]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/client/content_cao.h
Merge branch 'master' of https://github.com/minetest/minetest
[dragonfireclient.git] / src / client / content_cao.h
index 6f3b2f06b877c20afd84c41caff170bb94560a29..09c26bd9c12d69db4c539173dce24e2380094ce3 100644 (file)
@@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 class Camera;
 class Client;
 struct Nametag;
+struct MinimapMarker;
 
 /*
        SmoothTranslator
@@ -84,6 +85,7 @@ class GenericCAO : public ClientActiveObject
        scene::IBillboardSceneNode *m_spritenode = nullptr;
        scene::IDummyTransformationSceneNode *m_matrixnode = nullptr;
        Nametag *m_nametag = nullptr;
+       MinimapMarker *m_marker = nullptr;
        v3f m_position = v3f(0.0f, 10.0f * BS, 0);
        v3f m_velocity;
        v3f m_acceleration;
@@ -109,6 +111,7 @@ class GenericCAO : public ClientActiveObject
        v3f m_attachment_position;
        v3f m_attachment_rotation;
        bool m_attached_to_local = false;
+       bool m_force_visible = false;
 
        int m_anim_frame = 0;
        int m_anim_num_frames = 1;
@@ -125,6 +128,12 @@ class GenericCAO : public ClientActiveObject
        u8 m_last_light = 255;
        bool m_is_visible = false;
        s8 m_glow = 0;
+       // Material
+       video::E_MATERIAL_TYPE m_material_type;
+       // Settings
+       bool m_enable_shaders = false;
+
+       bool visualExpiryRequired(const ObjectProperties &newprops) const;
 
 public:
        GenericCAO(Client *client, ClientEnvironment *env);
@@ -163,6 +172,21 @@ class GenericCAO : public ClientActiveObject
 
        inline const v3f &getRotation() const { return m_rotation; }
 
+       inline const v3f getAcceleration() const
+       {
+               return m_acceleration;
+       }
+
+       inline const v3f getVelocity() const
+       {
+               return m_velocity;
+       }
+       
+       inline const u16 getHp() const
+       {
+               return m_hp;
+       }
+
        const bool isImmortal();
 
        scene::ISceneNode *getSceneNode() const;
@@ -182,10 +206,11 @@ class GenericCAO : public ClientActiveObject
                return m_matrixnode->getRelativeTransformationMatrix();
        }
 
-       inline const core::matrix4 &getAbsolutePosRotMatrix() const
+       inline const core::matrix4 *getAbsolutePosRotMatrix() const
        {
-               assert(m_matrixnode);
-               return m_matrixnode->getAbsoluteTransformation();
+               if (!m_matrixnode)
+                       return nullptr;
+               return &m_matrixnode->getAbsoluteTransformation();
        }
 
        inline f32 getStepHeight() const
@@ -198,6 +223,16 @@ class GenericCAO : public ClientActiveObject
                return m_is_local_player;
        }
 
+       inline std::string getName() const
+       {
+               return m_name;
+       }
+
+       inline bool isPlayer() const
+       {
+               return m_is_player;
+       }
+
        inline bool isVisible() const
        {
                return m_is_visible;
@@ -209,14 +244,16 @@ class GenericCAO : public ClientActiveObject
        }
 
        void setChildrenVisible(bool toset);
-       void setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation);
+       void setAttachment(int parent_id, const std::string &bone, v3f position,
+                       v3f rotation, bool force_visible);
        void getAttachment(int *parent_id, std::string *bone, v3f *position,
-                       v3f *rotation) const;
+                       v3f *rotation, bool *force_visible) const;
        void clearChildAttachments();
        void clearParentAttachment();
        void addAttachmentChild(int child_id);
        void removeAttachmentChild(int child_id);
        ClientActiveObject *getParent() const;
+       int getParentId() const { return m_attachment_parent_id; }
        const std::unordered_set<int> &getAttachmentChildIds() const
        { return m_attachment_child_ids; }
        void updateAttachments();
@@ -230,11 +267,18 @@ class GenericCAO : public ClientActiveObject
                m_visuals_expired = true;
        }
 
-       void updateLight(u8 light_at_pos);
+       void updateLight(u32 day_night_ratio);
 
-       void updateLightNoCheck(u8 light_at_pos);
+       void setNodeLight(u8 light);
 
-       v3s16 getLightPosition();
+       /* Get light position(s).
+        * returns number of positions written into pos[], which must have space
+        * for at least 3 vectors. */
+       u16 getLightPosition(v3s16 *pos);
+
+       void updateNametag();
+
+       void updateMarker();
 
        void updateNodePos();
 
@@ -263,4 +307,13 @@ class GenericCAO : public ClientActiveObject
        {
                return m_prop.infotext;
        }
+       
+       float m_waiting_for_reattach;
+       
+       ObjectProperties *getProperties()
+       {
+               return &m_prop;
+       }
+
+       void updateMeshCulling();
 };