A default implementation of IBlockData that also acts as a VoxelLayer. More...
#include <BlockData.h>
Classes | |
| class | IBlockCache |
| class | IBlockIO |
| This interface allows the CBlockData object to persist blocks in an external storage. More... | |
| struct | ThreadContext |
Public Member Functions | |
| virtual void | setBlock (CellId &cell, int &x, int &y, int &z, int material, double dx, double dy, double dz, TSet< CellId > *changedCells) |
| Sets a value for a voxel. More... | |
| virtual void | getBlock (CellId cell, int x, int y, int z, int &material, double &dx, double &dy, double &dz) |
| Gets the value of a voxel. More... | |
| virtual void | getContourData (CellId cell, ContourVoxelData *data, bool &empty, void *threadContext) override |
| Reads the entire Cell contents into a buffer. More... | |
| virtual void * | createThreadContext () override |
| The voxel layer can use this method to return a structure that will be unique for each calling thread. This allows to have lock-free work buffers assigned to each worker thread. | |
| virtual void | disposeThreadContext (void *threadContext) override |
| Destroys the specified thread context. | |
| virtual int | getStatsContourId () override |
| Returns the stats ID to be used for measuring performance of the getContourData() method. | |
| virtual bool | isCacheable () override |
| Returns true if the layer's output can be cached. Return true if the output for a cell will always be the same. | |
| virtual void | updateLOD (const TSet< CellId > &changedCells) |
| Recomputes higher LOD data. | |
| virtual void | beginChanges () |
| Sets a marker for a change set that can be undone. | |
| virtual void | trackCellChanges (CellId cell, const BlockVoxelData *blockData) |
| Requests changes made to a cell to be remembered so they can be undone. | |
| virtual void | endChanges () |
| Closes the marker for a change set that can be undone. | |
| virtual void | undo (TSet< CellId > &changedCells) |
| Undoes the last changes. | |
| void | setBlockIOHandler (IBlockIO *blockIOHandler) |
| Sets the IBlockIO interface. | |
| BlockVoxelData * | loadCell (CellId cell) |
| Loads voxel data for the specified cell using the assigned IBlockIO handler. | |
| void | saveCell (CellId cell, BlockVoxelData *data) |
| Saves voxel data for the specified cell using the assigned IBlockIO handler. | |
| void | setBlockCacheHandler (IBlockCache *blockCacheHandler) |
| Sets the IBlockCache interface. | |
| virtual BlockVoxelData * | fetchData (CellId cell, bool create) |
| Returns the voxel data buffer for the specified cell. More... | |
| virtual BlockVoxelData * | fetchCacheData (CellId cell, bool create) |
| Returns a cache voxel data buffer for the specified cell. More... | |
| void | removeFromCache (CellId cell) |
| Removes a cell from the memory cache. | |
| bool | pendingForUpdate () |
| void | cellProcessed (CellId cell) |
| bool | cellChildIsInProcessForUpdate (CellId cell) |
| CellId | getNextPendingForUpdate (CellId cell=0) |
| bool | cellIsPendingForUpdate (CellId cell) |
| int | getVoxelIntersections (VoxelFarm::Algebra::Vector *result, BlockVoxelData *data, CellId cell, int x, int y, int z) |
| Returns all triangles that intercept a voxel. More... | |
Public Member Functions inherited from VoxelFarm::IVoxelLayer | |
| virtual void | planJobs (Scene *scene) |
| This is called when a new scene is discovered. It can be used to create objects that will be later returned in voxel form. | |
| virtual void | runJobs () |
| Execute any additional generation task. | |
| virtual int | getStatsPlanJobsId () |
| Returns the stats ID to be used for measuring performance of the planJobs() method. | |
| virtual int | getStatsRunJobsId () |
| Returns the stats ID to be used for measuring performance of the runJobs() method. | |
Public Attributes | |
| TMap< CellId, BlockVoxelData * > | blockCache |
| An index where cell IDs are matched to their corresponding voxel data buffer. | |
| ExternalMutex::Mutex | lock |
| A critical section used to protect the block cache. | |
| TMap< CellId, BlockVoxelData * > | undoData |
| Contains the set of Cells that changed in the past modification. More... | |
Static Public Attributes | |
| static const int | IMMEDIATE_UPDATE_LOD = LOD_0 + 1 |
Protected Attributes | |
| IBlockIO * | blockIO |
| IBlockCache * | blockCacheHandler |
A default implementation of IBlockData that also acts as a VoxelLayer.
Definition at line 182 of file BlockData.h.
|
virtual |
Returns a cache voxel data buffer for the specified cell.
| cell | Cell ID for the cell to be retrieved |
| create | If set to true will create an empty cell buffer if no buffer is found for the cell |
Implements VoxelFarm::IBlockData.
|
virtual |
Returns the voxel data buffer for the specified cell.
| cell | Cell ID for the cell to be retrieved |
| create | If set to TRUE will create an empty cell buffer if no buffer is found for the cell |
Implements VoxelFarm::IBlockData.
|
virtual |
Gets the value of a voxel.
| cell | ID for the cell containing the voxel to be read |
| x | X coordinates for a voxel relative to the origin of the Cell |
| y | Y coordinates for a voxel relative to the origin of the Cell |
| z | Z coordinates for a voxel relative to the origin of the Cell |
| material | Will contain the material ID for the voxel when the call returns |
| dx | Will contain X coordinates of the inner-voxel point, relative to the origin of the voxel, when the call returns |
| dy | Will contain Y coordinates of the inner-voxel point, relative to the origin of the voxel, when the call returns |
| dz | Will contain Z coordinates of the inner-voxel point, relative to the origin of the voxel, when the call returns |
|
overridevirtual |
Reads the entire Cell contents into a buffer.
| cell | ID of the cell |
| data | A buffer where the voxel data will be copied. |
| empty | A flag notifying the entire cell is empty and could be discarded by the caller |
| threadContext | A thread context. This parameter is ignored since the CBlockData object does not require any threadsafe work buffers |
Implements VoxelFarm::IVoxelLayer.
| int VoxelFarm::CBlockData::getVoxelIntersections | ( | VoxelFarm::Algebra::Vector * | result, |
| BlockVoxelData * | data, | ||
| CellId | cell, | ||
| int | x, | ||
| int | y, | ||
| int | z | ||
| ) |
Returns all triangles that intercept a voxel.
| result | List of neighbor vertices forming a quad with the voxel's vertex. Each 3 entries there is a quad |
| data | Voxel data source |
| cell | Coordinates of the voxel in the form cell, x, y, z |
|
virtual |
Sets a value for a voxel.
| cell | ID for the cell containing the voxel to be set |
| x | X coordinates for a voxel relative to the origin of the Cell |
| y | Y coordinates for a voxel relative to the origin of the Cell |
| z | Z coordinates for a voxel relative to the origin of the Cell |
| material | ID for material being set. |
| dx | X coordinates of the inner-voxel point, relative to the origin of the voxel |
| dy | Y coordinates of the inner-voxel point, relative to the origin of the voxel |
| dz | Z coordinates of the inner-voxel point, relative to the origin of the voxel |
Implements VoxelFarm::IBlockData.
| TMap<CellId, BlockVoxelData*> VoxelFarm::CBlockData::undoData |
Contains the set of Cells that changed in the past modification.
Stores the previous state for Cells, so any changes can be reverted to this state
Definition at line 321 of file BlockData.h.