]> git.localhorst.tv Git - blobs.git/blobdiff - src/creature/Creature.hpp
cache perception
[blobs.git] / src / creature / Creature.hpp
index b8171ed73070a8baac5573b8c0d1c561c2427ba7..d55ab6f0c51790cebad22bc49617b7a347f630e7 100644 (file)
@@ -187,6 +187,7 @@ public:
        void Draw(graphics::Viewport &);
 
 private:
+       void Cache() noexcept;
        void TickState(double dt);
        void TickStats(double dt);
        void TickBrain(double dt);
@@ -222,6 +223,13 @@ private:
        Situation situation;
        Steering steering;
 
+       // cached because steering makes heavy use of this
+       double perception_range;
+       double perception_range_squared;
+       double perception_omni_range;
+       double perception_omni_range_squared;
+       double perception_field;
+
        struct Attributes {
                glm::vec3 position;
                glm::vec3 normal;