Revision: 8355 http://playerstage.svn.sourceforge.net/playerstage/?rev=8355&view=rev Author: natepak Date: 2009-11-03 17:20:47 +0000 (Tue, 03 Nov 2009)
Log Message: ----------- Fixed the trimesh shape Modified Paths: -------------- code/gazebo/branches/bullet2/server/physics/TrimeshShape.cc Modified: code/gazebo/branches/bullet2/server/physics/TrimeshShape.cc =================================================================== --- code/gazebo/branches/bullet2/server/physics/TrimeshShape.cc 2009-11-03 16:53:39 UTC (rev 8354) +++ code/gazebo/branches/bullet2/server/physics/TrimeshShape.cc 2009-11-03 17:20:47 UTC (rev 8355) @@ -24,7 +24,8 @@ * SVN: $Id$ */ -#include "MeshLoader.hh" +#include "MeshManager.hh" +#include "Mesh.hh" #include "TrimeshShape.hh" #include "GazeboError.hh" #include "OgreAdaptor.hh" @@ -61,31 +62,27 @@ /// Load the trimesh void TrimeshShape::Load(XMLConfigNode *node) { - MeshLoader *meshLoader = NULL; + MeshManager *meshManager = MeshManager::Instance(); this->meshNameP->Load(node); this->scaleP->Load(node); - meshLoader = new MeshLoader(); - meshLoader->Load( this->meshNameP->GetValue() ); + const Mesh *mesh = meshManager->Load( **this->meshNameP ); - this->numIndices = meshLoader->GetNumIndices(); - this->numVertices = meshLoader->GetNumVertices(); + if (!mesh) + gzthrow("Invalid mesh"); - // Create the vertex and index arrays - this->vertices = new float[this->numVertices*3]; - this->indices = new unsigned int[this->numIndices]; + mesh->FillArrays(&this->vertices, &this->indices); - meshLoader->FillArrays(&vertices, &indices); + this->numIndices = mesh->GetIndexCount(); + this->numVertices = mesh->GetVertexCount(); for (unsigned int i=0; i < this->numVertices; i++) { - vertices[i*3+0] = vertices[i*3+0] * (**this->scaleP).x; - vertices[i*3+1] = vertices[i*3+1] * (**this->scaleP).y; - vertices[i*3+2] = vertices[i*3+2] * (**this->scaleP).z; + this->vertices[i*3+0] = this->vertices[i*3+0] * (**this->scaleP).x; + this->vertices[i*3+1] = this->vertices[i*3+1] * (**this->scaleP).y; + this->vertices[i*3+2] = this->vertices[i*3+2] * (**this->scaleP).z; } - - delete meshLoader; } ////////////////////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit