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
Last revision Both sides next revision
editing_voxels [2018/01/25 13:10]
gobrosse
editing_voxels [2018/02/10 23:52]
gobrosse
Line 1: Line 1:
 ====== Programming::​Editing Voxel Data ====== ====== Programming::​Editing Voxel Data ======
  
-===== VoxelContexts ​=====+===== Voxel Data Storage ​=====
  
-To wrap the modifications of the world into usable chunks, the game makes use of **VoxelContext**s. The base VoxelContext ​interface exposes two things:+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)  * A Location, ie a 4-uple (world, x, y, z)
- * The data associated with this location ​:+ * The data associated with this location ​( [[mod_generalities#​voxeldatastorage|more detail here]] )
    * The voxel type: an instance of the '​Voxel.class'​ class.    * The voxel type: an instance of the '​Voxel.class'​ class.
    * Two 4-bit nibbles : sunlight and blocklight, representing the voxel flood-fill lightning values    * Two 4-bit nibbles : sunlight and blocklight, representing the voxel flood-fill lightning values
-   * A byte of metadata+   * A byte (8 bits) of metadata 
 + 
 +It is recommanded to use Cells rather than directly using '​raw'​ cell data and unstable voxel ids.
  
-It is recommanded ​to use VoxelContexts 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
  
-  ​VoxelContextbase interface. +    ​EditableCellAdditional ​interface ​editing the voxel data it represents 
-    WorldVoxelContext:​ Associated with a real World, getWorld() guaranteed not to return null. If corresponding chunks are loaded, getNeighbor functions will work. +      FutureCell: Describes future changes you wish to make to a cell 
-       * ChunkVoxelContext:​ Associated with a real, loaded chunk.  +      DummyCell: Describe a voxel cell outside of any real world (without context if you will)
-    * FutureVoxelContext: Describes future changes you wish to make to a cell +
-    AbstractVoxelContext: Describe a voxel cell outside of any real world (without context if you will) +
-    * EditableVoxelContext:​ Additional interface that allows subsequent pokes without going back to world+
  
  
Line 24: Line 27:
  
 | 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 |
Line 38: Line 41:
  
 | 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.txt · Last modified: 2018/02/10 23:52 by gobrosse