![]() |
Skylicht Engine
|
Abstract base class for GPU instancing logic in Skylicht-Engine. More...
#include <Material/Shader/Instancing/IShaderInstancing.h>
Public Member Functions | |
| IShaderInstancing () | |
| Constructor. Initializes descriptors to null. | |
| virtual | ~IShaderInstancing () |
| Destructor. | |
| virtual void | setupDescriptorForRenderLighting (const char *name) |
| Set up vertex descriptor for instanced rendering with lighting data. Adds necessary attributes for color, UV scaling, and world matrix. | |
| virtual bool | isSupport (IMeshBuffer *mb) |
| Check if instancing is supported for the given mesh buffer. Compares vertex descriptors to base and instanced formats. | |
| virtual bool | isSupport (IMesh *mesh) |
| Check if instancing is supported for the given mesh. Compares vertex descriptors for all mesh buffers. | |
| virtual IMeshBuffer * | createLinkMeshBuffer (IMeshBuffer *mb) |
| Create a mesh buffer that links to the vertex and index buffers of another mesh buffer. Used for instanced rendering. | |
| virtual IVertexBuffer * | createInstancingVertexBuffer ()=0 |
| Create a vertex buffer for instancing data (must be implemented by subclasses). | |
| virtual IMeshBuffer * | createMeshBuffer (video::E_INDEX_TYPE type)=0 |
| Create a mesh buffer for a specific index type (must be implemented by subclasses). | |
| virtual bool | applyInstancing (IMeshBuffer *meshbuffer, IVertexBuffer *instancingBuffer, IVertexBuffer *transformBuffer) |
| Apply instancing setup to a mesh buffer, binding instancing and transform buffers. | |
| virtual bool | applyInstancingForRenderLighting (IMeshBuffer *meshbuffer, IVertexBuffer *instancingBuffer, IVertexBuffer *transformBuffer) |
| Apply instancing setup for render lighting to a mesh buffer, binding buffers and using lighting descriptor. | |
| virtual bool | removeInstancing (IMeshBuffer *meshbuffer) |
| Remove instancing buffers from a mesh buffer, restoring the base descriptor. | |
| virtual bool | applyInstancing (IMesh *mesh, IVertexBuffer *instancingBuffer, IVertexBuffer *transformBuffer) |
| Apply instancing setup to all mesh buffers in a mesh, binding instancing and transform buffers. | |
| virtual bool | applyInstancingForRenderLighting (IMesh *mesh, IVertexBuffer *instancingBuffer, IVertexBuffer *transformBuffer) |
| Apply instancing setup for render lighting to all mesh buffers in a mesh. | |
| virtual bool | removeInstancing (IMesh *mesh) |
| Remove instancing buffers from all mesh buffers in a mesh, restoring the base descriptor. | |
| virtual void | batchIntancing (IVertexBuffer *vtxBuffer, CMaterial **materials, CEntity **entities, int count)=0 |
| Batch update instancing vertex buffer with transform and material data for multiple entities (must be implemented by subclasses). | |
| video::IVertexDescriptor * | getBaseVertexDescriptor () |
| Get the base vertex descriptor used for original mesh format. | |
| video::IVertexDescriptor * | getInstancingVertexDescriptor () |
| Get the instancing vertex descriptor used for instanced rendering format. | |
Static Public Member Functions | |
| static IVertexBuffer * | createTransformVertexBuffer () |
| Create a vertex buffer for transform matrices (static method). | |
| static IVertexBuffer * | createIndirectLightingVertexBuffer () |
| Create a vertex buffer for indirect lighting data (static method). | |
| static void | batchTransformAndLighting (IVertexBuffer *tBuffer, IVertexBuffer *lBuffer, CEntity **entities, int count) |
| Batch update transform and lighting vertex buffers for multiple entities (static method). | |
| static void | batchTransform (IVertexBuffer *tBuffer, CEntity **entities, int count) |
| Batch update transform vertex buffer for multiple entities (static method). | |
Protected Attributes | |
| video::IVertexDescriptor * | m_baseVtxDescriptor |
| The base vertex descriptor(original mesh format). | |
| video::IVertexDescriptor * | m_vtxDescriptor |
| Vertex descriptor for instanced rendering. | |
| video::IVertexDescriptor * | m_vtxDescriptorForRenderLighting |
| Vertex descriptor for instanced rendering with lighting data. | |
Abstract base class for GPU instancing logic in Skylicht-Engine.
Provides an interface for describing how vertex buffers and mesh buffers should be configured for hardware instancing, including batching transforms and lighting, descriptor setup, compatibility checks, and linking buffers.
|
virtual |
Apply instancing setup to all mesh buffers in a mesh, binding instancing and transform buffers.
| mesh | Target mesh. |
| instancingBuffer | Instancing vertex buffer. |
| transformBuffer | Transform vertex buffer. |
|
virtual |
Apply instancing setup to a mesh buffer, binding instancing and transform buffers.
| meshbuffer | Target mesh buffer. |
| instancingBuffer | Instancing vertex buffer. |
| transformBuffer | Transform vertex buffer. |
|
virtual |
Apply instancing setup for render lighting to all mesh buffers in a mesh.
| mesh | Target mesh. |
| instancingBuffer | Instancing vertex buffer. |
| transformBuffer | Transform vertex buffer. |
|
virtual |
Apply instancing setup for render lighting to a mesh buffer, binding buffers and using lighting descriptor.
| meshbuffer | Target mesh buffer. |
| instancingBuffer | Instancing vertex buffer. |
| transformBuffer | Transform vertex buffer. |
|
pure virtual |
Batch update instancing vertex buffer with transform and material data for multiple entities (must be implemented by subclasses).
| vtxBuffer | Instancing vertex buffer to fill. |
| materials | Array of materials per entity. |
| entities | Array of entities. |
| count | Number of instances. |
Implemented in Skylicht::C2TCoordColorInstancing, Skylicht::CSkinTBNSGInstancing, Skylicht::CStandardColorInstancing, Skylicht::CStandardSGInstancing, and Skylicht::CTBNSGInstancing.
|
static |
Batch update transform vertex buffer for multiple entities (static method).
| tBuffer | Transform vertex buffer. |
| entities | Array of entities. |
| count | Number of instances. |
|
static |
Batch update transform and lighting vertex buffers for multiple entities (static method).
| tBuffer | Transform vertex buffer. |
| lBuffer | Indirect lighting vertex buffer. |
| entities | Array of entities. |
| count | Number of instances. |
|
static |
Create a vertex buffer for indirect lighting data (static method).
|
pure virtual |
Create a vertex buffer for instancing data (must be implemented by subclasses).
Implemented in Skylicht::C2TCoordColorInstancing, Skylicht::CSkinTBNSGInstancing, Skylicht::CStandardColorInstancing, Skylicht::CStandardSGInstancing, and Skylicht::CTBNSGInstancing.
|
virtual |
Create a mesh buffer that links to the vertex and index buffers of another mesh buffer. Used for instanced rendering.
| mb | Source mesh buffer to link. |
|
pure virtual |
Create a mesh buffer for a specific index type (must be implemented by subclasses).
| type | Index buffer type. |
Implemented in Skylicht::C2TCoordColorInstancing, Skylicht::CSkinTBNSGInstancing, Skylicht::CStandardColorInstancing, Skylicht::CStandardSGInstancing, and Skylicht::CTBNSGInstancing.
|
static |
Create a vertex buffer for transform matrices (static method).
|
inline |
Get the base vertex descriptor used for original mesh format.
|
inline |
Get the instancing vertex descriptor used for instanced rendering format.
|
virtual |
Check if instancing is supported for the given mesh. Compares vertex descriptors for all mesh buffers.
| mesh | Mesh to check. |
|
virtual |
Check if instancing is supported for the given mesh buffer. Compares vertex descriptors to base and instanced formats.
| mb | Mesh buffer to check. |
|
virtual |
Remove instancing buffers from all mesh buffers in a mesh, restoring the base descriptor.
| mesh | Target mesh. |
|
virtual |
Remove instancing buffers from a mesh buffer, restoring the base descriptor.
| meshbuffer | Target mesh buffer. |
|
virtual |
Set up vertex descriptor for instanced rendering with lighting data. Adds necessary attributes for color, UV scaling, and world matrix.
| name | Name of the vertex descriptor. |