1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Draw node animation for items (#15930)

This commit is contained in:
cx384 2025-04-04 18:47:11 +02:00 committed by GitHub
parent 1db5a2f950
commit a6d4cd7c15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 117 additions and 74 deletions

View file

@ -118,13 +118,13 @@ void drawItemStack(
client->idef()->getItemstackColor(item, client);
const u32 mc = mesh->getMeshBufferCount();
if (mc > imesh->buffer_colors.size())
imesh->buffer_colors.resize(mc);
if (mc > imesh->buffer_info.size())
imesh->buffer_info.resize(mc);
for (u32 j = 0; j < mc; ++j) {
scene::IMeshBuffer *buf = mesh->getMeshBuffer(j);
video::SColor c = basecolor;
auto &p = imesh->buffer_colors[j];
auto &p = imesh->buffer_info[j];
p.applyOverride(c);
// TODO: could be moved to a shader
@ -137,6 +137,12 @@ void drawItemStack(
}
video::SMaterial &material = buf->getMaterial();
// Texture animation
if (p.animation_info) {
p.animation_info->updateTexture(material, client->getAnimationTime());
}
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
driver->setMaterial(material);
driver->drawMeshBuffer(buf);