2002-10-12 11:37:38 +00:00
|
|
|
/*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
*/
|
2011-02-22 10:33:14 +00:00
|
|
|
|
|
|
|
/** \file KX_KetsjiEngine.h
|
|
|
|
* \ingroup ketsji
|
|
|
|
*/
|
|
|
|
|
2012-02-23 10:41:31 +00:00
|
|
|
#ifndef __KX_KETSJIENGINE_H__
|
|
|
|
#define __KX_KETSJIENGINE_H__
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "MT_CmMatrix4x4.h"
|
|
|
|
#include "MT_Matrix4x4.h"
|
|
|
|
#include "STR_String.h"
|
|
|
|
#include "KX_ISystem.h"
|
|
|
|
#include "KX_Scene.h"
|
|
|
|
#include "KX_Python.h"
|
|
|
|
#include "KX_WorldInfo.h"
|
|
|
|
#include <vector>
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
class KX_TimeCategoryLogger;
|
|
|
|
|
|
|
|
#define LEFT_EYE 1
|
|
|
|
#define RIGHT_EYE 2
|
|
|
|
|
|
|
|
enum KX_ExitRequestMode
|
|
|
|
{
|
|
|
|
KX_EXIT_REQUEST_NO_REQUEST = 0,
|
|
|
|
KX_EXIT_REQUEST_QUIT_GAME,
|
|
|
|
KX_EXIT_REQUEST_RESTART_GAME,
|
|
|
|
KX_EXIT_REQUEST_START_OTHER_GAME,
|
|
|
|
KX_EXIT_REQUEST_NO_SCENES_LEFT,
|
|
|
|
KX_EXIT_REQUEST_BLENDER_ESC,
|
|
|
|
KX_EXIT_REQUEST_OUTSIDE,
|
|
|
|
KX_EXIT_REQUEST_MAX
|
|
|
|
};
|
|
|
|
|
2011-09-11 05:54:07 +00:00
|
|
|
typedef struct {
|
|
|
|
short matmode;
|
|
|
|
short glslflag;
|
|
|
|
} GlobalSettings;
|
|
|
|
|
2004-04-24 06:40:15 +00:00
|
|
|
/**
|
|
|
|
* KX_KetsjiEngine is the core game engine class.
|
|
|
|
*/
|
2002-10-12 11:37:38 +00:00
|
|
|
class KX_KetsjiEngine
|
|
|
|
{
|
|
|
|
|
|
|
|
private:
|
2012-03-08 03:05:57 +00:00
|
|
|
class RAS_ICanvas* m_canvas; // 2D Canvas (2D Rendering Device Context)
|
2002-10-12 11:37:38 +00:00
|
|
|
class RAS_IRasterizer* m_rasterizer; // 3D Rasterizer (3D Rendering)
|
2012-03-08 03:05:57 +00:00
|
|
|
class KX_ISystem* m_kxsystem;
|
2002-10-12 11:37:38 +00:00
|
|
|
class RAS_IRenderTools* m_rendertools;
|
|
|
|
class KX_ISceneConverter* m_sceneconverter;
|
2012-03-08 03:05:57 +00:00
|
|
|
class NG_NetworkDeviceInterface* m_networkdevice;
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2012-03-18 07:38:51 +00:00
|
|
|
/* borrowed from sys.modules["__main__"], don't manage ref's */
|
2004-05-16 13:10:10 +00:00
|
|
|
PyObject* m_pythondictionary;
|
2013-03-19 04:51:37 +00:00
|
|
|
PyObject* m_pyprofiledict;
|
2009-09-29 21:42:40 +00:00
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
class SCA_IInputDevice* m_keyboarddevice;
|
|
|
|
class SCA_IInputDevice* m_mousedevice;
|
2009-04-08 15:06:20 +00:00
|
|
|
class KX_Dome* m_dome; // dome stereo mode
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/** Lists of scenes scheduled to be removed at the end of the frame. */
|
|
|
|
std::set<STR_String> m_removingScenes;
|
|
|
|
/** Lists of overley scenes scheduled to be added at the end of the frame. */
|
|
|
|
std::set<STR_String> m_addingOverlayScenes;
|
|
|
|
/** Lists of background scenes scheduled to be added at the end of the frame. */
|
|
|
|
std::set<STR_String> m_addingBackgroundScenes;
|
|
|
|
/** Lists of scenes scheduled to be replaced at the end of the frame. */
|
|
|
|
std::set<std::pair<STR_String,STR_String> > m_replace_scenes;
|
|
|
|
|
|
|
|
/* The current list of scenes. */
|
|
|
|
KX_SceneList m_scenes;
|
|
|
|
/* State variable recording the presence of object debug info in the current scene list. */
|
2012-09-16 04:58:18 +00:00
|
|
|
bool m_propertiesPresent;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
bool m_bInitialized;
|
|
|
|
int m_activecam;
|
|
|
|
bool m_bFixedTime;
|
|
|
|
|
2006-05-13 23:31:36 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
bool m_firstframe;
|
2005-08-22 18:31:19 +00:00
|
|
|
int m_currentFrame;
|
|
|
|
|
2006-01-12 06:30:01 +00:00
|
|
|
double m_frameTime;//discrete timestamp of the 'game logic frame'
|
|
|
|
double m_clockTime;//current time
|
|
|
|
double m_previousClockTime;//previous clock time
|
2011-07-14 07:03:33 +00:00
|
|
|
double m_previousAnimTime; //the last time animations were updated
|
2006-05-13 23:31:36 +00:00
|
|
|
double m_remainingTime;
|
2006-01-12 06:30:01 +00:00
|
|
|
|
2009-05-01 16:35:06 +00:00
|
|
|
static int m_maxLogicFrame; /* maximum number of consecutive logic frame */
|
2009-05-21 18:10:19 +00:00
|
|
|
static int m_maxPhysicsFrame; /* maximum number of consecutive physics frame */
|
2004-10-16 11:41:50 +00:00
|
|
|
static double m_ticrate;
|
2008-06-17 10:06:38 +00:00
|
|
|
static double m_anim_framerate; /* for animation playback only - ipo and action */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-08-12 20:53:29 +00:00
|
|
|
static bool m_restrict_anim_fps;
|
|
|
|
|
2005-12-18 19:10:26 +00:00
|
|
|
static double m_suspendedtime;
|
|
|
|
static double m_suspendeddelta;
|
|
|
|
|
Cucumber, first batch of merge - UI changes and custom exit key
---------------------------------------------------------------
This was a test drive to see how painful the merge will be.
Next batches are:
- use desktop option for fullscreen
- multisampling option
- bullet collision mask
- python
- storage (vbo, dl, ...)
- lighting
[lighting still needs review]
[python could use review, although it should be straightforward]
[storage should be tested more I think]
Merged /branches/soc-2011-cucumber:r
36991,37059,37157,37416,37497-37499,37501,37522,39036,40593
36991:
==UI==
* Made some options available in Blender Game that were only available in Blender Render (camera resolution, animation fps)
* Created a panel for the embedded player
* Renamed the FPS option for the standalone player to Refresh Rate
* Moved framing options to display
* Made a button to launch the blender player from within blender (only tested on windows for now)
37059:
==UI==
* Added the option to change the exit key for the BGE. The UI currently just sets a number, and this feature most likely does not work for blenderplayer yet. More work on this to come.
* Removed the physics settings from the scene panel for the BGE.
* Added an Add menu in the logic brick header.
37157:
Making the bake options available in Blender Game
37416:
Making the exit key UI element accept key presses instead of numbers. It still does not work for the Blenderplayer, and it does not limit the input to key presses (other events don't work for exiting)
37497:
Some more work on getting the exit key to work in the Blenderplayer.
Input is now restricted to keyboard events only for the exit key UI.
37498:
Some clean up from the last commit.
The exit key setting affects the Blenderplayer now.
37499:
Cleaning up some duplicate code. Now the reverseTranslateTable for converting blender key codes to ketsji key codes is only defined in BL_BlenderDataConverter.
37501:
Centralizing the exit key methods to the keyboard devices. This should make it easier to get exit key control to the python API.
[37517: committed previously]
37522:
Moved control of the exit key away from the keyboard devices, and moved it to ketsjiengine.
Added setExitKey and getExitKey to the python API
39036:
A couple of the doversions were in the wrong spot. This should fix some issues with the exit key not being set.
[not committed entirely, see below]]
40552: space_logic.py (* fixed an error in space_logic.py *)
40593:
launch blenderplayer from ui not working in OSX fix - by Daniel Stokes and me
########################################################
code left behind (to be included in next commit):
########################################################
{
/* Initialize default values for collision masks */
Object *ob;
for(ob=main->object.first; ob; ob=ob->id.next)
ob->col_group = ob->col_mask = 1;
}
2011-12-20 03:11:56 +00:00
|
|
|
static short m_exitkey; /* Key used to exit the BGE */
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
int m_exitcode;
|
|
|
|
STR_String m_exitstring;
|
|
|
|
/**
|
|
|
|
* Some drawing parameters, the drawing mode
|
|
|
|
* (wire/flat/texture), and the camera zoom
|
|
|
|
* factor.
|
|
|
|
*/
|
|
|
|
int m_drawingmode;
|
|
|
|
float m_cameraZoom;
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
bool m_overrideCam;
|
2002-10-12 11:37:38 +00:00
|
|
|
STR_String m_overrideSceneName;
|
|
|
|
|
|
|
|
bool m_overrideCamUseOrtho;
|
|
|
|
MT_CmMatrix4x4 m_overrideCamProjMat;
|
|
|
|
MT_CmMatrix4x4 m_overrideCamViewMat;
|
2008-09-15 00:11:30 +00:00
|
|
|
float m_overrideCamNear;
|
|
|
|
float m_overrideCamFar;
|
2009-06-09 22:56:43 +00:00
|
|
|
float m_overrideCamLens;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
bool m_stereo;
|
|
|
|
int m_curreye;
|
|
|
|
|
|
|
|
/** Categories for profiling display. */
|
2012-06-06 22:38:39 +00:00
|
|
|
typedef enum {
|
2002-10-12 11:37:38 +00:00
|
|
|
tc_first = 0,
|
|
|
|
tc_physics = 0,
|
|
|
|
tc_logic,
|
2011-07-14 07:03:33 +00:00
|
|
|
tc_animations,
|
2002-10-12 11:37:38 +00:00
|
|
|
tc_network,
|
|
|
|
tc_scenegraph,
|
|
|
|
tc_rasterizer,
|
|
|
|
tc_services, // time spend in miscelaneous activities
|
|
|
|
tc_overhead, // profile info drawing overhead
|
|
|
|
tc_outside, // time spend outside main loop
|
|
|
|
tc_numCategories
|
|
|
|
} KX_TimeCategory;
|
|
|
|
|
|
|
|
/** Time logger. */
|
|
|
|
KX_TimeCategoryLogger* m_logger;
|
|
|
|
|
|
|
|
/** Labels for profiling display. */
|
|
|
|
static const char m_profileLabels[tc_numCategories][15];
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
/** Last estimated framerate */
|
|
|
|
static double m_average_framerate;
|
2002-10-12 11:37:38 +00:00
|
|
|
/** Show the framerate on the game display? */
|
|
|
|
bool m_show_framerate;
|
|
|
|
/** Show profiling info on the game display? */
|
|
|
|
bool m_show_profile;
|
|
|
|
/** Show any debug (scene) object properties on the game display? */
|
|
|
|
bool m_showProperties;
|
|
|
|
/** Show background behind text for readability? */
|
|
|
|
bool m_showBackground;
|
|
|
|
|
|
|
|
bool m_show_debug_properties;
|
|
|
|
|
2005-08-23 13:16:02 +00:00
|
|
|
/** record physics into keyframes */
|
2010-02-22 12:25:58 +00:00
|
|
|
bool m_animation_record;
|
2005-08-23 13:16:02 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/** Hide cursor every frame? */
|
|
|
|
bool m_hideCursor;
|
|
|
|
|
|
|
|
/** Override framing bars color? */
|
|
|
|
bool m_overrideFrameColor;
|
|
|
|
/** Red component of framing bar color. */
|
|
|
|
float m_overrideFrameColorR;
|
|
|
|
/** Green component of framing bar color. */
|
|
|
|
float m_overrideFrameColorG;
|
|
|
|
/** Blue component of framing bar color. */
|
|
|
|
float m_overrideFrameColorB;
|
|
|
|
|
2011-09-11 05:54:07 +00:00
|
|
|
/** Settings that doesn't go away with Game Actuator */
|
|
|
|
GlobalSettings m_globalsettings;
|
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
void RenderFrame(KX_Scene* scene, KX_Camera* cam);
|
2010-03-03 06:38:47 +00:00
|
|
|
void PostRenderScene(KX_Scene* scene);
|
2002-10-12 11:37:38 +00:00
|
|
|
void RenderDebugProperties();
|
2008-07-10 12:47:20 +00:00
|
|
|
void RenderShadowBuffers(KX_Scene *scene);
|
2002-10-12 11:37:38 +00:00
|
|
|
void SetBackGround(KX_WorldInfo* worldinfo);
|
Patch:[#25163] BGE support for Blender Font objects - unicode support
Problem/Bug:
------------
There were no way to have proper unicode characters (e.g. Japanese) in Blender Game Engine. Now we can :)
You can see a sample here: http://blog.mikepan.com/multi-language-support-in-blender/
Functionality Explanation:
--------------------------
This patch converts the Blender Font Objects to a new BGE type: KX_FontObject
This object inherits KX_GameObject.cpp and has the following properties:
- text (the text of the object)
- size (taken from the Blender object, usually is 1.0)
- resolution (1.0 by default, maybe not really needed, but at least for debugging/the time being it's nice to have)
The way we deal with linked objects is different than Blender. In Blender the text and size are a property of the Text databock. Therefore linked objects necessarily share the same text (and size, although the size of the object datablock affects that too). In BGE they are stored and accessed per object. Without that it would be problematic to have addObject adding texts that don't share the same data.
Known problems/limitations/ToDo:
--------------------------------
1) support for packed font and the <builtin>
2) figure why some fonts are displayed in a different size in 3DView/BGE (BLF)
3) investigate some glitches I see some times
4) support for multiline
5) support for more Blender Font Object options (text aligment, text boxes, ...)
[1] Diego (bdiego) evantually will help on that. For the time being we are using the "default" (ui) font to replace the <builtin>.
[2] but not all of them. I need to cross check who is calculating the size/dpi in/correctly - Blender or BLF. (e.g. fonts that work well - MS Gothic)
[3] I think this may be related to the resolution we are drawing the font
[4] It can't/will not be handled inside BFL. So the way I see it is to implement a mini text library/api that works as a middlelayer between the drawing step and BLF.
So instead of:
BLF_draw(fontid, (char *)text, strlen(text));
We would do:
MAGIC_ROUTINE_IM_NOT_BLF_draw(fontir, (char *)text, styleflag, width, height);
[5] don't hold your breath ... but if someone wants to have fun in the holidays the (4) and (5) are part of the same problem.
Code Explanation:
-----------------
The patch should be simple to read. They are three may parts:
1) BL_BlenderDataConversion.cpp:: converts the OB_FONT object into a KX_FontObject.cpp and store it in the KX_Scene->m_fonts
2) KetsjiEngine.cpp::RenderFonts:: loop through the texts and call their internal drawing routine.
3) KX_FontObject.cpp::
a) constructor: load the font of the object, and store other values.
b) DrawText: calculate the aspect for the given size (sounds hacky but this is how blf works) and call the render routine in RenderTools
4) KX_BlenderGL.cpp (called from rendertools) ::BL_print_game_line:: Draws the text. Using the BLF API
*) In order to handle visibility of the object added with AddObject I'm adding to the m_scene.m_fonts list only the Fonts in a visible layer - unlike Cameras and Lamps where all the objects are added.
Acknowledgements:
----------------
Thanks Benoit for the review and adjustment suggestions.
Thanks Diego for the BFL expertise, patches and support (Latin community ftw)
Thanks my boss for letting me do part of this patch during work time. Good thing we are starting a project in a partnership with a Japanese Foundation and eventual will need unicode in BGE :) for more details on that - www.nereusprogram.org - let's call it the main sponsor of this "bug feature" ;)
2010-12-16 10:25:41 +00:00
|
|
|
void RenderFonts(KX_Scene* scene);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
KX_KetsjiEngine(class KX_ISystem* system);
|
|
|
|
virtual ~KX_KetsjiEngine();
|
|
|
|
|
|
|
|
// set the devices and stuff. the client must take care of creating these
|
2008-11-26 17:38:54 +00:00
|
|
|
void SetWorldSettings(KX_WorldInfo* worldinfo);
|
2002-10-12 11:37:38 +00:00
|
|
|
void SetKeyboardDevice(SCA_IInputDevice* keyboarddevice);
|
|
|
|
void SetMouseDevice(SCA_IInputDevice* mousedevice);
|
|
|
|
void SetNetworkDevice(NG_NetworkDeviceInterface* networkdevice);
|
|
|
|
void SetCanvas(RAS_ICanvas* canvas);
|
|
|
|
void SetRenderTools(RAS_IRenderTools* rendertools);
|
|
|
|
void SetRasterizer(RAS_IRasterizer* rasterizer);
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2012-09-16 04:58:18 +00:00
|
|
|
void SetPyNamespace(PyObject *pythondictionary);
|
2012-03-08 03:05:57 +00:00
|
|
|
PyObject* GetPyNamespace() { return m_pythondictionary; }
|
2013-03-19 04:51:37 +00:00
|
|
|
PyObject* GetPyProfileDict();
|
2009-09-29 21:42:40 +00:00
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
void SetSceneConverter(KX_ISceneConverter* sceneconverter);
|
2010-02-22 12:25:58 +00:00
|
|
|
void SetAnimRecordMode(bool animation_record, int startFrame);
|
2005-08-23 13:16:02 +00:00
|
|
|
|
2012-03-08 03:05:57 +00:00
|
|
|
RAS_IRasterizer* GetRasterizer() { return m_rasterizer; }
|
|
|
|
RAS_ICanvas* GetCanvas() { return m_canvas; }
|
|
|
|
RAS_IRenderTools* GetRenderTools() { return m_rendertools; }
|
|
|
|
SCA_IInputDevice* GetKeyboardDevice() { return m_keyboarddevice; }
|
|
|
|
SCA_IInputDevice* GetMouseDevice() { return m_mousedevice; }
|
2007-10-22 20:24:26 +00:00
|
|
|
|
2009-04-08 15:06:20 +00:00
|
|
|
/// Dome functions
|
2009-05-17 20:37:13 +00:00
|
|
|
void InitDome(short res, short mode, short angle, float resbuf, short tilt, struct Text* text);
|
2009-04-08 15:06:20 +00:00
|
|
|
void EndDome();
|
|
|
|
void RenderDome();
|
|
|
|
bool m_usedome;
|
|
|
|
|
2006-12-02 22:25:47 +00:00
|
|
|
///returns true if an update happened to indicate -> Render
|
|
|
|
bool NextFrame();
|
2002-10-12 11:37:38 +00:00
|
|
|
void Render();
|
|
|
|
|
2006-11-30 00:19:27 +00:00
|
|
|
void StartEngine(bool clearIpo);
|
2002-10-12 11:37:38 +00:00
|
|
|
void StopEngine();
|
|
|
|
void Export(const STR_String& filename);
|
|
|
|
|
|
|
|
void RequestExit(int exitrequestmode);
|
|
|
|
void SetNameNextGame(const STR_String& nextgame);
|
|
|
|
int GetExitCode();
|
|
|
|
const STR_String& GetExitString();
|
|
|
|
|
|
|
|
KX_SceneList* CurrentScenes();
|
|
|
|
KX_Scene* FindScene(const STR_String& scenename);
|
|
|
|
void AddScene(class KX_Scene* scene);
|
|
|
|
void ConvertAndAddScene(const STR_String& scenename,bool overlay);
|
|
|
|
|
|
|
|
void RemoveScene(const STR_String& scenename);
|
|
|
|
void ReplaceScene(const STR_String& oldscene,const STR_String& newscene);
|
|
|
|
void SuspendScene(const STR_String& scenename);
|
|
|
|
void ResumeScene(const STR_String& scenename);
|
|
|
|
|
2008-09-18 01:46:28 +00:00
|
|
|
void GetSceneViewport(KX_Scene* scene, KX_Camera* cam, RAS_Rect& area, RAS_Rect& viewport);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
void SetDrawType(int drawingtype);
|
2012-03-08 03:05:57 +00:00
|
|
|
int GetDrawType() { return m_drawingmode; }
|
2009-04-08 15:06:20 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
void SetCameraZoom(float camzoom);
|
|
|
|
|
|
|
|
void EnableCameraOverride(const STR_String& forscene);
|
|
|
|
|
|
|
|
void SetCameraOverrideUseOrtho(bool useOrtho);
|
|
|
|
void SetCameraOverrideProjectionMatrix(const MT_CmMatrix4x4& mat);
|
|
|
|
void SetCameraOverrideViewMatrix(const MT_CmMatrix4x4& mat);
|
2008-09-15 00:11:30 +00:00
|
|
|
void SetCameraOverrideClipping(float near, float far);
|
2009-06-09 22:56:43 +00:00
|
|
|
void SetCameraOverrideLens(float lens);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets display of all frames.
|
2012-03-02 16:05:54 +00:00
|
|
|
* \param bUseFixedTime New setting for display all frames.
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
void SetUseFixedTime(bool bUseFixedTime);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns display of all frames.
|
2012-03-02 16:05:54 +00:00
|
|
|
* \return Current setting for display all frames.
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
bool GetUseFixedTime(void) const;
|
2005-12-18 19:10:26 +00:00
|
|
|
|
2008-10-31 21:06:48 +00:00
|
|
|
/**
|
|
|
|
* Returns current render frame clock time
|
|
|
|
*/
|
|
|
|
double GetClockTime(void) const;
|
2009-09-24 21:22:24 +00:00
|
|
|
/**
|
|
|
|
* Returns current logic frame clock time
|
|
|
|
*/
|
|
|
|
double GetFrameTime(void) const;
|
2008-10-31 21:06:48 +00:00
|
|
|
|
2009-05-23 14:40:36 +00:00
|
|
|
double GetRealTime(void) const;
|
2005-12-18 19:10:26 +00:00
|
|
|
/**
|
|
|
|
* Returns the difference between the local time of the scene (when it
|
|
|
|
* was running and not suspended) and the "curtime"
|
|
|
|
*/
|
|
|
|
static double GetSuspendedDelta();
|
|
|
|
|
2004-10-16 11:41:50 +00:00
|
|
|
/**
|
|
|
|
* Gets the number of logic updates per second.
|
|
|
|
*/
|
|
|
|
static double GetTicRate();
|
|
|
|
/**
|
|
|
|
* Sets the number of logic updates per second.
|
|
|
|
*/
|
|
|
|
static void SetTicRate(double ticrate);
|
2009-05-01 16:35:06 +00:00
|
|
|
/**
|
|
|
|
* Gets the maximum number of logic frame before render frame
|
|
|
|
*/
|
2009-05-01 20:34:23 +00:00
|
|
|
static int GetMaxLogicFrame();
|
2009-05-01 16:35:06 +00:00
|
|
|
/**
|
|
|
|
* Sets the maximum number of logic frame before render frame
|
|
|
|
*/
|
2009-05-01 20:34:23 +00:00
|
|
|
static void SetMaxLogicFrame(int frame);
|
2009-05-21 18:10:19 +00:00
|
|
|
/**
|
|
|
|
* 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);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-08-12 20:53:29 +00:00
|
|
|
/**
|
|
|
|
* Gets whether or not to lock animation updates to the animframerate
|
|
|
|
*/
|
|
|
|
static bool GetRestrictAnimationFPS();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether or not to lock animation updates to the animframerate
|
|
|
|
*/
|
|
|
|
static void SetRestrictAnimationFPS(bool bRestrictAnimFPS);
|
|
|
|
|
2008-06-17 10:06:38 +00:00
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
/**
|
|
|
|
* Gets the last estimated average framerate
|
|
|
|
*/
|
|
|
|
static double GetAverageFrameRate();
|
|
|
|
|
Cucumber, first batch of merge - UI changes and custom exit key
---------------------------------------------------------------
This was a test drive to see how painful the merge will be.
Next batches are:
- use desktop option for fullscreen
- multisampling option
- bullet collision mask
- python
- storage (vbo, dl, ...)
- lighting
[lighting still needs review]
[python could use review, although it should be straightforward]
[storage should be tested more I think]
Merged /branches/soc-2011-cucumber:r
36991,37059,37157,37416,37497-37499,37501,37522,39036,40593
36991:
==UI==
* Made some options available in Blender Game that were only available in Blender Render (camera resolution, animation fps)
* Created a panel for the embedded player
* Renamed the FPS option for the standalone player to Refresh Rate
* Moved framing options to display
* Made a button to launch the blender player from within blender (only tested on windows for now)
37059:
==UI==
* Added the option to change the exit key for the BGE. The UI currently just sets a number, and this feature most likely does not work for blenderplayer yet. More work on this to come.
* Removed the physics settings from the scene panel for the BGE.
* Added an Add menu in the logic brick header.
37157:
Making the bake options available in Blender Game
37416:
Making the exit key UI element accept key presses instead of numbers. It still does not work for the Blenderplayer, and it does not limit the input to key presses (other events don't work for exiting)
37497:
Some more work on getting the exit key to work in the Blenderplayer.
Input is now restricted to keyboard events only for the exit key UI.
37498:
Some clean up from the last commit.
The exit key setting affects the Blenderplayer now.
37499:
Cleaning up some duplicate code. Now the reverseTranslateTable for converting blender key codes to ketsji key codes is only defined in BL_BlenderDataConverter.
37501:
Centralizing the exit key methods to the keyboard devices. This should make it easier to get exit key control to the python API.
[37517: committed previously]
37522:
Moved control of the exit key away from the keyboard devices, and moved it to ketsjiengine.
Added setExitKey and getExitKey to the python API
39036:
A couple of the doversions were in the wrong spot. This should fix some issues with the exit key not being set.
[not committed entirely, see below]]
40552: space_logic.py (* fixed an error in space_logic.py *)
40593:
launch blenderplayer from ui not working in OSX fix - by Daniel Stokes and me
########################################################
code left behind (to be included in next commit):
########################################################
{
/* Initialize default values for collision masks */
Object *ob;
for(ob=main->object.first; ob; ob=ob->id.next)
ob->col_group = ob->col_mask = 1;
}
2011-12-20 03:11:56 +00:00
|
|
|
static void SetExitKey(short key);
|
|
|
|
|
|
|
|
static short GetExitKey();
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/**
|
|
|
|
* Activates or deactivates timing information display.
|
2012-03-02 16:05:54 +00:00
|
|
|
* \param frameRate Display for frame rate on or off.
|
|
|
|
* \param profile Display for individual components on or off.
|
|
|
|
* \param properties Display of scene object debug properties on or off.
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
void SetTimingDisplay(bool frameRate, bool profile, bool properties);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns status of timing information display.
|
2012-03-02 16:05:54 +00:00
|
|
|
* \param frameRate Display for frame rate on or off.
|
|
|
|
* \param profile Display for individual components on or off.
|
|
|
|
* \param properties Display of scene object debug properties on or off.
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
void GetTimingDisplay(bool& frameRate, bool& profile, bool& properties) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets cursor hiding on every frame.
|
2012-03-02 16:05:54 +00:00
|
|
|
* \param hideCursor Turns hiding on or off.
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
void SetHideCursor(bool hideCursor);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current setting for cursor hiding.
|
2012-03-02 16:05:54 +00:00
|
|
|
* \return The current setting for cursor hiding.
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
bool GetHideCursor(void) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables/disables the use of the framing bar color of the Blender file's scenes.
|
2012-03-02 16:05:54 +00:00
|
|
|
* \param overrideFrameColor The new setting.
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
void SetUseOverrideFrameColor(bool overrideFrameColor);
|
|
|
|
|
|
|
|
/**
|
2011-11-05 01:48:10 +00:00
|
|
|
* Check if the frame color is being overridden.
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
bool GetUseOverrideFrameColor(void) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the color used for framing bar color instead of the one in the Blender file's scenes.
|
2012-03-02 16:05:54 +00:00
|
|
|
* \param r Red component of the override color.
|
|
|
|
* \param g Green component of the override color.
|
|
|
|
* \param b Blue component of the override color.
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
void SetOverrideFrameColor(float r, float g, float b);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the color used for framing bar color instead of the one in the Blender file's scenes.
|
2012-03-02 16:05:54 +00:00
|
|
|
* \param r Red component of the override color.
|
|
|
|
* \param g Green component of the override color.
|
|
|
|
* \param b Blue component of the override color.
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
void GetOverrideFrameColor(float& r, float& g, float& b) const;
|
2009-11-15 23:58:56 +00:00
|
|
|
|
|
|
|
KX_Scene* CreateScene(const STR_String& scenename);
|
2012-12-18 20:56:25 +00:00
|
|
|
KX_Scene* CreateScene(Scene *scene, bool libloading=false);
|
2011-09-11 05:54:07 +00:00
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
GlobalSettings* GetGlobalSettings(void);
|
2011-09-11 05:54:07 +00:00
|
|
|
void SetGlobalSettings(GlobalSettings* gs);
|
|
|
|
|
2013-04-12 01:52:30 +00:00
|
|
|
/**
|
|
|
|
* Invalidate all the camera matrices and handle other
|
|
|
|
* needed changes when resized.
|
|
|
|
* It's only called from Blenderplayer.
|
|
|
|
*/
|
|
|
|
void Resize();
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Processes all scheduled scene activity.
|
|
|
|
* At the end, if the scene lists have changed,
|
|
|
|
* SceneListsChanged(void) is called.
|
2012-03-02 16:05:54 +00:00
|
|
|
* \see SceneListsChanged(void).
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
void ProcessScheduledScenes(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is invoked when the scene lists have changed.
|
|
|
|
*/
|
|
|
|
void SceneListsChanged(void);
|
|
|
|
|
|
|
|
void RemoveScheduledScenes(void);
|
|
|
|
void AddScheduledScenes(void);
|
|
|
|
void ReplaceScheduledScenes(void);
|
|
|
|
void PostProcessScene(class KX_Scene* scene);
|
|
|
|
|
|
|
|
bool BeginFrame();
|
2008-09-14 00:32:18 +00:00
|
|
|
void ClearFrame();
|
2002-10-12 11:37:38 +00:00
|
|
|
void EndFrame();
|
2009-08-18 15:37:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_CXX_GUARDEDALLOC
|
2012-06-25 09:14:37 +00:00
|
|
|
MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_KetsjiEngine")
|
2009-08-18 15:37:31 +00:00
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
};
|
|
|
|
|
2012-10-09 13:36:42 +00:00
|
|
|
#endif /* __KX_KETSJIENGINE_H__ */
|