Revision: 8904
http://playerstage.svn.sourceforge.net/playerstage/?rev=8904&view=rev
Author: hsujohnhsu
Date: 2010-09-15 02:26:39 +0000 (Wed, 15 Sep 2010)
Log Message:
-----------
trying to hunt down some bogus gui selection error that causes large scenes to
segfault, indices goes out of range when trying to select an object using
Ogre::Math::intersects.
Modified Paths:
--------------
code/gazebo/branches/wg/server/gui/GLWindow.cc
code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc
Modified: code/gazebo/branches/wg/server/gui/GLWindow.cc
===================================================================
--- code/gazebo/branches/wg/server/gui/GLWindow.cc 2010-09-14 22:21:19 UTC
(rev 8903)
+++ code/gazebo/branches/wg/server/gui/GLWindow.cc 2010-09-15 02:26:39 UTC
(rev 8904)
@@ -184,6 +184,9 @@
/// Handle a mouse button push
void GLWindow::HandleMousePush()
{
+ // stop simulation when this is happening
+ boost::recursive_mutex::scoped_lock
lock(*Simulator::Instance()->GetMRMutex());
+
this->mouseEvent.pressPos = this->mouseEvent.pos;
if (this->currMaker)
@@ -221,6 +224,9 @@
/// Handle a mouse button release
void GLWindow::HandleMouseRelease()
{
+ // stop simulation when this is happening
+ boost::recursive_mutex::scoped_lock
lock(*Simulator::Instance()->GetMRMutex());
+
OgreCreator::SetVisible("guiline", false);
if (this->currMaker)
Modified: code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc
===================================================================
--- code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc 2010-09-14
22:21:19 UTC (rev 8903)
+++ code/gazebo/branches/wg/server/rendering/OgreAdaptor.cc 2010-09-15
02:26:39 UTC (rev 8904)
@@ -543,19 +543,30 @@
bool new_closest_found = false;
for (int i = 0; i < static_cast<int>(index_count); i += 3)
{
- // check for a hit against this triangle
- std::pair<bool, Ogre::Real> hit = Ogre::Math::intersects(mouseRay,
vertices[indices[i]], vertices[indices[i+1]], vertices[indices[i+2]], true,
false);
+ int vert0 = indices[i];
+ int vert1 = indices[i+1];
+ int vert2 = indices[i+2];
- // if it was a hit check if its the closest
- if (hit.first)
+ if (vert0 < vertex_count && vert1 < vertex_count && vert2 <
vertex_count)
{
- if ((closest_distance < 0.0f) || (hit.second < closest_distance))
+ // check for a hit against this triangle
+ std::pair<bool, Ogre::Real> hit = Ogre::Math::intersects(mouseRay,
vertices[indices[i]], vertices[indices[i+1]], vertices[indices[i+2]], true,
false);
+
+ // if it was a hit check if its the closest
+ if (hit.first)
{
- // this is the closest so far, save it off
- closest_distance = hit.second;
- new_closest_found = true;
+ if ((closest_distance < 0.0f) || (hit.second < closest_distance))
+ {
+ // this is the closest so far, save it off
+ closest_distance = hit.second;
+ new_closest_found = true;
+ }
}
}
+ else
+ {
+ printf("OgreAdapter Ray Trace Select Entity Error: vertex indices
(%d,%d,%d) out of range! [>%d]\n",vert0,vert1,vert2,vertex_count);
+ }
}
delete [] vertices;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit