Advertisement
DEKTEN

FOR_SKETCHPUNKLABS_001

Nov 26th, 2020
605
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Hello Sketchpunk Labs, here is how I've been storing my voxel map data:
  2. I've never seen your videos before. Are you familiar with the formulas:
  3.  
  4.  
  5. tile_coord_x =  tile_coord_as_1d_index    % WID
  6. tile_coord_y = (tile_coord_as_1d_index    -tile_coord_x )/ WID
  7.  
  8.         //:Number of tiles on each axis:
  9.         #define NTX  8  //:Num_Tiles (   in_voxel_map )
  10.         #define NTY  4  //:Num_Tiles (   in_voxel_map )
  11.         #define NTZ  3  //:Num_Tiles (   in_voxel_map )
  12.  
  13.         //:Size_Of_A_Voxel_Tile_Measured_In_Pixels:
  14.         #define NPX  16 //:Num_Pixels_X( in_a_tile    )
  15.         #define NPY  16 //:Num_Pixels_Y( in_a_tile    )
  16.         #define NPZ  16 //:Num_Pixels_Z( in_a_tile    )
  17.  
  18.         //:Total__number_of__Pixels__in_entire_voxel_map
  19.         #define TPX  ( NTX * NPX ) //: Total_Pixels_X
  20.         #define TPY  ( NTY * NPY ) //: Total_Pixels_Y
  21.         #define TPZ  ( NTZ * NPZ ) //: Total_Pixels_Z
  22.  
  23.         #define _ 0                                          
  24.         #define X 1                                          
  25.         int VAT[ NTX * NTY * NTZ ]=int[ 8 * 4 * 3 ](  
  26.  
  27.         /** TODO: Eventually use an integer texture  **/
  28.         /**       for this tilemap data.             **/
  29.            
  30.         //:Highest Z Cross Section Is First Tile Map
  31.         //: 1 2 3 4 5 6 7 8        --- -----------------
  32.             X,X,X,X,X,X,X,X, //: 1  |             ^
  33.             X,_,_,_,_,_,_,X, //: 2  | Z == 0      |
  34.             X,_,_,_,_,_,_,X, //: 3  |             |
  35.             X,X,X,X,X,X,X,X, //: 4  |             |
  36.         //:                        ---            |
  37.         //: 1 2 3 4 5 6 7 8        ---   Cross Sections
  38.             X,_,_,_,_,_,_,X, //: 1  |    Can be thought
  39.             _,_,_,_,_,_,_,_, //: 2  |    of as differ-
  40.             _,_,_,_,_,_,_,_, //: 3  |    -ent 2D
  41.             X,_,_,_,_,_,_,X, //: 4  |    tilemaps.
  42.         //:                        ---            |
  43.         //: 1 2 3 4 5 6 7 8        ---            |
  44.             X,_,_,_,_,_,_,X, //: 1  |             |
  45.             X,_,_,_,_,_,_,X, //: 2  | Z == 2      |
  46.             X,_,_,_,_,_,_,X, //: 3  |             |
  47.             X,_,_,_,_,_,_,X  //: 4  |             V
  48.         //:                        --- -----------------
  49.         );                                                
  50.         #undef  _                                            
  51.         #undef  X  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement