|
From: Markus R. <rol...@us...> - 2006-01-22 18:57:57
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13745 Modified Files: property.cpp property.h Log Message: - added properties of Body, Joint and World Index: property.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/property.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** property.cpp 22 Jan 2006 17:25:23 -0000 1.2 --- property.cpp 22 Jan 2006 18:57:46 -0000 1.3 *************** *** 33,36 **** --- 33,40 ---- #include <oxygen/sceneserver/basenode.h> #include <oxygen/sceneserver/transform.h> + #include <oxygen/physicsserver/body.h> + #include <oxygen/physicsserver/joint.h> + #include <oxygen/physicsserver/world.h> + using namespace std; *************** *** 61,64 **** --- 65,83 ---- } + inline wxString FormatFloat(const float f) + { + return wxString::Format(_T("%.2f"),f); + } + + inline wxString FormatInt(const int i) + { + return wxString::Format(_T("%d"),i); + } + + inline wxString FormatBool(const bool b) + { + return b ? _T("true") : _T("false"); + } + Property::Property() { *************** *** 74,77 **** --- 93,99 ---- mClassMap[_T("/classes/oxygen/BaseNode")] = CL_BASENODE; mClassMap[_T("/classes/oxygen/Transform")] = CL_TRANSFORM; + mClassMap[_T("/classes/oxygen/Body")] = CL_BODY; + mClassMap[_T("/classes/oxygen/Joint")] = CL_JOINT; + mClassMap[_T("/classes/oxygen/World")] = CL_WORLD; } *************** *** 128,136 **** { shared_ptr<Transform> trans = shared_static_cast<Transform>(leaf); ! entries.push_back(Entry(_T("GetChangedMark"), wxString::Format("%d",trans->GetChangedMark()))); entries.push_back(Entry(_T("GetLocalTransform"), FormatMatrix(trans->GetLocalTransform()))); entries.push_back(Entry(_T("GetWorldTransform"), FormatMatrix(trans->GetWorldTransform()))); } void Property::GetClassList(boost::shared_ptr<Class> cl, TClassList& clList) const { --- 150,211 ---- { shared_ptr<Transform> trans = shared_static_cast<Transform>(leaf); ! entries.push_back(Entry(_T("GetChangedMark"), FormatInt(trans->GetChangedMark()))); entries.push_back(Entry(_T("GetLocalTransform"), FormatMatrix(trans->GetLocalTransform()))); entries.push_back(Entry(_T("GetWorldTransform"), FormatMatrix(trans->GetWorldTransform()))); } + void Property::GenBodyEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const + { + shared_ptr<Body> body = shared_static_cast<Body>(leaf); + entries.push_back(Entry(_T("GetMass"),FormatFloat(body->GetMass()))); + entries.push_back(Entry(_T("GetVelocity"),FormatVector3(body->GetVelocity()))); + entries.push_back(Entry(_T("GetAngularVelocity"),FormatVector3(body->GetAngularVelocity()))); + entries.push_back(Entry(_T("GetPosition"),FormatVector3(body->GetPosition()))); + } + + void Property::GenJointEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const + { + shared_ptr<Joint> joint = shared_static_cast<Joint>(leaf); + entries.push_back(Entry(_T("FeedBackEnabled"),FormatBool(joint->FeedBackEnabled()))); + + for (int i=0;i<2;++i) + { + wxString strIdx = _T("(") + FormatInt(i) + _T(")"); + const Joint::EBodyIndex idx = static_cast<Joint::EBodyIndex>(i); + + entries.push_back(Entry(_T("GetFeedbackForce")+strIdx,FormatVector3(joint->GetFeedbackForce(idx)))); + entries.push_back(Entry(_T("GetFeedbackTorque")+strIdx,FormatVector3(joint->GetFeedbackTorque(idx)))); + } + + for (int i=0;i<3;++i) + { + wxString strIdx = _T("(") + FormatInt(i) + _T(")"); + const Joint::EAxisIndex idx = static_cast<Joint::EAxisIndex>(i); + + entries.push_back(Entry(_T("GetBounce")+strIdx,FormatFloat(joint->GetBounce(idx)))); + entries.push_back(Entry(_T("GetLowStopDeg")+strIdx,FormatFloat(joint->GetLowStopDeg(idx)))); + entries.push_back(Entry(_T("GetHighStopDeg")+strIdx,FormatFloat(joint->GetHighStopDeg(idx)))); + entries.push_back(Entry(_T("GetLowStopPos")+strIdx,FormatFloat(joint->GetLowStopPos(idx)))); + entries.push_back(Entry(_T("GetHighStopPos")+strIdx,FormatFloat(joint->GetHighStopPos(idx)))); + entries.push_back(Entry(_T("GetCFM")+strIdx,FormatFloat(joint->GetCFM(idx)))); + entries.push_back(Entry(_T("GetStopCFM")+strIdx,FormatFloat(joint->GetStopCFM(idx)))); + entries.push_back(Entry(_T("GetSuspensionCFM")+strIdx,FormatFloat(joint->GetSuspensionCFM(idx)))); + entries.push_back(Entry(_T("GetStopERP")+strIdx,FormatFloat(joint->GetStopERP(idx)))); + entries.push_back(Entry(_T("GetSuspensionERP")+strIdx,FormatFloat(joint->GetSuspensionERP(idx)))); + entries.push_back(Entry(_T("GetLinearMotorVelocity")+strIdx,FormatFloat(joint->GetLinearMotorVelocity(idx)))); + entries.push_back(Entry(_T("GetAngularMotorVelocity")+strIdx,FormatFloat(joint->GetAngularMotorVelocity(idx)))); + entries.push_back(Entry(_T("GetMaxMotorForce")+strIdx,FormatFloat(joint->GetMaxMotorForce(idx)))); + } + } + + void Property::GenWorldEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const + { + shared_ptr<World> world = shared_static_cast<World>(leaf); + entries.push_back(Entry(_T("GetGravity"),FormatVector3(world->GetGravity()))); + entries.push_back(Entry(_T("GetERP"),FormatFloat(world->GetERP()))); + entries.push_back(Entry(_T("GetCFM"),FormatFloat(world->GetCFM()))); + } + + void Property::GetClassList(boost::shared_ptr<Class> cl, TClassList& clList) const { *************** *** 223,226 **** --- 298,312 ---- GenTransformEntries(leaf, entries); break; + + case CL_BODY: + GenBodyEntries(leaf, entries); + break; + + case CL_JOINT: + GenJointEntries(leaf, entries); + break; + + case CL_WORLD: + GenWorldEntries(leaf, entries); } } Index: property.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/property.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** property.h 22 Jan 2006 17:25:23 -0000 1.2 --- property.h 22 Jan 2006 18:57:46 -0000 1.3 *************** *** 40,44 **** CL_CLASS, CL_BASENODE, ! CL_TRANSFORM }; --- 40,47 ---- CL_CLASS, CL_BASENODE, ! CL_TRANSFORM, ! CL_BODY, ! CL_JOINT, ! CL_WORLD }; *************** *** 74,77 **** --- 77,83 ---- void GenBaseNodeEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; void GenTransformEntries(boost::shared_ptr<zeitgeist::Leaf> leaf, TEntryList& entries) const; + void GenBodyEntries(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; void GetClassList(boost::shared_ptr<zeitgeist::Class> cl, TClassList& clList) const; |