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

#include <LightBuffer.hpp>

Classes

struct  Float4
 
struct  Float4x4
 
struct  LightData
 
union  SpecLight
 

Public Types

using LightsData = castor::ArrayView< LightData >
 

Public Member Functions

C3D_API LightBuffer (Engine &engine, RenderDevice const &device, uint32_t count)
 Constructor. More...
 
C3D_API void addLight (Light &light)
 Adds a light source to the buffer. More...
 
C3D_API void removeLight (Light &light)
 Removes a light source from the buffer. More...
 
C3D_API void update (CpuUpdater &updater)
 Updates the buffer CPU wise. More...
 
C3D_API void upload (ashes::CommandBuffer const &commandBuffer)
 Uploads the buffer to VRAM. More...
 
C3D_API VkDescriptorSetLayoutBinding createLayoutBinding (uint32_t binding) const
 Creates the descriptor set layout binding. More...
 
C3D_API void createPassBinding (crg::FramePass &pass, uint32_t binding) const
 Creates a frame pass binding. More...
 
C3D_API ashes::WriteDescriptorSet getBinding (uint32_t binding) const
 Creates the descriptor write for this buffer. More...
 
C3D_API ashes::WriteDescriptorSet getBinding (uint32_t binding, VkDeviceSize offset, VkDeviceSize size) const
 Creates the descriptor write for this buffer. More...
 
C3D_API void createBinding (ashes::DescriptorSet &descriptorSet, VkDescriptorSetLayoutBinding const &binding) const
 Creates the descriptor set binding at given point. More...
 
C3D_API LightDatagetData (Light const &light)
 
C3D_API uint32_t getIndex (Light const &light) const
 
uint8_t * getPtr ()
 
VkDescriptorType getType () const
 
LightsArray getLights (LightType type) const
 
LightDataoperator[] (size_t index)
 
LightData const & operator[] (size_t index) const
 

Static Public Attributes

static constexpr uint32_t DataSize = sizeof( LightData )
 

Member Typedef Documentation

◆ LightsData

using castor3d::LightBuffer::LightsData = castor::ArrayView< LightData >

Constructor & Destructor Documentation

◆ LightBuffer()

C3D_API castor3d::LightBuffer::LightBuffer ( Engine engine,
RenderDevice const &  device,
uint32_t  count 
)

Constructor.

Parameters
[in]engineThe engine.
[in]deviceThe GPU device.
[in]countThe max passes count.

Member Function Documentation

◆ addLight()

C3D_API void castor3d::LightBuffer::addLight ( Light light)

Adds a light source to the buffer.

Parameters
[in]lightThe light source.

◆ createBinding()

C3D_API void castor3d::LightBuffer::createBinding ( ashes::DescriptorSet &  descriptorSet,
VkDescriptorSetLayoutBinding const &  binding 
) const

Creates the descriptor set binding at given point.

Parameters
[in]descriptorSetThe descriptor set that receives the binding.
[in]bindingThe descriptor set layout binding.

◆ createLayoutBinding()

C3D_API VkDescriptorSetLayoutBinding castor3d::LightBuffer::createLayoutBinding ( uint32_t  binding) const

Creates the descriptor set layout binding.

◆ createPassBinding()

C3D_API void castor3d::LightBuffer::createPassBinding ( crg::FramePass &  pass,
uint32_t  binding 
) const

Creates a frame pass binding.

◆ getBinding() [1/2]

C3D_API ashes::WriteDescriptorSet castor3d::LightBuffer::getBinding ( uint32_t  binding) const

Creates the descriptor write for this buffer.

◆ getBinding() [2/2]

C3D_API ashes::WriteDescriptorSet castor3d::LightBuffer::getBinding ( uint32_t  binding,
VkDeviceSize  offset,
VkDeviceSize  size 
) const

Creates the descriptor write for this buffer.

◆ getData()

C3D_API LightData & castor3d::LightBuffer::getData ( Light const &  light)
Returns
The pointer to the data for given light source.

◆ getIndex()

C3D_API uint32_t castor3d::LightBuffer::getIndex ( Light const &  light) const
Returns
The light source buffer index.

◆ getLights()

LightsArray castor3d::LightBuffer::getLights ( LightType  type) const
inline

◆ getPtr()

uint8_t * castor3d::LightBuffer::getPtr ( )
inline

References castor3d::ShaderBuffer::getPtr().

Here is the call graph for this function:

◆ getType()

VkDescriptorType castor3d::LightBuffer::getType ( ) const
inline

References castor3d::ShaderBuffer::getType().

Here is the call graph for this function:

◆ operator[]() [1/2]

LightData & castor3d::LightBuffer::operator[] ( size_t  index)
inline

◆ operator[]() [2/2]

LightData const & castor3d::LightBuffer::operator[] ( size_t  index) const
inline

◆ removeLight()

C3D_API void castor3d::LightBuffer::removeLight ( Light light)

Removes a light source from the buffer.

Parameters
[in]lightThe light source.

◆ update()

C3D_API void castor3d::LightBuffer::update ( CpuUpdater updater)

Updates the buffer CPU wise.

Parameters
[in,out]updaterThe update data.

◆ upload()

C3D_API void castor3d::LightBuffer::upload ( ashes::CommandBuffer const &  commandBuffer)

Uploads the buffer to VRAM.

Parameters
[in]commandBufferReceives the upload commands.

Member Data Documentation

◆ DataSize

constexpr uint32_t castor3d::LightBuffer::DataSize = sizeof( LightData )
staticconstexpr

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