User Tools

Site Tools


editing_voxels

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
editing_voxels [2018/01/25 12:37]
gobrosse [Poke types and what they mean]
editing_voxels [2018/02/10 23:52] (current)
gobrosse [Voxel Data Storage]
Line 1: Line 1:
 ====== Programming::​Editing Voxel Data ====== ====== Programming::​Editing Voxel Data ======
 +
 +===== Voxel Data Storage =====
 +
 +Chunk Stories makes use of a hierarchical model for it's voxel storage. A **World** contains many Regions, a **Region** is made out of 8x8x8 **Chunk**s, themselves made out of 32x32x32 **Cell**s. Cells are what voxels are stored in. The **Voxel** class in the codebase actually refers to the idea of voxel **type**, be aware of that !
 +
 +The base CellData interface exposes two things:
 +
 + * A Location, ie a 4-uple (world, x, y, z)
 + * The data associated with this location ( [[mod_generalities#​voxel data storage|more detail here]] )
 +   * The voxel type: an instance of the '​Voxel.class'​ class.
 +   * Two 4-bit nibbles : sunlight and blocklight, representing the voxel flood-fill lightning values
 +   * A byte (8 bits) of metadata
 +
 +It is recommanded to use Cells rather than directly using '​raw'​ cell data and unstable voxel ids.
 +
 +  * CellData: base interface.
 +    * WorldCell: Associated with a real World, getWorld() guaranteed not to return null. If corresponding chunks are loaded, getNeighbor functions will work.
 +       * ChunkCell: Associated with a real, loaded chunk. ​
 +
 +    * EditableCell:​ Additional interface editing the voxel data it represents
 +      * FutureCell: Describes future changes you wish to make to a cell
 +      * DummyCell: Describe a voxel cell outside of any real world (without context if you will)
 +
  
 ===== Peek types and what they mean ===== ===== Peek types and what they mean =====
  
 | Name | Arguments | Return | Throws Exceptions | | Name | Arguments | Return | Throws Exceptions |
-| world.peek() | int x, int y, int z | ChunkVoxelContext ​| Yes | +| world.peek() | int x, int y, int z | ChunkCell ​| Yes | 
-| world.peek() | Vector3dc location | ChunkVoxelContext ​| Yes | +| world.peek() | Vector3dc location | ChunkCell ​| Yes | 
-| world.peekSafely() | int x, int y, int z | WorldVoxelContext| No | +| world.peekSafely() | int x, int y, int z | WorldCell| No | 
-| world.peekSafely() | Vector3dc location | WorldVoxelContext| No |+| world.peekSafely() | Vector3dc location | WorldCell| No |
 | world.peekSimple() | int x, int y, int z | Voxel | No | | world.peekSimple() | int x, int y, int z | Voxel | No |
 | world.peekRaw() | int x, int y, int z | int | No | | world.peekRaw() | int x, int y, int z | int | No |
-| chunk.peek() | int x, int y, int z | ChunkVoxelContext ​| No | +| chunk.peek() | int x, int y, int z | ChunkCell ​| No | 
-| chunk.peek() | Vector3dc location | ChunkVoxelContext ​| No|+| chunk.peek() | Vector3dc location | ChunkCell ​| No|
 | chunk.peekSimple() | int x, int y, int z | Voxel | No | | chunk.peekSimple() | int x, int y, int z | Voxel | No |
 | chunk.peekRaw() | int x, int y, int z | int | No | | chunk.peekRaw() | int x, int y, int z | int | No |
 +
 ===== Poke types and what they mean ===== ===== Poke types and what they mean =====
  
 | Name | Arguments | Return | Triggers Updates | Throws Exceptions | | Name | Arguments | Return | Triggers Updates | Throws Exceptions |
-| world.poke() | x, y, z, voxel, sunlight, blocklight, metadata, cause | VoxelContext ​| Yes | Yes | +| world.poke() | x, y, z, voxel, sunlight, blocklight, metadata, cause | CellData ​| Yes | Yes | 
-| world.poke() | futureVoxelContext, cause | VoxelContext ​| Yes | Yes |+| world.poke() | futureCell, cause | CellData ​| Yes | Yes |
 | world.pokeSimple() | x, y, z, voxel, sunlight, blocklight, metadata | void | Yes | No | | world.pokeSimple() | x, y, z, voxel, sunlight, blocklight, metadata | void | Yes | No |
-| world.pokeSimple() | futureVoxelContext ​| void | Yes | No |+| world.pokeSimple() | futureCell ​| void | Yes | No |
 | world.pokeSimpleSilently() | x, y, z, voxel, sunlight, blocklight, metadata | void | No| No | | world.pokeSimpleSilently() | x, y, z, voxel, sunlight, blocklight, metadata | void | No| No |
-| world.pokeSimpleSilently() | futureVoxelContext ​| void | No| No |+| world.pokeSimpleSilently() | futureCell ​| void | No| No |
 | world.pokeRaw() | x, y, z, raw\_data\_bits | void | Yes | No | | world.pokeRaw() | x, y, z, raw\_data\_bits | void | Yes | No |
 | world.pokeRawSilently() | x, y, z, raw\_data\_bits | void | No | No | | world.pokeRawSilently() | x, y, z, raw\_data\_bits | void | No | No |
-| chunk.poke() | x, y, z, voxel, sunlight, blocklight, metadata, cause | VoxelContext ​| Yes | Yes|+| chunk.poke() | x, y, z, voxel, sunlight, blocklight, metadata, cause | CellData ​| Yes | Yes|
 | chunk.pokeSimple() | x, y, z, voxel, sunlight, blocklight, metadata | void | Yes | No | | chunk.pokeSimple() | x, y, z, voxel, sunlight, blocklight, metadata | void | Yes | No |
 | chunk.pokeSimpleSilently() | x, y, z, voxel, sunlight, blocklight, metadata | void | No| No | | chunk.pokeSimpleSilently() | x, y, z, voxel, sunlight, blocklight, metadata | void | No| No |
 | chunk.pokeRaw() | x, y, z, raw\_data\_bits | void | Yes | No | | chunk.pokeRaw() | x, y, z, raw\_data\_bits | void | Yes | No |
 | chunk.pokeRawSilently() | x, y, z, raw\_data\_bits | void | No | No | | chunk.pokeRawSilently() | x, y, z, raw\_data\_bits | void | No | No |
editing_voxels.1516880235.txt.gz · Last modified: 2018/01/25 12:37 by gobrosse