Browse Source

apply format

djeada 1 month ago
parent
commit
e0d38d82b6

+ 4 - 3
app/core/game_engine.cpp

@@ -108,9 +108,10 @@ GameEngine::GameEngine() {
   m_pine = std::make_unique<Render::GL::PineRenderer>();
   m_firecamp = std::make_unique<Render::GL::FireCampRenderer>();
 
-  m_passes = {m_ground.get(), m_terrain.get(), m_river.get(), m_riverbank.get(),
-              m_bridge.get(), m_biome.get(),   m_stone.get(), m_plant.get(),
-              m_pine.get(),   m_firecamp.get(), m_fog.get()};
+  m_passes = {m_ground.get(),    m_terrain.get(), m_river.get(),
+              m_riverbank.get(), m_bridge.get(),  m_biome.get(),
+              m_stone.get(),     m_plant.get(),   m_pine.get(),
+              m_firecamp.get(),  m_fog.get()};
 
   std::unique_ptr<Engine::Core::System> arrowSys =
       std::make_unique<Game::Systems::ArrowSystem>();

+ 31 - 32
assets/shaders/firecamp.frag

@@ -10,36 +10,35 @@ uniform float u_time;
 uniform float u_glowStrength;
 
 void main() {
-    float flameHeight = clamp(FlameHeight, 0.0, 1.0);
-    float intensityScale = clamp(Intensity, 0.6, 1.6);
-
-    vec2 animatedUV =
-        vec2(TexCoord.x, TexCoord.y + fract(u_time * 0.45 + FlamePhase * 0.05));
-    vec4 texColor = texture(fireTexture, animatedUV);
-
-    float noiseLow =
-        0.5 + 0.5 * sin(u_time * 2.3 + FlamePhase * 1.9 + flameHeight * 7.0);
-    float noiseHigh =
-        0.5 + 0.5 * sin(u_time * 4.8 + FlamePhase * 3.6 + TexCoord.x * 10.0);
-    float flicker = mix(noiseLow, noiseHigh, clamp(flameHeight * 1.2, 0.0, 1.0));
-
-    vec3 baseColor =
-        mix(vec3(1.18, 0.56, 0.15), vec3(0.95, 0.28, 0.08), flameHeight);
-    vec3 coreGlow = vec3(1.45, 0.92, 0.44);
-    vec3 flame =
-        mix(baseColor, coreGlow, pow(1.0 - flameHeight, 2.4) * 0.6) *
-        mix(0.85, 1.35, flicker) * intensityScale *
-        mix(vec3(1.0), vec3(1.55), clamp(texColor.rgb, 0.0, 1.0));
-
-    float edgeFade = smoothstep(0.0, 0.2, TexCoord.x) *
-                     smoothstep(0.0, 0.2, 1.0 - TexCoord.x);
-    float heightFade = smoothstep(1.05, 0.42, TexCoord.y);
-    float alpha = edgeFade * heightFade *
-                  mix(0.78, 1.05, flicker) * intensityScale * texColor.a;
-
-    float glow = pow(1.0 - flameHeight, 2.8) * u_glowStrength;
-    flame += vec3(1.26, 0.64, 0.22) * glow * intensityScale;
-
-    flame = clamp(flame, 0.0, 3.2);
-    FragColor = vec4(flame, clamp(alpha, 0.0, 1.0));
+  float flameHeight = clamp(FlameHeight, 0.0, 1.0);
+  float intensityScale = clamp(Intensity, 0.6, 1.6);
+
+  vec2 animatedUV =
+      vec2(TexCoord.x, TexCoord.y + fract(u_time * 0.45 + FlamePhase * 0.05));
+  vec4 texColor = texture(fireTexture, animatedUV);
+
+  float noiseLow =
+      0.5 + 0.5 * sin(u_time * 2.3 + FlamePhase * 1.9 + flameHeight * 7.0);
+  float noiseHigh =
+      0.5 + 0.5 * sin(u_time * 4.8 + FlamePhase * 3.6 + TexCoord.x * 10.0);
+  float flicker = mix(noiseLow, noiseHigh, clamp(flameHeight * 1.2, 0.0, 1.0));
+
+  vec3 baseColor =
+      mix(vec3(1.18, 0.56, 0.15), vec3(0.95, 0.28, 0.08), flameHeight);
+  vec3 coreGlow = vec3(1.45, 0.92, 0.44);
+  vec3 flame = mix(baseColor, coreGlow, pow(1.0 - flameHeight, 2.4) * 0.6) *
+               mix(0.85, 1.35, flicker) * intensityScale *
+               mix(vec3(1.0), vec3(1.55), clamp(texColor.rgb, 0.0, 1.0));
+
+  float edgeFade =
+      smoothstep(0.0, 0.2, TexCoord.x) * smoothstep(0.0, 0.2, 1.0 - TexCoord.x);
+  float heightFade = smoothstep(1.05, 0.42, TexCoord.y);
+  float alpha = edgeFade * heightFade * mix(0.78, 1.05, flicker) *
+                intensityScale * texColor.a;
+
+  float glow = pow(1.0 - flameHeight, 2.8) * u_glowStrength;
+  flame += vec3(1.26, 0.64, 0.22) * glow * intensityScale;
+
+  flame = clamp(flame, 0.0, 3.2);
+  FragColor = vec4(flame, clamp(alpha, 0.0, 1.0));
 }

+ 43 - 44
assets/shaders/firecamp.vert

@@ -3,8 +3,8 @@ layout(location = 0) in vec3 aPos;
 layout(location = 1) in vec2 aTexCoord;
 
 // Instance attributes
-layout(location = 3) in vec4 i_posIntensity;  // x, y, z, intensity
-layout(location = 4) in vec4 i_radiusPhase;   // radius, phase, duration, unused
+layout(location = 3) in vec4 i_posIntensity; // x, y, z, intensity
+layout(location = 4) in vec4 i_radiusPhase;  // radius, phase, duration, unused
 
 uniform mat4 u_viewProj;
 uniform float u_time;
@@ -19,55 +19,54 @@ out float FlamePhase;
 out float FlameHeight;
 
 void main() {
-    vec3 campPos = i_posIntensity.xyz;
-    float intensity = i_posIntensity.w;
-    float phase = i_radiusPhase.y;
-    float radius = i_radiusPhase.x;
+  vec3 campPos = i_posIntensity.xyz;
+  float intensity = i_posIntensity.w;
+  float phase = i_radiusPhase.y;
+  float radius = i_radiusPhase.x;
 
-    vec3 rightVec = normalize(vec3(u_cameraRight.x, 0.0, u_cameraRight.z));
-    if (length(rightVec) < 1e-4)
-        rightVec = vec3(1.0, 0.0, 0.0);
-    vec3 forwardVec = normalize(vec3(u_cameraForward.x, 0.0, u_cameraForward.z));
-    if (length(forwardVec) < 1e-4)
-        forwardVec = normalize(vec3(-rightVec.z, 0.0, rightVec.x));
-    vec3 upVec = vec3(0.0, 1.0, 0.0);
+  vec3 rightVec = normalize(vec3(u_cameraRight.x, 0.0, u_cameraRight.z));
+  if (length(rightVec) < 1e-4)
+    rightVec = vec3(1.0, 0.0, 0.0);
+  vec3 forwardVec = normalize(vec3(u_cameraForward.x, 0.0, u_cameraForward.z));
+  if (length(forwardVec) < 1e-4)
+    forwardVec = normalize(vec3(-rightVec.z, 0.0, rightVec.x));
+  vec3 upVec = vec3(0.0, 1.0, 0.0);
 
-    float planeId = floor(aPos.z + 0.5);
-    float angle = planeId * 2.0943951; // 120 degrees
-    float c = cos(angle);
-    float s = sin(angle);
-    vec3 horizontalAxis = normalize(rightVec * c + forwardVec * s);
-    if (length(horizontalAxis) < 1e-4)
-        horizontalAxis = rightVec;
+  float planeId = floor(aPos.z + 0.5);
+  float angle = planeId * 2.0943951; // 120 degrees
+  float c = cos(angle);
+  float s = sin(angle);
+  vec3 horizontalAxis = normalize(rightVec * c + forwardVec * s);
+  if (length(horizontalAxis) < 1e-4)
+    horizontalAxis = rightVec;
 
-    float intensityScale = clamp(intensity, 0.65, 1.4);
-    float heightT = clamp(aTexCoord.y, 0.0, 1.0);
+  float intensityScale = clamp(intensity, 0.65, 1.4);
+  float heightT = clamp(aTexCoord.y, 0.0, 1.0);
 
-    float widthBase = clamp(radius * 0.18 * intensityScale, 0.55, 0.95);
-    float widthScale = mix(widthBase, widthBase * 0.35, heightT);
-    float heightScale = clamp(radius * 0.24 * intensityScale, 0.55, 1.05);
+  float widthBase = clamp(radius * 0.18 * intensityScale, 0.55, 0.95);
+  float widthScale = mix(widthBase, widthBase * 0.35, heightT);
+  float heightScale = clamp(radius * 0.24 * intensityScale, 0.55, 1.05);
 
-    float flickerOffset =
-        sin(u_time * u_flickerSpeed + phase) * (u_flickerAmount * 0.55);
-    float sway = sin(u_time * (u_flickerSpeed * 1.05) + phase * 2.1 +
-                     heightT * 2.7);
-    vec3 wobbleOffset =
-        horizontalAxis * (sway * u_flickerAmount * radius * (0.18 + heightT * 0.35));
+  float flickerOffset =
+      sin(u_time * u_flickerSpeed + phase) * (u_flickerAmount * 0.55);
+  float sway =
+      sin(u_time * (u_flickerSpeed * 1.05) + phase * 2.1 + heightT * 2.7);
+  vec3 wobbleOffset = horizontalAxis * (sway * u_flickerAmount * radius *
+                                        (0.18 + heightT * 0.35));
 
-    vec3 localOffset =
-        horizontalAxis * (aPos.x * widthScale) +
-        upVec * (aPos.y * heightScale * (0.85 + heightT * 0.25));
+  vec3 localOffset = horizontalAxis * (aPos.x * widthScale) +
+                     upVec * (aPos.y * heightScale * (0.85 + heightT * 0.25));
 
-    float taper = mix(0.0, widthBase * 0.25, heightT * heightT);
-    localOffset += horizontalAxis * (-aPos.x * taper);
+  float taper = mix(0.0, widthBase * 0.25, heightT * heightT);
+  localOffset += horizontalAxis * (-aPos.x * taper);
 
-    float baseLift = radius * 0.02 + intensity * 0.04;
-    vec3 pos = campPos + localOffset + wobbleOffset +
-               upVec * (flickerOffset + baseLift);
+  float baseLift = radius * 0.02 + intensity * 0.04;
+  vec3 pos =
+      campPos + localOffset + wobbleOffset + upVec * (flickerOffset + baseLift);
 
-    gl_Position = u_viewProj * vec4(pos, 1.0);
-    TexCoord = aTexCoord;
-    Intensity = intensity;
-    FlamePhase = phase;
-    FlameHeight = heightT;
+  gl_Position = u_viewProj * vec4(pos, 1.0);
+  TexCoord = aTexCoord;
+  Intensity = intensity;
+  FlamePhase = phase;
+  FlameHeight = heightT;
 }

+ 2 - 2
game/map/level_loader.cpp

@@ -83,8 +83,8 @@ LevelLoadResult LevelLoader::loadFromAssets(const QString &mapPath,
     bool hasBarracks = false;
     for (auto *e : world.getEntitiesWith<Engine::Core::UnitComponent>()) {
       if (auto *u = e->getComponent<Engine::Core::UnitComponent>()) {
-        if (u->unitType ==
-                Game::Units::spawnTypeToString(Game::Units::SpawnType::Barracks) &&
+        if (u->unitType == Game::Units::spawnTypeToString(
+                               Game::Units::SpawnType::Barracks) &&
             owners.isPlayer(u->ownerId)) {
           hasBarracks = true;
           break;

+ 6 - 7
game/map/skirmish_loader.cpp

@@ -287,32 +287,31 @@ SkirmishLoadResult SkirmishLoader::start(const QString &mapPath,
     if (terrainService.isInitialized() && terrainService.getHeightMap()) {
       m_firecamp->configure(*terrainService.getHeightMap(),
                             terrainService.biomeSettings());
-      
-      // Load explicit firecamps from map definition
+
       const auto &fireCamps = terrainService.fireCamps();
       if (!fireCamps.empty()) {
         std::vector<QVector3D> positions;
         std::vector<float> intensities;
         std::vector<float> radii;
-        
+
         const auto *heightMap = terrainService.getHeightMap();
         const float tileSize = heightMap->getTileSize();
         const int width = heightMap->getWidth();
         const int height = heightMap->getHeight();
         const float halfWidth = width * 0.5f;
         const float halfHeight = height * 0.5f;
-        
+
         for (const auto &fc : fireCamps) {
-          // Convert grid coordinates to world coordinates
+
           float worldX = (fc.x - halfWidth) * tileSize;
           float worldZ = (fc.z - halfHeight) * tileSize;
           float worldY = terrainService.getTerrainHeight(worldX, worldZ);
-          
+
           positions.push_back(QVector3D(worldX, worldY, worldZ));
           intensities.push_back(fc.intensity);
           radii.push_back(fc.radius);
         }
-        
+
         m_firecamp->setExplicitFireCamps(positions, intensities, radii);
       }
     }

+ 3 - 2
game/systems/terrain_alignment_system.cpp

@@ -35,8 +35,9 @@ void TerrainAlignmentSystem::alignEntityToTerrain(
   float entityBaseOffset = 0.0f;
   if (auto *unit = entity->getComponent<Engine::Core::UnitComponent>()) {
     if (!unit->unitType.empty()) {
-      entityBaseOffset = Game::Units::TroopConfig::instance()
-                              .getSelectionRingGroundOffset(unit->unitType);
+      entityBaseOffset =
+          Game::Units::TroopConfig::instance().getSelectionRingGroundOffset(
+              unit->unitType);
     }
   }
 

+ 20 - 20
game/units/factory.cpp

@@ -9,30 +9,30 @@ namespace Game {
 namespace Units {
 
 void registerBuiltInUnits(UnitFactoryRegistry &reg) {
-  reg.registerFactory(SpawnType::Archer,
-                      [](Engine::Core::World &world, const SpawnParams &params) {
-                        return Archer::Create(world, params);
-                      });
+  reg.registerFactory(SpawnType::Archer, [](Engine::Core::World &world,
+                                            const SpawnParams &params) {
+    return Archer::Create(world, params);
+  });
 
-  reg.registerFactory(SpawnType::Knight,
-                      [](Engine::Core::World &world, const SpawnParams &params) {
-                        return Knight::Create(world, params);
-                      });
+  reg.registerFactory(SpawnType::Knight, [](Engine::Core::World &world,
+                                            const SpawnParams &params) {
+    return Knight::Create(world, params);
+  });
 
-  reg.registerFactory(SpawnType::MountedKnight,
-                      [](Engine::Core::World &world, const SpawnParams &params) {
-                        return MountedKnight::Create(world, params);
-                      });
+  reg.registerFactory(SpawnType::MountedKnight, [](Engine::Core::World &world,
+                                                   const SpawnParams &params) {
+    return MountedKnight::Create(world, params);
+  });
 
-  reg.registerFactory(SpawnType::Spearman,
-                      [](Engine::Core::World &world, const SpawnParams &params) {
-                        return Spearman::Create(world, params);
-                      });
+  reg.registerFactory(SpawnType::Spearman, [](Engine::Core::World &world,
+                                              const SpawnParams &params) {
+    return Spearman::Create(world, params);
+  });
 
-  reg.registerFactory(SpawnType::Barracks,
-                      [](Engine::Core::World &world, const SpawnParams &params) {
-                        return Barracks::Create(world, params);
-                      });
+  reg.registerFactory(SpawnType::Barracks, [](Engine::Core::World &world,
+                                              const SpawnParams &params) {
+    return Barracks::Create(world, params);
+  });
 }
 
 } // namespace Units

+ 1 - 1
game/units/factory.h

@@ -1,7 +1,7 @@
 #pragma once
 
-#include "unit.h"
 #include "spawn_type.h"
+#include "unit.h"
 #include <functional>
 #include <memory>
 #include <string>

+ 1 - 3
game/units/spawn_type.h

@@ -54,9 +54,7 @@ inline bool tryParseSpawnType(const QString &value, SpawnType &out) {
   return false;
 }
 
-inline bool isTroopSpawn(SpawnType type) {
-  return type != SpawnType::Barracks;
-}
+inline bool isTroopSpawn(SpawnType type) { return type != SpawnType::Barracks; }
 
 inline std::optional<TroopType> spawnTypeToTroopType(SpawnType type) {
   switch (type) {

+ 6 - 5
render/draw_queue.h

@@ -117,10 +117,10 @@ struct SelectionSmokeCmd {
   float baseAlpha = 0.15f;
 };
 
-using DrawCmd =
-    std::variant<GridCmd, SelectionRingCmd, SelectionSmokeCmd, CylinderCmd,
-                 MeshCmd, FogBatchCmd, GrassBatchCmd, StoneBatchCmd,
-                 PlantBatchCmd, PineBatchCmd, FireCampBatchCmd, TerrainChunkCmd>;
+using DrawCmd = std::variant<GridCmd, SelectionRingCmd, SelectionSmokeCmd,
+                             CylinderCmd, MeshCmd, FogBatchCmd, GrassBatchCmd,
+                             StoneBatchCmd, PlantBatchCmd, PineBatchCmd,
+                             FireCampBatchCmd, TerrainChunkCmd>;
 
 enum class DrawCmdType : std::uint8_t {
   Grid = 0,
@@ -327,7 +327,8 @@ private:
     } else if (cmd.index() == FireCampBatchCmdIndex) {
       const auto &firecamp = std::get<FireCampBatchCmdIndex>(cmd);
       uint64_t bufferPtr =
-          reinterpret_cast<uintptr_t>(firecamp.instanceBuffer) & 0x0000FFFFFFFFFFFF;
+          reinterpret_cast<uintptr_t>(firecamp.instanceBuffer) &
+          0x0000FFFFFFFFFFFF;
       key |= bufferPtr;
     } else if (cmd.index() == TerrainChunkCmdIndex) {
       const auto &terrain = std::get<TerrainChunkCmdIndex>(cmd);

+ 186 - 235
render/entity/horse_renderer.cpp

@@ -68,8 +68,7 @@ inline QVector3D coatGradient(const QVector3D &coat, float verticalFactor,
 }
 
 inline QVector3D lerp3(const QVector3D &a, const QVector3D &b, float t) {
-  return QVector3D(a.x() + (b.x() - a.x()) * t,
-                   a.y() + (b.y() - a.y()) * t,
+  return QVector3D(a.x() + (b.x() - a.x()) * t, a.y() + (b.y() - a.y()) * t,
                    a.z() + (b.z() - a.z()) * t);
 }
 
@@ -262,8 +261,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     chest.translate(chestCenter);
     chest.scale(d.bodyWidth * 1.12f, d.bodyHeight * 0.95f,
                 d.bodyLength * 0.36f);
-    QVector3D chestColor =
-        coatGradient(v.coatColor, 0.75f, 0.20f, coatSeedA);
+    QVector3D chestColor = coatGradient(v.coatColor, 0.75f, 0.20f, coatSeedA);
     out.mesh(getUnitSphere(), chest, chestColor, nullptr, 1.0f);
   }
 
@@ -273,8 +271,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
                                               -d.bodyLength * 0.03f));
     withers.scale(d.bodyWidth * 0.75f, d.bodyHeight * 0.35f,
                   d.bodyLength * 0.18f);
-    QVector3D witherColor =
-        coatGradient(v.coatColor, 0.88f, 0.35f, coatSeedB);
+    QVector3D witherColor = coatGradient(v.coatColor, 0.88f, 0.35f, coatSeedB);
     out.mesh(getUnitSphere(), withers, witherColor, nullptr, 1.0f);
   }
 
@@ -283,8 +280,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     belly.translate(bellyCenter);
     belly.scale(d.bodyWidth * 0.98f, d.bodyHeight * 0.64f,
                 d.bodyLength * 0.40f);
-    QVector3D bellyColor =
-        coatGradient(v.coatColor, 0.25f, -0.10f, coatSeedC);
+    QVector3D bellyColor = coatGradient(v.coatColor, 0.25f, -0.10f, coatSeedC);
     out.mesh(getUnitSphere(), belly, bellyColor, nullptr, 1.0f);
   }
 
@@ -321,10 +317,9 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     out.mesh(getUnitSphere(), hip, hipColor, nullptr, 1.0f);
 
     QMatrix4x4 haunch = ctx.model;
-    haunch.translate(rumpCenter +
-                     QVector3D(side * d.bodyWidth * 0.88f,
-                               d.bodyHeight * 0.24f,
-                               -d.bodyLength * 0.20f));
+    haunch.translate(rumpCenter + QVector3D(side * d.bodyWidth * 0.88f,
+                                            d.bodyHeight * 0.24f,
+                                            -d.bodyLength * 0.20f));
     haunch.scale(QVector3D(d.bodyWidth * 0.32f, d.bodyHeight * 0.28f,
                            d.bodyLength * 0.18f));
     QVector3D haunchColor =
@@ -333,11 +328,10 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
              1.0f);
   }
 
-  QVector3D withersPeak = chestCenter +
-                          QVector3D(0.0f, d.bodyHeight * 0.62f,
-                                    -d.bodyLength * 0.06f);
-  QVector3D croupPeak = rumpCenter + QVector3D(0.0f, d.bodyHeight * 0.46f,
-                                               -d.bodyLength * 0.18f);
+  QVector3D withersPeak = chestCenter + QVector3D(0.0f, d.bodyHeight * 0.62f,
+                                                  -d.bodyLength * 0.06f);
+  QVector3D croupPeak =
+      rumpCenter + QVector3D(0.0f, d.bodyHeight * 0.46f, -d.bodyLength * 0.18f);
 
   {
     QMatrix4x4 spine = ctx.model;
@@ -351,28 +345,24 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
   for (int i = 0; i < 2; ++i) {
     float side = (i == 0) ? 1.0f : -1.0f;
-    QVector3D scapulaTop = withersPeak +
-                           QVector3D(side * d.bodyWidth * 0.52f,
-                                     d.bodyHeight * 0.08f,
-                                     d.bodyLength * 0.06f);
-    QVector3D scapulaBase = chestCenter +
-                            QVector3D(side * d.bodyWidth * 0.70f,
-                                      -d.bodyHeight * 0.02f,
-                                      d.bodyLength * 0.06f);
+    QVector3D scapulaTop =
+        withersPeak + QVector3D(side * d.bodyWidth * 0.52f,
+                                d.bodyHeight * 0.08f, d.bodyLength * 0.06f);
+    QVector3D scapulaBase =
+        chestCenter + QVector3D(side * d.bodyWidth * 0.70f,
+                                -d.bodyHeight * 0.02f, d.bodyLength * 0.06f);
     QVector3D scapulaMid = lerp(scapulaTop, scapulaBase, 0.55f);
-    drawCylinder(out, ctx.model, scapulaTop, scapulaMid, d.bodyWidth * 0.18f,
-                 coatGradient(v.coatColor, 0.82f, 0.16f,
-                              coatSeedA + side * 0.05f));
+    drawCylinder(
+        out, ctx.model, scapulaTop, scapulaMid, d.bodyWidth * 0.18f,
+        coatGradient(v.coatColor, 0.82f, 0.16f, coatSeedA + side * 0.05f));
 
     QMatrix4x4 shoulderCap = ctx.model;
-    shoulderCap.translate(scapulaBase +
-                          QVector3D(0.0f, d.bodyHeight * 0.04f,
-                                    d.bodyLength * 0.02f));
+    shoulderCap.translate(scapulaBase + QVector3D(0.0f, d.bodyHeight * 0.04f,
+                                                  d.bodyLength * 0.02f));
     shoulderCap.scale(QVector3D(d.bodyWidth * 0.32f, d.bodyHeight * 0.24f,
                                 d.bodyLength * 0.18f));
     out.mesh(getUnitSphere(), shoulderCap,
-             coatGradient(v.coatColor, 0.66f, 0.12f,
-                          coatSeedB + side * 0.07f),
+             coatGradient(v.coatColor, 0.66f, 0.12f, coatSeedB + side * 0.07f),
              nullptr, 1.0f);
   }
 
@@ -383,8 +373,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     sternum.scale(QVector3D(d.bodyWidth * 0.50f, d.bodyHeight * 0.14f,
                             d.bodyLength * 0.12f));
     out.mesh(getUnitSphere(), sternum,
-             coatGradient(v.coatColor, 0.18f, 0.18f, coatSeedA * 0.4f),
-             nullptr, 1.0f);
+             coatGradient(v.coatColor, 0.18f, 0.18f, coatSeedA * 0.4f), nullptr,
+             1.0f);
   }
 
   QVector3D neckBase =
@@ -401,26 +391,23 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
            cylinderBetween(ctx.model, neckBase, neckMid, neckRadius * 1.00f),
            neckColorBase, nullptr, 1.0f);
   out.mesh(getUnitCylinder(),
-          cylinderBetween(ctx.model, neckMid, neckTop, neckRadius * 0.86f),
+           cylinderBetween(ctx.model, neckMid, neckTop, neckRadius * 0.86f),
            lighten(neckColorBase, 1.03f), nullptr, 1.0f);
 
   {
-    QVector3D jugularStart = lerp(neckBase, neckTop, 0.42f) +
-                             QVector3D(d.bodyWidth * 0.18f,
-                                       -d.bodyHeight * 0.06f,
-                                       d.bodyLength * 0.04f);
-    QVector3D jugularEnd = jugularStart +
-                           QVector3D(0.0f, -d.bodyHeight * 0.24f,
-                                     d.bodyLength * 0.06f);
-    drawCylinder(out, ctx.model, jugularStart, jugularEnd,
-                 neckRadius * 0.18f,
+    QVector3D jugularStart =
+        lerp(neckBase, neckTop, 0.42f) + QVector3D(d.bodyWidth * 0.18f,
+                                                   -d.bodyHeight * 0.06f,
+                                                   d.bodyLength * 0.04f);
+    QVector3D jugularEnd = jugularStart + QVector3D(0.0f, -d.bodyHeight * 0.24f,
+                                                    d.bodyLength * 0.06f);
+    drawCylinder(out, ctx.model, jugularStart, jugularEnd, neckRadius * 0.18f,
                  lighten(neckColorBase, 1.08f), 0.85f);
   }
 
-  // Mane cards along the neck (compute after neck base/top defined)
   const int maneSections = 8;
-  QVector3D maneColor = lerp3(v.maneColor, QVector3D(0.12f, 0.09f, 0.08f),
-                              0.35f);
+  QVector3D maneColor =
+      lerp3(v.maneColor, QVector3D(0.12f, 0.09f, 0.08f), 0.35f);
   for (int i = 0; i < maneSections; ++i) {
     float t = static_cast<float>(i) / static_cast<float>(maneSections - 1);
     QVector3D spine = lerp(neckBase, neckTop, t) +
@@ -563,23 +550,19 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
              1.0f);
   }
 
-  // Simple bridle straps
   QVector3D bridleBase = muzzleCenter + QVector3D(0.0f, -d.headHeight * 0.05f,
-                                                 d.muzzleLength * 0.20f);
-  QVector3D cheekAnchorLeft = headCenter +
-                              QVector3D(d.headWidth * 0.55f,
-                                        d.headHeight * 0.05f,
-                                        -d.headLength * 0.05f);
-  QVector3D cheekAnchorRight = headCenter +
-                               QVector3D(-d.headWidth * 0.55f,
-                                         d.headHeight * 0.05f,
-                                         -d.headLength * 0.05f);
-  QVector3D brow = headCenter +
-                   QVector3D(0.0f, d.headHeight * 0.38f,
-                             -d.headLength * 0.28f);
+                                                  d.muzzleLength * 0.20f);
+  QVector3D cheekAnchorLeft =
+      headCenter + QVector3D(d.headWidth * 0.55f, d.headHeight * 0.05f,
+                             -d.headLength * 0.05f);
+  QVector3D cheekAnchorRight =
+      headCenter + QVector3D(-d.headWidth * 0.55f, d.headHeight * 0.05f,
+                             -d.headLength * 0.05f);
+  QVector3D brow =
+      headCenter + QVector3D(0.0f, d.headHeight * 0.38f, -d.headLength * 0.28f);
   QVector3D tackColor = lighten(v.tackColor, 0.9f);
-  drawCylinder(out, ctx.model, bridleBase, cheekAnchorLeft,
-               d.headWidth * 0.07f, tackColor);
+  drawCylinder(out, ctx.model, bridleBase, cheekAnchorLeft, d.headWidth * 0.07f,
+               tackColor);
   drawCylinder(out, ctx.model, bridleBase, cheekAnchorRight,
                d.headWidth * 0.07f, tackColor);
   drawCylinder(out, ctx.model, cheekAnchorLeft, brow, d.headWidth * 0.05f,
@@ -605,36 +588,34 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
   }
 
   {
-    QVector3D forelockBase = headCenter +
-                             QVector3D(0.0f, d.headHeight * 0.28f,
-                                       -d.headLength * 0.18f);
+    QVector3D forelockBase = headCenter + QVector3D(0.0f, d.headHeight * 0.28f,
+                                                    -d.headLength * 0.18f);
     for (int i = 0; i < 3; ++i) {
       float offset = (i - 1) * d.headWidth * 0.10f;
       QVector3D strandBase = forelockBase + QVector3D(offset, 0.0f, 0.0f);
-      QVector3D strandTip = strandBase +
-                            QVector3D(offset * 0.4f,
-                                      -d.headHeight * 0.25f,
-                                      d.headLength * 0.12f);
-      drawCone(out, ctx.model, strandTip, strandBase,
-               d.headWidth * 0.10f,
+      QVector3D strandTip =
+          strandBase +
+          QVector3D(offset * 0.4f, -d.headHeight * 0.25f, d.headLength * 0.12f);
+      drawCone(out, ctx.model, strandTip, strandBase, d.headWidth * 0.10f,
                v.maneColor * (0.94f + 0.03f * i), 0.96f);
     }
   }
 
   QVector3D tailBase =
       rumpCenter + QVector3D(0.0f, d.bodyHeight * 0.36f, -d.bodyLength * 0.48f);
-  QVector3D tailCtrl = tailBase + QVector3D(0.0f, -d.tailLength * 0.20f,
-                                            -d.tailLength * 0.28f);
-  QVector3D tailEnd = tailBase + QVector3D(0.0f, -d.tailLength,
-                                           -d.tailLength * 0.70f);
+  QVector3D tailCtrl =
+      tailBase + QVector3D(0.0f, -d.tailLength * 0.20f, -d.tailLength * 0.28f);
+  QVector3D tailEnd =
+      tailBase + QVector3D(0.0f, -d.tailLength, -d.tailLength * 0.70f);
   QVector3D tailColor = lerp3(v.tailColor, v.maneColor, 0.35f);
   QVector3D prevTail = tailBase;
   for (int i = 1; i <= 8; ++i) {
     float t = static_cast<float>(i) / 8.0f;
     QVector3D p = bezier(tailBase, tailCtrl, tailEnd, t);
-    float swing = (anim.isMoving ? std::sin((phase + t * 0.12f) * 2.0f * kPi)
-                                 : std::sin((phase * 0.7f + t * 0.3f) * 2.0f * kPi)) *
-                  (0.04f + 0.015f * (1.0f - t));
+    float swing =
+        (anim.isMoving ? std::sin((phase + t * 0.12f) * 2.0f * kPi)
+                       : std::sin((phase * 0.7f + t * 0.3f) * 2.0f * kPi)) *
+        (0.04f + 0.015f * (1.0f - t));
     p.setX(p.x() + swing);
     float radius = d.bodyWidth * (0.20f - 0.018f * i);
     drawCylinder(out, ctx.model, prevTail, p, radius, tailColor);
@@ -647,17 +628,16 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
                                             -d.bodyLength * 0.02f));
     tailKnot.scale(QVector3D(d.bodyWidth * 0.24f, d.bodyWidth * 0.18f,
                              d.bodyWidth * 0.20f));
-    out.mesh(getUnitSphere(), tailKnot,
-             lighten(tailColor, 0.92f), nullptr, 1.0f);
+    out.mesh(getUnitSphere(), tailKnot, lighten(tailColor, 0.92f), nullptr,
+             1.0f);
   }
 
   for (int i = 0; i < 3; ++i) {
     float spread = (i - 1) * d.bodyWidth * 0.14f;
-    QVector3D fanBase = tailEnd + QVector3D(spread * 0.15f,
-                                            -d.bodyWidth * 0.05f,
-                                            -d.tailLength * 0.08f);
-    QVector3D fanTip = fanBase + QVector3D(spread,
-                                           -d.tailLength * 0.32f,
+    QVector3D fanBase =
+        tailEnd +
+        QVector3D(spread * 0.15f, -d.bodyWidth * 0.05f, -d.tailLength * 0.08f);
+    QVector3D fanTip = fanBase + QVector3D(spread, -d.tailLength * 0.32f,
                                            -d.tailLength * 0.22f);
     drawCone(out, ctx.model, fanTip, fanBase, d.bodyWidth * 0.24f,
              tailColor * (0.96f + 0.02f * i), 0.88f);
@@ -679,14 +659,14 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     QMatrix4x4 sole = ctx.model;
     sole.translate(lerp(hoofTop, hoofBottom, 0.88f) +
                    QVector3D(0.0f, -d.hoofHeight * 0.05f, 0.0f));
-    sole.scale(QVector3D(wallRadius * 1.08f, wallRadius * 0.28f,
-                         wallRadius * 1.02f));
+    sole.scale(
+        QVector3D(wallRadius * 1.08f, wallRadius * 0.28f, wallRadius * 1.02f));
     out.mesh(getUnitSphere(), sole, lighten(hoofColor, 1.12f), nullptr, 1.0f);
 
     QMatrix4x4 coronet = ctx.model;
     coronet.translate(lerp(hoofTop, hoofBottom, 0.12f));
-    coronet.scale(QVector3D(wallRadius * 1.05f, wallRadius * 0.24f,
-                            wallRadius * 1.05f));
+    coronet.scale(
+        QVector3D(wallRadius * 1.05f, wallRadius * 0.24f, wallRadius * 1.05f));
     out.mesh(getUnitSphere(), coronet, lighten(hoofColor, 1.06f), nullptr,
              1.0f);
   };
@@ -710,8 +690,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     }
 
     bool tightenLegs = anim.isMoving;
-    float shoulderOut =
-        d.bodyWidth * (tightenLegs ? 0.44f : 0.58f);
+    float shoulderOut = d.bodyWidth * (tightenLegs ? 0.44f : 0.58f);
     QVector3D shoulder = anchor + QVector3D(lateralSign * shoulderOut,
                                             0.05f + lift * 0.05f, stride);
     bool isRear = (forwardBias < 0.0f);
@@ -746,10 +725,9 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     girdleTop.setZ(girdleTop.z() + hipSwing * (isRear ? -0.08f : 0.05f));
     girdleTop.setX(girdleTop.x() - lateralSign * liftFactor * 0.03f);
 
-    QVector3D socket = shoulder +
-                       QVector3D(0.0f, d.bodyWidth * 0.12f,
-                                 isRear ? -d.bodyLength * 0.03f
-                                        : d.bodyLength * 0.02f);
+    QVector3D socket = shoulder + QVector3D(0.0f, d.bodyWidth * 0.12f,
+                                            isRear ? -d.bodyLength * 0.03f
+                                                   : d.bodyLength * 0.02f);
     drawCylinder(out, ctx.model, girdleTop, socket,
                  d.bodyWidth * (isRear ? 0.20f : 0.18f),
                  coatGradient(v.coatColor, isRear ? 0.70f : 0.80f,
@@ -757,13 +735,11 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
                               coatSeedB + lateralSign * 0.03f));
 
     QMatrix4x4 socketCap = ctx.model;
-    socketCap.translate(socket +
-                        QVector3D(0.0f, -d.bodyWidth * 0.04f,
-                                  isRear ? -d.bodyLength * 0.02f
-                                         : d.bodyLength * 0.03f));
+    socketCap.translate(socket + QVector3D(0.0f, -d.bodyWidth * 0.04f,
+                                           isRear ? -d.bodyLength * 0.02f
+                                                  : d.bodyLength * 0.03f));
     socketCap.scale(QVector3D(d.bodyWidth * (isRear ? 0.36f : 0.32f),
-                              d.bodyWidth * 0.28f,
-                              d.bodyLength * 0.18f));
+                              d.bodyWidth * 0.28f, d.bodyLength * 0.18f));
     out.mesh(getUnitSphere(), socketCap,
              coatGradient(v.coatColor, isRear ? 0.60f : 0.68f,
                           isRear ? -0.24f : 0.18f,
@@ -772,7 +748,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
     float kneeFlex =
         anim.isMoving
-            ? clamp01(std::sin(gallopAngle + (isRear ? 0.65f : -0.45f)) * 0.55f +
+            ? clamp01(std::sin(gallopAngle + (isRear ? 0.65f : -0.45f)) *
+                          0.55f +
                       0.42f)
             : 0.32f;
 
@@ -808,7 +785,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
     QVector3D thighColor =
         coatGradient(v.coatColor, isRear ? 0.48f : 0.58f,
-                      isRear ? -0.22f : 0.18f, coatSeedA + lateralSign * 0.07f);
+                     isRear ? -0.22f : 0.18f, coatSeedA + lateralSign * 0.07f);
     out.mesh(getUnitCone(),
              coneFromTo(ctx.model, thighBelly, shoulder, thighBellyR),
              thighColor, nullptr, 1.0f);
@@ -818,8 +795,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
       muscle.translate(thighBelly +
                        QVector3D(0.0f, 0.0f, isRear ? -0.015f : 0.020f));
       muscle.scale(thighBellyR * QVector3D(1.05f, 0.85f, 0.92f));
-      out.mesh(getUnitSphere(), muscle,
-               lighten(thighColor, 1.03f), nullptr, 1.0f);
+      out.mesh(getUnitSphere(), muscle, lighten(thighColor, 1.03f), nullptr,
+               1.0f);
     }
 
     QVector3D kneeColor = darken(thighColor, 0.96f);
@@ -828,11 +805,9 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
     {
       QMatrix4x4 joint = ctx.model;
-      joint.translate(knee +
-                      QVector3D(0.0f, 0.0f, isRear ? -0.028f : 0.034f));
+      joint.translate(knee + QVector3D(0.0f, 0.0f, isRear ? -0.028f : 0.034f));
       joint.scale(QVector3D(kneeR * 1.18f, kneeR * 1.06f, kneeR * 1.36f));
-      out.mesh(getUnitSphere(), joint, darken(kneeColor, 0.90f), nullptr,
-               1.0f);
+      out.mesh(getUnitSphere(), joint, darken(kneeColor, 0.90f), nullptr, 1.0f);
     }
 
     out.mesh(getUnitCylinder(),
@@ -841,10 +816,11 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
     {
       QMatrix4x4 tendon = ctx.model;
-      tendon.translate(lerp(knee, cannon, 0.55f) +
-                       QVector3D(0.0f, 0.0f,
-                                 isRear ? -cannonR * 0.35f : cannonR * 0.35f));
-      tendon.scale(QVector3D(cannonR * 0.45f, cannonR * 0.95f, cannonR * 0.55f));
+      tendon.translate(
+          lerp(knee, cannon, 0.55f) +
+          QVector3D(0.0f, 0.0f, isRear ? -cannonR * 0.35f : cannonR * 0.35f));
+      tendon.scale(
+          QVector3D(cannonR * 0.45f, cannonR * 0.95f, cannonR * 0.55f));
       out.mesh(getUnitSphere(), tendon,
                darken(thighColor, isRear ? 0.88f : 0.90f), nullptr, 1.0f);
     }
@@ -852,8 +828,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     {
       QMatrix4x4 joint = ctx.model;
       joint.translate(fetlock);
-      joint.scale(QVector3D(pasternR * 1.12f, pasternR * 1.05f,
-                            pasternR * 1.26f));
+      joint.scale(
+          QVector3D(pasternR * 1.12f, pasternR * 1.05f, pasternR * 1.26f));
       out.mesh(getUnitSphere(), joint, darken(thighColor, 0.92f), nullptr,
                1.0f);
     }
@@ -917,9 +893,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
   {
     QMatrix4x4 cantle = ctx.model;
-    cantle.translate(saddleCenter +
-                     QVector3D(0.0f, d.saddleThickness * 0.72f,
-                               -d.bodyLength * 0.12f));
+    cantle.translate(saddleCenter + QVector3D(0.0f, d.saddleThickness * 0.72f,
+                                              -d.bodyLength * 0.12f));
     cantle.scale(QVector3D(d.bodyWidth * 0.52f, d.saddleThickness * 0.60f,
                            d.bodyLength * 0.18f));
     out.mesh(getUnitSphere(), cantle, lighten(v.saddleColor, 1.05f), nullptr,
@@ -928,9 +903,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
   {
     QMatrix4x4 pommel = ctx.model;
-    pommel.translate(saddleCenter +
-                     QVector3D(0.0f, d.saddleThickness * 0.58f,
-                               d.bodyLength * 0.16f));
+    pommel.translate(saddleCenter + QVector3D(0.0f, d.saddleThickness * 0.58f,
+                                              d.bodyLength * 0.16f));
     pommel.scale(QVector3D(d.bodyWidth * 0.40f, d.saddleThickness * 0.48f,
                            d.bodyLength * 0.14f));
     out.mesh(getUnitSphere(), pommel, darken(v.saddleColor, 0.92f), nullptr,
@@ -940,10 +914,9 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
   for (int i = 0; i < 6; ++i) {
     float t = static_cast<float>(i) / 5.0f;
     QMatrix4x4 stitch = ctx.model;
-    stitch.translate(blanketCenter +
-                     QVector3D(d.bodyWidth * (t - 0.5f) * 1.1f,
-                               -d.saddleThickness * 0.35f,
-                               d.bodyLength * 0.28f));
+    stitch.translate(blanketCenter + QVector3D(d.bodyWidth * (t - 0.5f) * 1.1f,
+                                               -d.saddleThickness * 0.35f,
+                                               d.bodyLength * 0.28f));
     stitch.scale(QVector3D(d.bodyWidth * 0.05f, d.bodyWidth * 0.02f,
                            d.bodyWidth * 0.12f));
     out.mesh(getUnitSphere(), stitch, v.blanketColor * 0.75f, nullptr, 0.9f);
@@ -951,12 +924,11 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
   for (int i = 0; i < 2; ++i) {
     float side = (i == 0) ? 1.0f : -1.0f;
-    QVector3D strapTop =
-        saddleCenter +
-        QVector3D(side * d.bodyWidth * 0.92f, d.saddleThickness * 0.32f,
-                   d.bodyLength * 0.02f);
-    QVector3D strapBottom =
-        strapTop + QVector3D(0.0f, -d.bodyHeight * 0.94f, -d.bodyLength * 0.06f);
+    QVector3D strapTop = saddleCenter + QVector3D(side * d.bodyWidth * 0.92f,
+                                                  d.saddleThickness * 0.32f,
+                                                  d.bodyLength * 0.02f);
+    QVector3D strapBottom = strapTop + QVector3D(0.0f, -d.bodyHeight * 0.94f,
+                                                 -d.bodyLength * 0.06f);
     out.mesh(
         getUnitCylinder(),
         cylinderBetween(ctx.model, strapTop, strapBottom, d.bodyWidth * 0.065f),
@@ -973,14 +945,13 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
   for (int i = 0; i < 2; ++i) {
     float side = (i == 0) ? 1.0f : -1.0f;
-    QVector3D breastAnchor = chestCenter +
-                             QVector3D(side * d.bodyWidth * 0.70f,
-                                       -d.bodyHeight * 0.10f,
-                                       d.bodyLength * 0.18f);
-    QVector3D breastToSaddle = saddleCenter +
-                               QVector3D(side * d.bodyWidth * 0.48f,
-                                         -d.saddleThickness * 0.20f,
-                                         d.bodyLength * 0.10f);
+    QVector3D breastAnchor =
+        chestCenter + QVector3D(side * d.bodyWidth * 0.70f,
+                                -d.bodyHeight * 0.10f, d.bodyLength * 0.18f);
+    QVector3D breastToSaddle =
+        saddleCenter + QVector3D(side * d.bodyWidth * 0.48f,
+                                 -d.saddleThickness * 0.20f,
+                                 d.bodyLength * 0.10f);
     out.mesh(getUnitCylinder(),
              cylinderBetween(ctx.model, breastAnchor, breastToSaddle,
                              d.bodyWidth * 0.055f),
@@ -988,12 +959,10 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
   }
 
   QVector3D stirrupAttachLeft =
-      saddleCenter + QVector3D(d.bodyWidth * 0.92f,
-                               -d.saddleThickness * 0.10f,
+      saddleCenter + QVector3D(d.bodyWidth * 0.92f, -d.saddleThickness * 0.10f,
                                d.seatForwardOffset * 0.28f);
   QVector3D stirrupAttachRight =
-      saddleCenter + QVector3D(-d.bodyWidth * 0.92f,
-                               -d.saddleThickness * 0.10f,
+      saddleCenter + QVector3D(-d.bodyWidth * 0.92f, -d.saddleThickness * 0.10f,
                                d.seatForwardOffset * 0.28f);
   QVector3D stirrupBottomLeft =
       stirrupAttachLeft + QVector3D(0.0f, -d.stirrupDrop, 0.0f);
@@ -1007,20 +976,16 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     QVector3D riderLeather = darken(v.saddleColor, 0.88f);
     QVector3D riderSteel(0.72f, 0.73f, 0.78f);
 
-    QVector3D pelvisCenter = saddleCenter +
-                             QVector3D(riderLean * d.bodyWidth,
-                                       d.saddleThickness * 0.68f,
-                                       -d.bodyLength * 0.08f);
-    QVector3D spineMid = pelvisCenter +
-                         QVector3D(riderLean * d.bodyWidth * 0.35f,
-                                   d.bodyHeight * 0.32f,
-                                   d.bodyLength * 0.02f);
-    QVector3D torsoTop = spineMid +
-                         QVector3D(riderLean * d.bodyWidth * 0.25f,
-                                   d.bodyHeight * 0.28f,
-                                   0.03f);
-    QVector3D neckBase = torsoTop + QVector3D(0.0f, d.bodyHeight * 0.10f,
-                                             0.02f);
+    QVector3D pelvisCenter = saddleCenter + QVector3D(riderLean * d.bodyWidth,
+                                                      d.saddleThickness * 0.68f,
+                                                      -d.bodyLength * 0.08f);
+    QVector3D spineMid =
+        pelvisCenter + QVector3D(riderLean * d.bodyWidth * 0.35f,
+                                 d.bodyHeight * 0.32f, d.bodyLength * 0.02f);
+    QVector3D torsoTop = spineMid + QVector3D(riderLean * d.bodyWidth * 0.25f,
+                                              d.bodyHeight * 0.28f, 0.03f);
+    QVector3D neckBase =
+        torsoTop + QVector3D(0.0f, d.bodyHeight * 0.10f, 0.02f);
 
     QMatrix4x4 pelvis = ctx.model;
     pelvis.translate(pelvisCenter);
@@ -1028,8 +993,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
                            d.bodyWidth * 0.48f));
     out.mesh(getUnitSphere(), pelvis, riderCoat * 0.92f, nullptr, 1.0f);
 
-    drawCylinder(out, ctx.model, pelvisCenter, spineMid,
-                 d.bodyWidth * 0.36f, riderCoat * 0.96f);
+    drawCylinder(out, ctx.model, pelvisCenter, spineMid, d.bodyWidth * 0.36f,
+                 riderCoat * 0.96f);
     drawCylinder(out, ctx.model, spineMid, torsoTop, d.bodyWidth * 0.30f,
                  riderCoat * 0.98f);
 
@@ -1044,14 +1009,11 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     for (int i = 0; i < 2; ++i) {
       float side = (i == 0) ? 1.0f : -1.0f;
       QMatrix4x4 shoulderPad = ctx.model;
-      shoulderPad.translate(torsoTop +
-                            QVector3D(side * d.bodyWidth * 0.40f,
-                                      -d.bodyWidth * 0.02f,
-                                      0.02f));
+      shoulderPad.translate(torsoTop + QVector3D(side * d.bodyWidth * 0.40f,
+                                                 -d.bodyWidth * 0.02f, 0.02f));
       shoulderPad.scale(QVector3D(d.bodyWidth * 0.22f, d.bodyWidth * 0.16f,
                                   d.bodyWidth * 0.18f));
-      out.mesh(getUnitSphere(), shoulderPad, riderCloth * 0.92f, nullptr,
-               1.0f);
+      out.mesh(getUnitSphere(), shoulderPad, riderCloth * 0.92f, nullptr, 1.0f);
     }
 
     QVector3D handLeftTarget =
@@ -1062,17 +1024,15 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
     QVector3D swordGrip =
         pelvisCenter + QVector3D(-d.bodyWidth * (0.54f - riderLean * 0.20f),
-                                 d.bodyHeight * 0.46f,
-                                 d.bodyLength * 0.12f);
+                                 d.bodyHeight * 0.46f, d.bodyLength * 0.12f);
     QVector3D handRightTarget =
         swordGrip + QVector3D(0.0f, -d.bodyWidth * 0.05f, 0.0f);
 
     auto drawArm = [&](float sideSign, const QVector3D &handTarget,
                        bool swordHand) {
-      QVector3D shoulder = torsoTop +
-                           QVector3D(sideSign * d.bodyWidth * 0.42f,
-                                     -d.bodyWidth * 0.04f,
-                                     d.bodyLength * 0.03f);
+      QVector3D shoulder =
+          torsoTop + QVector3D(sideSign * d.bodyWidth * 0.42f,
+                               -d.bodyWidth * 0.04f, d.bodyLength * 0.03f);
       if (swordHand) {
         shoulder.setZ(shoulder.z() - d.bodyLength * 0.06f);
         shoulder.setY(shoulder.y() + d.bodyWidth * 0.02f);
@@ -1080,20 +1040,22 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
         shoulder.setZ(shoulder.z() + reinSlack * 0.20f * sideSign);
       }
 
-      QVector3D elbow = shoulder +
-                        QVector3D(sideSign * d.bodyWidth * (swordHand ? 0.20f : 0.14f),
-                                  -d.bodyWidth * (swordHand ? 0.32f : 0.26f),
-                                  d.bodyLength * (swordHand ? 0.02f : 0.10f));
+      QVector3D elbow =
+          shoulder +
+          QVector3D(sideSign * d.bodyWidth * (swordHand ? 0.20f : 0.14f),
+                    -d.bodyWidth * (swordHand ? 0.32f : 0.26f),
+                    d.bodyLength * (swordHand ? 0.02f : 0.10f));
       if (!swordHand) {
         elbow.setZ(elbow.z() + reinSlack * 0.12f * sideSign);
       } else {
         elbow.setX(elbow.x() + sideSign * d.bodyWidth * 0.02f);
       }
 
-      QVector3D wrist = handTarget +
-                        QVector3D(sideSign * d.bodyWidth * (swordHand ? 0.01f : 0.02f),
-                                  -d.bodyWidth * 0.03f,
-                                  -d.bodyLength * (swordHand ? -0.01f : 0.02f));
+      QVector3D wrist =
+          handTarget +
+          QVector3D(sideSign * d.bodyWidth * (swordHand ? 0.01f : 0.02f),
+                    -d.bodyWidth * 0.03f,
+                    -d.bodyLength * (swordHand ? -0.01f : 0.02f));
 
       drawCylinder(out, ctx.model, shoulder, elbow, d.bodyWidth * 0.11f,
                    riderCloth * (swordHand ? 0.98f : 0.96f));
@@ -1111,22 +1073,21 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
       QMatrix4x4 glove = ctx.model;
       QVector3D gloveOffset =
-          swordHand ? QVector3D(0.0f, -d.bodyWidth * 0.04f,
-                                d.bodyWidth * 0.02f)
+          swordHand ? QVector3D(0.0f, -d.bodyWidth * 0.04f, d.bodyWidth * 0.02f)
                     : QVector3D(0.0f, -d.bodyWidth * 0.05f, 0.0f);
       glove.translate(handTarget + gloveOffset);
       glove.scale(QVector3D(d.bodyWidth * 0.11f, d.bodyWidth * 0.14f,
                             d.bodyWidth * 0.09f));
-      QVector3D gloveColor = swordHand ? riderLeather * 0.96f
-                                       : riderSkin * 0.96f;
+      QVector3D gloveColor =
+          swordHand ? riderLeather * 0.96f : riderSkin * 0.96f;
       out.mesh(getUnitSphere(), glove, gloveColor, nullptr, 1.0f);
     };
 
     drawArm(1.0f, handLeftTarget, false);
     drawArm(-1.0f, handRightTarget, true);
 
-    QVector3D helmetTop = neckBase + QVector3D(0.0f, d.bodyHeight * 0.32f,
-                                               0.04f);
+    QVector3D helmetTop =
+        neckBase + QVector3D(0.0f, d.bodyHeight * 0.32f, 0.04f);
     QMatrix4x4 neck = ctx.model;
     neck.translate(lerp(torsoTop, neckBase, 0.6f));
     neck.scale(QVector3D(d.bodyWidth * 0.22f, d.bodyWidth * 0.24f,
@@ -1144,30 +1105,25 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     out.mesh(getUnitSphere(), helm, riderCloth * 0.82f, nullptr, 1.0f);
 
     QMatrix4x4 visor = ctx.model;
-    visor.translate(helmetTop + QVector3D(0.0f, d.bodyWidth * 0.02f,
-                                          d.bodyWidth * 0.15f));
+    visor.translate(helmetTop +
+                    QVector3D(0.0f, d.bodyWidth * 0.02f, d.bodyWidth * 0.15f));
     visor.scale(QVector3D(d.bodyWidth * 0.32f, d.bodyWidth * 0.08f,
                           d.bodyWidth * 0.16f));
     out.mesh(getUnitSphere(), visor, riderCoat * 0.75f, nullptr, 1.0f);
 
-    auto drawLeg = [&](float sideSign,
-                       const QVector3D &stirrupBottom) {
-      QVector3D hip = pelvisCenter +
-                      QVector3D(sideSign * d.bodyWidth * 0.34f,
-                                -d.bodyWidth * 0.01f,
-                                d.bodyWidth * 0.06f);
-      QVector3D knee = hip +
-                       QVector3D(sideSign * d.bodyWidth * 0.08f,
-                                 -d.stirrupDrop * 0.74f,
-                                 d.bodyLength * 0.18f);
-      QVector3D ankle = stirrupBottom +
-                        QVector3D(sideSign * d.bodyWidth * 0.02f,
-                                  d.bodyWidth * 0.05f,
-                                  d.bodyWidth * 0.05f);
-      QVector3D toe = ankle +
-                      QVector3D(sideSign * d.bodyWidth * 0.12f,
-                                -d.bodyWidth * 0.04f,
-                                d.bodyWidth * 0.10f);
+    auto drawLeg = [&](float sideSign, const QVector3D &stirrupBottom) {
+      QVector3D hip =
+          pelvisCenter + QVector3D(sideSign * d.bodyWidth * 0.34f,
+                                   -d.bodyWidth * 0.01f, d.bodyWidth * 0.06f);
+      QVector3D knee =
+          hip + QVector3D(sideSign * d.bodyWidth * 0.08f,
+                          -d.stirrupDrop * 0.74f, d.bodyLength * 0.18f);
+      QVector3D ankle =
+          stirrupBottom + QVector3D(sideSign * d.bodyWidth * 0.02f,
+                                    d.bodyWidth * 0.05f, d.bodyWidth * 0.05f);
+      QVector3D toe =
+          ankle + QVector3D(sideSign * d.bodyWidth * 0.12f,
+                            -d.bodyWidth * 0.04f, d.bodyWidth * 0.10f);
 
       drawCylinder(out, ctx.model, hip, knee, d.bodyWidth * 0.12f,
                    riderCloth * 0.96f);
@@ -1210,8 +1166,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
         swordGrip + QVector3D(-d.bodyWidth * 0.02f, d.bodyHeight * 0.18f,
                               d.bodyLength * 0.04f);
     QVector3D swordHandleBottom =
-        swordGrip + QVector3D(0.0f, -d.bodyWidth * 0.08f,
-                              -d.bodyLength * 0.02f);
+        swordGrip +
+        QVector3D(0.0f, -d.bodyWidth * 0.08f, -d.bodyLength * 0.02f);
 
     drawCylinder(out, ctx.model, swordGrip, swordHandleTop,
                  d.bodyWidth * 0.045f, riderLeather * 0.88f);
@@ -1221,14 +1177,14 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     pommel.scale(d.bodyWidth * 0.12f);
     out.mesh(getUnitSphere(), pommel, riderLeather * 0.75f, nullptr, 1.0f);
 
-    QVector3D guardCenter = swordHandleTop +
-                            QVector3D(0.0f, d.bodyWidth * 0.015f, 0.0f);
-    QVector3D guardL = guardCenter + QVector3D(d.bodyWidth * 0.18f,
-                                              d.bodyWidth * 0.03f,
-                                              -d.bodyWidth * 0.02f);
-    QVector3D guardR = guardCenter + QVector3D(-d.bodyWidth * 0.18f,
-                                              d.bodyWidth * 0.03f,
-                                              -d.bodyWidth * 0.02f);
+    QVector3D guardCenter =
+        swordHandleTop + QVector3D(0.0f, d.bodyWidth * 0.015f, 0.0f);
+    QVector3D guardL =
+        guardCenter + QVector3D(d.bodyWidth * 0.18f, d.bodyWidth * 0.03f,
+                                -d.bodyWidth * 0.02f);
+    QVector3D guardR =
+        guardCenter + QVector3D(-d.bodyWidth * 0.18f, d.bodyWidth * 0.03f,
+                                -d.bodyWidth * 0.02f);
     out.mesh(getUnitCylinder(),
              cylinderBetween(ctx.model, guardL, guardR, d.bodyWidth * 0.020f),
              riderSteel * 1.05f, nullptr, 1.0f);
@@ -1238,17 +1194,15 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     guardCore.scale(d.bodyWidth * 0.05f);
     out.mesh(getUnitSphere(), guardCore, riderSteel * 1.08f, nullptr, 1.0f);
 
-    QVector3D bladeBase = guardCenter +
-                          QVector3D(-d.bodyWidth * 0.01f, d.bodyWidth * 0.02f,
-                                    d.bodyWidth * 0.01f);
-    QVector3D bladeCtrl = bladeBase +
-                          QVector3D(-d.bodyWidth * 0.14f,
-                                    d.bodyHeight * 0.55f,
-                                    d.bodyLength * 0.28f);
-    QVector3D bladeTip = bladeBase +
-                         QVector3D(-d.bodyWidth * 0.06f,
-                                   d.bodyHeight * 0.95f,
-                                   d.bodyLength * 0.36f);
+    QVector3D bladeBase =
+        guardCenter + QVector3D(-d.bodyWidth * 0.01f, d.bodyWidth * 0.02f,
+                                d.bodyWidth * 0.01f);
+    QVector3D bladeCtrl =
+        bladeBase + QVector3D(-d.bodyWidth * 0.14f, d.bodyHeight * 0.55f,
+                              d.bodyLength * 0.28f);
+    QVector3D bladeTip =
+        bladeBase + QVector3D(-d.bodyWidth * 0.06f, d.bodyHeight * 0.95f,
+                              d.bodyLength * 0.36f);
 
     QVector3D prev = bladeBase;
     const int bladeSegments = 6;
@@ -1256,8 +1210,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
       float t = static_cast<float>(i) / static_cast<float>(bladeSegments);
       QVector3D p = bezier(bladeBase, bladeCtrl, bladeTip, t);
       float radius = d.bodyWidth * lerp(0.060f, 0.020f, t);
-      QVector3D bladeColor = riderSteel * (1.08f - 0.10f * t) +
-                             QVector3D(0.02f, 0.02f, 0.02f) * t;
+      QVector3D bladeColor =
+          riderSteel * (1.08f - 0.10f * t) + QVector3D(0.02f, 0.02f, 0.02f) * t;
       out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, prev, p, radius),
                bladeColor, nullptr, 1.0f);
       prev = p;
@@ -1274,8 +1228,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
 
   drawRider();
 
-  auto drawStirrup = [&](const QVector3D &attach,
-                         const QVector3D &bottom) {
+  auto drawStirrup = [&](const QVector3D &attach, const QVector3D &bottom) {
     out.mesh(getUnitCylinder(),
              cylinderBetween(ctx.model, attach, bottom, d.bodyWidth * 0.048f),
              v.tackColor * 0.98f, nullptr, 1.0f);
@@ -1285,8 +1238,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
                           QVector3D(0.0f, 0.0f, d.bodyWidth * 0.02f));
     leatherLoop.scale(QVector3D(d.bodyWidth * 0.18f, d.bodyWidth * 0.05f,
                                 d.bodyWidth * 0.10f));
-    out.mesh(getUnitSphere(), leatherLoop, v.tackColor * 0.92f, nullptr,
-             1.0f);
+    out.mesh(getUnitSphere(), leatherLoop, v.tackColor * 0.92f, nullptr, 1.0f);
 
     QMatrix4x4 stirrup = ctx.model;
     stirrup.translate(bottom + QVector3D(0.0f, -d.bodyWidth * 0.06f, 0.0f));
@@ -1359,8 +1311,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
                                                  d.seatForwardOffset * 0.10f);
 
     QVector3D mid = lerp(reinStart, reinEnd, 0.46f) +
-                    QVector3D(0.0f, -d.bodyHeight * (0.08f + reinSlack),
-                              0.0f);
+                    QVector3D(0.0f, -d.bodyHeight * (0.08f + reinSlack), 0.0f);
     out.mesh(getUnitCylinder(),
              cylinderBetween(ctx.model, reinStart, mid, d.bodyWidth * 0.02f),
              v.tackColor * 0.95f, nullptr, 1.0f);

+ 13 - 18
render/gl/backend.cpp

@@ -83,8 +83,7 @@ void Backend::initialize() {
     qWarning()
         << "Backend: pine shader missing - check pine_instanced.vert/frag";
   if (!m_firecampShader)
-    qWarning()
-        << "Backend: firecamp shader missing - check firecamp.vert/frag";
+    qWarning() << "Backend: firecamp shader missing - check firecamp.vert/frag";
   if (!m_groundShader)
     qWarning() << "Backend: ground_plane shader missing";
   if (!m_terrainShader)
@@ -548,7 +547,6 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
                                      cameraForward);
       }
 
-      // Bind white texture if no fire texture is available
       if (m_firecampUniforms.fireTexture != Shader::InvalidUniform) {
         if (m_resources && m_resources->white()) {
           m_resources->white()->bind(0);
@@ -558,11 +556,10 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
 
       glBindVertexArray(m_firecampVao);
       firecamp.instanceBuffer->bind();
-      const GLsizei stride =
-          static_cast<GLsizei>(sizeof(FireCampInstanceGpu));
-      glVertexAttribPointer(
-          3, 4, GL_FLOAT, GL_FALSE, stride,
-          reinterpret_cast<void *>(offsetof(FireCampInstanceGpu, posIntensity)));
+      const GLsizei stride = static_cast<GLsizei>(sizeof(FireCampInstanceGpu));
+      glVertexAttribPointer(3, 4, GL_FLOAT, GL_FALSE, stride,
+                            reinterpret_cast<void *>(
+                                offsetof(FireCampInstanceGpu, posIntensity)));
       glVertexAttribPointer(
           4, 4, GL_FLOAT, GL_FALSE, stride,
           reinterpret_cast<void *>(offsetof(FireCampInstanceGpu, radiusPhase)));
@@ -1865,7 +1862,6 @@ void Backend::initializeFireCampPipeline() {
   initializeOpenGLFunctions();
   shutdownFireCampPipeline();
 
-  // Simple quad for billboard fire camp rendering
   struct FireCampVertex {
     QVector3D position;
     QVector2D texCoord;
@@ -1878,14 +1874,14 @@ void Backend::initializeFireCampPipeline() {
 
   auto appendPlane = [&](float planeIndex) {
     unsigned short base = static_cast<unsigned short>(vertices.size());
-    vertices.push_back({QVector3D(-1.0f, 0.0f, planeIndex),
-                        QVector2D(0.0f, 0.0f)}); // bottom-left
-    vertices.push_back({QVector3D(1.0f, 0.0f, planeIndex),
-                        QVector2D(1.0f, 0.0f)}); // bottom-right
-    vertices.push_back({QVector3D(1.0f, 2.0f, planeIndex),
-                        QVector2D(1.0f, 1.0f)}); // top-right
-    vertices.push_back({QVector3D(-1.0f, 2.0f, planeIndex),
-                        QVector2D(0.0f, 1.0f)}); // top-left
+    vertices.push_back(
+        {QVector3D(-1.0f, 0.0f, planeIndex), QVector2D(0.0f, 0.0f)});
+    vertices.push_back(
+        {QVector3D(1.0f, 0.0f, planeIndex), QVector2D(1.0f, 0.0f)});
+    vertices.push_back(
+        {QVector3D(1.0f, 2.0f, planeIndex), QVector2D(1.0f, 1.0f)});
+    vertices.push_back(
+        {QVector3D(-1.0f, 2.0f, planeIndex), QVector2D(0.0f, 1.0f)});
 
     indices.push_back(base + 0);
     indices.push_back(base + 1);
@@ -1926,7 +1922,6 @@ void Backend::initializeFireCampPipeline() {
                indices.data(), GL_STATIC_DRAW);
   m_firecampIndexCount = static_cast<GLsizei>(indices.size());
 
-  // Setup instance attribute pointers (will be set per-instance)
   glEnableVertexAttribArray(3);
   glVertexAttribDivisor(3, 1);
 

+ 20 - 27
render/ground/bridge_renderer.cpp

@@ -48,8 +48,7 @@ void BridgeRenderer::buildMeshes() {
     std::vector<unsigned int> indices;
 
     const int vertsPerSegment = 12;
-    const float deckThickness =
-        std::clamp(bridge.width * 0.25f, 0.35f, 0.8f);
+    const float deckThickness = std::clamp(bridge.width * 0.25f, 0.35f, 0.8f);
     const float parapetHeight = std::clamp(bridge.width * 0.25f, 0.25f, 0.55f);
     const float parapetOffset = halfWidth * 1.05f;
 
@@ -98,11 +97,9 @@ void BridgeRenderer::buildMeshes() {
       QVector3D leftNormal = (-perpendicular).normalized();
       QVector3D rightNormal = perpendicular.normalized();
 
-      QVector3D topLeft =
-          centerPos + perpendicular * (-halfWidth);
+      QVector3D topLeft = centerPos + perpendicular * (-halfWidth);
       topLeft.setY(deckY);
-      QVector3D topRight =
-          centerPos + perpendicular * (halfWidth);
+      QVector3D topRight = centerPos + perpendicular * (halfWidth);
       topRight.setY(deckY);
 
       QVector3D bottomLeft = topLeft;
@@ -131,41 +128,37 @@ void BridgeRenderer::buildMeshes() {
       float texU1 = 1.0f;
       float texV = t * length * 0.4f;
 
-      addVertex(topLeft, QVector3D(0.0f, 1.0f, 0.0f), texU0, texV);   // 0
-      addVertex(topRight, QVector3D(0.0f, 1.0f, 0.0f), texU1, texV);  // 1
-      addVertex(bottomLeft, QVector3D(0.0f, -1.0f, 0.0f), texU0,
-                texV);                                                // 2
-      addVertex(bottomRight, QVector3D(0.0f, -1.0f, 0.0f), texU1,
-                texV);                                                // 3
-      addVertex(sideLeftTop, leftNormal, texU0, texV);                // 4
-      addVertex(sideLeftBottom, leftNormal, texU0, texV);             // 5
-      addVertex(sideRightTop, rightNormal, texU1, texV);              // 6
-      addVertex(sideRightBottom, rightNormal, texU1, texV);           // 7
-      addVertex(parapetLeftTop, leftNormal, texU0, texV);             // 8
-      addVertex(parapetLeftBottom, leftNormal, texU0, texV);          // 9
-      addVertex(parapetRightTop, rightNormal, texU1, texV);           // 10
-      addVertex(parapetRightBottom, rightNormal, texU1, texV);        // 11
+      addVertex(topLeft, QVector3D(0.0f, 1.0f, 0.0f), texU0, texV);
+      addVertex(topRight, QVector3D(0.0f, 1.0f, 0.0f), texU1, texV);
+      addVertex(bottomLeft, QVector3D(0.0f, -1.0f, 0.0f), texU0, texV);
+      addVertex(bottomRight, QVector3D(0.0f, -1.0f, 0.0f), texU1, texV);
+      addVertex(sideLeftTop, leftNormal, texU0, texV);
+      addVertex(sideLeftBottom, leftNormal, texU0, texV);
+      addVertex(sideRightTop, rightNormal, texU1, texV);
+      addVertex(sideRightBottom, rightNormal, texU1, texV);
+      addVertex(parapetLeftTop, leftNormal, texU0, texV);
+      addVertex(parapetLeftBottom, leftNormal, texU0, texV);
+      addVertex(parapetRightTop, rightNormal, texU1, texV);
+      addVertex(parapetRightBottom, rightNormal, texU1, texV);
 
       if (i < lengthSegments) {
         unsigned int baseIdx = static_cast<unsigned int>(i * vertsPerSegment);
         unsigned int nextIdx = baseIdx + vertsPerSegment;
 
-        // Deck top
         pushQuad(baseIdx + 0, baseIdx + 1, nextIdx + 1, nextIdx + 0);
-        // Deck bottom
+
         pushQuad(nextIdx + 3, nextIdx + 2, baseIdx + 2, baseIdx + 3);
-        // Left side wall
+
         pushQuad(baseIdx + 4, baseIdx + 5, nextIdx + 5, nextIdx + 4);
-        // Right side wall
+
         pushQuad(baseIdx + 6, baseIdx + 7, nextIdx + 7, nextIdx + 6);
-        // Parapet left outer face
+
         pushQuad(baseIdx + 9, baseIdx + 8, nextIdx + 8, nextIdx + 9);
-        // Parapet right outer face
+
         pushQuad(baseIdx + 11, baseIdx + 10, nextIdx + 10, nextIdx + 11);
       }
     }
 
-    // Add end caps to close the bridge slab
     if (!vertices.empty()) {
       unsigned int startIdx = 0;
       unsigned int endIdx =

+ 2 - 2
render/ground/firecamp_gpu.h

@@ -7,8 +7,8 @@
 namespace Render::GL {
 
 struct FireCampInstanceGpu {
-  QVector4D posIntensity;  // x, y, z, intensity
-  QVector4D radiusPhase;   // radius, phase, duration (or 1.0 for persistent), unused
+  QVector4D posIntensity;
+  QVector4D radiusPhase;
 };
 
 struct FireCampBatchParams {

+ 26 - 41
render/ground/firecamp_renderer.cpp

@@ -88,16 +88,16 @@ void FireCampRenderer::configure(
 void FireCampRenderer::submit(Renderer &renderer, ResourceManager *resources) {
   (void)resources;
 
-  m_fireCampInstanceCount =
-      static_cast<uint32_t>(m_fireCampInstances.size());
+  m_fireCampInstanceCount = static_cast<uint32_t>(m_fireCampInstances.size());
 
   if (m_fireCampInstanceCount == 0) {
     m_fireCampInstanceBuffer.reset();
     qWarning() << "FireCampRenderer: No instances to render";
     return;
   }
-  
-  qDebug() << "FireCampRenderer: Submitting" << m_fireCampInstanceCount << "fire camps";
+
+  qDebug() << "FireCampRenderer: Submitting" << m_fireCampInstanceCount
+           << "fire camps";
 
   auto &visibility = Game::Map::VisibilityService::instance();
   const bool useVisibility = visibility.isInitialized();
@@ -116,8 +116,7 @@ void FireCampRenderer::submit(Renderer &renderer, ResourceManager *resources) {
     visibleInstances = m_fireCampInstances;
   }
 
-  const uint32_t visibleCount =
-      static_cast<uint32_t>(visibleInstances.size());
+  const uint32_t visibleCount = static_cast<uint32_t>(visibleInstances.size());
   if (visibleCount == 0) {
     m_fireCampInstanceBuffer.reset();
     return;
@@ -131,15 +130,12 @@ void FireCampRenderer::submit(Renderer &renderer, ResourceManager *resources) {
 
   FireCampBatchParams params = m_fireCampParams;
   params.time = renderer.getAnimationTime();
-  params.flickerAmount =
-      m_fireCampParams.flickerAmount *
-      (0.9f + 0.25f * std::sin(params.time * 1.3f));
-  params.glowStrength =
-      m_fireCampParams.glowStrength *
-      (0.85f + 0.2f * std::sin(params.time * 1.7f + 1.2f));
+  params.flickerAmount = m_fireCampParams.flickerAmount *
+                         (0.9f + 0.25f * std::sin(params.time * 1.3f));
+  params.glowStrength = m_fireCampParams.glowStrength *
+                        (0.85f + 0.2f * std::sin(params.time * 1.7f + 1.2f));
   renderer.firecampBatch(m_fireCampInstanceBuffer.get(), visibleCount, params);
 
-  // Add compact log arrangement directly beneath the fire
   const QVector3D logColor(0.26f, 0.15f, 0.08f);
   const QVector3D charColor(0.08f, 0.05f, 0.03f);
 
@@ -156,11 +152,11 @@ void FireCampRenderer::submit(Renderer &renderer, ResourceManager *resources) {
                                 static_cast<uint32_t>(radiusPhase.y() * 37.0f));
 
     const float time = params.time;
-    const float charAmount = std::clamp(time * 0.015f + rand01(state) * 0.05f,
-                                        0.0f, 1.0f);
+    const float charAmount =
+        std::clamp(time * 0.015f + rand01(state) * 0.05f, 0.0f, 1.0f);
 
-    const QVector3D blendedLogColor = logColor * (1.0f - charAmount) +
-                                      charColor * (charAmount + 0.15f);
+    const QVector3D blendedLogColor =
+        logColor * (1.0f - charAmount) + charColor * (charAmount + 0.15f);
 
     const float logLength = std::clamp(baseRadius * 0.85f, 0.45f, 1.1f);
     const float logRadius = std::clamp(baseRadius * 0.08f, 0.03f, 0.08f);
@@ -204,8 +200,7 @@ void FireCampRenderer::clear() {
 
 void FireCampRenderer::setExplicitFireCamps(
     const std::vector<QVector3D> &positions,
-    const std::vector<float> &intensities,
-    const std::vector<float> &radii) {
+    const std::vector<float> &intensities, const std::vector<float> &radii) {
   m_explicitPositions = positions;
   m_explicitIntensities = intensities;
   m_explicitRadii = radii;
@@ -222,23 +217,22 @@ void FireCampRenderer::addExplicitFireCamps() {
 
   for (size_t i = 0; i < m_explicitPositions.size(); ++i) {
     const QVector3D &pos = m_explicitPositions[i];
-    
+
     float intensity = 1.0f;
     if (i < m_explicitIntensities.size()) {
       intensity = m_explicitIntensities[i];
     }
-    
+
     float radius = 3.0f;
     if (i < m_explicitRadii.size()) {
       radius = m_explicitRadii[i];
     }
-    
-    // Random phase for animation variation
+
     float phase = static_cast<float>(i) * 1.234567f;
-    
+
     FireCampInstanceGpu instance;
     instance.posIntensity = QVector4D(pos.x(), pos.y(), pos.z(), intensity);
-    instance.radiusPhase = QVector4D(radius, phase, 1.0f, 0.0f); // 1.0 = persistent
+    instance.radiusPhase = QVector4D(radius, phase, 1.0f, 0.0f);
     m_fireCampInstances.push_back(instance);
   }
 }
@@ -259,7 +253,6 @@ void FireCampRenderer::generateFireCampInstances() {
   const float edgeMarginX = static_cast<float>(m_width) * edgePadding;
   const float edgeMarginZ = static_cast<float>(m_height) * edgePadding;
 
-  // Lower density for fire camps - they're decorative
   float fireCampDensity = 0.02f;
 
   std::vector<QVector3D> normals(m_width * m_height, QVector3D(0, 1, 0));
@@ -297,7 +290,6 @@ void FireCampRenderer::generateFireCampInstances() {
     QVector3D normal = normals[normalIdx];
     float slope = 1.0f - std::clamp(normal.y(), 0.0f, 1.0f);
 
-    // Fire camps should be on flat ground
     if (slope > 0.3f)
       return false;
 
@@ -311,15 +303,12 @@ void FireCampRenderer::generateFireCampInstances() {
       return false;
     }
 
-    // Intensity and radius for lighting (if added later)
     float intensity = remap(rand01(state), 0.8f, 1.2f);
     float radius = remap(rand01(state), 2.0f, 4.0f) * tileSafe;
 
-    // Phase for animation variation
     float phase = rand01(state) * 6.2831853f;
 
-    // Persistent flag
-    float duration = 1.0f; // 1.0 means persistent
+    float duration = 1.0f;
 
     FireCampInstanceGpu instance;
     instance.posIntensity = QVector4D(worldX, worldY, worldZ, intensity);
@@ -328,7 +317,6 @@ void FireCampRenderer::generateFireCampInstances() {
     return true;
   };
 
-  // Place fire camps near settlements (procedural generation)
   for (int z = 0; z < m_height; z += 20) {
     for (int x = 0; x < m_width; x += 20) {
       int idx = z * m_width + x;
@@ -339,17 +327,14 @@ void FireCampRenderer::generateFireCampInstances() {
         continue;
 
       uint32_t state = hashCoords(
-          x, z,
-          m_noiseSeed ^ 0xF12ECA3Fu ^ static_cast<uint32_t>(idx));
+          x, z, m_noiseSeed ^ 0xF12ECA3Fu ^ static_cast<uint32_t>(idx));
 
       float worldX = (x - halfWidth) * m_tileSize;
       float worldZ = (z - halfHeight) * m_tileSize;
 
       float clusterNoise =
-          valueNoise(worldX * 0.02f, worldZ * 0.02f,
-                     m_noiseSeed ^ 0xCA3F12E0u);
+          valueNoise(worldX * 0.02f, worldZ * 0.02f, m_noiseSeed ^ 0xCA3F12E0u);
 
-      // Only place in specific areas
       if (clusterNoise < 0.4f)
         continue;
 
@@ -357,7 +342,7 @@ void FireCampRenderer::generateFireCampInstances() {
       if (m_terrainTypes[idx] == Game::Map::TerrainType::Hill) {
         densityMult = 0.5f;
       } else if (m_terrainTypes[idx] == Game::Map::TerrainType::Mountain) {
-        densityMult = 0.0f; // No fire camps on mountains
+        densityMult = 0.0f;
       }
 
       float effectiveDensity = fireCampDensity * densityMult;
@@ -369,13 +354,13 @@ void FireCampRenderer::generateFireCampInstances() {
     }
   }
 
-  // Add explicit firecamps from map definition
   addExplicitFireCamps();
 
   m_fireCampInstanceCount = m_fireCampInstances.size();
   m_fireCampInstancesDirty = m_fireCampInstanceCount > 0;
-  
-  qDebug() << "FireCampRenderer: Generated" << m_fireCampInstanceCount << "total instances";
+
+  qDebug() << "FireCampRenderer: Generated" << m_fireCampInstanceCount
+           << "total instances";
 }
 
 } // namespace Render::GL

+ 2 - 2
render/ground/firecamp_renderer.h

@@ -22,8 +22,8 @@ public:
                  const Game::Map::BiomeSettings &biomeSettings);
 
   void setExplicitFireCamps(const std::vector<QVector3D> &positions,
-                           const std::vector<float> &intensities = {},
-                           const std::vector<float> &radii = {});
+                            const std::vector<float> &intensities = {},
+                            const std::vector<float> &radii = {});
 
   void submit(Renderer &renderer, ResourceManager *resources) override;
 

+ 0 - 1
render/humanoid_base.cpp

@@ -610,7 +610,6 @@ void HumanoidRendererBase::render(const DrawContext &ctx,
 
     addAttachments(instCtx, variant, pose, anim, out);
   }
-
 }
 
 } // namespace Render::GL

+ 0 - 1
render/humanoid_base.h

@@ -136,7 +136,6 @@ protected:
 
   void drawCommonBody(const DrawContext &ctx, const HumanoidVariant &v,
                       const HumanoidPose &pose, ISubmitter &out) const;
-
 };
 
 } // namespace Render::GL

+ 2 - 2
render/scene_renderer.cpp

@@ -172,7 +172,7 @@ void Renderer::pineBatch(Buffer *instanceBuffer, std::size_t instanceCount,
 }
 
 void Renderer::firecampBatch(Buffer *instanceBuffer, std::size_t instanceCount,
-                              const FireCampBatchParams &params) {
+                             const FireCampBatchParams &params) {
   if (!instanceBuffer || instanceCount == 0 || !m_activeQueue)
     return;
   FireCampBatchCmd cmd;
@@ -235,7 +235,7 @@ void Renderer::selectionSmoke(const QMatrix4x4 &model, const QVector3D &color,
     m_activeQueue->submit(cmd);
 }
 
-void Renderer::enqueueSelectionRing(Engine::Core::Entity * /*entity*/,
+void Renderer::enqueueSelectionRing(Engine::Core::Entity *,
                                     Engine::Core::TransformComponent *transform,
                                     Engine::Core::UnitComponent *unitComp,
                                     bool selected, bool hovered) {