]> git.localhorst.tv Git - blobs.git/blobdiff - src/creature/Genome.hpp
color mutation
[blobs.git] / src / creature / Genome.hpp
index 75ca79c70188c439c4683b3a238e8271663d9196..1fc5c2a5f4871f22eb8f00dab6c2ad81c1c9e590 100644 (file)
@@ -22,7 +22,7 @@ struct Genome {
        struct Properties {
                /// every one of these should have at least one
                /// negative impact to prevent super-beings evolving
-               T props[8];
+               T props[9];
                /// power at the cost of higher solid intake
                T &Strength() noexcept { return props[0]; }
                const T &Strength() const noexcept { return props[0]; }
@@ -44,9 +44,12 @@ struct Genome {
                /// how likely to mutate
                T &Mutability() noexcept { return props[6]; }
                const T &Mutability() const noexcept { return props[6]; }
+               /// how likely to adapt to new environments
+               T &Adaptability() noexcept { return props[7]; }
+               const T &Adaptability() const noexcept { return props[7]; }
                /// mass of offspring
-               T &OffspringMass() noexcept { return props[7]; }
-               const T &OffspringMass() const noexcept { return props[7]; }
+               T &OffspringMass() noexcept { return props[8]; }
+               const T &OffspringMass() const noexcept { return props[8]; }
        };
        Properties<math::Distribution> properties;
 
@@ -54,6 +57,10 @@ struct Genome {
        math::Distribution base_saturation;
        math::Distribution base_lightness;
 
+       math::Distribution highlight_hue;
+       math::Distribution highlight_saturation;
+       math::Distribution highlight_lightness;
+
        void Configure(Creature &) const;
 
        static Properties<double> Instantiate(
@@ -66,9 +73,10 @@ struct Genome {
                        p.props[2].FakeNormal(rand.SNorm()),
                        p.props[3].FakeNormal(rand.SNorm()),
                        p.props[4].FakeNormal(rand.SNorm()),
-                       p.props[5].FakeNormal(rand.SNorm()),
-                       p.props[6].FakeNormal(rand.SNorm()),
-                       p.props[7].FakeNormal(rand.SNorm())
+                       glm::clamp(p.props[5].FakeNormal(rand.SNorm()), 0.0, 1.0),
+                       glm::clamp(p.props[6].FakeNormal(rand.SNorm()), 0.0, 1.0),
+                       glm::clamp(p.props[7].FakeNormal(rand.SNorm()), 0.0, 1.0),
+                       p.props[8].FakeNormal(rand.SNorm())
                };
        }