Files
voxel/Blocks.cs

77 lines
2.1 KiB
C#

namespace Voxel
{
public enum Blocks : byte
{
Air,
Stone,
Dirt,
OakPlanks,
Grass
}
public enum Orientation : uint
{
West = 0, // + X
East = 1, // - X
Top = 2, // + Y
Bottom = 3,// - Y
North = 4, // + Z
South = 5, // - Z
}
public class BlockDefinition
{
public Blocks BlockType;
public Textures[] FaceTextures;
public BlockDefinition(Blocks type, Textures singleTexture)
{
BlockType = type;
FaceTextures = new Voxel.Textures[6];
for (int i = 0; i < 6; i++) FaceTextures[i] = singleTexture;
}
public BlockDefinition(
Blocks type,
Textures west,
Textures east,
Textures top,
Textures bottom,
Textures north,
Textures south
)
{
BlockType = type;
FaceTextures = new Textures[]
{
west, east, top, bottom, north, south
};
}
}
public static class BlockDefinitions
{
public static readonly Dictionary<Blocks, BlockDefinition> Blocks;
static BlockDefinitions()
{
Blocks = new Dictionary<Blocks, BlockDefinition>
{
{ Voxel.Blocks.Stone, new BlockDefinition(Voxel.Blocks.Stone, Voxel.Textures.Stone) },
{ Voxel.Blocks.Dirt, new BlockDefinition(Voxel.Blocks.Dirt, Voxel.Textures.Dirt) },
{ Voxel.Blocks.OakPlanks, new BlockDefinition(Voxel.Blocks.OakPlanks, Voxel.Textures.OakPlanks) },
{ Voxel.Blocks.Grass, new BlockDefinition(
Voxel.Blocks.Grass,
Voxel.Textures.GrassSide, // West
Voxel.Textures.GrassSide, // East
Voxel.Textures.GrassTop, // Top
Voxel.Textures.Dirt, // Bottom
Voxel.Textures.GrassSide, // North
Voxel.Textures.GrassSide // South
)},
};
}
}
}