Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
|
Describes a top level accerlation structure. A tlas usually holds multiple Blas. A blas is an object/mesh instance together with its transformation in 3d space. More...
#include <foray_tlas.hpp>
Public Member Functions | |
Tlas ()=default | |
virtual | ~Tlas () |
virtual std::string_view | GetTypeName () const override |
Return a hint for the type of resource managed by the instantiation. | |
virtual void | CreateOrUpdate (core::Context *context=nullptr) |
(Re)creates the TLAS. Required to invoke when changes to the TLAS transitioned it to Dirty state. Will synchronize with the CPU. | |
virtual void | UpdateLean (VkCommandBuffer cmdBuffer, uint32_t frameIndex) |
Updates transforms only. TLAS rebuild is performed and synchronized on GPU only. TLAS must by non-Dirty! | |
virtual bool | Exists () const override |
Return true, if the managed resource is allocated. | |
virtual void | Destroy () override |
Destroy the resource. | |
operator VkAccelerationStructureKHR () | |
void | RemoveBlasInstance (uint64_t id) |
Remove a BLAS instance. | |
const BlasInstance * | GetBlasInstance (uint64_t id) const |
Get A BLAS instance by id. | |
uint64_t | AddBlasInstanceAuto (scene::ncomp::MeshInstance *meshInstance) |
Add a BLAS instance from meshInstance component. | |
uint64_t | AddBlasInstanceAnimated (const Blas &blas, BlasInstance::TransformUpdateFunc getUpdatedGlobalTransformFunc) |
Add an animated BLAS instance. | |
uint64_t | AddBlasInstanceStatic (const Blas &blas, const glm::mat4 &transform) |
Add a static BLAS instance. | |
void | ClearBlasInstances () |
Clear all instances. | |
![]() | |
ManagedResource () | |
Default constructor registers the resource. | |
ManagedResource (std::string_view name) | |
Registers the resource and sets its name. | |
virtual | ~ManagedResource () |
Unregisters the resource. | |
std::string_view | GetName () const |
Return a custom name for the object. | |
virtual void | SetName (std::string_view name) |
Set a custom name for the object. | |
std::string | Print () const |
Print name and type in one string. | |
![]() | |
NoMoveDefaults ()=default | |
NoMoveDefaults (const NoMoveDefaults &other)=delete | |
NoMoveDefaults (NoMoveDefaults &&other)=default | |
NoMoveDefaults & | operator= (const NoMoveDefaults &other)=delete |
Protected Attributes | |
core::Context * | mContext = nullptr |
bool | mDirty = false |
VkAccelerationStructureKHR | mAccelerationStructure = nullptr |
core::ManagedBuffer | mTlasMemory |
util::DualBuffer | mInstanceBuffer |
core::ManagedBuffer | mScratchBuffer |
VkDeviceAddress | mTlasAddress = 0 |
std::map< uint64_t, BlasInstance > | mAnimatedBlasInstances |
std::map< uint64_t, BlasInstance > | mStaticBlasInstances |
uint64_t | mNextId = 0 |
GeometryMetaBuffer | mMetaBuffer |
![]() | |
std::string | mName |
This objects custom name. | |
Additional Inherited Members | |
![]() | |
static void | sPrintAllocatedResources (bool printAsWarning) |
Print a list of all registered existing resources. | |
static const std::unordered_set< ManagedResource * > * | GetTotalAllocatedResources () |
Describes a top level accerlation structure. A tlas usually holds multiple Blas. A blas is an object/mesh instance together with its transformation in 3d space.
|
default |
|
inlinevirtual |
uint64_t foray::as::Tlas::AddBlasInstanceAnimated | ( | const Blas & | blas, |
BlasInstance::TransformUpdateFunc | getUpdatedGlobalTransformFunc | ||
) |
Add an animated BLAS instance.
uint64_t foray::as::Tlas::AddBlasInstanceAuto | ( | scene::ncomp::MeshInstance * | meshInstance | ) |
Add a BLAS instance from meshInstance component.
uint64_t foray::as::Tlas::AddBlasInstanceStatic | ( | const Blas & | blas, |
const glm::mat4 & | transform | ||
) |
Add a static BLAS instance.
void foray::as::Tlas::ClearBlasInstances | ( | ) |
Clear all instances.
|
virtual |
(Re)creates the TLAS. Required to invoke when changes to the TLAS transitioned it to Dirty state. Will synchronize with the CPU.
|
overridevirtual |
Destroy the resource.
Implements foray::core::ManagedResource.
|
inlineoverridevirtual |
Return true, if the managed resource is allocated.
Example: Vulkan object stored could be nullptr or instantiated
Implements foray::core::ManagedResource.
const BlasInstance * foray::as::Tlas::GetBlasInstance | ( | uint64_t | id | ) | const |
Get A BLAS instance by id.
|
inlineoverridevirtual |
Return a hint for the type of resource managed by the instantiation.
Reimplemented from foray::core::ManagedResource.
|
inline |
void foray::as::Tlas::RemoveBlasInstance | ( | uint64_t | id | ) |
Remove a BLAS instance.
|
virtual |
Updates transforms only. TLAS rebuild is performed and synchronized on GPU only. TLAS must by non-Dirty!
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |