[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31968] trunk/blender/source/gameengine/ Converter: Fix #23857: game engine world colors were not color corrected yet,
Brecht Van Lommel
brechtvanlommel at pandora.be
Thu Sep 16 21:03:02 CEST 2010
Revision: 31968
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31968
Author: blendix
Date: 2010-09-16 21:03:01 +0200 (Thu, 16 Sep 2010)
Log Message:
-----------
Fix #23857: game engine world colors were not color corrected yet,
giving inconsistent results with render/UI.
Modified Paths:
--------------
trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
trunk/blender/source/gameengine/Converter/BlenderWorldInfo.cpp
trunk/blender/source/gameengine/Converter/BlenderWorldInfo.h
Modified: trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2010-09-16 19:00:15 UTC (rev 31967)
+++ trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2010-09-16 19:03:01 UTC (rev 31968)
@@ -2634,7 +2634,7 @@
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);
Modified: trunk/blender/source/gameengine/Converter/BlenderWorldInfo.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BlenderWorldInfo.cpp 2010-09-16 19:00:15 UTC (rev 31967)
+++ trunk/blender/source/gameengine/Converter/BlenderWorldInfo.cpp 2010-09-16 19:03:01 UTC (rev 31968)
@@ -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 @@
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 @@
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::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::setMistColorRed(
float d
) {
- m_mistred = d;
+ m_mistcolor[0] = d;
}
@@ -218,7 +217,7 @@
BlenderWorldInfo::setMistColorGreen(
float d
) {
- m_mistgreen = d;
+ m_mistcolor[1] = d;
}
@@ -226,5 +225,5 @@
BlenderWorldInfo::setMistColorBlue(
float d
) {
- m_mistblue = d;
+ m_mistcolor[2] = d;
}
Modified: trunk/blender/source/gameengine/Converter/BlenderWorldInfo.h
===================================================================
--- trunk/blender/source/gameengine/Converter/BlenderWorldInfo.h 2010-09-16 19:00:15 UTC (rev 31967)
+++ trunk/blender/source/gameengine/Converter/BlenderWorldInfo.h 2010-09-16 19:03:01 UTC (rev 31968)
@@ -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();
More information about the Bf-blender-cvs
mailing list