Public Member Functions |
| | Voxelgrid (DataHandler *handle, int64_t hashSize) |
| | Constructs an empty voxel grid.
|
|
| ~Voxelgrid () |
| | Completely delete the sparse voxelgrid.
|
| void | drawVoxels (glm::mat4 projectionMatrix, glm::mat4 viewMatrix) |
| | Draw the voxel data.
|
| void | FloodFill (int x, int z, int height, bool fillDown=true) |
| | Floodfills pixels at the specified position and height.
|
| GLint | getHeight (int16_t x, int16_t z) |
| | Gets the height in waterHeight.
|
| std::vector< GLint > * | getHeightMap () |
| | Returns a pointer to waterHeight.
|
| neighs * | getNeighbourhood (int16_t x, int16_t y, int16_t z) |
| | Get a voxel and the 26 neighbouring pixels.
|
| neighs * | getNeighbourhoodHash (int16_t x, int16_t y, int16_t z) |
| | Get a voxel and the 26 neighbouring pixels.
|
| voxel * | getVoxel (int16_t x, int16_t y, int16_t z) |
| | Get value of voxel at x,y,z.
|
| std::vector< GLuint > * | getVoxelPositions () |
| | Create a data pointer to all existing voxels.
|
| void | hashAdd (int16_t x, int16_t y, int16_t z, bool filled, float a, float b) |
| | Adds a pixel using the hash functions.
|
| voxel * | hashGet (int16_t x, int16_t y, int16_t z) |
| | Gets a pixel using the hash functions.
|
| void | hashInit () |
| | Initializes the hashmap to the size specified by hashSize.
|
| void | initDraw () |
| | Initialize Voxelgrid for drawing.
|
|
bool | isEqualPoint (voxel *vox, short int x, short int y, short int z) |
| | Returns true if the voxel contains the coordinates specified by x,y,z.
|
| void | rehash () |
| | rehashes the table.
|
| void | setHeight (int16_t x, int16_t y, int16_t z) |
| | Sets the height in waterHeight.
|
| void | setVoxel (int16_t x, int16_t y, int16_t z, bool filled, float a, float b) |
| | Set value of voxel at x,y,z.
|
| void | updateVoxelrender () |
| | Updates the buffer on the GPU.
|
Public Attributes |
|
int64_t | hashSize |
| | size of the hash table
|
|
GLuint | numCollisions |
| | How many collisions presently.
|
|
GLuint | numInTable |
| | How many elements there are in the hashTable.
|
Private Member Functions |
| int64_t | hashFunc (int64_t x, int64_t y, int64_t z, int64_t inHashSize) |
| | hashFunc which returns a position in the hashtable to insert the voxel
|
Private Attributes |
|
DataHandler * | datahandler |
| | Handle to the datahandler and thus the model data.
|
|
std::vector< voxel * > * | hashTable |
| | Pointer to hashTable. Filled with voxel pointers.
|
|
GLuint | height |
| | The height of the map, needed for voxel extraction.
|
|
GLuint | numVoxels |
| | Number of voxels in the voxelPositions.
|
|
GLfloat | rehashTresh |
| | Rehash treshhold.
|
|
GLuint | voxelBuffer |
| | Buffer for rendering.
|
|
std::vector< GLuint > * | voxelPositions |
| | Vector for the position where there are voxels, for drawing purposes.
|
std::vector< std::vector
< std::vector< voxel * > * > * > * | voxels |
| | Container for the voxel lookup tables.
|
|
GLuint | voxelShader |
| | Shader program.
|
|
GLuint | voxelVAO |
| | VAOs for rendering.
|
|
std::vector< GLint > * | waterHeight |
| | The map of height data for the topmost water voxel.
|
|
GLuint | width |
| | The width of the map, needed for saving data in linear containers.
|
|
int | xoff [27] |
| | xoffsets for neighbour extraction.
|
|
int | yoff [27] |
| | xoffsets for neighbour extraction.
|
|
int | zoff [27] |
| | xoffsets for neighbour extraction.
|
Handles the representation of the voxelgrid.
The class is used to construct the voxelgrid used for simulation and visualization. It places a voxel for each point in the base area (x times z) and uses N number of voxels in the precision from the lowest point in the model to the heighest peak. Note voxels outside of highest possible, however not negative voxel coordinates. The class implements a rudimentary sparse voxelgrid.
Definition at line 48 of file voxel.h.