VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
visutwin::canvas::WorldClusters Class Reference

#include <scene/lighting/worldClusters.h>

Public Member Functions

const Vector3boundsMin () const
Vector3 boundsRange () const
const uint8_t * cellData () const
size_t cellDataSize () const
Vector3 cellsCountByBoundsSize () const
const ClusterConfigconfig () const
int lightCount () const
const GpuClusteredLightlightData () const
size_t lightDataSize () const
void update (const std::vector< ClusterLightData > &localLights, const BoundingBox &cameraBounds)
 WorldClusters (const ClusterConfig &config=ClusterConfig{})

Detailed Description

CPU-side 3D grid clustering for local lights (point/spot).

Divides the world into a 3D grid. Each cell stores indices of lights whose AABB overlaps that cell. The GPU fragment shader looks up its world position in the grid and only evaluates lights in the matching cell.

WorldClusters adapted for Metal buffer access. CPU-only: produces data arrays that the renderer uploads to GPU buffers.

Definition at line 69 of file worldClusters.h.

Constructor & Destructor Documentation

◆ WorldClusters()

visutwin::canvas::WorldClusters::WorldClusters ( const ClusterConfig & config = ClusterConfig{})
explicit

Definition at line 17 of file worldClusters.cpp.

References cellDataSize(), and config().

Member Function Documentation

◆ boundsMin()

const Vector3 & visutwin::canvas::WorldClusters::boundsMin ( ) const
inline

Definition at line 91 of file worldClusters.h.

◆ boundsRange()

Vector3 visutwin::canvas::WorldClusters::boundsRange ( ) const
inline

Definition at line 92 of file worldClusters.h.

Referenced by cellsCountByBoundsSize().

◆ cellData()

const uint8_t * visutwin::canvas::WorldClusters::cellData ( ) const
inline

Definition at line 87 of file worldClusters.h.

◆ cellDataSize()

size_t visutwin::canvas::WorldClusters::cellDataSize ( ) const
inline

Definition at line 88 of file worldClusters.h.

Referenced by WorldClusters().

◆ cellsCountByBoundsSize()

Vector3 visutwin::canvas::WorldClusters::cellsCountByBoundsSize ( ) const

Definition at line 25 of file worldClusters.cpp.

References boundsRange().

◆ config()

const ClusterConfig & visutwin::canvas::WorldClusters::config ( ) const
inline

Definition at line 95 of file worldClusters.h.

Referenced by WorldClusters().

◆ lightCount()

int visutwin::canvas::WorldClusters::lightCount ( ) const
inline

Definition at line 85 of file worldClusters.h.

◆ lightData()

const GpuClusteredLight * visutwin::canvas::WorldClusters::lightData ( ) const
inline

Definition at line 83 of file worldClusters.h.

◆ lightDataSize()

size_t visutwin::canvas::WorldClusters::lightDataSize ( ) const
inline

Definition at line 84 of file worldClusters.h.

◆ update()

void visutwin::canvas::WorldClusters::update ( const std::vector< ClusterLightData > & localLights,
const BoundingBox & cameraBounds )

Called per frame: collect lights, build grid, pack GPU data arrays.

Parameters
localLightsLocal lights (point/spot) collected from LightComponent.
cameraBoundsCamera frustum AABB for grid bounds computation.

Definition at line 34 of file worldClusters.cpp.


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