From: <sgv...@us...> - 2011-03-02 17:23:06
|
Revision: 248 http://simspark.svn.sourceforge.net/simspark/?rev=248&view=rev Author: sgvandijk Date: 2011-03-02 17:22:58 +0000 (Wed, 02 Mar 2011) Log Message: ----------- - Take out accidental joint feedback request - Some initialisation - Readd inputControl loop (at correct place) Modified Paths: -------------- trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp trunk/spark/lib/oxygen/sceneserver/scene.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp trunk/spark/lib/oxygen/simulationserver/simulationserver.h trunk/spark/plugin/odeimps/odehingejoint.cpp Modified: trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp =================================================================== --- trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/monitorserver/monitorserver.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -30,7 +30,7 @@ using namespace boost; using namespace std; -MonitorServer::MonitorServer() : Node() +MonitorServer::MonitorServer() : Node(), mDataCycle(0) { } Modified: trunk/spark/lib/oxygen/sceneserver/scene.cpp =================================================================== --- trunk/spark/lib/oxygen/sceneserver/scene.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/sceneserver/scene.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -26,7 +26,7 @@ using namespace salt; using namespace zeitgeist; -Scene::Scene() : BaseNode(), mModified(false), mModifiedNum(0) +Scene::Scene() : BaseNode(), mModified(false), mModifiedNum(0), mLastCacheUpdate(0) { } Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -312,15 +312,16 @@ Init(argc, argv); GetLog()->Normal() << "(SimulationServer) entering runloop\n"; + boost::shared_ptr<SimControlNode> inputCtr = GetControlNode("InputControl"); + if ( mMultiThreads ) { GetLog()->Normal()<< "(SimulationServer) running in multi-threads\n"; - RunMultiThreaded(); + RunMultiThreaded(inputCtr); } else { GetLog()->Normal()<< "(SimulationServer) running in single thread\n"; - boost::shared_ptr<SimControlNode> inputCtr = GetControlNode("InputControl"); if ( !mAutoTime && inputCtr.get() == 0 ) { GetLog()->Error()<< "(SimulationServer) ERROR: can not get InputControl\n"; @@ -391,7 +392,7 @@ return mSceneServer.get(); } -void SimulationServer::RunMultiThreaded() +void SimulationServer::RunMultiThreaded(boost::shared_ptr<SimControlNode> &inputCtr) { if (mSimStep == 0) { @@ -428,19 +429,34 @@ { ++mCycle; + // Signal start of cycle mThreadBarrier->wait(); if (mExit) mExitThreads = true; + // Wait for SimControlNodes' acts at the begining of a cycle - mThreadBarrier->wait(); finalDelta = initDelta = mSumDeltaTime; mSceneServer->PrePhysicsUpdate(mSimStep); mSceneServer->PhysicsUpdate(mSimStep); + if (mAutoTime) - AdvanceTime(mSimStep); + { + AdvanceTime(mSimStep); + } + + else + { + if (inputCtr.get() != 0) + { + while (int(mSumDeltaTime*100) < int(mSimStep*100)) + { + inputCtr->StartCycle();// advance the time + } + } + } UpdateDeltaTimeAfterStep(finalDelta); @@ -454,11 +470,13 @@ mSceneServer->PostPhysicsUpdate(); mGameControlServer->Update(finalStep); mSimTime += finalStep; + if (renderControl && renderControl->GetTime() - mSimTime < 0.005f ) renderControl->EndCycle(); - mThreadBarrier->wait(); + // End Cycle + mThreadBarrier->wait(); mSumDeltaTime -= initDelta - finalDelta; } @@ -484,7 +502,7 @@ mThreadBarrier->wait(); newCycle = false; - if ( controlNode->GetTime() - mSimTime <= 0.005f ) + if ( controlNode->GetTime() - mSimTime <= 0.005f && !isInputControl) { newCycle = true; controlNode->StartCycle(); Modified: trunk/spark/lib/oxygen/simulationserver/simulationserver.h =================================================================== --- trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/lib/oxygen/simulationserver/simulationserver.h 2011-03-02 17:22:58 UTC (rev 248) @@ -167,7 +167,7 @@ static void CatchSignal(int sig_num); /** the multi-threaded runloop of the simulation */ - void RunMultiThreaded(); + void RunMultiThreaded(boost::shared_ptr<SimControlNode> &inputCtr); /** the thread function which controls a single SimControlNode in * multi-threaded mode. */ Modified: trunk/spark/plugin/odeimps/odehingejoint.cpp =================================================================== --- trunk/spark/plugin/odeimps/odehingejoint.cpp 2011-02-26 00:09:51 UTC (rev 247) +++ trunk/spark/plugin/odeimps/odehingejoint.cpp 2011-03-02 17:22:58 UTC (rev 248) @@ -32,7 +32,7 @@ { dWorldID ODEWorld = (dWorldID) worldID; dJointID ODEJoint = dJointCreateHinge(ODEWorld, 0); - dJointSetFeedback( ODEJoint, &mFeedback ); + //dJointSetFeedback( ODEJoint, &mFeedback ); return (long) ODEJoint; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |