Selaa lähdekoodia

Fix compiler errors in files using renamed functions

- Add missing <cstdint> include to render_constants.h for uint32_t
- Update hash01 → hash_01 in palette.cpp, humanoid_base.cpp
- Update hash01 → hash_01 in knight_renderer.cpp, mounted_knight_renderer.cpp, spearman_renderer.cpp
- Update hashCoords → hash_coords, hashTo01 → hash_to_01, rand01 → rand_01 in riverbank_asset_renderer.cpp
- Fixes compilation errors in files that weren't previously updated

Co-authored-by: djeada <[email protected]>
copilot-swe-agent[bot] 1 kuukausi sitten
vanhempi
sitoutus
04c3fcf99c

+ 13 - 13
render/entity/knight_renderer.cpp

@@ -72,8 +72,8 @@ public:
                      uint32_t seed, HumanoidPose &pose) const override {
                      uint32_t seed, HumanoidPose &pose) const override {
     using HP = HumanProportions;
     using HP = HumanProportions;
 
 
-    float const arm_height_jitter = (hash01(seed ^ 0xABCDU) - 0.5F) * 0.03F;
-    float const arm_asymmetry = (hash01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
+    float const arm_height_jitter = (hash_01(seed ^ 0xABCDU) - 0.5F) * 0.03F;
+    float const arm_asymmetry = (hash_01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
 
 
     if (anim.is_attacking && anim.isMelee) {
     if (anim.is_attacking && anim.isMelee) {
       float const attack_phase =
       float const attack_phase =
@@ -479,7 +479,7 @@ private:
 
 
     e.metalColor = QVector3D(0.72F, 0.73F, 0.78F);
     e.metalColor = QVector3D(0.72F, 0.73F, 0.78F);
 
 
-    float const shield_hue = hash01(seed ^ 0x12345U);
+    float const shield_hue = hash_01(seed ^ 0x12345U);
     if (shield_hue < 0.45F) {
     if (shield_hue < 0.45F) {
       e.shieldColor = v.palette.cloth * 1.10F;
       e.shieldColor = v.palette.cloth * 1.10F;
     } else if (shield_hue < 0.90F) {
     } else if (shield_hue < 0.90F) {
@@ -489,20 +489,20 @@ private:
       e.shieldColor = e.metalColor * 0.95F;
       e.shieldColor = e.metalColor * 0.95F;
     }
     }
 
 
-    e.swordLength = 0.80F + (hash01(seed ^ 0xABCDU) - 0.5F) * 0.16F;
-    e.swordWidth = 0.060F + (hash01(seed ^ 0x7777U) - 0.5F) * 0.010F;
-    e.shieldRadius = 0.16F + (hash01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
+    e.swordLength = 0.80F + (hash_01(seed ^ 0xABCDU) - 0.5F) * 0.16F;
+    e.swordWidth = 0.060F + (hash_01(seed ^ 0x7777U) - 0.5F) * 0.010F;
+    e.shieldRadius = 0.16F + (hash_01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
 
 
-    e.guard_half_width = 0.120F + (hash01(seed ^ 0x3456U) - 0.5F) * 0.020F;
-    e.handleRadius = 0.016F + (hash01(seed ^ 0x88AAU) - 0.5F) * 0.003F;
-    e.pommelRadius = 0.045F + (hash01(seed ^ 0x19C3U) - 0.5F) * 0.006F;
+    e.guard_half_width = 0.120F + (hash_01(seed ^ 0x3456U) - 0.5F) * 0.020F;
+    e.handleRadius = 0.016F + (hash_01(seed ^ 0x88AAU) - 0.5F) * 0.003F;
+    e.pommelRadius = 0.045F + (hash_01(seed ^ 0x19C3U) - 0.5F) * 0.006F;
 
 
     e.bladeRicasso =
     e.bladeRicasso =
-        clampf(0.14F + (hash01(seed ^ 0xBEEFU) - 0.5F) * 0.04F, 0.10F, 0.20F);
-    e.bladeTaperBias = clamp01(0.6F + (hash01(seed ^ 0xFACEU) - 0.5F) * 0.2F);
+        clampf(0.14F + (hash_01(seed ^ 0xBEEFU) - 0.5F) * 0.04F, 0.10F, 0.20F);
+    e.bladeTaperBias = clamp01(0.6F + (hash_01(seed ^ 0xFACEU) - 0.5F) * 0.2F);
 
 
-    e.shieldCrossDecal = (hash01(seed ^ 0xA11CU) > 0.55F);
-    e.hasScabbard = (hash01(seed ^ 0x5CABU) > 0.15F);
+    e.shieldCrossDecal = (hash_01(seed ^ 0xA11CU) > 0.55F);
+    e.hasScabbard = (hash_01(seed ^ 0x5CABU) > 0.15F);
     return e;
     return e;
   }
   }
 
 

+ 6 - 6
render/entity/mounted_knight_renderer.cpp

@@ -68,8 +68,8 @@ public:
                      uint32_t seed, HumanoidPose &pose) const override {
                      uint32_t seed, HumanoidPose &pose) const override {
     using HP = HumanProportions;
     using HP = HumanProportions;
 
 
-    const float arm_height_jitter = (hash01(seed ^ 0xABCDU) - 0.5F) * 0.03F;
-    const float arm_asymmetry = (hash01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
+    const float arm_height_jitter = (hash_01(seed ^ 0xABCDU) - 0.5F) * 0.03F;
+    const float arm_asymmetry = (hash_01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
 
 
     uint32_t horse_seed = seed;
     uint32_t horse_seed = seed;
     if (ctx.entity != nullptr) {
     if (ctx.entity != nullptr) {
@@ -488,11 +488,11 @@ private:
 
 
     e.horseProfile = makeHorseProfile(seed, v.palette.leather, v.palette.cloth);
     e.horseProfile = makeHorseProfile(seed, v.palette.leather, v.palette.cloth);
 
 
-    e.swordLength = 0.82F + (hash01(seed ^ 0xABCDU) - 0.5F) * 0.12F;
-    e.swordWidth = 0.042F + (hash01(seed ^ 0x7777U) - 0.5F) * 0.008F;
+    e.swordLength = 0.82F + (hash_01(seed ^ 0xABCDU) - 0.5F) * 0.12F;
+    e.swordWidth = 0.042F + (hash_01(seed ^ 0x7777U) - 0.5F) * 0.008F;
 
 
-    e.hasSword = (hash01(seed ^ 0xFACEU) > 0.15F);
-    e.hasCavalryShield = (hash01(seed ^ 0xCAFEU) > 0.60F);
+    e.hasSword = (hash_01(seed ^ 0xFACEU) > 0.15F);
+    e.hasCavalryShield = (hash_01(seed ^ 0xCAFEU) > 0.60F);
 
 
     return e;
     return e;
   }
   }

+ 5 - 5
render/entity/spearman_renderer.cpp

@@ -61,8 +61,8 @@ public:
                      uint32_t seed, HumanoidPose &pose) const override {
                      uint32_t seed, HumanoidPose &pose) const override {
     using HP = HumanProportions;
     using HP = HumanProportions;
 
 
-    float const arm_height_jitter = (hash01(seed ^ 0xABCDU) - 0.5F) * 0.03F;
-    float const arm_asymmetry = (hash01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
+    float const arm_height_jitter = (hash_01(seed ^ 0xABCDU) - 0.5F) * 0.03F;
+    float const arm_asymmetry = (hash_01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
 
 
     if (anim.isInHoldMode || anim.isExitingHold) {
     if (anim.isInHoldMode || anim.isExitingHold) {
       float const t = anim.isInHoldMode ? 1.0F : (1.0F - anim.holdExitProgress);
       float const t = anim.isInHoldMode ? 1.0F : (1.0F - anim.holdExitProgress);
@@ -351,9 +351,9 @@ private:
     e.spearShaftColor = v.palette.leather * QVector3D(0.85F, 0.75F, 0.65F);
     e.spearShaftColor = v.palette.leather * QVector3D(0.85F, 0.75F, 0.65F);
     e.spearheadColor = QVector3D(0.75F, 0.76F, 0.80F);
     e.spearheadColor = QVector3D(0.75F, 0.76F, 0.80F);
 
 
-    e.spearLength = 1.15F + (hash01(seed ^ 0xABCDU) - 0.5F) * 0.10F;
-    e.spearShaftRadius = 0.018F + (hash01(seed ^ 0x7777U) - 0.5F) * 0.003F;
-    e.spearheadLength = 0.16F + (hash01(seed ^ 0xBEEFU) - 0.5F) * 0.04F;
+    e.spearLength = 1.15F + (hash_01(seed ^ 0xABCDU) - 0.5F) * 0.10F;
+    e.spearShaftRadius = 0.018F + (hash_01(seed ^ 0x7777U) - 0.5F) * 0.003F;
+    e.spearheadLength = 0.16F + (hash_01(seed ^ 0xBEEFU) - 0.5F) * 0.04F;
 
 
     return e;
     return e;
   }
   }

+ 1 - 0
render/gl/render_constants.h

@@ -1,5 +1,6 @@
 #pragma once
 #pragma once
 
 
+#include <cstdint>
 #include <numbers>
 #include <numbers>
 
 
 namespace Render::GL::MathConstants {
 namespace Render::GL::MathConstants {

+ 21 - 21
render/ground/riverbank_asset_renderer.cpp

@@ -28,10 +28,10 @@ inline auto valueNoise(float x, float z, uint32_t salt = 0U) -> float {
   int z1 = z0 + 1;
   int z1 = z0 + 1;
   float tx = x - float(x0);
   float tx = x - float(x0);
   float tz = z - float(z0);
   float tz = z - float(z0);
-  float const n00 = hashTo01(hashCoords(x0, z0, salt));
-  float const n10 = hashTo01(hashCoords(x1, z0, salt));
-  float const n01 = hashTo01(hashCoords(x0, z1, salt));
-  float const n11 = hashTo01(hashCoords(x1, z1, salt));
+  float const n00 = hash_to_01(hash_coords(x0, z0, salt));
+  float const n10 = hash_to_01(hash_coords(x1, z0, salt));
+  float const n01 = hash_to_01(hash_coords(x0, z1, salt));
+  float const n11 = hash_to_01(hash_coords(x1, z1, salt));
   float const nx0 = n00 * (1 - tx) + n10 * tx;
   float const nx0 = n00 * (1 - tx) + n10 * tx;
   float const nx1 = n01 * (1 - tx) + n11 * tx;
   float const nx1 = n01 * (1 - tx) + n11 * tx;
   return nx0 * (1 - tz) + nx1 * tz;
   return nx0 * (1 - tz) + nx1 * tz;
@@ -177,13 +177,13 @@ void RiverbankAssetRenderer::generateAssetInstances() {
       for (int side = 0; side < 2; ++side) {
       for (int side = 0; side < 2; ++side) {
         float const side_sign = (side == 0) ? -1.0F : 1.0F;
         float const side_sign = (side == 0) ? -1.0F : 1.0F;
 
 
-        if (rand01(rng) > 0.3F) {
+        if (rand_01(rng) > 0.3F) {
           continue;
           continue;
         }
         }
 
 
         float const dist_from_water =
         float const dist_from_water =
-            half_river_width + rand01(rng) * bank_zone_width;
-        float const along_river = (rand01(rng) - 0.5F) * 0.6F;
+            half_river_width + rand_01(rng) * bank_zone_width;
+        float const along_river = (rand_01(rng) - 0.5F) * 0.6F;
 
 
         QVector3D const asset_pos =
         QVector3D const asset_pos =
             center_pos + perpendicular * (side_sign * dist_from_water) +
             center_pos + perpendicular * (side_sign * dist_from_water) +
@@ -211,28 +211,28 @@ void RiverbankAssetRenderer::generateAssetInstances() {
         instance.position[1] = world_y;
         instance.position[1] = world_y;
         instance.position[2] = asset_pos.z();
         instance.position[2] = asset_pos.z();
 
 
-        float const type_rand = rand01(rng);
+        float const type_rand = rand_01(rng);
         if (type_rand < 0.7F) {
         if (type_rand < 0.7F) {
 
 
           instance.assetType = 0.0F;
           instance.assetType = 0.0F;
-          float const size = 0.05F + rand01(rng) * 0.1F;
-          instance.scale[0] = size * (0.8F + rand01(rng) * 0.4F);
-          instance.scale[1] = size * (0.6F + rand01(rng) * 0.3F);
-          instance.scale[2] = size * (0.8F + rand01(rng) * 0.4F);
+          float const size = 0.05F + rand_01(rng) * 0.1F;
+          instance.scale[0] = size * (0.8F + rand_01(rng) * 0.4F);
+          instance.scale[1] = size * (0.6F + rand_01(rng) * 0.3F);
+          instance.scale[2] = size * (0.8F + rand_01(rng) * 0.4F);
 
 
-          float const color_var = 0.3F + rand01(rng) * 0.4F;
+          float const color_var = 0.3F + rand_01(rng) * 0.4F;
           instance.color[0] = color_var;
           instance.color[0] = color_var;
           instance.color[1] = color_var * 0.9F;
           instance.color[1] = color_var * 0.9F;
           instance.color[2] = color_var * 0.85F;
           instance.color[2] = color_var * 0.85F;
         } else if (type_rand < 0.9F) {
         } else if (type_rand < 0.9F) {
 
 
           instance.assetType = 1.0F;
           instance.assetType = 1.0F;
-          float const size = 0.1F + rand01(rng) * 0.15F;
+          float const size = 0.1F + rand_01(rng) * 0.15F;
           instance.scale[0] = size;
           instance.scale[0] = size;
-          instance.scale[1] = size * (0.7F + rand01(rng) * 0.4F);
+          instance.scale[1] = size * (0.7F + rand_01(rng) * 0.4F);
           instance.scale[2] = size;
           instance.scale[2] = size;
 
 
-          float const color_var = 0.35F + rand01(rng) * 0.25F;
+          float const color_var = 0.35F + rand_01(rng) * 0.25F;
           instance.color[0] = color_var;
           instance.color[0] = color_var;
           instance.color[1] = color_var * 0.95F;
           instance.color[1] = color_var * 0.95F;
           instance.color[2] = color_var * 0.9F;
           instance.color[2] = color_var * 0.9F;
@@ -243,17 +243,17 @@ void RiverbankAssetRenderer::generateAssetInstances() {
           }
           }
 
 
           instance.assetType = 2.0F;
           instance.assetType = 2.0F;
-          float const size = 0.3F + rand01(rng) * 0.4F;
+          float const size = 0.3F + rand_01(rng) * 0.4F;
           instance.scale[0] = size * 0.3F;
           instance.scale[0] = size * 0.3F;
           instance.scale[1] = size;
           instance.scale[1] = size;
           instance.scale[2] = size * 0.3F;
           instance.scale[2] = size * 0.3F;
 
 
-          instance.color[0] = 0.25F + rand01(rng) * 0.15F;
-          instance.color[1] = 0.35F + rand01(rng) * 0.25F;
-          instance.color[2] = 0.15F + rand01(rng) * 0.1F;
+          instance.color[0] = 0.25F + rand_01(rng) * 0.15F;
+          instance.color[1] = 0.35F + rand_01(rng) * 0.25F;
+          instance.color[2] = 0.15F + rand_01(rng) * 0.1F;
         }
         }
 
 
-        float const angle = rand01(rng) * 6.28318F;
+        float const angle = rand_01(rng) * 6.28318F;
         instance.rotation[0] = 0.0F;
         instance.rotation[0] = 0.0F;
         instance.rotation[1] = std::sin(angle * 0.5F);
         instance.rotation[1] = std::sin(angle * 0.5F);
         instance.rotation[2] = 0.0F;
         instance.rotation[2] = 0.0F;

+ 4 - 4
render/humanoid_base.cpp

@@ -212,16 +212,16 @@ void HumanoidRendererBase::computeLocomotionPose(
   pose.shoulderL.setZ(pose.shoulderL.z() + slouch_offset);
   pose.shoulderL.setZ(pose.shoulderL.z() + slouch_offset);
   pose.shoulderR.setZ(pose.shoulderR.z() + slouch_offset);
   pose.shoulderR.setZ(pose.shoulderR.z() + slouch_offset);
 
 
-  float const foot_angle_jitter = (hash01(seed ^ 0x5678U) - 0.5F) * 0.12F;
-  float const foot_depth_jitter = (hash01(seed ^ 0x9ABCU) - 0.5F) * 0.08F;
+  float const foot_angle_jitter = (hash_01(seed ^ 0x5678U) - 0.5F) * 0.12F;
+  float const foot_depth_jitter = (hash_01(seed ^ 0x9ABCU) - 0.5F) * 0.08F;
 
 
   pose.footL.setX(pose.footL.x() + foot_angle_jitter);
   pose.footL.setX(pose.footL.x() + foot_angle_jitter);
   pose.foot_r.setX(pose.foot_r.x() - foot_angle_jitter);
   pose.foot_r.setX(pose.foot_r.x() - foot_angle_jitter);
   pose.footL.setZ(pose.footL.z() + foot_depth_jitter);
   pose.footL.setZ(pose.footL.z() + foot_depth_jitter);
   pose.foot_r.setZ(pose.foot_r.z() - foot_depth_jitter);
   pose.foot_r.setZ(pose.foot_r.z() - foot_depth_jitter);
 
 
-  float const arm_height_jitter = (hash01(seed ^ 0xABCDU) - 0.5F) * 0.03F;
-  float const arm_asymmetry = (hash01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
+  float const arm_height_jitter = (hash_01(seed ^ 0xABCDU) - 0.5F) * 0.03F;
+  float const arm_asymmetry = (hash_01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
 
 
   pose.handL =
   pose.handL =
       QVector3D(-0.05F + arm_asymmetry,
       QVector3D(-0.05F + arm_asymmetry,

+ 2 - 2
render/palette.cpp

@@ -13,12 +13,12 @@ auto makeHumanoidPalette(const QVector3D &team_tint,
                          uint32_t seed) -> HumanoidPalette {
                          uint32_t seed) -> HumanoidPalette {
   HumanoidPalette p;
   HumanoidPalette p;
 
 
-  float const variation = (hash01(seed) - 0.5F) * 0.08F;
+  float const variation = (hash_01(seed) - 0.5F) * 0.08F;
   p.cloth = clampVec01(team_tint * (1.0F + variation));
   p.cloth = clampVec01(team_tint * (1.0F + variation));
 
 
   p.skin = QVector3D(0.96F, 0.80F, 0.69F);
   p.skin = QVector3D(0.96F, 0.80F, 0.69F);
 
 
-  float const leather_var = (hash01(seed ^ 0x1234U) - 0.5F) * 0.06F;
+  float const leather_var = (hash_01(seed ^ 0x1234U) - 0.5F) * 0.06F;
   float const r = team_tint.x();
   float const r = team_tint.x();
   float const g = team_tint.y();
   float const g = team_tint.y();
   float const b = team_tint.z();
   float const b = team_tint.z();