baseline: working salvaged prototype on Godot 4.7.1 (pre-F1)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stewart Howe 2026-08-05 01:45:41 -04:00
commit 7f0f43b5fb
48 changed files with 2913 additions and 0 deletions

View file

@ -0,0 +1,31 @@
using Godot;
using IslaApocalypse.Core;
namespace IslaApocalypse.Client
{
// Notice this inherits from MeshInstance3D, which is Godot's visual 3D node!
public partial class ChunkRenderer : MeshInstance3D
{
public void RenderChunk(ChunkData data)
{
// 1. Pass the BlockIDs array to the generator!
Mesh = MarchingCubes.GenerateMesh(data.Densities, data.BlockIDs, Constants.ISO_LEVEL, Constants.VOXEL_SCALE);
StandardMaterial3D mat = new StandardMaterial3D();
// 2. THE FIX: Tell the material to use the colors we paint on the vertices!
mat.VertexColorUseAsAlbedo = true;
mat.Roughness = 0.8f;
mat.CullMode = BaseMaterial3D.CullModeEnum.Disabled;
MaterialOverride = mat;
Position = new Vector3(
data.ChunkPosition.X * Constants.CHUNK_SIZE_X * Constants.VOXEL_SCALE,
0,
data.ChunkPosition.Y * Constants.CHUNK_SIZE_Z * Constants.VOXEL_SCALE
);
}
}
}