GETerrainRenderer

Builds one cube per non-air block from a World, split into static and animated meshes.

Overview

Builds two Easy3D::CubeMeshRenderer instances from a Worlds::World: one static mesh for non-animated non-air blocks (built once), and one animated-subset mesh rebuilt whenever Update(device, animPhase) sees a new phase.

Sources: src/GalaxyEggbertCNA/Game/GETerrainRenderer.hpp and .cpp.

Construction

Triple-nested loop over the world's full blocksPerAxis() cube. For every non-air block:

worldX = x - kWorldCenterX;  worldZ = z - kWorldCenterZ;   // Y unshifted
if (BlockTypes::tileAnimBase(block.type()) is animated)
    m_animBlocks.push_back({worldX, y, worldZ, baseIcon});
else
    cubeBatch.Add(Cube(worldX, y, worldZ, size=1, uv=tileAtlas.GetTileUv(block.type())));

Also accumulates centroid sums (exposed as CentroidX/Y/Z()) — used as a camera look-at target since the spawn tile may be open air. Easy3D::BuildCubeMesh converts the batch into vertex/index arrays (24 vertices + 36 indices per cube), fed into a CubeMeshRenderer that uploads once to CNA VertexBuffer/IndexBuffer.

Animated Tile Groups (ported from mobile-eggbert Tables.cpp)

TileFrames
Lava8
Spike16
Crusher10
Saw6
Water1 / Water26 each
Temp20 (2 invisible frames)
Fan ×4 directions3 each
Marine11

AnimIcon(base, phase) looks up the current icon; IsAnimated(base) gates classification.

Update(device, animPhase)

No-op if the phase hasn't changed. Otherwise rebuilds the animated mesh from the current frame's icons. If the phase yields zero visible animated cubes (e.g. Temp's blank frames), the animated renderer is reset to null rather than uploading empty data.

Draw

staticRenderer->Draw(device, effect);
if (animatedRenderer) animatedRenderer->Draw(device, effect);

Known Limitations

Dependencies

Easy3D (CubeBatch, CubeMesh, CubeMeshRenderer), GETileAtlas, Worlds::World, BlockTypes.