From 2affbb437bd3cbf3e1a502bd65a5eefb64a92b9b Mon Sep 17 00:00:00 2001 From: Thomas Szepe Date: Mon, 23 Mar 2015 21:36:08 +0100 Subject: BGE: Multitexture world (mist, ambient) fix This patch fix the existing word API for mist and global ambient lighting. Add deprecated message to disableMist() Add setUseMist(enable). Reviewers: dfelinto, campbellbarton, moguri Reviewed By: moguri Subscribers: solarlune, jta, brecht Projects: #bf_blender:_next Differential Revision: https://developer.blender.org/D148 --- source/gameengine/Ketsji/KX_WorldInfo.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/gameengine/Ketsji/KX_WorldInfo.h') diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h index 90b16fe1242..251ba95f43a 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ b/source/gameengine/Ketsji/KX_WorldInfo.h @@ -61,12 +61,12 @@ public: virtual float getAmbientColorGreen() = 0; virtual float getAmbientColorBlue() = 0; - virtual void setBackColor(float, float, float) = 0; + virtual void setUseMist(bool enable) = 0; virtual void setMistStart(float) = 0; virtual void setMistDistance(float) = 0; - virtual void setMistColorRed(float) = 0; - virtual void setMistColorGreen(float) = 0; - virtual void setMistColorBlue(float) = 0; + virtual void setMistColor(float, float, float) = 0; + virtual void setBackColor(float, float, float) = 0; + virtual void setAmbientColor(float,float,float) = 0; #ifdef WITH_CXX_GUARDEDALLOC -- cgit v1.2.3 From d07c666a0e542517914dad580d1b3f4787525852 Mon Sep 17 00:00:00 2001 From: Thomas Szepe Date: Mon, 23 Mar 2015 21:40:11 +0100 Subject: BGE: Add setMistType and setMistIntensity API. This patch adds the missing setMistType() and setMistIntensity() to the API Reviewers: campbellbarton, brecht, moguri Reviewed By: campbellbarton, brecht, moguri Subscribers: campbellbarton, dingto Differential Revision: https://developer.blender.org/D149 --- source/gameengine/Ketsji/KX_WorldInfo.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/gameengine/Ketsji/KX_WorldInfo.h') diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h index 251ba95f43a..f90a4ff6b6d 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ b/source/gameengine/Ketsji/KX_WorldInfo.h @@ -43,6 +43,15 @@ class MT_CmMatrix4x4; class KX_WorldInfo { public: + /** + * Mist options + */ + enum MistType { + KX_MIST_QUADRATIC, + KX_MIST_LINEAR, + KX_MIST_INV_QUADRATIC, + }; + KX_WorldInfo() {} virtual ~KX_WorldInfo(); @@ -51,8 +60,10 @@ public: virtual float getBackColorRed() = 0; virtual float getBackColorGreen() = 0; virtual float getBackColorBlue() = 0; + virtual short getMistType() = 0; virtual float getMistStart() = 0; virtual float getMistDistance() = 0; + virtual float getMistIntensity() = 0; virtual float getMistColorRed() = 0; virtual float getMistColorGreen() = 0; virtual float getMistColorBlue() = 0; @@ -62,8 +73,10 @@ public: virtual float getAmbientColorBlue() = 0; virtual void setUseMist(bool enable) = 0; + virtual void setMistType(short) = 0; virtual void setMistStart(float) = 0; virtual void setMistDistance(float) = 0; + virtual void setMistIntensity(float) = 0; virtual void setMistColor(float, float, float) = 0; virtual void setBackColor(float, float, float) = 0; virtual void setAmbientColor(float,float,float) = 0; -- cgit v1.2.3 From 931c3e654404bbff05f1bcce9487fc6e91392300 Mon Sep 17 00:00:00 2001 From: Thomas Szepe Date: Mon, 23 Mar 2015 22:49:38 +0100 Subject: 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 --- source/gameengine/Ketsji/KX_WorldInfo.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source/gameengine/Ketsji/KX_WorldInfo.h') diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h index f90a4ff6b6d..a6f93dd80ba 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ b/source/gameengine/Ketsji/KX_WorldInfo.h @@ -57,9 +57,6 @@ public: virtual bool hasWorld() = 0; virtual bool hasMist() = 0; - virtual float getBackColorRed() = 0; - virtual float getBackColorGreen() = 0; - virtual float getBackColorBlue() = 0; virtual short getMistType() = 0; virtual float getMistStart() = 0; virtual float getMistDistance() = 0; @@ -67,11 +64,12 @@ public: virtual float getMistColorRed() = 0; virtual float getMistColorGreen() = 0; virtual float getMistColorBlue() = 0; - + virtual float getBackColorRed() = 0; + virtual float getBackColorGreen() = 0; + virtual float getBackColorBlue() = 0; virtual float getAmbientColorRed() = 0; virtual float getAmbientColorGreen() = 0; virtual float getAmbientColorBlue() = 0; - virtual void setUseMist(bool enable) = 0; virtual void setMistType(short) = 0; virtual void setMistStart(float) = 0; @@ -80,7 +78,8 @@ public: virtual void setMistColor(float, float, float) = 0; virtual void setBackColor(float, float, float) = 0; virtual void setAmbientColor(float,float,float) = 0; - + virtual void UpdateBackGround() = 0; + virtual void UpdateWorldSettings() = 0; #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_WorldInfo") -- cgit v1.2.3 From 6c9502a6c1e8637922991171680986f1c9a17f6e Mon Sep 17 00:00:00 2001 From: Thomas Szepe Date: Tue, 24 Mar 2015 00:19:15 +0100 Subject: BGE: Remove BlenderWorldInfo This patch will remove the BlenderWorldInfo and move the source into KX_WorldInfo. Reviewers: brecht, moguri Reviewed By: brecht, moguri Differential Revision: https://developer.blender.org/D156 --- source/gameengine/Ketsji/KX_WorldInfo.h | 75 +++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 28 deletions(-) (limited to 'source/gameengine/Ketsji/KX_WorldInfo.h') diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h index a6f93dd80ba..4abcfb98892 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ b/source/gameengine/Ketsji/KX_WorldInfo.h @@ -33,15 +33,34 @@ #define __KX_WORLDINFO_H__ #include "MT_Scalar.h" +#include "KX_KetsjiEngine.h" +#include "RAS_IRasterizer.h" #ifdef WITH_CXX_GUARDEDALLOC #include "MEM_guardedalloc.h" #endif -class MT_CmMatrix4x4; +struct Scene; +struct World; +const class KX_KetsjiEngine; +const class RAS_IRasterizer; class KX_WorldInfo { + bool m_do_color_management; + bool m_hasworld; + bool m_hasmist; + short m_misttype; + float m_miststart; + float m_mistdistance; + float m_mistintensity; + float m_mistcolor[3]; + float m_backgroundcolor[3]; + float m_ambientcolor[3]; + float m_con_mistcolor[3]; + float m_con_backgroundcolor[3]; + float m_con_ambientcolor[3]; + public: /** * Mist options @@ -52,34 +71,34 @@ public: KX_MIST_INV_QUADRATIC, }; - KX_WorldInfo() {} - virtual ~KX_WorldInfo(); + KX_WorldInfo(Scene *blenderscene, World *blenderworld); + ~KX_WorldInfo(); - virtual bool hasWorld() = 0; - virtual bool hasMist() = 0; - virtual short getMistType() = 0; - virtual float getMistStart() = 0; - virtual float getMistDistance() = 0; - virtual float getMistIntensity() = 0; - virtual float getMistColorRed() = 0; - virtual float getMistColorGreen() = 0; - virtual float getMistColorBlue() = 0; - virtual float getBackColorRed() = 0; - virtual float getBackColorGreen() = 0; - virtual float getBackColorBlue() = 0; - virtual float getAmbientColorRed() = 0; - virtual float getAmbientColorGreen() = 0; - virtual float getAmbientColorBlue() = 0; - virtual void setUseMist(bool enable) = 0; - virtual void setMistType(short) = 0; - virtual void setMistStart(float) = 0; - virtual void setMistDistance(float) = 0; - virtual void setMistIntensity(float) = 0; - virtual void setMistColor(float, float, float) = 0; - virtual void setBackColor(float, float, float) = 0; - virtual void setAmbientColor(float,float,float) = 0; - virtual void UpdateBackGround() = 0; - virtual void UpdateWorldSettings() = 0; + bool hasWorld(); + bool hasMist(); + short getMistType(); + float getMistStart(); + float getMistDistance(); + float getMistIntensity(); + float getMistColorRed(); + float getMistColorGreen(); + float getMistColorBlue(); + float getBackColorRed(); + float getBackColorGreen(); + float getBackColorBlue(); + float getAmbientColorRed(); + float getAmbientColorGreen(); + float getAmbientColorBlue(); + void setUseMist(bool enable); + void setMistType(short type); + void setMistStart(float d); + void setMistDistance(float d); + void setMistIntensity(float intensity); + void setMistColor(float r, float g, float b); + void setBackColor(float r, float g, float b); + void setAmbientColor(float r, float g, float b); + void UpdateBackGround(); + void UpdateWorldSettings(); #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_WorldInfo") -- cgit v1.2.3 From fd22a92939dc937216f50d1350a63de872e0a6be Mon Sep 17 00:00:00 2001 From: Thomas Szepe Date: Tue, 24 Mar 2015 00:23:40 +0100 Subject: BGE: Add new world API KX_WorldInfo (KX_Scene) This Patch will add a the world API (mist, background, ambient) to KX_WorldInfo. The new API uses now attributes. Reviewers: campbellbarton, moguri Reviewed By: moguri Subscribers: klauser, brecht Differential Revision: https://developer.blender.org/D157 --- source/gameengine/Ketsji/KX_WorldInfo.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'source/gameengine/Ketsji/KX_WorldInfo.h') diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h index 4abcfb98892..830f12de6b0 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ b/source/gameengine/Ketsji/KX_WorldInfo.h @@ -34,19 +34,24 @@ #include "MT_Scalar.h" #include "KX_KetsjiEngine.h" -#include "RAS_IRasterizer.h" +#include "PyObjectPlus.h" #ifdef WITH_CXX_GUARDEDALLOC #include "MEM_guardedalloc.h" #endif +#ifdef USE_MATHUTILS +void KX_WorldInfo_Mathutils_Callback_Init(void); +#endif + struct Scene; struct World; -const class KX_KetsjiEngine; -const class RAS_IRasterizer; -class KX_WorldInfo +class KX_WorldInfo : public PyObjectPlus { + Py_Header + + STR_String m_name; bool m_do_color_management; bool m_hasworld; bool m_hasmist; @@ -74,6 +79,7 @@ public: KX_WorldInfo(Scene *blenderscene, World *blenderworld); ~KX_WorldInfo(); + const STR_String &GetName(); bool hasWorld(); bool hasMist(); short getMistType(); @@ -100,6 +106,18 @@ public: void UpdateBackGround(); void UpdateWorldSettings(); +#ifdef WITH_PYTHON + /* attributes */ + static PyObject *pyattr_get_mist_typeconst(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject *pyattr_get_mist_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static int pyattr_set_mist_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static PyObject *pyattr_get_back_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static int pyattr_set_back_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + static PyObject *pyattr_get_ambient_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static int pyattr_set_ambient_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); + virtual PyObject *py_repr(void); +#endif + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_WorldInfo") #endif -- cgit v1.2.3 From ee579684617c1a9868b2c75cfb5d32efe26c1198 Mon Sep 17 00:00:00 2001 From: Thomas Szepe Date: Tue, 24 Mar 2015 00:27:45 +0100 Subject: BGE: Remove old world bge.render API This patch can be used to remove the old world bge.render API if the new world API D157 is used. If the new world API is applied we can remove the old API because the old has newer worked. The patch keep the two old working methods for backward compatibility. Reviewers: campbellbarton, moguri Reviewed By: campbellbarton, moguri Subscribers: brecht Differential Revision: https://developer.blender.org/D158 --- source/gameengine/Ketsji/KX_WorldInfo.h | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'source/gameengine/Ketsji/KX_WorldInfo.h') diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h index 830f12de6b0..64304e594cc 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ b/source/gameengine/Ketsji/KX_WorldInfo.h @@ -81,20 +81,6 @@ public: const STR_String &GetName(); bool hasWorld(); - bool hasMist(); - short getMistType(); - float getMistStart(); - float getMistDistance(); - float getMistIntensity(); - float getMistColorRed(); - float getMistColorGreen(); - float getMistColorBlue(); - float getBackColorRed(); - float getBackColorGreen(); - float getBackColorBlue(); - float getAmbientColorRed(); - float getAmbientColorGreen(); - float getAmbientColorBlue(); void setUseMist(bool enable); void setMistType(short type); void setMistStart(float d); -- cgit v1.2.3 From dc95ca92ca224d26423c5d63b33e7714a6a8c9ce Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Sun, 10 May 2015 00:54:06 +0200 Subject: BGE: Fix T43822 Videotexture does not use sky color for off-screen rendering Make scene background color as default for render-to-texture instead of current blue color (0, 0, 255). It is very useful for mirrors setups. Reviewers: moguri, ben2610, sybren, panzergame, hg1 Reviewed By: panzergame, hg1, moguri Subscribers: mpan3 Differential Revision: https://developer.blender.org/D1287 --- source/gameengine/Ketsji/KX_WorldInfo.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/gameengine/Ketsji/KX_WorldInfo.h') diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h index 64304e594cc..0e8fe3c730a 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ b/source/gameengine/Ketsji/KX_WorldInfo.h @@ -88,6 +88,7 @@ public: void setMistIntensity(float intensity); void setMistColor(float r, float g, float b); void setBackColor(float r, float g, float b); + const float *getBackColor() const; void setAmbientColor(float r, float g, float b); void UpdateBackGround(); void UpdateWorldSettings(); -- cgit v1.2.3