GPUScene tracks scene geometry, materials, and instances on the GPU for use in bindless and ray tracing pipelines. More...
#include <kanzi/core.ui/graphics3d/gpu_scene.hpp>
Public Member Functions | |
| uint32_t | getClusterInstanceIdx (const Model3DSharedPtr &model3DPtr, uint32_t clusterIdx, uint32_t instanceIdx) const |
| Returns the GPU instance index for a given cluster instance of a model. | |
| gfx::GPUSceneHandleGuard | getHandle () const |
| Returns a handle to the underlying GPU scene resource. | |
| uint32_t | getMaterialIndex (const MaterialSharedPtr &material) const |
| Returns the GPU-side index of a registered material. | |
| uint32_t | getMeshIndex (const MeshSharedPtr &mesh) const |
| Returns the GPU-side index of a registered mesh. | |
| uint32_t | getTextureIndex (const TextureSharedPtr &texture) const |
| Returns the GPU-side index of a registered texture. | |
| GPUScene (const GPUScene &)=delete | |
| GPUScene (Domain *domain, Scene *scene) | |
| Constructor. | |
| GPUScene (GPUScene &&)=delete | |
| bool | hadInstanceUpdate () const |
| Returns whether the instance buffer was updated during the most recent update() call. | |
| void | onModelAdded (Model3D &model) |
| Notifies the GPU scene that a Model3D node was added to the scene. | |
| void | onModelRemoved (Model3D &model) |
| Notifies the GPU scene that a Model3D node was removed from the scene. | |
| GPUScene & | operator= (const GPUScene &)=delete |
| GPUScene & | operator= (GPUScene &&)=delete |
| uint32_t | registerMaterial (const MaterialSharedPtr &material) |
| Registers a material with the GPU scene, returning its GPU index. | |
| uint32_t | registerMesh (const MeshSharedPtr &mesh) |
| Registers a mesh with the GPU scene, returning its GPU index. | |
| uint32_t | registerTexture (const TextureSharedPtr &texture) |
| Registers a texture with the GPU scene, returning its GPU index. | |
| bool | setClusterInstanceIdx (const Model3DSharedPtr &model3DPtr, uint32_t clusterIdx, uint32_t instanceIdx, uint32_t value) |
| Sets the GPU instance index for a given cluster instance of a model. | |
| void | unregisterMaterial (const MaterialSharedPtr &material) |
| Unregisters a material from the GPU scene. | |
| void | unregisterMesh (const MeshSharedPtr &mesh) |
| Unregisters a mesh from the GPU scene. | |
| void | unregisterTexture (const TextureSharedPtr &texture) |
| Unregisters a texture from the GPU scene. | |
| void | update (Renderer &renderer) |
| Updates the GPU scene state, uploading any dirty mesh, material, or instance data to the GPU. | |
| ~GPUScene () | |
| Destructor. | |
Static Public Member Functions | |
| static bool | isSupported () |
| Returns whether GPU scene is supported by the active graphics backend. | |
Static Public Attributes | |
| static constexpr uint32_t | invalidResourceIndex |
| Sentinel value returned when a resource index is not valid. | |
GPUScene tracks scene geometry, materials, and instances on the GPU for use in bindless and ray tracing pipelines.
Use GPUScene to access GPU-side representations of meshes, materials, and textures by index, and to register or unregister scene objects as they are added or removed from the scene.
Constructor.
| domain | The domain to use. |
| scene | The scene that owns this GPU scene. |
| kanzi::GPUScene::~GPUScene | ( | ) |
Destructor.
|
delete |
Returns whether GPU scene is supported by the active graphics backend.
Updates the GPU scene state, uploading any dirty mesh, material, or instance data to the GPU.
| renderer | Renderer to use. |
| uint32_t kanzi::GPUScene::getClusterInstanceIdx | ( | const Model3DSharedPtr & | model3DPtr, |
| uint32_t | clusterIdx, | ||
| uint32_t | instanceIdx ) const |
Returns the GPU instance index for a given cluster instance of a model.
| model3DPtr | The model node. |
| clusterIdx | Index of the mesh cluster. |
| instanceIdx | Instance index within the cluster. |
| bool kanzi::GPUScene::setClusterInstanceIdx | ( | const Model3DSharedPtr & | model3DPtr, |
| uint32_t | clusterIdx, | ||
| uint32_t | instanceIdx, | ||
| uint32_t | value ) |
Sets the GPU instance index for a given cluster instance of a model.
| model3DPtr | The model node. |
| clusterIdx | Index of the mesh cluster. |
| instanceIdx | Instance index within the cluster. |
| value | GPU instance index to set. |
| uint32_t kanzi::GPUScene::getMeshIndex | ( | const MeshSharedPtr & | mesh | ) | const |
Returns the GPU-side index of a registered mesh.
| mesh | The mesh to look up. |
| uint32_t kanzi::GPUScene::getMaterialIndex | ( | const MaterialSharedPtr & | material | ) | const |
Returns the GPU-side index of a registered material.
| material | The material to look up. |
| uint32_t kanzi::GPUScene::getTextureIndex | ( | const TextureSharedPtr & | texture | ) | const |
Returns the GPU-side index of a registered texture.
| texture | The texture to look up. |
|
inline |
Returns a handle to the underlying GPU scene resource.
| uint32_t kanzi::GPUScene::registerMesh | ( | const MeshSharedPtr & | mesh | ) |
Registers a mesh with the GPU scene, returning its GPU index.
| mesh | The mesh to register. |
| void kanzi::GPUScene::unregisterMesh | ( | const MeshSharedPtr & | mesh | ) |
Unregisters a mesh from the GPU scene.
| mesh | The mesh to unregister. |
| uint32_t kanzi::GPUScene::registerMaterial | ( | const MaterialSharedPtr & | material | ) |
Registers a material with the GPU scene, returning its GPU index.
| material | The material to register. |
| void kanzi::GPUScene::unregisterMaterial | ( | const MaterialSharedPtr & | material | ) |
Unregisters a material from the GPU scene.
| material | The material to unregister. |
| uint32_t kanzi::GPUScene::registerTexture | ( | const TextureSharedPtr & | texture | ) |
Registers a texture with the GPU scene, returning its GPU index.
| texture | The texture to register. |
| void kanzi::GPUScene::unregisterTexture | ( | const TextureSharedPtr & | texture | ) |
Unregisters a texture from the GPU scene.
| texture | The texture to unregister. |
Notifies the GPU scene that a Model3D node was added to the scene.
| model | The model that was added. |
Notifies the GPU scene that a Model3D node was removed from the scene.
| model | The model that was removed. |
|
inline |
Returns whether the instance buffer was updated during the most recent update() call.
Sentinel value returned when a resource index is not valid.
Clamped to 24 bits on purpose to match accel stuct instance custom index maximum value.