|
From: Charles L. <cn...@us...> - 2009-04-22 06:22:29
|
Update of /cvsroot/hgengine/Mercury/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2543/src Modified Files: ScreenODETest.cpp ScreenODETest.h Log Message: better beta Index: ScreenODETest.cpp =================================================================== RCS file: /cvsroot/hgengine/Mercury/src/ScreenODETest.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ScreenODETest.cpp 5 Sep 2007 00:49:36 -0000 1.36 --- ScreenODETest.cpp 22 Apr 2009 06:22:26 -0000 1.37 *************** *** 55,58 **** --- 55,59 ---- DISPLAY->AddLight(&m_light); + m_pLastAt = MercuryPoint( 0, 0, 0 ); m_bFirstUpdate=true; } *************** *** 60,63 **** --- 61,83 ---- void ScreenODETest::Update( const float dTime ) { + MercuryODEObject * c = m_pWorld.GetODEObjectByName( "Control" ); + + int x, y; + INPUTMAN->GetCursorPosition(x, y); + m_pCamera->Tweening.StopTweening(); + + //The tween adjusts the eye, up never changes, and center is always the control object + m_pCamera->Tweening.AddCommand( ssprintf( "linear,0.4;x,%f;y,%f;z,%f;", + c->GetX()+COS(float(x)/300)*70, + c->GetY()+SIN(float(x)/300)*70, + c->GetZ()+(float(y)/300)*70) ); + + //Tricky - we want to slosh around some. Mix last frame's at with this frame's + float dt = (dTime > 0.2)?0.2:dTime; + dt *= 5.; + m_pLastAt = m_pLastAt * (1.-dt) + c->GetPosition() * dt; + m_pCamera->SetTarget(m_pLastAt); + + MercuryScreen::Update( dTime ); if ( m_bFirstUpdate ) *************** *** 89,110 **** dBodySetForce( z->GetBody(), COS(RealAngle)*Amplitude,SIN(RealAngle)*Amplitude,0); - MercuryODEObject * c = m_pWorld.GetODEObjectByName( "Control" ); - - int x, y; - INPUTMAN->GetCursorPosition(x, y); - m_pCamera->Tweening.StopTweening(); - - //The tween adjusts the eye, up never changes, and center is always the control object - m_pCamera->Tweening.AddCommand( ssprintf( "linear,0.4;x,%f;y,%f;z,%f;", - c->GetX()+COS(float(x)/300)*70, - c->GetY()+SIN(float(x)/300)*70, - c->GetZ()+(float(y)/300)*70) ); - m_pCamera->SetTarget(c->GetPosition()); } ! void ScreenODETest::Draw() { ! ! MercuryScreen::Draw(); } --- 109,117 ---- dBodySetForce( z->GetBody(), COS(RealAngle)*Amplitude,SIN(RealAngle)*Amplitude,0); } ! void ScreenODETest::Render() { ! MercuryScreen::Render(); } Index: ScreenODETest.h =================================================================== RCS file: /cvsroot/hgengine/Mercury/src/ScreenODETest.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ScreenODETest.h 5 Nov 2006 06:21:47 -0000 1.15 --- ScreenODETest.h 22 Apr 2009 06:22:26 -0000 1.16 *************** *** 17,21 **** virtual void Init(); virtual void Update( const float dTime ); ! virtual void Draw(); void SendInfo( const MString & name ); --- 17,21 ---- virtual void Init(); virtual void Update( const float dTime ); ! virtual void Render(); void SendInfo( const MString & name ); *************** *** 24,27 **** --- 24,28 ---- MercuryLight m_light; MercuryODEWorld m_pWorld; + MercuryPoint m_pLastAt; MercuryShape m_shpGround; bool m_bFirstUpdate; |