1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Use Irrlicht's mesh cache for animated meshes.

Fixes #6676.
Allow animated meshes to be cached in Irrlicht's builtin mesh cache.
Use Material.EmmissiveColor instead of manipulating the mesh' vertex colors.
This commit is contained in:
Lars Hofhansl 2017-12-04 22:25:09 -08:00
parent f470cb7270
commit fd9f195fcc
5 changed files with 25 additions and 9 deletions

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <iostream>
#include <IAnimatedMesh.h>
#include <SAnimatedMesh.h>
#include <IAnimatedMeshSceneNode.h>
// In Irrlicht 1.8 the signature of ITexture::lock was changed from
// (bool, u32) to (E_TEXTURE_LOCK_MODE, u32).
@ -184,6 +185,13 @@ void setMeshBufferColor(scene::IMeshBuffer *buf, const video::SColor &color)
((video::S3DVertex *) (vertices + i * stride))->Color = color;
}
void setAnimatedMeshColor(scene::IAnimatedMeshSceneNode *node, const video::SColor &color)
{
for (u32 i = 0; i < node->getMaterialCount(); ++i) {
node->getMaterial(i).EmissiveColor = color;
}
}
void setMeshColor(scene::IMesh *mesh, const video::SColor &color)
{
if (mesh == NULL)