Castor3D 0.12.0
Multiplatform 3D engine
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
castor3d::InstantiationComponent Class Reference

#include <InstantiationComponent.hpp>

Inheritance diagram for castor3d::InstantiationComponent:
Inheritance graph
[legend]
Collaboration diagram for castor3d::InstantiationComponent:
Collaboration graph
[legend]

Classes

struct  Data
 

Public Types

using InstanceDataMap = std::map< MaterialRPtr, Data >
 

Public Member Functions

C3D_API InstantiationComponent (Submesh &submesh, uint32_t threshold=1u)
 Constructor. More...
 
C3D_API uint32_t ref (MaterialRPtr material)
 Increments instance count. More...
 
C3D_API uint32_t unref (MaterialRPtr material)
 Decrements instance count. More...
 
C3D_API uint32_t getRefCount (MaterialRPtr material) const
 Retrieves the instances count. More...
 
C3D_API bool isInstanced (MaterialRPtr material) const
 
C3D_API bool isInstanced () const
 
C3D_API uint32_t getMaxRefCount () const
 
C3D_API void gather (ShaderFlags const &shaderFlags, ProgramFlags const &programFlags, MaterialRPtr material, ashes::BufferCRefArray &buffers, std::vector< uint64_t > &offsets, ashes::PipelineVertexInputStateCreateInfoCRefArray &layouts, TextureFlagsArray const &mask, uint32_t &currentLocation) override
 Gathers buffers that need to go in a vertex layout. More...
 
C3D_API SubmeshComponentSPtr clone (Submesh &submesh) const override
 
C3D_API ProgramFlags getProgramFlags (MaterialRPtr material) const override
 
uint32_t getThreshold () const
 
InstanceDataMap::const_iterator end () const
 
InstanceDataMap::iterator end ()
 
InstanceDataMap::const_iterator find (MaterialRPtr material) const
 
InstanceDataMap::iterator find (MaterialRPtr material)
 
- Public Member Functions inherited from castor3d::SubmeshComponent
C3D_API SubmeshComponent (Submesh &submesh, castor::String const &type, uint32_t id)
 Constructor. More...
 
virtual C3D_API ~SubmeshComponent () noexcept=default
 Destructor. More...
 
C3D_API bool initialise (RenderDevice const &device)
 Initialises the submesh. More...
 
C3D_API void cleanup (RenderDevice const &device)
 Cleans the submesh. More...
 
C3D_API void upload ()
 Uploads data on VRAM. More...
 
virtual C3D_API void gather (ShaderFlags const &shaderFlags, ProgramFlags const &programFlags, MaterialRPtr material, ashes::BufferCRefArray &buffers, std::vector< uint64_t > &offsets, ashes::PipelineVertexInputStateCreateInfoCRefArray &layouts, TextureFlagsArray const &mask, uint32_t &currentLocation)=0
 Gathers buffers that need to go in a vertex layout. More...
 
virtual C3D_API ProgramFlags getProgramFlags (MaterialRPtr material) const =0
 
virtual C3D_API VkBufferUsageFlags getUsageFlags () const
 
virtual C3D_API SubmeshComponentSPtr clone (Submesh &submesh) const =0
 
castor::String const & getType () const
 
void needsUpdate ()
 Sets the component to be updated. More...
 
uint32_t getID ()
 

Static Public Attributes

static C3D_API castor::String const Name
 
static C3D_API uint32_t constexpr BindingPoint = 2u
 

Member Typedef Documentation

◆ InstanceDataMap

using castor3d::InstantiationComponent::InstanceDataMap = std::map< MaterialRPtr, Data >

Constructor & Destructor Documentation

◆ InstantiationComponent()

C3D_API castor3d::InstantiationComponent::InstantiationComponent ( Submesh submesh,
uint32_t  threshold = 1u 
)
explicit

Constructor.

Parameters
[in]submeshThe parent submesh.
[in]thresholdThe threshold from which a submesh will be instantiated.

Member Function Documentation

◆ clone()

C3D_API SubmeshComponentSPtr castor3d::InstantiationComponent::clone ( Submesh submesh) const
overridevirtual

Returns
Clones this component into given submesh.
Parameters
[in,out]submeshReceives the cloned component.

Implements castor3d::SubmeshComponent.

◆ end() [1/2]

InstanceDataMap::iterator castor3d::InstantiationComponent::end ( )
inline

◆ end() [2/2]

InstanceDataMap::const_iterator castor3d::InstantiationComponent::end ( ) const
inline

◆ find() [1/2]

InstanceDataMap::iterator castor3d::InstantiationComponent::find ( MaterialRPtr  material)
inline

References castor3d::SubmeshComponent::needsUpdate().

Here is the call graph for this function:

◆ find() [2/2]

InstanceDataMap::const_iterator castor3d::InstantiationComponent::find ( MaterialRPtr  material) const
inline

◆ gather()

C3D_API void castor3d::InstantiationComponent::gather ( ShaderFlags const &  shaderFlags,
ProgramFlags const &  programFlags,
MaterialRPtr  material,
ashes::BufferCRefArray &  buffers,
std::vector< uint64_t > &  offsets,
ashes::PipelineVertexInputStateCreateInfoCRefArray &  layouts,
TextureFlagsArray const &  mask,
uint32_t &  currentLocation 
)
overridevirtual

Gathers buffers that need to go in a vertex layout.

Parameters
[in]shaderFlagsThe shader flags.
[in]programFlagsThe program flags.
[in]materialThe material.
[in,out]buffersReceives the buffers.
[in,out]offsetsReceives the buffers offsets.
[in,out]layoutsReceives the vertex layouts.
[in]maskThe textures mask.
[in,out]currentLocationThe current attribute location.

Implements castor3d::SubmeshComponent.

◆ getMaxRefCount()

C3D_API uint32_t castor3d::InstantiationComponent::getMaxRefCount ( ) const
Returns
The maximum instances count, amongst all materials.

◆ getProgramFlags()

C3D_API ProgramFlags castor3d::InstantiationComponent::getProgramFlags ( MaterialRPtr  material) const
overridevirtual

name Getters.

Implements castor3d::SubmeshComponent.

◆ getRefCount()

C3D_API uint32_t castor3d::InstantiationComponent::getRefCount ( MaterialRPtr  material) const

Retrieves the instances count.

Parameters
[in]materialThe material for which the instance count is retrieved
Returns
The value

◆ getThreshold()

uint32_t castor3d::InstantiationComponent::getThreshold ( ) const
inline

◆ isInstanced() [1/2]

C3D_API bool castor3d::InstantiationComponent::isInstanced ( ) const
Returns
true if the max instance count is greater than the threshold.

◆ isInstanced() [2/2]

C3D_API bool castor3d::InstantiationComponent::isInstanced ( MaterialRPtr  material) const
Parameters
[in]materialThe material.
Returns
true if the instance count for given material is greater than the threshold.

◆ ref()

C3D_API uint32_t castor3d::InstantiationComponent::ref ( MaterialRPtr  material)

Increments instance count.

Parameters
[in]materialThe material for which the instance count is incremented.
Returns
The previous instance count.

◆ unref()

C3D_API uint32_t castor3d::InstantiationComponent::unref ( MaterialRPtr  material)

Decrements instance count.

Parameters
[in]materialThe material for which the instance count is decremented.
Returns
The previous instance count.

Member Data Documentation

◆ BindingPoint

C3D_API uint32_t constexpr castor3d::InstantiationComponent::BindingPoint = 2u
staticconstexpr

◆ Name

C3D_API castor::String const castor3d::InstantiationComponent::Name
static

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