mooviies

Untitled

May 3rd, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1.         public VoxelTypeDefinition GetVoxelTypeDefinition(ushort voxel)
  2.         {
  3.             ushort mask = 0xFFFF;
  4.  
  5.             if((voxel & 0xFF00) != 0xFF00) //Format 1111 1111 tttt tttt
  6.                 if((voxel & 0xF000) == 0xF000) //Format 1111 tttt tttt dddd
  7.                     mask <<= 4;
  8.                 else if((voxel & 0x8000) == 0x8000) //Format 1ttt tttt dddd dddd
  9.                     mask <<= 8;
  10.                 else if((voxel & 0x1000) == 0)
  11.                     mask <<= 12; //Format 0ttt dddd dddd dddd
  12.  
  13.             return voxelTypes[(ushort)(voxel & mask)];
  14.         }
Advertisement
Add Comment
Please, Sign In to add comment