Browse Source

Nothing important to mention

Panagiotis Christopoulos Charitos 15 years ago
parent
commit
77f3a37c51
6 changed files with 53 additions and 16 deletions
  1. 30 0
      src/Main.cpp
  2. 3 3
      src/Renderer/Renderer.cpp
  3. 5 1
      src/Scene/ParticleEmitter.cpp
  4. 2 0
      src/Tokenizer/Scanner.h
  5. 9 8
      src/Util/App.h
  6. 4 4
      src/Util/Input.cpp

+ 30 - 0
src/Main.cpp

@@ -153,6 +153,36 @@ void initPhysics()
 
 
 	//dynamicsWorld->setDebugDrawer(&debugDrawer);
+
+
+
+	/*for (int i=0;i<app->getScene()->getPhyWorld()->getDynamicsWorld()->getCollisionObjectArray().size();i++)
+	{
+		btCollisionObject* colObj = copyArray[i];
+		btRigidBody* body = btRigidBody::upcast(colObj);
+		if (body)
+		{
+			if (body->getMotionState())
+			{
+				btDefaultMotionState* myMotionState = (btDefaultMotionState*)body->getMotionState();
+				myMotionState->m_graphicsWorldTrans = myMotionState->m_startWorldTrans;
+				body->setCenterOfMassTransform( myMotionState->m_graphicsWorldTrans );
+				colObj->setInterpolationWorldTransform( myMotionState->m_startWorldTrans );
+				colObj->forceActivationState(ACTIVE_TAG);
+				colObj->activate();
+				colObj->setDeactivationTime(0);
+				//colObj->setActivationState(WANTS_DEACTIVATION);
+			}
+			//removed cached contact points (this is not necessary if all objects have been removed from the dynamics world)
+			//m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(colObj->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher());
+
+			btRigidBody* body = btRigidBody::upcast(colObj);
+			if (body && !body->isStaticObject())
+			{
+				btRigidBody::upcast(colObj)->setLinearVelocity(btVector3(0,0,0));
+				btRigidBody::upcast(colObj)->setAngularVelocity(btVector3(0,0,0));
+			}
+		}*/
 }
 
 

+ 3 - 3
src/Renderer/Renderer.cpp

@@ -132,8 +132,8 @@ void init()
 	if( !glewIsSupported("GL_ARB_vertex_buffer_object") )
 		WARNING( "Vertex Buffer Objects not supported. The application may crash (and burn)" );
 
-	w = app->windowW /* * renderingQuality*/;
-	h = app->windowH /* * renderingQuality*/;
+	w = app->getWindowWidth() /* * renderingQuality*/;
+	h = app->getWindowHeight() /* * renderingQuality*/;
 	aspectRatio = float(w)/h;
 
 	glClearColor( 0.1, 0.1, 0.1, 0.0 );
@@ -199,7 +199,7 @@ void render( const Camera& cam )
 	R::Dbg::runStage( cam );
 
 	//R::setViewport( 0, 0, App::windowW, App::windowH );
-	R::setViewport( 0, 0, app->windowW, app->windowH );
+	R::setViewport( 0, 0, app->getWindowWidth(), app->getWindowHeight() );
 
 	glDisable( GL_DEPTH_TEST );
 	glDisable( GL_BLEND );

+ 5 - 1
src/Scene/ParticleEmitter.cpp

@@ -53,9 +53,13 @@ void ParticleEmitter::init( const char* filename )
 		particles[i] = new Particle;
 		float mass = Util::randRange( minParticleMass, maxParticleMass );
 		btRigidBody* body = app->getScene()->getPhyWorld()->createNewRigidBody( mass, Transform::getIdentity(), colShape, particles[i],
-		                                                                   PhyWorld::CG_PARTICLE, PhyWorld::CG_MAP );
+		                                                                        PhyWorld::CG_PARTICLE, PhyWorld::CG_MAP );
 		body->forceActivationState( DISABLE_SIMULATION );
 	}
+
+	/*btDiscreteDynamicsWorld* btWorld = app->getScene()->getPhyWorld()->getDynamicsWorld();
+	btWorld->getBroadphase()->resetPool( btWorld->getDispatcher() );
+	btWorld->getConstraintSolver()->reset();*/
 }
 
 

+ 2 - 0
src/Tokenizer/Scanner.h

@@ -9,6 +9,8 @@
 // Scanner                                                                                                                          =
 //=====================================================================================================================================
 /**
+ * @brief C++ Tokenizer
+ *
  * The Scanner loads a file and returns the tokens. The script must be in C++ format. The class does not make any kind of
  * memory allocations so it can be fast.
  */

+ 9 - 8
src/Util/App.h

@@ -11,21 +11,22 @@
  */
 class App
 {
-	PROPERTY_R( uint, desktopW, getDesktopW ) ///< Property: The desktop width at App initialization
-	PROPERTY_R( uint, desktopH, getDesktopH ) ///< Property: The desktop height at App initialization
-	PROPERTY_RW( class Scene*, scene, setScene, getScene ) ///< Property: Pointer to the current scene
-	PROPERTY_RW( class Camera*, activeCam, setActiveCam, getActiveCam ) ///< Property: Pointer to the current camera
+	PROPERTY_R( uint, desktopW, getDesktopWidth ) ///< @ref PROPERTY_R : The desktop width at App initialization
+	PROPERTY_R( uint, desktopH, getDesktopHeight ) ///< @ref PROPERTY_R : The desktop height at App initialization
+	PROPERTY_R( uint, windowW, getWindowWidth ) ///< @ref PROPERTY_R : The main window width
+	PROPERTY_R( uint, windowH, getWindowHeight ) ///< @ref PROPERTY_R : The main window height
+
+	PROPERTY_RW( class Scene*, scene, setScene, getScene ) ///< @ref PROPERTY_RW : Pointer to the current scene
+	PROPERTY_RW( class Camera*, activeCam, setActiveCam, getActiveCam ) ///< @ref PROPERTY_RW : Pointer to the current camera
 
 	private:
 		static bool isCreated; ///< A flag to ensure one @ref App instance
 		uint time;
-		SDL_Surface* mainSurf;
-		SDL_Surface* iconImage;
+		SDL_Surface* mainSurf; ///< SDL stuff
+		SDL_Surface* iconImage; ///< SDL stuff
 
 	public:
 		uint timerTick;
-		uint windowW;
-		uint windowH;
 
 		App();
 		~App() {}

+ 4 - 4
src/Util/Input.cpp

@@ -43,7 +43,7 @@ handleEvents
 void handleEvents()
 {
 	if( hideCursor ) SDL_ShowCursor( SDL_DISABLE );
-	else              SDL_ShowCursor( SDL_ENABLE );
+	else             SDL_ShowCursor( SDL_ENABLE );
 
 	// add the times a key is bying pressed
 	for( int x=0; x<SDLK_LAST; x++ )
@@ -86,8 +86,8 @@ void handleEvents()
 				mousePos.x = event_.button.x;
 				mousePos.y = event_.button.y;
 
-				mousePosNdc.x = (2.0f * mousePos.x) / (float)app->windowW - 1.0f;
-				mousePosNdc.y = 1.0f - (2.0f * mousePos.y) / (float)app->windowH;
+				mousePosNdc.x = (2.0f * mousePos.x) / (float)app->getWindowWidth() - 1.0f;
+				mousePosNdc.y = 1.0f - (2.0f * mousePos.y) / (float)app->getWindowHeight();
 
 				if( warpMouse )
 				{
@@ -95,7 +95,7 @@ void handleEvents()
 					// ...SDL_WarpMouse function
 					if( mousePosNdc == Vec2::getZero() ) break;
 
-					SDL_WarpMouse( app->windowW/2, app->windowH/2);
+					SDL_WarpMouse( app->getWindowWidth()/2, app->getWindowHeight()/2);
 				}
 
 				mouseVelocity = mousePosNdc - prevMousePosNdc;