*M2 loader now loads models Y-up
*Fixed DrawObject and SceneWorld to accommodate the change
This commit is contained in:
parent
0bea841dd1
commit
a05dfe613e
@ -211,7 +211,7 @@ if(M2Vertices.size()>0)
|
||||
|
||||
for(u32 i=0;i<M2MVertices.size();i++)
|
||||
{
|
||||
M2Vertices.push_back(video::S3DVertex(core::vector3df(M2MVertices[i].pos.X,-M2MVertices[i].pos.Y,M2MVertices[i].pos.Z),core::vector3df(M2MVertices[i].normal.X,-M2MVertices[i].normal.Y,M2MVertices[i].normal.Z), video::SColor(255,100,100,100),M2MVertices[i].texcoords));
|
||||
M2Vertices.push_back(video::S3DVertex(core::vector3df(M2MVertices[i].pos.X,M2MVertices[i].pos.Z,M2MVertices[i].pos.Y),core::vector3df(M2MVertices[i].normal.X,M2MVertices[i].normal.Z,M2MVertices[i].normal.Y), video::SColor(255,100,100,100),M2MVertices[i].texcoords));
|
||||
}
|
||||
|
||||
|
||||
@ -274,11 +274,13 @@ if(i<M2MRenderFlags.size())
|
||||
if(M2MRenderFlags[i].blending==1)
|
||||
IMB->getMaterial().MaterialType=video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
}
|
||||
IMB->recalculateBoundingBox();
|
||||
Mesh->addMeshBuffer(IMB);
|
||||
IMB->drop();
|
||||
//std::cout << "Mesh now has "<<Mesh->getMeshBufferCount()<<" Buffers\n";
|
||||
}
|
||||
|
||||
Device->getSceneManager()->getMeshManipulator()->flipSurfaces(Mesh); //Fix inverted surfaces after the rotation
|
||||
Device->getSceneManager()->getMeshManipulator()->recalculateNormals(Mesh,true);//just to be sure
|
||||
aniMesh= new SAnimatedMesh();
|
||||
aniMesh->addMesh(Mesh);
|
||||
Mesh->drop();
|
||||
|
||||
@ -55,9 +55,6 @@ void DrawObject::_Init(void)
|
||||
scene::IAnimatedMesh *mesh = _smgr->getMesh(modelfile.c_str());
|
||||
if(mesh)
|
||||
{
|
||||
rotation.X = 270.0f; // M2 models are stored "lying on the side" - this puts them standing
|
||||
// ok, this f*cks up the text scene node, but shouldnt be such a problem right now,
|
||||
// until the M2-loader has been corrected so far that this line can be removed
|
||||
cube = _smgr->addAnimatedMeshSceneNode(mesh);
|
||||
//video::ITexture *tex = _device->getVideoDriver()->getTexture("data/misc/square.jpg");
|
||||
//cube->setMaterialTexture(0, tex);
|
||||
|
||||
@ -303,7 +303,7 @@ void SceneWorld::UpdateTerrain(void)
|
||||
if(doodad)
|
||||
{
|
||||
doodad->setPosition(core::vector3df(-d->x, d->z, -d->y));
|
||||
doodad->setRotation(core::vector3df(270-d->ox, -d->oy-90, -d->oz)); // +270 solves M2 models lying on the side
|
||||
doodad->setRotation(core::vector3df(-d->ox, -d->oy-90, -d->oz)); // +270 solves M2 models lying on the side
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user