I'm looking for some help to render multiple textures on characters. I've found some characters from the mario's universe in .obj with their textures in separate .png.
First, I animated them with 3ds max, then I exported them in .MD3 files thanks to the quake 3 3dsmax plugin.
But ... When I try to apply my textures on each layer as explained in the Irrlicht tutorial, it goes wrong.
expected :
got :
files :
idk why images are not loading for me, please right click and open in new tab

here is my code, I created a Character class that takes a modelInfo struct and everything needed to create an animated mesh.
the modelInfos structure
Code: Select all
typedef struct modelInfos_s {
std::string filename;
std::vector<std::string> textures;
std::pair<int, int> idleLoop;
std::pair<int, int> movingLoop;
std::pair<int, int> dyingLoop;
std::pair<int, int> deadLoop;
std::pair<int, int> victoryLoop;
float size;
} modelInfos_t;
Code: Select all
{ // MODELINFOS_T
"resources/models/characters/waluigi/waluigi.MD3", // MODEL MD3
{
"resources/models/characters/waluigi/Tex_0001_0.png", // TEXTURES
"resources/models/characters/waluigi/Tex_0002_0.png",
"resources/models/characters/waluigi/Tex_0003_0.png",
"resources/models/characters/waluigi/Tex_0004_1.png"
},
{0, 120}, // IDLE
{121, 142}, // MOVING
{143, 281}, // DYING
{282, 353}, // DEAD
{354, 604}, // VICTORY
1 // SCALE SIZE
}
}
Code: Select all
Character::Character(scene::ISceneManager *sManager, video::IVideoDriver *driver, modelInfos_t model, std::string name, int travelingTime, side orientation)
: _sManager(sManager), _driver(driver), _model(model), _name(name), _travelingTime(travelingTime), _orientation(orientation)
{
_mesh = _sManager->addAnimatedMeshSceneNode(_sManager->getMesh(_model.filename.c_str()));
_mesh->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_LIGHTING, false);
for (std::size_t i = 0; i < _model.textures.size(); i++) { // for reach textures file (_model.textures is a vector containing every .png textures)
video::ITexture *texture = _driver->getTexture(_model.textures[i].c_str());
if (texture && _mesh) {
_driver->removeTexture(texture);
texture = _driver->getTexture(_model.textures[i].c_str());
_mesh->setMaterialTexture(i, texture); // set the material texture on each layer
}
}
setOrientation(orientation);
setPosition(core::vector3df{0, 0, 0});
setSize(_model.size);
setAnimationSpeed(30);
setState(Character::state::idle);
}
