feat: add lighting to rendering state and minmap generation from heightmap#99
Conversation
6.1 Time-of-day lighting - Add LightingState class (src/render/lighting_state.hpp/cpp) that wraps GlobalLighting, handles time-of-day slot selection (Morning/Afternoon/ Evening/Night), and produces TerrainPushConstant and object lighting vectors for CPU-side consumers. - Extend UniformBufferObject with lightDirection, ambientColor, diffuseColor vec4s so basic.frag reads scene lighting from the UBO instead of hardcoded constants. - Update Renderer::updateUniformBuffer() to populate UBO lighting from LightingState when set, falling back to pre-Phase-6 defaults otherwise. - Update standard() and skinned() descriptor binding 0 stage flags to expose UBO to the fragment shader. 6.2 Shadow color - Decode GlobalLighting::shadowColor (ARGB uint32) in LightingState and expose it via TerrainPushConstant::shadowColor (vec4). - terrain.frag blends diffuse result toward shadow colour to simulate cast shadows. 6.3 Cloud shadows - Add cloud scroll/strength/time parameters to TerrainPushConstant. - terrain.vert computes fragCloudCoord (world-space xz * scale + time*scroll). - terrain.frag applies a 2-octave procedural FBM noise cloud shadow overlay without requiring an additional texture binding. - LightingState::setCloudShadow() / disableCloudShadow() / update() manage cloud animation accumulation. - TerrainRenderable::update(dt) forwards delta time to the push constant. 6.4 Minimap generation - Add MinimapGenerator (src/render/terrain/terrain_minimap.hpp/cpp) with generate() (1:1 pixel per heightmap cell) and generateScaled() (bilinear downsampling) producing RGBA8 images from HeightMap data. Tests (TDD) - tests/render/test_lighting_state.cpp – 23 tests covering defaults, setGlobalLighting, time-of-day switching, push constant generation, ARGB shadow decoding, object lighting, and cloud animation. - tests/terrain/test_terrain_minimap.cpp – 14 tests covering empty/invalid inputs, pixel count, gradient variation, bilinear scaling, edge clamping. - Fix pre-existing test regression: update TestsObjectFlagHelpers to match MapObject::shouldRender() behavior introduced in f20af65 (road/bridge points are placement markers and correctly return false from shouldRender). - Add GLFW_INCLUDE_NONE compile definition to suppress GL/gl.h inclusion in headless CI environments. All 24 test targets pass (100%). https://claude.ai/code/session_01St1oa77j4XRUuovTYQbAFn
Greptile SummaryImplements Phase 6 lighting, shadows, cloud effects, and minimap generation with comprehensive test coverage. Introduces Key changes:
Architecture:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: f6bc03f |
Greptile SummaryImplements Phase 6 lighting system with time-of-day management, shadow color tinting, procedural cloud shadows, and CPU-side minimap generation. The implementation follows the project's architecture patterns with proper RAII, extensive test coverage (38+ unit tests), and maintains backward compatibility through fallback defaults. Key implementations:
Issues identified:
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: 02d8047 |
Greptile SummaryImplements Phase 6 lighting and minimap features for the terrain rendering pipeline. Adds Key improvements:
Architecture:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 291c939 |
Summary
Implements Phase 6 of the rendering pipeline, adding time-of-day lighting, shadow colour tinting, cloud shadow animation, and minimap generation. Introduces
LightingStateto manage scene lighting state andMinimapGeneratorfor CPU-side minimap rendering.Key Changes
Lighting System (Phase 6.1–6.3)
LightingState class (
src/render/lighting_state.hpp/cpp): Manages active lighting state with support for:Shadow colour support (Phase 6.2): Decodes ARGB shadow colour from
GlobalLightingand applies tinting in terrain fragment shader based on surface orientationCloud shadow animation (Phase 6.3):
update()Minimap Generation (Phase 6.4)
src/render/terrain/terrain_minimap.hpp/cpp):Shader Updates
LightingState)UniformBufferObjectandTerrainPushConstantwith lighting and cloud parametersIntegration
LightingState(or defaults)setLighting(LightingState&)method for Phase 6 lightingLightingStateandMinimapGenerator(no Vulkan dependency)Implementation Details
https://claude.ai/code/session_01St1oa77j4XRUuovTYQbAFn