Skip to content

Commit

Permalink
final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Jan 17, 2025
1 parent b6eb3d0 commit 677e100
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/client/content_cao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
m_wield_meshnode->setScale(m_prop.visual_size / 2.0f);
} else if (m_prop.visual == "node") {
auto *mesh = generateNodeMesh(m_client, m_prop.node, m_meshnode_animation);
assert(mesh);

m_meshnode = m_smgr->addMeshSceneNode(mesh, m_matrixnode);
m_meshnode->setSharedMaterials(true);
Expand All @@ -822,7 +823,6 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)

m_meshnode->setScale(m_prop.visual_size);

// FIXME this tramples on the alphamode of the node
setSceneNodeMaterials(m_meshnode);
} else {
infostream<<"GenericCAO::addToScene(): \""<<m_prop.visual
Expand Down Expand Up @@ -1215,7 +1215,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
m_anim_frame = 0;
}

updateTexturePos();
updateTextureAnim();

if(m_reset_textures_timer >= 0)
{
Expand Down Expand Up @@ -1276,7 +1276,7 @@ static void setMeshBufferTextureCoords(scene::IMeshBuffer *buf, const v2f *uv, u
buf->setDirty(scene::EBT_VERTEX);
}

void GenericCAO::updateTexturePos()
void GenericCAO::updateTextureAnim()
{
if(m_spritenode)
{
Expand Down Expand Up @@ -1636,7 +1636,7 @@ bool GenericCAO::visualExpiryRequired(const ObjectProperties &new_) const
/* Visuals do not need to be expired for:
* - nametag props: handled by updateNametag()
* - textures: handled by updateTextures()
* - sprite props: handled by updateTexturePos()
* - sprite props: handled by updateTextureAnim()
* - glow: handled by updateLight()
* - any other properties that do not change appearance
*/
Expand All @@ -1646,10 +1646,10 @@ bool GenericCAO::visualExpiryRequired(const ObjectProperties &new_) const
// Ordered to compare primitive types before std::vectors
return old.backface_culling != new_.backface_culling ||
old.is_visible != new_.is_visible ||
old.node != new_.node ||
old.mesh != new_.mesh ||
old.shaded != new_.shaded ||
old.use_texture_alpha != new_.use_texture_alpha ||
old.node != new_.node ||
old.mesh != new_.mesh ||
old.visual != new_.visual ||
old.visual_size != new_.visual_size ||
old.wield_item != new_.wield_item ||
Expand Down Expand Up @@ -1760,7 +1760,7 @@ void GenericCAO::processMessage(const std::string &data)
m_anim_framelength = framelength;
m_tx_select_horiz_by_yawpitch = select_horiz_by_yawpitch;

updateTexturePos();
updateTextureAnim();
} else if (cmd == AO_CMD_SET_PHYSICS_OVERRIDE) {
float override_speed = readF32(is);
float override_jump = readF32(is);
Expand Down
3 changes: 1 addition & 2 deletions src/client/content_cao.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class Camera;
class Client;
struct Nametag;
struct MinimapMarker;
struct TileLayer;

/*
SmoothTranslator and other helpers
Expand Down Expand Up @@ -277,7 +276,7 @@ class GenericCAO : public ClientActiveObject

void step(float dtime, ClientEnvironment *env) override;

void updateTexturePos();
void updateTextureAnim();

// ffs this HAS TO BE a string copy! See #5739 if you think otherwise
// Reason: updateTextures(m_previous_texture_modifier);
Expand Down
2 changes: 2 additions & 0 deletions src/object_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,6 @@ void ObjectProperties::deSerialize(std::istream &is)
return;
node.param1 = readU8(is);
node.param2 = readU8(is);

// Add new properties down here and remember to use either tryRead<> or a try-catch.
}

0 comments on commit 677e100

Please sign in to comment.