#include <Chunk.h>
Definition at line 18 of file Chunk.h.
| Chunk |
( |
Volume * |
volume, |
|
|
int |
chunkX, |
|
|
int |
chunkY, |
|
|
int |
chunkZ |
|
) |
| |
| ChunkId GenerateChunkId |
( |
int |
chunkX, |
|
|
int |
chunkY, |
|
|
int |
chunkZ |
|
) |
| |
|
static |
| static std::string ChunkCoordsToString |
( |
int |
chunkX, |
|
|
int |
chunkY, |
|
|
int |
chunkZ |
|
) |
| |
|
static |
| std::string ChunkIdToString |
( |
ChunkId |
chunkId | ) |
|
|
static |
| std::string toString |
( |
| ) |
const |
| void * getLayer |
( |
int |
index | ) |
|
Will create a layer if it doesn't exists already.
Data is initialized to 0. Use the chunk edge length to compute the array size.
- Returns
- Data of the given layer.
- See Also
- Volume::getChunkEdgeLength
Definition at line 129 of file Chunk.cpp.
| const void * getConstLayer |
( |
int |
index | ) |
const |
Const pointer version of getLayer.
- Returns
NULL if a layer doesn't exists.
- See Also
- getLayer
Definition at line 139 of file Chunk.cpp.
Clears chunk on failure!
- Returns
false if the file is not readable.
Definition at line 187 of file Chunk.cpp.
Will unset m_Modified on success.
- Returns
true on success.
Definition at line 290 of file Chunk.cpp.
Increments the internal reference counter.
Chunks with reference won't be unloaded. Is thread safe.
- See Also
- releaseReference
Definition at line 371 of file Chunk.cpp.
| void releaseReference |
( |
| ) |
|
Decrements the internal reference counter.
Is thread safe.
- See Also
- addReference
Definition at line 377 of file Chunk.cpp.
Is thread safe.
Whether the chunk may be unloaded.
Definition at line 387 of file Chunk.cpp.
| bool isModified |
( |
| ) |
const |
| time_t getModificationTime |
( |
| ) |
const |
Timestamp of the first modification since last save event.
Definition at line 397 of file Chunk.cpp.
If it wasn't modified before: Sets the modification flag, updates the modification time and adds the chunk to the modified list.
Definition at line 402 of file Chunk.cpp.
| tthread::mutex * getMutex |
( |
| ) |
|
Use this to lock the object while using methods that aren't thread safe.
Definition at line 417 of file Chunk.cpp.
| void UnpackChunkId |
( |
ChunkId |
chunkId, |
|
|
int * |
outX, |
|
|
int * |
outY, |
|
|
int * |
outZ |
|
) |
| |
|
static |
| void initializeLayer |
( |
int |
index | ) |
|
| void clearLayers |
( |
bool |
silent = false | ) |
|
Deletes all layers and resets them to NULL.
If at least one layer was deleted m_Modified will be set.
Definition at line 115 of file Chunk.cpp.
Resets the modified flag.
Definition at line 412 of file Chunk.cpp.
| std::vector<char*> m_Layers |
Holds voxel arrays for all layers registered in the volume.
A pointer is NULL if the layer is not used in this chunk, in that case the layers default voxel value shuld be used. Voxels have to be initialized with 0!
Definition at line 137 of file Chunk.h.
Which layers are compressed.
True when the chunk has been modified and needs to be written to disk.
Definition at line 148 of file Chunk.h.
| time_t m_ModificationTime |
Timestamp of the first modification since last save event.
Is updated each time, when m_Modified changes from false to true.
Definition at line 155 of file Chunk.h.
| tthread::atomic_int m_References |
Reference count on this chunk.
Definition at line 167 of file Chunk.h.
The documentation for this class was generated from the following files: