Revision: 8850
http://playerstage.svn.sourceforge.net/playerstage/?rev=8850&view=rev
Author: hsujohnhsu
Date: 2010-08-12 18:28:18 +0000 (Thu, 12 Aug 2010)
Log Message:
-----------
use mBox.merge to add points to bounding box size.
fixed contact visualization flickering problem by calling
getParentSceneNode()->needUpdate().
Modified Paths:
--------------
code/gazebo/trunk/server/rendering/OgreDynamicLines.cc
Modified: code/gazebo/trunk/server/rendering/OgreDynamicLines.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreDynamicLines.cc 2010-08-12
02:55:01 UTC (rev 8849)
+++ code/gazebo/trunk/server/rendering/OgreDynamicLines.cc 2010-08-12
18:28:18 UTC (rev 8850)
@@ -115,19 +115,17 @@
void OgreDynamicLines::FillHardwareBuffers()
{
- Vector3 vaabMin, vaabMax;
int size = this->points.size();
this->PrepareHardwareBuffers(size,0);
+ //std::cout << "debug size " << size << std::endl;
+
if (!size)
{
this->mBox.setExtents(Ogre::Vector3::ZERO, Ogre::Vector3::ZERO);
this->dirty=false;
}
- vaabMin = this->points[0];
- vaabMax = this->points[0];
-
Ogre::HardwareVertexBufferSharedPtr vbuf =
this->mRenderOp.vertexData->vertexBufferBinding->getBuffer(0);
@@ -140,39 +138,24 @@
*prPos++ = this->points[i].y;
*prPos++ = this->points[i].z;
- if (this->points[i].x < vaabMin.x)
- vaabMin.x = this->points[i].x;
- if (this->points[i].y < vaabMin.y)
- vaabMin.y = this->points[i].y;
- if (this->points[i].z < vaabMin.z)
- vaabMin.z = this->points[i].z;
-
- if (this->points[i].x > vaabMax.x)
- vaabMax.x = this->points[i].x;
- if (this->points[i].y > vaabMax.y)
- vaabMax.y = this->points[i].y;
- if (this->points[i].z > vaabMax.z)
- vaabMax.z = this->points[i].z;
+
this->mBox.merge(Ogre::Vector3(this->points[i].x,this->points[i].y,this->points[i].z));
}
}
vbuf->unlock();
- if (!finite(vaabMin.x))
- vaabMin.x = 0;
- if (!finite(vaabMin.y))
- vaabMin.y = 0;
- if (!finite(vaabMin.z))
- vaabMin.z = 0;
+ // std::cout << "debug mBox merging "
+ // << this->getBoundingBox().getMinimum().x << " , "
+ // << this->getBoundingBox().getMinimum().y << " , "
+ // << this->getBoundingBox().getMinimum().z << " | "
+ // << this->getBoundingBox().getMaximum().x << " , "
+ // << this->getBoundingBox().getMaximum().y << " , "
+ // << this->getBoundingBox().getMaximum().z << std::endl;
+
//this->mBox.setExtents(Ogre::Vector3(-1e9,-1e9,-1e9),Ogre::Vector3(1e9,1e9,1e9)
);
- if (!finite(vaabMax.x))
- vaabMax.x = 0;
- if (!finite(vaabMax.y))
- vaabMax.y = 0;
- if (!finite(vaabMax.z))
- vaabMax.z = 0;
+ // need to update after mBox change, otherwise the lines goes in and out of
scope based on old mBox
+ this->getParentSceneNode()->needUpdate();
- this->mBox.setExtents(Ogre::Vector3(vaabMin.x, vaabMin.y, vaabMin.z),
- Ogre::Vector3(vaabMax.x, vaabMax.y, vaabMax.z) );
+ //this->getParentSceneNode()->showBoundingBox(true); // debug
this->dirty = false;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit