diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-04-09 16:54:13 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-04-10 15:49:49 +0400 |
commit | f93bc7693a530632455d3ec7acc4bce54a1f85bc (patch) | |
tree | d0e067438cbc547875b3cb77e53904c5ea2a537d /source/gameengine | |
parent | 19e627cab34a04a3d01b2e3a868b7bf91d56e8f9 (diff) |
Backport revisions for the 2.70a releasev2.70a
d2660a0, 6e99fb0, 58c22d8, 83f2012 + ff21f6a, a7ed1db. cc6b106
7997e38, 9d4b54b, efb48fc, 3fc293c, 29f359c, 77c1d17, 92a539e,
c626462, f48828b, 6452d9f, 765d077, 74518b2, af16d46, 8da4936,
6babbf5, f0106d2, f88776b, ee72cba, 467596d, e21a7b3, eed3974,
71a2ff1, ccf9afd, 44d6c68, 30fdfc3, b69809c, b0a8e4c, bd57ec6,
3b0832d, 2a25676, 3977b76, fb25a86, 9bbb30b, 51abc2b, 0ebade5,
2c0e32f, 3deaf7d, ea01b24, c61eb64, f3db038, a6fb670, eedde31,
b66a954, 7ff123c, f5b79df, 7148c97, 54a8753, fcaa018, 4c73001,
7a21330, 07578be, e9a64e2, fd3de8b, ae792e9, b7712a7 + 3600622,
d9557d0, 6d973b8, 688257d, 4acb57a, 95ac6bc,
Also backported openmp changes to sculpt making it so number
of real CPU cores is used as a number of threads here.
Diffstat (limited to 'source/gameengine')
5 files changed, 29 insertions, 23 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 0ec54412485..365bce34a60 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -938,11 +938,12 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace // this way only one KX_BlenderMaterial object has to exist per bucket bool bucketCreated; RAS_MaterialBucket* bucket = scene->FindBucket(polymat, bucketCreated); - if (bucketCreated) { - // this is needed to free up memory afterwards - converter->RegisterPolyMaterial(polymat); - converter->RegisterBlenderMaterial(bl_mat); - } + + // this is needed to free up memory afterwards. + // the converter will also prevent duplicates from being registered, + // so just register everything. + converter->RegisterPolyMaterial(polymat); + converter->RegisterBlenderMaterial(bl_mat); return bucket; } diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp index be85d89775f..75beb5d0e0e 100644 --- a/source/gameengine/Converter/BlenderWorldInfo.cpp +++ b/source/gameengine/Converter/BlenderWorldInfo.cpp @@ -61,6 +61,7 @@ #include "BLI_math.h" #include "BKE_global.h" +#include "BKE_scene.h" /* end of blender include block */ @@ -86,7 +87,7 @@ BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World *ble copy_v3_v3(m_backgroundcolor, &blenderworld->horr); copy_v3_v3(m_ambientcolor, &blenderworld->ambr); - if (blenderscene->r.color_mgt_flag & R_COLOR_MANAGEMENT) { + if (BKE_scene_check_color_management_enabled(blenderscene)) { linearrgb_to_srgb_v3_v3(m_mistcolor, m_mistcolor); linearrgb_to_srgb_v3_v3(m_backgroundcolor, m_backgroundcolor); linearrgb_to_srgb_v3_v3(m_ambientcolor, m_ambientcolor); diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index c0c28d15ad3..854e9fe7327 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -233,8 +233,7 @@ Scene *KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String& name) Scene *sce; /** - * Find the specified scene by name, or the first - * scene if nothing matches (shouldn't happen). + * Find the specified scene by name, or NULL if nothing matches. */ if ((sce= (Scene *)BLI_findstring(&m_maggie->scene, name.ReadPtr(), offsetof(ID, name) + 2))) return sce; @@ -246,7 +245,7 @@ Scene *KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String& name) return sce; } - return (Scene*)m_maggie->scene.first; + return NULL; } diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 3aa5a9f4f0e..e6b22420d90 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1702,6 +1702,8 @@ KX_Scene* KX_KetsjiEngine::CreateScene(Scene *scene, bool libloading) KX_Scene* KX_KetsjiEngine::CreateScene(const STR_String& scenename) { Scene *scene = m_sceneconverter->GetBlenderSceneForName(scenename); + if (!scene) + return NULL; return CreateScene(scene); } @@ -1717,8 +1719,12 @@ void KX_KetsjiEngine::AddScheduledScenes() { STR_String scenename = *scenenameit; KX_Scene* tmpscene = CreateScene(scenename); - m_scenes.push_back(tmpscene); - PostProcessScene(tmpscene); + if (tmpscene) { + m_scenes.push_back(tmpscene); + PostProcessScene(tmpscene); + } else { + printf("warning: scene %s could not be found, not added!\n",scenename.ReadPtr()); + } } m_addingOverlayScenes.clear(); } @@ -1731,9 +1737,12 @@ void KX_KetsjiEngine::AddScheduledScenes() { STR_String scenename = *scenenameit; KX_Scene* tmpscene = CreateScene(scenename); - m_scenes.insert(m_scenes.begin(),tmpscene); - PostProcessScene(tmpscene); - + if (tmpscene) { + m_scenes.insert(m_scenes.begin(),tmpscene); + PostProcessScene(tmpscene); + } else { + printf("warning: scene %s could not be found, not added!\n",scenename.ReadPtr()); + } } m_addingBackgroundScenes.clear(); } diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index e85b57f1769..abbe65738d4 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -395,10 +395,8 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) return; const int *viewport = canvas->GetViewPort(); - RAS_Rect rect = canvas->GetWindowArea(); - int rect_width = rect.GetWidth()+1, rect_height = rect.GetHeight()+1; - if (texturewidth != rect_width || textureheight != rect_height) + if (texturewidth != viewport[2] || textureheight != viewport[3]) { UpdateOffsetMatrix(canvas); UpdateCanvasTextureCoord(viewport); @@ -414,22 +412,22 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) if (need_depth) { glActiveTextureARB(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, texname[1]); - glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0); + glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, viewport[0], viewport[1], viewport[2], viewport[3], 0); } if (need_luminance) { glActiveTextureARB(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, texname[2]); - glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0); + glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, viewport[0], viewport[1], viewport[2], viewport[3], 0); } // reverting to texunit 0, without this we get bug [#28462] glActiveTextureARB(GL_TEXTURE0); - canvas->SetViewPort(0, 0, rect_width-1, rect_height-1); // We do this to make side-by-side stereo rendering work correctly with 2D filters. It would probably be nicer to just set the viewport, // but it can be easier for writing shaders to have the coordinates for the whole screen instead of just part of the screen. RAS_Rect scissor_rect = canvas->GetDisplayArea(); + glScissor(scissor_rect.GetLeft() + viewport[0], scissor_rect.GetBottom() + viewport[1], scissor_rect.GetWidth() + 1, @@ -459,7 +457,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glActiveTextureARB(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texname[0]); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0); // Don't use texturewidth and textureheight in case we don't have NPOT support + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, viewport[0], viewport[1], viewport[2], viewport[3], 0); // Don't use texturewidth and textureheight in case we don't have NPOT support glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_QUADS); @@ -473,8 +471,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) } glEnable(GL_DEPTH_TEST); - //We can't pass the results of canvas->GetViewPort() directly because canvas->SetViewPort() does some extra math [#34517] - canvas->SetViewPort(0, 0, viewport[2]-1, viewport[3]-1); EndShaderProgram(); glPopMatrix(); glMatrixMode(GL_MODELVIEW); |