14 #include "VoxelLayer.h"
57 TSet<CellId>* changedCells) = 0;
92 BlockVoxelData* blockKernel[3][3][3]);
95 int getVoxelListIntersections(
VoxelFarm::Algebra::Vector* result,
unsigned int* data,
int xsize,
int ysize,
int zsize,
int x,
int y,
int z);
96 void convertOldData(BlockVoxelData* data,
double oldMinValue = 0.0,
double oldMaxValue = 1.0);
99 int getVoxelIntersections(
102 BlockVoxelData* data,
118 void merge(TSet<CellId>* changedCells);
121 TMap<CellId, BlockVoxelData*> blockCache;
142 TSet<CellId>* changedCells);
185 const static int IMMEDIATE_UPDATE_LOD = LOD_0 + 1;
208 TSet<CellId>* changedCells);
236 void* threadContext)
override;
250 virtual void updateLOD(
const TSet<CellId>& changedCells);
258 virtual void undo(TSet<CellId>& changedCells);
287 virtual BlockVoxelData*
getCell(
const CellId& cell,
bool create) = 0;
328 BlockVoxelData* kernel[3][3][3];
331 TSet<CellId> pendingLODUpdateSet;
332 TSet<CellId> inprocessLODUpdateSet;
334 bool pendingForUpdate();
335 void cellProcessed(
CellId cell);
336 bool cellChildIsInProcessForUpdate(
CellId cell);
338 bool cellIsPendingForUpdate(
CellId cell);
345 BlockVoxelData* data,
347 CellId cell,
int x,
int y,
int z
350 void blockContourData(
CellId cell,
ContourVoxelData* data,
bool& empty, BlockVoxelData* blockKernel[3][3][3]);
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.
virtual void endChanges()
Closes the marker for a change set that can be undone.
virtual void endChanges()
Closes the marker for a change set that can be undone.
virtual void beginChanges()
Sets a marker for a change set that can be undone.
void getBlockContourData(IBlockData *blockData, CellId cell, ContourVoxelData *data, bool &empty, BlockVoxelData *blockKernel[3][3][3])
Copies voxel data from a block and its neighbors.
virtual int getStatsContourId() override
Returns the stats ID to be used for measuring performance of the getContourData() method...
virtual BlockVoxelData * fetchData(CellId cell, bool create)
Returns the voxel data buffer for the specified cell. This is a synchronous call. ...
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...
Contains all classes and functions for the VoxelFarm engine.
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.
void saveCell(CellId cell, BlockVoxelData *data)
Saves voxel data for the specified cell using the assigned IBlockIO handler.
virtual BlockVoxelData * fetchCacheData(CellId cell, bool create)
Returns a cache voxel data buffer for the specified cell.
TMap< CellId, BlockVoxelData * > blockCache
An index where cell IDs are matched to their corresponding voxel data buffer.
virtual void * createThreadContext() override
The voxel layer can use this method to return a structure that will be unique for each calling thread...
virtual void clearCellCache(const CellId &cell)=0
Remove a voxel data from the cache.
virtual void beginChanges()=0
Sets a marker for a change set that can be undone.
void setBlockIOHandler(IBlockIO *blockIOHandler)
Sets the IBlockIO interface.
A default implementation of IBlockData that also acts as a VoxelLayer.
void setBlockCacheHandler(IBlockCache *blockCacheHandler)
Sets the IBlockCache interface.
virtual void commitCell(const CellId &cell, BlockVoxelData *cellBocks)=0
Commit modified voxel data to the cache.
virtual void saveCell(CellId cell, BlockVoxelData *data)
Saves voxel data for the specified cell.
BlockVoxelData * loadCell(CellId cell)
Loads voxel data for the specified cell using the assigned IBlockIO handler.
virtual void setBlock(CellId &cell, int &x, int &y, int &z, int material, double dx, double dy, double dz, TSet< CellId > *changedCells)=0
Sets a value for a voxel.
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.
unsigned __int64 CellId
A 64bit integer that identifies a single world octree Cell.
void merge(TSet< CellId > *changedCells)
Merge the data in blockCache with the data in blockData and returns the affected cells in changedCell...
An interface for a voxel layer. By implementing this interface, very different modules can contribute...
virtual BlockVoxelData * fetchData(CellId cell, bool create)=0
Returns the voxel data buffer for the specified cell. This is a synchronous call. ...
virtual BlockVoxelData * fetchData(CellId cell, bool create)
Returns the voxel data buffer for the specified cell.
TMap< CellId, BlockVoxelData * > undoData
Contains the set of Cells that changed in the past modification.
void removeFromCache(CellId cell)
Removes a cell from the memory cache.
ExternalMutex::Mutex lock
A critical section used to protect the block cache.
virtual void getContourData(CellId cell, ContourVoxelData *data, bool &empty, void *threadContext) override
Reads the entire Cell contents into a buffer.
virtual BlockVoxelData * fetchCacheData(CellId cell, bool create)=0
Returns a cache voxel data buffer for the specified cell.
virtual void undo(TSet< CellId > &changedCells)
Undoes the last changes.
float y
Vector y coordinate.
virtual void beginChanges()
Sets a marker for a change set that can be undone.
int getVoxelIntersections(VoxelFarm::Algebra::Vector *result, BlockVoxelData *data, CellId cell, int x, int y, int z)
Returns all triangles that intercept a voxel.
virtual BlockVoxelData * getCell(const CellId &cell, bool create)=0
Get read only voxel data. Returns NULL if data doesn't exist.
virtual void updateLOD(const TSet< CellId > &changedCells)
Recomputes higher LOD data.
virtual void endChanges()=0
Closes the marker for a change set that can be undone.
This interface allows the CBlockData object to persist blocks in an external storage.
void updateBlockLOD(IBlockData *blocks, CellId cell)
Computes voxel data for a block using its eight octree children.
virtual void disposeThreadContext(void *threadContext) override
Destroys the specified thread context.
virtual void trackCellChanges(CellId cell, const BlockVoxelData *blockData)
Requests changes made to a cell to be remembered so they can be undone.
A structure for storing voxel information when we generate a mask from a mesh.
float x
Vector x coordinate.
bool vector
An indication if the voxel has a vector.
virtual void trackCellChanges(CellId cell, const BlockVoxelData *blockData)=0
Requests changes made to a cell to be remembered so they can be undone.
bool mat
An indication if the voxel has material.
virtual BlockVoxelData * loadCell(CellId cell)
Loads voxel data for the specified cell.
float z
Vector z coordinate.
virtual void trackCellChanges(CellId cell, const BlockVoxelData *blockData)
Requests changes made to a cell to be remembered so they can be undone.
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.
virtual BlockVoxelData * fetchCacheData(CellId cell, bool create)
Returns a cache voxel data buffer for the specified cell.
An implementation of IBlockData for merging a buffer into another IBlockData.