Revision: 8384 http://playerstage.svn.sourceforge.net/playerstage/?rev=8384&view=rev Author: natepak Date: 2009-11-10 21:55:39 +0000 (Tue, 10 Nov 2009)
Log Message: ----------- Slight performance improvement for trimeshes Modified Paths: -------------- code/gazebo/trunk/server/Mesh.cc code/gazebo/trunk/server/physics/ode/ODETrimeshShape.cc code/gazebo/trunk/server/rendering/OgreCreator.cc code/gazebo/trunk/server/rendering/OgreVisual.cc Modified: code/gazebo/trunk/server/Mesh.cc =================================================================== --- code/gazebo/trunk/server/Mesh.cc 2009-11-10 19:17:03 UTC (rev 8383) +++ code/gazebo/trunk/server/Mesh.cc 2009-11-10 21:55:39 UTC (rev 8384) @@ -51,6 +51,9 @@ for (iter = this->submeshes.begin(); iter != this->submeshes.end(); iter++) { + if ((*iter)->GetVertexCount() <= 2) + continue; + Vector3 smax = (*iter)->GetMax(); max.x = std::max(max.x, smax.x); max.y = std::max(max.y, smax.y); @@ -73,6 +76,9 @@ for (iter = this->submeshes.begin(); iter != this->submeshes.end(); iter++) { + if ((*iter)->GetVertexCount() <= 2) + continue; + Vector3 smin = (*iter)->GetMin(); min.x = std::min(min.x, smin.x); min.y = std::min(min.y, smin.y); @@ -90,7 +96,11 @@ std::vector<SubMesh *>::const_iterator iter; for (iter = this->submeshes.begin(); iter != this->submeshes.end(); iter++) + { + if ((*iter)->GetVertexCount() <= 2) + continue; sum += (*iter)->GetVertexCount(); + } return sum; } @@ -103,7 +113,11 @@ std::vector<SubMesh *>::const_iterator iter; for (iter = this->submeshes.begin(); iter != this->submeshes.end(); iter++) + { + if ((*iter)->GetVertexCount() <= 2) + continue; sum += (*iter)->GetNormalCount(); + } return sum; } @@ -116,7 +130,11 @@ std::vector<SubMesh *>::const_iterator iter; for (iter = this->submeshes.begin(); iter != this->submeshes.end(); iter++) + { + if ((*iter)->GetVertexCount() <= 2) + continue; sum += (*iter)->GetIndexCount(); + } return sum; } @@ -129,7 +147,11 @@ std::vector<SubMesh *>::const_iterator iter; for (iter = this->submeshes.begin(); iter != this->submeshes.end(); iter++) + { + if ((*iter)->GetVertexCount() <= 2) + continue; sum += (*iter)->GetTexCoordCount(); + } return sum; } @@ -194,6 +216,8 @@ for (iter = this->submeshes.begin(); iter != this->submeshes.end(); iter++) { + if ((*iter)->GetVertexCount() <= 2) + continue; vertCount += (*iter)->GetVertexCount(); indCount += (*iter)->GetIndexCount(); } @@ -213,6 +237,9 @@ for (iter = this->submeshes.begin(); iter != this->submeshes.end(); iter++) { + if ((*iter)->GetVertexCount() <= 2) + continue; + float *vertTmp = NULL; unsigned int *indTmp = NULL; (*iter)->FillArrays(&vertTmp, &indTmp); Modified: code/gazebo/trunk/server/physics/ode/ODETrimeshShape.cc =================================================================== --- code/gazebo/trunk/server/physics/ode/ODETrimeshShape.cc 2009-11-10 19:17:03 UTC (rev 8383) +++ code/gazebo/trunk/server/physics/ode/ODETrimeshShape.cc 2009-11-10 21:55:39 UTC (rev 8384) @@ -103,7 +103,7 @@ (float*)this->vertices, 3*sizeof(float), this->numVertices, (int*)this->indices, this->numIndices, 3*sizeof(int)); - pgeom->SetGeom( dCreateTriMesh( 0, this->odeData,0,0,0 ), true ); + pgeom->SetGeom( dCreateTriMesh( pgeom->GetSpaceId(), this->odeData,0,0,0 ), true ); mass = this->parent->GetMass(); @@ -112,9 +112,6 @@ physics->ConvertMass(&mass, &odeMass); this->parent->SetMass(mass); - // Create the trimesh geometry - //pgeom->SetGeom(this->geomId, true); - memset(this->matrix_dblbuff,0,32*sizeof(dReal)); this->last_matrix_index = 0; } Modified: code/gazebo/trunk/server/rendering/OgreCreator.cc =================================================================== --- code/gazebo/trunk/server/rendering/OgreCreator.cc 2009-11-10 19:17:03 UTC (rev 8383) +++ code/gazebo/trunk/server/rendering/OgreCreator.cc 2009-11-10 21:55:39 UTC (rev 8384) @@ -881,6 +881,9 @@ { Ogre::MeshPtr ogreMesh; + if (mesh->GetSubMeshCount() == 0) + return; + try { // Create a new mesh specifically for manual definition. @@ -1003,12 +1006,15 @@ Vector3 max = mesh->GetMax(); Vector3 min = mesh->GetMin(); + std::cout << "Max[" << max << "] Min[" << min << "]\n"; + if (!max.IsFinite()) gzthrow("Max bounding box is not finite[" << max << "]\n"); if (!min.IsFinite()) gzthrow("Min bounding box is not finite[" << min << "]\n"); + ogreMesh->_setBounds( Ogre::AxisAlignedBox( Ogre::Vector3(min.x, min.y, min.z), Ogre::Vector3(max.x, max.y, max.z)), Modified: code/gazebo/trunk/server/rendering/OgreVisual.cc =================================================================== --- code/gazebo/trunk/server/rendering/OgreVisual.cc 2009-11-10 19:17:03 UTC (rev 8383) +++ code/gazebo/trunk/server/rendering/OgreVisual.cc 2009-11-10 21:55:39 UTC (rev 8384) @@ -175,6 +175,8 @@ if (!MeshManager::Instance()->HasMesh(meshName)) MeshManager::Instance()->Load(meshName); + std::cout << "Loading mesh[" << meshName << "]\n"; + // Add the mesh into OGRE OgreCreator::InsertMesh( MeshManager::Instance()->GetMesh(meshName) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit