Merge of itasc branch. Project files, scons and cmake should be working. Makefile...
[blender.git] / source / gameengine / Ketsji / KX_KetsjiEngine.h
index 16b53b6..373e8bf 100644 (file)
@@ -1,15 +1,12 @@
 /*
  * $Id$
  *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License.  See http://www.blender.org/BL/ for information
- * about this.
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,7 +24,7 @@
  *
  * Contributor(s): none yet.
  *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * ***** END GPL LICENSE BLOCK *****
  *
  */
 #ifndef __KX_KETSJI_ENGINE
@@ -73,10 +70,10 @@ private:
        class RAS_IRenderTools*                         m_rendertools;
        class KX_ISceneConverter*                       m_sceneconverter;
        class NG_NetworkDeviceInterface*                m_networkdevice;
-       class SND_IAudioDevice*                         m_audiodevice;
        PyObject*                                       m_pythondictionary;
        class SCA_IInputDevice*                         m_keyboarddevice;
        class SCA_IInputDevice*                         m_mousedevice;
+       class KX_Dome*                                          m_dome; // dome stereo mode
 
        /** Lists of scenes scheduled to be removed at the end of the frame. */
        std::set<STR_String> m_removingScenes;
@@ -105,7 +102,10 @@ private:
        double                          m_previousClockTime;//previous clock time
        double                          m_remainingTime;
 
+       static int                              m_maxLogicFrame;        /* maximum number of consecutive logic frame */
+       static int                              m_maxPhysicsFrame;      /* maximum number of consecutive physics frame */
        static double                   m_ticrate;
+       static double                   m_anim_framerate; /* for animation playback only - ipo and action */
 
        static double                   m_suspendedtime;
        static double                   m_suspendeddelta;
@@ -126,6 +126,9 @@ private:
        bool                    m_overrideCamUseOrtho;
        MT_CmMatrix4x4  m_overrideCamProjMat;
        MT_CmMatrix4x4  m_overrideCamViewMat;
+       float                   m_overrideCamNear;
+       float                   m_overrideCamFar;
+       float                   m_overrideCamLens;
 
        bool m_stereo;
        int m_curreye;
@@ -151,6 +154,8 @@ private:
        
        /** Labels for profiling display. */
        static const char               m_profileLabels[tc_numCategories][15];
+       /** Last estimated framerate */
+       static double                   m_average_framerate;
        /** Show the framerate on the game display? */
        bool                                    m_show_framerate;
        /** Show profiling info on the game display? */
@@ -177,23 +182,22 @@ private:
        /** Blue component of framing bar color. */
        float                                   m_overrideFrameColorB;
 
-       void                                    SetupRenderFrame(KX_Scene *scene, KX_Camera* cam);
        void                                    RenderFrame(KX_Scene* scene, KX_Camera* cam);
+       void                                    PostRenderFrame();
        void                                    RenderDebugProperties();
+       void                                    RenderShadowBuffers(KX_Scene *scene);
        void                                    SetBackGround(KX_WorldInfo* worldinfo);
-       void                                    SetWorldSettings(KX_WorldInfo* worldinfo);
        void                                    DoSound(KX_Scene* scene);
 
 public:
-
        KX_KetsjiEngine(class KX_ISystem* system);
        virtual ~KX_KetsjiEngine();
 
        // set the devices and stuff. the client must take care of creating these
+       void                    SetWorldSettings(KX_WorldInfo* worldinfo);
        void                    SetKeyboardDevice(SCA_IInputDevice* keyboarddevice);
        void                    SetMouseDevice(SCA_IInputDevice* mousedevice);
        void                    SetNetworkDevice(NG_NetworkDeviceInterface* networkdevice);
-       void                    SetAudioDevice(SND_IAudioDevice* audiodevice);
        void                    SetCanvas(RAS_ICanvas* canvas);
        void                    SetRenderTools(RAS_IRenderTools* rendertools);
        void                    SetRasterizer(RAS_IRasterizer* rasterizer);
@@ -201,6 +205,16 @@ public:
        void                    SetSceneConverter(KX_ISceneConverter* sceneconverter);
        void                    SetGame2IpoMode(bool game2ipo,int startFrame);
 
+       RAS_IRasterizer*                GetRasterizer(){return m_rasterizer;};
+       RAS_ICanvas*                GetCanvas(){return m_canvas;};
+       RAS_IRenderTools*           GetRenderTools(){return m_rendertools;};
+
+       /// Dome functions
+       void                    InitDome(short res, short mode, short angle, float resbuf, short tilt, struct Text* text); 
+       void                    EndDome();
+       void                    RenderDome();
+       bool                    m_usedome;
+
        ///returns true if an update happened to indicate -> Render
        bool                    NextFrame();
        void                    Render();
@@ -224,7 +238,11 @@ public:
        void                    SuspendScene(const STR_String& scenename);
        void                    ResumeScene(const STR_String& scenename);
 
+       void                    GetSceneViewport(KX_Scene* scene, KX_Camera* cam, RAS_Rect& area, RAS_Rect& viewport);
+
        void SetDrawType(int drawingtype);
+       int  GetDrawType(){return m_drawingmode;};
+
        void SetCameraZoom(float camzoom);
        
        void EnableCameraOverride(const STR_String& forscene);
@@ -232,6 +250,8 @@ public:
        void SetCameraOverrideUseOrtho(bool useOrtho);
        void SetCameraOverrideProjectionMatrix(const MT_CmMatrix4x4& mat);
        void SetCameraOverrideViewMatrix(const MT_CmMatrix4x4& mat);
+       void SetCameraOverrideClipping(float near, float far);
+       void SetCameraOverrideLens(float lens);
        
        /**
         * Sets display of all frames.
@@ -245,6 +265,16 @@ public:
         */ 
        bool GetUseFixedTime(void) const;
 
+       /**
+        * Returns current render frame clock time
+        */
+       double GetClockTime(void) const;
+       /**
+        * Returns current logic frame clock time
+        */
+       double GetFrameTime(void) const;
+
+       double GetRealTime(void) const;
        /**
         * Returns the difference between the local time of the scene (when it
         * was running and not suspended) and the "curtime"
@@ -259,6 +289,36 @@ public:
         * Sets the number of logic updates per second.
         */
        static void SetTicRate(double ticrate);
+       /**
+        * Gets the maximum number of logic frame before render frame
+        */
+       static int GetMaxLogicFrame();
+       /**
+        * Sets the maximum number of logic frame before render frame
+        */
+       static void SetMaxLogicFrame(int frame);
+       /**
+        * Gets the maximum number of physics frame before render frame
+        */
+       static int GetMaxPhysicsFrame();
+       /**
+        * Sets the maximum number of physics frame before render frame
+        */
+       static void SetMaxPhysicsFrame(int frame);
+
+       /**
+        * Gets the framerate for playing animations. (actions and ipos)
+        */
+       static double GetAnimFrameRate();
+       /**
+        * Sets the framerate for playing animations. (actions and ipos)
+        */
+       static void SetAnimFrameRate(double framerate);
+
+       /**
+        * Gets the last estimated average framerate
+        */
+       static double GetAverageFrameRate();
 
        /**
         * Activates or deactivates timing information display.
@@ -337,8 +397,17 @@ protected:
        KX_Scene*               CreateScene(const STR_String& scenename);
        
        bool                    BeginFrame();
+       void                    ClearFrame();
        void                    EndFrame();
+       
+       
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+       void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_KetsjiEngine"); }
+       void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
 };
 
 #endif //__KX_KETSJI_ENGINE
 
+