Castor3D 0.16.0
Multiplatform 3D engine
|
#include <LightCache.hpp>
Public Types | |
using | ElementT = Light |
using | ElementKeyT = castor::String |
using | ElementCacheTraitsT = LightCacheTraits |
using | ElementObjectCacheT = ObjectCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT > |
using | ElementPtrT = typename ElementObjectCacheT::ElementPtrT |
using | ElementContT = typename ElementObjectCacheT::ElementContT |
using | ElementInitialiserT = typename ElementObjectCacheT::ElementInitialiserT |
using | ElementCleanerT = typename ElementObjectCacheT::ElementCleanerT |
using | ElementMergerT = typename ElementObjectCacheT::ElementMergerT |
using | ElementAttacherT = typename ElementObjectCacheT::ElementAttacherT |
using | ElementDetacherT = typename ElementObjectCacheT::ElementDetacherT |
Public Types inherited from castor3d::ObjectCacheBaseT< Light, castor::String, LightCacheTraits > | |
using | OnChangedFunction |
using | OnChanged |
Public Types inherited from castor::ResourceCacheBaseT< ResT, KeyT, TraitsT > | |
using | ElementT = ResT |
using | ElementKeyT = KeyT |
using | ElementCacheTraitsT = TraitsT |
using | ElementCacheBaseT = ResourceCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT > |
using | ElementCacheT = typename ElementCacheTraitsT::ElementCacheT |
using | ElementPtrT = typename ElementCacheTraitsT::ElementPtrT |
using | ElementObsT = typename ElementCacheTraitsT::ElementObsT |
using | ElementContT = typename ElementCacheTraitsT::ElementContT |
using | ElementInitialiserT = typename ElementCacheTraitsT::ElementInitialiserT |
using | ElementCleanerT = typename ElementCacheTraitsT::ElementCleanerT |
using | ElementMergerT = typename ElementCacheTraitsT::ElementMergerT |
Public Member Functions | |
C3D_API | ObjectCacheT (Scene &scene, SceneNodeRPtr rootNode, SceneNodeRPtr rootCameraNode, SceneNodeRPtr rootObjectNode) |
Constructor. | |
C3D_API void | initialise (castor3d::RenderDevice const &device) |
Intialises GPU buffer. | |
C3D_API void | cleanup () |
Sets all the elements to be cleaned up. | |
C3D_API void | update (CpuUpdater &updater) |
Updates the render pass, CPU wise. | |
C3D_API void | upload (UploadData &uploader) const |
Uploads all GPU buffers to VRAM. | |
C3D_API LightsArray | getLights (LightType type) const |
Retrieves the lights of given type. | |
C3D_API void | createPassBinding (crg::FramePass &pass, uint32_t binding) const |
Creates a frame pass binding. | |
C3D_API VkDescriptorSetLayoutBinding | createLayoutBinding (VkShaderStageFlags stages, uint32_t index) const |
Creates the descriptor set layout binding at given point. | |
C3D_API void | addLayoutBinding (ashes::VkDescriptorSetLayoutBindingArray &bindings, VkShaderStageFlags stages, uint32_t &index) const |
Adds the descriptor set layout binding at given point. | |
C3D_API ashes::WriteDescriptorSet | getBinding (uint32_t binding) const |
Creates the descriptor write for the lights buffer. | |
C3D_API void | addBinding (ashes::WriteDescriptorSetArray &writes, uint32_t &binding) const |
Creates the descriptor write for the lights buffer. | |
C3D_API ashes::WriteDescriptorSet | getBinding (uint32_t binding, VkDeviceSize offset, VkDeviceSize size) const |
Creates the descriptor write for the lights buffer. | |
C3D_API uint32_t | getLightsBufferCount (LightType type) const noexcept |
uint32_t | getLightsCount (LightType type) const |
bool | isDirty () const noexcept |
bool | hasClusteredLights () const noexcept |
Public Member Functions inherited from castor3d::ObjectCacheBaseT< Light, castor::String, LightCacheTraits > | |
void | mergeInto (ElementObjectCacheT &destination) |
Merges this cache's elements to the one given. | |
Engine * | getEngine () const noexcept |
castor::String const & | getObjectTypeName () const noexcept |
Public Member Functions inherited from castor::OwnedBy< Scene > | |
Scene * | getOwner () const |
Public Member Functions inherited from castor::ResourceCacheBaseT< ResT, KeyT, TraitsT > | |
ResourceCacheBaseT (ResourceCacheBaseT const &)=delete | |
ResourceCacheBaseT & | operator= (ResourceCacheBaseT const &)=delete |
ResourceCacheBaseT (ResourceCacheBaseT &&) noexcept=delete | |
ResourceCacheBaseT & | operator= (ResourceCacheBaseT &&) noexcept=delete |
void | cleanup () noexcept |
Sets all the elements to be cleaned up. | |
void | clear () noexcept |
Flushes the collection. | |
template<typename ... ParametersT> | |
ElementPtrT | create (ElementKeyT const &name, ParametersT &&... parameters) const |
Creates an element. | |
ElementObsT | tryAdd (ElementKeyT const &name, ElementPtrT &element, bool initialise=false) |
Adds an element. | |
ElementObsT | tryAddNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=false) |
Adds an element. | |
ElementObsT | add (ElementKeyT const &name, ElementPtrT &element, bool initialise=true) |
Logging version of tryAdd. | |
ElementObsT | addNoLock (ElementKeyT const &name, ElementPtrT &element, bool initialise=true) |
Logging version of tryAdd. | |
template<typename ... ParametersT> | |
ElementObsT | tryAdd (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters) |
Add an element, constructed in-place. | |
template<typename ... ParametersT> | |
ElementObsT | tryAddNoLock (ElementKeyT const &name, bool initialise, ElementObsT &created, ParametersT &&... parameters) |
Add an element, constructed in-place. | |
template<typename ... ParametersT> | |
ElementObsT | add (ElementKeyT const &name, ParametersT &&... parameters) |
Logging version of tryAdd. | |
template<typename ... ParametersT> | |
ElementObsT | addNoLock (ElementKeyT const &name, ParametersT &&... parameters) |
Logging version of tryAdd. | |
ElementPtrT | tryRemove (ElementKeyT const &name, bool cleanup=false) noexcept |
Removes an element, given a name. | |
ElementPtrT | tryRemoveNoLock (ElementKeyT const &name, bool cleanup=false) noexcept |
Removes an element, given a name. | |
ElementPtrT | remove (ElementKeyT const &name, bool cleanup=false) noexcept |
Logging version of tryRemove. | |
ElementPtrT | removeNoLock (ElementKeyT const &name, bool cleanup=false) noexcept |
Logging version of tryRemove. | |
void | rename (ElementKeyT const &oldName, ElementKeyT const &newName) |
Renames a resource. | |
ElementObsT | tryFind (ElementKeyT const &name) const noexcept |
Looks for an element with given name. | |
ElementObsT | tryFindNoLock (ElementKeyT const &name) const noexcept |
Looks for an element with given name. | |
ElementObsT | find (ElementKeyT const &name) const |
Logging version of tryRemove. | |
ElementObsT | findNoLock (ElementKeyT const &name) const |
Logging version of tryRemove. | |
void | mergeInto (ElementCacheBaseT &destination) |
Merges this cache's elements to the one given. | |
template<typename FuncType > | |
void | forEach (FuncType func) const |
template<typename FuncType > | |
void | forEach (FuncType func) |
uint32_t | getObjectCount () const noexcept |
uint32_t | getObjectCountNoLock () const noexcept |
String const & | getObjectTypeName () const noexcept |
bool | has (ElementKeyT const &name) const noexcept |
bool | hasNoLock (ElementKeyT const &name) const noexcept |
bool | isEmpty () const noexcept |
bool | isEmptyNoLock () const noexcept |
void | lock () const |
void | unlock () const noexcept |
auto | begin () noexcept |
auto | begin () const noexcept |
auto | end () noexcept |
auto | end () const noexcept |
void | reportCreation (String const &name) const |
void | reportAdded (String const &name) const |
void | reportDuplicate (String const &name) const |
void | reportNull () const |
void | reportUnknown (String const &name) const |
Light cache.
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementAttacherT = typename ElementObjectCacheT::ElementAttacherT |
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementCacheTraitsT = LightCacheTraits |
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementCleanerT = typename ElementObjectCacheT::ElementCleanerT |
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementContT = typename ElementObjectCacheT::ElementContT |
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementDetacherT = typename ElementObjectCacheT::ElementDetacherT |
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementInitialiserT = typename ElementObjectCacheT::ElementInitialiserT |
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementKeyT = castor::String |
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementMergerT = typename ElementObjectCacheT::ElementMergerT |
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementObjectCacheT = ObjectCacheBaseT< ElementT, ElementKeyT, ElementCacheTraitsT > |
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementPtrT = typename ElementObjectCacheT::ElementPtrT |
using castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ElementT = Light |
C3D_API castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::ObjectCacheT | ( | Scene & | scene, |
SceneNodeRPtr | rootNode, | ||
SceneNodeRPtr | rootCameraNode, | ||
SceneNodeRPtr | rootObjectNode ) |
Constructor.
[in] | scene | The scene. |
[in] | rootNode | The root node. |
[in] | rootCameraNode | The cameras root node. |
[in] | rootObjectNode | The objects root node. |
C3D_API void castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::addBinding | ( | ashes::WriteDescriptorSetArray & | writes, |
uint32_t & | binding ) const |
Creates the descriptor write for the lights buffer.
C3D_API void castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::addLayoutBinding | ( | ashes::VkDescriptorSetLayoutBindingArray & | bindings, |
VkShaderStageFlags | stages, | ||
uint32_t & | index ) const |
Adds the descriptor set layout binding at given point.
[in,out] | bindings | Receives the binding. |
[in] | stages | The impacted shader stages. |
[in,out] | index | The binding index. |
C3D_API void castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::cleanup | ( | ) |
Sets all the elements to be cleaned up.
C3D_API VkDescriptorSetLayoutBinding castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::createLayoutBinding | ( | VkShaderStageFlags | stages, |
uint32_t | index ) const |
Creates the descriptor set layout binding at given point.
[in] | stages | The impacted shader stages. |
[in] | index | The binding point index. |
C3D_API void castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::createPassBinding | ( | crg::FramePass & | pass, |
uint32_t | binding ) const |
Creates a frame pass binding.
C3D_API ashes::WriteDescriptorSet castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::getBinding | ( | uint32_t | binding | ) | const |
Creates the descriptor write for the lights buffer.
C3D_API ashes::WriteDescriptorSet castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::getBinding | ( | uint32_t | binding, |
VkDeviceSize | offset, | ||
VkDeviceSize | size ) const |
Creates the descriptor write for the lights buffer.
C3D_API LightsArray castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::getLights | ( | LightType | type | ) | const |
Retrieves the lights of given type.
[in] | type | The light type. |
|
noexcept |
[in] | type | The light type. |
|
inline |
|
inlinenoexcept |
References castor3d::ePoint, and castor3d::eSpot.
C3D_API void castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::initialise | ( | castor3d::RenderDevice const & | device | ) |
Intialises GPU buffer.
[in] | device | The GPU device. |
|
inlinenoexcept |
C3D_API void castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::update | ( | CpuUpdater & | updater | ) |
Updates the render pass, CPU wise.
[in,out] | updater | The update data. |
C3D_API void castor3d::ObjectCacheT< Light, castor::String, LightCacheTraits >::upload | ( | UploadData & | uploader | ) | const |
Uploads all GPU buffers to VRAM.
[in,out] | uploader | Receives the upload requests. |