Skip to content

Commit

Permalink
nice
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Jan 15, 2025
1 parent 2805c9e commit 0e978a3
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/client/content_cao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,13 @@ static scene::SMesh *generateNodeMesh(const NodeDefManager *ndef, MapNode n,
animation.clear();
for (int layer = 0; layer < MAX_TILE_LAYERS; layer++) {
for (PreMeshBuffer &p : collector.prebuffers[layer]) {
// reset the pre-computed light data stored in the vertex color,
// since we do that ourselves via updateLight().
for (auto &v : p.vertices)
v.Color.set(0xFFFFFFFF);
// but still apply the tile color
p.applyTileColor();

// TOOD support this
if (p.layer.material_flags & MATERIAL_FLAG_ANIMATION) {
const FrameSpec &frame = (*p.layer.frames)[0];
p.layer.texture = frame.texture;
Expand Down Expand Up @@ -813,8 +817,6 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
mesh->drop();

m_meshnode->setScale(m_prop.visual_size);
// TODO light fix
setColorParam(m_meshnode, video::SColor(255, 255, 255, 255));

// FIXME this tramples on the alphamode of the node
setSceneNodeMaterials(m_meshnode);
Expand Down Expand Up @@ -917,8 +919,7 @@ void GenericCAO::updateLight(u32 day_night_ratio)
if (!pos_ok)
light_at_pos = LIGHT_SUN;

// Initialize with full alpha, otherwise entity won't be visible
video::SColor light{0xFFFFFFFF};
video::SColor light;

// Encode light into color, adding a small boost
// based on the entity glow.
Expand All @@ -938,10 +939,6 @@ void GenericCAO::setNodeLight(const video::SColor &light_color)
return;
}

if (m_prop.visual == "node") {
return;
}

{
auto *node = getSceneNode();
if (!node)
Expand Down

0 comments on commit 0e978a3

Please sign in to comment.