diff options
author | Thomas Szepe <HG1_public@gmx.net> | 2015-10-11 19:43:05 +0300 |
---|---|---|
committer | Thomas Szepe <HG1_public@gmx.net> | 2015-10-11 19:43:05 +0300 |
commit | bd6febc4c4fa6ef33e581b5e50b01ba8327b702c (patch) | |
tree | aff864680830ebda2102d7c865e6000c1d4da046 /source | |
parent | 3dd83b533a032fe4e5e39a275e7f2fcff2beaf15 (diff) |
BGE: Change KX_WolrdInfo mathutils vector to color
Change the mathutils callback from vector to color for mistColor, backgroundColor and ambientColor.
Reviewers: lordloki, campbellbarton, panzergame, moguri, sybren
Reviewed By: panzergame, moguri, sybren
Projects: #game_engine, #game_logic
Differential Revision: https://developer.blender.org/D1432
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/Ketsji/KX_WorldInfo.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/source/gameengine/Ketsji/KX_WorldInfo.cpp b/source/gameengine/Ketsji/KX_WorldInfo.cpp index 111d81cad2e..be8b1ce92fc 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.cpp +++ b/source/gameengine/Ketsji/KX_WorldInfo.cpp @@ -253,11 +253,11 @@ PyAttributeDef KX_WorldInfo::Attributes[] = { /*----------------------mathutils callbacks ----------------------------*/ /* subtype */ -#define MATHUTILS_VEC_CB_MIST_COLOR 1 -#define MATHUTILS_VEC_CB_BACK_COLOR 2 -#define MATHUTILS_VEC_CB_AMBIENT_COLOR 3 +#define MATHUTILS_COL_CB_MIST_COLOR 1 +#define MATHUTILS_COL_CB_BACK_COLOR 2 +#define MATHUTILS_COL_CB_AMBIENT_COLOR 3 -static unsigned char mathutils_world_vector_cb_index = -1; /* index for our callbacks */ +static unsigned char mathutils_world_color_cb_index = -1; /* index for our callbacks */ static int mathutils_world_generic_check(BaseMathObject *bmo) { @@ -268,20 +268,20 @@ static int mathutils_world_generic_check(BaseMathObject *bmo) return 0; } -static int mathutils_world_vector_get(BaseMathObject *bmo, int subtype) +static int mathutils_world_color_get(BaseMathObject *bmo, int subtype) { KX_WorldInfo *self = static_cast<KX_WorldInfo*>BGE_PROXY_REF(bmo->cb_user); if (self == NULL) return -1; switch (subtype) { - case MATHUTILS_VEC_CB_MIST_COLOR: + case MATHUTILS_COL_CB_MIST_COLOR: copy_v3_v3(bmo->data, self->m_mistcolor); break; - case MATHUTILS_VEC_CB_BACK_COLOR: + case MATHUTILS_COL_CB_BACK_COLOR: copy_v3_v3(bmo->data, self->m_backgroundcolor); break; - case MATHUTILS_VEC_CB_AMBIENT_COLOR: + case MATHUTILS_COL_CB_AMBIENT_COLOR: copy_v3_v3(bmo->data, self->m_ambientcolor); break; default: @@ -290,7 +290,7 @@ static int mathutils_world_vector_get(BaseMathObject *bmo, int subtype) return 0; } -static int mathutils_world_vector_set(BaseMathObject *bmo, int subtype) +static int mathutils_world_color_set(BaseMathObject *bmo, int subtype) { KX_WorldInfo *self = static_cast<KX_WorldInfo*>BGE_PROXY_REF(bmo->cb_user); @@ -298,13 +298,13 @@ static int mathutils_world_vector_set(BaseMathObject *bmo, int subtype) return -1; switch (subtype) { - case MATHUTILS_VEC_CB_MIST_COLOR: + case MATHUTILS_COL_CB_MIST_COLOR: self->setMistColor(bmo->data[0], bmo->data[1], bmo->data[2]); break; - case MATHUTILS_VEC_CB_BACK_COLOR: + case MATHUTILS_COL_CB_BACK_COLOR: self->setBackColor(bmo->data[0], bmo->data[1], bmo->data[2]); break; - case MATHUTILS_VEC_CB_AMBIENT_COLOR: + case MATHUTILS_COL_CB_AMBIENT_COLOR: self->setAmbientColor(bmo->data[0], bmo->data[1], bmo->data[2]); break; default: @@ -313,7 +313,7 @@ static int mathutils_world_vector_set(BaseMathObject *bmo, int subtype) return 0; } -static int mathutils_world_vector_get_index(BaseMathObject *bmo, int subtype, int index) +static int mathutils_world_color_get_index(BaseMathObject *bmo, int subtype, int index) { KX_WorldInfo *self = static_cast<KX_WorldInfo*>BGE_PROXY_REF(bmo->cb_user); @@ -321,19 +321,19 @@ static int mathutils_world_vector_get_index(BaseMathObject *bmo, int subtype, in return -1; switch (subtype) { - case MATHUTILS_VEC_CB_MIST_COLOR: + case MATHUTILS_COL_CB_MIST_COLOR: { const float *color = self->m_mistcolor; bmo->data[index] = color[index]; } break; - case MATHUTILS_VEC_CB_BACK_COLOR: + case MATHUTILS_COL_CB_BACK_COLOR: { const float *color = self->m_backgroundcolor; bmo->data[index] = color[index]; } break; - case MATHUTILS_VEC_CB_AMBIENT_COLOR: + case MATHUTILS_COL_CB_AMBIENT_COLOR: { const float *color = self->m_ambientcolor; bmo->data[index] = color[index]; @@ -345,7 +345,7 @@ static int mathutils_world_vector_get_index(BaseMathObject *bmo, int subtype, in return 0; } -static int mathutils_world_vector_set_index(BaseMathObject *bmo, int subtype, int index) +static int mathutils_world_color_set_index(BaseMathObject *bmo, int subtype, int index) { KX_WorldInfo *self = static_cast<KX_WorldInfo*>BGE_PROXY_REF(bmo->cb_user); @@ -354,17 +354,17 @@ static int mathutils_world_vector_set_index(BaseMathObject *bmo, int subtype, in float color[4]; switch (subtype) { - case MATHUTILS_VEC_CB_MIST_COLOR: + case MATHUTILS_COL_CB_MIST_COLOR: copy_v3_v3(color, self->m_mistcolor); color[index] = bmo->data[index]; self->setMistColor(color[0], color[1], color[2]); break; - case MATHUTILS_VEC_CB_BACK_COLOR: + case MATHUTILS_COL_CB_BACK_COLOR: copy_v3_v3(color, self->m_backgroundcolor); color[index] = bmo->data[index]; self->setBackColor(color[0], color[1], color[2]); break; - case MATHUTILS_VEC_CB_AMBIENT_COLOR: + case MATHUTILS_COL_CB_AMBIENT_COLOR: copy_v3_v3(color, self->m_ambientcolor); color[index] = bmo->data[index]; self->setAmbientColor(color[0], color[1], color[2]); @@ -375,18 +375,18 @@ static int mathutils_world_vector_set_index(BaseMathObject *bmo, int subtype, in return 0; } -static Mathutils_Callback mathutils_world_vector_cb = { +static Mathutils_Callback mathutils_world_color_cb = { mathutils_world_generic_check, - mathutils_world_vector_get, - mathutils_world_vector_set, - mathutils_world_vector_get_index, - mathutils_world_vector_set_index + mathutils_world_color_get, + mathutils_world_color_set, + mathutils_world_color_get_index, + mathutils_world_color_set_index }; void KX_WorldInfo_Mathutils_Callback_Init() { // register mathutils callbacks, ok to run more than once. - mathutils_world_vector_cb_index = Mathutils_RegisterCallback(&mathutils_world_vector_cb); + mathutils_world_color_cb_index = Mathutils_RegisterCallback(&mathutils_world_color_cb); } #endif // USE_MATHUTILS @@ -418,9 +418,9 @@ PyObject *KX_WorldInfo::pyattr_get_mist_typeconst(void *self_v, const KX_PYATTRI PyObject *KX_WorldInfo::pyattr_get_mist_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { #ifdef USE_MATHUTILS - return Vector_CreatePyObject_cb( - BGE_PROXY_FROM_REF_BORROW(self_v), 3, - mathutils_world_vector_cb_index, MATHUTILS_VEC_CB_MIST_COLOR); + return Color_CreatePyObject_cb( + BGE_PROXY_FROM_REF_BORROW(self_v), + mathutils_world_color_cb_index, MATHUTILS_COL_CB_MIST_COLOR); #else KX_WorldInfo *self = static_cast<KX_WorldInfo*>(self_v); return PyObjectFrom(MT_Vector3(self->m_mistcolor)); @@ -444,9 +444,9 @@ PyObject *KX_WorldInfo::pyattr_get_back_color(void *self_v, const KX_PYATTRIBUTE { #ifdef USE_MATHUTILS - return Vector_CreatePyObject_cb( - BGE_PROXY_FROM_REF_BORROW(self_v), 3, - mathutils_world_vector_cb_index, MATHUTILS_VEC_CB_BACK_COLOR); + return Color_CreatePyObject_cb( + BGE_PROXY_FROM_REF_BORROW(self_v), + mathutils_world_color_cb_index, MATHUTILS_COL_CB_BACK_COLOR); #else KX_WorldInfo *self = static_cast<KX_WorldInfo*>(self_v); return PyObjectFrom(MT_Vector3(self->m_backgroundcolor)); @@ -469,9 +469,9 @@ int KX_WorldInfo::pyattr_set_back_color(void *self_v, const KX_PYATTRIBUTE_DEF * PyObject *KX_WorldInfo::pyattr_get_ambient_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { #ifdef USE_MATHUTILS - return Vector_CreatePyObject_cb( - BGE_PROXY_FROM_REF_BORROW(self_v), 3, - mathutils_world_vector_cb_index, MATHUTILS_VEC_CB_AMBIENT_COLOR); + return Color_CreatePyObject_cb( + BGE_PROXY_FROM_REF_BORROW(self_v), + mathutils_world_color_cb_index, MATHUTILS_COL_CB_AMBIENT_COLOR); #else KX_WorldInfo *self = static_cast<KX_WorldInfo*>(self_v); return PyObjectFrom(MT_Vector3(self->m_ambientcolor)); |