Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hello Sketchpunk Labs, here is how I've been storing my voxel map data:
- I've never seen your videos before. Are you familiar with the formulas:
- tile_coord_x = tile_coord_as_1d_index % WID
- tile_coord_y = (tile_coord_as_1d_index -tile_coord_x )/ WID
- //:Number of tiles on each axis:
- #define NTX 8 //:Num_Tiles ( in_voxel_map )
- #define NTY 4 //:Num_Tiles ( in_voxel_map )
- #define NTZ 3 //:Num_Tiles ( in_voxel_map )
- //:Size_Of_A_Voxel_Tile_Measured_In_Pixels:
- #define NPX 16 //:Num_Pixels_X( in_a_tile )
- #define NPY 16 //:Num_Pixels_Y( in_a_tile )
- #define NPZ 16 //:Num_Pixels_Z( in_a_tile )
- //:Total__number_of__Pixels__in_entire_voxel_map
- #define TPX ( NTX * NPX ) //: Total_Pixels_X
- #define TPY ( NTY * NPY ) //: Total_Pixels_Y
- #define TPZ ( NTZ * NPZ ) //: Total_Pixels_Z
- #define _ 0
- #define X 1
- int VAT[ NTX * NTY * NTZ ]=int[ 8 * 4 * 3 ](
- /** TODO: Eventually use an integer texture **/
- /** for this tilemap data. **/
- //:Highest Z Cross Section Is First Tile Map
- //: 1 2 3 4 5 6 7 8 --- -----------------
- X,X,X,X,X,X,X,X, //: 1 | ^
- X,_,_,_,_,_,_,X, //: 2 | Z == 0 |
- X,_,_,_,_,_,_,X, //: 3 | |
- X,X,X,X,X,X,X,X, //: 4 | |
- //: --- |
- //: 1 2 3 4 5 6 7 8 --- Cross Sections
- X,_,_,_,_,_,_,X, //: 1 | Can be thought
- _,_,_,_,_,_,_,_, //: 2 | of as differ-
- _,_,_,_,_,_,_,_, //: 3 | -ent 2D
- X,_,_,_,_,_,_,X, //: 4 | tilemaps.
- //: --- |
- //: 1 2 3 4 5 6 7 8 --- |
- X,_,_,_,_,_,_,X, //: 1 | |
- X,_,_,_,_,_,_,X, //: 2 | Z == 2 |
- X,_,_,_,_,_,_,X, //: 3 | |
- X,_,_,_,_,_,_,X //: 4 | V
- //: --- -----------------
- );
- #undef _
- #undef X
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement