|
From: Markus R. <rol...@us...> - 2007-06-15 08:48:42
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv14965/contrib/rsgedit Modified Files: property.cpp property.h sparkglrender.cpp sparkglrender.h Log Message: - merged ROSIMPORTER_XLAB bracnh Index: property.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/property.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** property.cpp 17 May 2007 17:49:23 -0000 1.9 --- property.cpp 15 Jun 2007 08:48:16 -0000 1.10 *************** *** 36,39 **** --- 36,41 ---- #include <oxygen/physicsserver/body.h> #include <oxygen/physicsserver/joint.h> + #include <oxygen/physicsserver/hingejoint.h> + #include <oxygen/physicsserver/universaljoint.h> #include <oxygen/physicsserver/world.h> #include <oxygen/physicsserver/collisionhandler.h> *************** *** 108,111 **** --- 110,115 ---- mClassMap[_T("/classes/oxygen/Body")] = CL_BODY; mClassMap[_T("/classes/oxygen/Joint")] = CL_JOINT; + mClassMap[_T("/classes/oxygen/HingeJoint")] = CL_HINGEJOINT; + mClassMap[_T("/classes/oxygen/UniversalJoint")] = CL_UNIVERSALJOINT; mClassMap[_T("/classes/oxygen/World")] = CL_WORLD; mClassMap[_T("/classes/oxygen/CollisionHandler")] = CL_COLLISIONHANDLER; *************** *** 201,204 **** --- 205,224 ---- } + void Property::GenHingeEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const + { + const HingeJoint& hinge = *shared_static_cast<HingeJoint>(leaf); + entries.push_back(Entry(_T("GetAngle"),FormatFloat(hinge.GetAngle()))); + entries.push_back(Entry(_T("GetAngleRate"),FormatFloat(hinge.GetAngleRate()))); + } + + void Property::GenUniversalEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const + { + const UniversalJoint& universal = *shared_static_cast<UniversalJoint>(leaf); + entries.push_back(Entry(_T("GetAngle(0)"),FormatFloat(universal.GetAngle(Joint::AI_FIRST)))); + entries.push_back(Entry(_T("GetAngle(1)"),FormatFloat(universal.GetAngle(Joint::AI_SECOND)))); + entries.push_back(Entry(_T("GetAngleRate(0)"),FormatFloat(universal.GetAngleRate(Joint::AI_FIRST)))); + entries.push_back(Entry(_T("GetAngleRate(1)"),FormatFloat(universal.GetAngleRate(Joint::AI_SECOND)))); + } + void Property::GenJointEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const { *************** *** 383,386 **** --- 403,414 ---- break; + case CL_HINGEJOINT: + GenHingeEntries(leaf, entries); + break; + + case CL_UNIVERSALJOINT: + GenUniversalEntries(leaf, entries); + break; + case CL_JOINT: GenJointEntries(leaf, entries); Index: sparkglrender.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkglrender.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sparkglrender.h 15 Apr 2007 12:19:12 -0000 1.6 --- sparkglrender.h 15 Jun 2007 08:48:16 -0000 1.7 *************** *** 44,47 **** --- 44,54 ---- class SparkGLRender { + protected: + struct RenderSelectionContext + { + RenderSelectionContext(boost::shared_ptr<oxygen::BaseNode> node); + ~RenderSelectionContext(); + }; + public: SparkGLRender(); Index: sparkglrender.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkglrender.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sparkglrender.cpp 15 Apr 2007 12:19:12 -0000 1.5 --- sparkglrender.cpp 15 Jun 2007 08:48:16 -0000 1.6 *************** *** 20,23 **** --- 20,25 ---- #include "sparkglrender.h" #include <zeitgeist/logserver/logserver.h> + #include <oxygen/physicsserver/body.h> + #include <oxygen/physicsserver/joint.h> #include <oxygen/sceneserver/camera.h> #include <oxygen/sceneserver/sceneserver.h> *************** *** 36,39 **** --- 38,57 ---- using namespace kerosin; + // ---- SparkGLRender::RenderSelectionContext + + SparkGLRender::RenderSelectionContext::RenderSelectionContext(shared_ptr<BaseNode> node) + { + assert(node.get() != 0); + glPushMatrix(); + glMultMatrixf(node->GetWorldTransform().m); + } + + SparkGLRender::RenderSelectionContext::~RenderSelectionContext() + { + glPopMatrix(); + } + + // ---- SparkGLRender + SparkGLRender::SparkGLRender() { *************** *** 110,116 **** --- 128,136 ---- if (sMatNode.get() != 0) { + shared_ptr<Material> material = sMatNode->GetMaterial(); sMatNode->SetMaterial("matSelected"); + RenderSelectionContext context(sMatNode); sMatNode->RenderInternal(); *************** *** 128,138 **** if (renderNode.get() != 0) { renderNode->RenderInternal(); return; } const salt::AABB3& bb = node->GetWorldBoundingBox(); float size = std::max<float>(GLRENDER_MIN_AXIS_WIDTH, bb.GetRadius()); ! Axis::RenderAxis(size); } --- 148,193 ---- if (renderNode.get() != 0) { + RenderSelectionContext context(renderNode); renderNode->RenderInternal(); return; } + shared_ptr<Joint> jointNode = + shared_dynamic_cast<Joint>(node); + + if (jointNode.get() != 0) + { + for ( + int i=Joint::BI_FIRST; + i<=Joint::BI_SECOND; + ++i + ) + { + shared_ptr<Body> body = + jointNode->GetBody(static_cast<Joint::EBodyIndex>(i)); + + if (body.get() == 0) + { + continue; + } + + RenderNodeSelection(body); + } + + { + RenderSelectionContext context(jointNode); + Axis::RenderAxis(0.5); + } + + return; + } + const salt::AABB3& bb = node->GetWorldBoundingBox(); float size = std::max<float>(GLRENDER_MIN_AXIS_WIDTH, bb.GetRadius()); ! ! { ! RenderSelectionContext context(node); ! Axis::RenderAxis(size); ! } } *************** *** 150,158 **** glDisable(GL_DEPTH_TEST); - glPushMatrix(); - glMultMatrixf(node->GetWorldTransform().m); - RenderNodeSelection(node); - - glPopMatrix(); } --- 205,208 ---- Index: property.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/property.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** property.h 15 Mar 2007 07:26:24 -0000 1.6 --- property.h 15 Jun 2007 08:48:16 -0000 1.7 *************** *** 47,50 **** --- 47,52 ---- CL_BODY, CL_JOINT, + CL_HINGEJOINT, + CL_UNIVERSALJOINT, CL_WORLD, CL_COLLISIONHANDLER, *************** *** 86,89 **** --- 88,93 ---- void GenTransformEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; void GenBodyEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; + void GenHingeEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; + void GenUniversalEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; void GenJointEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; void GenWorldEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; |