From 368262461641f23239c1a7bd2e6fa9d5057902e7 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 18 Aug 2009 15:27:48 +0000 Subject: 2.5: Game Engine * Added Shading and Performance panels in the scene buttons, containing the options previously in the 2.4x game menu. * Added show framerate/debug/physics/warnings back in game menu. * Moved these settings from G.fileflags to scene GameData. * Enabled Display Lists by default. * Some other small game scene button tweaks. --- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 6 +-- .../GamePlayer/ghost/GPG_Application.cpp | 13 +++--- source/gameengine/Ketsji/KX_PythonInit.cpp | 46 +++++++++++----------- 3 files changed, 33 insertions(+), 32 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 4efdf04890e..ae46f880711 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -350,12 +350,12 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw if(GPU_extensions_minimum_support()) useglslmat = true; - else if(G.fileflags & G_FILE_GAME_MAT_GLSL) + else if(blscene->gm.matmode == GAME_MAT_GLSL) usemat = false; - if(usemat && (G.fileflags & G_FILE_GAME_MAT)) + if(usemat && (blscene->gm.matmode != GAME_MAT_TEXFACE)) sceneconverter->SetMaterials(true); - if(useglslmat && (G.fileflags & G_FILE_GAME_MAT_GLSL)) + if(useglslmat && (blscene->gm.matmode == GAME_MAT_GLSL)) sceneconverter->SetGLSLMaterials(true); KX_Scene* startscene = new KX_Scene(keyboarddevice, diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 4c824a8df40..c9a2e81bdae 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -524,16 +524,17 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) // SYS_WriteCommandLineInt(syshandle, "fixedtime", 0); // SYS_WriteCommandLineInt(syshandle, "vertexarrays",1); + GameData *gm= &m_startScene->gm; bool properties = (SYS_GetCommandLineInt(syshandle, "show_properties", 0) != 0); bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0); - bool fixedFr = (G.fileflags & G_FILE_ENABLE_ALL_FRAMES); + bool fixedFr = (gm->flag & GAME_ENABLE_ALL_FRAMES); - bool showPhysics = (G.fileflags & G_FILE_SHOW_PHYSICS); + bool showPhysics = (gm->flag & GAME_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 useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", G.fileflags & G_FILE_DISPLAY_LISTS) != 0); + bool useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", gm->flag & GAME_DISPLAY_LISTS) != 0); bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0); if(GLEW_ARB_multitexture && GLEW_VERSION_1_1) @@ -541,7 +542,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) if(GPU_extensions_minimum_support()) m_blenderglslmat = (SYS_GetCommandLineInt(syshandle, "blender_glsl_material", 1) != 0); - else if(G.fileflags & G_FILE_GAME_MAT_GLSL) + else if(gm->matmode == GAME_MAT_GLSL) m_blendermat = false; // create the canvas, rasterizer and rendertools @@ -671,9 +672,9 @@ bool GPG_Application::startEngine(void) // if (always_use_expand_framing) // sceneconverter->SetAlwaysUseExpandFraming(true); - if(m_blendermat && (G.fileflags & G_FILE_GAME_MAT)) + if(m_blendermat && (m_startScene->gm.matmode != GAME_MAT_TEXFACE)) m_sceneconverter->SetMaterials(true); - if(m_blenderglslmat && (G.fileflags & G_FILE_GAME_MAT_GLSL)) + if(m_blenderglslmat && (m_startScene->gm.matmode == GAME_MAT_GLSL)) m_sceneconverter->SetGLSLMaterials(true); KX_Scene* startscene = new KX_Scene(m_keyboard, diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 0eef33f927e..de3dcd0ebf8 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -92,6 +92,7 @@ extern "C" { /* we only need this to get a list of libraries from the main struct */ #include "DNA_ID.h" +#include "DNA_scene_types.h" #include "marshal.h" /* python header for loading/saving dicts */ @@ -206,8 +207,6 @@ static PyObject* gPySendMessage(PyObject*, PyObject* args) Py_RETURN_NONE; } -static bool usedsp = false; - // this gets a pointer to an array filled with floats static PyObject* gPyGetSpectrum(PyObject*) { @@ -769,17 +768,17 @@ static PyObject* gPyDisableMotionBlur(PyObject*) int getGLSLSettingFlag(char *setting) { if(strcmp(setting, "lights") == 0) - return G_FILE_GLSL_NO_LIGHTS; + return GAME_GLSL_NO_LIGHTS; else if(strcmp(setting, "shaders") == 0) - return G_FILE_GLSL_NO_SHADERS; + return GAME_GLSL_NO_SHADERS; else if(strcmp(setting, "shadows") == 0) - return G_FILE_GLSL_NO_SHADOWS; + return GAME_GLSL_NO_SHADOWS; else if(strcmp(setting, "ramps") == 0) - return G_FILE_GLSL_NO_RAMPS; + return GAME_GLSL_NO_RAMPS; else if(strcmp(setting, "nodes") == 0) - return G_FILE_GLSL_NO_NODES; + return GAME_GLSL_NO_NODES; else if(strcmp(setting, "extra_textures") == 0) - return G_FILE_GLSL_NO_EXTRA_TEX; + return GAME_GLSL_NO_EXTRA_TEX; else return -1; } @@ -788,8 +787,9 @@ static PyObject* gPySetGLSLMaterialSetting(PyObject*, PyObject* args, PyObject*) { + GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); char *setting; - int enable, flag, fileflags; + int enable, flag, sceneflag; if (!PyArg_ParseTuple(args,"si:setGLSLMaterialSetting",&setting,&enable)) return NULL; @@ -801,15 +801,15 @@ static PyObject* gPySetGLSLMaterialSetting(PyObject*, return NULL; } - fileflags = G.fileflags; + sceneflag= gm->flag; if (enable) - G.fileflags &= ~flag; + gm->flag &= ~flag; else - G.fileflags |= flag; + gm->flag |= flag; /* display lists and GLSL materials need to be remade */ - if(G.fileflags != fileflags) { + if(sceneflag != gm->flag) { GPU_materials_free(); if(gp_KetsjiEngine) { KX_SceneList *scenes = gp_KetsjiEngine->CurrentScenes(); @@ -830,6 +830,7 @@ static PyObject* gPyGetGLSLMaterialSetting(PyObject*, PyObject* args, PyObject*) { + GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); char *setting; int enabled = 0, flag; @@ -843,7 +844,7 @@ static PyObject* gPyGetGLSLMaterialSetting(PyObject*, return NULL; } - enabled = ((G.fileflags & flag) != 0); + enabled = ((gm->flag & flag) != 0); return PyLong_FromSsize_t(enabled); } @@ -855,35 +856,34 @@ static PyObject* gPySetMaterialType(PyObject*, PyObject* args, PyObject*) { - int flag, type; + GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); + int type; if (!PyArg_ParseTuple(args,"i:setMaterialType",&type)) return NULL; if(type == KX_BLENDER_GLSL_MATERIAL) - flag = G_FILE_GAME_MAT|G_FILE_GAME_MAT_GLSL; + gm->matmode= GAME_MAT_GLSL; else if(type == KX_BLENDER_MULTITEX_MATERIAL) - flag = G_FILE_GAME_MAT; + gm->matmode= GAME_MAT_MULTITEX; else if(type == KX_TEXFACE_MATERIAL) - flag = 0; + gm->matmode= GAME_MAT_TEXFACE; else { PyErr_SetString(PyExc_ValueError, "Rasterizer.setMaterialType(int): material type is not known"); return NULL; } - G.fileflags &= ~(G_FILE_GAME_MAT|G_FILE_GAME_MAT_GLSL); - G.fileflags |= flag; - Py_RETURN_NONE; } static PyObject* gPyGetMaterialType(PyObject*) { + GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); int flag; - if(G.fileflags & G_FILE_GAME_MAT_GLSL) + if(gm->matmode == GAME_MAT_GLSL) flag = KX_BLENDER_GLSL_MATERIAL; - else if(G.fileflags & G_FILE_GAME_MAT) + else if(gm->matmode == GAME_MAT_MULTITEX) flag = KX_BLENDER_MULTITEX_MATERIAL; else flag = KX_TEXFACE_MATERIAL; -- cgit v1.2.3