[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15606] branches/apricot/source: Apricot: GLSL
Brecht Van Lommel
brechtvanlommel at pandora.be
Wed Jul 16 18:20:52 CEST 2008
Revision: 15606
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15606
Author: blendix
Date: 2008-07-16 18:20:52 +0200 (Wed, 16 Jul 2008)
Log Message:
-----------
Apricot: GLSL
=============
* Moved GLSL setting switching functions into the game engine
python API so they work in the blender player, and can do
better state switching.
* Also fixes bug #17331, error compiling with cmake.
* For the makers of test builds: it would be great if builds of
this revision or newer for various platforms could be made
available. We want to release a file to test and benchmark
GLSL on different graphics cards, and we need test builds for
this. Thanks!
Modified Paths:
--------------
branches/apricot/source/blender/python/SConscript
branches/apricot/source/blender/python/api2_2x/Blender.c
branches/apricot/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
branches/apricot/source/gameengine/GamePlayer/ActiveX/BlenderPlayerCtl.cpp
branches/apricot/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
branches/apricot/source/gameengine/GamePlayer/netscape/src/ketsji/KXH_ketsji_hooks.cpp
branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp
branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.h
branches/apricot/source/gameengine/Ketsji/KX_PythonInit.cpp
branches/apricot/source/gameengine/Ketsji/KX_PythonInit.h
branches/apricot/source/gameengine/PyDoc/Rasterizer.py
Modified: branches/apricot/source/blender/python/SConscript
===================================================================
--- branches/apricot/source/blender/python/SConscript 2008-07-16 15:44:47 UTC (rev 15605)
+++ branches/apricot/source/blender/python/SConscript 2008-07-16 16:20:52 UTC (rev 15606)
@@ -6,7 +6,7 @@
incs = 'api2_2x ../blenkernel ../nodes ../blenlib ../blenloader'
incs += ' ../render/extern/include ../radiosity/extern/include'
incs += ' ../makesdna #intern/guardedalloc #intern/bmfont ../imbuf ../include'
-incs += ' #extern/glew/include ../gpu'
+incs += ' #extern/glew/include'
incs += ' ' + env['BF_PYTHON_INC']
incs += ' ' + env['BF_OPENGL_INC']
Modified: branches/apricot/source/blender/python/api2_2x/Blender.c
===================================================================
--- branches/apricot/source/blender/python/api2_2x/Blender.c 2008-07-16 15:44:47 UTC (rev 15605)
+++ branches/apricot/source/blender/python/api2_2x/Blender.c 2008-07-16 16:20:52 UTC (rev 15606)
@@ -56,7 +56,6 @@
#include "DNA_screen_types.h" /* for SPACE_VIEW3D */
#include "DNA_userdef_types.h"
#include "DNA_packedFile_types.h"
-#include "GPU_material.h"
#include "EXPP_interface.h" /* for bpy_gethome() */
#include "gen_utils.h"
#include "modules.h"
@@ -316,41 +315,7 @@
U.gameflags |= USER_DISABLE_MIPMAP;
set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
- }
- else if(StringEqual( name, "glsl_lights" ) ||
- StringEqual( name, "glsl_shaders" ) ||
- StringEqual( name, "glsl_shadows" ) ||
- StringEqual( name, "glsl_ramps" ) ||
- StringEqual( name, "glsl_nodes" ) ||
- StringEqual( name, "glsl_extra_textures" )) {
-
- int value = PyObject_IsTrue( arg );
- int flag = 0;
-
- if (value==-1)
- return EXPP_ReturnPyObjError( PyExc_ValueError,
- "expected an integer" );
-
- if(StringEqual( name, "glsl_lights" ))
- flag = G_FILE_GLSL_NO_LIGHTS;
- else if(StringEqual( name, "glsl_shaders" ))
- flag = G_FILE_GLSL_NO_SHADERS;
- else if(StringEqual( name, "glsl_shadows" ))
- flag = G_FILE_GLSL_NO_SHADOWS;
- else if(StringEqual( name, "glsl_ramps" ))
- flag = G_FILE_GLSL_NO_RAMPS;
- else if(StringEqual( name, "glsl_nodes" ))
- flag = G_FILE_GLSL_NO_NODES;
- else if(StringEqual( name, "glsl_extra_textures" ))
- flag = G_FILE_GLSL_NO_EXTRA_TEX;
-
- if (value)
- G.fileflags &= ~flag;
- else
- G.fileflags |= flag;
-
- GPU_materials_free();
- }else
+ } else
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"value given is not a blender setting" ) );
Py_RETURN_NONE;
@@ -597,18 +562,6 @@
ret = PyInt_FromLong( (U.flag & USER_FILECOMPRESS) >> 15 );
else if(StringEqual( str, "mipmap" ))
ret = PyInt_FromLong( (U.gameflags & USER_DISABLE_MIPMAP)!=0 );
- else if(StringEqual( str, "glsl_lights" ))
- ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_LIGHTS)==0 );
- else if(StringEqual( str, "glsl_shaders" ))
- ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_SHADERS)==0 );
- else if(StringEqual( str, "glsl_shadows" ))
- ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_SHADOWS)==0 );
- else if(StringEqual( str, "glsl_ramps" ))
- ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_RAMPS)==0 );
- else if(StringEqual( str, "glsl_nodes" ))
- ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_NODES)==0 );
- else if(StringEqual( str, "glsl_extra_textures" ))
- ret = PyInt_FromLong( (G.fileflags & G_FILE_GLSL_NO_EXTRA_TEX)==0 );
else if(StringEqual( str, "add_view_align" ))
ret = PyInt_FromLong( ((U.flag & USER_ADD_VIEWALIGNED)!=0) );
else if(StringEqual( str, "add_editmode" ))
Modified: branches/apricot/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
===================================================================
--- branches/apricot/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 2008-07-16 15:44:47 UTC (rev 15605)
+++ branches/apricot/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 2008-07-16 16:20:52 UTC (rev 15606)
@@ -336,7 +336,7 @@
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest);
ketsjiengine->SetPythonDictionary(dictionaryobject);
initRasterizer(rasterizer, canvas);
- PyObject *gameLogic = initGameLogic(startscene);
+ PyObject *gameLogic = initGameLogic(ketsjiengine, startscene);
PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module.
initGameKeys();
initPythonConstraintBinding();
@@ -603,7 +603,7 @@
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest);
ketsjiengine->SetPythonDictionary(dictionaryobject);
initRasterizer(rasterizer, canvas);
- PyObject *gameLogic = initGameLogic(startscene);
+ PyObject *gameLogic = initGameLogic(ketsjiengine, startscene);
PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module
initGameKeys();
initPythonConstraintBinding();
Modified: branches/apricot/source/gameengine/GamePlayer/ActiveX/BlenderPlayerCtl.cpp
===================================================================
--- branches/apricot/source/gameengine/GamePlayer/ActiveX/BlenderPlayerCtl.cpp 2008-07-16 15:44:47 UTC (rev 15605)
+++ branches/apricot/source/gameengine/GamePlayer/ActiveX/BlenderPlayerCtl.cpp 2008-07-16 16:20:52 UTC (rev 15606)
@@ -668,7 +668,7 @@
m_ketsjiengine->SetPythonDictionary(m_dictionaryobject);
initRasterizer(m_rasterizer, m_canvas);
- PyDict_SetItemString(m_dictionaryobject, "GameLogic", initGameLogic(startscene)); // Same as importing the module
+ PyDict_SetItemString(m_dictionaryobject, "GameLogic", initGameLogic(m_ketsjiengine, startscene)); // Same as importing the module
initGameKeys();
initPythonConstraintBinding();
Modified: branches/apricot/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
===================================================================
--- branches/apricot/source/gameengine/GamePlayer/ghost/GPG_Application.cpp 2008-07-16 15:44:47 UTC (rev 15605)
+++ branches/apricot/source/gameengine/GamePlayer/ghost/GPG_Application.cpp 2008-07-16 16:20:52 UTC (rev 15606)
@@ -651,7 +651,7 @@
PyObject* dictionaryobject = initGamePlayerPythonScripting("Ketsji", psl_Lowest);
m_ketsjiengine->SetPythonDictionary(dictionaryobject);
initRasterizer(m_rasterizer, m_canvas);
- PyDict_SetItemString(dictionaryobject, "GameLogic", initGameLogic(startscene)); // Same as importing the module
+ PyDict_SetItemString(dictionaryobject, "GameLogic", initGameLogic(m_ketsjiengine, startscene)); // Same as importing the module
initGameKeys();
initPythonConstraintBinding();
Modified: branches/apricot/source/gameengine/GamePlayer/netscape/src/ketsji/KXH_ketsji_hooks.cpp
===================================================================
--- branches/apricot/source/gameengine/GamePlayer/netscape/src/ketsji/KXH_ketsji_hooks.cpp 2008-07-16 15:44:47 UTC (rev 15605)
+++ branches/apricot/source/gameengine/GamePlayer/netscape/src/ketsji/KXH_ketsji_hooks.cpp 2008-07-16 16:20:52 UTC (rev 15606)
@@ -567,7 +567,7 @@
startSceneName->Ptr());
initRasterizer(k->rasterizer, k->canvas_device);;
- PyDict_SetItemString(dictionaryobject, "GameLogic", initGameLogic(startscene)); // Same as importing the module
+ PyDict_SetItemString(dictionaryobject, "GameLogic", initGameLogic(k->kx_engine, startscene)); // Same as importing the module
initGameKeys();
initPythonConstraintBinding();
Modified: branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp
===================================================================
--- branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp 2008-07-16 15:44:47 UTC (rev 15605)
+++ branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp 2008-07-16 16:20:52 UTC (rev 15606)
@@ -29,8 +29,10 @@
return (Scene*)G.main->scene.first;
}
-const bool BL_BlenderShader::Ok()const
+bool BL_BlenderShader::Ok()
{
+ VerifyShader();
+
return (mMat && mMat->gpumaterial);
}
@@ -61,15 +63,7 @@
if(mMat && !mMat->gpumaterial)
GPU_material_from_blender(mBlenderScene, mMat);
- if(mMat && mMat->gpumaterial != mGPUMat) {
- mGPUMat = mMat->gpumaterial;
-
- /* this is shaky - display lists are wrong now after the
- * material changed, so we set all meshes as modified to
- * rebuild their display lists */
- if(mScene->GetBucketManager())
- mScene->GetBucketManager()->ReleaseDisplayLists();
- }
+ mGPUMat = mMat->gpumaterial;
return (mMat && mGPUMat);
}
Modified: branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.h
===================================================================
--- branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.h 2008-07-16 15:44:47 UTC (rev 15605)
+++ branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.h 2008-07-16 16:20:52 UTC (rev 15606)
@@ -40,7 +40,7 @@
BL_BlenderShader(KX_Scene *scene, struct Material *ma, int lightlayer);
virtual ~BL_BlenderShader();
- const bool Ok()const;
+ bool Ok();
void SetProg(bool enable);
int GetAttribNum();
Modified: branches/apricot/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- branches/apricot/source/gameengine/Ketsji/KX_PythonInit.cpp 2008-07-16 15:44:47 UTC (rev 15605)
+++ branches/apricot/source/gameengine/Ketsji/KX_PythonInit.cpp 2008-07-16 16:20:52 UTC (rev 15606)
@@ -51,13 +51,13 @@
#include "BL_ActionActuator.h"
#include "RAS_IRasterizer.h"
#include "RAS_ICanvas.h"
+#include "RAS_BucketManager.h"
#include "MT_Vector3.h"
#include "MT_Point3.h"
#include "ListValue.h"
#include "KX_Scene.h"
#include "SND_DeviceManager.h"
-#include "RAS_OpenGLRasterizer/RAS_GLExtensionManager.h"
#include "BL_Shader.h"
#include "KX_PyMath.h"
@@ -73,6 +73,7 @@
#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BLI_blenlib.h"
+#include "GPU_material.h"
static void setSandbox(TPythonSecurityLevel level);
@@ -80,6 +81,7 @@
// 'local' copy of canvas ptr, for window height/width python scripts
static RAS_ICanvas* gp_Canvas = NULL;
static KX_Scene* gp_KetsjiScene = NULL;
+static KX_KetsjiEngine* gp_KetsjiEngine = NULL;
static RAS_IRasterizer* gp_Rasterizer = NULL;
void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)
@@ -671,6 +673,76 @@
Py_Return;
}
+int getGLSLSettingFlag(char *setting)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list