diff --git a/src/Client/GUI/CM2Mesh.cpp b/src/Client/GUI/CM2Mesh.cpp index 9db37d0..3885bfe 100755 --- a/src/Client/GUI/CM2Mesh.cpp +++ b/src/Client/GUI/CM2Mesh.cpp @@ -1420,10 +1420,30 @@ void CM2Mesh::newAnimation(u32 id, s32 start, s32 end, f32 probability) a.end = end; a.probability = probability + prev_prob; Animations.push_back(a); - - } +void CM2Mesh::setGeoSetRender(u32 id, bool render)//this sets the render status for a geoset ID +{ + for(u16 i = 0; i < GeoSetID.size(); i++) + { + if(GeoSetID[i]==id) + { + GeoSetRender[i]=render; + } + } +}; + + + +bool CM2Mesh::getGeoSetRender(u32 meshbufferNumber)//This gets the render status for a specific mesh buffer +{ + if(GeoSetRender.size()>meshbufferNumber) + { + return GeoSetRender[meshbufferNumber]; + } + else + return false; +}; } // end namespace scene diff --git a/src/Client/GUI/CM2Mesh.h b/src/Client/GUI/CM2Mesh.h index 82e2b3a..b7101d2 100755 --- a/src/Client/GUI/CM2Mesh.h +++ b/src/Client/GUI/CM2Mesh.h @@ -14,7 +14,6 @@ namespace scene u32 begin; u32 end; }; - class IAnimatedMeshSceneNode; class IBoneSceneNode; @@ -133,6 +132,12 @@ namespace scene //! loaders should call this after populating the mesh virtual void finalize(); + SSkinMeshBuffer *createBuffer(u32 id) + { + GeoSetID.push_back(id); + GeoSetRender.push_back((id==0?true:false));//This may be changed later on when we know more about the submesh switching business + return createBuffer(); + }; virtual SSkinMeshBuffer *createBuffer(); virtual SJoint *createJoint(SJoint *parent=0); @@ -146,6 +151,9 @@ namespace scene //Retrieve animation information void getFrameLoop(u32 animId, s32 &start, s32 &end); void newAnimation(u32 id, s32 start, s32 end, f32 probability); + //Retrieve geoset rendering information + void setGeoSetRender(u32 id, bool render); + bool getGeoSetRender(u32 meshbufferNumber); private: void checkForAnimation(); @@ -172,8 +180,10 @@ private: core::array *SkinningBuffers; //Meshbuffer to skin, default is to skin localBuffers core::array LocalBuffers; + core::array GeoSetID; //Array of Submesh Meshpart IDs used for switching Geosets on and off + core::array GeoSetRender; - core::array AllJoints; + core::array AllJoints; core::array RootJoints; bool HasAnimation; diff --git a/src/Client/GUI/CM2MeshFileLoader.cpp b/src/Client/GUI/CM2MeshFileLoader.cpp index 455d330..4232fd9 100644 --- a/src/Client/GUI/CM2MeshFileLoader.cpp +++ b/src/Client/GUI/CM2MeshFileLoader.cpp @@ -115,7 +115,7 @@ void CM2MeshFileLoader::ReadViewData(io::IReadFile* file) { file->read(&tempM2Submesh,sizeof(ModelViewSubmesh)-(header.version==0x100?16:0)); M2MSubmeshes.push_back(tempM2Submesh); - DEBUG(logdebug("Submesh %u nBone: %u ofsBone: %u",i,tempM2Submesh.nBone, tempM2Submesh.ofsBone)); + DEBUG(logdebug("Submesh %u MeshPartID %u",i,tempM2Submesh.meshpartId)); // std::cout<< "Submesh " <createBuffer(); + scene::SSkinMeshBuffer *MeshBuffer = AnimatedMesh->createBuffer(M2MSubmeshes[i].meshpartId); //Put the Indices and Vertices of the Submesh into a mesh buffer //Each Submesh contains only the Indices and Vertices that belong to it. diff --git a/src/dep/src/irrlicht/CAnimatedMeshSceneNode.cpp b/src/dep/src/irrlicht/CAnimatedMeshSceneNode.cpp index b737896..aed98c6 100644 --- a/src/dep/src/irrlicht/CAnimatedMeshSceneNode.cpp +++ b/src/dep/src/irrlicht/CAnimatedMeshSceneNode.cpp @@ -330,10 +330,12 @@ void CAnimatedMeshSceneNode::render() { video::IMaterialRenderer* rnd = driver->getMaterialRenderer(Materials[i].MaterialType); bool transparent = (rnd && rnd->isTransparent()); - + bool renderSubmesh = true; + if(Mesh->getMeshType() == EAMT_M2) + renderSubmesh = ((CM2Mesh*)Mesh)->getGeoSetRender(i); // only render transparent buffer if this is the transparent render pass // and solid only in solid pass - if (transparent == isTransparentPass) + if (transparent == isTransparentPass && renderSubmesh) { scene::IMeshBuffer* mb = m->getMeshBuffer(i);