diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-06-14 01:24:21 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-06-14 01:24:21 +0400 |
commit | 6d62a18a51303da845df1c04cd2b357853b7e7ed (patch) | |
tree | dbe5455cf7d57f719b58615c1c40c6a8f2903439 /source/gameengine/Converter | |
parent | 9fb4cbc668ad7fc612cbb63206567066e2626173 (diff) |
Apricot Branch: GLSL
====================
* Added support for lamps and shaders. All material diffuse and
specular shaders are supported, for lamps especially area light
support is not there yet.
* Added support for these GLSL shaders in the game engine, though
it is incomplete and somewhat of a hack. Specifically all the
variables are completely static, which means moving lights, or
animating material properties will not work.
* Enabling GLSL shaders is now different. They work in textured
drawmode, and can be enabled in the Game menu with the option
"Blender GLSL Materials"
Known issues:
* The GLSL shaders don't always update correct on light changes.
* The game player appears to crash with these GLSL shaders, while
regular blender works fine.
Diffstat (limited to 'source/gameengine/Converter')
4 files changed, 21 insertions, 3 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 82d16ffa181..1be462c113f 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -509,6 +509,7 @@ BL_Material* ConvertMaterial( } } } + // above one tex the switches here // are not used switch(valid_index) { @@ -829,7 +830,6 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools* } } - meshobj->SetName(mesh->id.name); meshobj->m_xyz_index_to_vertex_index_mapping.resize(mesh->totvert); for (int f=0;f<mesh->totface;f++,mface++) @@ -891,6 +891,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools* ma = give_current_material(blenderobj, 1); bl_mat = ConvertMaterial(mesh, ma, tface, mface, mmcol, lightlayer, blenderobj, layers); + bl_mat->glslmat = converter->GetGLSLMaterials(); // set the index were dealing with bl_mat->material_index = (int)mface->mat_nr; diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 8640e69102b..de91bce2ab1 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -100,7 +100,8 @@ KX_BlenderSceneConverter::KX_BlenderSceneConverter( m_sipo(sipo), m_ketsjiEngine(engine), m_alwaysUseExpandFraming(false), - m_usemat(false) + m_usemat(false), + m_useglslmat(false) { m_newfilename = ""; } @@ -449,6 +450,13 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene) void KX_BlenderSceneConverter::SetMaterials(bool val) { m_usemat = val; + m_useglslmat = false; +} + +void KX_BlenderSceneConverter::SetGLSLMaterials(bool val) +{ + m_usemat = val; + m_useglslmat = val; } bool KX_BlenderSceneConverter::GetMaterials() @@ -456,6 +464,10 @@ bool KX_BlenderSceneConverter::GetMaterials() return m_usemat; } +bool KX_BlenderSceneConverter::GetGLSLMaterials() +{ + return m_useglslmat; +} void KX_BlenderSceneConverter::RegisterBlenderMaterial(BL_Material *mat) { diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h index a45d7396875..e5d6ccc5caf 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.h +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h @@ -75,6 +75,7 @@ class KX_BlenderSceneConverter : public KX_ISceneConverter class KX_Scene* m_currentScene; // Scene being converted bool m_alwaysUseExpandFraming; bool m_usemat; + bool m_useglslmat; void localDel_ipoCurve ( IpoCurve * icu ,struct SpaceIpo* sipo); // struct Ipo* findIpoForName(char* objName); @@ -146,6 +147,10 @@ public: virtual void SetMaterials(bool val); virtual bool GetMaterials(); + // use blender glsl materials + virtual void SetGLSLMaterials(bool val); + virtual bool GetGLSLMaterials(); + }; #endif //__KX_BLENDERSCENECONVERTER_H diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript index f5e382b471e..3be352c568b 100644 --- a/source/gameengine/Converter/SConscript +++ b/source/gameengine/Converter/SConscript @@ -16,7 +16,7 @@ incs += ' #source/gameengine/Expressions #source/gameengine/Network #source/game incs += ' #source/gameengine/Physics/common #source/gameengine/Physics/Bullet #source/gameengine/Physics/BlOde' incs += ' #source/gameengine/Physics/Dummy #source/gameengine/Physics/Sumo' incs += ' #source/gameengine/Physics/Sumo/Fuzzics/include #source/gameengine/Network/LoopBackNetwork' -incs += ' #source/blender/misc #source/blender/blenloader' +incs += ' #source/blender/misc #source/blender/blenloader #source/blender/gpu' incs += ' ' + env['BF_PYTHON_INC'] incs += ' ' + env['BF_SOLID_INC'] |