diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-05-26 15:56:36 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-05-26 15:56:36 +0300 |
commit | 322380999ed91179ebce511c7b14e470b48bf993 (patch) | |
tree | c13a97f18bf388f0f4a2ad3f423764742b3f5bb9 /source/gameengine | |
parent | 650fdcd74fecc14cdfdc0b2e17317f31807b6a40 (diff) | |
parent | a23fbc71a1886e9f83fd1d6782050d5a8c356d13 (diff) |
Merge branch 'master' into gooseberry
Conflicts:
source/blender/editors/object/object_ops.c
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_BlenderMaterial.cpp | 93 |
3 files changed, 42 insertions, 59 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 2f62ffdd698..3fc0215fe18 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1065,8 +1065,8 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, else ma = mesh->mat ? mesh->mat[mface->mat_nr]:NULL; - /* ckeck for texface since texface _only_ is used as a fallback */ - if (ma == NULL && tface == NULL) { + // Check for blender material + if (ma == NULL) { ma= &defmaterial; } diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 67ea65a5e81..6d97447dff0 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -74,6 +74,7 @@ extern "C" #include "BKE_report.h" #include "BKE_library.h" #include "BKE_modifier.h" +#include "BKE_material.h" #include "BKE_text.h" #include "BKE_sound.h" @@ -522,6 +523,9 @@ int main(int argc, char** argv) BKE_sound_init_once(); + // Initialize a default material for meshes without materials. + init_def_material(); + BKE_library_callback_free_window_manager_set(wm_free); /* if running blenderplayer the last argument can't be parsed since it has to be the filename. else it is bundled */ diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index 8e534ee1821..7ec2673bf1f 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -96,20 +96,18 @@ void KX_BlenderMaterial::Initialize( ); Material *ma = data->material; - if (ma) { - // Save material data to restore on exit - mSavedData.r = ma->r; - mSavedData.g = ma->g; - mSavedData.b = ma->b; - mSavedData.a = ma->alpha; - mSavedData.specr = ma->specr; - mSavedData.specg = ma->specg; - mSavedData.specb = ma->specb; - mSavedData.spec = ma->spec; - mSavedData.ref = ma->ref; - mSavedData.hardness = ma->har; - mSavedData.emit = ma->emit; - } + // Save material data to restore on exit + mSavedData.r = ma->r; + mSavedData.g = ma->g; + mSavedData.b = ma->b; + mSavedData.a = ma->alpha; + mSavedData.specr = ma->specr; + mSavedData.specg = ma->specg; + mSavedData.specb = ma->specb; + mSavedData.spec = ma->spec; + mSavedData.ref = ma->ref; + mSavedData.hardness = ma->har; + mSavedData.emit = ma->emit; mMaterial = data; mShader = 0; @@ -142,21 +140,18 @@ void KX_BlenderMaterial::Initialize( KX_BlenderMaterial::~KX_BlenderMaterial() { Material *ma = mMaterial->material; - - if (ma) { - // Restore Blender material data - ma->r = mSavedData.r; - ma->g = mSavedData.g; - ma->b = mSavedData.b; - ma->alpha = mSavedData.a; - ma->specr = mSavedData.specr; - ma->specg = mSavedData.specg; - ma->specb = mSavedData.specb; - ma->spec = mSavedData.spec; - ma->ref = mSavedData.ref; - ma->har = mSavedData.hardness; - ma->emit = mSavedData.emit; - } + // Restore Blender material data + ma->r = mSavedData.r; + ma->g = mSavedData.g; + ma->b = mSavedData.b; + ma->alpha = mSavedData.a; + ma->specr = mSavedData.specr; + ma->specg = mSavedData.specg; + ma->specb = mSavedData.specb; + ma->spec = mSavedData.spec; + ma->ref = mSavedData.ref; + ma->har = mSavedData.hardness; + ma->emit = mSavedData.emit; // cleanup work if (mConstructed) @@ -828,34 +823,18 @@ void KX_BlenderMaterial::UpdateIPO( { // only works one deep now - // Multitexture Input - mMaterial->speccolor[0] = (float)(specrgb)[0]; - mMaterial->speccolor[1] = (float)(specrgb)[1]; - mMaterial->speccolor[2] = (float)(specrgb)[2]; - mMaterial->matcolor[0] = (float)(rgba[0]); - mMaterial->matcolor[1] = (float)(rgba[1]); - mMaterial->matcolor[2] = (float)(rgba[2]); - mMaterial->alpha = (float)(rgba[3]); - mMaterial->hard = (float)(hard); - mMaterial->emit = (float)(emit); - mMaterial->spec_f = (float)(spec); - mMaterial->ref = (float)(ref); - - Material *ma = mMaterial->material; - if (ma) { - // GLSL Input - ma->specr = (float)(specrgb)[0]; - ma->specg = (float)(specrgb)[1]; - ma->specb = (float)(specrgb)[2]; - ma->r = (float)(rgba[0]); - ma->g = (float)(rgba[1]); - ma->b = (float)(rgba[2]); - ma->alpha = (float)(rgba[3]); - ma->har = (float)(hard); - ma->emit = (float)(emit); - ma->spec = (float)(spec); - ma->ref = (float)(ref); - } + // GLSL Multitexture Input + mMaterial->material->specr = mMaterial->speccolor[0] = (float)(specrgb)[0]; + mMaterial->material->specg = mMaterial->speccolor[1] = (float)(specrgb)[1]; + mMaterial->material->specb = mMaterial->speccolor[2] = (float)(specrgb)[2]; + mMaterial->material->r = mMaterial->matcolor[0] = (float)(rgba[0]); + mMaterial->material->g = mMaterial->matcolor[1] = (float)(rgba[1]); + mMaterial->material->b = mMaterial->matcolor[2] = (float)(rgba[2]); + mMaterial->material->alpha = mMaterial->alpha = (float)(rgba[3]); + mMaterial->material->har = mMaterial->hard = (float)(hard); + mMaterial->material->emit = mMaterial->emit = (float)(emit); + mMaterial->material->spec = mMaterial->spec_f = (float)(spec); + mMaterial->material->ref = mMaterial->ref = (float)(ref); } void KX_BlenderMaterial::Replace_IScene(SCA_IScene *val) |