X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fclient%2Fcontent_cao.h;h=4bbba91342a5d7506fece1e878d56629f704ee72;hb=a049e8267fabd101cb5c6528b3270214cb0647f0;hp=320607061dc2fd0320674d12ee9dad0cb399b4f5;hpb=eb2bda7d0bbb1ef5f74e8ff88eeedddfe4d75669;p=dragonfireclient.git diff --git a/src/client/content_cao.h b/src/client/content_cao.h index 320607061..4bbba9134 100644 --- a/src/client/content_cao.h +++ b/src/client/content_cao.h @@ -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; @@ -102,10 +104,15 @@ class GenericCAO : public ClientActiveObject bool m_animation_loop = true; // stores position and rotation for each bone name std::unordered_map> m_bone_position; + + int m_attachment_parent_id = 0; + std::unordered_set m_attachment_child_ids; std::string m_attachment_bone = ""; 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; float m_anim_framelength = 0.2f; @@ -121,8 +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; - std::vector m_children; + bool visualExpiryRequired(const ObjectProperties &newprops) const; public: GenericCAO(Client *client, ClientEnvironment *env); @@ -152,18 +163,22 @@ class GenericCAO : public ClientActiveObject virtual bool getSelectionBox(aabb3f *toset) const; - v3f getPosition(); + const v3f getPosition() const; - inline const v3f &getRotation() + void setPosition(const v3f &pos) { - return m_rotation; + pos_translator.val_current = pos; } + inline const v3f &getRotation() const { return m_rotation; } + const bool isImmortal(); - scene::ISceneNode *getSceneNode(); + inline const ObjectProperties &getProperties() const { return m_prop; } + + scene::ISceneNode *getSceneNode() const; - scene::IAnimatedMeshSceneNode *getAnimatedMeshSceneNode(); + scene::IAnimatedMeshSceneNode *getAnimatedMeshSceneNode() const; // m_matrixnode controls the position and rotation of the child node // for all scene nodes, as a workaround for an Irrlicht problem with @@ -178,6 +193,13 @@ class GenericCAO : public ClientActiveObject return m_matrixnode->getRelativeTransformationMatrix(); } + inline const core::matrix4 *getAbsolutePosRotMatrix() const + { + if (!m_matrixnode) + return nullptr; + return &m_matrixnode->getAbsoluteTransformation(); + } + inline f32 getStepHeight() const { return m_prop.stepheight; @@ -199,25 +221,40 @@ class GenericCAO : public ClientActiveObject } void setChildrenVisible(bool toset); - + 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, bool *force_visible) const; + void clearChildAttachments(); + void clearParentAttachment(); + void addAttachmentChild(int child_id); + void removeAttachmentChild(int child_id); ClientActiveObject *getParent() const; - - void setAttachments(); + const std::unordered_set &getAttachmentChildIds() const + { return m_attachment_child_ids; } + void updateAttachments(); void removeFromScene(bool permanent); - void addToScene(ITextureSource *tsrc); + void addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr); inline void expireVisuals() { m_visuals_expired = true; } - void updateLight(u8 light_at_pos); + void updateLight(u32 day_night_ratio); + + void setNodeLight(u8 light); + + /* 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 updateLightNoCheck(u8 light_at_pos); + void updateNametag(); - v3s16 getLightPosition(); + void updateMarker(); void updateNodePos(); @@ -225,7 +262,9 @@ class GenericCAO : public ClientActiveObject void updateTexturePos(); - void updateTextures(const std::string &modref); + // ffs this HAS TO BE a string copy! See #5739 if you think otherwise + // Reason: updateTextures(m_previous_texture_modifier); + void updateTextures(std::string mod); void updateAnimation(); @@ -233,8 +272,6 @@ class GenericCAO : public ClientActiveObject void updateBonePosition(); - void updateAttachments(); - void processMessage(const std::string &data); bool directReportPunch(v3f dir, const ItemStack *punchitem=NULL, @@ -246,4 +283,6 @@ class GenericCAO : public ClientActiveObject { return m_prop.infotext; } + + void updateMeshCulling(); };