VoxelFarm::CInstanceManager Class Reference

Handles instanced voxel data. More...

#include <InstanceManager.h>

Inheritance diagram for VoxelFarm::CInstanceManager:
VoxelFarm::IVoxelLayer VoxelFarm::IMask VoxelFarm::CInstanceHeightMap VoxelFarm::CInstanceSimplexWorld

Public Member Functions

 CInstanceManager (Architecture::CArchitectureManager *architectureManager)
 
int loadClassData (char *name, char *filename)
 Load data for one class.
 
int loadClassData (VoxelFarm::IInputStream *reader, char *name, char *filename)
 Load data for one class from a resource stream.
 
int loadClassDataRaw (const char *name, const char *data)
 Load data for one class out of the provided raw data.
 
virtual void getContourData (CellId cell, ContourVoxelData *data, bool &empty, void *threadContext) override
 Returns voxel data for the specified cell (IVoxelLayer) More...
 
virtual void planJobs (Scene *scene) override
 Processes a scene to get new entities from it. This is called by the scene creation loop. It adds master cells to the instance grid for their generation in worker threads.
 
virtual void runJobs () override
 Processes pending generation requests. This is called by the contouring loop. Pending cells will be generated at this time.
 
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 int * generateInstances (CellId cell)
 Runs planting rules over one cell.
 
virtual double getMaskValue (double x, double y, double z) override
 Retrieves a mask value based on whether there are instances in that coordinate.
 
- Public Member Functions inherited from VoxelFarm::IVoxelLayer
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.
 
virtual bool isCacheable ()
 Returns true if the layer's output can be cached. Return true if the output for a cell will always be the same.
 

Protected Attributes

Architecture::CArchitectureManagerarchitectureManager
 
TVector< ClassDataclasses
 
TMap< CellId, TVector< int > > instances
 
TMap< CellId, int * > instanceMap
 
TVector< InstanceDatainstanceData
 
TMap< String, int > classMap
 
TSet< CellIdgeneratedCells
 
ExternalMutex::Mutex lock
 
TSet< CellIdpendingCells
 

Detailed Description

Handles instanced voxel data.

Definition at line 81 of file InstanceManager.h.

Member Function Documentation

virtual void VoxelFarm::CInstanceManager::getContourData ( CellId  cell,
ContourVoxelData data,
bool &  empty,
void *  threadContext 
)
overridevirtual

Returns voxel data for the specified cell (IVoxelLayer)

Parameters
cellID of the cell
dataA buffer where the voxel data will be copied.
emptyA flag notifying the entire cell is empty and could be discarded by the caller

Implements VoxelFarm::IVoxelLayer.


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