Here is what i mean
![Image](http://img375.imageshack.us/img375/6339/tanc.jpg)
Project files atatched as well so people who have tangent meshes that work fine in irrlicht can try my code aswell. 2megs
http://www.mediafire.com/?02oydkf3u3un3do
Code: Select all
irr::scene::IAnimatedMeshSceneNode* FrameWork::loadModel(string s){
core::stringc currentPath = dev->getFileSystem()->getWorkingDirectory();
irr::scene::IAnimatedMeshSceneNode* model=0;
irr::scene::IAnimatedMesh* LoadedMesh = 0;
irr::scene::IMesh* Tmesh=0;
irr::scene::IAnimatedMesh* AMesh=0;
unsigned int i,j;
if(!smgr->getMeshCache()->isMeshLoaded(core::stringw(s.c_str()))){
LoadedMesh = smgr->getMesh(core::stringc(s.c_str()));
Tmesh = smgr->getMeshManipulator()->createMeshWithTangents(LoadedMesh);
smgr->getMeshCache()->removeMesh(LoadedMesh);
if(Tmesh){
AMesh = smgr->getMeshManipulator()->createAnimatedMesh(Tmesh);
Tmesh->drop();
if(AMesh){
AMesh->getMesh(0)->setHardwareMappingHint(scene::EHM_STATIC);
smgr->getMeshCache()->addMesh(core::stringw(s.c_str()),AMesh);
model = smgr->addAnimatedMeshSceneNode(AMesh,smgr->getSceneNodeFromId(0xFEE00000));
AMesh->drop();
}
}
}else{//La malla ya estaba...
AMesh = smgr->getMesh(core::stringc(s.c_str()));
model = smgr->addAnimatedMeshSceneNode(AMesh,smgr->getSceneNodeFromId(0xFEE00000));
}
if(model){
dev->getFileSystem()->changeWorkingDirectoryTo(path);
for(i=0;i<model->getMaterialCount();i++){
model->getMaterial(i).MaterialTypeParam = 192;
model->getMaterial(i).AmbientColor=video::SColor(255,255,255,255);
model->getMaterial(i).AntiAliasing = antialiasing;
model->getMaterial(i).NormalizeNormals = true;
model->getMaterial(i).Lighting=true;
model->getMaterial(i).Shininess = 50;
model->getMaterial(i).setTexture(2,nullNormal);
model->getMaterial(i).setTexture(4,shadowmapTarget);//El Shadowmap target va ahi
for(j=0;j<8;j++){
model->getMaterial(i).TextureLayer[j].TrilinearFilter = true;
}
}
dev->getFileSystem()->changeWorkingDirectoryTo(currentPath);
}
return model;
}
I don't know... i knew how to map properly the binormal and tangent seeing the irrlicht source, in the DX driver code, where the extra materials were created from ASM code inside the source. Watch where the binormals and tangents are stored in OpenGL, and i hope everything goes finally well. The code for the tangents generation is independent from the drivers, so, in theory, it should work the same for OGL and DXSeems for opengl i had to invert the binormal to get rid of the strange inverted normals at the boundries of uv islands. Now its better but the uv seams still show...