Culling, rendering improvements and optimizations, block removing test.

This commit is contained in:
2025-09-02 22:43:35 +02:00
parent a9cab195b6
commit 00713db79e
16 changed files with 390 additions and 210 deletions

View File

@@ -2,8 +2,11 @@
{
public enum Blocks : byte
{
Air = 0,
Stone = 1,
Air,
Stone,
Dirt,
OakPlanks,
Grass
}
public enum Orientation : uint
@@ -16,8 +19,58 @@
South = 5, // - Z
}
public enum Texture : uint
public class BlockDefinition
{
Stone = 1
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
)},
};
}
}
}