Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
foray::as::BlasInstance Class Reference

A reference to a BLAS maintained by the TLAS. More...

#include <foray_blasinstance.hpp>

Public Types

using TransformUpdateFunc = std::function< void(glm::mat4 &)>
 Function template used for updating the transform matrix of animated instances.
 

Public Member Functions

 BlasInstance ()
 
 BlasInstance (uint64_t instanceId, const Blas *blas, TransformUpdateFunc getUpdatedGlobalTransformFunc)
 Initialize as animated.
 
 BlasInstance (uint64_t instanceId, const Blas *blas, const glm::mat4 &globalTransform)
 Initialize as static.
 
bool IsAnimated () const
 
void SetGeometryMetaOffset (uint32_t offset)
 Set the offset into the GeometryMetaBuffer (see foray_geometrymetabuffer.hpp)
 
void SetShaderBindingTableOffset (uint32_t offset)
 Set the offset for shader binding table.
 
VkGeometryInstanceFlagsKHR GetGeometryInstanceFlags () const
 
BlasInstanceSetGeometryInstanceFlags (VkGeometryFlagsKHR flags)
 
BlasInstanceAddGeometryInstanceFlag (VkGeometryFlagBitsKHR flag)
 
void Update ()
 Updates the transform by fetching a new matrix.
 

Static Public Member Functions

static void TranslateTransformMatrix (const glm::mat4 &in, VkTransformMatrixKHR &out)
 Translates glms column major 4x4 matrix to the row major 4x3 matrix type VkTransformMatrixKHR.
 

Protected Attributes

uint64_t mInstanceId = 0UL
 Id assigned by the TLAS.
 
const BlasmBlas
 BLAS.
 
TransformUpdateFunc mGetUpdatedGlobalTransformFunc = nullptr
 Function used to update transform (if animated, nullptr otherwise)
 
VkAccelerationStructureInstanceKHR mAsInstance = {}
 Vulkans instance struct, contains the actual reference to the BLAS, the transform and the custom index (used to offset into GeometryMetaBuffer)
 

Detailed Description

A reference to a BLAS maintained by the TLAS.

Member Typedef Documentation

◆ TransformUpdateFunc

using foray::as::BlasInstance::TransformUpdateFunc = std::function<void(glm::mat4&)>

Function template used for updating the transform matrix of animated instances.

Constructor & Destructor Documentation

◆ BlasInstance() [1/3]

foray::as::BlasInstance::BlasInstance ( )
inline

◆ BlasInstance() [2/3]

foray::as::BlasInstance::BlasInstance ( uint64_t  instanceId,
const Blas blas,
TransformUpdateFunc  getUpdatedGlobalTransformFunc 
)

Initialize as animated.

◆ BlasInstance() [3/3]

foray::as::BlasInstance::BlasInstance ( uint64_t  instanceId,
const Blas blas,
const glm::mat4 &  globalTransform 
)

Initialize as static.

Member Function Documentation

◆ AddGeometryInstanceFlag()

BlasInstance & foray::as::BlasInstance::AddGeometryInstanceFlag ( VkGeometryFlagBitsKHR  flag)
inline

◆ GetGeometryInstanceFlags()

VkGeometryInstanceFlagsKHR foray::as::BlasInstance::GetGeometryInstanceFlags ( ) const
inline

◆ IsAnimated()

bool foray::as::BlasInstance::IsAnimated ( ) const
inline

◆ SetGeometryInstanceFlags()

BlasInstance & foray::as::BlasInstance::SetGeometryInstanceFlags ( VkGeometryFlagsKHR  flags)
inline

◆ SetGeometryMetaOffset()

void foray::as::BlasInstance::SetGeometryMetaOffset ( uint32_t  offset)

Set the offset into the GeometryMetaBuffer (see foray_geometrymetabuffer.hpp)

◆ SetShaderBindingTableOffset()

void foray::as::BlasInstance::SetShaderBindingTableOffset ( uint32_t  offset)

Set the offset for shader binding table.

◆ TranslateTransformMatrix()

static void foray::as::BlasInstance::TranslateTransformMatrix ( const glm::mat4 &  in,
VkTransformMatrixKHR &  out 
)
static

Translates glms column major 4x4 matrix to the row major 4x3 matrix type VkTransformMatrixKHR.

◆ Update()

void foray::as::BlasInstance::Update ( )

Updates the transform by fetching a new matrix.

Member Data Documentation

◆ mAsInstance

VkAccelerationStructureInstanceKHR foray::as::BlasInstance::mAsInstance = {}
protected

Vulkans instance struct, contains the actual reference to the BLAS, the transform and the custom index (used to offset into GeometryMetaBuffer)

◆ mBlas

const Blas* foray::as::BlasInstance::mBlas
protected

BLAS.

◆ mGetUpdatedGlobalTransformFunc

TransformUpdateFunc foray::as::BlasInstance::mGetUpdatedGlobalTransformFunc = nullptr
protected

Function used to update transform (if animated, nullptr otherwise)

◆ mInstanceId

uint64_t foray::as::BlasInstance::mInstanceId = 0UL
protected

Id assigned by the TLAS.


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