diff options
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Converter/BlenderWorldInfo.cpp | 53 | ||||
-rw-r--r-- | source/gameengine/Converter/BlenderWorldInfo.h | 14 |
3 files changed, 31 insertions, 38 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 521bc011b09..f9bca9a2cdd 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -2634,7 +2634,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, sumolist->Release(); // convert world - KX_WorldInfo* worldinfo = new BlenderWorldInfo(blenderscene->world); + KX_WorldInfo* worldinfo = new BlenderWorldInfo(blenderscene, blenderscene->world); converter->RegisterWorldInfo(worldinfo); kxscene->SetWorldInfo(worldinfo); diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp index 47653519cfd..f0d6083a8fa 100644 --- a/source/gameengine/Converter/BlenderWorldInfo.cpp +++ b/source/gameengine/Converter/BlenderWorldInfo.cpp @@ -2,7 +2,7 @@ * $Id$ * ***** BEGIN GPL LICENSE BLOCK ***** * - * This program is free software; you can redistribute it and/or + * This program is free software; you can [0]istribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. @@ -55,11 +55,13 @@ #include "DNA_world_types.h" #include "DNA_screen_types.h" +#include "BLI_math.h" + #include "BKE_global.h" /* end of blender include block */ -BlenderWorldInfo::BlenderWorldInfo(struct World* blenderworld) +BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World* blenderworld) { if (blenderworld) { @@ -71,27 +73,24 @@ BlenderWorldInfo::BlenderWorldInfo(struct World* blenderworld) m_hasmist = true; m_miststart = blenderworld->miststa; m_mistdistance = blenderworld->mistdist; - m_mistred = blenderworld->horr; - m_mistgreen = blenderworld->horg; - m_mistblue = blenderworld->horb; + copy_v3_v3(m_mistcolor, &blenderworld->horr); } else { m_hasmist = false; m_miststart = 0.0; m_mistdistance = 0.0; - m_mistred = 0.0; - m_mistgreen = 0.0; - m_mistblue = 0.0; + zero_v3(m_mistcolor); } - m_backgroundred = blenderworld->horr; - m_backgroundgreen = blenderworld->horg; - m_backgroundblue = blenderworld->horb; - - m_ambientred = blenderworld->ambr; - m_ambientgreen = blenderworld->ambg; - m_ambientblue = blenderworld->ambb; + copy_v3_v3(m_backgroundcolor, &blenderworld->horr); + copy_v3_v3(m_ambientcolor, &blenderworld->ambr); + + if(blenderscene->r.color_mgt_flag & R_COLOR_MANAGEMENT) { + 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); + } } else { @@ -123,37 +122,37 @@ bool BlenderWorldInfo::hasMist() float BlenderWorldInfo::getBackColorRed() { - return m_backgroundred; + return m_backgroundcolor[0]; } float BlenderWorldInfo::getBackColorGreen() { - return m_backgroundgreen; + return m_backgroundcolor[1]; } float BlenderWorldInfo::getBackColorBlue() { - return m_backgroundblue; + return m_backgroundcolor[2]; } float BlenderWorldInfo::getAmbientColorRed() { - return m_ambientred; + return m_ambientcolor[0]; } float BlenderWorldInfo::getAmbientColorGreen() { - return m_ambientgreen; + return m_ambientcolor[1]; } float BlenderWorldInfo::getAmbientColorBlue() { - return m_ambientblue; + return m_ambientcolor[2]; } float BlenderWorldInfo::getMistStart() @@ -172,21 +171,21 @@ float BlenderWorldInfo::getMistDistance() float BlenderWorldInfo::getMistColorRed() { - return m_mistred; + return m_mistcolor[0]; } float BlenderWorldInfo::getMistColorGreen() { - return m_mistgreen; + return m_mistcolor[1]; } float BlenderWorldInfo::getMistColorBlue() { - return m_mistblue; + return m_mistcolor[2]; } @@ -210,7 +209,7 @@ BlenderWorldInfo::setMistDistance( BlenderWorldInfo::setMistColorRed( float d ) { - m_mistred = d; + m_mistcolor[0] = d; } @@ -218,7 +217,7 @@ BlenderWorldInfo::setMistColorRed( BlenderWorldInfo::setMistColorGreen( float d ) { - m_mistgreen = d; + m_mistcolor[1] = d; } @@ -226,5 +225,5 @@ BlenderWorldInfo::setMistColorGreen( BlenderWorldInfo::setMistColorBlue( float d ) { - m_mistblue = d; + m_mistcolor[2] = d; } diff --git a/source/gameengine/Converter/BlenderWorldInfo.h b/source/gameengine/Converter/BlenderWorldInfo.h index b500c55a7f2..a430e18223e 100644 --- a/source/gameengine/Converter/BlenderWorldInfo.h +++ b/source/gameengine/Converter/BlenderWorldInfo.h @@ -35,23 +35,17 @@ class BlenderWorldInfo : public KX_WorldInfo { bool m_hasworld; - float m_backgroundred; - float m_backgroundgreen; - float m_backgroundblue; + float m_backgroundcolor[3]; bool m_hasmist; float m_miststart; float m_mistdistance; - float m_mistred; - float m_mistgreen; - float m_mistblue; + float m_mistcolor[3]; - float m_ambientred; - float m_ambientgreen; - float m_ambientblue; + float m_ambientcolor[3]; public: - BlenderWorldInfo(struct World* blenderworld); + BlenderWorldInfo(struct Scene *blenderscene, struct World* blenderworld); ~BlenderWorldInfo(); bool hasWorld(); |