style: drop redundant type qualifiers, use explicit types (IDE cleanup)
Pure formatting from the IDE's code cleanup: remove redundant ClassName./namespace qualifiers and replace var with explicit types. No behavior change.
This commit is contained in:
@@ -4,16 +4,16 @@ public sealed class Chunk
|
||||
{
|
||||
public const int Size = 16;
|
||||
|
||||
private readonly ushort[] _ids = new ushort[Chunk.Size * Chunk.Size * Chunk.Size];
|
||||
private readonly ushort[] _ids = new ushort[Size * Size * Size];
|
||||
|
||||
public ushort this[int x, int y, int z]
|
||||
{
|
||||
get => this._ids[Chunk.Index(x, y, z)];
|
||||
set => this._ids[Chunk.Index(x, y, z)] = value;
|
||||
get => this._ids[Index(x, y, z)];
|
||||
set => this._ids[Index(x, y, z)] = value;
|
||||
}
|
||||
|
||||
public static bool InBounds(int x, int y, int z) =>
|
||||
x is >= 0 and < Chunk.Size && y is >= 0 and < Chunk.Size && z is >= 0 and < Chunk.Size;
|
||||
x is >= 0 and < Size && y is >= 0 and < Size && z is >= 0 and < Size;
|
||||
|
||||
private static int Index(int x, int y, int z) => (x * Chunk.Size + y) * Chunk.Size + z;
|
||||
private static int Index(int x, int y, int z) => (x * Size + y) * Size + z;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ public sealed class ChunkMesher : IChunkMesher
|
||||
|
||||
public ChunkMesher(int atlasWidthPixels, int atlasHeightPixels)
|
||||
{
|
||||
this._tileU = (float)ChunkMesher.TileSizePixels / atlasWidthPixels;
|
||||
this._tileV = (float)ChunkMesher.TileSizePixels / atlasHeightPixels;
|
||||
this._tileU = (float)TileSizePixels / atlasWidthPixels;
|
||||
this._tileV = (float)TileSizePixels / atlasHeightPixels;
|
||||
}
|
||||
|
||||
// Per-face geometry: base corner + two in-plane edge vectors (u, v) with
|
||||
@@ -65,7 +65,7 @@ public sealed class ChunkMesher : IChunkMesher
|
||||
IBlock block = registry.Get(chunk[x, y, z]);
|
||||
if (!block.IsOpaque) continue;
|
||||
|
||||
foreach (Face face in ChunkMesher.Faces)
|
||||
foreach (Face face in Faces)
|
||||
{
|
||||
int nx = x + face.Normal.x;
|
||||
int ny = y + face.Normal.y;
|
||||
@@ -91,9 +91,9 @@ public sealed class ChunkMesher : IChunkMesher
|
||||
// Image is flipped on load, so offset from the top to keep tile (0,0) = top-left.
|
||||
float vBase = 1f - (tile.Y + 1) * this._tileV;
|
||||
|
||||
foreach (int corner in ChunkMesher.Triangle)
|
||||
foreach (int corner in Triangle)
|
||||
{
|
||||
(float cu, float cv) = ChunkMesher.Corners[corner];
|
||||
(float cu, float cv) = Corners[corner];
|
||||
|
||||
float px = x + face.Base.x + face.U.x * cu + face.V.x * cv;
|
||||
float py = y + face.Base.y + face.U.y * cu + face.V.y * cv;
|
||||
|
||||
@@ -74,9 +74,9 @@ public sealed class CaveCarver
|
||||
int chunkBaseY = chunkPos.Y * VoxelChunk.Size;
|
||||
int chunkBaseZ = chunkPos.Z * VoxelChunk.Size;
|
||||
|
||||
int chunkCellX = CaveCarver.FloorDiv(chunkBaseX, cellSize);
|
||||
int chunkCellY = CaveCarver.FloorDiv(chunkBaseY, cellSize);
|
||||
int chunkCellZ = CaveCarver.FloorDiv(chunkBaseZ, cellSize);
|
||||
int chunkCellX = FloorDiv(chunkBaseX, cellSize);
|
||||
int chunkCellY = FloorDiv(chunkBaseY, cellSize);
|
||||
int chunkCellZ = FloorDiv(chunkBaseZ, cellSize);
|
||||
|
||||
for (int cdx = -radius; cdx <= radius; cdx++)
|
||||
for (int cdy = -radius; cdy <= radius; cdy++)
|
||||
|
||||
@@ -5,6 +5,6 @@ namespace VoxelEngine.World.WorldGen;
|
||||
public static class WorldConstants
|
||||
{
|
||||
public const int WorldHeightChunks = 32;
|
||||
public const int WorldHeight = WorldConstants.WorldHeightChunks * VoxelChunk.Size; // 512
|
||||
public const int WorldHeight = WorldHeightChunks * VoxelChunk.Size; // 512
|
||||
public const int SeaLevel = 256;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user