[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34393] trunk/blender/source/gameengine: BGE BugFix [#25711]render.setBackgroundColor() does not work:

Dalai Felinto dfelinto at gmail.com
Tue Jan 18 23:27:19 CET 2011


Revision: 34393
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34393
Author:   dfelinto
Date:     2011-01-18 22:27:18 +0000 (Tue, 18 Jan 2011)
Log Message:
-----------
BGE BugFix [#25711]render.setBackgroundColor() does not work:
Since rev.2 (hans ftw) we have a strange situation where horizon color was being used at Convert time for the WorldInfo background color (and for the fog). However through the Python API only the Rasterizer background color was being updated. On top of that the KX_KetsjiEngine.cpp::SetBackGround was using the WorldInfo bgcolor when render mode was the potato one (TEXTURED). Bottomline, when in potato mode the glClearColor used was the original one in worldinfo, not the API updated one in Rasterized.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Converter/BlenderWorldInfo.cpp
    trunk/blender/source/gameengine/Converter/BlenderWorldInfo.h
    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
    trunk/blender/source/gameengine/Ketsji/KX_WorldInfo.h

Modified: trunk/blender/source/gameengine/Converter/BlenderWorldInfo.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BlenderWorldInfo.cpp	2011-01-18 21:39:50 UTC (rev 34392)
+++ trunk/blender/source/gameengine/Converter/BlenderWorldInfo.cpp	2011-01-18 22:27:18 UTC (rev 34393)
@@ -188,6 +188,12 @@
 	return m_mistcolor[2];
 }
 
+void BlenderWorldInfo::setBackColor(float r, float g, float b)
+{
+	m_backgroundcolor[0] = r;
+	m_backgroundcolor[1] = g;
+	m_backgroundcolor[2] = b;
+}
 
 	void	
 BlenderWorldInfo::setMistStart(

Modified: trunk/blender/source/gameengine/Converter/BlenderWorldInfo.h
===================================================================
--- trunk/blender/source/gameengine/Converter/BlenderWorldInfo.h	2011-01-18 21:39:50 UTC (rev 34392)
+++ trunk/blender/source/gameengine/Converter/BlenderWorldInfo.h	2011-01-18 22:27:18 UTC (rev 34393)
@@ -64,6 +64,12 @@
     float	getMistColorGreen();
     float	getMistColorBlue();     
 
+		void
+	setBackColor(
+		float r,
+		float g,
+		float b
+	);
 		void	
 	setMistStart(
 		float d

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp	2011-01-18 21:39:50 UTC (rev 34392)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp	2011-01-18 22:27:18 UTC (rev 34393)
@@ -923,6 +923,11 @@
 	{
 		gp_Rasterizer->SetBackColor(vec[0], vec[1], vec[2], vec[3]);
 	}
+
+	KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo();
+	if (wi->hasWorld())
+		wi->setBackColor(vec[0], vec[1], vec[2]);
+
 	Py_RETURN_NONE;
 }
 

Modified: trunk/blender/source/gameengine/Ketsji/KX_WorldInfo.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_WorldInfo.h	2011-01-18 21:39:50 UTC (rev 34392)
+++ trunk/blender/source/gameengine/Ketsji/KX_WorldInfo.h	2011-01-18 22:27:18 UTC (rev 34393)
@@ -58,6 +58,7 @@
 	virtual float	getAmbientColorGreen()=0;
 	virtual float	getAmbientColorBlue()=0;
 
+	virtual void	setBackColor(float,float,float)=0;
 	virtual void	setMistStart(float)=0;
 	virtual void	setMistDistance(float)=0;
 	virtual void	setMistColorRed(float)=0;




More information about the Bf-blender-cvs mailing list