Allolib  1.0
C++ Components For Interactive Multimedia
al::RenderManager Class Reference

RenderManager class. More...

#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/graphics/al_RenderManager.hpp>

Inheritance diagram for al::RenderManager:
al::Graphics

Public Member Functions

void multModelMatrix (const Matrix4f &m)
 Multiply current matrix.
 
void multViewMatrix (const Matrix4f &m)
 
void multProjMatrix (const Matrix4f &m)
 
Matrix4f modelMatrix () const
 
Matrix4f viewMatrix () const
 
Matrix4f projMatrix () const
 
void modelMatrix (const Matrix4f &m)
 
void viewMatrix (const Matrix4f &m)
 
void projMatrix (const Matrix4f &m)
 
void pushModelMatrix ()
 
void pushViewMatrix ()
 
void pushProjMatrix ()
 
void pushModelMatrix (const Matrix4f &m)
 
void pushViewMatrix (const Matrix4f &m)
 
void pushProjMatrix (const Matrix4f &m)
 
void popModelMatrix ()
 
void popViewMatrix ()
 
void popProjMatrix ()
 
void resetModelMatrixStack ()
 
void resetViewMatrixStack ()
 
void resetProjMatrixStack ()
 
void resetMatrixStack ()
 
void pushMatrix ()
 Push current matrix stack.
 
void pushMatrix (const Matrix4f &m)
 
void popMatrix ()
 Pop current matrix stack.
 
void loadIdentity ()
 Set current matrix to identity.
 
void translate (float x, float y, float z=0.)
 Translate current matrix.
 
template<class T >
void translate (const Vec< 3, T > &v)
 Translate current matrix.
 
template<class T >
void translate (const Vec< 2, T > &v)
 Translate current matrix.
 
void rotate (float angle, float x=0., float y=0., float z=1.)
 
void rotate (const Quatf &q)
 Rotate current matrix.
 
void rotate (const Quatd &q)
 Rotate current matrix.
 
template<class T >
void rotate (float angle, const Vec< 3, T > &axis)
 
void scale (float x, float y, float z=1.)
 Scale current matrix along each dimension.
 
void scale (float s)
 Scale current matrix uniformly.
 
template<class T >
void scale (const Vec< 3, T > &v)
 Scale current matrix along each dimension.
 
template<class T >
void scale (const Vec< 2, T > &v)
 Scale current matrix along each dimension.
 
void viewport (int left, int bottom, int width, int height)
 Set viewport.
 
void viewport (const Viewport &v)
 
Viewport viewport ()
 
void pushViewport ()
 
void popViewport ()
 
void pushViewport (int l, int b, int w, int h)
 
void pushViewport (const Viewport &v)
 
void pushViewport (int w, int h)
 
void framebuffer (EasyFBO &easyFBO)
 
void framebuffer (FBO &fbo)
 
void framebuffer (unsigned int id)
 
unsigned int framebuffer ()
 
void pushFramebuffer ()
 
void popFramebuffer ()
 
void pushFramebuffer (EasyFBO &f)
 
void pushFramebuffer (FBO &f)
 
void pushFramebuffer (unsigned int f)
 
void shader (ShaderProgram &s)
 
ShaderProgramshader ()
 
ShaderProgramshaderPtr ()
 
virtual void camera (Viewpoint const &v)
 
virtual void camera (Viewpoint::SpecialType v)
 
void pushCamera ()
 
void popCamera ()
 
void pushCamera (Viewpoint const &v)
 
void pushCamera (Viewpoint::SpecialType v)
 
virtual void update ()
 
void draw (VAOMesh &mesh)
 
void draw (EasyVAO &vao)
 
void draw (const Mesh &mesh)
 
void draw (Mesh &&mesh)
 

Protected Attributes

ShaderProgrammShaderPtr = nullptr
 
std::unordered_map< unsigned int, int > modelviewLocs
 
std::unordered_map< unsigned int, int > projLocs
 
bool mShaderChanged = false
 
MatrixStack mViewStack
 
MatrixStack mProjStack
 
MatrixStack mModelStack
 
bool mMatChanged = false
 
ViewportStack mViewportStack
 
EasyVAO mInternalVAO
 
FBOStack mFBOStack
 

Detailed Description

RenderManager class.

Render manager handles basic rendering states

  1. model / view / projection matrix
    • model matrix can be directly set
    • or can be set with translate / rotate / scale functions
    • view and projection matrix can be directly set
    • or can be set using Viewpoint class and RenderManager::camera function
    • matrices can be push / pop'ed
    • pushing and popping camera will push/pop both iew/proj mat
  2. viewport and framebuffer
    • keeps track of current state
    • also provides push / pop functionality
  3. shaders
    • keeps track of current shader
    • get & cache location and set values of uniforms for model, view, projection matrix
  4. drawing mesh
    • sending vertex position/color/normal/texcoord to bound shader
    • mesh can be regular cpu-side al::Mesh
    • or gpu-stored al::VAOMesh

!. writing shader for al::RenderManager

  • modelview matrix: uniform mat4 l_ModelViewMatrix;
  • projection matrix: uniform mat4 al_ProjectionMatrix;
  • vertex position layout (location = 0) in vec3 position;
  • vertex color: layout (location = 1) in vec4 color;
  • vertex texcoord: layout (location = 2) in vec2 texcoord;
  • vertex normal: layout (location = 3) in vec3 normal;

Definition at line 98 of file al_RenderManager.hpp.

Member Function Documentation

◆ rotate() [1/2]

template<class T >
void al::RenderManager::rotate ( float  angle,
const Vec< 3, T > &  axis 
)
inline

Rotate current matrix

Parameters
[in]angleangle, in degrees
[in]axisrotation axis

Definition at line 213 of file al_RenderManager.hpp.

◆ rotate() [2/2]

void al::RenderManager::rotate ( float  angle,
float  x = 0.,
float  y = 0.,
float  z = 1. 
)

Rotate current matrix

Parameters
[in]angleangle, in degrees
[in]xx component of rotation axis
[in]yy component of rotation axis
[in]zz component of rotation axis

The documentation for this class was generated from the following file: