-fixes in player: draw physics debugging, only render frames when actually updated...
authorErwin Coumans <blender@erwincoumans.com>
Tue, 26 Dec 2006 22:02:31 +0000 (22:02 +0000)
committerErwin Coumans <blender@erwincoumans.com>
Tue, 26 Dec 2006 22:02:31 +0000 (22:02 +0000)
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/Ketsji/KX_ISceneConverter.h
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp

index fd47df7f7703a7825a0a6d13f0ae68fe9466d923..0d2aa774394601212ae0916043eebc5236376b85 100644 (file)
@@ -435,10 +435,12 @@ bool GPG_Application::processEvent(GHOST_IEvent* event)
                                        m_exitRequested = m_ketsjiengine->GetExitCode();
                                        
                                        // kick the engine
-                                       m_ketsjiengine->NextFrame();
-                                       
-                                       // render the frame
-                                       m_ketsjiengine->Render();
+                                       bool renderFrame = m_ketsjiengine->NextFrame();
+                                       if (renderFrame)
+                                       {
+                                               // render the frame
+                                               m_ketsjiengine->Render();
+                                       }
                                }
                                m_exitString = m_ketsjiengine->GetExitString();
                        }
@@ -496,6 +498,9 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
                bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0);
                bool fixedFr = (G.fileflags & G_FILE_ENABLE_ALL_FRAMES);
 
+               bool showPhysics = (G.fileflags & G_FILE_SHOW_PHYSICS);
+               SYS_WriteCommandLineInt(syshandle, "show_physics", showPhysics);
+
                bool fixed_framerate= (SYS_GetCommandLineInt(syshandle, "fixed_framerate", fixedFr) != 0);
                bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0);
                bool useVertexArrays = SYS_GetCommandLineInt(syshandle,"vertexarrays",1) != 0;
index 2727ce7746e9f089780fe8410b9b64eef8910a32..2e4250dfe1ef8bcb05b4ff7ffb9e48c268a90dc3 100644 (file)
@@ -39,7 +39,7 @@ class KX_ISceneConverter
 {
 
 public:
-       KX_ISceneConverter() {}
+       KX_ISceneConverter() :addInitFromFrame(false) {}//this addInitFromFrame is a back hack, todo remove
        virtual ~KX_ISceneConverter () {};
 
        /*
index d3eb4db6f35a55e4bd461b2bd9eab58cb3b96254..ecb6c8d9dcf453c18d1aa07d93f138dd7c8c4909 100644 (file)
@@ -368,8 +368,14 @@ void               CcdPhysicsController::setScaling(float scaleX,float scaleY,float scaleZ)
                if (m_body && m_body->getCollisionShape())
                {
                        m_body->getCollisionShape()->setLocalScaling(m_cci.m_scaling);
-                       m_body->getCollisionShape()->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor);
-                       m_body->setMassProps(m_cci.m_mass, m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor);
+                       
+                       //printf("no inertia recalc for fixed objects with mass=0\n");
+                       if (m_cci.m_mass)
+                       {
+                               m_body->getCollisionShape()->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor);
+                               m_body->setMassProps(m_cci.m_mass, m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor);
+                       } 
+                       
                }
        }
 }