Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Szepe <HG1_public@gmx.net>2015-03-24 00:49:38 +0300
committerThomas Szepe <HG1_public@gmx.net>2015-03-24 00:49:38 +0300
commit931c3e654404bbff05f1bcce9487fc6e91392300 (patch)
tree6b71c869a8827c2231f47db7a8d22a67cbc60380 /source/gameengine/Converter/BlenderWorldInfo.cpp
parentc73693d4a5c9b286333a90dd0fc6fd8a7e6ea753 (diff)
BGE: Code clean up for world (mist, background, ambient)
Code clean up for BGE world mist, background and global ambient color. Move mist render update to BlenderWolrdInfo Reviewers: moguri, brecht Reviewed By: moguri, brecht Differential Revision: https://developer.blender.org/D152
Diffstat (limited to 'source/gameengine/Converter/BlenderWorldInfo.cpp')
-rw-r--r--source/gameengine/Converter/BlenderWorldInfo.cpp55
1 files changed, 38 insertions, 17 deletions
diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp
index 5f476949616..40293d7479b 100644
--- a/source/gameengine/Converter/BlenderWorldInfo.cpp
+++ b/source/gameengine/Converter/BlenderWorldInfo.cpp
@@ -33,6 +33,8 @@
#include <stdio.h> // printf()
#include "BlenderWorldInfo.h"
+#include "KX_PythonInit.h"
+#include "GPU_material.h"
/* This little block needed for linking to Blender... */
#ifdef WIN32
@@ -40,23 +42,7 @@
#endif
/* This list includes only data type definitions */
-#include "DNA_object_types.h"
-#include "DNA_material_types.h"
-#include "DNA_image_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_group_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_property_types.h"
-#include "DNA_text_types.h"
-#include "DNA_sensor_types.h"
-#include "DNA_controller_types.h"
-#include "DNA_actuator_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
-#include "DNA_screen_types.h"
#include "BLI_math.h"
@@ -65,7 +51,7 @@
/* end of blender include block */
-BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World *blenderworld)
+BlenderWorldInfo::BlenderWorldInfo(Scene *blenderscene, World *blenderworld)
{
if (blenderworld) {
m_hasworld = true;
@@ -212,3 +198,38 @@ void BlenderWorldInfo::setAmbientColor(float r, float g, float b)
m_ambientcolor[1] = g;
m_ambientcolor[2] = b;
}
+
+void BlenderWorldInfo::UpdateBackGround()
+{
+ if (m_hasworld) {
+ RAS_IRasterizer *m_rasterizer = KX_GetActiveEngine()->GetRasterizer();
+
+ if (m_rasterizer->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID) {
+ m_rasterizer->SetBackColor(m_backgroundcolor);
+ GPU_horizon_update_color(m_backgroundcolor);
+ }
+ }
+}
+
+void BlenderWorldInfo::UpdateWorldSettings()
+{
+ if (m_hasworld) {
+ RAS_IRasterizer *m_rasterizer = KX_GetActiveEngine()->GetRasterizer();
+
+ if (m_rasterizer->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID) {
+ m_rasterizer->SetAmbientColor(m_ambientcolor);
+ GPU_ambient_update_color(m_ambientcolor);
+
+ if (m_hasmist) {
+ m_rasterizer->SetFog(m_misttype, m_miststart, m_mistdistance, m_mistintensity, m_mistcolor);
+ GPU_mist_update_values(m_misttype, m_miststart, m_mistdistance, m_mistintensity, m_mistcolor);
+ m_rasterizer->EnableFog(true);
+ GPU_mist_update_enable(true);
+ }
+ else {
+ m_rasterizer->EnableFog(false);
+ GPU_mist_update_enable(false);
+ }
+ }
+ }
+}