|
Aeon Engine c550894
AeonGames Open Source Game Engine
|
OpenGL rendering backend implementing the Renderer interface. More...
#include <C:/Code/AeonEngine/engine/renderers/opengl/OpenGLRenderer.hpp>


Public Member Functions | |
| OpenGLRenderer (void *aWindow) | |
| Construct from a native window handle. | |
| void | LoadMesh (const Mesh &aMesh) final |
| Loads mesh data into GPU memory. | |
| void | UnloadMesh (const Mesh &aMesh) final |
| Unloads mesh data from GPU memory. | |
| void * | GetContext () const |
| Get the platform-specific OpenGL rendering context. | |
| GLuint | GetVertexArrayObject () const |
| Get the shared vertex array object. | |
| GLuint | GetOverlayProgram () const |
| Get the overlay shader program identifier. | |
| GLuint | GetOverlayQuad () const |
| Get the overlay screen-quad buffer. | |
| void | BindMesh (const Mesh &aMesh) |
| Bind a mesh for subsequent draw calls. | |
| void | BindPipeline (const Pipeline &aPipeline) |
| Bind a pipeline (shader program) for rendering. | |
| void | SetMaterial (const Material &aMaterial) |
| Set the active material for rendering. | |
| void | SetSkeleton (const BufferAccessor &aSkeletonBuffer) const |
| Upload skeleton joint matrices for skinned rendering. | |
| void | SetMatrices (const OpenGLBuffer &aMatricesBuffer) const |
| Bind the matrices uniform buffer for the current draw. | |
| void | LoadPipeline (const Pipeline &aPipeline) final |
| Loads a rendering pipeline (shaders and state) into the renderer. | |
| void | UnloadPipeline (const Pipeline &aPipeline) final |
| Unloads a rendering pipeline from the renderer. | |
| void | LoadMaterial (const Material &aMaterial) final |
| Loads material data into the renderer. | |
| void | UnloadMaterial (const Material &aMaterial) final |
| Unloads material data from the renderer. | |
| void | LoadTexture (const Texture &aTexture) final |
| Loads a texture into GPU memory. | |
| void | UnloadTexture (const Texture &aTexture) final |
| Unloads a texture from GPU memory. | |
| GLuint | GetTextureId (const Texture &aTexture) |
| Get the OpenGL texture identifier for a loaded texture. | |
| void | AttachWindow (void *aWindowId) final |
| Attach a Window as a rendering surface. | |
| void | DetachWindow (void *aWindowId) final |
| Detach a Window as a rendering surface. | |
| void | SetProjectionMatrix (void *aWindowId, const Matrix4x4 &aMatrix) final |
| Sets the projection matrix for a specific window surface. | |
| void | SetViewMatrix (void *aWindowId, const Matrix4x4 &aMatrix) final |
| Sets the view matrix for a specific window surface. | |
| void | SetClearColor (void *aWindowId, float R, float G, float B, float A) final |
| Sets the color to be used to clear the window background. | |
| void | ResizeViewport (void *aWindowId, int32_t aX, int32_t aY, uint32_t aWidth, uint32_t aHeight) final |
| Resizes the specific window surface's viewport. | |
| void | BeginRender (void *aWindowId) final |
| Begins a render pass for the given window surface. | |
| void | EndRender (void *aWindowId) final |
| Ends the current render pass for the given window surface. | |
| void | Render (void *aWindowId, const Matrix4x4 &aModelMatrix, const Mesh &aMesh, const Pipeline &aPipeline, const Material *aMaterial=nullptr, const BufferAccessor *aSkeleton=nullptr, Topology aTopology=Topology::TRIANGLE_LIST, uint32_t aVertexStart=0, uint32_t aVertexCount=0xffffffff, uint32_t aInstanceCount=1, uint32_t aFirstInstance=0) const final |
| Issues a draw call for a mesh with the given pipeline and optional material. | |
| const Frustum & | GetFrustum (void *aWindowId) const final |
| Returns the view frustum for the given window surface. | |
| BufferAccessor | AllocateSingleFrameUniformMemory (void *aWindowId, size_t aSize) final |
| Allocates uniform buffer memory that is valid for a single frame. | |
| Public Member Functions inherited from AeonGames::Renderer | |
| virtual DLL | ~Renderer ()=0 |
| Virtual destructor. | |
Protected Member Functions | |
| void | InitializeOverlay () |
| Initialize overlay shader program and quad buffer. | |
| void | FinalizeOverlay () |
| Release overlay shader program and quad buffer. | |
Protected Attributes | |
| GLuint | mVertexArrayObject {} |
| General VAO. | |
| GLuint | mOverlayProgram {} |
| Raw overlay shader program. | |
| OpenGLBuffer | mOverlayQuad {} |
| Overlay quadrilateral. | |
| OpenGLPipeline * | mCurrentPipeline {nullptr} |
| Currently bound pipeline. | |
| std::unordered_map< size_t, OpenGLPipeline > | mPipelineStore {} |
| Loaded pipeline cache. | |
| std::unordered_map< size_t, OpenGLMaterial > | mMaterialStore {} |
| Loaded material cache. | |
| std::unordered_map< size_t, OpenGLMesh > | mMeshStore {} |
| Loaded mesh cache. | |
| std::unordered_map< size_t, OpenGLTexture > | mTextureStore {} |
| Loaded texture cache. | |
| std::unordered_map< void *, OpenGLWindow > | mWindowStore {} |
| Attached window map. | |
OpenGL rendering backend implementing the Renderer interface.
Definition at line 44 of file OpenGLRenderer.hpp.
|
finalvirtual |
Allocates uniform buffer memory that is valid for a single frame.
| aWindowId | Platform dependent window handle. |
| aSize | Size in bytes of the requested allocation. |
Implements AeonGames::Renderer.
Definition at line 780 of file OpenGLRenderer.cpp.
|
finalvirtual |
Attach a Window as a rendering surface.
| aWindowId | Platform depended window handle. |
Implements AeonGames::Renderer.
Definition at line 669 of file OpenGLRenderer.cpp.
|
finalvirtual |
Begins a render pass for the given window surface.
| aWindowId | Platform dependent window handle. |
Implements AeonGames::Renderer.
Definition at line 732 of file OpenGLRenderer.cpp.
| void AeonGames::OpenGLRenderer::BindMesh | ( | const Mesh & | aMesh | ) |
Bind a mesh for subsequent draw calls.
Definition at line 524 of file OpenGLRenderer.cpp.
| void AeonGames::OpenGLRenderer::BindPipeline | ( | const Pipeline & | aPipeline | ) |
Bind a pipeline (shader program) for rendering.
Definition at line 557 of file OpenGLRenderer.cpp.
|
finalvirtual |
Detach a Window as a rendering surface.
| aWindowId | Platform depended window handle. |
Implements AeonGames::Renderer.
Definition at line 683 of file OpenGLRenderer.cpp.
|
finalvirtual |
Ends the current render pass for the given window surface.
| aWindowId | Platform dependent window handle. |
Implements AeonGames::Renderer.
Definition at line 741 of file OpenGLRenderer.cpp.
|
protected |
Release overlay shader program and quad buffer.
Definition at line 482 of file OpenGLRenderer.cpp.
| void * AeonGames::OpenGLRenderer::GetContext | ( | ) | const |
Get the platform-specific OpenGL rendering context.
Definition at line 791 of file OpenGLRenderer.cpp.
|
finalvirtual |
Returns the view frustum for the given window surface.
| aWindowId | Platform dependent window handle. |
Implements AeonGames::Renderer.
Definition at line 770 of file OpenGLRenderer.cpp.
| GLuint AeonGames::OpenGLRenderer::GetOverlayProgram | ( | ) | const |
Get the overlay shader program identifier.
Definition at line 659 of file OpenGLRenderer.cpp.
| GLuint AeonGames::OpenGLRenderer::GetOverlayQuad | ( | ) | const |
Get the overlay screen-quad buffer.
Definition at line 664 of file OpenGLRenderer.cpp.
| GLuint AeonGames::OpenGLRenderer::GetTextureId | ( | const Texture & | aTexture | ) |
Get the OpenGL texture identifier for a loaded texture.
Definition at line 643 of file OpenGLRenderer.cpp.
| GLuint AeonGames::OpenGLRenderer::GetVertexArrayObject | ( | ) | const |
Get the shared vertex array object.
Definition at line 654 of file OpenGLRenderer.cpp.
|
protected |
Initialize overlay shader program and quad buffer.
Definition at line 406 of file OpenGLRenderer.cpp.
|
finalvirtual |
Loads material data into the renderer.
| aMaterial | The material to load. |
Implements AeonGames::Renderer.
Definition at line 610 of file OpenGLRenderer.cpp.
|
finalvirtual |
Loads mesh data into GPU memory.
| aMesh | The mesh to load. |
Implements AeonGames::Renderer.
Definition at line 504 of file OpenGLRenderer.cpp.
|
finalvirtual |
Loads a rendering pipeline (shaders and state) into the renderer.
| aPipeline | The pipeline to load. |
Implements AeonGames::Renderer.
Definition at line 539 of file OpenGLRenderer.cpp.
|
finalvirtual |
Loads a texture into GPU memory.
| aTexture | The texture to load. |
Implements AeonGames::Renderer.
Definition at line 626 of file OpenGLRenderer.cpp.
|
finalvirtual |
Issues a draw call for a mesh with the given pipeline and optional material.
| aWindowId | Platform dependent window handle. |
| aModelMatrix | Model transformation matrix. |
| aMesh | Mesh to render. |
| aPipeline | Pipeline (shaders/state) to use. |
| aMaterial | Optional material to bind. |
| aSkeleton | Optional skeleton buffer for skinned meshes. |
| aTopology | Primitive topology (default: TRIANGLE_LIST). |
| aVertexStart | First vertex index. |
| aVertexCount | Number of vertices to draw (default: all). |
| aInstanceCount | Number of instances to draw. |
| aFirstInstance | Index of the first instance. |
Implements AeonGames::Renderer.
Definition at line 750 of file OpenGLRenderer.cpp.
|
finalvirtual |
Resizes the specific window surface's viewport.
| aWindowId | Platform dependent window handle. |
| aX | X coordinate of the viewport. |
| aY | Y coordinate of the viewport. |
| aWidth | Width of the viewport. |
| aHeight | Height of the viewport. |
Implements AeonGames::Renderer.
Definition at line 722 of file OpenGLRenderer.cpp.
|
finalvirtual |
Sets the color to be used to clear the window background.
| aWindowId | Platform depended window handle. |
| R | Red component of the clear color. |
| G | Green component of the clear color. |
| B | Blue component of the clear color. |
| A | Alpha component of the clear color. |
Implements AeonGames::Renderer.
Definition at line 713 of file OpenGLRenderer.cpp.
| void AeonGames::OpenGLRenderer::SetMaterial | ( | const Material & | aMaterial | ) |
Set the active material for rendering.
Definition at line 570 of file OpenGLRenderer.cpp.
| void AeonGames::OpenGLRenderer::SetMatrices | ( | const OpenGLBuffer & | aMatricesBuffer | ) | const |
Bind the matrices uniform buffer for the current draw.
Definition at line 596 of file OpenGLRenderer.cpp.
|
finalvirtual |
Sets the projection matrix for a specific window surface.
| aWindowId | Platform depended window handle. |
| aMatrix | The projection matrix. |
Implements AeonGames::Renderer.
Definition at line 693 of file OpenGLRenderer.cpp.
| void AeonGames::OpenGLRenderer::SetSkeleton | ( | const BufferAccessor & | aSkeletonBuffer | ) | const |
Upload skeleton joint matrices for skinned rendering.
Definition at line 582 of file OpenGLRenderer.cpp.
|
finalvirtual |
Sets the view matrix for a specific window surface.
| aWindowId | Platform depended window handle. |
| aMatrix | The view matrix. |
Implements AeonGames::Renderer.
Definition at line 703 of file OpenGLRenderer.cpp.
|
finalvirtual |
Unloads material data from the renderer.
| aMaterial | The material to unload. |
Implements AeonGames::Renderer.
Definition at line 619 of file OpenGLRenderer.cpp.
|
finalvirtual |
Unloads mesh data from GPU memory.
| aMesh | The mesh to unload. |
Implements AeonGames::Renderer.
Definition at line 515 of file OpenGLRenderer.cpp.
|
finalvirtual |
Unloads a rendering pipeline from the renderer.
| aPipeline | The pipeline to unload. |
Implements AeonGames::Renderer.
Definition at line 550 of file OpenGLRenderer.cpp.
|
finalvirtual |
Unloads a texture from GPU memory.
| aTexture | The texture to unload. |
Implements AeonGames::Renderer.
Definition at line 636 of file OpenGLRenderer.cpp.
|
protected |
Currently bound pipeline.
Definition at line 134 of file OpenGLRenderer.hpp.
|
protected |
Loaded material cache.
Definition at line 136 of file OpenGLRenderer.hpp.
|
protected |
Loaded mesh cache.
Definition at line 137 of file OpenGLRenderer.hpp.
|
protected |
Loaded pipeline cache.
Definition at line 135 of file OpenGLRenderer.hpp.
|
protected |
Loaded texture cache.
Definition at line 138 of file OpenGLRenderer.hpp.
|
protected |
General VAO.
Definition at line 121 of file OpenGLRenderer.hpp.
|
protected |
Attached window map.
Definition at line 139 of file OpenGLRenderer.hpp.