From c2147a9c3d502caea6a54749cd46d2d79c67caa0 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sat, 1 May 2010 16:18:05 +0000 Subject: Merge with trunk, revision 28446 - 28528. --- source/gameengine/Converter/BL_ArmatureObject.cpp | 2 +- source/gameengine/Ketsji/KX_GameObject.cpp | 70 +++++++++++------------ source/gameengine/Ketsji/KX_ObjectActuator.cpp | 28 ++++----- 3 files changed, 50 insertions(+), 50 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index 35ee3ac1ca3..78f16dd6982 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -108,7 +108,7 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) if (copy_constraint) { ListBase listb; // copy all constraint for backward compatibility - copy_constraints(&listb, &pchan->constraints); // copy_constraints NULLs listb + copy_constraints(&listb, &pchan->constraints, FALSE); // copy_constraints NULLs listb, no need to make extern for this operation. pchan->constraints= listb; } else { pchan->constraints.first = NULL; diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 776207ef209..e5fb78daceb 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1261,7 +1261,7 @@ static int mathutils_kxgameob_generic_check(BaseMathObject *bmo) return 1; } -static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype, float *vec_from) +static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype) { KX_GameObject* self= static_castBGE_PROXY_REF(bmo->cb_user); if(self==NULL) @@ -1269,39 +1269,39 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype, float switch(subtype) { case MATHUTILS_VEC_CB_POS_LOCAL: - self->NodeGetLocalPosition().getValue(vec_from); + self->NodeGetLocalPosition().getValue(bmo->data); break; case MATHUTILS_VEC_CB_POS_GLOBAL: - self->NodeGetWorldPosition().getValue(vec_from); + self->NodeGetWorldPosition().getValue(bmo->data); break; case MATHUTILS_VEC_CB_SCALE_LOCAL: - self->NodeGetLocalScaling().getValue(vec_from); + self->NodeGetLocalScaling().getValue(bmo->data); break; case MATHUTILS_VEC_CB_SCALE_GLOBAL: - self->NodeGetWorldScaling().getValue(vec_from); + self->NodeGetWorldScaling().getValue(bmo->data); break; case MATHUTILS_VEC_CB_INERTIA_LOCAL: if(!self->GetPhysicsController()) return 0; - self->GetPhysicsController()->GetLocalInertia().getValue(vec_from); + self->GetPhysicsController()->GetLocalInertia().getValue(bmo->data); break; case MATHUTILS_VEC_CB_OBJECT_COLOR: - self->GetObjectColor().getValue(vec_from); + self->GetObjectColor().getValue(bmo->data); break; case MATHUTILS_VEC_CB_LINVEL_LOCAL: if(!self->GetPhysicsController()) return 0; - self->GetLinearVelocity(true).getValue(vec_from); + self->GetLinearVelocity(true).getValue(bmo->data); break; case MATHUTILS_VEC_CB_LINVEL_GLOBAL: if(!self->GetPhysicsController()) return 0; - self->GetLinearVelocity(false).getValue(vec_from); + self->GetLinearVelocity(false).getValue(bmo->data); break; case MATHUTILS_VEC_CB_ANGVEL_LOCAL: if(!self->GetPhysicsController()) return 0; - self->GetAngularVelocity(true).getValue(vec_from); + self->GetAngularVelocity(true).getValue(bmo->data); break; case MATHUTILS_VEC_CB_ANGVEL_GLOBAL: if(!self->GetPhysicsController()) return 0; - self->GetAngularVelocity(false).getValue(vec_from); + self->GetAngularVelocity(false).getValue(bmo->data); break; } @@ -1309,7 +1309,7 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype, float return 1; } -static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype, float *vec_to) +static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype) { KX_GameObject* self= static_castBGE_PROXY_REF(bmo->cb_user); if(self==NULL) @@ -1317,15 +1317,15 @@ static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype, float switch(subtype) { case MATHUTILS_VEC_CB_POS_LOCAL: - self->NodeSetLocalPosition(MT_Point3(vec_to)); + self->NodeSetLocalPosition(MT_Point3(bmo->data)); self->NodeUpdateGS(0.f); break; case MATHUTILS_VEC_CB_POS_GLOBAL: - self->NodeSetWorldPosition(MT_Point3(vec_to)); + self->NodeSetWorldPosition(MT_Point3(bmo->data)); self->NodeUpdateGS(0.f); break; case MATHUTILS_VEC_CB_SCALE_LOCAL: - self->NodeSetLocalScale(MT_Point3(vec_to)); + self->NodeSetLocalScale(MT_Point3(bmo->data)); self->NodeUpdateGS(0.f); break; case MATHUTILS_VEC_CB_SCALE_GLOBAL: @@ -1334,46 +1334,46 @@ static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype, float /* read only */ break; case MATHUTILS_VEC_CB_OBJECT_COLOR: - self->SetObjectColor(MT_Vector4(vec_to)); + self->SetObjectColor(MT_Vector4(bmo->data)); break; case MATHUTILS_VEC_CB_LINVEL_LOCAL: - self->setLinearVelocity(MT_Point3(vec_to),true); + self->setLinearVelocity(MT_Point3(bmo->data),true); break; case MATHUTILS_VEC_CB_LINVEL_GLOBAL: - self->setLinearVelocity(MT_Point3(vec_to),false); + self->setLinearVelocity(MT_Point3(bmo->data),false); break; case MATHUTILS_VEC_CB_ANGVEL_LOCAL: - self->setAngularVelocity(MT_Point3(vec_to),true); + self->setAngularVelocity(MT_Point3(bmo->data),true); break; case MATHUTILS_VEC_CB_ANGVEL_GLOBAL: - self->setAngularVelocity(MT_Point3(vec_to),false); + self->setAngularVelocity(MT_Point3(bmo->data),false); break; } return 1; } -static int mathutils_kxgameob_vector_get_index(BaseMathObject *bmo, int subtype, float *vec_from, int index) +static int mathutils_kxgameob_vector_get_index(BaseMathObject *bmo, int subtype, int index) { float f[4]; /* lazy, avoid repeteing the case statement */ - if(!mathutils_kxgameob_vector_get(bmo, subtype, f)) + if(!mathutils_kxgameob_vector_get(bmo, subtype)) return 0; - vec_from[index]= f[index]; + bmo->data[index]= f[index]; return 1; } -static int mathutils_kxgameob_vector_set_index(BaseMathObject *bmo, int subtype, float *vec_to, int index) +static int mathutils_kxgameob_vector_set_index(BaseMathObject *bmo, int subtype, int index) { - float f= vec_to[index]; + float f= bmo->data[index]; /* lazy, avoid repeteing the case statement */ - if(!mathutils_kxgameob_vector_get(bmo, subtype, vec_to)) + if(!mathutils_kxgameob_vector_get(bmo, subtype)) return 0; - vec_to[index]= f; - mathutils_kxgameob_vector_set(bmo, subtype, vec_to); + bmo->data[index]= f; + mathutils_kxgameob_vector_set(bmo, subtype); return 1; } @@ -1392,18 +1392,18 @@ Mathutils_Callback mathutils_kxgameob_vector_cb = { static int mathutils_kxgameob_matrix_cb_index= -1; /* index for our callbacks */ -static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype, float *mat_from) +static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype) { KX_GameObject* self= static_castBGE_PROXY_REF(bmo->cb_user); if(self==NULL) return 0; - + switch(subtype) { case MATHUTILS_MAT_CB_ORI_LOCAL: - self->NodeGetLocalOrientation().getValue3x3(mat_from); + self->NodeGetLocalOrientation().getValue3x3(bmo->data); break; case MATHUTILS_MAT_CB_ORI_GLOBAL: - self->NodeGetWorldOrientation().getValue3x3(mat_from); + self->NodeGetWorldOrientation().getValue3x3(bmo->data); break; } @@ -1411,7 +1411,7 @@ static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype, float } -static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype, float *mat_to) +static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype) { KX_GameObject* self= static_castBGE_PROXY_REF(bmo->cb_user); if(self==NULL) @@ -1420,12 +1420,12 @@ static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype, float MT_Matrix3x3 mat3x3; switch(subtype) { case MATHUTILS_MAT_CB_ORI_LOCAL: - mat3x3.setValue3x3(mat_to); + mat3x3.setValue3x3(bmo->data); self->NodeSetLocalOrientation(mat3x3); self->NodeUpdateGS(0.f); break; case MATHUTILS_MAT_CB_ORI_GLOBAL: - mat3x3.setValue3x3(mat_to); + mat3x3.setValue3x3(bmo->data); self->NodeSetLocalOrientation(mat3x3); self->NodeUpdateGS(0.f); break; diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index 824017f5704..460e4369c5b 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -392,7 +392,7 @@ static int mathutils_obactu_generic_check(BaseMathObject *bmo) return 1; } -static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype, float *vec_from) +static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype) { KX_ObjectActuator* self= static_castBGE_PROXY_REF(bmo->cb_user); if(self==NULL) @@ -400,17 +400,17 @@ static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype, float * switch(subtype) { case MATHUTILS_VEC_CB_LINV: - self->m_linear_velocity.getValue(vec_from); + self->m_linear_velocity.getValue(bmo->data); break; case MATHUTILS_VEC_CB_ANGV: - self->m_angular_velocity.getValue(vec_from); + self->m_angular_velocity.getValue(bmo->data); break; } return 1; } -static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype, float *vec_to) +static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype) { KX_ObjectActuator* self= static_castBGE_PROXY_REF(bmo->cb_user); if(self==NULL) @@ -418,37 +418,37 @@ static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype, float * switch(subtype) { case MATHUTILS_VEC_CB_LINV: - self->m_linear_velocity.setValue(vec_to); + self->m_linear_velocity.setValue(bmo->data); break; case MATHUTILS_VEC_CB_ANGV: - self->m_angular_velocity.setValue(vec_to); + self->m_angular_velocity.setValue(bmo->data); break; } return 1; } -static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, float *vec_from, int index) +static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, int index) { float f[4]; /* lazy, avoid repeteing the case statement */ - if(!mathutils_obactu_vector_get(bmo, subtype, f)) + if(!mathutils_obactu_vector_get(bmo, subtype)) return 0; - vec_from[index]= f[index]; + bmo->data[index]= f[index]; return 1; } -static int mathutils_obactu_vector_set_index(BaseMathObject *bmo, int subtype, float *vec_to, int index) +static int mathutils_obactu_vector_set_index(BaseMathObject *bmo, int subtype, int index) { - float f= vec_to[index]; + float f= bmo->data[index]; /* lazy, avoid repeteing the case statement */ - if(!mathutils_obactu_vector_get(bmo, subtype, vec_to)) + if(!mathutils_obactu_vector_get(bmo, subtype)) return 0; - vec_to[index]= f; - mathutils_obactu_vector_set(bmo, subtype, vec_to); + bmo->data[index]= f; + mathutils_obactu_vector_set(bmo, subtype); return 1; } -- cgit v1.2.3 From 857f14714a87fac0f9c530f05bd6e6099f0fe9f0 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 25 May 2010 12:40:33 +0000 Subject: Merge with trunk, revision 28528 - 28976. --- source/gameengine/Converter/BL_ArmatureObject.cpp | 2 +- .../Converter/BL_BlenderDataConversion.cpp | 6 +- .../gameengine/Converter/BL_ModifierDeformer.cpp | 16 + source/gameengine/Converter/BL_ModifierDeformer.h | 1 + source/gameengine/Expressions/ListValue.cpp | 6 +- .../GamePlayer/ghost/GPG_Application.cpp | 5 +- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 6 +- source/gameengine/Ketsji/KX_GameObject.cpp | 7 +- source/gameengine/Ketsji/KX_ObjectActuator.cpp | 3 - source/gameengine/Ketsji/KX_PythonInit.cpp | 7 + source/gameengine/Ketsji/KX_PythonInit.h | 1 + source/gameengine/Ketsji/KX_PythonSeq.cpp | 2 + source/gameengine/Ketsji/KX_Scene.cpp | 10 +- source/gameengine/PyDoc/GameKeys.py | 190 - source/gameengine/PyDoc/GameLogic.py | 518 -- source/gameengine/PyDoc/GameTypes.py | 6184 -------------------- source/gameengine/PyDoc/Rasterizer.py | 221 - source/gameengine/PyDoc/bge.events.rst | 194 + source/gameengine/PyDoc/bge.logic.rst | 622 ++ source/gameengine/PyDoc/bge.render.rst | 231 + source/gameengine/PyDoc/bge.types.rst | 4339 ++++++++++++++ 21 files changed, 5432 insertions(+), 7139 deletions(-) delete mode 100644 source/gameengine/PyDoc/GameKeys.py delete mode 100644 source/gameengine/PyDoc/GameLogic.py delete mode 100644 source/gameengine/PyDoc/GameTypes.py delete mode 100644 source/gameengine/PyDoc/Rasterizer.py create mode 100644 source/gameengine/PyDoc/bge.events.rst create mode 100644 source/gameengine/PyDoc/bge.logic.rst create mode 100644 source/gameengine/PyDoc/bge.render.rst create mode 100644 source/gameengine/PyDoc/bge.types.rst (limited to 'source/gameengine') diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index 78f16dd6982..217011517eb 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -93,7 +93,7 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) BLI_duplicatelist(&out->chanbase, &src->chanbase); /* remap pointers */ - ghash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp); + ghash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "game_copy_pose gh"); pchan= (bPoseChannel*)src->chanbase.first; outpchan= (bPoseChannel*)out->chanbase.first; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 4a2aa3695fa..2f0f70ed9fe 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1729,7 +1729,7 @@ static KX_GameObject *gameobject_from_blenderobject( // only support relative shape key bool bHasShapeKey = mesh->key != NULL && mesh->key->type==KEY_RELATIVE; bool bHasDvert = mesh->dvert != NULL && ob->defbase.first; - bool bHasArmature = (ob->parent && ob->parent->type == OB_ARMATURE && ob->partype==PARSKEL && bHasDvert); + bool bHasArmature = (BL_ModifierDeformer::HasArmatureDeformer(ob) && ob->parent && ob->parent->type == OB_ARMATURE && bHasDvert); bool bHasModifier = BL_ModifierDeformer::HasCompatibleDeformer(ob); bool bHasSoftBody = (!ob->parent && (ob->gameflag & OB_SOFT_BODY)); @@ -2357,8 +2357,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie, if (me->dvert){ BL_DeformableGameObject *obj = (BL_DeformableGameObject*)converter->FindGameObject(blenderobj); - - if (obj && blenderobj->parent && blenderobj->parent->type==OB_ARMATURE && blenderobj->partype==PARSKEL){ + + if (obj && BL_ModifierDeformer::HasArmatureDeformer(blenderobj) && blenderobj->parent && blenderobj->parent->type==OB_ARMATURE){ KX_GameObject *par = converter->FindGameObject(blenderobj->parent); if (par && obj->GetDeformer()) ((BL_SkinDeformer*)obj->GetDeformer())->SetArmature((BL_ArmatureObject*) par); diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp index e28ea47b162..5ccf8de29b1 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.cpp +++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp @@ -114,11 +114,27 @@ bool BL_ModifierDeformer::HasCompatibleDeformer(Object *ob) continue; if (!(md->mode & eModifierMode_Realtime)) continue; + /* armature modifier are handled by SkinDeformer, not ModifierDeformer */ + if (md->type == eModifierType_Armature ) + continue; return true; } return false; } +bool BL_ModifierDeformer::HasArmatureDeformer(Object *ob) +{ + if (!ob->modifiers.first) + return false; + + ModifierData* md; + for (md = (ModifierData*)ob->modifiers.first; md; md = (ModifierData*)md->next) { + if (md->type == eModifierType_Armature ) + return true; + } + return false; +} + bool BL_ModifierDeformer::Update(void) { bool bShapeUpdate = BL_ShapeDeformer::Update(); diff --git a/source/gameengine/Converter/BL_ModifierDeformer.h b/source/gameengine/Converter/BL_ModifierDeformer.h index 1122d5e8b32..adf537110f1 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.h +++ b/source/gameengine/Converter/BL_ModifierDeformer.h @@ -45,6 +45,7 @@ class BL_ModifierDeformer : public BL_ShapeDeformer { public: static bool HasCompatibleDeformer(Object *ob); + static bool HasArmatureDeformer(Object *ob); BL_ModifierDeformer(BL_DeformableGameObject *gameobj, diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 75aff67424b..4d9d82efb98 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -362,8 +362,8 @@ PyObject* listvalue_buffer_slice(PyObject* self,Py_ssize_t ilow, Py_ssize_t ihig if (ihigh >= n) ihigh = n; - if (ihigh < ilow) - ihigh = ilow; + if (ihigh < ilow) + ihigh = ilow; newlist = PyList_New(ihigh - ilow); if (!newlist) @@ -491,6 +491,8 @@ static PySequenceMethods listvalue_as_sequence = { NULL, /*sq_ass_item*/ NULL, /*sq_ass_slice*/ (objobjproc)listvalue_buffer_contains, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 7c3a6adf881..71507642226 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -794,10 +794,7 @@ void GPG_Application::exitEngine() m_canvas = 0; } - libtiff_exit(); -#ifdef WITH_QUICKTIME - quicktime_exit(); -#endif + IMB_exit(); GPU_extensions_exit(); m_exitRequested = 0; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 9d87adb7400..b7ed8666325 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -376,11 +376,7 @@ int main(int argc, char** argv) GEN_init_messaging_system(); -#ifdef WITH_QUICKTIME - quicktime_init(); -#endif - - libtiff_init(); + IMB_init(); // Parse command line options #ifndef NDEBUG diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index e5fb78daceb..abc597a9eae 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1355,12 +1355,9 @@ static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype) static int mathutils_kxgameob_vector_get_index(BaseMathObject *bmo, int subtype, int index) { - float f[4]; /* lazy, avoid repeteing the case statement */ if(!mathutils_kxgameob_vector_get(bmo, subtype)) return 0; - - bmo->data[index]= f[index]; return 1; } @@ -1742,6 +1739,8 @@ PySequenceMethods KX_GameObject::Sequence = { NULL, /* sq_ass_item */ NULL, /* sq_ass_slice */ (objobjproc)Seq_Contains, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; PyTypeObject KX_GameObject::Type = { @@ -2736,7 +2735,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo, KX_RayCast::Callback callback(this,spc); KX_RayCast::RayTest(pe, fromPoint, toPoint, callback); - if (m_pHitObject) + if (m_pHitObject) return m_pHitObject->GetProxy(); Py_RETURN_NONE; diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index 460e4369c5b..dff95551d70 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -430,12 +430,9 @@ static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype) static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, int index) { - float f[4]; /* lazy, avoid repeteing the case statement */ if(!mathutils_obactu_vector_get(bmo, subtype)) return 0; - - bmo->data[index]= f[index]; return 1; } diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index f47c168d745..0198555753e 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -41,6 +41,7 @@ extern "C" { #include "mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use. #include "geometry.h" // Blender.Geometry module copied here so the blenderlayer can use. #include "bgl.h" + #include "blf_api.h" #include "marshal.h" /* python header for loading/saving dicts */ } @@ -1981,6 +1982,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main * initMathutils(); initGeometry(); initBGL(); + initBLF(); #ifdef WITH_FFMPEG initVideoTexture(); @@ -2306,6 +2308,11 @@ PyObject* initBGL() return BGL_Init(); } +PyObject* initBLF() +{ + return BLF_Init(); +} + // utility function for loading and saving the globalDict int saveGamePythonConfig( char **marshal_buffer) { diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h index 7c2b1226bdb..fb59a2f21eb 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.h +++ b/source/gameengine/Ketsji/KX_PythonInit.h @@ -47,6 +47,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur PyObject* initMathutils(); PyObject* initGeometry(); PyObject* initBGL(); +PyObject* initBLF(); PyObject* initVideoTexture(void); void exitGamePlayerPythonScripting(); PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie); diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index f28c9518ac4..8ffd58a781b 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -324,6 +324,8 @@ PySequenceMethods KX_PythonSeq_as_sequence = { NULL, /* sq_ass_item */ NULL, /* sq_ass_slice */ (objobjproc)KX_PythonSeq_contains, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; static PyMappingMethods KX_PythonSeq_as_mapping = { diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index f805b693d0b..d72fef166e6 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -962,8 +962,8 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj) { m_logicmgr->RemoveSensor(*its); } - - SCA_ControllerList& controllers = newobj->GetControllers(); + + SCA_ControllerList& controllers = newobj->GetControllers(); for (SCA_ControllerList::iterator itc = controllers.begin(); !(itc==controllers.end());itc++) { @@ -1067,12 +1067,12 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u bool bHasShapeKey = blendmesh->key != NULL && blendmesh->key->type==KEY_RELATIVE; bool bHasDvert = blendmesh->dvert != NULL; bool bHasArmature = + BL_ModifierDeformer::HasArmatureDeformer(blendobj) && parentobj && // current parent is armature parentobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE && oldblendobj && // needed for mesh deform blendobj->parent && // original object had armature (not sure this test is needed) - blendobj->parent->type == OB_ARMATURE && - blendobj->partype==PARSKEL && + blendobj->parent->type == OB_ARMATURE && blendmesh->dvert!=NULL; // mesh has vertex group bool bHasSoftBody = (!parentobj && (blendobj->gameflag & OB_SOFT_BODY)); @@ -1999,6 +1999,8 @@ PySequenceMethods KX_Scene::Sequence = { NULL, /* sq_ass_item */ NULL, /* sq_ass_slice */ (objobjproc)Seq_Contains, /* sq_contains */ + (binaryfunc) NULL, /* sq_inplace_concat */ + (ssizeargfunc) NULL, /* sq_inplace_repeat */ }; PyObject* KX_Scene::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) diff --git a/source/gameengine/PyDoc/GameKeys.py b/source/gameengine/PyDoc/GameKeys.py deleted file mode 100644 index 1c4f45ddbab..00000000000 --- a/source/gameengine/PyDoc/GameKeys.py +++ /dev/null @@ -1,190 +0,0 @@ -# $Id$ -""" -Documentation for the GameKeys module. -====================================== - -This module holds key constants for the SCA_KeyboardSensor. - - -Example:: - # Set a connected keyboard sensor to accept F1 - import GameLogic - import GameKeys - - co = GameLogic.getCurrentController() - # 'Keyboard' is a keyboard sensor - sensor = co.sensors["Keyboard"] - sensor.key = GameKeys.F1KEY - -Example:: - # Do the all keys thing - import GameLogic - import GameKeys - - co = GameLogic.getCurrentController() - # 'Keyboard' is a keyboard sensor - sensor = co.sensors["Keyboard"] - - for key,status in sensor.events: - # key[0] == GameKeys.keycode, key[1] = status - if status == GameLogic.KX_INPUT_JUST_ACTIVATED: - if key == GameKeys.WKEY: - # Activate Forward! - if key == GameKeys.SKEY: - # Activate Backward! - if key == GameKeys.AKEY: - # Activate Left! - if key == GameKeys.DKEY: - # Activate Right! - -@group Alphabet keys: AKEY, BKEY, CKEY, DKEY, EKEY, FKEY, GKEY, HKEY, IKEY, JKEY, KKEY, LKEY, MKEY, NKEY, OKEY, PKEY, QKEY, RKEY, SKEY, TKEY, UKEY, VKEY, WKEY, XKEY, YKEY, ZKEY -@var AKEY: -@var BKEY: -@var CKEY: -@var DKEY: -@var EKEY: -@var FKEY: -@var GKEY: -@var HKEY: -@var IKEY: -@var JKEY: -@var KKEY: -@var LKEY: -@var MKEY: -@var NKEY: -@var OKEY: -@var PKEY: -@var QKEY: -@var RKEY: -@var SKEY: -@var TKEY: -@var UKEY: -@var VKEY: -@var WKEY: -@var XKEY: -@var YKEY: -@var ZKEY: - -@group Number keys: ZEROKEY, ONEKEY, TWOKEY, THREEKEY, FOURKEY, FIVEKEY, SIXKEY, SEVENKEY, EIGHTKEY, NINEKEY -@var ZEROKEY: -@var ONEKEY: -@var TWOKEY: -@var THREEKEY: -@var FOURKEY: -@var FIVEKEY: -@var SIXKEY: -@var SEVENKEY: -@var EIGHTKEY: -@var NINEKEY: - -@group Modifiers: CAPSLOCKKEY, LEFTCTRLKEY, LEFTALTKEY, RIGHTALTKEY, RIGHTCTRLKEY, RIGHTSHIFTKEY, LEFTSHIFTKEY -@var CAPSLOCKKEY: -@var LEFTCTRLKEY: -@var LEFTALTKEY: -@var RIGHTALTKEY: -@var RIGHTCTRLKEY: -@var RIGHTSHIFTKEY: -@var LEFTSHIFTKEY: - -@group Arrow Keys: LEFTARROWKEY, DOWNARROWKEY, RIGHTARROWKEY, UPARROWKEY -@var LEFTARROWKEY: -@var DOWNARROWKEY: -@var RIGHTARROWKEY: -@var UPARROWKEY: - -@group Numberpad Keys: PAD0, PAD1, PAD2, PAD3, PAD4, PAD5, PAD6, PAD7, PAD8, PAD9, PADPERIOD, PADSLASHKEY, PADASTERKEY, PADMINUS, PADENTER, PADPLUSKEY -@var PAD0: -@var PAD1: -@var PAD2: -@var PAD3: -@var PAD4: -@var PAD5: -@var PAD6: -@var PAD7: -@var PAD8: -@var PAD9: -@var PADPERIOD: -@var PADSLASHKEY: -@var PADASTERKEY: -@var PADMINUS: -@var PADENTER: -@var PADPLUSKEY: - -@group Function Keys: F1KEY, F2KEY, F3KEY, F4KEY, F5KEY, F6KEY, F7KEY, F8KEY, F9KEY, F10KEY, F11KEY, F12KEY, F13KEY, F14KEY, F15KEY, F16KEY, F17KEY, F18KEY, F19KEY -@var F1KEY: -@var F2KEY: -@var F3KEY: -@var F4KEY: -@var F5KEY: -@var F6KEY: -@var F7KEY: -@var F8KEY: -@var F9KEY: -@var F10KEY: -@var F11KEY: -@var F12KEY: -@var F13KEY: -@var F14KEY: -@var F15KEY: -@var F16KEY: -@var F17KEY: -@var F18KEY: -@var F19KEY: - -@group Other Keys: ACCENTGRAVEKEY, BACKSLASHKEY, BACKSPACEKEY, COMMAKEY, DELKEY, ENDKEY, EQUALKEY, ESCKEY, HOMEKEY, INSERTKEY, LEFTBRACKETKEY, LINEFEEDKEY, MINUSKEY, PAGEDOWNKEY, PAGEUPKEY, PAUSEKEY, PERIODKEY, QUOTEKEY, RIGHTBRACKETKEY, RETKEY, SEMICOLONKEY, SLASHKEY, SPACEKEY, TABKEY -@var ACCENTGRAVEKEY: -@var BACKSLASHKEY: -@var BACKSPACEKEY: -@var COMMAKEY: -@var DELKEY: -@var ENDKEY: -@var EQUALKEY: -@var ESCKEY: -@var HOMEKEY: -@var INSERTKEY: -@var LEFTBRACKETKEY: -@var LINEFEEDKEY: -@var MINUSKEY: -@var PAGEDOWNKEY: -@var PAGEUPKEY: -@var PAUSEKEY: -@var PERIODKEY: -@var QUOTEKEY: -@var RIGHTBRACKETKEY: -@var RETKEY: -@var SEMICOLONKEY: -@var SLASHKEY: -@var SPACEKEY: -@var TABKEY: - -@group Mouse Events: LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEX, MOUSEY -@var LEFTMOUSE: -@var MIDDLEMOUSE: -@var RIGHTMOUSE: -@var WHEELUPMOUSE: -@var WHEELDOWNMOUSE: -@var MOUSEX: -@var MOUSEY: - -""" - -def EventToString(event): - """ - Return the string name of a key event. Will raise a ValueError error if its invalid. - - @type event: int - @param event: key event from GameKeys or the keyboard sensor. - @rtype: string - """ - -def EventToCharacter(event, shift): - """ - Return the string name of a key event. Returns an empty string if the event cant be represented as a character. - - @type event: int - @param event: key event from GameKeys or the keyboard sensor. - @type shift: bool - @param shift: set to true if shift is held. - @rtype: string - """ - diff --git a/source/gameengine/PyDoc/GameLogic.py b/source/gameengine/PyDoc/GameLogic.py deleted file mode 100644 index 5eb0fecd94c..00000000000 --- a/source/gameengine/PyDoc/GameLogic.py +++ /dev/null @@ -1,518 +0,0 @@ -# $Id$ -""" -Documentation for the GameLogic Module. -======================================= - - Module to access logic functions, imported automatically into the python controllers namespace. - - Examples:: - # To get the controller thats running this python script: - cont = GameLogic.getCurrentController() # GameLogic is automatically imported - - # To get the game object this controller is on: - obj = cont.owner - L{KX_GameObject} and L{KX_Camera} or L{KX_LightObject} methods are - available depending on the type of object:: - # To get a sensor linked to this controller. - # "sensorname" is the name of the sensor as defined in the Blender interface. - # +---------------------+ +--------+ - # | Sensor "sensorname" +--+ Python + - # +---------------------+ +--------+ - sens = cont.sensors["sensorname"] - - # To get a sequence of all sensors: - sensors = co.sensors - - See the sensor's reference for available methods: - - L{DelaySensor} - - L{JoystickSensor} - - L{KeyboardSensor} - - L{MouseFocusSensor} - - L{MouseSensor} - - L{NearSensor} - - L{NetworkMessageSensor} - - L{PropertySensor} - - L{RadarSensor} - - L{RandomSensor} - - L{RaySensor} - - L{TouchSensor} - - You can also access actuators linked to the controller:: - # To get an actuator attached to the controller: - # +--------+ +-------------------------+ - # + Python +--+ Actuator "actuatorname" | - # +--------+ +-------------------------+ - actuator = co.actuators["actuatorname"] - - # Activate an actuator - controller.activate(actuator) - - See the actuator's reference for available methods: - - L{2DFilterActuator} - - L{ActionActuator} - - L{AddObjectActuator} - - L{CameraActuator} - - L{ConstraintActuator} - - L{DynamicActuator} - - L{EndObjectActuator} - - L{GameActuator} - - L{IpoActuator} - - L{NetworkMessageActuator} - - L{ObjectActuator} - - L{ParentActuator} - - L{PropertyActuator} - - L{RandomActuator} - - L{ReplaceMeshActuator} - - L{SceneActuator} - - L{ShapeActionActuator} - - L{SoundActuator} - - L{StateActuator} - - L{TrackToActuator} - - L{VisibilityActuator} - - Most logic brick's methods are accessors for the properties available in the logic buttons. - Consult the logic bricks documentation for more information on how each logic brick works. - - There are also methods to access the current L{KX_Scene}:: - # Get the current scene - scene = GameLogic.getCurrentScene() - - # Get the current camera - cam = scene.active_camera - - Matricies as used by the game engine are B{row major}:: - matrix[row][col] = float - L{KX_Camera} has some examples using matricies. - - -@group Constants: KX_TRUE, KX_FALSE -@var KX_TRUE: True value used by some modules. -@var KX_FALSE: False value used by some modules. - -@group Property Sensor: KX_PROPSENSOR_* -@var KX_PROPSENSOR_EQUAL: Activate when the property is equal to the sensor value. -@var KX_PROPSENSOR_NOTEQUAL: Activate when the property is not equal to the sensor value. -@var KX_PROPSENSOR_INTERVAL: Activate when the property is between the specified limits. -@var KX_PROPSENSOR_CHANGED: Activate when the property changes -@var KX_PROPSENSOR_EXPRESSION: Activate when the expression matches - -@group Constraint Actuator: KX_CONSTRAINTACT_* -@var KX_CONSTRAINTACT_LOCX: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_LOCY: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_LOCZ: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_ROTX: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_ROTY: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_ROTZ: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_DIRNX: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_DIRNY: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_DIRPX: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_DIRPY: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_ORIX: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_ORIY: See L{KX_ConstraintActuator} -@var KX_CONSTRAINTACT_ORIZ: See L{KX_ConstraintActuator} - -@group IPO Actuator: KX_IPOACT_* -@var KX_IPOACT_PLAY: See L{KX_IpoActuator} -@var KX_IPOACT_PINGPONG: See L{KX_IpoActuator} -@var KX_IPOACT_FLIPPER: See L{KX_IpoActuator} -@var KX_IPOACT_LOOPSTOP: See L{KX_IpoActuator} -@var KX_IPOACT_LOOPEND: See L{KX_IpoActuator} -@var KX_IPOACT_FROM_PROP: See L{KX_IpoActuator} - -@group Random Distributions: KX_RANDOMACT_* -@var KX_RANDOMACT_BOOL_CONST: See L{SCA_RandomActuator} -@var KX_RANDOMACT_BOOL_UNIFORM: See L{SCA_RandomActuator} -@var KX_RANDOMACT_BOOL_BERNOUILLI: See L{SCA_RandomActuator} -@var KX_RANDOMACT_INT_CONST: See L{SCA_RandomActuator} -@var KX_RANDOMACT_INT_UNIFORM: See L{SCA_RandomActuator} -@var KX_RANDOMACT_INT_POISSON: See L{SCA_RandomActuator} -@var KX_RANDOMACT_FLOAT_CONST: See L{SCA_RandomActuator} -@var KX_RANDOMACT_FLOAT_UNIFORM: See L{SCA_RandomActuator} -@var KX_RANDOMACT_FLOAT_NORMAL: See L{SCA_RandomActuator} -@var KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL: See L{SCA_RandomActuator} - -@group Action Actuator: KX_ACTIONACT_* -@var KX_ACTIONACT_PLAY: See L{BL_ActionActuator} -@var KX_ACTIONACT_FLIPPER: See L{BL_ActionActuator} -@var KX_ACTIONACT_LOOPSTOP: See L{BL_ActionActuator} -@var KX_ACTIONACT_LOOPEND: See L{BL_ActionActuator} -@var KX_ACTIONACT_PROPERTY: See L{BL_ActionActuator} - -@group Sound Actuator: KX_SOUNDACT_* -@var KX_SOUNDACT_PLAYSTOP: See L{KX_SoundActuator} -@var KX_SOUNDACT_PLAYEND: See L{KX_SoundActuator} -@var KX_SOUNDACT_LOOPSTOP: See L{KX_SoundActuator} -@var KX_SOUNDACT_LOOPEND: See L{KX_SoundActuator} -@var KX_SOUNDACT_LOOPBIDIRECTIONAL: See L{KX_SoundActuator} -@var KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: See L{KX_SoundActuator} - -@group Radar Sensor: KX_RADAR_* -@var KX_RADAR_AXIS_POS_X: See L{KX_RadarSensor} -@var KX_RADAR_AXIS_POS_Y: See L{KX_RadarSensor} -@var KX_RADAR_AXIS_POS_Z: See L{KX_RadarSensor} -@var KX_RADAR_AXIS_NEG_X: See L{KX_RadarSensor} -@var KX_RADAR_AXIS_NEG_Y: See L{KX_RadarSensor} -@var KX_RADAR_AXIS_NEG_Z: See L{KX_RadarSensor} - -@group Ray Sensor: KX_RAY_* -@var KX_RAY_AXIS_POS_X: See L{KX_RaySensor} -@var KX_RAY_AXIS_POS_Y: See L{KX_RaySensor} -@var KX_RAY_AXIS_POS_Z: See L{KX_RaySensor} -@var KX_RAY_AXIS_NEG_X: See L{KX_RaySensor} -@var KX_RAY_AXIS_NEG_Y: See L{KX_RaySensor} -@var KX_RAY_AXIS_NEG_Z: See L{KX_RaySensor} - -@group Dynamic Actuator: KX_DYN_* -@var KX_DYN_RESTORE_DYNAMICS: See L{KX_SCA_DynamicActuator} -@var KX_DYN_DISABLE_DYNAMICS: See L{KX_SCA_DynamicActuator} -@var KX_DYN_ENABLE_RIGID_BODY: See L{KX_SCA_DynamicActuator} -@var KX_DYN_DISABLE_RIGID_BODY: See L{KX_SCA_DynamicActuator} -@var KX_DYN_SET_MASS: See L{KX_SCA_DynamicActuator} - -@group Game Actuator: KX_GAME_* -@var KX_GAME_LOAD: See L{KX_GameActuator} -@var KX_GAME_START: See L{KX_GameActuator} -@var KX_GAME_RESTART: See L{KX_GameActuator} -@var KX_GAME_QUIT: See L{KX_GameActuator} -@var KX_GAME_SAVECFG: See L{KX_GameActuator} -@var KX_GAME_LOADCFG: See L{KX_GameActuator} - -@group Scene Actuator: KX_SCENE_* -@var KX_SCENE_RESTART: See L{KX_SceneActuator} -@var KX_SCENE_SET_SCENE: See L{KX_SceneActuator} -@var KX_SCENE_SET_CAMERA: See L{KX_SceneActuator} -@var KX_SCENE_ADD_FRONT_SCENE: See L{KX_SceneActuator} -@var KX_SCENE_ADD_BACK_SCENE: See L{KX_SceneActuator} -@var KX_SCENE_REMOVE_SCENE: See L{KX_SceneActuator} -@var KX_SCENE_SUSPEND: See L{KX_SceneActuator} -@var KX_SCENE_RESUME: See L{KX_SceneActuator} - -@group Input Status: KX_INPUT_* -@var KX_INPUT_NONE: See L{SCA_MouseSensor} -@var KX_INPUT_JUST_ACTIVATED: See L{SCA_MouseSensor} -@var KX_INPUT_ACTIVE: See L{SCA_MouseSensor} -@var KX_INPUT_JUST_RELEASED: See L{SCA_MouseSensor} - - -@group Mouse Buttons: KX_MOUSE_BUT_* -@var KX_MOUSE_BUT_LEFT: See L{SCA_MouseSensor} -@var KX_MOUSE_BUT_MIDDLE: See L{SCA_MouseSensor} -@var KX_MOUSE_BUT_RIGHT: See L{SCA_MouseSensor} - -@group States: KX_STATE* -@var KX_STATE1: -@var KX_STATE10: -@var KX_STATE11: -@var KX_STATE12: -@var KX_STATE13: -@var KX_STATE14: -@var KX_STATE15: -@var KX_STATE16: -@var KX_STATE17: -@var KX_STATE18: -@var KX_STATE19: -@var KX_STATE2: -@var KX_STATE20: -@var KX_STATE21: -@var KX_STATE22: -@var KX_STATE23: -@var KX_STATE24: -@var KX_STATE25: -@var KX_STATE26: -@var KX_STATE27: -@var KX_STATE28: -@var KX_STATE29: -@var KX_STATE3: -@var KX_STATE30: -@var KX_STATE4: -@var KX_STATE5: -@var KX_STATE6: -@var KX_STATE7: -@var KX_STATE8: -@var KX_STATE9: -@var KX_STATE_OP_CLR: -@var KX_STATE_OP_CPY: -@var KX_STATE_OP_NEG: -@var KX_STATE_OP_SET: - -@group 2D Filter: RAS_2DFILTER_* -@var RAS_2DFILTER_BLUR: -@var RAS_2DFILTER_CUSTOMFILTER: -@var RAS_2DFILTER_DILATION: -@var RAS_2DFILTER_DISABLED: -@var RAS_2DFILTER_ENABLED: -@var RAS_2DFILTER_EROSION: -@var RAS_2DFILTER_GRAYSCALE: -@var RAS_2DFILTER_INVERT: -@var RAS_2DFILTER_LAPLACIAN: -@var RAS_2DFILTER_MOTIONBLUR: -@var RAS_2DFILTER_NOFILTER: -@var RAS_2DFILTER_PREWITT: -@var RAS_2DFILTER_SEPIA: -@var RAS_2DFILTER_SHARPEN: -@var RAS_2DFILTER_SOBEL: - -@group Constraint Actuator: KX_ACT_CONSTRAINT_* -@var KX_ACT_CONSTRAINT_DISTANCE: -@var KX_ACT_CONSTRAINT_DOROTFH: -@var KX_ACT_CONSTRAINT_FHNX: -@var KX_ACT_CONSTRAINT_FHNY: -@var KX_ACT_CONSTRAINT_FHNZ: -@var KX_ACT_CONSTRAINT_FHPX: -@var KX_ACT_CONSTRAINT_FHPY: -@var KX_ACT_CONSTRAINT_FHPZ: -@var KX_ACT_CONSTRAINT_LOCAL: -@var KX_ACT_CONSTRAINT_MATERIAL: -@var KX_ACT_CONSTRAINT_NORMAL: -@var KX_ACT_CONSTRAINT_PERMANENT: - -@group Parent Actuator: KX_PARENT_* -@var KX_PARENT_REMOVE: -@var KX_PARENT_SET: - -@group Shader: MODELMATRIX*, MODELVIEWMATRIX*, VIEWMATRIX*, CAM_POS, CONSTANT_TIMER, SHD_TANGENT -@var VIEWMATRIX: -@var VIEWMATRIX_INVERSE: -@var VIEWMATRIX_INVERSETRANSPOSE: -@var VIEWMATRIX_TRANSPOSE: -@var MODELMATRIX: -@var MODELMATRIX_INVERSE: -@var MODELMATRIX_INVERSETRANSPOSE: -@var MODELMATRIX_TRANSPOSE: -@var MODELVIEWMATRIX: -@var MODELVIEWMATRIX_INVERSE: -@var MODELVIEWMATRIX_INVERSETRANSPOSE: -@var MODELVIEWMATRIX_TRANSPOSE: -@var CAM_POS: Current camera position -@var CONSTANT_TIMER: User a timer for the uniform value. -@var SHD_TANGENT: Not yet documented. - -@group Blender Material: BL_* -@var BL_DST_ALPHA: -@var BL_DST_COLOR: -@var BL_ONE: -@var BL_ONE_MINUS_DST_ALPHA: -@var BL_ONE_MINUS_DST_COLOR: -@var BL_ONE_MINUS_SRC_ALPHA: -@var BL_ONE_MINUS_SRC_COLOR: -@var BL_SRC_ALPHA: -@var BL_SRC_ALPHA_SATURATE: -@var BL_SRC_COLOR: -@var BL_ZERO: - -@group Deprecated: addActiveActuator - -@var globalDict: A dictionary that is saved between loading blend files so you can use - it to store inventory and other variables you want to store between - scenes and blend files. It can also be written to a file and loaded - later on with the game load/save actuators. - note: only python built in types such as int/string/bool/float/tuples/lists - can be saved, GameObjects, Actuators etc will not work as expectred. - -@var keyboard: The current keyboard wrapped in an SCA_PythonKeyboard object. -@var mouse: The current mouse wrapped in an SCA_PythonMouse object. -""" - -import GameTypes - -# TODO -# error - -def getCurrentController(): - """ - Gets the Python controller associated with this Python script. - - @rtype: L{SCA_PythonController} - """ -def getCurrentScene(): - """ - Gets the current Scene. - - @rtype: L{KX_Scene} - """ -def getSceneList(): - """ - Gets a list of the current scenes loaded in the game engine. - - @note: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes. - - @rtype: list of L{KX_Scene} - """ -def addActiveActuator(actuator, activate): - """ - Activates the given actuator. - - @deprecated: Use L{GameTypes.SCA_PythonController.activate} and L{GameTypes.SCA_PythonController.deactivate} instead. - @type actuator: L{SCA_IActuator} or the actuator name as a string. - @type activate: boolean - @param activate: whether to activate or deactivate the given actuator. - """ -def loadGlobalDict(): - """ - Loads GameLogic.globalDict from a file. - """ -def saveGlobalDict(): - """ - Saves GameLogic.globalDict to a file. - """ -def addScene(name, overlay=1): - """ - Loads a scene into the game engine. - - @param name: The name of the scene - @type name: string - @param overlay: Overlay or underlay (optional) - @type overlay: int - """ -def sendMessage(subject, body="", to="", message_from=""): - """ - Sends a message to sensors in any active scene. - - @param subject: The subject of the message - @type subject: string - @param body: The body of the message (optional) - @type body: string - @param to: The name of the object to send the message to (optional) - @type to: string - @param message_from: The name of the object that the message is coming from (optional) - @type message_from: string - """ -def setGravity(gravity): - """ - Sets the world gravity. - - @type gravity: list [fx, fy, fz] - """ -def getSpectrum(): - """ - Returns a 512 point list from the sound card. - This only works if the fmod sound driver is being used. - - @rtype: list [float], len(getSpectrum()) == 512 - """ -def stopDSP(): - """ - Stops the sound driver using DSP effects. - - Only the fmod sound driver supports this. - DSP can be computationally expensive. - """ -def getMaxLogicFrame(): - """ - Gets the maximum number of logic frame per render frame. - - @return: The maximum number of logic frame per render frame - @rtype: integer - """ -def setMaxLogicFrame(maxlogic): - """ - Sets the maximum number of logic frame that are executed per render frame. - This does not affect the physic system that still runs at full frame rate. - - @param maxlogic: The new maximum number of logic frame per render frame. Valid values: 1..5 - @type maxlogic: integer - """ -def getMaxPhysicsFrame(): - """ - Gets the maximum number of physics frame per render frame. - - @return: The maximum number of physics frame per render frame - @rtype: integer - """ -def setMaxPhysicsFrame(maxphysics): - """ - Sets the maximum number of physics timestep that are executed per render frame. - Higher value allows physics to keep up with realtime even if graphics slows down the game. - Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate) - maxphysics/ticrate is the maximum delay of the renderer that physics can compensate. - - @param maxphysics: The new maximum number of physics timestep per render frame. Valid values: 1..5. - @type maxphysics: integer - """ -def getLogicTicRate(): - """ - Gets the logic update frequency. - - @return: The logic frequency in Hz - @rtype: float - """ -def setLogicTicRate(ticrate): - """ - Sets the logic update frequency. - - The logic update frequency is the number of times logic bricks are executed every second. - The default is 60 Hz. - - @param ticrate: The new logic update frequency (in Hz). - @type ticrate: float - """ -def getPhysicsTicRate(): - """ - NOT IMPLEMENTED - Gets the physics update frequency - - @return: The physics update frequency in Hz - @rtype: float - """ -def setPhysicsTicRate(ticrate): - """ - NOT IMPLEMENTED - Sets the physics update frequency - - The physics update frequency is the number of times the physics system is executed every second. - The default is 60 Hz. - - @param ticrate: The new update frequency (in Hz). - @type ticrate: float - """ -def saveGlobalDict(): - """ - Saves GameLogic.globalDict to a file. - """ -def loadGlobalDict(): - """ - Loads GameLogic.globalDict from a file. - """ - -#{ Utility functions -def getAverageFrameRate(): - """ - Gets the estimated average framerate - - @return: The estimed average framerate in frames per second - @rtype: float - """ -def expandPath(path): - """ - Converts a blender internal path into a proper file system path. - - Use / as directory separator in path - You can use '//' at the start of the string to define a relative path; - Blender replaces that string by the directory of the startup .blend or runtime file - to make a full path name (doesn't change during the game, even if you load other .blend). - The function also converts the directory separator to the local file system format. - - @param path: The path string to be converted/expanded. - @type path: string - @return: The converted string - @rtype: string - """ - -def getBlendFileList(path = "//"): - """ - Returns a list of blend files in the same directory as the open blend file, or from using the option argument. - - @param path: Optional directory argument, will be expanded (like expandPath) into the full path. - @type path: string - @return: A list of filenames, with no directory prefix - @rtype: list - """ -def PrintGLInfo(): - """ - Prints GL Extension Info into the console - """ -def getRandomFloat(): - """ - Returns a random floating point value in the range [0...1) - """ -#} diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py deleted file mode 100644 index 22915de37c7..00000000000 --- a/source/gameengine/PyDoc/GameTypes.py +++ /dev/null @@ -1,6184 +0,0 @@ -""" -Documentation for the GameTypes Module. -======================================= - -@group Base: PyObjectPlus, CValue, CPropValue, SCA_ILogicBrick, SCA_IObject, SCA_ISensor, SCA_IController, SCA_IActuator - -@group Object: KX_GameObject, KX_LightObject, KX_Camera, BL_ArmatureObject - -@group Animation: BL_ArmatureConstraint - -@group Mesh: KX_MeshProxy, KX_PolyProxy, KX_VertexProxy - -@group Shading: KX_PolygonMaterial, KX_BlenderMaterial, BL_Shader - -@group Sensors: SCA_ActuatorSensor, SCA_AlwaysSensor, SCA_DelaySensor, SCA_JoystickSensor, SCA_KeyboardSensor, KX_MouseFocusSensor, SCA_MouseSensor, KX_NearSensor, KX_NetworkMessageSensor, SCA_PropertySensor, KX_RadarSensor, SCA_RandomSensor, KX_RaySensor, KX_TouchSensor, KX_ArmatureSensor - -@group Actuators: SCA_2DFilterActuator, BL_ActionActuator, BL_ArmatureActuator, KX_SCA_AddObjectActuator, KX_CameraActuator, KX_ConstraintActuator, KX_SCA_DynamicActuator, KX_SCA_EndObjectActuator, KX_GameActuator, KX_IpoActuator, KX_NetworkMessageActuator, KX_ObjectActuator, KX_ParentActuator, SCA_PropertyActuator, SCA_RandomActuator, KX_SCA_ReplaceMeshActuator, KX_SceneActuator, BL_ShapeActionActuator, KX_SoundActuator, KX_StateActuator, KX_TrackToActuator, KX_VisibilityActuator - -@group Controllers: SCA_ANDController, SCA_NANDController, SCA_NORController, SCA_ORController, SCA_PythonController, SCA_XNORController, SCA_XORController -""" -import GameLogic - -class PyObjectPlus: - """ - PyObjectPlus base class of most other types in the Game Engine. - - @ivar invalid: Test if the object has been freed by the game engine and is no longer valid. - - Normally this is not a problem but when storing game engine data in the GameLogic module, - KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data. - Calling an attribute or method on an invalid object will raise a SystemError. - - The invalid attribute allows testing for this case without exception handling. - @type invalid: bool - """ - - def isA(game_type): - """ - Check if this is a type or a subtype game_type. - - @param game_type: the name of the type or the type its self from the L{GameTypes} module. - @type game_type: string or type - @return: True if this object is a type or a subtype of game_type. - @rtype: bool - """ - -class CValue(PyObjectPlus): - """ - This class is a basis for other classes. - @ivar name: The name of this CValue derived object (read-only). - @type name: string - @group Deprecated: getName - """ - def getName(): - """ - Returns the name of the CValue. - - @deprecated: Use the L{name} attribute instead. - @note: in most cases the CValue's subclasses will override this function. - @rtype: string - """ - -class CPropValue(CValue): - """ - This class has no python functions - """ - pass - -class SCA_ILogicBrick(CValue): - """ - Base class for all logic bricks. - - @ivar executePriority: This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first). - @type executePriority: int - @ivar owner: The game object this logic brick is attached to (read-only). - @type owner: L{KX_GameObject} or None in exceptional cases. - @ivar name: The name of this logic brick (read-only). - @type name: string - """ - -#{ Deprecated - def getOwner(): - """ - Gets the game object associated with this logic brick. - - @deprecated: Use the L{owner} attribute instead. - @rtype: L{KX_GameObject} - """ - - def setExecutePriority(priority): - """ - Sets the priority of this logic brick. - - This determines the order controllers are evaluated, and actuators are activated. - Bricks with lower priority will be executed first. - - @deprecated: Use the L{executePriority} attribute instead. - @type priority: integer - @param priority: the priority of this logic brick. - """ - def getExecutePriority(): - """ - Gets the execution priority of this logic brick. - - @deprecated: Use the L{executePriority} attribute instead. - @rtype: integer - @return: this logic bricks current priority. - """ -#} - -class SCA_PythonKeyboard(PyObjectPlus): - """ - The current keyboard. - @ivar events: a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). - - - 'keycode' matches the values in L{GameKeys}. - - 'status' uses... - - L{GameLogic.KX_INPUT_NONE} - - L{GameLogic.KX_INPUT_JUST_ACTIVATED} - - L{GameLogic.KX_INPUT_ACTIVE} - - L{GameLogic.KX_INPUT_JUST_RELEASED} - - @type events: list [[keycode, status], ...] - """ - pass - -class SCA_PythonMouse(PyObjectPlus): - """ - The current mouse. - - @ivar events: a list of pressed buttons that have either been pressed, or just released, or are active this frame. (read-only). - - - 'keycode' matches the values in L{GameKeys}. - - 'status' uses... - - L{GameLogic.KX_INPUT_NONE} - - L{GameLogic.KX_INPUT_JUST_ACTIVATED} - - L{GameLogic.KX_INPUT_ACTIVE} - - L{GameLogic.KX_INPUT_JUST_RELEASED} - - @type events: list [[keycode, status], ...] - @ivar position: The normalized x and y position of the mouse cursor. - @type position: list [x, y] - @ivar visible: The visibility of the mouse cursor - @type visible: boolean - """ - pass - -class SCA_IObject(CValue): - """ - This class has no python functions - """ - pass - -class SCA_ISensor(SCA_ILogicBrick): - """ - Base class for all sensor logic bricks. - - @ivar usePosPulseMode: Flag to turn positive pulse mode on and off. - @type usePosPulseMode: boolean - @ivar useNegPulseMode: Flag to turn negative pulse mode on and off. - @type useNegPulseMode: boolean - @ivar frequency: The frequency for pulse mode sensors. - @type frequency: int - @ivar level: Option whether to detect level or edge transition when entering a state. - It makes a difference only in case of logic state transition (state actuator). - A level detector will immediately generate a pulse, negative or positive - depending on the sensor condition, as soon as the state is activated. - A edge detector will wait for a state change before generating a pulse. - note: mutually exclusive with L{tap}, enabling will disable L{tap}. - @type level: boolean - @ivar tap: When enabled only sensors that are just activated will send a positive event, - after this they will be detected as negative by the controllers. - This will make a key thats held act as if its only tapped for an instant. - note: mutually exclusive with L{level}, enabling will disable L{level}. - @type tap: boolean - @ivar invert: Flag to set if this sensor activates on positive or negative events. - @type invert: boolean - @ivar triggered: True if this sensor brick is in a positive state. (read-only) - @type triggered: boolean - @ivar positive: True if this sensor brick is in a positive state. (read-only) - @type positive: boolean - @ivar status: The status of the sensor. (read-only) - KX_SENSOR_INACTIVE, KX_SENSOR_JUST_ACTIVATED, - KX_SENSOR_ACTIVE, KX_SENSOR_JUST_DEACTIVATED - Note: this convenient attribute combines the values of triggered and positive attributes - @type status: int from 0-3. - """ - - def reset(): - """ - Reset sensor internal state, effect depends on the type of sensor and settings. - - The sensor is put in its initial state as if it was just activated. - """ -#{ Deprecated - def isPositive(): - """ - True if this sensor brick is in a positive state. - - @deprecated: use L{positive} - """ - - def isTriggered(): - """ - True if this sensor brick has triggered the current controller. - - @deprecated: use L{triggered} - """ - - def getUsePosPulseMode(): - """ - True if the sensor is in positive pulse mode. - - @deprecated: use L{usePosPulseMode} - """ - def setUsePosPulseMode(pulse): - """ - Sets positive pulse mode. - - @type pulse: boolean - @param pulse: If True, will activate positive pulse mode for this sensor. - @deprecated: use L{usePosPulseMode} - """ - def getFrequency(): - """ - The frequency for pulse mode sensors. - - @rtype: integer - @return: the pulse frequency in 1/50 sec. - @deprecated: use L{frequency} - """ - def setFrequency(freq): - """ - Sets the frequency for pulse mode sensors. - - @type freq: integer - @return: the pulse frequency in 1/50 sec. - @deprecated: use L{frequency} - """ - def getUseNegPulseMode(): - """ - True if the sensor is in negative pulse mode. - - @deprecated: use L{useNegPulseMode} - """ - def setUseNegPulseMode(pulse): - """ - Sets negative pulse mode. - - @type pulse: boolean - @param pulse: If True, will activate negative pulse mode for this sensor. - @deprecated: use L{useNegPulseMode} - """ - def getInvert(): - """ - True if this sensor activates on negative events. - - @deprecated: use L{invert} - """ - def setInvert(invert): - """ - Sets if this sensor activates on positive or negative events. - - @type invert: boolean - @param invert: true if activates on negative events; false if activates on positive events. - @deprecated: use L{invert} - """ - def getLevel(): - """ - Returns whether this sensor is a level detector or a edge detector. - It makes a difference only in case of logic state transition (state actuator). - A level detector will immediately generate a pulse, negative or positive - depending on the sensor condition, as soon as the state is activated. - A edge detector will wait for a state change before generating a pulse. - - @rtype: boolean - @return: true if sensor is level sensitive, false if it is edge sensitive - @deprecated: use L{level} - """ - def setLevel(level): - """ - Set whether to detect level or edge transition when entering a state. - - @param level: Detect level instead of edge? (KX_TRUE, KX_FALSE) - @type level: boolean - @deprecated: use L{level} - """ -#} - -class SCA_IController(SCA_ILogicBrick): - """ - Base class for all controller logic bricks. - - @ivar state: the controllers state bitmask. - This can be used with the GameObject's state to test if the controller is active. - @type state: int bitmask - @ivar sensors: a list of sensors linked to this controller - - note: the sensors are not necessarily owned by the same object. - - note: when objects are instanced in dupligroups links may be lost from objects outside the dupligroup. - @type sensors: sequence supporting index/string lookups and iteration. - @ivar actuators: a list of actuators linked to this controller. - - note: the sensors are not necessarily owned by the same object. - - note: when objects are instanced in dupligroups links may be lost from objects outside the dupligroup. - @type actuators: sequence supporting index/string lookups and iteration. - @ivar useHighPriority: When set the controller executes always before all other controllers that dont have this set. - note: Order of execution between high priority controllers is not guaranteed. - @type useHighPriority: bool - """ -#{ Deprecated - def getState(): - """ - Get the controllers state bitmask, this can be used with the GameObject's state to test if the the controller is active. - This for instance will always be true however you could compare with a previous state to see when the state was activated. - GameLogic.getCurrentController().state & GameLogic.getCurrentController().owner.state - @deprecated: Use the L{state} property - @rtype: int - """ - def getSensors(): - """ - Gets a list of all sensors attached to this controller. - @deprecated: use the L{sensors} property - @rtype: list [L{SCA_ISensor}] - """ - def getSensor(name): - """ - Gets the named linked sensor. - @deprecated: use the L{sensors}[name] property - @type name: string - @rtype: L{SCA_ISensor} - """ - def getActuators(): - """ - Gets a list of all actuators linked to this controller. - @deprecated: Use the L{actuators} property - @rtype: list [L{SCA_IActuator}] - """ - def getActuator(name): - """ - Gets the named linked actuator. - @deprecated: use the L{actuators}[name] property - @type name: string - @rtype: L{SCA_IActuator} - """ -#} - -class SCA_IActuator(SCA_ILogicBrick): - """ - Base class for all actuator logic bricks. - """ - -class BL_ActionActuator(SCA_IActuator): - """ - Action Actuators apply an action to an actor. - - @ivar action: The name of the action to set as the current action. - @type action: string - @ivar channelNames: A list of channel names that may be used with L{setChannel} and L{getChannel} - @type channelNames: list of strings - @ivar frameStart: Specifies the starting frame of the animation. - @type frameStart: float - @ivar frameEnd: Specifies the ending frame of the animation. - @type frameEnd: float - @ivar blendIn: Specifies the number of frames of animation to generate when making transitions between actions. - @type blendIn: float - @ivar priority: Sets the priority of this actuator. Actuators will lower - priority numbers will override actuators with higher - numbers. - @type priority: integer - @ivar frame: Sets the current frame for the animation. - @type frame: float - @ivar propName: Sets the property to be used in FromProp playback mode. - @type propName: string - @ivar blendTime: Sets the internal frame timer. This property must be in - the range from 0.0 to blendIn. - @type blendTime: float - @ivar mode: The operation mode of the actuator. KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND - @type mode: integer - @ivar useContinue: The actions continue option, True or False. - When True, the action will always play from where last left off, - otherwise negative events to this actuator will reset it to its start frame. - @type useContinue: boolean - @ivar framePropName: The name of the property that is set to the current frame number. - @type framePropName: string - """ - def setChannel(channel, matrix): - """ - Alternative to the 2 arguments, 4 arguments (channel, matrix, loc, size, quat) are also supported. - - @note: These values are relative to the bones rest position, currently the api has no way to get this info (which is annoying), but can be worked around by using bones with a rest pose that has no translation. - @param channel: A string specifying the name of the bone channel, error raised if not in L{channelNames}. - @type channel: string - @param matrix: A 4x4 matrix specifying the overriding transformation - as an offset from the bone's rest position. - @type matrix: list [[float]] - """ - - def getChannel(channel): - """ - @param channel: A string specifying the name of the bone channel. error raised if not in L{channelNames}. - @type channel: string - @rtype: tuple - @return: (loc, size, quat) - """ - -#{ Deprecated - def setAction(action, reset = True): - """ - Sets the current action. - @deprecated: use the L{action} property - @param action: The name of the action to set as the current action. - @type action: string - @param reset: Optional parameter indicating whether to reset the - blend timer or not. A value of 1 indicates that the - timer should be reset. A value of 0 will leave it - unchanged. If reset is not specified, the timer will - be reset. - """ - - def setStart(start): - """ - Specifies the starting frame of the animation. - @deprecated: Use the L{frameStart} property - @param start: the starting frame of the animation - @type start: float - """ - - def setEnd(end): - """ - Specifies the ending frame of the animation. - @deprecated: use the L{frameEnd} property - @param end: the ending frame of the animation - @type end: float - """ - def setBlendin(blendin): - """ - Specifies the number of frames of animation to generate - when making transitions between actions. - @deprecated: use the L{blendIn} property - @param blendin: the number of frames in transition. - @type blendin: float - """ - - def setPriority(priority): - """ - Sets the priority of this actuator. - - @deprecated: Use use the L{priority} property - @param priority: Specifies the new priority. Actuators will lower - priority numbers will override actuators with higher - numbers. - @type priority: integer - """ - def setFrame(frame): - """ - Sets the current frame for the animation. - - @deprecated: use the L{frame} property - @param frame: Specifies the new current frame for the animation - @type frame: float - """ - - def setProperty(prop): - """ - Sets the property to be used in FromProp playback mode. - - @deprecated: use the L{property} property - @param prop: the name of the property to use. - @type prop: string. - """ - - def setBlendtime(blendtime): - """ - Sets the internal frame timer. - - Allows the script to directly modify the internal timer - used when generating transitions between actions. - - @deprecated: use the L{blendTime} property - @param blendtime: The new time. This parameter must be in the range from 0.0 to 1.0. - @type blendtime: float - """ - - def setType(mode): - """ - Sets the operation mode of the actuator - - @deprecated: use the L{type} property - @param mode: KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND - @type mode: integer - """ - - def setContinue(cont): - """ - Set the actions continue option True or False. see getContinue. - - @deprecated: use the L{useContinue} property - @param cont: The continue option. - @type cont: bool - """ - - def getType(): - """ - Returns the operation mode of the actuator - - @deprecated: use the L{type} property - @rtype: integer - @return: KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND - """ - - def getContinue(): - """ - When True, the action will always play from where last left off, otherwise negative events to this actuator will reset it to its start frame. - - @deprecated: use the L{useContinue} property - @rtype: bool - """ - - def getAction(): - """ - getAction() returns the name of the action associated with this actuator. - - @deprecated: use the L{action} property - @rtype: string - """ - - def getStart(): - """ - Returns the starting frame of the action. - - @deprecated: use the L{frameStart} property - @rtype: float - """ - def getEnd(): - """ - Returns the last frame of the action. - - @deprecated: use the L{frameEnd} property - @rtype: float - """ - def getBlendin(): - """ - Returns the number of interpolation animation frames to be generated when this actuator is triggered. - - @deprecated: use the L{blendIn} property - @rtype: float - """ - def getPriority(): - """ - Returns the priority for this actuator. Actuators with lower Priority numbers will - override actuators with higher numbers. - - @deprecated: use the L{priority} property - @rtype: integer - """ - def getFrame(): - """ - Returns the current frame number. - - @deprecated: use the L{frame} property - @rtype: float - """ - def getProperty(): - """ - Returns the name of the property to be used in FromProp mode. - - @deprecated: use the L{property} property - @rtype: string - """ - def setFrameProperty(prop): - """ - @deprecated: use the L{framePropName} property - @param prop: A string specifying the property of the object that will be updated with the action frame number. - @type prop: string - """ - def getFrameProperty(): - """ - Returns the name of the property that is set to the current frame number. - - @deprecated: use the L{framePropName} property - @rtype: string - """ -#} - -class BL_Shader(PyObjectPlus): - """ - BL_Shader GLSL shaders. - - TODO - Description - """ - - def setUniformfv(name, fList): - """ - Set a uniform with a list of float values - - @param name: the uniform name - @type name: string - - @param fList: a list (2, 3 or 4 elements) of float values - @type fList: list[float] - """ - - def delSource(): - """ - Clear the shader. Use this method before the source is changed with L{setSource}. - """ - def getFragmentProg(): - """ - Returns the fragment program. - - @rtype: string - @return: The fragment program. - """ - def getVertexProg(): - """ - Get the vertex program. - - @rtype: string - @return: The vertex program. - """ - def isValid(): - """ - Check if the shader is valid. - - @rtype: bool - @return: True if the shader is valid - """ - def setAttrib(enum): - """ - Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.) - - @param enum: attribute location value - @type enum: integer - """ - def setNumberOfPasses( max_pass ): - """ - Set the maximum number of passes. Not used a.t.m. - - @param max_pass: the maximum number of passes - @type max_pass: integer - """ - def setSampler(name, index): - """ - Set uniform texture sample index. - - @param name: Uniform name - @type name: string - - @param index: Texture sample index. - @type index: integer - """ - def setSource(vertexProgram, fragmentProgram): - """ - Set the vertex and fragment programs - - @param vertexProgram: Vertex program - @type vertexProgram: string - - @param fragmentProgram: Fragment program - @type fragmentProgram: string - """ - def setUniform1f(name, fx): - """ - Set a uniform with 1 float value. - - @param name: the uniform name - @type name: string - - @param fx: Uniform value - @type fx: float - """ - def setUniform1i(name, ix): - """ - Set a uniform with an integer value. - - @param name: the uniform name - @type name: string - - @param ix: the uniform value - @type ix: integer - """ - def setUniform2f(name, fx, fy): - """ - Set a uniform with 2 float values - - @param name: the uniform name - @type name: string - - @param fx: first float value - @type fx: float - - @param fy: second float value - @type fy: float - """ - def setUniform2i(name, ix, iy): - """ - Set a uniform with 2 integer values - - @param name: the uniform name - @type name: string - - @param ix: first integer value - @type ix: integer - - @param iy: second integer value - @type iy: integer - """ - def setUniform3f(name, fx,fy,fz): - """ - Set a uniform with 3 float values. - - @param name: the uniform name - @type name: string - - @param fx: first float value - @type fx: float - - @param fy: second float value - @type fy: float - - @param fz: third float value - @type fz: float - """ - def setUniform3i(name, ix,iy,iz): - """ - Set a uniform with 3 integer values - - @param name: the uniform name - @type name: string - - @param ix: first integer value - @type ix: integer - - @param iy: second integer value - @type iy: integer - - @param iz: third integer value - @type iz: integer - """ - def setUniform4f(name, fx,fy,fz,fw): - """ - Set a uniform with 4 float values. - - @param name: the uniform name - @type name: string - - @param fx: first float value - @type fx: float - - @param fy: second float value - @type fy: float - - @param fz: third float value - @type fz: float - - @param fw: fourth float value - @type fw: float - """ - def setUniform4i(name, ix,iy,iz, iw): - """ - Set a uniform with 4 integer values - - @param name: the uniform name - @type name: string - - @param ix: first integer value - @type ix: integer - - @param iy: second integer value - @type iy: integer - - @param iz: third integer value - @type iz: integer - - @param iw: fourth integer value - @type iw: integer - """ - def setUniformDef(name, type): - """ - Define a new uniform - - @param name: the uniform name - @type name: string - - @param type: uniform type - @type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX - """ - def setUniformMatrix3(name, mat, transpose): - """ - Set a uniform with a 3x3 matrix value - - @param name: the uniform name - @type name: string - - @param mat: A 3x3 matrix [[f,f,f], [f,f,f], [f,f,f]] - @type mat: 3x3 matrix - - @param transpose: set to True to transpose the matrix - @type transpose: bool - """ - def setUniformMatrix4(name, mat, transpose): - """ - Set a uniform with a 4x4 matrix value - - @param name: the uniform name - @type name: string - - @param mat: A 4x4 matrix [[f,f,f,f], [f,f,f,f], [f,f,f,f], [f,f,f,f]] - @type mat: 4x4 matrix - - @param transpose: set to True to transpose the matrix - @type transpose: bool - """ - def setUniformiv(name, iList): - """ - Set a uniform with a list of integer values - - @param name: the uniform name - @type name: string - - @param iList: a list (2, 3 or 4 elements) of integer values - @type iList: list[integer] - """ - def validate(): - """ - Validate the shader object. - - """ - -class BL_ShapeActionActuator(SCA_IActuator): - """ - ShapeAction Actuators apply an shape action to an mesh object.\ - - @ivar action: The name of the action to set as the current shape action. - @type action: string - @ivar frameStart: Specifies the starting frame of the shape animation. - @type frameStart: float - @ivar frameEnd: Specifies the ending frame of the shape animation. - @type frameEnd: float - @ivar blendIn: Specifies the number of frames of animation to generate when making transitions between actions. - @type blendIn: float - @ivar priority: Sets the priority of this actuator. Actuators will lower - priority numbers will override actuators with higher - numbers. - @type priority: integer - @ivar frame: Sets the current frame for the animation. - @type frame: float - @ivar propName: Sets the property to be used in FromProp playback mode. - @type propName: string - @ivar blendTime: Sets the internal frame timer. This property must be in - the range from 0.0 to blendin. - @type blendTime: float - @ivar mode: The operation mode of the actuator. - KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, - KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND - @type mode: integer - @ivar framePropName: The name of the property that is set to the current frame number. - @type framePropName: string - - """ -#{ Deprecated - def setAction(action, reset = True): - """ - Sets the current action. - - @deprecated: use the L{action} property - @param action: The name of the action to set as the current action. - @type action: string - @param reset: Optional parameter indicating whether to reset the - blend timer or not. A value of 1 indicates that the - timer should be reset. A value of 0 will leave it - unchanged. If reset is not specified, the timer will - be reset. - """ - - def setStart(start): - """ - Specifies the starting frame of the animation. - - @deprecated: use the L{frameStart} property - @param start: the starting frame of the animation - @type start: float - """ - - def setEnd(end): - """ - Specifies the ending frame of the animation. - - @deprecated: use the L{frameEnd} property - @param end: the ending frame of the animation - @type end: float - """ - def setBlendin(blendin): - """ - Specifies the number of frames of animation to generate - when making transitions between actions. - - @deprecated: use the L{blendIn} property - @param blendin: the number of frames in transition. - @type blendin: float - """ - - def setPriority(priority): - """ - Sets the priority of this actuator. - - @deprecated: use the L{priority} property - @param priority: Specifies the new priority. Actuators will lower - priority numbers will override actuators with higher - numbers. - @type priority: integer - """ - def setFrame(frame): - """ - Sets the current frame for the animation. - - @deprecated: use the L{frame} property - @param frame: Specifies the new current frame for the animation - @type frame: float - """ - - def setProperty(prop): - """ - Sets the property to be used in FromProp playback mode. - - @deprecated: use the L{property} property - @param prop: the name of the property to use. - @type prop: string. - """ - - def setBlendtime(blendtime): - """ - Sets the internal frame timer. - - Allows the script to directly modify the internal timer - used when generating transitions between actions. - - @deprecated: use the L{blendTime} property - @param blendtime: The new time. This parameter must be in the range from 0.0 to 1.0. - @type blendtime: float - """ - - def setType(mode): - """ - Sets the operation mode of the actuator - - @deprecated: use the L{type} property - @param mode: KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND - @type mode: integer - """ - - def getType(): - """ - Returns the operation mode of the actuator - - @deprecated: use the L{type} property - @rtype: integer - @return: KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND - """ - - def getAction(): - """ - getAction() returns the name of the action associated with this actuator. - - @deprecated: use the L{action} property - @rtype: string - """ - - def getStart(): - """ - Returns the starting frame of the action. - - @deprecated: use the L{frameStart} property - @rtype: float - """ - def getEnd(): - """ - Returns the last frame of the action. - - @deprecated: use the L{frameEnd} property - @rtype: float - """ - def getBlendin(): - """ - Returns the number of interpolation animation frames to be generated when this actuator is triggered. - - @deprecated: use the L{blendIn} property - @rtype: float - """ - def getPriority(): - """ - Returns the priority for this actuator. Actuators with lower Priority numbers will - override actuators with higher numbers. - - @deprecated: use the L{priority} property - @rtype: integer - """ - def getFrame(): - """ - Returns the current frame number. - - @deprecated: use the L{frame} property - @rtype: float - """ - def getProperty(): - """ - Returns the name of the property to be used in FromProp mode. - - @deprecated: use the L{property} property - @rtype: string - """ - def setFrameProperty(prop): - """ - @deprecated: use the L{framePropName} property - @param prop: A string specifying the property of the object that will be updated with the action frame number. - @type prop: string - """ - def getFrameProperty(): - """ - Returns the name of the property that is set to the current frame number. - - @deprecated: use the L{framePropName} property - @rtype: string - """ -#} - -class CListValue(CPropValue): - """ - CListValue - - This is a list like object used in the game engine internally that behaves similar to a python list in most ways. - - As well as the normal index lookup. - C{val= clist[i]} - - CListValue supports string lookups. - C{val= scene.objects["Cube"]} - - Other operations such as C{len(clist), list(clist), clist[0:10]} are also supported. - """ - def append(val): - """ - Add an item to the list (like pythons append) - - Warning: Appending values to the list can cause crashes when the list is used internally by the game engine. - """ - - def count(val): - """ - Count the number of instances of a value in the list. - - @rtype: integer - @return: number of instances - """ - def index(val): - """ - Return the index of a value in the list. - - @rtype: integer - @return: The index of the value in the list. - """ - def reverse(): - """ - Reverse the order of the list. - """ - def get(key, default=None): - """ - Return the value matching key, or the default value if its not found. - @return: The key value or a default. - """ - def from_id(id): - """ - This is a funtion especially for the game engine to return a value with a spesific id. - - Since object names are not always unique, the id of an object can be used to get an object from the CValueList. - - Example. - - C{myObID = id(gameObject)} - - C{...} - - C{ob= scene.objects.from_id(myObID)} - - Where myObID is an int or long from the id function. - - This has the advantage that you can store the id in places you could not store a gameObject. - - Warning: the id is derived from a memory location and will be different each time the game engine starts. - """ - -class KX_BlenderMaterial(PyObjectPlus): # , RAS_IPolyMaterial) - """ - KX_BlenderMaterial - - """ - - def getShader(): - """ - Returns the material's shader. - - @rtype: L{BL_Shader} - @return: the material's shader - """ - - def setBlending(src, dest): - """ - Set the pixel color arithmetic functions. - - @param src: Specifies how the red, green, blue, - and alpha source blending factors are computed. - @type src: GL_ZERO, - GL_ONE, - GL_SRC_COLOR, - GL_ONE_MINUS_SRC_COLOR, - GL_DST_COLOR, - GL_ONE_MINUS_DST_COLOR, - GL_SRC_ALPHA, - GL_ONE_MINUS_SRC_ALPHA, - GL_DST_ALPHA, - GL_ONE_MINUS_DST_ALPHA, - GL_SRC_ALPHA_SATURATE - - - @param dest: Specifies how the red, green, blue, - and alpha destination blending factors are computed. - @type dest: GL_ZERO, - GL_ONE, - GL_SRC_COLOR, - GL_ONE_MINUS_SRC_COLOR, - GL_DST_COLOR, - GL_ONE_MINUS_DST_COLOR, - GL_SRC_ALPHA, - GL_ONE_MINUS_SRC_ALPHA, - GL_DST_ALPHA, - GL_ONE_MINUS_DST_ALPHA, - GL_SRC_ALPHA_SATURATE - - """ - def getMaterialIndex(): - """ - Returns the material's index. - - @rtype: integer - @return: the material's index - """ - -class KX_CameraActuator(SCA_IActuator): - """ - Applies changes to a camera. - - @ivar min: minimum distance to the target object maintained by the actuator - @type min: float - @ivar max: maximum distance to stay from the target object - @type max: float - @ivar height: height to stay above the target object - @type height: float - @ivar useXY: axis this actuator is tracking, true=X, false=Y - @type useXY: boolean - @ivar object: the object this actuator tracks. - @type object: L{KX_GameObject} or None - @author: snail - """ -#{ Deprecated - def getObject(name_only = 1): - """ - Returns the name of the object this actuator tracks. - - @deprecated: Use the L{object} attribute instead. - @type name_only: bool - @param name_only: optional argument, when 0 return a KX_GameObject - @rtype: string, L{KX_GameObject} or None if no object is set - """ - - def setObject(target): - """ - Sets the object this actuator tracks. - - @deprecated: Use the L{object} attribute instead. - @param target: the object to track. - @type target: L{KX_GameObject}, string or None - """ - - def getMin(): - """ - Returns the minimum distance to target maintained by the actuator. - - @deprecated: Use the L{min} attribute instead. - @rtype: float - """ - - def setMin(distance): - """ - Sets the minimum distance to the target object maintained by the - actuator. - - @deprecated: Use the L{min} attribute instead. - @param distance: The minimum distance to maintain. - @type distance: float - """ - - def getMax(): - """ - Gets the maximum distance to stay from the target object. - - @deprecated: Use the L{max} attribute instead. - @rtype: float - """ - - def setMax(distance): - """ - Sets the maximum distance to stay from the target object. - - @deprecated: Use the L{max} attribute instead. - @param distance: The maximum distance to maintain. - @type distance: float - """ - - def getHeight(): - """ - Returns the height to stay above the target object. - - @deprecated: Use the L{height} attribute instead. - @rtype: float - """ - - def setHeight(height): - """ - Sets the height to stay above the target object. - - @deprecated: Use the L{height} attribute instead. - @type height: float - @param height: The height to stay above the target object. - """ - - def setXY(xaxis): - """ - Sets the axis to get behind. - - @deprecated: Use the L{useXY} attribute instead. - @param xaxis: False to track Y axis, True to track X axis. - @type xaxis: boolean - """ - - def getXY(): - """ - Returns the axis this actuator is tracking. - - @deprecated: Use the L{useXY} attribute instead. - @return: True if tracking X axis, False if tracking Y axis. - @rtype: boolean - """ -#} - -class KX_ConstraintActuator(SCA_IActuator): - """ - A constraint actuator limits the position, rotation, distance or orientation of an object. - - Properties: - - @ivar damp: time constant of the constraint expressed in frame (not use by Force field constraint) - @type damp: integer - - @ivar rotDamp: time constant for the rotation expressed in frame (only for the distance constraint) - 0 = use damp for rotation as well - @type rotDamp: integer - - @ivar direction: the reference direction in world coordinate for the orientation constraint - @type direction: 3-tuple of float: [x,y,z] - - @ivar option: Binary combination of the following values: - Applicable to Distance constraint: - - KX_ACT_CONSTRAINT_NORMAL ( 64) : Activate alignment to surface - - KX_ACT_CONSTRAINT_DISTANCE ( 512) : Activate distance control - - KX_ACT_CONSTRAINT_LOCAL (1024) : direction of the ray is along the local axis - Applicable to Force field constraint: - - KX_ACT_CONSTRAINT_DOROTFH (2048) : Force field act on rotation as well - Applicable to both: - - KX_ACT_CONSTRAINT_MATERIAL ( 128) : Detect material rather than property - - KX_ACT_CONSTRAINT_PERMANENT ( 256) : No deactivation if ray does not hit target - @type option: integer - - @ivar time: activation time of the actuator. The actuator disables itself after this many frame. - If set to 0, the actuator is not limited in time. - @type time: integer - - @ivar propName: the name of the property or material for the ray detection of the distance constraint. - @type propName: string - - @ivar min: The lower bound of the constraint - For the rotation and orientation constraint, it represents radiant - @type min: float - - @ivar distance: the target distance of the distance constraint - @type distance: float - - @ivar max: the upper bound of the constraint. - For rotation and orientation constraints, it represents radiant. - @type max: float - - @ivar rayLength: the length of the ray of the distance constraint. - @type rayLength: float - - @ivar limit: type of constraint, use one of the following constant: - KX_ACT_CONSTRAINT_LOCX ( 1) : limit X coord - KX_ACT_CONSTRAINT_LOCY ( 2) : limit Y coord - KX_ACT_CONSTRAINT_LOCZ ( 3) : limit Z coord - KX_ACT_CONSTRAINT_ROTX ( 4) : limit X rotation - KX_ACT_CONSTRAINT_ROTY ( 5) : limit Y rotation - KX_ACT_CONSTRAINT_ROTZ ( 6) : limit Z rotation - KX_ACT_CONSTRAINT_DIRPX ( 7) : set distance along positive X axis - KX_ACT_CONSTRAINT_DIRPY ( 8) : set distance along positive Y axis - KX_ACT_CONSTRAINT_DIRPZ ( 9) : set distance along positive Z axis - KX_ACT_CONSTRAINT_DIRNX (10) : set distance along negative X axis - KX_ACT_CONSTRAINT_DIRNY (11) : set distance along negative Y axis - KX_ACT_CONSTRAINT_DIRNZ (12) : set distance along negative Z axis - KX_ACT_CONSTRAINT_ORIX (13) : set orientation of X axis - KX_ACT_CONSTRAINT_ORIY (14) : set orientation of Y axis - KX_ACT_CONSTRAINT_ORIZ (15) : set orientation of Z axis - KX_ACT_CONSTRAINT_FHPX (16) : set force field along positive X axis - KX_ACT_CONSTRAINT_FHPY (17) : set force field along positive Y axis - KX_ACT_CONSTRAINT_FHPZ (18) : set force field along positive Z axis - KX_ACT_CONSTRAINT_FHNX (19) : set force field along negative X axis - KX_ACT_CONSTRAINT_FHNY (20) : set force field along negative Y axis - KX_ACT_CONSTRAINT_FHNZ (21) : set force field along negative Z axis - @type limit: integer - """ -#{ Deprecated - def setDamp(time): - """ - Sets the time this constraint is delayed. - - @param time: The number of frames to delay. - Negative values are ignored. - @type time: integer - """ - def getDamp(): - """ - Returns the damping time of the constraint. - - @rtype: integer - """ - def setMin(lower): - """ - Sets the lower bound of the constraint. - - For rotational and orientation constraints, lower is specified in degrees. - - @type lower: float - """ - def getMin(): - """ - Gets the lower bound of the constraint. - - For rotational and orientation constraints, the lower bound is returned in radians. - - @rtype: float - """ - def setMax(upper): - """ - Sets the upper bound of the constraint. - - For rotational and orientation constraints, upper is specified in degrees. - - @type upper: float - """ - def getMax(): - """ - Gets the upper bound of the constraint. - - For rotational and orientation constraints, the upper bound is returned in radians. - - @rtype: float - """ - def setLimit(limit): - """ - Sets the type of constraint. - - See module L{GameLogic} for valid constraint types. - - @param limit: - Position constraints: KX_CONSTRAINTACT_LOCX, KX_CONSTRAINTACT_LOCY, KX_CONSTRAINTACT_LOCZ - Rotation constraints: KX_CONSTRAINTACT_ROTX, KX_CONSTRAINTACT_ROTY or KX_CONSTRAINTACT_ROTZ - Distance contraints: KX_ACT_CONSTRAINT_DIRPX, KX_ACT_CONSTRAINT_DIRPY, KX_ACT_CONSTRAINT_DIRPZ, KX_ACT_CONSTRAINT_DIRNX, KX_ACT_CONSTRAINT_DIRNY, KX_ACT_CONSTRAINT_DIRNZ - Orientation constraints: KX_ACT_CONSTRAINT_ORIX, KX_ACT_CONSTRAINT_ORIY, KX_ACT_CONSTRAINT_ORIZ - """ - def getLimit(): - """ - Gets the type of constraint. - - See module L{GameLogic} for valid constraints. - - @return: - Position constraints: KX_CONSTRAINTACT_LOCX, KX_CONSTRAINTACT_LOCY, KX_CONSTRAINTACT_LOCZ, - Rotation constraints: KX_CONSTRAINTACT_ROTX, KX_CONSTRAINTACT_ROTY, KX_CONSTRAINTACT_ROTZ, - Distance contraints: KX_ACT_CONSTRAINT_DIRPX, KX_ACT_CONSTRAINT_DIRPY, KX_ACT_CONSTRAINT_DIRPZ, KX_ACT_CONSTRAINT_DIRNX, KX_ACT_CONSTRAINT_DIRNY, KX_ACT_CONSTRAINT_DIRNZ, - Orientation constraints: KX_ACT_CONSTRAINT_ORIX, KX_ACT_CONSTRAINT_ORIY, KX_ACT_CONSTRAINT_ORIZ - """ - def setRotDamp(duration): - """ - Sets the time constant of the orientation constraint. - - @param duration: If the duration is negative, it is set to 0. - @type duration: integer - """ - def getRotDamp(): - """ - Returns the damping time for application of the constraint. - - @rtype: integer - """ - def setDirection(vector): - """ - Sets the reference direction in world coordinate for the orientation constraint - - @type vector: 3-tuple - """ - def getDirection(): - """ - Returns the reference direction of the orientation constraint in world coordinate. - - @rtype: 3-tuple - """ - def setOption(option): - """ - Sets several options of the distance constraint. - - @type option: integer - @param option: Binary combination of the following values: - 64 : Activate alignment to surface - 128 : Detect material rather than property - 256 : No deactivation if ray does not hit target - 512 : Activate distance control - """ - def getOption(): - """ - Returns the option parameter. - - @rtype: integer - """ - def setTime(duration): - """ - Sets the activation time of the actuator. - - @type duration: integer - @param duration: The actuator disables itself after this many frame. - If set to 0 or negative, the actuator is not limited in time. - """ - def getTime(): - """ - Returns the time parameter. - - @rtype: integer - """ - def setProperty(property): - """ - Sets the name of the property or material for the ray detection of the distance constraint. - - @type property: string - @param property: If empty, the ray will detect any collisioning object. - """ - def getProperty(): - """ - Returns the property parameter. - - @rtype: string - """ - def setDistance(distance): - """ - Sets the target distance in distance constraint. - - @type distance: float - """ - def getDistance(): - """ - Returns the distance parameter. - - @rtype: float - """ - def setRayLength(length): - """ - Sets the maximum ray length of the distance constraint. - - @type length: float - """ - def getRayLength(): - """ - Returns the length of the ray - - @rtype: float - """ -#} - -class KX_ConstraintWrapper(PyObjectPlus): - """ - KX_ConstraintWrapper - - """ - def getConstraintId(val): - """ - Returns the contraint's ID - - @rtype: integer - @return: the constraint's ID - """ - -class KX_GameActuator(SCA_IActuator): - """ - The game actuator loads a new .blend file, restarts the current .blend file or quits the game. - - Properties: - - @ivar fileName: the new .blend file to load - @type fileName: string. - @ivar mode: The mode of this actuator - @type mode: Constant in... - - L{GameLogic.KX_GAME_LOAD} - - L{GameLogic.KX_GAME_START} - - L{GameLogic.KX_GAME_RESTART} - - L{GameLogic.KX_GAME_QUIT} - - L{GameLogic.KX_GAME_SAVECFG} - - L{GameLogic.KX_GAME_LOADCFG} - """ -#{ Deprecated - def getFile(): - """ - Returns the filename of the new .blend file to load. - - @deprecated: use the L{fileName} property - @rtype: string - """ - def setFile(filename): - """ - Sets the new .blend file to load. - - @deprecated: use the L{fileName} property - @param filename: The file name this actuator will load. - @type filename: string - """ -#} - -class KX_GameObject(SCA_IObject): - """ - All game objects are derived from this class. - - Properties assigned to game objects are accessible as attributes of this class. - - note: Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError, if an object may have been removed since last accessing it use the L{invalid} attribute to check. - - @ivar name: The object's name. (read-only) - @type name: string. - @ivar mass: The object's mass - - note: The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0 - @type mass: float - @ivar linVelocityMin: Enforces the object keeps moving at a minimum velocity. - - note: Applies to dynamic and rigid body objects only. - - note: A value of 0.0 disables this option. - - note: While objects are stationary the minimum velocity will not be applied. - @type linVelocityMin: float - @ivar linVelocityMax: Clamp the maximum linear velocity to prevent objects moving beyond a set speed. - - note: Applies to dynamic and rigid body objects only. - - note: A value of 0.0 disables this option (rather then setting it stationary). - @type linVelocityMax: float - @ivar localInertia: the object's inertia vector in local coordinates. Read only. - @type localInertia: list [ix, iy, iz] - @ivar parent: The object's parent object. (read-only) - @type parent: L{KX_GameObject} or None - @ivar visible: visibility flag. - - note: Game logic will still run for invisible objects. - @type visible: boolean - @ivar color: The object color of the object - @type color: list [r, g, b, a] - @ivar occlusion: occlusion capability flag. - @type occlusion: boolean - @ivar position: The object's position. - - deprecated: use L{localPosition} and L{worldPosition} - @type position: list [x, y, z] On write: local position, on read: world position - @ivar orientation: The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. - - deprecated: use L{localOrientation} and L{worldOrientation} - @type orientation: 3x3 Matrix [[float]] On write: local orientation, on read: world orientation - @ivar scaling: The object's scaling factor. list [sx, sy, sz] - - deprecated: use L{localScale} and L{worldScale} - @type scaling: list [sx, sy, sz] On write: local scaling, on read: world scaling - @ivar localOrientation: The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. - @type localOrientation: 3x3 Matrix [[float]] - @ivar worldOrientation: The object's world orientation. - @type worldOrientation: 3x3 Matrix [[float]] - @ivar localScale: The object's local scaling factor. - @type localScale: list [sx, sy, sz] - @ivar worldScale: The object's world scaling factor. Read-only - @type worldScale: list [sx, sy, sz] - @ivar localPosition: The object's local position. - @type localPosition: list [x, y, z] - @ivar worldPosition: The object's world position. - @type worldPosition: list [x, y, z] - @ivar timeOffset: adjust the slowparent delay at runtime. - @type timeOffset: float - @ivar state: the game object's state bitmask, using the first 30 bits, one bit must always be set. - @type state: int - @ivar meshes: a list meshes for this object. - - note: Most objects use only 1 mesh. - - note: Changes to this list will not update the KX_GameObject. - @type meshes: list of L{KX_MeshProxy} - @ivar sensors: a sequence of L{SCA_ISensor} objects with string/index lookups and iterator support. - - note: This attribute is experemental and may be removed (but probably wont be). - - note: Changes to this list will not update the KX_GameObject. - @type sensors: list - @ivar controllers: a sequence of L{SCA_IController} objects with string/index lookups and iterator support. - - note: This attribute is experemental and may be removed (but probably wont be). - - note: Changes to this list will not update the KX_GameObject. - @type controllers: list of L{SCA_ISensor}. - @ivar actuators: a list of L{SCA_IActuator} with string/index lookups and iterator support. - - note: This attribute is experemental and may be removed (but probably wont be). - - note: Changes to this list will not update the KX_GameObject. - @type actuators: list - @ivar attrDict: get the objects internal python attribute dictionary for direct (faster) access. - @type attrDict: dict - @ivar children: direct children of this object, (read-only). - @type children: L{CListValue} of L{KX_GameObject}'s - @ivar childrenRecursive: all children of this object including childrens children, (read-only). - @type childrenRecursive: L{CListValue} of L{KX_GameObject}'s - @group Deprecated: getPosition, setPosition, setWorldPosition, getOrientation, setOrientation, getState, setState, getParent, getVisible, getMass, getMesh, getChildren, getChildrenRecursive - @group Property Access: get, attrDict, getPropertyNames - """ - def endObject(): - """ - Delete this object, can be used in place of the EndObject Actuator. - The actual removal of the object from the scene is delayed. - """ - def replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False): - """ - Replace the mesh of this object with a new mesh. This works the same was as the actuator. - @type mesh: L{KX_MeshProxy} or mesh name - @type useDisplayMesh: bool - @param useDisplayMesh: when enabled the display mesh will be replaced (optional argument). - @type usePhysicsMesh: bool - @param usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument). - """ - def getVisible(): - """ - Gets the game object's visible flag. - - @deprecated: use L{visible} - @rtype: boolean - """ - def setVisible(visible, recursive): - """ - Sets the game object's visible flag. - - @type visible: boolean - @type recursive: boolean - @param recursive: optional argument to set all childrens visibility flag too. - """ - def setOcclusion(occlusion, recursive): - """ - Sets the game object's occlusion capability. - - @type occlusion: boolean - @type recursive: boolean - @param recursive: optional argument to set all childrens occlusion flag too. - """ - def getState(): - """ - Gets the game object's state bitmask. - - @deprecated: use L{state} - @rtype: int - @return: the objects state. - """ - def setState(state): - """ - Sets the game object's state flag. - The bitmasks for states from 1 to 30 can be set with (1<<0, 1<<1, 1<<2 ... 1<<29) - @deprecated: use L{state} - @type state: integer - """ - def setPosition(pos): - """ - Sets the game object's position. - Global coordinates for root object, local for child objects. - - @deprecated: use L{localPosition} - @type pos: [x, y, z] - @param pos: the new position, in local coordinates. - """ - def setWorldPosition(pos): - """ - Sets the game object's position in world coordinates regardless if the object is root or child. - - @deprecated: use L{worldPosition} - @type pos: [x, y, z] - @param pos: the new position, in world coordinates. - """ - def getPosition(): - """ - Gets the game object's position. - - @deprecated: use L{worldPosition} - @rtype: list [x, y, z] - @return: the object's position in world coordinates. - """ - def setOrientation(orn): - """ - Sets the game object's orientation. - - @deprecated: use L{localOrientation} - @type orn: 3x3 rotation matrix, or Quaternion. - @param orn: a rotation matrix specifying the new rotation. - @note: When using this matrix with Blender.mathutils.Matrix() types, it will need to be transposed. - """ - def alignAxisToVect(vect, axis, factor): - """ - Aligns any of the game object's axis along the given vector. - - @type vect: 3d vector. - @param vect: a vector to align the axis. - @type axis: integer. - @param axis:The axis you want to align - - 0: X axis - - 1: Y axis - - 2: Z axis (default) - @type factor: float - @param factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0) - """ - def getAxisVect(vect): - """ - Returns the axis vector rotates by the objects worldspace orientation. - This is the equivalent of multiplying the vector by the orientation matrix. - - @type vect: 3d vector. - @param vect: a vector to align the axis. - @rtype: 3d vector. - @return: The vector in relation to the objects rotation. - - """ - def getOrientation(): - """ - Gets the game object's orientation. - - @deprecated: use L{worldOrientation} - @rtype: 3x3 rotation matrix - @return: The game object's rotation matrix - @note: When using this matrix with Blender.mathutils.Matrix() types, it will need to be transposed. - """ - def applyMovement(movement, local = 0): - """ - Sets the game object's movement. - - @type movement: 3d vector. - @param movement: movement vector. - @type local: boolean - @param local: - False: you get the "global" movement ie: relative to world orientation (default). - - True: you get the "local" movement ie: relative to object orientation. - """ - def applyRotation(rotation, local = 0): - """ - Sets the game object's rotation. - - @type rotation: 3d vector. - @param rotation: rotation vector. - @type local: boolean - @param local: - False: you get the "global" rotation ie: relative to world orientation (default). - - True: you get the "local" rotation ie: relative to object orientation. - """ - def applyForce(force, local = 0): - """ - Sets the game object's force. - - This requires a dynamic object. - - @type force: 3d vector. - @param force: force vector. - @type local: boolean - @param local: - False: you get the "global" force ie: relative to world orientation (default). - - True: you get the "local" force ie: relative to object orientation. - """ - def applyTorque(torque, local = 0): - """ - Sets the game object's torque. - - This requires a dynamic object. - - @type torque: 3d vector. - @param torque: torque vector. - @type local: boolean - @param local: - False: you get the "global" torque ie: relative to world orientation (default). - - True: you get the "local" torque ie: relative to object orientation. - """ - def getLinearVelocity(local = 0): - """ - Gets the game object's linear velocity. - - This method returns the game object's velocity through it's centre of mass, - ie no angular velocity component. - - @type local: boolean - @param local: - False: you get the "global" velocity ie: relative to world orientation (default). - - True: you get the "local" velocity ie: relative to object orientation. - @rtype: list [vx, vy, vz] - @return: the object's linear velocity. - """ - def setLinearVelocity(velocity, local = 0): - """ - Sets the game object's linear velocity. - - This method sets game object's velocity through it's centre of mass, - ie no angular velocity component. - - This requires a dynamic object. - - @type velocity: 3d vector. - @param velocity: linear velocity vector. - @type local: boolean - @param local: - False: you get the "global" velocity ie: relative to world orientation (default). - - True: you get the "local" velocity ie: relative to object orientation. - """ - def getAngularVelocity(local = 0): - """ - Gets the game object's angular velocity. - - @type local: boolean - @param local: - False: you get the "global" velocity ie: relative to world orientation (default). - - True: you get the "local" velocity ie: relative to object orientation. - @rtype: list [vx, vy, vz] - @return: the object's angular velocity. - """ - def setAngularVelocity(velocity, local = 0): - """ - Sets the game object's angular velocity. - - This requires a dynamic object. - - @type velocity: 3d vector. - @param velocity: angular velocity vector. - @type local: boolean - @param local: - False: you get the "global" velocity ie: relative to world orientation (default). - - True: you get the "local" velocity ie: relative to object orientation. - """ - def getVelocity(point): - """ - Gets the game object's velocity at the specified point. - - Gets the game object's velocity at the specified point, including angular - components. - - @type point: list [x, y, z] - @param point: the point to return the velocity for, in local coordinates. (optional: default = [0, 0, 0]) - @rtype: list [vx, vy, vz] - @return: the velocity at the specified point. - """ - def getMass(): - """ - Gets the game object's mass. - - @deprecated: use L{mass} - @rtype: float - @return: the object's mass. - """ - def getReactionForce(): - """ - Gets the game object's reaction force. - - The reaction force is the force applied to this object over the last simulation timestep. - This also includes impulses, eg from collisions. - - (B{This is not implimented for bullet physics at the moment}) - - @rtype: list [fx, fy, fz] - @return: the reaction force of this object. - """ - def applyImpulse(point, impulse): - """ - Applies an impulse to the game object. - - This will apply the specified impulse to the game object at the specified point. - If point != getPosition(), applyImpulse will also change the object's angular momentum. - Otherwise, only linear momentum will change. - - @type point: list [x, y, z] - @param point: the point to apply the impulse to (in world coordinates) - """ - def suspendDynamics(): - """ - Suspends physics for this object. - """ - def restoreDynamics(): - """ - Resumes physics for this object. - @Note: The objects linear velocity will be applied from when the dynamics were suspended. - """ - def enableRigidBody(): - """ - Enables rigid body physics for this object. - - Rigid body physics allows the object to roll on collisions. - @Note: This is not working with bullet physics yet. - """ - def disableRigidBody(): - """ - Disables rigid body physics for this object. - @Note: This is not working with bullet physics yet. The angular is removed but rigid body physics can still rotate it later. - """ - def getParent(): - """ - Gets this object's parent. - - @deprecated: use L{parent} - @rtype: L{KX_GameObject} - @return: this object's parent object, or None if this object has no parent. - """ - def setParent(parent,compound,ghost): - """ - Sets this object's parent. - Control the shape status with the optional compound and ghost parameters: - compound=1: the object shape should be added to the parent compound shape (default) - compound=0: the object should keep its individual shape. - In that case you can control if it should be ghost or not: - ghost=1 if the object should be made ghost while parented (default) - ghost=0 if the object should be solid while parented - Note: if the object type is sensor, it stays ghost regardless of ghost parameter - - @type parent: L{KX_GameObject} - @param parent: new parent object. - @type compound: int - @param compound: whether the shape should be added to the parent compound shape - @type ghost: int - @param ghost: whether the object should be ghost while parented - """ - def removeParent(): - """ - Removes this objects parent. - """ - def getChildren(): - """ - Return a list of immediate children of this object. - @rtype: L{CListValue} of L{KX_GameObject} - @return: a list of all this objects children. - """ - def getChildrenRecursive(): - """ - Return a list of children of this object, including all their childrens children. - @rtype: L{CListValue} of L{KX_GameObject} - @return: a list of all this objects children recursivly. - """ - def getMesh(mesh): - """ - Gets the mesh object for this object. - - @type mesh: integer - @param mesh: the mesh object to return (optional: default mesh = 0) - @rtype: L{KX_MeshProxy} - @return: the first mesh object associated with this game object, or None if this object has no meshs. - """ - def getPhysicsId(): - """ - Returns the user data object associated with this game object's physics controller. - """ - def getPropertyNames(): - """ - Gets a list of all property names. - @rtype: list - @return: All property names for this object. - """ - def getDistanceTo(other): - """ - Returns the distance to another object or point. - - @param other: a point or another L{KX_GameObject} to measure the distance to. - @type other: L{KX_GameObject} or list [x, y, z] - @rtype: float - """ - def getVectTo(other): - """ - Returns the vector and the distance to another object or point. - The vector is normalized unless the distance is 0, in which a NULL vector is returned. - - @param other: a point or another L{KX_GameObject} to get the vector and distance to. - @type other: L{KX_GameObject} or list [x, y, z] - @rtype: 3-tuple (float, 3-tuple (x,y,z), 3-tuple (x,y,z)) - @return: (distance, globalVector(3), localVector(3)) - """ - def rayCastTo(other,dist,prop): - """ - Look towards another point/object and find first object hit within dist that matches prop. - - The ray is always casted from the center of the object, ignoring the object itself. - The ray is casted towards the center of another object or an explicit [x,y,z] point. - Use rayCast() if you need to retrieve the hit point - - @param other: [x,y,z] or object towards which the ray is casted - @type other: L{KX_GameObject} or 3-tuple - @param dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other - @type dist: float - @param prop: property name that object must have; can be omitted => detect any object - @type prop: string - @rtype: L{KX_GameObject} - @return: the first object hit or None if no object or object does not match prop - """ - def rayCast(objto,objfrom,dist,prop,face,xray,poly): - """ - Look from a point/object to another point/object and find first object hit within dist that matches prop. - if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None,None,None) if no hit. - if poly is 1, returns a 4-tuple with in addition a L{KX_PolyProxy} as 4th element. - if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element. - - Ex:: - # shoot along the axis gun-gunAim (gunAim should be collision-free) - ob,point,normal = gun.rayCast(gunAim,None,50) - if ob: - # hit something - - Notes: - The ray ignores the object on which the method is called. - It is casted from/to object center or explicit [x,y,z] points. - - The face paremeter determines the orientation of the normal:: - 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside) - 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect) - - The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray. - The prop and xray parameters interact as follow:: - prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray. - prop off, xray on : idem. - prop on, xray off: return closest hit if it matches prop, no hit otherwise. - prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray. - The L{KX_PolyProxy} 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray. - If there is no hit or the hit object is not a static mesh, None is returned as 4th element. - - The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects. - - @param objto: [x,y,z] or object to which the ray is casted - @type objto: L{KX_GameObject} or 3-tuple - @param objfrom: [x,y,z] or object from which the ray is casted; None or omitted => use self object center - @type objfrom: L{KX_GameObject} or 3-tuple or None - @param dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to - @type dist: float - @param prop: property name that object must have; can be omitted or "" => detect any object - @type prop: string - @param face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin - @type face: int - @param xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object - @type xray: int - @param poly: polygon option: 0,1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit - 0 or omitted=> return value is a 3-tuple (object, hitpoint, hitnormal) or (None,None,None) if no hit - 1=>return value is a 4-tuple and the 4th element is a L{KX_PolyProxy} or None if no hit or the object doesn't use a mesh collision shape. - 2=>return value is a 5-tuple and the 5th element is a 2-tuple (u,v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping. - @type poly: int - @rtype: 3-tuple (L{KX_GameObject}, 3-tuple (x,y,z), 3-tuple (nx,ny,nz)) - or 4-tuple (L{KX_GameObject}, 3-tuple (x,y,z), 3-tuple (nx,ny,nz), L{KX_PolyProxy}) - or 5-tuple (L{KX_GameObject}, 3-tuple (x,y,z), 3-tuple (nx,ny,nz), L{KX_PolyProxy}, 2-tuple (u,v)) - @return: (object,hitpoint,hitnormal) or (object,hitpoint,hitnormal,polygon) or (object,hitpoint,hitnormal,polygon,hituv) - object, hitpoint and hitnormal are None if no hit. - polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None - hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None - """ - def setCollisionMargin(margin): - """ - Set the objects collision margin. - - note: If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError. - - @type margin: float - @param margin: the collision margin distance in blender units. - """ - def sendMessage(subject, body="", to=""): - """ - Sends a message. - - @param subject: The subject of the message - @type subject: string - @param body: The body of the message (optional) - @type body: string - @param to: The name of the object to send the message to (optional) - @type to: string - """ - def reinstancePhysicsMesh(gameObject, meshObject): - """ - Updates the physics system with the changed mesh. - - If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object. - - @param gameObject: optional argument, set the physics shape from this gameObjets mesh. - @type gameObject: string, L{KX_GameObject} or None - @param meshObject: optional argument, set the physics shape from this mesh. - @type meshObject: string, L{KX_MeshProxy} or None - - @note: if this object has instances the other instances will be updated too. - @note: the gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf). - @warning: only triangle mesh type objects are supported currently (not convex hull) - @warning: if the object is a part of a combound object it will fail (parent or child) - @warning: rebuilding the physics mesh can be slow, running many times per second will give a performance hit. - @rtype: boolean - @return: True if reinstance succeeded, False if it failed. - """ - - def get(key, default=None): - """ - Return the value matching key, or the default value if its not found. - @return: The key value or a default. - """ - - -class KX_IpoActuator(SCA_IActuator): - """ - IPO actuator activates an animation. - - @ivar frameStart: Start frame. - @type frameStart: float - @ivar frameEnd: End frame. - @type frameEnd: float - @ivar propName: Use this property to define the Ipo position - @type propName: string - @ivar framePropName: Assign this property this action current frame number - @type framePropName: string - @ivar mode: Play mode for the ipo. (In GameLogic.KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND, KX_IPOACT_FROM_PROP) - @type mode: int - @ivar useIpoAsForce: Apply Ipo as a global or local force depending on the local option (dynamic objects only) - @type useIpoAsForce: bool - @ivar useIpoAdd: Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag - @type useIpoAdd: bool - @ivar useIpoLocal: Let the ipo acts in local coordinates, used in Force and Add mode. - @type useIpoLocal: bool - @ivar useChildren: Update IPO on all children Objects as well - @type useChildren: bool - """ -#{ Deprecated - def set(mode, startframe, endframe, force): - """ - Sets the properties of the actuator. - - @deprecated: use other attributes. - @param mode: "Play", "PingPong", "Flipper", "LoopStop", "LoopEnd" or "FromProp" - @type mode: string - @param startframe: first frame to use - @type startframe: integer - @param endframe: last frame to use - @type endframe: integer - @param force: special mode - @type force: integer (0=normal, 1=interpret location as force, 2=additive) - """ - def setProperty(property): - """ - Sets the name of the property to be used in FromProp mode. - - @deprecated: use L{propName} - @type property: string - """ - def setStart(startframe): - """ - Sets the frame from which the IPO starts playing. - - @deprecated: use L{frameStart} - @type startframe: integer - """ - def getStart(): - """ - Returns the frame from which the IPO starts playing. - - @deprecated: use L{frameStart} - @rtype: integer - """ - def setEnd(endframe): - """ - Sets the frame at which the IPO stops playing. - - @deprecated: use L{frameEnd} - @type endframe: integer - """ - def getEnd(): - """ - Returns the frame at which the IPO stops playing. - - @deprecated: use L{frameEnd} - @rtype: integer - """ - def setIpoAsForce(force): - """ - Set whether to interpret the ipo as a force rather than a displacement. - - @deprecated: use L{useIpoAsForce} - @type force: boolean - @param force: KX_TRUE or KX_FALSE - """ - def getIpoAsForce(): - """ - Returns whether to interpret the ipo as a force rather than a displacement. - - @deprecated: use L{useIpoAsForce} - @rtype: boolean - """ - def setIpoAdd(add): - """ - Set whether to interpret the ipo as additive rather than absolute. - - @deprecated: use L{useIpoAdd} - @type add: boolean - @param add: KX_TRUE or KX_FALSE - """ - def getIpoAdd(): - """ - Returns whether to interpret the ipo as additive rather than absolute. - - @deprecated: use L{useIpoAdd} - @rtype: boolean - """ - def setType(mode): - """ - Sets the operation mode of the actuator. - - @deprecated: use L{type} - @param mode: KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND - @type mode: string - """ - def getType(): - """ - Returns the operation mode of the actuator. - - @deprecated: use L{type} - @rtype: integer - @return: KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND - """ - def setForceIpoActsLocal(local): - """ - Set whether to apply the force in the object's local - coordinates rather than the world global coordinates. - - @deprecated: use L{useIpoLocal} - @param local: Apply the ipo-as-force in the object's local - coordinates? (KX_TRUE, KX_FALSE) - @type local: boolean - """ - def getForceIpoActsLocal(): - """ - Return whether to apply the force in the object's local - coordinates rather than the world global coordinates. - - @deprecated: use L{useIpoLocal} - """ -#} - -class KX_LightObject(KX_GameObject): - """ - A Light object. - - Example: - - # Turn on a red alert light. - import GameLogic - - co = GameLogic.getCurrentController() - light = co.owner - - light.energy = 1.0 - light.colour = [1.0, 0.0, 0.0] - - @group Constants: NORMAL, SPOT, SUN - @ivar SPOT: A spot light source. See attribute 'type' - @ivar SUN: A point light source with no attenuation. See attribute 'type' - @ivar NORMAL: A point light source. See attribute 'type' - - @ivar type: The type of light - must be SPOT, SUN or NORMAL - @ivar layer: The layer mask that this light affects object on. - @type layer: bitfield - @ivar energy: The brightness of this light. - @type energy: float - @ivar distance: The maximum distance this light can illuminate. (SPOT and NORMAL lights only) - @type distance: float - @ivar colour: The colour of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0] - @type colour: list [r, g, b] - @ivar color: Synonym for colour. - @ivar lin_attenuation: The linear component of this light's attenuation. (SPOT and NORMAL lights only) - @type lin_attenuation: float - @ivar quad_attenuation: The quadratic component of this light's attenuation (SPOT and NORMAL lights only) - @type quad_attenuation: float - @ivar spotsize: The cone angle of the spot light, in degrees. (float) (SPOT lights only) - 0.0 <= spotsize <= 180.0. Spotsize = 360.0 is also accepted. - @ivar spotblend: Specifies the intensity distribution of the spot light. (float) (SPOT lights only) - Higher values result in a more focused light source. - 0.0 <= spotblend <= 1.0. - - """ - -class KX_MeshProxy(SCA_IObject): - """ - A mesh object. - - You can only change the vertex properties of a mesh object, not the mesh topology. - - To use mesh objects effectively, you should know a bit about how the game engine handles them. - 1. Mesh Objects are converted from Blender at scene load. - 2. The Converter groups polygons by Material. This means they can be sent to the - renderer efficiently. A material holds: - 1. The texture. - 2. The Blender material. - 3. The Tile properties - 4. The face properties - (From the "Texture Face" panel) - 5. Transparency & z sorting - 6. Light layer - 7. Polygon shape (triangle/quad) - 8. Game Object - 3. Verticies will be split by face if necessary. Verticies can only be shared between - faces if: - 1. They are at the same position - 2. UV coordinates are the same - 3. Their normals are the same (both polygons are "Set Smooth") - 4. They are the same colour - For example: a cube has 24 verticies: 6 faces with 4 verticies per face. - - The correct method of iterating over every L{KX_VertexProxy} in a game object:: - import GameLogic - - co = GameLogic.getCurrentController() - obj = co.owner - - m_i = 0 - mesh = obj.getMesh(m_i) # There can be more than one mesh... - while mesh != None: - for mat in range(mesh.getNumMaterials()): - for v_index in range(mesh.getVertexArrayLength(mat)): - vertex = mesh.getVertex(mat, v_index) - # Do something with vertex here... - # ... eg: colour the vertex red. - vertex.colour = [1.0, 0.0, 0.0, 1.0] - m_i += 1 - mesh = obj.getMesh(m_i) - - @ivar materials: - @type materials: list of L{KX_BlenderMaterial} or L{KX_PolygonMaterial} types - - @ivar numPolygons: - @type numPolygons: integer - - @ivar numMaterials: - @type numMaterials: integer - """ - - def getNumMaterials(): - """ - Gets the number of materials associated with this object. - - @rtype: integer - """ - - def getMaterialName(matid): - """ - Gets the name of the specified material. - - @type matid: integer - @param matid: the specified material. - @rtype: string - @return: the attached material name. - """ - def getTextureName(matid): - """ - Gets the name of the specified material's texture. - - @type matid: integer - @param matid: the specified material - @rtype: string - @return: the attached material's texture name. - """ - def getVertexArrayLength(matid): - """ - Gets the length of the vertex array associated with the specified material. - - There is one vertex array for each material. - - @type matid: integer - @param matid: the specified material - @rtype: integer - @return: the number of verticies in the vertex array. - """ - def getVertex(matid, index): - """ - Gets the specified vertex from the mesh object. - - @type matid: integer - @param matid: the specified material - @type index: integer - @param index: the index into the vertex array. - @rtype: L{KX_VertexProxy} - @return: a vertex object. - """ - def getNumPolygons(): - """ - Returns the number of polygon in the mesh. - - @rtype: integer - """ - def getPolygon(index): - """ - Gets the specified polygon from the mesh. - - @type index: integer - @param index: polygon number - @rtype: L{KX_PolyProxy} - @return: a polygon object. - """ - -class SCA_MouseSensor(SCA_ISensor): - """ - Mouse Sensor logic brick. - - Properties: - - @ivar position: current [x,y] coordinates of the mouse, in frame coordinates (pixels) - @type position: [integer,interger] - @ivar mode: sensor mode: 1=KX_MOUSESENSORMODE_LEFTBUTTON 2=KX_MOUSESENSORMODE_MIDDLEBUTTON - 3=KX_MOUSESENSORMODE_RIGHTBUTTON 4=KX_MOUSESENSORMODE_WHEELUP - 5=KX_MOUSESENSORMODE_WHEELDOWN 9=KX_MOUSESENSORMODE_MOVEMENT - @type mode: integer - """ - - def getXPosition(): - """ - Gets the x coordinate of the mouse. - - @deprecated: use the L{position} property - @rtype: integer - @return: the current x coordinate of the mouse, in frame coordinates (pixels) - """ - def getYPosition(): - """ - Gets the y coordinate of the mouse. - - @deprecated: use the L{position} property - @rtype: integer - @return: the current y coordinate of the mouse, in frame coordinates (pixels). - """ - def getButtonStatus(button): - """ - Get the mouse button status. - - @type button: int - @param button: value in GameLogic members KX_MOUSE_BUT_LEFT, KX_MOUSE_BUT_MIDDLE, KX_MOUSE_BUT_RIGHT - - @rtype: integer - @return: value in GameLogic members KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED - """ - -class KX_MouseFocusSensor(SCA_MouseSensor): - """ - The mouse focus sensor detects when the mouse is over the current game object. - - The mouse focus sensor works by transforming the mouse coordinates from 2d device - space to 3d space then raycasting away from the camera. - - @ivar raySource: The worldspace source of the ray (the view position) - @type raySource: list (vector of 3 floats) - @ivar rayTarget: The worldspace target of the ray. - @type rayTarget: list (vector of 3 floats) - @ivar rayDirection: The L{rayTarget} - L{raySource} normalized. - @type rayDirection: list (normalized vector of 3 floats) - @ivar hitObject: the last object the mouse was over. - @type hitObject: L{KX_GameObject} or None - @ivar hitPosition: The worldspace position of the ray intersecton. - @type hitPosition: list (vector of 3 floats) - @ivar hitNormal: the worldspace normal from the face at point of intersection. - @type hitNormal: list (normalized vector of 3 floats) - @ivar hitUV: the UV coordinates at the point of intersection. - If the object has no UV mapping, it returns [0,0]. - The UV coordinates are not normalized, they can be < 0 or > 1 depending on the UV mapping. - @type hitUV: list (vector of 2 floats) - @ivar usePulseFocus: When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set) - @type usePulseFocus: bool - """ -#{ Deprecated - def getHitNormal(): - """ - Returns the normal (in worldcoordinates) at the point of collision where the object was hit by this ray. - - @deprecated: use the L{hitNormal} property - @rtype: list [x, y, z] - @return: the ray collision normal. - """ - def getHitObject(): - """ - Returns the object that was hit by this ray or None. - - @deprecated: use the L{hitObject} property - @rtype: L{KX_GameObject} or None - @return: the collision object. - """ - def getHitPosition(): - """ - Returns the position (in worldcoordinates) at the point of collision where the object was hit by this ray. - - @deprecated: use the L{hitPosition} property - @rtype: list [x, y, z] - @return: the ray collision position. - """ - def getRayDirection(): - """ - Returns the normalized direction (in worldcoordinates) of the ray cast by the mouse. - - @deprecated: use the L{rayDirection} property - @rtype: list [x, y, z] - @return: the ray direction. - """ - def getRaySource(): - """ - Returns the position (in worldcoordinates) the ray was cast from by the mouse. - - @deprecated: use the L{raySource} property - @rtype: list [x, y, z] - @return: the ray source. - """ - def getRayTarget(): - """ - Returns the target of the ray (in worldcoordinates) that seeks the focus object. - - @deprecated: use the L{rayTarget} property - @rtype: list [x, y, z] - @return: the ray target. - """ -#} - -class KX_TouchSensor(SCA_ISensor): - """ - Touch sensor detects collisions between objects. - - @ivar propName: The property or material to collide with. - @type propName: string - @ivar useMaterial: Determines if the sensor is looking for a property or material. - KX_True = Find material; KX_False = Find property - @type useMaterial: boolean - @ivar usePulseCollision: When enabled, changes to the set of colliding objects generate a pulse. - @type usePulseCollision: bool - @ivar hitObject: The last collided object. (read-only) - @type hitObject: L{KX_GameObject} or None - @ivar hitObjectList: A list of colliding objects. (read-only) - @type hitObjectList: L{CListValue} of L{KX_GameObject} - """ -#{ Deprecated - def setProperty(name): - """ - Set the property or material to collide with. Use - setTouchMaterial() to switch between properties and - materials. - - @deprecated: use the L{property} property - @type name: string - """ - - def getProperty(): - """ - Returns the property or material to collide with. Use - getTouchMaterial() to find out whether this sensor - looks for properties or materials. - - @deprecated: use the L{property} property - @rtype: string - """ - def getHitObject(): - """ - Returns the last object hit by this touch sensor. - - @deprecated: use the L{hitObject} property - @rtype: L{KX_GameObject} - """ - def getHitObjectList(): - """ - Returns a list of all objects hit in the last frame. (B{deprecated}) - - Only objects that have the requisite material/property are listed. - - @deprecated: use the L{hitObjectList} property - @rtype: L{CListValue} of L{hitObjectList} - """ - def getTouchMaterial(): - """ - Returns KX_TRUE if this sensor looks for a specific material, - KX_FALSE if it looks for a specific property. (B{deprecated}) - - @deprecated: use the L{useMaterial} property - """ -#} - -class KX_NearSensor(KX_TouchSensor): - """ - A near sensor is a specialised form of touch sensor. - - @ivar distance: The near sensor activates when an object is within this distance. - @type distance: float - @ivar resetDistance: The near sensor deactivates when the object exceeds this distance. - @type resetDistance: float - """ - -class KX_NetworkMessageActuator(SCA_IActuator): - """ - Message Actuator - - @ivar propName: Messages will only be sent to objects with the given property name. - @type propName: string - @ivar subject: The subject field of the message. - @type subject: string - @ivar body: The body of the message. - @type body: string - @ivar usePropBody: Send a property instead of a regular body message. - @type usePropBody: boolean - """ -#{Deprecated - def setToPropName(name): - """ - Messages will only be sent to objects with the given property name. - - @deprecated: Use the L{propName} attribute instead. - @type name: string - """ - def setSubject(subject): - """ - Sets the subject field of the message. - - @deprecated: Use the L{subject} attribute instead. - @type subject: string - """ - def setBodyType(bodytype): - """ - Sets the type of body to send. - - @deprecated: Use the L{usePropBody} attribute instead. - @type bodytype: boolean - @param bodytype: True to send the value of a property, False to send the body text. - """ - def setBody(body): - """ - Sets the message body. - - @deprecated: Use the L{body} attribute instead. - @type body: string - @param body: if the body type is True, this is the name of the property to send. - if the body type is False, this is the text to send. - """ -#} - -class KX_NetworkMessageSensor(SCA_ISensor): - """ - The Message Sensor logic brick. - - Currently only loopback (local) networks are supported. - - @ivar subject: The subject the sensor is looking for. - @type subject: string - @ivar frameMessageCount: The number of messages received since the last frame. - (Read-only) - @type frameMessageCount: int - @ivar subjects: The list of message subjects received. (Read-only) - @type subjects: list of strings - @ivar bodies: The list of message bodies received. (Read-only) - @type bodies: list of strings - """ -#{ Deprecated - def setSubjectFilterText(subject): - """ - Change the message subject text that this sensor is listening to. - - @deprecated: Use the L{subject} attribute instead. - @type subject: string - @param subject: the new message subject to listen for. - """ - - def getFrameMessageCount(): - """ - Get the number of messages received since the last frame. - - @deprecated: Use the L{frameMessageCount} attribute instead. - @rtype: integer - """ - def getBodies(): - """ - Gets the list of message bodies. - - @deprecated: Use the L{bodies} attribute instead. - @rtype: list - """ - def getSubject(): - """ - Gets the message subject this sensor is listening for from the Subject: field. - - @deprecated: Use the L{subject} attribute instead. - @rtype: string - """ - def getSubjects(): - """ - Gets the list of message subjects received. - - @deprecated: Use the L{subjects} attribute instead. - @rtype: list - """ -#} - -class KX_ObjectActuator(SCA_IActuator): - """ - The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement, - velocity, or angular velocity to an object. - Servo control allows to regulate force to achieve a certain speed target. - - @ivar force: The force applied by the actuator - @type force: list [x, y, z] - @ivar useLocalForce: A flag specifying if the force is local - @type useLocalForce: bool - @ivar torque: The torque applied by the actuator - @type torque: list [x, y, z] - @ivar useLocalTorque: A flag specifying if the torque is local - @type useLocalTorque: bool - @ivar dLoc: The displacement vector applied by the actuator - @type dLoc: list [x, y, z] - @ivar useLocalDLoc: A flag specifying if the dLoc is local - @type useLocalDLoc: bool - @ivar dRot: The angular displacement vector applied by the actuator - - note: Since the displacement is applied every frame, you must adjust the displacement - based on the frame rate, or you game experience will depend on the player's computer - speed. - @type dRot: list [x, y, z] - @ivar useLocalDRot: A flag specifying if the dRot is local - @type useLocalDRot: bool - @ivar linV: The linear velocity applied by the actuator - @type linV: list [x, y, z] - @ivar useLocalLinV: A flag specifying if the linear velocity is local - - note: This is the target speed for servo controllers - @type useLocalLinV: bool - @ivar angV: The angular velocity applied by the actuator - @type angV: list [x, y, z] - @ivar useLocalAngV: A flag specifying if the angular velocity is local - @type useLocalAngV: bool - - @ivar damping: The damping parameter of the servo controller - @type damping: short - - @ivar forceLimitX: The min/max force limit along the X axis and activates or deactivates the limits in the servo controller - @type forceLimitX: list [min(float), max(float), bool] - @ivar forceLimitY: The min/max force limit along the Y axis and activates or deactivates the limits in the servo controller - @type forceLimitY: list [min(float), max(float), bool] - @ivar forceLimitZ: The min/max force limit along the Z axis and activates or deactivates the limits in the servo controller - @type forceLimitZ: list [min(float), max(float), bool] - - @ivar pid: The PID coefficients of the servo controller - @type pid: list of floats [proportional, integral, derivate] - @ivar reference: The object that is used as reference to compute the velocity for the servo controller. - @type reference: L{KX_GameObject} or None - - @group Deprecated: getForce, setForce, getTorque, setTorque, getDLoc, setDLoc, getDRot, setDRot, getLinearVelocity, setLinearVelocity, getAngularVelocity, - setAngularVelocity, getDamping, setDamping, getForceLimitX, setForceLimitX, getForceLimitY, setForceLimitY, getForceLimitZ, setForceLimitZ, - getPID, setPID - """ - def getForce(): - """ - Returns the force applied by the actuator. - - @deprecated: Use L{force} and L{useLocalForce} instead. - @rtype: list [fx, fy, fz, local] - @return: A four item list, containing the vector force, and a flag specifying whether the force is local. - """ - def setForce(fx, fy, fz, local): - """ - Sets the force applied by the actuator. - - @deprecated: Use L{force} and L{useLocalForce} instead. - @type fx: float - @param fx: the x component of the force. - @type fy: float - @param fy: the z component of the force. - @type fz: float - @param fz: the z component of the force. - @type local: boolean - @param local: - False: the force is applied in world coordinates. - - True: the force is applied in local coordinates. - """ - def getTorque(): - """ - Returns the torque applied by the actuator. - - @deprecated: Use L{torque} and L{useLocalTorque} instead. - @rtype: list [S{Tau}x, S{Tau}y, S{Tau}z, local] - @return: A four item list, containing the vector torque, and a flag specifying whether - the torque is applied in local coordinates (True) or world coordinates (False) - """ - def setTorque(tx, ty, tz, local): - """ - Sets the torque applied by the actuator. - - @deprecated: Use L{torque} and L{useLocalTorque} instead. - @type tx: float - @param tx: the x component of the torque. - @type ty: float - @param ty: the z component of the torque. - @type tz: float - @param tz: the z component of the torque. - @type local: boolean - @param local: - False: the torque is applied in world coordinates. - - True: the torque is applied in local coordinates. - """ - def getDLoc(): - """ - Returns the displacement vector applied by the actuator. - - @deprecated: Use L{dLoc} and L{useLocalDLoc} instead. - @rtype: list [dx, dy, dz, local] - @return: A four item list, containing the vector displacement, and whether - the displacement is applied in local coordinates (True) or world - coordinates (False) - """ - def setDLoc(dx, dy, dz, local): - """ - Sets the displacement vector applied by the actuator. - - Since the displacement is applied every frame, you must adjust the displacement - based on the frame rate, or you game experience will depend on the player's computer - speed. - - @deprecated: Use L{dLoc} and L{useLocalDLoc} instead. - @type dx: float - @param dx: the x component of the displacement vector. - @type dy: float - @param dy: the z component of the displacement vector. - @type dz: float - @param dz: the z component of the displacement vector. - @type local: boolean - @param local: - False: the displacement vector is applied in world coordinates. - - True: the displacement vector is applied in local coordinates. - """ - def getDRot(): - """ - Returns the angular displacement vector applied by the actuator. - - @deprecated: Use L{dRot} and L{useLocalDRot} instead. - @rtype: list [dx, dy, dz, local] - @return: A four item list, containing the angular displacement vector, and whether - the displacement is applied in local coordinates (True) or world coordinates (False) - """ - def setDRot(dx, dy, dz, local): - """ - Sets the angular displacement vector applied by the actuator. - - Since the displacement is applied every frame, you must adjust the displacement - based on the frame rate, or you game experience will depend on the player's computer - speed. - - @deprecated: Use L{dRot} and L{useLocalDRot} instead. - @type dx: float - @param dx: the x component of the angular displacement vector. - @type dy: float - @param dy: the z component of the angular displacement vector. - @type dz: float - @param dz: the z component of the angular displacement vector. - @type local: boolean - @param local: - False: the angular displacement vector is applied in world coordinates. - - True: the angular displacement vector is applied in local coordinates. - """ - def getLinearVelocity(): - """ - Returns the linear velocity applied by the actuator. - For the servo control actuator, this is the target speed. - - @deprecated: Use L{linV} and L{useLocalLinV} instead. - @rtype: list [vx, vy, vz, local] - @return: A four item list, containing the vector velocity, and whether the velocity is applied in local coordinates (True) or world coordinates (False) - """ - def setLinearVelocity(vx, vy, vz, local): - """ - Sets the linear velocity applied by the actuator. - For the servo control actuator, sets the target speed. - - @deprecated: Use L{linV} and L{useLocalLinV} instead. - @type vx: float - @param vx: the x component of the velocity vector. - @type vy: float - @param vy: the z component of the velocity vector. - @type vz: float - @param vz: the z component of the velocity vector. - @type local: boolean - @param local: - False: the velocity vector is in world coordinates. - - True: the velocity vector is in local coordinates. - """ - def getAngularVelocity(): - """ - Returns the angular velocity applied by the actuator. - - @deprecated: Use L{angV} and L{useLocalAngV} instead. - @rtype: list [S{omega}x, S{omega}y, S{omega}z, local] - @return: A four item list, containing the vector velocity, and whether - the velocity is applied in local coordinates (True) or world - coordinates (False) - """ - def setAngularVelocity(wx, wy, wz, local): - """ - Sets the angular velocity applied by the actuator. - - @deprecated: Use L{angV} and L{useLocalAngV} instead. - @type wx: float - @param wx: the x component of the velocity vector. - @type wy: float - @param wy: the z component of the velocity vector. - @type wz: float - @param wz: the z component of the velocity vector. - @type local: boolean - @param local: - False: the velocity vector is applied in world coordinates. - - True: the velocity vector is applied in local coordinates. - """ - def getDamping(): - """ - Returns the damping parameter of the servo controller. - - @deprecated: Use L{damping} instead. - @rtype: integer - @return: the time constant of the servo controller in frame unit. - """ - def setDamping(damp): - """ - Sets the damping parameter of the servo controller. - - @deprecated: Use L{damping} instead. - @type damp: integer - @param damp: the damping parameter in frame unit. - """ - def getForceLimitX(): - """ - Returns the min/max force limit along the X axis used by the servo controller. - - @deprecated: Use L{forceLimitX} instead. - @rtype: list [min, max, enabled] - @return: A three item list, containing the min and max limits of the force as float - and whether the limits are active(true) or inactive(true) - """ - def setForceLimitX(min, max, enable): - """ - Sets the min/max force limit along the X axis and activates or deactivates the limits in the servo controller. - - @deprecated: Use L{forceLimitX} instead. - @type min: float - @param min: the minimum value of the force along the X axis. - @type max: float - @param max: the maximum value of the force along the X axis. - @type enable: boolean - @param enable: - True: the force will be limited to the min/max - - False: the force will not be limited - """ - def getForceLimitY(): - """ - Returns the min/max force limit along the Y axis used by the servo controller. - - @deprecated: Use L{forceLimitY} instead. - @rtype: list [min, max, enabled] - @return: A three item list, containing the min and max limits of the force as float - and whether the limits are active(true) or inactive(true) - """ - def setForceLimitY(min, max, enable): - """ - Sets the min/max force limit along the Y axis and activates or deactivates the limits in the servo controller. - - @deprecated: Use L{forceLimitY} instead. - @type min: float - @param min: the minimum value of the force along the Y axis. - @type max: float - @param max: the maximum value of the force along the Y axis. - @type enable: boolean - @param enable: - True: the force will be limited to the min/max - - False: the force will not be limited - """ - def getForceLimitZ(): - """ - Returns the min/max force limit along the Z axis used by the servo controller. - - @deprecated: Use L{forceLimitZ} instead. - @rtype: list [min, max, enabled] - @return: A three item list, containing the min and max limits of the force as float - and whether the limits are active(true) or inactive(true) - """ - def setForceLimitZ(min, max, enable): - """ - Sets the min/max force limit along the Z axis and activates or deactivates the limits in the servo controller. - - @deprecated: Use L{forceLimitZ} instead. - @type min: float - @param min: the minimum value of the force along the Z axis. - @type max: float - @param max: the maximum value of the force along the Z axis. - @type enable: boolean - @param enable: - True: the force will be limited to the min/max - - False: the force will not be limited - """ - def getPID(): - """ - Returns the PID coefficient of the servo controller. - - @deprecated: Use L{pid} instead. - @rtype: list [P, I, D] - @return: A three item list, containing the PID coefficient as floats: - P : proportional coefficient - I : Integral coefficient - D : Derivate coefficient - """ - def setPID(P, I, D): - """ - Sets the PID coefficients of the servo controller. - - @deprecated: Use L{pid} instead. - @type P: flat - @param P: proportional coefficient - @type I: float - @param I: Integral coefficient - @type D: float - @param D: Derivate coefficient - """ - -class KX_ParentActuator(SCA_IActuator): - """ - The parent actuator can set or remove an objects parent object. - @ivar object: the object this actuator sets the parent too. - @type object: L{KX_GameObject} or None - @ivar mode: The mode of this actuator - @type mode: int from 0 to 1 L{GameLogic.Parent Actuator} - @ivar compound: Whether the object shape should be added to the parent compound shape when parenting - Effective only if the parent is already a compound shape - @type compound: bool - @ivar ghost: whether the object should be made ghost when parenting - Effective only if the shape is not added to the parent compound shape - @type ghost: bool - - """ - def setObject(object): - """ - Sets the object to set as parent. - - Object can be either a L{KX_GameObject} or the name of the object. - - @deprecated: Use the L{object} property. - @type object: L{KX_GameObject}, string or None - """ - def getObject(name_only = 1): - """ - Returns the name of the object to change to. - - @deprecated: Use the L{object} property. - @type name_only: bool - @param name_only: optional argument, when 0 return a KX_GameObject - @rtype: string, L{KX_GameObject} or None if no object is set - """ - -class KX_PhysicsObjectWrapper(PyObjectPlus): - """ - KX_PhysicsObjectWrapper - - """ - def setActive(active): - """ - Set the object to be active. - - @param active: set to True to be active - @type active: bool - """ - - def setAngularVelocity(x, y, z, local): - """ - Set the angular velocity of the object. - - @param x: angular velocity for the x-axis - @type x: float - - @param y: angular velocity for the y-axis - @type y: float - - @param z: angular velocity for the z-axis - @type z: float - - @param local: set to True for local axis - @type local: bool - """ - def setLinearVelocity(x, y, z, local): - """ - Set the linear velocity of the object. - - @param x: linear velocity for the x-axis - @type x: float - - @param y: linear velocity for the y-axis - @type y: float - - @param z: linear velocity for the z-axis - @type z: float - - @param local: set to True for local axis - @type local: bool - """ - def setPosition(x, y, z): - """ - Set the position of the object - - @param x: x coordinate - @type x: float - - @param y: y coordinate - @type y: float - - @param z: z coordinate - @type z: float - """ - -class KX_PolyProxy(SCA_IObject): - """ - A polygon holds the index of the vertex forming the poylgon. - - Note: - The polygon attributes are read-only, you need to retrieve the vertex proxy if you want - to change the vertex settings. - - @ivar matname: The name of polygon material, empty if no material. - @type matname: string - @ivar material: The material of the polygon - @type material: L{KX_PolygonMaterial} or L{KX_BlenderMaterial} - @ivar texture: The texture name of the polygon. - @type texture: string - @ivar matid: The material index of the polygon, use this to retrieve vertex proxy from mesh proxy - @type matid: integer - @ivar v1: vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy - @type v1: integer - @ivar v2: vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy - @type v2: integer - @ivar v3: vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy - @type v3: integer - @ivar v4: vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex - use this to retrieve vertex proxy from mesh proxy - @type v4: integer - @ivar visible: visible state of the polygon: 1=visible, 0=invisible - @type visible: integer - @ivar collide: collide state of the polygon: 1=receives collision, 0=collision free. - @type collide: integer - """ - - def getMaterialName(): - """ - Returns the polygon material name with MA prefix - - @rtype: string - @return: material name - """ - def getMaterial(): - """ - Returns the polygon material - - @rtype: L{KX_PolygonMaterial} or L{KX_BlenderMaterial} - """ - def getTextureName(): - """ - Returns the polygon texture name - - @rtype: string - @return: texture name - """ - def getMaterialIndex(): - """ - Returns the material bucket index of the polygon. - This index and the ones returned by getVertexIndex() are needed to retrieve the vertex proxy from L{KX_MeshProxy}. - - @rtype: integer - @return: the material index in the mesh - """ - def getNumVertex(): - """ - Returns the number of vertex of the polygon. - - @rtype: integer - @return: number of vertex, 3 or 4. - """ - def isVisible(): - """ - Returns whether the polygon is visible or not - - @rtype: integer - @return: 0=invisible, 1=visible - """ - def isCollider(): - """ - Returns whether the polygon is receives collision or not - - @rtype: integer - @return: 0=collision free, 1=receives collision - """ - def getVertexIndex(vertex): - """ - Returns the mesh vertex index of a polygon vertex - This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from L{KX_MeshProxy}. - - @type vertex: integer - @param vertex: index of the vertex in the polygon: 0->3 - @rtype: integer - @return: mesh vertex index - """ - def getMesh(): - """ - Returns a mesh proxy - - @rtype: L{KX_MeshProxy} - @return: mesh proxy - """ - -class KX_PolygonMaterial: - """ - This is the interface to materials in the game engine. - - Materials define the render state to be applied to mesh objects. - - Warning: Some of the methods/variables are CObjects. If you mix these up, - you will crash blender. - - This example requires: - - PyOpenGL http://pyopengl.sourceforge.net/ - - GLEWPy http://glewpy.sourceforge.net/ - Example:: - - import GameLogic - import OpenGL - from OpenGL.GL import * - from OpenGL.GLU import * - import glew - from glew import * - - glewInit() - - vertex_shader = \"\"\" - - void main(void) - { - gl_Position = ftransform(); - } - \"\"\" - - fragment_shader =\"\"\" - - void main(void) - { - gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); - } - \"\"\" - - class MyMaterial: - def __init__(self): - self.pass_no = 0 - # Create a shader - self.m_program = glCreateProgramObjectARB() - # Compile the vertex shader - self.shader(GL_VERTEX_SHADER_ARB, (vertex_shader)) - # Compile the fragment shader - self.shader(GL_FRAGMENT_SHADER_ARB, (fragment_shader)) - # Link the shaders together - self.link() - - def PrintInfoLog(self, tag, object): - \"\"\" - PrintInfoLog prints the GLSL compiler log - \"\"\" - print "Tag: def PrintGLError(self, tag = ""): - - def PrintGLError(self, tag = ""): - \"\"\" - Prints the current GL error status - \"\"\" - if len(tag): - print tag - err = glGetError() - if err != GL_NO_ERROR: - print "GL Error: %s\\n"%(gluErrorString(err)) - - def shader(self, type, shaders): - \"\"\" - shader compiles a GLSL shader and attaches it to the current - program. - - type should be either GL_VERTEX_SHADER_ARB or GL_FRAGMENT_SHADER_ARB - shaders should be a sequence of shader source to compile. - \"\"\" - # Create a shader object - shader_object = glCreateShaderObjectARB(type) - - # Add the source code - glShaderSourceARB(shader_object, len(shaders), shaders) - - # Compile the shader - glCompileShaderARB(shader_object) - - # Print the compiler log - self.PrintInfoLog("vertex shader", shader_object) - - # Check if compiled, and attach if it did - compiled = glGetObjectParameterivARB(shader_object, GL_OBJECT_COMPILE_STATUS_ARB) - if compiled: - glAttachObjectARB(self.m_program, shader_object) - - # Delete the object (glAttachObjectARB makes a copy) - glDeleteObjectARB(shader_object) - - # print the gl error log - self.PrintGLError() - - def link(self): - \"\"\" - Links the shaders together. - \"\"\" - # clear error indicator - glGetError() - - glLinkProgramARB(self.m_program) - - self.PrintInfoLog("link", self.m_program) - - linked = glGetObjectParameterivARB(self.m_program, GL_OBJECT_LINK_STATUS_ARB) - if not linked: - print "Shader failed to link" - return - - glValidateProgramARB(self.m_program) - valid = glGetObjectParameterivARB(self.m_program, GL_OBJECT_VALIDATE_STATUS_ARB) - if not valid: - print "Shader failed to validate" - return - - def activate(self, rasty, cachingInfo, mat): - self.pass_no+=1 - if (self.pass_no == 1): - glDisable(GL_COLOR_MATERIAL) - glUseProgramObjectARB(self.m_program) - return True - - glEnable(GL_COLOR_MATERIAL) - glUseProgramObjectARB(0) - self.pass_no = 0 - return False - - obj = GameLogic.getCurrentController().owner - - mesh = obj.meshes[0] - - for mat in mesh.materials: - mat.setCustomMaterial(MyMaterial()) - print mat.texture - - @ivar texture: Texture name - @type texture: string (read-only) - - @ivar gl_texture: OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture) - @type gl_texture: integer (read-only) - - @ivar material: Material name - @type material: string (read-only) - - @ivar tface: Texture face properties - @type tface: CObject (read-only) - - @ivar tile: Texture is tiling - @type tile: boolean - @ivar tilexrep: Number of tile repetitions in x direction. - @type tilexrep: integer - @ivar tileyrep: Number of tile repetitions in y direction. - @type tileyrep: integer - - @ivar drawingmode: Drawing mode for the material. - - 2 (drawingmode & 4) Textured - - 4 (drawingmode & 16) Light - - 14 (drawingmode & 16384) 3d Polygon Text - @type drawingmode: bitfield - - @ivar transparent: This material is transparent. All meshes with this - material will be rendered after non transparent meshes from back - to front. - @type transparent: boolean - - @ivar zsort: Transparent polygons in meshes with this material will be sorted back to - front before rendering. - Non-Transparent polygons will be sorted front to back before rendering. - @type zsort: boolean - - @ivar lightlayer: Light layers this material affects. - @type lightlayer: bitfield. - - @ivar triangle: Mesh data with this material is triangles. It's probably not safe to change this. - @type triangle: boolean - - @ivar diffuse: The diffuse colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0] - @type diffuse: list [r, g, b] - @ivar specular: The specular colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0] - @type specular: list [r, g, b] - @ivar shininess: The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0 - @type shininess: float - @ivar specularity: The amount of specular of the material. 0.0 <= specularity <= 1.0 - @type specularity: float - """ - def updateTexture(tface, rasty): - """ - Updates a realtime animation. - - @param tface: Texture face (eg mat.tface) - @type tface: CObject - @param rasty: Rasterizer - @type rasty: CObject - """ - def setTexture(tface): - """ - Sets texture render state. - - Example:: - mat.setTexture(mat.tface) - - @param tface: Texture face - @type tface: CObject - """ - def activate(rasty, cachingInfo): - """ - Sets material parameters for this object for rendering. - - Material Parameters set: - 1. Texture - 2. Backface culling - 3. Line drawing - 4. Specular Colour - 5. Shininess - 6. Diffuse Colour - 7. Polygon Offset. - - @param rasty: Rasterizer instance. - @type rasty: CObject - @param cachingInfo: Material cache instance. - @type cachingInfo: CObject - """ - def setCustomMaterial(material): - """ - Sets the material state setup object. - - Using this method, you can extend or completely replace the gameengine material - to do your own advanced multipass effects. - - Use this method to register your material class. Instead of the normal material, - your class's activate method will be called just before rendering the mesh. - This should setup the texture, material, and any other state you would like. - It should return True to render the mesh, or False if you are finished. You should - clean up any state Blender does not set before returning False. - - Activate Method Definition:: - def activate(self, rasty, cachingInfo, material): - - Example:: - class PyMaterial: - def __init__(self): - self.pass_no = -1 - - def activate(self, rasty, cachingInfo, material): - # Activate the material here. - # - # The activate method will be called until it returns False. - # Every time the activate method returns True the mesh will - # be rendered. - # - # rasty is a CObject for passing to material.updateTexture() - # and material.activate() - # cachingInfo is a CObject for passing to material.activate() - # material is the KX_PolygonMaterial instance this material - # was added to - - # default material properties: - self.pass_no += 1 - if self.pass_no == 0: - material.activate(rasty, cachingInfo) - # Return True to do this pass - return True - - # clean up and return False to finish. - self.pass_no = -1 - return False - - # Create a new Python Material and pass it to the renderer. - mat.setCustomMaterial(PyMaterial()) - - @param material: The material object. - @type material: instance - """ - -class KX_RadarSensor(KX_NearSensor): - """ - Radar sensor is a near sensor with a conical sensor object. - - @ivar coneOrigin: The origin of the cone with which to test. The origin - is in the middle of the cone. - (read-only) - @type coneOrigin: list of floats [x, y, z] - @ivar coneTarget: The center of the bottom face of the cone with which to test. - (read-only) - @type coneTarget: list of floats [x, y, z] - @ivar distance: The height of the cone with which to test. - @type distance: float - @ivar angle: The angle of the cone (in degrees) with which to test. - @type angle: float from 0 to 360 - @ivar axis: The axis on which the radar cone is cast - @type axis: int from 0 to 5 - KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z, - KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z - """ -#{Deprecated - #--The following methods are deprecated, please use properties instead. - def getConeOrigin(): - """ - Returns the origin of the cone with which to test. The origin - is in the middle of the cone. - - @deprecated: Use the L{coneOrigin} property. - @rtype: list [x, y, z] - """ - - def getConeTarget(): - """ - Returns the center of the bottom face of the cone with which to test. - - @deprecated: Use the L{coneTarget} property. - @rtype: list [x, y, z] - """ -#} - - def getConeHeight(): - """ - Returns the height of the cone with which to test. - - @rtype: float - """ - -class KX_RaySensor(SCA_ISensor): - """ - A ray sensor detects the first object in a given direction. - - @ivar propName: The property the ray is looking for. - @type propName: string - @ivar range: The distance of the ray. - @type range: float - @ivar useMaterial: Whether or not to look for a material (false = property) - @type useMaterial: boolean - @ivar useXRay: Whether or not to use XRay. - @type useXRay: boolean - @ivar hitObject: The game object that was hit by the ray. (Read-only) - @type hitObject: L{KX_GameObject} - @ivar hitPosition: The position (in worldcoordinates) where the object was hit by the ray. (Read-only) - @type hitPosition: list [x, y, z] - @ivar hitNormal: The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (Read-only) - @type hitNormal: list [x, y, z] - @ivar rayDirection: The direction from the ray (in worldcoordinates). (Read-only) - @type rayDirection: list [x, y, z] - @ivar axis: The axis the ray is pointing on. - @type axis: int from 0 to 5 - KX_RAY_AXIS_POS_X, KX_RAY_AXIS_POS_Y, KX_RAY_AXIS_POS_Z, - KX_RAY_AXIS_NEG_X, KX_RAY_AXIS_NEG_Y, KX_RAY_AXIS_NEG_Z - """ -#{ Deprecated - def getHitObject(): - """ - Returns the game object that was hit by this ray. - - @deprecated: Use the L{hitObject} attribute instead. - @rtype: L{KX_GameObject} - """ - def getHitPosition(): - """ - Returns the position (in worldcoordinates) where the object was hit by this ray. - - @deprecated: Use the L{hitPosition} attribute instead. - @rtype: list [x, y, z] - """ - def getHitNormal(): - """ - Returns the normal (in worldcoordinates) of the object at the location where the object was hit by this ray. - - @deprecated: Use the L{hitNormal} attribute instead. - @rtype: list [nx, ny, nz] - """ - def getRayDirection(): - """ - Returns the direction from the ray (in worldcoordinates) - - @deprecated: Use the L{rayDirection} attribute instead. - @rtype: list [dx, dy, dz] - """ -#} - -class KX_SCA_AddObjectActuator(SCA_IActuator): - """ - Edit Object Actuator (in Add Object Mode) - @ivar object: the object this actuator adds. - @type object: L{KX_GameObject} or None - @ivar objectLastCreated: the last added object from this actuator (read-only). - @type objectLastCreated: L{KX_GameObject} or None - @ivar time: the lifetime of added objects, in frames. Set to 0 to disable automatic deletion. - @type time: integer - @ivar linearVelocity: the initial linear velocity of added objects. - @type linearVelocity: list [vx, vy, vz] - @ivar angularVelocity: the initial angular velocity of added objects. - @type angularVelocity: list [vx, vy, vz] - - @warning: An Add Object actuator will be ignored if at game start, the linked object doesn't exist - (or is empty) or the linked object is in an active layer. - - This will genereate a warning in the console: - - C{ERROR: GameObject I{Name} has a AddObjectActuator I{ActuatorName} without object (in 'nonactive' layer)} - """ -#{Deprecated - def setObject(object): - """ - Sets the game object to add. - - A copy of the object will be added to the scene when the actuator is activated. - - If the object does not exist, this function is ignored. - - object can either be a L{KX_GameObject} or the name of an object or None. - - @deprecated: use the L{object} property - @type object: L{KX_GameObject}, string or None - """ - def getObject(name_only = 0): - """ - Returns the name of the game object to be added. - - Returns None if no game object has been assigned to be added. - - @deprecated: use the L{object} property - @type name_only: bool - @param name_only: optional argument, when 0 return a KX_GameObject - @rtype: string, L{KX_GameObject} or None if no object is set - """ - def setTime(time): - """ - Sets the lifetime of added objects, in frames. - - If time == 0, the object will last forever. - - @deprecated: use the L{time} property - @type time: integer - @param time: The minimum value for time is 0. - """ - def getTime(): - """ - Returns the lifetime of the added object, in frames. - - @deprecated: use the L{time} property - @rtype: integer - """ - def setLinearVelocity(vx, vy, vz): - """ - Sets the initial linear velocity of added objects. - - @deprecated: use the L{linearVelocity} property - @type vx: float - @param vx: the x component of the initial linear velocity. - @type vy: float - @param vy: the y component of the initial linear velocity. - @type vz: float - @param vz: the z component of the initial linear velocity. - """ - def getLinearVelocity(): - """ - Returns the initial linear velocity of added objects. - - @deprecated: use the L{linearVelocity} property - @rtype: list [vx, vy, vz] - """ - def setAngularVelocity(vx, vy, vz): - """ - Sets the initial angular velocity of added objects. - - @deprecated: use the L{angularVelocity} property - @type vx: float - @param vx: the x component of the initial angular velocity. - @type vy: float - @param vy: the y component of the initial angular velocity. - @type vz: float - @param vz: the z component of the initial angular velocity. - """ - def getAngularVelocity(): - """ - Returns the initial angular velocity of added objects. - - @deprecated: use the L{angularVelocity} property - @rtype: list [vx, vy, vz] - """ - def getLastCreatedObject(): - """ - Returns the last object created by this actuator. - - @deprecated: use the L{objectLastCreated} property - @rtype: L{KX_GameObject} - @return: A L{KX_GameObject} or None if no object has been created. - """ -#} - def instantAddObject(): - """ - Returns the last object created by this actuator. The object can then be accessed from L{objectLastCreated}. - - @rtype: None - """ - -class KX_SCA_DynamicActuator(SCA_IActuator): - """ - Dynamic Actuator. - @ivar mode: the type of operation of the actuator, 0-4 - KX_DYN_RESTORE_DYNAMICS, KX_DYN_DISABLE_DYNAMICS, - KX_DYN_ENABLE_RIGID_BODY, KX_DYN_DISABLE_RIGID_BODY, KX_DYN_SET_MASS - @type mode: integer - @ivar mass: the mass value for the KX_DYN_SET_MASS operation - @type mass: float - """ -#{ Deprecated - def setOperation(operation): - """ - Set the type of operation when the actuator is activated: - - 0 = restore dynamics - - 1 = disable dynamics - - 2 = enable rigid body - - 3 = disable rigid body - - 4 = set mass - - @deprecated: Use the L{mode} attribute instead. - """ - def getOperation(): - """ - return the type of operation - @deprecated: Use the L{mode} attribute instead. - """ -#} - -class KX_SCA_EndObjectActuator(SCA_IActuator): - """ - Edit Object Actuator (in End Object mode) - - This actuator has no python methods. - """ - -class KX_SCA_ReplaceMeshActuator(SCA_IActuator): - """ - Edit Object actuator, in Replace Mesh mode. - - Example:: - # Level-of-detail - # Switch a game object's mesh based on its depth in the camera view. - # +----------+ +-----------+ +-------------------------------------+ - # | Always +-----+ Python +-----+ Edit Object (Replace Mesh) LOD.Mesh | - # +----------+ +-----------+ +-------------------------------------+ - import GameLogic - - # List detail meshes here - # Mesh (name, near, far) - # Meshes overlap so that they don't 'pop' when on the edge of the distance. - meshes = ((".Hi", 0.0, -20.0), - (".Med", -15.0, -50.0), - (".Lo", -40.0, -100.0) - ) - - co = GameLogic.getCurrentController() - obj = co.owner - act = co.actuators["LOD." + obj.name] - cam = GameLogic.getCurrentScene().active_camera - - def Depth(pos, plane): - return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3] - - # Depth is negative and decreasing further from the camera - depth = Depth(obj.position, cam.world_to_camera[2]) - - newmesh = None - curmesh = None - # Find the lowest detail mesh for depth - for mesh in meshes: - if depth < mesh[1] and depth > mesh[2]: - newmesh = mesh - if "ME" + obj.name + mesh[0] == act.getMesh(): - curmesh = mesh - - if newmesh != None and "ME" + obj.name + newmesh[0] != act.getMesh(): - # The mesh is a different mesh - switch it. - # Check the current mesh is not a better fit. - if curmesh == None or curmesh[1] < depth or curmesh[2] > depth: - act.mesh = obj.getName() + newmesh[0] - GameLogic.addActiveActuator(act, True) - - @warning: Replace mesh actuators will be ignored if at game start, the - named mesh doesn't exist. - - This will generate a warning in the console: - - C{ERROR: GameObject I{Name} ReplaceMeshActuator I{ActuatorName} without object} - - @ivar mesh: L{KX_MeshProxy} or the name of the mesh that will replace the current one - Set to None to disable actuator - @type mesh: L{KX_MeshProxy} or None if no mesh is set - - @ivar useDisplayMesh: when true the displayed mesh is replaced. - @type useDisplayMesh: boolean - @ivar usePhysicsMesh: when true the physics mesh is replaced. - @type usePhysicsMesh: boolean - """ - def setMesh(name): - """ - Sets the name of the mesh that will replace the current one. - When the name is None it will unset the mesh value so no action is taken. - - @deprecated: Use the L{mesh} attribute instead. - @type name: string or None - """ - def getMesh(): - """ - Returns the name of the mesh that will replace the current one. - - Returns None if no mesh has been scheduled to be added. - - @deprecated: Use the L{mesh} attribute instead. - @rtype: string or None - """ - def instantReplaceMesh(): - """ - Immediately replace mesh without delay. - @rtype: None - """ - -class KX_Scene(PyObjectPlus): - """ - An active scene that gives access to objects, cameras, lights and scene attributes. - - The activity culling stuff is supposed to disable logic bricks when their owner gets too far - from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows - what it does! - - Example:: - import GameLogic - - # get the scene - scene = GameLogic.getCurrentScene() - - # print all the objects in the scene - for obj in scene.objects: - print obj.name - - # get an object named 'Cube' - obj = scene.objects["Cube"] - - # get the first object in the scene. - obj = scene.objects[0] - - Example:: - # Get the depth of an object in the camera view. - import GameLogic - - obj = GameLogic.getCurrentController().owner - cam = GameLogic.getCurrentScene().active_camera - - # Depth is negative and decreasing further from the camera - depth = obj.position[0]*cam.world_to_camera[2][0] + obj.position[1]*cam.world_to_camera[2][1] + obj.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3] - - @bug: All attributes are read only at the moment. - - @ivar name: The scene's name, (read-only). - @type name: string - @ivar objects: A list of objects in the scene, (read-only). - @type objects: L{CListValue} of L{KX_GameObject} - @ivar objectsInactive: A list of objects on background layers (used for the addObject actuator), (read-only). - @type objectsInactive: L{CListValue} of L{KX_GameObject} - @ivar lights: A list of lights in the scene, (read-only). - @type lights: L{CListValue} of L{KX_LightObject} - @ivar cameras: A list of cameras in the scene, (read-only). - @type cameras: L{CListValue} of L{KX_Camera} - @ivar active_camera: The current active camera. - note: this can be set directly from python to avoid using the L{KX_SceneActuator}. - @type active_camera: L{KX_Camera} - @ivar suspended: True if the scene is suspended, (read-only). - @type suspended: boolean - @ivar activity_culling: True if the scene is activity culling - @type activity_culling: boolean - @ivar activity_culling_radius: The distance outside which to do activity culling. Measured in manhattan distance. - @type activity_culling_radius: float - @ivar dbvt_culling: True when Dynamic Bounding box Volume Tree is set (read-only). - @type dbvt_culling: bool - @ivar pre_draw: A list of callables to be run before the render step. - @type pre_draw: list - @ivar post_draw: A list of callables to be run after the render step. - @type post_draw: list - @group Deprecated: getLightList, getObjectList, getName - """ - - def getLightList(): - """ - Returns the list of lights in the scene. - - @deprecated: Use the L{lights} attribute instead. - @rtype: list [L{KX_LightObject}] - """ - def getObjectList(): - """ - Returns the list of objects in the scene. - - @deprecated: Use the L{objects} attribute instead. - @rtype: list [L{KX_GameObject}] - """ - def getName(): - """ - Returns the name of the scene. - - @deprecated: Use the L{name} attribute instead. - @rtype: string - """ - - def addObject(object, other, time=0): - """ - Adds an object to the scene like the Add Object Actuator would, and returns the created object. - - @param object: The object to add - @type object: L{KX_GameObject} or string - @param other: The object's center to use when adding the object - @type other: L{KX_GameObject} or string - @param time: The lifetime of the added object, in frames. A time of 0 means the object will last forever. - @type time: int - - @rtype: L{KX_GameObject} - """ - - def end(): - """ - Removes the scene from the game. - """ - - def restart(): - """ - Restarts the scene. - """ - - def replace(scene): - """ - Replaces this scene with another one. - - @param scene: The name of the scene to replace this scene with. - @type scene: string - """ - - def suspend(): - """ - Suspends this scene. - """ - - def resume(): - """ - Resume this scene. - """ - - def get(key, default=None): - """ - Return the value matching key, or the default value if its not found. - @return: The key value or a default. - """ - -class KX_SceneActuator(SCA_IActuator): - """ - Scene Actuator logic brick. - - @warning: Scene actuators that use a scene name will be ignored if at game start, the - named scene doesn't exist or is empty - - This will generate a warning in the console: - - C{ERROR: GameObject I{Name} has a SceneActuator I{ActuatorName} (SetScene) without scene} - - @ivar scene: the name of the scene to change to/overlay/underlay/remove/suspend/resume - @type scene: string. - @ivar camera: the camera to change to. - When setting the attribute, you can use either a L{KX_Camera} or the name of the camera. - @type camera: L{KX_Camera} on read, string or L{KX_Camera} on write - @ivar useRestart: Set flag to True to restart the sene - @type useRestart: bool - @ivar mode: The mode of the actuator - @type mode: int from 0 to 5 L{GameLogic.Scene Actuator} - """ -#{ Deprecated - def setUseRestart(flag): - """ - Set flag to True to restart the scene. - - @deprecated: Use the L{useRestart} attribute instead. - @type flag: boolean - """ - def setScene(scene): - """ - Sets the name of the scene to change to/overlay/underlay/remove/suspend/resume. - - @deprecated: use the L{scene} attribute instead. - @type scene: string - """ - def setCamera(camera): - """ - Sets the camera to change to. - - Camera can be either a L{KX_Camera} or the name of the camera. - - @deprecated: use the L{camera} attribute instead. - @type camera: L{KX_Camera} or string - """ - def getUseRestart(): - """ - Returns True if the scene will be restarted. - - @deprecated: use the L{useRestart} attribute instead. - @rtype: boolean - """ - def getScene(): - """ - Returns the name of the scene to change to/overlay/underlay/remove/suspend/resume. - - Returns an empty string ("") if no scene has been set. - - @deprecated: use the L{scene} attribute instead. - @rtype: string - """ - def getCamera(): - """ - Returns the name of the camera to change to. - - @deprecated: use the L{camera} attribute instead. - @rtype: string - """ -#} - -class KX_SoundActuator(SCA_IActuator): - """ - Sound Actuator. - - The L{startSound()}, L{pauseSound()} and L{stopSound()} do not require - the actuator to be activated - they act instantly provided that the actuator has - been activated once at least. - - @ivar fileName: The filename of the sound this actuator plays. - @type fileName: string - - @ivar volume: The volume (gain) of the sound. - @type volume: float - - @ivar pitch: The pitch of the sound. - @type pitch: float - - @ivar rollOffFactor: The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away. - @type rollOffFactor: float - - @ivar looping: The loop mode of the actuator. - @type looping: integer - - @ivar position: The position of the sound as a list: [x, y, z]. - @type position: float array - - @ivar velocity: The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z]. - @type velocity: float array - - @ivar orientation: The orientation of the sound. When setting the orientation you can also use quaternion [float,float,float,float] or euler angles [float,float,float] - @type orientation: 3x3 matrix [[float]] - - @ivar mode: The operation mode of the actuator. You can use one of the following constants: - - KX_SOUNDACT_PLAYSTOP (1) - - KX_SOUNDACT_PLAYEND (2) - - KX_SOUNDACT_LOOPSTOP (3) - - KX_SOUNDACT_LOOPEND (4) - - KX_SOUNDACT_LOOPBIDIRECTIONAL (5) - - KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP (6) - @type mode: integer - """ - -#{ Play Methods - def startSound(): - """ - Starts the sound. - """ - def pauseSound(): - """ - Pauses the sound. - """ - def stopSound(): - """ - Stops the sound. - """ -#} - -#{ Deprecated - def setFilename(filename): - """ - Sets the filename of the sound this actuator plays. - - @deprecated: Use the L{fileName} attribute instead. - @type filename: string - """ - def getFilename(): - """ - Returns the filename of the sound this actuator plays. - - @deprecated: Use the L{fileName} attribute instead. - @rtype: string - """ - def setGain(gain): - """ - Sets the gain (volume) of the sound - - @deprecated: Use the L{volume} attribute instead. - @type gain: float - @param gain: 0.0 (quiet) <= gain <= 1.0 (loud) - """ - def getGain(): - """ - Gets the gain (volume) of the sound. - - @deprecated: Use the L{volume} attribute instead. - @rtype: float - """ - def setPitch(pitch): - """ - Sets the pitch of the sound. - - @deprecated: Use the L{pitch} attribute instead. - @type pitch: float - """ - def getPitch(): - """ - Returns the pitch of the sound. - - @deprecated: Use the L{pitch} attribute instead. - @rtype: float - """ - def setRollOffFactor(rolloff): - """ - Sets the rolloff factor for the sounds. - - Rolloff defines the rate of attenuation as the sound gets further away. - Higher rolloff factors shorten the distance at which the sound can be heard. - - @deprecated: Use the L{rollOffFactor} attribute instead. - @type rolloff: float - """ - def getRollOffFactor(): - """ - Returns the rolloff factor for the sound. - - @deprecated: Use the L{rollOffFactor} attribute instead. - @rtype: float - """ - def setLooping(loop): - """ - Sets the loop mode of the actuator. - - @bug: There are no constants defined for this method! - @param loop: - Play Stop 1 - - Play End 2 - - Loop Stop 3 - - Loop End 4 - - Bidirection Stop 5 - - Bidirection End 6 - - @deprecated: Use the L{looping} attribute instead. - @type loop: integer - """ - def getLooping(): - """ - Returns the current loop mode of the actuator. - - @deprecated: Use the L{looping} attribute instead. - @rtype: integer - """ - def setPosition(x, y, z): - """ - Sets the position this sound will come from. - - @deprecated: Use the L{position} attribute instead. - @type x: float - @param x: The x coordinate of the sound. - @type y: float - @param y: The y coordinate of the sound. - @type z: float - @param z: The z coordinate of the sound. - """ - def setVelocity(vx, vy, vz): - """ - Sets the velocity this sound is moving at. - - The sound's pitch is determined from the velocity. - - @deprecated: Use the L{velocity} attribute instead. - @type vx: float - @param vx: The vx coordinate of the sound. - @type vy: float - @param vy: The vy coordinate of the sound. - @type vz: float - @param vz: The vz coordinate of the sound. - """ - def setOrientation(o11, o12, o13, o21, o22, o23, o31, o32, o33): - """ - Sets the orientation of the sound. - - The nine parameters specify a rotation matrix:: - | o11, o12, o13 | - | o21, o22, o23 | - | o31, o32, o33 | - @deprecated: Use the L{orientation} attribute instead. - """ - - def setType(mode): - """ - Sets the operation mode of the actuator. - - @deprecated: Use the L{type} attribute instead. - @param mode: KX_SOUNDACT_PLAYSTOP, KX_SOUNDACT_PLAYEND, KX_SOUNDACT_LOOPSTOP, KX_SOUNDACT_LOOPEND, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP - @type mode: integer - """ - - def getType(): - """ - Returns the operation mode of the actuator. - - @deprecated: Use the L{type} attribute instead. - @rtype: integer - @return: KX_SOUNDACT_PLAYSTOP, KX_SOUNDACT_PLAYEND, KX_SOUNDACT_LOOPSTOP, KX_SOUNDACT_LOOPEND, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP - """ -#} - -class KX_StateActuator(SCA_IActuator): - """ - State actuator changes the state mask of parent object. - - Property: - - @ivar operation: type of bit operation to be applied on object state mask. - You can use one of the following constant: - - KX_STATE_OP_CPY (0) : Copy state mask - - KX_STATE_OP_SET (1) : Add bits to state mask - - KX_STATE_OP_CLR (2) : Substract bits to state mask - - KX_STATE_OP_NEG (3) : Invert bits to state mask - @type operation: integer - - @ivar mask: value that defines the bits that will be modified by the operation. - The bits that are 1 in the mask will be updated in the object state, - the bits that are 0 are will be left unmodified expect for the Copy operation - which copies the mask to the object state - @type mask: integer - """ - def setOperation(op): - """ - Set the type of bit operation to be applied on object state mask. - Use setMask() to specify the bits that will be modified. - - @deprecated: Use the L{operation} attribute instead. - @param op: bit operation (0=Copy, 1=Add, 2=Substract, 3=Invert) - @type op: integer - """ - def setMask(mask): - """ - Set the value that defines the bits that will be modified by the operation. - The bits that are 1 in the value will be updated in the object state, - the bits that are 0 are will be left unmodified expect for the Copy operation - which copies the value to the object state. - - @deprecated: Use the L{mask} attribute instead. - @param mask: bits that will be modified - @type mask: integer - """ - -class KX_TrackToActuator(SCA_IActuator): - """ - Edit Object actuator in Track To mode. - - @warning: Track To Actuators will be ignored if at game start, the - object to track to is invalid. - - This will generate a warning in the console: - - C{ERROR: GameObject I{Name} no object in EditObjectActuator I{ActuatorName}} - - @ivar object: the object this actuator tracks. - @type object: L{KX_GameObject} or None - @ivar time: the time in frames with which to delay the tracking motion - @type time: integer - @ivar use3D: the tracking motion to use 3D - @type use3D: boolean - - """ -#{ Deprecated - def setObject(object): - """ - Sets the object to track. - - @deprecated: Use the L{object} attribute instead. - @type object: L{KX_GameObject}, string or None - @param object: Either a reference to a game object or the name of the object to track. - """ - def getObject(name_only): - """ - Returns the name of the object to track. - - @deprecated: Use the L{object} attribute instead. - @type name_only: bool - @param name_only: optional argument, when 0 return a KX_GameObject - @rtype: string, L{KX_GameObject} or None if no object is set - """ - def setTime(time): - """ - Sets the time in frames with which to delay the tracking motion. - - @deprecated: Use the L{time} attribute instead. - @type time: integer - """ - def getTime(): - """ - Returns the time in frames with which the tracking motion is delayed. - - @deprecated: Use the L{time} attribute instead. - @rtype: integer - """ - def setUse3D(use3d): - """ - DEPRECATED: Use the property. - Sets the tracking motion to use 3D. - - @deprecated: Use the L{use3D} attribute instead. - @type use3d: boolean - @param use3d: - True: allow the tracking motion to extend in the z-direction. - - False: lock the tracking motion to the x-y plane. - """ - def getUse3D(): - """ - Returns True if the tracking motion will track in the z direction. - - @deprecated: Use the L{use3D} attribute instead. - @rtype: boolean - """ -#} - -class KX_VehicleWrapper(PyObjectPlus): - """ - KX_VehicleWrapper - - TODO - description - """ - - def addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering): - - """ - Add a wheel to the vehicle - - @param wheel: The object to use as a wheel. - @type wheel: L{KX_GameObject} or a KX_GameObject name - @param attachPos: The position that this wheel will attach to. - @type attachPos: vector of 3 floats - @param attachDir: The direction this wheel points. - @type attachDir: vector of 3 floats - @param axleDir: The direction of this wheels axle. - @type axleDir: vector of 3 floats - @param suspensionRestLength: TODO - Description - @type suspensionRestLength: float - @param wheelRadius: The size of the wheel. - @type wheelRadius: float - """ - - def applyBraking(force, wheelIndex): - """ - Apply a braking force to the specified wheel - - @param force: the brake force - @type force: float - - @param wheelIndex: index of the wheel where the force needs to be applied - @type wheelIndex: integer - """ - def applyEngineForce(force, wheelIndex): - """ - Apply an engine force to the specified wheel - - @param force: the engine force - @type force: float - - @param wheelIndex: index of the wheel where the force needs to be applied - @type wheelIndex: integer - """ - def getConstraintId(): - """ - Get the constraint ID - - @rtype: integer - @return: the constraint id - """ - def getConstraintType(): - """ - Returns the constraint type. - - @rtype: integer - @return: constraint type - """ - def getNumWheels(): - """ - Returns the number of wheels. - - @rtype: integer - @return: the number of wheels for this vehicle - """ - def getWheelOrientationQuaternion(wheelIndex): - """ - Returns the wheel orientation as a quaternion. - - @param wheelIndex: the wheel index - @type wheelIndex: integer - - @rtype: TODO - type should be quat as per method name but from the code it looks like a matrix - @return: TODO Description - """ - def getWheelPosition(wheelIndex): - """ - Returns the position of the specified wheel - - @param wheelIndex: the wheel index - @type wheelIndex: integer - - @rtype: list[x, y, z] - @return: position vector - """ - def getWheelRotation(wheelIndex): - """ - Returns the rotation of the specified wheel - - @param wheelIndex: the wheel index - @type wheelIndex: integer - - @rtype: float - @return: the wheel rotation - """ - def setRollInfluence(rollInfluece, wheelIndex): - """ - Set the specified wheel's roll influence. - The higher the roll influence the more the vehicle will tend to roll over in corners. - - @param rollInfluece: the wheel roll influence - @type rollInfluece: float - - @param wheelIndex: the wheel index - @type wheelIndex: integer - """ - def setSteeringValue(steering, wheelIndex): - """ - Set the specified wheel's steering - - @param steering: the wheel steering - @type steering: float - - @param wheelIndex: the wheel index - @type wheelIndex: integer - """ - def setSuspensionCompression(compression, wheelIndex): - """ - Set the specified wheel's compression - - @param compression: the wheel compression - @type compression: float - - @param wheelIndex: the wheel index - @type wheelIndex: integer - """ - def setSuspensionDamping(damping, wheelIndex): - """ - Set the specified wheel's damping - - @param damping: the wheel damping - @type damping: float - - @param wheelIndex: the wheel index - @type wheelIndex: integer - """ - def setSuspensionStiffness(stiffness, wheelIndex): - """ - Set the specified wheel's stiffness - - @param stiffness: the wheel stiffness - @type stiffness: float - - @param wheelIndex: the wheel index - @type wheelIndex: integer - """ - def setTyreFriction(friction, wheelIndex): - """ - Set the specified wheel's tyre friction - - @param friction: the tyre friction - @type friction: float - - @param wheelIndex: the wheel index - @type wheelIndex: integer - """ - -class KX_VertexProxy(SCA_IObject): - """ - A vertex holds position, UV, colour and normal information. - - Note: - The physics simulation is NOT currently updated - physics will not respond - to changes in the vertex position. - - @ivar XYZ: The position of the vertex. - @type XYZ: list [x, y, z] - @ivar UV: The texture coordinates of the vertex. - @type UV: list [u, v] - @ivar normal: The normal of the vertex - @type normal: list [nx, ny, nz] - @ivar colour: The colour of the vertex. - Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0] - @type colour: list [r, g, b, a] - @ivar color: Synonym for colour. - - @group Position: x, y, z - @ivar x: The x coordinate of the vertex. - @type x: float - @ivar y: The y coordinate of the vertex. - @type y: float - @ivar z: The z coordinate of the vertex. - @type z: float - - @group Texture Coordinates: u, v - @ivar u: The u texture coordinate of the vertex. - @type u: float - @ivar v: The v texture coordinate of the vertex. - @type v: float - - @ivar u2: The second u texture coordinate of the vertex. - @type u2: float - @ivar v2: The second v texture coordinate of the vertex. - @type v2: float - - @group Colour: r, g, b, a - @ivar r: The red component of the vertex colour. 0.0 <= r <= 1.0 - @type r: float - @ivar g: The green component of the vertex colour. 0.0 <= g <= 1.0 - @type g: float - @ivar b: The blue component of the vertex colour. 0.0 <= b <= 1.0 - @type b: float - @ivar a: The alpha component of the vertex colour. 0.0 <= a <= 1.0 - @type a: float - """ - - def getXYZ(): - """ - Gets the position of this vertex. - - @rtype: list [x, y, z] - @return: this vertexes position in local coordinates. - """ - def setXYZ(pos): - """ - Sets the position of this vertex. - - @type pos: list [x, y, z] - @param pos: the new position for this vertex in local coordinates. - """ - def getUV(): - """ - Gets the UV (texture) coordinates of this vertex. - - @rtype: list [u, v] - @return: this vertexes UV (texture) coordinates. - """ - def setUV(uv): - """ - Sets the UV (texture) coordinates of this vertex. - - @type uv: list [u, v] - """ - def getUV2(): - """ - Gets the 2nd UV (texture) coordinates of this vertex. - - @rtype: list [u, v] - @return: this vertexes UV (texture) coordinates. - """ - def setUV2(uv, unit): - """ - Sets the 2nd UV (texture) coordinates of this vertex. - - @type uv: list [u, v] - @param unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV - @param unit: int - """ - def getRGBA(): - """ - Gets the colour of this vertex. - - The colour is represented as four bytes packed into an integer value. The colour is - packed as RGBA. - - Since Python offers no way to get each byte without shifting, you must use the struct module to - access colour in an machine independent way. - - Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead. - - Example:: - import struct; - col = struct.unpack('4B', struct.pack('I', v.getRGBA())) - # col = (r, g, b, a) - # black = ( 0, 0, 0, 255) - # white = (255, 255, 255, 255) - - @rtype: integer - @return: packed colour. 4 byte integer with one byte per colour channel in RGBA format. - """ - def setRGBA(col): - """ - Sets the colour of this vertex. - - See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes - or the colour attribute instead. - - setRGBA() also accepts a four component list as argument col. The list represents the colour as [r, g, b, a] - with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0] - - Example:: - v.setRGBA(0xff0000ff) # Red - v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian - v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red - v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms. - - @type col: integer or list [r, g, b, a] - @param col: the new colour of this vertex in packed RGBA format. - """ - def getNormal(): - """ - Gets the normal vector of this vertex. - - @rtype: list [nx, ny, nz] - @return: normalised normal vector. - """ - def setNormal(normal): - """ - Sets the normal vector of this vertex. - - @type normal: sequence of floats [r, g, b] - @param normal: the new normal of this vertex. - """ - -class KX_VisibilityActuator(SCA_IActuator): - """ - Visibility Actuator. - @ivar visibility: whether the actuator makes its parent object visible or invisible - @type visibility: boolean - @ivar useOcclusion: whether the actuator makes its parent object an occluder or not - @type useOcclusion: boolean - @ivar useRecursion: whether the visibility/occlusion should be propagated to all children of the object - @type useRecursion: boolean - """ -#{ Deprecated - def set(visible): - """ - Sets whether the actuator makes its parent object visible or invisible. - - @deprecated: Use the L{visibility} attribute instead. - @param visible: - True: Makes its parent visible. - - False: Makes its parent invisible. - """ -#} - -class SCA_2DFilterActuator(SCA_IActuator): - """ - Create, enable and disable 2D filters - - Properties: - - The following properties don't have an immediate effect. - You must active the actuator to get the result. - The actuator is not persistent: it automatically stops itself after setting up the filter - but the filter remains active. To stop a filter you must activate the actuator with 'type' - set to RAS_2DFILTER_DISABLED or RAS_2DFILTER_NOFILTER. - - @ivar shaderText: shader source code for custom shader - @type shaderText: string - @ivar disableMotionBlur: action on motion blur: 0=enable, 1=disable - @type disableMotionBlur: integer - @ivar mode: type of 2D filter, use one of the following constants: - RAS_2DFILTER_ENABLED (-2) : enable the filter that was previously disabled - RAS_2DFILTER_DISABLED (-1) : disable the filter that is currently active - RAS_2DFILTER_NOFILTER (0) : disable and destroy the filter that is currently active - RAS_2DFILTER_MOTIONBLUR (1) : create and enable preset filters - RAS_2DFILTER_BLUR (2) - RAS_2DFILTER_SHARPEN (3) - RAS_2DFILTER_DILATION (4) - RAS_2DFILTER_EROSION (5) - RAS_2DFILTER_LAPLACIAN (6) - RAS_2DFILTER_SOBEL (7) - RAS_2DFILTER_PREWITT (8) - RAS_2DFILTER_GRAYSCALE (9) - RAS_2DFILTER_SEPIA (10) - RAS_2DFILTER_INVERT (11) - RAS_2DFILTER_CUSTOMFILTER (12) : customer filter, the code code is set via shaderText property - @type mode: integer - @ivar passNumber: order number of filter in the stack of 2D filters. Filters are executed in increasing order of passNb. - Only be one filter can be defined per passNb. - @type passNumber: integer (0-100) - @ivar value: argument for motion blur filter - @type value: float (0.0-100.0) - """ - -class SCA_ANDController(SCA_IController): - """ - An AND controller activates only when all linked sensors are activated. - - There are no special python methods for this controller. - """ - -class SCA_ActuatorSensor(SCA_ISensor): - """ - Actuator sensor detect change in actuator state of the parent object. - It generates a positive pulse if the corresponding actuator is activated - and a negative pulse if the actuator is deactivated. - - Properties: - - @ivar actuator: the name of the actuator that the sensor is monitoring. - @type actuator: string - """ -#{Deprecated - def getActuator(): - """ - Return the Actuator with which the sensor operates. - - @deprecated: Use the L{actuator} attribute instead. - @rtype: string - """ - def setActuator(name): - """ - Sets the Actuator with which to operate. If there is no Actuator - of this name, the function has no effect. - - @deprecated: Use the L{actuator} attribute instead. - @param name: actuator name - @type name: string - """ -#} - -class SCA_AlwaysSensor(SCA_ISensor): - """ - This sensor is always activated. - """ - -class SCA_DelaySensor(SCA_ISensor): - """ - The Delay sensor generates positive and negative triggers at precise time, - expressed in number of frames. The delay parameter defines the length - of the initial OFF period. A positive trigger is generated at the end of this period. - The duration parameter defines the length of the ON period following the OFF period. - There is a negative trigger at the end of the ON period. If duration is 0, the sensor - stays ON and there is no negative trigger. - The sensor runs the OFF-ON cycle once unless the repeat option is set: the - OFF-ON cycle repeats indefinately (or the OFF cycle if duration is 0). - Use SCA_ISensor::reset() at any time to restart sensor. - - Properties: - - @ivar delay: length of the initial OFF period as number of frame, 0 for immediate trigger. - @type delay: integer. - @ivar duration: length of the ON period in number of frame after the initial OFF period. - If duration is greater than 0, a negative trigger is sent at the end of the ON pulse. - @type duration: integer - @ivar repeat: 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once. - @type repeat: integer - """ -#{Deprecated - def setDelay(delay): - """ - Set the initial delay before the positive trigger. - - @deprecated: Use the L{delay} attribute instead. - @param delay: length of the initial OFF period as number of frame, 0 for immediate trigger - @type delay: integer - """ - def setDuration(duration): - """ - Set the duration of the ON pulse after initial delay and the generation of the positive trigger. - If duration is greater than 0, a negative trigger is sent at the end of the ON pulse. - - @deprecated: Use the L{duration} attribute instead. - @param duration: length of the ON period in number of frame after the initial OFF period - @type duration: integer - """ - def setRepeat(repeat): - """ - Set if the sensor repeat mode. - - @deprecated: Use the L{repeat} attribute instead. - @param repeat: 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once. - @type repeat: integer - """ - def getDelay(): - """ - Return the delay parameter value. - - @deprecated: Use the L{delay} attribute instead. - @rtype: integer - """ - def getDuration(): - """ - Return the duration parameter value - - @deprecated: Use the L{duration} attribute instead. - @rtype: integer - """ - def getRepeat(): - """ - Return the repeat parameter value - - @deprecated: Use the L{repeat} attribute instead. - @rtype: KX_TRUE or KX_FALSE - """ -#} - -class SCA_JoystickSensor(SCA_ISensor): - """ - This sensor detects player joystick events. - - Properties: - - @ivar axisValues: (read-only) The state of the joysticks axis as a list of values L{numAxis} long. - each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing. - The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls. - left:[-32767, 0, ...], right:[32767, 0, ...], up:[0, -32767, ...], down:[0, 32767, ...] - @type axisValues: list of ints - - @ivar axisSingle: (read-only) like L{axisValues} but returns a single axis value that is set by the sensor. - Only use this for "Single Axis" type sensors otherwise it will raise an error. - @type axisSingle: int - - @ivar hatValues: (read-only) The state of the joysticks hats as a list of values L{numHats} long. - each spesifying the direction of the hat from 1 to 12, 0 when inactive. - Hat directions are as follows... - - 0:None - - 1:Up - - 2:Right - - 4:Down - - 8:Left - - 3:Up - Right - - 6:Down - Right - - 12:Down - Left - - 9:Up - Left - - @type hatValues: list of ints - - @ivar hatSingle: (read-only) like L{hatValues} but returns a single hat direction value that is set by the sensor. - @type hatSingle: int - - @ivar numAxis: (read-only) The number of axes for the joystick at this index. - @type numAxis: integer - @ivar numButtons: (read-only) The number of buttons for the joystick at this index. - @type numButtons: integer - @ivar numHats: (read-only) The number of hats for the joystick at this index. - @type numHats: integer - @ivar connected: (read-only) True if a joystick is connected at this joysticks index. - @type connected: boolean - @ivar index: The joystick index to use (from 0 to 7). The first joystick is always 0. - @type index: integer - @ivar threshold: Axis threshold. Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive. - @type threshold: integer - @ivar button: The button index the sensor reacts to (first button = 0). When the "All Events" toggle is set, this option has no effect. - @type button: integer - @ivar axis: The axis this sensor reacts to, as a list of two values [axisIndex, axisDirection] - axisIndex: the axis index to use when detecting axis movement, 1=primary directional control, 2=secondary directional control. - axisDirection: 0=right, 1=up, 2=left, 3=down - @type axis: [integer, integer] - @ivar hat: The hat the sensor reacts to, as a list of two values: [hatIndex, hatDirection] - hatIndex: the hat index to use when detecting hat movement, 1=primary hat, 2=secondary hat (4 max). - hatDirection: 1-12 - @type hat: [integer, integer] - """ - - def getButtonActiveList(): - """ - Returns a list containing the indicies of the currently pressed buttons. - @rtype: list - """ - def getButtonStatus(buttonIndex): - """ - Returns a bool of the current pressed state of the specified button. - @param buttonIndex: the button index, 0=first button - @type buttonIndex: integer - @rtype: bool - """ -#{Deprecated - def getIndex(): - """ - Returns the joystick index to use (from 1 to 8). - - @deprecated: Use the L{index} attribute instead. - @rtype: integer - """ - def setIndex(index): - """ - Sets the joystick index to use. - - @deprecated: Use the L{index} attribute instead. - @param index: The index of this joystick sensor, Clamped between 1 and 8. - @type index: integer - @note: This is only useful when you have more then 1 joystick connected to your computer - multiplayer games. - """ - def getAxis(): - """ - Returns the current axis this sensor reacts to. See L{getAxisValue()} for the current axis state. - - @deprecated: Use the L{axis} attribute instead. - @rtype: list - @return: 2 values returned are [axisIndex, axisDirection] - see L{setAxis()} for their purpose. - @note: When the "All Events" toggle is set, this option has no effect. - """ - def setAxis(axisIndex, axisDirection): - """ - @deprecated: Use the L{axis} attribute instead. - @param axisIndex: Set the axis index to use when detecting axis movement. - @type axisIndex: integer from 1 to 2 - @param axisDirection: Set the axis direction used for detecting motion. 0:right, 1:up, 2:left, 3:down. - @type axisDirection: integer from 0 to 3 - @note: When the "All Events" toggle is set, this option has no effect. - """ - def getAxisValue(): - """ - Returns the state of the joysticks axis. See differs to L{getAxis()} returning the current state of the joystick. - - @deprecated: Use the L{axisValues} attribute instead. - @rtype: list - @return: 4 values, each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing. - - The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls. - - left:[-32767, 0, ...], right:[32767, 0, ...], up:[0, -32767, ...], down:[0, 32767, ...] - @note: Some gamepads only set the axis on and off like a button. - """ - def getThreshold(): - """ - Get the axis threshold. See L{setThreshold()} for details. - - @deprecated: Use the L{threshold} attribute instead. - @rtype: integer - """ - def setThreshold(threshold): - """ - Set the axis threshold. - - @deprecated: Use the L{threshold} attribute instead. - @param threshold: Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive. - @type threshold: integer - """ - def getButton(): - """ - Returns the button index the sensor reacts to. See L{getButtonValue()} for a list of pressed buttons. - - @deprecated: Use the L{button} attribute instead. - @rtype: integer - @note: When the "All Events" toggle is set, this option has no effect. - """ - def setButton(index): - """ - Sets the button index the sensor reacts to when the "All Events" option is not set. - - @deprecated: Use the L{button} attribute instead. - @note: When the "All Events" toggle is set, this option has no effect. - """ - def getButtonValue(): - """ - Returns a list containing the indicies of the currently pressed buttons. - - @deprecated: Use the L{getButtonActiveList} method instead. - @rtype: list - """ - def getHat(): - """ - Returns the current hat direction this sensor is set to. - [hatNumber, hatDirection]. - - @deprecated: Use the L{hat} attribute instead. - @rtype: list - @note: When the "All Events" toggle is set, this option has no effect. - """ - def setHat(index,direction): - """ - Sets the hat index the sensor reacts to when the "All Events" option is not set. - - @deprecated: Use the L{hat} attribute instead. - @type index: integer - """ - def getNumAxes(): - """ - Returns the number of axes for the joystick at this index. - - @deprecated: Use the L{numAxis} attribute instead. - @rtype: integer - """ - def getNumButtons(): - """ - Returns the number of buttons for the joystick at this index. - - @deprecated: Use the L{numButtons} attribute instead. - @rtype: integer - """ - def getNumHats(): - """ - Returns the number of hats for the joystick at this index. - - @deprecated: Use the L{numHats} attribute instead. - @rtype: integer - """ - def isConnected(): - """ - Returns True if a joystick is detected at this joysticks index. - - @deprecated: Use the L{connected} attribute instead. - @rtype: bool - """ -#} - -class SCA_KeyboardSensor(SCA_ISensor): - """ - A keyboard sensor detects player key presses. - - See module L{GameKeys} for keycode values. - - @ivar key: The key code this sensor is looking for. - @type key: keycode from L{GameKeys} module - @ivar hold1: The key code for the first modifier this sensor is looking for. - @type hold1: keycode from L{GameKeys} module - @ivar hold2: The key code for the second modifier this sensor is looking for. - @type hold2: keycode from L{GameKeys} module - @ivar toggleProperty: The name of the property that indicates whether or not to log keystrokes as a string. - @type toggleProperty: string - @ivar targetProperty: The name of the property that receives keystrokes in case in case a string is logged. - @type targetProperty: string - @ivar useAllKeys: Flag to determine whether or not to accept all keys. - @type useAllKeys: boolean - @ivar events: a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). - - - 'keycode' matches the values in L{GameKeys}. - - 'status' uses... - - L{GameLogic.KX_INPUT_NONE} - - L{GameLogic.KX_INPUT_JUST_ACTIVATED} - - L{GameLogic.KX_INPUT_ACTIVE} - - L{GameLogic.KX_INPUT_JUST_RELEASED} - - @type events: list [[keycode, status], ...] - """ - - def getKeyStatus(keycode): - """ - Get the status of a key. - - @rtype: key state L{GameLogic} members (KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED) - @return: The state of the given key - @type keycode: integer - @param keycode: The code that represents the key you want to get the state of - """ - -#{Deprecated - def getKey(): - """ - Returns the key code this sensor is looking for. - - @deprecated: Use the L{key} attribute instead. - @rtype: keycode from L{GameKeys} module - """ - - def setKey(keycode): - """ - Set the key this sensor should listen for. - - @deprecated: Use the L{key} attribute instead. - @type keycode: keycode from L{GameKeys} module - """ - - def getHold1(): - """ - Returns the key code for the first modifier this sensor is looking for. - - @deprecated: Use the L{hold1} attribute instead. - @rtype: keycode from L{GameKeys} module - """ - - def setHold1(keycode): - """ - Sets the key code for the first modifier this sensor should look for. - - @deprecated: Use the L{hold1} attribute instead. - @type keycode: keycode from L{GameKeys} module - """ - - def getHold2(): - """ - Returns the key code for the second modifier this sensor is looking for. - - @deprecated: Use the L{hold2} attribute instead. - @rtype: keycode from L{GameKeys} module - """ - - def setHold2(keycode): - """ - Sets the key code for the second modifier this sensor should look for. - - @deprecated: Use the L{hold2} attribute instead. - @type keycode: keycode from L{GameKeys} module - """ - - def getPressedKeys(): - """ - Get a list of keys that have either been pressed, or just released this frame. - - @deprecated: Use the L{events} attribute instead. - @rtype: list of key status. [[keycode, status]] - """ - - def getCurrentlyPressedKeys(): - """ - Get a list of currently pressed keys that have either been pressed, or just released - - @deprecated: Use the L{events} attribute instead. - @rtype: list of key status. [[keycode, status]] - """ -#} - -class SCA_NANDController(SCA_IController): - """ - An NAND controller activates when all linked sensors are not active. - - There are no special python methods for this controller. - """ - -class SCA_NORController(SCA_IController): - """ - An NOR controller activates only when all linked sensors are de-activated. - - There are no special python methods for this controller. - """ - -class SCA_ORController(SCA_IController): - """ - An OR controller activates when any connected sensor activates. - - There are no special python methods for this controller. - """ - -class SCA_PropertyActuator(SCA_IActuator): - """ - Property Actuator - - Properties: - - @ivar propName: the property on which to operate. - @type propName: string - @ivar value: the value with which the actuator operates. - @type value: string - @ivar mode: TODO - add constants to game logic dict!. - @type mode: int - """ -#{ Deprecated - def setProperty(prop): - """ - Set the property on which to operate. - - If there is no property of this name, the call is ignored. - - @deprecated: Use the L{propName} attribute instead. - @type prop: string - @param prop: The name of the property to set. - """ - def getProperty(): - """ - Returns the name of the property on which to operate. - - @deprecated: Use the L{propName} attribute instead. - @rtype: string - """ - def setValue(value): - """ - Set the value with which the actuator operates. - - If the value is not compatible with the type of the - property, the subsequent action is ignored. - - @deprecated: Use the L{value} attribute instead. - @type value: string - """ - def getValue(): - """ - Gets the value with which this actuator operates. - - @deprecated: Use the L{value} attribute instead. - @rtype: string - """ -#} - -class SCA_PropertySensor(SCA_ISensor): - """ - Activates when the game object property matches. - - Properties: - - @ivar mode: type of check on the property: - KX_PROPSENSOR_EQUAL(1), KX_PROPSENSOR_NOTEQUAL(2), KX_PROPSENSOR_INTERVAL(3), - KX_PROPSENSOR_CHANGED(4), KX_PROPSENSOR_EXPRESSION(5) - @type mode: integer - @ivar propName: the property the sensor operates. - @type propName: string - @ivar value: the value with which the sensor compares to the value of the property. - @type value: string - @ivar min: the minimum value of the range used to evaluate the property when in interval mode. - @type min: string - @ivar max: the maximum value of the range used to evaluate the property when in interval mode. - @type max: string - """ -#{ Deprecated - def getType(): - """ - Gets when to activate this sensor. - - @deprecated: Use the L{mode} attribute instead. - @return: KX_PROPSENSOR_EQUAL, KX_PROPSENSOR_NOTEQUAL, - KX_PROPSENSOR_INTERVAL, KX_PROPSENSOR_CHANGED, - or KX_PROPSENSOR_EXPRESSION. - """ - - def setType(checktype): - """ - Set the type of check to perform. - - @deprecated: Use the L{mode} attribute instead. - @type checktype: KX_PROPSENSOR_EQUAL, KX_PROPSENSOR_NOTEQUAL, - KX_PROPSENSOR_INTERVAL, KX_PROPSENSOR_CHANGED, - or KX_PROPSENSOR_EXPRESSION. - """ - - def getProperty(): - """ - Return the property with which the sensor operates. - - @deprecated: Use the L{propName} attribute instead. - @rtype: string - @return: the name of the property this sensor is watching. - """ - def setProperty(name): - """ - Sets the property with which to operate. If there is no property - of that name, this call is ignored. - - @deprecated: Use the L{propName} attribute instead. - @type name: string. - """ - def getValue(): - """ - Return the value with which the sensor compares to the value of the property. - - @deprecated: Use the L{value} attribute instead. - @rtype: string - @return: the value of the property this sensor is watching. - """ - def setValue(value): - """ - Set the value with which the sensor operates. If the value - is not compatible with the type of the property, the subsequent - action is ignored. - - @deprecated: Use the L{value} attribute instead. - @type value: string - """ -#} - -class SCA_PythonController(SCA_IController): - """ - A Python controller uses a Python script to activate it's actuators, - based on it's sensors. - - Properties: - - @ivar script: The value of this variable depends on the execution methid. - - When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts. - - When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts. - note: once this is set the script name given for warnings will remain unchanged. - @type script: string - @ivar mode: the execution mode for this controller (read-only). - - Script: 0, Execite the L{script} as a python code. - - Module: 1, Execite the L{script} as a module and function. - @type mode: int - - @group Deprecated: getScript, setScript - """ - def activate(actuator): - """ - Activates an actuator attached to this controller. - @type actuator: actuator or the actuator name as a string - """ - def deactivate(actuator): - """ - Deactivates an actuator attached to this controller. - @type actuator: actuator or the actuator name as a string - """ - def getScript(): - """ - Gets the Python script body this controller executes. - - @deprecated: Use the L{script} attribute instead. - @rtype: string - """ - def setScript(script_body): - """ - Sets the Python script string this controller executes. - - @deprecated: Use the L{script} attribute instead. - @type script_body: string. - """ - -class SCA_RandomActuator(SCA_IActuator): - """ - Random Actuator - - Properties: - - @ivar seed: Seed of the random number generator. - Equal seeds produce equal series. If the seed is 0, - the generator will produce the same value on every call. - @type seed: integer - @ivar para1: the first parameter of the active distribution. - Refer to the documentation of the generator types for the meaning - of this value. - @type para1: float, read-only - @ivar para2: the second parameter of the active distribution. - Refer to the documentation of the generator types for the meaning - of this value. - @type para2: float, read-only - @ivar distribution: distribution type: - KX_RANDOMACT_BOOL_CONST, KX_RANDOMACT_BOOL_UNIFORM, KX_RANDOMACT_BOOL_BERNOUILLI, - KX_RANDOMACT_INT_CONST, KX_RANDOMACT_INT_UNIFORM, KX_RANDOMACT_INT_POISSON, - KX_RANDOMACT_FLOAT_CONST, KX_RANDOMACT_FLOAT_UNIFORM, KX_RANDOMACT_FLOAT_NORMAL, - KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL - @type distribution: integer, read-only - @ivar propName: the name of the property to set with the random value. - If the generator and property types do not match, the assignment is ignored. - @type propName: string - - """ - def setBoolConst(value): - """ - Sets this generator to produce a constant boolean value. - - @param value: The value to return. - @type value: boolean - """ - def setBoolUniform(): - """ - Sets this generator to produce a uniform boolean distribution. - - The generator will generate True or False with 50% chance. - """ - def setBoolBernouilli(value): - """ - Sets this generator to produce a Bernouilli distribution. - - @param value: Specifies the proportion of False values to produce. - - 0.0: Always generate True - - 1.0: Always generate False - @type value: float - """ - def setIntConst(value): - """ - Sets this generator to always produce the given value. - - @param value: the value this generator produces. - @type value: integer - """ - def setIntUniform(lower_bound, upper_bound): - """ - Sets this generator to produce a random value between the given lower and - upper bounds (inclusive). - - @type lower_bound: integer - @type upper_bound: integer - """ - def setIntPoisson(value): - """ - Generate a Poisson-distributed number. - - This performs a series of Bernouilli tests with parameter value. - It returns the number of tries needed to achieve succes. - - @type value: float - """ - def setFloatConst(value): - """ - Always generate the given value. - - @type value: float - """ - def setFloatUniform(lower_bound, upper_bound): - """ - Generates a random float between lower_bound and upper_bound with a - uniform distribution. - - @type lower_bound: float - @type upper_bound: float - """ - def setFloatNormal(mean, standard_deviation): - """ - Generates a random float from the given normal distribution. - - @type mean: float - @param mean: The mean (average) value of the generated numbers - @type standard_deviation: float - @param standard_deviation: The standard deviation of the generated numbers. - """ - def setFloatNegativeExponential(half_life): - """ - Generate negative-exponentially distributed numbers. - - The half-life 'time' is characterized by half_life. - - @type half_life: float - """ -#{ Deprecated - def setSeed(seed): - """ - Sets the seed of the random number generator. - - Equal seeds produce equal series. If the seed is 0, - the generator will produce the same value on every call. - - @deprecated: Use the L{seed} attribute instead. - @type seed: integer - """ - def getSeed(): - """ - Returns the initial seed of the generator. - - @deprecated: Use the L{seed} attribute instead. - @rtype: integer - """ - def getPara1(): - """ - Returns the first parameter of the active distribution. - - Refer to the documentation of the generator types for the meaning - of this value. - - @deprecated: Use the L{para1} attribute instead. - @rtype: float - """ - def getPara2(): - """ - Returns the second parameter of the active distribution. - - Refer to the documentation of the generator types for the meaning - of this value. - - @deprecated: Use the L{para2} attribute instead. - @rtype: float - """ - def getDistribution(): - """ - Returns the type of random distribution. - - @deprecated: Use the L{distribution} attribute instead. - @rtype: distribution type - @return: KX_RANDOMACT_BOOL_CONST, KX_RANDOMACT_BOOL_UNIFORM, KX_RANDOMACT_BOOL_BERNOUILLI, - KX_RANDOMACT_INT_CONST, KX_RANDOMACT_INT_UNIFORM, KX_RANDOMACT_INT_POISSON, - KX_RANDOMACT_FLOAT_CONST, KX_RANDOMACT_FLOAT_UNIFORM, KX_RANDOMACT_FLOAT_NORMAL, - KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL - """ - def setProperty(property): - """ - Set the property to which the random value is assigned. - - If the generator and property types do not match, the assignment is ignored. - - @deprecated: Use the L{propName} attribute instead. - @type property: string - @param property: The name of the property to set. - """ - def getProperty(): - """ - Returns the name of the property to set. - - @deprecated: Use the L{propName} attribute instead. - @rtype: string - """ -#} - - -class SCA_RandomSensor(SCA_ISensor): - """ - This sensor activates randomly. - - @ivar lastDraw: The seed of the random number generator. - @type lastDraw: int - @ivar seed: The seed of the random number generator. - @type seed: int - """ - - def setSeed(seed): - """ - Sets the seed of the random number generator. - - If the seed is 0, the generator will produce the same value on every call. - - @type seed: integer. - """ - def getSeed(): - """ - Returns the initial seed of the generator. Equal seeds produce equal random - series. - - @rtype: integer - """ - def getLastDraw(): - """ - Returns the last random number generated. - - @rtype: integer - """ - -class SCA_XNORController(SCA_IController): - """ - An XNOR controller activates when all linked sensors are the same (activated or inative). - - There are no special python methods for this controller. - """ - -class SCA_XORController(SCA_IController): - """ - An XOR controller activates when there is the input is mixed, but not when all are on or off. - - There are no special python methods for this controller. - """ - -class KX_Camera(KX_GameObject): - """ - A Camera object. - - @group Constants: INSIDE, INTERSECT, OUTSIDE - @ivar INSIDE: see sphereInsideFrustum() and boxInsideFrustum() - @ivar INTERSECT: see sphereInsideFrustum() and boxInsideFrustum() - @ivar OUTSIDE: see sphereInsideFrustum() and boxInsideFrustum() - - @ivar lens: The camera's lens value. - @type lens: float - @ivar near: The camera's near clip distance. - @type near: float - @ivar far: The camera's far clip distance. - @type far: float - @ivar perspective: True if this camera has a perspective transform, False for an orthographic projection. - @type perspective: boolean - @ivar frustum_culling: True if this camera is frustum culling. - @type frustum_culling: boolean - @ivar projection_matrix: This camera's 4x4 projection matrix. - @type projection_matrix: 4x4 Matrix [[float]] - @ivar modelview_matrix: This camera's 4x4 model view matrix. (read-only) - Regenerated every frame from the camera's position and orientation. - @type modelview_matrix: 4x4 Matrix [[float]] - @ivar camera_to_world: This camera's camera to world transform. (read-only) - Regenerated every frame from the camera's position and orientation. - @type camera_to_world: 4x4 Matrix [[float]] - @ivar world_to_camera: This camera's world to camera transform. (read-only) - Regenerated every frame from the camera's position and orientation. - This is camera_to_world inverted. - @type world_to_camera: 4x4 Matrix [[float]] - @ivar useViewport: True when the camera is used as a viewport, set True to enable a viewport for this camera. - @type useViewport: bool - - @group Deprecated: enableViewport, getProjectionMatrix, setProjectionMatrix - """ - - def sphereInsideFrustum(centre, radius): - """ - Tests the given sphere against the view frustum. - - @note: when the camera is first initialized the result will be invalid because the projection matrix has not been set. - @param centre: The centre of the sphere (in world coordinates.) - @type centre: list [x, y, z] - @param radius: the radius of the sphere - @type radius: float - @return: INSIDE, OUTSIDE or INTERSECT - - Example:: - import GameLogic - co = GameLogic.getCurrentController() - cam = co.owner - - # A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0] - if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE): - # Sphere is inside frustum ! - # Do something useful ! - else: - # Sphere is outside frustum - """ - def boxInsideFrustum(box): - """ - Tests the given box against the view frustum. - - Example:: - import GameLogic - co = GameLogic.getCurrentController() - cam = co.owner - - # Box to test... - box = [] - box.append([-1.0, -1.0, -1.0]) - box.append([-1.0, -1.0, 1.0]) - box.append([-1.0, 1.0, -1.0]) - box.append([-1.0, 1.0, 1.0]) - box.append([ 1.0, -1.0, -1.0]) - box.append([ 1.0, -1.0, 1.0]) - box.append([ 1.0, 1.0, -1.0]) - box.append([ 1.0, 1.0, 1.0]) - - if (cam.boxInsideFrustum(box) != cam.OUTSIDE): - # Box is inside/intersects frustum ! - # Do something useful ! - else: - # Box is outside the frustum ! - - @note: when the camera is first initialized the result will be invalid because the projection matrix has not been set. - @return: INSIDE, OUTSIDE or INTERSECT - @type box: list - @param box: Eight (8) corner points of the box (in world coordinates.) - """ - def pointInsideFrustum(point): - """ - Tests the given point against the view frustum. - - Example:: - import GameLogic - co = GameLogic.getCurrentController() - cam = co.owner - - # Test point [0.0, 0.0, 0.0] - if (cam.pointInsideFrustum([0.0, 0.0, 0.0])): - # Point is inside frustum ! - # Do something useful ! - else: - # Box is outside the frustum ! - - @note: when the camera is first initialized the result will be invalid because the projection matrix has not been set. - @rtype: boolean - @return: True if the given point is inside this camera's viewing frustum. - @type point: [x, y, z] - @param point: The point to test (in world coordinates.) - """ - def getCameraToWorld(): - """ - Returns the camera-to-world transform. - - @rtype: matrix (4x4 list) - @return: the camera-to-world transform matrix. - """ - def getWorldToCamera(): - """ - Returns the world-to-camera transform. - - This returns the inverse matrix of getCameraToWorld(). - - @rtype: matrix (4x4 list) - @return: the world-to-camera transform matrix. - """ - def getProjectionMatrix(): - """ - Returns the camera's projection matrix. - - @deprecated: Use the L{projection_matrix} attribute instead. - @rtype: matrix (4x4 list) - @return: the camera's projection matrix. - """ - def setProjectionMatrix(matrix): - """ - Sets the camera's projection matrix. - - You should use normalised device coordinates for the clipping planes: - left = -1.0, right = 1.0, top = 1.0, bottom = -1.0, near = cam.near, far = cam.far - - Example:: - import GameLogic - - def Scale(matrix, size): - for y in range(4): - for x in range(4): - matrix[y][x] = matrix[y][x] * size[y] - return matrix - - # Generate a perspective projection matrix - def Perspective(cam): - return [[cam.near, 0.0 , 0.0 , 0.0 ], - [0.0 , cam.near, 0.0 , 0.0 ], - [0.0 , 0.0 , -(cam.far+cam.near)/(cam.far-cam.near), -2.0*cam.far*cam.near/(cam.far - cam.near)], - [0.0 , 0.0 , -1.0 , 0.0 ]] - - # Generate an orthographic projection matrix - # You will need to scale the camera - def Orthographic(cam): - return [[1.0/cam.scaling[0], 0.0 , 0.0 , 0.0 ], - [0.0 , 1.0/cam.scaling[1], 0.0 , 0.0 ], - [0.0 , 0.0 , -2.0/(cam.far-cam.near), -(cam.far+cam.near)/(cam.far-cam.near)], - [0.0 , 0.0 , 0.0 , 1.0 ]] - - # Generate an isometric projection matrix - def Isometric(cam): - return Scale([[0.707, 0.0 , 0.707, 0.0], - [0.408, 0.816,-0.408, 0.0], - [0.0 , 0.0 , 0.0 , 0.0], - [0.0 , 0.0 , 0.0 , 1.0]], - [1.0/cam.scaling[0], 1.0/cam.scaling[1], 1.0/cam.scaling[2], 1.0]) - - co = GameLogic.getCurrentController() - cam = co.owner - cam.setProjectionMatrix(Perspective(cam))) - - @deprecated: Use the L{projection_matrix} attribute instead. - @type matrix: 4x4 matrix. - @param matrix: The new projection matrix for this camera. - """ - - def enableViewport(viewport): - """ - Use this camera to draw a viewport on the screen (for split screen games or overlay scenes). The viewport region is defined with L{setViewport}. - - @deprecated: Use the L{useViewport} attribute instead. - @type viewport: bool - @param viewport: the new viewport status - """ - def setOnTop(): - """ - Set this cameras viewport ontop of all other viewport. - """ - def setViewport(left, bottom, right, top): - """ - Sets the region of this viewport on the screen in pixels. - - Use L{Rasterizer.getWindowHeight} L{Rasterizer.getWindowWidth} to calculate values relative to the entire display. - - @type left: int - @type bottom: int - @type right: int - @type top: int - """ - def getScreenPosition(arg): - """ - Gets the position of an object projected on screen space. - - Example: - # For an object in the middle of the screen, coord = [0.5,0.5] - coord = camera.getScreenPosition(object) - - @param arg: L{KX_GameObject}, object name or list [x, y, z] - @rtype: list [x, y] - @return: the object's position in screen coordinates. - """ - def getScreenVect(x, y): - """ - Gets the vector from the camera position in the screen coordinate direction. - - Example: - # Gets the vector of the camera front direction: - m_vect = camera.getScreenVect(0.5,0.5) - - @type x: float - @type y: float - @rtype: 3d vector - @return: the vector from a screen coordinate. - """ - def getScreenRay(x, y, dist, property): - """ - Look towards a screen coordinate (x,y) and find first object hit within dist that matches prop. - The ray is similar to KX_GameObject->rayCastTo. - - Example: - # Gets an object with a property "wall" in front of the camera within a distance of 100: - target = camera.getScreenRay(0.5,0.5,100,"wall") - - @type x: float - @type y: float - @param dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other - @type dist: float - @param property: property name that object must have; can be omitted => detect any object - @type property: string - @rtype: L{KX_GameObject} - @return: the first object hit or None if no object or object does not match prop - """ - -class BL_ArmatureObject(KX_GameObject): - """ - An armature object. - - @ivar constraints: The list of armature constraint defined on this armature - Elements of the list can be accessed by index or string. - The key format for string access is ':' - @type constraints: list of L{BL_ArmatureConstraint} - @ivar channels: The list of armature channels. - Elements of the list can be accessed by index or name the bone. - @type channels: list of L{BL_ArmatureChannel} - """ - - def update(): - """ - Ensures that the armature will be updated on next graphic frame. - - This action is unecessary if a KX_ArmatureActuator with mode run is active - or if an action is playing. Use this function in other cases. It must be called - on each frame to ensure that the armature is updated continously. - """ - -class BL_ArmatureActuator(SCA_IActuator): - """ - Armature Actuators change constraint condition on armatures. - - @group Constants: KX_ACT_ARMATURE_RUN, KX_ACT_ARMATURE_ENABLE, KX_ACT_ARMATURE_DISABLE, KX_ACT_ARMATURE_SETTARGET, KX_ACT_ARMATURE_SETWEIGHT - @ivar KX_ACT_ARMATURE_RUN: see type - @ivar KX_ACT_ARMATURE_ENABLE: see type - @ivar KX_ACT_ARMATURE_DISABLE: see type - @ivar KX_ACT_ARMATURE_SETTARGET: see type - @ivar KX_ACT_ARMATURE_SETWEIGHT: see type - @ivar type: The type of action that the actuator executes when it is active. - - KX_ACT_ARMATURE_RUN(0): just make sure the armature will be updated on the next graphic frame - This is the only persistent mode of the actuator: it executes automatically once per frame until stopped by a controller - - KX_ACT_ARMATURE_ENABLE(1): enable the constraint. - - KX_ACT_ARMATURE_DISABLE(2): disable the constraint (runtime constraint values are not updated). - - KX_ACT_ARMATURE_SETTARGET(3): change target and subtarget of constraint - - KX_ACT_ARMATURE_SETWEIGHT(4): change weight of (only for IK constraint) - @type type: integer - @ivar constraint: The constraint object this actuator is controlling. - @type constraint: L{BL_ArmatureConstraint} - @ivar target: The object that this actuator will set as primary target to the constraint it controls - @type target: L{KX_GameObject} - @ivar subtarget: The object that this actuator will set as secondary target to the constraint it controls. - Currently, the only secondary target is the pole target for IK constraint. - @type subtarget: L{KX_GameObject} - @ivar weight: The weight this actuator will set on the constraint it controls. - Currently only the IK constraint has a weight. It must be a value between 0 and 1. - A weight of 0 disables a constraint while still updating constraint runtime values (see L{BL_ArmatureConstraint}) - @type weight: float - """ - -class KX_ArmatureSensor(SCA_ISensor): - """ - Armature sensor detect conditions on armatures. - - @group Constants: KX_ARMSENSOR_STATE_CHANGED, KX_ARMSENSOR_LIN_ERROR_BELOW, KX_ARMSENSOR_LIN_ERROR_ABOVE, KX_ARMSENSOR_ROT_ERROR_BELOW, KX_ARMSENSOR_ROT_ERROR_ABOVE - @ivar KX_ARMSENSOR_STATE_CHANGED: see type - @ivar KX_ARMSENSOR_LIN_ERROR_BELOW: see type - @ivar KX_ARMSENSOR_LIN_ERROR_ABOVE: see type - @ivar KX_ARMSENSOR_ROT_ERROR_BELOW: see type - @ivar KX_ARMSENSOR_ROT_ERROR_ABOVE: see type - @ivar type: The type of measurement that the sensor make when it is active. - - KX_ARMSENSOR_STATE_CHANGED(0): detect that the constraint is changing state (active/inactive) - - KX_ARMSENSOR_LIN_ERROR_BELOW(1): detect that the constraint linear error is above a threshold - - KX_ARMSENSOR_LIN_ERROR_ABOVE(2): detect that the constraint linear error is below a threshold - - KX_ARMSENSOR_ROT_ERROR_BELOW(3): detect that the constraint rotation error is above a threshold - - KX_ARMSENSOR_ROT_ERROR_ABOVE(4): detect that the constraint rotation error is below a threshold - @type type: integer - @ivar constraint: The constraint object this sensor is watching. - @type constraint: L{BL_ArmatureConstraint} - @ivar value: The threshold used in the comparison with the constraint error - The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver - The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver - The linear error on CopyPose is always >= 0: it is the norm of the distance between the target and the bone - The rotation error on CopyPose is always >= 0: it is the norm of the equivalent rotation vector between the bone and the target orientations - The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller - @type value: float - """ - -class BL_ArmatureConstraint(PyObjectPlus): - """ - Proxy to Armature Constraint. Allows to change constraint on the fly. - Obtained through L{BL_ArmatureObject}.constraints. - Note: not all armature constraints are supported in the GE. - - @group Constants: CONSTRAINT_TYPE_TRACKTO, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_ROTLIKE, CONSTRAINT_TYPE_LOCLIKE, CONSTRAINT_TYPE_MINMAX, CONSTRAINT_TYPE_SIZELIKE, CONSTRAINT_TYPE_LOCKTRACK, CONSTRAINT_TYPE_STRETCHTO, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_TRANSFORM, CONSTRAINT_TYPE_DISTLIMIT,CONSTRAINT_IK_COPYPOSE, CONSTRAINT_IK_DISTANCE,CONSTRAINT_IK_MODE_INSIDE, CONSTRAINT_IK_MODE_OUTSIDE,CONSTRAINT_IK_MODE_ONSURFACE,CONSTRAINT_IK_FLAG_TIP,CONSTRAINT_IK_FLAG_ROT, CONSTRAINT_IK_FLAG_STRETCH, CONSTRAINT_IK_FLAG_POS - @ivar CONSTRAINT_TYPE_TRACKTO: see type - @ivar CONSTRAINT_TYPE_KINEMATIC: see type - @ivar CONSTRAINT_TYPE_ROTLIKE: see type - @ivar CONSTRAINT_TYPE_LOCLIKE: see type - @ivar CONSTRAINT_TYPE_MINMAX: see type - @ivar CONSTRAINT_TYPE_SIZELIKE: see type - @ivar CONSTRAINT_TYPE_LOCKTRACK: see type - @ivar CONSTRAINT_TYPE_STRETCHTO: see type - @ivar CONSTRAINT_TYPE_CLAMPTO: see type - @ivar CONSTRAINT_TYPE_TRANSFORM: see type - @ivar CONSTRAINT_TYPE_DISTLIMIT: see type - @ivar CONSTRAINT_IK_COPYPOSE: see ik_type - @ivar CONSTRAINT_IK_DISTANCE: see ik_type - @ivar CONSTRAINT_IK_MODE_INSIDE: see ik_mode - @ivar CONSTRAINT_IK_MODE_OUTSIDE: see ik_mode - @ivar CONSTRAINT_IK_MODE_ONSURFACE: see ik_mode - @ivar CONSTRAINT_IK_FLAG_TIP: see ik_flag - @ivar CONSTRAINT_IK_FLAG_ROT: see ik_flag - @ivar CONSTRAINT_IK_FLAG_STRETCH: see ik_flag - @ivar CONSTRAINT_IK_FLAG_POS: see ik_flag - @ivar type: Type of constraint, read-only - @type type: integer, one of CONSTRAINT_TYPE_ constant - @ivar name: Name of constraint constructed as : - This name is also the key subscript on L{BL_ArmatureObject}.constraints list - @type name: string - @ivar enforce: fraction of constraint effect that is enforced. Between 0 and 1. - @type enforce: float - @ivar headtail: position of target between head and tail of the target bone: 0=head, 1=tail - Only used if the target is a bone (i.e target object is an armature) - @type headtail: float - @ivar lin_error: runtime linear error (in Blender unit) on constraint at the current frame. - This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. - @type lin_error: float - @ivar rot_error: runtime rotation error (in radiant) on constraint at the current frame. - This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. - It is only set if the constraint has a rotation part, for example, a CopyPose+Rotation IK constraint. - @type rot_error: float - @ivar target: Primary target object for the constraint. The position of this object in the GE will be used as target for the constraint. - @type target: L{KX_GameObject} - @ivar subtarget: Secondary target object for the constraint. The position of this object in the GE will be used as secondary target for the constraint. - Currently this is only used for pole target on IK constraint. - @type subtarget: L{KX_GameObject} - @ivar active: True if the constraint is active. - Note: an inactive constraint does not update lin_error and rot_error. - @type active: boolean - @ivar ik_weight: Weight of the IK constraint between 0 and 1. - Only defined for IK constraint. - @type ik_weight: float - @ivar ik_type: Type of IK constraint, read-only - - CONSTRAINT_IK_COPYPOSE(0): constraint is trying to match the position and eventually the rotation of the target. - - CONSTRAINT_IK_DISTANCE(1): constraint is maintaining a certain distance to target subject to ik_mode - @type ik_type: integer - @ivar ik_flag: Combination of IK constraint option flags, read-only - - CONSTRAINT_IK_FLAG_TIP(1) : set when the constraint operates on the head of the bone and not the tail - - CONSTRAINT_IK_FLAG_ROT(2) : set when the constraint tries to match the orientation of the target - - CONSTRAINT_IK_FLAG_STRETCH(16) : set when the armature is allowed to stretch (only the bones with stretch factor > 0.0) - - CONSTRAINT_IK_FLAG_POS(32) : set when the constraint tries to match the position of the target - @type ik_flag: integer - @ivar ik_dist: Distance the constraint is trying to maintain with target, only used when ik_type=CONSTRAINT_IK_DISTANCE - @type ik_dist: float - @ivar ik_mode: Additional mode for IK constraint. Currently only used for Distance constraint: - - CONSTRAINT_IK_MODE_INSIDE(0) : the constraint tries to keep the bone within ik_dist of target - - CONSTRAINT_IK_MODE_OUTSIDE(1) : the constraint tries to keep the bone outside ik_dist of the target - - CONSTRAINT_IK_MODE_ONSURFACE(2) : the constraint tries to keep the bone exactly at ik_dist of the target - @type ik_mode: integer - """ - -class BL_ArmatureChannel(PyObjectPlus): - """ - Proxy to armature pose channel. Allows to read and set armature pose. - The attributes are identical to RNA attributes, but mostly in read-only mode. - - @group Constants: PCHAN_ROT_QUAT, PCHAN_ROT_XYZ, PCHAN_ROT_XZY, PCHAN_ROT_YXZ, PCHAN_ROT_YZX, PCHAN_ROT_ZXY, PCHAN_ROT_ZYX - @ivar PCHAN_ROT_QUAT: see rotation_mode - @ivar PCHAN_ROT_XYZ: see rotation_mode - @ivar PCHAN_ROT_XZY: see rotation_mode - @ivar PCHAN_ROT_YXZ: see rotation_mode - @ivar PCHAN_ROT_YZX: see rotation_mode - @ivar PCHAN_ROT_ZXY: see rotation_mode - @ivar PCHAN_ROT_ZYX: see rotation_mode - @ivar name: channel name (=bone name), read-only. - @type name: string - @ivar bone: return the bone object corresponding to this pose channel, read-only. - @type bone: L{BL_ArmatureBone} - @ivar parent: return the parent channel object, None if root channel, read-only. - @type parent: L{BL_ArmatureChannel} - @ivar has_ik: true if the bone is part of an active IK chain, read-only. - This flag is not set when an IK constraint is defined but not enabled (miss target information for example) - @type has_ik: boolean - @ivar ik_dof_x: true if the bone is free to rotation in the X axis, read-only. - @type ik_dof_x: boolean - @ivar ik_dof_y: true if the bone is free to rotation in the Y axis, read-only. - @type ik_dof_y: boolean - @ivar ik_dof_z: true if the bone is free to rotation in the Z axis, read-only. - @type ik_dof_z: boolean - @ivar ik_limit_x: true if a limit is imposed on X rotation, read-only. - @type ik_limit_x: boolean - @ivar ik_limit_y: true if a limit is imposed on Y rotation, read-only. - @type ik_limit_y: boolean - @ivar ik_limit_z: true if a limit is imposed on Z rotation, read-only. - @type ik_limit_z: boolean - @ivar ik_rot_control: true if channel rotation should applied as IK constraint, read-only. - @type ik_rot_control: boolean - @ivar ik_lin_control: true if channel size should applied as IK constraint, read-only. - @type ik_lin_control: boolean - @ivar location: displacement of the bone head in armature local space, read-write. - You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. - Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see L{BL_ArmatureObject.update}) - @type location: vector [X,Y,Z] - @ivar scale: scale of the bone relative to its parent, read-write. - An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. - Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see L{BL_ArmatureObject.update}) - @type scale: vector [sizeX, sizeY, sizeZ] - @ivar rotation: rotation of the bone relative to its parent expressed as a quaternion, read-write. - This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. - Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see L{BL_ArmatureObject.update}) - @type rotation: vector [qr, qi, qj, qk] - @ivar euler_rotation: rotation of the bone relative to its parent expressed as a set of euler angles, read-write. - This field is only used if rotation_mode is > 0. You must always pass the angles in [X,Y,Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation. - Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see L{BL_ArmatureObject.update}) - @type euler_rotation: vector [X, Y, Z] - @ivar rotation_mode: method of updating the bone rotation, read-write. - Use the following constants (euler mode are named as in BLender UI but the actual axis order is reversed): - - PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation - - PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively - - PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively - - PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively - - PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively - - PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively - - PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively - @type rotation_mode: integer - @ivar channel_matrix: pose matrix in bone space (deformation of the bone due to action, constraint, etc), Read-only. - This field is updated after the graphic render, it represents the current pose. - @type channel_matrix: matrix [4][4] - @ivar pose_matrix: pose matrix in armature space, read-only, - This field is updated after the graphic render, it represents the current pose. - @type pose_matrix: matrix [4][4] - @ivar pose_head: position of bone head in armature space, read-only. - @type pose_head: vector [x, y, z] - @ivar pose_tail: position of bone tail in armature space, read-only. - @type pose_tail: vector [x, y, z] - @ivar ik_min_x: minimum value of X rotation in degree (<= 0) when X rotation is limited (see ik_limit_x), read-only. - @type ik_min_x: float - @ivar ik_max_x: maximum value of X rotation in degree (>= 0) when X rotation is limited (see ik_limit_x), read-only. - @type ik_max_x: float - @ivar ik_min_y: minimum value of Y rotation in degree (<= 0) when Y rotation is limited (see ik_limit_y), read-only. - @type ik_min_y: float - @ivar ik_max_y: maximum value of Y rotation in degree (>= 0) when Y rotation is limited (see ik_limit_y), read-only. - @type ik_max_y: float - @ivar ik_min_z: minimum value of Z rotation in degree (<= 0) when Z rotation is limited (see ik_limit_z), read-only. - @type ik_min_z: float - @ivar ik_max_z: maximum value of Z rotation in degree (>= 0) when Z rotation is limited (see ik_limit_z), read-only. - @type ik_max_z: float - @ivar ik_stiffness_x: bone rotation stiffness in X axis, read-only - @type ik_stiffness_x: float between 0 and 1 - @ivar ik_stiffness_y: bone rotation stiffness in Y axis, read-only - @type ik_stiffness_y: float between 0 and 1 - @ivar ik_stiffness_z: bone rotation stiffness in Z axis, read-only - @type ik_stiffness_z: float between 0 and 1 - @ivar ik_stretch: ratio of scale change that is allowed, 0=bone can't change size, read-only. - @type ik_stretch: float - @ivar ik_rot_weight: weight of rotation constraint when ik_rot_control is set, read-write. - @type ik_rot_weight: float between 0 and 1 - @ivar ik_lin_weight: weight of size constraint when ik_lin_control is set, read-write. - @type ik_lin_weight: float between 0 and 1 - @ivar joint_rotation: control bone rotation in term of joint angle (for robotic applications), read-write. - When writing to this attribute, you pass a [x, y, z] vector and an appropriate set of euler angles or quaternion is calculated according to the rotation_mode. - When you read this attribute, the current pose matrix is converted into a [x, y, z] vector representing the joint angles. - The value and the meaning of the x, y, z depends on the ik_dof_ attributes: - - 1DoF joint X, Y or Z: the corresponding x, y, or z value is used an a joint angle in radiant - - 2DoF joint X+Y or Z+Y: treated as 2 successive 1DoF joints: first X or Z, then Y. The x or z value is used as a joint angle in radiant along the X or Z axis, followed by a rotation along the new Y axis of y radiants. - - 2DoF joint X+Z: treated as a 2DoF joint with rotation axis on the X/Z plane. The x and z values are used as the coordinates of the rotation vector in the X/Z plane. - - 3DoF joint X+Y+Z: treated as a revolute joint. The [x,y,z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose. - - Notes: - - The bone must be part of an IK chain if you want to set the ik_dof_ attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target): the IK solver will not run but the IK panel will show up on the UI for each bone in the chain. - - [0,0,0] always corresponds to the rest pose. - - You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see L{BL_ArmatureObject.update}). - - You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute. - @type joint_rotation: vector [x, y, z] - """ - -class BL_ArmatureBone(PyObjectPlus): - """ - Proxy to Blender bone structure. All fields are read-only and comply to RNA names. - All space attribute correspond to the rest pose. - - @ivar name: bone name - @type name: string - @ivar connected: true when the bone head is struck to the parent's tail - @type connected: boolean - @ivar hinge: true when bone doesn't inherit rotation or scale from parent bone - @type hinge: boolean - @ivar inherit_scale: true when bone inherits scaling from parent bone - @type inherit_scale: boolean - @ivar bbone_segments: number of B-bone segments - @type bbone_segments: integer - @ivar roll: bone rotation around head-tail axis - @type roll: float - @ivar head: location of head end of the bone in parent bone space - @type head: vector [x, y, z] - @ivar tail: location of head end of the bone in parent bone space - @type tail: vector [x, y, z] - @ivar length: bone length - @type length: float - @ivar arm_head: location of head end of the bone in armature space - @type arm_head: vector [x, y, z] - @ivar arm_tail: location of tail end of the bone in armature space - @type arm_tail: vector [x, y, z] - @ivar arm_mat: matrix of the bone head in armature space - This matrix has no scale part. - @type arm_mat: matrix [4][4] - @ivar bone_mat: rotation matrix of the bone in parent bone space. - @type bone_mat: matrix [3][3] - @ivar parent: parent bone, or None for root bone - @type parent: L{BL_ArmatureBone} - @ivar children: list of bone's children - @type children: list of L{BL_ArmatureBone} - """ -# Util func to extract all attrs -""" -import types -attrs = [] -for name, val in locals().items(): - if name.startswith('__'): - continue - if type(val) == types.ClassType: - for line in val.__doc__.split('\n'): - if '@ivar' in line: - attrs.append(name + '::' + line.split()[1].replace(':', '')) - -for a in attrs: - print a -""" - - -# Util func to construct a mapping from deprecated attrs to new ones. -""" -import types -import re -import pprint -depAttrs = {} -for name, val in locals().items(): - if name.startswith('__'): - continue - if type(val) == types.ClassType: - print "\t# %s" % name - - # Inspect each attribute. - for attrName in dir(val): - if attrName.startswith('__'): - continue - attr = getattr(val, attrName) - - # Check whether this attribute is deprecated by searching each line. - newAttrName = None - for line in attr.__doc__.split('\n'): - match = re.search(r'@deprecated.*L{(\w+)}', line) - if match: - newAttrName = match.group(1) - break - if not newAttrName: - continue - - # Store the mappings to new attributes in a list (because there - # could be collisions). - if attrName not in depAttrs: - depAttrs[attrName] = {} - mapping = depAttrs[attrName] - - for line in val.__doc__.split('\n'): - if ("@type %s:" % newAttrName) in line: - # The attribute is being replaced in this class (i.e. the - # deprecated attribute wasn't inherited from a parent). We - # have a winner! - funcType = None - if 'sequence' in line: - funcType = 'Keyed' - else: - funcType = 'Simple' - - if attrName.startswith('get') or attrName.startswith('is'): - func = "replace%sGetter" % funcType - elif attrName.startswith('set') or attrName.startswith('enable'): - func = "replace%sSetter" % funcType - else: - func = 'UNKNOWN' - - # Another mapping, from a conversion tuple to lists of class - # names. - conversion = (func, newAttrName) - if conversion not in mapping: - mapping[conversion] = [] - mapping[conversion].append(name) - break - -pprint.pprint(depAttrs, width = 100) -""" diff --git a/source/gameengine/PyDoc/Rasterizer.py b/source/gameengine/PyDoc/Rasterizer.py deleted file mode 100644 index 8fd4d506bde..00000000000 --- a/source/gameengine/PyDoc/Rasterizer.py +++ /dev/null @@ -1,221 +0,0 @@ -# $Id$ -""" -Documentation for the Rasterizer module. - -Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook:: - # To use a mouse movement sensor "Mouse" and a - # motion actuator to mouse look: - import Rasterizer - import GameLogic - - # SCALE sets the speed of motion - SCALE=[1, 0.5] - - co = GameLogic.getCurrentController() - obj = co.getOwner() - mouse = co.getSensor("Mouse") - lmotion = co.getActuator("LMove") - wmotion = co.getActuator("WMove") - - # Transform the mouse coordinates to see how far the mouse has moved. - def mousePos(): - x = (Rasterizer.getWindowWidth()/2 - mouse.getXPosition())*SCALE[0] - y = (Rasterizer.getWindowHeight()/2 - mouse.getYPosition())*SCALE[1] - return (x, y) - - pos = mousePos() - - # Set the amount of motion: X is applied in world coordinates... - lmotion.setTorque(0.0, 0.0, pos[0], False) - # ...Y is applied in local coordinates - wmotion.setTorque(-pos[1], 0.0, 0.0, True) - - # Activate both actuators - GameLogic.addActiveActuator(lmotion, True) - GameLogic.addActiveActuator(wmotion, True) - - # Centre the mouse - Rasterizer.setMousePosition(Rasterizer.getWindowWidth()/2, Rasterizer.getWindowHeight()/2) - -@group Material Types: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL -@var KX_TEXFACE_MATERIAL: Materials as defined by the texture face settings. -@var KX_BLENDER_MULTITEX_MATERIAL: Materials approximating blender materials with multitexturing. -@var KX_BLENDER_GLSL_MATERIAL: Materials approximating blender materials with GLSL. - -""" -def getWindowWidth(): - """ - Gets the width of the window (in pixels) - - @rtype: integer - """ -def getWindowHeight(): - """ - Gets the height of the window (in pixels) - - @rtype: integer - """ -def makeScreenshot(filename): - """ - Writes a screenshot to the given filename. - - If filename starts with // the image will be saved relative to the current directory. - If the filename contains # it will be replaced with the frame number. - - The standalone player saves .png files. It does not support colour space conversion - or gamma correction. - - When run from Blender, makeScreenshot supports Iris, IrisZ, TGA, Raw TGA, PNG, HamX, and Jpeg. - Gamma, Colourspace conversion and Jpeg compression are taken from the Render settings panels. - - @type filename: string - """ - -def enableVisibility(visible): - """ - Doesn't really do anything... - """ - -def showMouse(visible): - """ - Enables or disables the operating system mouse cursor. - - @type visible: boolean - """ - -def setMousePosition(x, y): - """ - Sets the mouse cursor position. - - @type x: integer - @type y: integer - """ - -def setBackgroundColor(rgba): - """ - Sets the window background colour. - - @type rgba: list [r, g, b, a] - """ - -def setMistColor(rgb): - """ - Sets the mist colour. - - @type rgb: list [r, g, b] - """ - -def setAmbientColor(rgb): - """ - Sets the color of ambient light. - - @type rgb: list [r, g, b] - """ - -def setMistStart(start): - """ - Sets the mist start value. Objects further away than start will have mist applied to them. - - @type start: float - """ - -def setMistEnd(end): - """ - Sets the mist end value. Objects further away from this will be coloured solid with - the colour set by setMistColor(). - - @type end: float - """ - -def disableMist(): - """ - Disables mist. - - @note: Set any of the mist properties to enable mist. - """ - -def setEyeSeparation(eyesep): - """ - Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value. - - @param eyesep: The distance between the left and right eye. - @type eyesep: float - """ - -def getEyeSeparation(): - """ - Gets the current eye separation for stereo mode. - - @rtype: float - """ - -def setFocalLength(focallength): - """ - Sets the focal length for stereo mode. It uses the current camera focal length as initial value. - - @param focallength: The focal length. - @type focallength: float - """ - -def getFocalLength(): - """ - Gets the current focal length for stereo mode. - - @rtype: float - """ - -def setMaterialMode(mode): - """ - Set the material mode to use for OpenGL rendering. - - @type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL - @note: Changes will only affect newly created scenes. - """ - -def getMaterialMode(mode): - """ - Get the material mode to use for OpenGL rendering. - - @rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL - """ - -def setGLSLMaterialSetting(setting, enable): - """ - Enables or disables a GLSL material setting. - - @type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) - @type enable: boolean - """ - -def getGLSLMaterialSetting(setting, enable): - """ - Get the state of a GLSL material setting. - - @type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) - @rtype: boolean - """ - -def drawLine(fromVec,toVec,color): - """ - Draw a line in the 3D scene. - - @param fromVec: the origin of the line - @type fromVec: list [x, y, z] - @param toVec: the end of the line - @type toVec: list [x, y, z] - @param color: the color of the line - @type color: list [r, g, b] - """ - -def enableMotionBlur(factor): - """ - Enable the motion blue effect. - - @param factor: the ammount of motion blur to display. - @type factor: float [0.0 - 1.0] - """ - -def disableMotionBlur(): - """ - Disable the motion blue effect. - """ diff --git a/source/gameengine/PyDoc/bge.events.rst b/source/gameengine/PyDoc/bge.events.rst new file mode 100644 index 00000000000..afdcf39f178 --- /dev/null +++ b/source/gameengine/PyDoc/bge.events.rst @@ -0,0 +1,194 @@ + +Game Engine bge.events module. +============================== + +This module holds key constants for the SCA_KeyboardSensor. + +.. module:: bge.events + +.. code-block:: python + + # Set a connected keyboard sensor to accept F1 + import bge + + co = bge.logic.getCurrentController() + # 'Keyboard' is a keyboard sensor + sensor = co.sensors["Keyboard"] + sensor.key = bge.keys.F1KEY + +.. code-block:: python + + # Do the all keys thing + import bge + + co = bge.logic.getCurrentController() + # 'Keyboard' is a keyboard sensor + sensor = co.sensors["Keyboard"] + + for key,status in sensor.events: + # key[0] == bge.keys.keycode, key[1] = status + if status == bge.logic.KX_INPUT_JUST_ACTIVATED: + if key == bge.keys.WKEY: + # Activate Forward! + if key == bge.keys.SKEY: + # Activate Backward! + if key == bge.keys.AKEY: + # Activate Left! + if key == bge.keys.DKEY: + # Activate Right! + +.. function:: EventToString(event) + + Return the string name of a key event. Will raise a ValueError error if its invalid. + + :arg event: key event from bge.keys or the keyboard sensor. + :type event: int + :rtype: string + +.. function:: EventToCharacter(event, shift) + + Return the string name of a key event. Returns an empty string if the event cant be represented as a character. + + :type event: int + :arg event: key event from :mod:`bge.keys` or the keyboard sensor. + :type shift: bool + :arg shift: set to true if shift is held. + :rtype: string + + +**Alphabet keys** + +.. data:: AKEY +.. data:: BKEY +.. data:: CKEY +.. data:: DKEY +.. data:: EKEY +.. data:: FKEY +.. data:: GKEY +.. data:: HKEY +.. data:: IKEY +.. data:: JKEY +.. data:: KKEY +.. data:: LKEY +.. data:: MKEY +.. data:: NKEY +.. data:: OKEY +.. data:: PKEY +.. data:: QKEY +.. data:: RKEY +.. data:: SKEY +.. data:: TKEY +.. data:: UKEY +.. data:: VKEY +.. data:: WKEY +.. data:: XKEY +.. data:: YKEY +.. data:: ZKEY + +**Number keys** + +.. data:: ZEROKEY +.. data:: ONEKEY +.. data:: TWOKEY +.. data:: THREEKEY +.. data:: FOURKEY +.. data:: FIVEKEY +.. data:: SIXKEY +.. data:: SEVENKEY +.. data:: EIGHTKEY +.. data:: NINEKEY + +**Modifiers** + +.. data:: CAPSLOCKKEY +.. data:: LEFTCTRLKEY +.. data:: LEFTALTKEY +.. data:: RIGHTALTKEY +.. data:: RIGHTCTRLKEY +.. data:: RIGHTSHIFTKEY +.. data:: LEFTSHIFTKEY + +**Arrow Keys** + +.. data:: LEFTARROWKEY +.. data:: DOWNARROWKEY +.. data:: RIGHTARROWKEY +.. data:: UPARROWKEY + +**Numberpad Keys** + +.. data:: PAD0 +.. data:: PAD1 +.. data:: PAD2 +.. data:: PAD3 +.. data:: PAD4 +.. data:: PAD5 +.. data:: PAD6 +.. data:: PAD7 +.. data:: PAD8 +.. data:: PAD9 +.. data:: PADPERIOD +.. data:: PADSLASHKEY +.. data:: PADASTERKEY +.. data:: PADMINUS +.. data:: PADENTER +.. data:: PADPLUSKEY + +**Function Keys** + +.. data:: F1KEY +.. data:: F2KEY +.. data:: F3KEY +.. data:: F4KEY +.. data:: F5KEY +.. data:: F6KEY +.. data:: F7KEY +.. data:: F8KEY +.. data:: F9KEY +.. data:: F10KEY +.. data:: F11KEY +.. data:: F12KEY +.. data:: F13KEY +.. data:: F14KEY +.. data:: F15KEY +.. data:: F16KEY +.. data:: F17KEY +.. data:: F18KEY +.. data:: F19KEY + +**Other Keys** + +.. data:: ACCENTGRAVEKEY +.. data:: BACKSLASHKEY +.. data:: BACKSPACEKEY +.. data:: COMMAKEY +.. data:: DELKEY +.. data:: ENDKEY +.. data:: EQUALKEY +.. data:: ESCKEY +.. data:: HOMEKEY +.. data:: INSERTKEY +.. data:: LEFTBRACKETKEY +.. data:: LINEFEEDKEY +.. data:: MINUSKEY +.. data:: PAGEDOWNKEY +.. data:: PAGEUPKEY +.. data:: PAUSEKEY +.. data:: PERIODKEY +.. data:: QUOTEKEY +.. data:: RIGHTBRACKETKEY +.. data:: RETKEY +.. data:: SEMICOLONKEY +.. data:: SLASHKEY +.. data:: SPACEKEY +.. data:: TABKEY + +**Mouse Events** + +.. data:: LEFTMOUSE +.. data:: MIDDLEMOUSE +.. data:: RIGHTMOUSE +.. data:: WHEELUPMOUSE +.. data:: WHEELDOWNMOUSE +.. data:: MOUSEX +.. data:: MOUSEY: diff --git a/source/gameengine/PyDoc/bge.logic.rst b/source/gameengine/PyDoc/bge.logic.rst new file mode 100644 index 00000000000..7fb2c3df67a --- /dev/null +++ b/source/gameengine/PyDoc/bge.logic.rst @@ -0,0 +1,622 @@ + +Game Engine bge.logic Module. +============================= + +Module to access logic functions, imported automatically into the python controllers namespace. + +.. module:: bge.logic + +.. code-block:: python + + # To get the controller thats running this python script: + cont = bge.logic.getCurrentController() # bge.logic is automatically imported + + # To get the game object this controller is on: + obj = cont.owner + +:class:`bge.types.KX_GameObject` and :class:`bge.types.KX_Camera` or :class:`bge.types.KX_LightObject` methods are available depending on the type of object + +.. code-block:: python + + # To get a sensor linked to this controller. + # "sensorname" is the name of the sensor as defined in the Blender interface. + # +---------------------+ +--------+ + # | Sensor "sensorname" +--+ Python + + # +---------------------+ +--------+ + sens = cont.sensors["sensorname"] + + # To get a sequence of all sensors: + sensors = co.sensors + +See the sensor's reference for available methods: + +* :class:`bge.types.SCA_DelaySensor` +* :class:`bge.types.SCA_JoystickSensor` +* :class:`bge.types.SCA_KeyboardSensor` +* :class:`bge.types.KX_MouseFocusSensor` +* :class:`bge.types.SCA_MouseSensor` +* :class:`bge.types.KX_NearSensor` +* :class:`bge.types.KX_NetworkMessageSensor` +* :class:`bge.types.SCA_PropertySensor` +* :class:`bge.types.KX_RadarSensor` +* :class:`bge.types.SCA_RandomSensor` +* :class:`bge.types.KX_RaySensor` +* :class:`bge.types.KX_TouchSensor` + +You can also access actuators linked to the controller + +.. code-block:: python + + # To get an actuator attached to the controller: + # +--------+ +-------------------------+ + # + Python +--+ Actuator "actuatorname" | + # +--------+ +-------------------------+ + actuator = co.actuators["actuatorname"] + + # Activate an actuator + controller.activate(actuator) + + +See the actuator's reference for available methods + +* :class:`bge.types.SCA_2DFilterActuator` +* :class:`bge.types.BL_ActionActuator` +* :class:`bge.types.KX_SCA_AddObjectActuator` +* :class:`bge.types.KX_CameraActuator` +* :class:`bge.types.KX_ConstraintActuator` +* :class:`bge.types.KX_SCA_DynamicActuator` +* :class:`bge.types.KX_SCA_EndObjectActuator` +* :class:`bge.types.KX_GameActuator` +* :class:`bge.types.KX_IpoActuator` +* :class:`bge.types.KX_NetworkMessageActuator` +* :class:`bge.types.KX_ObjectActuator` +* :class:`bge.types.KX_ParentActuator` +* :class:`bge.types.SCA_PropertyActuator` +* :class:`bge.types.SCA_RandomActuator` +* :class:`bge.types.KX_SCA_ReplaceMeshActuator` +* :class:`bge.types.KX_SceneActuator` +* :class:`bge.types.BL_ShapeActionActuator` +* :class:`bge.types.KX_SoundActuator` +* :class:`bge.types.KX_StateActuator` +* :class:`bge.types.KX_TrackToActuator` +* :class:`bge.types.KX_VisibilityActuator` + +Most logic brick's methods are accessors for the properties available in the logic buttons. +Consult the logic bricks documentation for more information on how each logic brick works. + +There are also methods to access the current :class:`bge.types.KX_Scene` + +.. code-block:: python + + # Get the current scene + scene = bge.logic.getCurrentScene() + + # Get the current camera + cam = scene.active_camera + +Matricies as used by the game engine are **row major** +``matrix[row][col] = float`` + +:class:`bge.types.KX_Camera` has some examples using matricies. + + +.. data:: globalDict + + A dictionary that is saved between loading blend files so you can use it to store inventory and other variables you want to store between scenes and blend files. + It can also be written to a file and loaded later on with the game load/save actuators. + + .. note:: only python built in types such as int/string/bool/float/tuples/lists can be saved, GameObjects, Actuators etc will not work as expectred. + +.. data:: keyboard: The current keyboard wrapped in an SCA_PythonKeyboard object. +.. data:: mouse: The current mouse wrapped in an SCA_PythonMouse object. + +.. function:: getCurrentController() + + Gets the Python controller associated with this Python script. + + :rtype: :class:`bge.types.SCA_PythonController` + +.. function:: getCurrentScene() + + Gets the current Scene. + + :rtype: :class:`bge.types.KX_Scene` + +.. function:: getSceneList() + + Gets a list of the current scenes loaded in the game engine. + + :rtype: list of :class:`bge.types.KX_Scene` + + .. note:: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes. + +.. function:: loadGlobalDict() + + Loads bge.logic.globalDict from a file. + +.. function:: saveGlobalDict() + + Saves bge.logic.globalDict to a file. + +.. function:: addScene(name, overlay=1) + + Loads a scene into the game engine. + + :arg name: The name of the scene + :type name: string + :arg overlay: Overlay or underlay (optional) + :type overlay: integer + +.. function:: sendMessage(subject, body="", to="", message_from="") + + Sends a message to sensors in any active scene. + + :arg subject: The subject of the message + :type subject: string + :arg body: The body of the message (optional) + :type body: string + :arg to: The name of the object to send the message to (optional) + :type to: string + :arg message_from: The name of the object that the message is coming from (optional) + :type message_from: string + +.. function:: setGravity(gravity) + + Sets the world gravity. + + :type gravity: list [fx, fy, fz] + +.. function:: getSpectrum() + + Returns a 512 point list from the sound card. + This only works if the fmod sound driver is being used. + + :rtype: list [float], len(getSpectrum()) == 512 + +.. function:: stopDSP() + + Stops the sound driver using DSP effects. + + Only the fmod sound driver supports this. + DSP can be computationally expensive. + +.. function:: getMaxLogicFrame() + + Gets the maximum number of logic frame per render frame. + + :return: The maximum number of logic frame per render frame + :rtype: integer + +.. function:: setMaxLogicFrame(maxlogic) + + Sets the maximum number of logic frame that are executed per render frame. + This does not affect the physic system that still runs at full frame rate. + + :arg maxlogic: The new maximum number of logic frame per render frame. Valid values: 1..5 + :type maxlogic: integer + +.. function:: getMaxPhysicsFrame() + + Gets the maximum number of physics frame per render frame. + + :return: The maximum number of physics frame per render frame + :rtype: integer + +.. function:: setMaxPhysicsFrame(maxphysics) + + Sets the maximum number of physics timestep that are executed per render frame. + Higher value allows physics to keep up with realtime even if graphics slows down the game. + Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate) + maxphysics/ticrate is the maximum delay of the renderer that physics can compensate. + + :arg maxphysics: The new maximum number of physics timestep per render frame. Valid values: 1..5. + :type maxphysics: integer + +.. function:: getLogicTicRate() + + Gets the logic update frequency. + + :return: The logic frequency in Hz + :rtype: float + +.. function:: setLogicTicRate(ticrate) + + Sets the logic update frequency. + + The logic update frequency is the number of times logic bricks are executed every second. + The default is 60 Hz. + + :arg ticrate: The new logic update frequency (in Hz). + :type ticrate: float + +.. function:: getPhysicsTicRate() + + Gets the physics update frequency + + :return: The physics update frequency in Hz + :rtype: float + + .. warning: Not implimented yet + +.. function:: setPhysicsTicRate(ticrate) + + Sets the physics update frequency + + The physics update frequency is the number of times the physics system is executed every second. + The default is 60 Hz. + + :arg ticrate: The new update frequency (in Hz). + :type ticrate: float + + .. warning: Not implimented yet + +.. function:: saveGlobalDict() + + Saves bge.logic.globalDict to a file. + +.. function:: loadGlobalDict() + + Loads bge.logic.globalDict from a file. + + +Utility functions + +.. function:: getAverageFrameRate() + + Gets the estimated average framerate + + :return: The estimed average framerate in frames per second + :rtype: float + +.. function:: expandPath(path) + + Converts a blender internal path into a proper file system path. + + Use / as directory separator in path + You can use '//' at the start of the string to define a relative path; + Blender replaces that string by the directory of the startup .blend or runtime file + to make a full path name (doesn't change during the game, even if you load other .blend). + The function also converts the directory separator to the local file system format. + + :arg path: The path string to be converted/expanded. + :type path: string + :return: The converted string + :rtype: string + + +.. function:: getBlendFileList(path = "//") + + Returns a list of blend files in the same directory as the open blend file, or from using the option argument. + + :arg path: Optional directory argument, will be expanded (like expandPath) into the full path. + :type path: string + :return: A list of filenames, with no directory prefix + :rtype: list + +.. function:: PrintGLInfo() + + Prints GL Extension Info into the console + +.. function:: getRandomFloat() + + Returns a random floating point value in the range [0 - 1) + +========= +Constants +========= + +.. data:: KX_TRUE: True value used by some modules. +.. data:: KX_FALSE: False value used by some modules. + +--------------- +Property Sensor +--------------- + +.. data:: KX_PROPSENSOR_EQUAL + + Activate when the property is equal to the sensor value. + +.. data:: KX_PROPSENSOR_NOTEQUAL + + Activate when the property is not equal to the sensor value. + +.. data:: KX_PROPSENSOR_INTERVAL + + Activate when the property is between the specified limits. + +.. data:: KX_PROPSENSOR_CHANGED + + Activate when the property changes + +.. data:: KX_PROPSENSOR_EXPRESSION + + Activate when the expression matches + +------------------- +Constraint Actuator +------------------- + +See :class:`bge.types.KX_ConstraintActuator` + +.. data:: KX_CONSTRAINTACT_LOCX +.. data:: KX_CONSTRAINTACT_LOCY +.. data:: KX_CONSTRAINTACT_LOCZ +.. data:: KX_CONSTRAINTACT_ROTX +.. data:: KX_CONSTRAINTACT_ROTY +.. data:: KX_CONSTRAINTACT_ROTZ +.. data:: KX_CONSTRAINTACT_DIRNX +.. data:: KX_CONSTRAINTACT_DIRNY +.. data:: KX_CONSTRAINTACT_DIRPX +.. data:: KX_CONSTRAINTACT_DIRPY +.. data:: KX_CONSTRAINTACT_ORIX +.. data:: KX_CONSTRAINTACT_ORIY +.. data:: KX_CONSTRAINTACT_ORIZ + +------------ +IPO Actuator +------------ + +See :class:`bge.types.KX_IpoActuator` + +.. data:: KX_IPOACT_PLAY +.. data:: KX_IPOACT_PINGPONG +.. data:: KX_IPOACT_FLIPPER +.. data:: KX_IPOACT_LOOPSTOP +.. data:: KX_IPOACT_LOOPEND +.. data:: KX_IPOACT_FROM_PROP + +-------------------- +Random Distributions +-------------------- + +See :class:`bge.types.SCA_RandomActuator` + +.. data:: KX_RANDOMACT_BOOL_CONST +.. data:: KX_RANDOMACT_BOOL_UNIFORM +.. data:: KX_RANDOMACT_BOOL_BERNOUILLI +.. data:: KX_RANDOMACT_INT_CONST +.. data:: KX_RANDOMACT_INT_UNIFORM +.. data:: KX_RANDOMACT_INT_POISSON +.. data:: KX_RANDOMACT_FLOAT_CONST +.. data:: KX_RANDOMACT_FLOAT_UNIFORM +.. data:: KX_RANDOMACT_FLOAT_NORMAL +.. data:: KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL + +--------------- +Action Actuator +--------------- + +See :class:`bge.types.BL_ActionActuator` + +.. data:: KX_ACTIONACT_PLAY +.. data:: KX_ACTIONACT_FLIPPER +.. data:: KX_ACTIONACT_LOOPSTOP +.. data:: KX_ACTIONACT_LOOPEND +.. data:: KX_ACTIONACT_PROPERTY + +-------------- +Sound Actuator +-------------- + +See :class:`bge.types.KX_SoundActuator` + +.. data:: KX_SOUNDACT_PLAYSTOP +.. data:: KX_SOUNDACT_PLAYEND +.. data:: KX_SOUNDACT_LOOPSTOP +.. data:: KX_SOUNDACT_LOOPEND +.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL +.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP + +------------ +Radar Sensor +------------ + +See :class:`bge.types.KX_RadarSensor` + +.. data:: KX_RADAR_AXIS_POS_X +.. data:: KX_RADAR_AXIS_POS_Y +.. data:: KX_RADAR_AXIS_POS_Z +.. data:: KX_RADAR_AXIS_NEG_X +.. data:: KX_RADAR_AXIS_NEG_Y +.. data:: KX_RADAR_AXIS_NEG_Z + +---------- +Ray Sensor +---------- + +See :class:`bge.types.KX_RaySensor` + +.. data:: KX_RAY_AXIS_POS_X +.. data:: KX_RAY_AXIS_POS_Y +.. data:: KX_RAY_AXIS_POS_Z +.. data:: KX_RAY_AXIS_NEG_X +.. data:: KX_RAY_AXIS_NEG_Y +.. data:: KX_RAY_AXIS_NEG_Z + +---------------- +Dynamic Actuator +---------------- + +See :class:`bge.types.KX_SCA_DynamicActuator` + +.. data:: KX_DYN_RESTORE_DYNAMICS +.. data:: KX_DYN_DISABLE_DYNAMICS +.. data:: KX_DYN_ENABLE_RIGID_BODY +.. data:: KX_DYN_DISABLE_RIGID_BODY +.. data:: KX_DYN_SET_MASS + +------------- +Game Actuator +------------- + +See :class:`bge.types.KX_GameActuator` + +.. data:: KX_GAME_LOAD +.. data:: KX_GAME_START +.. data:: KX_GAME_RESTART +.. data:: KX_GAME_QUIT +.. data:: KX_GAME_SAVECFG +.. data:: KX_GAME_LOADCFG + +-------------- +Scene Actuator +-------------- + +See :class:`bge.types.KX_SceneActuator` + +.. data:: KX_SCENE_RESTART +.. data:: KX_SCENE_SET_SCENE +.. data:: KX_SCENE_SET_CAMERA +.. data:: KX_SCENE_ADD_FRONT_SCENE +.. data:: KX_SCENE_ADD_BACK_SCENE +.. data:: KX_SCENE_REMOVE_SCENE +.. data:: KX_SCENE_SUSPEND +.. data:: KX_SCENE_RESUME + +------------ +Input Status +------------ + +See :class:`bge.types.SCA_MouseSensor` + +.. data:: KX_INPUT_NONE +.. data:: KX_INPUT_JUST_ACTIVATED +.. data:: KX_INPUT_ACTIVE +.. data:: KX_INPUT_JUST_RELEASED + +------------- +Mouse Buttons +------------- + +See :class:`bge.types.SCA_MouseSensor` + +.. data:: KX_MOUSE_BUT_LEFT +.. data:: KX_MOUSE_BUT_MIDDLE +.. data:: KX_MOUSE_BUT_RIGHT + +------ +States +------ + +See :class:`bge.types.KX_StateActuator` + +.. data:: KX_STATE1 +.. data:: KX_STATE2 +.. data:: KX_STATE3 +.. data:: KX_STATE4 +.. data:: KX_STATE5 +.. data:: KX_STATE6 +.. data:: KX_STATE7 +.. data:: KX_STATE8 +.. data:: KX_STATE9 +.. data:: KX_STATE10 +.. data:: KX_STATE11 +.. data:: KX_STATE12 +.. data:: KX_STATE13 +.. data:: KX_STATE14 +.. data:: KX_STATE15 +.. data:: KX_STATE16 +.. data:: KX_STATE17 +.. data:: KX_STATE18 +.. data:: KX_STATE19 +.. data:: KX_STATE20 +.. data:: KX_STATE21 +.. data:: KX_STATE22 +.. data:: KX_STATE23 +.. data:: KX_STATE24 +.. data:: KX_STATE25 +.. data:: KX_STATE26 +.. data:: KX_STATE27 +.. data:: KX_STATE28 +.. data:: KX_STATE29 +.. data:: KX_STATE30 +.. data:: KX_STATE_OP_CLR +.. data:: KX_STATE_OP_CPY +.. data:: KX_STATE_OP_NEG +.. data:: KX_STATE_OP_SET + +--------- +2D Filter +--------- + +.. data:: RAS_2DFILTER_BLUR +.. data:: RAS_2DFILTER_CUSTOMFILTER +.. data:: RAS_2DFILTER_DILATION +.. data:: RAS_2DFILTER_DISABLED +.. data:: RAS_2DFILTER_ENABLED +.. data:: RAS_2DFILTER_EROSION +.. data:: RAS_2DFILTER_GRAYSCALE +.. data:: RAS_2DFILTER_INVERT +.. data:: RAS_2DFILTER_LAPLACIAN +.. data:: RAS_2DFILTER_MOTIONBLUR +.. data:: RAS_2DFILTER_NOFILTER +.. data:: RAS_2DFILTER_PREWITT +.. data:: RAS_2DFILTER_SEPIA +.. data:: RAS_2DFILTER_SHARPEN +.. data:: RAS_2DFILTER_SOBEL + +------------------- +Constraint Actuator +------------------- + +.. data:: KX_ACT_CONSTRAINT_DISTANCE +.. data:: KX_ACT_CONSTRAINT_DOROTFH +.. data:: KX_ACT_CONSTRAINT_FHNX +.. data:: KX_ACT_CONSTRAINT_FHNY +.. data:: KX_ACT_CONSTRAINT_FHNZ +.. data:: KX_ACT_CONSTRAINT_FHPX +.. data:: KX_ACT_CONSTRAINT_FHPY +.. data:: KX_ACT_CONSTRAINT_FHPZ +.. data:: KX_ACT_CONSTRAINT_LOCAL +.. data:: KX_ACT_CONSTRAINT_MATERIAL +.. data:: KX_ACT_CONSTRAINT_NORMAL +.. data:: KX_ACT_CONSTRAINT_PERMANENT + +--------------- +Parent Actuator +--------------- + +.. data:: KX_PARENT_REMOVE +.. data:: KX_PARENT_SET + +------ +Shader +------ + +.. data:: VIEWMATRIX +.. data:: VIEWMATRIX_INVERSE +.. data:: VIEWMATRIX_INVERSETRANSPOSE +.. data:: VIEWMATRIX_TRANSPOSE +.. data:: MODELMATRIX +.. data:: MODELMATRIX_INVERSE +.. data:: MODELMATRIX_INVERSETRANSPOSE +.. data:: MODELMATRIX_TRANSPOSE +.. data:: MODELVIEWMATRIX +.. data:: MODELVIEWMATRIX_INVERSE +.. data:: MODELVIEWMATRIX_INVERSETRANSPOSE +.. data:: MODELVIEWMATRIX_TRANSPOSE +.. data:: CAM_POS + + Current camera position + +.. data:: CONSTANT_TIMER + + User a timer for the uniform value. + +.. data:: SHD_TANGENT + +---------------- +Blender Material +---------------- + +.. data:: BL_DST_ALPHA +.. data:: BL_DST_COLOR +.. data:: BL_ONE +.. data:: BL_ONE_MINUS_DST_ALPHA +.. data:: BL_ONE_MINUS_DST_COLOR +.. data:: BL_ONE_MINUS_SRC_ALPHA +.. data:: BL_ONE_MINUS_SRC_COLOR +.. data:: BL_SRC_ALPHA +.. data:: BL_SRC_ALPHA_SATURATE +.. data:: BL_SRC_COLOR +.. data:: BL_ZERO diff --git a/source/gameengine/PyDoc/bge.render.rst b/source/gameengine/PyDoc/bge.render.rst new file mode 100644 index 00000000000..d1a35019165 --- /dev/null +++ b/source/gameengine/PyDoc/bge.render.rst @@ -0,0 +1,231 @@ + +Game Engine bge.render Module. +============================== + +.. module:: bge.render + +.. code-block:: python + + # Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook:: + # To use a mouse movement sensor "Mouse" and a + # motion actuator to mouse look: + import bge.render + import bge.logic + + # SCALE sets the speed of motion + SCALE=[1, 0.5] + + co = bge.logic.getCurrentController() + obj = co.getOwner() + mouse = co.getSensor("Mouse") + lmotion = co.getActuator("LMove") + wmotion = co.getActuator("WMove") + + # Transform the mouse coordinates to see how far the mouse has moved. + def mousePos(): + x = (bge.render.getWindowWidth()/2 - mouse.getXPosition())*SCALE[0] + y = (bge.render.getWindowHeight()/2 - mouse.getYPosition())*SCALE[1] + return (x, y) + + pos = mousePos() + + # Set the amount of motion: X is applied in world coordinates... + lmotion.setTorque(0.0, 0.0, pos[0], False) + # ...Y is applied in local coordinates + wmotion.setTorque(-pos[1], 0.0, 0.0, True) + + # Activate both actuators + bge.logic.addActiveActuator(lmotion, True) + bge.logic.addActiveActuator(wmotion, True) + + # Centre the mouse + bge.render.setMousePosition(bge.render.getWindowWidth()/2, bge.render.getWindowHeight()/2) + + +.. data:: KX_TEXFACE_MATERIAL + + Materials as defined by the texture face settings. + +.. data:: KX_BLENDER_MULTITEX_MATERIAL + + Materials approximating blender materials with multitexturing. + +.. data:: KX_BLENDER_GLSL_MATERIAL + + Materials approximating blender materials with GLSL. + +.. function:: getWindowWidth() + + Gets the width of the window (in pixels) + + :rtype: integer + +.. function:: getWindowHeight() + + Gets the height of the window (in pixels) + + :rtype: integer + +.. function:: makeScreenshot(filename) + + Writes a screenshot to the given filename. + + If filename starts with // the image will be saved relative to the current directory. + If the filename contains # it will be replaced with the frame number. + + The standalone player saves .png files. It does not support colour space conversion + or gamma correction. + + When run from Blender, makeScreenshot supports Iris, IrisZ, TGA, Raw TGA, PNG, HamX, and Jpeg. + Gamma, Colourspace conversion and Jpeg compression are taken from the Render settings panels. + + :type filename: string + + +.. function:: enableVisibility(visible) + + Doesn't really do anything... + + +.. function:: showMouse(visible) + + Enables or disables the operating system mouse cursor. + + :type visible: boolean + + +.. function:: setMousePosition(x, y) + + Sets the mouse cursor position. + + :type x: integer + :type y: integer + + +.. function:: setBackgroundColor(rgba) + + Sets the window background colour. + + :type rgba: list [r, g, b, a] + + +.. function:: setMistColor(rgb) + + Sets the mist colour. + + :type rgb: list [r, g, b] + + +.. function:: setAmbientColor(rgb) + + Sets the color of ambient light. + + :type rgb: list [r, g, b] + + +.. function:: setMistStart(start) + + Sets the mist start value. Objects further away than start will have mist applied to them. + + :type start: float + + +.. function:: setMistEnd(end) + + Sets the mist end value. Objects further away from this will be coloured solid with + the colour set by setMistColor(). + + :type end: float + + +.. function:: disableMist() + + Disables mist. + + .. note:: Set any of the mist properties to enable mist. + + +.. function:: setEyeSeparation(eyesep) + + Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value. + + :arg eyesep: The distance between the left and right eye. + :type eyesep: float + + +.. function:: getEyeSeparation() + + Gets the current eye separation for stereo mode. + + :rtype: float + + +.. function:: setFocalLength(focallength) + + Sets the focal length for stereo mode. It uses the current camera focal length as initial value. + + :arg focallength: The focal length. + :type focallength: float + +.. function:: getFocalLength() + + Gets the current focal length for stereo mode. + + :rtype: float + +.. function:: setMaterialMode(mode) + + Set the material mode to use for OpenGL rendering. + + :type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL + + .. note:: Changes will only affect newly created scenes. + + +.. function:: getMaterialMode(mode) + + Get the material mode to use for OpenGL rendering. + + :rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL + + +.. function:: setGLSLMaterialSetting(setting, enable) + + Enables or disables a GLSL material setting. + + :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) + :type enable: boolean + + +.. function:: getGLSLMaterialSetting(setting, enable) + + Get the state of a GLSL material setting. + + :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) + :rtype: boolean + + +.. function:: drawLine(fromVec,toVec,color) + + Draw a line in the 3D scene. + + :arg fromVec: the origin of the line + :type fromVec: list [x, y, z] + :arg toVec: the end of the line + :type toVec: list [x, y, z] + :arg color: the color of the line + :type color: list [r, g, b] + + +.. function:: enableMotionBlur(factor) + + Enable the motion blue effect. + + :arg factor: the ammount of motion blur to display. + :type factor: float [0.0 - 1.0] + + +.. function:: disableMotionBlur() + + Disable the motion blue effect. + diff --git a/source/gameengine/PyDoc/bge.types.rst b/source/gameengine/PyDoc/bge.types.rst new file mode 100644 index 00000000000..6cfb3377cac --- /dev/null +++ b/source/gameengine/PyDoc/bge.types.rst @@ -0,0 +1,4339 @@ + +Game Engine bge.types Module. +============================== + +.. module:: bge.types + +.. class:: PyObjectPlus + + PyObjectPlus base class of most other types in the Game Engine. + + .. attribute:: invalid + + Test if the object has been freed by the game engine and is no longer valid. + + Normally this is not a problem but when storing game engine data in the GameLogic module, + KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data. + Calling an attribute or method on an invalid object will raise a SystemError. + + The invalid attribute allows testing for this case without exception handling. + + *type* bool + + .. method:: isA(game_type) + + Check if this is a type or a subtype game_type. + + :arg game_type: the name of the type or the type its self from the :mod:`bge.types` module. + :type game_type: string or type + :return: True if this object is a type or a subtype of game_type. + :rtype: bool + +.. class:: CValue(PyObjectPlus) + + This class is a basis for other classes. + + .. attribute:: name + + The name of this CValue derived object (read-only). **type** string + +.. class:: CPropValue(CValue) + + This class has no python functions + +.. class:: SCA_ILogicBrick(CValue) + + Base class for all logic bricks. + + .. attribute:: executePriority + + This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first). + + *type* executePriority: int + + .. attribute:: owner + + The game object this logic brick is attached to (read-only). **type** :class:`KX_GameObject` or None in exceptional cases. + + .. attribute:: name + + The name of this logic brick (read-only). **type** string + +.. class:: SCA_PythonKeyboard(PyObjectPlus) + + The current keyboard. + + .. attribute:: events + + A list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). + + * 'keycode' matches the values in :mod:`bge.keys`. + * 'status' uses... + * :mod:`bge.logic.KX_INPUT_NONE` + * :mod:`bge.logic.KX_INPUT_JUST_ACTIVATED` + * :mod:`bge.logic.KX_INPUT_ACTIVE` + * :mod:`bge.logic.KX_INPUT_JUST_RELEASED` + + *type* list [[keycode, status], ...] + +.. class:: SCA_PythonMouse(PyObjectPlus) + + The current mouse. + + .. attribute:: events + + a list of pressed buttons that have either been pressed, or just released, or are active this frame. (read-only). + + * 'keycode' matches the values in :mod:`bge.keys`. + * 'status' uses... + * :mod:`bge.logic.KX_INPUT_NONE` + * :mod:`bge.logic.KX_INPUT_JUST_ACTIVATED` + * :mod:`bge.logic.KX_INPUT_ACTIVE` + * :mod:`bge.logic.KX_INPUT_JUST_RELEASED` + + *type* list [[keycode, status], ...] + + .. attribute:: position + + The normalized x and y position of the mouse cursor. **type** list [x, y] + + .. attribute:: visible + + The visibility of the mouse cursor. **type** boolean + +.. class:: SCA_IObject(CValue) + + This class has no python functions + +.. class:: SCA_ISensor(SCA_ILogicBrick) + + Base class for all sensor logic bricks. + + .. attribute:: usePosPulseMode + + Flag to turn positive pulse mode on and off. **type** boolean + + .. attribute:: useNegPulseMode + + Flag to turn negative pulse mode on and off. **type** boolean + + .. attribute:: frequency + + The frequency for pulse mode sensors. **type** integer + + .. attribute:: level + + level Option whether to detect level or edge transition when entering a state. + It makes a difference only in case of logic state transition (state actuator). + A level detector will immediately generate a pulse, negative or positive + depending on the sensor condition, as soon as the state is activated. + A edge detector will wait for a state change before generating a pulse. + note: mutually exclusive with :data:`tap`, enabling will disable :data:`tap`. + + *type* boolean + + .. attribute:: tap + + When enabled only sensors that are just activated will send a positive event, + after this they will be detected as negative by the controllers. + This will make a key thats held act as if its only tapped for an instant. + note: mutually exclusive with :data:`level`, enabling will disable :data:`level`. + + *type* boolean + + .. attribute:: invert + + Flag to set if this sensor activates on positive or negative events. **type** boolean + + .. attribute:: triggered + + True if this sensor brick is in a positive state. (read-only). **type** boolean + + .. attribute:: positive + + True if this sensor brick is in a positive state. (read-only). **type** boolean + + .. attribute:: status + + The status of the sensor. (read-only). **type** int from 0-3. + + * KX_SENSOR_INACTIVE + * KX_SENSOR_JUST_ACTIVATED + * KX_SENSOR_ACTIVE + * KX_SENSOR_JUST_DEACTIVATED + + .. note:: this convenient attribute combines the values of triggered and positive attributes. + + .. method:: reset() + + Reset sensor internal state, effect depends on the type of sensor and settings. + + The sensor is put in its initial state as if it was just activated. + +.. class:: SCA_IController(SCA_ILogicBrick) + + Base class for all controller logic bricks. + + .. attribute:: state + + The controllers state bitmask. This can be used with the GameObject's state to test if the controller is active. **type** int bitmask + + .. attribute:: sensors + + A list of sensors linked to this controller. **type** sequence supporting index/string lookups and iteration. + + .. note:: The sensors are not necessarily owned by the same object. + .. note:: When objects are instanced in dupligroups links may be lost from objects outside the dupligroup. + + .. attribute:: actuators + + A list of actuators linked to this controller. **type** sequence supporting index/string lookups and iteration. + + .. note:: The sensors are not necessarily owned by the same object. + .. note:: When objects are instanced in dupligroups links may be lost from objects outside the dupligroup. + + .. attribute:: useHighPriority + + When set the controller executes always before all other controllers that dont have this set. **type** bool + + .. note:: Order of execution between high priority controllers is not guaranteed. + +.. class:: SCA_IActuator(SCA_ILogicBrick) + + Base class for all actuator logic bricks. + +.. class:: BL_ActionActuator(SCA_IActuator) + + Action Actuators apply an action to an actor. + + .. attribute:: action + + The name of the action to set as the current action. **type** string + + .. attribute:: channelNames + + A list of channel names that may be used with :data:`setChannel` and :data:`getChannel`. **type** list of strings + + .. attribute:: frameStart + + Specifies the starting frame of the animation. **type** float + + .. attribute:: frameEnd + + Specifies the ending frame of the animation. **type** float + + .. attribute:: blendIn + + Specifies the number of frames of animation to generate when making transitions between actions. **type** float + + .. attribute:: priority + + Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers. **type** integer + + .. attribute:: frame + + Sets the current frame for the animation. **type** float + + .. attribute:: propName + + Sets the property to be used in FromProp playback mode. **type** string + + .. attribute:: blendTime + + Sets the internal frame timer. This property must be in the range from 0.0 to blendIn. **type** float + + .. attribute:: mode + + The operation mode of the actuator. KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND. **type** integer + + .. attribute:: useContinue + + The actions continue option, True or False. When True, the action will always play from where last left off, otherwise negative events to this actuator will reset it to its start frame. **type** boolean + + .. attribute:: framePropName + + The name of the property that is set to the current frame number. **type** string + + .. method:: setChannel(channel, matrix) + + Alternative to the 2 arguments, 4 arguments (channel, matrix, loc, size, quat) are also supported. + + :arg channel: A string specifying the name of the bone channel, error raised if not in :data:`channelNames`. + :type channel: string + :arg matrix: A 4x4 matrix specifying the overriding transformation as an offset from the bone's rest position. + :arg matrix: list [[float]] + + .. note:: These values are relative to the bones rest position, currently the api has no way to get this info (which is annoying), but can be worked around by using bones with a rest pose that has no translation. + + .. method:: getChannel(channel) + + :arg channel: A string specifying the name of the bone channel. error raised if not in :data:`channelNames`. + :type channel: string + :return: (loc, size, quat) + :rtype: tuple + +.. class:: BL_Shader(PyObjectPlus) + + BL_Shader GLSL shaders. + + TODO - Description + + .. method:: setUniformfv(name, fList) + + Set a uniform with a list of float values + + :arg name: the uniform name + :type name: string + :arg fList: a list (2, 3 or 4 elements) of float values + :type fList: list[float] + + .. method:: delSource() + + Clear the shader. Use this method before the source is changed with :data:`setSource`. + + .. method:: getFragmentProg() + + Returns the fragment program. + + :return: The fragment program. + :rtype: string + + .. method:: getVertexProg() + + Get the vertex program. + + :return: The vertex program. + :rtype: string + + .. method:: isValid() + + Check if the shader is valid. + + :return: True if the shader is valid + :rtype: bool + + .. method:: setAttrib(enum) + + Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.) + + :arg enum: attribute location value + :type enum: integer + + .. method:: setNumberOfPasses( max_pass ) + + Set the maximum number of passes. Not used a.t.m. + + :arg max_pass: the maximum number of passes + :type max_pass: integer + + .. method:: setSampler(name, index) + + Set uniform texture sample index. + + :arg name: Uniform name + :type name: string + :arg index: Texture sample index. + :type index: integer + + .. method:: setSource(vertexProgram, fragmentProgram) + + Set the vertex and fragment programs + + :arg vertexProgram: Vertex program + :type vertexProgram: string + :arg fragmentProgram: Fragment program + :type fragmentProgram: string + + .. method:: setUniform1f(name, fx) + + Set a uniform with 1 float value. + + :arg name: the uniform name + :type name: string + :arg fx: Uniform value + :type fx: float + + .. method:: setUniform1i(name, ix) + + Set a uniform with an integer value. + + :arg name: the uniform name + :type name: string + :arg ix: the uniform value + :type ix: integer + + .. method:: setUniform2f(name, fx, fy) + + Set a uniform with 2 float values + + :arg name: the uniform name + :type name: string + :arg fx: first float value + :type fx: float + + :arg fy: second float value + :type fy: float + + .. method:: setUniform2i(name, ix, iy) + + Set a uniform with 2 integer values + + :arg name: the uniform name + :type name: string + :arg ix: first integer value + :type ix: integer + :arg iy: second integer value + :type iy: integer + + .. method:: setUniform3f(name, fx, fy, fz) + + Set a uniform with 3 float values. + + :arg name: the uniform name + :type name: string + :arg fx: first float value + :type fx: float + :arg fy: second float value + :type fy: float + :arg fz: third float value + :type fz: float + + .. method:: setUniform3i(name, ix, iy, iz) + + Set a uniform with 3 integer values + + :arg name: the uniform name + :type name: string + :arg ix: first integer value + :type ix: integer + :arg iy: second integer value + :type iy: integer + :arg iz: third integer value + :type iz: integer + + .. method:: setUniform4f(name, fx, fy, fz, fw) + + Set a uniform with 4 float values. + + :arg name: the uniform name + :type name: string + :arg fx: first float value + :type fx: float + :arg fy: second float value + :type fy: float + :arg fz: third float value + :type fz: float + :arg fw: fourth float value + :type fw: float + + .. method:: setUniform4i(name, ix, iy, iz, iw) + + Set a uniform with 4 integer values + + :arg name: the uniform name + :type name: string + :arg ix: first integer value + :type ix: integer + :arg iy: second integer value + :type iy: integer + :arg iz: third integer value + :type iz: integer + :arg iw: fourth integer value + :type iw: integer + + .. method:: setUniformDef(name, type) + + Define a new uniform + + :arg name: the uniform name + :type name: string + :arg type: uniform type + :type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX + + .. method:: setUniformMatrix3(name, mat, transpose) + + Set a uniform with a 3x3 matrix value + + :arg name: the uniform name + :type name: string + :arg mat: A 3x3 matrix [[f, f, f], [f, f, f], [f, f, f]] + :type mat: 3x3 matrix + :arg transpose: set to True to transpose the matrix + :type transpose: bool + + .. method:: setUniformMatrix4(name, mat, transpose) + + Set a uniform with a 4x4 matrix value + + :arg name: the uniform name + :type name: string + :arg mat: A 4x4 matrix [[f, f, f, f], [f, f, f, f], [f, f, f, f], [f, f, f, f]] + :type mat: 4x4 matrix + :arg transpose: set to True to transpose the matrix + :type transpose: bool + + .. method:: setUniformiv(name, iList) + + Set a uniform with a list of integer values + + :arg name: the uniform name + :type name: string + :arg iList: a list (2, 3 or 4 elements) of integer values + :type iList: list[integer] + + .. method:: validate() + + Validate the shader object. + +.. class:: BL_ShapeActionActuator(SCA_IActuator) + + ShapeAction Actuators apply an shape action to an mesh object. + + .. attribute:: action + + The name of the action to set as the current shape action. **type** string + + .. attribute:: frameStart + + Specifies the starting frame of the shape animation. **type** float + + .. attribute:: frameEnd + + Specifies the ending frame of the shape animation. **type** float + + .. attribute:: blendIn + + Specifies the number of frames of animation to generate when making transitions between actions. **type** float + + .. attribute:: priority + + Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers. **type** integer + + .. attribute:: frame + + Sets the current frame for the animation. **type** float + + .. attribute:: propName + + Sets the property to be used in FromProp playback mode. **type** string + + .. attribute:: blendTime + + Sets the internal frame timer. This property must be in the range from 0.0 to blendin. **type** float + + .. attribute:: mode + + The operation mode of the actuator in [KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND] **type** integer + + .. attribute:: framePropName + + The name of the property that is set to the current frame number. **type** string + +.. class:: CListValue(CPropValue) + + CListValue + + This is a list like object used in the game engine internally that behaves similar to a python list in most ways. + + As well as the normal index lookup. + ``val= clist[i]`` + + CListValue supports string lookups. + ``val= scene.objects["Cube"]`` + + Other operations such as ``len(clist), list(clist), clist[0:10]`` are also supported. + + .. method:: append(val) + + Add an item to the list (like pythons append) + + .. warning:: Appending values to the list can cause crashes when the list is used internally by the game engine. + + .. method:: count(val) + + Count the number of instances of a value in the list. + + :return: number of instances + :rtype: integer + + .. method:: index(val) + + Return the index of a value in the list. + + :return: The index of the value in the list. + :rtype: integer + + .. method:: reverse() + + Reverse the order of the list. + + .. method:: get(key, default=None) + + Return the value matching key, or the default value if its not found. + + :return: The key value or a default. + + .. method:: from_id(id) + + This is a funtion especially for the game engine to return a value with a spesific id. + + Since object names are not always unique, the id of an object can be used to get an object from the CValueList. + + Example. + + ``myObID=id(gameObject)`` + ``ob= scene.objects.from_id(myObID)`` + + Where myObID is an int or long from the id function. + + This has the advantage that you can store the id in places you could not store a gameObject. + + .. warning:: the id is derived from a memory location and will be different each time the game engine starts. + +.. class:: KX_BlenderMaterial(PyObjectPlus) + + KX_BlenderMaterial + + .. method:: getShader() + + Returns the material's shader. + + :return: the material's shader + :rtype: :class:`BL_Shader` + + .. method:: setBlending(src, dest) + + Set the pixel color arithmetic functions. + + :arg src: Specifies how the red, green, blue, and alpha source blending factors are computed. + :type src: Value in... + + * GL_ZERO, + * GL_ONE, + * GL_SRC_COLOR, + * GL_ONE_MINUS_SRC_COLOR, + * GL_DST_COLOR, + * GL_ONE_MINUS_DST_COLOR, + * GL_SRC_ALPHA, + * GL_ONE_MINUS_SRC_ALPHA, + * GL_DST_ALPHA, + * GL_ONE_MINUS_DST_ALPHA, + * GL_SRC_ALPHA_SATURATE + + :arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed. + :type dest: Value in... + + * GL_ZERO + * GL_ONE + * GL_SRC_COLOR + * GL_ONE_MINUS_SRC_COLOR + * GL_DST_COLOR + * GL_ONE_MINUS_DST_COLOR + * GL_SRC_ALPHA + * GL_ONE_MINUS_SRC_ALPHA + * GL_DST_ALPHA + * GL_ONE_MINUS_DST_ALPHA + * GL_SRC_ALPHA_SATURATE + + .. method:: getMaterialIndex() + + Returns the material's index. + + :return: the material's index + :rtype: integer + +.. class:: KX_CameraActuator(SCA_IActuator) + + Applies changes to a camera. + + .. attribute:: min + + minimum distance to the target object maintained by the actuator. **type** float + + .. attribute:: max + + maximum distance to stay from the target object. **type** float + + .. attribute:: height + + height to stay above the target object. **type** float + + .. attribute:: useXY + + axis this actuator is tracking, True=X, False=Y. **type** boolean + + .. attribute:: object + + the object this actuator tracks. **type** :class:`KX_GameObject` or None + + @author: snail + +.. class:: KX_ConstraintActuator(SCA_IActuator) + + A constraint actuator limits the position, rotation, distance or orientation of an object. + + Properties: + + .. attribute:: damp + + Time constant of the constraint expressed in frame (not use by Force field constraint). **type** integer + + .. attribute:: rotDamp + + Time constant for the rotation expressed in frame (only for the distance constraint), 0 = use damp for rotation as well. **type** integer + + .. attribute:: direction + + The reference direction in world coordinate for the orientation constraint. **type** 3-tuple of float: (x, y, z) + + .. attribute:: option + + Binary combination of the following values. **type** integer + + * Applicable to Distance constraint + * KX_ACT_CONSTRAINT_NORMAL ( 64) : Activate alignment to surface + * KX_ACT_CONSTRAINT_DISTANCE ( 512) : Activate distance control + * KX_ACT_CONSTRAINT_LOCAL (1024) : direction of the ray is along the local axis + * Applicable to Force field constraint: + * KX_ACT_CONSTRAINT_DOROTFH (2048) : Force field act on rotation as well + * Applicable to both: + * KX_ACT_CONSTRAINT_MATERIAL ( 128) : Detect material rather than property + * KX_ACT_CONSTRAINT_PERMANENT ( 256) : No deactivation if ray does not hit target + + .. attribute:: time + + activation time of the actuator. The actuator disables itself after this many frame. If set to 0, the actuator is not limited in time. **type** integer + + .. attribute:: propName + + the name of the property or material for the ray detection of the distance constraint. **type** string + + .. attribute:: min + + The lower bound of the constraint. For the rotation and orientation constraint, it represents radiant **type** float + + .. attribute:: distance + + the target distance of the distance constraint **type** float + + .. attribute:: max + + the upper bound of the constraint. For rotation and orientation constraints, it represents radiant. **type** float + + .. attribute:: rayLength + + the length of the ray of the distance constraint. + + *type* float + + .. attribute:: limit + + type of constraint. **type** integer. + + use one of the following constant: + + * KX_ACT_CONSTRAINT_LOCX ( 1) : limit X coord + * KX_ACT_CONSTRAINT_LOCY ( 2) : limit Y coord + * KX_ACT_CONSTRAINT_LOCZ ( 3) : limit Z coord + * KX_ACT_CONSTRAINT_ROTX ( 4) : limit X rotation + * KX_ACT_CONSTRAINT_ROTY ( 5) : limit Y rotation + * KX_ACT_CONSTRAINT_ROTZ ( 6) : limit Z rotation + * KX_ACT_CONSTRAINT_DIRPX ( 7) : set distance along positive X axis + * KX_ACT_CONSTRAINT_DIRPY ( 8) : set distance along positive Y axis + * KX_ACT_CONSTRAINT_DIRPZ ( 9) : set distance along positive Z axis + * KX_ACT_CONSTRAINT_DIRNX (10) : set distance along negative X axis + * KX_ACT_CONSTRAINT_DIRNY (11) : set distance along negative Y axis + * KX_ACT_CONSTRAINT_DIRNZ (12) : set distance along negative Z axis + * KX_ACT_CONSTRAINT_ORIX (13) : set orientation of X axis + * KX_ACT_CONSTRAINT_ORIY (14) : set orientation of Y axis + * KX_ACT_CONSTRAINT_ORIZ (15) : set orientation of Z axis + * KX_ACT_CONSTRAINT_FHPX (16) : set force field along positive X axis + * KX_ACT_CONSTRAINT_FHPY (17) : set force field along positive Y axis + * KX_ACT_CONSTRAINT_FHPZ (18) : set force field along positive Z axis + * KX_ACT_CONSTRAINT_FHNX (19) : set force field along negative X axis + * KX_ACT_CONSTRAINT_FHNY (20) : set force field along negative Y axis + * KX_ACT_CONSTRAINT_FHNZ (21) : set force field along negative Z axis + +.. class:: KX_ConstraintWrapper(PyObjectPlus) + + KX_ConstraintWrapper + + .. method:: getConstraintId(val) + + Returns the contraint's ID + + :return: the constraint's ID + :rtype: integer + +.. class:: KX_GameActuator(SCA_IActuator) + + The game actuator loads a new .blend file, restarts the current .blend file or quits the game. + + Properties: + + .. attribute:: fileName + + the new .blend file to load **type** string. + + .. attribute:: mode + + The mode of this actuator **type** Constant in... + + * :mod:`bge.logic.KX_GAME_LOAD` + * :mod:`bge.logic.KX_GAME_START` + * :mod:`bge.logic.KX_GAME_RESTART` + * :mod:`bge.logic.KX_GAME_QUIT` + * :mod:`bge.logic.KX_GAME_SAVECFG` + * :mod:`bge.logic.KX_GAME_LOADCFG` + +.. class:: KX_GameObject(SCA_IObject) + + All game objects are derived from this class. + + Properties assigned to game objects are accessible as attributes of this class. + + .. note:: Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError, if an object may have been removed since last accessing it use the :data:`invalid` attribute to check. + + .. attribute:: name + + The object's name. (read-only). **type** string. + + .. attribute:: mass + + The object's mass + + .. note:: The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0 **type** float + + .. attribute:: linVelocityMin + + Enforces the object keeps moving at a minimum velocity. + + .. note:: Applies to dynamic and rigid body objects only. + .. note:: A value of 0.0 disables this option. + .. note:: While objects are stationary the minimum velocity will not be applied. **type** float + + .. attribute:: linVelocityMax + + Clamp the maximum linear velocity to prevent objects moving beyond a set speed. + + .. note:: Applies to dynamic and rigid body objects only. + .. note:: A value of 0.0 disables this option (rather then setting it stationary). **type** float + + .. attribute:: localInertia + + the object's inertia vector in local coordinates. Read only. **type** list [ix, iy, iz] + + .. attribute:: parent + + The object's parent object. (read-only). **type** :class:`KX_GameObject` or None + + .. attribute:: visible + + visibility flag. + + .. note:: Game logic will still run for invisible objects. **type** boolean + + .. attribute:: color + + The object color of the object **type** list [r, g, b, a] + + .. attribute:: occlusion + + occlusion capability flag. **type** boolean + + .. attribute:: position + + The object's position. + + .. deprecated:: use :data:`localPosition` and :data:`worldPosition`. **type** list [x, y, z] On write: local position, on read: world position + + .. attribute:: orientation + + The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. + + .. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`. **type** 3x3 Matrix [[float]] On write: local orientation, on read: world orientation + + .. attribute:: scaling + + The object's scaling factor. list [sx, sy, sz] + + .. deprecated:: use :data:`localScale` and :data:`worldScale`. **type** list [sx, sy, sz] On write: local scaling, on read: world scaling + + .. attribute:: localOrientation + + The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. **type** 3x3 Matrix [[float]] + + .. attribute:: worldOrientation + + The object's world orientation. **type** 3x3 Matrix [[float]] + + .. attribute:: localScale + + The object's local scaling factor. **type** list [sx, sy, sz] + + .. attribute:: worldScale + + The object's world scaling factor. Read-only **type** list [sx, sy, sz] + + .. attribute:: localPosition + + The object's local position. **type** list [x, y, z] + + .. attribute:: worldPosition + + The object's world position. **type** list [x, y, z] + + .. attribute:: timeOffset + + adjust the slowparent delay at runtime. **type** float + + .. attribute:: state + + the game object's state bitmask, using the first 30 bits, one bit must always be set. **type** int + + .. attribute:: meshes + + a list meshes for this object. + + .. note:: Most objects use only 1 mesh. + .. note:: Changes to this list will not update the KX_GameObject. **type** list of :class:`KX_MeshProxy` + + .. attribute:: sensors + + a sequence of :class:`SCA_ISensor` objects with string/index lookups and iterator support. + + .. note:: This attribute is experemental and may be removed (but probably wont be). + .. note:: Changes to this list will not update the KX_GameObject. **type** list + + .. attribute:: controllers + + a sequence of :class:`SCA_IController` objects with string/index lookups and iterator support. + .. note:: This attribute is experemental and may be removed (but probably wont be). + .. note:: Changes to this list will not update the KX_GameObject. **type** list of :class:`SCA_ISensor`. + + .. attribute:: actuators + + a list of :class:`SCA_IActuator` with string/index lookups and iterator support. + + .. note:: This attribute is experemental and may be removed (but probably wont be). + .. note:: Changes to this list will not update the KX_GameObject. **type** list + + .. attribute:: attrDict + + get the objects internal python attribute dictionary for direct (faster) access. **type** dict + + .. attribute:: children + + direct children of this object, (read-only). **type** :class:`CListValue` of :class:`KX_GameObject`'s + + .. attribute:: childrenRecursive + + all children of this object including childrens children, (read-only). **type** :class:`CListValue` of :class:`KX_GameObject`'s + + .. method:: endObject() + + Delete this object, can be used in place of the EndObject Actuator. + + The actual removal of the object from the scene is delayed. + + .. method:: replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False) + + Replace the mesh of this object with a new mesh. This works the same was as the actuator. + + :arg mesh: mesh to replace or the meshes name. + :type mesh: :class:`MeshProxy` or string + :arg useDisplayMesh: when enabled the display mesh will be replaced (optional argument). + :type useDisplayMesh: bool + :arg usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument). + :type usePhysicsMesh: bool + + .. method:: setVisible(visible, recursive) + + Sets the game object's visible flag. + + :arg visible: the visible state to set. + :type visible: boolean + :arg recursive: optional argument to set all childrens visibility flag too. + :type recursive: boolean + + .. method:: setOcclusion(occlusion, recursive) + + Sets the game object's occlusion capability. + + :arg occlusion: the state to set the occlusion to. + :type occlusion: boolean + :arg recursive: optional argument to set all childrens occlusion flag too. + :type recursive: boolean + + .. method:: alignAxisToVect(vect, axis=2, factor=1.0) + + Aligns any of the game object's axis along the given vector. + + + :arg vect: a vector to align the axis. + :type vect: 3D vector + :arg axis: The axis you want to align + + * 0: X axis + * 1: Y axis + * 2: Z axis + + :type axis: integer + :arg factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0) + :type factor: float + + .. method:: getAxisVect(vect) + + Returns the axis vector rotates by the objects worldspace orientation. + This is the equivalent of multiplying the vector by the orientation matrix. + + :arg vect: a vector to align the axis. + :type vect: 3D Vector + :return: The vector in relation to the objects rotation. + :rtype: 3d vector. + + .. method:: applyMovement(movement, local=False) + + Sets the game object's movement. + + :arg movement: movement vector. + :type movement: 3D Vector + :arg local: + * False: you get the "global" movement ie: relative to world orientation. + * True: you get the "local" movement ie: relative to object orientation. + :arg local: boolean + + .. method:: applyRotation(rotation, local=False) + + Sets the game object's rotation. + + :arg rotation: rotation vector. + :type rotation: 3D Vector + :arg local: + * False: you get the "global" rotation ie: relative to world orientation. + * True: you get the "local" rotation ie: relative to object orientation. + :arg local: boolean + + .. method:: applyForce(force, local=False) + + Sets the game object's force. + + This requires a dynamic object. + + :arg force: force vector. + :type force: 3D Vector + :arg local: + * False: you get the "global" force ie: relative to world orientation. + * True: you get the "local" force ie: relative to object orientation. + :type local: boolean + + .. method:: applyTorque(torque, local=False) + + Sets the game object's torque. + + This requires a dynamic object. + + :arg torque: torque vector. + :type torque: 3D Vector + :arg local: + * False: you get the "global" torque ie: relative to world orientation. + * True: you get the "local" torque ie: relative to object orientation. + :type local: boolean + + .. method:: getLinearVelocity(local=False) + + Gets the game object's linear velocity. + + This method returns the game object's velocity through it's centre of mass, ie no angular velocity component. + + :arg local: + * False: you get the "global" velocity ie: relative to world orientation. + * True: you get the "local" velocity ie: relative to object orientation. + :type local: boolean + :return: the object's linear velocity. + :rtype: list [vx, vy, vz] + + .. method:: setLinearVelocity(velocity, local=False) + + Sets the game object's linear velocity. + + This method sets game object's velocity through it's centre of mass, + ie no angular velocity component. + + This requires a dynamic object. + + :arg velocity: linear velocity vector. + :type velocity: 3D Vector + :arg local: + * False: you get the "global" velocity ie: relative to world orientation. + * True: you get the "local" velocity ie: relative to object orientation. + :type local: boolean + + .. method:: getAngularVelocity(local=False) + + Gets the game object's angular velocity. + + :arg local: + * False: you get the "global" velocity ie: relative to world orientation. + * True: you get the "local" velocity ie: relative to object orientation. + :type local: boolean + :return: the object's angular velocity. + :rtype: list [vx, vy, vz] + + .. method:: setAngularVelocity(velocity, local=False) + + Sets the game object's angular velocity. + + This requires a dynamic object. + + :arg velocity: angular velocity vector. + :type velocity: boolean + :arg local: + * False: you get the "global" velocity ie: relative to world orientation. + * True: you get the "local" velocity ie: relative to object orientation. + + .. method:: getVelocity(point=(0, 0, 0)) + + Gets the game object's velocity at the specified point. + + Gets the game object's velocity at the specified point, including angular + components. + + :arg point: optional point to return the velocity for, in local coordinates. + :type point: 3D Vector + :return: the velocity at the specified point. + :rtype: list [vx, vy, vz] + + .. method:: getReactionForce() + + Gets the game object's reaction force. + + The reaction force is the force applied to this object over the last simulation timestep. + This also includes impulses, eg from collisions. + + :return: the reaction force of this object. + :rtype: list [fx, fy, fz] + + .. note:: This is not implimented at the moment. + + .. method:: applyImpulse(point, impulse) + + Applies an impulse to the game object. + + This will apply the specified impulse to the game object at the specified point. + If point != position, applyImpulse will also change the object's angular momentum. + Otherwise, only linear momentum will change. + + :arg point: the point to apply the impulse to (in world coordinates) + :type point: the point to apply the impulse to (in world coordinates) + + .. method:: suspendDynamics() + + Suspends physics for this object. + + .. method:: restoreDynamics() + + Resumes physics for this object. + + .. note:: The objects linear velocity will be applied from when the dynamics were suspended. + + .. method:: enableRigidBody() + + Enables rigid body physics for this object. + + Rigid body physics allows the object to roll on collisions. + + .. note:: This is not working with bullet physics yet. + + .. method:: disableRigidBody() + + Disables rigid body physics for this object. + + .. note:: This is not working with bullet physics yet. The angular is removed but rigid body physics can still rotate it later. + + .. method:: setParent(parent, compound=True, ghost=True) + + Sets this object's parent. + Control the shape status with the optional compound and ghost parameters: + + In that case you can control if it should be ghost or not: + + :arg parent: new parent object. + :type parent: :class:`KX_GameObject` + :arg compound: whether the shape should be added to the parent compound shape. + + * True: the object shape should be added to the parent compound shape. + * False: the object should keep its individual shape. + + :type compound: boolean + :arg ghost: whether the object should be ghost while parented. + + * True: if the object should be made ghost while parented. + * False: if the object should be solid while parented. + + :type ghost: boolean + + .. note:: if the object type is sensor, it stays ghost regardless of ghost parameter + + .. method:: removeParent() + + Removes this objects parent. + + .. method:: getPhysicsId() + + Returns the user data object associated with this game object's physics controller. + + .. method:: getPropertyNames() + + Gets a list of all property names. + + :return: All property names for this object. + :rtype: list + + .. method:: getDistanceTo(other) + + :arg other: a point or another :class:`KX_GameObject` to measure the distance to. + :type other: :class:`KX_GameObject` or list [x, y, z] + :return: distance to another object or point. + :rtype: float + + .. method:: getVectTo(other) + + Returns the vector and the distance to another object or point. + The vector is normalized unless the distance is 0, in which a zero length vector is returned. + + :arg other: a point or another :class:`KX_GameObject` to get the vector and distance to. + :type other: :class:`KX_GameObject` or list [x, y, z] + :return: (distance, globalVector(3), localVector(3)) + :rtype: 3-tuple (float, 3-tuple (x, y, z), 3-tuple (x, y, z)) + + .. method:: rayCastTo(other, dist, prop) + + Look towards another point/object and find first object hit within dist that matches prop. + + The ray is always casted from the center of the object, ignoring the object itself. + The ray is casted towards the center of another object or an explicit [x, y, z] point. + Use rayCast() if you need to retrieve the hit point + + :arg other: [x, y, z] or object towards which the ray is casted + :type other: :class:`KX_GameObject` or 3-tuple + :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other + :type dist: float + :arg prop: property name that object must have; can be omitted => detect any object + :type prop: string + :return: the first object hit or None if no object or object does not match prop + :rtype: :class:`KX_GameObject` + + .. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly) + + Look from a point/object to another point/object and find first object hit within dist that matches prop. + if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit. + if poly is 1, returns a 4-tuple with in addition a :class:`KX_PolyProxy` as 4th element. + if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element. + + .. code-block:: python + + # shoot along the axis gun-gunAim (gunAim should be collision-free) + obj, point, normal = gun.rayCast(gunAim, None, 50) + if obj: + # do something + pass + + The face paremeter determines the orientation of the normal. + + * 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside) + * 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect) + + The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray. + The prop and xray parameters interact as follow. + + * prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray. + * prop off, xray on : idem. + * prop on, xray off: return closest hit if it matches prop, no hit otherwise. + * prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray. + + The :class:`KX_PolyProxy` 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray. + If there is no hit or the hit object is not a static mesh, None is returned as 4th element. + + The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects. + + :arg objto: [x, y, z] or object to which the ray is casted + :type objto: :class:`KX_GameObject` or 3-tuple + :arg objfrom: [x, y, z] or object from which the ray is casted; None or omitted => use self object center + :type objfrom: :class:`KX_GameObject` or 3-tuple or None + :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to + :type dist: float + :arg prop: property name that object must have; can be omitted or "" => detect any object + :type prop: string + :arg face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin + :type face: integer + :arg xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object + :type xray: integer + :arg poly: polygon option: 0, 1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit. + + * 0 or omitted: return value is a 3-tuple (object, hitpoint, hitnormal) or (None, None, None) if no hit + * 1: return value is a 4-tuple and the 4th element is a :class:`KX_PolyProxy` or None if no hit or the object doesn't use a mesh collision shape. + * 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping. + + :type poly: integer + :return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv). + + * object, hitpoint and hitnormal are None if no hit. + * polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None + * hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None + + :rtype: + + * 3-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz)) + * or 4-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`) + * or 5-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`, 2-tuple (u, v)) + + .. note:: The ray ignores the object on which the method is called. It is casted from/to object center or explicit [x, y, z] points. + + .. method:: setCollisionMargin(margin) + + Set the objects collision margin. + + .. note:: If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError. + + :arg margin: the collision margin distance in blender units. + :type margin: float + + .. method:: sendMessage(subject, body="", to="") + + Sends a message. + + :arg subject: The subject of the message + :type subject: string + :arg body: The body of the message (optional) + :type body: string + :arg to: The name of the object to send the message to (optional) + :type to: string + + .. method:: reinstancePhysicsMesh(gameObject, meshObject) + + Updates the physics system with the changed mesh. + + If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object. + + :arg gameObject: optional argument, set the physics shape from this gameObjets mesh. + :type gameObject: string, :class:`KX_GameObject` or None + :arg meshObject: optional argument, set the physics shape from this mesh. + :type meshObject: string, :class:`MeshProxy` or None + + .. note:: if this object has instances the other instances will be updated too. + .. note:: the gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf). + .. warning:: only triangle mesh type objects are supported currently (not convex hull) + .. warning:: if the object is a part of a combound object it will fail (parent or child) + .. warning:: rebuilding the physics mesh can be slow, running many times per second will give a performance hit. + + :return: True if reinstance succeeded, False if it failed. + :rtype: boolean + + .. method:: get(key, default=None) + + Return the value matching key, or the default value if its not found. + :return: The key value or a default. + +.. class:: KX_IpoActuator(SCA_IActuator) + + IPO actuator activates an animation. + + .. attribute:: frameStart + + Start frame. **type** float + + .. attribute:: frameEnd + + End frame. **type** float + + .. attribute:: propName + + Use this property to define the Ipo position **type** string + + .. attribute:: framePropName + + Assign this property this action current frame number **type** string + + .. attribute:: mode + + Play mode for the ipo. (In GameLogic.KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND, KX_IPOACT_FROM_PROP) **type** integer + + .. attribute:: useIpoAsForce + + Apply Ipo as a global or local force depending on the local option (dynamic objects only) **type** bool + + .. attribute:: useIpoAdd + + Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag **type** bool + + .. attribute:: useIpoLocal + + Let the ipo acts in local coordinates, used in Force and Add mode. **type** bool + + .. attribute:: useChildren + + Update IPO on all children Objects as well **type** bool + +.. class:: KX_LightObject(KX_GameObject) + + A Light object. + + .. code-block:: python + + # Turn on a red alert light. + import bge + + co = bge.logic.getCurrentController() + light = co.owner + + light.energy = 1.0 + light.colour = [1.0, 0.0, 0.0] + + .. data:: SPOT + + A spot light source. See attribute :data:`type` + + .. data:: SUN + + A point light source with no attenuation. See attribute :data:`type` + + .. data:: NORMAL + + A point light source. See attribute :data:`type` + + .. attribute:: type + + The type of light - must be SPOT, SUN or NORMAL + + .. attribute:: layer + + The layer mask that this light affects object on. **type** bitfield + + .. attribute:: energy + + The brightness of this light. **type** float + + .. attribute:: distance + + The maximum distance this light can illuminate. (SPOT and NORMAL lights only) **type** float + + .. attribute:: colour + + The colour of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0]. **type** list [r, g, b] + + .. attribute:: color + + Synonym for colour. + + .. attribute:: lin_attenuation + + The linear component of this light's attenuation. (SPOT and NORMAL lights only) **type** float + + .. attribute:: quad_attenuation + + The quadratic component of this light's attenuation (SPOT and NORMAL lights only) **type** float + + .. attribute:: spotsize + + The cone angle of the spot light, in degrees (SPOT lights only). **type** float in [0 - 180]. + + .. attribute:: spotblend + + Specifies the intensity distribution of the spot light (SPOT lights only). **type** float in [0 - 1] + + .. note:: Higher values result in a more focused light source. + +.. class:: KX_MeshProxy(SCA_IObject) + + A mesh object. + + You can only change the vertex properties of a mesh object, not the mesh topology. + + To use mesh objects effectively, you should know a bit about how the game engine handles them. + + #. Mesh Objects are converted from Blender at scene load. + #. The Converter groups polygons by Material. This means they can be sent to the renderer efficiently. A material holds: + + #. The texture. + #. The Blender material. + #. The Tile properties + #. The face properties - (From the "Texture Face" panel) + #. Transparency & z sorting + #. Light layer + #. Polygon shape (triangle/quad) + #. Game Object + + #. Verticies will be split by face if necessary. Verticies can only be shared between faces if: + + #. They are at the same position + #. UV coordinates are the same + #. Their normals are the same (both polygons are "Set Smooth") + #. They are the same colour, for example: a cube has 24 verticies: 6 faces with 4 verticies per face. + + The correct method of iterating over every :class:`KX_VertexProxy` in a game object + + .. code-block:: python + + import GameLogic + + co = GameLogic.getCurrentController() + obj = co.owner + + m_i = 0 + mesh = obj.getMesh(m_i) # There can be more than one mesh... + while mesh != None: + for mat in range(mesh.getNumMaterials()): + for v_index in range(mesh.getVertexArrayLength(mat)): + vertex = mesh.getVertex(mat, v_index) + # Do something with vertex here... + # ... eg: colour the vertex red. + vertex.colour = [1.0, 0.0, 0.0, 1.0] + m_i += 1 + mesh = obj.getMesh(m_i) + + .. attribute:: materials + + **type** list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types + + .. attribute:: numPolygons + + **type** integer + + .. attribute:: numMaterials + + **type** integer + + .. method:: getNumMaterials() + + :return: number of materials associated with this object + :rtype: integer + + .. method:: getMaterialName(matid) + + Gets the name of the specified material. + + :arg matid: the specified material. + :type matid: integer + :return: the attached material name. + :rtype: string + + .. method:: getTextureName(matid) + + Gets the name of the specified material's texture. + + :arg matid: the specified material + :type matid: integer + :return: the attached material's texture name. + :rtype: string + + .. method:: getVertexArrayLength(matid) + + Gets the length of the vertex array associated with the specified material. + + There is one vertex array for each material. + + :arg matid: the specified material + :type matid: integer + :return: the number of verticies in the vertex array. + :rtype: integer + + .. method:: getVertex(matid, index) + + Gets the specified vertex from the mesh object. + + :arg matid: the specified material + :type matid: integer + :arg index: the index into the vertex array. + :type index: integer + :return: a vertex object. + :rtype: :class:`KX_VertexProxy` + + .. method:: getNumPolygons() + + :return: The number of polygon in the mesh. + :rtype: integer + + .. method:: getPolygon(index) + + Gets the specified polygon from the mesh. + + :arg index: polygon number + :type index: integer + :return: a polygon object. + :rtype: :class:`PolyProxy` + +.. class:: SCA_MouseSensor(SCA_ISensor) + + Mouse Sensor logic brick. + + Properties: + + .. attribute:: position + + current [x, y] coordinates of the mouse, in frame coordinates (pixels) **type** [integer, interger] + + .. attribute:: mode + + sensor mode. **type** integer + + * KX_MOUSESENSORMODE_LEFTBUTTON(1) + * KX_MOUSESENSORMODE_MIDDLEBUTTON(2) + * KX_MOUSESENSORMODE_RIGHTBUTTON(3) + * KX_MOUSESENSORMODE_WHEELUP(4) + * KX_MOUSESENSORMODE_WHEELDOWN(5) + * KX_MOUSESENSORMODE_MOVEMENT(6) + + .. method:: getButtonStatus(button) + + Get the mouse button status. + + :arg button: value in GameLogic members KX_MOUSE_BUT_LEFT, KX_MOUSE_BUT_MIDDLE, KX_MOUSE_BUT_RIGHT + :type button: integer + :return: value in GameLogic members KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED + :rtype: integer + +.. class:: KX_MouseFocusSensor(SCA_MouseSensor) + + The mouse focus sensor detects when the mouse is over the current game object. + + The mouse focus sensor works by transforming the mouse coordinates from 2d device + space to 3d space then raycasting away from the camera. + + .. attribute:: raySource + + The worldspace source of the ray (the view position) **type** list (vector of 3 floats) + + .. attribute:: rayTarget + + The worldspace target of the ray. **type** list (vector of 3 floats) + + .. attribute:: rayDirection + + The :data:`rayTarget` - :class:`raySource` normalized. **type** list (normalized vector of 3 floats) + + .. attribute:: hitObject + + the last object the mouse was over. **type** :class:`KX_GameObject` or None + + .. attribute:: hitPosition + + The worldspace position of the ray intersecton. **type** list (vector of 3 floats) + + .. attribute:: hitNormal + + the worldspace normal from the face at point of intersection. **type** list (normalized vector of 3 floats) + + .. attribute:: hitUV + + the UV coordinates at the point of intersection. **type** list (vector of 2 floats) + + If the object has no UV mapping, it returns [0, 0]. + + The UV coordinates are not normalized, they can be < 0 or > 1 depending on the UV mapping. + + .. attribute:: usePulseFocus + + When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set) **type** bool + +.. class:: KX_TouchSensor(SCA_ISensor) + + Touch sensor detects collisions between objects. + + .. attribute:: propName + + The property or material to collide with. **type** string + + .. attribute:: useMaterial + + Determines if the sensor is looking for a property or material. KX_True = Find material; KX_False = Find property. **type** boolean + + .. attribute:: usePulseCollision + + When enabled, changes to the set of colliding objects generate a pulse. **type** bool + + .. attribute:: hitObject + + The last collided object. (read-only) **type** :class:`KX_GameObject` or None + + .. attribute:: hitObjectList + + A list of colliding objects. (read-only) **type** :class:`CListValue` of :class:`KX_GameObject` + +.. class:: KX_NearSensor(KX_TouchSensor) + + A near sensor is a specialised form of touch sensor. + + .. attribute:: distance + + The near sensor activates when an object is within this distance. **type** float + + .. attribute:: resetDistance + + The near sensor deactivates when the object exceeds this distance. **type** float + +.. class:: KX_NetworkMessageActuator(SCA_IActuator) + + Message Actuator + + .. attribute:: propName + + Messages will only be sent to objects with the given property name. **type** string + + .. attribute:: subject + + The subject field of the message. **type** string + + .. attribute:: body + + The body of the message. **type** string + + .. attribute:: usePropBody + + Send a property instead of a regular body message. **type** boolean + +.. class:: KX_NetworkMessageSensor(SCA_ISensor) + + The Message Sensor logic brick. + + Currently only loopback (local) networks are supported. + + .. attribute:: subject + + The subject the sensor is looking for. **type** string + + .. attribute:: frameMessageCount + + The number of messages received since the last frame. (read-only). **type** integer + + .. attribute:: subjects + + The list of message subjects received. (read-only). **type** list of strings + + .. attribute:: bodies + + The list of message bodies received. (read-only) **type** list of strings + +.. class:: KX_ObjectActuator(SCA_IActuator) + + The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement, + velocity, or angular velocity to an object. + Servo control allows to regulate force to achieve a certain speed target. + + .. attribute:: force + + The force applied by the actuator **type** list [x, y, z] + + .. attribute:: useLocalForce + + A flag specifying if the force is local **type** bool + + .. attribute:: torque + + The torque applied by the actuator **type** list [x, y, z] + + .. attribute:: useLocalTorque + + A flag specifying if the torque is local **type** bool + + .. attribute:: dLoc + + The displacement vector applied by the actuator **type** list [x, y, z] + + .. attribute:: useLocalDLoc + + A flag specifying if the dLoc is local **type** bool + + .. attribute:: dRot + + The angular displacement vector applied by the actuator + + .. note:: Since the displacement is applied every frame, you must adjust the displacement based on the frame rate, or you game experience will depend on the player's computer speed. **type** list [x, y, z] + + .. attribute:: useLocalDRot + + A flag specifying if the dRot is local **type** bool + + .. attribute:: linV + + The linear velocity applied by the actuator **type** list [x, y, z] + + .. attribute:: useLocalLinV + + A flag specifying if the linear velocity is local. + + .. note:: This is the target speed for servo controllers **type** bool + + .. attribute:: angV + + The angular velocity applied by the actuator **type** list [x, y, z] + + .. attribute:: useLocalAngV + + A flag specifying if the angular velocity is local **type** bool + + .. attribute:: damping + + The damping parameter of the servo controller **type** short + + .. attribute:: forceLimitX + + The min/max force limit along the X axis and activates or deactivates the limits in the servo controller **type** list [min(float), max(float), bool] + + .. attribute:: forceLimitY + + The min/max force limit along the Y axis and activates or deactivates the limits in the servo controller **type** list [min(float), max(float), bool] + + .. attribute:: forceLimitZ + + The min/max force limit along the Z axis and activates or deactivates the limits in the servo controller **type** list [min(float), max(float), bool] + + .. attribute:: pid + + The PID coefficients of the servo controller **type** list of floats [proportional, integral, derivate] + + .. attribute:: reference + + The object that is used as reference to compute the velocity for the servo controller. **type** :class:`KX_GameObject` or None + +.. class:: KX_ParentActuator(SCA_IActuator) + + The parent actuator can set or remove an objects parent object. + + .. attribute:: object + + the object this actuator sets the parent too. **type** :class:`KX_GameObject` or None + + .. attribute:: mode + + The mode of this actuator **type** integer from 0 to 1. + + .. attribute:: compound + + Whether the object shape should be added to the parent compound shape when parenting. + + Effective only if the parent is already a compound shape **type** bool + + .. attribute:: ghost + + whether the object should be made ghost when parenting + Effective only if the shape is not added to the parent compound shape **type** bool + +.. class:: KX_PhysicsObjectWrapper(PyObjectPlus) + + KX_PhysicsObjectWrapper + + .. method:: setActive(active) + + Set the object to be active. + + :arg active: set to True to be active + :type active: bool + + .. method:: setAngularVelocity(x, y, z, local) + + Set the angular velocity of the object. + + :arg x: angular velocity for the x-axis + :type x: float + + :arg y: angular velocity for the y-axis + :type y: float + + :arg z: angular velocity for the z-axis + :type z: float + + :arg local: set to True for local axis + :type local: bool + + .. method:: setLinearVelocity(x, y, z, local) + + Set the linear velocity of the object. + + :arg x: linear velocity for the x-axis + :type x: float + + :arg y: linear velocity for the y-axis + :type y: float + + :arg z: linear velocity for the z-axis + :type z: float + + :arg local: set to True for local axis + :type local: bool + +.. class:: KX_PolyProxy(SCA_IObject) + + A polygon holds the index of the vertex forming the poylgon. + + Note: + The polygon attributes are read-only, you need to retrieve the vertex proxy if you want + to change the vertex settings. + + .. attribute:: matname + + The name of polygon material, empty if no material. **type** string + + .. attribute:: material + + The material of the polygon **type** :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial` + + .. attribute:: texture + + The texture name of the polygon. **type** string + + .. attribute:: matid + + The material index of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer + + .. attribute:: v1 + + vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer + + .. attribute:: v2 + + vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer + + .. attribute:: v3 + + vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer + + .. attribute:: v4 + + vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex + use this to retrieve vertex proxy from mesh proxy **type** integer + + .. attribute:: visible + + visible state of the polygon: 1=visible, 0=invisible **type** integer + + .. attribute:: collide + + collide state of the polygon: 1=receives collision, 0=collision free. **type** integer + + .. method:: getMaterialName() + + Returns the polygon material name with MA prefix + + :return: material name + :rtype: string + + .. method:: getMaterial() + + :return: The polygon material + :rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial` + + .. method:: getTextureName() + + :return: The texture name + :rtype: string + + .. method:: getMaterialIndex() + + Returns the material bucket index of the polygon. + This index and the ones returned by getVertexIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`. + + :return: the material index in the mesh + :rtype: integer + + .. method:: getNumVertex() + + Returns the number of vertex of the polygon. + + :return: number of vertex, 3 or 4. + :rtype: integer + + .. method:: isVisible() + + Returns whether the polygon is visible or not + + :return: 0=invisible, 1=visible + :rtype: boolean + + .. method:: isCollider() + + Returns whether the polygon is receives collision or not + + :return: 0=collision free, 1=receives collision + :rtype: integer + + .. method:: getVertexIndex(vertex) + + Returns the mesh vertex index of a polygon vertex + This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`. + + :arg vertex: index of the vertex in the polygon: 0->3 + :arg vertex: integer + :return: mesh vertex index + :rtype: integer + + .. method:: getMesh() + + Returns a mesh proxy + + :return: mesh proxy + :rtype: :class:`MeshProxy` + +.. class:: KX_PolygonMaterial + + This is the interface to materials in the game engine. + + Materials define the render state to be applied to mesh objects. + + .. warning:: Some of the methods/variables are CObjects. If you mix these up, you will crash blender. + + This example requires + + * PyOpenGL + * GLEWPy + + .. code-block:: python + + import GameLogic + import OpenGL + from OpenGL.GL import * + from OpenGL.GLU import * + import glew + from glew import * + + glewInit() + + vertex_shader = """ + + void main(void) + { + gl_Position = ftransform(); + } + """ + + fragment_shader =""" + + void main(void) + { + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); + } + """ + + class MyMaterial: + def __init__(self): + self.pass_no = 0 + # Create a shader + self.m_program = glCreateProgramObjectARB() + # Compile the vertex shader + self.shader(GL_VERTEX_SHADER_ARB, (vertex_shader)) + # Compile the fragment shader + self.shader(GL_FRAGMENT_SHADER_ARB, (fragment_shader)) + # Link the shaders together + self.link() + + def PrintInfoLog(self, tag, object): + """ + PrintInfoLog prints the GLSL compiler log + """ + print "Tag: def PrintGLError(self, tag = ""): + + def PrintGLError(self, tag = ""): + """ + Prints the current GL error status + """ + if len(tag): + print tag + err = glGetError() + if err != GL_NO_ERROR: + print "GL Error: %s\\n"%(gluErrorString(err)) + + def shader(self, type, shaders): + """ + shader compiles a GLSL shader and attaches it to the current + program. + + type should be either GL_VERTEX_SHADER_ARB or GL_FRAGMENT_SHADER_ARB + shaders should be a sequence of shader source to compile. + """ + # Create a shader object + shader_object = glCreateShaderObjectARB(type) + + # Add the source code + glShaderSourceARB(shader_object, len(shaders), shaders) + + # Compile the shader + glCompileShaderARB(shader_object) + + # Print the compiler log + self.PrintInfoLog("vertex shader", shader_object) + + # Check if compiled, and attach if it did + compiled = glGetObjectParameterivARB(shader_object, GL_OBJECT_COMPILE_STATUS_ARB) + if compiled: + glAttachObjectARB(self.m_program, shader_object) + + # Delete the object (glAttachObjectARB makes a copy) + glDeleteObjectARB(shader_object) + + # print the gl error log + self.PrintGLError() + + def link(self): + """ + Links the shaders together. + """ + # clear error indicator + glGetError() + + glLinkProgramARB(self.m_program) + + self.PrintInfoLog("link", self.m_program) + + linked = glGetObjectParameterivARB(self.m_program, GL_OBJECT_LINK_STATUS_ARB) + if not linked: + print "Shader failed to link" + return + + glValidateProgramARB(self.m_program) + valid = glGetObjectParameterivARB(self.m_program, GL_OBJECT_VALIDATE_STATUS_ARB) + if not valid: + print "Shader failed to validate" + return + + def activate(self, rasty, cachingInfo, mat): + self.pass_no+=1 + if (self.pass_no == 1): + glDisable(GL_COLOR_MATERIAL) + glUseProgramObjectARB(self.m_program) + return True + + glEnable(GL_COLOR_MATERIAL) + glUseProgramObjectARB(0) + self.pass_no = 0 + return False + + obj = GameLogic.getCurrentController().owner + + mesh = obj.meshes[0] + + for mat in mesh.materials: + mat.setCustomMaterial(MyMaterial()) + print mat.texture + + .. attribute:: texture + + Texture name **type** string (read-only) + + .. attribute:: gl_texture + + OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture) **type** integer (read-only) + + .. attribute:: material + + Material name **type** string (read-only) + + .. attribute:: tface + + Texture face properties **type** CObject (read-only) + + .. attribute:: tile + + Texture is tiling **type** boolean + + .. attribute:: tilexrep + + Number of tile repetitions in x direction. **type** integer + + .. attribute:: tileyrep + + Number of tile repetitions in y direction. **type** integer + + .. attribute:: drawingmode + + Drawing mode for the material. + - 2 (drawingmode & 4) Textured + - 4 (drawingmode & 16) Light + - 14 (drawingmode & 16384) 3d Polygon Text **type** bitfield + + .. attribute:: transparent + + This material is transparent. All meshes with this + material will be rendered after non transparent meshes from back + to front. **type** boolean + + .. attribute:: zsort + + Transparent polygons in meshes with this material will be sorted back to + front before rendering. + Non-Transparent polygons will be sorted front to back before rendering. **type** boolean + + .. attribute:: lightlayer + + Light layers this material affects. **type** bitfield. + + .. attribute:: triangle + + Mesh data with this material is triangles. It's probably not safe to change this. **type** boolean + + .. attribute:: diffuse + + The diffuse colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0] **type** list [r, g, b] + + .. attribute:: specular + + The specular colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0] **type** list [r, g, b] + + .. attribute:: shininess + + The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0 **type** float + + .. attribute:: specularity + + The amount of specular of the material. 0.0 <= specularity <= 1.0 **type** float + + .. method:: updateTexture(tface, rasty) + + Updates a realtime animation. + + :arg tface: Texture face (eg mat.tface) + :type tface: CObject + :arg rasty: Rasterizer + :type rasty: CObject + + .. method:: setTexture(tface) + + Sets texture render state. + + .. code-block:: python + + mat.setTexture(mat.tface) + + :arg tface: Texture face + :type tface: CObject + + .. method:: activate(rasty, cachingInfo) + + Sets material parameters for this object for rendering. + + Material Parameters set: + + #. Texture + #. Backface culling + #. Line drawing + #. Specular Colour + #. Shininess + #. Diffuse Colour + #. Polygon Offset. + + :arg rasty: Rasterizer instance. + :type rasty: CObject + :arg cachingInfo: Material cache instance. + :type cachingInfo: CObject + + .. method:: setCustomMaterial(material) + + Sets the material state setup object. + + Using this method, you can extend or completely replace the gameengine material + to do your own advanced multipass effects. + + Use this method to register your material class. Instead of the normal material, + your class's activate method will be called just before rendering the mesh. + This should setup the texture, material, and any other state you would like. + It should return True to render the mesh, or False if you are finished. You should + clean up any state Blender does not set before returning False. + + Activate Method Definition:: + `def activate(self, rasty, cachingInfo, material):` + + .. code-block:: python + + class PyMaterial: + def __init__(self): + self.pass_no = -1 + + def activate(self, rasty, cachingInfo, material): + # Activate the material here. + # + # The activate method will be called until it returns False. + # Every time the activate method returns True the mesh will + # be rendered. + # + # rasty is a CObject for passing to material.updateTexture() + # and material.activate() + # cachingInfo is a CObject for passing to material.activate() + # material is the KX_PolygonMaterial instance this material + # was added to + + # default material properties: + self.pass_no += 1 + if self.pass_no == 0: + material.activate(rasty, cachingInfo) + # Return True to do this pass + return True + + # clean up and return False to finish. + self.pass_no = -1 + return False + + # Create a new Python Material and pass it to the renderer. + mat.setCustomMaterial(PyMaterial()) + + :arg material: The material object. + :type material: instance + +.. class:: KX_RadarSensor(KX_NearSensor) + + Radar sensor is a near sensor with a conical sensor object. + + .. attribute:: coneOrigin + + The origin of the cone with which to test. The origin is in the middle of the cone. (read-only) **type** list of floats [x, y, z] + + .. attribute:: coneTarget + + The center of the bottom face of the cone with which to test. (read-only) **type** list of floats [x, y, z] + + .. attribute:: distance + + The height of the cone with which to test. **type** float + + .. attribute:: angle + + The angle of the cone (in degrees) with which to test. **type** float from 0 to 360 + + .. attribute:: axis + + The axis on which the radar cone is cast **type** integer from 0 to 5 + + KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z, + KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z + + .. method:: getConeHeight() + + :return: The height of the cone with which to test. + :rtype: float + +.. class:: KX_RaySensor(SCA_ISensor) + + A ray sensor detects the first object in a given direction. + + .. attribute:: propName + + The property the ray is looking for. **type** string + + .. attribute:: range + + The distance of the ray. **type** float + + .. attribute:: useMaterial + + Whether or not to look for a material (false = property) **type** boolean + + .. attribute:: useXRay + + Whether or not to use XRay. **type** boolean + + .. attribute:: hitObject + + The game object that was hit by the ray. (read-only) **type** :class:`KX_GameObject` + + .. attribute:: hitPosition + + The position (in worldcoordinates) where the object was hit by the ray. (read-only) **type** list [x, y, z] + + .. attribute:: hitNormal + + The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (read-only) **type** list [x, y, z] + + .. attribute:: rayDirection + + The direction from the ray (in worldcoordinates). (read-only) **type** list [x, y, z] + + .. attribute:: axis + + The axis the ray is pointing on. **type** integer from 0 to 5 + + * KX_RAY_AXIS_POS_X + * KX_RAY_AXIS_POS_Y + * KX_RAY_AXIS_POS_Z + * KX_RAY_AXIS_NEG_X + * KX_RAY_AXIS_NEG_Y + * KX_RAY_AXIS_NEG_Z + +.. class:: KX_SCA_AddObjectActuator(SCA_IActuator) + + Edit Object Actuator (in Add Object Mode) + + .. attribute:: object + + the object this actuator adds. **type** :class:`KX_GameObject` or None + + .. attribute:: objectLastCreated + + the last added object from this actuator (read-only). **type** :class:`KX_GameObject` or None + + .. attribute:: time + + the lifetime of added objects, in frames. Set to 0 to disable automatic deletion. **type** integer + + .. attribute:: linearVelocity + + the initial linear velocity of added objects. **type** list [vx, vy, vz] + + .. attribute:: angularVelocity + + the initial angular velocity of added objects. **type** list [vx, vy, vz] + + .. warning:: An Add Object actuator will be ignored if at game start, the linked object doesn't exist + (or is empty) or the linked object is in an active layer. + + This will genereate a warning in the console: + + ``Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer)`` + + .. method:: instantAddObject() + + :return: The last object created by this actuator. The object can then be accessed from :data:`objectLastCreated`. + :rtype: None + +.. class:: KX_SCA_DynamicActuator(SCA_IActuator) + + Dynamic Actuator. + + .. attribute:: mode + + **type** integer + + the type of operation of the actuator, 0-4 + + * KX_DYN_RESTORE_DYNAMICS(0) + * KX_DYN_DISABLE_DYNAMICS(1) + * KX_DYN_ENABLE_RIGID_BODY(2) + * KX_DYN_DISABLE_RIGID_BODY(3) + * KX_DYN_SET_MASS(4) + + .. attribute:: mass + + the mass value for the KX_DYN_SET_MASS operation **type** float + +.. class:: KX_SCA_EndObjectActuator(SCA_IActuator) + + Edit Object Actuator (in End Object mode) + + This actuator has no python methods. + +.. class:: KX_SCA_ReplaceMeshActuator(SCA_IActuator) + + Edit Object actuator, in Replace Mesh mode. + + .. code-block:: python + + # Level-of-detail + # Switch a game object's mesh based on its depth in the camera view. + # +----------+ +-----------+ +-------------------------------------+ + # | Always +-----+ Python +-----+ Edit Object (Replace Mesh) LOD.Mesh | + # +----------+ +-----------+ +-------------------------------------+ + import GameLogic + + # List detail meshes here + # Mesh (name, near, far) + # Meshes overlap so that they don't 'pop' when on the edge of the distance. + meshes = ((".Hi", 0.0, -20.0), + (".Med", -15.0, -50.0), + (".Lo", -40.0, -100.0) + ) + + co = GameLogic.getCurrentController() + obj = co.owner + act = co.actuators["LOD." + obj.name] + cam = GameLogic.getCurrentScene().active_camera + + def Depth(pos, plane): + return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3] + + # Depth is negative and decreasing further from the camera + depth = Depth(obj.position, cam.world_to_camera[2]) + + newmesh = None + curmesh = None + # Find the lowest detail mesh for depth + for mesh in meshes: + if depth < mesh[1] and depth > mesh[2]: + newmesh = mesh + if "ME" + obj.name + mesh[0] == act.getMesh(): + curmesh = mesh + + if newmesh != None and "ME" + obj.name + newmesh[0] != act.getMesh(): + # The mesh is a different mesh - switch it. + # Check the current mesh is not a better fit. + if curmesh == None or curmesh[1] < depth or curmesh[2] > depth: + act.mesh = obj.getName() + newmesh[0] + GameLogic.addActiveActuator(act, True) + + .. warning:: Replace mesh actuators will be ignored if at game start, the named mesh doesn't exist. + + This will generate a warning in the console + + ``Error: GameObject 'Name' ReplaceMeshActuator 'ActuatorName' without object`` + + .. attribute:: mesh + + :class:`MeshProxy` or the name of the mesh that will replace the current one. + + Set to None to disable actuator **type** :class:`MeshProxy` or None if no mesh is set + + .. attribute:: useDisplayMesh + + when true the displayed mesh is replaced. **type** boolean + + .. attribute:: usePhysicsMesh + + when true the physics mesh is replaced. **type** boolean + + .. method:: instantReplaceMesh() + + Immediately replace mesh without delay. + +.. class:: KX_Scene(PyObjectPlus) + + An active scene that gives access to objects, cameras, lights and scene attributes. + + The activity culling stuff is supposed to disable logic bricks when their owner gets too far + from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows + what it does! + + .. code-block:: python + + import GameLogic + + # get the scene + scene = GameLogic.getCurrentScene() + + # print all the objects in the scene + for obj in scene.objects: + print obj.name + + # get an object named 'Cube' + obj = scene.objects["Cube"] + + # get the first object in the scene. + obj = scene.objects[0] + + .. code-block:: python + + # Get the depth of an object in the camera view. + import GameLogic + + obj = GameLogic.getCurrentController().owner + cam = GameLogic.getCurrentScene().active_camera + + # Depth is negative and decreasing further from the camera + depth = obj.position[0]*cam.world_to_camera[2][0] + obj.position[1]*cam.world_to_camera[2][1] + obj.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3] + + @bug: All attributes are read only at the moment. + + .. attribute:: name + + The scene's name, (read-only). **type** string + + .. attribute:: objects + + A list of objects in the scene, (read-only). **type** :class:`CListValue` of :class:`KX_GameObject` + + .. attribute:: objectsInactive + + A list of objects on background layers (used for the addObject actuator), (read-only). **type** :class:`CListValue` of :class:`KX_GameObject` + + .. attribute:: lights + + A list of lights in the scene, (read-only). **type** :class:`CListValue` of :class:`KX_LightObject` + + .. attribute:: cameras + + A list of cameras in the scene, (read-only). **type** :class:`CListValue` of :class:`KX_Camera` + + .. attribute:: active_camera + + The current active camera. + + .. note:: this can be set directly from python to avoid using the :class:`KX_SceneActuator`. **type** :class:`KX_Camera` + + .. attribute:: suspended + + True if the scene is suspended, (read-only). **type** boolean + + .. attribute:: activity_culling + + True if the scene is activity culling **type** boolean + + .. attribute:: activity_culling_radius + + The distance outside which to do activity culling. Measured in manhattan distance. **type** float + + .. attribute:: dbvt_culling + + True when Dynamic Bounding box Volume Tree is set (read-only). **type** bool + + .. attribute:: pre_draw + + A list of callables to be run before the render step. **type** list + + .. attribute:: post_draw + + A list of callables to be run after the render step. **type** list + + .. method:: addObject(object, other, time=0) + + Adds an object to the scene like the Add Object Actuator would. + + :arg object: The object to add + :type object: :class:`KX_GameObject` or string + :arg other: The object's center to use when adding the object + :type other: :class:`KX_GameObject` or string + :arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever. + :type time: integer + :return: The newly added object. + :rtype: :class:`KX_GameObject` + + .. method:: end() + + Removes the scene from the game. + + .. method:: restart() + + Restarts the scene. + + .. method:: replace(scene) + + Replaces this scene with another one. + + :arg scene: The name of the scene to replace this scene with. + :type scene: string + + .. method:: suspend() + + Suspends this scene. + + .. method:: resume() + + Resume this scene. + + .. method:: get(key, default=None) + + Return the value matching key, or the default value if its not found. + :return: The key value or a default. + +.. class:: KX_SceneActuator(SCA_IActuator) + + Scene Actuator logic brick. + + .. warning:: Scene actuators that use a scene name will be ignored if at game start, the named scene doesn't exist or is empty + + This will generate a warning in the console: + + ``Error: GameObject 'Name' has a SceneActuator 'ActuatorName' (SetScene) without scene`` + + .. attribute:: scene + + the name of the scene to change to/overlay/underlay/remove/suspend/resume **type** string. + + .. attribute:: camera + + the camera to change to. + + .. note:: When setting the attribute, you can use either a :class:`KX_Camera` or the name of the camera. **type** :class:`KX_Camera` on read, string or :class:`KX_Camera` on write + + .. attribute:: useRestart + + Set flag to True to restart the sene **type** bool + + .. attribute:: mode + + The mode of the actuator **type** integer from 0 to 5. + +.. class:: KX_SoundActuator(SCA_IActuator) + + Sound Actuator. + + The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not requirethe actuator to be activated - they act instantly provided that the actuator has been activated once at least. + + .. attribute:: fileName + + The filename of the sound this actuator plays. **type** string + + .. attribute:: volume + + The volume (gain) of the sound. **type** float + + .. attribute:: pitch + + The pitch of the sound. **type** float + + .. attribute:: rollOffFactor + + The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away. **type** float + + .. attribute:: looping + + The loop mode of the actuator. **type** integer + + .. attribute:: position + + The position of the sound as a list: [x, y, z]. **type** float array + + .. attribute:: velocity + + The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z]. **type** float array + + .. attribute:: orientation + + The orientation of the sound. When setting the orientation you can also use quaternion [float, float, float, float] or euler angles [float, float, float] **type** 3x3 matrix [[float]] + + .. attribute:: mode + + The operation mode of the actuator. **type** integer + + You can use one of the following constants: + * KX_SOUNDACT_PLAYSTOP (1) + * KX_SOUNDACT_PLAYEND (2) + * KX_SOUNDACT_LOOPSTOP (3) + * KX_SOUNDACT_LOOPEND (4) + * KX_SOUNDACT_LOOPBIDIRECTIONAL (5) + * KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP (6) + +.. class:: KX_StateActuator(SCA_IActuator) + + State actuator changes the state mask of parent object. + + Property: + + .. attribute:: operation + + type of bit operation to be applied on object state mask. + + You can use one of the following constant: + + * KX_STATE_OP_CPY (0) : Copy state mask + * KX_STATE_OP_SET (1) : Add bits to state mask + * KX_STATE_OP_CLR (2) : Substract bits to state mask + * KX_STATE_OP_NEG (3) : Invert bits to state mask **type** integer + + .. attribute:: mask + + value that defines the bits that will be modified by the operation. + The bits that are 1 in the mask will be updated in the object state, + the bits that are 0 are will be left unmodified expect for the Copy operation + which copies the mask to the object state **type** integer + +.. class:: KX_TrackToActuator(SCA_IActuator) + + Edit Object actuator in Track To mode. + + .. warning:: Track To Actuators will be ignored if at game start, the + object to track to is invalid. + + This will generate a warning in the console: + + ``Error: GameObject 'Name' no object in EditObjectActuator 'ActuatorName'`` + + .. attribute:: object + + the object this actuator tracks. **type** :class:`KX_GameObject` or None + + .. attribute:: time + + the time in frames with which to delay the tracking motion **type** integer + + .. attribute:: use3D + + the tracking motion to use 3D **type** boolean + +.. class:: KX_VehicleWrapper(PyObjectPlus) + + KX_VehicleWrapper + + TODO - description + + .. method:: addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering) + + Add a wheel to the vehicle + + :arg wheel: The object to use as a wheel. + :type wheel: :class:`KX_GameObject` or a KX_GameObject name + :arg attachPos: The position that this wheel will attach to. + :type attachPos: vector of 3 floats + :arg attachDir: The direction this wheel points. + :type attachDir: vector of 3 floats + :arg axleDir: The direction of this wheels axle. + :type axleDir: vector of 3 floats + :arg suspensionRestLength: TODO - Description + :type suspensionRestLength: float + :arg wheelRadius: The size of the wheel. + :type wheelRadius: float + + .. method:: applyBraking(force, wheelIndex) + + Apply a braking force to the specified wheel + + :arg force: the brake force + :type force: float + + :arg wheelIndex: index of the wheel where the force needs to be applied + :type wheelIndex: integer + + .. method:: applyEngineForce(force, wheelIndex) + + Apply an engine force to the specified wheel + + :arg force: the engine force + :type force: float + + :arg wheelIndex: index of the wheel where the force needs to be applied + :type wheelIndex: integer + + .. method:: getConstraintId() + + Get the constraint ID + + :return: the constraint id + :rtype: integer + + .. method:: getConstraintType() + + Returns the constraint type. + + :return: constraint type + :rtype: integer + + .. method:: getNumWheels() + + Returns the number of wheels. + + :return: the number of wheels for this vehicle + :rtype: integer + + .. method:: getWheelOrientationQuaternion(wheelIndex) + + Returns the wheel orientation as a quaternion. + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + :return: TODO Description + :rtype: TODO - type should be quat as per method name but from the code it looks like a matrix + + .. method:: getWheelPosition(wheelIndex) + + Returns the position of the specified wheel + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + :return: position vector + :rtype: list[x, y, z] + + .. method:: getWheelRotation(wheelIndex) + + Returns the rotation of the specified wheel + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + :return: the wheel rotation + :rtype: float + + .. method:: setRollInfluence(rollInfluece, wheelIndex) + + Set the specified wheel's roll influence. + The higher the roll influence the more the vehicle will tend to roll over in corners. + + :arg rollInfluece: the wheel roll influence + :type rollInfluece: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + .. method:: setSteeringValue(steering, wheelIndex) + + Set the specified wheel's steering + + :arg steering: the wheel steering + :type steering: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + .. method:: setSuspensionCompression(compression, wheelIndex) + + Set the specified wheel's compression + + :arg compression: the wheel compression + :type compression: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + .. method:: setSuspensionDamping(damping, wheelIndex) + + Set the specified wheel's damping + + :arg damping: the wheel damping + :type damping: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + .. method:: setSuspensionStiffness(stiffness, wheelIndex) + + Set the specified wheel's stiffness + + :arg stiffness: the wheel stiffness + :type stiffness: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + + .. method:: setTyreFriction(friction, wheelIndex) + + Set the specified wheel's tyre friction + + :arg friction: the tyre friction + :type friction: float + + :arg wheelIndex: the wheel index + :type wheelIndex: integer + +.. class:: KX_VertexProxy(SCA_IObject) + + A vertex holds position, UV, colour and normal information. + + Note: + The physics simulation is NOT currently updated - physics will not respond + to changes in the vertex position. + + .. attribute:: XYZ + + The position of the vertex. **type** list [x, y, z] + + .. attribute:: UV + + The texture coordinates of the vertex. **type** list [u, v] + + .. attribute:: normal + + The normal of the vertex **type** list [nx, ny, nz] + + .. attribute:: colour + + The colour of the vertex. **type** list [r, g, b, a] + + Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0] + + .. attribute:: color + + Synonym for colour. + + .. attribute:: x + + The x coordinate of the vertex. **type** float + + .. attribute:: y + + The y coordinate of the vertex. **type** float + + .. attribute:: z + + The z coordinate of the vertex. **type** float + + .. attribute:: u + + The u texture coordinate of the vertex. **type** float + + .. attribute:: v + + The v texture coordinate of the vertex. **type** float + + .. attribute:: u2 + + The second u texture coordinate of the vertex. **type** float + + .. attribute:: v2 + + The second v texture coordinate of the vertex. **type** float + + .. attribute:: r + + The red component of the vertex colour. 0.0 <= r <= 1.0 **type** float + + .. attribute:: g + + The green component of the vertex colour. 0.0 <= g <= 1.0 **type** float + + .. attribute:: b + + The blue component of the vertex colour. 0.0 <= b <= 1.0 **type** float + + .. attribute:: a + + The alpha component of the vertex colour. 0.0 <= a <= 1.0 **type** float + + .. method:: getXYZ() + + Gets the position of this vertex. + + :return: this vertexes position in local coordinates. + :rtype: list [x, y, z] + + .. method:: setXYZ(pos) + + Sets the position of this vertex. + + **type** list [x, y, z] + + :arg pos: the new position for this vertex in local coordinates. + + .. method:: getUV() + + Gets the UV (texture) coordinates of this vertex. + + :return: this vertexes UV (texture) coordinates. + :rtype: list [u, v] + + .. method:: setUV(uv) + + Sets the UV (texture) coordinates of this vertex. + + **type** list [u, v] + + .. method:: getUV2() + + Gets the 2nd UV (texture) coordinates of this vertex. + + :return: this vertexes UV (texture) coordinates. + :rtype: list [u, v] + + .. method:: setUV2(uv, unit) + + Sets the 2nd UV (texture) coordinates of this vertex. + + **type** list [u, v] + + :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV + :arg unit: integer + + .. method:: getRGBA() + + Gets the colour of this vertex. + + The colour is represented as four bytes packed into an integer value. The colour is + packed as RGBA. + + Since Python offers no way to get each byte without shifting, you must use the struct module to + access colour in an machine independent way. + + Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead. + + .. code-block:: python + + import struct; + col = struct.unpack('4B', struct.pack('I', v.getRGBA())) + # col = (r, g, b, a) + # black = ( 0, 0, 0, 255) + # white = (255, 255, 255, 255) + + :return: packed colour. 4 byte integer with one byte per colour channel in RGBA format. + :rtype: integer + + .. method:: setRGBA(col) + + Sets the colour of this vertex. + + See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes + or the colour attribute instead. + + setRGBA() also accepts a four component list as argument col. The list represents the colour as [r, g, b, a] + with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0] + + .. code-block:: python + + v.setRGBA(0xff0000ff) # Red + v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian + v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red + v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms. + + :arg col: the new colour of this vertex in packed RGBA format. + :type col: integer or list [r, g, b, a] + + .. method:: getNormal() + + Gets the normal vector of this vertex. + + :return: normalised normal vector. + :rtype: list [nx, ny, nz] + + .. method:: setNormal(normal) + + Sets the normal vector of this vertex. + + **type** sequence of floats [r, g, b] + + :arg normal: the new normal of this vertex. + +.. class:: KX_VisibilityActuator(SCA_IActuator) + + Visibility Actuator. + + .. attribute:: visibility + + whether the actuator makes its parent object visible or invisible **type** boolean + + .. attribute:: useOcclusion + + whether the actuator makes its parent object an occluder or not **type** boolean + + .. attribute:: useRecursion + + whether the visibility/occlusion should be propagated to all children of the object **type** boolean + +.. class:: SCA_2DFilterActuator(SCA_IActuator) + + Create, enable and disable 2D filters + + Properties: + + The following properties don't have an immediate effect. + You must active the actuator to get the result. + The actuator is not persistent: it automatically stops itself after setting up the filter + but the filter remains active. To stop a filter you must activate the actuator with 'type' + set to RAS_2DFILTER_DISABLED or RAS_2DFILTER_NOFILTER. + + .. attribute:: shaderText + + shader source code for custom shader **type** string + + .. attribute:: disableMotionBlur + + action on motion blur: 0=enable, 1=disable **type** integer + + .. attribute:: mode + + type of 2D filter, use one of the following constants: + + * RAS_2DFILTER_ENABLED (-2) : enable the filter that was previously disabled + * RAS_2DFILTER_DISABLED (-1) : disable the filter that is currently active + * RAS_2DFILTER_NOFILTER (0) : disable and destroy the filter that is currently active + * RAS_2DFILTER_MOTIONBLUR (1) : create and enable preset filters + * RAS_2DFILTER_BLUR (2) + * RAS_2DFILTER_SHARPEN (3) + * RAS_2DFILTER_DILATION (4) + * RAS_2DFILTER_EROSION (5) + * RAS_2DFILTER_LAPLACIAN (6) + * RAS_2DFILTER_SOBEL (7) + * RAS_2DFILTER_PREWITT (8) + * RAS_2DFILTER_GRAYSCALE (9) + * RAS_2DFILTER_SEPIA (10) + * RAS_2DFILTER_INVERT (11) + * RAS_2DFILTER_CUSTOMFILTER (12) : customer filter, the code code is set via shaderText property **type** integer + + .. attribute:: passNumber + + order number of filter in the stack of 2D filters. Filters are executed in increasing order of passNb. + + Only be one filter can be defined per passNb. **type** integer (0-100) + + .. attribute:: value + + argument for motion blur filter **type** float (0.0-100.0) + +.. class:: SCA_ANDController(SCA_IController) + + An AND controller activates only when all linked sensors are activated. + + There are no special python methods for this controller. + +.. class:: SCA_ActuatorSensor(SCA_ISensor) + + Actuator sensor detect change in actuator state of the parent object. + It generates a positive pulse if the corresponding actuator is activated + and a negative pulse if the actuator is deactivated. + + Properties: + + .. attribute:: actuator + + the name of the actuator that the sensor is monitoring. **type** string + +.. class:: SCA_AlwaysSensor(SCA_ISensor) + + This sensor is always activated. + +.. class:: SCA_DelaySensor(SCA_ISensor) + + The Delay sensor generates positive and negative triggers at precise time, + expressed in number of frames. The delay parameter defines the length of the initial OFF period. A positive trigger is generated at the end of this period. + + The duration parameter defines the length of the ON period following the OFF period. + There is a negative trigger at the end of the ON period. If duration is 0, the sensor stays ON and there is no negative trigger. + + The sensor runs the OFF-ON cycle once unless the repeat option is set: the OFF-ON cycle repeats indefinately (or the OFF cycle if duration is 0). + + Use :class:`SCA_ISensor.reset` at any time to restart sensor. + + Properties: + + .. attribute:: delay + + length of the initial OFF period as number of frame, 0 for immediate trigger. **type** integer. + + .. attribute:: duration + + length of the ON period in number of frame after the initial OFF period. + + If duration is greater than 0, a negative trigger is sent at the end of the ON pulse. **type** integer + + .. attribute:: repeat + + 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once. **type** integer + +.. class:: SCA_JoystickSensor(SCA_ISensor) + + This sensor detects player joystick events. + + Properties: + + .. attribute:: axisValues + + The state of the joysticks axis as a list of values :data:`numAxis` long. (read-only). **type** list of ints. + + Each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing. + The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls. + + * left:[-32767, 0, ...] + * right:[32767, 0, ...] + * up:[0, -32767, ...] + * down:[0, 32767, ...] + + .. attribute:: axisSingle + + like :data:`axisValues` but returns a single axis value that is set by the sensor. (read-only). **type** integer + + .. note:: only use this for "Single Axis" type sensors otherwise it will raise an error. + + .. attribute:: hatValues + + The state of the joysticks hats as a list of values :data:`numHats` long. (read-only) **type** list of ints + + Each spesifying the direction of the hat from 1 to 12, 0 when inactive. + + Hat directions are as follows... + + * 0:None + * 1:Up + * 2:Right + * 4:Down + * 8:Left + * 3:Up - Right + * 6:Down - Right + * 12:Down - Left + * 9:Up - Left + + .. attribute:: hatSingle + + Like :data:`hatValues` but returns a single hat direction value that is set by the sensor. (read-only). **type** integer + + .. attribute:: numAxis + + The number of axes for the joystick at this index. (read-only). **type** integer + + .. attribute:: numButtons + + The number of buttons for the joystick at this index. (read-only). **type** integer + + .. attribute:: numHats + + The number of hats for the joystick at this index. (read-only). **type** integer + + .. attribute:: connected + + True if a joystick is connected at this joysticks index. (read-only). **type** boolean + + .. attribute:: index + + The joystick index to use (from 0 to 7). The first joystick is always 0. **type** integer + + .. attribute:: threshold + + Axis threshold. Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive. **type** integer + + .. attribute:: button + + The button index the sensor reacts to (first button = 0). When the "All Events" toggle is set, this option has no effect. **type** integer + + .. attribute:: axis + + The axis this sensor reacts to, as a list of two values [axisIndex, axisDirection] + + * axisIndex: the axis index to use when detecting axis movement, 1=primary directional control, 2=secondary directional control. + * axisDirection: 0=right, 1=up, 2=left, 3=down. **type** [integer, integer] + + .. attribute:: hat + + The hat the sensor reacts to, as a list of two values: [hatIndex, hatDirection] + + * hatIndex: the hat index to use when detecting hat movement, 1=primary hat, 2=secondary hat (4 max). + * hatDirection: 1-12 **type** [integer, integer] + + .. method:: getButtonActiveList() + + :return: A list containing the indicies of the currently pressed buttons. + :rtype: list + + .. method:: getButtonStatus(buttonIndex) + + :arg buttonIndex: the button index, 0=first button + :type buttonIndex: integer + :return: The current pressed state of the specified button. + :rtype: boolean + +.. class:: SCA_KeyboardSensor(SCA_ISensor) + + A keyboard sensor detects player key presses. + + See module :mod:`bge.keys` for keycode values. + + .. attribute:: key + + The key code this sensor is looking for. **type** keycode from :mod:`bge.keys` module + + .. attribute:: hold1 + + The key code for the first modifier this sensor is looking for. **type** keycode from :mod:`bge.keys` module + + .. attribute:: hold2 + + The key code for the second modifier this sensor is looking for. **type** keycode from :mod:`bge.keys` module + + .. attribute:: toggleProperty + + The name of the property that indicates whether or not to log keystrokes as a string. **type** string + + .. attribute:: targetProperty + + The name of the property that receives keystrokes in case in case a string is logged. **type** string + + .. attribute:: useAllKeys + + Flag to determine whether or not to accept all keys. **type** boolean + + .. attribute:: events + + a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). **type** list [[keycode, status], ...] + + * 'keycode' matches the values in :mod:`bge.keys`. + * 'status' uses... + + * :mod:`bge.logic.KX_INPUT_NONE` + * :mod:`bge.logic.KX_INPUT_JUST_ACTIVATED` + * :mod:`bge.logic.KX_INPUT_ACTIVE` + * :mod:`bge.logic.KX_INPUT_JUST_RELEASED` + + .. method:: getKeyStatus(keycode) + + Get the status of a key. + + :arg keycode: The code that represents the key you want to get the state of + :type keycode: integer + :return: The state of the given key + :rtype: key state :mod:`bge.logic` members (KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED) + +.. class:: SCA_NANDController(SCA_IController) + + An NAND controller activates when all linked sensors are not active. + + There are no special python methods for this controller. + +.. class:: SCA_NORController(SCA_IController) + + An NOR controller activates only when all linked sensors are de-activated. + + There are no special python methods for this controller. + +.. class:: SCA_ORController(SCA_IController) + + An OR controller activates when any connected sensor activates. + + There are no special python methods for this controller. + +.. class:: SCA_PropertyActuator(SCA_IActuator) + + Property Actuator + + Properties: + + .. attribute:: propName + + the property on which to operate. **type** string + + .. attribute:: value + + the value with which the actuator operates. **type** string + + .. attribute:: mode + + TODO - add constants to game logic dict!. **type** integer + +.. class:: SCA_PropertySensor(SCA_ISensor) + + Activates when the game object property matches. + + Properties: + + .. attribute:: mode + + Type of check on the property. **type** integer + + * KX_PROPSENSOR_EQUAL(1) + * KX_PROPSENSOR_NOTEQUAL(2) + * KX_PROPSENSOR_INTERVAL(3) + * KX_PROPSENSOR_CHANGED(4) + * KX_PROPSENSOR_EXPRESSION(5) + + .. attribute:: propName + + the property the sensor operates. **type** string + + .. attribute:: value + + the value with which the sensor compares to the value of the property. **type** string + + .. attribute:: min + + the minimum value of the range used to evaluate the property when in interval mode. **type** string + + .. attribute:: max + + the maximum value of the range used to evaluate the property when in interval mode. **type** string + +.. class:: SCA_PythonController(SCA_IController) + + A Python controller uses a Python script to activate it's actuators, + based on it's sensors. + + Properties: + + .. attribute:: script + + The value of this variable depends on the execution methid. + + * When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts. + * When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts. + + .. note:: once this is set the script name given for warnings will remain unchanged. **type** string + + .. attribute:: mode + + the execution mode for this controller (read-only). + + * Script: 0, Execite the :data:`script` as a python code. + * Module: 1, Execite the :data:`script` as a module and function. **type** integer + + .. method:: activate(actuator) + + Activates an actuator attached to this controller. + + :arg actuator: The actuator to operate on. + :type actuator: actuator or the actuator name as a string + + .. method:: deactivate(actuator) + + Deactivates an actuator attached to this controller. + + :arg actuator: The actuator to operate on. + :type actuator: actuator or the actuator name as a string + +.. class:: SCA_RandomActuator(SCA_IActuator) + + Random Actuator + + Properties: + + .. attribute:: seed + + Seed of the random number generator. **type** integer. + + Equal seeds produce equal series. If the seed is 0, the generator will produce the same value on every call. + + .. attribute:: para1 + + the first parameter of the active distribution. **type** float, read-only. + + Refer to the documentation of the generator types for the meaning of this value. + + .. attribute:: para2 + + the second parameter of the active distribution. **type** float, read-only + + Refer to the documentation of the generator types for the meaning of this value. + + .. attribute:: distribution + + distribution type. (read-only). **type** integer + + * KX_RANDOMACT_BOOL_CONST + * KX_RANDOMACT_BOOL_UNIFORM + * KX_RANDOMACT_BOOL_BERNOUILLI + * KX_RANDOMACT_INT_CONST + * KX_RANDOMACT_INT_UNIFORM + * KX_RANDOMACT_INT_POISSON + * KX_RANDOMACT_FLOAT_CONST + * KX_RANDOMACT_FLOAT_UNIFORM + * KX_RANDOMACT_FLOAT_NORMAL + * KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL + + .. attribute:: propName + + the name of the property to set with the random value. **type** string + + If the generator and property types do not match, the assignment is ignored. + + .. method:: setBoolConst(value) + + Sets this generator to produce a constant boolean value. + + :arg value: The value to return. + :type value: boolean + + .. method:: setBoolUniform() + + Sets this generator to produce a uniform boolean distribution. + + The generator will generate True or False with 50% chance. + + .. method:: setBoolBernouilli(value) + + Sets this generator to produce a Bernouilli distribution. + + :arg value: Specifies the proportion of False values to produce. + + * 0.0: Always generate True + * 1.0: Always generate False + :type value: float + + .. method:: setIntConst(value) + + Sets this generator to always produce the given value. + + :arg value: the value this generator produces. + :type value: integer + + .. method:: setIntUniform(lower_bound, upper_bound) + + Sets this generator to produce a random value between the given lower and + upper bounds (inclusive). + + :type lower_bound: integer + :type upper_bound: integer + + .. method:: setIntPoisson(value) + + Generate a Poisson-distributed number. + + This performs a series of Bernouilli tests with parameter value. + It returns the number of tries needed to achieve succes. + + :type value: float + + .. method:: setFloatConst(value) + + Always generate the given value. + + :type value: float + + .. method:: setFloatUniform(lower_bound, upper_bound) + + Generates a random float between lower_bound and upper_bound with a + uniform distribution. + + :type lower_bound: float + :type upper_bound: float + + .. method:: setFloatNormal(mean, standard_deviation) + + Generates a random float from the given normal distribution. + + :arg mean: The mean (average) value of the generated numbers + :type mean: float + :arg standard_deviation: The standard deviation of the generated numbers. + :type standard_deviation: float + + .. method:: setFloatNegativeExponential(half_life) + + Generate negative-exponentially distributed numbers. + + The half-life 'time' is characterized by half_life. + + :type half_life: float + +.. class:: SCA_RandomSensor(SCA_ISensor) + + This sensor activates randomly. + + .. attribute:: lastDraw + + The seed of the random number generator. **type** integer + + .. attribute:: seed + + The seed of the random number generator. **type** integer + + .. method:: setSeed(seed) + + Sets the seed of the random number generator. + + If the seed is 0, the generator will produce the same value on every call. + + :type seed: integer + + .. method:: getSeed() + + :return: The initial seed of the generator. Equal seeds produce equal random series. + :rtype: integer + + .. method:: getLastDraw() + + :return: The last random number generated. + :rtype: integer + +.. class:: SCA_XNORController(SCA_IController) + + An XNOR controller activates when all linked sensors are the same (activated or inative). + + There are no special python methods for this controller. + +.. class:: SCA_XORController(SCA_IController) + + An XOR controller activates when there is the input is mixed, but not when all are on or off. + + There are no special python methods for this controller. + +.. class:: KX_Camera(KX_GameObject) + + A Camera object. + + .. attribute:: INSIDE + + see :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` + + .. attribute:: INTERSECT + + see :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` + + .. attribute:: OUTSIDE + + see :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` + + .. attribute:: lens + + The camera's lens value. **type** float + + .. attribute:: near + + The camera's near clip distance. **type** float + + .. attribute:: far + + The camera's far clip distance. **type** float + + .. attribute:: perspective + + True if this camera has a perspective transform, False for an orthographic projection. **type** boolean + + .. attribute:: frustum_culling + + True if this camera is frustum culling. **type** boolean + + .. attribute:: projection_matrix + + This camera's 4x4 projection matrix. **type** 4x4 Matrix [[float]] + + .. attribute:: modelview_matrix + + This camera's 4x4 model view matrix. (read-only). **type** 4x4 Matrix [[float]] + + .. note:: This matrix is regenerated every frame from the camera's position and orientation. + + .. attribute:: camera_to_world + + This camera's camera to world transform. (read-only). **type** 4x4 Matrix [[float]] + + .. note:: This matrix is regenerated every frame from the camera's position and orientation. + + .. attribute:: world_to_camera + + This camera's world to camera transform. (read-only). **type** 4x4 Matrix [[float]] + + .. note:: Regenerated every frame from the camera's position and orientation. + .. note:: This is camera_to_world inverted. + + .. attribute:: useViewport + + True when the camera is used as a viewport, set True to enable a viewport for this camera. **type** boolean + + .. method:: sphereInsideFrustum(centre, radius) + + Tests the given sphere against the view frustum. + + :arg centre: The centre of the sphere (in world coordinates.) + :type centre: list [x, y, z] + :arg radius: the radius of the sphere + :type radius: float + :return: INSIDE, OUTSIDE or INTERSECT + :rtype: integer + + .. code-block:: python + + import GameLogic + co = GameLogic.getCurrentController() + cam = co.owner + + # A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0] + if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE): + # Sphere is inside frustum ! + # Do something useful ! + else: + # Sphere is outside frustum + + .. note:: when the camera is first initialized the result will be invalid because the projection matrix has not been set. + + .. method:: boxInsideFrustum(box) + + Tests the given box against the view frustum. + + .. code-block:: python + + import GameLogic + co = GameLogic.getCurrentController() + cam = co.owner + + # Box to test... + box = [] + box.append([-1.0, -1.0, -1.0]) + box.append([-1.0, -1.0, 1.0]) + box.append([-1.0, 1.0, -1.0]) + box.append([-1.0, 1.0, 1.0]) + box.append([ 1.0, -1.0, -1.0]) + box.append([ 1.0, -1.0, 1.0]) + box.append([ 1.0, 1.0, -1.0]) + box.append([ 1.0, 1.0, 1.0]) + + if (cam.boxInsideFrustum(box) != cam.OUTSIDE): + # Box is inside/intersects frustum ! + # Do something useful ! + else: + # Box is outside the frustum ! + + :arg box: Eight (8) corner points of the box (in world coordinates.) + :type box: list of lists + :return: INSIDE, OUTSIDE or INTERSECT + + .. note:: when the camera is first initialized the result will be invalid because the projection matrix has not been set. + + .. method:: pointInsideFrustum(point) + + Tests the given point against the view frustum. + + .. code-block:: python + + import GameLogic + co = GameLogic.getCurrentController() + cam = co.owner + + # Test point [0.0, 0.0, 0.0] + if (cam.pointInsideFrustum([0.0, 0.0, 0.0])): + # Point is inside frustum ! + # Do something useful ! + else: + # Box is outside the frustum ! + + :arg point: The point to test (in world coordinates.) + :type point: 3D Vector + :return: True if the given point is inside this camera's viewing frustum. + :rtype: boolean + + .. note:: when the camera is first initialized the result will be invalid because the projection matrix has not been set. + + .. method:: getCameraToWorld() + + Returns the camera-to-world transform. + + :return: the camera-to-world transform matrix. + :rtype: matrix (4x4 list) + + .. method:: getWorldToCamera() + + Returns the world-to-camera transform. + + This returns the inverse matrix of getCameraToWorld(). + + :return: the world-to-camera transform matrix. + :rtype: matrix (4x4 list) + + .. method:: setOnTop() + + Set this cameras viewport ontop of all other viewport. + + .. method:: setViewport(left, bottom, right, top) + + Sets the region of this viewport on the screen in pixels. + + Use :data:`bge.render.getWindowHeight` and :data:`bge.render.getWindowWidth` to calculate values relative to the entire display. + + :arg left: left pixel coordinate of this viewport + :type left: integer + :arg bottom: bottom pixel coordinate of this viewport + :type bottom: integer + :arg right: right pixel coordinate of this viewport + :type right: integer + :arg top: top pixel coordinate of this viewport + :type top: integer + + .. method:: getScreenPosition(object) + + Gets the position of an object projected on screen space. + + .. code-block:: python + + # For an object in the middle of the screen, coord = [0.5, 0.5] + coord = camera.getScreenPosition(object) + + :arg object: object name or list [x, y, z] + :type object: :class:`KX_GameObject` or 3D Vector + :return: the object's position in screen coordinates. + :rtype: list [x, y] + + .. method:: getScreenVect(x, y) + + Gets the vector from the camera position in the screen coordinate direction. + + .. code-block:: python + + # Gets the vector of the camera front direction: + m_vect = camera.getScreenVect(0.5, 0.5) + + + :arg x: X Axis + :type x: float + :arg y: Y Axis + :type y: float + :rtype: 3D Vector + :return: The vector from screen coordinate. + + .. method:: getScreenRay(x, y, dist=inf, property=None) + + Look towards a screen coordinate (x, y) and find first object hit within dist that matches prop. + The ray is similar to KX_GameObject->rayCastTo. + + .. code-block:: python + + # Gets an object with a property "wall" in front of the camera within a distance of 100: + target = camera.getScreenRay(0.5, 0.5, 100, "wall") + + :arg x: X Axis + :type x: float + :arg y: Y Axis + :type y: float + :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other + :type dist: float + :arg property: property name that object must have; can be omitted => detect any object + :type property: string + :rtype: :class:`KX_GameObject` + :return: the first object hit or None if no object or object does not match prop + +.. class:: BL_ArmatureObject(KX_GameObject) + + An armature object. + + .. attribute:: constraints + + The list of armature constraint defined on this armature. + Elements of the list can be accessed by index or string. + The key format for string access is ':' **type** list of :class:`BL_ArmatureConstraint` + + .. attribute:: channels + + The list of armature channels. + Elements of the list can be accessed by index or name the bone. **type** list of :class:`BL_ArmatureChannel` + + .. method:: update() + + Ensures that the armature will be updated on next graphic frame. + + This action is unecessary if a KX_ArmatureActuator with mode run is active + or if an action is playing. Use this function in other cases. It must be called + on each frame to ensure that the armature is updated continously. + +.. class:: BL_ArmatureActuator(SCA_IActuator) + + Armature Actuators change constraint condition on armatures. + + .. attribute:: KX_ACT_ARMATURE_RUN + + see type + + .. attribute:: KX_ACT_ARMATURE_ENABLE + + see type + + .. attribute:: KX_ACT_ARMATURE_DISABLE + + see type + + .. attribute:: KX_ACT_ARMATURE_SETTARGET + + see type + + .. attribute:: KX_ACT_ARMATURE_SETWEIGHT + + see type + + .. attribute:: type + + The type of action that the actuator executes when it is active. + + * KX_ACT_ARMATURE_RUN(0) just make sure the armature will be updated on the next graphic frame. This is the only persistent mode of the actuator: it executes automatically once per frame until stopped by a controller + * KX_ACT_ARMATURE_ENABLE(1) enable the constraint. + * KX_ACT_ARMATURE_DISABLE(2) disable the constraint (runtime constraint values are not updated). + * KX_ACT_ARMATURE_SETTARGET(3) change target and subtarget of constraint. + * KX_ACT_ARMATURE_SETWEIGHT(4) change weight of (only for IK constraint). **type** integer + + .. attribute:: constraint + + The constraint object this actuator is controlling. **type** :class:`BL_ArmatureConstraint` + + .. attribute:: target + + The object that this actuator will set as primary target to the constraint it controls **type** :class:`KX_GameObject` + + .. attribute:: subtarget + + The object that this actuator will set as secondary target to the constraint it controls. **type** :class:`KX_GameObject`. + + .. note:: Currently, the only secondary target is the pole target for IK constraint. + + .. attribute:: weight + + The weight this actuator will set on the constraint it controls. **type** float. + + .. note:: Currently only the IK constraint has a weight. It must be a value between 0 and 1. + + .. note:: A weight of 0 disables a constraint while still updating constraint runtime values (see :class:`BL_ArmatureConstraint`) + +.. class:: KX_ArmatureSensor(SCA_ISensor) + + Armature sensor detect conditions on armatures. + + See :data:`type` + + .. data:: KX_ARMSENSOR_STATE_CHANGED + .. data:: KX_ARMSENSOR_LIN_ERROR_BELOW + .. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE + .. data:: KX_ARMSENSOR_ROT_ERROR_BELOW + .. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE + + .. attribute:: type + + The type of measurement that the sensor make when it is active. **type** integer. + + * KX_ARMSENSOR_STATE_CHANGED(0) detect that the constraint is changing state (active/inactive) + * KX_ARMSENSOR_LIN_ERROR_BELOW(1) detect that the constraint linear error is above a threshold + * KX_ARMSENSOR_LIN_ERROR_ABOVE(2) detect that the constraint linear error is below a threshold + * KX_ARMSENSOR_ROT_ERROR_BELOW(3) detect that the constraint rotation error is above a threshold + * KX_ARMSENSOR_ROT_ERROR_ABOVE(4) detect that the constraint rotation error is below a threshold + + .. attribute:: constraint + + The constraint object this sensor is watching. **type** :class:`BL_ArmatureConstraint` + + .. attribute:: value + + **type** float + + The threshold used in the comparison with the constraint error + The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver + The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver + The linear error on CopyPose is always >= 0: it is the norm of the distance between the target and the bone + The rotation error on CopyPose is always >= 0: it is the norm of the equivalent rotation vector between the bone and the target orientations + The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller. + +.. class:: BL_ArmatureConstraint(PyObjectPlus) + + Proxy to Armature Constraint. Allows to change constraint on the fly. + Obtained through :class:`BL_ArmatureObject`.constraints. + + .. note:: not all armature constraints are supported in the GE. + + + Constants related to see :data:`type` + + .. data:: CONSTRAINT_TYPE_TRACKTO + .. data:: CONSTRAINT_TYPE_KINEMATIC + .. data:: CONSTRAINT_TYPE_ROTLIKE + .. data:: CONSTRAINT_TYPE_LOCLIKE + .. data:: CONSTRAINT_TYPE_MINMAX + .. data:: CONSTRAINT_TYPE_SIZELIKE + .. data:: CONSTRAINT_TYPE_LOCKTRACK + .. data:: CONSTRAINT_TYPE_STRETCHTO + .. data:: CONSTRAINT_TYPE_CLAMPTO + .. data:: CONSTRAINT_TYPE_TRANSFORM + .. data:: CONSTRAINT_TYPE_DISTLIMIT + + + Constants related to see :data:`ik_type` + + .. data:: CONSTRAINT_IK_COPYPOSE + .. data:: CONSTRAINT_IK_DISTANCE + .. data:: CONSTRAINT_IK_MODE_INSIDE + .. data:: CONSTRAINT_IK_MODE_OUTSIDE + .. data:: CONSTRAINT_IK_MODE_ONSURFACE + .. data:: CONSTRAINT_IK_FLAG_TIP + .. data:: CONSTRAINT_IK_FLAG_ROT + .. data:: CONSTRAINT_IK_FLAG_STRETCH + .. data:: CONSTRAINT_IK_FLAG_POS + + .. attribute:: type + + Type of constraint, (read-only) **type** integer, one of CONSTRAINT_TYPE_* constants + + .. attribute:: name + + Name of constraint constructed as :. constraints list **type** string + + This name is also the key subscript on :class:`BL_ArmatureObject`. + + .. attribute:: enforce + + fraction of constraint effect that is enforced. Between 0 and 1. **type** float + + .. attribute:: headtail + + Position of target between head and tail of the target bone: 0=head, 1=tail. **type** float. + + .. note:: Only used if the target is a bone (i.e target object is an armature. + + .. attribute:: lin_error + + runtime linear error (in Blender units) on constraint at the current frame. + + This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. **type** float + + .. attribute:: rot_error + + Runtime rotation error (in radiant) on constraint at the current frame. **type** float. + + This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. + + It is only set if the constraint has a rotation part, for example, a CopyPose+Rotation IK constraint. + + .. attribute:: target + + Primary target object for the constraint. The position of this object in the GE will be used as target for the constraint. **type** :class:`KX_GameObject`. + + .. attribute:: subtarget + + Secondary target object for the constraint. The position of this object in the GE will be used as secondary target for the constraint. **type** :class:`KX_GameObject`. + + Currently this is only used for pole target on IK constraint. + + .. attribute:: active + + True if the constraint is active. + + .. note:: an inactive constraint does not update lin_error and rot_error. **type** boolean + + .. attribute:: ik_weight + + Weight of the IK constraint between 0 and 1. + + Only defined for IK constraint. **type** float + + .. attribute:: ik_type + + Type of IK constraint, (read-only). **type** integer. + + * CONSTRAINT_IK_COPYPOSE(0) constraint is trying to match the position and eventually the rotation of the target. + * CONSTRAINT_IK_DISTANCE(1) constraint is maintaining a certain distance to target subject to ik_mode + + .. attribute:: ik_flag + + Combination of IK constraint option flags, read-only + + * CONSTRAINT_IK_FLAG_TIP(1) : set when the constraint operates on the head of the bone and not the tail + * CONSTRAINT_IK_FLAG_ROT(2) : set when the constraint tries to match the orientation of the target + * CONSTRAINT_IK_FLAG_STRETCH(16) : set when the armature is allowed to stretch (only the bones with stretch factor > 0.0) + * CONSTRAINT_IK_FLAG_POS(32) : set when the constraint tries to match the position of the target **type** integer + + .. attribute:: ik_dist + + Distance the constraint is trying to maintain with target, only used when ik_type=CONSTRAINT_IK_DISTANCE **type** float + + .. attribute:: ik_mode + + Additional mode for IK constraint. Currently only used for Distance constraint: + + * CONSTRAINT_IK_MODE_INSIDE(0) : the constraint tries to keep the bone within ik_dist of target + * CONSTRAINT_IK_MODE_OUTSIDE(1) : the constraint tries to keep the bone outside ik_dist of the target + * CONSTRAINT_IK_MODE_ONSURFACE(2) : the constraint tries to keep the bone exactly at ik_dist of the target **type** integer + +.. class:: BL_ArmatureChannel(PyObjectPlus) + + Proxy to armature pose channel. Allows to read and set armature pose. + The attributes are identical to RNA attributes, but mostly in read-only mode. + + See :data:`rotation_mode` + + .. data:: PCHAN_ROT_QUAT + .. data:: PCHAN_ROT_XYZ + .. data:: PCHAN_ROT_XZY + .. data:: PCHAN_ROT_YXZ + .. data:: PCHAN_ROT_YZX + .. data:: PCHAN_ROT_ZXY + .. data:: PCHAN_ROT_ZYX + + .. attribute:: name + + channel name (=bone name), read-only. **type** string + + .. attribute:: bone + + return the bone object corresponding to this pose channel, read-only. **type** :class:`BL_ArmatureBone` + + .. attribute:: parent + + return the parent channel object, None if root channel, read-only. **type** :class:`BL_ArmatureChannel` + + .. attribute:: has_ik + + true if the bone is part of an active IK chain, read-only. + This flag is not set when an IK constraint is defined but not enabled (miss target information for example) **type** boolean + + .. attribute:: ik_dof_x + + true if the bone is free to rotation in the X axis, read-only. **type** boolean + + .. attribute:: ik_dof_y + + true if the bone is free to rotation in the Y axis, read-only. **type** boolean + + .. attribute:: ik_dof_z + + true if the bone is free to rotation in the Z axis, read-only. **type** boolean + + .. attribute:: ik_limit_x + + true if a limit is imposed on X rotation, read-only. **type** boolean + + .. attribute:: ik_limit_y + + true if a limit is imposed on Y rotation, read-only. **type** boolean + + .. attribute:: ik_limit_z + + true if a limit is imposed on Z rotation, read-only. **type** boolean + + .. attribute:: ik_rot_control + + true if channel rotation should applied as IK constraint, read-only. **type** boolean + + .. attribute:: ik_lin_control + + true if channel size should applied as IK constraint, read-only. **type** boolean + + .. attribute:: location + + displacement of the bone head in armature local space, read-write. **type** vector [X, Y, Z]. + + .. note:: You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. + .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`). + + .. attribute:: scale + + scale of the bone relative to its parent, read-write. **type** vector [sizeX, sizeY, sizeZ]. + + .. note:: An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. + .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) + + .. attribute:: rotation + + rotation of the bone relative to its parent expressed as a quaternion, read-write. **type** vector [qr, qi, qj, qk]. + + .. note:: This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. + .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) + + .. attribute:: euler_rotation + + rotation of the bone relative to its parent expressed as a set of euler angles, read-write. **type** vector [X, Y, Z]. + + .. note:: This field is only used if rotation_mode is > 0. You must always pass the angles in [X, Y, Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation. + .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) + + .. attribute:: rotation_mode + + Method of updating the bone rotation, read-write. **type** integer + + Use the following constants (euler mode are named as in Blender UI but the actual axis order is reversed). + + * PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation + * PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively + * PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively + * PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively + * PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively + * PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively + * PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively + + .. attribute:: channel_matrix + + pose matrix in bone space (deformation of the bone due to action, constraint, etc), Read-only. + This field is updated after the graphic render, it represents the current pose. **type** matrix [4][4] + + .. attribute:: pose_matrix + + pose matrix in armature space, read-only, + This field is updated after the graphic render, it represents the current pose. **type** matrix [4][4] + + .. attribute:: pose_head + + position of bone head in armature space, read-only. **type** vector [x, y, z] + + .. attribute:: pose_tail + + position of bone tail in armature space, read-only. **type** vector [x, y, z] + + .. attribute:: ik_min_x + + minimum value of X rotation in degree (<= 0) when X rotation is limited (see ik_limit_x), read-only. **type** float + + .. attribute:: ik_max_x + + maximum value of X rotation in degree (>= 0) when X rotation is limited (see ik_limit_x), read-only. **type** float + + .. attribute:: ik_min_y + + minimum value of Y rotation in degree (<= 0) when Y rotation is limited (see ik_limit_y), read-only. **type** float + + .. attribute:: ik_max_y + + maximum value of Y rotation in degree (>= 0) when Y rotation is limited (see ik_limit_y), read-only. **type** float + + .. attribute:: ik_min_z + + minimum value of Z rotation in degree (<= 0) when Z rotation is limited (see ik_limit_z), read-only. **type** float + + .. attribute:: ik_max_z + + maximum value of Z rotation in degree (>= 0) when Z rotation is limited (see ik_limit_z), read-only. **type** float + + .. attribute:: ik_stiffness_x + + bone rotation stiffness in X axis, read-only **type** float between 0 and 1 + + .. attribute:: ik_stiffness_y + + bone rotation stiffness in Y axis, read-only **type** float between 0 and 1 + + .. attribute:: ik_stiffness_z + + bone rotation stiffness in Z axis, read-only **type** float between 0 and 1 + + .. attribute:: ik_stretch + + ratio of scale change that is allowed, 0=bone can't change size, read-only. **type** float + + .. attribute:: ik_rot_weight + + weight of rotation constraint when ik_rot_control is set, read-write. **type** float between 0 and 1 + + .. attribute:: ik_lin_weight + + weight of size constraint when ik_lin_control is set, read-write. **type** float between 0 and 1 + + .. attribute:: joint_rotation + + Control bone rotation in term of joint angle (for robotic applications), read-write. **type** vector [x, y, z] + + When writing to this attribute, you pass a [x, y, z] vector and an appropriate set of euler angles or quaternion is calculated according to the rotation_mode. + + When you read this attribute, the current pose matrix is converted into a [x, y, z] vector representing the joint angles. + + The value and the meaning of the x, y, z depends on the ik_dof_x/ik_dof_y/ik_dof_z attributes: + + * 1DoF joint X, Y or Z: the corresponding x, y, or z value is used an a joint angle in radiant + * 2DoF joint X+Y or Z+Y: treated as 2 successive 1DoF joints: first X or Z, then Y. The x or z value is used as a joint angle in radiant along the X or Z axis, followed by a rotation along the new Y axis of y radiants. + * 2DoF joint X+Z: treated as a 2DoF joint with rotation axis on the X/Z plane. The x and z values are used as the coordinates of the rotation vector in the X/Z plane. + * 3DoF joint X+Y+Z: treated as a revolute joint. The [x, y, z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose. + + .. note:: The bone must be part of an IK chain if you want to set the ik_dof_x/ik_dof_y/ik_dof_z attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target) the IK solver will not run but the IK panel will show up on the UI for each bone in the chain. + .. note:: [0, 0, 0] always corresponds to the rest pose. + .. note:: You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see :data:`BL_ArmatureObject.update`). + .. note:: You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute. + +.. class:: BL_ArmatureBone(PyObjectPlus) + + Proxy to Blender bone structure. All fields are read-only and comply to RNA names. + All space attribute correspond to the rest pose. + + .. attribute:: name + + bone name **type** string + + .. attribute:: connected + + true when the bone head is struck to the parent's tail **type** boolean + + .. attribute:: hinge + + true when bone doesn't inherit rotation or scale from parent bone **type** boolean + + .. attribute:: inherit_scale + + true when bone inherits scaling from parent bone **type** boolean + + .. attribute:: bbone_segments + + number of B-bone segments **type** integer + + .. attribute:: roll + + bone rotation around head-tail axis **type** float + + .. attribute:: head + + location of head end of the bone in parent bone space **type** vector [x, y, z] + + .. attribute:: tail + + location of head end of the bone in parent bone space **type** vector [x, y, z] + + .. attribute:: length + + bone length **type** float + + .. attribute:: arm_head + + location of head end of the bone in armature space **type** vector [x, y, z] + + .. attribute:: arm_tail + + location of tail end of the bone in armature space **type** vector [x, y, z] + + .. attribute:: arm_mat + + matrix of the bone head in armature space **type** matrix [4][4] + + .. note:: This matrix has no scale part. + + .. attribute:: bone_mat + + rotation matrix of the bone in parent bone space. **type** matrix [3][3] + + .. attribute:: parent + + parent bone, or None for root bone **type** :class:`BL_ArmatureBone` + + .. attribute:: children + + list of bone's children. **type** list of :class:`BL_ArmatureBone` -- cgit v1.2.3 From 99bbc90266beeedd432981d7332a04ebafae413c Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sat, 19 Jun 2010 10:31:47 +0000 Subject: Deleting my GSoC branch to recreate it. --- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 568 -- source/gameengine/BlenderRoutines/CMakeLists.txt | 53 - .../BlenderRoutines/KX_BlenderCanvas.cpp | 207 - .../gameengine/BlenderRoutines/KX_BlenderCanvas.h | 201 - source/gameengine/BlenderRoutines/KX_BlenderGL.cpp | 223 - source/gameengine/BlenderRoutines/KX_BlenderGL.h | 60 - .../BlenderRoutines/KX_BlenderInputDevice.cpp | 30 - .../BlenderRoutines/KX_BlenderInputDevice.h | 242 - .../BlenderRoutines/KX_BlenderKeyboardDevice.cpp | 165 - .../BlenderRoutines/KX_BlenderKeyboardDevice.h | 60 - .../BlenderRoutines/KX_BlenderMouseDevice.cpp | 191 - .../BlenderRoutines/KX_BlenderMouseDevice.h | 58 - .../BlenderRoutines/KX_BlenderRenderTools.cpp | 381 - .../BlenderRoutines/KX_BlenderRenderTools.h | 110 - .../BlenderRoutines/KX_BlenderSystem.cpp | 52 - .../gameengine/BlenderRoutines/KX_BlenderSystem.h | 60 - source/gameengine/BlenderRoutines/Makefile | 78 - source/gameengine/BlenderRoutines/SConscript | 36 - source/gameengine/CMakeLists.txt | 48 - source/gameengine/Converter/BL_ActionActuator.cpp | 677 -- source/gameengine/Converter/BL_ActionActuator.h | 177 - .../gameengine/Converter/BL_ArmatureActuator.cpp | 261 - source/gameengine/Converter/BL_ArmatureActuator.h | 93 - source/gameengine/Converter/BL_ArmatureChannel.cpp | 465 - source/gameengine/Converter/BL_ArmatureChannel.h | 95 - .../gameengine/Converter/BL_ArmatureConstraint.cpp | 450 - .../gameengine/Converter/BL_ArmatureConstraint.h | 118 - source/gameengine/Converter/BL_ArmatureObject.cpp | 658 -- source/gameengine/Converter/BL_ArmatureObject.h | 151 - .../Converter/BL_BlenderDataConversion.cpp | 2694 ------ .../Converter/BL_BlenderDataConversion.h | 50 - .../Converter/BL_DeformableGameObject.cpp | 112 - .../gameengine/Converter/BL_DeformableGameObject.h | 111 - source/gameengine/Converter/BL_MeshDeformer.cpp | 236 - source/gameengine/Converter/BL_MeshDeformer.h | 98 - .../gameengine/Converter/BL_ModifierDeformer.cpp | 199 - source/gameengine/Converter/BL_ModifierDeformer.h | 114 - .../Converter/BL_ShapeActionActuator.cpp | 494 -- .../gameengine/Converter/BL_ShapeActionActuator.h | 161 - source/gameengine/Converter/BL_ShapeDeformer.cpp | 187 - source/gameengine/Converter/BL_ShapeDeformer.h | 95 - source/gameengine/Converter/BL_SkinDeformer.cpp | 234 - source/gameengine/Converter/BL_SkinDeformer.h | 118 - source/gameengine/Converter/BlenderWorldInfo.cpp | 230 - source/gameengine/Converter/BlenderWorldInfo.h | 107 - source/gameengine/Converter/CMakeLists.txt | 73 - .../Converter/KX_BlenderScalarInterpolator.cpp | 74 - .../Converter/KX_BlenderScalarInterpolator.h | 78 - .../Converter/KX_BlenderSceneConverter.cpp | 1392 --- .../Converter/KX_BlenderSceneConverter.h | 187 - .../gameengine/Converter/KX_ConvertActuators.cpp | 1056 --- source/gameengine/Converter/KX_ConvertActuators.h | 45 - .../gameengine/Converter/KX_ConvertControllers.cpp | 237 - .../gameengine/Converter/KX_ConvertControllers.h | 45 - .../gameengine/Converter/KX_ConvertProperties.cpp | 154 - source/gameengine/Converter/KX_ConvertProperties.h | 39 - source/gameengine/Converter/KX_ConvertSensors.cpp | 859 -- source/gameengine/Converter/KX_ConvertSensors.h | 43 - source/gameengine/Converter/KX_IpoConvert.cpp | 480 - source/gameengine/Converter/KX_IpoConvert.h | 55 - .../gameengine/Converter/KX_SoftBodyDeformer.cpp | 120 - source/gameengine/Converter/KX_SoftBodyDeformer.h | 102 - source/gameengine/Converter/Makefile | 67 - source/gameengine/Converter/SConscript | 35 - source/gameengine/Expressions/BoolValue.cpp | 209 - source/gameengine/Expressions/BoolValue.h | 64 - source/gameengine/Expressions/CMakeLists.txt | 46 - source/gameengine/Expressions/ConstExpr.cpp | 128 - source/gameengine/Expressions/ConstExpr.h | 54 - source/gameengine/Expressions/EXP_C-Api.cpp | 120 - source/gameengine/Expressions/EXP_C-Api.h | 65 - source/gameengine/Expressions/EmptyValue.cpp | 123 - source/gameengine/Expressions/EmptyValue.h | 47 - source/gameengine/Expressions/ErrorValue.cpp | 121 - source/gameengine/Expressions/ErrorValue.h | 46 - source/gameengine/Expressions/Expression.cpp | 74 - source/gameengine/Expressions/Expression.h | 145 - source/gameengine/Expressions/FloatValue.cpp | 318 - source/gameengine/Expressions/FloatValue.h | 56 - source/gameengine/Expressions/IdentifierExpr.cpp | 99 - source/gameengine/Expressions/IdentifierExpr.h | 59 - source/gameengine/Expressions/IfExpr.cpp | 141 - source/gameengine/Expressions/IfExpr.h | 57 - source/gameengine/Expressions/InputParser.cpp | 634 -- source/gameengine/Expressions/InputParser.h | 115 - source/gameengine/Expressions/IntValue.cpp | 333 - source/gameengine/Expressions/IntValue.h | 71 - source/gameengine/Expressions/KX_HashedPtr.cpp | 59 - source/gameengine/Expressions/KX_HashedPtr.h | 61 - source/gameengine/Expressions/KX_Python.h | 70 - source/gameengine/Expressions/ListValue.cpp | 677 -- source/gameengine/Expressions/ListValue.h | 88 - source/gameengine/Expressions/Makefile | 46 - source/gameengine/Expressions/Operator1Expr.cpp | 148 - source/gameengine/Expressions/Operator1Expr.h | 59 - source/gameengine/Expressions/Operator2Expr.cpp | 273 - source/gameengine/Expressions/Operator2Expr.h | 65 - source/gameengine/Expressions/PyObjectPlus.cpp | 1227 --- source/gameengine/Expressions/PyObjectPlus.h | 559 -- source/gameengine/Expressions/SConscript | 15 - source/gameengine/Expressions/StringValue.cpp | 136 - source/gameengine/Expressions/StringValue.h | 61 - source/gameengine/Expressions/Value.cpp | 634 -- source/gameengine/Expressions/Value.h | 445 - source/gameengine/Expressions/VectorValue.cpp | 213 - source/gameengine/Expressions/VectorValue.h | 92 - source/gameengine/Expressions/VoidValue.h | 72 - source/gameengine/GameLogic/CMakeLists.txt | 52 - source/gameengine/GameLogic/Joystick/Makefile | 44 - .../gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 305 - .../gameengine/GameLogic/Joystick/SCA_Joystick.h | 197 - .../GameLogic/Joystick/SCA_JoystickDefines.h | 51 - .../GameLogic/Joystick/SCA_JoystickEvents.cpp | 123 - .../GameLogic/Joystick/SCA_JoystickPrivate.h | 48 - source/gameengine/GameLogic/Makefile | 50 - .../gameengine/GameLogic/SCA_2DFilterActuator.cpp | 142 - source/gameengine/GameLogic/SCA_2DFilterActuator.h | 67 - source/gameengine/GameLogic/SCA_ANDController.cpp | 127 - source/gameengine/GameLogic/SCA_ANDController.h | 49 - .../GameLogic/SCA_ActuatorEventManager.cpp | 64 - .../GameLogic/SCA_ActuatorEventManager.h | 56 - source/gameengine/GameLogic/SCA_ActuatorSensor.cpp | 165 - source/gameengine/GameLogic/SCA_ActuatorSensor.h | 71 - .../GameLogic/SCA_AlwaysEventManager.cpp | 55 - .../gameengine/GameLogic/SCA_AlwaysEventManager.h | 50 - source/gameengine/GameLogic/SCA_AlwaysSensor.cpp | 136 - source/gameengine/GameLogic/SCA_AlwaysSensor.h | 51 - .../gameengine/GameLogic/SCA_BasicEventManager.cpp | 57 - .../gameengine/GameLogic/SCA_BasicEventManager.h | 57 - source/gameengine/GameLogic/SCA_DelaySensor.cpp | 165 - source/gameengine/GameLogic/SCA_DelaySensor.h | 66 - source/gameengine/GameLogic/SCA_EventManager.cpp | 79 - source/gameengine/GameLogic/SCA_EventManager.h | 91 - .../GameLogic/SCA_ExpressionController.cpp | 154 - .../GameLogic/SCA_ExpressionController.h | 66 - source/gameengine/GameLogic/SCA_IActuator.cpp | 136 - source/gameengine/GameLogic/SCA_IActuator.h | 166 - source/gameengine/GameLogic/SCA_IController.cpp | 250 - source/gameengine/GameLogic/SCA_IController.h | 110 - source/gameengine/GameLogic/SCA_IInputDevice.cpp | 135 - source/gameengine/GameLogic/SCA_IInputDevice.h | 325 - source/gameengine/GameLogic/SCA_ILogicBrick.cpp | 256 - source/gameengine/GameLogic/SCA_ILogicBrick.h | 165 - source/gameengine/GameLogic/SCA_IObject.cpp | 345 - source/gameengine/GameLogic/SCA_IObject.h | 228 - source/gameengine/GameLogic/SCA_IScene.cpp | 78 - source/gameengine/GameLogic/SCA_IScene.h | 81 - source/gameengine/GameLogic/SCA_ISensor.cpp | 421 - source/gameengine/GameLogic/SCA_ISensor.h | 202 - .../gameengine/GameLogic/SCA_JoystickManager.cpp | 85 - source/gameengine/GameLogic/SCA_JoystickManager.h | 57 - source/gameengine/GameLogic/SCA_JoystickSensor.cpp | 415 - source/gameengine/GameLogic/SCA_JoystickSensor.h | 164 - .../gameengine/GameLogic/SCA_KeyboardManager.cpp | 76 - source/gameengine/GameLogic/SCA_KeyboardManager.h | 67 - source/gameengine/GameLogic/SCA_KeyboardSensor.cpp | 643 -- source/gameengine/GameLogic/SCA_KeyboardSensor.h | 141 - source/gameengine/GameLogic/SCA_LogicManager.cpp | 339 - source/gameengine/GameLogic/SCA_LogicManager.h | 155 - source/gameengine/GameLogic/SCA_MouseManager.cpp | 108 - source/gameengine/GameLogic/SCA_MouseManager.h | 76 - source/gameengine/GameLogic/SCA_MouseSensor.cpp | 310 - source/gameengine/GameLogic/SCA_MouseSensor.h | 120 - source/gameengine/GameLogic/SCA_NANDController.cpp | 129 - source/gameengine/GameLogic/SCA_NANDController.h | 53 - source/gameengine/GameLogic/SCA_NORController.cpp | 129 - source/gameengine/GameLogic/SCA_NORController.h | 49 - source/gameengine/GameLogic/SCA_ORController.cpp | 125 - source/gameengine/GameLogic/SCA_ORController.h | 50 - .../gameengine/GameLogic/SCA_PropertyActuator.cpp | 262 - source/gameengine/GameLogic/SCA_PropertyActuator.h | 90 - .../GameLogic/SCA_PropertyEventManager.cpp | 53 - .../GameLogic/SCA_PropertyEventManager.h | 55 - source/gameengine/GameLogic/SCA_PropertySensor.cpp | 383 - source/gameengine/GameLogic/SCA_PropertySensor.h | 112 - .../gameengine/GameLogic/SCA_PythonController.cpp | 541 -- source/gameengine/GameLogic/SCA_PythonController.h | 118 - source/gameengine/GameLogic/SCA_PythonKeyboard.cpp | 104 - source/gameengine/GameLogic/SCA_PythonKeyboard.h | 44 - source/gameengine/GameLogic/SCA_PythonMouse.cpp | 178 - source/gameengine/GameLogic/SCA_PythonMouse.h | 53 - source/gameengine/GameLogic/SCA_RandomActuator.cpp | 550 -- source/gameengine/GameLogic/SCA_RandomActuator.h | 120 - .../GameLogic/SCA_RandomEventManager.cpp | 54 - .../gameengine/GameLogic/SCA_RandomEventManager.h | 56 - .../GameLogic/SCA_RandomNumberGenerator.cpp | 126 - .../GameLogic/SCA_RandomNumberGenerator.h | 86 - source/gameengine/GameLogic/SCA_RandomSensor.cpp | 181 - source/gameengine/GameLogic/SCA_RandomSensor.h | 71 - .../gameengine/GameLogic/SCA_TimeEventManager.cpp | 112 - source/gameengine/GameLogic/SCA_TimeEventManager.h | 61 - source/gameengine/GameLogic/SCA_XNORController.cpp | 133 - source/gameengine/GameLogic/SCA_XNORController.h | 54 - source/gameengine/GameLogic/SCA_XORController.cpp | 132 - source/gameengine/GameLogic/SCA_XORController.h | 49 - source/gameengine/GameLogic/SConscript | 26 - source/gameengine/GamePlayer/CMakeLists.txt | 32 - source/gameengine/GamePlayer/Makefile | 57 - source/gameengine/GamePlayer/SConscript | 3 - source/gameengine/GamePlayer/common/CMakeLists.txt | 77 - source/gameengine/GamePlayer/common/GPC_Canvas.cpp | 494 -- source/gameengine/GamePlayer/common/GPC_Canvas.h | 271 - source/gameengine/GamePlayer/common/GPC_Engine.cpp | 335 - source/gameengine/GamePlayer/common/GPC_Engine.h | 123 - .../GamePlayer/common/GPC_KeyboardDevice.cpp | 124 - .../GamePlayer/common/GPC_KeyboardDevice.h | 88 - .../GamePlayer/common/GPC_MouseDevice.cpp | 209 - .../gameengine/GamePlayer/common/GPC_MouseDevice.h | 104 - .../gameengine/GamePlayer/common/GPC_RawImage.cpp | 131 - source/gameengine/GamePlayer/common/GPC_RawImage.h | 119 - .../GamePlayer/common/GPC_RawLoadDotBlendArray.cpp | 9306 -------------------- .../GamePlayer/common/GPC_RawLoadDotBlendArray.h | 36 - .../GamePlayer/common/GPC_RawLogoArrays.cpp | 1456 --- .../GamePlayer/common/GPC_RawLogoArrays.h | 40 - .../GamePlayer/common/GPC_RenderTools.cpp | 435 - .../gameengine/GamePlayer/common/GPC_RenderTools.h | 103 - source/gameengine/GamePlayer/common/GPC_System.cpp | 86 - source/gameengine/GamePlayer/common/GPC_System.h | 61 - source/gameengine/GamePlayer/common/Makefile | 84 - source/gameengine/GamePlayer/common/SConscript | 71 - source/gameengine/GamePlayer/common/bmfont.cpp | 298 - source/gameengine/GamePlayer/common/load.blend | Bin 60988 -> 0 bytes .../gameengine/GamePlayer/common/logo_blender.raw | Bin 14720 -> 0 bytes .../GamePlayer/common/logo_blender3d.raw | Bin 5984 -> 0 bytes source/gameengine/GamePlayer/common/logo_nan.raw | Bin 3968 -> 0 bytes .../GamePlayer/common/unix/GPU_Canvas.cpp | 68 - .../gameengine/GamePlayer/common/unix/GPU_Canvas.h | 58 - .../GamePlayer/common/unix/GPU_Engine.cpp | 299 - .../gameengine/GamePlayer/common/unix/GPU_Engine.h | 61 - .../GamePlayer/common/unix/GPU_KeyboardDevice.cpp | 133 - .../GamePlayer/common/unix/GPU_KeyboardDevice.h | 61 - .../GamePlayer/common/unix/GPU_PolygonMaterial.h | 53 - .../GamePlayer/common/unix/GPU_System.cpp | 51 - .../gameengine/GamePlayer/common/unix/GPU_System.h | 46 - source/gameengine/GamePlayer/common/unix/Makefile | 70 - .../GamePlayer/common/windows/GPW_Canvas.cpp | 171 - .../GamePlayer/common/windows/GPW_Canvas.h | 115 - .../GamePlayer/common/windows/GPW_Engine.cpp | 112 - .../GamePlayer/common/windows/GPW_Engine.h | 45 - .../common/windows/GPW_KeyboardDevice.cpp | 283 - .../GamePlayer/common/windows/GPW_KeyboardDevice.h | 66 - .../GamePlayer/common/windows/GPW_System.cpp | 88 - .../GamePlayer/common/windows/GPW_System.h | 58 - .../gameengine/GamePlayer/common/windows/Makefile | 62 - source/gameengine/GamePlayer/ghost/CMakeLists.txt | 76 - .../GamePlayer/ghost/GPG_Application.cpp | 897 -- .../gameengine/GamePlayer/ghost/GPG_Application.h | 159 - source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp | 116 - source/gameengine/GamePlayer/ghost/GPG_Canvas.h | 66 - .../GamePlayer/ghost/GPG_KeyboardDevice.cpp | 159 - .../GamePlayer/ghost/GPG_KeyboardDevice.h | 55 - source/gameengine/GamePlayer/ghost/GPG_System.cpp | 50 - source/gameengine/GamePlayer/ghost/GPG_System.h | 53 - source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 916 -- source/gameengine/GamePlayer/ghost/Makefile | 86 - source/gameengine/GamePlayer/ghost/SConscript | 53 - source/gameengine/Ketsji/BL_BlenderShader.cpp | 162 - source/gameengine/Ketsji/BL_BlenderShader.h | 69 - source/gameengine/Ketsji/BL_Material.cpp | 160 - source/gameengine/Ketsji/BL_Material.h | 191 - source/gameengine/Ketsji/BL_Shader.cpp | 1416 --- source/gameengine/Ketsji/BL_Shader.h | 256 - source/gameengine/Ketsji/BL_Texture.cpp | 673 -- source/gameengine/Ketsji/BL_Texture.h | 78 - source/gameengine/Ketsji/CMakeLists.txt | 83 - source/gameengine/Ketsji/KXNetwork/CMakeLists.txt | 48 - .../Ketsji/KXNetwork/KX_NetworkEventManager.cpp | 74 - .../Ketsji/KXNetwork/KX_NetworkEventManager.h | 53 - .../Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp | 135 - .../Ketsji/KXNetwork/KX_NetworkMessageActuator.h | 70 - .../Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp | 218 - .../Ketsji/KXNetwork/KX_NetworkMessageSensor.h | 89 - .../Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp | 28 - .../Ketsji/KXNetwork/KX_NetworkObjectActuator.h | 29 - .../Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp | 29 - .../Ketsji/KXNetwork/KX_NetworkObjectSensor.h | 29 - source/gameengine/Ketsji/KXNetwork/Makefile | 48 - source/gameengine/Ketsji/KXNetwork/SConscript | 17 - source/gameengine/Ketsji/KX_ArmatureSensor.cpp | 204 - source/gameengine/Ketsji/KX_ArmatureSensor.h | 89 - source/gameengine/Ketsji/KX_BlenderMaterial.cpp | 939 -- source/gameengine/Ketsji/KX_BlenderMaterial.h | 154 - .../Ketsji/KX_BulletPhysicsController.cpp | 524 -- .../gameengine/Ketsji/KX_BulletPhysicsController.h | 92 - source/gameengine/Ketsji/KX_Camera.cpp | 1027 --- source/gameengine/Ketsji/KX_Camera.h | 314 - source/gameengine/Ketsji/KX_CameraActuator.cpp | 419 - source/gameengine/Ketsji/KX_CameraActuator.h | 132 - .../gameengine/Ketsji/KX_CameraIpoSGController.cpp | 122 - .../gameengine/Ketsji/KX_CameraIpoSGController.h | 97 - source/gameengine/Ketsji/KX_ClientObjectInfo.h | 87 - source/gameengine/Ketsji/KX_ConstraintActuator.cpp | 623 -- source/gameengine/Ketsji/KX_ConstraintActuator.h | 149 - source/gameengine/Ketsji/KX_ConstraintWrapper.cpp | 117 - source/gameengine/Ketsji/KX_ConstraintWrapper.h | 56 - source/gameengine/Ketsji/KX_ConvertPhysicsObject.h | 171 - .../gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp | 556 -- source/gameengine/Ketsji/KX_Dome.cpp | 2059 ----- source/gameengine/Ketsji/KX_Dome.h | 197 - source/gameengine/Ketsji/KX_EmptyObject.cpp | 34 - source/gameengine/Ketsji/KX_EmptyObject.h | 50 - source/gameengine/Ketsji/KX_GameActuator.cpp | 244 - source/gameengine/Ketsji/KX_GameActuator.h | 90 - source/gameengine/Ketsji/KX_GameObject.cpp | 3043 ------- source/gameengine/Ketsji/KX_GameObject.h | 913 -- source/gameengine/Ketsji/KX_IInterpolator.h | 55 - source/gameengine/Ketsji/KX_IPOTransform.h | 86 - source/gameengine/Ketsji/KX_IPO_SGController.cpp | 379 - source/gameengine/Ketsji/KX_IPO_SGController.h | 129 - source/gameengine/Ketsji/KX_IPhysicsController.cpp | 48 - source/gameengine/Ketsji/KX_IPhysicsController.h | 139 - source/gameengine/Ketsji/KX_IScalarInterpolator.h | 51 - source/gameengine/Ketsji/KX_ISceneConverter.h | 96 - source/gameengine/Ketsji/KX_ISystem.h | 64 - source/gameengine/Ketsji/KX_IpoActuator.cpp | 453 - source/gameengine/Ketsji/KX_IpoActuator.h | 144 - source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 1918 ---- source/gameengine/Ketsji/KX_KetsjiEngine.h | 422 - source/gameengine/Ketsji/KX_Light.cpp | 389 - source/gameengine/Ketsji/KX_Light.h | 83 - .../gameengine/Ketsji/KX_LightIpoSGController.cpp | 118 - source/gameengine/Ketsji/KX_LightIpoSGController.h | 105 - .../gameengine/Ketsji/KX_MaterialIpoController.cpp | 97 - .../gameengine/Ketsji/KX_MaterialIpoController.h | 65 - source/gameengine/Ketsji/KX_MeshProxy.cpp | 311 - source/gameengine/Ketsji/KX_MeshProxy.h | 80 - source/gameengine/Ketsji/KX_MotionState.cpp | 103 - source/gameengine/Ketsji/KX_MotionState.h | 64 - source/gameengine/Ketsji/KX_MouseFocusSensor.cpp | 448 - source/gameengine/Ketsji/KX_MouseFocusSensor.h | 185 - source/gameengine/Ketsji/KX_NearSensor.cpp | 288 - source/gameengine/Ketsji/KX_NearSensor.h | 107 - .../Ketsji/KX_ObColorIpoSGController.cpp | 109 - .../gameengine/Ketsji/KX_ObColorIpoSGController.h | 80 - source/gameengine/Ketsji/KX_ObjectActuator.cpp | 639 -- source/gameengine/Ketsji/KX_ObjectActuator.h | 225 - .../Ketsji/KX_OrientationInterpolator.cpp | 51 - .../gameengine/Ketsji/KX_OrientationInterpolator.h | 63 - source/gameengine/Ketsji/KX_ParentActuator.cpp | 204 - source/gameengine/Ketsji/KX_ParentActuator.h | 95 - source/gameengine/Ketsji/KX_PhysicsEngineEnums.h | 44 - .../gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp | 142 - source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h | 57 - .../Ketsji/KX_PhysicsPropertiesobsolete.h | 58 - source/gameengine/Ketsji/KX_PolyProxy.cpp | 273 - source/gameengine/Ketsji/KX_PolyProxy.h | 73 - source/gameengine/Ketsji/KX_PolygonMaterial.cpp | 396 - source/gameengine/Ketsji/KX_PolygonMaterial.h | 149 - .../gameengine/Ketsji/KX_PositionInterpolator.cpp | 37 - source/gameengine/Ketsji/KX_PositionInterpolator.h | 63 - .../gameengine/Ketsji/KX_PyConstraintBinding.cpp | 663 -- source/gameengine/Ketsji/KX_PyConstraintBinding.h | 43 - source/gameengine/Ketsji/KX_PyMath.cpp | 193 - source/gameengine/Ketsji/KX_PyMath.h | 242 - source/gameengine/Ketsji/KX_PythonInit.cpp | 2417 ----- source/gameengine/Ketsji/KX_PythonInit.h | 76 - source/gameengine/Ketsji/KX_PythonInitTypes.cpp | 261 - source/gameengine/Ketsji/KX_PythonInitTypes.h | 37 - source/gameengine/Ketsji/KX_PythonSeq.cpp | 515 -- source/gameengine/Ketsji/KX_PythonSeq.h | 66 - source/gameengine/Ketsji/KX_RadarSensor.cpp | 215 - source/gameengine/Ketsji/KX_RadarSensor.h | 96 - source/gameengine/Ketsji/KX_RayCast.cpp | 119 - source/gameengine/Ketsji/KX_RayCast.h | 143 - source/gameengine/Ketsji/KX_RayEventManager.cpp | 49 - source/gameengine/Ketsji/KX_RayEventManager.h | 55 - source/gameengine/Ketsji/KX_RaySensor.cpp | 368 - source/gameengine/Ketsji/KX_RaySensor.h | 103 - .../gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp | 284 - .../gameengine/Ketsji/KX_SCA_AddObjectActuator.h | 138 - .../gameengine/Ketsji/KX_SCA_DynamicActuator.cpp | 158 - source/gameengine/Ketsji/KX_SCA_DynamicActuator.h | 76 - .../gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp | 121 - .../gameengine/Ketsji/KX_SCA_EndObjectActuator.h | 74 - .../Ketsji/KX_SCA_ReplaceMeshActuator.cpp | 177 - .../gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h | 98 - .../Ketsji/KX_SG_BoneParentNodeRelationship.cpp | 151 - .../Ketsji/KX_SG_BoneParentNodeRelationship.h | 111 - .../gameengine/Ketsji/KX_SG_NodeRelationships.cpp | 294 - source/gameengine/Ketsji/KX_SG_NodeRelationships.h | 241 - source/gameengine/Ketsji/KX_ScalarInterpolator.cpp | 34 - source/gameengine/Ketsji/KX_ScalarInterpolator.h | 68 - .../gameengine/Ketsji/KX_ScalingInterpolator.cpp | 37 - source/gameengine/Ketsji/KX_ScalingInterpolator.h | 63 - source/gameengine/Ketsji/KX_Scene.cpp | 2238 ----- source/gameengine/Ketsji/KX_Scene.h | 620 -- source/gameengine/Ketsji/KX_SceneActuator.cpp | 288 - source/gameengine/Ketsji/KX_SceneActuator.h | 111 - source/gameengine/Ketsji/KX_SoundActuator.cpp | 544 -- source/gameengine/Ketsji/KX_SoundActuator.h | 125 - source/gameengine/Ketsji/KX_StateActuator.cpp | 168 - source/gameengine/Ketsji/KX_StateActuator.h | 95 - source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp | 138 - source/gameengine/Ketsji/KX_TimeCategoryLogger.h | 137 - source/gameengine/Ketsji/KX_TimeLogger.cpp | 114 - source/gameengine/Ketsji/KX_TimeLogger.h | 115 - source/gameengine/Ketsji/KX_TouchEventManager.cpp | 180 - source/gameengine/Ketsji/KX_TouchEventManager.h | 88 - source/gameengine/Ketsji/KX_TouchSensor.cpp | 347 - source/gameengine/Ketsji/KX_TouchSensor.h | 135 - source/gameengine/Ketsji/KX_TrackToActuator.cpp | 491 -- source/gameengine/Ketsji/KX_TrackToActuator.h | 85 - source/gameengine/Ketsji/KX_VehicleWrapper.cpp | 322 - source/gameengine/Ketsji/KX_VehicleWrapper.h | 57 - source/gameengine/Ketsji/KX_VertexProxy.cpp | 444 - source/gameengine/Ketsji/KX_VertexProxy.h | 77 - source/gameengine/Ketsji/KX_VisibilityActuator.cpp | 124 - source/gameengine/Ketsji/KX_VisibilityActuator.h | 73 - source/gameengine/Ketsji/KX_WorldInfo.cpp | 34 - source/gameengine/Ketsji/KX_WorldInfo.h | 76 - source/gameengine/Ketsji/KX_WorldIpoController.cpp | 114 - source/gameengine/Ketsji/KX_WorldIpoController.h | 103 - source/gameengine/Ketsji/Makefile | 74 - source/gameengine/Ketsji/SConscript | 43 - source/gameengine/Makefile | 44 - source/gameengine/Network/CMakeLists.txt | 37 - .../Network/LoopBackNetwork/CMakeLists.txt | 37 - source/gameengine/Network/LoopBackNetwork/Makefile | 41 - .../NG_LoopBackNetworkDeviceInterface.cpp | 112 - .../NG_LoopBackNetworkDeviceInterface.h | 66 - .../gameengine/Network/LoopBackNetwork/SConscript | 8 - source/gameengine/Network/Makefile | 48 - .../gameengine/Network/NG_NetworkDeviceInterface.h | 89 - source/gameengine/Network/NG_NetworkMessage.cpp | 52 - source/gameengine/Network/NG_NetworkMessage.h | 139 - source/gameengine/Network/NG_NetworkObject.cpp | 43 - source/gameengine/Network/NG_NetworkObject.h | 56 - source/gameengine/Network/NG_NetworkScene.cpp | 268 - source/gameengine/Network/NG_NetworkScene.h | 117 - source/gameengine/Network/SConscript | 8 - .../gameengine/Network/TerraplayNetwork/Makefile | 42 - .../NG_TerraplayNetworkDeviceInterface.cpp | 189 - .../NG_TerraplayNetworkDeviceInterface.h | 66 - source/gameengine/Physics/Bullet/CMakeLists.txt | 50 - .../Physics/Bullet/CcdGraphicController.cpp | 149 - .../Physics/Bullet/CcdGraphicController.h | 88 - .../Physics/Bullet/CcdPhysicsController.cpp | 2165 ----- .../Physics/Bullet/CcdPhysicsController.h | 619 -- .../Physics/Bullet/CcdPhysicsEnvironment.cpp | 2721 ------ .../Physics/Bullet/CcdPhysicsEnvironment.h | 285 - source/gameengine/Physics/Bullet/Makefile | 55 - source/gameengine/Physics/Bullet/SConscript | 30 - source/gameengine/Physics/Dummy/CMakeLists.txt | 35 - .../Physics/Dummy/DummyPhysicsEnvironment.cpp | 112 - .../Physics/Dummy/DummyPhysicsEnvironment.h | 105 - source/gameengine/Physics/Dummy/Makefile | 45 - source/gameengine/Physics/Dummy/SConscript | 8 - source/gameengine/Physics/Makefile | 37 - source/gameengine/Physics/common/CMakeLists.txt | 36 - source/gameengine/Physics/common/Makefile | 57 - .../gameengine/Physics/common/PHY_DynamicTypes.h | 151 - .../gameengine/Physics/common/PHY_IController.cpp | 35 - source/gameengine/Physics/common/PHY_IController.h | 63 - .../Physics/common/PHY_IGraphicController.cpp | 35 - .../Physics/common/PHY_IGraphicController.h | 60 - .../gameengine/Physics/common/PHY_IMotionState.cpp | 34 - .../gameengine/Physics/common/PHY_IMotionState.h | 68 - .../Physics/common/PHY_IPhysicsController.cpp | 35 - .../Physics/common/PHY_IPhysicsController.h | 110 - .../Physics/common/PHY_IPhysicsEnvironment.cpp | 42 - .../Physics/common/PHY_IPhysicsEnvironment.h | 188 - source/gameengine/Physics/common/PHY_IVehicle.cpp | 7 - source/gameengine/Physics/common/PHY_IVehicle.h | 66 - source/gameengine/Physics/common/PHY_Pro.h | 60 - source/gameengine/Physics/common/SConscript | 8 - source/gameengine/PyDoc/API_intro.py | 110 - source/gameengine/PyDoc/PhysicsConstraints.py | 294 - source/gameengine/PyDoc/SConscript | 34 - source/gameengine/PyDoc/VideoTexture.py | 218 - source/gameengine/PyDoc/bge.events.rst | 194 - source/gameengine/PyDoc/bge.logic.rst | 622 -- source/gameengine/PyDoc/bge.render.rst | 231 - source/gameengine/PyDoc/bge.types.rst | 4339 --------- source/gameengine/PyDoc/bge_api_validate_py.txt | 136 - source/gameengine/PyDoc/epy_docgen.sh | 16 - source/gameengine/PyDoc/how_to_build_win.txt | 16 - source/gameengine/Rasterizer/CMakeLists.txt | 46 - source/gameengine/Rasterizer/Makefile | 61 - .../gameengine/Rasterizer/RAS_2DFilterManager.cpp | 520 -- source/gameengine/Rasterizer/RAS_2DFilterManager.h | 113 - source/gameengine/Rasterizer/RAS_BucketManager.cpp | 360 - source/gameengine/Rasterizer/RAS_BucketManager.h | 94 - source/gameengine/Rasterizer/RAS_CameraData.h | 65 - source/gameengine/Rasterizer/RAS_Deformer.h | 98 - .../gameengine/Rasterizer/RAS_FramingManager.cpp | 328 - source/gameengine/Rasterizer/RAS_FramingManager.h | 297 - source/gameengine/Rasterizer/RAS_ICanvas.h | 219 - .../gameengine/Rasterizer/RAS_IPolygonMaterial.cpp | 245 - .../gameengine/Rasterizer/RAS_IPolygonMaterial.h | 195 - source/gameengine/Rasterizer/RAS_IRasterizer.h | 424 - source/gameengine/Rasterizer/RAS_IRenderTools.cpp | 55 - source/gameengine/Rasterizer/RAS_IRenderTools.h | 191 - source/gameengine/Rasterizer/RAS_LightObject.h | 65 - .../gameengine/Rasterizer/RAS_MaterialBucket.cpp | 664 -- source/gameengine/Rasterizer/RAS_MaterialBucket.h | 261 - source/gameengine/Rasterizer/RAS_MeshObject.cpp | 616 -- source/gameengine/Rasterizer/RAS_MeshObject.h | 180 - source/gameengine/Rasterizer/RAS_ObjectColor.h | 39 - .../RAS_OpenGLFilters/RAS_Blur2DFilter.h | 51 - .../RAS_OpenGLFilters/RAS_Dilation2DFilter.h | 51 - .../RAS_OpenGLFilters/RAS_Erosion2DFilter.h | 50 - .../RAS_OpenGLFilters/RAS_GrayScale2DFilter.h | 41 - .../RAS_OpenGLFilters/RAS_Invert2DFilter.h | 41 - .../RAS_OpenGLFilters/RAS_Laplacian2DFilter.h | 53 - .../RAS_OpenGLFilters/RAS_Prewitt2DFilter.h | 58 - .../RAS_OpenGLFilters/RAS_Sepia2DFilter.h | 41 - .../RAS_OpenGLFilters/RAS_Sharpen2DFilter.h | 52 - .../RAS_OpenGLFilters/RAS_Sobel2DFilter.h | 57 - .../Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt | 47 - .../Rasterizer/RAS_OpenGLRasterizer/Makefile | 57 - .../RAS_GLExtensionManager.cpp | 67 - .../RAS_OpenGLRasterizer/RAS_GLExtensionManager.h | 42 - .../RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp | 308 - .../RAS_OpenGLRasterizer/RAS_ListRasterizer.h | 80 - .../RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 1155 --- .../RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h | 302 - .../RAS_VAOpenGLRasterizer.cpp | 380 - .../RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h | 70 - .../Rasterizer/RAS_OpenGLRasterizer/SConscript | 13 - source/gameengine/Rasterizer/RAS_Polygon.cpp | 134 - source/gameengine/Rasterizer/RAS_Polygon.h | 102 - source/gameengine/Rasterizer/RAS_Rect.h | 105 - source/gameengine/Rasterizer/RAS_TexMatrix.h | 40 - source/gameengine/Rasterizer/RAS_TexVert.cpp | 149 - source/gameengine/Rasterizer/RAS_TexVert.h | 150 - source/gameengine/Rasterizer/RAS_texmatrix.cpp | 127 - source/gameengine/Rasterizer/SConscript | 16 - source/gameengine/SConscript | 24 - source/gameengine/SceneGraph/CMakeLists.txt | 35 - source/gameengine/SceneGraph/Makefile | 38 - source/gameengine/SceneGraph/SConscript | 9 - source/gameengine/SceneGraph/SG_BBox.cpp | 257 - source/gameengine/SceneGraph/SG_BBox.h | 143 - source/gameengine/SceneGraph/SG_Controller.cpp | 46 - source/gameengine/SceneGraph/SG_Controller.h | 125 - source/gameengine/SceneGraph/SG_DList.h | 251 - source/gameengine/SceneGraph/SG_IObject.cpp | 95 - source/gameengine/SceneGraph/SG_IObject.h | 363 - source/gameengine/SceneGraph/SG_Node.cpp | 223 - source/gameengine/SceneGraph/SG_Node.h | 278 - source/gameengine/SceneGraph/SG_ParentRelation.h | 140 - source/gameengine/SceneGraph/SG_QList.h | 164 - source/gameengine/SceneGraph/SG_Spatial.cpp | 213 - source/gameengine/SceneGraph/SG_Spatial.h | 295 - source/gameengine/SceneGraph/SG_Tree.cpp | 411 - source/gameengine/SceneGraph/SG_Tree.h | 166 - source/gameengine/VideoTexture/BlendType.h | 77 - source/gameengine/VideoTexture/CMakeLists.txt | 67 - source/gameengine/VideoTexture/Common.h | 55 - source/gameengine/VideoTexture/Exception.cpp | 217 - source/gameengine/VideoTexture/Exception.h | 218 - source/gameengine/VideoTexture/FilterBase.cpp | 150 - source/gameengine/VideoTexture/FilterBase.h | 138 - .../gameengine/VideoTexture/FilterBlueScreen.cpp | 177 - source/gameengine/VideoTexture/FilterBlueScreen.h | 97 - source/gameengine/VideoTexture/FilterColor.cpp | 347 - source/gameengine/VideoTexture/FilterColor.h | 168 - source/gameengine/VideoTexture/FilterNormal.cpp | 166 - source/gameengine/VideoTexture/FilterNormal.h | 107 - source/gameengine/VideoTexture/FilterSource.cpp | 168 - source/gameengine/VideoTexture/FilterSource.h | 263 - source/gameengine/VideoTexture/ImageBase.cpp | 697 -- source/gameengine/VideoTexture/ImageBase.h | 356 - source/gameengine/VideoTexture/ImageBuff.cpp | 418 - source/gameengine/VideoTexture/ImageBuff.h | 61 - source/gameengine/VideoTexture/ImageMix.cpp | 209 - source/gameengine/VideoTexture/ImageMix.h | 123 - source/gameengine/VideoTexture/ImageRender.cpp | 755 -- source/gameengine/VideoTexture/ImageRender.h | 104 - source/gameengine/VideoTexture/ImageViewport.cpp | 348 - source/gameengine/VideoTexture/ImageViewport.h | 98 - source/gameengine/VideoTexture/Makefile | 68 - source/gameengine/VideoTexture/PyTypeList.cpp | 82 - source/gameengine/VideoTexture/PyTypeList.h | 85 - source/gameengine/VideoTexture/SConscript | 31 - source/gameengine/VideoTexture/Texture.cpp | 485 - source/gameengine/VideoTexture/Texture.h | 92 - source/gameengine/VideoTexture/VideoBase.cpp | 198 - source/gameengine/VideoTexture/VideoBase.h | 196 - source/gameengine/VideoTexture/VideoFFmpeg.cpp | 1357 --- source/gameengine/VideoTexture/VideoFFmpeg.h | 215 - source/gameengine/VideoTexture/blendVideoTex.cpp | 214 - 582 files changed, 132911 deletions(-) delete mode 100644 source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp delete mode 100644 source/gameengine/BlenderRoutines/CMakeLists.txt delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderCanvas.h delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderGL.cpp delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderGL.h delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderInputDevice.cpp delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp delete mode 100644 source/gameengine/BlenderRoutines/KX_BlenderSystem.h delete mode 100644 source/gameengine/BlenderRoutines/Makefile delete mode 100644 source/gameengine/BlenderRoutines/SConscript delete mode 100644 source/gameengine/CMakeLists.txt delete mode 100644 source/gameengine/Converter/BL_ActionActuator.cpp delete mode 100644 source/gameengine/Converter/BL_ActionActuator.h delete mode 100644 source/gameengine/Converter/BL_ArmatureActuator.cpp delete mode 100644 source/gameengine/Converter/BL_ArmatureActuator.h delete mode 100644 source/gameengine/Converter/BL_ArmatureChannel.cpp delete mode 100644 source/gameengine/Converter/BL_ArmatureChannel.h delete mode 100644 source/gameengine/Converter/BL_ArmatureConstraint.cpp delete mode 100644 source/gameengine/Converter/BL_ArmatureConstraint.h delete mode 100644 source/gameengine/Converter/BL_ArmatureObject.cpp delete mode 100644 source/gameengine/Converter/BL_ArmatureObject.h delete mode 100644 source/gameengine/Converter/BL_BlenderDataConversion.cpp delete mode 100644 source/gameengine/Converter/BL_BlenderDataConversion.h delete mode 100644 source/gameengine/Converter/BL_DeformableGameObject.cpp delete mode 100644 source/gameengine/Converter/BL_DeformableGameObject.h delete mode 100644 source/gameengine/Converter/BL_MeshDeformer.cpp delete mode 100644 source/gameengine/Converter/BL_MeshDeformer.h delete mode 100644 source/gameengine/Converter/BL_ModifierDeformer.cpp delete mode 100644 source/gameengine/Converter/BL_ModifierDeformer.h delete mode 100644 source/gameengine/Converter/BL_ShapeActionActuator.cpp delete mode 100644 source/gameengine/Converter/BL_ShapeActionActuator.h delete mode 100644 source/gameengine/Converter/BL_ShapeDeformer.cpp delete mode 100644 source/gameengine/Converter/BL_ShapeDeformer.h delete mode 100644 source/gameengine/Converter/BL_SkinDeformer.cpp delete mode 100644 source/gameengine/Converter/BL_SkinDeformer.h delete mode 100644 source/gameengine/Converter/BlenderWorldInfo.cpp delete mode 100644 source/gameengine/Converter/BlenderWorldInfo.h delete mode 100644 source/gameengine/Converter/CMakeLists.txt delete mode 100644 source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp delete mode 100644 source/gameengine/Converter/KX_BlenderScalarInterpolator.h delete mode 100644 source/gameengine/Converter/KX_BlenderSceneConverter.cpp delete mode 100644 source/gameengine/Converter/KX_BlenderSceneConverter.h delete mode 100644 source/gameengine/Converter/KX_ConvertActuators.cpp delete mode 100644 source/gameengine/Converter/KX_ConvertActuators.h delete mode 100644 source/gameengine/Converter/KX_ConvertControllers.cpp delete mode 100644 source/gameengine/Converter/KX_ConvertControllers.h delete mode 100644 source/gameengine/Converter/KX_ConvertProperties.cpp delete mode 100644 source/gameengine/Converter/KX_ConvertProperties.h delete mode 100644 source/gameengine/Converter/KX_ConvertSensors.cpp delete mode 100644 source/gameengine/Converter/KX_ConvertSensors.h delete mode 100644 source/gameengine/Converter/KX_IpoConvert.cpp delete mode 100644 source/gameengine/Converter/KX_IpoConvert.h delete mode 100644 source/gameengine/Converter/KX_SoftBodyDeformer.cpp delete mode 100644 source/gameengine/Converter/KX_SoftBodyDeformer.h delete mode 100644 source/gameengine/Converter/Makefile delete mode 100644 source/gameengine/Converter/SConscript delete mode 100644 source/gameengine/Expressions/BoolValue.cpp delete mode 100644 source/gameengine/Expressions/BoolValue.h delete mode 100644 source/gameengine/Expressions/CMakeLists.txt delete mode 100644 source/gameengine/Expressions/ConstExpr.cpp delete mode 100644 source/gameengine/Expressions/ConstExpr.h delete mode 100644 source/gameengine/Expressions/EXP_C-Api.cpp delete mode 100644 source/gameengine/Expressions/EXP_C-Api.h delete mode 100644 source/gameengine/Expressions/EmptyValue.cpp delete mode 100644 source/gameengine/Expressions/EmptyValue.h delete mode 100644 source/gameengine/Expressions/ErrorValue.cpp delete mode 100644 source/gameengine/Expressions/ErrorValue.h delete mode 100644 source/gameengine/Expressions/Expression.cpp delete mode 100644 source/gameengine/Expressions/Expression.h delete mode 100644 source/gameengine/Expressions/FloatValue.cpp delete mode 100644 source/gameengine/Expressions/FloatValue.h delete mode 100644 source/gameengine/Expressions/IdentifierExpr.cpp delete mode 100644 source/gameengine/Expressions/IdentifierExpr.h delete mode 100644 source/gameengine/Expressions/IfExpr.cpp delete mode 100644 source/gameengine/Expressions/IfExpr.h delete mode 100644 source/gameengine/Expressions/InputParser.cpp delete mode 100644 source/gameengine/Expressions/InputParser.h delete mode 100644 source/gameengine/Expressions/IntValue.cpp delete mode 100644 source/gameengine/Expressions/IntValue.h delete mode 100644 source/gameengine/Expressions/KX_HashedPtr.cpp delete mode 100644 source/gameengine/Expressions/KX_HashedPtr.h delete mode 100644 source/gameengine/Expressions/KX_Python.h delete mode 100644 source/gameengine/Expressions/ListValue.cpp delete mode 100644 source/gameengine/Expressions/ListValue.h delete mode 100644 source/gameengine/Expressions/Makefile delete mode 100644 source/gameengine/Expressions/Operator1Expr.cpp delete mode 100644 source/gameengine/Expressions/Operator1Expr.h delete mode 100644 source/gameengine/Expressions/Operator2Expr.cpp delete mode 100644 source/gameengine/Expressions/Operator2Expr.h delete mode 100644 source/gameengine/Expressions/PyObjectPlus.cpp delete mode 100644 source/gameengine/Expressions/PyObjectPlus.h delete mode 100644 source/gameengine/Expressions/SConscript delete mode 100644 source/gameengine/Expressions/StringValue.cpp delete mode 100644 source/gameengine/Expressions/StringValue.h delete mode 100644 source/gameengine/Expressions/Value.cpp delete mode 100644 source/gameengine/Expressions/Value.h delete mode 100644 source/gameengine/Expressions/VectorValue.cpp delete mode 100644 source/gameengine/Expressions/VectorValue.h delete mode 100644 source/gameengine/Expressions/VoidValue.h delete mode 100644 source/gameengine/GameLogic/CMakeLists.txt delete mode 100644 source/gameengine/GameLogic/Joystick/Makefile delete mode 100644 source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp delete mode 100644 source/gameengine/GameLogic/Joystick/SCA_Joystick.h delete mode 100644 source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h delete mode 100644 source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp delete mode 100644 source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h delete mode 100644 source/gameengine/GameLogic/Makefile delete mode 100644 source/gameengine/GameLogic/SCA_2DFilterActuator.cpp delete mode 100644 source/gameengine/GameLogic/SCA_2DFilterActuator.h delete mode 100644 source/gameengine/GameLogic/SCA_ANDController.cpp delete mode 100644 source/gameengine/GameLogic/SCA_ANDController.h delete mode 100644 source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_ActuatorEventManager.h delete mode 100644 source/gameengine/GameLogic/SCA_ActuatorSensor.cpp delete mode 100644 source/gameengine/GameLogic/SCA_ActuatorSensor.h delete mode 100644 source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_AlwaysEventManager.h delete mode 100644 source/gameengine/GameLogic/SCA_AlwaysSensor.cpp delete mode 100644 source/gameengine/GameLogic/SCA_AlwaysSensor.h delete mode 100644 source/gameengine/GameLogic/SCA_BasicEventManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_BasicEventManager.h delete mode 100644 source/gameengine/GameLogic/SCA_DelaySensor.cpp delete mode 100644 source/gameengine/GameLogic/SCA_DelaySensor.h delete mode 100644 source/gameengine/GameLogic/SCA_EventManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_EventManager.h delete mode 100644 source/gameengine/GameLogic/SCA_ExpressionController.cpp delete mode 100644 source/gameengine/GameLogic/SCA_ExpressionController.h delete mode 100644 source/gameengine/GameLogic/SCA_IActuator.cpp delete mode 100644 source/gameengine/GameLogic/SCA_IActuator.h delete mode 100644 source/gameengine/GameLogic/SCA_IController.cpp delete mode 100644 source/gameengine/GameLogic/SCA_IController.h delete mode 100644 source/gameengine/GameLogic/SCA_IInputDevice.cpp delete mode 100644 source/gameengine/GameLogic/SCA_IInputDevice.h delete mode 100644 source/gameengine/GameLogic/SCA_ILogicBrick.cpp delete mode 100644 source/gameengine/GameLogic/SCA_ILogicBrick.h delete mode 100644 source/gameengine/GameLogic/SCA_IObject.cpp delete mode 100644 source/gameengine/GameLogic/SCA_IObject.h delete mode 100644 source/gameengine/GameLogic/SCA_IScene.cpp delete mode 100644 source/gameengine/GameLogic/SCA_IScene.h delete mode 100644 source/gameengine/GameLogic/SCA_ISensor.cpp delete mode 100644 source/gameengine/GameLogic/SCA_ISensor.h delete mode 100644 source/gameengine/GameLogic/SCA_JoystickManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_JoystickManager.h delete mode 100644 source/gameengine/GameLogic/SCA_JoystickSensor.cpp delete mode 100644 source/gameengine/GameLogic/SCA_JoystickSensor.h delete mode 100644 source/gameengine/GameLogic/SCA_KeyboardManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_KeyboardManager.h delete mode 100644 source/gameengine/GameLogic/SCA_KeyboardSensor.cpp delete mode 100644 source/gameengine/GameLogic/SCA_KeyboardSensor.h delete mode 100644 source/gameengine/GameLogic/SCA_LogicManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_LogicManager.h delete mode 100644 source/gameengine/GameLogic/SCA_MouseManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_MouseManager.h delete mode 100644 source/gameengine/GameLogic/SCA_MouseSensor.cpp delete mode 100644 source/gameengine/GameLogic/SCA_MouseSensor.h delete mode 100644 source/gameengine/GameLogic/SCA_NANDController.cpp delete mode 100644 source/gameengine/GameLogic/SCA_NANDController.h delete mode 100644 source/gameengine/GameLogic/SCA_NORController.cpp delete mode 100644 source/gameengine/GameLogic/SCA_NORController.h delete mode 100644 source/gameengine/GameLogic/SCA_ORController.cpp delete mode 100644 source/gameengine/GameLogic/SCA_ORController.h delete mode 100644 source/gameengine/GameLogic/SCA_PropertyActuator.cpp delete mode 100644 source/gameengine/GameLogic/SCA_PropertyActuator.h delete mode 100644 source/gameengine/GameLogic/SCA_PropertyEventManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_PropertyEventManager.h delete mode 100644 source/gameengine/GameLogic/SCA_PropertySensor.cpp delete mode 100644 source/gameengine/GameLogic/SCA_PropertySensor.h delete mode 100644 source/gameengine/GameLogic/SCA_PythonController.cpp delete mode 100644 source/gameengine/GameLogic/SCA_PythonController.h delete mode 100644 source/gameengine/GameLogic/SCA_PythonKeyboard.cpp delete mode 100644 source/gameengine/GameLogic/SCA_PythonKeyboard.h delete mode 100644 source/gameengine/GameLogic/SCA_PythonMouse.cpp delete mode 100644 source/gameengine/GameLogic/SCA_PythonMouse.h delete mode 100644 source/gameengine/GameLogic/SCA_RandomActuator.cpp delete mode 100644 source/gameengine/GameLogic/SCA_RandomActuator.h delete mode 100644 source/gameengine/GameLogic/SCA_RandomEventManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_RandomEventManager.h delete mode 100644 source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp delete mode 100644 source/gameengine/GameLogic/SCA_RandomNumberGenerator.h delete mode 100644 source/gameengine/GameLogic/SCA_RandomSensor.cpp delete mode 100644 source/gameengine/GameLogic/SCA_RandomSensor.h delete mode 100644 source/gameengine/GameLogic/SCA_TimeEventManager.cpp delete mode 100644 source/gameengine/GameLogic/SCA_TimeEventManager.h delete mode 100644 source/gameengine/GameLogic/SCA_XNORController.cpp delete mode 100644 source/gameengine/GameLogic/SCA_XNORController.h delete mode 100644 source/gameengine/GameLogic/SCA_XORController.cpp delete mode 100644 source/gameengine/GameLogic/SCA_XORController.h delete mode 100644 source/gameengine/GameLogic/SConscript delete mode 100644 source/gameengine/GamePlayer/CMakeLists.txt delete mode 100644 source/gameengine/GamePlayer/Makefile delete mode 100644 source/gameengine/GamePlayer/SConscript delete mode 100644 source/gameengine/GamePlayer/common/CMakeLists.txt delete mode 100644 source/gameengine/GamePlayer/common/GPC_Canvas.cpp delete mode 100644 source/gameengine/GamePlayer/common/GPC_Canvas.h delete mode 100644 source/gameengine/GamePlayer/common/GPC_Engine.cpp delete mode 100644 source/gameengine/GamePlayer/common/GPC_Engine.h delete mode 100644 source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp delete mode 100644 source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h delete mode 100644 source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp delete mode 100644 source/gameengine/GamePlayer/common/GPC_MouseDevice.h delete mode 100644 source/gameengine/GamePlayer/common/GPC_RawImage.cpp delete mode 100644 source/gameengine/GamePlayer/common/GPC_RawImage.h delete mode 100644 source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp delete mode 100644 source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h delete mode 100644 source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp delete mode 100644 source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h delete mode 100644 source/gameengine/GamePlayer/common/GPC_RenderTools.cpp delete mode 100644 source/gameengine/GamePlayer/common/GPC_RenderTools.h delete mode 100644 source/gameengine/GamePlayer/common/GPC_System.cpp delete mode 100644 source/gameengine/GamePlayer/common/GPC_System.h delete mode 100644 source/gameengine/GamePlayer/common/Makefile delete mode 100644 source/gameengine/GamePlayer/common/SConscript delete mode 100644 source/gameengine/GamePlayer/common/bmfont.cpp delete mode 100644 source/gameengine/GamePlayer/common/load.blend delete mode 100644 source/gameengine/GamePlayer/common/logo_blender.raw delete mode 100644 source/gameengine/GamePlayer/common/logo_blender3d.raw delete mode 100644 source/gameengine/GamePlayer/common/logo_nan.raw delete mode 100644 source/gameengine/GamePlayer/common/unix/GPU_Canvas.cpp delete mode 100644 source/gameengine/GamePlayer/common/unix/GPU_Canvas.h delete mode 100644 source/gameengine/GamePlayer/common/unix/GPU_Engine.cpp delete mode 100644 source/gameengine/GamePlayer/common/unix/GPU_Engine.h delete mode 100644 source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.cpp delete mode 100644 source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.h delete mode 100644 source/gameengine/GamePlayer/common/unix/GPU_PolygonMaterial.h delete mode 100644 source/gameengine/GamePlayer/common/unix/GPU_System.cpp delete mode 100644 source/gameengine/GamePlayer/common/unix/GPU_System.h delete mode 100644 source/gameengine/GamePlayer/common/unix/Makefile delete mode 100644 source/gameengine/GamePlayer/common/windows/GPW_Canvas.cpp delete mode 100644 source/gameengine/GamePlayer/common/windows/GPW_Canvas.h delete mode 100644 source/gameengine/GamePlayer/common/windows/GPW_Engine.cpp delete mode 100644 source/gameengine/GamePlayer/common/windows/GPW_Engine.h delete mode 100644 source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.cpp delete mode 100644 source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.h delete mode 100644 source/gameengine/GamePlayer/common/windows/GPW_System.cpp delete mode 100644 source/gameengine/GamePlayer/common/windows/GPW_System.h delete mode 100644 source/gameengine/GamePlayer/common/windows/Makefile delete mode 100644 source/gameengine/GamePlayer/ghost/CMakeLists.txt delete mode 100644 source/gameengine/GamePlayer/ghost/GPG_Application.cpp delete mode 100644 source/gameengine/GamePlayer/ghost/GPG_Application.h delete mode 100644 source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp delete mode 100644 source/gameengine/GamePlayer/ghost/GPG_Canvas.h delete mode 100644 source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp delete mode 100644 source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h delete mode 100644 source/gameengine/GamePlayer/ghost/GPG_System.cpp delete mode 100644 source/gameengine/GamePlayer/ghost/GPG_System.h delete mode 100644 source/gameengine/GamePlayer/ghost/GPG_ghost.cpp delete mode 100644 source/gameengine/GamePlayer/ghost/Makefile delete mode 100644 source/gameengine/GamePlayer/ghost/SConscript delete mode 100644 source/gameengine/Ketsji/BL_BlenderShader.cpp delete mode 100644 source/gameengine/Ketsji/BL_BlenderShader.h delete mode 100644 source/gameengine/Ketsji/BL_Material.cpp delete mode 100644 source/gameengine/Ketsji/BL_Material.h delete mode 100644 source/gameengine/Ketsji/BL_Shader.cpp delete mode 100644 source/gameengine/Ketsji/BL_Shader.h delete mode 100644 source/gameengine/Ketsji/BL_Texture.cpp delete mode 100644 source/gameengine/Ketsji/BL_Texture.h delete mode 100644 source/gameengine/Ketsji/CMakeLists.txt delete mode 100644 source/gameengine/Ketsji/KXNetwork/CMakeLists.txt delete mode 100644 source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp delete mode 100644 source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h delete mode 100644 source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp delete mode 100644 source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h delete mode 100644 source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp delete mode 100644 source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h delete mode 100644 source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp delete mode 100644 source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.h delete mode 100644 source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp delete mode 100644 source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.h delete mode 100644 source/gameengine/Ketsji/KXNetwork/Makefile delete mode 100644 source/gameengine/Ketsji/KXNetwork/SConscript delete mode 100644 source/gameengine/Ketsji/KX_ArmatureSensor.cpp delete mode 100644 source/gameengine/Ketsji/KX_ArmatureSensor.h delete mode 100644 source/gameengine/Ketsji/KX_BlenderMaterial.cpp delete mode 100644 source/gameengine/Ketsji/KX_BlenderMaterial.h delete mode 100644 source/gameengine/Ketsji/KX_BulletPhysicsController.cpp delete mode 100644 source/gameengine/Ketsji/KX_BulletPhysicsController.h delete mode 100644 source/gameengine/Ketsji/KX_Camera.cpp delete mode 100644 source/gameengine/Ketsji/KX_Camera.h delete mode 100644 source/gameengine/Ketsji/KX_CameraActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_CameraActuator.h delete mode 100644 source/gameengine/Ketsji/KX_CameraIpoSGController.cpp delete mode 100644 source/gameengine/Ketsji/KX_CameraIpoSGController.h delete mode 100644 source/gameengine/Ketsji/KX_ClientObjectInfo.h delete mode 100644 source/gameengine/Ketsji/KX_ConstraintActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_ConstraintActuator.h delete mode 100644 source/gameengine/Ketsji/KX_ConstraintWrapper.cpp delete mode 100644 source/gameengine/Ketsji/KX_ConstraintWrapper.h delete mode 100644 source/gameengine/Ketsji/KX_ConvertPhysicsObject.h delete mode 100644 source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp delete mode 100644 source/gameengine/Ketsji/KX_Dome.cpp delete mode 100644 source/gameengine/Ketsji/KX_Dome.h delete mode 100644 source/gameengine/Ketsji/KX_EmptyObject.cpp delete mode 100644 source/gameengine/Ketsji/KX_EmptyObject.h delete mode 100644 source/gameengine/Ketsji/KX_GameActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_GameActuator.h delete mode 100644 source/gameengine/Ketsji/KX_GameObject.cpp delete mode 100644 source/gameengine/Ketsji/KX_GameObject.h delete mode 100644 source/gameengine/Ketsji/KX_IInterpolator.h delete mode 100644 source/gameengine/Ketsji/KX_IPOTransform.h delete mode 100644 source/gameengine/Ketsji/KX_IPO_SGController.cpp delete mode 100644 source/gameengine/Ketsji/KX_IPO_SGController.h delete mode 100644 source/gameengine/Ketsji/KX_IPhysicsController.cpp delete mode 100644 source/gameengine/Ketsji/KX_IPhysicsController.h delete mode 100644 source/gameengine/Ketsji/KX_IScalarInterpolator.h delete mode 100644 source/gameengine/Ketsji/KX_ISceneConverter.h delete mode 100644 source/gameengine/Ketsji/KX_ISystem.h delete mode 100644 source/gameengine/Ketsji/KX_IpoActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_IpoActuator.h delete mode 100644 source/gameengine/Ketsji/KX_KetsjiEngine.cpp delete mode 100644 source/gameengine/Ketsji/KX_KetsjiEngine.h delete mode 100644 source/gameengine/Ketsji/KX_Light.cpp delete mode 100644 source/gameengine/Ketsji/KX_Light.h delete mode 100644 source/gameengine/Ketsji/KX_LightIpoSGController.cpp delete mode 100644 source/gameengine/Ketsji/KX_LightIpoSGController.h delete mode 100644 source/gameengine/Ketsji/KX_MaterialIpoController.cpp delete mode 100644 source/gameengine/Ketsji/KX_MaterialIpoController.h delete mode 100644 source/gameengine/Ketsji/KX_MeshProxy.cpp delete mode 100644 source/gameengine/Ketsji/KX_MeshProxy.h delete mode 100644 source/gameengine/Ketsji/KX_MotionState.cpp delete mode 100644 source/gameengine/Ketsji/KX_MotionState.h delete mode 100644 source/gameengine/Ketsji/KX_MouseFocusSensor.cpp delete mode 100644 source/gameengine/Ketsji/KX_MouseFocusSensor.h delete mode 100644 source/gameengine/Ketsji/KX_NearSensor.cpp delete mode 100644 source/gameengine/Ketsji/KX_NearSensor.h delete mode 100644 source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp delete mode 100644 source/gameengine/Ketsji/KX_ObColorIpoSGController.h delete mode 100644 source/gameengine/Ketsji/KX_ObjectActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_ObjectActuator.h delete mode 100644 source/gameengine/Ketsji/KX_OrientationInterpolator.cpp delete mode 100644 source/gameengine/Ketsji/KX_OrientationInterpolator.h delete mode 100644 source/gameengine/Ketsji/KX_ParentActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_ParentActuator.h delete mode 100644 source/gameengine/Ketsji/KX_PhysicsEngineEnums.h delete mode 100644 source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp delete mode 100644 source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h delete mode 100644 source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h delete mode 100644 source/gameengine/Ketsji/KX_PolyProxy.cpp delete mode 100644 source/gameengine/Ketsji/KX_PolyProxy.h delete mode 100644 source/gameengine/Ketsji/KX_PolygonMaterial.cpp delete mode 100644 source/gameengine/Ketsji/KX_PolygonMaterial.h delete mode 100644 source/gameengine/Ketsji/KX_PositionInterpolator.cpp delete mode 100644 source/gameengine/Ketsji/KX_PositionInterpolator.h delete mode 100644 source/gameengine/Ketsji/KX_PyConstraintBinding.cpp delete mode 100644 source/gameengine/Ketsji/KX_PyConstraintBinding.h delete mode 100644 source/gameengine/Ketsji/KX_PyMath.cpp delete mode 100644 source/gameengine/Ketsji/KX_PyMath.h delete mode 100644 source/gameengine/Ketsji/KX_PythonInit.cpp delete mode 100644 source/gameengine/Ketsji/KX_PythonInit.h delete mode 100644 source/gameengine/Ketsji/KX_PythonInitTypes.cpp delete mode 100644 source/gameengine/Ketsji/KX_PythonInitTypes.h delete mode 100644 source/gameengine/Ketsji/KX_PythonSeq.cpp delete mode 100644 source/gameengine/Ketsji/KX_PythonSeq.h delete mode 100644 source/gameengine/Ketsji/KX_RadarSensor.cpp delete mode 100644 source/gameengine/Ketsji/KX_RadarSensor.h delete mode 100644 source/gameengine/Ketsji/KX_RayCast.cpp delete mode 100644 source/gameengine/Ketsji/KX_RayCast.h delete mode 100644 source/gameengine/Ketsji/KX_RayEventManager.cpp delete mode 100644 source/gameengine/Ketsji/KX_RayEventManager.h delete mode 100644 source/gameengine/Ketsji/KX_RaySensor.cpp delete mode 100644 source/gameengine/Ketsji/KX_RaySensor.h delete mode 100644 source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h delete mode 100644 source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_SCA_DynamicActuator.h delete mode 100644 source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h delete mode 100644 source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h delete mode 100644 source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp delete mode 100644 source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h delete mode 100644 source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp delete mode 100644 source/gameengine/Ketsji/KX_SG_NodeRelationships.h delete mode 100644 source/gameengine/Ketsji/KX_ScalarInterpolator.cpp delete mode 100644 source/gameengine/Ketsji/KX_ScalarInterpolator.h delete mode 100644 source/gameengine/Ketsji/KX_ScalingInterpolator.cpp delete mode 100644 source/gameengine/Ketsji/KX_ScalingInterpolator.h delete mode 100644 source/gameengine/Ketsji/KX_Scene.cpp delete mode 100644 source/gameengine/Ketsji/KX_Scene.h delete mode 100644 source/gameengine/Ketsji/KX_SceneActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_SceneActuator.h delete mode 100644 source/gameengine/Ketsji/KX_SoundActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_SoundActuator.h delete mode 100644 source/gameengine/Ketsji/KX_StateActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_StateActuator.h delete mode 100644 source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp delete mode 100644 source/gameengine/Ketsji/KX_TimeCategoryLogger.h delete mode 100644 source/gameengine/Ketsji/KX_TimeLogger.cpp delete mode 100644 source/gameengine/Ketsji/KX_TimeLogger.h delete mode 100644 source/gameengine/Ketsji/KX_TouchEventManager.cpp delete mode 100644 source/gameengine/Ketsji/KX_TouchEventManager.h delete mode 100644 source/gameengine/Ketsji/KX_TouchSensor.cpp delete mode 100644 source/gameengine/Ketsji/KX_TouchSensor.h delete mode 100644 source/gameengine/Ketsji/KX_TrackToActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_TrackToActuator.h delete mode 100644 source/gameengine/Ketsji/KX_VehicleWrapper.cpp delete mode 100644 source/gameengine/Ketsji/KX_VehicleWrapper.h delete mode 100644 source/gameengine/Ketsji/KX_VertexProxy.cpp delete mode 100644 source/gameengine/Ketsji/KX_VertexProxy.h delete mode 100644 source/gameengine/Ketsji/KX_VisibilityActuator.cpp delete mode 100644 source/gameengine/Ketsji/KX_VisibilityActuator.h delete mode 100644 source/gameengine/Ketsji/KX_WorldInfo.cpp delete mode 100644 source/gameengine/Ketsji/KX_WorldInfo.h delete mode 100644 source/gameengine/Ketsji/KX_WorldIpoController.cpp delete mode 100644 source/gameengine/Ketsji/KX_WorldIpoController.h delete mode 100644 source/gameengine/Ketsji/Makefile delete mode 100644 source/gameengine/Ketsji/SConscript delete mode 100644 source/gameengine/Makefile delete mode 100644 source/gameengine/Network/CMakeLists.txt delete mode 100644 source/gameengine/Network/LoopBackNetwork/CMakeLists.txt delete mode 100644 source/gameengine/Network/LoopBackNetwork/Makefile delete mode 100644 source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp delete mode 100644 source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h delete mode 100644 source/gameengine/Network/LoopBackNetwork/SConscript delete mode 100644 source/gameengine/Network/Makefile delete mode 100644 source/gameengine/Network/NG_NetworkDeviceInterface.h delete mode 100644 source/gameengine/Network/NG_NetworkMessage.cpp delete mode 100644 source/gameengine/Network/NG_NetworkMessage.h delete mode 100644 source/gameengine/Network/NG_NetworkObject.cpp delete mode 100644 source/gameengine/Network/NG_NetworkObject.h delete mode 100644 source/gameengine/Network/NG_NetworkScene.cpp delete mode 100644 source/gameengine/Network/NG_NetworkScene.h delete mode 100644 source/gameengine/Network/SConscript delete mode 100644 source/gameengine/Network/TerraplayNetwork/Makefile delete mode 100644 source/gameengine/Network/TerraplayNetwork/NG_TerraplayNetworkDeviceInterface.cpp delete mode 100644 source/gameengine/Network/TerraplayNetwork/NG_TerraplayNetworkDeviceInterface.h delete mode 100644 source/gameengine/Physics/Bullet/CMakeLists.txt delete mode 100644 source/gameengine/Physics/Bullet/CcdGraphicController.cpp delete mode 100644 source/gameengine/Physics/Bullet/CcdGraphicController.h delete mode 100644 source/gameengine/Physics/Bullet/CcdPhysicsController.cpp delete mode 100644 source/gameengine/Physics/Bullet/CcdPhysicsController.h delete mode 100644 source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp delete mode 100644 source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h delete mode 100644 source/gameengine/Physics/Bullet/Makefile delete mode 100644 source/gameengine/Physics/Bullet/SConscript delete mode 100644 source/gameengine/Physics/Dummy/CMakeLists.txt delete mode 100644 source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp delete mode 100644 source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h delete mode 100644 source/gameengine/Physics/Dummy/Makefile delete mode 100644 source/gameengine/Physics/Dummy/SConscript delete mode 100644 source/gameengine/Physics/Makefile delete mode 100644 source/gameengine/Physics/common/CMakeLists.txt delete mode 100644 source/gameengine/Physics/common/Makefile delete mode 100644 source/gameengine/Physics/common/PHY_DynamicTypes.h delete mode 100644 source/gameengine/Physics/common/PHY_IController.cpp delete mode 100644 source/gameengine/Physics/common/PHY_IController.h delete mode 100644 source/gameengine/Physics/common/PHY_IGraphicController.cpp delete mode 100644 source/gameengine/Physics/common/PHY_IGraphicController.h delete mode 100644 source/gameengine/Physics/common/PHY_IMotionState.cpp delete mode 100644 source/gameengine/Physics/common/PHY_IMotionState.h delete mode 100644 source/gameengine/Physics/common/PHY_IPhysicsController.cpp delete mode 100644 source/gameengine/Physics/common/PHY_IPhysicsController.h delete mode 100644 source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp delete mode 100644 source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h delete mode 100644 source/gameengine/Physics/common/PHY_IVehicle.cpp delete mode 100644 source/gameengine/Physics/common/PHY_IVehicle.h delete mode 100644 source/gameengine/Physics/common/PHY_Pro.h delete mode 100644 source/gameengine/Physics/common/SConscript delete mode 100644 source/gameengine/PyDoc/API_intro.py delete mode 100644 source/gameengine/PyDoc/PhysicsConstraints.py delete mode 100644 source/gameengine/PyDoc/SConscript delete mode 100644 source/gameengine/PyDoc/VideoTexture.py delete mode 100644 source/gameengine/PyDoc/bge.events.rst delete mode 100644 source/gameengine/PyDoc/bge.logic.rst delete mode 100644 source/gameengine/PyDoc/bge.render.rst delete mode 100644 source/gameengine/PyDoc/bge.types.rst delete mode 100644 source/gameengine/PyDoc/bge_api_validate_py.txt delete mode 100755 source/gameengine/PyDoc/epy_docgen.sh delete mode 100644 source/gameengine/PyDoc/how_to_build_win.txt delete mode 100644 source/gameengine/Rasterizer/CMakeLists.txt delete mode 100644 source/gameengine/Rasterizer/Makefile delete mode 100644 source/gameengine/Rasterizer/RAS_2DFilterManager.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_2DFilterManager.h delete mode 100644 source/gameengine/Rasterizer/RAS_BucketManager.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_BucketManager.h delete mode 100644 source/gameengine/Rasterizer/RAS_CameraData.h delete mode 100644 source/gameengine/Rasterizer/RAS_Deformer.h delete mode 100644 source/gameengine/Rasterizer/RAS_FramingManager.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_FramingManager.h delete mode 100644 source/gameengine/Rasterizer/RAS_ICanvas.h delete mode 100644 source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_IPolygonMaterial.h delete mode 100644 source/gameengine/Rasterizer/RAS_IRasterizer.h delete mode 100644 source/gameengine/Rasterizer/RAS_IRenderTools.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_IRenderTools.h delete mode 100644 source/gameengine/Rasterizer/RAS_LightObject.h delete mode 100644 source/gameengine/Rasterizer/RAS_MaterialBucket.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_MaterialBucket.h delete mode 100644 source/gameengine/Rasterizer/RAS_MeshObject.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_MeshObject.h delete mode 100644 source/gameengine/Rasterizer/RAS_ObjectColor.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript delete mode 100644 source/gameengine/Rasterizer/RAS_Polygon.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_Polygon.h delete mode 100644 source/gameengine/Rasterizer/RAS_Rect.h delete mode 100644 source/gameengine/Rasterizer/RAS_TexMatrix.h delete mode 100644 source/gameengine/Rasterizer/RAS_TexVert.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_TexVert.h delete mode 100644 source/gameengine/Rasterizer/RAS_texmatrix.cpp delete mode 100644 source/gameengine/Rasterizer/SConscript delete mode 100644 source/gameengine/SConscript delete mode 100644 source/gameengine/SceneGraph/CMakeLists.txt delete mode 100644 source/gameengine/SceneGraph/Makefile delete mode 100644 source/gameengine/SceneGraph/SConscript delete mode 100644 source/gameengine/SceneGraph/SG_BBox.cpp delete mode 100644 source/gameengine/SceneGraph/SG_BBox.h delete mode 100644 source/gameengine/SceneGraph/SG_Controller.cpp delete mode 100644 source/gameengine/SceneGraph/SG_Controller.h delete mode 100644 source/gameengine/SceneGraph/SG_DList.h delete mode 100644 source/gameengine/SceneGraph/SG_IObject.cpp delete mode 100644 source/gameengine/SceneGraph/SG_IObject.h delete mode 100644 source/gameengine/SceneGraph/SG_Node.cpp delete mode 100644 source/gameengine/SceneGraph/SG_Node.h delete mode 100644 source/gameengine/SceneGraph/SG_ParentRelation.h delete mode 100644 source/gameengine/SceneGraph/SG_QList.h delete mode 100644 source/gameengine/SceneGraph/SG_Spatial.cpp delete mode 100644 source/gameengine/SceneGraph/SG_Spatial.h delete mode 100644 source/gameengine/SceneGraph/SG_Tree.cpp delete mode 100644 source/gameengine/SceneGraph/SG_Tree.h delete mode 100644 source/gameengine/VideoTexture/BlendType.h delete mode 100644 source/gameengine/VideoTexture/CMakeLists.txt delete mode 100644 source/gameengine/VideoTexture/Common.h delete mode 100644 source/gameengine/VideoTexture/Exception.cpp delete mode 100644 source/gameengine/VideoTexture/Exception.h delete mode 100644 source/gameengine/VideoTexture/FilterBase.cpp delete mode 100644 source/gameengine/VideoTexture/FilterBase.h delete mode 100644 source/gameengine/VideoTexture/FilterBlueScreen.cpp delete mode 100644 source/gameengine/VideoTexture/FilterBlueScreen.h delete mode 100644 source/gameengine/VideoTexture/FilterColor.cpp delete mode 100644 source/gameengine/VideoTexture/FilterColor.h delete mode 100644 source/gameengine/VideoTexture/FilterNormal.cpp delete mode 100644 source/gameengine/VideoTexture/FilterNormal.h delete mode 100644 source/gameengine/VideoTexture/FilterSource.cpp delete mode 100644 source/gameengine/VideoTexture/FilterSource.h delete mode 100644 source/gameengine/VideoTexture/ImageBase.cpp delete mode 100644 source/gameengine/VideoTexture/ImageBase.h delete mode 100644 source/gameengine/VideoTexture/ImageBuff.cpp delete mode 100644 source/gameengine/VideoTexture/ImageBuff.h delete mode 100644 source/gameengine/VideoTexture/ImageMix.cpp delete mode 100644 source/gameengine/VideoTexture/ImageMix.h delete mode 100644 source/gameengine/VideoTexture/ImageRender.cpp delete mode 100644 source/gameengine/VideoTexture/ImageRender.h delete mode 100644 source/gameengine/VideoTexture/ImageViewport.cpp delete mode 100644 source/gameengine/VideoTexture/ImageViewport.h delete mode 100644 source/gameengine/VideoTexture/Makefile delete mode 100644 source/gameengine/VideoTexture/PyTypeList.cpp delete mode 100644 source/gameengine/VideoTexture/PyTypeList.h delete mode 100644 source/gameengine/VideoTexture/SConscript delete mode 100644 source/gameengine/VideoTexture/Texture.cpp delete mode 100644 source/gameengine/VideoTexture/Texture.h delete mode 100644 source/gameengine/VideoTexture/VideoBase.cpp delete mode 100644 source/gameengine/VideoTexture/VideoBase.h delete mode 100644 source/gameengine/VideoTexture/VideoFFmpeg.cpp delete mode 100644 source/gameengine/VideoTexture/VideoFFmpeg.h delete mode 100644 source/gameengine/VideoTexture/blendVideoTex.cpp (limited to 'source/gameengine') diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp deleted file mode 100644 index 5b7ceaa296c..00000000000 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ /dev/null @@ -1,568 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Blender's Ketsji startpoint - */ - -#include -#include -#include - -#ifdef WIN32 -// don't show stl-warnings -#pragma warning (disable:4786) -#endif - -#include "GL/glew.h" - -#include "KX_BlenderGL.h" -#include "KX_BlenderCanvas.h" -#include "KX_BlenderKeyboardDevice.h" -#include "KX_BlenderMouseDevice.h" -#include "KX_BlenderRenderTools.h" -#include "KX_BlenderSystem.h" -#include "BL_Material.h" - -#include "KX_KetsjiEngine.h" -#include "KX_BlenderSceneConverter.h" -#include "KX_PythonInit.h" -#include "KX_PyConstraintBinding.h" - -#include "RAS_GLExtensionManager.h" -#include "RAS_OpenGLRasterizer.h" -#include "RAS_VAOpenGLRasterizer.h" -#include "RAS_ListRasterizer.h" - -#include "NG_LoopBackNetworkDeviceInterface.h" - -#include "SYS_System.h" - -#include "GPU_extensions.h" -#include "Value.h" - - - -#ifdef __cplusplus -extern "C" { -#endif - /***/ -#include "DNA_view3d_types.h" -#include "DNA_screen_types.h" -#include "DNA_windowmanager_types.h" -#include "BKE_global.h" -#include "BKE_report.h" - -#include "BKE_utildefines.h" -//XXX #include "BIF_screen.h" -//XXX #include "BIF_scrarea.h" - -#include "BKE_main.h" -#include "BLI_blenlib.h" -#include "BLO_readfile.h" -#include "DNA_scene_types.h" - /***/ - -#include "AUD_C-API.h" - -//XXX #include "BSE_headerbuttons.h" -#include "BKE_context.h" -#include "../../blender/windowmanager/WM_types.h" -#include "../../blender/windowmanager/wm_window.h" -#include "../../blender/windowmanager/wm_event_system.h" -#ifdef __cplusplus -} -#endif - - -static BlendFileData *load_game_data(char *filename) -{ - ReportList reports; - BlendFileData *bfd; - - BKE_reports_init(&reports, RPT_STORE); - bfd= BLO_read_from_file(filename, &reports); - - if (!bfd) { - printf("Loading %s failed: ", filename); - BKE_reports_print(&reports, RPT_ERROR); - } - - BKE_reports_clear(&reports); - - return bfd; -} - -extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *cam_frame, int always_use_expand_framing) -{ - /* context values */ - struct wmWindow *win= CTX_wm_window(C); - struct Scene *scene= CTX_data_scene(C); - struct Main* maggie1= CTX_data_main(C); - - - RAS_Rect area_rect; - area_rect.SetLeft(cam_frame->xmin); - area_rect.SetBottom(cam_frame->ymin); - area_rect.SetRight(cam_frame->xmax); - area_rect.SetTop(cam_frame->ymax); - - int exitrequested = KX_EXIT_REQUEST_NO_REQUEST; - Main* blenderdata = maggie1; - - char* startscenename = scene->id.name+2; - char pathname[FILE_MAXDIR+FILE_MAXFILE], oldsce[FILE_MAXDIR+FILE_MAXFILE]; - STR_String exitstring = ""; - BlendFileData *bfd= NULL; - - BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); - BLI_strncpy(oldsce, G.sce, sizeof(oldsce)); -#ifndef DISABLE_PYTHON - resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path - setGamePythonPath(G.sce); - - // Acquire Python's GIL (global interpreter lock) - // so we can safely run Python code and API calls - PyGILState_STATE gilstate = PyGILState_Ensure(); - - PyObject *pyGlobalDict = PyDict_New(); /* python utility storage, spans blend file loading */ -#endif - - bgl::InitExtensions(true); - - do - { - View3D *v3d= CTX_wm_view3d(C); - RegionView3D *rv3d= CTX_wm_region_view3d(C); - - // get some preferences - SYS_SystemHandle syshandle = SYS_GetSystem(); - bool properties = (SYS_GetCommandLineInt(syshandle, "show_properties", 0) != 0); - bool usefixed = (SYS_GetCommandLineInt(syshandle, "fixedtime", 0) != 0); - bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0); - bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0); - bool animation_record = (SYS_GetCommandLineInt(syshandle, "animation_record", 0) != 0); - bool displaylists = (SYS_GetCommandLineInt(syshandle, "displaylists", 0) != 0); - bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 0) != 0); - bool novertexarrays = (SYS_GetCommandLineInt(syshandle, "novertexarrays", 0) != 0); - if(animation_record) usefixed= true; /* override since you's always want fixed time for sim recording */ - - // create the canvas, rasterizer and rendertools - RAS_ICanvas* canvas = new KX_BlenderCanvas(win, area_rect, ar); - canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); - RAS_IRenderTools* rendertools = new KX_BlenderRenderTools(); - RAS_IRasterizer* rasterizer = NULL; - - if(displaylists) { - if (GLEW_VERSION_1_1 && !novertexarrays) - rasterizer = new RAS_ListRasterizer(canvas, true, true); - else - rasterizer = new RAS_ListRasterizer(canvas); - } - else if (GLEW_VERSION_1_1 && !novertexarrays) - rasterizer = new RAS_VAOpenGLRasterizer(canvas, false); - else - rasterizer = new RAS_OpenGLRasterizer(canvas); - - // create the inputdevices - KX_BlenderKeyboardDevice* keyboarddevice = new KX_BlenderKeyboardDevice(); - KX_BlenderMouseDevice* mousedevice = new KX_BlenderMouseDevice(); - - // create a networkdevice - NG_NetworkDeviceInterface* networkdevice = new - NG_LoopBackNetworkDeviceInterface(); - - // - // create a ketsji/blendersystem (only needed for timing and stuff) - KX_BlenderSystem* kxsystem = new KX_BlenderSystem(); - - // create the ketsjiengine - KX_KetsjiEngine* ketsjiengine = new KX_KetsjiEngine(kxsystem); - - // set the devices - ketsjiengine->SetKeyboardDevice(keyboarddevice); - ketsjiengine->SetMouseDevice(mousedevice); - ketsjiengine->SetNetworkDevice(networkdevice); - ketsjiengine->SetCanvas(canvas); - ketsjiengine->SetRenderTools(rendertools); - ketsjiengine->SetRasterizer(rasterizer); - ketsjiengine->SetNetworkDevice(networkdevice); - ketsjiengine->SetUseFixedTime(usefixed); - ketsjiengine->SetTimingDisplay(frameRate, profile, properties); - -#ifndef DISABLE_PYTHON - CValue::SetDeprecationWarnings(nodepwarnings); -#endif - - //lock frame and camera enabled - storing global values - int tmp_lay= scene->lay; - Object *tmp_camera = scene->camera; - - if (v3d->scenelock==0){ - scene->lay= v3d->lay; - scene->camera= v3d->camera; - } - - // some blender stuff - MT_CmMatrix4x4 projmat; - MT_CmMatrix4x4 viewmat; - float camzoom; - int i; - - for (i = 0; i < 16; i++) - { - float *viewmat_linear= (float*) rv3d->viewmat; - viewmat.setElem(i, viewmat_linear[i]); - } - for (i = 0; i < 16; i++) - { - float *projmat_linear= (float*) rv3d->winmat; - projmat.setElem(i, projmat_linear[i]); - } - - if(rv3d->persp==RV3D_CAMOB) { - if(scene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */ - camzoom = 1.0f; - } - else { - camzoom = (1.41421 + (rv3d->camzoom / 50.0)); - camzoom *= camzoom; - camzoom = 4.0 / camzoom; - } - } - else { - camzoom = 2.0; - } - - - - ketsjiengine->SetDrawType(v3d->drawtype); - ketsjiengine->SetCameraZoom(camzoom); - - // if we got an exitcode 3 (KX_EXIT_REQUEST_START_OTHER_GAME) load a different file - if (exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME || exitrequested == KX_EXIT_REQUEST_RESTART_GAME) - { - exitrequested = KX_EXIT_REQUEST_NO_REQUEST; - if (bfd) BLO_blendfiledata_free(bfd); - - char basedpath[240]; - // base the actuator filename with respect - // to the original file working directory - - if (exitstring != "") - strcpy(basedpath, exitstring.Ptr()); - - // load relative to the last loaded file, this used to be relative - // to the first file but that makes no sense, relative paths in - // blend files should be relative to that file, not some other file - // that happened to be loaded first - BLI_path_abs(basedpath, pathname); - bfd = load_game_data(basedpath); - - // if it wasn't loaded, try it forced relative - if (!bfd) - { - // just add "//" in front of it - char temppath[242]; - strcpy(temppath, "//"); - strcat(temppath, basedpath); - - BLI_path_abs(temppath, pathname); - bfd = load_game_data(temppath); - } - - // if we got a loaded blendfile, proceed - if (bfd) - { - blenderdata = bfd->main; - startscenename = bfd->curscene->id.name + 2; - - if(blenderdata) { - BLI_strncpy(G.sce, blenderdata->name, sizeof(G.sce)); - BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); -#ifndef DISABLE_PYTHON - setGamePythonPath(G.sce); -#endif - } - } - // else forget it, we can't find it - else - { - exitrequested = KX_EXIT_REQUEST_QUIT_GAME; - } - } - - Scene *blscene= bfd ? bfd->curscene : (Scene *)BLI_findstring(&blenderdata->scene, startscenename, offsetof(ID, name) + 2); - - if (blscene) - { - int startFrame = blscene->r.cfra; - ketsjiengine->SetAnimRecordMode(animation_record, startFrame); - - // Quad buffered needs a special window. - if(blscene->gm.stereoflag == STEREO_ENABLED){ - if (blscene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) - rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) blscene->gm.stereomode); - - rasterizer->SetEyeSeparation(blscene->gm.eyeseparation); - } - - rasterizer->SetBackColor(blscene->gm.framing.col[0], blscene->gm.framing.col[1], blscene->gm.framing.col[2], 0.0f); - } - - if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME) - { - if (rv3d->persp != RV3D_CAMOB) - { - ketsjiengine->EnableCameraOverride(startscenename); - ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == RV3D_ORTHO)); - ketsjiengine->SetCameraOverrideProjectionMatrix(projmat); - ketsjiengine->SetCameraOverrideViewMatrix(viewmat); - ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far); - ketsjiengine->SetCameraOverrideLens(v3d->lens); - } - - // create a scene converter, create and convert the startingscene - KX_ISceneConverter* sceneconverter = new KX_BlenderSceneConverter(blenderdata, ketsjiengine); - ketsjiengine->SetSceneConverter(sceneconverter); - sceneconverter->addInitFromFrame=false; - if (always_use_expand_framing) - sceneconverter->SetAlwaysUseExpandFraming(true); - - bool usemat = false, useglslmat = false; - - if(GLEW_ARB_multitexture && GLEW_VERSION_1_1) - usemat = true; - - if(GPU_glsl_support()) - useglslmat = true; - else if(blscene->gm.matmode == GAME_MAT_GLSL) - usemat = false; - - if(usemat && (blscene->gm.matmode != GAME_MAT_TEXFACE)) - sceneconverter->SetMaterials(true); - if(useglslmat && (blscene->gm.matmode == GAME_MAT_GLSL)) - sceneconverter->SetGLSLMaterials(true); - - KX_Scene* startscene = new KX_Scene(keyboarddevice, - mousedevice, - networkdevice, - startscenename, - blscene, - canvas); - -#ifndef DISABLE_PYTHON - // some python things - PyObject *gameLogic, *gameLogic_keys; - setupGamePython(ketsjiengine, startscene, blenderdata, pyGlobalDict, &gameLogic, &gameLogic_keys, 0, NULL); -#endif // DISABLE_PYTHON - - //initialize Dome Settings - if(blscene->gm.stereoflag == STEREO_DOME) - ketsjiengine->InitDome(blscene->gm.dome.res, blscene->gm.dome.mode, blscene->gm.dome.angle, blscene->gm.dome.resbuf, blscene->gm.dome.tilt, blscene->gm.dome.warptext); - - // initialize 3D Audio Settings - AUD_set3DSetting(AUD_3DS_SPEED_OF_SOUND, blscene->audio.speed_of_sound); - AUD_set3DSetting(AUD_3DS_DOPPLER_FACTOR, blscene->audio.doppler_factor); - AUD_set3DSetting(AUD_3DS_DISTANCE_MODEL, blscene->audio.distance_model); - - if (sceneconverter) - { - // convert and add scene - sceneconverter->ConvertScene( - startscene, - rendertools, - canvas); - ketsjiengine->AddScene(startscene); - - // init the rasterizer - rasterizer->Init(); - - // start the engine - ketsjiengine->StartEngine(true); - - - // Set the animation playback rate for ipo's and actions - // the framerate below should patch with FPS macro defined in blendef.h - // Could be in StartEngine set the framerate, we need the scene to do this - ketsjiengine->SetAnimFrameRate(FPS); - - // the mainloop - printf("\nBlender Game Engine Started\n\n"); - while (!exitrequested) - { - // first check if we want to exit - exitrequested = ketsjiengine->GetExitCode(); - - // kick the engine - bool render = ketsjiengine->NextFrame(); // XXX 2.5 Bug, This is never true! FIXME- Campbell - - if (render) - { - // render the frame - ketsjiengine->Render(); - } - - wm_window_process_events_nosleep(C); - - // test for the ESC key - //XXX while (qtest()) - while(wmEvent *event= (wmEvent *)win->queue.first) - { - short val = 0; - //unsigned short event = 0; //XXX extern_qread(&val); - - if (keyboarddevice->ConvertBlenderEvent(event->type,event->val)) - exitrequested = KX_EXIT_REQUEST_BLENDER_ESC; - - /* Coordinate conversion... where - * should this really be? - */ - if (event->type==MOUSEMOVE) { - /* Note, not nice! XXX 2.5 event hack */ - val = event->x - ar->winrct.xmin; - mousedevice->ConvertBlenderEvent(MOUSEX, val); - - val = ar->winy - (event->y - ar->winrct.ymin) - 1; - mousedevice->ConvertBlenderEvent(MOUSEY, val); - } - else { - mousedevice->ConvertBlenderEvent(event->type,event->val); - } - - BLI_remlink(&win->queue, event); - wm_event_free(event); - } - - } - printf("\nBlender Game Engine Finished\n\n"); - exitstring = ketsjiengine->GetExitString(); - - - // when exiting the mainloop -#ifndef DISABLE_PYTHON - // Clears the dictionary by hand: - // This prevents, extra references to global variables - // inside the GameLogic dictionary when the python interpreter is finalized. - // which allows the scene to safely delete them :) - // see: (space.c)->start_game - - //PyDict_Clear(PyModule_GetDict(gameLogic)); - - // Keep original items, means python plugins will autocomplete members - int listIndex; - PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic)); - for (listIndex=0; listIndex < PyList_Size(gameLogic_keys_new); listIndex++) { - PyObject* item = PyList_GET_ITEM(gameLogic_keys_new, listIndex); - if (!PySequence_Contains(gameLogic_keys, item)) { - PyDict_DelItem( PyModule_GetDict(gameLogic), item); - } - } - Py_DECREF(gameLogic_keys_new); - gameLogic_keys_new = NULL; -#endif - ketsjiengine->StopEngine(); -#ifndef DISABLE_PYTHON - exitGamePythonScripting(); -#endif - networkdevice->Disconnect(); - } - if (sceneconverter) - { - delete sceneconverter; - sceneconverter = NULL; - } - -#ifndef DISABLE_PYTHON - Py_DECREF(gameLogic_keys); - gameLogic_keys = NULL; -#endif - } - //lock frame and camera enabled - restoring global values - if (v3d->scenelock==0){ - scene->lay= tmp_lay; - scene->camera= tmp_camera; - } - - // set the cursor back to normal - canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); - - // clean up some stuff - if (ketsjiengine) - { - delete ketsjiengine; - ketsjiengine = NULL; - } - if (kxsystem) - { - delete kxsystem; - kxsystem = NULL; - } - if (networkdevice) - { - delete networkdevice; - networkdevice = NULL; - } - if (keyboarddevice) - { - delete keyboarddevice; - keyboarddevice = NULL; - } - if (mousedevice) - { - delete mousedevice; - mousedevice = NULL; - } - if (rasterizer) - { - delete rasterizer; - rasterizer = NULL; - } - if (rendertools) - { - delete rendertools; - rendertools = NULL; - } - if (canvas) - { - delete canvas; - canvas = NULL; - } - - } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME); - - if (bfd) BLO_blendfiledata_free(bfd); - - BLI_strncpy(G.sce, oldsce, sizeof(G.sce)); - -#ifndef DISABLE_PYTHON - Py_DECREF(pyGlobalDict); - - // Release Python's GIL - PyGILState_Release(gilstate); -#endif - -} diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt deleted file mode 100644 index 625ad006e0c..00000000000 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ - -FILE(GLOB SRC *.cpp) - -SET(INC - . - ../../../source/kernel/gen_system - ../../../intern/string - ../../../intern/guardedalloc - ../../../intern/audaspace/intern - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/Converter - ../../../source/blender/imbuf - ../../../intern/ghost/include - ../../../intern/moto/include - ../../../source/gameengine/Ketsji - ../../../source/blender/blenlib - ../../../source/blender/blenkernel - ../../../source/blender/blenfont - ../../../source/blender/editors/include - ../../../source/blender/windowmanager - ../../../source/blender - ../../../source/blender/include - ../../../source/blender/makesdna - ../../../source/blender/makesrna - ../../../source/gameengine/Rasterizer - ../../../source/gameengine/GameLogic - ../../../source/gameengine/Expressions - ../../../source/gameengine/Network - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Physics/common - ../../../source/gameengine/Physics/Bullet - ../../../source/gameengine/Network/LoopBackNetwork - ../../../source/blender/misc - ../../../source/blender/blenloader - ../../../source/blender/gpu - ../../../extern/bullet2/src - ../../../extern/glew/include -) - -ADD_DEFINITIONS(-DGLEW_STATIC) - -IF(WITH_FFMPEG) - ADD_DEFINITIONS(-DWITH_FFMPEG) -ENDIF(WITH_FFMPEG) - -IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) -ELSE(WITH_PYTHON) - ADD_DEFINITIONS(-DDISABLE_PYTHON) -ENDIF(WITH_PYTHON) - -BLENDERLIB(bf_blroutines "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_bloutines', sources, Split(incs), [], libtype=['game', 'game2', 'player'], priority=[0, 0, 55] , compileflags=cxxflags) diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp deleted file mode 100644 index b04e951028d..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_BlenderCanvas.h" -#include "DNA_screen_types.h" -#include "stdio.h" - - -KX_BlenderCanvas::KX_BlenderCanvas(struct wmWindow *win, RAS_Rect &rect, struct ARegion *ar) : -m_win(win), -m_frame_rect(rect) -{ - // area boundaries needed for mouse coordinates in Letterbox framing mode - m_area_left = ar->winrct.xmin; - m_area_top = ar->winrct.ymax; -} - -KX_BlenderCanvas::~KX_BlenderCanvas() -{ -} - -void KX_BlenderCanvas::Init() -{ - glDepthFunc(GL_LEQUAL); -} - - -void KX_BlenderCanvas::SwapBuffers() -{ - BL_SwapBuffers(m_win); -} - -void KX_BlenderCanvas::BeginFrame() -{ - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LEQUAL); - -} - - -void KX_BlenderCanvas::EndFrame() -{ - // this is needed, else blender distorts a lot - glPopAttrib(); - glPushAttrib(GL_ALL_ATTRIB_BITS); - - glDisable(GL_FOG); -} - - - -void KX_BlenderCanvas::ClearColor(float r,float g,float b,float a) -{ - glClearColor(r,g,b,a); -} - - - -void KX_BlenderCanvas::ClearBuffer(int type) -{ - int ogltype = 0; - - if (type & RAS_ICanvas::COLOR_BUFFER ) - ogltype |= GL_COLOR_BUFFER_BIT; - - if (type & RAS_ICanvas::DEPTH_BUFFER ) - ogltype |= GL_DEPTH_BUFFER_BIT; - glClear(ogltype); -} - -int KX_BlenderCanvas::GetWidth( -) const { - return m_frame_rect.GetWidth(); -} - -int KX_BlenderCanvas::GetHeight( -) const { - return m_frame_rect.GetHeight(); -} - -int KX_BlenderCanvas::GetMouseX(int x) -{ - float left = GetWindowArea().GetLeft(); - return float(x - (left - m_area_left)); -} - -int KX_BlenderCanvas::GetMouseY(int y) -{ - float top = GetWindowArea().GetTop(); - return float(y - (m_area_top - top)); -} - -float KX_BlenderCanvas::GetMouseNormalizedX(int x) -{ - int can_x = GetMouseX(x); - return float(can_x)/this->GetWidth(); -} - -float KX_BlenderCanvas::GetMouseNormalizedY(int y) -{ - int can_y = GetMouseY(y); - return float(can_y)/this->GetHeight(); -} - -RAS_Rect & -KX_BlenderCanvas:: -GetWindowArea( -){ - return m_area_rect; -} - - void -KX_BlenderCanvas:: -SetViewPort( - int x1, int y1, - int x2, int y2 -){ - /* x1 and y1 are the min pixel coordinate (e.g. 0) - x2 and y2 are the max pixel coordinate - the width,height is calculated including both pixels - therefore: max - min + 1 - */ - int vp_width = (x2 - x1) + 1; - int vp_height = (y2 - y1) + 1; - int minx = m_frame_rect.GetLeft(); - int miny = m_frame_rect.GetBottom(); - - m_area_rect.SetLeft(minx + x1); - m_area_rect.SetBottom(miny + y1); - m_area_rect.SetRight(minx + x2); - m_area_rect.SetTop(miny + y2); - - glViewport(minx + x1, miny + y1, vp_width, vp_height); - glScissor(minx + x1, miny + y1, vp_width, vp_height); -} - - -void KX_BlenderCanvas::SetMouseState(RAS_MouseState mousestate) -{ - m_mousestate = mousestate; - - switch (mousestate) - { - case MOUSE_INVISIBLE: - { - BL_HideMouse(m_win); - break; - } - case MOUSE_WAIT: - { - BL_WaitMouse(m_win); - break; - } - case MOUSE_NORMAL: - { - BL_NormalMouse(m_win); - break; - } - default: - { - } - } -} - - - -// (0,0) is top left, (width,height) is bottom right -void KX_BlenderCanvas::SetMousePosition(int x,int y) -{ - int winX = m_frame_rect.GetLeft(); - int winY = m_frame_rect.GetBottom(); - int winH = m_frame_rect.GetHeight(); - - BL_warp_pointer(m_win, winX + x, winY + (winH-y)); -} - - - -void KX_BlenderCanvas::MakeScreenShot(const char* filename) -{ -// BL_MakeScreenShot(m_ar, filename); -} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h deleted file mode 100644 index 0d80bdee055..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h +++ /dev/null @@ -1,201 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_BLENDERCANVAS -#define __KX_BLENDERCANVAS - -#ifdef WIN32 -#include -#endif - -#include "GL/glew.h" - -#include "RAS_ICanvas.h" -#include "RAS_Rect.h" - -#include "KX_BlenderGL.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -struct ARegion; -struct wmWindow; - -/** - * 2D Blender device context abstraction. - * The connection from 3d rendercontext to 2d Blender surface embedding. - */ - -class KX_BlenderCanvas : public RAS_ICanvas -{ -private: - /** Rect that defines the area used for rendering, - relative to the context */ - RAS_Rect m_displayarea; - -public: - /* Construct a new canvas. - * - * @param area The Blender ARegion to run the game within. - */ - KX_BlenderCanvas(struct wmWindow* win, class RAS_Rect &rect, struct ARegion* ar); - ~KX_BlenderCanvas(); - - void - Init( - ); - - void - SwapBuffers( - ); - void - Resize( - int width, - int height - ); - - void - BeginFrame( - ); - - void - EndFrame( - ); - - void - ClearColor( - float r, - float g, - float b, - float a - ); - - void - ClearBuffer( - int type - ); - - int - GetWidth( - ) const ; - - int - GetHeight( - ) const ; - - int - GetMouseX(int x - ); - - int - GetMouseY(int y - ); - - float - GetMouseNormalizedX(int x - ); - - float - GetMouseNormalizedY(int y - ); - - const - RAS_Rect & - GetDisplayArea( - ) const { - return m_displayarea; - }; - - void - SetDisplayArea(RAS_Rect *rect - ) { - m_displayarea= *rect; - }; - - RAS_Rect & - GetWindowArea( - ); - - void - SetViewPort( - int x1, int y1, - int x2, int y2 - ); - - void - SetMouseState( - RAS_MouseState mousestate - ); - - void - SetMousePosition( - int x, - int y - ); - - void - MakeScreenShot( - const char* filename - ); - - /** - * Nothing needs be done for BlenderCanvas - * Begin/End Draw, as the game engine GL context - * is always current/active. - */ - - bool - BeginDraw( - ) { - return true; - }; - - void - EndDraw( - ) { - }; - -private: - /** Blender area the game engine is running within */ - struct wmWindow* m_win; - RAS_Rect m_frame_rect; - RAS_Rect m_area_rect; - short m_area_left; - short m_area_top; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderCanvas"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // __KX_BLENDERCANVAS - diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp deleted file mode 100644 index 55a687c0baa..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_BlenderGL.h" - -#ifdef __cplusplus -extern "C" { -#endif -#include "BLF_api.h" -#ifdef __cplusplus -} -#endif - -/* - * This little block needed for linking to Blender... - */ -#ifdef WIN32 -#include -#include "BLI_winstuff.h" -#endif - -#include -#include - -#include "GL/glew.h" - -#include "BL_Material.h" // MAXTEX - -/* Data types encoding the game world: */ -#include "DNA_object_types.h" -#include "DNA_scene_types.h" -#include "DNA_screen_types.h" -#include "DNA_camera_types.h" -#include "DNA_world_types.h" -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_image_types.h" -#include "DNA_view3d_types.h" -#include "DNA_material_types.h" -#include "DNA_windowmanager_types.h" - -#include "BKE_global.h" -#include "BKE_bmfont.h" -#include "BKE_image.h" - -extern "C" { -#include "WM_api.h" -#include "WM_types.h" -#include "wm_event_system.h" -#include "wm_cursors.h" -#include "wm_window.h" -} - -/* end of blender block */ - -/* was in drawmesh.c */ -void spack(unsigned int ucol) -{ - char *cp= (char *)&ucol; - - glColor3ub(cp[3], cp[2], cp[1]); -} - -void BL_warp_pointer(wmWindow *win, int x,int y) -{ - WM_cursor_warp(win, x, y); -} - -void BL_SwapBuffers(wmWindow *win) -{ - wm_window_swap_buffers(win); -} - -void DisableForText() -{ - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */ - - if(glIsEnabled(GL_BLEND)) glDisable(GL_BLEND); - if(glIsEnabled(GL_ALPHA_TEST)) glDisable(GL_ALPHA_TEST); - - if(glIsEnabled(GL_LIGHTING)) { - glDisable(GL_LIGHTING); - glDisable(GL_COLOR_MATERIAL); - } - - if(GLEW_ARB_multitexture) { - for(int i=0; i - -#include "wm_event_types.h" -#include "WM_types.h" -#include "SCA_IInputDevice.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -/** - Base Class for Blender specific inputdevices. Blender specific inputdevices are used when the gameengine is running in embedded mode instead of standalone mode. -*/ -class BL_BlenderInputDevice : public SCA_IInputDevice -{ - // this map is Blender specific: a conversion between blender and ketsji enums - std::map m_reverseKeyTranslateTable; -public: - BL_BlenderInputDevice() - { - - /* The reverse table. In order to not confuse ourselves, we */ - /* immediately convert all events that come in to KX codes. */ - m_reverseKeyTranslateTable[LEFTMOUSE ] = KX_LEFTMOUSE ; - m_reverseKeyTranslateTable[MIDDLEMOUSE ] = KX_MIDDLEMOUSE ; - m_reverseKeyTranslateTable[RIGHTMOUSE ] = KX_RIGHTMOUSE ; - m_reverseKeyTranslateTable[WHEELUPMOUSE ] = KX_WHEELUPMOUSE ; - m_reverseKeyTranslateTable[WHEELDOWNMOUSE ] = KX_WHEELDOWNMOUSE ; - m_reverseKeyTranslateTable[MOUSEX ] = KX_MOUSEX ; - m_reverseKeyTranslateTable[MOUSEY ] = KX_MOUSEY ; - - // TIMERS - - m_reverseKeyTranslateTable[TIMER0 ] = KX_TIMER0 ; - m_reverseKeyTranslateTable[TIMER1 ] = KX_TIMER1 ; - m_reverseKeyTranslateTable[TIMER2 ] = KX_TIMER2 ; - - // SYSTEM -#if 0 - /* **** XXX **** */ - m_reverseKeyTranslateTable[KEYBD ] = KX_KEYBD ; - m_reverseKeyTranslateTable[RAWKEYBD ] = KX_RAWKEYBD ; - m_reverseKeyTranslateTable[REDRAW ] = KX_REDRAW ; - m_reverseKeyTranslateTable[INPUTCHANGE ] = KX_INPUTCHANGE ; - m_reverseKeyTranslateTable[QFULL ] = KX_QFULL ; - m_reverseKeyTranslateTable[WINFREEZE ] = KX_WINFREEZE ; - m_reverseKeyTranslateTable[WINTHAW ] = KX_WINTHAW ; - m_reverseKeyTranslateTable[WINCLOSE ] = KX_WINCLOSE ; - m_reverseKeyTranslateTable[WINQUIT ] = KX_WINQUIT ; - m_reverseKeyTranslateTable[Q_FIRSTTIME ] = KX_Q_FIRSTTIME ; - /* **** XXX **** */ -#endif - // standard keyboard - - m_reverseKeyTranslateTable[AKEY ] = KX_AKEY ; - m_reverseKeyTranslateTable[BKEY ] = KX_BKEY ; - m_reverseKeyTranslateTable[CKEY ] = KX_CKEY ; - m_reverseKeyTranslateTable[DKEY ] = KX_DKEY ; - m_reverseKeyTranslateTable[EKEY ] = KX_EKEY ; - m_reverseKeyTranslateTable[FKEY ] = KX_FKEY ; - m_reverseKeyTranslateTable[GKEY ] = KX_GKEY ; -//XXX clean up -#ifdef WIN32 -#define HKEY 'h' -#endif - m_reverseKeyTranslateTable[HKEY ] = KX_HKEY ; -//XXX clean up -#ifdef WIN32 -#undef HKEY -#endif - m_reverseKeyTranslateTable[IKEY ] = KX_IKEY ; - m_reverseKeyTranslateTable[JKEY ] = KX_JKEY ; - m_reverseKeyTranslateTable[KKEY ] = KX_KKEY ; - m_reverseKeyTranslateTable[LKEY ] = KX_LKEY ; - m_reverseKeyTranslateTable[MKEY ] = KX_MKEY ; - m_reverseKeyTranslateTable[NKEY ] = KX_NKEY ; - m_reverseKeyTranslateTable[OKEY ] = KX_OKEY ; - m_reverseKeyTranslateTable[PKEY ] = KX_PKEY ; - m_reverseKeyTranslateTable[QKEY ] = KX_QKEY ; - m_reverseKeyTranslateTable[RKEY ] = KX_RKEY ; - m_reverseKeyTranslateTable[SKEY ] = KX_SKEY ; - m_reverseKeyTranslateTable[TKEY ] = KX_TKEY ; - m_reverseKeyTranslateTable[UKEY ] = KX_UKEY ; - m_reverseKeyTranslateTable[VKEY ] = KX_VKEY ; - m_reverseKeyTranslateTable[WKEY ] = KX_WKEY ; - m_reverseKeyTranslateTable[XKEY ] = KX_XKEY ; - m_reverseKeyTranslateTable[YKEY ] = KX_YKEY ; - m_reverseKeyTranslateTable[ZKEY ] = KX_ZKEY ; - - m_reverseKeyTranslateTable[ZEROKEY ] = KX_ZEROKEY ; - m_reverseKeyTranslateTable[ONEKEY ] = KX_ONEKEY ; - m_reverseKeyTranslateTable[TWOKEY ] = KX_TWOKEY ; - m_reverseKeyTranslateTable[THREEKEY ] = KX_THREEKEY ; - m_reverseKeyTranslateTable[FOURKEY ] = KX_FOURKEY ; - m_reverseKeyTranslateTable[FIVEKEY ] = KX_FIVEKEY ; - m_reverseKeyTranslateTable[SIXKEY ] = KX_SIXKEY ; - m_reverseKeyTranslateTable[SEVENKEY ] = KX_SEVENKEY ; - m_reverseKeyTranslateTable[EIGHTKEY ] = KX_EIGHTKEY ; - m_reverseKeyTranslateTable[NINEKEY ] = KX_NINEKEY ; - - m_reverseKeyTranslateTable[CAPSLOCKKEY ] = KX_CAPSLOCKKEY ; - - m_reverseKeyTranslateTable[LEFTCTRLKEY ] = KX_LEFTCTRLKEY ; - m_reverseKeyTranslateTable[LEFTALTKEY ] = KX_LEFTALTKEY ; - m_reverseKeyTranslateTable[RIGHTALTKEY ] = KX_RIGHTALTKEY ; - m_reverseKeyTranslateTable[RIGHTCTRLKEY ] = KX_RIGHTCTRLKEY ; - m_reverseKeyTranslateTable[RIGHTSHIFTKEY ] = KX_RIGHTSHIFTKEY ; - m_reverseKeyTranslateTable[LEFTSHIFTKEY ] = KX_LEFTSHIFTKEY ; - - m_reverseKeyTranslateTable[ESCKEY ] = KX_ESCKEY ; - m_reverseKeyTranslateTable[TABKEY ] = KX_TABKEY ; - m_reverseKeyTranslateTable[RETKEY ] = KX_RETKEY ; - m_reverseKeyTranslateTable[SPACEKEY ] = KX_SPACEKEY ; - m_reverseKeyTranslateTable[LINEFEEDKEY ] = KX_LINEFEEDKEY ; - m_reverseKeyTranslateTable[BACKSPACEKEY ] = KX_BACKSPACEKEY ; - m_reverseKeyTranslateTable[DELKEY ] = KX_DELKEY ; - m_reverseKeyTranslateTable[SEMICOLONKEY ] = KX_SEMICOLONKEY ; - m_reverseKeyTranslateTable[PERIODKEY ] = KX_PERIODKEY ; - m_reverseKeyTranslateTable[COMMAKEY ] = KX_COMMAKEY ; - m_reverseKeyTranslateTable[QUOTEKEY ] = KX_QUOTEKEY ; - m_reverseKeyTranslateTable[ACCENTGRAVEKEY ] = KX_ACCENTGRAVEKEY ; - m_reverseKeyTranslateTable[MINUSKEY ] = KX_MINUSKEY ; - m_reverseKeyTranslateTable[SLASHKEY ] = KX_SLASHKEY ; - m_reverseKeyTranslateTable[BACKSLASHKEY ] = KX_BACKSLASHKEY ; - m_reverseKeyTranslateTable[EQUALKEY ] = KX_EQUALKEY ; - m_reverseKeyTranslateTable[LEFTBRACKETKEY ] = KX_LEFTBRACKETKEY ; - m_reverseKeyTranslateTable[RIGHTBRACKETKEY ] = KX_RIGHTBRACKETKEY ; - - m_reverseKeyTranslateTable[LEFTARROWKEY ] = KX_LEFTARROWKEY ; - m_reverseKeyTranslateTable[DOWNARROWKEY ] = KX_DOWNARROWKEY ; - m_reverseKeyTranslateTable[RIGHTARROWKEY ] = KX_RIGHTARROWKEY ; - m_reverseKeyTranslateTable[UPARROWKEY ] = KX_UPARROWKEY ; - - m_reverseKeyTranslateTable[PAD2 ] = KX_PAD2 ; - m_reverseKeyTranslateTable[PAD4 ] = KX_PAD4 ; - m_reverseKeyTranslateTable[PAD6 ] = KX_PAD6 ; - m_reverseKeyTranslateTable[PAD8 ] = KX_PAD8 ; - - m_reverseKeyTranslateTable[PAD1 ] = KX_PAD1 ; - m_reverseKeyTranslateTable[PAD3 ] = KX_PAD3 ; - m_reverseKeyTranslateTable[PAD5 ] = KX_PAD5 ; - m_reverseKeyTranslateTable[PAD7 ] = KX_PAD7 ; - m_reverseKeyTranslateTable[PAD9 ] = KX_PAD9 ; - - m_reverseKeyTranslateTable[PADPERIOD ] = KX_PADPERIOD ; - m_reverseKeyTranslateTable[PADSLASHKEY ] = KX_PADSLASHKEY ; - m_reverseKeyTranslateTable[PADASTERKEY ] = KX_PADASTERKEY ; - - - m_reverseKeyTranslateTable[PAD0 ] = KX_PAD0 ; - m_reverseKeyTranslateTable[PADMINUS ] = KX_PADMINUS ; - m_reverseKeyTranslateTable[PADENTER ] = KX_PADENTER ; - m_reverseKeyTranslateTable[PADPLUSKEY ] = KX_PADPLUSKEY ; - - - m_reverseKeyTranslateTable[F1KEY ] = KX_F1KEY ; - m_reverseKeyTranslateTable[F2KEY ] = KX_F2KEY ; - m_reverseKeyTranslateTable[F3KEY ] = KX_F3KEY ; - m_reverseKeyTranslateTable[F4KEY ] = KX_F4KEY ; - m_reverseKeyTranslateTable[F5KEY ] = KX_F5KEY ; - m_reverseKeyTranslateTable[F6KEY ] = KX_F6KEY ; - m_reverseKeyTranslateTable[F7KEY ] = KX_F7KEY ; - m_reverseKeyTranslateTable[F8KEY ] = KX_F8KEY ; - m_reverseKeyTranslateTable[F9KEY ] = KX_F9KEY ; - m_reverseKeyTranslateTable[F10KEY ] = KX_F10KEY ; - m_reverseKeyTranslateTable[F11KEY ] = KX_F11KEY ; - m_reverseKeyTranslateTable[F12KEY ] = KX_F12KEY ; - m_reverseKeyTranslateTable[F13KEY ] = KX_F13KEY ; - m_reverseKeyTranslateTable[F14KEY ] = KX_F14KEY ; - m_reverseKeyTranslateTable[F15KEY ] = KX_F15KEY ; - m_reverseKeyTranslateTable[F16KEY ] = KX_F16KEY ; - m_reverseKeyTranslateTable[F17KEY ] = KX_F17KEY ; - m_reverseKeyTranslateTable[F18KEY ] = KX_F18KEY ; - m_reverseKeyTranslateTable[F19KEY ] = KX_F19KEY ; - - m_reverseKeyTranslateTable[PAUSEKEY ] = KX_PAUSEKEY ; - m_reverseKeyTranslateTable[INSERTKEY ] = KX_INSERTKEY ; - m_reverseKeyTranslateTable[HOMEKEY ] = KX_HOMEKEY ; - m_reverseKeyTranslateTable[PAGEUPKEY ] = KX_PAGEUPKEY ; - m_reverseKeyTranslateTable[PAGEDOWNKEY ] = KX_PAGEDOWNKEY ; - m_reverseKeyTranslateTable[ENDKEY ] = KX_ENDKEY ; - - - } - - virtual ~BL_BlenderInputDevice() - { - - } - - KX_EnumInputs ToNative(unsigned short incode) { - return m_reverseKeyTranslateTable[incode]; - } - - virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)=0; -// virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0; - virtual bool ConvertBlenderEvent(unsigned short incode,short val)=0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_BlenderInputDevice"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; -#endif //__KX_BLENDERINPUTDEVICE - diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp deleted file mode 100644 index e8cb25af868..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 -// annoying warnings about truncated STL debug info -#pragma warning (disable :4786) -#endif - -#include "KX_BlenderKeyboardDevice.h" - -KX_BlenderKeyboardDevice::KX_BlenderKeyboardDevice() - : m_hookesc(false) -{ - -} -KX_BlenderKeyboardDevice::~KX_BlenderKeyboardDevice() -{ - -} - -/** - IsPressed gives boolean information about keyboard status, true if pressed, false if not -*/ - -bool KX_BlenderKeyboardDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode]; - bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - inevent.m_status == SCA_InputEvent::KX_ACTIVE); - return pressed; -} -/*const SCA_InputEvent& KX_BlenderKeyboardDevice::GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - return m_eventStatusTables[m_currentTable][inputcode]; -} -*/ -/** - NextFrame toggles currentTable with previousTable, - and copy relevant event information from previous to current - (pressed keys need to be remembered) -*/ -void KX_BlenderKeyboardDevice::NextFrame() -{ - SCA_IInputDevice::NextFrame(); - - // now convert justpressed keyevents into regular (active) keyevents - int previousTable = 1-m_currentTable; - for (int keyevent= KX_BEGINKEY; keyevent<= KX_ENDKEY;keyevent++) - { - SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][keyevent]; - if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - oldevent.m_status == SCA_InputEvent::KX_ACTIVE ) - { - m_eventStatusTables[m_currentTable][keyevent] = oldevent; - m_eventStatusTables[m_currentTable][keyevent].m_status = SCA_InputEvent::KX_ACTIVE; - } - } -} - -/** - ConvertBlenderEvent translates blender keyboard events into ketsji kbd events - extra event information is stored, like ramp-mode (just released/pressed) -*/ - - -bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode,short val) -{ - bool result = false; - - // convert event - KX_EnumInputs kxevent = this->ToNative(incode); - - // only process it, if it's a key - if (kxevent >= KX_BEGINKEY && kxevent <= KX_ENDKEY) - { - int previousTable = 1-m_currentTable; - - if (val == KM_PRESS) - { - if (kxevent == KX_ESCKEY && val != 0 && !m_hookesc) - result = true; - if (kxevent == KX_PAUSEKEY && val && (IsPressed(KX_LEFTCTRLKEY) || IsPressed(KX_RIGHTCTRLKEY))) - result = true; - - // todo: convert val ?? - m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //??? - - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - case SCA_InputEvent::KX_JUSTACTIVATED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - case SCA_InputEvent::KX_ACTIVE: - - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - case SCA_InputEvent::KX_NO_INPUTSTATUS: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - } - } - - } else if (val == KM_RELEASE) - { - // blender eventval == 0 - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - case SCA_InputEvent::KX_JUSTACTIVATED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED; - break; - } - case SCA_InputEvent::KX_ACTIVE: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS; - } - } - } - } - return result; -} - -void KX_BlenderKeyboardDevice::HookEscape() -{ - m_hookesc = true; -} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h deleted file mode 100644 index 6cd47a5d93e..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_BLENDERKEYBOARDDEVICE -#define __KX_BLENDERKEYBOARDDEVICE - -#include "KX_BlenderInputDevice.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class KX_BlenderKeyboardDevice : public BL_BlenderInputDevice -{ - bool m_hookesc; -public: - KX_BlenderKeyboardDevice(); - virtual ~KX_BlenderKeyboardDevice(); - - virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode); -// virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode); - virtual bool ConvertBlenderEvent(unsigned short incode,short val); - virtual void NextFrame(); - virtual void HookEscape(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderKeyboardDevice"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_BLENDERKEYBOARDDEVICE - diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp deleted file mode 100644 index c3e3935fca5..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 -// annoying warnings about truncated STL debug info -#pragma warning (disable :4786) -#endif - -#include "KX_BlenderMouseDevice.h" - -KX_BlenderMouseDevice::KX_BlenderMouseDevice() -{ - -} -KX_BlenderMouseDevice::~KX_BlenderMouseDevice() -{ - -} - -/** - IsPressed gives boolean information about mouse status, true if pressed, false if not -*/ - -bool KX_BlenderMouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode]; - bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - inevent.m_status == SCA_InputEvent::KX_ACTIVE); - return pressed; -} -/*const SCA_InputEvent& KX_BlenderMouseDevice::GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - return m_eventStatusTables[m_currentTable][inputcode]; -} -*/ - -/** - NextFrame toggles currentTable with previousTable, - and copy relevant event information from previous to current - (pressed keys need to be remembered) -*/ -void KX_BlenderMouseDevice::NextFrame() -{ - SCA_IInputDevice::NextFrame(); - - // now convert justpressed keyevents into regular (active) keyevents - int previousTable = 1-m_currentTable; - for (int mouseevent= KX_BEGINMOUSE; mouseevent< KX_ENDMOUSEBUTTONS;mouseevent++) - { - SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][mouseevent]; - if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - oldevent.m_status == SCA_InputEvent::KX_ACTIVE ) - { - m_eventStatusTables[m_currentTable][mouseevent] = oldevent; - m_eventStatusTables[m_currentTable][mouseevent].m_status = SCA_InputEvent::KX_ACTIVE; - } - } - for (int mousemove= KX_ENDMOUSEBUTTONS; mousemove< KX_ENDMOUSE;mousemove++) - { - SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][mousemove]; - m_eventStatusTables[m_currentTable][mousemove] = oldevent; - if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - oldevent.m_status == SCA_InputEvent::KX_ACTIVE ) - { - - m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_JUSTRELEASED; - } else - { - if (oldevent.m_status == SCA_InputEvent::KX_JUSTRELEASED) - { - - m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS ; - } - } - } -} - - -/** - ConvertBlenderEvent translates blender mouse events into ketsji kbd events - extra event information is stored, like ramp-mode (just released/pressed) -*/ - - -bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode,short val) -{ - bool result = false; - - // convert event - KX_EnumInputs kxevent = this->ToNative(incode); - int previousTable = 1-m_currentTable; - - // only process it, if it's a key - if (kxevent > KX_BEGINMOUSE && kxevent < KX_ENDMOUSEBUTTONS) - { - if (val == KM_PRESS) - { - m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //??? - - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - - case SCA_InputEvent::KX_ACTIVE: - case SCA_InputEvent::KX_JUSTACTIVATED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - case SCA_InputEvent::KX_JUSTRELEASED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - } - } - - } else if (val == KM_RELEASE) - { - // blender eventval == 0 - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - case SCA_InputEvent::KX_JUSTACTIVATED: - case SCA_InputEvent::KX_ACTIVE: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS; - } - } - } - } - - if (kxevent > KX_ENDMOUSEBUTTONS && kxevent < KX_ENDMOUSE) - { - m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //remember mouse position - - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - - case SCA_InputEvent::KX_ACTIVE: - case SCA_InputEvent::KX_JUSTACTIVATED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - case SCA_InputEvent::KX_JUSTRELEASED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - } - } - } - - - return result; -} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h deleted file mode 100644 index 8f037ae5b07..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_BLENDERMOUSEDEVICE -#define __KX_BLENDERMOUSEDEVICE - -#include "KX_BlenderInputDevice.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class KX_BlenderMouseDevice : public BL_BlenderInputDevice -{ -public: - KX_BlenderMouseDevice(); - virtual ~KX_BlenderMouseDevice(); - - virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode); -// virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode); - virtual bool ConvertBlenderEvent(unsigned short incode,short val); - virtual void NextFrame(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderMouseDevice"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_BLENDERMOUSEDEVICE - diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp deleted file mode 100644 index 3d736557535..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "GL/glew.h" - -#include "RAS_IRenderTools.h" -#include "RAS_IRasterizer.h" -#include "RAS_LightObject.h" -#include "RAS_ICanvas.h" -#include "RAS_GLExtensionManager.h" - -#include "KX_GameObject.h" -#include "KX_PolygonMaterial.h" -#include "KX_BlenderMaterial.h" -#include "KX_RayCast.h" -#include "KX_IPhysicsController.h" -#include "KX_Light.h" - -#include "PHY_IPhysicsEnvironment.h" - -#include "STR_String.h" - -#include "GPU_draw.h" - -#include "KX_BlenderGL.h" // for text printing -#include "KX_BlenderRenderTools.h" - -unsigned int KX_BlenderRenderTools::m_numgllights; - -KX_BlenderRenderTools::KX_BlenderRenderTools() -{ - glGetIntegerv(GL_MAX_LIGHTS, (GLint*) &m_numgllights); - if (m_numgllights < 8) - m_numgllights = 8; -} - -KX_BlenderRenderTools::~KX_BlenderRenderTools() -{ -} - -void KX_BlenderRenderTools::BeginFrame(RAS_IRasterizer* rasty) -{ - m_clientobject = NULL; - m_lastlightlayer = -1; - m_lastauxinfo = NULL; - m_lastlighting = true; /* force disable in DisableOpenGLLights() */ - DisableOpenGLLights(); -} - -void KX_BlenderRenderTools::EndFrame(RAS_IRasterizer* rasty) -{ -} - -/* ProcessLighting performs lighting on objects. the layer is a bitfield that - * contains layer information. There are 20 'official' layers in blender. A - * light is applied on an object only when they are in the same layer. OpenGL - * has a maximum of 8 lights (simultaneous), so 20 * 8 lights are possible in - * a scene. */ - -void KX_BlenderRenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat) -{ - bool enable = false; - int layer= -1; - - /* find the layer */ - if(uselights) { - if(m_clientobject) - layer = static_cast(m_clientobject)->GetLayer(); - } - - /* avoid state switching */ - if(m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo) - return; - - m_lastlightlayer = layer; - m_lastauxinfo = m_auxilaryClientInfo; - - /* enable/disable lights as needed */ - if(layer >= 0) - enable = applyLights(layer, viewmat); - - if(enable) - EnableOpenGLLights(rasty); - else - DisableOpenGLLights(); -} - -void KX_BlenderRenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty) -{ - if(m_lastlighting == true) - return; - - glEnable(GL_LIGHTING); - glEnable(GL_COLOR_MATERIAL); - - glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); - glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (rasty->GetCameraOrtho())? GL_FALSE: GL_TRUE); - if (GLEW_EXT_separate_specular_color || GLEW_VERSION_1_2) - glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR); - - m_lastlighting = true; -} - -void KX_BlenderRenderTools::DisableOpenGLLights() -{ - if(m_lastlighting == false) - return; - - glDisable(GL_LIGHTING); - glDisable(GL_COLOR_MATERIAL); - - m_lastlighting = false; -} - - -void KX_BlenderRenderTools::SetClientObject(RAS_IRasterizer *rasty, void* obj) -{ - if (m_clientobject != obj) - { - bool ccw = (obj == NULL || !((KX_GameObject*)obj)->IsNegativeScaling()); - rasty->SetFrontFace(ccw); - - m_clientobject = obj; - } -} - -bool KX_BlenderRenderTools::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data) -{ - double* const oglmatrix = (double* const) data; - MT_Point3 resultpoint(result->m_hitPoint); - MT_Vector3 resultnormal(result->m_hitNormal); - MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]); - MT_Vector3 dir = -(left.cross(resultnormal)).safe_normalized(); - left = (dir.cross(resultnormal)).safe_normalized(); - // for the up vector, we take the 'resultnormal' returned by the physics - - double maat[16]={ - left[0], left[1], left[2], 0, - dir[0], dir[1], dir[2], 0, - resultnormal[0],resultnormal[1],resultnormal[2], 0, - 0, 0, 0, 1}; - glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]); - //glMultMatrixd(oglmatrix); - glMultMatrixd(maat); - return true; -} - -void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,int objectdrawmode ) -{ - /* FIXME: - blender: intern/moto/include/MT_Vector3.inl:42: MT_Vector3 operator/(const - MT_Vector3&, double): Assertion `!MT_fuzzyZero(s)' failed. - - Program received signal SIGABRT, Aborted. - [Switching to Thread 16384 (LWP 1519)] - 0x40477571 in kill () from /lib/libc.so.6 - (gdb) bt - #7 0x08334368 in MT_Vector3::normalized() const () - #8 0x0833e6ec in KX_BlenderRenderTools::applyTransform(RAS_IRasterizer*, double*, int) () - */ - - if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED || - objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED) - { - // rotate the billboard/halo - //page 360/361 3D Game Engine Design, David Eberly for a discussion - // on screen aligned and axis aligned billboards - // assumed is that the preprocessor transformed all billboard polygons - // so that their normal points into the positive x direction (1.0 , 0.0 , 0.0) - // when new parenting for objects is done, this rotation - // will be moved into the object - - MT_Point3 objpos (oglmatrix[12],oglmatrix[13],oglmatrix[14]); - MT_Point3 campos = rasty->GetCameraPosition(); - MT_Vector3 dir = (campos - objpos).safe_normalized(); - MT_Vector3 up(0,0,1.0); - - KX_GameObject* gameobj = (KX_GameObject*)m_clientobject; - // get scaling of halo object - MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale(); - - bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned - if (screenaligned) - { - up = (up - up.dot(dir) * dir).safe_normalized(); - } else - { - dir = (dir - up.dot(dir)*up).safe_normalized(); - } - - MT_Vector3 left = dir.normalized(); - dir = (left.cross(up)).normalized(); - - // we have calculated the row vectors, now we keep - // local scaling into account: - - left *= size[0]; - dir *= size[1]; - up *= size[2]; - double maat[16]={ - left[0], left[1],left[2], 0, - dir[0], dir[1],dir[2],0, - up[0],up[1],up[2],0, - 0,0,0,1}; - glTranslated(objpos[0],objpos[1],objpos[2]); - glMultMatrixd(maat); - - } else - { - if (objectdrawmode & RAS_IPolyMaterial::SHADOW) - { - // shadow must be cast to the ground, physics system needed here! - MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]); - KX_GameObject *gameobj = (KX_GameObject*)m_clientobject; - MT_Vector3 direction = MT_Vector3(0,0,-1); - - direction.normalize(); - direction *= 100000; - - MT_Point3 topoint = frompoint + direction; - - KX_Scene* kxscene = (KX_Scene*) m_auxilaryClientInfo; - PHY_IPhysicsEnvironment* physics_environment = kxscene->GetPhysicsEnvironment(); - KX_IPhysicsController* physics_controller = gameobj->GetPhysicsController(); - - KX_GameObject *parent = gameobj->GetParent(); - if (!physics_controller && parent) - physics_controller = parent->GetPhysicsController(); - if (parent) - parent->Release(); - - KX_RayCast::Callback callback(this, physics_controller, oglmatrix); - if (!KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback)) - { - // couldn't find something to cast the shadow on... - glMultMatrixd(oglmatrix); - } - else - { // we found the "ground", but the cast matrix doesn't take - // scaling in consideration, so we must apply the object scale - MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale(); - glScalef(size[0], size[1], size[2]); - } - } else - { - - // 'normal' object - glMultMatrixd(oglmatrix); - } - } -} - - -void KX_BlenderRenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode, - const char* text, - int xco, - int yco, - int width, - int height) -{ - if(mode == RAS_IRenderTools::RAS_TEXT_PADDED) - BL_print_gamedebug_line_padded(text, xco, yco, width, height); - else - BL_print_gamedebug_line(text, xco, yco, width, height); -} - -/* Render Text renders text into a (series of) polygon, using a texture font, - * Each character consists of one polygon (one quad or two triangles) */ - -void KX_BlenderRenderTools::RenderText( - int mode, - RAS_IPolyMaterial* polymat, - float v1[3], float v2[3], float v3[3], float v4[3], int glattrib) -{ - const STR_String& mytext = ((CValue*)m_clientobject)->GetPropertyText("Text"); - - const unsigned int flag = polymat->GetFlag(); - struct MTFace* tface = 0; - unsigned int *col = 0; - - if(flag & RAS_BLENDERMAT) { - KX_BlenderMaterial *bl_mat = static_cast(polymat); - tface = bl_mat->GetMTFace(); - col = bl_mat->GetMCol(); - } else { - KX_PolygonMaterial* blenderpoly = static_cast(polymat); - tface = blenderpoly->GetMTFace(); - col = blenderpoly->GetMCol(); - } - - GPU_render_text(tface, mode, mytext, mytext.Length(), col, v1, v2, v3, v4, glattrib); -} - - -void KX_BlenderRenderTools::PushMatrix() -{ - glPushMatrix(); -} - -void KX_BlenderRenderTools::PopMatrix() -{ - glPopMatrix(); -} - - -int KX_BlenderRenderTools::applyLights(int objectlayer, const MT_Transform& viewmat) -{ - // taken from blender source, incompatibility between Blender Object / GameObject - KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo; - float glviewmat[16]; - unsigned int count; - std::vector::iterator lit = m_lights.begin(); - - for(count=0; countm_light; - - if(kxlight->ApplyLight(kxscene, objectlayer, count)) - count++; - } - glPopMatrix(); - - return count; -} - -void KX_BlenderRenderTools::MotionBlur(RAS_IRasterizer* rasterizer) -{ - int state = rasterizer->GetMotionBlurState(); - float motionblurvalue; - if(state) - { - motionblurvalue = rasterizer->GetMotionBlurValue(); - if(state==1) - { - //bugfix:load color buffer into accum buffer for the first time(state=1) - glAccum(GL_LOAD, 1.0); - rasterizer->SetMotionBlurState(2); - } - else if(motionblurvalue>=0.0 && motionblurvalue<=1.0) - { - glAccum(GL_MULT, motionblurvalue); - glAccum(GL_ACCUM, 1-motionblurvalue); - glAccum(GL_RETURN, 1.0); - glFlush(); - } - } -} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h deleted file mode 100644 index 07226524538..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_BLENDERRENDERTOOLS -#define __KX_BLENDERRENDERTOOLS - -#ifdef WIN32 -// don't show stl-warnings -#pragma warning (disable:4786) -#endif - -#include "RAS_IRenderTools.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -struct KX_ClientObjectInfo; -class KX_RayCast; - -/* BlenderRenderTools are a set of tools to apply 2D/3D graphics effects, which - * are not part of the (polygon) Rasterizer. Effects like 2D text, 3D (polygon) - * text, lighting. - * - * Most of this code is duplicated in GPC_RenderTools, so this should be - * moved to some common location to avoid duplication. */ - -class KX_BlenderRenderTools : public RAS_IRenderTools -{ - int m_lastlightlayer; - bool m_lastlighting; - void *m_lastauxinfo; - static unsigned int m_numgllights; - -public: - KX_BlenderRenderTools(); - virtual ~KX_BlenderRenderTools(); - - void EndFrame(RAS_IRasterizer* rasty); - void BeginFrame(RAS_IRasterizer* rasty); - - void EnableOpenGLLights(RAS_IRasterizer *rasty); - void DisableOpenGLLights(); - void ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat); - - void RenderText2D(RAS_TEXT_RENDER_MODE mode, - const char* text, - int xco, - int yco, - int width, - int height); - void RenderText(int mode, - class RAS_IPolyMaterial* polymat, - float v1[3], - float v2[3], - float v3[3], - float v4[3], - int glattrib); - - void applyTransform(RAS_IRasterizer* rasty, double* oglmatrix, int objectdrawmode); - int applyLights(int objectlayer, const MT_Transform& viewmat); - - void PushMatrix(); - void PopMatrix(); - - bool RayHit(KX_ClientObjectInfo* client, class KX_RayCast* result, void * const data); - bool NeedRayCast(KX_ClientObjectInfo*) { return true; } - - virtual void MotionBlur(RAS_IRasterizer* rasterizer); - - virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderRenderTools"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_BLENDERRENDERTOOLS - - - diff --git a/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp b/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp deleted file mode 100644 index 813869dd032..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_ISystem.h" - -#ifdef WIN32 -#pragma warning (disable :4786) -#include -#endif //WIN32 - -#include -#include -#include "KX_BlenderInputDevice.h" -#include "KX_BlenderSystem.h" - -#include "PIL_time.h" - -KX_BlenderSystem::KX_BlenderSystem() -: KX_ISystem() -{ - m_starttime = PIL_check_seconds_timer(); -} - -double KX_BlenderSystem::GetTimeInSeconds() -{ - return PIL_check_seconds_timer() - m_starttime; -} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderSystem.h b/source/gameengine/BlenderRoutines/KX_BlenderSystem.h deleted file mode 100644 index 7c848a7a856..00000000000 --- a/source/gameengine/BlenderRoutines/KX_BlenderSystem.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_BLENDERSYSTEM -#define __KX_BLENDERSYSTEM - -/** - * Blender System embedding. Needed when gameengine runs embedded within Blender. - */ -#include "KX_ISystem.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class KX_BlenderSystem : public KX_ISystem -{ - double m_starttime; - -public: - KX_BlenderSystem(); - virtual ~KX_BlenderSystem() {}; - virtual double GetTimeInSeconds(); - - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderSystem"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_BLENDERSYSTEM - diff --git a/source/gameengine/BlenderRoutines/Makefile b/source/gameengine/BlenderRoutines/Makefile deleted file mode 100644 index 4a437aff97d..00000000000 --- a/source/gameengine/BlenderRoutines/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = bloutines -DIR = $(OCGDIR)/gameengine/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(OPENGL_HEADERS) -CPPFLAGS += -I$(NAN_AUDASPACE)/include -# because of kernel dependency on makesdna -CPPFLAGS += -I../../blender/makesdna -CPPFLAGS += -I../../blender/editors/include -# because of kernel dependency on imbuf -CPPFLAGS += -I../../blender/windowmanager -CPPFLAGS += -I../../blender/imbuf -CPPFLAGS += -I../../blender/blenlib -CPPFLAGS += -I../../blender/blenkernel -CPPFLAGS += -I../../blender/render/extern/include -CPPFLAGS += -I../../blender/blenloader -CPPFLAGS += -I../../blender/blenfont -CPPFLAGS += -I../../blender/gpu -CPPFLAGS += -I../../blender/makesrna -CPPFLAGS += -I../Converter -CPPFLAGS += -I../Expressions -CPPFLAGS += -I../GameLogic -CPPFLAGS += -I../Ketsji -CPPFLAGS += -I../Rasterizer -CPPFLAGS += -I../Rasterizer/RAS_OpenGLRasterizer -CPPFLAGS += -I../SceneGraph -CPPFLAGS += -I../../kernel/gen_system -CPPFLAGS += -I../Network -CPPFLAGS += -I../Network/LoopBackNetwork -CPPFLAGS += -I../Physics/common -CPPFLAGS += -I. - -ifeq ($(OS),windows) - CPPFLAGS += -I../../blender -endif - -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) - -ifeq ($(WITH_FFMPEG), true) - CPPFLAGS += -DWITH_FFMPEG -endif diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript deleted file mode 100644 index e5b263ad930..00000000000 --- a/source/gameengine/BlenderRoutines/SConscript +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = env.Glob('*.cpp') -defs = [ 'GLEW_STATIC' ] - -incs = '. #source/kernel/gen_system #intern/string #intern/guardedalloc' -incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer' -incs += ' #source/gameengine/Converter #source/blender/imbuf' -incs += ' #intern/ghost/include' -incs += ' #intern/audaspace/intern' -incs += ' #intern/moto/include #source/gameengine/Ketsji #source/blender/blenlib' -incs += ' #source/blender/blenkernel #source/blender' -incs += ' #source/blender/blenfont #source/blender/editors/include' -incs += ' #source/blender/makesdna #source/blender/makesrna' -incs += ' #source/gameengine/Rasterizer #source/gameengine/GameLogic' -incs += ' #source/gameengine/Expressions #source/gameengine/Network' -incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common' -incs += ' #source/gameengine/Physics/Bullet' -incs += ' #source/gameengine/Network/LoopBackNetwork' -incs += ' #source/blender/misc #source/blender/blenloader' -incs += ' #extern/glew/include #source/blender/gpu' -incs += ' #source/blender/windowmanager' - -if env['WITH_BF_FFMPEG']: - defs.append('WITH_FFMPEG') - -if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] -else: - defs.append('DISABLE_PYTHON') - -incs += ' ' + env['BF_BULLET_INC'] -incs += ' ' + env['BF_OPENGL_INC'] - -env.BlenderLib ( 'bf_bloutines', sources, Split(incs), defs, libtype=['core','player'], priority=[300,35] , cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/CMakeLists.txt b/source/gameengine/CMakeLists.txt deleted file mode 100644 index 7b58a2a6875..00000000000 --- a/source/gameengine/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -ADD_SUBDIRECTORY(BlenderRoutines) -ADD_SUBDIRECTORY(Converter) -ADD_SUBDIRECTORY(Expressions) -ADD_SUBDIRECTORY(GameLogic) -ADD_SUBDIRECTORY(Ketsji) -ADD_SUBDIRECTORY(Ketsji/KXNetwork) -ADD_SUBDIRECTORY(Network) -ADD_SUBDIRECTORY(Network/LoopBackNetwork) -ADD_SUBDIRECTORY(Physics/common) -ADD_SUBDIRECTORY(Physics/Dummy) -ADD_SUBDIRECTORY(Rasterizer) -ADD_SUBDIRECTORY(Rasterizer/RAS_OpenGLRasterizer) -ADD_SUBDIRECTORY(SceneGraph) -ADD_SUBDIRECTORY(Physics/Bullet) - -IF(WITH_PYTHON) - ADD_SUBDIRECTORY(VideoTexture) -ENDIF(WITH_PYTHON) - -IF(WITH_PLAYER) - ADD_SUBDIRECTORY(GamePlayer) -ENDIF(WITH_PLAYER) diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp deleted file mode 100644 index b8d4c4e0f04..00000000000 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ /dev/null @@ -1,677 +0,0 @@ -/** -* $Id$ -* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** -*/ - -#if defined (__sgi) -#include -#else -#include -#endif - -#include "SCA_LogicManager.h" -#include "BL_ActionActuator.h" -#include "BL_ArmatureObject.h" -#include "BL_SkinDeformer.h" -#include "KX_GameObject.h" -#include "STR_HashedString.h" -#include "DNA_nla_types.h" -#include "BKE_action.h" -#include "DNA_action_types.h" -#include "DNA_armature_types.h" -#include "DNA_scene_types.h" -#include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" -#include "BLI_math.h" -#include "MT_Matrix4x4.h" -#include "BKE_utildefines.h" -#include "FloatValue.h" -#include "PyObjectPlus.h" -#include "KX_PyMath.h" - -extern "C" { -#include "BKE_animsys.h" -#include "BKE_action.h" -#include "RNA_access.h" -#include "RNA_define.h" -} - -BL_ActionActuator::~BL_ActionActuator() -{ - if (m_pose) - game_free_pose(m_pose); - if (m_userpose) - game_free_pose(m_userpose); - if (m_blendpose) - game_free_pose(m_blendpose); -} - -void BL_ActionActuator::ProcessReplica() -{ - SCA_IActuator::ProcessReplica(); - - m_pose = NULL; - m_blendpose = NULL; - m_localtime=m_startframe; - m_lastUpdate=-1; - -} - -void BL_ActionActuator::SetBlendTime (float newtime){ - m_blendframe = newtime; -} - -CValue* BL_ActionActuator::GetReplica() { - BL_ActionActuator* replica = new BL_ActionActuator(*this);//m_float,GetName()); - replica->ProcessReplica(); - return replica; -} - -bool BL_ActionActuator::ClampLocalTime() -{ - if (m_startframe < m_endframe) - { - if (m_localtime < m_startframe) - { - m_localtime = m_startframe; - return true; - } - else if (m_localtime > m_endframe) - { - m_localtime = m_endframe; - return true; - } - } else { - if (m_localtime > m_startframe) - { - m_localtime = m_startframe; - return true; - } - else if (m_localtime < m_endframe) - { - m_localtime = m_endframe; - return true; - } - } - return false; -} - -void BL_ActionActuator::SetStartTime(float curtime) -{ - float direction = m_startframe < m_endframe ? 1.0 : -1.0; - - if (!(m_flag & ACT_FLAG_REVERSE)) - m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate(); - else - m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate(); -} - -void BL_ActionActuator::SetLocalTime(float curtime) -{ - float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate(); - - if (m_endframe < m_startframe) - delta_time = -delta_time; - - if (!(m_flag & ACT_FLAG_REVERSE)) - m_localtime = m_startframe + delta_time; - else - m_localtime = m_endframe - delta_time; -} - - -bool BL_ActionActuator::Update(double curtime, bool frame) -{ - bool bNegativeEvent = false; - bool bPositiveEvent = false; - bool keepgoing = true; - bool wrap = false; - bool apply=true; - int priority; - float newweight; - - curtime -= KX_KetsjiEngine::GetSuspendedDelta(); - - // result = true if animation has to be continued, false if animation stops - // maybe there are events for us in the queue ! - if (frame) - { - bNegativeEvent = m_negevent; - bPositiveEvent = m_posevent; - RemoveAllEvents(); - - if (bPositiveEvent) - m_flag |= ACT_FLAG_ACTIVE; - - if (bNegativeEvent) - { - // dont continue where we left off when restarting - if (m_end_reset) { - m_flag &= ~ACT_FLAG_LOCKINPUT; - } - - if (!(m_flag & ACT_FLAG_ACTIVE)) - return false; - m_flag &= ~ACT_FLAG_ACTIVE; - } - } - - /* We know that action actuators have been discarded from all non armature objects: - if we're being called, we're attached to a BL_ArmatureObject */ - BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); - float length = m_endframe - m_startframe; - - priority = m_priority; - - /* Determine pre-incrementation behaviour and set appropriate flags */ - switch (m_playtype){ - case ACT_ACTION_MOTION: - if (bNegativeEvent){ - keepgoing=false; - apply=false; - }; - break; - case ACT_ACTION_FROM_PROP: - if (bNegativeEvent){ - apply=false; - keepgoing=false; - } - break; - case ACT_ACTION_LOOP_END: - if (bPositiveEvent){ - if (!(m_flag & ACT_FLAG_LOCKINPUT)){ - m_flag &= ~ACT_FLAG_KEYUP; - m_flag &= ~ACT_FLAG_REVERSE; - m_flag |= ACT_FLAG_LOCKINPUT; - m_localtime = m_startframe; - m_starttime = curtime; - } - } - if (bNegativeEvent){ - m_flag |= ACT_FLAG_KEYUP; - } - break; - case ACT_ACTION_LOOP_STOP: - if (bPositiveEvent){ - if (!(m_flag & ACT_FLAG_LOCKINPUT)){ - m_flag &= ~ACT_FLAG_REVERSE; - m_flag &= ~ACT_FLAG_KEYUP; - m_flag |= ACT_FLAG_LOCKINPUT; - SetStartTime(curtime); - } - } - if (bNegativeEvent){ - m_flag |= ACT_FLAG_KEYUP; - m_flag &= ~ACT_FLAG_LOCKINPUT; - keepgoing=false; - apply=false; - } - break; - case ACT_ACTION_FLIPPER: - if (bPositiveEvent){ - if (!(m_flag & ACT_FLAG_LOCKINPUT)){ - m_flag &= ~ACT_FLAG_REVERSE; - m_flag |= ACT_FLAG_LOCKINPUT; - SetStartTime(curtime); - } - } - else if (bNegativeEvent){ - m_flag |= ACT_FLAG_REVERSE; - m_flag &= ~ACT_FLAG_LOCKINPUT; - SetStartTime(curtime); - } - break; - case ACT_ACTION_PLAY: - if (bPositiveEvent){ - if (!(m_flag & ACT_FLAG_LOCKINPUT)){ - m_flag &= ~ACT_FLAG_REVERSE; - m_localtime = m_starttime; - m_starttime = curtime; - m_flag |= ACT_FLAG_LOCKINPUT; - } - } - break; - default: - break; - } - - /* Perform increment */ - if (keepgoing){ - if (m_playtype == ACT_ACTION_MOTION){ - MT_Point3 newpos; - MT_Point3 deltapos; - - newpos = obj->NodeGetWorldPosition(); - - /* Find displacement */ - deltapos = newpos-m_lastpos; - m_localtime += (length/m_stridelength) * deltapos.length(); - m_lastpos = newpos; - } - else{ - SetLocalTime(curtime); - } - } - - /* Check if a wrapping response is needed */ - if (length){ - if (m_localtime < m_startframe || m_localtime > m_endframe) - { - m_localtime = m_startframe + fmod(m_localtime, length); - wrap = true; - } - } - else - m_localtime = m_startframe; - - /* Perform post-increment tasks */ - switch (m_playtype){ - case ACT_ACTION_FROM_PROP: - { - CValue* propval = GetParent()->GetProperty(m_propname); - if (propval) - m_localtime = propval->GetNumber(); - - if (bNegativeEvent){ - keepgoing=false; - } - } - break; - case ACT_ACTION_MOTION: - break; - case ACT_ACTION_LOOP_STOP: - break; - case ACT_ACTION_FLIPPER: - if (wrap){ - if (!(m_flag & ACT_FLAG_REVERSE)){ - m_localtime=m_endframe; - //keepgoing = false; - } - else { - m_localtime=m_startframe; - keepgoing = false; - } - } - break; - case ACT_ACTION_LOOP_END: - if (wrap){ - if (m_flag & ACT_FLAG_KEYUP){ - keepgoing = false; - m_localtime = m_endframe; - m_flag &= ~ACT_FLAG_LOCKINPUT; - } - SetStartTime(curtime); - } - break; - case ACT_ACTION_PLAY: - if (wrap){ - m_localtime = m_endframe; - keepgoing = false; - m_flag &= ~ACT_FLAG_LOCKINPUT; - } - break; - default: - keepgoing = false; - break; - } - - /* Set the property if its defined */ - if (m_framepropname[0] != '\0') { - CValue* propowner = GetParent(); - CValue* oldprop = propowner->GetProperty(m_framepropname); - CValue* newval = new CFloatValue(m_localtime); - if (oldprop) { - oldprop->SetValue(newval); - } else { - propowner->SetProperty(m_framepropname, newval); - } - newval->Release(); - } - - if (bNegativeEvent) - m_blendframe=0.0; - - /* Apply the pose if necessary*/ - if (apply){ - - /* Priority test */ - if (obj->SetActiveAction(this, priority, curtime)){ - - /* Get the underlying pose from the armature */ - obj->GetPose(&m_pose); - -// 2.4x function, - /* Override the necessary channels with ones from the action */ - // XXX extract_pose_from_action(m_pose, m_action, m_localtime); - - -// 2.5x - replacement for extract_pose_from_action(...) above. - { - struct PointerRNA id_ptr; - Object *arm= obj->GetArmatureObject(); - bPose *pose_back= arm->pose; - - arm->pose= m_pose; - RNA_id_pointer_create((ID *)arm, &id_ptr); - animsys_evaluate_action(&id_ptr, m_action, NULL, m_localtime); - - arm->pose= pose_back; - -// 2.5x - could also do this but looks too high level, constraints use this, it works ok. -// Object workob; /* evaluate using workob */ -// what_does_obaction((Scene *)obj->GetScene(), obj->GetArmatureObject(), &workob, m_pose, m_action, NULL, m_localtime); - } - - // done getting the pose from the action - - /* Perform the user override (if any) */ - if (m_userpose){ - extract_pose_from_pose(m_pose, m_userpose); - game_free_pose(m_userpose); //cant use MEM_freeN(m_userpose) because the channels need freeing too. - m_userpose = NULL; - } -#if 1 - /* Handle blending */ - if (m_blendin && (m_blendframeGetMRDPose(&m_blendpose); - m_blendstart = curtime; - } - - /* Find percentages */ - newweight = (m_blendframe/(float)m_blendin); - game_blend_poses(m_pose, m_blendpose, 1.0 - newweight); - - /* Increment current blending percentage */ - m_blendframe = (curtime - m_blendstart)*KX_KetsjiEngine::GetAnimFrameRate(); - if (m_blendframe>m_blendin) - m_blendframe = m_blendin; - - } -#endif - m_lastUpdate = m_localtime; - obj->SetPose (m_pose); - } - else{ - m_blendframe = 0.0; - } - } - - if (!keepgoing){ - m_blendframe = 0.0; - } - return keepgoing; -}; - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) { - char *string= _PyUnicode_AsString(value); - - if (!string) { - PyErr_SetString(PyExc_TypeError, "expected a single string"); - return NULL; - } - - bPoseChannel *pchan; - - if(m_userpose==NULL && m_pose==NULL) { - BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); - obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ - } - - // get_pose_channel accounts for NULL pose, run on both incase one exists but - // the channel doesnt - if( !(pchan=get_pose_channel(m_userpose, string)) && - !(pchan=get_pose_channel(m_pose, string)) ) - { - PyErr_SetString(PyExc_ValueError, "channel doesnt exist"); - return NULL; - } - - PyObject *ret = PyTuple_New(3); - - PyObject *list = PyList_New(3); - PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->loc[0])); - PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->loc[1])); - PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->loc[2])); - PyTuple_SET_ITEM(ret, 0, list); - - list = PyList_New(3); - PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->size[0])); - PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->size[1])); - PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->size[2])); - PyTuple_SET_ITEM(ret, 1, list); - - list = PyList_New(4); - PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->quat[0])); - PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->quat[1])); - PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->quat[2])); - PyList_SET_ITEM(list, 3, PyFloat_FromDouble(pchan->quat[3])); - PyTuple_SET_ITEM(ret, 2, list); - - return ret; -/* - return Py_BuildValue("([fff][fff][ffff])", - pchan->loc[0], pchan->loc[1], pchan->loc[2], - pchan->size[0], pchan->size[1], pchan->size[2], - pchan->quat[0], pchan->quat[1], pchan->quat[2], pchan->quat[3] ); -*/ -} - -/* setChannel */ -KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, -"setChannel(channel, matrix)\n" -"\t - channel : A string specifying the name of the bone channel.\n" -"\t - matrix : A 4x4 matrix specifying the overriding transformation\n" -"\t as an offset from the bone's rest position.\n") -{ - BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); - char *string; - PyObject *pymat= NULL; - PyObject *pyloc= NULL, *pysize= NULL, *pyquat= NULL; - bPoseChannel *pchan; - - if(PyTuple_Size(args)==2) { - if (!PyArg_ParseTuple(args,"sO:setChannel", &string, &pymat)) // matrix - return NULL; - } - else if(PyTuple_Size(args)==4) { - if (!PyArg_ParseTuple(args,"sOOO:setChannel", &string, &pyloc, &pysize, &pyquat)) // loc/size/quat - return NULL; - } - else { - PyErr_SetString(PyExc_ValueError, "Expected a string and a 4x4 matrix (2 args) or a string and loc/size/quat sequences (4 args)"); - return NULL; - } - - if(pymat) { - float matrix[4][4]; - MT_Matrix4x4 mat; - - if(!PyMatTo(pymat, mat)) - return NULL; - - mat.getValue((float*)matrix); - - BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); - - if (!m_userpose) { - if(!m_pose) - obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ - game_copy_pose(&m_userpose, m_pose, 0); - } - // pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there. - pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there. - - if(pchan) { - VECCOPY (pchan->loc, matrix[3]); - mat4_to_size( pchan->size,matrix); - mat4_to_quat( pchan->quat,matrix); - } - } - else { - MT_Vector3 loc; - MT_Vector3 size; - MT_Quaternion quat; - - if (!PyVecTo(pyloc, loc) || !PyVecTo(pysize, size) || !PyQuatTo(pyquat, quat)) - return NULL; - - // same as above - if (!m_userpose) { - if(!m_pose) - obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ - game_copy_pose(&m_userpose, m_pose, 0); - } - // pchan= verify_pose_channel(m_userpose, string); - pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there. - - // for some reason loc.setValue(pchan->loc) fails - if(pchan) { - pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2]; - pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2]; - pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */ - } - } - - if(pchan==NULL) { - PyErr_SetString(PyExc_ValueError, "Channel could not be found, use the 'channelNames' attribute to get a list of valid channels"); - return NULL; - } - - Py_RETURN_NONE; -} - -/* ------------------------------------------------------------------------- */ -/* Python Integration Hooks */ -/* ------------------------------------------------------------------------- */ - -PyTypeObject BL_ActionActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BL_ActionActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef BL_ActionActuator::Methods[] = { - {"getChannel", (PyCFunction) BL_ActionActuator::sPyGetChannel, METH_O}, - KX_PYMETHODTABLE(BL_ActionActuator, setChannel), - {NULL,NULL} //Sentinel -}; - -PyAttributeDef BL_ActionActuator::Attributes[] = { - KX_PYATTRIBUTE_FLOAT_RW("frameStart", 0, MAXFRAMEF, BL_ActionActuator, m_startframe), - KX_PYATTRIBUTE_FLOAT_RW("frameEnd", 0, MAXFRAMEF, BL_ActionActuator, m_endframe), - KX_PYATTRIBUTE_FLOAT_RW("blendIn", 0, MAXFRAMEF, BL_ActionActuator, m_blendin), - KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ActionActuator, pyattr_get_action, pyattr_set_action), - KX_PYATTRIBUTE_RO_FUNCTION("channelNames", BL_ActionActuator, pyattr_get_channel_names), - KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ActionActuator, m_priority), - KX_PYATTRIBUTE_FLOAT_RW_CHECK("frame", 0, MAXFRAMEF, BL_ActionActuator, m_localtime, CheckFrame), - KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ActionActuator, m_propname), - KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 31, false, BL_ActionActuator, m_framepropname), - KX_PYATTRIBUTE_BOOL_RW("useContinue", BL_ActionActuator, m_end_reset), - KX_PYATTRIBUTE_FLOAT_RW_CHECK("blendTime", 0, MAXFRAMEF, BL_ActionActuator, m_blendframe, CheckBlendTime), - KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",0,100,false,BL_ActionActuator,m_playtype,CheckType), - { NULL } //Sentinel -}; - -PyObject* BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - BL_ActionActuator* self= static_cast(self_v); - return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : ""); -} - -int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - BL_ActionActuator* self= static_cast(self_v); - - if (!PyUnicode_Check(value)) - { - PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, expected the string name of the action"); - return PY_SET_ATTR_FAIL; - } - - bAction *action= NULL; - STR_String val = _PyUnicode_AsString(value); - - if (val != "") - { - action= (bAction*)SCA_ILogicBrick::m_sCurrentLogicManager->GetActionByName(val); - if (!action) - { - PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, action not found!"); - return PY_SET_ATTR_FAIL; - } - } - - self->SetAction(action); - return PY_SET_ATTR_SUCCESS; - -} - -PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - BL_ActionActuator* self= static_cast(self_v); - PyObject *ret= PyList_New(0); - PyObject *item; - - bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose(); - - if(pose) { - bPoseChannel *pchan; - for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { - item= PyUnicode_FromString(pchan->name); - PyList_Append(ret, item); - Py_DECREF(item); - } - } - - return ret; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h deleted file mode 100644 index 10ce1fad27a..00000000000 --- a/source/gameengine/Converter/BL_ActionActuator.h +++ /dev/null @@ -1,177 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BL_ACTIONACTUATOR -#define BL_ACTIONACTUATOR - -#include "GEN_HashedPtr.h" -#include "SCA_IActuator.h" -#include "DNA_actuator_types.h" -#include "MT_Point3.h" - -class BL_ActionActuator : public SCA_IActuator -{ -public: - Py_Header; - BL_ActionActuator(SCA_IObject* gameobj, - const STR_String& propname, - const STR_String& framepropname, - float starttime, - float endtime, - struct bAction *action, - short playtype, - short blendin, - short priority, - short end_reset, - float stride) - : SCA_IActuator(gameobj, KX_ACT_ACTION), - - m_lastpos(0, 0, 0), - m_blendframe(0), - m_flag(0), - m_startframe (starttime), - m_endframe(endtime) , - m_starttime(0), - m_localtime(starttime), - m_lastUpdate(-1), - m_blendin(blendin), - m_blendstart(0), - m_stridelength(stride), - m_playtype(playtype), - m_priority(priority), - m_end_reset(end_reset), - m_pose(NULL), - m_blendpose(NULL), - m_userpose(NULL), - m_action(action), - m_propname(propname), - m_framepropname(framepropname) - { - }; - virtual ~BL_ActionActuator(); - virtual bool Update(double curtime, bool frame); - virtual CValue* GetReplica(); - virtual void ProcessReplica(); - - void SetBlendTime (float newtime); - - bAction* GetAction() { return m_action; } - void SetAction(bAction* act) { m_action= act; } - -#ifndef DISABLE_PYTHON - - KX_PYMETHOD_O(BL_ActionActuator,GetChannel); - KX_PYMETHOD_DOC(BL_ActionActuator,setChannel); - - static PyObject* pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - /* attribute check */ - static int CheckFrame(void *self, const PyAttributeDef*) - { - BL_ActionActuator* act = reinterpret_cast(self); - - if (act->m_localtime < act->m_startframe) - act->m_localtime = act->m_startframe; - else if (act->m_localtime > act->m_endframe) - act->m_localtime = act->m_endframe; - - return 0; - } - - static int CheckBlendTime(void *self, const PyAttributeDef*) - { - BL_ActionActuator* act = reinterpret_cast(self); - - if (act->m_blendframe > act->m_blendin) - act->m_blendframe = act->m_blendin; - - return 0; - } - - static int CheckType(void *self, const PyAttributeDef*) - { - BL_ActionActuator* act = reinterpret_cast(self); - - switch (act->m_playtype) { - case ACT_ACTION_PLAY: - case ACT_ACTION_FLIPPER: - case ACT_ACTION_LOOP_STOP: - case ACT_ACTION_LOOP_END: - case ACT_ACTION_FROM_PROP: - return 0; - default: - PyErr_SetString(PyExc_ValueError, "Action Actuator, invalid play type supplied"); - return 1; - } - } -#endif // DISABLE_PYTHON - -protected: - - void SetStartTime(float curtime); - void SetLocalTime(float curtime); - bool ClampLocalTime(); - - MT_Point3 m_lastpos; - float m_blendframe; - int m_flag; - /** The frame this action starts */ - float m_startframe; - /** The frame this action ends */ - float m_endframe; - /** The time this action started */ - float m_starttime; - /** The current time of the action */ - float m_localtime; - - float m_lastUpdate; - float m_blendin; - float m_blendstart; - float m_stridelength; - short m_playtype; - short m_priority; - bool m_end_reset; - struct bPose* m_pose; - struct bPose* m_blendpose; - struct bPose* m_userpose; - struct bAction *m_action; - STR_String m_propname; - STR_String m_framepropname; -}; - -enum { - ACT_FLAG_REVERSE = 0x00000001, - ACT_FLAG_LOCKINPUT = 0x00000002, - ACT_FLAG_KEYUP = 0x00000004, - ACT_FLAG_ACTIVE = 0x00000008 -}; - -#endif - diff --git a/source/gameengine/Converter/BL_ArmatureActuator.cpp b/source/gameengine/Converter/BL_ArmatureActuator.cpp deleted file mode 100644 index 82b8307a2bc..00000000000 --- a/source/gameengine/Converter/BL_ArmatureActuator.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "DNA_action_types.h" -#include "DNA_constraint_types.h" -#include "DNA_actuator_types.h" -#include "BKE_constraint.h" -#include "BL_ArmatureActuator.h" -#include "BL_ArmatureObject.h" -#include "BLI_math.h" - -/** - * This class is the conversion of the Pose channel constraint. - * It makes a link between the pose constraint and the KX scene. - * The main purpose is to give access to the constraint target - * to link it to a game object. - * It also allows to activate/deactivate constraints during the game. - * Later it will also be possible to create constraint on the fly - */ - -BL_ArmatureActuator::BL_ArmatureActuator(SCA_IObject* obj, - int type, - const char *posechannel, - const char *constraintname, - KX_GameObject* targetobj, - KX_GameObject* subtargetobj, - float weight) : - SCA_IActuator(obj, KX_ACT_ARMATURE), - m_constraint(NULL), - m_gametarget(targetobj), - m_gamesubtarget(subtargetobj), - m_posechannel(posechannel), - m_constraintname(constraintname), - m_weight(weight), - m_type(type) -{ - if (m_gametarget) - m_gametarget->RegisterActuator(this); - if (m_gamesubtarget) - m_gamesubtarget->RegisterActuator(this); - FindConstraint(); -} - -BL_ArmatureActuator::~BL_ArmatureActuator() -{ - if (m_gametarget) - m_gametarget->UnregisterActuator(this); - if (m_gamesubtarget) - m_gamesubtarget->UnregisterActuator(this); -} - -void BL_ArmatureActuator::ProcessReplica() -{ - // the replica is tracking the same object => register it (this may be changed in Relnk()) - if (m_gametarget) - m_gametarget->RegisterActuator(this); - if (m_gamesubtarget) - m_gamesubtarget->UnregisterActuator(this); - SCA_IActuator::ProcessReplica(); -} - -void BL_ArmatureActuator::ReParent(SCA_IObject* parent) -{ - SCA_IActuator::ReParent(parent); - // must remap the constraint - FindConstraint(); -} - -bool BL_ArmatureActuator::UnlinkObject(SCA_IObject* clientobj) -{ - bool res=false; - if (clientobj == m_gametarget) - { - // this object is being deleted, we cannot continue to track it. - m_gametarget = NULL; - res = true; - } - if (clientobj == m_gamesubtarget) - { - // this object is being deleted, we cannot continue to track it. - m_gamesubtarget = NULL; - res = true; - } - return res; -} - -void BL_ArmatureActuator::Relink(GEN_Map *obj_map) -{ - void **h_obj = (*obj_map)[m_gametarget]; - if (h_obj) { - if (m_gametarget) - m_gametarget->UnregisterActuator(this); - m_gametarget = (KX_GameObject*)(*h_obj); - m_gametarget->RegisterActuator(this); - } - h_obj = (*obj_map)[m_gamesubtarget]; - if (h_obj) { - if (m_gamesubtarget) - m_gamesubtarget->UnregisterActuator(this); - m_gamesubtarget = (KX_GameObject*)(*h_obj); - m_gamesubtarget->RegisterActuator(this); - } -} - -void BL_ArmatureActuator::FindConstraint() -{ - m_constraint = NULL; - - if (m_gameobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) { - BL_ArmatureObject* armobj = (BL_ArmatureObject*)m_gameobj; - m_constraint = armobj->GetConstraint(m_posechannel, m_constraintname); - } -} - -bool BL_ArmatureActuator::Update(double curtime, bool frame) -{ - // the only role of this actuator is to ensure that the armature pose will be evaluated - bool result = false; - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (!bNegativeEvent) { - BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); - switch (m_type) { - case ACT_ARM_RUN: - result = true; - obj->SetActiveAction(NULL, 0, curtime); - break; - case ACT_ARM_ENABLE: - if (m_constraint) - m_constraint->ClrConstraintFlag(CONSTRAINT_OFF); - break; - case ACT_ARM_DISABLE: - if (m_constraint) - m_constraint->SetConstraintFlag(CONSTRAINT_OFF); - break; - case ACT_ARM_SETTARGET: - if (m_constraint) { - m_constraint->SetTarget(m_gametarget); - m_constraint->SetSubtarget(m_gamesubtarget); - } - break; - case ACT_ARM_SETWEIGHT: - if (m_constraint) - m_constraint->SetWeight(m_weight); - break; - } - } - return result; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python Integration Hooks */ -/* ------------------------------------------------------------------------- */ - -PyTypeObject BL_ArmatureActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BL_ArmatureActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - - -PyMethodDef BL_ArmatureActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef BL_ArmatureActuator::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("constraint", BL_ArmatureActuator, pyattr_get_constraint), - KX_PYATTRIBUTE_RW_FUNCTION("target", BL_ArmatureActuator, pyattr_get_object, pyattr_set_object), - KX_PYATTRIBUTE_RW_FUNCTION("subtarget", BL_ArmatureActuator, pyattr_get_object, pyattr_set_object), - KX_PYATTRIBUTE_FLOAT_RW("weight",0.0f,1.0f,BL_ArmatureActuator,m_weight), - KX_PYATTRIBUTE_INT_RW("type",0,ACT_ARM_MAXTYPE,false,BL_ArmatureActuator,m_type), - { NULL } //Sentinel -}; - -PyObject* BL_ArmatureActuator::pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - BL_ArmatureActuator* actuator = static_cast(self); - KX_GameObject *target = (!strcmp(attrdef->m_name, "target")) ? actuator->m_gametarget : actuator->m_gamesubtarget; - if (!target) - Py_RETURN_NONE; - else - return target->GetProxy(); -} - -int BL_ArmatureActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - BL_ArmatureActuator* actuator = static_cast(self); - KX_GameObject* &target = (!strcmp(attrdef->m_name, "target")) ? actuator->m_gametarget : actuator->m_gamesubtarget; - KX_GameObject *gameobj; - - if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.object = value: BL_ArmatureActuator")) - return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - - if (target != NULL) - target->UnregisterActuator(actuator); - - target = gameobj; - - if (target) - target->RegisterActuator(actuator); - - return PY_SET_ATTR_SUCCESS; -} - -PyObject* BL_ArmatureActuator::pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - BL_ArmatureActuator* actuator = static_cast(self); - BL_ArmatureConstraint* constraint = actuator->m_constraint; - if (!constraint) - Py_RETURN_NONE; - else - return constraint->GetProxy(); -} - -#endif // DISABLE_PYTHON - diff --git a/source/gameengine/Converter/BL_ArmatureActuator.h b/source/gameengine/Converter/BL_ArmatureActuator.h deleted file mode 100644 index 72e2e96ea73..00000000000 --- a/source/gameengine/Converter/BL_ArmatureActuator.h +++ /dev/null @@ -1,93 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef BL_ARMATUREACTUATOR -#define BL_ARMATUREACTUATOR - -#include "SCA_IActuator.h" -#include "BL_ArmatureConstraint.h" - -/** - * This class is the conversion of the Pose channel constraint. - * It makes a link between the pose constraint and the KX scene. - * The main purpose is to give access to the constraint target - * to link it to a game object. - * It also allows to activate/deactivate constraints during the game. - * Later it will also be possible to create constraint on the fly - */ - -class BL_ArmatureActuator : public SCA_IActuator -{ - Py_Header; -public: - BL_ArmatureActuator(SCA_IObject* gameobj, - int type, - const char *posechannel, - const char *constraintname, - KX_GameObject* targetobj, - KX_GameObject* subtargetobj, - float weight); - - virtual ~BL_ArmatureActuator(); - - virtual CValue* GetReplica() { - BL_ArmatureActuator* replica = new BL_ArmatureActuator(*this); - replica->ProcessReplica(); - return replica; - }; - virtual void ProcessReplica(); - virtual bool UnlinkObject(SCA_IObject* clientobj); - virtual void Relink(GEN_Map *obj_map); - virtual bool Update(double curtime, bool frame); - virtual void ReParent(SCA_IObject* parent); - -#ifndef DISABLE_PYTHON - - /* These are used to get and set m_target */ - static PyObject* pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - -#endif // DISABLE_PYTHON - -private: - // identify the constraint that this actuator controls - void FindConstraint(); - - BL_ArmatureConstraint* m_constraint; - KX_GameObject* m_gametarget; - KX_GameObject* m_gamesubtarget; - STR_String m_posechannel; - STR_String m_constraintname; - float m_weight; - int m_type; -}; - -#endif //BL_ARMATUREACTUATOR - - diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp deleted file mode 100644 index 4bf2117c5c5..00000000000 --- a/source/gameengine/Converter/BL_ArmatureChannel.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "DNA_armature_types.h" -#include "BL_ArmatureChannel.h" -#include "BL_ArmatureObject.h" -#include "BL_ArmatureConstraint.h" -#include "BLI_math.h" -#include "BLI_string.h" - -#ifndef DISABLE_PYTHON - -PyTypeObject BL_ArmatureChannel::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BL_ArmatureChannel", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &CValue::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyObject* BL_ArmatureChannel::py_repr(void) -{ - return PyUnicode_FromString(m_posechannel->name); -} - -PyObject *BL_ArmatureChannel::GetProxy() -{ - return GetProxyPlus_Ext(this, &Type, m_posechannel); -} - -PyObject *BL_ArmatureChannel::NewProxy(bool py_owns) -{ - return NewProxyPlus_Ext(this, &Type, m_posechannel, py_owns); -} - -#endif // DISABLE_PYTHON - -BL_ArmatureChannel::BL_ArmatureChannel( - BL_ArmatureObject *armature, - bPoseChannel *posechannel) - : PyObjectPlus(), m_posechannel(posechannel), m_armature(armature) -{ -} - -BL_ArmatureChannel::~BL_ArmatureChannel() -{ -} - -#ifndef DISABLE_PYTHON - -// PYTHON - -PyMethodDef BL_ArmatureChannel::Methods[] = { - {NULL,NULL} //Sentinel -}; - -// order of definition of attributes, must match Attributes[] array -#define BCA_BONE 0 -#define BCA_PARENT 1 - -PyAttributeDef BL_ArmatureChannel::Attributes[] = { - // Keep these attributes in order of BCA_ defines!!! used by py_attr_getattr and py_attr_setattr - KX_PYATTRIBUTE_RO_FUNCTION("bone",BL_ArmatureChannel,py_attr_getattr), - KX_PYATTRIBUTE_RO_FUNCTION("parent",BL_ArmatureChannel,py_attr_getattr), - - { NULL } //Sentinel -}; - -/* attributes directly taken from bPoseChannel */ -PyAttributeDef BL_ArmatureChannel::AttributesPtr[] = { - KX_PYATTRIBUTE_CHAR_RO("name",bPoseChannel,name), - KX_PYATTRIBUTE_FLAG_RO("has_ik",bPoseChannel,flag, POSE_CHAIN), - KX_PYATTRIBUTE_FLAG_NEGATIVE_RO("ik_dof_x",bPoseChannel,ikflag, BONE_IK_NO_XDOF), - KX_PYATTRIBUTE_FLAG_NEGATIVE_RO("ik_dof_y",bPoseChannel,ikflag, BONE_IK_NO_YDOF), - KX_PYATTRIBUTE_FLAG_NEGATIVE_RO("ik_dof_z",bPoseChannel,ikflag, BONE_IK_NO_ZDOF), - KX_PYATTRIBUTE_FLAG_RO("ik_limit_x",bPoseChannel,ikflag, BONE_IK_XLIMIT), - KX_PYATTRIBUTE_FLAG_RO("ik_limit_y",bPoseChannel,ikflag, BONE_IK_YLIMIT), - KX_PYATTRIBUTE_FLAG_RO("ik_limit_z",bPoseChannel,ikflag, BONE_IK_ZLIMIT), - KX_PYATTRIBUTE_FLAG_RO("ik_rot_control",bPoseChannel,ikflag, BONE_IK_ROTCTL), - KX_PYATTRIBUTE_FLAG_RO("ik_lin_control",bPoseChannel,ikflag, BONE_IK_LINCTL), - KX_PYATTRIBUTE_FLOAT_VECTOR_RW("location",-FLT_MAX,FLT_MAX,bPoseChannel,loc,3), - KX_PYATTRIBUTE_FLOAT_VECTOR_RW("scale",-FLT_MAX,FLT_MAX,bPoseChannel,size,3), - KX_PYATTRIBUTE_FLOAT_VECTOR_RW("rotation_quaternion",-1.0f,1.0f,bPoseChannel,quat,4), - KX_PYATTRIBUTE_FLOAT_VECTOR_RW("rotaion_euler",-10.f,10.f,bPoseChannel,eul,3), - KX_PYATTRIBUTE_SHORT_RW("rotation_mode",0,ROT_MODE_MAX-1,false,bPoseChannel,rotmode), - KX_PYATTRIBUTE_FLOAT_MATRIX_RO("channel_matrix",bPoseChannel,chan_mat,4), - KX_PYATTRIBUTE_FLOAT_MATRIX_RO("pose_matrix",bPoseChannel,pose_mat,4), - KX_PYATTRIBUTE_FLOAT_VECTOR_RO("pose_head",bPoseChannel,pose_head,3), - KX_PYATTRIBUTE_FLOAT_VECTOR_RO("pose_tail",bPoseChannel,pose_tail,3), - KX_PYATTRIBUTE_FLOAT_RO("ik_min_x",bPoseChannel,limitmin[0]), - KX_PYATTRIBUTE_FLOAT_RO("ik_max_x",bPoseChannel,limitmax[0]), - KX_PYATTRIBUTE_FLOAT_RO("ik_min_y",bPoseChannel,limitmin[1]), - KX_PYATTRIBUTE_FLOAT_RO("ik_max_y",bPoseChannel,limitmax[1]), - KX_PYATTRIBUTE_FLOAT_RO("ik_min_z",bPoseChannel,limitmin[2]), - KX_PYATTRIBUTE_FLOAT_RO("ik_max_z",bPoseChannel,limitmax[2]), - KX_PYATTRIBUTE_FLOAT_RO("ik_stiffness_x",bPoseChannel,stiffness[0]), - KX_PYATTRIBUTE_FLOAT_RO("ik_stiffness_y",bPoseChannel,stiffness[1]), - KX_PYATTRIBUTE_FLOAT_RO("ik_stiffness_z",bPoseChannel,stiffness[2]), - KX_PYATTRIBUTE_FLOAT_RO("ik_stretch",bPoseChannel,ikstretch), - KX_PYATTRIBUTE_FLOAT_RW("ik_rot_weight",0,1.0f,bPoseChannel,ikrotweight), - KX_PYATTRIBUTE_FLOAT_RW("ik_lin_weight",0,1.0f,bPoseChannel,iklinweight), - KX_PYATTRIBUTE_RW_FUNCTION("joint_rotation",BL_ArmatureChannel,py_attr_get_joint_rotation,py_attr_set_joint_rotation), - { NULL } //Sentinel -}; - -PyObject* BL_ArmatureChannel::py_attr_getattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - BL_ArmatureChannel* self= static_cast(self_v); - bPoseChannel* channel = self->m_posechannel; - int attr_order = attrdef-Attributes; - - if (!channel) { - PyErr_SetString(PyExc_AttributeError, "channel is NULL"); - return NULL; - } - - switch (attr_order) { - case BCA_BONE: - // bones are standalone proxy - return NewProxyPlus_Ext(NULL,&BL_ArmatureBone::Type,channel->bone,false); - case BCA_PARENT: - { - BL_ArmatureChannel* parent = self->m_armature->GetChannel(channel->parent); - if (parent) - return parent->GetProxy(); - else - Py_RETURN_NONE; - } - } - PyErr_SetString(PyExc_AttributeError, "channel unknown attribute"); - return NULL; -} - -int BL_ArmatureChannel::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - BL_ArmatureChannel* self= static_cast(self_v); - bPoseChannel* channel = self->m_posechannel; - int attr_order = attrdef-Attributes; - -// int ival; -// double dval; -// char* sval; -// KX_GameObject *oval; - - if (!channel) { - PyErr_SetString(PyExc_AttributeError, "channel is NULL"); - return PY_SET_ATTR_FAIL; - } - - switch (attr_order) { - default: - break; - } - - PyErr_SetString(PyExc_AttributeError, "channel unknown attribute"); - return PY_SET_ATTR_FAIL; -} - -PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - BL_ArmatureChannel* self= static_cast(self_v); - bPoseChannel* pchan = self->m_posechannel; - // decompose the pose matrix in euler rotation - float rest_mat[3][3]; - float pose_mat[3][3]; - float joint_mat[3][3]; - float joints[3]; - float norm; - double sa, ca; - // get rotation in armature space - copy_m3_m4(pose_mat, pchan->pose_mat); - normalize_m3(pose_mat); - if (pchan->parent) { - // bone has a parent, compute the rest pose of the bone taking actual pose of parent - mul_m3_m3m4(rest_mat, pchan->bone->bone_mat, pchan->parent->pose_mat); - normalize_m3(rest_mat); - } else { - // otherwise, the bone matrix in armature space is the rest pose - copy_m3_m4(rest_mat, pchan->bone->arm_mat); - } - // remove the rest pose to get the joint movement - transpose_m3(rest_mat); - mul_m3_m3m3(joint_mat, rest_mat, pose_mat); - joints[0] = joints[1] = joints[2] = 0.f; - // returns a 3 element list that gives corresponding joint - int flag = 0; - if (!(pchan->ikflag & BONE_IK_NO_XDOF)) - flag |= 1; - if (!(pchan->ikflag & BONE_IK_NO_YDOF)) - flag |= 2; - if (!(pchan->ikflag & BONE_IK_NO_ZDOF)) - flag |= 4; - switch (flag) { - case 0: // fixed joint - break; - case 1: // X only - mat3_to_eulO( joints, EULER_ORDER_XYZ,joint_mat); - joints[1] = joints[2] = 0.f; - break; - case 2: // Y only - mat3_to_eulO( joints, EULER_ORDER_XYZ,joint_mat); - joints[0] = joints[2] = 0.f; - break; - case 3: // X+Y - mat3_to_eulO( joints, EULER_ORDER_ZYX,joint_mat); - joints[2] = 0.f; - break; - case 4: // Z only - mat3_to_eulO( joints, EULER_ORDER_XYZ,joint_mat); - joints[0] = joints[1] = 0.f; - break; - case 5: // X+Z - // decompose this as an equivalent rotation vector in X/Z plane - joints[0] = joint_mat[1][2]; - joints[2] = -joint_mat[1][0]; - norm = normalize_v3(joints); - if (norm < FLT_EPSILON) { - norm = (joint_mat[1][1] < 0.f) ? M_PI : 0.f; - } else { - norm = acos(joint_mat[1][1]); - } - mul_v3_fl(joints, norm); - break; - case 6: // Y+Z - mat3_to_eulO( joints, EULER_ORDER_XYZ,joint_mat); - joints[0] = 0.f; - break; - case 7: // X+Y+Z - // equivalent axis - joints[0] = (joint_mat[1][2]-joint_mat[2][1])*0.5f; - joints[1] = (joint_mat[2][0]-joint_mat[0][2])*0.5f; - joints[2] = (joint_mat[0][1]-joint_mat[1][0])*0.5f; - sa = len_v3(joints); - ca = (joint_mat[0][0]+joint_mat[1][1]+joint_mat[1][1]-1.0f)*0.5f; - if (sa > FLT_EPSILON) { - norm = atan2(sa,ca)/sa; - } else { - if (ca < 0.0) { - norm = M_PI; - mul_v3_fl(joints,0.f); - if (joint_mat[0][0] > 0.f) { - joints[0] = 1.0f; - } else if (joint_mat[1][1] > 0.f) { - joints[1] = 1.0f; - } else { - joints[2] = 1.0f; - } - } else { - norm = 0.0; - } - } - mul_v3_fl(joints,norm); - break; - } - return newVectorObject(joints, 3, Py_NEW, NULL); -} - -int BL_ArmatureChannel::py_attr_set_joint_rotation(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - BL_ArmatureChannel* self= static_cast(self_v); - bPoseChannel* pchan = self->m_posechannel; - PyObject *item; - float joints[3]; - float quat[4]; - - if (!PySequence_Check(value) || PySequence_Size(value) != 3) { - PyErr_SetString(PyExc_AttributeError, "expected a sequence of [3] floats"); - return PY_SET_ATTR_FAIL; - } - for (int i=0; i<3; i++) { - item = PySequence_GetItem(value, i); /* new ref */ - joints[i] = PyFloat_AsDouble(item); - Py_DECREF(item); - if (joints[i] == -1.0f && PyErr_Occurred()) { - PyErr_SetString(PyExc_AttributeError, "expected a sequence of [3] floats"); - return PY_SET_ATTR_FAIL; - } - } - - int flag = 0; - if (!(pchan->ikflag & BONE_IK_NO_XDOF)) - flag |= 1; - if (!(pchan->ikflag & BONE_IK_NO_YDOF)) - flag |= 2; - if (!(pchan->ikflag & BONE_IK_NO_ZDOF)) - flag |= 4; - unit_qt(quat); - switch (flag) { - case 0: // fixed joint - break; - case 1: // X only - joints[1] = joints[2] = 0.f; - eulO_to_quat( quat,joints, EULER_ORDER_XYZ); - break; - case 2: // Y only - joints[0] = joints[2] = 0.f; - eulO_to_quat( quat,joints, EULER_ORDER_XYZ); - break; - case 3: // X+Y - joints[2] = 0.f; - eulO_to_quat( quat,joints, EULER_ORDER_ZYX); - break; - case 4: // Z only - joints[0] = joints[1] = 0.f; - eulO_to_quat( quat,joints, EULER_ORDER_XYZ); - break; - case 5: // X+Z - // X and Z are components of an equivalent rotation axis - joints[1] = 0; - axis_angle_to_quat( quat,joints, len_v3(joints)); - break; - case 6: // Y+Z - joints[0] = 0.f; - eulO_to_quat( quat,joints, EULER_ORDER_XYZ); - break; - case 7: // X+Y+Z - // equivalent axis - axis_angle_to_quat( quat,joints, len_v3(joints)); - break; - } - if (pchan->rotmode > 0) { - quat_to_eulO( joints, pchan->rotmode,quat); - copy_v3_v3(pchan->eul, joints); - } else - copy_qt_qt(pchan->quat, quat); - return PY_SET_ATTR_SUCCESS; -} - -// ************************* -// BL_ArmatureBone -// -// Access to Bone structure -PyTypeObject BL_ArmatureBone::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BL_ArmatureBone", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_bone_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &CValue::Type, - 0,0,0,0,0,0, - py_base_new -}; - -// not used since this class is never instantiated -PyObject *BL_ArmatureBone::GetProxy() -{ - return NULL; -} -PyObject *BL_ArmatureBone::NewProxy(bool py_owns) -{ - return NULL; -} - -PyObject *BL_ArmatureBone::py_bone_repr(PyObject *self) -{ - Bone* bone = static_castBGE_PROXY_PTR(self); - return PyUnicode_FromString(bone->name); -} - -PyMethodDef BL_ArmatureBone::Methods[] = { - {NULL,NULL} //Sentinel -}; - -/* no attributes on C++ class since it is never instantiated */ -PyAttributeDef BL_ArmatureBone::Attributes[] = { - { NULL } //Sentinel -}; - -// attributes that work on proxy ptr (points to a Bone structure) -PyAttributeDef BL_ArmatureBone::AttributesPtr[] = { - KX_PYATTRIBUTE_CHAR_RO("name",Bone,name), - KX_PYATTRIBUTE_FLAG_RO("connected",Bone,flag, BONE_CONNECTED), - KX_PYATTRIBUTE_FLAG_RO("hinge",Bone,flag, BONE_HINGE), - KX_PYATTRIBUTE_FLAG_NEGATIVE_RO("inherit_scale",Bone,flag, BONE_NO_SCALE), - KX_PYATTRIBUTE_SHORT_RO("bbone_segments",Bone,segments), - KX_PYATTRIBUTE_FLOAT_RO("roll",Bone,roll), - KX_PYATTRIBUTE_FLOAT_VECTOR_RO("head",Bone,head,3), - KX_PYATTRIBUTE_FLOAT_VECTOR_RO("tail",Bone,tail,3), - KX_PYATTRIBUTE_FLOAT_RO("length",Bone,length), - KX_PYATTRIBUTE_FLOAT_VECTOR_RO("arm_head",Bone,arm_head,3), - KX_PYATTRIBUTE_FLOAT_VECTOR_RO("arm_tail",Bone,arm_tail,3), - KX_PYATTRIBUTE_FLOAT_MATRIX_RO("arm_mat",Bone,arm_mat,4), - KX_PYATTRIBUTE_FLOAT_MATRIX_RO("bone_mat",Bone,bone_mat,4), - KX_PYATTRIBUTE_RO_FUNCTION("parent",BL_ArmatureBone,py_bone_get_parent), - KX_PYATTRIBUTE_RO_FUNCTION("children",BL_ArmatureBone,py_bone_get_parent), - { NULL } //Sentinel -}; - -PyObject *BL_ArmatureBone::py_bone_get_parent(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - Bone* bone = reinterpret_castBGE_PROXY_PTR(self); - if (bone->parent) { - // create a proxy unconnected to any GE object - return NewProxyPlus_Ext(NULL,&Type,bone->parent,false); - } - Py_RETURN_NONE; -} - -PyObject *BL_ArmatureBone::py_bone_get_children(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - Bone* bone = reinterpret_castBGE_PROXY_PTR(self); - Bone* child; - int count = 0; - for (child=(Bone*)bone->childbase.first; child; child=(Bone*)child->next) - count++; - - PyObject* childrenlist = PyList_New(count); - - for (count = 0, child=(Bone*)bone->childbase.first; child; child=(Bone*)child->next, ++count) - PyList_SET_ITEM(childrenlist,count,NewProxyPlus_Ext(NULL,&Type,child,false)); - - return childrenlist; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Converter/BL_ArmatureChannel.h b/source/gameengine/Converter/BL_ArmatureChannel.h deleted file mode 100644 index 79f0cc80348..00000000000 --- a/source/gameengine/Converter/BL_ArmatureChannel.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __BL_ARMATURECHANNEL -#define __BL_ARMATURECHANNEL - -#include "DNA_action_types.h" -#include "GEN_HashedPtr.h" -#include "GEN_Map.h" -#include "PyObjectPlus.h" - -class SCA_IObject; -class KX_GameObject; -class BL_ArmatureObject; -struct bConstraint; -struct bPoseChannel; -struct Object; -struct bPose; - -class BL_ArmatureChannel : public PyObjectPlus -{ - // use Py_HeaderPtr since we use generic pointer in proxy - Py_HeaderPtr; - -private: - friend class BL_ArmatureObject; - struct bPoseChannel* m_posechannel; - BL_ArmatureObject* m_armature; - -public: - BL_ArmatureChannel(class BL_ArmatureObject *armature, - struct bPoseChannel *posechannel); - virtual ~BL_ArmatureChannel(); - -#ifndef DISABLE_PYTHON - // Python access - virtual PyObject* py_repr(void); - - static PyObject* py_attr_getattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int py_attr_setattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* py_attr_get_joint_rotation(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int py_attr_set_joint_rotation(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); -#endif // DISABLE_PYTHON -}; - -/* this is a factory class to access bBone data field in the GE. - It's not supposed to be instantiated, we only need it for the Attributes and Method array. - The actual proxy object will be manually created using NewProxyPtr */ -class BL_ArmatureBone : public PyObjectPlus -{ - // use Py_HeaderPtr since we use generic pointer in proxy - Py_HeaderPtr; -private: - // make constructor private to make sure no one tries to instantiate this class - BL_ArmatureBone() {} - virtual ~BL_ArmatureBone() {} - -public: - -#ifndef DISABLE_PYTHON - static PyObject *py_bone_repr(PyObject *self); - static PyObject *py_bone_get_parent(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static PyObject *py_bone_get_children(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); -#endif - -}; - - -#endif //__BL_ARMATURECHANNEL - diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.cpp b/source/gameengine/Converter/BL_ArmatureConstraint.cpp deleted file mode 100644 index 0b7ab043d16..00000000000 --- a/source/gameengine/Converter/BL_ArmatureConstraint.cpp +++ /dev/null @@ -1,450 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "DNA_constraint_types.h" -#include "DNA_action_types.h" -#include "BL_ArmatureConstraint.h" -#include "BL_ArmatureObject.h" -#include "BLI_math.h" -#include "BLI_string.h" - -#ifndef DISABLE_PYTHON - -PyTypeObject BL_ArmatureConstraint::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BL_ArmatureConstraint", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &CValue::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyObject* BL_ArmatureConstraint::py_repr(void) -{ - return PyUnicode_FromString(m_name); -} - -#endif // DISABLE_PYTHON - -BL_ArmatureConstraint::BL_ArmatureConstraint( - BL_ArmatureObject *armature, - bPoseChannel *posechannel, - bConstraint *constraint, - KX_GameObject* target, - KX_GameObject* subtarget) - : PyObjectPlus(), m_constraint(constraint), m_posechannel(posechannel), m_armature(armature) -{ - m_target = target; - m_blendtarget = (target) ? target->GetBlenderObject() : NULL; - m_subtarget = subtarget; - m_blendsubtarget = (subtarget) ? subtarget->GetBlenderObject() : NULL; - m_pose = m_subpose = NULL; - if (m_blendtarget) { - copy_m4_m4(m_blendmat, m_blendtarget->obmat); - if (m_blendtarget->type == OB_ARMATURE) - m_pose = m_blendtarget->pose; - } - if (m_blendsubtarget) { - copy_m4_m4(m_blendsubmat, m_blendsubtarget->obmat); - if (m_blendsubtarget->type == OB_ARMATURE) - m_subpose = m_blendsubtarget->pose; - } - if (m_target) - m_target->RegisterObject(m_armature); - if (m_subtarget) - m_subtarget->RegisterObject(m_armature); - BLI_snprintf(m_name, sizeof(m_name), "%s:%s", m_posechannel->name, m_constraint->name); -} - -BL_ArmatureConstraint::~BL_ArmatureConstraint() -{ - if (m_target) - m_target->UnregisterObject(m_armature); - if (m_subtarget) - m_subtarget->UnregisterObject(m_armature); -} - -BL_ArmatureConstraint* BL_ArmatureConstraint::GetReplica() const -{ - BL_ArmatureConstraint* replica = new BL_ArmatureConstraint(*this); - replica->ProcessReplica(); - return replica; -} - -void BL_ArmatureConstraint::ReParent(BL_ArmatureObject* armature) -{ - m_armature = armature; - if (m_target) - m_target->RegisterObject(armature); - if (m_subtarget) - m_subtarget->RegisterObject(armature); - // find the corresponding constraint in the new armature object - if (m_constraint) { - bPose* newpose = armature->GetOrigPose(); - char* constraint = m_constraint->name; - char* posechannel = m_posechannel->name; - bPoseChannel* pchan; - bConstraint* pcon; - m_constraint = NULL; - m_posechannel = NULL; - // and locate the constraint - for (pchan = (bPoseChannel*)newpose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { - if (!strcmp(pchan->name, posechannel)) { - // now locate the constraint - for (pcon = (bConstraint*)pchan->constraints.first; pcon; pcon=(bConstraint*)pcon->next) { - if (!strcmp(pcon->name, constraint)) { - m_constraint = pcon; - m_posechannel = pchan; - break; - } - } - break; - } - } - } -} - -void BL_ArmatureConstraint::Relink(GEN_Map *obj_map) -{ - void **h_obj = (*obj_map)[m_target]; - if (h_obj) { - m_target->UnregisterObject(m_armature); - m_target = (KX_GameObject*)(*h_obj); - m_target->RegisterObject(m_armature); - } - h_obj = (*obj_map)[m_subtarget]; - if (h_obj) { - m_subtarget->UnregisterObject(m_armature); - m_subtarget = (KX_GameObject*)(*h_obj); - m_subtarget->RegisterObject(m_armature); - } -} - -bool BL_ArmatureConstraint::UnlinkObject(SCA_IObject* clientobj) -{ - bool res=false; - if (clientobj == m_target) { - m_target = NULL; - res = true; - } - if (clientobj == m_subtarget) { - m_subtarget = NULL; - res = true; - } - return res; -} - -void BL_ArmatureConstraint::UpdateTarget() -{ - if (m_constraint && !(m_constraint->flag&CONSTRAINT_OFF) && (!m_blendtarget || m_target)) { - if (m_blendtarget) { - // external target, must be updated - m_target->UpdateBlenderObjectMatrix(m_blendtarget); - if (m_pose && m_target->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) - // update the pose in case a bone is specified in the constraint target - m_blendtarget->pose = ((BL_ArmatureObject*)m_target)->GetOrigPose(); - } - if (m_blendsubtarget && m_subtarget) { - m_subtarget->UpdateBlenderObjectMatrix(m_blendsubtarget); - if (m_subpose && m_subtarget->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) - m_blendsubtarget->pose = ((BL_ArmatureObject*)m_target)->GetOrigPose(); - } - } -} - -void BL_ArmatureConstraint::RestoreTarget() -{ - if (m_constraint && !(m_constraint->flag&CONSTRAINT_OFF) && (!m_blendtarget || m_target)) { - if (m_blendtarget) { - copy_m4_m4(m_blendtarget->obmat, m_blendmat); - if (m_pose) - m_blendtarget->pose = m_pose; - } - if (m_blendsubtarget && m_subtarget) { - copy_m4_m4(m_blendsubtarget->obmat, m_blendsubmat); - if (m_subpose) - m_blendsubtarget->pose = m_subpose; - } - } -} - -bool BL_ArmatureConstraint::Match(const char* posechannel, const char* constraint) -{ - return (!strcmp(m_posechannel->name, posechannel) && !strcmp(m_constraint->name, constraint)); -} - -void BL_ArmatureConstraint::SetTarget(KX_GameObject* target) -{ - if (m_blendtarget) { - if (target != m_target) { - m_target->UnregisterObject(m_armature); - m_target = target; - if (m_target) - m_target->RegisterObject(m_armature); - } - } - -} - -void BL_ArmatureConstraint::SetSubtarget(KX_GameObject* subtarget) -{ - if (m_blendsubtarget) { - if (subtarget != m_subtarget) { - m_subtarget->UnregisterObject(m_armature); - m_subtarget = subtarget; - if (m_subtarget) - m_subtarget->RegisterObject(m_armature); - } - } - -} - -#ifndef DISABLE_PYTHON - -// PYTHON - -PyMethodDef BL_ArmatureConstraint::Methods[] = { - {NULL,NULL} //Sentinel -}; - -// order of definition of attributes, must match Attributes[] array -#define BCA_TYPE 0 -#define BCA_NAME 1 -#define BCA_ENFORCE 2 -#define BCA_HEADTAIL 3 -#define BCA_LINERROR 4 -#define BCA_ROTERROR 5 -#define BCA_TARGET 6 -#define BCA_SUBTARGET 7 -#define BCA_ACTIVE 8 -#define BCA_IKWEIGHT 9 -#define BCA_IKTYPE 10 -#define BCA_IKFLAG 11 -#define BCA_IKDIST 12 -#define BCA_IKMODE 13 - -PyAttributeDef BL_ArmatureConstraint::Attributes[] = { - // Keep these attributes in order of BCA_ defines!!! used by py_attr_getattr and py_attr_setattr - KX_PYATTRIBUTE_RO_FUNCTION("type",BL_ArmatureConstraint,py_attr_getattr), - KX_PYATTRIBUTE_RO_FUNCTION("name",BL_ArmatureConstraint,py_attr_getattr), - KX_PYATTRIBUTE_RW_FUNCTION("enforce",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr), - KX_PYATTRIBUTE_RW_FUNCTION("headtail",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr), - KX_PYATTRIBUTE_RO_FUNCTION("lin_error",BL_ArmatureConstraint,py_attr_getattr), - KX_PYATTRIBUTE_RO_FUNCTION("rot_error",BL_ArmatureConstraint,py_attr_getattr), - KX_PYATTRIBUTE_RW_FUNCTION("target",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr), - KX_PYATTRIBUTE_RW_FUNCTION("subtarget",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr), - KX_PYATTRIBUTE_RW_FUNCTION("active",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr), - KX_PYATTRIBUTE_RW_FUNCTION("ik_weight",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr), - KX_PYATTRIBUTE_RO_FUNCTION("ik_type",BL_ArmatureConstraint,py_attr_getattr), - KX_PYATTRIBUTE_RO_FUNCTION("ik_flag",BL_ArmatureConstraint,py_attr_getattr), - KX_PYATTRIBUTE_RW_FUNCTION("ik_dist",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr), - KX_PYATTRIBUTE_RW_FUNCTION("ik_mode",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr), - - { NULL } //Sentinel -}; - - -PyObject* BL_ArmatureConstraint::py_attr_getattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - BL_ArmatureConstraint* self= static_cast(self_v); - bConstraint* constraint = self->m_constraint; - bKinematicConstraint* ikconstraint = (constraint && constraint->type == CONSTRAINT_TYPE_KINEMATIC) ? (bKinematicConstraint*)constraint->data : NULL; - int attr_order = attrdef-Attributes; - - if (!constraint) { - PyErr_SetString(PyExc_AttributeError, "constraint is NULL"); - return NULL; - } - - switch (attr_order) { - case BCA_TYPE: - return PyLong_FromLong(constraint->type); - case BCA_NAME: - return PyUnicode_FromString(constraint->name); - case BCA_ENFORCE: - return PyFloat_FromDouble(constraint->enforce); - case BCA_HEADTAIL: - return PyFloat_FromDouble(constraint->headtail); - case BCA_LINERROR: - return PyFloat_FromDouble(constraint->lin_error); - case BCA_ROTERROR: - return PyFloat_FromDouble(constraint->rot_error); - case BCA_TARGET: - if (!self->m_target) - Py_RETURN_NONE; - else - return self->m_target->GetProxy(); - case BCA_SUBTARGET: - if (!self->m_subtarget) - Py_RETURN_NONE; - else - return self->m_subtarget->GetProxy(); - case BCA_ACTIVE: - return PyBool_FromLong(constraint->flag & CONSTRAINT_OFF); - case BCA_IKWEIGHT: - case BCA_IKTYPE: - case BCA_IKFLAG: - case BCA_IKDIST: - case BCA_IKMODE: - if (!ikconstraint) { - PyErr_SetString(PyExc_AttributeError, "constraint is not of IK type"); - return NULL; - } - switch (attr_order) { - case BCA_IKWEIGHT: - return PyFloat_FromDouble((ikconstraint)?ikconstraint->weight:0.0); - case BCA_IKTYPE: - return PyLong_FromLong(ikconstraint->type); - case BCA_IKFLAG: - return PyLong_FromLong(ikconstraint->flag); - case BCA_IKDIST: - return PyFloat_FromDouble(ikconstraint->dist); - case BCA_IKMODE: - return PyLong_FromLong(ikconstraint->mode); - } - // should not come here - break; - } - PyErr_SetString(PyExc_AttributeError, "constraint unknown attribute"); - return NULL; -} - -int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - BL_ArmatureConstraint* self= static_cast(self_v); - bConstraint* constraint = self->m_constraint; - bKinematicConstraint* ikconstraint = (constraint && constraint->type == CONSTRAINT_TYPE_KINEMATIC) ? (bKinematicConstraint*)constraint->data : NULL; - int attr_order = attrdef-Attributes; - int ival; - double dval; -// char* sval; - KX_GameObject *oval; - - if (!constraint) { - PyErr_SetString(PyExc_AttributeError, "constraint is NULL"); - return PY_SET_ATTR_FAIL; - } - - switch (attr_order) { - case BCA_ENFORCE: - dval = PyFloat_AsDouble(value); - if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */ - PyErr_SetString(PyExc_AttributeError, "constraint.enforce = float: BL_ArmatureConstraint, expected a float between 0 and 1"); - return PY_SET_ATTR_FAIL; - } - constraint->enforce = dval; - return PY_SET_ATTR_SUCCESS; - - case BCA_HEADTAIL: - dval = PyFloat_AsDouble(value); - if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */ - PyErr_SetString(PyExc_AttributeError, "constraint.headtail = float: BL_ArmatureConstraint, expected a float between 0 and 1"); - return PY_SET_ATTR_FAIL; - } - constraint->headtail = dval; - return PY_SET_ATTR_SUCCESS; - - case BCA_TARGET: - if (!ConvertPythonToGameObject(value, &oval, true, "constraint.target = value: BL_ArmatureConstraint")) - return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - self->SetTarget(oval); - return PY_SET_ATTR_SUCCESS; - - case BCA_SUBTARGET: - if (!ConvertPythonToGameObject(value, &oval, true, "constraint.subtarget = value: BL_ArmatureConstraint")) - return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - self->SetSubtarget(oval); - return PY_SET_ATTR_SUCCESS; - - case BCA_ACTIVE: - ival = PyObject_IsTrue( value ); - if (ival == -1) { - PyErr_SetString(PyExc_AttributeError, "constraint.active = bool: BL_ArmatureConstraint, expected True or False"); - return PY_SET_ATTR_FAIL; - } - self->m_constraint->flag = (self->m_constraint->flag & ~CONSTRAINT_OFF) | ((ival)?0:CONSTRAINT_OFF); - return PY_SET_ATTR_SUCCESS; - - case BCA_IKWEIGHT: - case BCA_IKDIST: - case BCA_IKMODE: - if (!ikconstraint) { - PyErr_SetString(PyExc_AttributeError, "constraint is not of IK type"); - return PY_SET_ATTR_FAIL; - } - switch (attr_order) { - case BCA_IKWEIGHT: - dval = PyFloat_AsDouble(value); - if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */ - PyErr_SetString(PyExc_AttributeError, "constraint.weight = float: BL_ArmatureConstraint, expected a float between 0 and 1"); - return PY_SET_ATTR_FAIL; - } - ikconstraint->weight = dval; - return PY_SET_ATTR_SUCCESS; - - case BCA_IKDIST: - dval = PyFloat_AsDouble(value); - if (dval < 0.0f) { /* also accounts for non float */ - PyErr_SetString(PyExc_AttributeError, "constraint.ik_dist = float: BL_ArmatureConstraint, expected a positive float"); - return PY_SET_ATTR_FAIL; - } - ikconstraint->dist = dval; - return PY_SET_ATTR_SUCCESS; - - case BCA_IKMODE: - ival = PyLong_AsLong(value); - if (ival < 0) { - PyErr_SetString(PyExc_AttributeError, "constraint.ik_mode = integer: BL_ArmatureConstraint, expected a positive integer"); - return PY_SET_ATTR_FAIL; - } - ikconstraint->mode = ival; - return PY_SET_ATTR_SUCCESS; - } - // should not come here - break; - - } - - PyErr_SetString(PyExc_AttributeError, "constraint unknown attribute"); - return PY_SET_ATTR_FAIL; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.h b/source/gameengine/Converter/BL_ArmatureConstraint.h deleted file mode 100644 index a9f612b6c0c..00000000000 --- a/source/gameengine/Converter/BL_ArmatureConstraint.h +++ /dev/null @@ -1,118 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __BL_ARMATURECONSTRAINT -#define __BL_ARMATURECONSTRAINT - -#include "DNA_constraint_types.h" -#include "GEN_HashedPtr.h" -#include "GEN_Map.h" -#include "PyObjectPlus.h" - -class SCA_IObject; -class KX_GameObject; -class BL_ArmatureObject; -struct bConstraint; -struct bPoseChannel; -struct Object; -struct bPose; - -/** - * SG_DList : element of controlled constraint list - * head = BL_ArmatureObject::m_controlledConstraints - * SG_QList : not used - */ -class BL_ArmatureConstraint : public PyObjectPlus -{ - Py_Header; - -private: - struct bConstraint* m_constraint; - struct bPoseChannel* m_posechannel; - class BL_ArmatureObject* m_armature; - char m_name[64]; - KX_GameObject* m_target; - KX_GameObject* m_subtarget; - struct Object* m_blendtarget; - struct Object* m_blendsubtarget; - float m_blendmat[4][4]; - float m_blendsubmat[4][4]; - struct bPose* m_pose; - struct bPose* m_subpose; - -public: - BL_ArmatureConstraint(class BL_ArmatureObject *armature, - struct bPoseChannel *posechannel, - struct bConstraint *constraint, - KX_GameObject* target, - KX_GameObject* subtarget); - virtual ~BL_ArmatureConstraint(); - - BL_ArmatureConstraint* GetReplica() const; - void ReParent(BL_ArmatureObject* armature); - void Relink(GEN_Map *map); - bool UnlinkObject(SCA_IObject* clientobj); - - void UpdateTarget(); - void RestoreTarget(); - - bool Match(const char* posechannel, const char* constraint); - const char* GetName() { return m_name; } - - void SetConstraintFlag(int flag) - { - if (m_constraint) - m_constraint->flag |= flag; - } - void ClrConstraintFlag(int flag) - { - if (m_constraint) - m_constraint->flag &= ~flag; - } - void SetWeight(float weight) - { - if (m_constraint && m_constraint->type == CONSTRAINT_TYPE_KINEMATIC && m_constraint->data) { - bKinematicConstraint* con = (bKinematicConstraint*)m_constraint->data; - con->weight = weight; - } - } - void SetTarget(KX_GameObject* target); - void SetSubtarget(KX_GameObject* subtarget); - -#ifndef DISABLE_PYTHON - - // Python access - virtual PyObject* py_repr(void); - - static PyObject* py_attr_getattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int py_attr_setattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); -#endif // DISABLE_PYTHON -}; - -#endif //__BL_ARMATURECONSTRAINT - diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp deleted file mode 100644 index 217011517eb..00000000000 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ /dev/null @@ -1,658 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "BL_ArmatureObject.h" -#include "BL_ActionActuator.h" -#include "KX_BlenderSceneConverter.h" -#include "BLI_blenlib.h" -#include "BLI_ghash.h" -#include "BLI_math.h" -#include "BIK_api.h" -#include "BKE_action.h" -#include "BKE_armature.h" -#include "BKE_utildefines.h" -#include "BKE_constraint.h" -#include "GEN_Map.h" -#include "GEN_HashedPtr.h" -#include "MEM_guardedalloc.h" -#include "DNA_action_types.h" -#include "DNA_armature_types.h" -#include "DNA_object_types.h" -#include "DNA_scene_types.h" -#include "DNA_nla_types.h" -#include "DNA_constraint_types.h" -#include "KX_PythonSeq.h" -#include "KX_PythonInit.h" -#include "KX_KetsjiEngine.h" - -#include "MT_Matrix4x4.h" - -/** - * Move here pose function for game engine so that we can mix with GE objects - * Principle is as follow: - * Use Blender structures so that where_is_pose can be used unchanged - * Copy the constraint so that they can be enabled/disabled/added/removed at runtime - * Don't copy the constraints for the pose used by the Action actuator, it does not need them. - * Scan the constraint structures so that the KX equivalent of target objects are identified and - * stored in separate list. - * When it is about to evaluate the pose, set the KX object position in the obmat of the corresponding - * Blender objects and restore after the evaluation. - */ -void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) -{ - bPose *out; - bPoseChannel *pchan, *outpchan; - GHash *ghash; - - /* the game engine copies the current armature pose and then swaps - * the object pose pointer. this makes it possible to change poses - * without affecting the original blender data. */ - - if (!src) { - *dst=NULL; - return; - } - else if (*dst==src) { - printf("copy_pose source and target are the same\n"); - *dst=NULL; - return; - } - - out= (bPose*)MEM_dupallocN(src); - out->chanhash = NULL; - out->agroups.first= out->agroups.last= NULL; - out->ikdata = NULL; - out->ikparam = MEM_dupallocN(out->ikparam); - out->flag |= POSE_GAME_ENGINE; - BLI_duplicatelist(&out->chanbase, &src->chanbase); - - /* remap pointers */ - ghash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "game_copy_pose gh"); - - pchan= (bPoseChannel*)src->chanbase.first; - outpchan= (bPoseChannel*)out->chanbase.first; - for (; pchan; pchan=pchan->next, outpchan=outpchan->next) - BLI_ghash_insert(ghash, pchan, outpchan); - - for (pchan=(bPoseChannel*)out->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { - pchan->parent= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->parent); - pchan->child= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->child); - pchan->path= NULL; - - if (copy_constraint) { - ListBase listb; - // copy all constraint for backward compatibility - copy_constraints(&listb, &pchan->constraints, FALSE); // copy_constraints NULLs listb, no need to make extern for this operation. - pchan->constraints= listb; - } else { - pchan->constraints.first = NULL; - pchan->constraints.last = NULL; - } - } - - BLI_ghash_free(ghash, NULL, NULL); - // set acceleration structure for channel lookup - make_pose_channels_hash(out); - *dst=out; -} - - - -/* Only allowed for Poses with identical channels */ -void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/) -{ - short mode= ACTSTRIPMODE_BLEND; - - bPoseChannel *dchan; - const bPoseChannel *schan; - bConstraint *dcon, *scon; - float dstweight; - int i; - - switch (mode){ - case ACTSTRIPMODE_BLEND: - dstweight = 1.0F - srcweight; - break; - case ACTSTRIPMODE_ADD: - dstweight = 1.0F; - break; - default : - dstweight = 1.0F; - } - - schan= (bPoseChannel*)src->chanbase.first; - for (dchan = (bPoseChannel*)dst->chanbase.first; dchan; dchan=(bPoseChannel*)dchan->next, schan= (bPoseChannel*)schan->next){ - // always blend on all channels since we don't know which one has been set - /* quat interpolation done separate */ - if (schan->rotmode == ROT_MODE_QUAT) { - float dquat[4], squat[4]; - - QUATCOPY(dquat, dchan->quat); - QUATCOPY(squat, schan->quat); - if (mode==ACTSTRIPMODE_BLEND) - interp_qt_qtqt(dchan->quat, dquat, squat, srcweight); - else { - mul_fac_qt_fl(squat, srcweight); - mul_qt_qtqt(dchan->quat, dquat, squat); - } - - normalize_qt(dchan->quat); - } - - for (i=0; i<3; i++) { - /* blending for loc and scale are pretty self-explanatory... */ - dchan->loc[i] = (dchan->loc[i]*dstweight) + (schan->loc[i]*srcweight); - dchan->size[i] = 1.0f + ((dchan->size[i]-1.0f)*dstweight) + ((schan->size[i]-1.0f)*srcweight); - - /* euler-rotation interpolation done here instead... */ - // FIXME: are these results decent? - if (schan->rotmode) - dchan->eul[i] = (dchan->eul[i]*dstweight) + (schan->eul[i]*srcweight); - } - for(dcon= (bConstraint*)dchan->constraints.first, scon= (bConstraint*)schan->constraints.first; dcon && scon; dcon= (bConstraint*)dcon->next, scon= (bConstraint*)scon->next) { - /* no 'add' option for constraint blending */ - dcon->enforce= dcon->enforce*(1.0f-srcweight) + scon->enforce*srcweight; - } - } - - /* this pose is now in src time */ - dst->ctime= src->ctime; -} - -void game_free_pose(bPose *pose) -{ - if (pose) { - /* free pose-channels and constraints */ - free_pose_channels(pose); - - /* free IK solver state */ - BIK_clear_data(pose); - - /* free IK solver param */ - if (pose->ikparam) - MEM_freeN(pose->ikparam); - - MEM_freeN(pose); - } -} - -BL_ArmatureObject::BL_ArmatureObject( - void* sgReplicationInfo, - SG_Callbacks callbacks, - Object *armature, - Scene *scene) - -: KX_GameObject(sgReplicationInfo,callbacks), - m_controlledConstraints(), - m_poseChannels(), - m_objArma(armature), - m_framePose(NULL), - m_scene(scene), // maybe remove later. needed for where_is_pose - m_lastframe(0.0), - m_timestep(0.040), - m_activeAct(NULL), - m_activePriority(999), - m_constraintNumber(0), - m_channelNumber(0), - m_lastapplyframe(0.0) -{ - m_armature = (bArmature *)armature->data; - - /* we make a copy of blender object's pose, and then always swap it with - * the original pose before calling into blender functions, to deal with - * replica's or other objects using the same blender object */ - m_pose = NULL; - game_copy_pose(&m_pose, m_objArma->pose, 1); - // store the original armature object matrix - memcpy(m_obmat, m_objArma->obmat, sizeof(m_obmat)); -} - -BL_ArmatureObject::~BL_ArmatureObject() -{ - BL_ArmatureConstraint* constraint; - while ((constraint = m_controlledConstraints.Remove()) != NULL) { - delete constraint; - } - BL_ArmatureChannel* channel; - while ((channel = static_cast(m_poseChannels.Remove())) != NULL) { - delete channel; - } - if (m_pose) - game_free_pose(m_pose); - if (m_framePose) - game_free_pose(m_framePose); -} - - -void BL_ArmatureObject::LoadConstraints(KX_BlenderSceneConverter* converter) -{ - // first delete any existing constraint (should not have any) - while (!m_controlledConstraints.Empty()) { - BL_ArmatureConstraint* constraint = m_controlledConstraints.Remove(); - delete constraint; - } - m_constraintNumber = 0; - - // list all the constraint and convert them to BL_ArmatureConstraint - // get the persistent pose structure - bPoseChannel* pchan; - bConstraint* pcon; - bConstraintTypeInfo* cti; - Object* blendtarget; - KX_GameObject* gametarget; - KX_GameObject* gamesubtarget; - - // and locate the constraint - for (pchan = (bPoseChannel*)m_pose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { - for (pcon = (bConstraint*)pchan->constraints.first; pcon; pcon=(bConstraint*)pcon->next) { - if (pcon->flag & CONSTRAINT_DISABLE) - continue; - // which constraint should we support? - switch (pcon->type) { - case CONSTRAINT_TYPE_TRACKTO: - case CONSTRAINT_TYPE_KINEMATIC: - case CONSTRAINT_TYPE_ROTLIKE: - case CONSTRAINT_TYPE_LOCLIKE: - case CONSTRAINT_TYPE_MINMAX: - case CONSTRAINT_TYPE_SIZELIKE: - case CONSTRAINT_TYPE_LOCKTRACK: - case CONSTRAINT_TYPE_STRETCHTO: - case CONSTRAINT_TYPE_CLAMPTO: - case CONSTRAINT_TYPE_TRANSFORM: - case CONSTRAINT_TYPE_DISTLIMIT: - cti = constraint_get_typeinfo(pcon); - gametarget = gamesubtarget = NULL; - if (cti && cti->get_constraint_targets) { - ListBase listb = { NULL, NULL }; - cti->get_constraint_targets(pcon, &listb); - if (listb.first) { - bConstraintTarget* target = (bConstraintTarget*)listb.first; - if (target->tar && target->tar != m_objArma) { - // only remember external objects, self target is handled automatically - blendtarget = target->tar; - gametarget = converter->FindGameObject(blendtarget); - } - if (target->next != NULL) { - // secondary target - target = (bConstraintTarget*)target->next; - if (target->tar && target->tar != m_objArma) { - // only track external object - blendtarget = target->tar; - gamesubtarget = converter->FindGameObject(blendtarget); - } - } - } - if (cti->flush_constraint_targets) - cti->flush_constraint_targets(pcon, &listb, 1); - } - BL_ArmatureConstraint* constraint = new BL_ArmatureConstraint(this, pchan, pcon, gametarget, gamesubtarget); - m_controlledConstraints.AddBack(constraint); - m_constraintNumber++; - } - } - } -} - -BL_ArmatureConstraint* BL_ArmatureObject::GetConstraint(const char* posechannel, const char* constraintname) -{ - SG_DList::iterator cit(m_controlledConstraints); - for (cit.begin(); !cit.end(); ++cit) { - BL_ArmatureConstraint* constraint = *cit; - if (constraint->Match(posechannel, constraintname)) - return constraint; - } - return NULL; -} - -BL_ArmatureConstraint* BL_ArmatureObject::GetConstraint(const char* posechannelconstraint) -{ - // performance: use hash string instead of plain string compare - SG_DList::iterator cit(m_controlledConstraints); - for (cit.begin(); !cit.end(); ++cit) { - BL_ArmatureConstraint* constraint = *cit; - if (!strcmp(constraint->GetName(), posechannelconstraint)) - return constraint; - } - return NULL; -} - -BL_ArmatureConstraint* BL_ArmatureObject::GetConstraint(int index) -{ - SG_DList::iterator cit(m_controlledConstraints); - for (cit.begin(); !cit.end() && index; ++cit, --index); - return (cit.end()) ? NULL : *cit; -} - -/* this function is called to populate the m_poseChannels list */ -void BL_ArmatureObject::LoadChannels() -{ - if (m_poseChannels.Empty()) { - bPoseChannel* pchan; - BL_ArmatureChannel* proxy; - - m_channelNumber = 0; - for (pchan = (bPoseChannel*)m_pose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { - proxy = new BL_ArmatureChannel(this, pchan); - m_poseChannels.AddBack(proxy); - m_channelNumber++; - } - } -} - -BL_ArmatureChannel* BL_ArmatureObject::GetChannel(bPoseChannel* pchan) -{ - LoadChannels(); - SG_DList::iterator cit(m_poseChannels); - for (cit.begin(); !cit.end(); ++cit) - { - BL_ArmatureChannel* channel = *cit; - if (channel->m_posechannel == pchan) - return channel; - } - return NULL; -} - -BL_ArmatureChannel* BL_ArmatureObject::GetChannel(const char* str) -{ - LoadChannels(); - SG_DList::iterator cit(m_poseChannels); - for (cit.begin(); !cit.end(); ++cit) - { - BL_ArmatureChannel* channel = *cit; - if (!strcmp(channel->m_posechannel->name, str)) - return channel; - } - return NULL; -} - -BL_ArmatureChannel* BL_ArmatureObject::GetChannel(int index) -{ - LoadChannels(); - if (index < 0 || index >= m_channelNumber) - return NULL; - SG_DList::iterator cit(m_poseChannels); - for (cit.begin(); !cit.end() && index; ++cit, --index); - return (cit.end()) ? NULL : *cit; -} - -CValue* BL_ArmatureObject::GetReplica() -{ - BL_ArmatureObject* replica = new BL_ArmatureObject(*this); - replica->ProcessReplica(); - return replica; -} - -void BL_ArmatureObject::ProcessReplica() -{ - bPose *pose= m_pose; - KX_GameObject::ProcessReplica(); - - m_pose = NULL; - m_framePose = NULL; - game_copy_pose(&m_pose, pose, 1); -} - -void BL_ArmatureObject::ReParentLogic() -{ - SG_DList::iterator cit(m_controlledConstraints); - for (cit.begin(); !cit.end(); ++cit) { - (*cit)->ReParent(this); - } - KX_GameObject::ReParentLogic(); -} - -void BL_ArmatureObject::Relink(GEN_Map *obj_map) -{ - SG_DList::iterator cit(m_controlledConstraints); - for (cit.begin(); !cit.end(); ++cit) { - (*cit)->Relink(obj_map); - } - KX_GameObject::Relink(obj_map); -} - -bool BL_ArmatureObject::UnlinkObject(SCA_IObject* clientobj) -{ - // clientobj is being deleted, make sure we don't hold any reference to it - bool res = false; - SG_DList::iterator cit(m_controlledConstraints); - for (cit.begin(); !cit.end(); ++cit) { - res |= (*cit)->UnlinkObject(clientobj); - } - return res; -} - -void BL_ArmatureObject::ApplyPose() -{ - m_armpose = m_objArma->pose; - m_objArma->pose = m_pose; - // in the GE, we use ctime to store the timestep - m_pose->ctime = (float)m_timestep; - //m_scene->r.cfra++; - if(m_lastapplyframe != m_lastframe) { - // update the constraint if any, first put them all off so that only the active ones will be updated - SG_DList::iterator cit(m_controlledConstraints); - for (cit.begin(); !cit.end(); ++cit) { - (*cit)->UpdateTarget(); - } - // update ourself - UpdateBlenderObjectMatrix(m_objArma); - where_is_pose(m_scene, m_objArma); // XXX - // restore ourself - memcpy(m_objArma->obmat, m_obmat, sizeof(m_obmat)); - // restore active targets - for (cit.begin(); !cit.end(); ++cit) { - (*cit)->RestoreTarget(); - } - m_lastapplyframe = m_lastframe; - } -} - -void BL_ArmatureObject::RestorePose() -{ - m_objArma->pose = m_armpose; - m_armpose = NULL; -} - -void BL_ArmatureObject::SetPose(bPose *pose) -{ - extract_pose_from_pose(m_pose, pose); - m_lastapplyframe = -1.0; -} - -bool BL_ArmatureObject::SetActiveAction(BL_ActionActuator *act, short priority, double curtime) -{ - if (curtime != m_lastframe){ - m_activePriority = 9999; - // compute the timestep for the underlying IK algorithm - m_timestep = curtime-m_lastframe; - m_lastframe= curtime; - m_activeAct = NULL; - // remember the pose at the start of the frame - GetPose(&m_framePose); - } - - if (act) - { - if (priority<=m_activePriority) - { - if (prioritySetBlendTime(0.0); - } - m_activeAct = act; - m_activePriority = priority; - m_lastframe = curtime; - - return true; - } - else{ - act->SetBlendTime(0.0); - return false; - } - } - return false; -} - -BL_ActionActuator * BL_ArmatureObject::GetActiveAction() -{ - return m_activeAct; -} - -void BL_ArmatureObject::GetPose(bPose **pose) -{ - /* If the caller supplies a null pose, create a new one. */ - /* Otherwise, copy the armature's pose channels into the caller-supplied pose */ - - if (!*pose) { - /* probably not to good of an idea to - duplicate everying, but it clears up - a crash and memory leakage when - &BL_ActionActuator::m_pose is freed - */ - game_copy_pose(pose, m_pose, 0); - } - else { - if (*pose == m_pose) - // no need to copy if the pointers are the same - return; - - extract_pose_from_pose(*pose, m_pose); - } -} - -void BL_ArmatureObject::GetMRDPose(bPose **pose) -{ - /* If the caller supplies a null pose, create a new one. */ - /* Otherwise, copy the armature's pose channels into the caller-supplied pose */ - - if (!*pose) - game_copy_pose(pose, m_pose, 0); - else - extract_pose_from_pose(*pose, m_pose); -} - -short BL_ArmatureObject::GetActivePriority() -{ - return m_activePriority; -} - -double BL_ArmatureObject::GetLastFrame() -{ - return m_lastframe; -} - -bool BL_ArmatureObject::GetBoneMatrix(Bone* bone, MT_Matrix4x4& matrix) -{ - bPoseChannel *pchan; - - ApplyPose(); - pchan = get_pose_channel(m_objArma->pose, bone->name); - if(pchan) - matrix.setValue(&pchan->pose_mat[0][0]); - RestorePose(); - - return (pchan != NULL); -} - -float BL_ArmatureObject::GetBoneLength(Bone* bone) const -{ - return (float)(MT_Point3(bone->head) - MT_Point3(bone->tail)).length(); -} - -#ifndef DISABLE_PYTHON - -// PYTHON - -PyTypeObject BL_ArmatureObject::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BL_ArmatureObject", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0, - &KX_GameObject::Sequence, - &KX_GameObject::Mapping, - 0,0,0, - NULL, - NULL, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &KX_GameObject::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef BL_ArmatureObject::Methods[] = { - - KX_PYMETHODTABLE_NOARGS(BL_ArmatureObject, update), - {NULL,NULL} //Sentinel -}; - -PyAttributeDef BL_ArmatureObject::Attributes[] = { - - KX_PYATTRIBUTE_RO_FUNCTION("constraints", BL_ArmatureObject, pyattr_get_constraints), - KX_PYATTRIBUTE_RO_FUNCTION("channels", BL_ArmatureObject, pyattr_get_channels), - {NULL} //Sentinel -}; - -PyObject* BL_ArmatureObject::pyattr_get_constraints(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - return KX_PythonSeq_CreatePyObject((static_cast(self_v))->m_proxy, KX_PYGENSEQ_OB_TYPE_CONSTRAINTS); -} - -PyObject* BL_ArmatureObject::pyattr_get_channels(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - BL_ArmatureObject* self = static_cast(self_v); - self->LoadChannels(); // make sure we have the channels - return KX_PythonSeq_CreatePyObject((static_cast(self_v))->m_proxy, KX_PYGENSEQ_OB_TYPE_CHANNELS); -} - -KX_PYMETHODDEF_DOC_NOARGS(BL_ArmatureObject, update, - "update()\n" - "Make sure that the armature will be updated on next graphic frame.\n" - "This is automatically done if a KX_ArmatureActuator with mode run is active\n" - "or if an action is playing. This function is usefull in other cases.\n") -{ - SetActiveAction(NULL, 0, KX_GetActiveEngine()->GetFrameTime()); - Py_RETURN_NONE; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h deleted file mode 100644 index 6ad7de03489..00000000000 --- a/source/gameengine/Converter/BL_ArmatureObject.h +++ /dev/null @@ -1,151 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BL_ARMATUREOBJECT -#define BL_ARMATUREOBJECT - -#include "KX_GameObject.h" -#include "BL_ArmatureConstraint.h" -#include "BL_ArmatureChannel.h" - -#include "SG_IObject.h" -#include -#include - -struct bArmature; -struct Bone; -struct bConstraint; -class BL_ActionActuator; -class BL_ArmatureActuator; -class MT_Matrix4x4; -struct Object; -class KX_BlenderSceneConverter; - -class BL_ArmatureObject : public KX_GameObject -{ - Py_Header; -public: - - double GetLastFrame (); - short GetActivePriority(); - virtual void ProcessReplica(); - virtual void ReParentLogic(); - virtual void Relink(GEN_Map *obj_map); - virtual bool UnlinkObject(SCA_IObject* clientobj); - - class BL_ActionActuator * GetActiveAction(); - - BL_ArmatureObject( - void* sgReplicationInfo, - SG_Callbacks callbacks, - Object *armature, - Scene *scene - ); - virtual ~BL_ArmatureObject(); - - virtual CValue* GetReplica(); - void GetMRDPose(struct bPose **pose); - void GetPose(struct bPose **pose); - void SetPose (struct bPose *pose); - struct bPose *GetOrigPose() {return m_pose;} // never edit this, only for accessing names - - void ApplyPose(); - void RestorePose(); - - bool SetActiveAction(class BL_ActionActuator *act, short priority, double curtime); - - struct bArmature * GetArmature() { return m_armature; } - const struct bArmature * GetArmature() const { return m_armature; } - const struct Scene * GetScene() const { return m_scene; } - - Object* GetArmatureObject() {return m_objArma;} - - // for constraint python API - void LoadConstraints(KX_BlenderSceneConverter* converter); - size_t GetConstraintNumber() const { return m_constraintNumber; } - BL_ArmatureConstraint* GetConstraint(const char* posechannel, const char* constraint); - BL_ArmatureConstraint* GetConstraint(const char* posechannelconstraint); - BL_ArmatureConstraint* GetConstraint(int index); - // for pose channel python API - void LoadChannels(); - size_t GetChannelNumber() const { return m_constraintNumber; } - BL_ArmatureChannel* GetChannel(bPoseChannel* channel); - BL_ArmatureChannel* GetChannel(const char* channel); - BL_ArmatureChannel* GetChannel(int index); - - /// Retrieve the pose matrix for the specified bone. - /// Returns true on success. - bool GetBoneMatrix(Bone* bone, MT_Matrix4x4& matrix); - - /// Returns the bone length. The end of the bone is in the local y direction. - float GetBoneLength(Bone* bone) const; - - virtual int GetGameObjectType() { return OBJ_ARMATURE; } - -#ifndef DISABLE_PYTHON - - // PYTHON - static PyObject* pyattr_get_constraints(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_channels(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - KX_PYMETHOD_DOC_NOARGS(BL_ArmatureObject, update); - -#endif // DISABLE_PYTHON - -protected: - /* list element: BL_ArmatureConstraint. Use SG_DListHead to have automatic list replication */ - SG_DListHead m_controlledConstraints; - /* list element: BL_ArmatureChannel. Use SG_DList to avoid list replication */ - SG_DList m_poseChannels; - Object *m_objArma; - struct bArmature *m_armature; - struct bPose *m_pose; - struct bPose *m_armpose; - struct bPose *m_framePose; - struct Scene *m_scene; // need for where_is_pose - double m_lastframe; - double m_timestep; // delta since last pose evaluation. - class BL_ActionActuator *m_activeAct; - short m_activePriority; - size_t m_constraintNumber; - size_t m_channelNumber; - // store the original armature object matrix - float m_obmat[4][4]; - - double m_lastapplyframe; -}; - -/* Pose function specific to the game engine */ -void game_blend_poses(struct bPose *dst, struct bPose *src, float srcweight/*, short mode*/); /* was blend_poses */ -//void extract_pose_from_pose(struct bPose *pose, const struct bPose *src); -void game_copy_pose(struct bPose **dst, struct bPose *src, int copy_con); -void game_free_pose(struct bPose *pose); - - -#endif - diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp deleted file mode 100644 index 2f0f70ed9fe..00000000000 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ /dev/null @@ -1,2694 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Convert blender data to ketsji - */ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif - -#include - -#include "BL_BlenderDataConversion.h" -#include "KX_BlenderGL.h" -#include "KX_BlenderScalarInterpolator.h" - -#include "RAS_IPolygonMaterial.h" -#include "KX_PolygonMaterial.h" - -// Expressions -#include "ListValue.h" -#include "IntValue.h" -// Collision & Fuzzics LTD - -#include "PHY_Pro.h" - - -#include "KX_Scene.h" -#include "KX_GameObject.h" -#include "RAS_FramingManager.h" -#include "RAS_MeshObject.h" - -#include "KX_ConvertActuators.h" -#include "KX_ConvertControllers.h" -#include "KX_ConvertSensors.h" - -#include "SCA_LogicManager.h" -#include "SCA_EventManager.h" -#include "SCA_TimeEventManager.h" -#include "KX_Light.h" -#include "KX_Camera.h" -#include "KX_EmptyObject.h" -#include "MT_Point3.h" -#include "MT_Transform.h" -#include "MT_MinMax.h" -#include "SCA_IInputDevice.h" -#include "RAS_TexMatrix.h" -#include "RAS_ICanvas.h" -#include "RAS_MaterialBucket.h" -//#include "KX_BlenderPolyMaterial.h" -#include "RAS_Polygon.h" -#include "RAS_TexVert.h" -#include "RAS_BucketManager.h" -#include "RAS_IRenderTools.h" -#include "BL_Material.h" -#include "KX_BlenderMaterial.h" -#include "BL_Texture.h" - -#include "DNA_action_types.h" -#include "BKE_main.h" -#include "BKE_global.h" -#include "BKE_object.h" -#include "BL_ModifierDeformer.h" -#include "BL_ShapeDeformer.h" -#include "BL_SkinDeformer.h" -#include "BL_MeshDeformer.h" -#include "KX_SoftBodyDeformer.h" -//#include "BL_ArmatureController.h" - -#include "BlenderWorldInfo.h" - -#include "KX_KetsjiEngine.h" -#include "KX_BlenderSceneConverter.h" - -/* This little block needed for linking to Blender... */ -#ifdef WIN32 -#include "BLI_winstuff.h" -#endif - -/* This list includes only data type definitions */ -#include "DNA_object_types.h" -#include "DNA_material_types.h" -#include "DNA_texture_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_sound_types.h" -#include "DNA_key_types.h" -#include "DNA_armature_types.h" -#include "DNA_object_force.h" - -#include "MEM_guardedalloc.h" -#include "BKE_utildefines.h" -#include "BKE_key.h" -#include "BKE_mesh.h" -#include "MT_Point3.h" - -#include "BLI_math.h" - -extern "C" { -#include "BKE_scene.h" -#include "BKE_customdata.h" -#include "BKE_cdderivedmesh.h" -#include "BKE_DerivedMesh.h" -} - -#include "BKE_material.h" /* give_current_material */ -/* end of blender include block */ - -#include "KX_BlenderInputDevice.h" -#include "KX_ConvertProperties.h" -#include "KX_HashedPtr.h" - - -#include "KX_ScalarInterpolator.h" - -#include "KX_IpoConvert.h" -#include "SYS_System.h" - -#include "SG_Node.h" -#include "SG_BBox.h" -#include "SG_Tree.h" - -#include "KX_ConvertPhysicsObject.h" -#ifdef USE_BULLET -#include "CcdPhysicsEnvironment.h" -#include "CcdGraphicController.h" -#endif -#include "KX_MotionState.h" - -// This file defines relationships between parents and children -// in the game engine. - -#include "KX_SG_NodeRelationships.h" -#include "KX_SG_BoneParentNodeRelationship.h" - -#include "BL_ArmatureObject.h" -#include "BL_DeformableGameObject.h" - -#ifdef __cplusplus -extern "C" { -#endif -//XXX #include "BSE_headerbuttons.h" -//XXX void update_for_newframe(); -//void scene_update_for_newframe(struct Scene *sce, unsigned int lay); -//#include "BKE_ipo.h" -//void do_all_data_ipos(void); -#ifdef __cplusplus -} -#endif - -static int default_face_mode = TF_DYNAMIC; - -static unsigned int KX_rgbaint2uint_new(unsigned int icol) -{ - union - { - unsigned int integer; - unsigned char cp[4]; - } out_color, in_color; - - in_color.integer = icol; - out_color.cp[0] = in_color.cp[3]; // red - out_color.cp[1] = in_color.cp[2]; // green - out_color.cp[2] = in_color.cp[1]; // blue - out_color.cp[3] = in_color.cp[0]; // alpha - - return out_color.integer; -} - -/* Now the real converting starts... */ -static unsigned int KX_Mcol2uint_new(MCol col) -{ - /* color has to be converted without endian sensitivity. So no shifting! */ - union - { - MCol col; - unsigned int integer; - unsigned char cp[4]; - } out_color, in_color; - - in_color.col = col; - out_color.cp[0] = in_color.cp[3]; // red - out_color.cp[1] = in_color.cp[2]; // green - out_color.cp[2] = in_color.cp[1]; // blue - out_color.cp[3] = in_color.cp[0]; // alpha - - return out_color.integer; -} - -static void SetDefaultFaceType(Scene* scene) -{ - default_face_mode = TF_DYNAMIC; - Scene *sce; - Base *base; - - for(SETLOOPER(scene,base)) - { - if (base->object->type == OB_LAMP) - { - default_face_mode = TF_DYNAMIC|TF_LIGHT; - return; - } - } -} - - -// -- -static void GetRGB(short type, - MFace* mface, - MCol* mmcol, - Material *mat, - unsigned int &c0, - unsigned int &c1, - unsigned int &c2, - unsigned int &c3) -{ - unsigned int color = 0xFFFFFFFFL; - switch(type) - { - case 0: // vertex colors - { - if(mmcol) { - c0 = KX_Mcol2uint_new(mmcol[0]); - c1 = KX_Mcol2uint_new(mmcol[1]); - c2 = KX_Mcol2uint_new(mmcol[2]); - if (mface->v4) - c3 = KX_Mcol2uint_new(mmcol[3]); - }else // backup white - { - c0 = KX_rgbaint2uint_new(color); - c1 = KX_rgbaint2uint_new(color); - c2 = KX_rgbaint2uint_new(color); - if (mface->v4) - c3 = KX_rgbaint2uint_new( color ); - } - } break; - - - case 1: // material rgba - { - if (mat) { - union { - unsigned char cp[4]; - unsigned int integer; - } col_converter; - col_converter.cp[3] = (unsigned char) (mat->r*255.0); - col_converter.cp[2] = (unsigned char) (mat->g*255.0); - col_converter.cp[1] = (unsigned char) (mat->b*255.0); - col_converter.cp[0] = (unsigned char) (mat->alpha*255.0); - color = col_converter.integer; - } - c0 = KX_rgbaint2uint_new(color); - c1 = KX_rgbaint2uint_new(color); - c2 = KX_rgbaint2uint_new(color); - if (mface->v4) - c3 = KX_rgbaint2uint_new(color); - } break; - - default: // white - { - c0 = KX_rgbaint2uint_new(color); - c1 = KX_rgbaint2uint_new(color); - c2 = KX_rgbaint2uint_new(color); - if (mface->v4) - c3 = KX_rgbaint2uint_new(color); - } break; - } -} - -typedef struct MTF_localLayer -{ - MTFace *face; - const char *name; -}MTF_localLayer; - -// ------------------------------------ -bool ConvertMaterial( - BL_Material *material, - Material *mat, - MTFace* tface, - const char *tfaceName, - MFace* mface, - MCol* mmcol, - MTF_localLayer *layers, - bool glslmat) -{ - material->Initialize(); - int numchan = -1, texalpha = 0; - bool validmat = (mat!=0); - bool validface = (tface!=0); - - short type = 0; - if( validmat ) - type = 1; // material color - - material->IdMode = DEFAULT_BLENDER; - material->glslmat = (validmat)? glslmat: false; - material->materialindex = mface->mat_nr; - - // -------------------------------- - if(validmat) { - - // use vertex colors by explicitly setting - if(mat->mode &MA_VERTEXCOLP || glslmat) - type = 0; - - // use lighting? - material->ras_mode |= ( mat->mode & MA_SHLESS )?0:USE_LIGHT; - MTex *mttmp = 0; - numchan = getNumTexChannels(mat); - int valid_index = 0; - - // use the face texture if - // 1) it is set in the buttons - // 2) we have a face texture and a material but no valid texture in slot 1 - bool facetex = false; - if(validface && mat->mode &MA_FACETEXTURE) - facetex = true; - if(validface && !mat->mtex[0]) - facetex = true; - if(validface && mat->mtex[0]) { - MTex *tmp = mat->mtex[0]; - if(!tmp->tex || (tmp->tex && !tmp->tex->ima)) - facetex = true; - } - numchan = numchan>MAXTEX?MAXTEX:numchan; - - // foreach MTex - for(int i=0; itpage); - - if(tmp) { - material->img[i] = tmp; - material->texname[i] = material->img[i]->id.name; - material->flag[i] |= ( tface->transp &TF_ALPHA )?USEALPHA:0; - material->flag[i] |= ( tface->transp &TF_ADD )?CALCALPHA:0; - material->flag[i] |= MIPMAP; - - if(material->img[i]->flag & IMA_REFLECT) - material->mapping[i].mapping |= USEREFL; - else - { - mttmp = getImageFromMaterial( mat, i ); - if(mttmp && mttmp->texco &TEXCO_UV) - { - STR_String uvName = mttmp->uvname; - - if (!uvName.IsEmpty()) - material->mapping[i].uvCoName = mttmp->uvname; - else - material->mapping[i].uvCoName = ""; - } - material->mapping[i].mapping |= USEUV; - } - - if(material->ras_mode & USE_LIGHT) - material->ras_mode &= ~USE_LIGHT; - if(tface->mode & TF_LIGHT) - material->ras_mode |= USE_LIGHT; - - valid_index++; - } - else { - material->img[i] = 0; - material->texname[i] = ""; - } - continue; - } - - mttmp = getImageFromMaterial( mat, i ); - if( mttmp ) { - if( mttmp->tex ) { - if( mttmp->tex->type == TEX_IMAGE ) { - material->mtexname[i] = mttmp->tex->id.name; - material->img[i] = mttmp->tex->ima; - if( material->img[i] ) { - - material->texname[i] = material->img[i]->id.name; - material->flag[i] |= ( mttmp->tex->imaflag &TEX_MIPMAP )?MIPMAP:0; - // ----------------------- - if( mttmp->tex->imaflag &TEX_USEALPHA ) { - material->flag[i] |= USEALPHA; - } - // ----------------------- - else if( mttmp->tex->imaflag &TEX_CALCALPHA ) { - material->flag[i] |= CALCALPHA; - } - else if(mttmp->tex->flag &TEX_NEGALPHA) { - material->flag[i] |= USENEGALPHA; - } - - material->color_blend[i] = mttmp->colfac; - material->flag[i] |= ( mttmp->mapto & MAP_ALPHA )?TEXALPHA:0; - material->flag[i] |= ( mttmp->texflag& MTEX_NEGATIVE )?TEXNEG:0; - - if(!glslmat && (material->flag[i] & TEXALPHA)) - texalpha = 1; - } - } - else if(mttmp->tex->type == TEX_ENVMAP) { - if( mttmp->tex->env->stype == ENV_LOAD ) { - - material->mtexname[i] = mttmp->tex->id.name; - EnvMap *env = mttmp->tex->env; - env->ima = mttmp->tex->ima; - material->cubemap[i] = env; - - if (material->cubemap[i]) - { - if (!material->cubemap[i]->cube[0]) - BL_Texture::SplitEnvMap(material->cubemap[i]); - - material->texname[i]= material->cubemap[i]->ima->id.name; - material->mapping[i].mapping |= USEENV; - } - } - } - material->flag[i] |= (mat->ipo!=0)?HASIPO:0; - /// -------------------------------- - // mapping methods - material->mapping[i].mapping |= ( mttmp->texco & TEXCO_REFL )?USEREFL:0; - - if(mttmp->texco & TEXCO_OBJECT) { - material->mapping[i].mapping |= USEOBJ; - if(mttmp->object) - material->mapping[i].objconame = mttmp->object->id.name; - } - else if(mttmp->texco &TEXCO_REFL) - material->mapping[i].mapping |= USEREFL; - else if(mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB)) - material->mapping[i].mapping |= USEORCO; - else if(mttmp->texco &TEXCO_UV) - { - STR_String uvName = mttmp->uvname; - - if (!uvName.IsEmpty()) - material->mapping[i].uvCoName = mttmp->uvname; - else - material->mapping[i].uvCoName = ""; - material->mapping[i].mapping |= USEUV; - } - else if(mttmp->texco &TEXCO_NORM) - material->mapping[i].mapping |= USENORM; - else if(mttmp->texco &TEXCO_TANGENT) - material->mapping[i].mapping |= USETANG; - else - material->mapping[i].mapping |= DISABLE; - - material->mapping[i].scale[0] = mttmp->size[0]; - material->mapping[i].scale[1] = mttmp->size[1]; - material->mapping[i].scale[2] = mttmp->size[2]; - material->mapping[i].offsets[0] = mttmp->ofs[0]; - material->mapping[i].offsets[1] = mttmp->ofs[1]; - material->mapping[i].offsets[2] = mttmp->ofs[2]; - - material->mapping[i].projplane[0] = mttmp->projx; - material->mapping[i].projplane[1] = mttmp->projy; - material->mapping[i].projplane[2] = mttmp->projz; - /// -------------------------------- - - switch( mttmp->blendtype ) { - case MTEX_BLEND: - material->blend_mode[i] = BLEND_MIX; - break; - case MTEX_MUL: - material->blend_mode[i] = BLEND_MUL; - break; - case MTEX_ADD: - material->blend_mode[i] = BLEND_ADD; - break; - case MTEX_SUB: - material->blend_mode[i] = BLEND_SUB; - break; - case MTEX_SCREEN: - material->blend_mode[i] = BLEND_SCR; - break; - } - valid_index++; - } - } - } - - // above one tex the switches here - // are not used - switch(valid_index) { - case 0: - material->IdMode = DEFAULT_BLENDER; - break; - case 1: - material->IdMode = ONETEX; - break; - default: - material->IdMode = GREATERTHAN2; - break; - } - material->SetUsers(mat->id.us); - - material->num_enabled = valid_index; - - material->speccolor[0] = mat->specr; - material->speccolor[1] = mat->specg; - material->speccolor[2] = mat->specb; - material->hard = (float)mat->har/4.0f; - material->matcolor[0] = mat->r; - material->matcolor[1] = mat->g; - material->matcolor[2] = mat->b; - material->matcolor[3] = mat->alpha; - material->alpha = mat->alpha; - material->emit = mat->emit; - material->spec_f = mat->spec; - material->ref = mat->ref; - material->amb = mat->amb; - - material->ras_mode |= (mat->material_type == MA_TYPE_WIRE)? WIRE: 0; - } - else { - int valid = 0; - - // check for tface tex to fallback on - if( validface ){ - - // no light bugfix - if(tface->mode) material->ras_mode |= USE_LIGHT; - - material->img[0] = (Image*)(tface->tpage); - // ------------------------ - if(material->img[0]) { - material->texname[0] = material->img[0]->id.name; - material->mapping[0].mapping |= ( (material->img[0]->flag & IMA_REFLECT)!=0 )?USEREFL:0; - material->flag[0] |= ( tface->transp &TF_ALPHA )?USEALPHA:0; - material->flag[0] |= ( tface->transp &TF_ADD )?CALCALPHA:0; - valid++; - } - } - material->SetUsers(-1); - material->num_enabled = valid; - material->IdMode = TEXFACE; - material->speccolor[0] = 1.f; - material->speccolor[1] = 1.f; - material->speccolor[2] = 1.f; - material->hard = 35.f; - material->matcolor[0] = 0.5f; - material->matcolor[1] = 0.5f; - material->matcolor[2] = 0.5f; - material->spec_f = 0.5f; - material->ref = 0.8f; - } - MT_Point2 uv[4]; - MT_Point2 uv2[4]; - const char *uvName = "", *uv2Name = ""; - - - uv2[0]= uv2[1]= uv2[2]= uv2[3]= MT_Point2(0.0f, 0.0f); - - if( validface ) { - - material->ras_mode |= (tface->mode & TF_INVISIBLE)?0:POLY_VIS; - - material->transp = tface->transp; - material->tile = tface->tile; - material->mode = tface->mode; - - uv[0].setValue(tface->uv[0]); - uv[1].setValue(tface->uv[1]); - uv[2].setValue(tface->uv[2]); - - if (mface->v4) - uv[3].setValue(tface->uv[3]); - - uvName = tfaceName; - } - else { - // nothing at all - material->ras_mode |= (POLY_VIS| (validmat?0:USE_LIGHT)); - material->mode = default_face_mode; - material->transp = TF_SOLID; - material->tile = 0; - - uv[0]= uv[1]= uv[2]= uv[3]= MT_Point2(0.0f, 0.0f); - } - - // with ztransp enabled, enforce alpha blending mode - if(validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->transp == TF_SOLID)) - material->transp = TF_ALPHA; - - // always zsort alpha + add - if((material->transp == TF_ALPHA || material->transp == TF_ADD || texalpha) && (material->transp != TF_CLIP)) { - material->ras_mode |= ALPHA; - material->ras_mode |= (material->mode & TF_ALPHASORT)? ZSORT: 0; - } - - // collider or not? - material->ras_mode |= (material->mode & TF_DYNAMIC)? COLLIDER: 0; - - // these flags are irrelevant at this point, remove so they - // don't hurt material bucketing - material->mode &= ~(TF_DYNAMIC|TF_ALPHASORT|TF_TEX); - - // get uv sets - if(validmat) - { - bool isFirstSet = true; - - // only two sets implemented, but any of the eight - // sets can make up the two layers - for (int vind = 0; vindnum_enabled; vind++) - { - BL_Mapping &map = material->mapping[vind]; - - if (map.uvCoName.IsEmpty()) - isFirstSet = false; - else - { - for (int lay=0; layuv[0]); - uvSet[1].setValue(layer.face->uv[1]); - uvSet[2].setValue(layer.face->uv[2]); - - if (mface->v4) - uvSet[3].setValue(layer.face->uv[3]); - else - uvSet[3].setValue(0.0f, 0.0f); - - if (isFirstSet) - { - uv[0] = uvSet[0]; uv[1] = uvSet[1]; - uv[2] = uvSet[2]; uv[3] = uvSet[3]; - isFirstSet = false; - uvName = layer.name; - } - else if(strcmp(layer.name, uvName) != 0) - { - uv2[0] = uvSet[0]; uv2[1] = uvSet[1]; - uv2[2] = uvSet[2]; uv2[3] = uvSet[3]; - map.mapping |= USECUSTOMUV; - uv2Name = layer.name; - } - } - } - } - } - } - - unsigned int rgb[4]; - GetRGB(type,mface,mmcol,mat,rgb[0],rgb[1],rgb[2], rgb[3]); - - // swap the material color, so MCol on TF_BMFONT works - if (validmat && type==1 && (tface && tface->mode & TF_BMFONT)) - { - rgb[0] = KX_rgbaint2uint_new(rgb[0]); - rgb[1] = KX_rgbaint2uint_new(rgb[1]); - rgb[2] = KX_rgbaint2uint_new(rgb[2]); - rgb[3] = KX_rgbaint2uint_new(rgb[3]); - } - - material->SetConversionRGB(rgb); - material->SetConversionUV(uvName, uv); - material->SetConversionUV2(uv2Name, uv2); - - if(validmat) - material->matname =(mat->id.name); - - material->tface = tface; - material->material = mat; - return true; -} - -/* blenderobj can be NULL, make sure its checked for */ -RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, KX_BlenderSceneConverter *converter) -{ - RAS_MeshObject *meshobj; - int lightlayer = blenderobj ? blenderobj->lay:(1<<20)-1; // all layers if no object. - - if ((meshobj = converter->FindGameMesh(mesh/*, ob->lay*/)) != NULL) - return meshobj; - // Get DerivedMesh data - DerivedMesh *dm = CDDM_from_mesh(mesh, blenderobj); - - MVert *mvert = dm->getVertArray(dm); - int totvert = dm->getNumVerts(dm); - - MFace *mface = dm->getFaceArray(dm); - MTFace *tface = static_cast(dm->getFaceDataArray(dm, CD_MTFACE)); - MCol *mcol = static_cast(dm->getFaceDataArray(dm, CD_MCOL)); - float (*tangent)[3] = NULL; - int totface = dm->getNumFaces(dm); - const char *tfaceName = ""; - - if(tface) { - DM_add_tangent_layer(dm); - tangent = (float(*)[3])dm->getFaceDataArray(dm, CD_TANGENT); - } - - meshobj = new RAS_MeshObject(mesh); - - // Extract avaiable layers - MTF_localLayer *layers = new MTF_localLayer[MAX_MTFACE]; - for (int lay=0; layfaceData.totlayer; i++) - { - if (dm->faceData.layers[i].type == CD_MTFACE) - { - assert(validLayers <= 8); - - layers[validLayers].face = (MTFace*)(dm->faceData.layers[i].data); - layers[validLayers].name = dm->faceData.layers[i].name; - if(tface == layers[validLayers].face) - tfaceName = layers[validLayers].name; - validLayers++; - } - } - - meshobj->SetName(mesh->id.name + 2); - meshobj->m_sharedvertex_map.resize(totvert); - RAS_IPolyMaterial* polymat = NULL; - STR_String imastr; - // These pointers will hold persistent material structure during the conversion - // to avoid countless allocation/deallocation of memory. - BL_Material* bl_mat = NULL; - KX_BlenderMaterial* kx_blmat = NULL; - KX_PolygonMaterial* kx_polymat = NULL; - - for (int f=0;fv1].co); - pt1.setValue(mvert[mface->v2].co); - pt2.setValue(mvert[mface->v3].co); - if (mface->v4) pt3.setValue(mvert[mface->v4].co); - - if(mface->flag & ME_SMOOTH) { - float n0[3], n1[3], n2[3], n3[3]; - - normal_short_to_float_v3(n0, mvert[mface->v1].no); - normal_short_to_float_v3(n1, mvert[mface->v2].no); - normal_short_to_float_v3(n2, mvert[mface->v3].no); - no0 = n0; - no1 = n1; - no2 = n2; - - if(mface->v4) { - normal_short_to_float_v3(n3, mvert[mface->v4].no); - no3 = n3; - } - } - else { - float fno[3]; - - if(mface->v4) - normal_quad_v3( fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co); - else - normal_tri_v3( fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co); - - no0 = no1 = no2 = no3 = MT_Vector3(fno); - } - - if(tangent) { - tan0 = tangent[f*4 + 0]; - tan1 = tangent[f*4 + 1]; - tan2 = tangent[f*4 + 2]; - - if (mface->v4) - tan3 = tangent[f*4 + 3]; - } - if(blenderobj) - ma = give_current_material(blenderobj, mface->mat_nr+1); - else - ma = mesh->mat ? mesh->mat[mface->mat_nr]:NULL; - - { - bool visible = true; - bool twoside = false; - - if(converter->GetMaterials()) { - /* do Blender Multitexture and Blender GLSL materials */ - unsigned int rgb[4]; - MT_Point2 uv[4]; - - /* first is the BL_Material */ - if (!bl_mat) - bl_mat = new BL_Material(); - ConvertMaterial(bl_mat, ma, tface, tfaceName, mface, mcol, - layers, converter->GetGLSLMaterials()); - - visible = ((bl_mat->ras_mode & POLY_VIS)!=0); - collider = ((bl_mat->ras_mode & COLLIDER)!=0); - twoside = ((bl_mat->mode & TF_TWOSIDE)!=0); - - /* vertex colors and uv's were stored in bl_mat temporarily */ - bl_mat->GetConversionRGB(rgb); - rgb0 = rgb[0]; rgb1 = rgb[1]; - rgb2 = rgb[2]; rgb3 = rgb[3]; - - bl_mat->GetConversionUV(uv); - uv0 = uv[0]; uv1 = uv[1]; - uv2 = uv[2]; uv3 = uv[3]; - - bl_mat->GetConversionUV2(uv); - uv20 = uv[0]; uv21 = uv[1]; - uv22 = uv[2]; uv23 = uv[3]; - - /* then the KX_BlenderMaterial */ - if (kx_blmat == NULL) - kx_blmat = new KX_BlenderMaterial(); - - kx_blmat->Initialize(scene, bl_mat); - polymat = static_cast(kx_blmat); - } - else { - /* do Texture Face materials */ - Image* bima = (tface)? (Image*)tface->tpage: NULL; - imastr = (tface)? (bima? (bima)->id.name : "" ) : ""; - - char transp=0; - short mode=0, tile=0; - int tilexrep=4,tileyrep = 4; - - if (bima) { - tilexrep = bima->xrep; - tileyrep = bima->yrep; - } - - /* get tface properties if available */ - if(tface) { - /* TF_DYNAMIC means the polygon is a collision face */ - collider = ((tface->mode & TF_DYNAMIC) != 0); - transp = tface->transp; - tile = tface->tile; - mode = tface->mode; - - visible = !(tface->mode & TF_INVISIBLE); - twoside = ((tface->mode & TF_TWOSIDE)!=0); - - uv0.setValue(tface->uv[0]); - uv1.setValue(tface->uv[1]); - uv2.setValue(tface->uv[2]); - - if (mface->v4) - uv3.setValue(tface->uv[3]); - } - else { - /* no texfaces, set COLLSION true and everything else FALSE */ - mode = default_face_mode; - transp = TF_SOLID; - tile = 0; - } - - /* get vertex colors */ - if (mcol) { - /* we have vertex colors */ - rgb0 = KX_Mcol2uint_new(mcol[0]); - rgb1 = KX_Mcol2uint_new(mcol[1]); - rgb2 = KX_Mcol2uint_new(mcol[2]); - - if (mface->v4) - rgb3 = KX_Mcol2uint_new(mcol[3]); - } - else { - /* no vertex colors, take from material, otherwise white */ - unsigned int color = 0xFFFFFFFFL; - - if (ma) - { - union - { - unsigned char cp[4]; - unsigned int integer; - } col_converter; - - col_converter.cp[3] = (unsigned char) (ma->r*255.0); - col_converter.cp[2] = (unsigned char) (ma->g*255.0); - col_converter.cp[1] = (unsigned char) (ma->b*255.0); - col_converter.cp[0] = (unsigned char) (ma->alpha*255.0); - - color = col_converter.integer; - } - - rgb0 = KX_rgbaint2uint_new(color); - rgb1 = KX_rgbaint2uint_new(color); - rgb2 = KX_rgbaint2uint_new(color); - - if (mface->v4) - rgb3 = KX_rgbaint2uint_new(color); - } - - // only zsort alpha + add - bool alpha = (transp == TF_ALPHA || transp == TF_ADD); - bool zsort = (mode & TF_ALPHASORT)? alpha: 0; - - if (kx_polymat == NULL) - kx_polymat = new KX_PolygonMaterial(); - kx_polymat->Initialize(imastr, ma, (int)mface->mat_nr, - tile, tilexrep, tileyrep, - mode, transp, alpha, zsort, lightlayer, tface, (unsigned int*)mcol); - polymat = static_cast(kx_polymat); - - if (ma) { - polymat->m_specular = MT_Vector3(ma->specr, ma->specg, ma->specb)*ma->spec; - polymat->m_shininess = (float)ma->har/4.0; // 0 < ma->har <= 512 - polymat->m_diffuse = MT_Vector3(ma->r, ma->g, ma->b)*(ma->emit + ma->ref); - } - else { - polymat->m_specular.setValue(0.0f,0.0f,0.0f); - polymat->m_shininess = 35.0; - } - } - - /* mark face as flat, so vertices are split */ - bool flat = (mface->flag & ME_SMOOTH) == 0; - - // see if a bucket was reused or a new one was created - // this way only one KX_BlenderMaterial object has to exist per bucket - bool bucketCreated; - RAS_MaterialBucket* bucket = scene->FindBucket(polymat, bucketCreated); - if (bucketCreated) { - // this is needed to free up memory afterwards - converter->RegisterPolyMaterial(polymat); - if(converter->GetMaterials()) { - converter->RegisterBlenderMaterial(bl_mat); - // the poly material has been stored in the bucket, next time we must create a new one - bl_mat = NULL; - kx_blmat = NULL; - } else { - // the poly material has been stored in the bucket, next time we must create a new one - kx_polymat = NULL; - } - } else { - // from now on, use the polygon material from the material bucket - polymat = bucket->GetPolyMaterial(); - // keep the material pointers, they will be reused for next face - } - - int nverts = (mface->v4)? 4: 3; - RAS_Polygon *poly = meshobj->AddPolygon(bucket, nverts); - - poly->SetVisible(visible); - poly->SetCollider(collider); - poly->SetTwoside(twoside); - //poly->SetEdgeCode(mface->edcode); - - meshobj->AddVertex(poly,0,pt0,uv0,uv20,tan0,rgb0,no0,flat,mface->v1); - meshobj->AddVertex(poly,1,pt1,uv1,uv21,tan1,rgb1,no1,flat,mface->v2); - meshobj->AddVertex(poly,2,pt2,uv2,uv22,tan2,rgb2,no2,flat,mface->v3); - - if (nverts==4) - meshobj->AddVertex(poly,3,pt3,uv3,uv23,tan3,rgb3,no3,flat,mface->v4); - } - - if (tface) - tface++; - if (mcol) - mcol+=4; - - for (int lay=0; laym_sharedvertex_map for reinstance phys mesh. - // 2.49a and before it did: meshobj->m_sharedvertex_map.clear(); - // but this didnt save much ram. - Campbell - meshobj->EndConversion(); - - // pre calculate texture generation - for(list::iterator mit = meshobj->GetFirstMaterial(); - mit != meshobj->GetLastMaterial(); ++ mit) { - mit->m_bucket->GetPolyMaterial()->OnConstruction(lightlayer); - } - - if (layers) - delete []layers; - - dm->release(dm); - // cleanup material - if (bl_mat) - delete bl_mat; - if (kx_blmat) - delete kx_blmat; - if (kx_polymat) - delete kx_polymat; - converter->RegisterGameMesh(meshobj, mesh); - return meshobj; -} - - - -static PHY_MaterialProps *CreateMaterialFromBlenderObject(struct Object* blenderobject) -{ - PHY_MaterialProps *materialProps = new PHY_MaterialProps; - - MT_assert(materialProps && "Create physics material properties failed"); - - Material* blendermat = give_current_material(blenderobject, 0); - - if (blendermat) - { - MT_assert(0.0f <= blendermat->reflect && blendermat->reflect <= 1.0f); - - materialProps->m_restitution = blendermat->reflect; - materialProps->m_friction = blendermat->friction; - materialProps->m_fh_spring = blendermat->fh; - materialProps->m_fh_damping = blendermat->xyfrict; - materialProps->m_fh_distance = blendermat->fhdist; - materialProps->m_fh_normal = (blendermat->dynamode & MA_FH_NOR) != 0; - } - else { - //give some defaults - materialProps->m_restitution = 0.f; - materialProps->m_friction = 0.5; - materialProps->m_fh_spring = 0.f; - materialProps->m_fh_damping = 0.f; - materialProps->m_fh_distance = 0.f; - materialProps->m_fh_normal = false; - - } - - return materialProps; -} - -static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blenderobject) -{ - PHY_ShapeProps *shapeProps = new PHY_ShapeProps; - - MT_assert(shapeProps); - - shapeProps->m_mass = blenderobject->mass; - -// This needs to be fixed in blender. For now, we use: - -// in Blender, inertia stands for the size value which is equivalent to -// the sphere radius - shapeProps->m_inertia = blenderobject->formfactor; - - MT_assert(0.0f <= blenderobject->damping && blenderobject->damping <= 1.0f); - MT_assert(0.0f <= blenderobject->rdamping && blenderobject->rdamping <= 1.0f); - - shapeProps->m_lin_drag = 1.0 - blenderobject->damping; - shapeProps->m_ang_drag = 1.0 - blenderobject->rdamping; - - shapeProps->m_friction_scaling[0] = blenderobject->anisotropicFriction[0]; - shapeProps->m_friction_scaling[1] = blenderobject->anisotropicFriction[1]; - shapeProps->m_friction_scaling[2] = blenderobject->anisotropicFriction[2]; - shapeProps->m_do_anisotropic = ((blenderobject->gameflag & OB_ANISOTROPIC_FRICTION) != 0); - - shapeProps->m_do_fh = (blenderobject->gameflag & OB_DO_FH) != 0; - shapeProps->m_do_rot_fh = (blenderobject->gameflag & OB_ROT_FH) != 0; - -// velocity clamping XXX - shapeProps->m_clamp_vel_min = blenderobject->min_vel; - shapeProps->m_clamp_vel_max = blenderobject->max_vel; - - return shapeProps; -} - - - - - -////////////////////////////////////////////////////////// - - - -static float my_boundbox_mesh(Mesh *me, float *loc, float *size) -{ - MVert *mvert; - BoundBox *bb; - MT_Point3 min, max; - float mloc[3], msize[3]; - float radius=0.0f, vert_radius, *co; - int a; - - if(me->bb==0) me->bb= (struct BoundBox *)MEM_callocN(sizeof(BoundBox), "boundbox"); - bb= me->bb; - - INIT_MINMAX(min, max); - - if (!loc) loc= mloc; - if (!size) size= msize; - - mvert= me->mvert; - for(a=0; atotvert; a++, mvert++) { - co= mvert->co; - - /* bounds */ - DO_MINMAX(co, min, max); - - /* radius */ - vert_radius= co[0]*co[0] + co[1]*co[1] + co[2]*co[2]; - if (vert_radius > radius) - radius= vert_radius; - } - - if(me->totvert) { - loc[0]= (min[0]+max[0])/2.0; - loc[1]= (min[1]+max[1])/2.0; - loc[2]= (min[2]+max[2])/2.0; - - size[0]= (max[0]-min[0])/2.0; - size[1]= (max[1]-min[1])/2.0; - size[2]= (max[2]-min[2])/2.0; - } - else { - loc[0]= loc[1]= loc[2]= 0.0; - size[0]= size[1]= size[2]= 0.0; - } - - bb->vec[0][0]=bb->vec[1][0]=bb->vec[2][0]=bb->vec[3][0]= loc[0]-size[0]; - bb->vec[4][0]=bb->vec[5][0]=bb->vec[6][0]=bb->vec[7][0]= loc[0]+size[0]; - - bb->vec[0][1]=bb->vec[1][1]=bb->vec[4][1]=bb->vec[5][1]= loc[1]-size[1]; - bb->vec[2][1]=bb->vec[3][1]=bb->vec[6][1]=bb->vec[7][1]= loc[1]+size[1]; - - bb->vec[0][2]=bb->vec[3][2]=bb->vec[4][2]=bb->vec[7][2]= loc[2]-size[2]; - bb->vec[1][2]=bb->vec[2][2]=bb->vec[5][2]=bb->vec[6][2]= loc[2]+size[2]; - - return sqrt(radius); -} - - - - -static void my_tex_space_mesh(Mesh *me) - { - KeyBlock *kb; - float *fp, loc[3], size[3], min[3], max[3]; - int a; - - my_boundbox_mesh(me, loc, size); - - if(me->texflag & AUTOSPACE) { - if(me->key) { - kb= me->key->refkey; - if (kb) { - - INIT_MINMAX(min, max); - - fp= (float *)kb->data; - for(a=0; atotelem; a++, fp+=3) { - DO_MINMAX(fp, min, max); - } - if(kb->totelem) { - loc[0]= (min[0]+max[0])/2.0; loc[1]= (min[1]+max[1])/2.0; loc[2]= (min[2]+max[2])/2.0; - size[0]= (max[0]-min[0])/2.0; size[1]= (max[1]-min[1])/2.0; size[2]= (max[2]-min[2])/2.0; - } - else { - loc[0]= loc[1]= loc[2]= 0.0; - size[0]= size[1]= size[2]= 0.0; - } - - } - } - - VECCOPY(me->loc, loc); - VECCOPY(me->size, size); - me->rot[0]= me->rot[1]= me->rot[2]= 0.0; - - if(me->size[0]==0.0) me->size[0]= 1.0; - else if(me->size[0]>0.0 && me->size[0]<0.00001) me->size[0]= 0.00001; - else if(me->size[0]<0.0 && me->size[0]> -0.00001) me->size[0]= -0.00001; - - if(me->size[1]==0.0) me->size[1]= 1.0; - else if(me->size[1]>0.0 && me->size[1]<0.00001) me->size[1]= 0.00001; - else if(me->size[1]<0.0 && me->size[1]> -0.00001) me->size[1]= -0.00001; - - if(me->size[2]==0.0) me->size[2]= 1.0; - else if(me->size[2]>0.0 && me->size[2]<0.00001) me->size[2]= 0.00001; - else if(me->size[2]<0.0 && me->size[2]> -0.00001) me->size[2]= -0.00001; - } - -} - -static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, float *size) -{ - BoundBox *bb= NULL; - /* uses boundbox, function used by Ketsji */ - switch (ob->type) - { - case OB_MESH: - if (dm) - { - float min_r[3], max_r[3]; - INIT_MINMAX(min_r, max_r); - dm->getMinMax(dm, min_r, max_r); - size[0]= 0.5*fabs(max_r[0] - min_r[0]); - size[1]= 0.5*fabs(max_r[1] - min_r[1]); - size[2]= 0.5*fabs(max_r[2] - min_r[2]); - - center[0]= 0.5*(max_r[0] + min_r[0]); - center[1]= 0.5*(max_r[1] + min_r[1]); - center[2]= 0.5*(max_r[2] + min_r[2]); - return; - } else - { - bb= ( (Mesh *)ob->data )->bb; - if(bb==0) - { - my_tex_space_mesh((struct Mesh *)ob->data); - bb= ( (Mesh *)ob->data )->bb; - } - } - break; - case OB_CURVE: - case OB_SURF: - case OB_FONT: - center[0]= center[1]= center[2]= 0.0; - size[0] = size[1]=size[2]=0.0; - break; - case OB_MBALL: - bb= ob->bb; - break; - } - - if(bb==NULL) - { - center[0]= center[1]= center[2]= 0.0; - size[0] = size[1]=size[2]=1.0; - } - else - { - size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]); - size[1]= 0.5*fabs(bb->vec[0][1] - bb->vec[2][1]); - size[2]= 0.5*fabs(bb->vec[0][2] - bb->vec[1][2]); - - center[0]= 0.5*(bb->vec[0][0] + bb->vec[4][0]); - center[1]= 0.5*(bb->vec[0][1] + bb->vec[2][1]); - center[2]= 0.5*(bb->vec[0][2] + bb->vec[1][2]); - } -} - - - - -////////////////////////////////////////////////////// - - -void BL_CreateGraphicObjectNew(KX_GameObject* gameobj, - const MT_Point3& localAabbMin, - const MT_Point3& localAabbMax, - KX_Scene* kxscene, - bool isActive, - e_PhysicsEngine physics_engine) -{ - if (gameobj->GetMeshCount() > 0) - { - switch (physics_engine) - { -#ifdef USE_BULLET - case UseBullet: - { - CcdPhysicsEnvironment* env = (CcdPhysicsEnvironment*)kxscene->GetPhysicsEnvironment(); - assert(env); - PHY_IMotionState* motionstate = new KX_MotionState(gameobj->GetSGNode()); - CcdGraphicController* ctrl = new CcdGraphicController(env, motionstate); - gameobj->SetGraphicController(ctrl); - ctrl->setNewClientInfo(gameobj->getClientInfo()); - ctrl->setLocalAabb(localAabbMin, localAabbMax); - if (isActive) { - // add first, this will create the proxy handle, only if the object is visible - if (gameobj->GetVisible()) - env->addCcdGraphicController(ctrl); - // update the mesh if there is a deformer, this will also update the bounding box for modifiers - RAS_Deformer* deformer = gameobj->GetDeformer(); - if (deformer) - deformer->UpdateBuckets(); - } - } - break; -#endif - default: - break; - } - } -} - -void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, - struct Object* blenderobject, - RAS_MeshObject* meshobj, - KX_Scene* kxscene, - int activeLayerBitInfo, - e_PhysicsEngine physics_engine, - KX_BlenderSceneConverter *converter, - bool processCompoundChildren - ) - -{ - //SYS_SystemHandle syshandle = SYS_GetSystem(); /*unused*/ - //int userigidbody = SYS_GetCommandLineInt(syshandle,"norigidbody",0); - //bool bRigidBody = (userigidbody == 0); - - // object has physics representation? - if (!(blenderobject->gameflag & OB_COLLISION)) - return; - - // get Root Parent of blenderobject - struct Object* parent= blenderobject->parent; - while(parent && parent->parent) { - parent= parent->parent; - } - - bool isCompoundChild = false; - bool hasCompoundChildren = !parent && (blenderobject->gameflag & OB_CHILD); - - /* When the parent is not OB_DYNAMIC and has no OB_COLLISION then it gets no bullet controller - * and cant be apart of the parents compound shape */ - if (parent && (parent->gameflag & (OB_DYNAMIC | OB_COLLISION))) { - - if ((parent->gameflag & OB_CHILD) != 0 && (blenderobject->gameflag & OB_CHILD)) - { - isCompoundChild = true; - } - } - if (processCompoundChildren != isCompoundChild) - return; - - - PHY_ShapeProps* shapeprops = - CreateShapePropsFromBlenderObject(blenderobject); - - - PHY_MaterialProps* smmaterial = - CreateMaterialFromBlenderObject(blenderobject); - - KX_ObjectProperties objprop; - objprop.m_lockXaxis = (blenderobject->gameflag2 & OB_LOCK_RIGID_BODY_X_AXIS) !=0; - objprop.m_lockYaxis = (blenderobject->gameflag2 & OB_LOCK_RIGID_BODY_Y_AXIS) !=0; - objprop.m_lockZaxis = (blenderobject->gameflag2 & OB_LOCK_RIGID_BODY_Z_AXIS) !=0; - objprop.m_lockXRotaxis = (blenderobject->gameflag2 & OB_LOCK_RIGID_BODY_X_ROT_AXIS) !=0; - objprop.m_lockYRotaxis = (blenderobject->gameflag2 & OB_LOCK_RIGID_BODY_Y_ROT_AXIS) !=0; - objprop.m_lockZRotaxis = (blenderobject->gameflag2 & OB_LOCK_RIGID_BODY_Z_ROT_AXIS) !=0; - - objprop.m_isCompoundChild = isCompoundChild; - objprop.m_hasCompoundChildren = hasCompoundChildren; - objprop.m_margin = blenderobject->margin; - - // ACTOR is now a separate feature - objprop.m_isactor = (blenderobject->gameflag & OB_ACTOR)!=0; - objprop.m_dyna = (blenderobject->gameflag & OB_DYNAMIC) != 0; - objprop.m_softbody = (blenderobject->gameflag & OB_SOFT_BODY) != 0; - objprop.m_angular_rigidbody = (blenderobject->gameflag & OB_RIGID_BODY) != 0; - - ///contact processing threshold is only for rigid bodies and static geometry, not 'dynamic' - if (objprop.m_angular_rigidbody || !objprop.m_dyna ) - { - objprop.m_contactProcessingThreshold = blenderobject->m_contactProcessingThreshold; - } else - { - objprop.m_contactProcessingThreshold = 0.f; - } - - objprop.m_sensor = (blenderobject->gameflag & OB_SENSOR) != 0; - - if (objprop.m_softbody) - { - ///for game soft bodies - if (blenderobject->bsoft) - { - objprop.m_gamesoftFlag = blenderobject->bsoft->flag; - /////////////////// - objprop.m_soft_linStiff = blenderobject->bsoft->linStiff; - objprop.m_soft_angStiff = blenderobject->bsoft->angStiff; /* angular stiffness 0..1 */ - objprop.m_soft_volume= blenderobject->bsoft->volume; /* volume preservation 0..1 */ - - objprop.m_soft_viterations= blenderobject->bsoft->viterations; /* Velocities solver iterations */ - objprop.m_soft_piterations= blenderobject->bsoft->piterations; /* Positions solver iterations */ - objprop.m_soft_diterations= blenderobject->bsoft->diterations; /* Drift solver iterations */ - objprop.m_soft_citerations= blenderobject->bsoft->citerations; /* Cluster solver iterations */ - - objprop.m_soft_kSRHR_CL= blenderobject->bsoft->kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */ - objprop.m_soft_kSKHR_CL= blenderobject->bsoft->kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */ - objprop.m_soft_kSSHR_CL= blenderobject->bsoft->kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */ - objprop.m_soft_kSR_SPLT_CL= blenderobject->bsoft->kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - - objprop.m_soft_kSK_SPLT_CL= blenderobject->bsoft->kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - objprop.m_soft_kSS_SPLT_CL= blenderobject->bsoft->kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - objprop.m_soft_kVCF= blenderobject->bsoft->kVCF; /* Velocities correction factor (Baumgarte) */ - objprop.m_soft_kDP= blenderobject->bsoft->kDP; /* Damping coefficient [0,1] */ - - objprop.m_soft_kDG= blenderobject->bsoft->kDG; /* Drag coefficient [0,+inf] */ - objprop.m_soft_kLF= blenderobject->bsoft->kLF; /* Lift coefficient [0,+inf] */ - objprop.m_soft_kPR= blenderobject->bsoft->kPR; /* Pressure coefficient [-inf,+inf] */ - objprop.m_soft_kVC= blenderobject->bsoft->kVC; /* Volume conversation coefficient [0,+inf] */ - - objprop.m_soft_kDF= blenderobject->bsoft->kDF; /* Dynamic friction coefficient [0,1] */ - objprop.m_soft_kMT= blenderobject->bsoft->kMT; /* Pose matching coefficient [0,1] */ - objprop.m_soft_kCHR= blenderobject->bsoft->kCHR; /* Rigid contacts hardness [0,1] */ - objprop.m_soft_kKHR= blenderobject->bsoft->kKHR; /* Kinetic contacts hardness [0,1] */ - - objprop.m_soft_kSHR= blenderobject->bsoft->kSHR; /* Soft contacts hardness [0,1] */ - objprop.m_soft_kAHR= blenderobject->bsoft->kAHR; /* Anchors hardness [0,1] */ - objprop.m_soft_collisionflags= blenderobject->bsoft->collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ - objprop.m_soft_numclusteriterations= blenderobject->bsoft->numclusteriterations; /* number of iterations to refine collision clusters*/ - //objprop.m_soft_welding = blenderobject->bsoft->welding; /* welding */ - /* disable welding: it doesn't bring any additional stability and it breaks the relation between soft body collision shape and graphic mesh */ - objprop.m_soft_welding = 0.f; - objprop.m_margin = blenderobject->bsoft->margin; - objprop.m_contactProcessingThreshold = 0.f; - } else - { - objprop.m_gamesoftFlag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT; - - objprop.m_soft_linStiff = 0.5;; - objprop.m_soft_angStiff = 1.f; /* angular stiffness 0..1 */ - objprop.m_soft_volume= 1.f; /* volume preservation 0..1 */ - - - objprop.m_soft_viterations= 0; - objprop.m_soft_piterations= 1; - objprop.m_soft_diterations= 0; - objprop.m_soft_citerations= 4; - - objprop.m_soft_kSRHR_CL= 0.1f; - objprop.m_soft_kSKHR_CL= 1.f; - objprop.m_soft_kSSHR_CL= 0.5; - objprop.m_soft_kSR_SPLT_CL= 0.5f; - - objprop.m_soft_kSK_SPLT_CL= 0.5f; - objprop.m_soft_kSS_SPLT_CL= 0.5f; - objprop.m_soft_kVCF= 1; - objprop.m_soft_kDP= 0; - - objprop.m_soft_kDG= 0; - objprop.m_soft_kLF= 0; - objprop.m_soft_kPR= 0; - objprop.m_soft_kVC= 0; - - objprop.m_soft_kDF= 0.2f; - objprop.m_soft_kMT= 0.05f; - objprop.m_soft_kCHR= 1.0f; - objprop.m_soft_kKHR= 0.1f; - - objprop.m_soft_kSHR= 1.f; - objprop.m_soft_kAHR= 0.7f; - objprop.m_soft_collisionflags= OB_BSB_COL_SDF_RS + OB_BSB_COL_VF_SS; - objprop.m_soft_numclusteriterations= 16; - objprop.m_soft_welding = 0.f; - objprop.m_margin = 0.f; - objprop.m_contactProcessingThreshold = 0.f; - } - } - - objprop.m_ghost = (blenderobject->gameflag & OB_GHOST) != 0; - objprop.m_disableSleeping = (blenderobject->gameflag & OB_COLLISION_RESPONSE) != 0;//abuse the OB_COLLISION_RESPONSE flag - //mmm, for now, taks this for the size of the dynamicobject - // Blender uses inertia for radius of dynamic object - objprop.m_radius = blenderobject->inertia; - objprop.m_in_active_layer = (blenderobject->lay & activeLayerBitInfo) != 0; - objprop.m_dynamic_parent=NULL; - objprop.m_isdeformable = ((blenderobject->gameflag2 & 2)) != 0; - objprop.m_boundclass = objprop.m_dyna?KX_BOUNDSPHERE:KX_BOUNDMESH; - - if ((blenderobject->gameflag & OB_SOFT_BODY) && !(blenderobject->gameflag & OB_BOUNDS)) - { - objprop.m_boundclass = KX_BOUNDMESH; - } - - KX_BoxBounds bb; - DerivedMesh* dm = NULL; - if (gameobj->GetDeformer()) - dm = gameobj->GetDeformer()->GetFinalMesh(); - my_get_local_bounds(blenderobject,dm,objprop.m_boundobject.box.m_center,bb.m_extends); - if (blenderobject->gameflag & OB_BOUNDS) - { - switch (blenderobject->boundtype) - { - case OB_BOUND_BOX: - objprop.m_boundclass = KX_BOUNDBOX; - //mmm, has to be divided by 2 to be proper extends - objprop.m_boundobject.box.m_extends[0]=2.f*bb.m_extends[0]; - objprop.m_boundobject.box.m_extends[1]=2.f*bb.m_extends[1]; - objprop.m_boundobject.box.m_extends[2]=2.f*bb.m_extends[2]; - break; - case OB_BOUND_POLYT: - if (blenderobject->type == OB_MESH) - { - objprop.m_boundclass = KX_BOUNDPOLYTOPE; - break; - } - // Object is not a mesh... fall through OB_BOUND_POLYH to - // OB_BOUND_SPHERE - case OB_BOUND_POLYH: - if (blenderobject->type == OB_MESH) - { - objprop.m_boundclass = KX_BOUNDMESH; - break; - } - // Object is not a mesh... can't use polyheder. - // Fall through and become a sphere. - case OB_BOUND_SPHERE: - { - objprop.m_boundclass = KX_BOUNDSPHERE; - objprop.m_boundobject.c.m_radius = MT_max(bb.m_extends[0], MT_max(bb.m_extends[1], bb.m_extends[2])); - break; - } - case OB_BOUND_CYLINDER: - { - objprop.m_boundclass = KX_BOUNDCYLINDER; - objprop.m_boundobject.c.m_radius = MT_max(bb.m_extends[0], bb.m_extends[1]); - objprop.m_boundobject.c.m_height = 2.f*bb.m_extends[2]; - break; - } - case OB_BOUND_CONE: - { - objprop.m_boundclass = KX_BOUNDCONE; - objprop.m_boundobject.c.m_radius = MT_max(bb.m_extends[0], bb.m_extends[1]); - objprop.m_boundobject.c.m_height = 2.f*bb.m_extends[2]; - break; - } - } - } - - - if (parent/* && (parent->gameflag & OB_DYNAMIC)*/) { - // parented object cannot be dynamic - KX_GameObject *parentgameobject = converter->FindGameObject(parent); - objprop.m_dynamic_parent = parentgameobject; - //cannot be dynamic: - objprop.m_dyna = false; - objprop.m_softbody = false; - shapeprops->m_mass = 0.f; - } - - - objprop.m_concave = (blenderobject->boundtype & 4) != 0; - - switch (physics_engine) - { -#ifdef USE_BULLET - case UseBullet: - KX_ConvertBulletObject(gameobj, meshobj, dm, kxscene, shapeprops, smmaterial, &objprop); - break; - -#endif - case UseDynamo: - //KX_ConvertDynamoObject(gameobj,meshobj,kxscene,shapeprops, smmaterial, &objprop); - break; - - case UseNone: - default: - break; - } - delete shapeprops; - delete smmaterial; -} - - - - - -static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int layerflag, KX_Scene *kxscene, RAS_IRenderTools *rendertools, KX_BlenderSceneConverter *converter) { - RAS_LightObject lightobj; - KX_LightObject *gamelight; - - lightobj.m_att1 = la->att1; - lightobj.m_att2 = (la->mode & LA_QUAD)?la->att2:0.0; - lightobj.m_red = la->r; - lightobj.m_green = la->g; - lightobj.m_blue = la->b; - lightobj.m_distance = la->dist; - lightobj.m_energy = la->energy; - lightobj.m_layer = layerflag; - lightobj.m_spotblend = la->spotblend; - lightobj.m_spotsize = la->spotsize; - - lightobj.m_nodiffuse = (la->mode & LA_NO_DIFF) != 0; - lightobj.m_nospecular = (la->mode & LA_NO_SPEC) != 0; - - bool glslmat = converter->GetGLSLMaterials(); - - // in GLSL NEGATIVE LAMP is handled inside the lamp update function - if(glslmat==0) { - if (la->mode & LA_NEG) - { - lightobj.m_red = -lightobj.m_red; - lightobj.m_green = -lightobj.m_green; - lightobj.m_blue = -lightobj.m_blue; - } - } - - if (la->type==LA_SUN) { - lightobj.m_type = RAS_LightObject::LIGHT_SUN; - } else if (la->type==LA_SPOT) { - lightobj.m_type = RAS_LightObject::LIGHT_SPOT; - } else { - lightobj.m_type = RAS_LightObject::LIGHT_NORMAL; - } - - gamelight = new KX_LightObject(kxscene, KX_Scene::m_callbacks, rendertools, - lightobj, glslmat); - - BL_ConvertLampIpos(la, gamelight, converter); - - return gamelight; -} - -static KX_Camera *gamecamera_from_bcamera(Object *ob, KX_Scene *kxscene, KX_BlenderSceneConverter *converter) { - Camera* ca = static_cast(ob->data); - RAS_CameraData camdata(ca->lens, ca->ortho_scale, ca->clipsta, ca->clipend, ca->type == CAM_PERSP, ca->YF_dofdist); - KX_Camera *gamecamera; - - gamecamera= new KX_Camera(kxscene, KX_Scene::m_callbacks, camdata); - gamecamera->SetName(ca->id.name + 2); - - BL_ConvertCameraIpos(ca, gamecamera, converter); - - return gamecamera; -} - -static KX_GameObject *gameobject_from_blenderobject( - Object *ob, - KX_Scene *kxscene, - RAS_IRenderTools *rendertools, - KX_BlenderSceneConverter *converter) -{ - KX_GameObject *gameobj = NULL; - - switch(ob->type) - { - case OB_LAMP: - { - KX_LightObject* gamelight= gamelight_from_blamp(ob, static_cast(ob->data), ob->lay, kxscene, rendertools, converter); - gameobj = gamelight; - - gamelight->AddRef(); - kxscene->GetLightList()->Add(gamelight); - - break; - } - - case OB_CAMERA: - { - KX_Camera* gamecamera = gamecamera_from_bcamera(ob, kxscene, converter); - gameobj = gamecamera; - - //don't add a reference: the camera list in kxscene->m_cameras is not released at the end - //gamecamera->AddRef(); - kxscene->AddCamera(gamecamera); - - break; - } - - case OB_MESH: - { - Mesh* mesh = static_cast(ob->data); - float center[3], extents[3]; - float radius = my_boundbox_mesh((Mesh*) ob->data, center, extents); - RAS_MeshObject* meshobj = BL_ConvertMesh(mesh,ob,kxscene,converter); - - // needed for python scripting - kxscene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj); - - gameobj = new BL_DeformableGameObject(ob,kxscene,KX_Scene::m_callbacks); - - // set transformation - gameobj->AddMesh(meshobj); - - // for all objects: check whether they want to - // respond to updates - bool ignoreActivityCulling = - ((ob->gameflag2 & OB_NEVER_DO_ACTIVITY_CULLING)!=0); - gameobj->SetIgnoreActivityCulling(ignoreActivityCulling); - gameobj->SetOccluder((ob->gameflag & OB_OCCLUDER) != 0, false); - - // two options exists for deform: shape keys and armature - // only support relative shape key - bool bHasShapeKey = mesh->key != NULL && mesh->key->type==KEY_RELATIVE; - bool bHasDvert = mesh->dvert != NULL && ob->defbase.first; - bool bHasArmature = (BL_ModifierDeformer::HasArmatureDeformer(ob) && ob->parent && ob->parent->type == OB_ARMATURE && bHasDvert); - bool bHasModifier = BL_ModifierDeformer::HasCompatibleDeformer(ob); - bool bHasSoftBody = (!ob->parent && (ob->gameflag & OB_SOFT_BODY)); - - if (bHasModifier) { - BL_ModifierDeformer *dcont = new BL_ModifierDeformer((BL_DeformableGameObject *)gameobj, - kxscene->GetBlenderScene(), ob, meshobj); - ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); - if (bHasShapeKey && bHasArmature) - dcont->LoadShapeDrivers(ob->parent); - } else if (bHasShapeKey) { - // not that we can have shape keys without dvert! - BL_ShapeDeformer *dcont = new BL_ShapeDeformer((BL_DeformableGameObject*)gameobj, - ob, meshobj); - ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); - if (bHasArmature) - dcont->LoadShapeDrivers(ob->parent); - } else if (bHasArmature) { - BL_SkinDeformer *dcont = new BL_SkinDeformer((BL_DeformableGameObject*)gameobj, - ob, meshobj); - ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); - } else if (bHasDvert) { - // this case correspond to a mesh that can potentially deform but not with the - // object to which it is attached for the moment. A skin mesh was created in - // BL_ConvertMesh() so must create a deformer too! - BL_MeshDeformer *dcont = new BL_MeshDeformer((BL_DeformableGameObject*)gameobj, - ob, meshobj); - ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); - } else if (bHasSoftBody) { - KX_SoftBodyDeformer *dcont = new KX_SoftBodyDeformer(meshobj, (BL_DeformableGameObject*)gameobj); - ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); - } - - MT_Point3 min = MT_Point3(center) - MT_Vector3(extents); - MT_Point3 max = MT_Point3(center) + MT_Vector3(extents); - SG_BBox bbox = SG_BBox(min, max); - gameobj->GetSGNode()->SetBBox(bbox); - gameobj->GetSGNode()->SetRadius(radius); - - break; - } - - case OB_ARMATURE: - { - gameobj = new BL_ArmatureObject( - kxscene, - KX_Scene::m_callbacks, - ob, - kxscene->GetBlenderScene() // handle - ); - /* Get the current pose from the armature object and apply it as the rest pose */ - break; - } - - case OB_EMPTY: - { - gameobj = new KX_EmptyObject(kxscene,KX_Scene::m_callbacks); - // set transformation - break; - } - } - if (gameobj) - { - gameobj->SetLayer(ob->lay); - gameobj->SetBlenderObject(ob); - /* set the visibility state based on the objects render option in the outliner */ - if(ob->restrictflag & OB_RESTRICT_RENDER) gameobj->SetVisible(0, 0); - } - return gameobj; -} - -struct parentChildLink { - struct Object* m_blenderchild; - SG_Node* m_gamechildnode; -}; - -#include "DNA_constraint_types.h" -//XXX #include "BIF_editconstraint.h" - -bPoseChannel *get_active_posechannel2 (Object *ob) -{ - bArmature *arm= (bArmature*)ob->data; - bPoseChannel *pchan; - - /* find active */ - for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= pchan->next) { - if(pchan->bone && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer)) - return pchan; - } - - return NULL; -} - -ListBase *get_active_constraints2(Object *ob) -{ - if (!ob) - return NULL; - - // XXX - shouldnt we care about the pose data and not the mode??? - if (ob->mode & OB_MODE_POSE) { - bPoseChannel *pchan; - - pchan = get_active_posechannel2(ob); - if (pchan) - return &pchan->constraints; - } - else - return &ob->constraints; - - return NULL; -} - - -void RBJconstraints(Object *ob)//not used -{ - ListBase *conlist; - bConstraint *curcon; - - conlist = get_active_constraints2(ob); - - if (conlist) { - for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) { - - printf("%i\n",curcon->type); - } - - - } -} - -#include "PHY_IPhysicsEnvironment.h" -#include "KX_IPhysicsController.h" -#include "PHY_DynamicTypes.h" - -KX_IPhysicsController* getPhId(CListValue* sumolist,STR_String busc){//not used - - for (int j=0;jGetCount();j++) - { - KX_GameObject* gameobje = (KX_GameObject*) sumolist->GetValue(j); - if (gameobje->GetName()==busc) - return gameobje->GetPhysicsController(); - } - - return 0; - -} - -KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist){ - - for (int j=0;jGetCount();j++) - { - KX_GameObject* gameobje = (KX_GameObject*) sumolist->GetValue(j); - if (gameobje->GetName()==busc) - return gameobje; - } - - return 0; - -} - -// convert blender objects into ketsji gameobjects -void BL_ConvertBlenderObjects(struct Main* maggie, - KX_Scene* kxscene, - KX_KetsjiEngine* ketsjiEngine, - e_PhysicsEngine physics_engine, - RAS_IRenderTools* rendertools, - RAS_ICanvas* canvas, - KX_BlenderSceneConverter* converter, - bool alwaysUseExpandFraming - ) -{ - - Scene *blenderscene = kxscene->GetBlenderScene(); - // for SETLOOPER - Scene *sce; - Base *base; - - // Get the frame settings of the canvas. - // Get the aspect ratio of the canvas as designed by the user. - - RAS_FrameSettings::RAS_FrameType frame_type; - int aspect_width; - int aspect_height; - vector inivel,iniang; - set grouplist; // list of groups to be converted - set allblobj; // all objects converted - set groupobj; // objects from groups (never in active layer) - - if (alwaysUseExpandFraming) { - frame_type = RAS_FrameSettings::e_frame_extend; - aspect_width = canvas->GetWidth(); - aspect_height = canvas->GetHeight(); - } else { - if (blenderscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { - frame_type = RAS_FrameSettings::e_frame_bars; - } else if (blenderscene->gm.framing.type == SCE_GAMEFRAMING_EXTEND) { - frame_type = RAS_FrameSettings::e_frame_extend; - } else { - frame_type = RAS_FrameSettings::e_frame_scale; - } - - aspect_width = blenderscene->gm.xsch; - aspect_height = blenderscene->gm.ysch; - } - - RAS_FrameSettings frame_settings( - frame_type, - blenderscene->gm.framing.col[0], - blenderscene->gm.framing.col[1], - blenderscene->gm.framing.col[2], - aspect_width, - aspect_height - ); - kxscene->SetFramingType(frame_settings); - - kxscene->SetGravity(MT_Vector3(0,0, -blenderscene->gm.gravity)); - - /* set activity culling parameters */ - kxscene->SetActivityCulling( (blenderscene->gm.mode & WO_ACTIVITY_CULLING) != 0); - kxscene->SetActivityCullingRadius(blenderscene->gm.activityBoxRadius); - kxscene->SetDbvtCulling((blenderscene->gm.mode & WO_DBVT_CULLING) != 0); - - // no occlusion culling by default - kxscene->SetDbvtOcclusionRes(0); - - int activeLayerBitInfo = blenderscene->lay; - - // list of all object converted, active and inactive - CListValue* sumolist = new CListValue(); - - vector vec_parent_child; - - CListValue* objectlist = kxscene->GetObjectList(); - CListValue* inactivelist = kxscene->GetInactiveList(); - CListValue* parentlist = kxscene->GetRootParentList(); - - SCA_LogicManager* logicmgr = kxscene->GetLogicManager(); - SCA_TimeEventManager* timemgr = kxscene->GetTimeEventManager(); - - CListValue* logicbrick_conversionlist = new CListValue(); - - //SG_TreeFactory tf; - - // Convert actions to actionmap - bAction *curAct; - for (curAct = (bAction*)maggie->action.first; curAct; curAct=(bAction*)curAct->id.next) - { - logicmgr->RegisterActionName(curAct->id.name + 2, curAct); - } - - SetDefaultFaceType(blenderscene); - // Let's support scene set. - // Beware of name conflict in linked data, it will not crash but will create confusion - // in Python scripting and in certain actuators (replace mesh). Linked scene *should* have - // no conflicting name for Object, Object data and Action. - for (SETLOOPER(blenderscene, base)) - { - Object* blenderobject = base->object; - allblobj.insert(blenderobject); - - KX_GameObject* gameobj = gameobject_from_blenderobject( - base->object, - kxscene, - rendertools, - converter); - - bool isInActiveLayer = (blenderobject->lay & activeLayerBitInfo) !=0; - bool addobj=true; - - if (converter->addInitFromFrame) - if (!isInActiveLayer) - addobj=false; - - if (gameobj&&addobj) - { - MT_Point3 posPrev; - MT_Matrix3x3 angor; - if (converter->addInitFromFrame) blenderscene->r.cfra=blenderscene->r.sfra; - - MT_Point3 pos; - pos.setValue( - blenderobject->loc[0]+blenderobject->dloc[0], - blenderobject->loc[1]+blenderobject->dloc[1], - blenderobject->loc[2]+blenderobject->dloc[2] - ); - MT_Vector3 eulxyz(blenderobject->rot); - MT_Vector3 scale(blenderobject->size); - if (converter->addInitFromFrame){//rcruiz - float eulxyzPrev[3]; - blenderscene->r.cfra=blenderscene->r.sfra-1; - //XXX update_for_newframe(); - MT_Vector3 tmp=pos-MT_Point3(blenderobject->loc[0]+blenderobject->dloc[0], - blenderobject->loc[1]+blenderobject->dloc[1], - blenderobject->loc[2]+blenderobject->dloc[2] - ); - eulxyzPrev[0]=blenderobject->rot[0]; - eulxyzPrev[1]=blenderobject->rot[1]; - eulxyzPrev[2]=blenderobject->rot[2]; - - double fps = (double) blenderscene->r.frs_sec/ - (double) blenderscene->r.frs_sec_base; - - tmp.scale(fps, fps, fps); - inivel.push_back(tmp); - tmp=eulxyz-eulxyzPrev; - tmp.scale(fps, fps, fps); - iniang.push_back(tmp); - blenderscene->r.cfra=blenderscene->r.sfra; - //XXX update_for_newframe(); - } - - gameobj->NodeSetLocalPosition(pos); - gameobj->NodeSetLocalOrientation(MT_Matrix3x3(eulxyz)); - gameobj->NodeSetLocalScale(scale); - gameobj->NodeUpdateGS(0); - - BL_ConvertIpos(blenderobject,gameobj,converter); - BL_ConvertMaterialIpos(blenderobject, gameobj, converter); - - sumolist->Add(gameobj->AddRef()); - - BL_ConvertProperties(blenderobject,gameobj,timemgr,kxscene,isInActiveLayer); - - gameobj->SetName(blenderobject->id.name + 2); - - // update children/parent hierarchy - if ((blenderobject->parent != 0)&&(!converter->addInitFromFrame)) - { - // blender has an additional 'parentinverse' offset in each object - SG_Callbacks callback(NULL,NULL,NULL,KX_Scene::KX_ScenegraphUpdateFunc,KX_Scene::KX_ScenegraphRescheduleFunc); - SG_Node* parentinversenode = new SG_Node(NULL,kxscene,callback); - - // define a normal parent relationship for this node. - KX_NormalParentRelation * parent_relation = KX_NormalParentRelation::New(); - parentinversenode->SetParentRelation(parent_relation); - - parentChildLink pclink; - pclink.m_blenderchild = blenderobject; - pclink.m_gamechildnode = parentinversenode; - vec_parent_child.push_back(pclink); - - float* fl = (float*) blenderobject->parentinv; - MT_Transform parinvtrans(fl); - parentinversenode->SetLocalPosition(parinvtrans.getOrigin()); - // problem here: the parent inverse transform combines scaling and rotation - // in the basis but the scenegraph needs separate rotation and scaling. - // This is not important for OpenGL (it uses 4x4 matrix) but it is important - // for the physic engine that needs a separate scaling - //parentinversenode->SetLocalOrientation(parinvtrans.getBasis()); - - // Extract the rotation and the scaling from the basis - MT_Matrix3x3 ori(parinvtrans.getBasis()); - MT_Vector3 x(ori.getColumn(0)); - MT_Vector3 y(ori.getColumn(1)); - MT_Vector3 z(ori.getColumn(2)); - MT_Vector3 parscale(x.length(), y.length(), z.length()); - if (!MT_fuzzyZero(parscale[0])) - x /= parscale[0]; - if (!MT_fuzzyZero(parscale[1])) - y /= parscale[1]; - if (!MT_fuzzyZero(parscale[2])) - z /= parscale[2]; - ori.setColumn(0, x); - ori.setColumn(1, y); - ori.setColumn(2, z); - parentinversenode->SetLocalOrientation(ori); - parentinversenode->SetLocalScale(parscale); - - parentinversenode->AddChild(gameobj->GetSGNode()); - } - - // needed for python scripting - logicmgr->RegisterGameObjectName(gameobj->GetName(),gameobj); - - // needed for group duplication - logicmgr->RegisterGameObj(blenderobject, gameobj); - for (int i = 0; i < gameobj->GetMeshCount(); i++) - logicmgr->RegisterGameMeshName(gameobj->GetMesh(i)->GetName(), blenderobject); - - converter->RegisterGameObject(gameobj, blenderobject); - // this was put in rapidly, needs to be looked at more closely - // only draw/use objects in active 'blender' layers - - logicbrick_conversionlist->Add(gameobj->AddRef()); - - if (converter->addInitFromFrame){ - posPrev=gameobj->NodeGetWorldPosition(); - angor=gameobj->NodeGetWorldOrientation(); - } - if (isInActiveLayer) - { - objectlist->Add(gameobj->AddRef()); - //tf.Add(gameobj->GetSGNode()); - - gameobj->NodeUpdateGS(0); - gameobj->AddMeshUser(); - - } - else - { - //we must store this object otherwise it will be deleted - //at the end of this function if it is not a root object - inactivelist->Add(gameobj->AddRef()); - } - if (gameobj->IsDupliGroup()) - grouplist.insert(blenderobject->dup_group); - if (converter->addInitFromFrame){ - gameobj->NodeSetLocalPosition(posPrev); - gameobj->NodeSetLocalOrientation(angor); - } - - } - /* Note about memory leak issues: - When a CValue derived class is created, m_refcount is initialized to 1 - so the class must be released after being used to make sure that it won't - hang in memory. If the object needs to be stored for a long time, - use AddRef() so that this Release() does not free the object. - Make sure that for any AddRef() there is a Release()!!!! - Do the same for any object derived from CValue, CExpression and NG_NetworkMessage - */ - if (gameobj) - gameobj->Release(); - - } - - if (!grouplist.empty()) - { - // now convert the group referenced by dupli group object - // keep track of all groups already converted - set allgrouplist = grouplist; - set tempglist; - // recurse - while (!grouplist.empty()) - { - set::iterator git; - tempglist.clear(); - tempglist.swap(grouplist); - for (git=tempglist.begin(); git!=tempglist.end(); git++) - { - Group* group = *git; - GroupObject* go; - for(go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) - { - Object* blenderobject = go->ob; - if (converter->FindGameObject(blenderobject) == NULL) - { - allblobj.insert(blenderobject); - groupobj.insert(blenderobject); - KX_GameObject* gameobj = gameobject_from_blenderobject( - blenderobject, - kxscene, - rendertools, - converter); - - // this code is copied from above except that - // object from groups are never in active layer - bool isInActiveLayer = false; - bool addobj=true; - - if (converter->addInitFromFrame) - if (!isInActiveLayer) - addobj=false; - - if (gameobj&&addobj) - { - MT_Point3 posPrev; - MT_Matrix3x3 angor; - if (converter->addInitFromFrame) - blenderscene->r.cfra=blenderscene->r.sfra; - - MT_Point3 pos( - blenderobject->loc[0]+blenderobject->dloc[0], - blenderobject->loc[1]+blenderobject->dloc[1], - blenderobject->loc[2]+blenderobject->dloc[2] - ); - MT_Vector3 eulxyz(blenderobject->rot); - MT_Vector3 scale(blenderobject->size); - if (converter->addInitFromFrame){//rcruiz - float eulxyzPrev[3]; - blenderscene->r.cfra=blenderscene->r.sfra-1; - //XXX update_for_newframe(); - MT_Vector3 tmp=pos-MT_Point3(blenderobject->loc[0]+blenderobject->dloc[0], - blenderobject->loc[1]+blenderobject->dloc[1], - blenderobject->loc[2]+blenderobject->dloc[2] - ); - eulxyzPrev[0]=blenderobject->rot[0]; - eulxyzPrev[1]=blenderobject->rot[1]; - eulxyzPrev[2]=blenderobject->rot[2]; - - double fps = (double) blenderscene->r.frs_sec/ - (double) blenderscene->r.frs_sec_base; - - tmp.scale(fps, fps, fps); - inivel.push_back(tmp); - tmp=eulxyz-eulxyzPrev; - tmp.scale(fps, fps, fps); - iniang.push_back(tmp); - blenderscene->r.cfra=blenderscene->r.sfra; - //XXX update_for_newframe(); - } - - gameobj->NodeSetLocalPosition(pos); - gameobj->NodeSetLocalOrientation(MT_Matrix3x3(eulxyz)); - gameobj->NodeSetLocalScale(scale); - gameobj->NodeUpdateGS(0); - - BL_ConvertIpos(blenderobject,gameobj,converter); - BL_ConvertMaterialIpos(blenderobject,gameobj, converter); - - sumolist->Add(gameobj->AddRef()); - - BL_ConvertProperties(blenderobject,gameobj,timemgr,kxscene,isInActiveLayer); - - - gameobj->SetName(blenderobject->id.name + 2); - - // update children/parent hierarchy - if ((blenderobject->parent != 0)&&(!converter->addInitFromFrame)) - { - // blender has an additional 'parentinverse' offset in each object - SG_Callbacks callback(NULL,NULL,NULL,KX_Scene::KX_ScenegraphUpdateFunc,KX_Scene::KX_ScenegraphRescheduleFunc); - SG_Node* parentinversenode = new SG_Node(NULL,kxscene,callback); - - // define a normal parent relationship for this node. - KX_NormalParentRelation * parent_relation = KX_NormalParentRelation::New(); - parentinversenode->SetParentRelation(parent_relation); - - parentChildLink pclink; - pclink.m_blenderchild = blenderobject; - pclink.m_gamechildnode = parentinversenode; - vec_parent_child.push_back(pclink); - - float* fl = (float*) blenderobject->parentinv; - MT_Transform parinvtrans(fl); - parentinversenode->SetLocalPosition(parinvtrans.getOrigin()); - - // Extract the rotation and the scaling from the basis - MT_Matrix3x3 ori(parinvtrans.getBasis()); - MT_Vector3 x(ori.getColumn(0)); - MT_Vector3 y(ori.getColumn(1)); - MT_Vector3 z(ori.getColumn(2)); - MT_Vector3 localscale(x.length(), y.length(), z.length()); - if (!MT_fuzzyZero(localscale[0])) - x /= localscale[0]; - if (!MT_fuzzyZero(localscale[1])) - y /= localscale[1]; - if (!MT_fuzzyZero(localscale[2])) - z /= localscale[2]; - ori.setColumn(0, x); - ori.setColumn(1, y); - ori.setColumn(2, z); - parentinversenode->SetLocalOrientation(ori); - parentinversenode->SetLocalScale(localscale); - - parentinversenode->AddChild(gameobj->GetSGNode()); - } - - // needed for python scripting - logicmgr->RegisterGameObjectName(gameobj->GetName(),gameobj); - - // needed for group duplication - logicmgr->RegisterGameObj(blenderobject, gameobj); - for (int i = 0; i < gameobj->GetMeshCount(); i++) - logicmgr->RegisterGameMeshName(gameobj->GetMesh(i)->GetName(), blenderobject); - - converter->RegisterGameObject(gameobj, blenderobject); - // this was put in rapidly, needs to be looked at more closely - // only draw/use objects in active 'blender' layers - - logicbrick_conversionlist->Add(gameobj->AddRef()); - - if (converter->addInitFromFrame){ - posPrev=gameobj->NodeGetWorldPosition(); - angor=gameobj->NodeGetWorldOrientation(); - } - if (isInActiveLayer) - { - objectlist->Add(gameobj->AddRef()); - //tf.Add(gameobj->GetSGNode()); - - gameobj->NodeUpdateGS(0); - gameobj->AddMeshUser(); - } - else - { - //we must store this object otherwise it will be deleted - //at the end of this function if it is not a root object - inactivelist->Add(gameobj->AddRef()); - - } - if (gameobj->IsDupliGroup()) - { - // check that the group is not already converted - if (allgrouplist.insert(blenderobject->dup_group).second) - grouplist.insert(blenderobject->dup_group); - } - if (converter->addInitFromFrame){ - gameobj->NodeSetLocalPosition(posPrev); - gameobj->NodeSetLocalOrientation(angor); - } - - } - if (gameobj) - gameobj->Release(); - } - } - } - } - } - - // non-camera objects not supported as camera currently - if (blenderscene->camera && blenderscene->camera->type == OB_CAMERA) { - KX_Camera *gamecamera= (KX_Camera*) converter->FindGameObject(blenderscene->camera); - - if(gamecamera) - kxscene->SetActiveCamera(gamecamera); - } - - // Set up armatures - set::iterator oit; - for(oit=allblobj.begin(); oit!=allblobj.end(); oit++) - { - Object* blenderobj = *oit; - if (blenderobj->type==OB_MESH) { - Mesh *me = (Mesh*)blenderobj->data; - - if (me->dvert){ - BL_DeformableGameObject *obj = (BL_DeformableGameObject*)converter->FindGameObject(blenderobj); - - if (obj && BL_ModifierDeformer::HasArmatureDeformer(blenderobj) && blenderobj->parent && blenderobj->parent->type==OB_ARMATURE){ - KX_GameObject *par = converter->FindGameObject(blenderobj->parent); - if (par && obj->GetDeformer()) - ((BL_SkinDeformer*)obj->GetDeformer())->SetArmature((BL_ArmatureObject*) par); - } - } - } - } - - // create hierarchy information - int i; - vector::iterator pcit; - - for (pcit = vec_parent_child.begin();!(pcit==vec_parent_child.end());++pcit) - { - - struct Object* blenderchild = pcit->m_blenderchild; - struct Object* blenderparent = blenderchild->parent; - KX_GameObject* parentobj = converter->FindGameObject(blenderparent); - KX_GameObject* childobj = converter->FindGameObject(blenderchild); - - assert(childobj); - - if (!parentobj || objectlist->SearchValue(childobj) != objectlist->SearchValue(parentobj)) - { - // special case: the parent and child object are not in the same layer. - // This weird situation is used in Apricot for test purposes. - // Resolve it by not converting the child - childobj->GetSGNode()->DisconnectFromParent(); - delete pcit->m_gamechildnode; - // Now destroy the child object but also all its descendent that may already be linked - // Remove the child reference in the local list! - // Note: there may be descendents already if the children of the child were processed - // by this loop before the child. In that case, we must remove the children also - CListValue* childrenlist = childobj->GetChildrenRecursive(); - childrenlist->Add(childobj->AddRef()); - for ( i=0;iGetCount();i++) - { - KX_GameObject* obj = static_cast(childrenlist->GetValue(i)); - if (sumolist->RemoveValue(obj)) - obj->Release(); - if (logicbrick_conversionlist->RemoveValue(obj)) - obj->Release(); - } - childrenlist->Release(); - - // now destroy recursively - converter->UnregisterGameObject(childobj); // removing objects during conversion make sure this runs too - kxscene->RemoveObject(childobj); - - continue; - } - - switch (blenderchild->partype) - { - case PARVERT1: - { - // creat a new vertex parent relationship for this node. - KX_VertexParentRelation * vertex_parent_relation = KX_VertexParentRelation::New(); - pcit->m_gamechildnode->SetParentRelation(vertex_parent_relation); - break; - } - case PARSLOW: - { - // creat a new slow parent relationship for this node. - KX_SlowParentRelation * slow_parent_relation = KX_SlowParentRelation::New(blenderchild->sf); - pcit->m_gamechildnode->SetParentRelation(slow_parent_relation); - break; - } - case PARBONE: - { - // parent this to a bone - Bone *parent_bone = get_named_bone( (bArmature *)(blenderchild->parent)->data, blenderchild->parsubstr); - - if(parent_bone) { - KX_BoneParentRelation *bone_parent_relation = KX_BoneParentRelation::New(parent_bone); - pcit->m_gamechildnode->SetParentRelation(bone_parent_relation); - } - - break; - } - case PARSKEL: // skinned - ignore - break; - case PAROBJECT: - case PARCURVE: - case PARKEY: - case PARVERT3: - default: - // unhandled - break; - } - - parentobj-> GetSGNode()->AddChild(pcit->m_gamechildnode); - } - vec_parent_child.clear(); - - // find 'root' parents (object that has not parents in SceneGraph) - for (i=0;iGetCount();++i) - { - KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); - if (gameobj->GetSGNode()->GetSGParent() == 0) - { - parentlist->Add(gameobj->AddRef()); - gameobj->NodeUpdateGS(0); - } - } - - // create graphic controller for culling - if (kxscene->GetDbvtCulling()) - { - bool occlusion = false; - for (i=0; iGetCount();i++) - { - KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); - if (gameobj->GetMeshCount() > 0) - { - MT_Point3 box[2]; - gameobj->GetSGNode()->BBox().getmm(box, MT_Transform::Identity()); - // box[0] is the min, box[1] is the max - bool isactive = objectlist->SearchValue(gameobj); - BL_CreateGraphicObjectNew(gameobj,box[0],box[1],kxscene,isactive,physics_engine); - if (gameobj->GetOccluder()) - occlusion = true; - } - } - if (occlusion) - kxscene->SetDbvtOcclusionRes(blenderscene->gm.occlusionRes); - } - if (blenderscene->world) - kxscene->GetPhysicsEnvironment()->setNumTimeSubSteps(blenderscene->gm.physubstep); - - // now that the scenegraph is complete, let's instantiate the deformers. - // We need that to create reusable derived mesh and physic shapes - for (i=0;iGetCount();++i) - { - KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); - if (gameobj->GetDeformer()) - gameobj->GetDeformer()->UpdateBuckets(); - } - - // Set up armature constraints - for (i=0;iGetCount();++i) - { - KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); - if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) - ((BL_ArmatureObject*)gameobj)->LoadConstraints(converter); - } - - bool processCompoundChildren = false; - - // create physics information - for (i=0;iGetCount();i++) - { - KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); - struct Object* blenderobject = gameobj->GetBlenderObject(); - int nummeshes = gameobj->GetMeshCount(); - RAS_MeshObject* meshobj = 0; - if (nummeshes > 0) - { - meshobj = gameobj->GetMesh(0); - } - int layerMask = (groupobj.find(blenderobject) == groupobj.end()) ? activeLayerBitInfo : 0; - BL_CreatePhysicsObjectNew(gameobj,blenderobject,meshobj,kxscene,layerMask,physics_engine,converter,processCompoundChildren); - } - - processCompoundChildren = true; - // create physics information - for (i=0;iGetCount();i++) - { - KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); - struct Object* blenderobject = gameobj->GetBlenderObject(); - int nummeshes = gameobj->GetMeshCount(); - RAS_MeshObject* meshobj = 0; - if (nummeshes > 0) - { - meshobj = gameobj->GetMesh(0); - } - int layerMask = (groupobj.find(blenderobject) == groupobj.end()) ? activeLayerBitInfo : 0; - BL_CreatePhysicsObjectNew(gameobj,blenderobject,meshobj,kxscene,layerMask,physics_engine,converter,processCompoundChildren); - } - - //set ini linearVel and int angularVel //rcruiz - if (converter->addInitFromFrame) - for (i=0;iGetCount();i++) - { - KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); - if (gameobj->IsDynamic()){ - gameobj->setLinearVelocity(inivel[i],false); - gameobj->setAngularVelocity(iniang[i],false); - } - - - } - - // create physics joints - for (i=0;iGetCount();i++) - { - KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); - struct Object* blenderobject = gameobj->GetBlenderObject(); - ListBase *conlist; - bConstraint *curcon; - conlist = get_active_constraints2(blenderobject); - - if (conlist) { - for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) { - if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT){ - - bRigidBodyJointConstraint *dat=(bRigidBodyJointConstraint *)curcon->data; - - if (!dat->child){ - - PHY_IPhysicsController* physctr2 = 0; - - if (dat->tar) - { - KX_GameObject *gotar=getGameOb(dat->tar->id.name+2,sumolist); - if (gotar && gotar->GetPhysicsController()) - physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData(); - } - - if (gameobj->GetPhysicsController()) - { - PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) gameobj->GetPhysicsController()->GetUserData(); - //we need to pass a full constraint frame, not just axis - - //localConstraintFrameBasis - MT_Matrix3x3 localCFrame(MT_Vector3(dat->axX,dat->axY,dat->axZ)); - MT_Vector3 axis0 = localCFrame.getColumn(0); - MT_Vector3 axis1 = localCFrame.getColumn(1); - MT_Vector3 axis2 = localCFrame.getColumn(2); - - int constraintId = kxscene->GetPhysicsEnvironment()->createConstraint(physctrl,physctr2,(PHY_ConstraintType)dat->type,(float)dat->pivX, - (float)dat->pivY,(float)dat->pivZ, - (float)axis0.x(),(float)axis0.y(),(float)axis0.z(), - (float)axis1.x(),(float)axis1.y(),(float)axis1.z(), - (float)axis2.x(),(float)axis2.y(),(float)axis2.z(),dat->flag); - if (constraintId) - { - //if it is a generic 6DOF constraint, set all the limits accordingly - if (dat->type == PHY_GENERIC_6DOF_CONSTRAINT) - { - int dof; - int dofbit=1; - for (dof=0;dof<6;dof++) - { - if (dat->flag & dofbit) - { - kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]); - } else - { - //minLimit > maxLimit means free(disabled limit) for this degree of freedom - kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,1,-1); - } - dofbit<<=1; - } - } - } - } - } - } - } - } - } - - sumolist->Release(); - - // convert world - KX_WorldInfo* worldinfo = new BlenderWorldInfo(blenderscene->world); - converter->RegisterWorldInfo(worldinfo); - kxscene->SetWorldInfo(worldinfo); - -#define CONVERT_LOGIC -#ifdef CONVERT_LOGIC - // convert logic bricks, sensors, controllers and actuators - for (i=0;iGetCount();i++) - { - KX_GameObject* gameobj = static_cast(logicbrick_conversionlist->GetValue(i)); - struct Object* blenderobj = gameobj->GetBlenderObject(); - int layerMask = (groupobj.find(blenderobj) == groupobj.end()) ? activeLayerBitInfo : 0; - bool isInActiveLayer = (blenderobj->lay & layerMask)!=0; - BL_ConvertActuators(maggie->name, blenderobj,gameobj,logicmgr,kxscene,ketsjiEngine,layerMask,isInActiveLayer,rendertools,converter); - } - for ( i=0;iGetCount();i++) - { - KX_GameObject* gameobj = static_cast(logicbrick_conversionlist->GetValue(i)); - struct Object* blenderobj = gameobj->GetBlenderObject(); - int layerMask = (groupobj.find(blenderobj) == groupobj.end()) ? activeLayerBitInfo : 0; - bool isInActiveLayer = (blenderobj->lay & layerMask)!=0; - BL_ConvertControllers(blenderobj,gameobj,logicmgr, layerMask,isInActiveLayer,converter); - } - for ( i=0;iGetCount();i++) - { - KX_GameObject* gameobj = static_cast(logicbrick_conversionlist->GetValue(i)); - struct Object* blenderobj = gameobj->GetBlenderObject(); - int layerMask = (groupobj.find(blenderobj) == groupobj.end()) ? activeLayerBitInfo : 0; - bool isInActiveLayer = (blenderobj->lay & layerMask)!=0; - BL_ConvertSensors(blenderobj,gameobj,logicmgr,kxscene,ketsjiEngine,layerMask,isInActiveLayer,canvas,converter); - // set the init state to all objects - gameobj->SetInitState((blenderobj->init_state)?blenderobj->init_state:blenderobj->state); - } - // apply the initial state to controllers, only on the active objects as this registers the sensors - for ( i=0;iGetCount();i++) - { - KX_GameObject* gameobj = static_cast(objectlist->GetValue(i)); - gameobj->ResetState(); - } - -#endif //CONVERT_LOGIC - - logicbrick_conversionlist->Release(); - - // Calculate the scene btree - - // too slow - commented out. - //kxscene->SetNodeTree(tf.MakeTree()); - - // instantiate dupli group, we will loop trough the object - // that are in active layers. Note that duplicating group - // has the effect of adding objects at the end of objectlist. - // Only loop through the first part of the list. - int objcount = objectlist->GetCount(); - for (i=0;iGetValue(i); - if (gameobj->IsDupliGroup()) - { - kxscene->DupliGroupRecurse(gameobj, 0); - } - } - - KX_Camera *activecam = kxscene->GetActiveCamera(); - MT_Scalar distance = (activecam)? activecam->GetCameraFar() - activecam->GetCameraNear(): 100.0f; - RAS_BucketManager *bucketmanager = kxscene->GetBucketManager(); - bucketmanager->OptimizeBuckets(distance); -} diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.h b/source/gameengine/Converter/BL_BlenderDataConversion.h deleted file mode 100644 index 66419dbccd1..00000000000 --- a/source/gameengine/Converter/BL_BlenderDataConversion.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __BLENDER_CONVERT -#define __BLENDER_CONVERT - -#include "GEN_HashedPtr.h" -#include "STR_String.h" -#include "KX_Python.h" -#include "KX_PhysicsEngineEnums.h" - -class RAS_MeshObject* BL_ConvertMesh(struct Mesh* mesh,struct Object* lightobj,class KX_Scene* scene, class KX_BlenderSceneConverter *converter); - -void BL_ConvertBlenderObjects(struct Main* maggie, - class KX_Scene* kxscene, - class KX_KetsjiEngine* ketsjiEngine, - e_PhysicsEngine physics_engine, - class RAS_IRenderTools* rendertools, - class RAS_ICanvas* canvas, - class KX_BlenderSceneConverter* sceneconverter, - bool alwaysUseExpandFraming - ); - -#endif // __BLENDER_CONVERT - diff --git a/source/gameengine/Converter/BL_DeformableGameObject.cpp b/source/gameengine/Converter/BL_DeformableGameObject.cpp deleted file mode 100644 index f076d52c745..00000000000 --- a/source/gameengine/Converter/BL_DeformableGameObject.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "BL_DeformableGameObject.h" -#include "BL_ShapeDeformer.h" -#include "BL_ShapeActionActuator.h" -#include "RAS_MaterialBucket.h" - - -BL_DeformableGameObject::~BL_DeformableGameObject() -{ - if (m_pDeformer) - delete m_pDeformer; // __NLA : Temporary until we decide where to put this -} - -void BL_DeformableGameObject::ProcessReplica() -{ - KX_GameObject::ProcessReplica(); - - if (m_pDeformer) - m_pDeformer= (BL_MeshDeformer*)m_pDeformer->GetReplica(); -} - -CValue* BL_DeformableGameObject::GetReplica() -{ - - BL_DeformableGameObject* replica = new BL_DeformableGameObject(*this);//m_float,GetName()); - replica->ProcessReplica(); - return replica; -} - -bool BL_DeformableGameObject::SetActiveAction(BL_ShapeActionActuator *act, short priority, double curtime) -{ - if (curtime != m_lastframe){ - m_activePriority = 9999; - m_lastframe= curtime; - m_activeAct = NULL; - } - - if (priority<=m_activePriority) - { - if (m_activeAct && (m_activeAct!=act)) - m_activeAct->SetBlendTime(0.0f); /* Reset the blend timer */ - m_activeAct = act; - m_activePriority = priority; - m_lastframe = curtime; - - return true; - } - else{ - act->SetBlendTime(0.0f); - return false; - } -} - -bool BL_DeformableGameObject::GetShape(vector &shape) -{ - shape.clear(); - if (m_pDeformer) - { - Mesh* mesh = ((BL_MeshDeformer*)m_pDeformer)->GetMesh(); - // this check is normally superfluous: a shape deformer can only be created if the mesh - // has relative keys - if (mesh && mesh->key && mesh->key->type==KEY_RELATIVE) - { - KeyBlock *kb; - for (kb = (KeyBlock*)mesh->key->block.first; kb; kb = (KeyBlock*)kb->next) - { - shape.push_back(kb->curval); - } - } - } - return !shape.empty(); -} - -void BL_DeformableGameObject::SetDeformer(class RAS_Deformer* deformer) -{ - m_pDeformer = deformer; - - SG_QList::iterator mit(m_meshSlots); - for(mit.begin(); !mit.end(); ++mit) - { - (*mit)->SetDeformer(deformer); - } -} - diff --git a/source/gameengine/Converter/BL_DeformableGameObject.h b/source/gameengine/Converter/BL_DeformableGameObject.h deleted file mode 100644 index 0696a61eb41..00000000000 --- a/source/gameengine/Converter/BL_DeformableGameObject.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BL_DEFORMABLEGAMEOBJECT -#define BL_DEFORMABLEGAMEOBJECT - -#ifdef WIN32 -#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning -#endif //WIN32 - -#include "DNA_mesh_types.h" -#include "KX_GameObject.h" -#include "BL_MeshDeformer.h" -#include - -class BL_ShapeActionActuator; -struct Key; - -class BL_DeformableGameObject : public KX_GameObject -{ -public: - CValue* GetReplica(); - - double GetLastFrame () - { - return m_lastframe; - } - Object* GetBlendObject() - { - return m_blendobj; - } - virtual void Relink(GEN_Map*map) - { - if (m_pDeformer) - m_pDeformer->Relink (map); - KX_GameObject::Relink(map); - }; - void ProcessReplica(); - - BL_DeformableGameObject(Object* blendobj, void* sgReplicationInfo, SG_Callbacks callbacks) : - KX_GameObject(sgReplicationInfo,callbacks), - m_pDeformer(NULL), - m_activeAct(NULL), - m_lastframe(0.), - m_blendobj(blendobj), - m_activePriority(9999) - { - m_isDeformable = true; - }; - virtual ~BL_DeformableGameObject(); - bool SetActiveAction(class BL_ShapeActionActuator *act, short priority, double curtime); - - bool GetShape(vector &shape); - Key* GetKey() - { - return (m_pDeformer) ? ((BL_MeshDeformer*)m_pDeformer)->GetMesh()->key : NULL; - } - - virtual void SetDeformer(class RAS_Deformer* deformer); - virtual class RAS_Deformer* GetDeformer() - { - return m_pDeformer; - } - -public: - -protected: - - RAS_Deformer *m_pDeformer; - - class BL_ShapeActionActuator *m_activeAct; - double m_lastframe; - Object* m_blendobj; - short m_activePriority; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_DeformableGameObject"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Converter/BL_MeshDeformer.cpp b/source/gameengine/Converter/BL_MeshDeformer.cpp deleted file mode 100644 index 332c6fee2cf..00000000000 --- a/source/gameengine/Converter/BL_MeshDeformer.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Simple deformation controller that restores a mesh to its rest position - */ - -#ifdef WIN32 -// This warning tells us about truncation of __long__ stl-generated names. -// It can occasionally cause DevStudio to have internal compiler warnings. -#pragma warning( disable : 4786 ) -#endif - -#include "RAS_IPolygonMaterial.h" -#include "BL_DeformableGameObject.h" -#include "BL_MeshDeformer.h" -#include "RAS_MeshObject.h" -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" - -#include "GEN_Map.h" -#include "STR_HashedString.h" -#include "BLI_math.h" - -bool BL_MeshDeformer::Apply(RAS_IPolyMaterial*) -{ - size_t i; - - // only apply once per frame if the mesh is actually modified - if(m_pMeshObject->MeshModified() && - m_lastDeformUpdate != m_gameobj->GetLastFrame()) { - // For each material - for(list::iterator mit= m_pMeshObject->GetFirstMaterial(); - mit != m_pMeshObject->GetLastMaterial(); ++ mit) { - if(!mit->m_slots[(void*)m_gameobj]) - continue; - - RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj]; - RAS_MeshSlot::iterator it; - - // for each array - for(slot->begin(it); !slot->end(it); slot->next(it)) { - // For each vertex - for(i=it.startvertex; imvert[v.getOrigIndex()].co); - } - } - } - - m_lastDeformUpdate = m_gameobj->GetLastFrame(); - - return true; - } - - return false; -} - -BL_MeshDeformer::~BL_MeshDeformer() -{ - if (m_transverts) - delete [] m_transverts; - if (m_transnors) - delete [] m_transnors; -} - -void BL_MeshDeformer::ProcessReplica() -{ - m_transverts = NULL; - m_transnors = NULL; - m_tvtot = 0; - m_bDynamic=false; - m_lastDeformUpdate = -1; -} - -void BL_MeshDeformer::Relink(GEN_Map*map) -{ - void **h_obj = (*map)[m_gameobj]; - - if (h_obj) - m_gameobj = (BL_DeformableGameObject*)(*h_obj); - else - m_gameobj = NULL; -} - -/** - * @warning This function is expensive! - */ -void BL_MeshDeformer::RecalcNormals() -{ - /* We don't normalize for performance, not doing it for faces normals - * gives area-weight normals which often look better anyway, and use - * GL_NORMALIZE so we don't have to do per vertex normalization either - * since the GPU can do it faster */ - list::iterator mit; - RAS_MeshSlot::iterator it; - size_t i; - - /* set vertex normals to zero */ - memset(m_transnors, 0, sizeof(float)*3*m_bmesh->totvert); - - /* add face normals to vertices. */ - for(mit = m_pMeshObject->GetFirstMaterial(); - mit != m_pMeshObject->GetLastMaterial(); ++ mit) { - if(!mit->m_slots[(void*)m_gameobj]) - continue; - - RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj]; - - for(slot->begin(it); !slot->end(it); slot->next(it)) { - int nvert = (int)it.array->m_type; - - for(i=0; igetOrigIndex()]; - - n1[0]= co1[0]-co3[0]; - n1[1]= co1[1]-co3[1]; - n1[2]= co1[2]-co3[2]; - - n2[0]= co2[0]-co4[0]; - n2[1]= co2[1]-co4[1]; - n2[2]= co2[2]-co4[2]; - } - else { - n1[0]= co1[0]-co2[0]; - n2[0]= co2[0]-co3[0]; - n1[1]= co1[1]-co2[1]; - - n2[1]= co2[1]-co3[1]; - n1[2]= co1[2]-co2[2]; - n2[2]= co2[2]-co3[2]; - } - - fnor[0]= n1[1]*n2[2] - n1[2]*n2[1]; - fnor[1]= n1[2]*n2[0] - n1[0]*n2[2]; - fnor[2]= n1[0]*n2[1] - n1[1]*n2[0]; - normalize_v3(fnor); - - /* add to vertices for smooth normals */ - float *vn1 = m_transnors[v1.getOrigIndex()]; - float *vn2 = m_transnors[v2.getOrigIndex()]; - float *vn3 = m_transnors[v3.getOrigIndex()]; - - vn1[0] += fnor[0]; vn1[1] += fnor[1]; vn1[2] += fnor[2]; - vn2[0] += fnor[0]; vn2[1] += fnor[1]; vn2[2] += fnor[2]; - vn3[0] += fnor[0]; vn3[1] += fnor[1]; vn3[2] += fnor[2]; - - if(v4) { - float *vn4 = m_transnors[v4->getOrigIndex()]; - vn4[0] += fnor[0]; vn4[1] += fnor[1]; vn4[2] += fnor[2]; - } - - /* in case of flat - just assign, the vertices are split */ - if(v1.getFlag() & RAS_TexVert::FLAT) { - v1.SetNormal(fnor); - v2.SetNormal(fnor); - v3.SetNormal(fnor); - if(v4) - v4->SetNormal(fnor); - } - } - } - } - - /* assign smooth vertex normals */ - for(mit = m_pMeshObject->GetFirstMaterial(); - mit != m_pMeshObject->GetLastMaterial(); ++ mit) { - if(!mit->m_slots[(void*)m_gameobj]) - continue; - - RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj]; - - for(slot->begin(it); !slot->end(it); slot->next(it)) { - for(i=it.startvertex; itotvert){ - if (m_transverts) - delete [] m_transverts; - if (m_transnors) - delete [] m_transnors; - - m_transverts=new float[m_bmesh->totvert][3]; - m_transnors=new float[m_bmesh->totvert][3]; - m_tvtot = m_bmesh->totvert; - } -} - diff --git a/source/gameengine/Converter/BL_MeshDeformer.h b/source/gameengine/Converter/BL_MeshDeformer.h deleted file mode 100644 index c8f58dc7b17..00000000000 --- a/source/gameengine/Converter/BL_MeshDeformer.h +++ /dev/null @@ -1,98 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BL_MESHDEFORMER -#define BL_MESHDEFORMER - -#include "RAS_Deformer.h" -#include "DNA_object_types.h" -#include "DNA_key_types.h" -#include "MT_Point3.h" -#include - -#ifdef WIN32 -#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning -#endif //WIN32 - -class BL_DeformableGameObject; - -class BL_MeshDeformer : public RAS_Deformer -{ -public: - void VerifyStorage(); - void RecalcNormals(); - virtual void Relink(GEN_Map*map); - BL_MeshDeformer(BL_DeformableGameObject *gameobj, - struct Object* obj, - class RAS_MeshObject *meshobj ): - m_pMeshObject(meshobj), - m_bmesh((struct Mesh*)(obj->data)), - m_transverts(0), - m_transnors(0), - m_objMesh(obj), - m_tvtot(0), - m_gameobj(gameobj), - m_lastDeformUpdate(-1) - {}; - virtual ~BL_MeshDeformer(); - virtual void SetSimulatedTime(double time){}; - virtual bool Apply(class RAS_IPolyMaterial *mat); - virtual bool Update(void){ return false; }; - virtual bool UpdateBuckets(void){ return false; }; - virtual RAS_Deformer* GetReplica(){return NULL;}; - virtual void ProcessReplica(); - struct Mesh* GetMesh() { return m_bmesh; }; - virtual class RAS_MeshObject* GetRasMesh() { return (RAS_MeshObject*)m_pMeshObject; }; - virtual float (* GetTransVerts(int *tot))[3] { *tot= m_tvtot; return m_transverts; } - // virtual void InitDeform(double time){}; - -protected: - class RAS_MeshObject* m_pMeshObject; - struct Mesh* m_bmesh; - - // this is so m_transverts doesn't need to be converted - // before deformation - float (*m_transverts)[3]; - float (*m_transnors)[3]; - struct Object* m_objMesh; - // -- - int m_tvtot; - BL_DeformableGameObject* m_gameobj; - double m_lastDeformUpdate; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_MeshDeformer"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp deleted file mode 100644 index 5ccf8de29b1..00000000000 --- a/source/gameengine/Converter/BL_ModifierDeformer.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif //WIN32 - -#include "MEM_guardedalloc.h" -#include "BL_ModifierDeformer.h" -#include "GEN_Map.h" -#include "STR_HashedString.h" -#include "RAS_IPolygonMaterial.h" -#include "RAS_MeshObject.h" -#include "PHY_IGraphicController.h" - -//#include "BL_ArmatureController.h" -#include "DNA_armature_types.h" -#include "DNA_action_types.h" -#include "DNA_key_types.h" -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_ipo_types.h" -#include "DNA_curve_types.h" -#include "DNA_modifier_types.h" -#include "DNA_scene_types.h" -#include "BKE_armature.h" -#include "BKE_action.h" -#include "BKE_key.h" -#include "BKE_ipo.h" -#include "MT_Point3.h" - -extern "C"{ - #include "BKE_customdata.h" - #include "BKE_DerivedMesh.h" - #include "BKE_lattice.h" - #include "BKE_modifier.h" -} - #include "BKE_utildefines.h" - -#include "BLI_blenlib.h" -#include "BLI_math.h" - -#define __NLA_DEFNORMALS -//#undef __NLA_DEFNORMALS - - -BL_ModifierDeformer::~BL_ModifierDeformer() -{ - if (m_dm) { - // deformedOnly is used as a user counter - if (--m_dm->deformedOnly == 0) { - m_dm->needsFree = 1; - m_dm->release(m_dm); - } - } -}; - -RAS_Deformer *BL_ModifierDeformer::GetReplica() -{ - BL_ModifierDeformer *result; - - result = new BL_ModifierDeformer(*this); - result->ProcessReplica(); - return result; -} - -void BL_ModifierDeformer::ProcessReplica() -{ - /* Note! - This is not inherited from PyObjectPlus */ - BL_ShapeDeformer::ProcessReplica(); - if (m_dm) - // by default try to reuse mesh, deformedOnly is used as a user count - m_dm->deformedOnly++; - // this will force an update and if the mesh cannot be reused, a new one will be created - m_lastModifierUpdate = -1; -} - -bool BL_ModifierDeformer::HasCompatibleDeformer(Object *ob) -{ - if (!ob->modifiers.first) - return false; - // soft body cannot use mesh modifiers - if ((ob->gameflag & OB_SOFT_BODY) != 0) - return false; - ModifierData* md; - for (md = (ModifierData*)ob->modifiers.first; md; md = (ModifierData*)md->next) { - if (modifier_dependsOnTime(md)) - continue; - if (!(md->mode & eModifierMode_Realtime)) - continue; - /* armature modifier are handled by SkinDeformer, not ModifierDeformer */ - if (md->type == eModifierType_Armature ) - continue; - return true; - } - return false; -} - -bool BL_ModifierDeformer::HasArmatureDeformer(Object *ob) -{ - if (!ob->modifiers.first) - return false; - - ModifierData* md; - for (md = (ModifierData*)ob->modifiers.first; md; md = (ModifierData*)md->next) { - if (md->type == eModifierType_Armature ) - return true; - } - return false; -} - -bool BL_ModifierDeformer::Update(void) -{ - bool bShapeUpdate = BL_ShapeDeformer::Update(); - - if (bShapeUpdate || m_lastModifierUpdate != m_gameobj->GetLastFrame()) { - // static derived mesh are not updated - if (m_dm == NULL || m_bDynamic) { - /* execute the modifiers */ - Object* blendobj = m_gameobj->GetBlendObject(); - /* hack: the modifiers require that the mesh is attached to the object - It may not be the case here because of replace mesh actuator */ - Mesh *oldmesh = (Mesh*)blendobj->data; - blendobj->data = m_bmesh; - /* execute the modifiers */ - DerivedMesh *dm = mesh_create_derived_no_virtual(m_scene, blendobj, m_transverts, CD_MASK_MESH); - /* restore object data */ - blendobj->data = oldmesh; - /* free the current derived mesh and replace, (dm should never be NULL) */ - if (m_dm != NULL) { - // HACK! use deformedOnly as a user counter - if (--m_dm->deformedOnly == 0) { - m_dm->needsFree = 1; - m_dm->release(m_dm); - } - } - m_dm = dm; - // get rid of temporary data - m_dm->needsFree = 0; - m_dm->release(m_dm); - // HACK! use deformedOnly as a user counter - m_dm->deformedOnly = 1; - /* update the graphic controller */ - PHY_IGraphicController *ctrl = m_gameobj->GetGraphicController(); - if (ctrl) { - float min_r[3], max_r[3]; - INIT_MINMAX(min_r, max_r); - m_dm->getMinMax(m_dm, min_r, max_r); - ctrl->setLocalAabb(min_r, max_r); - } - } - m_lastModifierUpdate=m_gameobj->GetLastFrame(); - bShapeUpdate = true; - } - return bShapeUpdate; -} - -bool BL_ModifierDeformer::Apply(RAS_IPolyMaterial *mat) -{ - if (!Update()) - return false; - - // drawing is based on derived mesh, must set it in the mesh slots - int nmat = m_pMeshObject->NumMaterials(); - for (int imat=0; imatGetMeshMaterial(imat); - RAS_MeshSlot **slot = mmat->m_slots[(void*)m_gameobj]; - if(!slot || !*slot) - continue; - (*slot)->m_pDerivedMesh = m_dm; - } - return true; -} diff --git a/source/gameengine/Converter/BL_ModifierDeformer.h b/source/gameengine/Converter/BL_ModifierDeformer.h deleted file mode 100644 index adf537110f1..00000000000 --- a/source/gameengine/Converter/BL_ModifierDeformer.h +++ /dev/null @@ -1,114 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BL_MODIFIERDEFORMER -#define BL_MODIFIERDEFORMER - -#ifdef WIN32 -#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning -#endif //WIN32 - -#include "BL_ShapeDeformer.h" -#include "BL_DeformableGameObject.h" -#include - -struct DerivedMesh; -struct Object; - -class BL_ModifierDeformer : public BL_ShapeDeformer -{ -public: - static bool HasCompatibleDeformer(Object *ob); - static bool HasArmatureDeformer(Object *ob); - - - BL_ModifierDeformer(BL_DeformableGameObject *gameobj, - Scene *scene, - Object *bmeshobj, - RAS_MeshObject *mesh) - : - BL_ShapeDeformer(gameobj,bmeshobj, mesh), - m_lastModifierUpdate(-1), - m_scene(scene), - m_dm(NULL) - { - m_recalcNormal = false; - }; - - /* this second constructor is needed for making a mesh deformable on the fly. */ - BL_ModifierDeformer(BL_DeformableGameObject *gameobj, - struct Scene *scene, - struct Object *bmeshobj_old, - struct Object *bmeshobj_new, - class RAS_MeshObject *mesh, - bool release_object, - BL_ArmatureObject* arma = NULL) - : - BL_ShapeDeformer(gameobj, bmeshobj_old, bmeshobj_new, mesh, release_object, false, arma), - m_lastModifierUpdate(-1), - m_scene(scene), - m_dm(NULL) - { - }; - - virtual void ProcessReplica(); - virtual RAS_Deformer *GetReplica(); - virtual ~BL_ModifierDeformer(); - virtual bool UseVertexArray() - { - return false; - } - - bool Update (void); - bool Apply(RAS_IPolyMaterial *mat); - void ForceUpdate() - { - m_lastModifierUpdate = -1.0; - }; - virtual struct DerivedMesh* GetFinalMesh() - { - return m_dm; - } - - -protected: - double m_lastModifierUpdate; - Scene *m_scene; - DerivedMesh *m_dm; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_ModifierDeformer"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp deleted file mode 100644 index 08d3e54a7c5..00000000000 --- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp +++ /dev/null @@ -1,494 +0,0 @@ -/** -* $Id$ -* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** -*/ - -#if defined (__sgi) -#include -#else -#include -#endif - -#include "SCA_LogicManager.h" -#include "BL_ShapeActionActuator.h" -#include "BL_ShapeDeformer.h" -#include "KX_GameObject.h" -#include "STR_HashedString.h" -#include "DNA_nla_types.h" -#include "DNA_action_types.h" -#include "DNA_anim_types.h" -#include "DNA_scene_types.h" -#include "BKE_action.h" -#include "DNA_armature_types.h" -#include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" -#include "BLI_math.h" -#include "MT_Matrix4x4.h" -#include "BKE_utildefines.h" -#include "FloatValue.h" -#include "PyObjectPlus.h" - -extern "C" { - #include "BKE_animsys.h" -} - -BL_ShapeActionActuator::~BL_ShapeActionActuator() -{ -} - -void BL_ShapeActionActuator::ProcessReplica() -{ - SCA_IActuator::ProcessReplica(); - m_localtime=m_startframe; - m_lastUpdate=-1; -} - -void BL_ShapeActionActuator::SetBlendTime (float newtime) -{ - m_blendframe = newtime; -} - -CValue* BL_ShapeActionActuator::GetReplica() -{ - BL_ShapeActionActuator* replica = new BL_ShapeActionActuator(*this);//m_float,GetName()); - replica->ProcessReplica(); - return replica; -} - -bool BL_ShapeActionActuator::ClampLocalTime() -{ - if (m_startframe < m_endframe) { - if (m_localtime < m_startframe) - { - m_localtime = m_startframe; - return true; - } - else if (m_localtime > m_endframe) - { - m_localtime = m_endframe; - return true; - } - } else { - if (m_localtime > m_startframe) - { - m_localtime = m_startframe; - return true; - } - else if (m_localtime < m_endframe) - { - m_localtime = m_endframe; - return true; - } - } - return false; -} - -void BL_ShapeActionActuator::SetStartTime(float curtime) -{ - float direction = m_startframe < m_endframe ? 1.0 : -1.0; - - if (!(m_flag & ACT_FLAG_REVERSE)) - m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate(); - else - m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate(); -} - -void BL_ShapeActionActuator::SetLocalTime(float curtime) -{ - float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate(); - - if (m_endframe < m_startframe) - delta_time = -delta_time; - - if (!(m_flag & ACT_FLAG_REVERSE)) - m_localtime = m_startframe + delta_time; - else - m_localtime = m_endframe - delta_time; -} - -void BL_ShapeActionActuator::BlendShape(Key* key, float srcweight) -{ - vector::const_iterator it; - float dstweight; - KeyBlock *kb; - - dstweight = 1.0F - srcweight; - - for (it=m_blendshape.begin(), kb = (KeyBlock*)key->block.first; - kb && it != m_blendshape.end(); - kb = (KeyBlock*)kb->next, it++) { - kb->curval = kb->curval * dstweight + (*it) * srcweight; - } -} - -bool BL_ShapeActionActuator::Update(double curtime, bool frame) -{ - bool bNegativeEvent = false; - bool bPositiveEvent = false; - bool keepgoing = true; - bool wrap = false; - bool apply=true; - int priority; - float newweight; - - curtime -= KX_KetsjiEngine::GetSuspendedDelta(); - - // result = true if animation has to be continued, false if animation stops - // maybe there are events for us in the queue ! - if (frame) - { - bNegativeEvent = m_negevent; - bPositiveEvent = m_posevent; - RemoveAllEvents(); - - if (bPositiveEvent) - m_flag |= ACT_FLAG_ACTIVE; - - if (bNegativeEvent) - { - if (!(m_flag & ACT_FLAG_ACTIVE)) - return false; - m_flag &= ~ACT_FLAG_ACTIVE; - } - } - - /* This action can only be attached to a deform object */ - BL_DeformableGameObject *obj = (BL_DeformableGameObject*)GetParent(); - float length = m_endframe - m_startframe; - - priority = m_priority; - - /* Determine pre-incrementation behaviour and set appropriate flags */ - switch (m_playtype){ - case ACT_ACTION_MOTION: - if (bNegativeEvent){ - keepgoing=false; - apply=false; - }; - break; - case ACT_ACTION_FROM_PROP: - if (bNegativeEvent){ - apply=false; - keepgoing=false; - } - break; - case ACT_ACTION_LOOP_END: - if (bPositiveEvent){ - if (!(m_flag & ACT_FLAG_LOCKINPUT)){ - m_flag &= ~ACT_FLAG_KEYUP; - m_flag &= ~ACT_FLAG_REVERSE; - m_flag |= ACT_FLAG_LOCKINPUT; - m_localtime = m_startframe; - m_starttime = curtime; - } - } - if (bNegativeEvent){ - m_flag |= ACT_FLAG_KEYUP; - } - break; - case ACT_ACTION_LOOP_STOP: - if (bPositiveEvent){ - if (!(m_flag & ACT_FLAG_LOCKINPUT)){ - m_flag &= ~ACT_FLAG_REVERSE; - m_flag &= ~ACT_FLAG_KEYUP; - m_flag |= ACT_FLAG_LOCKINPUT; - SetStartTime(curtime); - } - } - if (bNegativeEvent){ - m_flag |= ACT_FLAG_KEYUP; - m_flag &= ~ACT_FLAG_LOCKINPUT; - keepgoing=false; - apply=false; - } - break; - case ACT_ACTION_FLIPPER: - if (bPositiveEvent){ - if (!(m_flag & ACT_FLAG_LOCKINPUT)){ - m_flag &= ~ACT_FLAG_REVERSE; - m_flag |= ACT_FLAG_LOCKINPUT; - SetStartTime(curtime); - } - } - else if (bNegativeEvent){ - m_flag |= ACT_FLAG_REVERSE; - m_flag &= ~ACT_FLAG_LOCKINPUT; - SetStartTime(curtime); - } - break; - case ACT_ACTION_PLAY: - if (bPositiveEvent){ - if (!(m_flag & ACT_FLAG_LOCKINPUT)){ - m_flag &= ~ACT_FLAG_REVERSE; - m_localtime = m_starttime; - m_starttime = curtime; - m_flag |= ACT_FLAG_LOCKINPUT; - } - } - break; - default: - break; - } - - /* Perform increment */ - if (keepgoing){ - if (m_playtype == ACT_ACTION_MOTION){ - MT_Point3 newpos; - MT_Point3 deltapos; - - newpos = obj->NodeGetWorldPosition(); - - /* Find displacement */ - deltapos = newpos-m_lastpos; - m_localtime += (length/m_stridelength) * deltapos.length(); - m_lastpos = newpos; - } - else{ - SetLocalTime(curtime); - } - } - - /* Check if a wrapping response is needed */ - if (length){ - if (m_localtime < m_startframe || m_localtime > m_endframe) - { - m_localtime = m_startframe + fmod(m_localtime, length); - wrap = true; - } - } - else - m_localtime = m_startframe; - - /* Perform post-increment tasks */ - switch (m_playtype){ - case ACT_ACTION_FROM_PROP: - { - CValue* propval = GetParent()->GetProperty(m_propname); - if (propval) - m_localtime = propval->GetNumber(); - - if (bNegativeEvent){ - keepgoing=false; - } - } - break; - case ACT_ACTION_MOTION: - break; - case ACT_ACTION_LOOP_STOP: - break; - case ACT_ACTION_FLIPPER: - if (wrap){ - if (!(m_flag & ACT_FLAG_REVERSE)){ - m_localtime=m_endframe; - //keepgoing = false; - } - else { - m_localtime=m_startframe; - keepgoing = false; - } - } - break; - case ACT_ACTION_LOOP_END: - if (wrap){ - if (m_flag & ACT_FLAG_KEYUP){ - keepgoing = false; - m_localtime = m_endframe; - m_flag &= ~ACT_FLAG_LOCKINPUT; - } - SetStartTime(curtime); - } - break; - case ACT_ACTION_PLAY: - if (wrap){ - m_localtime = m_endframe; - keepgoing = false; - m_flag &= ~ACT_FLAG_LOCKINPUT; - } - break; - default: - keepgoing = false; - break; - } - - /* Set the property if its defined */ - if (m_framepropname[0] != '\0') { - CValue* propowner = GetParent(); - CValue* oldprop = propowner->GetProperty(m_framepropname); - CValue* newval = new CFloatValue(m_localtime); - if (oldprop) { - oldprop->SetValue(newval); - } else { - propowner->SetProperty(m_framepropname, newval); - } - newval->Release(); - } - - if (bNegativeEvent) - m_blendframe=0.0f; - - /* Apply the pose if necessary*/ - if (apply) { - - /* Priority test */ - if (obj->SetActiveAction(this, priority, curtime)){ - Key *key = obj->GetKey(); - - if (!key) { - // this could happen if the mesh was changed in the middle of an action - // and the new mesh has no key, stop the action - keepgoing = false; - } - else { - ListBase tchanbase= {NULL, NULL}; - - if (m_blendin && m_blendframe==0.0f){ - // this is the start of the blending, remember the startup shape - obj->GetShape(m_blendshape); - m_blendstart = curtime; - } - // only interested in shape channel - - // in 2.4x was // extract_ipochannels_from_action(&tchanbase, &key->id, m_action, "Shape", m_localtime); - BKE_animsys_evaluate_animdata(&key->id, key->adt, m_localtime, ADT_RECALC_ANIM); - - // XXX - in 2.5 theres no way to do this. possibly not that important to support - Campbell - if (0) { // XXX !execute_ipochannels(&tchanbase)) { - // no update, this is possible if action does not match the keys, stop the action - keepgoing = false; - } - else { - // the key have changed, apply blending if needed - if (m_blendin && (m_blendframem_blendin) - m_blendframe = m_blendin; - } - m_lastUpdate = m_localtime; - } - BLI_freelistN(&tchanbase); - } - } - else{ - m_blendframe = 0.0f; - } - } - - if (!keepgoing){ - m_blendframe = 0.0f; - } - return keepgoing; -}; - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ - -PyTypeObject BL_ShapeActionActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BL_ShapeActionActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - - -PyMethodDef BL_ShapeActionActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef BL_ShapeActionActuator::Attributes[] = { - KX_PYATTRIBUTE_FLOAT_RW("frameStart", 0, MAXFRAMEF, BL_ShapeActionActuator, m_startframe), - KX_PYATTRIBUTE_FLOAT_RW("frameEnd", 0, MAXFRAMEF, BL_ShapeActionActuator, m_endframe), - KX_PYATTRIBUTE_FLOAT_RW("blendIn", 0, MAXFRAMEF, BL_ShapeActionActuator, m_blendin), - KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ShapeActionActuator, pyattr_get_action, pyattr_set_action), - KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ShapeActionActuator, m_priority), - KX_PYATTRIBUTE_FLOAT_RW_CHECK("frame", 0, MAXFRAMEF, BL_ShapeActionActuator, m_localtime, CheckFrame), - KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ShapeActionActuator, m_propname), - KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 31, false, BL_ShapeActionActuator, m_framepropname), - KX_PYATTRIBUTE_FLOAT_RW_CHECK("blendTime", 0, MAXFRAMEF, BL_ShapeActionActuator, m_blendframe, CheckBlendTime), - KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",0,100,false,BL_ShapeActionActuator,m_playtype,CheckType), - { NULL } //Sentinel -}; - -PyObject* BL_ShapeActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - BL_ShapeActionActuator* self= static_cast(self_v); - return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : ""); -} - -int BL_ShapeActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - BL_ShapeActionActuator* self= static_cast(self_v); - /* exact copy of BL_ActionActuator's function from here down */ - if (!PyUnicode_Check(value)) - { - PyErr_SetString(PyExc_ValueError, "actuator.action = val: Shape Action Actuator, expected the string name of the action"); - return PY_SET_ATTR_FAIL; - } - - bAction *action= NULL; - STR_String val = _PyUnicode_AsString(value); - - if (val != "") - { - action= (bAction*)SCA_ILogicBrick::m_sCurrentLogicManager->GetActionByName(val); - if (action==NULL) - { - PyErr_SetString(PyExc_ValueError, "actuator.action = val: Shape Action Actuator, action not found!"); - return PY_SET_ATTR_FAIL; - } - } - - self->SetAction(action); - return PY_SET_ATTR_SUCCESS; - -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.h b/source/gameengine/Converter/BL_ShapeActionActuator.h deleted file mode 100644 index 64cd21e5544..00000000000 --- a/source/gameengine/Converter/BL_ShapeActionActuator.h +++ /dev/null @@ -1,161 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BL_SHAPEACTIONACTUATOR -#define BL_SHAPEACTIONACTUATOR - -#include "GEN_HashedPtr.h" -#include "SCA_IActuator.h" -#include "BL_ActionActuator.h" -#include "MT_Point3.h" -#include - -struct Key; -class BL_ShapeActionActuator : public SCA_IActuator -{ -public: - Py_Header; - BL_ShapeActionActuator(SCA_IObject* gameobj, - const STR_String& propname, - const STR_String& framepropname, - float starttime, - float endtime, - struct bAction *action, - short playtype, - short blendin, - short priority, - float stride) - : SCA_IActuator(gameobj, KX_ACT_SHAPEACTION), - - m_lastpos(0, 0, 0), - m_blendframe(0), - m_flag(0), - m_startframe (starttime), - m_endframe(endtime) , - m_starttime(0), - m_localtime(starttime), - m_lastUpdate(-1), - m_blendin(blendin), - m_blendstart(0), - m_stridelength(stride), - m_playtype(playtype), - m_priority(priority), - m_action(action), - m_framepropname(framepropname), - m_propname(propname) - { - }; - virtual ~BL_ShapeActionActuator(); - virtual bool Update(double curtime, bool frame); - virtual CValue* GetReplica(); - virtual void ProcessReplica(); - - void SetBlendTime (float newtime); - void BlendShape(struct Key* key, float weigth); - - bAction* GetAction() { return m_action; } - void SetAction(bAction* act) { m_action= act; } - -#ifndef DISABLE_PYTHON - - static PyObject* pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - static int CheckBlendTime(void *self, const PyAttributeDef*) - { - BL_ShapeActionActuator* act = reinterpret_cast(self); - - if (act->m_blendframe > act->m_blendin) - act->m_blendframe = act->m_blendin; - - return 0; - } - static int CheckFrame(void *self, const PyAttributeDef*) - { - BL_ShapeActionActuator* act = reinterpret_cast(self); - - if (act->m_localtime < act->m_startframe) - act->m_localtime = act->m_startframe; - else if (act->m_localtime > act->m_endframe) - act->m_localtime = act->m_endframe; - - return 0; - } - static int CheckType(void *self, const PyAttributeDef*) - { - BL_ShapeActionActuator* act = reinterpret_cast(self); - - switch (act->m_playtype) { - case ACT_ACTION_PLAY: - case ACT_ACTION_FLIPPER: - case ACT_ACTION_LOOP_STOP: - case ACT_ACTION_LOOP_END: - case ACT_ACTION_FROM_PROP: - return 0; - default: - PyErr_SetString(PyExc_ValueError, "Shape Action Actuator, invalid play type supplied"); - return 1; - } - - } - -#endif // DISABLE_PYTHON - -protected: - - void SetStartTime(float curtime); - void SetLocalTime(float curtime); - bool ClampLocalTime(); - - MT_Point3 m_lastpos; - float m_blendframe; - int m_flag; - /** The frame this action starts */ - float m_startframe; - /** The frame this action ends */ - float m_endframe; - /** The time this action started */ - float m_starttime; - /** The current time of the action */ - float m_localtime; - - float m_lastUpdate; - float m_blendin; - float m_blendstart; - float m_stridelength; - short m_playtype; - short m_priority; - struct bAction *m_action; - STR_String m_framepropname; - STR_String m_propname; - vector m_blendshape; -}; - -#endif - diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp deleted file mode 100644 index 1a90001adca..00000000000 --- a/source/gameengine/Converter/BL_ShapeDeformer.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif //WIN32 - -#include "MEM_guardedalloc.h" -#include "BL_ShapeDeformer.h" -#include "GEN_Map.h" -#include "STR_HashedString.h" -#include "RAS_IPolygonMaterial.h" -#include "RAS_MeshObject.h" - -//#include "BL_ArmatureController.h" -#include "DNA_armature_types.h" -#include "DNA_action_types.h" -#include "DNA_key_types.h" -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_ipo_types.h" -#include "DNA_curve_types.h" -#include "BKE_armature.h" -#include "BKE_action.h" -#include "BKE_key.h" -#include "BKE_ipo.h" -#include "MT_Point3.h" - -extern "C"{ - #include "BKE_lattice.h" -} - #include "BKE_utildefines.h" - -#include "BLI_blenlib.h" -#include "BLI_math.h" - -#define __NLA_DEFNORMALS -//#undef __NLA_DEFNORMALS - - -BL_ShapeDeformer::~BL_ShapeDeformer() -{ -}; - -RAS_Deformer *BL_ShapeDeformer::GetReplica() -{ - BL_ShapeDeformer *result; - - result = new BL_ShapeDeformer(*this); - result->ProcessReplica(); - return result; -} - -void BL_ShapeDeformer::ProcessReplica() -{ - BL_SkinDeformer::ProcessReplica(); - m_lastShapeUpdate = -1; -} - -bool BL_ShapeDeformer::LoadShapeDrivers(Object* arma) -{ - IpoCurve *icu; - - m_shapeDrivers.clear(); - // check if this mesh has armature driven shape keys - if (m_bmesh->key && m_bmesh->key->ipo) { - for(icu= (IpoCurve*)m_bmesh->key->ipo->curve.first; icu; icu= (IpoCurve*)icu->next) { - if(icu->driver && - (icu->flag & IPO_MUTE) == 0 && - icu->driver->type == IPO_DRIVER_TYPE_NORMAL && - icu->driver->ob == arma && - icu->driver->blocktype == ID_AR) { - // this shape key ipo curve has a driver on the parent armature - // record this curve in the shape deformer so that the corresponding - m_shapeDrivers.push_back(icu); - } - } - } - return !m_shapeDrivers.empty(); -} - -bool BL_ShapeDeformer::ExecuteShapeDrivers(void) -{ - if (!m_shapeDrivers.empty() && PoseUpdated()) { - vector::iterator it; -// void *poin; -// int type; - - // the shape drivers use the bone matrix as input. Must - // update the matrix now - m_armobj->ApplyPose(); - - for (it=m_shapeDrivers.begin(); it!=m_shapeDrivers.end(); it++) { - // no need to set a specific time: this curve has a driver - // XXX IpoCurve *icu = *it; - //calc_icu(icu, 1.0f); - //poin = get_ipo_poin((ID*)m_bmesh->key, icu, &type); - //if (poin) - // write_ipo_poin(poin, type, icu->curval); - } - - ForceUpdate(); - m_armobj->RestorePose(); - m_bDynamic = true; - return true; - } - return false; -} - -bool BL_ShapeDeformer::Update(void) -{ - bool bShapeUpdate = false; - bool bSkinUpdate = false; - - ExecuteShapeDrivers(); - - /* See if the object shape has changed */ - if (m_lastShapeUpdate != m_gameobj->GetLastFrame()) { - /* the key coefficient have been set already, we just need to blend the keys */ - Object* blendobj = m_gameobj->GetBlendObject(); - - // make sure the vertex weight cache is in line with this object - m_pMeshObject->CheckWeightCache(blendobj); - - /* we will blend the key directly in m_transverts array: it is used by armature as the start position */ - /* m_bmesh->key can be NULL in case of Modifier deformer */ - if (m_bmesh->key) { - /* store verts locally */ - VerifyStorage(); - - do_rel_key(0, m_bmesh->totvert, m_bmesh->totvert, (char *)(float *)m_transverts, m_bmesh->key, NULL, 0); - m_bDynamic = true; - } - - // Don't release the weight array as in Blender, it will most likely be reusable on next frame - // The weight array are ultimately deleted when the skin mesh is destroyed - - /* Update the current frame */ - m_lastShapeUpdate=m_gameobj->GetLastFrame(); - - // As we have changed, the mesh, the skin deformer must update as well. - // This will force the update - BL_SkinDeformer::ForceUpdate(); - bShapeUpdate = true; - } - // check for armature deform - bSkinUpdate = BL_SkinDeformer::UpdateInternal(bShapeUpdate && m_bDynamic); - - // non dynamic deformer = Modifer without armature and shape keys, no need to create storage - if (!bSkinUpdate && bShapeUpdate && m_bDynamic) { - // this means that there is no armature, we still need to - // update the normal (was not done after shape key calculation) - -#ifdef __NLA_DEFNORMALS - if (m_recalcNormal) - RecalcNormals(); -#endif - bSkinUpdate = true; - } - return bSkinUpdate; -} diff --git a/source/gameengine/Converter/BL_ShapeDeformer.h b/source/gameengine/Converter/BL_ShapeDeformer.h deleted file mode 100644 index 0ae349642c4..00000000000 --- a/source/gameengine/Converter/BL_ShapeDeformer.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BL_SHAPEDEFORMER -#define BL_SHAPEDEFORMER - -#ifdef WIN32 -#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning -#endif //WIN32 - -#include "BL_SkinDeformer.h" -#include "BL_DeformableGameObject.h" -#include - -struct IpoCurve; - -class BL_ShapeDeformer : public BL_SkinDeformer -{ -public: - BL_ShapeDeformer(BL_DeformableGameObject *gameobj, - Object *bmeshobj, - RAS_MeshObject *mesh) - : - BL_SkinDeformer(gameobj,bmeshobj, mesh), - m_lastShapeUpdate(-1) - { - }; - - /* this second constructor is needed for making a mesh deformable on the fly. */ - BL_ShapeDeformer(BL_DeformableGameObject *gameobj, - struct Object *bmeshobj_old, - struct Object *bmeshobj_new, - class RAS_MeshObject *mesh, - bool release_object, - bool recalc_normal, - BL_ArmatureObject* arma = NULL) - : - BL_SkinDeformer(gameobj, bmeshobj_old, bmeshobj_new, mesh, release_object, recalc_normal, arma), - m_lastShapeUpdate(-1) - { - }; - - virtual RAS_Deformer *GetReplica(); - virtual void ProcessReplica(); - virtual ~BL_ShapeDeformer(); - - bool Update (void); - bool LoadShapeDrivers(Object* arma); - bool ExecuteShapeDrivers(void); - - void ForceUpdate() - { - m_lastShapeUpdate = -1.0; - }; - -protected: - vector m_shapeDrivers; - double m_lastShapeUpdate; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_ShapeDeformer"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp deleted file mode 100644 index c6e371dc0bf..00000000000 --- a/source/gameengine/Converter/BL_SkinDeformer.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif //WIN32 - -#include "BL_SkinDeformer.h" -#include "GEN_Map.h" -#include "STR_HashedString.h" -#include "RAS_IPolygonMaterial.h" -#include "RAS_MeshObject.h" - -//#include "BL_ArmatureController.h" -#include "DNA_armature_types.h" -#include "DNA_action_types.h" -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "BKE_armature.h" -#include "BKE_action.h" -#include "MT_Point3.h" - -extern "C"{ - #include "BKE_lattice.h" -} - #include "BKE_utildefines.h" - -#include "BLI_blenlib.h" -#include "BLI_math.h" - -#define __NLA_DEFNORMALS -//#undef __NLA_DEFNORMALS - -BL_SkinDeformer::BL_SkinDeformer(BL_DeformableGameObject *gameobj, - struct Object *bmeshobj, - class RAS_MeshObject *mesh, - BL_ArmatureObject* arma) - : // - BL_MeshDeformer(gameobj, bmeshobj, mesh), - m_armobj(arma), - m_lastArmaUpdate(-1), - //m_defbase(&bmeshobj->defbase), - m_releaseobject(false), - m_poseApplied(false), - m_recalcNormal(true) -{ - copy_m4_m4(m_obmat, bmeshobj->obmat); -}; - -BL_SkinDeformer::BL_SkinDeformer( - BL_DeformableGameObject *gameobj, - struct Object *bmeshobj_old, // Blender object that owns the new mesh - struct Object *bmeshobj_new, // Blender object that owns the original mesh - class RAS_MeshObject *mesh, - bool release_object, - bool recalc_normal, - BL_ArmatureObject* arma) : - BL_MeshDeformer(gameobj, bmeshobj_old, mesh), - m_armobj(arma), - m_lastArmaUpdate(-1), - //m_defbase(&bmeshobj_old->defbase), - m_releaseobject(release_object), - m_recalcNormal(recalc_normal) - { - // this is needed to ensure correct deformation of mesh: - // the deformation is done with Blender's armature_deform_verts() function - // that takes an object as parameter and not a mesh. The object matrice is used - // in the calculation, so we must use the matrix of the original object to - // simulate a pure replacement of the mesh. - copy_m4_m4(m_obmat, bmeshobj_new->obmat); - } - -BL_SkinDeformer::~BL_SkinDeformer() -{ - if(m_releaseobject && m_armobj) - m_armobj->Release(); -} - -void BL_SkinDeformer::Relink(GEN_Map*map) -{ - if (m_armobj) { - void **h_obj = (*map)[m_armobj]; - - if (h_obj) - m_armobj = (BL_ArmatureObject*)(*h_obj); - else - m_armobj=NULL; - } - - BL_MeshDeformer::Relink(map); -} - -bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat) -{ - RAS_MeshSlot::iterator it; - RAS_MeshMaterial *mmat; - RAS_MeshSlot *slot; - size_t i, nmat, imat; - - // update the vertex in m_transverts - if (!Update()) - return false; - - if (m_transverts) { - // the vertex cache is unique to this deformer, no need to update it - // if it wasn't updated! We must update all the materials at once - // because we will not get here again for the other material - nmat = m_pMeshObject->NumMaterials(); - for (imat=0; imatGetMeshMaterial(imat); - if(!mmat->m_slots[(void*)m_gameobj]) - continue; - - slot = *mmat->m_slots[(void*)m_gameobj]; - - // for each array - for(slot->begin(it); !slot->end(it); slot->next(it)) { - // for each vertex - // copy the untransformed data from the original mvert - for(i=it.startvertex; iProcessReplica(); - return result; -} - -void BL_SkinDeformer::ProcessReplica() -{ - BL_MeshDeformer::ProcessReplica(); - m_lastArmaUpdate = -1; - m_releaseobject = false; -} - -//void where_is_pose (Object *ob); -//void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3], int numVerts, int deformflag); -bool BL_SkinDeformer::UpdateInternal(bool shape_applied) -{ - /* See if the armature has been updated for this frame */ - if (PoseUpdated()){ - float obmat[4][4]; // the original object matrice - - /* XXX note: where_is_pose() (from BKE_armature.h) calculates all matrices needed to start deforming */ - /* but it requires the blender object pointer... */ - Object* par_arma = m_armobj->GetArmatureObject(); - - if(!shape_applied) { - /* store verts locally */ - VerifyStorage(); - - /* duplicate */ - for (int v =0; vtotvert; v++) - VECCOPY(m_transverts[v], m_bmesh->mvert[v].co); - } - - m_armobj->ApplyPose(); - - // save matrix first - copy_m4_m4(obmat, m_objMesh->obmat); - // set reference matrix - copy_m4_m4(m_objMesh->obmat, m_obmat); - - armature_deform_verts( par_arma, m_objMesh, NULL, m_transverts, NULL, m_bmesh->totvert, ARM_DEF_VGROUP, NULL, NULL ); - - // restore matrix - copy_m4_m4(m_objMesh->obmat, obmat); - -#ifdef __NLA_DEFNORMALS - if (m_recalcNormal) - RecalcNormals(); -#endif - - /* Update the current frame */ - m_lastArmaUpdate=m_armobj->GetLastFrame(); - - m_armobj->RestorePose(); - /* dynamic vertex, cannot use display list */ - m_bDynamic = true; - /* indicate that the m_transverts and normals are up to date */ - return true; - } - - return false; -} - -bool BL_SkinDeformer::Update(void) -{ - return UpdateInternal(false); -} - -/* XXX note: I propose to drop this function */ -void BL_SkinDeformer::SetArmature(BL_ArmatureObject *armobj) -{ - // only used to set the object now - m_armobj = armobj; -} diff --git a/source/gameengine/Converter/BL_SkinDeformer.h b/source/gameengine/Converter/BL_SkinDeformer.h deleted file mode 100644 index 80bdd96febd..00000000000 --- a/source/gameengine/Converter/BL_SkinDeformer.h +++ /dev/null @@ -1,118 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BL_SKINDEFORMER -#define BL_SKINDEFORMER - -#ifdef WIN32 -#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning -#endif //WIN32 - -#include "GEN_HashedPtr.h" -#include "BL_MeshDeformer.h" -#include "BL_ArmatureObject.h" - -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_object_types.h" -#include "BKE_armature.h" - -#include "RAS_Deformer.h" - - -class BL_SkinDeformer : public BL_MeshDeformer -{ -public: -// void SetArmatureController (BL_ArmatureController *cont); - virtual void Relink(GEN_Map*map); - void SetArmature (class BL_ArmatureObject *armobj); - - BL_SkinDeformer(BL_DeformableGameObject *gameobj, - struct Object *bmeshobj, - class RAS_MeshObject *mesh, - BL_ArmatureObject* arma = NULL); - - /* this second constructor is needed for making a mesh deformable on the fly. */ - BL_SkinDeformer(BL_DeformableGameObject *gameobj, - struct Object *bmeshobj_old, - struct Object *bmeshobj_new, - class RAS_MeshObject *mesh, - bool release_object, - bool recalc_normal, - BL_ArmatureObject* arma = NULL); - - virtual RAS_Deformer *GetReplica(); - virtual void ProcessReplica(); - - virtual ~BL_SkinDeformer(); - bool Update (void); - bool UpdateInternal (bool shape_applied); - bool Apply (class RAS_IPolyMaterial *polymat); - bool UpdateBuckets(void) - { - // update the deformer and all the mesh slots; Apply() does it well, so just call it. - return Apply(NULL); - } - bool PoseUpdated(void) - { - if (m_armobj && m_lastArmaUpdate!=m_armobj->GetLastFrame()) { - return true; - } - return false; - } - - void ForceUpdate() - { - m_lastArmaUpdate = -1.0; - }; - virtual bool ShareVertexArray() - { - return false; - } - -protected: - BL_ArmatureObject* m_armobj; // Our parent object - float m_time; - double m_lastArmaUpdate; - //ListBase* m_defbase; - float m_obmat[4][4]; // the reference matrix for skeleton deform - bool m_releaseobject; - bool m_poseApplied; - bool m_recalcNormal; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_SkinDeformer"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp deleted file mode 100644 index 47653519cfd..00000000000 --- a/source/gameengine/Converter/BlenderWorldInfo.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include // printf() - -#include "BlenderWorldInfo.h" -#include "KX_BlenderGL.h" - -/* This little block needed for linking to Blender... */ -#ifdef WIN32 -#include "BLI_winstuff.h" -#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 "BKE_global.h" -/* end of blender include block */ - - -BlenderWorldInfo::BlenderWorldInfo(struct World* blenderworld) -{ - if (blenderworld) - { - m_hasworld = true; - - // do we have mist? - if ((blenderworld->mode) & WO_MIST) - { - m_hasmist = true; - m_miststart = blenderworld->miststa; - m_mistdistance = blenderworld->mistdist; - m_mistred = blenderworld->horr; - m_mistgreen = blenderworld->horg; - m_mistblue = blenderworld->horb; - } - else - { - m_hasmist = false; - m_miststart = 0.0; - m_mistdistance = 0.0; - m_mistred = 0.0; - m_mistgreen = 0.0; - m_mistblue = 0.0; - } - - m_backgroundred = blenderworld->horr; - m_backgroundgreen = blenderworld->horg; - m_backgroundblue = blenderworld->horb; - - m_ambientred = blenderworld->ambr; - m_ambientgreen = blenderworld->ambg; - m_ambientblue = blenderworld->ambb; - } - else - { - m_hasworld = false; - } -} - - - -BlenderWorldInfo::~BlenderWorldInfo() -{ - -} - - -bool BlenderWorldInfo::hasWorld() -{ - return m_hasworld; -} - - - -bool BlenderWorldInfo::hasMist() -{ - return m_hasmist; -} - - - -float BlenderWorldInfo::getBackColorRed() -{ - return m_backgroundred; -} - - - -float BlenderWorldInfo::getBackColorGreen() -{ - return m_backgroundgreen; -} - - - -float BlenderWorldInfo::getBackColorBlue() -{ - return m_backgroundblue; -} - - -float BlenderWorldInfo::getAmbientColorRed() -{ - return m_ambientred; -} - -float BlenderWorldInfo::getAmbientColorGreen() -{ - return m_ambientgreen; -} - -float BlenderWorldInfo::getAmbientColorBlue() -{ - return m_ambientblue; -} - -float BlenderWorldInfo::getMistStart() -{ - return m_miststart; -} - - - -float BlenderWorldInfo::getMistDistance() -{ - return m_mistdistance; -} - - - -float BlenderWorldInfo::getMistColorRed() -{ - return m_mistred; -} - - - -float BlenderWorldInfo::getMistColorGreen() -{ - return m_mistgreen; -} - - - -float BlenderWorldInfo::getMistColorBlue() -{ - return m_mistblue; -} - - - void -BlenderWorldInfo::setMistStart( - float d -) { - m_miststart = d; -} - - - void -BlenderWorldInfo::setMistDistance( - float d -) { - m_mistdistance = d; -} - - - void -BlenderWorldInfo::setMistColorRed( - float d -) { - m_mistred = d; -} - - - void -BlenderWorldInfo::setMistColorGreen( - float d -) { - m_mistgreen = d; -} - - - void -BlenderWorldInfo::setMistColorBlue( - float d -) { - m_mistblue = d; -} diff --git a/source/gameengine/Converter/BlenderWorldInfo.h b/source/gameengine/Converter/BlenderWorldInfo.h deleted file mode 100644 index b2762e9a73e..00000000000 --- a/source/gameengine/Converter/BlenderWorldInfo.h +++ /dev/null @@ -1,107 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __BLENDERWORLDINFO_H -#define __BLENDERWORLDINFO_H -#include "MT_CmMatrix4x4.h" -#include "KX_WorldInfo.h" -#include "KX_BlenderGL.h" - -class BlenderWorldInfo : public KX_WorldInfo -{ - bool m_hasworld; - float m_backgroundred; - float m_backgroundgreen; - float m_backgroundblue; - - bool m_hasmist; - float m_miststart; - float m_mistdistance; - float m_mistred; - float m_mistgreen; - float m_mistblue; - - float m_ambientred; - float m_ambientgreen; - float m_ambientblue; - -public: - BlenderWorldInfo(struct World* blenderworld); - ~BlenderWorldInfo(); - - bool hasWorld(); - bool hasMist(); - float getBackColorRed(); - float getBackColorGreen(); - float getBackColorBlue(); - - float getAmbientColorRed(); - float getAmbientColorGreen(); - float getAmbientColorBlue(); - - float getMistStart(); - float getMistDistance(); - float getMistColorRed(); - float getMistColorGreen(); - float getMistColorBlue(); - - void - setMistStart( - float d - ); - - void - setMistDistance( - float d - ); - - void - setMistColorRed( - float d - ); - - void - setMistColorGreen( - float d - ); - - void - setMistColorBlue( - float d - ); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BlenderWorldInfo"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__BLENDERWORLDINFO_H - diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt deleted file mode 100644 index 26689be644f..00000000000 --- a/source/gameengine/Converter/CMakeLists.txt +++ /dev/null @@ -1,73 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -FILE(GLOB SRC *.cpp) - -SET(INC - . - ../../../source/kernel/gen_system - ../../../intern/string - ../../../intern/guardedalloc - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../intern/audaspace/intern - ../../../source/gameengine/Converter - ../../../source/gameengine/BlenderRoutines - ../../../source/blender/imbuf - ../../../intern/moto/include - ../../../source/gameengine/Ketsji - ../../../source/gameengine/Ketsji/KXNetwork - ../../../source/blender/blenlib - ../../../source/blender/blenkernel - ../../../source/blender/windowmanager - ../../../source/blender - ../../../source/blender/include - ../../../source/blender/makesdna - ../../../source/blender/makesrna - ../../../source/gameengine/Rasterizer - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/GameLogic - ../../../source/gameengine/Expressions - ../../../source/gameengine/Network - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Physics/common - ../../../source/gameengine/Physics/Bullet - ../../../source/gameengine/Physics/Dummy - ../../../source/gameengine/Network/LoopBackNetwork - ../../../source/blender/misc - ../../../source/blender/blenloader - ../../../source/blender/gpu - ../../../source/blender/ikplugin - ../../../extern/bullet2/src -) - -IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) -ELSE(WITH_PYTHON) - ADD_DEFINITIONS(-DDISABLE_PYTHON) -ENDIF(WITH_PYTHON) - -BLENDERLIB(bf_converter "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_converter', sources, Split(incs), [], libtype=['game','player'], priority=[5,70] ) diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp deleted file mode 100644 index e325439b087..00000000000 --- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_BlenderScalarInterpolator.h" - -#include - -extern "C" { -#include "DNA_ipo_types.h" -#include "DNA_action_types.h" -#include "DNA_anim_types.h" -#include "BKE_fcurve.h" -} - -float BL_ScalarInterpolator::GetValue(float currentTime) const { - // XXX 2.4x IPO_GetFloatValue(m_blender_adt, m_channel, currentTime); - return evaluate_fcurve(m_fcu, currentTime); -} - -BL_InterpolatorList::BL_InterpolatorList(struct AnimData *adt) { - if(adt->action==NULL) - return; - - for(FCurve *fcu= (FCurve *)adt->action->curves.first; fcu; fcu= (FCurve *)fcu->next) { - if(fcu->rna_path) { - BL_ScalarInterpolator *new_ipo = new BL_ScalarInterpolator(fcu); - //assert(new_ipo); - push_back(new_ipo); - } - } -} - -BL_InterpolatorList::~BL_InterpolatorList() { - BL_InterpolatorList::iterator i; - for (i = begin(); !(i == end()); ++i) { - delete *i; - } -} - -KX_IScalarInterpolator *BL_InterpolatorList::GetScalarInterpolator(const char *rna_path, int array_index) { - for(BL_InterpolatorList::iterator i = begin(); (i != end()) ; i++ ) - { - FCurve *fcu= (static_cast(*i))->GetFCurve(); - if(array_index==fcu->array_index && strcmp(rna_path, fcu->rna_path)==0) - return *i; - } - return NULL; -} - diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.h b/source/gameengine/Converter/KX_BlenderScalarInterpolator.h deleted file mode 100644 index ad4779fee6a..00000000000 --- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.h +++ /dev/null @@ -1,78 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_SCALARINTERPOLATOR_H -#define __KX_SCALARINTERPOLATOR_H - -#include - -#include "KX_IScalarInterpolator.h" - -typedef unsigned short BL_IpoChannel; - -class BL_ScalarInterpolator : public KX_IScalarInterpolator { -public: - BL_ScalarInterpolator() {} // required for use in STL list - BL_ScalarInterpolator(struct FCurve* fcu) : - m_fcu(fcu) - {} - - virtual ~BL_ScalarInterpolator() {} - - virtual float GetValue(float currentTime) const; - struct FCurve *GetFCurve() { return m_fcu;}; - -private: - struct FCurve *m_fcu; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_ScalarInterpolator"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - - -class BL_InterpolatorList : public std::vector { -public: - BL_InterpolatorList(struct AnimData *adt); - ~BL_InterpolatorList(); - - KX_IScalarInterpolator *GetScalarInterpolator(const char *rna_path, int array_index); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_InterpolatorList"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_SCALARINTERPOLATOR_H - diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp deleted file mode 100644 index 3a5bb92b4fa..00000000000 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ /dev/null @@ -1,1392 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 - #pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif - -#include "KX_Scene.h" -#include "KX_GameObject.h" -#include "KX_BlenderSceneConverter.h" -#include "KX_IpoConvert.h" -#include "RAS_MeshObject.h" -#include "KX_PhysicsEngineEnums.h" -#include "PHY_IPhysicsEnvironment.h" -#include "KX_KetsjiEngine.h" -#include "KX_IPhysicsController.h" -#include "BL_Material.h" -#include "KX_BlenderMaterial.h" -#include "KX_PolygonMaterial.h" - - -#include "SYS_System.h" - -#include "DummyPhysicsEnvironment.h" - -#include "KX_ConvertPhysicsObject.h" - -#ifdef USE_BULLET -#include "CcdPhysicsEnvironment.h" -#endif - -#include "KX_BlenderSceneConverter.h" -#include "KX_BlenderScalarInterpolator.h" -#include "BL_BlenderDataConversion.h" -#include "BlenderWorldInfo.h" -#include "KX_Scene.h" - -/* This little block needed for linking to Blender... */ -#ifdef WIN32 -#include "BLI_winstuff.h" -#endif - -/* This list includes only data type definitions */ -#include "DNA_scene_types.h" -#include "DNA_world_types.h" -#include "BKE_main.h" - -#include "BLI_math.h" - -extern "C" -{ -#include "DNA_object_types.h" -#include "DNA_curve_types.h" -#include "DNA_mesh_types.h" -#include "DNA_material_types.h" -#include "BLI_blenlib.h" -#include "MEM_guardedalloc.h" -#include "BKE_global.h" -#include "BKE_animsys.h" -#include "BKE_library.h" -#include "BKE_material.h" // copy_material -#include "BKE_mesh.h" // copy_mesh -#include "DNA_space_types.h" -#include "DNA_anim_types.h" -#include "RNA_define.h" -#include "../../blender/editors/include/ED_keyframing.h" -} - -/* Only for dynamic loading and merging */ -#include "RAS_BucketManager.h" // XXX cant stay -#include "KX_BlenderSceneConverter.h" -#include "BL_BlenderDataConversion.h" -#include "KX_MeshProxy.h" -#include "RAS_MeshObject.h" -extern "C" { - #include "BKE_context.h" - #include "BLO_readfile.h" - #include "BKE_report.h" - #include "DNA_space_types.h" - #include "DNA_windowmanager_types.h" /* report api */ - #include "../../blender/blenlib/BLI_linklist.h" -} - -KX_BlenderSceneConverter::KX_BlenderSceneConverter( - struct Main* maggie, - class KX_KetsjiEngine* engine - ) - : m_maggie(maggie), - /*m_maggie_dyn(NULL),*/ - m_ketsjiEngine(engine), - m_alwaysUseExpandFraming(false), - m_usemat(false), - m_useglslmat(false) -{ - tag_main(maggie, 0); /* avoid re-tagging later on */ - m_newfilename = ""; -} - - -KX_BlenderSceneConverter::~KX_BlenderSceneConverter() -{ - // clears meshes, and hashmaps from blender to gameengine data - int i; - // delete sumoshapes - - - int numAdtLists = m_map_blender_to_gameAdtList.size(); - for (i=0; i >::iterator itw = m_worldinfos.begin(); - while (itw != m_worldinfos.end()) { - delete (*itw).second; - itw++; - } - - vector >::iterator itp = m_polymaterials.begin(); - while (itp != m_polymaterials.end()) { - delete (*itp).second; - itp++; - } - - // delete after RAS_IPolyMaterial - vector >::iterator itmat = m_materials.begin(); - while (itmat != m_materials.end()) { - delete (*itmat).second; - itmat++; - } - - - vector >::iterator itm = m_meshobjects.begin(); - while (itm != m_meshobjects.end()) { - delete (*itm).second; - itm++; - } - -#ifdef USE_BULLET - KX_ClearBulletSharedShapes(); -#endif - - /* free any data that was dynamically loaded */ - for (vector::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) { - Main *main= *it; - free_main(main); - } - - m_DynamicMaggie.clear(); -} - -void KX_BlenderSceneConverter::SetNewFileName(const STR_String& filename) -{ - m_newfilename = filename; -} - - - -bool KX_BlenderSceneConverter::TryAndLoadNewFile() -{ - bool result = false; - - // find the file -/* if () - { - result = true; - } - // if not, clear the newfilename - else - { - m_newfilename = ""; - } -*/ - return result; -} - -Scene *KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String& name) -{ - Scene *sce; - - /** - * Find the specified scene by name, or the first - * scene if nothing matches (shouldn't happen). - */ - if((sce= (Scene *)BLI_findstring(&m_maggie->scene, name.ReadPtr(), offsetof(ID, name) + 2))) - return sce; - - for (vector::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) { - Main *main= *it; - - if((sce= (Scene *)BLI_findstring(&main->scene, name.ReadPtr(), offsetof(ID, name) + 2))) - return sce; - } - - return (Scene*)m_maggie->scene.first; - -} -#include "KX_PythonInit.h" - -#ifdef USE_BULLET - -#include "LinearMath/btIDebugDraw.h" - - -struct BlenderDebugDraw : public btIDebugDraw -{ - BlenderDebugDraw () : - m_debugMode(0) - { - } - - int m_debugMode; - - virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color) - { - if (m_debugMode >0) - { - MT_Vector3 kxfrom(from[0],from[1],from[2]); - MT_Vector3 kxto(to[0],to[1],to[2]); - MT_Vector3 kxcolor(color[0],color[1],color[2]); - - KX_RasterizerDrawDebugLine(kxfrom,kxto,kxcolor); - } - } - - virtual void reportErrorWarning(const char* warningString) - { - - } - - virtual void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,float distance,int lifeTime,const btVector3& color) - { - //not yet - } - - virtual void setDebugMode(int debugMode) - { - m_debugMode = debugMode; - } - virtual int getDebugMode() const - { - return m_debugMode; - } - ///todo: find out if Blender can do this - virtual void draw3dText(const btVector3& location,const char* textString) - { - - } - -}; - -#endif - -void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene, - class RAS_IRenderTools* rendertools, - class RAS_ICanvas* canvas) -{ - //find out which physics engine - Scene *blenderscene = destinationscene->GetBlenderScene(); - - e_PhysicsEngine physics_engine = UseBullet; - bool useDbvtCulling = false; - // hook for registration function during conversion. - m_currentScene = destinationscene; - destinationscene->SetSceneConverter(this); - SG_SetActiveStage(SG_STAGE_CONVERTER); - - if (blenderscene) - { - - switch (blenderscene->gm.physicsEngine) - { - case WOPHY_BULLET: - { - physics_engine = UseBullet; - useDbvtCulling = (blenderscene->gm.mode & WO_DBVT_CULLING) != 0; - break; - } - - case WOPHY_ODE: - { - physics_engine = UseODE; - break; - } - case WOPHY_DYNAMO: - { - physics_engine = UseDynamo; - break; - } - case WOPHY_SUMO: - { - physics_engine = UseSumo; - break; - } - case WOPHY_NONE: - { - physics_engine = UseNone; - } - } - } - - switch (physics_engine) - { -#ifdef USE_BULLET - case UseBullet: - { - CcdPhysicsEnvironment* ccdPhysEnv = new CcdPhysicsEnvironment(useDbvtCulling); - ccdPhysEnv->setDebugDrawer(new BlenderDebugDraw()); - ccdPhysEnv->setDeactivationLinearTreshold(0.8f); // default, can be overridden by Python - ccdPhysEnv->setDeactivationAngularTreshold(1.0f); // default, can be overridden by Python - - SYS_SystemHandle syshandle = SYS_GetSystem(); /*unused*/ - int visualizePhysics = SYS_GetCommandLineInt(syshandle,"show_physics",0); - if (visualizePhysics) - ccdPhysEnv->setDebugMode(btIDebugDraw::DBG_DrawWireframe|btIDebugDraw::DBG_DrawAabb|btIDebugDraw::DBG_DrawContactPoints|btIDebugDraw::DBG_DrawText|btIDebugDraw::DBG_DrawConstraintLimits|btIDebugDraw::DBG_DrawConstraints); - - //todo: get a button in blender ? - //disable / enable debug drawing (contact points, aabb's etc) - //ccdPhysEnv->setDebugMode(1); - destinationscene->SetPhysicsEnvironment(ccdPhysEnv); - break; - } -#endif - case UseDynamo: - { - } - - default: - case UseNone: - physics_engine = UseNone; - destinationscene ->SetPhysicsEnvironment(new DummyPhysicsEnvironment()); - break; - } - - BL_ConvertBlenderObjects(m_maggie, - destinationscene, - m_ketsjiEngine, - physics_engine, - rendertools, - canvas, - this, - m_alwaysUseExpandFraming - ); - - //These lookup are not needed during game - m_map_blender_to_gameactuator.clear(); - m_map_blender_to_gamecontroller.clear(); - m_map_blender_to_gameobject.clear(); - - //Clearing this lookup table has the effect of disabling the cache of meshes - //between scenes, even if they are shared in the blend file. - //This cache mecanism is buggy so I leave it disable and the memory leak - //that would result from this is fixed in RemoveScene() - m_map_mesh_to_gamemesh.clear(); -} - -// This function removes all entities stored in the converter for that scene -// It should be used instead of direct delete scene -// Note that there was some provision for sharing entities (meshes...) between -// scenes but that is now disabled so all scene will have their own copy -// and we can delete them here. If the sharing is reactivated, change this code too.. -// (see KX_BlenderSceneConverter::ConvertScene) -void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene) -{ - int i, size; - // delete the scene first as it will stop the use of entities - delete scene; - // delete the entities of this scene - vector >::iterator worldit; - size = m_worldinfos.size(); - for (i=0, worldit=m_worldinfos.begin(); i >::iterator polymit; - size = m_polymaterials.size(); - for (i=0, polymit=m_polymaterials.begin(); i >::iterator matit; - size = m_materials.size(); - for (i=0, matit=m_materials.begin(); i >::iterator meshit; - size = m_meshobjects.size(); - for (i=0, meshit=m_meshobjects.begin(); i(m_currentScene,mat)); -} - - - -void KX_BlenderSceneConverter::SetAlwaysUseExpandFraming( - bool to_what) -{ - m_alwaysUseExpandFraming= to_what; -} - - - -void KX_BlenderSceneConverter::RegisterGameObject( - KX_GameObject *gameobject, - struct Object *for_blenderobject) -{ - /* only maintained while converting, freed during game runtime */ - m_map_blender_to_gameobject.insert(CHashedPtr(for_blenderobject),gameobject); -} - -/* only need to run this during conversion since - * m_map_blender_to_gameobject is freed after conversion */ -void KX_BlenderSceneConverter::UnregisterGameObject( - KX_GameObject *gameobject) -{ - struct Object *bobp= gameobject->GetBlenderObject(); - if (bobp) { - CHashedPtr bptr(bobp); - KX_GameObject **gobp= m_map_blender_to_gameobject[bptr]; - if (gobp && *gobp == gameobject) - { - // also maintain m_map_blender_to_gameobject if the gameobject - // being removed is matching the blender object - m_map_blender_to_gameobject.remove(bptr); - } - } -} - -KX_GameObject *KX_BlenderSceneConverter::FindGameObject( - struct Object *for_blenderobject) -{ - KX_GameObject **obp= m_map_blender_to_gameobject[CHashedPtr(for_blenderobject)]; - - return obp?*obp:NULL; -} - -void KX_BlenderSceneConverter::RegisterGameMesh( - RAS_MeshObject *gamemesh, - struct Mesh *for_blendermesh) -{ - if(for_blendermesh) { /* dynamically loaded meshes we dont want to keep lookups for */ - m_map_mesh_to_gamemesh.insert(CHashedPtr(for_blendermesh),gamemesh); - } - m_meshobjects.push_back(pair(m_currentScene,gamemesh)); -} - - - -RAS_MeshObject *KX_BlenderSceneConverter::FindGameMesh( - struct Mesh *for_blendermesh/*, - unsigned int onlayer*/) -{ - RAS_MeshObject** meshp = m_map_mesh_to_gamemesh[CHashedPtr(for_blendermesh)]; - - if (meshp/* && onlayer==(*meshp)->GetLightLayer()*/) { - return *meshp; - } else { - return NULL; - } -} - - - - - - -void KX_BlenderSceneConverter::RegisterPolyMaterial(RAS_IPolyMaterial *polymat) -{ - m_polymaterials.push_back(pair(m_currentScene,polymat)); -} - - - -void KX_BlenderSceneConverter::RegisterInterpolatorList( - BL_InterpolatorList *adtList, - struct AnimData *for_adt) -{ - m_map_blender_to_gameAdtList.insert(CHashedPtr(for_adt), adtList); -} - - - -BL_InterpolatorList *KX_BlenderSceneConverter::FindInterpolatorList( - struct AnimData *for_adt) -{ - BL_InterpolatorList **listp = m_map_blender_to_gameAdtList[CHashedPtr(for_adt)]; - - return listp?*listp:NULL; -} - - - -void KX_BlenderSceneConverter::RegisterGameActuator( - SCA_IActuator *act, - struct bActuator *for_actuator) -{ - m_map_blender_to_gameactuator.insert(CHashedPtr(for_actuator), act); -} - - - -SCA_IActuator *KX_BlenderSceneConverter::FindGameActuator( - struct bActuator *for_actuator) -{ - SCA_IActuator **actp = m_map_blender_to_gameactuator[CHashedPtr(for_actuator)]; - - return actp?*actp:NULL; -} - - - -void KX_BlenderSceneConverter::RegisterGameController( - SCA_IController *cont, - struct bController *for_controller) -{ - m_map_blender_to_gamecontroller.insert(CHashedPtr(for_controller), cont); -} - - - -SCA_IController *KX_BlenderSceneConverter::FindGameController( - struct bController *for_controller) -{ - SCA_IController **contp = m_map_blender_to_gamecontroller[CHashedPtr(for_controller)]; - - return contp?*contp:NULL; -} - - - -void KX_BlenderSceneConverter::RegisterWorldInfo( - KX_WorldInfo *worldinfo) -{ - m_worldinfos.push_back(pair(m_currentScene,worldinfo)); -} - -//quick hack -extern "C" -{ - void mat3_to_compatible_eul( float *eul, float *oldrot,float mat[][3]); -} - -void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo) -{ - - KX_SceneList* scenes = m_ketsjiEngine->CurrentScenes(); - int numScenes = scenes->size(); - int i; - for (i=0;iat(i); - //PHY_IPhysicsEnvironment* physEnv = scene->GetPhysicsEnvironment(); - CListValue* parentList = scene->GetRootParentList(); - int numObjects = parentList->GetCount(); - int g; - for (g=0;gGetValue(g); - if (gameObj->IsDynamic()) - { - //KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController(); - - Object* blenderObject = gameObj->GetBlenderObject(); - if (blenderObject) - { -#if 0 - //erase existing ipo's - Ipo* ipo = blenderObject->ipo;//findIpoForName(blenderObject->id.name+2); - if (ipo) - { //clear the curve data - if (clearIpo){//rcruiz - IpoCurve *icu1; - - int numCurves = 0; - for( icu1 = (IpoCurve*)ipo->curve.first; icu1; ) { - - IpoCurve* tmpicu = icu1; - - /*int i; - BezTriple *bezt; - for( bezt = tmpicu->bezt, i = 0; i < tmpicu->totvert; i++, bezt++){ - printf("(%f,%f,%f),(%f,%f,%f),(%f,%f,%f)\n",bezt->vec[0][0],bezt->vec[0][1],bezt->vec[0][2],bezt->vec[1][0],bezt->vec[1][1],bezt->vec[1][2],bezt->vec[2][0],bezt->vec[2][1],bezt->vec[2][2]); - }*/ - - icu1 = icu1->next; - numCurves++; - - BLI_remlink( &( blenderObject->ipo->curve ), tmpicu ); - if( tmpicu->bezt ) - MEM_freeN( tmpicu->bezt ); - MEM_freeN( tmpicu ); - localDel_ipoCurve( tmpicu ); - } - } - } else - { ipo = NULL; // XXX add_ipo(blenderObject->id.name+2, ID_OB); - blenderObject->ipo = ipo; - - } -#endif - } - } - - } - - - } - - - -} - -void KX_BlenderSceneConverter::resetNoneDynamicObjectToIpo(){ - - if (addInitFromFrame){ - KX_SceneList* scenes = m_ketsjiEngine->CurrentScenes(); - int numScenes = scenes->size(); - if (numScenes>=0){ - KX_Scene* scene = scenes->at(0); - CListValue* parentList = scene->GetRootParentList(); - for (int ix=0;ixGetCount();ix++){ - KX_GameObject* gameobj = (KX_GameObject*)parentList->GetValue(ix); - if (!gameobj->IsDynamic()){ - Object* blenderobject = gameobj->GetBlenderObject(); - if (!blenderobject) - continue; - if (blenderobject->type==OB_ARMATURE) - continue; - float eu[3]; - mat4_to_eul(eu,blenderobject->obmat); - MT_Point3 pos = MT_Point3( - blenderobject->obmat[3][0], - blenderobject->obmat[3][1], - blenderobject->obmat[3][2] - ); - MT_Vector3 eulxyz = MT_Vector3( - eu[0], - eu[1], - eu[2] - ); - MT_Vector3 scale = MT_Vector3( - blenderobject->size[0], - blenderobject->size[1], - blenderobject->size[2] - ); - gameobj->NodeSetLocalPosition(pos); - gameobj->NodeSetLocalOrientation(MT_Matrix3x3(eulxyz)); - gameobj->NodeSetLocalScale(scale); - gameobj->NodeUpdateGS(0); - } - } - } - } -} - - - ///this generates ipo curves for position, rotation, allowing to use game physics in animation -void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) -{ - - KX_SceneList* scenes = m_ketsjiEngine->CurrentScenes(); - int numScenes = scenes->size(); - int i; - for (i=0;iat(i); - //PHY_IPhysicsEnvironment* physEnv = scene->GetPhysicsEnvironment(); - CListValue* parentList = scene->GetRootParentList(); - int numObjects = parentList->GetCount(); - int g; - for (g=0;gGetValue(g); - if (gameObj->IsDynamic()) - { - //KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController(); - - Object* blenderObject = gameObj->GetBlenderObject(); - - if(blenderObject->adt==NULL) - BKE_id_add_animdata(&blenderObject->id); - - if (blenderObject && blenderObject->adt) - { - const MT_Point3& position = gameObj->NodeGetWorldPosition(); - //const MT_Vector3& scale = gameObj->NodeGetWorldScaling(); - const MT_Matrix3x3& orn = gameObj->NodeGetWorldOrientation(); - - position.getValue(blenderObject->loc); - - float tmat[3][3]; - for (int r=0;r<3;r++) - for (int c=0;c<3;c++) - tmat[r][c] = orn[c][r]; - - mat3_to_compatible_eul(blenderObject->rot, blenderObject->rot, tmat); - - insert_keyframe(&blenderObject->id, NULL, NULL, "location", -1, frameNumber, INSERTKEY_FAST); - insert_keyframe(&blenderObject->id, NULL, NULL, "rotation_euler", -1, frameNumber, INSERTKEY_FAST); - -#if 0 - const MT_Point3& position = gameObj->NodeGetWorldPosition(); - //const MT_Vector3& scale = gameObj->NodeGetWorldScaling(); - const MT_Matrix3x3& orn = gameObj->NodeGetWorldOrientation(); - - float eulerAngles[3]; - float eulerAnglesOld[3] = {0.0f, 0.0f, 0.0f}; - float tmat[3][3]; - - // XXX animato - Ipo* ipo = blenderObject->ipo; - - //create the curves, if not existing, set linear if new - - IpoCurve *icu_lx = findIpoCurve((IpoCurve *)ipo->curve.first,"LocX"); - if (!icu_lx) { - icu_lx = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X, 1); - if(icu_lx) icu_lx->ipo = IPO_LIN; - } - IpoCurve *icu_ly = findIpoCurve((IpoCurve *)ipo->curve.first,"LocY"); - if (!icu_ly) { - icu_ly = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y, 1); - if(icu_ly) icu_ly->ipo = IPO_LIN; - } - IpoCurve *icu_lz = findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ"); - if (!icu_lz) { - icu_lz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z, 1); - if(icu_lz) icu_lz->ipo = IPO_LIN; - } - IpoCurve *icu_rx = findIpoCurve((IpoCurve *)ipo->curve.first,"RotX"); - if (!icu_rx) { - icu_rx = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X, 1); - if(icu_rx) icu_rx->ipo = IPO_LIN; - } - IpoCurve *icu_ry = findIpoCurve((IpoCurve *)ipo->curve.first,"RotY"); - if (!icu_ry) { - icu_ry = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y, 1); - if(icu_ry) icu_ry->ipo = IPO_LIN; - } - IpoCurve *icu_rz = findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ"); - if (!icu_rz) { - icu_rz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z, 1); - if(icu_rz) icu_rz->ipo = IPO_LIN; - } - - if(icu_rx) eulerAnglesOld[0]= eval_icu( icu_rx, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); - if(icu_ry) eulerAnglesOld[1]= eval_icu( icu_ry, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); - if(icu_rz) eulerAnglesOld[2]= eval_icu( icu_rz, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); - - // orn.getValue((float *)tmat); // uses the wrong ordering, cant use this - for (int r=0;r<3;r++) - for (int c=0;c<3;c++) - tmat[r][c] = orn[c][r]; - - // mat3_to_eul( eulerAngles,tmat); // better to use Mat3ToCompatibleEul - mat3_to_compatible_eul( eulerAngles, eulerAnglesOld,tmat); - - //eval_icu - for(int x = 0; x < 3; x++) - eulerAngles[x] *= (float) ((180 / 3.14159265f) / 10.0); - - //fill the curves with data - if (icu_lx) insert_vert_icu(icu_lx, frameNumber, position.x(), 1); - if (icu_ly) insert_vert_icu(icu_ly, frameNumber, position.y(), 1); - if (icu_lz) insert_vert_icu(icu_lz, frameNumber, position.z(), 1); - if (icu_rx) insert_vert_icu(icu_rx, frameNumber, eulerAngles[0], 1); - if (icu_ry) insert_vert_icu(icu_ry, frameNumber, eulerAngles[1], 1); - if (icu_rz) insert_vert_icu(icu_rz, frameNumber, eulerAngles[2], 1); - - // Handles are corrected at the end, testhandles_ipocurve isnt needed yet -#endif - } - } - } - } -} - - -void KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo() -{ - - KX_SceneList* scenes = m_ketsjiEngine->CurrentScenes(); - int numScenes = scenes->size(); - int i; - for (i=0;iat(i); - //PHY_IPhysicsEnvironment* physEnv = scene->GetPhysicsEnvironment(); - CListValue* parentList = scene->GetRootParentList(); - int numObjects = parentList->GetCount(); - int g; - for (g=0;gGetValue(g); - if (gameObj->IsDynamic()) - { - //KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController(); - - Object* blenderObject = gameObj->GetBlenderObject(); - if (blenderObject && blenderObject->ipo) - { - // XXX animato -#if 0 - Ipo* ipo = blenderObject->ipo; - - //create the curves, if not existing - //testhandles_ipocurve checks for NULL - testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"LocX")); - testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"LocY")); - testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ")); - testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotX")); - testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotY")); - testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ")); -#endif - } - } - - } - - - } - - - -} - -#ifndef DISABLE_PYTHON -PyObject *KX_BlenderSceneConverter::GetPyNamespace() -{ - return m_ketsjiEngine->GetPyNamespace(); -} -#endif - -vector &KX_BlenderSceneConverter::GetMainDynamic() -{ - return m_DynamicMaggie; -} - -Main* KX_BlenderSceneConverter::GetMainDynamicPath(const char *path) -{ - for (vector::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) - if(strcmp((*it)->name, path)==0) - return *it; - - return NULL; -} - -bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, KX_Scene *scene_merge, char **err_str) -{ - bContext *C; - Main *main_newlib; /* stored as a dynamic 'main' until we free it */ - Main *main_tmp= NULL; /* created only for linking, then freed */ - LinkNode *names = NULL; - BlendHandle *bpy_openlib = NULL; /* ptr to the open .blend file */ - int idcode= BLO_idcode_from_name(group); - short flag= 0; /* dont need any special options */ - ReportList reports; - static char err_local[255]; - - /* only scene and mesh supported right now */ - if(idcode!=ID_SCE && idcode!=ID_ME) { - snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group); - return false; - } - - if(GetMainDynamicPath(path)) { - snprintf(err_local, sizeof(err_local), "blend file already open \"%s\"\n", path); - *err_str= err_local; - return false; - } - - bpy_openlib = BLO_blendhandle_from_file( (char *)path ); - if(bpy_openlib==NULL) { - snprintf(err_local, sizeof(err_local), "could not open blendfile \"%s\"\n", path); - *err_str= err_local; - return false; - } - - main_newlib= (Main *)MEM_callocN( sizeof(Main), "BgeMain"); - C= CTX_create(); - CTX_data_main_set(C, main_newlib); - BKE_reports_init(&reports, RPT_STORE); - - /* here appending/linking starts */ - main_tmp = BLO_library_append_begin(C, &bpy_openlib, (char *)path); - - names = BLO_blendhandle_get_datablock_names( bpy_openlib, idcode); - - int i=0; - LinkNode *n= names; - while(n) { - BLO_library_append_named_part(C, main_tmp, &bpy_openlib, (char *)n->link, idcode, 0); - n= (LinkNode *)n->next; - i++; - } - BLI_linklist_free(names, free); /* free linklist *and* each node's data */ - - BLO_library_append_end(C, main_tmp, &bpy_openlib, idcode, flag); - BLO_blendhandle_close(bpy_openlib); - - CTX_free(C); - BKE_reports_clear(&reports); - /* done linking */ - - /* needed for lookups*/ - GetMainDynamic().push_back(main_newlib); - strncpy(main_newlib->name, path, sizeof(main_newlib->name)); - - - if(idcode==ID_ME) { - /* Convert all new meshes into BGE meshes */ - ID* mesh; - KX_Scene *kx_scene= m_currentScene; - - for(mesh= (ID *)main_newlib->mesh.first; mesh; mesh= (ID *)mesh->next ) { - RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)mesh, NULL, scene_merge, this); - kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj); - } - } - else if(idcode==ID_SCE) { - /* Merge all new linked in scene into the existing one */ - ID *scene; - for(scene= (ID *)main_newlib->scene.first; scene; scene= (ID *)scene->next ) { - printf("SceneName: %s\n", scene->name); - - /* merge into the base scene */ - KX_Scene* other= m_ketsjiEngine->CreateScene((Scene *)scene); - scene_merge->MergeScene(other); - - // RemoveScene(other); // Dont run this, it frees the entire scene converter data, just delete the scene - delete other; - } - } - - return true; -} - -/* Note m_map_*** are all ok and dont need to be freed - * most are temp and NewRemoveObject frees m_map_gameobject_to_blender */ -bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) -{ - int maggie_index; - int i=0; - - if(maggie==NULL) - return false; - - /* tag all false except the one we remove */ - for (vector::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) { - Main *main= *it; - if(main != maggie) { - tag_main(main, 0); - } - else { - maggie_index= i; - } - i++; - } - - m_DynamicMaggie.erase(m_DynamicMaggie.begin() + maggie_index); - tag_main(maggie, 1); - - - /* free all tagged objects */ - KX_SceneList* scenes = m_ketsjiEngine->CurrentScenes(); - int numScenes = scenes->size(); - - - for (int scene_idx=0;scene_idxat(scene_idx); - if(IS_TAGGED(scene->GetBlenderScene())) { - RemoveScene(scene); // XXX - not tested yet - scene_idx--; - numScenes--; - } - else { - - /* incase the mesh might be refered to later */ - { - GEN_Map &mapStringToMeshes = scene->GetLogicManager()->GetMeshMap(); - - for(int i=0; iGetMesh())) - { - STR_HashedString mn = meshobj->GetName(); - mapStringToMeshes.remove(mn); - i--; - } - } - } - - //scene->FreeTagged(); /* removed tagged objects and meshes*/ - CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL}; - - for(int ob_ls_idx=0; obj_lists[ob_ls_idx]; ob_ls_idx++) - { - CListValue *obs= obj_lists[ob_ls_idx]; - RAS_MeshObject* mesh; - - for (int ob_idx = 0; ob_idx < obs->GetCount(); ob_idx++) - { - KX_GameObject* gameobj = (KX_GameObject*)obs->GetValue(ob_idx); - if(IS_TAGGED(gameobj->GetBlenderObject())) { - - int size_before = obs->GetCount(); - - /* Eventually calls RemoveNodeDestructObject - * frees m_map_gameobject_to_blender from UnregisterGameObject */ - scene->RemoveObject(gameobj); - - if(size_before != obs->GetCount()) - ob_idx--; - else { - printf("ERROR COULD NOT REMOVE \"%s\"\n", gameobj->GetName().ReadPtr()); - } - } - else { - /* free the mesh, we could be referecing a linked one! */ - int mesh_index= gameobj->GetMeshCount(); - while(mesh_index--) { - mesh= gameobj->GetMesh(mesh_index); - if(IS_TAGGED(mesh->GetMesh())) { - gameobj->RemoveMeshes(); /* XXX - slack, should only remove meshes that are library items but mostly objects only have 1 mesh */ - break; - } - } - } - } - } - } - } - - - int size; - - // delete the entities of this scene - /* TODO - */ - /* - vector >::iterator worldit; - size = m_worldinfos.size(); - for (i=0, worldit=m_worldinfos.begin(); i KX_WorldInfoSet; - KX_WorldInfoSet worldset; - for (int scene_idx=0;scene_idxat(scene_idx); - if(scene->GetWorldInfo()) - worldset.insert( scene->GetWorldInfo() ); - } - - vector >::iterator worldit; - size = m_worldinfos.size(); - for (i=0, worldit=m_worldinfos.begin(); i >::iterator polymit; - size = m_polymaterials.size(); - - - - for (i=0, polymit=m_polymaterials.begin(); iGetFlag() & RAS_BLENDERMAT) { - KX_BlenderMaterial *bl_mat = static_cast(mat); - bmat= bl_mat->GetBlenderMaterial(); - - } else { - KX_PolygonMaterial *kx_mat = static_cast(mat); - bmat= kx_mat->GetBlenderMaterial(); - } - - if (IS_TAGGED(bmat)) { - /* only remove from bucket */ - ((*polymit).first)->GetBucketManager()->RemoveMaterial(mat); - } - - i++; - polymit++; - } - - - - for (i=0, polymit=m_polymaterials.begin(); iGetFlag() & RAS_BLENDERMAT) { - KX_BlenderMaterial *bl_mat = static_cast(mat); - bmat= bl_mat->GetBlenderMaterial(); - - } else { - KX_PolygonMaterial *kx_mat = static_cast(mat); - bmat= kx_mat->GetBlenderMaterial(); - } - - if(bmat) { - //printf("FOUND MAT '%s' !!! ", ((ID*)bmat)->name+2); - } - else { - //printf("LOST MAT !!!"); - } - - if (IS_TAGGED(bmat)) { - - delete (*polymit).second; - *polymit = m_polymaterials.back(); - m_polymaterials.pop_back(); - size--; - //printf("tagged !\n"); - } else { - i++; - polymit++; - //printf("(un)tagged !\n"); - } - } - - vector >::iterator matit; - size = m_materials.size(); - for (i=0, matit=m_materials.begin(); imaterial)) { - delete (*matit).second; - *matit = m_materials.back(); - m_materials.pop_back(); - size--; - } else { - i++; - matit++; - } - } - - vector >::iterator meshit; - size = m_meshobjects.size(); - for (i=0, meshit=m_meshobjects.begin(); iGetMesh())) { - delete (*meshit).second; - *meshit = m_meshobjects.back(); - m_meshobjects.pop_back(); - size--; - } else { - i++; - meshit++; - } - } - - free_main(maggie); - - return true; -} - -bool KX_BlenderSceneConverter::FreeBlendFile(const char *path) -{ - return FreeBlendFile(GetMainDynamicPath(path)); -} - -bool KX_BlenderSceneConverter::MergeScene(KX_Scene *to, KX_Scene *from) -{ - - { - vector >::iterator itp = m_worldinfos.begin(); - while (itp != m_worldinfos.end()) { - if ((*itp).first==from) - (*itp).first= to; - itp++; - } - } - - { - vector >::iterator itp = m_polymaterials.begin(); - while (itp != m_polymaterials.end()) { - if ((*itp).first==from) { - (*itp).first= to; - - /* also switch internal data */ - RAS_IPolyMaterial*mat= (*itp).second; - mat->Replace_IScene(to); - } - itp++; - } - } - - { - vector >::iterator itp = m_meshobjects.begin(); - while (itp != m_meshobjects.end()) { - if ((*itp).first==from) - (*itp).first= to; - itp++; - } - } - - { - vector >::iterator itp = m_materials.begin(); - while (itp != m_materials.end()) { - if ((*itp).first==from) - (*itp).first= to; - itp++; - } - } - - return true; -} - -/* This function merges a mesh from the current scene into another main - * it does not convert */ -RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene, Main *maggie, const char *name) -{ - /* Find a mesh in the current main */ - ID *me= static_cast(BLI_findstring(&m_maggie->mesh, name, offsetof(ID, name) + 2)); - - if(me==NULL) { - printf("Could not be found \"%s\"\n", name); - return NULL; - } - - /* Watch this!, if its used in the original scene can cause big troubles */ - if(me->us > 0) { - printf("Mesh has a user \"%s\"\n", name); - me = (ID*)copy_mesh((Mesh*)me); - me->us--; - } - BLI_remlink(&m_maggie->mesh, me); /* even if we made the copy it needs to be removed */ - BLI_addtail(&maggie->mesh, me); - - - /* Must copy the materials this uses else we cant free them */ - { - Mesh *mesh= (Mesh *)me; - - /* ensure all materials are tagged */ - for(int i=0; itotcol; i++) - if(mesh->mat[i]) - mesh->mat[i]->id.flag &= ~LIB_DOIT; - - for(int i=0; itotcol; i++) - { - Material *mat_old= mesh->mat[i]; - - /* if its tagged its a replaced material */ - if(mat_old && (mat_old->id.flag & LIB_DOIT)==0) - { - Material *mat_old= mesh->mat[i]; - Material *mat_new= copy_material( mat_old ); - - mat_new->id.flag |= LIB_DOIT; - mat_old->id.us--; - - BLI_remlink(&m_maggie->mat, mat_new); - BLI_addtail(&maggie->mat, mat_new); - - mesh->mat[i]= mat_new; - - /* the same material may be used twice */ - for(int j=i+1; jtotcol; j++) - { - if(mesh->mat[j]==mat_old) - { - mesh->mat[j]= mat_new; - mat_new->id.us++; - mat_old->id.us--; - } - } - } - } - } - - RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)me, NULL, kx_scene, this); - kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj); - m_map_mesh_to_gamemesh.clear(); /* This is at runtime so no need to keep this, BL_ConvertMesh adds */ - return meshobj; -} diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h deleted file mode 100644 index 3dd3afb5662..00000000000 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.h +++ /dev/null @@ -1,187 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_BLENDERSCENECONVERTER_H -#define __KX_BLENDERSCENECONVERTER_H - -#include "KX_HashedPtr.h" -#include "GEN_Map.h" -#include - -#include "KX_ISceneConverter.h" -#include "KX_IpoConvert.h" - -class KX_WorldInfo; -class SCA_IActuator; -class SCA_IController; -class RAS_MeshObject; -class RAS_IPolyMaterial; -class BL_InterpolatorList; -class BL_Material; -struct Main; -struct Scene; - -class KX_BlenderSceneConverter : public KX_ISceneConverter -{ - // Use vector of pairs to allow removal of entities between scene switch - vector > m_worldinfos; - vector > m_polymaterials; - vector > m_meshobjects; - vector > m_materials; - // Should also have a list of collision shapes. - // For the time being this is held in KX_Scene::m_shapes - - GEN_Map m_map_blender_to_gameobject; /* cleared after conversion */ - GEN_Map m_map_mesh_to_gamemesh; /* cleared after conversion */ - GEN_Map m_map_blender_to_gameactuator; /* cleared after conversion */ - GEN_Mapm_map_blender_to_gamecontroller; /* cleared after conversion */ - - GEN_Map m_map_blender_to_gameAdtList; - - Main* m_maggie; - vector m_DynamicMaggie; - - STR_String m_newfilename; - class KX_KetsjiEngine* m_ketsjiEngine; - class KX_Scene* m_currentScene; // Scene being converted - bool m_alwaysUseExpandFraming; - bool m_usemat; - bool m_useglslmat; - -public: - KX_BlenderSceneConverter( - Main* maggie, - class KX_KetsjiEngine* engine - ); - - virtual ~KX_BlenderSceneConverter(); - - /* Scenename: name of the scene to be converted. - * destinationscene: pass an empty scene, everything goes into this - * dictobj: python dictionary (for pythoncontrollers) - */ - virtual void ConvertScene( - class KX_Scene* destinationscene, - class RAS_IRenderTools* rendertools, - class RAS_ICanvas* canvas - ); - virtual void RemoveScene(class KX_Scene *scene); - - void SetNewFileName(const STR_String& filename); - bool TryAndLoadNewFile(); - - void SetAlwaysUseExpandFraming(bool to_what); - - void RegisterGameObject(KX_GameObject *gameobject, struct Object *for_blenderobject); - void UnregisterGameObject(KX_GameObject *gameobject); - KX_GameObject *FindGameObject(struct Object *for_blenderobject); - - void RegisterGameMesh(RAS_MeshObject *gamemesh, struct Mesh *for_blendermesh); - RAS_MeshObject *FindGameMesh(struct Mesh *for_blendermesh/*, unsigned int onlayer*/); - - void RegisterPolyMaterial(RAS_IPolyMaterial *polymat); - - void RegisterBlenderMaterial(BL_Material *mat); - - void RegisterInterpolatorList(BL_InterpolatorList *adtList, struct AnimData *for_adt); - BL_InterpolatorList *FindInterpolatorList(struct AnimData *for_adt); - - void RegisterGameActuator(SCA_IActuator *act, struct bActuator *for_actuator); - SCA_IActuator *FindGameActuator(struct bActuator *for_actuator); - - void RegisterGameController(SCA_IController *cont, struct bController *for_controller); - SCA_IController *FindGameController(struct bController *for_controller); - - void RegisterWorldInfo(KX_WorldInfo *worldinfo); - - virtual void ResetPhysicsObjectsAnimationIpo(bool clearIpo); - - ///this is for reseting the position,rotation and scale of the gameobjet that is not dynamic - virtual void resetNoneDynamicObjectToIpo(); - - ///this generates ipo curves for position, rotation, allowing to use game physics in animation - virtual void WritePhysicsObjectToAnimationIpo(int frameNumber); - virtual void TestHandlesPhysicsObjectToAnimationIpo(); - - // use blender materials - virtual void SetMaterials(bool val); - virtual bool GetMaterials(); - - // use blender glsl materials - virtual void SetGLSLMaterials(bool val); - virtual bool GetGLSLMaterials(); - - struct Scene* GetBlenderSceneForName(const STR_String& name); - -// struct Main* GetMain() { return m_maggie; }; - struct Main* GetMainDynamicPath(const char *path); - vector &GetMainDynamic(); - - bool LinkBlendFile(const char *path, char *group, KX_Scene *scene_merge, char **err_str); - bool MergeScene(KX_Scene *to, KX_Scene *from); - RAS_MeshObject *ConvertMeshSpecial(KX_Scene* kx_scene, Main *maggie, const char *name); - bool FreeBlendFile(struct Main *maggie); - bool FreeBlendFile(const char *path); - - void PrintStats() { - printf("BGE STATS!\n"); - - printf("\nAssets...\n"); - printf("\t m_worldinfos: %d\n", (int)m_worldinfos.size()); - printf("\t m_polymaterials: %d\n", (int)m_polymaterials.size()); - printf("\t m_meshobjects: %d\n", (int)m_meshobjects.size()); - printf("\t m_materials: %d\n", (int)m_materials.size()); - - printf("\nMappings...\n"); - printf("\t m_map_blender_to_gameobject: %d\n", (int)m_map_blender_to_gameobject.size()); - printf("\t m_map_mesh_to_gamemesh: %d\n", (int)m_map_mesh_to_gamemesh.size()); - printf("\t m_map_blender_to_gameactuator: %d\n", (int)m_map_blender_to_gameactuator.size()); - printf("\t m_map_blender_to_gamecontroller: %d\n", (int)m_map_blender_to_gamecontroller.size()); - printf("\t m_map_blender_to_gameAdtList: %d\n", (int)m_map_blender_to_gameAdtList.size()); - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_printmemlist_pydict(); -#endif -// /printf("\t m_ketsjiEngine->m_scenes: %d\n", m_ketsjiEngine->CurrentScenes()->size()); - } - - - -#ifndef DISABLE_PYTHON - PyObject *GetPyNamespace(); -#endif - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderSceneConverter"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_BLENDERSCENECONVERTER_H - diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp deleted file mode 100644 index 9b41470769f..00000000000 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ /dev/null @@ -1,1056 +0,0 @@ -/** -* $Id$ -* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** -* Convert Blender actuators for use in the GameEngine -*/ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif //WIN32 - -#define BLENDER_HACK_DTIME 0.02 - -#include "MEM_guardedalloc.h" - -#include "KX_BlenderSceneConverter.h" -#include "KX_ConvertActuators.h" -#include "AUD_C-API.h" -// Actuators -//SCA logiclibrary native logicbricks -#include "SCA_PropertyActuator.h" -#include "SCA_LogicManager.h" -#include "SCA_RandomActuator.h" -#include "SCA_2DFilterActuator.h" - -// Ketsji specific logicbricks -#include "KX_SceneActuator.h" -#include "KX_IpoActuator.h" -#include "KX_SoundActuator.h" -#include "KX_ObjectActuator.h" -#include "KX_TrackToActuator.h" -#include "KX_ConstraintActuator.h" -#include "KX_CameraActuator.h" -#include "KX_GameActuator.h" -#include "KX_StateActuator.h" -#include "KX_VisibilityActuator.h" -#include "KX_SCA_AddObjectActuator.h" -#include "KX_SCA_EndObjectActuator.h" -#include "KX_SCA_ReplaceMeshActuator.h" -#include "KX_ParentActuator.h" -#include "KX_SCA_DynamicActuator.h" - -#include "KX_Scene.h" -#include "KX_KetsjiEngine.h" - -#include "IntValue.h" -#include "KX_GameObject.h" - -/* This little block needed for linking to Blender... */ -#include "BKE_text.h" -#include "BLI_blenlib.h" - -#define FILE_MAX 240 // repeated here to avoid dependency from BKE_utildefines.h - -#include "KX_NetworkMessageActuator.h" - -#ifdef WIN32 -#include "BLI_winstuff.h" -#endif - -#include "DNA_object_types.h" -#include "DNA_sound_types.h" -#include "DNA_scene_types.h" -#include "DNA_actuator_types.h" -#include "DNA_packedFile_types.h" -#include "BL_ActionActuator.h" -#include "BL_ShapeActionActuator.h" -#include "BL_ArmatureActuator.h" -/* end of blender include block */ - -#include "BL_BlenderDataConversion.h" - -/** -KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set -*/ - -#define KX_BLENDERTRUNC(x) (( x < 0.0001 && x > -0.0001 ) ? 0.0 : x) - -void BL_ConvertActuators(char* maggiename, - struct Object* blenderobject, - KX_GameObject* gameobj, - SCA_LogicManager* logicmgr, - KX_Scene* scene, - KX_KetsjiEngine* ketsjiEngine, - int activeLayerBitInfo, - bool isInActiveLayer, - RAS_IRenderTools* rendertools, - KX_BlenderSceneConverter* converter - ) -{ - - int uniqueint = 0; - int actcount = 0; - int executePriority = 0; - bActuator* bact = (bActuator*) blenderobject->actuators.first; - while (bact) - { - actcount++; - bact = bact->next; - } - gameobj->ReserveActuator(actcount); - bact = (bActuator*) blenderobject->actuators.first; - while(bact) - { - STR_String uniquename = bact->name; - STR_String& objectname = gameobj->GetName(); - - SCA_IActuator* baseact = NULL; - switch (bact->type) - { - case ACT_OBJECT: - { - bObjectActuator* obact = (bObjectActuator*) bact->data; - KX_GameObject* obref = NULL; - MT_Vector3 forcevec(KX_BLENDERTRUNC(obact->forceloc[0]), - KX_BLENDERTRUNC(obact->forceloc[1]), - KX_BLENDERTRUNC(obact->forceloc[2])); - MT_Vector3 torquevec(obact->forcerot[0],obact->forcerot[1],obact->forcerot[2]); - MT_Vector3 dlocvec ( KX_BLENDERTRUNC(obact->dloc[0]), - KX_BLENDERTRUNC(obact->dloc[1]), - KX_BLENDERTRUNC(obact->dloc[2])); - MT_Vector3 drotvec ( KX_BLENDERTRUNC(obact->drot[0]),obact->drot[1],obact->drot[2]); - MT_Vector3 linvelvec ( KX_BLENDERTRUNC(obact->linearvelocity[0]), - KX_BLENDERTRUNC(obact->linearvelocity[1]), - KX_BLENDERTRUNC(obact->linearvelocity[2])); - MT_Vector3 angvelvec ( KX_BLENDERTRUNC(obact->angularvelocity[0]), - KX_BLENDERTRUNC(obact->angularvelocity[1]), - KX_BLENDERTRUNC(obact->angularvelocity[2])); - short damping = obact->damping; - - drotvec /= BLENDER_HACK_DTIME; - //drotvec /= BLENDER_HACK_DTIME; - drotvec *= MT_2_PI/360.0; - //dlocvec /= BLENDER_HACK_DTIME; - //linvelvec /= BLENDER_HACK_DTIME; - //angvelvec /= BLENDER_HACK_DTIME; - - /* Blender uses a bit vector internally for the local-flags. In */ - /* KX, we have four bools. The compiler should be smart enough */ - /* to do the right thing. We need to explicitly convert here! */ - - KX_LocalFlags bitLocalFlag; - - bitLocalFlag.Force = bool((obact->flag & ACT_FORCE_LOCAL)!=0); - bitLocalFlag.Torque = bool((obact->flag & ACT_TORQUE_LOCAL) !=0);//rlocal; - bitLocalFlag.DLoc = bool((obact->flag & ACT_DLOC_LOCAL)!=0); - bitLocalFlag.DRot = bool((obact->flag & ACT_DROT_LOCAL)!=0); - bitLocalFlag.LinearVelocity = bool((obact->flag & ACT_LIN_VEL_LOCAL)!=0); - bitLocalFlag.AngularVelocity = bool((obact->flag & ACT_ANG_VEL_LOCAL)!=0); - bitLocalFlag.ServoControl = bool(obact->type == ACT_OBJECT_SERVO); - bitLocalFlag.AddOrSetLinV = bool((obact->flag & ACT_ADD_LIN_VEL)!=0); - if (obact->reference && bitLocalFlag.ServoControl) - { - obref = converter->FindGameObject(obact->reference); - } - - KX_ObjectActuator* tmpbaseact = new KX_ObjectActuator(gameobj, - obref, - forcevec.getValue(), - torquevec.getValue(), - dlocvec.getValue(), - drotvec.getValue(), - linvelvec.getValue(), - angvelvec.getValue(), - damping, - bitLocalFlag - ); - baseact = tmpbaseact; - break; - } - case ACT_ACTION: - { - if (blenderobject->type==OB_ARMATURE){ - bActionActuator* actact = (bActionActuator*) bact->data; - STR_String propname = (actact->name ? actact->name : ""); - STR_String propframe = (actact->frameProp ? actact->frameProp : ""); - - BL_ActionActuator* tmpbaseact = new BL_ActionActuator( - gameobj, - propname, - propframe, - actact->sta, - actact->end, - actact->act, - actact->type, // + 1, because Blender starts to count at zero, - actact->blendin, - actact->priority, - actact->end_reset, - actact->stridelength - // Ketsji at 1, because zero is reserved for "NoDef" - ); - baseact= tmpbaseact; - break; - } - else - printf ("Discarded action actuator from non-armature object [%s]\n", blenderobject->id.name+2); - } - case ACT_SHAPEACTION: - { - if (blenderobject->type==OB_MESH){ - bActionActuator* actact = (bActionActuator*) bact->data; - STR_String propname = (actact->name ? actact->name : ""); - STR_String propframe = (actact->frameProp ? actact->frameProp : ""); - - BL_ShapeActionActuator* tmpbaseact = new BL_ShapeActionActuator( - gameobj, - propname, - propframe, - actact->sta, - actact->end, - actact->act, - actact->type, // + 1, because Blender starts to count at zero, - actact->blendin, - actact->priority, - actact->stridelength - // Ketsji at 1, because zero is reserved for "NoDef" - ); - baseact= tmpbaseact; - break; - } - else - printf ("Discarded shape action actuator from non-mesh object [%s]\n", blenderobject->id.name+2); - } - case ACT_IPO: - { - bIpoActuator* ipoact = (bIpoActuator*) bact->data; - bool ipochild = (ipoact->flag & ACT_IPOCHILD) !=0; - STR_String propname = ipoact->name; - STR_String frameProp = ipoact->frameProp; - // first bit? - bool ipo_as_force = (ipoact->flag & ACT_IPOFORCE); - bool local = (ipoact->flag & ACT_IPOLOCAL); - bool ipo_add = (ipoact->flag & ACT_IPOADD); - - KX_IpoActuator* tmpbaseact = new KX_IpoActuator( - gameobj, - propname , - frameProp, - ipoact->sta, - ipoact->end, - ipochild, - ipoact->type + 1, // + 1, because Blender starts to count at zero, - // Ketsji at 1, because zero is reserved for "NoDef" - ipo_as_force, - ipo_add, - local); - baseact = tmpbaseact; - break; - } - case ACT_LAMP: - { - break; - } - case ACT_CAMERA: - { - bCameraActuator *camact = (bCameraActuator *) bact->data; - if (camact->ob) { - KX_GameObject *tmpgob = converter->FindGameObject(camact->ob); - - /* visifac, fac and axis are not copied from the struct... */ - /* that's some internal state... */ - KX_CameraActuator *tmpcamact - = new KX_CameraActuator(gameobj, - tmpgob, - camact->height, - camact->min, - camact->max, - camact->axis=='x'); - baseact = tmpcamact; - } - break; - } - case ACT_MESSAGE: - { - bMessageActuator *msgAct = (bMessageActuator *) bact->data; - - /** - * Get the name of the properties that objects must own that - * we're sending to, if present - */ - STR_String toPropName = (msgAct->toPropName - ? (char*) msgAct->toPropName - : ""); - - /** - * Get the Message Subject to send. - */ - STR_String subject = (msgAct->subject - ? (char*) msgAct->subject - : ""); - - /** - * Get the bodyType - */ - int bodyType = msgAct->bodyType; - - /** - * Get the body (text message or property name whose value - * we'll be sending, might be empty - */ - STR_String body = (msgAct->body - ? (char*) msgAct->body - : ""); - - KX_NetworkMessageActuator *tmpmsgact = - new KX_NetworkMessageActuator( - gameobj, // actuator controlling object - scene->GetNetworkScene(), // needed for replication - toPropName, - subject, - bodyType, - body); - baseact = tmpmsgact; - break; - } - case ACT_MATERIAL: - { - break; - } - case ACT_SOUND: - { - bSoundActuator* soundact = (bSoundActuator*) bact->data; - /* get type, and possibly a start and end frame */ - KX_SoundActuator::KX_SOUNDACT_TYPE - soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF; - - switch(soundact->type) { - case ACT_SND_PLAY_STOP_SOUND: - soundActuatorType = KX_SoundActuator::KX_SOUNDACT_PLAYSTOP; - break; - case ACT_SND_PLAY_END_SOUND: - soundActuatorType = KX_SoundActuator::KX_SOUNDACT_PLAYEND; - break; - case ACT_SND_LOOP_STOP_SOUND: - soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPSTOP; - break; - case ACT_SND_LOOP_END_SOUND: - soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPEND; - break; - case ACT_SND_LOOP_BIDIRECTIONAL_SOUND: - soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL; - break; - case ACT_SND_LOOP_BIDIRECTIONAL_STOP_SOUND: - soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP; - break; - - default: - /* This is an error!!! */ - soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF; - } - - if (soundActuatorType != KX_SoundActuator::KX_SOUNDACT_NODEF) - { - bSound* sound = soundact->sound; - bool is3d = soundact->flag & ACT_SND_3D_SOUND ? true : false; - AUD_Sound* snd_sound = NULL; - KX_3DSoundSettings settings; - settings.cone_inner_angle = soundact->sound3D.cone_inner_angle; - settings.cone_outer_angle = soundact->sound3D.cone_outer_angle; - settings.cone_outer_gain = soundact->sound3D.cone_outer_gain; - settings.max_distance = soundact->sound3D.max_distance; - settings.max_gain = soundact->sound3D.max_gain; - settings.min_gain = soundact->sound3D.min_gain; - settings.reference_distance = soundact->sound3D.reference_distance; - settings.rolloff_factor = soundact->sound3D.rolloff_factor; - - if(!sound) - { - std::cout << "WARNING: Sound actuator \"" << bact->name << - "\" from object \"" << blenderobject->id.name+2 << - "\" has no sound datablock." << std::endl; - } - else - snd_sound = sound->playback_handle; - KX_SoundActuator* tmpsoundact = - new KX_SoundActuator(gameobj, - snd_sound, - soundact->volume, - exp((soundact->pitch / 12.0) * log(2.0)), - is3d, - settings, - soundActuatorType); - - tmpsoundact->SetName(bact->name); - baseact = tmpsoundact; - } - break; - } - case ACT_PROPERTY: - { - bPropertyActuator* propact = (bPropertyActuator*) bact->data; - SCA_IObject* destinationObj = NULL; - - /* - here the destinationobject is searched. problem with multiple scenes: other scenes - have not been converted yet, so the destobj will not be found, so the prop will - not be copied. - possible solutions: - - convert everything when possible and not realtime only when needed. - - let the object-with-property report itself to the act when converted - */ - if (propact->ob) - destinationObj = converter->FindGameObject(propact->ob); - - SCA_PropertyActuator* tmppropact = new SCA_PropertyActuator( - gameobj, - destinationObj, - propact->name, - propact->value, - propact->type+1); // + 1 because Ketsji Logic starts - // with 0 for KX_ACT_PROP_NODEF - baseact = tmppropact; - break; - } - case ACT_EDIT_OBJECT: - { - bEditObjectActuator *editobact - = (bEditObjectActuator *) bact->data; - /* There are four different kinds of 'edit object' thingies */ - /* The alternative to this lengthy conversion is packing */ - /* several actuators in one, which is not very nice design.. */ - switch (editobact->type) { - case ACT_EDOB_ADD_OBJECT: - { - - // does the 'original' for replication exists, and - // is it in a non-active layer ? - SCA_IObject* originalval = NULL; - if (editobact->ob) - { - if (editobact->ob->lay & activeLayerBitInfo) - { - fprintf(stderr, "Warning, object \"%s\" from AddObject actuator \"%s\" is not in a hidden layer.\n", objectname.Ptr(), uniquename.Ptr()); - } - else { - originalval = converter->FindGameObject(editobact->ob); - } - } - - KX_SCA_AddObjectActuator* tmpaddact = - new KX_SCA_AddObjectActuator( - gameobj, - originalval, - editobact->time, - scene, - editobact->linVelocity, - (editobact->localflag & ACT_EDOB_LOCAL_LINV)!=0, - editobact->angVelocity, - (editobact->localflag & ACT_EDOB_LOCAL_ANGV)!=0 - ); - - //editobact->ob to gameobj - baseact = tmpaddact; - } - break; - case ACT_EDOB_END_OBJECT: - { - KX_SCA_EndObjectActuator* tmpendact - = new KX_SCA_EndObjectActuator(gameobj,scene); - baseact = tmpendact; - } - break; - case ACT_EDOB_REPLACE_MESH: - { - RAS_MeshObject *tmpmesh = NULL; - if (editobact->me) - tmpmesh = BL_ConvertMesh( - editobact->me, - blenderobject, - scene, - converter - ); - - KX_SCA_ReplaceMeshActuator* tmpreplaceact - = new KX_SCA_ReplaceMeshActuator( - gameobj, - tmpmesh, - scene, - (editobact->flag & ACT_EDOB_REPLACE_MESH_NOGFX)==0, - (editobact->flag & ACT_EDOB_REPLACE_MESH_PHYS)!=0 - - ); - - baseact = tmpreplaceact; - } - break; - case ACT_EDOB_TRACK_TO: - { - SCA_IObject* originalval = NULL; - if (editobact->ob) - originalval = converter->FindGameObject(editobact->ob); - - KX_TrackToActuator* tmptrackact - = new KX_TrackToActuator(gameobj, - originalval, - editobact->time, - editobact->flag, - blenderobject->trackflag, - blenderobject->upflag - ); - baseact = tmptrackact; - break; - } - case ACT_EDOB_DYNAMICS: - { - KX_SCA_DynamicActuator* tmpdynact - = new KX_SCA_DynamicActuator(gameobj, - editobact->dyn_operation, - editobact->mass - ); - baseact = tmpdynact; - } - } - break; - } - case ACT_CONSTRAINT: - { - float min = 0.0, max = 0.0; - char *prop = NULL; - KX_ConstraintActuator::KX_CONSTRAINTTYPE locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_NODEF; - bConstraintActuator *conact - = (bConstraintActuator*) bact->data; - /* convert settings... degrees in the ui become radians */ - /* internally */ - if (conact->type == ACT_CONST_TYPE_ORI) { - min = (MT_2_PI * conact->minloc[0])/360.0; - max = (MT_2_PI * conact->maxloc[0])/360.0; - switch (conact->mode) { - case ACT_CONST_DIRPX: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX; - break; - case ACT_CONST_DIRPY: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIY; - break; - case ACT_CONST_DIRPZ: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIZ; - break; - } - } else if (conact->type == ACT_CONST_TYPE_DIST) { - switch (conact->mode) { - case ACT_CONST_DIRPX: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPX; - min = conact->minloc[0]; - max = conact->maxloc[0]; - break; - case ACT_CONST_DIRPY: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPY; - min = conact->minloc[1]; - max = conact->maxloc[1]; - break; - case ACT_CONST_DIRPZ: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPZ; - min = conact->minloc[2]; - max = conact->maxloc[2]; - break; - case ACT_CONST_DIRNX: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNX; - min = conact->minloc[0]; - max = conact->maxloc[0]; - break; - case ACT_CONST_DIRNY: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNY; - min = conact->minloc[1]; - max = conact->maxloc[1]; - break; - case ACT_CONST_DIRNZ: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNZ; - min = conact->minloc[2]; - max = conact->maxloc[2]; - break; - } - prop = conact->matprop; - } else if (conact->type == ACT_CONST_TYPE_FH) { - switch (conact->mode) { - case ACT_CONST_DIRPX: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPX; - min = conact->minloc[0]; - max = conact->maxloc[0]; - break; - case ACT_CONST_DIRPY: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPY; - min = conact->minloc[1]; - max = conact->maxloc[1]; - break; - case ACT_CONST_DIRPZ: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPZ; - min = conact->minloc[2]; - max = conact->maxloc[2]; - break; - case ACT_CONST_DIRNX: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNX; - min = conact->minloc[0]; - max = conact->maxloc[0]; - break; - case ACT_CONST_DIRNY: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNY; - min = conact->minloc[1]; - max = conact->maxloc[1]; - break; - case ACT_CONST_DIRNZ: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNZ; - min = conact->minloc[2]; - max = conact->maxloc[2]; - break; - } - prop = conact->matprop; - } else { - switch (conact->flag) { - case ACT_CONST_LOCX: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCX; - min = conact->minloc[0]; - max = conact->maxloc[0]; - break; - case ACT_CONST_LOCY: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCY; - min = conact->minloc[1]; - max = conact->maxloc[1]; - break; - case ACT_CONST_LOCZ: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCZ; - min = conact->minloc[2]; - max = conact->maxloc[2]; - break; - case ACT_CONST_ROTX: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTX; - min = MT_2_PI * conact->minrot[0] / 360.0; - max = MT_2_PI * conact->maxrot[0] / 360.0; - break; - case ACT_CONST_ROTY: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTY; - min = MT_2_PI * conact->minrot[1] / 360.0; - max = MT_2_PI * conact->maxrot[1] / 360.0; - break; - case ACT_CONST_ROTZ: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTZ; - min = MT_2_PI * conact->minrot[2] / 360.0; - max = MT_2_PI * conact->maxrot[2] / 360.0; - break; - default: - ; /* error */ - } - } - KX_ConstraintActuator *tmpconact - = new KX_ConstraintActuator(gameobj, - conact->damp, - conact->rotdamp, - min, - max, - conact->maxrot, - locrot, - conact->time, - conact->flag, - prop); - baseact = tmpconact; - break; - } - case ACT_GROUP: - { - // deprecated - } - break; - case ACT_SCENE: - { - bSceneActuator *sceneact = (bSceneActuator *) bact->data; - STR_String nextSceneName(""); - - KX_SceneActuator* tmpsceneact; - int mode = KX_SceneActuator::KX_SCENE_NODEF; - KX_Camera *cam = NULL; - //KX_Scene* scene = NULL; - switch (sceneact->type) - { - case ACT_SCENE_RESUME: - case ACT_SCENE_SUSPEND: - case ACT_SCENE_ADD_FRONT: - case ACT_SCENE_ADD_BACK: - case ACT_SCENE_REMOVE: - case ACT_SCENE_SET: - { - switch (sceneact->type) - { - case ACT_SCENE_RESUME: - mode = KX_SceneActuator::KX_SCENE_RESUME; - break; - case ACT_SCENE_SUSPEND: - mode = KX_SceneActuator::KX_SCENE_SUSPEND; - break; - case ACT_SCENE_ADD_FRONT: - mode = KX_SceneActuator::KX_SCENE_ADD_FRONT_SCENE; - break; - case ACT_SCENE_ADD_BACK: - mode = KX_SceneActuator::KX_SCENE_ADD_BACK_SCENE; - break; - case ACT_SCENE_REMOVE: - mode = KX_SceneActuator::KX_SCENE_REMOVE_SCENE; - break; - case ACT_SCENE_SET: - default: - mode = KX_SceneActuator::KX_SCENE_SET_SCENE; - break; - }; - - if (sceneact->scene) - { - nextSceneName = sceneact->scene->id.name + 2; // this '2' is necessary to remove prefix 'SC' - } - - break; - } - case ACT_SCENE_CAMERA: - mode = KX_SceneActuator::KX_SCENE_SET_CAMERA; - if (sceneact->camera) - { - cam = (KX_Camera*) converter->FindGameObject(sceneact->camera); - } - break; - case ACT_SCENE_RESTART: - { - - mode = KX_SceneActuator::KX_SCENE_RESTART; - break; - } - default: - ; /* flag error */ - } - tmpsceneact = new KX_SceneActuator(gameobj, - mode, - scene, - ketsjiEngine, - nextSceneName, - cam); - baseact = tmpsceneact; - break; - } - case ACT_GAME: - { - bGameActuator *gameact = (bGameActuator *) bact->data; - KX_GameActuator* tmpgameact; - STR_String filename = maggiename; - STR_String loadinganimationname = ""; - int mode = KX_GameActuator::KX_GAME_NODEF; - switch (gameact->type) - { - case ACT_GAME_LOAD: - { - mode = KX_GameActuator::KX_GAME_LOAD; - filename = gameact->filename; - loadinganimationname = gameact->loadaniname; - break; - } - case ACT_GAME_START: - { - mode = KX_GameActuator::KX_GAME_START; - filename = gameact->filename; - loadinganimationname = gameact->loadaniname; - break; - } - case ACT_GAME_RESTART: - { - mode = KX_GameActuator::KX_GAME_RESTART; - break; - } - case ACT_GAME_QUIT: - { - mode = KX_GameActuator::KX_GAME_QUIT; - break; - } - case ACT_GAME_SAVECFG: - { - mode = KX_GameActuator::KX_GAME_SAVECFG; - break; - } - case ACT_GAME_LOADCFG: - { - mode = KX_GameActuator::KX_GAME_LOADCFG; - break; - } - default: - ; /* flag error */ - } - tmpgameact = new KX_GameActuator(gameobj, - mode, - filename, - loadinganimationname, - scene, - ketsjiEngine); - baseact = tmpgameact; - - break; - } - case ACT_RANDOM: - { - bRandomActuator *randAct - = (bRandomActuator *) bact->data; - - unsigned long seedArg = randAct->seed; - if (seedArg == 0) - { - seedArg = (int)(ketsjiEngine->GetRealTime()*100000.0); - seedArg ^= (intptr_t)randAct; - } - SCA_RandomActuator::KX_RANDOMACT_MODE modeArg - = SCA_RandomActuator::KX_RANDOMACT_NODEF; - SCA_RandomActuator *tmprandomact; - float paraArg1 = 0.0; - float paraArg2 = 0.0; - - switch (randAct->distribution) { - case ACT_RANDOM_BOOL_CONST: - modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_CONST; - paraArg1 = (float) randAct->int_arg_1; - break; - case ACT_RANDOM_BOOL_UNIFORM: - modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_UNIFORM; - break; - case ACT_RANDOM_BOOL_BERNOUILLI: - paraArg1 = randAct->float_arg_1; - modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_BERNOUILLI; - break; - case ACT_RANDOM_INT_CONST: - modeArg = SCA_RandomActuator::KX_RANDOMACT_INT_CONST; - paraArg1 = (float) randAct->int_arg_1; - break; - case ACT_RANDOM_INT_UNIFORM: - paraArg1 = (float) randAct->int_arg_1; - paraArg2 = (float) randAct->int_arg_2; - modeArg = SCA_RandomActuator::KX_RANDOMACT_INT_UNIFORM; - break; - case ACT_RANDOM_INT_POISSON: - paraArg1 = randAct->float_arg_1; - modeArg = SCA_RandomActuator::KX_RANDOMACT_INT_POISSON; - break; - case ACT_RANDOM_FLOAT_CONST: - paraArg1 = randAct->float_arg_1; - modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_CONST; - break; - case ACT_RANDOM_FLOAT_UNIFORM: - paraArg1 = randAct->float_arg_1; - paraArg2 = randAct->float_arg_2; - modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_UNIFORM; - break; - case ACT_RANDOM_FLOAT_NORMAL: - paraArg1 = randAct->float_arg_1; - paraArg2 = randAct->float_arg_2; - modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_NORMAL; - break; - case ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL: - paraArg1 = randAct->float_arg_1; - modeArg = SCA_RandomActuator::KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL; - break; - default: - ; /* error */ - } - tmprandomact = new SCA_RandomActuator(gameobj, - seedArg, - modeArg, - paraArg1, - paraArg2, - randAct->propname); - baseact = tmprandomact; - } - break; - - case ACT_VISIBILITY: - { - bVisibilityActuator *vis_act = (bVisibilityActuator *) bact->data; - KX_VisibilityActuator * tmp_vis_act = NULL; - bool v = ((vis_act->flag & ACT_VISIBILITY_INVISIBLE) != 0); - bool o = ((vis_act->flag & ACT_VISIBILITY_OCCLUSION) != 0); - bool recursive = ((vis_act->flag & ACT_VISIBILITY_RECURSIVE) != 0); - - tmp_vis_act = new KX_VisibilityActuator(gameobj, !v, o, recursive); - - baseact = tmp_vis_act; - } - break; - - case ACT_STATE: - { - bStateActuator *sta_act = (bStateActuator *) bact->data; - KX_StateActuator * tmp_sta_act = NULL; - - tmp_sta_act = - new KX_StateActuator(gameobj, sta_act->type, sta_act->mask); - - baseact = tmp_sta_act; - } - break; - - case ACT_2DFILTER: - { - bTwoDFilterActuator *_2dfilter = (bTwoDFilterActuator*) bact->data; - SCA_2DFilterActuator *tmp = NULL; - - RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode; - switch(_2dfilter->type) - { - case ACT_2DFILTER_MOTIONBLUR: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR; - break; - case ACT_2DFILTER_BLUR: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_BLUR; - break; - case ACT_2DFILTER_SHARPEN: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_SHARPEN; - break; - case ACT_2DFILTER_DILATION: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_DILATION; - break; - case ACT_2DFILTER_EROSION: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_EROSION; - break; - case ACT_2DFILTER_LAPLACIAN: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_LAPLACIAN; - break; - case ACT_2DFILTER_SOBEL: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_SOBEL; - break; - case ACT_2DFILTER_PREWITT: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_PREWITT; - break; - case ACT_2DFILTER_GRAYSCALE: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_GRAYSCALE; - break; - case ACT_2DFILTER_SEPIA: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_SEPIA; - break; - case ACT_2DFILTER_INVERT: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_INVERT; - break; - case ACT_2DFILTER_CUSTOMFILTER: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_CUSTOMFILTER; - break; - case ACT_2DFILTER_NOFILTER: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_NOFILTER; - break; - case ACT_2DFILTER_DISABLED: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_DISABLED; - break; - case ACT_2DFILTER_ENABLED: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_ENABLED; - break; - default: - filtermode = RAS_2DFilterManager::RAS_2DFILTER_NOFILTER; - break; - } - - tmp = new SCA_2DFilterActuator(gameobj, filtermode, _2dfilter->flag, - _2dfilter->float_arg,_2dfilter->int_arg,ketsjiEngine->GetRasterizer(),scene); - - if (_2dfilter->text) - { - char *buf; - // this is some blender specific code - buf = txt_to_buf(_2dfilter->text); - if (buf) - { - tmp->SetShaderText(buf); - MEM_freeN(buf); - } - } - - baseact = tmp; - - } - break; - case ACT_PARENT: - { - bParentActuator *parAct = (bParentActuator *) bact->data; - int mode = KX_ParentActuator::KX_PARENT_NODEF; - bool addToCompound = true; - bool ghost = true; - KX_GameObject *tmpgob = NULL; - - switch(parAct->type) - { - case ACT_PARENT_SET: - mode = KX_ParentActuator::KX_PARENT_SET; - tmpgob = converter->FindGameObject(parAct->ob); - addToCompound = !(parAct->flag & ACT_PARENT_COMPOUND); - ghost = !(parAct->flag & ACT_PARENT_GHOST); - break; - case ACT_PARENT_REMOVE: - mode = KX_ParentActuator::KX_PARENT_REMOVE; - tmpgob = NULL; - break; - } - - KX_ParentActuator *tmpparact - = new KX_ParentActuator(gameobj, - mode, - addToCompound, - ghost, - tmpgob); - baseact = tmpparact; - break; - } - - case ACT_ARMATURE: - { - bArmatureActuator* armAct = (bArmatureActuator*) bact->data; - KX_GameObject *tmpgob = converter->FindGameObject(armAct->target); - KX_GameObject *subgob = converter->FindGameObject(armAct->subtarget); - BL_ArmatureActuator* tmparmact = new BL_ArmatureActuator(gameobj, armAct->type, armAct->posechannel, armAct->constraint, tmpgob, subgob, armAct->weight); - baseact = tmparmact; - break; - } - default: - ; /* generate some error */ - } - - if (baseact) - { - baseact->SetExecutePriority(executePriority++); - uniquename += "#ACT#"; - uniqueint++; - CIntValue* uniqueval = new CIntValue(uniqueint); - uniquename += uniqueval->GetText(); - uniqueval->Release(); - baseact->SetName(bact->name); - //gameobj->SetProperty(uniquename,baseact); - gameobj->AddActuator(baseact); - - converter->RegisterGameActuator(baseact, bact); - // done with baseact, release it - baseact->Release(); - } - - bact = bact->next; - } -} - - diff --git a/source/gameengine/Converter/KX_ConvertActuators.h b/source/gameengine/Converter/KX_ConvertActuators.h deleted file mode 100644 index 82624f94b49..00000000000 --- a/source/gameengine/Converter/KX_ConvertActuators.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_CONVERTACTUATORS_H -#define __KX_CONVERTACTUATORS_H - -void BL_ConvertActuators(char* maggiename, - struct Object* blenderobject, - class KX_GameObject* gameobj, - class SCA_LogicManager* logicmgr, - class KX_Scene* scene, - class KX_KetsjiEngine* ketsjiEngine, - int activeLayerBitInfo, - bool isInActiveLayer, - class RAS_IRenderTools* rendertools, - class KX_BlenderSceneConverter* converter); - - -#endif //__KX_CONVERTACTUATORS_H - diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp b/source/gameengine/Converter/KX_ConvertControllers.cpp deleted file mode 100644 index 858db6d76a1..00000000000 --- a/source/gameengine/Converter/KX_ConvertControllers.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "MEM_guardedalloc.h" - -#include "KX_BlenderSceneConverter.h" -#include "KX_ConvertControllers.h" -#include "KX_Python.h" - -// Controller -#include "SCA_ANDController.h" -#include "SCA_ORController.h" -#include "SCA_NANDController.h" -#include "SCA_NORController.h" -#include "SCA_XORController.h" -#include "SCA_XNORController.h" -#include "SCA_PythonController.h" -#include "SCA_ExpressionController.h" - -#include "SCA_LogicManager.h" -#include "KX_GameObject.h" -#include "IntValue.h" - -/* This little block needed for linking to Blender... */ -#ifdef WIN32 -#include "BLI_winstuff.h" -#endif - -#include "DNA_object_types.h" -#include "DNA_controller_types.h" -#include "DNA_text_types.h" - -#include "BKE_text.h" - -#include "BLI_blenlib.h" - -/* end of blender include block */ - - - static void -LinkControllerToActuators( - SCA_IController *game_controller, - bController* bcontr, - SCA_LogicManager* logicmgr, - KX_BlenderSceneConverter* converter -) { - // Iterate through the actuators of the game blender - // controller and find the corresponding ketsji actuator. - - game_controller->ReserveActuator(bcontr->totlinks); - for (int i=0;itotlinks;i++) - { - bActuator* bact = (bActuator*) bcontr->links[i]; - SCA_IActuator *game_actuator = converter->FindGameActuator(bact); - if (game_actuator) { - logicmgr->RegisterToActuator(game_controller, game_actuator); - } - } -} - - -void BL_ConvertControllers( - struct Object* blenderobject, - class KX_GameObject* gameobj, - SCA_LogicManager* logicmgr, - int activeLayerBitInfo, - bool isInActiveLayer, - KX_BlenderSceneConverter* converter -) { - int uniqueint=0; - int count = 0; - int executePriority=0; - bController* bcontr = (bController*)blenderobject->controllers.first; - while (bcontr) - { - bcontr = bcontr->next; - count++; - } - gameobj->ReserveController(count); - bcontr = (bController*)blenderobject->controllers.first; - while (bcontr) - { - SCA_IController* gamecontroller = NULL; - switch(bcontr->type) - { - case CONT_LOGIC_AND: - { - gamecontroller = new SCA_ANDController(gameobj); - break; - } - case CONT_LOGIC_OR: - { - gamecontroller = new SCA_ORController(gameobj); - break; - } - case CONT_LOGIC_NAND: - { - gamecontroller = new SCA_NANDController(gameobj); - break; - } - case CONT_LOGIC_NOR: - { - gamecontroller = new SCA_NORController(gameobj); - break; - } - case CONT_LOGIC_XOR: - { - gamecontroller = new SCA_XORController(gameobj); - break; - } - case CONT_LOGIC_XNOR: - { - gamecontroller = new SCA_XNORController(gameobj); - break; - } - case CONT_EXPRESSION: - { - bExpressionCont* bexpcont = (bExpressionCont*) bcontr->data; - STR_String expressiontext = STR_String(bexpcont->str); - if (expressiontext.Length() > 0) - { - gamecontroller = new SCA_ExpressionController(gameobj,expressiontext); - } - break; - } - case CONT_PYTHON: - { - bPythonCont* pycont = (bPythonCont*) bcontr->data; - SCA_PythonController* pyctrl = new SCA_PythonController(gameobj, pycont->mode); - gamecontroller = pyctrl; -#ifndef DISABLE_PYTHON - - pyctrl->SetNamespace(converter->GetPyNamespace()); - - if(pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) { - if (pycont->text) - { - char *buf; - // this is some blender specific code - buf= txt_to_buf(pycont->text); - if (buf) - { - pyctrl->SetScriptText(STR_String(buf)); - pyctrl->SetScriptName(pycont->text->id.name+2); - MEM_freeN(buf); - } - - } - } - else { - /* let the controller print any warnings here when importing */ - pyctrl->SetScriptText(STR_String(pycont->module)); - pyctrl->SetScriptName(pycont->module); /* will be something like module.func so using it as the name is OK */ - } - - if(pycont->flag & CONT_PY_DEBUG) { - printf("\nDebuging \"%s\", module for object %s\n\texpect worse performance.\n", pycont->module, blenderobject->id.name+2); - pyctrl->SetDebug(true); - } - -#endif // DISABLE_PYTHON - - break; - } - default: - { - - } - } - - if (gamecontroller) - { - LinkControllerToActuators(gamecontroller,bcontr,logicmgr,converter); - gamecontroller->SetExecutePriority(executePriority++); - gamecontroller->SetBookmark((bcontr->flag & CONT_PRIO) != 0); - gamecontroller->SetState(bcontr->state_mask); - STR_String uniquename = bcontr->name; - uniquename += "#CONTR#"; - uniqueint++; - CIntValue* uniqueval = new CIntValue(uniqueint); - uniquename += uniqueval->GetText(); - uniqueval->Release(); - gamecontroller->SetName(uniquename); - gameobj->AddController(gamecontroller); - - converter->RegisterGameController(gamecontroller, bcontr); - -#ifndef DISABLE_PYTHON - if (bcontr->type==CONT_PYTHON) { - SCA_PythonController *pyctrl= static_cast(gamecontroller); - /* not strictly needed but gives syntax errors early on and - * gives more pradictable performance for larger scripts */ - if(pyctrl->m_mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) - pyctrl->Compile(); - else { - /* We cant do this because importing runs the script which could end up accessing - * internal BGE functions, this is unstable while we're converting the scene. - * This is a pitty because its useful to see errors at startup but cant help it */ - - // pyctrl->Import(); - } - } -#endif // DISABLE_PYTHON - - //done with gamecontroller - gamecontroller->Release(); - } - - bcontr = bcontr->next; - } - -} diff --git a/source/gameengine/Converter/KX_ConvertControllers.h b/source/gameengine/Converter/KX_ConvertControllers.h deleted file mode 100644 index c251985abfb..00000000000 --- a/source/gameengine/Converter/KX_ConvertControllers.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_CONVERTCONTROLLERS_H -#define __KX_CONVERTCONTROLLERS_H - -#include "KX_Python.h" - -void BL_ConvertControllers( - struct Object* blenderobject, - class KX_GameObject* gameobj, - class SCA_LogicManager* logicmgr, - int activeLayerBitInfo, - bool isInActiveLayer, - class KX_BlenderSceneConverter* converter -); - - -#endif //__KX_CONVERTCONTROLLERS_H - diff --git a/source/gameengine/Converter/KX_ConvertProperties.cpp b/source/gameengine/Converter/KX_ConvertProperties.cpp deleted file mode 100644 index 44c0ad38909..00000000000 --- a/source/gameengine/Converter/KX_ConvertProperties.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_ConvertProperties.h" - - -#include "DNA_object_types.h" -#include "DNA_property_types.h" -/* end of blender include block */ - - -#include "Value.h" -#include "VectorValue.h" -#include "BoolValue.h" -#include "StringValue.h" -#include "FloatValue.h" -#include "KX_GameObject.h" -#include "IntValue.h" -#include "SCA_TimeEventManager.h" -#include "SCA_IScene.h" - -/* This little block needed for linking to Blender... */ -#ifdef WIN32 -#include "BLI_winstuff.h" -#endif - -void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventManager* timemgr,SCA_IScene* scene, bool isInActiveLayer) -{ - - bProperty* prop = (bProperty*)object->prop.first; - CValue* propval; - bool show_debug_info; - while(prop) - { - - propval = NULL; - show_debug_info = bool (prop->flag & PROP_DEBUG); - - switch(prop->type) { - case GPROP_BOOL: - { - propval = new CBoolValue((bool)(prop->data != 0)); - gameobj->SetProperty(prop->name,propval); - //promp->poin= &prop->data; - break; - } - case GPROP_INT: - { - propval = new CIntValue((int)prop->data); - gameobj->SetProperty(prop->name,propval); - break; - } - case GPROP_FLOAT: - { - //prop->poin= &prop->data; - float floatprop = *((float*)&prop->data); - propval = new CFloatValue(floatprop); - gameobj->SetProperty(prop->name,propval); - } - break; - case GPROP_STRING: - { - //prop->poin= callocN(MAX_PROPSTRING, "property string"); - propval = new CStringValue((char*)prop->poin,""); - gameobj->SetProperty(prop->name,propval); - break; - } - case GPROP_TIME: - { - float floatprop = *((float*)&prop->data); - - CValue* timeval = new CFloatValue(floatprop); - // set a subproperty called 'timer' so that - // we can register the replica of this property - // at the time a game object is replicated (AddObjectActuator triggers this) - CValue *bval = new CBoolValue(true); - timeval->SetProperty("timer",bval); - bval->Release(); - if (isInActiveLayer) - { - timemgr->AddTimeProperty(timeval); - } - - propval = timeval; - gameobj->SetProperty(prop->name,timeval); - - } - default: - { - // todo make an assert etc. - } - } - - if (propval) - { - if (show_debug_info) - { - scene->AddDebugProperty(gameobj,STR_String(prop->name)); - } - // done with propval, release it - propval->Release(); - } - -#ifndef DISABLE_PYTHON - /* Warn if we double up on attributes, this isnt quite right since it wont find inherited attributes however there arnt many */ - for(PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) { - if(strcmp(prop->name, attrdef->m_name)==0) { - printf("Warning! user defined property name \"%s\" is also a python attribute for object \"%s\"\n\tUse ob[\"%s\"] syntax to avoid conflict\n", prop->name, object->id.name+2, prop->name); - break; - } - } - for(PyMethodDef *methdef = KX_GameObject::Methods; methdef->ml_name; methdef++) { - if(strcmp(prop->name, methdef->ml_name)==0) { - printf("Warning! user defined property name \"%s\" is also a python method for object \"%s\"\n\tUse ob[\"%s\"] syntax to avoid conflict\n", prop->name, object->id.name+2, prop->name); - break; - } - } - /* end warning check */ -#endif // DISABLE_PYTHON - - prop = prop->next; - } - // check if state needs to be debugged - if (object->scaflag & OB_DEBUGSTATE) - { - // reserve name for object state - scene->AddDebugProperty(gameobj,STR_String("__state__")); - } -} diff --git a/source/gameengine/Converter/KX_ConvertProperties.h b/source/gameengine/Converter/KX_ConvertProperties.h deleted file mode 100644 index 0fac2be0fe5..00000000000 --- a/source/gameengine/Converter/KX_ConvertProperties.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_CONVERTPROPERTIES -#define __KX_CONVERTPROPERTIES - -void BL_ConvertProperties(struct Object* object, - class KX_GameObject* gameobj, - class SCA_TimeEventManager* timemgr, - class SCA_IScene* scene, - bool isInActiveLayer); - -#endif //__KX_CONVERTPROPERTIES - diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp deleted file mode 100644 index d65fee93a12..00000000000 --- a/source/gameengine/Converter/KX_ConvertSensors.cpp +++ /dev/null @@ -1,859 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Conversion of Blender data blocks to KX sensor system - */ - -#include - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif //WIN32 - -#include "wm_event_types.h" -#include "KX_BlenderSceneConverter.h" -#include "KX_ConvertSensors.h" - -/* This little block needed for linking to Blender... */ -#ifdef WIN32 -#include "BLI_winstuff.h" -#endif - -#include "DNA_object_types.h" -#include "DNA_material_types.h" -#include "DNA_sensor_types.h" -#include "DNA_actuator_types.h" /* for SENS_ALL_KEYS ? this define is -probably misplaced */ -/* end of blender include block */ - -#include "RAS_IPolygonMaterial.h" -// Sensors -#include "KX_GameObject.h" -#include "RAS_MeshObject.h" -#include "SCA_KeyboardSensor.h" -#include "SCA_MouseSensor.h" -#include "SCA_AlwaysSensor.h" -#include "KX_TouchSensor.h" -#include "KX_NearSensor.h" -#include "KX_RadarSensor.h" -#include "KX_MouseFocusSensor.h" -#include "KX_ArmatureSensor.h" -#include "SCA_JoystickSensor.h" -#include "KX_NetworkMessageSensor.h" -#include "SCA_ActuatorSensor.h" -#include "SCA_DelaySensor.h" - - -#include "SCA_PropertySensor.h" -#include "SCA_RandomSensor.h" -#include "KX_RaySensor.h" -#include "SCA_EventManager.h" -#include "SCA_LogicManager.h" -#include "KX_BlenderInputDevice.h" -#include "KX_Scene.h" -#include "IntValue.h" -#include "KX_BlenderKeyboardDevice.h" -#include "KX_BlenderGL.h" -#include "RAS_ICanvas.h" -#include "PHY_IPhysicsEnvironment.h" - -#include "KX_KetsjiEngine.h" -#include "KX_BlenderSceneConverter.h" - -// this map is Blender specific: a conversion between blender and ketsji enums -std::map gReverseKeyTranslateTable; - - -void BL_ConvertSensors(struct Object* blenderobject, - class KX_GameObject* gameobj, - SCA_LogicManager* logicmgr, - KX_Scene* kxscene, - KX_KetsjiEngine* kxengine, - int activeLayerBitInfo, - bool isInActiveLayer, - RAS_ICanvas* canvas, - KX_BlenderSceneConverter* converter - ) -{ - static bool reverseTableConverted = false; - - if (!reverseTableConverted) - { - reverseTableConverted = true; - - /* The reverse table. In order to not confuse ourselves, we */ - /* immediately convert all events that come in to KX codes. */ - gReverseKeyTranslateTable[LEFTMOUSE ] = SCA_IInputDevice::KX_LEFTMOUSE; - gReverseKeyTranslateTable[MIDDLEMOUSE ] = SCA_IInputDevice::KX_MIDDLEMOUSE; - gReverseKeyTranslateTable[RIGHTMOUSE ] = SCA_IInputDevice::KX_RIGHTMOUSE; - gReverseKeyTranslateTable[WHEELUPMOUSE ] = SCA_IInputDevice::KX_WHEELUPMOUSE; - gReverseKeyTranslateTable[WHEELDOWNMOUSE ] = SCA_IInputDevice::KX_WHEELDOWNMOUSE; - gReverseKeyTranslateTable[MOUSEX ] = SCA_IInputDevice::KX_MOUSEX; - gReverseKeyTranslateTable[MOUSEY ] = SCA_IInputDevice::KX_MOUSEY; - - // TIMERS - - gReverseKeyTranslateTable[TIMER0 ] = SCA_IInputDevice::KX_TIMER0; - gReverseKeyTranslateTable[TIMER1 ] = SCA_IInputDevice::KX_TIMER1; - gReverseKeyTranslateTable[TIMER2 ] = SCA_IInputDevice::KX_TIMER2; - - // SYSTEM - -#if 0 - /* **** XXX **** */ - gReverseKeyTranslateTable[KEYBD ] = SCA_IInputDevice::KX_KEYBD; - gReverseKeyTranslateTable[RAWKEYBD ] = SCA_IInputDevice::KX_RAWKEYBD; - gReverseKeyTranslateTable[REDRAW ] = SCA_IInputDevice::KX_REDRAW; - gReverseKeyTranslateTable[INPUTCHANGE ] = SCA_IInputDevice::KX_INPUTCHANGE; - gReverseKeyTranslateTable[QFULL ] = SCA_IInputDevice::KX_QFULL; - gReverseKeyTranslateTable[WINFREEZE ] = SCA_IInputDevice::KX_WINFREEZE; - gReverseKeyTranslateTable[WINTHAW ] = SCA_IInputDevice::KX_WINTHAW; - gReverseKeyTranslateTable[WINCLOSE ] = SCA_IInputDevice::KX_WINCLOSE; - gReverseKeyTranslateTable[WINQUIT ] = SCA_IInputDevice::KX_WINQUIT; - gReverseKeyTranslateTable[Q_FIRSTTIME ] = SCA_IInputDevice::KX_Q_FIRSTTIME; - /* **** XXX **** */ -#endif - - // standard keyboard - - gReverseKeyTranslateTable[AKEY ] = SCA_IInputDevice::KX_AKEY; - gReverseKeyTranslateTable[BKEY ] = SCA_IInputDevice::KX_BKEY; - gReverseKeyTranslateTable[CKEY ] = SCA_IInputDevice::KX_CKEY; - gReverseKeyTranslateTable[DKEY ] = SCA_IInputDevice::KX_DKEY; - gReverseKeyTranslateTable[EKEY ] = SCA_IInputDevice::KX_EKEY; - gReverseKeyTranslateTable[FKEY ] = SCA_IInputDevice::KX_FKEY; - gReverseKeyTranslateTable[GKEY ] = SCA_IInputDevice::KX_GKEY; - -//XXX clean up -#ifdef WIN32 -#define HKEY 'h' -#endif - gReverseKeyTranslateTable[HKEY ] = SCA_IInputDevice::KX_HKEY; -//XXX clean up -#ifdef WIN32 -#undef HKEY -#endif - - gReverseKeyTranslateTable[IKEY ] = SCA_IInputDevice::KX_IKEY; - gReverseKeyTranslateTable[JKEY ] = SCA_IInputDevice::KX_JKEY; - gReverseKeyTranslateTable[KKEY ] = SCA_IInputDevice::KX_KKEY; - gReverseKeyTranslateTable[LKEY ] = SCA_IInputDevice::KX_LKEY; - gReverseKeyTranslateTable[MKEY ] = SCA_IInputDevice::KX_MKEY; - gReverseKeyTranslateTable[NKEY ] = SCA_IInputDevice::KX_NKEY; - gReverseKeyTranslateTable[OKEY ] = SCA_IInputDevice::KX_OKEY; - gReverseKeyTranslateTable[PKEY ] = SCA_IInputDevice::KX_PKEY; - gReverseKeyTranslateTable[QKEY ] = SCA_IInputDevice::KX_QKEY; - gReverseKeyTranslateTable[RKEY ] = SCA_IInputDevice::KX_RKEY; - gReverseKeyTranslateTable[SKEY ] = SCA_IInputDevice::KX_SKEY; - gReverseKeyTranslateTable[TKEY ] = SCA_IInputDevice::KX_TKEY; - gReverseKeyTranslateTable[UKEY ] = SCA_IInputDevice::KX_UKEY; - gReverseKeyTranslateTable[VKEY ] = SCA_IInputDevice::KX_VKEY; - gReverseKeyTranslateTable[WKEY ] = SCA_IInputDevice::KX_WKEY; - gReverseKeyTranslateTable[XKEY ] = SCA_IInputDevice::KX_XKEY; - gReverseKeyTranslateTable[YKEY ] = SCA_IInputDevice::KX_YKEY; - gReverseKeyTranslateTable[ZKEY ] = SCA_IInputDevice::KX_ZKEY; - - gReverseKeyTranslateTable[ZEROKEY ] = SCA_IInputDevice::KX_ZEROKEY; - gReverseKeyTranslateTable[ONEKEY ] = SCA_IInputDevice::KX_ONEKEY; - gReverseKeyTranslateTable[TWOKEY ] = SCA_IInputDevice::KX_TWOKEY; - gReverseKeyTranslateTable[THREEKEY ] = SCA_IInputDevice::KX_THREEKEY; - gReverseKeyTranslateTable[FOURKEY ] = SCA_IInputDevice::KX_FOURKEY; - gReverseKeyTranslateTable[FIVEKEY ] = SCA_IInputDevice::KX_FIVEKEY; - gReverseKeyTranslateTable[SIXKEY ] = SCA_IInputDevice::KX_SIXKEY; - gReverseKeyTranslateTable[SEVENKEY ] = SCA_IInputDevice::KX_SEVENKEY; - gReverseKeyTranslateTable[EIGHTKEY ] = SCA_IInputDevice::KX_EIGHTKEY; - gReverseKeyTranslateTable[NINEKEY ] = SCA_IInputDevice::KX_NINEKEY; - - gReverseKeyTranslateTable[CAPSLOCKKEY ] = SCA_IInputDevice::KX_CAPSLOCKKEY; - - gReverseKeyTranslateTable[LEFTCTRLKEY ] = SCA_IInputDevice::KX_LEFTCTRLKEY; - gReverseKeyTranslateTable[LEFTALTKEY ] = SCA_IInputDevice::KX_LEFTALTKEY; - gReverseKeyTranslateTable[RIGHTALTKEY ] = SCA_IInputDevice::KX_RIGHTALTKEY; - gReverseKeyTranslateTable[RIGHTCTRLKEY ] = SCA_IInputDevice::KX_RIGHTCTRLKEY; - gReverseKeyTranslateTable[RIGHTSHIFTKEY ] = SCA_IInputDevice::KX_RIGHTSHIFTKEY; - gReverseKeyTranslateTable[LEFTSHIFTKEY ] = SCA_IInputDevice::KX_LEFTSHIFTKEY; - - gReverseKeyTranslateTable[ESCKEY ] = SCA_IInputDevice::KX_ESCKEY; - gReverseKeyTranslateTable[TABKEY ] = SCA_IInputDevice::KX_TABKEY; - gReverseKeyTranslateTable[RETKEY ] = SCA_IInputDevice::KX_RETKEY; - gReverseKeyTranslateTable[SPACEKEY ] = SCA_IInputDevice::KX_SPACEKEY; - gReverseKeyTranslateTable[LINEFEEDKEY ] = SCA_IInputDevice::KX_LINEFEEDKEY; - gReverseKeyTranslateTable[BACKSPACEKEY ] = SCA_IInputDevice::KX_BACKSPACEKEY; - gReverseKeyTranslateTable[DELKEY ] = SCA_IInputDevice::KX_DELKEY; - gReverseKeyTranslateTable[SEMICOLONKEY ] = SCA_IInputDevice::KX_SEMICOLONKEY; - gReverseKeyTranslateTable[PERIODKEY ] = SCA_IInputDevice::KX_PERIODKEY; - gReverseKeyTranslateTable[COMMAKEY ] = SCA_IInputDevice::KX_COMMAKEY; - gReverseKeyTranslateTable[QUOTEKEY ] = SCA_IInputDevice::KX_QUOTEKEY; - gReverseKeyTranslateTable[ACCENTGRAVEKEY ] = SCA_IInputDevice::KX_ACCENTGRAVEKEY; - gReverseKeyTranslateTable[MINUSKEY ] = SCA_IInputDevice::KX_MINUSKEY; - gReverseKeyTranslateTable[SLASHKEY ] = SCA_IInputDevice::KX_SLASHKEY; - gReverseKeyTranslateTable[BACKSLASHKEY ] = SCA_IInputDevice::KX_BACKSLASHKEY; - gReverseKeyTranslateTable[EQUALKEY ] = SCA_IInputDevice::KX_EQUALKEY; - gReverseKeyTranslateTable[LEFTBRACKETKEY ] = SCA_IInputDevice::KX_LEFTBRACKETKEY; - gReverseKeyTranslateTable[RIGHTBRACKETKEY ] = SCA_IInputDevice::KX_RIGHTBRACKETKEY; - - gReverseKeyTranslateTable[LEFTARROWKEY ] = SCA_IInputDevice::KX_LEFTARROWKEY; - gReverseKeyTranslateTable[DOWNARROWKEY ] = SCA_IInputDevice::KX_DOWNARROWKEY; - gReverseKeyTranslateTable[RIGHTARROWKEY ] = SCA_IInputDevice::KX_RIGHTARROWKEY; - gReverseKeyTranslateTable[UPARROWKEY ] = SCA_IInputDevice::KX_UPARROWKEY; - - gReverseKeyTranslateTable[PAD2 ] = SCA_IInputDevice::KX_PAD2; - gReverseKeyTranslateTable[PAD4 ] = SCA_IInputDevice::KX_PAD4; - gReverseKeyTranslateTable[PAD6 ] = SCA_IInputDevice::KX_PAD6; - gReverseKeyTranslateTable[PAD8 ] = SCA_IInputDevice::KX_PAD8; - - gReverseKeyTranslateTable[PAD1 ] = SCA_IInputDevice::KX_PAD1; - gReverseKeyTranslateTable[PAD3 ] = SCA_IInputDevice::KX_PAD3; - gReverseKeyTranslateTable[PAD5 ] = SCA_IInputDevice::KX_PAD5; - gReverseKeyTranslateTable[PAD7 ] = SCA_IInputDevice::KX_PAD7; - gReverseKeyTranslateTable[PAD9 ] = SCA_IInputDevice::KX_PAD9; - - gReverseKeyTranslateTable[PADPERIOD ] = SCA_IInputDevice::KX_PADPERIOD; - gReverseKeyTranslateTable[PADSLASHKEY ] = SCA_IInputDevice::KX_PADSLASHKEY; - gReverseKeyTranslateTable[PADASTERKEY ] = SCA_IInputDevice::KX_PADASTERKEY; - - gReverseKeyTranslateTable[PAD0 ] = SCA_IInputDevice::KX_PAD0; - gReverseKeyTranslateTable[PADMINUS ] = SCA_IInputDevice::KX_PADMINUS; - gReverseKeyTranslateTable[PADENTER ] = SCA_IInputDevice::KX_PADENTER; - gReverseKeyTranslateTable[PADPLUSKEY ] = SCA_IInputDevice::KX_PADPLUSKEY; - - - gReverseKeyTranslateTable[F1KEY ] = SCA_IInputDevice::KX_F1KEY; - gReverseKeyTranslateTable[F2KEY ] = SCA_IInputDevice::KX_F2KEY; - gReverseKeyTranslateTable[F3KEY ] = SCA_IInputDevice::KX_F3KEY; - gReverseKeyTranslateTable[F4KEY ] = SCA_IInputDevice::KX_F4KEY; - gReverseKeyTranslateTable[F5KEY ] = SCA_IInputDevice::KX_F5KEY; - gReverseKeyTranslateTable[F6KEY ] = SCA_IInputDevice::KX_F6KEY; - gReverseKeyTranslateTable[F7KEY ] = SCA_IInputDevice::KX_F7KEY; - gReverseKeyTranslateTable[F8KEY ] = SCA_IInputDevice::KX_F8KEY; - gReverseKeyTranslateTable[F9KEY ] = SCA_IInputDevice::KX_F9KEY; - gReverseKeyTranslateTable[F10KEY ] = SCA_IInputDevice::KX_F10KEY; - gReverseKeyTranslateTable[F11KEY ] = SCA_IInputDevice::KX_F11KEY; - gReverseKeyTranslateTable[F12KEY ] = SCA_IInputDevice::KX_F12KEY; - gReverseKeyTranslateTable[F13KEY ] = SCA_IInputDevice::KX_F13KEY; - gReverseKeyTranslateTable[F14KEY ] = SCA_IInputDevice::KX_F14KEY; - gReverseKeyTranslateTable[F15KEY ] = SCA_IInputDevice::KX_F15KEY; - gReverseKeyTranslateTable[F16KEY ] = SCA_IInputDevice::KX_F16KEY; - gReverseKeyTranslateTable[F17KEY ] = SCA_IInputDevice::KX_F17KEY; - gReverseKeyTranslateTable[F18KEY ] = SCA_IInputDevice::KX_F18KEY; - gReverseKeyTranslateTable[F19KEY ] = SCA_IInputDevice::KX_F19KEY; - - - gReverseKeyTranslateTable[PAUSEKEY ] = SCA_IInputDevice::KX_PAUSEKEY; - gReverseKeyTranslateTable[INSERTKEY ] = SCA_IInputDevice::KX_INSERTKEY; - gReverseKeyTranslateTable[HOMEKEY ] = SCA_IInputDevice::KX_HOMEKEY; - gReverseKeyTranslateTable[PAGEUPKEY ] = SCA_IInputDevice::KX_PAGEUPKEY; - gReverseKeyTranslateTable[PAGEDOWNKEY ] = SCA_IInputDevice::KX_PAGEDOWNKEY; - gReverseKeyTranslateTable[ENDKEY ] = SCA_IInputDevice::KX_ENDKEY; - } - - int executePriority = 0; - int uniqueint = 0; - int count = 0; - bSensor* sens = (bSensor*)blenderobject->sensors.first; - bool pos_pulsemode = false; - bool neg_pulsemode = false; - int frequency = 0; - bool invert = false; - bool level = false; - bool tap = false; - - while (sens) - { - sens = sens->next; - count++; - } - gameobj->ReserveSensor(count); - sens = (bSensor*)blenderobject->sensors.first; - while(sens) - { - SCA_ISensor* gamesensor=NULL; - /* All sensors have a pulse toggle, frequency, and invert field. */ - /* These are extracted here, and set when the sensor is added to the */ - /* list. */ - pos_pulsemode = (sens->pulse & SENS_PULSE_REPEAT)!=0; - neg_pulsemode = (sens->pulse & SENS_NEG_PULSE_MODE)!=0; - - frequency = sens->freq; - invert = !(sens->invert == 0); - level = !(sens->level == 0); - tap = !(sens->tap == 0); - - switch (sens->type) - { - case SENS_ALWAYS: - { - - SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR); - if (eventmgr) - { - gamesensor = new SCA_AlwaysSensor(eventmgr, gameobj); - } - - break; - } - - case SENS_DELAY: - { - // we can reuse the Always event manager for the delay sensor - SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR); - if (eventmgr) - { - bDelaySensor* delaysensor = (bDelaySensor*)sens->data; - gamesensor = new SCA_DelaySensor(eventmgr, - gameobj, - delaysensor->delay, - delaysensor->duration, - (delaysensor->flag & SENS_DELAY_REPEAT) != 0); - } - break; - } - - case SENS_COLLISION: - { - SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::TOUCH_EVENTMGR); - if (eventmgr) - { - // collision sensor can sense both materials and properties. - - bool bFindMaterial = false, bTouchPulse = false; - - bCollisionSensor* blendertouchsensor = (bCollisionSensor*)sens->data; - - bFindMaterial = (blendertouchsensor->mode & SENS_COLLISION_MATERIAL); - bTouchPulse = (blendertouchsensor->mode & SENS_COLLISION_PULSE); - - - STR_String touchPropOrMatName = ( bFindMaterial ? - blendertouchsensor->materialName: - (blendertouchsensor->name ? blendertouchsensor->name: "")); - - - if (gameobj->GetPhysicsController()) - { - gamesensor = new KX_TouchSensor(eventmgr, - gameobj, - bFindMaterial, - bTouchPulse, - touchPropOrMatName); - } - - } - - break; - } - case SENS_TOUCH: - { - SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::TOUCH_EVENTMGR); - if (eventmgr) - { - STR_String touchpropertyname; - bTouchSensor* blendertouchsensor = (bTouchSensor*)sens->data; - - if (blendertouchsensor->ma) - { - touchpropertyname = (char*) (blendertouchsensor->ma->id.name+2); - } - bool bFindMaterial = true; - if (gameobj->GetPhysicsController()) - { - gamesensor = new KX_TouchSensor(eventmgr, - gameobj, - bFindMaterial, - false, - touchpropertyname); - } - } - break; - } - case SENS_MESSAGE: - { - KX_NetworkEventManager* eventmgr = (KX_NetworkEventManager*) - logicmgr->FindEventManager(SCA_EventManager::NETWORK_EVENTMGR); - if (eventmgr) { - bMessageSensor* msgSens = (bMessageSensor*) sens->data; - - /* Get our NetworkScene */ - NG_NetworkScene *NetworkScene = kxscene->GetNetworkScene(); - /* filter on the incoming subjects, might be empty */ - STR_String subject = (msgSens->subject - ? (char*)msgSens->subject - : ""); - - gamesensor = new KX_NetworkMessageSensor( - eventmgr, // our eventmanager - NetworkScene, // our NetworkScene - gameobj, // the sensor controlling object - subject); // subject to filter on - } - break; - } - case SENS_NEAR: - { - - SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::TOUCH_EVENTMGR); - if (eventmgr) - { - STR_String nearpropertyname; - bNearSensor* blendernearsensor = (bNearSensor*)sens->data; - if (blendernearsensor->name) - { - // only objects that own this property will be taken into account - nearpropertyname = (char*) blendernearsensor->name; - } - - //DT_ShapeHandle shape = DT_Sphere(0.0); - - // this sumoObject is not deleted by a gameobj, so delete it ourself - // later (memleaks)! - float radius = blendernearsensor->dist; - PHY__Vector3 pos; - const MT_Vector3& wpos = gameobj->NodeGetWorldPosition(); - pos[0] = wpos[0]; - pos[1] = wpos[1]; - pos[2] = wpos[2]; - pos[3] = 0.f; - bool bFindMaterial = false; - PHY_IPhysicsController* physCtrl = kxscene->GetPhysicsEnvironment()->CreateSphereController(radius,pos); - - //will be done in KX_TouchEventManager::RegisterSensor() - //if (isInActiveLayer) - // kxscene->GetPhysicsEnvironment()->addSensor(physCtrl); - - - - gamesensor = new KX_NearSensor(eventmgr,gameobj, - blendernearsensor->dist, - blendernearsensor->resetdist, - bFindMaterial, - nearpropertyname, - physCtrl); - - } - break; - } - - - case SENS_KEYBOARD: - { - /* temporary input device, for converting the code for the keyboard sensor */ - - bKeyboardSensor* blenderkeybdsensor = (bKeyboardSensor*)sens->data; - SCA_KeyboardManager* eventmgr = (SCA_KeyboardManager*) logicmgr->FindEventManager(SCA_EventManager::KEYBOARD_EVENTMGR); - if (eventmgr) - { - gamesensor = new SCA_KeyboardSensor(eventmgr, - gReverseKeyTranslateTable[blenderkeybdsensor->key], - gReverseKeyTranslateTable[blenderkeybdsensor->qual], - gReverseKeyTranslateTable[blenderkeybdsensor->qual2], - (blenderkeybdsensor->type == SENS_ALL_KEYS), - blenderkeybdsensor->targetName, - blenderkeybdsensor->toggleName, - gameobj); // blenderkeybdsensor->pad); - - } - - break; - } - case SENS_MOUSE: - { - int keytype = SCA_MouseSensor::KX_MOUSESENSORMODE_NODEF; - int trackfocus = 0; - bMouseSensor *bmouse = (bMouseSensor *)sens->data; - - /* There are two main types of mouse sensors. If there is - * no focus-related behaviour requested, we can make do - * with a basic sensor. This cuts down memory usage and - * gives a slight performance gain. */ - - SCA_MouseManager *eventmgr - = (SCA_MouseManager*) logicmgr->FindEventManager(SCA_EventManager::MOUSE_EVENTMGR); - if (eventmgr) { - - /* Determine key mode. There is at most one active mode. */ - switch (bmouse->type) { - case BL_SENS_MOUSE_LEFT_BUTTON: - keytype = SCA_MouseSensor::KX_MOUSESENSORMODE_LEFTBUTTON; - break; - case BL_SENS_MOUSE_MIDDLE_BUTTON: - keytype = SCA_MouseSensor::KX_MOUSESENSORMODE_MIDDLEBUTTON; - break; - case BL_SENS_MOUSE_RIGHT_BUTTON: - keytype = SCA_MouseSensor::KX_MOUSESENSORMODE_RIGHTBUTTON; - break; - case BL_SENS_MOUSE_WHEEL_UP: - keytype = SCA_MouseSensor::KX_MOUSESENSORMODE_WHEELUP; - break; - case BL_SENS_MOUSE_WHEEL_DOWN: - keytype = SCA_MouseSensor::KX_MOUSESENSORMODE_WHEELDOWN; - break; - case BL_SENS_MOUSE_MOVEMENT: - keytype = SCA_MouseSensor::KX_MOUSESENSORMODE_MOVEMENT; - break; - case BL_SENS_MOUSE_MOUSEOVER: - trackfocus = 1; - break; - case BL_SENS_MOUSE_MOUSEOVER_ANY: - trackfocus = 2; - break; - - default: - ; /* error */ - } - - /* initial mouse position */ - int startx = canvas->GetWidth()/2; - int starty = canvas->GetHeight()/2; - - if (!trackfocus) { - /* plain, simple mouse sensor */ - gamesensor = new SCA_MouseSensor(eventmgr, - startx,starty, - keytype, - gameobj); - } else { - /* give us a focus-aware sensor */ - gamesensor = new KX_MouseFocusSensor(eventmgr, - startx, - starty, - keytype, - trackfocus, - (bmouse->flag & SENS_MOUSE_FOCUS_PULSE) ? true:false, - kxscene, - kxengine, - gameobj); - } - } else { - // cout << "\n Could't find mouse event manager..."; - should throw an error here... - } - break; - } - case SENS_PROPERTY: - { - bPropertySensor* blenderpropsensor = (bPropertySensor*) sens->data; - SCA_EventManager* eventmgr - = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR); - if (eventmgr) - { - STR_String propname=blenderpropsensor->name; - STR_String propval=blenderpropsensor->value; - STR_String propmaxval=blenderpropsensor->maxvalue; - - SCA_PropertySensor::KX_PROPSENSOR_TYPE - propchecktype = SCA_PropertySensor::KX_PROPSENSOR_NODEF; - - /* Better do an explicit conversion here! (was implicit */ - /* before...) */ - switch(blenderpropsensor->type) { - case SENS_PROP_EQUAL: - propchecktype = SCA_PropertySensor::KX_PROPSENSOR_EQUAL; - break; - case SENS_PROP_NEQUAL: - propchecktype = SCA_PropertySensor::KX_PROPSENSOR_NOTEQUAL; - break; - case SENS_PROP_INTERVAL: - propchecktype = SCA_PropertySensor::KX_PROPSENSOR_INTERVAL; - break; - case SENS_PROP_CHANGED: - propchecktype = SCA_PropertySensor::KX_PROPSENSOR_CHANGED; - break; - case SENS_PROP_EXPRESSION: - propchecktype = SCA_PropertySensor::KX_PROPSENSOR_EXPRESSION; - /* error */ - break; - default: - ; /* error */ - } - gamesensor = new SCA_PropertySensor(eventmgr,gameobj,propname,propval,propmaxval,propchecktype); - } - - break; - } - case SENS_ACTUATOR: - { - bActuatorSensor* blenderactsensor = (bActuatorSensor*) sens->data; - // we will reuse the property event manager, there is nothing special with this sensor - SCA_EventManager* eventmgr - = logicmgr->FindEventManager(SCA_EventManager::ACTUATOR_EVENTMGR); - if (eventmgr) - { - STR_String propname=blenderactsensor->name; - gamesensor = new SCA_ActuatorSensor(eventmgr,gameobj,propname); - } - break; - } - - case SENS_ARMATURE: - { - bArmatureSensor* blenderarmsensor = (bArmatureSensor*) sens->data; - // we will reuse the property event manager, there is nothing special with this sensor - SCA_EventManager* eventmgr - = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR); - if (eventmgr) - { - STR_String bonename=blenderarmsensor->posechannel; - STR_String constraintname=blenderarmsensor->constraint; - gamesensor = new KX_ArmatureSensor(eventmgr,gameobj,bonename,constraintname, blenderarmsensor->type, blenderarmsensor->value); - } - break; - } - - case SENS_RADAR: - { - - SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::TOUCH_EVENTMGR); - if (eventmgr) - { - STR_String radarpropertyname; - STR_String touchpropertyname; - bRadarSensor* blenderradarsensor = (bRadarSensor*) sens->data; - - int radaraxis = blenderradarsensor->axis; - - if (blenderradarsensor->name) - { - // only objects that own this property will be taken into account - radarpropertyname = (char*) blenderradarsensor->name; - } - - MT_Scalar coneheight = blenderradarsensor->range; - - // janco: the angle was doubled, so should I divide the factor in 2 - // or the blenderradarsensor->angle? - // nzc: the angle is the opening angle. We need to init with - // the axis-hull angle,so /2.0. - MT_Scalar factor = tan(MT_radians((blenderradarsensor->angle)/2.0)); - //MT_Scalar coneradius = coneheight * (factor / 2); - MT_Scalar coneradius = coneheight * factor; - - - // this sumoObject is not deleted by a gameobj, so delete it ourself - // later (memleaks)! - MT_Scalar smallmargin = 0.0; - MT_Scalar largemargin = 0.0; - - bool bFindMaterial = false; - PHY_IPhysicsController* ctrl = kxscene->GetPhysicsEnvironment()->CreateConeController(coneradius,coneheight); - - gamesensor = new KX_RadarSensor( - eventmgr, - gameobj, - ctrl, - coneradius, - coneheight, - radaraxis, - smallmargin, - largemargin, - bFindMaterial, - radarpropertyname); - - } - - break; - } - case SENS_RAY: - { - bRaySensor* blenderraysensor = (bRaySensor*) sens->data; - - //blenderradarsensor->angle; - SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR); - if (eventmgr) - { - bool bFindMaterial = (blenderraysensor->mode & SENS_COLLISION_MATERIAL); - bool bXRay = (blenderraysensor->mode & SENS_RAY_XRAY); - - STR_String checkname = (bFindMaterial? blenderraysensor->matname : blenderraysensor->propname); - - // don't want to get rays of length 0.0 or so - double distance = (blenderraysensor->range < 0.01 ? 0.01 : blenderraysensor->range ); - int axis = blenderraysensor->axisflag; - - - gamesensor = new KX_RaySensor(eventmgr, - gameobj, - checkname, - bFindMaterial, - bXRay, - distance, - axis, - kxscene); - - } - break; - } - - case SENS_RANDOM: - { - bRandomSensor* blenderrndsensor = (bRandomSensor*) sens->data; - // some files didn't write randomsensor, avoid crash now for NULL ptr's - if (blenderrndsensor) - { - SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR); - if (eventmgr) - { - int randomSeed = blenderrndsensor->seed; - if (randomSeed == 0) - { - randomSeed = (int)(kxengine->GetRealTime()*100000.0); - randomSeed ^= (intptr_t)blenderrndsensor; - } - gamesensor = new SCA_RandomSensor(eventmgr, gameobj, randomSeed); - } - } - break; - } - case SENS_JOYSTICK: - { - int joysticktype = SCA_JoystickSensor::KX_JOYSENSORMODE_NODEF; - - bJoystickSensor* bjoy = (bJoystickSensor*) sens->data; - - SCA_JoystickManager *eventmgr - = (SCA_JoystickManager*) logicmgr->FindEventManager(SCA_EventManager::JOY_EVENTMGR); - if (eventmgr) - { - int axis =0; - int axisf =0; - int button =0; - int hat =0; - int hatf =0; - int prec =0; - - switch(bjoy->type) - { - case SENS_JOY_AXIS: - axis = bjoy->axis; - axisf = bjoy->axisf; - prec = bjoy->precision; - joysticktype = SCA_JoystickSensor::KX_JOYSENSORMODE_AXIS; - break; - case SENS_JOY_BUTTON: - button = bjoy->button; - joysticktype = SCA_JoystickSensor::KX_JOYSENSORMODE_BUTTON; - break; - case SENS_JOY_HAT: - hat = bjoy->hat; - hatf = bjoy->hatf; - joysticktype = SCA_JoystickSensor::KX_JOYSENSORMODE_HAT; - break; - case SENS_JOY_AXIS_SINGLE: - axis = bjoy->axis_single; - prec = bjoy->precision; - joysticktype = SCA_JoystickSensor::KX_JOYSENSORMODE_AXIS_SINGLE; - break; - default: - printf("Error: bad case statement\n"); - break; - } - gamesensor = new SCA_JoystickSensor( - eventmgr, - gameobj, - bjoy->joyindex, - joysticktype, - axis,axisf, - prec, - button, - hat,hatf, - (bjoy->flag & SENS_JOY_ANY_EVENT)); - } - else - { - printf("Error there was a problem finding the event manager\n"); - } - - break; - } - default: - { - } - } - - if (gamesensor) - { - gamesensor->SetExecutePriority(executePriority++); - STR_String uniquename = sens->name; - uniquename += "#SENS#"; - uniqueint++; - CIntValue* uniqueval = new CIntValue(uniqueint); - uniquename += uniqueval->GetText(); - uniqueval->Release(); - - /* Conversion succeeded, so we can set the generic props here. */ - gamesensor->SetPulseMode(pos_pulsemode, - neg_pulsemode, - frequency); - gamesensor->SetInvert(invert); - gamesensor->SetLevel(level); - gamesensor->SetTap(tap); - gamesensor->SetName(sens->name); - - gameobj->AddSensor(gamesensor); - - // only register to manager if it's in an active layer - // Make registration dynamic: only when sensor is activated - //if (isInActiveLayer) - // gamesensor->RegisterToManager(); - - gamesensor->ReserveController(sens->totlinks); - for (int i=0;itotlinks;i++) - { - bController* linkedcont = (bController*) sens->links[i]; - if (linkedcont) { - SCA_IController* gamecont = converter->FindGameController(linkedcont); - - if (gamecont) { - logicmgr->RegisterToSensor(gamecont,gamesensor); - } else { - printf( - "Warning, sensor \"%s\" could not find its controller " - "(link %d of %d) from object \"%s\"\n" - "\tthere has been an error converting the blender controller for the game engine," - "logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2); - } - } else { - printf( - "Warning, sensor \"%s\" has lost a link to a controller " - "(link %d of %d) from object \"%s\"\n" - "\tpossible causes are partially appended objects or an error reading the file," - "logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2); - } - } - // special case: Keyboard sensor with no link - // this combination is usually used for key logging. - if (sens->type == SENS_KEYBOARD && sens->totlinks == 0) { - // Force the registration so that the sensor runs - gamesensor->IncLink(); - } - - // done with gamesensor - gamesensor->Release(); - - } - sens=sens->next; - } -} - diff --git a/source/gameengine/Converter/KX_ConvertSensors.h b/source/gameengine/Converter/KX_ConvertSensors.h deleted file mode 100644 index db3c6146f18..00000000000 --- a/source/gameengine/Converter/KX_ConvertSensors.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_CONVERTSENSOR_H -#define __KX_CONVERTSENSOR_H - -void BL_ConvertSensors(struct Object* blenderobject, - class KX_GameObject* gameobj, - class SCA_LogicManager* logicmgr, - class KX_Scene* kxscene, - class KX_KetsjiEngine* kxengine, - int activeLayerBitInfo, - bool isInActiveLayer, - class RAS_ICanvas* canvas, - class KX_BlenderSceneConverter* converter); - -#endif //__KX_CONVERTSENSOR_H - diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp deleted file mode 100644 index c983c8a5100..00000000000 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ /dev/null @@ -1,480 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 - -// don't show stl-warnings -#pragma warning (disable:4786) -#endif - -#include "BKE_material.h" /* give_current_material */ - -#include "KX_GameObject.h" -#include "KX_IpoConvert.h" -#include "KX_IInterpolator.h" -#include "KX_ScalarInterpolator.h" - -#include "KX_BlenderScalarInterpolator.h" -#include "KX_BlenderSceneConverter.h" - - -/* This little block needed for linking to Blender... */ -#ifdef WIN32 -#include "BLI_winstuff.h" -#endif - -#include "DNA_object_types.h" -#include "DNA_action_types.h" -#include "DNA_ipo_types.h" -#include "DNA_lamp_types.h" -#include "DNA_world_types.h" -#include "DNA_camera_types.h" -#include "DNA_material_types.h" -/* end of blender include block */ - -#include "KX_IPO_SGController.h" -#include "KX_LightIpoSGController.h" -#include "KX_CameraIpoSGController.h" -#include "KX_WorldIpoController.h" -#include "KX_ObColorIpoSGController.h" -#include "KX_MaterialIpoController.h" - -#include "SG_Node.h" - -#include "STR_HashedString.h" - -static BL_InterpolatorList *GetAdtList(struct AnimData *for_adt, KX_BlenderSceneConverter *converter) { - BL_InterpolatorList *adtList= converter->FindInterpolatorList(for_adt); - - if (!adtList) { - adtList = new BL_InterpolatorList(for_adt); - converter->RegisterInterpolatorList(adtList, for_adt); - } - - return adtList; -} - -void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_BlenderSceneConverter *converter) -{ - if (blenderobject->adt) { - - KX_IpoSGController* ipocontr = new KX_IpoSGController(); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - - // For ipo_as_force, we need to know which SM object and Scene the - // object associated with this ipo is in. Is this already known here? - // I think not.... then it must be done later :( -// ipocontr->SetSumoReference(gameobj->GetSumoScene(), -// gameobj->GetSumoObject()); - - ipocontr->SetGameObject(gameobj); - - ipocontr->GetIPOTransform().SetPosition( - MT_Point3( - blenderobject->loc[0]/*+blenderobject->dloc[0]*/, - blenderobject->loc[1]/*+blenderobject->dloc[1]*/, - blenderobject->loc[2]/*+blenderobject->dloc[2]*/ - ) - ); - ipocontr->GetIPOTransform().SetEulerAngles( - MT_Vector3( - blenderobject->rot[0], - blenderobject->rot[1], - blenderobject->rot[2] - ) - ); - ipocontr->GetIPOTransform().SetScaling( - MT_Vector3( - blenderobject->size[0], - blenderobject->size[1], - blenderobject->size[2] - ) - ); - - const char *rotmode, *drotmode; - - switch(blenderobject->rotmode) - { - case ROT_MODE_AXISANGLE: - rotmode = "rotation_axis_angle"; - drotmode = "delta_rotation_axis_angle"; - case ROT_MODE_QUAT: - rotmode = "rotation_quaternion"; - drotmode = "delta_rotation_quaternion"; - default: - rotmode = "rotation_euler"; - drotmode = "delta_rotation_euler"; - } - - BL_InterpolatorList *adtList= GetAdtList(blenderobject->adt, converter); - - // For each active channel in the adtList add an - // interpolator to the game object. - - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; - - for(int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("location", i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetPosition()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_LOC_X+i, true); - } - } - for(int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("delta_location", i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaPosition()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_DLOC_X+i, true); - } - } - for(int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator(rotmode, i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetEulerAngles()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_ROT_X+i, true); - } - } - for(int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator(drotmode, i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaEulerAngles()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_DROT_X+i, true); - } - } - for(int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("scale", i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetScaling()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_SIZE_X+i, true); - } - } - for(int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("delta_scale", i))) { - interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaScaling()[i]), interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetIPOChannelActive(OB_DSIZE_X+i, true); - } - } - - { - KX_ObColorIpoSGController* ipocontr_obcol=NULL; - - for(int i=0; i<4; i++) { - if ((interp = adtList->GetScalarInterpolator("color", i))) { - if (!ipocontr_obcol) { - ipocontr_obcol = new KX_ObColorIpoSGController(); - gameobj->GetSGNode()->AddSGController(ipocontr_obcol); - ipocontr_obcol->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr_obcol->m_rgba[i], interp); - ipocontr_obcol->AddInterpolator(interpolator); - } - } - } - } -} - -void BL_ConvertLampIpos(struct Lamp* blenderlamp, KX_GameObject *lightobj,KX_BlenderSceneConverter *converter) -{ - - if (blenderlamp->adt) { - - KX_LightIpoSGController* ipocontr = new KX_LightIpoSGController(); - lightobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(lightobj->GetSGNode()); - - ipocontr->m_energy = blenderlamp->energy; - ipocontr->m_col_rgb[0] = blenderlamp->r; - ipocontr->m_col_rgb[1] = blenderlamp->g; - ipocontr->m_col_rgb[2] = blenderlamp->b; - ipocontr->m_dist = blenderlamp->dist; - - BL_InterpolatorList *adtList= GetAdtList(blenderlamp->adt, converter); - - // For each active channel in the adtList add an - // interpolator to the game object. - - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; - - if ((interp= adtList->GetScalarInterpolator("energy", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_energy, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyEnergy(true); - } - - if ((interp = adtList->GetScalarInterpolator("distance", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_dist, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyDist(true); - } - - for(int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("color", i))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyColor(true); - } - } - } -} - - - - -void BL_ConvertCameraIpos(struct Camera* blendercamera, KX_GameObject *cameraobj,KX_BlenderSceneConverter *converter) -{ - - if (blendercamera->adt) { - - KX_CameraIpoSGController* ipocontr = new KX_CameraIpoSGController(); - cameraobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(cameraobj->GetSGNode()); - - ipocontr->m_lens = blendercamera->lens; - ipocontr->m_clipstart = blendercamera->clipsta; - ipocontr->m_clipend = blendercamera->clipend; - - BL_InterpolatorList *adtList= GetAdtList(blendercamera->adt, converter); - - // For each active channel in the adtList add an - // interpolator to the game object. - - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; - - if ((interp = adtList->GetScalarInterpolator("lens", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_lens, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyLens(true); - } - - if ((interp = adtList->GetScalarInterpolator("clip_start", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_clipstart, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyClipStart(true); - } - - if ((interp = adtList->GetScalarInterpolator("clip_end", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_clipend, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyClipEnd(true); - } - - } -} - - -void BL_ConvertWorldIpos(struct World* blenderworld,KX_BlenderSceneConverter *converter) -{ - - if (blenderworld->adt) { - - KX_WorldIpoController* ipocontr = new KX_WorldIpoController(); - -// Erwin, hook up the world ipo controller here -// Gino: hook it up to what ? -// is there a userinterface element for that ? -// for now, we have some new python hooks to access the data, for a work-around - - ipocontr->m_mist_start = blenderworld->miststa; - ipocontr->m_mist_dist = blenderworld->mistdist; - ipocontr->m_mist_rgb[0] = blenderworld->horr; - ipocontr->m_mist_rgb[1] = blenderworld->horg; - ipocontr->m_mist_rgb[2] = blenderworld->horb; - - BL_InterpolatorList *adtList= GetAdtList(blenderworld->adt, converter); - - // For each active channel in the adtList add an - // interpolator to the game object. - - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *interp; - - for(int i=0; i<3; i++) { - if ((interp = adtList->GetScalarInterpolator("horizon_color", i))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_rgb[i], interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyMistColor(true); - } - } - - if ((interp = adtList->GetScalarInterpolator("mist.depth", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_dist, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyMistDist(true); - } - - if ((interp = adtList->GetScalarInterpolator("mist.start", 0))) { - interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_start, interp); - ipocontr->AddInterpolator(interpolator); - ipocontr->SetModifyMistStart(true); - } - } -} - -static void ConvertMaterialIpos( - Material* blendermaterial, - dword matname_hash, - KX_GameObject* gameobj, - KX_BlenderSceneConverter *converter - ) -{ - if (blendermaterial->adt) { - KX_MaterialIpoController* ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - - BL_InterpolatorList *adtList= GetAdtList(blendermaterial->adt, converter); - - - ipocontr->m_rgba[0] = blendermaterial->r; - ipocontr->m_rgba[1] = blendermaterial->g; - ipocontr->m_rgba[2] = blendermaterial->b; - ipocontr->m_rgba[3] = blendermaterial->alpha; - - ipocontr->m_specrgb[0] = blendermaterial->specr; - ipocontr->m_specrgb[1] = blendermaterial->specg; - ipocontr->m_specrgb[2] = blendermaterial->specb; - - ipocontr->m_hard = blendermaterial->har; - ipocontr->m_spec = blendermaterial->spec; - ipocontr->m_ref = blendermaterial->ref; - ipocontr->m_emit = blendermaterial->emit; - ipocontr->m_alpha = blendermaterial->alpha; - - KX_IInterpolator *interpolator; - KX_IScalarInterpolator *sinterp; - - // -- - for(int i=0; i<3; i++) { - if ((sinterp = adtList->GetScalarInterpolator("diffuse_color", i))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_rgba[i], sinterp); - ipocontr->AddInterpolator(interpolator); - } - } - - if ((sinterp = adtList->GetScalarInterpolator("alpha", 0))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_rgba[3], sinterp); - ipocontr->AddInterpolator(interpolator); - } - - for(int i=0; i<3; i++) { - if ((sinterp = adtList->GetScalarInterpolator("specular_color", i))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_specrgb[i], sinterp); - ipocontr->AddInterpolator(interpolator); - } - } - - if ((sinterp = adtList->GetScalarInterpolator("specular_hardness", 0))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_hard, sinterp); - ipocontr->AddInterpolator(interpolator); - } - - if ((sinterp = adtList->GetScalarInterpolator("specularity", 0))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_spec, sinterp); - ipocontr->AddInterpolator(interpolator); - } - - if ((sinterp = adtList->GetScalarInterpolator("diffuse_reflection", 0))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_ref, sinterp); - ipocontr->AddInterpolator(interpolator); - } - - if ((sinterp = adtList->GetScalarInterpolator("emit", 0))) { - if (!ipocontr) { - ipocontr = new KX_MaterialIpoController(matname_hash); - gameobj->GetSGNode()->AddSGController(ipocontr); - ipocontr->SetObject(gameobj->GetSGNode()); - } - interpolator= new KX_ScalarInterpolator(&ipocontr->m_emit, sinterp); - ipocontr->AddInterpolator(interpolator); - } - } -} - -void BL_ConvertMaterialIpos( - struct Object* blenderobject, - KX_GameObject* gameobj, - KX_BlenderSceneConverter *converter - ) -{ - if (blenderobject->totcol==1) - { - Material *mat = give_current_material(blenderobject, 1); - // if there is only one material attached to the mesh then set material_index in BL_ConvertMaterialIpos to NULL - // --> this makes the UpdateMaterialData function in KX_GameObject.cpp use the old hack of using SetObjectColor - // because this yields a better performance as not all the vertex colors need to be edited - if(mat) ConvertMaterialIpos(mat, 0, gameobj, converter); - } - else - { - for (int material_index=1; material_index <= blenderobject->totcol; material_index++) - { - Material *mat = give_current_material(blenderobject, material_index); - STR_HashedString matname; - if(mat) { - matname= mat->id.name; // who is using this name? can we remove the MA here? - ConvertMaterialIpos(mat, matname.hash(), gameobj, converter); - } - } - } -} - diff --git a/source/gameengine/Converter/KX_IpoConvert.h b/source/gameengine/Converter/KX_IpoConvert.h deleted file mode 100644 index 6178f00efb5..00000000000 --- a/source/gameengine/Converter/KX_IpoConvert.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_IPOCONVERT_H -#define __KX_IPOCONVERT_H - -struct Object; - -void BL_ConvertIpos(struct Object* blenderobject, - class KX_GameObject* gameobj, - class KX_BlenderSceneConverter *converter); - -void BL_ConvertLampIpos(struct Lamp* blenderlight, - class KX_GameObject* lightobj, - class KX_BlenderSceneConverter *converter); - -void BL_ConvertWorldIpos(struct World* blenderworld, - class KX_BlenderSceneConverter *converter); - -void BL_ConvertCameraIpos(struct Camera* blendercamera, - class KX_GameObject* cameraobj, - class KX_BlenderSceneConverter *converter); - -void BL_ConvertMaterialIpos(struct Object* blenderobject, - class KX_GameObject* materialobj, - class KX_BlenderSceneConverter *converter); - - -#endif //__KX_IPOCONVERT_H - diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp deleted file mode 100644 index 9d58a16ddfc..00000000000 --- a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif //WIN32 - -#include "MT_assert.h" - -#include "KX_ConvertPhysicsObject.h" -#include "KX_SoftBodyDeformer.h" -#include "RAS_MeshObject.h" -#include "GEN_Map.h" -#include "GEN_HashedPtr.h" - -#ifdef USE_BULLET - -#include "CcdPhysicsEnvironment.h" -#include "CcdPhysicsController.h" -#include "BulletSoftBody/btSoftBody.h" - -#include "KX_BulletPhysicsController.h" -#include "btBulletDynamicsCommon.h" - -void KX_SoftBodyDeformer::Relink(GEN_Map*map) -{ - void **h_obj = (*map)[m_gameobj]; - - if (h_obj) { - m_gameobj = (BL_DeformableGameObject*)(*h_obj); - m_pMeshObject = m_gameobj->GetMesh(0); - } else { - m_gameobj = NULL; - m_pMeshObject = NULL; - } -} - -bool KX_SoftBodyDeformer::Apply(class RAS_IPolyMaterial *polymat) -{ - KX_BulletPhysicsController* ctrl = (KX_BulletPhysicsController*) m_gameobj->GetPhysicsController(); - if (!ctrl) - return false; - - btSoftBody* softBody= ctrl->GetSoftBody(); - if (!softBody) - return false; - - //printf("apply\n"); - RAS_MeshSlot::iterator it; - RAS_MeshMaterial *mmat; - RAS_MeshSlot *slot; - size_t i; - - // update the vertex in m_transverts - Update(); - - // The vertex cache can only be updated for this deformer: - // Duplicated objects with more than one ploymaterial (=multiple mesh slot per object) - // share the same mesh (=the same cache). As the rendering is done per polymaterial - // cycling through the objects, the entire mesh cache cannot be updated in one shot. - mmat = m_pMeshObject->GetMeshMaterial(polymat); - if(!mmat->m_slots[(void*)m_gameobj]) - return true; - - slot = *mmat->m_slots[(void*)m_gameobj]; - - // for each array - for(slot->begin(it); !slot->end(it); slot->next(it)) - { - btSoftBody::tNodeArray& nodes(softBody->m_nodes); - - int index = 0; - for(i=it.startvertex; i= 0); - - MT_Point3 pt ( - nodes[v.getSoftBodyIndex()].m_x.getX(), - nodes[v.getSoftBodyIndex()].m_x.getY(), - nodes[v.getSoftBodyIndex()].m_x.getZ()); - v.SetXYZ(pt); - - MT_Vector3 normal ( - nodes[v.getSoftBodyIndex()].m_n.getX(), - nodes[v.getSoftBodyIndex()].m_n.getY(), - nodes[v.getSoftBodyIndex()].m_n.getZ()); - v.SetNormal(normal); - - } - } - return true; -} - -#endif diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.h b/source/gameengine/Converter/KX_SoftBodyDeformer.h deleted file mode 100644 index 89407f2a279..00000000000 --- a/source/gameengine/Converter/KX_SoftBodyDeformer.h +++ /dev/null @@ -1,102 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef KX_SOFTBODYDEFORMER -#define KX_SOFTBODYDEFORMER - -#ifdef WIN32 -#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning -#endif //WIN32 - -#include "RAS_Deformer.h" -#include "BL_DeformableGameObject.h" -#include - - -class KX_SoftBodyDeformer : public RAS_Deformer -{ - class RAS_MeshObject* m_pMeshObject; - class BL_DeformableGameObject* m_gameobj; - -public: - KX_SoftBodyDeformer(RAS_MeshObject* pMeshObject,BL_DeformableGameObject* gameobj) - :m_pMeshObject(pMeshObject), - m_gameobj(gameobj) - { - //printf("KX_SoftBodyDeformer\n"); - }; - - virtual ~KX_SoftBodyDeformer() - { - //printf("~KX_SoftBodyDeformer\n"); - }; - virtual void Relink(GEN_Map*map); - virtual bool Apply(class RAS_IPolyMaterial *polymat); - virtual bool Update(void) - { - //printf("update\n"); - m_bDynamic = true; - return true;//?? - } - virtual bool UpdateBuckets(void) - { - // this is to update the mesh slots outside the rasterizer, - // no need to do it for this deformer, it's done in any case in Apply() - return false; - } - - virtual RAS_Deformer *GetReplica() - { - KX_SoftBodyDeformer* deformer = new KX_SoftBodyDeformer(*this); - deformer->ProcessReplica(); - return deformer; - } - virtual void ProcessReplica() - { - // we have two pointers to deal with but we cannot do it now, will be done in Relink - m_bDynamic = false; - } - virtual bool SkipVertexTransform() - { - return true; - } - -protected: - //class RAS_MeshObject *m_pMesh; - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_ShapeDeformer"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - - -#endif - diff --git a/source/gameengine/Converter/Makefile b/source/gameengine/Converter/Makefile deleted file mode 100644 index b6da47930d3..00000000000 --- a/source/gameengine/Converter/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = blconverter -DIR = $(OCGDIR)/gameengine/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(OPENGL_HEADERS) -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I$(NAN_BULLET2)/include -CPPFLAGS += -I$(NAN_AUDASPACE)/include - -CPPFLAGS += -I../../blender -# these two needed because of blenkernel -CPPFLAGS += -I../../blender/windowmanager -CPPFLAGS += -I../../blender/imbuf -CPPFLAGS += -I../../blender/makesdna -CPPFLAGS += -I../../blender/makesrna -CPPFLAGS += -I../../blender/editors/include -CPPFLAGS += -I../../blender/blenlib -CPPFLAGS += -I../../blender/blenkernel -CPPFLAGS += -I../../blender/blenloader -CPPFLAGS += -I../../blender/render/extern/include -CPPFLAGS += -I../../blender/gpu -CPPFLAGS += -I../../blender/ikplugin -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include -CPPFLAGS += -I../Expressions -I../Rasterizer -I../GameLogic -CPPFLAGS += -I../Ketsji -I../BlenderRoutines -I../SceneGraph -CPPFLAGS += -I../../kernel/gen_system -CPPFLAGS += -I../Rasterizer/RAS_OpenGLRasterizer -CPPFLAGS += -I../Network -I../Ketsji/KXNetwork -CPPFLAGS += -I../Physics/common -I../Physics/Dummy -CPPFLAGS += -I../Physics/BlOde -CPPFLAGS += -I../Physics/Bullet -CPPFLAGS += -I. diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript deleted file mode 100644 index 616c205732c..00000000000 --- a/source/gameengine/Converter/SConscript +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = env.Glob('*.cpp') -defs = [] - -incs = '. #source/kernel/gen_system #intern/string #intern/guardedalloc' -incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer' -incs += ' #intern/audaspace/intern #source/gameengine/Converter' -incs += ' #source/gameengine/BlenderRoutines #source/blender/imbuf' -incs += ' #intern/moto/include #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork' -incs += ' #source/blender/blenlib #source/blender/blenkernel #source/blender' -incs += ' #source/blender/editors/include #source/blender/makesdna #source/gameengine/Rasterizer' -incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer #source/gameengine/GameLogic' -incs += ' #source/gameengine/Expressions #source/gameengine/Network #source/gameengine/SceneGraph' -incs += ' #source/gameengine/Physics/common #source/gameengine/Physics/Bullet' -incs += ' #source/gameengine/Physics/Dummy' -incs += ' #source/gameengine/Network/LoopBackNetwork' -incs += ' #source/blender/misc #source/blender/blenloader #source/blender/gpu' -incs += ' #source/blender/windowmanager' -incs += ' #source/blender/makesrna' -incs += ' #source/blender/ikplugin' - -incs += ' ' + env['BF_BULLET_INC'] - -if env['BF_DEBUG']: - if env['OURPLATFORM'] in ('win32-mingw', 'win32-vc', 'win64-vc'): - defs.append('_DEBUG') - -if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] -else: - defs.append('DISABLE_PYTHON') - -env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Expressions/BoolValue.cpp b/source/gameengine/Expressions/BoolValue.cpp deleted file mode 100644 index e6bb454a1b5..00000000000 --- a/source/gameengine/Expressions/BoolValue.cpp +++ /dev/null @@ -1,209 +0,0 @@ - -// BoolValue.cpp: implementation of the CBoolValue class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include "BoolValue.h" -#include "StringValue.h" -#include "ErrorValue.h" -#include "VoidValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -const STR_String CBoolValue::sTrueString = "TRUE"; -const STR_String CBoolValue::sFalseString = "FALSE"; - -CBoolValue::CBoolValue() -/* -pre: false -effect: constructs a new CBoolValue -*/ -{ - trace("Bool constructor error"); -} - - - -CBoolValue::CBoolValue(bool inBool) -: m_bool(inBool) -{ -} // Constructs a new CBoolValue containing - - - -CBoolValue::CBoolValue(bool innie,const char *name,AllocationTYPE alloctype) -{ - m_bool = innie; - SetName(name); - - if (alloctype == CValue::STACKVALUE) - CValue::DisableRefCount(); -} - - - -void CBoolValue::SetValue(CValue* newval) -{ - m_bool = (newval->GetNumber() != 0); - SetModified(true); -} - - - -CValue* CBoolValue::Calc(VALUE_OPERATOR op, CValue *val) -/* -pre: -ret: a new object containing the result of applying operator op to this -object and val -*/ -{ - switch (op) - { - case VALUE_POS_OPERATOR: - case VALUE_NEG_OPERATOR: - { - return new CErrorValue (op2str(op) + GetText()); - break; - } - case VALUE_NOT_OPERATOR: - { - return new CBoolValue (!m_bool); - break; - } - default: - { - return val->CalcFinal(VALUE_BOOL_TYPE, op, this); - break; - } - } -} - - - -CValue* CBoolValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) -/* -pre: the type of val is dtype -ret: a new object containing the result of applying operator op to val and -this object -*/ -{ - CValue *ret; - - switch(dtype) - { - case VALUE_EMPTY_TYPE: - case VALUE_BOOL_TYPE: - { - switch(op) - { - case VALUE_AND_OPERATOR: - { - ret = new CBoolValue (((CBoolValue *) val)->GetBool() && m_bool); - break; - } - case VALUE_OR_OPERATOR: - { - ret = new CBoolValue (((CBoolValue *) val)->GetBool() || m_bool); - break; - } - case VALUE_EQL_OPERATOR: - { - ret = new CBoolValue (((CBoolValue *) val)->GetBool() == m_bool); - break; - } - case VALUE_NEQ_OPERATOR: - { - ret = new CBoolValue (((CBoolValue *) val)->GetBool() != m_bool); - break; - } - case VALUE_NOT_OPERATOR: - { - return new CBoolValue (!m_bool); - break; - } - default: - { - ret = new CErrorValue(val->GetText() + op2str(op) + - "[operator not allowed on booleans]"); - break; - } - } - break; - } - case VALUE_STRING_TYPE: - { - switch(op) - { - case VALUE_ADD_OPERATOR: - { - ret = new CStringValue(val->GetText() + GetText(),""); - break; - } - default: - { - ret = new CErrorValue(val->GetText() + op2str(op) + "[Only + allowed on boolean and string]"); - break; - } - } - break; - } - default: - ret = new CErrorValue("[type mismatch]" + op2str(op) + GetText()); - } - - return ret; -} - - - -bool CBoolValue::GetBool() -/* -pre: -ret: the bool stored in the object -*/ -{ - return m_bool; -} - - - -double CBoolValue::GetNumber() -{ - return (double)m_bool; -} - - - -const STR_String& CBoolValue::GetText() -{ - return m_bool ? sTrueString : sFalseString; -} - - - -CValue* CBoolValue::GetReplica() -{ - CBoolValue* replica = new CBoolValue(*this); - replica->ProcessReplica(); - - return replica; -} - -#ifndef DISABLE_PYTHON -PyObject* CBoolValue::ConvertValueToPython() -{ - return PyBool_FromLong(m_bool != 0); -} -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Expressions/BoolValue.h b/source/gameengine/Expressions/BoolValue.h deleted file mode 100644 index baec6bdee69..00000000000 --- a/source/gameengine/Expressions/BoolValue.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * BoolValue.h: interface for the CBoolValue class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ -#if !defined _BOOLVALUE_H -#define _BOOLVALUE_H - -#include "Value.h" - -/** - * Smart Boolean Value class. - * Is used by parser when an expression tree is build containing booleans. - */ - -class CBoolValue : public CPropValue -{ - - //PLUGIN_DECLARE_SERIAL(CBoolValue,CValue) - -public: - static const STR_String sTrueString; - static const STR_String sFalseString; - - CBoolValue(); - CBoolValue(bool inBool); - CBoolValue(bool innie, const char *name, AllocationTYPE alloctype = CValue::HEAPVALUE); - - virtual const STR_String& GetText(); - virtual double GetNumber(); - bool GetBool(); - virtual void SetValue(CValue* newval); - - virtual CValue* Calc(VALUE_OPERATOR op, CValue *val); - virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - - void Configure(CValue* menuvalue); - virtual CValue* GetReplica(); -#ifndef DISABLE_PYTHON - virtual PyObject* ConvertValueToPython(); -#endif - -private: - bool m_bool; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CBoolValue"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined _BOOLVALUE_H - diff --git a/source/gameengine/Expressions/CMakeLists.txt b/source/gameengine/Expressions/CMakeLists.txt deleted file mode 100644 index 41f771e12bd..00000000000 --- a/source/gameengine/Expressions/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -FILE(GLOB SRC *.cpp) - -SET(INC - . - ../../../source/kernel/gen_system - ../../../intern/string - ../../../intern/guardedalloc - ../../../intern/moto/include - ../../../source/gameengine/SceneGraph - ../../../source/blender/blenloader -) - -IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) -ELSE(WITH_PYTHON) - ADD_DEFINITIONS(-DDISABLE_PYTHON) -ENDIF(WITH_PYTHON) - -BLENDERLIB(bf_expressions "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_expressions', sources, Split(incs), [], libtype=['game','player'], priority = [45,125] ) diff --git a/source/gameengine/Expressions/ConstExpr.cpp b/source/gameengine/Expressions/ConstExpr.cpp deleted file mode 100644 index e873e968c86..00000000000 --- a/source/gameengine/Expressions/ConstExpr.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// ConstExpr.cpp: implementation of the CConstExpr class. - -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include "Value.h" // for precompiled header -#include "ConstExpr.h" -#include "VectorValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CConstExpr::CConstExpr() -{ -} - - - -CConstExpr::CConstExpr(CValue* constval) -/* -pre: -effect: constructs a CConstExpr cointing the value constval -*/ -{ - m_value = constval; -// m_bModified=true; -} - - - -CConstExpr::~CConstExpr() -/* -pre: -effect: deletes the object -*/ -{ - if (m_value) - m_value->Release(); -} - - - -unsigned char CConstExpr::GetExpressionID() -{ - return CCONSTEXPRESSIONID; -} - - - -CValue* CConstExpr::Calculate() -/* -pre: -ret: a new object containing the value of the stored CValue -*/ -{ - return m_value->AddRef(); -} - - - -void CConstExpr::ClearModified() -{ - if (m_value) - { - m_value->SetModified(false); - m_value->SetAffected(false); - } -} - - - -double CConstExpr::GetNumber() -{ - return -1; -} - - - -bool CConstExpr::NeedsRecalculated() -{ - return m_value->IsAffected(); // IsAffected is m_bModified OR m_bAffected !!! -} - - - -CExpression* CConstExpr::CheckLink(std::vector& brokenlinks) -{ -// parent checks if child is still usefull. -// When for example it's value it's deleted flag set -// then release Value, and return NULL in case of constexpression -// else return this... - - assertd(m_value); - if (m_value->IsReleaseRequested()) - { - AddRef(); //numchanges++; - return Release(); - } - else - return this; -} - - - -void CConstExpr::BroadcastOperators(VALUE_OPERATOR op) -{ - assertd(m_value); - m_value->SetColorOperator(op); -} - - - -bool CConstExpr::MergeExpression(CExpression *otherexpr) -{ - assertd(false); - return false; -} diff --git a/source/gameengine/Expressions/ConstExpr.h b/source/gameengine/Expressions/ConstExpr.h deleted file mode 100644 index f48b8d34355..00000000000 --- a/source/gameengine/Expressions/ConstExpr.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ConstExpr.h: interface for the CConstExpr class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __CONSTEXPR_H__ -#define __CONSTEXPR_H__ - -#include "Expression.h" -#include "Value.h" // Added by ClassView - -class CConstExpr : public CExpression -{ - //PLUGIN_DECLARE_SERIAL_EXPRESSION (CConstExpr,CExpression) -public: - virtual bool MergeExpression(CExpression* otherexpr); - - void BroadcastOperators(VALUE_OPERATOR op); - - virtual unsigned char GetExpressionID(); - CExpression* CheckLink(std::vector& brokenlinks); - //bool IsInside(float x,float y,float z,bool bBorderInclude=true); - bool NeedsRecalculated(); - void ClearModified(); - virtual double GetNumber(); - virtual CValue* Calculate(); - CConstExpr(CValue* constval); - CConstExpr(); - virtual ~CConstExpr(); - - -private: - CValue* m_value; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CConstExpr"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined(AFX_CONSTEXPR_H__061ECFC3_BE87_11D1_A51C_00A02472FC58__INCLUDED_) - diff --git a/source/gameengine/Expressions/EXP_C-Api.cpp b/source/gameengine/Expressions/EXP_C-Api.cpp deleted file mode 100644 index d97e13b7784..00000000000 --- a/source/gameengine/Expressions/EXP_C-Api.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "EXP_C-Api.h" -#include "IntValue.h" -#include "BoolValue.h" -#include "StringValue.h" -#include "ErrorValue.h" -#include "InputParser.h" - -EXP_ValueHandle EXP_CreateInt(int innie) -{ - return (EXP_ValueHandle) new CIntValue(innie); -} - - - -EXP_ValueHandle EXP_CreateBool(int innie) -{ - return (EXP_ValueHandle) new CBoolValue(innie!=0); -} - - - -EXP_ValueHandle EXP_CreateString(const char* str) -{ - - return (EXP_ValueHandle) new CStringValue(str,""); -} - - - -void EXP_SetName(EXP_ValueHandle inval,const char* newname) -{ - ((CValue*) inval)->SetName(newname); -} - - - -/* calculate expression from inputtext */ -EXP_ValueHandle EXP_ParseInput(const char* inputtext) -{ - CValue* resultval=NULL; - CParser parser; - CExpression* expr = parser.ProcessText(inputtext); - if (expr) - { - resultval = expr->Calculate(); - expr->Release(); - } - else - { - resultval = new CErrorValue("couldn't parsetext"); - } - - return (EXP_ValueHandle) resultval; -} - - - -void EXP_ReleaseValue(EXP_ValueHandle inval) -{ - ((CValue*) inval)->Release(); -} - - - -int EXP_IsValid(EXP_ValueHandle inval) -{ - return !((CValue*) inval)->IsError(); -} - - - -/* assign property 'propval' to 'destinationval' */ -void EXP_SetProperty(EXP_ValueHandle destinationval, - const char* propname, - EXP_ValueHandle propval) -{ - ((CValue*) destinationval)->SetProperty(propname,(CValue*)propval); -} - - - -const char* EXP_GetText(EXP_ValueHandle inval) -{ - return ((CValue*) inval)->GetText(); -} - - - -EXP_ValueHandle EXP_GetProperty(EXP_ValueHandle inval,const char* propname) -{ - return (EXP_ValueHandle) ((CValue*)inval)->GetProperty(propname); -} diff --git a/source/gameengine/Expressions/EXP_C-Api.h b/source/gameengine/Expressions/EXP_C-Api.h deleted file mode 100644 index 12fdc4945e7..00000000000 --- a/source/gameengine/Expressions/EXP_C-Api.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __EXPRESSION_INCLUDE -#define __EXPRESSION_INCLUDE - -#define EXP_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name - -EXP_DECLARE_HANDLE(EXP_ValueHandle); -EXP_DECLARE_HANDLE(EXP_ExpressionHandle); - - -#ifdef __cplusplus -extern "C" { -#endif - -extern EXP_ValueHandle EXP_CreateInt(int innie); -extern EXP_ValueHandle EXP_CreateBool(int innie); -extern EXP_ValueHandle EXP_CreateString(const char* str); -extern void EXP_SetName(EXP_ValueHandle,const char* newname); - -/* calculate expression from inputtext */ -extern EXP_ValueHandle EXP_ParseInput(const char* inputtext); -extern void EXP_ReleaseValue(EXP_ValueHandle); -extern int EXP_IsValid(EXP_ValueHandle); - -/* assign property 'propval' to 'destinationval' */ -extern void EXP_SetProperty(EXP_ValueHandle propval,EXP_ValueHandle destinationval); - -/* returns NULL if property doesn't exist */ -extern EXP_ValueHandle EXP_GetProperty(EXP_ValueHandle inval,const char* propname); - -const char* EXP_GetText(EXP_ValueHandle); - -#ifdef __cplusplus -} -#endif - -#endif //__EXPRESSION_INCLUDE - diff --git a/source/gameengine/Expressions/EmptyValue.cpp b/source/gameengine/Expressions/EmptyValue.cpp deleted file mode 100644 index 22215ba5ed1..00000000000 --- a/source/gameengine/Expressions/EmptyValue.cpp +++ /dev/null @@ -1,123 +0,0 @@ - -// EmptyValue.cpp: implementation of the CEmptyValue class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include "EmptyValue.h" -#include "IntValue.h" -#include "FloatValue.h" -#include "StringValue.h" -#include "ErrorValue.h" -#include "ListValue.h" -#include "VoidValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CEmptyValue::CEmptyValue() -/* -pre: -effect: constructs a new CEmptyValue -*/ -{ - SetModified(false); -} - - - -CEmptyValue::~CEmptyValue() -/* -pre: -effect: deletes the object -*/ -{ - -} - - - -CValue * CEmptyValue::Calc(VALUE_OPERATOR op, CValue * val) -/* -pre: -ret: a new object containing the result of applying operator op to this -object and val -*/ -{ - return val->CalcFinal(VALUE_EMPTY_TYPE, op, this); - -} - - - -CValue * CEmptyValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue * val) -/* -pre: the type of val is dtype -ret: a new object containing the result of applying operator op to val and -this object -*/ -{ - return val->AddRef(); -} - - - -double CEmptyValue::GetNumber() -{ - return 0; -} - - - -CListValue* CEmptyValue::GetPolySoup() -{ - CListValue* soup = new CListValue(); - //don't add any poly, while it's an empty value - return soup; -} - - - -bool CEmptyValue::IsInside(CValue* testpoint,bool bBorderInclude) -{ - // empty space is solid, so always inside - return true; -} - - - -double* CEmptyValue::GetVector3(bool bGetTransformedVec) -{ - assertd(false); // don't get vector from me - return ZeroVector(); -} - - - -static STR_String emptyString = STR_String(""); - - -const STR_String & CEmptyValue::GetText() -{ - return emptyString; -} - - - -CValue* CEmptyValue::GetReplica() -{ - CEmptyValue* replica = new CEmptyValue(*this); - replica->ProcessReplica(); - return replica; -} - diff --git a/source/gameengine/Expressions/EmptyValue.h b/source/gameengine/Expressions/EmptyValue.h deleted file mode 100644 index 01029d1655d..00000000000 --- a/source/gameengine/Expressions/EmptyValue.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * EmptyValue.h: interface for the CEmptyValue class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ -#if !defined _EMPTYVALUE_H -#define _EMPTYVALUE_H - -#include "Value.h" - -class CListValue; - -class CEmptyValue : public CPropValue -{ - //PLUGIN_DECLARE_SERIAL (CEmptyValue,CValue) -public: - CEmptyValue(); - virtual ~CEmptyValue(); - - virtual const STR_String & GetText(); - virtual double GetNumber(); - CListValue* GetPolySoup(); - virtual double* GetVector3(bool bGetTransformedVec=false); - bool IsInside(CValue* testpoint,bool bBorderInclude=true); - CValue * Calc(VALUE_OPERATOR op, CValue *val); - CValue * CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - virtual CValue* GetReplica(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CEmptyValue"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined _EMPTYVALUE_H - diff --git a/source/gameengine/Expressions/ErrorValue.cpp b/source/gameengine/Expressions/ErrorValue.cpp deleted file mode 100644 index 3063d02d69d..00000000000 --- a/source/gameengine/Expressions/ErrorValue.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// ErrorValue.cpp: implementation of the CErrorValue class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include "ErrorValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CErrorValue::CErrorValue() -/* -pre: -effect: constructs a new CErrorValue containing errormessage "Error" -*/ -{ - m_strErrorText = "Error"; - SetError(true); -} - - - -CErrorValue::CErrorValue(const char *errmsg) -/* -pre: -effect: constructs a new CErrorValue containing errormessage errmsg -*/ -{ - m_strErrorText = "["; - m_strErrorText += errmsg; - m_strErrorText += "]"; - SetError(true); -} - - - -CErrorValue::~CErrorValue() -/* -pre: -effect: deletes the object -*/ -{ - -} - - - -CValue* CErrorValue::Calc(VALUE_OPERATOR op, CValue *val) -/* -pre: -ret: a new object containing the result of applying operator op to this - object and val -*/ -{ - CValue* errorval; - - switch (op) - { - case VALUE_POS_OPERATOR: - case VALUE_NEG_OPERATOR: - case VALUE_NOT_OPERATOR: - { - errorval = new CErrorValue (op2str(op) + GetText()); - break; - } - default: - { - errorval = val->CalcFinal(VALUE_ERROR_TYPE, op, this); - break; - } - } - - return errorval; -} - - - -CValue* CErrorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) -/* -pre: the type of val is dtype -ret: a new object containing the result of applying operator op to val and - this object -*/ -{ - return new CErrorValue (val->GetText() + op2str(op) + GetText()); -} - - - -double CErrorValue::GetNumber() -{ - return -1; -} - - - -const STR_String & CErrorValue::GetText() -{ - return m_strErrorText; -} - - - -CValue* CErrorValue::GetReplica() -{ - // who would want a copy of an error ? - trace ("Error: ErrorValue::GetReplica() not implemented yet"); - assertd(false); - - return NULL; -} diff --git a/source/gameengine/Expressions/ErrorValue.h b/source/gameengine/Expressions/ErrorValue.h deleted file mode 100644 index 2f65850c4f1..00000000000 --- a/source/gameengine/Expressions/ErrorValue.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * ErrorValue.h: interface for the CErrorValue class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#if !defined _ERRORVALUE_H -#define _ERRORVALUE_H - -#include "Value.h" - -class CErrorValue : public CPropValue -{ - -public: - virtual const STR_String & GetText(); - virtual double GetNumber(); - CErrorValue(); - CErrorValue(const char *errmsg); - virtual ~CErrorValue(); - virtual CValue* Calc(VALUE_OPERATOR op, CValue* val); - virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - virtual CValue* GetReplica(); - -private: - STR_String m_strErrorText; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CErrorValue"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined _ERRORVALUE_H - diff --git a/source/gameengine/Expressions/Expression.cpp b/source/gameengine/Expressions/Expression.cpp deleted file mode 100644 index 7ef0d4cc84c..00000000000 --- a/source/gameengine/Expressions/Expression.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Expression.cpp: implementation of the CExpression class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include "Expression.h" -#include "ErrorValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// -#ifdef _DEBUG -//int gRefCountExpr; -#endif -CExpression::CExpression()// : m_cached_calculate(NULL) -{ - m_refcount = 1; -#ifdef _DEBUG - //gRefCountExpr++; -#endif -} - -CExpression::~CExpression() -{ - assert (m_refcount == 0); -} - - - -// destuctor for CBrokenLinkInfo -CBrokenLinkInfo::~CBrokenLinkInfo() -{ - if (m_pExpr && !m_bRestored) - m_pExpr->Release(); -} - - -void CBrokenLinkInfo::RestoreLink() -{ - - - assertd(m_pExpr); - - if (m_pExpr) - { - if (!m_bRestored){ - m_bRestored=true; - - } - if (*m_pmemExpr) - { - (*m_pmemExpr)->Release(); - } - *m_pmemExpr = m_pExpr; - -// m_pExpr=NULL; - } -} - -void CBrokenLinkInfo::BreakLink() -{ - m_bRestored=false; - m_pExpr->AddRef(); -} - diff --git a/source/gameengine/Expressions/Expression.h b/source/gameengine/Expressions/Expression.h deleted file mode 100644 index bd346fd0552..00000000000 --- a/source/gameengine/Expressions/Expression.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Expression.h: interface for the CExpression class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#if !defined _EXPRESSION_H -#define _EXPRESSION_H - -#include "Value.h" - -//extern int gRefCountExpr; // only for debugging purposes (detect mem.leaks) - - -#define PLUGIN_DECLARE_SERIAL_EXPRESSION(class_name,base_class_name) \ -public: \ - virtual base_class_name * Copy() { return new class_name; } \ - virtual bool EdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring); \ - virtual bool EdIdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring) \ -{ \ - if (bIsStoring) \ - { \ - unsigned char exprID = GetExpressionID(); \ - arch << exprID; \ - } \ - return true; \ -} \ - - - -class CExpression; - - -// for undo/redo system the deletion in the expressiontree can be restored by replacing broken links 'inplace' -class CBrokenLinkInfo -{ - public: - CBrokenLinkInfo(CExpression** pmemexpr,CExpression* expr) - :m_pmemExpr(pmemexpr), - m_pExpr(expr) - { - assertd(pmemexpr); - m_bRestored=false; - }; - - virtual ~CBrokenLinkInfo(); - void RestoreLink(); - void BreakLink(); - - - // members vars - private: - CExpression** m_pmemExpr; - CExpression* m_pExpr; - bool m_bRestored; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CBrokenLinkInfo"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - - - - - - - - -class CExpression -{ -public: - enum { - COPERATOR1EXPRESSIONID = 1, - COPERATOR2EXPRESSIONID = 2, - CCONSTEXPRESSIONID = 3, - CIFEXPRESSIONID = 4, - COPERATORVAREXPRESSIONID = 5, - CIDENTIFIEREXPRESSIONID = 6 - }; - - -protected: - virtual ~CExpression() = 0; //pure virtual -public: - virtual bool MergeExpression(CExpression* otherexpr) = 0; - CExpression(); - - - virtual CValue* Calculate() = 0; //pure virtual - virtual unsigned char GetExpressionID() = 0; - //virtual bool IsInside(float x,float y,float z,bool bBorderInclude=true) = 0; //pure virtual - virtual bool NeedsRecalculated() = 0; // another pure one - virtual CExpression * CheckLink(std::vector& brokenlinks) =0; // another pure one - virtual void ClearModified() = 0; // another pure one - //virtual CExpression * Copy() =0; - virtual void BroadcastOperators(VALUE_OPERATOR op) =0; - - virtual CExpression * AddRef() { // please leave multiline, for debugger !!! - -#ifdef _DEBUG - //gRefCountExpr++; - assertd(m_refcount < 255); -#endif - m_refcount++; - return this; - }; - virtual CExpression* Release(CExpression* complicatedtrick=NULL) { -#ifdef _DEBUG - //gRefCountExpr--; -#endif - if (--m_refcount < 1) - { - delete this; - } //else - // return this; - return complicatedtrick; - }; - - -protected: - - int m_refcount; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CExpression"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined _EXPRESSION_H - diff --git a/source/gameengine/Expressions/FloatValue.cpp b/source/gameengine/Expressions/FloatValue.cpp deleted file mode 100644 index 82c86ac68b2..00000000000 --- a/source/gameengine/Expressions/FloatValue.cpp +++ /dev/null @@ -1,318 +0,0 @@ -// FloatValue.cpp: implementation of the CFloatValue class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include "FloatValue.h" -#include "IntValue.h" -#include "StringValue.h" -#include "BoolValue.h" -#include "ErrorValue.h" -#include "VoidValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CFloatValue::CFloatValue() -/* -pre: false -effect: constructs a new CFloatValue -*/ -{ - m_pstrRep=NULL; -} - - - -CFloatValue::CFloatValue(float fl) -/* -pre: -effect: constructs a new CFloatValue containing value fl -*/ -{ - m_float = fl; - m_pstrRep=NULL; -} - - - -CFloatValue::CFloatValue(float fl,const char *name,AllocationTYPE alloctype) -/* -pre: -effect: constructs a new CFloatValue containing value fl -*/ -{ - - m_float = fl; - SetName(name); - if (alloctype==CValue::STACKVALUE) - { - CValue::DisableRefCount(); - - } - m_pstrRep=NULL; -} - - - -CFloatValue::~CFloatValue() -/* -pre: -effect: deletes the object -*/ -{ - if (m_pstrRep) - delete m_pstrRep; -} - - - -CValue* CFloatValue::Calc(VALUE_OPERATOR op, CValue *val) -/* -pre: -ret: a new object containing the result of applying operator op to this - object and val -*/ -{ - //return val->CalcFloat(op, this); - switch (op) - { - case VALUE_POS_OPERATOR: - return new CFloatValue (m_float); - break; - case VALUE_NEG_OPERATOR: - return new CFloatValue (-m_float); - break; - case VALUE_NOT_OPERATOR: - return new CErrorValue (op2str(op) + "only allowed on booleans"); - break; - case VALUE_AND_OPERATOR: - case VALUE_OR_OPERATOR: - return new CErrorValue(val->GetText() + op2str(op) + "only allowed on booleans"); - break; - default: - return val->CalcFinal(VALUE_FLOAT_TYPE, op, this); - break; - } -} - - - -CValue* CFloatValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) -/* -pre: the type of val is dtype -ret: a new object containing the result of applying operator op to val and - this object -*/ -{ - CValue *ret; - - switch(dtype) - { - case VALUE_INT_TYPE: - { - switch (op) - { - case VALUE_MOD_OPERATOR: - ret = new CFloatValue(fmod(((CIntValue *) val)->GetInt(), m_float)); - break; - case VALUE_ADD_OPERATOR: - ret = new CFloatValue(((CIntValue *) val)->GetInt() + m_float); - break; - case VALUE_SUB_OPERATOR: - ret = new CFloatValue(((CIntValue *) val)->GetInt() - m_float); - break; - case VALUE_MUL_OPERATOR: - ret = new CFloatValue(((CIntValue *) val)->GetInt() * m_float); - break; - case VALUE_DIV_OPERATOR: - if (m_float == 0) - ret = new CErrorValue("Division by zero"); - else - ret = new CFloatValue (((CIntValue *) val)->GetInt() / m_float); - break; - case VALUE_EQL_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() == m_float); - break; - case VALUE_NEQ_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() != m_float); - break; - case VALUE_GRE_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() > m_float); - break; - case VALUE_LES_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() < m_float); - break; - case VALUE_GEQ_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() >= m_float); - break; - case VALUE_LEQ_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() <= m_float); - break; - default: - ret = new CErrorValue("illegal operator. please send a bug report."); - break; - } - break; - } - case VALUE_EMPTY_TYPE: - case VALUE_FLOAT_TYPE: - { - switch (op) - { - case VALUE_MOD_OPERATOR: - ret = new CFloatValue(fmod(((CFloatValue *) val)->GetFloat(), m_float)); - break; - case VALUE_ADD_OPERATOR: - ret = new CFloatValue(((CFloatValue *) val)->GetFloat() + m_float); - break; - case VALUE_SUB_OPERATOR: - ret = new CFloatValue(((CFloatValue *) val)->GetFloat() - m_float); - break; - case VALUE_MUL_OPERATOR: - ret = new CFloatValue(((CFloatValue *) val)->GetFloat() * m_float); - break; - case VALUE_DIV_OPERATOR: - if (m_float == 0) - ret = new CErrorValue("Division by zero"); - else - ret = new CFloatValue (((CFloatValue *) val)->GetFloat() / m_float); - break; - case VALUE_EQL_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() == m_float); - break; - case VALUE_NEQ_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() != m_float); - break; - case VALUE_GRE_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() > m_float); - break; - case VALUE_LES_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() < m_float); - break; - case VALUE_GEQ_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() >= m_float); - break; - case VALUE_LEQ_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() <= m_float); - break; - case VALUE_NEG_OPERATOR: - ret = new CFloatValue (-m_float); - break; - case VALUE_POS_OPERATOR: - ret = new CFloatValue (m_float); - break; - - default: - ret = new CErrorValue("illegal operator. please send a bug report."); - break; - } - break; - } - case VALUE_STRING_TYPE: - { - switch(op) - { - case VALUE_ADD_OPERATOR: - ret = new CStringValue(val->GetText() + GetText(),""); - break; - case VALUE_EQL_OPERATOR: - case VALUE_NEQ_OPERATOR: - case VALUE_GRE_OPERATOR: - case VALUE_LES_OPERATOR: - case VALUE_GEQ_OPERATOR: - case VALUE_LEQ_OPERATOR: - ret = new CErrorValue("[Cannot compare string with float]" + op2str(op) + GetText()); - break; - default: - ret = new CErrorValue("[operator not allowed on strings]" + op2str(op) + GetText()); - break; - } - break; - } - case VALUE_BOOL_TYPE: - ret = new CErrorValue("[operator not valid on boolean and float]" + op2str(op) + GetText()); - break; - case VALUE_ERROR_TYPE: - ret = new CErrorValue(val->GetText() + op2str(op) + GetText()); - break; - default: - ret = new CErrorValue("illegal type. contact your dealer (if any)"); - break; - } - return ret; -} - - - -void CFloatValue::SetFloat(float fl) -{ - m_float = fl; - SetModified(true); -} - - - -float CFloatValue::GetFloat() -/* -pre: -ret: the float stored in the object -*/ -{ - return m_float; -} - - - -double CFloatValue::GetNumber() -{ - return m_float; -} - - - -void CFloatValue::SetValue(CValue* newval) -{ - m_float = (float)newval->GetNumber(); - SetModified(true); -} - - - -const STR_String & CFloatValue::GetText() -{ - if (!m_pstrRep) - m_pstrRep = new STR_String(); - - m_pstrRep->Format("%f",m_float); - return *m_pstrRep; -} - - - -CValue* CFloatValue::GetReplica() -{ - CFloatValue* replica = new CFloatValue(*this); - replica->m_pstrRep = NULL; /* should be in CFloatValue::ProcessReplica() but its not defined, no matter */ - replica->ProcessReplica(); - - return replica; -} - - -#ifndef DISABLE_PYTHON -PyObject* CFloatValue::ConvertValueToPython() -{ - return PyFloat_FromDouble(m_float); -} -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Expressions/FloatValue.h b/source/gameengine/Expressions/FloatValue.h deleted file mode 100644 index f1469734a1f..00000000000 --- a/source/gameengine/Expressions/FloatValue.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * FloatValue.h: interface for the CFloatValue class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ -#if !defined _FLOATVALUE_H -#define _FLOATVALUE_H - -#include "Value.h" - -class CFloatValue : public CPropValue -{ - //PLUGIN_DECLARE_SERIAL (CFloatValue,CValue) -public: - CFloatValue(); - CFloatValue(float fl); - CFloatValue(float fl,const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE); - - virtual const STR_String & GetText(); - - void Configure(CValue* menuvalue); - virtual double GetNumber(); - virtual void SetValue(CValue* newval); - float GetFloat(); - void SetFloat(float fl); - virtual ~CFloatValue(); - virtual CValue* GetReplica(); - virtual CValue* Calc(VALUE_OPERATOR op, CValue *val); - virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); -#ifndef DISABLE_PYTHON - virtual PyObject* ConvertValueToPython(); -#endif - -protected: - float m_float; - STR_String* m_pstrRep; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CFloatValue"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined _FLOATVALUE_H - diff --git a/source/gameengine/Expressions/IdentifierExpr.cpp b/source/gameengine/Expressions/IdentifierExpr.cpp deleted file mode 100644 index 3cbd5b748d1..00000000000 --- a/source/gameengine/Expressions/IdentifierExpr.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "IdentifierExpr.h" - -CIdentifierExpr::CIdentifierExpr(const STR_String& identifier,CValue* id_context) -:m_identifier(identifier) -{ - if (id_context) - m_idContext = id_context->AddRef(); - else - m_idContext=NULL; -} - - -CIdentifierExpr::~CIdentifierExpr() -{ - if (m_idContext) - m_idContext->Release(); -} - - - -CValue* CIdentifierExpr::Calculate() -{ - CValue* result = NULL; - if (m_idContext) - result = m_idContext->FindIdentifier(m_identifier); - - return result; -} - - - -bool CIdentifierExpr::MergeExpression(CExpression* otherexpr) -{ - return false; -} - - - -unsigned char CIdentifierExpr::GetExpressionID() -{ - return CIDENTIFIEREXPRESSIONID; -} - - - -bool CIdentifierExpr::NeedsRecalculated() -{ - return true; -} - - - -CExpression* CIdentifierExpr::CheckLink(std::vector& brokenlinks) -{ - assertd(false); // not implemented yet - return NULL; -} - - - -void CIdentifierExpr::ClearModified() -{ - assertd(false); // not implemented yet -} - - - -void CIdentifierExpr::BroadcastOperators(VALUE_OPERATOR op) -{ - assertd(false); // not implemented yet -} diff --git a/source/gameengine/Expressions/IdentifierExpr.h b/source/gameengine/Expressions/IdentifierExpr.h deleted file mode 100644 index c47a63659c1..00000000000 --- a/source/gameengine/Expressions/IdentifierExpr.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __IDENTIFIER_EXPR -#define __IDENTIFIER_EXPR - -#include "Expression.h" - -class CIdentifierExpr : public CExpression -{ - CValue* m_idContext; - STR_String m_identifier; -public: - CIdentifierExpr(const STR_String& identifier,CValue* id_context); - virtual ~CIdentifierExpr(); - - virtual CValue* Calculate(); - virtual bool MergeExpression(CExpression* otherexpr); - virtual unsigned char GetExpressionID(); - virtual bool NeedsRecalculated(); - virtual CExpression* CheckLink(std::vector& brokenlinks); - virtual void ClearModified(); - virtual void BroadcastOperators(VALUE_OPERATOR op); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CIdentifierExpr"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__IDENTIFIER_EXPR - diff --git a/source/gameengine/Expressions/IfExpr.cpp b/source/gameengine/Expressions/IfExpr.cpp deleted file mode 100644 index 0aa9cfbd3c6..00000000000 --- a/source/gameengine/Expressions/IfExpr.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// IfExpr.cpp: implementation of the CIfExpr class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include "IfExpr.h" -#include "EmptyValue.h" -#include "ErrorValue.h" -#include "BoolValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - - -CIfExpr::CIfExpr() -{ -} - - - -CIfExpr::CIfExpr(CExpression *guard, CExpression *e1, CExpression *e2) -/* -pre: -effect: constructs an CifExpr-object corresponding to IF(guard, e1, e2) -*/ -{ - m_guard = guard; - m_e1 = e1; - m_e2 = e2; -} - - - -CIfExpr::~CIfExpr() -/* -pre: -effect: dereferences the object -*/ -{ - if (m_guard) - m_guard->Release(); - - if (m_e1) - m_e1->Release(); - - if (m_e2) - m_e2->Release(); -} - - - -CValue* CIfExpr::Calculate() -/* -pre: -ret: a new object containing the value of m_e1 if m_guard is a boolean TRUE - a new object containing the value of m_e2 if m_guard is a boolean FALSE - an new errorvalue if m_guard is not a boolean -*/ -{ - CValue *guardval; - guardval = m_guard->Calculate(); - const STR_String& text = guardval->GetText(); - guardval->Release(); - - if (&text == &CBoolValue::sTrueString) - { - return m_e1->Calculate(); - } - else if (&text == &CBoolValue::sFalseString) - { - return m_e2->Calculate(); - } - else - { - return new CErrorValue("Guard should be of boolean type"); - } -} - - - -bool CIfExpr::MergeExpression(CExpression *otherexpr) -{ - assertd(false); - return false; -} - - - -bool CIfExpr::IsInside(float x,float y,float z,bool bBorderInclude) -{ - assertd(false); - return false; -} - - - -bool CIfExpr::NeedsRecalculated() -{ - return (m_guard->NeedsRecalculated() || - m_e1->NeedsRecalculated() || - m_e2->NeedsRecalculated()); -} - - - -CExpression* CIfExpr::CheckLink(std::vector& brokenlinks) -{ - assertd(false); - return NULL; -} - - - -void CIfExpr::ClearModified() -{ - assertd(false); -} - - - -void CIfExpr::BroadcastOperators(VALUE_OPERATOR op) -{ - assertd(false); -} - - - -unsigned char CIfExpr::GetExpressionID() -{ - return CIFEXPRESSIONID; -} diff --git a/source/gameengine/Expressions/IfExpr.h b/source/gameengine/Expressions/IfExpr.h deleted file mode 100644 index f06718c851f..00000000000 --- a/source/gameengine/Expressions/IfExpr.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * IfExpr.h: interface for the CIfExpr class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ -#if !defined(AFX_IFEXPR_H__1F691841_C5C7_11D1_A863_0000B4542BD8__INCLUDED_) -#define AFX_IFEXPR_H__1F691841_C5C7_11D1_A863_0000B4542BD8__INCLUDED_ - -#if _MSC_VER >= 1000 -#pragma once -#endif // _MSC_VER >= 1000 - -#include "Expression.h" - -class CIfExpr : public CExpression -{ - //PLUGIN_DECLARE_SERIAL_EXPRESSION (CIfExpr,CExpression) - -private: - CExpression *m_guard, *m_e1, *m_e2; - -public: - virtual bool MergeExpression(CExpression* otherexpr); - CIfExpr(CExpression *guard, CExpression *e1, CExpression *e2); - CIfExpr(); - - virtual unsigned char GetExpressionID(); - virtual ~CIfExpr(); - virtual CValue* Calculate(); - - virtual bool IsInside(float x,float y,float z,bool bBorderInclude=true); - virtual bool NeedsRecalculated(); - - - virtual CExpression* CheckLink(std::vector& brokenlinks); - virtual void ClearModified(); - virtual void BroadcastOperators(VALUE_OPERATOR op); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CIfExpr"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined(AFX_IFEXPR_H__1F691841_C5C7_11D1_A863_0000B4542BD8__INCLUDED_) - diff --git a/source/gameengine/Expressions/InputParser.cpp b/source/gameengine/Expressions/InputParser.cpp deleted file mode 100644 index 8187ff6a9e8..00000000000 --- a/source/gameengine/Expressions/InputParser.cpp +++ /dev/null @@ -1,634 +0,0 @@ -// Parser.cpp: implementation of the CParser class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include - -#include "MT_assert.h" - -#include "Value.h" -#include "InputParser.h" -#include "ErrorValue.h" -#include "IntValue.h" -#include "StringValue.h" -#include "FloatValue.h" -#include "BoolValue.h" -#include "EmptyValue.h" -#include "ConstExpr.h" -#include "Operator2Expr.h" -#include "Operator1Expr.h" -#include "IdentifierExpr.h" - -// this is disable at the moment, I expected a memleak from it, but the error-cleanup was the reason -// well, looks we don't need it anyway, until maybe the Curved Surfaces are integrated into CSG -// cool things like (IF(LOD==1,CCurvedValue,IF(LOD==2,CCurvedValue2)) etc... -#include "IfExpr.h" - -#if (defined(WIN32) || defined(WIN64)) && !defined(FREE_WINDOWS) -#define strcasecmp _stricmp - -#ifndef strtoll -#define strtoll _strtoi64 -#endif - -#endif /* Def WIN32 or Def WIN64 */ - -#define NUM_PRIORITY 6 -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CParser::CParser() : m_identifierContext(NULL) -{ -} - - - -CParser::~CParser() -{ - if (m_identifierContext) - m_identifierContext->Release(); -} - - - -void CParser::ScanError(const char *str) -{ - // sets the global variable errmsg to an errormessage with - // contents str, appending if it already exists - // AfxMessageBox("Parse Error:"+str,MB_ICONERROR); - if (errmsg) - errmsg = new COperator2Expr(VALUE_ADD_OPERATOR, errmsg, Error(str)); - else - errmsg = Error(str); - - sym = errorsym; -} - - - -CExpression* CParser::Error(const char *str) -{ - // makes and returns a new CConstExpr filled with an CErrorValue - // with string str - // AfxMessageBox("Error:"+str,MB_ICONERROR); - return new CConstExpr(new CErrorValue(str)); -} - - - -void CParser::NextCh() -{ - // sets the global variable ch to the next character, if it exists - // and increases the global variable chcount - chcount++; - - if (chcount < text.Length()) - ch = text[chcount]; - else - ch = 0x00; -} - - - -void CParser::TermChar(char c) -{ - // generates an error if the next char isn't the specified char c, - // otherwise, skip the char - if(ch == c) - { - NextCh(); - } - else - { - STR_String str; - str.Format("Warning: %c expected\ncontinuing without it", c); - trace(str); - } -} - - - -void CParser::DigRep() -{ - // changes the current character to the first character that - // isn't a decimal - while ((ch >= '0') && (ch <= '9')) - NextCh(); -} - - - -void CParser::CharRep() -{ - // changes the current character to the first character that - // isn't an alphanumeric character - while (((ch >= '0') && (ch <= '9')) - || ((ch >= 'a') && (ch <= 'z')) - || ((ch >= 'A') && (ch <= 'Z')) - || (ch == '.') || (ch == '_')) - NextCh(); -} - - - -void CParser::GrabString(int start) -{ - // puts part of the input string into the global variable - // const_as_string, from position start, to position chchount - const_as_string = text.Mid(start, chcount-start); -} - - - -void CParser::NextSym() -{ - // sets the global variable sym to the next symbol, and - // if it is an operator - // sets the global variable opkind to the kind of operator - // if it is a constant - // sets the global variable constkind to the kind of operator - // if it is a reference to a cell - // sets the global variable cellcoord to the kind of operator - - errmsg = NULL; - while(ch == ' ' || ch == 0x9) - NextCh(); - - switch(ch) - { - case '(': - sym = lbracksym; NextCh(); - break; - case ')': - sym = rbracksym; NextCh(); - break; - case ',': - sym = commasym; NextCh(); - break; - case '%' : - sym = opsym; opkind = OPmodulus; NextCh(); - break; - case '+' : - sym = opsym; opkind = OPplus; NextCh(); - break; - case '-' : - sym = opsym; opkind = OPminus; NextCh(); - break; - case '*' : - sym = opsym; opkind = OPtimes; NextCh(); - break; - case '/' : - sym = opsym; opkind = OPdivide; NextCh(); - break; - case '&' : - sym = opsym; opkind = OPand; NextCh(); TermChar('&'); - break; - case '|' : - sym = opsym; opkind = OPor; NextCh(); TermChar('|'); - break; - case '=' : - sym = opsym; opkind = OPequal; NextCh(); TermChar('='); - break; - case '!' : - sym = opsym; - NextCh(); - if (ch == '=') - { - opkind = OPunequal; - NextCh(); - } - else - { - opkind = OPnot; - } - break; - case '>': - sym = opsym; - NextCh(); - if (ch == '=') - { - opkind = OPgreaterequal; - NextCh(); - } - else - { - opkind = OPgreater; - } - break; - case '<': - sym = opsym; - NextCh(); - if (ch == '=') { - opkind = OPlessequal; - NextCh(); - } else { - opkind = OPless; - } - break; - case '\"' : { - int start; - sym = constsym; - constkind = stringtype; - NextCh(); - start = chcount; - while ((ch != '\"') && (ch != 0x0)) - NextCh(); - GrabString(start); - TermChar('\"'); // check for eol before '\"' - break; - } - case 0x0: sym = eolsym; break; - default: - { - int start; - start = chcount; - DigRep(); - if ((start != chcount) || (ch == '.')) { // number - sym = constsym; - if (ch == '.') { - constkind = floattype; - NextCh(); - DigRep(); - } - else constkind = inttype; - if ((ch == 'e') || (ch == 'E')) { - int mark; - constkind = floattype; - NextCh(); - if ((ch == '+') || (ch == '-')) NextCh(); - mark = chcount; - DigRep(); - if (mark == chcount) { - ScanError("Number expected after 'E'"); - return; - } - } - GrabString(start); - } else if (((ch >= 'a') && (ch <= 'z')) - || ((ch >= 'A') && (ch <= 'Z'))) - { // reserved word? - - start = chcount; - CharRep(); - GrabString(start); - if (!strcasecmp(const_as_string, "SUM")) { - sym = sumsym; - } - else if (!strcasecmp(const_as_string, "NOT")) { - sym = opsym; - opkind = OPnot; - } - else if (!strcasecmp(const_as_string, "AND")) { - sym = opsym; opkind = OPand; - } - else if (!strcasecmp(const_as_string, "OR")) { - sym = opsym; opkind = OPor; - } - else if (!strcasecmp(const_as_string, "IF")) - sym = ifsym; - else if (!strcasecmp(const_as_string, "WHOMADE")) - sym = whocodedsym; - else if (!strcasecmp(const_as_string, "FALSE")) { - sym = constsym; constkind = booltype; boolvalue = false; - } else if (!strcasecmp(const_as_string, "TRUE")) { - sym = constsym; constkind = booltype; boolvalue = true; - } else { - sym = idsym; - //STR_String str; - //str.Format("'%s' makes no sense here", (const char*)funstr); - //ScanError(str); - } - } else { // unknown symbol - STR_String str; - str.Format("Unexpected character '%c'", ch); - NextCh(); - ScanError(str); - return; - } - } - } -} - -#if 0 -int CParser::MakeInt() { - // returns the integer representation of the value in the global - // variable const_as_string - // pre: const_as_string contains only numercal chars - return atoi(const_as_string); -} -#endif - -STR_String CParser::Symbol2Str(int s) { - // returns a string representation of of symbol s, - // for use in Term when generating an error - switch(s) { - case errorsym: return "error"; - case lbracksym: return "("; - case rbracksym: return ")"; - case commasym: return ","; - case opsym: return "operator"; - case constsym: return "constant"; - case sumsym: return "SUM"; - case ifsym: return "IF"; - case whocodedsym: return "WHOMADE"; - case eolsym: return "end of line"; - case idsym: return "identifier"; - default: return "unknown"; // should not happen - } -} - -void CParser::Term(int s) { - // generates an error if the next symbol isn't the specified symbol s - // otherwise, skip the symbol - if(s == sym) NextSym(); - else { - STR_String msg; - msg.Format("Warning: " + Symbol2Str(s) + " expected\ncontinuing without it"); - -// AfxMessageBox(msg,MB_ICONERROR); - - trace(msg); - } -} - -int CParser::Priority(int optorkind) { - // returns the priority of an operator - // higher number means higher priority - switch(optorkind) { - case OPor: return 1; - case OPand: return 2; - case OPgreater: - case OPless: - case OPgreaterequal: - case OPlessequal: - case OPequal: - case OPunequal: return 3; - case OPplus: - case OPminus: return 4; - case OPmodulus: - case OPtimes: - case OPdivide: return 5; - } - MT_assert(false); - return 0; // should not happen -} - -CExpression *CParser::Ex(int i) { - // parses an expression in the imput, starting at priority i, and - // returns an CExpression, containing the parsed input - CExpression *e1 = NULL, *e2 = NULL; - int opkind2; - - if (i < NUM_PRIORITY) { - e1 = Ex(i + 1); - while ((sym == opsym) && (Priority(opkind) == i)) { - opkind2 = opkind; - NextSym(); - e2 = Ex(i + 1); - switch(opkind2) { - case OPmodulus: e1 = new COperator2Expr(VALUE_MOD_OPERATOR,e1, e2); break; - case OPplus: e1 = new COperator2Expr(VALUE_ADD_OPERATOR,e1, e2); break; - case OPminus: e1 = new COperator2Expr(VALUE_SUB_OPERATOR,e1, e2); break; - case OPtimes: e1 = new COperator2Expr(VALUE_MUL_OPERATOR,e1, e2); break; - case OPdivide: e1 = new COperator2Expr(VALUE_DIV_OPERATOR,e1, e2); break; - case OPand: e1 = new COperator2Expr(VALUE_AND_OPERATOR,e1, e2); break; - case OPor: e1 = new COperator2Expr(VALUE_OR_OPERATOR,e1, e2); break; - case OPequal: e1 = new COperator2Expr(VALUE_EQL_OPERATOR,e1, e2); break; - case OPunequal: e1 = new COperator2Expr(VALUE_NEQ_OPERATOR,e1, e2); break; - case OPgreater: e1 = new COperator2Expr(VALUE_GRE_OPERATOR,e1, e2); break; - case OPless: e1 = new COperator2Expr(VALUE_LES_OPERATOR,e1, e2); break; - case OPgreaterequal: e1 = new COperator2Expr(VALUE_GEQ_OPERATOR,e1, e2); break; - case OPlessequal: e1 = new COperator2Expr(VALUE_LEQ_OPERATOR,e1, e2); break; - default: MT_assert(false); break; // should not happen - } - } - } else if (i == NUM_PRIORITY) { - if ((sym == opsym) - && ( (opkind == OPminus) || (opkind == OPnot) || (opkind == OPplus) ) - ) - { - NextSym(); - switch(opkind) { - /* +1 is also a valid number! */ - case OPplus: e1 = new COperator1Expr(VALUE_POS_OPERATOR, Ex(NUM_PRIORITY)); break; - case OPminus: e1 = new COperator1Expr(VALUE_NEG_OPERATOR, Ex(NUM_PRIORITY)); break; - case OPnot: e1 = new COperator1Expr(VALUE_NOT_OPERATOR, Ex(NUM_PRIORITY)); break; - default: { - // should not happen - e1 = Error("operator +, - or ! expected"); - } - } - } - else { - switch(sym) { - case constsym: { - switch(constkind) { - case booltype: - e1 = new CConstExpr(new CBoolValue(boolvalue)); - break; - case inttype: - { - cInt temp; - temp = strtoll(const_as_string, NULL, 10); /* atoi is for int only */ - e1 = new CConstExpr(new CIntValue(temp)); - break; - } - case floattype: - { - double temp; - temp = atof(const_as_string); - e1 = new CConstExpr(new CFloatValue(temp)); - break; - } - case stringtype: - e1 = new CConstExpr(new CStringValue(const_as_string,"")); - break; - default : - MT_assert(false); - break; - } - NextSym(); - break; - } - case lbracksym: - NextSym(); - e1 = Ex(1); - Term(rbracksym); - break; - case ifsym: - { - CExpression *e3; - NextSym(); - Term(lbracksym); - e1 = Ex(1); - Term(commasym); - e2 = Ex(1); - if (sym == commasym) { - NextSym(); - e3 = Ex(1); - } else { - e3 = new CConstExpr(new CEmptyValue()); - } - Term(rbracksym); - e1 = new CIfExpr(e1, e2, e3); - break; - } - case idsym: - { - e1 = new CIdentifierExpr(const_as_string,m_identifierContext); - NextSym(); - - break; - } - case errorsym: - { - MT_assert(!e1); - STR_String errtext="[no info]"; - if (errmsg) - { - CValue* errmsgval = errmsg->Calculate(); - errtext=errmsgval->GetText(); - errmsgval->Release(); - - //e1 = Error(errmsg->Calculate()->GetText());//new CConstExpr(errmsg->Calculate()); - - if ( !(errmsg->Release()) ) - { - errmsg=NULL; - } else { - // does this happen ? - MT_assert ("does this happen"); - } - } - e1 = Error(errtext); - - break; - } - default: - NextSym(); - //return Error("Expression expected"); - MT_assert(!e1); - e1 = Error("Expression expected"); - } - } - } - return e1; -} - -CExpression *CParser::Expr() { - // parses an expression in the imput, and - // returns an CExpression, containing the parsed input - return Ex(1); -} - -CExpression* CParser::ProcessText -(const char *intext) { - - // and parses the string in intext and returns it. - - - CExpression* expr; - text = intext; - - - chcount = 0; - if (text.Length() == 0) { - return NULL; - } - - ch = text[0]; - /*if (ch != '=') { - expr = new CConstExpr(new CStringValue(text)); - *dependant = deplist; - return expr; - } else - */ - // NextCh(); - NextSym(); - expr = Expr(); - if (sym != eolsym) { - CExpression* oldexpr = expr; - expr = new COperator2Expr(VALUE_ADD_OPERATOR, - oldexpr, Error(STR_String("Extra characters after expression")));//new CConstExpr(new CErrorValue("Extra characters after expression"))); - } - if (errmsg) - errmsg->Release(); - - return expr; -} - - - -float CParser::GetFloat(STR_String& txt) -{ - // returns parsed text into a float - // empty string returns -1 - -// AfxMessageBox("parsed string="+txt); - CValue* val=NULL; - float result=-1; -// String tmpstr; - - CExpression* expr = ProcessText(txt); - if (expr) { - val = expr->Calculate(); - result=(float)val->GetNumber(); - - - - val->Release(); - expr->Release(); - } -// tmpstr.Format("parseresult=%g",result); -// AfxMessageBox(tmpstr); - return result; -} - -CValue* CParser::GetValue(STR_String& txt, bool bFallbackToText) -{ - // returns parsed text into a value, - // empty string returns NULL value ! - // if bFallbackToText then unparsed stuff is put into text - - CValue* result=NULL; - CExpression* expr = ProcessText(txt); - if (expr) { - result = expr->Calculate(); - expr->Release(); - } - if (result) - { - // if the parsed stuff lead to an errorvalue, don't return errors, just NULL - if (result->IsError()) { - result->Release(); - result=NULL; - if (bFallbackToText) { - if (txt.Length()>0) - { - result = new CStringValue(txt,""); - } - } - } - } - return result; -} - -void CParser::SetContext(CValue* context) -{ - if (m_identifierContext) - { - m_identifierContext->Release(); - } - m_identifierContext = context; -} diff --git a/source/gameengine/Expressions/InputParser.h b/source/gameengine/Expressions/InputParser.h deleted file mode 100644 index 0d7eab27aeb..00000000000 --- a/source/gameengine/Expressions/InputParser.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Parser.h: interface for the CParser class. - * Eindhoven University of Technology 1997 - * OOPS team (Serge vd Boom, Erwin Coumans, Tom Geelen, Wynke Stuylemeier) - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ -#ifndef __INPUTPARSER_H__ -#define __INPUTPARSER_H__ - -class CParser; -#include "Expression.h" - - -class CParser -{ -public: - CParser(); - virtual ~CParser(); - - float GetFloat(STR_String& txt); - CValue* GetValue(STR_String& txt, bool bFallbackToText=false); - CExpression* ProcessText(const char *intext); - void SetContext(CValue* context); - -private: - enum symbols { - errorsym, - lbracksym, - rbracksym, - cellsym, - commasym, - opsym, - constsym, - sumsym, - ifsym, - whocodedsym, - eolsym, - idsym - }; // all kinds of symbols - - enum optype { - OPmodulus, - OPplus, - OPminus, - OPtimes, - OPdivide, - OPand, - OPor, - OPequal, - OPunequal, - OPgreater, - OPless, - OPgreaterequal, - OPlessequal, - OPnot - }; // all kinds of operators - - enum consttype { - booltype, - inttype, - floattype, - stringtype - }; // all kinds of constants - - int sym, // current symbol - opkind, // kind of operator, if symbol is an operator - constkind; // kind of operator, if symbol is a constant - - char ch; // current character - int chcount; // index to character in input string - CExpression *errmsg; // contains a errormessage, if scanner error - - STR_String text, // contains a copy of the original text - const_as_string; // string representation of the symbol, if symbol is a constant - bool boolvalue; // value of the boolean, if symbol is a constant of type boolean - CValue* m_identifierContext;// context in which identifiers are looked up - - - void ScanError(const char *str); - CExpression* Error(const char *str); - void NextCh(); - void TermChar(char c); - void DigRep(); - void CharRep(); - void GrabString(int start); - void NextSym(); -#if 0 /* not used yet */ - int MakeInt(); -#endif - STR_String Symbol2Str(int s); - void Term(int s); - int Priority(int optor); - CExpression *Ex(int i); - CExpression *Expr(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CParser"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp deleted file mode 100644 index 83e57200db0..00000000000 --- a/source/gameengine/Expressions/IntValue.cpp +++ /dev/null @@ -1,333 +0,0 @@ -// IntValue.cpp: implementation of the CIntValue class. -/* -* Copyright (c) 1996-2000 Erwin Coumans -* -* Permission to use, copy, modify, distribute and sell this software -* and its documentation for any purpose is hereby granted without fee, -* provided that the above copyright notice appear in all copies and -* that both that copyright notice and this permission notice appear -* in supporting documentation. Erwin Coumans makes no -* representations about the suitability of this software for any -* purpose. It is provided "as is" without express or implied warranty. -* -*/ - -#include "IntValue.h" -#include "ErrorValue.h" -#include "FloatValue.h" -#include "BoolValue.h" -#include "StringValue.h" -#include "VoidValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CIntValue::CIntValue() -/* -pre: false -effect: constructs a new CIntValue -*/ -{ - -#ifdef _DEBUG_ - m_textval = "Int illegal constructor"; -#endif - m_pstrRep=NULL; -} - - - -CIntValue::CIntValue(cInt innie) -/* -pre: -effect: constructs a new CIntValue containing cInt innie -*/ -{ - m_int = innie; - m_pstrRep=NULL; -} - - - -CIntValue::CIntValue(cInt innie,const char *name,AllocationTYPE alloctype) -{ - m_int = innie; - SetName(name); - - if (alloctype==CValue::STACKVALUE) - { - CValue::DisableRefCount(); - } - m_pstrRep=NULL; - -} - - - -CIntValue::~CIntValue() -/* -pre: -effect: deletes the object -*/ -{ - if (m_pstrRep) - delete m_pstrRep; -} - - - -CValue* CIntValue::Calc(VALUE_OPERATOR op, CValue *val) -/* -pre: -ret: a new object containing the result of applying operator op to this -object and val -*/ -{ - //return val->CalcInt(op, this); - switch (op) { - case VALUE_POS_OPERATOR: - return new CIntValue (m_int); - break; - case VALUE_NEG_OPERATOR: - return new CIntValue (-m_int); - break; - case VALUE_NOT_OPERATOR: - return new CErrorValue (op2str(op) + "only allowed on booleans"); - break; - case VALUE_AND_OPERATOR: - case VALUE_OR_OPERATOR: - return new CErrorValue(val->GetText() + op2str(op) + "only allowed on booleans"); - break; - default: - return val->CalcFinal(VALUE_INT_TYPE, op, this); - break; - } -} - - - -CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) -/* -pre: the type of val is dtype -ret: a new object containing the result of applying operator op to val and -this object -*/ -{ - CValue *ret; - - switch(dtype) { - case VALUE_EMPTY_TYPE: - case VALUE_INT_TYPE: - { - switch (op) { - case VALUE_MOD_OPERATOR: - ret = new CIntValue (((CIntValue *) val)->GetInt() % m_int); - break; - case VALUE_ADD_OPERATOR: - ret = new CIntValue (((CIntValue *) val)->GetInt() + m_int); - break; - case VALUE_SUB_OPERATOR: - ret = new CIntValue (((CIntValue *) val)->GetInt() - m_int); - break; - case VALUE_MUL_OPERATOR: - ret = new CIntValue (((CIntValue *) val)->GetInt() * m_int); - break; - case VALUE_DIV_OPERATOR: - if (m_int == 0) - { - if (val->GetNumber() == 0) - { - ret = new CErrorValue("Not a Number"); - } else - { - ret = new CErrorValue("Division by zero"); - } - } - else - ret = new CIntValue (((CIntValue *) val)->GetInt() / m_int); - break; - case VALUE_EQL_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() == m_int); - break; - case VALUE_NEQ_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() != m_int); - break; - case VALUE_GRE_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() > m_int); - break; - case VALUE_LES_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() < m_int); - break; - case VALUE_GEQ_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() >= m_int); - break; - case VALUE_LEQ_OPERATOR: - ret = new CBoolValue(((CIntValue *) val)->GetInt() <= m_int); - break; - case VALUE_NEG_OPERATOR: - ret = new CIntValue (-m_int); - break; - case VALUE_POS_OPERATOR: - ret = new CIntValue (m_int); - break; - default: - ret = new CErrorValue("illegal operator. please send a bug report."); - break; - } - break; - } - case VALUE_FLOAT_TYPE: - { - switch (op) { - case VALUE_MOD_OPERATOR: - ret = new CFloatValue(fmod(((CFloatValue *) val)->GetFloat(), m_int)); - break; - case VALUE_ADD_OPERATOR: - ret = new CFloatValue (((CFloatValue *) val)->GetFloat() + m_int); - break; - case VALUE_SUB_OPERATOR: - ret = new CFloatValue (((CFloatValue *) val)->GetFloat() - m_int); - break; - case VALUE_MUL_OPERATOR: - ret = new CFloatValue (((CFloatValue *) val)->GetFloat() * m_int); - break; - case VALUE_DIV_OPERATOR: - if (m_int == 0) - ret = new CErrorValue("Division by zero"); - else - ret = new CFloatValue (((CFloatValue *) val)->GetFloat() / m_int); - break; - case VALUE_EQL_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() == m_int); - break; - case VALUE_NEQ_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() != m_int); - break; - case VALUE_GRE_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() > m_int); - break; - case VALUE_LES_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() < m_int); - break; - case VALUE_GEQ_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() >= m_int); - break; - case VALUE_LEQ_OPERATOR: - ret = new CBoolValue(((CFloatValue *) val)->GetFloat() <= m_int); - break; - default: - ret = new CErrorValue("illegal operator. please send a bug report."); - break; - } - break; - } - case VALUE_STRING_TYPE: - { - switch(op) { - case VALUE_ADD_OPERATOR: - ret = new CStringValue(val->GetText() + GetText(),""); - break; - case VALUE_EQL_OPERATOR: - case VALUE_NEQ_OPERATOR: - case VALUE_GRE_OPERATOR: - case VALUE_LES_OPERATOR: - case VALUE_GEQ_OPERATOR: - case VALUE_LEQ_OPERATOR: - ret = new CErrorValue("[Cannot compare string with integer]" + op2str(op) + GetText()); - break; - default: - ret = new CErrorValue("[operator not allowed on strings]" + op2str(op) + GetText()); - break; - } - break; - } - case VALUE_BOOL_TYPE: - ret = new CErrorValue("[operator not valid on boolean and integer]" + op2str(op) + GetText()); - break; - /* - case VALUE_EMPTY_TYPE: - { - switch(op) { - - case VALUE_ADD_OPERATOR: - ret = new CIntValue (m_int); - break; - case VALUE_SUB_OPERATOR: - ret = new CIntValue (-m_int); - break; - default: - { - ret = new CErrorValue(op2str(op) + GetText()); - } - } - break; - } - */ - case VALUE_ERROR_TYPE: - ret = new CErrorValue(val->GetText() + op2str(op) + GetText()); - break; - default: - ret = new CErrorValue("illegal type. contact your dealer (if any)"); - break; - } - return ret; -} - - - -cInt CIntValue::GetInt() -/* -pre: -ret: the cInt stored in the object -*/ -{ - return m_int; -} - - - -double CIntValue::GetNumber() -{ - return (float) m_int; -} - - - -const STR_String & CIntValue::GetText() -{ - if (!m_pstrRep) - m_pstrRep=new STR_String(); - m_pstrRep->Format("%lld",m_int); - - return *m_pstrRep; -} - - - -CValue* CIntValue::GetReplica() { - CIntValue* replica = new CIntValue(*this); - replica->ProcessReplica(); - replica->m_pstrRep = NULL; - - return replica; -} - - - -void CIntValue::SetValue(CValue* newval) -{ - m_int = (cInt)newval->GetNumber(); - SetModified(true); -} - - -#ifndef DISABLE_PYTHON -PyObject* CIntValue::ConvertValueToPython() -{ - if((m_int > INT_MIN) && (m_int < INT_MAX)) - return PyLong_FromSsize_t(m_int); - else - return PyLong_FromLongLong(m_int); -} -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Expressions/IntValue.h b/source/gameengine/Expressions/IntValue.h deleted file mode 100644 index 26150674c93..00000000000 --- a/source/gameengine/Expressions/IntValue.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * IntValue.h: interface for the CIntValue class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ -#if !defined _INTVALUE_H -#define _INTVALUE_H - - -#include "Value.h" - -typedef long long cInt; - -class CIntValue : public CPropValue -{ - //PLUGIN_DECLARE_SERIAL (CIntValue,CValue) - -public: - virtual const STR_String& GetText(); - virtual double GetNumber(); - - cInt GetInt(); - CIntValue(); - CIntValue(cInt innie); - CIntValue(cInt innie, - const char *name, - AllocationTYPE alloctype=CValue::HEAPVALUE); - - virtual CValue* Calc(VALUE_OPERATOR op, - CValue *val); - - virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, - VALUE_OPERATOR op, - CValue *val); - - virtual void SetValue(CValue* newval); - - void Configure(CValue* menuvalue); - void AddConfigurationData(CValue* menuvalue); - virtual CValue* GetReplica(); - -#ifndef DISABLE_PYTHON - virtual PyObject* ConvertValueToPython(); -#endif - -protected: - virtual ~CIntValue(); - -private: - cInt m_int; - STR_String* m_pstrRep; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CIntValue"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined _INTVALUE_H - diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp deleted file mode 100644 index 1743e55c2bf..00000000000 --- a/source/gameengine/Expressions/KX_HashedPtr.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_HashedPtr.h" - -unsigned int KX_Hash(void * inDWord) -{ -#if defined(_WIN64) - unsigned __int64 key = (unsigned __int64)inDWord; -#else - unsigned long key = (unsigned long)inDWord; -#endif - - key += ~(key << 16); - key ^= (key >> 5); - key += (key << 3); - key ^= (key >> 13); - key += ~(key << 9); - key ^= (key >> 17); - - return (unsigned int)(key & 0xffffffff); -} - - -CHashedPtr::CHashedPtr(void* val) : m_valptr(val) -{ -} - - - -unsigned int CHashedPtr::hash() const -{ - return KX_Hash(m_valptr); -} diff --git a/source/gameengine/Expressions/KX_HashedPtr.h b/source/gameengine/Expressions/KX_HashedPtr.h deleted file mode 100644 index c4abf3b3279..00000000000 --- a/source/gameengine/Expressions/KX_HashedPtr.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_HASHEDPTR -#define __KX_HASHEDPTR - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -unsigned int KX_Hash(void * inDWord); - -class CHashedPtr -{ - void* m_valptr; - -public: - CHashedPtr(void* val); - - unsigned int hash() const; - - inline friend bool operator ==( const CHashedPtr & rhs,const CHashedPtr & lhs) - { - return rhs.m_valptr == lhs.m_valptr; - } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CHashedPtr"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_HASHEDPTR - diff --git a/source/gameengine/Expressions/KX_Python.h b/source/gameengine/Expressions/KX_Python.h deleted file mode 100644 index 7901d5226f7..00000000000 --- a/source/gameengine/Expressions/KX_Python.h +++ /dev/null @@ -1,70 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_PYTHON_H -#define KX_PYTHON_H - -//#define USE_DL_EXPORT - -/* python redefines, quiet the compiler */ -#ifdef _XOPEN_SOURCE -#undef _XOPEN_SOURCE -#endif - -#ifdef _POSIX_C_SOURCE -#undef _POSIX_C_SOURCE -#endif - -#ifndef DISABLE_PYTHON -#include "Python.h" - -#define USE_MATHUTILS // Blender 2.5x api will use mathutils, for a while we might want to test without it - -#endif - -#ifdef __FreeBSD__ -#include -#if __FreeBSD_version > 500039 -#undef isalnum -#undef isalpha -#undef iscntrl -#undef isdigit -#undef isgraph -#undef islower -#undef isprint -#undef ispunct -#undef isspace -#undef isupper -#undef isxdigit -#undef tolower -#undef toupper -#endif -#endif - -#endif // KX_PYTHON_H - diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp deleted file mode 100644 index 4d9d82efb98..00000000000 --- a/source/gameengine/Expressions/ListValue.cpp +++ /dev/null @@ -1,677 +0,0 @@ -// ListValue.cpp: implementation of the CListValue class. -// -////////////////////////////////////////////////////////////////////// -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include - -#include "ListValue.h" -#include "StringValue.h" -#include "VoidValue.h" -#include -#include "BoolValue.h" - -#include "BLO_sys_types.h" /* for intptr_t support */ - - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CListValue::CListValue() -: CPropValue() -{ - m_bReleaseContents=true; -} - - - -CListValue::~CListValue() -{ - - if (m_bReleaseContents) { - for (unsigned int i=0;iRelease(); - } - } -} - - -static STR_String gstrListRep=STR_String("List"); - -const STR_String & CListValue::GetText() -{ - gstrListRep = "["; - STR_String commastr = ""; - - for (int i=0;iGetText(); - commastr = ","; - } - gstrListRep += "]"; - - return gstrListRep; -} - - - -CValue* CListValue::GetReplica() { - CListValue* replica = new CListValue(*this); - - replica->ProcessReplica(); - - replica->m_bReleaseContents=true; // for copy, complete array is copied for now... - // copy all values - int numelements = m_pValueArray.size(); - unsigned int i=0; - replica->m_pValueArray.resize(numelements); - for (i=0;im_pValueArray[i] = m_pValueArray[i]->GetReplica(); - - - return replica; -}; - - - -void CListValue::SetValue(int i, CValue *val) -{ - assertd(i < m_pValueArray.size()); - m_pValueArray[i]=val; -} - - - -void CListValue::Resize(int num) -{ - m_pValueArray.resize(num); -} - - - -void CListValue::Remove(int i) -{ - assertd(iRelease(); - m_pValueArray.clear();//.Clear(); -} - - - -CValue* CListValue::FindValue(const STR_String & name) -{ - for (int i=0; i < GetCount(); i++) - if (GetValue(i)->GetName() == name) - return GetValue(i); - - return NULL; -} - -CValue* CListValue::FindValue(const char * name) -{ - for (int i=0; i < GetCount(); i++) - if (GetValue(i)->GetName() == name) - return GetValue(i); - - return NULL; -} - -bool CListValue::SearchValue(CValue *val) -{ - for (int i=0;i=0;i--) - if (val == GetValue(i)) - { - Remove(i); - result=true; - } - return result; -} - - - -void CListValue::MergeList(CListValue *otherlist) -{ - - int numelements = this->GetCount(); - int numotherelements = otherlist->GetCount(); - - - Resize(numelements+numotherelements); - - for (int i=0;iGetValue(i)->AddRef()); - } -} - -bool CListValue::CheckEqual(CValue* first,CValue* second) -{ - bool result = false; - - CValue* eqval = ((CValue*)first)->Calc(VALUE_EQL_OPERATOR,(CValue*)second); - - if (eqval==NULL) - return false; - const STR_String& text = eqval->GetText(); - if (&text==&CBoolValue::sTrueString) - { - result = true; - } - eqval->Release(); - return result; - -} - - -/* --------------------------------------------------------------------- - * Some stuff taken from the header - * --------------------------------------------------------------------- */ -CValue* CListValue::Calc(VALUE_OPERATOR op,CValue *val) -{ - //assert(false); // todo: implement me! - static int error_printed = 0; - if (error_printed==0) { - fprintf(stderr, "CValueList::Calc not yet implimented\n"); - error_printed = 1; - } - return NULL; -} - -CValue* CListValue::CalcFinal(VALUE_DATA_TYPE dtype, - VALUE_OPERATOR op, - CValue* val) -{ - //assert(false); // todo: implement me! - static int error_printed = 0; - if (error_printed==0) { - fprintf(stderr, "CValueList::CalcFinal not yet implimented\n"); - error_printed = 1; - } - return NULL; -} - - - -void CListValue::Add(CValue* value) -{ - m_pValueArray.push_back(value); -} - - - -double CListValue::GetNumber() -{ - return -1; -} - - - -void CListValue::SetModified(bool bModified) -{ - CValue::SetModified(bModified); - int numels = GetCount(); - - for (int i=0;iSetModified(bModified); -} - - - -bool CListValue::IsModified() -{ - bool bmod = CValue::IsModified(); //normal own flag - int numels = GetCount(); - - for (int i=0;iIsModified(); - - return bmod; -} - -#ifndef DISABLE_PYTHON - -/* --------------------------------------------------------------------- */ -/* Python interface ---------------------------------------------------- */ -/* --------------------------------------------------------------------- */ - -Py_ssize_t listvalue_bufferlen(PyObject* self) -{ - CListValue *list= static_cast(BGE_PROXY_REF(self)); - if (list==NULL) - return 0; - - return (Py_ssize_t)list->GetCount(); -} - -PyObject* listvalue_buffer_item(PyObject* self, Py_ssize_t index) -{ - CListValue *list= static_cast(BGE_PROXY_REF(self)); - CValue *cval; - - if (list==NULL) { - PyErr_SetString(PyExc_SystemError, "val = CList[i], "BGE_PROXY_ERROR_MSG); - return NULL; - } - - int count = list->GetCount(); - - if (index < 0) - index = count+index; - - if (index < 0 || index >= count) { - PyErr_SetString(PyExc_IndexError, "CList[i]: Python ListIndex out of range in CValueList"); - return NULL; - } - - cval= list->GetValue(index); - - PyObject* pyobj = cval->ConvertValueToPython(); - if (pyobj) - return pyobj; - else - return cval->GetProxy(); -} - -PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex) -{ - CListValue *list= static_cast(BGE_PROXY_REF(self)); - if (list==NULL) { - PyErr_SetString(PyExc_SystemError, "value = CList[i], "BGE_PROXY_ERROR_MSG); - return NULL; - } - - if (PyUnicode_Check(pyindex)) - { - CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(pyindex)); - if (item) { - PyObject* pyobj = item->ConvertValueToPython(); - if(pyobj) - return pyobj; - else - return item->GetProxy(); - } - } - else if (PyLong_Check(pyindex)) - { - int index = PyLong_AsSsize_t(pyindex); - return listvalue_buffer_item(self, index); /* wont add a ref */ - } - - PyObject *pyindex_str = PyObject_Repr(pyindex); /* new ref */ - PyErr_Format(PyExc_KeyError, "CList[key]: '%s' key not in list", _PyUnicode_AsString(pyindex_str)); - Py_DECREF(pyindex_str); - return NULL; -} - - -/* just slice it into a python list... */ -PyObject* listvalue_buffer_slice(PyObject* self,Py_ssize_t ilow, Py_ssize_t ihigh) -{ - CListValue *list= static_cast(BGE_PROXY_REF(self)); - if (list==NULL) { - PyErr_SetString(PyExc_SystemError, "val = CList[i:j], "BGE_PROXY_ERROR_MSG); - return NULL; - } - - int i, j; - PyObject *newlist; - - if (ilow < 0) ilow = 0; - - int n = ((CListValue*) list)->GetCount(); - - if (ihigh >= n) - ihigh = n; - if (ihigh < ilow) - ihigh = ilow; - - newlist = PyList_New(ihigh - ilow); - if (!newlist) - return NULL; - - for (i = ilow, j = 0; i < ihigh; i++, j++) - { - PyObject* pyobj = list->GetValue(i)->ConvertValueToPython(); - if (!pyobj) - pyobj = list->GetValue(i)->GetProxy(); - PyList_SET_ITEM(newlist, i, pyobj); - } - return newlist; -} - - -/* clist + list, return a list that python owns */ -static PyObject *listvalue_buffer_concat(PyObject * self, PyObject * other) -{ - CListValue *listval= static_cast(BGE_PROXY_REF(self)); - int i, numitems, numitems_orig; - - if (listval==NULL) { - PyErr_SetString(PyExc_SystemError, "CList+other, "BGE_PROXY_ERROR_MSG); - return NULL; - } - - numitems_orig= listval->GetCount(); - - // for now, we support CListValue concatenated with items - // and CListValue concatenated to Python Lists - // and CListValue concatenated with another CListValue - - /* Shallow copy, dont use listval->GetReplica(), it will screw up with KX_GameObjects */ - CListValue* listval_new = new CListValue(); - - if (PyList_Check(other)) - { - CValue* listitemval; - bool error = false; - - numitems = PyList_Size(other); - - /* copy the first part of the list */ - listval_new->Resize(numitems_orig + numitems); - for (i=0;iSetValue(i, listval->GetValue(i)->AddRef()); - - for (i=0;iConvertPythonToValue(PyList_GetItem(other,i), "cList + pyList: CListValue, "); - - if (listitemval) { - listval_new->SetValue(i+numitems_orig, listitemval); - } else { - error= true; - break; - } - } - - if (error) { - listval_new->Resize(numitems_orig+i); /* resize so we dont try release NULL pointers */ - listval_new->Release(); - return NULL; /* ConvertPythonToValue above sets the error */ - } - - } - else if (PyObject_TypeCheck(other, &CListValue::Type)) { - // add items from otherlist to this list - CListValue* otherval = static_cast(BGE_PROXY_REF(other)); - if(otherval==NULL) { - listval_new->Release(); - PyErr_SetString(PyExc_SystemError, "CList+other, "BGE_PROXY_ERROR_MSG); - return NULL; - } - - numitems = otherval->GetCount(); - - /* copy the first part of the list */ - listval_new->Resize(numitems_orig + numitems); /* resize so we dont try release NULL pointers */ - for (i=0;iSetValue(i, listval->GetValue(i)->AddRef()); - - /* now copy the other part of the list */ - for (i=0;iSetValue(i+numitems_orig, otherval->GetValue(i)->AddRef()); - - } - return listval_new->NewProxy(true); /* python owns this list */ -} - -static int listvalue_buffer_contains(PyObject *self_v, PyObject *value) -{ - CListValue *self= static_cast(BGE_PROXY_REF(self_v)); - - if (self==NULL) { - PyErr_SetString(PyExc_SystemError, "val in CList, "BGE_PROXY_ERROR_MSG); - return -1; - } - - if (PyUnicode_Check(value)) { - if (self->FindValue((const char *)_PyUnicode_AsString(value))) { - return 1; - } - } - else if (PyObject_TypeCheck(value, &CValue::Type)) { /* not dict like at all but this worked before __contains__ was used */ - CValue *item= static_cast(BGE_PROXY_REF(value)); - for (int i=0; i < self->GetCount(); i++) - if (self->GetValue(i) == item) // Com - return 1; - - } // not using CheckEqual - - return 0; -} - - -static PySequenceMethods listvalue_as_sequence = { - listvalue_bufferlen,//(inquiry)buffer_length, /*sq_length*/ - listvalue_buffer_concat, /*sq_concat*/ - NULL, /*sq_repeat*/ - listvalue_buffer_item, /*sq_item*/ -// TODO, slicing in py3 - NULL, // listvalue_buffer_slice, /*sq_slice*/ - NULL, /*sq_ass_item*/ - NULL, /*sq_ass_slice*/ - (objobjproc)listvalue_buffer_contains, /* sq_contains */ - (binaryfunc) NULL, /* sq_inplace_concat */ - (ssizeargfunc) NULL, /* sq_inplace_repeat */ -}; - - - -/* Is this one used ? */ -static PyMappingMethods instance_as_mapping = { - listvalue_bufferlen, /*mp_length*/ - listvalue_mapping_subscript, /*mp_subscript*/ - NULL /*mp_ass_subscript*/ -}; - - - -PyTypeObject CListValue::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "CListValue", /*tp_name*/ - sizeof(PyObjectPlus_Proxy), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - py_base_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - py_base_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - &listvalue_as_sequence, /*tp_as_sequence*/ - &instance_as_mapping, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call */ - 0, - NULL, - NULL, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &CValue::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef CListValue::Methods[] = { - /* List style access */ - {"append", (PyCFunction)CListValue::sPyappend,METH_O}, - {"reverse", (PyCFunction)CListValue::sPyreverse,METH_NOARGS}, - {"index", (PyCFunction)CListValue::sPyindex,METH_O}, - {"count", (PyCFunction)CListValue::sPycount,METH_O}, - - /* Dict style access */ - {"get", (PyCFunction)CListValue::sPyget,METH_VARARGS}, - - /* Own cvalue funcs */ - {"from_id", (PyCFunction)CListValue::sPyfrom_id,METH_O}, - - {NULL,NULL} //Sentinel -}; - -PyAttributeDef CListValue::Attributes[] = { - { NULL } //Sentinel -}; - -PyObject* CListValue::Pyappend(PyObject* value) -{ - CValue* objval = ConvertPythonToValue(value, "CList.append(i): CValueList, "); - - if (!objval) /* ConvertPythonToValue sets the error */ - return NULL; - - if (!BGE_PROXY_PYOWNS(m_proxy)) { - PyErr_SetString(PyExc_TypeError, "CList.append(i): this CValueList is used internally for the game engine and can't be modified"); - return NULL; - } - - Add(objval); - - Py_RETURN_NONE; -} - -PyObject* CListValue::Pyreverse() -{ - std::reverse(m_pValueArray.begin(),m_pValueArray.end()); - Py_RETURN_NONE; -} - -PyObject* CListValue::Pyindex(PyObject *value) -{ - PyObject* result = NULL; - - CValue* checkobj = ConvertPythonToValue(value, "val = cList[i]: CValueList, "); - if (checkobj==NULL) - return NULL; /* ConvertPythonToValue sets the error */ - - int numelem = GetCount(); - for (int i=0;iRelease(); - - if (result==NULL) { - PyErr_SetString(PyExc_ValueError, "CList.index(x): x not in CListValue"); - } - return result; - -} - - - -PyObject* CListValue::Pycount(PyObject* value) -{ - int numfound = 0; - - CValue* checkobj = ConvertPythonToValue(value, ""); /* error ignored */ - - if (checkobj==NULL) { /* in this case just return that there are no items in the list */ - PyErr_Clear(); - return PyLong_FromSsize_t(0); - } - - int numelem = GetCount(); - for (int i=0;iRelease(); - - return PyLong_FromSsize_t(numfound); -} - -/* Matches python dict.get(key, [default]) */ -PyObject* CListValue::Pyget(PyObject *args) -{ - char *key; - PyObject* def = Py_None; - - if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) - return NULL; - - CValue *item = FindValue((const char *)key); - if (item) { - PyObject* pyobj = item->ConvertValueToPython(); - if (pyobj) - return pyobj; - else - return item->GetProxy(); - } - Py_INCREF(def); - return def; -} - - -PyObject* CListValue::Pyfrom_id(PyObject* value) -{ - uintptr_t id= (uintptr_t)PyLong_AsVoidPtr(value); - - if (PyErr_Occurred()) - return NULL; - - int numelem = GetCount(); - for (int i=0;i(m_pValueArray[i]->m_proxy) == id) - return GetValue(i)->GetProxy(); - } - PyErr_SetString(PyExc_IndexError, "from_id(#): id not found in CValueList"); - return NULL; - -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Expressions/ListValue.h b/source/gameengine/Expressions/ListValue.h deleted file mode 100644 index 8f3b9dcda0b..00000000000 --- a/source/gameengine/Expressions/ListValue.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * ListValue.h: interface for the CListValue class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#if !defined _LISTVALUE_H -#define _LISTVALUE_H - -#include "Value.h" - -class CListValue : public CPropValue -{ - Py_Header; - //PLUGIN_DECLARE_SERIAL (CListValue,CValue) - -public: - CListValue(); - virtual ~CListValue(); - - void AddConfigurationData(CValue* menuvalue); - void Configure(CValue* menuvalue); - void Add(CValue* value); - - /** @attention not implemented yet :( */ - virtual CValue* Calc(VALUE_OPERATOR op,CValue *val); - virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, - VALUE_OPERATOR op, - CValue* val); - virtual double GetNumber(); - virtual CValue* GetReplica(); - -public: - void MergeList(CListValue* otherlist); - bool RemoveValue(CValue* val); - void SetReleaseOnDestruct(bool bReleaseContents); - bool SearchValue(CValue* val); - - CValue* FindValue(const STR_String & name); - CValue* FindValue(const char *name); - - void ReleaseAndRemoveAll(); - virtual void SetModified(bool bModified); - virtual inline bool IsModified(); - void Remove(int i); - void Resize(int num); - void SetValue(int i,CValue* val); - CValue* GetValue(int i){ assertd(i < m_pValueArray.size()); return m_pValueArray[i];} - int GetCount() { return m_pValueArray.size();}; - virtual const STR_String & GetText(); - - bool CheckEqual(CValue* first,CValue* second); - -#ifndef DISABLE_PYTHON - virtual PyObject* py_repr(void) { - PyObject *py_proxy= this->GetProxy(); - PyObject *py_list= PySequence_List(py_proxy); - PyObject *py_string= PyObject_Repr(py_list); - Py_DECREF(py_list); - Py_DECREF(py_proxy); - return py_string; - } - - KX_PYMETHOD_O(CListValue,append); - KX_PYMETHOD_NOARGS(CListValue,reverse); - KX_PYMETHOD_O(CListValue,index); - KX_PYMETHOD_O(CListValue,count); - KX_PYMETHOD_VARARGS(CListValue,get); - KX_PYMETHOD_O(CListValue,from_id); -#endif - -private: - - std::vector m_pValueArray; - bool m_bReleaseContents; -}; - -#endif // !defined _LISTVALUE_H - diff --git a/source/gameengine/Expressions/Makefile b/source/gameengine/Expressions/Makefile deleted file mode 100644 index 09512c3ae87..00000000000 --- a/source/gameengine/Expressions/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = expression -DIR = $(OCGDIR)/gameengine/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) -CPPFLAGS += -I../../blender/makesdna -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include - -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I../../kernel/gen_system -CPPFLAGS += -I../../gameengine/SceneGraph - diff --git a/source/gameengine/Expressions/Operator1Expr.cpp b/source/gameengine/Expressions/Operator1Expr.cpp deleted file mode 100644 index ca852020e5a..00000000000 --- a/source/gameengine/Expressions/Operator1Expr.cpp +++ /dev/null @@ -1,148 +0,0 @@ -// Operator1Expr.cpp: implementation of the COperator1Expr class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include "Operator1Expr.h" -#include "EmptyValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -COperator1Expr::COperator1Expr() -/* -pre: -effect: constucts an empty COperator1Expr -*/ -{ - m_lhs = NULL; -} - -COperator1Expr::COperator1Expr(VALUE_OPERATOR op, CExpression * lhs) -/* -pre: -effect: constucts a COperator1Expr with op and lhs in it -*/ -{ - m_lhs = lhs; - m_op = op; -} - -COperator1Expr::~COperator1Expr() -/* -pre: -effect: deletes the object -*/ -{ - if (m_lhs) m_lhs->Release(); -} - -CValue * COperator1Expr::Calculate() -/* -pre: -ret: a new object containing the result of applying the operator m_op to the - value of m_lhs -*/ -{ - CValue *ret; - CValue *temp = m_lhs->Calculate(); - CValue* empty = new CEmptyValue(); - ret = empty->Calc(m_op, temp); - empty->Release(); - temp->Release(); - - return ret; -} - -/* -bool COperator1Expr::IsInside(float x, float y, float z,bool bBorderInclude) -{ - - bool result = true; - switch (m_op) - { - - case VALUE_ADD_OPERATOR: - { - - if (m_lhs) - { - result = result || m_lhs->IsInside(x,y,z,bBorderInclude); - } - break; - } - case VALUE_SUB_OPERATOR: - { - result = true; - if (m_lhs) - { - result = result && (!m_lhs->IsInside(x,y,z,bBorderInclude)); - } - break; - } - } - return result; -} - -*/ -bool COperator1Expr::NeedsRecalculated() { - - return m_lhs->NeedsRecalculated(); - -} - -CExpression* COperator1Expr::CheckLink(std::vector& brokenlinks) { - - CExpression* newlhs = m_lhs->CheckLink(brokenlinks); - - if (newlhs) - { - if (newlhs==m_lhs) { - // not changed - } else { - // changed - //numchanges++; - newlhs->AddRef(); - - //m_lhs->Release(); - brokenlinks.push_back(new CBrokenLinkInfo(&m_lhs,m_lhs)); - - m_lhs = newlhs; - } - return this; - } else { - //numchanges++; - AddRef(); - - return Release(); - } - -} - -void COperator1Expr::BroadcastOperators(VALUE_OPERATOR op) -{ - if (m_lhs) - m_lhs->BroadcastOperators(m_op); -} - - - - -bool COperator1Expr::MergeExpression(CExpression *otherexpr) -{ - if (m_lhs) - return m_lhs->MergeExpression(otherexpr); - - assertd(false); // should not get here, expression is not compatible for merge - return false; -} diff --git a/source/gameengine/Expressions/Operator1Expr.h b/source/gameengine/Expressions/Operator1Expr.h deleted file mode 100644 index c2bc68076a0..00000000000 --- a/source/gameengine/Expressions/Operator1Expr.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Operator1Expr.h: interface for the COperator1Expr class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#if !defined(AFX_OPERATOR1EXPR_H__A1653901_BF41_11D1_A51C_00A02472FC58__INCLUDED_) -#define AFX_OPERATOR1EXPR_H__A1653901_BF41_11D1_A51C_00A02472FC58__INCLUDED_ - -#include "Expression.h" - -class COperator1Expr : public CExpression -{ - //PLUGIN_DECLARE_SERIAL_EXPRESSION (COperator1Expr,CExpression) - - - -public: - virtual bool MergeExpression(CExpression* otherexpr); - virtual void BroadcastOperators(VALUE_OPERATOR op); - - virtual unsigned char GetExpressionID() { return COPERATOR1EXPRESSIONID;}; - CExpression* CheckLink(std::vector& brokenlinks); - //virtual bool IsInside(float x,float y,float z,bool bBorderInclude = true); - virtual bool NeedsRecalculated(); - void ClearModified() { - if (m_lhs) - m_lhs->ClearModified(); - } - virtual CValue* Calculate(); - COperator1Expr(VALUE_OPERATOR op, CExpression *lhs); - COperator1Expr(); - virtual ~COperator1Expr(); - - - -private: - VALUE_OPERATOR m_op; - CExpression * m_lhs; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:COperator1Expr"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined(AFX_OPERATOR1EXPR_H__A1653901_BF41_11D1_A51C_00A02472FC58__INCLUDED_) - diff --git a/source/gameengine/Expressions/Operator2Expr.cpp b/source/gameengine/Expressions/Operator2Expr.cpp deleted file mode 100644 index 9428559c607..00000000000 --- a/source/gameengine/Expressions/Operator2Expr.cpp +++ /dev/null @@ -1,273 +0,0 @@ -// Operator2Expr.cpp: implementation of the COperator2Expr class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ -// 31 dec 1998 - big update: try to use the cached data for updating, instead of -// rebuilding completely it from left and right node. Modified flags and bounding boxes -// have to do the trick -// when expression is cached, there will be a call to UpdateCalc() instead of Calc() - -#include "Operator2Expr.h" -#include "StringValue.h" -#include "VoidValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -COperator2Expr::COperator2Expr(VALUE_OPERATOR op, CExpression *lhs, CExpression *rhs) -: -m_rhs(rhs), -m_lhs(lhs), -m_cached_calculate(NULL), -m_op(op) -/* -pre: -effect: constucts a COperator2Expr with op, lhs and rhs in it -*/ -{ - -} - -COperator2Expr::COperator2Expr(): -m_rhs(NULL), -m_lhs(NULL), -m_cached_calculate(NULL) - -/* -pre: -effect: constucts an empty COperator2Expr -*/ -{ - -} - -COperator2Expr::~COperator2Expr() -/* -pre: -effect: deletes the object -*/ -{ - if (m_lhs) - m_lhs->Release(); - if (m_rhs) - m_rhs->Release(); - if (m_cached_calculate) - m_cached_calculate->Release(); - -} -CValue* COperator2Expr::Calculate() -/* -pre: -ret: a new object containing the result of applying operator m_op to m_lhs -and m_rhs -*/ -{ - - bool leftmodified,rightmodified; - leftmodified = m_lhs->NeedsRecalculated(); - rightmodified = m_rhs->NeedsRecalculated(); - - // if no modifications on both left and right subtree, and result is already calculated - // then just return cached result... - if (!leftmodified && !rightmodified && (m_cached_calculate)) - { - // not modified, just return m_cached_calculate - } else { - // if not yet calculated, or modified... - - - if (m_cached_calculate) { - m_cached_calculate->Release(); - m_cached_calculate=NULL; - } - - CValue* ffleft = m_lhs->Calculate(); - CValue* ffright = m_rhs->Calculate(); - - ffleft->SetOwnerExpression(this);//->m_pOwnerExpression=this; - ffright->SetOwnerExpression(this);//->m_pOwnerExpression=this; - - m_cached_calculate = ffleft->Calc(m_op,ffright); - - //if (m_cached_calculate) - // m_cached_calculate->Action(CValue::SETOWNEREXPR,&CVoidValue(this,false,CValue::STACKVALUE)); - - ffleft->Release(); - ffright->Release(); - } - - return m_cached_calculate->AddRef(); - -} - -/* -bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude) -{ - bool inside; - inside = false; - - switch (m_op) - { - case VALUE_ADD_OPERATOR: { - // inside = first || second; // optimized with early out if first is inside - // todo: calculate smallest leaf first ! is much faster... - - bool second;//first ;//,second; - - //first = m_lhs->IsInside(x,y,z) ; - second = m_rhs->IsInside(x,y,z,bBorderInclude) ; - if (second) - return true; //early out - - // second = m_rhs->IsInside(x,y,z) ; - - return m_lhs->IsInside(x,y,z,bBorderInclude) ; - - break; - } - - case VALUE_SUB_OPERATOR: { - //inside = first && !second; // optimized with early out - // todo: same as with add_operator: calc smallest leaf first - - bool second;//first ;//,second; - //first = m_lhs->IsInside(x,y,z) ; - second = m_rhs->IsInside(x,y,z,bBorderInclude); - if (second) - return false; - - // second space get subtracted -> negate! - //second = m_rhs->IsInside(x,y,z); - - return (m_lhs->IsInside(x,y,z,bBorderInclude)); - - - break; - } - default:{ - assert(false); - // not yet implemented, only add or sub csg operations - } - } - - return inside; -} - - - -bool COperator2Expr::IsRightInside(float x, float y, float z,bool bBorderInclude) { - - return m_rhs->IsInside(x,y,z,bBorderInclude) ; - -} - -bool COperator2Expr::IsLeftInside(float x, float y, float z,bool bBorderInclude) { - return m_lhs->IsInside(x,y,z,bBorderInclude); -} -*/ -bool COperator2Expr::NeedsRecalculated() { - // added some lines, just for debugging purposes, it could be a one-liner :) - //bool modleft - //bool modright; - assertd(m_lhs); - assertd(m_rhs); - - //modright = m_rhs->NeedsRecalculated(); - if (m_rhs->NeedsRecalculated()) // early out - return true; - return m_lhs->NeedsRecalculated(); - //modleft = m_lhs->NeedsRecalculated(); - //return (modleft || modright); - -} - - - -CExpression* COperator2Expr::CheckLink(std::vector& brokenlinks) { -// if both children are 'dead', return NULL -// if only one child is alive, return that child -// if both childresn are alive, return this - - -// bool leftalive = true,rightalive=true; - /* Does this mean the function will always bomb? */ - assertd(false); - assert(m_lhs); - assert(m_rhs); -/* - if (m_cached_calculate) - m_cached_calculate->Action(CValue::REFRESH_CACHE); - - CExpression* newlhs = m_lhs->CheckLink(brokenlinks); - CExpression* newrhs = m_rhs->CheckLink(brokenlinks); - - if (m_lhs != newlhs) - { - brokenlinks.push_back(new CBrokenLinkInfo(&m_lhs,m_lhs)); - } - - if (m_rhs != newrhs) - { - brokenlinks.push_back(new CBrokenLinkInfo(&m_rhs,m_rhs)); - } - - - - m_lhs = newlhs; - m_rhs = newrhs; - - if (m_lhs && m_rhs) { - return this; - } - - AddRef(); - if (m_lhs) - return Release(m_lhs->AddRef()); - - if (m_rhs) - return Release(m_rhs->AddRef()); -/ - - */ - return Release(); - - - -} - - -bool COperator2Expr::MergeExpression(CExpression *otherexpr) -{ - if (m_lhs) - { - if (m_lhs->GetExpressionID() == CExpression::CCONSTEXPRESSIONID) - { - // cross fingers ;) replace constexpr by new tree... - m_lhs->Release(); - m_lhs = otherexpr->AddRef(); - return true; - } - } - - assertd(false); - return false; -} - - -void COperator2Expr::BroadcastOperators(VALUE_OPERATOR op) -{ - if (m_lhs) - m_lhs->BroadcastOperators(m_op); - if (m_rhs) - m_rhs->BroadcastOperators(m_op); -} diff --git a/source/gameengine/Expressions/Operator2Expr.h b/source/gameengine/Expressions/Operator2Expr.h deleted file mode 100644 index bb26b7c03be..00000000000 --- a/source/gameengine/Expressions/Operator2Expr.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Operator2Expr.h: interface for the COperator2Expr class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#if !defined _OPERATOR2EXPR_H -#define _OPERATOR2EXPR_H - - -#include "Expression.h" -#include "Value.h" // Added by ClassView - -class COperator2Expr : public CExpression -{ - //PLUGIN_DECLARE_SERIAL_EXPRESSION (COperator2Expr,CExpression) - -public: - virtual bool MergeExpression(CExpression* otherexpr); - virtual unsigned char GetExpressionID() { return COPERATOR2EXPRESSIONID;}; - virtual void BroadcastOperators(VALUE_OPERATOR op); - CExpression* CheckLink(std::vector& brokenlinks); - //virtual bool IsInside(float x,float y,float z,bool bBorderInclude=true); - //virtual bool IsLeftInside(float x,float y,float z,bool bBorderInclude); - //virtual bool IsRightInside(float x,float y,float z,bool bBorderInclude); - bool NeedsRecalculated(); - void ClearModified() { - if (m_lhs) - m_lhs->ClearModified(); - if (m_rhs) - m_rhs->ClearModified(); - } - virtual CValue* Calculate(); - COperator2Expr(VALUE_OPERATOR op, CExpression *lhs, CExpression *rhs); - COperator2Expr(); - virtual ~COperator2Expr(); - - -protected: - CExpression * m_rhs; - CExpression * m_lhs; - CValue* m_cached_calculate; // cached result - -private: - VALUE_OPERATOR m_op; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:COperator2Expr"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined _OPERATOR2EXPR_H - diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp deleted file mode 100644 index dbfa4a36ec6..00000000000 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ /dev/null @@ -1,1227 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/*------------------------------ - * PyObjectPlus cpp - * - * C++ library routines for Crawl 3.2 - * - * Derived from work by - * David Redish - * graduate student - * Computer Science Department - * Carnegie Mellon University (CMU) - * Center for the Neural Basis of Cognition (CNBC) - * http://www.python.org/doc/PyCPP.html - * -------------------------------*/ -#include -#include "stdlib.h" -#include "PyObjectPlus.h" -#include "STR_String.h" -#include "MT_Vector3.h" -#include "MEM_guardedalloc.h" - -PyObjectPlus::~PyObjectPlus() -{ -#ifndef DISABLE_PYTHON - if(m_proxy) { - BGE_PROXY_REF(m_proxy)= NULL; - Py_DECREF(m_proxy); /* Remove own reference, python may still have 1 */ - } -// assert(ob_refcnt==0); -#endif -} - -PyObjectPlus::PyObjectPlus() : SG_QList() // constructor -{ -#ifndef DISABLE_PYTHON - m_proxy= NULL; -#endif -}; - -void PyObjectPlus::ProcessReplica() -{ -#ifndef DISABLE_PYTHON - /* Clear the proxy, will be created again if needed with GetProxy() - * otherwise the PyObject will point to the wrong reference */ - m_proxy= NULL; -#endif -} - -/* Sometimes we might want to manually invalidate a BGE type even if - * it hasnt been released by the BGE, say for example when an object - * is removed from a scene, accessing it may cause problems. - * - * In this case the current proxy is made invalid, disowned, - * and will raise an error on access. However if python can get access - * to this class again it will make a new proxy and work as expected. - */ -void PyObjectPlus::InvalidateProxy() // check typename of each parent -{ -#ifndef DISABLE_PYTHON - if(m_proxy) { - BGE_PROXY_REF(m_proxy)=NULL; - Py_DECREF(m_proxy); - m_proxy= NULL; - } -#endif -} - - -#ifndef DISABLE_PYTHON - -/*------------------------------ - * PyObjectPlus Type -- Every class, even the abstract one should have a Type -------------------------------*/ - - -PyTypeObject PyObjectPlus::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "PyObjectPlus", /*tp_name*/ - sizeof(PyObjectPlus_Proxy), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - NULL // no subtype -}; - -PyObject *PyObjectPlus::py_base_repr(PyObject *self) // This should be the entry in Type. -{ - PyObjectPlus *self_plus= BGE_PROXY_REF(self); - if(self_plus==NULL) { - PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); - return NULL; - } - return self_plus->py_repr(); -} - - -PyObject * PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyTypeObject *base_type; - PyObjectPlus_Proxy *base = NULL; - - if (!PyArg_ParseTuple(args, "O:Base PyObjectPlus", &base)) - return NULL; - - /* the 'base' PyObject may be subclassed (multiple times even) - * we need to find the first C++ defined class to check 'type' - * is a subclass of the base arguments type. - * - * This way we can share one tp_new function for every PyObjectPlus - * - * eg. - * - * # CustomOb is called 'type' in this C code - * class CustomOb(GameTypes.KX_GameObject): - * pass - * - * # this calls py_base_new(...), the type of 'CustomOb' is checked to be a subclass of the 'cont.owner' type - * ob = CustomOb(cont.owner) - * - * */ - base_type= Py_TYPE(base); - while(base_type && !BGE_PROXY_CHECK_TYPE(base_type)) - base_type= base_type->tp_base; - - if(base_type==NULL || !BGE_PROXY_CHECK_TYPE(base_type)) { - PyErr_SetString(PyExc_TypeError, "can't subclass from a blender game type because the argument given is not a game class or subclass"); - return NULL; - } - - /* use base_type rather then Py_TYPE(base) because we could alredy be subtyped */ - if(!PyType_IsSubtype(type, base_type)) { - PyErr_Format(PyExc_TypeError, "can't subclass blender game type <%s> from <%s> because it is not a subclass", base_type->tp_name, type->tp_name); - return NULL; - } - - /* invalidate the existing base and return a new subclassed one, - * this is a bit dodgy in that it also attaches its self to the existing object - * which is not really 'correct' python OO but for our use its OK. */ - - PyObjectPlus_Proxy *ret = (PyObjectPlus_Proxy *) type->tp_alloc(type, 0); /* starts with 1 ref, used for the return ref' */ - ret->ref= base->ref; - ret->ptr= base->ptr; - ret->py_owns= base->py_owns; - ret->py_ref = base->py_ref; - - if (ret->py_ref) { - base->ref= NULL; /* invalidate! disallow further access */ - base->ptr = NULL; - if (ret->ref) - ret->ref->m_proxy= NULL; - /* 'base' may be free'd after this func finished but not necessarily - * there is no reference to the BGE data now so it will throw an error on access */ - Py_DECREF(base); - if (ret->ref) { - ret->ref->m_proxy= (PyObject *)ret; /* no need to add a ref because one is added when creating. */ - Py_INCREF(ret); /* we return a new ref but m_proxy holds a ref so we need to add one */ - } - } else { - // generic structures don't hold a reference to this proxy, so don't increment ref count - if (ret->py_owns) - // but if the proxy owns the structure, there can be only one owner - base->ptr= NULL; - } - - return (PyObject *)ret; -} - -void PyObjectPlus::py_base_dealloc(PyObject *self) // python wrapper -{ - if (BGE_PROXY_PYREF(self)) { - PyObjectPlus *self_plus= BGE_PROXY_REF(self); - if(self_plus) { - if(BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it */ - self_plus->m_proxy = NULL; /* Need this to stop ~PyObjectPlus from decrefing m_proxy otherwise its decref'd twice and py-debug crashes */ - delete self_plus; - } - BGE_PROXY_REF(self)= NULL; // not really needed - } - // the generic pointer is not deleted directly, only through self_plus - BGE_PROXY_PTR(self)= NULL; // not really needed - } else { - void *ptr= BGE_PROXY_PTR(self); - if(ptr) { - if(BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it */ - // generic structure owned by python MUST be created though MEM_alloc - MEM_freeN(ptr); - } - BGE_PROXY_PTR(self)= NULL; // not really needed - } - } -#if 0 - /* is ok normally but not for subtyping, use tp_free instead. */ - PyObject_DEL( self ); -#else - Py_TYPE(self)->tp_free(self); -#endif -}; - -/*------------------------------ - * PyObjectPlus Methods -- Every class, even the abstract one should have a Methods -------------------------------*/ -PyMethodDef PyObjectPlus::Methods[] = { - {NULL, NULL} /* Sentinel */ -}; - -#define attr_invalid (&(PyObjectPlus::Attributes[0])) -PyAttributeDef PyObjectPlus::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("invalid", PyObjectPlus, pyattr_get_invalid), - {NULL} //Sentinel -}; - - - -PyObject* PyObjectPlus::pyattr_get_invalid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - return PyBool_FromLong(self_v ? 0:1); -} - -/* note, this is called as a python 'getset, where the PyAttributeDef is the closure */ -PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *attrdef) -{ - PyObjectPlus *ref= (BGE_PROXY_REF(self_py)); - char* ptr = (attrdef->m_usePtr) ? (char*)BGE_PROXY_PTR(self_py) : (char*)ref; - if(ptr == NULL || (BGE_PROXY_PYREF(self_py) && (ref==NULL || !ref->py_is_valid()))) { - if(attrdef == attr_invalid) - Py_RETURN_TRUE; // dont bother running the function - - PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); - return NULL; - } - - if (attrdef->m_type == KX_PYATTRIBUTE_TYPE_DUMMY) - { - // fake attribute, ignore - return NULL; - } - if (attrdef->m_type == KX_PYATTRIBUTE_TYPE_FUNCTION) - { - // the attribute has no field correspondance, handover processing to function. - if (attrdef->m_getFunction == NULL) - return NULL; - return (*attrdef->m_getFunction)(ref, attrdef); - } - ptr += attrdef->m_offset; - if (attrdef->m_length > 1) - { - PyObject* resultlist = PyList_New(attrdef->m_length); - for (unsigned int i=0; im_length; i++) - { - switch (attrdef->m_type) { - case KX_PYATTRIBUTE_TYPE_BOOL: - { - bool *val = reinterpret_cast(ptr); - ptr += sizeof(bool); - PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val)); - break; - } - case KX_PYATTRIBUTE_TYPE_SHORT: - { - short int *val = reinterpret_cast(ptr); - ptr += sizeof(short int); - PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val)); - break; - } - case KX_PYATTRIBUTE_TYPE_ENUM: - // enum are like int, just make sure the field size is the same - if (sizeof(int) != attrdef->m_size) - { - Py_DECREF(resultlist); - return NULL; - } - // walkthrough - case KX_PYATTRIBUTE_TYPE_INT: - { - int *val = reinterpret_cast(ptr); - ptr += sizeof(int); - PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val)); - break; - } - case KX_PYATTRIBUTE_TYPE_FLOAT: - { - float *val = reinterpret_cast(ptr); - ptr += sizeof(float); - PyList_SET_ITEM(resultlist,i,PyFloat_FromDouble(*val)); - break; - } - default: - // no support for array of complex data - Py_DECREF(resultlist); - return NULL; - } - } - return resultlist; - } - else - { - switch (attrdef->m_type) { - case KX_PYATTRIBUTE_TYPE_FLAG: - { - bool bval; - switch (attrdef->m_size) { - case 1: - { - unsigned char *val = reinterpret_cast(ptr); - bval = (*val & attrdef->m_imin); - break; - } - case 2: - { - unsigned short *val = reinterpret_cast(ptr); - bval = (*val & attrdef->m_imin); - break; - } - case 4: - { - unsigned int *val = reinterpret_cast(ptr); - bval = (*val & attrdef->m_imin); - break; - } - default: - return NULL; - } - if (attrdef->m_imax) - bval = !bval; - return PyLong_FromSsize_t(bval); - } - case KX_PYATTRIBUTE_TYPE_BOOL: - { - bool *val = reinterpret_cast(ptr); - return PyLong_FromSsize_t(*val); - } - case KX_PYATTRIBUTE_TYPE_SHORT: - { - short int *val = reinterpret_cast(ptr); - return PyLong_FromSsize_t(*val); - } - case KX_PYATTRIBUTE_TYPE_ENUM: - // enum are like int, just make sure the field size is the same - if (sizeof(int) != attrdef->m_size) - { - return NULL; - } - // walkthrough - case KX_PYATTRIBUTE_TYPE_INT: - { - int *val = reinterpret_cast(ptr); - return PyLong_FromSsize_t(*val); - } - case KX_PYATTRIBUTE_TYPE_FLOAT: - { - float *val = reinterpret_cast(ptr); - if (attrdef->m_imin == 0) { - if (attrdef->m_imax == 0) { - return PyFloat_FromDouble(*val); - } else { - // vector, verify size - if (attrdef->m_size != attrdef->m_imax*sizeof(float)) - { - return NULL; - } -#ifdef USE_MATHUTILS - return newVectorObject(val, attrdef->m_imax, Py_NEW, NULL); -#else - PyObject* resultlist = PyList_New(attrdef->m_imax); - for (unsigned int i=0; im_imax; i++) - { - PyList_SET_ITEM(resultlist,i,PyFloat_FromDouble(val[i])); - } - return resultlist; -#endif - } - } else { - // matrix case - if (attrdef->m_size != attrdef->m_imax*attrdef->m_imin*sizeof(float)) - { - return NULL; - } -#ifdef USE_MATHUTILS - return newMatrixObject(val, attrdef->m_imin, attrdef->m_imax, Py_WRAP, NULL); -#else - PyObject* collist = PyList_New(attrdef->m_imin); - for (unsigned int i=0; im_imin; i++) - { - PyObject* col = PyList_New(attrdef->m_imax); - for (unsigned int j=0; jm_imax; j++) - { - PyList_SET_ITEM(col,j,PyFloat_FromDouble(val[j])); - } - PyList_SET_ITEM(collist,i,col); - val += attrdef->m_imax; - } - return collist; -#endif - } - } - case KX_PYATTRIBUTE_TYPE_VECTOR: - { - MT_Vector3 *val = reinterpret_cast(ptr); -#ifdef USE_MATHUTILS - float fval[3]= {(*val)[0], (*val)[1], (*val)[2]}; - return newVectorObject(fval, 3, Py_NEW, NULL); -#else - PyObject* resultlist = PyList_New(3); - for (unsigned int i=0; i<3; i++) - { - PyList_SET_ITEM(resultlist,i,PyFloat_FromDouble((*val)[i])); - } - return resultlist; -#endif - } - case KX_PYATTRIBUTE_TYPE_STRING: - { - STR_String *val = reinterpret_cast(ptr); - return PyUnicode_FromString(*val); - } - case KX_PYATTRIBUTE_TYPE_CHAR: - { - return PyUnicode_FromString(ptr); - } - default: - return NULL; - } - } -} - - -static bool py_check_attr_float(float *var, PyObject *value, const PyAttributeDef *attrdef) -{ - double val = PyFloat_AsDouble(value); - if (val == -1.0 && PyErr_Occurred()) - { - PyErr_Format(PyExc_TypeError, "expected float value for attribute \"%s\"", attrdef->m_name); - return false; - } - if (attrdef->m_clamp) - { - if (val < attrdef->m_fmin) - val = attrdef->m_fmin; - else if (val > attrdef->m_fmax) - val = attrdef->m_fmax; - } - else if (val < attrdef->m_fmin || val > attrdef->m_fmax) - { - PyErr_Format(PyExc_ValueError, "value out of range for attribute \"%s\"", attrdef->m_name); - return false; - } - *var = (float)val; - return true; -} - -/* note, this is called as a python getset */ -int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAttributeDef *attrdef) -{ - PyObjectPlus *ref= (BGE_PROXY_REF(self_py)); - char* ptr = (attrdef->m_usePtr) ? (char*)BGE_PROXY_PTR(self_py) : (char*)ref; - if(ref==NULL || !ref->py_is_valid() || ptr==NULL) { - PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); - return PY_SET_ATTR_FAIL; - } - - void *undoBuffer = NULL; - void *sourceBuffer = NULL; - size_t bufferSize = 0; - PyObject *item = NULL; // to store object that must be dereferenced in case of error - PyObject *list = NULL; // to store object that must be dereferenced in case of error - - ptr += attrdef->m_offset; - if (attrdef->m_length > 1) - { - if (!PySequence_Check(value)) - { - PyErr_Format(PyExc_TypeError, "expected a sequence for attribute \"%s\"", attrdef->m_name); - return PY_SET_ATTR_FAIL; - } - if (PySequence_Size(value) != attrdef->m_length) - { - PyErr_Format(PyExc_TypeError, "incorrect number of elements in sequence for attribute \"%s\"", attrdef->m_name); - return PY_SET_ATTR_FAIL; - } - switch (attrdef->m_type) - { - case KX_PYATTRIBUTE_TYPE_FUNCTION: - if (attrdef->m_setFunction == NULL) - { - PyErr_Format(PyExc_AttributeError, "function attribute without function for attribute \"%s\", report to blender.org", attrdef->m_name); - return PY_SET_ATTR_FAIL; - } - return (*attrdef->m_setFunction)(ref, attrdef, value); - case KX_PYATTRIBUTE_TYPE_BOOL: - bufferSize = sizeof(bool); - break; - case KX_PYATTRIBUTE_TYPE_SHORT: - bufferSize = sizeof(short int); - break; - case KX_PYATTRIBUTE_TYPE_ENUM: - case KX_PYATTRIBUTE_TYPE_INT: - bufferSize = sizeof(int); - break; - case KX_PYATTRIBUTE_TYPE_FLOAT: - bufferSize = sizeof(float); - break; - default: - // should not happen - PyErr_Format(PyExc_AttributeError, "Unsupported attribute type for attribute \"%s\", report to blender.org", attrdef->m_name); - return PY_SET_ATTR_FAIL; - } - // let's implement a smart undo method - bufferSize *= attrdef->m_length; - undoBuffer = malloc(bufferSize); - sourceBuffer = ptr; - if (undoBuffer) - { - memcpy(undoBuffer, sourceBuffer, bufferSize); - } - for (int i=0; im_length; i++) - { - item = PySequence_GetItem(value, i); /* new ref */ - switch (attrdef->m_type) - { - case KX_PYATTRIBUTE_TYPE_BOOL: - { - bool *var = reinterpret_cast(ptr); - ptr += sizeof(bool); - if (PyLong_Check(item)) - { - *var = (PyLong_AsSsize_t(item) != 0); - } - else if (PyBool_Check(item)) - { - *var = (item == Py_True); - } - else - { - PyErr_Format(PyExc_TypeError, "expected an integer or a bool for attribute \"%s\"", attrdef->m_name); - goto UNDO_AND_ERROR; - } - break; - } - case KX_PYATTRIBUTE_TYPE_SHORT: - { - short int *var = reinterpret_cast(ptr); - ptr += sizeof(short int); - if (PyLong_Check(item)) - { - long val = PyLong_AsSsize_t(item); - if (attrdef->m_clamp) - { - if (val < attrdef->m_imin) - val = attrdef->m_imin; - else if (val > attrdef->m_imax) - val = attrdef->m_imax; - } - else if (val < attrdef->m_imin || val > attrdef->m_imax) - { - PyErr_Format(PyExc_ValueError, "item value out of range for attribute \"%s\"", attrdef->m_name); - goto UNDO_AND_ERROR; - } - *var = (short int)val; - } - else - { - PyErr_Format(PyExc_TypeError, "expected an integer for attribute \"%s\"", attrdef->m_name); - goto UNDO_AND_ERROR; - } - break; - } - case KX_PYATTRIBUTE_TYPE_ENUM: - // enum are equivalent to int, just make sure that the field size matches: - if (sizeof(int) != attrdef->m_size) - { - PyErr_Format(PyExc_AttributeError, "Size check error for attribute, \"%s\", report to blender.org", attrdef->m_name); - goto UNDO_AND_ERROR; - } - // walkthrough - case KX_PYATTRIBUTE_TYPE_INT: - { - int *var = reinterpret_cast(ptr); - ptr += sizeof(int); - if (PyLong_Check(item)) - { - long val = PyLong_AsSsize_t(item); - if (attrdef->m_clamp) - { - if (val < attrdef->m_imin) - val = attrdef->m_imin; - else if (val > attrdef->m_imax) - val = attrdef->m_imax; - } - else if (val < attrdef->m_imin || val > attrdef->m_imax) - { - PyErr_Format(PyExc_ValueError, "item value out of range for attribute \"%s\"", attrdef->m_name); - goto UNDO_AND_ERROR; - } - *var = (int)val; - } - else - { - PyErr_Format(PyExc_TypeError, "expected an integer for attribute \"%s\"", attrdef->m_name); - goto UNDO_AND_ERROR; - } - break; - } - case KX_PYATTRIBUTE_TYPE_FLOAT: - { - float *var = reinterpret_cast(ptr); - ptr += sizeof(float); - double val = PyFloat_AsDouble(item); - if (val == -1.0 && PyErr_Occurred()) - { - PyErr_Format(PyExc_TypeError, "expected a float for attribute \"%s\"", attrdef->m_name); - goto UNDO_AND_ERROR; - } - else if (attrdef->m_clamp) - { - if (val < attrdef->m_fmin) - val = attrdef->m_fmin; - else if (val > attrdef->m_fmax) - val = attrdef->m_fmax; - } - else if (val < attrdef->m_fmin || val > attrdef->m_fmax) - { - PyErr_Format(PyExc_ValueError, "item value out of range for attribute \"%s\"", attrdef->m_name); - goto UNDO_AND_ERROR; - } - *var = (float)val; - break; - } - default: - // should not happen - PyErr_Format(PyExc_AttributeError, "type check error for attribute \"%s\", report to blender.org", attrdef->m_name); - goto UNDO_AND_ERROR; - } - // finished using item, release - Py_DECREF(item); - item = NULL; - } - // no error, call check function if any - if (attrdef->m_checkFunction != NULL) - { - if ((*attrdef->m_checkFunction)(ref, attrdef) != 0) - { - // if the checing function didnt set an error then set a generic one here so we dont set an error with no exception - if (PyErr_Occurred()==0) - PyErr_Format(PyExc_AttributeError, "type check error for attribute \"%s\", reasion unknown", attrdef->m_name); - - // post check returned an error, restore values - UNDO_AND_ERROR: - if (undoBuffer) - { - memcpy(sourceBuffer, undoBuffer, bufferSize); - free(undoBuffer); - } - if (item) - Py_DECREF(item); - return PY_SET_ATTR_FAIL; - } - } - if (undoBuffer) - free(undoBuffer); - return PY_SET_ATTR_SUCCESS; - } - else // simple attribute value - { - if (attrdef->m_type == KX_PYATTRIBUTE_TYPE_FUNCTION) - { - if (attrdef->m_setFunction == NULL) - { - PyErr_Format(PyExc_AttributeError, "function attribute without function \"%s\", report to blender.org", attrdef->m_name); - return PY_SET_ATTR_FAIL; - } - return (*attrdef->m_setFunction)(ref, attrdef, value); - } - if (attrdef->m_checkFunction != NULL || attrdef->m_type == KX_PYATTRIBUTE_TYPE_VECTOR) - { - // post check function is provided, prepare undo buffer - sourceBuffer = ptr; - switch (attrdef->m_type) - { - case KX_PYATTRIBUTE_TYPE_BOOL: - bufferSize = sizeof(bool); - break; - case KX_PYATTRIBUTE_TYPE_SHORT: - bufferSize = sizeof(short); - break; - case KX_PYATTRIBUTE_TYPE_ENUM: - case KX_PYATTRIBUTE_TYPE_FLAG: - case KX_PYATTRIBUTE_TYPE_CHAR: - bufferSize = attrdef->m_size; - break; - case KX_PYATTRIBUTE_TYPE_INT: - bufferSize = sizeof(int); - break; - case KX_PYATTRIBUTE_TYPE_FLOAT: - bufferSize = sizeof(float); - if (attrdef->m_imax) - bufferSize *= attrdef->m_imax; - if (attrdef->m_imin) - bufferSize *= attrdef->m_imin; - break; - case KX_PYATTRIBUTE_TYPE_STRING: - sourceBuffer = reinterpret_cast(ptr)->Ptr(); - if (sourceBuffer) - bufferSize = strlen(reinterpret_cast(sourceBuffer))+1; - break; - case KX_PYATTRIBUTE_TYPE_VECTOR: - bufferSize = sizeof(MT_Vector3); - break; - default: - PyErr_Format(PyExc_AttributeError, "unknown type for attribute \"%s\", report to blender.org", attrdef->m_name); - return PY_SET_ATTR_FAIL; - } - if (bufferSize) - { - undoBuffer = malloc(bufferSize); - if (undoBuffer) - { - memcpy(undoBuffer, sourceBuffer, bufferSize); - } - } - } - - switch (attrdef->m_type) - { - case KX_PYATTRIBUTE_TYPE_BOOL: - { - bool *var = reinterpret_cast(ptr); - if (PyLong_Check(value)) - { - *var = (PyLong_AsSsize_t(value) != 0); - } - else if (PyBool_Check(value)) - { - *var = (value == Py_True); - } - else - { - PyErr_Format(PyExc_TypeError, "expected an integer or a bool for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - break; - } - case KX_PYATTRIBUTE_TYPE_FLAG: - { - bool bval; - if (PyLong_Check(value)) - { - bval = (PyLong_AsSsize_t(value) != 0); - } - else if (PyBool_Check(value)) - { - bval = (value == Py_True); - } - else - { - PyErr_Format(PyExc_TypeError, "expected an integer or a bool for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - if (attrdef->m_imax) - bval = !bval; - switch (attrdef->m_size) { - case 1: - { - unsigned char *val = reinterpret_cast(ptr); - *val = (*val & ~attrdef->m_imin) | ((bval)?attrdef->m_imin:0); - break; - } - case 2: - { - unsigned short *val = reinterpret_cast(ptr); - *val = (*val & ~attrdef->m_imin) | ((bval)?attrdef->m_imin:0); - break; - } - case 4: - { - unsigned int *val = reinterpret_cast(ptr); - *val = (*val & ~attrdef->m_imin) | ((bval)?attrdef->m_imin:0); - break; - } - default: - PyErr_Format(PyExc_TypeError, "internal error: unsupported flag field \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - break; - } - case KX_PYATTRIBUTE_TYPE_SHORT: - { - short int *var = reinterpret_cast(ptr); - if (PyLong_Check(value)) - { - long val = PyLong_AsSsize_t(value); - if (attrdef->m_clamp) - { - if (val < attrdef->m_imin) - val = attrdef->m_imin; - else if (val > attrdef->m_imax) - val = attrdef->m_imax; - } - else if (val < attrdef->m_imin || val > attrdef->m_imax) - { - PyErr_Format(PyExc_ValueError, "value out of range for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - *var = (short int)val; - } - else - { - PyErr_Format(PyExc_TypeError, "expected an integer for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - break; - } - case KX_PYATTRIBUTE_TYPE_ENUM: - // enum are equivalent to int, just make sure that the field size matches: - if (sizeof(int) != attrdef->m_size) - { - PyErr_Format(PyExc_AttributeError, "attribute size check error for attribute \"%s\", report to blender.org", attrdef->m_name); - goto FREE_AND_ERROR; - } - // walkthrough - case KX_PYATTRIBUTE_TYPE_INT: - { - int *var = reinterpret_cast(ptr); - if (PyLong_Check(value)) - { - long val = PyLong_AsSsize_t(value); - if (attrdef->m_clamp) - { - if (val < attrdef->m_imin) - val = attrdef->m_imin; - else if (val > attrdef->m_imax) - val = attrdef->m_imax; - } - else if (val < attrdef->m_imin || val > attrdef->m_imax) - { - PyErr_Format(PyExc_ValueError, "value out of range for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - *var = (int)val; - } - else - { - PyErr_Format(PyExc_TypeError, "expected an integer for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - break; - } - case KX_PYATTRIBUTE_TYPE_FLOAT: - { - float *var = reinterpret_cast(ptr); - if (attrdef->m_imin != 0) - { - if (attrdef->m_size != attrdef->m_imin*attrdef->m_imax*sizeof(float)) - { - PyErr_Format(PyExc_TypeError, "internal error: incorrect field size for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imin) - { - PyErr_Format(PyExc_TypeError, "expected a sequence of [%d][%d] floats for attribute \"%s\"", attrdef->m_imin, attrdef->m_imax, attrdef->m_name); - goto FREE_AND_ERROR; - } - for (int i=0; im_imin; i++) - { - PyObject *list = PySequence_GetItem(value, i); /* new ref */ - if (!PySequence_Check(list) || PySequence_Size(list) != attrdef->m_imax) - { - PyErr_Format(PyExc_TypeError, "expected a sequence of [%d][%d] floats for attribute \"%s\"", attrdef->m_imin, attrdef->m_imax, attrdef->m_name); - goto RESTORE_AND_ERROR; - } - for (int j=0; jm_imax; j++) - { - item = PySequence_GetItem(list, j); /* new ref */ - if (!py_check_attr_float(var, item, attrdef)) - { - PyErr_Format(PyExc_TypeError, "expected a sequence of [%d][%d] floats for attribute \"%s\"", attrdef->m_imin, attrdef->m_imax, attrdef->m_name); - goto RESTORE_AND_ERROR; - } - Py_DECREF(item); - item = NULL; - ++var; - } - Py_DECREF(list); - list = NULL; - } - } - else if (attrdef->m_imax != 0) - { - if (attrdef->m_size != attrdef->m_imax*sizeof(float)) - { - PyErr_Format(PyExc_TypeError, "internal error: incorrect field size for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imax) - { - PyErr_Format(PyExc_TypeError, "expected a sequence of [%d] floats for attribute \"%s\"", attrdef->m_imax, attrdef->m_name); - goto FREE_AND_ERROR; - } - for (int i=0; im_imax; i++) - { - item = PySequence_GetItem(value, i); /* new ref */ - if (!py_check_attr_float(var, item, attrdef)) - { - goto RESTORE_AND_ERROR; - } - Py_DECREF(item); - item = NULL; - ++var; - } - } - else - { - if (!py_check_attr_float(var, value, attrdef)) - goto FREE_AND_ERROR; - } - break; - } - case KX_PYATTRIBUTE_TYPE_VECTOR: - { - if (!PySequence_Check(value) || PySequence_Size(value) != 3) - { - PyErr_Format(PyExc_TypeError, "expected a sequence of 3 floats for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - MT_Vector3 *var = reinterpret_cast(ptr); - for (int i=0; i<3; i++) - { - item = PySequence_GetItem(value, i); /* new ref */ - double val = PyFloat_AsDouble(item); - Py_DECREF(item); - item = NULL; - if (val == -1.0 && PyErr_Occurred()) - { - PyErr_Format(PyExc_TypeError, "expected a sequence of 3 floats for attribute \"%s\"", attrdef->m_name); - goto RESTORE_AND_ERROR; - } - else if (attrdef->m_clamp) - { - if (val < attrdef->m_fmin) - val = attrdef->m_fmin; - else if (val > attrdef->m_fmax) - val = attrdef->m_fmax; - } - else if (val < attrdef->m_fmin || val > attrdef->m_fmax) - { - PyErr_Format(PyExc_ValueError, "value out of range for attribute \"%s\"", attrdef->m_name); - goto RESTORE_AND_ERROR; - } - (*var)[i] = (MT_Scalar)val; - } - break; - } - case KX_PYATTRIBUTE_TYPE_CHAR: - { - if (PyUnicode_Check(value)) - { - Py_ssize_t val_len; - char *val = _PyUnicode_AsStringAndSize(value, &val_len); - strncpy(ptr, val, attrdef->m_size); - ptr[attrdef->m_size-1] = 0; - } - else - { - PyErr_Format(PyExc_TypeError, "expected a string for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - break; - } - case KX_PYATTRIBUTE_TYPE_STRING: - { - STR_String *var = reinterpret_cast(ptr); - if (PyUnicode_Check(value)) - { - Py_ssize_t val_len; - char *val = _PyUnicode_AsStringAndSize(value, &val_len); - if (attrdef->m_clamp) - { - if (val_len < attrdef->m_imin) - { - // can't increase the length of the string - PyErr_Format(PyExc_ValueError, "string length too short for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - else if (val_len > attrdef->m_imax) - { - // trim the string - char c = val[attrdef->m_imax]; - val[attrdef->m_imax] = 0; - *var = val; - val[attrdef->m_imax] = c; - break; - } - } else if (val_len < attrdef->m_imin || val_len > attrdef->m_imax) - { - PyErr_Format(PyExc_ValueError, "string length out of range for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - *var = val; - } - else - { - PyErr_Format(PyExc_TypeError, "expected a string for attribute \"%s\"", attrdef->m_name); - goto FREE_AND_ERROR; - } - break; - } - default: - // should not happen - PyErr_Format(PyExc_AttributeError, "unknown type for attribute \"%s\", report to blender.org", attrdef->m_name); - goto FREE_AND_ERROR; - } - } - // check if post processing is needed - if (attrdef->m_checkFunction != NULL) - { - if ((*attrdef->m_checkFunction)(ref, attrdef) != 0) - { - // restore value - RESTORE_AND_ERROR: - if (undoBuffer) - { - if (attrdef->m_type == KX_PYATTRIBUTE_TYPE_STRING) - { - // special case for STR_String: restore the string - STR_String *var = reinterpret_cast(ptr); - *var = reinterpret_cast(undoBuffer); - } - else - { - // other field type have direct values - memcpy(ptr, undoBuffer, bufferSize); - } - } - FREE_AND_ERROR: - if (undoBuffer) - free(undoBuffer); - if (list) - Py_DECREF(list); - if (item) - Py_DECREF(item); - return 1; - } - } - if (undoBuffer) - free(undoBuffer); - return 0; -} - - - -/*------------------------------ - * PyObjectPlus repr -- representations -------------------------------*/ -PyObject *PyObjectPlus::py_repr(void) -{ - PyErr_SetString(PyExc_SystemError, "Representation not overridden by object."); - return NULL; -} - -PyObject *PyObjectPlus::GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr) -{ - if (self->m_proxy==NULL) - { - self->m_proxy = reinterpret_castPyObject_NEW( PyObjectPlus_Proxy, tp); - BGE_PROXY_PYOWNS(self->m_proxy) = false; - BGE_PROXY_PYREF(self->m_proxy) = true; - } - //PyObject_Print(self->m_proxy, stdout, 0); - //printf("ref %d\n", self->m_proxy->ob_refcnt); - - BGE_PROXY_REF(self->m_proxy) = self; /* Its possible this was set to NULL, so set it back here */ - BGE_PROXY_PTR(self->m_proxy) = ptr; - Py_INCREF(self->m_proxy); /* we own one, thos ones fore the return */ - return self->m_proxy; -} - -PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr, bool py_owns) -{ - if (!self) - { - // in case of proxy without reference to game object - PyObject* proxy = reinterpret_castPyObject_NEW( PyObjectPlus_Proxy, tp); - BGE_PROXY_PYREF(proxy) = false; - BGE_PROXY_PYOWNS(proxy) = py_owns; - BGE_PROXY_REF(proxy) = NULL; - BGE_PROXY_PTR(proxy) = ptr; - return proxy; - } - if (self->m_proxy) - { - if(py_owns) - { /* Free */ - BGE_PROXY_REF(self->m_proxy) = NULL; - Py_DECREF(self->m_proxy); - self->m_proxy= NULL; - } - else { - Py_INCREF(self->m_proxy); - return self->m_proxy; - } - - } - - GetProxyPlus_Ext(self, tp, ptr); - if(py_owns) { - BGE_PROXY_PYOWNS(self->m_proxy) = py_owns; - Py_DECREF(self->m_proxy); /* could avoid thrashing here but for now its ok */ - } - return self->m_proxy; -} - -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// -/* deprecation warning management */ - -bool PyObjectPlus::m_ignore_deprecation_warnings(false); -void PyObjectPlus::SetDeprecationWarnings(bool ignoreDeprecationWarnings) -{ - m_ignore_deprecation_warnings = ignoreDeprecationWarnings; -} - -void PyDebugLine() -{ - // import sys; print '\t%s:%d' % (sys._getframe(0).f_code.co_filename, sys._getframe(0).f_lineno) - - PyObject *getframe, *frame; - PyObject *f_lineno, *f_code, *co_filename; - - getframe = PySys_GetObject((char *)"_getframe"); // borrowed - if (getframe) { - frame = PyObject_CallObject(getframe, NULL); - if (frame) { - f_lineno= PyObject_GetAttrString(frame, "f_lineno"); - f_code= PyObject_GetAttrString(frame, "f_code"); - if (f_lineno && f_code) { - co_filename= PyObject_GetAttrString(f_code, "co_filename"); - if (co_filename) { - - printf("\t%s:%d\n", _PyUnicode_AsString(co_filename), (int)PyLong_AsSsize_t(f_lineno)); - - Py_DECREF(f_lineno); - Py_DECREF(f_code); - Py_DECREF(co_filename); - Py_DECREF(frame); - return; - } - } - - Py_XDECREF(f_lineno); - Py_XDECREF(f_code); - Py_DECREF(frame); - } - - } - PyErr_Clear(); - printf("\tERROR - Could not access sys._getframe(0).f_lineno or sys._getframe().f_code.co_filename\n"); -} - -void PyObjectPlus::ShowDeprecationWarning_func(const char* old_way,const char* new_way) -{ - printf("Method %s is deprecated, please use %s instead.\n", old_way, new_way); - PyDebugLine(); -} - -void PyObjectPlus::ClearDeprecationWarning() -{ - WarnLink *wlink_next; - WarnLink *wlink = GetDeprecationWarningLinkFirst(); - - while(wlink) - { - wlink->warn_done= false; /* no need to NULL the link, its cleared before adding to the list next time round */ - wlink_next= reinterpret_cast(wlink->link); - wlink->link= NULL; - wlink= wlink_next; - } - NullDeprecationWarning(); -} - -WarnLink* m_base_wlink_first= NULL; -WarnLink* m_base_wlink_last= NULL; - -WarnLink* PyObjectPlus::GetDeprecationWarningLinkFirst(void) {return m_base_wlink_first;} -WarnLink* PyObjectPlus::GetDeprecationWarningLinkLast(void) {return m_base_wlink_last;} -void PyObjectPlus::SetDeprecationWarningFirst(WarnLink* wlink) {m_base_wlink_first= wlink;} -void PyObjectPlus::SetDeprecationWarningLinkLast(WarnLink* wlink) {m_base_wlink_last= wlink;} -void PyObjectPlus::NullDeprecationWarning() {m_base_wlink_first= m_base_wlink_last= NULL;} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h deleted file mode 100644 index e19f4800ca5..00000000000 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ /dev/null @@ -1,559 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef _adr_py_lib_h_ // only process once, -#define _adr_py_lib_h_ // even if multiply included - -#ifndef __cplusplus // c++ only -#error Must be compiled with C++ -#endif - -#include "KX_Python.h" -#include "STR_String.h" -#include "MT_Vector3.h" -#include "SG_QList.h" - -/*------------------------------ - * Python defines -------------------------------*/ - -#ifndef DISABLE_PYTHON -#ifdef USE_MATHUTILS -extern "C" { -#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */ -} -#endif - -static inline void Py_Fatal(const char *M) { - fprintf(stderr, "%s\n", M); - exit(-1); -}; - - -/* Use with ShowDeprecationWarning macro */ -typedef struct { - bool warn_done; - void *link; -} WarnLink; - -#define ShowDeprecationWarning(old_way, new_way) \ -{ \ - static WarnLink wlink = {false, NULL}; \ - if ((m_ignore_deprecation_warnings || wlink.warn_done)==0) \ - { \ - ShowDeprecationWarning_func(old_way, new_way); \ - \ - WarnLink *wlink_last= GetDeprecationWarningLinkLast(); \ - wlink.warn_done = true; \ - wlink.link = NULL; \ - \ - if(wlink_last) { \ - wlink_last->link= (void *)&(wlink); \ - SetDeprecationWarningLinkLast(&(wlink)); \ - } else { \ - SetDeprecationWarningFirst(&(wlink)); \ - SetDeprecationWarningLinkLast(&(wlink)); \ - } \ - } \ -} \ - - - -typedef struct PyObjectPlus_Proxy { - PyObject_HEAD /* required python macro */ - class PyObjectPlus *ref; // pointer to GE object, it holds a reference to this proxy - void *ptr; // optional pointer to generic structure, the structure holds no reference to this proxy - bool py_owns; // true if the object pointed by ref should be deleted when the proxy is deleted - bool py_ref; // true if proxy is connected to a GE object (ref is used) -} PyObjectPlus_Proxy; - -#define BGE_PROXY_ERROR_MSG "Blender Game Engine data has been freed, cannot use this python variable" -#define BGE_PROXY_REF(_self) (((PyObjectPlus_Proxy *)_self)->ref) -#define BGE_PROXY_PTR(_self) (((PyObjectPlus_Proxy *)_self)->ptr) -#define BGE_PROXY_PYOWNS(_self) (((PyObjectPlus_Proxy *)_self)->py_owns) -#define BGE_PROXY_PYREF(_self) (((PyObjectPlus_Proxy *)_self)->py_ref) - -/* Note, sometimes we dont care what BGE type this is as long as its a proxy */ -#define BGE_PROXY_CHECK_TYPE(_type) ((_type)->tp_dealloc == PyObjectPlus::py_base_dealloc) - -/* Opposite of BGE_PROXY_REF */ -#define BGE_PROXY_FROM_REF(_self) (((PyObjectPlus *)_self)->GetProxy()) - - -// This must be the first line of each -// PyC++ class -// AttributesPtr correspond to attributes of proxy generic pointer -// each PyC++ class must be registered in KX_PythonInitTypes.cpp -#define __Py_Header \ - public: \ - static PyTypeObject Type; \ - static PyMethodDef Methods[]; \ - static PyAttributeDef Attributes[]; \ - virtual PyTypeObject *GetType(void) {return &Type;}; \ - virtual PyObject *GetProxy() {return GetProxyPlus_Ext(this, &Type, NULL);}; \ - virtual PyObject *NewProxy(bool py_owns) {return NewProxyPlus_Ext(this, &Type, NULL, py_owns);}; \ - -// leave above line empty (macro)! -// use this macro for class that use generic pointer in proxy -// GetProxy() and NewProxy() must be defined to set the correct pointer in the proxy -#define __Py_HeaderPtr \ - public: \ - static PyTypeObject Type; \ - static PyMethodDef Methods[]; \ - static PyAttributeDef Attributes[]; \ - static PyAttributeDef AttributesPtr[]; \ - virtual PyTypeObject *GetType(void) {return &Type;}; \ - virtual PyObject *GetProxy(); \ - virtual PyObject *NewProxy(bool py_owns); \ - -// leave above line empty (macro)! -#ifdef WITH_CXX_GUARDEDALLOC -#define Py_Header __Py_Header \ - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, Type.tp_name); } \ - void operator delete( void *mem ) { MEM_freeN(mem); } \ - -#else -#define Py_Header __Py_Header -#endif - -#ifdef WITH_CXX_GUARDEDALLOC -#define Py_HeaderPtr __Py_HeaderPtr \ - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, Type.tp_name); } \ - void operator delete( void *mem ) { MEM_freeN(mem); } \ - -#else -#define Py_HeaderPtr __Py_HeaderPtr -#endif - -/* - * nonzero values are an error for setattr - * however because of the nested lookups we need to know if the errors - * was because the attribute didnt exits of if there was some problem setting the value - */ - -#define PY_SET_ATTR_COERCE_FAIL 2 -#define PY_SET_ATTR_FAIL 1 -#define PY_SET_ATTR_MISSING -1 -#define PY_SET_ATTR_SUCCESS 0 - -/** - * These macros are helpfull when embedding Python routines. The second - * macro is one that also requires a documentation string - */ -#define KX_PYMETHOD(class_name, method_name) \ - PyObject* Py##method_name(PyObject* args, PyObject* kwds); \ - static PyObject* sPy##method_name( PyObject* self, PyObject* args, PyObject* kwds) { \ - if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_SystemError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \ - return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds); \ - }; \ - -#define KX_PYMETHOD_VARARGS(class_name, method_name) \ - PyObject* Py##method_name(PyObject* args); \ - static PyObject* sPy##method_name( PyObject* self, PyObject* args) { \ - if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_SystemError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \ - return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args); \ - }; \ - -#define KX_PYMETHOD_NOARGS(class_name, method_name) \ - PyObject* Py##method_name(); \ - static PyObject* sPy##method_name( PyObject* self) { \ - if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_SystemError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \ - return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(); \ - }; \ - -#define KX_PYMETHOD_O(class_name, method_name) \ - PyObject* Py##method_name(PyObject* value); \ - static PyObject* sPy##method_name( PyObject* self, PyObject* value) { \ - if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_SystemError, #class_name "." #method_name "(value) - " BGE_PROXY_ERROR_MSG); return NULL; } \ - return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(value); \ - }; \ - -#define KX_PYMETHOD_DOC(class_name, method_name) \ - PyObject* Py##method_name(PyObject* args, PyObject* kwds); \ - static PyObject* sPy##method_name( PyObject* self, PyObject* args, PyObject* kwds) { \ - if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_SystemError, #class_name "." #method_name "(...) - " BGE_PROXY_ERROR_MSG); return NULL; } \ - return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds); \ - }; \ - static const char method_name##_doc[]; \ - -#define KX_PYMETHOD_DOC_VARARGS(class_name, method_name) \ - PyObject* Py##method_name(PyObject* args); \ - static PyObject* sPy##method_name( PyObject* self, PyObject* args) { \ - if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_SystemError, #class_name "." #method_name "(...) - " BGE_PROXY_ERROR_MSG); return NULL; } \ - return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args); \ - }; \ - static const char method_name##_doc[]; \ - -#define KX_PYMETHOD_DOC_O(class_name, method_name) \ - PyObject* Py##method_name(PyObject* value); \ - static PyObject* sPy##method_name( PyObject* self, PyObject* value) { \ - if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_SystemError, #class_name "." #method_name "(value) - " BGE_PROXY_ERROR_MSG); return NULL; } \ - return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(value); \ - }; \ - static const char method_name##_doc[]; \ - -#define KX_PYMETHOD_DOC_NOARGS(class_name, method_name) \ - PyObject* Py##method_name(); \ - static PyObject* sPy##method_name( PyObject* self) { \ - if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_SystemError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \ - return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(); \ - }; \ - static const char method_name##_doc[]; \ - - -/* The line above should remain empty */ -/** - * Method table macro (with doc) - */ -#define KX_PYMETHODTABLE(class_name, method_name) \ - {#method_name , (PyCFunction) class_name::sPy##method_name, METH_VARARGS, (const char *)class_name::method_name##_doc} - -#define KX_PYMETHODTABLE_O(class_name, method_name) \ - {#method_name , (PyCFunction) class_name::sPy##method_name, METH_O, (const char *)class_name::method_name##_doc} - -#define KX_PYMETHODTABLE_NOARGS(class_name, method_name) \ - {#method_name , (PyCFunction) class_name::sPy##method_name, METH_NOARGS, (const char *)class_name::method_name##_doc} - -/** - * Function implementation macro - */ -#define KX_PYMETHODDEF_DOC(class_name, method_name, doc_string) \ -const char class_name::method_name##_doc[] = doc_string; \ -PyObject* class_name::Py##method_name(PyObject* args, PyObject*) - -#define KX_PYMETHODDEF_DOC_VARARGS(class_name, method_name, doc_string) \ -const char class_name::method_name##_doc[] = doc_string; \ -PyObject* class_name::Py##method_name(PyObject* args) - -#define KX_PYMETHODDEF_DOC_O(class_name, method_name, doc_string) \ -const char class_name::method_name##_doc[] = doc_string; \ -PyObject* class_name::Py##method_name(PyObject* value) - -#define KX_PYMETHODDEF_DOC_NOARGS(class_name, method_name, doc_string) \ -const char class_name::method_name##_doc[] = doc_string; \ -PyObject* class_name::Py##method_name() - -/** - * Attribute management - */ -enum KX_PYATTRIBUTE_TYPE { - KX_PYATTRIBUTE_TYPE_BOOL, - KX_PYATTRIBUTE_TYPE_ENUM, - KX_PYATTRIBUTE_TYPE_SHORT, - KX_PYATTRIBUTE_TYPE_INT, - KX_PYATTRIBUTE_TYPE_FLOAT, - KX_PYATTRIBUTE_TYPE_STRING, - KX_PYATTRIBUTE_TYPE_DUMMY, - KX_PYATTRIBUTE_TYPE_FUNCTION, - KX_PYATTRIBUTE_TYPE_VECTOR, - KX_PYATTRIBUTE_TYPE_FLAG, - KX_PYATTRIBUTE_TYPE_CHAR, -}; - -enum KX_PYATTRIBUTE_ACCESS { - KX_PYATTRIBUTE_RW, - KX_PYATTRIBUTE_RO -}; - -struct KX_PYATTRIBUTE_DEF; -typedef int (*KX_PYATTRIBUTE_CHECK_FUNCTION)(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); -typedef int (*KX_PYATTRIBUTE_SET_FUNCTION)(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); -typedef PyObject* (*KX_PYATTRIBUTE_GET_FUNCTION)(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - -typedef struct KX_PYATTRIBUTE_DEF { - const char *m_name; // name of the python attribute - KX_PYATTRIBUTE_TYPE m_type; // type of value - KX_PYATTRIBUTE_ACCESS m_access; // read/write access or read-only - int m_imin; // minimum value in case of integer attributes - // (for string: minimum string length, for flag: mask value, for float: matrix row size) - int m_imax; // maximum value in case of integer attributes - // (for string: maximum string length, for flag: 1 if flag is negative, float: vector/matrix col size) - float m_fmin; // minimum value in case of float attributes - float m_fmax; // maximum value in case of float attributes - bool m_clamp; // enforce min/max value by clamping - bool m_usePtr; // the attribute uses the proxy generic pointer, set at runtime - size_t m_offset; // position of field in structure - size_t m_size; // size of field for runtime verification (enum only) - size_t m_length; // length of array, 1=simple attribute - KX_PYATTRIBUTE_CHECK_FUNCTION m_checkFunction; // static function to check the assignment, returns 0 if no error - KX_PYATTRIBUTE_SET_FUNCTION m_setFunction; // static function to check the assignment, returns 0 if no error - KX_PYATTRIBUTE_GET_FUNCTION m_getFunction; // static function to check the assignment, returns 0 if no error - - // The following pointers are just used to have compile time check for attribute type. - // It would have been good to use a union but that would require C99 compatibility - // to initialize specific union fields through designated initializers. - struct { - bool *m_boolPtr; - short int *m_shortPtr; - int *m_intPtr; - float *m_floatPtr; - STR_String *m_stringPtr; - MT_Vector3 *m_vectorPtr; - char *m_charPtr; - } m_typeCheck; -} PyAttributeDef; - -#define KX_PYATTRIBUTE_DUMMY(name) \ - { name, KX_PYATTRIBUTE_TYPE_DUMMY, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, 0, 0, 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } - -#define KX_PYATTRIBUTE_BOOL_RW(name,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_BOOL, KX_PYATTRIBUTE_RW, 0, 1, 0.f, 0.f, false, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {&((object *)0)->field, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_BOOL_RW_CHECK(name,object,field,function) \ - { name, KX_PYATTRIBUTE_TYPE_BOOL, KX_PYATTRIBUTE_RW, 0, 1, 0.f, 0.f, false, false, offsetof(object,field), 0, 1, &object::function, NULL, NULL, {&((object *)0)->field, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_BOOL_RO(name,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_BOOL, KX_PYATTRIBUTE_RO, 0, 1, 0.f, 0.f, false, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {&((object *)0)->field, NULL, NULL, NULL, NULL, NULL, NULL} } - -/* attribute points to a single bit of an integer field, attribute=true if bit is set */ -#define KX_PYATTRIBUTE_FLAG_RW(name,object,field,bit) \ - { name, KX_PYATTRIBUTE_TYPE_FLAG, KX_PYATTRIBUTE_RW, bit, 0, 0.f, 0.f, false, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLAG_RW_CHECK(name,object,field,bit,function) \ - { name, KX_PYATTRIBUTE_TYPE_FLAG, KX_PYATTRIBUTE_RW, bit, 0, 0.f, 0.f, false, false, offsetof(object,field), sizeof(((object *)0)->field), 1, &object::function, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLAG_RO(name,object,field,bit) \ - { name, KX_PYATTRIBUTE_TYPE_FLAG, KX_PYATTRIBUTE_RO, bit, 0, 0.f, 0.f, false, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } - -/* attribute points to a single bit of an integer field, attribute=true if bit is set*/ -#define KX_PYATTRIBUTE_FLAG_NEGATIVE_RW(name,object,field,bit) \ - { name, KX_PYATTRIBUTE_TYPE_FLAG, KX_PYATTRIBUTE_RW, bit, 1, 0.f, 0.f, false, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLAG_NEGATIVE_RW_CHECK(name,object,field,bit,function) \ - { name, KX_PYATTRIBUTE_TYPE_FLAG, KX_PYATTRIBUTE_RW, bit, 1, 0.f, 0.f, false, false, offsetof(object,field), sizeof(((object *)0)->field), 1, &object::function, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLAG_NEGATIVE_RO(name,object,field,bit) \ - { name, KX_PYATTRIBUTE_TYPE_FLAG, KX_PYATTRIBUTE_RO, bit, 1, 0.f, 0.f, false, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } - -// enum field cannot be mapped to pointer (because we would need a pointer for each enum) -// use field size to verify mapping at runtime only, assuming enum size is equal to int size. -#define KX_PYATTRIBUTE_ENUM_RW(name,min,max,clamp,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_ENUM, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_ENUM_RW_CHECK(name,min,max,clamp,object,field,function) \ - { name, KX_PYATTRIBUTE_TYPE_ENUM, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), sizeof(((object *)0)->field), 1, &object::function, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_ENUM_RO(name,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_ENUM, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } - -#define KX_PYATTRIBUTE_SHORT_RW(name,min,max,clamp,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_SHORT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {NULL, &((object *)0)->field, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_SHORT_RW_CHECK(name,min,max,clamp,object,field,function) \ - { name, KX_PYATTRIBUTE_TYPE_SHORT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, 1, &object::function, NULL, NULL, {NULL, &((object *)0)->field, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_SHORT_RO(name,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_SHORT, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {NULL, &((object *)0)->field, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_SHORT_ARRAY_RW(name,min,max,clamp,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_SHORT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, length, NULL, NULL, NULL, {NULL, ((object *)0)->field, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_SHORT_ARRAY_RW_CHECK(name,min,max,clamp,object,field,length,function) \ - { name, KX_PYATTRIBUTE_TYPE_SHORT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, length, &object::function, NULL, NULL, {NULL, ((object *)0)->field, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_SHORT_ARRAY_RO(name,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_SHORT, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), 0, length, NULL, NULL, NULL, {NULL, ((object *)0)->field, NULL, NULL, NULL, NULL, NULL} } -// SHORT_LIST -#define KX_PYATTRIBUTE_SHORT_LIST_RW(name,min,max,clamp,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_SHORT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, length, NULL, NULL, NULL, {NULL, &((object *)0)->field, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_SHORT_LIST_RW_CHECK(name,min,max,clamp,object,field,length,function) \ - { name, KX_PYATTRIBUTE_TYPE_SHORT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, length, &object::function, NULL, NULL, {NULL, &((object *)0)->field, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_SHORT_LIST_RO(name,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_SHORT, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), 0, length, NULL, NULL, NULL, {NULL, &((object *)0)->field, NULL, NULL, NULL, NULL, NULL} } - -#define KX_PYATTRIBUTE_INT_RW(name,min,max,clamp,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_INT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {NULL, NULL, &((object *)0)->field, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_INT_RW_CHECK(name,min,max,clamp,object,field,function) \ - { name, KX_PYATTRIBUTE_TYPE_INT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, 1, &object::function, NULL, NULL, {NULL, NULL, &((object *)0)->field, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_INT_RO(name,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_INT, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {NULL, NULL, &((object *)0)->field, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_INT_ARRAY_RW(name,min,max,clamp,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_INT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, length, NULL, NULL, NULL, {NULL, NULL, ((object *)0)->field, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_INT_ARRAY_RW_CHECK(name,min,max,clamp,object,field,length,function) \ - { name, KX_PYATTRIBUTE_TYPE_INT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, length, &object::function, NULL, NULL, {NULL, NULL, ((object *)0)->field, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_INT_ARRAY_RO(name,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_INT, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), 0, length, NULL, NULL, NULL, {NULL, NULL, ((object *)0)->field, NULL, NULL, NULL, NULL} } -// INT_LIST -#define KX_PYATTRIBUTE_INT_LIST_RW(name,min,max,clamp,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_INT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, length, NULL, NULL, NULL, {NULL, NULL, &((object *)0)->field, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_INT_LIST_RW_CHECK(name,min,max,clamp,object,field,length,function) \ - { name, KX_PYATTRIBUTE_TYPE_INT, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, length, &object::function, NULL, NULL, {NULL, NULL, &((object *)0)->field, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_INT_LIST_RO(name,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_INT, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), 0, length, NULL, NULL, NULL, {NULL, NULL, &((object *)0)->field, NULL, NULL, NULL, NULL} } - -// always clamp for float -#define KX_PYATTRIBUTE_FLOAT_RW(name,min,max,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RW, 0, 0, min, max, true, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {NULL, NULL, NULL, &((object *)0)->field, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLOAT_RW_CHECK(name,min,max,object,field,function) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RW, 0, 0, min, max, true, false, offsetof(object,field), 0, 1, &object::function, NULL, NULL, {NULL, NULL, NULL, &((object *)0)->field, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLOAT_RO(name,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {NULL, NULL, NULL, &((object *)0)->field, NULL, NULL, NULL} } -// field must be float[n], returns a sequence -#define KX_PYATTRIBUTE_FLOAT_ARRAY_RW(name,min,max,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RW, 0, 0, min, max, true, false, offsetof(object,field), 0, length, NULL, NULL, NULL, {NULL, NULL, NULL, ((object *)0)->field, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLOAT_ARRAY_RW_CHECK(name,min,max,object,field,length,function) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RW, 0, 0, min, max, true, false, offsetof(object,field), 0, length, &object::function, NULL, NULL, {NULL, NULL, NULL, ((object *)0)->field, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLOAT_ARRAY_RO(name,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), 0, length, NULL, NULL, NULL, {NULL, NULL, NULL, ((object *)0)->field, NULL, NULL, NULL} } -// field must be float[n], returns a vector -#define KX_PYATTRIBUTE_FLOAT_VECTOR_RW(name,min,max,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RW, 0, length, min, max, true, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, ((object *)0)->field, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLOAT_VECTOR_RW_CHECK(name,min,max,object,field,length,function) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RW, 0, length, min, max, true, false, offsetof(object,field), sizeof(((object *)0)->field), 1, &object::function, NULL, NULL, {NULL, NULL, NULL, ((object *)0)->field, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLOAT_VECTOR_RO(name,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RO, 0, length, 0.f, 0.f, false, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, ((object *)0)->field, NULL, NULL, NULL} } -// field must be float[n][n], returns a matrix -#define KX_PYATTRIBUTE_FLOAT_MATRIX_RW(name,min,max,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RW, length, length, min, max, true, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, ((object *)0)->field[0], NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLOAT_MATRIX_RW_CHECK(name,min,max,object,field,length,function) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RW, length, length, min, max, true, false, offsetof(object,field), sizeof(((object *)0)->field), 1, &object::function, NULL, NULL, {NULL, NULL, NULL, ((object *)0)->field[0], NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_FLOAT_MATRIX_RO(name,object,field,length) \ - { name, KX_PYATTRIBUTE_TYPE_FLOAT, KX_PYATTRIBUTE_RO, length, length, 0.f, 0.f, false, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, ((object *)0)->field[0], NULL, NULL, NULL} } - -// only for STR_String member -#define KX_PYATTRIBUTE_STRING_RW(name,min,max,clamp,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_STRING, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, &((object *)0)->field, NULL, NULL} } -#define KX_PYATTRIBUTE_STRING_RW_CHECK(name,min,max,clamp,object,field,function) \ - { name, KX_PYATTRIBUTE_TYPE_STRING, KX_PYATTRIBUTE_RW, min, max, 0.f, 0.f, clamp, false, offsetof(object,field), 0, 1, &object::function, NULL, NULL, {NULL, NULL, NULL, NULL, &((object *)0)->field, NULL, NULL} } -#define KX_PYATTRIBUTE_STRING_RO(name,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_STRING, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), 0, 1 , NULL, NULL, NULL, {NULL, NULL, NULL, NULL, &((object *)0)->field, NULL, NULL} } - -// only for char [] array -#define KX_PYATTRIBUTE_CHAR_RW(name,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_CHAR, KX_PYATTRIBUTE_RW, 0, 0, 0.f, 0.f, true, false, offsetof(object,field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, ((object *)0)->field} } -#define KX_PYATTRIBUTE_CHAR_RW_CHECK(name,object,field,function) \ - { name, KX_PYATTRIBUTE_TYPE_CHAR, KX_PYATTRIBUTE_RW, 0, 0, 0.f, 0.f, true, false, offsetof(object,field), sizeof(((object *)0)->field), 1, &object::function, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, ((object *)0)->field} } -#define KX_PYATTRIBUTE_CHAR_RO(name,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_CHAR, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), sizeof(((object *)0)->field), 1 , NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, ((object *)0)->field} } - -// for MT_Vector3 member -#define KX_PYATTRIBUTE_VECTOR_RW(name,min,max,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_VECTOR, KX_PYATTRIBUTE_RW, 0, 0, min, max, true, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, &((object *)0)->field, NULL} } -#define KX_PYATTRIBUTE_VECTOR_RW_CHECK(name,min,max,clamp,object,field,function) \ - { name, KX_PYATTRIBUTE_TYPE_VECTOR, KX_PYATTRIBUTE_RW, 0, 0, min, max, true, false, offsetof(object,field), 0, 1, &object::function, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, &((object *)0)->field, NULL} } -#define KX_PYATTRIBUTE_VECTOR_RO(name,object,field) \ - { name, KX_PYATTRIBUTE_TYPE_VECTOR, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object,field), 0, 1 , NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, &((object *)0)->field, NULL} } - -#define KX_PYATTRIBUTE_RW_FUNCTION(name,object,getfunction,setfunction) \ - { name, KX_PYATTRIBUTE_TYPE_FUNCTION, KX_PYATTRIBUTE_RW, 0, 0, 0.f, 0.f, false, false, 0, 0, 1, NULL, &object::setfunction, &object::getfunction, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_RO_FUNCTION(name,object,getfunction) \ - { name, KX_PYATTRIBUTE_TYPE_FUNCTION, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, 0, 0, 1, NULL, NULL, &object::getfunction, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_ARRAY_RW_FUNCTION(name,object,length,getfunction,setfunction) \ - { name, KX_PYATTRIBUTE_TYPE_FUNCTION, KX_PYATTRIBUTE_RW, 0, 0, 0.f, 0,f, false, false, 0, 0, length, NULL, &object::setfunction, &object::getfunction, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } -#define KX_PYATTRIBUTE_ARRAY_RO_FUNCTION(name,object,length,getfunction) \ - { name, KX_PYATTRIBUTE_TYPE_FUNCTION, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0,f, false, false, 0, 0, length, NULL, NULL, &object::getfunction, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} } - - -/*------------------------------ - * PyObjectPlus -------------------------------*/ -typedef PyTypeObject * PyParentObject; // Define the PyParent Object - -#else // DISABLE_PYTHON - -#define Py_Header \ - public: \ - - -#define Py_HeaderPtr \ - public: \ - - -#endif - - - -// By making SG_QList the ultimate parent for PyObjectPlus objects, it -// allows to put them in 2 different dynamic lists at the same time -// The use of these links is interesting because they free of memory allocation -// but it's very important not to mess up with them. If you decide that -// the SG_QList or SG_DList component is used for something for a certain class, -// they cannot can be used for anything else at a parent level! -// What these lists are and what they are used for must be carefully documented -// at the level where they are used. -// DON'T MAKE ANY USE OF THESE LIST AT THIS LEVEL, they are already used -// at SCA_IActuator, SCA_ISensor, SCA_IController level which rules out the -// possibility to use them at SCA_ILogicBrick, CValue and PyObjectPlus level. -class PyObjectPlus : public SG_QList -{ // The PyObjectPlus abstract class - Py_Header; // Always start with Py_Header - -public: - PyObjectPlus(); - - virtual ~PyObjectPlus(); // destructor - -#ifndef DISABLE_PYTHON - PyObject *m_proxy; /* actually a PyObjectPlus_Proxy */ - - /* These static functions are referenced by ALL PyObjectPlus_Proxy types - * they take the C++ reference from the PyObjectPlus_Proxy and call - * its own virtual py_repr, py_base_dealloc ,etc. functions. - */ - - static PyObject* py_base_new(PyTypeObject *type, PyObject *args, PyObject *kwds); /* allows subclassing */ - static void py_base_dealloc(PyObject *self); - static PyObject* py_base_repr(PyObject *self); - - /* These are all virtual python methods that are defined in each class - * Our own fake subclassing calls these on each class, then calls the parent */ - virtual PyObject* py_repr(void); - /* subclass may overwrite this function to implement more sophisticated method of validating a proxy */ - virtual bool py_is_valid(void) { return true; } - - static PyObject* py_get_attrdef(PyObject *self_py, const PyAttributeDef *attrdef); - static int py_set_attrdef(PyObject *self_py, PyObject *value, const PyAttributeDef *attrdef); - - /* Kindof dumb, always returns True, the false case is checked for, before this function gets accessed */ - static PyObject* pyattr_get_invalid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - - static PyObject *GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr); - /* self=NULL => proxy to generic pointer detached from GE object - if py_owns is true, the memory pointed by ptr will be deleted automatially with MEM_freeN - self!=NULL=> proxy attached to GE object, ptr is optional and point to a struct from which attributes can be defined - if py_owns is true, the object will be deleted automatically, ptr will NOT be deleted - (assume object destructor takes care of it) */ - static PyObject *NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr, bool py_owns); - - static WarnLink* GetDeprecationWarningLinkFirst(void); - static WarnLink* GetDeprecationWarningLinkLast(void); - static void SetDeprecationWarningFirst(WarnLink* wlink); - static void SetDeprecationWarningLinkLast(WarnLink* wlink); - static void NullDeprecationWarning(); - - /** enable/disable display of deprecation warnings */ - static void SetDeprecationWarnings(bool ignoreDeprecationWarnings); - /** Shows a deprecation warning */ - static void ShowDeprecationWarning_func(const char* method,const char* prop); - static void ClearDeprecationWarning(); - -#endif - - void InvalidateProxy(); - - /** - * Makes sure any internal data owned by this class is deep copied. - */ - virtual void ProcessReplica(); - - static bool m_ignore_deprecation_warnings; -}; - -#ifndef DISABLE_PYTHON -PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict); -#endif - -#endif // _adr_py_lib_h_ diff --git a/source/gameengine/Expressions/SConscript b/source/gameengine/Expressions/SConscript deleted file mode 100644 index 94af9dcfec8..00000000000 --- a/source/gameengine/Expressions/SConscript +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = env.Glob('*.cpp') - -incs ='. #source/kernel/gen_system #intern/guardedalloc #intern/string #intern/moto/include #source/gameengine/SceneGraph #source/blender/blenloader' - -defs = [] - -if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] -else: - defs.append('DISABLE_PYTHON') - -env.BlenderLib ( 'bf_expressions', sources, Split(incs), defs, libtype=['core','player'], priority = [360,80], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Expressions/StringValue.cpp b/source/gameengine/Expressions/StringValue.cpp deleted file mode 100644 index d0aa8d26678..00000000000 --- a/source/gameengine/Expressions/StringValue.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// StringValue.cpp: implementation of the CStringValue class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include "StringValue.h" -#include "BoolValue.h" -#include "ErrorValue.h" -#include "VoidValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CStringValue::CStringValue() -/* -pre: false -effect: constructs a new CStringValue -*/ -{ - m_strString = "[Illegal String constructor call]"; -} - -CStringValue::CStringValue(const char *txt,const char *name,AllocationTYPE alloctype) -/* -pre: -effect: constructs a new CStringValue containing text txt -*/ -{ - m_strString = txt; - SetName(name); - - if (alloctype==CValue::STACKVALUE) - { - CValue::DisableRefCount(); - - } - - -} - - -CValue* CStringValue::Calc(VALUE_OPERATOR op, CValue *val) -/* -pre: -ret: a new object containing the result of applying operator op to this -object and val -*/ -{ - //return val->CalrcString(op, this); - return val->CalcFinal(VALUE_STRING_TYPE, op, this); -} - -CValue* CStringValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) -/* -pre: the type of val is dtype -ret: a new object containing the result of applying operator op to val and -this object -*/ -{ - CValue *ret; - - if (op == VALUE_ADD_OPERATOR) { - if (dtype == VALUE_ERROR_TYPE) - ret = new CErrorValue(val->GetText() + op2str(op) + GetText()); - else - ret = new CStringValue(val->GetText() + GetText(),""); - } else { - - if (dtype == VALUE_STRING_TYPE || dtype == VALUE_EMPTY_TYPE) { - switch(op) { - case VALUE_EQL_OPERATOR: - ret = new CBoolValue(val->GetText() == GetText()); - break; - case VALUE_NEQ_OPERATOR: - ret = new CBoolValue(val->GetText() != GetText()); - break; - case VALUE_GRE_OPERATOR: - ret = new CBoolValue(val->GetText() > GetText()); - break; - case VALUE_LES_OPERATOR: - ret = new CBoolValue(val->GetText() < GetText()); - break; - case VALUE_GEQ_OPERATOR: - ret = new CBoolValue(val->GetText() >= GetText()); - break; - case VALUE_LEQ_OPERATOR: - ret = new CBoolValue(val->GetText() <= GetText()); - break; - default: - ret = new CErrorValue(val->GetText() + op2str(op) + "[operator not allowed on strings]"); - break; - } - } else { - ret = new CErrorValue(val->GetText() + op2str(op) + "[operator not allowed on strings]"); - } - } - return ret; -} - - - -double CStringValue::GetNumber() -{ - return -1; -} - - - -const STR_String & CStringValue::GetText() -{ - return m_strString; -} - -bool CStringValue::IsEqual(const STR_String & other) -{ - return (m_strString == other); -} - -CValue* CStringValue::GetReplica() -{ - CStringValue* replica = new CStringValue(*this); - replica->ProcessReplica(); - return replica; -}; - - diff --git a/source/gameengine/Expressions/StringValue.h b/source/gameengine/Expressions/StringValue.h deleted file mode 100644 index a23bb4ec3e2..00000000000 --- a/source/gameengine/Expressions/StringValue.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * StringValue.h: interface for the CStringValue class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef __STRINGVALUE_H__ -#define __STRINGVALUE_H__ - -#include "Value.h" - -class CStringValue : public CPropValue -{ - - - //PLUGIN_DECLARE_SERIAL(CStringValue,CValue) -public: - /// Construction / destruction - CStringValue(); - CStringValue (const char *txt, const char *name , AllocationTYPE alloctype = CValue::HEAPVALUE); - - virtual ~CStringValue() { - }; - /// CValue implementation - virtual bool IsEqual(const STR_String & other); - virtual const STR_String & GetText(); - virtual double GetNumber(); - - virtual CValue* Calc(VALUE_OPERATOR op, CValue *val); - virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - virtual void SetValue(CValue* newval) { m_strString = newval->GetText(); SetModified(true); }; - virtual CValue* GetReplica(); -#ifndef DISABLE_PYTHON - virtual PyObject* ConvertValueToPython() { - return PyUnicode_FromString(m_strString.Ptr()); - } -#endif // DISABLE_PYTHON - -private: - // data member - STR_String m_strString; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CStringValue"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp deleted file mode 100644 index 1f4f961268b..00000000000 --- a/source/gameengine/Expressions/Value.cpp +++ /dev/null @@ -1,634 +0,0 @@ -// Value.cpp: implementation of the CValue class. -// developed at Eindhoven University of Technology, 1997 -// by the OOPS team -////////////////////////////////////////////////////////////////////// -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ -#include "Value.h" -#include "FloatValue.h" -#include "IntValue.h" -#include "VectorValue.h" -#include "VoidValue.h" -#include "StringValue.h" -#include "ErrorValue.h" -#include "ListValue.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -double CValue::m_sZeroVec[3] = {0.0,0.0,0.0}; - -#ifndef DISABLE_PYTHON - -PyTypeObject CValue::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "CValue", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0, - 0,0,0,0,0, - NULL, - NULL, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &PyObjectPlus::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef CValue::Methods[] = { - {NULL,NULL} //Sentinel -}; -#endif // DISABLE_PYTHON - - -/*#define CVALUE_DEBUG*/ -#ifdef CVALUE_DEBUG -int gRefCount; -struct SmartCValueRef -{ - CValue *m_ref; - int m_count; - SmartCValueRef(CValue *ref) - { - m_ref = ref; - m_count = gRefCount++; - } -}; - -#include - -std::vector gRefList; -#endif - -#ifdef _DEBUG -//int gRefCountValue; -#endif - -CValue::CValue() - : PyObjectPlus(), - -m_pNamedPropertyArray(NULL), -m_refcount(1) -/* -pre: false -effect: constucts a CValue -*/ -{ - //debug(gRefCountValue++) // debugging -#ifdef _DEBUG - //gRefCountValue++; -#ifdef CVALUE_DEBUG - gRefList.push_back(SmartCValueRef(this)); -#endif -#endif -} - - - -CValue::~CValue() -/* -pre: -effect: deletes the object -*/ -{ - ClearProperties(); - - assertd (m_refcount==0); -#ifdef CVALUE_DEBUG - std::vector::iterator it; - for (it=gRefList.begin(); it!=gRefList.end(); it++) - { - if (it->m_ref == this) - { - *it = gRefList.back(); - gRefList.pop_back(); - break; - } - } -#endif -} - - - - -#define VALUE_SUB(val1, val2) (val1)->Calc(VALUE_SUB_OPERATOR, val2) -#define VALUE_MUL(val1, val2) (val1)->Calc(VALUE_MUL_OPERATOR, val2) -#define VALUE_DIV(val1, val2) (val1)->Calc(VALUE_DIV_OPERATOR, val2) -#define VALUE_NEG(val1) (val1)->Calc(VALUE_NEG_OPERATOR, val1) -#define VALUE_POS(val1) (val1)->Calc(VALUE_POS_OPERATOR, val1) - - -STR_String CValue::op2str (VALUE_OPERATOR op) -{ - //pre: - //ret: the stringrepresentation of operator op - - STR_String opmsg; - switch (op) { - case VALUE_MOD_OPERATOR: - opmsg = " % "; - break; - case VALUE_ADD_OPERATOR: - opmsg = " + "; - break; - case VALUE_SUB_OPERATOR: - opmsg = " - "; - break; - case VALUE_MUL_OPERATOR: - opmsg = " * "; - break; - case VALUE_DIV_OPERATOR: - opmsg = " / "; - break; - case VALUE_NEG_OPERATOR: - opmsg = " -"; - break; - case VALUE_POS_OPERATOR: - opmsg = " +"; - break; - case VALUE_AND_OPERATOR: - opmsg = " & "; - break; - case VALUE_OR_OPERATOR: - opmsg = " | "; - break; - case VALUE_EQL_OPERATOR: - opmsg = " = "; - break; - case VALUE_NEQ_OPERATOR: - opmsg = " != "; - break; - case VALUE_NOT_OPERATOR: - opmsg = " !"; - break; - default: - opmsg="Error in Errorhandling routine."; - // AfxMessageBox("Invalid operator"); - break; - } - return opmsg; -} - - - - - -//--------------------------------------------------------------------------------------------------------------------- -// Property Management -//--------------------------------------------------------------------------------------------------------------------- - - - -// -// Set property , overwrites and releases a previous property with the same name if needed -// -void CValue::SetProperty(const STR_String & name,CValue* ioProperty) -{ - if (ioProperty==NULL) - { // Check if somebody is setting an empty property - trace("Warning:trying to set empty property!"); - return; - } - - if (m_pNamedPropertyArray) - { // Try to replace property (if so -> exit as soon as we replaced it) - CValue* oldval = (*m_pNamedPropertyArray)[name]; - if (oldval) - oldval->Release(); - } - else { // Make sure we have a property array - m_pNamedPropertyArray = new std::map; - } - - // Add property at end of array - (*m_pNamedPropertyArray)[name] = ioProperty->AddRef();//->Add(ioProperty); -} - -void CValue::SetProperty(const char* name,CValue* ioProperty) -{ - if (ioProperty==NULL) - { // Check if somebody is setting an empty property - trace("Warning:trying to set empty property!"); - return; - } - - if (m_pNamedPropertyArray) - { // Try to replace property (if so -> exit as soon as we replaced it) - CValue* oldval = (*m_pNamedPropertyArray)[name]; - if (oldval) - oldval->Release(); - } - else { // Make sure we have a property array - m_pNamedPropertyArray = new std::map; - } - - // Add property at end of array - (*m_pNamedPropertyArray)[name] = ioProperty->AddRef();//->Add(ioProperty); -} - -// -// Get pointer to a property with name , returns NULL if there is no property named -// -CValue* CValue::GetProperty(const STR_String & inName) -{ - if (m_pNamedPropertyArray) { - std::map::iterator it = m_pNamedPropertyArray->find(inName); - if (it != m_pNamedPropertyArray->end()) - return (*it).second; - } - return NULL; -} - -CValue* CValue::GetProperty(const char *inName) -{ - if (m_pNamedPropertyArray) { - std::map::iterator it = m_pNamedPropertyArray->find(inName); - if (it != m_pNamedPropertyArray->end()) - return (*it).second; - } - return NULL; -} - -// -// Get text description of property with name , returns an empty string if there is no property named -// -const STR_String& CValue::GetPropertyText(const STR_String & inName) -{ - const static STR_String sEmpty(""); - - CValue *property = GetProperty(inName); - if (property) - return property->GetText(); - else - return sEmpty; -} - -float CValue::GetPropertyNumber(const STR_String& inName,float defnumber) -{ - CValue *property = GetProperty(inName); - if (property) - return property->GetNumber(); - else - return defnumber; -} - - - -// -// Remove the property named , returns true if the property was succesfully removed, false if property was not found or could not be removed -// -bool CValue::RemoveProperty(const char *inName) -{ - // Check if there are properties at all which can be removed - if (m_pNamedPropertyArray) - { - std::map::iterator it = m_pNamedPropertyArray->find(inName); - if (it != m_pNamedPropertyArray->end()) - { - ((*it).second)->Release(); - m_pNamedPropertyArray->erase(it); - return true; - } - } - - return false; -} - -// -// Get Property Names -// -vector CValue::GetPropertyNames() -{ - vector result; - if(!m_pNamedPropertyArray) return result; - result.reserve(m_pNamedPropertyArray->size()); - - std::map::iterator it; - for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++) - { - result.push_back((*it).first); - } - return result; -} - -// -// Clear all properties -// -void CValue::ClearProperties() -{ - // Check if we have any properties - if (m_pNamedPropertyArray == NULL) - return; - - // Remove all properties - std::map::iterator it; - for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++) - { - CValue* tmpval = (*it).second; - //STR_String name = (*it).first; - tmpval->Release(); - } - - // Delete property array - delete m_pNamedPropertyArray; - m_pNamedPropertyArray=NULL; -} - - - -// -// Set all properties' modified flag to -// -void CValue::SetPropertiesModified(bool inModified) -{ - if(!m_pNamedPropertyArray) return; - std::map::iterator it; - - for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++) - ((*it).second)->SetModified(inModified); -} - - - -// -// Check if any of the properties in this value have been modified -// -bool CValue::IsAnyPropertyModified() -{ - if(!m_pNamedPropertyArray) return false; - std::map::iterator it; - - for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++) - if (((*it).second)->IsModified()) - return true; - - return false; -} - - - -// -// Get property number -// -CValue* CValue::GetProperty(int inIndex) -{ - - int count=0; - CValue* result = NULL; - - if (m_pNamedPropertyArray) - { - std::map::iterator it; - for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++) - { - if (count++==inIndex) - { - result = (*it).second; - break; - } - } - - } - return result; -} - - - -// -// Get the amount of properties assiocated with this value -// -int CValue::GetPropertyCount() -{ - if (m_pNamedPropertyArray) - return m_pNamedPropertyArray->size(); - else - return 0; -} - - -double* CValue::GetVector3(bool bGetTransformedVec) -{ - assertd(false); // don;t get vector from me - return m_sZeroVec;//::sZero; -} - - -/*--------------------------------------------------------------------------------------------------------------------- - Reference Counting ----------------------------------------------------------------------------------------------------------------------*/ - - - -// -// Release a reference to this value (when reference count reaches 0, the value is removed from the heap) -// - - - -// -// Disable reference counting for this value -// -void CValue::DisableRefCount() -{ - assertd(m_refcount == 1); - m_refcount--; - - //debug(gRefCountValue--); -#ifdef _DEBUG - //gRefCountValue--; -#endif - m_ValFlags.RefCountDisabled=true; -} - - - -void CValue::ProcessReplica() /* was AddDataToReplica in 2.48 */ -{ - m_refcount = 1; - -#ifdef _DEBUG - //gRefCountValue++; -#endif - PyObjectPlus::ProcessReplica(); - - m_ValFlags.RefCountDisabled = false; - - /* copy all props */ - if (m_pNamedPropertyArray) - { - std::map *pOldArray = m_pNamedPropertyArray; - m_pNamedPropertyArray=NULL; - std::map::iterator it; - for (it= pOldArray->begin(); (it != pOldArray->end()); it++) - { - CValue *val = (*it).second->GetReplica(); - SetProperty((*it).first,val); - val->Release(); - } - } -} - -CValue* CValue::FindIdentifier(const STR_String& identifiername) -{ - - CValue* result = NULL; - - int pos = 0; - // if a dot exists, explode the name into pieces to get the subcontext - if ((pos=identifiername.Find('.'))>=0) - { - const STR_String rightstring = identifiername.Right(identifiername.Length() -1 - pos); - const STR_String leftstring = identifiername.Left(pos); - CValue* tempresult = GetProperty(leftstring); - if (tempresult) - { - result=tempresult->FindIdentifier(rightstring); - } - } else - { - result = GetProperty(identifiername); - if (result) - return result->AddRef(); - } - if (!result) - { - // warning here !!! - result = new CErrorValue(identifiername+" not found"); - } - return result; -} - -#ifndef DISABLE_PYTHON - -PyAttributeDef CValue::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("name", CValue, pyattr_get_name), - { NULL } //Sentinel -}; - -PyObject * CValue::pyattr_get_name(void * self_v, const KX_PYATTRIBUTE_DEF * attrdef) { - CValue * self = static_cast (self_v); - return PyUnicode_FromString(self->GetName()); -} - -CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix) -{ - - CValue* vallie = NULL; - /* refcounting is broking here! - this crashes anyway, just store a python list for KX_GameObject */ -#if 0 - if (PyList_Check(pyobj)) - { - CListValue* listval = new CListValue(); - bool error = false; - - int i; - int numitems = PyList_Size(pyobj); - for (i=0;iAdd(listitemval); - } else - { - error = true; - } - } - if (!error) - { - // jippie! could be converted - vallie = listval; - } else - { - // list could not be converted... bad luck - listval->Release(); - } - - } else -#endif - if (PyFloat_Check(pyobj)) - { - vallie = new CFloatValue( (float)PyFloat_AsDouble(pyobj) ); - } else - if (PyLong_Check(pyobj)) - { - vallie = new CIntValue( (cInt)PyLong_AsLongLong(pyobj) ); - } else - if (PyUnicode_Check(pyobj)) - { - vallie = new CStringValue(_PyUnicode_AsString(pyobj),""); - } else - if (PyObject_TypeCheck(pyobj, &CValue::Type)) /* Note, dont let these get assigned to GameObject props, must check elsewhere */ - { - vallie = (static_cast(BGE_PROXY_REF(pyobj)))->AddRef(); - } else - { - /* return an error value from the caller */ - PyErr_Format(PyExc_TypeError, "%scould convert python value to a game engine property", error_prefix); - } - return vallie; - -} - -PyObject* CValue::ConvertKeysToPython( void ) -{ - PyObject *pylist = PyList_New( 0 ); - PyObject *pystr; - - if (m_pNamedPropertyArray) - { - std::map::iterator it; - for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++) - { - pystr = PyUnicode_FromString( (*it).first ); - PyList_Append(pylist, pystr); - Py_DECREF( pystr ); - } - } - return pylist; -} - -#endif // DISABLE_PYTHON - - -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// -/* These implementations were moved out of the header */ - -void CValue::SetOwnerExpression(class CExpression* expr) -{ - /* intentionally empty */ -} - -void CValue::SetColorOperator(VALUE_OPERATOR op) -{ - /* intentionally empty */ -} -void CValue::SetValue(CValue* newval) -{ - // no one should get here - assertd(newval->GetNumber() == 10121969); -} diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h deleted file mode 100644 index f639ae5af78..00000000000 --- a/source/gameengine/Expressions/Value.h +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Value.h: interface for the CValue class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifdef WIN32 -#pragma warning (disable:4786) -#endif //WIN32 - -///////////////////////////////////////////////////////////////////////////////////// -//// Baseclass CValue -//// Together with CExpression, CValue and it's derived classes can be used to -//// parse expressions into a parsetree with error detecting/correcting capabilities -//// also expandible by a CFactory pluginsystem -//// -//// Features: -//// Reference Counting (AddRef() / Release()) -//// Calculations (Calc() / CalcFinal()) -//// Configuration (Configure()) -//// Serialization (EdSerialize() / EdIdSerialize() / EdPtrSerialize() and macro PLUGIN_DECLARE_SERIAL -//// Property system (SetProperty() / GetProperty() / FindIdentifier()) -//// Replication (GetReplica()) -//// Flags (IsSelected() / IsModified() / SetSelected()...) -//// -//// Some small editor-specific things added -//// A helperclass CompressorArchive handles the serialization -//// -///////////////////////////////////////////////////////////////////////////////////// -#ifndef __VALUE_H__ -#define __VALUE_H__ - -#include // array functionality for the propertylist -#include "STR_String.h" // STR_String class - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -#ifndef GEN_NO_ASSERT -#undef assert -#define assert(exp) ((void)NULL) -#endif - - -#ifndef GEN_NO_TRACE -#undef trace -#define trace(exp) ((void)NULL) -#endif - -#ifndef GEN_NO_DEBUG -#undef debug -#define debug(exp) ((void)NULL) -#endif - -#ifndef GEN_NO_ASSERTD -#undef assertd -#define assertd(exp) ((void)NULL) -#endif - - -#ifndef USE_PRAGMA_ONCE -#ifdef WIN32 - #pragma once - -#endif //WIN32 -#endif - -#define EDITOR_LEVEL_VERSION 0x06 - -enum VALUE_OPERATOR { - - VALUE_MOD_OPERATOR, // % - VALUE_ADD_OPERATOR, // + - VALUE_SUB_OPERATOR, // - - VALUE_MUL_OPERATOR, // * - VALUE_DIV_OPERATOR, // / - VALUE_NEG_OPERATOR, // - - VALUE_POS_OPERATOR, // + - VALUE_AND_OPERATOR, // && - VALUE_OR_OPERATOR, // || - VALUE_EQL_OPERATOR, // == - VALUE_NEQ_OPERATOR, // != - VALUE_GRE_OPERATOR, // > - VALUE_LES_OPERATOR, // < - VALUE_GEQ_OPERATOR, // >= - VALUE_LEQ_OPERATOR, // <= - VALUE_NOT_OPERATOR, // ! - VALUE_NO_OPERATOR // no operation at all -}; - -enum VALUE_DATA_TYPE { - VALUE_NO_TYPE, // abstract baseclass - VALUE_INT_TYPE, - VALUE_FLOAT_TYPE, - VALUE_STRING_TYPE, - VALUE_BOOL_TYPE, - VALUE_ERROR_TYPE, - VALUE_EMPTY_TYPE, - VALUE_SOLID_TYPE, - VALUE_COMBISOLID_TYPE, - VALUE_VECTOR_TYPE, - VALUE_MENU_TYPE, - VALUE_ACTOR_TYPE, - VALUE_MAX_TYPE //only here to provide number of types -}; - - - -#ifdef _DEBUG -//extern int gRefCountValue; // debugonly variable to check if all CValue Refences are Dereferenced at programexit -#endif - -struct HashableInt -{ - HashableInt(int id) : mData(id) { } - - unsigned long Hash() const { return 0;} ////}gHash(&mData, sizeof(int));} - - bool operator==(HashableInt rhs) { return mData == rhs.mData; } - - int mData; -}; - - -// -// Bitfield that stores the flags for each CValue derived class -// -struct ValueFlags { - ValueFlags() : - Modified(true), - Selected(false), - Affected(false), - ReleaseRequested(false), - Error(false), - RefCountDisabled(false), - HasProperties(false), - HasName(false), - Visible(true), - CustomFlag1(false), - CustomFlag2(false) - { - } - - unsigned short Modified : 1; - unsigned short Selected : 1; - unsigned short Affected : 1; - unsigned short ReleaseRequested : 1; - unsigned short Error : 1; - unsigned short RefCountDisabled : 1; - unsigned short HasProperties : 1; - unsigned short HasName : 1; - unsigned short Visible : 1; - unsigned short CustomFlag1 : 1; - unsigned short CustomFlag2 : 1; - - -}; - -/** - * Base Class for all Actions performed on CValue's. Can be extended for undo/redo system in future. -*/ -class CAction -{ -public: - CAction() { - }; - virtual ~CAction(){ - }; - virtual void Execute() const =0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CAction"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -// -// CValue -// -// Base class for all editor functionality, flexible object type that allows -// calculations and uses reference counting for memory management. -// -// - - - - -#include "PyObjectPlus.h" -#ifndef DISABLE_PYTHON -#include "object.h" -#endif -class CValue : public PyObjectPlus - -{ -Py_Header; -public: - enum AllocationTYPE { - STACKVALUE = 0, - HEAPVALUE = 1 - }; - - enum DrawTYPE { - STARTFRAME = 0, - ENDFRAME = 1, - INTERFRAME = 2 - }; - - - // Construction / Destruction - CValue(); - -#ifndef DISABLE_PYTHON - //static PyObject* PyMake(PyObject*,PyObject*); - virtual PyObject *py_repr(void) - { - return PyUnicode_FromString((const char*)GetText()); - } - - virtual PyObject* ConvertValueToPython() { - return NULL; - } - - virtual CValue* ConvertPythonToValue(PyObject* pyobj, const char *error_prefix); - - static PyObject * pyattr_get_name(void * self, const KX_PYATTRIBUTE_DEF * attrdef); - - virtual PyObject* ConvertKeysToPython( void ); -#endif // DISABLE_PYTHON - - - - // Expression Calculation - virtual CValue* Calc(VALUE_OPERATOR op, CValue *val) = 0; - virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) = 0; - virtual void SetOwnerExpression(class CExpression* expr); - - - - void Execute(const CAction& a) - { - a.Execute(); - }; - - /// Reference Counting - int GetRefCount() - { - return m_refcount; - } - - // Add a reference to this value - CValue* AddRef() - { - // Increase global reference count, used to see at the end of the program - // if all CValue-derived classes have been dereferenced to 0 - //debug(gRefCountValue++); - #ifdef _DEBUG - //gRefCountValue++; - #endif - m_refcount++; - return this; - } - - // Release a reference to this value (when reference count reaches 0, the value is removed from the heap) - int Release() - { - // Decrease global reference count, used to see at the end of the program - // if all CValue-derived classes have been dereferenced to 0 - //debug(gRefCountValue--); - #ifdef _DEBUG - //gRefCountValue--; - #endif - // Decrease local reference count, if it reaches 0 the object should be freed - if (--m_refcount > 0) - { - // Reference count normal, return new reference count - return m_refcount; - } - else - { - // Reference count reached 0, delete ourselves and return 0 - // MT_assert(m_refcount==0, "Reference count reached sub-zero, object released too much"); - - delete this; - return 0; - } - } - - - /// Property Management - virtual void SetProperty(const STR_String& name,CValue* ioProperty); // Set property , overwrites and releases a previous property with the same name if needed - virtual void SetProperty(const char* name,CValue* ioProperty); - virtual CValue* GetProperty(const char* inName); // Get pointer to a property with name , returns NULL if there is no property named - virtual CValue* GetProperty(const STR_String & inName); - const STR_String& GetPropertyText(const STR_String & inName); // Get text description of property with name , returns an empty string if there is no property named - float GetPropertyNumber(const STR_String& inName,float defnumber); - virtual bool RemoveProperty(const char *inName); // Remove the property named , returns true if the property was succesfully removed, false if property was not found or could not be removed - virtual vector GetPropertyNames(); - virtual void ClearProperties(); // Clear all properties - - virtual void SetPropertiesModified(bool inModified); // Set all properties' modified flag to - virtual bool IsAnyPropertyModified(); // Check if any of the properties in this value have been modified - - virtual CValue* GetProperty(int inIndex); // Get property number - virtual int GetPropertyCount(); // Get the amount of properties assiocated with this value - - virtual CValue* FindIdentifier(const STR_String& identifiername); - /** Set the wireframe color of this value depending on the CSG - * operator type - * @attention: not implemented */ - virtual void SetColorOperator(VALUE_OPERATOR op); - - virtual const STR_String & GetText() = 0; - virtual double GetNumber() = 0; - double* ZeroVector() { return m_sZeroVec; }; - virtual double* GetVector3(bool bGetTransformedVec = false); - - virtual STR_String& GetName() = 0; // Retrieve the name of the value - virtual void SetName(const char *name) = 0; // Set the name of the value - /** Sets the value to this cvalue. - * @attention this particular function should never be called. Why not abstract? */ - virtual void SetValue(CValue* newval); - virtual CValue* GetReplica() =0; - virtual void ProcessReplica(); - //virtual CValue* Copy() = 0; - - - STR_String op2str(VALUE_OPERATOR op); - - // setting / getting flags - inline void SetSelected(bool bSelected) { m_ValFlags.Selected = bSelected; } - virtual void SetModified(bool bModified) { m_ValFlags.Modified = bModified; } - virtual void SetAffected(bool bAffected=true) { m_ValFlags.Affected = bAffected; } - inline void SetReleaseRequested(bool bReleaseRequested) { m_ValFlags.ReleaseRequested=bReleaseRequested; } - inline void SetError(bool err) { m_ValFlags.Error=err; } - inline void SetVisible (bool vis) { m_ValFlags.Visible=vis; } - - virtual bool IsModified() { return m_ValFlags.Modified; } - inline bool IsError() { return m_ValFlags.Error; } - virtual bool IsAffected() { return m_ValFlags.Affected || m_ValFlags.Modified; } - virtual bool IsSelected() { return m_ValFlags.Selected; } - inline bool IsReleaseRequested() { return m_ValFlags.ReleaseRequested; } - virtual bool IsVisible() { return m_ValFlags.Visible;} - virtual void SetCustomFlag1(bool bCustomFlag) { m_ValFlags.CustomFlag1 = bCustomFlag;}; - virtual bool IsCustomFlag1() { return m_ValFlags.CustomFlag1;}; - - virtual void SetCustomFlag2(bool bCustomFlag) { m_ValFlags.CustomFlag2 = bCustomFlag;}; - virtual bool IsCustomFlag2() { return m_ValFlags.CustomFlag2;}; - -protected: - virtual void DisableRefCount(); // Disable reference counting for this value - //virtual void AddDataToReplica(CValue* replica); - virtual ~CValue(); -private: - // Member variables - std::map* m_pNamedPropertyArray; // Properties for user/game etc - ValueFlags m_ValFlags; // Frequently used flags in a bitfield (low memoryusage) - int m_refcount; // Reference Counter - static double m_sZeroVec[3]; - -}; - - - -// -// Declare a CValue or CExpression or CWhatever to be serialized by the editor. -// -// This macro introduces the EdSerialize() function (which must be implemented by -// the client) and the EdIdSerialize() function (which is implemented by this macro). -// -// The generated Copy() function returns a pointer to type -// of object. So, for *any* CValue-derived object this should be set to CValue, -// for *any* CExpression-derived object this should be set to CExpression. -// -#define PLUGIN_DECLARE_SERIAL(class_name, root_base_class_name) \ -public: \ - virtual root_base_class_name * Copy() { return new class_name; } \ - virtual bool EdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring); \ - virtual bool EdIdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring) \ -{ \ - if (bIsStoring) \ - arch.StoreString(#class_name); \ - \ - return false; \ -} \ - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - -// CPropValue is a CValue derived class, that implements the identification (String name) -// SetName() / GetName(), -// normal classes should derive from CPropValue, real lightweight classes straight from CValue - - -class CPropValue : public CValue -{ -public: - CPropValue() : - CValue(), - m_strNewName() - - { - } - - virtual ~CPropValue() - { - } - - virtual void SetName(const char *name) { - m_strNewName = name; - } - - virtual STR_String& GetName() { - //STR_String namefromprop = GetPropertyText("Name"); - //if (namefromprop.Length() > 0) - // return namefromprop; - return m_strNewName; - }; // name of Value - -protected: - STR_String m_strNewName; // Identification - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CPropValue"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined _VALUEBASECLASS_H - diff --git a/source/gameengine/Expressions/VectorValue.cpp b/source/gameengine/Expressions/VectorValue.cpp deleted file mode 100644 index 59ff601746f..00000000000 --- a/source/gameengine/Expressions/VectorValue.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// VectorValue.cpp: implementation of the CVectorValue class. -/* - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifdef WIN32 -#pragma warning (disable:4786) -#endif - -#include "Value.h" -#include "VectorValue.h" -#include "ErrorValue.h" -//#include "MatrixValue.h" -#include "VoidValue.h" -#include "StringValue.h" -//#include "FactoryManager.h" - - - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CVectorValue::CVectorValue(float x,float y,float z, AllocationTYPE alloctype) -{ - SetCustomFlag1(false);//FancyOutput=false; - - if (alloctype == STACKVALUE) - { - CValue::DisableRefCount(); - }; - - m_vec[KX_X] = m_transformedvec[KX_X] = x; - m_vec[KX_Y] = m_transformedvec[KX_Y] = y; - m_vec[KX_Z] = m_transformedvec[KX_Z] = z; - -} -CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctype) { - - SetCustomFlag1(false);//FancyOutput=false; - - m_vec[KX_X] = m_transformedvec[KX_X] = vec[KX_X]; - m_vec[KX_Y] = m_transformedvec[KX_Y] = vec[KX_Y]; - m_vec[KX_Z] = m_transformedvec[KX_Z] = vec[KX_Z]; - - if (alloctype == STACKVALUE) - { - CValue::DisableRefCount(); - - } - - SetName(name); -} - -CVectorValue::CVectorValue(double vec[],AllocationTYPE alloctype) { - - SetCustomFlag1(false);//FancyOutput=false; - - m_vec[KX_X] = m_transformedvec[KX_X] = vec[KX_X]; - m_vec[KX_Y] = m_transformedvec[KX_Y] = vec[KX_Y]; - m_vec[KX_Z] = m_transformedvec[KX_Z] = vec[KX_Z]; - - if (alloctype == STACKVALUE) - { - CValue::DisableRefCount(); - - } - - -} -CVectorValue::~CVectorValue() -{ - -} - -CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) -/* -pre: the type of val is dtype -ret: a new object containing the result of applying operator op to val and -this object -*/ -{ - CValue *ret = NULL; - - switch(op) - { - case VALUE_ADD_OPERATOR: - { - switch (dtype) - { - case VALUE_EMPTY_TYPE: - case VALUE_VECTOR_TYPE: - { - ret = new CVectorValue( - val->GetVector3()[KX_X] + GetVector3()[KX_X], - val->GetVector3()[KX_Y] + GetVector3()[KX_Y], - val->GetVector3()[KX_Z] + GetVector3()[KX_Z], - CValue::HEAPVALUE); - ret->SetName(GetName()); - break; - } - - default: - ret = new CErrorValue(val->GetText() + op2str(op) + GetText()); - } - break; - } - case VALUE_MUL_OPERATOR: - { - switch (dtype) - { - - case VALUE_EMPTY_TYPE: - case VALUE_VECTOR_TYPE: - { - //MT_Vector3 supports 'scaling' by another vector, instead of using general transform, Gino? - //ret = new CVectorValue(val->GetVector3().Scaled(GetVector3()),GetName()); - break; - } - case VALUE_FLOAT_TYPE: - { - ret = new CVectorValue( - val->GetVector3()[KX_X] * GetVector3()[KX_X], - val->GetVector3()[KX_Y] * GetVector3()[KX_Y], - val->GetVector3()[KX_Z] * GetVector3()[KX_Z], - CValue::HEAPVALUE); - ret->SetName(GetName()); - break; - } - - default: - ret = new CErrorValue(val->GetText() + op2str(op) + GetText()); - } - break; - - } - - default: - ret = new CErrorValue(val->GetText() + op2str(op) + GetText()); - } - - - return ret; -} - -double CVectorValue::GetNumber() -{ - return m_vec[KX_X]; -} - - -double* CVectorValue::GetVector3(bool bGetTransformedVec) -{ - if (bGetTransformedVec) - return m_transformedvec; - // else - return m_vec; -} - - - - - -void CVectorValue::SetVector(double newvec[]) -{ - m_vec[KX_X] = m_transformedvec[KX_X] = newvec[KX_X]; - m_vec[KX_Y] = m_transformedvec[KX_Y] = newvec[KX_Y]; - m_vec[KX_Z] = m_transformedvec[KX_Z] = newvec[KX_Z]; - - SetModified(true); -} - - -void CVectorValue::SetValue(CValue *newval) -{ - - double* newvec = ((CVectorValue*)newval)->GetVector3(); - m_vec[KX_X] = m_transformedvec[KX_X] = newvec[KX_X]; - m_vec[KX_Y] = m_transformedvec[KX_Y] = newvec[KX_Y]; - m_vec[KX_Z] = m_transformedvec[KX_Z] = newvec[KX_Z]; - - SetModified(true); -} - -static const STR_String gstrVectorStr=STR_String(); -const STR_String & CVectorValue::GetText() -{ - assertd(false); - return gstrVectorStr; -} - -CValue* CVectorValue::GetReplica() { - CVectorValue* replica = new CVectorValue(*this); - replica->ProcessReplica(); - return replica; -}; - -/*void CVectorValue::Transform(rcMatrix4x4 mat) -{ - m_transformedvec = mat*m_vec; -} -*/ - - diff --git a/source/gameengine/Expressions/VectorValue.h b/source/gameengine/Expressions/VectorValue.h deleted file mode 100644 index 49fb1e7ea08..00000000000 --- a/source/gameengine/Expressions/VectorValue.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * VectorValue.h: interface for the CVectorValue class. - * $Id$ - * Copyright (c) 1996-2000 Erwin Coumans - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Erwin Coumans makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ -#if !defined _VECTORVALUE_H -#define _VECTORVALUE_H - -#include "Value.h" - -#define KX_X 0 -#define KX_Y 1 -#define KX_Z 2 - - -class CVectorValue : public CPropValue -{ - //PLUGIN_DECLARE_SERIAL(CVectorValue,CValue) - -public: - //void Transform(rcMatrix4x4 mat); - virtual void SetValue(CValue* newval); - void SetVector(double newvec[]); - void Configure(CValue* menuvalue); - virtual double* GetVector3(bool bGetTransformedVec=false); - virtual double GetNumber(); - - CValue* Calc(VALUE_OPERATOR op, CValue *val) { - return val->CalcFinal(VALUE_VECTOR_TYPE, op, this); - } - - CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - - - CVectorValue(double vec[],const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE); - CVectorValue() {}; - - CVectorValue(double vec[],AllocationTYPE alloctype=CValue::HEAPVALUE); - CVectorValue(float x,float y,float z, AllocationTYPE alloctype = CValue::HEAPVALUE); - virtual ~CVectorValue(); - //virtual bool ExportT3D(File *txtfile,bool bNoName=false); - void AddConfigurationData(CValue* menuvalue); - - - - virtual CValue* GetReplica(); - virtual const STR_String & GetText(); - -/* - void SnapPoint(float num,int snap) - { - if (num > 0) num += ((float)snap / 2); - else num -= ((float)snap / 2); - num = (long)(((long)(num / snap)) * snap); - }; - - void SnapPosition(const double snapvec[]) - { - - if (snapvec[KX_X] >= 1) - SnapPoint(m_vec[KX_X],snapvec[KX_X]); - if (snapvec[KX_Y] >= 1) - SnapPoint(m_vec[KX_Y],snapvec[KX_Y]); - if (snapvec[KX_Z] >= 1) - SnapPoint(m_vec[KX_Z],snapvec[KX_Z]); - - } -*/ - -protected: - double m_vec[3]; - double m_transformedvec[3]; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CVectorValue"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined _VECTORVALUE_H - diff --git a/source/gameengine/Expressions/VoidValue.h b/source/gameengine/Expressions/VoidValue.h deleted file mode 100644 index 5281fb4f8a3..00000000000 --- a/source/gameengine/Expressions/VoidValue.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * VoidValue.h: interface for the CVoidValue class. - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __VOIDVALUE_H__ -#define __VOIDVALUE_H__ - -#include "Value.h" - -// -// Void value, used to transport *any* type of data -// -class CVoidValue : public CPropValue -{ - //PLUGIN_DECLARE_SERIAL (CVoidValue,CValue) - -public: - /// Construction/destruction - CVoidValue() : m_bDeleteOnDestruct(false), m_pAnything(NULL) { } - CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype) : m_bDeleteOnDestruct(bDeleteOnDestruct), m_pAnything(voidptr) { if (alloctype == STACKVALUE) CValue::DisableRefCount(); } - virtual ~CVoidValue(); // Destruct void value, delete memory if we're owning it - - /// Value -> String or number - virtual const STR_String & GetText(); // Get string description of void value (unimplemented) - virtual double GetNumber() { return -1; } - - /// Value calculation - virtual CValue* Calc(VALUE_OPERATOR op, CValue *val); - virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue* val); - - /// Value replication - virtual CValue* GetReplica(); - - /// Data members - bool m_bDeleteOnDestruct; - void* m_pAnything; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CVoidValue"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // !defined _VOIDVALUE_H - diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt deleted file mode 100644 index 3ffba14ec95..00000000000 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -FILE(GLOB SRC *.cpp Joystick/*.cpp) - -SET(INC - . - ../../../source/kernel/gen_system - ../../../intern/string - ../../../source/gameengine/Expressions - ../../../source/gameengine/SceneGraph - ../../../intern/moto/include - ../../../source/gameengine/Rasterizer -) - -IF(WITH_SDL) - SET(INC ${INC} ${SDL_INCLUDE_DIR}) -ELSE(WITH_SDL) - ADD_DEFINITIONS(-DDISABLE_SDL) -ENDIF(WITH_SDL) - -IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) -ELSE(WITH_PYTHON) - ADD_DEFINITIONS(-DDISABLE_PYTHON) -ENDIF(WITH_PYTHON) - -BLENDERLIB(bf_logic "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_logic', sources, Split(incs), [], libtype=['game','player'], priority=[30, 110] ) diff --git a/source/gameengine/GameLogic/Joystick/Makefile b/source/gameengine/GameLogic/Joystick/Makefile deleted file mode 100644 index 02def1cec62..00000000000 --- a/source/gameengine/GameLogic/Joystick/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = Joystick -DIR = $(OCGDIR)/gameengine/logic/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I../Expressions -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) -CPPFLAGS += $(NAN_SDLCFLAGS) -CPPFLAGS += -I../../SceneGraph -CPPFLAGS += -I../../../kernel/gen_system diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp deleted file mode 100644 index c58c28f7dc9..00000000000 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): snailrose. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef DISABLE_SDL -#include -#endif - -#include -#include - -#include "SCA_Joystick.h" -#include "SCA_JoystickPrivate.h" - -SCA_Joystick::SCA_Joystick(short int index) - : - m_joyindex(index), - m_prec(3200), - m_axismax(-1), - m_buttonmax(-1), - m_hatmax(-1), - m_isinit(0), - m_istrig_axis(0), - m_istrig_button(0), - m_istrig_hat(0) -{ - for(int i=0; i= JOYINDEX_MAX) { - echo("Error-invalid joystick index: " << joyindex); - return NULL; - } - - if (m_refCount == 0) - { - int i; - // do this once only - if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO ) == -1 ){ - echo("Error-Initializing-SDL: " << SDL_GetError()); - return NULL; - } - - m_joynum = SDL_NumJoysticks(); - - for (i=0; iCreateJoystickDevice(); - } - m_refCount = 1; - } - else - { - m_refCount++; - } - return m_instance[joyindex]; -#endif -} - -void SCA_Joystick::ReleaseInstance() -{ - if (--m_refCount == 0) - { -#ifndef DISABLE_SDL - int i; - for (i=0; iDestroyJoystickDevice(); - delete m_instance[i]; - } - m_instance[i]= NULL; - } - - SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO ); -#endif - } -} - -void SCA_Joystick::cSetPrecision(int val) -{ - m_prec = val; -} - - -bool SCA_Joystick::aAxisPairIsPositive(int axis) -{ - return (pAxisTest(axis) > m_prec) ? true:false; -} - -bool SCA_Joystick::aAxisPairDirectionIsPositive(int axis, int dir) -{ - - int res; - - if (dir==JOYAXIS_UP || dir==JOYAXIS_DOWN) - res = pGetAxis(axis, 1); - else /* JOYAXIS_LEFT || JOYAXIS_RIGHT */ - res = pGetAxis(axis, 0); - - if (dir==JOYAXIS_DOWN || dir==JOYAXIS_RIGHT) - return (res > m_prec) ? true : false; - else /* JOYAXIS_UP || JOYAXIS_LEFT */ - return (res < -m_prec) ? true : false; -} - -bool SCA_Joystick::aAxisIsPositive(int axis_single) -{ - return abs(m_axis_array[axis_single]) > m_prec ? true:false; -} - -bool SCA_Joystick::aAnyButtonPressIsPositive(void) -{ -#ifndef DISABLE_SDL - /* this is needed for the "all events" option - * so we know if there are no buttons pressed */ - for (int i=0; im_joystick, i)) - return true; -#endif - return false; -} - -bool SCA_Joystick::aButtonPressIsPositive(int button) -{ -#ifdef DISABLE_SDL - return false; -#else - bool result; - SDL_JoystickGetButton(m_private->m_joystick, button)? result = true:result = false; - return result; -#endif -} - - -bool SCA_Joystick::aButtonReleaseIsPositive(int button) -{ -#ifdef DISABLE_SDL - return false; -#else - bool result; - SDL_JoystickGetButton(m_private->m_joystick, button)? result = false : result = true; - return result; -#endif -} - - -bool SCA_Joystick::aHatIsPositive(int hatnum, int dir) -{ - return (GetHat(hatnum)==dir) ? true : false; -} - -int SCA_Joystick::GetNumberOfAxes() -{ - return m_axismax; -} - - -int SCA_Joystick::GetNumberOfButtons() -{ - return m_buttonmax; -} - - -int SCA_Joystick::GetNumberOfHats() -{ - return m_hatmax; -} - -bool SCA_Joystick::CreateJoystickDevice(void) -{ -#ifdef DISABLE_SDL - m_isinit = true; - m_axismax = m_buttonmax = m_hatmax = 0; - return false; -#else - if(m_isinit == false){ - if (m_joyindex>=m_joynum) { - // don't print a message, because this is done anyway - //echo("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)"); - - // Need this so python args can return empty lists - m_axismax = m_buttonmax = m_hatmax = 0; - return false; - } - - m_private->m_joystick = SDL_JoystickOpen(m_joyindex); - SDL_JoystickEventState(SDL_ENABLE); - m_isinit = true; - - echo("Joystick " << m_joyindex << " initialized"); - - /* must run after being initialized */ - m_axismax = SDL_JoystickNumAxes(m_private->m_joystick); - m_buttonmax = SDL_JoystickNumButtons(m_private->m_joystick); - m_hatmax = SDL_JoystickNumHats(m_private->m_joystick); - - if (m_axismax > JOYAXIS_MAX) m_axismax= JOYAXIS_MAX; /* very unlikely */ - else if (m_axismax < 0) m_axismax = 0; - - if (m_hatmax > JOYHAT_MAX) m_hatmax= JOYHAT_MAX; /* very unlikely */ - else if(m_hatmax<0) m_hatmax= 0; - - if(m_buttonmax<0) m_buttonmax= 0; - - } - return true; -#endif -} - - -void SCA_Joystick::DestroyJoystickDevice(void) -{ -#ifndef DISABLE_SDL - if (m_isinit){ - if(SDL_JoystickOpened(m_joyindex)){ - echo("Closing-joystick " << m_joyindex); - SDL_JoystickClose(m_private->m_joystick); - } - m_isinit = false; - } -#endif -} - -int SCA_Joystick::Connected(void) -{ -#ifndef DISABLE_SDL - if (m_isinit && SDL_JoystickOpened(m_joyindex)) - return 1; -#endif - return 0; -} - -int SCA_Joystick::pGetAxis(int axisnum, int udlr) -{ -#ifndef DISABLE_SDL - return m_axis_array[(axisnum*2)+udlr]; -#endif - return 0; -} - -int SCA_Joystick::pAxisTest(int axisnum) -{ -#ifndef DISABLE_SDL - short i1= m_axis_array[(axisnum*2)]; - short i2= m_axis_array[(axisnum*2)+1]; - - /* long winded way to do - * return MAX2(abs(i1), abs(i2)) - * avoid abs from math.h */ - if (i1 < 0) i1 = -i1; - if (i2 < 0) i2 = -i2; - if (i1 -#define echo(x) std::cout << x << std::endl; -#endif - -#define JOYINDEX_MAX 8 -#define JOYAXIS_MAX 16 -#define JOYBUT_MAX 18 -#define JOYHAT_MAX 4 - -#define JOYAXIS_RIGHT 0 -#define JOYAXIS_UP 1 -#define JOYAXIS_DOWN 3 -#define JOYAXIS_LEFT 2 - -#endif diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp deleted file mode 100644 index 17cf242bf5c..00000000000 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): snailrose. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef DISABLE_SDL -#include -#endif - -#include "SCA_Joystick.h" -#include "SCA_JoystickPrivate.h" - - -#ifndef DISABLE_SDL -void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event) -{ - if(sdl_event->jaxis.axis >= JOYAXIS_MAX) - return; - - m_axis_array[sdl_event->jaxis.axis]= sdl_event->jaxis.value; - m_istrig_axis = 1; -} - -/* See notes below in the event loop */ -void SCA_Joystick::OnHatMotion(SDL_Event* sdl_event) -{ - if(sdl_event->jhat.hat >= JOYHAT_MAX) - return; - - m_hat_array[sdl_event->jhat.hat]= sdl_event->jhat.value; - m_istrig_hat = 1; -} - -/* See notes below in the event loop */ -void SCA_Joystick::OnButtonUp(SDL_Event* sdl_event) -{ - m_istrig_button = 1; -} - - -void SCA_Joystick::OnButtonDown(SDL_Event* sdl_event) -{ - //if(sdl_event->jbutton.button > m_buttonmax) /* unsigned int so always above 0 */ - // return; - // sdl_event->jbutton.button; - - m_istrig_button = 1; -} - - -void SCA_Joystick::OnNothing(SDL_Event* sdl_event) -{ - m_istrig_axis = m_istrig_button = m_istrig_hat = 0; -} - -void SCA_Joystick::HandleEvents(void) -{ - SDL_Event sdl_event; - - int i; - for (i=0; iOnNothing(&sdl_event); - } - - while(SDL_PollEvent(&sdl_event)) - { - /* Note! m_instance[sdl_event.jaxis.which] - * will segfault if over JOYINDEX_MAX, not too nice but what are the chances? */ - - /* Note!, with buttons, this wont care which button is pressed, - * only to set 'm_istrig_button', actual pressed buttons are detected by SDL_JoystickGetButton */ - - /* Note!, if you manage to press and release a button within 1 logic tick - * it wont work as it should */ - - switch(sdl_event.type) - { - case SDL_JOYAXISMOTION: - SCA_Joystick::m_instance[sdl_event.jaxis.which]->OnAxisMotion(&sdl_event); - break; - case SDL_JOYHATMOTION: - SCA_Joystick::m_instance[sdl_event.jhat.which]->OnHatMotion(&sdl_event); - break; - case SDL_JOYBUTTONUP: - SCA_Joystick::m_instance[sdl_event.jbutton.which]->OnButtonUp(&sdl_event); - break; - case SDL_JOYBUTTONDOWN: - SCA_Joystick::m_instance[sdl_event.jbutton.which]->OnButtonDown(&sdl_event); - break; -#if 0 /* Not used yet */ - case SDL_JOYBALLMOTION: - SCA_Joystick::m_instance[sdl_event.jball.which]->OnBallMotion(&sdl_event); - break; -#endif - default: - printf("SCA_Joystick::HandleEvents, Unknown SDL event, this should not happen\n"); - break; - } - } -} -#endif diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h deleted file mode 100644 index 4e7f6f73413..00000000000 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): snailrose. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __SCA_JOYSTICKPRIVATE_H__ -#define __SCA_JOYSTICKPRIVATE_H__ -#include "SCA_Joystick.h" - -#ifndef DISABLE_SDL -class SCA_Joystick::PrivateData -{ -public: - /* - * The Joystick - */ - SDL_Joystick* m_joystick; - - PrivateData() - : m_joystick(NULL) - { - } -}; -#endif - -#endif diff --git a/source/gameengine/GameLogic/Makefile b/source/gameengine/GameLogic/Makefile deleted file mode 100644 index ba1e1c25ee7..00000000000 --- a/source/gameengine/GameLogic/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = logic -SOURCEDIR = source/gameengine/gameengine/GameLogic -DIR = $(OCGDIR)/gameengine/$(LIBNAME) -DIRS = Joystick - -include nan_subdirs.mk -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I../Expressions -CPPFLAGS += -I../SceneGraph -CPPFLAGS += -I../Rasterizer -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I../../blender/makesdna -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) -CPPFLAGS += $(NAN_SDLCFLAGS) - -CPPFLAGS += -I../../kernel/gen_system diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp deleted file mode 100644 index f6d24af0e67..00000000000 --- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/** - * SCA_2DFilterActuator.cpp - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_IActuator.h" -#include "SCA_2DFilterActuator.h" - -#include - -SCA_2DFilterActuator::~SCA_2DFilterActuator() -{ -} - -SCA_2DFilterActuator::SCA_2DFilterActuator( - SCA_IObject *gameobj, - RAS_2DFilterManager::RAS_2DFILTER_MODE type, - short flag, - float float_arg, - int int_arg, - RAS_IRasterizer* rasterizer, - SCA_IScene* scene) - : SCA_IActuator(gameobj, KX_ACT_2DFILTER), - m_type(type), - m_disableMotionBlur(flag), - m_float_arg(float_arg), - m_int_arg(int_arg), - m_rasterizer(rasterizer), - m_scene(scene) -{ - m_gameObj = NULL; - if(gameobj){ - m_propNames = gameobj->GetPropertyNames(); - m_gameObj = gameobj; - } -} - - -CValue* SCA_2DFilterActuator::GetReplica() -{ - SCA_2DFilterActuator* replica = new SCA_2DFilterActuator(*this); - replica->ProcessReplica(); - return replica; -} - - -bool SCA_2DFilterActuator::Update() -{ - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - - if (bNegativeEvent) - return false; // do nothing on negative events - - if( m_type == RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR ) - { - if(!m_disableMotionBlur) - m_rasterizer->EnableMotionBlur(m_float_arg); - else - m_rasterizer->DisableMotionBlur(); - - return false; - } - else if(m_type < RAS_2DFilterManager::RAS_2DFILTER_NUMBER_OF_FILTERS) - { - m_scene->Update2DFilter(m_propNames, m_gameObj, m_type, m_int_arg, m_shaderText); - } - // once the filter is in place, no need to update it again => disable the actuator - return false; -} - - -void SCA_2DFilterActuator::SetShaderText(const char *text) -{ - m_shaderText = text; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_2DFilterActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_2DFilterActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_2DFilterActuator::Methods[] = { - /* add python functions to deal with m_msg... */ - {NULL,NULL} -}; - -PyAttributeDef SCA_2DFilterActuator::Attributes[] = { - KX_PYATTRIBUTE_STRING_RW("shaderText", 0, 64000, false, SCA_2DFilterActuator, m_shaderText), - KX_PYATTRIBUTE_SHORT_RW("disableMotionBlur", 0, 1, true, SCA_2DFilterActuator, m_disableMotionBlur), - KX_PYATTRIBUTE_ENUM_RW("mode",RAS_2DFilterManager::RAS_2DFILTER_ENABLED,RAS_2DFilterManager::RAS_2DFILTER_NUMBER_OF_FILTERS,false,SCA_2DFilterActuator,m_type), - KX_PYATTRIBUTE_INT_RW("passNumber", 0, 100, true, SCA_2DFilterActuator, m_int_arg), - KX_PYATTRIBUTE_FLOAT_RW("value", 0.0, 100.0, SCA_2DFilterActuator, m_float_arg), - { NULL } //Sentinel -}; - -#endif diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.h b/source/gameengine/GameLogic/SCA_2DFilterActuator.h deleted file mode 100644 index 034b10763ce..00000000000 --- a/source/gameengine/GameLogic/SCA_2DFilterActuator.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * SCA_2DFilterActuator.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __SCA_2DFILETRACTUATOR_H__ -#define __SCA_2DFILETRACTUATOR_H__ - -#include "RAS_IRasterizer.h" -#include "SCA_IActuator.h" -#include "SCA_IScene.h" - -class SCA_2DFilterActuator : public SCA_IActuator -{ - Py_Header; - -private: - vector m_propNames; - void * m_gameObj; - RAS_2DFilterManager::RAS_2DFILTER_MODE m_type; - short m_disableMotionBlur; - float m_float_arg; - int m_int_arg; - STR_String m_shaderText; - RAS_IRasterizer* m_rasterizer; - SCA_IScene* m_scene; - -public: - - SCA_2DFilterActuator( - class SCA_IObject* gameobj, - RAS_2DFilterManager::RAS_2DFILTER_MODE type, - short flag, - float float_arg, - int int_arg, - RAS_IRasterizer* rasterizer, - SCA_IScene* scene); - - void SetShaderText(const char *text); - virtual ~SCA_2DFilterActuator(); - virtual bool Update(); - - virtual CValue* GetReplica(); -}; -#endif diff --git a/source/gameengine/GameLogic/SCA_ANDController.cpp b/source/gameengine/GameLogic/SCA_ANDController.cpp deleted file mode 100644 index 53c9be5215e..00000000000 --- a/source/gameengine/GameLogic/SCA_ANDController.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/** - * 'And' together all inputs - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_ANDController.h" -#include "SCA_ISensor.h" -#include "SCA_LogicManager.h" -#include "BoolValue.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_ANDController::SCA_ANDController(SCA_IObject* gameobj) - : - SCA_IController(gameobj) -{ -} - - - -SCA_ANDController::~SCA_ANDController() -{ -} - - - -void SCA_ANDController::Trigger(SCA_LogicManager* logicmgr) -{ - - bool sensorresult = true; - - for (vector::const_iterator is=m_linkedsensors.begin(); - !(is==m_linkedsensors.end());is++) - { - SCA_ISensor* sensor = *is; - if (!sensor->GetState()) - { - sensorresult = false; - break; - } - } - - for (vector::const_iterator i=m_linkedactuators.begin(); - !(i==m_linkedactuators.end());i++) - { - SCA_IActuator* actua = *i; - logicmgr->AddActiveActuator(actua,sensorresult); - } -} - - - -CValue* SCA_ANDController::GetReplica() -{ - CValue* replica = new SCA_ANDController(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_ANDController::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_ANDController", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IController::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_ANDController::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_ANDController::Attributes[] = { - { NULL } //Sentinel -}; -#endif // DISABLE_PYTHON -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_ANDController.h b/source/gameengine/GameLogic/SCA_ANDController.h deleted file mode 100644 index a511a438c2f..00000000000 --- a/source/gameengine/GameLogic/SCA_ANDController.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * SCA_ANDController.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_ANDCONTROLLER -#define __KX_ANDCONTROLLER - -#include "SCA_IController.h" - -class SCA_ANDController : public SCA_IController -{ - Py_Header; - //virtual void Trigger(class SCA_LogicManager* logicmgr); -public: - SCA_ANDController(SCA_IObject* gameobj); - virtual ~SCA_ANDController(); - virtual CValue* GetReplica(); - virtual void Trigger(SCA_LogicManager* logicmgr); -}; - -#endif //__KX_ANDCONTROLLER - diff --git a/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp b/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp deleted file mode 100644 index 9a6ed25a203..00000000000 --- a/source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_ISensor.h" -#include "SCA_ActuatorEventManager.h" -#include "SCA_ActuatorSensor.h" - - -SCA_ActuatorEventManager::SCA_ActuatorEventManager(class SCA_LogicManager* logicmgr) - : SCA_EventManager(logicmgr, ACTUATOR_EVENTMGR) -{ -} - - - -SCA_ActuatorEventManager::~SCA_ActuatorEventManager() -{ - -} - -void SCA_ActuatorEventManager::NextFrame() -{ - // check for changed actuator - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - (*it)->Activate(m_logicmgr); - } -} - -void SCA_ActuatorEventManager::UpdateFrame() -{ - // update the state of actuator before executing them - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - (*it)->Update(); - } -} \ No newline at end of file diff --git a/source/gameengine/GameLogic/SCA_ActuatorEventManager.h b/source/gameengine/GameLogic/SCA_ActuatorEventManager.h deleted file mode 100644 index 9adb9fcca39..00000000000 --- a/source/gameengine/GameLogic/SCA_ActuatorEventManager.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_ACTUATOREVENTMANAGER -#define __KX_ACTUATOREVENTMANAGER - -#include "SCA_EventManager.h" - -#include - -using namespace std; - -class SCA_ActuatorEventManager : public SCA_EventManager -{ -public: - SCA_ActuatorEventManager(class SCA_LogicManager* logicmgr); - virtual ~SCA_ActuatorEventManager(); - virtual void NextFrame(); - virtual void UpdateFrame(); - //SCA_LogicManager* GetLogicManager() { return m_logicmgr;} - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_ActuatorEventManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_ACTUATOREVENTMANAGER - diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp deleted file mode 100644 index c77e58d2f3b..00000000000 --- a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/** - * Actuator sensor - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include -#include "SCA_ActuatorSensor.h" -#include "SCA_EventManager.h" -#include "SCA_LogicManager.h" - -SCA_ActuatorSensor::SCA_ActuatorSensor(SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - const STR_String& actname) - : SCA_ISensor(gameobj,eventmgr), - m_checkactname(actname) -{ - m_actuator = GetParent()->FindActuator(m_checkactname); - Init(); -} - -void SCA_ActuatorSensor::Init() -{ - m_lastresult = m_invert?true:false; - m_midresult = m_lastresult; - m_reset = true; -} - -CValue* SCA_ActuatorSensor::GetReplica() -{ - SCA_ActuatorSensor* replica = new SCA_ActuatorSensor(*this); - // m_range_expr must be recalculated on replica! - replica->ProcessReplica(); - replica->Init(); - - return replica; -} - -void SCA_ActuatorSensor::ReParent(SCA_IObject* parent) -{ - m_actuator = parent->FindActuator(m_checkactname); - SCA_ISensor::ReParent(parent); -} - -bool SCA_ActuatorSensor::IsPositiveTrigger() -{ - bool result = m_lastresult; - if (m_invert) - result = !result; - - return result; -} - - - -SCA_ActuatorSensor::~SCA_ActuatorSensor() -{ -} - - - -bool SCA_ActuatorSensor::Evaluate() -{ - if (m_actuator) - { - bool result = m_actuator->IsActive(); - bool reset = m_reset && m_level; - - m_reset = false; - if (m_lastresult != result || m_midresult != result) - { - m_lastresult = m_midresult = result; - return true; - } - return (reset) ? true : false; - } - return false; -} - -void SCA_ActuatorSensor::Update() -{ - if (m_actuator) - { - m_midresult = m_actuator->IsActive() && !m_actuator->IsNegativeEvent(); - } -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_ActuatorSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_ActuatorSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_ActuatorSensor::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_ActuatorSensor::Attributes[] = { - KX_PYATTRIBUTE_STRING_RW_CHECK("actuator",0,100,false,SCA_ActuatorSensor,m_checkactname,CheckActuator), - { NULL } //Sentinel -}; - -int SCA_ActuatorSensor::CheckActuator(void *self, const PyAttributeDef*) -{ - SCA_ActuatorSensor* sensor = reinterpret_cast(self); - SCA_IActuator* act = sensor->GetParent()->FindActuator(sensor->m_checkactname); - if (act) { - sensor->m_actuator = act; - return 0; - } - PyErr_SetString(PyExc_AttributeError, "string does not correspond to an actuator"); - return 1; -} - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.h b/source/gameengine/GameLogic/SCA_ActuatorSensor.h deleted file mode 100644 index 323746889bf..00000000000 --- a/source/gameengine/GameLogic/SCA_ActuatorSensor.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Actuator sensor - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_ACTUATORSENSOR -#define __KX_ACTUATORSENSOR - -#include "SCA_ISensor.h" -#include "SCA_IActuator.h" - -class SCA_ActuatorSensor : public SCA_ISensor -{ - Py_Header; - STR_String m_checkactname; - bool m_lastresult; - bool m_midresult; - protected: - SCA_IActuator* m_actuator; -public: - SCA_ActuatorSensor(class SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - const STR_String& actname); - - virtual ~SCA_ActuatorSensor(); - virtual CValue* GetReplica(); - virtual void Init(); - virtual bool Evaluate(); - virtual bool IsPositiveTrigger(); - virtual void ReParent(SCA_IObject* parent); - void Update(); - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - static int CheckActuator(void *self, const PyAttributeDef*); - -#endif // DISABLE_PYTHON -}; - -#endif - diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp b/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp deleted file mode 100644 index 7ecd286ea43..00000000000 --- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Manager for 'always' events. Since always sensors can operate in pulse - * mode, they need to be activated. - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_AlwaysEventManager.h" -#include "SCA_LogicManager.h" -#include -#include "SCA_ISensor.h" - -using namespace std; - -SCA_AlwaysEventManager::SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr) - : SCA_EventManager(logicmgr, ALWAYS_EVENTMGR) -{ -} - - - -void SCA_AlwaysEventManager::NextFrame() -{ - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - (*it)->Activate(m_logicmgr); - } -} - diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h b/source/gameengine/GameLogic/SCA_AlwaysEventManager.h deleted file mode 100644 index cbbb5debd3c..00000000000 --- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_ALWAYSEVENTMGR -#define __KX_ALWAYSEVENTMGR -#include "SCA_EventManager.h" -#include - -using namespace std; -class SCA_AlwaysEventManager : public SCA_EventManager -{ -public: - SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr); - virtual void NextFrame(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_AlwaysEventManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_ALWAYSEVENTMGR - diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp deleted file mode 100644 index 0f3b81a057e..00000000000 --- a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Always trigger - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 -// This warning tells us about truncation of __long__ stl-generated names. -// It can occasionally cause DevStudio to have internal compiler warnings. -#pragma warning( disable : 4786 ) -#endif - -#include "SCA_AlwaysSensor.h" -#include "SCA_LogicManager.h" -#include "SCA_EventManager.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_AlwaysSensor::SCA_AlwaysSensor(class SCA_EventManager* eventmgr, - SCA_IObject* gameobj) - : SCA_ISensor(gameobj,eventmgr) -{ - //SetDrawColor(255,0,0); - Init(); -} - -void SCA_AlwaysSensor::Init() -{ - m_alwaysresult = true; -} - -SCA_AlwaysSensor::~SCA_AlwaysSensor() -{ - /* intentionally empty */ -} - - - -CValue* SCA_AlwaysSensor::GetReplica() -{ - CValue* replica = new SCA_AlwaysSensor(*this);//m_float,GetName()); - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - - - -bool SCA_AlwaysSensor::IsPositiveTrigger() -{ - return (m_invert ? false : true); -} - - - -bool SCA_AlwaysSensor::Evaluate() -{ - /* Nice! :) */ - //return true; - /* even nicer ;) */ - //return false; - - /* nicest ! */ - bool result = m_alwaysresult; - m_alwaysresult = false; - return result; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_AlwaysSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_AlwaysSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_AlwaysSensor::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_AlwaysSensor::Attributes[] = { - { NULL } //Sentinel -}; - -#endif - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.h b/source/gameengine/GameLogic/SCA_AlwaysSensor.h deleted file mode 100644 index 0de2a3f0629..00000000000 --- a/source/gameengine/GameLogic/SCA_AlwaysSensor.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * SCA_AlwaysSensor.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_ALWAYSSENSOR -#define __KX_ALWAYSSENSOR -#include "SCA_ISensor.h" - -class SCA_AlwaysSensor : public SCA_ISensor -{ - Py_Header; - bool m_alwaysresult; -public: - SCA_AlwaysSensor(class SCA_EventManager* eventmgr, - SCA_IObject* gameobj); - virtual ~SCA_AlwaysSensor(); - virtual CValue* GetReplica(); - virtual bool Evaluate(); - virtual bool IsPositiveTrigger(); - virtual void Init(); -}; - -#endif //__KX_ALWAYSSENSOR - diff --git a/source/gameengine/GameLogic/SCA_BasicEventManager.cpp b/source/gameengine/GameLogic/SCA_BasicEventManager.cpp deleted file mode 100644 index 2fdb1a96216..00000000000 --- a/source/gameengine/GameLogic/SCA_BasicEventManager.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Manager for 'always' events. Since always sensors can operate in pulse - * mode, they need to be activated. - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_BasicEventManager.h" -#include "SCA_LogicManager.h" -#include -#include "SCA_ISensor.h" - -using namespace std; - -SCA_BasicEventManager::SCA_BasicEventManager(class SCA_LogicManager* logicmgr) - : SCA_EventManager(logicmgr, BASIC_EVENTMGR) -{ -} - -SCA_BasicEventManager::~SCA_BasicEventManager() -{ -} - -void SCA_BasicEventManager::NextFrame() -{ - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - (*it)->Activate(m_logicmgr); - } -} - diff --git a/source/gameengine/GameLogic/SCA_BasicEventManager.h b/source/gameengine/GameLogic/SCA_BasicEventManager.h deleted file mode 100644 index a0fae4958c1..00000000000 --- a/source/gameengine/GameLogic/SCA_BasicEventManager.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Manager for sensor that only need to call Update - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __SCA_BASICEVENTMGR -#define __SCA_BASICEVENTMGR - -#include "SCA_EventManager.h" -#include - -using namespace std; - -class SCA_BasicEventManager : public SCA_EventManager -{ -public: - SCA_BasicEventManager(class SCA_LogicManager* logicmgr); - ~SCA_BasicEventManager(); - - virtual void NextFrame(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_BasicEventManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__SCA_BASICEVENTMGR - diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp deleted file mode 100644 index 701bcb2fc2f..00000000000 --- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/** - * Delay trigger - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 -// This warning tells us about truncation of __long__ stl-generated names. -// It can occasionally cause DevStudio to have internal compiler warnings. -#pragma warning( disable : 4786 ) -#endif - -#include "SCA_DelaySensor.h" -#include "SCA_LogicManager.h" -#include "SCA_EventManager.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_DelaySensor::SCA_DelaySensor(class SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - int delay, - int duration, - bool repeat) - : SCA_ISensor(gameobj,eventmgr), - m_repeat(repeat), - m_delay(delay), - m_duration(duration) -{ - Init(); -} - -void SCA_DelaySensor::Init() -{ - m_lastResult = false; - m_frameCount = -1; - m_reset = true; -} - -SCA_DelaySensor::~SCA_DelaySensor() -{ - /* intentionally empty */ -} - -CValue* SCA_DelaySensor::GetReplica() -{ - CValue* replica = new SCA_DelaySensor(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - - - -bool SCA_DelaySensor::IsPositiveTrigger() -{ - return (m_invert ? !m_lastResult : m_lastResult); -} - -bool SCA_DelaySensor::Evaluate() -{ - bool trigger = false; - bool result; - - if (m_frameCount==-1) { - // this is needed to ensure ON trigger in case delay==0 - // and avoid spurious OFF trigger when duration==0 - m_lastResult = false; - m_frameCount = 0; - } - - if (m_frameCount 0) { - if (m_frameCount < m_delay+m_duration) { - m_frameCount++; - result = true; - } else { - result = false; - if (m_repeat) - m_frameCount = -1; - } - } else { - result = true; - if (m_repeat) - m_frameCount = -1; - } - if ((m_reset && m_level) || result != m_lastResult) - trigger = true; - m_reset = false; - m_lastResult = result; - return trigger; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_DelaySensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_DelaySensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_DelaySensor::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_DelaySensor::Attributes[] = { - KX_PYATTRIBUTE_INT_RW("delay",0,100000,true,SCA_DelaySensor,m_delay), - KX_PYATTRIBUTE_INT_RW("duration",0,100000,true,SCA_DelaySensor,m_duration), - KX_PYATTRIBUTE_BOOL_RW("repeat",SCA_DelaySensor,m_repeat), - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.h b/source/gameengine/GameLogic/SCA_DelaySensor.h deleted file mode 100644 index c5db16afb54..00000000000 --- a/source/gameengine/GameLogic/SCA_DelaySensor.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * SCA_DelaySensor.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_DELAYSENSOR -#define __KX_DELAYSENSOR -#include "SCA_ISensor.h" - -class SCA_DelaySensor : public SCA_ISensor -{ - Py_Header; - bool m_lastResult; - bool m_repeat; - int m_delay; - int m_duration; - int m_frameCount; - -public: - SCA_DelaySensor(class SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - int delay, - int duration, - bool repeat); - virtual ~SCA_DelaySensor(); - virtual CValue* GetReplica(); - virtual bool Evaluate(); - virtual bool IsPositiveTrigger(); - virtual void Init(); - - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - -}; - -#endif //__KX_ALWAYSSENSOR - diff --git a/source/gameengine/GameLogic/SCA_EventManager.cpp b/source/gameengine/GameLogic/SCA_EventManager.cpp deleted file mode 100644 index 3a4a06ebfbd..00000000000 --- a/source/gameengine/GameLogic/SCA_EventManager.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include -#include "SCA_EventManager.h" -#include "SCA_ISensor.h" - - -SCA_EventManager::SCA_EventManager(SCA_LogicManager* logicmgr, EVENT_MANAGER_TYPE mgrtype) - :m_logicmgr(logicmgr), - m_mgrtype(mgrtype) -{ -} - - - -SCA_EventManager::~SCA_EventManager() -{ - // all sensors should be removed - assert(m_sensors.Empty()); -} - -void SCA_EventManager::RegisterSensor(class SCA_ISensor* sensor) -{ - m_sensors.AddBack(sensor); -} - -void SCA_EventManager::RemoveSensor(class SCA_ISensor* sensor) -{ - sensor->Delink(); -} - -void SCA_EventManager::NextFrame(double curtime, double fixedtime) -{ - NextFrame(); -} - -void SCA_EventManager::NextFrame() -{ - assert(false); // && "Event managers should override a NextFrame method"); -} - -void SCA_EventManager::EndFrame() -{ -} - -void SCA_EventManager::UpdateFrame() -{ -} - -int SCA_EventManager::GetType() -{ - return (int) m_mgrtype; -} diff --git a/source/gameengine/GameLogic/SCA_EventManager.h b/source/gameengine/GameLogic/SCA_EventManager.h deleted file mode 100644 index 8f77e7d4905..00000000000 --- a/source/gameengine/GameLogic/SCA_EventManager.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_EVENTMANAGER -#define __KX_EVENTMANAGER - -#include -#include -#include - -#include "SG_DList.h" - -class SCA_EventManager -{ -protected: - class SCA_LogicManager* m_logicmgr; /* all event manager subclasses use this (other then TimeEventManager) */ - - // use a set to speed-up insertion/removal - //std::set m_sensors; - SG_DList m_sensors; - -public: - enum EVENT_MANAGER_TYPE { - KEYBOARD_EVENTMGR = 0, - MOUSE_EVENTMGR, - ALWAYS_EVENTMGR, - TOUCH_EVENTMGR, - PROPERTY_EVENTMGR, - TIME_EVENTMGR, - RANDOM_EVENTMGR, - RAY_EVENTMGR, - NETWORK_EVENTMGR, - JOY_EVENTMGR, - ACTUATOR_EVENTMGR, - BASIC_EVENTMGR - }; - - SCA_EventManager(SCA_LogicManager* logicmgr, EVENT_MANAGER_TYPE mgrtype); - virtual ~SCA_EventManager(); - - virtual void RemoveSensor(class SCA_ISensor* sensor); - virtual void NextFrame(double curtime, double fixedtime); - virtual void NextFrame(); - virtual void UpdateFrame(); - virtual void EndFrame(); - virtual void RegisterSensor(class SCA_ISensor* sensor); - int GetType(); - //SG_DList &GetSensors() { return m_sensors; } - - - void Replace_LogicManager(SCA_LogicManager* logicmgr) { m_logicmgr= logicmgr; } - virtual void Replace_PhysicsScene(class PHY_IPhysicsEnvironment* env) { } /* only for event managers that use one */ - -protected: - EVENT_MANAGER_TYPE m_mgrtype; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_EventManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/GameLogic/SCA_ExpressionController.cpp b/source/gameengine/GameLogic/SCA_ExpressionController.cpp deleted file mode 100644 index b678648ca58..00000000000 --- a/source/gameengine/GameLogic/SCA_ExpressionController.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/** - * 'Expression Controller enables to calculate an expression that wires inputs to output - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_ExpressionController.h" -#include "SCA_ISensor.h" -#include "SCA_LogicManager.h" -#include "BoolValue.h" -#include "InputParser.h" -#include "MT_Transform.h" // for fuzzyZero - -#include - - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_ExpressionController::SCA_ExpressionController(SCA_IObject* gameobj, - const STR_String& exprtext) - :SCA_IController(gameobj), - m_exprText(exprtext), - m_exprCache(NULL) -{ -} - - - -SCA_ExpressionController::~SCA_ExpressionController() -{ - if (m_exprCache) - m_exprCache->Release(); -} - - - -CValue* SCA_ExpressionController::GetReplica() -{ - SCA_ExpressionController* replica = new SCA_ExpressionController(*this); - replica->m_exprText = m_exprText; - replica->m_exprCache = NULL; - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - - -// Forced deletion of precalculated expression to break reference loop -// Use this function when you know that you won't use the sensor anymore -void SCA_ExpressionController::Delete() -{ - if (m_exprCache) - { - m_exprCache->Release(); - m_exprCache = NULL; - } - Release(); -} - - -void SCA_ExpressionController::Trigger(SCA_LogicManager* logicmgr) -{ - - bool expressionresult = false; - if (!m_exprCache) - { - CParser parser; - parser.SetContext(this->AddRef()); - m_exprCache = parser.ProcessText(m_exprText); - } - if (m_exprCache) - { - CValue* value = m_exprCache->Calculate(); - if (value) - { - if (value->IsError()) - { - printf("%s\n", value->GetText().ReadPtr()); - } else - { - float num = (float)value->GetNumber(); - expressionresult = !MT_fuzzyZero(num); - } - value->Release(); - - } - } - - for (vector::const_iterator i=m_linkedactuators.begin(); - !(i==m_linkedactuators.end());i++) - { - SCA_IActuator* actua = *i; - logicmgr->AddActiveActuator(actua,expressionresult); - } -} - - - -CValue* SCA_ExpressionController::FindIdentifier(const STR_String& identifiername) -{ - - CValue* identifierval = NULL; - - for (vector::const_iterator is=m_linkedsensors.begin(); - !(is==m_linkedsensors.end());is++) - { - SCA_ISensor* sensor = *is; - if (sensor->GetName() == identifiername) - { - identifierval = new CBoolValue(sensor->GetState()); - //identifierval = sensor->AddRef(); - } - - //if (!sensor->IsPositiveTrigger()) - //{ - // sensorresult = false; - // break; - //} - } - - if (identifierval) - return identifierval; - - return GetParent()->FindIdentifier(identifiername); - -} diff --git a/source/gameengine/GameLogic/SCA_ExpressionController.h b/source/gameengine/GameLogic/SCA_ExpressionController.h deleted file mode 100644 index d7bb8edebb1..00000000000 --- a/source/gameengine/GameLogic/SCA_ExpressionController.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * KX_EXPRESSIONController.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_EXPRESSIONCONTROLLER -#define __KX_EXPRESSIONCONTROLLER - -#include "SCA_IController.h" - -class SCA_ExpressionController : public SCA_IController -{ -// Py_Header; - STR_String m_exprText; - CExpression* m_exprCache; - -public: - SCA_ExpressionController(SCA_IObject* gameobj, - const STR_String& exprtext); - - virtual ~SCA_ExpressionController(); - virtual CValue* GetReplica(); - virtual void Trigger(SCA_LogicManager* logicmgr); - virtual CValue* FindIdentifier(const STR_String& identifiername); - /** - * used to release the expression cache - * so that self references are removed before the controller itself is released - */ - virtual void Delete(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_ExpressionController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_EXPRESSIONCONTROLLER - diff --git a/source/gameengine/GameLogic/SCA_IActuator.cpp b/source/gameengine/GameLogic/SCA_IActuator.cpp deleted file mode 100644 index b836227895f..00000000000 --- a/source/gameengine/GameLogic/SCA_IActuator.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_IActuator.h" -#include - -using namespace std; - -SCA_IActuator::SCA_IActuator(SCA_IObject* gameobj, KX_ACTUATOR_TYPE type) : - SCA_ILogicBrick(gameobj), - m_type(type), - m_links(0), - m_posevent(false), - m_negevent(false) -{ - // nothing to do -} - -bool SCA_IActuator::Update(double curtime, bool frame) -{ - if (frame) - return Update(); - - return true; -} - -bool SCA_IActuator::Update() -{ - assert(false && "Actuators should override an Update method."); - return false; -} - -void SCA_IActuator::Activate(SG_DList& head) -{ - if (QEmpty()) - { - InsertActiveQList(m_gameobj->m_activeActuators); - head.AddBack(&m_gameobj->m_activeActuators); - } -} - -// this function is only used to deactivate actuators outside the logic loop -// e.g. when an object is deleted. -void SCA_IActuator::Deactivate() -{ - if (QDelink()) - { - // the actuator was in the active list - if (m_gameobj->m_activeActuators.QEmpty()) - // the owner object has no more active actuators, remove it from the global list - m_gameobj->m_activeActuators.Delink(); - } -} - - -void SCA_IActuator::ProcessReplica() -{ - SCA_ILogicBrick::ProcessReplica(); - RemoveAllEvents(); - m_linkedcontrollers.clear(); -} - - - -SCA_IActuator::~SCA_IActuator() -{ - RemoveAllEvents(); -} - -void SCA_IActuator::DecLink() -{ - m_links--; - if (m_links < 0) - { - printf("Warning: actuator %s has negative m_links: %d\n", m_name.Ptr(), m_links); - m_links = 0; - } -} - -void SCA_IActuator::LinkToController(SCA_IController* controller) -{ - m_linkedcontrollers.push_back(controller); -} - -void SCA_IActuator::UnlinkController(SCA_IController* controller) -{ - std::vector::iterator contit; - for (contit = m_linkedcontrollers.begin();!(contit==m_linkedcontrollers.end());++contit) - { - if ((*contit) == controller) - { - *contit = m_linkedcontrollers.back(); - m_linkedcontrollers.pop_back(); - return; - } - } - printf("Missing link from actuator %s:%s to controller %s:%s\n", - m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), - controller->GetParent()->GetName().ReadPtr(), controller->GetName().ReadPtr()); -} - -void SCA_IActuator::UnlinkAllControllers() -{ - std::vector::iterator contit; - for (contit = m_linkedcontrollers.begin();!(contit==m_linkedcontrollers.end());++contit) - { - (*contit)->UnlinkActuator(this); - } - m_linkedcontrollers.clear(); -} - diff --git a/source/gameengine/GameLogic/SCA_IActuator.h b/source/gameengine/GameLogic/SCA_IActuator.h deleted file mode 100644 index f456183a16c..00000000000 --- a/source/gameengine/GameLogic/SCA_IActuator.h +++ /dev/null @@ -1,166 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_IACTUATOR -#define __KX_IACTUATOR - -#include "SCA_IController.h" -#include - -/* - * Use of SG_DList : None - * Use of SG_QList : element of activated actuator list of their owner - * Head: SCA_IObject::m_activeActuators - */ -class SCA_IActuator : public SCA_ILogicBrick -{ - friend class SCA_LogicManager; -protected: - int m_type; - int m_links; // number of active links to controllers - // when 0, the actuator is automatically stopped - //std::vector m_events; - bool m_posevent; - bool m_negevent; - - std::vector m_linkedcontrollers; - - void RemoveAllEvents() - { - m_posevent = false; - m_negevent = false; - } - - -public: - /** - * This class also inherits the default copy constructors - */ - enum KX_ACTUATOR_TYPE { - KX_ACT_OBJECT, - KX_ACT_IPO, - KX_ACT_CAMERA, - KX_ACT_SOUND, - KX_ACT_PROPERTY, - KX_ACT_ADD_OBJECT, - KX_ACT_END_OBJECT, - KX_ACT_DYNAMIC, - KX_ACT_REPLACE_MESH, - KX_ACT_TRACKTO, - KX_ACT_CONSTRAINT, - KX_ACT_SCENE, - KX_ACT_RANDOM, - KX_ACT_MESSAGE, - KX_ACT_ACTION, - KX_ACT_CD, - KX_ACT_GAME, - KX_ACT_VISIBILITY, - KX_ACT_2DFILTER, - KX_ACT_PARENT, - KX_ACT_SHAPEACTION, - KX_ACT_STATE, - KX_ACT_ARMATURE, - }; - - SCA_IActuator(SCA_IObject* gameobj, KX_ACTUATOR_TYPE type); - - /** - * UnlinkObject(...) - * Certain actuator use gameobject pointers (like TractTo actuator) - * This function can be called when an object is removed to make - * sure that the actuator will not use it anymore. - */ - - virtual bool UnlinkObject(SCA_IObject* clientobj) { return false; } - - /** - * Update(...) - * Update the actuator based upon the events received since - * the last call to Update, the current time and deltatime the - * time elapsed in this frame ? - * It is the responsibility of concrete Actuators to clear - * their event's. This is usually done in the Update() method via - * a call to RemoveAllEvents() - */ - - - virtual bool Update(double curtime, bool frame); - virtual bool Update(); - - /** - * Add an event to an actuator. - */ - //void AddEvent(CValue* event) - void AddEvent(bool event) - { - if (event) - m_posevent = true; - else - m_negevent = true; - } - - virtual void ProcessReplica(); - - /** - * Return true iff all the current events - * are negative. The definition of negative event is - * not immediately clear. But usually refers to key-up events - * or events where no action is required. - */ - bool IsNegativeEvent() const - { - return !m_posevent && m_negevent; - } - - virtual ~SCA_IActuator(); - - /** - * remove this actuator from the list of active actuators - */ - virtual void Deactivate(); - virtual void Activate(SG_DList& head); - - void LinkToController(SCA_IController* controller); - void UnlinkController(class SCA_IController* cont); - void UnlinkAllControllers(); - - void ClrLink() { m_links=0; } - void IncLink() { m_links++; } - void DecLink(); - bool IsNoLink() const { return !m_links; } - bool IsType(KX_ACTUATOR_TYPE type) { return m_type == type; } - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_IActuator"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_IACTUATOR - diff --git a/source/gameengine/GameLogic/SCA_IController.cpp b/source/gameengine/GameLogic/SCA_IController.cpp deleted file mode 100644 index c291ff091aa..00000000000 --- a/source/gameengine/GameLogic/SCA_IController.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_IController.h" -#include "SCA_LogicManager.h" -#include "SCA_IActuator.h" -#include "SCA_ISensor.h" -#include "PyObjectPlus.h" -#include "../Ketsji/KX_PythonSeq.h" /* not nice, only need for KX_PythonSeq_CreatePyObject */ - -#include - -SCA_IController::SCA_IController(SCA_IObject* gameobj) - : - SCA_ILogicBrick(gameobj), - m_statemask(0), - m_justActivated(false) -{ -} - - - -SCA_IController::~SCA_IController() -{ - //UnlinkAllActuators(); -} - - - -std::vector& SCA_IController::GetLinkedSensors() -{ - return m_linkedsensors; -} - - - -std::vector& SCA_IController::GetLinkedActuators() -{ - return m_linkedactuators; -} - - - -void SCA_IController::UnlinkAllSensors() -{ - std::vector::iterator sensit; - for (sensit = m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit) - { - if (IsActive()) - { - (*sensit)->DecLink(); - } - (*sensit)->UnlinkController(this); - } - m_linkedsensors.clear(); -} - - - -void SCA_IController::UnlinkAllActuators() -{ - std::vector::iterator actit; - for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit) - { - if (IsActive()) - { - (*actit)->DecLink(); - } - (*actit)->UnlinkController(this); - } - m_linkedactuators.clear(); -} - -void SCA_IController::LinkToActuator(SCA_IActuator* actua) -{ - m_linkedactuators.push_back(actua); - if (IsActive()) - { - actua->IncLink(); - } -} - -void SCA_IController::UnlinkActuator(class SCA_IActuator* actua) -{ - std::vector::iterator actit; - for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit) - { - if ((*actit) == actua) - { - if (IsActive()) - { - (*actit)->DecLink(); - } - *actit = m_linkedactuators.back(); - m_linkedactuators.pop_back(); - return; - } - } - printf("Missing link from controller %s:%s to actuator %s:%s\n", - m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), - actua->GetParent()->GetName().ReadPtr(), actua->GetName().ReadPtr()); -} - -void SCA_IController::LinkToSensor(SCA_ISensor* sensor) -{ - m_linkedsensors.push_back(sensor); - if (IsActive()) - { - sensor->IncLink(); - } -} - -void SCA_IController::UnlinkSensor(class SCA_ISensor* sensor) -{ - std::vector::iterator sensit; - for (sensit = m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit) - { - if ((*sensit) == sensor) - { - if (IsActive()) - { - sensor->DecLink(); - } - *sensit = m_linkedsensors.back(); - m_linkedsensors.pop_back(); - return; - } - } - printf("Missing link from controller %s:%s to sensor %s:%s\n", - m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), - sensor->GetParent()->GetName().ReadPtr(), sensor->GetName().ReadPtr()); -} - - -void SCA_IController::ApplyState(unsigned int state) -{ - std::vector::iterator actit; - std::vector::iterator sensit; - - if (m_statemask & state) - { - if (!IsActive()) - { - // reactive the controller, all the links to actuator are valid again - for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit) - { - (*actit)->IncLink(); - } - - for (sensit = m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit) - { - (*sensit)->IncLink(); - } - SetActive(true); - m_justActivated = true; - } - } else if (IsActive()) - { - for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit) - { - (*actit)->DecLink(); - } - for (sensit = m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit) - { - (*sensit)->DecLink(); - } - SetActive(false); - m_justActivated = false; - } -} - -#ifndef DISABLE_PYTHON - -/* Python api */ - -PyTypeObject SCA_IController::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_IController", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ILogicBrick::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_IController::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_IController::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("state", SCA_IController, pyattr_get_state), - KX_PYATTRIBUTE_RO_FUNCTION("sensors", SCA_IController, pyattr_get_sensors), - KX_PYATTRIBUTE_RO_FUNCTION("actuators", SCA_IController, pyattr_get_actuators), - KX_PYATTRIBUTE_BOOL_RW("useHighPriority",SCA_IController,m_bookmark), - { NULL } //Sentinel -}; - -PyObject* SCA_IController::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_IController* self= static_cast(self_v); - return PyLong_FromSsize_t(self->m_statemask); -} - -PyObject* SCA_IController::pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - return KX_PythonSeq_CreatePyObject((static_cast(self_v))->m_proxy, KX_PYGENSEQ_CONT_TYPE_SENSORS); -} - -PyObject* SCA_IController::pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - return KX_PythonSeq_CreatePyObject((static_cast(self_v))->m_proxy, KX_PYGENSEQ_CONT_TYPE_ACTUATORS); -} -#endif // DISABLE_PYTHON diff --git a/source/gameengine/GameLogic/SCA_IController.h b/source/gameengine/GameLogic/SCA_IController.h deleted file mode 100644 index e23a0d7dc92..00000000000 --- a/source/gameengine/GameLogic/SCA_IController.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_ICONTROLLER -#define __KX_ICONTROLLER - -#include "SCA_ILogicBrick.h" -#include "PyObjectPlus.h" - -/* - * Use of SG_DList element: none - * Use of SG_QList element: build ordered list of activated controller on the owner object - * Head: SCA_IObject::m_activeControllers - */ -class SCA_IController : public SCA_ILogicBrick -{ - Py_Header; -protected: - std::vector m_linkedsensors; - std::vector m_linkedactuators; - unsigned int m_statemask; - bool m_justActivated; - bool m_bookmark; -public: - SCA_IController(SCA_IObject* gameobj); - virtual ~SCA_IController(); - virtual void Trigger(class SCA_LogicManager* logicmgr)=0; - void LinkToSensor(SCA_ISensor* sensor); - void LinkToActuator(SCA_IActuator*); - std::vector& GetLinkedSensors(); - std::vector& GetLinkedActuators(); - void ReserveActuator(int num) - { - m_linkedactuators.reserve(num); - } - void UnlinkAllSensors(); - void UnlinkAllActuators(); - void UnlinkActuator(class SCA_IActuator* actua); - void UnlinkSensor(class SCA_ISensor* sensor); - void SetState(unsigned int state) { m_statemask = state; } - void ApplyState(unsigned int state); - void Deactivate() - { - // the controller can only be part of a sensor m_newControllers list - Delink(); - } - bool IsJustActivated() - { - return m_justActivated; - } - void ClrJustActivated() - { - m_justActivated = false; - } - void SetBookmark(bool bookmark) - { - m_bookmark = bookmark; - } - void Activate(SG_DList& head) - { - if (QEmpty()) - { - if (m_bookmark) - { - m_gameobj->m_activeBookmarkedControllers.QAddBack(this); - head.AddFront(&m_gameobj->m_activeBookmarkedControllers); - } - else - { - InsertActiveQList(m_gameobj->m_activeControllers); - head.AddBack(&m_gameobj->m_activeControllers); - } - } - } - - -#ifndef DISABLE_PYTHON - static PyObject* pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); -#endif // DISABLE_PYTHON -}; - -#endif - diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.cpp b/source/gameengine/GameLogic/SCA_IInputDevice.cpp deleted file mode 100644 index 9d902681d36..00000000000 --- a/source/gameengine/GameLogic/SCA_IInputDevice.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include -#include "SCA_IInputDevice.h" - -SCA_IInputDevice::SCA_IInputDevice() - : - m_currentTable(0) -{ - ClearStatusTable(0); - ClearStatusTable(1); -} - - - -SCA_IInputDevice::~SCA_IInputDevice() -{ -} - -void SCA_IInputDevice::HookEscape() -{ - assert(false && "This device does not support hooking escape."); -} - -void SCA_IInputDevice::ClearStatusTable(int tableid) -{ - for (int i=0;i KX_NO_INPUTSTATUS - * KX_JUSTACTIVATED -> KX_ACTIVE - * KX_ACTIVE -> KX_ACTIVE - * KX_JUSTRELEASED -> KX_NO_INPUTSTATUS - * - * Getting new events provides the - * KX_NO_INPUTSTATUS->KX_JUSTACTIVATED and - * KX_ACTIVE->KX_JUSTRELEASED transitions. - */ - virtual void NextFrame(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_InputEvent"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //KX_INPUTDEVICE_H - diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp deleted file mode 100644 index f2e1a8dd151..00000000000 --- a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_ILogicBrick.h" -#include "PyObjectPlus.h" - -SCA_LogicManager* SCA_ILogicBrick::m_sCurrentLogicManager = NULL; - -SCA_ILogicBrick::SCA_ILogicBrick(SCA_IObject* gameobj) - : - CValue(), - m_gameobj(gameobj), - m_Execute_Priority(0), - m_Execute_Ueber_Priority(0), - m_bActive(false), - m_eventval(0) -{ - m_text = "KX_LogicBrick"; -} - - - -SCA_ILogicBrick::~SCA_ILogicBrick() -{ - RemoveEvent(); -} - - - -void SCA_ILogicBrick::SetExecutePriority(int execute_Priority) -{ - m_Execute_Priority = execute_Priority; -} - - - -void SCA_ILogicBrick::SetUeberExecutePriority(int execute_Priority) -{ - m_Execute_Ueber_Priority = execute_Priority; -} - - - -void SCA_ILogicBrick::ReParent(SCA_IObject* parent) -{ - m_gameobj = parent; -} - -void SCA_ILogicBrick::Relink(GEN_Map *obj_map) -{ - // nothing to do -} - -CValue* SCA_ILogicBrick::Calc(VALUE_OPERATOR op, CValue *val) -{ - CValue* temp = new CBoolValue(false,""); - CValue* result = temp->Calc(op,val); - temp->Release(); - - return result; -} - - - -CValue* SCA_ILogicBrick::CalcFinal(VALUE_DATA_TYPE dtype, - VALUE_OPERATOR op, - CValue *val) -{ - // same as bool implementation, so... - CValue* temp = new CBoolValue(false,""); - CValue* result = temp->CalcFinal(dtype,op,val); - temp->Release(); - - return result; -} - - - -const STR_String& SCA_ILogicBrick::GetText() -{ - if (m_name.Length()) - return m_name; - - return m_text; -} - - - -double SCA_ILogicBrick::GetNumber() -{ - return -1; -} - - - -STR_String& SCA_ILogicBrick::GetName() -{ - return m_name; -} - - - -void SCA_ILogicBrick::SetName(const char *name) -{ - m_name = name; -} - -bool SCA_ILogicBrick::LessComparedTo(SCA_ILogicBrick* other) -{ - return (this->m_Execute_Ueber_Priority < other->m_Execute_Ueber_Priority) - || ((this->m_Execute_Ueber_Priority == other->m_Execute_Ueber_Priority) && - (this->m_Execute_Priority < other->m_Execute_Priority)); -} - -void SCA_ILogicBrick::RegisterEvent(CValue* eventval) -{ - if (m_eventval) - m_eventval->Release(); - - m_eventval = eventval->AddRef(); -} - - -void SCA_ILogicBrick::RemoveEvent() -{ - if (m_eventval) - { - m_eventval->Release(); - m_eventval = NULL; - } -} - - - -CValue* SCA_ILogicBrick::GetEvent() -{ - if (m_eventval) - { - return m_eventval->AddRef(); - } - - return NULL; -} - - - -#ifndef DISABLE_PYTHON - -/* python stuff */ - -PyTypeObject SCA_ILogicBrick::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_ILogicBrick", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &CValue::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_ILogicBrick::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_ILogicBrick::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("owner", SCA_ILogicBrick, pyattr_get_owner), - KX_PYATTRIBUTE_INT_RW("executePriority",0,100000,false,SCA_ILogicBrick,m_Execute_Priority), - KX_PYATTRIBUTE_STRING_RO("name", SCA_ILogicBrick, m_name), - {NULL} //Sentinel -}; - -int SCA_ILogicBrick::CheckProperty(void *self, const PyAttributeDef *attrdef) -{ - if (attrdef->m_type != KX_PYATTRIBUTE_TYPE_STRING || attrdef->m_length != 1) { - PyErr_SetString(PyExc_AttributeError, "inconsistent check function for attribute type, report to blender.org"); - return 1; - } - SCA_ILogicBrick* brick = reinterpret_cast(self); - STR_String* var = reinterpret_cast((char*)self+attrdef->m_offset); - CValue* prop = brick->GetParent()->FindIdentifier(*var); - bool error = prop->IsError(); - prop->Release(); - if (error) { - PyErr_SetString(PyExc_ValueError, "string does not correspond to a property"); - return 1; - } - return 0; -} - -/*Attribute functions */ -PyObject* SCA_ILogicBrick::pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_ILogicBrick* self= static_cast(self_v); - CValue* parent = self->GetParent(); - - if (parent) - return parent->GetProxy(); - - Py_RETURN_NONE; -} - - - -/* Conversions for making life better. */ -bool SCA_ILogicBrick::PyArgToBool(int boolArg) -{ - if (boolArg) { - return true; - } else { - return false; - } -} - -PyObject* SCA_ILogicBrick::BoolToPyArg(bool boolarg) -{ - return PyLong_FromSsize_t(boolarg? KX_TRUE: KX_FALSE); -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.h b/source/gameengine/GameLogic/SCA_ILogicBrick.h deleted file mode 100644 index 3225c245550..00000000000 --- a/source/gameengine/GameLogic/SCA_ILogicBrick.h +++ /dev/null @@ -1,165 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_ILOGICBRICK -#define __KX_ILOGICBRICK - -#include "Value.h" -#include "SCA_IObject.h" -#include "BoolValue.h" -#include "GEN_Map.h" -#include "GEN_HashedPtr.h" - -class NG_NetworkScene; -class SCA_IScene; - -class SCA_ILogicBrick : public CValue -{ - Py_Header; -protected: - SCA_IObject* m_gameobj; - int m_Execute_Priority; - int m_Execute_Ueber_Priority; - - bool m_bActive; - CValue* m_eventval; - STR_String m_text; - STR_String m_name; - //unsigned long m_drawcolor; - void RegisterEvent(CValue* eventval); - void RemoveEvent(); - CValue* GetEvent(); - -public: - SCA_ILogicBrick(SCA_IObject* gameobj); - virtual ~SCA_ILogicBrick(); - - void SetExecutePriority(int execute_Priority); - void SetUeberExecutePriority(int execute_Priority); - - SCA_IObject* GetParent() { return m_gameobj; } - - virtual void ReParent(SCA_IObject* parent); - virtual void Relink(GEN_Map *obj_map); - virtual void Delete() { Release(); } - - // act as a BoolValue (with value IsPositiveTrigger) - virtual CValue* Calc(VALUE_OPERATOR op, CValue *val); - virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - - virtual const STR_String & GetText(); - virtual double GetNumber(); - virtual STR_String& GetName(); - virtual void SetName(const char *); - - bool IsActive() - { - return m_bActive; - } - - void SetActive(bool active) - { - m_bActive=active; - } - - // insert in a QList at position corresponding to m_Execute_Priority - void InsertActiveQList(SG_QList& head) - { - SG_QList::iterator it(head); - for(it.begin(); !it.end() && m_Execute_Priority > (*it)->m_Execute_Priority; ++it); - it.add_back(this); - } - - // insert in a QList at position corresponding to m_Execute_Priority - // inside a longer list that contains elements of other objects. - // Sorting is done only between the elements of the same object. - // head is the head of the combined list - // current points to the first element of the object in the list, NULL if none yet - void InsertSelfActiveQList(SG_QList& head, SG_QList** current) - { - if (!*current) - { - // first element can be put anywhere - head.QAddBack(this); - *current = this; - return; - } - // note: we assume current points actually to one o our element, skip the tests - SG_QList::iterator it(head,*current); - if (m_Execute_Priority <= (*it)->m_Execute_Priority) - { - // this element comes before the first - *current = this; - } - else - { - for(++it; !it.end() && (*it)->m_gameobj == m_gameobj && m_Execute_Priority > (*it)->m_Execute_Priority; ++it); - } - it.add_back(this); - } - - virtual bool LessComparedTo(SCA_ILogicBrick* other); - - /* runtime variable, set when Triggering the python controller */ - static class SCA_LogicManager* m_sCurrentLogicManager; - - - /* for moving logic bricks between scenes */ - virtual void Replace_IScene(SCA_IScene *val) {}; - virtual void Replace_NetworkScene(NG_NetworkScene *val) {}; - -#ifndef DISABLE_PYTHON - // python methods - - static PyObject* pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - - // check that attribute is a property - static int CheckProperty(void *self, const PyAttributeDef *attrdef); - - enum KX_BOOL_TYPE { - KX_BOOL_NODEF = 0, - KX_TRUE, - KX_FALSE, - KX_BOOL_MAX - }; - - -protected: - /* Some conversions to go with the bool type. */ - /** Convert a KX_TRUE, KX_FALSE in Python to a c++ value. */ - bool PyArgToBool(int boolArg); - - /** Convert a a c++ value to KX_TRUE, KX_FALSE in Python. */ - PyObject* BoolToPyArg(bool); - -#endif // DISABLE_PYTHON - -}; - -#endif - diff --git a/source/gameengine/GameLogic/SCA_IObject.cpp b/source/gameengine/GameLogic/SCA_IObject.cpp deleted file mode 100644 index 7c0a5b2db15..00000000000 --- a/source/gameengine/GameLogic/SCA_IObject.cpp +++ /dev/null @@ -1,345 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include -#include - -#include "SCA_IObject.h" -#include "SCA_ISensor.h" -#include "SCA_IController.h" -#include "SCA_IActuator.h" -#include "MT_Point3.h" -#include "ListValue.h" - -MT_Point3 SCA_IObject::m_sDummy=MT_Point3(0,0,0); -SG_QList SCA_IObject::m_activeBookmarkedControllers; - -SCA_IObject::SCA_IObject(): - CValue(), - m_initState(0), - m_state(0), - m_firstState(NULL) -{ - m_suspended = false; -} - -SCA_IObject::~SCA_IObject() -{ - SCA_SensorList::iterator its; - for (its = m_sensors.begin(); !(its == m_sensors.end()); ++its) - { - //Use Delete for sensor to ensure proper cleaning - (*its)->Delete(); - //((CValue*)(*its))->Release(); - } - SCA_ControllerList::iterator itc; - for (itc = m_controllers.begin(); !(itc == m_controllers.end()); ++itc) - { - //Use Delete for controller to ensure proper cleaning (expression controller) - (*itc)->Delete(); - //((CValue*)(*itc))->Release(); - } - SCA_ActuatorList::iterator ita; - for (ita = m_registeredActuators.begin(); !(ita==m_registeredActuators.end()); ++ita) - { - (*ita)->UnlinkObject(this); - } - for (ita = m_actuators.begin(); !(ita==m_actuators.end()); ++ita) - { - (*ita)->Delete(); - } - - SCA_ObjectList::iterator ito; - for (ito = m_registeredObjects.begin(); !(ito==m_registeredObjects.end()); ++ito) - { - (*ito)->UnlinkObject(this); - } - - //T_InterpolatorList::iterator i; - //for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - // delete *i; - //} -} - -void SCA_IObject::AddSensor(SCA_ISensor* act) -{ - act->AddRef(); - m_sensors.push_back(act); -} - - - -void SCA_IObject::AddController(SCA_IController* act) -{ - act->AddRef(); - m_controllers.push_back(act); -} - - - -void SCA_IObject::AddActuator(SCA_IActuator* act) -{ - act->AddRef(); - m_actuators.push_back(act); -} - -void SCA_IObject::RegisterActuator(SCA_IActuator* act) -{ - // don't increase ref count, it would create dead lock - m_registeredActuators.push_back(act); -} - -void SCA_IObject::UnregisterActuator(SCA_IActuator* act) -{ - SCA_ActuatorList::iterator ita; - for (ita = m_registeredActuators.begin(); ita != m_registeredActuators.end(); ++ita) - { - if ((*ita) == act) { - (*ita) = m_registeredActuators.back(); - m_registeredActuators.pop_back(); - break; - } - } -} - -void SCA_IObject::RegisterObject(SCA_IObject* obj) -{ - // one object may be registered multiple times via constraint target - // store multiple reference, this will serve as registration counter - m_registeredObjects.push_back(obj); -} - -void SCA_IObject::UnregisterObject(SCA_IObject* obj) -{ - SCA_ObjectList::iterator ito; - for (ito = m_registeredObjects.begin(); ito != m_registeredObjects.end(); ++ito) - { - if ((*ito) == obj) { - (*ito) = m_registeredObjects.back(); - m_registeredObjects.pop_back(); - break; - } - } -} - -void SCA_IObject::ReParentLogic() -{ - SCA_ActuatorList& oldactuators = GetActuators(); - int act = 0; - SCA_ActuatorList::iterator ita; - for (ita = oldactuators.begin(); !(ita==oldactuators.end()); ++ita) - { - SCA_IActuator* newactuator = (SCA_IActuator*) (*ita)->GetReplica(); - newactuator->ReParent(this); - // actuators are initially not connected to any controller - newactuator->SetActive(false); - newactuator->ClrLink(); - oldactuators[act++] = newactuator; - } - - SCA_ControllerList& oldcontrollers = GetControllers(); - int con = 0; - SCA_ControllerList::iterator itc; - for (itc = oldcontrollers.begin(); !(itc==oldcontrollers.end()); ++itc) - { - SCA_IController* newcontroller = (SCA_IController*)(*itc)->GetReplica(); - newcontroller->ReParent(this); - newcontroller->SetActive(false); - oldcontrollers[con++]=newcontroller; - - } - // convert sensors last so that actuators are already available for Actuator sensor - SCA_SensorList& oldsensors = GetSensors(); - int sen = 0; - SCA_SensorList::iterator its; - for (its = oldsensors.begin(); !(its==oldsensors.end()); ++its) - { - SCA_ISensor* newsensor = (SCA_ISensor*)(*its)->GetReplica(); - newsensor->ReParent(this); - newsensor->SetActive(false); - // sensors are initially not connected to any controller - newsensor->ClrLink(); - oldsensors[sen++] = newsensor; - } - - // a new object cannot be client of any actuator - m_registeredActuators.clear(); - m_registeredObjects.clear(); -} - - - -SCA_ISensor* SCA_IObject::FindSensor(const STR_String& sensorname) -{ - SCA_ISensor* foundsensor = NULL; - - for (SCA_SensorList::iterator its = m_sensors.begin();!(its==m_sensors.end());++its) - { - if ((*its)->GetName() == sensorname) - { - foundsensor = (*its); - break; - } - } - return foundsensor; -} - - - -SCA_IController* SCA_IObject::FindController(const STR_String& controllername) -{ - SCA_IController* foundcontroller = NULL; - - for (SCA_ControllerList::iterator itc = m_controllers.begin();!(itc==m_controllers.end());++itc) - { - if ((*itc)->GetName() == controllername) - { - foundcontroller = (*itc); - break; - } - } - return foundcontroller; -} - - - -SCA_IActuator* SCA_IObject::FindActuator(const STR_String& actuatorname) -{ - SCA_IActuator* foundactuator = NULL; - - for (SCA_ActuatorList::iterator ita = m_actuators.begin();!(ita==m_actuators.end());++ita) - { - if ((*ita)->GetName() == actuatorname) - { - foundactuator = (*ita); - break; - } - } - - return foundactuator; -} - - -void SCA_IObject::Suspend() -{ - if ((!m_ignore_activity_culling) - && (!m_suspended)) { - m_suspended = true; - /* flag suspend for all sensors */ - SCA_SensorList::iterator i = m_sensors.begin(); - while (i != m_sensors.end()) { - (*i)->Suspend(); - ++i; - } - } -} - - - -void SCA_IObject::Resume(void) -{ - if (m_suspended) { - m_suspended = false; - /* unflag suspend for all sensors */ - SCA_SensorList::iterator i = m_sensors.begin(); - while (i != m_sensors.end()) { - (*i)->Resume(); - ++i; - } - } -} - -void SCA_IObject::SetState(unsigned int state) -{ - unsigned int tmpstate; - SCA_ControllerList::iterator contit; - - // we will update the state in two steps: - // 1) set the new state bits that are 1 - // 2) clr the new state bits that are 0 - // This to ensure continuity if a sensor is attached to two states - // that are switching state: no need to deactive and reactive the sensor - - tmpstate = m_state | state; - if (tmpstate != m_state) - { - // update the status of the controllers - for (contit = m_controllers.begin(); contit != m_controllers.end(); ++contit) - { - (*contit)->ApplyState(tmpstate); - } - } - m_state = state; - if (m_state != tmpstate) - { - for (contit = m_controllers.begin(); contit != m_controllers.end(); ++contit) - { - (*contit)->ApplyState(m_state); - } - } -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_IObject::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_IObject", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &CValue::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_IObject::Methods[] = { - //{"setOrientation", (PyCFunction) SCA_IObject::sPySetOrientation, METH_VARARGS}, - //{"getOrientation", (PyCFunction) SCA_IObject::sPyGetOrientation, METH_VARARGS}, - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_IObject::Attributes[] = { - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/GameLogic/SCA_IObject.h b/source/gameengine/GameLogic/SCA_IObject.h deleted file mode 100644 index 0178da5f343..00000000000 --- a/source/gameengine/GameLogic/SCA_IObject.h +++ /dev/null @@ -1,228 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * An abstract object that has some logic, python scripting and - * reference counting Note: transformation stuff has been moved to - * SceneGraph - */ - -#ifndef SCA_IOBJECT_H -#define SCA_IOBJECT_H - -#include "Value.h" -#include - -class SCA_IObject; -class SCA_ISensor; -class SCA_IController; -class SCA_IActuator; - -#ifndef DISABLE_PYTHON -template T PyVecTo(PyObject*); -#endif - -typedef std::vector SCA_SensorList; -typedef std::vector SCA_ControllerList; -typedef std::vector SCA_ActuatorList; -typedef std::vector SCA_ObjectList; - -class SCA_IObject : public CValue -{ - - Py_Header; - -protected: - friend class KX_StateActuator; - friend class SCA_IActuator; - friend class SCA_IController; - SCA_SensorList m_sensors; - SCA_ControllerList m_controllers; - SCA_ActuatorList m_actuators; - SCA_ActuatorList m_registeredActuators; // actuators that use a pointer to this object - SCA_ObjectList m_registeredObjects; // objects that hold reference to this object - - // SG_Dlist: element of objects with active actuators - // Head: SCA_LogicManager::m_activeActuators - // SG_QList: Head of active actuators list on this object - // Elements: SCA_IActuator - SG_QList m_activeActuators; - // SG_Dlist: element of list os lists with active controllers - // Head: SCA_LogicManager::m_activeControllers - // SG_QList: Head of active controller list on this object - // Elements: SCA_IController - SG_QList m_activeControllers; - // SG_Dlist: element of list of lists of active controllers - // Head: SCA_LogicManager::m_activeControllers - // SG_QList: Head of active bookmarked controller list globally - // Elements: SCA_IController with bookmark option - static SG_QList m_activeBookmarkedControllers; - - static class MT_Point3 m_sDummy; - - /** - * Ignore activity culling requests? - */ - bool m_ignore_activity_culling; - - /** - * Ignore updates? - */ - bool m_suspended; - - /** - * init state of object (used when object is created) - */ - unsigned int m_initState; - - /** - * current state = bit mask of state that are active - */ - unsigned int m_state; - - /** - * pointer inside state actuator list for sorting - */ - SG_QList* m_firstState; - -public: - - SCA_IObject(); - virtual ~SCA_IObject(); - - SCA_ControllerList& GetControllers() - { - return m_controllers; - } - SCA_SensorList& GetSensors() - { - return m_sensors; - } - SCA_ActuatorList& GetActuators() - { - return m_actuators; - } - SG_QList& GetActiveActuators() - { - return m_activeActuators; - } - - void AddSensor(SCA_ISensor* act); - void ReserveSensor(int num) - { - m_sensors.reserve(num); - } - void AddController(SCA_IController* act); - void ReserveController(int num) - { - m_controllers.reserve(num); - } - void AddActuator(SCA_IActuator* act); - void ReserveActuator(int num) - { - m_actuators.reserve(num); - } - void RegisterActuator(SCA_IActuator* act); - void UnregisterActuator(SCA_IActuator* act); - - void RegisterObject(SCA_IObject* objs); - void UnregisterObject(SCA_IObject* objs); - /** - * UnlinkObject(...) - * this object is informed that one of the object to which it holds a reference is deleted - * returns true if there was indeed a reference. - */ - virtual bool UnlinkObject(SCA_IObject* clientobj) { return false; } - - SCA_ISensor* FindSensor(const STR_String& sensorname); - SCA_IActuator* FindActuator(const STR_String& actuatorname); - SCA_IController* FindController(const STR_String& controllername); - - void SetCurrentTime(float currentTime) {} - - virtual void ReParentLogic(); - - /** - * Set whether or not to ignore activity culling requests - */ - void SetIgnoreActivityCulling(bool b) - { - m_ignore_activity_culling = b; - } - - /** - * Set whether or not this object wants to ignore activity culling - * requests - */ - bool GetIgnoreActivityCulling() - { - return m_ignore_activity_culling; - } - - /** - * Suspend all progress. - */ - void Suspend(void); - - /** - * Resume progress - */ - void Resume(void); - - /** - * Set init state - */ - void SetInitState(unsigned int initState) { m_initState = initState; } - - /** - * initialize the state when object is created - */ - void ResetState(void) { SetState(m_initState); } - - /** - * Set the object state - */ - void SetState(unsigned int state); - - /** - * Get the object state - */ - unsigned int GetState(void) { return m_state; } - -// const class MT_Point3& ConvertPythonPylist(PyObject* pylist); - - virtual int GetGameObjectType() {return -1;} - - typedef enum ObjectTypes { - OBJ_ARMATURE=0, - OBJ_CAMERA=1, - OBJ_LIGHT=2, - }ObjectTypes; - -}; - -#endif //SCA_IOBJECT_H - diff --git a/source/gameengine/GameLogic/SCA_IScene.cpp b/source/gameengine/GameLogic/SCA_IScene.cpp deleted file mode 100644 index 75e323efe94..00000000000 --- a/source/gameengine/GameLogic/SCA_IScene.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_IScene.h" -#include "Value.h" - -SCA_DebugProp::SCA_DebugProp(): m_obj(NULL) -{ -} - -SCA_DebugProp::~SCA_DebugProp() -{ - if (m_obj) - m_obj->Release(); -} - -SCA_IScene::SCA_IScene() -{ -} - -void SCA_IScene::RemoveAllDebugProperties() -{ - for (std::vector::iterator it = m_debugList.begin(); - !(it==m_debugList.end());++it) - { - delete (*it); - } - m_debugList.clear(); -} - - -SCA_IScene::~SCA_IScene() -{ - RemoveAllDebugProperties(); -} - - -std::vector& SCA_IScene::GetDebugProperties() -{ - return m_debugList; -} - - - -void SCA_IScene::AddDebugProperty(class CValue* debugprop, - const STR_String &name) -{ - SCA_DebugProp* dprop = new SCA_DebugProp(); - dprop->m_obj = debugprop; - debugprop->AddRef(); - dprop->m_name = name; - m_debugList.push_back(dprop); -} diff --git a/source/gameengine/GameLogic/SCA_IScene.h b/source/gameengine/GameLogic/SCA_IScene.h deleted file mode 100644 index 7fd04e9d27f..00000000000 --- a/source/gameengine/GameLogic/SCA_IScene.h +++ /dev/null @@ -1,81 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_ISCENE_H -#define __KX_ISCENE_H - -#include - -#include "STR_String.h" -#include "RAS_2DFilterManager.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -struct SCA_DebugProp -{ - class CValue* m_obj; - STR_String m_name; - SCA_DebugProp(); - ~SCA_DebugProp(); -}; - -class SCA_IScene -{ - std::vector m_debugList; -public: - SCA_IScene(); - virtual ~SCA_IScene(); - virtual class SCA_IObject* AddReplicaObject(class CValue* gameobj, - class CValue* locationobj, - int lifespan=0)=0; - virtual void RemoveObject(class CValue* gameobj)=0; - virtual void DelayedRemoveObject(class CValue* gameobj)=0; - //virtual void DelayedReleaseObject(class CValue* gameobj)=0; - - virtual void ReplaceMesh(class CValue* gameobj, - void* meshobj, bool use_gfx, bool use_phys)=0; - std::vector& GetDebugProperties(); - void AddDebugProperty(class CValue* debugprop, - const STR_String &name); - void RemoveAllDebugProperties(); - virtual void Update2DFilter(vector& propNames, void* gameObj, - RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, - int pass, STR_String& text) {} - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_IScene"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_ISCENE_H - diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp deleted file mode 100644 index bff02326c9c..00000000000 --- a/source/gameengine/GameLogic/SCA_ISensor.cpp +++ /dev/null @@ -1,421 +0,0 @@ -/** - * Abstract class for sensor logic bricks - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_ISensor.h" -#include "SCA_EventManager.h" -#include "SCA_LogicManager.h" -// needed for IsTriggered() -#include "SCA_PythonController.h" - -#include - -/* Native functions */ -void SCA_ISensor::ReParent(SCA_IObject* parent) -{ - SCA_ILogicBrick::ReParent(parent); - // will be done when the sensor is activated - //m_eventmgr->RegisterSensor(this); - //this->SetActive(false); -} - - -SCA_ISensor::SCA_ISensor(SCA_IObject* gameobj, - class SCA_EventManager* eventmgr) : - SCA_ILogicBrick(gameobj) -{ - m_links = 0; - m_suspended = false; - m_invert = false; - m_level = false; - m_tap = false; - m_reset = false; - m_pos_ticks = 0; - m_neg_ticks = 0; - m_pos_pulsemode = false; - m_neg_pulsemode = false; - m_pulse_frequency = 0; - m_state = false; - m_prev_state = false; - - m_eventmgr = eventmgr; -} - - -SCA_ISensor::~SCA_ISensor() -{ - // intentionally empty -} - -void SCA_ISensor::ProcessReplica() -{ - SCA_ILogicBrick::ProcessReplica(); - m_linkedcontrollers.clear(); -} - -bool SCA_ISensor::IsPositiveTrigger() { - bool result = false; - - if (m_eventval) { - result = (m_eventval->GetNumber() != 0.0); - } - if (m_invert) { - result = !result; - } - - return result; -} - -void SCA_ISensor::SetPulseMode(bool posmode, - bool negmode, - int freq) { - m_pos_pulsemode = posmode; - m_neg_pulsemode = negmode; - m_pulse_frequency = freq; -} - -void SCA_ISensor::SetInvert(bool inv) { - m_invert = inv; -} - -void SCA_ISensor::SetLevel(bool lvl) { - m_level = lvl; -} - -void SCA_ISensor::SetTap(bool tap) { - m_tap = tap; -} - - -double SCA_ISensor::GetNumber() { - return GetState(); -} - -void SCA_ISensor::Suspend() { - m_suspended = true; -} - -bool SCA_ISensor::IsSuspended() { - return m_suspended; -} - -void SCA_ISensor::Resume() { - m_suspended = false; -} - -void SCA_ISensor::Init() { - printf("Sensor %s has no init function, please report this bug to Blender.org\n", m_name.Ptr()); -} - -void SCA_ISensor::DecLink() { - m_links--; - if (m_links < 0) - { - printf("Warning: sensor %s has negative m_links: %d\n", m_name.Ptr(), m_links); - m_links = 0; - } - if (!m_links) - { - // sensor is detached from all controllers, remove it from manager - UnregisterToManager(); - } -} - -void SCA_ISensor::RegisterToManager() -{ - // sensor is just activated, initialize it - Init(); - m_state = false; - m_eventmgr->RegisterSensor(this); -} - -void SCA_ISensor::Replace_EventManager(class SCA_LogicManager* logicmgr) -{ - if(m_links) { /* true if we're used currently */ - - m_eventmgr->RemoveSensor(this); - m_eventmgr= logicmgr->FindEventManager(m_eventmgr->GetType()); - m_eventmgr->RegisterSensor(this); - } - else { - m_eventmgr= logicmgr->FindEventManager(m_eventmgr->GetType()); - } -} - -void SCA_ISensor::LinkToController(SCA_IController* controller) -{ - m_linkedcontrollers.push_back(controller); -} - -void SCA_ISensor::UnlinkController(SCA_IController* controller) -{ - std::vector::iterator contit; - for (contit = m_linkedcontrollers.begin();!(contit==m_linkedcontrollers.end());++contit) - { - if ((*contit) == controller) - { - *contit = m_linkedcontrollers.back(); - m_linkedcontrollers.pop_back(); - return; - } - } - printf("Missing link from sensor %s:%s to controller %s:%s\n", - m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), - controller->GetParent()->GetName().ReadPtr(), controller->GetName().ReadPtr()); -} - -void SCA_ISensor::UnlinkAllControllers() -{ - std::vector::iterator contit; - for (contit = m_linkedcontrollers.begin();!(contit==m_linkedcontrollers.end());++contit) - { - (*contit)->UnlinkSensor(this); - } - m_linkedcontrollers.clear(); -} - -void SCA_ISensor::UnregisterToManager() -{ - m_eventmgr->RemoveSensor(this); - m_links = 0; -} - -void SCA_ISensor::ActivateControllers(class SCA_LogicManager* logicmgr) -{ - for(vector::const_iterator c= m_linkedcontrollers.begin(); - c!=m_linkedcontrollers.end();++c) - { - SCA_IController* contr = *c; - if (contr->IsActive()) - logicmgr->AddTriggeredController(contr, this); - } -} - -void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr) -{ - - // calculate if a __triggering__ is wanted - // don't evaluate a sensor that is not connected to any controller - if (m_links && !m_suspended) { - bool result = this->Evaluate(); - // store the state for the rest of the logic system - m_prev_state = m_state; - m_state = this->IsPositiveTrigger(); - if (result) { - // the sensor triggered this frame - if (m_state || !m_tap) { - ActivateControllers(logicmgr); - // reset these counters so that pulse are synchronized with transition - m_pos_ticks = 0; - m_neg_ticks = 0; - } else - { - result = false; - } - } else - { - /* First, the pulsing behaviour, if pulse mode is - * active. It seems something goes wrong if pulse mode is - * not set :( */ - if (m_pos_pulsemode) { - m_pos_ticks++; - if (m_pos_ticks > m_pulse_frequency) { - if ( m_state ) - { - ActivateControllers(logicmgr); - result = true; - } - m_pos_ticks = 0; - } - } - // negative pulse doesn't make sense in tap mode, skip - if (m_neg_pulsemode && !m_tap) - { - m_neg_ticks++; - if (m_neg_ticks > m_pulse_frequency) { - if (!m_state ) - { - ActivateControllers(logicmgr); - result = true; - } - m_neg_ticks = 0; - } - } - } - if (m_tap) - { - // in tap mode: we send always a negative pulse immediately after a positive pulse - if (!result) - { - // the sensor did not trigger on this frame - if (m_prev_state) - { - // but it triggered on previous frame => send a negative pulse - ActivateControllers(logicmgr); - result = true; - } - // in any case, absence of trigger means sensor off - m_state = false; - } - } - if (!result && m_level) - { - // This level sensor is connected to at least one controller that was just made - // active but it did not generate an event yet, do it now to those controllers only - for(vector::const_iterator c= m_linkedcontrollers.begin(); - c!=m_linkedcontrollers.end();++c) - { - SCA_IController* contr = *c; - if (contr->IsJustActivated()) - logicmgr->AddTriggeredController(contr, this); - } - } - } -} - -#ifndef DISABLE_PYTHON - -/* ----------------------------------------------- */ -/* Python Functions */ -/* ----------------------------------------------- */ - -KX_PYMETHODDEF_DOC_NOARGS(SCA_ISensor, reset, -"reset()\n" -"\tReset sensor internal state, effect depends on the type of sensor and settings.\n" -"\tThe sensor is put in its initial state as if it was just activated.\n") -{ - Init(); - m_prev_state = false; - Py_RETURN_NONE; -} - -/* ----------------------------------------------- */ -/* Python Integration Hooks */ -/* ----------------------------------------------- */ - -PyTypeObject SCA_ISensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_ISensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ILogicBrick::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_ISensor::Methods[] = { - KX_PYMETHODTABLE_NOARGS(SCA_ISensor, reset), - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_ISensor::Attributes[] = { - KX_PYATTRIBUTE_BOOL_RW("usePosPulseMode",SCA_ISensor,m_pos_pulsemode), - KX_PYATTRIBUTE_BOOL_RW("useNegPulseMode",SCA_ISensor,m_neg_pulsemode), - KX_PYATTRIBUTE_INT_RW("frequency",0,100000,true,SCA_ISensor,m_pulse_frequency), - KX_PYATTRIBUTE_BOOL_RW("invert",SCA_ISensor,m_invert), - KX_PYATTRIBUTE_BOOL_RW_CHECK("level",SCA_ISensor,m_level,pyattr_check_level), - KX_PYATTRIBUTE_BOOL_RW_CHECK("tap",SCA_ISensor,m_tap,pyattr_check_tap), - KX_PYATTRIBUTE_RO_FUNCTION("triggered", SCA_ISensor, pyattr_get_triggered), - KX_PYATTRIBUTE_RO_FUNCTION("positive", SCA_ISensor, pyattr_get_positive), - KX_PYATTRIBUTE_RO_FUNCTION("status", SCA_ISensor, pyattr_get_status), - //KX_PYATTRIBUTE_TODO("links"), - //KX_PYATTRIBUTE_TODO("posTicks"), - //KX_PYATTRIBUTE_TODO("negTicks"), - { NULL } //Sentinel -}; - - -PyObject* SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_ISensor* self= static_cast(self_v); - int retval = 0; - if (SCA_PythonController::m_sCurrentController) - retval = SCA_PythonController::m_sCurrentController->IsTriggered(self); - return PyLong_FromSsize_t(retval); -} - -PyObject* SCA_ISensor::pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_ISensor* self= static_cast(self_v); - return PyLong_FromSsize_t(self->GetState()); -} - -PyObject* SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_ISensor* self= static_cast(self_v); - int status = 0; - if (self->GetState()) - { - if (self->GetState() == self->GetPrevState()) - { - status = 2; - } - else - { - status = 1; - } - } - else if (self->GetState() != self->GetPrevState()) - { - status = 3; - } - return PyLong_FromSsize_t(status); -} - -int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_ISensor* self= static_cast(self_v); - if (self->m_level) - self->m_tap = false; - return 0; -} - -int SCA_ISensor::pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_ISensor* self= static_cast(self_v); - if (self->m_tap) - self->m_level = false; - return 0; -} -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h deleted file mode 100644 index 42d06d856b6..00000000000 --- a/source/gameengine/GameLogic/SCA_ISensor.h +++ /dev/null @@ -1,202 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Interface Class for all logic Sensors. Implements - * pulsemode and pulsefrequency, and event suppression. - */ - -#ifndef __SCA_ISENSOR -#define __SCA_ISENSOR - -#include "SCA_IController.h" - -#include - -/** - * Interface Class for all logic Sensors. Implements - * pulsemode,pulsefrequency - * Use of SG_DList element: link sensors to their respective event manager - * Head: SCA_EventManager::m_sensors - * Use of SG_QList element: not used - */ -class SCA_ISensor : public SCA_ILogicBrick -{ - Py_Header; -protected: - class SCA_EventManager* m_eventmgr; - - /** Pulse positive pulses? */ - bool m_pos_pulsemode; - - /** Pulse negative pulses? */ - bool m_neg_pulsemode; - - /** Repeat frequency in pulse mode. */ - int m_pulse_frequency; - - /** Number of ticks since the last positive pulse. */ - int m_pos_ticks; - - /** Number of ticks since the last negative pulse. */ - int m_neg_ticks; - - /** invert the output signal*/ - bool m_invert; - - /** detect level instead of edge*/ - bool m_level; - - /** tap mode */ - bool m_tap; - - /** sensor has been reset */ - bool m_reset; - - /** Sensor must ignore updates? */ - bool m_suspended; - - /** number of connections to controller */ - int m_links; - - /** current sensor state */ - bool m_state; - - /** previous state (for tap option) */ - bool m_prev_state; - - std::vector m_linkedcontrollers; - -public: - - enum sensortype { - ST_NONE = 0, - ST_TOUCH, - ST_NEAR, - ST_RADAR, - // to be updated as needed - }; - - SCA_ISensor(SCA_IObject* gameobj, - class SCA_EventManager* eventmgr);; - ~SCA_ISensor(); - virtual void ReParent(SCA_IObject* parent); - - /** Because we want sensors to share some behaviour, the Activate has */ - /* an implementation on this level. It requires an evaluate on the lower */ - /* level of individual sensors. Mapping the old activate()s is easy. */ - /* The IsPosTrig() also has to change, to keep things consistent. */ - void Activate(class SCA_LogicManager* logicmgr); - virtual bool Evaluate() = 0; - virtual bool IsPositiveTrigger(); - virtual void Init(); - - virtual CValue* GetReplica()=0; - - /** Set parameters for the pulsing behaviour. - * @param posmode Trigger positive pulses? - * @param negmode Trigger negative pulses? - * @param freq Frequency to use when doing pulsing. - */ - void SetPulseMode(bool posmode, - bool negmode, - int freq); - - /** Set inversion of pulses on or off. */ - void SetInvert(bool inv); - /** set the level detection on or off */ - void SetLevel(bool lvl); - void SetTap(bool tap); - - virtual void RegisterToManager(); - virtual void UnregisterToManager(); - void Replace_EventManager(class SCA_LogicManager* logicmgr); - void ReserveController(int num) - { - m_linkedcontrollers.reserve(num); - } - void LinkToController(SCA_IController* controller); - void UnlinkController(SCA_IController* controller); - void UnlinkAllControllers(); - void ActivateControllers(class SCA_LogicManager* logicmgr); - - virtual void ProcessReplica(); - - virtual double GetNumber(); - - virtual sensortype GetSensorType() { return ST_NONE; } - - /** Stop sensing for a while. */ - void Suspend(); - - /** Is this sensor switched off? */ - bool IsSuspended(); - - /** get the state of the sensor: positive or negative */ - bool GetState() - { - return m_state; - } - - /** get the previous state of the sensor: positive or negative */ - bool GetPrevState() - { - return m_prev_state; - } - - /** Resume sensing. */ - void Resume(); - - void ClrLink() - { m_links = 0; } - void IncLink() - { if (!m_links++) RegisterToManager(); } - void DecLink(); - bool IsNoLink() const - { return !m_links; } - -#ifndef DISABLE_PYTHON - /* Python functions: */ - KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,reset); - - static PyObject* pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - - enum SensorStatus { - KX_SENSOR_INACTIVE = 0, - KX_SENSOR_JUST_ACTIVATED, - KX_SENSOR_ACTIVE, - KX_SENSOR_JUST_DEACTIVATED - - }; -#endif // DISABLE_PYTHON -}; - -#endif //__SCA_ISENSOR - diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp deleted file mode 100644 index 5a975552d3d..00000000000 --- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "SCA_JoystickSensor.h" -#include "SCA_JoystickManager.h" -#include "SCA_LogicManager.h" -//#include -#include "SCA_ISensor.h" - -//using namespace std; - - -SCA_JoystickManager::SCA_JoystickManager(class SCA_LogicManager* logicmgr) - : SCA_EventManager(logicmgr, JOY_EVENTMGR) -{ - int i; - for (i=0; iReleaseInstance(); - } -} - - -void SCA_JoystickManager::NextFrame(double curtime,double deltatime) -{ - if (m_sensors.Empty()) { - return; - } - else { - ; -#ifndef DISABLE_SDL - SCA_Joystick::HandleEvents(); /* Handle all SDL Joystick events */ -#endif - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - SCA_JoystickSensor* joysensor = *it; - if(!joysensor->IsSuspended()) - { - joysensor->Activate(m_logicmgr); - } - } - } -} - - -SCA_Joystick *SCA_JoystickManager::GetJoystickDevice( short int joyindex) -{ - /* - *Return the instance of SCA_Joystick for use - */ - return m_joystick[joyindex]; -} diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.h b/source/gameengine/GameLogic/SCA_JoystickManager.h deleted file mode 100644 index cde2e866815..00000000000 --- a/source/gameengine/GameLogic/SCA_JoystickManager.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __JOYSTICKMANAGER_H_ -#define __JOYSTICKMANAGER_H_ - -#include "SCA_EventManager.h" -#include "Joystick/SCA_Joystick.h" -#include - -using namespace std; -class SCA_JoystickManager : public SCA_EventManager -{ - /** - * SDL Joystick Class Instance - */ - SCA_Joystick *m_joystick[JOYINDEX_MAX]; -public: - SCA_JoystickManager(class SCA_LogicManager* logicmgr); - virtual ~SCA_JoystickManager(); - virtual void NextFrame(double curtime,double deltatime); - SCA_Joystick* GetJoystickDevice(short int joyindex); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_JoystickManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp deleted file mode 100644 index 5ab42ae7608..00000000000 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "SCA_JoystickManager.h" -#include "SCA_JoystickSensor.h" - -#include "SCA_EventManager.h" -#include "SCA_LogicManager.h" - -#include "PyObjectPlus.h" - -#include -#include - - - -SCA_JoystickSensor::SCA_JoystickSensor(class SCA_JoystickManager* eventmgr, - SCA_IObject* gameobj, - short int joyindex, - short int joymode, - int axis, int axisf,int prec, - int button, - int hat, int hatf, bool allevents) - :SCA_ISensor(gameobj,eventmgr), - m_axis(axis), - m_axisf(axisf), - m_button(button), - m_hat(hat), - m_hatf(hatf), - m_precision(prec), - m_joymode(joymode), - m_joyindex(joyindex), - m_bAllEvents(allevents) -{ -/* -std::cout << " axis " << m_axis << std::endl; -std::cout << " axis flag " << m_axisf << std::endl; -std::cout << " precision " << m_precision << std::endl; -std::cout << " button " << m_button << std::endl; -std::cout << " hat " << m_hat << std::endl; -std::cout << " hat flag " << m_hatf << std::endl; -*/ - Init(); -} - -void SCA_JoystickSensor::Init() -{ - m_istrig=(m_invert)?1:0; - m_istrig_prev=0; - m_reset = true; -} - -SCA_JoystickSensor::~SCA_JoystickSensor() -{ -} - - -CValue* SCA_JoystickSensor::GetReplica() -{ - SCA_JoystickSensor* replica = new SCA_JoystickSensor(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - replica->Init(); - return replica; -} - - -bool SCA_JoystickSensor::IsPositiveTrigger() -{ - bool result = m_istrig; - if (m_invert) - result = !result; - return result; -} - - -bool SCA_JoystickSensor::Evaluate() -{ - SCA_Joystick *js = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); - bool result = false; - bool reset = m_reset && m_level; - - if(js==NULL) /* no joystick - dont do anything */ - return false; - - m_reset = false; - switch(m_joymode) - { - case KX_JOYSENSORMODE_AXIS: - { - /* what is what! - m_axisf == JOYAXIS_RIGHT, JOYAXIS_UP, JOYAXIS_DOWN, JOYAXIS_LEFT - m_axisf == 1 == up - m_axisf == 2 == left - m_axisf == 3 == down - - numberof== m_axis (1-4), range is half of JOYAXIS_MAX since - it assumes the axis joysticks are axis parirs (0,1), (2,3), etc - also note that this starts at 1 where functions its used - with expect a zero index. - */ - - if (!js->IsTrigAxis() && !reset) /* No events from SDL? - dont bother */ - return false; - - js->cSetPrecision(m_precision); - if (m_bAllEvents) { - if(js->aAxisPairIsPositive(m_axis-1)){ /* use zero based axis index internally */ - m_istrig = 1; - result = true; - }else{ - if(m_istrig){ - m_istrig = 0; - result = true; - } - } - } - else { - if(js->aAxisPairDirectionIsPositive(m_axis-1, m_axisf)){ /* use zero based axis index internally */ - m_istrig = 1; - result = true; - }else{ - if(m_istrig){ - m_istrig = 0; - result = true; - } - } - } - break; - } - case KX_JOYSENSORMODE_AXIS_SINGLE: - { - /* Like KX_JOYSENSORMODE_AXIS but dont pair up axis */ - if (!js->IsTrigAxis() && !reset) /* No events from SDL? - dont bother */ - return false; - - /* No need for 'm_bAllEvents' check here since were only checking 1 axis */ - js->cSetPrecision(m_precision); - if(js->aAxisIsPositive(m_axis-1)){ /* use zero based axis index internally */ - m_istrig = 1; - result = true; - }else{ - if(m_istrig){ - m_istrig = 0; - result = true; - } - } - break; - } - - case KX_JOYSENSORMODE_BUTTON: - { - /* what is what! - m_button = the actual button in question - */ - if (!js->IsTrigButton() && !reset) /* No events from SDL? - dont bother */ - return false; - - if(( m_bAllEvents && js->aAnyButtonPressIsPositive()) || (!m_bAllEvents && js->aButtonPressIsPositive(m_button))) { - m_istrig = 1; - result = true; - }else { - if(m_istrig){ - m_istrig = 0; - result = true; - } - } - break; - } - case KX_JOYSENSORMODE_HAT: - { - /* what is what! - numberof = m_hat -- max 4 - direction= m_hatf -- max 12 - */ - - if (!js->IsTrigHat() && !reset) /* No events from SDL? - dont bother */ - return false; - - if((m_bAllEvents && js->GetHat(m_hat-1)) || js->aHatIsPositive(m_hat-1, m_hatf)) { - m_istrig = 1; - result = true; - }else{ - if(m_istrig){ - m_istrig = 0; - result = true; - } - } - break; - } - /* test for ball anyone ?*/ - default: - printf("Error invalid switch statement\n"); - break; - } - - /* if not all events are enabled, only send a positive pulse when - * the button state changes */ - if (!m_bAllEvents) { - if (m_istrig_prev == m_istrig) { - result = false; - } else { - m_istrig_prev = m_istrig; - } - } - - if (reset) - result = true; - - return result; -} - - -bool SCA_JoystickSensor::isValid(SCA_JoystickSensor::KX_JOYSENSORMODE m) -{ - bool res = false; - res = ((m > KX_JOYSENSORMODE_NODEF) && (m < KX_JOYSENSORMODE_MAX)); - return res; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_JoystickSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_JoystickSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_JoystickSensor::Methods[] = { - {"getButtonActiveList",(PyCFunction) SCA_JoystickSensor::sPyGetButtonActiveList, METH_NOARGS,(const char *)GetButtonActiveList_doc}, - {"getButtonStatus",(PyCFunction) SCA_JoystickSensor::sPyGetButtonStatus, METH_VARARGS,(const char *)GetButtonStatus_doc}, - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_JoystickSensor::Attributes[] = { - KX_PYATTRIBUTE_SHORT_RW("index",0,JOYINDEX_MAX-1,true,SCA_JoystickSensor,m_joyindex), - KX_PYATTRIBUTE_INT_RW("threshold",0,32768,true,SCA_JoystickSensor,m_precision), - KX_PYATTRIBUTE_INT_RW("button",0,100,false,SCA_JoystickSensor,m_button), - KX_PYATTRIBUTE_INT_LIST_RW_CHECK("axis",0,3,true,SCA_JoystickSensor,m_axis,2,CheckAxis), - KX_PYATTRIBUTE_INT_LIST_RW_CHECK("hat",0,12,true,SCA_JoystickSensor,m_hat,2,CheckHat), - KX_PYATTRIBUTE_RO_FUNCTION("axisValues", SCA_JoystickSensor, pyattr_get_axis_values), - KX_PYATTRIBUTE_RO_FUNCTION("axisSingle", SCA_JoystickSensor, pyattr_get_axis_single), - KX_PYATTRIBUTE_RO_FUNCTION("hatValues", SCA_JoystickSensor, pyattr_get_hat_values), - KX_PYATTRIBUTE_RO_FUNCTION("hatSingle", SCA_JoystickSensor, pyattr_get_hat_single), - KX_PYATTRIBUTE_RO_FUNCTION("numAxis", SCA_JoystickSensor, pyattr_get_num_axis), - KX_PYATTRIBUTE_RO_FUNCTION("numButtons", SCA_JoystickSensor, pyattr_get_num_buttons), - KX_PYATTRIBUTE_RO_FUNCTION("numHats", SCA_JoystickSensor, pyattr_get_num_hats), - KX_PYATTRIBUTE_RO_FUNCTION("connected", SCA_JoystickSensor, pyattr_get_connected), - //KX_PYATTRIBUTE_TODO("events"), - { NULL } //Sentinel -}; - -/* get button active list -------------------------------------------------- */ -const char SCA_JoystickSensor::GetButtonActiveList_doc[] = -"getButtonActiveList\n" -"\tReturns a list containing the indicies of the button currently pressed.\n"; -PyObject* SCA_JoystickSensor::PyGetButtonActiveList( ) { - SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); - PyObject *ls = PyList_New(0); - PyObject *value; - int i; - - if(joy) { - for (i=0; i < joy->GetNumberOfButtons(); i++) { - if (joy->aButtonPressIsPositive(i)) { - value = PyLong_FromSsize_t(i); - PyList_Append(ls, value); - Py_DECREF(value); - } - } - } - return ls; -} - -/* get button status -------------------------------------------------- */ -const char SCA_JoystickSensor::GetButtonStatus_doc[] = -"getButtonStatus(buttonIndex)\n" -"\tReturns a bool of the current pressed state of the specified button.\n"; -PyObject* SCA_JoystickSensor::PyGetButtonStatus( PyObject* args ) { - SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); - int index; - - if(!PyArg_ParseTuple(args, "i:getButtonStatus", &index)){ - return NULL; - } - if(joy && index >= 0 && index < joy->GetNumberOfButtons()) { - return PyBool_FromLong(joy->aButtonPressIsPositive(index) ? 1 : 0); - } - return PyBool_FromLong(0); -} - -PyObject* SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_JoystickSensor* self= static_cast(self_v); - SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - - int axis_index= joy->GetNumberOfAxes(); - PyObject *list= PyList_New(axis_index); - - while(axis_index--) { - PyList_SET_ITEM(list, axis_index, PyLong_FromSsize_t(joy->GetAxisPosition(axis_index))); - } - - return list; -} - -PyObject* SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_JoystickSensor* self= static_cast(self_v); - SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - - if(self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) { - PyErr_SetString(PyExc_TypeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type"); - return NULL; - } - - return PyLong_FromSsize_t(joy->GetAxisPosition(self->m_axis-1)); -} - -PyObject* SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_JoystickSensor* self= static_cast(self_v); - SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - - int hat_index= joy->GetNumberOfHats(); - PyObject *list= PyList_New(hat_index); - - while(hat_index--) { - PyList_SET_ITEM(list, hat_index, PyLong_FromSsize_t(joy->GetHat(hat_index))); - } - - return list; -} - -PyObject* SCA_JoystickSensor::pyattr_get_hat_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_JoystickSensor* self= static_cast(self_v); - SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - - return PyLong_FromSsize_t(joy->GetHat(self->m_hat-1)); -} - -PyObject* SCA_JoystickSensor::pyattr_get_num_axis(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_JoystickSensor* self= static_cast(self_v); - SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - return PyLong_FromSsize_t( joy ? joy->GetNumberOfAxes() : 0 ); -} - -PyObject* SCA_JoystickSensor::pyattr_get_num_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_JoystickSensor* self= static_cast(self_v); - SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - return PyLong_FromSsize_t( joy ? joy->GetNumberOfButtons() : 0 ); -} - -PyObject* SCA_JoystickSensor::pyattr_get_num_hats(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_JoystickSensor* self= static_cast(self_v); - SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - return PyLong_FromSsize_t( joy ? joy->GetNumberOfHats() : 0 ); -} - -PyObject* SCA_JoystickSensor::pyattr_get_connected(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_JoystickSensor* self= static_cast(self_v); - SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - return PyBool_FromLong( joy ? joy->Connected() : 0 ); -} - -#endif diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.h b/source/gameengine/GameLogic/SCA_JoystickSensor.h deleted file mode 100644 index 90fb16de747..00000000000 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.h +++ /dev/null @@ -1,164 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - - -#ifndef __JOYSENSOR_H_ -#define __JOYSENSOR_H - -#include "SCA_ISensor.h" -#include "./Joystick/SCA_JoystickDefines.h" - -class SCA_JoystickSensor :public SCA_ISensor -{ - Py_Header; - - /** - * Axis 1-JOYAXIS_MAX, MUST be followed by m_axisf - */ - int m_axis; - /** - * Axis flag to find direction, MUST be an int - */ - int m_axisf; - /** - * The actual button - */ - int m_button; - /** - * Flag for a pressed or released button - */ - int m_buttonf; - /** - * The actual hat 1-JOYHAT_MAX. MUST be followed by m_hatf - */ - int m_hat; - /** - * Flag to find direction 1-12, MUST be an int - */ - int m_hatf; - /** - * The threshold value the axis acts opon - */ - int m_precision; - /** - * Is an event triggered ? - */ - bool m_istrig; - /** - * Last trigger state for this sensors joystick, - * Otherwise it will trigger all the time - * this is used to see if the trigger state changes. - */ - bool m_istrig_prev; - /** - * The mode to determine axis,button or hat - */ - short int m_joymode; - /** - * Select which joystick to use - */ - short int m_joyindex; - - /** - * Detect all events for the currently selected type - */ - bool m_bAllEvents; - - enum KX_JOYSENSORMODE { - KX_JOYSENSORMODE_NODEF = 0, - KX_JOYSENSORMODE_AXIS, - KX_JOYSENSORMODE_BUTTON, - KX_JOYSENSORMODE_HAT, - KX_JOYSENSORMODE_AXIS_SINGLE, - KX_JOYSENSORMODE_MAX - }; - bool isValid(KX_JOYSENSORMODE); - -public: - SCA_JoystickSensor(class SCA_JoystickManager* eventmgr, - SCA_IObject* gameobj, - short int joyindex, - short int joymode, - int axis, int axisf,int prec, - int button, - int hat, int hatf, bool allevents); - virtual ~SCA_JoystickSensor(); - virtual CValue* GetReplica(); - - virtual bool Evaluate(); - virtual bool IsPositiveTrigger(); - virtual void Init(); - - short int GetJoyIndex(void){ - return m_joyindex; - } - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - /* Joystick Index */ - KX_PYMETHOD_DOC_NOARGS(SCA_JoystickSensor,GetButtonActiveList); - KX_PYMETHOD_DOC_VARARGS(SCA_JoystickSensor,GetButtonStatus); - - static PyObject* pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_axis_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_hat_single(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_num_axis(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_num_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_num_hats(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_connected(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - - - /* attribute check */ - static int CheckAxis(void *self, const PyAttributeDef*) - { - SCA_JoystickSensor* sensor = reinterpret_cast(self); - if (sensor->m_axis < 1) - sensor->m_axis = 1; - else if (sensor->m_axis > JOYAXIS_MAX) - sensor->m_axis = JOYAXIS_MAX; - return 0; - } - static int CheckHat(void *self, const PyAttributeDef*) - { - SCA_JoystickSensor* sensor = reinterpret_cast(self); - if (sensor->m_hat < 1) - sensor->m_hat = 1; - else if (sensor->m_hat > JOYHAT_MAX) - sensor->m_hat = JOYHAT_MAX; - return 0; - } - -#endif // DISABLE_PYTHON - -}; - -#endif diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.cpp b/source/gameengine/GameLogic/SCA_KeyboardManager.cpp deleted file mode 100644 index eba904ba647..00000000000 --- a/source/gameengine/GameLogic/SCA_KeyboardManager.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Manager for keyboard events - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "BoolValue.h" -#include "SCA_KeyboardManager.h" -#include "SCA_KeyboardSensor.h" -#include "IntValue.h" -#include - -SCA_KeyboardManager::SCA_KeyboardManager(SCA_LogicManager* logicmgr, - SCA_IInputDevice* inputdev) - : SCA_EventManager(logicmgr, KEYBOARD_EVENTMGR), - m_inputDevice(inputdev) -{ -} - - - -SCA_KeyboardManager::~SCA_KeyboardManager() -{ -} - - - -SCA_IInputDevice* SCA_KeyboardManager::GetInputDevice() -{ - return m_inputDevice; -} - - - -void SCA_KeyboardManager::NextFrame() -{ - //const SCA_InputEvent& event = GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0; - // cerr << "SCA_KeyboardManager::NextFrame"<< endl; - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - (*it)->Activate(m_logicmgr); - } -} - -bool SCA_KeyboardManager::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - return false; - //return m_kxsystem->IsPressed(inputcode); -} - diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.h b/source/gameengine/GameLogic/SCA_KeyboardManager.h deleted file mode 100644 index a9fe208eaca..00000000000 --- a/source/gameengine/GameLogic/SCA_KeyboardManager.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Manager for keyboard events - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_KEYBOARDMANAGER -#define __KX_KEYBOARDMANAGER - - -#include "SCA_EventManager.h" - -#include - -using namespace std; - -#include "SCA_IInputDevice.h" - - -class SCA_KeyboardManager : public SCA_EventManager -{ - class SCA_IInputDevice* m_inputDevice; - -public: - SCA_KeyboardManager(class SCA_LogicManager* logicmgr,class SCA_IInputDevice* inputdev); - virtual ~SCA_KeyboardManager(); - - bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode); - - virtual void NextFrame(); - SCA_IInputDevice* GetInputDevice(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_KeyboardManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_KEYBOARDMANAGER - diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp deleted file mode 100644 index c49d65226dc..00000000000 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp +++ /dev/null @@ -1,643 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Sensor for keyboard input - */ -#include "SCA_KeyboardSensor.h" -#include "SCA_KeyboardManager.h" -#include "SCA_LogicManager.h" -#include "StringValue.h" -#include "SCA_IInputDevice.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_KeyboardSensor::SCA_KeyboardSensor(SCA_KeyboardManager* keybdmgr, - short int hotkey, - short int qual, - short int qual2, - bool bAllKeys, - const STR_String& targetProp, - const STR_String& toggleProp, - SCA_IObject* gameobj) - :SCA_ISensor(gameobj,keybdmgr), - m_hotkey(hotkey), - m_qual(qual), - m_qual2(qual2), - m_bAllKeys(bAllKeys), - m_targetprop(targetProp), - m_toggleprop(toggleProp) -{ - if (hotkey == SCA_IInputDevice::KX_ESCKEY) - keybdmgr->GetInputDevice()->HookEscape(); -// SetDrawColor(0xff0000ff); - Init(); -} - - - -SCA_KeyboardSensor::~SCA_KeyboardSensor() -{ -} - -void SCA_KeyboardSensor::Init() -{ - // this function is used when the sensor is disconnected from all controllers - // by the state engine. It reinitializes the sensor as if it was just created. - // However, if the target key is pressed when the sensor is reactivated, it - // will not generated an event (see remark in Evaluate()). - m_val = (m_invert)?1:0; - m_reset = true; -} - -CValue* SCA_KeyboardSensor::GetReplica() -{ - SCA_KeyboardSensor* replica = new SCA_KeyboardSensor(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - replica->Init(); - return replica; -} - - - -short int SCA_KeyboardSensor::GetHotkey() -{ - return m_hotkey; -} - - - -bool SCA_KeyboardSensor::IsPositiveTrigger() -{ - bool result = (m_val != 0); - - if (m_invert) - result = !result; - - return result; -} - - - -bool SCA_KeyboardSensor::TriggerOnAllKeys() -{ - return m_bAllKeys; -} - - - -bool SCA_KeyboardSensor::Evaluate() -{ - bool result = false; - bool reset = m_reset && m_level; - bool qual = true; - bool qual_change = false; - short int m_val_orig = m_val; - - SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); - // cerr << "SCA_KeyboardSensor::Eval event, sensing for "<< m_hotkey << " at device " << inputdev << "\n"; - - /* See if we need to do logging: togPropState exists and is - * different from 0 */ - CValue* myparent = GetParent(); - CValue* togPropState = myparent->GetProperty(m_toggleprop); - if (togPropState && - (((int)togPropState->GetNumber()) != 0) ) - { - LogKeystrokes(); - } - - m_reset = false; - - /* Now see whether events must be bounced. */ - if (m_bAllKeys) - { - bool justactivated = false; - bool justreleased = false; - bool active = false; - - for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) - { - const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); - switch (inevent.m_status) - { - case SCA_InputEvent::KX_JUSTACTIVATED: - justactivated = true; - break; - case SCA_InputEvent::KX_JUSTRELEASED: - justreleased = true; - break; - case SCA_InputEvent::KX_ACTIVE: - active = true; - break; - } - } - - if (justactivated) - { - m_val=1; - result = true; - } else - { - if (justreleased) - { - m_val=(active)?1:0; - result = true; - } else - { - if (active) - { - if (m_val == 0) - { - m_val = 1; - if (m_level) { - result = true; - } - } - } else - { - if (m_val == 1) - { - m_val = 0; - result = true; - } - } - } - if (m_tap) - // special case for tap mode: only generate event for new activation - result = false; - } - - - } else - { - - // cerr << "======= SCA_KeyboardSensor::Evaluate:: peeking at key status" << endl; - const SCA_InputEvent & inevent = inputdev->GetEventValue( - (SCA_IInputDevice::KX_EnumInputs) m_hotkey); - - // cerr << "======= SCA_KeyboardSensor::Evaluate:: status: " << inevent.m_status << endl; - - - /* Check qualifier keys - * - see if the qualifiers we request are pressed - 'qual' true/false - * - see if the qualifiers we request changed their state - 'qual_change' true/false - */ - if (m_qual > 0) { - const SCA_InputEvent & qualevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) m_qual); - switch(qualevent.m_status) { - case SCA_InputEvent::KX_NO_INPUTSTATUS: - qual = false; - break; - case SCA_InputEvent::KX_JUSTRELEASED: - qual_change = true; - qual = false; - break; - case SCA_InputEvent::KX_JUSTACTIVATED: - qual_change = true; - } - } - if (m_qual2 > 0 && qual==true) { - const SCA_InputEvent & qualevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) m_qual2); - /* copy of above */ - switch(qualevent.m_status) { - case SCA_InputEvent::KX_NO_INPUTSTATUS: - qual = false; - break; - case SCA_InputEvent::KX_JUSTRELEASED: - qual_change = true; - qual = false; - break; - case SCA_InputEvent::KX_JUSTACTIVATED: - qual_change = true; - } - } - /* done reading qualifiers */ - - if (inevent.m_status == SCA_InputEvent::KX_NO_INPUTSTATUS) - { - if (m_val == 1) - { - // this situation may occur after a scene suspend: the keyboard release - // event was not captured, produce now the event off - m_val = 0; - result = true; - } - } else - { - if (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED) - { - m_val=1; - result = true; - } else - { - if (inevent.m_status == SCA_InputEvent::KX_JUSTRELEASED) - { - m_val = 0; - result = true; - } else - { - if (inevent.m_status == SCA_InputEvent::KX_ACTIVE) - { - if (m_val == 0) - { - m_val = 1; - if (m_level) - { - result = true; - } - } - } - } - } - } - - /* Modify the key state based on qual(s) - * Tested carefuly. dont touch unless your really sure. - * note, this will only change the results if key modifiers are set. - * - * When all modifiers and keys are positive - * - pulse true - * - * When ANY of the modifiers or main key become inactive, - * - pulse false - */ - if (qual==false) { /* one of the qualifiers are not pressed */ - if (m_val_orig && qual_change) { /* we were originally enabled, but a qualifier changed */ - result = true; - } else { - result = false; - } - m_val = 0; /* since one of the qualifiers is not on, set the state to false */ - } else { /* we done have any qualifiers or they are all pressed */ - if (m_val && qual_change) { /* the main key state is true and our qualifier just changed */ - result = true; - } - } - /* done with key quals */ - - } - - if (reset) - // force an event - result = true; - return result; - -} - -void SCA_KeyboardSensor::AddToTargetProp(int keyIndex) -{ - if (IsPrintable(keyIndex)) { - CValue* tprop = GetParent()->GetProperty(m_targetprop); - - if (tprop) { - /* overwrite the old property */ - if (IsDelete(keyIndex)) { - /* strip one char, if possible */ - STR_String newprop = tprop->GetText(); - int oldlength = newprop.Length(); - if (oldlength >= 1 ) { - newprop.SetLength(oldlength - 1); - CStringValue * newstringprop = new CStringValue(newprop, m_targetprop); - GetParent()->SetProperty(m_targetprop, newstringprop); - newstringprop->Release(); - } - } else { - /* append */ - char pchar = ToCharacter(keyIndex, IsShifted()); - STR_String newprop = tprop->GetText() + pchar; - CStringValue * newstringprop = new CStringValue(newprop, m_targetprop); - GetParent()->SetProperty(m_targetprop, newstringprop); - newstringprop->Release(); - } - } else { - if (!IsDelete(keyIndex)) { - /* Make a new property. Deletes can be ignored. */ - char pchar = ToCharacter(keyIndex, IsShifted()); - STR_String newprop = pchar; - CStringValue * newstringprop = new CStringValue(newprop, m_targetprop); - GetParent()->SetProperty(m_targetprop, newstringprop); - newstringprop->Release(); - } - } - } - -} - -/** - * Tests whether shift is pressed - */ -bool SCA_KeyboardSensor::IsShifted(void) -{ - SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); - - if ( (inputdev->GetEventValue(SCA_IInputDevice::KX_RIGHTSHIFTKEY).m_status - == SCA_InputEvent::KX_ACTIVE) - || (inputdev->GetEventValue(SCA_IInputDevice::KX_RIGHTSHIFTKEY).m_status - == SCA_InputEvent::KX_JUSTACTIVATED) - || (inputdev->GetEventValue(SCA_IInputDevice::KX_LEFTSHIFTKEY).m_status - == SCA_InputEvent::KX_ACTIVE) - || (inputdev->GetEventValue(SCA_IInputDevice::KX_LEFTSHIFTKEY).m_status - == SCA_InputEvent::KX_JUSTACTIVATED) - ) { - return true; - } else { - return false; - } -} - -void SCA_KeyboardSensor::LogKeystrokes(void) -{ - SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); - int num = inputdev->GetNumActiveEvents(); - - /* weird loop, this one... */ - if (num > 0) - { - - int index = 0; - /* Check on all keys whether they were pushed. This does not - * untangle the ordering, so don't type too fast :) */ - for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) - { - const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); - if (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED) //NO_INPUTSTATUS) - { - if (index < num) - { - AddToTargetProp(i); - index++; - } - } - } - } -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python Functions */ -/* ------------------------------------------------------------------------- */ - -KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus, -"getKeyStatus(keycode)\n" -"\tGet the given key's status (KX_NO_INPUTSTATUS, KX_JUSTACTIVATED, KX_ACTIVE or KX_JUSTRELEASED).\n") -{ - if (!PyLong_Check(value)) { - PyErr_SetString(PyExc_ValueError, "sensor.getKeyStatus(int): Keyboard Sensor, expected an int"); - return NULL; - } - - int keycode = PyLong_AsSsize_t(value); - - if ((keycode < SCA_IInputDevice::KX_BEGINKEY) - || (keycode > SCA_IInputDevice::KX_ENDKEY)){ - PyErr_SetString(PyExc_AttributeError, "sensor.getKeyStatus(int): Keyboard Sensor, invalid keycode specified!"); - return NULL; - } - - SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); - const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) keycode); - return PyLong_FromSsize_t(inevent.m_status); -} - -/* ------------------------------------------------------------------------- */ -/* Python Integration Hooks */ -/* ------------------------------------------------------------------------- */ - -PyTypeObject SCA_KeyboardSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_KeyboardSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_KeyboardSensor::Methods[] = { - KX_PYMETHODTABLE_O(SCA_KeyboardSensor, getKeyStatus), - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_KeyboardSensor::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_KeyboardSensor, pyattr_get_events), - KX_PYATTRIBUTE_BOOL_RW("useAllKeys",SCA_KeyboardSensor,m_bAllKeys), - KX_PYATTRIBUTE_INT_RW("key",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_hotkey), - KX_PYATTRIBUTE_SHORT_RW("hold1",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_qual), - KX_PYATTRIBUTE_SHORT_RW("hold2",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_qual2), - KX_PYATTRIBUTE_STRING_RW("toggleProperty",0,100,false,SCA_KeyboardSensor,m_toggleprop), - KX_PYATTRIBUTE_STRING_RW("targetProperty",0,100,false,SCA_KeyboardSensor,m_targetprop), - { NULL } //Sentinel -}; - - -PyObject* SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_KeyboardSensor* self= static_cast(self_v); - - SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)self->m_eventmgr)->GetInputDevice(); - - PyObject* resultlist = PyList_New(0); - - for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) - { - const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); - if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) - { - PyObject* keypair = PyList_New(2); - PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i)); - PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status)); - PyList_Append(resultlist,keypair); - } - } - return resultlist; -} - -#endif // DISABLE_PYTHON - -/* Accessed from python */ - -// this code looks ugly, please use an ordinary hashtable - -char ToCharacter(int keyIndex, bool shifted) -{ - /* numerals */ - if ( (keyIndex >= SCA_IInputDevice::KX_ZEROKEY) - && (keyIndex <= SCA_IInputDevice::KX_NINEKEY) ) { - if (shifted) { - char numshift[] = ")!@#$%^&*("; - return numshift[keyIndex - '0']; - } else { - return keyIndex - SCA_IInputDevice::KX_ZEROKEY + '0'; - } - } - - /* letters... always lowercase... is that desirable? */ - if ( (keyIndex >= SCA_IInputDevice::KX_AKEY) - && (keyIndex <= SCA_IInputDevice::KX_ZKEY) ) { - if (shifted) { - return keyIndex - SCA_IInputDevice::KX_AKEY + 'A'; - } else { - return keyIndex - SCA_IInputDevice::KX_AKEY + 'a'; - } - } - - if (keyIndex == SCA_IInputDevice::KX_SPACEKEY) { - return ' '; - } - if (keyIndex == SCA_IInputDevice::KX_RETKEY || keyIndex == SCA_IInputDevice::KX_PADENTER) { - return '\n'; - } - - - if (keyIndex == SCA_IInputDevice::KX_PADASTERKEY) { - return '*'; - } - - if (keyIndex == SCA_IInputDevice::KX_TABKEY) { - return '\t'; - } - - /* comma to period */ - char commatoperiod[] = ",-."; - char commatoperiodshifted[] = "<_>"; - if (keyIndex == SCA_IInputDevice::KX_COMMAKEY) { - if (shifted) { - return commatoperiodshifted[0]; - } else { - return commatoperiod[0]; - } - } - if (keyIndex == SCA_IInputDevice::KX_MINUSKEY) { - if (shifted) { - return commatoperiodshifted[1]; - } else { - return commatoperiod[1]; - } - } - if (keyIndex == SCA_IInputDevice::KX_PERIODKEY) { - if (shifted) { - return commatoperiodshifted[2]; - } else { - return commatoperiod[2]; - } - } - - /* semicolon to rightbracket */ - char semicolontorightbracket[] = ";\'`/\\=[]"; - char semicolontorightbracketshifted[] = ":\"~\?|+{}"; - if ((keyIndex >= SCA_IInputDevice::KX_SEMICOLONKEY) - && (keyIndex <= SCA_IInputDevice::KX_RIGHTBRACKETKEY)) { - if (shifted) { - return semicolontorightbracketshifted[keyIndex - SCA_IInputDevice::KX_SEMICOLONKEY]; - } else { - return semicolontorightbracket[keyIndex - SCA_IInputDevice::KX_SEMICOLONKEY]; - } - } - - /* keypad2 to padplus */ - char pad2topadplus[] = "246813579. 0- +"; - if ((keyIndex >= SCA_IInputDevice::KX_PAD2) - && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY)) { - return pad2topadplus[keyIndex - SCA_IInputDevice::KX_PAD2]; - } - - return '!'; -} - - - -/** - * Determine whether this character can be printed. We cannot use - * the library functions here, because we need to test our own - * keycodes. */ -bool IsPrintable(int keyIndex) -{ - /* only print - * - numerals: KX_ZEROKEY to KX_NINEKEY - * - alphas: KX_AKEY to KX_ZKEY. - * - specials: KX_RETKEY, KX_PADASTERKEY, KX_PADCOMMAKEY to KX_PERIODKEY, - * KX_TABKEY , KX_SEMICOLONKEY to KX_RIGHTBRACKETKEY, - * KX_PAD2 to KX_PADPLUSKEY - * - delete and backspace: also printable in the sense that they modify - * the string - * - retkey: should this be printable? - * - virgule: prints a space... don't know which key that's supposed - * to be... - */ - if ( ((keyIndex >= SCA_IInputDevice::KX_ZEROKEY) - && (keyIndex <= SCA_IInputDevice::KX_NINEKEY)) - || ((keyIndex >= SCA_IInputDevice::KX_AKEY) - && (keyIndex <= SCA_IInputDevice::KX_ZKEY)) - || (keyIndex == SCA_IInputDevice::KX_SPACEKEY) - || (keyIndex == SCA_IInputDevice::KX_RETKEY) - || (keyIndex == SCA_IInputDevice::KX_PADENTER) - || (keyIndex == SCA_IInputDevice::KX_PADASTERKEY) - || (keyIndex == SCA_IInputDevice::KX_TABKEY) - || ((keyIndex >= SCA_IInputDevice::KX_COMMAKEY) - && (keyIndex <= SCA_IInputDevice::KX_PERIODKEY)) - || ((keyIndex >= SCA_IInputDevice::KX_SEMICOLONKEY) - && (keyIndex <= SCA_IInputDevice::KX_RIGHTBRACKETKEY)) - || ((keyIndex >= SCA_IInputDevice::KX_PAD2) - && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY)) - || (keyIndex == SCA_IInputDevice::KX_DELKEY) - || (keyIndex == SCA_IInputDevice::KX_BACKSPACEKEY) - ) - { - return true; - } else { - return false; - } -} - -/** - * Tests whether this is a delete key. - */ -bool IsDelete(int keyIndex) -{ - if ( (keyIndex == SCA_IInputDevice::KX_DELKEY) - || (keyIndex == SCA_IInputDevice::KX_BACKSPACEKEY) ) { - return true; - } else { - return false; - } -} diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.h b/source/gameengine/GameLogic/SCA_KeyboardSensor.h deleted file mode 100644 index 5ca329b0846..00000000000 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.h +++ /dev/null @@ -1,141 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Sensor for keyboard input - */ - -#ifndef __KX_KEYBOARDSENSOR -#define __KX_KEYBOARDSENSOR - -#include "SCA_ISensor.h" -#include "BoolValue.h" -#include - -/** - * The keyboard sensor listens to the keyboard, and passes on events - * on selected keystrokes. It has an alternate mode in which it logs - * keypresses to a property. Note that these modes are not mutually - * exclusive. */ -class SCA_KeyboardSensor : public SCA_ISensor -{ - Py_Header; - - /** - * the key this sensor is sensing for - */ - int m_hotkey; - short int m_qual,m_qual2; - short int m_val; - /** - * If this toggle is true, all incoming key events generate a - * response. - */ - bool m_bAllKeys; - - /** - * The name of the property to which logged text is appended. If - * this property is not defined, no logging takes place. - */ - STR_String m_targetprop; - /** - * The property that indicates whether or not to log text when in - * loggin mode. If the property equals 0, no loggin is done. For - * all other values, logging is active. Logging can only become - * active if there is a property to log to. Logging is independant - * from hotkey settings. */ - STR_String m_toggleprop; - - /** - * Log the keystrokes from the current input buffer. - */ - void LogKeystrokes(void); - - /** - * Adds this key-code to the target prop. - */ - void AddToTargetProp(int keyIndex); - - /** - * Tests whether shift is pressed. - */ - bool IsShifted(void); - -public: - SCA_KeyboardSensor(class SCA_KeyboardManager* keybdmgr, - short int hotkey, - short int qual, - short int qual2, - bool bAllKeys, - const STR_String& targetProp, - const STR_String& toggleProp, - SCA_IObject* gameobj); - virtual ~SCA_KeyboardSensor(); - virtual CValue* GetReplica(); - virtual void Init(); - - - short int GetHotkey(); - virtual bool Evaluate(); - virtual bool IsPositiveTrigger(); - bool TriggerOnAllKeys(); - -#ifndef DISABLE_PYTHON - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - // KeyEvents: - KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,getEventList); - // KeyStatus: - KX_PYMETHOD_DOC_O(SCA_KeyboardSensor,getKeyStatus); - - static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); -#endif -}; - - -/** - * Transform keycodes to something printable. - */ -char ToCharacter(int keyIndex, bool shifted); - -/** - * Determine whether this character can be printed. We cannot use - * the library functions here, because we need to test our own - * keycodes. */ -bool IsPrintable(int keyIndex); - -/** - * Tests whether this is a delete key. - */ -bool IsDelete(int keyIndex); - - -#endif //__KX_KEYBOARDSENSOR - - - diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp deleted file mode 100644 index d003c5618f1..00000000000 --- a/source/gameengine/GameLogic/SCA_LogicManager.cpp +++ /dev/null @@ -1,339 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Regulates the top-level logic behaviour for one scene. - */ -#include "Value.h" -#include "SCA_LogicManager.h" -#include "SCA_ISensor.h" -#include "SCA_IController.h" -#include "SCA_IActuator.h" -#include "SCA_EventManager.h" -#include "SCA_PythonController.h" -#include - - -SCA_LogicManager::SCA_LogicManager() -{ -} - - - -SCA_LogicManager::~SCA_LogicManager() -{ - for (vector::iterator it = m_eventmanagers.begin();!(it==m_eventmanagers.end());++it) - { - delete (*it); - } - m_eventmanagers.clear(); - assert(m_activeActuators.Empty()); -} - -/* -// this kind of fixes bug 398 but breakes games, so better leave it out for now. -// a removed object's gameobject (and logicbricks and stuff) didn't get released -// because it was still in the m_mapStringToGameObjects map. -void SCA_LogicManager::RemoveGameObject(const STR_String& gameobjname) -{ - int numgameobj = m_mapStringToGameObjects.size(); - for (int i = 0; i < numgameobj; i++) - { - CValue** gameobjptr = m_mapStringToGameObjects.at(i); - assert(gameobjptr); - - if (gameobjptr) - { - if ((*gameobjptr)->GetName() == gameobjname) - (*gameobjptr)->Release(); - } - } - - m_mapStringToGameObjects.remove(gameobjname); -} -*/ - - -void SCA_LogicManager::RegisterEventManager(SCA_EventManager* eventmgr) -{ - m_eventmanagers.push_back(eventmgr); -} - - - -void SCA_LogicManager::RegisterGameObjectName(const STR_String& gameobjname, - CValue* gameobj) -{ - STR_HashedString mn = gameobjname; - m_mapStringToGameObjects.insert(mn,gameobj); -} - - - -void SCA_LogicManager::RegisterGameMeshName(const STR_String& gamemeshname, void* blendobj) -{ - STR_HashedString mn = gamemeshname; - m_map_gamemeshname_to_blendobj.insert(mn, blendobj); -} - - - -void SCA_LogicManager::RegisterGameObj(void* blendobj, CValue* gameobj) -{ - m_map_blendobj_to_gameobj.insert(CHashedPtr(blendobj), gameobj); -} - -void SCA_LogicManager::UnregisterGameObj(void* blendobj, CValue* gameobj) -{ - void **obp = m_map_blendobj_to_gameobj[CHashedPtr(blendobj)]; - if (obp && (CValue*)(*obp) == gameobj) - m_map_blendobj_to_gameobj.remove(CHashedPtr(blendobj)); -} - -CValue* SCA_LogicManager::GetGameObjectByName(const STR_String& gameobjname) -{ - STR_HashedString mn = gameobjname; - CValue** gameptr = m_mapStringToGameObjects[mn]; - - if (gameptr) - return *gameptr; - - return NULL; -} - - -CValue* SCA_LogicManager::FindGameObjByBlendObj(void* blendobj) -{ - void **obp= m_map_blendobj_to_gameobj[CHashedPtr(blendobj)]; - return obp?(CValue*)(*obp):NULL; -} - - - -void* SCA_LogicManager::FindBlendObjByGameMeshName(const STR_String& gamemeshname) -{ - STR_HashedString mn = gamemeshname; - void **obp= m_map_gamemeshname_to_blendobj[mn]; - return obp?*obp:NULL; -} - - - -void SCA_LogicManager::RemoveSensor(SCA_ISensor* sensor) -{ - sensor->UnlinkAllControllers(); - sensor->UnregisterToManager(); -} - -void SCA_LogicManager::RemoveController(SCA_IController* controller) -{ - controller->UnlinkAllSensors(); - controller->UnlinkAllActuators(); - controller->Deactivate(); -} - - -void SCA_LogicManager::RemoveActuator(SCA_IActuator* actuator) -{ - actuator->UnlinkAllControllers(); - actuator->Deactivate(); - actuator->SetActive(false); -} - - - -void SCA_LogicManager::RegisterToSensor(SCA_IController* controller,SCA_ISensor* sensor) -{ - sensor->LinkToController(controller); - controller->LinkToSensor(sensor); -} - - - -void SCA_LogicManager::RegisterToActuator(SCA_IController* controller,SCA_IActuator* actua) -{ - actua->LinkToController(controller); - controller->LinkToActuator(actua); -} - - - -void SCA_LogicManager::BeginFrame(double curtime, double fixedtime) -{ - for (vector::const_iterator ie=m_eventmanagers.begin(); !(ie==m_eventmanagers.end()); ie++) - (*ie)->NextFrame(curtime, fixedtime); - - for(SG_QList* obj = (SG_QList*)m_triggeredControllerSet.Remove(); - obj != NULL; - obj = (SG_QList*)m_triggeredControllerSet.Remove()) - { - for(SCA_IController* contr = (SCA_IController*)obj->QRemove(); - contr != NULL; - contr = (SCA_IController*)obj->QRemove()) - { - contr->Trigger(this); - contr->ClrJustActivated(); - } - } -} - - - -void SCA_LogicManager::UpdateFrame(double curtime, bool frame) -{ - for (vector::const_iterator ie=m_eventmanagers.begin(); !(ie==m_eventmanagers.end()); ie++) - (*ie)->UpdateFrame(); - - SG_DList::iterator io(m_activeActuators); - for (io.begin(); !io.end(); ) - { - SG_QList* ahead = *io; - // increment now so that we can remove the current element - ++io; - SG_QList::iterator ia(*ahead); - for (ia.begin(); !ia.end(); ) - { - SCA_IActuator* actua = *ia; - // increment first to allow removal of inactive actuators. - ++ia; - if (!actua->Update(curtime, frame)) - { - // this actuator is not active anymore, remove - actua->QDelink(); - actua->SetActive(false); - } else if (actua->IsNoLink()) - { - // This actuator has no more links but it still active - // make sure it will get a negative event on next frame to stop it - // Do this check after Update() rather than before to make sure - // that all the actuators that are activated at same time than a state - // actuator have a chance to execute. - bool event = false; - actua->RemoveAllEvents(); - actua->AddEvent(event); - } - } - if (ahead->QEmpty()) - { - // no more active controller, remove from main list - ahead->Delink(); - } - } -} - - - -void* SCA_LogicManager::GetActionByName (const STR_String& actname) -{ - STR_HashedString an = actname; - void** actptr = m_mapStringToActions[an]; - - if (actptr) - return *actptr; - - return NULL; -} - - - -void* SCA_LogicManager::GetMeshByName(const STR_String& meshname) -{ - STR_HashedString mn = meshname; - void** meshptr = m_mapStringToMeshes[mn]; - - if (meshptr) - return *meshptr; - - return NULL; -} - - - -void SCA_LogicManager::RegisterMeshName(const STR_String& meshname,void* mesh) -{ - STR_HashedString mn = meshname; - m_mapStringToMeshes.insert(mn,mesh); -} - -void SCA_LogicManager::UnregisterMeshName(const STR_String& meshname,void* mesh) -{ - STR_HashedString mn = meshname; - m_mapStringToMeshes.remove(mn); -} - - -void SCA_LogicManager::RegisterActionName(const STR_String& actname,void* action) -{ - STR_HashedString an = actname; - m_mapStringToActions.insert(an, action); -} - - - -void SCA_LogicManager::EndFrame() -{ - for (vector::const_iterator ie=m_eventmanagers.begin(); - !(ie==m_eventmanagers.end());ie++) - { - (*ie)->EndFrame(); - } -} - - -void SCA_LogicManager::AddTriggeredController(SCA_IController* controller, SCA_ISensor* sensor) -{ - controller->Activate(m_triggeredControllerSet); - -#ifndef DISABLE_PYTHON - - // so that the controller knows which sensor has activited it - // only needed for python controller - // Note that this is safe even if the controller is subclassed. - if (controller->GetType() == &SCA_PythonController::Type) - { - SCA_PythonController* pythonController = (SCA_PythonController*)controller; - pythonController->AddTriggeredSensor(sensor); - } -#endif -} - -SCA_EventManager* SCA_LogicManager::FindEventManager(int eventmgrtype) -{ - // find an eventmanager of a certain type - SCA_EventManager* eventmgr = NULL; - - for (vector::const_iterator i= - m_eventmanagers.begin();!(i==m_eventmanagers.end());i++) - { - SCA_EventManager* emgr = *i; - if (emgr->GetType() == eventmgrtype) - { - eventmgr = emgr; - break; - } - } - return eventmgr; -} diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h deleted file mode 100644 index 85733275a45..00000000000 --- a/source/gameengine/GameLogic/SCA_LogicManager.h +++ /dev/null @@ -1,155 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Regulates the top-level logic behaviour for one scene. - */ -#ifndef __KX_LOGICMANAGER -#define __KX_LOGICMANAGER - -#ifdef WIN32 -#pragma warning (disable:4786) -#endif - -#include -//#include "GEN_Map.h" -#include -#include -#include - -#include "GEN_Map.h" -#include "STR_HashedString.h" -#include "Value.h" -#include "SG_QList.h" - -#include "KX_HashedPtr.h" - -using namespace std; -typedef std::list controllerlist; -typedef std::map sensormap_t; - -/** - * This manager handles sensor, controllers and actuators. - * logic executes each frame the following way: - * find triggering sensors - * build list of controllers that are triggered by these triggering sensors - * process all triggered controllers - * during this phase actuators can be added to the active actuator list - * process all active actuators - * clear triggering sensors - * clear triggered controllers - * (actuators may be active during a longer timeframe) -*/ - -#include "SCA_ILogicBrick.h" -#include "SCA_IActuator.h" -#include "SCA_EventManager.h" - - -class SCA_LogicManager -{ - vector m_eventmanagers; - - // SG_DList: Head of objects having activated actuators - // element: SCA_IObject::m_activeActuators - SG_DList m_activeActuators; - // SG_DList: Head of objects having activated controllers - // element: SCA_IObject::m_activeControllers - SG_DList m_triggeredControllerSet; - - // need to find better way for this - // also known as FactoryManager... - GEN_Map m_mapStringToGameObjects; - GEN_Map m_mapStringToMeshes; - GEN_Map m_mapStringToActions; - - GEN_Map m_map_gamemeshname_to_blendobj; - GEN_Map m_map_blendobj_to_gameobj; -public: - SCA_LogicManager(); - virtual ~SCA_LogicManager(); - - //void SetKeyboardManager(SCA_KeyboardManager* keyboardmgr) { m_keyboardmgr=keyboardmgr;} - void RegisterEventManager(SCA_EventManager* eventmgr); - void RegisterToSensor(SCA_IController* controller, - class SCA_ISensor* sensor); - void RegisterToActuator(SCA_IController* controller, - class SCA_IActuator* actuator); - - void BeginFrame(double curtime, double fixedtime); - void UpdateFrame(double curtime, bool frame); - void EndFrame(); - void AddActiveActuator(SCA_IActuator* actua,bool event) - { - actua->SetActive(true); - actua->Activate(m_activeActuators); - actua->AddEvent(event); - } - - void AddTriggeredController(SCA_IController* controller, SCA_ISensor* sensor); - SCA_EventManager* FindEventManager(int eventmgrtype); - vector GetEventManagers() { return m_eventmanagers; } - - void RemoveGameObject(const STR_String& gameobjname); - - /** - * remove Logic Bricks from the running logicmanager - */ - void RemoveSensor(SCA_ISensor* sensor); - void RemoveController(SCA_IController* controller); - void RemoveActuator(SCA_IActuator* actuator); - - - // for the scripting... needs a FactoryManager later (if we would have time... ;) - void RegisterMeshName(const STR_String& meshname,void* mesh); - void UnregisterMeshName(const STR_String& meshname,void* mesh); - GEN_Map& GetMeshMap() { return m_mapStringToMeshes; }; - - void RegisterActionName(const STR_String& actname,void* action); - - void* GetActionByName (const STR_String& actname); - void* GetMeshByName(const STR_String& meshname); - - void RegisterGameObjectName(const STR_String& gameobjname,CValue* gameobj); - class CValue* GetGameObjectByName(const STR_String& gameobjname); - - void RegisterGameMeshName(const STR_String& gamemeshname, void* blendobj); - void* FindBlendObjByGameMeshName(const STR_String& gamemeshname); - - void RegisterGameObj(void* blendobj, CValue* gameobj); - void UnregisterGameObj(void* blendobj, CValue* gameobj); - CValue* FindGameObjByBlendObj(void* blendobj); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_LogicManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_LOGICMANAGER - diff --git a/source/gameengine/GameLogic/SCA_MouseManager.cpp b/source/gameengine/GameLogic/SCA_MouseManager.cpp deleted file mode 100644 index f7f9a566c8d..00000000000 --- a/source/gameengine/GameLogic/SCA_MouseManager.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Manager for mouse events - * - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 -// This warning tells us about truncation of __long__ stl-generated names. -// It can occasionally cause DevStudio to have internal compiler warnings. -#pragma warning( disable : 4786 ) -#endif - -#include "BoolValue.h" -#include "SCA_MouseManager.h" -#include "SCA_MouseSensor.h" -#include "IntValue.h" -#include "RAS_ICanvas.h" - - -SCA_MouseManager::SCA_MouseManager(SCA_LogicManager* logicmgr, - SCA_IInputDevice* mousedev, - RAS_ICanvas* canvas) - : SCA_EventManager(logicmgr, MOUSE_EVENTMGR), - m_mousedevice (mousedev), - m_canvas(canvas) -{ - m_xpos = 0; - m_ypos = 0; -} - - - -SCA_MouseManager::~SCA_MouseManager() -{ -} - - - -SCA_IInputDevice* SCA_MouseManager::GetInputDevice() -{ - return m_mousedevice; -} - - - -void SCA_MouseManager::NextFrame() -{ - if (m_mousedevice) - { - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - SCA_MouseSensor* mousesensor = (SCA_MouseSensor*)(*it); - // (0,0) is the Upper Left corner in our local window - // coordinates - if (!mousesensor->IsSuspended()) - { - const SCA_InputEvent& event1 = - m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEX); - const SCA_InputEvent& event2 = - m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEY); - - int mx = this->m_canvas->GetMouseX(event1.m_eventval); - int my = this->m_canvas->GetMouseY(event2.m_eventval); - - mousesensor->setX(mx); - mousesensor->setY(my); - - mousesensor->Activate(m_logicmgr); - } - } - } -} - -bool SCA_MouseManager::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - /* We should guard for non-mouse events maybe? A rather silly side */ - /* effect here is that position-change events are considered presses as */ - /* well. */ - - return m_mousedevice->IsPressed(inputcode); -} diff --git a/source/gameengine/GameLogic/SCA_MouseManager.h b/source/gameengine/GameLogic/SCA_MouseManager.h deleted file mode 100644 index 0e7dfa2a284..00000000000 --- a/source/gameengine/GameLogic/SCA_MouseManager.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Manager for mouse events - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - - -#ifndef __KX_MOUSEMANAGER -#define __KX_MOUSEMANAGER - - -#include "SCA_EventManager.h" - -#include - -using namespace std; - -#include "SCA_IInputDevice.h" - - -class SCA_MouseManager : public SCA_EventManager -{ - - class SCA_IInputDevice* m_mousedevice; - class RAS_ICanvas* m_canvas; - - unsigned short m_xpos; // Cached location of the mouse pointer - unsigned short m_ypos; - -public: - SCA_MouseManager(class SCA_LogicManager* logicmgr,class SCA_IInputDevice* mousedev, class RAS_ICanvas* canvas); - virtual ~SCA_MouseManager(); - - /** - * Checks whether a mouse button is depressed. Ignores requests on non- - * mouse related evenst. Can also flag mouse movement. - */ - bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode); - virtual void NextFrame(); - SCA_IInputDevice* GetInputDevice(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_MouseManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_MOUSEMANAGER - diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp deleted file mode 100644 index 9f4b25986b0..00000000000 --- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp +++ /dev/null @@ -1,310 +0,0 @@ -/** - * Sensor for mouse input - * - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): José I. Romero (cleanup and fixes) - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_MouseSensor.h" -#include "SCA_EventManager.h" -#include "SCA_MouseManager.h" -#include "SCA_LogicManager.h" -#include "SCA_IInputDevice.h" -#include "ConstExpr.h" -#include - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_MouseSensor::SCA_MouseSensor(SCA_MouseManager* eventmgr, - int startx,int starty, - short int mousemode, - SCA_IObject* gameobj) - : SCA_ISensor(gameobj,eventmgr), - m_x(startx), - m_y(starty) -{ - m_mousemode = mousemode; - m_triggermode = true; - - UpdateHotkey(this); - Init(); -} - -void SCA_MouseSensor::Init() -{ - m_val = (m_invert)?1:0; /* stores the latest attribute */ - m_reset = true; -} - -SCA_MouseSensor::~SCA_MouseSensor() -{ - /* Nothing to be done here. */ -} - -void SCA_MouseSensor::UpdateHotkey(void *self) -{ - // gosh, this function is so damn stupid - // its here because of a design mistake in the mouse sensor, it should only - // have 3 trigger modes (button, wheel, move), and let the user set the - // hotkey separately, like the other sensors. but instead it has a mode for - // each friggin key and i have to update the hotkey based on it... genius! - SCA_MouseSensor* sensor = reinterpret_cast(self); - - switch (sensor->m_mousemode) { - case KX_MOUSESENSORMODE_LEFTBUTTON: - sensor->m_hotkey = SCA_IInputDevice::KX_LEFTMOUSE; - break; - case KX_MOUSESENSORMODE_MIDDLEBUTTON: - sensor->m_hotkey = SCA_IInputDevice::KX_MIDDLEMOUSE; - break; - case KX_MOUSESENSORMODE_RIGHTBUTTON: - sensor->m_hotkey = SCA_IInputDevice::KX_RIGHTMOUSE; - break; - case KX_MOUSESENSORMODE_WHEELUP: - sensor->m_hotkey = SCA_IInputDevice::KX_WHEELUPMOUSE; - break; - case KX_MOUSESENSORMODE_WHEELDOWN: - sensor->m_hotkey = SCA_IInputDevice::KX_WHEELDOWNMOUSE; - break; - default: - ; /* ignore, no hotkey */ - } -} - -CValue* SCA_MouseSensor::GetReplica() -{ - SCA_MouseSensor* replica = new SCA_MouseSensor(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - replica->Init(); - - return replica; -} - - - -bool SCA_MouseSensor::IsPositiveTrigger() -{ - bool result = (m_val != 0); - if (m_invert) - result = !result; - - return result; -} - - - -short int SCA_MouseSensor::GetModeKey() -{ - return m_mousemode; -} - - - -SCA_IInputDevice::KX_EnumInputs SCA_MouseSensor::GetHotKey() -{ - return m_hotkey; -} - - - -bool SCA_MouseSensor::Evaluate() -{ - bool result = false; - bool reset = m_reset && m_level; - SCA_IInputDevice* mousedev = ((SCA_MouseManager *)m_eventmgr)->GetInputDevice(); - - m_reset = false; - switch (m_mousemode) { - case KX_MOUSESENSORMODE_LEFTBUTTON: - case KX_MOUSESENSORMODE_MIDDLEBUTTON: - case KX_MOUSESENSORMODE_RIGHTBUTTON: - case KX_MOUSESENSORMODE_WHEELUP: - case KX_MOUSESENSORMODE_WHEELDOWN: - { - const SCA_InputEvent& mevent = mousedev->GetEventValue(m_hotkey); - switch (mevent.m_status){ - case SCA_InputEvent::KX_JUSTACTIVATED: - m_val = 1; - result = true; - break; - case SCA_InputEvent::KX_JUSTRELEASED: - m_val = 0; - result = true; - break; - case SCA_InputEvent::KX_ACTIVE: - if (m_val == 0) - { - m_val = 1; - if (m_level) - result = true; - } - break; - default: - if (m_val == 1) - { - m_val = 0; - result = true; - } - break; - } - break; - } - case KX_MOUSESENSORMODE_MOVEMENT: - { - const SCA_InputEvent& eventX = mousedev->GetEventValue(SCA_IInputDevice::KX_MOUSEX); - const SCA_InputEvent& eventY = mousedev->GetEventValue(SCA_IInputDevice::KX_MOUSEY); - - if (eventX.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - eventY.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - eventX.m_status == SCA_InputEvent::KX_ACTIVE || - eventY.m_status == SCA_InputEvent::KX_ACTIVE) - { - m_val = 1; - result = true; - } - else if (eventX.m_status == SCA_InputEvent::KX_JUSTRELEASED || - eventY.m_status == SCA_InputEvent::KX_JUSTRELEASED ) - { - m_val = 0; - result = true; - } - else //KX_NO_IMPUTSTATUS - { - if (m_val == 1) - { - m_val = 0; - result = true; - } - } - - break; - } - default: - ; /* error */ - } - - if (reset) - // force an event - result = true; - return result; -} - -void SCA_MouseSensor::setX(short x) -{ - m_x = x; -} - -void SCA_MouseSensor::setY(short y) -{ - m_y = y; -} - -bool SCA_MouseSensor::isValid(SCA_MouseSensor::KX_MOUSESENSORMODE m) -{ - return ((m > KX_MOUSESENSORMODE_NODEF) && (m < KX_MOUSESENSORMODE_MAX)); -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus, -"getButtonStatus(button)\n" -"\tGet the given button's status (KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED).\n") -{ - if (PyLong_Check(value)) - { - int button = PyLong_AsSsize_t(value); - - if ((button < SCA_IInputDevice::KX_LEFTMOUSE) - || (button > SCA_IInputDevice::KX_RIGHTMOUSE)){ - PyErr_SetString(PyExc_ValueError, "sensor.getButtonStatus(int): Mouse Sensor, invalid button specified!"); - return NULL; - } - - SCA_IInputDevice* mousedev = ((SCA_MouseManager *)m_eventmgr)->GetInputDevice(); - const SCA_InputEvent& event = mousedev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) button); - return PyLong_FromSsize_t(event.m_status); - } - - Py_RETURN_NONE; -} - -/* ------------------------------------------------------------------------- */ -/* Python Integration Hooks */ -/* ------------------------------------------------------------------------- */ - -PyTypeObject SCA_MouseSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_MouseSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_MouseSensor::Methods[] = { - KX_PYMETHODTABLE_O(SCA_MouseSensor, getButtonStatus), - {NULL,NULL} //Sentinel -}; - -int SCA_MouseSensor::UpdateHotkeyPy(void *self, const PyAttributeDef*) -{ - UpdateHotkey(self); - // return value is used in py_setattro(), - // 0=attribute checked ok (see Attributes array definition) - return 0; -} - -PyAttributeDef SCA_MouseSensor::Attributes[] = { - KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",KX_MOUSESENSORMODE_NODEF,KX_MOUSESENSORMODE_MAX-1,true,SCA_MouseSensor,m_mousemode,UpdateHotkeyPy), - KX_PYATTRIBUTE_SHORT_LIST_RO("position",SCA_MouseSensor,m_x,2), - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.h b/source/gameengine/GameLogic/SCA_MouseSensor.h deleted file mode 100644 index f52b57a3e11..00000000000 --- a/source/gameengine/GameLogic/SCA_MouseSensor.h +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Senses mouse events - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): José I. Romero (cleanup and fixes) - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_MOUSESENSOR -#define __KX_MOUSESENSOR - -#include "SCA_ISensor.h" -#include "BoolValue.h" -#include "SCA_IInputDevice.h" - -class SCA_MouseSensor : public SCA_ISensor -{ - Py_Header; - - /** - * Use SCA_IInputDevice values to encode the mouse mode for now. - */ - short int m_mousemode; - /** - * Triggermode true means all mouse events trigger. Useful mainly - * for button presses. - */ - bool m_triggermode; - /** - * Remember the last state update - */ - int m_val; - - SCA_IInputDevice::KX_EnumInputs m_hotkey; - - /** - * valid x coordinate, MUST be followed by y coordinate - */ - short m_x; - - /** - * valid y coordinate - */ - short m_y; - - public: - /** - * Allowable modes for the trigger status of the mouse sensor. - */ - enum KX_MOUSESENSORMODE { - KX_MOUSESENSORMODE_NODEF = 0, - KX_MOUSESENSORMODE_LEFTBUTTON, - KX_MOUSESENSORMODE_MIDDLEBUTTON, - KX_MOUSESENSORMODE_RIGHTBUTTON, - KX_MOUSESENSORMODE_WHEELUP, - KX_MOUSESENSORMODE_WHEELDOWN, - KX_MOUSESENSORMODE_POSITION, - KX_MOUSESENSORMODE_POSITIONX, - KX_MOUSESENSORMODE_POSITIONY, - KX_MOUSESENSORMODE_MOVEMENT, - KX_MOUSESENSORMODE_MAX - }; - - bool isValid(KX_MOUSESENSORMODE); - - SCA_MouseSensor(class SCA_MouseManager* keybdmgr, - int startx,int starty, - short int mousemode, - SCA_IObject* gameobj); - - virtual ~SCA_MouseSensor(); - virtual CValue* GetReplica(); - virtual bool Evaluate(); - virtual void Init(); - virtual bool IsPositiveTrigger(); - short int GetModeKey(); - SCA_IInputDevice::KX_EnumInputs GetHotKey(); - void setX(short x); - void setY(short y); - - static void UpdateHotkey(void *self); - - -#ifndef DISABLE_PYTHON - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - static int UpdateHotkeyPy(void *self, const PyAttributeDef *); - - // get button status - KX_PYMETHOD_DOC_O(SCA_MouseSensor,getButtonStatus); -#endif -}; - -#endif //__KX_MOUSESENSOR - diff --git a/source/gameengine/GameLogic/SCA_NANDController.cpp b/source/gameengine/GameLogic/SCA_NANDController.cpp deleted file mode 100644 index c09a53d8ac7..00000000000 --- a/source/gameengine/GameLogic/SCA_NANDController.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/** - * 'Nand' together all inputs - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_NANDController.h" -#include "SCA_ISensor.h" -#include "SCA_LogicManager.h" -#include "BoolValue.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_NANDController::SCA_NANDController(SCA_IObject* gameobj) - : - SCA_IController(gameobj) -{ -} - - - -SCA_NANDController::~SCA_NANDController() -{ -} - - - -void SCA_NANDController::Trigger(SCA_LogicManager* logicmgr) -{ - - bool sensorresult = false; - - for (vector::const_iterator is=m_linkedsensors.begin(); - !(is==m_linkedsensors.end());is++) - { - SCA_ISensor* sensor = *is; - if (!sensor->GetState()) - { - sensorresult = true; - break; - } - } - - for (vector::const_iterator i=m_linkedactuators.begin(); - !(i==m_linkedactuators.end());i++) - { - SCA_IActuator* actua = *i; - logicmgr->AddActiveActuator(actua,sensorresult); - } -} - - - -CValue* SCA_NANDController::GetReplica() -{ - CValue* replica = new SCA_NANDController(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_NANDController::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_NANDController", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IController::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_NANDController::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_NANDController::Attributes[] = { - { NULL } //Sentinel -}; - -#endif - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_NANDController.h b/source/gameengine/GameLogic/SCA_NANDController.h deleted file mode 100644 index b1ec7de13dd..00000000000 --- a/source/gameengine/GameLogic/SCA_NANDController.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * SCA_NANDController.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_NANDCONTROLLER -#define __KX_NANDCONTROLLER - -#include "SCA_IController.h" - -class SCA_NANDController : public SCA_IController -{ - Py_Header; - //virtual void Trigger(class SCA_LogicManager* logicmgr); -public: - SCA_NANDController(SCA_IObject* gameobj); - virtual ~SCA_NANDController(); - virtual CValue* GetReplica(); - virtual void Trigger(SCA_LogicManager* logicmgr); - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ -}; - -#endif //__KX_NANDCONTROLLER - diff --git a/source/gameengine/GameLogic/SCA_NORController.cpp b/source/gameengine/GameLogic/SCA_NORController.cpp deleted file mode 100644 index 8ebd79efcfa..00000000000 --- a/source/gameengine/GameLogic/SCA_NORController.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/** - * 'Nor' together all inputs - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_NORController.h" -#include "SCA_ISensor.h" -#include "SCA_LogicManager.h" -#include "BoolValue.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_NORController::SCA_NORController(SCA_IObject* gameobj) - : - SCA_IController(gameobj) -{ -} - - - -SCA_NORController::~SCA_NORController() -{ -} - - - -void SCA_NORController::Trigger(SCA_LogicManager* logicmgr) -{ - - bool sensorresult = true; - - for (vector::const_iterator is=m_linkedsensors.begin(); - !(is==m_linkedsensors.end());is++) - { - SCA_ISensor* sensor = *is; - if (sensor->GetState()) - { - sensorresult = false; - break; - } - } - - for (vector::const_iterator i=m_linkedactuators.begin(); - !(i==m_linkedactuators.end());i++) - { - SCA_IActuator* actua = *i; - logicmgr->AddActiveActuator(actua,sensorresult); - } -} - - - -CValue* SCA_NORController::GetReplica() -{ - CValue* replica = new SCA_NORController(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_NORController::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_NORController", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IController::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_NORController::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_NORController::Attributes[] = { - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_NORController.h b/source/gameengine/GameLogic/SCA_NORController.h deleted file mode 100644 index 12b2ad99282..00000000000 --- a/source/gameengine/GameLogic/SCA_NORController.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * SCA_NORController.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_NORCONTROLLER -#define __KX_NORCONTROLLER - -#include "SCA_IController.h" - -class SCA_NORController : public SCA_IController -{ - Py_Header; - //virtual void Trigger(class SCA_LogicManager* logicmgr); -public: - SCA_NORController(SCA_IObject* gameobj); - virtual ~SCA_NORController(); - virtual CValue* GetReplica(); - virtual void Trigger(SCA_LogicManager* logicmgr); -}; - -#endif //__KX_NORCONTROLLER - diff --git a/source/gameengine/GameLogic/SCA_ORController.cpp b/source/gameengine/GameLogic/SCA_ORController.cpp deleted file mode 100644 index a638147e211..00000000000 --- a/source/gameengine/GameLogic/SCA_ORController.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/** - * 'Or' together all inputs - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_ORController.h" -#include "SCA_ISensor.h" -#include "SCA_LogicManager.h" -#include "BoolValue.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_ORController::SCA_ORController(SCA_IObject* gameobj) - :SCA_IController(gameobj) -{ -} - - - -SCA_ORController::~SCA_ORController() -{ -} - - - -CValue* SCA_ORController::GetReplica() -{ - CValue* replica = new SCA_ORController(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - - -void SCA_ORController::Trigger(SCA_LogicManager* logicmgr) -{ - - bool sensorresult = false; - SCA_ISensor* sensor; - - vector::const_iterator is=m_linkedsensors.begin(); - while ( (!sensorresult) && (!(is==m_linkedsensors.end())) ) - { - sensor = *is; - if (sensor->GetState()) sensorresult = true; - is++; - } - - for (vector::const_iterator i=m_linkedactuators.begin(); - !(i==m_linkedactuators.end());i++) - { - SCA_IActuator* actua = *i; - logicmgr->AddActiveActuator(actua,sensorresult); - } -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_ORController::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_ORController", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IController::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_ORController::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_ORController::Attributes[] = { - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_ORController.h b/source/gameengine/GameLogic/SCA_ORController.h deleted file mode 100644 index eb848c6d9e3..00000000000 --- a/source/gameengine/GameLogic/SCA_ORController.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * SCA_ORController.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_ORCONTROLLER -#define __KX_ORCONTROLLER - -#include "SCA_IController.h" - -class SCA_ORController : public SCA_IController -{ - Py_Header; - //virtual void Trigger(class SCA_LogicManager* logicmgr); -public: - SCA_ORController(SCA_IObject* gameobj); - - virtual ~SCA_ORController(); - virtual CValue* GetReplica(); - virtual void Trigger(SCA_LogicManager* logicmgr); -}; - -#endif //__KX_ORCONTROLLER - diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp deleted file mode 100644 index c1b49d32712..00000000000 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/** - * Assign, change, copy properties - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_PropertyActuator.h" -#include "InputParser.h" -#include "Operator2Expr.h" -#include "ConstExpr.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_PropertyActuator::SCA_PropertyActuator(SCA_IObject* gameobj,SCA_IObject* sourceObj,const STR_String& propname,const STR_String& expr,int acttype) - : SCA_IActuator(gameobj, KX_ACT_PROPERTY), - m_type(acttype), - m_propname(propname), - m_exprtxt(expr), - m_sourceObj(sourceObj) -{ - // protect ourselves against someone else deleting the source object - // don't protect against ourselves: it would create a dead lock - if (m_sourceObj) - m_sourceObj->RegisterActuator(this); -} - -SCA_PropertyActuator::~SCA_PropertyActuator() -{ - if (m_sourceObj) - m_sourceObj->UnregisterActuator(this); -} - -bool SCA_PropertyActuator::Update() -{ - bool result = false; - - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - - if (bNegativeEvent) - return false; // do nothing on negative events - - - CValue* propowner = GetParent(); - CParser parser; - parser.SetContext( propowner->AddRef()); - - CExpression* userexpr= NULL; - - if (m_type==KX_ACT_PROP_TOGGLE) - { - /* dont use */ - CValue* newval; - CValue* oldprop = propowner->GetProperty(m_propname); - if (oldprop) - { - newval = new CBoolValue((oldprop->GetNumber()==0.0) ? true:false); - oldprop->SetValue(newval); - } else - { /* as not been assigned, evaluate as false, so assign true */ - newval = new CBoolValue(true); - propowner->SetProperty(m_propname,newval); - } - newval->Release(); - } - else if ((userexpr = parser.ProcessText(m_exprtxt))) { - switch (m_type) - { - - case KX_ACT_PROP_ASSIGN: - { - - CValue* newval = userexpr->Calculate(); - CValue* oldprop = propowner->GetProperty(m_propname); - if (oldprop) - { - oldprop->SetValue(newval); - } else - { - propowner->SetProperty(m_propname,newval); - } - newval->Release(); - break; - } - case KX_ACT_PROP_ADD: - { - CValue* oldprop = propowner->GetProperty(m_propname); - if (oldprop) - { - // int waarde = (int)oldprop->GetNumber(); /*unused*/ - CExpression* expr = new COperator2Expr(VALUE_ADD_OPERATOR,new CConstExpr(oldprop->AddRef()), - userexpr->AddRef()); - - CValue* newprop = expr->Calculate(); - oldprop->SetValue(newprop); - newprop->Release(); - expr->Release(); - - } - - break; - } - case KX_ACT_PROP_COPY: - { - if (m_sourceObj) - { - CValue* copyprop = m_sourceObj->GetProperty(m_exprtxt); - if (copyprop) - { - CValue *val = copyprop->GetReplica(); - GetParent()->SetProperty( - m_propname, - val); - val->Release(); - - } - } - break; - } - /* case KX_ACT_PROP_TOGGLE: */ /* accounted for above, no need for userexpr */ - default: - { - - } - } - - userexpr->Release(); - } - - return result; -} - - bool - -SCA_PropertyActuator:: - -isValid( - - SCA_PropertyActuator::KX_ACT_PROP_MODE mode - -){ - bool res = false; - res = ((mode > KX_ACT_PROP_NODEF) && (mode < KX_ACT_PROP_MAX)); - return res; -} - - - CValue* - -SCA_PropertyActuator:: - -GetReplica() { - - SCA_PropertyActuator* replica = new SCA_PropertyActuator(*this); - - replica->ProcessReplica(); - return replica; - -}; - -void SCA_PropertyActuator::ProcessReplica() -{ - // no need to check for self reference like in the constructor: - // the replica will always have a different parent - if (m_sourceObj) - m_sourceObj->RegisterActuator(this); - SCA_IActuator::ProcessReplica(); -} - -bool SCA_PropertyActuator::UnlinkObject(SCA_IObject* clientobj) -{ - if (clientobj == m_sourceObj) - { - // this object is being deleted, we cannot continue to track it. - m_sourceObj = NULL; - return true; - } - return false; -} - -void SCA_PropertyActuator::Relink(GEN_Map *obj_map) -{ - void **h_obj = (*obj_map)[m_sourceObj]; - if (h_obj) { - if (m_sourceObj) - m_sourceObj->UnregisterActuator(this); - m_sourceObj = (SCA_IObject*)(*h_obj); - m_sourceObj->RegisterActuator(this); - } -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_PropertyActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_PropertyActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_PropertyActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_PropertyActuator::Attributes[] = { - KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,100,false,SCA_PropertyActuator,m_propname,CheckProperty), - KX_PYATTRIBUTE_STRING_RW("value",0,100,false,SCA_PropertyActuator,m_exprtxt), - KX_PYATTRIBUTE_INT_RW("mode", KX_ACT_PROP_NODEF+1, KX_ACT_PROP_MAX-1, false, SCA_PropertyActuator, m_type), /* ATTR_TODO add constents to game logic dict */ - { NULL } //Sentinel -}; - -#endif - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.h b/source/gameengine/GameLogic/SCA_PropertyActuator.h deleted file mode 100644 index a38c42f16ad..00000000000 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.h +++ /dev/null @@ -1,90 +0,0 @@ -/** - * SCA_PropertyActuator.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_PROPERTYACTUATOR -#define __KX_PROPERTYACTUATOR - -#include "SCA_IActuator.h" - -class SCA_PropertyActuator : public SCA_IActuator -{ - Py_Header; - - enum KX_ACT_PROP_MODE { - KX_ACT_PROP_NODEF = 0, - KX_ACT_PROP_ASSIGN, - KX_ACT_PROP_ADD, - KX_ACT_PROP_COPY, - KX_ACT_PROP_TOGGLE, - KX_ACT_PROP_MAX - }; - - /**check whether this value is valid */ - bool isValid(KX_ACT_PROP_MODE mode); - - int m_type; - STR_String m_propname; - STR_String m_exprtxt; - SCA_IObject* m_sourceObj; // for copy property actuator - -public: - - - - SCA_PropertyActuator( - SCA_IObject* gameobj, - SCA_IObject* sourceObj, - const STR_String& propname, - const STR_String& expr, - int acttype); - - - ~SCA_PropertyActuator(); - - CValue* - GetReplica( - ); - - virtual void ProcessReplica(); - virtual bool UnlinkObject(SCA_IObject* clientobj); - virtual void Relink(GEN_Map *obj_map); - - virtual bool - Update(); - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - -}; - -#endif //__KX_PROPERTYACTUATOR_DOC - diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp b/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp deleted file mode 100644 index f6a1b257c18..00000000000 --- a/source/gameengine/GameLogic/SCA_PropertyEventManager.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_ISensor.h" -#include "SCA_PropertyEventManager.h" - - -SCA_PropertyEventManager::SCA_PropertyEventManager(class SCA_LogicManager* logicmgr) - : SCA_EventManager(logicmgr, PROPERTY_EVENTMGR) -{ -} - - - -SCA_PropertyEventManager::~SCA_PropertyEventManager() -{ - -} - -void SCA_PropertyEventManager::NextFrame() -{ - // check for changed properties - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - (*it)->Activate(m_logicmgr); - } -} diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.h b/source/gameengine/GameLogic/SCA_PropertyEventManager.h deleted file mode 100644 index 159b6d8b827..00000000000 --- a/source/gameengine/GameLogic/SCA_PropertyEventManager.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_PROPERTYEVENTMANAGER -#define __KX_PROPERTYEVENTMANAGER - -#include "SCA_EventManager.h" - -#include - -using namespace std; - -class SCA_PropertyEventManager : public SCA_EventManager -{ -public: - SCA_PropertyEventManager(class SCA_LogicManager* logicmgr); - virtual ~SCA_PropertyEventManager(); - virtual void NextFrame(); - //SCA_LogicManager* GetLogicManager() { return m_logicmgr;} - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_PropertyEventManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_PROPERTYEVENTMANAGER - diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp deleted file mode 100644 index be86b976a70..00000000000 --- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/** - * Property sensor - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include -#include "SCA_PropertySensor.h" -#include "Operator2Expr.h" -#include "ConstExpr.h" -#include "InputParser.h" -#include "StringValue.h" -#include "SCA_EventManager.h" -#include "SCA_LogicManager.h" -#include "BoolValue.h" -#include "FloatValue.h" -#include - -SCA_PropertySensor::SCA_PropertySensor(SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - const STR_String& propname, - const STR_String& propval, - const STR_String& propmaxval, - KX_PROPSENSOR_TYPE checktype) - : SCA_ISensor(gameobj,eventmgr), - m_checktype(checktype), - m_checkpropval(propval), - m_checkpropmaxval(propmaxval), - m_checkpropname(propname), - m_range_expr(NULL) -{ - //CParser pars; - //pars.SetContext(this->AddRef()); - //CValue* resultval = m_rightexpr->Calculate(); - - CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname); - if (!orgprop->IsError()) - { - m_previoustext = orgprop->GetText(); - } - orgprop->Release(); - - if (m_checktype==KX_PROPSENSOR_INTERVAL) - { - PrecalculateRangeExpression(); - } - Init(); -} - -void SCA_PropertySensor::Init() -{ - m_recentresult = false; - m_lastresult = m_invert?true:false; - m_reset = true; -} - -void SCA_PropertySensor::PrecalculateRangeExpression() -{ - CParser pars; - //The context is needed to retrieve the property at runtime but it creates - //loop of references - pars.SetContext(this->AddRef()); - STR_String checkstr = "(" + m_checkpropval + " <= " - + m_checkpropname + ") && ( " - + m_checkpropname + " <= " - + m_checkpropmaxval + ")"; - - m_range_expr = pars.ProcessText(checkstr); -} - -// Forced deletion of precalculated range expression to break reference loop -// Use this function when you know that you won't use the sensor anymore -void SCA_PropertySensor::Delete() -{ - if (m_range_expr) - { - m_range_expr->Release(); - m_range_expr = NULL; - } - Release(); -} - -CValue* SCA_PropertySensor::GetReplica() -{ - SCA_PropertySensor* replica = new SCA_PropertySensor(*this); - // m_range_expr must be recalculated on replica! - replica->ProcessReplica(); - replica->Init(); - - replica->m_range_expr = NULL; - if (replica->m_checktype==KX_PROPSENSOR_INTERVAL) - { - replica->PrecalculateRangeExpression(); - } - - - return replica; -} - - - -bool SCA_PropertySensor::IsPositiveTrigger() -{ - bool result = m_recentresult;//CheckPropertyCondition(); - if (m_invert) - result = !result; - - return result; -} - - - -SCA_PropertySensor::~SCA_PropertySensor() -{ - //if (m_rightexpr) - // m_rightexpr->Release(); - - if (m_range_expr) - { - m_range_expr->Release(); - m_range_expr=NULL; - } - -} - - - -bool SCA_PropertySensor::Evaluate() -{ - bool result = CheckPropertyCondition(); - bool reset = m_reset && m_level; - - m_reset = false; - if (m_lastresult!=result) - { - m_lastresult = result; - return true; - } - return (reset) ? true : false; -} - - -bool SCA_PropertySensor::CheckPropertyCondition() -{ - - m_recentresult=false; - bool result=false; - bool reverse = false; - switch (m_checktype) - { - case KX_PROPSENSOR_NOTEQUAL: - reverse = true; - case KX_PROPSENSOR_EQUAL: - { - CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname); - if (!orgprop->IsError()) - { - const STR_String& testprop = orgprop->GetText(); - // Force strings to upper case, to avoid confusion in - // bool tests. It's stupid the prop's identity is lost - // on the way here... - if ((&testprop == &CBoolValue::sTrueString) || (&testprop == &CBoolValue::sFalseString)) { - m_checkpropval.Upper(); - } - result = (testprop == m_checkpropval); - - /* Patch: floating point values cant use strings usefully since you can have "0.0" == "0.0000" - * this could be made into a generic Value class function for comparing values with a string. - */ - if(result==false && dynamic_cast(orgprop) != NULL) { - float f; - - if(EOF == sscanf(m_checkpropval.ReadPtr(), "%f", &f)) - { - //error - } - else { - result = (f == ((CFloatValue *)orgprop)->GetFloat()); - } - } - /* end patch */ - } - orgprop->Release(); - - if (reverse) - result = !result; - break; - - } - - case KX_PROPSENSOR_EXPRESSION: - { - /* - if (m_rightexpr) - { - CValue* resultval = m_rightexpr->Calculate(); - if (resultval->IsError()) - { - int i=0; - STR_String errortest = resultval->GetText(); - printf(errortest); - - } else - { - result = resultval->GetNumber() != 0; - } - } - */ - break; - } - case KX_PROPSENSOR_INTERVAL: - { - //CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname); - //if (orgprop) - //{ - if (m_range_expr) - { - CValue* vallie = m_range_expr->Calculate(); - if (vallie) - { - const STR_String& errtext = vallie->GetText(); - if (&errtext == &CBoolValue::sTrueString) - { - result = true; - } else - { - if (vallie->IsError()) - { - //printf (errtext.ReadPtr()); - } - } - - vallie->Release(); - } - } - - - //} - - //cout << " \nSens:Prop:interval!"; /* need implementation here!!! */ - - break; - } - case KX_PROPSENSOR_CHANGED: - { - CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname); - - if (!orgprop->IsError()) - { - if (m_previoustext != orgprop->GetText()) - { - m_previoustext = orgprop->GetText(); - result = true; - } - } - orgprop->Release(); - - //cout << " \nSens:Prop:changed!"; /* need implementation here!!! */ - break; - } - default: - ; /* error */ - } - - //the concept of Edge and Level triggering has unwanted effect for KX_PROPSENSOR_CHANGED - //see Game Engine bugtracker [ #3809 ] - if (m_checktype != KX_PROPSENSOR_CHANGED) - { - m_recentresult=result; - } else - { - m_recentresult=result;//true; - } - return result; -} - -CValue* SCA_PropertySensor::FindIdentifier(const STR_String& identifiername) -{ - return GetParent()->FindIdentifier(identifiername); -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*) -{ - /* If someone actually do type checking please make sure the 'max' and 'min' - are checked as well (currently they are calling the PrecalculateRangeExpression - function directly */ - - /* There is no type checking at this moment, unfortunately... */ - return 0; -} - -int SCA_PropertySensor::validValueForIntervalProperty(void *self, const PyAttributeDef*) -{ - SCA_PropertySensor* sensor = reinterpret_cast(self); - - if (sensor->m_checktype==KX_PROPSENSOR_INTERVAL) - { - sensor->PrecalculateRangeExpression(); - } - return 0; -} - -int SCA_PropertySensor::modeChange(void *self, const PyAttributeDef* attrdef) -{ - SCA_PropertySensor* sensor = reinterpret_cast(self); - - if (sensor->m_checktype==KX_PROPSENSOR_INTERVAL) - { - sensor->PrecalculateRangeExpression(); - } - return 0; -} - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_PropertySensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_PropertySensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_PropertySensor::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_PropertySensor::Attributes[] = { - KX_PYATTRIBUTE_INT_RW_CHECK("mode",KX_PROPSENSOR_NODEF,KX_PROPSENSOR_MAX-1,false,SCA_PropertySensor,m_checktype,modeChange), - KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,100,false,SCA_PropertySensor,m_checkpropname,CheckProperty), - KX_PYATTRIBUTE_STRING_RW_CHECK("value",0,100,false,SCA_PropertySensor,m_checkpropval,validValueForProperty), - KX_PYATTRIBUTE_STRING_RW_CHECK("min",0,100,false,SCA_PropertySensor,m_checkpropval,validValueForIntervalProperty), - KX_PYATTRIBUTE_STRING_RW_CHECK("max",0,100,false,SCA_PropertySensor,m_checkpropmaxval,validValueForIntervalProperty), - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.h b/source/gameengine/GameLogic/SCA_PropertySensor.h deleted file mode 100644 index 9a5c4762558..00000000000 --- a/source/gameengine/GameLogic/SCA_PropertySensor.h +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Property sensor - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_PROPERTYSENSOR -#define __KX_PROPERTYSENSOR - -#include "SCA_ISensor.h" - -class SCA_PropertySensor : public SCA_ISensor -{ - Py_Header; - //class CExpression* m_rightexpr; - int m_checktype; - STR_String m_checkpropval; - STR_String m_checkpropmaxval; - STR_String m_checkpropname; - STR_String m_previoustext; - bool m_lastresult; - bool m_recentresult; - CExpression* m_range_expr; - - protected: - -public: - enum KX_PROPSENSOR_TYPE { - KX_PROPSENSOR_NODEF = 0, - KX_PROPSENSOR_EQUAL, - KX_PROPSENSOR_NOTEQUAL, - KX_PROPSENSOR_INTERVAL, - KX_PROPSENSOR_CHANGED, - KX_PROPSENSOR_EXPRESSION, - KX_PROPSENSOR_MAX - }; - - const STR_String S_KX_PROPSENSOR_EQ_STRING; - - SCA_PropertySensor(class SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - const STR_String& propname, - const STR_String& propval, - const STR_String& propmaxval, - KX_PROPSENSOR_TYPE checktype); - - /** - * For property sensor, it is used to release the pre-calculated expression - * so that self references are removed before the sensor itself is released - */ - virtual void Delete(); - virtual ~SCA_PropertySensor(); - virtual CValue* GetReplica(); - virtual void Init(); - void PrecalculateRangeExpression(); - bool CheckPropertyCondition(); - - virtual bool Evaluate(); - virtual bool IsPositiveTrigger(); - virtual CValue* FindIdentifier(const STR_String& identifiername); - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - /** - * Test whether this is a sensible value (type check) - */ - static int validValueForProperty(void* self, const PyAttributeDef*); - - /** - * Test whether this is a sensible value for interval (type check) and updates Range Expression - */ - static int validValueForIntervalProperty(void* self, const PyAttributeDef*); - - /** - * Test if the new mode is interval. If positive updates Range Expression - */ - static int modeChange(void* self, const PyAttributeDef* attrdef); - -#endif -}; - -#endif - diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp deleted file mode 100644 index 45d3be01bbb..00000000000 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/** - * Execute Python scripts - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_PythonController.h" -#include "SCA_LogicManager.h" -#include "SCA_ISensor.h" -#include "SCA_IActuator.h" -#include "PyObjectPlus.h" - -#ifndef DISABLE_PYTHON -#include "compile.h" -#include "eval.h" -#endif // DISABLE_PYTHON - -#include - - -// initialize static member variables -SCA_PythonController* SCA_PythonController::m_sCurrentController = NULL; - - -SCA_PythonController::SCA_PythonController(SCA_IObject* gameobj, int mode) - : SCA_IController(gameobj), -#ifndef DISABLE_PYTHON - m_bytecode(NULL), - m_function(NULL), -#endif - m_function_argc(0), - m_bModified(true), - m_debug(false), - m_mode(mode) -#ifndef DISABLE_PYTHON - , m_pythondictionary(NULL) -#endif - -{ - -} - -/* -//debugging -CValue* SCA_PythonController::AddRef() -{ - //printf("AddRef refcount = %i\n",GetRefCount()); - return CValue::AddRef(); -} -int SCA_PythonController::Release() -{ - //printf("Release refcount = %i\n",GetRefCount()); - return CValue::Release(); -} -*/ - - - -SCA_PythonController::~SCA_PythonController() -{ - -#ifndef DISABLE_PYTHON - //printf("released python byte script\n"); - - Py_XDECREF(m_bytecode); - Py_XDECREF(m_function); - - if (m_pythondictionary) { - // break any circular references in the dictionary - PyDict_Clear(m_pythondictionary); - Py_DECREF(m_pythondictionary); - } -#endif -} - - - -CValue* SCA_PythonController::GetReplica() -{ - SCA_PythonController* replica = new SCA_PythonController(*this); - -#ifndef DISABLE_PYTHON - /* why is this needed at all??? - m_bytecode is NULL'd below so this doesnt make sense - * but removing it crashes blender (with YoFrankie). so leave in for now - Campbell */ - Py_XINCREF(replica->m_bytecode); - - Py_XINCREF(replica->m_function); // this is ok since its not set to NULL - replica->m_bModified = replica->m_bytecode == NULL; - - // The replica->m_pythondictionary is stolen - replace with a copy. - if (m_pythondictionary) - replica->m_pythondictionary = PyDict_Copy(m_pythondictionary); - - /* - // The other option is to incref the replica->m_pythondictionary - - // the replica objects can then share data. - if (m_pythondictionary) - Py_INCREF(replica->m_pythondictionary); - */ -#endif - - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - - - -void SCA_PythonController::SetScriptText(const STR_String& text) -{ - m_scriptText = text; - m_bModified = true; -} - - - -void SCA_PythonController::SetScriptName(const STR_String& name) -{ - m_scriptName = name; -} - - -#ifndef DISABLE_PYTHON -void SCA_PythonController::SetNamespace(PyObject* pythondictionary) -{ - if (m_pythondictionary) - { - PyDict_Clear(m_pythondictionary); - Py_DECREF(m_pythondictionary); - } - m_pythondictionary = PyDict_Copy(pythondictionary); /* new reference */ - - /* Without __file__ set the sys.argv[0] is used for the filename - * which ends up with lines from the blender binary being printed in the console */ - PyDict_SetItemString(m_pythondictionary, "__file__", PyUnicode_FromString(m_scriptName.Ptr())); - -} -#endif - -int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor) -{ - if (std::find(m_triggeredSensors.begin(), m_triggeredSensors.end(), sensor) != - m_triggeredSensors.end()) - return 1; - return 0; -} - -#ifndef DISABLE_PYTHON - -/* warning, self is not the SCA_PythonController, its a PyObjectPlus_Proxy */ -PyObject* SCA_PythonController::sPyGetCurrentController(PyObject *self) -{ - if(m_sCurrentController==NULL) - { - PyErr_SetString(PyExc_SystemError, "GameLogic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt."); - return NULL; - } - return m_sCurrentController->GetProxy(); -} - -SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value) -{ - // for safety, todo: only allow for registered actuators (pointertable) - // we don't want to crash gameengine/blender by python scripts - std::vector lacts = m_sCurrentController->GetLinkedActuators(); - std::vector::iterator it; - - if (PyUnicode_Check(value)) { - /* get the actuator from the name */ - char *name= _PyUnicode_AsString(value); - for(it = lacts.begin(); it!= lacts.end(); ++it) { - if( name == (*it)->GetName() ) { - return *it; - } - } - } - else if (PyObject_TypeCheck(value, &SCA_IActuator::Type)) { - PyObjectPlus *value_plus= BGE_PROXY_REF(value); - for(it = lacts.begin(); it!= lacts.end(); ++it) { - if( static_cast(value_plus) == (*it) ) { - return *it; - } - } - } - - /* set the exception */ - PyObject *value_str = PyObject_Repr(value); /* new ref */ - PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str)); - Py_DECREF(value_str); - - return false; -} - -const char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()"; - -PyTypeObject SCA_PythonController::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_PythonController", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IController::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_PythonController::Methods[] = { - {"activate", (PyCFunction) SCA_PythonController::sPyActivate, METH_O}, - {"deactivate", (PyCFunction) SCA_PythonController::sPyDeActivate, METH_O}, - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_PythonController::Attributes[] = { - KX_PYATTRIBUTE_RW_FUNCTION("script", SCA_PythonController, pyattr_get_script, pyattr_set_script), - KX_PYATTRIBUTE_INT_RO("mode", SCA_PythonController, m_mode), - { NULL } //Sentinel -}; - -void SCA_PythonController::ErrorPrint(const char *error_msg) -{ - // didn't compile, so instead of compile, complain - // something is wrong, tell the user what went wrong - printf("%s - controller \"%s\":\n", error_msg, GetName().Ptr()); - //PyRun_SimpleString(m_scriptText.Ptr()); - PyErr_Print(); - - /* Added in 2.48a, the last_traceback can reference Objects for example, increasing - * their user count. Not to mention holding references to wrapped data. - * This is especially bad when the PyObject for the wrapped data is free'd, after blender - * has alredy dealocated the pointer */ - PySys_SetObject( (char *)"last_traceback", NULL); - PyErr_Clear(); /* just to be sure */ -} - -bool SCA_PythonController::Compile() -{ - //printf("py script modified '%s'\n", m_scriptName.Ptr()); - m_bModified= false; - - // if a script already exists, decref it before replace the pointer to a new script - if (m_bytecode) { - Py_DECREF(m_bytecode); - m_bytecode=NULL; - } - - // recompile the scripttext into bytecode - m_bytecode = Py_CompileString(m_scriptText.Ptr(), m_scriptName.Ptr(), Py_file_input); - - if (m_bytecode) { - return true; - } else { - ErrorPrint("Python error compiling script"); - return false; - } -} - -bool SCA_PythonController::Import() -{ - //printf("py module modified '%s'\n", m_scriptName.Ptr()); - m_bModified= false; - - /* incase we re-import */ - Py_XDECREF(m_function); - m_function= NULL; - - vector py_function_path = m_scriptText.Explode('.'); - - if(py_function_path.size() < 2) { - printf("Python module name formatting error \"%s\":\n\texpected \"SomeModule.Func\", got \"%s\"\n", GetName().Ptr(), m_scriptText.Ptr()); - return false; - } - - PyObject *mod = PyImport_ImportModule((char *)py_function_path[0].Ptr()); - /* Dont reload yet, do this within the loop so packages reload too */ - - if(mod==NULL) { - ErrorPrint("Python module not found"); - return false; - } - /* 'mod' will be DECREF'd as 'base' - * 'm_function' will be left holding a reference that the controller owns */ - - PyObject *base= mod; - - for(unsigned int i=1; i < py_function_path.size(); i++) { - if(m_debug && PyModule_Check(base)) { /* base could be a class */ - Py_DECREF(base); /* getting a new one so dont hold a ref to the old one */ - base= PyImport_ReloadModule(base); - if (base==NULL) { - m_function= NULL; - break; - } - } - - m_function = PyObject_GetAttrString(base, py_function_path[i].Ptr()); - Py_DECREF(base); - base = m_function; /* for the next loop if there is on */ - - if(m_function==NULL) { - break; - } - } - - if(m_function==NULL) { - if(PyErr_Occurred()) - ErrorPrint("Python controller found the module but could not access the function"); - else - printf("Python module error \"%s\":\n \"%s\" module found but function missing\n", GetName().Ptr(), m_scriptText.Ptr()); - return false; - } - - if(!PyCallable_Check(m_function)) { - Py_DECREF(m_function); - printf("Python module function error \"%s\":\n \"%s\" not callable\n", GetName().Ptr(), m_scriptText.Ptr()); - return false; - } - - m_function_argc = 0; /* rare cases this could be a function that isnt defined in python, assume zero args */ - if (PyFunction_Check(m_function)) { - PyObject *py_arg_count = PyObject_GetAttrString(PyFunction_GET_CODE(m_function), "co_argcount"); - if(py_arg_count) { - m_function_argc = PyLong_AsLong(py_arg_count); - Py_DECREF(py_arg_count); - } - else { - PyErr_Clear(); /* unlikely to fail but just incase */ - } - } - - if(m_function_argc > 1) { - Py_DECREF(m_function); - printf("Python module function has \"%s\":\n \"%s\" takes %d args, should be zero or 1 controller arg\n", GetName().Ptr(), m_scriptText.Ptr(), m_function_argc); - return false; - } - - return true; -} - - -void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) -{ - m_sCurrentController = this; - m_sCurrentLogicManager = logicmgr; - - PyObject *excdict= NULL; - PyObject* resultobj= NULL; - - switch(m_mode) { - case SCA_PYEXEC_SCRIPT: - { - if (m_bModified) - if (Compile()==false) // sets m_bModified to false - return; - if (!m_bytecode) - return; - - /* - * This part here with excdict is a temporary patch - * to avoid python/gameengine crashes when python - * inadvertently holds references to game objects - * in global variables. - * - * The idea is always make a fresh dictionary, and - * destroy it right after it is used to make sure - * python won't hold any gameobject references. - * - * Note that the PyDict_Clear _is_ necessary before - * the Py_DECREF() because it is possible for the - * variables inside the dictionary to hold references - * to the dictionary (ie. generate a cycle), so we - * break it by hand, then DECREF (which in this case - * should always ensure excdict is cleared). - */ - - excdict= PyDict_Copy(m_pythondictionary); - resultobj = PyEval_EvalCode((PyCodeObject*)m_bytecode, excdict, excdict); - /* PyRun_SimpleString(m_scriptText.Ptr()); */ - break; - } - case SCA_PYEXEC_MODULE: - { - if (m_bModified || m_debug) - if (Import()==false) // sets m_bModified to false - return; - if (!m_function) - return; - - PyObject *args= NULL; - - if(m_function_argc==1) { - args = PyTuple_New(1); - PyTuple_SET_ITEM(args, 0, GetProxy()); - } - - resultobj = PyObject_CallObject(m_function, args); - Py_XDECREF(args); - break; - } - - } /* end switch */ - - - - /* Free the return value and print the error */ - if (resultobj) - { - Py_DECREF(resultobj); - } - else - { - // something is wrong, tell the user what went wrong - printf("Python script error from controller \"%s\":\n", GetName().Ptr()); - PyErr_Print(); - - /* Added in 2.48a, the last_traceback can reference Objects for example, increasing - * their user count. Not to mention holding references to wrapped data. - * This is especially bad when the PyObject for the wrapped data is free'd, after blender - * has alredy dealocated the pointer */ - PySys_SetObject( (char *)"last_traceback", NULL); - PyErr_Clear(); /* just to be sure */ - } - - if(excdict) /* Only for SCA_PYEXEC_SCRIPT types */ - { - /* clear after PyErrPrint - seems it can be using - * something in this dictionary and crash? */ - // This doesn't appear to be needed anymore - //PyDict_Clear(excdict); - Py_DECREF(excdict); - } - - m_triggeredSensors.clear(); - m_sCurrentController = NULL; -} - -PyObject* SCA_PythonController::PyActivate(PyObject *value) -{ - if(m_sCurrentController != this) { - PyErr_SetString(PyExc_SystemError, "Cannot add an actuator from a non-active controller"); - return NULL; - } - - SCA_IActuator* actu = LinkedActuatorFromPy(value); - if(actu==NULL) - return NULL; - - m_sCurrentLogicManager->AddActiveActuator((SCA_IActuator*)actu, true); - Py_RETURN_NONE; -} - -PyObject* SCA_PythonController::PyDeActivate(PyObject *value) -{ - if(m_sCurrentController != this) { - PyErr_SetString(PyExc_SystemError, "Cannot add an actuator from a non-active controller"); - return NULL; - } - - SCA_IActuator* actu = LinkedActuatorFromPy(value); - if(actu==NULL) - return NULL; - - m_sCurrentLogicManager->AddActiveActuator((SCA_IActuator*)actu, false); - Py_RETURN_NONE; -} - -PyObject* SCA_PythonController::pyattr_get_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - //SCA_PythonController* self= static_cast(static_cast(static_cast(static_cast(static_cast(self_v))))); - // static_cast(dynamic_cast(obj)) - static_cast(obj) - - SCA_PythonController* self= static_cast(self_v); - return PyUnicode_FromString(self->m_scriptText); -} - - - -int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - SCA_PythonController* self= static_cast(self_v); - - char *scriptArg = _PyUnicode_AsString(value); - - if (scriptArg==NULL) { - PyErr_SetString(PyExc_TypeError, "controller.script = string: Python Controller, expected a string script text"); - return PY_SET_ATTR_FAIL; - } - - /* set scripttext sets m_bModified to true, - so next time the script is needed, a reparse into byte code is done */ - self->SetScriptText(scriptArg); - - return PY_SET_ATTR_SUCCESS; -} - -#else // DISABLE_PYTHON - -void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) -{ - /* intentionally blank */ -} - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h deleted file mode 100644 index bd78014038c..00000000000 --- a/source/gameengine/GameLogic/SCA_PythonController.h +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Execute Python scripts - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef KX_PYTHONCONTROLLER_H -#define KX_PYTHONCONTROLLER_H - -#include "SCA_IController.h" -#include "SCA_LogicManager.h" -#include "BoolValue.h" - -#include - -class SCA_IObject; -class SCA_PythonController : public SCA_IController -{ - Py_Header; -#ifndef DISABLE_PYTHON - struct _object * m_bytecode; /* SCA_PYEXEC_SCRIPT only */ - PyObject* m_function; /* SCA_PYEXEC_MODULE only */ -#endif - int m_function_argc; - bool m_bModified; - bool m_debug; /* use with SCA_PYEXEC_MODULE for reloading every logic run */ - int m_mode; - - - protected: - STR_String m_scriptText; - STR_String m_scriptName; -#ifndef DISABLE_PYTHON - PyObject* m_pythondictionary; /* for SCA_PYEXEC_SCRIPT only */ - PyObject* m_pythonfunction; /* for SCA_PYEXEC_MODULE only */ -#endif - std::vector m_triggeredSensors; - - public: - enum SCA_PyExecMode - { - SCA_PYEXEC_SCRIPT = 0, - SCA_PYEXEC_MODULE, - SCA_PYEXEC_MAX - }; - - static SCA_PythonController* m_sCurrentController; // protected !!! - - //for debugging - //virtual CValue* AddRef(); - //virtual int Release(); // Release a reference to this value (when reference count reaches 0, the value is removed from the heap) - - SCA_PythonController(SCA_IObject* gameobj, int mode); - virtual ~SCA_PythonController(); - - virtual CValue* GetReplica(); - virtual void Trigger(class SCA_LogicManager* logicmgr); - - void SetScriptText(const STR_String& text); - void SetScriptName(const STR_String& name); -#ifndef DISABLE_PYTHON - void SetNamespace(PyObject* pythondictionary); -#endif - void SetDebug(bool debug) { m_debug = debug; } - void AddTriggeredSensor(class SCA_ISensor* sensor) - { m_triggeredSensors.push_back(sensor); } - int IsTriggered(class SCA_ISensor* sensor); - bool Compile(); - bool Import(); - void ErrorPrint(const char *error_msg); - -#ifndef DISABLE_PYTHON - static const char* sPyGetCurrentController__doc__; - static PyObject* sPyGetCurrentController(PyObject* self); - static const char* sPyAddActiveActuator__doc__; - static PyObject* sPyAddActiveActuator(PyObject* self, - PyObject* args); - static SCA_IActuator* LinkedActuatorFromPy(PyObject *value); - - - KX_PYMETHOD_O(SCA_PythonController,Activate); - KX_PYMETHOD_O(SCA_PythonController,DeActivate); - KX_PYMETHOD_O(SCA_PythonController,SetScript); - KX_PYMETHOD_NOARGS(SCA_PythonController,GetScript); - - - static PyObject* pyattr_get_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); -#endif -}; - -#endif //KX_PYTHONCONTROLLER_H - diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp deleted file mode 100644 index 7951a749254..00000000000 --- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_PythonKeyboard.h" -#include "SCA_IInputDevice.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_PythonKeyboard::SCA_PythonKeyboard(SCA_IInputDevice* keyboard) -: PyObjectPlus(), -m_keyboard(keyboard) -{ -} - -SCA_PythonKeyboard::~SCA_PythonKeyboard() -{ - /* intentionally empty */ -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_PythonKeyboard::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_PythonKeyboard", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &PyObjectPlus::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_PythonKeyboard::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_PythonKeyboard::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_PythonKeyboard, pyattr_get_events), - { NULL } //Sentinel -}; - -PyObject* SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_PythonKeyboard* self = static_cast(self_v); - - PyObject* resultlist = PyList_New(0); - - for (int i=SCA_IInputDevice::KX_BEGINKEY; i<=SCA_IInputDevice::KX_ENDKEY; i++) - { - const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i); - - - if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) - { - PyObject* keypair = PyTuple_New(2); - PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i)); - PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status)); - PyList_Append(resultlist, keypair); - } - } - - return resultlist; -} - -#endif diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.h b/source/gameengine/GameLogic/SCA_PythonKeyboard.h deleted file mode 100644 index 0b353ac444c..00000000000 --- a/source/gameengine/GameLogic/SCA_PythonKeyboard.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_PYKEYBOARD -#define __KX_PYKEYBOARD - -#include "PyObjectPlus.h" - -class SCA_PythonKeyboard : public PyObjectPlus -{ - Py_Header; - class SCA_IInputDevice *m_keyboard; -public: - SCA_PythonKeyboard(class SCA_IInputDevice* keyboard); - virtual ~SCA_PythonKeyboard(); - -#ifndef DISABLE_PYTHON - static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); -#endif -}; - -#endif //__KX_PYKEYBOARD - diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp deleted file mode 100644 index b2bb68f020e..00000000000 --- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_PythonMouse.h" -#include "SCA_IInputDevice.h" -#include "RAS_ICanvas.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_PythonMouse::SCA_PythonMouse(SCA_IInputDevice* mouse, RAS_ICanvas* canvas) -: PyObjectPlus(), -m_canvas(canvas), -m_mouse(mouse) -{ -} - -SCA_PythonMouse::~SCA_PythonMouse() -{ - /* intentionally empty */ -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_PythonMouse::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_PythonMouse", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &PyObjectPlus::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_PythonMouse::Methods[] = { -// KX_PYMETHODTABLE(SCA_PythonMouse, show), - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_PythonMouse::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_PythonMouse, pyattr_get_events), - KX_PYATTRIBUTE_RW_FUNCTION("position", SCA_PythonMouse, pyattr_get_position, pyattr_set_position), - KX_PYATTRIBUTE_RW_FUNCTION("visible", SCA_PythonMouse, pyattr_get_visible, pyattr_set_visible), - { NULL } //Sentinel -}; - -PyObject* SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_PythonMouse* self = static_cast(self_v); - - PyObject* resultlist = PyList_New(0); - - for (int i=SCA_IInputDevice::KX_BEGINMOUSE; i<=SCA_IInputDevice::KX_ENDMOUSE; i++) - { - const SCA_InputEvent & inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i); - - - if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) - { - PyObject* keypair = PyTuple_New(2); - PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i)); - PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status)); - PyList_Append(resultlist, keypair); - } - } - - return resultlist; -} - -PyObject* SCA_PythonMouse::pyattr_get_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_PythonMouse* self = static_cast(self_v); - const SCA_InputEvent & xevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEX); - const SCA_InputEvent & yevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEY); - - float x_coord, y_coord; - - x_coord = self->m_canvas->GetMouseNormalizedX(xevent.m_eventval); - y_coord = self->m_canvas->GetMouseNormalizedY(yevent.m_eventval); - - PyObject* ret = PyTuple_New(2); - - PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(x_coord)); - PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(y_coord)); - - return ret; -} - -int SCA_PythonMouse::pyattr_set_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - SCA_PythonMouse* self = static_cast(self_v); - int x, y; - float pyx, pyy; - if (!PyArg_ParseTuple(value, "ff:position", &pyx, &pyy)) - return PY_SET_ATTR_FAIL; - - x = (int)(pyx*self->m_canvas->GetWidth()); - y = (int)(pyy*self->m_canvas->GetHeight()); - - self->m_canvas->SetMousePosition(x, y); - - return PY_SET_ATTR_SUCCESS; -} - -PyObject* SCA_PythonMouse::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_PythonMouse* self = static_cast(self_v); - - int visible; - - if (self->m_canvas->GetMouseState() == RAS_ICanvas::MOUSE_INVISIBLE) - visible = 0; - else - visible = 1; - - return PyBool_FromLong(visible); -} - -int SCA_PythonMouse::pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - SCA_PythonMouse* self = static_cast(self_v); - - int visible = PyObject_IsTrue(value); - - if (visible == -1) - { - PyErr_SetString(PyExc_AttributeError, "SCA_PythonMouse.visible = bool: SCA_PythonMouse, expected True or False"); - return PY_SET_ATTR_FAIL; - } - - if (visible) - self->m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); - else - self->m_canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); - - return PY_SET_ATTR_SUCCESS; -} - -#endif diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.h b/source/gameengine/GameLogic/SCA_PythonMouse.h deleted file mode 100644 index c73e6683fc8..00000000000 --- a/source/gameengine/GameLogic/SCA_PythonMouse.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_PYMOUSE -#define __KX_PYMOUSE - -#include "PyObjectPlus.h" - -class SCA_PythonMouse : public PyObjectPlus -{ - Py_Header; - class SCA_IInputDevice *m_mouse; - class RAS_ICanvas *m_canvas; -public: - SCA_PythonMouse(class SCA_IInputDevice* mouse, class RAS_ICanvas* canvas); - virtual ~SCA_PythonMouse(); - - void Show(bool visible); - -#ifndef DISABLE_PYTHON - KX_PYMETHOD_DOC(SCA_PythonMouse, show); - - static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); - static PyObject* pyattr_get_visible(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_visible(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); -#endif -}; - -#endif //__KX_PYMOUSE - diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp deleted file mode 100644 index 4b90ca7dadf..00000000000 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ /dev/null @@ -1,550 +0,0 @@ -/** - * Set random/camera stuff - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "BoolValue.h" -#include "IntValue.h" -#include "FloatValue.h" -#include "SCA_IActuator.h" -#include "SCA_RandomActuator.h" -#include "math.h" -#include "MT_Transform.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj, - long seed, - SCA_RandomActuator::KX_RANDOMACT_MODE mode, - float para1, - float para2, - const STR_String &propName) - : SCA_IActuator(gameobj, KX_ACT_RANDOM), - m_propname(propName), - m_parameter1(para1), - m_parameter2(para2), - m_distribution(mode) -{ - m_base = new SCA_RandomNumberGenerator(seed); - m_counter = 0; - enforceConstraints(); -} - - - -SCA_RandomActuator::~SCA_RandomActuator() -{ - m_base->Release(); -} - - - -CValue* SCA_RandomActuator::GetReplica() -{ - SCA_RandomActuator* replica = new SCA_RandomActuator(*this); - // replication just copy the m_base pointer => common random generator - replica->ProcessReplica(); - return replica; -} - -void SCA_RandomActuator::ProcessReplica() -{ - SCA_IActuator::ProcessReplica(); - // increment reference count so that we can release the generator at the end - m_base->AddRef(); -} - - - -bool SCA_RandomActuator::Update() -{ - //bool result = false; /*unused*/ - bool bNegativeEvent = IsNegativeEvent(); - - RemoveAllEvents(); - - - CValue *tmpval = NULL; - - if (bNegativeEvent) - return false; // do nothing on negative events - - switch (m_distribution) { - case KX_RANDOMACT_BOOL_CONST: { - /* un petit peu filthy */ - bool res = !(m_parameter1 < 0.5); - tmpval = new CBoolValue(res); - } - break; - case KX_RANDOMACT_BOOL_UNIFORM: { - /* flip a coin */ - bool res; - if (m_counter > 31) { - m_previous = m_base->Draw(); - res = ((m_previous & 0x1) == 0); - m_counter = 1; - } else { - res = (((m_previous >> m_counter) & 0x1) == 0); - m_counter++; - } - tmpval = new CBoolValue(res); - } - break; - case KX_RANDOMACT_BOOL_BERNOUILLI: { - /* 'percentage' */ - bool res; - res = (m_base->DrawFloat() < m_parameter1); - tmpval = new CBoolValue(res); - } - break; - case KX_RANDOMACT_INT_CONST: { - /* constant */ - tmpval = new CIntValue((int) floor(m_parameter1)); - } - break; - case KX_RANDOMACT_INT_UNIFORM: { - /* uniform (toss a die) */ - int res; - /* The [0, 1] interval is projected onto the [min, max+1] domain, */ - /* and then rounded. */ - res = (int) floor( ((m_parameter2 - m_parameter1 + 1) * m_base->DrawFloat()) - + m_parameter1); - tmpval = new CIntValue(res); - } - break; - case KX_RANDOMACT_INT_POISSON: { - /* poisson (queues) */ - /* If x_1, x_2, ... is a sequence of random numbers with uniform */ - /* distribution between zero and one, k is the first integer for */ - /* which the product x_1*x_2*...*x_k < exp(-\lamba). */ - float a = 0.0, b = 0.0; - int res = 0; - /* The - sign is important here! The number to test for, a, must be */ - /* between 0 and 1. */ - a = exp(-m_parameter1); - /* a quickly reaches 0.... so we guard explicitly for that. */ - if (a < FLT_MIN) a = FLT_MIN; - b = m_base->DrawFloat(); - while (b >= a) { - b = b * m_base->DrawFloat(); - res++; - }; - tmpval = new CIntValue(res); - } - break; - case KX_RANDOMACT_FLOAT_CONST: { - /* constant */ - tmpval = new CFloatValue(m_parameter1); - } - break; - case KX_RANDOMACT_FLOAT_UNIFORM: { - float res = ((m_parameter2 - m_parameter1) * m_base->DrawFloat()) - + m_parameter1; - tmpval = new CFloatValue(res); - } - break; - case KX_RANDOMACT_FLOAT_NORMAL: { - /* normal (big numbers): para1 = mean, para2 = std dev */ - - /* - - 070301 - nzc - Changed the termination condition. I think I - made a small mistake here, but it only affects distro's where - the seed equals 0. In that case, the algorithm locks. Let's - just guard that case separately. - - */ - - float x = 0.0, y = 0.0, s = 0.0, t = 0.0; - if (m_base->GetSeed() == 0) { - /* - - 070301 - nzc - Just taking the mean here seems reasonable. - - */ - tmpval = new CFloatValue(m_parameter1); - } else { - /* - - 070301 - nzc - Now, with seed != 0, we will most assuredly get some - sensible values. The termination condition states two - things: - 1. s >= 0 is not allowed: to prevent the distro from - getting a bias towards high values. This is a small - correction, really, and might also be left out. - 2. s == 0 is not allowed: to prevent a division by zero - when renormalising the drawn value to the desired - distribution shape. As a side effect, the distro will - never yield the exact mean. - I am not sure whether this is consistent, since the error - cause by #2 is of the same magnitude as the one - prevented by #1. The error introduced into the SD will be - improved, though. By how much? Hard to say... If you like - the maths, feel free to analyse. Be aware that this is - one of the really old standard algorithms. I think the - original came in Fortran, was translated to Pascal, and - then someone came up with the C code. My guess it that - this will be quite sufficient here. - - */ - do - { - x = 2.0 * m_base->DrawFloat() - 1.0; - y = 2.0 * m_base->DrawFloat() - 1.0; - s = x*x + y*y; - } while ( (s >= 1.0) || (s == 0.0) ); - t = x * sqrt( (-2.0 * log(s)) / s); - tmpval = new CFloatValue(m_parameter1 + m_parameter2 * t); - } - } - break; - case KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL: { - /* 1st order fall-off. I am very partial to using the half-life as */ - /* controlling parameter. Using the 'normal' exponent is not very */ - /* intuitive... */ - /* tmpval = new CFloatValue( (1.0 / m_parameter1) */ - tmpval = new CFloatValue( (m_parameter1) - * (-log(1.0 - m_base->DrawFloat())) ); - - } - break; - default: - { - /* unknown distribution... */ - static bool randomWarning = false; - if (!randomWarning) { - randomWarning = true; - std::cout << "RandomActuator '" << GetName() << "' has an unknown distribution." << std::endl; - } - return false; - } - } - - /* Round up: assign it */ - CValue *prop = GetParent()->GetProperty(m_propname); - if (prop) { - prop->SetValue(tmpval); - } - tmpval->Release(); - - return false; -} - -void SCA_RandomActuator::enforceConstraints() { - /* The constraints that are checked here are the ones fundamental to */ - /* the various distributions. Limitations of the algorithms are checked */ - /* elsewhere (or they should be... ). */ - switch (m_distribution) { - case KX_RANDOMACT_BOOL_CONST: - case KX_RANDOMACT_BOOL_UNIFORM: - case KX_RANDOMACT_INT_CONST: - case KX_RANDOMACT_INT_UNIFORM: - case KX_RANDOMACT_FLOAT_UNIFORM: - case KX_RANDOMACT_FLOAT_CONST: - ; /* Nothing to be done here. We allow uniform distro's to have */ - /* 'funny' domains, i.e. max < min. This does not give problems. */ - break; - case KX_RANDOMACT_BOOL_BERNOUILLI: - /* clamp to [0, 1] */ - if (m_parameter1 < 0.0) { - m_parameter1 = 0.0; - } else if (m_parameter1 > 1.0) { - m_parameter1 = 1.0; - } - break; - case KX_RANDOMACT_INT_POISSON: - /* non-negative */ - if (m_parameter1 < 0.0) { - m_parameter1 = 0.0; - } - break; - case KX_RANDOMACT_FLOAT_NORMAL: - /* standard dev. is non-negative */ - if (m_parameter2 < 0.0) { - m_parameter2 = 0.0; - } - break; - case KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL: - /* halflife must be non-negative */ - if (m_parameter1 < 0.0) { - m_parameter1 = 0.0; - } - break; - default: - ; /* unknown distribution... */ - } -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_RandomActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_RandomActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_RandomActuator::Methods[] = { - KX_PYMETHODTABLE(SCA_RandomActuator, setBoolConst), - KX_PYMETHODTABLE_NOARGS(SCA_RandomActuator, setBoolUniform), - KX_PYMETHODTABLE(SCA_RandomActuator, setBoolBernouilli), - - KX_PYMETHODTABLE(SCA_RandomActuator, setIntConst), - KX_PYMETHODTABLE(SCA_RandomActuator, setIntUniform), - KX_PYMETHODTABLE(SCA_RandomActuator, setIntPoisson), - - KX_PYMETHODTABLE(SCA_RandomActuator, setFloatConst), - KX_PYMETHODTABLE(SCA_RandomActuator, setFloatUniform), - KX_PYMETHODTABLE(SCA_RandomActuator, setFloatNormal), - KX_PYMETHODTABLE(SCA_RandomActuator, setFloatNegativeExponential), - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_RandomActuator::Attributes[] = { - KX_PYATTRIBUTE_FLOAT_RO("para1",SCA_RandomActuator,m_parameter1), - KX_PYATTRIBUTE_FLOAT_RO("para2",SCA_RandomActuator,m_parameter2), - KX_PYATTRIBUTE_ENUM_RO("distribution",SCA_RandomActuator,m_distribution), - KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,100,false,SCA_RandomActuator,m_propname,CheckProperty), - KX_PYATTRIBUTE_RW_FUNCTION("seed",SCA_RandomActuator,pyattr_get_seed,pyattr_set_seed), - { NULL } //Sentinel -}; - -PyObject* SCA_RandomActuator::pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_RandomActuator* act = static_cast(self); - return PyLong_FromSsize_t(act->m_base->GetSeed()); -} - -int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - SCA_RandomActuator* act = static_cast(self); - if (PyLong_Check(value)) { - int ival = PyLong_AsSsize_t(value); - act->m_base->SetSeed(ival); - return PY_SET_ATTR_SUCCESS; - } else { - PyErr_SetString(PyExc_TypeError, "actuator.seed = int: Random Actuator, expected an integer"); - return PY_SET_ATTR_FAIL; - } -} - -/* 11. setBoolConst */ -KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolConst, -"setBoolConst(value)\n" -"\t- value: 0 or 1\n" -"\tSet this generator to produce a constant boolean value.\n") -{ - int paraArg; - if(!PyArg_ParseTuple(args, "i:setBoolConst", ¶Arg)) { - return NULL; - } - - m_distribution = KX_RANDOMACT_BOOL_CONST; - m_parameter1 = (paraArg) ? 1.0 : 0.0; - - Py_RETURN_NONE; -} -/* 12. setBoolUniform, */ -KX_PYMETHODDEF_DOC_NOARGS(SCA_RandomActuator, setBoolUniform, -"setBoolUniform()\n" -"\tSet this generator to produce true and false, each with 50%% chance of occuring\n") -{ - /* no args */ - m_distribution = KX_RANDOMACT_BOOL_UNIFORM; - enforceConstraints(); - Py_RETURN_NONE; -} -/* 13. setBoolBernouilli, */ -KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolBernouilli, -"setBoolBernouilli(value)\n" -"\t- value: a float between 0 and 1\n" -"\tReturn false value * 100%% of the time.\n") -{ - float paraArg; - if(!PyArg_ParseTuple(args, "f:setBoolBernouilli", ¶Arg)) { - return NULL; - } - - m_distribution = KX_RANDOMACT_BOOL_BERNOUILLI; - m_parameter1 = paraArg; - enforceConstraints(); - Py_RETURN_NONE; -} -/* 14. setIntConst,*/ -KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntConst, -"setIntConst(value)\n" -"\t- value: integer\n" -"\tAlways return value\n") -{ - int paraArg; - if(!PyArg_ParseTuple(args, "i:setIntConst", ¶Arg)) { - return NULL; - } - - m_distribution = KX_RANDOMACT_INT_CONST; - m_parameter1 = paraArg; - enforceConstraints(); - Py_RETURN_NONE; -} -/* 15. setIntUniform,*/ -KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntUniform, -"setIntUniform(lower_bound, upper_bound)\n" -"\t- lower_bound: integer\n" -"\t- upper_bound: integer\n" -"\tReturn a random integer between lower_bound and\n" -"\tupper_bound. The boundaries are included.\n") -{ - int paraArg1, paraArg2; - if(!PyArg_ParseTuple(args, "ii:setIntUniform", ¶Arg1, ¶Arg2)) { - return NULL; - } - - m_distribution = KX_RANDOMACT_INT_UNIFORM; - m_parameter1 = paraArg1; - m_parameter2 = paraArg2; - enforceConstraints(); - Py_RETURN_NONE; -} -/* 16. setIntPoisson, */ -KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntPoisson, -"setIntPoisson(value)\n" -"\t- value: float\n" -"\tReturn a Poisson-distributed number. This performs a series\n" -"\tof Bernouilli tests with parameter value. It returns the\n" -"\tnumber of tries needed to achieve succes.\n") -{ - float paraArg; - if(!PyArg_ParseTuple(args, "f:setIntPoisson", ¶Arg)) { - return NULL; - } - - m_distribution = KX_RANDOMACT_INT_POISSON; - m_parameter1 = paraArg; - enforceConstraints(); - Py_RETURN_NONE; -} -/* 17. setFloatConst */ -KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatConst, -"setFloatConst(value)\n" -"\t- value: float\n" -"\tAlways return value\n") -{ - float paraArg; - if(!PyArg_ParseTuple(args, "f:setFloatConst", ¶Arg)) { - return NULL; - } - - m_distribution = KX_RANDOMACT_FLOAT_CONST; - m_parameter1 = paraArg; - enforceConstraints(); - Py_RETURN_NONE; -} -/* 18. setFloatUniform, */ -KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatUniform, -"setFloatUniform(lower_bound, upper_bound)\n" -"\t- lower_bound: float\n" -"\t- upper_bound: float\n" -"\tReturn a random integer between lower_bound and\n" -"\tupper_bound.\n") -{ - float paraArg1, paraArg2; - if(!PyArg_ParseTuple(args, "ff:setFloatUniform", ¶Arg1, ¶Arg2)) { - return NULL; - } - - m_distribution = KX_RANDOMACT_FLOAT_UNIFORM; - m_parameter1 = paraArg1; - m_parameter2 = paraArg2; - enforceConstraints(); - Py_RETURN_NONE; -} -/* 19. setFloatNormal, */ -KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNormal, -"setFloatNormal(mean, standard_deviation)\n" -"\t- mean: float\n" -"\t- standard_deviation: float\n" -"\tReturn normal-distributed numbers. The average is mean, and the\n" -"\tdeviation from the mean is characterized by standard_deviation.\n") -{ - float paraArg1, paraArg2; - if(!PyArg_ParseTuple(args, "ff:setFloatNormal", ¶Arg1, ¶Arg2)) { - return NULL; - } - - m_distribution = KX_RANDOMACT_FLOAT_NORMAL; - m_parameter1 = paraArg1; - m_parameter2 = paraArg2; - enforceConstraints(); - Py_RETURN_NONE; -} -/* 20. setFloatNegativeExponential, */ -KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential, -"setFloatNegativeExponential(half_life)\n" -"\t- half_life: float\n" -"\tReturn negative-exponentially distributed numbers. The half-life 'time'\n" -"\tis characterized by half_life.\n") -{ - float paraArg; - if(!PyArg_ParseTuple(args, "f:setFloatNegativeExponential", ¶Arg)) { - return NULL; - } - - m_distribution = KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL; - m_parameter1 = paraArg; - enforceConstraints(); - Py_RETURN_NONE; -} - -#endif - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.h b/source/gameengine/GameLogic/SCA_RandomActuator.h deleted file mode 100644 index 41d19f5b4c4..00000000000 --- a/source/gameengine/GameLogic/SCA_RandomActuator.h +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Draw a random number, and put it in a property - * - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_RANDOMACTUATOR -#define __KX_RANDOMACTUATOR - -#include "SCA_IActuator.h" -#include "SCA_RandomNumberGenerator.h" - -class SCA_RandomActuator : public SCA_IActuator -{ - Py_Header; - /** Property to assign to */ - STR_String m_propname; - - /** First parameter. The meaning of the parameters depends on the - * distribution */ - float m_parameter1; - /** Second parameter. The meaning of the parameters depends on the - * distribution */ - float m_parameter2; - - /** The base generator */ - SCA_RandomNumberGenerator *m_base; - - /** just a generic, persistent counter */ - int m_counter; - - /** cache for the previous draw */ - long m_previous; - - /** apply constraints for the chosen distribution to the parameters */ - void enforceConstraints(void); - - public: - - enum KX_RANDOMACT_MODE { - KX_RANDOMACT_NODEF, - KX_RANDOMACT_BOOL_CONST, - KX_RANDOMACT_BOOL_UNIFORM, - KX_RANDOMACT_BOOL_BERNOUILLI, - KX_RANDOMACT_INT_CONST, - KX_RANDOMACT_INT_UNIFORM, - KX_RANDOMACT_INT_POISSON, - KX_RANDOMACT_FLOAT_CONST, - KX_RANDOMACT_FLOAT_UNIFORM, - KX_RANDOMACT_FLOAT_NORMAL, - KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL, - KX_RANDOMACT_MAX - }; - /** distribution type */ - KX_RANDOMACT_MODE m_distribution; - - SCA_RandomActuator(class SCA_IObject* gameobj, - long seed, - KX_RANDOMACT_MODE mode, - float para1, - float para2, - const STR_String &propName); - virtual ~SCA_RandomActuator(); - virtual bool Update(); - - virtual CValue* GetReplica(); - virtual void ProcessReplica(); - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - static PyObject* pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setBoolConst); - KX_PYMETHOD_DOC_NOARGS(SCA_RandomActuator, setBoolUniform); - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setBoolBernouilli); - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setIntConst); - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setIntUniform); - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setIntPoisson); - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatConst); - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatUniform); - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatNormal); - KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential); - -#endif // DISABLE_PYTHON - -}; /* end of class KX_EditObjectActuator : public SCA_PropertyActuator */ - -#endif - diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.cpp b/source/gameengine/GameLogic/SCA_RandomEventManager.cpp deleted file mode 100644 index a0ffed57ba5..00000000000 --- a/source/gameengine/GameLogic/SCA_RandomEventManager.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Manager for random events - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "SCA_RandomEventManager.h" -#include "SCA_LogicManager.h" -#include "SCA_ISensor.h" -#include -using namespace std; - -#include -#include - -SCA_RandomEventManager::SCA_RandomEventManager(class SCA_LogicManager* logicmgr) - : SCA_EventManager(logicmgr, RANDOM_EVENTMGR) -{ -} - - -void SCA_RandomEventManager::NextFrame() -{ - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - (*it)->Activate(m_logicmgr); - } -} - diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.h b/source/gameengine/GameLogic/SCA_RandomEventManager.h deleted file mode 100644 index 386ec886f06..00000000000 --- a/source/gameengine/GameLogic/SCA_RandomEventManager.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Manager for random events - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_RANDOMEVENTMGR -#define __KX_RANDOMEVENTMGR - -#include "SCA_EventManager.h" -#include - -using namespace std; - -class SCA_RandomEventManager : public SCA_EventManager -{ -public: - SCA_RandomEventManager(class SCA_LogicManager* logicmgr); - - virtual void NextFrame(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_RandomEventManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_RANDOMEVENTMGR - diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp deleted file mode 100644 index f5cd4b07458..00000000000 --- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Generate random numbers that can be used by other components. We - * convert to different types/distributions elsewhere. This just - * delivers a clean, random bitvector. - * - * $Id$ - */ - -/* A C-program for MT19937: Real number version */ -/* genrand() generates one pseudorandom real number (double) */ -/* which is uniformly distributed on [0,1]-interval, for each */ -/* call. sgenrand(seed) set initial values to the working area */ -/* of 624 words. Before genrand(), sgenrand(seed) must be */ -/* called once. (seed is any 32-bit integer except for 0). */ -/* Integer generator is obtained by modifying two lines. */ -/* Coded by Takuji Nishimura, considering the suggestions by */ -/* Topher Cooper and Marc Rieffel in July-Aug. 1997. */ - -/* This library is free software; you can redistribute it and/or */ -/* modify it under the terms of the GNU Library General Public */ -/* License as published by the Free Software Foundation; either */ -/* version 2 of the License, or (at your option) any later */ -/* version. */ -/* This library is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -/* See the GNU Library General Public License for more details. */ -/* You should have received a copy of the GNU Library General */ -/* Public License along with this library; if not, write to the */ -/* Free Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA */ -/* 02110-1301, USA */ - -/* Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. */ -/* When you use this, send an email to: matumoto@math.keio.ac.jp */ -/* with an appropriate reference to your work. */ - -#include -#include "SCA_RandomNumberGenerator.h" - -/* Period parameters */ -#define N 624 -#define M 397 -#define MATRIX_A 0x9908b0df /* constant vector a */ -#define UPPER_MASK 0x80000000 /* most significant w-r bits */ -#define LOWER_MASK 0x7fffffff /* least significant r bits */ - -/* Tempering parameters */ -#define TEMPERING_MASK_B 0x9d2c5680 -#define TEMPERING_MASK_C 0xefc60000 -#define TEMPERING_SHIFT_U(y) (y >> 11) -#define TEMPERING_SHIFT_S(y) (y << 7) -#define TEMPERING_SHIFT_T(y) (y << 15) -#define TEMPERING_SHIFT_L(y) (y >> 18) - -SCA_RandomNumberGenerator::SCA_RandomNumberGenerator(long seed) { - // int mti = N + 1; /*unused*/ - m_seed = seed; - m_refcount = 1; - SetStartVector(); -} - -SCA_RandomNumberGenerator::~SCA_RandomNumberGenerator() { - /* intentionally empty */ -} - -void SCA_RandomNumberGenerator::SetStartVector(void) { - /* setting initial seeds to mt[N] using */ - /* the generator Line 25 of Table 1 in */ - /* [KNUTH 1981, The Art of Computer Programming */ - /* Vol. 2 (2nd Ed.), pp102] */ - mt[0] = m_seed & 0xffffffff; - for (mti = 1; mti < N; mti++) - mt[mti] = (69069 * mt[mti-1]) & 0xffffffff; -} - -long SCA_RandomNumberGenerator::GetSeed() { return m_seed; } -void SCA_RandomNumberGenerator::SetSeed(long newseed) -{ - m_seed = newseed; - SetStartVector(); -} - -/** - * This is the important part: copied verbatim :) - */ -unsigned long SCA_RandomNumberGenerator::Draw() { - static unsigned long mag01[2] = { 0x0, MATRIX_A }; - /* mag01[x] = x * MATRIX_A for x=0,1 */ - - unsigned long y; - - if (mti >= N) { /* generate N words at one time */ - int kk; - - /* I set this in the constructor, so it is always satisfied ! */ -// if (mti == N+1) /* if sgenrand() has not been called, */ -// GEN_srand(4357); /* a default initial seed is used */ - - for (kk = 0; kk < N - M; kk++) { - y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK); - mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1]; - } - for (; kk < N-1; kk++) { - y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK); - mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1]; - } - y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK); - mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1]; - - mti = 0; - } - - y = mt[mti++]; - y ^= TEMPERING_SHIFT_U(y); - y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B; - y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C; - y ^= TEMPERING_SHIFT_L(y); - - return y; -} - -float SCA_RandomNumberGenerator::DrawFloat() { - return ( (float) Draw()/ (unsigned long) 0xffffffff ); -} - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h deleted file mode 100644 index 1e644fe5c26..00000000000 --- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Generate random numbers that can be used by other components. Each - * generator needs its own generator, so that the seed can be set - * on a per-generator basis. - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_RANDOMNUMBERGENERATOR -#define __KX_RANDOMNUMBERGENERATOR - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class SCA_RandomNumberGenerator { - - /* reference counted for memleak */ - int m_refcount; - - /** base seed */ - long m_seed; - - /* A bit silly.. The N parameter is a define in the .cpp file */ - /** the array for the state vector */ - /* unsigned long mt[N]; */ - unsigned long mt[624]; - - /** mti==N+1 means mt[KX_MT_VectorLenght] is not initialized */ - int mti; /* initialised in the cpp file */ - - /** Calculate a start vector */ - void SetStartVector(void); - public: - SCA_RandomNumberGenerator(long seed); - ~SCA_RandomNumberGenerator(); - unsigned long Draw(); - float DrawFloat(); - long GetSeed(); - void SetSeed(long newseed); - SCA_RandomNumberGenerator* AddRef() - { - ++m_refcount; - return this; - } - void Release() - { - if (--m_refcount == 0) - delete this; - } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_RandomNumberGenerator"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif /* __KX_RANDOMNUMBERGENERATOR */ - diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp deleted file mode 100644 index a7d18ff40d4..00000000000 --- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/** - * Generate random pulses - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_RandomSensor.h" -#include "SCA_EventManager.h" -#include "SCA_RandomEventManager.h" -#include "SCA_LogicManager.h" -#include "ConstExpr.h" -#include - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_RandomSensor::SCA_RandomSensor(SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - int startseed) - : SCA_ISensor(gameobj,eventmgr) -{ - m_basegenerator = new SCA_RandomNumberGenerator(startseed); - Init(); -} - - - -SCA_RandomSensor::~SCA_RandomSensor() -{ - m_basegenerator->Release(); -} - -void SCA_RandomSensor::Init() -{ - m_iteration = 0; - m_interval = 0; - m_lastdraw = false; - m_currentDraw = m_basegenerator->Draw(); -} - - -CValue* SCA_RandomSensor::GetReplica() -{ - CValue* replica = new SCA_RandomSensor(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - -void SCA_RandomSensor::ProcessReplica() -{ - SCA_ISensor::ProcessReplica(); - // increment reference count so that we can release the generator at this end - m_basegenerator->AddRef(); -} - - -bool SCA_RandomSensor::IsPositiveTrigger() -{ - return (m_invert !=m_lastdraw); -} - - -bool SCA_RandomSensor::Evaluate() -{ - /* Random generator is the generator from Line 25 of Table 1 in */ - /* [KNUTH 1981, The Art of Computer Programming Vol. 2 */ - /* (2nd Ed.), pp102] */ - /* It's a very simple max. length sequence generator. We can */ - /* draw 32 bool values before having to generate the next */ - /* sequence value. There are some theorems that will tell you */ - /* this is a reasonable way of generating bools. Check Knuth. */ - /* Furthermore, we only draw each -eth frame. */ - - bool evaluateResult = false; - - if (++m_interval > m_pulse_frequency) { - bool drawResult = false; - m_interval = 0; - if (m_iteration > 31) { - m_currentDraw = m_basegenerator->Draw(); - drawResult = (m_currentDraw & 0x1) == 0; - m_iteration = 1; - } else { - drawResult = ((m_currentDraw >> m_iteration) & 0x1) == 0; - m_iteration++; - } - evaluateResult = drawResult != m_lastdraw; - m_lastdraw = drawResult; - } - - /* now pass this result to some controller */ - return evaluateResult; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_RandomSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_RandomSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_RandomSensor::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_RandomSensor::Attributes[] = { - KX_PYATTRIBUTE_BOOL_RO("lastDraw",SCA_RandomSensor,m_lastdraw), - KX_PYATTRIBUTE_RW_FUNCTION("seed", SCA_RandomSensor, pyattr_get_seed, pyattr_set_seed), - {NULL} //Sentinel -}; - -PyObject* SCA_RandomSensor::pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - SCA_RandomSensor* self= static_cast(self_v); - return PyLong_FromSsize_t(self->m_basegenerator->GetSeed()); -} - -int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - SCA_RandomSensor* self= static_cast(self_v); - if (!PyLong_Check(value)) { - PyErr_SetString(PyExc_TypeError, "sensor.seed = int: Random Sensor, expected an integer"); - return PY_SET_ATTR_FAIL; - } - self->m_basegenerator->SetSeed(PyLong_AsSsize_t(value)); - return PY_SET_ATTR_SUCCESS; -} - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.h b/source/gameengine/GameLogic/SCA_RandomSensor.h deleted file mode 100644 index 3be17943d84..00000000000 --- a/source/gameengine/GameLogic/SCA_RandomSensor.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Generate random pulses - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_RANDOMSENSOR -#define __KX_RANDOMSENSOR - -#include "SCA_ISensor.h" -#include "BoolValue.h" -#include "SCA_RandomNumberGenerator.h" - -class SCA_RandomSensor : public SCA_ISensor -{ - Py_Header; - - unsigned int m_currentDraw; - int m_iteration; - int m_interval; - SCA_RandomNumberGenerator *m_basegenerator; - bool m_lastdraw; -public: - SCA_RandomSensor(class SCA_EventManager* rndmgr, - SCA_IObject* gameobj, - int startseed); - virtual ~SCA_RandomSensor(); - virtual CValue* GetReplica(); - virtual void ProcessReplica(); - virtual bool Evaluate(); - virtual bool IsPositiveTrigger(); - virtual void Init(); - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - static PyObject* pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); -#endif -}; - -#endif //__KX_RANDOMSENSOR - diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp deleted file mode 100644 index d794a4f1227..00000000000 --- a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 - -// This warning tells us about truncation of __long__ stl-generated names. -// It can occasionally cause DevStudio to have internal compiler warnings. -#pragma warning( disable : 4786 ) -#endif - -#include "SCA_TimeEventManager.h" - -#include "SCA_LogicManager.h" -#include "FloatValue.h" - -SCA_TimeEventManager::SCA_TimeEventManager(SCA_LogicManager* logicmgr) -: SCA_EventManager(NULL, TIME_EVENTMGR) -{ -} - - - -SCA_TimeEventManager::~SCA_TimeEventManager() -{ - for (vector::iterator it = m_timevalues.begin(); - !(it == m_timevalues.end()); ++it) - { - (*it)->Release(); - } -} - - - -void SCA_TimeEventManager::RegisterSensor(SCA_ISensor* sensor) -{ - // not yet -} - -void SCA_TimeEventManager::RemoveSensor(SCA_ISensor* sensor) -{ - // empty -} - - - -void SCA_TimeEventManager::NextFrame(double curtime, double fixedtime) -{ - if (m_timevalues.size() > 0 && fixedtime > 0.0) - { - CFloatValue* floatval = new CFloatValue(curtime); - - // update sensors, but ... need deltatime ! - for (vector::iterator it = m_timevalues.begin(); - !(it == m_timevalues.end()); ++it) - { - float newtime = (*it)->GetNumber() + fixedtime; - floatval->SetFloat(newtime); - (*it)->SetValue(floatval); - } - - floatval->Release(); - } -} - - - -void SCA_TimeEventManager::AddTimeProperty(CValue* timeval) -{ - timeval->AddRef(); - m_timevalues.push_back(timeval); -} - - - -void SCA_TimeEventManager::RemoveTimeProperty(CValue* timeval) -{ - for (vector::iterator it = m_timevalues.begin(); - !(it == m_timevalues.end()); ++it) - { - if ((*it) == timeval) - { - this->m_timevalues.erase(it); - timeval->Release(); - break; - } - } -} diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.h b/source/gameengine/GameLogic/SCA_TimeEventManager.h deleted file mode 100644 index ad4f343d137..00000000000 --- a/source/gameengine/GameLogic/SCA_TimeEventManager.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_TIMEEVENTMANAGER -#define __KX_TIMEEVENTMANAGER - -#include "SCA_EventManager.h" -#include "Value.h" -#include - -using namespace std; - -class SCA_TimeEventManager : public SCA_EventManager -{ - vector m_timevalues; // values that need their time updated regularly - -public: - SCA_TimeEventManager(class SCA_LogicManager* logicmgr); - virtual ~SCA_TimeEventManager(); - - virtual void NextFrame(double curtime, double fixedtime); - virtual void RegisterSensor(class SCA_ISensor* sensor); - virtual void RemoveSensor(class SCA_ISensor* sensor); - void AddTimeProperty(CValue* timeval); - void RemoveTimeProperty(CValue* timeval); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_TimeEventManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_TIMEEVENTMANAGER - diff --git a/source/gameengine/GameLogic/SCA_XNORController.cpp b/source/gameengine/GameLogic/SCA_XNORController.cpp deleted file mode 100644 index 9f54e41d110..00000000000 --- a/source/gameengine/GameLogic/SCA_XNORController.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/** - * 'Xnor' together all inputs - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_XNORController.h" -#include "SCA_ISensor.h" -#include "SCA_LogicManager.h" -#include "BoolValue.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_XNORController::SCA_XNORController(SCA_IObject* gameobj) - : - SCA_IController(gameobj) -{ -} - - - -SCA_XNORController::~SCA_XNORController() -{ -} - - - -void SCA_XNORController::Trigger(SCA_LogicManager* logicmgr) -{ - - bool sensorresult = true; - - for (vector::const_iterator is=m_linkedsensors.begin(); - !(is==m_linkedsensors.end());is++) - { - SCA_ISensor* sensor = *is; - if (sensor->GetState()) - { - if (sensorresult == false) - { - sensorresult = true; - break; - } - sensorresult = false; - } - } - - for (vector::const_iterator i=m_linkedactuators.begin(); - !(i==m_linkedactuators.end());i++) - { - SCA_IActuator* actua = *i; - logicmgr->AddActiveActuator(actua,sensorresult); - } -} - - - -CValue* SCA_XNORController::GetReplica() -{ - CValue* replica = new SCA_XNORController(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_XNORController::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_XNORController", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IController::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_XNORController::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_XNORController::Attributes[] = { - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_XNORController.h b/source/gameengine/GameLogic/SCA_XNORController.h deleted file mode 100644 index 54361be163a..00000000000 --- a/source/gameengine/GameLogic/SCA_XNORController.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * SCA_XNORController.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_XNORCONTROLLER -#define __KX_XNORCONTROLLER - -#include "SCA_IController.h" - -class SCA_XNORController : public SCA_IController -{ - Py_Header; - //virtual void Trigger(class SCA_LogicManager* logicmgr); -public: - SCA_XNORController(SCA_IObject* gameobj); - virtual ~SCA_XNORController(); - virtual CValue* GetReplica(); - virtual void Trigger(SCA_LogicManager* logicmgr); - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - -}; - -#endif //__KX_XNORCONTROLLER - diff --git a/source/gameengine/GameLogic/SCA_XORController.cpp b/source/gameengine/GameLogic/SCA_XORController.cpp deleted file mode 100644 index a58f30a3bed..00000000000 --- a/source/gameengine/GameLogic/SCA_XORController.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/** - * 'Xor' together all inputs - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_XORController.h" -#include "SCA_ISensor.h" -#include "SCA_LogicManager.h" -#include "BoolValue.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -SCA_XORController::SCA_XORController(SCA_IObject* gameobj) - : - SCA_IController(gameobj) -{ -} - - - -SCA_XORController::~SCA_XORController() -{ -} - - - -void SCA_XORController::Trigger(SCA_LogicManager* logicmgr) -{ - - bool sensorresult = false; - - for (vector::const_iterator is=m_linkedsensors.begin(); - !(is==m_linkedsensors.end());is++) - { - SCA_ISensor* sensor = *is; - if (sensor->GetState()) - { - if (sensorresult == true) - { - sensorresult = false; - break; - } - sensorresult = true; - } - } - - for (vector::const_iterator i=m_linkedactuators.begin(); - !(i==m_linkedactuators.end());i++) - { - SCA_IActuator* actua = *i; - logicmgr->AddActiveActuator(actua,sensorresult); - } -} - - - -CValue* SCA_XORController::GetReplica() -{ - CValue* replica = new SCA_XORController(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject SCA_XORController::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SCA_XORController", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IController::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef SCA_XORController::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef SCA_XORController::Attributes[] = { - { NULL } //Sentinel -}; -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/GameLogic/SCA_XORController.h b/source/gameengine/GameLogic/SCA_XORController.h deleted file mode 100644 index 940e3d2135c..00000000000 --- a/source/gameengine/GameLogic/SCA_XORController.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * SCA_XORController.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_XORCONTROLLER -#define __KX_XORCONTROLLER - -#include "SCA_IController.h" - -class SCA_XORController : public SCA_IController -{ - Py_Header; - //virtual void Trigger(class SCA_LogicManager* logicmgr); -public: - SCA_XORController(SCA_IObject* gameobj); - virtual ~SCA_XORController(); - virtual CValue* GetReplica(); - virtual void Trigger(SCA_LogicManager* logicmgr); -}; - -#endif //__KX_XORCONTROLLER - diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript deleted file mode 100644 index 3840754ed06..00000000000 --- a/source/gameengine/GameLogic/SConscript +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = env.Glob('*.cpp') + env.Glob('Joystick/*.cpp') - -incs = '. #/source/kernel/gen_system #/intern/string' -incs += ' #/source/gameengine/Expressions #/intern/moto/include' -incs += ' #/source/gameengine/Rasterizer #/source/gameengine/SceneGraph' - -defs = [] - -if env['WITH_BF_SDL']: - incs += ' ' + env['BF_SDL_INC'] -else: - defs.append('DISABLE_SDL') - -if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] -else: - defs.append('DISABLE_PYTHON') - -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - if env['BF_DEBUG']: - defs.append('_DEBUG') - -env.BlenderLib ( 'bf_logic', sources, Split(incs), defs, libtype=['core','player'], priority=[330,65], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/GamePlayer/CMakeLists.txt b/source/gameengine/GamePlayer/CMakeLists.txt deleted file mode 100644 index f0ce3afbe10..00000000000 --- a/source/gameengine/GamePlayer/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -ADD_SUBDIRECTORY(common) -ADD_SUBDIRECTORY(ghost) - -IF(WITH_WEBPLUGIN) - ADD_SUBDIRECTORY(xembed) -ENDIF(WITH_WEBPLUGIN) diff --git a/source/gameengine/GamePlayer/Makefile b/source/gameengine/GamePlayer/Makefile deleted file mode 100644 index c4f78f23117..00000000000 --- a/source/gameengine/GamePlayer/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# Bounces make to subdirectories. - -include nan_definitions.mk - -SOURCEDIR = source/gameengine/GamePlayer -DIR = $(OCGDIR)/gameengine/GamePlayer -DIRS = common ghost - -ifeq ($(WITH_BF_WEBPLUGIN),true) -ifeq ($(OS),$(findstring $(OS), "freebsd irix windows")) - ifneq ($(FREE_WINDOWS),true) - DIRS += netscape - endif -endif - -ifeq ($(OS),$(findstring $(OS), "linux")) - ifeq ($(CPU),i386) - DIRS += netscape - endif -endif - -ifeq ($(OS),$(findstring $(OS), "solaris")) - ifeq ($(CPU),sparc) - DIRS += netscape - endif -endif -endif - -include nan_subdirs.mk diff --git a/source/gameengine/GamePlayer/SConscript b/source/gameengine/GamePlayer/SConscript deleted file mode 100644 index 0b140bba8e7..00000000000 --- a/source/gameengine/GamePlayer/SConscript +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/python -SConscript(['common/SConscript', - 'ghost/SConscript']) diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt deleted file mode 100644 index 418b77357a4..00000000000 --- a/source/gameengine/GamePlayer/common/CMakeLists.txt +++ /dev/null @@ -1,77 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -SET(SRC - bmfont.cpp - GPC_Canvas.cpp - GPC_Engine.cpp - GPC_KeyboardDevice.cpp - GPC_MouseDevice.cpp - GPC_RawImage.cpp - GPC_RawLoadDotBlendArray.cpp - GPC_RawLogoArrays.cpp - GPC_RenderTools.cpp - GPC_System.cpp -) - -SET(INC - . - ../../../../intern/string - ../../../../intern/ghost - ../../../../intern/guardedalloc - ../../../../intern/moto/include - ../../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../../source/kernel/gen_system - ../../../../source/kernel/gen_messaging - ../../../../source/gameengine/Converter - ../../../../source/blender/imbuf - ../../../../source/gameengine/Ketsji - ../../../../source/blender/blenlib - ../../../../source/blender/blenkernel - ../../../../source/blender - ../../../../source/blender/include - ../../../../source/blender/makesdna - ../../../../source/gameengine/Rasterizer - ../../../../source/gameengine/GameLogic - ../../../../source/gameengine/Expressions - ../../../../source/gameengine/Network - ../../../../source/gameengine/SceneGraph - ../../../../source/gameengine/Physics/common - ../../../../source/gameengine/Network/LoopBackNetwork - ../../../../source/gameengine/GamePlayer/ghost - ../../../../source/blender/misc - ../../../../source/blender/blenloader - ../../../../source/blender/gpu - ../../../../extern/glew/include - ${PYTHON_INC} - ${PNG_INC} - ${ZLIB_INC} -) - -ADD_DEFINITIONS(-DGLEW_STATIC) - -BLENDERLIB_NOLIST(gp_common "${SRC}" "${INC}") -#env.BlenderLib (libname='gp_common', sources=source_files, includes=incs, defines = [], libtype='player', priority=5, compileflags=cflags) diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp deleted file mode 100644 index b90aec75959..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp +++ /dev/null @@ -1,494 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef NOPNG -#ifdef WIN32 -#include "png.h" -#else -#include -#endif -#endif // NOPNG - -#include "RAS_IPolygonMaterial.h" -#include "GPC_Canvas.h" - -GPC_Canvas::TBannerId GPC_Canvas::s_bannerId = 0; - - -GPC_Canvas::GPC_Canvas( - int width, - int height -) : - m_width(width), - m_height(height), - m_bannersEnabled(false) -{ -} - - -GPC_Canvas::~GPC_Canvas() -{ - DisposeAllBanners(); -} - - -// void GPC_Canvas::InitPostRenderingContext(void) -// { -// glViewport(0, 0, m_width, m_height); -// glMatrixMode(GL_PROJECTION); -// glLoadIdentity(); - -// glOrtho(-2.0, 2.0, -2.0, 2.0, -20.0, 20.0); - -// glMatrixMode(GL_MODELVIEW); -// glLoadIdentity(); - -// glEnable(GL_DEPTH_TEST); - -// glDepthFunc(GL_LESS); - -// glShadeModel(GL_SMOOTH); -// } - -void GPC_Canvas::Resize(int width, int height) -{ - m_width = width; - m_height = height; -} - -void GPC_Canvas::EndFrame() -{ - if (m_bannersEnabled) - DrawAllBanners(); -} - - -void GPC_Canvas::ClearColor(float r, float g, float b, float a) -{ - ::glClearColor(r,g,b,a); -} - -void GPC_Canvas::SetViewPort(int x1, int y1, int x2, int y2) -{ - /* x1 and y1 are the min pixel coordinate (e.g. 0) - x2 and y2 are the max pixel coordinate - the width,height is calculated including both pixels - therefore: max - min + 1 - */ - - /* XXX, nasty, this needs to go somewhere else, - * but where... definitly need to clean up this - * whole canvas/rendertools mess. - */ - glEnable(GL_SCISSOR_TEST); - - glViewport(x1,y1,x2-x1 + 1,y2-y1 + 1); - glScissor(x1,y1,x2-x1 + 1,y2-y1 + 1); -}; - - -void GPC_Canvas::ClearBuffer( - int type -){ - - int ogltype = 0; - if (type & RAS_ICanvas::COLOR_BUFFER ) - ogltype |= GL_COLOR_BUFFER_BIT; - if (type & RAS_ICanvas::DEPTH_BUFFER ) - ogltype |= GL_DEPTH_BUFFER_BIT; - - ::glClear(ogltype); -} - - -GPC_Canvas::TBannerId GPC_Canvas::AddBanner( - unsigned int bannerWidth, unsigned int bannerHeight, - unsigned int imageWidth, unsigned int imageHeight, - unsigned char* imageData, - TBannerAlignment alignment, bool enabled) -{ - TBannerData banner; - - banner.alignment = alignment; - banner.enabled = enabled; - banner.displayWidth = bannerWidth; - banner.displayHeight = bannerHeight; - banner.imageWidth = imageWidth; - banner.imageHeight = imageHeight; - unsigned int bannerDataSize = imageWidth*imageHeight*4; - banner.imageData = new unsigned char [bannerDataSize]; - ::memcpy(banner.imageData, imageData, bannerDataSize); - banner.textureName = 0; - - m_banners.insert(TBannerMap::value_type(++s_bannerId, banner)); - return s_bannerId; -} - - -void GPC_Canvas::DisposeBanner(TBannerId id) -{ - TBannerMap::iterator it = m_banners.find(id); - if (it != m_banners.end()) { - DisposeBanner(it->second); - m_banners.erase(it); - } -} - -void GPC_Canvas::DisposeAllBanners() -{ - TBannerMap::iterator it = m_banners.begin(); - while (it != m_banners.end()) { - DisposeBanner(it->second); - it++; - } -} - -void GPC_Canvas::SetBannerEnabled(TBannerId id, bool enabled) -{ - TBannerMap::iterator it = m_banners.find(id); - if (it != m_banners.end()) { - it->second.enabled = enabled; - } -} - - -void GPC_Canvas::SetBannerDisplayEnabled(bool enabled) -{ - m_bannersEnabled = enabled; -} - - -void GPC_Canvas::DisposeBanner(TBannerData& banner) -{ - if (banner.imageData) { - delete [] banner.imageData; - banner.imageData = 0; - } - if (banner.textureName) { - ::glDeleteTextures(1, (GLuint*)&banner.textureName); - } -} - -void GPC_Canvas::DrawAllBanners(void) -{ - if(!m_bannersEnabled || (m_banners.size() < 1)) - return; - - // Save the old rendering parameters. - - CanvasRenderState render_state; - PushRenderState(render_state); - - // Set up everything for banner display. - - // Set up OpenGL matrices - SetOrthoProjection(); - // Activate OpenGL settings needed for display of the texture - ::glDisable(GL_LIGHTING); - ::glDisable(GL_DEPTH_TEST); - ::glDisable(GL_FOG); - ::glEnable(GL_TEXTURE_2D); - ::glEnable(GL_BLEND); - ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - TBannerMap::iterator it = m_banners.begin(); - while (it != m_banners.end()) { - if (it->second.enabled) { - DrawBanner(it->second); - } - it++; - } - - PopRenderState(render_state); -} - - -void GPC_Canvas::DrawBanner(TBannerData& banner) -{ - if(!banner.enabled) - return; - - // Set up coordinates - int coords[4][2]; - if (banner.alignment == alignTopLeft) { - // Upper left - coords[0][0] = 0; - coords[0][1] = ((int)m_height)-banner.displayHeight; - coords[1][0] = banner.displayWidth; - coords[1][1] = ((int)m_height)-banner.displayHeight; - coords[2][0] = banner.displayWidth; - coords[2][1] = ((int)m_height); - coords[3][0] = 0; - coords[3][1] = ((int)m_height); - } - else { - // Lower right - coords[0][0] = (int)m_width - banner.displayWidth; - coords[0][1] = 0; - coords[1][0] = m_width; - coords[1][1] = 0; - coords[2][0] = m_width; - coords[2][1] = banner.displayHeight; - coords[3][0] = (int)m_width - banner.displayWidth; - coords[3][1] = banner.displayHeight; - } - // Set up uvs - int uvs[4][2] = { - { 0, 1}, - { 1, 1}, - { 1, 0}, - { 0, 0} - }; - - if (!banner.textureName) { - ::glGenTextures(1, (GLuint*)&banner.textureName); - ::glBindTexture(GL_TEXTURE_2D, banner.textureName); - ::glTexImage2D( - GL_TEXTURE_2D, // target - 0, // level - 4, // components - banner.imageWidth, // width - banner.displayHeight, // height - 0, // border - GL_RGBA, // format - GL_UNSIGNED_BYTE, // type - banner.imageData); // image data - ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - else { - ::glBindTexture(GL_TEXTURE_2D, banner.textureName); - } - - // Draw the rectangle with the texture on it - ::glBegin(GL_QUADS); - ::glColor4f(1.f, 1.f, 1.f, 1.f); - ::glTexCoord2iv((GLint*)uvs[0]); - ::glVertex2iv((GLint*)coords[0]); - ::glTexCoord2iv((GLint*)uvs[1]); - ::glVertex2iv((GLint*)coords[1]); - ::glTexCoord2iv((GLint*)uvs[2]); - ::glVertex2iv((GLint*)coords[2]); - ::glTexCoord2iv((GLint*)uvs[3]); - ::glVertex2iv((GLint*)coords[3]); - ::glEnd(); -} - - void -GPC_Canvas:: -PushRenderState( - CanvasRenderState & render_state -){ -#if 0 - - ::glMatrixMode(GL_PROJECTION); - ::glPushMatrix(); - ::glMatrixMode(GL_MODELVIEW); - ::glPushMatrix(); - ::glMatrixMode(GL_TEXTURE); - ::glPushMatrix(); - // Save old OpenGL settings - ::glGetIntegerv(GL_LIGHTING, (GLint*)&(render_state.oldLighting)); - ::glGetIntegerv(GL_DEPTH_TEST, (GLint*)&(render_state.oldDepthTest)); - ::glGetIntegerv(GL_FOG, (GLint*)&(render_state.oldFog)); - ::glGetIntegerv(GL_TEXTURE_2D, (GLint*)&(render_state.oldTexture2D)); - ::glGetIntegerv(GL_BLEND, (GLint*)&(render_state.oldBlend)); - ::glGetIntegerv(GL_BLEND_SRC, (GLint*)&(render_state.oldBlendSrc)); - ::glGetIntegerv(GL_BLEND_DST, (GLint*)&(render_state.oldBlendDst)); - ::glGetFloatv(GL_CURRENT_COLOR, render_state.oldColor); - ::glGetIntegerv(GL_DEPTH_WRITEMASK,(GLint*)&(render_state.oldWriteMask)); -#else - - glPushAttrib(GL_ALL_ATTRIB_BITS); - -#endif -} - - void -GPC_Canvas:: -PopRenderState( - const CanvasRenderState & render_state -){ -#if 0 - // Restore OpenGL settings - render_state.oldLighting ? ::glEnable(GL_LIGHTING) : glDisable(GL_LIGHTING); - render_state.oldDepthTest ? ::glEnable(GL_DEPTH_TEST) : glDisable(GL_DEPTH_TEST); - render_state.oldFog ? ::glEnable(GL_FOG) : ::glDisable(GL_FOG); - render_state.oldTexture2D ? ::glEnable(GL_TEXTURE_2D) : glDisable(GL_TEXTURE_2D); - render_state.oldBlend ? glEnable(GL_BLEND) : ::glDisable(GL_BLEND); - ::glBlendFunc((GLenum)render_state.oldBlendSrc, (GLenum)render_state.oldBlendDst); - render_state.oldWriteMask ? ::glEnable(GL_DEPTH_WRITEMASK) : glDisable(GL_DEPTH_WRITEMASK); - - ::glColor4fv(render_state.oldColor); - // Restore OpenGL matrices - ::glMatrixMode(GL_TEXTURE); - ::glPopMatrix(); - ::glMatrixMode(GL_PROJECTION); - ::glPopMatrix(); - ::glMatrixMode(GL_MODELVIEW); - ::glPopMatrix(); - -#else - - glPopAttrib(); -#endif -} - - void -GPC_Canvas:: -SetOrthoProjection( -){ - // Set up OpenGL matrices - ::glViewport(0, 0, m_width, m_height); - ::glScissor(0, 0, m_width, m_height); - ::glMatrixMode(GL_PROJECTION); - ::glLoadIdentity(); - ::glOrtho(0, m_width, 0, m_height, -1, 1); - ::glMatrixMode(GL_MODELVIEW); - ::glLoadIdentity(); - ::glMatrixMode(GL_TEXTURE); - ::glLoadIdentity(); -} - - void -GPC_Canvas:: -MakeScreenShot( - const char* filename -){ - png_structp png_ptr; - png_infop info_ptr; - unsigned char *pixels = 0; - png_bytepp row_pointers = 0; - int i, bytesperpixel = 3, color_type = PNG_COLOR_TYPE_RGB; - FILE *fp = 0; - - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (!png_ptr) - { - std::cout << "Cannot png_create_write_struct." << std::endl; - return; - } - - info_ptr = png_create_info_struct(png_ptr); - if (!info_ptr) - { - png_destroy_write_struct(&png_ptr, (png_infopp)NULL); - std::cout << "Cannot png_create_info_struct." << std::endl; - return; - } - - if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_write_struct(&png_ptr, &info_ptr); - delete [] pixels; - delete [] row_pointers; - // printf("Aborting\n"); - if (fp) { - fflush(fp); - fclose(fp); - } - return; - } - - // copy image data - - pixels = new unsigned char[GetWidth() * GetHeight() * bytesperpixel * sizeof(unsigned char)]; - if (!pixels) { - std::cout << "Cannot allocate pixels array" << std::endl; - return; - } - - glReadPixels(0, 0, GetWidth(), GetHeight(), GL_RGB, GL_UNSIGNED_BYTE, pixels); - - fp = fopen(filename, "wb"); - if (!fp) - { - std::cout << "Couldn't open " << filename << " for writing." << std::endl; - longjmp(png_jmpbuf(png_ptr), 1); - } - - png_init_io(png_ptr, fp); - - /* - png_set_filter(png_ptr, 0, - PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE | - PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB | - PNG_FILTER_UP | PNG_FILTER_VALUE_UP | - PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG | - PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH| - PNG_ALL_FILTERS); - - png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); - */ - - // png image settings - png_set_IHDR(png_ptr, - info_ptr, - GetWidth(), - GetHeight(), - 8, - color_type, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); - - // write the file header information - png_write_info(png_ptr, info_ptr); - - // allocate memory for an array of row-pointers - row_pointers = new png_bytep [(GetHeight() * sizeof(png_bytep))]; - if (!row_pointers) - { - std::cout << "Cannot allocate row-pointers array" << std::endl; - longjmp(png_jmpbuf(png_ptr), 1); - } - - // set the individual row-pointers to point at the correct offsets - for (i = 0; i < GetHeight(); i++) { - row_pointers[GetHeight()-1-i] = (png_bytep) - ((unsigned char *)pixels + (i * GetWidth()) * bytesperpixel * sizeof(unsigned char)); - } - - // write out the entire image data in one call - png_write_image(png_ptr, row_pointers); - - // write the additional chunks to the PNG file (not really needed) - png_write_end(png_ptr, info_ptr); - - // clean up - delete [] (pixels); - delete [] (row_pointers); - png_destroy_write_struct(&png_ptr, &info_ptr); - - if (fp) - { - fflush(fp); - fclose(fp); - } -} - diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h deleted file mode 100644 index 6e5d58c8478..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.h +++ /dev/null @@ -1,271 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef _GPC_CANVAS_H_ -#define _GPC_CANVAS_H_ - -#include "RAS_ICanvas.h" -#include "RAS_Rect.h" - -#ifdef WIN32 - #pragma warning (disable:4786) // suppress stl-MSVC debug info warning - #include -#endif // WIN32 - -#include "GL/glew.h" - -#include - - -class GPC_Canvas : public RAS_ICanvas -{ -public: - /** - * Used to position banners in the canvas. - */ - typedef enum { - alignTopLeft, - alignBottomRight - } TBannerAlignment; - - typedef int TBannerId; - -protected: - /** - * Used to store info for banners drawn on top of the canvas. - */ - typedef struct { - /** Where the banner will be displayed. */ - TBannerAlignment alignment; - /** Banner display enabled. */ - bool enabled; - /** Banner display width. */ - unsigned int displayWidth; - /** Banner display height. */ - unsigned int displayHeight; - /** Banner image width. */ - unsigned int imageWidth; - /** Banner image height. */ - unsigned int imageHeight; - /** Banner image data. */ - unsigned char* imageData; - /** Banner OpenGL texture name. */ - unsigned int textureName; - } TBannerData; - typedef std::map TBannerMap; - - /** Width of the context. */ - int m_width; - /** Height of the context. */ - int m_height; - /** Rect that defines the area used for rendering, - relative to the context */ - RAS_Rect m_displayarea; - - /** Storage for the banners to display. */ - TBannerMap m_banners; - /** State of banner display. */ - bool m_bannersEnabled; - -public: - - GPC_Canvas(int width, int height); - - virtual ~GPC_Canvas(); - - void Resize(int width, int height); - - - /** - * @section Methods inherited from abstract base class RAS_ICanvas. - */ - - int - GetWidth( - ) const { - return m_width; - } - - int - GetHeight( - ) const { - return m_height; - } - - const - RAS_Rect & - GetDisplayArea( - ) const { - return m_displayarea; - }; - - void - SetDisplayArea( - RAS_Rect *rect - ) { - m_displayarea= *rect; - }; - - RAS_Rect & - GetWindowArea( - ) { - return m_displayarea; - } - - void - BeginFrame( - ) {}; - - /** - * Draws overlay banners and progress bars. - */ - void - EndFrame( - ); - - void SetViewPort(int x1, int y1, int x2, int y2); - - void ClearColor(float r, float g, float b, float a); - - /** - * @section Methods inherited from abstract base class RAS_ICanvas. - * Semantics are not yet honoured. - */ - - void SetMouseState(RAS_MouseState mousestate) - { - // not yet - } - - void SetMousePosition(int x, int y) - { - // not yet - } - - virtual void MakeScreenShot(const char* filename); - - void ClearBuffer(int type); - - /** - * @section Services provided by this class. - */ - - /** - * Enables display of a banner. - * The image data is copied inside. - * @param bannerWidth Display width of the banner. - * @param bannerHeight Display height of the banner. - * @param imageWidth Width of the banner image in pixels. - * @param imageHeight Height of the banner image in pixels. - * @param imageData Pointer to the pixels of the image to display. - * @param alignement Where the banner will be positioned on the canvas. - * @param enabled Whether the banner will be displayed intiallly. - * @return A banner id. - */ - TBannerId AddBanner( - unsigned int bannerWidth, unsigned int bannerHeight, - unsigned int imageWidth, unsigned int imageHeight, - unsigned char* imageData, TBannerAlignment alignment = alignTopLeft, - bool enabled = true); - - /** - * Disposes a banner. - * @param id Bannner to be disposed. - */ - void DisposeBanner(TBannerId id); - - /** - * Disposes all the banners. - */ - void DisposeAllBanners(); - - /** - * Enables or disables display of a banner. - * @param id Banner id of the banner to be enabled/disabled. - * @param enabled New state of the banner. - */ - void SetBannerEnabled(TBannerId id, bool enabled = true); - - /** - * Enables or disables display of all banners. - * @param enabled New state of the banners. - */ - void SetBannerDisplayEnabled(bool enabled = true); - -protected: - /** - * Disposes a banner. - * @param it Bannner to be disposed. - */ - void DisposeBanner(TBannerData& banner); - - /** - * Draws all the banners enabled. - */ - void DrawAllBanners(void); - - /** - * Draws a banner. - */ - void DrawBanner(TBannerData& banner); - - struct CanvasRenderState { - int oldLighting; - int oldDepthTest; - int oldFog; - int oldTexture2D; - int oldBlend; - int oldBlendSrc; - int oldBlendDst; - float oldColor[4]; - int oldWriteMask; - }; - - void - PushRenderState( - CanvasRenderState & render_state - ); - void - PopRenderState( - const CanvasRenderState & render_state - ); - - /** - * Set up an orthogonal viewing,model and texture matrix - * for banners and progress bars. - */ - void - SetOrthoProjection( - ); - - static TBannerId s_bannerId; -}; - -#endif // _GPC_CANVAS_H_ - diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.cpp b/source/gameengine/GamePlayer/common/GPC_Engine.cpp deleted file mode 100644 index 54ace227821..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_Engine.cpp +++ /dev/null @@ -1,335 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 - #pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif // WIN32 - -#include - -#include "BKE_blender.h" // initglobals() -#include "BKE_global.h" // Global G -#include "BKE_report.h" -#include "DNA_scene_types.h" -#include "DNA_camera_types.h" // Camera -#include "DNA_object_types.h" // Object - -#include "BLO_readfile.h" -#include "BLI_blenlib.h" - -// include files needed by "KX_BlenderSceneConverter.h" - -#include "GEN_Map.h" -#include "SCA_IActuator.h" -#include "RAS_MeshObject.h" - -#include "KX_BlenderSceneConverter.h" -#include "KX_KetsjiEngine.h" -#include "NG_LoopBackNetworkDeviceInterface.h" - -#include "RAS_IRenderTools.h" - -#include "GPC_Engine.h" -#include "GPC_KeyboardDevice.h" -#include "GPC_MouseDevice.h" -#include "GPC_RawImage.h" -#include "GPC_RawLoadDotBlendArray.h" - - - -GPC_Engine::GPC_Engine(char *customLoadingAnimationURL, - int foregroundColor, int backgroundColor, int frameRate) : - m_initialized(false), m_running(false), m_loading(false), - m_customLoadingAnimation(false), m_previousProgress(0.0), - m_system(NULL), m_keyboarddev(NULL), - m_mousedev(NULL), m_canvas(NULL), m_rendertools(NULL), - m_portal(NULL), m_sceneconverter(NULL), m_networkdev(NULL), - m_curarea(NULL), m_customLoadingAnimationURL(NULL), - m_foregroundColor(foregroundColor), m_backgroundColor(backgroundColor), - m_frameRate(frameRate), - m_BlenderLogo(0), m_Blender3DLogo(0)/*, m_NaNLogo(0)*/ -{ - if(customLoadingAnimationURL[0] != '\0') - { - m_customLoadingAnimationURL = new char[sizeof(customLoadingAnimationURL)]; -// not yet, need to be implemented first... m_customLoadingAnimation = true; - } - - // load the Blender logo into memory - m_BlenderLogo = new GPC_RawImage(); - // blender3d size is 115 x 32 so make resulting texture 128 x 128 - if(!m_BlenderLogo->Load("BlenderLogo", 128, 128, GPC_RawImage::alignTopLeft, 8, 8)) - m_BlenderLogo = 0; - - // load the Blender3D logo into memory - m_Blender3DLogo = new GPC_RawImage(); - // blender3d size is 136 x 11 so make resulting texture 256 x 256 - if(!m_Blender3DLogo->Load("Blender3DLogo", 256, 256, GPC_RawImage::alignBottomRight, 8, 8)) - m_Blender3DLogo = 0; - -#if 0 - // obsolete logo - // load the NaN logo into memory - m_NaNLogo = new GPC_RawImage(); - // blender3d size is 32 x 31 so make resulting texture 64 x 64 - if(!m_NaNLogo->Load("NaNLogo", 64, 64, GPC_RawImage::alignBottomRight, 8, 8)) - m_NaNLogo = 0; -#endif -} - - -GPC_Engine::~GPC_Engine() -{ - // deleting everything in reverse order of creation -#if 0 -// hmm deleted in Stop() delete m_portal; -// hmm deleted in Stop() delete m_sceneconverter; - delete m_system; - delete m_networkdev; - delete m_rendertools; - delete m_canvas; - delete m_mousedev; - delete m_keyboarddev; -// not yet used so be careful and not delete them -// delete m_WaveCache; -// delete m_curarea; // for future use, not used yet -#endif - delete m_BlenderLogo; - delete m_Blender3DLogo; -#if 0 - delete m_NaNLogo; -#endif -} - - -bool GPC_Engine::Start(char *filename) -{ - ReportList reports; - BlendFileData *bfd; - - BKE_reports_init(&reports, RPT_STORE); - bfd= BLO_read_from_file(filename, &reports); - BKE_reports_clear(&reports); - - if (!bfd) { - // XXX, deal with error here - cout << "Unable to load: " << filename << endl; - return false; - } - - StartKetsji(); - - if(bfd->type == BLENFILETYPE_PUB) - m_canvas->SetBannerDisplayEnabled(false); - - return true; -} - - -bool GPC_Engine::Start(unsigned char *blenderDataBuffer, - unsigned int blenderDataBufferSize) -{ - ReportList reports; - BlendFileData *bfd; - - BKE_reports_init(&reports, RPT_STORE); - bfd= BLO_read_from_memory(blenderDataBuffer, blenderDataBufferSize, &reports); - BKE_reports_clear(&reports); - - if (!bfd) { - // XXX, deal with error here - cout << "Unable to load. " << endl; - return false; - } - - StartKetsji(); - - if(bfd->type == BLENFILETYPE_PUB) - m_canvas->SetBannerDisplayEnabled(false); - - return true; -} - - -bool GPC_Engine::StartKetsji(void) -{ - STR_String startSceneName = ""; // XXX scene->id.name + 2; -/* - KX_KetsjiEngine* ketsjieng = new KX_KetsjiEngine(m_system); - m_portal = new KetsjiPortal(ketsjieng); - m_portal->setSecurity(psl_Highest); - - KX_ISceneConverter *sceneconverter = new KX_BlenderSceneConverter(&G, ketsjieng); - - m_portal->Enter( - startSceneName, - sceneconverter, - m_canvas, - m_rendertools, - m_keyboarddev, - m_mousedev, - m_networkdev, - m_system); - - m_system->SetMainLoop(m_portal->m_ketsjieng); - - m_running = true; - */ - return true; -} - - -void GPC_Engine::StartLoadingAnimation() -{ - if(m_customLoadingAnimation) - { - } - else - { - unsigned char *blenderDataBuffer; - int blenderDataBufferSize; - GetRawLoadingAnimation(&blenderDataBuffer, &blenderDataBufferSize); - if(!Start(blenderDataBuffer, blenderDataBufferSize)) - cout << "something went wrong when starting the engine" << endl; - delete blenderDataBuffer; // created with 'new' in GetRawLoadingAnimation() - } -} - - -// will be platform dependant -float GPC_Engine::DetermineProgress(void) -{ -#if 0 - float progress; - if ((m_blenderData.m_ulProgress > 0) && - (m_blenderData.m_ulProgressMax != m_blenderData.m_ulProgress)) { - progress = (float)m_blenderData.m_ulProgress; - progress /= (float)m_blenderData.m_ulProgressMax; - } - else { - progress = 0.f; - } - progress *= 100.f; - return (unsigned int) progress ; -#endif - return m_previousProgress + 0.01; // temporary TODO -} - - -void GPC_Engine::UpdateLoadingAnimation(void) -{ - //int delta; - - float progress = DetermineProgress(); - - if(progress > m_previousProgress) - { -// delta = progress - m_previousProgress; - m_previousProgress = progress; - if(m_previousProgress > 1.0) - m_previousProgress = 1.0; // limit to 1.0 (has to change !) -// m_engine->m_previousProgress = 0.0; - } - - STR_String to = ""; - STR_String from = ""; - STR_String subject = "progress"; - STR_String body; - body.Format("%f", progress); // a number between 0.0 and 1.0 - - if(m_networkdev) - { - // Store a progress message in the network device. - NG_NetworkMessage* msg = new NG_NetworkMessage(to, from, subject, body); - m_networkdev->SendNetworkMessage(msg); - msg->Release(); - } -} - - -void GPC_Engine::Stop() -{ - // only delete things that are created in StartKetsji() -/* if(m_portal) - { - m_portal->Leave(); - delete m_portal; // also gets rid of KX_KetsjiEngine (says Maarten) - m_portal = 0; - } -*/ if(m_sceneconverter) - { - delete m_sceneconverter; - m_sceneconverter = 0; - } -#if 0 - if(m_frameTimerID) - { - ::KillTimer(0, m_frameTimerID); - m_frameTimerID = 0; - } - m_engineRunning = false; -#endif - - m_running = false; -} - - -void GPC_Engine::Exit() -{ - if(m_running) - Stop(); - - if (m_system) { - delete m_system; - m_system = 0; - } - if (m_keyboarddev) { - delete m_keyboarddev; - m_keyboarddev = 0; - } - if (m_mousedev) { - delete m_mousedev; - m_mousedev = 0; - } - if (m_canvas) { - delete m_canvas; - m_canvas = 0; - } - if (m_rendertools) { - delete m_rendertools; - m_rendertools = 0; - } - if (m_networkdev) { - delete m_networkdev; - m_networkdev = 0; - } - - m_initialized = false; -} - diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.h b/source/gameengine/GamePlayer/common/GPC_Engine.h deleted file mode 100644 index 0b7c85396f2..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_Engine.h +++ /dev/null @@ -1,123 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPC_ENGINE_H -#define __GPC_ENGINE_H - -#include "GPC_Canvas.h" -#include "GPC_System.h" - -class GPC_KeyboardDevice; -class GPC_MouseDevice; - -class RAS_IRenderTools; -class KetsjiPortal; -class KX_ISceneConverter; -class NG_LoopBackNetworkDeviceInterface; -class GPC_RawImage; - - -class GPC_Engine -{ -//protected: -public: - /** Engine construction state. */ - bool m_initialized; - /** Engine state. */ - bool m_running; - /** loading state, ie a file is requested and is being loaded. Different - * from initialized and/or running */ - bool m_loading; - - bool m_customLoadingAnimation; - - /** Last file download progress measurement. */ - float m_previousProgress; - - /** The game engine's system abstraction. */ - GPC_System* m_system; - /** The game engine's keyboard abstraction. */ - GPC_KeyboardDevice* m_keyboarddev; - /** The game engine's mouse abstraction. */ - GPC_MouseDevice* m_mousedev; - /** The game engine's canvas abstraction. */ - GPC_Canvas* m_canvas; - /** The game engine's platform dependent render tools. */ - RAS_IRenderTools* m_rendertools; - /** The portal used to start the engine. */ - KetsjiPortal* m_portal; - /** Converts Blender data files. */ - KX_ISceneConverter* m_sceneconverter; - /** Network interface. */ - NG_LoopBackNetworkDeviceInterface* m_networkdev; - - struct ScrArea *m_curarea; // for future use, not used yet - - char *m_customLoadingAnimationURL; - int m_foregroundColor; - int m_backgroundColor; - int m_frameRate; - - GPC_RawImage *m_BlenderLogo; - GPC_Canvas::TBannerId m_BlenderLogoId; - GPC_RawImage *m_Blender3DLogo; - GPC_Canvas::TBannerId m_Blender3DLogoId; -#if 0 - GPC_RawImage *m_NaNLogo; - GPC_Canvas::TBannerId m_NaNLogoId; -#endif - -public: - GPC_Engine(char *customLoadingAnimation, - int foregroundColor, int backgroundColor, int frameRate); - virtual ~GPC_Engine(); - // Initialize() functions are not put here since they have - // different prototypes for Unix and Windows - void StartLoadingAnimation(); - bool Start(char *filename); // file-on-disk starter - bool Start(unsigned char *blenderDataBuffer, - unsigned int blenderDataBufferSize); // file-in-memory starter - - void Stop(); - virtual void Exit(); - - bool Initialized(void) {return m_initialized;} - bool Loading(void) {return m_loading;} - bool Running(void) const {return m_running;} - - virtual float DetermineProgress(void); // will be platform dependant - void UpdateLoadingAnimation(void); - -private: - bool StartKetsji(void); - -}; - -#endif // __GPC_ENGINE_H - diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp deleted file mode 100644 index 3d61e63f09e..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "GPC_KeyboardDevice.h" - -#include - -/** - * NextFrame toggles currentTable with previousTable, - * and copies relevant event information from previous to current table - * (pressed keys need to be remembered). - */ -void GPC_KeyboardDevice::NextFrame() -{ - SCA_IInputDevice::NextFrame(); - - // Now convert justpressed key events into regular (active) keyevents - int previousTable = 1-m_currentTable; - for (int keyevent= KX_BEGINKEY; keyevent<= KX_ENDKEY;keyevent++) - { - SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][keyevent]; - if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - oldevent.m_status == SCA_InputEvent::KX_ACTIVE ) - { - m_eventStatusTables[m_currentTable][keyevent] = oldevent; - m_eventStatusTables[m_currentTable][keyevent].m_status = SCA_InputEvent::KX_ACTIVE; - //m_eventStatusTables[m_currentTable][keyevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED ; - } - } -} - - - -/** - * ConvertBPEvent translates Windows keyboard events into ketsji kbd events. - * Extra event information is stored, like ramp-mode (just released/pressed) - */ -bool GPC_KeyboardDevice::ConvertEvent(int incode, int val) -{ - bool result = false; - - // convert event - KX_EnumInputs kxevent = this->ToNative(incode); - - // only process it, if it's a key - if (kxevent >= KX_BEGINKEY && kxevent <= KX_ENDKEY) - { - int previousTable = 1-m_currentTable; - - if (val > 0) - { - if (kxevent == SCA_IInputDevice::KX_ESCKEY && val != 0 && !m_hookesc) - result = true; - - // todo: convert val ?? - m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //??? - - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - case SCA_InputEvent::KX_JUSTACTIVATED: - case SCA_InputEvent::KX_ACTIVE: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - - case SCA_InputEvent::KX_NO_INPUTSTATUS: - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - } - } - - } else - { - - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - case SCA_InputEvent::KX_JUSTACTIVATED: - case SCA_InputEvent::KX_ACTIVE: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS; - } - } - } - } - return result; -} - -void GPC_KeyboardDevice::HookEscape() -{ - m_hookesc = true; -} diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h deleted file mode 100644 index 206d37f7be6..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h +++ /dev/null @@ -1,88 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPC_KEYBOARDDEVICE_H -#define __GPC_KEYBOARDDEVICE_H - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif // WIN32 - -#include "SCA_IInputDevice.h" - -#include - - -/** - * System independent implementation of SCA_IInputDevice. - * System dependent keyboard devices need only to inherit this class - * and fill the m_reverseKeyTranslateTable key translation map. - * @see SCA_IInputDevice - */ - -class GPC_KeyboardDevice : public SCA_IInputDevice -{ -protected: - - /** - * This map converts system dependent keyboard codes into Ketsji codes. - * System dependent keyboard codes are stored as ints. - */ - std::map m_reverseKeyTranslateTable; - -public: - bool m_hookesc; - GPC_KeyboardDevice() - : m_hookesc(false) - { - } - - virtual ~GPC_KeyboardDevice(void) - { - } - - virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) - { - return false; - } - - virtual void NextFrame(); - - virtual KX_EnumInputs ToNative(int incode) - { - return m_reverseKeyTranslateTable[incode]; - } - - virtual bool ConvertEvent(int incode, int val); - - virtual void HookEscape(); -}; - -#endif // _GPC_KEYBOARDDEVICE_H - diff --git a/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp b/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp deleted file mode 100644 index 706c3d178cd..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "GPC_MouseDevice.h" - -GPC_MouseDevice::GPC_MouseDevice() -{ - -} -GPC_MouseDevice::~GPC_MouseDevice() -{ - -} - -/** - * IsPressed gives boolean information about mouse status, true if pressed, false if not. - */ -bool GPC_MouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) -{ - const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode]; - bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - inevent.m_status == SCA_InputEvent::KX_ACTIVE); - return pressed; -} - - -/** - * NextFrame toggles currentTable with previousTable, - * and copies relevant event information from previous to current table - * (pressed keys need to be remembered). - */ -void GPC_MouseDevice::NextFrame() -{ - SCA_IInputDevice::NextFrame(); - - // Convert just pressed events into regular (active) events - int previousTable = 1-m_currentTable; - for (int mouseevent= KX_BEGINMOUSE; mouseevent< KX_ENDMOUSEBUTTONS; mouseevent++) { - SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][mouseevent]; - if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - oldevent.m_status == SCA_InputEvent::KX_ACTIVE) { - m_eventStatusTables[m_currentTable][mouseevent] = oldevent; - m_eventStatusTables[m_currentTable][mouseevent].m_status = SCA_InputEvent::KX_ACTIVE; - } - } - for (int mousemove= KX_ENDMOUSEBUTTONS; mousemove< KX_ENDMOUSE; mousemove++) { - SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][mousemove]; - m_eventStatusTables[m_currentTable][mousemove] = oldevent; - if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || - oldevent.m_status == SCA_InputEvent::KX_ACTIVE) { - m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_JUSTRELEASED; - } - else { - if (oldevent.m_status == SCA_InputEvent::KX_JUSTRELEASED) { - m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS ; - } - } - } -} - - -bool GPC_MouseDevice::ConvertButtonEvent(TButtonId button, bool isDown) -{ - bool result = false; - - switch (button) - { - case buttonLeft: - result = ConvertEvent(KX_LEFTMOUSE, isDown); - break; - case buttonMiddle: - result = ConvertEvent(KX_MIDDLEMOUSE, isDown); - break; - case buttonRight: - result = ConvertEvent(KX_RIGHTMOUSE, isDown); - break; - case buttonWheelUp: - result = ConvertEvent(KX_WHEELUPMOUSE, isDown); - break; - case buttonWheelDown: - result = ConvertEvent(KX_WHEELDOWNMOUSE, isDown); - break; - default: - // Should not happen! - break; - } - - return result; -} - -/** - * Splits combined button and x,y cursor move events into separate Ketsji - * x and y move and button events. - */ -bool GPC_MouseDevice::ConvertButtonEvent(TButtonId button, bool isDown, int x, int y) -{ - // First update state tables for cursor move. - bool result = ConvertMoveEvent(x, y); - - // Now update for button state. - if (result) { - result = ConvertButtonEvent(button, isDown); - } - - return result; -} - -/** - * Splits combined x,y move into separate Ketsji x and y move events. - */ -bool GPC_MouseDevice::ConvertMoveEvent(int x, int y) -{ - bool result; - - // Convert to local coordinates? - result = ConvertEvent(KX_MOUSEX, x); - if (result) { - result = ConvertEvent(KX_MOUSEY, y); - } - - return result; -} - - -bool GPC_MouseDevice::ConvertEvent(KX_EnumInputs kxevent, int eventval) -{ - bool result = true; - - // Only process it, if it's a mouse event - if (kxevent > KX_BEGINMOUSE && kxevent < KX_ENDMOUSE) { - int previousTable = 1-m_currentTable; - - if (eventval > 0) { - m_eventStatusTables[m_currentTable][kxevent].m_eventval = eventval; - - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - case SCA_InputEvent::KX_ACTIVE: - case SCA_InputEvent::KX_JUSTACTIVATED: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - break; - } - case SCA_InputEvent::KX_JUSTRELEASED: - { - if ( kxevent > KX_BEGINMOUSEBUTTONS && kxevent < KX_ENDMOUSEBUTTONS) - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - } else - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - - } - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; - } - } - - } - else { - switch (m_eventStatusTables[previousTable][kxevent].m_status) - { - case SCA_InputEvent::KX_JUSTACTIVATED: - case SCA_InputEvent::KX_ACTIVE: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED; - break; - } - default: - { - m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS; - } - } - } - } - else { - result = false; - } - return result; -} diff --git a/source/gameengine/GamePlayer/common/GPC_MouseDevice.h b/source/gameengine/GamePlayer/common/GPC_MouseDevice.h deleted file mode 100644 index 41f34b8e22f..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_MouseDevice.h +++ /dev/null @@ -1,104 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPC_MOUSE_DEVICE_H -#define __GPC_MOUSE_DEVICE_H - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif // WIN32 - -#include "SCA_IInputDevice.h" - - -/** - * Generic Ketsji mouse device. - * @see SCA_IInputDevice - */ -class GPC_MouseDevice : public SCA_IInputDevice -{ -public: - /** - * Button identifier. - */ - typedef enum { - buttonLeft, - buttonMiddle, - buttonRight, - buttonWheelUp, - buttonWheelDown - } TButtonId; - - GPC_MouseDevice(); - virtual ~GPC_MouseDevice(void); - - virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode); - virtual void NextFrame(); - - /** - * Call this routine to update the mouse device when a button state changes. - * @param button Which button state changes. - * @param isDown The new state of the button. - * @param x Position x-coordinate of the cursor at the time of the state change. - * @param y Position y-coordinate of the cursor at the time of the state change. - * @return Indication as to whether the event was processed. - */ - virtual bool ConvertButtonEvent(TButtonId button, bool isDown); - - /** - * Call this routine to update the mouse device when a button state and - * cursor position changes at the same time (e.g. in Win32 messages). - * @param button Which button state changes. - * @param isDown The new state of the button. - * @param x Position x-coordinate of the cursor at the time of the state change. - * @param y Position y-coordinate of the cursor at the time of the state change. - * @return Indication as to whether the event was processed. - */ - virtual bool ConvertButtonEvent(TButtonId button, bool isDown, int x, int y); - - /** - * Call this routine to update the mouse device when the cursor has moved. - * @param x Position x-coordinate of the cursor. - * @param y Position y-coordinate of the cursor. - * @return Indication as to whether the event was processed. - */ - virtual bool ConvertMoveEvent(int x, int y); - -protected: - /** - * This routine converts a single mouse event to a Ketsji mouse event. - * @param kxevent Ketsji event code. - * @param eventval Value for this event. - * @return Indication as to whether the event was processed. - */ - virtual bool ConvertEvent(KX_EnumInputs kxevent, int eventval); -}; - -#endif // __GPC_MOUSE_DEVICE_H - diff --git a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp b/source/gameengine/GamePlayer/common/GPC_RawImage.cpp deleted file mode 100644 index 42f3b2dc1e1..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include -#include - -#include "GPC_RawImage.h" -#include "GPC_RawLogoArrays.h" - - -GPC_RawImage::GPC_RawImage() - : m_data(0), m_dataSize(0), m_width(0), m_height(0) -{ -} - - -bool GPC_RawImage::Load( - const char *srcName, - int destWidth, int destHeight, - TImageAlignment alignment, int offsetX, int offsetY) -{ - int srcWidth, srcHeight; - bool success = true; - if(strcmp(srcName, "BlenderLogo") == 0) - GetRawBlenderLogo(&m_data, &srcWidth, &srcHeight); - else - if(strcmp(srcName, "Blender3DLogo") == 0) - GetRawBlender3DLogo(&m_data, &srcWidth, &srcHeight); -#if 0 - else - if(strcmp(srcName, "NaNLogo") == 0) - GetRawNaNLogo(&m_data, &srcWidth, &srcHeight); -#endif - else // unknown image - success = false; - - if(success) - { - unsigned char *tempData = m_data; - - int numBytes = destWidth * destHeight * 4; - m_data = new unsigned char[numBytes]; // re-use m_data ('unsigned char' was 'char') - if(m_data) - { - ::memset(m_data, 0x00000000, numBytes); - m_width = destWidth; - m_height = destHeight; - - int srcBytesWidth = srcWidth * 4; - int dstBytesWidth = m_width * 4; - int numRows = (srcHeight + offsetY) < m_height ? srcHeight : m_height - offsetY; - numBytes = (srcWidth + offsetX) < m_width ? srcBytesWidth : (m_width - offsetX) * 4; - - if((offsetX < m_width) && (offsetY < m_height)) - { - unsigned char* src = (unsigned char*)tempData; - unsigned char* dst = (unsigned char*)m_data; - if(alignment == alignTopLeft) - { - // Put original in upper left corner - - // Add vertical offset - dst += offsetY * dstBytesWidth; - // Add horizontal offset - dst += offsetX * 4; - for (int row = 0; row < numRows; row++) - { - ::memcpy(dst, src, numBytes); - src += srcBytesWidth; - dst += dstBytesWidth; - } - } - else - { - // Put original in lower right corner - - // Add vertical offset - dst += (m_height - (srcHeight + offsetY)) * dstBytesWidth; - // Add horizontal offset - if (m_width > (srcWidth + offsetX)) { - dst += (m_width - (srcWidth + offsetX)) * 4; - } - else { - src += (srcWidth + offsetX - m_width) * 4; - } - for (int row = 0; row < numRows; row++) { - ::memcpy(dst, src, numBytes); - src += srcBytesWidth; - dst += dstBytesWidth; - } - } - } -// doesn't compile under Linux delete [] tempData; - delete tempData; - } - else { - // Allocation failed, restore old data - m_data = tempData; - success = false; - } - } - - return success; -} - diff --git a/source/gameengine/GamePlayer/common/GPC_RawImage.h b/source/gameengine/GamePlayer/common/GPC_RawImage.h deleted file mode 100644 index b66567854dd..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawImage.h +++ /dev/null @@ -1,119 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPC_RAWIMAGE_H__ -#define __GPC_RAWIMAGE_H__ - -/** - * This memory resource reads images from the application resources. - * Images are expected to be stored as raw RGBA bytes. - * You can generate these images by exporting images with an alpha - * channel from Photoshop in RAW format with interleaved channels. - */ - -class GPC_RawImage -{ -public: - GPC_RawImage(); - - typedef enum { - alignTopLeft, - alignBottomRight - } TImageAlignment; - - /** - * Loads the image form the resource into memory. - * Converts size of the image and places it with given alignment. - * @param hInstApp The application's instance (location of the resources). - * @param lpName Name of the resource. - * @param lpType Type of the resource. - * @param srcWidth The width of the resource image. - * @param srcHeight The height of the resource image. - * @param width The width of the image created. - * @param height The height of the image created. - * @param alignment How the resource image is located in the image created. - * @param offsetX Amount of horzontal offset applied to the resource image. - * @param offsetY Amount of vertical offset applied to the resource image. - */ - virtual bool Load(const char *srcName, - int destWidth, int destHeight, - TImageAlignment alignment = alignTopLeft, - int offsetX = 0, int offsetY = 0); - - /** - * Returns the width of the image. - * @return The width of the image. - */ - virtual int Width() const - { - return m_width; - } - - /** - * Returns the height of the image. - * @return The height of the image. - */ - virtual int Height() const - { - return m_height; - } - - /** - * Returns a pointer to the data loaded from the resource. - * @return A pointer to the data loaded from the resource. - */ - virtual unsigned char *Data() const - { - return m_data; - } - - /** - * Returns the size of the data loaded from the resource. - * @return The size of the loaded from the resource. - */ - virtual int DataSize() const - { - return m_dataSize; - } - -protected: - /** - * Disposes the data stored at the m_data member. - */ -// virtual void disposeData(void); - -protected: - unsigned char *m_data; - int m_dataSize; - int m_width; - int m_height; -}; - -#endif // __GPC_RAWIMAGE_H__ - diff --git a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp deleted file mode 100644 index 159a6f50776..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp +++ /dev/null @@ -1,9306 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -// This file is automatically generated. Do not edit by hand! - -#include "GPC_RawLoadDotBlendArray.h" - -void GetRawLoadingAnimation(unsigned char **data, int *dataSize) -{ - // create an array that will automatically be deleted when) - // we're outta this scope - static unsigned char load_blend[]= { 66, 76, 69, 78, 68, 70, - 73, 10, 0, 2, 21, 0, 0, 2, 22, 0, 0, 0, 0, 0, 0, - 2, 30, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 65, 25, 242, 2, 0, 2, 29, 253, 0, 0, 0, 4, 160, 249, 227, - 5, 65, 25, 242, 2, 0, 2, 29, 237, 0, 0, 0, 10, 39, 161, - 89, 128, 65, 248, 18, 0, 0, 2, 28, 205, 179, 76, 248, 13, 9, - 10, 156, 188, 58, 101, 43, 138, 63, 142, 132, 111, 231, 106, 44, 72, - 171, 116, 148, 204, 204, 104, 121, 88, 224, 36, 141, 195, 251, 160, 141, - 162, 12, 177, 93, 203, 236, 68, 235, 2, 137, 27, 34, 49, 52, 25, - 83, 60, 100, 208, 12, 234, 185, 206, 97, 0, 109, 170, 238, 253, 66, - 0, 68, 0, 0, 236, 253, 127, 0, 246, 18, 0, 82, 0, 0, 0, - 42, 247, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, - 0, 0, 0, 0, 0, 36, 0, 2, 0, 0, 236, 253, 127, 0, 224, - 253, 127, 0, 224, 253, 127, 72, 249, 18, 0, 219, 128, 251, 119, 104, - 78, 249, 119, 255, 255, 255, 255, 0, 0, 0, 64, 111, 122, 152, 187, - 158, 149, 34, 236, 158, 103, 110, 35, 246, 67, 137, 177, 29, 56, 22, - 101, 64, 134, 124, 38, 155, 203, 128, 162, 3, 184, 27, 114, 80, 94, - 145, 136, 82, 121, 92, 7, 241, 119, 134, 12, 246, 193, 229, 95, 180, - 47, 135, 212, 231, 14, 59, 120, 218, 79, 151, 205, 221, 116, 27, 122, - 92, 0, 68, 0, 111, 0, 99, 0, 117, 0, 109, 0, 101, 0, 110, - 0, 116, 0, 115, 0, 82, 145, 252, 119, 255, 255, 255, 255, 60, 247, - 18, 0, 0, 0, 0, 0, 92, 247, 18, 0, 0, 16, 0, 0, 4, - 0, 0, 0, 0, 0, 242, 2, 0, 0, 242, 2, 32, 110, 172, 7, - 3, 239, 0, 0, 0, 0, 162, 7, 0, 0, 0, 64, 149, 244, 255, - 174, 70, 126, 180, 169, 78, 97, 78, 32, 67, 111, 110, 116, 101, 110, - 116, 32, 84, 101, 97, 109, 0, 247, 18, 0, 0, 16, 0, 0, 4, - 0, 0, 0, 0, 0, 242, 2, 0, 0, 242, 2, 80, 33, 90, 7, - 2, 32, 0, 0, 0, 0, 72, 7, 82, 145, 252, 119, 255, 255, 255, - 255, 168, 247, 18, 0, 0, 0, 0, 0, 200, 247, 18, 0, 0, 16, - 0, 0, 4, 0, 0, 0, 0, 0, 242, 2, 0, 0, 242, 2, 64, - 33, 88, 7, 2, 67, 0, 0, 0, 0, 72, 7, 216, 69, 0, 2, - 99, 111, 110, 116, 101, 110, 116, 99, 114, 101, 97, 116, 105, 111, 110, - 64, 98, 108, 101, 110, 100, 101, 114, 46, 110, 108, 0, 2, 81, 67, - 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 216, 69, 0, 0, 0, - 0, 72, 7, 116, 249, 18, 0, 127, 164, 252, 119, 0, 0, 242, 2, - 103, 154, 252, 119, 0, 0, 0, 0, 128, 26, 2, 0, 112, 112, 247, - 2, 12, 155, 252, 119, 255, 255, 255, 255, 40, 248, 18, 0, 0, 0, - 0, 0, 124, 249, 18, 0, 0, 16, 0, 0, 0, 236, 179, 7, 120, - 1, 242, 2, 48, 62, 8, 0, 184, 250, 18, 0, 0, 0, 72, 7, - 0, 112, 166, 7, 0, 0, 242, 2, 80, 0, 242, 2, 80, 0, 242, - 2, 0, 0, 226, 7, 0, 16, 162, 7, 0, 240, 5, 0, 248, 3, - 242, 2, 248, 3, 242, 2, 10, 0, 0, 0, 1, 0, 0, 0, 248, - 3, 242, 2, 120, 1, 242, 2, 112, 236, 179, 7, 120, 1, 242, 2, - 120, 1, 242, 2, 104, 236, 179, 7, 0, 16, 0, 0, 4, 0, 0, - 0, 0, 0, 242, 2, 0, 0, 242, 2, 64, 0, 162, 7, 3, 239, - 0, 0, 0, 0, 162, 7, 112, 236, 179, 7, 96, 157, 12, 3, 112, - 236, 179, 7, 120, 1, 242, 2, 104, 236, 179, 7, 18, 0, 0, 0, - 168, 248, 18, 0, 166, 166, 252, 119, 0, 0, 72, 7, 0, 48, 84, - 7, 64, 27, 84, 7, 0, 0, 242, 2, 236, 248, 18, 0, 176, 160, - 252, 119, 0, 0, 72, 7, 0, 32, 84, 7, 0, 16, 0, 0, 0, - 0, 242, 2, 64, 27, 84, 7, 1, 0, 0, 0, 136, 4, 0, 0, - 0, 27, 84, 7, 144, 1, 161, 7, 0, 0, 0, 0, 0, 0, 0, - 0, 145, 0, 0, 0, 145, 0, 0, 0, 152, 0, 0, 0, 0, 0, - 72, 7, 144, 249, 18, 0, 9, 151, 252, 119, 0, 32, 84, 7, 0, - 16, 0, 0, 143, 157, 252, 119, 86, 250, 18, 0, 72, 27, 84, 7, - 32, 0, 226, 7, 8, 0, 0, 0, 193, 0, 0, 0, 25, 0, 0, - 0, 0, 0, 242, 2, 135, 2, 0, 0, 112, 236, 179, 7, 64, 33, - 88, 7, 19, 0, 0, 0, 0, 249, 18, 0, 0, 67, 0, 0, 72, - 27, 84, 7, 0, 0, 0, 0, 0, 0, 0, 0, 200, 59, 90, 7, - 0, 0, 0, 0, 63, 0, 0, 0, 72, 33, 88, 7, 128, 26, 2, - 0, 112, 112, 247, 2, 0, 0, 0, 0, 16, 0, 0, 0, 224, 249, - 18, 0, 255, 255, 223, 255, 32, 0, 0, 0, 252, 24, 242, 2, 144, - 0, 0, 0, 8, 0, 0, 0, 77, 26, 2, 0, 1, 120, 64, 0, - 80, 6, 242, 2, 109, 26, 228, 7, 210, 119, 64, 0, 16, 0, 0, - 0, 191, 119, 64, 0, 65, 97, 108, 46, 0, 2, 26, 101, 0, 0, - 0, 6, 77, 194, 164, 27, 66, 114, 105, 0, 0, 2, 26, 77, 0, - 7, 126, 76, 0, 0, 0, 1, 121, 216, 88, 60, 9, 46, 197, 144, - 120, 249, 120, 38, 9, 47, 236, 125, 7, 120, 19, 71, 211, 240, 158, - 108, 176, 1, 3, 162, 155, 46, 211, 171, 113, 161, 186, 232, 132, 49, - 29, 131, 232, 132, 18, 100, 192, 96, 83, 140, 177, 77, 77, 192, 162, - 147, 64, 192, 9, 189, 37, 14, 16, 8, 9, 197, 96, 211, 193, 18, - 37, 116, 136, 147, 80, 2, 164, 152, 150, 0, 129, 196, 132, 22, 170, - 254, 153, 211, 173, 180, 42, 167, 147, 49, 223, 251, 230, 251, 126, 204, - 115, 104, 110, 119, 102, 118, 118, 119, 118, 102, 118, 111, 116, 106, 25, - 61, 210, 159, 120, 77, 9, 35, 132, 40, 178, 238, 111, 237, 30, 209, - 169, 117, 231, 200, 214, 221, 6, 142, 11, 10, 10, 234, 6, 160, 10, - 42, 110, 60, 43, 73, 240, 143, 131, 43, 24, 174, 182, 112, 141, 138, - 142, 139, 39, 78, 254, 186, 119, 35, 100, 8, 124, 166, 206, 138, 247, - 106, 43, 210, 56, 226, 36, 13, 78, 140, 137, 113, 160, 167, 184, 26, - 160, 205, 158, 22, 239, 165, 135, 43, 125, 85, 188, 87, 218, 202, 120, - 47, 213, 23, 112, 191, 35, 222, 139, 16, 147, 39, 92, 30, 164, 0, - 241, 84, 136, 20, 28, 241, 38, 145, 45, 123, 180, 44, 45, 210, 182, - 19, 121, 229, 206, 68, 124, 219, 63, 138, 135, 117, 20, 47, 13, 96, - 164, 19, 81, 60, 89, 188, 52, 6, 79, 11, 176, 133, 103, 1, 91, - 60, 45, 131, 71, 0, 78, 179, 226, 217, 180, 75, 24, 188, 244, 25, - 241, 94, 90, 171, 140, 28, 139, 135, 117, 20, 79, 7, 48, 177, 242, - 179, 193, 211, 49, 120, 74, 128, 145, 206, 204, 238, 150, 7, 139, 167, - 100, 240, 140, 211, 227, 189, 116, 20, 175, 128, 45, 30, 214, 81, 188, - 4, 128, 149, 34, 158, 81, 97, 219, 110, 2, 131, 167, 2, 24, 233, - 204, 120, 182, 252, 84, 12, 30, 206, 105, 130, 5, 175, 143, 13, 30, - 214, 181, 99, 116, 64, 53, 157, 202, 103, 197, 243, 133, 79, 212, 137, - 246, 34, 94, 192, 52, 51, 78, 154, 56, 47, 28, 51, 199, 190, 98, - 61, 197, 205, 153, 106, 214, 39, 173, 56, 215, 246, 184, 88, 79, 113, - 83, 1, 22, 120, 75, 224, 166, 50, 184, 26, 128, 145, 150, 206, 165, - 61, 174, 134, 193, 205, 213, 199, 123, 165, 138, 184, 132, 209, 77, 138, - 139, 245, 20, 55, 13, 96, 164, 197, 121, 114, 214, 183, 52, 6, 87, - 11, 48, 210, 226, 92, 165, 57, 193, 213, 50, 184, 217, 159, 1, 142, - 136, 107, 209, 1, 6, 23, 235, 41, 174, 30, 96, 164, 21, 230, 214, - 137, 188, 122, 6, 55, 0, 96, 164, 69, 220, 116, 39, 124, 3, 24, - 220, 156, 79, 97, 46, 62, 51, 235, 130, 51, 25, 176, 222, 50, 23, - 0, 7, 136, 184, 74, 39, 184, 169, 12, 174, 6, 96, 164, 77, 96, - 244, 209, 102, 46, 24, 220, 220, 213, 48, 23, 159, 138, 237, 59, 25, - 51, 172, 183, 204, 5, 192, 72, 171, 146, 224, 155, 198, 224, 106, 1, - 70, 90, 196, 77, 112, 130, 171, 101, 112, 9, 192, 72, 139, 186, 143, - 125, 179, 151, 129, 48, 184, 104, 7, 181, 34, 110, 186, 19, 92, 172, - 111, 207, 218, 91, 17, 87, 101, 39, 195, 79, 40, 47, 216, 211, 14, - 212, 22, 44, 55, 215, 11, 246, 111, 166, 85, 143, 177, 44, 231, 202, - 99, 133, 112, 253, 104, 190, 200, 155, 248, 19, 237, 225, 75, 230, 254, - 182, 221, 189, 96, 189, 4, 67, 92, 128, 40, 136, 167, 39, 87, 224, - 54, 241, 128, 127, 21, 61, 204, 190, 5, 255, 18, 230, 69, 146, 180, - 211, 17, 36, 189, 113, 71, 98, 92, 25, 41, 92, 217, 43, 160, 207, - 112, 41, 253, 158, 40, 148, 31, 63, 81, 96, 127, 211, 80, 167, 161, - 76, 99, 231, 139, 60, 89, 153, 114, 62, 139, 52, 3, 67, 90, 225, - 255, 133, 78, 173, 141, 28, 58, 180, 230, 65, 122, 159, 183, 63, 61, - 208, 212, 137, 32, 228, 56, 240, 188, 138, 244, 252, 213, 73, 153, 60, - 182, 206, 9, 158, 170, 56, 20, 121, 19, 205, 153, 120, 47, 147, 201, - 158, 118, 9, 71, 231, 8, 231, 133, 206, 145, 102, 169, 217, 7, 82, - 91, 128, 107, 156, 174, 133, 156, 243, 48, 55, 231, 223, 208, 220, 48, - 115, 240, 135, 7, 51, 72, 226, 189, 201, 131, 153, 35, 79, 243, 85, - 80, 144, 209, 203, 139, 43, 128, 189, 243, 224, 54, 42, 172, 115, 36, - 216, 102, 152, 163, 236, 79, 204, 195, 155, 0, 115, 164, 93, 6, 250, - 5, 87, 118, 201, 103, 10, 188, 176, 191, 26, 232, 36, 150, 69, 216, - 205, 81, 1, 6, 46, 139, 113, 67, 203, 94, 173, 85, 61, 90, 118, - 107, 219, 210, 86, 220, 193, 33, 253, 35, 71, 15, 30, 59, 42, 38, - 62, 57, 73, 21, 29, 63, 68, 213, 61, 38, 57, 57, 46, 126, 88, - 82, 255, 68, 184, 139, 30, 57, 178, 127, 100, 76, 210, 136, 228, 209, - 9, 253, 7, 38, 140, 29, 52, 50, 46, 41, 54, 38, 177, 97, 66, - 98, 204, 200, 209, 209, 67, 98, 18, 251, 147, 255, 109, 127, 133, 48, - 88, 131, 43, 150, 176, 211, 110, 213, 38, 170, 67, 168, 55, 22, 29, - 74, 5, 219, 181, 220, 188, 198, 81, 143, 88, 27, 153, 243, 61, 232, - 16, 92, 185, 103, 30, 43, 30, 194, 181, 58, 180, 132, 198, 190, 205, - 242, 166, 162, 14, 101, 43, 90, 234, 13, 160, 239, 6, 122, 223, 142, - 139, 202, 162, 240, 1, 16, 205, 3, 26, 190, 233, 97, 123, 95, 142, - 179, 222, 251, 138, 245, 94, 176, 30, 64, 123, 184, 44, 197, 89, 5, - 106, 209, 82, 70, 135, 210, 39, 152, 215, 121, 218, 216, 86, 196, 8, - 48, 94, 250, 197, 96, 167, 182, 64, 63, 114, 31, 40, 240, 194, 254, - 206, 3, 94, 88, 30, 78, 237, 240, 34, 115, 223, 204, 205, 233, 121, - 39, 235, 212, 85, 153, 30, 175, 139, 133, 159, 25, 205, 101, 121, 166, - 23, 254, 128, 94, 131, 101, 175, 59, 158, 15, 170, 61, 212, 32, 143, - 157, 159, 93, 85, 219, 227, 54, 56, 242, 155, 67, 153, 177, 74, 165, - 67, 158, 23, 63, 51, 210, 251, 195, 241, 190, 17, 185, 117, 210, 52, - 246, 114, 125, 81, 106, 155, 70, 33, 174, 47, 142, 185, 170, 192, 60, - 16, 226, 19, 129, 248, 103, 78, 159, 134, 161, 124, 214, 170, 125, 211, - 118, 124, 159, 210, 133, 52, 179, 222, 25, 8, 124, 141, 141, 115, 158, - 24, 194, 219, 69, 157, 228, 209, 126, 13, 228, 134, 113, 120, 61, 48, - 157, 86, 60, 55, 157, 19, 148, 177, 52, 211, 142, 106, 177, 121, 14, - 112, 126, 106, 136, 247, 97, 18, 123, 2, 176, 20, 116, 60, 248, 246, - 138, 213, 150, 88, 51, 77, 156, 75, 106, 191, 181, 31, 67, 236, 0, - 124, 164, 236, 247, 212, 217, 51, 91, 133, 188, 120, 63, 114, 205, 179, - 174, 135, 59, 191, 188, 252, 198, 237, 183, 66, 88, 103, 10, 187, 21, - 103, 107, 191, 179, 21, 102, 57, 223, 161, 190, 27, 116, 21, 251, 80, - 24, 109, 88, 235, 78, 173, 91, 245, 80, 181, 143, 106, 217, 182, 181, - 61, 117, 57, 17, 255, 20, 215, 29, 56, 212, 113, 42, 157, 55, 252, - 171, 66, 62, 81, 212, 130, 207, 108, 248, 204, 129, 207, 199, 240, 57, - 11, 40, 94, 1, 77, 49, 143, 79, 20, 175, 160, 172, 152, 71, 37, - 82, 139, 236, 80, 108, 82, 148, 129, 242, 101, 138, 115, 92, 25, 146, - 24, 61, 104, 80, 92, 114, 191, 192, 1, 254, 201, 195, 162, 255, 11, - 118, 171, 149, 172, 157, 142, 154, 168, 178, 96, 56, 55, 214, 137, 49, - 73, 49, 209, 137, 131, 99, 95, 199, 106, 255, 255, 222, 127, 171, 167, - 48, 107, 174, 73, 252, 115, 151, 46, 231, 241, 99, 133, 242, 122, 7, - 66, 125, 54, 234, 53, 235, 179, 81, 231, 89, 159, 221, 144, 250, 236, - 54, 237, 59, 181, 38, 221, 222, 177, 153, 139, 16, 9, 103, 156, 135, - 177, 32, 20, 242, 31, 52, 50, 38, 126, 72, 255, 30, 49, 19, 146, - 251, 147, 193, 201, 253, 253, 253, 243, 237, 212, 19, 7, 37, 155, 121, - 55, 28, 26, 23, 31, 61, 210, 220, 66, 62, 248, 121, 139, 159, 211, - 37, 34, 28, 139, 207, 78, 181, 250, 108, 60, 243, 64, 31, 142, 126, - 26, 227, 120, 26, 251, 11, 182, 254, 212, 99, 5, 94, 169, 39, 204, - 215, 244, 65, 213, 29, 252, 193, 149, 203, 39, 194, 237, 203, 70, 151, - 244, 216, 199, 250, 56, 243, 165, 231, 15, 139, 14, 1, 125, 116, 79, - 240, 201, 236, 61, 250, 108, 122, 239, 43, 214, 23, 34, 133, 65, 198, - 130, 5, 213, 10, 181, 2, 99, 243, 170, 30, 142, 113, 95, 234, 229, - 246, 2, 172, 252, 50, 146, 228, 108, 134, 125, 220, 122, 216, 115, 173, - 123, 162, 192, 11, 251, 187, 10, 117, 10, 202, 35, 169, 109, 223, 108, - 238, 91, 65, 7, 123, 76, 63, 171, 100, 17, 253, 120, 176, 197, 15, - 15, 16, 141, 51, 255, 235, 248, 167, 86, 216, 126, 186, 250, 11, 200, - 137, 197, 246, 45, 126, 25, 73, 110, 153, 238, 155, 80, 58, 148, 183, - 143, 40, 99, 107, 122, 46, 179, 9, 246, 155, 112, 95, 136, 234, 255, - 72, 115, 28, 94, 195, 66, 13, 222, 20, 46, 244, 165, 56, 211, 37, - 224, 234, 6, 87, 15, 113, 230, 75, 136, 88, 219, 57, 199, 51, 170, - 253, 34, 127, 158, 238, 65, 191, 2, 31, 2, 109, 217, 118, 163, 116, - 4, 240, 62, 112, 230, 244, 60, 158, 222, 3, 166, 145, 250, 82, 37, - 213, 101, 206, 220, 214, 100, 177, 29, 37, 177, 222, 151, 16, 235, 11, - 95, 172, 30, 134, 23, 209, 13, 111, 67, 200, 164, 72, 54, 214, 116, - 246, 167, 187, 19, 239, 229, 107, 185, 235, 18, 225, 112, 208, 198, 200, - 70, 227, 51, 236, 3, 141, 207, 2, 54, 66, 252, 182, 201, 188, 143, - 29, 245, 21, 207, 115, 85, 234, 31, 152, 244, 110, 93, 161, 31, 21, - 51, 235, 242, 95, 230, 244, 9, 111, 22, 192, 11, 177, 144, 222, 231, - 189, 125, 199, 134, 167, 240, 75, 126, 255, 64, 208, 231, 175, 30, 53, - 81, 199, 214, 62, 23, 94, 179, 227, 68, 53, 234, 238, 72, 160, 71, - 154, 239, 139, 188, 39, 232, 246, 163, 202, 245, 15, 108, 6, 250, 163, - 64, 131, 247, 200, 183, 41, 240, 90, 38, 210, 31, 27, 176, 40, 235, - 210, 225, 209, 225, 115, 47, 61, 56, 128, 244, 31, 172, 127, 24, 126, - 233, 238, 172, 125, 101, 70, 111, 222, 139, 245, 143, 87, 255, 24, 126, - 134, 251, 58, 244, 234, 209, 195, 33, 120, 255, 113, 11, 213, 222, 160, - 152, 19, 225, 57, 77, 139, 238, 193, 251, 171, 17, 183, 194, 180, 237, - 106, 135, 125, 219, 198, 180, 7, 233, 115, 107, 47, 209, 68, 62, 152, - 161, 169, 179, 249, 8, 78, 27, 25, 224, 121, 41, 107, 199, 172, 66, - 252, 139, 199, 126, 194, 78, 37, 98, 232, 23, 135, 75, 239, 216, 219, - 170, 222, 166, 130, 135, 216, 246, 231, 137, 237, 247, 122, 233, 207, 63, - 233, 85, 221, 208, 177, 233, 196, 172, 115, 15, 167, 103, 125, 49, 255, - 184, 134, 106, 16, 27, 159, 153, 255, 204, 241, 153, 48, 87, 16, 159, - 1, 47, 245, 149, 195, 163, 15, 64, 95, 108, 214, 58, 198, 103, 126, - 220, 82, 14, 47, 155, 89, 113, 50, 151, 212, 158, 227, 156, 80, 123, - 142, 107, 21, 231, 139, 181, 231, 133, 109, 236, 185, 157, 189, 12, 249, - 119, 111, 174, 44, 246, 60, 32, 40, 223, 182, 156, 181, 231, 174, 246, - 96, 24, 7, 226, 56, 190, 195, 204, 31, 142, 49, 142, 99, 183, 214, - 218, 78, 45, 91, 181, 118, 26, 8, 122, 137, 248, 213, 185, 193, 240, - 81, 149, 169, 41, 98, 23, 7, 190, 226, 204, 113, 224, 43, 206, 28, - 7, 190, 226, 254, 230, 204, 113, 96, 83, 197, 43, 14, 227, 192, 166, - 10, 140, 3, 253, 132, 248, 239, 21, 241, 84, 188, 32, 52, 14, 12, - 246, 31, 158, 48, 204, 226, 66, 251, 39, 131, 243, 28, 155, 24, 211, - 31, 43, 243, 24, 168, 228, 121, 46, 36, 116, 133, 138, 64, 250, 19, - 27, 246, 46, 113, 95, 59, 14, 252, 87, 247, 223, 230, 239, 77, 247, - 63, 191, 113, 96, 238, 163, 199, 138, 156, 180, 54, 150, 152, 5, 227, - 148, 14, 236, 243, 155, 84, 235, 249, 39, 158, 83, 101, 139, 231, 244, - 169, 71, 33, 86, 193, 235, 176, 249, 122, 83, 49, 75, 63, 15, 243, - 57, 2, 123, 63, 154, 185, 79, 16, 235, 139, 128, 55, 134, 29, 28, - 68, 44, 227, 132, 243, 196, 43, 156, 227, 121, 162, 242, 120, 123, 146, - 134, 48, 92, 1, 235, 32, 254, 74, 131, 190, 116, 125, 166, 80, 142, - 249, 71, 65, 253, 50, 150, 83, 191, 156, 176, 214, 220, 55, 91, 191, - 60, 223, 206, 47, 207, 119, 234, 151, 199, 137, 126, 248, 165, 157, 95, - 126, 41, 250, 101, 172, 151, 243, 203, 218, 162, 175, 20, 246, 118, 31, - 253, 242, 159, 146, 126, 121, 190, 173, 95, 22, 251, 48, 155, 238, 85, - 63, 135, 56, 13, 250, 231, 35, 198, 46, 230, 179, 3, 218, 46, 126, - 98, 63, 166, 69, 152, 239, 239, 70, 248, 43, 172, 177, 213, 56, 113, - 114, 26, 42, 172, 253, 161, 247, 180, 63, 214, 63, 228, 53, 41, 210, - 124, 206, 160, 106, 89, 88, 12, 185, 18, 166, 91, 207, 50, 105, 220, - 128, 50, 209, 184, 1, 231, 3, 229, 125, 27, 55, 252, 123, 226, 6, - 156, 19, 118, 31, 136, 243, 245, 54, 110, 120, 189, 184, 161, 59, 236, - 114, 230, 128, 173, 210, 237, 143, 247, 10, 165, 207, 225, 118, 216, 62, - 199, 238, 222, 42, 208, 41, 111, 58, 254, 186, 109, 241, 94, 250, 94, - 214, 117, 164, 4, 94, 154, 61, 86, 30, 67, 253, 2, 3, 99, 253, - 182, 165, 195, 231, 1, 206, 215, 25, 159, 96, 210, 22, 44, 227, 16, - 219, 115, 77, 187, 253, 150, 94, 145, 195, 133, 1, 206, 71, 68, 195, - 105, 56, 78, 60, 31, 3, 55, 146, 178, 124, 249, 30, 126, 197, 242, - 229, 203, 79, 159, 190, 235, 100, 143, 102, 110, 112, 32, 88, 135, 2, - 226, 136, 148, 23, 85, 207, 254, 172, 181, 81, 163, 127, 247, 57, 124, - 163, 70, 137, 160, 16, 49, 137, 141, 254, 181, 242, 145, 234, 228, 237, - 223, 27, 251, 67, 123, 87, 73, 92, 79, 45, 232, 243, 211, 125, 226, - 186, 82, 90, 215, 159, 222, 167, 187, 66, 119, 57, 222, 139, 226, 35, - 14, 197, 79, 0, 24, 233, 17, 95, 97, 193, 223, 173, 208, 252, 108, - 197, 79, 96, 240, 85, 0, 11, 109, 0, 190, 135, 5, 127, 191, 34, - 221, 104, 197, 87, 49, 248, 217, 123, 193, 63, 138, 248, 158, 22, 252, - 158, 16, 111, 89, 241, 17, 135, 226, 235, 1, 70, 122, 142, 57, 141, - 42, 170, 240, 228, 52, 247, 172, 248, 122, 6, 63, 0, 96, 164, 71, - 67, 70, 207, 105, 52, 10, 13, 135, 231, 1, 20, 63, 128, 193, 207, - 1, 187, 131, 244, 40, 15, 53, 64, 248, 204, 32, 224, 132, 21, 31, - 113, 40, 126, 42, 192, 1, 34, 62, 181, 149, 222, 138, 126, 156, 178, - 123, 172, 5, 63, 149, 193, 71, 187, 134, 244, 28, 19, 19, 233, 125, - 98, 56, 180, 129, 20, 95, 195, 224, 19, 145, 30, 249, 23, 102, 248, - 231, 148, 136, 245, 162, 182, 23, 237, 109, 40, 107, 79, 247, 91, 109, - 103, 247, 86, 66, 230, 147, 127, 64, 64, 160, 243, 220, 165, 51, 182, - 182, 55, 0, 120, 105, 50, 65, 198, 76, 199, 92, 36, 142, 188, 181, - 189, 111, 109, 239, 219, 191, 188, 216, 94, 92, 79, 22, 219, 146, 105, - 125, 198, 75, 215, 82, 57, 197, 66, 69, 234, 119, 140, 109, 201, 100, - 108, 11, 192, 72, 207, 49, 49, 178, 222, 103, 132, 2, 215, 172, 197, - 182, 48, 248, 116, 221, 34, 236, 97, 225, 223, 90, 65, 90, 91, 109, - 145, 38, 211, 206, 182, 136, 248, 212, 246, 126, 194, 45, 84, 232, 47, - 198, 123, 117, 129, 0, 121, 147, 194, 28, 155, 53, 165, 252, 207, 216, - 218, 132, 46, 17, 173, 162, 71, 197, 36, 70, 75, 217, 137, 34, 121, - 28, 51, 180, 177, 194, 30, 113, 241, 35, 135, 211, 111, 109, 110, 172, - 151, 187, 124, 30, 6, 220, 210, 196, 237, 95, 123, 240, 224, 225, 230, - 54, 153, 23, 35, 63, 159, 158, 217, 39, 246, 87, 99, 189, 161, 107, - 53, 10, 176, 29, 96, 126, 28, 158, 149, 167, 248, 46, 225, 39, 118, - 186, 159, 113, 118, 255, 11, 181, 252, 51, 116, 235, 253, 207, 77, 2, - 249, 199, 134, 230, 252, 244, 51, 235, 49, 229, 148, 108, 136, 92, 144, - 245, 219, 136, 15, 212, 117, 158, 142, 16, 112, 60, 58, 213, 227, 111, - 247, 169, 110, 232, 48, 243, 168, 192, 87, 245, 67, 64, 75, 242, 229, - 188, 131, 135, 4, 25, 245, 188, 98, 89, 18, 191, 54, 121, 181, 58, - 113, 231, 178, 12, 172, 7, 56, 11, 203, 174, 133, 148, 204, 20, 198, - 122, 102, 209, 224, 133, 173, 190, 13, 166, 109, 30, 139, 45, 100, 220, - 190, 232, 156, 166, 193, 208, 181, 70, 231, 207, 246, 243, 246, 103, 181, - 237, 5, 184, 46, 17, 70, 111, 171, 158, 14, 97, 250, 170, 231, 11, - 214, 29, 194, 139, 207, 219, 133, 126, 152, 239, 237, 207, 19, 254, 211, - 127, 212, 23, 88, 199, 129, 234, 47, 234, 44, 213, 95, 212, 47, 212, - 103, 123, 253, 181, 119, 142, 175, 171, 191, 174, 254, 140, 105, 238, 235, - 47, 253, 51, 231, 99, 184, 223, 103, 182, 82, 154, 70, 234, 62, 127, - 57, 35, 175, 75, 47, 93, 246, 154, 250, 27, 105, 214, 95, 47, 9, - 253, 45, 124, 177, 122, 56, 171, 191, 230, 243, 28, 187, 252, 58, 251, - 231, 200, 233, 96, 87, 225, 50, 158, 54, 95, 90, 241, 202, 151, 190, - 106, 92, 207, 37, 218, 235, 78, 98, 219, 49, 78, 98, 47, 142, 249, - 63, 41, 38, 62, 105, 116, 162, 235, 22, 211, 210, 109, 229, 69, 254, - 158, 76, 185, 176, 55, 56, 109, 246, 43, 90, 17, 142, 117, 26, 243, - 217, 158, 210, 12, 30, 29, 159, 44, 215, 91, 157, 68, 219, 58, 166, - 109, 173, 216, 118, 152, 8, 143, 115, 210, 118, 17, 40, 193, 53, 25, - 61, 216, 117, 147, 202, 211, 214, 60, 30, 165, 120, 63, 74, 228, 231, - 105, 23, 35, 83, 59, 129, 182, 129, 218, 9, 220, 123, 176, 190, 174, - 75, 196, 96, 193, 78, 116, 27, 157, 76, 98, 163, 135, 140, 30, 79, - 70, 70, 199, 199, 88, 229, 227, 94, 83, 11, 178, 251, 59, 230, 65, - 42, 35, 221, 183, 19, 172, 63, 99, 203, 251, 4, 55, 108, 172, 251, - 252, 165, 225, 210, 55, 51, 121, 41, 59, 129, 190, 4, 124, 74, 198, - 235, 218, 9, 244, 71, 248, 217, 169, 78, 204, 6, 44, 51, 251, 38, - 161, 60, 3, 224, 12, 138, 103, 43, 163, 158, 143, 243, 91, 19, 28, - 235, 183, 38, 195, 202, 83, 207, 31, 111, 182, 37, 56, 78, 40, 35, - 36, 113, 122, 51, 161, 110, 56, 224, 225, 125, 244, 231, 47, 249, 31, - 191, 153, 105, 88, 221, 230, 187, 204, 55, 97, 39, 44, 135, 217, 145, - 156, 194, 153, 159, 107, 158, 185, 228, 132, 75, 59, 225, 196, 209, 25, - 143, 131, 93, 128, 75, 35, 94, 250, 99, 230, 43, 251, 168, 249, 250, - 159, 182, 19, 26, 81, 134, 190, 118, 186, 152, 28, 55, 42, 70, 24, - 211, 209, 9, 78, 185, 23, 176, 201, 88, 37, 228, 238, 113, 235, 186, - 65, 219, 131, 125, 121, 19, 182, 135, 28, 119, 190, 254, 105, 185, 16, - 215, 30, 179, 218, 30, 132, 223, 148, 237, 209, 28, 115, 222, 54, 45, - 23, 206, 32, 142, 90, 109, 15, 194, 227, 156, 246, 153, 19, 202, 228, - 108, 79, 194, 81, 235, 24, 6, 136, 247, 9, 22, 126, 5, 225, 243, - 132, 101, 94, 228, 254, 168, 109, 66, 123, 68, 109, 19, 158, 163, 208, - 56, 217, 140, 211, 41, 122, 84, 130, 195, 246, 222, 34, 127, 225, 215, - 212, 188, 4, 226, 104, 155, 178, 179, 221, 183, 77, 213, 71, 8, 71, - 236, 228, 138, 218, 43, 194, 133, 126, 107, 172, 151, 237, 223, 229, 226, - 237, 249, 188, 218, 166, 135, 158, 77, 4, 62, 15, 60, 155, 24, 109, - 219, 48, 255, 61, 16, 235, 41, 158, 173, 140, 249, 143, 97, 128, 191, - 90, 108, 135, 217, 59, 232, 45, 240, 223, 158, 77, 178, 216, 250, 232, - 105, 207, 240, 57, 142, 126, 228, 96, 254, 160, 192, 83, 201, 198, 48, - 172, 198, 187, 105, 155, 254, 211, 49, 183, 198, 189, 24, 28, 117, 214, - 178, 135, 252, 57, 222, 11, 245, 217, 65, 127, 131, 254, 93, 250, 11, - 253, 104, 138, 250, 241, 58, 250, 251, 208, 115, 199, 6, 212, 223, 203, - 197, 79, 240, 121, 209, 223, 25, 237, 99, 26, 163, 110, 90, 245, 87, - 111, 4, 95, 217, 152, 35, 250, 47, 241, 110, 26, 212, 163, 14, 83, - 253, 181, 149, 49, 255, 250, 11, 252, 97, 22, 244, 89, 230, 79, 179, - 158, 66, 251, 65, 84, 95, 5, 253, 109, 50, 106, 29, 171, 191, 170, - 191, 191, 108, 252, 127, 93, 127, 81, 103, 169, 254, 226, 57, 57, 234, - 179, 131, 254, 6, 255, 235, 236, 47, 62, 131, 109, 246, 58, 250, 91, - 109, 153, 234, 75, 179, 254, 182, 215, 228, 209, 254, 26, 103, 180, 191, - 217, 152, 234, 111, 156, 95, 181, 29, 168, 195, 189, 43, 95, 255, 146, - 218, 229, 105, 80, 207, 216, 95, 70, 198, 55, 98, 127, 179, 98, 253, - 170, 101, 60, 16, 237, 44, 200, 34, 232, 243, 116, 225, 147, 234, 239, - 61, 59, 253, 173, 211, 228, 255, 186, 254, 162, 206, 82, 253, 197, 179, - 61, 212, 103, 7, 253, 109, 252, 111, 179, 191, 154, 93, 168, 31, 175, - 163, 191, 165, 238, 124, 42, 232, 239, 245, 83, 75, 242, 164, 191, 69, - 166, 164, 239, 64, 29, 102, 236, 175, 166, 248, 242, 167, 59, 106, 30, - 208, 109, 20, 198, 2, 234, 177, 206, 106, 127, 89, 25, 243, 175, 191, - 208, 62, 238, 125, 212, 230, 79, 97, 189, 100, 21, 91, 254, 212, 162, - 207, 168, 191, 153, 125, 163, 215, 179, 250, 187, 69, 149, 186, 227, 255, - 186, 254, 162, 206, 90, 246, 230, 223, 197, 123, 161, 62, 91, 113, 180, - 184, 25, 119, 8, 32, 94, 119, 111, 142, 252, 241, 51, 189, 175, 163, - 254, 170, 90, 185, 175, 191, 251, 163, 106, 26, 157, 237, 205, 67, 151, - 253, 206, 31, 26, 30, 166, 153, 251, 233, 217, 64, 115, 110, 203, 155, - 59, 195, 91, 253, 209, 23, 161, 108, 205, 18, 239, 241, 181, 214, 246, - 226, 248, 221, 27, 75, 218, 12, 14, 150, 9, 243, 173, 226, 248, 195, - 32, 75, 212, 142, 206, 25, 206, 228, 168, 51, 233, 97, 45, 44, 11, - 168, 249, 113, 144, 179, 54, 71, 125, 62, 189, 49, 244, 81, 83, 207, - 114, 6, 157, 63, 122, 235, 25, 158, 243, 189, 249, 235, 156, 225, 105, - 192, 87, 227, 69, 46, 154, 47, 227, 121, 243, 149, 125, 206, 124, 253, - 39, 246, 230, 216, 190, 253, 222, 60, 33, 113, 244, 176, 196, 152, 164, - 36, 210, 173, 75, 219, 110, 173, 187, 119, 183, 223, 164, 43, 236, 78, - 212, 71, 26, 109, 247, 230, 216, 23, 251, 189, 121, 97, 225, 59, 14, - 156, 219, 123, 115, 205, 5, 24, 139, 11, 206, 247, 199, 180, 92, 56, - 23, 60, 111, 222, 31, 71, 138, 52, 67, 152, 118, 45, 253, 200, 199, - 115, 50, 173, 216, 134, 179, 61, 191, 135, 216, 31, 15, 55, 247, 252, - 26, 224, 163, 63, 239, 188, 79, 180, 92, 216, 243, 159, 51, 247, 201, - 83, 164, 25, 70, 207, 33, 71, 62, 86, 88, 206, 2, 206, 229, 243, - 44, 224, 156, 221, 89, 192, 57, 219, 179, 128, 188, 140, 159, 229, 44, - 224, 59, 102, 47, 117, 15, 250, 122, 209, 153, 45, 12, 126, 35, 182, - 208, 229, 179, 186, 150, 238, 219, 66, 214, 230, 73, 157, 95, 162, 77, - 162, 87, 222, 158, 251, 56, 191, 119, 198, 199, 85, 153, 173, 140, 255, - 162, 231, 113, 130, 45, 116, 244, 229, 249, 121, 158, 241, 95, 221, 75, - 221, 99, 246, 82, 119, 226, 189, 168, 191, 181, 209, 223, 160, 55, 171, - 191, 105, 203, 28, 159, 39, 235, 195, 229, 245, 87, 43, 202, 198, 230, - 31, 190, 206, 89, 150, 251, 190, 220, 158, 159, 251, 101, 182, 50, 254, - 139, 158, 199, 17, 231, 250, 75, 99, 81, 169, 231, 201, 158, 132, 227, - 200, 127, 237, 207, 185, 47, 247, 100, 116, 130, 179, 223, 99, 221, 177, - 234, 53, 230, 102, 161, 158, 91, 245, 58, 105, 68, 204, 200, 152, 228, - 209, 241, 206, 99, 212, 242, 175, 251, 252, 104, 145, 173, 94, 167, 105, - 99, 189, 84, 49, 238, 191, 91, 3, 159, 19, 105, 27, 249, 105, 204, - 207, 137, 24, 191, 101, 83, 238, 252, 249, 17, 158, 109, 37, 78, 111, - 22, 156, 215, 51, 174, 56, 225, 185, 142, 158, 55, 63, 231, 17, 238, - 51, 146, 129, 15, 251, 60, 8, 203, 226, 196, 231, 63, 125, 156, 202, - 98, 253, 91, 244, 109, 187, 218, 66, 140, 89, 104, 209, 54, 103, 109, - 142, 9, 110, 152, 9, 244, 70, 160, 55, 188, 145, 231, 71, 222, 249, - 124, 126, 228, 132, 101, 78, 54, 196, 5, 112, 229, 220, 6, 157, 185, - 21, 239, 149, 246, 27, 92, 55, 224, 186, 14, 215, 63, 255, 153, 24, - 21, 101, 160, 49, 42, 202, 130, 117, 227, 163, 71, 142, 16, 158, 85, - 36, 71, 39, 38, 11, 128, 109, 144, 106, 126, 126, 116, 220, 178, 63, - 247, 249, 206, 26, 239, 104, 68, 62, 108, 220, 139, 109, 196, 13, 129, - 133, 224, 200, 202, 41, 79, 164, 91, 149, 109, 27, 247, 226, 24, 209, - 184, 87, 119, 219, 126, 108, 204, 45, 13, 141, 75, 76, 74, 30, 154, - 24, 13, 173, 72, 70, 192, 1, 217, 206, 99, 68, 90, 46, 124, 135, - 245, 55, 115, 140, 216, 73, 108, 203, 18, 111, 223, 50, 207, 149, 167, - 101, 54, 205, 237, 226, 120, 13, 141, 139, 199, 175, 6, 136, 78, 218, - 182, 117, 61, 208, 169, 110, 59, 111, 151, 150, 11, 246, 227, 166, 185, - 221, 88, 145, 102, 160, 88, 78, 23, 182, 227, 188, 216, 245, 141, 96, - 180, 217, 180, 185, 148, 86, 52, 49, 35, 184, 140, 201, 59, 137, 253, - 100, 247, 24, 58, 177, 207, 236, 243, 63, 156, 79, 75, 159, 157, 140, - 182, 234, 119, 216, 99, 252, 46, 177, 199, 248, 157, 25, 235, 27, 214, - 62, 35, 141, 125, 159, 45, 122, 35, 21, 143, 202, 172, 132, 38, 1, - 238, 237, 67, 112, 206, 99, 153, 121, 176, 213, 45, 15, 203, 157, 91, - 121, 15, 191, 57, 246, 219, 135, 41, 23, 250, 13, 107, 60, 247, 42, - 236, 69, 175, 89, 159, 127, 98, 187, 84, 6, 213, 77, 179, 61, 176, - 202, 160, 176, 145, 33, 72, 46, 246, 185, 233, 40, 131, 55, 83, 46, - 60, 83, 52, 1, 124, 213, 218, 190, 138, 105, 31, 231, 37, 231, 166, - 115, 27, 132, 237, 7, 190, 230, 126, 15, 249, 178, 251, 61, 149, 216, - 134, 121, 191, 231, 109, 25, 233, 228, 241, 113, 201, 131, 99, 3, 73, - 108, 220, 224, 88, 212, 1, 123, 126, 74, 224, 163, 189, 225, 216, 71, - 21, 250, 234, 27, 204, 154, 122, 9, 122, 248, 10, 238, 225, 83, 245, - 34, 222, 75, 243, 60, 222, 75, 247, 12, 246, 79, 79, 205, 54, 150, - 234, 36, 242, 163, 123, 193, 156, 62, 214, 189, 32, 206, 19, 221, 11, - 226, 92, 177, 90, 33, 124, 183, 107, 244, 184, 152, 161, 163, 19, 199, - 71, 39, 14, 33, 206, 182, 133, 154, 235, 182, 123, 65, 188, 79, 96, - 250, 95, 134, 212, 204, 211, 24, 134, 137, 114, 80, 153, 80, 135, 210, - 196, 54, 138, 139, 23, 218, 9, 146, 28, 147, 0, 251, 212, 184, 209, - 241, 32, 150, 221, 100, 233, 174, 89, 101, 10, 19, 239, 135, 83, 31, - 32, 126, 175, 45, 47, 114, 217, 203, 135, 50, 89, 246, 207, 162, 142, - 211, 157, 47, 94, 184, 158, 5, 25, 99, 146, 98, 146, 5, 192, 172, - 86, 84, 169, 19, 174, 218, 218, 126, 188, 143, 183, 219, 7, 200, 217, - 194, 134, 1, 254, 104, 8, 253, 131, 131, 228, 229, 37, 140, 188, 184, - 38, 114, 175, 218, 142, 103, 82, 92, 50, 113, 181, 229, 79, 205, 177, - 29, 79, 188, 183, 140, 167, 206, 60, 158, 193, 194, 219, 72, 95, 111, - 60, 81, 38, 42, 159, 160, 203, 87, 29, 199, 19, 101, 180, 172, 79, - 187, 9, 15, 48, 217, 142, 39, 222, 219, 143, 167, 197, 206, 198, 153, - 71, 211, 126, 68, 97, 60, 155, 187, 43, 47, 202, 56, 142, 89, 127, - 233, 38, 58, 158, 156, 48, 158, 160, 151, 193, 46, 247, 95, 175, 108, - 199, 19, 239, 233, 120, 166, 142, 123, 172, 240, 16, 96, 249, 112, 55, - 72, 66, 62, 148, 201, 162, 159, 212, 62, 216, 202, 231, 250, 124, 231, - 165, 173, 124, 120, 79, 229, 11, 8, 115, 95, 190, 210, 82, 250, 200, - 200, 135, 54, 43, 231, 165, 131, 124, 46, 205, 111, 234, 11, 59, 125, - 124, 97, 149, 47, 61, 144, 202, 231, 245, 218, 242, 161, 76, 84, 62, - 180, 167, 196, 81, 62, 151, 238, 41, 253, 185, 173, 124, 120, 79, 229, - 83, 109, 116, 127, 252, 138, 75, 200, 135, 50, 81, 249, 208, 214, 171, - 94, 56, 200, 215, 216, 229, 254, 234, 153, 173, 124, 120, 79, 229, 211, - 125, 234, 190, 124, 133, 37, 228, 67, 153, 168, 124, 232, 135, 52, 207, - 29, 228, 107, 226, 138, 111, 238, 83, 91, 249, 240, 158, 202, 151, 179, - 208, 253, 249, 149, 146, 15, 101, 162, 242, 161, 143, 212, 61, 115, 144, - 175, 169, 43, 190, 74, 59, 249, 148, 140, 124, 233, 183, 168, 124, 133, - 100, 229, 43, 47, 33, 31, 202, 196, 158, 207, 234, 159, 58, 200, 215, - 204, 229, 25, 230, 63, 182, 242, 225, 61, 149, 47, 247, 35, 247, 231, - 183, 138, 19, 249, 210, 112, 126, 159, 196, 123, 77, 167, 246, 234, 177, - 109, 140, 130, 47, 132, 75, 154, 173, 52, 12, 104, 84, 215, 80, 253, - 131, 249, 65, 182, 123, 51, 199, 253, 179, 231, 129, 78, 1, 243, 74, - 198, 212, 194, 187, 196, 71, 211, 131, 241, 187, 11, 21, 227, 183, 172, - 199, 251, 23, 203, 18, 214, 255, 176, 96, 81, 45, 74, 151, 8, 124, - 251, 1, 223, 122, 34, 223, 132, 152, 145, 227, 226, 146, 228, 109, 118, - 154, 40, 39, 149, 217, 248, 8, 230, 252, 137, 85, 110, 47, 79, 233, - 115, 146, 225, 175, 82, 248, 249, 179, 84, 33, 126, 29, 190, 10, 169, - 164, 250, 53, 116, 199, 211, 20, 126, 77, 205, 129, 97, 245, 14, 212, - 21, 190, 171, 238, 229, 59, 112, 127, 14, 148, 77, 189, 176, 70, 248, - 174, 249, 254, 115, 245, 66, 239, 4, 127, 186, 119, 191, 201, 252, 221, - 245, 65, 89, 115, 50, 218, 77, 43, 210, 184, 66, 185, 194, 130, 204, - 67, 99, 70, 141, 77, 244, 135, 189, 69, 178, 188, 204, 40, 39, 149, - 57, 247, 97, 188, 23, 59, 214, 174, 100, 254, 12, 218, 206, 44, 22, - 186, 111, 194, 217, 81, 33, 171, 74, 157, 223, 59, 23, 238, 79, 143, - 234, 185, 111, 198, 194, 187, 194, 247, 227, 223, 221, 223, 35, 116, 49, - 244, 43, 182, 246, 62, 161, 15, 95, 23, 248, 43, 164, 247, 227, 189, - 161, 63, 188, 50, 203, 92, 235, 66, 98, 198, 199, 77, 67, 50, 195, - 238, 238, 17, 100, 78, 142, 27, 20, 23, 237, 166, 204, 40, 39, 149, - 89, 5, 48, 246, 193, 29, 153, 191, 130, 182, 115, 175, 105, 67, 74, - 239, 138, 10, 137, 243, 57, 27, 186, 239, 89, 10, 191, 80, 217, 57, - 172, 100, 204, 105, 65, 230, 210, 5, 59, 239, 199, 178, 221, 13, 190, - 23, 198, 121, 112, 193, 111, 67, 248, 37, 223, 238, 61, 47, 142, 243, - 246, 6, 199, 130, 134, 110, 73, 207, 56, 197, 63, 51, 203, 28, 157, - 152, 52, 54, 201, 181, 208, 84, 102, 21, 35, 179, 246, 1, 196, 71, - 15, 221, 147, 249, 224, 243, 20, 126, 99, 196, 201, 61, 186, 97, 123, - 247, 234, 238, 53, 223, 239, 253, 87, 10, 175, 184, 181, 123, 127, 212, - 227, 16, 225, 121, 229, 202, 187, 187, 195, 218, 66, 89, 239, 243, 45, - 133, 62, 248, 126, 223, 98, 95, 197, 175, 187, 133, 236, 22, 101, 62, - 186, 46, 36, 176, 207, 39, 202, 192, 67, 185, 251, 133, 179, 249, 81, - 49, 201, 209, 114, 114, 91, 222, 197, 248, 192, 42, 179, 254, 111, 240, - 1, 110, 202, 236, 108, 13, 22, 43, 181, 122, 187, 49, 178, 189, 16, - 16, 7, 63, 235, 45, 172, 65, 221, 237, 87, 194, 26, 60, 247, 243, - 246, 218, 247, 31, 159, 89, 79, 233, 74, 54, 59, 158, 113, 186, 192, - 209, 237, 154, 155, 61, 132, 117, 57, 114, 236, 168, 65, 209, 137, 238, - 173, 65, 148, 147, 202, 156, 126, 31, 246, 55, 15, 94, 95, 230, 247, - 54, 181, 202, 24, 55, 38, 184, 54, 222, 253, 82, 96, 181, 48, 126, - 217, 33, 53, 4, 153, 149, 15, 252, 191, 120, 117, 226, 75, 139, 204, - 115, 171, 182, 200, 168, 115, 236, 122, 70, 234, 137, 80, 65, 230, 228, - 216, 209, 137, 209, 19, 220, 147, 25, 229, 164, 50, 231, 228, 194, 190, - 234, 239, 215, 151, 185, 235, 160, 105, 25, 161, 187, 102, 9, 50, 159, - 173, 91, 93, 144, 153, 12, 60, 33, 188, 166, 108, 237, 198, 102, 27, - 114, 219, 101, 91, 108, 93, 181, 58, 75, 130, 118, 39, 148, 201, 56, - 253, 219, 118, 33, 15, 61, 58, 121, 100, 180, 220, 195, 52, 42, 51, - 202, 105, 209, 231, 170, 177, 94, 216, 7, 70, 102, 165, 187, 50, 163, - 30, 244, 251, 114, 94, 80, 179, 47, 139, 9, 227, 250, 237, 170, 221, - 194, 243, 244, 250, 57, 105, 27, 240, 254, 201, 241, 254, 27, 2, 254, - 46, 93, 147, 210, 205, 78, 90, 147, 241, 211, 59, 5, 27, 71, 206, - 230, 4, 153, 7, 39, 70, 199, 199, 141, 29, 229, 150, 204, 40, 167, - 69, 159, 171, 196, 122, 97, 31, 94, 119, 156, 79, 70, 85, 220, 238, - 125, 171, 136, 16, 163, 29, 110, 84, 172, 49, 150, 149, 93, 244, 129, - 112, 223, 33, 180, 238, 182, 57, 202, 140, 109, 156, 72, 119, 196, 187, - 110, 70, 192, 215, 21, 131, 125, 118, 157, 222, 142, 120, 49, 209, 114, - 214, 153, 209, 231, 42, 86, 153, 211, 43, 199, 122, 97, 31, 220, 145, - 249, 200, 31, 41, 60, 247, 217, 151, 33, 190, 201, 203, 246, 30, 83, - 158, 218, 223, 126, 107, 10, 255, 147, 71, 199, 3, 79, 90, 148, 22, - 236, 198, 242, 151, 29, 194, 213, 80, 54, 255, 157, 6, 194, 125, 245, - 37, 149, 246, 133, 158, 172, 177, 111, 181, 104, 55, 86, 53, 90, 16, - 124, 225, 114, 151, 224, 117, 69, 218, 10, 231, 203, 177, 99, 71, 197, - 36, 202, 24, 59, 139, 62, 87, 182, 202, 156, 83, 41, 214, 11, 251, - 224, 142, 204, 107, 110, 167, 240, 87, 27, 165, 238, 171, 176, 238, 242, - 222, 125, 250, 239, 195, 202, 111, 76, 225, 183, 79, 238, 22, 254, 145, - 161, 163, 32, 227, 157, 119, 187, 29, 184, 187, 62, 133, 63, 247, 97, - 9, 225, 29, 42, 153, 131, 226, 246, 29, 219, 87, 44, 172, 252, 75, - 179, 204, 119, 213, 33, 25, 218, 235, 189, 130, 55, 221, 231, 5, 29, - 26, 59, 50, 94, 206, 165, 88, 245, 185, 146, 85, 102, 37, 192, 216, - 7, 119, 100, 238, 15, 62, 37, 56, 76, 21, 114, 48, 236, 241, 222, - 223, 110, 253, 18, 58, 1, 252, 244, 142, 159, 223, 13, 27, 115, 116, - 156, 32, 115, 231, 251, 239, 238, 191, 14, 101, 185, 57, 171, 4, 159, - 178, 98, 235, 216, 125, 199, 23, 173, 221, 59, 89, 28, 103, 245, 189, - 78, 25, 151, 135, 254, 180, 93, 105, 200, 10, 16, 244, 57, 58, 49, - 193, 93, 159, 162, 100, 100, 214, 84, 4, 125, 174, 228, 158, 204, 187, - 115, 83, 248, 132, 65, 53, 246, 104, 31, 166, 135, 4, 206, 75, 223, - 127, 237, 80, 10, 95, 126, 90, 192, 129, 49, 19, 2, 4, 95, 221, - 124, 106, 64, 120, 213, 195, 16, 111, 92, 58, 36, 188, 203, 166, 64, - 191, 192, 208, 19, 23, 102, 182, 56, 36, 202, 124, 175, 76, 227, 237, - 11, 78, 126, 26, 212, 237, 214, 150, 237, 212, 167, 200, 201, 77, 101, - 70, 57, 169, 204, 9, 21, 98, 189, 148, 110, 202, 236, 204, 110, 164, - 156, 43, 24, 252, 119, 61, 95, 97, 205, 253, 120, 83, 41, 204, 249, - 239, 138, 115, 219, 241, 190, 232, 158, 141, 219, 127, 234, 153, 20, 72, - 215, 224, 170, 155, 126, 65, 233, 23, 210, 50, 14, 55, 127, 25, 68, - 215, 96, 98, 220, 176, 88, 119, 116, 3, 229, 164, 50, 167, 149, 143, - 245, 194, 62, 184, 35, 243, 47, 176, 6, 189, 27, 71, 182, 240, 235, - 144, 30, 82, 217, 120, 114, 255, 68, 88, 111, 107, 182, 118, 56, 176, - 255, 162, 121, 156, 215, 165, 119, 8, 207, 128, 178, 230, 161, 159, 183, - 16, 124, 76, 90, 163, 208, 0, 159, 223, 247, 208, 113, 78, 232, 241, - 65, 112, 246, 186, 61, 193, 95, 126, 29, 97, 179, 6, 93, 201, 77, - 101, 70, 57, 169, 204, 217, 190, 177, 94, 216, 7, 119, 100, 174, 126, - 39, 133, 95, 31, 172, 15, 125, 191, 251, 223, 33, 247, 87, 100, 135, - 205, 255, 42, 133, 239, 180, 76, 27, 126, 199, 63, 70, 144, 249, 193, - 68, 237, 129, 87, 95, 166, 240, 95, 100, 112, 194, 54, 59, 35, 42, - 37, 244, 227, 208, 151, 251, 62, 16, 215, 160, 255, 239, 253, 130, 139, - 254, 84, 47, 35, 123, 246, 141, 0, 203, 26, 148, 25, 104, 203, 187, - 251, 125, 173, 50, 19, 128, 177, 15, 238, 200, 220, 9, 214, 160, 41, - 116, 102, 200, 210, 220, 59, 45, 166, 14, 185, 29, 218, 3, 214, 219, - 161, 161, 113, 97, 27, 106, 14, 19, 98, 162, 164, 129, 113, 251, 155, - 65, 153, 97, 125, 1, 97, 77, 94, 220, 19, 31, 82, 61, 219, 115, - 223, 5, 113, 156, 107, 141, 168, 17, 172, 25, 210, 44, 40, 186, 207, - 198, 64, 102, 13, 186, 148, 154, 202, 76, 24, 153, 3, 202, 197, 122, - 97, 31, 220, 145, 217, 15, 214, 224, 59, 41, 197, 246, 20, 235, 181, - 109, 239, 136, 187, 25, 251, 103, 27, 193, 246, 229, 4, 31, 232, 182, - 53, 80, 144, 113, 221, 213, 224, 240, 163, 80, 54, 106, 237, 187, 194, - 26, 188, 246, 91, 192, 190, 39, 159, 110, 110, 97, 20, 101, 38, 3, - 74, 52, 234, 240, 105, 169, 224, 62, 41, 5, 236, 215, 160, 164, 220, - 84, 102, 148, 147, 202, 172, 43, 11, 242, 186, 41, 115, 79, 24, 231, - 163, 97, 109, 247, 62, 136, 222, 191, 215, 123, 217, 245, 208, 56, 24, - 211, 201, 159, 13, 14, 27, 180, 53, 84, 144, 217, 56, 111, 240, 254, - 149, 80, 118, 253, 210, 9, 97, 220, 179, 74, 132, 239, 155, 178, 250, - 72, 200, 70, 81, 230, 73, 55, 87, 103, 172, 59, 154, 153, 209, 179, - 72, 197, 12, 235, 62, 197, 181, 114, 88, 246, 131, 101, 173, 50, 167, - 150, 137, 245, 194, 62, 184, 35, 243, 18, 104, 59, 84, 23, 25, 90, - 239, 97, 220, 222, 150, 29, 127, 222, 59, 11, 238, 87, 174, 25, 176, - 111, 226, 186, 91, 130, 61, 206, 205, 237, 31, 154, 4, 253, 242, 159, - 120, 68, 232, 67, 177, 54, 127, 236, 157, 212, 230, 200, 190, 221, 226, - 62, 101, 217, 184, 155, 129, 154, 161, 177, 193, 79, 251, 173, 204, 176, - 238, 83, 220, 147, 25, 229, 180, 236, 7, 75, 199, 122, 9, 99, 237, - 134, 204, 95, 66, 219, 53, 198, 118, 221, 91, 191, 85, 231, 189, 159, - 175, 58, 27, 186, 19, 246, 36, 103, 211, 58, 135, 61, 249, 235, 180, - 32, 51, 191, 164, 243, 254, 29, 80, 86, 242, 240, 247, 194, 56, 151, - 88, 244, 237, 222, 128, 218, 217, 33, 84, 159, 183, 127, 118, 109, 91, - 197, 140, 45, 219, 195, 127, 217, 18, 204, 236, 83, 220, 210, 103, 148, - 115, 58, 115, 46, 128, 125, 112, 71, 230, 72, 216, 167, 44, 79, 56, - 18, 82, 179, 171, 49, 164, 224, 95, 45, 247, 247, 189, 151, 194, 55, - 189, 118, 112, 255, 119, 105, 17, 130, 221, 216, 248, 240, 96, 88, 111, - 40, 43, 94, 43, 66, 24, 231, 238, 207, 194, 67, 181, 25, 109, 246, - 141, 16, 101, 126, 209, 162, 80, 224, 195, 234, 47, 183, 246, 186, 186, - 97, 187, 221, 62, 197, 165, 62, 123, 139, 207, 238, 103, 80, 125, 134, - 61, 55, 246, 129, 230, 22, 96, 62, 1, 205, 45, 192, 247, 202, 96, - 174, 1, 155, 91, 16, 23, 31, 68, 236, 147, 96, 173, 57, 51, 121, - 203, 4, 162, 188, 85, 11, 173, 185, 5, 248, 44, 32, 245, 93, 176, - 191, 141, 29, 115, 102, 2, 210, 31, 43, 132, 11, 234, 115, 123, 130, - 108, 90, 215, 121, 53, 125, 220, 204, 45, 192, 45, 86, 94, 115, 11, - 134, 139, 185, 5, 135, 123, 19, 75, 110, 193, 88, 23, 185, 5, 11, - 180, 154, 140, 97, 191, 52, 48, 60, 122, 220, 66, 67, 191, 155, 26, - 103, 247, 221, 212, 109, 245, 155, 137, 223, 87, 21, 254, 50, 40, 158, - 16, 203, 13, 237, 100, 44, 94, 231, 79, 254, 163, 228, 176, 198, 255, - 137, 239, 166, 202, 231, 124, 57, 230, 204, 232, 85, 16, 187, 194, 165, - 43, 33, 94, 74, 243, 21, 48, 208, 124, 185, 47, 92, 1, 161, 253, - 186, 220, 28, 245, 79, 143, 102, 171, 221, 205, 45, 16, 190, 231, 45, - 234, 4, 103, 151, 115, 128, 114, 73, 230, 197, 74, 228, 7, 176, 121, - 177, 72, 183, 73, 21, 107, 243, 76, 3, 251, 40, 151, 23, 59, 42, - 105, 152, 152, 26, 235, 60, 61, 32, 7, 198, 71, 163, 138, 117, 254, - 189, 81, 149, 181, 47, 56, 142, 52, 47, 22, 105, 254, 39, 242, 98, - 177, 141, 55, 145, 23, 155, 6, 115, 157, 51, 208, 121, 159, 104, 185, - 224, 255, 7, 198, 90, 158, 133, 34, 141, 179, 188, 88, 196, 113, 149, - 23, 27, 151, 48, 58, 122, 112, 242, 216, 232, 100, 24, 91, 103, 143, - 80, 178, 223, 141, 181, 121, 22, 138, 247, 175, 155, 23, 75, 237, 39, - 218, 167, 25, 118, 50, 97, 93, 3, 148, 23, 234, 154, 208, 56, 114, - 128, 185, 109, 107, 236, 156, 56, 122, 172, 19, 77, 203, 169, 111, 238, - 111, 3, 145, 134, 210, 39, 0, 140, 252, 108, 246, 191, 206, 88, 248, - 91, 233, 19, 24, 122, 37, 192, 200, 143, 238, 249, 157, 183, 14, 122, - 86, 194, 74, 175, 100, 232, 211, 251, 195, 88, 193, 189, 249, 156, 67, - 138, 26, 244, 166, 148, 149, 30, 105, 40, 189, 22, 96, 228, 39, 158, - 237, 72, 50, 208, 151, 177, 210, 107, 25, 250, 220, 126, 176, 175, 132, - 123, 241, 60, 75, 146, 62, 173, 156, 149, 30, 105, 40, 125, 42, 192, - 200, 79, 60, 147, 150, 238, 192, 96, 43, 125, 42, 67, 31, 0, 48, - 242, 179, 217, 203, 35, 151, 247, 109, 201, 141, 117, 173, 244, 1, 12, - 125, 118, 223, 88, 175, 84, 134, 94, 74, 7, 52, 126, 204, 252, 247, - 101, 230, 31, 96, 228, 103, 221, 151, 59, 239, 66, 90, 109, 102, 254, - 25, 122, 37, 192, 200, 143, 221, 83, 56, 229, 80, 140, 153, 127, 134, - 62, 253, 29, 24, 59, 184, 103, 247, 170, 206, 232, 245, 53, 153, 249, - 127, 135, 153, 127, 128, 149, 86, 122, 201, 37, 144, 83, 132, 153, 127, - 134, 62, 183, 15, 204, 63, 220, 219, 239, 151, 237, 89, 232, 170, 51, - 243, 223, 135, 153, 127, 128, 181, 182, 244, 78, 101, 48, 22, 98, 230, - 159, 161, 15, 0, 24, 249, 49, 207, 7, 156, 14, 95, 142, 142, 153, - 127, 134, 62, 187, 55, 204, 191, 133, 94, 218, 2, 164, 121, 49, 243, - 223, 155, 153, 127, 128, 145, 31, 115, 214, 239, 92, 1, 170, 48, 243, - 207, 208, 43, 1, 70, 126, 108, 12, 238, 116, 254, 10, 48, 243, 207, - 208, 167, 247, 130, 249, 71, 122, 230, 252, 219, 25, 125, 78, 69, 102, - 254, 123, 49, 243, 15, 176, 210, 74, 47, 169, 129, 58, 15, 102, 254, - 25, 122, 140, 241, 144, 159, 195, 25, 188, 253, 252, 149, 103, 230, 191, - 167, 149, 158, 136, 252, 28, 98, 99, 123, 17, 166, 60, 86, 208, 248, - 23, 99, 94, 26, 255, 226, 187, 204, 48, 30, 182, 139, 127, 37, 223, - 111, 248, 186, 241, 175, 205, 115, 126, 136, 127, 85, 221, 98, 189, 140, - 69, 156, 196, 191, 127, 67, 236, 11, 151, 177, 43, 200, 213, 22, 230, - 182, 219, 219, 248, 247, 223, 20, 255, 234, 96, 62, 116, 221, 98, 189, - 242, 45, 155, 16, 105, 189, 94, 252, 75, 117, 194, 62, 254, 69, 185, - 242, 27, 255, 206, 235, 102, 141, 165, 112, 192, 80, 79, 165, 226, 32, - 212, 81, 186, 14, 141, 93, 242, 30, 7, 33, 13, 165, 215, 1, 140, - 252, 242, 18, 7, 233, 24, 122, 130, 244, 93, 242, 22, 7, 17, 134, - 62, 173, 51, 204, 107, 151, 188, 197, 65, 72, 67, 233, 53, 0, 35, - 191, 188, 196, 65, 26, 134, 62, 39, 42, 214, 11, 249, 229, 37, 14, - 66, 26, 74, 175, 7, 24, 249, 229, 37, 14, 210, 51, 244, 42, 128, - 145, 95, 94, 226, 32, 21, 67, 111, 236, 4, 251, 194, 168, 188, 197, - 65, 72, 99, 153, 127, 128, 145, 95, 94, 226, 32, 29, 67, 79, 0, - 70, 126, 121, 137, 131, 8, 67, 159, 214, 17, 230, 191, 83, 222, 226, - 32, 164, 177, 204, 63, 192, 164, 83, 222, 226, 32, 13, 67, 159, 211, - 1, 230, 191, 99, 222, 226, 32, 164, 177, 204, 63, 192, 154, 142, 121, - 139, 131, 244, 12, 189, 10, 96, 228, 151, 151, 56, 72, 197, 208, 27, - 219, 195, 252, 119, 200, 91, 28, 132, 52, 150, 249, 7, 24, 249, 229, - 37, 14, 210, 49, 244, 4, 96, 228, 151, 151, 56, 136, 48, 244, 105, - 237, 96, 254, 219, 231, 45, 14, 66, 26, 203, 252, 3, 76, 218, 231, - 45, 14, 210, 48, 244, 232, 235, 145, 95, 94, 226, 32, 164, 97, 227, - 32, 77, 187, 188, 197, 65, 24, 251, 52, 101, 232, 49, 46, 178, 198, - 65, 248, 107, 114, 142, 195, 159, 223, 239, 193, 59, 251, 83, 181, 200, - 219, 59, 234, 126, 241, 244, 62, 232, 234, 123, 240, 111, 250, 93, 150, - 246, 223, 243, 148, 251, 30, 60, 202, 18, 212, 182, 136, 230, 175, 166, - 211, 223, 208, 247, 224, 243, 247, 247, 127, 237, 187, 159, 81, 173, 9, - 193, 135, 221, 248, 110, 195, 32, 106, 191, 236, 222, 165, 16, 213, 154, - 126, 119, 185, 185, 211, 177, 208, 61, 122, 252, 198, 95, 49, 203, 17, - 87, 207, 106, 217, 252, 62, 79, 27, 92, 218, 31, 236, 3, 237, 15, - 126, 31, 154, 125, 119, 163, 165, 63, 129, 1, 78, 219, 204, 126, 232, - 186, 63, 250, 174, 102, 94, 170, 8, 176, 51, 17, 174, 215, 155, 39, - 177, 126, 15, 97, 95, 84, 77, 152, 13, 77, 227, 74, 61, 95, 6, - 31, 0, 56, 62, 120, 142, 218, 177, 63, 156, 67, 124, 40, 124, 39, - 3, 218, 105, 36, 242, 219, 31, 245, 133, 38, 1, 104, 145, 143, 240, - 172, 58, 69, 97, 194, 178, 216, 224, 57, 89, 108, 25, 124, 236, 24, - 234, 80, 166, 111, 156, 108, 71, 75, 191, 251, 130, 253, 170, 103, 25, - 7, 15, 136, 102, 57, 8, 251, 77, 130, 12, 237, 196, 254, 54, 176, - 153, 27, 103, 239, 168, 53, 207, 145, 233, 229, 203, 151, 166, 165, 75, - 151, 10, 215, 139, 23, 47, 164, 102, 149, 206, 23, 206, 17, 157, 47, - 252, 254, 47, 171, 131, 214, 249, 146, 120, 79, 190, 204, 124, 25, 121, - 51, 175, 4, 53, 248, 37, 141, 235, 249, 242, 102, 230, 76, 228, 46, - 228, 33, 55, 153, 222, 80, 115, 232, 204, 57, 181, 156, 254, 89, 158, - 39, 106, 204, 243, 133, 252, 112, 174, 19, 132, 185, 22, 115, 11, 82, - 136, 9, 203, 112, 190, 236, 202, 140, 67, 237, 202, 246, 66, 89, 178, - 29, 109, 240, 244, 134, 198, 227, 130, 44, 214, 50, 144, 207, 184, 231, - 204, 185, 44, 187, 50, 205, 126, 39, 101, 135, 236, 104, 233, 89, 47, - 142, 83, 61, 139, 141, 226, 72, 65, 130, 63, 109, 208, 83, 200, 179, - 45, 0, 119, 8, 43, 64, 47, 60, 225, 14, 97, 220, 117, 121, 17, - 79, 1, 22, 190, 215, 195, 153, 199, 184, 129, 141, 157, 115, 161, 35, - 41, 41, 41, 236, 229, 218, 27, 230, 157, 15, 247, 47, 231, 67, 117, - 31, 245, 221, 98, 123, 193, 127, 179, 239, 111, 176, 232, 190, 196, 247, - 238, 211, 31, 72, 235, 190, 6, 248, 42, 67, 204, 188, 210, 51, 75, - 122, 212, 33, 81, 46, 117, 191, 43, 49, 255, 96, 169, 147, 254, 182, - 52, 95, 246, 186, 79, 159, 117, 152, 203, 45, 207, 97, 194, 173, 123, - 234, 180, 2, 230, 103, 22, 61, 10, 226, 175, 80, 71, 9, 107, 162, - 171, 184, 44, 217, 239, 204, 163, 30, 154, 203, 136, 179, 50, 98, 87, - 70, 28, 241, 244, 70, 137, 50, 59, 90, 163, 51, 126, 248, 142, 166, - 198, 78, 240, 236, 101, 57, 200, 57, 148, 9, 120, 45, 29, 249, 25, - 53, 142, 101, 44, 158, 130, 182, 235, 76, 230, 150, 142, 109, 24, 157, - 180, 235, 48, 126, 196, 121, 153, 209, 201, 152, 26, 157, 180, 235, 116, - 62, 90, 58, 226, 57, 200, 162, 177, 47, 227, 204, 188, 236, 199, 165, - 165, 253, 24, 112, 102, 58, 39, 120, 206, 218, 112, 24, 43, 137, 50, - 135, 254, 74, 148, 57, 140, 115, 99, 39, 178, 56, 105, 67, 160, 117, - 210, 174, 109, 25, 252, 241, 142, 122, 37, 240, 215, 56, 41, 35, 142, - 101, 122, 39, 99, 224, 172, 93, 7, 221, 213, 176, 186, 207, 200, 119, - 208, 201, 56, 27, 157, 204, 165, 209, 137, 124, 7, 109, 117, 215, 232, - 132, 159, 94, 162, 93, 7, 126, 18, 101, 14, 242, 101, 74, 224, 57, - 41, 115, 218, 95, 103, 253, 112, 82, 166, 119, 50, 6, 196, 73, 153, - 62, 195, 201, 250, 176, 111, 215, 104, 50, 165, 24, 157, 172, 203, 12, - 39, 54, 204, 232, 100, 237, 27, 157, 216, 23, 39, 101, 246, 50, 147, - 131, 78, 218, 61, 248, 202, 100, 50, 56, 177, 37, 70, 39, 246, 202, - 89, 187, 7, 157, 216, 48, 59, 61, 208, 59, 195, 35, 206, 203, 28, - 100, 118, 38, 139, 51, 126, 78, 250, 171, 119, 160, 69, 63, 131, 65, - 9, 250, 188, 122, 150, 133, 82, 90, 136, 208, 148, 226, 243, 134, 2, - 16, 193, 208, 223, 198, 196, 39, 244, 74, 209, 135, 41, 136, 249, 21, - 125, 158, 16, 177, 21, 20, 226, 27, 164, 84, 194, 157, 57, 217, 220, - 155, 20, 130, 88, 7, 99, 160, 106, 112, 21, 133, 59, 111, 1, 46, - 76, 124, 72, 17, 82, 28, 224, 96, 248, 191, 8, 212, 40, 133, 242, - 98, 80, 83, 156, 148, 5, 184, 4, 252, 143, 245, 165, 197, 35, 244, - 18, 164, 36, 41, 37, 192, 126, 164, 12, 64, 37, 5, 28, 252, 30, - 95, 41, 1, 31, 191, 215, 91, 12, 160, 82, 66, 121, 5, 226, 11, - 126, 182, 156, 0, 151, 3, 168, 50, 169, 36, 224, 148, 135, 154, 114, - 164, 34, 192, 203, 225, 255, 114, 80, 90, 7, 224, 57, 128, 81, 21, - 90, 175, 44, 224, 248, 18, 21, 220, 85, 17, 104, 171, 66, 59, 37, - 4, 217, 33, 198, 128, 150, 75, 66, 137, 82, 40, 41, 1, 253, 175, - 46, 148, 87, 7, 136, 39, 53, 5, 184, 50, 212, 84, 39, 53, 4, - 184, 6, 64, 53, 73, 61, 1, 174, 69, 234, 146, 48, 82, 91, 104, - 171, 14, 180, 90, 23, 74, 16, 174, 11, 88, 245, 160, 6, 113, 42, - 1, 117, 13, 40, 65, 184, 62, 9, 36, 65, 196, 95, 128, 253, 1, - 106, 64, 2, 0, 142, 36, 33, 80, 227, 79, 26, 10, 180, 13, 1, - 10, 32, 141, 0, 62, 13, 24, 193, 164, 49, 96, 33, 78, 32, 105, - 6, 119, 65, 2, 109, 48, 105, 66, 58, 66, 13, 150, 55, 35, 157, - 224, 46, 88, 40, 175, 73, 112, 139, 219, 84, 128, 155, 2, 212, 9, - 106, 17, 174, 7, 53, 77, 73, 115, 1, 110, 14, 80, 51, 224, 134, - 112, 11, 18, 10, 45, 135, 8, 237, 214, 6, 121, 67, 161, 4, 225, - 80, 192, 10, 132, 26, 196, 9, 3, 234, 230, 80, 162, 20, 206, 244, - 11, 128, 129, 8, 23, 224, 112, 128, 212, 164, 139, 0, 243, 80, 19, - 14, 237, 41, 5, 61, 11, 135, 210, 78, 2, 220, 146, 68, 144, 86, - 128, 165, 20, 178, 114, 10, 194, 93, 75, 1, 142, 32, 173, 65, 242, - 86, 130, 110, 96, 92, 221, 26, 74, 16, 110, 5, 165, 109, 73, 27, - 1, 110, 3, 80, 123, 210, 14, 224, 161, 192, 161, 21, 220, 107, 5, - 90, 45, 64, 237, 72, 7, 161, 239, 77, 72, 20, 233, 12, 35, 129, - 112, 39, 104, 53, 10, 74, 16, 39, 10, 176, 58, 64, 13, 150, 119, - 1, 106, 45, 148, 40, 197, 152, 12, 38, 91, 136, 255, 26, 176, 206, - 195, 85, 252, 58, 97, 194, 4, 83, 100, 100, 164, 240, 121, 246, 236, - 89, 172, 249, 39, 133, 216, 127, 233, 66, 158, 79, 76, 76, 140, 41, - 36, 36, 196, 212, 186, 117, 107, 211, 196, 137, 19, 205, 124, 184, 188, - 243, 65, 122, 228, 131, 252, 242, 195, 231, 201, 147, 39, 216, 31, 225, - 83, 252, 141, 226, 215, 234, 23, 142, 75, 131, 6, 13, 76, 205, 154, - 53, 51, 45, 88, 176, 224, 181, 249, 168, 84, 42, 147, 183, 183, 183, - 169, 116, 233, 210, 216, 191, 215, 238, 23, 210, 163, 13, 196, 171, 66, - 133, 10, 175, 205, 167, 84, 169, 82, 22, 62, 208, 191, 215, 238, 23, - 229, 33, 94, 111, 132, 15, 140, 211, 107, 247, 235, 77, 241, 161, 227, - 131, 159, 176, 62, 164, 251, 101, 75, 103, 207, 87, 208, 31, 208, 27, - 65, 127, 222, 196, 56, 227, 252, 187, 156, 119, 25, 121, 80, 15, 113, - 125, 33, 159, 55, 49, 206, 56, 62, 111, 162, 95, 226, 120, 231, 139, - 15, 174, 47, 113, 157, 189, 17, 253, 177, 200, 227, 241, 223, 235, 151, - 56, 190, 212, 78, 191, 17, 253, 201, 207, 248, 136, 250, 71, 237, 116, - 190, 198, 89, 161, 80, 228, 123, 93, 208, 245, 37, 218, 251, 124, 249, - 47, 240, 55, 166, 201, 147, 39, 231, 203, 239, 208, 245, 37, 250, 195, - 215, 230, 35, 250, 99, 161, 95, 249, 241, 59, 162, 125, 23, 198, 25, - 198, 59, 223, 235, 75, 244, 63, 249, 210, 31, 26, 39, 228, 215, 127, - 209, 184, 37, 63, 250, 67, 249, 188, 41, 251, 99, 99, 55, 184, 255, - 46, 159, 55, 225, 151, 169, 253, 201, 47, 159, 55, 229, 119, 168, 253, - 201, 239, 248, 188, 41, 191, 44, 198, 151, 111, 204, 254, 228, 215, 174, - 138, 241, 247, 27, 179, 63, 111, 194, 239, 160, 254, 188, 137, 245, 133, - 243, 254, 166, 236, 79, 126, 227, 4, 113, 63, 144, 111, 251, 35, 218, - 247, 55, 182, 255, 18, 215, 217, 107, 247, 75, 244, 127, 111, 108, 255, - 37, 174, 179, 124, 239, 191, 100, 227, 112, 55, 214, 5, 213, 159, 55, - 181, 255, 202, 175, 254, 96, 252, 147, 223, 253, 23, 187, 143, 123, 83, - 251, 175, 252, 172, 47, 186, 207, 125, 83, 251, 175, 252, 246, 75, 180, - 239, 52, 222, 204, 151, 254, 80, 255, 149, 159, 184, 69, 244, 127, 111, - 196, 127, 209, 184, 197, 133, 254, 88, 114, 36, 90, 88, 159, 59, 226, - 247, 7, 217, 247, 110, 71, 181, 142, 138, 73, 138, 149, 206, 203, 200, - 249, 197, 245, 51, 119, 93, 19, 51, 175, 101, 71, 58, 121, 213, 209, - 118, 116, 249, 220, 177, 59, 92, 29, 173, 188, 51, 105, 249, 181, 19, - 69, 53, 213, 43, 239, 116, 235, 153, 251, 251, 248, 124, 17, 218, 105, - 36, 242, 67, 90, 205, 212, 245, 251, 216, 243, 225, 156, 19, 47, 121, - 219, 50, 133, 80, 182, 106, 193, 193, 3, 44, 94, 141, 225, 94, 26, - 103, 101, 187, 38, 36, 218, 60, 75, 159, 100, 80, 104, 126, 109, 52, - 221, 166, 236, 200, 194, 231, 252, 143, 237, 102, 219, 148, 133, 237, 185, - 202, 55, 175, 218, 202, 166, 44, 107, 211, 69, 158, 52, 158, 185, 151, - 45, 91, 181, 224, 42, 31, 52, 83, 99, 243, 108, 254, 167, 107, 79, - 249, 139, 237, 102, 219, 148, 45, 123, 228, 169, 57, 154, 243, 190, 77, - 217, 241, 28, 31, 77, 226, 143, 237, 212, 108, 223, 176, 236, 157, 191, - 150, 218, 224, 53, 232, 234, 169, 41, 122, 118, 171, 77, 89, 114, 205, - 103, 188, 121, 156, 173, 180, 127, 7, 254, 200, 247, 11, 155, 106, 131, - 215, 255, 131, 147, 40, 179, 205, 152, 78, 123, 112, 17, 250, 102, 59, - 6, 169, 7, 159, 34, 63, 155, 178, 206, 241, 5, 52, 41, 239, 108, - 205, 98, 219, 192, 57, 58, 244, 116, 153, 13, 94, 205, 225, 94, 198, - 46, 241, 219, 108, 218, 189, 126, 162, 168, 93, 153, 130, 150, 217, 208, - 174, 59, 252, 155, 193, 182, 76, 33, 148, 141, 92, 55, 221, 161, 13, - 251, 178, 242, 171, 126, 53, 216, 63, 131, 171, 150, 253, 189, 161, 92, - 151, 41, 54, 120, 43, 34, 210, 13, 246, 125, 251, 227, 229, 60, 67, - 192, 31, 147, 237, 240, 244, 14, 252, 230, 214, 254, 200, 16, 229, 167, - 87, 219, 62, 199, 16, 248, 217, 148, 93, 94, 252, 189, 97, 251, 47, - 41, 54, 101, 187, 38, 124, 239, 192, 111, 234, 250, 227, 134, 160, 239, - 91, 58, 240, 179, 215, 151, 254, 97, 75, 29, 240, 94, 196, 124, 228, - 192, 15, 241, 186, 196, 183, 204, 178, 231, 103, 175, 207, 216, 174, 214, - 14, 175, 207, 154, 178, 134, 170, 211, 51, 108, 117, 119, 113, 29, 187, - 50, 5, 140, 105, 178, 193, 126, 222, 254, 57, 213, 215, 97, 222, 194, - 70, 70, 26, 110, 167, 151, 176, 193, 155, 241, 224, 126, 150, 125, 153, - 247, 138, 67, 89, 246, 180, 233, 31, 207, 207, 178, 111, 3, 172, 157, - 33, 226, 94, 7, 27, 249, 206, 69, 123, 24, 82, 147, 251, 216, 172, - 243, 119, 63, 8, 113, 40, 211, 251, 116, 118, 224, 167, 153, 253, 81, - 184, 125, 89, 218, 184, 205, 234, 176, 61, 99, 109, 202, 98, 15, 252, - 170, 182, 31, 231, 221, 19, 182, 171, 87, 68, 36, 216, 200, 162, 79, - 156, 27, 110, 175, 247, 98, 187, 54, 101, 26, 191, 236, 3, 35, 214, - 77, 183, 157, 243, 142, 61, 194, 237, 203, 180, 126, 115, 212, 197, 42, - 182, 176, 41, 203, 105, 244, 181, 131, 44, 217, 147, 22, 168, 67, 70, - 214, 176, 29, 171, 138, 113, 225, 246, 235, 3, 219, 181, 47, 83, 86, - 172, 203, 219, 203, 231, 187, 170, 56, 111, 191, 86, 197, 50, 103, 180, - 54, 243, 118, 164, 205, 94, 71, 126, 93, 182, 56, 242, 131, 50, 207, - 21, 17, 182, 54, 118, 228, 16, 7, 218, 78, 126, 90, 7, 90, 177, - 204, 134, 246, 75, 101, 172, 131, 44, 88, 118, 114, 18, 111, 59, 31, - 239, 108, 117, 160, 21, 101, 206, 178, 127, 14, 57, 195, 195, 236, 3, - 235, 137, 190, 205, 151, 148, 37, 229, 8, 17, 158, 237, 248, 146, 138, - 112, 71, 132, 103, 62, 190, 164, 2, 220, 81, 24, 159, 234, 17, 225, - 89, 98, 117, 82, 11, 74, 136, 240, 60, 167, 22, 241, 19, 225, 106, - 194, 147, 184, 90, 34, 92, 27, 202, 107, 137, 56, 181, 133, 167, 122, - 230, 242, 74, 128, 83, 93, 44, 175, 68, 106, 8, 111, 9, 198, 242, - 58, 128, 83, 91, 44, 199, 39, 116, 149, 44, 112, 125, 82, 67, 196, - 169, 11, 56, 117, 196, 242, 186, 164, 42, 220, 153, 203, 235, 1, 92, - 215, 130, 95, 15, 40, 104, 57, 62, 113, 52, 195, 85, 224, 174, 178, - 136, 227, 79, 26, 144, 134, 98, 127, 253, 133, 39, 122, 230, 56, 164, - 49, 244, 173, 129, 136, 239, 79, 154, 146, 198, 34, 220, 68, 120, 238, - 71, 105, 3, 72, 83, 17, 63, 0, 106, 154, 138, 56, 1, 36, 144, - 52, 17, 224, 18, 0, 5, 139, 48, 62, 87, 108, 36, 188, 99, 92, - 41, 60, 45, 12, 38, 129, 2, 220, 147, 52, 35, 106, 18, 46, 242, - 84, 147, 48, 17, 174, 6, 48, 79, 194, 68, 62, 60, 9, 21, 225, - 106, 128, 143, 120, 102, 88, 3, 229, 188, 72, 171, 33, 33, 36, 84, - 44, 111, 9, 176, 70, 44, 143, 0, 184, 165, 5, 110, 65, 66, 68, - 156, 86, 0, 71, 136, 229, 173, 72, 115, 210, 194, 194, 31, 159, 246, - 81, 184, 57, 220, 153, 101, 104, 75, 90, 147, 54, 226, 88, 181, 37, - 237, 224, 206, 220, 151, 206, 164, 19, 137, 18, 203, 59, 19, 45, 233, - 36, 246, 87, 11, 26, 213, 73, 228, 211, 145, 180, 39, 29, 68, 156, - 142, 164, 27, 220, 153, 203, 59, 147, 46, 68, 43, 242, 233, 10, 53, - 90, 81, 158, 174, 128, 211, 81, 108, 87, 73, 138, 9, 239, 226, 68, - 90, 124, 166, 93, 76, 164, 85, 146, 194, 112, 103, 110, 171, 176, 240, - 76, 219, 140, 95, 132, 248, 136, 48, 62, 123, 45, 36, 188, 155, 84, - 41, 60, 65, 46, 36, 224, 34, 255, 18, 194, 147, 114, 90, 238, 37, - 228, 63, 34, 92, 18, 224, 18, 34, 142, 66, 140, 245, 148, 164, 160, - 144, 67, 168, 16, 96, 79, 82, 134, 152, 191, 201, 165, 20, 158, 212, - 151, 17, 225, 72, 160, 45, 40, 188, 41, 21, 249, 20, 128, 114, 79, - 177, 188, 20, 148, 151, 20, 225, 130, 80, 94, 192, 82, 94, 70, 248, - 166, 186, 82, 120, 166, 94, 90, 224, 139, 50, 227, 186, 244, 45, 99, - 142, 73, 27, 136, 235, 210, 241, 185, 136, 109, 153, 201, 238, 143, 198, - 230, 210, 57, 138, 121, 227, 195, 189, 229, 243, 150, 207, 91, 62, 111, - 249, 188, 229, 243, 150, 207, 91, 62, 111, 249, 188, 229, 243, 150, 207, - 91, 62, 111, 249, 188, 229, 243, 150, 207, 91, 62, 111, 249, 188, 229, - 243, 191, 132, 143, 212, 111, 245, 254, 111, 231, 243, 118, 222, 255, 127, - 228, 67, 115, 4, 48, 47, 128, 230, 8, 224, 59, 214, 48, 103, 64, - 151, 104, 126, 182, 31, 213, 26, 223, 239, 70, 95, 111, 220, 204, 33, - 71, 64, 229, 226, 187, 201, 1, 192, 183, 78, 128, 143, 240, 138, 84, - 227, 192, 142, 94, 198, 7, 237, 189, 234, 144, 158, 146, 121, 2, 103, - 224, 10, 225, 204, 188, 151, 181, 141, 48, 36, 92, 95, 139, 121, 1, - 153, 138, 196, 233, 154, 187, 15, 234, 105, 140, 123, 207, 56, 228, 8, - 40, 152, 94, 89, 126, 67, 182, 177, 245, 187, 201, 57, 30, 226, 251, - 84, 149, 32, 3, 180, 223, 72, 108, 167, 195, 198, 233, 134, 221, 101, - 234, 24, 106, 142, 86, 242, 234, 39, 222, 207, 151, 167, 16, 211, 207, - 156, 191, 161, 107, 169, 97, 134, 209, 85, 7, 240, 225, 5, 54, 94, - 214, 78, 34, 166, 105, 191, 63, 10, 63, 60, 38, 214, 80, 3, 240, - 30, 112, 3, 158, 223, 76, 81, 152, 254, 60, 119, 196, 208, 254, 244, - 117, 67, 187, 216, 123, 234, 121, 109, 21, 75, 86, 62, 35, 166, 91, - 23, 46, 27, 102, 241, 223, 26, 10, 247, 111, 200, 39, 60, 46, 253, - 119, 206, 20, 98, 154, 161, 254, 219, 176, 40, 108, 167, 128, 55, 251, - 73, 175, 103, 75, 128, 246, 94, 124, 5, 227, 173, 141, 255, 24, 102, - 76, 250, 65, 93, 61, 55, 253, 21, 129, 118, 75, 173, 43, 101, 252, - 114, 122, 33, 227, 135, 35, 235, 242, 145, 59, 159, 13, 91, 82, 132, - 152, 234, 61, 44, 102, 60, 221, 95, 105, 68, 188, 201, 161, 91, 230, - 47, 121, 69, 76, 85, 207, 55, 53, 206, 158, 90, 194, 168, 91, 90, - 153, 247, 206, 217, 60, 190, 153, 74, 97, 106, 24, 94, 213, 24, 31, - 84, 194, 120, 123, 108, 16, 223, 161, 114, 244, 7, 87, 47, 17, 83, - 185, 254, 213, 141, 199, 122, 61, 51, 196, 71, 29, 81, 255, 241, 115, - 183, 247, 198, 189, 32, 166, 217, 217, 26, 129, 54, 197, 84, 67, 125, - 238, 215, 244, 73, 231, 255, 84, 88, 218, 189, 153, 89, 87, 29, 220, - 186, 248, 226, 185, 62, 214, 126, 140, 250, 106, 166, 250, 158, 199, 55, - 164, 164, 158, 152, 126, 129, 113, 209, 194, 184, 244, 215, 44, 83, 207, - 47, 84, 236, 214, 231, 211, 136, 165, 221, 230, 11, 23, 133, 143, 185, - 243, 193, 248, 117, 23, 21, 166, 1, 91, 226, 13, 207, 135, 151, 50, - 206, 219, 145, 193, 55, 189, 186, 117, 124, 55, 63, 133, 73, 85, 239, - 70, 86, 169, 65, 127, 24, 106, 173, 89, 192, 95, 120, 53, 75, 249, - 199, 20, 133, 233, 157, 6, 93, 213, 149, 55, 191, 52, 248, 70, 207, - 230, 163, 148, 127, 78, 233, 175, 32, 166, 202, 123, 86, 242, 61, 111, - 221, 53, 204, 239, 59, 154, 31, 86, 170, 208, 227, 170, 48, 126, 126, - 223, 127, 206, 127, 80, 253, 39, 3, 231, 49, 134, 15, 46, 193, 229, - 126, 63, 153, 152, 38, 141, 249, 73, 29, 215, 53, 35, 107, 157, 223, - 42, 190, 65, 241, 90, 127, 158, 159, 172, 48, 205, 76, 175, 148, 85, - 201, 191, 180, 177, 94, 253, 61, 124, 56, 41, 54, 239, 228, 9, 133, - 233, 175, 42, 105, 106, 44, 219, 123, 55, 133, 47, 224, 179, 87, 191, - 255, 41, 49, 69, 102, 252, 200, 79, 25, 95, 214, 184, 179, 121, 123, - 126, 72, 248, 226, 212, 95, 238, 43, 76, 21, 14, 63, 231, 3, 215, - 43, 132, 178, 145, 222, 15, 114, 207, 129, 124, 91, 23, 255, 196, 79, - 168, 30, 97, 184, 117, 62, 133, 255, 165, 200, 236, 63, 195, 65, 150, - 176, 167, 243, 213, 63, 21, 169, 199, 123, 167, 110, 231, 15, 150, 56, - 153, 123, 17, 218, 93, 61, 244, 10, 255, 207, 186, 245, 89, 229, 160, - 31, 83, 189, 130, 254, 250, 10, 240, 252, 85, 31, 242, 77, 46, 174, - 225, 251, 244, 220, 196, 15, 171, 181, 162, 224, 31, 19, 137, 233, 82, - 216, 51, 126, 205, 79, 83, 248, 169, 189, 151, 241, 171, 154, 15, 233, - 61, 186, 131, 194, 20, 30, 179, 90, 125, 243, 153, 143, 81, 55, 99, - 61, 223, 250, 217, 168, 247, 134, 249, 17, 211, 177, 31, 15, 243, 117, - 39, 251, 24, 145, 159, 230, 214, 236, 232, 37, 233, 196, 148, 116, 225, - 59, 254, 220, 225, 39, 134, 87, 218, 15, 248, 93, 53, 54, 223, 49, - 76, 32, 166, 86, 157, 55, 240, 43, 119, 55, 50, 68, 116, 201, 228, - 163, 203, 85, 186, 249, 23, 232, 233, 211, 144, 84, 222, 72, 78, 134, - 125, 165, 63, 193, 231, 60, 27, 124, 181, 193, 251, 196, 116, 254, 199, - 157, 252, 198, 35, 65, 134, 47, 238, 204, 228, 239, 87, 223, 92, 239, - 219, 121, 196, 212, 125, 210, 167, 252, 238, 161, 235, 213, 158, 119, 143, - 242, 47, 94, 252, 94, 240, 40, 62, 215, 175, 252, 55, 223, 174, 228, - 169, 3, 89, 176, 190, 30, 20, 41, 255, 240, 42, 140, 193, 142, 163, - 87, 120, 255, 250, 233, 134, 6, 7, 134, 243, 247, 254, 220, 118, 101, - 238, 68, 51, 237, 94, 160, 93, 191, 184, 35, 191, 224, 236, 136, 178, - 229, 230, 153, 219, 189, 10, 237, 246, 25, 217, 134, 175, 127, 243, 7, - 238, 231, 105, 102, 249, 86, 128, 124, 103, 230, 132, 242, 59, 95, 164, - 120, 181, 214, 91, 251, 177, 119, 84, 5, 126, 87, 161, 93, 5, 63, - 210, 91, 251, 59, 103, 163, 47, 223, 254, 69, 165, 30, 177, 58, 24, - 103, 113, 92, 254, 172, 25, 197, 207, 243, 153, 59, 173, 96, 89, 98, - 154, 35, 206, 111, 242, 199, 60, 95, 170, 112, 165, 121, 67, 154, 40, - 76, 23, 135, 204, 16, 116, 237, 72, 217, 113, 188, 239, 149, 51, 19, - 180, 127, 40, 76, 81, 220, 71, 198, 73, 171, 187, 25, 134, 213, 237, - 208, 120, 208, 201, 99, 115, 241, 81, 109, 159, 3, 223, 26, 230, 15, - 255, 152, 111, 182, 45, 84, 29, 243, 234, 94, 85, 229, 12, 98, 186, - 204, 253, 144, 53, 126, 110, 45, 205, 182, 244, 202, 124, 173, 87, 183, - 91, 205, 90, 72, 76, 189, 7, 220, 205, 122, 39, 129, 215, 212, 78, - 155, 192, 239, 250, 235, 218, 128, 185, 95, 41, 76, 29, 58, 22, 54, - 46, 184, 81, 86, 19, 152, 51, 144, 79, 184, 249, 115, 212, 131, 213, - 196, 116, 113, 97, 35, 227, 205, 140, 177, 252, 135, 165, 14, 170, 253, - 188, 13, 229, 43, 131, 78, 86, 107, 81, 193, 184, 239, 230, 112, 94, - 147, 229, 167, 110, 121, 34, 240, 102, 242, 2, 98, 90, 49, 166, 149, - 113, 218, 218, 52, 126, 147, 166, 126, 227, 162, 30, 253, 174, 205, 154, - 78, 76, 235, 199, 61, 51, 140, 223, 245, 55, 255, 217, 129, 106, 234, - 34, 79, 155, 54, 59, 48, 79, 97, 218, 149, 18, 105, 248, 231, 85, - 3, 141, 102, 67, 5, 222, 244, 244, 188, 246, 239, 85, 196, 244, 235, - 165, 9, 70, 227, 190, 247, 249, 210, 215, 10, 241, 223, 158, 253, 89, - 91, 183, 151, 194, 52, 240, 183, 84, 227, 167, 75, 170, 102, 197, 53, - 201, 80, 87, 221, 245, 135, 103, 197, 56, 98, 250, 99, 238, 44, 99, - 175, 182, 93, 13, 151, 126, 251, 73, 221, 240, 116, 120, 243, 53, 67, - 21, 166, 232, 238, 195, 141, 187, 103, 86, 51, 212, 10, 216, 170, 158, - 123, 157, 203, 104, 50, 136, 152, 174, 169, 206, 25, 98, 215, 220, 53, - 240, 71, 9, 63, 227, 105, 207, 45, 189, 160, 172, 224, 163, 43, 89, - 39, 238, 237, 53, 84, 250, 214, 139, 191, 204, 169, 183, 182, 27, 76, - 76, 95, 20, 219, 160, 238, 188, 112, 131, 161, 67, 216, 123, 252, 189, - 95, 14, 236, 234, 57, 132, 152, 122, 53, 40, 173, 217, 186, 231, 47, - 67, 129, 152, 72, 62, 160, 82, 139, 207, 174, 118, 6, 29, 63, 219, - 65, 115, 209, 235, 99, 195, 247, 191, 38, 243, 103, 251, 94, 57, 215, - 188, 139, 194, 164, 245, 111, 165, 249, 167, 243, 44, 245, 63, 239, 69, - 242, 127, 13, 234, 18, 124, 95, 77, 76, 241, 254, 158, 198, 65, 39, - 215, 170, 251, 93, 94, 174, 142, 244, 218, 217, 38, 97, 56, 49, 141, - 187, 178, 216, 208, 185, 73, 81, 62, 173, 104, 49, 254, 175, 156, 175, - 155, 252, 51, 26, 198, 111, 203, 111, 89, 131, 122, 127, 198, 171, 166, - 151, 226, 199, 95, 240, 141, 24, 29, 67, 76, 103, 134, 22, 208, 156, - 57, 52, 149, 111, 177, 216, 135, 175, 173, 25, 217, 219, 212, 138, 152, - 116, 223, 133, 240, 37, 55, 110, 230, 91, 13, 232, 205, 235, 185, 101, - 81, 199, 1, 47, 179, 96, 117, 227, 209, 131, 151, 213, 159, 156, 248, - 71, 61, 191, 225, 229, 218, 199, 18, 136, 233, 235, 29, 61, 141, 83, - 127, 190, 175, 222, 186, 172, 58, 191, 225, 69, 159, 234, 79, 97, 125, - 24, 150, 119, 52, 250, 110, 218, 125, 96, 85, 223, 65, 252, 242, 23, - 237, 31, 47, 2, 91, 124, 247, 115, 63, 227, 205, 150, 17, 134, 67, - 195, 159, 168, 67, 174, 15, 248, 173, 24, 224, 45, 57, 86, 210, 56, - 38, 100, 16, 159, 102, 122, 21, 124, 179, 243, 201, 33, 132, 40, 76, - 133, 115, 139, 241, 219, 58, 84, 54, 28, 120, 178, 156, 127, 244, 98, - 225, 171, 7, 64, 27, 116, 244, 104, 214, 77, 159, 62, 134, 196, 164, - 0, 222, 227, 228, 38, 226, 147, 76, 76, 169, 93, 27, 241, 165, 135, - 29, 82, 151, 58, 59, 147, 127, 247, 229, 156, 82, 19, 192, 30, 36, - 214, 249, 52, 235, 121, 250, 65, 53, 246, 173, 242, 181, 237, 222, 181, - 97, 93, 214, 105, 241, 53, 191, 224, 231, 139, 134, 18, 47, 218, 243, - 199, 239, 87, 202, 232, 9, 253, 184, 54, 56, 198, 48, 216, 56, 67, - 240, 71, 37, 189, 35, 142, 222, 31, 67, 76, 105, 223, 4, 25, 98, - 75, 149, 53, 220, 30, 58, 67, 125, 84, 83, 46, 247, 208, 39, 196, - 244, 153, 88, 86, 199, 103, 24, 191, 161, 228, 222, 194, 13, 160, 141, - 89, 97, 51, 14, 236, 228, 19, 179, 208, 71, 29, 242, 212, 151, 138, - 131, 245, 187, 88, 57, 208, 48, 161, 77, 143, 3, 177, 153, 69, 248, - 197, 47, 61, 42, 150, 5, 61, 173, 85, 225, 67, 67, 165, 86, 213, - 12, 131, 170, 39, 241, 127, 148, 53, 229, 122, 65, 217, 203, 27, 95, - 25, 50, 79, 206, 54, 140, 159, 90, 146, 255, 161, 232, 185, 203, 219, - 97, 157, 55, 241, 87, 26, 191, 155, 58, 255, 192, 200, 9, 185, 234, - 65, 164, 155, 223, 226, 247, 136, 169, 118, 165, 127, 12, 7, 251, 111, - 53, 204, 45, 26, 198, 183, 63, 231, 113, 112, 242, 80, 98, 242, 233, - 252, 139, 193, 247, 66, 57, 195, 170, 228, 100, 62, 226, 207, 31, 61, - 50, 160, 221, 171, 233, 91, 13, 13, 11, 21, 86, 183, 225, 130, 248, - 211, 207, 118, 6, 158, 31, 75, 76, 47, 238, 4, 26, 7, 175, 52, - 24, 180, 101, 62, 82, 119, 202, 30, 191, 143, 68, 19, 211, 189, 43, - 77, 140, 223, 116, 59, 103, 80, 15, 215, 102, 100, 28, 152, 241, 9, - 142, 115, 135, 139, 75, 248, 230, 93, 11, 24, 111, 220, 110, 180, 195, - 227, 215, 158, 51, 176, 236, 179, 211, 227, 140, 125, 219, 181, 49, 116, - 44, 52, 59, 120, 224, 141, 130, 248, 179, 18, 166, 247, 215, 95, 52, - 244, 217, 227, 109, 108, 190, 97, 94, 102, 199, 71, 201, 122, 44, 235, - 152, 194, 25, 126, 30, 114, 215, 48, 117, 220, 141, 204, 150, 117, 244, - 179, 144, 182, 114, 218, 2, 245, 156, 178, 71, 12, 31, 23, 44, 190, - 163, 210, 237, 146, 211, 132, 212, 141, 19, 149, 52, 97, 137, 5, 141, - 31, 94, 237, 177, 163, 127, 80, 143, 15, 17, 175, 74, 183, 94, 154, - 98, 191, 45, 54, 180, 237, 213, 110, 199, 165, 241, 37, 126, 64, 188, - 117, 105, 81, 154, 207, 78, 125, 169, 206, 92, 89, 126, 71, 145, 164, - 138, 205, 17, 239, 69, 143, 103, 134, 109, 193, 74, 254, 213, 185, 144, - 224, 114, 37, 46, 77, 65, 188, 247, 154, 109, 52, 180, 57, 18, 205, - 175, 107, 250, 85, 208, 149, 29, 61, 49, 155, 210, 212, 195, 207, 71, - 179, 123, 209, 90, 126, 96, 173, 207, 50, 181, 161, 35, 199, 32, 173, - 178, 85, 51, 254, 230, 153, 43, 252, 135, 127, 108, 205, 200, 245, 50, - 164, 96, 217, 148, 39, 181, 13, 47, 134, 27, 249, 79, 7, 13, 11, - 78, 59, 252, 19, 190, 118, 206, 244, 104, 239, 74, 99, 90, 137, 213, - 89, 239, 206, 141, 107, 60, 79, 223, 234, 33, 226, 233, 47, 77, 53, - 246, 110, 48, 154, 31, 82, 184, 119, 227, 46, 155, 46, 234, 176, 236, - 185, 117, 76, 179, 132, 49, 253, 12, 116, 8, 198, 190, 177, 121, 236, - 13, 56, 246, 245, 63, 36, 166, 162, 48, 71, 101, 97, 142, 86, 39, - 39, 27, 112, 142, 162, 166, 42, 44, 115, 249, 81, 209, 48, 3, 206, - 229, 244, 229, 230, 57, 63, 14, 115, 30, 55, 33, 55, 11, 231, 124, - 4, 216, 201, 87, 160, 27, 25, 160, 27, 147, 166, 150, 52, 160, 110, - 116, 158, 5, 122, 0, 58, 84, 1, 116, 40, 166, 122, 146, 1, 117, - 232, 41, 216, 251, 37, 160, 107, 9, 160, 107, 195, 51, 139, 24, 80, - 215, 238, 64, 153, 30, 116, 50, 29, 116, 178, 206, 104, 165, 1, 117, - 114, 41, 180, 187, 6, 116, 119, 40, 232, 110, 3, 159, 97, 6, 212, - 221, 115, 83, 173, 58, 158, 59, 116, 70, 22, 234, 184, 122, 20, 49, - 221, 128, 181, 48, 8, 214, 66, 93, 160, 197, 181, 80, 124, 62, 196, - 67, 176, 102, 82, 97, 205, 84, 126, 209, 222, 128, 107, 230, 235, 21, - 196, 148, 12, 107, 235, 21, 172, 173, 106, 211, 75, 25, 42, 193, 218, - 186, 4, 54, 118, 30, 172, 193, 242, 176, 6, 203, 156, 157, 105, 192, - 53, 56, 7, 218, 104, 12, 107, 245, 26, 172, 213, 241, 73, 1, 6, - 92, 171, 15, 231, 18, 147, 39, 172, 233, 205, 176, 166, 15, 62, 89, - 110, 192, 53, 93, 84, 111, 182, 7, 215, 193, 30, 100, 13, 127, 146, - 133, 246, 224, 239, 153, 196, 100, 4, 187, 225, 13, 118, 99, 89, 223, - 65, 6, 180, 27, 35, 1, 111, 19, 216, 151, 25, 96, 95, 54, 46, - 171, 110, 64, 251, 226, 53, 211, 108, 135, 142, 131, 29, 154, 123, 226, - 159, 44, 180, 67, 45, 192, 7, 244, 7, 123, 85, 10, 236, 85, 235, - 1, 189, 13, 104, 175, 154, 131, 204, 103, 193, 174, 157, 5, 187, 166, - 89, 236, 99, 64, 187, 198, 237, 39, 166, 26, 96, 255, 6, 155, 237, - 159, 1, 237, 223, 199, 128, 55, 30, 236, 164, 214, 108, 39, 13, 104, - 39, 189, 83, 205, 246, 116, 8, 216, 211, 222, 151, 151, 103, 161, 61, - 77, 93, 76, 4, 187, 251, 28, 236, 174, 231, 251, 145, 6, 180, 187, - 197, 15, 154, 237, 243, 5, 176, 207, 215, 126, 77, 54, 160, 125, 62, - 158, 174, 176, 216, 241, 82, 49, 145, 6, 180, 227, 85, 183, 17, 211, - 106, 176, 247, 157, 192, 222, 119, 15, 123, 207, 128, 246, 254, 235, 149, - 196, 84, 24, 252, 194, 41, 240, 11, 213, 190, 245, 50, 160, 95, 216, - 189, 202, 236, 63, 226, 192, 127, 180, 60, 74, 12, 232, 63, 190, 2, - 63, 72, 253, 76, 213, 128, 173, 89, 232, 103, 78, 173, 54, 251, 163, - 30, 224, 143, 178, 127, 251, 41, 11, 253, 209, 187, 203, 205, 126, 43, - 13, 252, 86, 191, 38, 25, 89, 232, 183, 110, 46, 33, 166, 28, 240, - 111, 7, 193, 191, 249, 92, 43, 100, 64, 255, 118, 113, 163, 194, 180, - 7, 252, 224, 83, 240, 131, 33, 27, 42, 24, 208, 15, 22, 27, 108, - 245, 151, 51, 15, 84, 203, 66, 127, 217, 42, 73, 97, 241, 181, 254, - 89, 126, 89, 232, 107, 231, 37, 152, 125, 242, 111, 224, 147, 83, 74, - 29, 204, 66, 159, 124, 29, 244, 175, 163, 232, 187, 235, 229, 128, 110, - 130, 239, 46, 10, 62, 175, 63, 248, 248, 190, 224, 227, 171, 165, 77, - 48, 160, 143, 31, 219, 83, 97, 250, 9, 98, 129, 9, 16, 11, 108, - 78, 175, 108, 192, 88, 96, 210, 72, 107, 204, 80, 119, 91, 104, 22, - 198, 12, 185, 96, 255, 126, 132, 120, 227, 25, 196, 27, 167, 202, 142, - 51, 96, 188, 145, 94, 26, 214, 165, 24, 151, 76, 254, 152, 55, 96, - 92, 178, 234, 164, 194, 212, 28, 226, 151, 27, 16, 191, 252, 83, 51, - 202, 128, 241, 203, 179, 219, 196, 116, 92, 140, 115, 22, 111, 244, 53, - 96, 156, 179, 12, 214, 106, 178, 24, 15, 29, 27, 85, 193, 128, 241, - 80, 18, 230, 148, 65, 220, 180, 12, 226, 166, 11, 115, 66, 13, 24, - 55, 237, 195, 188, 73, 136, 175, 84, 220, 201, 176, 129, 35, 219, 24, - 48, 190, 170, 14, 54, 187, 27, 196, 97, 89, 16, 135, 109, 90, 220, - 209, 128, 113, 216, 237, 36, 98, 218, 14, 241, 90, 3, 136, 215, 154, - 31, 24, 110, 192, 120, 109, 44, 172, 213, 30, 16, 215, 213, 129, 184, - 238, 208, 222, 51, 6, 140, 235, 170, 194, 26, 68, 90, 35, 208, 122, - 221, 61, 106, 192, 248, 47, 4, 226, 176, 239, 33, 78, 92, 15, 113, - 226, 87, 119, 102, 26, 48, 78, 12, 4, 126, 143, 161, 93, 13, 180, - 187, 89, 127, 194, 128, 241, 228, 57, 88, 91, 17, 162, 124, 109, 186, - 100, 26, 48, 238, 44, 1, 122, 159, 8, 253, 248, 30, 250, 81, 160, - 235, 7, 6, 140, 79, 91, 206, 38, 166, 163, 208, 223, 58, 208, 223, - 42, 209, 179, 13, 24, 199, 14, 239, 66, 44, 227, 18, 51, 99, 189, - 1, 227, 221, 229, 191, 192, 152, 66, 92, 252, 5, 196, 197, 51, 122, - 47, 51, 96, 92, 252, 241, 14, 133, 169, 1, 196, 207, 205, 32, 126, - 238, 219, 115, 147, 1, 227, 231, 50, 208, 143, 21, 16, 103, 63, 132, - 56, 187, 18, 240, 195, 56, 187, 23, 172, 233, 230, 16, 143, 231, 64, - 60, 94, 40, 117, 187, 1, 227, 241, 186, 211, 20, 166, 45, 16, 183, - 143, 131, 184, 253, 239, 243, 41, 6, 140, 219, 15, 3, 94, 37, 49, - 190, 63, 210, 188, 189, 1, 227, 251, 6, 48, 6, 116, 31, 128, 101, - 184, 15, 168, 86, 76, 97, 186, 5, 251, 133, 138, 48, 151, 223, 220, - 77, 49, 224, 126, 33, 178, 32, 248, 115, 152, 95, 44, 107, 84, 127, - 143, 1, 247, 21, 77, 155, 42, 76, 9, 176, 255, 208, 193, 254, 99, - 131, 223, 42, 3, 238, 63, 234, 67, 187, 85, 96, 159, 50, 11, 246, - 41, 69, 61, 198, 24, 112, 159, 226, 15, 250, 87, 1, 246, 51, 221, - 96, 63, 179, 162, 239, 104, 3, 238, 103, 174, 130, 44, 90, 216, 247, - 84, 128, 125, 79, 101, 232, 7, 238, 123, 214, 189, 132, 181, 15, 251, - 163, 146, 176, 63, 170, 183, 102, 129, 1, 247, 71, 101, 64, 62, 29, - 236, 163, 80, 215, 82, 119, 100, 24, 112, 31, 181, 229, 23, 235, 62, - 175, 251, 194, 69, 7, 112, 191, 213, 191, 142, 194, 178, 47, 139, 209, - 44, 203, 194, 125, 217, 192, 201, 214, 253, 91, 242, 87, 51, 179, 112, - 255, 246, 39, 179, 191, 124, 144, 89, 55, 11, 247, 121, 99, 31, 88, - 247, 131, 179, 77, 53, 178, 112, 63, 88, 191, 132, 66, 216, 55, 30, - 135, 125, 99, 82, 212, 145, 44, 220, 55, 126, 232, 97, 221, 231, 221, - 29, 27, 100, 192, 253, 101, 213, 90, 196, 164, 18, 247, 161, 131, 150, - 86, 54, 224, 62, 244, 196, 175, 10, 203, 126, 117, 222, 164, 31, 178, - 112, 191, 58, 156, 179, 182, 59, 127, 100, 93, 3, 238, 107, 135, 63, - 36, 150, 253, 239, 135, 128, 39, 236, 127, 167, 90, 247, 201, 157, 99, - 239, 101, 225, 62, 121, 56, 216, 216, 219, 98, 63, 138, 245, 111, 104, - 192, 253, 180, 10, 240, 112, 223, 221, 14, 246, 221, 93, 1, 15, 247, - 221, 49, 5, 192, 207, 192, 254, 252, 16, 236, 207, 235, 131, 175, 192, - 253, 121, 69, 189, 121, 92, 58, 195, 184, 36, 87, 29, 96, 192, 125, - 124, 58, 232, 105, 71, 216, 239, 239, 132, 253, 62, 250, 35, 220, 239, - 15, 211, 155, 115, 56, 87, 21, 194, 119, 150, 245, 244, 242, 23, 207, - 5, 114, 131, 99, 189, 44, 239, 93, 99, 224, 4, 6, 14, 96, 224, - 220, 32, 6, 159, 129, 19, 24, 56, 128, 129, 115, 3, 25, 124, 6, - 78, 96, 224, 0, 6, 206, 13, 96, 240, 25, 56, 129, 129, 3, 24, - 56, 167, 145, 21, 78, 99, 96, 29, 3, 171, 24, 56, 199, 159, 193, - 103, 96, 29, 3, 171, 24, 56, 167, 33, 131, 207, 192, 58, 6, 86, - 49, 112, 78, 3, 6, 159, 129, 117, 12, 172, 98, 224, 156, 250, 12, - 62, 3, 235, 24, 88, 197, 192, 57, 245, 24, 124, 6, 214, 49, 176, - 138, 129, 115, 234, 50, 248, 12, 172, 99, 96, 21, 3, 231, 212, 97, - 240, 25, 88, 199, 192, 42, 6, 206, 169, 205, 224, 51, 176, 142, 129, - 85, 12, 156, 83, 139, 193, 103, 96, 29, 3, 171, 24, 56, 167, 38, - 131, 207, 192, 58, 6, 86, 49, 112, 78, 13, 6, 159, 129, 117, 12, - 172, 4, 152, 30, 226, 25, 171, 91, 225, 4, 6, 14, 168, 206, 232, - 100, 53, 70, 39, 25, 88, 87, 205, 138, 175, 100, 224, 108, 63, 43, - 78, 42, 3, 231, 164, 48, 178, 49, 176, 142, 129, 85, 12, 156, 61, - 197, 202, 51, 117, 138, 181, 92, 195, 148, 231, 78, 182, 194, 233, 147, - 25, 158, 76, 185, 146, 129, 179, 223, 103, 100, 99, 96, 45, 3, 43, - 25, 56, 251, 61, 6, 159, 129, 181, 12, 172, 100, 96, 227, 36, 102, - 60, 25, 88, 197, 192, 217, 19, 173, 176, 158, 129, 3, 24, 56, 119, - 2, 51, 86, 19, 172, 229, 90, 6, 38, 12, 108, 28, 111, 197, 215, - 51, 176, 134, 129, 115, 199, 89, 241, 211, 24, 88, 203, 192, 202, 113, - 76, 223, 199, 50, 125, 103, 96, 45, 3, 147, 177, 204, 248, 39, 91, - 97, 29, 3, 43, 25, 56, 59, 137, 225, 201, 192, 90, 6, 86, 50, - 112, 118, 34, 131, 207, 192, 90, 6, 86, 50, 176, 113, 12, 51, 254, - 12, 28, 48, 134, 209, 195, 4, 70, 175, 24, 88, 195, 192, 57, 163, - 153, 241, 103, 96, 29, 3, 171, 24, 56, 39, 158, 193, 103, 96, 109, - 60, 51, 95, 12, 108, 28, 197, 204, 23, 3, 107, 24, 56, 119, 36, - 51, 95, 12, 172, 101, 96, 229, 72, 102, 172, 70, 48, 99, 197, 192, - 90, 6, 86, 50, 112, 246, 112, 6, 159, 129, 181, 12, 172, 100, 224, - 236, 56, 6, 159, 129, 181, 12, 172, 100, 224, 236, 88, 6, 159, 129, - 181, 12, 172, 100, 224, 236, 97, 12, 62, 3, 107, 25, 88, 201, 192, - 217, 67, 25, 124, 6, 214, 50, 176, 146, 129, 179, 99, 24, 124, 6, - 214, 50, 176, 146, 129, 179, 135, 48, 248, 12, 172, 101, 96, 37, 3, - 103, 15, 102, 240, 25, 88, 203, 192, 74, 6, 206, 30, 196, 224, 51, - 176, 150, 129, 149, 12, 156, 29, 205, 224, 51, 176, 150, 129, 149, 12, - 156, 173, 99, 116, 76, 199, 232, 57, 83, 158, 83, 156, 209, 91, 6, - 214, 49, 176, 138, 129, 115, 138, 49, 248, 12, 172, 99, 96, 101, 49, - 70, 207, 139, 50, 235, 145, 129, 3, 138, 50, 122, 238, 195, 248, 23, - 6, 166, 239, 176, 198, 24, 173, 161, 248, 124, 167, 144, 248, 220, 139, - 254, 206, 133, 143, 24, 183, 185, 170, 79, 144, 169, 15, 144, 169, 199, - 152, 207, 101, 251, 50, 245, 9, 76, 125, 17, 177, 158, 254, 78, 134, - 143, 24, 47, 186, 170, 199, 24, 210, 85, 125, 58, 83, 95, 84, 172, - 167, 191, 131, 225, 35, 198, 154, 174, 234, 3, 100, 234, 49, 38, 117, - 85, 159, 30, 224, 90, 190, 132, 0, 153, 241, 151, 169, 199, 24, 215, - 85, 251, 105, 76, 125, 25, 177, 158, 254, 14, 132, 143, 24, 11, 187, - 170, 87, 49, 245, 165, 196, 122, 250, 59, 22, 62, 98, 204, 236, 170, - 62, 141, 169, 47, 65, 159, 203, 86, 97, 218, 151, 169, 87, 249, 187, - 150, 15, 99, 112, 151, 237, 203, 212, 235, 26, 202, 180, 47, 83, 143, - 49, 189, 171, 250, 52, 153, 122, 29, 83, 95, 156, 202, 167, 99, 218, - 151, 169, 199, 61, 130, 203, 254, 203, 212, 235, 234, 203, 244, 95, 166, - 30, 247, 28, 46, 251, 95, 207, 181, 252, 58, 153, 122, 149, 76, 61, - 238, 97, 92, 213, 167, 201, 212, 235, 234, 202, 244, 95, 166, 30, 247, - 68, 46, 251, 95, 71, 102, 252, 101, 234, 85, 117, 100, 244, 191, 182, - 235, 250, 52, 166, 94, 33, 214, 211, 223, 177, 242, 17, 247, 98, 180, - 158, 163, 242, 251, 51, 237, 203, 212, 227, 158, 205, 85, 125, 154, 76, - 189, 174, 150, 107, 249, 84, 50, 245, 184, 7, 116, 85, 159, 86, 83, - 166, 125, 153, 122, 149, 12, 127, 220, 83, 186, 108, 95, 166, 94, 231, - 162, 222, 87, 220, 143, 54, 20, 235, 60, 169, 255, 40, 243, 88, 33, - 254, 214, 46, 79, 127, 83, 204, 87, 220, 175, 58, 195, 45, 32, 226, - 210, 223, 255, 242, 21, 247, 179, 20, 183, 32, 237, 247, 96, 138, 171, - 183, 224, 250, 136, 251, 93, 42, 35, 139, 107, 241, 129, 213, 92, 215, - 167, 51, 245, 246, 252, 125, 197, 189, 50, 149, 197, 131, 250, 48, 232, - 151, 248, 155, 10, 60, 253, 221, 51, 95, 113, 47, 237, 206, 120, 248, - 136, 123, 109, 218, 46, 139, 75, 235, 83, 253, 164, 229, 242, 17, 247, - 228, 174, 234, 211, 82, 100, 230, 86, 166, 94, 149, 226, 122, 238, 113, - 143, 239, 108, 92, 196, 56, 209, 134, 87, 234, 20, 215, 188, 52, 83, - 220, 155, 111, 95, 241, 220, 192, 29, 61, 242, 17, 207, 21, 92, 206, - 237, 100, 247, 117, 82, 57, 217, 149, 140, 182, 237, 226, 89, 5, 109, - 215, 139, 218, 189, 186, 204, 120, 200, 212, 107, 101, 234, 149, 50, 245, - 120, 246, 225, 178, 125, 153, 122, 173, 76, 189, 146, 169, 103, 231, 222, - 178, 214, 39, 217, 143, 43, 145, 180, 11, 9, 147, 220, 183, 33, 170, - 60, 224, 226, 89, 141, 59, 250, 233, 43, 158, 229, 184, 139, 27, 48, - 209, 125, 61, 192, 179, 32, 87, 122, 159, 54, 193, 253, 254, 104, 39, - 184, 175, 171, 100, 130, 251, 246, 19, 207, 159, 92, 217, 71, 189, 76, - 189, 102, 188, 235, 53, 134, 103, 87, 238, 218, 207, 180, 113, 121, 24, - 15, 6, 151, 109, 87, 164, 83, 179, 182, 84, 57, 206, 181, 173, 196, - 243, 50, 151, 182, 120, 172, 107, 91, 169, 29, 235, 122, 158, 201, 88, - 247, 245, 11, 207, 226, 220, 29, 3, 93, 30, 112, 149, 201, 238, 173, - 73, 31, 241, 172, 79, 106, 125, 251, 136, 231, 127, 180, 222, 155, 246, - 215, 143, 25, 15, 153, 122, 165, 76, 61, 158, 29, 186, 170, 79, 149, - 169, 215, 202, 212, 43, 93, 212, 251, 138, 103, 145, 238, 172, 113, 95, - 241, 172, 210, 93, 127, 20, 48, 198, 245, 90, 193, 243, 77, 119, 215, - 120, 106, 130, 251, 62, 83, 147, 224, 190, 175, 198, 243, 83, 151, 49, - 163, 76, 189, 78, 166, 94, 53, 90, 38, 174, 137, 151, 137, 107, 226, - 165, 215, 170, 175, 120, 110, 235, 238, 154, 32, 241, 238, 217, 38, 31, - 241, 220, 215, 149, 92, 250, 81, 50, 118, 210, 69, 189, 175, 120, 102, - 236, 238, 124, 166, 141, 116, 95, 79, 180, 35, 221, 143, 73, 149, 35, - 93, 207, 29, 158, 83, 187, 170, 79, 149, 169, 215, 202, 212, 43, 153, - 122, 154, 39, 79, 127, 87, 217, 71, 60, 247, 118, 85, 159, 58, 92, - 166, 125, 153, 122, 165, 12, 127, 60, 71, 119, 217, 190, 76, 189, 86, - 166, 94, 201, 212, 151, 165, 58, 48, 133, 105, 63, 214, 117, 125, 42, - 83, 95, 154, 234, 179, 7, 211, 190, 76, 189, 146, 169, 47, 73, 117, - 165, 0, 211, 254, 48, 215, 245, 169, 50, 245, 90, 166, 94, 73, 245, - 218, 139, 105, 95, 166, 30, 159, 27, 184, 170, 79, 149, 169, 215, 202, - 212, 43, 135, 202, 244, 63, 70, 166, 255, 50, 245, 218, 24, 153, 241, - 151, 169, 199, 231, 26, 46, 251, 47, 83, 175, 29, 226, 90, 62, 165, - 76, 61, 62, 39, 113, 217, 127, 153, 122, 237, 96, 153, 254, 203, 212, - 227, 115, 23, 151, 250, 63, 72, 166, 125, 153, 122, 229, 32, 153, 246, - 163, 93, 215, 167, 70, 187, 150, 79, 43, 83, 175, 100, 234, 139, 209, - 125, 87, 33, 166, 125, 157, 181, 190, 48, 165, 47, 198, 236, 99, 116, - 86, 91, 207, 214, 251, 80, 91, 83, 132, 241, 71, 12, 47, 103, 245, - 248, 124, 201, 149, 44, 105, 50, 245, 58, 153, 122, 149, 76, 61, 62, - 175, 114, 37, 95, 154, 76, 189, 206, 69, 189, 175, 248, 172, 203, 157, - 177, 242, 21, 159, 133, 185, 139, 155, 80, 212, 253, 57, 8, 40, 42, - 61, 159, 62, 226, 243, 53, 87, 245, 233, 46, 234, 119, 195, 160, 226, - 119, 186, 234, 89, 190, 171, 229, 41, 252, 138, 172, 146, 252, 202, 97, - 4, 99, 254, 29, 174, 231, 156, 167, 240, 203, 72, 248, 219, 162, 89, - 28, 254, 154, 40, 190, 37, 172, 6, 217, 196, 121, 1, 71, 140, 141, - 253, 72, 48, 87, 72, 120, 243, 24, 174, 153, 222, 0, 23, 17, 198, - 83, 69, 198, 113, 69, 128, 74, 208, 91, 146, 200, 121, 11, 111, 45, - 195, 223, 86, 106, 6, 112, 97, 241, 183, 170, 18, 184, 194, 164, 16, - 224, 40, 137, 63, 201, 5, 254, 222, 194, 155, 205, 148, 164, 63, 135, - 191, 93, 138, 111, 60, 43, 65, 126, 226, 10, 0, 84, 20, 164, 168, - 76, 118, 112, 120, 18, 94, 12, 100, 42, 79, 238, 3, 255, 194, 194, - 249, 67, 73, 50, 4, 96, 47, 33, 46, 82, 145, 30, 28, 254, 174, - 87, 17, 225, 76, 59, 25, 224, 34, 66, 121, 77, 18, 192, 149, 18, - 222, 187, 87, 26, 254, 109, 229, 240, 253, 125, 126, 112, 223, 128, 188, - 199, 149, 22, 222, 217, 87, 6, 248, 108, 225, 240, 173, 126, 213, 224, - 222, 151, 60, 224, 240, 109, 127, 213, 133, 119, 172, 157, 231, 202, 8, - 239, 243, 195, 223, 252, 186, 203, 85, 20, 222, 200, 135, 191, 195, 53, - 158, 43, 43, 252, 242, 22, 254, 206, 215, 11, 14, 223, 223, 87, 75, - 248, 13, 175, 95, 184, 202, 194, 187, 255, 106, 0, 230, 90, 174, 10, - 64, 181, 133, 223, 240, 122, 197, 213, 36, 117, 0, 174, 5, 178, 61, - 224, 202, 9, 191, 250, 133, 227, 208, 147, 195, 95, 12, 43, 41, 244, - 101, 60, 135, 191, 58, 22, 32, 142, 97, 9, 225, 215, 182, 202, 65, - 43, 127, 115, 37, 197, 119, 231, 149, 34, 99, 128, 182, 17, 17, 206, - 60, 96, 108, 125, 1, 246, 23, 224, 166, 128, 163, 18, 206, 226, 85, - 192, 179, 36, 208, 169, 4, 158, 9, 0, 227, 155, 247, 8, 148, 140, - 225, 240, 55, 205, 252, 133, 49, 233, 198, 225, 59, 215, 240, 55, 189, - 170, 144, 94, 192, 7, 127, 229, 171, 60, 200, 115, 3, 198, 161, 33, - 140, 77, 5, 248, 247, 152, 195, 183, 178, 225, 27, 2, 43, 2, 126, - 25, 24, 131, 250, 112, 87, 10, 100, 171, 0, 159, 245, 161, 180, 60, - 201, 132, 49, 169, 47, 188, 81, 176, 60, 249, 13, 198, 164, 146, 240, - 214, 193, 82, 32, 115, 37, 224, 92, 23, 238, 74, 145, 37, 28, 190, - 139, 176, 46, 180, 90, 5, 230, 40, 152, 132, 136, 239, 16, 28, 207, - 5, 9, 111, 216, 107, 33, 232, 94, 19, 248, 108, 46, 200, 63, 22, - 224, 230, 194, 251, 4, 91, 129, 108, 65, 226, 187, 5, 75, 193, 92, - 7, 9, 191, 17, 102, 150, 63, 158, 132, 139, 239, 4, 28, 15, 112, - 160, 240, 222, 64, 13, 73, 2, 56, 148, 140, 22, 96, 44, 15, 19, - 222, 9, 168, 129, 177, 10, 21, 126, 105, 204, 60, 230, 248, 59, 98, - 136, 83, 13, 198, 39, 8, 228, 9, 22, 248, 196, 0, 76, 223, 15, - 24, 196, 53, 5, 74, 243, 59, 248, 198, 1, 220, 65, 104, 183, 52, - 41, 5, 112, 71, 241, 93, 126, 221, 56, 124, 43, 97, 71, 17, 14, - 35, 157, 68, 56, 24, 96, 181, 248, 238, 191, 193, 28, 190, 209, 80, - 45, 242, 236, 96, 121, 39, 224, 16, 78, 77, 162, 44, 56, 67, 8, - 132, 244, 66, 223, 199, 3, 172, 17, 222, 105, 168, 130, 190, 224, 219, - 22, 155, 8, 115, 215, 148, 195, 55, 41, 6, 9, 176, 134, 11, 1, - 57, 155, 8, 56, 201, 0, 55, 17, 198, 83, 5, 125, 137, 35, 157, - 5, 57, 107, 0, 159, 102, 0, 55, 23, 198, 42, 136, 171, 10, 154, - 135, 111, 53, 68, 61, 172, 13, 122, 24, 33, 252, 198, 217, 5, 40, - 143, 36, 194, 111, 70, 195, 56, 215, 33, 221, 197, 247, 33, 6, 115, - 248, 75, 123, 189, 73, 47, 128, 167, 192, 122, 44, 78, 122, 194, 93, - 121, 192, 239, 5, 159, 125, 200, 59, 130, 77, 232, 1, 245, 239, 144, - 190, 0, 31, 16, 172, 72, 47, 210, 3, 52, 189, 15, 192, 61, 0, - 191, 56, 104, 194, 26, 174, 53, 72, 211, 65, 208, 195, 158, 0, 199, - 137, 99, 24, 13, 112, 7, 210, 79, 104, 171, 52, 140, 73, 39, 17, - 14, 226, 240, 77, 138, 253, 196, 241, 124, 135, 12, 32, 253, 5, 254, - 205, 184, 54, 228, 93, 104, 23, 203, 203, 1, 237, 187, 226, 123, 24, - 99, 160, 188, 15, 233, 38, 192, 17, 0, 119, 35, 109, 5, 24, 127, - 148, 62, 138, 12, 20, 224, 182, 0, 247, 23, 222, 207, 168, 129, 126, - 13, 134, 145, 29, 40, 244, 183, 49, 192, 3, 137, 78, 128, 135, 114, - 131, 0, 86, 11, 112, 51, 128, 117, 34, 206, 24, 46, 10, 104, 7, - 8, 124, 146, 1, 30, 96, 145, 243, 93, 128, 204, 229, 99, 1, 110, - 45, 150, 107, 184, 190, 132, 23, 223, 59, 89, 19, 224, 254, 226, 187, - 41, 85, 92, 31, 144, 121, 128, 48, 110, 58, 78, 11, 50, 247, 196, - 92, 8, 104, 75, 11, 50, 155, 251, 213, 18, 240, 181, 66, 57, 234, - 103, 95, 224, 162, 21, 251, 165, 6, 105, 204, 239, 151, 84, 114, 93, - 97, 182, 218, 139, 58, 223, 21, 86, 84, 59, 97, 108, 91, 113, 248, - 118, 207, 118, 162, 62, 84, 1, 168, 174, 176, 94, 148, 92, 93, 210, - 149, 116, 17, 236, 225, 80, 174, 37, 204, 111, 23, 145, 182, 46, 64, - 221, 133, 242, 198, 48, 239, 117, 5, 184, 36, 233, 202, 5, 138, 239, - 226, 172, 1, 115, 52, 8, 224, 64, 129, 103, 36, 232, 149, 249, 221, - 151, 42, 82, 3, 224, 54, 100, 184, 0, 183, 225, 240, 183, 240, 70, - 137, 246, 167, 13, 64, 230, 242, 106, 220, 40, 225, 55, 242, 204, 118, - 108, 20, 64, 35, 69, 24, 127, 55, 111, 132, 5, 30, 33, 150, 39, - 114, 145, 36, 86, 44, 31, 15, 240, 8, 177, 47, 1, 220, 48, 40, - 143, 20, 230, 46, 16, 224, 72, 225, 93, 156, 26, 88, 59, 195, 0, - 138, 16, 231, 113, 24, 64, 67, 133, 242, 161, 92, 4, 244, 36, 90, - 228, 31, 1, 208, 80, 145, 127, 52, 148, 183, 20, 199, 39, 26, 160, - 24, 81, 231, 99, 0, 214, 8, 112, 45, 128, 129, 179, 0, 15, 129, - 177, 162, 239, 229, 28, 7, 176, 86, 156, 83, 45, 215, 69, 120, 51, - 167, 89, 31, 186, 0, 164, 21, 203, 187, 65, 185, 121, 94, 26, 115, - 248, 118, 207, 182, 226, 188, 159, 34, 39, 201, 9, 114, 28, 96, 3, - 119, 154, 156, 2, 232, 24, 192, 47, 185, 227, 228, 27, 114, 84, 128, - 47, 114, 39, 200, 17, 184, 59, 14, 99, 222, 157, 251, 6, 224, 67, - 130, 111, 29, 202, 29, 38, 7, 5, 184, 52, 248, 214, 195, 196, 40, - 252, 216, 38, 218, 132, 131, 0, 239, 23, 125, 235, 17, 98, 16, 224, - 72, 50, 12, 224, 253, 2, 62, 218, 180, 67, 0, 27, 201, 97, 193, - 183, 158, 32, 89, 128, 117, 4, 240, 215, 114, 39, 201, 1, 184, 59, - 1, 243, 158, 193, 29, 3, 9, 12, 112, 87, 142, 92, 6, 217, 142, - 1, 116, 0, 116, 230, 31, 224, 255, 141, 216, 110, 32, 192, 71, 225, - 14, 219, 237, 202, 25, 64, 130, 253, 130, 206, 140, 1, 248, 168, 32, - 79, 117, 208, 231, 61, 100, 55, 249, 154, 108, 2, 252, 129, 92, 38, - 124, 126, 77, 50, 192, 203, 221, 227, 118, 147, 93, 228, 43, 184, 243, - 5, 249, 51, 224, 243, 43, 178, 29, 116, 236, 5, 183, 29, 160, 141, - 100, 27, 200, 179, 151, 219, 69, 118, 2, 252, 21, 192, 73, 220, 54, - 128, 190, 36, 91, 1, 254, 147, 219, 73, 210, 1, 222, 8, 240, 3, - 46, 157, 108, 33, 235, 225, 78, 73, 118, 113, 91, 225, 115, 61, 217, - 0, 50, 247, 231, 182, 144, 205, 228, 11, 184, 83, 146, 39, 220, 6, - 248, 252, 130, 172, 3, 217, 94, 112, 59, 64, 134, 76, 97, 28, 122, - 114, 251, 200, 94, 178, 67, 232, 203, 120, 128, 87, 145, 189, 226, 24, - 238, 131, 210, 213, 112, 95, 151, 60, 228, 246, 194, 231, 106, 225, 57, - 116, 50, 208, 102, 10, 48, 234, 76, 38, 249, 84, 132, 7, 3, 206, - 30, 224, 106, 246, 173, 123, 1, 50, 243, 76, 0, 120, 53, 96, 161, - 77, 78, 6, 248, 83, 192, 194, 49, 233, 6, 99, 242, 41, 249, 12, - 198, 165, 10, 89, 15, 124, 50, 0, 254, 20, 230, 55, 17, 198, 97, - 59, 73, 131, 59, 244, 173, 187, 225, 51, 13, 198, 168, 34, 89, 7, - 227, 144, 70, 62, 135, 177, 64, 31, 186, 29, 198, 230, 115, 184, 47, - 69, 190, 135, 49, 217, 74, 214, 192, 29, 250, 220, 157, 240, 185, 6, - 198, 165, 60, 200, 156, 14, 208, 90, 24, 151, 242, 224, 91, 183, 194, - 120, 172, 133, 251, 42, 96, 111, 87, 144, 229, 100, 145, 184, 198, 87, - 146, 197, 96, 255, 151, 128, 156, 6, 110, 25, 64, 139, 133, 49, 25, - 11, 240, 82, 193, 47, 128, 61, 0, 156, 165, 100, 153, 208, 247, 64, - 128, 151, 192, 157, 89, 254, 120, 242, 9, 249, 216, 226, 91, 63, 22, - 236, 0, 250, 208, 120, 240, 154, 11, 5, 120, 28, 192, 11, 1, 203, - 92, 190, 16, 56, 46, 21, 199, 103, 33, 224, 52, 23, 99, 188, 149, - 100, 133, 40, 79, 19, 128, 23, 9, 50, 40, 201, 32, 110, 41, 153, - 46, 240, 193, 121, 95, 10, 237, 206, 16, 236, 79, 27, 128, 103, 144, - 233, 162, 253, 95, 8, 208, 39, 34, 252, 9, 192, 211, 4, 120, 40, - 192, 211, 72, 170, 0, 55, 5, 56, 85, 148, 115, 16, 55, 3, 202, - 205, 180, 129, 92, 42, 192, 83, 69, 156, 33, 224, 89, 23, 136, 54, - 97, 8, 64, 243, 69, 120, 5, 244, 124, 185, 48, 119, 131, 1, 94, - 41, 140, 67, 57, 176, 153, 139, 0, 90, 44, 218, 255, 69, 128, 177, - 204, 226, 91, 151, 128, 71, 197, 49, 76, 226, 150, 64, 15, 59, 139, - 250, 191, 153, 124, 72, 230, 130, 246, 161, 30, 126, 1, 208, 60, 208, - 67, 37, 217, 9, 229, 179, 160, 6, 105, 187, 115, 235, 160, 244, 125, - 81, 254, 83, 100, 34, 153, 0, 118, 65, 73, 126, 135, 245, 56, 129, - 76, 18, 214, 221, 78, 110, 34, 25, 71, 198, 195, 61, 218, 132, 247, - 200, 88, 184, 155, 8, 240, 21, 88, 155, 239, 1, 116, 10, 44, 252, - 231, 0, 31, 0, 252, 247, 32, 18, 235, 193, 125, 0, 99, 181, 68, - 208, 195, 158, 0, 47, 1, 239, 138, 99, 216, 24, 224, 100, 97, 60, - 209, 167, 204, 0, 120, 154, 56, 62, 211, 0, 158, 42, 142, 231, 56, - 224, 159, 68, 18, 1, 62, 203, 205, 129, 86, 199, 136, 190, 242, 3, - 50, 71, 132, 155, 64, 249, 100, 168, 65, 184, 36, 192, 179, 225, 14, - 225, 238, 220, 2, 146, 32, 242, 41, 7, 240, 84, 224, 99, 182, 189, - 131, 161, 220, 60, 206, 209, 0, 235, 72, 130, 0, 7, 129, 31, 73, - 21, 225, 97, 0, 39, 136, 62, 55, 129, 155, 10, 237, 39, 9, 124, - 198, 0, 156, 12, 119, 102, 57, 199, 0, 148, 44, 250, 214, 49, 0, - 125, 32, 250, 190, 177, 48, 115, 11, 68, 223, 58, 22, 160, 36, 209, - 198, 142, 135, 145, 74, 4, 169, 209, 183, 166, 192, 232, 140, 23, 246, - 26, 195, 0, 30, 47, 202, 92, 26, 240, 39, 145, 20, 209, 38, 140, - 5, 104, 190, 216, 175, 84, 144, 63, 65, 244, 221, 83, 200, 76, 152, - 49, 179, 206, 79, 1, 104, 173, 48, 182, 101, 193, 206, 204, 2, 75, - 99, 214, 135, 45, 80, 58, 75, 88, 47, 26, 110, 45, 209, 147, 41, - 130, 61, 12, 230, 62, 2, 248, 125, 145, 118, 45, 64, 122, 161, 60, - 26, 230, 253, 125, 145, 79, 15, 240, 173, 31, 11, 122, 91, 13, 230, - 104, 16, 172, 168, 84, 129, 167, 18, 244, 106, 142, 208, 71, 216, 161, - 0, 60, 28, 238, 16, 198, 49, 31, 5, 163, 110, 182, 63, 115, 160, - 220, 236, 103, 85, 224, 79, 103, 138, 229, 73, 0, 143, 132, 59, 179, - 189, 154, 9, 126, 115, 150, 88, 62, 19, 202, 71, 136, 227, 252, 33, - 64, 177, 98, 92, 253, 33, 96, 152, 203, 117, 224, 55, 63, 20, 202, - 53, 2, 60, 87, 208, 85, 179, 159, 157, 71, 230, 138, 243, 56, 12, - 60, 232, 60, 161, 60, 136, 155, 7, 254, 244, 125, 145, 255, 60, 40, - 143, 22, 249, 71, 147, 143, 196, 242, 49, 0, 199, 192, 29, 194, 221, - 192, 159, 206, 23, 225, 234, 0, 15, 17, 215, 93, 0, 140, 85, 138, - 48, 62, 184, 246, 63, 130, 210, 20, 209, 135, 234, 97, 182, 166, 136, - 250, 160, 135, 210, 201, 98, 249, 100, 232, 161, 185, 60, 26, 224, 217, - 66, 127, 113, 222, 113, 47, 171, 237, 99, 126, 47, 73, 3, 113, 47, - 219, 35, 219, 135, 191, 83, 234, 138, 250, 246, 170, 130, 188, 166, 250, - 56, 245, 47, 125, 139, 243, 7, 114, 38, 170, 219, 205, 244, 227, 171, - 103, 123, 58, 188, 87, 165, 111, 141, 196, 109, 154, 119, 97, 126, 188, - 197, 28, 214, 28, 243, 123, 71, 188, 19, 158, 170, 189, 62, 251, 65, - 189, 111, 252, 63, 234, 85, 234, 36, 11, 63, 202, 223, 158, 207, 181, - 99, 135, 131, 51, 134, 58, 242, 161, 116, 148, 207, 31, 190, 207, 213, - 23, 103, 122, 168, 87, 87, 40, 200, 215, 126, 252, 56, 220, 158, 79, - 142, 49, 49, 252, 187, 254, 142, 124, 104, 63, 40, 63, 74, 127, 209, - 163, 8, 95, 246, 234, 125, 7, 62, 195, 66, 199, 108, 217, 209, 217, - 145, 15, 165, 235, 244, 179, 39, 223, 163, 194, 14, 11, 189, 212, 123, - 103, 198, 183, 121, 190, 190, 80, 168, 35, 31, 21, 255, 68, 189, 169, - 100, 11, 11, 159, 39, 253, 30, 170, 15, 180, 189, 46, 201, 103, 243, - 157, 42, 189, 219, 246, 147, 230, 67, 233, 11, 55, 253, 75, 221, 125, - 237, 213, 48, 41, 62, 157, 210, 59, 235, 250, 86, 116, 228, 67, 233, - 169, 60, 114, 124, 118, 252, 101, 232, 221, 113, 157, 35, 31, 58, 30, - 148, 15, 29, 47, 41, 62, 77, 187, 133, 111, 91, 244, 141, 60, 31, - 250, 41, 197, 103, 94, 193, 96, 92, 18, 14, 124, 40, 29, 29, 39, - 218, 47, 90, 110, 207, 39, 154, 43, 172, 63, 99, 146, 214, 31, 42, - 23, 237, 23, 213, 39, 123, 62, 107, 35, 158, 236, 248, 106, 171, 35, - 31, 186, 142, 236, 245, 81, 106, 93, 24, 234, 248, 29, 209, 47, 113, - 228, 99, 191, 174, 168, 60, 116, 125, 216, 243, 121, 118, 106, 109, 100, - 191, 207, 165, 215, 169, 253, 186, 167, 252, 237, 249, 212, 186, 248, 77, - 248, 186, 165, 242, 250, 35, 55, 239, 134, 203, 71, 186, 53, 233, 43, - 205, 199, 190, 63, 82, 124, 106, 221, 156, 218, 119, 72, 47, 249, 117, - 42, 183, 190, 98, 31, 174, 236, 51, 108, 157, 52, 31, 74, 47, 39, - 207, 114, 175, 172, 193, 129, 233, 142, 124, 218, 107, 34, 248, 150, 229, - 127, 84, 55, 105, 216, 145, 95, 218, 224, 123, 245, 228, 175, 135, 243, - 225, 245, 139, 242, 23, 39, 246, 225, 167, 124, 228, 227, 192, 199, 207, - 39, 174, 227, 38, 39, 246, 240, 210, 135, 157, 249, 162, 241, 103, 212, - 61, 43, 36, 241, 155, 15, 22, 229, 41, 31, 202, 215, 65, 15, 189, - 163, 63, 82, 55, 119, 178, 190, 196, 118, 41, 253, 254, 103, 49, 124, - 220, 253, 178, 252, 173, 167, 61, 249, 42, 145, 37, 28, 228, 121, 126, - 233, 3, 239, 27, 19, 29, 249, 80, 57, 198, 70, 143, 225, 91, 175, - 168, 108, 225, 67, 249, 218, 243, 25, 210, 97, 230, 169, 63, 223, 113, - 228, 67, 233, 127, 184, 210, 134, 55, 190, 104, 202, 155, 72, 8, 31, - 183, 174, 129, 133, 159, 61, 159, 193, 189, 87, 152, 222, 27, 224, 200, - 135, 202, 111, 161, 19, 249, 92, 248, 179, 60, 191, 58, 171, 162, 3, - 159, 49, 223, 222, 202, 78, 27, 233, 200, 135, 202, 177, 174, 91, 8, - 159, 54, 163, 37, 63, 250, 165, 138, 255, 126, 65, 11, 11, 63, 123, - 62, 123, 123, 174, 121, 126, 203, 137, 31, 180, 180, 43, 210, 81, 62, - 59, 203, 253, 173, 62, 118, 59, 192, 129, 79, 210, 249, 211, 57, 139, - 147, 29, 249, 80, 124, 74, 127, 169, 109, 69, 94, 169, 142, 228, 203, - 254, 252, 143, 186, 236, 242, 222, 14, 124, 170, 63, 24, 86, 182, 231, - 100, 71, 62, 180, 63, 170, 209, 225, 124, 207, 236, 70, 22, 62, 150, - 254, 217, 253, 121, 61, 106, 216, 238, 119, 39, 246, 135, 182, 75, 233, - 199, 76, 109, 206, 119, 154, 208, 9, 214, 68, 57, 184, 146, 29, 248, - 188, 91, 254, 120, 205, 21, 227, 85, 142, 254, 75, 148, 227, 78, 147, - 62, 124, 239, 123, 181, 44, 124, 40, 95, 123, 62, 131, 78, 240, 39, - 223, 119, 178, 46, 154, 79, 142, 224, 55, 246, 220, 174, 166, 235, 131, - 174, 7, 169, 117, 218, 174, 238, 209, 249, 5, 234, 59, 242, 89, 80, - 220, 159, 223, 119, 108, 166, 154, 242, 27, 214, 176, 33, 191, 179, 250, - 30, 73, 62, 205, 158, 255, 211, 186, 240, 8, 105, 62, 148, 126, 74, - 219, 250, 124, 177, 98, 41, 146, 124, 38, 110, 57, 167, 59, 94, 82, - 154, 15, 165, 167, 114, 209, 79, 123, 62, 141, 94, 249, 232, 235, 58, - 241, 131, 84, 14, 74, 39, 39, 79, 244, 239, 217, 173, 186, 44, 145, - 30, 103, 251, 241, 150, 126, 239, 158, 183, 83, 191, 76, 233, 40, 31, - 185, 249, 138, 244, 187, 181, 104, 192, 33, 233, 126, 81, 122, 106, 103, - 165, 248, 4, 85, 174, 62, 232, 112, 39, 249, 241, 145, 147, 167, 105, - 209, 242, 81, 109, 98, 228, 229, 161, 252, 164, 248, 248, 63, 141, 236, - 52, 97, 185, 52, 31, 123, 191, 33, 197, 231, 167, 162, 197, 6, 55, - 116, 225, 119, 236, 237, 189, 148, 191, 248, 231, 110, 118, 143, 178, 107, - 164, 231, 203, 222, 127, 81, 251, 111, 207, 231, 232, 131, 239, 23, 213, - 219, 39, 237, 47, 236, 253, 14, 181, 255, 246, 124, 206, 135, 146, 75, - 223, 47, 150, 246, 95, 246, 246, 94, 202, 239, 108, 223, 165, 87, 205, - 91, 41, 237, 47, 236, 237, 180, 148, 223, 249, 35, 115, 194, 159, 191, - 46, 151, 246, 95, 246, 126, 199, 226, 207, 236, 254, 166, 183, 62, 90, - 249, 155, 101, 210, 126, 199, 222, 95, 80, 187, 237, 160, 207, 173, 22, - 148, 46, 182, 88, 218, 239, 216, 251, 13, 41, 255, 245, 106, 111, 47, - 18, 190, 72, 218, 239, 216, 219, 123, 41, 127, 145, 120, 166, 119, 163, - 161, 139, 164, 253, 142, 189, 255, 162, 246, 223, 158, 79, 133, 71, 135, - 234, 100, 79, 112, 228, 3, 35, 13, 250, 159, 3, 235, 32, 22, 62, - 113, 61, 12, 128, 207, 162, 146, 239, 123, 29, 91, 177, 65, 175, 9, - 95, 40, 157, 240, 73, 1, 124, 21, 208, 143, 129, 79, 13, 196, 133, - 189, 145, 30, 118, 106, 209, 240, 217, 206, 97, 93, 108, 40, 126, 237, - 159, 160, 169, 97, 78, 248, 180, 2, 252, 37, 106, 74, 103, 229, 227, - 92, 158, 33, 63, 44, 127, 183, 245, 78, 79, 7, 62, 29, 123, 84, - 10, 127, 244, 176, 52, 95, 120, 196, 199, 225, 159, 172, 56, 160, 206, - 76, 46, 164, 62, 84, 247, 160, 228, 122, 47, 243, 121, 96, 161, 30, - 61, 29, 199, 167, 199, 186, 225, 234, 114, 227, 11, 240, 148, 159, 28, - 159, 31, 42, 154, 78, 165, 142, 145, 230, 67, 233, 107, 77, 13, 84, - 95, 11, 146, 182, 63, 87, 43, 182, 93, 20, 196, 59, 155, 47, 21, - 62, 14, 9, 251, 182, 88, 184, 250, 206, 229, 146, 225, 159, 254, 241, - 121, 120, 210, 59, 211, 37, 227, 240, 135, 155, 126, 184, 118, 173, 191, - 52, 31, 216, 209, 169, 89, 126, 82, 124, 148, 235, 79, 108, 45, 82, - 223, 91, 146, 207, 71, 239, 235, 195, 72, 95, 250, 219, 147, 177, 146, - 253, 42, 189, 84, 23, 217, 177, 66, 9, 73, 62, 180, 63, 86, 126, - 206, 249, 76, 79, 171, 81, 119, 89, 7, 199, 126, 81, 58, 58, 206, - 116, 254, 165, 248, 124, 233, 83, 37, 238, 215, 182, 210, 124, 172, 244, - 174, 251, 165, 188, 244, 219, 68, 252, 21, 51, 233, 117, 65, 215, 23, - 93, 111, 206, 249, 124, 91, 228, 85, 133, 137, 211, 43, 185, 224, 67, - 215, 5, 229, 231, 156, 79, 195, 154, 35, 124, 26, 205, 114, 228, 67, - 199, 133, 246, 175, 97, 31, 15, 245, 233, 47, 102, 74, 251, 193, 18, - 239, 212, 27, 53, 158, 72, 242, 169, 188, 178, 159, 186, 243, 177, 109, - 178, 250, 156, 214, 122, 122, 67, 117, 180, 52, 31, 42, 7, 229, 39, - 197, 167, 125, 249, 23, 126, 198, 9, 210, 243, 69, 245, 71, 174, 95, - 253, 111, 92, 125, 118, 241, 125, 71, 62, 148, 126, 151, 190, 135, 122, - 111, 110, 140, 236, 248, 132, 127, 215, 185, 70, 210, 24, 105, 62, 67, - 186, 232, 212, 77, 179, 238, 88, 248, 73, 241, 41, 126, 229, 253, 125, - 159, 196, 72, 243, 161, 235, 147, 242, 147, 148, 167, 232, 173, 50, 209, - 78, 246, 41, 116, 92, 105, 127, 228, 228, 185, 227, 251, 176, 89, 191, - 4, 71, 62, 180, 253, 122, 95, 111, 83, 207, 106, 63, 74, 150, 79, - 205, 63, 190, 76, 111, 50, 200, 145, 143, 241, 159, 250, 252, 174, 226, - 59, 212, 3, 162, 138, 241, 37, 247, 13, 81, 95, 56, 95, 134, 159, - 113, 63, 82, 218, 174, 86, 48, 126, 98, 10, 147, 230, 19, 21, 89, - 157, 31, 223, 234, 140, 133, 159, 20, 159, 11, 85, 230, 45, 15, 110, - 227, 200, 103, 211, 80, 141, 122, 254, 174, 40, 254, 231, 207, 138, 169, - 23, 118, 234, 101, 177, 247, 82, 124, 244, 229, 91, 108, 14, 122, 87, - 154, 15, 165, 167, 118, 95, 138, 79, 71, 223, 97, 39, 215, 140, 113, - 102, 159, 233, 250, 166, 235, 157, 250, 69, 231, 124, 22, 93, 234, 20, - 221, 105, 167, 210, 5, 31, 74, 239, 218, 191, 119, 184, 60, 126, 84, - 202, 9, 95, 7, 62, 19, 115, 167, 171, 79, 148, 188, 162, 14, 191, - 223, 82, 221, 165, 231, 69, 217, 245, 94, 190, 251, 146, 222, 113, 245, - 28, 251, 69, 233, 40, 31, 57, 251, 188, 185, 89, 193, 196, 143, 148, - 206, 198, 199, 188, 47, 166, 251, 219, 153, 199, 199, 241, 5, 55, 244, - 230, 23, 116, 236, 196, 191, 8, 25, 239, 192, 231, 80, 171, 10, 21, - 171, 196, 57, 198, 9, 148, 158, 238, 151, 55, 44, 25, 203, 215, 185, - 85, 223, 194, 207, 158, 79, 118, 129, 17, 39, 149, 201, 210, 242, 208, - 246, 9, 241, 131, 75, 39, 57, 206, 234, 142, 119, 98, 202, 148, 116, - 148, 135, 202, 241, 227, 216, 222, 124, 183, 168, 210, 22, 121, 36, 245, - 240, 89, 209, 243, 35, 156, 216, 67, 122, 254, 72, 207, 71, 135, 204, - 47, 196, 7, 53, 84, 242, 147, 7, 120, 240, 233, 67, 111, 59, 196, - 99, 167, 130, 126, 44, 208, 101, 172, 244, 249, 42, 229, 71, 233, 41, - 63, 135, 115, 63, 255, 95, 61, 127, 156, 227, 200, 199, 158, 110, 242, - 180, 95, 213, 59, 127, 121, 166, 126, 248, 213, 35, 117, 178, 49, 219, - 65, 158, 23, 133, 195, 218, 247, 143, 117, 228, 179, 242, 69, 97, 126, - 203, 221, 99, 22, 57, 40, 125, 197, 80, 194, 47, 85, 108, 118, 224, - 115, 172, 232, 176, 175, 11, 12, 148, 63, 167, 165, 252, 40, 127, 123, - 62, 158, 145, 233, 109, 51, 182, 72, 243, 177, 151, 75, 234, 252, 121, - 107, 196, 193, 150, 77, 122, 59, 242, 41, 189, 110, 158, 186, 142, 223, - 113, 203, 186, 146, 243, 131, 15, 130, 87, 52, 29, 49, 76, 154, 15, - 93, 175, 114, 235, 180, 87, 212, 66, 62, 179, 139, 52, 31, 42, 199, - 149, 247, 151, 169, 183, 109, 218, 40, 201, 231, 89, 224, 79, 229, 255, - 76, 148, 246, 59, 212, 79, 200, 241, 89, 20, 20, 82, 97, 177, 19, - 62, 148, 158, 250, 29, 57, 62, 79, 131, 119, 222, 75, 73, 114, 228, - 67, 245, 165, 231, 195, 108, 117, 243, 71, 155, 212, 31, 55, 123, 160, - 94, 90, 101, 172, 164, 254, 92, 170, 88, 213, 216, 195, 201, 121, 84, - 161, 225, 155, 213, 29, 234, 122, 242, 252, 150, 189, 234, 106, 253, 127, - 87, 83, 125, 150, 146, 231, 96, 189, 97, 165, 10, 143, 151, 30, 103, - 202, 135, 242, 149, 226, 19, 242, 131, 127, 139, 1, 113, 210, 242, 80, - 57, 166, 86, 188, 161, 254, 102, 173, 175, 36, 159, 98, 47, 202, 191, - 184, 148, 34, 205, 135, 210, 167, 84, 248, 90, 189, 108, 118, 61, 73, - 62, 251, 94, 76, 48, 221, 117, 194, 135, 250, 97, 58, 95, 179, 207, - 156, 85, 15, 169, 95, 64, 58, 254, 201, 57, 114, 107, 247, 68, 105, - 62, 116, 158, 40, 63, 41, 62, 115, 210, 190, 206, 60, 95, 219, 201, - 254, 93, 140, 47, 40, 63, 57, 121, 58, 254, 240, 124, 217, 59, 225, - 210, 124, 40, 253, 131, 15, 207, 169, 55, 123, 254, 44, 25, 143, 109, - 184, 112, 113, 101, 201, 72, 71, 62, 163, 38, 246, 83, 251, 165, 175, - 13, 167, 124, 228, 226, 58, 239, 61, 151, 183, 245, 104, 39, 205, 135, - 202, 33, 215, 175, 197, 187, 110, 110, 50, 105, 28, 249, 208, 113, 165, - 227, 76, 215, 135, 20, 159, 202, 7, 185, 251, 163, 227, 165, 249, 80, - 122, 185, 117, 186, 124, 95, 229, 202, 117, 157, 216, 121, 186, 30, 40, - 189, 156, 60, 65, 23, 123, 134, 244, 26, 46, 205, 135, 174, 51, 57, - 121, 12, 23, 70, 104, 150, 56, 57, 15, 167, 246, 129, 234, 15, 141, - 55, 165, 248, 156, 34, 19, 31, 38, 166, 72, 243, 161, 227, 44, 23, - 175, 22, 244, 39, 215, 207, 57, 177, 99, 116, 157, 211, 254, 209, 241, - 145, 242, 167, 215, 125, 111, 55, 42, 224, 36, 110, 73, 158, 83, 146, - 247, 60, 250, 167, 197, 126, 81, 255, 37, 37, 207, 250, 197, 217, 71, - 251, 213, 147, 230, 67, 237, 134, 156, 61, 28, 246, 151, 209, 71, 61, - 69, 122, 124, 44, 114, 201, 200, 51, 56, 199, 103, 224, 218, 46, 210, - 124, 232, 60, 81, 126, 82, 124, 174, 63, 217, 152, 115, 246, 61, 233, - 253, 14, 93, 87, 114, 246, 103, 209, 189, 207, 175, 15, 119, 194, 103, - 121, 102, 17, 254, 244, 132, 38, 150, 184, 240, 137, 255, 53, 245, 198, - 181, 93, 36, 237, 170, 70, 245, 91, 185, 105, 19, 165, 249, 208, 243, - 190, 30, 63, 87, 230, 91, 248, 197, 75, 242, 233, 19, 244, 193, 31, - 151, 147, 164, 159, 55, 209, 184, 85, 46, 94, 213, 212, 249, 99, 194, - 130, 34, 222, 46, 248, 152, 233, 169, 92, 82, 124, 146, 15, 196, 250, - 23, 94, 237, 228, 60, 92, 164, 163, 253, 251, 113, 74, 13, 190, 212, - 39, 210, 254, 107, 76, 147, 57, 69, 50, 156, 244, 107, 82, 183, 32, - 254, 135, 49, 196, 18, 63, 203, 241, 249, 218, 235, 250, 133, 220, 9, - 210, 242, 80, 122, 202, 79, 138, 207, 35, 245, 55, 10, 221, 104, 34, - 25, 207, 91, 248, 201, 240, 201, 254, 113, 235, 203, 211, 19, 157, 237, - 47, 204, 231, 116, 84, 31, 229, 206, 235, 188, 106, 221, 158, 181, 249, - 47, 79, 73, 127, 97, 245, 55, 102, 190, 146, 231, 108, 133, 239, 207, - 46, 88, 95, 41, 185, 31, 164, 118, 85, 46, 110, 25, 244, 195, 186, - 33, 225, 45, 137, 36, 31, 43, 253, 60, 144, 199, 91, 146, 207, 111, - 223, 110, 26, 88, 188, 141, 82, 50, 110, 177, 198, 43, 51, 128, 79, - 35, 73, 62, 247, 182, 213, 237, 210, 151, 151, 142, 127, 172, 244, 174, - 229, 185, 184, 99, 98, 151, 153, 173, 156, 237, 187, 205, 244, 84, 30, - 185, 245, 222, 243, 86, 244, 232, 33, 33, 68, 146, 143, 149, 254, 16, - 220, 15, 146, 228, 243, 211, 189, 238, 201, 53, 131, 156, 228, 129, 88, - 232, 233, 58, 47, 3, 215, 68, 73, 62, 235, 107, 235, 135, 159, 15, - 113, 197, 135, 210, 187, 150, 231, 23, 191, 207, 199, 84, 11, 112, 242, - 28, 214, 178, 79, 238, 202, 19, 253, 44, 89, 121, 170, 247, 188, 218, - 175, 126, 5, 87, 124, 40, 189, 107, 59, 182, 58, 156, 211, 189, 104, - 225, 100, 156, 245, 83, 1, 127, 152, 69, 30, 43, 95, 231, 124, 38, - 189, 31, 89, 100, 92, 69, 105, 62, 148, 158, 158, 35, 72, 241, 81, - 77, 62, 93, 244, 101, 89, 105, 62, 148, 94, 238, 28, 96, 140, 86, - 251, 169, 103, 41, 105, 62, 148, 190, 152, 49, 133, 255, 176, 167, 116, - 60, 223, 161, 247, 210, 175, 7, 213, 113, 228, 67, 233, 169, 253, 138, - 237, 253, 46, 191, 194, 197, 185, 86, 213, 187, 59, 83, 31, 133, 74, - 243, 161, 244, 114, 242, 68, 189, 106, 53, 179, 78, 13, 71, 62, 148, - 158, 202, 67, 237, 190, 228, 121, 230, 181, 202, 11, 87, 134, 73, 243, - 161, 244, 207, 63, 104, 198, 103, 166, 253, 45, 233, 223, 151, 101, 37, - 44, 14, 115, 50, 239, 148, 142, 242, 145, 139, 15, 219, 121, 15, 158, - 254, 155, 11, 62, 148, 158, 158, 111, 74, 230, 21, 212, 169, 183, 114, - 67, 43, 23, 126, 80, 244, 95, 114, 241, 207, 142, 163, 202, 191, 234, - 141, 145, 230, 67, 233, 229, 250, 197, 31, 62, 248, 251, 139, 81, 142, - 124, 168, 28, 212, 191, 203, 237, 79, 163, 79, 126, 235, 59, 125, 140, - 52, 31, 74, 47, 215, 175, 109, 198, 46, 197, 218, 59, 217, 167, 80, - 122, 42, 143, 156, 125, 158, 114, 178, 74, 133, 214, 99, 164, 249, 80, - 122, 185, 253, 242, 224, 27, 147, 159, 255, 250, 190, 252, 121, 157, 125, - 62, 163, 179, 60, 97, 227, 27, 200, 63, 196, 60, 225, 168, 229, 210, - 121, 194, 246, 121, 131, 82, 124, 48, 79, 184, 209, 218, 252, 231, 121, - 98, 158, 112, 199, 109, 210, 121, 131, 246, 121, 172, 174, 242, 132, 159, - 28, 145, 207, 239, 149, 227, 131, 121, 194, 123, 214, 73, 243, 161, 249, - 175, 114, 249, 144, 152, 39, 188, 254, 134, 116, 126, 166, 125, 30, 173, - 171, 60, 225, 29, 253, 164, 243, 123, 237, 243, 52, 93, 229, 9, 143, - 12, 249, 159, 207, 19, 182, 207, 127, 166, 227, 230, 44, 79, 56, 152, - 228, 63, 207, 28, 243, 132, 123, 105, 229, 207, 177, 237, 243, 241, 157, - 230, 9, 199, 73, 231, 9, 219, 231, 205, 75, 233, 51, 230, 9, 127, - 241, 6, 242, 249, 49, 79, 216, 217, 121, 184, 125, 126, 175, 220, 124, - 97, 158, 240, 169, 47, 164, 249, 216, 247, 203, 85, 158, 240, 170, 141, - 242, 249, 189, 114, 242, 96, 158, 240, 242, 126, 210, 124, 168, 60, 114, - 235, 11, 243, 132, 191, 237, 146, 255, 124, 45, 204, 19, 238, 177, 60, - 255, 249, 90, 152, 39, 124, 232, 88, 254, 243, 172, 48, 79, 184, 210, - 172, 252, 231, 125, 97, 158, 112, 201, 245, 249, 207, 179, 194, 60, 225, - 153, 107, 242, 159, 247, 133, 121, 194, 186, 133, 249, 207, 215, 194, 60, - 97, 223, 207, 243, 159, 175, 133, 121, 194, 35, 230, 230, 63, 95, 11, - 243, 132, 191, 158, 150, 255, 124, 45, 204, 19, 46, 31, 39, 127, 110, - 35, 151, 223, 139, 121, 194, 67, 231, 120, 75, 230, 9, 219, 231, 27, - 211, 243, 10, 103, 121, 194, 51, 150, 75, 231, 175, 210, 117, 33, 151, - 191, 138, 121, 194, 207, 207, 201, 231, 247, 202, 229, 121, 98, 158, 240, - 227, 69, 242, 249, 189, 114, 249, 198, 152, 39, 220, 252, 158, 124, 222, - 178, 125, 158, 175, 179, 60, 225, 139, 38, 233, 188, 83, 251, 124, 99, - 87, 121, 194, 219, 226, 228, 243, 177, 229, 248, 200, 229, 9, 187, 155, - 79, 219, 218, 239, 214, 162, 181, 225, 249, 207, 167, 197, 60, 225, 240, - 140, 252, 231, 247, 98, 158, 240, 222, 21, 249, 207, 55, 198, 60, 225, - 57, 67, 243, 159, 255, 140, 121, 194, 63, 116, 201, 255, 247, 83, 48, - 79, 248, 206, 128, 252, 127, 63, 5, 243, 132, 47, 68, 230, 255, 123, - 37, 152, 39, 236, 63, 60, 255, 223, 115, 193, 60, 225, 228, 33, 249, - 255, 94, 9, 230, 9, 251, 13, 205, 255, 247, 92, 48, 79, 56, 116, - 88, 254, 191, 159, 130, 121, 194, 127, 15, 207, 255, 247, 83, 48, 79, - 248, 240, 136, 252, 127, 63, 5, 243, 132, 87, 140, 200, 255, 247, 83, - 48, 79, 56, 96, 182, 171, 60, 97, 154, 63, 228, 58, 255, 16, 243, - 132, 231, 244, 245, 118, 35, 143, 145, 230, 247, 154, 243, 134, 157, 229, - 9, 159, 157, 226, 42, 79, 216, 54, 207, 216, 85, 158, 240, 190, 246, - 210, 121, 194, 238, 230, 139, 98, 158, 240, 166, 175, 228, 243, 123, 229, - 242, 199, 48, 79, 56, 97, 190, 52, 31, 154, 183, 33, 151, 111, 140, - 121, 194, 103, 141, 68, 54, 159, 86, 238, 121, 1, 230, 9, 87, 89, - 43, 159, 111, 44, 247, 188, 0, 243, 132, 31, 157, 83, 186, 200, 55, - 54, 231, 209, 202, 229, 247, 98, 158, 240, 142, 155, 133, 100, 243, 141, - 229, 242, 159, 49, 79, 56, 118, 135, 124, 126, 175, 220, 56, 99, 158, - 176, 223, 110, 105, 62, 180, 95, 114, 250, 131, 121, 194, 251, 77, 69, - 92, 172, 11, 251, 124, 124, 233, 60, 225, 217, 239, 87, 114, 35, 223, - 216, 245, 186, 192, 60, 225, 239, 38, 86, 146, 205, 203, 149, 155, 47, - 204, 19, 94, 56, 71, 58, 191, 215, 221, 188, 38, 204, 19, 62, 244, - 169, 124, 190, 177, 92, 94, 46, 230, 9, 107, 102, 75, 207, 23, 165, - 151, 211, 31, 204, 19, 174, 59, 93, 58, 47, 215, 221, 124, 90, 204, - 19, 254, 104, 190, 124, 190, 177, 92, 30, 8, 230, 9, 199, 175, 144, - 207, 55, 150, 91, 239, 152, 39, 252, 217, 52, 249, 124, 45, 185, 113, - 198, 60, 225, 47, 22, 72, 63, 55, 183, 207, 219, 114, 149, 39, 124, - 106, 181, 116, 126, 175, 125, 254, 142, 171, 60, 97, 238, 176, 124, 190, - 177, 220, 57, 54, 230, 9, 159, 217, 35, 159, 223, 75, 243, 133, 93, - 229, 9, 159, 253, 92, 154, 143, 253, 247, 75, 92, 229, 9, 191, 59, - 159, 184, 145, 223, 235, 122, 189, 99, 158, 112, 102, 123, 111, 23, 124, - 168, 127, 119, 157, 111, 140, 121, 194, 83, 155, 74, 231, 9, 219, 231, - 249, 186, 202, 19, 94, 122, 94, 58, 79, 152, 218, 83, 57, 62, 152, - 39, 156, 244, 151, 124, 94, 46, 125, 158, 70, 247, 187, 206, 242, 132, - 175, 45, 145, 206, 19, 182, 127, 30, 39, 181, 95, 198, 60, 225, 220, - 185, 210, 242, 208, 231, 148, 114, 207, 25, 49, 79, 248, 143, 123, 210, - 121, 194, 246, 207, 229, 92, 229, 9, 47, 158, 45, 253, 220, 193, 62, - 63, 87, 234, 253, 36, 167, 130, 46, 21, 216, 246, 161, 244, 249, 170, - 125, 158, 177, 212, 121, 38, 230, 9, 215, 25, 47, 157, 39, 76, 243, - 152, 104, 30, 145, 84, 190, 49, 230, 9, 59, 123, 127, 2, 205, 199, - 165, 121, 64, 22, 126, 18, 249, 207, 152, 39, 252, 60, 45, 255, 249, - 189, 152, 39, 28, 213, 53, 255, 249, 198, 152, 39, 124, 234, 75, 249, - 188, 92, 185, 252, 94, 204, 19, 94, 188, 76, 62, 223, 152, 174, 91, - 87, 121, 194, 157, 210, 165, 249, 208, 188, 58, 57, 255, 142, 121, 194, - 37, 63, 146, 246, 59, 148, 143, 156, 63, 93, 24, 20, 82, 97, 196, - 71, 210, 121, 194, 148, 143, 156, 223, 193, 60, 97, 253, 60, 233, 60, - 97, 251, 124, 61, 154, 103, 231, 44, 79, 120, 211, 34, 249, 188, 92, - 154, 175, 231, 42, 79, 248, 241, 28, 233, 113, 182, 207, 59, 118, 149, - 39, 188, 118, 137, 124, 126, 175, 92, 158, 30, 230, 9, 215, 214, 19, - 217, 124, 27, 185, 231, 185, 152, 39, 92, 90, 47, 157, 223, 235, 110, - 126, 29, 230, 9, 183, 155, 37, 159, 111, 76, 231, 203, 85, 158, 112, - 253, 31, 229, 243, 123, 229, 226, 13, 204, 19, 222, 112, 72, 154, 143, - 187, 121, 185, 152, 39, 252, 231, 62, 34, 155, 175, 37, 199, 7, 243, - 132, 55, 237, 146, 207, 55, 150, 203, 91, 198, 60, 97, 206, 32, 159, - 223, 43, 55, 206, 152, 39, 252, 241, 199, 210, 124, 220, 205, 239, 197, - 60, 225, 139, 75, 165, 243, 123, 221, 205, 55, 198, 60, 225, 175, 22, - 203, 231, 27, 211, 245, 230, 42, 79, 120, 248, 114, 249, 188, 83, 57, - 253, 193, 60, 225, 249, 122, 249, 124, 99, 185, 113, 198, 60, 225, 6, - 243, 164, 243, 132, 237, 191, 247, 64, 251, 235, 44, 79, 248, 249, 92, - 23, 121, 194, 162, 223, 146, 179, 27, 152, 39, 252, 197, 121, 249, 124, - 99, 57, 187, 129, 121, 194, 135, 166, 74, 143, 15, 149, 71, 46, 15, - 4, 243, 132, 7, 164, 203, 231, 27, 203, 237, 11, 48, 79, 56, 104, - 134, 252, 247, 34, 229, 214, 41, 230, 9, 47, 153, 33, 157, 223, 235, - 152, 175, 39, 157, 39, 60, 101, 150, 52, 31, 154, 31, 44, 151, 151, - 139, 121, 194, 181, 230, 17, 217, 252, 94, 107, 252, 42, 157, 39, 60, - 230, 161, 82, 246, 253, 54, 114, 253, 194, 60, 225, 199, 131, 228, 243, - 114, 173, 121, 213, 210, 121, 194, 81, 243, 228, 243, 163, 228, 226, 103, - 204, 19, 86, 206, 118, 33, 143, 155, 249, 198, 152, 39, 156, 150, 74, - 100, 191, 247, 39, 55, 95, 152, 39, 220, 120, 150, 116, 158, 176, 187, - 223, 23, 198, 60, 225, 238, 74, 233, 60, 97, 251, 188, 99, 87, 121, - 194, 207, 206, 121, 203, 230, 247, 202, 217, 85, 204, 19, 62, 156, 37, - 157, 39, 76, 243, 113, 229, 242, 141, 49, 79, 248, 254, 30, 111, 217, - 252, 94, 185, 124, 45, 204, 19, 94, 111, 116, 149, 39, 76, 243, 131, - 93, 231, 27, 99, 158, 240, 123, 251, 189, 101, 243, 123, 229, 228, 193, - 60, 225, 85, 223, 72, 231, 9, 211, 124, 92, 185, 124, 54, 204, 19, - 190, 114, 198, 157, 252, 94, 215, 235, 20, 243, 132, 235, 127, 227, 138, - 15, 205, 15, 118, 157, 223, 139, 121, 194, 191, 124, 235, 78, 126, 47, - 205, 23, 150, 206, 19, 62, 127, 211, 21, 31, 247, 242, 159, 49, 79, - 216, 243, 168, 124, 126, 175, 156, 60, 152, 39, 252, 225, 13, 249, 252, - 94, 185, 115, 0, 204, 19, 246, 184, 45, 159, 223, 43, 151, 111, 140, - 121, 194, 47, 238, 74, 243, 161, 249, 184, 114, 249, 198, 152, 39, 252, - 233, 69, 249, 252, 94, 57, 187, 138, 121, 194, 69, 142, 72, 243, 161, - 242, 200, 229, 27, 99, 158, 240, 143, 87, 228, 243, 123, 229, 228, 193, - 60, 225, 152, 195, 210, 124, 236, 243, 124, 93, 229, 9, 31, 185, 33, - 159, 223, 43, 199, 7, 243, 132, 43, 184, 224, 99, 255, 254, 3, 87, - 121, 194, 239, 236, 151, 207, 239, 149, 243, 95, 152, 39, 124, 97, 190, - 52, 31, 119, 191, 111, 133, 121, 194, 158, 159, 200, 231, 247, 202, 249, - 119, 204, 19, 158, 60, 95, 154, 143, 253, 247, 210, 92, 229, 9, 239, - 250, 88, 62, 191, 87, 78, 30, 204, 19, 222, 55, 95, 154, 143, 187, - 223, 7, 193, 60, 97, 63, 39, 207, 29, 162, 90, 19, 225, 157, 247, - 198, 34, 177, 94, 65, 204, 239, 179, 37, 52, 166, 126, 0, 113, 146, - 70, 196, 197, 251, 7, 4, 4, 18, 155, 63, 78, 68, 79, 253, 251, - 177, 130, 72, 252, 233, 129, 111, 174, 151, 153, 87, 78, 193, 88, 47, - 125, 225, 88, 175, 236, 66, 86, 222, 246, 127, 133, 197, 223, 35, 68, - 198, 186, 159, 35, 249, 182, 169, 179, 96, 215, 168, 111, 92, 173, 214, - 49, 77, 235, 122, 119, 249, 243, 243, 167, 104, 88, 252, 42, 196, 147, - 40, 152, 95, 149, 195, 119, 38, 123, 138, 237, 138, 50, 146, 28, 143, - 88, 47, 44, 63, 142, 229, 208, 126, 35, 177, 157, 246, 245, 251, 26, - 215, 60, 173, 204, 39, 152, 106, 240, 243, 110, 156, 125, 165, 152, 172, - 48, 117, 128, 178, 117, 80, 54, 220, 84, 195, 128, 101, 175, 166, 41, - 76, 103, 43, 198, 26, 159, 7, 119, 228, 245, 141, 202, 91, 240, 176, - 236, 5, 148, 77, 106, 84, 222, 130, 215, 237, 204, 24, 227, 233, 123, - 215, 212, 254, 223, 22, 183, 148, 105, 161, 236, 36, 148, 53, 254, 182, - 184, 133, 246, 196, 193, 95, 255, 31, 123, 95, 1, 87, 213, 182, 173, - 191, 232, 110, 65, 58, 164, 148, 6, 233, 70, 148, 84, 80, 164, 67, - 233, 238, 6, 165, 149, 80, 26, 165, 20, 65, 5, 233, 110, 16, 73, - 105, 164, 59, 5, 105, 9, 165, 164, 255, 123, 123, 166, 247, 112, 125, - 231, 220, 115, 239, 123, 239, 190, 247, 126, 255, 115, 182, 191, 15, 215, - 94, 107, 206, 49, 190, 49, 230, 152, 177, 214, 158, 115, 46, 201, 171, - 122, 66, 117, 125, 223, 109, 57, 245, 129, 32, 196, 83, 215, 71, 121, - 117, 50, 176, 115, 67, 103, 206, 57, 195, 206, 73, 195, 206, 13, 132, - 123, 215, 253, 56, 247, 1, 150, 247, 10, 236, 92, 239, 153, 115, 112, - 219, 220, 225, 239, 200, 130, 249, 149, 3, 216, 22, 9, 59, 254, 225, - 149, 155, 103, 142, 241, 207, 28, 247, 160, 255, 122, 28, 121, 230, 248, - 230, 153, 227, 127, 245, 243, 183, 247, 129, 97, 252, 193, 251, 8, 255, - 224, 58, 254, 31, 92, 135, 115, 255, 135, 239, 99, 252, 131, 235, 55, - 255, 193, 117, 6, 248, 251, 167, 96, 49, 203, 242, 183, 119, 99, 34, - 126, 127, 239, 37, 124, 239, 115, 248, 155, 164, 16, 192, 49, 42, 132, - 1, 161, 67, 104, 16, 45, 116, 250, 221, 238, 17, 16, 227, 108, 127, - 203, 183, 9, 27, 223, 62, 130, 181, 89, 241, 176, 255, 3, 197, 167, - 198, 138, 197, 60, 23, 213, 126, 183, 13, 11, 131, 197, 199, 225, 125, - 244, 31, 239, 168, 253, 117, 206, 242, 223, 242, 253, 34, 231, 87, 185, - 191, 47, 7, 37, 224, 63, 202, 249, 241, 222, 197, 255, 120, 12, 228, - 192, 142, 206, 2, 130, 190, 193, 226, 11, 9, 241, 111, 114, 16, 64, - 155, 33, 5, 179, 31, 230, 132, 20, 20, 115, 52, 186, 51, 117, 236, - 108, 28, 220, 144, 178, 181, 115, 178, 55, 49, 130, 12, 156, 77, 28, - 45, 12, 172, 207, 180, 25, 103, 142, 124, 37, 126, 197, 223, 181, 26, - 191, 115, 30, 250, 157, 116, 127, 255, 57, 253, 155, 255, 127, 121, 247, - 215, 175, 121, 127, 149, 251, 115, 124, 211, 162, 252, 126, 155, 244, 159, - 173, 7, 55, 129, 92, 50, 96, 45, 194, 217, 183, 95, 34, 194, 234, - 216, 143, 55, 145, 254, 174, 221, 190, 18, 191, 141, 95, 108, 249, 81, - 14, 112, 223, 211, 157, 241, 109, 202, 25, 91, 110, 72, 57, 26, 24, - 26, 90, 56, 67, 223, 75, 227, 215, 54, 28, 241, 255, 104, 57, 232, - 35, 253, 123, 202, 1, 46, 247, 223, 85, 14, 170, 176, 62, 52, 3, - 200, 162, 254, 187, 24, 255, 245, 163, 122, 77, 213, 196, 253, 55, 206, - 255, 90, 14, 190, 176, 250, 156, 34, 249, 123, 186, 126, 125, 215, 247, - 127, 228, 9, 183, 231, 87, 63, 35, 254, 75, 254, 145, 191, 1, 139, - 81, 132, 95, 234, 54, 41, 224, 254, 247, 237, 5, 60, 141, 147, 185, - 129, 177, 157, 27, 135, 179, 153, 193, 79, 253, 255, 247, 15, 39, 167, - 179, 137, 187, 179, 139, 163, 137, 19, 231, 153, 132, 240, 80, 251, 126, - 82, 247, 183, 115, 255, 207, 126, 244, 215, 143, 255, 105, 199, 32, 252, - 221, 49, 194, 223, 149, 211, 12, 244, 203, 88, 226, 28, 56, 38, 1, - 233, 217, 36, 255, 94, 198, 77, 58, 165, 239, 233, 224, 231, 225, 199, - 191, 202, 253, 149, 134, 36, 236, 31, 45, 58, 124, 114, 237, 191, 25, - 8, 255, 69, 64, 255, 199, 129, 240, 191, 140, 255, 43, 54, 35, 254, - 15, 227, 127, 195, 23, 255, 200, 94, 164, 223, 0, 242, 127, 19, 126, - 75, 246, 63, 242, 199, 255, 132, 221, 191, 101, 39, 202, 25, 160, 254, - 55, 227, 172, 236, 223, 242, 203, 191, 195, 15, 255, 200, 110, 228, 223, - 176, 21, 13, 0, 29, 0, 227, 55, 128, 249, 7, 248, 173, 60, 63, - 228, 253, 144, 255, 179, 79, 144, 255, 13, 126, 248, 61, 219, 145, 207, - 216, 140, 246, 147, 157, 112, 254, 88, 48, 96, 3, 224, 156, 1, 238, - 191, 136, 179, 121, 127, 200, 195, 250, 201, 71, 232, 103, 252, 113, 214, - 15, 255, 85, 31, 252, 108, 251, 217, 50, 63, 107, 247, 89, 123, 127, - 216, 136, 7, 159, 24, 11, 3, 1, 12, 132, 0, 68, 0, 231, 254, - 73, 252, 72, 255, 35, 63, 1, 144, 137, 119, 198, 55, 103, 253, 113, - 214, 15, 63, 199, 194, 127, 198, 7, 63, 219, 126, 182, 204, 127, 148, - 55, 22, 224, 241, 195, 94, 66, 192, 157, 24, 6, 18, 24, 206, 195, - 64, 10, 159, 20, 7, 159, 136, 15, 64, 241, 79, 226, 71, 122, 50, - 32, 227, 60, 144, 73, 12, 116, 16, 158, 241, 7, 14, 224, 242, 35, - 30, 126, 43, 22, 254, 21, 251, 255, 200, 118, 76, 224, 123, 60, 80, - 46, 68, 128, 27, 41, 224, 76, 9, 3, 53, 252, 97, 48, 252, 65, - 55, 124, 17, 38, 12, 23, 224, 15, 243, 1, 24, 254, 0, 63, 210, - 93, 0, 121, 105, 129, 44, 106, 32, 155, 28, 232, 34, 1, 186, 9, - 0, 23, 236, 51, 177, 240, 95, 241, 193, 207, 245, 253, 172, 237, 63, - 202, 28, 255, 140, 221, 100, 128, 23, 13, 224, 12, 183, 129, 9, 134, - 139, 48, 176, 192, 192, 10, 3, 27, 124, 114, 54, 0, 199, 31, 224, - 71, 58, 54, 144, 151, 5, 200, 98, 2, 178, 47, 0, 93, 148, 64, - 247, 15, 63, 224, 159, 137, 133, 179, 62, 248, 185, 61, 248, 87, 203, - 254, 172, 237, 184, 192, 223, 231, 64, 25, 252, 176, 27, 94, 94, 204, - 128, 43, 156, 59, 23, 124, 114, 6, 12, 188, 240, 69, 94, 240, 5, - 126, 48, 8, 194, 32, 4, 159, 204, 244, 7, 16, 2, 105, 5, 64, - 94, 94, 32, 139, 11, 200, 102, 1, 186, 232, 207, 248, 129, 20, 112, - 34, 0, 28, 207, 250, 224, 95, 137, 129, 223, 179, 29, 19, 248, 150, - 0, 212, 65, 184, 223, 169, 64, 89, 48, 129, 114, 226, 4, 92, 225, - 220, 69, 224, 147, 61, 225, 63, 160, 195, 112, 5, 134, 171, 240, 197, - 119, 48, 200, 192, 32, 11, 32, 247, 19, 126, 156, 151, 1, 105, 175, - 130, 188, 146, 64, 150, 8, 144, 205, 11, 116, 177, 2, 221, 23, 0, - 23, 50, 192, 141, 0, 112, 197, 252, 7, 62, 248, 103, 202, 30, 5, - 180, 169, 24, 160, 110, 225, 3, 31, 147, 129, 186, 8, 247, 255, 37, - 16, 179, 188, 160, 220, 224, 60, 165, 129, 29, 138, 48, 40, 193, 112, - 19, 6, 21, 24, 84, 225, 63, 120, 194, 39, 31, 254, 1, 212, 64, - 90, 21, 144, 87, 9, 200, 146, 5, 178, 197, 129, 46, 94, 160, 251, - 18, 224, 66, 13, 184, 157, 3, 92, 177, 1, 119, 180, 159, 234, 193, - 239, 197, 192, 63, 138, 123, 60, 80, 199, 72, 129, 175, 127, 216, 206, - 5, 226, 84, 12, 112, 147, 135, 65, 25, 240, 215, 132, 47, 56, 128, - 225, 46, 252, 135, 13, 248, 143, 0, 240, 133, 75, 48, 152, 192, 96, - 250, 59, 48, 1, 105, 140, 64, 158, 187, 64, 134, 38, 144, 169, 12, - 116, 72, 3, 157, 2, 128, 195, 15, 31, 80, 1, 142, 68, 128, 51, - 214, 191, 16, 3, 191, 85, 246, 103, 227, 158, 4, 212, 181, 11, 103, - 108, 135, 199, 163, 4, 40, 27, 37, 80, 118, 58, 128, 59, 220, 30, - 75, 24, 108, 96, 176, 135, 47, 106, 131, 79, 4, 129, 47, 38, 131, - 193, 245, 119, 224, 2, 210, 56, 130, 60, 54, 64, 134, 41, 144, 169, - 3, 116, 40, 1, 157, 18, 128, 195, 15, 31, 92, 0, 28, 73, 126, - 170, 7, 191, 21, 3, 127, 20, 251, 63, 151, 61, 25, 104, 111, 152, - 64, 220, 9, 0, 253, 240, 186, 123, 11, 6, 45, 192, 209, 28, 6, - 91, 96, 135, 7, 12, 94, 240, 9, 219, 48, 248, 195, 240, 0, 134, - 135, 48, 4, 194, 16, 244, 19, 2, 193, 181, 7, 32, 173, 47, 200, - 235, 1, 100, 217, 2, 217, 6, 64, 215, 45, 160, 91, 2, 112, 225, - 0, 220, 104, 0, 215, 159, 99, 224, 31, 213, 129, 179, 246, 255, 136, - 253, 179, 245, 254, 71, 217, 211, 131, 118, 135, 23, 196, 159, 44, 224, - 161, 13, 226, 214, 26, 112, 189, 15, 108, 128, 219, 21, 10, 67, 4, - 12, 209, 240, 137, 82, 240, 201, 136, 48, 196, 194, 16, 247, 19, 98, - 193, 181, 39, 32, 109, 4, 200, 27, 4, 100, 221, 7, 178, 173, 129, - 46, 109, 160, 91, 22, 112, 225, 5, 220, 232, 207, 196, 192, 217, 118, - 224, 71, 29, 248, 61, 251, 127, 174, 251, 24, 32, 126, 8, 65, 157, - 162, 1, 253, 14, 39, 104, 127, 164, 65, 28, 106, 1, 62, 240, 242, - 113, 7, 229, 22, 12, 248, 195, 237, 73, 132, 225, 5, 12, 47, 225, - 27, 73, 192, 144, 6, 159, 104, 1, 144, 14, 240, 227, 123, 26, 72, - 243, 18, 228, 73, 4, 50, 34, 128, 76, 95, 160, 195, 22, 232, 212, - 2, 28, 164, 1, 39, 78, 192, 145, 6, 112, 38, 4, 54, 96, 252, - 65, 27, 240, 123, 117, 31, 23, 180, 167, 228, 160, 110, 177, 0, 63, - 139, 131, 118, 72, 13, 196, 163, 53, 224, 229, 15, 202, 12, 94, 134, - 207, 97, 120, 5, 95, 108, 7, 67, 14, 124, 18, 60, 252, 135, 89, - 24, 138, 97, 40, 129, 255, 248, 252, 19, 74, 192, 181, 66, 144, 54, - 7, 228, 125, 5, 100, 61, 1, 178, 253, 129, 46, 107, 160, 91, 13, - 112, 17, 7, 220, 88, 0, 87, 114, 192, 29, 247, 159, 104, 3, 126, - 203, 254, 31, 117, 159, 24, 196, 19, 3, 24, 127, 8, 2, 127, 43, - 131, 246, 200, 28, 196, 165, 47, 224, 7, 143, 227, 100, 80, 174, 121, - 192, 174, 74, 24, 222, 194, 39, 154, 194, 80, 7, 95, 152, 2, 208, - 8, 240, 227, 123, 29, 72, 243, 22, 228, 41, 1, 50, 210, 129, 204, - 88, 160, 195, 23, 232, 52, 7, 28, 148, 1, 39, 65, 192, 145, 1, - 112, 38, 62, 211, 6, 252, 43, 246, 163, 255, 84, 247, 169, 65, 219, - 194, 5, 198, 33, 178, 160, 63, 50, 0, 177, 120, 31, 196, 231, 19, - 192, 51, 19, 190, 88, 28, 216, 0, 183, 167, 9, 134, 86, 24, 218, - 97, 232, 132, 161, 11, 134, 15, 240, 133, 143, 0, 31, 192, 185, 78, - 144, 166, 21, 228, 169, 5, 50, 138, 128, 204, 100, 160, 35, 24, 232, - 180, 5, 28, 84, 1, 39, 17, 192, 145, 9, 112, 62, 219, 6, 160, - 255, 147, 246, 163, 158, 177, 159, 0, 220, 123, 209, 128, 49, 56, 15, - 136, 51, 69, 208, 39, 155, 130, 114, 240, 7, 117, 244, 57, 40, 43, - 56, 223, 106, 80, 182, 109, 192, 190, 62, 248, 66, 124, 248, 228, 49, - 24, 70, 224, 139, 12, 126, 194, 8, 184, 54, 8, 210, 126, 0, 121, - 27, 129, 172, 34, 32, 251, 57, 208, 229, 15, 116, 155, 2, 46, 138, - 128, 27, 15, 224, 74, 3, 184, 19, 156, 177, 31, 245, 15, 236, 255, - 189, 182, 143, 246, 76, 221, 151, 4, 109, 142, 46, 232, 155, 61, 64, - 27, 253, 20, 212, 213, 60, 80, 102, 112, 222, 29, 48, 244, 194, 23, - 224, 193, 48, 6, 195, 36, 12, 211, 240, 133, 206, 240, 205, 202, 126, - 194, 71, 112, 109, 18, 164, 29, 2, 121, 59, 128, 172, 74, 32, 251, - 21, 208, 21, 4, 116, 91, 2, 46, 74, 128, 219, 143, 54, 128, 246, - 31, 180, 129, 103, 237, 71, 248, 3, 251, 201, 192, 125, 40, 43, 184, - 31, 185, 2, 198, 165, 119, 193, 248, 196, 11, 212, 201, 68, 208, 94, - 149, 128, 184, 109, 3, 252, 71, 128, 77, 112, 251, 62, 193, 39, 51, - 194, 176, 4, 195, 242, 79, 88, 2, 215, 62, 129, 180, 147, 32, 111, - 47, 144, 85, 11, 100, 103, 0, 93, 161, 64, 183, 13, 224, 114, 19, - 112, 227, 7, 92, 233, 0, 247, 127, 100, 63, 194, 31, 216, 79, 116, - 166, 237, 103, 3, 227, 140, 171, 96, 108, 110, 0, 198, 104, 190, 32, - 30, 95, 128, 54, 187, 18, 212, 221, 15, 160, 12, 225, 118, 204, 193, - 176, 8, 159, 144, 5, 195, 103, 24, 214, 97, 216, 248, 9, 235, 224, - 218, 10, 72, 59, 7, 242, 14, 1, 89, 77, 64, 118, 14, 208, 21, - 1, 116, 219, 3, 46, 42, 128, 155, 0, 224, 250, 163, 15, 32, 250, - 79, 218, 143, 123, 198, 126, 250, 51, 109, 255, 53, 208, 222, 24, 129, - 113, 170, 63, 24, 175, 188, 4, 253, 214, 91, 208, 126, 245, 129, 56, - 254, 8, 236, 89, 5, 54, 126, 129, 225, 43, 124, 49, 215, 79, 248, - 10, 174, 173, 131, 180, 139, 32, 239, 24, 144, 213, 10, 100, 231, 3, - 93, 209, 64, 183, 35, 224, 162, 10, 184, 253, 232, 3, 232, 207, 216, - 143, 251, 159, 180, 255, 28, 120, 30, 245, 195, 126, 33, 112, 127, 170, - 6, 198, 31, 206, 96, 188, 250, 4, 140, 91, 10, 65, 156, 182, 131, - 118, 108, 18, 196, 243, 10, 176, 11, 110, 227, 54, 124, 226, 52, 12, - 187, 48, 236, 1, 236, 130, 115, 219, 32, 205, 58, 200, 243, 9, 200, - 24, 4, 50, 107, 129, 142, 215, 64, 231, 3, 192, 193, 24, 112, 146, - 1, 28, 127, 216, 79, 113, 102, 12, 240, 175, 216, 143, 249, 147, 253, - 12, 96, 124, 45, 12, 250, 25, 117, 112, 175, 230, 2, 198, 236, 79, - 193, 216, 173, 24, 244, 225, 157, 160, 45, 159, 6, 117, 250, 51, 40, - 219, 109, 96, 235, 55, 248, 98, 181, 159, 240, 13, 92, 219, 6, 105, - 63, 131, 188, 211, 64, 86, 39, 144, 93, 12, 116, 61, 5, 186, 93, - 0, 23, 117, 192, 77, 24, 112, 101, 248, 201, 126, 204, 255, 102, 251, - 77, 193, 61, 91, 32, 24, 151, 188, 1, 237, 83, 3, 232, 203, 71, - 64, 252, 46, 157, 41, 251, 157, 51, 182, 31, 192, 55, 68, 3, 56, - 56, 227, 131, 157, 51, 49, 176, 4, 100, 140, 0, 153, 13, 64, 199, - 27, 160, 51, 16, 112, 48, 253, 31, 180, 95, 238, 39, 251, 131, 192, - 253, 203, 27, 48, 142, 109, 0, 237, 213, 40, 232, 215, 150, 65, 251, - 182, 5, 202, 247, 172, 237, 71, 0, 103, 125, 176, 11, 210, 110, 128, - 188, 179, 64, 214, 7, 32, 187, 20, 232, 138, 3, 186, 207, 218, 47, - 247, 191, 104, 127, 58, 224, 214, 8, 198, 116, 191, 101, 255, 30, 176, - 241, 172, 237, 103, 125, 176, 15, 210, 252, 150, 253, 221, 64, 118, 41, - 208, 245, 151, 253, 255, 183, 236, 255, 179, 196, 255, 159, 189, 253, 251, - 51, 244, 127, 127, 246, 241, 207, 95, 227, 223, 191, 238, 127, 254, 44, - 247, 191, 127, 246, 231, 31, 127, 61, 255, 250, 235, 249, 231, 95, 207, - 191, 255, 250, 253, 227, 207, 254, 251, 215, 159, 253, 247, 207, 63, 243, - 239, 223, 127, 246, 249, 15, 127, 205, 127, 249, 107, 254, 211, 159, 125, - 254, 219, 95, 243, 31, 255, 154, 255, 250, 215, 252, 231, 191, 230, 191, - 255, 181, 254, 225, 175, 245, 47, 127, 173, 127, 250, 107, 253, 219, 95, - 235, 31, 255, 90, 255, 250, 215, 250, 231, 255, 207, 215, 191, 255, 109, - 135, 8, 21, 181, 107, 234, 242, 183, 229, 149, 149, 216, 53, 101, 228, - 175, 95, 227, 248, 117, 111, 134, 153, 95, 247, 102, 56, 187, 15, 203, - 47, 123, 51, 252, 178, 191, 199, 101, 14, 75, 123, 179, 223, 216, 195, - 192, 81, 88, 247, 174, 189, 139, 161, 181, 133, 147, 185, 137, 35, 187, - 189, 163, 137, 181, 157, 129, 177, 137, 163, 46, 216, 177, 65, 247, 183, - 115, 255, 207, 126, 184, 16, 190, 253, 151, 246, 102, 248, 113, 110, 115, - 243, 215, 189, 25, 224, 199, 63, 246, 102, 24, 188, 241, 247, 50, 82, - 114, 127, 217, 155, 97, 228, 198, 47, 199, 63, 100, 156, 142, 156, 206, - 64, 248, 10, 50, 242, 50, 16, 2, 34, 2, 36, 7, 251, 7, 157, - 174, 17, 190, 185, 105, 110, 231, 108, 231, 100, 110, 103, 79, 123, 153, - 131, 11, 18, 188, 34, 127, 3, 105, 237, 151, 205, 148, 224, 41, 190, - 211, 0, 255, 195, 175, 33, 227, 124, 191, 6, 223, 238, 196, 253, 123, - 218, 173, 239, 223, 209, 127, 104, 255, 158, 6, 243, 7, 113, 248, 55, - 102, 124, 176, 245, 213, 15, 67, 16, 191, 231, 219, 249, 126, 44, 7, - 113, 154, 154, 194, 174, 88, 195, 254, 162, 130, 92, 191, 156, 121, 153, - 144, 248, 183, 51, 191, 108, 221, 165, 13, 251, 251, 227, 12, 223, 247, - 191, 236, 191, 158, 249, 46, 243, 219, 47, 155, 123, 65, 240, 200, 251, - 141, 15, 210, 210, 247, 125, 91, 254, 219, 175, 125, 183, 249, 199, 134, - 39, 72, 223, 191, 253, 82, 226, 164, 191, 87, 206, 223, 211, 160, 3, - 47, 127, 247, 20, 162, 228, 47, 0, 215, 206, 253, 205, 203, 132, 223, - 191, 99, 127, 79, 250, 9, 20, 165, 253, 47, 64, 184, 9, 65, 49, - 240, 243, 173, 48, 77, 8, 191, 89, 190, 235, 16, 174, 148, 177, 157, - 161, 9, 100, 12, 127, 191, 29, 194, 233, 56, 244, 0, 194, 70, 71, - 71, 199, 64, 199, 198, 192, 192, 38, 192, 194, 196, 34, 32, 198, 195, - 198, 198, 35, 38, 37, 34, 34, 38, 34, 34, 37, 192, 254, 254, 1, - 255, 253, 246, 7, 1, 7, 11, 11, 7, 23, 7, 31, 23, 23, 255, - 28, 46, 46, 238, 57, 248, 31, 220, 115, 191, 100, 33, 248, 103, 4, - 156, 214, 65, 4, 232, 48, 3, 236, 145, 16, 46, 64, 136, 4, 8, - 72, 4, 8, 167, 147, 48, 99, 209, 78, 155, 16, 36, 96, 44, 81, - 16, 190, 127, 128, 175, 144, 96, 230, 32, 163, 160, 162, 161, 99, 96, - 98, 33, 252, 124, 17, 1, 66, 68, 250, 113, 17, 31, 66, 64, 70, - 64, 66, 68, 70, 68, 65, 67, 69, 71, 65, 194, 190, 12, 187, 72, - 128, 132, 76, 71, 200, 141, 34, 117, 203, 128, 232, 130, 131, 31, 15, - 234, 185, 168, 151, 133, 87, 232, 25, 136, 85, 234, 13, 47, 243, 58, - 250, 247, 74, 163, 49, 70, 223, 222, 252, 248, 197, 200, 137, 143, 228, - 85, 81, 0, 211, 213, 24, 85, 227, 107, 13, 175, 157, 249, 207, 247, - 169, 205, 154, 124, 45, 126, 208, 216, 239, 50, 183, 37, 195, 252, 36, - 245, 97, 201, 211, 166, 129, 79, 219, 105, 165, 239, 7, 231, 119, 212, - 77, 93, 3, 99, 223, 148, 53, 15, 45, 236, 10, 200, 106, 152, 185, - 5, 197, 165, 151, 183, 12, 47, 238, 17, 64, 136, 136, 48, 182, 200, - 223, 57, 161, 161, 162, 240, 125, 167, 64, 199, 77, 136, 12, 99, 224, - 112, 129, 8, 133, 199, 47, 234, 28, 156, 65, 189, 74, 239, 230, 101, - 6, 195, 143, 142, 254, 209, 210, 183, 137, 141, 156, 120, 191, 48, 162, - 194, 9, 160, 49, 241, 53, 244, 193, 72, 188, 62, 111, 124, 77, 141, - 223, 217, 100, 246, 111, 20, 126, 159, 1, 243, 175, 20, 78, 199, 32, - 108, 164, 239, 58, 9, 32, 9, 168, 100, 237, 101, 106, 28, 6, 30, - 249, 234, 132, 237, 30, 47, 222, 167, 204, 119, 67, 26, 183, 177, 74, - 142, 134, 49, 14, 152, 180, 123, 118, 215, 220, 202, 147, 87, 236, 110, - 149, 32, 42, 62, 214, 70, 62, 124, 131, 91, 219, 190, 123, 232, 90, - 57, 181, 203, 166, 84, 58, 80, 230, 39, 63, 132, 86, 46, 207, 248, - 70, 172, 234, 176, 252, 158, 202, 237, 26, 181, 48, 78, 179, 117, 63, - 17, 55, 251, 229, 205, 201, 245, 177, 201, 252, 177, 144, 219, 150, 70, - 146, 180, 94, 180, 139, 21, 136, 66, 132, 226, 49, 53, 47, 198, 249, - 15, 125, 118, 204, 46, 133, 12, 234, 177, 27, 69, 84, 166, 223, 232, - 74, 66, 248, 216, 145, 186, 156, 128, 93, 154, 231, 58, 59, 139, 246, - 192, 31, 125, 12, 109, 135, 255, 152, 230, 88, 99, 57, 77, 96, 233, - 101, 106, 153, 73, 103, 142, 237, 148, 60, 141, 226, 50, 234, 97, 205, - 187, 161, 92, 81, 87, 212, 230, 17, 174, 30, 99, 251, 251, 135, 238, - 180, 70, 1, 219, 111, 164, 168, 251, 204, 154, 14, 239, 190, 246, 137, - 57, 169, 237, 90, 26, 188, 101, 124, 30, 215, 135, 147, 195, 80, 225, - 54, 43, 142, 62, 101, 27, 151, 81, 83, 67, 20, 59, 244, 98, 70, - 142, 168, 59, 250, 201, 61, 185, 125, 220, 155, 83, 195, 49, 107, 9, - 168, 202, 54, 216, 202, 125, 199, 27, 43, 169, 105, 143, 183, 119, 227, - 113, 241, 233, 55, 110, 10, 84, 248, 127, 92, 64, 118, 35, 72, 223, - 245, 106, 119, 30, 66, 15, 138, 120, 73, 173, 187, 181, 118, 185, 252, - 225, 121, 245, 186, 161, 53, 238, 151, 104, 241, 18, 251, 52, 31, 228, - 21, 4, 86, 153, 140, 154, 245, 79, 33, 230, 39, 167, 144, 37, 142, - 133, 133, 112, 56, 70, 112, 12, 243, 180, 196, 53, 244, 161, 6, 42, - 19, 253, 117, 15, 14, 119, 102, 127, 153, 110, 187, 253, 96, 229, 34, - 4, 134, 53, 130, 42, 249, 254, 218, 16, 121, 121, 235, 182, 204, 46, - 60, 100, 235, 40, 238, 47, 227, 184, 189, 102, 38, 165, 41, 144, 59, - 178, 136, 125, 184, 143, 187, 143, 217, 177, 183, 63, 251, 13, 196, 87, - 7, 143, 117, 153, 52, 133, 98, 50, 167, 211, 123, 167, 143, 34, 142, - 252, 3, 165, 35, 10, 99, 82, 144, 43, 132, 141, 151, 215, 198, 203, - 247, 188, 99, 183, 85, 97, 189, 101, 79, 177, 215, 67, 255, 197, 98, - 123, 232, 60, 73, 149, 228, 209, 204, 41, 228, 32, 82, 219, 103, 183, - 163, 179, 226, 211, 204, 66, 69, 65, 92, 246, 201, 216, 69, 183, 44, - 72, 128, 146, 170, 186, 102, 236, 75, 245, 158, 106, 213, 235, 145, 177, - 61, 30, 82, 175, 222, 116, 180, 164, 220, 221, 53, 23, 159, 1, 169, - 21, 134, 57, 103, 107, 165, 216, 254, 194, 81, 250, 129, 50, 4, 252, - 233, 180, 109, 159, 165, 212, 44, 19, 42, 129, 124, 149, 67, 7, 86, - 98, 157, 91, 123, 114, 1, 18, 53, 107, 234, 158, 84, 110, 132, 82, - 162, 130, 136, 188, 65, 164, 7, 194, 201, 105, 213, 199, 62, 125, 170, - 75, 236, 182, 244, 137, 155, 200, 98, 69, 104, 59, 46, 78, 186, 85, - 226, 81, 146, 54, 187, 149, 185, 236, 6, 238, 180, 34, 122, 232, 243, - 121, 167, 144, 236, 41, 244, 154, 16, 181, 79, 138, 92, 120, 36, 62, - 86, 67, 211, 105, 98, 49, 238, 186, 45, 20, 238, 21, 122, 192, 126, - 192, 190, 123, 111, 48, 101, 45, 12, 74, 26, 195, 224, 64, 58, 73, - 158, 10, 238, 227, 191, 238, 209, 73, 19, 71, 163, 56, 150, 61, 241, - 181, 87, 226, 249, 44, 122, 4, 193, 41, 164, 58, 237, 58, 16, 25, - 119, 15, 171, 204, 222, 3, 169, 117, 89, 34, 105, 191, 213, 206, 9, - 169, 172, 130, 170, 137, 232, 56, 118, 217, 76, 162, 186, 250, 208, 210, - 89, 117, 152, 123, 44, 26, 215, 175, 166, 78, 196, 167, 18, 235, 82, - 253, 203, 151, 235, 177, 168, 9, 145, 130, 71, 117, 87, 20, 20, 86, - 73, 251, 60, 208, 182, 94, 55, 42, 31, 36, 181, 42, 241, 227, 223, - 93, 243, 224, 234, 251, 152, 238, 254, 201, 238, 120, 254, 250, 132, 158, - 211, 39, 255, 41, 52, 218, 138, 15, 171, 252, 197, 203, 247, 180, 55, - 62, 251, 140, 63, 186, 176, 27, 64, 94, 133, 193, 70, 27, 57, 140, - 136, 219, 181, 238, 84, 43, 226, 58, 189, 115, 76, 126, 219, 176, 175, - 69, 163, 220, 181, 79, 151, 177, 25, 239, 235, 30, 94, 151, 35, 1, - 237, 24, 169, 88, 81, 157, 246, 71, 232, 186, 207, 179, 109, 177, 83, - 168, 227, 152, 249, 136, 5, 165, 146, 130, 5, 71, 36, 109, 221, 137, - 124, 193, 95, 239, 109, 28, 137, 180, 87, 178, 178, 235, 241, 114, 238, - 189, 220, 114, 39, 170, 150, 18, 91, 124, 233, 230, 112, 11, 135, 221, - 147, 167, 131, 39, 86, 62, 157, 242, 215, 117, 247, 30, 151, 157, 135, - 12, 113, 238, 201, 108, 184, 245, 21, 126, 144, 80, 62, 72, 126, 125, - 10, 101, 43, 205, 46, 150, 214, 81, 173, 249, 106, 95, 149, 233, 167, - 121, 237, 179, 83, 59, 124, 130, 79, 172, 185, 56, 209, 60, 178, 136, - 184, 200, 95, 251, 74, 91, 172, 65, 177, 86, 188, 251, 246, 128, 119, - 75, 33, 113, 25, 218, 144, 149, 147, 107, 77, 24, 215, 210, 199, 186, - 67, 189, 242, 173, 119, 113, 199, 188, 240, 224, 232, 21, 217, 76, 72, - 72, 86, 227, 180, 160, 75, 181, 139, 105, 181, 152, 62, 78, 78, 45, - 60, 104, 190, 213, 185, 58, 204, 69, 80, 84, 52, 214, 92, 147, 40, - 64, 60, 48, 43, 96, 81, 182, 139, 35, 237, 149, 40, 133, 202, 119, - 210, 55, 83, 200, 227, 211, 30, 55, 106, 148, 218, 225, 71, 159, 32, - 62, 48, 154, 116, 126, 142, 58, 101, 221, 80, 210, 122, 168, 79, 250, - 46, 68, 67, 131, 184, 49, 165, 199, 143, 218, 35, 25, 144, 137, 139, - 20, 142, 86, 69, 35, 33, 181, 126, 224, 179, 186, 242, 245, 88, 168, - 171, 112, 35, 51, 53, 230, 117, 34, 179, 116, 235, 226, 178, 237, 158, - 144, 139, 222, 69, 10, 243, 204, 197, 201, 210, 112, 139, 113, 242, 250, - 233, 42, 113, 239, 141, 21, 159, 248, 215, 69, 233, 213, 197, 186, 113, - 54, 236, 123, 114, 144, 185, 49, 65, 149, 143, 219, 210, 155, 194, 92, - 225, 36, 109, 190, 11, 188, 180, 73, 249, 195, 7, 185, 42, 153, 47, - 67, 113, 160, 32, 126, 125, 171, 99, 195, 41, 159, 232, 87, 125, 179, - 13, 75, 227, 111, 151, 152, 76, 197, 67, 104, 100, 167, 183, 137, 98, - 47, 91, 213, 217, 54, 190, 196, 151, 15, 119, 121, 49, 221, 46, 213, - 89, 100, 205, 64, 133, 206, 190, 187, 114, 61, 98, 37, 249, 85, 202, - 42, 100, 84, 86, 33, 133, 28, 196, 75, 99, 97, 30, 103, 251, 0, - 177, 97, 175, 162, 141, 182, 59, 163, 121, 215, 185, 35, 185, 241, 121, - 215, 212, 238, 41, 52, 172, 162, 98, 89, 67, 225, 182, 238, 206, 16, - 162, 239, 75, 155, 108, 165, 87, 129, 51, 88, 211, 170, 97, 216, 51, - 187, 138, 206, 39, 98, 142, 236, 79, 110, 144, 178, 102, 103, 122, 232, - 118, 140, 247, 45, 91, 162, 62, 107, 119, 125, 202, 184, 49, 60, 21, - 7, 15, 165, 218, 90, 124, 195, 233, 197, 70, 175, 79, 126, 38, 207, - 225, 234, 212, 161, 64, 205, 251, 158, 143, 235, 241, 20, 58, 20, 74, - 11, 199, 204, 62, 249, 223, 24, 82, 73, 52, 76, 226, 231, 243, 236, - 93, 103, 123, 113, 201, 5, 21, 75, 246, 248, 198, 189, 62, 164, 155, - 238, 122, 71, 108, 39, 111, 90, 90, 187, 168, 108, 14, 109, 16, 199, - 32, 244, 232, 173, 125, 217, 77, 250, 112, 112, 103, 241, 20, 90, 25, - 152, 29, 46, 124, 229, 98, 85, 123, 245, 27, 67, 19, 205, 61, 202, - 13, 215, 233, 111, 234, 94, 152, 181, 155, 4, 101, 229, 158, 126, 129, - 164, 51, 179, 140, 69, 8, 104, 203, 181, 86, 62, 30, 176, 16, 59, - 133, 122, 45, 46, 153, 173, 187, 164, 174, 30, 208, 178, 187, 163, 109, - 37, 111, 24, 115, 55, 142, 86, 159, 228, 111, 13, 232, 242, 96, 117, - 176, 237, 161, 34, 101, 235, 228, 205, 50, 126, 168, 57, 12, 28, 90, - 247, 73, 63, 86, 86, 24, 216, 16, 241, 162, 88, 137, 30, 191, 138, - 129, 22, 98, 99, 227, 242, 44, 185, 122, 191, 236, 224, 222, 216, 198, - 196, 118, 191, 141, 121, 94, 121, 28, 213, 26, 77, 26, 253, 68, 11, - 62, 37, 219, 30, 47, 119, 233, 161, 222, 209, 198, 1, 191, 119, 204, - 49, 139, 130, 207, 105, 223, 84, 221, 155, 238, 162, 105, 28, 219, 77, - 74, 163, 200, 141, 15, 115, 251, 119, 97, 45, 204, 170, 85, 231, 193, - 99, 37, 60, 221, 119, 175, 183, 239, 184, 241, 126, 161, 93, 169, 81, - 76, 21, 47, 24, 86, 149, 134, 5, 189, 46, 213, 20, 243, 41, 196, - 173, 203, 60, 252, 33, 202, 198, 67, 194, 214, 220, 181, 13, 123, 226, - 158, 197, 231, 136, 207, 180, 215, 242, 66, 94, 91, 188, 203, 228, 27, - 77, 216, 64, 246, 14, 229, 238, 23, 43, 61, 80, 44, 93, 42, 137, - 253, 216, 41, 91, 133, 228, 71, 77, 131, 242, 225, 88, 166, 249, 213, - 243, 243, 107, 140, 249, 165, 201, 215, 35, 186, 184, 69, 124, 86, 72, - 78, 216, 79, 18, 138, 242, 149, 237, 82, 181, 77, 189, 159, 224, 84, - 29, 211, 76, 157, 180, 28, 107, 35, 16, 242, 235, 73, 59, 145, 15, - 21, 44, 25, 249, 17, 161, 45, 123, 91, 18, 39, 92, 119, 114, 33, - 156, 114, 67, 186, 96, 54, 121, 10, 41, 30, 251, 120, 63, 94, 247, - 86, 12, 54, 46, 109, 112, 173, 168, 163, 77, 216, 93, 90, 155, 150, - 34, 171, 24, 18, 126, 133, 187, 96, 238, 108, 59, 20, 239, 182, 126, - 204, 185, 115, 10, 213, 61, 58, 239, 122, 103, 104, 221, 126, 2, 194, - 231, 157, 164, 244, 118, 219, 113, 165, 195, 178, 46, 234, 182, 170, 183, - 182, 25, 19, 53, 232, 234, 61, 212, 92, 56, 176, 53, 59, 162, 134, - 57, 253, 20, 26, 10, 138, 210, 209, 36, 239, 69, 105, 198, 186, 203, - 67, 201, 164, 187, 86, 93, 46, 112, 80, 155, 124, 32, 113, 67, 196, - 104, 144, 3, 23, 135, 155, 205, 159, 191, 202, 108, 252, 228, 252, 150, - 207, 179, 209, 195, 228, 221, 175, 42, 236, 229, 218, 253, 37, 159, 7, - 172, 45, 6, 168, 100, 114, 92, 135, 42, 223, 250, 8, 28, 72, 28, - 211, 209, 57, 61, 95, 40, 26, 18, 241, 56, 144, 122, 173, 1, 9, - 120, 113, 190, 90, 93, 118, 235, 59, 62, 168, 149, 221, 95, 185, 94, - 84, 30, 214, 229, 63, 195, 116, 213, 38, 160, 48, 125, 124, 91, 123, - 237, 101, 172, 214, 126, 8, 215, 160, 113, 220, 219, 176, 7, 197, 110, - 134, 67, 17, 139, 15, 146, 222, 37, 167, 159, 66, 183, 78, 33, 242, - 232, 216, 199, 218, 125, 55, 244, 35, 186, 227, 120, 45, 56, 112, 220, - 106, 15, 166, 186, 55, 147, 95, 159, 232, 16, 33, 178, 32, 12, 137, - 13, 225, 165, 213, 204, 242, 29, 136, 220, 45, 204, 27, 95, 94, 223, - 61, 156, 254, 108, 118, 92, 53, 91, 21, 63, 44, 98, 206, 30, 156, - 175, 55, 102, 121, 220, 121, 180, 104, 99, 127, 10, 213, 231, 202, 239, - 150, 190, 233, 26, 119, 195, 31, 162, 16, 144, 114, 246, 121, 48, 89, - 189, 92, 108, 183, 116, 124, 146, 165, 96, 100, 229, 106, 173, 239, 221, - 120, 187, 156, 183, 147, 171, 90, 198, 70, 226, 53, 251, 218, 254, 41, - 180, 51, 208, 197, 65, 162, 165, 123, 222, 119, 161, 166, 183, 90, 210, - 135, 87, 194, 174, 247, 68, 57, 243, 132, 232, 100, 156, 145, 221, 105, - 252, 182, 110, 95, 189, 89, 5, 137, 124, 156, 69, 57, 172, 83, 252, - 124, 10, 181, 106, 104, 177, 31, 83, 133, 79, 172, 145, 143, 26, 233, - 164, 146, 6, 201, 82, 212, 200, 141, 151, 31, 91, 195, 194, 171, 127, - 100, 201, 205, 182, 170, 89, 180, 74, 115, 115, 223, 126, 156, 252, 158, - 68, 209, 198, 246, 179, 154, 21, 31, 45, 110, 150, 174, 204, 157, 210, - 24, 147, 176, 49, 82, 231, 61, 188, 151, 184, 110, 229, 91, 79, 243, - 18, 252, 110, 176, 151, 211, 150, 230, 246, 148, 15, 92, 166, 149, 119, - 74, 52, 21, 15, 159, 215, 16, 201, 222, 30, 214, 94, 201, 114, 191, - 87, 111, 142, 199, 197, 16, 124, 180, 113, 228, 47, 239, 80, 69, 214, - 217, 96, 149, 229, 98, 99, 101, 137, 140, 49, 64, 253, 177, 118, 159, - 170, 67, 246, 220, 99, 30, 118, 225, 195, 15, 11, 232, 95, 15, 112, - 143, 167, 15, 166, 143, 200, 107, 237, 228, 77, 182, 53, 108, 40, 52, - 59, 172, 46, 212, 185, 160, 154, 140, 157, 66, 3, 62, 183, 110, 165, - 187, 144, 81, 232, 210, 27, 196, 227, 155, 45, 219, 156, 104, 148, 47, - 165, 166, 219, 145, 132, 56, 56, 165, 70, 234, 98, 156, 66, 153, 159, - 169, 182, 245, 214, 213, 239, 76, 166, 148, 33, 32, 135, 223, 219, 61, - 154, 126, 189, 221, 215, 124, 143, 66, 53, 12, 57, 201, 103, 99, 140, - 101, 148, 51, 218, 53, 73, 116, 59, 210, 104, 98, 216, 199, 130, 129, - 151, 135, 157, 196, 206, 2, 95, 191, 244, 1, 141, 197, 16, 127, 181, - 244, 209, 226, 193, 33, 97, 122, 191, 129, 123, 16, 95, 105, 96, 97, - 98, 163, 175, 57, 146, 146, 120, 236, 41, 116, 96, 142, 199, 48, 116, - 200, 22, 7, 41, 173, 165, 198, 135, 141, 151, 196, 9, 189, 123, 238, - 99, 64, 144, 75, 215, 197, 23, 72, 174, 147, 55, 211, 99, 76, 85, - 77, 222, 61, 105, 59, 116, 10, 5, 192, 186, 212, 187, 199, 54, 140, - 97, 36, 182, 105, 105, 213, 87, 239, 213, 164, 188, 64, 82, 108, 116, - 222, 114, 157, 156, 150, 62, 133, 68, 187, 201, 186, 207, 227, 57, 80, - 40, 29, 60, 31, 138, 90, 195, 73, 58, 89, 40, 222, 190, 171, 120, - 112, 18, 7, 11, 25, 34, 189, 216, 106, 74, 146, 183, 158, 79, 149, - 242, 130, 108, 81, 222, 45, 248, 208, 193, 170, 250, 100, 232, 41, 84, - 54, 40, 149, 112, 35, 97, 33, 210, 181, 50, 232, 70, 42, 62, 147, - 128, 167, 247, 198, 188, 196, 190, 207, 166, 207, 50, 97, 146, 130, 21, - 103, 230, 76, 144, 198, 114, 20, 158, 175, 238, 48, 162, 143, 252, 6, - 238, 100, 77, 190, 145, 171, 247, 41, 180, 229, 170, 25, 227, 166, 101, - 128, 29, 116, 40, 233, 164, 148, 234, 199, 236, 140, 122, 76, 99, 163, - 60, 173, 147, 99, 118, 32, 177, 104, 181, 163, 229, 91, 118, 195, 108, - 192, 230, 129, 63, 185, 36, 82, 33, 77, 170, 196, 243, 197, 147, 160, - 163, 11, 133, 106, 34, 119, 87, 130, 20, 223, 8, 188, 208, 92, 62, - 128, 245, 152, 50, 45, 158, 161, 242, 242, 150, 57, 93, 6, 185, 113, - 92, 138, 206, 17, 246, 8, 85, 27, 28, 147, 213, 163, 39, 181, 31, - 164, 47, 190, 183, 181, 231, 50, 116, 255, 244, 237, 20, 202, 63, 65, - 219, 238, 253, 208, 34, 250, 168, 213, 234, 206, 50, 210, 77, 201, 192, - 56, 174, 117, 187, 245, 195, 155, 28, 78, 202, 101, 116, 101, 74, 207, - 195, 196, 195, 55, 14, 23, 79, 178, 229, 241, 78, 7, 134, 15, 54, - 146, 188, 169, 81, 42, 70, 166, 229, 159, 158, 47, 227, 141, 183, 74, - 110, 249, 234, 154, 207, 146, 158, 113, 160, 39, 139, 185, 254, 124, 245, - 171, 157, 147, 206, 110, 226, 87, 136, 110, 175, 162, 178, 108, 88, 154, - 149, 243, 24, 181, 133, 187, 212, 246, 152, 99, 103, 53, 89, 43, 115, - 231, 242, 177, 202, 113, 138, 80, 46, 178, 171, 223, 164, 193, 246, 187, - 176, 62, 171, 110, 129, 185, 94, 61, 38, 170, 119, 187, 33, 246, 71, - 195, 85, 33, 19, 99, 94, 225, 71, 77, 209, 151, 134, 151, 188, 164, - 230, 206, 127, 222, 21, 236, 64, 70, 250, 16, 224, 214, 119, 146, 149, - 153, 248, 245, 115, 121, 252, 94, 16, 190, 182, 179, 149, 223, 152, 0, - 222, 74, 37, 121, 206, 219, 235, 194, 228, 99, 202, 149, 169, 165, 169, - 123, 139, 135, 56, 147, 88, 226, 157, 126, 198, 99, 138, 51, 113, 82, - 228, 82, 200, 101, 184, 126, 167, 80, 219, 41, 84, 78, 120, 187, 58, - 34, 185, 44, 29, 33, 19, 165, 190, 186, 28, 137, 38, 41, 199, 231, - 69, 80, 84, 116, 139, 252, 118, 27, 114, 96, 84, 193, 186, 8, 172, - 200, 229, 203, 247, 124, 118, 46, 180, 189, 218, 100, 141, 119, 162, 28, - 138, 97, 63, 184, 34, 233, 68, 51, 238, 86, 123, 10, 169, 179, 230, - 216, 39, 117, 35, 221, 46, 107, 24, 141, 202, 91, 40, 204, 67, 218, - 47, 47, 62, 98, 222, 21, 83, 222, 182, 80, 196, 31, 122, 172, 169, - 73, 121, 151, 211, 201, 77, 232, 147, 47, 239, 88, 99, 233, 244, 200, - 41, 244, 64, 166, 133, 118, 244, 166, 7, 95, 101, 24, 110, 65, 36, - 210, 227, 80, 193, 160, 242, 173, 68, 88, 8, 70, 40, 247, 221, 114, - 200, 236, 30, 115, 113, 74, 148, 118, 147, 90, 16, 179, 235, 60, 133, - 66, 143, 166, 183, 93, 152, 45, 240, 42, 103, 135, 130, 212, 59, 16, - 76, 2, 38, 228, 35, 94, 157, 66, 202, 99, 29, 20, 135, 225, 167, - 208, 96, 230, 13, 221, 225, 245, 55, 245, 154, 40, 41, 124, 41, 132, - 51, 107, 74, 161, 139, 91, 122, 135, 135, 167, 208, 11, 221, 225, 27, - 217, 151, 38, 21, 157, 169, 124, 35, 240, 61, 204, 135, 151, 125, 250, - 245, 140, 148, 199, 196, 174, 44, 245, 145, 233, 39, 77, 45, 4, 118, - 212, 152, 14, 173, 77, 117, 175, 158, 66, 45, 172, 238, 73, 28, 111, - 222, 146, 148, 190, 156, 79, 169, 240, 163, 253, 118, 111, 206, 117, 152, - 225, 141, 251, 182, 181, 49, 63, 21, 237, 121, 196, 105, 135, 128, 236, - 242, 136, 201, 177, 60, 46, 82, 215, 17, 216, 64, 145, 204, 58, 154, - 114, 33, 226, 245, 209, 27, 137, 99, 47, 1, 43, 105, 99, 73, 156, - 128, 10, 115, 101, 143, 147, 14, 2, 214, 220, 29, 222, 203, 241, 241, - 76, 114, 230, 199, 61, 74, 139, 214, 150, 10, 58, 253, 56, 176, 254, - 127, 29, 143, 106, 206, 224, 104, 216, 139, 198, 242, 165, 187, 137, 126, - 69, 100, 195, 50, 135, 121, 255, 132, 215, 59, 9, 69, 187, 175, 181, - 219, 175, 106, 237, 119, 3, 163, 234, 2, 223, 174, 248, 184, 139, 236, - 213, 230, 20, 175, 91, 68, 227, 85, 233, 191, 152, 149, 99, 95, 247, - 201, 173, 97, 148, 56, 29, 172, 222, 137, 203, 176, 245, 242, 165, 162, - 68, 10, 122, 239, 228, 226, 18, 102, 105, 93, 37, 73, 183, 78, 217, - 241, 46, 58, 108, 52, 110, 17, 93, 159, 195, 30, 95, 213, 193, 83, - 253, 38, 83, 67, 253, 214, 165, 75, 213, 234, 138, 101, 43, 75, 225, - 178, 161, 135, 94, 181, 85, 201, 107, 36, 18, 99, 245, 25, 99, 253, - 8, 175, 175, 232, 44, 239, 29, 237, 62, 249, 80, 95, 50, 44, 34, - 231, 198, 37, 200, 178, 168, 216, 236, 68, 87, 22, 92, 184, 78, 33, - 32, 24, 216, 186, 39, 226, 218, 95, 189, 148, 154, 250, 68, 195, 74, - 43, 219, 117, 181, 216, 233, 27, 90, 236, 144, 150, 132, 172, 83, 57, - 43, 233, 120, 2, 182, 7, 14, 34, 18, 100, 77, 226, 47, 53, 182, - 49, 53, 53, 89, 187, 51, 111, 144, 143, 191, 23, 80, 110, 29, 23, - 86, 87, 38, 91, 46, 139, 230, 69, 65, 182, 125, 10, 61, 155, 218, - 209, 224, 222, 61, 80, 114, 51, 234, 64, 135, 117, 211, 1, 159, 187, - 194, 229, 217, 198, 99, 251, 245, 41, 18, 53, 119, 35, 135, 9, 112, - 251, 176, 220, 74, 211, 199, 54, 236, 96, 189, 207, 18, 59, 230, 235, - 11, 163, 30, 180, 99, 107, 121, 140, 41, 176, 234, 179, 235, 163, 230, - 64, 99, 85, 56, 202, 195, 80, 118, 221, 109, 177, 222, 85, 12, 191, - 102, 45, 201, 172, 100, 137, 137, 31, 214, 40, 166, 6, 30, 147, 126, - 124, 32, 88, 33, 105, 225, 70, 128, 76, 210, 245, 116, 185, 250, 20, - 82, 59, 72, 190, 97, 222, 47, 137, 204, 215, 40, 9, 37, 4, 251, - 138, 74, 136, 44, 49, 109, 55, 249, 127, 132, 120, 121, 37, 135, 95, - 152, 45, 173, 203, 154, 35, 138, 4, 147, 71, 208, 81, 69, 43, 34, - 232, 120, 199, 89, 48, 44, 11, 215, 31, 125, 146, 42, 55, 35, 15, - 191, 119, 52, 127, 49, 170, 202, 37, 88, 98, 250, 85, 168, 98, 96, - 63, 82, 145, 156, 229, 148, 246, 34, 153, 197, 248, 26, 237, 46, 46, - 218, 100, 75, 245, 193, 99, 241, 61, 245, 185, 242, 165, 53, 124, 179, - 238, 73, 118, 183, 131, 83, 104, 169, 52, 205, 157, 178, 62, 82, 42, - 82, 144, 167, 48, 191, 242, 96, 195, 34, 236, 13, 31, 37, 6, 99, - 110, 196, 212, 131, 104, 216, 64, 119, 244, 251, 243, 142, 95, 158, 234, - 160, 125, 127, 250, 4, 187, 217, 255, 63, 252, 28, 227, 251, 246, 180, - 127, 255, 28, 3, 255, 180, 9, 138, 128, 32, 68, 164, 95, 159, 83, - 192, 159, 99, 32, 35, 32, 162, 64, 168, 104, 103, 31, 95, 128, 135, - 24, 136, 72, 248, 191, 60, 56, 64, 65, 64, 65, 65, 67, 66, 68, - 194, 128, 157, 35, 64, 34, 132, 232, 184, 47, 240, 32, 75, 93, 81, - 49, 36, 186, 101, 224, 72, 127, 25, 197, 193, 95, 250, 54, 170, 95, - 116, 81, 159, 145, 211, 185, 194, 87, 13, 81, 179, 155, 188, 170, 47, - 235, 191, 4, 196, 188, 46, 110, 100, 32, 128, 137, 69, 132, 41, 61, - 35, 152, 0, 145, 142, 91, 138, 16, 201, 239, 239, 159, 11, 152, 159, - 56, 116, 178, 68, 55, 69, 22, 150, 233, 138, 239, 120, 62, 142, 234, - 77, 136, 191, 200, 50, 83, 25, 145, 242, 233, 176, 35, 251, 92, 254, - 147, 204, 38, 72, 237, 105, 224, 166, 160, 147, 85, 158, 9, 138, 62, - 126, 186, 127, 82, 243, 225, 72, 238, 130, 30, 74, 22, 95, 114, 28, - 234, 52, 33, 238, 5, 213, 192, 237, 252, 167, 165, 174, 250, 121, 86, - 5, 15, 173, 245, 155, 219, 103, 194, 118, 79, 76, 131, 228, 133, 140, - 125, 145, 155, 30, 61, 176, 191, 92, 184, 47, 70, 94, 238, 230, 138, - 77, 94, 39, 199, 202, 129, 48, 77, 235, 115, 121, 125, 137, 189, 198, - 245, 37, 137, 36, 68, 158, 240, 161, 199, 51, 203, 116, 208, 169, 16, - 113, 56, 46, 132, 15, 141, 81, 110, 75, 255, 75, 156, 202, 182, 57, - 241, 200, 188, 126, 6, 143, 14, 23, 131, 41, 94, 2, 55, 57, 107, - 102, 201, 16, 198, 39, 19, 204, 207, 12, 157, 206, 95, 247, 245, 156, - 81, 88, 50, 199, 231, 93, 30, 12, 155, 232, 47, 48, 204, 116, 188, - 83, 247, 168, 42, 17, 159, 242, 173, 155, 140, 229, 167, 107, 71, 110, - 149, 232, 210, 173, 26, 214, 216, 215, 34, 72, 122, 34, 248, 148, 85, - 52, 117, 35, 92, 184, 42, 11, 43, 186, 20, 133, 212, 15, 123, 252, - 248, 205, 235, 181, 22, 41, 67, 214, 253, 28, 135, 90, 226, 18, 121, - 50, 36, 210, 10, 205, 175, 135, 46, 218, 209, 221, 145, 254, 253, 193, - 19, 72, 18, 23, 242, 121, 142, 236, 86, 7, 223, 188, 55, 98, 193, - 143, 51, 81, 87, 11, 245, 82, 243, 106, 233, 157, 215, 96, 229, 110, - 66, 69, 18, 122, 206, 223, 194, 230, 140, 80, 31, 225, 240, 245, 126, - 148, 149, 36, 38, 3, 42, 233, 246, 101, 14, 221, 3, 199, 196, 71, - 101, 159, 27, 208, 52, 153, 233, 152, 184, 13, 214, 122, 14, 21, 238, - 126, 243, 165, 224, 199, 198, 93, 16, 204, 13, 73, 103, 149, 42, 42, - 140, 189, 169, 38, 158, 67, 209, 117, 88, 177, 36, 156, 118, 83, 65, - 102, 252, 83, 97, 93, 4, 205, 84, 111, 124, 166, 12, 65, 3, 134, - 218, 244, 147, 3, 23, 237, 198, 251, 15, 114, 202, 104, 239, 155, 233, - 43, 236, 15, 115, 10, 240, 135, 6, 25, 206, 52, 132, 39, 213, 126, - 182, 65, 115, 253, 200, 205, 195, 255, 194, 226, 128, 234, 14, 226, 246, - 122, 227, 138, 123, 64, 230, 77, 196, 207, 23, 4, 198, 155, 238, 185, - 208, 123, 48, 219, 11, 149, 137, 80, 161, 93, 149, 12, 23, 241, 49, - 63, 133, 72, 170, 77, 22, 40, 16, 6, 4, 201, 132, 227, 144, 51, - 177, 91, 130, 77, 169, 185, 87, 244, 28, 232, 98, 242, 93, 71, 226, - 55, 105, 244, 208, 12, 95, 238, 249, 189, 141, 198, 157, 46, 191, 73, - 67, 120, 191, 79, 224, 240, 234, 146, 101, 93, 222, 162, 31, 11, 94, - 255, 161, 151, 144, 85, 34, 170, 100, 60, 115, 40, 13, 141, 202, 18, - 251, 87, 23, 133, 142, 168, 224, 241, 198, 6, 175, 177, 57, 251, 86, - 9, 68, 125, 164, 83, 104, 98, 140, 162, 66, 239, 195, 39, 202, 80, - 170, 111, 87, 223, 100, 107, 249, 68, 208, 175, 4, 204, 177, 126, 76, - 185, 88, 166, 134, 48, 29, 114, 64, 144, 125, 63, 136, 253, 164, 184, - 60, 120, 119, 89, 255, 20, 162, 122, 132, 49, 66, 132, 108, 43, 176, - 121, 60, 105, 95, 130, 159, 250, 220, 105, 25, 205, 215, 96, 128, 66, - 178, 205, 108, 78, 72, 30, 214, 250, 120, 189, 88, 83, 208, 172, 127, - 44, 51, 227, 179, 186, 214, 215, 62, 146, 199, 216, 116, 221, 111, 91, - 56, 198, 90, 145, 155, 136, 114, 69, 212, 59, 148, 23, 151, 132, 217, - 157, 75, 102, 90, 254, 128, 63, 35, 13, 91, 64, 126, 83, 162, 92, - 49, 223, 126, 142, 120, 149, 128, 205, 251, 245, 231, 65, 113, 19, 18, - 100, 54, 166, 41, 250, 7, 45, 223, 116, 36, 205, 88, 222, 156, 183, - 181, 53, 216, 22, 214, 158, 197, 49, 137, 96, 189, 20, 24, 22, 65, - 245, 165, 23, 39, 128, 67, 99, 218, 101, 186, 101, 119, 73, 209, 177, - 192, 132, 2, 197, 168, 197, 87, 140, 209, 25, 42, 188, 66, 194, 150, - 26, 22, 65, 128, 253, 46, 255, 109, 149, 220, 112, 88, 83, 84, 169, - 239, 214, 241, 237, 253, 71, 244, 177, 131, 253, 53, 239, 109, 235, 134, - 114, 136, 80, 105, 136, 148, 86, 197, 243, 77, 159, 186, 33, 140, 188, - 192, 150, 108, 119, 231, 109, 228, 44, 231, 84, 207, 56, 237, 177, 253, - 4, 69, 167, 133, 211, 34, 80, 11, 57, 40, 79, 14, 226, 88, 223, - 144, 28, 21, 204, 215, 193, 57, 133, 198, 133, 133, 238, 157, 39, 67, - 194, 25, 141, 244, 149, 130, 117, 148, 52, 28, 254, 170, 153, 100, 25, - 180, 33, 99, 110, 68, 251, 181, 247, 164, 46, 214, 146, 151, 35, 125, - 217, 66, 154, 145, 162, 28, 244, 90, 99, 159, 114, 115, 233, 91, 169, - 127, 52, 208, 174, 26, 204, 144, 186, 79, 193, 126, 103, 35, 146, 38, - 76, 14, 59, 231, 125, 76, 58, 227, 244, 51, 47, 195, 61, 175, 207, - 77, 97, 65, 116, 148, 142, 72, 126, 61, 122, 34, 229, 105, 41, 220, - 163, 129, 12, 212, 228, 238, 110, 132, 9, 108, 223, 190, 6, 32, 83, - 211, 112, 86, 223, 177, 159, 194, 96, 29, 48, 101, 94, 93, 30, 191, - 126, 123, 34, 15, 19, 195, 23, 131, 71, 169, 101, 100, 12, 79, 38, - 206, 68, 239, 77, 227, 133, 98, 108, 108, 216, 32, 139, 200, 71, 252, - 192, 120, 108, 45, 198, 208, 131, 64, 145, 152, 144, 204, 203, 168, 191, - 35, 135, 99, 168, 215, 136, 91, 62, 28, 89, 126, 36, 166, 67, 231, - 32, 70, 219, 43, 109, 176, 237, 133, 172, 22, 42, 207, 8, 205, 199, - 130, 109, 115, 62, 2, 148, 224, 58, 15, 200, 216, 144, 223, 222, 243, - 157, 178, 227, 193, 182, 247, 36, 235, 124, 206, 245, 250, 144, 153, 195, - 245, 220, 88, 109, 76, 242, 247, 215, 98, 241, 55, 77, 40, 213, 189, - 196, 39, 5, 212, 100, 150, 175, 249, 106, 185, 109, 70, 222, 175, 175, - 241, 68, 84, 79, 121, 195, 246, 0, 197, 90, 191, 222, 37, 236, 137, - 205, 167, 222, 107, 23, 19, 72, 235, 203, 216, 11, 68, 186, 99, 70, - 179, 122, 117, 12, 131, 175, 100, 170, 220, 212, 26, 140, 220, 17, 220, - 177, 120, 148, 197, 81, 175, 180, 34, 144, 147, 212, 93, 45, 101, 156, - 115, 63, 186, 113, 53, 150, 146, 246, 91, 254, 137, 54, 7, 66, 202, - 151, 118, 181, 160, 1, 119, 75, 150, 167, 134, 117, 235, 45, 65, 227, - 217, 95, 51, 66, 38, 77, 130, 15, 188, 187, 144, 115, 26, 30, 138, - 50, 71, 4, 102, 245, 81, 208, 114, 51, 212, 225, 95, 16, 27, 43, - 10, 167, 37, 85, 95, 137, 24, 253, 152, 161, 47, 164, 116, 59, 120, - 178, 226, 147, 132, 89, 185, 20, 178, 237, 185, 28, 8, 27, 143, 230, - 115, 143, 150, 191, 177, 13, 2, 194, 196, 6, 25, 158, 237, 35, 53, - 41, 173, 185, 74, 245, 100, 164, 143, 41, 194, 88, 228, 5, 231, 35, - 121, 177, 83, 159, 72, 20, 79, 166, 44, 49, 38, 10, 61, 173, 104, - 233, 147, 104, 201, 174, 42, 230, 33, 93, 70, 251, 204, 232, 53, 70, - 193, 146, 28, 249, 73, 35, 145, 76, 0, 209, 44, 255, 250, 109, 182, - 135, 133, 180, 97, 17, 21, 158, 129, 190, 120, 58, 209, 105, 50, 179, - 134, 174, 115, 43, 97, 82, 35, 151, 46, 16, 189, 185, 222, 202, 188, - 252, 70, 19, 91, 117, 83, 13, 95, 242, 11, 218, 45, 203, 160, 235, - 250, 4, 133, 225, 151, 143, 19, 161, 139, 237, 152, 33, 209, 138, 50, - 253, 148, 74, 15, 154, 235, 39, 171, 136, 217, 85, 50, 140, 16, 239, - 75, 172, 247, 35, 27, 197, 12, 73, 225, 43, 248, 10, 68, 40, 85, - 146, 151, 171, 172, 182, 175, 8, 140, 251, 126, 153, 75, 65, 184, 93, - 23, 194, 118, 161, 76, 20, 243, 75, 221, 106, 136, 96, 54, 10, 146, - 237, 149, 251, 120, 41, 43, 214, 79, 145, 195, 111, 166, 122, 119, 239, - 65, 131, 55, 30, 152, 60, 54, 190, 74, 19, 90, 215, 74, 67, 32, - 140, 251, 244, 161, 40, 157, 107, 4, 82, 227, 97, 162, 114, 69, 110, - 124, 138, 164, 12, 242, 252, 219, 162, 195, 227, 182, 55, 78, 72, 100, - 179, 82, 151, 160, 117, 188, 115, 118, 213, 89, 92, 92, 228, 5, 88, - 77, 168, 70, 80, 254, 215, 103, 147, 89, 76, 5, 31, 30, 222, 49, - 144, 226, 113, 139, 22, 93, 205, 162, 84, 195, 16, 221, 229, 37, 212, - 208, 151, 218, 61, 40, 81, 88, 69, 175, 101, 168, 183, 86, 115, 91, - 62, 174, 122, 169, 174, 113, 81, 142, 175, 109, 228, 139, 122, 120, 218, - 238, 10, 70, 53, 129, 142, 166, 76, 187, 168, 251, 220, 194, 241, 124, - 159, 6, 67, 110, 104, 240, 80, 6, 148, 193, 32, 117, 123, 97, 97, - 43, 239, 89, 105, 119, 51, 142, 251, 39, 210, 197, 40, 81, 239, 218, - 154, 180, 216, 242, 172, 55, 106, 197, 132, 80, 161, 106, 228, 213, 8, - 69, 203, 136, 211, 94, 135, 231, 143, 73, 85, 59, 190, 132, 13, 211, - 227, 176, 49, 14, 234, 244, 103, 56, 40, 190, 84, 115, 242, 207, 176, - 108, 219, 225, 239, 214, 26, 92, 207, 100, 119, 204, 38, 126, 199, 99, - 37, 146, 7, 185, 112, 30, 84, 221, 153, 29, 28, 232, 208, 247, 247, - 39, 83, 88, 87, 93, 207, 61, 89, 240, 187, 179, 179, 169, 110, 184, - 40, 54, 124, 105, 194, 83, 163, 49, 170, 116, 81, 143, 109, 253, 158, - 111, 6, 189, 56, 151, 0, 154, 182, 216, 134, 83, 12, 165, 58, 3, - 212, 95, 54, 227, 233, 147, 144, 238, 35, 249, 217, 91, 150, 164, 96, - 238, 157, 31, 223, 73, 92, 137, 10, 229, 11, 211, 105, 27, 250, 9, - 239, 184, 137, 155, 184, 211, 6, 199, 137, 187, 199, 221, 46, 215, 176, - 137, 71, 16, 62, 10, 107, 84, 106, 223, 75, 108, 203, 35, 247, 78, - 196, 99, 28, 31, 217, 242, 139, 186, 128, 150, 110, 151, 87, 90, 109, - 54, 129, 106, 193, 194, 88, 115, 189, 118, 225, 6, 231, 180, 43, 142, - 110, 21, 2, 141, 221, 144, 179, 82, 151, 188, 121, 248, 77, 143, 215, - 143, 10, 182, 188, 186, 208, 82, 215, 60, 18, 196, 185, 159, 68, 68, - 201, 207, 74, 82, 145, 59, 149, 16, 63, 201, 13, 17, 244, 71, 194, - 197, 191, 95, 40, 252, 225, 179, 165, 137, 169, 161, 135, 36, 151, 106, - 171, 138, 236, 185, 45, 131, 92, 220, 225, 18, 78, 251, 98, 102, 21, - 22, 194, 152, 194, 48, 164, 210, 60, 201, 23, 120, 207, 71, 209, 236, - 222, 86, 217, 166, 220, 146, 211, 247, 80, 246, 155, 73, 111, 145, 122, - 227, 119, 103, 180, 85, 100, 168, 211, 204, 80, 168, 72, 152, 79, 110, - 250, 162, 254, 120, 200, 77, 60, 156, 218, 132, 20, 86, 169, 200, 171, - 69, 33, 104, 117, 121, 41, 217, 97, 225, 125, 66, 58, 39, 159, 93, - 234, 184, 240, 229, 16, 82, 49, 68, 209, 135, 209, 158, 15, 6, 211, - 218, 202, 14, 28, 39, 226, 234, 26, 209, 114, 217, 193, 154, 233, 199, - 150, 162, 250, 193, 114, 201, 37, 84, 186, 74, 90, 56, 3, 126, 34, - 215, 195, 73, 87, 30, 186, 10, 38, 212, 181, 39, 132, 189, 109, 75, - 73, 123, 136, 186, 242, 118, 38, 128, 222, 79, 220, 70, 161, 246, 34, - 54, 170, 241, 2, 205, 224, 218, 64, 251, 90, 3, 207, 83, 162, 143, - 75, 131, 108, 172, 193, 152, 114, 120, 37, 14, 205, 232, 54, 40, 131, - 88, 118, 164, 177, 200, 248, 184, 77, 56, 55, 24, 102, 120, 46, 240, - 204, 139, 202, 29, 226, 230, 240, 71, 166, 39, 8, 64, 238, 173, 171, - 122, 210, 134, 8, 250, 50, 141, 14, 21, 9, 203, 131, 132, 150, 29, - 22, 129, 148, 226, 141, 43, 61, 214, 237, 14, 33, 152, 180, 21, 99, - 98, 99, 171, 222, 38, 80, 222, 39, 169, 2, 47, 141, 17, 23, 53, - 83, 18, 90, 10, 84, 180, 53, 180, 241, 12, 186, 39, 92, 80, 8, - 81, 163, 95, 210, 77, 179, 183, 248, 58, 236, 193, 91, 8, 131, 25, - 167, 80, 36, 217, 0, 177, 49, 195, 90, 161, 47, 90, 237, 213, 72, - 36, 91, 15, 165, 14, 10, 63, 49, 109, 204, 113, 179, 217, 135, 88, - 197, 151, 48, 167, 165, 151, 123, 212, 194, 25, 234, 110, 78, 100, 25, - 249, 13, 187, 65, 98, 239, 73, 250, 30, 42, 20, 250, 73, 188, 243, - 18, 95, 211, 146, 62, 215, 84, 84, 160, 190, 72, 17, 245, 110, 159, - 195, 23, 179, 94, 146, 26, 41, 215, 45, 210, 75, 155, 104, 208, 172, - 117, 84, 68, 155, 231, 168, 8, 34, 104, 17, 171, 17, 230, 179, 206, - 33, 31, 154, 141, 46, 24, 15, 212, 250, 50, 72, 45, 125, 195, 230, - 5, 84, 37, 63, 78, 45, 104, 178, 162, 57, 72, 130, 103, 140, 242, - 208, 196, 235, 19, 46, 235, 137, 141, 218, 228, 173, 74, 223, 248, 168, - 221, 12, 88, 231, 197, 113, 187, 186, 236, 189, 225, 199, 91, 17, 109, - 154, 234, 163, 146, 43, 249, 156, 119, 30, 171, 213, 210, 145, 176, 199, - 191, 52, 111, 16, 122, 18, 117, 10, 185, 106, 251, 15, 167, 208, 51, - 250, 93, 192, 86, 190, 254, 205, 252, 60, 211, 197, 138, 19, 166, 69, - 66, 217, 39, 24, 250, 95, 50, 145, 63, 45, 25, 99, 72, 80, 16, - 149, 73, 110, 209, 111, 175, 136, 68, 225, 88, 32, 177, 53, 51, 202, - 14, 96, 108, 14, 210, 156, 246, 137, 249, 177, 97, 107, 157, 92, 29, - 85, 97, 52, 121, 237, 57, 37, 70, 142, 53, 122, 43, 125, 142, 163, - 201, 175, 236, 214, 64, 53, 177, 233, 182, 69, 246, 202, 45, 147, 102, - 226, 219, 174, 46, 161, 15, 168, 241, 212, 139, 14, 163, 145, 184, 53, - 155, 234, 253, 42, 88, 9, 202, 166, 52, 123, 204, 42, 243, 14, 253, - 235, 91, 29, 146, 51, 134, 115, 142, 133, 159, 174, 221, 187, 62, 110, - 68, 190, 229, 243, 134, 243, 232, 197, 222, 5, 134, 18, 18, 250, 37, - 81, 190, 210, 131, 97, 119, 145, 59, 195, 196, 7, 146, 228, 120, 66, - 199, 178, 7, 143, 245, 38, 142, 92, 4, 228, 195, 184, 143, 197, 166, - 166, 114, 212, 246, 146, 34, 194, 199, 218, 136, 197, 202, 142, 194, 42, - 103, 37, 76, 75, 37, 174, 95, 205, 155, 247, 71, 101, 240, 147, 208, - 187, 222, 92, 99, 229, 83, 253, 146, 138, 212, 158, 64, 148, 63, 204, - 212, 245, 73, 196, 51, 158, 26, 17, 212, 57, 90, 199, 164, 210, 202, - 113, 242, 169, 183, 88, 70, 162, 24, 155, 199, 85, 242, 34, 134, 73, - 235, 8, 47, 29, 177, 101, 31, 149, 107, 116, 176, 213, 198, 142, 229, - 148, 84, 99, 14, 17, 107, 248, 170, 171, 122, 83, 10, 42, 172, 154, - 149, 174, 53, 100, 5, 84, 208, 26, 237, 122, 57, 71, 152, 214, 151, - 51, 73, 111, 93, 117, 239, 214, 220, 181, 186, 147, 134, 108, 88, 71, - 76, 107, 66, 179, 115, 59, 101, 35, 24, 59, 193, 36, 50, 52, 94, - 22, 105, 101, 128, 128, 162, 144, 81, 46, 54, 226, 208, 89, 159, 7, - 17, 143, 215, 203, 80, 242, 171, 185, 146, 76, 59, 6, 118, 181, 175, - 187, 191, 40, 47, 146, 33, 150, 147, 3, 87, 106, 56, 50, 193, 252, - 158, 101, 150, 60, 2, 26, 191, 254, 145, 233, 5, 201, 175, 252, 185, - 58, 10, 21, 20, 24, 95, 102, 211, 7, 83, 218, 98, 175, 96, 16, - 87, 88, 80, 211, 134, 77, 248, 220, 147, 148, 231, 80, 203, 162, 83, - 229, 228, 189, 26, 152, 84, 177, 244, 180, 184, 125, 190, 36, 220, 100, - 142, 208, 179, 4, 115, 96, 140, 13, 57, 8, 165, 137, 72, 180, 113, - 224, 246, 64, 149, 193, 10, 30, 105, 188, 49, 50, 219, 126, 80, 4, - 127, 64, 152, 254, 167, 22, 207, 189, 168, 109, 241, 194, 180, 108, 83, - 132, 161, 117, 71, 60, 22, 63, 4, 191, 237, 205, 126, 244, 206, 243, - 115, 56, 16, 122, 235, 230, 248, 35, 174, 30, 82, 10, 170, 172, 229, - 155, 185, 37, 72, 132, 174, 97, 40, 177, 45, 188, 168, 87, 228, 167, - 201, 208, 236, 113, 5, 155, 179, 216, 159, 135, 102, 249, 214, 200, 182, - 183, 124, 51, 147, 42, 107, 194, 68, 98, 101, 110, 118, 160, 13, 107, - 193, 117, 110, 233, 28, 195, 156, 84, 91, 157, 176, 251, 202, 234, 88, - 49, 97, 140, 247, 165, 208, 214, 6, 201, 231, 50, 3, 7, 155, 33, - 93, 197, 85, 23, 147, 236, 76, 217, 91, 133, 119, 44, 24, 141, 137, - 99, 96, 13, 242, 235, 185, 160, 214, 202, 10, 23, 226, 135, 183, 139, - 155, 102, 231, 250, 55, 134, 213, 244, 77, 116, 53, 99, 253, 153, 7, - 100, 163, 62, 248, 5, 186, 180, 183, 30, 221, 98, 66, 195, 31, 175, - 183, 171, 201, 98, 40, 246, 23, 180, 46, 184, 175, 92, 45, 173, 169, - 112, 206, 180, 87, 52, 231, 250, 83, 90, 39, 122, 239, 221, 108, 45, - 20, 61, 61, 163, 103, 252, 155, 17, 60, 51, 29, 43, 61, 248, 53, - 129, 109, 106, 116, 117, 15, 13, 118, 144, 79, 176, 114, 86, 95, 53, - 188, 44, 207, 12, 184, 78, 53, 132, 59, 34, 248, 117, 137, 170, 255, - 243, 123, 181, 16, 110, 20, 247, 130, 29, 38, 216, 157, 103, 230, 61, - 154, 147, 139, 36, 242, 197, 136, 10, 15, 219, 37, 79, 161, 195, 243, - 170, 152, 217, 172, 111, 26, 2, 162, 140, 94, 20, 191, 67, 53, 10, - 159, 212, 102, 31, 186, 189, 31, 133, 63, 82, 212, 66, 212, 159, 104, - 33, 109, 19, 158, 214, 87, 100, 99, 217, 48, 187, 248, 116, 192, 65, - 196, 184, 35, 143, 170, 199, 44, 47, 122, 139, 181, 24, 215, 196, 240, - 157, 12, 149, 85, 232, 10, 58, 199, 173, 46, 59, 196, 52, 243, 130, - 152, 106, 229, 121, 113, 137, 125, 203, 230, 161, 55, 181, 209, 24, 151, - 80, 234, 136, 162, 35, 148, 198, 8, 39, 93, 30, 220, 65, 37, 214, - 252, 38, 141, 168, 16, 78, 154, 204, 207, 121, 10, 153, 134, 61, 245, - 83, 251, 74, 139, 90, 55, 171, 249, 241, 20, 42, 61, 62, 120, 53, - 148, 229, 70, 28, 41, 141, 92, 108, 17, 245, 110, 20, 101, 60, 238, - 169, 11, 71, 198, 251, 108, 221, 248, 135, 77, 78, 78, 56, 233, 36, - 205, 46, 14, 38, 38, 248, 229, 244, 136, 76, 234, 18, 247, 205, 197, - 118, 197, 170, 40, 174, 242, 95, 189, 239, 143, 59, 106, 95, 205, 184, - 56, 223, 227, 115, 218, 207, 23, 11, 213, 146, 103, 88, 78, 180, 87, - 190, 80, 63, 209, 241, 32, 98, 28, 50, 243, 48, 12, 116, 129, 50, - 244, 26, 10, 66, 141, 118, 87, 13, 123, 110, 112, 72, 114, 45, 158, - 191, 69, 168, 137, 177, 143, 54, 25, 102, 56, 122, 45, 182, 74, 126, - 159, 103, 156, 203, 51, 104, 82, 24, 173, 54, 61, 3, 77, 68, 161, - 121, 75, 184, 251, 228, 213, 186, 184, 247, 220, 44, 37, 66, 196, 241, - 216, 182, 243, 144, 8, 94, 95, 29, 149, 3, 77, 9, 149, 7, 69, - 190, 14, 103, 81, 63, 118, 105, 52, 2, 181, 248, 244, 228, 64, 249, - 195, 33, 211, 10, 25, 151, 134, 0, 136, 228, 128, 108, 11, 199, 124, - 38, 27, 247, 252, 37, 202, 198, 21, 217, 91, 228, 50, 137, 147, 171, - 234, 90, 193, 17, 163, 107, 253, 219, 23, 191, 13, 81, 16, 20, 163, - 206, 102, 239, 122, 239, 86, 86, 59, 247, 190, 154, 243, 39, 38, 108, - 82, 154, 11, 166, 38, 55, 96, 41, 173, 14, 44, 244, 33, 187, 77, - 114, 141, 80, 233, 176, 40, 99, 235, 205, 147, 53, 218, 230, 249, 219, - 28, 212, 23, 189, 187, 204, 119, 231, 179, 139, 242, 159, 248, 35, 145, - 137, 146, 215, 250, 28, 218, 229, 21, 54, 239, 105, 151, 60, 236, 52, - 148, 108, 51, 173, 64, 69, 216, 98, 42, 185, 36, 90, 41, 115, 113, - 162, 120, 91, 184, 107, 173, 88, 199, 91, 52, 13, 50, 108, 250, 70, - 182, 210, 162, 52, 36, 153, 43, 205, 27, 27, 169, 81, 223, 189, 95, - 34, 205, 168, 68, 91, 212, 157, 37, 232, 47, 234, 204, 35, 239, 173, - 143, 241, 241, 80, 54, 96, 133, 56, 56, 193, 136, 246, 74, 249, 64, - 183, 226, 165, 237, 149, 43, 153, 172, 17, 215, 159, 27, 187, 183, 200, - 248, 170, 191, 208, 52, 143, 97, 73, 15, 84, 17, 187, 147, 214, 131, - 80, 204, 36, 130, 42, 135, 115, 1, 3, 169, 227, 213, 24, 75, 1, - 75, 204, 133, 226, 39, 1, 85, 145, 232, 65, 122, 246, 152, 142, 174, - 104, 36, 43, 55, 153, 248, 67, 87, 133, 81, 89, 105, 99, 25, 164, - 158, 199, 173, 240, 83, 214, 214, 188, 62, 215, 22, 114, 129, 86, 62, - 156, 118, 73, 149, 5, 18, 136, 62, 255, 204, 150, 190, 81, 131, 227, - 154, 63, 189, 47, 210, 26, 57, 102, 129, 171, 28, 45, 255, 189, 2, - 200, 221, 130, 112, 182, 12, 191, 153, 220, 254, 86, 133, 95, 147, 221, - 66, 255, 100, 61, 166, 223, 183, 115, 200, 47, 195, 34, 166, 250, 88, - 77, 36, 185, 140, 89, 136, 83, 195, 185, 188, 162, 62, 245, 112, 186, - 217, 15, 169, 32, 162, 27, 206, 71, 227, 93, 54, 188, 191, 226, 44, - 28, 118, 145, 180, 152, 192, 36, 155, 229, 147, 123, 183, 242, 94, 141, - 176, 17, 57, 153, 97, 111, 112, 235, 99, 60, 95, 156, 206, 220, 60, - 170, 26, 189, 62, 253, 118, 105, 91, 228, 237, 130, 25, 45, 177, 137, - 170, 139, 156, 250, 153, 100, 108, 183, 52, 53, 77, 155, 174, 11, 60, - 153, 91, 72, 219, 38, 113, 187, 90, 74, 171, 47, 183, 159, 18, 26, - 53, 70, 102, 125, 109, 59, 155, 63, 249, 219, 57, 55, 232, 41, 99, - 182, 244, 151, 75, 83, 82, 171, 186, 111, 167, 107, 211, 40, 74, 89, - 167, 216, 203, 184, 175, 182, 108, 238, 34, 37, 148, 127, 155, 54, 74, - 52, 15, 177, 178, 193, 206, 53, 216, 231, 200, 52, 201, 202, 118, 64, - 21, 74, 184, 127, 84, 149, 203, 16, 104, 236, 159, 206, 199, 27, 195, - 205, 32, 73, 226, 53, 137, 46, 210, 31, 160, 235, 95, 106, 42, 65, - 119, 163, 217, 169, 189, 173, 92, 218, 99, 91, 173, 242, 121, 126, 107, - 90, 60, 183, 142, 194, 183, 141, 182, 112, 49, 205, 138, 30, 166, 201, - 193, 134, 221, 207, 89, 243, 247, 31, 84, 239, 179, 137, 71, 122, 102, - 237, 89, 148, 85, 205, 80, 63, 115, 160, 83, 183, 102, 160, 74, 30, - 15, 18, 23, 214, 169, 53, 113, 195, 252, 188, 51, 26, 142, 21, 184, - 159, 127, 183, 165, 113, 139, 237, 235, 210, 163, 80, 181, 176, 193, 2, - 87, 229, 48, 199, 145, 185, 133, 172, 250, 163, 247, 47, 148, 239, 60, - 98, 180, 226, 72, 229, 25, 80, 48, 125, 169, 95, 119, 216, 245, 201, - 6, 99, 120, 174, 208, 33, 23, 71, 61, 163, 136, 21, 194, 151, 189, - 149, 89, 227, 61, 201, 245, 52, 215, 63, 155, 133, 225, 85, 219, 43, - 253, 76, 21, 250, 57, 155, 34, 61, 167, 161, 55, 143, 90, 108, 21, - 80, 236, 173, 162, 133, 40, 62, 228, 47, 52, 82, 169, 210, 233, 220, - 185, 200, 87, 46, 60, 162, 51, 199, 230, 22, 208, 25, 90, 113, 224, - 220, 197, 46, 230, 139, 162, 38, 39, 56, 223, 167, 41, 27, 23, 200, - 207, 234, 89, 34, 146, 243, 94, 198, 229, 227, 151, 231, 143, 33, 116, - 188, 67, 47, 60, 225, 82, 129, 97, 101, 219, 214, 91, 143, 10, 217, - 234, 108, 25, 195, 181, 134, 166, 108, 109, 174, 221, 60, 234, 144, 27, - 187, 114, 17, 185, 77, 72, 244, 107, 238, 139, 36, 234, 134, 105, 210, - 59, 106, 237, 16, 251, 59, 102, 167, 128, 75, 66, 59, 230, 110, 163, - 99, 140, 23, 58, 82, 170, 231, 140, 18, 38, 54, 30, 149, 177, 182, - 79, 76, 77, 170, 181, 29, 93, 19, 109, 109, 97, 186, 40, 192, 247, - 34, 176, 163, 195, 176, 44, 248, 116, 192, 246, 107, 159, 129, 131, 44, - 97, 131, 4, 123, 253, 248, 158, 103, 9, 71, 115, 68, 226, 230, 103, - 238, 144, 54, 122, 191, 221, 165, 201, 186, 194, 15, 250, 248, 119, 227, - 229, 70, 139, 68, 59, 76, 239, 36, 9, 29, 152, 32, 96, 113, 249, - 163, 206, 132, 33, 222, 29, 208, 72, 20, 145, 67, 86, 200, 73, 250, - 102, 213, 172, 74, 182, 175, 28, 191, 165, 124, 82, 105, 213, 227, 163, - 185, 199, 98, 130, 16, 233, 157, 124, 235, 189, 206, 157, 123, 197, 209, - 237, 197, 101, 197, 165, 206, 251, 205, 85, 222, 56, 87, 174, 206, 151, - 224, 162, 93, 119, 205, 185, 130, 142, 242, 238, 17, 218, 77, 234, 124, - 71, 115, 146, 25, 90, 220, 40, 28, 137, 27, 21, 230, 147, 1, 125, - 183, 162, 27, 219, 165, 104, 195, 89, 204, 172, 189, 170, 154, 243, 158, - 37, 172, 117, 60, 150, 192, 113, 189, 137, 112, 251, 221, 221, 107, 135, - 99, 195, 153, 3, 60, 113, 242, 150, 101, 173, 33, 66, 2, 155, 122, - 165, 49, 183, 33, 110, 67, 134, 72, 221, 112, 130, 85, 117, 242, 113, - 133, 190, 169, 177, 102, 119, 3, 99, 86, 63, 22, 73, 205, 35, 133, - 228, 67, 190, 62, 193, 59, 31, 110, 118, 197, 248, 162, 179, 150, 63, - 120, 149, 60, 230, 67, 192, 59, 61, 103, 168, 152, 129, 5, 105, 187, - 19, 212, 210, 81, 111, 184, 198, 172, 105, 176, 93, 161, 140, 207, 81, - 154, 88, 17, 118, 223, 223, 158, 231, 175, 9, 182, 154, 124, 157, 88, - 112, 95, 110, 211, 68, 56, 227, 50, 111, 10, 74, 218, 94, 43, 250, - 11, 49, 75, 209, 49, 58, 21, 218, 47, 244, 246, 120, 143, 146, 5, - 166, 6, 17, 51, 232, 109, 252, 230, 185, 43, 94, 164, 217, 217, 134, - 88, 168, 11, 81, 171, 32, 76, 55, 200, 248, 135, 74, 224, 199, 179, - 169, 26, 7, 26, 71, 45, 246, 124, 154, 109, 205, 21, 226, 178, 92, - 212, 151, 18, 121, 147, 175, 195, 122, 201, 245, 118, 36, 173, 16, 141, - 244, 92, 134, 62, 210, 219, 8, 106, 125, 65, 163, 153, 185, 201, 148, - 10, 111, 131, 2, 204, 150, 200, 8, 68, 225, 0, 203, 143, 49, 180, - 19, 88, 84, 15, 60, 34, 250, 21, 67, 139, 98, 136, 66, 235, 190, - 220, 221, 90, 77, 108, 66, 35, 56, 140, 22, 12, 56, 33, 233, 149, - 89, 143, 127, 216, 250, 249, 74, 228, 242, 71, 52, 91, 61, 230, 103, - 195, 150, 121, 82, 57, 20, 222, 3, 244, 108, 46, 119, 230, 42, 11, - 173, 253, 4, 55, 51, 35, 6, 142, 205, 210, 175, 84, 13, 200, 23, - 54, 187, 20, 226, 87, 127, 54, 162, 28, 12, 74, 191, 122, 151, 177, - 16, 73, 221, 140, 80, 149, 87, 154, 141, 234, 221, 53, 49, 109, 219, - 216, 151, 142, 4, 40, 2, 134, 181, 183, 223, 55, 23, 215, 229, 166, - 249, 250, 143, 82, 216, 143, 20, 80, 82, 209, 119, 101, 100, 45, 32, - 161, 234, 119, 217, 11, 17, 94, 144, 156, 215, 165, 24, 78, 233, 173, - 21, 125, 140, 218, 166, 231, 225, 59, 17, 48, 111, 220, 19, 206, 33, - 89, 128, 104, 68, 23, 49, 218, 130, 115, 187, 116, 253, 86, 8, 62, - 153, 239, 133, 226, 18, 223, 119, 234, 118, 234, 218, 132, 110, 193, 77, - 15, 162, 232, 133, 115, 146, 2, 60, 122, 147, 159, 73, 217, 126, 68, - 186, 168, 130, 96, 37, 165, 210, 116, 229, 169, 168, 196, 61, 249, 124, - 43, 86, 149, 28, 205, 167, 49, 54, 250, 238, 144, 242, 71, 159, 56, - 217, 117, 142, 55, 237, 239, 31, 27, 167, 102, 124, 107, 77, 110, 138, - 169, 230, 124, 234, 194, 91, 167, 86, 148, 186, 196, 48, 82, 12, 205, - 207, 107, 174, 180, 92, 99, 159, 98, 87, 215, 222, 205, 126, 194, 255, - 16, 181, 40, 157, 193, 222, 195, 218, 142, 131, 204, 114, 111, 143, 78, - 147, 241, 179, 4, 250, 137, 56, 115, 60, 49, 153, 134, 35, 206, 51, - 146, 65, 59, 206, 167, 225, 239, 217, 174, 222, 143, 9, 191, 113, 23, - 85, 246, 196, 86, 56, 223, 222, 246, 20, 138, 222, 83, 233, 97, 201, - 209, 186, 138, 47, 143, 235, 67, 88, 188, 178, 203, 225, 155, 109, 41, - 92, 108, 18, 219, 170, 119, 91, 255, 99, 104, 251, 129, 150, 78, 111, - 166, 225, 198, 189, 182, 155, 219, 91, 116, 29, 174, 183, 187, 2, 28, - 119, 238, 149, 8, 115, 34, 238, 92, 81, 188, 132, 18, 69, 26, 22, - 239, 112, 215, 142, 255, 205, 187, 133, 212, 146, 121, 157, 139, 182, 42, - 29, 5, 26, 104, 17, 225, 194, 23, 130, 217, 203, 43, 73, 88, 9, - 137, 125, 48, 218, 8, 168, 238, 226, 36, 126, 102, 55, 82, 83, 235, - 204, 224, 120, 230, 207, 51, 179, 195, 255, 80, 234, 155, 181, 115, 169, - 214, 59, 197, 120, 193, 59, 72, 247, 179, 75, 221, 189, 119, 19, 57, - 72, 90, 11, 156, 10, 219, 143, 76, 100, 198, 179, 153, 247, 238, 87, - 157, 11, 123, 162, 110, 163, 99, 149, 28, 60, 242, 230, 9, 42, 151, - 209, 64, 216, 73, 76, 213, 210, 211, 167, 69, 41, 37, 116, 87, 202, - 104, 66, 22, 13, 165, 218, 122, 78, 161, 178, 197, 219, 54, 25, 88, - 53, 93, 209, 218, 51, 104, 146, 164, 23, 191, 242, 202, 94, 46, 207, - 117, 150, 54, 18, 83, 46, 195, 70, 232, 234, 19, 138, 242, 180, 22, - 255, 212, 162, 234, 115, 58, 216, 231, 217, 129, 108, 208, 79, 72, 219, - 10, 133, 63, 237, 127, 242, 154, 217, 242, 74, 8, 173, 181, 168, 190, - 5, 57, 212, 122, 1, 189, 169, 137, 8, 69, 57, 221, 135, 163, 36, - 152, 184, 103, 232, 226, 164, 167, 212, 193, 102, 211, 146, 40, 205, 142, - 180, 208, 122, 162, 161, 166, 49, 237, 218, 161, 247, 110, 177, 132, 178, - 187, 197, 5, 163, 147, 196, 158, 147, 172, 7, 235, 225, 84, 220, 12, - 212, 116, 111, 39, 92, 98, 70, 198, 100, 35, 194, 11, 171, 243, 187, - 27, 123, 158, 17, 167, 100, 76, 6, 5, 111, 138, 105, 51, 27, 238, - 60, 86, 181, 167, 13, 37, 65, 198, 231, 75, 44, 39, 168, 228, 114, - 23, 248, 12, 107, 37, 138, 187, 90, 15, 155, 182, 162, 102, 240, 30, - 133, 153, 169, 239, 229, 190, 209, 149, 97, 37, 109, 251, 54, 198, 127, - 188, 102, 125, 18, 95, 217, 83, 50, 98, 118, 190, 141, 222, 214, 81, - 216, 123, 189, 8, 169, 219, 166, 19, 87, 231, 186, 151, 248, 242, 80, - 242, 50, 191, 63, 227, 107, 250, 89, 241, 23, 40, 94, 99, 203, 148, - 118, 54, 28, 195, 115, 188, 242, 81, 1, 138, 129, 162, 237, 83, 130, - 229, 175, 149, 85, 218, 251, 58, 87, 100, 70, 9, 240, 189, 218, 82, - 24, 200, 199, 52, 41, 144, 102, 163, 5, 2, 142, 186, 39, 251, 47, - 170, 90, 63, 70, 224, 159, 144, 163, 49, 186, 231, 162, 69, 25, 50, - 37, 52, 42, 121, 185, 196, 111, 185, 111, 104, 15, 177, 40, 134, 249, - 18, 20, 177, 89, 180, 148, 113, 165, 66, 147, 1, 226, 153, 43, 148, - 40, 239, 200, 226, 9, 29, 41, 224, 22, 109, 156, 144, 8, 78, 239, - 79, 249, 20, 120, 125, 56, 178, 160, 222, 241, 80, 148, 98, 50, 131, - 222, 239, 114, 71, 57, 181, 201, 161, 247, 122, 112, 47, 244, 34, 163, - 181, 121, 86, 54, 24, 105, 48, 229, 252, 62, 110, 15, 229, 135, 57, - 11, 233, 193, 227, 73, 228, 200, 209, 194, 142, 200, 186, 54, 119, 36, - 42, 207, 243, 142, 185, 150, 177, 6, 92, 146, 46, 168, 232, 226, 36, - 204, 153, 124, 236, 9, 164, 35, 146, 60, 220, 33, 90, 88, 197, 244, - 202, 229, 210, 5, 87, 82, 100, 47, 182, 111, 98, 217, 162, 111, 11, - 164, 149, 16, 23, 84, 106, 25, 36, 228, 91, 223, 167, 190, 207, 167, - 125, 207, 53, 247, 6, 95, 4, 73, 81, 77, 219, 205, 55, 142, 74, - 182, 182, 119, 146, 240, 63, 177, 225, 52, 20, 189, 47, 228, 102, 21, - 223, 144, 182, 122, 186, 100, 216, 109, 177, 168, 114, 173, 61, 213, 215, - 44, 142, 205, 75, 24, 225, 50, 241, 205, 157, 130, 124, 68, 196, 128, - 249, 168, 163, 107, 39, 58, 230, 36, 47, 121, 31, 148, 6, 170, 86, - 154, 152, 48, 74, 118, 116, 197, 37, 240, 54, 62, 228, 176, 84, 99, - 106, 128, 18, 184, 13, 253, 234, 60, 180, 134, 21, 75, 195, 98, 52, - 149, 110, 210, 233, 110, 54, 81, 123, 98, 10, 124, 225, 165, 116, 47, - 115, 160, 147, 42, 8, 12, 137, 167, 185, 192, 115, 232, 229, 89, 202, - 210, 144, 142, 143, 206, 129, 36, 211, 127, 82, 148, 21, 70, 84, 202, - 119, 87, 139, 157, 61, 146, 5, 175, 252, 129, 240, 65, 205, 193, 163, - 246, 246, 97, 157, 162, 26, 135, 0, 254, 25, 136, 174, 143, 162, 35, - 54, 32, 113, 8, 123, 51, 128, 63, 168, 83, 74, 253, 118, 219, 99, - 129, 103, 186, 88, 217, 159, 175, 48, 202, 122, 112, 163, 181, 190, 136, - 61, 133, 148, 37, 77, 50, 46, 243, 73, 102, 16, 102, 235, 58, 35, - 116, 142, 106, 44, 121, 191, 45, 165, 128, 20, 23, 244, 26, 170, 95, - 173, 147, 134, 235, 102, 142, 127, 243, 214, 59, 231, 166, 234, 61, 83, - 64, 167, 80, 12, 161, 211, 207, 25, 50, 51, 187, 36, 119, 246, 61, - 224, 187, 146, 152, 75, 171, 218, 213, 104, 174, 78, 201, 134, 43, 203, - 167, 179, 180, 187, 48, 20, 99, 170, 160, 233, 167, 215, 209, 111, 216, - 236, 67, 220, 182, 210, 18, 163, 55, 201, 103, 39, 95, 58, 68, 50, - 192, 66, 167, 124, 49, 42, 90, 86, 121, 214, 156, 101, 101, 66, 251, - 13, 131, 105, 83, 38, 62, 165, 199, 240, 248, 66, 111, 95, 181, 84, - 46, 18, 106, 97, 61, 27, 182, 239, 210, 85, 15, 199, 158, 39, 5, - 250, 57, 157, 41, 28, 172, 180, 95, 21, 214, 226, 98, 59, 15, 28, - 123, 158, 9, 172, 139, 220, 227, 214, 71, 124, 94, 200, 160, 239, 218, - 117, 167, 150, 67, 251, 194, 158, 154, 88, 23, 67, 5, 109, 32, 91, - 119, 116, 1, 22, 77, 224, 253, 220, 52, 242, 133, 162, 52, 231, 210, - 36, 111, 117, 19, 141, 167, 151, 136, 194, 174, 119, 12, 198, 38, 29, - 75, 159, 136, 237, 12, 237, 82, 102, 186, 198, 52, 205, 222, 47, 247, - 154, 84, 73, 204, 185, 89, 175, 238, 232, 192, 202, 29, 255, 181, 198, - 90, 121, 244, 85, 112, 182, 84, 214, 19, 207, 135, 82, 168, 8, 202, - 172, 234, 11, 58, 236, 53, 218, 36, 56, 183, 220, 52, 248, 143, 34, - 194, 228, 244, 165, 3, 58, 185, 197, 101, 6, 230, 173, 94, 178, 5, - 54, 124, 66, 197, 170, 48, 94, 182, 46, 90, 248, 80, 115, 173, 84, - 51, 212, 155, 196, 138, 76, 147, 86, 157, 16, 147, 32, 154, 229, 128, - 179, 165, 59, 43, 226, 116, 168, 111, 237, 99, 222, 2, 225, 198, 59, - 89, 175, 39, 13, 15, 189, 44, 198, 89, 199, 43, 240, 165, 113, 154, - 199, 35, 138, 39, 83, 171, 61, 207, 105, 83, 169, 62, 26, 79, 240, - 10, 250, 64, 161, 115, 238, 21, 57, 6, 166, 3, 125, 93, 91, 212, - 162, 30, 90, 183, 68, 182, 149, 21, 70, 73, 125, 155, 123, 192, 12, - 127, 51, 223, 124, 181, 142, 3, 131, 87, 97, 254, 189, 99, 217, 209, - 69, 233, 161, 14, 90, 236, 193, 186, 89, 101, 180, 225, 110, 54, 212, - 103, 163, 247, 153, 181, 10, 107, 108, 41, 48, 204, 27, 141, 80, 25, - 148, 30, 143, 105, 106, 245, 123, 163, 5, 245, 47, 231, 212, 155, 243, - 173, 106, 108, 107, 223, 136, 165, 13, 45, 226, 234, 157, 229, 99, 176, - 178, 220, 153, 77, 179, 237, 224, 146, 242, 151, 48, 103, 14, 79, 58, - 166, 99, 140, 55, 105, 102, 62, 169, 196, 209, 202, 228, 243, 78, 174, - 43, 22, 64, 13, 22, 12, 232, 145, 201, 63, 48, 225, 43, 142, 41, - 64, 20, 140, 41, 207, 214, 113, 178, 124, 200, 210, 153, 86, 145, 209, - 209, 224, 197, 86, 197, 135, 18, 77, 48, 81, 140, 129, 237, 157, 98, - 63, 72, 93, 138, 171, 86, 22, 182, 234, 3, 201, 140, 28, 15, 13, - 74, 53, 17, 133, 220, 188, 94, 63, 251, 134, 73, 185, 252, 42, 113, - 82, 154, 182, 169, 44, 77, 1, 181, 63, 159, 110, 67, 19, 183, 175, - 135, 242, 163, 128, 50, 182, 42, 173, 60, 220, 121, 42, 121, 156, 15, - 146, 60, 82, 104, 91, 68, 227, 47, 71, 39, 207, 21, 154, 72, 107, - 162, 183, 18, 160, 60, 9, 173, 242, 170, 66, 195, 121, 26, 219, 36, - 164, 87, 167, 34, 208, 148, 188, 101, 113, 175, 157, 133, 203, 40, 80, - 70, 50, 36, 64, 34, 225, 100, 234, 193, 12, 164, 93, 218, 166, 27, - 28, 34, 4, 241, 180, 208, 216, 6, 25, 105, 107, 190, 130, 82, 8, - 139, 76, 34, 51, 201, 238, 219, 44, 247, 112, 13, 141, 213, 71, 110, - 161, 33, 93, 16, 242, 101, 173, 223, 97, 183, 189, 82, 63, 200, 194, - 84, 17, 217, 59, 136, 108, 161, 28, 165, 240, 58, 229, 189, 174, 76, - 63, 102, 199, 167, 241, 225, 151, 186, 221, 44, 26, 44, 106, 218, 247, - 77, 223, 214, 220, 201, 26, 151, 188, 103, 107, 8, 229, 181, 145, 208, - 235, 215, 201, 25, 208, 196, 132, 31, 29, 164, 9, 140, 72, 115, 218, - 175, 176, 154, 16, 15, 116, 10, 92, 145, 21, 115, 91, 59, 97, 199, - 60, 188, 80, 125, 43, 195, 24, 211, 81, 23, 185, 81, 73, 66, 248, - 158, 14, 59, 21, 58, 127, 126, 155, 28, 123, 48, 138, 28, 237, 91, - 39, 214, 75, 187, 75, 36, 235, 90, 132, 65, 109, 137, 249, 15, 227, - 158, 120, 8, 107, 208, 173, 204, 15, 96, 177, 179, 141, 122, 51, 94, - 231, 249, 54, 19, 218, 164, 220, 238, 23, 20, 163, 190, 110, 165, 219, - 145, 21, 132, 137, 206, 230, 94, 77, 157, 197, 38, 223, 194, 216, 27, - 165, 157, 181, 150, 127, 31, 149, 78, 145, 242, 17, 250, 178, 184, 245, - 253, 68, 148, 123, 102, 110, 200, 177, 40, 152, 245, 250, 70, 220, 171, - 11, 219, 219, 239, 18, 24, 171, 171, 60, 26, 130, 66, 217, 242, 217, - 59, 61, 86, 138, 248, 212, 63, 175, 222, 215, 12, 197, 49, 119, 213, - 58, 226, 23, 109, 221, 199, 174, 197, 217, 174, 105, 179, 100, 29, 239, - 213, 194, 138, 84, 131, 94, 83, 63, 118, 90, 232, 144, 48, 245, 123, - 234, 82, 148, 182, 174, 248, 40, 135, 35, 211, 64, 223, 152, 152, 244, - 190, 227, 139, 183, 46, 74, 196, 172, 235, 196, 214, 142, 241, 77, 3, - 41, 141, 121, 167, 208, 199, 150, 155, 79, 43, 115, 180, 27, 144, 176, - 63, 103, 150, 75, 111, 23, 149, 193, 42, 190, 58, 223, 240, 45, 83, - 77, 171, 41, 196, 194, 120, 151, 96, 183, 187, 59, 220, 61, 36, 217, - 196, 35, 57, 49, 186, 1, 200, 184, 146, 82, 71, 206, 135, 53, 218, - 122, 230, 235, 171, 76, 227, 114, 124, 35, 152, 98, 151, 250, 102, 124, - 206, 111, 164, 39, 223, 118, 179, 25, 29, 252, 50, 210, 51, 18, 170, - 214, 214, 42, 191, 156, 247, 153, 187, 101, 228, 128, 145, 95, 204, 194, - 207, 176, 128, 238, 70, 163, 231, 104, 5, 251, 139, 161, 30, 71, 199, - 26, 15, 238, 210, 119, 60, 24, 244, 86, 208, 87, 155, 165, 97, 214, - 160, 26, 234, 244, 5, 76, 45, 99, 162, 120, 138, 251, 214, 233, 253, - 25, 215, 10, 145, 178, 234, 50, 210, 185, 175, 69, 135, 74, 132, 80, - 233, 142, 173, 79, 245, 77, 102, 21, 51, 145, 32, 94, 123, 250, 66, - 131, 122, 187, 71, 173, 175, 58, 11, 235, 70, 147, 122, 158, 85, 188, - 63, 207, 74, 102, 182, 152, 38, 255, 195, 113, 2, 109, 102, 219, 59, - 36, 229, 239, 159, 4, 68, 115, 109, 125, 114, 188, 99, 195, 181, 83, - 224, 193, 247, 88, 10, 5, 187, 206, 240, 173, 250, 76, 199, 226, 13, - 149, 236, 108, 43, 84, 151, 252, 214, 9, 127, 65, 237, 183, 60, 221, - 3, 137, 23, 47, 182, 148, 91, 37, 132, 61, 10, 30, 69, 116, 165, - 247, 54, 187, 171, 174, 48, 38, 168, 157, 91, 53, 140, 141, 37, 169, - 63, 129, 89, 16, 106, 115, 120, 128, 149, 111, 95, 211, 112, 68, 156, - 169, 189, 80, 104, 212, 45, 16, 209, 104, 249, 124, 80, 124, 239, 11, - 175, 209, 88, 145, 127, 61, 164, 23, 129, 200, 252, 126, 201, 228, 20, - 66, 13, 62, 29, 30, 90, 83, 123, 167, 238, 56, 139, 31, 153, 118, - 125, 145, 82, 67, 103, 16, 149, 248, 99, 147, 111, 197, 73, 183, 82, - 193, 61, 43, 173, 123, 177, 87, 42, 80, 167, 208, 4, 8, 36, 24, - 60, 28, 135, 90, 44, 44, 172, 181, 145, 231, 40, 221, 231, 102, 69, - 199, 176, 239, 14, 47, 53, 100, 159, 123, 199, 210, 238, 230, 175, 202, - 123, 162, 52, 85, 115, 191, 99, 231, 206, 68, 110, 167, 43, 178, 151, - 196, 114, 126, 254, 201, 155, 240, 185, 4, 71, 63, 250, 53, 209, 107, - 137, 155, 18, 3, 62, 111, 180, 16, 103, 5, 76, 18, 118, 174, 63, - 175, 117, 187, 230, 161, 64, 156, 99, 255, 14, 233, 206, 226, 129, 209, - 246, 190, 255, 76, 82, 91, 212, 123, 163, 150, 59, 138, 219, 219, 205, - 155, 232, 199, 85, 123, 201, 41, 227, 155, 175, 62, 189, 38, 153, 64, - 154, 91, 27, 208, 233, 119, 170, 101, 245, 205, 33, 35, 134, 228, 142, - 223, 9, 175, 88, 93, 165, 231, 159, 148, 52, 170, 165, 121, 125, 178, - 30, 111, 23, 60, 144, 117, 29, 219, 141, 185, 222, 139, 97, 149, 165, - 131, 83, 233, 35, 126, 45, 225, 121, 86, 212, 54, 177, 139, 35, 62, - 151, 213, 98, 123, 11, 30, 199, 155, 48, 189, 199, 78, 9, 198, 77, - 98, 47, 207, 116, 33, 217, 67, 167, 178, 194, 150, 243, 111, 239, 154, - 155, 255, 246, 225, 233, 135, 134, 172, 226, 16, 181, 152, 150, 39, 14, - 109, 46, 183, 93, 22, 38, 116, 245, 253, 25, 248, 55, 73, 189, 77, - 173, 6, 18, 242, 252, 181, 6, 198, 242, 34, 252, 44, 164, 137, 138, - 247, 179, 124, 106, 178, 232, 197, 66, 98, 104, 194, 219, 88, 152, 219, - 40, 167, 105, 38, 220, 135, 89, 180, 45, 219, 103, 106, 131, 5, 48, - 61, 30, 119, 62, 46, 49, 24, 215, 204, 233, 204, 162, 172, 55, 60, - 210, 154, 101, 16, 136, 187, 118, 61, 185, 225, 19, 186, 159, 164, 189, - 210, 78, 183, 98, 94, 92, 249, 34, 9, 93, 169, 67, 6, 122, 97, - 172, 227, 19, 158, 114, 206, 76, 151, 151, 119, 237, 140, 52, 40, 21, - 252, 66, 194, 90, 231, 190, 192, 136, 77, 163, 155, 33, 4, 95, 212, - 82, 56, 148, 251, 250, 176, 23, 125, 84, 249, 35, 135, 137, 158, 214, - 167, 176, 58, 131, 38, 225, 252, 252, 43, 172, 97, 149, 151, 206, 51, - 49, 81, 51, 140, 4, 133, 221, 245, 172, 17, 49, 20, 78, 142, 236, - 110, 24, 101, 125, 249, 149, 224, 157, 124, 234, 40, 171, 153, 14, 167, - 222, 107, 138, 43, 155, 42, 2, 138, 53, 149, 230, 217, 154, 68, 108, - 86, 46, 166, 35, 3, 169, 73, 61, 39, 38, 90, 62, 31, 51, 243, - 26, 30, 158, 220, 108, 46, 85, 19, 10, 140, 126, 240, 13, 79, 93, - 184, 56, 237, 209, 163, 143, 82, 250, 47, 91, 115, 164, 166, 195, 222, - 250, 112, 187, 88, 58, 126, 27, 122, 221, 109, 136, 113, 205, 155, 228, - 146, 104, 247, 220, 43, 225, 186, 88, 246, 148, 151, 184, 16, 123, 112, - 216, 51, 159, 228, 227, 247, 171, 131, 250, 67, 163, 220, 251, 10, 131, - 216, 232, 171, 183, 155, 138, 125, 46, 83, 169, 62, 100, 136, 98, 43, - 109, 127, 77, 20, 126, 245, 196, 196, 227, 20, 10, 184, 38, 91, 248, - 176, 245, 235, 45, 241, 20, 202, 235, 94, 201, 241, 241, 251, 195, 82, - 82, 142, 55, 87, 38, 239, 18, 51, 20, 46, 4, 229, 40, 58, 30, - 14, 223, 98, 204, 201, 98, 11, 176, 22, 38, 158, 188, 131, 58, 80, - 109, 211, 155, 135, 16, 157, 193, 60, 103, 127, 249, 133, 160, 70, 223, - 202, 163, 81, 86, 230, 103, 106, 159, 215, 247, 69, 116, 46, 223, 204, - 109, 226, 36, 189, 41, 100, 123, 237, 164, 179, 132, 144, 69, 223, 151, - 232, 203, 48, 46, 214, 1, 197, 41, 148, 126, 88, 102, 153, 140, 140, - 231, 223, 76, 139, 235, 65, 217, 161, 67, 20, 253, 177, 191, 205, 52, - 81, 70, 3, 175, 53, 107, 136, 11, 65, 158, 86, 48, 244, 157, 42, - 222, 98, 79, 206, 171, 14, 114, 86, 35, 195, 98, 212, 43, 114, 209, - 175, 196, 21, 158, 223, 115, 38, 230, 77, 201, 37, 77, 185, 151, 194, - 58, 100, 200, 77, 211, 164, 172, 193, 17, 194, 106, 114, 67, 39, 250, - 68, 85, 20, 67, 150, 202, 58, 166, 43, 107, 239, 154, 131, 187, 117, - 182, 215, 170, 42, 181, 103, 57, 139, 152, 152, 112, 110, 192, 124, 26, - 245, 107, 98, 55, 20, 105, 94, 91, 154, 254, 119, 108, 149, 158, 37, - 168, 175, 10, 50, 218, 211, 217, 35, 154, 91, 66, 238, 190, 230, 76, - 167, 226, 120, 85, 238, 44, 83, 114, 223, 178, 110, 119, 72, 48, 97, - 126, 49, 171, 113, 48, 179, 41, 209, 222, 212, 178, 78, 61, 175, 57, - 210, 129, 53, 238, 98, 178, 122, 134, 136, 213, 13, 95, 65, 29, 110, - 185, 50, 8, 10, 232, 53, 209, 242, 40, 65, 107, 186, 175, 24, 250, - 144, 223, 233, 170, 35, 193, 210, 142, 250, 88, 22, 27, 82, 60, 157, - 180, 241, 140, 115, 118, 116, 225, 23, 132, 83, 200, 115, 37, 22, 77, - 86, 37, 195, 154, 175, 78, 31, 242, 15, 123, 231, 106, 180, 28, 38, - 234, 59, 118, 89, 210, 152, 224, 75, 145, 12, 27, 26, 63, 155, 176, - 203, 149, 56, 93, 255, 161, 181, 83, 136, 64, 189, 25, 207, 84, 68, - 255, 62, 255, 41, 116, 251, 42, 217, 144, 146, 135, 65, 100, 65, 219, - 164, 190, 139, 170, 178, 202, 106, 117, 170, 63, 25, 241, 203, 15, 10, - 215, 9, 58, 6, 117, 60, 189, 170, 104, 92, 60, 136, 23, 165, 212, - 23, 243, 103, 197, 161, 237, 26, 239, 41, 156, 12, 137, 211, 30, 183, - 147, 43, 165, 105, 88, 248, 251, 190, 170, 31, 234, 149, 207, 237, 90, - 153, 198, 147, 156, 191, 77, 134, 79, 211, 132, 254, 241, 129, 135, 203, - 162, 90, 239, 186, 186, 236, 62, 91, 235, 142, 17, 11, 154, 138, 225, - 228, 157, 46, 79, 137, 126, 61, 235, 160, 168, 80, 35, 45, 122, 195, - 90, 117, 106, 221, 146, 219, 147, 239, 61, 84, 155, 72, 163, 186, 230, - 144, 198, 243, 217, 15, 90, 204, 239, 101, 189, 72, 55, 66, 151, 151, - 106, 70, 160, 153, 29, 206, 226, 167, 228, 210, 75, 189, 18, 131, 228, - 34, 220, 182, 177, 250, 204, 49, 195, 191, 50, 236, 93, 238, 178, 207, - 84, 47, 141, 160, 88, 242, 251, 137, 88, 68, 196, 132, 147, 46, 207, - 238, 190, 81, 242, 146, 203, 200, 77, 120, 197, 157, 99, 29, 199, 138, - 37, 174, 235, 108, 133, 68, 40, 173, 167, 208, 240, 41, 52, 103, 67, - 180, 61, 189, 47, 66, 143, 126, 179, 142, 136, 222, 208, 211, 199, 237, - 218, 61, 204, 118, 158, 64, 35, 132, 56, 66, 193, 175, 223, 202, 138, - 114, 42, 199, 102, 80, 57, 208, 67, 168, 216, 240, 79, 76, 239, 118, - 170, 125, 93, 193, 115, 48, 145, 75, 219, 247, 195, 204, 43, 12, 209, - 96, 238, 88, 190, 171, 158, 105, 118, 10, 241, 174, 21, 104, 16, 170, - 11, 197, 80, 95, 127, 146, 207, 201, 179, 20, 134, 105, 227, 248, 158, - 224, 125, 104, 168, 189, 214, 10, 54, 115, 182, 6, 239, 128, 165, 218, - 114, 29, 97, 120, 83, 189, 161, 71, 182, 23, 106, 126, 96, 123, 167, - 108, 59, 196, 81, 56, 255, 117, 84, 235, 107, 89, 18, 49, 191, 150, - 62, 59, 110, 0, 29, 132, 248, 46, 183, 195, 251, 194, 18, 211, 35, - 43, 70, 87, 58, 199, 192, 40, 46, 201, 113, 164, 116, 124, 132, 40, - 84, 193, 248, 248, 135, 226, 172, 153, 175, 207, 149, 65, 92, 133, 24, - 148, 87, 93, 150, 230, 175, 228, 233, 112, 65, 31, 203, 137, 197, 180, - 49, 31, 233, 144, 92, 144, 190, 72, 250, 84, 212, 123, 146, 115, 66, - 85, 147, 255, 72, 224, 118, 227, 179, 46, 97, 225, 128, 34, 57, 204, - 171, 136, 242, 177, 104, 131, 123, 206, 88, 35, 185, 55, 18, 4, 179, - 81, 88, 139, 229, 69, 223, 58, 99, 185, 225, 95, 112, 100, 180, 226, - 140, 192, 72, 86, 241, 33, 146, 51, 84, 184, 248, 234, 234, 144, 71, - 248, 126, 253, 81, 153, 198, 124, 175, 237, 122, 206, 53, 118, 207, 4, - 217, 201, 148, 231, 174, 243, 45, 52, 76, 213, 21, 237, 179, 100, 87, - 142, 82, 80, 75, 229, 94, 40, 47, 244, 87, 157, 48, 61, 194, 33, - 65, 24, 187, 245, 164, 88, 179, 47, 231, 106, 164, 228, 81, 89, 50, - 83, 188, 42, 223, 108, 23, 79, 138, 137, 31, 3, 29, 59, 233, 144, - 68, 220, 187, 172, 221, 243, 158, 239, 13, 52, 241, 181, 84, 63, 135, - 166, 74, 123, 22, 22, 58, 171, 153, 222, 153, 122, 43, 169, 42, 152, - 216, 217, 54, 215, 213, 53, 63, 223, 195, 234, 197, 106, 50, 100, 92, - 148, 35, 93, 234, 129, 142, 137, 183, 208, 75, 153, 119, 244, 118, 105, - 76, 236, 209, 165, 88, 42, 219, 151, 146, 34, 232, 162, 181, 211, 141, - 138, 119, 134, 132, 42, 179, 232, 162, 155, 19, 207, 213, 233, 214, 47, - 40, 162, 61, 205, 233, 29, 189, 86, 42, 118, 173, 125, 216, 50, 171, - 83, 137, 132, 51, 240, 206, 84, 13, 154, 163, 113, 153, 186, 183, 74, - 105, 145, 95, 19, 47, 225, 251, 27, 158, 185, 76, 57, 55, 213, 165, - 234, 102, 138, 16, 212, 95, 84, 125, 222, 62, 164, 208, 200, 61, 167, - 233, 45, 43, 67, 172, 33, 80, 212, 84, 127, 194, 119, 77, 89, 123, - 191, 164, 214, 138, 143, 101, 228, 51, 153, 138, 183, 126, 42, 229, 170, - 249, 183, 4, 85, 92, 51, 61, 36, 226, 114, 235, 227, 202, 54, 44, - 114, 178, 119, 23, 132, 31, 68, 11, 17, 122, 196, 168, 190, 170, 247, - 15, 52, 189, 197, 26, 63, 166, 209, 80, 158, 79, 67, 127, 10, 17, - 93, 83, 79, 81, 229, 46, 120, 112, 205, 224, 218, 75, 105, 126, 6, - 147, 112, 246, 5, 181, 190, 21, 237, 129, 188, 140, 72, 77, 62, 236, - 168, 214, 215, 91, 88, 59, 70, 39, 67, 254, 187, 85, 106, 19, 163, - 58, 99, 217, 225, 252, 35, 164, 115, 149, 162, 230, 118, 60, 31, 179, - 249, 158, 84, 40, 222, 108, 43, 12, 201, 136, 126, 169, 144, 175, 231, - 190, 125, 20, 154, 40, 97, 111, 201, 55, 52, 217, 128, 197, 186, 54, - 78, 110, 251, 208, 144, 50, 248, 72, 53, 162, 99, 161, 103, 32, 77, - 222, 70, 141, 56, 151, 133, 140, 152, 0, 225, 136, 45, 159, 173, 246, - 88, 76, 21, 51, 171, 111, 30, 71, 190, 45, 181, 220, 214, 152, 50, - 206, 46, 202, 102, 60, 155, 234, 110, 209, 90, 148, 141, 47, 215, 117, - 73, 25, 11, 13, 2, 230, 36, 229, 169, 22, 233, 55, 175, 210, 228, - 49, 155, 83, 62, 52, 188, 186, 82, 193, 156, 144, 165, 172, 81, 84, - 115, 121, 188, 243, 19, 251, 62, 41, 147, 34, 90, 38, 243, 203, 7, - 46, 150, 44, 147, 117, 62, 15, 229, 167, 231, 44, 74, 242, 3, 188, - 55, 54, 183, 187, 109, 137, 205, 59, 178, 159, 217, 87, 19, 197, 161, - 222, 192, 46, 145, 126, 29, 212, 105, 248, 74, 242, 144, 140, 198, 142, - 101, 101, 230, 162, 101, 195, 156, 38, 86, 135, 184, 250, 56, 7, 57, - 173, 0, 187, 147, 129, 43, 67, 14, 98, 10, 198, 220, 80, 64, 122, - 186, 226, 68, 41, 170, 67, 181, 232, 67, 22, 104, 130, 224, 155, 43, - 187, 197, 209, 13, 97, 143, 71, 81, 8, 177, 87, 16, 13, 41, 214, - 118, 203, 162, 214, 91, 37, 43, 146, 67, 7, 234, 20, 93, 144, 154, - 177, 56, 89, 7, 166, 110, 160, 157, 246, 62, 91, 194, 125, 223, 151, - 89, 35, 199, 209, 216, 169, 252, 205, 165, 250, 64, 142, 115, 28, 187, - 55, 234, 9, 73, 121, 35, 19, 115, 199, 158, 115, 197, 43, 54, 87, - 85, 218, 81, 83, 123, 1, 86, 202, 28, 10, 157, 154, 34, 3, 133, - 224, 102, 254, 9, 251, 164, 111, 75, 89, 130, 236, 183, 76, 67, 159, - 133, 220, 93, 223, 78, 50, 157, 148, 231, 153, 199, 240, 235, 14, 9, - 17, 227, 66, 203, 214, 94, 120, 170, 16, 95, 25, 61, 113, 53, 41, - 34, 91, 107, 111, 234, 33, 250, 4, 233, 18, 37, 197, 116, 74, 103, - 37, 65, 223, 219, 56, 254, 27, 47, 220, 103, 153, 55, 79, 161, 9, - 61, 86, 61, 222, 97, 125, 89, 232, 107, 59, 179, 60, 173, 93, 152, - 191, 231, 222, 80, 173, 229, 160, 118, 243, 155, 160, 143, 6, 201, 132, - 252, 29, 27, 28, 143, 15, 130, 12, 217, 155, 209, 120, 66, 125, 177, - 10, 91, 250, 215, 123, 140, 221, 144, 179, 251, 66, 241, 154, 87, 12, - 66, 38, 184, 69, 179, 166, 212, 7, 89, 161, 35, 155, 78, 204, 79, - 87, 227, 45, 226, 155, 14, 93, 251, 101, 203, 205, 154, 199, 81, 173, - 12, 183, 36, 233, 25, 169, 68, 11, 247, 179, 83, 88, 125, 21, 42, - 87, 200, 222, 49, 155, 222, 149, 27, 207, 117, 198, 115, 93, 73, 103, - 224, 97, 120, 76, 28, 12, 37, 143, 175, 217, 134, 89, 176, 75, 77, - 16, 171, 4, 163, 183, 197, 61, 42, 248, 58, 183, 60, 164, 97, 57, - 207, 195, 241, 117, 61, 165, 131, 170, 61, 169, 224, 46, 39, 71, 89, - 181, 1, 218, 147, 173, 10, 52, 155, 224, 112, 33, 243, 192, 168, 243, - 105, 21, 87, 241, 69, 241, 50, 93, 216, 209, 229, 102, 47, 232, 236, - 222, 115, 49, 161, 176, 118, 157, 77, 253, 146, 252, 218, 220, 181, 77, - 69, 218, 40, 138, 96, 151, 168, 101, 207, 25, 161, 236, 99, 48, 243, - 146, 3, 15, 170, 226, 50, 245, 26, 187, 75, 165, 122, 29, 126, 106, - 163, 252, 71, 234, 160, 237, 149, 225, 88, 108, 4, 63, 17, 2, 49, - 134, 253, 97, 27, 230, 201, 17, 85, 129, 214, 208, 79, 161, 182, 1, - 213, 108, 50, 46, 56, 231, 8, 108, 172, 151, 178, 141, 40, 177, 115, - 162, 88, 35, 23, 114, 187, 191, 241, 226, 237, 243, 14, 12, 22, 115, - 19, 147, 24, 231, 36, 167, 110, 177, 71, 173, 12, 246, 156, 111, 83, - 200, 40, 188, 157, 0, 51, 16, 45, 205, 40, 225, 46, 149, 146, 90, - 101, 11, 23, 171, 59, 237, 151, 219, 225, 223, 90, 158, 110, 83, 210, - 11, 79, 174, 126, 107, 53, 37, 25, 72, 150, 225, 214, 203, 146, 136, - 123, 53, 37, 18, 25, 158, 38, 73, 38, 197, 226, 234, 25, 241, 200, - 225, 72, 233, 249, 78, 253, 88, 54, 113, 130, 28, 46, 98, 155, 158, - 175, 197, 92, 138, 217, 68, 134, 105, 199, 156, 118, 242, 156, 90, 82, - 236, 117, 194, 23, 105, 135, 99, 8, 123, 116, 89, 149, 31, 39, 181, - 135, 111, 66, 180, 175, 57, 21, 135, 174, 123, 219, 165, 223, 232, 243, - 175, 155, 199, 229, 151, 109, 38, 46, 163, 245, 201, 166, 246, 98, 157, - 204, 36, 25, 117, 49, 167, 113, 193, 245, 141, 138, 98, 142, 254, 82, - 206, 113, 185, 59, 131, 106, 235, 146, 231, 70, 218, 96, 31, 202, 103, - 1, 50, 68, 113, 180, 100, 225, 181, 15, 29, 41, 220, 143, 70, 57, - 49, 89, 88, 48, 115, 141, 253, 194, 162, 250, 230, 122, 54, 171, 40, - 124, 90, 24, 89, 50, 237, 71, 10, 244, 42, 173, 71, 79, 212, 118, - 215, 94, 239, 105, 112, 144, 96, 169, 226, 47, 50, 109, 106, 52, 99, - 30, 249, 172, 112, 20, 219, 85, 98, 77, 241, 92, 233, 34, 225, 28, - 163, 15, 42, 125, 91, 133, 131, 59, 93, 241, 106, 125, 148, 104, 150, - 141, 68, 220, 242, 201, 186, 52, 94, 148, 77, 254, 186, 229, 128, 216, - 149, 175, 170, 132, 157, 184, 38, 50, 235, 242, 171, 215, 61, 75, 112, - 39, 52, 149, 219, 110, 60, 126, 106, 73, 29, 109, 12, 189, 189, 19, - 211, 146, 45, 195, 91, 45, 100, 25, 156, 89, 110, 207, 28, 157, 190, - 252, 190, 166, 108, 137, 162, 116, 112, 9, 59, 235, 115, 250, 22, 109, - 179, 100, 184, 218, 225, 129, 246, 138, 244, 235, 98, 254, 121, 131, 209, - 33, 166, 152, 142, 176, 231, 66, 171, 59, 43, 173, 131, 148, 15, 163, - 89, 237, 51, 77, 12, 37, 111, 159, 66, 3, 135, 30, 59, 6, 146, - 247, 237, 158, 222, 123, 170, 144, 56, 65, 230, 121, 172, 119, 71, 15, - 229, 158, 122, 177, 137, 137, 190, 101, 108, 26, 19, 142, 126, 139, 234, - 78, 222, 139, 226, 114, 138, 39, 183, 30, 83, 14, 83, 5, 31, 196, - 111, 113, 248, 141, 23, 229, 208, 9, 205, 246, 222, 101, 107, 247, 90, - 227, 147, 84, 91, 155, 145, 145, 147, 151, 31, 145, 253, 186, 125, 77, - 237, 50, 203, 72, 125, 107, 177, 29, 143, 91, 243, 251, 164, 59, 125, - 67, 16, 177, 248, 245, 61, 134, 53, 90, 15, 159, 175, 61, 195, 12, - 170, 40, 154, 134, 250, 248, 23, 240, 82, 191, 124, 26, 24, 126, 244, - 88, 170, 149, 176, 79, 35, 92, 200, 147, 23, 177, 48, 219, 107, 34, - 24, 147, 219, 93, 100, 3, 59, 55, 237, 112, 101, 62, 34, 129, 250, - 60, 163, 72, 20, 77, 92, 220, 241, 164, 176, 101, 99, 113, 38, 13, - 165, 146, 212, 253, 226, 126, 195, 227, 83, 136, 223, 119, 166, 244, 190, - 131, 214, 34, 253, 83, 95, 100, 150, 209, 198, 107, 62, 167, 125, 59, - 98, 73, 28, 235, 100, 6, 61, 77, 132, 2, 118, 26, 235, 203, 239, - 22, 43, 179, 75, 110, 236, 146, 87, 115, 189, 122, 213, 116, 213, 167, - 255, 142, 206, 65, 196, 14, 147, 222, 192, 90, 133, 214, 41, 84, 229, - 124, 238, 248, 238, 65, 252, 240, 69, 10, 124, 239, 196, 150, 187, 43, - 136, 147, 74, 220, 226, 104, 142, 232, 7, 86, 93, 174, 73, 249, 171, - 62, 131, 62, 89, 229, 70, 7, 102, 151, 47, 178, 105, 62, 87, 189, - 200, 253, 172, 124, 119, 149, 116, 114, 202, 85, 172, 127, 168, 211, 91, - 155, 242, 117, 38, 15, 207, 237, 199, 230, 111, 197, 139, 15, 52, 238, - 83, 245, 22, 126, 59, 234, 160, 214, 218, 60, 204, 205, 87, 125, 200, - 158, 33, 73, 136, 182, 22, 48, 151, 159, 232, 29, 113, 80, 177, 94, - 237, 121, 239, 81, 29, 238, 219, 88, 206, 33, 239, 170, 221, 83, 40, - 205, 45, 109, 144, 220, 248, 170, 180, 141, 56, 78, 138, 231, 88, 36, - 54, 61, 126, 181, 251, 215, 100, 149, 85, 164, 234, 92, 99, 226, 17, - 127, 19, 228, 175, 21, 201, 205, 45, 147, 185, 213, 118, 190, 72, 216, - 229, 211, 187, 47, 16, 93, 194, 166, 182, 198, 228, 5, 47, 113, 199, - 33, 197, 189, 242, 98, 127, 133, 248, 255, 152, 251, 238, 176, 40, 146, - 231, 239, 37, 232, 154, 80, 84, 84, 48, 174, 1, 19, 138, 128, 98, - 32, 237, 204, 168, 96, 150, 83, 48, 7, 64, 5, 5, 84, 196, 128, - 9, 88, 64, 49, 11, 102, 209, 83, 49, 220, 137, 152, 0, 81, 81, - 1, 215, 156, 191, 162, 39, 138, 98, 88, 3, 6, 76, 152, 21, 65, - 223, 238, 221, 233, 158, 94, 220, 157, 89, 126, 187, 127, 188, 247, 60, - 60, 214, 51, 215, 93, 53, 85, 83, 159, 234, 234, 234, 176, 113, 35, - 67, 19, 70, 165, 218, 205, 142, 29, 51, 197, 219, 37, 175, 243, 145, - 159, 206, 117, 18, 223, 158, 30, 80, 100, 57, 119, 195, 187, 215, 255, - 203, 161, 172, 39, 55, 95, 21, 189, 103, 146, 181, 229, 116, 235, 224, - 135, 91, 2, 191, 126, 45, 233, 89, 245, 162, 185, 137, 200, 201, 225, - 238, 144, 26, 131, 142, 44, 189, 111, 107, 148, 119, 201, 216, 178, 87, - 199, 196, 225, 115, 99, 199, 31, 233, 179, 34, 113, 246, 119, 143, 135, - 57, 235, 139, 47, 250, 118, 61, 126, 254, 194, 196, 230, 59, 30, 133, - 22, 30, 29, 181, 125, 244, 198, 143, 149, 90, 53, 61, 155, 122, 193, - 190, 126, 179, 216, 2, 81, 181, 143, 103, 87, 181, 152, 178, 170, 164, - 243, 207, 123, 99, 51, 82, 141, 211, 182, 7, 230, 173, 27, 239, 58, - 204, 126, 73, 233, 181, 254, 71, 110, 31, 113, 244, 237, 221, 181, 123, - 69, 241, 223, 115, 215, 93, 157, 241, 106, 222, 152, 127, 246, 7, 15, - 178, 171, 243, 171, 166, 131, 217, 178, 231, 73, 11, 63, 29, 28, 179, - 244, 221, 189, 83, 227, 118, 25, 175, 111, 183, 160, 66, 134, 85, 201, - 128, 3, 127, 167, 219, 126, 60, 79, 221, 217, 153, 94, 241, 174, 40, - 62, 241, 75, 199, 14, 31, 31, 53, 252, 52, 186, 167, 197, 215, 47, - 247, 191, 110, 62, 183, 68, 210, 252, 68, 45, 75, 247, 177, 77, 14, - 127, 186, 21, 102, 118, 207, 161, 228, 192, 141, 139, 238, 61, 103, 13, - 47, 248, 222, 42, 255, 89, 78, 199, 177, 33, 237, 251, 92, 91, 252, - 168, 121, 219, 109, 177, 215, 210, 236, 175, 70, 134, 13, 237, 153, 212, - 226, 201, 104, 233, 18, 183, 224, 106, 51, 182, 57, 77, 180, 152, 254, - 245, 164, 245, 127, 87, 235, 90, 198, 250, 68, 141, 171, 242, 213, 170, - 96, 253, 191, 233, 71, 110, 251, 31, 168, 231, 22, 116, 179, 111, 219, - 38, 143, 191, 85, 254, 246, 185, 94, 106, 112, 187, 138, 19, 36, 11, - 219, 103, 63, 62, 58, 98, 236, 251, 185, 159, 179, 18, 70, 36, 95, - 9, 170, 56, 136, 154, 254, 172, 249, 138, 33, 231, 55, 190, 51, 22, - 251, 55, 24, 113, 177, 210, 160, 251, 7, 188, 158, 2, 135, 27, 176, - 62, 173, 112, 89, 199, 134, 9, 251, 6, 157, 55, 50, 218, 88, 227, - 202, 10, 227, 176, 176, 195, 137, 105, 59, 175, 29, 201, 77, 144, 90, - 53, 60, 246, 211, 251, 112, 220, 111, 145, 107, 131, 12, 159, 110, 222, - 15, 221, 159, 45, 156, 88, 146, 59, 249, 248, 225, 136, 95, 183, 140, - 250, 116, 107, 86, 121, 208, 253, 129, 197, 67, 130, 44, 190, 73, 242, - 220, 123, 76, 49, 202, 143, 75, 121, 233, 186, 219, 247, 254, 250, 103, - 251, 237, 51, 101, 231, 250, 61, 245, 17, 31, 152, 249, 207, 192, 185, - 14, 97, 19, 108, 247, 153, 45, 221, 213, 123, 230, 39, 144, 43, 22, - 188, 190, 254, 43, 126, 244, 222, 144, 246, 50, 241, 215, 157, 91, 151, - 135, 31, 127, 248, 79, 221, 228, 235, 23, 189, 178, 69, 39, 118, 27, - 53, 79, 254, 247, 99, 199, 46, 67, 162, 115, 91, 77, 113, 107, 209, - 54, 244, 88, 239, 61, 23, 237, 107, 255, 22, 93, 233, 82, 103, 198, - 207, 226, 137, 109, 119, 30, 13, 54, 105, 91, 225, 249, 189, 136, 46, - 174, 21, 66, 63, 118, 56, 234, 217, 126, 104, 207, 161, 162, 208, 164, - 116, 179, 95, 185, 19, 166, 78, 89, 254, 210, 234, 181, 227, 17, 185, - 81, 252, 253, 58, 226, 205, 142, 78, 85, 75, 230, 216, 5, 180, 147, - 248, 78, 52, 31, 226, 33, 174, 159, 252, 32, 48, 197, 163, 185, 53, - 211, 62, 41, 170, 69, 13, 167, 35, 7, 19, 90, 247, 154, 48, 249, - 242, 237, 6, 33, 30, 75, 239, 254, 106, 63, 212, 255, 192, 17, 73, - 146, 115, 74, 69, 170, 249, 164, 15, 55, 234, 140, 12, 158, 177, 111, - 167, 127, 152, 168, 203, 210, 109, 93, 204, 198, 220, 14, 54, 86, 88, - 69, 85, 205, 156, 250, 229, 74, 164, 237, 62, 115, 167, 153, 235, 124, - 2, 166, 26, 187, 102, 175, 168, 154, 145, 150, 50, 242, 185, 233, 39, - 209, 89, 143, 154, 63, 102, 213, 240, 151, 213, 152, 236, 107, 69, 15, - 202, 253, 104, 101, 53, 65, 122, 213, 251, 115, 225, 210, 49, 233, 51, - 18, 218, 54, 59, 246, 120, 85, 97, 247, 183, 159, 3, 246, 30, 111, - 223, 243, 129, 200, 104, 243, 182, 90, 190, 81, 86, 93, 76, 214, 143, - 48, 59, 176, 108, 244, 178, 9, 11, 170, 255, 21, 20, 93, 213, 207, - 105, 78, 150, 219, 232, 58, 191, 255, 251, 186, 237, 192, 223, 206, 99, - 198, 190, 185, 179, 160, 212, 239, 200, 187, 133, 23, 23, 172, 78, 79, - 105, 240, 97, 90, 238, 193, 153, 165, 238, 167, 38, 254, 37, 95, 115, - 176, 222, 253, 23, 67, 67, 218, 123, 189, 202, 123, 43, 61, 62, 46, - 119, 199, 133, 255, 253, 22, 245, 46, 157, 250, 101, 108, 206, 188, 205, - 83, 74, 157, 158, 230, 63, 240, 115, 28, 98, 41, 94, 91, 250, 86, - 114, 245, 127, 231, 54, 174, 247, 119, 232, 253, 164, 247, 157, 163, 165, - 131, 139, 251, 28, 248, 177, 249, 216, 219, 110, 173, 102, 153, 156, 185, - 176, 155, 41, 237, 82, 220, 252, 240, 181, 177, 153, 25, 25, 13, 54, - 201, 47, 252, 188, 151, 48, 182, 239, 247, 26, 159, 79, 6, 205, 12, - 95, 115, 95, 145, 60, 252, 180, 251, 249, 1, 143, 30, 223, 57, 244, - 198, 121, 209, 190, 143, 43, 171, 116, 235, 186, 216, 109, 194, 183, 73, - 179, 222, 122, 205, 247, 30, 180, 176, 237, 190, 184, 21, 205, 101, 206, - 29, 155, 12, 57, 124, 98, 202, 197, 228, 54, 109, 45, 19, 86, 201, - 229, 185, 125, 38, 79, 238, 92, 115, 228, 129, 23, 139, 31, 55, 46, - 248, 22, 100, 147, 81, 119, 229, 179, 117, 70, 55, 98, 140, 79, 14, - 251, 228, 113, 176, 81, 224, 230, 191, 108, 22, 110, 237, 255, 107, 87, - 163, 113, 97, 245, 110, 79, 54, 206, 153, 118, 101, 75, 212, 226, 22, - 126, 251, 199, 30, 165, 26, 15, 253, 126, 191, 90, 218, 166, 143, 146, - 233, 230, 161, 151, 238, 92, 190, 178, 123, 111, 231, 170, 54, 201, 41, - 213, 29, 106, 93, 221, 213, 205, 56, 194, 166, 203, 149, 53, 195, 95, - 79, 27, 26, 252, 163, 206, 146, 118, 87, 187, 84, 180, 31, 60, 178, - 195, 158, 116, 47, 219, 142, 65, 255, 60, 48, 126, 49, 186, 239, 181, - 163, 91, 15, 37, 222, 170, 247, 63, 171, 166, 67, 234, 214, 105, 97, - 118, 168, 153, 91, 197, 177, 238, 137, 142, 63, 115, 7, 181, 15, 121, - 28, 124, 41, 202, 230, 237, 249, 57, 119, 122, 47, 191, 20, 208, 240, - 201, 121, 102, 152, 108, 215, 30, 151, 131, 191, 190, 238, 155, 119, 46, - 112, 197, 194, 117, 49, 157, 198, 215, 117, 168, 226, 97, 47, 77, 240, - 222, 248, 210, 114, 100, 207, 37, 115, 143, 154, 22, 100, 36, 216, 12, - 31, 124, 241, 214, 139, 119, 245, 235, 52, 207, 184, 240, 91, 244, 229, - 118, 114, 114, 179, 27, 99, 74, 71, 215, 107, 219, 106, 224, 163, 254, - 195, 45, 86, 223, 57, 244, 98, 76, 11, 73, 179, 126, 86, 62, 237, - 198, 158, 184, 113, 224, 192, 229, 148, 186, 93, 172, 197, 69, 65, 147, - 206, 173, 93, 99, 243, 177, 85, 66, 104, 142, 247, 144, 228, 81, 7, - 76, 21, 153, 133, 137, 230, 103, 246, 76, 25, 253, 35, 43, 47, 112, - 253, 224, 251, 213, 115, 134, 231, 255, 19, 102, 118, 105, 112, 147, 197, - 219, 66, 186, 188, 176, 61, 56, 105, 95, 244, 209, 74, 145, 107, 26, - 100, 138, 46, 77, 99, 150, 103, 143, 238, 62, 180, 191, 119, 179, 79, - 237, 101, 91, 110, 93, 169, 59, 113, 204, 192, 209, 163, 50, 239, 85, - 183, 185, 191, 59, 96, 68, 45, 247, 144, 210, 172, 213, 14, 214, 3, - 250, 123, 231, 23, 207, 152, 59, 198, 42, 122, 253, 149, 140, 67, 85, - 46, 159, 186, 63, 61, 45, 255, 104, 65, 224, 250, 252, 209, 113, 25, - 87, 163, 29, 188, 31, 122, 46, 15, 30, 21, 185, 113, 229, 241, 245, - 255, 182, 47, 169, 215, 44, 165, 170, 109, 43, 255, 154, 63, 42, 214, - 120, 49, 225, 85, 78, 216, 180, 251, 237, 111, 119, 158, 228, 179, 125, - 84, 71, 55, 83, 217, 151, 143, 37, 254, 78, 171, 54, 108, 235, 227, - 216, 55, 108, 242, 196, 197, 97, 145, 171, 79, 53, 172, 244, 50, 240, - 195, 235, 253, 159, 223, 30, 92, 87, 55, 224, 127, 135, 23, 90, 153, - 84, 219, 245, 121, 239, 145, 187, 145, 97, 116, 226, 16, 102, 135, 241, - 85, 163, 17, 185, 10, 139, 143, 201, 247, 183, 72, 27, 143, 168, 209, - 173, 120, 93, 255, 248, 148, 214, 109, 75, 158, 119, 165, 62, 207, 219, - 48, 252, 82, 241, 244, 172, 141, 79, 227, 167, 52, 207, 119, 153, 89, - 24, 231, 151, 99, 124, 251, 203, 237, 85, 178, 37, 207, 127, 5, 252, - 156, 101, 155, 36, 237, 191, 99, 245, 237, 213, 67, 171, 13, 91, 119, - 223, 120, 224, 122, 151, 77, 149, 74, 27, 28, 177, 56, 158, 109, 223, - 182, 202, 182, 54, 91, 214, 109, 27, 249, 57, 122, 210, 210, 211, 107, - 198, 62, 150, 249, 181, 152, 90, 122, 254, 102, 233, 22, 139, 110, 126, - 219, 22, 47, 232, 190, 112, 157, 255, 149, 153, 19, 221, 182, 184, 246, - 57, 208, 115, 216, 162, 102, 86, 244, 167, 211, 103, 247, 228, 116, 31, - 178, 50, 90, 30, 229, 77, 109, 75, 138, 52, 118, 201, 11, 218, 145, - 217, 127, 218, 194, 171, 227, 23, 219, 121, 236, 169, 244, 241, 229, 75, - 155, 216, 42, 227, 147, 63, 136, 253, 7, 57, 121, 108, 104, 95, 101, - 85, 248, 192, 69, 173, 173, 199, 117, 116, 158, 253, 52, 209, 225, 86, - 90, 119, 247, 1, 70, 62, 93, 187, 236, 217, 251, 185, 208, 115, 129, - 104, 251, 67, 202, 37, 172, 241, 132, 152, 189, 161, 149, 37, 117, 242, - 122, 21, 13, 185, 181, 58, 130, 170, 120, 185, 197, 165, 70, 45, 222, - 39, 110, 166, 170, 13, 167, 68, 173, 29, 170, 63, 139, 236, 192, 28, - 173, 213, 194, 188, 206, 242, 97, 149, 86, 91, 172, 140, 59, 177, 126, - 201, 125, 219, 225, 141, 107, 102, 151, 182, 152, 243, 121, 111, 255, 33, - 243, 3, 141, 90, 86, 137, 75, 246, 200, 207, 221, 209, 250, 113, 132, - 139, 105, 155, 238, 11, 142, 46, 90, 250, 169, 120, 100, 159, 209, 179, - 215, 123, 219, 12, 167, 60, 99, 107, 215, 206, 238, 220, 107, 138, 251, - 199, 73, 178, 134, 35, 205, 143, 236, 105, 177, 82, 180, 101, 123, 124, - 193, 63, 251, 255, 25, 182, 126, 202, 228, 11, 23, 226, 163, 229, 95, - 134, 92, 119, 27, 219, 50, 230, 247, 173, 175, 219, 246, 219, 206, 254, - 223, 135, 131, 29, 31, 52, 203, 157, 85, 210, 224, 245, 151, 59, 59, - 75, 71, 60, 184, 19, 126, 248, 249, 111, 145, 215, 161, 249, 27, 226, - 86, 70, 31, 169, 243, 207, 169, 238, 103, 223, 39, 189, 109, 219, 215, - 121, 219, 170, 229, 49, 103, 195, 91, 93, 217, 213, 32, 195, 246, 245, - 154, 41, 247, 35, 3, 254, 155, 108, 183, 229, 229, 142, 130, 6, 62, - 23, 37, 77, 18, 65, 16, 237, 103, 59, 251, 76, 208, 241, 192, 182, - 219, 135, 197, 92, 30, 215, 193, 124, 126, 189, 169, 67, 118, 100, 191, - 169, 31, 117, 197, 106, 244, 11, 191, 157, 63, 34, 231, 13, 111, 116, - 125, 238, 251, 137, 85, 90, 53, 237, 250, 97, 144, 120, 91, 220, 24, - 89, 214, 197, 241, 181, 76, 236, 55, 86, 243, 89, 215, 188, 253, 197, - 79, 19, 23, 189, 127, 151, 191, 225, 169, 29, 125, 217, 61, 199, 181, - 190, 247, 148, 186, 125, 109, 234, 24, 37, 156, 253, 32, 250, 49, 108, - 94, 250, 137, 208, 91, 198, 244, 197, 55, 13, 102, 250, 117, 243, 217, - 214, 193, 118, 113, 157, 228, 33, 223, 63, 88, 217, 173, 58, 107, 245, - 60, 112, 100, 196, 22, 139, 129, 127, 167, 157, 90, 241, 81, 222, 169, - 90, 192, 143, 67, 133, 57, 201, 199, 46, 119, 106, 178, 188, 197, 187, - 7, 212, 214, 49, 169, 37, 174, 131, 78, 91, 90, 246, 110, 241, 180, - 249, 235, 167, 131, 221, 143, 103, 74, 114, 253, 146, 143, 22, 221, 221, - 21, 113, 239, 228, 137, 29, 141, 127, 139, 226, 79, 109, 186, 119, 254, - 227, 222, 16, 179, 244, 104, 179, 224, 189, 47, 115, 63, 117, 248, 116, - 196, 101, 249, 213, 246, 251, 231, 244, 29, 112, 249, 213, 63, 63, 67, - 141, 215, 61, 252, 183, 77, 106, 173, 115, 243, 235, 30, 249, 90, 152, - 59, 63, 45, 112, 97, 157, 180, 184, 120, 179, 162, 142, 5, 191, 70, - 78, 220, 189, 178, 221, 43, 191, 132, 125, 183, 188, 229, 119, 131, 63, - 217, 186, 125, 206, 61, 179, 121, 232, 147, 75, 163, 247, 245, 246, 241, - 179, 170, 119, 249, 68, 232, 152, 227, 77, 2, 47, 88, 239, 155, 236, - 121, 41, 216, 253, 99, 188, 253, 245, 119, 217, 123, 7, 197, 173, 60, - 184, 188, 66, 194, 4, 239, 71, 23, 54, 221, 123, 211, 120, 86, 142, - 125, 248, 250, 97, 179, 28, 211, 30, 141, 88, 24, 208, 98, 128, 248, - 223, 83, 5, 71, 7, 223, 246, 218, 238, 125, 161, 232, 85, 53, 201, - 206, 152, 23, 79, 47, 23, 15, 62, 209, 118, 221, 106, 155, 206, 255, - 172, 31, 95, 115, 104, 195, 215, 83, 159, 59, 68, 218, 94, 107, 188, - 54, 121, 153, 205, 158, 181, 78, 195, 229, 151, 172, 22, 63, 155, 250, - 205, 38, 167, 234, 151, 166, 15, 141, 179, 206, 213, 28, 84, 107, 122, - 101, 135, 3, 115, 179, 221, 11, 190, 175, 190, 86, 255, 196, 94, 175, - 13, 171, 107, 53, 90, 167, 184, 188, 42, 230, 193, 234, 31, 235, 103, - 6, 157, 58, 112, 239, 189, 71, 80, 221, 10, 97, 29, 98, 236, 62, - 58, 157, 220, 220, 200, 107, 71, 254, 192, 199, 201, 139, 246, 83, 105, - 98, 35, 135, 117, 78, 31, 127, 100, 57, 85, 122, 215, 225, 248, 222, - 45, 151, 54, 245, 170, 179, 176, 69, 68, 171, 58, 125, 135, 94, 190, - 183, 201, 220, 188, 225, 241, 172, 245, 173, 199, 213, 170, 176, 241, 244, - 209, 161, 31, 106, 223, 77, 30, 125, 247, 240, 155, 65, 79, 170, 120, - 117, 139, 15, 97, 230, 142, 57, 57, 164, 227, 243, 255, 26, 29, 174, - 178, 167, 123, 5, 207, 244, 189, 1, 29, 219, 62, 253, 190, 45, 59, - 123, 178, 233, 127, 116, 64, 223, 177, 25, 118, 187, 86, 133, 173, 29, - 88, 144, 59, 53, 33, 228, 198, 229, 241, 39, 86, 143, 108, 55, 218, - 163, 70, 114, 243, 131, 191, 230, 30, 157, 236, 94, 79, 210, 172, 209, - 173, 146, 139, 255, 210, 102, 199, 135, 239, 44, 233, 217, 215, 173, 91, - 167, 90, 195, 231, 159, 142, 236, 18, 55, 36, 250, 146, 151, 121, 238, - 186, 253, 81, 139, 93, 6, 137, 251, 206, 77, 155, 60, 189, 253, 198, - 36, 179, 101, 109, 90, 186, 214, 190, 182, 209, 173, 160, 224, 198, 29, - 201, 41, 102, 245, 217, 241, 187, 79, 237, 12, 255, 236, 88, 189, 119, - 235, 156, 38, 115, 63, 54, 244, 72, 104, 114, 111, 83, 243, 117, 61, - 3, 105, 177, 165, 217, 242, 232, 26, 73, 43, 134, 59, 207, 118, 24, - 127, 168, 93, 219, 245, 49, 141, 27, 206, 60, 189, 227, 212, 94, 23, - 35, 217, 252, 136, 103, 47, 247, 212, 176, 178, 146, 139, 254, 59, 54, - 168, 147, 73, 133, 85, 167, 92, 186, 216, 205, 106, 55, 223, 171, 112, - 90, 149, 140, 216, 142, 181, 106, 68, 137, 47, 223, 179, 105, 218, 34, - 189, 242, 19, 143, 197, 77, 188, 115, 135, 55, 181, 172, 16, 63, 59, - 74, 225, 118, 77, 84, 53, 181, 202, 85, 227, 36, 59, 170, 232, 227, - 251, 237, 35, 71, 7, 223, 47, 217, 55, 64, 18, 45, 241, 216, 221, - 243, 104, 203, 75, 157, 91, 249, 248, 25, 69, 101, 204, 140, 115, 91, - 223, 222, 119, 204, 58, 219, 185, 3, 99, 106, 244, 45, 30, 75, 217, - 228, 14, 14, 162, 140, 77, 58, 182, 171, 24, 63, 173, 160, 241, 212, - 89, 49, 126, 171, 36, 167, 175, 214, 245, 169, 108, 180, 190, 249, 162, - 253, 51, 70, 222, 95, 184, 255, 91, 188, 239, 248, 41, 39, 222, 53, - 120, 255, 178, 222, 40, 175, 35, 133, 149, 39, 30, 108, 126, 185, 193, - 219, 105, 133, 55, 198, 254, 206, 253, 60, 118, 239, 35, 199, 88, 241, - 152, 160, 236, 147, 45, 236, 6, 154, 77, 10, 123, 112, 113, 174, 223, - 204, 23, 63, 55, 251, 121, 196, 202, 44, 194, 250, 108, 72, 109, 181, - 190, 235, 236, 222, 31, 238, 12, 127, 180, 39, 189, 174, 131, 69, 204, - 231, 86, 19, 243, 135, 127, 61, 54, 180, 69, 99, 105, 137, 251, 158, - 97, 29, 140, 3, 94, 214, 48, 74, 188, 147, 86, 116, 121, 87, 237, - 246, 214, 217, 121, 138, 157, 15, 118, 122, 251, 157, 180, 49, 91, 121, - 245, 151, 185, 211, 156, 25, 11, 219, 50, 189, 243, 35, 154, 244, 111, - 212, 110, 130, 67, 181, 240, 78, 213, 106, 175, 104, 119, 160, 187, 185, - 209, 86, 231, 129, 223, 15, 95, 15, 221, 150, 48, 44, 157, 146, 52, - 54, 165, 166, 140, 22, 221, 235, 107, 85, 219, 100, 220, 30, 234, 109, - 224, 166, 171, 62, 93, 154, 12, 62, 211, 225, 88, 226, 102, 231, 5, - 210, 6, 206, 181, 188, 38, 43, 170, 20, 127, 255, 242, 239, 230, 61, - 107, 47, 154, 230, 13, 31, 96, 99, 229, 95, 233, 183, 168, 241, 177, - 121, 118, 163, 41, 209, 66, 227, 243, 127, 101, 108, 27, 241, 115, 70, - 233, 131, 45, 222, 169, 241, 146, 51, 93, 199, 212, 60, 243, 108, 251, - 6, 48, 231, 239, 111, 225, 180, 239, 218, 107, 115, 119, 73, 179, 53, - 169, 115, 26, 94, 124, 91, 56, 182, 229, 30, 191, 124, 255, 220, 187, - 157, 15, 189, 153, 37, 138, 115, 184, 251, 124, 234, 201, 253, 13, 156, - 103, 92, 109, 26, 178, 32, 209, 221, 207, 164, 183, 116, 131, 159, 123, - 162, 215, 23, 187, 160, 97, 206, 205, 198, 249, 14, 107, 75, 187, 196, - 13, 255, 58, 113, 225, 203, 118, 11, 214, 167, 167, 101, 250, 120, 152, - 207, 111, 19, 57, 101, 99, 73, 157, 65, 215, 198, 181, 221, 240, 172, - 235, 187, 253, 37, 125, 142, 57, 13, 222, 208, 221, 209, 113, 102, 140, - 212, 97, 187, 169, 149, 81, 226, 219, 152, 185, 91, 102, 84, 61, 56, - 97, 136, 183, 243, 173, 243, 46, 244, 224, 199, 27, 18, 210, 189, 223, - 207, 11, 26, 213, 189, 118, 247, 51, 237, 19, 221, 77, 35, 171, 198, - 181, 157, 248, 122, 194, 138, 124, 209, 248, 164, 2, 199, 85, 107, 123, - 55, 184, 93, 124, 37, 226, 115, 251, 97, 102, 183, 155, 210, 79, 191, - 5, 231, 158, 24, 243, 121, 205, 98, 123, 249, 18, 197, 192, 165, 169, - 159, 95, 118, 206, 205, 185, 247, 168, 85, 175, 194, 65, 149, 106, 86, - 173, 235, 251, 60, 188, 246, 209, 253, 147, 219, 38, 245, 79, 16, 53, - 148, 53, 221, 16, 17, 246, 109, 223, 36, 39, 219, 81, 255, 4, 220, - 238, 109, 101, 245, 120, 233, 207, 6, 35, 92, 179, 122, 60, 28, 49, - 183, 71, 166, 101, 197, 57, 199, 102, 212, 202, 74, 24, 185, 160, 243, - 236, 232, 54, 23, 141, 36, 115, 166, 130, 201, 218, 146, 252, 156, 218, - 199, 183, 156, 31, 23, 226, 179, 196, 183, 235, 212, 18, 233, 128, 165, - 201, 183, 71, 182, 184, 88, 181, 107, 241, 134, 51, 131, 199, 48, 23, - 199, 4, 62, 173, 211, 106, 182, 120, 115, 147, 172, 245, 209, 15, 178, - 122, 29, 88, 120, 172, 95, 130, 180, 119, 222, 193, 7, 55, 246, 254, - 117, 234, 219, 79, 143, 59, 37, 199, 87, 222, 153, 87, 117, 103, 159, - 173, 94, 110, 85, 92, 219, 59, 217, 81, 189, 71, 47, 168, 85, 239, - 165, 81, 225, 224, 196, 117, 37, 251, 150, 210, 247, 168, 154, 198, 179, - 147, 110, 57, 108, 79, 200, 127, 251, 216, 230, 235, 188, 195, 51, 38, - 121, 139, 100, 153, 226, 91, 77, 102, 237, 53, 53, 137, 55, 218, 85, - 91, 124, 33, 247, 219, 200, 30, 33, 67, 134, 95, 218, 125, 230, 205, - 253, 208, 79, 65, 123, 67, 186, 156, 141, 238, 44, 142, 125, 248, 182, - 175, 232, 174, 168, 185, 155, 141, 91, 243, 255, 29, 95, 190, 57, 174, - 209, 206, 5, 207, 58, 153, 182, 106, 92, 177, 75, 193, 182, 26, 83, - 246, 124, 172, 208, 162, 145, 236, 94, 196, 162, 7, 7, 2, 186, 214, - 204, 61, 19, 87, 177, 201, 243, 156, 3, 162, 61, 205, 255, 238, 20, - 222, 35, 174, 244, 184, 104, 89, 208, 200, 1, 35, 163, 35, 171, 85, - 118, 185, 112, 161, 145, 89, 98, 236, 170, 248, 109, 182, 255, 181, 218, - 251, 109, 102, 192, 233, 208, 53, 171, 223, 28, 168, 248, 52, 111, 70, - 171, 87, 237, 122, 87, 105, 92, 101, 203, 69, 183, 6, 115, 59, 121, - 30, 144, 58, 250, 180, 124, 150, 178, 126, 203, 242, 240, 112, 39, 179, - 37, 77, 159, 5, 84, 28, 238, 215, 125, 234, 161, 26, 199, 143, 111, - 78, 46, 25, 187, 106, 179, 213, 18, 111, 187, 86, 177, 125, 143, 63, - 63, 222, 232, 224, 228, 153, 54, 169, 223, 199, 175, 184, 109, 237, 63, - 103, 78, 230, 138, 196, 223, 183, 123, 125, 251, 39, 222, 120, 198, 162, - 105, 51, 94, 245, 60, 249, 246, 233, 153, 1, 222, 247, 230, 39, 91, - 173, 188, 64, 111, 27, 191, 126, 213, 78, 79, 153, 209, 126, 139, 210, - 206, 219, 106, 255, 251, 186, 212, 105, 113, 78, 243, 225, 166, 238, 43, - 138, 162, 91, 245, 255, 45, 58, 149, 60, 103, 246, 203, 152, 195, 81, - 95, 234, 87, 219, 108, 190, 39, 230, 140, 251, 155, 27, 125, 171, 54, - 236, 115, 91, 90, 82, 251, 221, 171, 43, 243, 140, 127, 158, 63, 56, - 112, 252, 186, 148, 85, 45, 170, 155, 138, 172, 2, 54, 111, 206, 79, - 12, 61, 254, 122, 251, 222, 229, 249, 171, 123, 59, 216, 15, 41, 76, - 218, 189, 173, 195, 216, 157, 253, 118, 120, 135, 251, 109, 42, 168, 187, - 234, 163, 104, 127, 231, 161, 46, 251, 50, 82, 94, 229, 83, 111, 222, - 36, 61, 252, 178, 254, 135, 104, 208, 225, 235, 181, 31, 87, 63, 237, - 120, 39, 204, 113, 214, 187, 169, 187, 50, 102, 54, 159, 184, 186, 119, - 212, 132, 158, 78, 169, 159, 134, 238, 216, 184, 175, 78, 235, 5, 135, - 189, 147, 214, 109, 148, 157, 11, 245, 184, 18, 49, 244, 249, 179, 156, - 55, 153, 131, 189, 253, 78, 125, 152, 210, 98, 74, 183, 184, 254, 133, - 57, 143, 194, 220, 223, 110, 9, 189, 84, 127, 252, 184, 227, 111, 206, - 135, 126, 159, 188, 109, 202, 250, 253, 61, 115, 166, 53, 219, 151, 96, - 213, 36, 52, 118, 130, 231, 188, 78, 38, 135, 247, 49, 117, 38, 44, - 235, 148, 54, 35, 230, 233, 199, 32, 233, 137, 44, 19, 187, 9, 230, - 30, 3, 138, 254, 123, 126, 123, 255, 178, 213, 107, 42, 184, 181, 140, - 18, 79, 171, 85, 81, 58, 111, 88, 228, 30, 155, 214, 173, 44, 215, - 52, 152, 34, 94, 25, 85, 117, 234, 233, 161, 73, 3, 155, 212, 114, - 219, 118, 98, 231, 215, 13, 117, 69, 33, 83, 58, 126, 249, 250, 170, - 106, 157, 191, 55, 154, 123, 172, 220, 248, 246, 175, 180, 123, 179, 154, - 47, 250, 175, 199, 92, 219, 27, 9, 183, 38, 220, 220, 57, 75, 225, - 246, 52, 40, 236, 208, 198, 161, 247, 199, 75, 63, 199, 221, 205, 61, - 40, 189, 107, 83, 84, 209, 168, 246, 79, 143, 31, 135, 95, 254, 116, - 188, 75, 215, 170, 148, 215, 228, 232, 202, 168, 95, 247, 188, 122, 13, - 203, 95, 27, 46, 110, 180, 114, 199, 202, 160, 225, 209, 103, 223, 75, - 39, 126, 10, 127, 59, 34, 57, 151, 121, 122, 110, 150, 241, 236, 235, - 119, 134, 86, 189, 102, 250, 209, 228, 148, 135, 201, 249, 78, 53, 71, - 79, 222, 112, 105, 204, 147, 0, 203, 39, 174, 221, 123, 90, 119, 108, - 177, 98, 137, 243, 84, 251, 244, 137, 129, 138, 106, 219, 86, 14, 62, - 186, 225, 221, 203, 21, 166, 239, 237, 83, 236, 75, 11, 124, 19, 143, - 184, 28, 107, 231, 60, 245, 228, 178, 121, 51, 43, 12, 75, 252, 149, - 211, 106, 101, 190, 111, 82, 240, 141, 202, 53, 207, 70, 207, 175, 212, - 196, 253, 75, 80, 76, 235, 106, 212, 170, 243, 173, 130, 7, 196, 108, - 167, 42, 57, 228, 159, 93, 18, 243, 56, 251, 120, 211, 0, 217, 147, - 95, 55, 187, 82, 185, 111, 98, 154, 250, 44, 190, 55, 59, 60, 50, - 43, 217, 184, 223, 58, 243, 113, 83, 15, 209, 180, 164, 32, 125, 142, - 172, 184, 209, 177, 153, 87, 171, 191, 148, 88, 42, 102, 173, 122, 155, - 187, 195, 248, 131, 169, 213, 16, 103, 143, 135, 119, 134, 153, 26, 27, - 129, 121, 99, 222, 163, 130, 201, 162, 132, 126, 11, 159, 84, 252, 57, - 173, 249, 213, 234, 171, 51, 158, 236, 172, 155, 223, 116, 89, 109, 241, - 171, 5, 197, 233, 143, 197, 97, 14, 205, 103, 53, 153, 186, 127, 198, - 134, 233, 99, 168, 189, 159, 134, 12, 24, 176, 55, 125, 229, 193, 53, - 223, 166, 229, 180, 9, 218, 208, 102, 141, 113, 85, 115, 135, 188, 235, - 155, 142, 124, 252, 100, 187, 224, 250, 240, 249, 183, 226, 187, 54, 45, - 242, 253, 181, 171, 120, 230, 237, 175, 63, 36, 109, 174, 37, 172, 246, - 122, 119, 110, 192, 181, 163, 9, 245, 250, 230, 141, 56, 215, 196, 170, - 253, 247, 69, 205, 82, 170, 117, 232, 91, 244, 241, 229, 193, 223, 119, - 69, 34, 81, 119, 90, 36, 10, 6, 255, 122, 22, 77, 20, 215, 99, - 47, 8, 147, 39, 114, 119, 232, 137, 148, 109, 186, 251, 78, 158, 16, - 234, 171, 253, 190, 57, 68, 73, 0, 183, 16, 70, 36, 146, 73, 69, - 162, 68, 64, 87, 3, 180, 72, 202, 119, 103, 29, 146, 15, 101, 214, - 35, 56, 193, 247, 41, 43, 223, 214, 206, 206, 94, 219, 125, 119, 34, - 145, 131, 232, 218, 213, 171, 174, 34, 209, 69, 86, 166, 68, 39, 249, - 253, 64, 171, 116, 240, 111, 78, 206, 68, 113, 147, 63, 120, 162, 54, - 253, 124, 39, 135, 252, 249, 220, 20, 223, 49, 134, 46, 176, 131, 122, - 163, 63, 248, 31, 69, 169, 236, 16, 194, 108, 74, 176, 114, 83, 251, - 255, 198, 38, 34, 246, 61, 193, 59, 118, 98, 109, 70, 81, 255, 215, - 123, 2, 123, 123, 2, 155, 65, 137, 192, 142, 230, 232, 59, 250, 76, - 18, 171, 183, 161, 199, 205, 152, 52, 117, 138, 173, 239, 140, 96, 223, - 233, 156, 53, 177, 205, 129, 13, 60, 101, 234, 223, 30, 254, 71, 119, - 87, 253, 11, 239, 5, 244, 100, 219, 181, 97, 251, 121, 70, 113, 237, - 115, 82, 254, 236, 251, 39, 175, 250, 74, 203, 25, 107, 176, 181, 247, - 188, 62, 29, 176, 140, 40, 78, 70, 14, 120, 39, 40, 83, 121, 31, - 226, 42, 93, 100, 52, 208, 42, 35, 188, 210, 207, 20, 36, 3, 242, - 197, 122, 64, 25, 172, 46, 118, 33, 147, 116, 144, 209, 80, 171, 140, - 101, 107, 218, 186, 98, 61, 8, 25, 34, 86, 166, 210, 83, 236, 116, - 145, 97, 165, 85, 134, 245, 133, 72, 41, 148, 81, 196, 218, 221, 154, - 245, 199, 226, 132, 101, 167, 160, 29, 145, 63, 34, 58, 212, 113, 9, - 205, 61, 47, 139, 99, 37, 119, 99, 69, 171, 250, 76, 159, 201, 29, - 83, 88, 175, 103, 80, 251, 138, 223, 189, 153, 5, 204, 41, 222, 190, - 197, 98, 63, 230, 159, 156, 56, 59, 213, 211, 96, 70, 218, 254, 111, - 37, 93, 249, 243, 92, 198, 58, 227, 128, 29, 95, 223, 159, 11, 99, - 25, 215, 238, 13, 216, 54, 43, 49, 221, 38, 127, 61, 241, 92, 115, - 95, 100, 3, 232, 23, 164, 13, 224, 119, 70, 54, 64, 52, 180, 1, - 247, 92, 187, 13, 182, 135, 60, 180, 71, 54, 64, 237, 161, 13, 150, - 111, 156, 154, 42, 100, 3, 231, 190, 14, 105, 200, 6, 203, 183, 210, - 105, 200, 6, 11, 55, 15, 75, 19, 178, 129, 111, 184, 60, 21, 217, - 0, 209, 208, 6, 220, 115, 1, 27, 0, 191, 69, 54, 248, 12, 108, - 0, 253, 16, 217, 0, 209, 109, 59, 45, 161, 185, 231, 154, 249, 209, - 45, 234, 51, 158, 54, 245, 178, 145, 13, 80, 123, 57, 176, 1, 149, - 179, 131, 183, 111, 35, 96, 131, 59, 253, 66, 221, 144, 13, 186, 198, - 199, 40, 233, 206, 192, 6, 242, 246, 107, 220, 248, 250, 126, 6, 54, - 200, 189, 98, 236, 134, 108, 128, 232, 70, 192, 6, 220, 115, 126, 27, - 64, 92, 145, 126, 0, 113, 130, 108, 128, 232, 64, 224, 7, 220, 115, - 205, 252, 174, 0, 63, 152, 249, 119, 140, 20, 217, 0, 181, 175, 10, - 108, 80, 218, 59, 130, 183, 239, 103, 96, 131, 150, 38, 179, 165, 200, - 6, 33, 1, 97, 74, 186, 26, 176, 193, 163, 240, 89, 82, 33, 63, - 176, 127, 17, 46, 69, 54, 64, 116, 107, 96, 3, 238, 185, 230, 190, - 104, 12, 128, 113, 31, 141, 1, 33, 230, 147, 196, 20, 49, 158, 255, - 49, 6, 56, 168, 143, 1, 20, 232, 235, 249, 215, 36, 193, 49, 0, - 182, 67, 113, 77, 46, 225, 218, 43, 60, 39, 233, 56, 6, 24, 105, - 140, 107, 16, 239, 72, 6, 228, 139, 100, 80, 128, 166, 216, 241, 44, - 68, 39, 25, 13, 180, 202, 128, 120, 194, 122, 16, 50, 160, 222, 72, - 23, 159, 154, 186, 142, 1, 154, 101, 64, 127, 197, 99, 192, 95, 147, - 212, 198, 0, 138, 149, 81, 100, 174, 235, 24, 160, 89, 6, 244, 7, - 40, 195, 133, 181, 187, 53, 219, 198, 236, 221, 223, 114, 46, 110, 202, - 164, 136, 94, 232, 150, 73, 241, 197, 83, 35, 35, 35, 99, 196, 47, - 164, 12, 63, 46, 6, 201, 164, 136, 134, 252, 248, 98, 19, 201, 15, - 218, 147, 228, 199, 225, 89, 38, 69, 52, 228, 199, 135, 115, 146, 31, - 180, 29, 201, 143, 195, 134, 76, 138, 104, 200, 143, 15, 51, 144, 31, - 194, 12, 196, 9, 194, 140, 39, 24, 79, 201, 220, 233, 15, 204, 116, - 84, 199, 76, 136, 17, 240, 27, 90, 24, 51, 176, 29, 242, 131, 34, - 17, 215, 222, 147, 214, 15, 51, 163, 173, 162, 112, 222, 4, 249, 182, - 193, 23, 253, 78, 18, 67, 153, 74, 92, 82, 250, 97, 166, 94, 117, - 9, 198, 76, 8, 33, 3, 234, 141, 116, 9, 161, 244, 195, 140, 44, - 102, 56, 206, 155, 32, 95, 18, 51, 33, 72, 134, 104, 162, 94, 152, - 89, 180, 51, 18, 99, 6, 218, 221, 90, 99, 206, 47, 147, 66, 155, - 114, 57, 189, 182, 251, 182, 213, 125, 18, 218, 88, 27, 63, 104, 191, - 242, 242, 11, 225, 225, 7, 109, 85, 110, 126, 162, 137, 90, 249, 65, - 187, 232, 202, 15, 97, 6, 226, 4, 97, 38, 241, 32, 240, 53, 115, - 30, 204, 116, 82, 199, 76, 74, 252, 68, 177, 36, 90, 24, 51, 176, - 29, 242, 3, 187, 120, 238, 219, 167, 68, 25, 110, 156, 177, 35, 100, - 36, 130, 119, 74, 97, 229, 80, 81, 134, 27, 103, 32, 95, 36, 3, - 234, 141, 116, 201, 145, 25, 110, 156, 145, 68, 171, 99, 38, 145, 181, - 175, 143, 204, 112, 227, 12, 180, 59, 242, 161, 68, 170, 131, 198, 113, - 38, 62, 109, 63, 165, 75, 222, 238, 194, 218, 152, 228, 167, 105, 156, - 129, 252, 116, 201, 129, 93, 88, 123, 90, 227, 216, 212, 65, 227, 56, - 35, 79, 221, 79, 233, 146, 79, 186, 176, 182, 35, 223, 79, 211, 56, - 35, 3, 239, 167, 107, 110, 6, 113, 130, 48, 227, 179, 23, 228, 90, - 41, 60, 185, 153, 99, 153, 234, 10, 232, 155, 184, 95, 24, 51, 176, - 29, 246, 231, 3, 92, 123, 187, 253, 250, 97, 134, 156, 159, 67, 190, - 216, 159, 1, 13, 101, 42, 109, 187, 79, 63, 204, 144, 243, 115, 9, - 33, 3, 234, 141, 116, 241, 220, 167, 31, 102, 200, 249, 57, 228, 75, - 98, 70, 194, 202, 80, 236, 213, 15, 51, 104, 126, 238, 194, 218, 29, - 249, 144, 204, 71, 44, 191, 55, 112, 139, 99, 217, 249, 121, 191, 196, - 13, 84, 255, 140, 204, 195, 186, 196, 113, 104, 99, 146, 223, 160, 27, - 255, 164, 151, 157, 235, 66, 126, 133, 55, 207, 118, 210, 133, 159, 39, - 193, 175, 245, 40, 177, 220, 110, 227, 195, 19, 101, 231, 141, 137, 25, - 27, 168, 87, 83, 174, 186, 234, 52, 14, 238, 37, 198, 45, 240, 126, - 85, 183, 70, 253, 49, 7, 155, 191, 125, 3, 101, 179, 125, 158, 78, - 185, 25, 196, 9, 198, 204, 78, 224, 7, 7, 121, 198, 153, 206, 234, - 152, 81, 36, 79, 18, 251, 236, 17, 198, 12, 108, 135, 252, 192, 39, - 153, 104, 159, 164, 43, 102, 42, 104, 244, 3, 82, 134, 15, 33, 67, - 1, 222, 73, 193, 202, 73, 252, 87, 87, 204, 8, 203, 128, 124, 177, - 30, 128, 70, 186, 80, 255, 232, 138, 25, 29, 244, 216, 163, 142, 25, - 5, 107, 95, 197, 78, 93, 49, 163, 77, 134, 76, 137, 153, 118, 70, - 42, 187, 91, 43, 91, 130, 248, 223, 166, 157, 156, 108, 131, 40, 42, - 37, 134, 226, 203, 85, 96, 220, 149, 15, 44, 161, 126, 244, 125, 114, - 136, 141, 128, 116, 82, 172, 106, 92, 146, 228, 249, 210, 22, 199, 159, - 117, 228, 235, 91, 84, 59, 142, 94, 21, 176, 137, 197, 106, 18, 174, - 159, 213, 126, 121, 142, 110, 237, 124, 236, 48, 95, 223, 183, 245, 10, - 233, 161, 116, 245, 163, 108, 165, 152, 249, 175, 203, 173, 35, 202, 90, - 113, 73, 37, 230, 81, 227, 204, 35, 124, 125, 75, 77, 106, 48, 92, - 173, 206, 2, 211, 33, 47, 172, 24, 161, 26, 30, 178, 31, 244, 41, - 67, 217, 207, 161, 250, 41, 7, 100, 191, 93, 57, 170, 113, 24, 218, - 143, 57, 97, 126, 72, 200, 126, 182, 23, 118, 164, 35, 251, 161, 216, - 4, 237, 103, 221, 254, 84, 39, 33, 251, 45, 217, 106, 209, 25, 217, - 47, 124, 215, 3, 71, 100, 191, 196, 105, 103, 29, 133, 236, 199, 213, - 249, 44, 48, 13, 237, 39, 84, 255, 67, 246, 131, 120, 65, 246, 75, - 109, 173, 217, 126, 13, 116, 176, 223, 245, 126, 37, 212, 214, 174, 191, - 93, 145, 253, 130, 76, 77, 148, 121, 135, 223, 93, 95, 58, 38, 184, - 34, 111, 14, 50, 205, 34, 142, 182, 90, 116, 244, 4, 178, 31, 138, - 197, 217, 111, 207, 209, 227, 34, 46, 241, 214, 225, 238, 88, 22, 210, - 73, 61, 76, 164, 200, 126, 181, 59, 94, 86, 202, 154, 45, 170, 204, - 28, 51, 57, 194, 43, 215, 198, 180, 6, 195, 213, 8, 45, 48, 125, - 236, 185, 21, 35, 84, 59, 68, 246, 131, 177, 64, 221, 255, 100, 82, - 245, 53, 18, 228, 127, 50, 222, 188, 41, 11, 248, 223, 239, 109, 40, - 183, 178, 163, 71, 23, 168, 232, 182, 192, 255, 78, 180, 229, 175, 195, - 253, 6, 254, 103, 180, 14, 141, 61, 73, 184, 230, 55, 28, 248, 95, - 254, 145, 121, 188, 125, 75, 128, 255, 57, 116, 27, 143, 237, 87, 104, - 23, 164, 164, 221, 128, 255, 109, 138, 153, 204, 47, 23, 248, 31, 87, - 95, 180, 192, 116, 0, 240, 63, 161, 186, 35, 30, 243, 118, 114, 99, - 158, 124, 43, 136, 227, 123, 121, 198, 188, 174, 101, 198, 188, 29, 160, - 253, 118, 29, 198, 188, 29, 196, 88, 177, 131, 107, 95, 148, 104, 184, - 185, 149, 15, 33, 67, 1, 222, 73, 193, 202, 145, 37, 26, 110, 110, - 5, 249, 98, 61, 0, 141, 116, 73, 217, 102, 184, 185, 149, 207, 246, - 50, 99, 30, 107, 95, 106, 155, 225, 230, 86, 208, 238, 250, 206, 173, - 200, 60, 76, 150, 168, 255, 220, 138, 228, 7, 237, 169, 239, 220, 138, - 228, 71, 109, 211, 127, 110, 69, 230, 137, 16, 39, 8, 51, 178, 141, - 192, 15, 118, 242, 96, 166, 91, 153, 186, 55, 232, 43, 255, 91, 135, - 186, 247, 86, 162, 246, 181, 133, 107, 159, 179, 89, 87, 204, 152, 104, - 158, 147, 52, 201, 227, 234, 222, 91, 136, 186, 55, 160, 161, 76, 165, - 207, 109, 210, 21, 51, 154, 101, 36, 126, 95, 152, 134, 245, 32, 100, - 64, 189, 145, 46, 69, 9, 186, 98, 70, 179, 140, 103, 230, 71, 48, - 102, 32, 95, 181, 186, 55, 178, 87, 130, 174, 152, 209, 44, 99, 65, - 143, 169, 74, 204, 164, 179, 118, 183, 86, 182, 20, 137, 126, 44, 110, - 42, 133, 118, 196, 115, 23, 150, 182, 82, 236, 38, 158, 107, 142, 187, - 207, 155, 228, 73, 35, 22, 62, 70, 109, 168, 183, 214, 79, 149, 180, - 199, 210, 113, 212, 175, 30, 175, 121, 251, 142, 109, 113, 128, 226, 248, - 43, 48, 237, 176, 208, 140, 230, 147, 139, 176, 144, 206, 126, 91, 82, - 15, 248, 173, 144, 30, 136, 134, 122, 112, 207, 181, 235, 97, 118, 117, - 25, 106, 67, 217, 255, 111, 121, 26, 210, 163, 228, 246, 170, 52, 33, - 61, 56, 254, 10, 76, 67, 61, 248, 228, 146, 122, 64, 255, 65, 122, - 248, 44, 105, 42, 133, 254, 128, 244, 64, 244, 139, 71, 187, 137, 231, - 154, 223, 229, 73, 163, 60, 233, 145, 159, 89, 168, 13, 181, 100, 196, - 73, 37, 189, 120, 201, 56, 106, 151, 253, 121, 222, 190, 78, 64, 15, - 142, 191, 2, 211, 109, 128, 30, 124, 114, 73, 61, 68, 132, 30, 149, - 129, 30, 208, 231, 144, 30, 136, 174, 5, 190, 7, 247, 92, 243, 187, - 108, 0, 223, 99, 211, 81, 156, 47, 80, 47, 66, 85, 116, 91, 240, - 61, 222, 54, 8, 230, 237, 59, 2, 232, 193, 241, 87, 96, 218, 30, - 232, 193, 39, 151, 140, 137, 48, 14, 162, 152, 72, 173, 5, 56, 223, - 170, 61, 38, 218, 219, 149, 217, 87, 3, 250, 202, 214, 11, 199, 68, - 216, 14, 225, 92, 182, 129, 107, 111, 190, 94, 191, 60, 194, 190, 162, - 145, 61, 146, 1, 249, 226, 88, 2, 101, 108, 100, 231, 206, 235, 244, - 203, 35, 18, 190, 108, 195, 49, 81, 68, 200, 128, 122, 35, 93, 236, - 214, 233, 151, 71, 72, 253, 238, 226, 152, 8, 249, 146, 49, 81, 196, - 202, 144, 175, 213, 47, 143, 56, 121, 33, 0, 231, 17, 208, 238, 218, - 234, 252, 208, 166, 229, 93, 55, 128, 54, 214, 198, 15, 218, 175, 188, - 252, 236, 120, 248, 65, 91, 149, 151, 31, 180, 157, 54, 126, 208, 46, - 229, 93, 215, 128, 56, 193, 235, 26, 191, 129, 31, 108, 228, 193, 76, - 153, 61, 84, 242, 53, 96, 188, 94, 45, 140, 25, 216, 14, 143, 241, - 107, 136, 60, 98, 149, 225, 114, 111, 138, 144, 33, 7, 239, 36, 103, - 229, 248, 172, 50, 92, 238, 13, 249, 98, 61, 0, 141, 116, 41, 138, - 55, 92, 238, 77, 173, 86, 199, 140, 156, 181, 175, 44, 222, 112, 185, - 55, 180, 187, 33, 215, 53, 124, 86, 25, 118, 93, 3, 218, 211, 144, - 235, 26, 178, 120, 3, 175, 107, 252, 38, 106, 180, 63, 129, 31, 172, - 229, 193, 76, 153, 61, 39, 18, 208, 55, 177, 84, 135, 117, 141, 223, - 196, 122, 192, 47, 98, 93, 163, 84, 63, 204, 248, 165, 189, 229, 214, - 53, 126, 17, 235, 26, 128, 134, 50, 149, 182, 45, 209, 15, 51, 65, - 195, 214, 96, 204, 72, 8, 25, 80, 111, 164, 139, 103, 137, 126, 152, - 185, 226, 122, 145, 91, 215, 40, 45, 179, 174, 193, 202, 80, 252, 212, - 15, 51, 162, 243, 17, 220, 186, 70, 169, 246, 184, 11, 109, 90, 238, - 56, 94, 162, 157, 31, 180, 95, 121, 249, 121, 242, 240, 131, 182, 42, - 247, 250, 254, 79, 237, 252, 160, 93, 202, 59, 206, 64, 156, 32, 204, - 20, 125, 0, 126, 240, 91, 3, 102, 198, 249, 134, 134, 204, 156, 110, - 27, 60, 193, 95, 189, 198, 83, 12, 230, 183, 63, 116, 168, 241, 20, - 19, 181, 145, 98, 34, 55, 251, 166, 43, 102, 42, 107, 244, 131, 111, - 79, 114, 92, 112, 109, 132, 144, 161, 0, 239, 164, 96, 229, 200, 63, - 235, 138, 25, 205, 50, 22, 220, 153, 142, 101, 64, 190, 88, 15, 64, - 35, 93, 66, 62, 234, 138, 25, 205, 50, 228, 189, 27, 102, 99, 61, - 126, 148, 169, 241, 176, 246, 205, 121, 171, 43, 102, 52, 203, 232, 245, - 116, 190, 18, 51, 13, 141, 85, 118, 183, 86, 182, 84, 237, 79, 132, - 118, 68, 126, 131, 104, 143, 244, 181, 52, 247, 92, 115, 220, 253, 60, - 160, 27, 83, 191, 205, 57, 182, 77, 63, 6, 181, 55, 206, 26, 200, - 12, 113, 254, 143, 183, 239, 47, 198, 139, 185, 121, 253, 62, 219, 102, - 24, 99, 237, 247, 144, 237, 59, 146, 153, 253, 249, 145, 64, 95, 31, - 102, 173, 248, 49, 219, 102, 60, 243, 174, 201, 45, 85, 223, 8, 127, - 38, 98, 225, 21, 254, 190, 81, 147, 152, 43, 235, 15, 177, 109, 130, - 153, 112, 201, 191, 108, 223, 41, 76, 135, 228, 141, 188, 125, 127, 71, - 77, 99, 130, 150, 174, 96, 219, 204, 96, 204, 219, 203, 216, 190, 179, - 152, 128, 109, 19, 4, 228, 206, 97, 110, 212, 114, 100, 219, 204, 103, - 34, 206, 180, 84, 210, 70, 17, 50, 230, 81, 139, 42, 2, 125, 99, - 152, 129, 81, 205, 216, 54, 177, 204, 167, 253, 214, 172, 220, 197, 204, - 134, 123, 173, 5, 250, 46, 99, 14, 37, 181, 97, 219, 172, 196, 116, - 198, 167, 120, 226, 185, 246, 113, 26, 250, 11, 196, 16, 233, 47, 16, - 19, 120, 30, 202, 210, 208, 95, 184, 231, 218, 253, 229, 234, 127, 67, - 176, 191, 160, 246, 208, 95, 106, 252, 51, 135, 183, 111, 41, 240, 151, - 232, 90, 139, 176, 191, 36, 117, 93, 142, 253, 229, 127, 99, 86, 9, - 250, 203, 171, 53, 27, 177, 191, 52, 250, 185, 14, 251, 75, 161, 116, - 173, 160, 191, 100, 95, 88, 138, 253, 229, 80, 238, 2, 236, 47, 3, - 47, 132, 11, 244, 157, 198, 84, 233, 22, 130, 253, 197, 114, 232, 56, - 236, 47, 45, 103, 14, 17, 244, 23, 233, 14, 26, 251, 203, 241, 182, - 78, 216, 95, 82, 156, 109, 4, 253, 229, 179, 79, 7, 236, 47, 131, - 69, 182, 216, 95, 210, 182, 181, 19, 244, 151, 111, 152, 255, 74, 76, - 67, 127, 249, 38, 32, 23, 249, 11, 140, 135, 164, 191, 192, 248, 134, - 252, 5, 209, 157, 128, 191, 112, 207, 53, 243, 59, 9, 252, 229, 138, - 159, 17, 222, 3, 142, 218, 155, 1, 127, 105, 177, 183, 41, 111, 223, - 239, 192, 95, 102, 56, 58, 102, 35, 127, 57, 145, 226, 170, 164, 127, - 103, 142, 100, 222, 217, 184, 243, 246, 173, 220, 221, 135, 145, 191, 252, - 43, 27, 249, 139, 127, 137, 135, 146, 182, 6, 254, 226, 55, 134, 230, - 237, 107, 20, 61, 137, 185, 84, 161, 117, 54, 242, 23, 139, 150, 150, - 42, 26, 248, 203, 112, 247, 74, 188, 125, 197, 209, 211, 152, 227, 117, - 222, 101, 33, 127, 153, 58, 247, 170, 146, 54, 5, 254, 146, 240, 48, - 57, 139, 175, 111, 30, 240, 151, 181, 127, 5, 100, 33, 127, 57, 115, - 154, 86, 210, 69, 225, 50, 102, 212, 208, 183, 153, 124, 125, 127, 2, - 127, 113, 238, 101, 149, 133, 252, 229, 80, 96, 173, 44, 228, 47, 157, - 86, 84, 205, 18, 242, 151, 122, 38, 239, 50, 145, 191, 32, 26, 250, - 11, 247, 156, 223, 95, 224, 216, 70, 250, 11, 28, 171, 144, 191, 32, - 26, 198, 23, 238, 185, 102, 126, 159, 128, 191, 172, 50, 139, 192, 251, - 229, 81, 123, 19, 224, 47, 137, 187, 249, 251, 194, 248, 18, 145, 131, - 214, 227, 134, 49, 227, 166, 170, 104, 24, 95, 122, 85, 231, 95, 167, - 131, 241, 229, 81, 248, 92, 41, 242, 151, 192, 34, 21, 109, 2, 252, - 229, 130, 139, 64, 95, 16, 95, 190, 134, 206, 199, 251, 244, 59, 213, - 82, 205, 117, 140, 128, 191, 132, 166, 134, 75, 133, 226, 139, 43, 141, - 244, 157, 193, 72, 146, 35, 216, 190, 179, 24, 147, 218, 145, 82, 161, - 248, 146, 184, 16, 181, 153, 207, 252, 62, 16, 41, 197, 227, 145, 192, - 122, 40, 140, 47, 109, 255, 135, 250, 198, 50, 230, 215, 85, 52, 244, - 151, 175, 215, 133, 228, 46, 99, 92, 30, 68, 226, 179, 5, 136, 134, - 254, 194, 61, 231, 159, 231, 193, 60, 21, 229, 172, 241, 133, 32, 15, - 251, 201, 155, 179, 42, 15, 153, 225, 61, 188, 160, 111, 206, 27, 29, - 246, 73, 127, 32, 246, 73, 23, 113, 237, 125, 222, 232, 55, 207, 131, - 99, 46, 222, 39, 93, 68, 236, 251, 7, 24, 128, 50, 149, 152, 125, - 173, 223, 60, 15, 198, 105, 188, 239, 255, 45, 39, 3, 234, 141, 116, - 145, 189, 214, 111, 158, 7, 177, 141, 207, 176, 189, 81, 207, 89, 61, - 217, 92, 213, 252, 181, 126, 243, 60, 232, 15, 184, 150, 241, 70, 125, - 175, 61, 151, 187, 200, 164, 136, 126, 194, 100, 82, 124, 57, 141, 218, - 222, 253, 215, 234, 252, 184, 177, 13, 228, 192, 44, 13, 249, 241, 141, - 121, 106, 235, 156, 101, 248, 113, 177, 79, 38, 69, 52, 228, 199, 23, - 19, 73, 126, 230, 101, 248, 113, 216, 144, 73, 17, 13, 249, 241, 97, - 134, 156, 231, 65, 156, 224, 179, 5, 207, 129, 31, 124, 16, 194, 140, - 3, 254, 30, 230, 160, 111, 252, 75, 97, 204, 192, 118, 200, 15, 226, - 95, 113, 237, 37, 47, 13, 135, 25, 200, 23, 201, 48, 7, 52, 148, - 169, 92, 103, 127, 97, 56, 204, 152, 19, 50, 160, 222, 72, 23, 234, - 133, 225, 48, 3, 249, 146, 152, 49, 103, 101, 228, 60, 55, 28, 102, - 160, 221, 113, 173, 192, 116, 126, 182, 38, 204, 136, 194, 26, 235, 140, - 25, 104, 99, 146, 159, 38, 204, 64, 126, 186, 98, 134, 42, 195, 79, - 19, 102, 32, 63, 93, 49, 3, 109, 71, 242, 211, 132, 25, 200, 79, - 87, 204, 64, 156, 32, 204, 152, 63, 1, 126, 80, 40, 132, 153, 142, - 220, 25, 219, 130, 73, 98, 207, 103, 194, 152, 129, 237, 240, 24, 80, - 64, 156, 97, 123, 106, 56, 204, 120, 18, 50, 114, 192, 59, 229, 176, - 114, 66, 158, 26, 14, 51, 144, 47, 214, 3, 208, 88, 151, 167, 134, - 195, 140, 231, 51, 117, 204, 228, 176, 246, 141, 127, 98, 56, 204, 64, - 187, 235, 139, 25, 178, 198, 29, 242, 84, 127, 204, 144, 252, 68, 79, - 245, 199, 12, 201, 15, 218, 78, 95, 204, 144, 185, 25, 196, 9, 174, - 193, 63, 0, 126, 240, 92, 8, 51, 157, 240, 247, 136, 127, 60, 73, - 156, 248, 72, 24, 51, 176, 29, 30, 3, 30, 19, 53, 248, 71, 250, - 97, 134, 172, 39, 154, 19, 50, 226, 21, 0, 251, 172, 28, 249, 67, - 253, 48, 67, 214, 19, 33, 95, 92, 131, 7, 239, 142, 116, 241, 124, - 168, 31, 102, 200, 122, 34, 228, 75, 98, 6, 202, 84, 198, 151, 7, - 250, 97, 6, 213, 19, 93, 88, 187, 227, 179, 0, 167, 171, 159, 220, - 248, 34, 243, 143, 122, 34, 165, 216, 45, 173, 242, 228, 150, 78, 227, - 2, 180, 49, 226, 231, 35, 175, 126, 242, 65, 163, 15, 206, 101, 235, - 77, 230, 128, 223, 13, 105, 172, 78, 252, 60, 9, 126, 242, 206, 53, - 78, 166, 54, 116, 254, 163, 30, 161, 120, 189, 91, 26, 223, 164, 110, - 182, 78, 53, 248, 7, 4, 191, 83, 213, 79, 54, 158, 59, 239, 143, - 249, 170, 29, 220, 151, 97, 163, 219, 158, 49, 136, 19, 132, 25, 197, - 61, 64, 63, 17, 194, 140, 35, 87, 31, 190, 15, 230, 63, 249, 58, - 212, 224, 239, 19, 181, 235, 251, 92, 251, 214, 148, 167, 142, 152, 169, - 165, 209, 15, 58, 186, 72, 156, 112, 237, 154, 144, 161, 0, 239, 164, - 96, 229, 180, 46, 234, 171, 35, 102, 52, 203, 56, 229, 242, 245, 56, - 214, 35, 159, 208, 3, 208, 72, 151, 214, 241, 131, 116, 196, 140, 102, - 25, 207, 95, 62, 116, 198, 122, 228, 151, 169, 193, 179, 246, 109, 77, - 245, 211, 17, 51, 154, 101, 140, 250, 165, 26, 103, 186, 154, 170, 236, - 110, 173, 108, 41, 18, 69, 180, 105, 39, 135, 118, 68, 62, 132, 232, - 110, 41, 49, 20, 247, 92, 115, 220, 13, 28, 88, 66, 221, 173, 214, - 10, 239, 237, 182, 237, 227, 164, 164, 187, 79, 243, 167, 175, 247, 31, - 200, 187, 79, 250, 205, 146, 205, 52, 135, 213, 36, 92, 239, 55, 141, - 72, 166, 249, 176, 170, 172, 151, 68, 237, 167, 155, 95, 42, 102, 219, - 164, 208, 41, 79, 191, 41, 105, 113, 68, 26, 221, 237, 215, 103, 23, - 254, 26, 217, 97, 122, 162, 59, 90, 91, 200, 160, 223, 88, 30, 97, - 235, 147, 199, 233, 126, 175, 55, 243, 246, 45, 142, 202, 162, 205, 62, - 141, 99, 219, 200, 233, 95, 238, 110, 74, 250, 87, 248, 105, 58, 112, - 179, 165, 192, 59, 159, 163, 19, 186, 84, 98, 219, 92, 164, 93, 102, - 154, 176, 114, 47, 211, 167, 39, 148, 58, 243, 215, 254, 175, 209, 255, - 171, 86, 153, 237, 155, 67, 203, 220, 234, 179, 182, 186, 73, 247, 14, - 225, 31, 187, 197, 209, 185, 180, 111, 52, 197, 182, 201, 163, 47, 84, - 154, 175, 164, 171, 71, 220, 163, 151, 93, 220, 44, 176, 230, 240, 128, - 62, 251, 24, 173, 147, 40, 104, 179, 1, 166, 174, 42, 125, 159, 208, - 13, 108, 234, 243, 126, 223, 111, 81, 5, 180, 223, 227, 78, 108, 155, - 151, 244, 149, 10, 61, 149, 244, 207, 240, 66, 250, 65, 27, 111, 87, - 126, 59, 191, 165, 27, 87, 25, 199, 182, 41, 162, 229, 19, 3, 85, - 116, 196, 71, 122, 224, 133, 105, 174, 252, 53, 158, 47, 244, 222, 239, - 51, 217, 54, 223, 233, 27, 86, 51, 92, 85, 245, 176, 98, 250, 155, - 83, 168, 43, 255, 55, 42, 165, 71, 248, 142, 71, 109, 152, 143, 139, - 84, 239, 96, 36, 53, 98, 150, 30, 240, 227, 237, 43, 58, 101, 204, - 92, 104, 141, 222, 205, 148, 233, 246, 45, 72, 73, 87, 144, 86, 96, - 18, 206, 249, 243, 246, 253, 45, 175, 200, 48, 174, 3, 216, 54, 149, - 24, 231, 3, 82, 21, 45, 173, 204, 56, 55, 177, 231, 215, 87, 94, - 133, 217, 145, 208, 132, 109, 83, 141, 217, 209, 183, 142, 146, 254, 29, - 94, 157, 201, 61, 40, 18, 176, 85, 77, 134, 91, 103, 179, 192, 116, - 198, 167, 186, 140, 208, 250, 27, 142, 37, 32, 190, 162, 88, 50, 15, - 196, 18, 24, 47, 81, 44, 65, 52, 60, 231, 192, 61, 215, 204, 111, - 17, 136, 37, 5, 171, 37, 89, 40, 150, 44, 200, 87, 213, 132, 103, - 130, 88, 18, 179, 176, 22, 111, 29, 184, 20, 196, 18, 110, 156, 78, - 194, 107, 65, 70, 32, 150, 240, 141, 211, 42, 27, 236, 167, 15, 78, - 138, 195, 177, 100, 141, 245, 90, 22, 151, 105, 116, 216, 99, 254, 53, - 57, 99, 16, 75, 70, 108, 221, 129, 99, 73, 163, 135, 241, 74, 186, - 10, 136, 37, 53, 157, 35, 120, 251, 126, 1, 177, 36, 229, 59, 122, - 103, 57, 109, 26, 36, 119, 86, 189, 243, 105, 90, 242, 112, 37, 111, - 60, 48, 137, 62, 71, 43, 198, 63, 117, 70, 177, 196, 43, 181, 169, - 82, 86, 101, 16, 75, 154, 164, 254, 37, 16, 255, 174, 209, 211, 70, - 39, 224, 88, 146, 185, 41, 155, 181, 213, 77, 186, 81, 222, 83, 222, - 190, 159, 162, 114, 233, 236, 122, 53, 92, 81, 44, 89, 185, 161, 30, - 27, 15, 238, 209, 109, 235, 73, 4, 124, 237, 1, 45, 94, 83, 215, - 21, 197, 146, 228, 11, 42, 218, 56, 226, 9, 221, 191, 164, 46, 63, - 62, 64, 44, 169, 224, 89, 31, 199, 18, 119, 214, 223, 77, 34, 10, - 233, 101, 79, 90, 8, 96, 250, 45, 109, 92, 161, 35, 142, 37, 67, - 171, 117, 98, 251, 126, 164, 247, 213, 118, 20, 144, 251, 133, 78, 29, - 106, 131, 99, 73, 82, 159, 22, 236, 59, 23, 211, 155, 93, 27, 9, - 198, 18, 145, 71, 77, 28, 75, 188, 3, 171, 170, 250, 130, 88, 242, - 239, 138, 10, 188, 125, 171, 128, 88, 98, 126, 161, 42, 142, 37, 190, - 193, 111, 148, 223, 165, 22, 136, 37, 121, 238, 167, 120, 191, 209, 75, - 16, 75, 222, 236, 184, 225, 140, 98, 201, 137, 109, 3, 148, 244, 47, - 183, 202, 76, 242, 246, 236, 12, 222, 119, 6, 177, 100, 141, 236, 167, - 51, 138, 37, 77, 150, 54, 114, 65, 177, 68, 212, 104, 180, 139, 80, - 44, 225, 214, 96, 45, 48, 13, 99, 137, 208, 218, 44, 142, 37, 32, - 143, 66, 177, 228, 75, 171, 118, 114, 152, 23, 161, 88, 130, 232, 217, - 7, 99, 40, 238, 185, 102, 126, 123, 61, 74, 168, 167, 139, 209, 90, - 153, 29, 253, 120, 244, 56, 37, 61, 106, 170, 63, 125, 169, 229, 2, - 222, 117, 176, 62, 177, 155, 105, 46, 71, 79, 194, 235, 132, 217, 32, - 150, 240, 229, 232, 74, 61, 22, 238, 167, 195, 61, 235, 100, 163, 88, - 50, 112, 84, 129, 50, 110, 117, 137, 73, 163, 207, 183, 221, 198, 27, - 195, 146, 34, 14, 211, 45, 169, 9, 56, 150, 220, 91, 31, 160, 252, - 254, 203, 231, 30, 167, 71, 25, 95, 230, 245, 151, 170, 178, 44, 250, - 91, 190, 137, 27, 138, 37, 139, 43, 152, 43, 233, 53, 32, 47, 137, - 108, 222, 144, 119, 63, 92, 11, 16, 75, 78, 191, 169, 227, 134, 98, - 137, 115, 70, 53, 37, 61, 31, 196, 18, 191, 40, 19, 254, 125, 230, - 32, 150, 52, 114, 188, 231, 138, 98, 137, 34, 240, 136, 146, 158, 0, - 98, 201, 177, 13, 171, 249, 207, 201, 197, 228, 210, 86, 117, 135, 224, - 88, 242, 248, 199, 89, 165, 238, 9, 145, 247, 232, 17, 85, 87, 156, - 224, 235, 107, 25, 253, 128, 14, 25, 224, 147, 133, 98, 73, 231, 159, - 199, 149, 244, 106, 144, 151, 172, 120, 98, 204, 251, 141, 254, 149, 21, - 208, 141, 188, 28, 178, 81, 44, 25, 253, 122, 128, 146, 126, 54, 191, - 144, 14, 241, 15, 226, 237, 27, 12, 98, 201, 67, 183, 168, 108, 20, - 75, 134, 236, 90, 162, 164, 183, 135, 127, 164, 55, 87, 92, 205, 219, - 119, 61, 136, 37, 109, 159, 111, 202, 70, 177, 228, 116, 151, 45, 74, - 250, 83, 120, 49, 253, 102, 241, 54, 222, 190, 37, 32, 150, 88, 120, - 110, 70, 109, 152, 202, 225, 9, 217, 40, 47, 17, 37, 111, 200, 230, - 199, 180, 49, 99, 210, 110, 93, 54, 138, 37, 69, 215, 214, 40, 105, - 83, 16, 75, 238, 79, 229, 127, 231, 122, 167, 42, 50, 197, 118, 107, - 178, 81, 44, 249, 217, 60, 78, 73, 119, 0, 121, 137, 85, 221, 101, - 252, 235, 216, 167, 170, 48, 51, 174, 200, 178, 81, 44, 25, 247, 51, - 84, 73, 127, 0, 177, 196, 241, 172, 119, 182, 80, 44, 225, 214, 231, - 45, 48, 125, 2, 196, 18, 161, 117, 123, 110, 142, 211, 15, 199, 146, - 37, 32, 47, 129, 243, 31, 20, 75, 16, 237, 10, 242, 18, 238, 185, - 102, 126, 59, 64, 94, 210, 242, 197, 28, 124, 254, 210, 172, 149, 138, - 166, 65, 94, 226, 226, 61, 155, 183, 239, 71, 144, 151, 112, 243, 243, - 36, 188, 134, 108, 2, 98, 9, 223, 252, 92, 53, 246, 236, 167, 223, - 159, 70, 109, 82, 232, 99, 78, 17, 82, 148, 151, 196, 164, 241, 159, - 251, 44, 141, 58, 76, 239, 216, 133, 244, 202, 160, 247, 207, 87, 209, - 98, 144, 151, 100, 120, 241, 235, 11, 231, 56, 77, 175, 33, 185, 114, - 250, 235, 20, 150, 6, 121, 201, 85, 115, 161, 119, 62, 71, 103, 122, - 160, 54, 23, 233, 39, 203, 195, 89, 125, 47, 211, 149, 111, 10, 173, - 39, 95, 163, 227, 99, 145, 94, 57, 244, 165, 231, 104, 61, 249, 38, - 109, 228, 33, 180, 174, 155, 75, 175, 57, 134, 218, 228, 209, 190, 25, - 42, 218, 20, 204, 113, 58, 28, 229, 239, 43, 6, 177, 36, 42, 10, - 181, 81, 208, 127, 109, 83, 201, 53, 7, 121, 137, 85, 22, 255, 59, - 139, 162, 11, 232, 204, 157, 232, 251, 190, 164, 143, 119, 81, 173, 189, - 255, 6, 115, 156, 140, 43, 252, 190, 241, 3, 196, 146, 101, 230, 97, - 82, 20, 75, 196, 79, 102, 74, 85, 243, 163, 143, 244, 226, 67, 51, - 164, 252, 185, 227, 23, 122, 116, 143, 233, 82, 20, 75, 94, 190, 15, - 101, 109, 85, 76, 207, 216, 28, 42, 96, 171, 82, 186, 213, 8, 212, - 87, 196, 20, 236, 86, 209, 48, 150, 236, 252, 50, 157, 255, 251, 130, - 88, 18, 217, 103, 6, 62, 19, 188, 110, 217, 12, 182, 111, 5, 102, - 239, 85, 254, 119, 54, 2, 177, 196, 247, 17, 106, 83, 137, 217, 22, - 169, 210, 215, 20, 196, 18, 69, 19, 254, 59, 1, 225, 28, 39, 126, - 59, 178, 85, 53, 230, 47, 153, 202, 182, 191, 64, 44, 185, 238, 58, - 87, 42, 20, 75, 184, 189, 27, 22, 152, 62, 6, 98, 137, 208, 158, - 14, 84, 35, 83, 214, 197, 80, 173, 244, 246, 36, 177, 207, 3, 161, - 26, 89, 23, 92, 127, 241, 1, 125, 21, 121, 194, 53, 50, 216, 14, - 215, 175, 238, 114, 237, 67, 242, 12, 183, 22, 3, 249, 226, 250, 21, - 160, 161, 76, 21, 100, 12, 183, 22, 227, 67, 200, 128, 122, 35, 93, - 226, 239, 24, 110, 45, 6, 242, 37, 107, 100, 62, 172, 12, 201, 29, - 195, 173, 197, 64, 187, 27, 114, 253, 82, 148, 103, 216, 245, 75, 104, - 79, 67, 174, 95, 74, 238, 24, 118, 253, 18, 226, 4, 175, 197, 220, - 4, 126, 112, 79, 8, 51, 93, 185, 189, 250, 160, 111, 226, 45, 29, - 206, 67, 220, 38, 214, 48, 114, 137, 181, 152, 91, 134, 195, 12, 228, - 139, 207, 67, 0, 26, 202, 84, 142, 140, 255, 25, 14, 51, 18, 66, - 6, 212, 27, 233, 226, 249, 159, 225, 48, 3, 249, 170, 157, 135, 96, - 101, 40, 110, 26, 14, 51, 208, 238, 134, 92, 191, 132, 54, 54, 228, - 250, 165, 231, 127, 134, 93, 191, 132, 182, 51, 228, 250, 37, 196, 9, - 94, 139, 185, 6, 252, 224, 182, 16, 102, 186, 113, 235, 4, 55, 64, - 60, 207, 209, 97, 45, 230, 6, 49, 6, 220, 224, 218, 167, 92, 215, - 15, 51, 205, 158, 85, 227, 206, 17, 16, 50, 20, 224, 157, 20, 172, - 28, 234, 186, 126, 152, 249, 57, 32, 60, 11, 235, 145, 67, 232, 1, - 104, 164, 75, 206, 255, 244, 195, 204, 218, 199, 5, 220, 157, 23, 57, - 101, 214, 98, 88, 251, 250, 252, 79, 63, 204, 4, 206, 242, 229, 238, - 19, 188, 174, 253, 76, 13, 180, 41, 162, 181, 201, 249, 99, 95, 11, - 15, 63, 104, 191, 242, 242, 131, 246, 212, 198, 15, 218, 170, 188, 252, - 124, 120, 248, 65, 187, 232, 202, 15, 231, 102, 215, 136, 220, 236, 18, - 240, 131, 155, 2, 152, 177, 183, 227, 242, 6, 208, 87, 113, 69, 135, - 220, 236, 26, 225, 207, 87, 137, 220, 236, 138, 1, 115, 179, 171, 132, - 63, 3, 26, 202, 84, 54, 186, 98, 192, 220, 140, 144, 1, 245, 70, - 186, 196, 95, 54, 96, 110, 118, 165, 76, 110, 198, 202, 144, 92, 54, - 96, 110, 118, 197, 176, 227, 140, 232, 138, 97, 199, 25, 104, 79, 67, - 142, 51, 146, 203, 134, 29, 103, 32, 78, 112, 110, 118, 14, 248, 193, - 53, 33, 204, 112, 123, 152, 37, 160, 111, 226, 5, 29, 114, 179, 75, - 68, 78, 115, 145, 200, 205, 46, 24, 48, 55, 187, 72, 228, 102, 128, - 134, 50, 149, 185, 217, 121, 3, 230, 102, 132, 12, 168, 55, 210, 197, - 243, 188, 1, 115, 179, 11, 101, 114, 51, 86, 134, 226, 156, 1, 115, - 179, 11, 134, 157, 207, 64, 27, 27, 114, 62, 227, 121, 222, 176, 243, - 25, 104, 59, 67, 206, 103, 32, 78, 240, 89, 213, 163, 192, 15, 46, - 105, 199, 76, 232, 164, 0, 209, 12, 50, 111, 56, 11, 226, 249, 153, - 73, 98, 127, 255, 150, 114, 127, 255, 102, 204, 137, 248, 5, 217, 157, - 123, 198, 75, 255, 200, 205, 206, 18, 99, 192, 89, 226, 78, 4, 185, - 38, 63, 128, 99, 100, 17, 221, 115, 232, 211, 172, 150, 243, 166, 56, - 171, 48, 83, 69, 163, 31, 164, 140, 59, 142, 125, 205, 135, 144, 161, - 0, 239, 164, 96, 229, 196, 103, 105, 151, 177, 125, 118, 167, 236, 236, - 226, 66, 103, 21, 102, 52, 203, 184, 107, 245, 15, 55, 6, 156, 33, - 244, 0, 52, 214, 229, 132, 118, 25, 199, 99, 26, 158, 220, 22, 33, - 118, 83, 97, 70, 179, 140, 191, 159, 53, 224, 114, 204, 51, 101, 114, - 179, 51, 236, 190, 210, 12, 237, 50, 234, 45, 235, 37, 125, 103, 19, - 43, 85, 97, 70, 179, 140, 25, 5, 170, 189, 101, 195, 140, 85, 118, - 183, 86, 182, 84, 157, 13, 130, 118, 68, 252, 16, 13, 207, 6, 113, - 207, 69, 162, 53, 162, 230, 162, 221, 162, 22, 162, 84, 240, 135, 239, - 114, 28, 208, 141, 113, 112, 221, 194, 182, 233, 199, 160, 246, 166, 89, - 3, 25, 187, 174, 114, 222, 49, 224, 55, 227, 197, 220, 105, 115, 147, - 109, 51, 140, 121, 57, 44, 91, 73, 91, 101, 141, 100, 230, 45, 74, - 230, 237, 107, 220, 221, 135, 233, 99, 126, 136, 109, 51, 158, 89, 53, - 49, 93, 73, 87, 44, 157, 200, 252, 232, 120, 132, 183, 111, 123, 211, - 169, 76, 223, 160, 189, 108, 155, 25, 76, 97, 229, 68, 37, 93, 224, - 54, 147, 57, 106, 191, 133, 183, 111, 177, 124, 22, 211, 163, 194, 70, - 182, 205, 108, 230, 199, 134, 117, 42, 90, 58, 135, 57, 214, 118, 13, - 191, 190, 242, 185, 204, 193, 51, 171, 216, 54, 243, 25, 187, 247, 241, - 153, 170, 186, 183, 140, 113, 220, 178, 130, 191, 111, 84, 12, 115, 160, - 46, 234, 27, 203, 220, 159, 181, 56, 83, 85, 159, 92, 196, 124, 106, - 185, 64, 64, 238, 98, 230, 68, 220, 84, 182, 205, 82, 198, 44, 200, - 143, 237, 187, 140, 25, 235, 238, 45, 208, 119, 57, 227, 230, 219, 19, - 159, 67, 67, 244, 253, 57, 113, 196, 115, 237, 99, 60, 244, 53, 136, - 63, 210, 215, 32, 158, 144, 175, 33, 26, 250, 26, 247, 28, 250, 90, - 83, 214, 215, 90, 98, 126, 239, 128, 175, 141, 176, 90, 133, 125, 13, - 181, 135, 190, 246, 209, 106, 143, 160, 175, 73, 173, 210, 177, 175, 73, - 126, 108, 193, 190, 22, 154, 183, 72, 208, 215, 114, 125, 226, 176, 175, - 237, 90, 185, 90, 73, 139, 129, 175, 109, 186, 186, 94, 208, 215, 134, - 164, 175, 198, 190, 102, 50, 51, 30, 251, 154, 99, 65, 156, 160, 175, - 13, 154, 18, 135, 125, 237, 139, 91, 28, 246, 181, 132, 26, 113, 130, - 190, 70, 21, 175, 196, 190, 182, 172, 69, 28, 246, 181, 195, 215, 248, - 251, 194, 115, 104, 67, 71, 174, 197, 190, 86, 177, 247, 42, 236, 107, - 15, 78, 198, 9, 250, 218, 138, 244, 37, 216, 215, 230, 251, 199, 98, - 95, 11, 178, 140, 17, 244, 181, 37, 142, 225, 216, 215, 16, 13, 125, - 141, 123, 206, 239, 107, 48, 14, 147, 190, 6, 227, 42, 242, 53, 68, - 187, 3, 95, 227, 158, 67, 95, 171, 9, 124, 205, 10, 248, 90, 35, - 204, 175, 0, 248, 218, 189, 31, 245, 241, 25, 89, 212, 190, 2, 240, - 181, 248, 218, 252, 235, 116, 166, 221, 189, 152, 121, 63, 26, 225, 51, - 178, 77, 71, 171, 126, 111, 9, 250, 218, 90, 185, 57, 111, 95, 19, - 224, 107, 223, 60, 43, 225, 51, 178, 118, 115, 69, 217, 200, 215, 54, - 86, 122, 195, 187, 206, 110, 11, 124, 173, 192, 228, 10, 62, 231, 26, - 36, 75, 201, 66, 190, 246, 248, 209, 158, 44, 33, 95, 235, 119, 107, - 123, 22, 242, 181, 37, 39, 55, 101, 33, 95, 123, 153, 188, 134, 183, - 239, 79, 224, 107, 233, 253, 22, 225, 51, 178, 225, 221, 99, 149, 116, - 5, 224, 107, 73, 141, 163, 179, 132, 124, 173, 114, 149, 227, 248, 140, - 108, 154, 245, 126, 37, 93, 5, 248, 218, 208, 67, 255, 242, 247, 5, - 190, 246, 176, 150, 44, 11, 249, 90, 223, 51, 67, 178, 84, 251, 65, - 150, 49, 238, 190, 237, 179, 4, 125, 205, 242, 5, 231, 107, 44, 253, - 0, 250, 26, 126, 206, 239, 107, 112, 60, 38, 125, 13, 142, 175, 200, - 215, 16, 13, 227, 26, 247, 28, 250, 218, 76, 224, 107, 179, 128, 175, - 133, 169, 197, 181, 89, 21, 230, 227, 243, 181, 168, 61, 140, 107, 84, - 45, 129, 181, 69, 16, 215, 146, 163, 195, 241, 249, 218, 251, 53, 85, - 116, 125, 224, 107, 213, 182, 243, 175, 1, 193, 184, 22, 24, 26, 142, - 207, 215, 46, 121, 164, 162, 127, 151, 76, 100, 172, 167, 241, 175, 195, - 218, 192, 49, 52, 133, 59, 35, 235, 251, 69, 69, 67, 95, 251, 183, - 162, 192, 58, 44, 240, 181, 27, 141, 80, 155, 217, 204, 206, 14, 44, - 13, 124, 109, 6, 29, 41, 21, 138, 107, 123, 70, 113, 231, 107, 15, - 143, 65, 103, 100, 101, 204, 115, 255, 72, 193, 243, 181, 175, 158, 70, - 224, 243, 181, 207, 140, 216, 179, 185, 192, 215, 30, 155, 11, 201, 93, - 204, 140, 11, 65, 109, 150, 50, 167, 214, 163, 190, 203, 152, 38, 89, - 66, 125, 151, 51, 94, 119, 185, 179, 185, 136, 134, 113, 141, 123, 206, - 63, 175, 133, 121, 57, 202, 209, 83, 14, 129, 188, 243, 28, 111, 142, - 174, 126, 54, 23, 244, 45, 58, 44, 156, 163, 195, 118, 248, 108, 238, - 17, 142, 191, 236, 176, 174, 57, 186, 230, 185, 26, 204, 19, 240, 217, - 220, 35, 196, 111, 24, 1, 26, 202, 84, 174, 73, 31, 214, 53, 71, - 215, 44, 3, 142, 15, 88, 15, 66, 6, 212, 27, 233, 146, 152, 174, - 107, 142, 174, 69, 6, 136, 11, 88, 143, 195, 101, 126, 195, 136, 149, - 97, 151, 174, 107, 142, 174, 89, 6, 244, 7, 124, 246, 245, 176, 250, - 89, 85, 46, 223, 146, 73, 17, 253, 163, 123, 38, 197, 151, 135, 169, - 157, 125, 45, 195, 143, 27, 83, 101, 82, 68, 67, 126, 124, 99, 173, - 218, 221, 129, 233, 101, 248, 225, 184, 9, 248, 177, 180, 146, 31, 79, - 60, 85, 187, 59, 176, 12, 63, 14, 27, 50, 41, 162, 33, 63, 62, - 204, 144, 243, 90, 136, 19, 124, 207, 182, 93, 160, 184, 232, 168, 16, - 102, 184, 179, 185, 118, 160, 111, 74, 170, 48, 102, 96, 59, 228, 7, - 41, 105, 28, 127, 42, 213, 112, 152, 129, 124, 241, 239, 36, 1, 26, - 202, 84, 206, 157, 83, 12, 135, 25, 59, 66, 6, 212, 27, 233, 226, - 147, 98, 56, 204, 64, 190, 36, 102, 236, 88, 25, 148, 125, 160, 193, - 48, 3, 237, 142, 107, 35, 191, 229, 110, 154, 48, 35, 10, 123, 40, - 213, 21, 51, 208, 198, 36, 63, 77, 152, 129, 252, 116, 197, 140, 15, - 201, 239, 23, 224, 167, 1, 51, 242, 89, 15, 165, 186, 98, 6, 218, - 142, 124, 63, 77, 152, 129, 239, 167, 43, 102, 32, 78, 112, 253, 212, - 37, 80, 156, 114, 72, 8, 51, 220, 217, 92, 10, 244, 77, 116, 11, - 20, 196, 12, 108, 135, 235, 142, 82, 238, 219, 219, 185, 5, 26, 12, - 51, 144, 47, 174, 159, 2, 26, 202, 84, 218, 214, 53, 208, 96, 152, - 145, 16, 50, 160, 222, 72, 23, 79, 30, 25, 229, 197, 12, 228, 171, - 86, 63, 101, 101, 40, 92, 12, 135, 25, 104, 119, 125, 49, 163, 182, - 182, 237, 26, 168, 55, 102, 212, 214, 182, 73, 126, 255, 71, 204, 168, - 173, 109, 187, 232, 143, 25, 181, 181, 109, 23, 14, 51, 146, 174, 129, - 98, 185, 93, 160, 0, 102, 184, 179, 185, 10, 231, 64, 177, 143, 147, - 48, 102, 96, 59, 92, 119, 116, 230, 248, 23, 117, 211, 15, 51, 106, - 245, 83, 66, 134, 2, 188, 147, 130, 149, 35, 235, 166, 31, 102, 212, - 234, 167, 78, 132, 30, 128, 70, 186, 152, 119, 211, 15, 51, 106, 245, - 83, 39, 117, 204, 64, 153, 202, 252, 175, 171, 126, 152, 65, 245, 83, - 23, 214, 238, 248, 142, 85, 121, 245, 147, 179, 254, 125, 243, 71, 253, - 20, 158, 165, 245, 30, 146, 162, 181, 126, 170, 118, 207, 9, 193, 79, - 113, 162, 250, 201, 13, 253, 236, 179, 202, 214, 200, 226, 31, 237, 150, - 182, 9, 136, 208, 90, 35, 83, 203, 245, 8, 126, 146, 46, 53, 78, - 42, 6, 121, 254, 81, 7, 41, 122, 189, 91, 218, 122, 98, 77, 173, - 117, 16, 181, 92, 175, 43, 193, 239, 116, 245, 147, 141, 183, 207, 253, - 99, 174, 11, 207, 230, 46, 28, 30, 174, 117, 174, 75, 142, 51, 16, - 39, 120, 109, 219, 17, 248, 129, 139, 16, 102, 184, 179, 185, 137, 93, - 2, 197, 146, 206, 194, 152, 129, 237, 240, 24, 208, 133, 227, 223, 58, - 113, 128, 142, 152, 209, 124, 222, 244, 183, 243, 66, 124, 54, 87, 66, - 200, 72, 4, 239, 148, 200, 202, 105, 29, 50, 80, 71, 204, 104, 150, - 177, 161, 168, 176, 27, 214, 163, 51, 161, 7, 160, 145, 46, 173, 115, - 70, 235, 136, 25, 205, 50, 162, 198, 191, 194, 103, 115, 37, 157, 213, - 49, 3, 101, 194, 127, 147, 126, 14, 208, 17, 51, 154, 101, 244, 35, - 207, 230, 2, 187, 163, 125, 235, 129, 109, 218, 201, 161, 29, 17, 63, - 68, 119, 74, 137, 161, 184, 231, 224, 255, 84, 3, 253, 128, 127, 59, - 19, 117, 224, 102, 3, 75, 168, 169, 109, 70, 225, 243, 116, 45, 215, - 132, 42, 105, 239, 105, 254, 180, 120, 209, 66, 92, 247, 25, 12, 240, - 17, 0, 254, 230, 137, 36, 92, 173, 106, 201, 102, 154, 195, 106, 18, - 94, 223, 128, 231, 233, 248, 176, 42, 98, 207, 211, 5, 53, 69, 117, - 230, 20, 218, 102, 122, 34, 91, 83, 77, 163, 11, 207, 110, 16, 168, - 169, 30, 166, 87, 180, 66, 117, 209, 12, 154, 154, 19, 195, 202, 61, - 78, 23, 174, 155, 39, 208, 55, 139, 78, 79, 69, 99, 165, 156, 238, - 190, 46, 140, 149, 123, 154, 190, 57, 123, 154, 192, 186, 193, 57, 250, - 99, 189, 137, 108, 155, 139, 116, 161, 253, 48, 182, 239, 101, 58, 191, - 111, 47, 1, 185, 215, 232, 169, 118, 150, 108, 155, 28, 122, 120, 108, - 11, 213, 26, 75, 196, 77, 122, 248, 125, 59, 129, 190, 185, 244, 240, - 108, 20, 171, 242, 104, 171, 76, 118, 109, 36, 226, 30, 253, 205, 50, - 73, 224, 157, 31, 208, 135, 211, 142, 177, 109, 20, 244, 148, 227, 215, - 84, 117, 254, 136, 39, 116, 207, 211, 143, 121, 251, 138, 163, 11, 232, - 186, 235, 191, 179, 109, 94, 210, 245, 236, 170, 43, 253, 161, 114, 68, - 33, 189, 177, 142, 132, 183, 38, 248, 46, 234, 45, 237, 188, 212, 131, - 109, 83, 68, 79, 179, 31, 164, 164, 75, 194, 63, 210, 30, 121, 163, - 4, 234, 152, 95, 232, 9, 145, 131, 217, 54, 223, 233, 110, 212, 0, - 246, 174, 191, 98, 186, 154, 81, 111, 254, 51, 158, 81, 165, 180, 123, - 39, 23, 212, 134, 153, 254, 165, 91, 150, 170, 182, 100, 196, 108, 63, - 210, 133, 183, 175, 209, 41, 99, 166, 141, 87, 119, 182, 141, 41, 147, - 191, 206, 89, 85, 123, 149, 86, 96, 2, 238, 116, 20, 168, 219, 86, - 100, 46, 78, 170, 205, 182, 169, 196, 60, 247, 170, 162, 164, 127, 187, - 85, 102, 236, 41, 35, 129, 250, 105, 21, 102, 143, 83, 37, 182, 77, - 53, 166, 117, 134, 169, 146, 54, 137, 168, 206, 244, 244, 255, 41, 240, - 125, 107, 50, 220, 186, 162, 5, 166, 225, 121, 58, 114, 189, 81, 100, - 212, 66, 84, 29, 252, 53, 54, 106, 241, 231, 25, 24, 16, 95, 81, - 44, 105, 213, 186, 157, 28, 198, 75, 20, 75, 16, 253, 241, 96, 12, - 197, 61, 215, 28, 75, 118, 245, 41, 161, 238, 157, 104, 129, 207, 211, - 85, 17, 181, 87, 210, 57, 161, 254, 180, 155, 184, 115, 54, 23, 75, - 44, 65, 44, 177, 4, 177, 164, 30, 238, 219, 116, 233, 102, 154, 27, - 167, 147, 240, 250, 213, 143, 240, 100, 154, 111, 156, 22, 41, 207, 61, - 237, 167, 47, 247, 240, 192, 177, 228, 91, 211, 186, 44, 62, 210, 232, - 247, 191, 46, 241, 158, 17, 251, 9, 207, 192, 12, 148, 156, 64, 177, - 36, 211, 207, 77, 117, 254, 24, 196, 146, 131, 78, 209, 78, 66, 177, - 100, 244, 145, 67, 78, 40, 150, 180, 126, 248, 203, 9, 197, 146, 207, - 198, 214, 206, 66, 177, 36, 181, 133, 11, 62, 155, 187, 244, 104, 176, - 179, 234, 155, 95, 166, 123, 252, 195, 127, 174, 183, 66, 244, 53, 218, - 163, 205, 38, 103, 20, 75, 172, 188, 127, 43, 233, 106, 32, 150, 92, - 163, 29, 4, 238, 38, 200, 165, 7, 191, 62, 132, 207, 249, 87, 141, - 221, 166, 164, 187, 129, 88, 210, 170, 201, 50, 222, 190, 133, 32, 150, - 140, 58, 127, 238, 24, 138, 37, 158, 221, 140, 149, 118, 126, 21, 254, - 132, 62, 231, 28, 193, 235, 167, 95, 163, 10, 104, 251, 210, 36, 28, - 75, 102, 39, 92, 85, 210, 165, 225, 133, 116, 113, 167, 34, 222, 190, - 223, 64, 44, 89, 183, 185, 26, 142, 37, 70, 209, 22, 42, 108, 129, - 88, 210, 127, 98, 67, 193, 88, 242, 81, 84, 31, 199, 146, 15, 149, - 234, 227, 88, 82, 100, 94, 159, 31, 151, 32, 150, 48, 243, 234, 225, - 88, 146, 118, 78, 117, 214, 220, 4, 196, 146, 86, 230, 252, 114, 225, - 217, 92, 197, 30, 59, 28, 75, 38, 246, 80, 181, 111, 8, 98, 201, - 146, 251, 98, 222, 190, 143, 65, 44, 185, 187, 98, 64, 38, 138, 37, - 15, 125, 45, 50, 85, 107, 49, 149, 153, 71, 97, 233, 252, 254, 12, - 98, 201, 8, 71, 52, 6, 86, 99, 218, 57, 170, 214, 24, 225, 25, - 152, 153, 147, 210, 4, 198, 153, 154, 12, 183, 110, 108, 129, 105, 24, - 75, 200, 245, 100, 222, 88, 2, 242, 40, 20, 75, 106, 128, 88, 2, - 243, 34, 20, 75, 16, 13, 207, 230, 114, 207, 53, 199, 146, 215, 30, - 37, 84, 77, 103, 55, 28, 75, 46, 231, 251, 42, 233, 246, 83, 253, - 233, 131, 62, 11, 136, 88, 82, 15, 196, 18, 11, 37, 15, 212, 215, - 35, 118, 51, 205, 229, 232, 73, 120, 125, 242, 36, 200, 75, 248, 114, - 116, 216, 119, 83, 244, 126, 218, 230, 191, 247, 89, 40, 150, 12, 126, - 41, 87, 210, 211, 64, 44, 185, 243, 106, 21, 239, 119, 243, 5, 177, - 228, 197, 139, 202, 89, 40, 150, 204, 127, 211, 67, 105, 179, 160, 240, - 227, 116, 251, 6, 141, 120, 177, 245, 0, 196, 146, 249, 177, 119, 241, - 157, 33, 189, 76, 108, 149, 103, 94, 95, 132, 159, 166, 29, 92, 167, - 242, 158, 145, 93, 2, 98, 9, 179, 229, 31, 87, 20, 75, 170, 139, - 142, 42, 233, 39, 225, 151, 233, 11, 99, 46, 242, 246, 157, 11, 98, - 73, 160, 199, 77, 124, 54, 183, 161, 60, 67, 73, 175, 142, 188, 73, - 223, 108, 190, 141, 183, 175, 83, 76, 46, 253, 189, 208, 6, 159, 205, - 109, 96, 45, 81, 190, 255, 29, 16, 75, 94, 45, 203, 224, 245, 181, - 69, 178, 7, 244, 86, 159, 191, 241, 217, 220, 58, 23, 238, 40, 233, - 55, 243, 159, 208, 225, 179, 43, 243, 174, 235, 230, 131, 188, 36, 217, - 200, 10, 159, 205, 173, 51, 85, 117, 135, 242, 79, 144, 151, 132, 126, - 248, 139, 183, 239, 151, 200, 183, 244, 237, 238, 11, 241, 217, 220, 54, - 39, 84, 103, 85, 175, 204, 255, 72, 63, 108, 177, 137, 183, 239, 49, - 16, 75, 94, 223, 77, 192, 103, 115, 135, 214, 85, 157, 181, 253, 21, - 94, 76, 111, 27, 244, 55, 255, 90, 116, 116, 41, 189, 214, 29, 183, - 97, 168, 223, 42, 89, 21, 65, 44, 121, 118, 52, 129, 255, 92, 175, - 220, 152, 185, 186, 149, 59, 155, 187, 251, 173, 234, 172, 173, 49, 136, - 37, 177, 46, 252, 103, 115, 45, 78, 85, 100, 82, 155, 114, 103, 115, - 63, 184, 169, 244, 109, 39, 173, 204, 4, 140, 228, 63, 155, 91, 253, - 84, 21, 166, 214, 142, 40, 124, 54, 247, 235, 137, 25, 74, 186, 24, - 196, 146, 237, 201, 67, 5, 207, 230, 114, 251, 2, 44, 48, 125, 28, - 196, 18, 114, 191, 128, 200, 200, 10, 196, 18, 43, 16, 75, 172, 254, - 136, 37, 112, 190, 132, 98, 73, 36, 152, 227, 244, 35, 206, 230, 34, - 218, 9, 204, 113, 250, 17, 103, 115, 85, 177, 36, 12, 196, 18, 110, - 77, 120, 38, 152, 227, 84, 242, 158, 133, 207, 230, 86, 157, 161, 58, - 83, 216, 27, 204, 113, 6, 68, 112, 231, 17, 7, 139, 102, 136, 224, - 142, 188, 121, 162, 233, 184, 239, 123, 120, 54, 23, 207, 207, 147, 240, - 250, 51, 60, 155, 203, 55, 63, 23, 177, 247, 15, 181, 234, 27, 129, - 207, 230, 58, 95, 99, 105, 16, 75, 6, 12, 140, 20, 60, 155, 219, - 241, 127, 220, 217, 220, 235, 31, 209, 221, 199, 199, 233, 195, 85, 101, - 2, 231, 107, 179, 104, 235, 55, 145, 248, 108, 110, 215, 44, 180, 174, - 123, 154, 238, 187, 82, 104, 93, 247, 28, 125, 207, 42, 18, 159, 205, - 61, 248, 9, 157, 175, 189, 76, 47, 184, 38, 240, 59, 178, 96, 142, - 227, 145, 205, 157, 205, 157, 251, 62, 130, 181, 213, 77, 122, 191, 68, - 72, 223, 92, 250, 84, 17, 119, 54, 247, 98, 1, 119, 54, 247, 250, - 61, 254, 190, 70, 209, 15, 232, 252, 134, 220, 217, 220, 49, 243, 35, - 216, 115, 204, 79, 232, 71, 249, 252, 107, 254, 181, 65, 44, 249, 215, - 45, 28, 159, 205, 237, 192, 254, 222, 109, 125, 16, 75, 254, 110, 207, - 127, 102, 244, 49, 200, 75, 102, 47, 155, 133, 207, 230, 158, 106, 175, - 242, 171, 183, 32, 47, 177, 206, 153, 46, 112, 174, 247, 11, 93, 119, - 23, 119, 54, 183, 235, 180, 233, 248, 108, 238, 8, 55, 129, 243, 181, - 32, 47, 177, 252, 139, 59, 155, 59, 113, 33, 119, 54, 55, 227, 152, - 240, 217, 220, 65, 125, 185, 179, 185, 94, 155, 185, 179, 185, 67, 94, - 11, 159, 205, 109, 90, 97, 38, 62, 155, 107, 177, 69, 69, 155, 128, - 88, 82, 217, 113, 150, 84, 104, 142, 179, 32, 142, 59, 155, 107, 28, - 48, 155, 61, 3, 93, 157, 249, 89, 71, 248, 108, 46, 183, 239, 195, - 2, 211, 48, 47, 33, 247, 131, 136, 140, 102, 129, 88, 50, 11, 196, - 146, 89, 127, 238, 101, 119, 228, 106, 100, 158, 17, 129, 98, 73, 87, - 161, 26, 25, 119, 54, 87, 2, 250, 38, 118, 20, 174, 145, 193, 118, - 184, 126, 213, 137, 88, 139, 233, 104, 192, 181, 152, 78, 68, 253, 10, - 208, 80, 166, 50, 186, 68, 26, 112, 45, 134, 144, 1, 245, 70, 186, - 80, 145, 6, 92, 139, 233, 88, 102, 45, 134, 149, 145, 19, 97, 192, - 181, 152, 142, 129, 6, 93, 191, 132, 54, 54, 228, 250, 37, 21, 25, - 104, 208, 245, 75, 104, 59, 67, 174, 95, 66, 156, 224, 187, 133, 231, - 2, 63, 112, 20, 194, 12, 119, 54, 55, 39, 60, 80, 236, 57, 95, - 24, 51, 176, 29, 190, 147, 55, 156, 227, 175, 152, 103, 56, 204, 120, - 18, 50, 114, 192, 59, 229, 176, 114, 66, 230, 25, 14, 51, 144, 47, - 214, 3, 208, 88, 151, 121, 134, 195, 140, 231, 124, 117, 204, 64, 153, - 202, 181, 140, 185, 134, 195, 12, 180, 187, 33, 215, 47, 67, 230, 25, - 118, 253, 82, 52, 207, 176, 235, 151, 208, 118, 134, 92, 191, 132, 56, - 65, 152, 201, 153, 9, 252, 32, 66, 8, 51, 220, 217, 220, 248, 57, - 160, 239, 108, 97, 204, 192, 118, 248, 110, 225, 57, 28, 255, 196, 48, - 253, 48, 227, 89, 235, 43, 119, 183, 48, 33, 35, 30, 188, 83, 60, - 43, 199, 46, 76, 63, 204, 132, 121, 158, 193, 247, 164, 66, 190, 88, - 15, 64, 35, 93, 228, 179, 244, 195, 140, 229, 198, 57, 248, 247, 253, - 204, 103, 171, 99, 6, 202, 84, 234, 58, 75, 63, 204, 68, 79, 228, - 48, 3, 237, 174, 237, 172, 42, 180, 41, 199, 91, 243, 127, 127, 236, - 221, 226, 225, 7, 237, 87, 94, 126, 208, 158, 218, 248, 65, 91, 149, - 151, 159, 39, 15, 63, 104, 23, 93, 249, 33, 204, 64, 156, 224, 223, - 74, 153, 6, 232, 185, 2, 152, 33, 206, 230, 122, 130, 190, 57, 211, - 133, 49, 3, 219, 225, 49, 96, 6, 199, 223, 103, 186, 225, 198, 25, - 200, 23, 143, 1, 128, 134, 50, 149, 51, 131, 80, 195, 141, 51, 158, - 132, 12, 168, 55, 210, 69, 22, 106, 184, 113, 6, 242, 85, 251, 173, - 20, 86, 134, 121, 168, 225, 198, 25, 104, 119, 67, 142, 51, 208, 198, - 134, 28, 103, 100, 161, 134, 29, 103, 204, 67, 13, 59, 206, 40, 113, - 130, 246, 56, 4, 3, 63, 152, 41, 132, 25, 110, 15, 179, 57, 232, - 43, 153, 42, 140, 25, 216, 14, 143, 1, 33, 28, 255, 148, 41, 134, - 195, 12, 228, 139, 231, 26, 224, 157, 160, 76, 229, 92, 99, 138, 225, - 48, 3, 249, 226, 57, 19, 160, 145, 46, 57, 147, 13, 135, 25, 201, - 212, 50, 107, 254, 83, 85, 188, 125, 38, 27, 14, 51, 208, 238, 134, - 156, 207, 80, 83, 12, 59, 159, 129, 246, 52, 228, 124, 198, 103, 178, - 97, 231, 51, 16, 39, 24, 51, 19, 128, 31, 76, 211, 132, 153, 80, - 223, 41, 147, 102, 78, 86, 110, 250, 39, 190, 135, 15, 232, 171, 8, - 12, 20, 190, 3, 34, 152, 216, 247, 21, 196, 181, 151, 79, 10, 212, - 241, 60, 187, 169, 70, 63, 24, 113, 230, 73, 10, 222, 247, 21, 68, - 236, 251, 2, 52, 148, 169, 244, 185, 137, 129, 58, 158, 103, 215, 44, - 227, 88, 250, 90, 123, 172, 7, 33, 3, 234, 141, 116, 145, 5, 4, - 234, 120, 158, 93, 179, 12, 215, 253, 215, 113, 110, 6, 249, 170, 221, - 1, 193, 202, 240, 241, 15, 212, 241, 60, 187, 102, 25, 182, 7, 84, - 191, 189, 92, 196, 218, 221, 90, 217, 82, 117, 174, 8, 218, 17, 249, - 16, 162, 67, 29, 151, 208, 220, 115, 205, 113, 87, 209, 170, 62, 35, - 251, 22, 197, 254, 182, 114, 63, 6, 181, 175, 248, 221, 155, 9, 110, - 145, 196, 219, 183, 88, 236, 199, 188, 92, 94, 133, 253, 61, 244, 96, - 166, 176, 175, 175, 146, 174, 252, 121, 46, 211, 249, 112, 42, 239, 239, - 164, 255, 92, 24, 203, 28, 95, 60, 211, 70, 245, 116, 37, 166, 219, - 228, 175, 39, 158, 107, 31, 123, 138, 88, 191, 32, 109, 0, 191, 51, - 178, 1, 162, 161, 13, 184, 231, 218, 109, 208, 100, 102, 91, 7, 100, - 3, 212, 30, 218, 192, 117, 209, 40, 123, 33, 27, 204, 60, 124, 56, - 5, 217, 32, 54, 171, 118, 42, 178, 193, 145, 154, 147, 82, 133, 108, - 112, 194, 164, 233, 62, 100, 3, 68, 67, 27, 112, 207, 249, 109, 0, - 253, 22, 217, 224, 59, 176, 1, 244, 67, 100, 3, 68, 223, 234, 180, - 132, 230, 158, 107, 230, 39, 105, 89, 159, 73, 173, 49, 197, 13, 217, - 0, 181, 247, 1, 54, 184, 94, 146, 192, 219, 119, 45, 176, 193, 186, - 51, 165, 153, 200, 6, 63, 7, 171, 246, 181, 124, 253, 52, 151, 249, - 154, 185, 131, 119, 109, 241, 43, 176, 129, 255, 29, 159, 12, 100, 3, - 68, 183, 4, 54, 224, 158, 243, 219, 0, 226, 138, 244, 3, 136, 19, - 100, 3, 68, 67, 63, 224, 158, 107, 247, 131, 2, 92, 87, 239, 199, - 160, 246, 74, 63, 200, 227, 239, 11, 253, 32, 44, 44, 18, 255, 150, - 228, 213, 125, 42, 26, 250, 193, 149, 18, 254, 220, 7, 250, 1, 55, - 175, 88, 137, 105, 232, 7, 34, 129, 223, 131, 196, 99, 192, 4, 98, - 175, 164, 47, 136, 107, 193, 188, 99, 128, 131, 218, 24, 0, 250, 42, - 198, 233, 48, 6, 76, 32, 98, 231, 120, 174, 125, 200, 184, 64, 189, - 238, 52, 137, 153, 180, 192, 14, 199, 206, 241, 196, 24, 0, 104, 40, - 83, 217, 104, 92, 160, 94, 119, 154, 76, 72, 110, 159, 138, 245, 32, - 100, 64, 189, 145, 46, 241, 126, 129, 122, 221, 105, 114, 126, 113, 40, - 119, 63, 215, 184, 50, 99, 0, 43, 67, 226, 23, 168, 215, 157, 38, - 38, 43, 136, 123, 128, 198, 105, 159, 175, 66, 155, 150, 119, 254, 43, - 226, 225, 7, 237, 87, 94, 126, 208, 158, 218, 248, 65, 91, 149, 151, - 159, 132, 135, 31, 180, 75, 121, 231, 231, 16, 39, 120, 237, 100, 52, - 240, 131, 9, 188, 152, 233, 72, 98, 70, 2, 250, 74, 198, 10, 99, - 6, 182, 195, 243, 0, 31, 98, 237, 196, 71, 63, 204, 92, 75, 119, - 193, 254, 12, 249, 98, 25, 224, 157, 160, 76, 229, 124, 102, 140, 126, - 152, 89, 30, 249, 13, 231, 77, 144, 47, 158, 107, 0, 26, 233, 66, - 141, 209, 15, 51, 169, 55, 219, 225, 251, 230, 36, 99, 203, 204, 53, - 88, 251, 230, 140, 214, 15, 51, 207, 6, 19, 191, 151, 229, 163, 221, - 135, 160, 77, 203, 235, 147, 208, 198, 218, 248, 65, 251, 149, 151, 31, - 197, 195, 15, 218, 170, 188, 252, 160, 237, 180, 241, 131, 118, 41, 47, - 102, 32, 78, 240, 218, 201, 112, 224, 7, 190, 188, 152, 233, 68, 98, - 38, 103, 84, 160, 216, 115, 164, 48, 102, 96, 59, 92, 111, 26, 69, - 172, 157, 140, 208, 15, 51, 48, 175, 196, 245, 38, 66, 70, 14, 120, - 167, 28, 86, 78, 200, 8, 253, 48, 3, 243, 54, 172, 199, 72, 66, - 15, 64, 99, 93, 70, 232, 135, 25, 152, 23, 97, 61, 70, 150, 89, - 59, 97, 237, 27, 63, 92, 63, 204, 64, 159, 192, 107, 39, 35, 136, - 115, 44, 84, 7, 57, 151, 159, 203, 164, 136, 142, 79, 219, 79, 233, - 146, 183, 187, 176, 54, 38, 249, 113, 185, 174, 76, 138, 104, 200, 79, - 151, 28, 216, 133, 181, 39, 254, 205, 58, 186, 131, 156, 203, 27, 101, - 82, 68, 123, 2, 126, 186, 228, 147, 46, 172, 237, 200, 247, 227, 240, - 1, 255, 85, 209, 240, 253, 116, 205, 205, 32, 78, 240, 218, 137, 23, - 240, 131, 209, 188, 152, 113, 36, 49, 19, 63, 12, 244, 29, 42, 140, - 25, 216, 14, 175, 57, 12, 35, 214, 78, 134, 232, 135, 25, 114, 126, - 110, 78, 200, 136, 7, 239, 20, 207, 202, 177, 27, 162, 31, 102, 200, - 249, 57, 228, 139, 245, 0, 52, 210, 69, 238, 173, 31, 102, 200, 249, - 185, 249, 208, 50, 107, 39, 172, 125, 61, 189, 245, 195, 12, 154, 159, - 187, 176, 118, 199, 191, 203, 232, 35, 150, 135, 228, 118, 119, 44, 59, - 63, 239, 151, 184, 129, 90, 245, 35, 232, 176, 78, 107, 39, 101, 248, - 205, 152, 242, 219, 177, 236, 92, 23, 242, 75, 219, 106, 121, 68, 167, - 181, 19, 111, 98, 92, 248, 75, 44, 247, 218, 218, 205, 173, 236, 188, - 209, 243, 214, 6, 234, 95, 219, 20, 103, 157, 214, 78, 8, 126, 41, - 99, 197, 242, 42, 107, 162, 254, 152, 131, 237, 218, 190, 129, 10, 250, - 107, 142, 78, 53, 45, 136, 19, 124, 223, 156, 39, 160, 135, 243, 98, - 166, 51, 137, 25, 79, 208, 55, 103, 144, 48, 102, 96, 59, 60, 6, - 12, 38, 230, 51, 127, 233, 138, 153, 10, 90, 98, 39, 49, 150, 13, - 38, 198, 0, 64, 67, 153, 74, 127, 110, 172, 43, 102, 132, 101, 120, - 18, 50, 160, 222, 72, 23, 159, 70, 186, 98, 70, 7, 61, 6, 149, - 89, 59, 65, 246, 106, 168, 43, 102, 42, 240, 142, 51, 237, 140, 84, - 118, 183, 86, 182, 4, 152, 108, 211, 78, 174, 94, 87, 86, 253, 7, - 127, 75, 141, 47, 87, 129, 113, 87, 62, 176, 132, 138, 166, 87, 28, - 98, 51, 109, 26, 253, 127, 73, 158, 47, 13, 158, 119, 228, 235, 91, - 84, 59, 142, 254, 210, 137, 98, 177, 149, 132, 235, 103, 181, 95, 158, - 163, 199, 109, 11, 56, 204, 215, 247, 109, 189, 66, 122, 229, 194, 84, - 22, 127, 166, 204, 133, 201, 11, 148, 180, 73, 73, 37, 38, 253, 74, - 224, 17, 190, 190, 165, 38, 53, 24, 174, 86, 103, 129, 233, 144, 23, - 86, 140, 80, 13, 15, 217, 15, 250, 148, 161, 236, 215, 183, 81, 183, - 116, 77, 246, 3, 207, 59, 9, 217, 239, 253, 209, 98, 108, 63, 20, - 155, 160, 253, 46, 93, 174, 115, 68, 200, 126, 178, 69, 254, 71, 145, - 253, 190, 188, 183, 57, 138, 236, 215, 112, 162, 229, 81, 33, 251, 113, - 117, 62, 11, 76, 67, 251, 9, 213, 255, 144, 253, 32, 94, 144, 253, - 86, 104, 177, 223, 52, 29, 236, 183, 215, 179, 132, 26, 231, 114, 43, - 179, 172, 253, 154, 222, 243, 165, 31, 186, 243, 255, 182, 231, 133, 58, - 113, 180, 243, 221, 46, 110, 200, 126, 40, 22, 119, 252, 124, 142, 158, - 117, 224, 51, 239, 249, 153, 234, 245, 11, 233, 3, 123, 173, 78, 34, - 251, 117, 152, 116, 87, 185, 31, 249, 65, 133, 202, 204, 49, 251, 19, - 188, 251, 154, 39, 152, 214, 96, 184, 26, 161, 5, 166, 239, 23, 88, - 49, 66, 181, 67, 100, 63, 24, 11, 212, 253, 239, 207, 188, 73, 229, - 127, 252, 121, 19, 244, 191, 71, 183, 35, 165, 156, 253, 84, 237, 219, - 2, 255, 139, 183, 224, 239, 91, 217, 34, 142, 174, 184, 36, 10, 239, - 107, 70, 99, 207, 56, 224, 127, 179, 38, 205, 225, 223, 7, 106, 89, - 72, 23, 126, 24, 139, 247, 144, 54, 58, 31, 160, 164, 251, 1, 255, - 27, 226, 23, 200, 255, 91, 56, 192, 126, 92, 125, 209, 2, 211, 19, - 128, 255, 9, 213, 29, 241, 253, 77, 158, 220, 152, 71, 89, 130, 56, - 238, 197, 59, 230, 117, 37, 199, 188, 16, 208, 87, 86, 95, 120, 204, - 131, 237, 80, 28, 151, 53, 224, 218, 155, 215, 55, 220, 220, 10, 242, - 197, 99, 5, 160, 161, 76, 101, 46, 106, 101, 184, 185, 149, 136, 144, - 1, 245, 70, 186, 216, 89, 25, 110, 110, 5, 249, 146, 99, 158, 136, - 149, 33, 183, 52, 220, 220, 10, 218, 93, 223, 185, 149, 218, 25, 124, - 43, 253, 231, 86, 106, 121, 167, 149, 254, 115, 43, 181, 188, 211, 82, - 255, 185, 21, 153, 39, 66, 156, 32, 204, 136, 106, 5, 138, 139, 60, - 121, 49, 211, 141, 196, 140, 188, 94, 160, 152, 170, 43, 140, 25, 216, - 14, 249, 1, 85, 143, 107, 239, 89, 71, 87, 204, 152, 104, 244, 3, - 247, 71, 219, 241, 188, 135, 34, 100, 200, 193, 59, 201, 89, 57, 62, - 22, 186, 98, 70, 179, 140, 156, 254, 94, 105, 88, 143, 186, 132, 30, - 128, 70, 186, 132, 212, 214, 21, 51, 154, 101, 248, 72, 215, 226, 123, - 53, 168, 186, 234, 152, 145, 179, 246, 149, 213, 210, 21, 51, 154, 101, - 28, 174, 52, 83, 137, 153, 116, 214, 238, 214, 202, 150, 34, 209, 143, - 197, 77, 165, 208, 142, 200, 135, 16, 221, 243, 214, 110, 226, 185, 230, - 184, 155, 209, 40, 79, 106, 92, 247, 52, 106, 67, 189, 217, 115, 65, - 73, 59, 166, 140, 163, 190, 46, 123, 106, 207, 231, 127, 143, 90, 29, - 160, 56, 254, 10, 76, 59, 44, 52, 163, 133, 228, 34, 61, 224, 183, - 37, 245, 128, 223, 10, 233, 129, 104, 168, 7, 247, 92, 187, 30, 57, - 43, 34, 80, 27, 170, 223, 251, 232, 52, 164, 135, 91, 215, 117, 105, - 66, 122, 112, 252, 21, 152, 134, 122, 8, 201, 69, 122, 64, 255, 65, - 122, 44, 91, 217, 84, 10, 253, 1, 233, 129, 232, 43, 55, 119, 19, - 207, 181, 140, 191, 198, 121, 210, 133, 39, 83, 81, 27, 234, 68, 254, - 17, 37, 157, 249, 207, 56, 202, 104, 112, 78, 54, 159, 30, 121, 214, - 7, 40, 142, 191, 2, 211, 135, 22, 152, 209, 66, 114, 145, 30, 208, - 71, 145, 30, 219, 150, 52, 149, 66, 159, 67, 122, 32, 250, 76, 222, - 110, 226, 185, 102, 126, 222, 13, 242, 164, 147, 75, 167, 162, 54, 212, - 127, 141, 84, 244, 143, 3, 227, 40, 31, 121, 32, 111, 92, 219, 1, - 190, 7, 199, 95, 129, 233, 230, 224, 123, 8, 201, 69, 49, 17, 198, - 65, 124, 63, 87, 127, 128, 115, 75, 190, 152, 104, 111, 71, 198, 68, - 89, 205, 64, 113, 226, 64, 225, 152, 8, 219, 97, 156, 215, 36, 214, - 53, 6, 234, 151, 71, 60, 186, 102, 138, 99, 162, 136, 144, 33, 51, - 7, 99, 60, 43, 71, 62, 64, 191, 60, 194, 216, 246, 0, 94, 59, - 129, 124, 241, 218, 9, 124, 119, 86, 134, 231, 0, 253, 242, 136, 13, - 212, 39, 188, 22, 8, 249, 146, 49, 17, 202, 84, 126, 221, 254, 250, - 229, 17, 22, 118, 92, 189, 9, 218, 93, 91, 157, 31, 218, 180, 188, - 235, 6, 208, 198, 218, 248, 65, 251, 149, 151, 159, 39, 15, 63, 104, - 171, 242, 242, 131, 182, 211, 198, 15, 218, 165, 188, 235, 26, 16, 39, - 248, 126, 174, 222, 224, 187, 212, 226, 197, 140, 218, 30, 42, 69, 191, - 64, 177, 79, 95, 97, 204, 192, 118, 120, 109, 187, 31, 113, 63, 87, - 31, 195, 229, 222, 62, 132, 12, 5, 120, 39, 5, 43, 71, 214, 199, - 112, 185, 55, 228, 139, 245, 0, 52, 210, 197, 188, 143, 225, 114, 111, - 159, 190, 101, 238, 231, 98, 237, 155, 216, 219, 112, 185, 55, 180, 187, - 33, 215, 53, 100, 125, 12, 187, 174, 97, 222, 199, 176, 235, 26, 208, - 118, 134, 92, 215, 128, 56, 193, 251, 14, 123, 0, 63, 232, 207, 139, - 25, 181, 61, 39, 137, 189, 2, 197, 18, 15, 97, 204, 192, 118, 120, - 221, 185, 23, 177, 87, 215, 93, 63, 204, 236, 147, 89, 226, 49, 64, - 66, 200, 72, 4, 239, 148, 200, 202, 161, 220, 245, 195, 76, 161, 201, - 69, 110, 253, 220, 131, 208, 3, 208, 72, 151, 156, 158, 250, 97, 38, - 41, 185, 42, 183, 126, 238, 81, 102, 253, 156, 181, 175, 79, 79, 253, - 48, 179, 98, 115, 56, 183, 87, 215, 93, 123, 220, 133, 54, 45, 247, - 122, 55, 15, 63, 104, 191, 114, 175, 119, 247, 212, 206, 15, 218, 170, - 188, 252, 124, 120, 248, 65, 187, 148, 119, 156, 129, 56, 65, 152, 145, - 81, 192, 15, 122, 107, 192, 204, 4, 223, 80, 248, 195, 83, 51, 216, - 205, 186, 120, 15, 17, 232, 171, 96, 116, 216, 167, 213, 131, 24, 3, - 186, 19, 227, 12, 173, 223, 124, 245, 171, 127, 50, 183, 199, 181, 59, - 49, 6, 0, 26, 202, 84, 49, 208, 111, 190, 218, 212, 249, 45, 206, - 155, 124, 8, 25, 80, 111, 164, 139, 93, 13, 253, 230, 171, 143, 186, - 155, 74, 177, 30, 76, 153, 125, 90, 172, 12, 170, 186, 126, 243, 85, - 239, 38, 195, 240, 124, 21, 218, 29, 205, 43, 224, 254, 68, 104, 71, - 228, 55, 136, 30, 244, 247, 2, 154, 123, 174, 57, 238, 62, 76, 53, - 99, 102, 20, 61, 96, 219, 244, 99, 80, 251, 186, 111, 198, 51, 75, - 46, 173, 227, 237, 251, 125, 73, 20, 51, 117, 127, 33, 91, 123, 94, - 137, 233, 132, 211, 127, 19, 207, 249, 231, 71, 34, 66, 143, 111, 64, - 15, 248, 173, 144, 30, 136, 222, 4, 244, 224, 158, 107, 230, 183, 52, - 205, 140, 169, 61, 122, 1, 254, 221, 12, 212, 254, 9, 208, 99, 203, - 174, 16, 222, 190, 166, 75, 163, 152, 230, 14, 238, 110, 72, 15, 68, - 199, 3, 61, 184, 231, 252, 122, 64, 255, 65, 122, 124, 0, 122, 64, - 127, 192, 185, 50, 75, 215, 219, 178, 128, 230, 158, 107, 230, 151, 126, - 200, 140, 249, 247, 131, 20, 239, 23, 69, 237, 169, 119, 227, 153, 231, - 103, 242, 120, 223, 165, 30, 208, 195, 105, 177, 35, 254, 30, 136, 142, - 2, 122, 112, 207, 249, 245, 128, 62, 138, 235, 7, 64, 15, 232, 115, - 72, 15, 68, 143, 1, 223, 131, 123, 174, 153, 223, 79, 224, 87, 87, - 77, 123, 97, 61, 80, 251, 110, 224, 123, 4, 196, 143, 225, 223, 247, - 10, 252, 170, 75, 229, 121, 120, 239, 42, 162, 55, 0, 61, 184, 231, - 252, 121, 4, 140, 131, 184, 134, 87, 5, 224, 188, 7, 127, 76, 116, - 32, 235, 75, 102, 96, 126, 91, 77, 135, 26, 158, 25, 81, 251, 50, - 227, 218, 231, 84, 213, 47, 143, 200, 74, 94, 134, 199, 95, 138, 144, - 33, 7, 239, 36, 103, 229, 248, 84, 213, 47, 143, 24, 172, 136, 199, - 245, 53, 200, 23, 235, 1, 104, 164, 75, 81, 21, 253, 242, 136, 152, - 167, 117, 113, 76, 164, 170, 149, 169, 225, 177, 246, 149, 85, 209, 47, - 143, 216, 188, 191, 19, 206, 35, 160, 221, 181, 141, 171, 208, 166, 229, - 30, 167, 121, 248, 65, 251, 149, 151, 31, 180, 167, 214, 189, 181, 192, - 86, 229, 229, 39, 227, 225, 7, 237, 82, 222, 60, 2, 226, 4, 255, - 110, 65, 133, 64, 49, 196, 16, 31, 102, 58, 146, 245, 135, 202, 160, - 109, 37, 29, 106, 60, 149, 9, 63, 168, 204, 181, 143, 23, 235, 135, - 25, 89, 225, 255, 48, 102, 68, 132, 12, 25, 120, 39, 25, 43, 71, - 34, 214, 15, 51, 155, 54, 137, 79, 98, 61, 42, 17, 122, 64, 189, - 89, 25, 41, 21, 245, 195, 204, 3, 207, 35, 156, 30, 149, 202, 212, - 120, 88, 251, 82, 21, 245, 195, 76, 252, 137, 86, 24, 51, 208, 238, - 218, 124, 8, 218, 180, 188, 62, 41, 225, 225, 7, 237, 87, 94, 126, - 208, 158, 218, 248, 65, 91, 149, 123, 110, 192, 195, 15, 218, 165, 188, - 152, 129, 56, 193, 185, 183, 17, 248, 46, 85, 248, 49, 211, 137, 144, - 77, 129, 190, 114, 19, 97, 204, 192, 118, 120, 12, 48, 37, 214, 138, - 76, 244, 195, 204, 191, 189, 250, 98, 95, 131, 124, 241, 24, 0, 104, - 40, 83, 89, 35, 49, 214, 15, 51, 37, 155, 190, 227, 252, 158, 34, - 100, 64, 189, 145, 46, 33, 198, 250, 97, 166, 198, 254, 255, 112, 126, - 15, 249, 146, 152, 161, 144, 189, 140, 245, 195, 76, 147, 248, 48, 140, - 25, 104, 119, 109, 62, 4, 109, 170, 139, 15, 145, 53, 20, 104, 99, - 109, 252, 160, 253, 202, 203, 47, 132, 135, 31, 180, 85, 121, 249, 137, - 120, 248, 65, 187, 232, 202, 15, 231, 102, 70, 68, 141, 167, 29, 240, - 131, 10, 252, 152, 113, 36, 101, 131, 190, 146, 14, 194, 152, 129, 237, - 240, 24, 32, 34, 106, 60, 182, 250, 97, 134, 156, 175, 66, 190, 184, - 198, 3, 223, 201, 136, 141, 207, 182, 250, 97, 134, 156, 175, 66, 190, - 184, 198, 3, 104, 164, 75, 78, 123, 253, 48, 67, 206, 87, 37, 29, - 202, 212, 120, 88, 251, 250, 180, 215, 15, 51, 104, 190, 234, 194, 218, - 29, 249, 80, 142, 175, 88, 222, 114, 235, 138, 63, 230, 171, 223, 35, - 79, 82, 59, 102, 228, 185, 234, 20, 199, 9, 126, 149, 198, 137, 229, - 3, 91, 159, 251, 99, 222, 24, 15, 248, 85, 221, 87, 55, 91, 167, - 26, 79, 123, 142, 159, 221, 26, 177, 60, 226, 86, 190, 91, 217, 249, - 219, 217, 169, 39, 169, 61, 63, 90, 73, 117, 202, 29, 9, 126, 150, - 19, 196, 242, 255, 242, 199, 252, 49, 143, 122, 22, 113, 146, 138, 24, - 214, 95, 183, 243, 216, 237, 8, 204, 88, 3, 63, 48, 226, 199, 76, - 103, 178, 254, 0, 250, 42, 218, 234, 80, 227, 105, 71, 212, 70, 108, - 136, 243, 216, 109, 244, 59, 143, 173, 182, 94, 97, 67, 212, 120, 0, - 13, 101, 42, 125, 174, 181, 126, 231, 177, 213, 244, 32, 100, 64, 189, - 145, 46, 178, 86, 250, 157, 199, 86, 211, 163, 109, 153, 26, 15, 43, - 195, 167, 165, 126, 231, 177, 209, 90, 66, 17, 107, 119, 116, 6, 53, - 78, 203, 222, 193, 1, 58, 236, 29, 172, 232, 89, 66, 45, 202, 247, - 255, 99, 239, 224, 140, 60, 95, 250, 224, 3, 127, 222, 186, 192, 249, - 218, 113, 116, 141, 84, 132, 213, 36, 92, 79, 26, 84, 114, 157, 54, - 9, 203, 227, 173, 15, 173, 168, 37, 98, 184, 250, 147, 5, 166, 79, - 109, 177, 97, 132, 234, 82, 248, 60, 118, 107, 206, 6, 43, 181, 216, - 96, 164, 14, 54, 240, 0, 54, 72, 76, 77, 116, 41, 107, 131, 51, - 192, 6, 75, 210, 19, 121, 239, 37, 217, 10, 108, 176, 157, 57, 135, - 239, 91, 71, 241, 165, 43, 176, 65, 250, 254, 186, 188, 251, 0, 150, - 1, 27, 112, 181, 43, 11, 76, 67, 27, 8, 213, 180, 240, 121, 236, - 86, 156, 13, 70, 107, 177, 193, 248, 52, 97, 27, 56, 140, 40, 161, - 236, 141, 15, 101, 149, 181, 193, 141, 103, 190, 244, 114, 230, 16, 239, - 247, 216, 104, 22, 71, 159, 255, 144, 143, 247, 144, 162, 152, 232, 246, - 253, 58, 189, 252, 103, 43, 222, 154, 140, 4, 216, 128, 171, 123, 89, - 96, 58, 19, 216, 64, 168, 30, 134, 207, 99, 183, 228, 108, 176, 66, - 203, 62, 208, 80, 29, 246, 129, 30, 2, 126, 48, 220, 39, 230, 143, - 125, 160, 189, 238, 250, 210, 117, 164, 252, 123, 57, 71, 3, 63, 8, - 184, 51, 6, 239, 3, 69, 113, 188, 26, 240, 131, 162, 161, 253, 121, - 251, 198, 2, 27, 112, 53, 51, 11, 76, 67, 63, 16, 170, 165, 225, - 49, 192, 154, 56, 143, 221, 20, 196, 181, 118, 252, 99, 64, 87, 50, - 62, 129, 190, 138, 230, 58, 140, 1, 214, 68, 236, 108, 65, 156, 95, - 104, 174, 95, 222, 4, 235, 193, 56, 118, 182, 32, 198, 0, 64, 67, - 153, 202, 70, 205, 245, 203, 155, 96, 173, 22, 235, 65, 200, 128, 122, - 35, 93, 226, 155, 233, 151, 55, 193, 58, 42, 214, 163, 121, 153, 49, - 128, 149, 33, 105, 166, 95, 222, 4, 107, 156, 56, 151, 111, 206, 229, - 17, 241, 62, 187, 229, 92, 93, 93, 38, 69, 180, 220, 162, 34, 205, - 87, 111, 87, 59, 143, 77, 240, 147, 249, 238, 150, 115, 245, 109, 153, - 20, 209, 150, 128, 31, 95, 221, 91, 237, 60, 118, 51, 142, 31, 53, - 110, 183, 156, 171, 51, 203, 164, 136, 126, 89, 171, 34, 205, 87, 127, - 86, 171, 31, 16, 252, 82, 128, 190, 92, 189, 87, 38, 69, 116, 18, - 120, 63, 190, 58, 176, 218, 121, 236, 166, 68, 77, 43, 7, 248, 129, - 53, 63, 102, 186, 17, 223, 67, 2, 250, 74, 62, 232, 112, 30, 187, - 41, 49, 15, 144, 16, 251, 150, 100, 122, 238, 91, 90, 83, 11, 207, - 53, 32, 95, 44, 3, 240, 133, 50, 149, 243, 153, 34, 253, 48, 179, - 181, 225, 99, 78, 134, 140, 152, 107, 0, 189, 145, 46, 84, 145, 126, - 152, 241, 120, 189, 158, 187, 251, 233, 67, 153, 185, 6, 107, 35, 234, - 134, 126, 152, 153, 229, 74, 236, 91, 146, 241, 236, 91, 2, 54, 45, - 239, 252, 23, 218, 88, 27, 63, 104, 191, 242, 242, 163, 120, 248, 65, - 91, 149, 155, 223, 13, 237, 252, 160, 93, 202, 59, 63, 135, 56, 65, - 152, 9, 145, 4, 137, 19, 155, 242, 98, 70, 185, 217, 15, 215, 91, - 64, 95, 74, 161, 67, 77, 43, 135, 168, 55, 61, 38, 206, 99, 167, - 234, 135, 153, 108, 199, 5, 220, 218, 201, 99, 162, 222, 4, 222, 9, - 202, 84, 142, 101, 169, 250, 97, 230, 212, 241, 177, 120, 12, 128, 124, - 177, 30, 80, 6, 210, 37, 85, 207, 113, 102, 103, 33, 167, 135, 162, - 204, 218, 9, 107, 223, 248, 20, 253, 48, 51, 33, 117, 56, 119, 30, - 59, 85, 187, 15, 65, 155, 150, 183, 206, 26, 194, 195, 15, 218, 175, - 188, 252, 68, 60, 252, 160, 173, 202, 203, 15, 218, 78, 235, 189, 36, - 192, 46, 229, 173, 3, 67, 156, 224, 123, 57, 69, 65, 98, 121, 14, - 63, 102, 200, 61, 24, 137, 118, 160, 175, 81, 144, 240, 190, 37, 208, - 14, 255, 86, 178, 57, 215, 222, 211, 55, 72, 175, 61, 24, 100, 110, - 6, 249, 226, 223, 124, 6, 52, 148, 169, 204, 109, 124, 130, 244, 218, - 131, 65, 230, 102, 118, 132, 12, 168, 55, 210, 69, 70, 7, 233, 181, - 7, 131, 204, 205, 32, 95, 181, 223, 124, 102, 101, 196, 83, 65, 122, - 237, 193, 64, 185, 89, 58, 107, 119, 188, 230, 223, 35, 214, 77, 83, - 110, 86, 117, 207, 117, 169, 208, 94, 8, 207, 239, 245, 168, 115, 174, - 173, 88, 31, 166, 168, 21, 107, 157, 148, 244, 209, 235, 155, 169, 6, - 99, 103, 240, 230, 97, 45, 219, 63, 163, 56, 254, 230, 56, 15, 28, - 20, 212, 145, 214, 117, 15, 6, 252, 182, 72, 15, 151, 150, 177, 110, - 154, 114, 194, 46, 7, 175, 75, 133, 246, 66, 28, 104, 96, 73, 37, - 44, 104, 138, 245, 184, 62, 182, 161, 146, 110, 148, 179, 153, 170, 243, - 169, 26, 175, 30, 73, 29, 158, 81, 28, 127, 115, 156, 127, 46, 11, - 238, 72, 235, 186, 7, 3, 250, 15, 210, 99, 238, 224, 88, 55, 77, - 185, 104, 215, 127, 175, 75, 133, 246, 66, 108, 127, 81, 143, 154, 119, - 195, 14, 235, 113, 184, 66, 47, 37, 29, 7, 190, 135, 113, 98, 44, - 175, 30, 63, 108, 158, 81, 28, 127, 115, 156, 247, 158, 12, 236, 72, - 235, 186, 7, 3, 250, 40, 210, 163, 158, 117, 172, 155, 166, 28, 56, - 44, 245, 186, 84, 104, 47, 132, 125, 35, 75, 202, 51, 18, 253, 78, - 5, 69, 197, 175, 85, 253, 222, 69, 51, 240, 61, 34, 111, 133, 240, - 230, 207, 167, 192, 247, 224, 248, 155, 227, 124, 123, 61, 248, 30, 186, - 238, 193, 128, 113, 16, 197, 196, 20, 81, 176, 24, 198, 72, 190, 152, - 72, 238, 193, 144, 229, 4, 137, 139, 140, 131, 133, 215, 147, 115, 136, - 152, 168, 224, 248, 203, 52, 244, 45, 87, 157, 63, 221, 7, 231, 197, - 144, 47, 142, 137, 128, 134, 50, 149, 86, 209, 73, 134, 246, 60, 98, - 233, 254, 48, 44, 195, 142, 144, 1, 245, 70, 186, 36, 26, 5, 235, - 149, 71, 28, 9, 251, 136, 215, 18, 32, 95, 181, 152, 200, 202, 176, - 211, 73, 134, 246, 60, 226, 248, 16, 110, 47, 39, 180, 187, 182, 113, - 21, 218, 180, 188, 227, 180, 57, 15, 63, 104, 191, 242, 242, 131, 246, - 212, 198, 15, 218, 170, 188, 252, 236, 120, 248, 65, 187, 148, 55, 143, - 128, 56, 193, 231, 108, 250, 4, 139, 33, 134, 52, 98, 38, 116, 82, - 192, 68, 118, 51, 39, 254, 158, 160, 111, 226, 0, 97, 204, 192, 118, - 220, 249, 20, 174, 125, 74, 255, 96, 189, 242, 8, 133, 127, 50, 113, - 62, 133, 147, 33, 1, 52, 148, 169, 204, 93, 251, 5, 235, 149, 71, - 4, 56, 191, 197, 152, 145, 16, 50, 160, 222, 72, 151, 156, 190, 193, - 122, 229, 17, 15, 137, 181, 49, 200, 87, 237, 183, 87, 88, 25, 138, - 62, 193, 122, 229, 17, 94, 196, 94, 78, 104, 119, 114, 47, 39, 180, - 35, 242, 27, 68, 123, 254, 189, 128, 230, 158, 107, 142, 187, 247, 82, - 205, 152, 93, 209, 203, 216, 54, 253, 24, 212, 190, 214, 155, 241, 76, - 251, 211, 71, 120, 251, 194, 189, 156, 159, 198, 162, 122, 244, 74, 76, - 195, 189, 156, 220, 115, 254, 113, 11, 126, 91, 82, 15, 248, 173, 144, - 30, 136, 246, 2, 122, 112, 207, 53, 243, 83, 0, 61, 250, 159, 173, - 131, 239, 13, 69, 237, 173, 128, 30, 251, 7, 222, 18, 220, 147, 122, - 112, 80, 63, 87, 164, 7, 162, 161, 30, 220, 115, 126, 61, 160, 255, - 32, 61, 190, 0, 61, 30, 18, 123, 57, 17, 125, 22, 232, 241, 80, - 160, 118, 253, 46, 205, 140, 105, 117, 219, 30, 239, 129, 68, 237, 135, - 190, 29, 207, 56, 154, 63, 227, 205, 105, 170, 44, 141, 98, 190, 92, - 172, 128, 247, 164, 34, 122, 25, 208, 131, 123, 206, 175, 7, 244, 81, - 242, 123, 120, 17, 123, 57, 17, 61, 22, 232, 225, 37, 80, 127, 46, - 1, 223, 99, 78, 170, 7, 214, 3, 181, 119, 2, 223, 227, 68, 170, - 240, 94, 206, 7, 89, 220, 94, 78, 68, 195, 189, 156, 220, 115, 254, - 60, 2, 198, 65, 124, 142, 202, 29, 140, 141, 162, 96, 254, 152, 232, - 64, 156, 241, 233, 29, 44, 246, 233, 37, 28, 19, 97, 59, 92, 147, - 238, 205, 181, 47, 242, 208, 47, 143, 232, 221, 105, 30, 254, 173, 115, - 31, 66, 134, 2, 188, 147, 130, 149, 35, 243, 208, 47, 143, 120, 92, - 181, 29, 222, 203, 9, 249, 98, 61, 0, 141, 116, 49, 247, 208, 47, - 143, 88, 166, 216, 197, 213, 214, 123, 169, 199, 68, 5, 107, 223, 68, - 119, 253, 242, 136, 245, 49, 83, 184, 115, 84, 30, 218, 199, 85, 104, - 211, 242, 142, 211, 50, 30, 126, 208, 126, 229, 206, 75, 120, 248, 65, - 91, 149, 59, 47, 113, 215, 206, 15, 218, 165, 188, 121, 4, 196, 9, - 222, 47, 64, 3, 63, 232, 35, 128, 153, 142, 68, 61, 162, 103, 176, - 88, 210, 67, 24, 51, 176, 29, 30, 227, 123, 18, 121, 68, 119, 253, - 48, 115, 183, 105, 12, 246, 103, 9, 33, 35, 17, 188, 83, 34, 43, - 135, 234, 174, 31, 102, 206, 116, 120, 135, 253, 25, 242, 197, 122, 0, - 26, 233, 146, 195, 232, 135, 25, 199, 119, 151, 185, 115, 84, 61, 212, - 49, 147, 200, 218, 215, 135, 209, 15, 51, 89, 199, 164, 220, 30, 155, - 238, 218, 125, 8, 218, 180, 188, 62, 73, 241, 240, 131, 246, 43, 47, - 63, 104, 79, 109, 252, 160, 173, 202, 203, 207, 135, 135, 31, 180, 75, - 121, 49, 3, 113, 130, 115, 111, 87, 224, 7, 238, 2, 152, 233, 68, - 172, 253, 129, 190, 137, 82, 97, 204, 192, 118, 120, 12, 160, 184, 246, - 118, 82, 253, 48, 19, 186, 182, 18, 55, 6, 80, 196, 24, 0, 104, - 40, 83, 153, 123, 187, 233, 135, 153, 243, 117, 55, 114, 231, 168, 8, - 25, 80, 111, 164, 139, 167, 155, 126, 152, 73, 108, 31, 200, 205, 33, - 164, 234, 152, 241, 97, 101, 40, 92, 245, 195, 140, 223, 26, 226, 238, - 94, 169, 118, 31, 130, 54, 45, 239, 90, 12, 180, 177, 214, 251, 169, - 129, 253, 202, 203, 207, 147, 135, 31, 180, 85, 121, 249, 65, 219, 105, - 227, 7, 237, 82, 222, 181, 34, 136, 19, 156, 155, 117, 3, 126, 64, - 11, 96, 198, 145, 200, 27, 92, 128, 111, 58, 235, 144, 155, 185, 16, - 254, 236, 66, 228, 102, 78, 250, 97, 134, 156, 175, 250, 16, 50, 20, - 224, 157, 20, 172, 28, 153, 147, 126, 152, 33, 231, 171, 144, 47, 214, - 3, 208, 72, 23, 115, 39, 253, 48, 67, 206, 87, 125, 156, 203, 228, - 102, 172, 125, 19, 187, 233, 135, 25, 47, 98, 47, 39, 180, 59, 185, - 151, 211, 98, 235, 138, 63, 230, 171, 112, 47, 103, 236, 140, 188, 44, - 157, 114, 51, 130, 31, 220, 203, 185, 164, 245, 185, 63, 230, 141, 112, - 47, 103, 215, 125, 117, 117, 218, 147, 96, 78, 240, 131, 123, 57, 195, - 137, 189, 156, 15, 137, 189, 156, 73, 58, 238, 229, 132, 182, 35, 247, - 114, 222, 36, 246, 114, 122, 17, 123, 57, 195, 117, 220, 203, 9, 113, - 130, 49, 227, 0, 252, 192, 85, 0, 51, 157, 137, 188, 161, 43, 24, - 151, 186, 232, 144, 155, 117, 37, 114, 154, 174, 68, 251, 206, 193, 6, - 219, 203, 41, 33, 100, 36, 130, 119, 74, 100, 229, 40, 58, 5, 27, - 108, 47, 39, 228, 139, 245, 0, 52, 210, 69, 222, 49, 216, 96, 123, - 57, 37, 93, 202, 228, 102, 172, 125, 19, 29, 130, 13, 182, 151, 19, - 218, 221, 80, 123, 57, 39, 229, 251, 255, 177, 143, 17, 238, 229, 92, - 245, 192, 159, 119, 31, 35, 220, 203, 89, 154, 178, 2, 239, 99, 68, - 88, 133, 123, 57, 95, 204, 202, 227, 173, 241, 192, 189, 156, 92, 253, - 201, 2, 211, 112, 255, 154, 80, 93, 10, 217, 0, 250, 133, 161, 246, - 114, 94, 79, 77, 252, 99, 63, 43, 220, 203, 153, 145, 158, 200, 187, - 198, 2, 247, 114, 222, 103, 206, 225, 253, 172, 40, 190, 192, 189, 156, - 138, 253, 117, 121, 235, 42, 112, 47, 39, 87, 187, 178, 192, 52, 180, - 129, 80, 77, 11, 239, 233, 237, 24, 108, 176, 189, 156, 29, 180, 236, - 229, 92, 166, 195, 94, 206, 115, 196, 94, 206, 135, 196, 94, 206, 101, - 58, 236, 229, 124, 72, 236, 229, 124, 72, 236, 229, 124, 168, 227, 94, - 78, 136, 171, 255, 31, 246, 114, 250, 19, 123, 57, 189, 136, 189, 156, - 239, 116, 216, 203, 233, 69, 236, 229, 244, 34, 246, 114, 122, 233, 184, - 151, 19, 198, 125, 124, 127, 251, 104, 16, 215, 186, 9, 140, 1, 93, - 137, 248, 100, 15, 98, 237, 88, 29, 198, 0, 123, 34, 118, 218, 19, - 115, 13, 59, 253, 242, 38, 88, 15, 198, 177, 147, 144, 145, 8, 248, - 38, 178, 114, 236, 198, 234, 151, 55, 193, 90, 45, 183, 239, 129, 144, - 1, 248, 34, 93, 228, 99, 244, 203, 155, 96, 29, 149, 251, 45, 146, - 50, 99, 0, 107, 35, 207, 49, 250, 229, 77, 176, 198, 137, 231, 26, - 118, 193, 196, 125, 235, 187, 229, 92, 93, 93, 38, 69, 244, 69, 139, - 138, 52, 95, 189, 93, 109, 237, 105, 108, 176, 218, 222, 80, 174, 190, - 45, 147, 34, 26, 238, 13, 229, 171, 123, 171, 221, 207, 53, 134, 227, - 103, 238, 183, 91, 206, 213, 153, 101, 82, 68, 167, 212, 174, 72, 243, - 213, 159, 213, 238, 231, 34, 248, 193, 189, 156, 92, 189, 87, 38, 69, - 52, 220, 203, 201, 87, 7, 86, 187, 191, 125, 52, 135, 153, 248, 225, - 192, 15, 28, 4, 48, 211, 141, 184, 91, 28, 244, 205, 25, 41, 140, - 25, 216, 14, 223, 123, 62, 138, 107, 239, 51, 82, 63, 204, 148, 100, - 54, 200, 226, 126, 139, 36, 152, 248, 45, 146, 96, 49, 148, 169, 156, - 207, 140, 208, 15, 51, 197, 15, 189, 178, 185, 223, 34, 33, 244, 0, - 239, 142, 116, 145, 141, 208, 15, 51, 84, 158, 59, 167, 199, 72, 117, - 204, 120, 178, 50, 204, 71, 232, 135, 153, 171, 47, 231, 112, 191, 125, - 59, 82, 251, 124, 21, 218, 180, 188, 243, 95, 104, 99, 109, 252, 160, - 253, 202, 203, 79, 198, 195, 15, 218, 170, 188, 252, 204, 121, 248, 65, - 187, 148, 119, 126, 14, 113, 130, 127, 143, 202, 27, 248, 193, 104, 126, - 204, 192, 205, 156, 248, 183, 111, 65, 223, 248, 161, 194, 152, 129, 237, - 240, 111, 120, 12, 227, 218, 75, 134, 234, 135, 153, 230, 138, 219, 89, - 220, 111, 145, 4, 19, 191, 69, 2, 116, 26, 174, 226, 157, 50, 68, - 63, 204, 156, 43, 110, 146, 197, 253, 22, 9, 161, 7, 120, 119, 164, - 11, 53, 68, 63, 204, 212, 59, 158, 229, 198, 253, 22, 137, 58, 102, - 204, 89, 25, 57, 222, 250, 97, 102, 67, 149, 96, 140, 25, 104, 119, - 109, 62, 4, 109, 90, 222, 58, 43, 180, 177, 54, 126, 208, 126, 229, - 174, 43, 243, 240, 131, 182, 42, 119, 93, 217, 91, 59, 63, 104, 151, - 242, 214, 129, 33, 78, 240, 190, 165, 8, 224, 7, 195, 5, 48, 67, - 236, 193, 200, 241, 2, 241, 124, 176, 48, 102, 96, 59, 60, 6, 120, - 17, 227, 204, 32, 253, 246, 96, 144, 185, 153, 39, 33, 35, 7, 188, - 83, 14, 43, 39, 228, 47, 253, 246, 96, 144, 185, 25, 228, 203, 253, - 22, 9, 208, 157, 149, 33, 243, 212, 111, 15, 6, 153, 155, 121, 14, - 86, 199, 76, 14, 107, 95, 187, 72, 253, 246, 96, 160, 220, 44, 157, - 181, 59, 90, 43, 111, 238, 24, 235, 166, 41, 55, 171, 149, 121, 93, - 42, 180, 23, 226, 98, 85, 75, 74, 116, 106, 4, 59, 142, 80, 84, - 230, 165, 137, 74, 250, 197, 245, 205, 84, 175, 128, 37, 188, 103, 145, - 131, 109, 159, 81, 28, 127, 115, 156, 7, 126, 8, 234, 72, 235, 186, - 7, 3, 126, 91, 164, 199, 246, 14, 177, 110, 154, 114, 66, 199, 172, - 235, 82, 161, 189, 16, 29, 106, 89, 82, 135, 110, 254, 204, 68, 122, - 84, 114, 106, 167, 148, 95, 12, 244, 248, 17, 190, 153, 55, 63, 85, - 0, 61, 56, 254, 230, 56, 255, 108, 27, 220, 145, 214, 117, 15, 6, - 244, 31, 164, 71, 146, 67, 172, 155, 166, 92, 116, 45, 248, 30, 66, - 123, 33, 246, 86, 183, 164, 106, 143, 246, 195, 123, 57, 127, 14, 155, - 170, 164, 223, 3, 61, 30, 55, 90, 198, 155, 199, 38, 2, 61, 56, - 254, 230, 56, 239, 173, 10, 244, 208, 117, 15, 6, 244, 81, 164, 135, - 168, 101, 172, 155, 166, 28, 184, 231, 201, 235, 82, 161, 189, 16, 254, - 141, 44, 169, 102, 191, 67, 241, 94, 206, 150, 231, 166, 41, 233, 198, - 57, 155, 169, 201, 245, 166, 240, 230, 207, 251, 59, 60, 163, 56, 254, - 230, 56, 223, 94, 1, 244, 208, 117, 15, 6, 140, 131, 248, 76, 200, - 92, 128, 115, 111, 129, 152, 72, 236, 193, 176, 3, 125, 83, 230, 235, - 176, 47, 45, 130, 195, 121, 74, 56, 215, 158, 154, 175, 95, 30, 177, - 33, 203, 18, 231, 197, 144, 47, 222, 203, 9, 104, 40, 83, 25, 83, - 230, 233, 151, 71, 188, 173, 181, 19, 199, 93, 59, 66, 6, 212, 27, - 233, 226, 51, 79, 191, 60, 98, 113, 238, 75, 44, 3, 242, 85, 219, - 203, 201, 202, 40, 154, 171, 95, 30, 225, 182, 125, 46, 206, 35, 160, - 221, 181, 142, 171, 192, 166, 229, 30, 167, 231, 105, 231, 7, 237, 87, - 238, 245, 95, 30, 126, 208, 86, 229, 229, 7, 109, 167, 141, 31, 180, - 75, 121, 243, 8, 136, 19, 140, 153, 233, 192, 15, 34, 52, 96, 198, - 127, 194, 228, 153, 196, 205, 156, 72, 118, 209, 156, 96, 113, 200, 236, - 96, 177, 191, 127, 75, 185, 191, 127, 51, 230, 68, 252, 130, 236, 206, - 61, 227, 165, 101, 49, 3, 219, 33, 63, 8, 153, 195, 241, 247, 12, - 211, 228, 7, 240, 221, 45, 152, 221, 173, 26, 102, 190, 19, 253, 112, - 229, 171, 243, 127, 165, 151, 225, 49, 62, 132, 144, 81, 4, 222, 169, - 136, 149, 99, 55, 75, 187, 12, 143, 234, 21, 50, 31, 205, 173, 237, - 198, 87, 231, 95, 253, 239, 18, 44, 3, 242, 197, 122, 0, 26, 233, - 98, 62, 83, 187, 140, 47, 61, 46, 103, 30, 107, 83, 81, 202, 87, - 231, 191, 120, 115, 50, 206, 35, 66, 102, 171, 99, 6, 202, 84, 254, - 59, 157, 71, 198, 73, 47, 233, 248, 16, 153, 148, 175, 206, 223, 255, - 74, 24, 174, 243, 67, 187, 147, 191, 27, 14, 237, 136, 248, 33, 90, - 121, 47, 39, 126, 46, 18, 173, 17, 181, 17, 237, 22, 217, 136, 246, - 138, 218, 225, 184, 251, 32, 213, 140, 9, 111, 126, 130, 187, 151, 147, - 109, 111, 246, 121, 4, 211, 123, 113, 36, 239, 24, 250, 181, 234, 100, - 38, 236, 107, 7, 182, 205, 124, 38, 231, 157, 137, 146, 54, 41, 137, - 102, 206, 183, 190, 198, 91, 31, 47, 53, 89, 194, 200, 54, 206, 195, - 119, 72, 34, 58, 228, 197, 26, 226, 57, 127, 125, 23, 250, 5, 105, - 3, 248, 157, 145, 13, 16, 61, 24, 216, 128, 123, 174, 217, 6, 143, - 224, 126, 214, 12, 57, 182, 1, 106, 95, 29, 216, 64, 252, 112, 182, - 160, 13, 58, 15, 107, 140, 109, 224, 61, 249, 63, 23, 100, 131, 237, - 212, 10, 65, 27, 68, 244, 219, 234, 140, 108, 128, 232, 105, 192, 6, - 220, 115, 126, 27, 64, 191, 69, 54, 248, 14, 108, 0, 253, 16, 217, - 0, 209, 211, 129, 13, 184, 231, 208, 6, 118, 192, 6, 221, 128, 13, - 156, 48, 191, 246, 105, 102, 140, 171, 243, 30, 188, 23, 22, 181, 239, - 1, 108, 32, 218, 235, 205, 155, 131, 124, 6, 54, 24, 48, 214, 196, - 13, 217, 224, 242, 195, 93, 74, 123, 252, 254, 25, 205, 120, 187, 121, - 184, 10, 217, 192, 204, 99, 141, 19, 178, 1, 162, 161, 13, 184, 231, - 252, 54, 128, 184, 34, 253, 0, 226, 4, 217, 0, 209, 127, 1, 27, - 112, 207, 161, 13, 194, 128, 13, 102, 2, 27, 204, 192, 252, 242, 129, - 31, 228, 62, 8, 197, 251, 79, 81, 251, 170, 192, 6, 213, 139, 103, - 243, 230, 47, 95, 128, 13, 58, 204, 68, 251, 240, 231, 51, 61, 62, - 169, 206, 195, 66, 63, 40, 253, 16, 41, 21, 178, 193, 236, 111, 145, - 120, 239, 42, 162, 33, 22, 184, 231, 252, 121, 19, 140, 251, 248, 252, - 249, 20, 16, 215, 230, 10, 141, 1, 14, 92, 124, 10, 5, 237, 167, - 233, 48, 6, 132, 18, 177, 51, 148, 136, 101, 211, 116, 29, 3, 180, - 220, 169, 8, 240, 142, 99, 39, 33, 163, 8, 240, 45, 98, 229, 196, - 135, 232, 58, 6, 104, 150, 1, 241, 132, 245, 152, 70, 232, 1, 104, - 164, 75, 202, 84, 93, 199, 0, 205, 50, 160, 191, 98, 61, 166, 149, - 25, 3, 88, 27, 81, 83, 117, 29, 3, 52, 203, 128, 254, 128, 207, - 170, 78, 227, 242, 8, 179, 119, 127, 203, 185, 184, 41, 147, 34, 250, - 16, 149, 73, 241, 197, 83, 181, 179, 170, 33, 234, 252, 184, 24, 36, - 147, 34, 58, 13, 240, 227, 139, 77, 106, 245, 156, 169, 234, 252, 56, - 60, 203, 164, 136, 134, 252, 248, 112, 174, 86, 207, 41, 195, 143, 195, - 134, 76, 138, 104, 168, 47, 31, 102, 212, 238, 84, 156, 194, 97, 70, - 22, 8, 252, 96, 186, 16, 102, 58, 114, 231, 207, 65, 95, 121, 176, - 48, 102, 96, 59, 124, 54, 124, 50, 145, 55, 5, 27, 14, 51, 144, - 47, 62, 27, 14, 104, 40, 83, 185, 63, 34, 200, 112, 152, 161, 8, - 25, 80, 111, 164, 75, 72, 144, 225, 48, 3, 249, 170, 221, 169, 136, - 236, 21, 100, 56, 204, 64, 187, 35, 31, 146, 139, 78, 158, 212, 132, - 25, 201, 187, 249, 58, 99, 6, 218, 152, 228, 167, 9, 51, 144, 159, - 174, 152, 9, 41, 195, 79, 19, 102, 40, 192, 79, 87, 204, 136, 202, - 240, 211, 132, 25, 17, 224, 167, 43, 102, 32, 78, 240, 239, 60, 250, - 3, 63, 152, 34, 132, 153, 78, 220, 247, 0, 125, 101, 19, 133, 49, - 3, 219, 225, 59, 21, 39, 113, 252, 205, 39, 26, 14, 51, 144, 47, - 246, 53, 40, 35, 144, 221, 139, 19, 96, 56, 204, 136, 8, 25, 80, - 111, 164, 139, 93, 128, 225, 48, 3, 249, 170, 253, 206, 35, 43, 67, - 238, 111, 56, 204, 64, 187, 235, 139, 25, 114, 237, 9, 218, 88, 95, - 204, 144, 252, 236, 2, 244, 199, 12, 201, 15, 218, 78, 95, 204, 144, - 185, 25, 196, 9, 190, 35, 222, 15, 248, 65, 160, 16, 102, 28, 185, - 59, 56, 38, 128, 120, 62, 94, 24, 51, 176, 29, 30, 3, 38, 112, - 252, 115, 198, 233, 135, 25, 114, 126, 78, 17, 50, 228, 224, 157, 228, - 172, 28, 159, 113, 250, 97, 134, 156, 159, 67, 190, 88, 15, 64, 35, - 93, 138, 252, 244, 195, 12, 57, 63, 167, 198, 171, 99, 6, 202, 84, - 114, 243, 211, 15, 51, 104, 126, 238, 194, 218, 29, 255, 94, 209, 88, - 177, 124, 212, 215, 230, 127, 204, 207, 115, 228, 215, 165, 73, 71, 214, - 107, 157, 155, 170, 213, 160, 8, 126, 121, 99, 196, 242, 129, 30, 213, - 255, 152, 235, 74, 78, 93, 151, 118, 251, 172, 27, 63, 104, 79, 188, - 183, 118, 128, 88, 158, 22, 93, 226, 90, 118, 222, 40, 187, 112, 93, - 186, 188, 118, 180, 214, 121, 163, 218, 222, 90, 130, 31, 5, 222, 207, - 57, 42, 242, 143, 57, 152, 2, 188, 95, 24, 53, 75, 235, 28, 76, - 237, 142, 120, 63, 98, 15, 70, 77, 224, 7, 254, 66, 152, 233, 204, - 157, 233, 247, 13, 22, 123, 54, 18, 198, 12, 108, 135, 253, 192, 151, - 227, 31, 111, 165, 43, 102, 106, 104, 244, 131, 149, 177, 18, 28, 159, - 69, 132, 12, 153, 15, 192, 62, 43, 39, 167, 142, 174, 152, 209, 44, - 163, 105, 159, 100, 110, 12, 240, 33, 214, 198, 128, 222, 72, 23, 243, - 90, 186, 98, 70, 179, 140, 134, 146, 71, 120, 44, 131, 124, 213, 238, - 136, 247, 97, 177, 223, 78, 87, 204, 104, 150, 17, 248, 75, 53, 206, - 44, 48, 81, 217, 221, 90, 217, 82, 245, 27, 220, 208, 142, 136, 31, - 162, 123, 165, 196, 80, 220, 115, 240, 127, 170, 137, 68, 173, 69, 45, - 69, 206, 224, 15, 197, 221, 103, 3, 75, 168, 154, 45, 27, 226, 125, - 155, 237, 219, 183, 81, 182, 31, 150, 231, 75, 167, 244, 179, 199, 99, - 212, 96, 145, 181, 40, 0, 244, 155, 71, 244, 253, 89, 59, 142, 94, - 48, 216, 129, 187, 135, 148, 197, 170, 105, 201, 62, 250, 150, 251, 58, - 222, 58, 82, 169, 201, 33, 218, 249, 202, 14, 182, 77, 6, 221, 100, - 208, 126, 182, 30, 150, 73, 27, 221, 61, 138, 251, 166, 128, 62, 233, - 162, 246, 162, 12, 240, 135, 207, 190, 154, 156, 161, 205, 162, 206, 178, - 109, 46, 210, 131, 91, 252, 79, 73, 27, 69, 92, 166, 63, 127, 185, - 137, 251, 102, 129, 62, 167, 68, 182, 162, 115, 224, 15, 245, 253, 21, - 117, 141, 190, 58, 0, 221, 145, 154, 67, 239, 217, 125, 95, 73, 27, - 71, 220, 164, 23, 138, 30, 243, 214, 95, 126, 71, 229, 210, 39, 115, - 10, 216, 54, 121, 244, 251, 137, 133, 108, 223, 123, 116, 83, 163, 247, - 184, 239, 101, 81, 7, 209, 255, 192, 95, 14, 248, 195, 250, 70, 61, - 160, 235, 0, 44, 168, 90, 40, 104, 227, 89, 95, 149, 180, 121, 196, - 19, 250, 201, 235, 79, 184, 239, 77, 16, 55, 110, 129, 126, 183, 137, - 190, 38, 209, 5, 116, 114, 255, 103, 108, 155, 151, 244, 167, 181, 119, - 85, 182, 138, 40, 164, 37, 247, 255, 135, 251, 230, 129, 62, 247, 128, - 174, 247, 9, 125, 139, 163, 222, 210, 75, 219, 160, 122, 93, 17, 93, - 241, 247, 97, 37, 93, 26, 254, 145, 254, 231, 214, 94, 220, 247, 17, - 176, 213, 99, 240, 247, 148, 248, 70, 197, 81, 95, 232, 216, 103, 137, - 108, 155, 239, 116, 241, 240, 4, 182, 111, 49, 189, 228, 250, 42, 220, - 183, 0, 244, 121, 1, 254, 94, 129, 111, 140, 250, 254, 136, 42, 165, - 15, 245, 194, 181, 68, 102, 217, 213, 88, 21, 45, 53, 98, 2, 61, - 23, 224, 190, 111, 64, 159, 119, 224, 175, 136, 232, 251, 91, 110, 204, - 220, 190, 182, 136, 109, 99, 202, 220, 14, 88, 204, 126, 223, 138, 204, - 237, 205, 92, 125, 242, 35, 232, 243, 25, 252, 125, 39, 250, 254, 138, - 170, 204, 84, 183, 64, 109, 170, 49, 237, 130, 150, 176, 223, 168, 58, - 211, 231, 52, 215, 183, 20, 246, 49, 178, 17, 85, 48, 34, 251, 214, - 100, 184, 26, 176, 5, 166, 51, 62, 213, 101, 200, 218, 112, 21, 208, - 167, 58, 248, 171, 69, 244, 69, 184, 132, 177, 10, 225, 18, 238, 41, - 135, 177, 7, 225, 18, 209, 238, 0, 151, 220, 115, 205, 184, 84, 0, - 92, 238, 23, 87, 192, 184, 244, 15, 59, 164, 108, 63, 28, 224, 50, - 248, 57, 63, 46, 107, 90, 196, 209, 59, 119, 55, 196, 184, 68, 99, - 94, 21, 128, 203, 106, 11, 248, 113, 249, 11, 224, 242, 249, 200, 61, - 24, 151, 155, 163, 50, 48, 46, 7, 239, 190, 160, 1, 151, 132, 175, - 1, 92, 86, 140, 191, 135, 113, 105, 122, 237, 165, 138, 6, 184, 156, - 255, 250, 61, 129, 75, 91, 128, 203, 14, 0, 151, 36, 62, 174, 209, - 183, 107, 124, 199, 184, 28, 94, 90, 202, 126, 243, 155, 116, 208, 23, - 35, 222, 154, 170, 81, 116, 46, 61, 98, 141, 169, 27, 194, 229, 233, - 87, 98, 37, 109, 10, 112, 105, 79, 85, 117, 227, 112, 105, 7, 112, - 105, 7, 112, 105, 79, 248, 248, 3, 186, 210, 236, 218, 110, 8, 151, - 191, 247, 212, 84, 210, 205, 33, 46, 243, 107, 184, 113, 184, 180, 7, - 184, 180, 7, 184, 228, 250, 26, 3, 92, 230, 47, 68, 181, 220, 151, - 116, 71, 107, 213, 251, 255, 12, 47, 164, 79, 185, 189, 34, 112, 105, - 7, 112, 217, 1, 224, 146, 211, 183, 0, 224, 114, 158, 243, 45, 140, - 75, 207, 190, 215, 84, 247, 173, 3, 92, 46, 30, 121, 158, 192, 165, - 45, 192, 165, 45, 192, 165, 45, 97, 171, 47, 116, 103, 219, 203, 24, - 151, 157, 141, 174, 178, 62, 94, 76, 59, 222, 186, 70, 224, 210, 22, - 224, 210, 22, 224, 146, 236, 91, 74, 111, 250, 245, 31, 198, 229, 158, - 41, 42, 218, 24, 224, 50, 227, 225, 77, 2, 151, 182, 0, 151, 182, - 0, 151, 92, 95, 209, 41, 99, 198, 102, 197, 85, 140, 203, 71, 54, - 23, 216, 56, 84, 145, 233, 52, 41, 147, 192, 165, 45, 192, 165, 45, - 192, 37, 17, 179, 1, 46, 99, 20, 123, 48, 46, 59, 157, 221, 166, - 170, 123, 135, 87, 103, 138, 119, 175, 35, 112, 9, 124, 209, 168, 29, - 192, 101, 59, 53, 92, 114, 235, 18, 22, 152, 134, 184, 36, 215, 43, - 248, 112, 9, 199, 119, 132, 203, 165, 0, 151, 112, 188, 70, 184, 68, - 244, 82, 128, 75, 238, 185, 102, 92, 54, 255, 171, 132, 170, 215, 245, - 50, 198, 229, 95, 45, 95, 43, 219, 223, 190, 231, 75, 47, 121, 215, - 196, 149, 195, 101, 11, 22, 151, 109, 112, 223, 39, 117, 226, 232, 85, - 247, 141, 240, 30, 127, 148, 59, 206, 5, 184, 52, 63, 26, 197, 187, - 230, 80, 223, 244, 16, 221, 244, 244, 90, 55, 132, 75, 171, 129, 59, - 149, 116, 5, 128, 203, 224, 251, 169, 110, 28, 46, 93, 1, 46, 41, - 128, 75, 6, 247, 189, 15, 112, 121, 211, 237, 172, 27, 194, 165, 115, - 227, 155, 74, 250, 109, 248, 101, 122, 169, 217, 93, 55, 14, 151, 61, - 1, 46, 61, 0, 46, 123, 115, 249, 1, 192, 101, 106, 245, 199, 110, - 8, 151, 119, 255, 123, 174, 164, 63, 134, 223, 164, 183, 110, 252, 127, - 180, 93, 7, 124, 84, 197, 243, 191, 132, 64, 32, 8, 4, 136, 244, - 18, 58, 136, 98, 128, 159, 10, 36, 228, 238, 61, 154, 74, 11, 130, - 34, 61, 180, 208, 67, 232, 45, 229, 146, 208, 107, 64, 20, 148, 22, - 21, 165, 9, 134, 38, 144, 220, 133, 208, 164, 67, 168, 210, 57, 122, - 145, 18, 122, 11, 240, 159, 121, 239, 109, 185, 112, 217, 119, 126, 242, - 254, 124, 62, 249, 56, 159, 231, 238, 204, 219, 185, 249, 206, 236, 206, - 238, 188, 189, 35, 196, 101, 105, 192, 229, 183, 7, 31, 80, 92, 30, - 186, 249, 76, 161, 75, 3, 46, 247, 121, 189, 225, 112, 217, 28, 112, - 217, 18, 112, 217, 138, 246, 221, 5, 184, 76, 168, 154, 135, 220, 143, - 45, 85, 88, 165, 214, 49, 196, 199, 92, 150, 238, 215, 202, 101, 102, - 184, 12, 1, 92, 134, 0, 46, 91, 211, 190, 53, 1, 151, 141, 234, - 63, 160, 184, 204, 29, 173, 126, 215, 227, 15, 192, 229, 252, 29, 255, - 4, 51, 92, 182, 0, 92, 126, 9, 184, 252, 156, 221, 177, 110, 189, - 43, 21, 106, 188, 43, 152, 224, 178, 241, 208, 52, 133, 182, 3, 46, - 135, 254, 154, 18, 204, 112, 217, 4, 112, 217, 24, 112, 217, 136, 225, - 35, 238, 137, 212, 33, 104, 123, 48, 193, 101, 239, 3, 42, 159, 2, - 128, 203, 241, 157, 247, 6, 51, 92, 54, 1, 92, 54, 1, 92, 54, - 101, 191, 17, 224, 178, 233, 230, 35, 193, 52, 94, 102, 166, 43, 116, - 77, 192, 229, 54, 75, 122, 48, 195, 101, 51, 192, 101, 51, 192, 101, - 51, 218, 183, 24, 224, 242, 233, 235, 191, 131, 9, 46, 125, 235, 170, - 239, 92, 18, 112, 185, 111, 193, 186, 96, 134, 203, 38, 128, 203, 198, - 128, 75, 102, 27, 187, 1, 151, 233, 161, 139, 130, 9, 46, 127, 25, - 48, 91, 161, 247, 2, 46, 167, 143, 158, 16, 204, 112, 105, 6, 92, - 54, 4, 92, 6, 178, 239, 186, 0, 46, 217, 94, 153, 31, 165, 237, - 128, 75, 126, 15, 205, 199, 163, 62, 224, 178, 62, 224, 178, 254, 59, - 184, 196, 57, 49, 63, 143, 197, 57, 46, 193, 37, 161, 45, 128, 75, - 246, 156, 224, 114, 20, 224, 114, 20, 229, 183, 19, 226, 101, 155, 8, - 43, 173, 59, 105, 168, 181, 175, 15, 241, 242, 84, 105, 214, 183, 45, - 244, 233, 3, 127, 227, 184, 190, 149, 32, 94, 14, 92, 16, 77, 235, - 78, 200, 26, 172, 4, 224, 114, 72, 248, 72, 225, 62, 88, 65, 192, - 101, 222, 46, 195, 204, 4, 151, 221, 102, 170, 223, 112, 43, 10, 184, - 252, 117, 235, 32, 51, 195, 229, 48, 192, 229, 80, 192, 229, 16, 118, - 199, 161, 215, 14, 41, 224, 167, 126, 102, 130, 203, 83, 1, 97, 234, - 62, 24, 196, 203, 234, 145, 189, 204, 12, 151, 17, 128, 203, 193, 128, - 203, 112, 46, 110, 29, 148, 126, 49, 247, 48, 19, 92, 46, 248, 41, - 84, 165, 33, 94, 206, 123, 34, 254, 254, 75, 65, 192, 101, 158, 176, - 46, 102, 130, 203, 50, 195, 58, 153, 213, 185, 232, 25, 169, 180, 181, - 131, 153, 225, 114, 16, 224, 114, 0, 224, 114, 0, 231, 15, 206, 75, - 15, 210, 218, 81, 92, 90, 215, 124, 173, 208, 11, 33, 94, 154, 23, - 126, 195, 225, 178, 31, 224, 178, 63, 224, 178, 63, 237, 123, 55, 246, - 154, 52, 127, 21, 145, 123, 83, 10, 234, 208, 221, 172, 218, 218, 109, - 105, 88, 158, 222, 102, 134, 203, 129, 128, 203, 65, 128, 203, 193, 180, - 239, 50, 136, 151, 177, 3, 136, 174, 50, 164, 33, 182, 254, 10, 253, - 47, 224, 178, 90, 129, 129, 102, 134, 203, 8, 192, 101, 4, 224, 114, - 136, 83, 188, 188, 185, 186, 191, 153, 224, 114, 203, 19, 149, 143, 23, - 224, 114, 74, 195, 126, 102, 134, 203, 8, 192, 101, 4, 224, 50, 130, - 179, 241, 215, 210, 132, 222, 125, 72, 27, 57, 102, 158, 74, 231, 3, - 92, 142, 221, 75, 159, 3, 46, 7, 3, 46, 7, 3, 46, 217, 59, - 123, 0, 46, 123, 60, 35, 252, 189, 228, 167, 29, 6, 152, 201, 60, - 182, 98, 121, 118, 62, 236, 33, 200, 123, 12, 239, 251, 156, 123, 231, - 199, 128, 203, 224, 252, 100, 127, 245, 61, 185, 146, 143, 250, 205, 192, - 23, 128, 203, 23, 121, 153, 77, 190, 6, 187, 242, 240, 24, 6, 184, - 28, 206, 141, 183, 176, 204, 246, 111, 253, 40, 189, 5, 112, 201, 239, - 235, 250, 120, 140, 0, 92, 142, 0, 92, 142, 120, 247, 140, 122, 97, - 174, 30, 182, 6, 172, 91, 123, 232, 229, 20, 234, 177, 243, 211, 208, - 55, 180, 166, 126, 78, 1, 219, 209, 179, 221, 190, 92, 13, 249, 7, - 198, 229, 174, 145, 47, 187, 63, 5, 198, 84, 88, 203, 95, 125, 96, - 92, 238, 26, 249, 178, 251, 83, 6, 122, 147, 177, 248, 126, 96, 92, - 238, 58, 180, 102, 150, 26, 242, 154, 90, 14, 190, 134, 113, 185, 107, - 212, 187, 145, 251, 61, 214, 15, 140, 221, 239, 241, 253, 192, 216, 253, - 30, 212, 157, 145, 251, 61, 136, 19, 250, 125, 159, 202, 96, 7, 133, - 245, 48, 83, 159, 213, 182, 85, 31, 232, 237, 95, 77, 31, 51, 216, - 142, 214, 15, 86, 231, 190, 239, 83, 213, 56, 204, 248, 115, 50, 18, - 225, 157, 18, 53, 57, 150, 170, 198, 97, 6, 249, 210, 113, 0, 77, - 198, 146, 94, 197, 56, 204, 248, 87, 203, 82, 63, 88, 77, 203, 195, - 85, 49, 14, 51, 168, 119, 35, 247, 123, 44, 85, 141, 221, 239, 65, - 125, 26, 185, 223, 19, 90, 197, 216, 253, 30, 196, 9, 189, 63, 197, - 31, 236, 160, 134, 14, 102, 106, 7, 112, 119, 123, 12, 244, 118, 84, - 212, 199, 12, 182, 99, 247, 142, 48, 254, 17, 21, 141, 195, 12, 242, - 165, 49, 0, 104, 148, 169, 52, 170, 104, 28, 102, 66, 57, 25, 56, - 110, 50, 150, 132, 10, 198, 97, 6, 249, 58, 125, 223, 71, 147, 225, - 95, 193, 56, 204, 160, 222, 141, 140, 51, 166, 138, 198, 198, 25, 212, - 167, 145, 113, 198, 191, 130, 177, 113, 6, 113, 66, 207, 48, 135, 12, - 242, 118, 84, 214, 195, 12, 59, 195, 156, 224, 24, 232, 29, 146, 161, - 143, 25, 108, 71, 237, 57, 129, 251, 237, 143, 24, 135, 25, 228, 75, - 107, 161, 224, 157, 80, 166, 242, 142, 233, 198, 97, 6, 249, 210, 253, - 30, 160, 201, 88, 2, 252, 251, 27, 134, 153, 144, 140, 44, 181, 80, - 25, 154, 140, 128, 1, 198, 157, 95, 59, 98, 108, 156, 65, 29, 27, - 122, 174, 192, 191, 191, 161, 113, 6, 117, 103, 100, 156, 65, 156, 208, - 250, 193, 208, 65, 222, 136, 33, 49, 102, 216, 153, 79, 135, 47, 244, - 173, 61, 72, 23, 51, 216, 142, 98, 6, 104, 194, 63, 49, 96, 144, - 113, 152, 225, 100, 36, 192, 59, 57, 52, 57, 1, 2, 25, 255, 21, - 51, 200, 151, 214, 245, 2, 77, 198, 146, 216, 125, 144, 97, 152, 241, - 229, 100, 152, 52, 153, 202, 56, 68, 50, 254, 35, 102, 80, 239, 70, - 198, 153, 128, 44, 252, 114, 26, 103, 80, 159, 70, 198, 153, 128, 44, - 252, 114, 26, 103, 16, 39, 52, 206, 56, 6, 121, 35, 134, 178, 193, - 12, 86, 152, 105, 60, 180, 12, 28, 244, 245, 175, 224, 10, 51, 30, - 78, 152, 193, 118, 116, 29, 80, 145, 241, 15, 77, 207, 222, 14, 138, - 172, 241, 72, 253, 37, 181, 68, 144, 168, 86, 230, 80, 241, 105, 236, - 123, 40, 21, 153, 140, 68, 120, 39, 148, 169, 52, 250, 51, 123, 25, - 173, 242, 122, 167, 174, 184, 149, 55, 72, 84, 43, 243, 221, 39, 83, - 217, 119, 17, 43, 112, 227, 0, 154, 140, 197, 177, 58, 123, 25, 123, - 90, 28, 176, 45, 73, 206, 45, 172, 149, 185, 115, 129, 157, 197, 241, - 175, 224, 140, 25, 148, 169, 156, 201, 249, 35, 123, 25, 151, 190, 250, - 218, 252, 112, 136, 184, 86, 102, 253, 94, 86, 43, 131, 122, 231, 235, - 3, 80, 143, 132, 31, 161, 177, 86, 134, 61, 199, 188, 104, 5, 211, - 50, 83, 121, 211, 42, 248, 227, 107, 101, 186, 70, 38, 211, 239, 158, - 147, 246, 88, 43, 243, 120, 112, 140, 93, 175, 78, 100, 239, 159, 1, - 118, 82, 31, 240, 126, 241, 220, 118, 82, 31, 96, 46, 144, 110, 211, - 171, 15, 40, 63, 32, 214, 70, 234, 3, 8, 141, 245, 1, 236, 185, - 184, 70, 2, 237, 130, 215, 1, 254, 206, 68, 7, 132, 198, 90, 25, - 246, 220, 181, 14, 176, 86, 102, 119, 237, 109, 84, 7, 164, 61, 214, - 202, 76, 206, 51, 86, 87, 7, 63, 252, 94, 158, 234, 160, 230, 135, - 39, 109, 68, 7, 1, 197, 18, 116, 117, 240, 219, 163, 21, 41, 68, - 7, 132, 198, 58, 17, 246, 92, 172, 3, 180, 91, 190, 86, 6, 237, - 144, 232, 128, 208, 88, 43, 195, 158, 163, 14, 106, 129, 14, 62, 5, - 29, 124, 230, 84, 43, 19, 211, 132, 213, 202, 144, 246, 88, 43, 83, - 113, 163, 126, 173, 76, 151, 30, 172, 86, 230, 207, 243, 172, 86, 38, - 178, 142, 126, 173, 204, 237, 174, 9, 180, 86, 134, 208, 168, 3, 246, - 92, 172, 3, 196, 21, 111, 7, 136, 19, 162, 3, 66, 99, 173, 12, - 123, 142, 58, 24, 12, 58, 24, 4, 58, 24, 228, 84, 43, 147, 121, - 150, 213, 202, 144, 246, 88, 43, 19, 255, 92, 191, 86, 102, 247, 48, - 86, 43, 83, 234, 33, 171, 149, 201, 204, 208, 175, 149, 185, 241, 148, - 213, 202, 16, 26, 177, 192, 158, 235, 204, 155, 28, 44, 6, 88, 151, - 15, 242, 78, 10, 21, 198, 0, 167, 122, 73, 11, 232, 47, 109, 165, - 126, 12, 192, 118, 244, 172, 228, 42, 198, 63, 100, 165, 187, 49, 192, - 245, 92, 0, 241, 78, 207, 74, 174, 98, 50, 44, 64, 91, 52, 159, - 233, 88, 225, 110, 12, 112, 45, 3, 241, 68, 199, 193, 201, 192, 113, - 147, 177, 68, 172, 112, 55, 6, 184, 150, 129, 246, 74, 199, 177, 210, - 57, 6, 88, 136, 190, 86, 184, 27, 3, 92, 203, 64, 123, 160, 231, - 254, 87, 14, 114, 170, 29, 97, 126, 211, 106, 38, 52, 214, 142, 136, - 252, 169, 211, 185, 255, 21, 206, 252, 152, 15, 178, 154, 9, 141, 181, - 45, 34, 223, 228, 116, 238, 63, 11, 63, 134, 103, 171, 153, 208, 200, - 79, 132, 115, 167, 252, 65, 22, 126, 12, 27, 86, 51, 161, 113, 188, - 34, 204, 56, 157, 251, 95, 206, 48, 99, 89, 10, 243, 38, 135, 30, - 102, 216, 90, 195, 4, 125, 173, 191, 235, 99, 6, 219, 209, 179, 146, - 203, 24, 127, 223, 223, 141, 195, 12, 242, 165, 182, 134, 50, 150, 107, - 235, 128, 223, 140, 195, 140, 137, 147, 129, 227, 38, 99, 9, 248, 205, - 56, 204, 32, 95, 167, 115, 255, 154, 140, 180, 165, 198, 97, 6, 245, - 206, 207, 189, 93, 97, 6, 231, 222, 238, 98, 6, 117, 204, 243, 115, - 133, 25, 92, 107, 184, 139, 153, 128, 44, 252, 92, 97, 6, 215, 26, - 238, 98, 6, 117, 199, 243, 115, 133, 25, 28, 175, 187, 152, 65, 156, - 208, 60, 240, 86, 176, 131, 229, 122, 152, 97, 245, 101, 105, 191, 130, - 63, 255, 69, 31, 51, 216, 142, 198, 128, 95, 25, 255, 244, 159, 141, - 195, 140, 133, 147, 145, 6, 239, 148, 166, 201, 9, 253, 217, 56, 204, - 32, 95, 58, 14, 160, 201, 88, 50, 18, 141, 195, 140, 229, 23, 103, - 204, 160, 76, 133, 91, 162, 113, 152, 65, 189, 231, 20, 51, 78, 123, - 19, 63, 231, 28, 51, 60, 63, 212, 103, 78, 49, 195, 243, 179, 38, - 230, 28, 51, 252, 220, 12, 113, 66, 239, 70, 72, 1, 59, 88, 170, - 135, 25, 86, 95, 230, 15, 125, 19, 237, 250, 152, 193, 118, 116, 237, - 156, 202, 248, 7, 216, 115, 134, 25, 126, 125, 142, 124, 233, 218, 25, - 104, 148, 169, 216, 156, 45, 103, 152, 225, 215, 231, 254, 156, 12, 28, - 55, 25, 75, 136, 45, 103, 152, 225, 215, 231, 200, 215, 233, 94, 50, - 77, 134, 35, 37, 103, 152, 33, 235, 243, 32, 77, 239, 196, 134, 38, - 119, 243, 78, 219, 62, 188, 194, 59, 235, 115, 172, 149, 105, 184, 243, - 135, 108, 215, 166, 78, 126, 220, 198, 248, 125, 11, 252, 62, 242, 40, - 243, 206, 90, 55, 3, 248, 117, 176, 184, 199, 47, 132, 227, 103, 105, - 237, 157, 22, 254, 236, 117, 195, 172, 235, 70, 203, 238, 195, 102, 255, - 188, 113, 217, 174, 27, 157, 230, 142, 41, 140, 95, 72, 87, 239, 180, - 203, 221, 99, 222, 89, 131, 165, 111, 59, 108, 62, 210, 120, 100, 182, - 107, 48, 62, 206, 32, 78, 40, 102, 214, 130, 29, 108, 213, 195, 12, - 171, 47, 115, 36, 15, 242, 14, 221, 162, 143, 25, 108, 71, 243, 192, - 201, 92, 30, 120, 163, 187, 152, 113, 93, 255, 241, 119, 80, 179, 100, - 154, 7, 230, 100, 56, 224, 157, 28, 154, 28, 199, 90, 119, 49, 227, - 90, 198, 163, 238, 54, 42, 3, 249, 210, 113, 0, 77, 198, 146, 246, - 183, 187, 152, 113, 45, 35, 239, 252, 43, 108, 79, 115, 139, 51, 102, - 80, 166, 66, 236, 112, 23, 51, 174, 101, 124, 205, 213, 202, 160, 222, - 249, 51, 134, 168, 71, 194, 143, 208, 88, 43, 195, 158, 147, 51, 134, - 149, 77, 129, 240, 199, 215, 202, 172, 182, 149, 160, 223, 121, 95, 115, - 89, 109, 143, 181, 50, 47, 182, 212, 182, 57, 159, 201, 175, 108, 26, - 103, 170, 196, 214, 226, 69, 103, 73, 213, 143, 126, 76, 191, 243, 78, - 176, 154, 59, 243, 15, 169, 103, 187, 239, 133, 121, 36, 172, 149, 169, - 223, 151, 124, 139, 105, 179, 244, 195, 185, 53, 118, 114, 38, 255, 73, - 72, 178, 157, 157, 49, 44, 103, 218, 0, 127, 155, 77, 101, 157, 106, - 101, 50, 143, 236, 177, 147, 51, 134, 126, 187, 142, 217, 213, 51, 104, - 251, 164, 69, 193, 167, 237, 236, 140, 97, 89, 211, 54, 83, 25, 211, - 46, 248, 227, 107, 101, 166, 246, 184, 104, 39, 103, 12, 115, 127, 117, - 213, 78, 206, 228, 199, 72, 183, 132, 249, 43, 172, 149, 169, 240, 215, - 61, 59, 57, 99, 184, 250, 224, 35, 187, 122, 70, 253, 140, 20, 120, - 237, 185, 157, 157, 49, 44, 109, 58, 4, 127, 233, 240, 199, 206, 138, - 159, 151, 58, 174, 246, 72, 37, 103, 12, 151, 109, 52, 41, 116, 161, - 232, 203, 146, 99, 220, 91, 59, 59, 99, 88, 218, 116, 28, 254, 78, - 114, 125, 189, 226, 174, 73, 181, 223, 102, 216, 201, 25, 195, 202, 91, - 174, 171, 122, 142, 190, 45, 61, 24, 122, 206, 206, 206, 24, 150, 54, - 157, 129, 177, 158, 227, 198, 107, 138, 187, 43, 141, 26, 113, 200, 78, - 206, 24, 250, 23, 221, 161, 141, 247, 161, 180, 43, 105, 147, 157, 157, - 49, 44, 99, 186, 4, 250, 186, 194, 233, 249, 69, 236, 19, 105, 189, - 99, 185, 157, 156, 49, 60, 127, 101, 177, 93, 173, 5, 120, 41, 125, - 118, 99, 174, 157, 157, 49, 44, 103, 186, 1, 127, 183, 184, 223, 247, - 73, 236, 107, 41, 127, 171, 41, 164, 141, 124, 161, 206, 4, 133, 126, - 27, 236, 33, 239, 46, 30, 107, 103, 103, 12, 203, 155, 238, 193, 95, - 6, 215, 23, 107, 101, 206, 245, 140, 183, 147, 51, 134, 251, 28, 241, - 154, 158, 243, 200, 191, 159, 25, 111, 103, 103, 12, 203, 155, 30, 195, - 223, 115, 174, 47, 214, 202, 124, 92, 101, 146, 157, 156, 49, 236, 222, - 114, 178, 54, 222, 130, 242, 119, 35, 232, 251, 152, 94, 99, 31, 143, - 242, 166, 220, 30, 229, 157, 206, 228, 179, 28, 176, 31, 165, 241, 76, - 62, 159, 27, 246, 129, 62, 5, 225, 175, 8, 215, 151, 224, 18, 125, - 21, 95, 43, 131, 190, 135, 224, 146, 208, 205, 0, 151, 236, 185, 107, - 92, 94, 6, 92, 46, 190, 146, 151, 226, 50, 79, 17, 187, 210, 190, - 61, 224, 50, 111, 141, 122, 66, 92, 230, 242, 155, 37, 53, 235, 254, - 1, 197, 37, 137, 121, 222, 128, 203, 122, 233, 115, 133, 184, 196, 90, - 153, 74, 35, 151, 82, 92, 38, 167, 39, 81, 92, 182, 173, 105, 23, - 226, 242, 21, 224, 50, 96, 197, 1, 138, 203, 138, 205, 78, 81, 92, - 22, 47, 118, 65, 136, 75, 172, 149, 249, 96, 243, 85, 138, 203, 181, - 241, 183, 40, 46, 63, 105, 125, 79, 136, 75, 172, 149, 241, 254, 224, - 33, 197, 229, 228, 143, 158, 107, 248, 56, 35, 149, 168, 253, 70, 136, - 75, 172, 149, 169, 153, 199, 155, 226, 114, 246, 184, 220, 10, 93, 22, - 112, 121, 43, 35, 87, 42, 195, 101, 41, 192, 101, 41, 192, 101, 41, - 167, 90, 153, 221, 205, 31, 80, 92, 118, 254, 253, 138, 66, 103, 70, - 221, 150, 94, 153, 78, 10, 113, 121, 59, 246, 174, 148, 252, 114, 59, - 197, 229, 254, 7, 41, 234, 125, 54, 81, 15, 165, 218, 183, 54, 112, - 184, 44, 251, 14, 46, 241, 236, 239, 212, 94, 127, 81, 92, 166, 123, - 108, 210, 240, 241, 82, 42, 182, 100, 19, 135, 203, 178, 128, 203, 178, - 128, 203, 178, 156, 141, 191, 150, 102, 21, 182, 81, 92, 134, 15, 85, - 229, 98, 173, 76, 203, 99, 201, 28, 46, 203, 2, 46, 203, 2, 46, - 203, 58, 213, 202, 36, 236, 221, 72, 113, 25, 90, 108, 29, 197, 101, - 230, 159, 43, 57, 92, 150, 5, 92, 150, 3, 92, 150, 227, 222, 57, - 159, 188, 172, 227, 18, 138, 203, 42, 199, 231, 83, 92, 46, 111, 57, - 135, 195, 37, 244, 241, 40, 247, 14, 46, 217, 190, 132, 31, 165, 17, - 151, 252, 126, 133, 8, 151, 24, 223, 9, 46, 167, 0, 46, 49, 94, - 19, 92, 18, 26, 107, 101, 216, 115, 196, 101, 21, 192, 101, 21, 192, - 101, 21, 202, 175, 114, 155, 76, 203, 121, 243, 1, 90, 43, 243, 79, - 244, 85, 165, 253, 137, 51, 221, 165, 132, 207, 249, 90, 153, 138, 128, - 203, 42, 128, 203, 106, 180, 239, 137, 247, 103, 73, 31, 205, 243, 164, - 181, 50, 100, 238, 56, 10, 112, 153, 184, 42, 86, 184, 231, 80, 214, - 107, 189, 180, 104, 0, 171, 149, 105, 115, 243, 23, 133, 206, 11, 184, - 28, 218, 155, 175, 149, 105, 0, 184, 12, 2, 92, 6, 211, 190, 167, - 1, 151, 126, 119, 118, 208, 90, 153, 181, 41, 106, 77, 198, 157, 168, - 125, 82, 145, 95, 79, 113, 181, 50, 18, 224, 178, 17, 224, 178, 137, - 83, 173, 204, 184, 241, 14, 90, 43, 115, 225, 83, 181, 86, 230, 81, - 212, 81, 233, 202, 205, 127, 133, 123, 29, 101, 1, 151, 183, 61, 88, - 173, 204, 197, 210, 106, 173, 76, 25, 192, 101, 183, 79, 95, 115, 181, - 50, 205, 0, 151, 95, 0, 46, 191, 164, 125, 83, 0, 151, 211, 55, - 229, 166, 103, 242, 147, 6, 168, 181, 50, 93, 98, 46, 75, 114, 121, - 190, 86, 166, 5, 224, 178, 57, 224, 178, 57, 237, 91, 3, 112, 249, - 83, 249, 135, 180, 86, 102, 191, 183, 250, 206, 155, 1, 151, 115, 50, - 78, 115, 181, 50, 159, 3, 46, 155, 2, 46, 27, 211, 190, 151, 172, - 119, 37, 105, 206, 30, 90, 43, 19, 24, 177, 67, 171, 179, 121, 40, - 213, 106, 147, 202, 213, 202, 200, 128, 75, 9, 112, 105, 225, 206, 213, - 63, 145, 66, 95, 176, 90, 153, 47, 122, 176, 90, 153, 122, 251, 119, - 115, 181, 50, 18, 224, 82, 2, 92, 202, 220, 217, 248, 215, 82, 174, - 101, 135, 104, 173, 204, 253, 250, 7, 21, 186, 22, 224, 114, 245, 129, - 253, 92, 173, 76, 35, 192, 165, 12, 184, 100, 125, 125, 1, 151, 159, - 214, 218, 78, 107, 101, 30, 199, 171, 53, 61, 62, 128, 203, 239, 107, - 173, 225, 106, 101, 36, 192, 165, 5, 112, 201, 108, 227, 32, 224, 114, - 215, 177, 159, 104, 173, 76, 133, 181, 179, 20, 250, 72, 84, 65, 185, - 110, 194, 120, 174, 86, 38, 16, 112, 89, 31, 112, 89, 143, 155, 31, - 20, 150, 217, 94, 153, 31, 165, 177, 86, 134, 223, 67, 243, 241, 248, - 20, 112, 249, 41, 224, 242, 211, 119, 112, 137, 115, 98, 126, 30, 251, - 53, 87, 43, 243, 53, 87, 43, 243, 245, 59, 181, 50, 17, 240, 70, - 17, 78, 181, 50, 23, 135, 176, 90, 153, 175, 180, 246, 245, 32, 94, - 94, 47, 193, 215, 202, 68, 0, 46, 35, 0, 151, 172, 111, 5, 136, - 151, 249, 35, 89, 173, 12, 89, 131, 21, 7, 92, 30, 28, 58, 82, - 184, 15, 134, 181, 50, 3, 70, 178, 90, 153, 65, 235, 88, 173, 76, - 151, 123, 124, 173, 204, 64, 192, 229, 0, 192, 37, 171, 59, 201, 229, - 181, 67, 170, 114, 136, 213, 202, 180, 30, 198, 106, 101, 46, 237, 226, - 107, 101, 250, 1, 46, 251, 2, 46, 251, 56, 213, 202, 108, 152, 199, - 106, 101, 124, 94, 135, 154, 73, 188, 236, 217, 163, 155, 48, 215, 82, - 8, 112, 185, 227, 18, 171, 149, 185, 244, 136, 213, 202, 220, 200, 221, - 145, 171, 149, 9, 3, 92, 246, 6, 92, 246, 102, 53, 188, 128, 203, - 99, 109, 191, 166, 184, 236, 92, 65, 173, 143, 153, 6, 241, 210, 251, - 62, 95, 43, 211, 19, 112, 217, 19, 112, 217, 139, 246, 125, 24, 123, - 77, 234, 62, 159, 213, 202, 180, 46, 174, 214, 202, 28, 1, 92, 222, - 252, 190, 23, 87, 43, 19, 6, 184, 236, 3, 184, 236, 75, 251, 174, - 133, 120, 57, 125, 87, 95, 90, 43, 243, 97, 45, 181, 246, 229, 38, - 224, 114, 206, 15, 3, 184, 90, 153, 126, 128, 203, 126, 128, 75, 86, - 163, 243, 10, 112, 233, 253, 39, 171, 149, 217, 33, 247, 167, 181, 50, - 214, 147, 124, 173, 76, 127, 192, 101, 63, 192, 101, 63, 167, 120, 121, - 173, 127, 95, 90, 43, 211, 120, 103, 95, 90, 43, 243, 91, 217, 126, - 92, 173, 76, 63, 192, 101, 63, 192, 101, 63, 167, 120, 57, 243, 139, - 1, 180, 86, 230, 220, 124, 181, 166, 231, 109, 84, 30, 121, 212, 103, - 131, 185, 90, 153, 254, 128, 203, 254, 128, 75, 102, 27, 79, 1, 151, - 211, 231, 177, 90, 153, 171, 221, 212, 90, 153, 87, 128, 203, 218, 213, - 249, 90, 153, 129, 128, 203, 129, 128, 203, 65, 78, 241, 146, 237, 223, - 250, 81, 26, 107, 101, 248, 125, 93, 31, 232, 83, 16, 254, 138, 112, - 125, 105, 78, 97, 45, 151, 187, 158, 5, 235, 228, 20, 189, 156, 194, - 103, 108, 189, 155, 4, 109, 183, 187, 145, 83, 72, 226, 214, 226, 73, - 140, 127, 194, 54, 227, 114, 215, 161, 156, 12, 43, 188, 147, 67, 147, - 227, 191, 205, 184, 220, 53, 242, 165, 235, 125, 160, 201, 88, 146, 210, - 140, 203, 93, 155, 182, 59, 231, 20, 80, 166, 226, 27, 211, 140, 203, - 93, 163, 222, 141, 220, 239, 241, 223, 102, 236, 126, 15, 234, 211, 200, - 253, 30, 75, 154, 177, 251, 61, 136, 19, 154, 135, 155, 6, 118, 176, - 86, 15, 51, 172, 190, 204, 31, 250, 38, 206, 112, 35, 119, 61, 139, - 203, 249, 206, 228, 114, 215, 51, 140, 195, 12, 242, 165, 185, 107, 160, - 81, 166, 146, 35, 155, 110, 28, 102, 252, 57, 25, 56, 110, 50, 150, - 144, 233, 198, 97, 6, 249, 58, 229, 174, 53, 25, 142, 105, 198, 97, - 6, 245, 110, 228, 126, 15, 234, 216, 200, 253, 158, 144, 233, 198, 238, - 247, 160, 238, 140, 220, 239, 65, 156, 208, 154, 204, 73, 96, 7, 179, - 244, 48, 195, 234, 203, 28, 83, 1, 99, 83, 220, 136, 51, 83, 185, - 56, 51, 149, 241, 207, 152, 108, 96, 156, 225, 100, 56, 224, 157, 28, - 154, 28, 235, 100, 227, 48, 131, 124, 233, 56, 128, 38, 99, 241, 157, - 108, 28, 102, 66, 167, 100, 201, 93, 79, 209, 206, 71, 76, 50, 14, - 51, 168, 119, 35, 227, 140, 117, 178, 177, 113, 198, 119, 178, 177, 113, - 6, 117, 103, 100, 156, 65, 156, 208, 154, 204, 56, 176, 131, 105, 58, - 152, 225, 234, 203, 18, 39, 130, 63, 159, 160, 143, 25, 108, 71, 99, - 192, 68, 198, 63, 105, 188, 113, 152, 241, 231, 100, 36, 194, 59, 37, - 106, 114, 44, 227, 141, 195, 12, 242, 165, 227, 0, 154, 140, 37, 61, - 222, 56, 204, 248, 79, 200, 114, 134, 121, 130, 118, 62, 34, 222, 56, - 204, 160, 222, 141, 140, 51, 150, 241, 198, 198, 25, 212, 167, 145, 113, - 38, 52, 222, 216, 56, 131, 56, 33, 152, 9, 240, 7, 59, 152, 164, - 135, 25, 118, 230, 51, 20, 250, 58, 172, 250, 152, 193, 118, 52, 6, - 196, 50, 254, 17, 86, 227, 48, 131, 124, 105, 12, 0, 26, 101, 42, - 243, 191, 196, 1, 134, 97, 38, 148, 147, 129, 227, 38, 99, 9, 240, - 31, 104, 24, 102, 144, 175, 83, 77, 166, 38, 35, 201, 223, 56, 204, - 160, 222, 141, 140, 51, 168, 99, 67, 207, 175, 249, 15, 52, 52, 206, - 160, 238, 140, 140, 51, 136, 19, 186, 158, 169, 28, 238, 237, 136, 115, - 129, 153, 190, 35, 6, 245, 30, 58, 98, 88, 173, 129, 189, 77, 195, - 121, 31, 248, 113, 184, 183, 127, 173, 112, 253, 218, 127, 104, 71, 253, - 51, 208, 244, 252, 90, 205, 240, 108, 237, 160, 88, 197, 49, 54, 143, - 37, 203, 27, 168, 152, 201, 231, 210, 14, 106, 118, 169, 193, 226, 12, - 39, 35, 17, 222, 41, 81, 147, 99, 173, 145, 189, 140, 69, 99, 110, - 216, 74, 12, 159, 159, 172, 98, 198, 181, 140, 95, 254, 153, 195, 214, - 76, 181, 184, 113, 0, 77, 198, 18, 80, 45, 123, 25, 11, 23, 22, - 218, 186, 219, 119, 191, 77, 197, 140, 107, 25, 135, 151, 109, 100, 231, - 125, 56, 25, 38, 77, 166, 50, 71, 171, 156, 189, 140, 55, 199, 218, - 154, 175, 79, 34, 152, 113, 45, 227, 199, 251, 209, 10, 102, 202, 120, - 170, 122, 175, 162, 180, 84, 235, 3, 80, 143, 132, 31, 161, 155, 109, - 152, 43, 177, 231, 38, 211, 34, 83, 101, 211, 50, 83, 21, 211, 10, - 110, 159, 228, 81, 171, 250, 242, 157, 61, 205, 108, 164, 62, 128, 180, - 207, 101, 111, 45, 47, 110, 86, 73, 24, 163, 222, 200, 237, 228, 143, - 251, 23, 214, 218, 124, 43, 47, 216, 252, 70, 193, 147, 167, 189, 147, - 124, 114, 225, 25, 97, 60, 122, 45, 135, 202, 163, 82, 227, 180, 54, - 189, 228, 53, 254, 179, 212, 190, 209, 97, 114, 245, 30, 243, 132, 125, - 223, 196, 246, 147, 171, 174, 189, 170, 181, 25, 40, 127, 120, 197, 219, - 166, 230, 84, 195, 229, 157, 131, 202, 138, 223, 57, 118, 136, 188, 165, - 36, 217, 151, 29, 46, 223, 89, 209, 88, 235, 59, 82, 46, 219, 160, - 141, 78, 223, 49, 114, 163, 159, 191, 177, 145, 122, 8, 203, 69, 149, - 246, 140, 182, 202, 13, 58, 181, 215, 233, 27, 47, 103, 206, 104, 162, - 181, 153, 40, 199, 167, 52, 212, 250, 78, 150, 125, 110, 125, 162, 211, - 119, 154, 124, 114, 211, 135, 180, 174, 136, 208, 155, 31, 37, 112, 207, - 179, 143, 211, 104, 47, 136, 33, 222, 94, 16, 19, 196, 94, 8, 221, - 20, 236, 133, 61, 71, 123, 169, 2, 246, 82, 25, 236, 133, 237, 119, - 63, 0, 123, 169, 55, 182, 53, 181, 23, 210, 30, 237, 101, 234, 200, - 5, 186, 246, 210, 192, 103, 19, 181, 151, 139, 197, 213, 253, 57, 180, - 151, 137, 85, 46, 217, 244, 236, 197, 179, 92, 110, 59, 177, 151, 23, - 149, 189, 236, 196, 94, 30, 69, 231, 210, 57, 15, 210, 79, 182, 4, - 220, 178, 17, 123, 73, 40, 245, 143, 166, 251, 112, 217, 225, 181, 75, - 215, 94, 142, 62, 249, 131, 218, 75, 253, 207, 23, 83, 123, 89, 250, - 211, 44, 93, 123, 105, 177, 207, 74, 237, 101, 211, 144, 209, 90, 95, - 171, 252, 162, 102, 152, 174, 189, 228, 13, 137, 164, 246, 146, 80, 49, - 142, 218, 75, 153, 178, 19, 117, 237, 229, 193, 103, 51, 168, 189, 16, - 26, 237, 133, 61, 23, 219, 11, 250, 67, 222, 94, 208, 191, 17, 123, - 33, 244, 195, 245, 115, 37, 246, 28, 237, 165, 20, 216, 75, 57, 176, - 23, 182, 175, 91, 0, 236, 165, 225, 229, 130, 169, 196, 94, 72, 251, - 218, 96, 47, 77, 79, 36, 10, 127, 183, 247, 26, 181, 147, 63, 170, - 217, 192, 78, 236, 229, 120, 201, 117, 202, 187, 191, 181, 117, 146, 219, - 87, 243, 16, 214, 134, 239, 7, 123, 217, 119, 220, 210, 144, 216, 75, - 241, 151, 181, 20, 186, 5, 216, 203, 39, 69, 42, 9, 235, 183, 242, - 197, 245, 147, 107, 248, 5, 5, 18, 123, 217, 212, 113, 161, 34, 55, - 15, 216, 75, 249, 114, 213, 133, 239, 92, 53, 110, 136, 188, 164, 29, - 57, 251, 50, 92, 158, 88, 82, 221, 171, 47, 3, 246, 98, 186, 122, - 95, 216, 119, 30, 216, 75, 219, 147, 213, 82, 137, 189, 212, 111, 80, - 95, 161, 247, 69, 89, 229, 118, 47, 58, 165, 138, 250, 62, 1, 123, - 169, 176, 131, 220, 87, 61, 81, 142, 90, 165, 182, 71, 123, 217, 250, - 93, 143, 84, 49, 62, 166, 201, 175, 242, 69, 164, 18, 123, 33, 52, - 218, 11, 123, 46, 182, 23, 140, 109, 188, 189, 96, 172, 34, 246, 66, - 104, 140, 71, 236, 57, 218, 203, 72, 176, 151, 81, 96, 47, 236, 123, - 120, 143, 193, 94, 58, 85, 142, 166, 245, 106, 164, 189, 39, 216, 139, - 185, 132, 78, 205, 25, 248, 151, 165, 118, 210, 230, 91, 185, 214, 153, - 24, 51, 241, 47, 155, 117, 214, 31, 111, 192, 94, 246, 47, 32, 109, - 122, 201, 125, 126, 214, 250, 130, 189, 84, 254, 77, 167, 47, 248, 151, - 243, 247, 72, 155, 129, 242, 39, 103, 73, 223, 112, 121, 198, 110, 113, - 95, 19, 216, 203, 207, 179, 73, 155, 225, 242, 63, 23, 181, 26, 59, - 176, 151, 247, 106, 69, 139, 199, 11, 246, 242, 180, 123, 36, 173, 207, - 155, 180, 69, 187, 187, 19, 252, 203, 202, 190, 99, 205, 122, 254, 37, - 173, 15, 105, 51, 81, 14, 121, 61, 198, 76, 236, 229, 210, 156, 49, - 102, 61, 255, 242, 89, 250, 104, 90, 219, 71, 104, 180, 23, 246, 92, - 39, 159, 8, 246, 66, 247, 173, 204, 225, 222, 1, 254, 194, 57, 171, - 83, 109, 159, 163, 82, 184, 119, 104, 69, 253, 57, 43, 182, 99, 223, - 197, 97, 115, 175, 140, 10, 238, 206, 89, 93, 175, 93, 48, 230, 178, - 239, 226, 132, 115, 223, 197, 129, 185, 183, 38, 199, 90, 193, 221, 57, - 171, 107, 25, 232, 167, 217, 119, 113, 184, 113, 0, 77, 198, 226, 91, - 193, 221, 57, 171, 107, 25, 136, 109, 58, 142, 138, 206, 115, 86, 148, - 169, 204, 93, 253, 221, 157, 179, 186, 150, 129, 246, 64, 243, 137, 21, - 194, 157, 106, 221, 216, 220, 197, 106, 38, 244, 101, 217, 102, 17, 205, - 105, 156, 242, 137, 89, 248, 177, 216, 102, 53, 19, 26, 249, 137, 98, - 158, 83, 62, 49, 11, 63, 230, 251, 172, 102, 66, 35, 63, 145, 79, - 116, 202, 39, 250, 59, 243, 99, 216, 176, 154, 9, 141, 252, 68, 152, - 113, 218, 183, 50, 51, 204, 164, 7, 130, 29, 112, 235, 9, 215, 152, - 97, 181, 125, 254, 208, 55, 177, 161, 62, 102, 176, 29, 93, 131, 5, - 51, 254, 1, 254, 198, 97, 6, 249, 210, 53, 24, 208, 40, 83, 145, - 209, 208, 56, 204, 248, 115, 50, 112, 220, 100, 44, 105, 65, 198, 97, - 6, 249, 58, 237, 91, 105, 50, 66, 130, 140, 195, 76, 0, 103, 67, - 38, 175, 200, 84, 87, 152, 49, 141, 42, 231, 54, 102, 80, 199, 60, - 63, 87, 152, 65, 126, 238, 98, 6, 245, 73, 249, 121, 70, 166, 186, - 194, 12, 242, 115, 23, 51, 33, 65, 206, 239, 231, 10, 51, 200, 207, - 93, 204, 32, 78, 232, 253, 36, 159, 129, 29, 152, 245, 48, 195, 106, - 251, 66, 160, 111, 122, 125, 125, 204, 96, 59, 250, 45, 169, 6, 140, - 127, 104, 125, 227, 48, 131, 124, 233, 183, 164, 128, 70, 153, 74, 44, - 171, 103, 28, 102, 66, 56, 25, 56, 110, 50, 22, 107, 61, 227, 48, - 131, 124, 121, 204, 132, 104, 50, 124, 235, 25, 135, 25, 212, 123, 78, - 49, 195, 231, 184, 81, 199, 57, 197, 12, 207, 207, 90, 47, 231, 152, - 225, 249, 249, 214, 203, 57, 102, 248, 185, 25, 226, 132, 96, 38, 164, - 46, 216, 65, 160, 30, 102, 88, 109, 159, 47, 244, 77, 248, 68, 31, - 51, 216, 142, 126, 75, 234, 83, 198, 223, 255, 147, 156, 97, 134, 207, - 39, 34, 95, 250, 45, 41, 160, 81, 166, 146, 187, 254, 95, 206, 48, - 195, 231, 19, 125, 57, 25, 56, 110, 50, 22, 203, 255, 114, 134, 25, - 62, 159, 136, 124, 121, 204, 248, 106, 50, 210, 235, 230, 12, 51, 36, - 159, 24, 164, 233, 157, 216, 80, 232, 246, 130, 91, 43, 109, 29, 253, - 78, 62, 209, 226, 88, 102, 254, 59, 178, 100, 182, 249, 68, 167, 28, - 247, 255, 156, 249, 237, 154, 243, 213, 59, 249, 38, 228, 247, 121, 181, - 5, 217, 230, 155, 156, 206, 0, 113, 252, 28, 53, 11, 109, 173, 177, - 173, 96, 106, 214, 124, 68, 250, 237, 101, 230, 184, 203, 137, 217, 230, - 35, 156, 238, 158, 175, 203, 189, 223, 182, 130, 91, 227, 11, 190, 187, - 94, 245, 135, 247, 91, 84, 38, 38, 219, 245, 42, 31, 103, 16, 39, - 116, 110, 22, 0, 118, 240, 153, 30, 102, 88, 109, 95, 122, 29, 240, - 231, 181, 245, 49, 131, 237, 104, 12, 168, 195, 248, 87, 79, 111, 227, - 38, 102, 138, 186, 180, 3, 252, 255, 52, 6, 112, 50, 210, 225, 157, - 210, 53, 57, 213, 3, 58, 187, 137, 25, 215, 50, 240, 255, 211, 113, - 212, 230, 198, 1, 52, 25, 75, 223, 142, 239, 229, 114, 15, 51, 174, - 101, 224, 255, 167, 227, 168, 237, 140, 25, 148, 169, 140, 35, 173, 165, - 155, 152, 113, 45, 99, 231, 191, 234, 190, 213, 112, 47, 85, 239, 85, - 148, 150, 234, 153, 104, 212, 35, 225, 71, 104, 60, 19, 205, 158, 187, - 190, 215, 99, 107, 235, 76, 203, 247, 85, 167, 164, 144, 51, 209, 43, - 158, 169, 185, 243, 224, 33, 97, 210, 136, 15, 74, 101, 169, 33, 170, - 98, 138, 226, 242, 247, 119, 167, 44, 144, 24, 86, 151, 211, 124, 191, - 87, 244, 74, 73, 132, 85, 147, 82, 235, 182, 90, 242, 88, 190, 86, - 147, 155, 36, 141, 251, 106, 122, 138, 154, 159, 92, 39, 201, 47, 91, - 166, 136, 115, 70, 27, 165, 207, 150, 142, 79, 33, 231, 169, 71, 108, - 249, 86, 203, 223, 39, 75, 97, 31, 84, 23, 231, 254, 99, 237, 210, - 249, 106, 223, 213, 83, 159, 166, 73, 3, 150, 188, 215, 64, 149, 187, - 93, 58, 52, 48, 190, 129, 56, 247, 176, 75, 90, 31, 126, 96, 11, - 57, 139, 125, 98, 183, 99, 139, 42, 119, 159, 244, 212, 255, 201, 22, - 113, 223, 131, 210, 185, 233, 73, 245, 201, 89, 236, 251, 55, 91, 52, - 80, 251, 30, 149, 54, 239, 74, 212, 145, 123, 66, 42, 220, 35, 87, - 32, 57, 139, 189, 227, 246, 43, 173, 239, 25, 169, 103, 225, 7, 58, - 125, 207, 75, 219, 242, 183, 104, 64, 206, 98, 87, 11, 91, 83, 95, - 237, 123, 89, 58, 240, 225, 221, 205, 98, 61, 95, 147, 22, 87, 251, - 117, 11, 57, 139, 221, 170, 176, 90, 247, 233, 25, 125, 91, 26, 208, - 108, 113, 178, 88, 238, 93, 233, 248, 223, 249, 83, 200, 89, 236, 139, - 129, 149, 181, 223, 247, 161, 116, 51, 41, 72, 103, 143, 229, 137, 212, - 97, 76, 227, 20, 114, 22, 187, 219, 244, 38, 218, 239, 251, 82, 234, - 189, 164, 169, 78, 223, 215, 82, 249, 163, 117, 73, 27, 249, 238, 214, - 122, 170, 92, 179, 135, 108, 91, 221, 80, 108, 87, 105, 158, 242, 94, - 223, 182, 90, 27, 47, 249, 229, 228, 112, 173, 111, 110, 249, 7, 211, - 4, 157, 190, 121, 228, 34, 219, 22, 106, 109, 242, 202, 253, 191, 93, - 175, 245, 205, 39, 239, 188, 191, 87, 167, 175, 143, 44, 21, 184, 171, - 181, 121, 79, 126, 147, 223, 83, 205, 213, 155, 11, 200, 29, 103, 23, - 176, 137, 251, 22, 148, 43, 39, 19, 156, 250, 202, 45, 211, 253, 181, - 190, 133, 229, 17, 215, 171, 234, 244, 45, 34, 179, 61, 58, 63, 74, - 159, 27, 243, 190, 204, 239, 221, 249, 120, 84, 49, 21, 132, 191, 34, - 30, 85, 156, 230, 127, 138, 31, 2, 223, 76, 252, 16, 214, 50, 162, - 175, 37, 126, 136, 208, 193, 224, 135, 216, 115, 215, 126, 104, 19, 248, - 161, 73, 211, 6, 211, 154, 169, 164, 120, 117, 62, 219, 16, 252, 80, - 193, 70, 191, 113, 126, 168, 178, 82, 203, 24, 197, 237, 11, 161, 31, - 98, 49, 126, 57, 221, 71, 66, 63, 36, 138, 241, 196, 15, 37, 29, - 75, 177, 17, 63, 228, 255, 249, 46, 27, 241, 67, 227, 109, 135, 108, - 122, 126, 232, 147, 149, 187, 109, 196, 15, 21, 59, 170, 237, 41, 129, - 31, 122, 241, 226, 136, 206, 62, 137, 93, 250, 170, 231, 85, 27, 241, - 67, 23, 199, 223, 176, 17, 63, 52, 224, 247, 219, 54, 61, 63, 36, - 247, 38, 123, 86, 123, 164, 31, 219, 95, 212, 250, 238, 147, 30, 124, - 113, 222, 166, 231, 135, 230, 103, 92, 176, 17, 63, 52, 235, 249, 57, - 27, 241, 67, 19, 77, 103, 109, 122, 126, 232, 230, 193, 99, 54, 226, - 135, 110, 141, 59, 102, 35, 126, 232, 118, 141, 99, 54, 61, 63, 244, - 100, 196, 105, 27, 241, 67, 77, 125, 206, 106, 239, 124, 89, 154, 183, - 248, 156, 78, 223, 107, 210, 23, 59, 201, 187, 221, 148, 218, 154, 200, - 59, 223, 150, 186, 4, 233, 245, 189, 43, 213, 142, 39, 58, 201, 144, - 98, 147, 72, 223, 135, 210, 145, 243, 122, 227, 125, 34, 237, 137, 63, - 101, 35, 126, 168, 200, 193, 147, 54, 226, 135, 58, 23, 59, 97, 211, - 243, 67, 11, 70, 81, 157, 200, 37, 226, 143, 218, 136, 31, 250, 126, - 166, 216, 54, 176, 38, 100, 93, 200, 113, 27, 241, 67, 129, 245, 14, - 218, 136, 31, 218, 90, 254, 111, 155, 158, 31, 202, 252, 125, 157, 141, - 248, 161, 194, 214, 165, 54, 226, 135, 170, 118, 248, 65, 252, 206, 224, - 135, 154, 140, 140, 177, 17, 63, 180, 171, 239, 112, 234, 135, 90, 117, - 234, 167, 235, 135, 98, 170, 140, 165, 126, 104, 173, 35, 150, 250, 161, - 95, 215, 76, 212, 245, 67, 108, 239, 215, 143, 210, 232, 135, 248, 61, - 97, 31, 143, 202, 224, 135, 42, 131, 31, 170, 252, 142, 31, 194, 249, - 27, 241, 67, 117, 192, 15, 225, 124, 140, 248, 33, 66, 251, 130, 31, - 98, 207, 93, 215, 84, 159, 106, 153, 105, 217, 59, 238, 137, 157, 248, - 33, 219, 179, 252, 202, 92, 255, 252, 224, 48, 105, 250, 238, 114, 169, - 204, 15, 149, 1, 63, 84, 10, 252, 80, 73, 218, 247, 231, 137, 11, - 36, 182, 54, 88, 78, 247, 39, 87, 131, 31, 18, 173, 13, 176, 239, - 124, 240, 67, 81, 117, 138, 216, 137, 31, 122, 254, 170, 182, 66, 23, - 138, 91, 39, 189, 120, 212, 70, 184, 119, 55, 125, 242, 70, 105, 81, - 129, 221, 180, 30, 59, 104, 137, 250, 158, 159, 140, 79, 150, 170, 222, - 234, 40, 92, 199, 175, 29, 101, 151, 118, 46, 93, 147, 74, 252, 80, - 224, 201, 93, 10, 93, 115, 244, 118, 201, 49, 236, 156, 176, 111, 25, - 240, 67, 167, 111, 253, 147, 74, 252, 80, 100, 137, 11, 10, 221, 10, - 252, 208, 31, 77, 174, 10, 251, 182, 138, 59, 40, 221, 124, 118, 55, - 149, 248, 161, 164, 230, 207, 20, 186, 60, 248, 161, 41, 33, 166, 173, - 194, 189, 89, 240, 67, 59, 46, 228, 219, 74, 252, 208, 226, 203, 42, - 125, 23, 252, 208, 152, 235, 249, 132, 125, 143, 96, 109, 90, 11, 194, - 223, 33, 249, 44, 83, 229, 174, 143, 186, 44, 125, 244, 215, 61, 225, - 59, 223, 1, 63, 148, 239, 244, 245, 84, 226, 135, 174, 238, 184, 168, - 208, 143, 162, 110, 75, 101, 254, 60, 37, 236, 187, 11, 252, 208, 164, - 190, 135, 83, 137, 31, 170, 26, 176, 79, 161, 79, 68, 61, 148, 22, - 60, 223, 41, 236, 123, 23, 252, 208, 119, 189, 183, 165, 18, 63, 244, - 96, 108, 170, 66, 123, 131, 31, 234, 146, 144, 34, 236, 219, 44, 238, - 181, 84, 107, 86, 50, 105, 35, 119, 201, 220, 160, 254, 70, 224, 135, - 230, 244, 249, 83, 216, 183, 15, 248, 161, 237, 127, 47, 77, 37, 126, - 40, 224, 192, 124, 133, 238, 15, 126, 104, 251, 222, 233, 194, 190, 23, - 192, 15, 61, 249, 136, 228, 144, 242, 202, 251, 39, 169, 251, 195, 169, - 193, 249, 228, 207, 110, 215, 19, 246, 93, 8, 126, 104, 66, 177, 146, - 169, 196, 15, 149, 159, 158, 71, 161, 255, 10, 46, 32, 47, 42, 126, - 83, 136, 133, 116, 240, 67, 229, 158, 239, 179, 19, 63, 180, 183, 101, - 170, 66, 63, 8, 46, 44, 63, 249, 109, 173, 176, 239, 107, 240, 67, - 236, 76, 129, 31, 165, 207, 131, 31, 226, 207, 26, 248, 120, 148, 3, - 63, 84, 14, 252, 80, 185, 119, 231, 67, 176, 198, 227, 231, 67, 184, - 102, 35, 126, 136, 208, 184, 46, 99, 207, 93, 223, 235, 102, 135, 249, - 208, 79, 199, 163, 104, 173, 234, 244, 25, 42, 45, 193, 124, 40, 195, - 28, 197, 213, 170, 142, 4, 63, 52, 18, 252, 208, 72, 182, 31, 15, - 243, 33, 150, 83, 88, 78, 247, 189, 61, 193, 15, 137, 114, 10, 106, - 220, 90, 45, 253, 189, 135, 180, 73, 146, 198, 172, 81, 233, 50, 48, - 31, 170, 57, 87, 188, 159, 108, 141, 219, 40, 125, 95, 192, 74, 235, - 92, 79, 29, 83, 247, 135, 207, 195, 124, 200, 54, 85, 188, 175, 107, - 129, 249, 80, 205, 149, 164, 222, 49, 77, 138, 243, 80, 235, 32, 199, - 68, 109, 151, 54, 119, 236, 43, 236, 155, 1, 126, 232, 100, 173, 190, - 180, 70, 182, 244, 76, 181, 70, 246, 125, 240, 67, 157, 239, 246, 18, - 246, 173, 0, 126, 168, 235, 10, 86, 35, 59, 176, 128, 90, 35, 91, - 28, 252, 144, 121, 72, 23, 97, 223, 21, 224, 135, 252, 127, 106, 79, - 107, 100, 135, 207, 83, 233, 175, 193, 15, 237, 153, 219, 94, 216, 247, - 58, 248, 33, 207, 65, 93, 104, 141, 236, 154, 199, 106, 61, 238, 69, - 240, 67, 101, 35, 123, 8, 251, 62, 2, 63, 212, 46, 162, 23, 173, - 145, 141, 170, 22, 166, 213, 125, 222, 150, 126, 188, 208, 71, 216, 247, - 1, 248, 161, 31, 31, 176, 251, 228, 194, 139, 171, 181, 167, 248, 77, - 137, 250, 13, 7, 10, 251, 98, 141, 236, 145, 251, 3, 105, 141, 108, - 224, 164, 65, 102, 50, 31, 90, 90, 46, 92, 216, 55, 47, 248, 161, - 136, 206, 180, 141, 60, 161, 251, 96, 90, 35, 187, 52, 44, 66, 216, - 55, 55, 248, 161, 13, 195, 135, 210, 26, 217, 4, 179, 90, 231, 234, - 5, 126, 104, 140, 207, 72, 97, 223, 103, 224, 135, 138, 158, 34, 185, - 103, 88, 151, 117, 85, 207, 29, 188, 0, 63, 180, 230, 234, 56, 241, - 120, 193, 15, 205, 44, 18, 69, 235, 107, 187, 167, 170, 244, 91, 240, - 67, 1, 253, 197, 231, 35, 112, 62, 244, 123, 18, 105, 227, 43, 231, - 58, 173, 210, 56, 31, 10, 245, 136, 49, 235, 205, 135, 216, 89, 21, - 63, 74, 227, 124, 136, 63, 195, 226, 227, 49, 10, 252, 208, 40, 240, - 67, 163, 222, 201, 163, 99, 30, 144, 158, 203, 45, 19, 238, 29, 82, - 87, 47, 39, 200, 106, 115, 67, 160, 111, 98, 57, 55, 246, 158, 2, - 184, 125, 206, 242, 220, 126, 109, 57, 3, 247, 107, 203, 115, 251, 181, - 64, 163, 76, 197, 67, 148, 53, 112, 191, 150, 147, 129, 227, 38, 99, - 9, 41, 107, 224, 126, 109, 185, 44, 251, 181, 154, 12, 71, 25, 3, - 247, 107, 203, 25, 187, 95, 139, 58, 54, 114, 191, 54, 164, 172, 177, - 251, 181, 168, 59, 35, 247, 107, 17, 39, 180, 206, 176, 68, 184, 119, - 122, 128, 30, 102, 88, 109, 174, 163, 116, 184, 119, 104, 41, 55, 206, - 5, 149, 230, 206, 211, 148, 230, 206, 5, 149, 52, 240, 92, 16, 39, - 195, 1, 239, 228, 208, 228, 88, 75, 26, 120, 46, 168, 20, 55, 14, - 160, 201, 88, 124, 75, 26, 120, 46, 168, 84, 150, 115, 65, 165, 180, - 115, 65, 37, 12, 60, 23, 84, 210, 216, 253, 90, 107, 73, 99, 247, - 107, 125, 75, 26, 187, 95, 139, 186, 51, 114, 191, 22, 113, 66, 235, - 12, 139, 130, 29, 148, 209, 195, 12, 119, 247, 99, 241, 112, 111, 255, - 98, 110, 212, 127, 20, 231, 98, 64, 113, 198, 63, 233, 253, 156, 97, - 166, 88, 209, 143, 26, 210, 24, 192, 201, 72, 132, 119, 74, 212, 228, - 88, 222, 207, 25, 102, 254, 57, 81, 139, 125, 239, 181, 24, 55, 14, - 160, 201, 88, 210, 253, 114, 134, 153, 162, 195, 186, 178, 113, 20, 203, - 82, 255, 81, 76, 229, 29, 234, 151, 51, 204, 28, 168, 206, 213, 25, - 190, 207, 217, 80, 22, 126, 168, 83, 198, 219, 245, 191, 119, 246, 87, - 5, 252, 80, 127, 255, 149, 31, 234, 51, 59, 126, 168, 171, 255, 202, - 47, 84, 192, 15, 245, 226, 46, 63, 90, 103, 88, 148, 97, 38, 32, - 6, 236, 160, 132, 14, 102, 248, 187, 31, 161, 175, 163, 176, 62, 102, - 176, 29, 141, 1, 69, 24, 255, 136, 194, 198, 197, 25, 228, 75, 99, - 0, 208, 40, 83, 105, 84, 216, 184, 56, 19, 202, 201, 192, 113, 147, - 177, 36, 248, 26, 23, 103, 144, 175, 83, 157, 161, 38, 35, 41, 198, - 184, 56, 131, 122, 55, 50, 206, 152, 10, 27, 27, 103, 80, 159, 70, - 198, 25, 212, 157, 145, 113, 6, 113, 66, 48, 147, 49, 22, 236, 160, - 168, 30, 102, 216, 153, 237, 164, 232, 112, 239, 128, 40, 125, 204, 96, - 59, 98, 7, 1, 209, 140, 127, 90, 164, 113, 152, 9, 224, 100, 36, - 193, 59, 37, 105, 114, 66, 34, 141, 195, 12, 242, 165, 227, 0, 154, - 140, 197, 49, 206, 56, 204, 4, 68, 57, 99, 6, 101, 42, 254, 101, - 156, 113, 152, 65, 189, 27, 185, 158, 9, 137, 52, 118, 61, 131, 250, - 52, 114, 61, 19, 49, 206, 216, 245, 12, 226, 132, 222, 97, 52, 4, - 236, 32, 70, 128, 153, 161, 253, 76, 125, 135, 179, 223, 35, 2, 250, - 102, 140, 214, 199, 12, 182, 35, 118, 144, 49, 134, 241, 79, 28, 153, - 189, 29, 116, 191, 227, 101, 75, 159, 82, 52, 72, 84, 155, 235, 8, - 241, 160, 119, 63, 34, 95, 34, 35, 2, 104, 148, 169, 96, 102, 120, - 246, 50, 230, 60, 219, 106, 251, 241, 236, 252, 32, 81, 109, 238, 44, - 207, 82, 20, 51, 17, 156, 12, 28, 55, 29, 203, 208, 236, 101, 60, - 223, 113, 38, 53, 237, 227, 163, 65, 162, 218, 220, 198, 246, 191, 232, - 252, 15, 249, 242, 152, 137, 208, 100, 164, 15, 202, 94, 198, 213, 94, - 125, 204, 193, 30, 177, 194, 218, 220, 95, 158, 176, 218, 92, 212, 59, - 95, 11, 133, 122, 36, 252, 8, 141, 181, 80, 236, 57, 230, 129, 171, - 154, 150, 193, 223, 10, 110, 63, 30, 107, 161, 230, 253, 91, 88, 107, - 211, 66, 38, 237, 177, 22, 106, 212, 235, 87, 194, 250, 55, 172, 181, - 188, 21, 113, 77, 107, 243, 173, 28, 121, 236, 159, 64, 181, 111, 39, - 185, 208, 167, 251, 116, 250, 134, 202, 247, 46, 164, 104, 109, 122, 201, - 77, 63, 248, 83, 161, 115, 101, 246, 149, 195, 234, 139, 239, 100, 125, - 157, 107, 176, 124, 166, 246, 100, 173, 205, 112, 185, 254, 180, 33, 129, - 106, 206, 109, 132, 92, 234, 68, 191, 64, 113, 206, 109, 164, 124, 36, - 79, 31, 173, 205, 104, 185, 119, 175, 111, 180, 190, 99, 228, 23, 219, - 154, 232, 244, 29, 43, 135, 238, 247, 211, 218, 68, 202, 203, 27, 21, - 81, 199, 27, 109, 149, 119, 87, 206, 43, 30, 111, 108, 188, 220, 40, - 101, 137, 214, 102, 162, 124, 239, 223, 149, 90, 223, 201, 242, 143, 101, - 254, 210, 233, 59, 77, 94, 108, 137, 215, 218, 204, 164, 52, 214, 66, - 177, 231, 217, 199, 105, 180, 23, 196, 16, 111, 47, 136, 9, 98, 47, - 132, 70, 123, 97, 207, 201, 57, 10, 231, 243, 92, 104, 47, 173, 31, - 150, 165, 181, 185, 164, 61, 218, 139, 103, 253, 146, 186, 181, 185, 47, - 90, 20, 163, 181, 185, 95, 127, 252, 62, 173, 205, 93, 91, 216, 207, - 166, 103, 47, 227, 182, 23, 181, 17, 123, 177, 135, 22, 181, 17, 123, - 25, 112, 161, 136, 77, 207, 94, 38, 31, 44, 76, 235, 107, 223, 236, - 40, 98, 35, 246, 178, 192, 163, 168, 77, 207, 94, 6, 28, 34, 239, - 54, 90, 110, 28, 95, 212, 70, 236, 165, 108, 189, 34, 54, 61, 123, - 233, 183, 175, 0, 173, 205, 141, 126, 146, 143, 214, 114, 255, 214, 232, - 73, 138, 158, 189, 100, 164, 39, 165, 16, 123, 241, 54, 111, 73, 33, - 246, 82, 110, 245, 182, 20, 61, 123, 41, 86, 185, 36, 173, 205, 37, - 52, 218, 11, 123, 46, 182, 23, 244, 135, 188, 189, 160, 127, 35, 246, - 66, 232, 79, 192, 94, 216, 115, 180, 151, 178, 239, 236, 119, 239, 4, - 123, 233, 82, 117, 18, 189, 35, 146, 180, 127, 15, 236, 229, 180, 148, - 38, 220, 167, 51, 53, 106, 39, 159, 142, 188, 72, 107, 115, 175, 212, - 80, 247, 235, 189, 192, 94, 98, 7, 228, 22, 206, 79, 61, 26, 133, - 202, 231, 7, 21, 73, 37, 246, 178, 113, 134, 186, 87, 158, 15, 236, - 229, 139, 205, 181, 132, 125, 243, 120, 13, 150, 251, 133, 53, 74, 37, - 246, 210, 120, 76, 251, 84, 117, 31, 98, 132, 236, 27, 221, 89, 216, - 215, 107, 219, 72, 57, 176, 114, 207, 84, 98, 47, 15, 246, 246, 211, - 250, 142, 145, 15, 15, 22, 207, 169, 159, 130, 189, 164, 118, 141, 161, - 181, 185, 121, 151, 71, 42, 116, 27, 176, 151, 106, 7, 134, 136, 247, - 247, 193, 94, 198, 7, 123, 209, 218, 220, 15, 60, 212, 239, 149, 183, - 3, 123, 57, 180, 195, 67, 172, 171, 184, 105, 242, 254, 120, 86, 155, - 75, 232, 149, 96, 47, 236, 185, 216, 94, 48, 182, 57, 213, 254, 63, - 97, 103, 157, 9, 141, 254, 133, 61, 71, 123, 25, 245, 206, 190, 36, - 126, 43, 226, 139, 132, 24, 90, 155, 75, 218, 99, 237, 255, 134, 147, - 209, 102, 61, 255, 210, 127, 84, 52, 173, 205, 157, 93, 153, 244, 237, - 36, 111, 62, 18, 165, 91, 155, 107, 233, 21, 69, 107, 115, 77, 215, - 213, 61, 77, 47, 176, 151, 149, 13, 35, 197, 125, 193, 191, 236, 108, - 49, 142, 214, 215, 78, 148, 198, 154, 137, 127, 249, 235, 205, 24, 179, - 158, 127, 121, 188, 144, 180, 25, 45, 123, 53, 24, 99, 38, 254, 197, - 239, 31, 241, 154, 233, 13, 216, 75, 116, 230, 40, 90, 155, 219, 168, - 232, 104, 237, 91, 182, 86, 249, 235, 240, 209, 58, 123, 124, 241, 114, - 252, 158, 40, 90, 155, 27, 127, 37, 74, 235, 59, 89, 142, 127, 19, - 165, 91, 155, 91, 233, 24, 171, 205, 37, 52, 250, 23, 246, 92, 188, - 206, 195, 121, 42, 173, 153, 234, 15, 243, 176, 177, 194, 57, 171, 83, - 109, 174, 9, 250, 166, 15, 212, 159, 179, 98, 59, 250, 189, 215, 8, - 174, 102, 106, 160, 187, 115, 86, 215, 107, 23, 140, 185, 244, 123, 175, - 17, 220, 57, 115, 156, 223, 13, 209, 106, 166, 6, 184, 59, 103, 205, - 38, 103, 9, 126, 154, 238, 191, 13, 226, 206, 203, 195, 187, 147, 177, - 88, 7, 184, 59, 103, 117, 45, 3, 177, 77, 207, 203, 15, 204, 82, - 51, 165, 205, 85, 125, 7, 184, 59, 103, 117, 45, 3, 237, 129, 230, - 215, 6, 58, 215, 170, 178, 185, 139, 213, 76, 104, 172, 85, 21, 205, - 105, 248, 117, 20, 234, 152, 231, 199, 98, 155, 213, 76, 104, 228, 39, - 138, 121, 78, 181, 190, 89, 248, 49, 223, 103, 53, 19, 26, 249, 137, - 124, 162, 83, 173, 111, 22, 126, 12, 27, 86, 51, 161, 145, 159, 8, - 51, 252, 58, 15, 113, 66, 107, 166, 194, 192, 14, 134, 232, 97, 134, - 213, 230, 250, 66, 223, 132, 190, 110, 212, 76, 245, 231, 106, 141, 250, - 113, 53, 83, 125, 141, 195, 12, 242, 165, 53, 83, 64, 163, 76, 37, - 183, 208, 199, 56, 204, 248, 114, 50, 112, 220, 100, 44, 150, 62, 198, - 97, 6, 249, 58, 213, 76, 105, 50, 210, 195, 140, 195, 12, 234, 157, - 207, 21, 184, 194, 12, 230, 10, 220, 197, 12, 234, 152, 231, 231, 10, - 51, 200, 207, 93, 204, 88, 120, 126, 111, 198, 165, 186, 194, 140, 101, - 68, 57, 183, 49, 131, 186, 227, 223, 207, 21, 102, 240, 253, 220, 197, - 12, 226, 132, 96, 198, 183, 7, 216, 65, 127, 61, 204, 176, 218, 220, - 244, 222, 225, 222, 33, 189, 220, 168, 153, 234, 205, 197, 128, 222, 140, - 191, 163, 167, 113, 152, 9, 225, 100, 164, 195, 59, 165, 107, 114, 34, - 122, 26, 135, 25, 228, 75, 199, 1, 52, 29, 75, 79, 227, 48, 19, - 210, 43, 75, 205, 84, 47, 45, 207, 223, 195, 56, 204, 160, 222, 115, - 138, 25, 62, 199, 29, 209, 51, 231, 152, 113, 202, 233, 247, 204, 57, - 102, 156, 114, 250, 61, 114, 142, 25, 126, 110, 134, 56, 161, 103, 138, - 186, 128, 29, 132, 233, 97, 134, 213, 230, 38, 116, 15, 247, 78, 236, - 166, 143, 25, 108, 71, 99, 64, 119, 238, 76, 81, 183, 156, 97, 134, - 207, 39, 250, 114, 50, 18, 66, 1, 251, 154, 156, 180, 174, 57, 195, - 12, 159, 79, 68, 190, 116, 63, 25, 222, 157, 140, 37, 164, 107, 206, - 48, 195, 231, 19, 145, 47, 143, 25, 148, 169, 140, 181, 75, 206, 48, - 67, 242, 137, 65, 154, 222, 169, 13, 109, 43, 184, 53, 108, 97, 222, - 119, 242, 137, 88, 171, 154, 250, 215, 219, 192, 236, 242, 137, 78, 103, - 138, 186, 114, 181, 180, 105, 5, 183, 254, 89, 98, 89, 74, 214, 124, - 147, 47, 240, 251, 95, 169, 234, 217, 230, 155, 156, 114, 250, 28, 63, - 203, 129, 130, 91, 131, 194, 174, 188, 147, 143, 176, 92, 90, 102, 254, - 227, 208, 234, 108, 243, 17, 78, 57, 253, 46, 206, 227, 237, 60, 238, - 221, 245, 42, 142, 183, 88, 193, 152, 108, 215, 171, 78, 103, 138, 186, - 112, 231, 35, 58, 2, 221, 67, 15, 51, 220, 189, 155, 157, 195, 189, - 67, 59, 185, 113, 166, 168, 51, 183, 15, 219, 153, 139, 51, 167, 91, - 184, 137, 25, 215, 245, 166, 121, 255, 215, 184, 62, 221, 135, 229, 100, - 56, 224, 157, 28, 154, 156, 18, 99, 90, 187, 137, 25, 215, 50, 42, - 124, 153, 196, 190, 247, 218, 137, 27, 7, 208, 100, 44, 37, 190, 8, - 113, 19, 51, 174, 101, 148, 77, 219, 199, 246, 147, 59, 101, 57, 83, - 212, 73, 149, 145, 55, 95, 27, 55, 49, 227, 90, 198, 5, 174, 54, - 23, 245, 206, 215, 230, 162, 30, 9, 63, 66, 227, 25, 112, 246, 60, - 251, 218, 220, 232, 113, 73, 26, 174, 2, 164, 66, 219, 47, 42, 180, - 60, 36, 76, 154, 190, 46, 31, 205, 223, 183, 133, 62, 125, 224, 47, - 138, 235, 251, 124, 202, 2, 137, 97, 117, 57, 205, 247, 227, 25, 112, - 17, 86, 77, 218, 25, 240, 25, 242, 125, 173, 77, 146, 180, 97, 210, - 99, 45, 39, 189, 78, 58, 123, 224, 133, 56, 23, 30, 187, 81, 154, - 188, 179, 136, 38, 119, 179, 84, 241, 185, 143, 66, 231, 138, 78, 150, - 54, 215, 204, 21, 36, 206, 31, 216, 165, 192, 190, 27, 52, 254, 105, - 82, 193, 51, 9, 106, 14, 62, 122, 187, 116, 124, 94, 71, 161, 92, - 83, 220, 46, 105, 247, 247, 205, 181, 54, 123, 164, 223, 154, 28, 111, - 160, 202, 221, 39, 5, 63, 243, 169, 47, 234, 155, 25, 123, 80, 242, - 120, 48, 80, 243, 67, 233, 210, 183, 179, 22, 168, 116, 244, 81, 233, - 245, 111, 105, 58, 57, 213, 19, 210, 208, 32, 226, 195, 78, 73, 255, - 244, 94, 171, 229, 99, 207, 72, 65, 179, 82, 116, 234, 152, 207, 75, - 77, 182, 29, 214, 218, 56, 164, 143, 22, 188, 76, 81, 223, 249, 178, - 180, 48, 89, 156, 67, 206, 140, 189, 38, 149, 105, 218, 138, 214, 196, - 217, 71, 132, 168, 121, 111, 172, 137, 251, 237, 43, 221, 154, 184, 159, - 254, 87, 150, 214, 196, 101, 78, 240, 209, 106, 241, 30, 74, 199, 215, - 220, 215, 173, 205, 45, 219, 242, 28, 173, 205, 237, 125, 249, 184, 86, - 215, 251, 82, 90, 51, 234, 160, 110, 109, 110, 197, 149, 23, 104, 109, - 110, 194, 202, 19, 180, 54, 247, 245, 202, 3, 186, 181, 185, 131, 226, - 214, 210, 218, 220, 123, 45, 102, 209, 218, 220, 180, 90, 29, 117, 107, - 115, 223, 92, 74, 214, 234, 79, 243, 202, 235, 122, 236, 221, 164, 246, - 205, 39, 95, 253, 97, 67, 3, 113, 95, 31, 249, 250, 202, 214, 154, - 93, 189, 39, 151, 95, 55, 67, 219, 23, 42, 32, 167, 205, 92, 175, - 179, 47, 84, 80, 94, 52, 230, 140, 214, 198, 87, 110, 242, 213, 29, - 173, 111, 97, 249, 214, 7, 111, 116, 250, 22, 145, 217, 30, 157, 31, - 165, 241, 12, 56, 191, 119, 231, 227, 81, 213, 84, 16, 254, 138, 120, - 84, 125, 167, 22, 5, 125, 51, 241, 67, 211, 193, 15, 161, 175, 37, - 126, 136, 208, 102, 240, 67, 236, 185, 107, 63, 180, 17, 252, 208, 159, - 109, 231, 211, 123, 70, 199, 141, 155, 169, 208, 173, 193, 15, 237, 73, - 142, 231, 252, 80, 53, 240, 67, 213, 192, 15, 177, 251, 12, 95, 128, - 31, 98, 49, 126, 57, 221, 71, 242, 0, 63, 36, 138, 241, 196, 15, - 45, 178, 215, 167, 181, 185, 7, 110, 5, 218, 136, 31, 122, 249, 126, - 176, 110, 109, 238, 165, 243, 53, 104, 109, 238, 245, 253, 31, 219, 136, - 31, 186, 191, 69, 252, 205, 219, 92, 113, 118, 105, 87, 70, 51, 90, - 155, 59, 249, 155, 161, 218, 55, 56, 183, 75, 17, 93, 103, 10, 251, - 62, 141, 221, 37, 245, 248, 114, 55, 173, 205, 61, 220, 228, 8, 173, - 205, 45, 41, 157, 213, 173, 205, 253, 170, 251, 86, 90, 155, 235, 215, - 101, 3, 173, 205, 61, 245, 237, 10, 155, 56, 87, 127, 66, 74, 120, - 243, 43, 173, 205, 125, 82, 102, 182, 246, 206, 103, 164, 38, 35, 35, - 197, 251, 96, 224, 135, 138, 174, 169, 78, 107, 115, 119, 238, 124, 168, - 252, 94, 111, 163, 46, 75, 121, 107, 205, 77, 209, 243, 67, 3, 138, - 94, 79, 38, 126, 232, 169, 41, 81, 253, 166, 0, 248, 33, 191, 34, - 71, 27, 136, 229, 222, 149, 174, 109, 148, 2, 137, 31, 42, 83, 187, - 67, 32, 241, 67, 95, 252, 17, 17, 168, 231, 135, 174, 79, 168, 31, - 72, 252, 208, 166, 247, 106, 4, 18, 63, 52, 245, 187, 18, 129, 122, - 126, 232, 204, 69, 178, 95, 107, 146, 219, 12, 240, 12, 36, 126, 104, - 246, 221, 139, 13, 244, 252, 80, 226, 134, 245, 13, 136, 31, 234, 177, - 245, 117, 125, 226, 135, 102, 183, 59, 182, 69, 207, 15, 21, 251, 188, - 34, 253, 70, 192, 197, 9, 221, 233, 55, 2, 118, 119, 79, 208, 253, - 70, 192, 179, 15, 22, 211, 111, 4, 60, 63, 189, 49, 133, 248, 161, - 204, 201, 7, 83, 244, 252, 208, 190, 67, 79, 83, 136, 31, 170, 177, - 40, 55, 173, 205, 253, 247, 104, 33, 221, 218, 92, 182, 247, 235, 71, - 105, 244, 67, 252, 158, 176, 232, 27, 1, 56, 127, 35, 126, 168, 50, - 248, 33, 156, 143, 17, 63, 68, 232, 194, 224, 135, 216, 115, 215, 181, - 185, 105, 45, 51, 45, 63, 127, 243, 146, 214, 230, 174, 120, 163, 214, - 230, 22, 3, 63, 180, 237, 227, 50, 194, 218, 220, 197, 224, 135, 216, - 218, 96, 57, 221, 159, 244, 3, 63, 36, 90, 27, 96, 223, 123, 224, - 135, 110, 252, 246, 3, 173, 205, 141, 45, 49, 67, 221, 111, 4, 63, - 212, 102, 90, 188, 112, 175, 178, 101, 220, 70, 233, 211, 162, 83, 104, - 109, 238, 130, 179, 125, 20, 218, 10, 126, 232, 195, 248, 134, 194, 190, - 131, 97, 62, 228, 63, 99, 20, 245, 67, 151, 231, 239, 84, 126, 195, - 212, 168, 237, 82, 88, 254, 230, 58, 54, 190, 75, 106, 80, 167, 2, - 253, 86, 201, 240, 193, 241, 74, 223, 254, 224, 135, 94, 62, 54, 9, - 127, 243, 21, 241, 7, 165, 144, 133, 85, 169, 31, 58, 253, 67, 1, - 229, 61, 95, 91, 143, 74, 63, 72, 67, 133, 239, 252, 19, 248, 161, - 157, 253, 30, 208, 123, 150, 111, 204, 174, 164, 252, 46, 255, 195, 154, - 184, 200, 86, 194, 188, 197, 142, 184, 243, 210, 245, 95, 172, 236, 254, - 243, 195, 243, 20, 250, 36, 248, 161, 231, 30, 226, 90, 85, 71, 228, - 53, 201, 199, 124, 146, 214, 230, 22, 41, 171, 214, 34, 207, 143, 186, - 45, 237, 185, 117, 77, 216, 55, 22, 252, 80, 163, 58, 71, 104, 109, - 174, 215, 133, 125, 90, 77, 240, 67, 105, 255, 52, 113, 109, 238, 85, - 240, 67, 35, 62, 98, 181, 185, 105, 77, 213, 218, 220, 220, 224, 135, - 170, 134, 234, 215, 230, 166, 218, 89, 109, 238, 207, 245, 55, 42, 116, - 8, 248, 161, 216, 245, 226, 241, 246, 223, 230, 41, 215, 121, 194, 106, - 115, 59, 159, 82, 107, 115, 7, 130, 31, 10, 93, 47, 174, 205, 61, - 9, 126, 168, 116, 195, 193, 180, 54, 247, 247, 196, 182, 234, 55, 151, - 131, 243, 201, 62, 5, 197, 181, 185, 75, 192, 15, 109, 241, 103, 181, - 185, 247, 207, 169, 181, 185, 91, 130, 11, 200, 195, 155, 220, 18, 218, - 198, 17, 240, 67, 131, 106, 30, 160, 181, 185, 193, 83, 183, 210, 218, - 220, 248, 127, 215, 233, 214, 230, 178, 51, 5, 126, 148, 198, 218, 92, - 254, 172, 129, 168, 54, 23, 215, 120, 124, 109, 238, 5, 174, 54, 247, - 2, 87, 155, 123, 193, 141, 218, 220, 113, 251, 88, 109, 110, 105, 173, - 54, 23, 215, 101, 133, 191, 20, 215, 230, 226, 186, 140, 229, 20, 150, - 211, 125, 111, 92, 151, 137, 114, 10, 100, 62, 148, 191, 41, 171, 205, - 173, 212, 149, 124, 235, 121, 157, 20, 56, 82, 167, 166, 16, 230, 67, - 165, 70, 199, 208, 218, 220, 61, 9, 164, 111, 178, 52, 114, 133, 222, - 55, 166, 237, 146, 227, 102, 12, 173, 205, 205, 245, 44, 198, 76, 214, - 101, 223, 121, 90, 205, 122, 126, 40, 230, 86, 12, 173, 205, 53, 221, - 38, 114, 247, 73, 177, 183, 197, 114, 61, 226, 14, 74, 155, 203, 88, - 105, 109, 110, 29, 173, 46, 185, 0, 204, 135, 30, 124, 35, 238, 91, - 28, 252, 208, 246, 46, 209, 180, 54, 183, 244, 42, 117, 175, 30, 253, - 144, 244, 92, 252, 125, 234, 80, 240, 67, 53, 27, 142, 166, 181, 185, - 94, 99, 212, 122, 211, 16, 88, 151, 29, 95, 47, 174, 85, 173, 13, - 243, 161, 241, 213, 250, 210, 218, 220, 26, 191, 132, 105, 245, 181, 183, - 165, 54, 101, 123, 11, 251, 222, 0, 63, 244, 237, 50, 86, 155, 91, - 61, 159, 90, 155, 251, 16, 252, 208, 229, 254, 226, 218, 220, 23, 224, - 135, 174, 21, 30, 68, 107, 115, 103, 46, 103, 181, 185, 159, 154, 245, - 107, 115, 71, 246, 99, 181, 185, 201, 3, 88, 109, 110, 190, 112, 253, - 218, 220, 21, 227, 89, 109, 174, 169, 45, 171, 205, 237, 89, 65, 92, - 155, 251, 20, 252, 144, 215, 19, 86, 155, 187, 99, 52, 171, 205, 13, - 207, 212, 175, 205, 253, 181, 52, 171, 205, 181, 238, 96, 181, 185, 29, - 7, 232, 215, 230, 102, 174, 103, 181, 185, 167, 207, 177, 218, 220, 191, - 114, 235, 215, 230, 178, 179, 42, 126, 148, 86, 190, 85, 242, 196, 189, - 218, 92, 37, 15, 72, 114, 195, 223, 132, 123, 135, 118, 209, 203, 9, - 178, 218, 220, 80, 232, 235, 248, 214, 141, 250, 143, 142, 92, 190, 174, - 3, 87, 255, 241, 173, 113, 123, 79, 200, 151, 230, 235, 128, 70, 153, - 234, 17, 27, 227, 246, 158, 66, 57, 25, 56, 110, 50, 150, 132, 246, - 198, 237, 61, 33, 95, 167, 250, 15, 77, 134, 127, 123, 227, 246, 158, - 80, 239, 70, 238, 215, 154, 190, 53, 118, 191, 22, 245, 105, 228, 126, - 173, 127, 123, 99, 247, 107, 17, 39, 116, 239, 233, 43, 176, 131, 142, - 122, 152, 225, 238, 205, 133, 190, 137, 237, 220, 248, 254, 248, 55, 220, - 158, 205, 215, 220, 222, 83, 59, 227, 48, 131, 124, 105, 13, 32, 208, - 40, 83, 137, 170, 109, 141, 195, 140, 63, 39, 3, 199, 77, 198, 18, - 210, 214, 56, 204, 32, 95, 167, 122, 118, 77, 134, 227, 43, 227, 48, - 131, 122, 55, 114, 191, 22, 117, 108, 228, 126, 109, 72, 91, 99, 247, - 107, 81, 119, 70, 238, 215, 34, 78, 232, 222, 83, 75, 176, 131, 111, - 244, 48, 195, 221, 155, 219, 6, 252, 121, 136, 27, 123, 79, 109, 184, - 24, 208, 134, 171, 205, 109, 157, 51, 204, 236, 245, 119, 176, 24, 192, - 201, 112, 192, 59, 57, 52, 57, 150, 214, 57, 195, 204, 238, 233, 185, - 217, 189, 185, 33, 220, 56, 128, 38, 99, 73, 111, 149, 51, 204, 220, - 169, 187, 147, 238, 215, 134, 134, 100, 217, 123, 10, 209, 106, 115, 91, - 229, 12, 51, 187, 182, 176, 253, 90, 212, 123, 118, 181, 170, 168, 83, - 198, 219, 245, 191, 119, 206, 241, 8, 248, 161, 254, 254, 43, 63, 212, - 103, 118, 252, 80, 87, 255, 149, 95, 168, 128, 31, 234, 197, 93, 126, - 116, 110, 214, 146, 155, 155, 125, 1, 118, 240, 149, 14, 102, 248, 218, - 92, 232, 235, 104, 238, 198, 220, 172, 37, 103, 207, 45, 184, 185, 89, - 115, 3, 231, 102, 45, 56, 123, 6, 26, 101, 42, 141, 154, 27, 56, - 55, 227, 100, 224, 184, 201, 88, 18, 190, 52, 112, 110, 214, 60, 203, - 220, 76, 147, 225, 255, 165, 129, 115, 179, 230, 198, 198, 25, 83, 115, - 99, 227, 12, 234, 211, 200, 56, 227, 255, 165, 177, 113, 6, 113, 66, - 231, 102, 77, 192, 14, 90, 234, 97, 134, 157, 217, 246, 135, 190, 137, - 205, 220, 152, 155, 125, 193, 205, 105, 62, 231, 230, 102, 205, 12, 156, - 155, 125, 206, 205, 205, 128, 70, 153, 202, 220, 172, 169, 129, 115, 51, - 78, 6, 142, 155, 140, 37, 164, 169, 129, 115, 179, 102, 89, 230, 102, - 154, 12, 71, 19, 3, 231, 102, 205, 140, 93, 207, 160, 142, 141, 92, - 207, 132, 52, 53, 118, 61, 131, 186, 51, 114, 61, 131, 56, 161, 152, - 153, 49, 216, 59, 241, 11, 23, 152, 25, 56, 98, 80, 143, 238, 67, - 149, 26, 7, 19, 63, 111, 104, 12, 254, 188, 81, 184, 247, 213, 252, - 83, 210, 62, 183, 135, 200, 163, 90, 108, 181, 215, 222, 216, 215, 242, - 206, 220, 172, 49, 23, 3, 26, 51, 254, 22, 57, 123, 59, 56, 246, - 176, 248, 134, 103, 245, 122, 212, 85, 49, 227, 229, 210, 14, 156, 98, - 25, 39, 195, 1, 239, 228, 208, 228, 248, 75, 217, 203, 152, 218, 62, - 120, 195, 234, 9, 211, 234, 170, 152, 209, 151, 129, 124, 233, 56, 128, - 166, 99, 153, 53, 56, 91, 25, 215, 66, 170, 165, 30, 26, 26, 23, - 172, 98, 198, 141, 113, 52, 202, 50, 55, 107, 164, 97, 102, 70, 246, - 50, 46, 189, 26, 101, 254, 41, 146, 212, 179, 103, 39, 195, 170, 96, - 38, 67, 211, 123, 21, 165, 165, 90, 11, 229, 204, 79, 253, 55, 244, - 147, 41, 18, 223, 123, 137, 169, 162, 105, 61, 252, 165, 194, 31, 221, - 235, 168, 86, 74, 62, 252, 193, 146, 36, 181, 69, 11, 153, 180, 205, - 243, 252, 107, 249, 218, 202, 232, 143, 69, 62, 251, 165, 119, 15, 185, - 248, 191, 113, 1, 234, 211, 129, 242, 219, 106, 39, 21, 58, 223, 227, - 177, 242, 31, 177, 53, 106, 11, 115, 110, 19, 38, 202, 29, 187, 207, - 213, 218, 204, 164, 116, 141, 179, 63, 112, 207, 179, 143, 61, 25, 154, - 93, 24, 165, 131, 230, 253, 61, 255, 116, 165, 131, 34, 43, 211, 63, - 210, 211, 193, 241, 41, 39, 107, 17, 29, 204, 30, 253, 241, 199, 68, - 7, 185, 175, 76, 253, 88, 79, 7, 33, 213, 30, 125, 76, 116, 64, - 104, 212, 1, 123, 46, 214, 1, 218, 173, 158, 14, 90, 191, 163, 131, - 194, 154, 14, 106, 82, 126, 209, 160, 3, 203, 234, 111, 26, 102, 213, - 65, 41, 208, 193, 65, 123, 77, 225, 220, 34, 79, 222, 30, 114, 190, - 239, 2, 236, 68, 7, 139, 6, 36, 40, 116, 41, 208, 193, 196, 37, - 87, 197, 123, 49, 160, 131, 169, 21, 62, 167, 117, 129, 132, 70, 29, - 176, 231, 98, 29, 32, 174, 156, 117, 96, 229, 230, 234, 42, 173, 218, - 1, 211, 201, 18, 147, 3, 116, 112, 17, 116, 112, 209, 201, 14, 250, - 86, 177, 154, 153, 14, 84, 26, 237, 32, 223, 3, 113, 46, 23, 237, - 96, 44, 229, 63, 80, 62, 221, 89, 109, 239, 3, 58, 88, 27, 38, - 206, 33, 163, 29, 124, 228, 59, 142, 214, 186, 17, 26, 117, 192, 158, - 235, 172, 207, 65, 7, 244, 123, 115, 83, 6, 123, 135, 54, 17, 197, - 128, 58, 206, 49, 96, 58, 180, 159, 54, 88, 63, 6, 64, 59, 234, - 59, 167, 51, 95, 150, 49, 117, 176, 155, 49, 192, 245, 92, 0, 241, - 78, 125, 39, 39, 195, 1, 239, 228, 208, 228, 88, 5, 50, 156, 99, - 128, 107, 25, 136, 39, 58, 142, 105, 220, 56, 128, 38, 99, 241, 157, - 234, 110, 12, 112, 45, 3, 237, 149, 142, 131, 147, 97, 210, 100, 226, - 127, 19, 167, 184, 27, 3, 92, 203, 64, 123, 160, 181, 105, 83, 7, - 59, 213, 126, 49, 191, 105, 53, 19, 122, 66, 176, 205, 34, 242, 167, - 78, 181, 105, 89, 248, 49, 31, 100, 53, 19, 26, 249, 137, 124, 147, - 83, 109, 90, 22, 126, 12, 207, 86, 51, 161, 199, 3, 63, 17, 206, - 157, 238, 161, 156, 226, 204, 143, 97, 195, 106, 38, 52, 190, 159, 8, - 51, 252, 188, 9, 113, 66, 115, 90, 227, 193, 14, 184, 248, 252, 46, - 102, 234, 58, 97, 38, 113, 242, 96, 111, 255, 73, 250, 152, 193, 118, - 116, 29, 48, 153, 241, 79, 154, 104, 28, 102, 252, 57, 25, 137, 240, - 78, 137, 154, 28, 203, 68, 227, 48, 131, 124, 233, 56, 128, 38, 99, - 73, 159, 96, 28, 102, 252, 39, 57, 99, 6, 101, 42, 235, 244, 9, - 198, 97, 6, 245, 78, 108, 40, 209, 242, 177, 75, 204, 36, 172, 91, - 237, 54, 102, 44, 89, 248, 185, 194, 12, 242, 115, 23, 51, 168, 79, - 122, 159, 23, 240, 115, 133, 25, 228, 231, 46, 102, 66, 39, 56, 191, - 159, 43, 204, 32, 63, 119, 49, 131, 56, 161, 57, 45, 43, 216, 193, - 20, 17, 102, 254, 231, 132, 153, 80, 232, 235, 136, 211, 199, 12, 182, - 163, 49, 32, 158, 241, 143, 136, 51, 14, 51, 200, 151, 198, 0, 160, - 81, 166, 210, 40, 206, 56, 204, 132, 114, 50, 112, 220, 100, 44, 9, - 177, 198, 97, 6, 249, 58, 229, 180, 52, 25, 254, 177, 198, 97, 6, - 245, 158, 83, 204, 56, 229, 180, 226, 114, 142, 25, 167, 156, 86, 108, - 206, 49, 227, 148, 211, 138, 205, 57, 102, 156, 114, 90, 86, 134, 153, - 144, 63, 192, 14, 198, 139, 48, 243, 137, 115, 156, 249, 19, 48, 182, - 198, 141, 56, 243, 39, 231, 159, 255, 100, 252, 3, 172, 57, 195, 140, - 83, 222, 140, 147, 145, 8, 239, 148, 168, 201, 73, 90, 157, 51, 204, - 56, 141, 99, 13, 55, 14, 160, 201, 88, 44, 171, 115, 134, 25, 167, - 113, 172, 201, 18, 103, 214, 104, 177, 236, 143, 156, 97, 134, 172, 207, - 131, 52, 189, 19, 27, 178, 134, 122, 167, 189, 4, 61, 103, 93, 151, - 89, 146, 42, 89, 94, 214, 187, 188, 46, 187, 181, 169, 83, 77, 245, - 106, 103, 126, 107, 64, 167, 174, 248, 173, 153, 144, 127, 189, 59, 252, - 44, 28, 191, 209, 109, 188, 211, 170, 159, 78, 125, 103, 191, 100, 244, - 230, 74, 150, 230, 207, 130, 27, 102, 183, 110, 116, 138, 91, 127, 56, - 191, 31, 234, 42, 235, 26, 172, 47, 188, 95, 239, 248, 152, 108, 215, - 96, 78, 53, 213, 127, 112, 152, 249, 5, 108, 205, 42, 194, 204, 167, - 78, 152, 73, 95, 53, 216, 59, 100, 165, 62, 102, 176, 29, 173, 69, - 94, 197, 197, 153, 229, 238, 98, 198, 91, 215, 214, 66, 56, 25, 233, - 240, 78, 233, 154, 156, 132, 223, 221, 197, 140, 190, 12, 228, 75, 199, - 1, 52, 25, 75, 210, 82, 119, 49, 227, 198, 56, 86, 58, 99, 6, - 101, 42, 255, 253, 197, 93, 204, 120, 11, 49, 179, 212, 67, 213, 123, - 21, 165, 165, 90, 235, 230, 42, 151, 129, 103, 42, 249, 222, 165, 193, - 30, 235, 194, 95, 51, 46, 159, 147, 214, 58, 211, 82, 207, 190, 43, - 137, 156, 169, 108, 250, 222, 0, 37, 46, 249, 159, 234, 46, 237, 107, - 88, 176, 14, 233, 219, 13, 250, 12, 131, 191, 73, 92, 223, 140, 162, - 179, 164, 101, 13, 8, 86, 151, 211, 188, 73, 222, 145, 27, 224, 121, - 246, 88, 85, 207, 99, 238, 144, 74, 62, 41, 190, 129, 156, 49, 148, - 90, 250, 109, 80, 243, 7, 167, 165, 185, 161, 133, 55, 144, 190, 251, - 160, 207, 113, 248, 59, 199, 245, 125, 233, 125, 93, 234, 151, 92, 103, - 61, 57, 175, 183, 238, 253, 117, 107, 145, 202, 61, 246, 153, 84, 169, - 86, 42, 125, 231, 107, 208, 231, 46, 252, 61, 230, 250, 190, 145, 77, - 114, 7, 107, 96, 93, 114, 110, 238, 78, 13, 139, 66, 231, 202, 204, - 43, 119, 236, 222, 180, 46, 233, 251, 10, 251, 120, 84, 52, 229, 243, - 168, 200, 125, 183, 172, 144, 204, 180, 233, 71, 233, 136, 27, 37, 101, - 94, 207, 69, 161, 79, 105, 248, 171, 204, 245, 37, 191, 27, 218, 178, - 81, 191, 219, 129, 27, 219, 214, 146, 223, 237, 242, 15, 105, 31, 147, - 223, 109, 249, 203, 211, 181, 245, 126, 183, 95, 38, 78, 115, 249, 187, - 253, 50, 49, 123, 159, 72, 127, 183, 142, 193, 244, 119, 107, 95, 179, - 30, 253, 221, 42, 214, 175, 171, 251, 187, 249, 207, 109, 72, 127, 183, - 79, 174, 22, 78, 34, 191, 219, 185, 218, 62, 117, 245, 126, 55, 159, - 200, 246, 244, 119, 43, 187, 170, 61, 253, 221, 46, 221, 106, 255, 255, - 254, 187, 161, 127, 32, 191, 219, 160, 234, 174, 127, 183, 204, 63, 245, - 127, 183, 184, 230, 153, 150, 61, 27, 223, 79, 37, 191, 91, 72, 188, - 250, 29, 180, 35, 167, 187, 75, 187, 192, 207, 80, 174, 239, 177, 63, - 122, 142, 251, 253, 89, 82, 200, 201, 84, 123, 214, 223, 173, 208, 168, - 13, 210, 176, 199, 217, 199, 30, 236, 187, 125, 242, 14, 233, 151, 50, - 165, 131, 201, 239, 214, 246, 235, 102, 10, 221, 233, 217, 105, 201, 55, - 169, 127, 48, 251, 221, 204, 240, 187, 53, 131, 223, 173, 37, 237, 91, - 49, 239, 117, 41, 215, 248, 184, 96, 242, 187, 101, 212, 142, 80, 232, - 79, 199, 61, 147, 126, 153, 25, 26, 204, 126, 183, 175, 224, 119, 107, - 5, 191, 91, 11, 218, 247, 10, 252, 110, 77, 203, 149, 9, 38, 191, - 91, 155, 127, 238, 43, 239, 249, 231, 171, 188, 114, 120, 135, 89, 13, - 217, 239, 102, 134, 223, 173, 30, 252, 110, 31, 179, 251, 148, 178, 249, - 221, 198, 252, 135, 223, 13, 125, 46, 249, 221, 102, 41, 120, 123, 55, - 214, 170, 120, 99, 191, 99, 105, 136, 177, 117, 225, 175, 25, 151, 239, - 220, 2, 120, 43, 112, 44, 146, 158, 61, 247, 185, 173, 210, 149, 1, - 111, 222, 30, 236, 236, 121, 55, 211, 121, 192, 219, 121, 192, 219, 121, - 39, 188, 45, 160, 49, 126, 57, 205, 173, 22, 0, 188, 137, 98, 60, - 246, 125, 6, 120, 179, 206, 141, 164, 103, 177, 191, 46, 165, 206, 163, - 115, 3, 222, 14, 254, 203, 190, 101, 182, 15, 228, 29, 135, 95, 237, - 156, 233, 44, 203, 149, 2, 222, 162, 94, 141, 162, 231, 154, 103, 159, - 85, 247, 200, 10, 1, 222, 126, 142, 103, 125, 175, 153, 78, 195, 239, - 118, 6, 126, 183, 51, 12, 171, 240, 187, 253, 86, 52, 138, 158, 47, - 206, 223, 80, 203, 203, 2, 222, 102, 239, 101, 239, 252, 10, 199, 233, - 113, 1, 126, 55, 246, 206, 153, 202, 239, 102, 53, 179, 223, 77, 165, - 135, 40, 191, 27, 211, 115, 81, 232, 83, 26, 254, 42, 115, 125, 233, - 156, 230, 23, 46, 223, 180, 8, 226, 244, 31, 162, 57, 77, 61, 231, - 57, 205, 207, 208, 62, 209, 141, 57, 205, 207, 220, 92, 224, 103, 46, - 223, 180, 196, 184, 181, 115, 8, 39, 35, 29, 222, 41, 93, 147, 99, - 89, 98, 220, 218, 25, 249, 210, 113, 0, 77, 198, 146, 190, 216, 184, - 181, 115, 72, 98, 150, 57, 77, 162, 150, 111, 90, 108, 96, 190, 105, - 137, 193, 249, 166, 37, 6, 231, 155, 22, 27, 156, 111, 90, 108, 112, - 190, 105, 17, 151, 111, 250, 17, 236, 224, 23, 17, 102, 234, 59, 231, - 155, 160, 175, 99, 129, 27, 249, 166, 69, 92, 158, 102, 33, 183, 14, - 88, 96, 96, 190, 105, 33, 151, 111, 2, 26, 101, 42, 141, 22, 24, - 152, 111, 226, 100, 224, 184, 201, 88, 18, 126, 50, 48, 223, 180, 32, - 75, 190, 73, 147, 225, 255, 147, 129, 249, 166, 5, 6, 231, 155, 22, - 24, 156, 111, 250, 201, 224, 124, 211, 79, 6, 231, 155, 126, 100, 152, - 9, 253, 30, 236, 96, 145, 0, 51, 181, 3, 156, 48, 227, 15, 125, - 19, 231, 233, 99, 6, 219, 209, 92, 208, 124, 46, 223, 52, 47, 103, - 152, 57, 219, 173, 100, 29, 154, 11, 154, 207, 229, 130, 128, 70, 153, - 202, 25, 170, 31, 114, 134, 153, 201, 223, 140, 11, 160, 227, 224, 100, - 224, 184, 201, 88, 66, 126, 200, 25, 102, 30, 157, 63, 196, 206, 80, - 205, 115, 198, 140, 191, 38, 195, 241, 125, 206, 48, 51, 231, 195, 254, - 44, 223, 52, 111, 112, 182, 103, 87, 81, 167, 255, 245, 44, 44, 234, - 56, 59, 126, 168, 191, 255, 202, 47, 68, 192, 15, 117, 245, 95, 249, - 161, 238, 178, 227, 135, 122, 249, 175, 103, 117, 17, 39, 116, 255, 124, - 54, 216, 193, 143, 34, 204, 100, 57, 67, 53, 23, 252, 249, 119, 110, - 236, 159, 207, 229, 98, 192, 92, 110, 255, 124, 142, 129, 251, 231, 156, - 12, 7, 188, 147, 67, 147, 99, 157, 99, 224, 254, 249, 119, 220, 56, - 128, 38, 99, 241, 157, 99, 224, 254, 249, 119, 89, 246, 207, 191, 211, - 246, 207, 103, 27, 184, 127, 62, 199, 216, 56, 99, 157, 99, 108, 156, - 241, 157, 99, 108, 156, 65, 221, 25, 25, 103, 16, 39, 4, 51, 233, - 153, 96, 7, 223, 139, 48, 227, 124, 230, 36, 49, 1, 48, 246, 198, - 141, 125, 141, 4, 206, 63, 191, 229, 226, 76, 130, 113, 152, 65, 190, - 52, 206, 0, 157, 168, 241, 14, 120, 99, 28, 102, 252, 57, 25, 56, - 110, 50, 150, 180, 215, 198, 97, 6, 249, 58, 197, 25, 77, 70, 200, - 107, 227, 48, 131, 122, 55, 114, 61, 131, 58, 54, 114, 61, 131, 250, - 52, 114, 61, 19, 242, 218, 216, 245, 12, 226, 132, 126, 43, 246, 1, - 204, 105, 102, 187, 192, 204, 160, 222, 195, 187, 247, 236, 62, 52, 98, - 196, 48, 211, 192, 222, 97, 236, 123, 217, 208, 55, 253, 229, 96, 239, - 176, 176, 48, 115, 88, 88, 30, 203, 154, 102, 151, 236, 159, 95, 250, - 233, 221, 187, 116, 51, 185, 245, 249, 43, 198, 223, 250, 60, 123, 59, - 152, 112, 102, 146, 253, 113, 225, 47, 27, 138, 238, 209, 249, 169, 204, - 109, 250, 221, 75, 228, 75, 215, 231, 64, 163, 76, 5, 51, 79, 179, - 151, 177, 183, 247, 123, 182, 85, 61, 31, 11, 239, 209, 185, 121, 98, - 62, 149, 17, 194, 201, 192, 113, 147, 177, 56, 30, 101, 47, 227, 243, - 97, 37, 182, 126, 187, 196, 203, 44, 186, 71, 167, 242, 161, 85, 236, - 155, 228, 47, 157, 49, 19, 162, 201, 72, 120, 144, 189, 140, 82, 126, - 157, 204, 147, 14, 91, 133, 247, 232, 36, 189, 141, 160, 247, 232, 160, - 222, 249, 123, 11, 80, 143, 132, 31, 161, 27, 111, 152, 43, 177, 231, - 174, 115, 165, 255, 182, 170, 47, 223, 170, 116, 147, 222, 163, 67, 218, - 123, 217, 91, 203, 83, 99, 111, 11, 191, 135, 231, 221, 168, 157, 156, - 80, 207, 91, 203, 77, 126, 43, 155, 11, 238, 83, 218, 23, 179, 119, - 146, 155, 172, 152, 32, 236, 123, 71, 14, 149, 187, 228, 253, 137, 222, - 139, 210, 106, 240, 32, 133, 174, 26, 29, 38, 87, 111, 47, 254, 118, - 214, 213, 216, 126, 242, 145, 25, 191, 4, 145, 115, 145, 53, 186, 223, - 85, 232, 7, 81, 225, 178, 189, 120, 153, 134, 194, 115, 145, 177, 67, - 228, 33, 94, 126, 90, 155, 225, 114, 231, 153, 197, 20, 218, 35, 122, - 164, 220, 184, 68, 73, 97, 223, 55, 177, 99, 228, 252, 65, 37, 180, - 54, 145, 114, 175, 194, 106, 95, 188, 23, 165, 184, 173, 176, 78, 223, - 120, 185, 250, 180, 92, 90, 155, 137, 114, 212, 239, 38, 77, 238, 100, - 121, 105, 252, 43, 157, 239, 14, 78, 147, 67, 234, 121, 53, 164, 103, - 122, 53, 26, 239, 45, 96, 207, 179, 143, 211, 104, 47, 136, 33, 222, - 94, 16, 19, 196, 94, 8, 253, 1, 216, 11, 123, 238, 218, 94, 150, - 130, 189, 148, 108, 204, 206, 244, 146, 246, 69, 192, 94, 172, 189, 26, - 9, 199, 113, 87, 110, 39, 143, 250, 59, 130, 222, 163, 179, 241, 151, - 85, 42, 13, 246, 82, 237, 210, 5, 225, 111, 94, 160, 81, 168, 60, - 122, 243, 110, 106, 47, 141, 38, 170, 223, 16, 44, 10, 246, 114, 188, - 236, 10, 225, 247, 165, 238, 128, 189, 132, 109, 79, 160, 246, 146, 59, - 237, 128, 66, 63, 3, 123, 137, 232, 34, 214, 95, 38, 216, 203, 210, - 145, 175, 131, 136, 189, 52, 145, 94, 104, 223, 169, 28, 41, 223, 202, - 255, 36, 72, 207, 94, 6, 109, 62, 19, 68, 236, 229, 121, 165, 131, - 65, 234, 111, 110, 149, 139, 188, 90, 27, 164, 103, 47, 207, 58, 206, - 10, 34, 246, 242, 116, 198, 116, 77, 238, 100, 249, 73, 218, 20, 93, - 123, 233, 208, 61, 41, 136, 216, 11, 161, 209, 94, 216, 115, 177, 189, - 160, 63, 36, 246, 242, 20, 236, 5, 253, 27, 177, 23, 66, 183, 254, - 115, 174, 196, 158, 187, 182, 151, 118, 82, 125, 249, 178, 119, 222, 173, - 196, 94, 72, 123, 219, 214, 214, 178, 215, 182, 121, 194, 57, 102, 181, - 198, 237, 228, 184, 106, 31, 167, 18, 123, 57, 59, 106, 129, 178, 167, - 147, 23, 236, 165, 220, 240, 197, 194, 113, 52, 50, 135, 202, 215, 35, - 66, 130, 137, 189, 60, 171, 242, 133, 66, 15, 141, 13, 147, 35, 155, - 53, 14, 22, 245, 45, 26, 215, 79, 78, 255, 170, 127, 67, 98, 47, - 143, 182, 91, 21, 91, 27, 7, 246, 210, 52, 98, 163, 240, 236, 249, - 11, 176, 151, 191, 31, 125, 64, 239, 224, 73, 63, 170, 214, 239, 44, - 142, 26, 41, 215, 105, 187, 64, 56, 222, 17, 49, 99, 228, 227, 215, - 211, 233, 61, 58, 169, 239, 95, 84, 232, 208, 40, 171, 188, 178, 245, - 43, 97, 223, 253, 96, 47, 133, 139, 31, 165, 247, 232, 120, 14, 82, - 191, 17, 245, 44, 106, 178, 188, 110, 199, 118, 97, 223, 215, 96, 47, - 157, 87, 236, 160, 231, 229, 9, 189, 5, 236, 133, 61, 23, 219, 11, - 198, 54, 222, 191, 96, 172, 34, 246, 66, 232, 2, 224, 95, 216, 243, - 108, 236, 5, 252, 203, 194, 164, 94, 244, 188, 60, 105, 95, 17, 252, - 203, 141, 17, 195, 132, 107, 136, 83, 224, 95, 252, 102, 70, 209, 123, - 116, 70, 251, 107, 223, 1, 2, 123, 9, 235, 32, 254, 14, 208, 51, - 136, 71, 39, 38, 143, 165, 247, 232, 252, 252, 84, 165, 125, 208, 191, - 152, 197, 107, 151, 167, 224, 95, 106, 159, 138, 161, 231, 244, 175, 237, - 86, 233, 247, 163, 195, 229, 249, 155, 196, 103, 252, 63, 140, 27, 34, - 207, 49, 69, 209, 59, 120, 124, 38, 168, 123, 79, 181, 193, 191, 156, - 203, 59, 92, 216, 119, 21, 248, 151, 19, 91, 251, 210, 123, 116, 62, - 175, 172, 126, 203, 231, 14, 216, 139, 207, 189, 80, 241, 120, 193, 94, - 174, 127, 221, 143, 222, 163, 99, 127, 170, 229, 55, 192, 191, 204, 152, - 55, 80, 247, 30, 157, 158, 157, 7, 210, 218, 2, 66, 163, 127, 97, - 207, 197, 235, 60, 156, 167, 210, 125, 171, 43, 48, 15, 203, 20, 206, - 89, 157, 238, 209, 73, 200, 128, 181, 206, 61, 253, 57, 43, 182, 163, - 235, 163, 251, 140, 191, 239, 157, 236, 231, 97, 101, 194, 174, 219, 251, - 87, 92, 162, 205, 89, 125, 92, 206, 195, 70, 221, 236, 72, 235, 37, - 145, 47, 93, 231, 1, 141, 50, 21, 110, 183, 178, 151, 113, 164, 198, - 14, 219, 249, 182, 185, 181, 57, 171, 107, 25, 119, 30, 70, 179, 154, - 76, 78, 6, 142, 155, 140, 37, 227, 122, 246, 50, 26, 46, 121, 158, - 250, 252, 211, 66, 218, 156, 213, 181, 140, 67, 121, 87, 179, 117, 222, - 189, 44, 235, 60, 77, 70, 232, 213, 236, 101, 124, 17, 217, 217, 252, - 73, 53, 50, 103, 117, 45, 163, 229, 37, 117, 206, 250, 173, 167, 170, - 247, 42, 74, 75, 213, 71, 160, 30, 9, 63, 66, 55, 5, 31, 193, - 158, 187, 246, 17, 15, 193, 71, 212, 26, 58, 135, 222, 229, 71, 218, - 227, 93, 91, 145, 101, 90, 136, 191, 23, 9, 62, 226, 117, 211, 175, - 82, 136, 143, 104, 118, 234, 134, 66, 207, 7, 31, 49, 33, 164, 174, - 176, 239, 16, 152, 131, 172, 9, 78, 166, 115, 144, 106, 107, 213, 111, - 122, 158, 43, 217, 79, 46, 249, 105, 9, 225, 60, 34, 58, 223, 96, - 249, 155, 55, 63, 208, 187, 31, 115, 159, 235, 167, 126, 43, 49, 112, - 132, 220, 56, 126, 147, 112, 254, 210, 59, 109, 164, 188, 254, 228, 66, - 173, 205, 104, 121, 164, 237, 119, 133, 190, 16, 60, 70, 238, 185, 48, - 73, 216, 247, 69, 218, 88, 185, 227, 123, 151, 82, 136, 143, 88, 18, - 121, 88, 251, 134, 179, 85, 126, 17, 60, 37, 69, 28, 23, 226, 229, - 146, 77, 170, 211, 57, 136, 169, 127, 73, 117, 14, 98, 158, 36, 15, - 206, 44, 44, 140, 191, 111, 211, 38, 203, 249, 239, 221, 214, 190, 67, - 58, 85, 254, 242, 135, 154, 218, 247, 64, 167, 201, 15, 219, 92, 215, - 249, 30, 232, 116, 185, 195, 179, 33, 244, 30, 64, 66, 159, 27, 51, - 139, 123, 158, 125, 60, 66, 91, 67, 252, 241, 182, 134, 120, 34, 182, - 70, 104, 92, 31, 177, 231, 174, 109, 237, 14, 216, 90, 239, 173, 54, - 106, 107, 164, 61, 174, 143, 102, 68, 132, 137, 191, 129, 13, 182, 86, - 38, 113, 52, 181, 181, 60, 221, 230, 40, 116, 2, 216, 90, 253, 33, - 203, 133, 58, 24, 0, 182, 38, 255, 251, 34, 133, 216, 218, 230, 146, - 223, 43, 250, 158, 14, 182, 118, 230, 94, 71, 161, 173, 13, 6, 91, - 91, 85, 176, 1, 157, 179, 94, 217, 84, 87, 225, 147, 6, 182, 22, - 168, 243, 29, 107, 180, 181, 223, 87, 63, 165, 182, 182, 97, 134, 122, - 239, 37, 218, 218, 212, 13, 181, 133, 227, 125, 14, 182, 214, 43, 45, - 148, 222, 27, 249, 143, 173, 55, 189, 55, 242, 227, 53, 99, 108, 122, - 243, 221, 158, 61, 167, 179, 123, 35, 15, 253, 160, 217, 203, 36, 185, - 99, 174, 133, 41, 122, 182, 54, 232, 48, 185, 159, 115, 170, 252, 253, - 46, 139, 141, 216, 90, 74, 74, 127, 155, 158, 173, 245, 45, 60, 159, - 218, 26, 161, 209, 214, 216, 115, 177, 173, 161, 31, 230, 109, 13, 253, - 42, 177, 53, 66, 127, 6, 182, 198, 158, 187, 182, 181, 221, 96, 107, - 109, 98, 182, 164, 18, 91, 35, 237, 243, 227, 29, 130, 83, 87, 166, - 138, 215, 71, 237, 228, 129, 167, 151, 210, 185, 114, 249, 197, 139, 82, - 137, 173, 45, 237, 254, 131, 176, 111, 39, 176, 181, 133, 62, 211, 232, - 157, 147, 99, 91, 171, 237, 159, 23, 239, 39, 167, 172, 250, 77, 216, - 183, 58, 216, 218, 155, 58, 243, 232, 124, 247, 7, 191, 57, 10, 125, - 28, 108, 237, 238, 161, 4, 97, 223, 126, 96, 107, 117, 75, 37, 208, - 59, 39, 107, 254, 79, 165, 255, 5, 91, 123, 191, 149, 184, 111, 221, - 109, 99, 229, 204, 148, 185, 116, 174, 188, 249, 196, 76, 133, 126, 5, - 182, 86, 175, 91, 184, 176, 239, 75, 107, 188, 60, 111, 144, 143, 157, - 216, 218, 141, 165, 234, 119, 110, 75, 91, 38, 201, 182, 22, 237, 133, - 243, 251, 122, 219, 38, 203, 55, 254, 45, 155, 74, 108, 173, 119, 195, - 46, 10, 237, 13, 182, 182, 185, 229, 76, 161, 92, 159, 109, 211, 229, - 127, 159, 237, 164, 243, 108, 66, 223, 0, 91, 99, 207, 197, 182, 134, - 241, 152, 183, 53, 140, 175, 196, 214, 8, 221, 4, 108, 141, 61, 119, - 109, 107, 247, 192, 214, 2, 54, 132, 211, 121, 54, 105, 143, 49, 116, - 75, 200, 16, 221, 251, 42, 87, 44, 25, 78, 231, 217, 87, 103, 170, - 243, 242, 197, 96, 107, 143, 162, 134, 10, 251, 14, 199, 24, 90, 51, - 156, 206, 179, 151, 254, 161, 242, 49, 131, 95, 155, 54, 93, 124, 127, - 99, 119, 176, 181, 34, 139, 70, 210, 185, 114, 163, 78, 35, 20, 122, - 39, 216, 218, 151, 249, 71, 8, 251, 134, 129, 173, 181, 152, 50, 130, - 222, 87, 89, 103, 137, 74, 163, 95, 203, 191, 81, 220, 247, 37, 248, - 181, 220, 237, 70, 208, 121, 118, 129, 67, 42, 237, 13, 182, 86, 243, - 175, 81, 186, 243, 236, 57, 19, 99, 232, 60, 187, 202, 95, 42, 237, - 13, 126, 237, 254, 65, 241, 218, 160, 32, 216, 218, 209, 41, 68, 39, - 83, 101, 243, 125, 245, 44, 90, 49, 176, 181, 166, 237, 196, 223, 174, - 244, 4, 91, 235, 86, 143, 205, 209, 9, 125, 22, 108, 141, 61, 23, - 207, 209, 113, 94, 78, 230, 232, 1, 23, 129, 126, 160, 55, 71, 103, - 247, 246, 133, 66, 95, 199, 37, 253, 57, 58, 182, 163, 123, 139, 151, - 185, 115, 50, 151, 220, 205, 43, 103, 179, 79, 82, 207, 171, 33, 221, - 91, 188, 204, 237, 45, 2, 141, 50, 149, 70, 151, 220, 205, 43, 187, - 150, 129, 185, 20, 58, 14, 78, 6, 142, 155, 140, 37, 193, 225, 110, - 94, 217, 181, 12, 92, 127, 211, 113, 92, 202, 114, 78, 70, 147, 145, - 116, 209, 221, 188, 178, 107, 25, 184, 102, 163, 231, 100, 46, 101, 169, - 215, 165, 249, 69, 171, 153, 208, 120, 247, 163, 40, 239, 232, 244, 29, - 200, 44, 252, 88, 254, 201, 106, 38, 52, 242, 19, 229, 165, 156, 190, - 3, 233, 112, 230, 199, 242, 19, 86, 51, 161, 145, 159, 40, 111, 225, - 84, 3, 115, 209, 153, 31, 91, 191, 90, 205, 132, 70, 126, 162, 117, - 45, 191, 23, 163, 224, 68, 227, 151, 113, 6, 236, 224, 138, 30, 102, - 216, 189, 125, 73, 23, 6, 123, 7, 156, 215, 199, 12, 182, 35, 118, - 16, 112, 129, 241, 79, 59, 231, 238, 186, 54, 27, 123, 134, 185, 53, - 145, 17, 192, 201, 72, 130, 119, 74, 210, 228, 132, 156, 115, 119, 93, - 235, 90, 6, 206, 169, 232, 56, 206, 115, 227, 0, 154, 140, 197, 113, - 214, 221, 117, 173, 107, 25, 24, 75, 233, 56, 206, 59, 99, 6, 101, - 42, 254, 229, 172, 187, 235, 90, 215, 50, 208, 135, 210, 253, 193, 115, - 89, 108, 156, 174, 81, 192, 198, 53, 250, 69, 35, 176, 113, 193, 218, - 197, 105, 127, 48, 11, 63, 54, 15, 181, 154, 9, 141, 252, 68, 243, - 83, 167, 115, 45, 103, 157, 249, 177, 185, 134, 213, 76, 104, 228, 39, - 154, 131, 240, 252, 34, 178, 240, 99, 241, 196, 106, 38, 52, 242, 19, - 197, 25, 30, 51, 136, 19, 130, 153, 164, 147, 96, 7, 23, 245, 48, - 195, 238, 237, 139, 128, 190, 25, 167, 244, 49, 131, 237, 136, 29, 100, - 156, 230, 246, 47, 79, 25, 23, 103, 144, 47, 145, 17, 1, 52, 202, - 84, 242, 77, 167, 140, 139, 51, 17, 156, 12, 28, 55, 25, 75, 226, - 63, 198, 197, 25, 228, 203, 99, 38, 66, 147, 17, 240, 143, 113, 113, - 6, 245, 206, 127, 175, 202, 85, 156, 193, 239, 85, 185, 27, 103, 124, - 179, 240, 115, 21, 103, 144, 159, 187, 113, 6, 245, 73, 249, 229, 137, - 76, 117, 21, 103, 252, 129, 159, 187, 113, 38, 224, 31, 231, 247, 115, - 21, 103, 240, 253, 220, 141, 51, 136, 19, 130, 153, 136, 163, 96, 7, - 103, 244, 48, 195, 238, 237, 11, 128, 190, 73, 199, 245, 49, 131, 237, - 104, 12, 56, 193, 248, 91, 142, 27, 23, 103, 144, 47, 141, 1, 64, - 163, 76, 108, 147, 126, 204, 184, 56, 19, 192, 201, 192, 113, 147, 177, - 132, 30, 51, 46, 206, 32, 95, 30, 51, 1, 154, 140, 140, 163, 198, - 197, 25, 212, 59, 181, 161, 183, 105, 193, 174, 226, 140, 105, 212, 5, - 179, 187, 113, 6, 117, 204, 243, 115, 21, 103, 144, 159, 187, 113, 38, - 148, 231, 119, 40, 45, 216, 85, 156, 177, 134, 93, 48, 187, 27, 103, - 80, 119, 148, 223, 203, 180, 96, 87, 113, 198, 50, 226, 130, 217, 221, - 56, 131, 56, 161, 123, 14, 7, 193, 14, 78, 234, 97, 230, 83, 250, - 123, 100, 28, 1, 127, 158, 174, 143, 25, 108, 71, 99, 192, 17, 174, - 86, 230, 176, 113, 113, 38, 130, 147, 145, 1, 239, 148, 161, 201, 177, - 28, 54, 46, 206, 32, 95, 58, 14, 160, 201, 88, 210, 15, 25, 23, - 103, 34, 210, 157, 49, 131, 50, 21, 92, 30, 50, 46, 206, 160, 222, - 115, 26, 103, 248, 243, 142, 150, 195, 57, 143, 51, 60, 63, 212, 103, - 78, 227, 12, 207, 47, 244, 80, 206, 227, 140, 83, 14, 224, 32, 87, - 43, 179, 23, 236, 224, 168, 30, 102, 184, 187, 32, 160, 175, 99, 191, - 27, 57, 128, 131, 220, 218, 249, 0, 151, 3, 216, 111, 92, 156, 65, - 190, 52, 7, 0, 52, 202, 84, 26, 237, 55, 46, 206, 132, 114, 50, - 112, 220, 100, 44, 9, 251, 140, 139, 51, 200, 215, 41, 7, 160, 201, - 240, 223, 103, 92, 156, 65, 189, 231, 52, 206, 240, 54, 105, 218, 159, - 243, 56, 195, 243, 67, 125, 230, 52, 206, 240, 252, 252, 247, 229, 60, - 206, 240, 152, 65, 156, 208, 90, 153, 93, 96, 7, 7, 245, 48, 195, - 221, 5, 1, 125, 19, 119, 235, 99, 6, 219, 209, 61, 225, 61, 220, - 25, 230, 221, 57, 139, 51, 252, 121, 76, 228, 75, 247, 182, 129, 70, - 153, 74, 158, 225, 239, 156, 197, 25, 254, 60, 166, 63, 39, 3, 199, - 77, 198, 18, 242, 119, 206, 226, 12, 127, 30, 19, 249, 58, 237, 109, - 107, 50, 28, 187, 114, 22, 103, 200, 121, 204, 32, 77, 239, 244, 158, - 239, 139, 5, 183, 162, 158, 179, 158, 199, 244, 191, 178, 204, 92, 185, - 244, 158, 108, 207, 215, 57, 157, 57, 254, 155, 227, 183, 183, 224, 86, - 212, 105, 214, 243, 122, 25, 142, 101, 230, 78, 19, 39, 186, 197, 47, - 132, 227, 151, 56, 162, 252, 86, 212, 97, 214, 243, 92, 105, 211, 86, - 152, 151, 127, 60, 59, 213, 29, 126, 168, 59, 138, 153, 214, 133, 182, - 166, 219, 122, 189, 115, 222, 39, 228, 222, 50, 243, 200, 97, 195, 204, - 34, 126, 180, 86, 102, 23, 87, 43, 179, 13, 236, 96, 175, 30, 102, - 184, 187, 32, 118, 130, 63, 223, 161, 143, 25, 108, 71, 99, 192, 78, - 174, 86, 102, 123, 206, 226, 12, 127, 30, 36, 148, 147, 225, 128, 119, - 114, 104, 114, 172, 219, 115, 22, 103, 248, 243, 32, 200, 151, 142, 3, - 104, 50, 22, 223, 237, 57, 139, 51, 252, 121, 144, 208, 29, 89, 106, - 101, 118, 104, 121, 134, 109, 57, 139, 51, 228, 60, 72, 144, 166, 119, - 250, 125, 159, 212, 130, 91, 215, 108, 59, 242, 206, 121, 16, 199, 197, - 101, 230, 168, 189, 117, 108, 238, 216, 164, 149, 227, 103, 217, 86, 112, - 107, 207, 197, 97, 239, 236, 249, 251, 3, 102, 218, 220, 140, 117, 139, - 159, 47, 199, 47, 241, 203, 66, 91, 23, 95, 158, 241, 206, 190, 174, - 227, 238, 50, 243, 210, 70, 235, 221, 194, 12, 234, 142, 242, 59, 83, - 112, 107, 80, 167, 145, 239, 236, 221, 37, 93, 94, 102, 190, 189, 103, - 176, 91, 152, 65, 156, 80, 204, 164, 130, 29, 236, 210, 193, 12, 119, - 23, 68, 98, 26, 96, 44, 85, 31, 51, 216, 142, 250, 231, 173, 140, - 255, 158, 201, 159, 187, 25, 103, 138, 184, 180, 131, 136, 30, 149, 183, - 80, 25, 91, 185, 56, 3, 52, 202, 84, 226, 196, 223, 69, 114, 185, - 23, 103, 92, 203, 8, 121, 156, 212, 128, 198, 25, 78, 6, 142, 155, - 140, 229, 243, 205, 205, 221, 140, 51, 174, 101, 212, 158, 158, 196, 206, - 130, 165, 102, 137, 51, 68, 198, 169, 236, 199, 225, 28, 103, 92, 203, - 216, 156, 17, 163, 96, 166, 158, 151, 170, 247, 42, 74, 75, 147, 105, - 118, 141, 15, 211, 80, 143, 132, 31, 161, 241, 59, 29, 236, 185, 106, - 59, 13, 76, 37, 157, 246, 127, 119, 180, 206, 180, 200, 95, 84, 165, - 119, 102, 159, 27, 49, 77, 161, 111, 71, 132, 73, 127, 61, 223, 35, - 60, 3, 158, 103, 202, 2, 137, 197, 183, 229, 180, 198, 160, 78, 244, - 74, 73, 20, 223, 148, 125, 201, 184, 213, 82, 242, 163, 10, 90, 155, - 36, 105, 127, 254, 79, 26, 168, 231, 145, 214, 73, 93, 218, 230, 23, - 158, 197, 41, 31, 183, 81, 10, 89, 58, 155, 222, 153, 93, 225, 167, - 59, 54, 245, 156, 101, 178, 180, 97, 127, 37, 187, 168, 239, 79, 177, - 118, 105, 79, 106, 172, 214, 38, 77, 218, 125, 96, 188, 93, 61, 103, - 185, 93, 66, 123, 21, 245, 61, 17, 187, 75, 90, 178, 184, 190, 214, - 102, 143, 180, 54, 185, 162, 93, 61, 103, 185, 79, 242, 57, 157, 95, - 216, 215, 39, 238, 160, 212, 254, 223, 146, 90, 155, 116, 233, 155, 47, - 189, 213, 179, 6, 209, 71, 165, 216, 144, 91, 194, 241, 158, 141, 61, - 33, 5, 214, 251, 134, 222, 153, 61, 165, 126, 144, 66, 231, 143, 62, - 35, 221, 14, 172, 40, 236, 251, 52, 246, 188, 212, 182, 219, 50, 122, - 103, 246, 217, 37, 59, 20, 250, 85, 212, 101, 105, 211, 197, 139, 194, - 190, 120, 103, 182, 229, 147, 123, 90, 155, 155, 210, 135, 141, 30, 105, - 231, 120, 110, 75, 69, 218, 60, 23, 246, 53, 197, 221, 149, 174, 36, - 60, 210, 218, 100, 72, 251, 54, 95, 87, 207, 75, 69, 63, 148, 22, - 56, 78, 235, 200, 125, 34, 157, 136, 252, 75, 107, 243, 92, 58, 125, - 86, 187, 83, 60, 250, 165, 148, 209, 96, 145, 176, 175, 71, 220, 107, - 201, 81, 105, 41, 105, 35, 55, 79, 248, 78, 61, 19, 104, 246, 144, - 39, 100, 198, 137, 229, 166, 121, 202, 213, 126, 39, 119, 69, 123, 201, - 27, 43, 189, 167, 142, 215, 156, 91, 222, 34, 191, 74, 17, 218, 243, - 182, 60, 114, 173, 182, 221, 180, 190, 121, 229, 82, 109, 2, 20, 186, - 144, 57, 159, 60, 172, 133, 135, 80, 238, 243, 52, 31, 185, 111, 224, - 34, 237, 76, 224, 123, 242, 255, 164, 42, 10, 46, 30, 71, 21, 148, - 205, 150, 21, 66, 28, 189, 142, 45, 44, 179, 218, 30, 63, 74, 111, - 121, 84, 76, 214, 171, 249, 33, 190, 4, 253, 43, 239, 75, 208, 95, - 210, 220, 136, 70, 163, 47, 97, 207, 93, 251, 146, 237, 224, 75, 122, - 6, 29, 14, 36, 190, 164, 72, 211, 26, 138, 252, 154, 67, 194, 164, - 208, 204, 8, 225, 187, 252, 5, 190, 132, 205, 109, 151, 211, 250, 147, - 66, 224, 75, 68, 115, 91, 69, 127, 177, 171, 165, 71, 55, 223, 6, - 18, 95, 242, 253, 93, 245, 46, 143, 87, 81, 235, 164, 152, 31, 163, - 235, 139, 109, 109, 163, 84, 179, 177, 103, 10, 241, 37, 81, 237, 99, - 85, 26, 124, 201, 204, 233, 219, 82, 196, 186, 183, 75, 87, 190, 243, - 161, 247, 94, 159, 140, 204, 175, 217, 248, 118, 9, 227, 146, 168, 175, - 87, 220, 46, 233, 246, 194, 11, 41, 196, 151, 68, 122, 70, 164, 168, - 231, 204, 247, 73, 95, 150, 202, 159, 44, 150, 123, 80, 250, 227, 220, - 161, 64, 226, 75, 58, 158, 254, 80, 209, 207, 155, 168, 163, 82, 106, - 163, 161, 58, 186, 58, 33, 213, 172, 65, 106, 166, 78, 73, 111, 146, - 215, 107, 125, 207, 72, 83, 91, 236, 18, 246, 125, 3, 190, 164, 106, - 229, 191, 131, 136, 47, 217, 123, 126, 183, 86, 199, 114, 89, 26, 48, - 111, 175, 78, 223, 107, 210, 225, 26, 187, 131, 136, 47, 41, 56, 123, - 103, 16, 241, 37, 45, 159, 111, 211, 233, 123, 87, 106, 184, 52, 37, - 136, 248, 18, 239, 85, 91, 52, 185, 15, 165, 163, 107, 55, 233, 244, - 125, 34, 213, 140, 39, 109, 158, 75, 91, 126, 222, 162, 201, 125, 41, - 53, 75, 75, 17, 246, 125, 27, 251, 90, 122, 85, 147, 198, 49, 185, - 234, 7, 105, 218, 185, 87, 15, 185, 73, 245, 205, 98, 185, 224, 75, - 236, 210, 119, 65, 196, 151, 36, 183, 85, 227, 170, 9, 124, 201, 142, - 222, 241, 98, 185, 105, 121, 228, 79, 190, 39, 117, 74, 121, 229, 225, - 251, 102, 171, 227, 5, 95, 178, 254, 237, 28, 157, 190, 62, 242, 140, - 244, 25, 65, 196, 151, 60, 49, 205, 212, 198, 91, 80, 222, 217, 125, - 166, 142, 174, 10, 203, 172, 238, 203, 143, 210, 155, 193, 151, 232, 213, - 131, 17, 95, 130, 243, 40, 226, 75, 58, 124, 240, 97, 26, 206, 139, - 136, 47, 33, 244, 124, 240, 37, 236, 57, 241, 37, 197, 157, 248, 133, - 180, 205, 180, 132, 22, 61, 108, 39, 190, 164, 166, 199, 103, 202, 220, - 186, 183, 28, 38, 93, 216, 62, 81, 120, 126, 178, 173, 215, 2, 137, - 173, 107, 151, 211, 218, 36, 219, 252, 149, 146, 104, 93, 139, 125, 63, - 30, 187, 90, 234, 153, 158, 102, 39, 190, 228, 200, 212, 122, 10, 206, - 154, 14, 95, 39, 249, 62, 254, 187, 161, 168, 239, 150, 241, 27, 165, - 15, 255, 173, 25, 76, 124, 73, 174, 80, 171, 66, 143, 141, 73, 150, - 234, 21, 89, 21, 44, 234, 59, 37, 220, 46, 21, 169, 243, 58, 152, - 248, 146, 54, 191, 120, 40, 115, 255, 146, 147, 182, 75, 56, 247, 20, - 245, 237, 99, 221, 37, 253, 240, 227, 223, 193, 196, 151, 196, 253, 182, - 76, 161, 3, 199, 237, 147, 102, 220, 152, 44, 148, 59, 16, 230, 37, - 125, 147, 58, 208, 239, 220, 245, 31, 93, 81, 161, 127, 6, 95, 178, - 40, 250, 164, 112, 188, 115, 198, 158, 144, 130, 71, 215, 165, 190, 228, - 158, 79, 128, 226, 183, 226, 98, 206, 72, 141, 146, 155, 9, 253, 223, - 45, 235, 121, 41, 170, 81, 239, 134, 196, 151, 204, 190, 241, 155, 122, - 166, 40, 242, 178, 228, 99, 58, 45, 148, 219, 27, 124, 73, 191, 93, - 175, 27, 18, 95, 82, 98, 80, 62, 229, 157, 183, 70, 221, 150, 206, - 60, 42, 42, 28, 239, 93, 240, 37, 35, 110, 151, 164, 223, 230, 187, - 100, 47, 174, 208, 18, 248, 146, 42, 179, 223, 23, 246, 237, 23, 247, - 68, 234, 218, 210, 39, 152, 248, 146, 78, 166, 103, 202, 59, 76, 6, - 95, 178, 163, 163, 248, 157, 243, 195, 188, 228, 147, 7, 137, 164, 141, - 252, 145, 105, 136, 66, 191, 13, 246, 144, 79, 149, 241, 23, 246, 45, - 182, 205, 83, 190, 122, 118, 10, 245, 37, 205, 62, 154, 172, 196, 138, - 218, 224, 75, 110, 148, 56, 36, 212, 243, 40, 152, 151, 244, 249, 169, - 149, 157, 248, 146, 66, 125, 127, 81, 232, 209, 224, 75, 58, 254, 121, - 94, 56, 103, 221, 12, 190, 164, 213, 130, 242, 169, 196, 151, 220, 146, - 205, 10, 221, 17, 230, 37, 95, 12, 139, 22, 226, 232, 37, 248, 18, - 86, 19, 232, 71, 233, 83, 224, 75, 244, 106, 5, 169, 47, 57, 197, - 230, 37, 243, 97, 94, 130, 235, 31, 226, 75, 8, 253, 57, 248, 18, - 246, 156, 248, 146, 30, 78, 252, 94, 192, 188, 100, 224, 176, 24, 250, - 45, 194, 77, 199, 212, 58, 174, 147, 131, 195, 164, 9, 23, 70, 9, - 177, 53, 121, 194, 2, 137, 229, 180, 150, 211, 186, 181, 107, 48, 47, - 17, 229, 180, 20, 95, 108, 93, 45, 221, 234, 74, 238, 103, 73, 146, - 106, 191, 85, 223, 161, 51, 172, 113, 112, 173, 39, 234, 187, 41, 126, - 163, 84, 167, 51, 233, 187, 89, 250, 123, 163, 250, 158, 165, 173, 201, - 146, 127, 238, 33, 194, 190, 225, 209, 118, 41, 166, 90, 23, 51, 241, - 37, 209, 101, 59, 43, 116, 9, 235, 118, 9, 215, 153, 162, 190, 135, - 192, 151, 140, 218, 49, 192, 76, 124, 73, 158, 63, 84, 89, 103, 35, - 247, 73, 249, 103, 137, 117, 53, 11, 230, 37, 91, 166, 142, 165, 223, - 94, 188, 255, 163, 250, 29, 198, 51, 224, 75, 150, 47, 143, 22, 246, - 189, 15, 243, 146, 207, 19, 201, 111, 116, 74, 186, 242, 175, 86, 179, - 7, 107, 156, 212, 210, 98, 93, 189, 133, 121, 201, 5, 250, 251, 58, - 164, 207, 61, 99, 180, 59, 229, 47, 75, 235, 18, 196, 114, 95, 131, - 47, 9, 56, 65, 206, 214, 222, 148, 110, 71, 71, 105, 114, 111, 75, - 191, 85, 143, 50, 235, 205, 75, 126, 191, 29, 73, 191, 23, 89, 89, - 251, 174, 101, 46, 240, 37, 191, 20, 143, 210, 121, 231, 39, 210, 237, - 249, 164, 205, 115, 105, 180, 103, 180, 153, 204, 75, 242, 12, 212, 123, - 231, 215, 82, 80, 121, 106, 243, 114, 234, 16, 141, 134, 121, 137, 101, - 103, 140, 88, 46, 204, 75, 90, 190, 136, 161, 223, 169, 156, 245, 72, - 211, 21, 248, 146, 35, 119, 197, 125, 113, 141, 51, 246, 40, 105, 147, - 87, 14, 171, 164, 210, 121, 192, 151, 180, 26, 46, 126, 231, 60, 219, - 124, 228, 230, 121, 200, 120, 223, 147, 191, 24, 162, 98, 176, 8, 204, - 75, 202, 55, 27, 109, 22, 175, 233, 10, 203, 172, 94, 212, 143, 210, - 56, 47, 209, 171, 35, 165, 57, 178, 84, 110, 255, 50, 101, 176, 183, - 255, 54, 189, 28, 25, 171, 51, 76, 180, 67, 123, 155, 27, 57, 50, - 59, 151, 191, 178, 51, 254, 155, 63, 127, 47, 151, 123, 121, 101, 215, - 121, 159, 14, 49, 5, 105, 142, 204, 159, 147, 145, 8, 239, 148, 168, - 201, 241, 111, 153, 189, 12, 231, 188, 178, 107, 25, 5, 191, 89, 155, - 76, 199, 97, 227, 198, 1, 52, 25, 75, 117, 255, 174, 110, 230, 149, - 93, 203, 24, 112, 103, 61, 171, 101, 180, 101, 249, 78, 190, 77, 219, - 35, 173, 220, 213, 205, 188, 178, 107, 25, 21, 184, 28, 25, 234, 157, - 196, 15, 19, 196, 15, 212, 35, 221, 191, 212, 232, 10, 16, 63, 216, - 115, 213, 118, 170, 155, 74, 57, 251, 226, 150, 153, 150, 27, 101, 143, - 208, 185, 232, 175, 245, 206, 42, 244, 117, 88, 215, 222, 148, 174, 11, - 99, 232, 123, 83, 23, 72, 44, 159, 189, 156, 214, 52, 190, 137, 90, - 41, 137, 242, 217, 42, 206, 87, 75, 190, 82, 21, 27, 137, 31, 62, - 55, 203, 105, 249, 151, 117, 146, 247, 172, 18, 226, 122, 38, 88, 215, - 190, 191, 176, 60, 205, 145, 45, 106, 90, 67, 235, 155, 44, 85, 123, - 80, 71, 167, 6, 203, 46, 229, 58, 255, 5, 93, 215, 230, 233, 161, - 230, 158, 252, 96, 93, 27, 118, 163, 135, 176, 111, 47, 88, 215, 142, - 77, 251, 205, 70, 226, 135, 61, 92, 125, 207, 125, 176, 174, 45, 189, - 227, 159, 6, 194, 119, 182, 30, 148, 230, 95, 168, 219, 144, 196, 143, - 3, 27, 26, 41, 116, 203, 232, 163, 210, 228, 137, 109, 133, 231, 50, - 190, 131, 248, 49, 242, 248, 18, 58, 23, 173, 125, 102, 136, 66, 63, - 133, 117, 237, 171, 146, 149, 133, 103, 48, 238, 67, 252, 184, 179, 118, - 11, 93, 215, 62, 120, 255, 176, 66, 103, 70, 93, 150, 164, 49, 87, - 117, 190, 177, 112, 77, 42, 222, 246, 31, 186, 174, 189, 63, 254, 44, - 93, 215, 254, 253, 215, 69, 157, 190, 119, 37, 71, 220, 3, 186, 174, - 221, 62, 254, 126, 16, 201, 145, 253, 58, 241, 174, 176, 175, 39, 204, - 69, 131, 71, 159, 167, 235, 218, 181, 53, 212, 117, 106, 30, 136, 31, - 151, 206, 172, 19, 246, 197, 248, 209, 181, 251, 100, 186, 174, 173, 210, - 163, 83, 16, 137, 31, 39, 61, 170, 138, 223, 25, 226, 135, 207, 149, - 196, 64, 18, 63, 82, 95, 239, 10, 84, 235, 88, 114, 203, 94, 37, - 255, 21, 222, 59, 252, 2, 214, 181, 79, 204, 108, 93, 187, 247, 214, - 92, 133, 206, 13, 241, 99, 238, 119, 63, 234, 212, 145, 250, 200, 71, - 46, 53, 164, 235, 218, 213, 155, 212, 124, 207, 91, 152, 139, 134, 22, - 24, 94, 95, 172, 231, 194, 50, 171, 37, 246, 163, 52, 230, 200, 244, - 106, 140, 137, 47, 65, 255, 74, 124, 9, 126, 135, 30, 253, 37, 241, - 37, 132, 54, 131, 47, 97, 207, 179, 241, 37, 48, 23, 141, 29, 58, - 208, 70, 124, 137, 247, 233, 169, 10, 109, 1, 95, 114, 182, 219, 207, - 226, 92, 238, 148, 5, 18, 219, 203, 90, 78, 107, 86, 61, 97, 46, - 42, 218, 203, 82, 253, 193, 106, 233, 198, 192, 41, 212, 151, 28, 177, - 206, 85, 232, 220, 224, 75, 14, 206, 93, 34, 196, 116, 190, 184, 141, - 210, 237, 192, 253, 212, 151, 252, 30, 184, 70, 251, 70, 79, 178, 20, - 88, 127, 182, 176, 239, 57, 240, 37, 3, 109, 177, 13, 136, 47, 105, - 82, 33, 116, 139, 186, 222, 218, 46, 93, 217, 191, 37, 89, 212, 55, - 45, 118, 151, 84, 245, 135, 189, 212, 151, 36, 237, 113, 104, 121, 239, - 125, 82, 243, 23, 207, 132, 114, 243, 194, 186, 246, 203, 37, 100, 92, - 233, 82, 187, 222, 95, 105, 227, 61, 42, 173, 41, 186, 95, 88, 71, - 122, 5, 124, 137, 231, 189, 55, 129, 196, 151, 60, 127, 113, 66, 161, - 63, 133, 185, 232, 55, 94, 171, 133, 54, 126, 1, 124, 201, 163, 126, - 29, 104, 190, 189, 123, 147, 197, 10, 125, 19, 124, 73, 211, 35, 135, - 133, 239, 252, 12, 124, 201, 200, 181, 103, 104, 190, 125, 228, 246, 243, - 52, 223, 30, 126, 204, 97, 211, 243, 37, 103, 222, 238, 163, 249, 246, - 57, 237, 118, 218, 72, 142, 172, 229, 10, 187, 78, 223, 39, 82, 235, - 219, 54, 154, 111, 223, 16, 186, 197, 70, 230, 162, 37, 254, 217, 40, - 236, 107, 130, 117, 109, 141, 101, 235, 105, 190, 253, 222, 235, 101, 54, - 146, 35, 251, 173, 221, 66, 155, 158, 47, 41, 244, 225, 24, 154, 111, - 127, 61, 180, 175, 141, 228, 200, 76, 201, 237, 117, 234, 117, 243, 200, - 189, 34, 251, 210, 124, 251, 139, 203, 253, 109, 36, 71, 54, 243, 139, - 65, 54, 61, 95, 114, 250, 127, 4, 131, 239, 201, 5, 222, 14, 178, - 145, 28, 217, 136, 239, 134, 216, 244, 124, 9, 171, 21, 247, 163, 52, - 206, 69, 245, 106, 200, 137, 47, 193, 121, 20, 241, 37, 54, 240, 37, - 56, 47, 34, 190, 132, 208, 85, 193, 151, 176, 231, 196, 151, 148, 112, - 226, 55, 31, 124, 137, 87, 239, 43, 116, 94, 178, 254, 171, 42, 202, - 186, 250, 71, 88, 215, 126, 177, 161, 139, 112, 141, 189, 10, 214, 181, - 108, 31, 123, 57, 173, 73, 190, 0, 190, 68, 180, 143, 141, 125, 11, - 196, 175, 150, 182, 21, 77, 75, 37, 190, 164, 215, 147, 131, 10, 253, - 101, 204, 58, 169, 228, 213, 179, 194, 179, 86, 119, 193, 151, 180, 14, - 242, 216, 74, 124, 201, 216, 133, 143, 149, 246, 111, 103, 37, 75, 143, - 190, 185, 46, 236, 187, 111, 188, 93, 186, 209, 99, 113, 42, 241, 37, - 59, 54, 116, 87, 232, 74, 224, 75, 154, 213, 203, 35, 236, 59, 126, - 194, 46, 41, 169, 201, 77, 234, 75, 166, 191, 63, 69, 153, 79, 44, - 137, 218, 39, 173, 253, 177, 170, 240, 59, 64, 107, 6, 28, 148, 130, - 207, 255, 70, 115, 100, 99, 218, 109, 86, 232, 123, 99, 143, 74, 183, - 223, 223, 39, 236, 59, 215, 122, 66, 58, 112, 116, 105, 48, 241, 37, - 230, 66, 243, 21, 122, 18, 204, 75, 186, 124, 61, 77, 216, 55, 32, - 254, 188, 36, 143, 142, 15, 38, 190, 100, 223, 228, 126, 10, 93, 53, - 230, 178, 52, 44, 119, 11, 97, 223, 55, 209, 215, 164, 99, 126, 36, - 87, 117, 83, 74, 90, 252, 82, 25, 239, 202, 168, 219, 82, 250, 39, - 151, 132, 115, 169, 137, 224, 75, 78, 7, 189, 79, 115, 100, 7, 51, - 84, 186, 11, 248, 146, 45, 75, 139, 9, 229, 214, 135, 121, 73, 159, - 106, 158, 52, 71, 118, 111, 215, 117, 69, 86, 67, 240, 37, 243, 62, - 219, 43, 148, 27, 12, 190, 164, 102, 202, 18, 154, 35, 123, 47, 100, - 168, 66, 251, 131, 47, 25, 94, 170, 138, 176, 239, 123, 219, 60, 229, - 110, 7, 194, 104, 142, 108, 253, 237, 135, 138, 143, 47, 7, 190, 164, - 230, 163, 59, 66, 76, 143, 134, 117, 237, 151, 109, 218, 211, 28, 89, - 245, 124, 191, 43, 244, 56, 240, 37, 150, 31, 28, 194, 58, 240, 95, - 113, 239, 238, 64, 5, 154, 35, 43, 218, 215, 162, 214, 159, 71, 22, - 148, 231, 15, 143, 18, 218, 228, 85, 240, 37, 236, 91, 0, 126, 148, - 62, 14, 190, 68, 239, 27, 1, 196, 151, 224, 122, 137, 248, 146, 185, - 224, 75, 42, 112, 57, 50, 66, 227, 222, 93, 133, 44, 57, 178, 234, - 166, 8, 39, 126, 123, 192, 151, 248, 53, 137, 162, 57, 50, 191, 178, - 234, 250, 252, 85, 68, 152, 84, 115, 187, 120, 125, 94, 19, 230, 37, - 236, 12, 203, 114, 90, 115, 94, 19, 124, 137, 232, 12, 11, 246, 149, - 227, 86, 75, 147, 251, 15, 162, 57, 178, 85, 33, 234, 247, 135, 66, - 96, 94, 82, 226, 211, 62, 194, 115, 150, 79, 96, 141, 211, 170, 94, - 87, 154, 35, 203, 157, 174, 126, 235, 104, 149, 53, 89, 26, 217, 191, - 167, 176, 111, 51, 171, 93, 122, 94, 104, 56, 205, 145, 13, 91, 163, - 214, 84, 111, 139, 220, 46, 201, 77, 197, 245, 216, 111, 97, 94, 82, - 249, 172, 149, 230, 200, 134, 182, 81, 219, 215, 141, 217, 39, 141, 250, - 55, 82, 216, 119, 43, 172, 113, 254, 55, 38, 130, 230, 200, 34, 98, - 212, 26, 248, 199, 81, 71, 165, 13, 19, 197, 231, 74, 207, 193, 188, - 228, 219, 126, 67, 105, 142, 172, 88, 127, 245, 253, 111, 131, 47, 249, - 173, 255, 72, 157, 119, 62, 47, 205, 90, 56, 138, 230, 200, 78, 149, - 27, 163, 229, 170, 46, 75, 21, 127, 30, 43, 236, 123, 3, 230, 37, - 51, 90, 176, 28, 217, 196, 43, 42, 253, 6, 124, 201, 232, 177, 226, - 251, 167, 51, 193, 151, 124, 86, 44, 138, 230, 200, 26, 21, 100, 57, - 178, 214, 121, 162, 116, 222, 249, 137, 148, 118, 144, 229, 200, 242, 52, - 136, 214, 114, 115, 47, 165, 22, 191, 139, 229, 226, 26, 39, 53, 128, - 229, 200, 38, 141, 97, 57, 178, 144, 237, 58, 191, 47, 204, 75, 174, - 189, 97, 57, 178, 190, 79, 89, 142, 236, 223, 187, 49, 58, 245, 246, - 121, 228, 126, 123, 89, 142, 236, 247, 98, 44, 71, 118, 177, 167, 248, - 157, 115, 111, 243, 145, 7, 222, 138, 164, 57, 178, 223, 251, 168, 24, - 204, 7, 243, 18, 175, 94, 163, 117, 116, 85, 88, 102, 223, 122, 240, - 163, 52, 206, 75, 244, 190, 1, 65, 207, 43, 167, 112, 223, 92, 222, - 52, 216, 27, 115, 102, 226, 28, 25, 171, 191, 244, 135, 190, 137, 91, - 220, 56, 175, 156, 194, 229, 175, 146, 185, 243, 202, 105, 198, 213, 197, - 32, 95, 154, 191, 2, 26, 101, 42, 50, 182, 24, 87, 23, 227, 207, - 201, 192, 113, 147, 177, 164, 109, 54, 174, 46, 6, 249, 58, 157, 35, - 211, 100, 132, 108, 54, 174, 46, 6, 245, 110, 100, 253, 37, 234, 216, - 200, 250, 75, 212, 167, 145, 245, 151, 33, 155, 141, 173, 191, 68, 156, - 16, 204, 36, 172, 7, 59, 72, 209, 195, 12, 171, 191, 12, 129, 190, - 233, 27, 221, 248, 230, 242, 38, 238, 91, 197, 127, 49, 254, 161, 27, - 141, 171, 139, 65, 190, 244, 155, 203, 64, 163, 76, 197, 99, 111, 48, - 174, 46, 38, 132, 147, 129, 227, 38, 99, 177, 110, 48, 174, 46, 6, - 249, 58, 125, 115, 89, 147, 225, 187, 193, 184, 186, 24, 212, 187, 145, - 245, 151, 168, 99, 35, 235, 47, 173, 27, 140, 173, 191, 244, 221, 96, - 108, 253, 37, 226, 132, 126, 79, 198, 18, 238, 157, 190, 73, 15, 51, - 172, 254, 210, 23, 250, 38, 172, 213, 199, 12, 182, 35, 118, 144, 176, - 142, 241, 247, 95, 107, 92, 156, 65, 190, 68, 134, 47, 208, 40, 83, - 153, 197, 38, 25, 23, 103, 124, 57, 25, 56, 110, 50, 22, 75, 146, - 113, 113, 6, 249, 242, 152, 241, 213, 100, 36, 193, 111, 99, 84, 156, - 65, 189, 27, 89, 127, 137, 58, 54, 178, 254, 210, 146, 100, 108, 253, - 37, 234, 206, 200, 250, 75, 196, 9, 253, 182, 127, 227, 71, 158, 9, - 235, 245, 48, 195, 213, 95, 102, 132, 123, 103, 124, 245, 200, 83, 183, - 254, 18, 218, 209, 26, 252, 144, 55, 158, 244, 23, 135, 190, 70, 197, - 25, 228, 75, 109, 173, 199, 35, 79, 148, 169, 216, 156, 64, 198, 127, - 141, 51, 200, 151, 214, 69, 3, 95, 50, 150, 196, 54, 217, 203, 248, - 175, 113, 6, 249, 242, 152, 65, 153, 202, 254, 101, 227, 236, 101, 252, - 215, 56, 131, 122, 55, 178, 254, 210, 55, 11, 191, 156, 214, 95, 162, - 62, 141, 172, 191, 68, 221, 25, 89, 127, 137, 56, 161, 223, 147, 233, - 11, 118, 192, 249, 51, 215, 152, 97, 245, 151, 9, 141, 160, 175, 172, - 143, 25, 108, 71, 99, 64, 35, 246, 219, 39, 74, 217, 219, 129, 59, - 113, 102, 210, 194, 8, 59, 141, 1, 156, 140, 4, 120, 167, 4, 77, - 142, 111, 255, 236, 101, 184, 19, 103, 22, 116, 98, 53, 43, 200, 151, - 142, 3, 104, 50, 150, 196, 126, 217, 203, 112, 39, 206, 216, 46, 60, - 11, 166, 227, 144, 157, 49, 131, 50, 149, 117, 153, 64, 134, 59, 113, - 166, 249, 160, 110, 20, 51, 168, 247, 236, 238, 238, 66, 157, 50, 222, - 174, 255, 189, 51, 247, 233, 159, 61, 63, 212, 223, 127, 229, 135, 250, - 204, 142, 31, 234, 234, 191, 242, 11, 16, 240, 67, 189, 184, 203, 143, - 126, 79, 166, 47, 195, 76, 68, 47, 160, 57, 127, 230, 26, 51, 172, - 254, 50, 0, 250, 38, 133, 233, 99, 6, 219, 209, 239, 176, 244, 97, - 252, 45, 97, 57, 139, 51, 163, 63, 107, 79, 231, 102, 200, 151, 198, - 50, 160, 81, 166, 146, 113, 235, 157, 179, 56, 147, 158, 60, 138, 206, - 205, 2, 56, 25, 56, 110, 50, 150, 208, 222, 57, 139, 51, 127, 124, - 249, 47, 197, 12, 242, 117, 250, 158, 140, 38, 35, 163, 87, 206, 226, - 76, 207, 251, 61, 216, 247, 100, 194, 178, 183, 33, 212, 233, 127, 181, - 73, 212, 113, 118, 252, 80, 127, 255, 149, 95, 168, 128, 31, 234, 234, - 191, 242, 67, 221, 101, 199, 15, 245, 242, 95, 49, 163, 224, 132, 172, - 107, 35, 193, 14, 250, 234, 96, 166, 14, 171, 191, 204, 232, 249, 200, - 51, 49, 90, 31, 51, 216, 142, 230, 155, 98, 24, 127, 107, 207, 156, - 197, 25, 167, 188, 89, 12, 147, 225, 15, 116, 134, 198, 59, 32, 58, - 103, 113, 198, 41, 111, 198, 201, 192, 113, 147, 177, 164, 69, 229, 44, - 206, 56, 229, 205, 162, 157, 49, 227, 175, 201, 8, 137, 202, 89, 156, - 113, 250, 110, 89, 79, 206, 134, 12, 88, 207, 160, 142, 141, 92, 207, - 160, 62, 141, 92, 207, 132, 68, 57, 191, 95, 78, 215, 51, 136, 19, - 154, 55, 27, 253, 200, 51, 162, 151, 30, 102, 216, 121, 204, 16, 232, - 155, 62, 86, 31, 51, 216, 142, 230, 155, 198, 49, 254, 161, 99, 141, - 91, 207, 32, 95, 154, 55, 3, 26, 101, 42, 184, 30, 99, 220, 122, - 38, 132, 147, 129, 227, 38, 99, 177, 142, 49, 110, 61, 131, 124, 157, - 242, 102, 154, 12, 223, 49, 198, 173, 103, 80, 239, 70, 174, 103, 80, - 199, 70, 174, 103, 172, 99, 140, 93, 207, 248, 142, 49, 118, 61, 131, - 56, 33, 152, 9, 25, 14, 118, 16, 169, 135, 25, 246, 29, 102, 95, - 232, 155, 48, 82, 31, 51, 216, 142, 174, 53, 70, 49, 254, 254, 35, - 141, 139, 51, 200, 151, 174, 53, 128, 70, 153, 74, 190, 105, 132, 113, - 113, 198, 151, 147, 129, 227, 38, 99, 177, 140, 48, 46, 206, 32, 95, - 167, 188, 153, 38, 35, 125, 184, 113, 113, 6, 245, 110, 228, 254, 12, - 234, 216, 200, 253, 25, 203, 136, 156, 199, 25, 167, 185, 227, 240, 156, - 199, 25, 126, 110, 134, 56, 161, 152, 233, 2, 118, 48, 90, 15, 51, - 236, 59, 204, 233, 195, 30, 121, 250, 119, 211, 199, 12, 182, 163, 49, - 96, 24, 227, 239, 24, 106, 92, 156, 9, 225, 100, 36, 194, 59, 165, - 107, 114, 146, 186, 26, 23, 103, 144, 47, 157, 255, 1, 77, 198, 98, - 233, 106, 92, 156, 241, 239, 230, 140, 25, 148, 169, 232, 186, 139, 113, - 113, 6, 245, 110, 228, 254, 12, 234, 216, 200, 253, 25, 75, 215, 156, - 199, 25, 39, 204, 116, 201, 121, 156, 113, 194, 76, 23, 134, 25, 107, - 42, 216, 193, 240, 108, 48, 51, 188, 251, 208, 97, 89, 238, 145, 77, - 239, 12, 237, 59, 185, 129, 153, 206, 28, 102, 58, 51, 254, 1, 29, - 179, 183, 131, 216, 214, 211, 236, 7, 10, 52, 212, 48, 227, 229, 58, - 7, 208, 39, 15, 187, 227, 149, 147, 145, 14, 239, 148, 174, 201, 241, - 237, 32, 144, 177, 176, 76, 234, 189, 220, 165, 131, 85, 204, 184, 150, - 113, 115, 116, 5, 54, 255, 235, 196, 141, 3, 104, 50, 150, 140, 246, - 217, 203, 24, 155, 249, 40, 245, 232, 192, 175, 181, 187, 151, 93, 203, - 8, 253, 242, 61, 154, 255, 11, 233, 228, 140, 25, 148, 169, 16, 91, - 179, 151, 209, 236, 239, 174, 230, 253, 251, 8, 102, 92, 203, 168, 126, - 92, 173, 149, 201, 208, 244, 94, 69, 105, 169, 222, 39, 130, 122, 164, - 57, 0, 141, 14, 89, 56, 94, 98, 207, 93, 159, 37, 57, 181, 182, - 128, 92, 108, 72, 43, 237, 188, 119, 11, 153, 180, 247, 121, 220, 81, - 158, 148, 80, 73, 184, 118, 121, 154, 127, 144, 188, 251, 205, 4, 122, - 79, 102, 171, 17, 234, 221, 142, 185, 50, 227, 228, 182, 59, 215, 136, - 107, 26, 114, 77, 145, 55, 92, 76, 165, 119, 93, 18, 58, 226, 198, - 119, 220, 243, 236, 231, 107, 25, 154, 93, 240, 58, 192, 223, 153, 232, - 128, 208, 168, 3, 246, 60, 123, 29, 172, 152, 18, 78, 239, 138, 34, - 237, 81, 7, 30, 47, 11, 218, 244, 116, 176, 237, 230, 28, 122, 79, - 215, 160, 204, 70, 41, 68, 7, 27, 118, 120, 166, 232, 233, 224, 250, - 248, 127, 147, 137, 14, 8, 141, 58, 96, 207, 197, 58, 64, 187, 229, - 117, 128, 118, 72, 116, 64, 232, 54, 160, 3, 246, 60, 155, 111, 214, - 128, 14, 46, 151, 252, 202, 78, 116, 64, 218, 231, 7, 29, 244, 45, - 34, 62, 187, 255, 4, 116, 112, 114, 219, 80, 122, 127, 212, 161, 98, - 37, 109, 68, 7, 79, 23, 39, 235, 234, 96, 226, 252, 69, 41, 68, - 7, 132, 70, 29, 176, 231, 98, 29, 32, 174, 120, 29, 32, 78, 136, - 14, 8, 141, 118, 192, 158, 103, 111, 7, 7, 183, 198, 208, 187, 117, - 72, 251, 124, 160, 131, 252, 167, 197, 231, 200, 208, 14, 254, 188, 19, - 67, 239, 154, 249, 94, 59, 191, 137, 58, 168, 245, 72, 220, 23, 117, - 208, 129, 158, 83, 155, 73, 105, 212, 65, 7, 157, 243, 107, 36, 6, - 160, 223, 167, 49, 96, 19, 248, 181, 46, 194, 24, 224, 116, 47, 163, - 9, 250, 90, 109, 24, 3, 170, 166, 133, 133, 85, 148, 55, 148, 158, - 187, 181, 195, 166, 222, 22, 169, 145, 135, 83, 12, 192, 118, 196, 175, - 89, 237, 220, 250, 60, 37, 123, 191, 182, 96, 84, 160, 189, 66, 169, - 239, 133, 49, 224, 92, 196, 253, 20, 34, 3, 249, 82, 223, 137, 50, - 82, 181, 57, 77, 114, 246, 50, 194, 62, 44, 159, 218, 98, 252, 246, - 134, 162, 24, 208, 170, 194, 192, 64, 58, 14, 78, 6, 142, 155, 140, - 197, 127, 75, 246, 50, 28, 233, 143, 82, 27, 253, 220, 77, 24, 3, - 222, 126, 146, 143, 198, 0, 228, 235, 180, 223, 72, 244, 181, 57, 123, - 25, 219, 7, 132, 154, 167, 108, 21, 199, 0, 180, 67, 98, 247, 168, - 119, 222, 238, 81, 143, 132, 31, 161, 209, 238, 217, 115, 147, 233, 59, - 83, 77, 211, 50, 211, 135, 166, 85, 240, 71, 108, 232, 52, 216, 253, - 149, 219, 201, 245, 137, 221, 147, 246, 232, 255, 50, 206, 188, 175, 235, - 255, 254, 90, 97, 165, 216, 239, 208, 243, 39, 138, 253, 191, 167, 172, - 178, 233, 217, 253, 208, 111, 237, 244, 14, 55, 66, 163, 221, 179, 231, - 98, 236, 163, 93, 240, 58, 192, 223, 153, 232, 128, 208, 168, 3, 246, - 28, 117, 240, 225, 59, 58, 64, 236, 183, 237, 227, 77, 239, 83, 39, - 237, 81, 7, 223, 166, 87, 12, 212, 211, 193, 235, 179, 151, 146, 137, - 14, 110, 207, 108, 67, 99, 64, 201, 215, 147, 117, 253, 223, 45, 207, - 89, 212, 255, 17, 26, 117, 192, 158, 139, 117, 128, 118, 203, 235, 0, - 237, 144, 232, 128, 208, 24, 3, 216, 115, 212, 193, 71, 160, 131, 154, - 160, 131, 154, 78, 49, 224, 196, 208, 214, 52, 6, 144, 246, 24, 3, - 62, 220, 152, 161, 27, 3, 186, 79, 235, 69, 237, 96, 124, 61, 31, - 106, 7, 11, 60, 23, 234, 234, 224, 74, 116, 36, 213, 1, 161, 81, - 7, 236, 185, 78, 12, 216, 236, 172, 3, 230, 175, 173, 102, 66, 163, - 29, 240, 126, 252, 59, 83, 99, 208, 65, 99, 208, 65, 99, 39, 59, - 8, 220, 205, 98, 0, 105, 143, 49, 160, 205, 121, 253, 24, 144, 114, - 143, 197, 128, 181, 15, 88, 12, 88, 233, 70, 12, 232, 193, 197, 128, - 30, 92, 12, 232, 225, 110, 12, 216, 196, 98, 128, 101, 61, 248, 181, - 84, 189, 24, 192, 242, 77, 38, 232, 107, 221, 168, 191, 14, 192, 118, - 212, 119, 254, 197, 248, 251, 110, 116, 119, 29, 224, 122, 61, 136, 115, - 62, 234, 59, 255, 226, 124, 39, 202, 216, 164, 237, 109, 111, 112, 119, - 29, 224, 90, 6, 206, 169, 232, 56, 56, 25, 56, 110, 50, 150, 128, - 13, 238, 174, 3, 92, 203, 192, 57, 11, 29, 199, 198, 44, 49, 64, - 147, 145, 182, 222, 221, 117, 64, 54, 121, 134, 187, 49, 116, 237, 140, - 122, 231, 239, 244, 97, 115, 103, 171, 153, 208, 235, 44, 54, 139, 104, - 78, 237, 180, 223, 189, 193, 153, 31, 155, 135, 90, 205, 132, 94, 15, - 252, 68, 243, 83, 167, 253, 238, 44, 252, 216, 156, 206, 106, 38, 52, - 242, 19, 205, 245, 156, 206, 23, 175, 119, 230, 199, 230, 71, 86, 51, - 161, 145, 159, 104, 222, 196, 175, 157, 17, 39, 4, 51, 105, 127, 131, - 29, 108, 210, 195, 12, 203, 55, 165, 173, 123, 228, 105, 89, 171, 63, - 111, 194, 118, 196, 14, 44, 235, 24, 255, 244, 36, 119, 231, 77, 174, - 237, 0, 99, 36, 145, 97, 225, 100, 164, 193, 59, 165, 105, 114, 66, - 147, 220, 157, 55, 185, 150, 129, 49, 136, 142, 99, 45, 55, 14, 160, - 201, 88, 146, 118, 187, 59, 111, 114, 45, 3, 125, 60, 29, 199, 90, - 103, 204, 160, 76, 101, 254, 183, 219, 221, 121, 147, 107, 25, 61, 56, - 204, 160, 222, 121, 27, 98, 115, 13, 171, 153, 208, 104, 67, 162, 57, - 136, 211, 126, 119, 22, 126, 44, 110, 91, 205, 132, 70, 126, 162, 120, - 238, 148, 191, 218, 237, 204, 143, 197, 64, 171, 153, 208, 200, 79, 20, - 27, 157, 242, 87, 89, 248, 245, 224, 48, 211, 131, 195, 76, 15, 55, - 49, 131, 56, 161, 107, 141, 237, 96, 7, 235, 245, 48, 195, 234, 78, - 44, 208, 55, 109, 167, 126, 156, 193, 118, 212, 158, 119, 49, 254, 33, - 59, 141, 139, 51, 200, 151, 218, 51, 208, 40, 83, 201, 3, 239, 48, - 46, 206, 88, 56, 25, 56, 110, 50, 150, 136, 29, 198, 197, 25, 228, - 203, 99, 198, 66, 244, 181, 195, 184, 56, 131, 122, 39, 54, 148, 102, - 218, 186, 213, 85, 156, 49, 221, 139, 116, 59, 206, 160, 142, 121, 126, - 174, 226, 12, 242, 115, 55, 206, 68, 100, 225, 231, 42, 206, 32, 63, - 119, 227, 140, 41, 11, 63, 87, 113, 6, 249, 185, 27, 103, 16, 39, - 236, 14, 35, 176, 131, 191, 245, 48, 195, 234, 78, 76, 208, 215, 154, - 230, 198, 250, 124, 59, 55, 167, 217, 198, 248, 39, 29, 54, 46, 206, - 32, 95, 106, 107, 40, 99, 187, 230, 159, 15, 27, 23, 103, 76, 156, - 12, 28, 55, 25, 75, 250, 33, 227, 226, 12, 242, 117, 154, 155, 105, - 50, 66, 15, 25, 23, 103, 80, 239, 188, 13, 185, 138, 51, 104, 67, - 238, 198, 25, 75, 22, 126, 174, 226, 12, 242, 115, 55, 206, 160, 62, - 121, 126, 174, 226, 12, 242, 115, 55, 206, 132, 102, 225, 231, 42, 206, - 32, 63, 119, 227, 12, 226, 132, 221, 97, 4, 118, 176, 93, 15, 51, - 159, 114, 119, 24, 61, 242, 116, 236, 119, 227, 12, 253, 65, 102, 7, - 142, 3, 140, 127, 196, 126, 227, 226, 12, 242, 101, 119, 24, 61, 242, - 68, 153, 74, 163, 253, 198, 197, 153, 80, 78, 6, 142, 155, 140, 37, - 97, 159, 113, 113, 6, 249, 58, 223, 97, 164, 229, 205, 246, 25, 23, - 103, 80, 239, 57, 141, 51, 38, 167, 59, 140, 114, 30, 103, 76, 78, - 119, 24, 229, 60, 206, 152, 156, 238, 48, 202, 121, 156, 49, 57, 221, - 97, 196, 48, 19, 122, 14, 236, 224, 160, 30, 102, 62, 227, 238, 48, - 122, 228, 153, 120, 65, 63, 206, 96, 59, 186, 183, 125, 145, 219, 11, - 188, 96, 92, 156, 65, 190, 116, 111, 27, 104, 148, 169, 172, 7, 206, - 27, 23, 103, 252, 57, 25, 56, 110, 50, 150, 144, 243, 198, 197, 25, - 228, 235, 116, 182, 81, 147, 225, 56, 103, 92, 156, 65, 189, 231, 52, - 206, 56, 157, 69, 60, 159, 243, 56, 227, 116, 22, 241, 124, 206, 227, - 12, 207, 15, 117, 151, 211, 56, 195, 99, 6, 113, 66, 239, 99, 57, - 5, 118, 176, 87, 15, 51, 172, 238, 196, 113, 22, 252, 249, 25, 253, - 56, 131, 237, 104, 12, 56, 203, 248, 103, 156, 206, 89, 156, 225, 247, - 207, 67, 57, 25, 14, 120, 39, 135, 38, 199, 122, 58, 103, 113, 134, - 223, 63, 71, 190, 116, 28, 64, 147, 177, 248, 158, 206, 89, 156, 225, - 247, 207, 67, 207, 56, 99, 6, 101, 42, 249, 191, 83, 57, 139, 51, - 100, 255, 60, 72, 211, 59, 189, 211, 167, 155, 119, 218, 232, 3, 207, - 222, 217, 63, 79, 74, 59, 108, 158, 248, 251, 232, 192, 236, 246, 12, - 157, 106, 120, 57, 126, 37, 186, 122, 167, 205, 47, 253, 107, 80, 214, - 189, 104, 199, 246, 195, 230, 209, 241, 110, 222, 97, 196, 241, 75, 107, - 225, 157, 86, 108, 72, 155, 134, 89, 247, 117, 67, 79, 30, 54, 23, - 110, 255, 149, 221, 29, 126, 168, 59, 194, 47, 52, 212, 59, 13, 117, - 149, 117, 143, 212, 10, 227, 109, 50, 54, 198, 189, 59, 140, 78, 113, - 235, 153, 99, 96, 7, 231, 244, 48, 195, 234, 78, 18, 255, 1, 127, - 126, 82, 63, 206, 96, 59, 26, 3, 254, 225, 214, 51, 39, 114, 22, - 103, 248, 253, 70, 127, 78, 70, 34, 188, 83, 162, 38, 199, 114, 34, - 103, 113, 134, 223, 111, 68, 190, 116, 28, 64, 147, 177, 164, 31, 207, - 89, 156, 225, 247, 27, 253, 79, 102, 57, 167, 117, 82, 91, 207, 28, - 207, 89, 156, 33, 251, 141, 65, 154, 222, 137, 13, 205, 7, 204, 92, - 26, 243, 216, 150, 117, 191, 49, 13, 108, 104, 229, 184, 207, 178, 221, - 111, 116, 90, 207, 112, 252, 38, 3, 191, 6, 107, 199, 217, 222, 217, - 187, 219, 118, 216, 28, 212, 229, 97, 182, 123, 119, 78, 235, 153, 227, - 140, 223, 104, 192, 76, 205, 125, 223, 52, 204, 186, 15, 150, 4, 152, - 233, 180, 169, 117, 182, 251, 96, 78, 235, 153, 227, 206, 152, 65, 93, - 101, 221, 83, 66, 204, 252, 58, 62, 251, 61, 37, 167, 245, 204, 49, - 110, 61, 115, 9, 236, 224, 148, 14, 102, 184, 123, 191, 66, 161, 175, - 227, 136, 27, 235, 153, 99, 92, 12, 56, 202, 213, 55, 222, 113, 55, - 206, 20, 116, 105, 7, 43, 228, 125, 244, 155, 198, 200, 151, 198, 0, - 160, 81, 166, 50, 183, 185, 229, 110, 156, 113, 45, 35, 180, 79, 50, - 91, 207, 112, 50, 112, 220, 100, 44, 137, 215, 220, 141, 51, 217, 200, - 184, 91, 143, 197, 178, 35, 89, 214, 51, 154, 12, 255, 203, 238, 198, - 25, 215, 50, 182, 189, 82, 49, 243, 121, 46, 85, 239, 85, 148, 150, - 38, 83, 116, 141, 15, 211, 80, 143, 132, 31, 161, 27, 36, 197, 91, - 216, 115, 215, 223, 33, 29, 220, 58, 211, 210, 191, 95, 121, 205, 158, - 3, 164, 197, 129, 181, 20, 250, 127, 167, 186, 75, 248, 219, 137, 206, - 181, 188, 231, 55, 75, 98, 241, 109, 57, 61, 19, 150, 63, 243, 15, - 73, 20, 223, 176, 111, 102, 174, 245, 210, 189, 184, 181, 244, 190, 157, - 193, 203, 212, 187, 172, 60, 50, 109, 210, 143, 77, 19, 132, 231, 170, - 94, 229, 218, 33, 133, 140, 220, 77, 191, 225, 103, 93, 175, 221, 71, - 149, 121, 64, 106, 241, 188, 144, 240, 60, 210, 203, 92, 199, 164, 246, - 123, 63, 208, 218, 156, 146, 138, 127, 25, 164, 210, 209, 103, 164, 65, - 62, 77, 132, 125, 95, 199, 158, 151, 102, 31, 108, 169, 181, 113, 72, - 158, 141, 212, 24, 137, 223, 151, 31, 178, 249, 27, 97, 223, 92, 113, - 215, 164, 239, 31, 182, 213, 218, 220, 148, 202, 111, 234, 162, 208, 190, - 209, 183, 165, 135, 227, 250, 8, 251, 150, 143, 187, 43, 33, 150, 180, - 153, 157, 100, 181, 68, 42, 244, 252, 232, 135, 82, 159, 51, 221, 133, - 125, 15, 199, 62, 145, 26, 77, 190, 64, 191, 233, 233, 223, 82, 189, - 155, 106, 75, 212, 75, 233, 235, 53, 167, 55, 139, 250, 218, 98, 95, - 75, 79, 99, 190, 161, 223, 7, 222, 95, 98, 170, 66, 191, 10, 246, - 144, 207, 223, 93, 46, 190, 143, 42, 205, 83, 30, 177, 176, 15, 253, - 14, 223, 155, 15, 219, 169, 116, 116, 30, 121, 112, 171, 143, 116, 238, - 159, 201, 39, 159, 121, 213, 136, 126, 227, 247, 217, 167, 13, 232, 221, - 53, 126, 67, 3, 116, 239, 174, 97, 103, 19, 253, 40, 141, 223, 191, - 210, 59, 179, 72, 176, 133, 254, 134, 96, 11, 239, 193, 66, 255, 65, - 231, 72, 26, 45, 1, 182, 216, 115, 215, 216, 218, 6, 216, 202, 95, - 109, 90, 10, 193, 86, 82, 155, 207, 21, 58, 24, 176, 245, 217, 202, - 199, 194, 187, 157, 26, 2, 182, 216, 92, 111, 57, 61, 107, 88, 11, - 176, 37, 154, 235, 97, 223, 2, 94, 235, 165, 60, 39, 124, 236, 4, - 91, 219, 171, 202, 10, 157, 15, 176, 21, 62, 102, 140, 208, 94, 254, - 5, 108, 45, 155, 246, 43, 189, 219, 110, 198, 89, 155, 66, 63, 126, - 117, 64, 58, 248, 193, 73, 97, 95, 47, 175, 99, 210, 218, 186, 119, - 40, 182, 22, 188, 246, 80, 206, 45, 215, 3, 108, 229, 205, 240, 22, - 126, 199, 208, 39, 254, 188, 132, 190, 156, 96, 171, 240, 60, 31, 133, - 246, 138, 187, 44, 229, 63, 147, 33, 148, 219, 127, 252, 53, 233, 88, - 68, 56, 197, 214, 149, 184, 210, 138, 126, 126, 6, 108, 85, 92, 90, - 65, 232, 195, 74, 143, 187, 43, 69, 22, 205, 71, 191, 113, 217, 223, - 175, 136, 66, 127, 111, 125, 40, 221, 133, 184, 34, 234, 123, 9, 176, - 213, 120, 246, 210, 134, 4, 91, 123, 199, 215, 87, 104, 63, 192, 214, - 197, 233, 213, 133, 182, 246, 32, 230, 181, 36, 207, 43, 64, 198, 37, - 247, 75, 104, 163, 208, 179, 1, 91, 185, 23, 77, 21, 142, 247, 14, - 96, 171, 89, 46, 114, 119, 161, 151, 252, 123, 165, 177, 10, 93, 8, - 176, 53, 178, 107, 127, 29, 31, 150, 79, 126, 83, 169, 134, 157, 96, - 107, 206, 7, 185, 21, 58, 51, 170, 160, 92, 184, 231, 118, 155, 30, - 182, 216, 153, 87, 63, 74, 227, 247, 179, 245, 206, 194, 210, 184, 117, - 141, 97, 107, 22, 98, 11, 226, 38, 197, 150, 70, 43, 216, 162, 207, - 9, 182, 222, 189, 175, 242, 104, 183, 149, 244, 251, 217, 197, 103, 77, - 87, 232, 98, 167, 187, 75, 9, 227, 186, 8, 223, 165, 111, 177, 89, - 18, 91, 247, 44, 167, 103, 88, 195, 94, 255, 33, 137, 214, 61, 216, - 119, 50, 96, 235, 11, 223, 227, 20, 91, 255, 171, 80, 68, 177, 83, - 11, 96, 107, 154, 165, 129, 208, 198, 127, 6, 108, 181, 92, 62, 36, - 149, 96, 171, 121, 216, 116, 133, 62, 6, 216, 250, 242, 233, 18, 97, - 223, 23, 128, 173, 118, 215, 215, 166, 18, 108, 149, 239, 189, 71, 161, - 243, 198, 156, 145, 186, 175, 58, 38, 236, 107, 25, 127, 94, 194, 57, - 12, 193, 214, 221, 63, 174, 42, 116, 163, 217, 151, 37, 251, 169, 227, - 194, 190, 227, 18, 174, 73, 109, 27, 206, 77, 37, 216, 178, 125, 92, - 95, 161, 235, 143, 191, 45, 13, 238, 61, 93, 168, 171, 69, 157, 239, - 74, 127, 125, 82, 142, 98, 171, 118, 68, 3, 133, 94, 51, 225, 161, - 116, 4, 230, 83, 162, 190, 243, 162, 158, 72, 201, 103, 250, 80, 108, - 45, 238, 222, 89, 241, 157, 211, 70, 191, 148, 74, 255, 28, 35, 148, - 251, 89, 212, 107, 169, 72, 255, 71, 20, 91, 17, 113, 249, 149, 119, - 158, 0, 216, 42, 91, 173, 108, 170, 30, 182, 70, 143, 32, 223, 16, - 246, 146, 171, 52, 120, 165, 240, 241, 2, 108, 205, 61, 243, 143, 80, - 238, 77, 192, 86, 205, 87, 75, 41, 182, 34, 214, 170, 247, 136, 222, - 5, 108, 125, 123, 172, 157, 176, 111, 38, 96, 139, 157, 165, 246, 163, - 116, 50, 96, 75, 239, 140, 53, 141, 91, 151, 25, 182, 240, 219, 244, - 56, 95, 36, 216, 34, 52, 126, 3, 150, 61, 119, 253, 13, 216, 52, - 192, 86, 194, 124, 118, 79, 210, 230, 100, 149, 174, 8, 113, 203, 113, - 78, 124, 214, 249, 113, 209, 89, 18, 203, 1, 44, 167, 103, 163, 243, - 66, 220, 18, 229, 0, 148, 24, 0, 216, 170, 190, 147, 221, 117, 20, - 81, 68, 253, 230, 103, 41, 192, 214, 31, 161, 227, 132, 125, 11, 121, - 237, 144, 198, 121, 140, 166, 223, 98, 45, 127, 95, 253, 38, 106, 69, - 152, 19, 254, 118, 78, 124, 79, 82, 115, 192, 86, 157, 242, 225, 244, - 123, 170, 69, 188, 251, 41, 180, 4, 113, 235, 199, 177, 97, 194, 190, - 29, 226, 206, 75, 56, 119, 39, 216, 218, 237, 173, 126, 55, 192, 110, - 189, 44, 181, 110, 217, 91, 216, 183, 119, 204, 53, 105, 40, 189, 75, - 233, 166, 180, 161, 135, 58, 198, 47, 163, 110, 75, 87, 3, 196, 186, - 218, 20, 123, 87, 42, 91, 123, 52, 253, 158, 234, 147, 153, 42, 221, - 8, 230, 132, 7, 238, 136, 191, 211, 187, 21, 226, 86, 169, 147, 209, - 244, 123, 170, 159, 255, 21, 163, 125, 199, 245, 165, 244, 113, 115, 241, - 29, 75, 15, 97, 78, 120, 195, 70, 191, 215, 42, 95, 14, 82, 105, - 188, 191, 204, 97, 139, 212, 189, 115, 104, 83, 72, 20, 253, 158, 106, - 112, 66, 148, 118, 215, 81, 30, 185, 69, 161, 104, 179, 222, 156, 240, - 219, 127, 163, 233, 55, 81, 189, 191, 32, 247, 66, 21, 148, 55, 254, - 30, 99, 214, 139, 91, 236, 140, 190, 31, 165, 113, 78, 168, 119, 118, - 159, 238, 127, 92, 226, 114, 185, 177, 176, 110, 60, 166, 183, 198, 102, - 231, 224, 67, 97, 61, 152, 56, 75, 63, 47, 21, 202, 173, 27, 29, - 233, 92, 205, 237, 116, 119, 243, 82, 174, 215, 141, 63, 70, 236, 164, - 247, 94, 35, 95, 186, 198, 6, 26, 101, 42, 235, 223, 201, 238, 230, - 165, 92, 203, 168, 210, 38, 141, 202, 8, 229, 100, 224, 184, 201, 88, - 252, 39, 184, 155, 151, 114, 45, 35, 207, 125, 137, 237, 227, 204, 202, - 178, 198, 214, 100, 36, 198, 186, 155, 151, 114, 45, 163, 49, 183, 198, - 70, 189, 19, 127, 26, 9, 254, 20, 245, 72, 248, 17, 26, 215, 216, - 236, 57, 241, 167, 31, 154, 2, 185, 51, 224, 3, 193, 159, 14, 247, - 47, 75, 191, 207, 255, 127, 228, 125, 119, 116, 20, 85, 244, 255, 38, - 244, 30, 32, 116, 132, 208, 73, 1, 150, 42, 66, 96, 119, 134, 162, - 244, 80, 20, 172, 132, 14, 210, 130, 244, 146, 176, 9, 32, 82, 132, - 40, 8, 34, 136, 1, 21, 34, 2, 198, 0, 138, 144, 132, 13, 77, - 164, 70, 138, 70, 138, 44, 189, 72, 9, 33, 129, 16, 8, 252, 238, - 157, 153, 87, 38, 108, 102, 246, 251, 203, 251, 227, 123, 206, 55, 231, - 236, 225, 158, 225, 221, 123, 231, 221, 185, 159, 119, 95, 187, 239, 149, - 232, 30, 164, 208, 45, 161, 61, 197, 239, 71, 120, 251, 90, 2, 45, - 35, 224, 55, 147, 219, 59, 93, 10, 198, 1, 108, 62, 44, 150, 238, - 185, 47, 9, 237, 169, 209, 124, 24, 242, 90, 160, 61, 13, 47, 122, - 172, 45, 105, 79, 227, 214, 191, 163, 222, 179, 2, 237, 105, 74, 232, - 70, 218, 63, 141, 3, 158, 237, 240, 219, 105, 105, 196, 48, 3, 125, - 149, 132, 116, 114, 39, 205, 33, 169, 126, 72, 101, 37, 22, 23, 132, - 246, 52, 103, 195, 171, 180, 79, 157, 8, 60, 201, 240, 59, 192, 241, - 230, 192, 24, 123, 114, 249, 129, 237, 72, 123, 122, 227, 89, 68, 59, - 50, 198, 62, 60, 109, 62, 229, 61, 12, 60, 199, 45, 141, 45, 41, - 240, 227, 239, 169, 70, 127, 38, 237, 169, 245, 194, 114, 133, 46, 14, - 99, 108, 91, 204, 114, 202, 123, 18, 120, 78, 195, 239, 47, 142, 55, - 59, 242, 154, 180, 225, 206, 92, 122, 31, 100, 161, 59, 170, 94, 188, - 55, 35, 229, 249, 68, 202, 155, 10, 60, 103, 225, 119, 158, 123, 231, - 202, 48, 198, 190, 208, 115, 70, 59, 210, 158, 222, 122, 109, 176, 66, - 55, 135, 246, 180, 70, 237, 174, 148, 247, 34, 240, 93, 2, 190, 43, - 28, 47, 158, 79, 237, 10, 46, 65, 251, 42, 133, 171, 169, 247, 231, - 166, 65, 123, 122, 110, 214, 8, 106, 231, 107, 192, 115, 3, 126, 183, - 184, 111, 116, 24, 218, 211, 137, 67, 206, 145, 113, 184, 92, 51, 76, - 205, 243, 194, 246, 180, 79, 246, 30, 250, 125, 239, 0, 207, 61, 248, - 165, 113, 188, 79, 161, 61, 205, 217, 96, 163, 119, 240, 84, 236, 59, - 175, 173, 218, 38, 22, 150, 223, 232, 157, 66, 231, 95, 210, 129, 39, - 3, 126, 89, 28, 47, 182, 167, 117, 35, 106, 183, 33, 237, 233, 142, - 35, 167, 119, 145, 246, 212, 119, 116, 56, 213, 155, 131, 60, 94, 65, - 150, 66, 94, 65, 186, 246, 148, 229, 126, 248, 82, 26, 219, 83, 62, - 39, 164, 56, 240, 148, 134, 95, 57, 142, 151, 142, 3, 62, 209, 143, - 177, 177, 253, 32, 216, 34, 52, 142, 3, 216, 115, 247, 216, 194, 49, - 246, 249, 83, 75, 232, 93, 211, 227, 78, 118, 84, 232, 70, 128, 173, - 202, 217, 236, 158, 169, 190, 192, 51, 2, 126, 51, 57, 222, 50, 128, - 45, 54, 55, 28, 75, 115, 57, 42, 0, 182, 140, 230, 134, 149, 111, - 94, 96, 155, 244, 236, 55, 114, 127, 242, 78, 233, 159, 71, 218, 253, - 80, 128, 173, 147, 171, 202, 183, 99, 216, 106, 4, 216, 106, 164, 195, - 86, 58, 96, 107, 244, 170, 246, 237, 8, 182, 250, 78, 121, 179, 157, - 186, 159, 255, 168, 84, 180, 239, 24, 67, 108, 213, 130, 190, 74, 175, - 117, 163, 40, 182, 90, 215, 93, 168, 249, 233, 89, 169, 214, 137, 229, - 134, 216, 122, 7, 250, 42, 216, 142, 19, 108, 189, 253, 243, 143, 10, - 61, 22, 250, 42, 247, 247, 27, 99, 235, 222, 156, 107, 210, 235, 147, - 239, 208, 251, 173, 146, 34, 235, 42, 118, 251, 15, 176, 213, 177, 89, - 151, 68, 134, 173, 70, 128, 173, 32, 192, 22, 107, 195, 134, 133, 223, - 149, 18, 55, 91, 146, 8, 182, 182, 62, 45, 163, 208, 27, 194, 211, - 165, 17, 65, 53, 147, 24, 182, 252, 1, 91, 254, 128, 173, 134, 28, - 62, 50, 165, 183, 26, 164, 39, 18, 108, 109, 219, 118, 82, 161, 255, - 4, 108, 21, 237, 180, 45, 145, 97, 203, 31, 176, 21, 0, 216, 10, - 160, 188, 223, 1, 182, 14, 223, 161, 99, 20, 185, 74, 85, 117, 238, - 227, 54, 96, 235, 139, 65, 3, 18, 25, 182, 2, 0, 91, 129, 128, - 173, 64, 221, 157, 52, 47, 122, 189, 71, 199, 216, 183, 19, 187, 39, - 170, 237, 80, 97, 121, 196, 170, 70, 137, 12, 91, 129, 128, 173, 64, - 192, 86, 32, 215, 14, 21, 147, 187, 119, 56, 79, 239, 149, 153, 61, - 70, 189, 123, 254, 41, 140, 3, 238, 55, 98, 121, 79, 57, 200, 227, - 6, 91, 44, 167, 200, 151, 210, 56, 198, 230, 115, 141, 140, 176, 133, - 113, 150, 96, 107, 9, 96, 11, 227, 38, 193, 22, 161, 17, 91, 236, - 57, 98, 203, 255, 37, 108, 237, 7, 108, 149, 61, 203, 198, 216, 107, - 55, 168, 119, 84, 85, 133, 49, 118, 217, 107, 253, 18, 140, 176, 53, - 1, 198, 216, 108, 157, 36, 150, 230, 8, 141, 134, 49, 182, 209, 58, - 9, 242, 206, 131, 184, 181, 114, 255, 41, 58, 198, 62, 89, 83, 29, - 99, 183, 1, 108, 189, 63, 132, 141, 177, 227, 224, 187, 109, 135, 239, - 190, 147, 243, 151, 207, 1, 91, 247, 158, 179, 49, 246, 128, 46, 234, - 24, 251, 56, 140, 177, 143, 71, 179, 49, 118, 162, 165, 62, 96, 171, - 62, 96, 171, 30, 229, 173, 94, 232, 148, 212, 169, 111, 28, 29, 99, - 55, 206, 58, 168, 208, 1, 48, 198, 158, 210, 231, 100, 18, 195, 86, - 93, 192, 86, 29, 192, 86, 109, 202, 59, 26, 198, 216, 216, 135, 33, - 216, 10, 125, 113, 69, 161, 7, 125, 126, 89, 90, 187, 134, 141, 207, - 79, 90, 106, 1, 182, 106, 1, 182, 24, 239, 8, 24, 99, 63, 29, - 20, 77, 199, 216, 203, 6, 55, 81, 232, 213, 115, 110, 75, 155, 167, - 142, 226, 176, 85, 15, 176, 213, 80, 135, 173, 75, 239, 222, 149, 238, - 183, 12, 162, 99, 108, 215, 244, 206, 10, 29, 53, 63, 93, 146, 161, - 63, 197, 176, 101, 5, 108, 53, 5, 108, 53, 165, 188, 205, 97, 140, - 109, 153, 57, 129, 198, 45, 223, 231, 95, 41, 109, 247, 197, 169, 217, - 210, 168, 107, 11, 18, 245, 113, 43, 72, 135, 173, 117, 179, 114, 164, - 230, 109, 188, 73, 189, 228, 173, 77, 43, 40, 244, 100, 192, 214, 168, - 172, 6, 73, 12, 91, 254, 128, 45, 127, 192, 86, 67, 221, 24, 123, - 86, 168, 15, 29, 99, 187, 182, 169, 227, 109, 196, 86, 221, 95, 175, - 115, 216, 242, 7, 108, 249, 3, 182, 252, 185, 57, 183, 98, 114, 213, - 233, 63, 210, 49, 118, 194, 13, 117, 174, 236, 58, 96, 107, 85, 60, - 27, 99, 231, 224, 187, 122, 5, 0, 182, 152, 173, 158, 2, 182, 88, - 174, 154, 47, 165, 119, 3, 182, 248, 28, 182, 226, 192, 83, 26, 126, - 229, 56, 94, 26, 183, 34, 245, 99, 236, 142, 220, 24, 187, 35, 55, - 198, 238, 248, 210, 24, 187, 35, 96, 171, 163, 110, 140, 253, 211, 106, - 54, 198, 238, 145, 192, 198, 216, 255, 113, 99, 236, 190, 192, 51, 2, - 126, 51, 57, 94, 28, 99, 179, 53, 195, 88, 154, 123, 134, 99, 108, - 163, 53, 67, 228, 45, 6, 216, 90, 149, 202, 198, 216, 139, 36, 117, - 12, 86, 9, 176, 53, 113, 19, 27, 99, 199, 1, 207, 118, 248, 237, - 180, 116, 96, 119, 87, 195, 24, 251, 240, 52, 54, 198, 14, 140, 157, - 172, 208, 53, 33, 110, 77, 250, 251, 35, 27, 195, 86, 7, 192, 86, - 7, 192, 86, 7, 238, 46, 246, 83, 82, 191, 109, 227, 233, 24, 123, - 197, 118, 245, 126, 151, 142, 216, 39, 108, 49, 210, 198, 176, 37, 3, - 182, 100, 192, 150, 76, 121, 37, 136, 91, 216, 119, 39, 216, 106, 48, - 81, 189, 211, 101, 17, 196, 173, 135, 225, 108, 124, 126, 210, 34, 1, - 182, 36, 192, 150, 68, 121, 163, 97, 140, 61, 35, 112, 26, 29, 99, - 191, 177, 77, 173, 227, 24, 24, 99, 159, 105, 197, 108, 149, 10, 239, - 122, 22, 126, 231, 57, 91, 197, 195, 24, 123, 99, 97, 54, 198, 126, - 175, 190, 74, 183, 130, 62, 161, 79, 103, 54, 198, 190, 8, 124, 151, - 224, 119, 133, 171, 239, 17, 136, 91, 103, 226, 216, 157, 37, 227, 180, - 251, 135, 159, 66, 220, 122, 56, 158, 233, 189, 6, 250, 110, 192, 239, - 22, 167, 247, 17, 196, 173, 126, 85, 217, 24, 123, 255, 31, 179, 232, - 157, 37, 173, 166, 179, 49, 246, 29, 224, 185, 7, 191, 52, 142, 23, - 199, 216, 127, 212, 97, 99, 236, 94, 19, 217, 24, 251, 157, 114, 108, - 140, 157, 14, 60, 25, 240, 203, 226, 120, 177, 79, 88, 33, 135, 141, - 177, 223, 255, 128, 141, 177, 191, 223, 195, 222, 57, 7, 121, 188, 58, - 2, 182, 58, 234, 226, 22, 203, 129, 244, 165, 52, 246, 9, 249, 220, - 200, 226, 192, 83, 26, 126, 229, 56, 94, 186, 247, 35, 146, 141, 177, - 45, 107, 96, 204, 124, 201, 108, 140, 205, 242, 63, 98, 28, 15, 189, - 237, 107, 205, 215, 177, 177, 28, 205, 205, 248, 134, 203, 153, 250, 90, - 220, 190, 92, 148, 75, 115, 51, 224, 157, 80, 167, 50, 70, 253, 90, - 220, 190, 92, 148, 75, 235, 1, 52, 169, 75, 218, 26, 113, 251, 114, - 237, 107, 115, 229, 76, 173, 213, 246, 125, 173, 17, 183, 47, 23, 237, - 46, 50, 255, 35, 244, 107, 177, 249, 31, 104, 79, 145, 249, 31, 142, - 53, 98, 243, 63, 16, 39, 52, 207, 112, 229, 67, 111, 191, 72, 51, - 204, 176, 252, 15, 199, 106, 40, 251, 149, 249, 188, 20, 150, 163, 126, - 176, 154, 201, 143, 94, 37, 110, 95, 174, 133, 211, 225, 128, 119, 114, - 104, 122, 252, 86, 137, 219, 151, 139, 114, 105, 61, 128, 38, 117, 137, - 251, 82, 220, 190, 92, 203, 87, 122, 204, 160, 78, 165, 79, 240, 165, - 184, 125, 185, 104, 119, 145, 249, 31, 126, 171, 196, 230, 127, 160, 61, - 69, 230, 127, 216, 191, 20, 155, 255, 129, 56, 161, 121, 134, 203, 224, - 187, 172, 49, 195, 12, 203, 255, 176, 3, 175, 243, 11, 15, 242, 12, - 87, 114, 49, 96, 5, 151, 103, 248, 133, 192, 60, 195, 21, 92, 12, - 0, 26, 117, 42, 61, 164, 229, 2, 243, 12, 57, 29, 88, 111, 82, - 151, 176, 229, 2, 243, 12, 191, 200, 149, 103, 72, 236, 181, 92, 96, - 158, 225, 23, 98, 243, 63, 208, 198, 34, 243, 63, 194, 150, 139, 205, - 255, 176, 44, 23, 155, 255, 129, 56, 161, 231, 39, 110, 5, 63, 88, - 105, 134, 25, 150, 255, 97, 1, 94, 199, 103, 30, 228, 25, 46, 227, - 98, 192, 231, 220, 25, 16, 159, 9, 204, 51, 252, 156, 243, 53, 212, - 177, 76, 139, 1, 63, 9, 204, 51, 228, 116, 96, 189, 73, 93, 236, - 63, 9, 204, 51, 252, 44, 87, 158, 161, 166, 35, 101, 171, 184, 56, - 131, 118, 23, 153, 255, 129, 54, 22, 153, 255, 97, 255, 73, 108, 254, - 7, 218, 78, 100, 254, 7, 226, 132, 222, 213, 179, 9, 252, 96, 153, - 25, 102, 88, 254, 71, 202, 150, 135, 222, 33, 155, 61, 56, 63, 113, - 11, 119, 238, 224, 22, 238, 204, 209, 31, 197, 197, 153, 16, 78, 71, - 10, 188, 83, 138, 166, 39, 236, 71, 113, 113, 6, 229, 210, 122, 0, - 77, 235, 242, 163, 184, 56, 19, 178, 57, 215, 249, 137, 155, 181, 92, - 198, 77, 226, 226, 12, 218, 93, 228, 120, 38, 236, 71, 177, 227, 25, - 203, 143, 98, 199, 51, 104, 59, 145, 227, 25, 196, 9, 189, 67, 225, - 123, 240, 131, 173, 102, 152, 97, 249, 31, 209, 63, 0, 111, 172, 121, - 156, 193, 114, 244, 220, 233, 31, 184, 189, 236, 27, 197, 197, 25, 31, - 78, 71, 52, 188, 83, 180, 166, 199, 186, 81, 92, 156, 65, 185, 180, - 30, 64, 147, 186, 56, 55, 136, 139, 51, 62, 177, 185, 238, 234, 137, - 213, 114, 25, 55, 136, 139, 51, 104, 119, 145, 227, 25, 235, 70, 177, - 227, 25, 180, 167, 200, 241, 76, 200, 6, 177, 227, 25, 196, 9, 189, - 71, 241, 5, 208, 155, 76, 48, 195, 221, 59, 18, 2, 188, 41, 223, - 122, 112, 135, 194, 247, 92, 12, 248, 142, 59, 163, 241, 91, 113, 113, - 6, 229, 210, 24, 0, 52, 234, 84, 230, 180, 214, 139, 139, 51, 33, - 156, 14, 172, 55, 169, 139, 99, 189, 184, 56, 131, 114, 117, 119, 40, - 104, 58, 226, 94, 136, 139, 51, 104, 119, 145, 227, 25, 180, 177, 200, - 241, 140, 99, 189, 216, 241, 12, 218, 78, 228, 120, 70, 193, 137, 38, - 47, 45, 27, 252, 224, 123, 51, 204, 176, 253, 92, 113, 207, 31, 122, - 91, 115, 204, 227, 12, 150, 163, 119, 79, 61, 103, 242, 157, 207, 196, - 197, 25, 43, 167, 35, 14, 222, 41, 78, 211, 19, 242, 76, 92, 156, - 65, 185, 180, 30, 64, 147, 186, 184, 158, 138, 139, 51, 214, 28, 61, - 102, 80, 167, 210, 199, 124, 42, 46, 206, 160, 221, 69, 142, 103, 66, - 158, 137, 29, 207, 160, 61, 69, 142, 103, 194, 158, 138, 29, 207, 32, - 78, 232, 61, 138, 143, 192, 15, 94, 152, 97, 134, 157, 3, 25, 6, - 188, 105, 89, 230, 113, 6, 203, 209, 59, 59, 159, 112, 247, 91, 101, - 137, 139, 51, 40, 151, 232, 8, 3, 26, 117, 42, 243, 12, 89, 226, - 226, 76, 24, 167, 3, 235, 77, 234, 18, 243, 88, 92, 156, 65, 185, - 60, 102, 194, 52, 29, 214, 199, 226, 226, 12, 218, 93, 228, 120, 198, - 39, 75, 236, 120, 6, 237, 41, 114, 60, 99, 125, 44, 118, 60, 131, - 56, 161, 247, 40, 166, 131, 31, 100, 155, 97, 134, 157, 3, 105, 5, - 222, 184, 12, 243, 56, 131, 229, 104, 12, 200, 228, 238, 81, 204, 16, - 23, 103, 80, 46, 141, 1, 64, 163, 78, 101, 12, 253, 80, 92, 156, - 177, 114, 58, 176, 222, 164, 46, 161, 15, 197, 197, 25, 148, 171, 187, - 71, 81, 211, 145, 150, 46, 46, 206, 160, 221, 69, 142, 103, 208, 198, - 34, 199, 51, 161, 15, 197, 142, 103, 208, 118, 34, 199, 51, 136, 19, - 122, 222, 112, 161, 12, 239, 184, 71, 110, 48, 19, 54, 108, 204, 148, - 81, 234, 121, 243, 22, 238, 123, 164, 61, 120, 232, 237, 87, 58, 3, - 48, 83, 88, 26, 62, 188, 134, 188, 102, 73, 216, 158, 10, 217, 85, - 236, 47, 221, 163, 248, 128, 139, 1, 15, 184, 243, 185, 74, 101, 228, - 233, 7, 72, 29, 59, 122, 84, 195, 140, 183, 197, 219, 226, 254, 143, - 198, 0, 94, 71, 127, 192, 190, 166, 199, 89, 210, 19, 29, 213, 60, - 211, 209, 159, 219, 107, 95, 38, 195, 155, 212, 197, 199, 35, 29, 213, - 61, 210, 129, 114, 233, 57, 19, 168, 67, 187, 211, 36, 180, 132, 145, - 14, 135, 237, 216, 209, 197, 26, 102, 242, 210, 225, 176, 209, 115, 38, - 56, 29, 49, 240, 253, 80, 167, 82, 162, 152, 59, 29, 86, 9, 117, - 76, 156, 239, 179, 167, 83, 237, 162, 90, 123, 88, 196, 45, 46, 117, - 245, 40, 205, 213, 3, 104, 63, 77, 71, 76, 145, 188, 117, 188, 223, - 196, 127, 79, 15, 239, 251, 208, 190, 120, 83, 29, 5, 12, 116, 248, - 113, 58, 44, 154, 78, 229, 155, 23, 202, 91, 71, 219, 125, 243, 183, - 213, 89, 176, 164, 153, 212, 161, 128, 105, 61, 166, 105, 62, 90, 79, - 177, 170, 122, 38, 185, 222, 246, 218, 152, 115, 205, 92, 73, 103, 233, - 60, 238, 165, 96, 37, 186, 83, 122, 246, 245, 133, 114, 30, 46, 161, - 235, 99, 78, 211, 124, 249, 127, 203, 187, 248, 252, 47, 122, 23, 196, - 134, 254, 93, 28, 220, 125, 178, 14, 27, 123, 23, 135, 205, 252, 93, - 28, 54, 246, 46, 42, 173, 190, 139, 195, 102, 246, 46, 223, 121, 169, - 24, 170, 167, 120, 86, 222, 118, 25, 217, 99, 149, 206, 46, 195, 44, - 175, 88, 28, 150, 38, 150, 37, 150, 214, 44, 7, 117, 127, 39, 249, - 243, 246, 101, 219, 230, 182, 139, 151, 173, 135, 252, 202, 208, 155, 191, - 25, 189, 139, 87, 114, 79, 121, 236, 137, 47, 180, 62, 93, 136, 92, - 240, 217, 120, 37, 182, 20, 182, 245, 150, 111, 45, 56, 108, 56, 158, - 41, 146, 220, 71, 110, 148, 213, 76, 139, 149, 253, 228, 55, 254, 94, - 160, 208, 245, 18, 251, 203, 206, 105, 52, 135, 218, 45, 111, 147, 14, - 239, 201, 101, 10, 70, 104, 101, 66, 229, 133, 41, 106, 62, 251, 91, - 109, 135, 203, 94, 247, 203, 26, 222, 223, 120, 113, 255, 88, 185, 145, - 125, 132, 86, 102, 146, 60, 54, 92, 221, 163, 123, 190, 141, 67, 254, - 178, 229, 97, 67, 222, 156, 253, 243, 229, 194, 157, 125, 246, 168, 79, - 151, 80, 250, 173, 65, 95, 112, 207, 141, 191, 27, 182, 75, 228, 187, - 133, 142, 157, 97, 75, 88, 152, 216, 58, 247, 119, 11, 253, 98, 129, - 109, 84, 246, 122, 118, 198, 7, 124, 51, 252, 69, 194, 175, 128, 218, - 82, 121, 47, 216, 215, 73, 238, 59, 183, 122, 187, 220, 223, 173, 27, - 124, 183, 222, 99, 179, 13, 109, 239, 13, 223, 45, 248, 80, 209, 68, - 242, 221, 66, 166, 118, 85, 232, 204, 246, 189, 229, 30, 229, 62, 54, - 180, 125, 182, 179, 143, 156, 146, 180, 41, 145, 124, 183, 211, 87, 15, - 41, 244, 195, 132, 254, 242, 221, 31, 140, 109, 127, 69, 126, 79, 78, - 187, 244, 122, 18, 249, 110, 77, 166, 169, 123, 186, 143, 180, 25, 46, - 59, 7, 173, 54, 228, 253, 2, 190, 219, 216, 173, 251, 233, 119, 59, - 95, 234, 162, 66, 255, 2, 223, 109, 208, 149, 98, 134, 182, 127, 4, - 223, 109, 230, 4, 127, 250, 221, 8, 221, 31, 190, 27, 123, 110, 252, - 221, 176, 173, 55, 195, 219, 168, 92, 120, 27, 170, 125, 183, 37, 240, - 163, 57, 193, 128, 183, 148, 204, 38, 187, 220, 225, 109, 195, 254, 146, - 175, 25, 189, 203, 11, 103, 79, 121, 226, 224, 166, 109, 200, 119, 187, - 80, 185, 123, 27, 149, 183, 183, 252, 250, 137, 225, 109, 140, 121, 251, - 200, 53, 83, 3, 218, 144, 239, 54, 229, 86, 21, 133, 246, 6, 188, - 221, 111, 115, 220, 80, 239, 115, 248, 110, 227, 223, 248, 250, 53, 242, - 221, 86, 6, 141, 87, 232, 130, 128, 183, 140, 226, 87, 90, 27, 241, - 62, 131, 239, 86, 184, 190, 119, 107, 242, 221, 42, 117, 252, 202, 170, - 242, 58, 228, 87, 235, 70, 237, 52, 230, 157, 47, 191, 17, 176, 178, - 41, 249, 110, 132, 238, 1, 223, 141, 61, 55, 158, 223, 192, 190, 38, - 157, 19, 244, 130, 126, 78, 186, 81, 191, 179, 153, 174, 223, 233, 44, - 152, 225, 237, 44, 96, 222, 239, 196, 114, 116, 207, 78, 65, 214, 39, - 8, 41, 224, 105, 63, 199, 253, 248, 3, 219, 20, 186, 103, 135, 211, - 129, 239, 228, 212, 244, 184, 188, 61, 237, 231, 120, 185, 237, 231, 160, - 255, 211, 122, 20, 208, 247, 115, 72, 93, 194, 188, 61, 237, 231, 184, - 175, 7, 126, 43, 58, 191, 86, 32, 67, 119, 190, 60, 107, 55, 29, - 54, 66, 175, 178, 37, 216, 141, 218, 83, 221, 217, 224, 222, 122, 121, - 12, 207, 14, 27, 161, 151, 133, 236, 182, 27, 225, 92, 183, 54, 155, - 75, 30, 243, 51, 135, 141, 208, 171, 225, 253, 140, 252, 143, 31, 247, - 160, 207, 209, 61, 54, 17, 25, 222, 118, 174, 207, 248, 178, 255, 53, - 215, 249, 95, 24, 250, 171, 197, 220, 255, 176, 28, 157, 151, 178, 48, - 249, 113, 179, 197, 249, 31, 202, 165, 227, 30, 160, 81, 167, 226, 35, - 179, 197, 249, 95, 152, 69, 239, 127, 164, 46, 41, 17, 226, 252, 15, - 109, 194, 159, 211, 230, 206, 255, 66, 43, 172, 240, 216, 255, 236, 156, - 60, 251, 160, 34, 110, 253, 47, 12, 228, 121, 234, 127, 88, 87, 34, - 207, 1, 239, 231, 206, 255, 82, 124, 87, 120, 236, 127, 232, 115, 116, - 255, 253, 204, 12, 239, 52, 47, 35, 255, 107, 161, 243, 191, 148, 240, - 12, 239, 148, 89, 230, 254, 135, 229, 232, 26, 95, 56, 147, 31, 58, - 75, 156, 255, 133, 112, 58, 240, 157, 82, 52, 61, 105, 51, 197, 249, - 31, 202, 213, 173, 241, 105, 58, 28, 51, 197, 249, 31, 218, 36, 191, - 254, 167, 91, 227, 155, 153, 127, 255, 211, 173, 241, 205, 204, 191, 255, - 241, 241, 23, 125, 142, 198, 223, 137, 25, 222, 33, 17, 70, 254, 215, - 82, 231, 127, 142, 25, 25, 222, 142, 169, 230, 254, 135, 229, 232, 119, - 155, 193, 228, 251, 76, 245, 116, 222, 199, 203, 116, 190, 196, 194, 233, - 112, 76, 135, 247, 210, 244, 196, 76, 241, 116, 222, 199, 92, 7, 202, - 165, 245, 0, 154, 212, 197, 58, 197, 211, 121, 31, 15, 234, 193, 233, - 112, 76, 131, 122, 76, 215, 230, 50, 38, 123, 58, 239, 227, 101, 58, - 239, 131, 114, 105, 61, 128, 182, 104, 58, 66, 38, 231, 175, 61, 208, - 213, 131, 211, 129, 62, 130, 58, 149, 254, 208, 164, 252, 181, 7, 186, - 239, 49, 85, 223, 30, 88, 52, 29, 97, 147, 242, 215, 30, 16, 29, - 193, 154, 143, 242, 120, 115, 55, 174, 24, 234, 216, 99, 55, 154, 223, - 208, 173, 157, 76, 17, 43, 207, 42, 88, 30, 250, 153, 94, 222, 203, - 115, 40, 170, 60, 135, 205, 19, 121, 33, 188, 188, 111, 11, 58, 167, - 125, 80, 114, 79, 238, 247, 75, 123, 88, 207, 62, 115, 201, 103, 237, - 243, 154, 7, 209, 245, 39, 39, 113, 237, 243, 255, 231, 248, 92, 215, - 159, 156, 164, 175, 111, 244, 161, 79, 155, 229, 150, 103, 143, 171, 99, - 143, 62, 84, 42, 62, 175, 113, 163, 174, 63, 57, 145, 139, 231, 149, - 192, 15, 103, 26, 181, 167, 173, 244, 253, 73, 224, 13, 11, 243, 160, - 63, 57, 145, 235, 79, 126, 196, 249, 122, 77, 79, 219, 211, 130, 166, - 237, 16, 202, 165, 253, 73, 160, 81, 167, 130, 223, 87, 60, 109, 79, - 205, 117, 132, 113, 58, 210, 38, 64, 223, 71, 171, 139, 179, 186, 167, - 237, 169, 7, 245, 152, 192, 213, 3, 232, 48, 77, 71, 76, 53, 79, - 219, 211, 130, 166, 237, 105, 24, 167, 35, 13, 190, 31, 234, 84, 252, - 166, 170, 167, 237, 105, 33, 183, 237, 16, 150, 161, 245, 8, 227, 234, - 1, 116, 152, 166, 195, 85, 217, 211, 246, 180, 144, 219, 246, 20, 203, - 208, 122, 132, 229, 234, 223, 135, 105, 253, 171, 74, 158, 182, 167, 238, - 235, 129, 255, 79, 239, 246, 172, 153, 65, 239, 246, 196, 92, 110, 119, - 237, 21, 230, 114, 231, 110, 175, 154, 88, 2, 94, 58, 47, 77, 255, - 46, 234, 159, 95, 234, 32, 211, 185, 230, 180, 242, 75, 185, 50, 177, - 148, 30, 247, 236, 132, 41, 111, 116, 57, 11, 55, 31, 237, 75, 233, - 189, 95, 7, 202, 102, 188, 196, 6, 136, 161, 255, 235, 54, 64, 140, - 255, 95, 183, 1, 182, 65, 122, 27, 188, 28, 107, 85, 27, 232, 99, - 109, 19, 139, 175, 215, 203, 54, 112, 216, 152, 13, 84, 90, 181, 129, - 241, 90, 135, 106, 3, 118, 174, 1, 161, 85, 27, 24, 243, 170, 54, - 112, 216, 152, 13, 84, 90, 181, 129, 49, 47, 218, 32, 200, 75, 109, - 35, 235, 41, 45, 7, 188, 249, 217, 91, 118, 108, 243, 72, 61, 8, - 125, 37, 125, 144, 196, 158, 147, 179, 29, 94, 177, 116, 128, 31, 145, - 183, 115, 244, 82, 169, 219, 116, 210, 183, 96, 223, 114, 118, 210, 118, - 201, 246, 99, 222, 125, 11, 197, 126, 61, 246, 73, 115, 27, 47, 212, - 222, 55, 69, 58, 219, 104, 155, 66, 103, 31, 248, 87, 106, 114, 249, - 50, 173, 199, 90, 75, 31, 203, 102, 203, 251, 150, 68, 203, 40, 202, - 59, 184, 229, 3, 41, 115, 70, 97, 226, 131, 242, 230, 86, 215, 148, - 242, 203, 23, 22, 150, 51, 75, 239, 165, 188, 127, 90, 38, 89, 46, - 1, 95, 154, 37, 148, 157, 117, 240, 71, 41, 185, 204, 7, 229, 119, - 17, 251, 17, 186, 240, 91, 213, 184, 231, 216, 160, 54, 177, 148, 134, - 95, 13, 175, 38, 47, 217, 15, 219, 127, 98, 191, 110, 255, 221, 178, - 99, 123, 78, 236, 71, 232, 42, 155, 103, 72, 236, 57, 218, 175, 153, - 114, 110, 114, 111, 248, 145, 245, 138, 209, 167, 54, 74, 172, 47, 197, - 236, 247, 214, 170, 88, 201, 108, 173, 99, 109, 145, 157, 82, 135, 83, - 123, 146, 136, 253, 98, 254, 78, 80, 232, 70, 79, 92, 210, 181, 93, - 187, 232, 186, 193, 231, 150, 58, 96, 191, 58, 150, 61, 240, 35, 188, - 222, 33, 233, 82, 249, 213, 123, 216, 185, 161, 45, 39, 43, 107, 38, - 213, 27, 148, 147, 49, 118, 17, 222, 147, 150, 32, 229, 44, 149, 98, - 94, 237, 41, 239, 251, 203, 202, 203, 246, 97, 51, 127, 35, 246, 35, - 116, 147, 65, 213, 184, 231, 22, 75, 41, 206, 126, 132, 151, 216, 15, - 99, 27, 177, 95, 107, 176, 31, 198, 42, 98, 63, 66, 35, 142, 216, - 115, 180, 95, 45, 176, 95, 19, 240, 191, 38, 58, 28, 157, 250, 143, - 244, 29, 153, 253, 138, 78, 217, 14, 207, 243, 238, 59, 34, 111, 214, - 130, 125, 210, 180, 232, 162, 219, 136, 253, 138, 252, 108, 85, 232, 226, - 25, 255, 74, 85, 82, 67, 183, 49, 255, 107, 2, 246, 107, 2, 254, - 199, 120, 31, 151, 120, 32, 253, 178, 126, 30, 41, 35, 143, 174, 56, - 120, 155, 58, 127, 95, 88, 254, 98, 191, 109, 27, 243, 191, 38, 96, - 191, 38, 150, 251, 186, 181, 142, 82, 242, 200, 42, 206, 70, 196, 126, - 132, 238, 1, 246, 99, 207, 221, 251, 31, 157, 63, 168, 196, 250, 187, - 113, 229, 161, 239, 51, 209, 168, 191, 219, 90, 63, 127, 80, 17, 198, - 133, 21, 60, 152, 63, 168, 200, 245, 75, 42, 114, 243, 7, 21, 196, - 205, 95, 89, 56, 29, 248, 78, 14, 77, 79, 140, 175, 184, 249, 43, - 148, 171, 27, 175, 106, 58, 172, 190, 226, 230, 175, 208, 38, 34, 231, - 79, 177, 254, 34, 231, 79, 173, 190, 98, 231, 79, 209, 231, 232, 61, - 28, 189, 192, 142, 149, 140, 252, 239, 53, 157, 255, 89, 129, 215, 90, - 206, 220, 255, 176, 28, 221, 35, 87, 142, 201, 119, 150, 21, 231, 127, - 40, 151, 238, 245, 3, 26, 117, 42, 115, 50, 101, 197, 249, 159, 181, - 156, 222, 255, 72, 93, 92, 62, 226, 252, 15, 109, 34, 114, 254, 52, - 164, 172, 216, 249, 83, 172, 171, 200, 249, 83, 244, 57, 186, 126, 212, - 61, 195, 59, 174, 188, 129, 255, 53, 181, 234, 252, 207, 15, 120, 253, - 122, 154, 251, 31, 150, 163, 251, 180, 122, 114, 235, 71, 61, 196, 249, - 31, 202, 165, 251, 180, 128, 70, 157, 74, 255, 179, 135, 56, 255, 243, - 235, 153, 107, 159, 150, 86, 151, 148, 238, 2, 215, 143, 122, 8, 94, - 63, 234, 33, 120, 253, 168, 187, 224, 245, 163, 238, 220, 124, 83, 151, - 12, 239, 152, 94, 70, 254, 167, 223, 183, 153, 210, 45, 195, 59, 165, - 171, 7, 235, 71, 221, 184, 245, 163, 110, 220, 250, 81, 87, 129, 235, - 71, 156, 14, 124, 167, 20, 77, 79, 90, 23, 129, 235, 71, 93, 115, - 173, 31, 105, 58, 28, 93, 4, 174, 31, 117, 21, 188, 126, 212, 69, - 240, 250, 81, 23, 193, 235, 71, 93, 184, 254, 95, 167, 12, 239, 144, - 238, 70, 254, 167, 223, 191, 225, 120, 3, 250, 89, 175, 123, 208, 255, - 123, 131, 251, 110, 111, 112, 253, 191, 215, 5, 246, 255, 56, 29, 248, - 78, 14, 77, 79, 76, 103, 129, 253, 191, 215, 115, 245, 255, 52, 29, - 214, 206, 2, 251, 127, 175, 11, 238, 255, 117, 22, 220, 255, 235, 44, - 184, 255, 215, 137, 249, 159, 143, 12, 118, 236, 226, 198, 255, 180, 60, - 143, 49, 195, 134, 235, 251, 127, 192, 27, 215, 33, 195, 52, 63, 10, - 203, 209, 254, 95, 71, 38, 63, 90, 206, 107, 14, 217, 98, 119, 55, - 223, 158, 251, 187, 61, 250, 47, 188, 29, 237, 255, 117, 228, 250, 127, - 64, 163, 78, 165, 208, 120, 79, 116, 84, 203, 83, 199, 245, 153, 237, - 232, 189, 130, 86, 78, 7, 214, 155, 212, 197, 53, 214, 19, 29, 213, - 243, 212, 177, 180, 109, 203, 36, 90, 143, 14, 122, 31, 183, 106, 58, - 156, 99, 140, 116, 188, 60, 223, 254, 82, 206, 74, 163, 153, 54, 50, - 111, 134, 118, 39, 243, 102, 184, 215, 15, 237, 72, 228, 17, 186, 247, - 154, 185, 18, 123, 238, 190, 13, 59, 255, 115, 41, 249, 68, 90, 61, - 186, 71, 147, 148, 47, 153, 241, 142, 124, 96, 238, 2, 67, 222, 71, - 37, 198, 202, 55, 27, 111, 213, 202, 204, 146, 165, 38, 123, 181, 243, - 164, 163, 228, 148, 185, 39, 12, 121, 115, 10, 44, 144, 255, 110, 120, - 169, 29, 217, 55, 71, 232, 176, 27, 203, 184, 231, 121, 183, 227, 105, - 154, 95, 240, 54, 192, 239, 76, 108, 64, 104, 220, 235, 204, 158, 187, - 151, 247, 15, 216, 32, 34, 120, 96, 34, 177, 1, 41, 95, 28, 108, - 208, 112, 112, 75, 67, 222, 199, 96, 131, 118, 195, 171, 38, 18, 27, - 52, 218, 171, 238, 89, 69, 27, 220, 123, 254, 36, 193, 204, 6, 187, - 238, 157, 76, 32, 54, 32, 52, 218, 128, 61, 55, 182, 1, 250, 45, - 111, 3, 244, 67, 98, 3, 66, 15, 7, 27, 176, 231, 238, 229, 149, - 140, 47, 37, 23, 252, 37, 50, 137, 216, 128, 148, 111, 4, 54, 24, - 56, 181, 118, 146, 153, 31, 148, 143, 59, 64, 109, 208, 239, 143, 48, - 133, 246, 2, 27, 116, 221, 85, 44, 209, 204, 6, 129, 99, 98, 218, - 18, 27, 16, 122, 2, 216, 128, 61, 55, 182, 1, 226, 138, 183, 1, - 226, 132, 216, 128, 208, 232, 7, 236, 121, 222, 126, 112, 183, 208, 116, - 186, 231, 157, 148, 71, 63, 24, 18, 111, 204, 139, 54, 72, 220, 65, - 206, 63, 157, 37, 251, 201, 234, 121, 166, 232, 7, 191, 126, 19, 97, - 51, 179, 65, 249, 247, 72, 153, 37, 148, 70, 63, 96, 207, 141, 251, - 32, 216, 238, 211, 179, 229, 70, 66, 187, 214, 201, 48, 6, 40, 249, - 75, 116, 15, 37, 216, 207, 249, 161, 121, 12, 192, 114, 116, 127, 231, - 104, 110, 15, 233, 135, 158, 198, 0, 247, 177, 27, 241, 78, 247, 119, - 142, 230, 246, 169, 2, 109, 215, 218, 76, 215, 40, 79, 99, 128, 123, - 29, 136, 39, 90, 15, 78, 7, 214, 155, 212, 37, 108, 148, 167, 49, - 192, 189, 14, 244, 87, 90, 143, 15, 115, 237, 83, 37, 246, 26, 229, - 105, 12, 112, 175, 3, 253, 129, 206, 11, 124, 168, 223, 7, 202, 218, - 77, 135, 141, 208, 219, 236, 9, 118, 163, 246, 84, 183, 175, 96, 148, - 94, 30, 107, 131, 28, 54, 66, 163, 60, 163, 182, 73, 183, 175, 32, - 151, 60, 134, 103, 135, 141, 208, 241, 32, 207, 8, 231, 186, 51, 132, - 114, 201, 99, 216, 112, 216, 8, 141, 239, 103, 132, 25, 190, 223, 132, - 56, 161, 249, 126, 67, 129, 150, 205, 48, 195, 242, 202, 45, 192, 235, - 24, 110, 142, 25, 44, 71, 251, 212, 35, 184, 126, 251, 112, 113, 152, - 65, 185, 212, 215, 80, 199, 72, 173, 223, 62, 76, 28, 102, 44, 156, - 14, 172, 55, 169, 139, 117, 152, 56, 204, 160, 92, 221, 216, 64, 211, - 225, 28, 42, 14, 51, 104, 119, 62, 103, 212, 29, 102, 48, 103, 212, - 83, 204, 160, 141, 121, 121, 238, 48, 131, 242, 60, 197, 140, 53, 151, - 60, 119, 152, 241, 3, 121, 158, 98, 6, 109, 199, 203, 115, 135, 25, - 124, 63, 79, 49, 163, 224, 132, 200, 27, 4, 126, 48, 210, 12, 51, - 44, 175, 220, 57, 4, 218, 243, 193, 230, 152, 193, 114, 52, 6, 12, - 97, 242, 173, 54, 79, 49, 83, 192, 20, 51, 118, 78, 135, 19, 222, - 201, 169, 233, 177, 183, 247, 20, 51, 5, 76, 49, 131, 114, 105, 61, - 128, 38, 117, 9, 105, 231, 41, 102, 10, 152, 98, 198, 62, 88, 143, - 25, 212, 169, 140, 111, 131, 61, 197, 76, 1, 67, 204, 108, 215, 236, - 94, 79, 27, 215, 123, 239, 124, 152, 228, 14, 51, 23, 198, 150, 183, - 155, 245, 219, 135, 223, 13, 179, 63, 255, 120, 151, 86, 38, 198, 126, - 114, 82, 178, 66, 191, 82, 37, 222, 126, 60, 102, 191, 33, 222, 74, - 252, 118, 132, 147, 239, 162, 116, 226, 215, 143, 237, 158, 140, 23, 182, - 107, 223, 150, 212, 227, 246, 175, 15, 147, 220, 97, 245, 44, 212, 195, - 172, 239, 61, 0, 234, 145, 232, 53, 108, 55, 169, 199, 187, 221, 50, - 21, 186, 57, 212, 195, 254, 69, 101, 67, 156, 151, 130, 122, 48, 249, - 46, 74, 239, 134, 122, 120, 210, 231, 223, 174, 249, 15, 169, 199, 181, - 239, 31, 38, 185, 107, 35, 26, 140, 46, 111, 55, 235, 63, 23, 114, - 133, 217, 167, 142, 105, 145, 68, 234, 113, 227, 245, 242, 10, 221, 160, - 81, 188, 253, 104, 169, 130, 73, 70, 245, 168, 182, 251, 8, 39, 223, - 69, 233, 123, 171, 31, 219, 61, 233, 183, 111, 215, 124, 148, 212, 163, - 30, 248, 149, 187, 182, 233, 10, 124, 15, 179, 62, 176, 3, 190, 71, - 47, 218, 63, 143, 177, 127, 25, 164, 222, 85, 240, 168, 114, 188, 253, - 243, 161, 179, 12, 219, 181, 34, 240, 61, 152, 124, 23, 165, 157, 240, - 61, 60, 237, 123, 99, 59, 72, 239, 232, 107, 13, 56, 31, 106, 214, - 38, 178, 251, 3, 92, 109, 51, 188, 67, 219, 152, 183, 137, 88, 142, - 222, 159, 215, 150, 201, 79, 123, 45, 127, 253, 8, 126, 254, 37, 148, - 211, 225, 130, 119, 114, 105, 122, 28, 175, 229, 175, 31, 193, 207, 191, - 160, 92, 90, 15, 160, 73, 93, 124, 94, 203, 95, 63, 130, 159, 127, - 9, 109, 163, 111, 19, 81, 167, 226, 25, 173, 243, 215, 143, 32, 243, - 47, 193, 154, 221, 73, 92, 109, 24, 90, 196, 249, 124, 80, 151, 151, - 230, 95, 124, 156, 39, 108, 217, 173, 230, 122, 212, 143, 112, 112, 242, - 156, 32, 111, 70, 252, 240, 151, 230, 50, 162, 147, 79, 216, 54, 182, - 203, 123, 62, 66, 119, 222, 13, 39, 47, 109, 36, 200, 43, 212, 250, - 165, 121, 1, 215, 129, 19, 182, 189, 155, 91, 36, 121, 212, 207, 105, - 205, 228, 69, 195, 251, 245, 253, 112, 198, 75, 99, 236, 80, 168, 111, - 145, 55, 103, 122, 212, 143, 64, 156, 16, 204, 184, 154, 66, 252, 29, - 100, 134, 25, 118, 127, 64, 204, 171, 25, 222, 126, 173, 204, 49, 131, - 229, 232, 122, 222, 171, 220, 154, 77, 51, 79, 49, 83, 198, 173, 31, - 164, 93, 14, 161, 119, 78, 250, 113, 58, 98, 224, 157, 98, 52, 61, - 161, 239, 121, 138, 25, 247, 58, 124, 127, 237, 65, 117, 160, 92, 90, - 15, 160, 73, 93, 98, 6, 120, 138, 25, 247, 58, 70, 149, 60, 78, - 251, 17, 126, 173, 114, 173, 75, 182, 210, 198, 221, 253, 60, 197, 140, - 123, 29, 155, 158, 171, 231, 211, 204, 45, 160, 218, 189, 158, 82, 82, - 221, 235, 135, 118, 36, 242, 8, 253, 70, 220, 28, 59, 123, 238, 190, - 221, 189, 218, 235, 153, 253, 76, 219, 42, 244, 126, 176, 95, 255, 236, - 164, 148, 31, 144, 58, 72, 242, 122, 220, 212, 240, 220, 193, 167, 229, - 151, 74, 12, 171, 177, 116, 126, 212, 235, 217, 102, 201, 8, 171, 22, - 229, 110, 202, 109, 82, 141, 113, 81, 90, 153, 157, 82, 249, 209, 31, - 43, 52, 222, 107, 89, 98, 228, 66, 147, 249, 206, 125, 210, 130, 107, - 203, 232, 221, 123, 155, 162, 190, 162, 247, 90, 30, 173, 185, 206, 144, - 215, 82, 240, 148, 84, 233, 242, 70, 122, 247, 222, 231, 235, 227, 212, - 121, 214, 136, 179, 210, 25, 239, 29, 198, 122, 35, 47, 72, 181, 247, - 36, 208, 187, 247, 90, 212, 85, 251, 92, 94, 17, 151, 37, 121, 193, - 1, 67, 94, 175, 168, 107, 82, 86, 193, 67, 244, 94, 203, 26, 29, - 143, 169, 115, 195, 17, 183, 165, 129, 115, 78, 26, 242, 214, 138, 186, - 43, 69, 251, 166, 210, 123, 45, 251, 79, 191, 161, 208, 221, 34, 210, - 165, 93, 174, 71, 134, 188, 225, 81, 153, 210, 202, 187, 69, 181, 125, - 111, 89, 82, 237, 113, 85, 21, 122, 72, 68, 182, 116, 58, 35, 176, - 189, 17, 239, 127, 142, 28, 105, 228, 67, 122, 199, 183, 236, 172, 212, - 95, 161, 71, 219, 188, 228, 167, 109, 7, 24, 242, 166, 58, 189, 229, - 22, 161, 77, 181, 50, 5, 101, 231, 136, 90, 10, 189, 54, 188, 176, - 188, 123, 182, 151, 33, 239, 209, 200, 98, 242, 107, 235, 137, 77, 74, - 202, 242, 37, 245, 27, 61, 108, 95, 74, 254, 219, 59, 198, 120, 30, - 221, 89, 90, 110, 255, 234, 231, 90, 25, 31, 57, 120, 139, 234, 75, - 57, 237, 203, 202, 11, 235, 204, 49, 228, 125, 225, 44, 39, 179, 57, - 126, 95, 74, 159, 159, 94, 65, 54, 155, 251, 167, 184, 124, 79, 143, - 75, 108, 123, 8, 46, 9, 253, 58, 224, 146, 61, 119, 47, 239, 18, - 224, 178, 204, 124, 255, 96, 130, 75, 239, 61, 146, 82, 190, 27, 222, - 45, 214, 171, 172, 97, 223, 246, 38, 224, 146, 197, 188, 88, 58, 103, - 95, 5, 112, 105, 20, 243, 144, 183, 72, 193, 109, 82, 114, 15, 47, - 122, 111, 95, 145, 183, 127, 81, 116, 21, 3, 92, 190, 26, 216, 207, - 80, 239, 35, 192, 101, 220, 165, 154, 109, 8, 46, 79, 76, 246, 83, - 222, 255, 217, 211, 163, 82, 250, 228, 213, 134, 109, 73, 118, 129, 83, - 210, 43, 247, 110, 4, 19, 92, 222, 93, 86, 158, 222, 55, 219, 101, - 112, 29, 67, 219, 63, 5, 92, 246, 216, 100, 167, 184, 60, 18, 244, - 154, 66, 215, 6, 92, 62, 216, 218, 212, 144, 183, 24, 224, 242, 183, - 20, 111, 138, 203, 35, 255, 170, 247, 190, 122, 1, 46, 253, 170, 125, - 108, 248, 206, 87, 34, 239, 74, 251, 31, 173, 108, 75, 112, 249, 247, - 187, 23, 148, 61, 162, 15, 194, 211, 165, 253, 43, 182, 237, 54, 110, - 75, 50, 165, 216, 175, 246, 237, 38, 184, 188, 115, 168, 104, 130, 218, - 14, 101, 75, 243, 247, 55, 49, 180, 243, 139, 200, 28, 233, 210, 221, - 209, 164, 140, 188, 114, 203, 167, 10, 237, 5, 184, 180, 13, 253, 222, - 144, 23, 239, 196, 108, 244, 233, 254, 4, 130, 203, 255, 126, 79, 85, - 233, 136, 194, 242, 170, 181, 22, 67, 223, 192, 187, 197, 46, 220, 47, - 71, 239, 237, 107, 240, 101, 109, 149, 182, 149, 146, 223, 24, 19, 96, - 204, 11, 184, 44, 115, 187, 69, 34, 193, 229, 46, 223, 215, 52, 222, - 178, 242, 32, 155, 241, 154, 18, 226, 146, 173, 59, 249, 82, 26, 113, - 105, 182, 30, 69, 112, 137, 241, 157, 224, 114, 1, 224, 18, 227, 53, - 193, 37, 161, 151, 3, 46, 217, 115, 247, 242, 222, 234, 253, 204, 238, - 119, 147, 248, 163, 85, 10, 12, 216, 167, 148, 47, 112, 118, 144, 20, - 212, 245, 186, 161, 237, 47, 151, 3, 92, 210, 190, 99, 44, 93, 71, - 250, 0, 112, 105, 212, 119, 84, 244, 226, 157, 127, 125, 171, 37, 17, - 92, 118, 169, 85, 72, 161, 223, 6, 92, 158, 251, 251, 130, 161, 13, - 110, 2, 46, 219, 95, 251, 60, 145, 224, 114, 76, 117, 155, 66, 223, - 4, 92, 70, 92, 141, 51, 124, 231, 58, 16, 47, 119, 15, 113, 180, - 37, 184, 252, 115, 172, 122, 159, 116, 81, 192, 101, 211, 210, 141, 12, - 177, 181, 14, 112, 185, 224, 239, 69, 20, 151, 39, 187, 170, 49, 62, - 21, 112, 89, 38, 209, 97, 200, 123, 41, 242, 154, 116, 125, 241, 3, - 122, 87, 109, 131, 170, 125, 20, 122, 95, 248, 109, 105, 195, 227, 25, - 134, 216, 186, 7, 184, 140, 158, 251, 52, 129, 224, 50, 112, 205, 79, - 10, 61, 221, 145, 46, 85, 59, 211, 217, 176, 190, 71, 33, 94, 150, - 95, 84, 149, 222, 167, 233, 31, 171, 246, 51, 240, 174, 218, 87, 170, - 159, 53, 238, 91, 204, 206, 145, 46, 23, 10, 162, 241, 178, 92, 231, - 38, 10, 157, 6, 184, 60, 60, 183, 153, 97, 204, 171, 152, 236, 45, - 91, 143, 61, 110, 71, 112, 57, 229, 59, 181, 159, 177, 15, 226, 165, - 99, 115, 73, 67, 189, 159, 2, 46, 165, 14, 165, 41, 46, 67, 135, - 111, 81, 232, 61, 16, 47, 27, 76, 118, 25, 250, 198, 74, 192, 101, - 249, 138, 165, 147, 8, 46, 123, 156, 175, 174, 208, 201, 16, 47, 247, - 125, 21, 104, 232, 147, 143, 1, 151, 108, 45, 212, 151, 210, 151, 0, - 151, 102, 107, 164, 4, 151, 216, 39, 230, 227, 37, 246, 113, 9, 46, - 9, 141, 57, 43, 236, 185, 123, 121, 7, 32, 94, 214, 155, 193, 114, - 86, 142, 105, 229, 235, 67, 188, 12, 41, 102, 204, 123, 15, 226, 37, - 27, 131, 197, 210, 181, 205, 194, 128, 75, 163, 49, 152, 218, 23, 221, - 6, 254, 50, 139, 222, 197, 249, 119, 11, 237, 174, 70, 192, 229, 234, - 127, 195, 13, 121, 159, 2, 46, 183, 239, 140, 160, 119, 113, 70, 100, - 147, 117, 206, 163, 210, 27, 193, 179, 77, 244, 158, 146, 170, 84, 158, - 77, 239, 226, 140, 216, 31, 161, 221, 17, 121, 86, 138, 251, 202, 120, - 174, 229, 57, 224, 242, 65, 25, 58, 79, 35, 253, 81, 156, 240, 94, - 150, 214, 21, 50, 227, 189, 38, 221, 93, 16, 65, 239, 226, 124, 255, - 107, 194, 123, 91, 58, 22, 103, 204, 251, 2, 112, 217, 122, 69, 4, - 189, 139, 243, 122, 119, 149, 46, 2, 253, 216, 229, 5, 140, 121, 125, - 1, 151, 7, 78, 176, 187, 56, 87, 13, 81, 109, 254, 10, 196, 203, - 222, 143, 103, 24, 242, 158, 130, 120, 153, 29, 57, 133, 222, 197, 217, - 112, 176, 74, 151, 5, 92, 246, 151, 167, 24, 242, 62, 132, 120, 185, - 113, 248, 12, 122, 23, 103, 167, 213, 170, 63, 60, 0, 92, 190, 83, - 208, 248, 157, 159, 2, 46, 203, 116, 101, 119, 113, 254, 123, 91, 243, - 13, 136, 151, 157, 119, 27, 251, 6, 198, 203, 82, 95, 18, 191, 242, - 145, 71, 214, 32, 247, 135, 150, 149, 247, 127, 103, 236, 147, 24, 47, - 217, 250, 188, 47, 165, 49, 94, 154, 173, 219, 147, 57, 5, 156, 71, - 160, 243, 112, 189, 97, 156, 220, 218, 108, 78, 129, 221, 21, 21, 10, - 188, 161, 125, 205, 231, 20, 176, 28, 157, 191, 226, 198, 198, 105, 125, - 196, 173, 231, 161, 92, 58, 15, 7, 239, 132, 58, 21, 105, 125, 196, - 173, 231, 161, 92, 90, 15, 212, 161, 213, 197, 167, 143, 184, 245, 188, - 208, 190, 185, 230, 225, 250, 106, 243, 22, 189, 197, 173, 231, 161, 221, - 69, 174, 231, 57, 250, 136, 93, 207, 243, 233, 35, 118, 61, 15, 109, - 39, 114, 61, 15, 113, 66, 231, 225, 2, 51, 188, 93, 77, 205, 48, - 195, 238, 138, 138, 105, 2, 24, 107, 236, 193, 60, 92, 19, 110, 254, - 170, 9, 183, 119, 191, 145, 56, 204, 248, 113, 58, 98, 224, 157, 98, - 52, 61, 246, 70, 226, 48, 131, 114, 105, 61, 128, 38, 117, 73, 9, - 18, 135, 25, 191, 198, 185, 230, 225, 26, 107, 243, 137, 65, 226, 48, - 131, 118, 207, 47, 102, 44, 252, 125, 104, 141, 242, 143, 25, 94, 30, - 218, 51, 191, 152, 225, 229, 133, 6, 229, 31, 51, 186, 56, 19, 200, - 229, 91, 53, 0, 63, 232, 109, 134, 25, 118, 87, 84, 40, 98, 204, - 223, 131, 56, 19, 200, 197, 128, 0, 38, 63, 204, 95, 28, 102, 80, - 46, 141, 1, 64, 163, 78, 165, 144, 191, 56, 204, 132, 114, 58, 176, - 222, 164, 46, 209, 13, 197, 97, 6, 229, 242, 152, 9, 213, 116, 248, - 53, 20, 135, 25, 180, 187, 200, 56, 99, 241, 23, 27, 103, 208, 158, - 34, 227, 140, 95, 67, 177, 113, 6, 113, 66, 48, 19, 90, 7, 252, - 32, 208, 4, 51, 77, 217, 93, 81, 126, 192, 27, 83, 207, 28, 51, - 88, 142, 198, 128, 250, 220, 190, 145, 122, 226, 48, 131, 114, 105, 12, - 0, 26, 117, 42, 235, 197, 117, 197, 97, 198, 143, 211, 129, 245, 38, - 117, 9, 169, 43, 14, 51, 40, 151, 199, 140, 159, 166, 195, 85, 71, - 28, 102, 208, 238, 34, 227, 12, 218, 88, 100, 156, 9, 169, 43, 54, - 206, 160, 237, 68, 198, 25, 196, 9, 221, 107, 245, 28, 252, 160, 129, - 25, 102, 216, 158, 94, 87, 109, 104, 207, 107, 121, 176, 175, 160, 54, - 23, 3, 106, 115, 227, 25, 63, 129, 227, 25, 78, 135, 11, 222, 201, - 165, 233, 113, 248, 9, 28, 207, 212, 226, 234, 1, 52, 169, 75, 220, - 11, 129, 227, 153, 90, 185, 198, 51, 181, 180, 62, 230, 11, 129, 227, - 25, 63, 193, 227, 25, 63, 177, 113, 6, 237, 41, 50, 206, 216, 95, - 136, 141, 51, 136, 19, 138, 153, 199, 224, 7, 117, 242, 198, 204, 71, - 163, 70, 88, 38, 113, 223, 195, 14, 188, 206, 103, 238, 48, 163, 191, - 247, 6, 203, 209, 189, 131, 57, 76, 126, 204, 211, 188, 207, 211, 146, - 239, 183, 76, 250, 240, 120, 169, 96, 163, 92, 168, 155, 73, 195, 233, - 62, 25, 148, 75, 247, 14, 2, 141, 58, 21, 105, 217, 121, 235, 72, - 191, 87, 60, 97, 210, 238, 38, 134, 185, 80, 43, 39, 5, 177, 61, - 144, 156, 14, 172, 55, 169, 75, 232, 147, 188, 117, 188, 83, 229, 213, - 164, 184, 244, 118, 237, 141, 114, 161, 106, 206, 108, 65, 247, 226, 160, - 92, 221, 62, 120, 77, 135, 61, 43, 111, 29, 65, 83, 166, 218, 250, - 79, 118, 24, 230, 66, 53, 121, 155, 229, 66, 161, 221, 249, 252, 15, - 180, 35, 145, 71, 104, 204, 133, 98, 207, 45, 150, 101, 150, 122, 150, - 141, 150, 186, 150, 31, 225, 71, 218, 221, 115, 63, 151, 146, 253, 251, - 251, 210, 60, 32, 82, 30, 115, 161, 110, 204, 155, 97, 56, 39, 141, - 249, 31, 242, 154, 111, 104, 14, 140, 79, 191, 120, 154, 7, 244, 229, - 241, 36, 211, 28, 152, 11, 93, 78, 104, 101, 150, 80, 26, 243, 63, - 216, 243, 188, 99, 79, 154, 230, 23, 188, 13, 240, 59, 19, 27, 16, - 26, 115, 96, 216, 115, 180, 65, 32, 216, 32, 8, 108, 16, 164, 203, - 129, 201, 118, 244, 166, 249, 96, 164, 60, 230, 192, 188, 21, 93, 199, - 52, 31, 236, 207, 243, 133, 104, 62, 216, 167, 125, 175, 5, 19, 27, - 248, 239, 58, 18, 108, 102, 131, 202, 59, 214, 5, 19, 27, 16, 26, - 109, 192, 158, 27, 219, 0, 253, 150, 183, 1, 250, 33, 177, 1, 161, - 49, 23, 138, 61, 71, 27, 84, 7, 27, 84, 7, 27, 84, 215, 229, - 66, 221, 27, 205, 114, 161, 72, 121, 204, 133, 234, 181, 185, 150, 105, - 46, 212, 238, 227, 251, 168, 31, 236, 217, 61, 134, 230, 66, 29, 154, - 81, 200, 212, 15, 214, 7, 236, 167, 185, 80, 132, 198, 92, 40, 246, - 220, 216, 6, 136, 43, 222, 6, 136, 19, 98, 3, 66, 163, 31, 176, - 231, 104, 131, 241, 96, 131, 241, 96, 131, 241, 58, 63, 8, 175, 199, - 114, 161, 72, 121, 244, 131, 105, 46, 243, 92, 168, 149, 119, 89, 46, - 84, 151, 217, 44, 23, 106, 180, 203, 60, 23, 106, 220, 58, 150, 11, - 69, 104, 244, 3, 246, 220, 100, 63, 230, 99, 46, 23, 234, 33, 180, - 107, 207, 13, 99, 128, 62, 23, 10, 120, 157, 153, 30, 196, 128, 199, - 92, 219, 249, 136, 203, 133, 202, 244, 52, 6, 184, 239, 11, 32, 222, - 105, 219, 249, 136, 139, 1, 64, 163, 78, 165, 223, 145, 225, 105, 12, - 112, 175, 3, 241, 68, 235, 193, 233, 192, 122, 147, 186, 132, 101, 120, - 26, 3, 220, 235, 64, 127, 165, 245, 200, 204, 21, 3, 136, 189, 50, - 60, 141, 1, 238, 117, 160, 63, 208, 190, 124, 166, 62, 55, 136, 181, - 155, 14, 27, 161, 49, 215, 200, 168, 61, 213, 229, 66, 101, 232, 229, - 177, 54, 200, 97, 35, 52, 230, 26, 25, 181, 77, 186, 92, 168, 92, - 242, 24, 158, 29, 54, 66, 227, 251, 25, 225, 92, 55, 127, 144, 75, - 30, 195, 134, 195, 70, 104, 124, 63, 35, 204, 232, 114, 161, 30, 114, - 243, 192, 119, 192, 15, 30, 155, 97, 134, 203, 133, 2, 94, 191, 251, - 230, 152, 193, 114, 52, 135, 40, 157, 155, 7, 190, 39, 14, 51, 40, - 151, 142, 157, 225, 157, 80, 167, 226, 115, 247, 196, 97, 6, 229, 210, - 57, 0, 160, 73, 93, 82, 238, 138, 195, 140, 223, 253, 92, 243, 192, - 247, 181, 190, 217, 93, 113, 152, 65, 187, 243, 125, 111, 119, 152, 193, - 190, 183, 167, 152, 177, 231, 146, 231, 14, 51, 40, 207, 83, 204, 160, - 61, 121, 121, 238, 48, 131, 99, 13, 79, 49, 19, 154, 75, 158, 59, - 204, 224, 251, 121, 138, 25, 196, 9, 157, 7, 190, 9, 126, 240, 208, - 12, 51, 44, 23, 42, 20, 120, 93, 183, 205, 49, 131, 229, 232, 216, - 249, 63, 110, 30, 248, 182, 56, 204, 160, 92, 58, 118, 6, 26, 117, - 42, 133, 110, 139, 195, 76, 40, 167, 3, 235, 77, 234, 18, 125, 75, - 28, 102, 80, 174, 110, 30, 88, 211, 225, 119, 75, 28, 102, 208, 238, - 249, 197, 12, 63, 103, 100, 185, 157, 127, 204, 240, 242, 208, 158, 249, - 197, 12, 47, 207, 239, 86, 254, 49, 195, 247, 205, 16, 39, 116, 30, - 248, 42, 248, 193, 29, 51, 204, 176, 92, 25, 63, 224, 141, 185, 110, - 142, 25, 44, 71, 99, 192, 13, 110, 30, 248, 122, 254, 48, 195, 143, - 207, 81, 46, 141, 1, 64, 163, 78, 101, 30, 248, 90, 254, 48, 195, - 143, 207, 253, 56, 29, 88, 111, 82, 151, 144, 107, 249, 195, 12, 63, - 62, 71, 185, 186, 121, 96, 77, 135, 235, 106, 254, 48, 67, 198, 231, - 193, 154, 221, 137, 15, 133, 132, 22, 113, 230, 92, 144, 95, 26, 159, - 251, 57, 79, 216, 174, 254, 55, 54, 207, 241, 185, 46, 167, 245, 154, - 62, 87, 198, 59, 180, 206, 203, 99, 93, 144, 23, 213, 169, 113, 158, - 99, 93, 221, 249, 252, 156, 188, 155, 35, 139, 56, 135, 128, 13, 115, - 143, 27, 157, 7, 78, 216, 74, 103, 54, 207, 115, 220, 168, 235, 59, - 94, 213, 231, 202, 216, 54, 204, 120, 121, 12, 6, 239, 247, 100, 86, - 222, 99, 48, 62, 206, 32, 78, 104, 223, 236, 18, 248, 193, 77, 51, - 204, 176, 92, 25, 215, 21, 104, 207, 47, 155, 99, 6, 203, 209, 24, - 112, 133, 203, 149, 57, 239, 41, 102, 220, 231, 127, 212, 157, 220, 155, - 222, 77, 30, 202, 233, 112, 193, 59, 185, 52, 61, 49, 169, 158, 98, - 198, 189, 142, 192, 14, 61, 169, 14, 148, 75, 235, 1, 52, 169, 139, - 235, 180, 167, 152, 113, 175, 99, 221, 26, 150, 43, 19, 122, 57, 215, - 60, 240, 101, 173, 111, 118, 212, 83, 204, 184, 215, 17, 203, 231, 202, - 156, 103, 123, 12, 151, 250, 7, 57, 209, 142, 68, 30, 161, 59, 199, - 205, 177, 179, 231, 228, 76, 232, 134, 150, 182, 240, 35, 237, 174, 171, - 215, 51, 251, 124, 248, 70, 100, 143, 225, 125, 123, 15, 165, 124, 175, - 212, 65, 210, 168, 169, 13, 232, 156, 111, 95, 139, 191, 101, 4, 240, - 205, 228, 120, 31, 149, 95, 42, 49, 172, 198, 210, 249, 51, 239, 103, - 155, 37, 35, 172, 146, 61, 134, 78, 199, 96, 186, 39, 255, 203, 240, - 97, 10, 141, 185, 50, 97, 51, 70, 82, 222, 56, 224, 221, 14, 124, - 59, 57, 222, 231, 5, 246, 73, 31, 72, 147, 233, 222, 223, 119, 142, - 206, 86, 104, 204, 149, 217, 18, 56, 143, 242, 38, 2, 79, 50, 252, - 14, 232, 120, 79, 73, 31, 255, 180, 56, 145, 236, 49, 44, 49, 97, - 89, 34, 217, 99, 120, 252, 207, 21, 148, 247, 48, 240, 28, 183, 212, - 177, 164, 192, 143, 223, 99, 88, 117, 216, 218, 68, 178, 199, 240, 114, - 179, 53, 10, 93, 44, 226, 178, 244, 173, 229, 43, 202, 123, 18, 120, - 78, 195, 47, 149, 227, 125, 18, 121, 77, 250, 126, 242, 162, 68, 178, - 199, 112, 198, 115, 245, 142, 202, 130, 17, 183, 165, 55, 231, 71, 25, - 246, 5, 106, 68, 221, 149, 134, 7, 76, 79, 36, 123, 12, 23, 182, - 90, 160, 208, 99, 34, 210, 165, 152, 179, 95, 80, 222, 11, 240, 206, - 151, 224, 119, 133, 211, 27, 29, 149, 41, 101, 13, 254, 37, 145, 236, - 49, 188, 90, 251, 188, 66, 143, 138, 200, 150, 126, 207, 178, 208, 246, - 234, 154, 165, 182, 229, 134, 165, 150, 229, 150, 165, 38, 229, 221, 235, - 200, 145, 18, 151, 208, 253, 178, 242, 76, 167, 85, 161, 107, 219, 188, - 228, 38, 105, 108, 47, 236, 29, 104, 227, 238, 193, 47, 141, 155, 35, - 75, 119, 122, 203, 151, 127, 171, 146, 68, 246, 24, 30, 252, 182, 148, - 66, 159, 11, 47, 44, 23, 204, 184, 77, 223, 57, 221, 82, 195, 146, - 1, 58, 179, 44, 126, 148, 247, 66, 100, 49, 57, 61, 115, 23, 221, - 251, 219, 214, 246, 181, 118, 183, 103, 41, 185, 217, 176, 37, 148, 55, - 7, 222, 217, 203, 171, 142, 165, 144, 23, 251, 190, 89, 206, 210, 114, - 221, 148, 40, 186, 39, 255, 213, 10, 170, 221, 158, 183, 47, 43, 47, - 94, 56, 198, 116, 79, 62, 155, 3, 246, 165, 52, 238, 49, 228, 231, - 134, 139, 131, 190, 210, 240, 43, 199, 233, 165, 123, 242, 83, 25, 46, - 63, 3, 92, 98, 219, 67, 215, 63, 52, 186, 35, 224, 146, 61, 119, - 143, 203, 51, 128, 203, 18, 247, 139, 211, 28, 182, 176, 58, 93, 149, - 242, 109, 1, 151, 143, 222, 188, 210, 150, 225, 178, 161, 134, 75, 127, - 93, 174, 12, 139, 121, 177, 116, 78, 183, 16, 224, 210, 40, 230, 17, - 92, 254, 147, 89, 141, 230, 176, 157, 223, 238, 163, 157, 217, 149, 32, - 93, 152, 88, 168, 29, 195, 101, 32, 224, 50, 16, 112, 25, 168, 219, - 251, 187, 176, 254, 173, 96, 130, 203, 164, 222, 169, 193, 100, 239, 111, - 214, 172, 223, 131, 25, 46, 3, 1, 151, 1, 128, 203, 0, 150, 75, - 86, 240, 148, 52, 41, 253, 16, 205, 149, 217, 243, 223, 230, 96, 21, - 31, 103, 165, 110, 55, 215, 6, 51, 92, 6, 0, 46, 3, 0, 151, - 140, 55, 27, 112, 121, 123, 237, 176, 96, 130, 203, 6, 173, 135, 42, - 116, 97, 192, 229, 144, 63, 7, 7, 51, 92, 250, 3, 46, 3, 0, - 151, 140, 215, 18, 117, 77, 186, 242, 252, 11, 186, 39, 127, 103, 240, - 214, 96, 178, 247, 119, 221, 140, 131, 134, 125, 234, 39, 145, 119, 165, - 147, 235, 238, 7, 19, 92, 174, 222, 148, 173, 210, 128, 203, 245, 255, - 120, 183, 99, 184, 12, 4, 92, 6, 2, 46, 3, 185, 182, 36, 83, - 122, 45, 248, 81, 48, 193, 165, 163, 210, 35, 77, 47, 224, 50, 61, - 51, 152, 225, 50, 16, 112, 25, 8, 184, 12, 228, 222, 57, 71, 58, - 246, 40, 139, 148, 145, 35, 239, 168, 186, 188, 1, 151, 27, 222, 47, - 214, 142, 225, 50, 16, 112, 25, 8, 184, 12, 212, 229, 202, 172, 186, - 84, 149, 238, 201, 239, 151, 229, 167, 229, 36, 21, 150, 183, 215, 99, - 185, 15, 233, 192, 147, 1, 191, 44, 206, 55, 48, 87, 230, 208, 63, - 129, 52, 135, 109, 171, 83, 245, 37, 47, 91, 41, 185, 86, 11, 107, - 59, 134, 75, 224, 241, 10, 2, 92, 6, 113, 216, 42, 45, 159, 40, - 220, 156, 230, 176, 213, 89, 216, 76, 227, 45, 43, 79, 45, 213, 204, - 52, 135, 141, 173, 75, 248, 82, 26, 113, 201, 175, 87, 20, 7, 125, - 165, 225, 87, 142, 211, 75, 247, 228, 159, 102, 184, 252, 4, 112, 137, - 241, 154, 224, 146, 208, 203, 0, 151, 236, 57, 226, 210, 31, 144, 229, - 15, 184, 100, 216, 234, 219, 251, 153, 253, 69, 171, 186, 52, 87, 166, - 242, 212, 195, 106, 249, 179, 131, 164, 110, 210, 21, 46, 94, 6, 2, - 46, 253, 1, 151, 13, 88, 110, 85, 185, 165, 18, 235, 59, 198, 210, - 117, 134, 247, 0, 151, 70, 125, 71, 228, 237, 93, 112, 155, 180, 100, - 99, 85, 154, 43, 83, 230, 31, 245, 252, 133, 190, 128, 203, 121, 101, - 254, 229, 226, 101, 13, 192, 101, 77, 192, 101, 45, 93, 174, 76, 219, - 23, 203, 105, 188, 244, 122, 212, 73, 161, 111, 61, 61, 42, 69, 94, - 222, 151, 192, 112, 89, 7, 112, 89, 15, 112, 201, 222, 185, 46, 224, - 114, 201, 183, 111, 180, 33, 184, 236, 216, 241, 148, 226, 119, 37, 0, - 151, 175, 93, 173, 222, 142, 225, 210, 95, 195, 37, 243, 181, 173, 128, - 75, 185, 237, 92, 154, 43, 19, 116, 98, 154, 154, 211, 58, 251, 178, - 52, 185, 206, 168, 118, 12, 151, 141, 0, 151, 141, 0, 151, 236, 187, - 29, 135, 120, 89, 229, 206, 247, 20, 151, 101, 47, 87, 81, 231, 64, - 195, 111, 75, 51, 55, 71, 24, 238, 223, 40, 2, 241, 242, 210, 249, - 102, 52, 94, 62, 190, 175, 174, 171, 148, 138, 76, 151, 106, 173, 252, - 57, 129, 225, 178, 30, 224, 178, 62, 224, 146, 213, 247, 52, 196, 203, - 26, 35, 75, 210, 92, 153, 97, 99, 212, 92, 153, 111, 195, 179, 165, - 154, 219, 92, 237, 244, 184, 108, 12, 184, 180, 82, 222, 25, 17, 57, - 210, 153, 45, 52, 39, 70, 174, 217, 183, 181, 66, 31, 4, 92, 102, - 62, 108, 215, 158, 225, 178, 37, 224, 178, 37, 224, 178, 21, 229, 109, - 150, 236, 45, 23, 155, 80, 156, 230, 150, 134, 222, 254, 167, 157, 218, - 183, 40, 44, 7, 28, 123, 157, 195, 101, 51, 192, 165, 85, 135, 203, - 121, 128, 203, 94, 242, 185, 4, 130, 203, 160, 173, 235, 149, 250, 238, - 128, 120, 121, 102, 94, 42, 23, 47, 235, 107, 241, 146, 197, 248, 79, - 1, 151, 233, 29, 74, 208, 92, 153, 7, 73, 170, 143, 37, 64, 188, - 44, 221, 52, 192, 120, 45, 11, 112, 201, 214, 202, 124, 41, 141, 185, - 50, 252, 26, 90, 113, 175, 234, 128, 203, 234, 128, 203, 234, 47, 231, - 150, 30, 213, 231, 202, 196, 114, 185, 50, 177, 92, 174, 76, 44, 151, - 43, 163, 198, 203, 9, 128, 203, 9, 186, 92, 25, 236, 63, 19, 92, - 254, 194, 229, 202, 36, 149, 99, 188, 125, 129, 103, 4, 252, 102, 90, - 194, 116, 185, 50, 108, 12, 22, 75, 215, 190, 48, 94, 26, 141, 193, - 72, 188, 188, 247, 53, 203, 149, 121, 222, 49, 220, 70, 226, 101, 233, - 59, 44, 31, 34, 14, 244, 109, 135, 223, 78, 78, 47, 198, 203, 173, - 71, 89, 174, 204, 232, 234, 179, 105, 174, 76, 195, 49, 236, 157, 19, - 129, 39, 25, 126, 7, 56, 94, 204, 149, 201, 28, 200, 114, 101, 62, - 106, 58, 155, 230, 202, 52, 173, 202, 120, 15, 3, 207, 113, 248, 165, - 112, 188, 216, 143, 237, 177, 147, 229, 202, 188, 157, 204, 114, 101, 134, - 29, 102, 243, 52, 39, 129, 231, 52, 252, 82, 117, 188, 215, 164, 215, - 187, 205, 166, 185, 50, 227, 7, 207, 166, 185, 50, 43, 167, 207, 54, - 205, 149, 185, 251, 238, 108, 154, 43, 243, 79, 128, 74, 23, 134, 120, - 121, 224, 9, 211, 123, 1, 244, 93, 130, 223, 21, 78, 111, 57, 192, - 229, 39, 37, 103, 211, 92, 153, 105, 90, 174, 73, 13, 136, 151, 61, - 63, 100, 103, 184, 92, 3, 158, 27, 240, 187, 197, 241, 158, 142, 204, - 145, 166, 87, 154, 70, 115, 101, 182, 30, 156, 170, 174, 85, 2, 46, - 175, 79, 158, 106, 99, 184, 28, 7, 184, 28, 7, 184, 28, 199, 245, - 39, 189, 229, 123, 103, 89, 174, 204, 131, 127, 85, 127, 120, 12, 253, - 216, 203, 215, 217, 247, 77, 7, 159, 200, 128, 95, 22, 167, 247, 25, - 224, 114, 242, 167, 44, 87, 230, 104, 51, 109, 157, 19, 226, 229, 84, - 46, 39, 41, 7, 121, 188, 194, 0, 151, 97, 186, 92, 153, 57, 167, - 89, 174, 204, 199, 111, 178, 92, 153, 5, 127, 153, 231, 202, 176, 245, - 91, 95, 74, 99, 188, 228, 215, 117, 139, 123, 141, 7, 92, 142, 7, - 92, 142, 127, 121, 15, 243, 37, 46, 87, 230, 36, 140, 147, 175, 154, - 205, 41, 112, 185, 50, 192, 27, 122, 218, 131, 185, 235, 75, 220, 120, - 223, 197, 237, 45, 59, 37, 112, 238, 218, 197, 141, 247, 129, 70, 157, - 138, 180, 83, 2, 231, 174, 121, 29, 80, 111, 82, 23, 159, 83, 226, - 230, 174, 81, 174, 110, 238, 90, 211, 17, 115, 82, 220, 220, 53, 218, - 93, 228, 122, 143, 227, 148, 216, 245, 30, 159, 83, 98, 215, 123, 208, - 118, 34, 215, 123, 16, 39, 116, 189, 231, 16, 248, 193, 37, 51, 204, - 112, 185, 50, 127, 66, 249, 195, 230, 152, 193, 114, 20, 51, 71, 184, - 245, 158, 195, 2, 49, 115, 132, 243, 103, 160, 81, 167, 26, 76, 4, - 98, 134, 211, 129, 245, 38, 117, 137, 254, 67, 224, 122, 207, 225, 92, - 152, 209, 116, 248, 253, 33, 112, 189, 231, 176, 224, 245, 158, 195, 130, - 215, 123, 254, 16, 188, 222, 243, 135, 224, 245, 158, 67, 220, 122, 207, - 254, 12, 111, 191, 147, 102, 152, 97, 185, 50, 126, 192, 27, 115, 208, - 131, 245, 158, 67, 220, 58, 201, 239, 220, 122, 207, 65, 113, 152, 65, - 185, 116, 189, 7, 104, 212, 169, 174, 11, 136, 195, 140, 31, 167, 3, - 235, 77, 234, 18, 114, 64, 28, 102, 80, 174, 110, 189, 71, 211, 225, - 218, 47, 14, 51, 104, 119, 145, 113, 6, 109, 44, 50, 206, 132, 28, - 16, 27, 103, 208, 118, 34, 227, 12, 226, 132, 198, 153, 61, 224, 7, - 135, 76, 48, 195, 229, 202, 184, 246, 65, 31, 104, 175, 7, 235, 61, - 251, 184, 24, 176, 143, 235, 155, 37, 139, 195, 76, 40, 167, 195, 5, - 239, 228, 210, 244, 56, 146, 197, 97, 6, 229, 210, 122, 0, 77, 234, - 226, 147, 44, 176, 111, 182, 55, 215, 122, 207, 94, 173, 111, 230, 20, - 216, 55, 75, 22, 27, 103, 28, 201, 98, 227, 140, 79, 178, 216, 56, - 131, 182, 19, 26, 103, 246, 112, 113, 102, 55, 248, 193, 126, 51, 204, - 176, 61, 159, 126, 136, 177, 68, 15, 226, 204, 30, 174, 125, 78, 226, - 226, 76, 162, 192, 56, 147, 196, 197, 25, 160, 81, 167, 18, 103, 18, - 4, 198, 25, 78, 7, 214, 155, 212, 37, 36, 65, 96, 156, 73, 204, - 21, 103, 52, 29, 174, 221, 2, 227, 76, 162, 224, 56, 147, 32, 56, - 206, 36, 8, 142, 51, 187, 5, 199, 153, 221, 28, 102, 182, 131, 31, - 236, 113, 135, 153, 145, 227, 63, 26, 52, 77, 217, 35, 109, 225, 219, - 192, 93, 128, 177, 223, 60, 200, 47, 219, 197, 181, 207, 187, 152, 124, - 251, 206, 252, 221, 27, 84, 179, 91, 249, 166, 180, 125, 230, 116, 184, - 224, 157, 92, 154, 30, 191, 95, 243, 119, 111, 144, 37, 118, 94, 60, - 173, 199, 111, 92, 61, 128, 166, 117, 249, 37, 127, 247, 6, 253, 52, - 124, 49, 59, 183, 246, 183, 92, 113, 230, 55, 13, 51, 219, 243, 119, - 111, 208, 225, 38, 83, 104, 174, 12, 218, 93, 151, 35, 1, 118, 164, - 123, 93, 52, 250, 163, 150, 11, 36, 246, 220, 125, 187, 235, 106, 80, - 85, 46, 111, 209, 46, 211, 195, 28, 9, 173, 124, 225, 172, 55, 229, - 90, 239, 148, 50, 228, 205, 46, 50, 88, 182, 219, 30, 169, 23, 65, - 90, 198, 200, 13, 106, 252, 165, 208, 197, 50, 102, 200, 145, 119, 190, - 183, 26, 241, 62, 157, 247, 177, 60, 123, 152, 151, 149, 228, 7, 16, - 218, 255, 220, 10, 238, 185, 113, 142, 4, 250, 5, 111, 3, 252, 206, - 212, 166, 26, 141, 54, 96, 207, 243, 182, 65, 153, 175, 99, 226, 137, - 13, 72, 121, 180, 193, 225, 14, 142, 120, 51, 27, 244, 248, 104, 96, - 60, 177, 193, 142, 174, 114, 60, 177, 65, 159, 165, 21, 227, 205, 108, - 208, 227, 204, 135, 63, 19, 27, 16, 26, 109, 192, 158, 27, 219, 0, - 253, 150, 183, 1, 250, 33, 177, 1, 161, 187, 128, 13, 216, 115, 247, - 242, 194, 192, 6, 103, 127, 141, 165, 185, 50, 164, 252, 43, 96, 131, - 179, 9, 31, 27, 242, 22, 47, 58, 88, 238, 251, 219, 135, 73, 196, - 6, 253, 170, 116, 87, 104, 63, 176, 193, 222, 134, 53, 12, 121, 159, - 131, 13, 42, 253, 52, 133, 230, 76, 17, 26, 109, 192, 158, 27, 219, - 0, 113, 197, 219, 0, 113, 66, 108, 64, 232, 241, 96, 3, 246, 220, - 189, 188, 179, 96, 131, 162, 145, 31, 209, 92, 25, 82, 190, 40, 216, - 160, 255, 29, 99, 222, 39, 224, 7, 227, 35, 72, 158, 205, 24, 185, - 196, 5, 117, 46, 26, 253, 32, 243, 246, 44, 155, 153, 31, 20, 91, - 48, 155, 230, 202, 16, 26, 109, 192, 158, 27, 247, 155, 176, 221, 167, - 119, 183, 174, 133, 118, 109, 183, 81, 12, 208, 223, 93, 232, 218, 6, - 229, 227, 61, 136, 1, 219, 184, 182, 115, 27, 55, 214, 248, 57, 127, - 57, 198, 136, 119, 218, 118, 114, 58, 92, 240, 78, 46, 77, 79, 220, - 55, 249, 203, 49, 70, 60, 209, 122, 196, 115, 245, 0, 154, 212, 197, - 254, 77, 254, 114, 140, 209, 95, 105, 61, 226, 115, 197, 128, 120, 45, - 183, 96, 109, 254, 114, 140, 209, 31, 232, 88, 227, 103, 125, 238, 8, - 107, 55, 29, 54, 66, 207, 107, 159, 96, 55, 106, 79, 117, 57, 193, - 223, 232, 229, 177, 54, 200, 97, 35, 52, 202, 51, 106, 155, 116, 121, - 4, 185, 228, 49, 60, 59, 108, 132, 158, 11, 242, 140, 112, 174, 203, - 35, 88, 171, 151, 199, 176, 225, 176, 17, 26, 223, 207, 8, 51, 186, - 251, 102, 215, 114, 247, 45, 126, 5, 126, 176, 221, 8, 51, 205, 117, - 152, 73, 249, 58, 195, 59, 100, 141, 57, 102, 176, 28, 189, 111, 246, - 107, 38, 223, 181, 90, 28, 102, 66, 56, 29, 41, 240, 78, 41, 154, - 158, 176, 213, 226, 48, 131, 114, 105, 61, 128, 166, 117, 89, 45, 14, - 51, 33, 107, 244, 152, 65, 157, 202, 92, 243, 87, 226, 48, 131, 118, - 39, 62, 20, 99, 111, 226, 22, 51, 209, 241, 91, 60, 198, 76, 88, - 46, 121, 238, 48, 131, 242, 60, 197, 140, 133, 147, 23, 10, 242, 220, - 97, 6, 229, 121, 138, 25, 180, 29, 255, 126, 238, 48, 131, 242, 60, - 197, 12, 226, 132, 96, 38, 229, 11, 240, 131, 181, 70, 152, 105, 161, - 195, 76, 244, 42, 224, 253, 210, 28, 51, 88, 142, 248, 129, 207, 42, - 46, 47, 127, 165, 56, 204, 248, 112, 58, 162, 225, 157, 162, 53, 61, - 214, 149, 226, 48, 131, 114, 105, 61, 128, 38, 117, 113, 174, 16, 135, - 25, 159, 47, 245, 152, 65, 157, 202, 28, 192, 10, 113, 152, 65, 187, - 231, 23, 51, 252, 156, 145, 117, 101, 254, 49, 195, 203, 67, 123, 230, - 23, 51, 188, 188, 144, 21, 249, 199, 12, 223, 55, 67, 156, 16, 204, - 68, 127, 6, 244, 87, 70, 152, 105, 169, 195, 76, 8, 240, 166, 44, - 51, 199, 12, 150, 163, 49, 96, 57, 183, 239, 127, 89, 254, 48, 195, - 143, 207, 81, 46, 141, 1, 64, 163, 78, 165, 255, 247, 121, 254, 48, - 195, 143, 207, 67, 56, 29, 88, 111, 82, 23, 199, 231, 249, 195, 12, - 63, 62, 71, 185, 186, 187, 211, 53, 29, 62, 159, 231, 15, 51, 100, - 124, 30, 172, 217, 157, 191, 27, 58, 232, 113, 177, 151, 198, 231, 97, - 97, 19, 237, 157, 227, 170, 53, 245, 164, 29, 71, 27, 243, 242, 190, - 29, 243, 238, 75, 99, 93, 148, 247, 107, 139, 213, 241, 30, 173, 249, - 115, 242, 222, 24, 81, 196, 217, 109, 251, 232, 151, 198, 141, 149, 199, - 79, 180, 251, 253, 28, 227, 209, 189, 50, 62, 156, 188, 56, 120, 191, - 218, 221, 167, 189, 52, 6, 155, 6, 239, 55, 179, 203, 36, 143, 226, - 140, 130, 19, 50, 127, 186, 17, 252, 224, 11, 35, 204, 180, 210, 97, - 38, 230, 167, 12, 111, 191, 173, 30, 156, 103, 249, 19, 55, 71, 251, - 19, 147, 239, 216, 236, 41, 102, 10, 187, 247, 103, 126, 174, 153, 211, - 17, 3, 239, 20, 163, 233, 113, 109, 242, 20, 51, 230, 58, 80, 46, - 173, 7, 208, 164, 46, 246, 31, 60, 197, 140, 7, 245, 216, 154, 43, - 143, 121, 171, 182, 118, 178, 209, 83, 204, 228, 165, 195, 161, 96, 102, - 164, 151, 106, 247, 122, 74, 73, 117, 143, 97, 46, 121, 22, 178, 199, - 80, 199, 93, 178, 190, 165, 153, 69, 253, 145, 118, 215, 217, 235, 153, - 189, 208, 159, 73, 141, 201, 30, 195, 41, 213, 212, 184, 228, 151, 58, - 72, 58, 242, 222, 135, 134, 49, 42, 173, 252, 82, 41, 32, 131, 96, - 53, 150, 206, 159, 149, 30, 151, 36, 61, 141, 175, 102, 56, 31, 150, - 254, 217, 63, 146, 227, 83, 167, 149, 236, 155, 203, 185, 125, 74, 161, - 11, 205, 120, 44, 205, 26, 120, 214, 80, 239, 115, 217, 34, 255, 85, - 171, 72, 83, 178, 127, 237, 102, 195, 210, 77, 213, 61, 134, 69, 229, - 77, 243, 43, 25, 234, 205, 41, 80, 70, 102, 243, 124, 190, 148, 14, - 187, 81, 69, 54, 155, 255, 35, 182, 71, 127, 20, 101, 251, 223, 19, - 223, 137, 35, 182, 63, 212, 83, 141, 225, 104, 251, 50, 143, 143, 255, - 108, 102, 251, 9, 211, 73, 187, 22, 75, 231, 237, 208, 246, 15, 27, - 175, 142, 55, 179, 125, 212, 234, 228, 120, 98, 251, 1, 125, 23, 197, - 19, 219, 47, 159, 242, 81, 188, 153, 237, 235, 22, 255, 229, 103, 98, - 251, 128, 38, 235, 127, 38, 182, 191, 176, 99, 254, 207, 102, 182, 103, - 243, 139, 190, 148, 70, 219, 155, 205, 59, 18, 219, 35, 78, 137, 237, - 83, 243, 176, 253, 103, 30, 216, 222, 187, 207, 51, 251, 221, 224, 15, - 104, 46, 74, 82, 45, 181, 191, 243, 243, 63, 131, 164, 55, 6, 158, - 53, 236, 251, 84, 2, 219, 151, 218, 53, 154, 238, 121, 39, 49, 224, - 202, 216, 36, 233, 147, 173, 49, 134, 115, 120, 49, 203, 254, 145, 46, - 94, 221, 150, 68, 108, 127, 240, 96, 180, 66, 247, 154, 249, 88, 106, - 84, 102, 158, 33, 111, 115, 176, 253, 103, 71, 253, 105, 254, 209, 16, - 91, 29, 133, 14, 7, 219, 7, 204, 173, 106, 200, 123, 31, 108, 207, - 230, 53, 125, 41, 221, 21, 108, 111, 54, 223, 73, 108, 143, 237, 151, - 222, 239, 29, 54, 102, 123, 149, 238, 160, 216, 222, 97, 211, 219, 254, - 154, 206, 246, 199, 193, 239, 215, 45, 99, 251, 154, 63, 215, 250, 134, - 77, 192, 239, 47, 255, 103, 124, 222, 250, 109, 176, 125, 66, 183, 105, - 116, 95, 51, 137, 151, 101, 192, 239, 255, 54, 136, 151, 200, 91, 244, - 243, 127, 164, 140, 152, 9, 116, 175, 238, 176, 79, 39, 43, 116, 69, - 240, 251, 54, 231, 77, 206, 151, 7, 219, 63, 34, 251, 85, 193, 246, - 127, 253, 166, 210, 197, 192, 246, 22, 155, 241, 59, 63, 3, 219, 179, - 249, 84, 95, 74, 143, 3, 219, 155, 205, 179, 210, 125, 120, 27, 185, - 57, 203, 111, 97, 12, 246, 153, 81, 140, 111, 173, 143, 241, 27, 32, - 206, 125, 239, 65, 140, 223, 192, 197, 198, 13, 76, 190, 223, 103, 226, - 198, 146, 126, 156, 142, 24, 120, 167, 24, 77, 79, 220, 119, 226, 198, - 146, 40, 151, 214, 3, 104, 82, 23, 251, 119, 226, 198, 146, 126, 223, - 231, 138, 241, 223, 107, 115, 150, 223, 138, 27, 75, 162, 221, 69, 206, - 191, 160, 141, 69, 206, 191, 216, 191, 19, 59, 255, 130, 182, 19, 57, - 255, 130, 56, 161, 231, 34, 46, 1, 63, 216, 104, 132, 153, 215, 244, - 115, 150, 235, 97, 204, 182, 206, 131, 57, 203, 245, 220, 56, 111, 61, - 55, 103, 25, 35, 112, 206, 146, 211, 145, 2, 239, 148, 162, 233, 9, - 139, 17, 56, 103, 185, 142, 171, 7, 208, 164, 46, 113, 75, 5, 206, - 89, 174, 203, 53, 103, 185, 78, 195, 229, 82, 129, 115, 150, 49, 98, - 231, 95, 194, 98, 196, 206, 191, 160, 61, 69, 206, 191, 216, 151, 138, - 157, 127, 65, 156, 208, 115, 228, 22, 130, 31, 124, 107, 128, 153, 166, - 86, 29, 102, 236, 192, 235, 92, 108, 142, 25, 44, 71, 207, 95, 251, - 148, 59, 71, 110, 113, 254, 48, 115, 234, 226, 56, 138, 25, 148, 75, - 207, 145, 3, 26, 117, 42, 184, 92, 148, 63, 204, 248, 237, 77, 165, - 152, 177, 115, 58, 176, 222, 164, 46, 97, 139, 242, 135, 153, 161, 241, - 87, 216, 121, 120, 139, 115, 157, 35, 71, 236, 181, 40, 127, 152, 249, - 121, 20, 119, 142, 220, 98, 230, 67, 185, 229, 161, 77, 115, 247, 175, - 77, 247, 236, 44, 202, 91, 30, 218, 239, 127, 42, 47, 204, 64, 30, - 218, 234, 127, 42, 207, 98, 32, 15, 237, 226, 169, 60, 122, 142, 220, - 66, 134, 25, 251, 199, 224, 7, 75, 140, 48, 163, 223, 83, 100, 1, - 94, 199, 39, 230, 152, 193, 114, 244, 28, 185, 5, 76, 190, 207, 39, - 226, 226, 12, 202, 165, 190, 134, 58, 22, 106, 243, 22, 243, 197, 197, - 25, 11, 167, 3, 235, 77, 234, 98, 157, 47, 46, 206, 160, 92, 30, - 51, 22, 77, 135, 243, 99, 113, 113, 6, 237, 46, 50, 206, 160, 141, - 69, 198, 25, 235, 124, 177, 113, 6, 109, 39, 50, 206, 32, 78, 8, - 102, 44, 81, 224, 7, 11, 141, 48, 163, 223, 131, 225, 156, 7, 237, - 249, 92, 115, 204, 96, 57, 26, 3, 230, 49, 249, 41, 115, 196, 97, - 198, 206, 233, 112, 194, 59, 57, 53, 61, 161, 115, 196, 97, 6, 229, - 210, 122, 0, 77, 234, 146, 22, 37, 14, 51, 246, 185, 122, 204, 160, - 78, 69, 90, 148, 56, 204, 160, 221, 69, 142, 103, 66, 231, 136, 29, - 207, 160, 61, 69, 142, 103, 28, 81, 98, 199, 51, 136, 19, 58, 207, - 255, 97, 166, 183, 253, 99, 119, 152, 25, 53, 120, 212, 32, 188, 26, - 97, 146, 238, 140, 95, 71, 36, 140, 127, 198, 103, 190, 244, 45, 115, - 99, 6, 203, 17, 63, 136, 179, 112, 229, 199, 101, 122, 91, 76, 254, - 140, 246, 174, 182, 238, 48, 141, 222, 91, 128, 114, 233, 28, 0, 188, - 19, 234, 84, 250, 102, 99, 60, 209, 145, 247, 222, 213, 237, 91, 199, - 178, 59, 75, 198, 51, 29, 88, 111, 82, 23, 231, 104, 79, 116, 228, - 189, 119, 117, 218, 233, 222, 108, 14, 128, 211, 97, 209, 116, 42, 255, - 126, 232, 137, 142, 188, 247, 174, 158, 110, 62, 155, 238, 93, 69, 187, - 243, 251, 245, 208, 142, 196, 135, 8, 141, 103, 91, 179, 231, 238, 219, - 93, 60, 219, 186, 94, 121, 114, 46, 70, 119, 153, 148, 199, 179, 173, - 183, 180, 124, 203, 144, 247, 113, 137, 177, 242, 215, 191, 221, 214, 238, - 114, 157, 37, 175, 158, 234, 183, 75, 157, 243, 141, 146, 171, 85, 155, - 210, 214, 120, 206, 119, 129, 188, 187, 223, 112, 122, 198, 57, 161, 241, - 108, 107, 246, 220, 100, 207, 226, 24, 189, 13, 240, 59, 19, 27, 16, - 26, 109, 192, 158, 187, 151, 151, 10, 54, 200, 241, 157, 74, 207, 121, - 39, 229, 139, 129, 13, 154, 141, 29, 109, 122, 206, 123, 244, 180, 161, - 244, 156, 247, 13, 97, 31, 180, 35, 54, 8, 29, 253, 78, 59, 51, - 27, 164, 150, 238, 211, 142, 216, 128, 208, 104, 3, 246, 220, 216, 6, - 232, 183, 188, 13, 208, 15, 137, 13, 8, 141, 54, 96, 207, 243, 182, - 193, 199, 139, 122, 209, 243, 254, 73, 121, 180, 193, 185, 208, 62, 166, - 231, 253, 255, 214, 189, 63, 61, 231, 189, 64, 207, 62, 244, 188, 255, - 133, 79, 122, 154, 158, 243, 30, 90, 211, 78, 247, 174, 18, 26, 109, - 192, 158, 27, 219, 0, 113, 197, 219, 0, 113, 66, 108, 64, 104, 180, - 1, 123, 158, 183, 13, 170, 52, 152, 77, 247, 174, 146, 242, 104, 131, - 203, 173, 102, 155, 158, 243, 94, 214, 62, 155, 158, 243, 254, 203, 27, - 179, 233, 57, 239, 211, 123, 206, 54, 61, 231, 189, 196, 187, 108, 239, - 42, 161, 209, 6, 236, 185, 201, 60, 48, 216, 128, 158, 139, 56, 12, - 218, 153, 40, 179, 24, 192, 206, 172, 142, 25, 149, 233, 237, 55, 210, - 60, 6, 96, 57, 218, 118, 142, 98, 229, 227, 70, 120, 26, 3, 220, - 247, 5, 16, 239, 180, 237, 228, 116, 196, 192, 59, 197, 104, 122, 236, - 35, 60, 141, 1, 238, 117, 32, 158, 104, 61, 70, 114, 245, 0, 154, - 212, 37, 101, 184, 167, 49, 192, 189, 14, 244, 87, 90, 143, 145, 185, - 98, 128, 102, 223, 208, 225, 158, 198, 0, 247, 58, 208, 31, 232, 156, - 209, 136, 76, 221, 94, 78, 214, 110, 58, 108, 132, 198, 115, 207, 141, - 218, 83, 221, 188, 109, 46, 121, 172, 13, 114, 216, 8, 141, 242, 140, - 218, 38, 221, 188, 237, 112, 189, 60, 134, 103, 135, 141, 208, 40, 207, - 8, 231, 186, 126, 93, 46, 121, 12, 27, 14, 27, 161, 81, 158, 17, - 102, 116, 103, 86, 15, 99, 152, 137, 25, 4, 126, 192, 197, 103, 247, - 152, 225, 206, 172, 6, 94, 215, 16, 115, 204, 96, 57, 186, 23, 123, - 40, 43, 31, 54, 68, 28, 102, 80, 46, 221, 139, 13, 52, 234, 84, - 10, 13, 17, 135, 153, 80, 78, 7, 214, 155, 212, 37, 122, 176, 56, - 204, 160, 92, 221, 25, 6, 154, 14, 191, 193, 226, 48, 131, 118, 231, - 243, 198, 220, 97, 6, 243, 198, 60, 197, 140, 37, 151, 60, 119, 152, - 65, 121, 158, 98, 6, 237, 201, 203, 115, 135, 25, 148, 231, 41, 102, - 252, 114, 201, 115, 135, 25, 148, 231, 41, 102, 16, 39, 116, 189, 49, - 28, 252, 96, 152, 25, 102, 184, 51, 171, 17, 99, 179, 205, 49, 131, - 229, 104, 12, 8, 101, 229, 173, 161, 226, 48, 131, 114, 169, 14, 120, - 39, 212, 169, 196, 178, 8, 129, 113, 102, 54, 23, 103, 128, 38, 117, - 177, 71, 8, 140, 51, 179, 115, 197, 25, 205, 190, 41, 225, 226, 48, - 131, 118, 207, 47, 102, 116, 107, 29, 17, 249, 199, 140, 110, 173, 35, - 34, 255, 152, 225, 229, 161, 237, 242, 139, 25, 190, 111, 134, 56, 161, - 57, 18, 211, 193, 15, 6, 153, 97, 134, 157, 89, 157, 50, 43, 211, - 59, 100, 166, 57, 102, 176, 28, 93, 167, 155, 197, 202, 187, 102, 228, - 15, 51, 252, 248, 60, 132, 211, 145, 2, 239, 148, 162, 233, 9, 155, - 145, 63, 204, 240, 227, 115, 148, 75, 235, 1, 52, 173, 203, 140, 252, - 97, 134, 31, 159, 135, 204, 212, 99, 38, 69, 179, 111, 244, 244, 252, - 97, 134, 140, 207, 131, 53, 187, 19, 31, 114, 189, 91, 196, 249, 113, - 133, 243, 193, 185, 199, 231, 209, 71, 78, 216, 206, 22, 76, 246, 232, - 174, 193, 48, 78, 222, 161, 247, 139, 56, 39, 166, 110, 9, 206, 61, - 214, 117, 130, 188, 166, 119, 231, 121, 118, 231, 46, 39, 239, 13, 144, - 183, 123, 111, 159, 132, 220, 227, 198, 80, 144, 119, 183, 243, 4, 207, - 114, 36, 166, 51, 121, 150, 129, 69, 156, 127, 111, 140, 122, 105, 12, - 22, 119, 244, 132, 237, 92, 118, 184, 103, 57, 18, 211, 25, 102, 82, - 154, 131, 31, 132, 155, 97, 166, 21, 219, 191, 63, 13, 120, 167, 154, - 99, 6, 203, 209, 220, 130, 105, 172, 188, 223, 68, 79, 49, 227, 227, - 222, 159, 75, 183, 221, 77, 115, 11, 56, 29, 209, 240, 78, 209, 154, - 30, 107, 176, 167, 152, 113, 175, 99, 218, 241, 177, 109, 104, 61, 166, - 114, 245, 0, 154, 212, 197, 222, 218, 83, 204, 184, 215, 177, 166, 252, - 25, 122, 150, 188, 207, 84, 61, 102, 162, 53, 251, 134, 180, 240, 20, - 51, 238, 117, 124, 243, 66, 197, 140, 179, 128, 106, 247, 122, 74, 73, - 117, 31, 25, 218, 145, 250, 184, 70, 227, 254, 73, 246, 220, 125, 187, - 139, 251, 39, 251, 37, 52, 218, 77, 246, 145, 125, 147, 220, 85, 161, - 131, 82, 7, 73, 15, 14, 142, 48, 228, 245, 241, 93, 42, 157, 10, - 250, 178, 45, 217, 71, 70, 176, 90, 241, 217, 102, 105, 245, 103, 107, - 12, 231, 195, 202, 23, 220, 38, 245, 61, 119, 71, 43, 179, 83, 138, - 125, 165, 182, 130, 157, 170, 207, 18, 164, 230, 39, 122, 24, 198, 158, - 199, 5, 246, 73, 63, 237, 88, 76, 207, 173, 45, 211, 105, 131, 66, - 63, 13, 63, 44, 69, 151, 220, 102, 200, 155, 25, 121, 76, 114, 30, - 76, 214, 202, 164, 72, 63, 120, 29, 209, 120, 79, 74, 253, 131, 79, - 27, 242, 62, 143, 60, 35, 21, 105, 126, 142, 158, 17, 63, 49, 240, - 178, 122, 71, 95, 196, 89, 233, 108, 157, 91, 198, 239, 28, 121, 65, - 122, 107, 98, 6, 61, 35, 126, 219, 219, 143, 180, 243, 229, 47, 75, - 37, 236, 89, 198, 243, 62, 145, 215, 164, 240, 185, 247, 233, 25, 241, - 69, 134, 164, 41, 116, 199, 136, 219, 82, 172, 244, 192, 144, 183, 223, - 156, 187, 82, 224, 205, 235, 244, 204, 219, 218, 209, 69, 149, 125, 138, - 127, 58, 210, 165, 247, 79, 188, 98, 184, 103, 241, 189, 168, 76, 41, - 116, 127, 127, 173, 76, 150, 116, 244, 122, 132, 66, 219, 194, 179, 165, - 249, 94, 203, 12, 121, 227, 34, 114, 164, 236, 10, 241, 244, 140, 248, - 242, 245, 118, 40, 244, 215, 54, 47, 57, 166, 233, 78, 67, 222, 198, - 201, 222, 242, 170, 175, 99, 232, 30, 77, 223, 178, 170, 174, 202, 17, - 133, 229, 55, 174, 143, 55, 228, 221, 22, 89, 76, 238, 191, 180, 161, - 86, 166, 164, 124, 225, 7, 245, 187, 252, 209, 190, 148, 188, 229, 249, - 14, 67, 91, 173, 112, 150, 150, 75, 180, 28, 79, 207, 136, 63, 215, - 163, 137, 66, 239, 110, 95, 86, 14, 40, 127, 209, 208, 159, 241, 204, - 91, 54, 127, 236, 75, 105, 60, 243, 214, 108, 94, 153, 96, 26, 219, - 57, 130, 105, 188, 187, 1, 219, 45, 26, 103, 52, 26, 239, 110, 96, - 207, 221, 203, 251, 23, 48, 157, 250, 93, 17, 186, 47, 119, 210, 218, - 113, 74, 249, 158, 128, 233, 15, 166, 215, 51, 236, 119, 102, 149, 95, - 42, 249, 238, 111, 74, 207, 136, 39, 241, 18, 239, 110, 24, 183, 105, - 186, 241, 121, 220, 5, 182, 73, 213, 215, 134, 211, 51, 226, 51, 143, - 168, 103, 60, 23, 6, 76, 95, 58, 180, 208, 144, 247, 25, 96, 122, - 254, 196, 21, 237, 8, 166, 255, 170, 181, 86, 61, 7, 60, 226, 176, - 148, 147, 181, 174, 157, 49, 46, 143, 73, 71, 131, 55, 180, 35, 152, - 62, 19, 242, 131, 198, 123, 82, 186, 48, 116, 179, 241, 59, 3, 166, - 119, 63, 220, 218, 142, 96, 250, 131, 121, 241, 234, 156, 52, 96, 186, - 96, 165, 95, 12, 121, 45, 81, 23, 164, 111, 198, 236, 166, 231, 88, - 63, 206, 114, 170, 231, 233, 3, 166, 223, 157, 119, 208, 144, 183, 64, - 212, 53, 105, 137, 245, 120, 59, 130, 233, 117, 209, 127, 41, 180, 15, - 96, 250, 113, 218, 191, 134, 188, 205, 162, 238, 74, 143, 222, 188, 209, - 142, 96, 122, 231, 195, 108, 133, 238, 31, 145, 46, 253, 211, 181, 72, - 123, 35, 222, 14, 128, 233, 228, 130, 85, 219, 19, 76, 223, 172, 22, - 216, 94, 197, 86, 182, 228, 104, 25, 108, 200, 219, 52, 50, 71, 106, - 191, 234, 3, 122, 142, 245, 227, 153, 3, 21, 186, 55, 98, 250, 131, - 80, 67, 222, 7, 78, 111, 185, 113, 41, 59, 61, 199, 122, 149, 203, - 170, 208, 127, 132, 23, 150, 39, 46, 42, 103, 200, 123, 6, 48, 189, - 251, 226, 45, 122, 190, 188, 207, 171, 170, 157, 31, 0, 166, 43, 12, - 251, 177, 157, 177, 222, 210, 242, 149, 239, 86, 208, 243, 229, 223, 148, - 23, 41, 116, 22, 96, 186, 77, 242, 108, 99, 191, 2, 76, 179, 245, - 16, 95, 74, 95, 0, 76, 155, 173, 147, 16, 76, 99, 191, 130, 96, - 26, 239, 125, 192, 126, 2, 193, 52, 161, 241, 222, 7, 246, 220, 189, - 188, 211, 128, 233, 107, 79, 147, 219, 18, 76, 119, 45, 122, 85, 41, - 223, 30, 48, 253, 161, 165, 170, 97, 251, 242, 0, 48, 253, 211, 23, - 101, 232, 125, 44, 164, 207, 90, 16, 48, 29, 236, 59, 208, 176, 77, - 44, 0, 113, 186, 207, 175, 163, 232, 125, 44, 199, 146, 35, 212, 187, - 141, 1, 211, 29, 174, 47, 72, 52, 195, 116, 229, 217, 107, 105, 156, - 118, 90, 54, 171, 52, 96, 122, 73, 114, 188, 49, 47, 96, 218, 235, - 195, 93, 52, 78, 255, 60, 110, 143, 198, 123, 82, 122, 123, 226, 126, - 211, 56, 61, 213, 113, 136, 198, 233, 109, 27, 143, 210, 56, 125, 255, - 120, 138, 137, 222, 11, 82, 157, 15, 254, 166, 113, 250, 221, 5, 255, - 104, 188, 151, 165, 232, 237, 231, 18, 141, 219, 131, 107, 210, 188, 123, - 169, 52, 78, 127, 87, 92, 189, 83, 165, 1, 96, 58, 163, 254, 69, - 67, 222, 56, 192, 244, 152, 27, 231, 104, 156, 238, 80, 250, 169, 66, - 79, 159, 157, 46, 85, 108, 88, 202, 48, 230, 165, 0, 166, 223, 250, - 178, 57, 141, 211, 221, 218, 246, 85, 232, 154, 128, 233, 202, 183, 63, - 50, 228, 29, 48, 59, 71, 154, 57, 114, 37, 141, 211, 219, 63, 89, - 165, 208, 223, 3, 166, 247, 111, 92, 109, 200, 123, 21, 48, 189, 233, - 124, 20, 141, 211, 13, 215, 140, 83, 232, 197, 128, 233, 222, 227, 236, - 134, 188, 177, 128, 233, 173, 101, 202, 209, 56, 221, 166, 213, 37, 165, - 190, 23, 0, 211, 247, 254, 216, 99, 104, 171, 191, 1, 211, 201, 182, - 53, 52, 78, 71, 206, 81, 253, 240, 38, 96, 186, 226, 138, 177, 198, - 223, 23, 48, 205, 214, 247, 124, 41, 253, 47, 96, 218, 108, 221, 143, - 96, 26, 251, 241, 124, 223, 27, 251, 229, 4, 211, 132, 198, 190, 55, - 123, 158, 119, 223, 251, 251, 82, 44, 135, 99, 169, 86, 30, 115, 151, - 206, 92, 49, 230, 197, 220, 165, 115, 107, 103, 211, 28, 14, 50, 110, - 44, 0, 152, 30, 83, 195, 108, 13, 109, 155, 212, 172, 232, 108, 122, - 54, 253, 192, 125, 234, 126, 189, 130, 128, 233, 197, 17, 102, 247, 44, - 239, 147, 206, 209, 59, 154, 15, 73, 239, 204, 8, 215, 206, 121, 63, - 44, 173, 178, 27, 231, 112, 96, 156, 62, 127, 143, 228, 127, 164, 72, - 31, 238, 82, 105, 140, 211, 89, 243, 102, 217, 204, 48, 253, 221, 219, - 179, 232, 185, 246, 71, 26, 206, 162, 231, 218, 167, 63, 158, 105, 194, - 123, 65, 218, 176, 113, 38, 61, 215, 222, 54, 127, 166, 141, 96, 58, - 117, 184, 25, 239, 53, 233, 234, 132, 153, 244, 92, 251, 175, 123, 105, - 247, 89, 3, 166, 223, 106, 100, 204, 235, 15, 152, 126, 176, 121, 38, - 205, 149, 249, 226, 152, 122, 94, 79, 56, 196, 233, 196, 187, 83, 13, - 121, 147, 0, 211, 187, 119, 77, 164, 231, 218, 55, 254, 104, 156, 66, - 47, 7, 76, 159, 174, 63, 202, 144, 119, 136, 35, 71, 90, 178, 252, - 61, 122, 174, 125, 171, 148, 119, 213, 92, 25, 192, 116, 149, 146, 239, - 26, 242, 158, 0, 76, 23, 93, 54, 140, 230, 232, 92, 136, 87, 117, - 45, 1, 76, 31, 188, 63, 193, 248, 157, 1, 211, 157, 202, 78, 163, - 231, 218, 63, 94, 171, 214, 61, 29, 48, 189, 100, 152, 177, 111, 100, - 3, 166, 43, 84, 141, 160, 231, 218, 39, 173, 140, 160, 231, 218, 15, - 171, 48, 219, 244, 92, 123, 182, 94, 237, 75, 105, 60, 215, 222, 108, - 29, 155, 230, 204, 55, 103, 115, 40, 214, 129, 64, 79, 55, 155, 67, - 97, 103, 116, 135, 0, 111, 74, 83, 243, 57, 20, 44, 71, 231, 4, - 155, 177, 242, 161, 77, 197, 205, 213, 163, 92, 58, 39, 8, 52, 234, - 84, 188, 207, 42, 110, 174, 62, 132, 211, 129, 245, 38, 117, 113, 88, - 197, 205, 213, 163, 92, 93, 206, 188, 166, 35, 110, 160, 184, 185, 122, - 180, 187, 200, 245, 45, 180, 177, 200, 245, 45, 135, 85, 236, 250, 22, - 218, 78, 228, 250, 150, 130, 19, 77, 94, 218, 59, 224, 7, 205, 205, - 48, 195, 206, 232, 142, 251, 32, 211, 219, 250, 190, 57, 102, 176, 28, - 241, 3, 235, 7, 172, 188, 243, 61, 113, 152, 177, 114, 58, 226, 224, - 157, 226, 52, 61, 33, 239, 137, 195, 12, 202, 165, 245, 0, 154, 212, - 197, 245, 174, 56, 204, 88, 223, 215, 99, 38, 78, 179, 111, 216, 187, - 226, 48, 131, 118, 23, 185, 190, 21, 242, 158, 216, 245, 45, 180, 167, - 200, 245, 173, 176, 119, 197, 174, 111, 33, 78, 8, 102, 226, 222, 2, - 63, 24, 104, 130, 25, 238, 140, 238, 48, 224, 77, 27, 96, 142, 25, - 44, 71, 252, 32, 237, 109, 86, 222, 49, 64, 28, 102, 80, 46, 209, - 17, 6, 52, 234, 84, 34, 247, 0, 113, 152, 9, 227, 116, 96, 189, - 73, 93, 98, 250, 139, 195, 12, 202, 229, 49, 19, 166, 233, 176, 246, - 23, 135, 25, 180, 187, 200, 56, 227, 51, 64, 108, 156, 65, 123, 138, - 140, 51, 214, 254, 98, 227, 12, 226, 132, 96, 38, 172, 15, 248, 193, - 59, 102, 152, 97, 123, 182, 173, 192, 27, 215, 207, 28, 51, 88, 142, - 198, 128, 55, 89, 121, 123, 63, 113, 152, 65, 185, 52, 6, 0, 141, - 58, 149, 145, 80, 95, 113, 152, 177, 114, 58, 176, 222, 164, 46, 161, - 125, 197, 97, 6, 229, 242, 152, 177, 106, 58, 210, 250, 136, 195, 12, - 218, 93, 100, 156, 65, 27, 139, 140, 51, 161, 125, 197, 198, 25, 180, - 157, 200, 56, 131, 56, 161, 103, 116, 119, 7, 63, 120, 203, 12, 51, - 108, 143, 107, 90, 239, 76, 239, 152, 158, 230, 152, 193, 114, 116, 95, - 80, 47, 110, 239, 81, 79, 129, 123, 143, 122, 113, 251, 130, 128, 70, - 157, 74, 255, 175, 135, 56, 204, 248, 113, 58, 176, 222, 164, 46, 33, - 61, 196, 97, 6, 229, 234, 206, 181, 215, 116, 184, 186, 11, 220, 123, - 212, 83, 108, 156, 65, 27, 139, 140, 51, 33, 61, 196, 198, 25, 180, - 157, 200, 56, 131, 56, 161, 152, 233, 4, 125, 154, 62, 121, 98, 230, - 163, 81, 35, 70, 106, 50, 180, 89, 165, 110, 153, 222, 161, 93, 73, - 121, 95, 25, 111, 170, 192, 140, 165, 151, 238, 79, 233, 198, 237, 63, - 237, 198, 197, 153, 46, 153, 121, 222, 111, 240, 101, 74, 243, 221, 181, - 188, 146, 218, 27, 229, 6, 37, 255, 23, 201, 238, 208, 226, 116, 184, - 224, 157, 92, 154, 30, 191, 55, 242, 214, 113, 124, 70, 221, 36, 203, - 148, 27, 109, 141, 114, 131, 78, 245, 237, 206, 246, 159, 118, 229, 234, - 1, 52, 173, 203, 235, 121, 235, 240, 143, 94, 148, 20, 245, 209, 174, - 182, 70, 185, 65, 203, 198, 244, 98, 103, 26, 119, 213, 99, 198, 165, - 217, 215, 213, 41, 111, 29, 255, 38, 15, 180, 253, 94, 194, 97, 120, - 174, 125, 70, 111, 150, 27, 132, 118, 231, 243, 33, 208, 142, 68, 30, - 161, 49, 31, 130, 61, 199, 251, 62, 155, 88, 54, 90, 172, 150, 31, - 185, 59, 94, 49, 55, 168, 236, 152, 63, 180, 50, 221, 101, 82, 30, - 115, 131, 198, 207, 27, 100, 24, 163, 48, 55, 168, 85, 220, 11, 109, - 109, 103, 150, 156, 54, 110, 109, 27, 117, 46, 55, 74, 206, 184, 18, - 178, 219, 120, 62, 118, 129, 124, 239, 249, 251, 218, 250, 207, 18, 74, - 99, 62, 4, 123, 158, 119, 236, 73, 211, 252, 130, 183, 1, 126, 103, - 98, 3, 66, 163, 13, 216, 115, 180, 65, 16, 216, 32, 16, 108, 16, - 168, 203, 9, 73, 123, 240, 38, 205, 139, 33, 229, 49, 39, 228, 191, - 130, 93, 77, 243, 98, 130, 47, 203, 52, 47, 230, 217, 158, 96, 154, - 23, 211, 224, 135, 214, 166, 121, 49, 137, 205, 173, 52, 47, 134, 208, - 104, 3, 246, 220, 216, 6, 232, 183, 188, 13, 208, 15, 137, 13, 8, - 141, 54, 96, 207, 209, 6, 141, 220, 218, 224, 148, 181, 59, 181, 1, - 41, 143, 54, 8, 110, 30, 98, 106, 131, 39, 23, 222, 164, 54, 216, - 48, 180, 55, 181, 65, 213, 81, 230, 185, 65, 67, 130, 88, 110, 16, - 161, 209, 6, 236, 185, 177, 13, 16, 87, 188, 13, 16, 39, 196, 6, - 132, 70, 27, 176, 231, 104, 131, 105, 96, 131, 105, 96, 131, 105, 58, - 27, 124, 215, 153, 229, 6, 145, 242, 104, 131, 31, 251, 153, 231, 6, - 29, 121, 143, 229, 6, 45, 30, 202, 114, 131, 126, 29, 101, 158, 27, - 84, 118, 50, 203, 13, 34, 52, 218, 128, 61, 55, 238, 55, 97, 187, - 79, 243, 67, 37, 104, 215, 186, 27, 198, 0, 93, 126, 168, 171, 35, - 148, 239, 224, 65, 12, 232, 200, 181, 157, 29, 153, 252, 52, 217, 211, - 24, 224, 190, 47, 128, 120, 167, 109, 39, 167, 195, 5, 239, 228, 210, - 244, 56, 100, 79, 99, 128, 123, 29, 136, 39, 90, 143, 14, 92, 61, - 128, 38, 117, 241, 145, 61, 141, 1, 238, 117, 160, 191, 210, 122, 116, - 200, 21, 3, 52, 251, 198, 72, 158, 198, 0, 247, 58, 208, 31, 104, - 223, 91, 214, 231, 202, 176, 118, 211, 97, 35, 52, 230, 202, 24, 181, - 167, 186, 121, 219, 92, 242, 88, 27, 228, 176, 17, 26, 229, 25, 181, - 77, 186, 241, 126, 46, 121, 12, 207, 14, 27, 161, 81, 158, 17, 206, - 117, 227, 125, 73, 47, 143, 97, 195, 97, 35, 52, 202, 51, 194, 140, - 238, 126, 83, 137, 235, 55, 5, 129, 31, 116, 50, 195, 12, 151, 79, - 103, 135, 254, 118, 99, 115, 204, 96, 57, 218, 71, 111, 194, 141, 53, - 26, 139, 195, 12, 202, 165, 99, 13, 160, 81, 167, 50, 214, 104, 36, - 14, 51, 126, 156, 14, 172, 55, 169, 75, 72, 35, 113, 152, 65, 185, - 186, 177, 134, 166, 195, 21, 36, 14, 51, 104, 119, 190, 239, 237, 14, - 51, 216, 247, 246, 20, 51, 104, 99, 94, 158, 59, 204, 160, 60, 79, - 49, 19, 146, 75, 158, 59, 204, 160, 60, 79, 49, 131, 182, 227, 229, - 185, 195, 12, 202, 243, 20, 51, 136, 19, 26, 103, 26, 102, 122, 251, - 73, 102, 152, 97, 249, 116, 174, 64, 192, 88, 128, 7, 113, 38, 144, - 107, 159, 3, 185, 56, 227, 47, 48, 206, 112, 58, 92, 240, 78, 46, - 77, 143, 195, 95, 96, 156, 9, 224, 234, 1, 52, 169, 139, 143, 191, - 192, 56, 19, 144, 43, 206, 104, 246, 141, 105, 40, 48, 206, 248, 231, - 31, 51, 252, 156, 145, 195, 63, 255, 152, 225, 229, 249, 248, 231, 31, - 51, 188, 60, 180, 93, 126, 49, 195, 247, 205, 16, 39, 52, 111, 187, - 14, 248, 65, 144, 25, 102, 88, 62, 93, 76, 3, 192, 88, 125, 15, - 226, 76, 3, 46, 6, 52, 224, 242, 182, 235, 229, 15, 51, 252, 248, - 220, 143, 211, 17, 3, 239, 20, 163, 233, 177, 215, 203, 31, 102, 248, - 241, 57, 202, 165, 245, 0, 154, 212, 37, 165, 110, 254, 48, 195, 143, - 207, 253, 234, 231, 202, 167, 211, 236, 27, 90, 55, 127, 152, 33, 227, - 243, 96, 205, 238, 196, 135, 252, 222, 43, 226, 252, 44, 235, 104, 66, - 238, 241, 185, 227, 200, 9, 91, 192, 131, 253, 121, 142, 207, 117, 121, - 219, 156, 188, 79, 62, 40, 226, 28, 89, 249, 203, 132, 220, 99, 93, - 235, 209, 19, 182, 11, 47, 134, 229, 57, 214, 213, 229, 109, 215, 101, - 242, 124, 222, 47, 226, 76, 92, 243, 106, 66, 238, 113, 35, 230, 6, - 205, 223, 51, 62, 207, 113, 163, 46, 111, 155, 147, 87, 116, 96, 17, - 103, 203, 45, 81, 47, 141, 193, 156, 248, 126, 213, 35, 242, 28, 131, - 233, 242, 182, 235, 112, 125, 179, 90, 224, 7, 13, 205, 48, 195, 242, - 233, 66, 129, 215, 85, 203, 28, 51, 88, 142, 198, 128, 218, 92, 223, - 172, 186, 167, 152, 113, 159, 239, 210, 54, 180, 35, 187, 179, 189, 54, - 23, 3, 128, 70, 157, 10, 102, 42, 123, 138, 25, 247, 58, 2, 50, - 70, 209, 188, 157, 80, 78, 7, 214, 155, 212, 37, 196, 215, 83, 204, - 184, 215, 33, 117, 187, 64, 117, 160, 92, 93, 222, 182, 166, 195, 90, - 210, 83, 204, 184, 215, 177, 130, 203, 13, 66, 187, 243, 251, 19, 209, - 142, 68, 30, 161, 113, 127, 34, 123, 142, 103, 76, 55, 177, 52, 4, - 220, 180, 133, 31, 191, 63, 113, 76, 199, 202, 116, 207, 241, 134, 226, - 29, 20, 58, 48, 117, 144, 116, 43, 101, 44, 229, 237, 11, 60, 35, - 224, 55, 147, 227, 45, 229, 187, 84, 74, 76, 107, 181, 155, 236, 79, - 36, 88, 45, 255, 108, 179, 84, 98, 102, 140, 225, 92, 90, 185, 130, - 219, 164, 87, 187, 223, 10, 38, 251, 19, 187, 246, 171, 161, 204, 47, - 87, 121, 150, 32, 93, 45, 240, 6, 157, 107, 142, 179, 52, 181, 108, - 183, 52, 179, 236, 180, 52, 103, 249, 61, 5, 246, 73, 187, 253, 23, - 208, 60, 130, 173, 239, 169, 185, 3, 152, 27, 148, 49, 121, 11, 229, - 77, 180, 180, 176, 36, 91, 90, 90, 14, 88, 90, 177, 185, 135, 200, - 99, 210, 188, 51, 187, 104, 30, 193, 145, 142, 251, 20, 250, 89, 248, - 73, 233, 234, 182, 35, 38, 185, 0, 103, 164, 17, 11, 254, 164, 121, - 4, 183, 127, 73, 165, 121, 4, 19, 175, 94, 164, 188, 135, 65, 223, - 113, 203, 171, 150, 20, 248, 49, 189, 23, 164, 249, 235, 238, 208, 60, - 130, 155, 245, 210, 84, 58, 226, 178, 212, 118, 211, 67, 202, 123, 18, - 120, 78, 91, 90, 91, 254, 178, 180, 166, 188, 94, 81, 215, 164, 83, - 115, 238, 210, 60, 130, 168, 87, 31, 40, 116, 175, 136, 219, 210, 198, - 255, 50, 40, 111, 42, 240, 158, 5, 190, 243, 28, 239, 71, 115, 238, - 74, 242, 226, 251, 52, 143, 224, 82, 139, 210, 202, 62, 252, 139, 142, - 116, 41, 250, 112, 93, 186, 39, 255, 34, 240, 92, 178, 188, 102, 185, - 2, 222, 65, 120, 135, 69, 101, 74, 239, 47, 31, 72, 243, 8, 190, - 191, 52, 71, 161, 131, 195, 179, 165, 170, 143, 86, 82, 222, 107, 22, - 155, 229, 134, 69, 182, 220, 178, 116, 162, 188, 225, 17, 57, 82, 102, - 253, 157, 52, 143, 96, 111, 249, 221, 10, 253, 139, 205, 75, 174, 241, - 60, 145, 242, 222, 177, 116, 177, 220, 179, 116, 181, 164, 193, 143, 238, - 169, 76, 246, 150, 35, 46, 125, 71, 243, 8, 70, 39, 173, 80, 232, - 130, 17, 133, 229, 43, 55, 39, 81, 222, 116, 203, 235, 150, 12, 208, - 153, 101, 177, 83, 222, 31, 35, 139, 201, 19, 195, 131, 218, 147, 253, - 137, 27, 250, 169, 117, 63, 216, 190, 148, 108, 251, 124, 23, 181, 85, - 14, 214, 211, 171, 181, 165, 144, 87, 11, 202, 251, 185, 179, 180, 188, - 168, 196, 20, 154, 71, 112, 57, 165, 133, 66, 255, 214, 190, 172, 60, - 99, 202, 13, 195, 249, 93, 204, 13, 98, 243, 199, 190, 148, 190, 60, - 189, 130, 204, 207, 43, 23, 247, 178, 90, 74, 195, 175, 156, 151, 245, - 229, 60, 130, 202, 250, 60, 2, 108, 183, 8, 166, 9, 221, 9, 48, - 205, 158, 35, 166, 45, 47, 97, 250, 111, 192, 244, 206, 177, 55, 40, - 166, 23, 140, 89, 174, 230, 32, 0, 166, 103, 159, 172, 156, 192, 48, - 109, 213, 48, 221, 152, 205, 83, 151, 95, 42, 189, 114, 182, 62, 205, - 35, 32, 241, 18, 115, 131, 62, 59, 217, 215, 112, 110, 24, 247, 28, - 87, 28, 217, 147, 230, 17, 188, 255, 102, 31, 45, 7, 33, 65, 250, - 94, 126, 43, 145, 97, 58, 16, 48, 29, 8, 152, 14, 212, 237, 57, - 62, 241, 247, 32, 154, 71, 112, 252, 226, 72, 109, 79, 254, 97, 233, - 216, 144, 49, 137, 12, 211, 129, 128, 233, 64, 192, 116, 160, 110, 207, - 113, 141, 197, 97, 44, 223, 111, 247, 71, 26, 239, 73, 169, 249, 127, - 147, 76, 243, 8, 254, 120, 103, 50, 205, 35, 176, 125, 53, 85, 203, - 217, 59, 43, 237, 248, 103, 122, 34, 195, 116, 32, 96, 58, 16, 48, - 29, 168, 219, 115, 60, 175, 231, 108, 154, 71, 16, 248, 174, 131, 230, - 251, 149, 47, 19, 153, 200, 48, 29, 0, 152, 14, 0, 76, 7, 112, - 57, 73, 215, 164, 114, 21, 34, 104, 30, 193, 183, 61, 212, 242, 37, - 0, 211, 7, 163, 231, 36, 50, 76, 7, 0, 166, 3, 0, 211, 140, - 183, 86, 212, 93, 105, 224, 190, 121, 52, 143, 96, 115, 208, 114, 133, - 238, 18, 145, 46, 13, 252, 114, 125, 34, 195, 116, 0, 96, 58, 0, - 48, 237, 79, 121, 95, 7, 76, 59, 187, 144, 220, 200, 44, 41, 241, - 194, 69, 45, 127, 33, 91, 122, 54, 229, 121, 34, 195, 116, 67, 192, - 116, 3, 192, 52, 187, 143, 224, 245, 200, 28, 201, 175, 91, 77, 154, - 71, 48, 224, 114, 45, 133, 110, 8, 152, 174, 51, 189, 110, 18, 195, - 116, 93, 192, 116, 29, 192, 116, 29, 202, 155, 225, 244, 150, 171, 188, - 82, 130, 230, 17, 60, 173, 103, 81, 232, 127, 195, 11, 203, 159, 76, - 100, 57, 153, 233, 150, 122, 128, 233, 250, 128, 233, 6, 148, 247, 6, - 96, 186, 247, 48, 45, 175, 4, 48, 61, 187, 248, 103, 10, 253, 4, - 48, 125, 255, 125, 102, 171, 28, 172, 167, 87, 0, 96, 154, 125, 163, - 39, 128, 233, 253, 187, 198, 210, 60, 130, 140, 117, 161, 10, 253, 28, - 48, 253, 201, 130, 190, 134, 190, 129, 123, 142, 217, 122, 136, 47, 165, - 113, 207, 49, 191, 78, 82, 28, 244, 149, 134, 95, 57, 78, 47, 205, - 35, 240, 213, 99, 26, 251, 9, 4, 211, 132, 198, 220, 32, 246, 220, - 61, 166, 79, 1, 166, 255, 25, 180, 139, 98, 250, 251, 132, 107, 74, - 249, 118, 128, 233, 41, 49, 21, 19, 94, 142, 211, 12, 211, 25, 128, - 233, 244, 223, 139, 82, 76, 147, 62, 107, 33, 192, 244, 252, 79, 223, - 55, 92, 235, 40, 8, 113, 250, 175, 133, 163, 41, 166, 99, 219, 68, - 210, 220, 160, 98, 113, 139, 115, 97, 58, 0, 48, 29, 160, 203, 13, - 122, 163, 216, 122, 138, 233, 251, 177, 113, 52, 55, 40, 49, 235, 87, - 14, 211, 254, 128, 105, 127, 192, 116, 67, 93, 110, 208, 95, 139, 156, - 20, 211, 255, 245, 59, 72, 115, 131, 30, 189, 114, 212, 20, 211, 243, - 154, 254, 73, 49, 125, 165, 254, 95, 52, 55, 200, 94, 253, 28, 135, - 233, 134, 128, 233, 6, 128, 105, 230, 107, 79, 1, 211, 9, 21, 175, - 80, 76, 251, 84, 191, 70, 115, 131, 6, 213, 186, 193, 97, 186, 1, - 96, 186, 1, 96, 186, 129, 46, 55, 104, 181, 237, 50, 197, 244, 128, - 255, 174, 42, 244, 43, 128, 233, 230, 43, 111, 112, 152, 110, 0, 152, - 110, 0, 152, 102, 188, 147, 1, 211, 133, 182, 221, 160, 152, 222, 185, - 71, 197, 71, 58, 96, 186, 241, 22, 150, 27, 116, 17, 120, 46, 1, - 62, 174, 0, 78, 8, 111, 52, 96, 186, 122, 231, 32, 154, 27, 52, - 189, 64, 103, 245, 158, 101, 192, 116, 202, 239, 3, 147, 24, 166, 235, - 0, 166, 107, 1, 166, 107, 82, 222, 214, 142, 28, 233, 249, 150, 79, - 40, 166, 199, 215, 88, 168, 208, 145, 128, 233, 113, 75, 22, 113, 152, - 174, 14, 152, 174, 6, 152, 174, 70, 121, 239, 1, 166, 75, 198, 142, - 161, 152, 246, 31, 58, 64, 161, 183, 0, 166, 93, 87, 154, 36, 49, - 76, 215, 0, 76, 251, 1, 166, 89, 123, 176, 11, 48, 189, 186, 69, - 97, 154, 27, 84, 199, 91, 253, 94, 87, 1, 211, 19, 250, 109, 227, - 48, 13, 237, 143, 87, 67, 192, 52, 107, 195, 46, 2, 166, 11, 221, - 90, 70, 49, 29, 189, 64, 109, 3, 238, 1, 166, 195, 222, 30, 110, - 188, 134, 6, 152, 102, 235, 123, 190, 148, 198, 220, 32, 126, 221, 207, - 8, 211, 216, 143, 231, 251, 222, 43, 184, 220, 160, 21, 92, 110, 208, - 10, 46, 55, 72, 197, 244, 52, 192, 244, 52, 93, 223, 123, 95, 9, - 150, 27, 244, 25, 151, 27, 244, 245, 13, 198, 219, 23, 120, 70, 192, - 111, 38, 199, 139, 185, 65, 209, 63, 176, 220, 32, 50, 110, 196, 220, - 160, 113, 118, 227, 181, 59, 140, 211, 150, 166, 44, 55, 232, 155, 76, - 150, 27, 212, 126, 23, 27, 115, 198, 1, 207, 118, 248, 237, 212, 241, - 238, 147, 90, 182, 137, 160, 185, 65, 225, 167, 89, 110, 208, 186, 117, - 44, 255, 35, 209, 50, 21, 48, 61, 21, 48, 61, 85, 23, 167, 7, - 191, 29, 78, 115, 131, 126, 11, 12, 167, 185, 65, 62, 207, 205, 115, - 131, 86, 255, 195, 114, 131, 22, 110, 97, 185, 65, 211, 35, 25, 239, - 97, 208, 119, 28, 126, 41, 58, 189, 23, 164, 146, 77, 103, 209, 220, - 32, 159, 106, 179, 104, 110, 144, 111, 33, 198, 123, 18, 120, 78, 195, - 239, 47, 29, 239, 53, 41, 35, 96, 22, 205, 13, 74, 168, 160, 210, - 69, 1, 211, 115, 44, 140, 55, 21, 120, 206, 194, 239, 60, 199, 235, - 7, 152, 110, 62, 97, 22, 205, 13, 186, 113, 72, 189, 191, 123, 48, - 96, 186, 147, 223, 116, 27, 195, 244, 84, 192, 244, 84, 192, 244, 20, - 29, 166, 127, 24, 56, 153, 230, 6, 125, 149, 16, 166, 222, 57, 14, - 152, 142, 175, 52, 198, 198, 48, 61, 25, 48, 61, 9, 48, 253, 17, - 229, 221, 15, 152, 110, 90, 127, 16, 205, 13, 170, 57, 41, 84, 161, - 251, 0, 166, 95, 221, 59, 208, 198, 48, 61, 30, 48, 61, 30, 48, - 61, 158, 242, 158, 7, 76, 79, 79, 29, 73, 115, 131, 126, 30, 175, - 234, 218, 12, 152, 30, 184, 102, 162, 141, 97, 122, 2, 96, 250, 35, - 192, 244, 36, 202, 123, 12, 48, 189, 235, 149, 233, 52, 55, 232, 47, - 155, 90, 247, 76, 192, 244, 47, 41, 204, 55, 114, 176, 158, 94, 83, - 1, 211, 204, 175, 158, 2, 166, 207, 127, 200, 114, 131, 18, 206, 176, - 220, 160, 175, 236, 230, 185, 65, 108, 189, 218, 151, 210, 24, 167, 249, - 117, 236, 226, 160, 175, 52, 252, 202, 113, 122, 233, 92, 125, 45, 110, - 207, 118, 137, 76, 111, 87, 29, 179, 57, 148, 87, 217, 121, 57, 229, - 51, 189, 67, 202, 153, 207, 161, 96, 57, 154, 183, 83, 158, 59, 147, - 168, 172, 184, 185, 250, 16, 78, 71, 10, 188, 83, 138, 166, 39, 172, - 172, 184, 185, 122, 148, 75, 235, 1, 52, 173, 75, 89, 113, 115, 245, - 33, 229, 114, 157, 73, 164, 217, 55, 218, 71, 220, 92, 61, 218, 93, - 228, 250, 86, 88, 89, 177, 235, 91, 150, 178, 98, 215, 183, 208, 118, - 34, 215, 183, 16, 39, 116, 207, 118, 145, 76, 239, 208, 90, 102, 152, - 97, 249, 116, 86, 224, 141, 43, 102, 142, 25, 44, 71, 247, 58, 23, - 231, 246, 210, 21, 19, 135, 25, 148, 75, 247, 108, 3, 141, 58, 21, - 159, 43, 42, 14, 51, 86, 78, 7, 214, 155, 212, 37, 180, 168, 56, - 204, 160, 92, 221, 158, 109, 77, 71, 90, 17, 113, 152, 65, 187, 139, - 92, 223, 66, 27, 139, 92, 223, 10, 45, 42, 118, 125, 11, 109, 39, - 114, 125, 11, 113, 66, 115, 80, 11, 128, 31, 148, 48, 195, 12, 203, - 167, 75, 43, 156, 233, 29, 86, 200, 28, 51, 88, 142, 230, 237, 20, - 230, 190, 125, 33, 113, 152, 9, 227, 116, 164, 129, 220, 52, 77, 79, - 116, 65, 113, 152, 65, 185, 180, 30, 64, 147, 186, 248, 21, 20, 135, - 153, 176, 66, 122, 204, 164, 105, 54, 138, 43, 32, 14, 51, 104, 119, - 145, 113, 6, 109, 44, 50, 206, 248, 21, 20, 27, 103, 208, 118, 34, - 227, 12, 226, 132, 174, 111, 125, 10, 126, 80, 196, 4, 51, 92, 62, - 93, 156, 119, 166, 119, 204, 82, 115, 204, 96, 57, 26, 3, 188, 185, - 245, 173, 165, 226, 48, 99, 229, 116, 196, 121, 1, 246, 53, 61, 206, - 37, 226, 48, 131, 114, 233, 186, 51, 188, 59, 169, 75, 200, 18, 129, - 123, 143, 150, 230, 202, 65, 245, 210, 246, 30, 125, 42, 112, 239, 209, - 82, 177, 113, 6, 109, 44, 50, 206, 132, 44, 17, 27, 103, 208, 118, - 34, 227, 12, 226, 132, 238, 61, 90, 0, 126, 80, 192, 12, 51, 220, - 30, 215, 197, 208, 151, 91, 228, 193, 222, 163, 197, 220, 122, 237, 98, - 110, 239, 209, 66, 129, 123, 143, 56, 29, 46, 120, 39, 151, 166, 199, - 177, 80, 224, 222, 163, 69, 92, 61, 128, 38, 117, 241, 89, 40, 112, - 239, 209, 162, 92, 123, 143, 52, 251, 198, 44, 16, 184, 247, 104, 161, - 216, 56, 227, 88, 40, 54, 206, 248, 44, 20, 27, 103, 208, 118, 34, - 227, 12, 226, 132, 158, 229, 157, 3, 126, 240, 169, 27, 204, 76, 30, - 51, 142, 187, 54, 136, 237, 139, 249, 36, 211, 219, 111, 190, 7, 119, - 70, 124, 194, 237, 217, 249, 132, 149, 79, 153, 235, 105, 62, 93, 49, - 183, 126, 176, 235, 102, 54, 219, 179, 195, 233, 136, 129, 119, 138, 209, - 244, 56, 162, 60, 205, 167, 115, 175, 99, 94, 197, 74, 44, 6, 204, - 231, 234, 1, 52, 169, 139, 213, 225, 105, 62, 157, 123, 29, 190, 127, - 180, 179, 209, 122, 204, 207, 181, 247, 72, 179, 111, 74, 142, 167, 249, - 116, 238, 117, 28, 220, 216, 80, 209, 81, 221, 91, 181, 123, 61, 165, - 164, 154, 15, 129, 118, 36, 62, 68, 232, 215, 183, 47, 151, 216, 115, - 247, 237, 238, 195, 158, 175, 201, 223, 214, 201, 164, 57, 33, 164, 124, - 129, 196, 94, 114, 61, 159, 103, 198, 235, 21, 114, 63, 249, 250, 145, - 23, 90, 153, 1, 242, 131, 14, 94, 202, 188, 184, 119, 226, 187, 242, - 253, 117, 222, 134, 103, 108, 229, 200, 161, 242, 193, 33, 133, 180, 50, - 67, 229, 207, 111, 23, 84, 121, 35, 134, 203, 7, 86, 21, 76, 50, - 158, 83, 29, 37, 251, 61, 246, 210, 202, 140, 145, 187, 132, 171, 107, - 14, 94, 17, 227, 228, 107, 133, 159, 155, 172, 177, 76, 144, 119, 63, - 121, 162, 149, 153, 36, 143, 44, 243, 68, 91, 39, 153, 34, 87, 168, - 151, 101, 194, 59, 93, 14, 153, 151, 77, 115, 96, 124, 163, 179, 181, - 117, 83, 135, 188, 250, 251, 108, 19, 222, 57, 242, 209, 247, 30, 107, - 101, 62, 150, 135, 159, 33, 103, 172, 126, 34, 91, 122, 62, 50, 225, - 93, 36, 63, 75, 120, 76, 243, 103, 8, 189, 243, 97, 52, 247, 60, - 239, 56, 141, 254, 130, 24, 226, 253, 5, 49, 65, 252, 133, 208, 157, - 193, 95, 216, 115, 247, 242, 210, 192, 95, 130, 94, 121, 66, 239, 153, - 34, 229, 209, 95, 110, 14, 173, 110, 234, 47, 11, 22, 52, 162, 254, - 50, 162, 97, 155, 68, 226, 47, 157, 127, 239, 156, 104, 230, 47, 5, - 63, 36, 231, 1, 14, 149, 139, 186, 222, 83, 245, 130, 191, 236, 104, - 252, 174, 241, 122, 40, 248, 203, 249, 186, 175, 39, 18, 127, 137, 31, - 164, 233, 5, 127, 249, 120, 109, 35, 83, 127, 57, 220, 181, 58, 245, - 151, 212, 209, 101, 169, 191, 220, 94, 92, 216, 212, 95, 202, 191, 250, - 40, 129, 248, 139, 189, 218, 189, 4, 149, 215, 33, 199, 92, 185, 144, - 96, 230, 47, 101, 74, 222, 74, 32, 254, 178, 233, 244, 237, 4, 226, - 47, 157, 190, 190, 147, 96, 230, 47, 237, 55, 221, 167, 121, 119, 132, - 70, 127, 97, 207, 141, 253, 5, 219, 67, 222, 95, 176, 125, 35, 254, - 66, 232, 150, 224, 47, 236, 185, 123, 121, 201, 224, 47, 177, 155, 58, - 208, 124, 43, 82, 190, 20, 248, 203, 163, 213, 193, 134, 188, 133, 58, - 244, 147, 7, 100, 183, 182, 17, 127, 217, 247, 119, 75, 133, 46, 4, - 254, 82, 127, 71, 51, 67, 222, 59, 224, 47, 173, 74, 5, 217, 136, - 191, 196, 190, 171, 210, 190, 224, 47, 153, 75, 131, 12, 121, 11, 68, - 141, 146, 191, 233, 216, 212, 70, 252, 165, 66, 235, 22, 10, 93, 4, - 252, 101, 101, 224, 171, 134, 188, 229, 162, 38, 200, 93, 198, 181, 177, - 17, 127, 249, 99, 70, 123, 133, 246, 1, 127, 113, 204, 151, 13, 121, - 143, 129, 191, 180, 216, 222, 149, 230, 151, 13, 91, 222, 93, 161, 31, - 135, 59, 228, 49, 253, 66, 140, 207, 40, 3, 127, 185, 48, 187, 139, - 141, 248, 203, 137, 66, 111, 168, 52, 248, 203, 129, 69, 157, 109, 102, - 254, 50, 120, 98, 103, 154, 155, 70, 104, 244, 23, 246, 220, 216, 95, - 48, 182, 241, 254, 130, 177, 138, 248, 11, 161, 155, 131, 191, 176, 231, - 238, 229, 37, 129, 191, 220, 154, 81, 155, 250, 11, 41, 143, 254, 146, - 126, 197, 223, 248, 187, 129, 191, 140, 56, 209, 136, 250, 203, 168, 43, - 86, 117, 109, 17, 252, 37, 236, 113, 115, 67, 222, 123, 224, 47, 159, - 250, 182, 161, 254, 210, 245, 204, 107, 10, 93, 14, 252, 229, 149, 31, - 95, 51, 246, 83, 240, 151, 172, 177, 45, 169, 191, 124, 182, 76, 245, - 205, 146, 224, 47, 149, 126, 107, 98, 200, 91, 27, 252, 101, 220, 183, - 65, 212, 95, 158, 221, 107, 160, 174, 165, 130, 191, 148, 108, 83, 199, - 144, 55, 30, 252, 101, 196, 209, 202, 212, 95, 42, 134, 87, 84, 207, - 180, 3, 127, 169, 121, 177, 172, 33, 239, 99, 240, 151, 189, 91, 170, - 82, 127, 89, 177, 178, 186, 66, 191, 8, 255, 68, 30, 28, 89, 195, - 212, 95, 238, 44, 174, 65, 253, 133, 208, 232, 47, 236, 185, 241, 56, - 15, 251, 169, 244, 46, 141, 39, 208, 15, 91, 96, 210, 103, 109, 198, - 173, 169, 60, 203, 244, 14, 121, 234, 193, 93, 26, 207, 184, 245, 158, - 103, 220, 186, 85, 118, 254, 206, 128, 192, 152, 75, 215, 123, 56, 29, - 41, 240, 78, 41, 154, 158, 176, 236, 252, 157, 1, 129, 237, 52, 173, - 199, 83, 174, 30, 64, 211, 186, 100, 231, 239, 12, 8, 196, 54, 173, - 199, 211, 92, 235, 86, 154, 125, 163, 159, 228, 239, 12, 8, 244, 7, - 58, 87, 144, 173, 207, 237, 99, 125, 23, 135, 141, 208, 151, 229, 4, - 187, 81, 159, 70, 183, 110, 149, 75, 30, 139, 109, 14, 27, 161, 81, - 158, 81, 204, 211, 173, 91, 229, 146, 199, 218, 62, 135, 141, 208, 40, - 207, 168, 77, 212, 205, 119, 62, 209, 203, 99, 216, 112, 216, 8, 141, - 242, 140, 48, 163, 187, 75, 227, 9, 119, 151, 70, 6, 248, 65, 142, - 9, 102, 154, 115, 247, 60, 100, 1, 239, 99, 15, 238, 210, 200, 226, - 238, 160, 200, 98, 229, 99, 30, 137, 195, 140, 15, 167, 35, 26, 222, - 41, 90, 211, 99, 125, 36, 14, 51, 40, 151, 214, 3, 104, 82, 23, - 103, 166, 56, 204, 248, 60, 206, 117, 151, 134, 102, 223, 144, 76, 113, - 152, 65, 187, 211, 251, 88, 10, 206, 74, 114, 135, 25, 203, 212, 26, - 30, 99, 198, 154, 75, 158, 59, 204, 160, 60, 79, 49, 131, 246, 228, - 229, 185, 195, 12, 202, 243, 20, 51, 33, 185, 228, 185, 195, 12, 202, - 243, 20, 51, 136, 19, 130, 25, 231, 191, 64, 63, 49, 193, 76, 11, - 238, 92, 79, 224, 77, 73, 247, 224, 236, 212, 12, 46, 6, 60, 228, - 206, 78, 77, 23, 135, 25, 148, 75, 99, 0, 208, 168, 83, 153, 179, - 124, 32, 14, 51, 33, 156, 14, 172, 55, 169, 75, 220, 69, 113, 152, - 65, 185, 186, 179, 83, 53, 29, 246, 139, 226, 48, 131, 118, 207, 47, - 102, 116, 107, 169, 15, 242, 143, 25, 94, 30, 218, 51, 191, 152, 225, - 229, 217, 47, 230, 31, 51, 124, 223, 76, 193, 137, 38, 207, 113, 22, - 252, 32, 195, 4, 51, 45, 217, 247, 176, 3, 175, 243, 188, 57, 102, - 176, 28, 241, 3, 231, 5, 86, 62, 228, 124, 254, 48, 195, 207, 39, - 162, 92, 162, 195, 14, 52, 234, 84, 250, 127, 231, 242, 135, 25, 126, - 62, 209, 206, 233, 192, 122, 147, 186, 132, 157, 203, 31, 102, 248, 249, - 68, 148, 203, 99, 198, 78, 236, 117, 46, 127, 152, 33, 243, 137, 193, - 154, 221, 105, 46, 227, 197, 210, 123, 214, 14, 169, 146, 148, 123, 62, - 209, 239, 202, 70, 91, 155, 132, 251, 158, 229, 164, 159, 99, 242, 98, - 14, 149, 222, 147, 24, 255, 85, 66, 238, 249, 38, 151, 107, 163, 237, - 225, 153, 122, 158, 245, 245, 56, 121, 161, 115, 42, 237, 249, 189, 124, - 216, 75, 243, 17, 33, 206, 88, 91, 157, 93, 205, 61, 138, 51, 22, - 254, 253, 82, 124, 247, 52, 140, 207, 105, 159, 123, 188, 106, 159, 25, - 107, 11, 41, 216, 212, 163, 56, 131, 56, 33, 152, 177, 164, 130, 31, - 252, 107, 130, 153, 86, 220, 247, 0, 94, 71, 170, 57, 102, 176, 28, - 241, 3, 199, 63, 172, 124, 195, 144, 30, 69, 60, 195, 76, 57, 183, - 126, 112, 169, 73, 52, 189, 231, 12, 229, 82, 95, 67, 29, 103, 181, - 113, 64, 63, 79, 116, 84, 203, 83, 71, 213, 239, 206, 210, 60, 67, - 11, 167, 3, 235, 77, 234, 210, 208, 81, 178, 128, 103, 152, 113, 175, - 99, 183, 227, 36, 205, 99, 70, 185, 60, 102, 44, 154, 142, 232, 185, - 158, 232, 168, 146, 167, 142, 245, 183, 212, 117, 171, 214, 5, 85, 187, - 215, 83, 74, 194, 159, 127, 144, 19, 237, 72, 124, 136, 208, 119, 126, - 154, 99, 103, 207, 221, 183, 187, 49, 221, 159, 217, 135, 255, 68, 230, - 179, 173, 210, 200, 63, 171, 42, 244, 236, 176, 225, 210, 47, 29, 90, - 25, 206, 133, 23, 89, 176, 90, 98, 88, 141, 165, 243, 253, 205, 34, - 54, 73, 70, 88, 85, 199, 241, 91, 164, 82, 255, 144, 59, 71, 226, - 164, 1, 195, 18, 19, 213, 249, 131, 120, 201, 47, 253, 7, 67, 222, - 115, 145, 59, 164, 105, 111, 126, 70, 243, 43, 138, 77, 249, 88, 221, - 203, 30, 190, 75, 42, 219, 100, 170, 33, 239, 147, 200, 68, 233, 163, - 195, 36, 239, 201, 41, 93, 108, 166, 230, 61, 21, 142, 216, 43, 117, - 91, 61, 209, 144, 215, 43, 234, 128, 244, 222, 161, 72, 154, 155, 241, - 253, 245, 249, 106, 174, 86, 196, 97, 233, 105, 193, 37, 38, 188, 199, - 164, 144, 85, 43, 104, 110, 198, 234, 152, 181, 218, 60, 240, 73, 233, - 193, 198, 13, 134, 188, 25, 145, 103, 164, 212, 61, 219, 105, 110, 198, - 176, 230, 59, 19, 213, 249, 146, 179, 146, 107, 195, 110, 147, 59, 210, - 46, 72, 95, 29, 216, 65, 115, 51, 102, 223, 217, 78, 243, 173, 134, - 149, 223, 110, 50, 119, 125, 77, 250, 248, 234, 118, 154, 155, 209, 127, - 255, 14, 141, 247, 182, 212, 240, 187, 95, 76, 120, 239, 74, 51, 165, - 157, 52, 55, 227, 203, 214, 187, 52, 222, 116, 233, 151, 38, 9, 38, - 190, 145, 41, 189, 159, 177, 135, 230, 91, 93, 79, 78, 214, 230, 189, - 179, 165, 113, 75, 247, 153, 232, 205, 145, 58, 151, 164, 247, 224, 200, - 165, 110, 28, 80, 121, 109, 94, 242, 233, 228, 223, 77, 114, 151, 188, - 229, 25, 91, 142, 104, 101, 10, 202, 239, 37, 29, 211, 120, 11, 201, - 237, 78, 156, 48, 225, 45, 44, 127, 240, 132, 248, 115, 81, 121, 118, - 197, 83, 26, 111, 49, 121, 93, 243, 51, 198, 247, 227, 36, 23, 151, - 43, 54, 78, 165, 185, 90, 141, 186, 158, 215, 214, 23, 74, 203, 195, - 162, 174, 154, 212, 183, 172, 204, 214, 217, 124, 41, 189, 243, 97, 69, - 217, 108, 253, 141, 180, 37, 216, 190, 146, 182, 228, 83, 104, 75, 176, - 189, 36, 109, 9, 161, 59, 196, 205, 177, 179, 231, 238, 229, 237, 237, - 245, 204, 126, 252, 139, 158, 193, 164, 45, 57, 176, 188, 168, 66, 119, - 156, 48, 92, 74, 159, 30, 214, 214, 136, 119, 55, 180, 37, 44, 78, - 199, 210, 181, 160, 210, 208, 150, 24, 197, 105, 228, 189, 11, 109, 73, - 124, 106, 8, 109, 75, 126, 156, 240, 182, 134, 143, 120, 233, 131, 226, - 131, 77, 124, 109, 135, 52, 107, 109, 8, 109, 75, 202, 58, 186, 104, - 190, 182, 75, 250, 97, 144, 108, 194, 155, 40, 77, 43, 222, 134, 182, - 37, 171, 59, 183, 208, 120, 247, 74, 206, 168, 198, 38, 188, 7, 164, - 227, 15, 26, 210, 182, 228, 171, 9, 117, 105, 238, 230, 136, 7, 53, - 77, 120, 143, 73, 175, 12, 172, 74, 219, 146, 161, 49, 149, 104, 238, - 230, 230, 75, 190, 166, 121, 94, 231, 173, 190, 180, 45, 249, 62, 172, - 28, 205, 221, 28, 23, 231, 99, 194, 123, 65, 90, 50, 189, 20, 109, - 75, 92, 165, 74, 210, 182, 164, 233, 250, 226, 166, 109, 201, 129, 2, - 37, 104, 91, 242, 226, 151, 162, 180, 45, 121, 237, 67, 179, 181, 172, - 187, 210, 241, 172, 23, 9, 164, 45, 217, 182, 240, 169, 182, 150, 149, - 46, 173, 170, 254, 56, 193, 172, 45, 121, 113, 144, 148, 201, 146, 246, - 78, 126, 164, 173, 101, 101, 75, 243, 234, 102, 38, 152, 181, 37, 75, - 207, 166, 145, 50, 114, 165, 121, 15, 19, 72, 91, 18, 211, 228, 81, - 130, 89, 91, 98, 77, 240, 162, 109, 201, 188, 185, 222, 180, 45, 57, - 219, 189, 128, 105, 91, 210, 179, 49, 169, 111, 81, 121, 228, 68, 173, - 190, 208, 150, 68, 237, 124, 108, 162, 183, 184, 60, 106, 47, 25, 11, - 150, 148, 151, 206, 85, 223, 25, 219, 146, 127, 139, 62, 77, 48, 107, - 75, 216, 26, 172, 47, 165, 177, 45, 49, 91, 155, 165, 253, 18, 232, - 71, 145, 182, 36, 182, 78, 144, 19, 251, 69, 164, 45, 33, 244, 244, - 77, 115, 236, 236, 121, 30, 253, 146, 218, 207, 236, 21, 178, 11, 208, - 60, 175, 45, 251, 212, 245, 151, 209, 93, 135, 75, 223, 252, 211, 199, - 112, 44, 121, 173, 195, 106, 137, 245, 209, 99, 233, 58, 97, 161, 197, - 155, 36, 163, 62, 58, 242, 214, 141, 216, 34, 141, 248, 203, 199, 70, - 218, 146, 33, 146, 218, 55, 143, 152, 26, 47, 45, 31, 243, 143, 225, - 125, 124, 161, 51, 119, 72, 133, 238, 110, 111, 79, 218, 146, 8, 251, - 6, 133, 94, 56, 115, 151, 116, 251, 208, 74, 67, 222, 59, 208, 150, - 164, 126, 176, 170, 61, 105, 75, 174, 94, 93, 171, 208, 242, 236, 189, - 210, 226, 177, 223, 25, 242, 78, 135, 126, 201, 167, 111, 253, 210, 158, - 180, 37, 141, 55, 236, 83, 232, 25, 208, 150, 92, 205, 78, 49, 228, - 173, 62, 231, 152, 228, 19, 120, 169, 61, 105, 75, 14, 44, 73, 87, - 232, 165, 208, 150, 148, 125, 225, 101, 104, 171, 249, 17, 103, 164, 118, - 153, 229, 104, 126, 217, 166, 132, 10, 218, 58, 231, 89, 169, 175, 163, - 178, 33, 239, 120, 104, 75, 126, 241, 41, 77, 243, 203, 126, 237, 95, - 66, 161, 127, 10, 191, 44, 197, 125, 83, 212, 120, 125, 21, 218, 146, - 58, 43, 138, 210, 252, 178, 42, 13, 84, 186, 0, 180, 37, 229, 118, - 22, 49, 228, 45, 29, 117, 87, 202, 172, 88, 132, 230, 151, 253, 25, - 164, 242, 250, 67, 91, 178, 95, 46, 102, 200, 155, 5, 109, 201, 193, - 147, 37, 105, 126, 89, 245, 63, 213, 247, 127, 16, 158, 45, 133, 158, - 240, 49, 228, 189, 14, 109, 201, 200, 26, 229, 105, 126, 217, 249, 59, - 42, 157, 211, 222, 75, 238, 188, 219, 215, 120, 109, 49, 217, 91, 254, - 99, 79, 121, 154, 95, 22, 189, 86, 45, 95, 30, 218, 146, 225, 225, - 21, 140, 215, 248, 146, 11, 203, 83, 23, 85, 178, 145, 182, 228, 135, - 69, 234, 186, 91, 16, 180, 37, 95, 46, 126, 197, 120, 173, 13, 218, - 146, 208, 183, 234, 208, 220, 52, 185, 159, 186, 62, 120, 46, 188, 180, - 60, 175, 151, 241, 218, 226, 83, 104, 75, 216, 250, 188, 47, 165, 19, - 161, 45, 49, 91, 183, 167, 253, 146, 185, 172, 45, 105, 1, 253, 18, - 28, 255, 144, 182, 132, 208, 163, 96, 140, 195, 158, 231, 129, 203, 174, - 207, 236, 75, 94, 244, 164, 109, 73, 137, 141, 109, 21, 186, 227, 251, - 195, 165, 37, 75, 234, 27, 242, 206, 124, 123, 181, 196, 198, 231, 177, - 116, 13, 121, 251, 252, 77, 146, 209, 248, 28, 121, 83, 103, 110, 145, - 118, 132, 134, 208, 182, 228, 234, 113, 245, 238, 177, 47, 167, 197, 75, - 233, 5, 140, 239, 42, 43, 229, 216, 33, 121, 183, 30, 71, 243, 77, - 91, 188, 170, 222, 49, 182, 28, 198, 56, 75, 154, 79, 50, 241, 211, - 68, 105, 209, 70, 146, 119, 232, 148, 98, 98, 62, 82, 104, 43, 244, - 75, 190, 91, 101, 124, 87, 89, 61, 104, 75, 166, 45, 26, 71, 115, - 85, 15, 37, 140, 86, 232, 14, 208, 150, 124, 123, 119, 164, 33, 239, - 183, 48, 198, 217, 51, 114, 24, 205, 85, 181, 134, 170, 57, 148, 31, - 67, 91, 210, 237, 77, 227, 251, 213, 150, 58, 206, 72, 101, 175, 246, - 162, 109, 73, 223, 134, 61, 105, 91, 50, 127, 108, 119, 67, 222, 221, - 208, 150, 148, 94, 208, 151, 182, 37, 171, 6, 189, 169, 249, 233, 101, - 233, 204, 107, 253, 141, 207, 213, 133, 182, 196, 225, 223, 159, 182, 37, - 139, 199, 246, 183, 145, 126, 201, 202, 159, 251, 155, 172, 189, 223, 149, - 54, 86, 27, 64, 219, 146, 65, 131, 212, 242, 229, 161, 45, 241, 221, - 248, 150, 33, 239, 51, 104, 75, 198, 119, 239, 71, 219, 146, 215, 239, - 171, 49, 237, 41, 180, 37, 117, 63, 239, 109, 200, 251, 16, 218, 146, - 90, 119, 122, 209, 182, 228, 243, 190, 42, 253, 2, 218, 146, 194, 187, - 123, 26, 242, 122, 67, 91, 18, 242, 110, 47, 218, 150, 12, 140, 83, - 203, 151, 132, 182, 100, 68, 33, 99, 222, 74, 208, 150, 252, 247, 101, - 119, 218, 150, 252, 217, 90, 221, 47, 82, 7, 218, 146, 174, 169, 175, - 27, 242, 150, 129, 49, 78, 70, 175, 14, 180, 45, 249, 40, 198, 166, - 237, 17, 41, 45, 151, 149, 90, 219, 204, 250, 37, 108, 239, 134, 47, - 165, 127, 131, 182, 196, 108, 79, 7, 153, 35, 195, 121, 49, 186, 22, - 115, 42, 211, 219, 113, 214, 100, 142, 172, 53, 155, 127, 113, 252, 13, - 101, 255, 50, 159, 35, 195, 114, 116, 222, 231, 111, 86, 62, 250, 140, - 184, 181, 24, 11, 167, 195, 1, 239, 228, 208, 244, 248, 157, 17, 183, - 22, 131, 114, 105, 61, 176, 222, 154, 142, 184, 211, 226, 214, 98, 44, - 127, 233, 231, 200, 28, 154, 125, 237, 167, 197, 173, 197, 160, 221, 69, - 174, 95, 250, 157, 17, 187, 126, 137, 246, 20, 185, 126, 105, 63, 45, - 118, 253, 18, 113, 66, 243, 238, 238, 195, 119, 73, 53, 193, 204, 107, - 220, 58, 1, 240, 58, 255, 244, 96, 45, 230, 20, 183, 134, 113, 146, - 91, 139, 249, 83, 28, 102, 80, 46, 93, 139, 1, 26, 117, 42, 145, - 34, 69, 28, 102, 236, 156, 14, 172, 55, 169, 75, 88, 138, 56, 204, - 160, 92, 221, 90, 140, 166, 35, 238, 190, 56, 204, 160, 221, 69, 174, - 95, 162, 141, 69, 174, 95, 134, 165, 136, 93, 191, 68, 219, 137, 92, - 191, 68, 156, 208, 187, 31, 111, 131, 31, 156, 50, 198, 76, 83, 43, - 151, 19, 118, 47, 211, 219, 122, 215, 131, 187, 31, 239, 113, 121, 119, - 247, 184, 187, 31, 239, 228, 15, 51, 55, 35, 70, 179, 220, 107, 78, - 71, 28, 188, 83, 156, 166, 39, 228, 78, 254, 48, 83, 48, 229, 14, - 93, 239, 65, 185, 180, 30, 64, 147, 186, 184, 254, 203, 31, 102, 90, - 54, 255, 182, 61, 173, 199, 221, 92, 121, 119, 154, 125, 195, 254, 203, - 31, 102, 66, 155, 126, 196, 238, 126, 188, 195, 249, 144, 238, 207, 97, - 67, 155, 18, 58, 47, 61, 47, 237, 67, 49, 144, 135, 246, 251, 159, - 202, 67, 123, 230, 37, 15, 109, 245, 63, 149, 23, 102, 32, 15, 237, - 226, 169, 60, 122, 247, 227, 109, 238, 28, 145, 235, 224, 7, 247, 77, - 48, 195, 229, 16, 133, 1, 111, 218, 77, 15, 238, 126, 188, 205, 229, - 94, 223, 226, 238, 126, 188, 41, 46, 206, 160, 92, 154, 123, 13, 52, - 234, 196, 50, 62, 55, 197, 197, 153, 48, 78, 7, 214, 155, 212, 37, - 230, 134, 184, 56, 131, 114, 117, 119, 63, 106, 58, 172, 55, 196, 197, - 25, 180, 187, 200, 56, 227, 115, 83, 108, 156, 65, 123, 138, 140, 51, - 214, 27, 98, 227, 12, 226, 132, 158, 35, 114, 25, 252, 224, 182, 9, - 102, 184, 61, 204, 86, 224, 141, 187, 234, 193, 221, 143, 215, 185, 24, - 112, 141, 59, 71, 228, 170, 56, 204, 160, 92, 26, 3, 128, 70, 157, - 202, 236, 193, 21, 113, 152, 177, 114, 58, 176, 222, 164, 46, 161, 87, - 196, 97, 6, 229, 234, 206, 17, 209, 116, 164, 93, 22, 135, 25, 180, - 187, 200, 241, 12, 218, 88, 228, 120, 38, 244, 138, 216, 241, 12, 218, - 78, 228, 120, 6, 113, 66, 207, 201, 223, 14, 126, 112, 61, 47, 204, - 96, 122, 247, 36, 221, 29, 70, 105, 151, 50, 189, 99, 246, 120, 112, - 247, 227, 37, 46, 6, 92, 98, 229, 125, 18, 61, 197, 76, 113, 183, - 126, 112, 241, 200, 183, 236, 254, 95, 78, 71, 154, 11, 176, 175, 233, - 113, 236, 242, 20, 51, 238, 117, 212, 72, 232, 69, 117, 160, 92, 154, - 15, 11, 245, 38, 117, 73, 251, 213, 83, 204, 184, 215, 145, 22, 104, - 163, 152, 65, 185, 186, 115, 68, 92, 26, 46, 119, 120, 138, 25, 247, - 58, 106, 206, 87, 247, 150, 13, 240, 86, 237, 94, 79, 41, 169, 230, - 6, 161, 29, 137, 15, 17, 26, 115, 85, 217, 243, 60, 246, 96, 244, - 124, 77, 110, 182, 245, 59, 173, 76, 119, 153, 148, 247, 78, 236, 37, - 175, 94, 107, 204, 139, 185, 135, 255, 6, 146, 50, 3, 100, 111, 199, - 122, 141, 247, 93, 185, 254, 233, 117, 38, 188, 161, 242, 133, 229, 49, - 90, 153, 161, 242, 157, 37, 223, 168, 231, 103, 63, 27, 41, 255, 216, - 116, 173, 33, 111, 78, 129, 241, 242, 204, 97, 107, 180, 50, 147, 228, - 137, 151, 190, 106, 167, 174, 35, 78, 150, 39, 56, 190, 106, 103, 188, - 142, 56, 69, 94, 113, 118, 149, 86, 102, 154, 220, 232, 232, 42, 141, - 119, 186, 188, 63, 113, 149, 9, 239, 12, 121, 247, 8, 34, 127, 150, - 156, 241, 190, 74, 99, 174, 106, 106, 43, 99, 189, 152, 123, 88, 188, - 225, 74, 173, 204, 199, 114, 249, 186, 43, 53, 189, 243, 229, 74, 181, - 87, 154, 232, 253, 68, 62, 148, 78, 202, 44, 148, 155, 13, 39, 239, - 188, 72, 94, 243, 143, 89, 125, 23, 203, 245, 45, 223, 104, 101, 150, - 80, 250, 252, 244, 165, 220, 243, 188, 99, 60, 250, 26, 226, 143, 247, - 53, 196, 19, 241, 53, 66, 163, 175, 177, 231, 121, 251, 218, 241, 211, - 125, 169, 175, 145, 242, 232, 107, 131, 110, 247, 52, 245, 53, 235, 244, - 238, 212, 215, 42, 87, 235, 74, 125, 205, 146, 248, 186, 169, 175, 157, - 121, 210, 129, 250, 90, 253, 2, 18, 245, 181, 101, 101, 218, 153, 250, - 90, 215, 203, 173, 169, 175, 213, 28, 222, 156, 250, 154, 111, 145, 102, - 166, 190, 246, 188, 105, 19, 234, 107, 203, 150, 52, 166, 190, 214, 240, - 191, 70, 166, 190, 118, 119, 112, 99, 234, 107, 199, 107, 88, 169, 175, - 245, 41, 253, 170, 169, 175, 157, 146, 122, 82, 95, 251, 171, 106, 79, - 234, 107, 3, 138, 244, 52, 245, 181, 234, 150, 14, 212, 215, 158, 92, - 104, 71, 125, 237, 239, 221, 173, 77, 125, 109, 102, 251, 102, 212, 215, - 8, 141, 190, 198, 158, 27, 251, 26, 182, 195, 188, 175, 97, 187, 74, - 124, 141, 208, 232, 107, 236, 121, 222, 190, 246, 90, 57, 27, 205, 121, - 36, 229, 209, 215, 42, 52, 53, 230, 69, 95, 251, 118, 128, 141, 230, - 60, 254, 213, 202, 70, 115, 30, 139, 85, 48, 227, 13, 149, 71, 174, - 104, 79, 115, 30, 219, 13, 104, 111, 35, 190, 246, 118, 161, 246, 54, - 51, 95, 203, 153, 210, 142, 230, 45, 206, 58, 167, 210, 232, 107, 107, - 50, 140, 215, 22, 45, 201, 83, 228, 31, 187, 18, 249, 211, 228, 158, - 27, 84, 218, 27, 124, 45, 221, 203, 248, 157, 189, 146, 103, 200, 195, - 234, 216, 105, 206, 99, 153, 37, 54, 109, 141, 202, 33, 175, 107, 221, - 206, 100, 205, 122, 142, 188, 243, 68, 19, 154, 243, 248, 196, 170, 230, - 135, 150, 5, 95, 91, 61, 200, 106, 200, 91, 60, 249, 19, 185, 120, - 253, 86, 54, 226, 107, 91, 195, 213, 92, 209, 226, 224, 107, 43, 206, - 180, 55, 121, 231, 197, 114, 131, 83, 175, 211, 124, 73, 66, 163, 175, - 177, 231, 198, 190, 134, 241, 152, 247, 53, 140, 175, 196, 215, 8, 141, - 190, 198, 158, 231, 237, 107, 43, 86, 55, 164, 190, 70, 202, 163, 175, - 21, 153, 211, 208, 212, 215, 42, 191, 219, 144, 250, 218, 250, 143, 27, - 82, 95, 11, 138, 111, 104, 234, 107, 17, 93, 253, 89, 62, 246, 74, - 127, 234, 107, 11, 159, 251, 155, 250, 90, 181, 31, 2, 168, 175, 77, - 234, 16, 64, 125, 173, 120, 64, 128, 169, 175, 21, 62, 238, 79, 125, - 173, 205, 40, 127, 234, 107, 227, 10, 250, 155, 250, 218, 210, 63, 26, - 80, 95, 235, 57, 80, 173, 99, 69, 240, 181, 208, 95, 140, 245, 222, - 6, 95, 155, 181, 160, 53, 245, 53, 223, 94, 42, 93, 14, 124, 237, - 98, 83, 227, 181, 54, 31, 240, 181, 198, 63, 55, 163, 190, 246, 239, - 127, 141, 52, 63, 93, 36, 151, 169, 239, 111, 178, 182, 184, 88, 158, - 50, 132, 229, 230, 18, 26, 125, 141, 61, 55, 30, 215, 98, 191, 156, - 244, 209, 99, 78, 64, 191, 243, 178, 89, 31, 157, 221, 153, 24, 10, - 188, 174, 120, 243, 62, 58, 150, 163, 231, 35, 109, 99, 229, 195, 226, - 243, 55, 174, 197, 126, 2, 61, 31, 105, 27, 119, 62, 18, 208, 168, - 83, 41, 20, 159, 191, 113, 45, 198, 7, 90, 15, 78, 7, 214, 155, - 212, 37, 250, 231, 252, 141, 107, 177, 93, 160, 245, 136, 207, 117, 47, - 143, 166, 195, 239, 231, 252, 141, 107, 209, 31, 232, 124, 98, 188, 62, - 87, 149, 245, 183, 28, 54, 66, 63, 233, 144, 96, 55, 234, 135, 233, - 242, 43, 114, 201, 99, 49, 213, 97, 35, 52, 202, 51, 138, 181, 186, - 92, 218, 159, 245, 242, 88, 187, 233, 176, 17, 26, 229, 25, 181, 167, - 186, 117, 196, 92, 242, 24, 54, 28, 54, 66, 163, 60, 35, 204, 240, - 227, 90, 196, 9, 61, 235, 239, 8, 248, 193, 118, 51, 204, 176, 59, - 19, 253, 128, 55, 230, 152, 57, 102, 176, 28, 29, 15, 30, 231, 206, - 250, 59, 38, 14, 51, 40, 151, 158, 143, 4, 52, 234, 84, 214, 53, - 142, 138, 195, 140, 31, 167, 3, 235, 77, 234, 18, 114, 84, 28, 102, - 80, 174, 238, 158, 81, 77, 135, 235, 136, 56, 204, 160, 221, 233, 220, - 200, 11, 103, 123, 119, 152, 177, 76, 253, 215, 230, 41, 102, 208, 198, - 188, 60, 119, 152, 65, 121, 158, 98, 38, 132, 151, 247, 212, 217, 222, - 29, 102, 28, 147, 255, 181, 121, 138, 25, 180, 29, 149, 247, 196, 217, - 222, 29, 102, 44, 32, 207, 83, 204, 32, 78, 232, 89, 127, 191, 131, - 31, 156, 48, 195, 12, 187, 51, 209, 117, 24, 218, 243, 63, 204, 49, - 131, 229, 104, 12, 56, 204, 157, 245, 119, 72, 28, 102, 66, 57, 29, - 46, 120, 39, 151, 166, 199, 113, 72, 28, 102, 80, 46, 173, 7, 208, - 164, 46, 62, 135, 196, 97, 38, 244, 143, 92, 103, 253, 105, 246, 141, - 249, 93, 28, 102, 208, 238, 249, 197, 12, 63, 167, 239, 56, 148, 127, - 204, 232, 214, 48, 14, 229, 31, 51, 186, 53, 140, 223, 243, 143, 25, - 190, 111, 134, 56, 161, 243, 167, 123, 193, 15, 142, 152, 97, 134, 221, - 153, 24, 115, 16, 218, 243, 3, 30, 156, 245, 119, 144, 139, 1, 7, - 185, 123, 70, 247, 231, 15, 51, 252, 252, 169, 31, 167, 35, 6, 222, - 41, 70, 211, 99, 223, 159, 63, 204, 240, 243, 167, 40, 151, 214, 3, - 104, 82, 151, 148, 125, 249, 195, 12, 63, 127, 234, 119, 32, 215, 89, - 127, 154, 125, 67, 247, 229, 15, 51, 100, 254, 52, 88, 179, 59, 241, - 33, 151, 179, 244, 158, 11, 15, 55, 188, 52, 127, 234, 227, 218, 104, - 235, 28, 240, 173, 71, 113, 193, 158, 75, 158, 213, 58, 224, 165, 57, - 50, 148, 215, 179, 68, 79, 143, 228, 161, 61, 169, 188, 51, 165, 247, - 76, 170, 213, 241, 165, 121, 16, 235, 229, 141, 182, 98, 141, 219, 123, - 20, 103, 66, 57, 121, 150, 11, 165, 247, 140, 247, 169, 251, 210, 88, - 215, 5, 242, 126, 24, 237, 239, 81, 156, 65, 156, 208, 190, 153, 19, - 252, 224, 119, 51, 204, 180, 98, 125, 109, 224, 117, 57, 61, 24, 207, - 236, 229, 98, 64, 50, 135, 153, 237, 111, 228, 43, 55, 119, 67, 115, - 7, 187, 103, 52, 153, 139, 1, 64, 163, 78, 44, 83, 249, 183, 55, - 242, 149, 155, 59, 171, 111, 122, 27, 90, 15, 78, 7, 214, 155, 212, - 37, 174, 69, 191, 34, 158, 97, 198, 189, 142, 7, 95, 165, 208, 220, - 92, 148, 171, 27, 207, 104, 58, 42, 191, 230, 137, 142, 188, 115, 115, - 235, 220, 102, 185, 185, 104, 119, 178, 111, 125, 140, 127, 144, 19, 237, - 72, 124, 136, 208, 13, 227, 230, 216, 217, 115, 247, 237, 238, 245, 158, - 207, 236, 163, 250, 44, 210, 112, 96, 149, 252, 71, 196, 42, 244, 43, - 19, 134, 75, 253, 3, 14, 25, 198, 148, 39, 11, 86, 75, 12, 171, - 177, 116, 125, 195, 43, 98, 147, 100, 132, 85, 139, 150, 155, 187, 241, - 147, 245, 90, 153, 56, 201, 49, 120, 189, 118, 103, 103, 188, 244, 118, - 240, 122, 67, 222, 130, 81, 59, 164, 6, 161, 223, 107, 101, 118, 74, - 227, 178, 212, 88, 90, 46, 98, 151, 52, 55, 218, 120, 14, 190, 100, - 84, 162, 20, 252, 39, 169, 175, 83, 170, 58, 106, 150, 66, 151, 136, - 216, 43, 37, 53, 30, 100, 200, 123, 55, 242, 128, 244, 251, 169, 102, - 244, 126, 211, 33, 213, 171, 41, 244, 131, 240, 195, 82, 167, 225, 5, - 140, 231, 219, 35, 143, 73, 207, 236, 46, 45, 31, 41, 69, 250, 233, - 120, 106, 176, 90, 223, 147, 210, 236, 247, 254, 52, 204, 83, 194, 251, - 77, 99, 122, 220, 209, 202, 164, 74, 37, 94, 188, 80, 232, 130, 17, - 103, 165, 158, 169, 197, 12, 245, 122, 71, 93, 144, 122, 44, 173, 76, - 239, 55, 109, 211, 161, 65, 59, 149, 247, 178, 212, 229, 113, 75, 67, - 222, 167, 145, 215, 164, 202, 75, 122, 208, 251, 77, 39, 253, 248, 174, - 66, 63, 15, 191, 45, 109, 56, 52, 202, 144, 55, 59, 242, 174, 212, - 220, 54, 141, 222, 111, 218, 247, 105, 184, 118, 175, 106, 186, 180, 237, - 92, 164, 137, 111, 100, 74, 33, 187, 29, 90, 153, 44, 233, 122, 249, - 72, 109, 190, 61, 91, 154, 53, 198, 140, 55, 71, 106, 84, 51, 138, - 148, 145, 103, 204, 136, 210, 230, 204, 189, 228, 223, 207, 68, 153, 204, - 153, 123, 203, 62, 79, 72, 153, 130, 114, 177, 97, 115, 52, 222, 66, - 114, 129, 63, 231, 24, 223, 65, 155, 92, 88, 94, 244, 23, 41, 83, - 84, 254, 176, 228, 199, 234, 59, 219, 138, 201, 221, 228, 79, 76, 244, - 22, 151, 11, 93, 248, 84, 43, 83, 82, 94, 21, 242, 153, 134, 163, - 210, 114, 210, 171, 95, 154, 212, 183, 172, 204, 214, 21, 125, 41, 141, - 249, 116, 102, 235, 141, 164, 45, 193, 246, 149, 180, 37, 227, 160, 45, - 193, 246, 146, 180, 37, 132, 182, 66, 91, 194, 158, 187, 151, 87, 165, - 215, 51, 123, 175, 13, 163, 105, 91, 50, 45, 64, 189, 11, 248, 85, - 104, 75, 134, 118, 93, 107, 218, 150, 176, 56, 29, 75, 215, 175, 176, - 45, 49, 138, 211, 164, 45, 249, 75, 238, 69, 219, 146, 35, 187, 180, - 181, 44, 104, 75, 156, 205, 66, 76, 238, 14, 222, 33, 149, 217, 223, - 151, 182, 37, 191, 84, 82, 121, 139, 64, 91, 210, 103, 116, 87, 67, - 222, 98, 208, 150, 92, 94, 101, 163, 109, 201, 133, 77, 234, 58, 82, - 41, 104, 75, 218, 236, 174, 102, 200, 155, 14, 109, 73, 151, 198, 55, - 131, 73, 91, 178, 222, 251, 160, 66, 103, 65, 91, 210, 48, 245, 91, - 195, 246, 0, 243, 252, 111, 102, 174, 161, 109, 201, 205, 143, 230, 40, - 116, 97, 104, 75, 250, 92, 236, 107, 200, 251, 56, 242, 140, 148, 253, - 243, 218, 182, 164, 45, 233, 52, 231, 23, 133, 46, 15, 109, 201, 157, - 126, 199, 13, 99, 197, 147, 200, 11, 82, 192, 189, 185, 193, 164, 45, - 185, 228, 245, 131, 122, 172, 92, 248, 101, 233, 156, 239, 49, 67, 189, - 89, 120, 95, 91, 208, 189, 96, 210, 150, 196, 84, 206, 86, 105, 204, - 167, 243, 46, 96, 242, 125, 239, 74, 25, 201, 207, 130, 73, 91, 50, - 127, 177, 202, 139, 121, 254, 85, 251, 103, 25, 234, 125, 1, 109, 73, - 235, 110, 15, 130, 73, 91, 210, 219, 245, 72, 107, 119, 179, 165, 113, - 147, 159, 5, 155, 181, 37, 251, 211, 139, 210, 182, 228, 148, 179, 52, - 109, 75, 46, 45, 241, 53, 109, 75, 234, 204, 170, 74, 219, 146, 200, - 106, 53, 104, 91, 242, 239, 174, 90, 166, 109, 73, 163, 243, 181, 105, - 91, 210, 108, 87, 3, 141, 183, 152, 220, 230, 203, 32, 211, 182, 100, - 119, 242, 171, 180, 45, 137, 255, 43, 152, 182, 37, 171, 44, 175, 155, - 182, 37, 108, 221, 216, 151, 210, 216, 150, 152, 173, 39, 211, 126, 9, - 244, 163, 104, 91, 82, 43, 200, 137, 253, 34, 210, 150, 16, 58, 251, - 135, 57, 118, 246, 220, 189, 188, 229, 85, 159, 217, 83, 215, 22, 167, - 249, 116, 111, 157, 85, 207, 16, 61, 60, 116, 184, 116, 178, 150, 113, - 110, 110, 111, 104, 75, 88, 31, 61, 150, 174, 79, 214, 129, 182, 196, - 168, 143, 174, 174, 107, 108, 145, 58, 124, 222, 134, 230, 211, 181, 169, - 168, 158, 141, 186, 0, 218, 146, 59, 171, 140, 207, 198, 13, 158, 183, - 67, 250, 127, 180, 93, 7, 96, 83, 213, 215, 191, 73, 10, 5, 25, - 22, 68, 134, 50, 202, 134, 50, 236, 96, 183, 205, 107, 203, 222, 5, - 10, 20, 16, 218, 180, 73, 219, 208, 54, 9, 73, 186, 24, 109, 5, - 100, 201, 222, 178, 172, 34, 75, 65, 202, 80, 144, 182, 73, 4, 65, - 28, 104, 21, 197, 173, 117, 15, 80, 64, 101, 202, 248, 126, 231, 190, - 151, 151, 87, 90, 192, 127, 202, 39, 158, 247, 206, 189, 239, 222, 223, - 29, 231, 220, 115, 206, 125, 35, 29, 254, 122, 31, 249, 123, 186, 17, - 11, 196, 103, 28, 123, 230, 30, 137, 92, 217, 227, 222, 207, 83, 246, - 228, 151, 68, 254, 56, 180, 190, 252, 61, 93, 181, 29, 62, 156, 159, - 63, 227, 104, 228, 219, 93, 254, 188, 231, 247, 181, 219, 242, 143, 71, - 118, 218, 125, 90, 254, 54, 183, 223, 23, 14, 206, 175, 157, 249, 78, - 100, 78, 139, 151, 238, 89, 215, 153, 123, 42, 178, 235, 147, 75, 228, - 111, 115, 127, 253, 105, 129, 86, 28, 239, 71, 145, 51, 236, 115, 239, - 89, 247, 16, 226, 146, 226, 186, 107, 181, 110, 91, 210, 98, 206, 11, - 156, 255, 3, 182, 228, 224, 237, 87, 238, 89, 247, 2, 226, 146, 209, - 139, 223, 208, 186, 109, 73, 75, 149, 216, 127, 29, 226, 146, 174, 121, - 63, 222, 179, 110, 108, 222, 79, 145, 51, 252, 85, 242, 247, 116, 23, - 198, 87, 231, 252, 161, 153, 191, 71, 118, 157, 95, 235, 158, 243, 252, - 14, 108, 201, 190, 149, 53, 229, 239, 233, 178, 54, 139, 58, 86, 15, - 182, 164, 203, 206, 123, 215, 125, 104, 246, 165, 72, 221, 222, 58, 242, - 247, 116, 117, 103, 60, 44, 126, 243, 13, 91, 114, 124, 192, 189, 127, - 143, 246, 91, 216, 18, 125, 138, 252, 13, 110, 212, 147, 49, 226, 55, - 181, 55, 180, 170, 168, 254, 17, 13, 239, 251, 61, 157, 254, 90, 3, - 249, 123, 186, 174, 39, 164, 111, 160, 97, 75, 124, 87, 221, 187, 110, - 27, 216, 18, 231, 134, 198, 242, 247, 116, 23, 183, 61, 206, 249, 39, - 96, 75, 206, 239, 187, 247, 61, 153, 27, 176, 37, 27, 95, 106, 227, - 249, 187, 145, 7, 197, 189, 233, 153, 89, 117, 163, 118, 159, 12, 188, - 239, 183, 185, 158, 247, 2, 26, 200, 60, 125, 155, 123, 191, 247, 5, - 228, 184, 164, 183, 199, 150, 44, 233, 208, 217, 69, 251, 31, 183, 45, - 113, 243, 189, 246, 206, 137, 240, 228, 87, 142, 247, 225, 192, 27, 17, - 139, 26, 14, 149, 109, 201, 141, 111, 196, 53, 186, 214, 148, 20, 249, - 122, 192, 189, 159, 55, 54, 134, 45, 241, 236, 207, 119, 202, 207, 159, - 187, 194, 150, 220, 107, 127, 238, 182, 37, 221, 236, 93, 100, 91, 178, - 166, 187, 248, 108, 62, 6, 182, 164, 213, 149, 123, 207, 223, 19, 115, - 95, 141, 108, 241, 240, 19, 178, 45, 177, 159, 21, 127, 127, 249, 218, - 83, 71, 34, 223, 253, 236, 222, 191, 43, 190, 43, 175, 36, 242, 229, - 95, 163, 101, 91, 178, 180, 233, 68, 206, 111, 134, 45, 169, 43, 36, - 222, 179, 110, 45, 196, 37, 246, 243, 41, 242, 183, 185, 250, 254, 233, - 156, 95, 128, 184, 228, 139, 245, 247, 254, 174, 119, 29, 246, 56, 199, - 143, 102, 200, 223, 230, 198, 46, 201, 20, 127, 219, 26, 182, 228, 253, - 241, 89, 247, 172, 219, 28, 182, 164, 217, 71, 118, 249, 219, 220, 129, - 210, 247, 196, 97, 176, 37, 173, 76, 150, 123, 214, 157, 10, 91, 18, - 215, 38, 93, 254, 54, 247, 233, 127, 196, 254, 79, 132, 45, 73, 56, - 166, 191, 103, 93, 1, 113, 73, 217, 208, 39, 101, 91, 114, 121, 252, - 4, 206, 111, 192, 30, 39, 197, 112, 239, 239, 107, 207, 195, 150, 20, - 133, 142, 151, 109, 9, 203, 27, 39, 253, 13, 218, 191, 34, 7, 30, - 29, 123, 159, 239, 122, 47, 69, 126, 49, 203, 243, 109, 174, 35, 114, - 140, 108, 75, 182, 84, 27, 125, 159, 118, 111, 70, 46, 125, 211, 243, - 109, 174, 230, 49, 145, 191, 5, 91, 146, 107, 30, 113, 159, 103, 254, - 234, 40, 123, 140, 231, 219, 220, 126, 71, 60, 223, 230, 214, 241, 191, - 119, 221, 198, 176, 37, 166, 215, 61, 223, 230, 126, 48, 72, 252, 54, - 183, 45, 108, 201, 161, 79, 239, 125, 191, 184, 246, 27, 15, 69, 109, - 174, 235, 249, 54, 247, 234, 104, 209, 6, 92, 131, 45, 201, 250, 178, - 167, 112, 191, 184, 196, 243, 222, 71, 3, 153, 63, 2, 91, 114, 191, - 247, 65, 228, 103, 49, 46, 197, 125, 229, 151, 47, 169, 203, 142, 222, - 239, 30, 153, 231, 111, 98, 22, 236, 189, 164, 246, 127, 229, 63, 220, - 87, 222, 171, 184, 31, 187, 87, 113, 143, 108, 207, 131, 123, 22, 227, - 175, 104, 163, 0, 125, 42, 144, 218, 137, 216, 243, 224, 158, 197, 16, - 174, 60, 14, 240, 238, 177, 148, 238, 126, 112, 207, 98, 252, 95, 185, - 227, 190, 178, 52, 191, 241, 187, 31, 220, 179, 24, 154, 247, 7, 249, - 252, 50, 98, 207, 131, 125, 126, 73, 243, 249, 32, 159, 95, 198, 239, - 126, 176, 207, 47, 105, 157, 200, 239, 201, 236, 184, 164, 142, 119, 221, - 111, 205, 120, 254, 38, 102, 60, 173, 177, 93, 255, 225, 190, 242, 203, - 138, 251, 177, 47, 41, 222, 147, 217, 245, 0, 223, 147, 121, 73, 113, - 95, 25, 60, 181, 201, 11, 237, 122, 128, 239, 201, 40, 218, 160, 113, - 187, 199, 178, 124, 231, 3, 124, 79, 102, 215, 29, 247, 149, 165, 54, - 252, 119, 62, 192, 247, 100, 118, 61, 216, 231, 151, 108, 215, 131, 125, - 126, 73, 243, 249, 32, 159, 95, 250, 239, 124, 176, 207, 47, 105, 157, - 200, 207, 98, 182, 66, 15, 94, 190, 207, 154, 81, 252, 77, 76, 127, - 212, 45, 216, 246, 31, 222, 147, 217, 161, 240, 1, 219, 21, 239, 201, - 108, 171, 218, 154, 169, 187, 245, 5, 143, 15, 216, 174, 240, 1, 224, - 169, 77, 30, 77, 190, 88, 181, 53, 115, 230, 141, 30, 30, 95, 166, - 104, 131, 198, 237, 30, 75, 244, 139, 85, 91, 51, 175, 124, 50, 212, - 243, 158, 204, 182, 59, 222, 147, 145, 218, 40, 219, 90, 181, 53, 115, - 179, 105, 19, 207, 123, 50, 219, 238, 254, 173, 42, 205, 169, 155, 191, - 91, 59, 21, 222, 147, 121, 241, 238, 120, 52, 127, 255, 43, 94, 244, - 61, 240, 104, 174, 254, 87, 60, 154, 187, 187, 225, 209, 188, 252, 87, - 60, 57, 54, 219, 170, 136, 205, 54, 65, 15, 118, 220, 111, 205, 40, - 254, 38, 230, 11, 208, 205, 231, 254, 195, 123, 50, 47, 40, 124, 192, - 11, 138, 216, 108, 203, 3, 124, 79, 70, 209, 70, 1, 250, 84, 38, - 181, 19, 177, 229, 1, 198, 102, 207, 41, 214, 37, 120, 247, 88, 74, - 55, 63, 192, 216, 236, 185, 59, 98, 51, 105, 126, 227, 55, 63, 192, - 216, 108, 203, 131, 245, 51, 17, 91, 30, 172, 159, 161, 249, 124, 144, - 126, 38, 126, 243, 131, 245, 51, 180, 78, 228, 216, 108, 61, 244, 96, - 235, 253, 214, 140, 226, 29, 102, 212, 45, 219, 240, 31, 98, 179, 77, - 138, 152, 102, 163, 34, 54, 219, 240, 0, 99, 179, 141, 138, 117, 9, - 158, 218, 228, 133, 54, 60, 192, 216, 76, 209, 6, 141, 219, 61, 150, - 229, 207, 62, 192, 216, 108, 195, 29, 177, 153, 212, 134, 255, 179, 15, - 48, 54, 219, 240, 96, 247, 51, 108, 195, 131, 221, 207, 208, 124, 62, - 200, 253, 140, 255, 179, 15, 118, 63, 67, 235, 68, 254, 59, 178, 107, - 160, 7, 155, 148, 107, 102, 100, 194, 96, 139, 89, 252, 163, 66, 229, - 48, 164, 184, 1, 117, 253, 215, 93, 82, 135, 132, 236, 136, 60, 245, - 94, 97, 228, 160, 200, 22, 111, 164, 188, 59, 61, 114, 100, 212, 29, - 177, 217, 122, 133, 15, 88, 167, 240, 51, 107, 43, 211, 131, 157, 145, - 116, 95, 16, 227, 137, 8, 9, 153, 19, 49, 50, 170, 206, 93, 245, - 128, 202, 200, 62, 96, 157, 194, 7, 128, 167, 54, 185, 159, 249, 79, - 109, 212, 253, 79, 109, 248, 175, 187, 195, 7, 72, 99, 41, 93, 243, - 95, 218, 120, 248, 190, 109, 132, 73, 115, 82, 121, 28, 177, 147, 99, - 121, 120, 69, 237, 218, 140, 245, 97, 3, 65, 189, 42, 238, 207, 31, - 48, 30, 141, 245, 65, 224, 201, 127, 19, 110, 141, 226, 239, 91, 173, - 70, 156, 179, 190, 50, 253, 235, 86, 169, 254, 185, 255, 59, 245, 94, - 154, 235, 212, 123, 173, 162, 94, 25, 168, 115, 92, 238, 176, 73, 112, - 235, 159, 252, 247, 128, 86, 43, 222, 57, 94, 117, 73, 29, 189, 166, - 178, 54, 186, 87, 218, 70, 52, 234, 18, 133, 132, 108, 140, 76, 74, - 122, 44, 106, 214, 230, 199, 93, 205, 110, 132, 71, 220, 169, 227, 84, - 166, 99, 37, 125, 43, 88, 117, 55, 221, 104, 16, 21, 255, 252, 77, - 103, 244, 19, 45, 129, 165, 230, 143, 56, 169, 238, 157, 127, 168, 128, - 174, 83, 27, 217, 18, 86, 91, 94, 146, 177, 17, 193, 214, 72, 186, - 230, 198, 115, 243, 61, 90, 149, 42, 242, 105, 238, 77, 152, 247, 116, - 118, 4, 36, 63, 239, 249, 250, 118, 36, 181, 237, 190, 119, 232, 230, - 211, 108, 157, 162, 60, 249, 140, 141, 81, 53, 97, 31, 131, 242, 107, - 215, 171, 248, 247, 167, 87, 41, 126, 7, 131, 93, 86, 211, 28, 87, - 156, 211, 30, 149, 206, 105, 193, 74, 200, 121, 197, 37, 245, 245, 219, - 125, 143, 222, 186, 221, 176, 111, 243, 211, 239, 149, 140, 57, 181, 88, - 184, 115, 78, 169, 156, 188, 166, 87, 42, 236, 198, 242, 138, 115, 26, - 15, 251, 167, 102, 239, 68, 141, 238, 189, 108, 63, 217, 194, 145, 81, - 143, 242, 217, 84, 87, 50, 167, 116, 93, 94, 211, 138, 54, 168, 79, - 5, 82, 59, 5, 145, 151, 43, 180, 113, 245, 229, 233, 111, 196, 140, - 173, 222, 247, 135, 207, 91, 29, 178, 241, 54, 26, 210, 253, 226, 74, - 219, 232, 168, 90, 32, 255, 22, 18, 225, 150, 219, 111, 73, 109, 228, - 71, 84, 108, 35, 122, 172, 234, 232, 164, 177, 103, 163, 14, 127, 192, - 14, 69, 241, 54, 26, 221, 181, 141, 175, 46, 205, 231, 109, 28, 148, - 230, 164, 173, 84, 38, 111, 253, 51, 111, 184, 247, 26, 241, 252, 44, - 242, 154, 77, 115, 35, 149, 123, 144, 41, 208, 137, 197, 160, 253, 10, - 221, 152, 184, 167, 78, 212, 168, 222, 203, 130, 121, 121, 54, 44, 202, - 93, 118, 92, 199, 167, 165, 185, 149, 246, 24, 172, 9, 243, 133, 110, - 116, 1, 185, 117, 67, 243, 249, 75, 81, 110, 124, 146, 133, 155, 111, - 253, 243, 159, 81, 202, 118, 39, 169, 210, 217, 108, 208, 94, 85, 122, - 185, 152, 240, 130, 52, 239, 109, 249, 136, 193, 103, 213, 56, 170, 156, - 123, 55, 255, 217, 147, 175, 151, 251, 157, 141, 238, 232, 75, 2, 104, - 33, 243, 244, 165, 113, 245, 181, 145, 54, 169, 205, 234, 227, 106, 202, - 237, 23, 239, 24, 24, 245, 216, 109, 207, 179, 177, 67, 24, 251, 55, - 32, 31, 69, 95, 78, 61, 181, 48, 42, 229, 211, 86, 61, 249, 202, - 122, 105, 167, 60, 7, 55, 79, 191, 21, 69, 178, 119, 167, 131, 49, - 246, 88, 80, 158, 98, 14, 118, 205, 249, 67, 110, 139, 116, 197, 205, - 27, 78, 54, 238, 171, 156, 131, 61, 104, 239, 99, 80, 126, 237, 205, - 154, 59, 231, 128, 244, 194, 61, 7, 43, 90, 14, 61, 234, 174, 71, - 186, 225, 230, 183, 213, 157, 247, 134, 18, 47, 191, 118, 38, 95, 231, - 241, 10, 89, 142, 204, 175, 22, 65, 122, 196, 159, 251, 140, 93, 34, - 219, 228, 141, 55, 124, 162, 122, 189, 207, 122, 186, 211, 75, 49, 111, - 175, 130, 190, 84, 204, 95, 113, 108, 116, 212, 12, 105, 158, 198, 142, - 157, 47, 143, 233, 229, 220, 237, 81, 81, 138, 118, 107, 98, 12, 129, - 160, 113, 138, 249, 155, 216, 245, 61, 121, 206, 72, 151, 221, 188, 179, - 89, 141, 190, 74, 185, 205, 197, 188, 189, 12, 250, 76, 49, 127, 242, - 111, 134, 192, 166, 200, 126, 225, 201, 203, 106, 255, 85, 149, 217, 151, - 94, 229, 214, 131, 143, 219, 190, 196, 93, 86, 23, 76, 185, 124, 223, - 184, 132, 202, 201, 246, 37, 206, 179, 22, 3, 167, 92, 126, 96, 113, - 137, 191, 162, 13, 234, 83, 129, 212, 142, 107, 242, 229, 7, 22, 151, - 16, 110, 57, 251, 34, 181, 17, 253, 159, 218, 248, 111, 113, 9, 205, - 137, 55, 126, 191, 51, 187, 8, 218, 87, 241, 126, 206, 228, 7, 139, - 23, 253, 128, 240, 228, 152, 225, 73, 143, 254, 21, 78, 188, 172, 38, - 125, 172, 168, 127, 189, 43, 245, 111, 101, 147, 46, 171, 137, 244, 97, - 31, 189, 81, 248, 193, 180, 190, 47, 233, 222, 61, 90, 250, 217, 236, - 10, 49, 3, 149, 169, 44, 102, 8, 156, 84, 153, 220, 104, 205, 13, - 193, 250, 241, 59, 70, 169, 145, 81, 53, 165, 152, 65, 197, 42, 123, - 129, 218, 29, 51, 16, 150, 59, 102, 248, 117, 220, 202, 163, 31, 60, - 19, 19, 117, 231, 189, 168, 231, 179, 114, 163, 108, 150, 144, 163, 158, - 121, 121, 218, 167, 11, 203, 128, 37, 25, 236, 121, 206, 153, 80, 171, - 239, 91, 3, 79, 72, 101, 60, 253, 56, 242, 232, 162, 190, 127, 183, - 234, 127, 204, 93, 183, 136, 61, 130, 250, 77, 84, 249, 181, 59, 87, - 152, 83, 154, 71, 63, 197, 120, 105, 142, 43, 204, 41, 253, 48, 99, - 37, 115, 26, 136, 186, 68, 73, 73, 117, 223, 56, 245, 222, 151, 81, - 115, 92, 239, 148, 204, 113, 109, 168, 16, 51, 80, 153, 202, 230, 52, - 127, 194, 221, 230, 244, 100, 212, 67, 159, 182, 14, 19, 99, 134, 58, - 119, 141, 195, 168, 140, 123, 78, 9, 203, 61, 167, 71, 91, 212, 61, - 42, 214, 23, 241, 220, 124, 151, 162, 91, 145, 158, 124, 81, 215, 218, - 195, 190, 154, 21, 54, 182, 251, 168, 69, 10, 191, 120, 82, 230, 47, - 204, 175, 81, 206, 87, 156, 96, 70, 86, 71, 101, 228, 24, 110, 121, - 140, 31, 201, 216, 57, 194, 29, 119, 89, 221, 179, 82, 189, 103, 108, - 252, 200, 241, 102, 107, 154, 190, 66, 254, 125, 55, 223, 149, 206, 147, - 39, 142, 112, 231, 157, 122, 175, 105, 228, 255, 0, 34, 173, 65, 75, - 36, 123, 0, 255, 197, 196, 50, 70, 35, 43, 139, 189, 172, 126, 212, - 189, 127, 77, 43, 47, 227, 152, 88, 147, 33, 219, 46, 221, 247, 177, - 228, 192, 9, 103, 219, 69, 157, 242, 151, 203, 104, 164, 186, 129, 152, - 199, 210, 81, 240, 51, 163, 69, 162, 200, 142, 168, 195, 143, 122, 223, - 219, 248, 207, 237, 92, 72, 7, 26, 72, 229, 27, 184, 239, 159, 140, - 21, 219, 181, 160, 126, 23, 156, 237, 125, 205, 38, 119, 57, 186, 230, - 46, 183, 28, 60, 213, 243, 71, 185, 230, 20, 111, 27, 172, 93, 221, - 229, 150, 43, 202, 69, 128, 167, 122, 5, 177, 146, 175, 200, 191, 170, - 118, 151, 139, 80, 148, 187, 16, 115, 89, 77, 245, 10, 163, 47, 171, - 123, 73, 114, 117, 151, 163, 107, 238, 114, 5, 224, 169, 158, 37, 90, - 196, 43, 240, 187, 46, 227, 21, 40, 202, 69, 131, 167, 122, 133, 102, - 248, 78, 242, 237, 58, 15, 94, 180, 162, 28, 3, 79, 245, 162, 205, - 226, 90, 75, 31, 144, 102, 118, 151, 99, 138, 114, 133, 99, 80, 6, - 233, 50, 211, 101, 181, 192, 241, 18, 237, 238, 114, 116, 205, 93, 46, - 30, 60, 213, 179, 160, 92, 232, 29, 227, 136, 87, 148, 243, 3, 79, - 245, 2, 165, 113, 216, 141, 153, 6, 119, 57, 63, 69, 57, 23, 228, - 71, 245, 252, 129, 71, 119, 145, 202, 246, 223, 144, 199, 75, 215, 220, - 229, 44, 224, 169, 158, 43, 93, 92, 207, 86, 131, 65, 150, 155, 69, - 81, 142, 244, 129, 234, 229, 167, 139, 237, 234, 236, 102, 171, 187, 156, - 191, 162, 28, 233, 15, 213, 11, 76, 23, 245, 39, 3, 5, 221, 229, - 232, 90, 3, 165, 143, 70, 185, 11, 146, 190, 54, 104, 249, 23, 239, - 95, 160, 164, 67, 110, 187, 151, 104, 54, 217, 173, 230, 52, 168, 137, - 127, 184, 255, 64, 93, 186, 97, 152, 57, 217, 152, 216, 53, 217, 96, - 239, 155, 97, 181, 26, 76, 164, 103, 82, 129, 14, 29, 217, 53, 142, - 65, 154, 237, 175, 192, 48, 39, 76, 53, 36, 218, 81, 223, 3, 70, - 0, 35, 179, 76, 188, 18, 159, 103, 30, 107, 199, 122, 234, 176, 70, - 183, 60, 191, 211, 27, 237, 201, 55, 38, 249, 119, 48, 153, 237, 254, - 34, 102, 87, 163, 62, 205, 96, 55, 166, 27, 252, 195, 252, 3, 59, - 250, 235, 76, 122, 255, 14, 21, 175, 116, 15, 236, 216, 135, 5, 121, - 218, 177, 40, 240, 152, 164, 135, 180, 187, 39, 157, 115, 231, 183, 174, - 153, 102, 48, 37, 219, 83, 208, 107, 163, 201, 222, 161, 220, 200, 71, - 163, 29, 51, 41, 156, 206, 222, 161, 163, 127, 128, 127, 183, 238, 29, - 253, 59, 249, 119, 231, 248, 157, 73, 79, 21, 56, 164, 111, 36, 3, - 235, 48, 163, 173, 226, 20, 68, 74, 23, 109, 52, 13, 188, 62, 25, - 40, 210, 213, 10, 245, 255, 75, 71, 208, 229, 14, 202, 246, 58, 118, - 100, 242, 61, 74, 37, 166, 7, 68, 167, 215, 147, 109, 202, 52, 184, - 123, 82, 174, 126, 87, 139, 217, 34, 103, 116, 236, 236, 31, 212, 81, - 158, 195, 64, 229, 28, 214, 172, 57, 144, 242, 233, 142, 172, 191, 178, - 157, 36, 116, 27, 213, 209, 113, 127, 37, 108, 31, 198, 124, 169, 124, - 7, 90, 11, 233, 138, 242, 247, 235, 88, 103, 8, 153, 121, 228, 152, - 175, 168, 203, 126, 183, 112, 204, 198, 212, 55, 37, 230, 157, 234, 16, - 238, 223, 165, 107, 47, 15, 134, 91, 255, 57, 6, 214, 158, 219, 166, - 147, 29, 127, 84, 25, 79, 197, 122, 236, 122, 76, 172, 197, 106, 78, - 182, 26, 108, 54, 110, 209, 249, 127, 134, 236, 202, 109, 58, 3, 78, - 160, 17, 235, 86, 34, 249, 94, 193, 175, 149, 219, 116, 42, 47, 219, - 174, 84, 177, 124, 105, 138, 104, 211, 7, 140, 238, 223, 95, 182, 93, - 169, 10, 219, 69, 229, 80, 207, 130, 114, 237, 72, 119, 109, 25, 9, - 178, 237, 82, 148, 243, 3, 79, 245, 2, 83, 68, 92, 37, 158, 159, - 162, 156, 107, 42, 108, 23, 210, 101, 201, 151, 213, 244, 180, 160, 215, - 142, 243, 30, 219, 53, 85, 97, 187, 192, 83, 189, 124, 148, 107, 195, - 202, 143, 195, 162, 40, 231, 15, 158, 234, 249, 163, 92, 39, 242, 51, - 71, 254, 146, 241, 252, 21, 229, 74, 49, 63, 84, 207, 149, 116, 89, - 221, 146, 48, 166, 37, 200, 120, 116, 205, 93, 142, 230, 145, 234, 69, - 160, 92, 228, 29, 237, 230, 43, 202, 209, 188, 83, 189, 50, 195, 101, - 53, 173, 203, 252, 79, 47, 202, 237, 6, 26, 203, 219, 66, 170, 87, - 96, 16, 231, 197, 208, 145, 245, 119, 219, 194, 210, 20, 111, 109, 161, - 216, 39, 210, 113, 139, 2, 35, 221, 150, 108, 51, 152, 108, 124, 61, - 151, 183, 5, 99, 120, 54, 44, 193, 164, 192, 201, 30, 253, 12, 84, - 212, 101, 9, 105, 6, 247, 58, 35, 217, 40, 108, 162, 12, 219, 213, - 104, 139, 54, 219, 140, 180, 114, 58, 192, 234, 245, 113, 247, 33, 95, - 81, 190, 166, 91, 125, 19, 116, 214, 187, 90, 101, 51, 147, 237, 153, - 191, 178, 174, 209, 98, 86, 152, 164, 187, 154, 51, 26, 4, 213, 39, - 189, 32, 121, 202, 245, 211, 209, 174, 46, 217, 96, 67, 101, 79, 167, - 81, 55, 202, 172, 55, 26, 200, 14, 218, 184, 191, 234, 71, 113, 70, - 82, 229, 125, 238, 234, 230, 129, 97, 200, 212, 165, 117, 112, 99, 78, - 34, 3, 232, 78, 116, 244, 239, 226, 31, 52, 153, 204, 98, 80, 96, - 96, 215, 64, 22, 18, 236, 150, 105, 153, 225, 63, 218, 66, 197, 88, - 185, 241, 243, 23, 49, 184, 175, 50, 40, 237, 223, 64, 93, 228, 104, - 233, 158, 36, 242, 103, 223, 37, 22, 142, 28, 29, 105, 77, 215, 217, - 51, 172, 6, 86, 249, 189, 228, 68, 96, 38, 122, 108, 68, 141, 74, - 246, 83, 231, 84, 98, 185, 167, 42, 105, 163, 44, 30, 58, 236, 139, - 53, 100, 72, 203, 52, 218, 238, 30, 183, 6, 238, 90, 223, 54, 117, - 109, 168, 179, 179, 230, 82, 120, 209, 245, 70, 33, 174, 83, 59, 157, - 29, 213, 159, 134, 127, 119, 107, 110, 136, 191, 34, 214, 174, 62, 192, - 207, 57, 99, 90, 71, 231, 160, 128, 117, 65, 119, 143, 197, 239, 164, - 251, 197, 240, 255, 61, 175, 124, 251, 119, 195, 255, 95, 242, 64, 249, - 141, 118, 172, 90, 180, 112, 135, 152, 213, 104, 7, 255, 182, 123, 119, - 173, 246, 92, 140, 51, 223, 219, 182, 232, 102, 189, 246, 238, 250, 183, - 111, 117, 22, 244, 183, 106, 57, 207, 245, 154, 114, 128, 255, 142, 109, - 241, 123, 197, 11, 206, 230, 57, 247, 77, 29, 200, 31, 70, 129, 231, - 121, 241, 185, 81, 7, 40, 189, 31, 249, 224, 67, 220, 245, 231, 247, - 170, 227, 200, 62, 214, 199, 57, 57, 250, 153, 32, 69, 125, 65, 81, - 223, 73, 121, 58, 94, 135, 49, 202, 215, 113, 44, 177, 254, 219, 153, - 198, 146, 155, 69, 95, 56, 116, 51, 23, 239, 119, 223, 47, 38, 249, - 147, 156, 221, 242, 47, 104, 36, 233, 11, 233, 77, 115, 145, 146, 12, - 233, 25, 86, 254, 219, 207, 149, 75, 225, 169, 179, 173, 28, 134, 195, - 9, 66, 187, 227, 9, 206, 55, 162, 38, 10, 79, 47, 109, 20, 177, - 224, 239, 9, 66, 255, 87, 94, 20, 252, 203, 201, 247, 191, 236, 197, - 60, 148, 117, 37, 79, 200, 91, 63, 35, 44, 119, 216, 150, 208, 58, - 3, 87, 85, 248, 38, 241, 173, 27, 121, 66, 236, 191, 77, 67, 115, - 94, 107, 198, 127, 83, 248, 252, 130, 154, 69, 127, 148, 229, 9, 223, - 110, 255, 151, 239, 81, 47, 125, 218, 60, 108, 124, 206, 191, 197, 53, - 190, 201, 187, 171, 252, 124, 74, 134, 5, 46, 174, 111, 32, 55, 199, - 172, 151, 230, 132, 220, 190, 157, 39, 60, 110, 122, 101, 59, 165, 111, - 172, 183, 108, 63, 189, 108, 117, 59, 119, 223, 173, 243, 253, 156, 147, - 158, 232, 232, 12, 88, 184, 52, 152, 255, 78, 242, 247, 121, 194, 251, - 207, 125, 23, 186, 183, 245, 31, 188, 253, 53, 174, 79, 138, 82, 175, - 229, 9, 91, 34, 196, 191, 91, 58, 229, 244, 31, 97, 117, 235, 13, - 45, 30, 247, 173, 216, 254, 204, 97, 29, 132, 195, 25, 53, 156, 151, - 126, 47, 45, 166, 250, 41, 231, 91, 11, 179, 98, 250, 58, 223, 233, - 126, 144, 63, 119, 157, 25, 211, 87, 72, 78, 107, 46, 68, 119, 22, - 248, 223, 65, 14, 236, 113, 48, 188, 119, 103, 65, 123, 107, 230, 116, - 241, 91, 132, 209, 117, 157, 181, 107, 175, 112, 54, 254, 253, 49, 39, - 127, 231, 72, 219, 90, 248, 167, 67, 63, 33, 76, 250, 221, 215, 87, - 127, 136, 114, 234, 178, 155, 10, 13, 119, 79, 230, 223, 213, 168, 78, - 93, 8, 47, 252, 123, 136, 227, 209, 166, 57, 188, 254, 233, 189, 58, - 109, 205, 164, 63, 181, 36, 35, 165, 252, 73, 198, 119, 174, 127, 210, - 137, 178, 199, 69, 178, 27, 19, 140, 186, 123, 200, 127, 212, 190, 20, - 167, 50, 61, 200, 254, 137, 243, 85, 91, 35, 87, 201, 71, 26, 109, - 96, 21, 228, 95, 107, 82, 158, 80, 20, 147, 20, 246, 89, 221, 209, - 225, 241, 45, 34, 42, 252, 14, 245, 111, 243, 102, 9, 207, 238, 45, - 46, 249, 163, 207, 199, 252, 218, 242, 117, 71, 195, 143, 28, 207, 21, - 26, 143, 119, 240, 249, 127, 248, 227, 247, 195, 223, 92, 93, 189, 36, - 126, 73, 110, 165, 242, 127, 21, 178, 122, 161, 109, 92, 88, 64, 73, - 71, 254, 119, 16, 142, 55, 138, 43, 254, 22, 121, 79, 157, 121, 129, - 235, 90, 241, 199, 1, 161, 191, 133, 108, 57, 82, 44, 221, 51, 182, - 65, 254, 19, 32, 255, 67, 171, 79, 115, 249, 231, 159, 201, 21, 190, - 251, 250, 195, 226, 243, 175, 23, 241, 249, 47, 219, 114, 61, 172, 235, - 220, 60, 97, 93, 196, 68, 222, 159, 212, 85, 135, 75, 166, 59, 245, - 225, 27, 150, 138, 237, 151, 254, 222, 93, 120, 234, 201, 64, 231, 245, - 23, 63, 210, 82, 253, 219, 39, 78, 59, 110, 142, 159, 171, 61, 49, - 35, 142, 95, 247, 141, 157, 235, 200, 251, 217, 230, 188, 101, 111, 205, - 229, 247, 22, 242, 27, 102, 180, 118, 104, 174, 159, 229, 233, 216, 189, - 7, 157, 135, 178, 7, 70, 244, 8, 201, 228, 243, 243, 126, 219, 219, - 142, 47, 141, 67, 29, 1, 181, 196, 191, 27, 86, 54, 37, 91, 91, - 52, 53, 203, 25, 187, 122, 55, 111, 255, 135, 71, 199, 10, 27, 54, - 180, 211, 46, 126, 94, 252, 27, 133, 243, 71, 158, 112, 142, 207, 186, - 40, 60, 252, 204, 158, 114, 242, 39, 25, 87, 176, 255, 208, 9, 87, - 19, 145, 236, 58, 171, 45, 195, 118, 119, 5, 120, 183, 172, 188, 108, - 51, 191, 73, 20, 246, 143, 252, 218, 17, 252, 79, 161, 179, 42, 242, - 127, 228, 201, 92, 225, 211, 14, 223, 133, 31, 249, 243, 163, 226, 78, - 105, 5, 21, 190, 89, 189, 188, 45, 79, 88, 217, 239, 233, 208, 252, - 155, 99, 249, 252, 31, 109, 63, 179, 120, 205, 123, 57, 194, 212, 140, - 56, 62, 95, 151, 59, 13, 47, 89, 127, 45, 206, 113, 58, 59, 167, - 82, 249, 127, 254, 111, 158, 16, 242, 113, 199, 176, 192, 182, 226, 223, - 53, 15, 110, 31, 80, 124, 10, 121, 227, 15, 175, 228, 233, 238, 91, - 150, 134, 78, 237, 190, 58, 244, 208, 45, 81, 254, 118, 200, 255, 73, - 200, 63, 215, 62, 128, 219, 228, 169, 103, 103, 9, 62, 207, 44, 60, - 242, 203, 0, 53, 95, 175, 103, 38, 143, 236, 243, 41, 116, 37, 39, - 189, 6, 175, 111, 30, 168, 214, 142, 59, 194, 66, 71, 160, 28, 165, - 243, 98, 125, 4, 253, 194, 199, 157, 77, 62, 248, 52, 156, 234, 127, - 220, 249, 159, 162, 134, 183, 102, 57, 35, 231, 222, 230, 253, 111, 124, - 107, 150, 208, 107, 75, 81, 241, 184, 173, 255, 114, 249, 69, 35, 127, - 228, 214, 127, 195, 147, 107, 205, 20, 255, 78, 96, 239, 1, 218, 14, - 167, 223, 118, 46, 233, 16, 192, 215, 127, 191, 143, 27, 133, 205, 169, - 155, 43, 188, 215, 238, 95, 94, 127, 234, 159, 89, 206, 233, 77, 247, - 21, 23, 53, 201, 21, 191, 171, 251, 33, 87, 251, 231, 197, 43, 37, - 89, 183, 197, 111, 117, 246, 236, 141, 117, 198, 214, 154, 234, 140, 30, - 188, 180, 156, 252, 73, 198, 21, 214, 255, 227, 158, 184, 33, 221, 96, - 215, 221, 75, 7, 198, 76, 31, 95, 206, 54, 135, 60, 187, 175, 232, - 106, 114, 154, 112, 173, 112, 227, 225, 170, 200, 63, 246, 143, 60, 225, - 192, 183, 142, 176, 159, 230, 158, 61, 242, 244, 250, 205, 21, 254, 246, - 252, 98, 216, 127, 237, 185, 230, 197, 91, 142, 61, 201, 117, 227, 227, - 46, 77, 195, 62, 120, 53, 79, 248, 237, 7, 45, 159, 143, 207, 90, - 79, 47, 218, 229, 212, 150, 164, 30, 174, 220, 254, 175, 2, 126, 135, - 178, 162, 176, 173, 143, 28, 231, 216, 171, 125, 138, 139, 179, 254, 204, - 19, 222, 60, 216, 139, 167, 63, 251, 245, 104, 232, 143, 7, 34, 67, - 151, 42, 228, 63, 25, 242, 143, 121, 242, 5, 46, 127, 225, 209, 153, - 66, 167, 201, 47, 21, 13, 153, 28, 204, 229, 63, 122, 194, 142, 208, - 166, 144, 191, 186, 78, 62, 255, 219, 214, 53, 167, 4, 107, 223, 250, - 119, 93, 175, 230, 13, 69, 249, 189, 122, 235, 71, 237, 135, 73, 205, - 157, 154, 109, 245, 74, 168, 126, 157, 78, 147, 138, 223, 184, 62, 203, - 185, 59, 70, 148, 255, 209, 235, 179, 132, 126, 97, 103, 139, 127, 188, - 122, 141, 203, 255, 125, 228, 159, 186, 122, 45, 252, 237, 250, 98, 253, - 29, 13, 67, 180, 7, 79, 142, 114, 77, 13, 20, 229, 111, 99, 113, - 97, 181, 110, 207, 18, 52, 61, 111, 137, 223, 223, 23, 218, 157, 155, - 126, 113, 21, 31, 243, 21, 191, 213, 28, 56, 113, 173, 54, 171, 221, - 191, 37, 191, 21, 138, 223, 88, 69, 47, 110, 225, 10, 180, 219, 156, - 173, 6, 191, 89, 78, 254, 228, 243, 101, 255, 143, 120, 143, 108, 63, - 249, 255, 252, 71, 69, 74, 203, 72, 71, 148, 124, 119, 233, 149, 212, - 83, 239, 223, 51, 254, 160, 176, 114, 197, 51, 206, 153, 191, 6, 29, - 200, 107, 60, 34, 98, 241, 212, 83, 66, 88, 244, 187, 7, 170, 226, - 255, 87, 118, 158, 42, 124, 25, 215, 36, 120, 193, 184, 25, 129, 127, - 127, 253, 190, 227, 206, 90, 213, 83, 59, 11, 63, 246, 9, 119, 246, - 220, 211, 152, 63, 195, 5, 47, 80, 222, 188, 191, 159, 230, 207, 122, - 89, 146, 99, 95, 243, 109, 43, 247, 223, 43, 126, 171, 138, 255, 175, - 38, 181, 255, 113, 168, 150, 199, 107, 63, 160, 125, 202, 91, 60, 198, - 143, 167, 55, 189, 63, 53, 228, 231, 109, 93, 228, 246, 143, 109, 174, - 237, 124, 111, 167, 221, 241, 89, 255, 65, 60, 239, 37, 75, 77, 33, - 228, 250, 120, 231, 230, 106, 223, 240, 254, 6, 95, 31, 207, 243, 28, - 189, 135, 240, 250, 43, 144, 239, 236, 61, 68, 142, 255, 190, 14, 95, - 237, 252, 66, 55, 207, 153, 241, 115, 79, 158, 183, 188, 199, 76, 33, - 105, 250, 19, 218, 41, 111, 126, 199, 199, 15, 222, 65, 121, 95, 108, - 94, 202, 227, 63, 87, 35, 255, 144, 87, 63, 153, 45, 199, 127, 35, - 62, 255, 72, 27, 109, 202, 21, 126, 202, 157, 93, 46, 254, 35, 25, - 223, 185, 254, 73, 39, 226, 31, 193, 158, 184, 37, 236, 127, 138, 217, - 170, 203, 190, 187, 244, 156, 198, 191, 130, 149, 233, 182, 157, 71, 185, - 242, 190, 31, 37, 36, 58, 84, 221, 170, 178, 254, 247, 27, 115, 133, - 143, 191, 53, 5, 182, 60, 250, 217, 62, 195, 254, 31, 42, 248, 255, - 15, 95, 206, 17, 52, 131, 19, 28, 66, 227, 24, 241, 217, 254, 224, - 4, 45, 229, 253, 213, 104, 60, 223, 95, 92, 41, 154, 184, 223, 47, - 105, 255, 222, 123, 201, 191, 237, 158, 181, 251, 191, 217, 247, 12, 151, - 255, 51, 127, 157, 15, 185, 5, 249, 151, 188, 60, 142, 199, 243, 7, - 223, 89, 221, 62, 99, 211, 79, 219, 220, 245, 237, 119, 200, 127, 215, - 158, 27, 218, 144, 29, 83, 156, 95, 204, 24, 207, 229, 21, 188, 99, - 138, 176, 3, 121, 143, 221, 28, 198, 211, 175, 69, 47, 13, 105, 156, - 191, 91, 150, 127, 55, 253, 81, 231, 130, 103, 91, 151, 172, 47, 88, - 201, 235, 151, 212, 10, 116, 62, 246, 85, 111, 103, 151, 199, 167, 112, - 121, 53, 249, 170, 55, 207, 251, 163, 145, 147, 203, 179, 3, 242, 47, - 53, 114, 6, 187, 235, 127, 174, 95, 234, 234, 49, 244, 185, 240, 131, - 97, 237, 185, 252, 23, 45, 92, 163, 93, 112, 198, 46, 212, 206, 154, - 44, 198, 255, 103, 236, 78, 202, 91, 59, 253, 77, 158, 238, 188, 114, - 99, 200, 191, 131, 183, 202, 242, 63, 211, 178, 129, 163, 125, 215, 121, - 17, 227, 132, 241, 221, 148, 242, 39, 57, 187, 229, 239, 234, 40, 218, - 125, 210, 137, 136, 122, 34, 233, 236, 105, 186, 123, 108, 255, 216, 83, - 155, 26, 29, 80, 166, 187, 12, 91, 44, 52, 125, 183, 179, 179, 253, - 137, 54, 251, 171, 34, 255, 146, 183, 146, 133, 192, 234, 170, 160, 245, - 151, 158, 219, 31, 158, 80, 241, 239, 101, 183, 63, 216, 90, 136, 252, - 176, 159, 144, 180, 187, 17, 31, 47, 120, 103, 7, 228, 229, 71, 140, - 229, 243, 103, 186, 94, 243, 64, 89, 141, 109, 247, 92, 255, 243, 158, - 154, 127, 32, 105, 72, 14, 223, 175, 253, 118, 244, 26, 151, 255, 180, - 35, 121, 92, 254, 143, 143, 89, 214, 254, 177, 160, 239, 183, 187, 235, - 103, 72, 246, 223, 45, 255, 224, 171, 51, 132, 53, 55, 187, 57, 222, - 188, 50, 128, 183, 183, 238, 102, 55, 109, 8, 242, 22, 22, 205, 221, - 71, 233, 15, 150, 143, 12, 62, 19, 122, 49, 80, 126, 111, 229, 208, - 111, 194, 194, 183, 163, 35, 150, 111, 28, 192, 231, 191, 218, 202, 233, - 194, 198, 183, 70, 57, 90, 14, 12, 226, 250, 10, 94, 75, 121, 125, - 30, 58, 195, 241, 26, 15, 8, 10, 138, 124, 232, 140, 44, 255, 190, - 79, 190, 24, 177, 167, 186, 143, 235, 250, 121, 235, 65, 254, 27, 103, - 63, 229, 9, 199, 159, 253, 61, 108, 105, 245, 54, 188, 252, 158, 103, - 127, 47, 110, 129, 188, 203, 23, 222, 230, 235, 97, 196, 188, 39, 130, - 243, 102, 191, 37, 143, 63, 108, 246, 120, 87, 183, 221, 219, 34, 102, - 173, 168, 209, 93, 41, 127, 146, 241, 157, 235, 159, 116, 130, 117, 133, - 47, 232, 116, 89, 157, 104, 213, 153, 140, 25, 233, 119, 149, 222, 199, - 95, 110, 47, 183, 254, 87, 92, 171, 235, 154, 122, 161, 141, 163, 81, - 204, 233, 144, 160, 42, 200, 191, 65, 96, 174, 240, 237, 41, 159, 32, - 117, 215, 87, 246, 173, 139, 248, 187, 194, 250, 255, 225, 68, 182, 112, - 124, 254, 52, 199, 240, 135, 219, 242, 246, 193, 107, 41, 111, 83, 248, - 30, 222, 108, 234, 39, 221, 246, 63, 123, 173, 219, 190, 123, 201, 255, - 236, 69, 159, 131, 61, 95, 81, 117, 224, 254, 243, 171, 91, 92, 254, - 57, 230, 28, 46, 255, 14, 215, 78, 181, 27, 21, 249, 240, 54, 165, - 252, 167, 64, 254, 237, 37, 249, 251, 6, 78, 21, 6, 190, 255, 190, - 99, 97, 193, 87, 124, 254, 7, 191, 255, 190, 182, 6, 242, 22, 12, - 136, 230, 233, 254, 63, 254, 29, 60, 224, 157, 126, 178, 252, 141, 49, - 105, 194, 213, 205, 190, 17, 99, 206, 104, 184, 252, 227, 119, 46, 118, - 76, 109, 151, 233, 28, 58, 74, 199, 245, 23, 188, 160, 67, 222, 47, - 255, 116, 228, 235, 169, 43, 242, 235, 95, 234, 40, 219, 255, 228, 220, - 116, 215, 75, 189, 55, 185, 244, 225, 111, 242, 188, 63, 38, 212, 214, - 62, 181, 102, 150, 176, 117, 233, 112, 94, 31, 188, 243, 119, 228, 77, - 12, 88, 193, 211, 19, 95, 125, 42, 228, 81, 163, 77, 94, 255, 221, - 191, 153, 224, 250, 233, 179, 247, 35, 234, 236, 243, 43, 39, 127, 146, - 179, 91, 254, 36, 111, 254, 96, 179, 158, 39, 254, 51, 232, 238, 181, - 251, 135, 93, 58, 107, 117, 142, 239, 151, 42, 248, 133, 62, 234, 26, - 54, 113, 154, 246, 242, 51, 231, 132, 13, 213, 159, 117, 77, 157, 60, - 188, 74, 251, 127, 253, 190, 9, 130, 163, 251, 92, 173, 235, 72, 92, - 88, 239, 173, 191, 87, 88, 255, 29, 227, 27, 8, 45, 198, 14, 22, - 222, 95, 57, 145, 95, 59, 126, 184, 191, 179, 120, 23, 98, 172, 168, - 95, 120, 122, 90, 189, 167, 181, 95, 78, 251, 194, 113, 250, 216, 228, - 74, 229, 79, 190, 222, 241, 250, 207, 7, 146, 230, 95, 228, 235, 191, - 52, 183, 54, 151, 255, 63, 239, 214, 221, 201, 159, 81, 175, 63, 187, - 61, 186, 197, 107, 173, 220, 125, 207, 148, 226, 255, 118, 146, 252, 135, - 180, 15, 22, 186, 133, 191, 167, 205, 252, 70, 252, 221, 133, 191, 67, - 46, 58, 182, 172, 209, 9, 218, 113, 173, 74, 196, 87, 163, 31, 114, - 198, 254, 246, 148, 35, 189, 241, 112, 209, 254, 206, 243, 143, 232, 209, - 184, 44, 98, 212, 154, 212, 8, 170, 191, 239, 100, 83, 225, 208, 250, - 65, 194, 178, 154, 103, 120, 249, 215, 215, 15, 114, 30, 89, 241, 168, - 16, 17, 23, 203, 99, 157, 213, 200, 143, 140, 139, 213, 214, 122, 59, - 155, 215, 95, 180, 241, 104, 68, 151, 209, 93, 35, 6, 60, 218, 219, - 65, 245, 59, 52, 157, 40, 156, 248, 250, 140, 227, 131, 1, 5, 124, - 188, 113, 253, 90, 104, 95, 105, 52, 64, 40, 12, 18, 255, 22, 251, - 200, 75, 183, 29, 115, 254, 248, 203, 177, 126, 134, 248, 219, 38, 193, - 215, 135, 186, 218, 174, 58, 27, 97, 131, 140, 202, 237, 255, 58, 221, - 177, 254, 187, 138, 118, 95, 41, 127, 254, 117, 193, 93, 164, 183, 240, - 172, 85, 24, 35, 201, 191, 197, 196, 105, 142, 127, 32, 255, 141, 144, - 127, 167, 201, 195, 157, 85, 145, 255, 218, 135, 210, 132, 86, 101, 103, - 74, 142, 95, 111, 81, 210, 240, 72, 73, 5, 249, 255, 242, 91, 47, - 97, 110, 141, 32, 129, 125, 83, 196, 227, 245, 1, 103, 58, 59, 111, - 213, 237, 38, 108, 62, 150, 200, 231, 175, 40, 190, 137, 35, 121, 70, - 7, 109, 208, 154, 156, 255, 23, 249, 159, 242, 77, 17, 54, 140, 217, - 168, 93, 182, 120, 45, 111, 239, 235, 126, 91, 29, 251, 158, 183, 10, - 134, 79, 183, 243, 254, 204, 254, 105, 137, 118, 222, 140, 183, 195, 47, - 238, 17, 127, 239, 224, 243, 118, 195, 35, 142, 245, 63, 17, 241, 221, - 236, 175, 156, 110, 249, 67, 230, 66, 147, 154, 103, 194, 221, 242, 119, - 66, 254, 117, 33, 115, 73, 254, 225, 127, 79, 137, 117, 60, 44, 201, - 127, 161, 36, 255, 160, 6, 189, 185, 252, 108, 51, 199, 10, 223, 159, - 171, 229, 156, 230, 183, 137, 235, 143, 61, 242, 79, 237, 207, 67, 250, - 11, 195, 126, 252, 134, 247, 231, 237, 159, 214, 105, 83, 15, 239, 208, - 134, 189, 40, 254, 29, 245, 16, 73, 254, 87, 39, 76, 115, 148, 219, - 255, 117, 244, 200, 159, 226, 61, 178, 253, 228, 255, 11, 218, 139, 148, - 146, 145, 110, 176, 222, 227, 6, 192, 243, 75, 155, 105, 219, 212, 140, - 208, 126, 54, 251, 140, 227, 215, 69, 42, 33, 254, 212, 10, 103, 173, - 183, 222, 114, 54, 94, 212, 176, 74, 235, 255, 221, 14, 121, 194, 163, - 143, 116, 9, 63, 243, 73, 215, 146, 250, 182, 41, 21, 190, 77, 216, - 176, 116, 150, 240, 121, 204, 153, 240, 86, 187, 14, 241, 107, 67, 30, - 255, 169, 36, 113, 213, 44, 225, 140, 90, 252, 61, 180, 181, 95, 189, - 88, 50, 142, 189, 86, 210, 185, 125, 238, 255, 139, 255, 31, 16, 215, - 64, 88, 116, 100, 164, 51, 237, 134, 248, 183, 129, 198, 78, 142, 22, - 206, 235, 235, 11, 62, 215, 63, 228, 242, 184, 181, 189, 77, 248, 57, - 223, 43, 225, 109, 206, 137, 251, 127, 219, 95, 249, 206, 122, 199, 223, - 10, 79, 109, 92, 139, 183, 93, 237, 246, 59, 37, 127, 233, 115, 5, - 237, 195, 49, 188, 252, 69, 125, 174, 115, 217, 205, 15, 74, 86, 188, - 46, 240, 180, 6, 249, 167, 95, 23, 194, 159, 136, 23, 247, 159, 253, - 78, 36, 8, 231, 114, 95, 142, 24, 155, 213, 131, 235, 79, 205, 97, - 83, 156, 218, 171, 55, 28, 219, 236, 226, 223, 169, 9, 155, 119, 83, - 251, 240, 231, 147, 156, 53, 14, 85, 231, 250, 99, 76, 249, 169, 248, - 213, 143, 30, 210, 86, 91, 40, 182, 255, 246, 164, 62, 174, 134, 121, - 59, 34, 46, 44, 82, 149, 223, 255, 181, 175, 232, 255, 73, 39, 242, - 219, 138, 36, 255, 233, 191, 187, 72, 239, 155, 243, 189, 202, 173, 205, - 167, 223, 93, 34, 124, 121, 125, 155, 243, 165, 182, 230, 226, 170, 196, - 127, 113, 65, 86, 225, 151, 220, 212, 18, 77, 233, 185, 34, 207, 223, - 22, 245, 252, 231, 251, 207, 80, 33, 118, 211, 99, 194, 174, 176, 98, - 126, 255, 53, 237, 137, 199, 156, 155, 6, 15, 17, 190, 233, 243, 43, - 159, 191, 153, 173, 71, 148, 252, 56, 233, 147, 240, 31, 6, 86, 46, - 255, 193, 123, 243, 132, 179, 154, 161, 37, 87, 122, 55, 224, 247, 15, - 14, 223, 28, 18, 30, 134, 188, 165, 19, 58, 243, 116, 155, 181, 77, - 139, 122, 191, 211, 166, 104, 243, 237, 242, 247, 127, 154, 117, 152, 207, - 253, 239, 129, 134, 25, 194, 128, 177, 171, 28, 131, 227, 223, 227, 247, - 27, 99, 102, 172, 210, 14, 251, 118, 154, 112, 234, 84, 11, 190, 254, - 222, 61, 249, 74, 216, 141, 9, 254, 218, 196, 147, 226, 254, 125, 123, - 181, 233, 66, 204, 107, 197, 130, 240, 227, 215, 124, 253, 38, 159, 172, - 227, 220, 120, 114, 148, 243, 234, 149, 134, 188, 60, 120, 161, 245, 228, - 122, 206, 129, 97, 226, 119, 61, 223, 35, 127, 107, 216, 115, 37, 145, - 169, 98, 253, 239, 198, 244, 116, 125, 58, 236, 33, 215, 187, 87, 215, - 115, 249, 191, 17, 186, 222, 145, 219, 216, 40, 12, 104, 184, 138, 215, - 95, 222, 218, 230, 60, 214, 181, 192, 241, 237, 141, 218, 124, 62, 158, - 110, 118, 178, 164, 87, 226, 34, 237, 185, 96, 241, 254, 207, 224, 143, - 213, 174, 55, 246, 154, 34, 134, 44, 13, 43, 39, 127, 146, 113, 133, - 253, 31, 116, 34, 190, 181, 72, 137, 58, 171, 229, 94, 247, 255, 22, - 213, 74, 40, 247, 55, 253, 74, 130, 190, 42, 73, 77, 154, 44, 236, - 122, 101, 93, 81, 85, 228, 159, 154, 169, 19, 90, 255, 88, 219, 113, - 99, 196, 172, 146, 53, 223, 253, 84, 65, 254, 53, 62, 110, 40, 124, - 87, 58, 66, 248, 108, 158, 153, 183, 63, 250, 177, 1, 206, 26, 141, - 31, 22, 22, 205, 93, 207, 231, 163, 186, 159, 201, 177, 125, 184, 160, - 77, 157, 96, 175, 84, 254, 191, 221, 202, 19, 78, 207, 254, 179, 79, - 235, 81, 7, 185, 188, 63, 252, 229, 183, 35, 203, 144, 247, 221, 199, - 165, 220, 126, 63, 180, 239, 96, 209, 149, 167, 74, 67, 247, 222, 204, - 147, 215, 63, 237, 255, 38, 249, 110, 230, 235, 127, 238, 182, 1, 194, - 236, 204, 150, 194, 249, 159, 235, 115, 249, 191, 100, 110, 233, 28, 191, - 115, 128, 240, 183, 185, 63, 239, 207, 67, 243, 76, 197, 135, 250, 90, - 67, 55, 95, 117, 235, 207, 54, 237, 249, 157, 199, 34, 86, 175, 45, - 224, 242, 143, 107, 216, 222, 153, 51, 83, 235, 60, 236, 91, 159, 247, - 55, 123, 166, 86, 56, 29, 22, 224, 236, 149, 43, 254, 190, 228, 243, - 200, 223, 156, 59, 167, 100, 249, 231, 162, 252, 173, 51, 198, 186, 182, - 47, 156, 226, 186, 249, 236, 26, 46, 255, 157, 218, 28, 167, 16, 220, - 81, 251, 72, 96, 75, 94, 127, 199, 55, 254, 142, 219, 35, 102, 58, - 7, 21, 229, 115, 253, 223, 157, 215, 209, 241, 176, 238, 209, 18, 215, - 80, 177, 254, 197, 188, 169, 174, 105, 11, 135, 69, 216, 222, 235, 85, - 78, 254, 36, 227, 59, 229, 79, 58, 161, 188, 255, 119, 47, 29, 48, - 15, 105, 85, 46, 54, 111, 38, 172, 211, 94, 57, 244, 169, 54, 243, - 183, 86, 225, 85, 145, 255, 208, 244, 56, 97, 254, 38, 75, 201, 198, - 73, 133, 197, 197, 223, 92, 169, 32, 255, 236, 99, 190, 194, 134, 235, - 177, 194, 210, 199, 182, 240, 249, 110, 180, 119, 188, 243, 92, 104, 117, - 97, 254, 222, 27, 188, 63, 71, 166, 189, 81, 178, 121, 196, 142, 240, - 75, 183, 102, 85, 42, 255, 244, 75, 121, 194, 51, 126, 179, 194, 14, - 165, 54, 228, 242, 27, 53, 104, 102, 241, 232, 43, 121, 66, 219, 218, - 187, 185, 252, 183, 30, 105, 84, 252, 100, 226, 142, 208, 241, 55, 242, - 100, 255, 79, 242, 79, 110, 178, 147, 203, 127, 195, 19, 213, 29, 147, - 215, 205, 18, 84, 133, 226, 239, 252, 249, 174, 152, 229, 212, 135, 251, - 56, 246, 86, 143, 226, 237, 255, 58, 170, 83, 73, 220, 170, 222, 37, - 131, 231, 136, 245, 55, 60, 182, 209, 53, 242, 179, 235, 17, 93, 234, - 254, 197, 229, 223, 102, 255, 215, 37, 175, 255, 51, 203, 121, 113, 222, - 92, 94, 254, 240, 63, 179, 132, 78, 230, 159, 74, 34, 34, 211, 57, - 222, 5, 228, 15, 139, 76, 47, 137, 171, 33, 233, 207, 165, 25, 14, - 199, 234, 125, 174, 175, 98, 195, 185, 252, 15, 246, 204, 114, 110, 190, - 145, 238, 112, 245, 253, 131, 215, 255, 176, 87, 142, 246, 187, 192, 44, - 103, 108, 81, 17, 79, 107, 179, 95, 47, 153, 81, 243, 124, 201, 239, - 129, 226, 248, 219, 246, 181, 185, 236, 203, 31, 141, 24, 115, 34, 160, - 156, 252, 201, 231, 43, 229, 207, 109, 63, 252, 63, 171, 43, 146, 219, - 255, 223, 45, 6, 12, 92, 218, 204, 209, 14, 254, 255, 75, 248, 255, - 111, 23, 169, 156, 211, 225, 255, 175, 158, 120, 203, 121, 125, 97, 195, - 42, 197, 127, 111, 189, 158, 43, 188, 235, 95, 86, 124, 114, 113, 181, - 162, 63, 67, 222, 172, 176, 255, 203, 30, 54, 67, 216, 221, 180, 175, - 99, 109, 76, 99, 46, 191, 214, 227, 251, 106, 127, 249, 125, 186, 240, - 166, 113, 50, 47, 251, 227, 178, 141, 125, 54, 108, 138, 15, 143, 221, - 156, 247, 255, 226, 255, 19, 14, 63, 175, 221, 247, 156, 213, 25, 61, - 169, 39, 111, 239, 157, 247, 172, 194, 138, 118, 47, 104, 125, 30, 142, - 225, 250, 184, 163, 224, 179, 176, 30, 29, 154, 149, 148, 74, 247, 159, - 215, 143, 106, 237, 10, 142, 74, 114, 148, 254, 22, 199, 227, 175, 193, - 236, 221, 146, 63, 224, 255, 247, 213, 141, 225, 242, 254, 19, 254, 255, - 244, 173, 15, 74, 246, 189, 46, 254, 214, 104, 208, 195, 49, 225, 109, - 16, 11, 184, 253, 255, 212, 227, 9, 194, 69, 248, 255, 71, 178, 122, - 240, 190, 215, 184, 152, 237, 220, 253, 152, 222, 113, 114, 188, 248, 155, - 178, 195, 103, 79, 214, 142, 41, 203, 118, 118, 237, 116, 152, 247, 103, - 152, 121, 127, 120, 237, 185, 171, 75, 86, 79, 200, 45, 231, 255, 63, - 133, 140, 202, 237, 255, 234, 86, 92, 255, 164, 19, 101, 181, 68, 242, - 124, 94, 92, 185, 244, 126, 56, 223, 171, 220, 189, 217, 121, 240, 255, - 191, 193, 255, 191, 208, 198, 28, 86, 149, 245, 79, 191, 49, 64, 191, - 171, 64, 191, 133, 176, 71, 254, 253, 2, 197, 254, 47, 236, 25, 199, - 173, 173, 25, 194, 51, 123, 215, 240, 241, 183, 211, 88, 157, 246, 29, - 203, 28, 183, 124, 3, 184, 173, 136, 110, 215, 75, 251, 79, 179, 55, - 139, 115, 92, 51, 42, 149, 127, 14, 124, 253, 190, 189, 67, 74, 138, - 63, 13, 228, 235, 253, 88, 225, 144, 240, 125, 200, 235, 21, 250, 60, - 127, 9, 254, 155, 130, 39, 66, 187, 213, 254, 229, 245, 163, 119, 248, - 255, 230, 87, 231, 114, 255, 255, 254, 135, 163, 132, 184, 106, 245, 132, - 38, 250, 189, 188, 253, 147, 49, 245, 157, 41, 171, 71, 9, 173, 84, - 9, 60, 109, 110, 219, 162, 36, 242, 91, 87, 137, 207, 203, 226, 252, - 127, 60, 110, 174, 176, 117, 198, 178, 136, 192, 143, 252, 249, 250, 15, - 135, 255, 63, 12, 255, 127, 252, 74, 67, 222, 95, 240, 194, 213, 39, - 235, 57, 11, 224, 243, 249, 243, 7, 228, 79, 68, 44, 16, 37, 249, - 255, 195, 240, 255, 53, 134, 63, 228, 218, 113, 117, 61, 159, 31, 223, - 181, 233, 206, 88, 199, 94, 109, 171, 223, 31, 225, 245, 181, 194, 1, - 71, 187, 195, 102, 231, 228, 139, 199, 185, 254, 189, 173, 81, 107, 19, - 114, 215, 148, 76, 8, 23, 215, 255, 166, 38, 173, 92, 198, 171, 186, - 136, 172, 239, 58, 150, 147, 63, 201, 184, 194, 243, 63, 232, 132, 171, - 166, 72, 146, 237, 191, 171, 6, 188, 241, 80, 66, 185, 223, 248, 60, - 6, 255, 63, 13, 254, 63, 106, 239, 186, 208, 170, 200, 127, 78, 74, - 158, 48, 170, 254, 229, 176, 236, 232, 99, 71, 154, 172, 207, 169, 16, - 255, 107, 154, 228, 10, 89, 159, 92, 13, 183, 39, 126, 206, 253, 247, - 216, 144, 107, 37, 15, 109, 157, 37, 12, 60, 106, 231, 101, 179, 187, - 117, 235, 211, 82, 200, 44, 177, 46, 172, 124, 253, 239, 129, 175, 255, - 125, 73, 73, 159, 152, 132, 119, 184, 252, 155, 156, 124, 237, 200, 115, - 240, 245, 135, 254, 173, 193, 199, 51, 244, 196, 59, 161, 191, 159, 169, - 81, 108, 187, 225, 121, 254, 75, 235, 127, 89, 207, 5, 92, 254, 198, - 213, 225, 194, 165, 57, 157, 132, 214, 22, 241, 249, 227, 222, 191, 59, - 57, 63, 156, 31, 46, 52, 123, 237, 11, 94, 255, 197, 167, 118, 21, - 151, 196, 198, 151, 172, 88, 38, 214, 15, 233, 219, 69, 72, 101, 207, - 71, 212, 46, 91, 212, 155, 234, 247, 134, 255, 223, 8, 255, 191, 202, - 183, 62, 151, 31, 120, 225, 37, 248, 255, 2, 248, 124, 30, 131, 33, - 95, 143, 88, 96, 153, 228, 255, 135, 195, 255, 127, 7, 255, 95, 246, - 236, 26, 62, 63, 61, 45, 51, 157, 51, 119, 125, 22, 62, 127, 168, - 134, 215, 79, 202, 250, 172, 68, 181, 44, 215, 217, 242, 214, 21, 62, - 31, 1, 241, 26, 109, 143, 133, 111, 21, 117, 254, 78, 148, 191, 49, - 122, 144, 235, 214, 156, 43, 66, 164, 169, 91, 57, 249, 147, 140, 43, - 60, 255, 171, 85, 169, 255, 175, 84, 7, 94, 30, 210, 170, 156, 108, - 90, 194, 255, 255, 9, 255, 63, 250, 183, 86, 37, 85, 145, 127, 226, - 249, 4, 33, 187, 231, 248, 240, 210, 35, 89, 97, 187, 135, 156, 173, - 224, 255, 255, 114, 61, 34, 60, 114, 35, 90, 40, 85, 23, 242, 249, - 254, 160, 83, 180, 179, 78, 70, 125, 33, 90, 251, 37, 239, 207, 205, - 83, 207, 134, 251, 143, 126, 161, 164, 115, 118, 229, 241, 127, 236, 229, - 60, 97, 248, 134, 252, 176, 208, 137, 63, 112, 249, 127, 197, 242, 139, - 227, 254, 65, 222, 71, 157, 56, 222, 95, 7, 127, 13, 245, 173, 22, - 80, 252, 254, 245, 60, 249, 249, 15, 201, 191, 218, 204, 149, 92, 254, - 157, 51, 85, 142, 197, 191, 204, 18, 150, 46, 90, 201, 203, 31, 62, - 55, 203, 121, 243, 37, 149, 163, 227, 167, 93, 120, 250, 181, 249, 163, - 194, 34, 39, 207, 43, 62, 125, 81, 172, 255, 113, 235, 5, 46, 215, - 75, 31, 70, 76, 104, 55, 72, 180, 255, 133, 95, 151, 56, 224, 255, - 223, 157, 55, 151, 247, 215, 9, 255, 223, 47, 253, 167, 146, 169, 240, - 249, 60, 222, 71, 126, 119, 196, 2, 9, 146, 255, 63, 113, 97, 134, - 227, 93, 248, 255, 67, 177, 225, 124, 126, 214, 117, 205, 118, 214, 217, - 105, 118, 148, 54, 92, 203, 235, 143, 186, 106, 213, 118, 153, 149, 237, - 12, 217, 222, 130, 167, 75, 84, 185, 225, 155, 110, 235, 194, 63, 105, - 38, 214, 223, 218, 125, 132, 75, 181, 110, 129, 112, 187, 36, 184, 156, - 252, 233, 153, 159, 82, 254, 252, 29, 32, 122, 254, 87, 77, 36, 241, - 253, 159, 187, 59, 128, 220, 179, 173, 180, 19, 15, 39, 8, 141, 142, - 39, 56, 157, 81, 19, 157, 179, 150, 54, 138, 120, 230, 239, 9, 194, - 176, 87, 94, 172, 146, 255, 255, 25, 242, 105, 145, 250, 84, 241, 182, - 191, 119, 21, 253, 62, 101, 121, 133, 247, 127, 70, 97, 93, 182, 105, - 244, 120, 232, 11, 147, 58, 242, 249, 78, 221, 84, 173, 168, 229, 183, - 121, 66, 190, 85, 197, 231, 111, 101, 94, 64, 241, 162, 137, 170, 240, - 99, 95, 254, 255, 188, 255, 83, 92, 150, 39, 188, 51, 246, 151, 208, - 113, 99, 196, 223, 154, 126, 237, 198, 23, 69, 163, 175, 229, 9, 62, - 187, 71, 112, 251, 187, 199, 247, 74, 241, 175, 3, 135, 134, 181, 251, - 90, 108, 127, 112, 163, 14, 194, 94, 115, 13, 231, 192, 6, 159, 240, - 111, 115, 12, 231, 91, 11, 121, 49, 125, 157, 117, 122, 28, 228, 253, - 5, 47, 232, 210, 154, 11, 99, 58, 11, 92, 215, 31, 69, 254, 168, - 206, 130, 195, 253, 254, 79, 211, 209, 117, 157, 15, 215, 94, 225, 244, - 251, 253, 49, 222, 247, 134, 161, 173, 133, 86, 129, 253, 132, 88, 125, - 1, 175, 95, 244, 69, 148, 211, 100, 110, 42, 176, 101, 83, 184, 63, - 222, 247, 248, 223, 37, 151, 255, 26, 162, 109, 255, 136, 120, 255, 107, - 213, 94, 157, 246, 146, 225, 79, 45, 201, 168, 220, 254, 175, 90, 37, - 251, 63, 232, 68, 188, 70, 36, 241, 253, 159, 187, 203, 191, 254, 190, - 148, 114, 243, 59, 208, 254, 137, 211, 97, 107, 228, 234, 112, 90, 227, - 168, 202, 250, 175, 151, 145, 39, 252, 121, 107, 114, 113, 73, 72, 96, - 73, 98, 231, 138, 239, 255, 156, 59, 55, 75, 248, 37, 190, 164, 228, - 160, 105, 63, 215, 247, 65, 237, 143, 134, 167, 190, 149, 43, 52, 205, - 16, 239, 7, 204, 235, 189, 167, 228, 157, 117, 183, 194, 116, 151, 42, - 95, 255, 70, 200, 106, 214, 115, 137, 97, 9, 123, 67, 185, 189, 204, - 93, 156, 88, 188, 1, 121, 63, 124, 254, 54, 127, 126, 239, 168, 23, - 94, 52, 107, 243, 155, 125, 118, 41, 222, 255, 33, 255, 159, 191, 100, - 7, 127, 166, 242, 122, 143, 60, 225, 93, 221, 177, 226, 129, 199, 215, - 243, 190, 253, 125, 250, 231, 176, 188, 156, 60, 161, 201, 124, 241, 183, - 241, 255, 222, 182, 38, 252, 130, 209, 86, 178, 251, 43, 177, 253, 161, - 197, 193, 66, 225, 236, 64, 231, 217, 3, 111, 242, 245, 255, 196, 91, - 167, 29, 141, 99, 231, 106, 143, 204, 136, 227, 239, 79, 213, 143, 157, - 235, 152, 241, 179, 205, 249, 88, 70, 107, 46, 63, 202, 87, 101, 180, - 214, 246, 146, 222, 255, 49, 238, 61, 232, 60, 144, 61, 48, 226, 108, - 112, 38, 151, 223, 160, 185, 87, 28, 97, 103, 7, 57, 18, 13, 19, - 121, 253, 216, 152, 108, 109, 157, 148, 44, 103, 224, 137, 61, 188, 253, - 151, 199, 140, 119, 182, 251, 188, 163, 227, 246, 73, 13, 111, 191, 113, - 255, 19, 206, 159, 210, 46, 10, 255, 190, 183, 167, 156, 252, 73, 198, - 21, 246, 127, 208, 9, 150, 43, 146, 244, 238, 199, 93, 21, 224, 88, - 89, 126, 185, 247, 191, 108, 223, 36, 10, 93, 162, 191, 118, 212, 253, - 167, 80, 168, 138, 252, 77, 207, 231, 10, 95, 15, 254, 160, 164, 241, - 171, 207, 135, 189, 16, 240, 102, 133, 247, 127, 66, 79, 230, 9, 151, - 182, 169, 194, 226, 222, 111, 203, 231, 191, 250, 208, 217, 197, 11, 139, - 167, 11, 15, 93, 24, 206, 231, 239, 143, 178, 199, 195, 255, 73, 29, - 161, 237, 184, 116, 122, 229, 254, 255, 223, 60, 225, 74, 84, 231, 48, - 161, 243, 122, 142, 253, 229, 250, 206, 197, 175, 33, 207, 49, 102, 37, - 79, 47, 217, 178, 182, 232, 197, 179, 171, 138, 182, 223, 242, 200, 159, - 214, 191, 37, 225, 56, 127, 166, 242, 217, 249, 89, 66, 195, 167, 123, - 247, 121, 180, 68, 197, 229, 83, 125, 125, 100, 209, 243, 216, 83, 94, - 56, 176, 140, 219, 131, 245, 7, 85, 142, 201, 155, 86, 20, 239, 251, - 73, 244, 191, 177, 90, 31, 225, 82, 191, 230, 206, 247, 244, 165, 252, - 253, 143, 115, 205, 254, 41, 106, 114, 107, 150, 179, 241, 220, 219, 188, - 255, 224, 133, 190, 27, 138, 138, 235, 110, 21, 223, 231, 249, 122, 206, - 237, 146, 144, 173, 255, 150, 164, 74, 239, 255, 36, 134, 14, 208, 62, - 124, 250, 109, 231, 238, 14, 226, 254, 109, 246, 246, 3, 161, 31, 204, - 205, 21, 54, 31, 252, 146, 215, 223, 127, 49, 203, 121, 217, 180, 183, - 216, 231, 236, 44, 62, 254, 182, 167, 114, 29, 150, 85, 159, 134, 23, - 77, 23, 127, 159, 55, 229, 133, 88, 231, 186, 198, 83, 157, 103, 198, - 44, 45, 31, 255, 231, 86, 242, 252, 79, 83, 233, 251, 63, 149, 234, - 192, 171, 9, 227, 143, 40, 211, 239, 172, 223, 87, 244, 65, 114, 154, - 112, 102, 214, 198, 94, 85, 145, 127, 194, 31, 121, 130, 53, 182, 164, - 248, 55, 245, 178, 162, 31, 114, 103, 86, 120, 255, 103, 25, 100, 213, - 172, 244, 82, 209, 188, 31, 234, 241, 249, 206, 154, 171, 10, 171, 129, - 189, 214, 212, 246, 225, 124, 62, 114, 235, 212, 46, 190, 144, 30, 30, - 62, 227, 80, 229, 246, 191, 7, 240, 87, 197, 149, 132, 69, 132, 159, - 226, 242, 126, 122, 110, 73, 113, 247, 63, 243, 132, 58, 83, 123, 242, - 244, 249, 186, 239, 22, 61, 251, 85, 68, 81, 246, 29, 242, 111, 46, - 244, 224, 235, 127, 104, 251, 153, 66, 116, 226, 202, 35, 237, 63, 13, - 228, 242, 239, 255, 189, 189, 40, 226, 231, 60, 225, 219, 69, 63, 240, - 254, 60, 117, 42, 208, 241, 121, 202, 79, 197, 187, 234, 136, 242, 91, - 113, 228, 71, 109, 90, 78, 43, 103, 63, 85, 27, 254, 254, 87, 76, - 235, 73, 197, 39, 174, 207, 114, 174, 138, 17, 229, 255, 230, 245, 89, - 66, 108, 175, 179, 197, 239, 93, 189, 198, 229, 191, 4, 249, 199, 174, - 94, 43, 121, 95, 122, 255, 103, 88, 227, 16, 237, 150, 147, 163, 92, - 243, 3, 69, 249, 39, 7, 173, 15, 173, 6, 123, 215, 162, 240, 45, - 94, 191, 176, 196, 238, 124, 182, 246, 137, 226, 234, 187, 214, 112, 249, - 251, 180, 95, 235, 216, 180, 247, 141, 240, 199, 159, 177, 241, 250, 19, - 22, 181, 112, 109, 154, 106, 115, 190, 58, 248, 77, 46, 127, 250, 29, - 40, 250, 62, 200, 18, 127, 89, 61, 207, 253, 61, 95, 102, 249, 239, - 13, 35, 251, 218, 140, 118, 166, 75, 53, 232, 153, 248, 205, 97, 96, - 96, 144, 244, 142, 185, 248, 45, 137, 63, 202, 103, 137, 84, 122, 242, - 166, 231, 55, 85, 144, 255, 180, 251, 123, 18, 127, 233, 91, 194, 191, - 254, 46, 135, 125, 191, 247, 202, 221, 239, 168, 135, 73, 24, 110, 188, - 82, 63, 180, 133, 180, 101, 122, 90, 185, 207, 132, 239, 247, 158, 178, - 18, 143, 48, 228, 254, 129, 231, 125, 156, 253, 79, 185, 254, 221, 239, - 189, 215, 114, 253, 83, 224, 93, 80, 163, 127, 72, 23, 246, 191, 3, - 239, 62, 239, 81, 42, 241, 8, 195, 141, 151, 15, 158, 240, 163, 39, - 151, 159, 191, 251, 189, 151, 167, 196, 203, 87, 224, 249, 129, 39, 252, - 248, 254, 166, 114, 243, 119, 191, 247, 188, 148, 120, 126, 10, 188, 229, - 179, 16, 39, 18, 94, 209, 29, 227, 189, 207, 123, 67, 74, 60, 194, - 112, 227, 249, 131, 39, 252, 136, 130, 148, 114, 253, 187, 223, 123, 40, - 74, 60, 127, 5, 94, 225, 204, 203, 106, 194, 47, 75, 155, 90, 14, - 239, 126, 239, 53, 40, 241, 8, 195, 141, 23, 1, 158, 240, 203, 250, - 149, 199, 187, 223, 115, 114, 37, 94, 132, 2, 175, 116, 6, 116, 5, - 233, 64, 255, 244, 114, 120, 247, 123, 238, 86, 78, 159, 103, 40, 244, - 25, 60, 239, 227, 194, 242, 191, 41, 115, 191, 231, 56, 229, 244, 89, - 129, 119, 97, 58, 244, 25, 233, 248, 127, 141, 229, 231, 239, 62, 207, - 5, 202, 233, 243, 116, 133, 62, 131, 39, 252, 210, 27, 102, 223, 59, - 245, 249, 126, 152, 178, 62, 43, 240, 252, 192, 19, 126, 33, 75, 171, - 32, 143, 123, 61, 183, 46, 167, 207, 10, 188, 130, 28, 232, 51, 199, - 52, 85, 42, 143, 123, 97, 202, 127, 47, 51, 199, 131, 23, 8, 158, - 240, 149, 127, 127, 92, 150, 199, 125, 58, 40, 255, 86, 133, 2, 207, - 149, 125, 89, 77, 248, 241, 199, 43, 149, 199, 61, 17, 229, 223, 170, - 200, 246, 224, 69, 131, 231, 125, 188, 232, 145, 135, 230, 63, 236, 251, - 149, 120, 209, 10, 188, 50, 248, 2, 194, 47, 140, 79, 175, 196, 62, - 223, 123, 192, 242, 111, 143, 102, 121, 240, 44, 224, 9, 63, 126, 216, - 165, 74, 236, 243, 127, 195, 179, 40, 240, 200, 87, 241, 62, 222, 170, - 212, 62, 255, 167, 249, 99, 74, 60, 9, 63, 223, 113, 87, 251, 124, - 87, 76, 183, 15, 38, 191, 235, 246, 193, 101, 67, 160, 43, 241, 30, - 63, 204, 125, 176, 221, 104, 74, 70, 171, 70, 123, 98, 74, 176, 228, - 132, 221, 62, 216, 31, 117, 163, 135, 98, 61, 69, 167, 251, 150, 30, - 78, 241, 149, 109, 96, 166, 194, 6, 102, 72, 120, 141, 254, 241, 218, - 7, 19, 134, 108, 3, 193, 19, 254, 242, 122, 222, 251, 224, 8, 5, - 94, 169, 29, 250, 130, 116, 105, 200, 37, 175, 125, 48, 97, 200, 54, - 16, 60, 225, 151, 5, 121, 239, 131, 227, 21, 120, 23, 108, 232, 27, - 210, 254, 79, 121, 239, 131, 9, 67, 182, 129, 224, 9, 63, 250, 5, - 179, 215, 62, 56, 95, 129, 231, 7, 158, 240, 253, 119, 120, 239, 131, - 253, 20, 120, 5, 86, 232, 51, 245, 113, 171, 209, 107, 31, 76, 24, - 178, 13, 4, 207, 251, 24, 237, 189, 15, 14, 84, 224, 185, 166, 193, - 6, 34, 93, 214, 214, 123, 31, 76, 24, 178, 13, 4, 79, 248, 165, - 129, 38, 175, 125, 112, 180, 2, 175, 112, 36, 236, 11, 210, 236, 51, - 239, 125, 48, 97, 200, 235, 13, 60, 225, 151, 125, 225, 189, 15, 142, - 80, 224, 149, 142, 192, 122, 67, 186, 160, 200, 123, 31, 76, 24, 242, - 122, 3, 79, 248, 254, 193, 222, 251, 224, 120, 5, 222, 133, 225, 144, - 5, 210, 101, 19, 189, 247, 193, 132, 33, 175, 55, 240, 132, 31, 239, - 242, 222, 7, 231, 43, 240, 252, 192, 19, 126, 65, 247, 169, 94, 251, - 96, 63, 5, 94, 193, 48, 172, 55, 26, 243, 33, 239, 125, 48, 97, - 200, 235, 13, 60, 225, 199, 239, 243, 222, 7, 7, 42, 240, 92, 240, - 47, 132, 31, 223, 210, 123, 31, 76, 24, 242, 122, 3, 79, 248, 101, - 223, 121, 239, 131, 163, 135, 150, 247, 193, 132, 207, 54, 121, 239, 131, - 201, 239, 186, 125, 112, 96, 24, 124, 91, 102, 57, 31, 108, 215, 153, - 244, 228, 132, 105, 51, 236, 222, 6, 203, 62, 216, 130, 186, 5, 168, - 19, 93, 116, 75, 109, 241, 59, 83, 83, 142, 59, 134, 40, 250, 56, - 68, 194, 155, 225, 189, 15, 102, 10, 188, 229, 131, 17, 39, 12, 161, - 223, 45, 240, 222, 7, 19, 134, 188, 239, 2, 79, 248, 209, 179, 188, - 247, 193, 254, 10, 188, 194, 65, 152, 67, 164, 93, 58, 239, 125, 48, - 97, 200, 54, 16, 60, 225, 199, 127, 229, 189, 15, 142, 80, 224, 149, - 14, 132, 13, 68, 186, 32, 223, 123, 31, 76, 24, 178, 13, 4, 79, - 248, 165, 107, 188, 247, 193, 241, 10, 188, 11, 3, 128, 133, 116, 193, - 94, 239, 125, 48, 97, 200, 54, 16, 60, 225, 251, 77, 240, 222, 7, - 231, 43, 240, 252, 192, 19, 126, 190, 202, 123, 31, 236, 167, 192, 43, - 232, 15, 44, 164, 151, 247, 244, 222, 7, 19, 134, 108, 3, 193, 19, - 190, 235, 27, 239, 125, 112, 160, 2, 207, 213, 15, 178, 32, 204, 239, - 189, 247, 193, 132, 33, 219, 64, 240, 132, 95, 240, 246, 93, 109, 254, - 125, 245, 57, 90, 129, 87, 40, 96, 172, 72, 199, 135, 123, 239, 131, - 9, 67, 94, 111, 224, 9, 223, 47, 193, 123, 31, 28, 161, 192, 43, - 213, 98, 189, 33, 173, 252, 187, 245, 255, 171, 15, 38, 12, 121, 189, - 129, 39, 252, 248, 48, 239, 125, 112, 188, 2, 239, 66, 56, 214, 155, - 150, 246, 213, 119, 141, 137, 238, 235, 131, 9, 67, 94, 111, 224, 9, - 191, 192, 233, 189, 15, 206, 87, 224, 249, 129, 39, 124, 255, 14, 222, - 251, 96, 63, 5, 30, 249, 43, 194, 47, 248, 213, 123, 31, 76, 24, - 74, 31, 76, 248, 254, 159, 121, 239, 131, 201, 239, 186, 125, 112, 97, - 16, 226, 131, 33, 74, 31, 108, 231, 251, 95, 120, 94, 163, 93, 246, - 192, 30, 31, 236, 10, 165, 248, 19, 250, 90, 221, 228, 91, 86, 236, - 217, 7, 83, 190, 188, 230, 66, 165, 239, 91, 170, 121, 239, 131, 163, - 21, 120, 101, 125, 176, 230, 144, 182, 216, 188, 247, 193, 132, 33, 223, - 235, 0, 79, 248, 254, 83, 189, 247, 193, 22, 5, 30, 3, 79, 248, - 126, 81, 222, 251, 96, 166, 192, 91, 222, 27, 99, 69, 58, 255, 144, - 247, 62, 152, 48, 228, 152, 3, 60, 225, 199, 47, 241, 222, 7, 251, - 43, 240, 10, 123, 193, 127, 32, 29, 127, 208, 123, 31, 76, 24, 178, - 13, 4, 79, 248, 174, 120, 239, 125, 112, 132, 2, 175, 180, 39, 108, - 96, 47, 250, 13, 169, 169, 229, 108, 254, 255, 226, 131, 9, 67, 182, - 129, 224, 9, 63, 63, 194, 123, 31, 28, 175, 192, 187, 208, 3, 54, - 16, 233, 248, 54, 222, 251, 96, 194, 144, 109, 32, 120, 194, 143, 190, - 233, 189, 15, 206, 87, 224, 249, 129, 39, 252, 11, 23, 189, 247, 193, - 126, 10, 188, 130, 238, 152, 59, 164, 203, 126, 240, 126, 31, 76, 24, - 114, 204, 1, 158, 240, 227, 135, 120, 239, 131, 3, 21, 120, 174, 110, - 180, 199, 68, 31, 167, 121, 239, 131, 9, 67, 182, 127, 224, 9, 191, - 236, 160, 247, 62, 56, 90, 129, 87, 22, 130, 181, 129, 244, 133, 67, - 222, 223, 139, 38, 12, 217, 254, 129, 231, 125, 252, 214, 123, 31, 108, - 81, 224, 49, 240, 132, 111, 41, 243, 222, 7, 51, 5, 222, 114, 248, - 23, 194, 143, 239, 239, 189, 15, 38, 12, 217, 254, 129, 39, 124, 215, - 21, 239, 125, 176, 127, 112, 121, 31, 76, 248, 17, 7, 188, 247, 193, - 228, 119, 221, 62, 216, 127, 23, 100, 17, 86, 209, 7, 243, 15, 110, - 197, 187, 210, 240, 196, 30, 31, 28, 129, 186, 203, 81, 39, 250, 113, - 147, 111, 126, 174, 199, 7, 83, 190, 108, 3, 3, 69, 188, 194, 71, - 188, 247, 193, 132, 33, 219, 64, 240, 132, 239, 223, 209, 123, 31, 28, - 175, 192, 179, 92, 160, 251, 128, 24, 119, 92, 21, 124, 240, 5, 197, - 120, 243, 161, 47, 129, 244, 27, 185, 222, 251, 96, 194, 144, 251, 183, - 15, 58, 8, 124, 215, 58, 239, 125, 48, 97, 200, 58, 3, 158, 240, - 203, 54, 123, 239, 131, 153, 2, 111, 121, 33, 250, 135, 116, 244, 214, - 42, 60, 15, 46, 84, 248, 244, 189, 208, 23, 224, 185, 182, 120, 239, - 131, 9, 67, 246, 233, 224, 9, 63, 162, 177, 247, 62, 56, 66, 129, - 87, 250, 10, 124, 58, 210, 5, 45, 189, 247, 193, 132, 33, 235, 51, - 120, 194, 143, 111, 234, 189, 15, 142, 87, 224, 93, 216, 3, 249, 34, - 237, 58, 237, 189, 15, 38, 12, 217, 167, 131, 39, 252, 130, 51, 222, - 251, 224, 124, 5, 158, 31, 120, 194, 95, 126, 192, 123, 31, 236, 167, - 192, 43, 216, 13, 127, 73, 99, 158, 236, 189, 15, 38, 12, 217, 167, - 131, 39, 252, 130, 113, 222, 251, 224, 64, 5, 158, 235, 101, 96, 33, - 173, 252, 155, 161, 255, 171, 15, 38, 12, 217, 167, 131, 39, 252, 232, - 92, 239, 247, 193, 209, 10, 188, 178, 151, 160, 43, 132, 25, 97, 242, - 218, 7, 19, 134, 108, 175, 192, 19, 126, 193, 50, 239, 125, 176, 69, - 129, 199, 192, 19, 126, 97, 45, 239, 125, 48, 83, 224, 145, 191, 34, - 124, 255, 143, 188, 247, 193, 132, 161, 244, 193, 132, 159, 191, 202, 123, - 31, 76, 126, 215, 237, 131, 227, 183, 96, 172, 65, 21, 125, 112, 136, - 199, 1, 151, 123, 39, 171, 112, 39, 116, 127, 11, 189, 131, 100, 242, - 141, 31, 224, 241, 193, 148, 47, 219, 192, 157, 34, 222, 5, 149, 247, - 62, 56, 66, 129, 87, 186, 3, 125, 68, 218, 101, 170, 194, 59, 89, - 59, 20, 54, 16, 60, 225, 151, 25, 188, 247, 193, 241, 10, 188, 11, - 219, 49, 31, 72, 231, 167, 84, 225, 157, 172, 237, 10, 27, 8, 158, - 240, 93, 39, 170, 240, 78, 150, 2, 207, 15, 60, 225, 251, 47, 244, - 222, 7, 251, 41, 240, 10, 182, 97, 172, 72, 71, 111, 241, 222, 7, - 19, 134, 108, 3, 193, 19, 190, 197, 207, 123, 31, 28, 168, 192, 115, - 189, 8, 123, 128, 116, 129, 206, 123, 31, 76, 24, 178, 13, 4, 79, - 248, 236, 33, 239, 125, 112, 180, 2, 175, 108, 43, 100, 75, 125, 20, - 188, 247, 193, 132, 33, 219, 64, 240, 132, 239, 119, 205, 123, 31, 108, - 81, 224, 49, 240, 132, 191, 252, 119, 239, 125, 48, 83, 224, 45, 127, - 1, 178, 69, 250, 194, 23, 222, 251, 96, 194, 144, 247, 53, 224, 9, - 223, 127, 128, 247, 62, 216, 95, 129, 87, 248, 60, 198, 138, 244, 242, - 169, 222, 251, 96, 194, 144, 237, 31, 120, 194, 47, 248, 192, 123, 31, - 28, 161, 192, 43, 45, 128, 253, 67, 186, 240, 128, 247, 251, 96, 194, - 144, 237, 31, 120, 194, 47, 60, 227, 253, 62, 56, 94, 129, 87, 248, - 28, 236, 31, 210, 249, 59, 189, 247, 193, 132, 33, 207, 31, 120, 194, - 247, 143, 244, 222, 7, 71, 40, 240, 200, 95, 17, 126, 254, 223, 222, - 251, 96, 194, 80, 250, 96, 194, 207, 63, 234, 189, 15, 38, 191, 43, - 191, 147, 181, 10, 99, 221, 85, 209, 7, 119, 187, 139, 15, 190, 176, - 25, 235, 125, 181, 68, 35, 61, 127, 123, 130, 242, 101, 31, 178, 89, - 250, 219, 37, 35, 189, 247, 193, 249, 10, 60, 63, 240, 132, 95, 214, - 198, 123, 31, 236, 167, 192, 43, 216, 132, 249, 35, 204, 137, 222, 251, - 96, 194, 144, 125, 8, 120, 194, 47, 235, 228, 189, 15, 14, 84, 224, - 185, 54, 98, 253, 34, 29, 253, 138, 247, 62, 152, 48, 100, 31, 2, - 158, 240, 11, 158, 245, 222, 7, 71, 43, 240, 202, 54, 192, 135, 32, - 237, 90, 234, 189, 15, 38, 12, 217, 135, 128, 39, 252, 252, 245, 222, - 251, 96, 139, 2, 143, 129, 39, 124, 86, 223, 251, 231, 193, 76, 129, - 183, 252, 89, 248, 16, 26, 115, 105, 121, 159, 254, 191, 248, 96, 194, - 144, 125, 8, 120, 194, 247, 111, 236, 189, 15, 246, 87, 224, 21, 174, - 135, 255, 64, 58, 240, 124, 21, 222, 201, 90, 175, 176, 129, 224, 9, - 63, 254, 163, 42, 188, 147, 165, 192, 43, 93, 7, 27, 136, 180, 95, - 191, 138, 250, 252, 159, 223, 201, 90, 167, 240, 33, 224, 9, 127, 249, - 132, 42, 188, 147, 165, 192, 187, 176, 22, 62, 4, 233, 248, 209, 85, - 120, 39, 107, 173, 194, 254, 129, 39, 252, 130, 29, 85, 120, 39, 75, - 129, 231, 7, 158, 240, 253, 166, 87, 225, 157, 44, 5, 94, 193, 26, - 172, 53, 164, 11, 83, 238, 42, 143, 251, 191, 147, 181, 70, 97, 255, - 192, 19, 126, 252, 51, 85, 120, 39, 75, 129, 231, 130, 111, 33, 124, - 139, 111, 21, 222, 201, 90, 173, 176, 127, 224, 9, 191, 224, 100, 21, - 222, 201, 90, 125, 199, 59, 89, 72, 251, 189, 84, 133, 119, 178, 86, - 41, 158, 7, 255, 138, 185, 219, 82, 209, 7, 119, 191, 139, 15, 182, - 144, 207, 254, 141, 158, 167, 154, 124, 3, 179, 60, 251, 96, 202, 151, - 251, 184, 74, 250, 187, 146, 185, 85, 120, 39, 75, 129, 183, 124, 37, - 228, 129, 116, 254, 212, 42, 188, 147, 181, 82, 97, 3, 193, 19, 126, - 129, 174, 10, 239, 100, 41, 240, 10, 87, 192, 30, 32, 29, 161, 247, - 140, 87, 243, 63, 250, 96, 194, 144, 109, 32, 120, 194, 47, 59, 85, - 133, 119, 178, 20, 120, 165, 203, 177, 222, 144, 46, 155, 91, 133, 119, - 178, 150, 43, 198, 123, 30, 99, 5, 158, 223, 134, 42, 60, 15, 62, - 175, 24, 47, 120, 194, 143, 46, 244, 254, 219, 164, 8, 5, 94, 233, - 159, 24, 239, 121, 250, 182, 203, 123, 31, 76, 24, 178, 205, 7, 79, - 248, 174, 106, 85, 120, 30, 172, 192, 187, 240, 7, 198, 139, 116, 105, - 104, 21, 158, 7, 255, 161, 176, 249, 224, 9, 191, 244, 159, 42, 60, - 15, 86, 224, 249, 129, 39, 252, 232, 159, 171, 240, 60, 88, 129, 87, - 112, 14, 107, 23, 105, 203, 71, 85, 120, 30, 124, 78, 97, 243, 193, - 19, 126, 89, 100, 21, 158, 7, 43, 240, 92, 103, 97, 11, 144, 142, - 78, 170, 194, 243, 224, 179, 10, 155, 15, 158, 240, 227, 223, 173, 194, - 243, 96, 5, 94, 217, 239, 208, 61, 164, 93, 129, 222, 251, 96, 194, - 144, 99, 94, 240, 132, 95, 118, 170, 10, 207, 131, 21, 120, 12, 60, - 225, 71, 188, 88, 133, 231, 193, 10, 188, 229, 240, 47, 132, 31, 223, - 185, 10, 207, 131, 127, 83, 216, 123, 240, 188, 143, 231, 170, 240, 60, - 248, 183, 59, 158, 7, 255, 70, 239, 24, 86, 225, 121, 240, 175, 30, - 31, 124, 97, 9, 250, 182, 170, 162, 15, 238, 113, 23, 31, 28, 65, - 62, 123, 41, 202, 211, 111, 9, 86, 247, 236, 131, 41, 95, 182, 129, - 191, 72, 62, 120, 88, 21, 158, 7, 255, 162, 176, 129, 224, 9, 191, - 192, 191, 10, 207, 131, 21, 120, 23, 126, 134, 189, 66, 186, 112, 156, - 247, 62, 152, 48, 100, 27, 8, 158, 240, 11, 218, 123, 191, 15, 206, - 87, 224, 249, 129, 231, 125, 220, 230, 189, 15, 246, 83, 224, 21, 252, - 4, 27, 72, 125, 92, 227, 189, 15, 38, 12, 217, 6, 130, 39, 252, - 252, 69, 222, 251, 224, 64, 5, 158, 235, 71, 204, 29, 210, 17, 171, - 189, 223, 7, 19, 134, 108, 3, 193, 19, 126, 252, 112, 239, 125, 112, - 180, 2, 175, 236, 7, 216, 63, 164, 45, 254, 169, 94, 239, 131, 9, - 67, 182, 129, 224, 9, 191, 236, 17, 239, 125, 176, 69, 129, 199, 126, - 160, 247, 157, 160, 51, 191, 123, 239, 131, 153, 2, 111, 249, 247, 24, - 43, 97, 158, 242, 222, 7, 19, 134, 108, 3, 193, 19, 190, 69, 239, - 253, 62, 216, 95, 129, 87, 248, 29, 98, 94, 164, 163, 199, 86, 225, - 189, 232, 239, 20, 49, 32, 120, 194, 47, 27, 94, 133, 247, 162, 21, - 120, 165, 101, 176, 45, 223, 209, 183, 118, 85, 120, 47, 186, 76, 97, - 255, 192, 19, 126, 105, 70, 21, 222, 139, 86, 224, 21, 46, 3, 22, - 210, 165, 51, 189, 223, 7, 19, 134, 60, 127, 224, 9, 223, 127, 190, - 247, 62, 56, 66, 129, 87, 10, 255, 66, 248, 129, 26, 239, 125, 48, - 97, 200, 243, 7, 158, 247, 241, 77, 239, 125, 112, 252, 210, 242, 62, - 152, 240, 3, 111, 123, 239, 131, 201, 239, 186, 125, 176, 101, 14, 198, - 251, 107, 69, 31, 220, 243, 46, 62, 56, 159, 124, 246, 28, 241, 61, - 209, 192, 111, 60, 62, 152, 242, 101, 31, 178, 68, 194, 27, 236, 189, - 15, 246, 83, 224, 21, 44, 134, 189, 95, 66, 127, 159, 59, 221, 107, - 31, 76, 24, 178, 15, 1, 79, 248, 150, 209, 222, 251, 224, 64, 5, - 158, 235, 25, 248, 144, 197, 244, 251, 198, 222, 251, 96, 194, 144, 125, - 8, 120, 194, 191, 112, 221, 123, 31, 28, 173, 192, 43, 91, 4, 31, - 130, 180, 255, 10, 239, 125, 48, 97, 200, 62, 4, 60, 225, 71, 204, - 243, 222, 7, 91, 20, 120, 12, 60, 225, 23, 220, 246, 222, 7, 51, - 5, 222, 242, 133, 144, 237, 34, 250, 190, 203, 251, 231, 193, 132, 33, - 251, 16, 240, 132, 191, 156, 165, 122, 189, 15, 246, 87, 224, 21, 46, - 0, 22, 210, 129, 121, 222, 251, 96, 194, 144, 109, 224, 2, 122, 214, - 143, 117, 252, 179, 247, 62, 56, 66, 129, 87, 58, 31, 88, 11, 40, - 206, 247, 222, 7, 19, 134, 108, 3, 193, 19, 254, 242, 108, 239, 125, - 112, 188, 2, 239, 194, 60, 248, 15, 234, 99, 174, 247, 62, 152, 48, - 228, 24, 26, 60, 225, 23, 12, 246, 222, 7, 231, 43, 240, 252, 192, - 19, 126, 217, 38, 239, 125, 176, 159, 2, 175, 224, 105, 216, 63, 164, - 151, 79, 243, 222, 7, 19, 134, 108, 255, 192, 19, 126, 180, 221, 123, - 31, 28, 168, 192, 115, 205, 197, 220, 33, 93, 54, 219, 123, 31, 76, - 24, 178, 253, 3, 79, 248, 241, 75, 188, 247, 193, 209, 10, 60, 242, - 87, 188, 143, 78, 239, 125, 48, 97, 40, 125, 48, 225, 23, 94, 246, - 222, 7, 147, 223, 157, 167, 192, 187, 176, 68, 233, 131, 179, 116, 105, - 169, 156, 85, 124, 153, 196, 109, 152, 88, 6, 117, 75, 175, 136, 84, - 152, 228, 241, 193, 76, 209, 199, 229, 179, 165, 119, 178, 108, 222, 251, - 96, 194, 144, 109, 32, 225, 1, 159, 37, 120, 191, 15, 246, 87, 224, - 21, 62, 5, 125, 70, 218, 47, 199, 123, 31, 76, 24, 50, 222, 109, - 216, 64, 224, 249, 247, 170, 194, 247, 193, 183, 21, 54, 21, 60, 225, - 151, 157, 174, 194, 189, 104, 5, 94, 233, 45, 224, 33, 29, 189, 187, - 10, 247, 162, 111, 41, 108, 42, 120, 194, 95, 190, 162, 10, 223, 7, - 43, 240, 46, 220, 132, 62, 33, 29, 255, 114, 21, 190, 15, 190, 169, - 176, 169, 224, 9, 191, 52, 166, 10, 223, 7, 43, 240, 252, 192, 19, - 126, 89, 231, 42, 124, 31, 172, 192, 43, 184, 1, 155, 138, 116, 116, - 72, 21, 190, 15, 190, 161, 176, 169, 224, 9, 63, 255, 139, 42, 124, - 31, 172, 192, 115, 253, 11, 123, 133, 116, 252, 215, 85, 248, 62, 248, - 95, 133, 77, 5, 79, 248, 254, 111, 84, 225, 251, 96, 5, 94, 217, - 117, 216, 212, 127, 233, 123, 54, 239, 125, 48, 97, 200, 49, 37, 120, - 194, 143, 159, 236, 189, 15, 182, 40, 240, 24, 120, 194, 47, 59, 234, - 189, 15, 102, 10, 188, 229, 215, 16, 83, 94, 39, 251, 226, 189, 15, - 38, 12, 217, 158, 130, 39, 124, 127, 135, 247, 247, 162, 253, 21, 120, - 133, 87, 97, 11, 174, 209, 239, 230, 85, 225, 157, 172, 171, 10, 251, - 7, 158, 240, 203, 90, 87, 225, 157, 44, 5, 30, 247, 85, 72, 199, - 255, 88, 133, 119, 178, 174, 220, 241, 78, 22, 240, 10, 190, 251, 223, - 125, 240, 192, 97, 35, 163, 106, 227, 252, 213, 245, 250, 108, 168, 91, - 190, 243, 76, 190, 42, 150, 207, 52, 72, 244, 27, 17, 25, 116, 35, - 138, 177, 65, 77, 69, 39, 76, 215, 199, 32, 115, 68, 228, 240, 254, - 191, 96, 209, 4, 152, 12, 217, 118, 22, 96, 177, 26, 50, 89, 64, - 146, 209, 106, 67, 2, 86, 210, 206, 178, 89, 14, 155, 206, 178, 88, - 118, 186, 209, 132, 3, 236, 112, 14, 113, 57, 196, 161, 82, 150, 81, - 143, 130, 198, 4, 102, 210, 165, 27, 38, 5, 119, 155, 204, 50, 108, - 44, 41, 77, 151, 204, 44, 58, 61, 163, 139, 70, 125, 66, 154, 57, - 49, 149, 80, 211, 12, 122, 12, 68, 44, 26, 212, 35, 112, 50, 179, - 155, 237, 44, 49, 195, 154, 105, 160, 35, 227, 229, 236, 57, 22, 3, - 179, 165, 152, 179, 82, 13, 57, 204, 98, 182, 81, 25, 67, 154, 33, - 157, 241, 11, 86, 116, 139, 99, 4, 88, 13, 73, 84, 130, 46, 217, - 236, 214, 73, 33, 193, 147, 69, 222, 56, 157, 131, 101, 234, 210, 152, - 212, 174, 209, 98, 70, 227, 86, 115, 58, 65, 81, 29, 91, 90, 134, - 213, 146, 194, 116, 137, 60, 21, 16, 96, 75, 180, 26, 45, 118, 27, - 10, 81, 191, 145, 45, 102, 80, 113, 137, 195, 8, 77, 6, 150, 102, - 48, 1, 19, 135, 0, 26, 1, 31, 165, 141, 153, 232, 146, 141, 137, - 199, 0, 180, 156, 198, 2, 108, 134, 180, 52, 234, 68, 34, 3, 151, - 200, 2, 50, 76, 122, 115, 92, 66, 70, 18, 227, 12, 13, 138, 51, - 28, 42, 209, 156, 110, 161, 137, 97, 188, 231, 54, 131, 33, 149, 233, - 173, 186, 172, 233, 102, 244, 55, 197, 156, 166, 103, 137, 105, 70, 139, - 13, 35, 166, 179, 193, 164, 103, 38, 131, 157, 146, 56, 81, 10, 24, - 54, 94, 129, 87, 71, 5, 51, 161, 74, 231, 32, 38, 246, 31, 157, - 195, 60, 192, 73, 165, 99, 54, 168, 31, 1, 233, 70, 75, 186, 206, - 50, 41, 8, 50, 48, 167, 50, 18, 116, 146, 149, 198, 68, 220, 180, - 12, 93, 154, 209, 158, 195, 236, 22, 93, 178, 129, 79, 9, 38, 34, - 193, 136, 198, 178, 173, 6, 11, 203, 161, 131, 61, 139, 250, 96, 207, - 162, 46, 208, 165, 68, 179, 222, 64, 50, 177, 240, 114, 1, 22, 93, - 98, 170, 65, 79, 2, 103, 118, 67, 118, 162, 153, 161, 49, 187, 116, - 52, 25, 146, 249, 44, 234, 185, 64, 3, 204, 9, 83, 13, 137, 152, - 97, 148, 99, 22, 171, 121, 170, 120, 204, 225, 199, 233, 84, 195, 66, - 191, 41, 99, 78, 178, 77, 10, 153, 204, 231, 136, 206, 40, 204, 59, - 150, 136, 113, 90, 211, 209, 118, 26, 179, 50, 192, 50, 76, 158, 33, - 41, 46, 19, 209, 7, 46, 37, 233, 18, 153, 201, 108, 165, 19, 114, - 232, 20, 144, 162, 51, 233, 209, 169, 0, 11, 151, 96, 128, 205, 78, - 103, 27, 179, 81, 95, 108, 84, 10, 50, 164, 163, 221, 74, 163, 177, - 101, 164, 161, 103, 137, 152, 26, 70, 74, 199, 149, 172, 67, 128, 222, - 108, 180, 119, 236, 208, 17, 92, 162, 46, 45, 45, 1, 67, 165, 84, - 166, 193, 106, 51, 154, 77, 76, 199, 160, 111, 124, 104, 188, 74, 80, - 143, 201, 152, 243, 116, 29, 169, 70, 130, 97, 18, 82, 72, 216, 39, - 117, 155, 140, 255, 197, 102, 209, 69, 196, 35, 57, 140, 174, 163, 73, - 36, 141, 54, 3, 151, 166, 61, 195, 154, 144, 1, 53, 22, 23, 125, - 162, 217, 100, 183, 210, 138, 228, 35, 73, 166, 67, 2, 29, 48, 203, - 118, 106, 123, 186, 65, 172, 170, 55, 88, 236, 41, 34, 203, 225, 209, - 158, 56, 87, 86, 179, 133, 47, 98, 98, 114, 220, 12, 95, 209, 98, - 14, 24, 18, 176, 65, 103, 231, 50, 166, 51, 108, 2, 73, 152, 235, - 134, 13, 66, 72, 2, 38, 179, 209, 124, 36, 25, 13, 113, 124, 88, - 152, 96, 76, 103, 90, 70, 178, 145, 43, 115, 2, 178, 12, 166, 76, - 170, 162, 207, 176, 210, 56, 49, 103, 36, 33, 190, 142, 179, 153, 193, - 100, 176, 38, 231, 48, 189, 17, 3, 177, 97, 162, 68, 173, 7, 195, - 85, 130, 165, 232, 140, 38, 59, 2, 52, 123, 16, 29, 130, 25, 148, - 85, 44, 161, 75, 183, 192, 42, 232, 244, 114, 29, 152, 108, 200, 205, - 12, 247, 14, 88, 172, 89, 126, 53, 69, 151, 102, 182, 217, 161, 159, - 1, 233, 200, 157, 212, 107, 50, 163, 153, 181, 89, 12, 137, 86, 126, - 76, 230, 199, 4, 150, 110, 180, 90, 233, 144, 76, 135, 4, 166, 75, - 79, 176, 210, 129, 115, 201, 116, 96, 134, 116, 250, 89, 95, 147, 88, - 1, 243, 206, 116, 105, 150, 20, 29, 131, 213, 225, 57, 108, 58, 77, - 6, 211, 233, 245, 44, 149, 132, 144, 2, 141, 195, 218, 213, 7, 241, - 99, 48, 31, 113, 48, 89, 8, 43, 202, 98, 169, 192, 20, 144, 133, - 72, 100, 86, 104, 51, 21, 231, 99, 224, 215, 197, 241, 101, 36, 120, - 114, 18, 204, 102, 18, 115, 114, 2, 172, 7, 214, 65, 156, 104, 18, - 33, 86, 190, 68, 226, 72, 227, 232, 156, 70, 115, 2, 43, 27, 68, - 170, 106, 194, 140, 27, 249, 47, 16, 179, 164, 20, 234, 102, 26, 173, - 170, 164, 20, 62, 209, 217, 57, 252, 34, 211, 231, 64, 221, 73, 22, - 162, 177, 238, 222, 125, 50, 231, 76, 25, 48, 87, 54, 40, 179, 129, - 219, 43, 115, 26, 228, 110, 201, 166, 67, 14, 29, 166, 51, 200, 146, - 40, 152, 217, 176, 32, 179, 57, 23, 0, 45, 230, 138, 141, 35, 230, - 141, 155, 94, 146, 42, 166, 158, 95, 130, 180, 9, 8, 22, 152, 214, - 171, 213, 108, 167, 83, 150, 81, 26, 46, 250, 171, 151, 116, 214, 158, - 130, 188, 20, 44, 31, 42, 72, 133, 116, 88, 183, 140, 86, 59, 105, - 78, 74, 16, 75, 193, 60, 6, 177, 36, 28, 67, 88, 138, 17, 157, - 167, 162, 180, 120, 184, 102, 233, 236, 113, 38, 43, 179, 152, 236, 182, - 12, 126, 204, 4, 182, 205, 156, 150, 33, 158, 50, 153, 217, 138, 134, - 50, 196, 83, 38, 55, 217, 25, 252, 8, 47, 151, 138, 133, 135, 90, - 226, 25, 233, 4, 244, 61, 193, 48, 221, 206, 76, 88, 119, 196, 102, - 194, 54, 113, 195, 4, 163, 37, 122, 41, 24, 54, 172, 173, 0, 114, - 27, 9, 228, 40, 205, 86, 216, 54, 202, 227, 174, 193, 144, 201, 27, - 197, 48, 245, 40, 133, 106, 65, 116, 192, 172, 193, 28, 26, 248, 188, - 19, 71, 230, 140, 116, 65, 92, 2, 41, 8, 46, 153, 168, 227, 217, - 230, 36, 150, 3, 10, 32, 235, 147, 164, 75, 55, 166, 229, 112, 135, - 26, 144, 153, 132, 165, 207, 103, 62, 145, 79, 44, 157, 116, 122, 43, - 183, 185, 48, 86, 92, 61, 144, 13, 11, 100, 39, 227, 67, 141, 90, - 117, 22, 172, 16, 123, 186, 206, 150, 202, 50, 131, 88, 102, 48, 203, - 12, 97, 153, 221, 152, 37, 195, 132, 235, 162, 185, 206, 200, 148, 150, - 39, 4, 69, 19, 106, 50, 115, 211, 138, 205, 12, 164, 104, 39, 219, - 29, 192, 93, 0, 150, 117, 90, 134, 157, 27, 86, 76, 117, 150, 129, - 91, 163, 0, 125, 22, 181, 41, 165, 48, 110, 76, 47, 169, 127, 34, - 7, 193, 145, 252, 113, 82, 18, 55, 237, 233, 88, 33, 64, 209, 139, - 39, 187, 120, 74, 231, 221, 13, 208, 139, 167, 116, 82, 150, 0, 120, - 114, 99, 98, 106, 14, 159, 115, 248, 69, 210, 139, 0, 51, 172, 182, - 45, 35, 221, 44, 89, 110, 180, 201, 235, 219, 210, 205, 102, 73, 117, - 176, 118, 244, 198, 76, 110, 63, 225, 46, 68, 253, 178, 39, 113, 109, - 200, 226, 81, 67, 6, 63, 102, 242, 99, 22, 154, 196, 26, 230, 209, - 11, 124, 143, 184, 18, 200, 174, 91, 164, 137, 196, 57, 136, 14, 193, - 116, 8, 161, 3, 173, 77, 41, 194, 128, 252, 161, 186, 228, 173, 172, - 180, 8, 3, 116, 226, 138, 11, 128, 75, 55, 144, 71, 206, 50, 91, - 185, 7, 74, 208, 33, 141, 160, 33, 9, 94, 64, 90, 2, 102, 88, - 113, 58, 235, 221, 62, 76, 47, 45, 10, 184, 91, 242, 7, 76, 239, - 102, 204, 9, 30, 15, 33, 182, 103, 52, 101, 74, 105, 76, 19, 196, - 106, 19, 165, 196, 205, 58, 4, 46, 250, 104, 234, 17, 231, 50, 44, - 238, 11, 89, 176, 201, 88, 215, 60, 137, 115, 166, 81, 172, 146, 96, - 206, 144, 188, 175, 62, 195, 130, 238, 211, 49, 41, 137, 78, 228, 212, - 113, 34, 75, 108, 75, 162, 31, 52, 135, 147, 132, 14, 97, 101, 195, - 214, 144, 226, 66, 111, 173, 118, 35, 204, 63, 220, 46, 228, 96, 135, - 241, 215, 103, 164, 167, 231, 196, 5, 49, 171, 187, 12, 13, 144, 108, - 162, 30, 58, 99, 207, 166, 120, 138, 132, 11, 127, 14, 11, 142, 104, - 197, 12, 31, 203, 125, 153, 57, 45, 13, 54, 128, 174, 99, 224, 148, - 155, 70, 161, 137, 197, 12, 125, 72, 72, 144, 103, 9, 142, 132, 151, - 33, 169, 37, 67, 88, 124, 4, 110, 38, 24, 38, 218, 104, 195, 138, - 48, 91, 140, 137, 3, 36, 3, 40, 42, 160, 9, 50, 35, 103, 2, - 147, 101, 20, 253, 108, 138, 25, 70, 31, 135, 100, 58, 36, 208, 33, - 149, 77, 55, 64, 165, 113, 72, 166, 67, 2, 29, 82, 201, 252, 167, - 98, 253, 217, 236, 146, 37, 52, 219, 50, 172, 6, 150, 108, 197, 252, - 33, 42, 34, 145, 19, 19, 101, 206, 30, 173, 211, 27, 17, 237, 218, - 82, 115, 56, 62, 218, 49, 242, 198, 104, 22, 233, 204, 87, 56, 49, - 41, 70, 238, 3, 172, 252, 152, 204, 143, 9, 252, 152, 202, 143, 162, - 7, 0, 3, 167, 44, 90, 5, 240, 50, 131, 94, 112, 103, 206, 244, - 8, 130, 72, 62, 230, 36, 146, 15, 78, 228, 195, 233, 4, 93, 78, - 129, 191, 162, 224, 1, 188, 17, 209, 0, 143, 8, 69, 183, 1, 229, - 77, 193, 82, 177, 200, 28, 133, 9, 8, 152, 16, 11, 162, 48, 50, - 37, 55, 2, 95, 142, 131, 17, 150, 28, 28, 14, 70, 186, 76, 37, - 105, 46, 177, 72, 147, 13, 38, 44, 59, 216, 126, 30, 125, 232, 210, - 81, 202, 150, 205, 108, 136, 91, 40, 28, 48, 208, 1, 222, 32, 25, - 125, 160, 104, 129, 135, 123, 60, 108, 16, 131, 230, 12, 30, 180, 24, - 244, 201, 134, 209, 252, 56, 144, 31, 163, 88, 18, 92, 15, 98, 84, - 3, 10, 101, 91, 200, 87, 231, 240, 99, 146, 213, 48, 141, 51, 52, - 30, 49, 166, 207, 182, 37, 166, 176, 28, 58, 100, 235, 96, 159, 114, - 232, 144, 77, 139, 214, 134, 58, 252, 100, 211, 37, 33, 226, 129, 118, - 147, 173, 135, 17, 54, 81, 160, 13, 20, 10, 204, 141, 233, 124, 54, - 160, 96, 92, 127, 220, 33, 174, 77, 178, 203, 220, 185, 115, 78, 111, - 22, 199, 102, 182, 65, 201, 173, 182, 56, 155, 65, 236, 54, 133, 37, - 192, 179, 167, 35, 32, 163, 179, 88, 138, 56, 138, 1, 232, 108, 20, - 179, 200, 59, 163, 25, 113, 127, 3, 173, 20, 153, 36, 106, 94, 100, - 211, 205, 153, 70, 137, 69, 0, 153, 110, 192, 196, 5, 192, 110, 32, - 210, 15, 160, 232, 74, 52, 29, 56, 82, 76, 19, 144, 108, 53, 103, - 88, 104, 43, 129, 101, 67, 122, 29, 144, 132, 42, 136, 176, 80, 24, - 162, 48, 154, 25, 223, 39, 136, 177, 19, 102, 138, 229, 80, 136, 111, - 37, 171, 203, 157, 14, 31, 52, 154, 203, 242, 88, 20, 74, 121, 236, - 137, 5, 43, 80, 97, 109, 200, 39, 203, 215, 168, 164, 219, 38, 209, - 21, 11, 207, 33, 151, 174, 75, 19, 57, 93, 14, 15, 188, 18, 17, - 212, 241, 173, 150, 206, 74, 150, 133, 161, 139, 188, 91, 201, 86, 35, - 109, 87, 200, 193, 129, 210, 179, 89, 58, 4, 154, 141, 109, 64, 142, - 153, 226, 23, 30, 140, 242, 179, 142, 199, 53, 57, 82, 58, 71, 74, - 147, 216, 101, 38, 135, 163, 137, 187, 44, 106, 60, 1, 30, 9, 151, - 160, 85, 217, 210, 25, 110, 35, 33, 25, 19, 14, 187, 203, 123, 168, - 103, 220, 181, 96, 153, 51, 238, 6, 129, 46, 70, 12, 217, 252, 100, - 52, 241, 62, 34, 201, 207, 80, 66, 216, 35, 150, 106, 64, 152, 133, - 77, 41, 157, 117, 60, 244, 227, 44, 47, 98, 53, 243, 86, 51, 131, - 245, 36, 0, 163, 157, 92, 45, 136, 130, 1, 84, 161, 20, 204, 31, - 84, 204, 142, 117, 202, 18, 225, 175, 48, 43, 140, 162, 43, 152, 24, - 62, 61, 36, 70, 218, 174, 225, 76, 243, 150, 14, 243, 148, 32, 30, - 205, 188, 211, 169, 22, 51, 0, 224, 251, 80, 129, 118, 56, 180, 101, - 165, 157, 176, 168, 4, 36, 213, 108, 126, 164, 189, 130, 53, 135, 199, - 152, 105, 226, 34, 231, 187, 60, 113, 187, 107, 225, 209, 25, 109, 189, - 210, 200, 130, 144, 191, 228, 219, 48, 163, 61, 77, 220, 159, 235, 141, - 86, 73, 39, 145, 63, 169, 23, 237, 0, 147, 40, 146, 182, 242, 16, - 195, 36, 45, 89, 88, 157, 180, 12, 132, 116, 180, 183, 151, 55, 238, - 86, 131, 157, 246, 213, 52, 38, 178, 131, 216, 1, 33, 39, 195, 106, - 74, 202, 48, 37, 210, 30, 40, 128, 174, 88, 152, 217, 108, 33, 33, - 217, 140, 124, 173, 5, 112, 179, 64, 198, 1, 195, 66, 199, 121, 100, - 193, 239, 203, 241, 208, 10, 61, 20, 21, 75, 148, 45, 133, 58, 113, - 80, 155, 180, 20, 49, 178, 176, 24, 179, 227, 160, 124, 113, 124, 3, - 110, 207, 182, 75, 114, 2, 71, 183, 152, 3, 44, 57, 113, 100, 234, - 56, 99, 200, 228, 174, 25, 28, 100, 96, 23, 253, 154, 232, 250, 116, - 153, 6, 238, 202, 236, 134, 116, 11, 13, 191, 7, 166, 129, 26, 114, - 243, 98, 56, 234, 78, 81, 175, 50, 220, 9, 218, 217, 32, 67, 153, - 180, 25, 166, 201, 201, 28, 123, 138, 217, 228, 78, 217, 72, 251, 221, - 9, 105, 63, 104, 147, 125, 149, 141, 235, 35, 95, 222, 100, 80, 56, - 3, 239, 174, 19, 23, 60, 95, 68, 220, 222, 219, 105, 147, 164, 207, - 22, 249, 28, 226, 115, 152, 184, 20, 196, 117, 192, 75, 98, 42, 69, - 179, 9, 134, 108, 40, 87, 35, 114, 247, 32, 93, 170, 157, 223, 153, - 201, 164, 72, 25, 209, 35, 246, 7, 136, 255, 2, 16, 0, 6, 32, - 2, 12, 224, 197, 3, 16, 119, 34, 224, 48, 100, 160, 233, 148, 105, - 48, 64, 70, 147, 148, 202, 154, 70, 24, 30, 155, 64, 5, 41, 224, - 68, 38, 157, 40, 41, 181, 195, 121, 131, 85, 50, 172, 118, 143, 193, - 193, 181, 108, 58, 228, 240, 18, 113, 182, 44, 4, 163, 156, 51, 144, - 221, 165, 43, 98, 30, 49, 98, 22, 93, 5, 4, 191, 117, 33, 178, - 124, 13, 113, 179, 7, 45, 163, 60, 90, 80, 201, 6, 113, 223, 141, - 138, 202, 36, 93, 38, 45, 232, 216, 33, 211, 108, 212, 75, 5, 202, - 103, 240, 225, 98, 178, 245, 50, 128, 156, 226, 253, 230, 234, 157, 97, - 228, 75, 72, 188, 141, 35, 121, 37, 218, 210, 192, 206, 113, 223, 64, - 235, 64, 186, 233, 67, 81, 99, 55, 178, 224, 54, 67, 16, 29, 130, - 233, 16, 194, 32, 13, 189, 217, 196, 111, 44, 96, 69, 114, 80, 210, - 7, 190, 200, 172, 217, 160, 28, 177, 42, 101, 144, 136, 160, 74, 162, - 156, 197, 35, 13, 26, 242, 230, 235, 145, 210, 112, 42, 144, 21, 114, - 68, 38, 93, 151, 152, 66, 203, 64, 220, 225, 243, 18, 124, 199, 101, - 32, 173, 195, 153, 124, 19, 133, 201, 220, 95, 138, 93, 224, 67, 225, - 183, 207, 96, 33, 147, 2, 249, 145, 119, 120, 154, 120, 228, 253, 158, - 22, 130, 192, 108, 154, 164, 135, 34, 99, 225, 55, 29, 209, 4, 44, - 10, 173, 38, 110, 101, 48, 26, 126, 203, 9, 97, 173, 184, 156, 16, - 86, 240, 190, 99, 203, 75, 55, 90, 40, 34, 68, 244, 74, 71, 132, - 167, 60, 80, 32, 51, 38, 37, 121, 52, 140, 184, 49, 81, 140, 235, - 40, 234, 48, 233, 16, 125, 144, 150, 138, 91, 122, 132, 120, 226, 54, - 144, 70, 194, 221, 14, 213, 225, 97, 111, 138, 49, 77, 79, 140, 168, - 151, 4, 139, 16, 131, 20, 132, 74, 82, 207, 176, 113, 16, 55, 254, - 48, 199, 54, 38, 25, 15, 19, 98, 46, 115, 22, 109, 216, 209, 65, - 88, 124, 222, 35, 244, 156, 239, 221, 41, 250, 183, 88, 13, 10, 239, - 71, 238, 221, 227, 39, 197, 158, 80, 21, 168, 165, 89, 12, 17, 204, - 180, 167, 33, 247, 193, 131, 44, 233, 182, 25, 122, 153, 158, 32, 174, - 107, 92, 12, 225, 251, 158, 100, 233, 204, 131, 209, 116, 76, 191, 45, - 205, 204, 55, 76, 220, 87, 100, 99, 71, 238, 137, 80, 41, 135, 162, - 91, 218, 96, 73, 230, 141, 16, 221, 60, 76, 1, 44, 64, 0, 217, - 68, 186, 141, 151, 68, 13, 33, 108, 227, 231, 116, 115, 134, 205, 16, - 135, 136, 194, 16, 103, 53, 112, 67, 72, 119, 123, 232, 10, 212, 206, - 150, 102, 148, 78, 113, 162, 109, 149, 18, 8, 219, 36, 206, 144, 35, - 115, 114, 94, 10, 65, 80, 85, 210, 118, 27, 2, 65, 152, 116, 140, - 54, 93, 202, 166, 218, 18, 135, 218, 110, 78, 206, 75, 193, 254, 134, - 240, 109, 8, 12, 245, 54, 66, 181, 81, 35, 6, 202, 51, 80, 158, - 129, 242, 12, 200, 75, 162, 114, 73, 84, 46, 137, 202, 37, 241, 114, - 54, 125, 10, 56, 58, 80, 141, 36, 170, 145, 68, 53, 146, 168, 6, - 228, 71, 141, 227, 200, 121, 3, 231, 169, 150, 137, 208, 77, 132, 110, - 202, 2, 161, 54, 229, 36, 81, 78, 18, 114, 146, 40, 199, 12, 95, - 23, 20, 220, 11, 138, 135, 64, 138, 51, 220, 253, 137, 89, 70, 41, - 75, 188, 241, 141, 164, 196, 137, 158, 211, 76, 62, 131, 132, 164, 75, - 163, 57, 98, 208, 69, 76, 8, 229, 75, 215, 113, 129, 79, 150, 24, - 0, 199, 97, 30, 40, 0, 21, 79, 113, 146, 42, 74, 41, 110, 108, - 168, 42, 221, 59, 227, 53, 137, 129, 30, 27, 249, 125, 56, 126, 206, - 145, 90, 71, 236, 153, 38, 222, 99, 19, 91, 140, 147, 235, 208, 21, - 44, 26, 40, 53, 178, 220, 146, 15, 72, 164, 37, 225, 185, 245, 200, - 232, 230, 113, 0, 15, 41, 2, 192, 114, 134, 246, 233, 226, 182, 132, - 116, 151, 124, 121, 0, 48, 41, 130, 225, 102, 152, 14, 193, 244, 248, - 34, 217, 96, 31, 225, 222, 24, 219, 205, 201, 201, 105, 6, 57, 137, - 74, 25, 34, 135, 30, 43, 19, 88, 17, 70, 93, 154, 92, 142, 22, - 56, 173, 53, 43, 221, 69, 75, 163, 157, 3, 236, 53, 67, 56, 15, - 61, 52, 80, 104, 79, 27, 66, 121, 247, 141, 234, 50, 79, 101, 196, - 200, 129, 34, 160, 145, 226, 253, 97, 104, 60, 157, 121, 129, 4, 179, - 62, 71, 220, 179, 103, 164, 65, 213, 105, 179, 64, 243, 66, 203, 3, - 203, 58, 64, 60, 27, 77, 60, 252, 163, 139, 193, 140, 246, 239, 162, - 132, 211, 115, 96, 118, 113, 209, 146, 97, 231, 143, 22, 108, 98, 105, - 68, 77, 33, 244, 36, 64, 76, 209, 196, 128, 232, 214, 142, 190, 59, - 183, 24, 124, 171, 47, 198, 217, 60, 72, 53, 98, 59, 79, 251, 7, - 216, 88, 61, 197, 75, 201, 220, 32, 83, 130, 143, 208, 125, 63, 36, - 88, 230, 96, 98, 77, 122, 184, 135, 0, 30, 36, 96, 188, 169, 134, - 68, 179, 5, 145, 28, 191, 243, 170, 167, 251, 14, 250, 73, 65, 212, - 65, 3, 173, 243, 113, 20, 80, 163, 5, 50, 31, 60, 156, 229, 19, - 194, 173, 167, 116, 63, 129, 243, 210, 45, 4, 90, 222, 58, 180, 226, - 169, 131, 201, 206, 72, 187, 35, 75, 175, 55, 232, 43, 43, 105, 182, - 167, 24, 172, 212, 60, 172, 30, 249, 113, 168, 14, 78, 100, 233, 41, - 32, 231, 113, 28, 140, 32, 120, 169, 101, 200, 221, 205, 33, 38, 16, - 123, 64, 55, 167, 68, 142, 180, 203, 106, 4, 0, 221, 24, 129, 117, - 139, 131, 54, 197, 5, 201, 28, 221, 20, 53, 235, 220, 185, 30, 30, - 106, 103, 142, 134, 70, 200, 250, 19, 96, 55, 75, 162, 39, 113, 199, - 144, 86, 39, 195, 10, 39, 98, 2, 210, 176, 103, 226, 240, 180, 129, - 21, 109, 59, 111, 94, 230, 225, 45, 165, 4, 114, 185, 167, 161, 28, - 206, 240, 108, 49, 11, 222, 139, 130, 94, 8, 150, 159, 3, 232, 168, - 75, 179, 241, 93, 25, 109, 29, 233, 44, 62, 21, 9, 224, 55, 78, - 249, 237, 40, 242, 60, 196, 208, 253, 77, 29, 127, 162, 68, 30, 0, - 110, 147, 223, 11, 193, 58, 147, 166, 134, 183, 195, 239, 251, 240, 172, - 32, 73, 144, 65, 242, 53, 145, 35, 31, 238, 174, 65, 188, 52, 137, - 238, 193, 72, 0, 138, 71, 6, 226, 141, 92, 43, 53, 75, 12, 38, - 128, 223, 54, 166, 4, 73, 73, 7, 149, 32, 85, 162, 187, 136, 210, - 189, 150, 0, 186, 217, 194, 55, 147, 20, 211, 27, 249, 67, 138, 0, - 76, 60, 221, 183, 7, 182, 123, 52, 124, 103, 66, 207, 190, 232, 44, - 46, 92, 189, 24, 61, 195, 185, 26, 164, 123, 79, 110, 221, 163, 218, - 18, 47, 173, 58, 186, 65, 79, 119, 12, 161, 229, 113, 162, 138, 103, - 154, 177, 129, 32, 189, 54, 153, 248, 95, 5, 176, 67, 165, 50, 68, - 185, 89, 232, 109, 92, 210, 158, 184, 100, 56, 64, 146, 152, 200, 144, - 238, 232, 232, 54, 131, 180, 123, 226, 235, 114, 82, 207, 201, 76, 188, - 106, 182, 160, 9, 171, 251, 182, 147, 152, 114, 171, 50, 51, 97, 183, - 66, 237, 218, 248, 34, 69, 239, 229, 12, 10, 192, 177, 66, 41, 114, - 10, 72, 38, 91, 199, 183, 108, 201, 210, 131, 39, 158, 195, 111, 228, - 209, 83, 72, 138, 51, 184, 43, 231, 174, 151, 162, 70, 126, 79, 84, - 103, 76, 163, 51, 162, 29, 143, 36, 224, 174, 61, 9, 186, 249, 98, - 47, 23, 74, 40, 2, 139, 4, 132, 132, 28, 52, 145, 30, 111, 136, - 240, 6, 91, 16, 29, 184, 129, 8, 225, 227, 21, 227, 47, 29, 177, - 208, 69, 126, 66, 175, 96, 50, 12, 38, 190, 214, 165, 199, 47, 210, - 189, 68, 108, 117, 68, 69, 73, 227, 61, 11, 128, 242, 64, 138, 180, - 50, 104, 254, 40, 60, 225, 83, 109, 35, 195, 41, 26, 116, 190, 170, - 166, 211, 146, 158, 158, 46, 190, 77, 19, 51, 33, 186, 255, 139, 244, - 188, 159, 158, 94, 100, 240, 35, 182, 155, 88, 10, 25, 226, 137, 98, - 147, 52, 51, 100, 151, 193, 143, 124, 177, 98, 222, 51, 48, 195, 140, - 2, 107, 54, 140, 2, 146, 97, 16, 90, 20, 245, 29, 17, 83, 176, - 141, 31, 141, 252, 152, 196, 143, 180, 13, 79, 12, 225, 57, 33, 60, - 39, 132, 231, 116, 227, 57, 221, 120, 78, 55, 172, 83, 204, 63, 29, - 146, 216, 224, 126, 64, 76, 176, 234, 16, 42, 15, 198, 150, 122, 168, - 33, 39, 138, 239, 107, 193, 176, 49, 124, 159, 203, 91, 141, 193, 38, - 109, 24, 137, 148, 24, 22, 205, 159, 55, 14, 32, 119, 220, 87, 188, - 165, 50, 152, 111, 58, 249, 35, 207, 193, 233, 81, 25, 73, 108, 56, - 10, 50, 201, 162, 16, 27, 205, 31, 89, 17, 215, 55, 170, 31, 185, - 203, 190, 244, 44, 49, 10, 129, 42, 235, 111, 202, 28, 14, 87, 58, - 140, 172, 196, 120, 236, 29, 217, 112, 201, 185, 177, 113, 3, 232, 78, - 60, 63, 242, 58, 195, 17, 36, 247, 167, 232, 154, 152, 40, 29, 84, - 38, 138, 84, 46, 202, 156, 205, 162, 12, 211, 99, 208, 91, 244, 40, - 42, 218, 76, 51, 57, 130, 158, 42, 244, 229, 143, 17, 162, 233, 41, - 2, 70, 39, 166, 134, 15, 160, 152, 128, 31, 7, 163, 92, 140, 152, - 236, 103, 160, 123, 172, 227, 197, 232, 33, 138, 54, 21, 82, 214, 56, - 114, 107, 195, 197, 35, 250, 204, 134, 143, 17, 111, 154, 15, 167, 133, - 60, 50, 113, 48, 180, 5, 93, 183, 35, 211, 192, 134, 209, 200, 19, - 196, 122, 3, 249, 93, 132, 132, 72, 241, 150, 117, 66, 52, 221, 178, - 30, 70, 49, 249, 120, 126, 243, 105, 52, 191, 157, 196, 5, 57, 154, - 47, 32, 62, 192, 49, 124, 91, 42, 86, 29, 128, 13, 145, 52, 187, - 81, 3, 233, 70, 203, 56, 236, 218, 67, 250, 241, 83, 112, 63, 54, - 134, 66, 27, 18, 25, 103, 162, 200, 191, 114, 110, 12, 188, 51, 103, - 184, 120, 16, 65, 65, 117, 33, 92, 158, 53, 146, 238, 20, 136, 21, - 185, 188, 56, 203, 37, 58, 22, 110, 19, 253, 102, 9, 99, 196, 125, - 24, 78, 124, 200, 56, 247, 215, 83, 201, 68, 107, 36, 118, 112, 140, - 64, 7, 166, 153, 19, 32, 156, 49, 180, 225, 225, 210, 224, 156, 36, - 97, 222, 60, 118, 153, 252, 246, 101, 127, 186, 109, 3, 85, 238, 47, - 62, 153, 136, 202, 192, 114, 7, 15, 129, 88, 237, 238, 179, 49, 17, - 221, 36, 177, 83, 134, 56, 117, 152, 167, 244, 4, 54, 56, 85, 199, - 202, 117, 120, 140, 33, 141, 244, 172, 31, 162, 195, 145, 38, 140, 147, - 98, 50, 236, 104, 232, 18, 230, 23, 206, 140, 54, 199, 44, 97, 4, - 60, 238, 24, 110, 140, 89, 194, 112, 10, 216, 221, 137, 24, 51, 22, - 157, 59, 1, 253, 78, 48, 235, 172, 122, 119, 218, 93, 223, 157, 238, - 235, 54, 222, 238, 12, 8, 204, 131, 59, 26, 122, 107, 78, 247, 164, - 228, 106, 208, 10, 27, 102, 214, 157, 244, 160, 185, 111, 192, 179, 132, - 254, 217, 216, 6, 217, 8, 154, 114, 209, 50, 191, 169, 33, 242, 145, - 210, 205, 121, 112, 122, 189, 184, 122, 20, 89, 92, 149, 60, 233, 49, - 164, 251, 119, 36, 1, 143, 57, 191, 179, 38, 87, 43, 79, 210, 61, - 86, 79, 206, 157, 21, 160, 87, 158, 132, 168, 132, 138, 180, 188, 149, - 242, 228, 113, 149, 245, 36, 197, 249, 241, 164, 165, 105, 145, 51, 198, - 136, 254, 59, 97, 140, 232, 198, 196, 190, 147, 101, 163, 231, 213, 146, - 30, 243, 225, 112, 92, 178, 69, 98, 15, 137, 227, 89, 238, 88, 37, - 146, 60, 4, 61, 47, 224, 11, 172, 175, 116, 23, 80, 154, 42, 119, - 146, 227, 185, 23, 162, 167, 247, 80, 2, 88, 180, 116, 218, 203, 42, - 51, 99, 232, 201, 78, 140, 89, 153, 53, 218, 76, 78, 121, 152, 49, - 213, 160, 204, 29, 134, 64, 177, 98, 238, 0, 114, 219, 89, 100, 114, - 42, 32, 136, 34, 119, 231, 177, 152, 97, 253, 71, 168, 152, 138, 169, - 241, 207, 71, 250, 87, 3, 254, 161, 6, 254, 249, 240, 163, 31, 171, - 141, 127, 141, 113, 246, 99, 254, 252, 24, 200, 202, 88, 52, 107, 202, - 236, 224, 27, 48, 61, 40, 141, 249, 243, 151, 153, 162, 217, 110, 245, - 78, 22, 173, 106, 204, 22, 168, 178, 217, 65, 214, 141, 249, 169, 34, - 112, 101, 16, 155, 139, 171, 97, 168, 19, 200, 126, 229, 229, 106, 163, - 214, 32, 28, 207, 169, 136, 163, 150, 232, 207, 147, 15, 67, 78, 103, - 22, 129, 84, 182, 234, 28, 235, 128, 242, 53, 52, 11, 52, 253, 192, - 181, 97, 139, 85, 22, 148, 41, 96, 11, 24, 33, 174, 102, 155, 88, - 44, 107, 160, 166, 214, 27, 179, 175, 80, 47, 2, 189, 184, 128, 252, - 166, 232, 85, 99, 92, 101, 172, 23, 35, 140, 77, 64, 44, 21, 191, - 187, 69, 235, 53, 144, 26, 196, 82, 64, 157, 113, 45, 141, 193, 243, - 160, 55, 249, 232, 65, 24, 48, 194, 128, 86, 67, 21, 1, 132, 97, - 44, 27, 165, 155, 2, 163, 27, 40, 13, 184, 84, 127, 53, 242, 44, - 170, 6, 168, 81, 128, 178, 139, 89, 60, 80, 196, 127, 62, 104, 115, - 76, 204, 232, 190, 203, 80, 238, 33, 204, 229, 67, 252, 172, 98, 181, - 192, 215, 228, 164, 1, 190, 56, 203, 106, 86, 141, 213, 145, 231, 187, - 26, 171, 11, 222, 23, 156, 47, 248, 135, 193, 139, 51, 95, 13, 189, - 208, 200, 101, 124, 88, 117, 86, 15, 105, 119, 57, 95, 164, 235, 35, - 237, 46, 91, 3, 233, 71, 100, 9, 138, 229, 169, 100, 3, 126, 244, - 212, 241, 197, 191, 71, 121, 29, 79, 189, 26, 200, 107, 40, 73, 222, - 7, 61, 245, 65, 207, 125, 208, 243, 70, 188, 30, 93, 173, 9, 122, - 8, 84, 11, 163, 172, 129, 20, 3, 169, 192, 215, 102, 77, 48, 18, - 198, 71, 64, 61, 247, 67, 141, 122, 200, 171, 142, 107, 245, 65, 143, - 224, 90, 3, 16, 181, 216, 144, 95, 123, 76, 186, 70, 232, 141, 192, - 169, 81, 90, 141, 92, 186, 246, 56, 80, 31, 71, 233, 199, 129, 237, - 139, 35, 225, 169, 33, 3, 53, 107, 6, 106, 206, 203, 212, 100, 45, - 144, 83, 155, 99, 60, 14, 125, 100, 172, 37, 242, 91, 161, 124, 107, - 96, 182, 1, 82, 91, 92, 107, 39, 213, 105, 15, 234, 0, 234, 136, - 84, 53, 228, 7, 128, 239, 4, 234, 12, 234, 194, 241, 154, 35, 191, - 57, 80, 154, 243, 183, 227, 186, 34, 239, 9, 80, 32, 90, 169, 195, - 219, 96, 44, 8, 233, 96, 80, 8, 240, 187, 161, 92, 119, 80, 15, - 164, 123, 130, 122, 225, 122, 111, 156, 251, 128, 66, 209, 183, 48, 244, - 136, 230, 62, 28, 164, 149, 234, 137, 125, 110, 137, 249, 33, 60, 177, - 95, 52, 46, 1, 20, 129, 126, 71, 130, 162, 64, 125, 65, 253, 64, - 253, 65, 3, 64, 3, 65, 131, 248, 120, 154, 177, 193, 24, 97, 125, - 169, 63, 143, 98, 164, 67, 48, 210, 161, 160, 97, 192, 24, 46, 225, - 141, 0, 141, 4, 69, 131, 70, 129, 70, 131, 198, 128, 98, 64, 99, - 209, 143, 113, 160, 241, 232, 95, 44, 16, 27, 34, 111, 2, 104, 34, - 104, 18, 232, 73, 204, 216, 100, 204, 214, 20, 224, 199, 209, 27, 213, - 244, 198, 52, 40, 1, 125, 72, 4, 233, 81, 198, 0, 74, 2, 159, - 12, 74, 1, 25, 65, 83, 65, 169, 160, 52, 80, 58, 200, 132, 217, - 174, 203, 251, 88, 147, 153, 233, 77, 86, 208, 52, 180, 107, 5, 217, - 144, 103, 71, 153, 12, 80, 38, 40, 11, 121, 217, 200, 203, 193, 121, - 58, 159, 167, 142, 92, 63, 149, 248, 51, 184, 30, 248, 112, 201, 85, - 147, 198, 73, 125, 39, 189, 153, 137, 242, 179, 32, 205, 218, 188, 239, - 173, 88, 46, 40, 15, 229, 243, 165, 57, 126, 74, 158, 91, 31, 54, - 27, 52, 71, 154, 171, 17, 24, 103, 107, 62, 151, 190, 176, 74, 190, - 236, 105, 208, 60, 208, 124, 208, 2, 208, 66, 208, 34, 208, 51, 40, - 187, 24, 180, 4, 180, 84, 106, 219, 141, 187, 12, 180, 28, 180, 2, - 180, 18, 121, 171, 64, 171, 65, 107, 64, 79, 128, 214, 130, 214, 129, - 214, 131, 158, 149, 230, 102, 3, 151, 37, 245, 179, 3, 219, 136, 241, - 108, 66, 223, 55, 227, 250, 22, 104, 99, 83, 133, 110, 60, 199, 231, - 89, 13, 11, 83, 113, 174, 159, 7, 189, 0, 218, 10, 122, 17, 180, - 13, 180, 29, 180, 3, 229, 119, 130, 118, 41, 244, 233, 37, 208, 203, - 160, 221, 200, 223, 3, 122, 5, 173, 239, 149, 245, 169, 11, 159, 197, - 250, 60, 221, 21, 250, 43, 182, 79, 237, 22, 222, 209, 238, 62, 208, - 126, 208, 1, 208, 65, 208, 171, 160, 215, 64, 135, 64, 135, 65, 175, - 131, 142, 128, 138, 64, 197, 160, 18, 144, 3, 228, 4, 185, 64, 111, - 128, 142, 130, 142, 1, 251, 77, 232, 195, 113, 208, 9, 200, 227, 57, - 208, 91, 200, 59, 9, 122, 27, 244, 14, 232, 93, 148, 123, 15, 116, - 10, 244, 62, 232, 3, 122, 91, 22, 180, 7, 244, 33, 232, 35, 148, - 57, 13, 250, 24, 117, 63, 145, 117, 216, 61, 174, 174, 236, 12, 234, - 124, 10, 250, 12, 244, 57, 232, 11, 208, 151, 40, 243, 21, 168, 30, - 31, 247, 19, 176, 95, 226, 58, 250, 26, 244, 13, 174, 127, 43, 201, - 182, 57, 95, 245, 180, 62, 130, 96, 179, 130, 248, 202, 87, 73, 50, - 41, 148, 202, 148, 221, 97, 75, 191, 3, 125, 15, 250, 1, 244, 35, - 232, 39, 208, 207, 160, 39, 64, 191, 112, 157, 246, 133, 191, 243, 101, - 191, 193, 18, 136, 235, 63, 132, 253, 14, 59, 114, 22, 116, 78, 234, - 243, 31, 18, 246, 159, 40, 111, 64, 217, 243, 124, 189, 249, 194, 151, - 249, 178, 139, 160, 191, 64, 127, 195, 242, 144, 13, 254, 7, 116, 9, - 101, 47, 131, 174, 128, 174, 162, 151, 215, 232, 5, 111, 208, 191, 160, - 27, 176, 78, 212, 183, 155, 82, 185, 91, 160, 107, 160, 27, 176, 88, - 245, 65, 12, 228, 30, 211, 109, 158, 47, 182, 205, 84, 106, 166, 2, - 169, 65, 26, 144, 15, 168, 26, 168, 58, 200, 87, 5, 31, 0, 170, - 169, 234, 206, 30, 82, 117, 99, 181, 84, 61, 177, 226, 60, 99, 169, - 173, 162, 177, 180, 99, 117, 84, 237, 88, 93, 21, 141, 169, 23, 123, - 88, 5, 47, 172, 162, 177, 213, 98, 245, 80, 183, 190, 74, 57, 46, - 31, 110, 75, 30, 81, 209, 152, 197, 246, 27, 224, 250, 163, 160, 134, - 160, 70, 138, 126, 208, 90, 234, 6, 34, 95, 208, 24, 215, 154, 128, - 30, 3, 61, 14, 106, 10, 106, 6, 106, 14, 195, 221, 2, 228, 175, - 122, 130, 181, 84, 245, 70, 191, 122, 115, 171, 172, 98, 238, 254, 54, - 98, 173, 64, 173, 85, 162, 175, 105, 131, 115, 91, 80, 59, 80, 123, - 80, 7, 149, 91, 254, 110, 31, 231, 195, 58, 170, 200, 159, 244, 129, - 174, 104, 88, 128, 74, 195, 58, 129, 58, 131, 186, 160, 157, 174, 160, - 219, 104, 225, 9, 156, 253, 96, 245, 201, 103, 6, 168, 124, 80, 198, - 7, 101, 124, 42, 41, 19, 198, 113, 3, 113, 45, 8, 109, 5, 243, - 60, 198, 66, 84, 226, 90, 239, 166, 18, 125, 68, 119, 85, 77, 214, - 67, 21, 206, 125, 126, 79, 180, 223, 75, 165, 133, 62, 10, 72, 135, - 179, 222, 40, 211, 7, 20, 138, 216, 132, 244, 47, 76, 129, 115, 27, - 43, 222, 7, 231, 25, 160, 100, 250, 210, 0, 100, 132, 5, 32, 31, - 26, 174, 234, 139, 113, 121, 100, 165, 85, 185, 245, 206, 45, 159, 154, - 76, 64, 187, 17, 160, 72, 96, 71, 169, 4, 214, 87, 21, 201, 250, - 169, 162, 88, 127, 212, 29, 192, 101, 215, 143, 13, 196, 245, 65, 104, - 191, 29, 104, 176, 234, 78, 61, 85, 179, 33, 210, 28, 14, 229, 50, - 245, 101, 195, 80, 111, 184, 170, 191, 228, 67, 61, 250, 53, 130, 151, - 99, 108, 36, 250, 30, 13, 26, 5, 106, 198, 215, 73, 119, 54, 90, - 229, 238, 215, 0, 30, 35, 145, 157, 31, 195, 231, 166, 29, 139, 81, - 13, 68, 222, 64, 122, 231, 157, 251, 233, 177, 42, 242, 169, 237, 96, - 203, 61, 118, 115, 28, 202, 142, 7, 197, 130, 38, 160, 208, 68, 232, - 227, 36, 208, 147, 178, 78, 210, 28, 12, 98, 147, 85, 131, 217, 20, - 94, 95, 156, 143, 56, 62, 39, 181, 88, 60, 159, 143, 33, 76, 39, - 233, 106, 2, 206, 137, 42, 113, 140, 122, 149, 184, 30, 13, 56, 39, - 129, 146, 65, 41, 32, 163, 202, 151, 199, 142, 110, 251, 48, 21, 237, - 166, 130, 210, 64, 233, 32, 19, 198, 107, 6, 89, 64, 211, 64, 86, - 144, 13, 100, 7, 101, 128, 50, 81, 63, 11, 148, 13, 202, 1, 77, - 7, 205, 0, 205, 4, 205, 2, 229, 130, 242, 128, 147, 15, 122, 10, - 244, 39, 198, 62, 91, 69, 118, 172, 22, 155, 131, 126, 207, 5, 61, - 13, 154, 199, 229, 51, 128, 205, 7, 45, 64, 157, 133, 192, 94, 4, - 122, 6, 124, 16, 230, 99, 49, 104, 137, 74, 180, 71, 75, 81, 126, - 153, 106, 40, 188, 143, 199, 230, 23, 72, 62, 98, 57, 202, 175, 0, - 173, 4, 173, 2, 173, 6, 173, 1, 173, 5, 173, 3, 173, 87, 137, - 118, 255, 117, 201, 246, 63, 11, 204, 13, 200, 219, 8, 218, 4, 218, - 140, 54, 183, 112, 189, 246, 101, 207, 33, 93, 0, 122, 30, 244, 2, - 104, 43, 232, 69, 208, 54, 208, 118, 208, 14, 208, 78, 208, 46, 208, - 75, 168, 243, 50, 104, 55, 104, 15, 232, 21, 21, 217, 119, 146, 27, - 217, 118, 26, 239, 48, 62, 191, 123, 113, 173, 16, 180, 79, 210, 183, - 253, 56, 31, 0, 29, 4, 189, 10, 122, 13, 116, 8, 116, 24, 244, - 58, 48, 142, 0, 187, 8, 84, 12, 42, 81, 13, 199, 90, 29, 142, - 25, 28, 14, 29, 34, 153, 249, 192, 158, 251, 112, 28, 7, 202, 59, - 85, 20, 71, 140, 224, 54, 199, 165, 18, 125, 247, 27, 56, 31, 5, - 29, 227, 237, 137, 114, 122, 19, 116, 28, 116, 2, 244, 22, 232, 36, - 174, 189, 13, 122, 7, 244, 46, 232, 61, 80, 56, 234, 158, 194, 249, - 125, 208, 7, 160, 82, 208, 135, 160, 143, 64, 167, 97, 139, 62, 6, - 125, 2, 254, 12, 232, 83, 208, 103, 160, 207, 65, 95, 128, 190, 148, - 236, 194, 87, 56, 127, 13, 250, 6, 244, 45, 168, 140, 143, 1, 62, - 7, 244, 61, 232, 7, 208, 143, 208, 137, 159, 64, 63, 131, 126, 1, - 253, 170, 26, 201, 119, 63, 245, 177, 54, 126, 131, 140, 127, 71, 250, - 172, 138, 98, 14, 232, 56, 198, 255, 135, 42, 154, 253, 73, 250, 173, - 162, 241, 143, 98, 23, 160, 55, 23, 85, 195, 216, 95, 92, 127, 70, - 192, 126, 208, 92, 143, 134, 189, 162, 58, 20, 15, 186, 109, 44, 108, - 9, 249, 33, 156, 255, 65, 95, 46, 129, 46, 3, 227, 138, 106, 12, - 34, 153, 49, 244, 93, 9, 159, 211, 171, 184, 126, 13, 116, 29, 244, - 47, 232, 6, 232, 38, 201, 159, 124, 17, 234, 220, 150, 100, 199, 212, - 226, 252, 171, 212, 176, 245, 32, 13, 200, 71, 45, 206, 49, 197, 191, - 213, 212, 240, 175, 32, 95, 181, 24, 127, 158, 87, 209, 120, 176, 51, - 66, 153, 154, 160, 135, 64, 181, 64, 181, 65, 117, 64, 117, 65, 15, - 83, 125, 80, 61, 80, 125, 208, 35, 168, 219, 0, 244, 168, 122, 52, - 107, 168, 30, 195, 26, 169, 99, 96, 143, 26, 193, 174, 208, 190, 163, - 33, 107, 172, 110, 200, 154, 128, 30, 67, 153, 199, 65, 77, 65, 205, - 64, 205, 81, 183, 5, 200, 31, 212, 18, 212, 74, 61, 22, 241, 192, - 88, 178, 58, 210, 24, 125, 88, 107, 96, 181, 81, 215, 100, 109, 213, - 181, 88, 59, 181, 103, 207, 209, 30, 229, 59, 128, 58, 130, 2, 212, - 180, 175, 17, 125, 78, 39, 240, 157, 213, 62, 124, 127, 20, 170, 162, - 62, 140, 67, 140, 60, 14, 152, 227, 36, 76, 236, 71, 80, 166, 43, - 199, 133, 223, 83, 139, 117, 8, 43, 16, 237, 4, 225, 28, 140, 105, - 11, 1, 117, 3, 223, 29, 212, 67, 77, 243, 175, 102, 61, 193, 247, - 2, 245, 86, 147, 157, 25, 15, 29, 31, 15, 220, 241, 114, 95, 63, - 97, 30, 204, 191, 201, 143, 168, 99, 209, 126, 44, 202, 196, 202, 101, - 234, 33, 146, 10, 5, 94, 24, 240, 195, 65, 90, 144, 160, 22, 237, - 106, 132, 90, 92, 107, 145, 56, 71, 129, 250, 226, 90, 63, 156, 251, - 171, 41, 6, 87, 179, 1, 56, 15, 68, 31, 7, 225, 60, 88, 61, - 17, 154, 54, 17, 216, 19, 21, 216, 212, 126, 45, 54, 68, 26, 207, - 80, 181, 219, 223, 210, 184, 38, 129, 159, 132, 242, 147, 238, 40, 223, - 138, 13, 83, 139, 250, 214, 71, 45, 174, 7, 170, 59, 28, 52, 130, - 250, 133, 113, 55, 151, 108, 64, 103, 245, 147, 168, 243, 36, 48, 158, - 148, 49, 70, 170, 91, 176, 104, 140, 103, 20, 104, 52, 205, 29, 151, - 129, 15, 27, 3, 138, 1, 238, 88, 200, 125, 28, 104, 60, 250, 29, - 11, 154, 0, 154, 168, 158, 44, 237, 97, 177, 39, 66, 185, 39, 49, - 206, 201, 160, 41, 160, 56, 80, 60, 72, 7, 74, 0, 37, 130, 244, - 192, 53, 168, 197, 125, 105, 18, 202, 207, 82, 77, 65, 63, 196, 189, - 109, 50, 198, 155, 2, 50, 170, 71, 178, 169, 40, 147, 10, 74, 3, - 165, 131, 76, 32, 51, 201, 10, 52, 13, 100, 5, 217, 56, 14, 252, - 2, 206, 25, 234, 56, 196, 112, 113, 124, 39, 166, 2, 101, 170, 107, - 179, 44, 174, 59, 241, 88, 9, 241, 124, 119, 70, 249, 217, 40, 151, - 131, 242, 159, 168, 220, 251, 110, 29, 116, 80, 199, 119, 110, 158, 235, - 113, 108, 58, 104, 134, 122, 10, 155, 137, 178, 179, 64, 185, 160, 60, - 80, 62, 230, 225, 41, 204, 65, 107, 85, 67, 54, 27, 231, 57, 200, - 155, 11, 122, 26, 52, 15, 227, 187, 10, 123, 50, 31, 252, 2, 208, - 66, 164, 23, 129, 158, 1, 45, 6, 45, 65, 222, 82, 208, 50, 208, - 114, 181, 40, 203, 21, 152, 195, 149, 160, 85, 160, 213, 160, 53, 160, - 181, 152, 131, 117, 160, 245, 234, 4, 126, 103, 225, 89, 148, 221, 160, - 38, 187, 231, 195, 54, 170, 19, 249, 157, 166, 77, 106, 218, 203, 38, - 178, 205, 72, 111, 1, 61, 167, 22, 247, 105, 5, 106, 26, 147, 30, - 179, 169, 71, 41, 61, 143, 91, 155, 75, 251, 43, 146, 211, 243, 40, - 251, 2, 250, 178, 21, 229, 95, 4, 109, 227, 229, 13, 252, 206, 203, - 118, 181, 123, 255, 73, 251, 78, 218, 95, 138, 123, 79, 113, 223, 89, - 83, 218, 119, 38, 33, 218, 79, 162, 111, 11, 129, 157, 196, 118, 160, - 142, 251, 94, 134, 184, 215, 19, 239, 5, 236, 4, 238, 46, 208, 75, - 160, 151, 65, 187, 65, 123, 64, 175, 128, 246, 146, 29, 195, 60, 238, - 3, 237, 7, 191, 30, 253, 60, 128, 126, 29, 228, 54, 129, 100, 79, - 123, 117, 236, 153, 112, 253, 53, 181, 1, 251, 190, 36, 118, 72, 157, - 196, 14, 131, 94, 199, 188, 28, 81, 39, 99, 31, 81, 139, 21, 113, - 190, 22, 43, 150, 215, 6, 141, 37, 5, 215, 82, 120, 68, 167, 82, - 220, 55, 40, 225, 243, 109, 196, 220, 25, 121, 164, 87, 241, 154, 184, - 255, 88, 143, 29, 99, 11, 16, 3, 221, 89, 134, 246, 176, 14, 244, - 201, 9, 114, 161, 223, 111, 128, 218, 163, 205, 163, 72, 31, 3, 189, - 9, 58, 14, 58, 1, 122, 11, 116, 18, 244, 54, 232, 29, 208, 187, - 160, 247, 64, 167, 64, 239, 3, 235, 3, 80, 41, 232, 67, 208, 71, - 160, 211, 100, 131, 89, 42, 251, 88, 157, 134, 246, 210, 232, 219, 240, - 74, 219, 79, 69, 253, 116, 208, 39, 106, 49, 246, 63, 131, 243, 167, - 160, 207, 164, 182, 62, 231, 125, 75, 135, 76, 218, 177, 47, 164, 121, - 41, 31, 227, 81, 236, 133, 253, 29, 202, 125, 5, 250, 26, 244, 141, - 90, 220, 31, 215, 99, 38, 72, 216, 132, 182, 77, 60, 14, 166, 249, - 248, 86, 186, 78, 123, 211, 50, 181, 47, 143, 133, 190, 83, 155, 185, - 55, 168, 207, 177, 197, 54, 190, 71, 91, 63, 64, 22, 63, 162, 204, - 79, 160, 159, 65, 191, 128, 126, 5, 253, 6, 250, 29, 116, 22, 116, - 142, 203, 152, 98, 76, 101, 159, 124, 216, 31, 232, 243, 104, 156, 255, - 196, 156, 158, 87, 91, 88, 109, 126, 23, 196, 82, 110, 14, 242, 85, - 180, 247, 242, 236, 37, 47, 0, 239, 162, 186, 49, 251, 11, 237, 254, - 173, 158, 134, 40, 100, 26, 191, 115, 34, 218, 51, 178, 201, 62, 236, - 31, 201, 14, 94, 194, 249, 50, 232, 138, 218, 227, 15, 175, 130, 174, - 129, 174, 131, 254, 5, 221, 0, 221, 4, 221, 2, 221, 6, 193, 193, - 50, 21, 72, 13, 210, 128, 124, 64, 213, 64, 213, 65, 190, 160, 26, - 160, 154, 160, 135, 64, 181, 64, 181, 65, 117, 64, 117, 65, 15, 131, - 252, 64, 245, 64, 245, 65, 143, 128, 26, 128, 30, 5, 53, 4, 53, - 2, 53, 6, 53, 1, 61, 6, 122, 28, 212, 20, 212, 12, 212, 28, - 212, 2, 228, 15, 106, 169, 97, 172, 21, 168, 53, 168, 13, 168, 173, - 198, 202, 218, 129, 218, 107, 124, 88, 7, 80, 71, 80, 0, 168, 19, - 168, 179, 198, 151, 117, 1, 117, 5, 61, 129, 186, 129, 160, 32, 80, - 48, 40, 68, 99, 99, 221, 64, 221, 193, 247, 0, 245, 212, 208, 90, - 105, 195, 122, 105, 200, 7, 217, 177, 154, 232, 99, 89, 187, 180, 79, - 16, 231, 188, 55, 202, 244, 1, 133, 106, 196, 249, 167, 253, 86, 24, - 202, 135, 107, 50, 48, 255, 84, 78, 212, 27, 45, 202, 8, 28, 47, - 147, 239, 65, 220, 242, 162, 123, 13, 125, 212, 89, 124, 159, 53, 22, - 251, 132, 8, 141, 91, 207, 178, 177, 70, 225, 27, 129, 27, 165, 17, - 203, 247, 197, 216, 250, 129, 250, 107, 114, 248, 189, 64, 113, 127, 67, - 245, 24, 27, 128, 252, 129, 154, 233, 168, 35, 166, 7, 161, 206, 96, - 208, 219, 146, 108, 251, 168, 103, 200, 253, 25, 130, 54, 134, 74, 253, - 29, 166, 153, 201, 191, 114, 31, 171, 162, 53, 234, 195, 134, 107, 102, - 49, 95, 169, 220, 80, 92, 24, 1, 26, 169, 17, 49, 62, 65, 123, - 209, 154, 92, 148, 111, 199, 70, 33, 127, 52, 104, 140, 38, 15, 125, - 200, 67, 141, 60, 89, 15, 123, 75, 216, 49, 56, 143, 5, 141, 211, - 184, 199, 233, 222, 95, 229, 179, 241, 26, 113, 237, 197, 226, 218, 4, - 62, 47, 79, 241, 121, 157, 168, 153, 141, 51, 249, 216, 124, 172, 157, - 124, 250, 141, 3, 70, 95, 29, 79, 210, 120, 230, 236, 73, 9, 147, - 218, 153, 172, 81, 115, 63, 62, 69, 227, 198, 158, 3, 236, 60, 22, - 135, 252, 120, 144, 14, 216, 9, 154, 185, 124, 239, 155, 168, 17, 247, - 124, 95, 168, 159, 198, 218, 31, 196, 244, 10, 76, 7, 48, 156, 106, - 81, 174, 6, 228, 39, 97, 142, 146, 113, 78, 1, 133, 34, 207, 136, - 243, 84, 205, 60, 126, 199, 157, 202, 167, 106, 220, 117, 230, 179, 52, - 9, 39, 29, 103, 19, 200, 172, 89, 192, 239, 117, 39, 202, 248, 212, - 102, 95, 102, 209, 136, 243, 58, 13, 249, 86, 210, 123, 182, 144, 223, - 123, 108, 38, 223, 223, 38, 187, 78, 241, 232, 34, 46, 95, 63, 46, - 99, 183, 124, 9, 227, 25, 172, 121, 119, 190, 47, 179, 161, 143, 118, - 141, 184, 167, 188, 32, 237, 43, 105, 31, 153, 129, 188, 76, 80, 22, - 218, 203, 214, 44, 150, 251, 220, 236, 142, 113, 126, 34, 221, 239, 204, - 65, 95, 166, 107, 150, 192, 238, 83, 27, 162, 221, 156, 129, 250, 99, - 84, 100, 215, 220, 122, 130, 189, 163, 102, 41, 90, 17, 211, 111, 75, - 54, 107, 22, 242, 115, 65, 121, 160, 124, 205, 50, 254, 132, 226, 254, - 109, 209, 94, 97, 57, 183, 82, 164, 115, 79, 65, 46, 179, 65, 115, - 128, 49, 23, 244, 52, 215, 187, 21, 92, 15, 231, 97, 220, 243, 185, - 174, 33, 94, 208, 136, 58, 72, 122, 52, 70, 51, 7, 109, 205, 161, - 159, 116, 129, 126, 204, 41, 167, 31, 164, 23, 11, 53, 158, 189, 252, - 23, 234, 81, 252, 62, 9, 237, 131, 23, 1, 255, 25, 208, 98, 208, - 18, 141, 15, 223, 23, 44, 5, 191, 12, 180, 92, 67, 235, 110, 37, - 250, 41, 238, 115, 190, 80, 123, 48, 87, 0, 115, 37, 214, 245, 42, - 13, 237, 133, 17, 135, 128, 95, 163, 169, 197, 218, 171, 250, 178, 181, - 154, 190, 108, 29, 174, 175, 215, 136, 251, 187, 103, 53, 226, 30, 239, - 21, 201, 103, 210, 62, 127, 161, 74, 121, 239, 115, 8, 235, 194, 219, - 168, 201, 54, 160, 205, 141, 146, 12, 55, 225, 188, 25, 180, 5, 244, - 28, 168, 0, 244, 188, 70, 148, 237, 11, 56, 111, 213, 136, 99, 120, - 17, 231, 109, 160, 237, 160, 29, 154, 242, 247, 84, 119, 34, 189, 11, - 125, 123, 73, 211, 149, 189, 140, 185, 219, 13, 106, 135, 118, 246, 104, - 220, 253, 236, 203, 94, 65, 255, 246, 130, 10, 53, 140, 235, 151, 251, - 30, 195, 62, 169, 223, 52, 134, 253, 224, 15, 0, 235, 32, 232, 85, - 140, 249, 53, 62, 214, 249, 210, 30, 144, 238, 195, 175, 98, 135, 52, - 116, 79, 179, 38, 59, 172, 33, 127, 133, 189, 59, 202, 30, 1, 21, - 129, 138, 65, 37, 32, 7, 200, 169, 161, 231, 21, 140, 185, 208, 222, - 27, 154, 213, 210, 115, 26, 95, 118, 20, 215, 142, 129, 222, 68, 91, - 199, 65, 39, 52, 107, 176, 46, 215, 160, 228, 154, 59, 98, 118, 113, - 141, 61, 39, 173, 187, 242, 49, 58, 233, 195, 90, 96, 174, 69, 189, - 181, 220, 6, 137, 251, 107, 248, 120, 21, 233, 192, 186, 255, 235, 236, - 92, 114, 26, 134, 129, 48, 236, 104, 186, 235, 138, 75, 112, 6, 164, - 74, 89, 32, 144, 96, 211, 75, 32, 245, 58, 221, 181, 168, 105, 120, - 174, 56, 73, 161, 45, 239, 247, 155, 2, 226, 28, 124, 191, 39, 9, - 1, 177, 234, 98, 148, 100, 60, 246, 216, 227, 177, 199, 254, 103, 17, - 124, 160, 79, 89, 159, 178, 94, 24, 153, 199, 227, 133, 80, 143, 173, - 117, 60, 103, 30, 140, 230, 47, 54, 243, 131, 189, 28, 216, 102, 208, - 233, 45, 64, 73, 244, 169, 102, 56, 196, 255, 27, 197, 121, 254, 8, - 187, 142, 173, 23, 38, 150, 114, 119, 74, 145, 75, 145, 75, 233, 79, - 51, 76, 139, 253, 226, 24, 27, 157, 64, 167, 133, 191, 42, 62, 44, - 213, 176, 164, 178, 143, 245, 190, 157, 33, 127, 14, 93, 64, 151, 166, - 76, 129, 235, 187, 66, 223, 181, 249, 30, 114, 195, 243, 22, 186, 179, - 1, 235, 99, 160, 223, 139, 196, 188, 98, 55, 113, 61, 37, 14, 215, - 137, 109, 122, 140, 104, 37, 235, 81, 230, 222, 50, 74, 50, 234, 100, - 124, 203, 110, 101, 189, 82, 110, 173, 26, 163, 100, 31, 208, 241, 104, - 67, 244, 40, 127, 58, 172, 238, 166, 79, 166, 57, 212, 28, 11, 63, - 115, 204, 68, 247, 177, 86, 146, 227, 11, 57, 178, 57, 178, 90, 199, - 210, 225, 254, 234, 241, 197, 109, 243, 204, 248, 54, 160, 23, 232, 21, - 122, 179, 45, 90, 94, 12, 51, 222, 223, 25, 219, 7, 54, 252, 180, - 237, 130, 167, 126, 53, 216, 203, 197, 219, 169, 120, 126, 119, 22, 111, - 247, 31, 222, 94, 156, 183, 153, 237, 71, 92, 254, 119, 206, 146, 115, - 28, 122, 190, 108, 181, 189, 178, 172, 60, 240, 55, 121, 216, 88, 60, }; - - *dataSize = 138801; - - // allocate a new array - *data = new unsigned char[138801]; - // and copy it. Now we are certain that the calling function - // can control the memory location - for(int i = 0; i < 138801 /* tmp array size */; i++) - { - (*data)[i] = load_blend[i]; - } - -} - - - diff --git a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h deleted file mode 100644 index 4a1ff4e43fa..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPC_RAWLOADDOTBLENDARRAY_H -#define __GPC_RAWLOADDOTBLENDARRAY_H - -void GetRawLoadingAnimation(unsigned char **data, int *dataSize); - -#endif // __GPC_RAWLOADDOTBLENDARRAY_H - diff --git a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp deleted file mode 100644 index 761e53cf1d3..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp +++ /dev/null @@ -1,1456 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -// This file is automatically generated. Do not edit by hand! - -#include "GPC_RawLogoArrays.h" - -void GetRawBlenderLogo(unsigned char **data, int *width, int *height) -{ - // create an array that will automatically be deleted when) - // we're outta this scope - static unsigned char logo_blender_raw[]= { 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 20, 21, 44, 44, 44, - 45, 26, 26, 26, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12, 12, 124, - 124, 124, 124, 232, 232, 232, 232, 248, 248, 248, 248, 243, 243, 243, 243, - 160, 160, 160, 160, 44, 44, 44, 44, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 13, 13, 13, 13, 172, 172, 172, 173, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 235, - 235, 235, 235, 95, 95, 95, 95, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, 88, 88, 88, - 255, 255, 255, 255, 255, 255, 255, 255, 254, 235, 217, 255, 253, 202, 152, - 255, 253, 216, 183, 255, 255, 250, 246, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 155, 155, 155, 155, 20, 20, 20, 20, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 255, 255, 255, 255, 255, - 249, 245, 255, 250, 162, 78, 255, 250, 145, 40, 255, 250, 149, 49, 255, - 251, 175, 104, 255, 254, 236, 219, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 202, 202, 202, 203, 53, 53, 53, 53, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 113, 113, 113, 113, 255, 255, 255, 255, 255, 253, 253, 255, 251, 196, - 147, 255, 249, 150, 51, 255, 249, 152, 55, 255, 248, 149, 50, 255, 249, - 160, 74, 255, 253, 219, 192, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 236, 236, 236, 236, 90, 90, 90, 90, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 76, 76, - 76, 76, 120, 120, 120, 120, 138, 138, 138, 138, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 163, 163, 163, 164, 196, 196, 196, 198, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 252, 206, 166, - 255, 248, 153, 61, 255, 247, 149, 52, 255, 247, 150, 53, 255, 247, 150, - 54, 255, 251, 196, 150, 255, 255, 249, 246, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 143, 143, 143, 143, 14, 14, 14, 14, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 43, 43, 43, 42, 198, 198, 198, 199, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 253, 226, 203, 255, - 248, 165, 85, 255, 246, 150, 53, 255, 246, 151, 55, 255, 246, 145, 46, - 255, 248, 175, 106, 255, 253, 238, 226, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 189, 189, 189, 189, 39, 39, 39, 39, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 22, 22, 22, 22, 214, 214, 214, 216, 255, - 255, 255, 255, 255, 255, 255, 255, 252, 245, 238, 255, 251, 233, 218, 255, - 251, 231, 215, 255, 251, 232, 216, 255, 251, 232, 216, 255, 252, 232, 216, - 255, 252, 232, 216, 255, 252, 232, 216, 255, 252, 232, 216, 255, 252, 232, - 216, 255, 252, 232, 217, 255, 252, 236, 223, 255, 251, 214, 186, 255, 245, - 156, 72, 255, 245, 150, 54, 255, 245, 151, 56, 255, 245, 146, 48, 255, - 246, 159, 76, 255, 252, 223, 198, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 226, 226, 226, 226, 71, 71, 71, 71, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 93, 93, 93, 255, 255, 255, 255, 253, 253, 252, 255, 248, 209, - 173, 255, 244, 155, 66, 255, 244, 152, 62, 255, 245, 152, 62, 255, 245, - 153, 62, 255, 245, 153, 62, 255, 245, 152, 62, 255, 245, 152, 62, 255, - 245, 152, 62, 255, 245, 152, 62, 255, 245, 152, 62, 255, 245, 152, 62, - 255, 245, 153, 62, 255, 245, 155, 66, 255, 244, 152, 62, 255, 244, 150, - 56, 255, 244, 150, 57, 255, 244, 150, 56, 255, 243, 146, 49, 255, 243, - 147, 54, 255, 249, 203, 162, 255, 254, 253, 254, 255, 255, 255, 255, 255, - 248, 248, 248, 248, 143, 143, 143, 143, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 119, 119, 119, 120, 119, - 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, - 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, - 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, - 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, - 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 118, 118, 118, 120, - 118, 118, 118, 120, 118, 118, 118, 120, 118, 118, 118, 120, 118, 118, 118, - 120, 118, 118, 118, 119, 118, 118, 118, 119, 118, 118, 118, 120, 118, 118, - 118, 119, 111, 111, 111, 112, 75, 75, 75, 75, 20, 20, 20, 20, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125, 125, 125, 126, - 255, 255, 255, 255, 250, 242, 234, 255, 242, 149, 57, 255, 242, 142, 42, - 255, 243, 146, 48, 255, 243, 146, 48, 255, 243, 146, 48, 255, 243, 145, - 48, 255, 243, 145, 48, 255, 243, 147, 51, 255, 244, 149, 55, 255, 244, - 149, 55, 255, 243, 149, 54, 255, 243, 149, 54, 255, 243, 149, 55, 255, - 243, 148, 52, 255, 243, 146, 49, 255, 243, 146, 49, 255, 243, 146, 49, - 255, 243, 147, 52, 255, 242, 149, 55, 255, 242, 147, 52, 255, 241, 142, - 45, 255, 246, 181, 122, 255, 252, 244, 238, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 223, 223, 223, 223, 102, 102, 102, 102, 12, 12, - 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 109, 109, 109, 110, 255, 255, 255, 255, 251, - 251, 250, 255, 245, 194, 149, 255, 243, 166, 90, 255, 243, 167, 95, 255, - 243, 168, 96, 255, 243, 168, 96, 255, 244, 168, 96, 255, 244, 173, 105, - 255, 244, 164, 89, 255, 242, 148, 55, 255, 242, 149, 56, 255, 242, 149, - 56, 255, 242, 148, 54, 255, 241, 143, 46, 255, 242, 149, 58, 255, 244, - 165, 90, 255, 244, 172, 102, 255, 244, 169, 96, 255, 242, 154, 69, 255, - 241, 142, 45, 255, 241, 146, 50, 255, 241, 147, 54, 255, 240, 141, 42, - 255, 243, 166, 94, 255, 251, 237, 226, 255, 254, 255, 255, 255, 253, 253, - 253, 255, 253, 253, 253, 255, 254, 254, 254, 255, 225, 232, 238, 255, 215, - 224, 231, 255, 246, 247, 249, 255, 255, 254, 254, 255, 253, 253, 253, 255, - 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, - 255, 253, 253, 253, 255, 253, 253, 253, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 254, 254, 254, 255, 253, 253, 253, 255, 253, - 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, - 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, - 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, - 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, - 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, - 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, - 255, 252, 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, 253, 253, - 253, 255, 255, 254, 253, 255, 244, 246, 247, 255, 208, 220, 229, 255, 234, - 238, 241, 255, 253, 253, 253, 255, 252, 252, 252, 255, 251, 251, 251, 255, - 251, 251, 251, 255, 251, 251, 251, 255, 251, 251, 251, 255, 251, 251, 251, - 255, 251, 251, 251, 255, 251, 251, 251, 255, 250, 250, 250, 255, 250, 250, - 250, 255, 250, 250, 250, 255, 250, 250, 250, 255, 250, 250, 250, 255, 250, - 250, 250, 255, 249, 249, 249, 255, 249, 249, 249, 255, 253, 253, 252, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 184, 183, 183, 182, 25, 25, 25, - 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 45, 45, 45, 45, 244, 244, 244, 248, 255, 255, 255, 255, 250, 252, - 254, 255, 250, 247, 246, 255, 250, 248, 246, 255, 250, 248, 246, 255, 250, - 249, 248, 255, 251, 254, 255, 255, 249, 230, 214, 255, 243, 167, 95, 255, - 241, 145, 50, 255, 241, 148, 56, 255, 241, 145, 51, 255, 241, 148, 56, - 255, 245, 182, 123, 255, 249, 227, 209, 255, 255, 253, 250, 255, 255, 255, - 254, 255, 255, 255, 254, 255, 253, 241, 232, 255, 246, 195, 152, 255, 241, - 155, 72, 255, 240, 142, 45, 255, 240, 147, 54, 255, 240, 141, 43, 255, - 242, 161, 86, 255, 250, 233, 222, 255, 252, 255, 255, 255, 252, 252, 253, - 255, 255, 255, 255, 255, 154, 181, 201, 255, 8, 78, 129, 255, 70, 124, - 161, 255, 249, 249, 250, 255, 255, 255, 254, 255, 253, 253, 253, 255, 253, - 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, - 254, 254, 254, 255, 213, 226, 233, 255, 119, 159, 186, 255, 127, 167, 191, - 255, 245, 247, 249, 255, 254, 254, 254, 255, 252, 252, 253, 255, 252, 252, - 252, 255, 253, 253, 253, 255, 255, 255, 254, 255, 255, 254, 254, 255, 253, - 253, 253, 255, 252, 252, 252, 255, 253, 253, 253, 255, 253, 253, 253, 255, - 253, 253, 253, 255, 252, 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, - 255, 252, 252, 252, 255, 252, 252, 252, 255, 253, 253, 253, 255, 252, 252, - 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, 252, - 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, - 252, 252, 252, 255, 252, 252, 252, 255, 255, 255, 255, 255, 206, 218, 228, - 255, 38, 105, 148, 255, 13, 91, 139, 255, 202, 213, 222, 255, 255, 255, - 255, 255, 251, 251, 251, 255, 251, 251, 251, 255, 251, 251, 251, 255, 253, - 252, 252, 255, 253, 252, 252, 255, 251, 251, 251, 255, 250, 250, 250, 255, - 250, 250, 250, 255, 250, 250, 250, 255, 250, 250, 250, 255, 249, 249, 249, - 255, 249, 249, 249, 255, 249, 249, 249, 255, 249, 249, 249, 255, 250, 250, - 249, 255, 252, 252, 251, 255, 228, 232, 236, 255, 198, 210, 220, 255, 226, - 229, 234, 255, 239, 244, 249, 255, 179, 181, 183, 190, 15, 15, 14, 13, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 94, 94, 94, 94, 220, 220, 220, 220, 250, 251, 251, 254, 250, 251, 252, - 255, 250, 251, 252, 255, 250, 253, 255, 255, 250, 255, 255, 255, 246, 216, - 188, 255, 241, 151, 62, 255, 240, 144, 49, 255, 240, 148, 56, 255, 240, - 145, 50, 255, 240, 149, 59, 255, 247, 214, 184, 255, 254, 255, 255, 255, - 255, 255, 255, 255, 238, 241, 245, 255, 210, 220, 230, 255, 215, 224, 232, - 255, 249, 252, 254, 255, 255, 255, 255, 255, 249, 234, 222, 255, 241, 165, - 94, 255, 239, 142, 44, 255, 239, 146, 53, 255, 238, 141, 44, 255, 240, - 156, 78, 255, 250, 237, 226, 255, 252, 255, 255, 255, 255, 255, 255, 255, - 154, 181, 201, 255, 0, 71, 125, 255, 29, 98, 142, 255, 246, 246, 248, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 252, 252, 252, 255, 255, 255, 255, 255, 173, - 199, 214, 255, 0, 68, 122, 255, 0, 83, 132, 255, 236, 241, 244, 255, - 255, 255, 254, 255, 255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 251, 248, 248, 255, 254, 250, 250, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 254, 253, 255, 252, 252, 252, 255, 253, 253, 253, 255, 255, - 255, 254, 255, 255, 255, 254, 255, 253, 253, 252, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 253, 253, 252, 255, 251, 251, 251, 255, 251, 251, 251, 255, 253, 252, - 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 177, 201, 216, 255, 0, 81, 132, 255, - 7, 86, 136, 255, 203, 213, 222, 255, 255, 255, 255, 255, 251, 251, 251, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 249, 247, 247, 255, 248, 246, - 246, 255, 255, 255, 253, 255, 255, 255, 255, 255, 252, 251, 251, 255, 249, - 249, 249, 255, 249, 249, 249, 255, 251, 251, 250, 255, 251, 250, 250, 255, - 251, 250, 249, 255, 255, 255, 254, 255, 255, 251, 250, 255, 253, 251, 249, - 255, 218, 225, 231, 255, 155, 174, 193, 255, 175, 186, 200, 255, 170, 184, - 200, 255, 240, 244, 248, 255, 134, 133, 133, 133, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, - 56, 56, 57, 237, 237, 237, 239, 252, 252, 252, 255, 249, 254, 255, 255, - 249, 247, 246, 255, 243, 191, 141, 255, 239, 144, 50, 255, 239, 144, 50, - 255, 239, 147, 55, 255, 239, 146, 52, 255, 239, 146, 55, 255, 246, 214, - 185, 255, 253, 255, 255, 255, 252, 253, 254, 255, 156, 184, 203, 255, 38, - 103, 146, 255, 11, 89, 137, 255, 11, 87, 136, 255, 65, 123, 160, 255, - 199, 214, 225, 255, 255, 255, 255, 255, 250, 238, 229, 255, 239, 159, 82, - 255, 237, 142, 47, 255, 238, 145, 52, 255, 236, 137, 37, 255, 244, 193, - 145, 255, 251, 255, 255, 255, 255, 255, 255, 255, 154, 181, 201, 255, 0, - 73, 126, 255, 41, 105, 147, 255, 227, 231, 236, 255, 176, 198, 212, 255, - 134, 170, 194, 255, 120, 161, 187, 255, 151, 178, 198, 255, 203, 217, 226, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 178, 201, 215, 255, 0, 79, - 130, 255, 15, 93, 139, 255, 235, 241, 244, 255, 255, 255, 255, 255, 244, - 246, 247, 255, 163, 190, 207, 255, 101, 144, 174, 255, 54, 109, 148, 255, - 65, 116, 153, 255, 114, 154, 181, 255, 175, 198, 212, 255, 245, 246, 247, - 255, 253, 253, 253, 255, 246, 247, 248, 255, 236, 240, 244, 255, 238, 242, - 245, 255, 255, 254, 252, 255, 200, 215, 225, 255, 128, 164, 188, 255, 104, - 147, 177, 255, 128, 165, 189, 255, 186, 202, 216, 255, 248, 247, 248, 255, - 252, 252, 252, 255, 254, 254, 253, 255, 252, 251, 251, 255, 186, 203, 216, - 255, 135, 171, 194, 255, 121, 162, 188, 255, 140, 174, 196, 255, 191, 209, - 221, 255, 171, 196, 212, 255, 3, 86, 135, 255, 9, 87, 136, 255, 202, - 212, 221, 255, 255, 255, 255, 255, 254, 252, 251, 255, 186, 204, 217, 255, - 115, 157, 184, 255, 61, 116, 154, 255, 56, 111, 151, 255, 101, 146, 175, - 255, 169, 191, 208, 255, 240, 242, 243, 255, 254, 253, 252, 255, 247, 247, - 247, 255, 244, 243, 244, 255, 246, 243, 244, 255, 246, 247, 246, 255, 163, - 190, 206, 255, 90, 132, 165, 255, 139, 167, 189, 255, 236, 237, 239, 255, - 198, 206, 217, 255, 198, 205, 215, 255, 181, 193, 206, 255, 246, 247, 248, - 255, 229, 228, 228, 233, 24, 24, 24, 24, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 62, 62, 62, 63, 209, 209, 209, 212, 250, 251, - 251, 253, 249, 254, 255, 255, 247, 235, 223, 255, 240, 170, 103, 255, 237, - 139, 41, 255, 237, 144, 52, 255, 238, 146, 54, 255, 238, 145, 54, 255, - 238, 140, 44, 255, 242, 181, 123, 255, 251, 255, 255, 255, 253, 253, 253, - 255, 133, 169, 192, 255, 0, 78, 130, 255, 0, 82, 132, 255, 2, 85, - 134, 255, 2, 85, 134, 255, 0, 78, 129, 255, 23, 92, 138, 255, 196, - 210, 221, 255, 255, 255, 255, 255, 245, 212, 185, 255, 236, 141, 46, 255, - 237, 144, 51, 255, 236, 141, 45, 255, 239, 163, 90, 255, 250, 248, 247, - 255, 255, 255, 255, 255, 153, 181, 200, 255, 0, 75, 127, 255, 22, 93, - 139, 255, 42, 106, 148, 255, 0, 69, 122, 255, 0, 63, 118, 255, 0, - 62, 117, 255, 0, 70, 123, 255, 9, 84, 133, 255, 150, 179, 199, 255, - 255, 255, 255, 255, 178, 201, 215, 255, 0, 78, 129, 255, 14, 92, 138, - 255, 241, 245, 247, 255, 234, 240, 243, 255, 69, 126, 163, 255, 0, 70, - 123, 255, 0, 72, 124, 255, 43, 109, 150, 255, 39, 106, 147, 255, 0, - 74, 126, 255, 0, 72, 125, 255, 107, 149, 177, 255, 255, 255, 255, 255, - 176, 199, 213, 255, 15, 89, 136, 255, 28, 101, 145, 255, 101, 145, 174, - 255, 0, 79, 129, 255, 0, 70, 122, 255, 0, 69, 122, 255, 0, 71, - 124, 255, 0, 78, 128, 255, 125, 162, 186, 255, 255, 255, 254, 255, 246, - 247, 248, 255, 107, 151, 179, 255, 1, 80, 130, 255, 0, 69, 123, 255, - 0, 65, 120, 255, 0, 67, 121, 255, 0, 77, 128, 255, 30, 102, 146, - 255, 8, 88, 136, 255, 10, 88, 136, 255, 204, 213, 222, 255, 248, 250, - 250, 255, 111, 154, 182, 255, 0, 81, 131, 255, 0, 73, 126, 255, 37, - 105, 148, 255, 52, 115, 154, 255, 4, 83, 132, 255, 0, 74, 126, 255, - 74, 128, 163, 255, 236, 239, 242, 255, 223, 228, 232, 255, 61, 114, 152, - 255, 63, 114, 152, 255, 89, 137, 168, 255, 0, 76, 127, 255, 0, 57, - 114, 255, 73, 125, 161, 255, 255, 250, 248, 255, 249, 248, 248, 255, 247, - 247, 247, 255, 247, 247, 246, 255, 245, 245, 245, 255, 255, 255, 255, 255, - 112, 112, 112, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 107, 107, 107, 108, - 246, 246, 246, 249, 255, 255, 255, 255, 247, 252, 255, 255, 243, 215, 190, - 255, 237, 151, 69, 255, 236, 139, 43, 255, 236, 144, 53, 255, 236, 145, - 53, 255, 237, 145, 53, 255, 237, 144, 52, 255, 236, 143, 53, 255, 245, - 217, 197, 255, 255, 255, 255, 255, 206, 218, 227, 255, 8, 87, 135, 255, - 0, 83, 132, 255, 5, 86, 135, 255, 5, 86, 135, 255, 5, 86, 135, - 255, 5, 86, 134, 255, 0, 76, 127, 255, 73, 128, 162, 255, 251, 252, - 253, 255, 250, 241, 234, 255, 237, 151, 69, 255, 236, 141, 48, 255, 236, - 142, 49, 255, 236, 145, 57, 255, 247, 230, 219, 255, 255, 255, 255, 255, - 153, 180, 200, 255, 0, 76, 127, 255, 0, 79, 129, 255, 8, 87, 134, - 255, 100, 146, 176, 255, 144, 174, 196, 255, 123, 163, 188, 255, 36, 104, - 147, 255, 0, 75, 126, 255, 10, 82, 130, 255, 202, 214, 223, 255, 186, - 206, 219, 255, 0, 78, 128, 255, 15, 93, 138, 255, 243, 245, 246, 255, - 113, 152, 179, 255, 0, 68, 120, 255, 7, 82, 131, 255, 154, 181, 201, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 163, 186, 203, 255, 2, 79, - 129, 255, 0, 75, 126, 255, 167, 188, 204, 255, 177, 199, 212, 255, 0, - 77, 127, 255, 0, 79, 129, 255, 0, 80, 129, 255, 90, 140, 171, 255, - 185, 197, 211, 255, 158, 181, 200, 255, 28, 100, 144, 255, 0, 75, 126, - 255, 34, 102, 145, 255, 252, 251, 249, 255, 147, 178, 197, 255, 0, 73, - 125, 255, 0, 79, 130, 255, 60, 120, 158, 255, 139, 173, 195, 255, 147, - 175, 196, 255, 83, 135, 167, 255, 0, 81, 130, 255, 1, 83, 133, 255, - 11, 88, 136, 255, 214, 219, 226, 255, 167, 192, 207, 255, 0, 75, 127, - 255, 0, 79, 129, 255, 116, 156, 182, 255, 255, 254, 252, 255, 255, 255, - 254, 255, 196, 208, 219, 255, 25, 96, 140, 255, 0, 71, 124, 255, 110, - 153, 180, 255, 219, 224, 229, 255, 7, 87, 134, 255, 0, 79, 130, 255, - 0, 80, 129, 255, 72, 126, 161, 255, 124, 161, 187, 255, 168, 191, 207, - 255, 249, 247, 246, 255, 246, 246, 246, 255, 245, 245, 245, 255, 245, 245, - 244, 255, 244, 244, 244, 255, 255, 255, 255, 255, 166, 166, 166, 171, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 22, - 22, 22, 157, 157, 157, 158, 255, 255, 255, 255, 250, 254, 255, 255, 246, - 247, 248, 255, 240, 196, 154, 255, 234, 141, 50, 255, 235, 141, 47, 255, - 235, 144, 53, 255, 235, 141, 48, 255, 235, 143, 52, 255, 235, 144, 53, - 255, 235, 142, 50, 255, 236, 149, 63, 255, 246, 237, 230, 255, 255, 255, - 255, 255, 167, 192, 208, 255, 0, 81, 131, 255, 3, 85, 133, 255, 5, - 86, 134, 255, 5, 85, 134, 255, 5, 85, 134, 255, 4, 85, 134, 255, - 0, 81, 131, 255, 40, 104, 146, 255, 240, 243, 245, 255, 251, 249, 250, - 255, 237, 163, 99, 255, 235, 139, 43, 255, 235, 142, 50, 255, 234, 139, - 47, 255, 243, 209, 184, 255, 255, 255, 255, 255, 152, 180, 199, 255, 0, - 75, 126, 255, 2, 76, 127, 255, 143, 172, 193, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 191, 207, 218, 255, 4, 83, 131, - 255, 0, 70, 122, 255, 107, 150, 178, 255, 186, 205, 217, 255, 0, 79, - 128, 255, 20, 95, 141, 255, 207, 218, 226, 255, 15, 90, 136, 255, 0, - 76, 127, 255, 33, 101, 144, 255, 170, 193, 208, 255, 172, 195, 210, 255, - 173, 197, 211, 255, 157, 185, 203, 255, 8, 88, 135, 255, 0, 75, 126, - 255, 40, 105, 146, 255, 155, 181, 200, 255, 1, 83, 131, 255, 0, 74, - 125, 255, 92, 140, 172, 255, 255, 255, 254, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 137, 171, 192, 255, 0, 73, 124, 255, 20, 95, 141, 255, - 223, 229, 235, 255, 39, 104, 145, 255, 0, 75, 126, 255, 50, 112, 151, - 255, 243, 242, 243, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 253, - 252, 255, 101, 144, 173, 255, 0, 76, 127, 255, 12, 89, 135, 255, 200, - 208, 218, 255, 71, 125, 160, 255, 0, 77, 128, 255, 12, 89, 136, 255, - 152, 180, 198, 255, 174, 197, 211, 255, 170, 194, 209, 255, 177, 197, 210, - 255, 61, 118, 155, 255, 0, 75, 126, 255, 44, 110, 150, 255, 202, 212, - 221, 255, 17, 92, 137, 255, 0, 75, 126, 255, 76, 130, 164, 255, 251, - 248, 246, 255, 255, 255, 254, 255, 255, 252, 250, 255, 244, 244, 244, 255, - 244, 244, 244, 255, 244, 244, 244, 255, 244, 244, 244, 255, 243, 243, 243, - 255, 254, 254, 254, 255, 172, 172, 172, 179, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 31, 31, 31, 199, 199, 199, 202, 255, 255, 255, - 255, 247, 252, 255, 255, 244, 235, 228, 255, 237, 175, 114, 255, 232, 137, - 42, 255, 233, 141, 49, 255, 234, 142, 51, 255, 233, 138, 44, 255, 235, - 156, 79, 255, 234, 146, 59, 255, 234, 142, 51, 255, 234, 142, 50, 255, - 235, 146, 59, 255, 245, 229, 219, 255, 255, 255, 255, 255, 192, 208, 219, - 255, 0, 81, 130, 255, 1, 83, 132, 255, 4, 85, 133, 255, 4, 85, - 133, 255, 4, 85, 133, 255, 4, 85, 133, 255, 0, 78, 128, 255, 53, - 115, 153, 255, 245, 247, 249, 255, 250, 246, 244, 255, 236, 155, 80, 255, - 234, 139, 45, 255, 233, 142, 50, 255, 232, 137, 42, 255, 241, 201, 169, - 255, 255, 255, 255, 255, 152, 179, 198, 255, 0, 73, 123, 255, 15, 92, - 137, 255, 235, 238, 240, 255, 254, 252, 251, 255, 248, 248, 248, 255, 252, - 251, 250, 255, 242, 243, 244, 255, 33, 99, 142, 255, 0, 71, 124, 255, - 76, 131, 165, 255, 175, 198, 213, 255, 0, 79, 128, 255, 22, 97, 142, - 255, 182, 198, 211, 255, 9, 85, 133, 255, 0, 81, 129, 255, 0, 81, - 129, 255, 0, 72, 123, 255, 0, 71, 122, 255, 0, 71, 122, 255, 0, - 72, 123, 255, 0, 75, 125, 255, 0, 73, 124, 255, 14, 88, 134, 255, - 134, 166, 187, 255, 1, 83, 131, 255, 2, 79, 128, 255, 185, 198, 210, - 255, 255, 255, 255, 255, 248, 248, 248, 255, 255, 255, 255, 255, 161, 186, - 202, 255, 0, 74, 125, 255, 23, 97, 141, 255, 204, 216, 225, 255, 14, - 91, 137, 255, 0, 72, 124, 255, 103, 147, 175, 255, 255, 255, 252, 255, - 248, 248, 248, 255, 247, 247, 247, 255, 255, 255, 255, 255, 174, 196, 211, - 255, 0, 79, 129, 255, 12, 89, 135, 255, 179, 194, 207, 255, 20, 95, - 141, 255, 1, 82, 131, 255, 4, 84, 133, 255, 0, 77, 127, 255, 0, - 74, 124, 255, 0, 74, 125, 255, 0, 74, 125, 255, 0, 77, 127, 255, - 0, 76, 125, 255, 15, 89, 135, 255, 184, 198, 210, 255, 18, 93, 138, - 255, 0, 72, 123, 255, 136, 169, 191, 255, 255, 255, 253, 255, 244, 244, - 244, 255, 244, 244, 244, 255, 244, 244, 244, 255, 243, 243, 243, 255, 243, - 243, 243, 255, 243, 243, 243, 255, 242, 242, 242, 255, 255, 255, 255, 255, - 165, 165, 165, 171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, 198, - 198, 198, 203, 255, 255, 255, 255, 244, 249, 253, 255, 241, 219, 201, 255, - 233, 154, 79, 255, 231, 135, 38, 255, 232, 141, 51, 255, 232, 140, 48, - 255, 232, 137, 42, 255, 237, 176, 119, 255, 243, 230, 220, 255, 234, 149, - 67, 255, 233, 140, 49, 255, 233, 142, 51, 255, 232, 138, 45, 255, 240, - 201, 168, 255, 249, 254, 255, 255, 243, 243, 244, 255, 72, 126, 160, 255, - 0, 73, 124, 255, 2, 83, 131, 255, 4, 84, 132, 255, 4, 84, 132, - 255, 0, 80, 130, 255, 0, 74, 125, 255, 147, 175, 195, 255, 255, 255, - 255, 255, 245, 229, 216, 255, 233, 144, 55, 255, 233, 140, 48, 255, 233, - 140, 49, 255, 232, 138, 47, 255, 241, 210, 186, 255, 255, 255, 255, 255, - 151, 178, 197, 255, 0, 73, 123, 255, 11, 88, 134, 255, 218, 225, 231, - 255, 255, 255, 253, 255, 247, 247, 247, 255, 255, 253, 252, 255, 232, 236, - 239, 255, 18, 92, 137, 255, 0, 71, 123, 255, 83, 136, 167, 255, 178, - 199, 213, 255, 0, 79, 128, 255, 22, 96, 140, 255, 189, 204, 215, 255, - 6, 84, 132, 255, 0, 76, 126, 255, 45, 108, 148, 255, 166, 183, 200, - 255, 162, 179, 197, 255, 160, 179, 197, 255, 168, 184, 200, 255, 175, 189, - 204, 255, 167, 183, 200, 255, 175, 190, 205, 255, 154, 180, 198, 255, 0, - 78, 128, 255, 7, 84, 132, 255, 206, 214, 222, 255, 254, 253, 251, 255, - 247, 247, 247, 255, 255, 255, 254, 255, 157, 183, 200, 255, 0, 74, 124, - 255, 22, 96, 141, 255, 210, 220, 227, 255, 20, 93, 138, 255, 0, 72, - 124, 255, 88, 136, 168, 255, 255, 255, 252, 255, 249, 249, 248, 255, 247, - 247, 247, 255, 255, 255, 255, 255, 164, 188, 204, 255, 0, 77, 127, 255, - 12, 88, 134, 255, 186, 198, 210, 255, 38, 104, 146, 255, 0, 78, 128, - 255, 22, 93, 138, 255, 159, 177, 196, 255, 162, 181, 198, 255, 159, 178, - 196, 255, 164, 182, 199, 255, 173, 187, 203, 255, 165, 182, 199, 255, 171, - 186, 202, 255, 199, 209, 218, 255, 12, 89, 134, 255, 0, 77, 126, 255, - 175, 189, 202, 255, 254, 251, 249, 255, 243, 243, 243, 255, 243, 243, 243, - 255, 243, 243, 243, 255, 243, 243, 243, 255, 242, 242, 242, 255, 242, 242, - 242, 255, 242, 242, 242, 255, 255, 255, 255, 255, 127, 127, 127, 127, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 123, 123, 123, 126, 255, 255, 255, 255, 244, 247, - 250, 255, 237, 204, 174, 255, 230, 140, 50, 255, 230, 136, 43, 255, 231, - 141, 52, 255, 231, 138, 45, 255, 231, 138, 48, 255, 237, 190, 146, 255, - 245, 246, 249, 255, 245, 247, 251, 255, 235, 164, 103, 255, 231, 137, 42, - 255, 232, 141, 51, 255, 231, 137, 43, 255, 235, 163, 95, 255, 244, 243, - 244, 255, 252, 253, 254, 255, 228, 230, 234, 255, 79, 129, 162, 255, 0, - 79, 128, 255, 0, 72, 123, 255, 0, 73, 124, 255, 17, 88, 134, 255, - 128, 164, 186, 255, 251, 249, 248, 255, 249, 253, 255, 255, 238, 189, 144, - 255, 231, 137, 42, 255, 232, 141, 50, 255, 232, 139, 47, 255, 232, 144, - 57, 255, 244, 231, 221, 255, 255, 255, 255, 255, 151, 177, 196, 255, 0, - 74, 124, 255, 0, 74, 125, 255, 91, 138, 169, 255, 244, 244, 245, 255, - 255, 255, 253, 255, 251, 250, 248, 255, 128, 163, 187, 255, 0, 77, 127, - 255, 0, 69, 121, 255, 136, 167, 190, 255, 187, 206, 217, 255, 0, 77, - 127, 255, 18, 92, 137, 255, 226, 231, 235, 255, 51, 111, 149, 255, 0, - 69, 121, 255, 38, 103, 143, 255, 227, 231, 234, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 206, 217, 225, 255, 145, 173, 193, 255, 229, 234, 237, - 255, 255, 255, 255, 255, 169, 192, 207, 255, 0, 76, 126, 255, 7, 85, - 132, 255, 210, 217, 224, 255, 253, 251, 250, 255, 246, 246, 246, 255, 255, - 255, 253, 255, 157, 182, 200, 255, 0, 74, 124, 255, 17, 93, 138, 255, - 238, 239, 241, 255, 89, 135, 165, 255, 0, 72, 123, 255, 19, 90, 135, - 255, 180, 197, 211, 255, 255, 251, 249, 255, 255, 254, 251, 255, 220, 226, - 231, 255, 52, 112, 150, 255, 0, 77, 126, 255, 10, 86, 132, 255, 209, - 214, 221, 255, 121, 157, 182, 255, 0, 70, 122, 255, 12, 86, 133, 255, - 188, 202, 214, 255, 255, 255, 255, 255, 255, 255, 255, 255, 227, 232, 235, - 255, 142, 173, 194, 255, 222, 227, 231, 255, 255, 255, 254, 255, 210, 218, - 224, 255, 10, 86, 132, 255, 0, 77, 125, 255, 175, 189, 202, 255, 254, - 250, 248, 255, 242, 242, 242, 255, 242, 242, 242, 255, 242, 242, 242, 255, - 242, 242, 242, 255, 242, 242, 242, 255, 241, 241, 241, 255, 246, 246, 246, - 255, 231, 231, 231, 241, 39, 39, 39, 38, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 9, - 215, 215, 215, 222, 249, 253, 255, 255, 239, 219, 201, 255, 229, 139, 51, - 255, 229, 137, 45, 255, 229, 140, 50, 255, 229, 135, 41, 255, 230, 143, - 57, 255, 238, 204, 173, 255, 244, 249, 253, 255, 245, 246, 248, 255, 244, - 250, 255, 255, 237, 194, 154, 255, 230, 135, 40, 255, 231, 141, 50, 255, - 231, 140, 50, 255, 231, 136, 44, 255, 237, 185, 141, 255, 245, 248, 253, - 255, 251, 252, 254, 255, 251, 248, 246, 255, 175, 193, 207, 255, 113, 152, - 179, 255, 128, 162, 186, 255, 210, 217, 224, 255, 255, 253, 252, 255, 248, - 254, 255, 255, 240, 211, 185, 255, 230, 139, 49, 255, 231, 139, 47, 255, - 231, 140, 50, 255, 230, 136, 42, 255, 233, 158, 87, 255, 245, 244, 243, - 255, 255, 255, 255, 255, 148, 175, 194, 255, 0, 69, 121, 255, 0, 78, - 127, 255, 0, 74, 124, 255, 41, 104, 144, 255, 109, 149, 176, 255, 65, - 120, 156, 255, 0, 75, 124, 255, 0, 69, 121, 255, 36, 100, 141, 255, - 239, 240, 241, 255, 177, 199, 212, 255, 0, 71, 123, 255, 6, 86, 132, - 255, 241, 244, 244, 255, 190, 203, 214, 255, 13, 83, 129, 255, 0, 68, - 119, 255, 24, 94, 138, 255, 119, 160, 185, 255, 107, 151, 178, 255, 4, - 82, 129, 255, 0, 57, 112, 255, 70, 120, 155, 255, 254, 253, 252, 255, - 166, 190, 205, 255, 0, 70, 122, 255, 0, 80, 128, 255, 207, 215, 222, - 255, 253, 251, 250, 255, 246, 246, 246, 255, 255, 255, 253, 255, 154, 180, - 198, 255, 0, 68, 120, 255, 8, 87, 134, 255, 240, 243, 243, 255, 192, - 207, 217, 255, 4, 80, 128, 255, 0, 73, 124, 255, 3, 82, 129, 255, - 82, 130, 162, 255, 101, 143, 171, 255, 21, 90, 135, 255, 0, 72, 123, - 255, 0, 78, 127, 255, 1, 80, 128, 255, 204, 212, 219, 255, 222, 228, - 233, 255, 36, 101, 143, 255, 0, 70, 121, 255, 11, 85, 131, 255, 104, - 147, 174, 255, 119, 158, 183, 255, 35, 100, 141, 255, 0, 62, 116, 255, - 34, 98, 140, 255, 232, 233, 235, 255, 211, 218, 224, 255, 2, 81, 129, - 255, 0, 72, 121, 255, 172, 186, 200, 255, 253, 250, 248, 255, 242, 242, - 242, 255, 241, 241, 241, 255, 241, 241, 241, 255, 241, 241, 241, 255, 240, - 240, 240, 255, 241, 241, 241, 255, 255, 255, 255, 255, 140, 140, 140, 145, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, 231, 231, 231, 238, 245, - 251, 255, 255, 236, 199, 168, 255, 227, 130, 35, 255, 228, 136, 45, 255, - 227, 132, 37, 255, 230, 152, 77, 255, 239, 219, 202, 255, 244, 250, 255, - 255, 251, 251, 252, 255, 245, 245, 245, 255, 244, 248, 251, 255, 240, 221, - 204, 255, 230, 140, 52, 255, 230, 138, 47, 255, 230, 140, 50, 255, 230, - 139, 48, 255, 229, 136, 44, 255, 235, 180, 132, 255, 243, 235, 230, 255, - 246, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 252, 255, 255, 255, 244, 244, 245, 255, 238, 198, 161, 255, 230, 141, - 53, 255, 230, 138, 45, 255, 230, 139, 49, 255, 230, 139, 49, 255, 229, - 132, 36, 255, 236, 184, 136, 255, 245, 250, 254, 255, 254, 253, 252, 255, - 164, 185, 201, 255, 39, 95, 137, 255, 72, 121, 155, 255, 141, 170, 190, - 255, 31, 96, 139, 255, 0, 70, 120, 255, 0, 70, 120, 255, 5, 81, - 128, 255, 62, 115, 151, 255, 201, 211, 219, 255, 255, 255, 254, 255, 185, - 203, 214, 255, 41, 100, 141, 255, 52, 112, 149, 255, 233, 237, 239, 255, - 255, 254, 252, 255, 187, 202, 213, 255, 74, 123, 157, 255, 17, 88, 133, - 255, 0, 70, 120, 255, 0, 72, 122, 255, 20, 92, 136, 255, 75, 124, - 158, 255, 183, 200, 212, 255, 253, 253, 252, 255, 179, 197, 210, 255, 41, - 99, 141, 255, 47, 107, 146, 255, 213, 219, 225, 255, 251, 249, 248, 255, - 245, 245, 245, 255, 253, 252, 251, 255, 170, 190, 204, 255, 40, 97, 138, - 255, 54, 113, 150, 255, 232, 236, 239, 255, 254, 252, 249, 255, 165, 186, - 201, 255, 39, 101, 142, 255, 2, 79, 127, 255, 0, 71, 121, 255, 0, - 73, 123, 255, 52, 111, 150, 255, 113, 152, 178, 255, 46, 107, 146, 255, - 46, 106, 145, 255, 203, 211, 218, 255, 255, 254, 252, 255, 213, 219, 226, - 255, 90, 136, 166, 255, 21, 91, 136, 255, 0, 74, 124, 255, 0, 72, - 122, 255, 14, 87, 133, 255, 65, 118, 154, 255, 166, 190, 205, 255, 249, - 249, 247, 255, 212, 219, 224, 255, 48, 107, 145, 255, 40, 99, 139, 255, - 181, 193, 205, 255, 250, 248, 246, 255, 241, 241, 241, 255, 241, 241, 241, - 255, 240, 240, 240, 255, 240, 240, 240, 255, 240, 240, 240, 255, 255, 255, - 255, 255, 199, 199, 199, 205, 10, 10, 10, 9, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 8, 8, 8, 7, 194, 194, 194, 202, 250, 253, 254, 255, 238, 227, - 219, 255, 230, 161, 95, 255, 228, 143, 60, 255, 231, 170, 111, 255, 239, - 231, 224, 255, 245, 250, 254, 255, 255, 255, 255, 255, 159, 159, 159, 163, - 136, 136, 136, 139, 253, 253, 254, 255, 243, 246, 250, 255, 234, 179, 130, - 255, 228, 132, 36, 255, 229, 139, 50, 255, 229, 139, 50, 255, 229, 138, - 48, 255, 229, 134, 41, 255, 230, 150, 72, 255, 236, 193, 154, 255, 239, - 216, 194, 255, 240, 223, 211, 255, 240, 220, 203, 255, 238, 204, 172, 255, - 232, 163, 97, 255, 228, 135, 42, 255, 229, 137, 46, 255, 229, 139, 49, - 255, 229, 139, 49, 255, 229, 135, 43, 255, 229, 140, 54, 255, 241, 223, - 207, 255, 245, 248, 251, 255, 244, 244, 244, 255, 241, 241, 242, 255, 236, - 237, 239, 255, 239, 239, 240, 255, 253, 250, 248, 255, 233, 235, 237, 255, - 190, 200, 211, 255, 173, 187, 200, 255, 201, 210, 218, 255, 244, 244, 244, - 255, 252, 251, 248, 255, 245, 245, 244, 255, 242, 242, 243, 255, 237, 238, - 239, 255, 238, 239, 240, 255, 244, 244, 244, 255, 245, 245, 244, 255, 253, - 250, 248, 255, 248, 246, 245, 255, 224, 228, 232, 255, 197, 206, 215, 255, - 201, 209, 217, 255, 228, 231, 235, 255, 248, 247, 245, 255, 252, 249, 248, - 255, 244, 244, 244, 255, 242, 242, 242, 255, 237, 238, 239, 255, 237, 238, - 239, 255, 243, 243, 243, 255, 244, 244, 244, 255, 244, 244, 244, 255, 244, - 244, 244, 255, 241, 242, 242, 255, 237, 238, 239, 255, 237, 238, 239, 255, - 243, 243, 243, 255, 244, 244, 244, 255, 252, 249, 247, 255, 232, 234, 236, - 255, 192, 201, 212, 255, 173, 187, 200, 255, 198, 207, 216, 255, 241, 241, - 241, 255, 250, 247, 246, 255, 236, 237, 238, 255, 236, 237, 238, 255, 241, - 241, 241, 255, 243, 243, 243, 255, 249, 247, 246, 255, 250, 246, 245, 255, - 227, 230, 233, 255, 199, 208, 216, 255, 193, 203, 212, 255, 220, 225, 229, - 255, 243, 242, 242, 255, 251, 248, 246, 255, 241, 241, 241, 255, 240, 240, - 240, 255, 234, 235, 237, 255, 233, 234, 236, 255, 237, 238, 238, 255, 240, - 240, 240, 255, 240, 240, 240, 255, 240, 240, 240, 255, 240, 240, 240, 255, - 244, 244, 244, 255, 254, 254, 254, 255, 194, 194, 194, 199, 43, 43, 43, - 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 84, 84, 84, 87, 253, 253, 252, 255, 246, 247, 248, 255, 240, 238, 238, - 255, 239, 234, 229, 255, 240, 242, 243, 255, 250, 252, 254, 255, 247, 247, - 246, 252, 134, 134, 134, 134, 0, 0, 0, 0, 30, 30, 30, 31, 226, - 226, 225, 235, 248, 250, 253, 255, 240, 231, 225, 255, 230, 154, 83, 255, - 227, 133, 39, 255, 228, 138, 49, 255, 228, 138, 49, 255, 228, 138, 49, - 255, 228, 135, 44, 255, 227, 133, 39, 255, 228, 138, 49, 255, 228, 140, - 55, 255, 228, 139, 52, 255, 227, 134, 42, 255, 227, 134, 41, 255, 228, - 138, 48, 255, 228, 138, 49, 255, 228, 138, 49, 255, 228, 135, 43, 255, - 228, 137, 47, 255, 237, 205, 176, 255, 245, 248, 252, 255, 253, 253, 253, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 254, 254, 255, 253, 253, - 253, 255, 253, 253, 253, 255, 254, 254, 254, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 254, 253, 255, - 252, 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, 255, 254, 253, - 255, 255, 254, 253, 255, 252, 252, 252, 255, 251, 251, 251, 255, 251, 251, - 251, 255, 252, 252, 252, 255, 254, 254, 254, 255, 225, 225, 225, 232, 141, - 141, 141, 145, 8, 8, 8, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 124, - 124, 124, 127, 236, 236, 236, 242, 255, 255, 255, 255, 254, 255, 255, 255, - 254, 255, 255, 255, 215, 215, 215, 219, 98, 98, 98, 99, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 90, 90, 92, 255, 255, - 255, 255, 244, 247, 250, 255, 238, 224, 214, 255, 229, 152, 81, 255, 226, - 131, 36, 255, 227, 137, 47, 255, 227, 138, 49, 255, 227, 138, 49, 255, - 227, 137, 48, 255, 227, 137, 47, 255, 227, 136, 46, 255, 227, 136, 46, - 255, 227, 137, 48, 255, 227, 138, 48, 255, 227, 138, 48, 255, 227, 137, - 48, 255, 226, 133, 39, 255, 227, 137, 48, 255, 235, 196, 160, 255, 244, - 249, 254, 255, 247, 248, 248, 255, 183, 183, 183, 190, 162, 162, 162, 169, - 163, 163, 163, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, - 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, - 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, - 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, - 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, - 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, - 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, - 164, 164, 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, - 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, - 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, - 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, - 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, 162, 162, 162, 170, - 162, 162, 162, 170, 162, 162, 162, 170, 162, 162, 162, 170, 162, 162, 162, - 170, 162, 162, 162, 170, 162, 162, 162, 170, 162, 162, 162, 170, 162, 162, - 162, 170, 162, 162, 162, 169, 162, 162, 162, 169, 162, 162, 162, 169, 162, - 162, 162, 169, 161, 161, 161, 169, 161, 161, 161, 169, 161, 161, 161, 169, - 161, 161, 161, 169, 161, 161, 161, 169, 162, 162, 162, 171, 156, 156, 156, - 162, 112, 112, 112, 112, 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, - 47, 46, 131, 131, 131, 134, 147, 147, 147, 152, 105, 105, 105, 106, 12, - 12, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 2, 2, 2, 144, 144, 144, 147, 254, 254, 254, - 255, 243, 246, 250, 255, 238, 228, 221, 255, 230, 168, 111, 255, 225, 134, - 45, 255, 225, 131, 37, 255, 226, 135, 43, 255, 226, 136, 46, 255, 226, - 137, 48, 255, 226, 137, 48, 255, 226, 137, 48, 255, 226, 137, 47, 255, - 226, 135, 45, 255, 225, 133, 40, 255, 225, 130, 36, 255, 228, 152, 76, - 255, 237, 209, 184, 255, 244, 248, 253, 255, 255, 255, 255, 255, 167, 167, - 167, 172, 5, 5, 5, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 9, 9, 8, 153, 153, 153, 158, 249, 249, 249, 255, - 246, 248, 251, 255, 239, 242, 246, 255, 235, 207, 184, 255, 229, 165, 105, - 255, 226, 146, 70, 255, 225, 135, 48, 255, 224, 130, 38, 255, 224, 129, - 34, 255, 224, 129, 34, 255, 224, 131, 40, 255, 226, 141, 58, 255, 228, - 158, 91, 255, 233, 190, 151, 255, 240, 237, 235, 255, 247, 251, 255, 255, - 250, 250, 251, 255, 177, 177, 177, 180, 23, 23, 23, 22, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 113, 113, 113, 115, 225, 225, 225, 233, 253, - 254, 254, 255, 244, 248, 252, 255, 239, 241, 244, 255, 238, 232, 228, 255, - 235, 209, 191, 255, 232, 190, 152, 255, 231, 184, 138, 255, 232, 185, 138, - 255, 232, 196, 164, 255, 237, 225, 217, 255, 240, 240, 240, 255, 246, 250, - 255, 255, 255, 255, 255, 255, 230, 230, 230, 235, 110, 110, 110, 111, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 40, 40, 40, 40, 149, 149, 149, 153, 220, 220, - 220, 229, 251, 252, 252, 255, 252, 254, 255, 255, 249, 253, 255, 255, 246, - 252, 255, 255, 245, 251, 255, 255, 246, 252, 255, 255, 248, 254, 255, 255, - 253, 255, 255, 255, 250, 251, 252, 255, 217, 218, 218, 226, 153, 153, 153, - 157, 45, 45, 45, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 102, 102, 102, - 102, 152, 152, 152, 157, 175, 175, 175, 185, 197, 197, 197, 210, 202, 203, - 203, 215, 197, 197, 197, 209, 180, 180, 180, 188, 155, 155, 155, 160, 97, - 97, 97, 98, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, - 6, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - - *width = 115; - *height = 32; - - // only load the requested logo - // allocate a new array - *data = new unsigned char[14720]; - // and copy it. Now we are certain that the calling function - // can control the memory location - for(int i = 0; i < 14720 /* tmp array size */; i++) - { - (*data)[i] = logo_blender_raw[i]; - } - -} - - -void GetRawBlender3DLogo(unsigned char **data, int *width, int *height) -{ - // create an array that will automatically be deleted when) - // we're outta this scope - static unsigned char logo_blender3d_raw[]= {255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 57, 255, 255, - 255, 243, 255, 255, 255, 252, 255, 255, 255, 251, 255, 255, 255, 200, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 57, 255, 255, 255, 243, 255, 255, 255, 252, 255, 255, 255, - 251, 255, 255, 255, 200, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 141, 255, 255, 255, 248, - 255, 255, 255, 253, 255, 255, 255, 248, 255, 255, 255, 141, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 17, 255, 255, 255, 159, 255, 255, 255, 231, 255, 255, 255, 247, 255, 255, - 255, 247, 255, 255, 255, 234, 255, 255, 255, 176, 255, 255, 255, 36, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 141, 255, 255, 255, - 248, 255, 255, 255, 253, 255, 255, 255, 248, 255, 255, 255, 141, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 86, 207, 207, 207, 255, 70, 70, 70, 255, 118, 118, 118, 255, 255, - 255, 255, 236, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 86, 207, 207, 207, 255, 70, 70, 70, - 255, 118, 118, 118, 255, 255, 255, 255, 236, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 170, - 153, 153, 153, 255, 70, 70, 70, 255, 153, 153, 153, 255, 255, 255, 255, - 170, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 141, 255, 255, 255, 255, 239, 239, 239, 255, 153, 153, 153, 255, 137, 137, - 137, 255, 137, 137, 137, 255, 153, 153, 153, 255, 223, 223, 223, 255, 255, - 255, 255, 255, 255, 255, 255, 141, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 170, 153, 153, 153, 255, 70, 70, 70, 255, 153, 153, 153, 255, 255, 255, - 255, 170, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 86, 255, 255, - 255, 172, 255, 255, 255, 172, 255, 255, 255, 86, 255, 255, 255, 86, 255, - 255, 255, 144, 255, 255, 255, 144, 255, 255, 255, 57, 255, 255, 255, 86, - 255, 255, 255, 144, 255, 255, 255, 207, 255, 255, 255, 207, 255, 255, 255, - 172, 255, 255, 255, 86, 255, 255, 255, 86, 255, 255, 255, 144, 255, 255, - 255, 144, 255, 255, 255, 57, 255, 255, 255, 86, 255, 255, 255, 144, 255, - 255, 255, 207, 255, 255, 255, 207, 255, 255, 255, 172, 255, 255, 255, 86, - 255, 255, 255, 86, 255, 255, 255, 144, 255, 255, 255, 144, 255, 255, 255, - 57, 255, 255, 255, 86, 255, 255, 255, 144, 255, 255, 255, 144, 255, 255, - 255, 57, 255, 255, 255, 144, 187, 187, 187, 255, 0, 0, 0, 253, 70, - 70, 70, 255, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, 255, - 255, 255, 255, 251, 255, 255, 255, 207, 255, 255, 255, 163, 187, 187, 187, - 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, 255, 251, 255, 255, - 255, 0, 255, 255, 255, 141, 255, 255, 255, 235, 255, 255, 255, 254, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 250, 255, 255, 255, 188, - 255, 255, 255, 54, 255, 255, 255, 198, 255, 255, 255, 234, 255, 255, 255, - 243, 255, 255, 255, 248, 255, 255, 255, 254, 255, 255, 255, 254, 255, 255, - 255, 251, 255, 255, 255, 207, 255, 255, 255, 17, 255, 255, 255, 0, 255, - 255, 255, 170, 255, 255, 255, 250, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 137, 137, 137, 255, 0, 0, 0, 253, 137, 137, 137, - 255, 255, 255, 255, 228, 255, 255, 255, 141, 255, 255, 255, 235, 255, 255, - 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 250, 255, - 255, 255, 188, 255, 255, 255, 54, 255, 255, 255, 198, 255, 255, 255, 234, - 255, 255, 255, 237, 255, 255, 255, 248, 255, 255, 255, 254, 255, 255, 255, - 253, 255, 255, 255, 255, 153, 153, 153, 255, 0, 0, 0, 253, 0, 0, - 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 0, - 0, 0, 253, 153, 153, 153, 255, 255, 255, 255, 251, 255, 255, 255, 0, - 255, 255, 255, 170, 255, 255, 255, 250, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 137, 137, 137, 255, 0, 0, 0, 253, 137, 137, - 137, 255, 255, 255, 255, 228, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 86, 255, 255, 255, 215, 255, 255, 255, 240, - 255, 255, 255, 231, 255, 255, 255, 159, 255, 255, 255, 17, 255, 255, 255, - 0, 255, 255, 255, 57, 255, 255, 255, 206, 255, 255, 255, 237, 255, 255, - 255, 231, 255, 255, 255, 159, 255, 255, 255, 35, 255, 255, 255, 105, 255, - 255, 255, 142, 255, 255, 255, 208, 255, 255, 255, 229, 255, 255, 255, 237, - 255, 255, 255, 215, 255, 255, 255, 205, 255, 255, 255, 228, 255, 255, 255, - 234, 255, 255, 255, 198, 255, 255, 255, 36, 255, 255, 255, 0, 255, 255, - 255, 227, 187, 187, 187, 255, 187, 187, 187, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 187, 187, 187, 255, 207, 207, 207, 255, 255, 255, 255, 254, - 255, 255, 255, 255, 187, 187, 187, 255, 207, 207, 207, 255, 187, 187, 187, - 255, 187, 187, 187, 255, 255, 255, 255, 255, 255, 255, 255, 255, 187, 187, - 187, 255, 207, 207, 207, 255, 255, 255, 255, 254, 255, 255, 255, 255, 187, - 187, 187, 255, 207, 207, 207, 255, 187, 187, 187, 255, 187, 187, 187, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 187, 187, 187, 255, 207, 207, 207, - 255, 255, 255, 255, 254, 255, 255, 255, 255, 187, 187, 187, 255, 207, 207, - 207, 255, 255, 255, 255, 170, 255, 255, 255, 172, 187, 187, 187, 255, 0, - 0, 0, 253, 70, 70, 70, 255, 153, 153, 153, 255, 86, 86, 86, 255, - 70, 70, 70, 255, 118, 118, 118, 255, 239, 239, 239, 255, 255, 255, 255, - 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, - 255, 254, 255, 255, 255, 246, 255, 255, 255, 255, 153, 153, 153, 255, 118, - 118, 118, 255, 69, 69, 69, 254, 70, 70, 70, 255, 137, 137, 137, 255, - 239, 239, 239, 255, 255, 255, 255, 254, 223, 223, 223, 255, 137, 137, 137, - 255, 153, 153, 153, 255, 169, 169, 169, 255, 102, 102, 102, 255, 70, 70, - 70, 255, 118, 118, 118, 255, 239, 239, 239, 255, 255, 255, 255, 236, 255, - 255, 255, 236, 255, 255, 255, 255, 137, 137, 137, 255, 70, 70, 70, 255, - 70, 70, 70, 255, 137, 137, 137, 255, 118, 118, 118, 255, 0, 0, 0, - 253, 137, 137, 137, 255, 255, 255, 255, 254, 255, 255, 255, 255, 153, 153, - 153, 255, 118, 118, 118, 255, 69, 69, 69, 254, 70, 70, 70, 255, 137, - 137, 137, 255, 239, 239, 239, 255, 255, 255, 255, 254, 223, 223, 223, 255, - 137, 137, 137, 255, 153, 153, 153, 255, 207, 207, 207, 255, 86, 86, 86, - 255, 70, 70, 70, 255, 223, 223, 223, 255, 0, 0, 0, 253, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 255, 239, 239, 239, 255, 86, - 86, 86, 255, 0, 0, 0, 253, 34, 34, 34, 255, 255, 255, 255, 253, - 255, 255, 255, 236, 255, 255, 255, 255, 137, 137, 137, 255, 70, 70, 70, - 255, 70, 70, 70, 255, 137, 137, 137, 255, 118, 118, 118, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 233, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 214, 255, 255, 255, 255, 187, 187, 187, 255, - 137, 137, 137, 255, 153, 153, 153, 255, 239, 239, 239, 255, 255, 255, 255, - 254, 255, 255, 255, 224, 255, 255, 255, 255, 207, 207, 207, 255, 137, 137, - 137, 255, 153, 153, 153, 255, 239, 239, 239, 255, 255, 255, 255, 255, 239, - 239, 239, 255, 187, 187, 187, 255, 223, 223, 223, 255, 169, 169, 169, 255, - 137, 137, 137, 255, 187, 187, 187, 255, 255, 255, 255, 255, 153, 153, 153, - 255, 137, 137, 137, 255, 223, 223, 223, 255, 255, 255, 255, 255, 255, 255, - 255, 36, 255, 255, 255, 205, 86, 86, 86, 255, 0, 0, 0, 253, 239, - 239, 239, 255, 222, 222, 222, 255, 0, 0, 0, 253, 18, 18, 18, 255, - 255, 255, 255, 255, 207, 207, 207, 255, 0, 0, 0, 253, 137, 137, 137, - 255, 86, 86, 86, 255, 0, 0, 0, 253, 239, 239, 239, 255, 222, 222, - 222, 255, 0, 0, 0, 253, 18, 18, 18, 255, 255, 255, 255, 255, 207, - 207, 207, 255, 0, 0, 0, 253, 137, 137, 137, 255, 86, 86, 86, 255, - 0, 0, 0, 253, 239, 239, 239, 255, 222, 222, 222, 255, 0, 0, 0, - 253, 18, 18, 18, 255, 255, 255, 255, 255, 207, 207, 207, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 116, 255, 255, 255, 172, 187, - 187, 187, 255, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, - 70, 70, 70, 254, 33, 33, 33, 255, 0, 0, 0, 253, 18, 18, 18, - 255, 239, 239, 239, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, - 70, 255, 255, 255, 255, 254, 255, 255, 255, 255, 50, 50, 50, 255, 0, - 0, 0, 253, 69, 69, 69, 254, 137, 137, 137, 254, 103, 103, 103, 254, - 0, 0, 0, 253, 18, 18, 18, 255, 239, 239, 239, 255, 187, 187, 187, - 255, 0, 0, 0, 253, 0, 0, 0, 253, 18, 18, 18, 255, 69, 69, - 69, 254, 18, 18, 18, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 70, 70, 70, 255, 0, 0, 0, 253, - 18, 18, 18, 255, 69, 69, 69, 254, 18, 18, 18, 255, 0, 0, 0, - 253, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 255, 50, 50, - 50, 255, 0, 0, 0, 253, 69, 69, 69, 254, 137, 137, 137, 254, 103, - 103, 103, 254, 0, 0, 0, 253, 18, 18, 18, 255, 239, 239, 239, 255, - 187, 187, 187, 255, 0, 0, 0, 253, 34, 34, 34, 255, 18, 18, 18, - 255, 0, 0, 0, 253, 0, 0, 0, 253, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 86, 86, 86, 255, 0, 0, 0, 253, 34, 34, 34, 255, - 255, 255, 255, 253, 255, 255, 255, 255, 70, 70, 70, 255, 0, 0, 0, - 253, 18, 18, 18, 255, 69, 69, 69, 254, 18, 18, 18, 255, 0, 0, - 0, 253, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 233, 255, - 255, 255, 0, 255, 255, 255, 57, 255, 255, 255, 255, 102, 102, 102, 255, - 0, 0, 0, 253, 49, 49, 49, 253, 18, 18, 18, 255, 18, 18, 18, - 255, 223, 223, 223, 255, 255, 255, 255, 255, 102, 102, 102, 255, 0, 0, - 0, 253, 49, 49, 49, 253, 18, 18, 18, 255, 18, 18, 18, 255, 207, - 207, 207, 255, 187, 187, 187, 255, 0, 0, 0, 253, 18, 18, 18, 255, - 50, 50, 50, 254, 18, 18, 18, 255, 0, 0, 0, 253, 34, 34, 34, - 255, 70, 70, 70, 253, 18, 18, 18, 255, 0, 0, 0, 253, 223, 223, - 223, 255, 255, 255, 255, 170, 255, 255, 255, 230, 153, 153, 153, 255, 0, - 0, 0, 253, 169, 169, 169, 255, 153, 153, 153, 255, 18, 18, 18, 255, - 0, 0, 0, 253, 207, 207, 207, 255, 137, 137, 137, 255, 0, 0, 0, - 253, 207, 207, 207, 255, 153, 153, 153, 255, 0, 0, 0, 253, 169, 169, - 169, 255, 153, 153, 153, 255, 18, 18, 18, 255, 0, 0, 0, 253, 207, - 207, 207, 255, 137, 137, 137, 255, 0, 0, 0, 253, 207, 207, 207, 255, - 153, 153, 153, 255, 0, 0, 0, 253, 169, 169, 169, 255, 153, 153, 153, - 255, 18, 18, 18, 255, 0, 0, 0, 253, 207, 207, 207, 255, 137, 137, - 137, 255, 0, 0, 0, 253, 207, 207, 207, 255, 255, 255, 255, 170, 255, - 255, 255, 172, 187, 187, 187, 255, 0, 0, 0, 253, 18, 18, 18, 255, - 207, 207, 207, 255, 255, 255, 255, 255, 255, 255, 255, 255, 86, 86, 86, - 255, 0, 0, 0, 253, 137, 137, 137, 255, 187, 187, 187, 255, 0, 0, - 0, 253, 70, 70, 70, 255, 255, 255, 255, 255, 169, 169, 169, 255, 0, - 0, 0, 253, 86, 86, 86, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 137, 137, 137, 255, 0, 0, 0, 253, 137, 137, 137, - 255, 187, 187, 187, 255, 0, 0, 0, 253, 0, 0, 0, 253, 207, 207, - 207, 255, 255, 255, 255, 255, 223, 223, 223, 255, 0, 0, 0, 253, 0, - 0, 0, 253, 255, 255, 255, 255, 187, 187, 187, 255, 0, 0, 0, 253, - 34, 34, 34, 255, 239, 239, 239, 255, 255, 255, 255, 255, 239, 239, 239, - 255, 50, 50, 50, 255, 0, 0, 0, 253, 137, 137, 137, 255, 169, 169, - 169, 255, 0, 0, 0, 253, 86, 86, 86, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 137, 137, 137, 255, 0, 0, 0, 253, - 137, 137, 137, 255, 187, 187, 187, 255, 0, 0, 0, 253, 0, 0, 0, - 253, 137, 137, 137, 255, 255, 255, 255, 255, 169, 169, 169, 255, 255, 255, - 255, 255, 255, 255, 255, 0, 255, 255, 255, 86, 138, 138, 138, 236, 0, - 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 18, 18, 18, 255, - 223, 223, 223, 255, 255, 255, 255, 255, 187, 187, 187, 255, 0, 0, 0, - 253, 34, 34, 34, 255, 239, 239, 239, 255, 255, 255, 255, 255, 239, 239, - 239, 255, 50, 50, 50, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, - 255, 255, 233, 255, 255, 255, 0, 255, 255, 255, 170, 207, 207, 207, 255, - 0, 0, 0, 253, 118, 118, 118, 255, 255, 255, 255, 255, 187, 187, 187, - 255, 0, 0, 0, 253, 137, 137, 137, 254, 207, 207, 207, 255, 0, 0, - 0, 253, 118, 118, 118, 255, 255, 255, 255, 255, 239, 239, 239, 255, 0, - 0, 0, 253, 86, 86, 86, 255, 187, 187, 187, 255, 0, 0, 0, 253, - 86, 86, 86, 255, 255, 255, 255, 255, 169, 169, 169, 255, 0, 0, 0, - 253, 102, 102, 102, 255, 255, 255, 255, 255, 169, 169, 169, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 198, 255, 255, 255, 141, 239, - 239, 239, 255, 0, 0, 0, 253, 102, 102, 102, 255, 102, 102, 102, 255, - 86, 86, 86, 255, 18, 18, 18, 255, 137, 137, 137, 255, 86, 86, 86, - 255, 34, 34, 34, 255, 255, 255, 255, 255, 239, 239, 239, 255, 0, 0, - 0, 253, 102, 102, 102, 255, 102, 102, 102, 255, 86, 86, 86, 255, 18, - 18, 18, 255, 137, 137, 137, 255, 86, 86, 86, 255, 34, 34, 34, 255, - 255, 255, 255, 255, 239, 239, 239, 255, 0, 0, 0, 253, 102, 102, 102, - 255, 102, 102, 102, 255, 86, 86, 86, 255, 18, 18, 18, 255, 137, 137, - 137, 255, 86, 86, 86, 255, 34, 34, 34, 255, 255, 255, 255, 255, 255, - 255, 255, 57, 255, 255, 255, 172, 187, 187, 187, 255, 0, 0, 0, 253, - 70, 70, 70, 255, 255, 255, 255, 255, 255, 255, 255, 57, 255, 255, 255, - 245, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 187, 187, - 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, 255, 255, 137, - 137, 137, 255, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, - 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, - 253, 70, 70, 70, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, - 70, 255, 255, 255, 255, 255, 255, 255, 255, 95, 255, 255, 255, 255, 0, - 0, 0, 253, 0, 0, 0, 253, 255, 255, 255, 255, 137, 137, 137, 255, - 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 254, 255, 255, 255, - 35, 255, 255, 255, 253, 137, 137, 137, 255, 0, 0, 0, 253, 137, 137, - 137, 255, 137, 137, 137, 255, 0, 0, 0, 253, 0, 0, 0, 253, 0, - 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, - 0, 0, 0, 253, 70, 70, 70, 255, 187, 187, 187, 255, 0, 0, 0, - 253, 50, 50, 50, 255, 255, 255, 255, 255, 255, 255, 255, 222, 255, 255, - 255, 213, 255, 255, 255, 252, 255, 255, 255, 254, 255, 255, 255, 254, 187, - 187, 187, 255, 137, 137, 137, 255, 137, 137, 137, 255, 34, 34, 34, 255, - 0, 0, 0, 253, 34, 34, 34, 255, 255, 255, 255, 255, 137, 137, 137, - 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 254, 255, 255, - 255, 35, 255, 255, 255, 253, 137, 137, 137, 255, 0, 0, 0, 253, 137, - 137, 137, 255, 255, 255, 255, 233, 255, 255, 255, 0, 255, 255, 255, 194, - 137, 137, 137, 255, 0, 0, 0, 253, 187, 187, 187, 255, 255, 255, 255, - 242, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 137, 137, - 137, 255, 0, 0, 0, 253, 187, 187, 187, 255, 255, 255, 255, 234, 255, - 255, 255, 255, 70, 70, 70, 255, 18, 18, 18, 255, 187, 187, 187, 255, - 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 253, 187, 187, 187, - 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 252, 187, 187, - 187, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 233, 255, - 255, 255, 17, 255, 255, 255, 255, 70, 70, 70, 255, 34, 34, 34, 255, - 50, 50, 50, 255, 137, 137, 137, 255, 86, 86, 86, 255, 70, 70, 70, - 255, 0, 0, 0, 253, 118, 118, 118, 255, 255, 255, 255, 253, 255, 255, - 255, 255, 70, 70, 70, 255, 34, 34, 34, 255, 50, 50, 50, 255, 137, - 137, 137, 255, 86, 86, 86, 255, 70, 70, 70, 255, 0, 0, 0, 253, - 118, 118, 118, 255, 255, 255, 255, 253, 255, 255, 255, 255, 70, 70, 70, - 255, 34, 34, 34, 255, 50, 50, 50, 255, 137, 137, 137, 255, 86, 86, - 86, 255, 70, 70, 70, 255, 0, 0, 0, 253, 118, 118, 118, 255, 255, - 255, 255, 255, 255, 255, 255, 252, 255, 255, 255, 254, 187, 187, 187, 255, - 0, 0, 0, 253, 50, 50, 50, 255, 255, 255, 255, 255, 255, 255, 255, - 250, 255, 255, 255, 255, 153, 153, 153, 255, 0, 0, 0, 253, 86, 86, - 86, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, - 255, 255, 255, 137, 137, 137, 255, 0, 0, 0, 253, 86, 86, 86, 255, - 187, 187, 187, 255, 187, 187, 187, 255, 187, 187, 187, 255, 187, 187, 187, - 255, 187, 187, 187, 255, 207, 207, 207, 255, 187, 187, 187, 255, 0, 0, - 0, 253, 70, 70, 70, 255, 255, 255, 255, 254, 255, 255, 255, 0, 255, - 255, 255, 255, 0, 0, 0, 253, 0, 0, 0, 253, 255, 255, 255, 255, - 137, 137, 137, 255, 0, 0, 0, 253, 102, 102, 102, 255, 255, 255, 255, - 255, 255, 255, 255, 243, 255, 255, 255, 255, 118, 118, 118, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 137, 137, 137, 255, 0, 0, 0, 253, 86, - 86, 86, 255, 187, 187, 187, 255, 187, 187, 187, 255, 187, 187, 187, 255, - 187, 187, 187, 255, 187, 187, 187, 255, 207, 207, 207, 255, 187, 187, 187, - 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, 255, 254, 255, 255, - 255, 0, 255, 255, 255, 86, 153, 153, 153, 255, 70, 70, 70, 255, 102, - 102, 102, 255, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, 255, - 187, 187, 187, 255, 0, 0, 0, 253, 0, 0, 0, 253, 187, 187, 187, - 255, 137, 137, 137, 255, 0, 0, 0, 253, 102, 102, 102, 255, 255, 255, - 255, 255, 255, 255, 255, 243, 255, 255, 255, 255, 118, 118, 118, 255, 0, - 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 254, 255, 255, 255, 252, - 255, 255, 255, 254, 153, 153, 153, 255, 0, 0, 0, 253, 169, 169, 169, - 255, 255, 255, 255, 251, 255, 255, 255, 255, 187, 187, 187, 255, 207, 207, - 207, 255, 153, 153, 153, 255, 0, 0, 0, 253, 169, 169, 169, 255, 255, - 255, 255, 248, 255, 255, 255, 255, 50, 50, 50, 255, 34, 34, 34, 255, - 187, 187, 187, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, - 249, 187, 187, 187, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, - 255, 249, 187, 187, 187, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, - 255, 255, 233, 255, 255, 255, 0, 255, 255, 255, 241, 137, 137, 137, 255, - 0, 0, 0, 253, 0, 0, 0, 253, 207, 207, 207, 255, 153, 153, 153, - 255, 0, 0, 0, 253, 0, 0, 0, 253, 207, 207, 207, 255, 255, 255, - 255, 200, 255, 255, 255, 241, 137, 137, 137, 255, 0, 0, 0, 253, 0, - 0, 0, 253, 207, 207, 207, 255, 153, 153, 153, 255, 0, 0, 0, 253, - 0, 0, 0, 253, 207, 207, 207, 255, 255, 255, 255, 200, 255, 255, 255, - 241, 137, 137, 137, 255, 0, 0, 0, 253, 0, 0, 0, 253, 207, 207, - 207, 255, 153, 153, 153, 255, 0, 0, 0, 253, 0, 0, 0, 253, 207, - 207, 207, 255, 207, 207, 207, 255, 70, 70, 70, 255, 118, 118, 118, 255, - 187, 187, 187, 255, 0, 0, 0, 253, 0, 0, 0, 253, 86, 86, 86, - 255, 187, 187, 187, 255, 153, 153, 153, 255, 18, 18, 18, 255, 0, 0, - 0, 253, 169, 169, 169, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, - 70, 70, 255, 255, 255, 255, 255, 223, 223, 223, 255, 0, 0, 0, 253, - 18, 18, 18, 255, 169, 169, 169, 255, 255, 255, 255, 255, 223, 223, 223, - 255, 50, 50, 50, 255, 0, 0, 0, 253, 138, 138, 138, 248, 187, 187, - 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, 255, 254, 255, - 255, 255, 0, 255, 255, 255, 255, 0, 0, 0, 253, 0, 0, 0, 253, - 255, 255, 255, 255, 223, 223, 223, 255, 18, 18, 18, 255, 0, 0, 0, - 253, 137, 137, 137, 255, 187, 187, 187, 255, 137, 137, 137, 255, 0, 0, - 0, 253, 0, 0, 0, 253, 137, 137, 137, 255, 223, 223, 223, 255, 0, - 0, 0, 253, 18, 18, 18, 255, 169, 169, 169, 255, 255, 255, 255, 255, - 223, 223, 223, 255, 50, 50, 50, 255, 0, 0, 0, 253, 138, 138, 138, - 248, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, - 255, 254, 255, 255, 255, 0, 255, 255, 255, 141, 186, 186, 186, 252, 0, - 0, 0, 253, 0, 0, 0, 253, 118, 118, 118, 255, 187, 187, 187, 255, - 169, 169, 169, 255, 50, 50, 50, 255, 0, 0, 0, 253, 18, 18, 18, - 255, 255, 255, 255, 255, 223, 223, 223, 255, 18, 18, 18, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 187, 187, 187, 255, 137, 137, 137, 255, 0, - 0, 0, 253, 0, 0, 0, 253, 137, 137, 137, 255, 207, 207, 207, 255, - 70, 70, 70, 255, 118, 118, 118, 255, 223, 223, 223, 255, 0, 0, 0, - 253, 86, 86, 86, 255, 239, 239, 239, 255, 137, 137, 137, 255, 0, 0, - 0, 253, 153, 153, 153, 249, 223, 223, 223, 255, 0, 0, 0, 253, 86, - 86, 86, 255, 239, 239, 239, 255, 187, 187, 187, 255, 0, 0, 0, 253, - 102, 102, 102, 255, 187, 187, 187, 255, 0, 0, 0, 253, 137, 137, 137, - 255, 255, 255, 255, 249, 187, 187, 187, 255, 0, 0, 0, 253, 137, 137, - 137, 255, 255, 255, 255, 249, 187, 187, 187, 255, 0, 0, 0, 253, 137, - 137, 137, 255, 255, 255, 255, 233, 255, 255, 255, 0, 255, 255, 255, 170, - 223, 223, 223, 255, 0, 0, 0, 253, 18, 18, 18, 255, 255, 255, 255, - 255, 223, 223, 223, 255, 0, 0, 0, 253, 34, 34, 34, 255, 255, 255, - 255, 255, 255, 255, 255, 57, 255, 255, 255, 170, 223, 223, 223, 255, 0, - 0, 0, 253, 18, 18, 18, 255, 255, 255, 255, 255, 223, 223, 223, 255, - 0, 0, 0, 253, 34, 34, 34, 255, 255, 255, 255, 255, 255, 255, 255, - 57, 255, 255, 255, 170, 223, 223, 223, 255, 0, 0, 0, 253, 18, 18, - 18, 255, 255, 255, 255, 255, 223, 223, 223, 255, 0, 0, 0, 253, 34, - 34, 34, 255, 255, 255, 255, 255, 187, 187, 187, 247, 0, 0, 0, 253, - 70, 70, 70, 253, 187, 187, 187, 255, 0, 0, 0, 253, 34, 34, 34, - 255, 50, 50, 50, 255, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 255, 187, 187, 187, 255, 0, - 0, 0, 253, 70, 70, 70, 255, 255, 255, 255, 241, 255, 255, 255, 255, - 169, 169, 169, 255, 34, 34, 34, 255, 0, 0, 0, 253, 0, 0, 0, - 253, 0, 0, 0, 253, 18, 18, 18, 255, 137, 137, 137, 255, 255, 255, - 255, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, - 255, 255, 236, 255, 255, 255, 0, 255, 255, 255, 255, 0, 0, 0, 253, - 0, 0, 0, 253, 255, 255, 255, 255, 255, 255, 255, 254, 153, 153, 153, - 255, 18, 18, 18, 255, 0, 0, 0, 253, 0, 0, 0, 253, 18, 18, - 18, 255, 70, 70, 70, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, - 255, 255, 255, 169, 169, 169, 255, 34, 34, 34, 255, 0, 0, 0, 253, - 0, 0, 0, 253, 0, 0, 0, 253, 18, 18, 18, 255, 137, 137, 137, - 255, 255, 255, 255, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, - 70, 255, 255, 255, 255, 236, 255, 255, 255, 0, 255, 255, 255, 86, 255, - 255, 255, 255, 153, 153, 153, 255, 34, 34, 34, 255, 0, 0, 0, 253, - 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 50, 50, 50, - 255, 187, 187, 187, 255, 255, 255, 255, 254, 255, 255, 255, 254, 153, 153, - 153, 255, 18, 18, 18, 255, 0, 0, 0, 253, 0, 0, 0, 253, 18, - 18, 18, 255, 70, 70, 70, 255, 0, 0, 0, 253, 137, 137, 137, 255, - 187, 187, 187, 251, 0, 0, 0, 253, 70, 70, 70, 252, 255, 255, 255, - 255, 153, 153, 153, 255, 18, 18, 18, 255, 0, 0, 0, 253, 0, 0, - 0, 253, 102, 102, 102, 255, 255, 255, 255, 255, 255, 255, 255, 255, 153, - 153, 153, 255, 18, 18, 18, 255, 0, 0, 0, 253, 0, 0, 0, 253, - 70, 70, 70, 255, 239, 239, 239, 255, 187, 187, 187, 255, 0, 0, 0, - 253, 137, 137, 137, 255, 255, 255, 255, 215, 187, 187, 187, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 215, 187, 187, 187, 255, 0, - 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 170, 255, 255, 255, 0, - 255, 255, 255, 36, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 251, 255, 255, 255, 0, 255, 255, 255, 36, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 251, 255, 255, 255, 0, 255, 255, 255, 36, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 253, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 215, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 236, - 255, 255, 255, 113, 255, 255, 255, 253, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 215, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 236, 255, 255, 255, 0, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 141, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 222, 255, 255, 255, 253, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 215, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 236, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 141, 255, 255, 255, 253, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 250, 255, 255, 255, 86, 255, 255, - 255, 141, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 214, 255, - 255, 255, 141, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 246, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 215, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 215, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 170, }; - - *width = 136; - *height = 11; - - // only load the requested logo - // allocate a new array - *data = new unsigned char[5984]; - // and copy it. Now we are certain that the calling function - // can control the memory location - for(int i = 0; i < 5984 /* tmp array size */; i++) - { - (*data)[i] = logo_blender3d_raw[i]; - } - -} - - - diff --git a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h deleted file mode 100644 index 464b7bacec8..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPC_RAWLOGOARRAYS_H -#define __GPC_RAWLOGOARRAYS_H - -void GetRawBlenderLogo(unsigned char **data, int *width, int *height); -void GetRawBlender3DLogo(unsigned char **data, int *width, int *height); -#if 0 -void GetRawNaNLogo(unsigned char **data, int *width, int *height); -#endif - -#endif // __GPC_RAWLOGOARRAYS_H - diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp deleted file mode 100644 index e02b5fedaf0..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ /dev/null @@ -1,435 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "GL/glew.h" - -#include "RAS_IRenderTools.h" -#include "RAS_IRasterizer.h" -#include "RAS_LightObject.h" -#include "RAS_ICanvas.h" -#include "RAS_GLExtensionManager.h" - -#include "KX_GameObject.h" -#include "KX_PolygonMaterial.h" -#include "KX_BlenderMaterial.h" -#include "KX_RayCast.h" -#include "KX_IPhysicsController.h" -#include "KX_Light.h" - -#include "PHY_IPhysicsEnvironment.h" - -#include "STR_String.h" - -#include "GPU_draw.h" - -#include "BKE_bmfont.h" // for text printing -#include "BKE_bmfont_types.h" - -#include "GPC_RenderTools.h" - - -unsigned int GPC_RenderTools::m_numgllights; - -GPC_RenderTools::GPC_RenderTools() -{ -// XXX m_font = BMF_GetFont(BMF_kHelvetica10); - - glGetIntegerv(GL_MAX_LIGHTS, (GLint*) &m_numgllights); - if (m_numgllights < 8) - m_numgllights = 8; -} - -GPC_RenderTools::~GPC_RenderTools() -{ -} - -void GPC_RenderTools::BeginFrame(RAS_IRasterizer* rasty) -{ - m_clientobject = NULL; - m_lastlightlayer = -1; - m_lastauxinfo = NULL; - m_lastlighting = true; /* force disable in DisableOpenGLLights() */ - DisableOpenGLLights(); -} - -void GPC_RenderTools::EndFrame(RAS_IRasterizer* rasty) -{ -} - -/* ProcessLighting performs lighting on objects. the layer is a bitfield that - * contains layer information. There are 20 'official' layers in blender. A - * light is applied on an object only when they are in the same layer. OpenGL - * has a maximum of 8 lights (simultaneous), so 20 * 8 lights are possible in - * a scene. */ - -void GPC_RenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat) -{ - bool enable = false; - int layer= -1; - - /* find the layer */ - if(uselights) { - if(m_clientobject) - layer = static_cast(m_clientobject)->GetLayer(); - } - - /* avoid state switching */ - if(m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo) - return; - - m_lastlightlayer = layer; - m_lastauxinfo = m_auxilaryClientInfo; - - /* enable/disable lights as needed */ - if(layer >= 0) - enable = applyLights(layer, viewmat); - - if(enable) - EnableOpenGLLights(rasty); - else - DisableOpenGLLights(); -} - -void GPC_RenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty) -{ - if(m_lastlighting == true) - return; - - glEnable(GL_LIGHTING); - glEnable(GL_COLOR_MATERIAL); - - glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); - glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (rasty->GetCameraOrtho())? GL_FALSE: GL_TRUE); - if (GLEW_EXT_separate_specular_color || GLEW_VERSION_1_2) - glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR); - - m_lastlighting = true; -} - -void GPC_RenderTools::DisableOpenGLLights() -{ - if(m_lastlighting == false) - return; - - glDisable(GL_LIGHTING); - glDisable(GL_COLOR_MATERIAL); - - m_lastlighting = false; -} - - -void GPC_RenderTools::SetClientObject(RAS_IRasterizer *rasty, void* obj) -{ - if (m_clientobject != obj) - { - bool ccw = (obj == NULL || !((KX_GameObject*)obj)->IsNegativeScaling()); - rasty->SetFrontFace(ccw); - - m_clientobject = obj; - } -} - -bool GPC_RenderTools::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data) -{ - double* const oglmatrix = (double* const) data; - MT_Point3 resultpoint(result->m_hitPoint); - MT_Vector3 resultnormal(result->m_hitNormal); - MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]); - MT_Vector3 dir = -(left.cross(resultnormal)).safe_normalized(); - left = (dir.cross(resultnormal)).safe_normalized(); - // for the up vector, we take the 'resultnormal' returned by the physics - - double maat[16]={ - left[0], left[1], left[2], 0, - dir[0], dir[1], dir[2], 0, - resultnormal[0],resultnormal[1],resultnormal[2], 0, - 0, 0, 0, 1}; - glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]); - //glMultMatrixd(oglmatrix); - glMultMatrixd(maat); - return true; -} - -void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,int objectdrawmode ) -{ - /* FIXME: - blender: intern/moto/include/MT_Vector3.inl:42: MT_Vector3 operator/(const - MT_Vector3&, double): Assertion `!MT_fuzzyZero(s)' failed. - - Program received signal SIGABRT, Aborted. - [Switching to Thread 16384 (LWP 1519)] - 0x40477571 in kill () from /lib/libc.so.6 - (gdb) bt - #7 0x08334368 in MT_Vector3::normalized() const () - #8 0x0833e6ec in GPC_RenderTools::applyTransform(RAS_IRasterizer*, double*, int) () - */ - - if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED || - objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED) - { - // rotate the billboard/halo - //page 360/361 3D Game Engine Design, David Eberly for a discussion - // on screen aligned and axis aligned billboards - // assumed is that the preprocessor transformed all billboard polygons - // so that their normal points into the positive x direction (1.0 , 0.0 , 0.0) - // when new parenting for objects is done, this rotation - // will be moved into the object - - MT_Point3 objpos (oglmatrix[12],oglmatrix[13],oglmatrix[14]); - MT_Point3 campos = rasty->GetCameraPosition(); - MT_Vector3 dir = (campos - objpos).safe_normalized(); - MT_Vector3 up(0,0,1.0); - - KX_GameObject* gameobj = (KX_GameObject*) this->m_clientobject; - // get scaling of halo object - MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale(); - - bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned - if (screenaligned) - { - up = (up - up.dot(dir) * dir).safe_normalized(); - } else - { - dir = (dir - up.dot(dir)*up).safe_normalized(); - } - - MT_Vector3 left = dir.normalized(); - dir = (left.cross(up)).normalized(); - - // we have calculated the row vectors, now we keep - // local scaling into account: - - left *= size[0]; - dir *= size[1]; - up *= size[2]; - double maat[16]={ - left[0], left[1],left[2], 0, - dir[0], dir[1],dir[2],0, - up[0],up[1],up[2],0, - 0,0,0,1}; - glTranslated(objpos[0],objpos[1],objpos[2]); - glMultMatrixd(maat); - - } else - { - if (objectdrawmode & RAS_IPolyMaterial::SHADOW) - { - // shadow must be cast to the ground, physics system needed here! - MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]); - KX_GameObject *gameobj = (KX_GameObject*) this->m_clientobject; - MT_Vector3 direction = MT_Vector3(0,0,-1); - - direction.normalize(); - direction *= 100000; - - MT_Point3 topoint = frompoint + direction; - - KX_Scene* kxscene = (KX_Scene*) m_auxilaryClientInfo; - PHY_IPhysicsEnvironment* physics_environment = kxscene->GetPhysicsEnvironment(); - KX_IPhysicsController* physics_controller = gameobj->GetPhysicsController(); - - KX_GameObject *parent = gameobj->GetParent(); - if (!physics_controller && parent) - physics_controller = parent->GetPhysicsController(); - if (parent) - parent->Release(); - - KX_RayCast::Callback callback(this, physics_controller, oglmatrix); - if (!KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback)) - { - // couldn't find something to cast the shadow on... - glMultMatrixd(oglmatrix); - } - } else - { - - // 'normal' object - glMultMatrixd(oglmatrix); - } - } -} - - -void GPC_RenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode, - const char* text, - int xco, - int yco, - int width, - int height) -{ - STR_String tmpstr(text); - char* s = tmpstr.Ptr(); - - // Save and change OpenGL settings - int texture2D; - glGetIntegerv(GL_TEXTURE_2D, (GLint*)&texture2D); - glDisable(GL_TEXTURE_2D); - int fog; - glGetIntegerv(GL_FOG, (GLint*)&fog); - glDisable(GL_FOG); - - int light; - glGetIntegerv(GL_LIGHTING, (GLint*)&light); - glDisable(GL_LIGHTING); - - - // Set up viewing settings - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - // Actual drawing (draw black first if padded) - if (mode == RAS_IRenderTools::RAS_TEXT_PADDED) - { - glColor3ub(0, 0, 0); - glRasterPos2s(xco+1, height-yco-1); - // XXX BMF_DrawString(m_font, s); - } - - glColor3ub(255, 255, 255); - glRasterPos2s(xco, height-yco); - // XXX BMF_DrawString(m_font, s); - - // Restore view settings - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - - // Restore OpenGL Settings - if (fog) - glEnable(GL_FOG); - else - glDisable(GL_FOG); - - if (texture2D) - glEnable(GL_TEXTURE_2D); - else - glDisable(GL_TEXTURE_2D); - if (light) - glEnable(GL_LIGHTING); - else - glDisable(GL_LIGHTING); -} - -/* Render Text renders text into a (series of) polygon, using a texture font, - * Each character consists of one polygon (one quad or two triangles) */ - -void GPC_RenderTools::RenderText( - int mode, - RAS_IPolyMaterial* polymat, - float v1[3], float v2[3], float v3[3], float v4[3], int glattrib) -{ - STR_String mytext = ((CValue*)m_clientobject)->GetPropertyText("Text"); - - const unsigned int flag = polymat->GetFlag(); - struct MTFace* tface = 0; - unsigned int *col = 0; - - if(flag & RAS_BLENDERMAT) { - KX_BlenderMaterial *bl_mat = static_cast(polymat); - tface = bl_mat->GetMTFace(); - col = bl_mat->GetMCol(); - } else { - KX_PolygonMaterial* blenderpoly = static_cast(polymat); - tface = blenderpoly->GetMTFace(); - col = blenderpoly->GetMCol(); - } - - GPU_render_text(tface, mode, mytext, mytext.Length(), col, v1, v2, v3, v4, glattrib); -} - - -void GPC_RenderTools::PushMatrix() -{ - glPushMatrix(); -} - -void GPC_RenderTools::PopMatrix() -{ - glPopMatrix(); -} - - -int GPC_RenderTools::applyLights(int objectlayer, const MT_Transform& viewmat) -{ - // taken from blender source, incompatibility between Blender Object / GameObject - KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo; - float glviewmat[16]; - unsigned int count; - std::vector::iterator lit = m_lights.begin(); - - for(count=0; countm_light; - - if(kxlight->ApplyLight(kxscene, objectlayer, count)) - count++; - } - glPopMatrix(); - - return count; -} - -void GPC_RenderTools::MotionBlur(RAS_IRasterizer* rasterizer) -{ - int state = rasterizer->GetMotionBlurState(); - float motionblurvalue; - if(state) - { - motionblurvalue = rasterizer->GetMotionBlurValue(); - if(state==1) - { - //bugfix:load color buffer into accum buffer for the first time(state=1) - glAccum(GL_LOAD, 1.0); - rasterizer->SetMotionBlurState(2); - } - else if(motionblurvalue>=0.0 && motionblurvalue<=1.0) - { - glAccum(GL_MULT, motionblurvalue); - glAccum(GL_ACCUM, 1-motionblurvalue); - glAccum(GL_RETURN, 1.0); - glFlush(); - } - } -} - diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.h b/source/gameengine/GamePlayer/common/GPC_RenderTools.h deleted file mode 100644 index 378c6d8580f..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.h +++ /dev/null @@ -1,103 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPC_RENDERTOOLS_H -#define __GPC_RENDERTOOLS_H - -#ifdef WIN32 -// don't show stl-warnings -#pragma warning (disable:4786) -#include -#endif // WIN32 - -#include "RAS_IRenderTools.h" - -struct KX_ClientObjectInfo; -class KX_RayCast; - -/* BlenderRenderTools are a set of tools to apply 2D/3D graphics effects, which - * are not part of the (polygon) Rasterizer. Effects like 2D text, 3D (polygon) - * text, lighting. - * - * Most of this code is duplicated in KX_BlenderRenderTools, so this should be - * moved to some common location to avoid duplication. */ - -class GPC_RenderTools : public RAS_IRenderTools -{ - int m_lastlightlayer; - bool m_lastlighting; - void *m_lastauxinfo; - static unsigned int m_numgllights; - -// XXX BMF_Font* m_font; - -public: - GPC_RenderTools(); - virtual ~GPC_RenderTools(); - - void EndFrame(RAS_IRasterizer* rasty); - void BeginFrame(RAS_IRasterizer* rasty); - - void EnableOpenGLLights(RAS_IRasterizer *rasty); - void DisableOpenGLLights(); - void ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat); - - /* @attention mode is ignored here */ - void RenderText2D(RAS_TEXT_RENDER_MODE mode, - const char* text, - int xco, - int yco, - int width, - int height); - void RenderText(int mode, - class RAS_IPolyMaterial* polymat, - float v1[3], - float v2[3], - float v3[3], - float v4[3], - int glattrib); - - void applyTransform(RAS_IRasterizer* rasty, double* oglmatrix, int objectdrawmode); - int applyLights(int objectlayer, const MT_Transform& viewmat); - - void PushMatrix(); - void PopMatrix(); - - bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data); - bool NeedRayCast(KX_ClientObjectInfo* client) { return true; } - - virtual void MotionBlur(RAS_IRasterizer* rasterizer); - - virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj); -}; - -#endif // __GPC_RENDERTOOLS_H - - - diff --git a/source/gameengine/GamePlayer/common/GPC_System.cpp b/source/gameengine/GamePlayer/common/GPC_System.cpp deleted file mode 100644 index 36022bae9dd..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_System.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "GPC_System.h" - -#include "GPC_KeyboardDevice.h" -#include "NG_NetworkDeviceInterface.h" - -GPC_System::GPC_System() -// : m_ndi(0) -{ -} - -/* -void GPC_System::NextFrame() -{ - // Have the imput devices proceed - std::vector::iterator idev; - for (idev = m_inputDevices.begin(); !(idev == m_inputDevices.end()); idev++) { - (*idev)->NextFrame(); - } - - // Have the network device proceed - if (m_ndi) { - m_ndi->NextFrame(); - } -} - -void GPC_System::StartMainLoop() -{ -} - - -void GPC_System::Sleep(int millisec) -{ - // do nothing for now ;) -} - - -void GPC_System::AddKey(unsigned char key, bool down) -{ - GPC_KeyboardDevice* keydev = (GPC_KeyboardDevice*) this->GetKeyboardDevice(); - if (keydev) { - //SCA_IInputDevice::KX_EnumInputs inp = keydev->ToNative(key); - keydev->ConvertEvent(key, down); - } -} - - -void GPC_System::SetNetworkDevice(NG_NetworkDeviceInterface* ndi) -{ - m_ndi = ndi; -} - - -NG_NetworkDeviceInterface* GPC_System::GetNetworkDevice() const -{ - return m_ndi; -} -*/ diff --git a/source/gameengine/GamePlayer/common/GPC_System.h b/source/gameengine/GamePlayer/common/GPC_System.h deleted file mode 100644 index 65a488e08bd..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_System.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPC_SYSTEM_H -#define __GPC_SYSTEM_H - -#if defined(WIN32) -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif /* WIN32 */ - -#include "KX_ISystem.h" - -//class NG_NetworkDeviceInterface; - -class GPC_System : public KX_ISystem -{ -public: - GPC_System(); - -// virtual void NextFrame(); -// virtual void StartMainLoop(); - virtual double GetTimeInSeconds() = 0; -// virtual void Sleep(int millisec); - //virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode); -// void AddKey(unsigned char key, bool down); - -// virtual void SetNetworkDevice(NG_NetworkDeviceInterface* ndi); -// virtual NG_NetworkDeviceInterface* GetNetworkDevice() const; - -//protected: -// NG_NetworkDeviceInterface* m_ndi; -}; - -#endif // __GPC_SYSTEM_H - diff --git a/source/gameengine/GamePlayer/common/Makefile b/source/gameengine/GamePlayer/common/Makefile deleted file mode 100644 index e1b07a226f6..00000000000 --- a/source/gameengine/GamePlayer/common/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = common -DIR = $(OCGDIR)/gameengine/GamePlayer/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(OPENGL_HEADERS) - -CPPFLAGS += -I../../../blender/blenkernel -CPPFLAGS += -I../../../blender/blenloader -CPPFLAGS += -I../../../blender/blenlib -CPPFLAGS += -I../../../blender/imbuf -CPPFLAGS += -I../../../blender/makesdna -CPPFLAGS += -I../../../blender/gpu -CPPFLAGS += -I../../../kernel/gen_system -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include - -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I$(NAN_PNG)/include -CPPFLAGS += -I$(NAN_ZLIB)/include -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) -CPPFLAGS += -I$(NAN_AUDASPACE)/include - -CPPFLAGS += -I../../../gameengine/Converter -CPPFLAGS += -I../../../gameengine/Expressions -CPPFLAGS += -I../../../gameengine/GameLogic -CPPFLAGS += -I../../../gameengine/Converter -CPPFLAGS += -I../../../gameengine/BlenderRoutines -CPPFLAGS += -I../../../gameengine/Ketsji -CPPFLAGS += -I../../../gameengine/Ketsji/KXNetwork -CPPFLAGS += -I../../../gameengine/Network -CPPFLAGS += -I../../../gameengine/Network/LoopBackNetwork -CPPFLAGS += -I../../../gameengine/Rasterizer -CPPFLAGS += -I../../../gameengine/SceneGraph -CPPFLAGS += -I../../../gameengine/Rasterizer/RAS_OpenGLRasterizer -CPPFLAGS += -I../../../gameengine/Physics/common - -############################### - -SOURCEDIR = source/gameengine/GamePlayer/common -DIRS = -ifeq ($(OS),windows) -# Still - DIRS = windows -else - ifneq ($(OS),darwin) - DIRS = unix - endif -endif - -include nan_subdirs.mk diff --git a/source/gameengine/GamePlayer/common/SConscript b/source/gameengine/GamePlayer/common/SConscript deleted file mode 100644 index b66d644f9f5..00000000000 --- a/source/gameengine/GamePlayer/common/SConscript +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/python -import sys -Import ('env') - - -source_files = ['bmfont.cpp', - 'GPC_Canvas.cpp', - 'GPC_Engine.cpp', - 'GPC_KeyboardDevice.cpp', - 'GPC_MouseDevice.cpp', - 'GPC_RawImage.cpp', - 'GPC_RawLoadDotBlendArray.cpp', - 'GPC_RawLogoArrays.cpp', - 'GPC_RenderTools.cpp', - 'GPC_System.cpp'] - -incs = ['.', - '#intern/string', - '#intern/ghost', - '#intern/guardedalloc', - '#intern/moto/include', - '#source/gameengine/Rasterizer/RAS_OpenGLRasterizer', - '#source/kernel/gen_system', - '#source/kernel/gen_messaging', - '#source/gameengine/Converter', - '#source/blender/imbuf', - '#source/gameengine/Ketsji', - '#source/blender/blenlib', - '#source/blender/blenkernel', - '#source/blender', - '#source/blender/include', - '#source/blender/makesdna', - '#source/gameengine/BlenderRoutines', - '#source/gameengine/Rasterizer', - '#source/gameengine/GameLogic', - '#source/gameengine/Expressions', - '#source/gameengine/Network', - '#source/gameengine/SceneGraph', - '#source/gameengine/Physics/common', - '#source/gameengine/Network/LoopBackNetwork', - '#source/gameengine/GamePlayer/ghost', - '#source/blender/misc', - '#source/blender/blenloader', - '#source/blender/gpu', - '#extern/glew/include'] - -#This is all plugin stuff! -#if sys.platform=='win32': -# source_files += ['windows/GPW_Canvas.cpp', -# 'windows/GPW_Engine.cpp', -# 'windows/GPW_KeyboardDevice.cpp', -# 'windows/GPW_System.cpp'] -# gp_common_env.Append ( CPPPATH = ['windows']) -#elif sys.platform=='linux2' or sys.platform=='linux-i386': -# source_files += ['unix/GPU_Canvas.cpp', -# 'unix/GPU_Engine.cpp', -# 'unix/GPU_KeyboardDevice.cpp', -# 'unix/GPU_System.cpp'] -# gp_common_env.Append ( CPPPATH = ['unix']) - -defs = [ 'GLEW_STATIC' ] - -if env['WITH_BF_PYTHON']: - incs += Split(env['BF_PYTHON_INC']) -else: - defs.append('DISABLE_PYTHON') - -incs += Split(env['BF_PNG_INC']) -incs += Split(env['BF_ZLIB_INC']) - -env.BlenderLib (libname='gp_common', sources=source_files, includes=incs, defines = defs, libtype=['player'], priority=[5], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/GamePlayer/common/bmfont.cpp b/source/gameengine/GamePlayer/common/bmfont.cpp deleted file mode 100644 index 3532eb81f87..00000000000 --- a/source/gameengine/GamePlayer/common/bmfont.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/** - * bmfont.c - * - * 04-10-2000 frank - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -/** - * Two external functions: - * - * void detectBitmapFont(ImBuf *ibuf) - * detects if an image buffer contains a bitmap font. It makes the - * specific bitmap data which is stored in the bitmap invisible to blender. - * - * void matrixGlyph(ImBuf * ibuf, unsigned short unicode, *float x 7) - * returns all the information about the character (unicode) in the floats - * - * Room for improvement: - * add kerning data in the bitmap - * all calculations in matrixGlyph() are static and could be done during - * initialization - */ - -#include - -#include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" -#include "BKE_global.h" -#include "IMB_imbuf_types.h" - -#include "BKE_bmfont.h" -#include "BKE_bmfont_types.h" - -/*MAART: -void printfGlyph(bmGlyph * glyph) -{ - printf("unicode: %d '%c'\n", glyph->unicode, glyph->unicode); - printf(" locx: %4d locy: %4d\n", glyph->locx, glyph->locy); - printf(" sizex: %3d sizey: %3d\n", glyph->sizex, glyph->sizey); - printf(" ofsx: %3d ofsy: %3d\n", glyph->ofsx, glyph->ofsy); - printf(" advan: %3d reser: %3d\n", glyph->advance, glyph->reserved); -} -*/ - -#define MAX2(x,y) ( (x)>(y) ? (x) : (y) ) -#define MAX3(x,y,z) MAX2( MAX2((x),(y)) , (z) ) - -void calcAlpha(ImBuf * ibuf) -{ - int i; - char * rect; - - if (ibuf) { - rect = (char *) ibuf->rect; - for (i = ibuf->x * ibuf->y ; i > 0 ; i--) { - rect[3] = MAX3(rect[0], rect[1], rect[2]); - rect += 4; - } - } -} - -void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step) -{ - int glyphcount, bytes, i, index, linelength, ysize; - unsigned char * buffer; - bmFont * bmfont; - - linelength = ibuf->x * step; - - glyphcount = (rect[6 * step] << 8) | rect[7 * step]; - bytes = ((glyphcount - 1) * sizeof(bmGlyph)) + sizeof(bmFont); - - ysize = (bytes + (ibuf->x - 1)) / ibuf->x; - - if (ysize < ibuf->y) { - // we're first going to copy all data into a liniar buffer. - // step can be 4 or 1 bytes, and the data is not sequential because - // the bitmap was flipped vertically. - - buffer = (unsigned char*)MEM_mallocN(bytes, "readBitmapFontVersion0:buffer"); - - index = 0; - for (i = 0; i < bytes; i++) { - buffer[i] = rect[index]; - index += step; - if (index >= linelength) { - // we've read one line, no skip to the line *before* that - rect -= linelength; - index -= linelength; - } - } - - // we're now going to endian convert the data - - bmfont = (bmFont*)MEM_mallocN(bytes, "readBitmapFontVersion0:bmfont"); - index = 0; - - // first read the header - bmfont->magic[0] = buffer[index++]; - bmfont->magic[1] = buffer[index++]; - bmfont->magic[2] = buffer[index++]; - bmfont->magic[3] = buffer[index++]; - bmfont->version = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->glyphcount = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->xsize = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->ysize = (buffer[index] << 8) | buffer[index + 1]; index += 2; - - for (i = 0; i < bmfont->glyphcount; i++) { - bmfont->glyphs[i].unicode = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->glyphs[i].locx = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->glyphs[i].locy = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->glyphs[i].ofsx = buffer[index++]; - bmfont->glyphs[i].ofsy = buffer[index++]; - bmfont->glyphs[i].sizex = buffer[index++]; - bmfont->glyphs[i].sizey = buffer[index++]; - bmfont->glyphs[i].advance = buffer[index++]; - bmfont->glyphs[i].reserved = buffer[index++]; - /* MAART: - if (G.f & G_DEBUG) { - printfGlyph(&bmfont->glyphs[i]); - } - */ - } - - MEM_freeN(buffer); - - /* MAART: - if (G.f & G_DEBUG) { - printf("Oldy = %d Newy = %d\n", ibuf->y, ibuf->y - ysize); - printf("glyphcount = %d\n", glyphcount); - printf("bytes = %d\n", bytes); - } - */ - - // we've read the data from the image. Now we're going - // to crop the image vertically so only the bitmap data - // remains visible - - ibuf->y -= ysize; - ibuf->userdata = bmfont; - ibuf->userflags |= IB_BITMAPFONT; - - if (ibuf->depth < 32) { - // we're going to fake alpha here: - calcAlpha(ibuf); - } - } else { - /* MAART: - printf("readBitmapFontVersion0: corrupted bitmapfont\n"); - */ - } -} - -void detectBitmapFont(ImBuf *ibuf) -{ - unsigned char * rect; - unsigned short version; - long i; - - if (ibuf != NULL) { - // bitmap must have an x size that is a power of two - if (is_power_of_two(ibuf->x)) { - rect = (unsigned char *) (ibuf->rect + (ibuf->x * (ibuf->y - 1))); - // printf ("starts with: %s %c %c %c %c\n", rect, rect[0], rect[1], rect[2], rect[3]); - if (rect[0] == 'B' && rect[1] == 'F' && rect[2] == 'N' && rect[3] == 'T') { - // printf("found 8bit font !\n"); - // round y size down - // do the 8 bit font stuff. (not yet) - } else { - // we try all 4 possible combinations - for (i = 0; i < 4; i++) { - if (rect[0] == 'B' && rect[4] == 'F' && rect[8] == 'N' && rect[12] == 'T') { - // printf("found 24bit font !\n"); - // We're going to parse the file: - - version = (rect[16] << 8) | rect[20]; - - if (version == 0) { - readBitmapFontVersion0(ibuf, rect, 4); - } else { - //printf("detectBitmapFont :Unsupported version %d\n", version); - } - - // on succes ibuf->userdata points to the bitmapfont - if (ibuf->userdata) { - break; - } - } - rect++; - } - } - } - } -} - -int locateGlyph(bmFont *bmfont, unsigned short unicode) -{ - int min, max, current = 0; - - if (bmfont) { - min = 0; - max = bmfont->glyphcount; - while (1) { - // look halfway for glyph - current = (min + max) >> 1; - - if (bmfont->glyphs[current].unicode == unicode) { - break; - } else if (bmfont->glyphs[current].unicode < unicode) { - // have to move up - min = current; - } else { - // have to move down - max = current; - } - - if (max - min <= 1) { - // unable to locate glyph - current = 0; - break; - } - } - } - - return(current); -} - -void matrixGlyph(ImBuf * ibuf, unsigned short unicode, - float *centerx, float *centery, - float *sizex, float *sizey, - float *transx, float *transy, - float *movex, float *movey, - float *advance) -{ - int index; - bmFont *bmfont; - - *centerx = *centery = 0.0; - *sizex = *sizey = 1.0; - *transx = *transy = 0.0; - *movex = *movey = 0.0; - *advance = 1.0; - - if (ibuf) { - bmfont = (bmFont*)ibuf->userdata; - if (bmfont && (ibuf->userflags & IB_BITMAPFONT)) { - index = locateGlyph(bmfont, unicode); - if (index) { - - *sizex = (bmfont->glyphs[index].sizex) / (float) (bmfont->glyphs[0].sizex); - *sizey = (bmfont->glyphs[index].sizey) / (float) (bmfont->glyphs[0].sizey); - - *transx = bmfont->glyphs[index].locx / (float) ibuf->x; - *transy = (ibuf->y - bmfont->glyphs[index].locy) / (float) ibuf->y; - - *centerx = bmfont->glyphs[0].locx / (float) ibuf->x; - *centery = (ibuf->y - bmfont->glyphs[0].locy) / (float) ibuf->y; - - // 2.0 units is the default size of an object - - *movey = (float)(1.0 - *sizey + 2.0 * (bmfont->glyphs[index].ofsy - bmfont->glyphs[0].ofsy) / (float) bmfont->glyphs[0].sizey); - *movex = (float)(*sizex - 1.0 + 2.0 * (bmfont->glyphs[index].ofsx - bmfont->glyphs[0].ofsx) / (float) bmfont->glyphs[0].sizex); - - *advance = (float)(2.0 * bmfont->glyphs[index].advance / (float) bmfont->glyphs[0].advance); - - // printfGlyph(&bmfont->glyphs[index]); - // printf("%c %d %0.5f %0.5f %0.5f %0.5f %0.5f \n", unicode, index, *sizex, *sizey, *transx, *transy, *advance); - } - } - } -} diff --git a/source/gameengine/GamePlayer/common/load.blend b/source/gameengine/GamePlayer/common/load.blend deleted file mode 100644 index ae520504971..00000000000 Binary files a/source/gameengine/GamePlayer/common/load.blend and /dev/null differ diff --git a/source/gameengine/GamePlayer/common/logo_blender.raw b/source/gameengine/GamePlayer/common/logo_blender.raw deleted file mode 100644 index 82bf25a2c6e..00000000000 Binary files a/source/gameengine/GamePlayer/common/logo_blender.raw and /dev/null differ diff --git a/source/gameengine/GamePlayer/common/logo_blender3d.raw b/source/gameengine/GamePlayer/common/logo_blender3d.raw deleted file mode 100644 index 6a86626bb10..00000000000 Binary files a/source/gameengine/GamePlayer/common/logo_blender3d.raw and /dev/null differ diff --git a/source/gameengine/GamePlayer/common/logo_nan.raw b/source/gameengine/GamePlayer/common/logo_nan.raw deleted file mode 100644 index b86308bd017..00000000000 Binary files a/source/gameengine/GamePlayer/common/logo_nan.raw and /dev/null differ diff --git a/source/gameengine/GamePlayer/common/unix/GPU_Canvas.cpp b/source/gameengine/GamePlayer/common/unix/GPU_Canvas.cpp deleted file mode 100644 index bb7b55fbcf1..00000000000 --- a/source/gameengine/GamePlayer/common/unix/GPU_Canvas.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -//#include -#include "GPU_Canvas.h" - -GPU_Canvas::GPU_Canvas(KXH_plugin_handle p, int width, int height) - : GPC_Canvas(width, height), m_plugin(p) -{ - /* intentionally empty */ -} - - -GPU_Canvas::~GPU_Canvas(void) -{ - /* intentionally empty */ -} - -void GPU_Canvas::Init(void) -{ - /* intentionally empty */ -} - -void GPU_Canvas::SwapBuffers(void) -{ - if (m_plugin) KXH_swap_buffers(m_plugin); -} - -bool -GPU_Canvas::BeginDraw(void) -{ - if (m_plugin) { - return KXH_begin_draw(m_plugin); - } else { - return false; - } -} - -void GPU_Canvas::EndDraw(void) -{ - if (m_plugin) KXH_end_draw(m_plugin); -} diff --git a/source/gameengine/GamePlayer/common/unix/GPU_Canvas.h b/source/gameengine/GamePlayer/common/unix/GPU_Canvas.h deleted file mode 100644 index 963c8f20435..00000000000 --- a/source/gameengine/GamePlayer/common/unix/GPU_Canvas.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPU_CANVAS_H -#define __GPU_CANVAS_H - -#include - -#include "KXH_ketsji_hooks.h" -#include "GPC_Canvas.h" - -class GPU_Canvas : public GPC_Canvas -{ -private: - - /** Handle to the drawing resource. */ - KXH_plugin_handle m_plugin; - -public: - GPU_Canvas(KXH_plugin_handle display, int width, int height); - virtual ~GPU_Canvas(); - - virtual void Init(void); - - bool BeginDraw(void); - void EndDraw(void); - virtual void SwapBuffers(void); - -}; - -#endif // __GPU_CANVAS_H - diff --git a/source/gameengine/GamePlayer/common/unix/GPU_Engine.cpp b/source/gameengine/GamePlayer/common/unix/GPU_Engine.cpp deleted file mode 100644 index 3eb7147bd98..00000000000 --- a/source/gameengine/GamePlayer/common/unix/GPU_Engine.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include -#include -#include "GPU_Engine.h" -#include "GPC_MouseDevice.h" -#include "GPU_Canvas.h" -#include "GPU_KeyboardDevice.h" -#include "GPU_System.h" - -#include "BLI_blenlib.h" -#include "BLO_readfile.h" - -#include "SND_DeviceManager.h" - -#include "NG_NetworkScene.h" -#include "NG_LoopBackNetworkDeviceInterface.h" -#include "SND_DeviceManager.h" -#include "KX_BlenderSceneConverter.h" -#include "KX_KetsjiEngine.h" - -#include "GPC_RenderTools.h" -#include "GPC_RawImage.h" - -void Redraw(GPU_Engine *engine); // -the- redraw function - -// callback functions -/* -void RedrawCallback(Widget, XtPointer closure, XEvent *, Boolean *continue_to_dispatch); - -void KeyDownCallback(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch); -void KeyUpCallback(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch); - -void ButtonPressReleaseCallback(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch); -void PointerMotionCallback(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch); - -void TimeOutCallback(XtPointer closure, XtIntervalId *id); -*/ - -GPU_Engine::GPU_Engine(char *customLoadingAnimationURL, - int foregroundColor, int backgroundColor, int frameRate) : - GPC_Engine(customLoadingAnimationURL, foregroundColor, backgroundColor, - frameRate), m_timerTimeOutMsecs(10) -{ -} - - -GPU_Engine::~GPU_Engine() -{ -} - -/* -bool GPU_Engine::Initialize(Display *display, Window window, int width, int height) -{ - SND_DeviceManager::Subscribe(); - m_audiodevice = SND_DeviceManager::Instance(); - - m_keyboarddev = new GPU_KeyboardDevice(); - m_mousedev = new GPC_MouseDevice(); - - // constructor only initializes data - // m_canvas = new GPU_Canvas(display, window, width, height); - //m_canvas->Init(); // create the actual visual and rendering context - //cout << "GPU_Canvas created and initialized, m_canvas " << m_canvas << endl; - //AddEventHandlers(); // done here (in GPU_Engine) since the event handlers need access to 'this', ie the engine - - // put the Blender logo in the topleft corner - if(m_BlenderLogo != 0) - // adding a banner automatically enables them - m_BlenderLogoId = m_canvas->AddBanner(m_BlenderLogo->Width(), m_BlenderLogo->Height(), - m_BlenderLogo->Width(), m_BlenderLogo->Height(), - m_BlenderLogo->Data(), GPC_Canvas::alignTopLeft); - - // put the Blender3D logo in the bottom right corner - if(m_Blender3DLogo != 0) - // adding a banner automatically enables them - m_Blender3DLogoId = m_canvas->AddBanner(m_Blender3DLogo->Width(), m_Blender3DLogo->Height(), - m_Blender3DLogo->Width(), m_Blender3DLogo->Height(), - m_Blender3DLogo->Data(), GPC_Canvas::alignTopLeft); - -#if 0 - // put the NaN logo in the bottom right corner - if(m_NaNLogo != 0) - // adding a banner automatically enables them - m_NaNLogoId = m_canvas->AddBanner(m_NaNLogo->Width(), m_NaNLogo->Height(), - m_NaNLogo->Width(), m_NaNLogo->Height(), - m_NaNLogo->Data(), GPC_Canvas::alignBottomRight); -#endif - // enable the display of all banners - m_canvas->SetBannerDisplayEnabled(true); - - m_rendertools = new GPC_RenderTools(); - - m_networkdev = new NG_LoopBackNetworkDeviceInterface(); - assert(m_networkdev); - - // creation of system needs 'current rendering context', this is taken care - // of by the GPU_Canvas::Init() - m_system = new GPU_System(); - - m_system->SetKeyboardDevice((GPU_KeyboardDevice *)m_keyboarddev); - m_system->SetMouseDevice(m_mousedev); - m_system->SetNetworkDevice(m_networkdev); - - m_initialized = true; - - return m_initialized; -} -*/ - -/* -void GPU_Engine::HandleNewWindow(Window window) -{ - // everything only if it's really a new window - if(window != ((GPU_Canvas *)m_canvas)->GetWindow()) - { - cout << "GPU_Engine::HandleNewWindow(), new window so calling SetNewWindowMakeNewWidgetAndMakeCurrent()" << endl; - // We don't have to remove the event handlers ourselves, they are destroyed by X11 - - // make canvas aware of new window, and make it current - ((GPU_Canvas *)m_canvas)->SetNewWindowMakeNewWidgetAndMakeCurrent(window); - - // and add event handlers to new widget - AddEventHandlers(); - cout << "GPU_Engine::HandleNewWindow(), event handlers added" << endl; - } -} -*/ -/* -void GPU_Engine::AddEventHandlers(void) -{ - Widget widget = ((GPU_Canvas *)m_canvas)->GetWidget(); - - // redraw - // MUST be the *Raw* event handler, the normal one doesn't work! - XtAddRawEventHandler(widget, ExposureMask, FALSE, RedrawCallback, this); -#if 0 - // key down - XtAddRawEventHandler(widget, KeyPressMask, FALSE, KeyDownCallback, this); - // key up - XtAddRawEventHandler(widget, KeyReleaseMask, FALSE, KeyUpCallback, this); - - // mouse button press - XtAddRawEventHandler(widget, ButtonPressMask, FALSE, ButtonPressReleaseCallback, this); - // mouse button release - XtAddRawEventHandler(widget, ButtonReleaseMask, FALSE, ButtonPressReleaseCallback, this); - // mouse motion - XtAddRawEventHandler(widget, PointerMotionMask, FALSE, PointerMotionCallback, this); -#endif -#if 0 - // time out, not a real timer. New time out will be set in callback - m_timerId = XtAppAddTimeOut(XtWidgetToApplicationContext(widget), - m_timerTimeOutMsecs, TimeOutCallback, this); -#endif -} -*/ - -void Redraw(GPU_Engine *engine) -{ -/* if(engine->Running()) - { - if(engine->Loading()) - { - engine->UpdateLoadingAnimation(); - } - - engine->m_system->DoMainLoopCallback(); - }*/ -} - - -/*+++++++++++++++++++++++++++++++++++++++++++++++++ - * Callback functions - +++++++++++++++++++++++++++++++++++++++++++++++++*/ -void RedrawCallback(Widget, XtPointer closure, XEvent *, Boolean *continue_to_dispatch) -{ - GPU_Engine *engine = (GPU_Engine *)closure; - - Redraw(engine); - - *continue_to_dispatch = True; -} - - -void KeyDownCallback(Widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch) -{ -/* GPU_Engine *engine = (GPU_Engine *)closure; - XKeyEvent *keyEvent = (XKeyEvent *)event; - - if(engine->Running()) - engine->m_system->AddKey(int(keyEvent->keycode), 1); - - *continue_to_dispatch = True;*/ -} - - -void KeyUpCallback(Widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch) -{ -/* GPU_Engine *engine = (GPU_Engine *)closure; - XKeyEvent *keyEvent = (XKeyEvent *)event; - - if(engine->Running()) - engine->m_system->AddKey(int(keyEvent->keycode), 0); - - *continue_to_dispatch = True;*/ -} - - -void ButtonPressReleaseCallback(Widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch) -{ - GPU_Engine *engine = (GPU_Engine *)closure; - XButtonEvent *buttonEvent = (XButtonEvent *)event; - bool isDown; - GPC_MouseDevice::TButtonId button; - - if(engine->Running()) - { - // determine type of event, press or release - isDown = false; - if(buttonEvent->type == ButtonPress) - isDown = true; - // determine which button exactly generated this event - switch(buttonEvent->button) - { - case 1: - button = GPC_MouseDevice::buttonLeft; - break; - case 2: - button = GPC_MouseDevice::buttonMiddle; - break; - case 3: - button = GPC_MouseDevice::buttonRight; - break; - } - engine->m_mousedev->ConvertButtonEvent(button, - isDown, buttonEvent->x, buttonEvent->y); - } - - *continue_to_dispatch = True; -} - - -void PointerMotionCallback(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch) -{ - GPU_Engine *engine = (GPU_Engine *)closure; - XButtonEvent *buttonEvent = (XButtonEvent *)event; - - if(engine->Running()) - { - engine->m_mousedev->ConvertMoveEvent(buttonEvent->x, buttonEvent->y); - } - - *continue_to_dispatch = True; -} - -/* -void TimeOutCallback(XtPointer closure, XtIntervalId *id) -{ - GPU_Engine *engine = (GPU_Engine *)closure; - - Redraw(engine); - // add a new time out since there is no real timer for X (not a simple one like under windows) - // TODO Have to get faster timer ! - - if(engine->Running()) - engine->m_timerId = XtAppAddTimeOut(XtWidgetToApplicationContext( - ((GPU_Canvas *)engine->m_canvas)->GetWidget()), - engine->m_timerTimeOutMsecs, TimeOutCallback, - closure); -} - -*/ diff --git a/source/gameengine/GamePlayer/common/unix/GPU_Engine.h b/source/gameengine/GamePlayer/common/unix/GPU_Engine.h deleted file mode 100644 index 12fb70c84ef..00000000000 --- a/source/gameengine/GamePlayer/common/unix/GPU_Engine.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPU_ENGINE_H -#define __GPU_ENGINE_H - -#include -#include -#include - -#define Object DNA_Object // tricky stuff !!! but without it, it doesn't compile... - -#include "GPC_Engine.h" - - -class GPU_Engine : public GPC_Engine -{ -public: - XtIntervalId m_timerId; - unsigned long m_timerTimeOutMsecs; - -public: - GPU_Engine(char *customLoadingAnimation, - int foregroundColor, int backgroundColor, int frameRate); - virtual ~GPU_Engine(); - bool Initialize(Display *display, Window window, int width, int height); - - void HandleNewWindow(Window window); - -private: - void AddEventHandlers(); -}; - -#endif // __GPU_ENGINE_H - diff --git a/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.cpp b/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.cpp deleted file mode 100644 index 5444cf22ac9..00000000000 --- a/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "GPU_KeyboardDevice.h" - -void GPU_KeyboardDevice::register_X_key_down_event(KeySym k) -{ - ConvertEvent(k, 1); -} - -void GPU_KeyboardDevice::register_X_key_up_event(KeySym k) -{ - ConvertEvent(k, 0); -} - - -#define map_x_key_to_kx_key(x,y) m_reverseKeyTranslateTable[x] = y; - -GPU_KeyboardDevice::GPU_KeyboardDevice(void) -{ - unsigned int i = 0; - - // Needed? - m_reverseKeyTranslateTable.clear(); - - for (i = XK_A; i< XK_Z; i++) { - m_reverseKeyTranslateTable[i] - = (SCA_IInputDevice::KX_EnumInputs) - (((unsigned int)SCA_IInputDevice::KX_AKEY) + i - XK_A); - } - - // Shifted versions: should not occur: KX doesn't distinguish - for (i = XK_a; i< XK_z; i++) { - m_reverseKeyTranslateTable[i] - = (SCA_IInputDevice::KX_EnumInputs) - (((int)SCA_IInputDevice::KX_AKEY) + i - XK_a); - } - - for (i = XK_0; i< XK_9; i++) { - m_reverseKeyTranslateTable[i] - = (SCA_IInputDevice::KX_EnumInputs) - (((int)SCA_IInputDevice::KX_ZEROKEY) + i - XK_0); - } - - for (i = XK_F1; i< XK_F19; i++) { - m_reverseKeyTranslateTable[i] - = (SCA_IInputDevice::KX_EnumInputs) - (((int)SCA_IInputDevice::KX_F1KEY) + i - XK_F1); - } - - // the remainder: - map_x_key_to_kx_key(XK_BackSpace, SCA_IInputDevice::KX_BACKSPACEKEY); - map_x_key_to_kx_key(XK_Tab, SCA_IInputDevice::KX_TABKEY); - map_x_key_to_kx_key(XK_Return, SCA_IInputDevice::KX_RETKEY); - map_x_key_to_kx_key(XK_Escape, SCA_IInputDevice::KX_ESCKEY); - map_x_key_to_kx_key(XK_space, SCA_IInputDevice::KX_SPACEKEY); - - map_x_key_to_kx_key(XK_Shift_L, SCA_IInputDevice::KX_LEFTSHIFTKEY); - map_x_key_to_kx_key(XK_Shift_R, SCA_IInputDevice::KX_RIGHTSHIFTKEY); - map_x_key_to_kx_key(XK_Control_L, SCA_IInputDevice::KX_LEFTCTRLKEY); - map_x_key_to_kx_key(XK_Control_R, SCA_IInputDevice::KX_RIGHTCTRLKEY); - map_x_key_to_kx_key(XK_Alt_L, SCA_IInputDevice::KX_LEFTALTKEY); - map_x_key_to_kx_key(XK_Alt_R, SCA_IInputDevice::KX_RIGHTALTKEY); - - map_x_key_to_kx_key(XK_Insert, SCA_IInputDevice::KX_INSERTKEY); - map_x_key_to_kx_key(XK_Delete, SCA_IInputDevice::KX_DELKEY); - map_x_key_to_kx_key(XK_Home, SCA_IInputDevice::KX_HOMEKEY); - map_x_key_to_kx_key(XK_End, SCA_IInputDevice::KX_ENDKEY); - map_x_key_to_kx_key(XK_Page_Up, SCA_IInputDevice::KX_PAGEUPKEY); - map_x_key_to_kx_key(XK_Page_Down, SCA_IInputDevice::KX_PAGEDOWNKEY); - - map_x_key_to_kx_key(XK_Left, SCA_IInputDevice::KX_LEFTARROWKEY); - map_x_key_to_kx_key(XK_Right, SCA_IInputDevice::KX_RIGHTARROWKEY); - map_x_key_to_kx_key(XK_Up, SCA_IInputDevice::KX_UPARROWKEY); - map_x_key_to_kx_key(XK_Down, SCA_IInputDevice::KX_DOWNARROWKEY); - - map_x_key_to_kx_key(XK_KP_0, SCA_IInputDevice::KX_PAD0); - map_x_key_to_kx_key(XK_KP_1, SCA_IInputDevice::KX_PAD1); - map_x_key_to_kx_key(XK_KP_2, SCA_IInputDevice::KX_PAD2); - map_x_key_to_kx_key(XK_KP_3, SCA_IInputDevice::KX_PAD3); - map_x_key_to_kx_key(XK_KP_4, SCA_IInputDevice::KX_PAD4); - map_x_key_to_kx_key(XK_KP_5, SCA_IInputDevice::KX_PAD5); - map_x_key_to_kx_key(XK_KP_6, SCA_IInputDevice::KX_PAD6); - map_x_key_to_kx_key(XK_KP_7, SCA_IInputDevice::KX_PAD7); - map_x_key_to_kx_key(XK_KP_8, SCA_IInputDevice::KX_PAD8); - map_x_key_to_kx_key(XK_KP_9, SCA_IInputDevice::KX_PAD9); - map_x_key_to_kx_key(XK_KP_Decimal, SCA_IInputDevice::KX_PADPERIOD); - - map_x_key_to_kx_key(XK_KP_Insert, SCA_IInputDevice::KX_INSERTKEY); - map_x_key_to_kx_key(XK_KP_End, SCA_IInputDevice::KX_ENDKEY); - map_x_key_to_kx_key(XK_KP_Down, SCA_IInputDevice::KX_DOWNARROWKEY); - map_x_key_to_kx_key(XK_KP_Page_Down,SCA_IInputDevice::KX_PAGEDOWNKEY); - map_x_key_to_kx_key(XK_KP_Left, SCA_IInputDevice::KX_LEFTARROWKEY); - map_x_key_to_kx_key(XK_KP_Right, SCA_IInputDevice::KX_RIGHTARROWKEY); - map_x_key_to_kx_key(XK_KP_Home, SCA_IInputDevice::KX_HOMEKEY); - map_x_key_to_kx_key(XK_KP_Up, SCA_IInputDevice::KX_UPARROWKEY); - map_x_key_to_kx_key(XK_KP_Page_Up, SCA_IInputDevice::KX_PAGEUPKEY); - map_x_key_to_kx_key(XK_KP_Delete, SCA_IInputDevice::KX_DELKEY); - - map_x_key_to_kx_key(XK_KP_Enter, SCA_IInputDevice::KX_PADENTER); - map_x_key_to_kx_key(XK_KP_Add, SCA_IInputDevice::KX_PADPLUSKEY); - map_x_key_to_kx_key(XK_KP_Subtract, SCA_IInputDevice::KX_PADMINUS); - map_x_key_to_kx_key(XK_KP_Multiply, SCA_IInputDevice::KX_PADASTERKEY); - map_x_key_to_kx_key(XK_KP_Divide, SCA_IInputDevice::KX_PADSLASHKEY); - - map_x_key_to_kx_key(XK_Caps_Lock, SCA_IInputDevice::KX_CAPSLOCKKEY); - -} diff --git a/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.h b/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.h deleted file mode 100644 index e4ff20c7159..00000000000 --- a/source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPU_KEYBOARDDEVICE_H -#define __GPU_KEYBOARDDEVICE_H - -#include -#include // Brilliant name, eh? Stupid !@#!$!@#@@% This is - // actually needed so as not to get name clashes between Object from - // blender and Object from X11... The proper include would be - // Intrinsic.h . Yes, we are a bunch of sado-masochists. Let's hurt - // ourselves! - -#include "GPC_KeyboardDevice.h" - -class GPU_KeyboardDevice : public GPC_KeyboardDevice -{ -public: - - void register_X_key_down_event(KeySym k); - void register_X_key_up_event(KeySym k); - - GPU_KeyboardDevice(void); - virtual ~GPU_KeyboardDevice() - { - /* intentionally empty */ - } - - private: - SCA_IInputDevice::KX_EnumInputs - convert_x_keycode_to_kx_keycode(unsigned int key); -}; - -#endif // _GPU_KEYBOARDDEVICE_H - diff --git a/source/gameengine/GamePlayer/common/unix/GPU_PolygonMaterial.h b/source/gameengine/GamePlayer/common/unix/GPU_PolygonMaterial.h deleted file mode 100644 index 66c8f830ad8..00000000000 --- a/source/gameengine/GamePlayer/common/unix/GPU_PolygonMaterial.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPU_POLYGONMATERIAL_H -#define __GPU_POLYGONMATERIAL_H - -#include "BP_PolygonMaterial.h" - -class GPU_PolygonMaterial : public BP_PolygonMaterial -{ -public: - GPUPolygonMaterial(const STR_String& texname, bool ba,const STR_String& matname, - int tile, int tileXrep, int tileYrep, int mode, int transparant, - int lightlayer,,void* tpage) : - BP_PolygonMaterial(texname, ba,matname, tile, tileXrep, tileYrep, - mode, transparant, lightlayer), - m_tface(tpage) - { - } - - virtual ~GPU_PolygonMaterial() - { - } -}; - -#endif // __GPU_POLYGONMATERIAL_H - diff --git a/source/gameengine/GamePlayer/common/unix/GPU_System.cpp b/source/gameengine/GamePlayer/common/unix/GPU_System.cpp deleted file mode 100644 index 8085ecb4380..00000000000 --- a/source/gameengine/GamePlayer/common/unix/GPU_System.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include -#include "GPU_System.h" - -static struct timeval startTime; -static int startTimeDone = 0; - - -double GPU_System::GetTimeInSeconds() -{ - if(!startTimeDone) - { - gettimeofday(&startTime, NULL); - startTimeDone = 1; - } - - struct timeval now; - gettimeofday(&now, NULL); - // next '1000' are used for precision - long ticks = (now.tv_sec - startTime.tv_sec) * 1000 + (now.tv_usec - startTime.tv_usec) / 1000; - double secs = (double)ticks / 1000.0; - return secs; -} diff --git a/source/gameengine/GamePlayer/common/unix/GPU_System.h b/source/gameengine/GamePlayer/common/unix/GPU_System.h deleted file mode 100644 index bd0658014e8..00000000000 --- a/source/gameengine/GamePlayer/common/unix/GPU_System.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPU_SYSTEM_H -#define __GPU_SYSTEM_H - -#include "GPC_System.h" - -class GPU_System : public GPC_System -{ -public: - GPU_System() - { - } - - virtual double GetTimeInSeconds(); -}; - -#endif // __GPU_SYSTEM_H - diff --git a/source/gameengine/GamePlayer/common/unix/Makefile b/source/gameengine/GamePlayer/common/unix/Makefile deleted file mode 100644 index c86f61b45d8..00000000000 --- a/source/gameengine/GamePlayer/common/unix/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = unix -DIR = $(OCGDIR)/gameengine/GamePlayer/common/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(OPENGL_HEADERS) -CPPFLAGS += -I$(NAN_STRING)/include - -CPPFLAGS += -I.. -CPPFLAGS += -I../../netscape/src/ketsji -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) - - -# Game Engine -CPPFLAGS += -I../../../../gameengine/Converter -CPPFLAGS += -I../../../../gameengine/Expressions -CPPFLAGS += -I../../../../gameengine/GameLogic -CPPFLAGS += -I../../../../gameengine/Ketsji -CPPFLAGS += -I../../../../gameengine/Ketsji/KXNetwork -CPPFLAGS += -I../../../../gameengine/Network -CPPFLAGS += -I../../../../gameengine/Network/LoopBackNetwork -CPPFLAGS += -I../../../../gameengine/Rasterizer -CPPFLAGS += -I../../../../gameengine/Rasterizer/RAS_OpenGLRasterizer -CPPFLAGS += -I../../../../gameengine/SceneGraph - -CPPFLAGS += -I$(NAN_MOTO)/include - -# Blender stuff -CPPFLAGS += -I../../../../blender/blenkernel -CPPFLAGS += -I../../../../blender/blenlib -CPPFLAGS += -I../../../../blender/blenloader -CPPFLAGS += -I../../../../blender/imbuf -CPPFLAGS += -I../../../../blender/makesdna -CPPFLAGS += -I../../../../kernel/gen_system - -CPPFLAGS += -I../../kernel/gen_system - diff --git a/source/gameengine/GamePlayer/common/windows/GPW_Canvas.cpp b/source/gameengine/GamePlayer/common/windows/GPW_Canvas.cpp deleted file mode 100644 index 44437820bd2..00000000000 --- a/source/gameengine/GamePlayer/common/windows/GPW_Canvas.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "GPW_Canvas.h" - -GPW_Canvas::GPW_Canvas(HWND hWnd, HDC hDC, int width, int height) - : GPC_Canvas(width, height), m_hWnd(hWnd), m_hRC(0), m_hDC(hDC) -{ -} - - -GPW_Canvas::~GPW_Canvas() -{ - if (m_hRC) { - ::wglDeleteContext(m_hRC); - } - //if (m_hDC) { - // ::ReleaseDC(m_hWnd, m_hDC); - //} -} - - -void GPW_Canvas::Init() -{ - -// log_entry("GPW_Canvas::Init"); - - /* - * Color and depth bit values are not to be trusted. - * For instance, on TNT2: - * When the screen color depth is set to 16 bit, we get 5 color bits - * and 16 depth bits. - * When the screen color depth is set to 32 bit, we get 8 color bits - * and 24 depth bits. - * Just to be safe, we request high quality settings. - */ - PIXELFORMATDESCRIPTOR pfd = - { - sizeof(PIXELFORMATDESCRIPTOR), // iSize - 1, // iVersion - PFD_DRAW_TO_WINDOW | - PFD_SUPPORT_OPENGL | -// PFD_STEREO | - PFD_DOUBLEBUFFER, // dwFlags - PFD_TYPE_RGBA, // iPixelType - 32, // cColorBits - 0, 0, // cRedBits, cRedShift (ignored) - 0, 0, // cGreenBits, cGreenShift (ignored) - 0, 0, // cBlueBits, cBlueShift (ignored) - 0, 0, // cAlphaBits, cAlphaShift (ignored) - 0, 0, 0, 0, 0, // cAccum_X_Bits - 32, // cDepthBits - 0, // cStencilBits - 0, // cAuxBuffers - PFD_MAIN_PLANE, // iLayerType - 0, // bReserved - 0, // dwLayerMask - 0, // dwVisibleMask - 0 // dwDamageMask - }; - PIXELFORMATDESCRIPTOR match; - - // Look what we get back for this pixel format - int pixelFormat = ::ChoosePixelFormat(m_hDC, &pfd); - if (!pixelFormat) { - DWORD error = ::GetLastError(); - } - ::DescribePixelFormat(m_hDC, pixelFormat, sizeof(match), &match); - - // Activate the pixel format for this context - ::SetPixelFormat(m_hDC, ::ChoosePixelFormat(m_hDC, &match), &match); - - // Create the OpenGL context and make it current - m_hRC = ::wglCreateContext(m_hDC); - ::wglMakeCurrent(m_hDC, m_hRC); - -} - -void GPW_Canvas::SetMousePosition(int x, int y) -{ - POINT point = { x, y }; - if (m_hWnd) - { - ::ClientToScreen(m_hWnd, &point); - ::SetCursorPos(point.x, point.y); - } -} - - -void GPW_Canvas::SetMouseState(RAS_MouseState mousestate) -{ - LPCSTR id; - switch (mousestate) - { - case MOUSE_INVISIBLE: - HideCursor(); - break; - case MOUSE_WAIT: - ::SetCursor(::LoadCursor(0, IDC_WAIT)); - ShowCursor(); - break; - case MOUSE_NORMAL: - ::SetCursor(::LoadCursor(0, IDC_ARROW)); - ShowCursor(); - break; - } -} - - -bool GPW_Canvas::BeginDraw(void) -{ - ::wglMakeCurrent(m_hDC, m_hRC); - // check errors, anyone? - return true; -} - - -void GPW_Canvas::EndDraw(void) -{ - ::wglMakeCurrent(NULL, NULL); -} - -void GPW_Canvas::SwapBuffers(void) -{ - if (m_hDC) { - ::SwapBuffers(m_hDC); - } -} - - -void GPW_Canvas::HideCursor(void) -{ - int count = ::ShowCursor(FALSE); - while (count >= 0) - { - count = ::ShowCursor(FALSE); - } -} - - -void GPW_Canvas::ShowCursor(void) -{ - ::ShowCursor(TRUE); -} - diff --git a/source/gameengine/GamePlayer/common/windows/GPW_Canvas.h b/source/gameengine/GamePlayer/common/windows/GPW_Canvas.h deleted file mode 100644 index f43be233ee2..00000000000 --- a/source/gameengine/GamePlayer/common/windows/GPW_Canvas.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef _GPW_CANVAS_H_ -#define _GPW_CANVAS_H_ - -#ifdef WIN32 -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif - -#include -#include -//#include - -#include "GPC_Canvas.h" - - -class GPW_Canvas : public GPC_Canvas -{ -protected: - /** The window handle. */ - HWND m_hWnd; - /** Rendering context. */ - HGLRC m_hRC; - /** Device Context. */ - HDC m_hDC; - -public: - /** - * Constructor. - */ - GPW_Canvas(HWND hWnd, HDC hDC, int width, int height); - - /** - * Destructor. - */ - virtual ~GPW_Canvas(void); - - virtual void Init(void); - - /** - * Moves the cursor to a new location. - * @param x The x-coordinate of the new location. - * @param x The y-coordinate of the new location. - */ - virtual void SetMousePosition(int x, int y); - - /** - * Sets the cursor shape and/or visibility. - * @param mousestate The new state ofthe cursor. - */ - virtual void SetMouseState(RAS_MouseState mousestate); - - bool BeginDraw(void); - void EndDraw(void); - - virtual void SwapBuffers(void); - - virtual HDC GetHDC(void) - { - return m_hDC; - } - - virtual void SetHDC(HDC hDC) - { - if (hDC != m_hDC) { - m_hDC = hDC; - } - } - - virtual HGLRC GetHGLRC(void) - { - return m_hRC; - } - -protected: - /** - * Hides the mouse cursor. - */ - void HideCursor(void); - - /** - * Shows the mouse cursor. - */ - void ShowCursor(void); -}; - -#endif // _GPW_CANVAS_H_ - diff --git a/source/gameengine/GamePlayer/common/windows/GPW_Engine.cpp b/source/gameengine/GamePlayer/common/windows/GPW_Engine.cpp deleted file mode 100644 index f5e9f2e767c..00000000000 --- a/source/gameengine/GamePlayer/common/windows/GPW_Engine.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#pragma warning (disable : 4786) - -#include - -#include "GPC_MouseDevice.h" -#include "GPC_RenderTools.h" -#include "GPC_RawImage.h" - -#include "GPW_Canvas.h" -#include "GPW_Engine.h" -#include "GPW_KeyboardDevice.h" -#include "GPW_System.h" - - -#include "NG_NetworkScene.h" -#include "NG_LoopBackNetworkDeviceInterface.h" - -GPW_Engine::GPW_Engine(char *customLoadingAnimationURL, - int foregroundColor, int backgroundColor, int frameRate) : - GPC_Engine(customLoadingAnimationURL, foregroundColor, backgroundColor, - frameRate) -{ -} - - -GPW_Engine::~GPW_Engine() -{ -} - - -bool GPW_Engine::Initialize(HDC hdc, int width, int height) -{ - m_keyboarddev = new GPW_KeyboardDevice(); - m_mousedev = new GPC_MouseDevice(); - - // constructor only initializes data - m_canvas = new GPW_Canvas(0, hdc, width, height); - m_canvas->Init(); // create the actual visual and rendering context - - // put the Blender logo in the topleft corner - if(m_BlenderLogo != 0) - // adding a banner automatically enables them - m_BlenderLogoId = m_canvas->AddBanner(m_BlenderLogo->Width(), m_BlenderLogo->Height(), - m_BlenderLogo->Width(), m_BlenderLogo->Height(), - m_BlenderLogo->Data(), GPC_Canvas::alignTopLeft); - - // put the Blender3D logo in the bottom right corner - if(m_Blender3DLogo != 0) - // adding a banner automatically enables them - m_Blender3DLogoId = m_canvas->AddBanner(m_Blender3DLogo->Width(), m_Blender3DLogo->Height(), - m_Blender3DLogo->Width(), m_Blender3DLogo->Height(), - m_Blender3DLogo->Data(), GPC_Canvas::alignBottomRight); -#if 0 - // put the NaN logo in the bottom right corner - if(m_NaNLogo != 0) - // adding a banner automatically enables them - m_NaNLogoId = m_canvas->AddBanner(m_NaNLogo->Width(), m_NaNLogo->Height(), - m_NaNLogo->Width(), m_NaNLogo->Height(), - m_NaNLogo->Data(), GPC_Canvas::alignBottomRight); -#endif - // enable the display of all banners - m_canvas->SetBannerDisplayEnabled(true); - - // stuff that must be done after creation of a rendering context - //m_canvas->InitPostRenderingContext(); - - m_rendertools = new GPC_RenderTools(); - - m_networkdev = new NG_LoopBackNetworkDeviceInterface(); - assert(m_networkdev); - - // creation of system needs 'current rendering context', this is taken care - // of by the GPW_Canvas - m_system = new GPW_System(); - -// m_system->SetKeyboardDevice((GPW_KeyboardDevice *)m_keyboarddev); -// m_system->SetMouseDevice(m_mousedev); -// m_system->SetNetworkDevice(m_networkdev); - - m_initialized = true; - - return m_initialized; -} diff --git a/source/gameengine/GamePlayer/common/windows/GPW_Engine.h b/source/gameengine/GamePlayer/common/windows/GPW_Engine.h deleted file mode 100644 index 8d237073fb0..00000000000 --- a/source/gameengine/GamePlayer/common/windows/GPW_Engine.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __GPW_ENGINE_H -#define __GPW_ENGINE_H - -#include "GPC_Engine.h" - -class GPW_Engine : public GPC_Engine -{ -public: - GPW_Engine(char *customLoadingAnimation, - int foregroundColor, int backgroundColor, int frameRate); - virtual ~GPW_Engine(); - bool Initialize(HDC hdc, int width, int height); -}; - -#endif // __GPW_ENGINE_H - diff --git a/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.cpp b/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.cpp deleted file mode 100644 index 7e8a50915c8..00000000000 --- a/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "GPW_KeyboardDevice.h" - -// Key code values not found in winuser.h -#ifndef VK_MINUS -#define VK_MINUS 0xBD -#endif // VK_MINUS -#ifndef VK_SEMICOLON -#define VK_SEMICOLON 0xBA -#endif // VK_SEMICOLON -#ifndef VK_PERIOD -#define VK_PERIOD 0xBE -#endif // VK_PERIOD -#ifndef VK_COMMA -#define VK_COMMA 0xBC -#endif // VK_COMMA -#ifndef VK_QUOTE -#define VK_QUOTE 0xDE -#endif // VK_QUOTE -#ifndef VK_BACK_QUOTE -#define VK_BACK_QUOTE 0xC0 -#endif // VK_BACK_QUOTE -#ifndef VK_SLASH -#define VK_SLASH 0xBF -#endif // VK_SLASH -#ifndef VK_BACK_SLASH -#define VK_BACK_SLASH 0xDC -#endif // VK_BACK_SLASH -#ifndef VK_EQUALS -#define VK_EQUALS 0xBB -#endif // VK_EQUALS -#ifndef VK_OPEN_BRACKET -#define VK_OPEN_BRACKET 0xDB -#endif // VK_OPEN_BRACKET -#ifndef VK_CLOSE_BRACKET -#define VK_CLOSE_BRACKET 0xDD -#endif // VK_CLOSE_BRACKET - - - -GPW_KeyboardDevice::GPW_KeyboardDevice(void) -{ - m_separateLeftRight = false; - m_separateLeftRightInitialized = false; - - m_reverseKeyTranslateTable['A' ] = KX_AKEY ; - m_reverseKeyTranslateTable['B' ] = KX_BKEY ; - m_reverseKeyTranslateTable['C' ] = KX_CKEY ; - m_reverseKeyTranslateTable['D' ] = KX_DKEY ; - m_reverseKeyTranslateTable['E' ] = KX_EKEY ; - m_reverseKeyTranslateTable['F' ] = KX_FKEY ; - m_reverseKeyTranslateTable['G' ] = KX_GKEY ; - m_reverseKeyTranslateTable['H' ] = KX_HKEY ; - m_reverseKeyTranslateTable['I' ] = KX_IKEY ; - m_reverseKeyTranslateTable['J' ] = KX_JKEY ; - m_reverseKeyTranslateTable['K' ] = KX_KKEY ; - m_reverseKeyTranslateTable['L' ] = KX_LKEY ; - m_reverseKeyTranslateTable['M' ] = KX_MKEY ; - m_reverseKeyTranslateTable['N' ] = KX_NKEY ; - m_reverseKeyTranslateTable['O' ] = KX_OKEY ; - m_reverseKeyTranslateTable['P' ] = KX_PKEY ; - m_reverseKeyTranslateTable['Q' ] = KX_QKEY ; - m_reverseKeyTranslateTable['R' ] = KX_RKEY ; - m_reverseKeyTranslateTable['S' ] = KX_SKEY ; - m_reverseKeyTranslateTable['T' ] = KX_TKEY ; - m_reverseKeyTranslateTable['U' ] = KX_UKEY ; - m_reverseKeyTranslateTable['V' ] = KX_VKEY ; - m_reverseKeyTranslateTable['W' ] = KX_WKEY ; - m_reverseKeyTranslateTable['X' ] = KX_XKEY ; - m_reverseKeyTranslateTable['Y' ] = KX_YKEY ; - m_reverseKeyTranslateTable['Z' ] = KX_ZKEY ; - - m_reverseKeyTranslateTable['0' ] = KX_ZEROKEY ; - m_reverseKeyTranslateTable['1' ] = KX_ONEKEY ; - m_reverseKeyTranslateTable['2' ] = KX_TWOKEY ; - m_reverseKeyTranslateTable['3' ] = KX_THREEKEY ; - m_reverseKeyTranslateTable['4' ] = KX_FOURKEY ; - m_reverseKeyTranslateTable['5' ] = KX_FIVEKEY ; - m_reverseKeyTranslateTable['6' ] = KX_SIXKEY ; - m_reverseKeyTranslateTable['7' ] = KX_SEVENKEY ; - m_reverseKeyTranslateTable['8' ] = KX_EIGHTKEY ; - m_reverseKeyTranslateTable['9' ] = KX_NINEKEY ; - - // Middle keyboard area keys - m_reverseKeyTranslateTable[VK_PAUSE ] = KX_PAUSEKEY ; - m_reverseKeyTranslateTable[VK_INSERT ] = KX_INSERTKEY ; - m_reverseKeyTranslateTable[VK_DELETE ] = KX_DELKEY ; - m_reverseKeyTranslateTable[VK_HOME ] = KX_HOMEKEY ; - m_reverseKeyTranslateTable[VK_END ] = KX_ENDKEY ; - m_reverseKeyTranslateTable[VK_PRIOR ] = KX_PAGEUPKEY ; - m_reverseKeyTranslateTable[VK_NEXT ] = KX_PAGEDOWNKEY ; - - // Arrow keys - m_reverseKeyTranslateTable[VK_UP ] = KX_UPARROWKEY ; - m_reverseKeyTranslateTable[VK_DOWN ] = KX_DOWNARROWKEY ; - m_reverseKeyTranslateTable[VK_LEFT ] = KX_LEFTARROWKEY ; - m_reverseKeyTranslateTable[VK_RIGHT ] = KX_RIGHTARROWKEY ; - - // Function keys - m_reverseKeyTranslateTable[VK_F1 ] = KX_F1KEY ; - m_reverseKeyTranslateTable[VK_F2 ] = KX_F2KEY ; - m_reverseKeyTranslateTable[VK_F3 ] = KX_F3KEY ; - m_reverseKeyTranslateTable[VK_F4 ] = KX_F4KEY ; - m_reverseKeyTranslateTable[VK_F5 ] = KX_F5KEY ; - m_reverseKeyTranslateTable[VK_F6 ] = KX_F6KEY ; - m_reverseKeyTranslateTable[VK_F7 ] = KX_F7KEY ; - m_reverseKeyTranslateTable[VK_F8 ] = KX_F8KEY ; - m_reverseKeyTranslateTable[VK_F9 ] = KX_F9KEY ; - m_reverseKeyTranslateTable[VK_F10 ] = KX_F10KEY ; - m_reverseKeyTranslateTable[VK_F11 ] = KX_F11KEY ; - m_reverseKeyTranslateTable[VK_F12 ] = KX_F12KEY ; - m_reverseKeyTranslateTable[VK_F13 ] = KX_F13KEY ; - m_reverseKeyTranslateTable[VK_F14 ] = KX_F14KEY ; - m_reverseKeyTranslateTable[VK_F15 ] = KX_F15KEY ; - m_reverseKeyTranslateTable[VK_F16 ] = KX_F16KEY ; - m_reverseKeyTranslateTable[VK_F17 ] = KX_F17KEY ; - m_reverseKeyTranslateTable[VK_F18 ] = KX_F18KEY ; - m_reverseKeyTranslateTable[VK_F19 ] = KX_F19KEY ; - - // Numpad keys - m_reverseKeyTranslateTable[VK_NUMPAD0 ] = KX_PAD0 ; - m_reverseKeyTranslateTable[VK_NUMPAD1 ] = KX_PAD1 ; - m_reverseKeyTranslateTable[VK_NUMPAD2 ] = KX_PAD2 ; - m_reverseKeyTranslateTable[VK_NUMPAD3 ] = KX_PAD3 ; - m_reverseKeyTranslateTable[VK_NUMPAD4 ] = KX_PAD4 ; - m_reverseKeyTranslateTable[VK_NUMPAD5 ] = KX_PAD5 ; - m_reverseKeyTranslateTable[VK_NUMPAD6 ] = KX_PAD6 ; - m_reverseKeyTranslateTable[VK_NUMPAD7 ] = KX_PAD7 ; - m_reverseKeyTranslateTable[VK_NUMPAD8 ] = KX_PAD8 ; - m_reverseKeyTranslateTable[VK_NUMPAD9 ] = KX_PAD9 ; - m_reverseKeyTranslateTable[VK_MULTIPLY ] = KX_PADASTERKEY ; - m_reverseKeyTranslateTable[VK_ADD ] = KX_PADPLUSKEY ; - m_reverseKeyTranslateTable[VK_DECIMAL ] = KX_PADPERIOD ; - m_reverseKeyTranslateTable[VK_SUBTRACT ] = KX_PADMINUS ; - m_reverseKeyTranslateTable[VK_DIVIDE ] = KX_PADSLASHKEY ; - m_reverseKeyTranslateTable[VK_SEPARATOR ] = KX_PADENTER ; - - // Other keys - m_reverseKeyTranslateTable[VK_CAPITAL ] = KX_CAPSLOCKKEY ; - m_reverseKeyTranslateTable[VK_ESCAPE ] = KX_ESCKEY ; - m_reverseKeyTranslateTable[VK_TAB ] = KX_TABKEY ; - //m_reverseKeyTranslateTable[VK_RETURN ] = KX_RETKEY ; - m_reverseKeyTranslateTable[VK_SPACE ] = KX_SPACEKEY ; - m_reverseKeyTranslateTable[VK_RETURN ] = KX_LINEFEEDKEY ; - m_reverseKeyTranslateTable[VK_BACK ] = KX_BACKSPACEKEY ; - m_reverseKeyTranslateTable[VK_SEMICOLON ] = KX_SEMICOLONKEY ; - m_reverseKeyTranslateTable[VK_PERIOD ] = KX_PERIODKEY ; - m_reverseKeyTranslateTable[VK_COMMA ] = KX_COMMAKEY ; - m_reverseKeyTranslateTable[VK_QUOTE ] = KX_QUOTEKEY ; - m_reverseKeyTranslateTable[VK_BACK_QUOTE ] = KX_ACCENTGRAVEKEY ; - m_reverseKeyTranslateTable[VK_MINUS ] = KX_MINUSKEY ; - m_reverseKeyTranslateTable[VK_SLASH ] = KX_SLASHKEY ; - m_reverseKeyTranslateTable[VK_BACK_SLASH ] = KX_BACKSLASHKEY ; - m_reverseKeyTranslateTable[VK_EQUALS ] = KX_EQUALKEY ; - m_reverseKeyTranslateTable[VK_OPEN_BRACKET ] = KX_LEFTBRACKETKEY ; - m_reverseKeyTranslateTable[VK_CLOSE_BRACKET ] = KX_RIGHTBRACKETKEY ; - - /* - * Need to handle Ctrl, Alt and Shift keys differently. - * Win32 messages do not discriminate left and right keys. - */ - m_reverseKeyTranslateTable[VK_LCONTROL ] = KX_LEFTCTRLKEY ; - m_reverseKeyTranslateTable[VK_RCONTROL ] = KX_RIGHTCTRLKEY ; - m_reverseKeyTranslateTable[VK_LMENU ] = KX_LEFTALTKEY ; - m_reverseKeyTranslateTable[VK_RMENU ] = KX_RIGHTALTKEY ; - m_reverseKeyTranslateTable[VK_RSHIFT ] = KX_RIGHTSHIFTKEY ; - m_reverseKeyTranslateTable[VK_LSHIFT ] = KX_LEFTSHIFTKEY ; -} - - -GPW_KeyboardDevice::~GPW_KeyboardDevice(void) -{ -} - - -void GPW_KeyboardDevice::ConvertWinEvent(WPARAM wParam, bool isDown) -{ - if ((wParam == VK_SHIFT) || (wParam == VK_MENU) || (wParam == VK_CONTROL)) { - ConvertModifierKey(wParam, isDown); - } - else { - ConvertEvent(wParam, isDown); - } -} - - -void GPW_KeyboardDevice::ConvertModifierKey(WPARAM wParam, bool isDown) -{ - /* - GetKeyState and GetAsyncKeyState only work with Win95, Win98, NT4, - Terminal Server and Windows 2000. - But on WinME it always returns zero. These two functions are simply - skipped by Millenium Edition! - - Official explanation from Microsoft: - Intentionally disabled. - It didn't work all that well on some newer hardware, and worked less - well with the passage of time, so it was fully disabled in ME. - */ - if (!m_separateLeftRightInitialized && isDown) { - CheckForSeperateLeftRight(wParam); - } - if (m_separateLeftRight) { - bool down = HIBYTE(::GetKeyState(VK_LSHIFT)) != 0; - ConvertEvent(VK_LSHIFT, down); - down = HIBYTE(::GetKeyState(VK_RSHIFT)) != 0; - ConvertEvent(VK_RSHIFT, down); - down = HIBYTE(::GetKeyState(VK_LMENU)) != 0; - ConvertEvent(VK_LMENU, down); - down = HIBYTE(::GetKeyState(VK_RMENU)) != 0; - ConvertEvent(VK_RMENU, down); - down = HIBYTE(::GetKeyState(VK_LCONTROL)) != 0; - ConvertEvent(VK_LCONTROL, down); - down = HIBYTE(::GetKeyState(VK_RCONTROL)) != 0; - ConvertEvent(VK_RCONTROL, down); - } - else { - bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0; - ConvertEvent(VK_LSHIFT, down); - ConvertEvent(VK_RSHIFT, down); - down = HIBYTE(::GetKeyState(VK_MENU)) != 0; - ConvertEvent(VK_LMENU, down); - ConvertEvent(VK_RMENU, down); - down = HIBYTE(::GetKeyState(VK_CONTROL)) != 0; - ConvertEvent(VK_LCONTROL, down); - ConvertEvent(VK_RCONTROL, down); - } -} - - -void GPW_KeyboardDevice::CheckForSeperateLeftRight(WPARAM wParam) -{ - // Check whether this system supports separate left and right keys - switch (wParam) { - case VK_SHIFT: - m_separateLeftRight = - (HIBYTE(::GetKeyState(VK_LSHIFT)) != 0) || - (HIBYTE(::GetKeyState(VK_RSHIFT)) != 0) ? - true : false; - break; - case VK_CONTROL: - m_separateLeftRight = - (HIBYTE(::GetKeyState(VK_LCONTROL)) != 0) || - (HIBYTE(::GetKeyState(VK_RCONTROL)) != 0) ? - true : false; - break; - case VK_MENU: - m_separateLeftRight = - (HIBYTE(::GetKeyState(VK_LMENU)) != 0) || - (HIBYTE(::GetKeyState(VK_RMENU)) != 0) ? - true : false; - break; - } - m_separateLeftRightInitialized = true; -} diff --git a/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.h b/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.h deleted file mode 100644 index e47ce32c44c..00000000000 --- a/source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef _GPW_KEYBOARDDEVICE_H_ -#define _GPW_KEYBOARDDEVICE_H_ - -#pragma warning (disable : 4786) - -#include -#include "GPC_KeyboardDevice.h" - -/** - * Win32 implementation of GPC_KeyboardDevice. - * The contructor fills the keyboard code translation map. - * Base class GPC_KeyboardDevice does the rest. - * @see SCA_IInputDevice - */ -class GPW_KeyboardDevice : public GPC_KeyboardDevice -{ -public: - GPW_KeyboardDevice(void); - - virtual ~GPW_KeyboardDevice(void); - - void ConvertWinEvent(WPARAM wParam, bool isDown); - -protected: - - void ConvertModifierKey(WPARAM wParam, bool isDown); - - void CheckForSeperateLeftRight(WPARAM wParam); - - /** Stores the capability of this system to distinguish left and right modifier keys. */ - bool m_separateLeftRight; - /** Stores the initialization state of the member m_leftRightDistinguishable. */ - bool m_separateLeftRightInitialized; -}; - -#endif //_GPW_KEYBOARDDEVICE_H_ - diff --git a/source/gameengine/GamePlayer/common/windows/GPW_System.cpp b/source/gameengine/GamePlayer/common/windows/GPW_System.cpp deleted file mode 100644 index 4f4a48a52f1..00000000000 --- a/source/gameengine/GamePlayer/common/windows/GPW_System.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Timing routine taken and modified from KX_BlenderSystem.cpp - */ - -#include -#include "GPW_System.h" - -GPW_System::GPW_System(void) -{ - m_freq = 0; - m_lastCount = 0; - m_lastRest = 0; - m_lastTime = 0; -} - - -double GPW_System::GetTimeInSeconds() -{ -#if 0 - double secs = ::GetTickCount(); - secs /= 1000.; - return secs; -#else - - // 03/20/1999 Thomas Hieber: completely redone to get true Millisecond - // accuracy instead of very rough ticks. This routine will also provide - // correct wrap around at the end of "long" - - // m_freq was set to -1, if the current Hardware does not support - // high resolution timers. We will use GetTickCount instead then. - if (m_freq < 0) { - return ::GetTickCount(); - } - - // m_freq is 0, the first time this function is being called. - if (m_freq == 0) { - // Try to determine the frequency of the high resulution timer - if (!::QueryPerformanceFrequency((LARGE_INTEGER*)&m_freq)) { - // There is no such timer.... - m_freq = -1; - return 0; - } - } - - // Retrieve current count - __int64 count = 0; - ::QueryPerformanceCounter((LARGE_INTEGER*)&count); - - // Calculate the time passed since last call, and add the rest of - // those tics that didn't make it into the last reported time. - __int64 delta = 1000*(count-m_lastCount) + m_lastRest; - - m_lastTime += (long)(delta/m_freq); // Save the new value - m_lastRest = delta%m_freq; // Save those ticks not being counted - m_lastCount = count; // Save last count - - // Return a high quality measurement of time - return m_lastTime/1000.0; -#endif -} - - diff --git a/source/gameengine/GamePlayer/common/windows/GPW_System.h b/source/gameengine/GamePlayer/common/windows/GPW_System.h deleted file mode 100644 index bd9a0cd709f..00000000000 --- a/source/gameengine/GamePlayer/common/windows/GPW_System.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Timing routine taken and modified from KX_BlenderSystem.cpp - */ - -#ifndef _GPW_SYSTEM_H_ -#define _GPW_SYSTEM_H_ - -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning - -#include "GPC_System.h" - -#if defined(__CYGWIN32__) -# define __int64 long long -#endif - -class GPW_System : public GPC_System -{ -public: - GPW_System(); - - virtual double GetTimeInSeconds(); -protected: - - __int64 m_freq; - __int64 m_lastCount; - __int64 m_lastRest; - long m_lastTime; - -}; - -#endif //_GPW_SYSTEM_H_ - diff --git a/source/gameengine/GamePlayer/common/windows/Makefile b/source/gameengine/GamePlayer/common/windows/Makefile deleted file mode 100644 index 3f1deb05f3a..00000000000 --- a/source/gameengine/GamePlayer/common/windows/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# -# ATTENTION: this Makefile is only used for win builds! - -LIBNAME = windows -DIR = $(OCGDIR)/gameengine/GamePlayer/common/$(LIBNAME) - -include nan_compile.mk - -CPPFLAGS += -I.. -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) - -CPPFLAGS += -I$(SRCHOME)/gameengine/GameLogic -CPPFLAGS += -I$(SRCHOME)/gameengine/Rasterizer -CPPFLAGS += -I$(SRCHOME)/gameengine/Ketsji -CPPFLAGS += -I$(SRCHOME)/gameengine/Network -CPPFLAGS += -I$(SRCHOME)/gameengine/Network/LoopBackNetwork - -CPPFLAGS += -I$(SRCHOME)/gameengine/Physics/Sumo/Fuzzics/include -CPPFLAGS += -I$(SRCHOME)/gameengine/Physics/Sumo/include - -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_GLEW)/include - -# Blender stuff -CPPFLAGS += -I$(SRCHOME)/blender/blenkernel -CPPFLAGS += -I$(SRCHOME)/blender/blenlib -CPPFLAGS += -I$(SRCHOME)/blender/blenloader -CPPFLAGS += -I$(SRCHOME)/blender/imbuf -CPPFLAGS += -I$(SRCHOME)/blender/makesdna -CPPFLAGS += -I$(SRCHOME)/kernel/gen_system - -CPPFLAGS += -I../../kernel/gen_system - diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt deleted file mode 100644 index 848c2f73f06..00000000000 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ /dev/null @@ -1,76 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -SET(SRC - GPG_Application.cpp - GPG_Canvas.cpp - GPG_ghost.cpp - GPG_KeyboardDevice.cpp - GPG_System.cpp -) - -SET(INC - . - ../../../../intern/string - ../../../../intern/ghost - ../../../../intern/guardedalloc - ../../../../intern/moto/include - ../../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../../source/kernel/gen_system - ../../../../source/kernel/gen_messaging - ../../../../source/gameengine/Converter - ../../../../source/blender/imbuf - ../../../../source/gameengine/Ketsji - ../../../../source/blender/blenlib - ../../../../source/blender/blenkernel - ../../../../source/blender/readblenfile - ../../../../source/blender - ../../../../source/blender/include - ../../../../source/blender/makesdna - ../../../../source/blender/makesrna - ../../../../source/gameengine/Rasterizer - ../../../../source/gameengine/GameLogic - ../../../../source/gameengine/Expressions - ../../../../source/gameengine/Network - ../../../../source/gameengine/SceneGraph - ../../../../source/gameengine/Physics/common - ../../../../source/gameengine/Network/LoopBackNetwork - ../../../../source/gameengine/GamePlayer/common - ../../../../source/blender/misc - ../../../../source/blender/blenloader - ../../../../source/blender/gpu - ../../../../extern/glew/include - ${PYTHON_INC} -) - -ADD_DEFINITIONS(-DGLEW_STATIC) - -IF(WITH_FFMPEG) - ADD_DEFINITIONS(-DWITH_FFMPEG) -ENDIF(WITH_FFMPEG) - -BLENDERLIB_NOLIST(gp_ghost "${SRC}" "${INC}") -#env.BlenderLib (libname='gp_ghost', sources=source_files, includes = incs, defines = [], libtype='player',priority=0, compileflags=cflags) diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp deleted file mode 100644 index 71507642226..00000000000 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ /dev/null @@ -1,897 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * GHOST Blender Player application implementation file. - */ - -#ifdef WIN32 - #pragma warning (disable:4786) // suppress stl-MSVC debug info warning - #include -#endif - -#include "GL/glew.h" -#include "GPU_extensions.h" - -#include "GPG_Application.h" - -#include -#include -#include - -/********************************** - * Begin Blender include block - **********************************/ -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus -#include "BLI_blenlib.h" -#include "BLO_readfile.h" -#include "BKE_global.h" -#include "BKE_main.h" -#include "BKE_sound.h" -#include "IMB_imbuf.h" -#include "DNA_scene_types.h" -#ifdef __cplusplus -} -#endif // __cplusplus -/********************************** - * End Blender include block - **********************************/ - - -#include "SYS_System.h" -#include "KX_KetsjiEngine.h" - -// include files needed by "KX_BlenderSceneConverter.h" -#include "GEN_Map.h" -#include "SCA_IActuator.h" -#include "RAS_MeshObject.h" -#include "RAS_OpenGLRasterizer.h" -#include "RAS_VAOpenGLRasterizer.h" -#include "RAS_ListRasterizer.h" -#include "RAS_GLExtensionManager.h" -#include "KX_PythonInit.h" -#include "KX_PyConstraintBinding.h" -#include "BL_Material.h" // MAXTEX - -#include "KX_BlenderSceneConverter.h" -#include "NG_LoopBackNetworkDeviceInterface.h" - -#include "GPC_MouseDevice.h" -#include "GPC_RenderTools.h" -#include "GPG_Canvas.h" -#include "GPG_KeyboardDevice.h" -#include "GPG_System.h" - -#include "STR_String.h" - -#include "GHOST_ISystem.h" -#include "GHOST_IEvent.h" -#include "GHOST_IEventConsumer.h" -#include "GHOST_IWindow.h" -#include "GHOST_Rect.h" - -static void frameTimerProc(GHOST_ITimerTask* task, GHOST_TUns64 time); - -static GHOST_ISystem* fSystem = 0; -static const int kTimerFreq = 10; - -GPG_Application::GPG_Application(GHOST_ISystem* system) - : m_startSceneName(""), - m_startScene(0), - m_maggie(0), - m_exitRequested(0), - m_system(system), - m_mainWindow(0), - m_frameTimer(0), - m_cursor(GHOST_kStandardCursorFirstCursor), - m_engineInitialized(0), - m_engineRunning(0), - m_isEmbedded(false), - m_ketsjiengine(0), - m_kxsystem(0), - m_keyboard(0), - m_mouse(0), - m_canvas(0), - m_rendertools(0), - m_rasterizer(0), - m_sceneconverter(0), - m_networkdevice(0), - m_blendermat(0), - m_blenderglslmat(0), - m_pyGlobalDictString(0), - m_pyGlobalDictString_Length(0) -{ - fSystem = system; -} - - - -GPG_Application::~GPG_Application(void) -{ - if(m_pyGlobalDictString) { - delete [] m_pyGlobalDictString; - m_pyGlobalDictString = 0; - m_pyGlobalDictString_Length = 0; - } - - exitEngine(); - fSystem->disposeWindow(m_mainWindow); -} - - - -bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene, int argc, char **argv) -{ - bool result = false; - - if (maggie != NULL && scene != NULL) - { -// XXX G.scene = scene; - m_maggie = maggie; - m_startSceneName = scene->id.name+2; - m_startScene = scene; - result = true; - } - - /* Python needs these */ - m_argc= argc; - m_argv= argv; - - return result; -} - - -#ifdef WIN32 -#define SCR_SAVE_MOUSE_MOVE_THRESHOLD 15 - -static HWND found_ghost_window_hwnd; -static GHOST_IWindow* ghost_window_to_find; -static WNDPROC ghost_wnd_proc; -static POINT scr_save_mouse_pos; - -static LRESULT CALLBACK screenSaverWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - BOOL close = FALSE; - switch (uMsg) - { - case WM_MOUSEMOVE: - { - POINT pt; - GetCursorPos(&pt); - LONG dx = scr_save_mouse_pos.x - pt.x; - LONG dy = scr_save_mouse_pos.y - pt.y; - if (abs(dx) > SCR_SAVE_MOUSE_MOVE_THRESHOLD - || abs(dy) > SCR_SAVE_MOUSE_MOVE_THRESHOLD) - { - close = TRUE; - } - scr_save_mouse_pos = pt; - break; - } - case WM_LBUTTONDOWN: - case WM_MBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_KEYDOWN: - close = TRUE; - } - if (close) - PostMessage(hwnd,WM_CLOSE,0,0); - return CallWindowProc(ghost_wnd_proc, hwnd, uMsg, wParam, lParam); -} - -BOOL CALLBACK findGhostWindowHWNDProc(HWND hwnd, LPARAM lParam) -{ - GHOST_IWindow *p = (GHOST_IWindow*) GetWindowLongPtr(hwnd, GWLP_USERDATA); - BOOL ret = TRUE; - if (p == ghost_window_to_find) - { - found_ghost_window_hwnd = hwnd; - ret = FALSE; - } - return ret; -} - -static HWND findGhostWindowHWND(GHOST_IWindow* window) -{ - found_ghost_window_hwnd = NULL; - ghost_window_to_find = window; - EnumWindows(findGhostWindowHWNDProc, NULL); - return found_ghost_window_hwnd; -} - -bool GPG_Application::startScreenSaverPreview( - HWND parentWindow, - const bool stereoVisual, - const int stereoMode) -{ - bool success = false; - - RECT rc; - if (GetWindowRect(parentWindow, &rc)) - { - int windowWidth = rc.right - rc.left; - int windowHeight = rc.bottom - rc.top; - STR_String title = ""; - - m_mainWindow = fSystem->createWindow(title, 0, 0, windowWidth, windowHeight, GHOST_kWindowStateMinimized, - GHOST_kDrawingContextTypeOpenGL, stereoVisual); - if (!m_mainWindow) { - printf("error: could not create main window\n"); - exit(-1); - } - - HWND ghost_hwnd = findGhostWindowHWND(m_mainWindow); - if (!ghost_hwnd) { - printf("error: could find main window\n"); - exit(-1); - } - - SetParent(ghost_hwnd, parentWindow); - LONG style = GetWindowLong(ghost_hwnd, GWL_STYLE); - LONG exstyle = GetWindowLong(ghost_hwnd, GWL_EXSTYLE); - - RECT adjrc = { 0, 0, windowWidth, windowHeight }; - AdjustWindowRectEx(&adjrc, style, FALSE, exstyle); - - style = (style & (~(WS_POPUP|WS_OVERLAPPEDWINDOW|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_TILEDWINDOW ))) | WS_CHILD; - SetWindowLong(ghost_hwnd, GWL_STYLE, style); - SetWindowPos(ghost_hwnd, NULL, adjrc.left, adjrc.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE); - - /* Check the size of the client rectangle of the window and resize the window - * so that the client rectangle has the size requested. - */ - m_mainWindow->setClientSize(windowWidth, windowHeight); - - success = initEngine(m_mainWindow, stereoMode); - if (success) { - success = startEngine(); - } - - } - return success; -} - -bool GPG_Application::startScreenSaverFullScreen( - int width, - int height, - int bpp,int frequency, - const bool stereoVisual, - const int stereoMode) -{ - bool ret = startFullScreen(width, height, bpp, frequency, stereoVisual, stereoMode); - if (ret) - { - HWND ghost_hwnd = findGhostWindowHWND(m_mainWindow); - if (ghost_hwnd != NULL) - { - GetCursorPos(&scr_save_mouse_pos); - ghost_wnd_proc = (WNDPROC) GetWindowLongPtr(ghost_hwnd, GWLP_WNDPROC); - SetWindowLongPtr(ghost_hwnd,GWLP_WNDPROC, (uintptr_t) screenSaverWindowProc); - } - } - return ret; -} - -#endif - -bool GPG_Application::startWindow(STR_String& title, - int windowLeft, - int windowTop, - int windowWidth, - int windowHeight, - const bool stereoVisual, - const int stereoMode) -{ - bool success; - // Create the main window - //STR_String title ("Blender Player - GHOST"); - m_mainWindow = fSystem->createWindow(title, windowLeft, windowTop, windowWidth, windowHeight, GHOST_kWindowStateNormal, - GHOST_kDrawingContextTypeOpenGL, stereoVisual); - if (!m_mainWindow) { - printf("error: could not create main window\n"); - exit(-1); - } - - /* Check the size of the client rectangle of the window and resize the window - * so that the client rectangle has the size requested. - */ - m_mainWindow->setClientSize(windowWidth, windowHeight); - m_mainWindow->setCursorVisibility(false); - - success = initEngine(m_mainWindow, stereoMode); - if (success) { - success = startEngine(); - } - return success; -} - -bool GPG_Application::startEmbeddedWindow(STR_String& title, - const GHOST_TEmbedderWindowID parentWindow, - const bool stereoVisual, - const int stereoMode) { - - m_mainWindow = fSystem->createWindow(title, 0, 0, 0, 0, GHOST_kWindowStateNormal, - GHOST_kDrawingContextTypeOpenGL, stereoVisual, parentWindow); - - if (!m_mainWindow) { - printf("error: could not create main window\n"); - exit(-1); - } - m_isEmbedded = true; - - bool success = initEngine(m_mainWindow, stereoMode); - if (success) { - success = startEngine(); - } - return success; -} - - -bool GPG_Application::startFullScreen( - int width, - int height, - int bpp,int frequency, - const bool stereoVisual, - const int stereoMode) -{ - bool success; - // Create the main window - GHOST_DisplaySetting setting; - setting.xPixels = width; - setting.yPixels = height; - setting.bpp = bpp; - setting.frequency = frequency; - - fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual); - m_mainWindow->setCursorVisibility(false); - - success = initEngine(m_mainWindow, stereoMode); - if (success) { - success = startEngine(); - } - return success; -} - - - - -bool GPG_Application::StartGameEngine(int stereoMode) -{ - bool success = initEngine(m_mainWindow, stereoMode); - - if (success) - success = startEngine(); - - return success; -} - - - -void GPG_Application::StopGameEngine() -{ - exitEngine(); -} - - - -bool GPG_Application::processEvent(GHOST_IEvent* event) -{ - bool handled = true; - - switch (event->getType()) - { - case GHOST_kEventUnknown: - break; - - case GHOST_kEventButtonDown: - handled = handleButton(event, true); - break; - - case GHOST_kEventButtonUp: - handled = handleButton(event, false); - break; - - case GHOST_kEventWheel: - handled = handleWheel(event); - break; - - case GHOST_kEventCursorMove: - handled = handleCursorMove(event); - break; - - case GHOST_kEventKeyDown: - handleKey(event, true); - break; - - case GHOST_kEventKeyUp: - handleKey(event, false); - break; - - - case GHOST_kEventWindowClose: - m_exitRequested = KX_EXIT_REQUEST_OUTSIDE; - break; - - case GHOST_kEventWindowActivate: - handled = false; - break; - case GHOST_kEventWindowDeactivate: - handled = false; - break; - - case GHOST_kEventWindowUpdate: - { - GHOST_IWindow* window = event->getWindow(); - if (!m_system->validWindow(window)) break; - // Update the state of the game engine - if (m_kxsystem && !m_exitRequested) - { - // Proceed to next frame - window->activateDrawingContext(); - - // first check if we want to exit - m_exitRequested = m_ketsjiengine->GetExitCode(); - - // kick the engine - bool renderFrame = m_ketsjiengine->NextFrame(); - if (renderFrame) - { - // render the frame - m_ketsjiengine->Render(); - } - } - m_exitString = m_ketsjiengine->GetExitString(); - } - break; - - case GHOST_kEventWindowSize: - { - GHOST_IWindow* window = event->getWindow(); - if (!m_system->validWindow(window)) break; - if (m_canvas) { - GHOST_Rect bnds; - window->getClientBounds(bnds); - m_canvas->Resize(bnds.getWidth(), bnds.getHeight()); - } - } - break; - - default: - handled = false; - break; - } - return handled; -} - - - -int GPG_Application::getExitRequested(void) -{ - return m_exitRequested; -} - - - -const STR_String& GPG_Application::getExitString(void) -{ - return m_exitString; -} - - - -bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) -{ - if (!m_engineInitialized) - { - GPU_extensions_init(); - bgl::InitExtensions(true); - - // get and set the preferences - SYS_SystemHandle syshandle = SYS_GetSystem(); - if (!syshandle) - return false; - - // SYS_WriteCommandLineInt(syshandle, "fixedtime", 0); - // SYS_WriteCommandLineInt(syshandle, "vertexarrays",1); - GameData *gm= &m_startScene->gm; - bool properties = (SYS_GetCommandLineInt(syshandle, "show_properties", 0) != 0); - bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0); - bool fixedFr = (gm->flag & GAME_ENABLE_ALL_FRAMES); - - bool showPhysics = (gm->flag & GAME_SHOW_PHYSICS); - SYS_WriteCommandLineInt(syshandle, "show_physics", showPhysics); - - bool fixed_framerate= (SYS_GetCommandLineInt(syshandle, "fixed_framerate", fixedFr) != 0); - bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0); - bool useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", gm->flag & GAME_DISPLAY_LISTS) != 0); - bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0); - - if(GLEW_ARB_multitexture && GLEW_VERSION_1_1) - m_blendermat = (SYS_GetCommandLineInt(syshandle, "blender_material", 1) != 0); - - if(GPU_glsl_support()) - m_blenderglslmat = (SYS_GetCommandLineInt(syshandle, "blender_glsl_material", 1) != 0); - else if(gm->matmode == GAME_MAT_GLSL) - m_blendermat = false; - - // create the canvas, rasterizer and rendertools - m_canvas = new GPG_Canvas(window); - if (!m_canvas) - return false; - - m_canvas->Init(); - m_rendertools = new GPC_RenderTools(); - if (!m_rendertools) - goto initFailed; - - if(useLists) { - if(GLEW_VERSION_1_1) - m_rasterizer = new RAS_ListRasterizer(m_canvas, true); - else - m_rasterizer = new RAS_ListRasterizer(m_canvas); - } - else if (GLEW_VERSION_1_1) - m_rasterizer = new RAS_VAOpenGLRasterizer(m_canvas); - else - m_rasterizer = new RAS_OpenGLRasterizer(m_canvas); - - /* Stereo parameters - Eye Separation from the UI - stereomode from the command-line/UI */ - m_rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) stereoMode); - m_rasterizer->SetEyeSeparation(m_startScene->gm.eyeseparation); - - if (!m_rasterizer) - goto initFailed; - - // create the inputdevices - m_keyboard = new GPG_KeyboardDevice(); - if (!m_keyboard) - goto initFailed; - - m_mouse = new GPC_MouseDevice(); - if (!m_mouse) - goto initFailed; - - // create a networkdevice - m_networkdevice = new NG_LoopBackNetworkDeviceInterface(); - if (!m_networkdevice) - goto initFailed; - - sound_init(m_maggie); - - // create a ketsjisystem (only needed for timing and stuff) - m_kxsystem = new GPG_System (m_system); - if (!m_kxsystem) - goto initFailed; - - // create the ketsjiengine - m_ketsjiengine = new KX_KetsjiEngine(m_kxsystem); - - // set the devices - m_ketsjiengine->SetKeyboardDevice(m_keyboard); - m_ketsjiengine->SetMouseDevice(m_mouse); - m_ketsjiengine->SetNetworkDevice(m_networkdevice); - m_ketsjiengine->SetCanvas(m_canvas); - m_ketsjiengine->SetRenderTools(m_rendertools); - m_ketsjiengine->SetRasterizer(m_rasterizer); - m_ketsjiengine->SetNetworkDevice(m_networkdevice); - - m_ketsjiengine->SetTimingDisplay(frameRate, false, false); - - CValue::SetDeprecationWarnings(nodepwarnings); - - m_ketsjiengine->SetUseFixedTime(fixed_framerate); - m_ketsjiengine->SetTimingDisplay(frameRate, profile, properties); - - m_engineInitialized = true; - } - - return m_engineInitialized; -initFailed: - sound_exit(); - delete m_kxsystem; - delete m_networkdevice; - delete m_mouse; - delete m_keyboard; - delete m_rasterizer; - delete m_rendertools; - delete m_canvas; - m_canvas = NULL; - m_rendertools = NULL; - m_rasterizer = NULL; - m_keyboard = NULL; - m_mouse = NULL; - m_networkdevice = NULL; - m_kxsystem = NULL; - return false; -} - - - -bool GPG_Application::startEngine(void) -{ - if (m_engineRunning) { - return false; - } - - // Temporary hack to disable banner display for NaN approved content. - /* - m_canvas->SetBannerDisplayEnabled(true); - Camera* cam; - cam = (Camera*)scene->camera->data; - if (cam) { - if (((cam->flag) & 48)==48) { - m_canvas->SetBannerDisplayEnabled(false); - } - } - else { - showError(CString("Camera data invalid.")); - return false; - } - */ - - // create a scene converter, create and convert the stratingscene - m_sceneconverter = new KX_BlenderSceneConverter(m_maggie, m_ketsjiengine); - if (m_sceneconverter) - { - STR_String startscenename = m_startSceneName.Ptr(); - m_ketsjiengine->SetSceneConverter(m_sceneconverter); - - // if (always_use_expand_framing) - // sceneconverter->SetAlwaysUseExpandFraming(true); - if(m_blendermat && (m_startScene->gm.matmode != GAME_MAT_TEXFACE)) - m_sceneconverter->SetMaterials(true); - if(m_blenderglslmat && (m_startScene->gm.matmode == GAME_MAT_GLSL)) - m_sceneconverter->SetGLSLMaterials(true); - - KX_Scene* startscene = new KX_Scene(m_keyboard, - m_mouse, - m_networkdevice, - startscenename, - m_startScene, - m_canvas); - -#ifndef DISABLE_PYTHON - // some python things - PyObject *gameLogic, *gameLogic_keys; - setupGamePython(m_ketsjiengine, startscene, m_maggie, NULL, &gameLogic, &gameLogic_keys, m_argc, m_argv); -#endif // DISABLE_PYTHON - - //initialize Dome Settings - if(m_startScene->gm.stereoflag == STEREO_DOME) - m_ketsjiengine->InitDome(m_startScene->gm.dome.res, m_startScene->gm.dome.mode, m_startScene->gm.dome.angle, m_startScene->gm.dome.resbuf, m_startScene->gm.dome.tilt, m_startScene->gm.dome.warptext); - - // Set the GameLogic.globalDict from marshal'd data, so we can - // load new blend files and keep data in GameLogic.globalDict - loadGamePythonConfig(m_pyGlobalDictString, m_pyGlobalDictString_Length); - - m_sceneconverter->ConvertScene( - startscene, - m_rendertools, - m_canvas); - m_ketsjiengine->AddScene(startscene); - - // Create a timer that is used to kick the engine - if (!m_frameTimer) { - m_frameTimer = m_system->installTimer(0, kTimerFreq, frameTimerProc, m_mainWindow); - } - m_rasterizer->Init(); - m_ketsjiengine->StartEngine(true); - m_engineRunning = true; - - // Set the animation playback rate for ipo's and actions - // the framerate below should patch with FPS macro defined in blendef.h - // Could be in StartEngine set the framerate, we need the scene to do this - Scene *scene= startscene->GetBlenderScene(); // needed for macro - m_ketsjiengine->SetAnimFrameRate(FPS); - } - - if (!m_engineRunning) - { - stopEngine(); - } - - return m_engineRunning; -} - - -void GPG_Application::stopEngine() -{ - // GameLogic.globalDict gets converted into a buffer, and sorted in - // m_pyGlobalDictString so we can restore after python has stopped - // and started between .blend file loads. - if(m_pyGlobalDictString) { - delete [] m_pyGlobalDictString; - m_pyGlobalDictString = 0; - } - - m_pyGlobalDictString_Length = saveGamePythonConfig(&m_pyGlobalDictString); - - // when exiting the mainloop - exitGamePythonScripting(); - m_ketsjiengine->StopEngine(); - m_networkdevice->Disconnect(); - - if (m_sceneconverter) { - delete m_sceneconverter; - m_sceneconverter = 0; - } - if (m_system && m_frameTimer) { - m_system->removeTimer(m_frameTimer); - m_frameTimer = 0; - } - m_engineRunning = false; -} - - -void GPG_Application::exitEngine() -{ - sound_exit(); - if (m_ketsjiengine) - { - stopEngine(); - delete m_ketsjiengine; - m_ketsjiengine = 0; - } - if (m_kxsystem) - { - delete m_kxsystem; - m_kxsystem = 0; - } - if (m_networkdevice) - { - delete m_networkdevice; - m_networkdevice = 0; - } - if (m_mouse) - { - delete m_mouse; - m_mouse = 0; - } - if (m_keyboard) - { - delete m_keyboard; - m_keyboard = 0; - } - if (m_rasterizer) - { - delete m_rasterizer; - m_rasterizer = 0; - } - if (m_rendertools) - { - delete m_rendertools; - m_rendertools = 0; - } - if (m_canvas) - { - delete m_canvas; - m_canvas = 0; - } - - IMB_exit(); - GPU_extensions_exit(); - - m_exitRequested = 0; - m_engineInitialized = false; -} - -bool GPG_Application::handleWheel(GHOST_IEvent* event) -{ - bool handled = false; - MT_assert(event); - if (m_mouse) - { - GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(); - GHOST_TEventWheelData* wheelData = static_cast(eventData); - GPC_MouseDevice::TButtonId button; - if (wheelData->z > 0) - button = GPC_MouseDevice::buttonWheelUp; - else - button = GPC_MouseDevice::buttonWheelDown; - m_mouse->ConvertButtonEvent(button, true); - handled = true; - } - return handled; -} - -bool GPG_Application::handleButton(GHOST_IEvent* event, bool isDown) -{ - bool handled = false; - MT_assert(event); - if (m_mouse) - { - GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(); - GHOST_TEventButtonData* buttonData = static_cast(eventData); - GPC_MouseDevice::TButtonId button; - switch (buttonData->button) - { - case GHOST_kButtonMaskMiddle: - button = GPC_MouseDevice::buttonMiddle; - break; - case GHOST_kButtonMaskRight: - button = GPC_MouseDevice::buttonRight; - break; - case GHOST_kButtonMaskLeft: - default: - button = GPC_MouseDevice::buttonLeft; - break; - } - m_mouse->ConvertButtonEvent(button, isDown); - handled = true; - } - return handled; -} - - -bool GPG_Application::handleCursorMove(GHOST_IEvent* event) -{ - bool handled = false; - MT_assert(event); - if (m_mouse && m_mainWindow) - { - GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(); - GHOST_TEventCursorData* cursorData = static_cast(eventData); - GHOST_TInt32 x, y; - m_mainWindow->screenToClient(cursorData->x, cursorData->y, x, y); - m_mouse->ConvertMoveEvent(x, y); - handled = true; - } - return handled; -} - - -bool GPG_Application::handleKey(GHOST_IEvent* event, bool isDown) -{ - bool handled = false; - MT_assert(event); - if (m_keyboard) - { - GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(); - GHOST_TEventKeyData* keyData = static_cast(eventData); - //no need for this test - //if (fSystem->getFullScreen()) { - if (keyData->key == GHOST_kKeyEsc && !m_keyboard->m_hookesc && !m_isEmbedded) { - m_exitRequested = KX_EXIT_REQUEST_OUTSIDE; - } - //} - m_keyboard->ConvertEvent(keyData->key, isDown); - handled = true; - } - return handled; -} - - - -static void frameTimerProc(GHOST_ITimerTask* task, GHOST_TUns64 time) -{ - GHOST_IWindow* window = (GHOST_IWindow*)task->getUserData(); - if (fSystem->validWindow(window)) { - window->invalidate(); - } -} diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h deleted file mode 100644 index 48a6c8e78ec..00000000000 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.h +++ /dev/null @@ -1,159 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * GHOST Blender Player application declaration file. - */ - -#include "GHOST_IEventConsumer.h" -#include "STR_String.h" - -#ifdef WIN32 -#include -#endif - -class KX_KetsjiEngine; -class KX_ISceneConverter; -class NG_LoopBackNetworkDeviceInterface; -class RAS_IRasterizer; -class GHOST_IEvent; -class GHOST_ISystem; -class GHOST_ITimerTask; -class GHOST_IWindow; -class GPC_MouseDevice; -class GPC_RenderTools; -class GPG_Canvas; -class GPG_KeyboardDevice; -class GPG_System; -struct Main; -struct Scene; - -class GPG_Application : public GHOST_IEventConsumer -{ -public: - GPG_Application(GHOST_ISystem* system); - ~GPG_Application(void); - - bool SetGameEngineData(struct Main* maggie, struct Scene* scene, int argc, char** argv); - bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight, - const bool stereoVisual, const int stereoMode); - bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode); - bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, const bool stereoVisual, const int stereoMode); -#ifdef WIN32 - bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode); - bool startScreenSaverPreview(HWND parentWindow, const bool stereoVisual, const int stereoMode); -#endif - - virtual bool processEvent(GHOST_IEvent* event); - int getExitRequested(void); - const STR_String& getExitString(void); - bool StartGameEngine(int stereoMode); - void StopGameEngine(); - -protected: - bool handleWheel(GHOST_IEvent* event); - bool handleButton(GHOST_IEvent* event, bool isDown); - bool handleCursorMove(GHOST_IEvent* event); - bool handleKey(GHOST_IEvent* event, bool isDown); - - /** - * Initializes the game engine. - */ - bool initEngine(GHOST_IWindow* window, int stereoMode); - - /** - * Starts the game engine. - */ - bool startEngine(void); - - /** - * Stop the game engine. - */ - void stopEngine(void); - - /** - * Shuts the game engine down. - */ - void exitEngine(void); - - /* The game data */ - STR_String m_startSceneName; - struct Scene* m_startScene; - struct Main* m_maggie; - - /* Exit state. */ - int m_exitRequested; - STR_String m_exitString; - /* GHOST system abstraction. */ - GHOST_ISystem* m_system; - /* Main window. */ - GHOST_IWindow* m_mainWindow; - /* Timer to advance frames. */ - GHOST_ITimerTask* m_frameTimer; - /* The cursor shape displayed. */ - GHOST_TStandardCursor m_cursor; - - /** Engine construction state. */ - bool m_engineInitialized; - /** Engine state. */ - bool m_engineRunning; - /** Running on embedded window */ - bool m_isEmbedded; - - /** the gameengine itself */ - KX_KetsjiEngine* m_ketsjiengine; - /** The game engine's system abstraction. */ - GPG_System* m_kxsystem; - /** The game engine's keyboard abstraction. */ - GPG_KeyboardDevice* m_keyboard; - /** The game engine's mouse abstraction. */ - GPC_MouseDevice* m_mouse; - /** The game engine's canvas abstraction. */ - GPG_Canvas* m_canvas; - /** The game engine's platform dependent render tools. */ - GPC_RenderTools* m_rendertools; - /** the rasterizer */ - RAS_IRasterizer* m_rasterizer; - /** Converts Blender data files. */ - KX_ISceneConverter* m_sceneconverter; - /** Network interface. */ - NG_LoopBackNetworkDeviceInterface* m_networkdevice; - - bool m_blendermat; - bool m_blenderglslmat; - - /* - * GameLogic.globalDict as a string so that loading new blend files can use the same dict. - * Do this because python starts/stops when loading blend files. - */ - char* m_pyGlobalDictString; - int m_pyGlobalDictString_Length; - - /* argc and argv need to be passed on to python */ - int m_argc; - char** m_argv; -}; - diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp deleted file mode 100644 index 24c0102a87c..00000000000 --- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "GPG_Canvas.h" -#include -#include "GHOST_ISystem.h" - -GPG_Canvas::GPG_Canvas(GHOST_IWindow* window) -: GPC_Canvas(0, 0), m_window(window) -{ - if (m_window) - { - GHOST_Rect bnds; - m_window->getClientBounds(bnds); - this->Resize(bnds.getWidth(), bnds.getHeight()); - } -} - - -GPG_Canvas::~GPG_Canvas(void) -{ -} - - -void GPG_Canvas::Init() -{ - if (m_window) - { - GHOST_TSuccess success; - success = m_window->setDrawingContextType(GHOST_kDrawingContextTypeOpenGL); - assert(success == GHOST_kSuccess); - } -} - -void GPG_Canvas::SetMousePosition(int x, int y) -{ - GHOST_ISystem* system = GHOST_ISystem::getSystem(); - if (system && m_window) - { - GHOST_TInt32 gx = (GHOST_TInt32)x; - GHOST_TInt32 gy = (GHOST_TInt32)y; - GHOST_TInt32 cx; - GHOST_TInt32 cy; - m_window->clientToScreen(gx, gy, cx, cy); - system->setCursorPosition(cx, cy); - } -} - - -void GPG_Canvas::SetMouseState(RAS_MouseState mousestate) -{ - m_mousestate = mousestate; - - if (m_window) - { - switch (mousestate) - { - case MOUSE_INVISIBLE: - m_window->setCursorVisibility(false); - break; - case MOUSE_WAIT: - m_window->setCursorShape(GHOST_kStandardCursorWait); - m_window->setCursorVisibility(true); - break; - case MOUSE_NORMAL: - m_window->setCursorShape(GHOST_kStandardCursorRightArrow); - m_window->setCursorVisibility(true); - break; - } - } -} - - -void GPG_Canvas::SwapBuffers() -{ - if (m_window) - { - m_window->swapBuffers(); - } -} - -float GPG_Canvas::GetMouseNormalizedX(int x) -{ - return float(x)/this->GetWidth(); -} - -float GPG_Canvas::GetMouseNormalizedY(int y) -{ - return float(y)/this->GetHeight(); -} diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h deleted file mode 100644 index 7b19c03d3c3..00000000000 --- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef _GPG_CANVAS_H_ -#define _GPG_CANVAS_H_ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif // WIN32 - -#include "GPC_Canvas.h" - -#include "GHOST_IWindow.h" - - -class GPG_Canvas : public GPC_Canvas -{ -protected: - /** GHOST window. */ - GHOST_IWindow* m_window; - -public: - GPG_Canvas(GHOST_IWindow* window); - virtual ~GPG_Canvas(void); - - virtual void Init(void); - virtual void SetMousePosition(int x, int y); - virtual void SetMouseState(RAS_MouseState mousestate); - virtual void SwapBuffers(); - virtual int GetMouseX(int x){return x;}; - virtual int GetMouseY(int y){return y;}; - virtual float GetMouseNormalizedX(int x); - virtual float GetMouseNormalizedY(int y); - - bool BeginDraw() { return true;}; - void EndDraw() {}; -}; - -#endif // _GPG_CANVAS_H_ - diff --git a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp b/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp deleted file mode 100644 index 2e9810ad0ae..00000000000 --- a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * GHOST Blender Player keyboard device implementation. - */ - -#include "GPG_KeyboardDevice.h" - -GPG_KeyboardDevice::GPG_KeyboardDevice(void) -{ - m_reverseKeyTranslateTable[GHOST_kKeyA ] = KX_AKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyB ] = KX_BKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyC ] = KX_CKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyD ] = KX_DKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyE ] = KX_EKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF ] = KX_FKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyG ] = KX_GKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyH ] = KX_HKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyI ] = KX_IKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyJ ] = KX_JKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyK ] = KX_KKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyL ] = KX_LKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyM ] = KX_MKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyN ] = KX_NKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyO ] = KX_OKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyP ] = KX_PKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyQ ] = KX_QKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyR ] = KX_RKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyS ] = KX_SKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyT ] = KX_TKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyU ] = KX_UKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyV ] = KX_VKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyW ] = KX_WKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyX ] = KX_XKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyY ] = KX_YKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyZ ] = KX_ZKEY ; - - m_reverseKeyTranslateTable[GHOST_kKey0 ] = KX_ZEROKEY ; - m_reverseKeyTranslateTable[GHOST_kKey1 ] = KX_ONEKEY ; - m_reverseKeyTranslateTable[GHOST_kKey2 ] = KX_TWOKEY ; - m_reverseKeyTranslateTable[GHOST_kKey3 ] = KX_THREEKEY ; - m_reverseKeyTranslateTable[GHOST_kKey4 ] = KX_FOURKEY ; - m_reverseKeyTranslateTable[GHOST_kKey5 ] = KX_FIVEKEY ; - m_reverseKeyTranslateTable[GHOST_kKey6 ] = KX_SIXKEY ; - m_reverseKeyTranslateTable[GHOST_kKey7 ] = KX_SEVENKEY ; - m_reverseKeyTranslateTable[GHOST_kKey8 ] = KX_EIGHTKEY ; - m_reverseKeyTranslateTable[GHOST_kKey9 ] = KX_NINEKEY ; - - // Middle keyboard area keys - m_reverseKeyTranslateTable[GHOST_kKeyPause ] = KX_PAUSEKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyInsert ] = KX_INSERTKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyDelete ] = KX_DELKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyHome ] = KX_HOMEKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyEnd ] = KX_ENDKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyUpPage ] = KX_PAGEUPKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyDownPage ] = KX_PAGEDOWNKEY ; - - // Arrow keys - m_reverseKeyTranslateTable[GHOST_kKeyUpArrow ] = KX_UPARROWKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyDownArrow ] = KX_DOWNARROWKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyLeftArrow ] = KX_LEFTARROWKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyRightArrow ] = KX_RIGHTARROWKEY ; - - // Function keys - m_reverseKeyTranslateTable[GHOST_kKeyF1 ] = KX_F1KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF2 ] = KX_F2KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF3 ] = KX_F3KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF4 ] = KX_F4KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF5 ] = KX_F5KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF6 ] = KX_F6KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF7 ] = KX_F7KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF8 ] = KX_F8KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF9 ] = KX_F9KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF10 ] = KX_F10KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF11 ] = KX_F11KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF12 ] = KX_F12KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF13 ] = KX_F13KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF14 ] = KX_F14KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF15 ] = KX_F15KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF16 ] = KX_F16KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF17 ] = KX_F17KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF18 ] = KX_F18KEY ; - m_reverseKeyTranslateTable[GHOST_kKeyF19 ] = KX_F19KEY ; - - - // Numpad keys - m_reverseKeyTranslateTable[GHOST_kKeyNumpad0 ] = KX_PAD0 ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpad1 ] = KX_PAD1 ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpad2 ] = KX_PAD2 ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpad3 ] = KX_PAD3 ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpad4 ] = KX_PAD4 ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpad5 ] = KX_PAD5 ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpad6 ] = KX_PAD6 ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpad7 ] = KX_PAD7 ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpad8 ] = KX_PAD8 ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpad9 ] = KX_PAD9 ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpadAsterisk ] = KX_PADASTERKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpadPlus ] = KX_PADPLUSKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpadPeriod ] = KX_PADPERIOD ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpadMinus ] = KX_PADMINUS ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpadSlash ] = KX_PADSLASHKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyNumpadEnter ] = KX_PADENTER ; - - // Other keys - m_reverseKeyTranslateTable[GHOST_kKeyCapsLock ] = KX_CAPSLOCKKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyEsc ] = KX_ESCKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyTab ] = KX_TABKEY ; - m_reverseKeyTranslateTable[GHOST_kKeySpace ] = KX_SPACEKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyEnter ] = KX_RETKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyBackSpace ] = KX_BACKSPACEKEY ; - m_reverseKeyTranslateTable[GHOST_kKeySemicolon ] = KX_SEMICOLONKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyPeriod ] = KX_PERIODKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyComma ] = KX_COMMAKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyQuote ] = KX_QUOTEKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyAccentGrave ] = KX_ACCENTGRAVEKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyMinus ] = KX_MINUSKEY ; - m_reverseKeyTranslateTable[GHOST_kKeySlash ] = KX_SLASHKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyBackslash ] = KX_BACKSLASHKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyEqual ] = KX_EQUALKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyLeftBracket ] = KX_LEFTBRACKETKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyRightBracket ] = KX_RIGHTBRACKETKEY ; - - // Modifier keys. - m_reverseKeyTranslateTable[GHOST_kKeyLeftControl ] = KX_LEFTCTRLKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyRightControl ] = KX_RIGHTCTRLKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyLeftAlt ] = KX_LEFTALTKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyRightAlt ] = KX_RIGHTALTKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyLeftShift ] = KX_LEFTSHIFTKEY ; - m_reverseKeyTranslateTable[GHOST_kKeyRightShift ] = KX_RIGHTSHIFTKEY ; -} - - -GPG_KeyboardDevice::~GPG_KeyboardDevice(void) -{ -} diff --git a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h b/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h deleted file mode 100644 index 8fb42caed95..00000000000 --- a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * GHOST Blender Player keyboard device. - */ - -#ifndef _GPG_KEYBOARDDEVICE_H_ -#define _GPG_KEYBOARDDEVICE_H_ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif // WIN32 - -#include "GHOST_Types.h" -#include "GPC_KeyboardDevice.h" - -/** - * GHOST implementation of GPC_KeyboardDevice. - * The contructor fills the keyboard code translation map. - * Base class GPC_KeyboardDevice does the rest. - * @see SCA_IInputDevice - */ -class GPG_KeyboardDevice : public GPC_KeyboardDevice -{ -public: - GPG_KeyboardDevice(void); - virtual ~GPG_KeyboardDevice(void); -}; - -#endif //_GPG_KEYBOARDDEVICE_H_ - diff --git a/source/gameengine/GamePlayer/ghost/GPG_System.cpp b/source/gameengine/GamePlayer/ghost/GPG_System.cpp deleted file mode 100644 index 94756ec4ed5..00000000000 --- a/source/gameengine/GamePlayer/ghost/GPG_System.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Blender Player system on GHOST. - */ - -#include "GPG_System.h" -#include -#include "GHOST_ISystem.h" - -GPG_System::GPG_System(GHOST_ISystem* system) -: m_system(system) -{ - assert(m_system); -} - - -double GPG_System::GetTimeInSeconds() -{ - GHOST_TInt64 millis = (GHOST_TInt64)m_system->getMilliSeconds(); - double time = (double)millis; - time /= 1000.; - return time; -} - - diff --git a/source/gameengine/GamePlayer/ghost/GPG_System.h b/source/gameengine/GamePlayer/ghost/GPG_System.h deleted file mode 100644 index e6e5506cbc1..00000000000 --- a/source/gameengine/GamePlayer/ghost/GPG_System.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Blender Player system on GHOST. - */ - -#ifndef _GPG_SYSTEM_H_ -#define _GPG_SYSTEM_H_ - -#ifdef WIN32 -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif // WIN32 - -#include "GPC_System.h" - -class GHOST_ISystem; - -class GPG_System : public GPC_System -{ - GHOST_ISystem* m_system; - -public: - GPG_System(GHOST_ISystem* system); - - virtual double GetTimeInSeconds(); -}; - -#endif // _GPG_SYSTEM_H_ - diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp deleted file mode 100644 index b7ed8666325..00000000000 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ /dev/null @@ -1,916 +0,0 @@ -/** -* $Id$ -* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** -* Start up of the Blender Player on GHOST. -*/ - -#include -#include - -#ifdef __linux__ -#ifdef __alpha__ -#include -#endif /* __alpha__ */ -#endif /* __linux__ */ - -#ifdef __APPLE__ -// Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh) -//#include -//#include -#endif // __APPLE__ -#include "GEN_messaging.h" -#include "KX_KetsjiEngine.h" -#include "KX_PythonInit.h" - -/********************************** -* Begin Blender include block -**********************************/ -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus -#include "MEM_guardedalloc.h" -#include "BKE_blender.h" -#include "BKE_global.h" -#include "BKE_icons.h" -#include "BKE_node.h" -#include "BKE_report.h" -#include "BLI_blenlib.h" -#include "DNA_scene_types.h" -#include "DNA_userdef_types.h" -#include "BLO_readfile.h" -#include "BLO_readblenfile.h" -#include "IMB_imbuf.h" -#include "BKE_text.h" - - int GHOST_HACK_getFirstFile(char buf[]); - -extern char bprogname[]; /* holds a copy of argv[0], from creator.c */ -extern char btempdir[]; /* use this to store a valid temp directory */ - -#ifdef __cplusplus -} -#endif // __cplusplus - -#include "GPU_draw.h" - -/********************************** -* End Blender include block -**********************************/ - -#include "SYS_System.h" -#include "GPG_Application.h" - -#include "GHOST_ISystem.h" -#include "RAS_IRasterizer.h" - -#include "BKE_main.h" -#include "BKE_utildefines.h" - -#include "RNA_define.h" - -#ifdef WIN32 -#include -#ifdef NDEBUG -#include -#endif // NDEBUG -#endif // WIN32 - -const int kMinWindowWidth = 100; -const int kMinWindowHeight = 100; - -char bprogname[FILE_MAXDIR+FILE_MAXFILE]; - -#ifdef WIN32 -typedef enum -{ - SCREEN_SAVER_MODE_NONE = 0, - SCREEN_SAVER_MODE_PREVIEW, - SCREEN_SAVER_MODE_SAVER, - SCREEN_SAVER_MODE_CONFIGURATION, - SCREEN_SAVER_MODE_PASSWORD, -} ScreenSaverMode; - -static ScreenSaverMode scr_saver_mode = SCREEN_SAVER_MODE_NONE; -static HWND scr_saver_hwnd = NULL; - -static BOOL scr_saver_init(int argc, char **argv) -{ - scr_saver_mode = SCREEN_SAVER_MODE_NONE; - scr_saver_hwnd = NULL; - BOOL ret = FALSE; - - int len = ::strlen(argv[0]); - if (len > 4 && !::stricmp(".scr", argv[0] + len - 4)) - { - scr_saver_mode = SCREEN_SAVER_MODE_CONFIGURATION; - ret = TRUE; - if (argc >= 2) - { - if (argc >= 3) - { - scr_saver_hwnd = (HWND) ::atoi(argv[2]); - } - if (!::stricmp("/c", argv[1])) - { - scr_saver_mode = SCREEN_SAVER_MODE_CONFIGURATION; - if (scr_saver_hwnd == NULL) - scr_saver_hwnd = ::GetForegroundWindow(); - } - else if (!::stricmp("/s", argv[1])) - { - scr_saver_mode = SCREEN_SAVER_MODE_SAVER; - } - else if (!::stricmp("/a", argv[1])) - { - scr_saver_mode = SCREEN_SAVER_MODE_PASSWORD; - } - else if (!::stricmp("/p", argv[1]) - || !::stricmp("/l", argv[1])) - { - scr_saver_mode = SCREEN_SAVER_MODE_PREVIEW; - } - } - } - return ret; -} - -#endif /* WIN32 */ - -void usage(const char* program) -{ - const char * consoleoption; -#ifdef _WIN32 - consoleoption = "-c "; -#else - consoleoption = ""; -#endif - - printf("usage: %s [-w [w h l t]] [-f [fw fh fb ff]] %s[-g gamengineoptions] " - "[-s stereomode] filename.blend\n", program, consoleoption); - printf(" -h: Prints this command summary\n\n"); - printf(" -w: display in a window\n"); - printf(" --Optional parameters--\n"); - printf(" w = window width\n"); - printf(" h = window height\n\n"); - printf(" l = window left coordinate\n"); - printf(" t = window top coordinate\n"); - printf(" Note: If w or h is defined, both must be defined.\n"); - printf(" Also, if l or t is defined, all options must be used.\n\n"); - printf(" -f: start game in full screen mode\n"); - printf(" --Optional parameters--\n"); - printf(" fw = full screen mode pixel width\n"); - printf(" fh = full screen mode pixel height\n\n"); - printf(" fb = full screen mode bits per pixel\n"); - printf(" ff = full screen mode frequency\n"); - printf(" Note: If fw or fh is defined, both must be defined.\n"); - printf(" Also, if fb is used, fw and fh must be used. ff requires all options.\n\n"); - printf(" -s: start player in stereo\n"); - printf(" stereomode: hwpageflip (Quad buffered shutter glasses)\n"); - printf(" syncdoubling (Above Below)\n"); - printf(" sidebyside (Left Right)\n"); - printf(" anaglyph (Red-Blue glasses)\n"); - printf(" vinterlace (Vertical interlace for autostereo display)\n"); - printf(" depending on the type of stereo you want\n\n"); - printf(" -D: start player in dome mode\n"); - printf(" --Optional parameters--\n"); - printf(" angle = field of view in degrees\n"); - printf(" tilt = tilt angle in degrees\n"); - printf(" warpdata = a file to use for warping the image (absolute path)\n"); - printf(" mode: fisheye (Fisheye)\n"); - printf(" truncatedfront (Front-Truncated)\n"); - printf(" truncatedrear (Rear-Truncated)\n"); - printf(" cubemap (Cube Map)\n"); - printf(" sphericalpanoramic (Spherical Panoramic)\n"); - printf(" depending on the type of dome you are using\n\n"); -#ifndef _WIN32 - printf(" -i: parent windows ID \n\n"); -#endif -#ifdef _WIN32 - printf(" -c: keep console window open\n\n"); -#endif - printf(" -d: turn debugging on\n\n"); - printf(" -g: game engine options:\n\n"); - printf(" Name Default Description\n"); - printf(" ------------------------------------------------------------------------\n"); - printf(" fixedtime 0 \"Enable all frames\"\n"); - printf(" nomipmap 0 Disable mipmaps\n"); - printf(" show_framerate 0 Show the frame rate\n"); - printf(" show_properties 0 Show debug properties\n"); - printf(" show_profile 0 Show profiling information\n"); - printf(" blender_material 0 Enable material settings\n"); - printf(" ignore_deprecation_warnings 1 Ignore deprecation warnings\n"); - printf("\n"); - printf(" - : all arguments after this are ignored, allowing python to access them from sys.argv\n"); - printf("\n"); - printf("example: %s -w 320 200 10 10 -g noaudio c:\\loadtest.blend\n", program); - printf("example: %s -g show_framerate = 0 c:\\loadtest.blend\n", program); -} - -static void get_filename(int argc, char **argv, char *filename) -{ -#ifdef __APPLE__ -/* On Mac we park the game file (called game.blend) in the application bundle. -* The executable is located in the bundle as well. -* Therefore, we can locate the game relative to the executable. - */ - int srclen = ::strlen(argv[0]); - int len = 0; - char *gamefile = NULL; - - filename[0] = '\0'; - - if (argc > 1) { - if (BLI_exists(argv[argc-1])) { - BLI_strncpy(filename, argv[argc-1], FILE_MAXDIR + FILE_MAXFILE); - } - if (::strncmp(argv[argc-1], "-psn_", 5)==0) { - static char firstfilebuf[512]; - if (GHOST_HACK_getFirstFile(firstfilebuf)) { - BLI_strncpy(filename, firstfilebuf, FILE_MAXDIR + FILE_MAXFILE); - } - } - } - - srclen -= ::strlen("MacOS/blenderplayer"); - if (srclen > 0) { - len = srclen + ::strlen("Resources/game.blend"); - gamefile = new char [len + 1]; - ::strcpy(gamefile, argv[0]); - ::strcpy(gamefile + srclen, "Resources/game.blend"); - //::printf("looking for file: %s\n", filename); - - if (BLI_exists(gamefile)) - BLI_strncpy(filename, gamefile, FILE_MAXDIR + FILE_MAXFILE); - - delete [] gamefile; - } - -#else - filename[0] = '\0'; - - if(argc > 1) - BLI_strncpy(filename, argv[argc-1], FILE_MAXDIR + FILE_MAXFILE); -#endif // !_APPLE -} - -static BlendFileData *load_game_data(char *progname, char *filename = NULL, char *relativename = NULL) -{ - ReportList reports; - BlendFileData *bfd = NULL; - - BKE_reports_init(&reports, RPT_STORE); - - /* try to load ourself, will only work if we are a runtime */ - if (blo_is_a_runtime(progname)) { - bfd= blo_read_runtime(progname, &reports); - if (bfd) { - bfd->type= BLENFILETYPE_RUNTIME; - strcpy(bfd->main->name, progname); - } - } else { - bfd= BLO_read_from_file(progname, &reports); - } - - if (!bfd && filename) { - bfd = load_game_data(filename); - if (!bfd) { - printf("Loading %s failed: ", filename); - BKE_reports_print(&reports, RPT_ERROR); - } - } - - BKE_reports_clear(&reports); - - return bfd; -} - -int main(int argc, char** argv) -{ - int i; - int argc_py_clamped= argc; /* use this so python args can be added after ' - ' */ - bool error = false; - SYS_SystemHandle syshandle = SYS_GetSystem(); - bool fullScreen = false; - bool fullScreenParFound = false; - bool windowParFound = false; - bool closeConsole = true; - RAS_IRasterizer::StereoMode stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; - bool stereoWindow = false; - bool stereoParFound = false; - int stereoFlag = STEREO_NOSTEREO; - int domeFov = -1; - int domeTilt = -200; - int domeMode = 0; - char* domeWarp = NULL; - Text *domeText = NULL; - int windowLeft = 100; - int windowTop = 100; - int windowWidth = 640; - int windowHeight = 480; - GHOST_TUns32 fullScreenWidth = 0; - GHOST_TUns32 fullScreenHeight= 0; - int fullScreenBpp = 32; - int fullScreenFrequency = 60; - GHOST_TEmbedderWindowID parentWindow = 0; - - - -#ifdef __linux__ -#ifdef __alpha__ - signal (SIGFPE, SIG_IGN); -#endif /* __alpha__ */ -#endif /* __linux__ */ - BLI_where_am_i(bprogname, argv[0]); -#ifdef __APPLE__ - // Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh) - /* - IBNibRef nibRef; - WindowRef window; - OSStatus err; - - // Create a Nib reference passing the name of the nib file (without the .nib extension) - // CreateNibReference only searches into the application bundle. - err = ::CreateNibReference(CFSTR("main"), &nibRef); - if (err) return -1; - - // Once the nib reference is created, set the menu bar. "MainMenu" is the name of the menu bar - // object. This name is set in InterfaceBuilder when the nib is created. - err = ::SetMenuBarFromNib(nibRef, CFSTR("MenuBar")); - if (err) return -1; - - // We don't need the nib reference anymore. - ::DisposeNibReference(nibRef); - */ -#endif // __APPLE__ - - RNA_init(); - - init_nodesystem(); - - initglobals(); - - GEN_init_messaging_system(); - - IMB_init(); - - // Parse command line options -#ifndef NDEBUG - printf("argv[0] = '%s'\n", argv[0]); -#endif - -#ifdef WIN32 - if (scr_saver_init(argc, argv)) - { - switch (scr_saver_mode) - { - case SCREEN_SAVER_MODE_CONFIGURATION: - MessageBox(scr_saver_hwnd, "This screen saver has no options that you can set", "Screen Saver", MB_OK); - break; - case SCREEN_SAVER_MODE_PASSWORD: - /* This is W95 only, which we currently do not support. - Fall-back to normal screen saver behaviour in that case... */ - case SCREEN_SAVER_MODE_SAVER: - fullScreen = true; - fullScreenParFound = true; - break; - - case SCREEN_SAVER_MODE_PREVIEW: - /* This will actually be handled somewhere below... */ - break; - } - } -#endif - // XXX add the ability to change this values to the command line parsing. - U.mixbufsize = 2048; - U.audiodevice = 2; - U.audiorate = 44100; - U.audioformat = 0x24; - U.audiochannels = 2; - - for (i = 1; (i < argc) && !error -#ifdef WIN32 - && scr_saver_mode == SCREEN_SAVER_MODE_NONE -#endif - ;) - - { -#ifndef NDEBUG - printf("argv[%d] = '%s' , %i\n", i, argv[i],argc); -#endif - if (argv[i][0] == '-') - { - /* ignore all args after " - ", allow python to have own args */ - if (argv[i][1]=='\0') { - argc_py_clamped= i; - break; - } - - switch (argv[i][1]) - { - case 'g': - // Parse game options - { - i++; - if (i < argc) - { - char* paramname = argv[i]; - // Check for single value versus assignment - if (i+1 < argc && (*(argv[i+1]) == '=')) - { - i++; - if (i + 1 < argc) - { - i++; - // Assignment - SYS_WriteCommandLineInt(syshandle, paramname, atoi(argv[i])); - SYS_WriteCommandLineFloat(syshandle, paramname, atof(argv[i])); - SYS_WriteCommandLineString(syshandle, paramname, argv[i]); -#ifndef NDEBUG - printf("%s = '%s'\n", paramname, argv[i]); -#endif - i++; - } - else - { - error = true; - printf("error: argument assignment %s without value.\n", paramname); - } - } - else - { -// SYS_WriteCommandLineInt(syshandle, argv[i++], 1); - } - } - } - break; - - case 'd': - i++; - G.f |= G_DEBUG; /* std output printf's */ - MEM_set_memory_debug(); - break; - - case 'f': - i++; - fullScreen = true; - fullScreenParFound = true; - if ((i + 2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-') - { - fullScreenWidth = atoi(argv[i++]); - fullScreenHeight = atoi(argv[i++]); - if ((i + 1) <= argc && argv[i][0] != '-') - { - fullScreenBpp = atoi(argv[i++]); - if ((i + 1) <= argc && argv[i][0] != '-') - fullScreenFrequency = atoi(argv[i++]); - } - } - break; - case 'w': - // Parse window position and size options - i++; - fullScreen = false; - windowParFound = true; - - if ((i + 2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-') - { - windowWidth = atoi(argv[i++]); - windowHeight = atoi(argv[i++]); - if ((i +2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-') - { - windowLeft = atoi(argv[i++]); - windowTop = atoi(argv[i++]); - } - } - break; - - case 'h': - usage(argv[0]); - return 0; - break; -#ifndef _WIN32 - case 'i': - i++; - if ( (i + 1) < argc ) - parentWindow = atoi(argv[i++]); -#ifndef NDEBUG - printf("XWindows ID = %d\n", parentWindow); -#endif //NDEBUG - -#endif // _WIN32 - case 'c': - i++; - closeConsole = false; - break; - case 's': // stereo - i++; - if ((i + 1) < argc) - { - stereomode = (RAS_IRasterizer::StereoMode) atoi(argv[i]); - if (stereomode < RAS_IRasterizer::RAS_STEREO_NOSTEREO || stereomode >= RAS_IRasterizer::RAS_STEREO_MAXSTEREO) - stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; - - if(!strcmp(argv[i], "nostereo")) // ok, redundant but clear - stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; - - // only the hardware pageflip method needs a stereo window - else if(!strcmp(argv[i], "hwpageflip")) { - stereomode = RAS_IRasterizer::RAS_STEREO_QUADBUFFERED; - stereoWindow = true; - } - else if(!strcmp(argv[i], "syncdoubling")) - stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW; - - else if(!strcmp(argv[i], "anaglyph")) - stereomode = RAS_IRasterizer::RAS_STEREO_ANAGLYPH; - - else if(!strcmp(argv[i], "sidebyside")) - stereomode = RAS_IRasterizer::RAS_STEREO_SIDEBYSIDE; - - else if(!strcmp(argv[i], "vinterlace")) - stereomode = RAS_IRasterizer::RAS_STEREO_VINTERLACE; - -#if 0 - // future stuff - else if(!strcmp(argv[i], "stencil") - stereomode = RAS_STEREO_STENCIL; -#endif - - i++; - stereoParFound = true; - stereoFlag = STEREO_ENABLED; - } - else - { - error = true; - printf("error: too few options for stereo argument.\n"); - } - break; - case 'D': - stereoFlag = STEREO_DOME; - stereomode = RAS_IRasterizer::RAS_STEREO_DOME; - i++; - if ((i + 1) < argc) - { - if(!strcmp(argv[i], "angle")){ - i++; - domeFov = atoi(argv[i++]); - } - if(!strcmp(argv[i], "tilt")){ - i++; - domeTilt = atoi(argv[i++]); - } - if(!strcmp(argv[i], "warpdata")){ - i++; - domeWarp = argv[i++]; - } - if(!strcmp(argv[i], "mode")){ - i++; - if(!strcmp(argv[i], "fisheye")) - domeMode = DOME_FISHEYE; - - else if(!strcmp(argv[i], "truncatedfront")) - domeMode = DOME_TRUNCATED_FRONT; - - else if(!strcmp(argv[i], "truncatedrear")) - domeMode = DOME_TRUNCATED_REAR; - - else if(!strcmp(argv[i], "cubemap")) - domeMode = DOME_ENVMAP; - - else if(!strcmp(argv[i], "sphericalpanoramic")) - domeMode = DOME_PANORAM_SPH; - - else - printf("error: %s is not a valid dome mode.\n", argv[i]); - } - i++; - } - break; - default: - printf("Unknown argument: %s\n", argv[i++]); - break; - } - } - else - { - i++; - } - } - - if ((windowWidth < kMinWindowWidth) || (windowHeight < kMinWindowHeight)) - { - error = true; - printf("error: window size too small.\n"); - } - - if (error ) - { - usage(argv[0]); - return 0; - } - -#ifdef WIN32 - if (scr_saver_mode != SCREEN_SAVER_MODE_CONFIGURATION) -#endif - { -#ifdef __APPLE__ - //SYS_WriteCommandLineInt(syshandle, "show_framerate", 1); - //SYS_WriteCommandLineInt(syshandle, "nomipmap", 1); - //fullScreen = false; // Can't use full screen -#endif - - if (SYS_GetCommandLineInt(syshandle, "nomipmap", 0)) - { - GPU_set_mipmap(0); - } - - // Create the system - if (GHOST_ISystem::createSystem() == GHOST_kSuccess) - { - GHOST_ISystem* system = GHOST_ISystem::getSystem(); - assertd(system); - - if (!fullScreenWidth || !fullScreenHeight) - system->getMainDisplayDimensions(fullScreenWidth, fullScreenHeight); - // process first batch of events. If the user - // drops a file on top off the blenderplayer icon, we - // recieve an event with the filename - - system->processEvents(0); - - // this bracket is needed for app (see below) to get out - // of scope before GHOST_ISystem::disposeSystem() is called. - { - int exitcode = KX_EXIT_REQUEST_NO_REQUEST; - STR_String exitstring = ""; - GPG_Application app(system); - bool firstTimeRunning = true; - char filename[FILE_MAXDIR + FILE_MAXFILE]; - char pathname[FILE_MAXDIR + FILE_MAXFILE]; - char *titlename; - - get_filename(argc_py_clamped, argv, filename); - if(filename[0]) - BLI_path_cwd(filename); - - do - { - // Read the Blender file - BlendFileData *bfd; - - // if we got an exitcode 3 (KX_EXIT_REQUEST_START_OTHER_GAME) load a different file - if (exitcode == KX_EXIT_REQUEST_START_OTHER_GAME) - { - char basedpath[240]; - - // base the actuator filename relative to the last file - strcpy(basedpath, exitstring.Ptr()); - BLI_path_abs(basedpath, pathname); - - bfd = load_game_data(basedpath); - - if (!bfd) - { - // just add "//" in front of it - char temppath[242]; - strcpy(temppath, "//"); - strcat(temppath, basedpath); - - BLI_path_abs(temppath, pathname); - bfd = load_game_data(temppath); - } - } - else - { - bfd = load_game_data(bprogname, filename[0]? filename: NULL); - } - - //::printf("game data loaded from %s\n", filename); - - if (!bfd) { - usage(argv[0]); - error = true; - exitcode = KX_EXIT_REQUEST_QUIT_GAME; - } - else - { -#ifdef WIN32 -#ifdef NDEBUG - if (closeConsole) - { - //::FreeConsole(); // Close a console window - } -#endif // NDEBUG -#endif // WIN32 - Main *maggie = bfd->main; - Scene *scene = bfd->curscene; - G.main = maggie; - - if (firstTimeRunning) - G.fileflags = bfd->fileflags; - - //Seg Fault; icon.c gIcons == 0 - BKE_icons_init(1); - - titlename = maggie->name; - - // Check whether the game should be displayed full-screen - if ((!fullScreenParFound) && (!windowParFound)) - { - // Only use file settings when command line did not override - if (scene->gm.fullscreen) { - //printf("fullscreen option found in Blender file\n"); - fullScreen = true; - fullScreenWidth= scene->gm.xplay; - fullScreenHeight= scene->gm.yplay; - fullScreenFrequency= scene->gm.freqplay; - fullScreenBpp = scene->gm.depth; - } - else - { - fullScreen = false; - windowWidth = scene->gm.xplay; - windowHeight = scene->gm.yplay; - } - } - - - // Check whether the game should be displayed in stereo - if (!stereoParFound) - { - if(scene->gm.stereoflag == STEREO_ENABLED){ - stereomode = (RAS_IRasterizer::StereoMode) scene->gm.stereomode; - if (stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) - stereoWindow = true; - } - } - else - scene->gm.stereoflag = STEREO_ENABLED; - - if (stereoFlag == STEREO_DOME){ - stereomode = RAS_IRasterizer::RAS_STEREO_DOME; - scene->gm.stereoflag = STEREO_DOME; - if (domeFov > 89) - scene->gm.dome.angle = domeFov; - if (domeTilt > -180) - scene->gm.dome.tilt = domeTilt; - if (domeMode > 0) - scene->gm.dome.mode = domeMode; - if (domeWarp) - { - //XXX to do: convert relative to absolute path - domeText= add_text(domeWarp, ""); - if(!domeText) - printf("error: invalid warpdata text file - %s\n", domeWarp); - else - scene->gm.dome.warptext = domeText; - } - } - - // GPG_Application app (system, maggie, startscenename); - app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */ - - BLI_strncpy(pathname, maggie->name, sizeof(pathname)); - BLI_strncpy(G.sce, maggie->name, sizeof(G.sce)); - setGamePythonPath(G.sce); - - if (firstTimeRunning) - { - firstTimeRunning = false; - - if (fullScreen) - { -#ifdef WIN32 - if (scr_saver_mode == SCREEN_SAVER_MODE_SAVER) - { - app.startScreenSaverFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency, - stereoWindow, stereomode); - } - else -#endif - { - app.startFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency, - stereoWindow, stereomode); - } - } - else - { -#ifdef __APPLE__ - // on Mac's we'll show the executable name instead of the 'game.blend' name - char tempname[1024], *appstring; - ::strcpy(tempname, titlename); - - appstring = strstr(tempname, ".app/"); - if (appstring) { - appstring[2] = 0; - titlename = &tempname[0]; - } -#endif - // Strip the path so that we have the name of the game file - STR_String path = titlename; -#ifndef WIN32 - vector parts = path.Explode('/'); -#else // WIN32 - vector parts = path.Explode('\\'); -#endif // WIN32 - STR_String title; - if (parts.size()) - { - title = parts[parts.size()-1]; - parts = title.Explode('.'); - if (parts.size() > 1) - { - title = parts[0]; - } - } - else - { - title = "blenderplayer"; - } -#ifdef WIN32 - if (scr_saver_mode == SCREEN_SAVER_MODE_PREVIEW) - { - app.startScreenSaverPreview(scr_saver_hwnd, stereoWindow, stereomode); - } - else -#endif - { - if (parentWindow != 0) - app.startEmbeddedWindow(title, parentWindow, stereoWindow, stereomode); - else - app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight, - stereoWindow, stereomode); - } - } - } - else - { - app.StartGameEngine(stereomode); - exitcode = KX_EXIT_REQUEST_NO_REQUEST; - } - - // Add the application as event consumer - system->addEventConsumer(&app); - - // Enter main loop - bool run = true; - while (run) - { - system->processEvents(false); - system->dispatchEvents(); - if ((exitcode = app.getExitRequested())) - { - run = false; - exitstring = app.getExitString(); - } - } - app.StopGameEngine(); - - BLO_blendfiledata_free(bfd); - } - } while (exitcode == KX_EXIT_REQUEST_RESTART_GAME || exitcode == KX_EXIT_REQUEST_START_OTHER_GAME); - } - - // Seg Fault; icon.c gIcons == 0 - BKE_icons_free(); - - // Dispose the system - GHOST_ISystem::disposeSystem(); - } else { - error = true; - printf("error: couldn't create a system.\n"); - } - } - - free_nodesystem(); - - return error ? -1 : 0; -} - - diff --git a/source/gameengine/GamePlayer/ghost/Makefile b/source/gameengine/GamePlayer/ghost/Makefile deleted file mode 100644 index a7fcf46b695..00000000000 --- a/source/gameengine/GamePlayer/ghost/Makefile +++ /dev/null @@ -1,86 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# Makefile for GHOST game player - -LIBNAME = ghost -DIR = $(OCGDIR)/gameengine/GamePlayer/ghost - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -# OpenGL header files -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(OPENGL_HEADERS) -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include - -CPPFLAGS += -I../../GamePlayer/common - -# Game Engine includes -CPPFLAGS += -I../../Converter -CPPFLAGS += -I../../Expressions -CPPFLAGS += -I../../GameLogic -CPPFLAGS += -I../../Ketsji -CPPFLAGS += -I../../Ketsji/KXNetwork -CPPFLAGS += -I../../Network -CPPFLAGS += -I../../Network/LoopBackNetwork -CPPFLAGS += -I../../Rasterizer -CPPFLAGS += -I../../Rasterizer/RAS_OpenGLRasterizer -CPPFLAGS += -I../../SceneGraph - -# Sumo -CPPFLAGS += -I$(SRCHOME)/gameengine/Physics/Sumo/include -CPPFLAGS += -I$(SRCHOME)/gameengine/Physics/Sumo/Fuzzics/include - -CPPFLAGS += -I$(NAN_MOTO)/include - -# Blender includes -CPPFLAGS += -I../../../blender/blenkernel -CPPFLAGS += -I../../../blender/blenlib -CPPFLAGS += -I../../../blender/blenloader -CPPFLAGS += -I../../../blender/imbuf -CPPFLAGS += -I../../../blender/makesdna -CPPFLAGS += -I../../../blender/makesrna -CPPFLAGS += -I../../../blender/readblenfile -CPPFLAGS += -I../../../blender/gpu - -CPPFLAGS += -I../../../gameengine/BlenderRoutines - -# kernel? GEN? stuff -CPPFLAGS += -I../../../kernel/gen_system -CPPFLAGS += -I../../../kernel/gen_messaging - -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_GHOST)/include -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) - -ifeq ($(WITH_FFMPEG), true) - CPPFLAGS += -DWITH_FFMPEG -endif diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript deleted file mode 100644 index 2269b6400e3..00000000000 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/python -import sys -Import ('env') - -source_files = ['GPG_Application.cpp', - 'GPG_Canvas.cpp', - 'GPG_ghost.cpp', - 'GPG_KeyboardDevice.cpp', - 'GPG_System.cpp'] - -incs = ['.', - '#intern/string', - '#intern/ghost', - '#intern/guardedalloc', - '#intern/moto/include', - '#source/gameengine/Rasterizer/RAS_OpenGLRasterizer', - '#source/kernel/gen_system', - '#source/kernel/gen_messaging', - '#source/gameengine/Converter', - '#source/blender/imbuf', - '#source/gameengine/Ketsji', - '#source/blender/blenlib', - '#source/blender/blenkernel', - '#source/blender/readblenfile', - '#source/blender', - '#source/blender/include', - '#source/blender/makesdna', - '#source/blender/makesrna', - '#source/gameengine/BlenderRoutines', - '#source/gameengine/Rasterizer', - '#source/gameengine/GameLogic', - '#source/gameengine/Expressions', - '#source/gameengine/Network', - '#source/gameengine/SceneGraph', - '#source/gameengine/Physics/common', - '#source/gameengine/Network/LoopBackNetwork', - '#source/gameengine/GamePlayer/common', - '#source/blender/misc', - '#source/blender/blenloader', - '#source/blender/gpu', - '#extern/glew/include'] - -defs = [ 'GLEW_STATIC' ] - -if env['WITH_BF_PYTHON']: - incs += Split(env['BF_PYTHON_INC']) -else: - defs.append('DISABLE_PYTHON') - -if env['WITH_BF_FFMPEG']: - defs.append('WITH_FFMPEG') - -env.BlenderLib (libname='gp_ghost', sources=source_files, includes = incs, defines = defs, libtype=['player'],priority=[0], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Ketsji/BL_BlenderShader.cpp b/source/gameengine/Ketsji/BL_BlenderShader.cpp deleted file mode 100644 index 109a693ec6d..00000000000 --- a/source/gameengine/Ketsji/BL_BlenderShader.cpp +++ /dev/null @@ -1,162 +0,0 @@ - -#include "DNA_customdata_types.h" -#include "DNA_material_types.h" -#include "DNA_scene_types.h" - -#include "BKE_global.h" -#include "BKE_main.h" - -#include "BL_BlenderShader.h" -#include "BL_Material.h" - -#include "GPU_extensions.h" -#include "GPU_material.h" - -#include "RAS_BucketManager.h" -#include "RAS_MeshObject.h" -#include "RAS_IRasterizer.h" - -BL_BlenderShader::BL_BlenderShader(KX_Scene *scene, struct Material *ma, int lightlayer) -: - mScene(scene), - mMat(ma), - mLightLayer(lightlayer), - mGPUMat(NULL) -{ - mBlenderScene = scene->GetBlenderScene(); - mBlendMode = GPU_BLEND_SOLID; - - ReloadMaterial(); -} - -BL_BlenderShader::~BL_BlenderShader() -{ - if(mGPUMat) - GPU_material_unbind(mGPUMat); -} - -void BL_BlenderShader::ReloadMaterial() -{ - mGPUMat = (mMat) ? GPU_material_from_blender(mBlenderScene, mMat) : NULL; -} - -void BL_BlenderShader::SetProg(bool enable, double time) -{ - if(VerifyShader()) { - if(enable) - GPU_material_bind(mGPUMat, mLightLayer, mBlenderScene->lay, time, 1); - else - GPU_material_unbind(mGPUMat); - } -} - -int BL_BlenderShader::GetAttribNum() -{ - GPUVertexAttribs attribs; - int i, enabled = 0; - - if(!VerifyShader()) - return enabled; - - GPU_material_vertex_attributes(mGPUMat, &attribs); - - for(i = 0; i < attribs.totlayer; i++) - if(attribs.layer[i].glindex+1 > enabled) - enabled= attribs.layer[i].glindex+1; - - if(enabled > BL_MAX_ATTRIB) - enabled = BL_MAX_ATTRIB; - - return enabled; -} - -void BL_BlenderShader::SetAttribs(RAS_IRasterizer* ras, const BL_Material *mat) -{ - GPUVertexAttribs attribs; - GPUMaterial *gpumat; - int i, attrib_num; - - ras->SetAttribNum(0); - - if(!VerifyShader()) - return; - - gpumat = mGPUMat; - - if(ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) { - GPU_material_vertex_attributes(gpumat, &attribs); - attrib_num = GetAttribNum(); - - ras->SetTexCoordNum(0); - ras->SetAttribNum(attrib_num); - for(i=0; iSetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, i); - - for(i = 0; i < attribs.totlayer; i++) { - if(attribs.layer[i].glindex > attrib_num) - continue; - - if(attribs.layer[i].type == CD_MTFACE) { - if(!mat->uvName.IsEmpty() && strcmp(mat->uvName.ReadPtr(), attribs.layer[i].name) == 0) - ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV1, attribs.layer[i].glindex); - else if(!mat->uv2Name.IsEmpty() && strcmp(mat->uv2Name.ReadPtr(), attribs.layer[i].name) == 0) - ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV2, attribs.layer[i].glindex); - else - ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV1, attribs.layer[i].glindex); - } - else if(attribs.layer[i].type == CD_TANGENT) - ras->SetAttrib(RAS_IRasterizer::RAS_TEXTANGENT, attribs.layer[i].glindex); - else if(attribs.layer[i].type == CD_ORCO) - ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_ORCO, attribs.layer[i].glindex); - else if(attribs.layer[i].type == CD_NORMAL) - ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_NORM, attribs.layer[i].glindex); - else if(attribs.layer[i].type == CD_MCOL) - ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_VCOL, attribs.layer[i].glindex); - else - ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, attribs.layer[i].glindex); - } - } -} - -void BL_BlenderShader::Update(const RAS_MeshSlot & ms, RAS_IRasterizer* rasty ) -{ - float obmat[4][4], viewmat[4][4], viewinvmat[4][4], obcol[4]; - GPUMaterial *gpumat; - - gpumat = mGPUMat; - - if(!gpumat || !GPU_material_bound(gpumat)) - return; - - MT_Matrix4x4 model; - model.setValue(ms.m_OpenGLMatrix); - const MT_Matrix4x4& view = rasty->GetViewMatrix(); - const MT_Matrix4x4& viewinv = rasty->GetViewInvMatrix(); - - // note: getValue gives back column major as needed by OpenGL - model.getValue((float*)obmat); - view.getValue((float*)viewmat); - viewinv.getValue((float*)viewinvmat); - - if(ms.m_bObjectColor) - ms.m_RGBAcolor.getValue((float*)obcol); - else - obcol[0]= obcol[1]= obcol[2]= obcol[3]= 1.0f; - - GPU_material_bind_uniforms(gpumat, obmat, viewmat, viewinvmat, obcol); - - mBlendMode = GPU_material_blend_mode(gpumat, obcol); -} - -int BL_BlenderShader::GetBlendMode() -{ - return mBlendMode; -} - -bool BL_BlenderShader::Equals(BL_BlenderShader *blshader) -{ - /* to avoid unneeded state switches */ - return (blshader && mMat == blshader->mMat && mLightLayer == blshader->mLightLayer); -} - -// eof diff --git a/source/gameengine/Ketsji/BL_BlenderShader.h b/source/gameengine/Ketsji/BL_BlenderShader.h deleted file mode 100644 index 073ce8f1ca5..00000000000 --- a/source/gameengine/Ketsji/BL_BlenderShader.h +++ /dev/null @@ -1,69 +0,0 @@ - -#ifndef __BL_GPUSHADER_H__ -#define __BL_GPUSHADER_H__ - -#include "GPU_material.h" - -#include "MT_Matrix4x4.h" -#include "MT_Matrix3x3.h" -#include "MT_Tuple2.h" -#include "MT_Tuple3.h" -#include "MT_Tuple4.h" - -#include "RAS_IPolygonMaterial.h" - -#include "KX_Scene.h" - -struct Material; -struct Scene; -class BL_Material; - -#define BL_MAX_ATTRIB 16 - -/** - * BL_BlenderShader - * Blender GPU shader material - */ -class BL_BlenderShader -{ -private: - KX_Scene *mScene; - struct Scene *mBlenderScene; - struct Material *mMat; - int mLightLayer; - int mBlendMode; - GPUMaterial *mGPUMat; - - bool VerifyShader() - { - return (NULL != mGPUMat); - } - -public: - BL_BlenderShader(KX_Scene *scene, struct Material *ma, int lightlayer); - virtual ~BL_BlenderShader(); - - bool Ok() - { - // same as VerifyShared - return (NULL != mGPUMat); - } - void SetProg(bool enable, double time=0.0); - - int GetAttribNum(); - void SetAttribs(class RAS_IRasterizer* ras, const BL_Material *mat); - void Update(const class RAS_MeshSlot & ms, class RAS_IRasterizer* rasty); - void ReloadMaterial(); - int GetBlendMode(); - - bool Equals(BL_BlenderShader *blshader); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_BlenderShader"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif//__BL_GPUSHADER_H__ diff --git a/source/gameengine/Ketsji/BL_Material.cpp b/source/gameengine/Ketsji/BL_Material.cpp deleted file mode 100644 index c63b9d55306..00000000000 --- a/source/gameengine/Ketsji/BL_Material.cpp +++ /dev/null @@ -1,160 +0,0 @@ -// ------------------------------------ -#include "BL_Material.h" -#include "DNA_material_types.h" -#include "DNA_texture_types.h" -#include "DNA_image_types.h" -#include "DNA_mesh_types.h" -#include "IMB_imbuf_types.h" -#include "IMB_imbuf.h" - -MTex* getImageFromMaterial(Material *mat, int index) -{ - if(!mat) return 0; - - if(!(index >=0 && index < MAX_MTEX) ) return 0; - - MTex *m = mat->mtex[index]; - return m?m:0; -} - -int getNumTexChannels( Material *mat ) -{ - int count = -1; - if(!mat) return -1; - - for(count =0; (count < 10) && mat->mtex[count] != 0; count++) {} - return count; -} - -BL_Material::BL_Material() -{ - Initialize(); -} - -void BL_Material::Initialize() -{ - rgb[0] = 0; - rgb[1] = 0; - rgb[2] = 0; - rgb[3] = 0; - IdMode = 0; - ras_mode = 0; - glslmat = 0; - tile = 0; - matname = "NoMaterial"; - matcolor[0] = 0.5f; - matcolor[1] = 0.5f; - matcolor[2] = 0.5f; - matcolor[3] = 0.5f; - speccolor[0] = 1.f; - speccolor[1] = 1.f; - speccolor[2] = 1.f; - transp = 0; - hard = 50.f; - spec_f = 0.5f; - alpha = 1.f; - emit = 0.f; - mode = 0; - material = 0; - tface = 0; - materialindex = 0; - amb=0.5f; - num_enabled = 0; - num_users = 1; - share = false; - - int i; - for(i=0; i<4; i++) - { - uv[i] = MT_Point2(0.f,1.f); - uv2[i] = MT_Point2(0.f, 1.f); - } - - for(i=0; i 1 ) - share = true; - else - share = false; -} - -bool BL_Material::IsShared() -{ - return share; -} - -void BL_Material::SetUsers(int num) -{ - num_users = num; -} - diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h deleted file mode 100644 index 6b53e7fa8b1..00000000000 --- a/source/gameengine/Ketsji/BL_Material.h +++ /dev/null @@ -1,191 +0,0 @@ -#ifndef __BL_MATERIAL_H__ -#define __BL_MATERIAL_H__ - -#include "STR_String.h" -#include "MT_Point2.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -// -- -struct MTex; -struct Material; -struct Image; -struct MTFace; -struct MTex; -struct Material; -struct EnvMap; -// -- - -/** max units - this will default to users available units - to build with more available, just increment this value - although the more you add the slower the search time will be. - we will go for eight, which should be enough -*/ -#define MAXTEX 8 //match in RAS_TexVert & RAS_OpenGLRasterizer - -// different mapping modes -class BL_Mapping -{ -public: - int mapping; - float scale[3]; - float offsets[3]; - int projplane[3]; - STR_String objconame; - STR_String uvCoName; -}; - -// base material struct -class BL_Material -{ -private: - int num_users; - bool share; - -public: - // ----------------------------------- - BL_Material(); - void Initialize(); - - int IdMode; - unsigned int ras_mode; - bool glslmat; - - STR_String texname[MAXTEX]; - unsigned int flag[MAXTEX]; - int tile,tilexrep[MAXTEX],tileyrep[MAXTEX]; - STR_String matname; - STR_String mtexname[MAXTEX]; - int materialindex; - - float matcolor[4]; - float speccolor[3]; - short transp, pad; - - float hard, spec_f; - float alpha, emit, color_blend[MAXTEX], ref; - float amb; - - int blend_mode[MAXTEX]; - - int mode; - int num_enabled; - - BL_Mapping mapping[MAXTEX]; - STR_String imageId[MAXTEX]; - - - Material* material; - MTFace* tface; - Image* img[MAXTEX]; - EnvMap* cubemap[MAXTEX]; - - unsigned int rgb[4]; - MT_Point2 uv[4]; - MT_Point2 uv2[4]; - - STR_String uvName; - STR_String uv2Name; - - void SetConversionRGB(unsigned int *rgb); - void GetConversionRGB(unsigned int *rgb); - - void SetConversionUV(const STR_String& name, MT_Point2 *uv); - void GetConversionUV(MT_Point2 *uv); - - void SetConversionUV2(const STR_String& name, MT_Point2 *uv); - void GetConversionUV2(MT_Point2 *uv); - - void SetSharedMaterial(bool v); - bool IsShared(); - void SetUsers(int num); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Material"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -// BL_Material::IdMode -enum BL_IdMode { - DEFAULT_BLENDER=-1, - TEXFACE, - ONETEX, - TWOTEX, - GREATERTHAN2 -}; - -// BL_Material::blend_mode[index] -enum BL_BlendMode -{ - BLEND_MIX=1, - BLEND_ADD, - BLEND_SUB, - BLEND_MUL, - BLEND_SCR -}; - -// ------------------------------------- -// BL_Material::flag[index] -enum BL_flag -{ - MIPMAP=1, // set to use mipmaps - CALCALPHA=2, // additive - USEALPHA=4, // use actual alpha channel - TEXALPHA=8, // use alpha combiner functions - TEXNEG=16, // negate blending - HASIPO=32, - USENEGALPHA=64 -}; - -// BL_Material::ras_mode -enum BL_ras_mode -{ - POLY_VIS=1, - COLLIDER=2, - ZSORT=4, - ALPHA=8, - // TRIANGLE=16, - USE_LIGHT=32, - WIRE=64 -}; - -// ------------------------------------- -// BL_Material::mapping[index]::mapping -enum BL_MappingFlag -{ - USEENV =1, - // -- - USEREFL =2, - USEOBJ =4, - USENORM =8, - USEORCO =16, - USEUV =32, - USETANG =64, - DISABLE =128, - USECUSTOMUV=256 -}; - -// BL_Material::BL_Mapping::projplane -enum BL_MappingProj -{ - PROJN=0, - PROJX, - PROJY, - PROJZ -}; - -// ------------------------------------ -//extern void initBL_Material(BL_Material* mat); -extern MTex* getImageFromMaterial(Material *mat, int index); -extern int getNumTexChannels( Material *mat ); -// ------------------------------------ - -#endif - - diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp deleted file mode 100644 index 8edefe7ac2d..00000000000 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ /dev/null @@ -1,1416 +0,0 @@ - -#include "GL/glew.h" - -#include -#include "BL_Shader.h" -#include "BL_Material.h" - -#include "MT_assert.h" -#include "MT_Matrix4x4.h" -#include "MT_Matrix3x3.h" -#include "KX_PyMath.h" -#include "MEM_guardedalloc.h" - -#include "RAS_GLExtensionManager.h" -#include "RAS_MeshObject.h" -#include "RAS_IRasterizer.h" - -#define spit(x) std::cout << x << std::endl; - -#define SORT_UNIFORMS 1 -#define UNIFORM_MAX_LEN (int)sizeof(float)*16 -#define MAX_LOG_LEN 262144 // bounds - -BL_Uniform::BL_Uniform(int data_size) -: mLoc(-1), - mDirty(true), - mType(UNI_NONE), - mTranspose(0), - mDataLen(data_size) -{ -#ifdef SORT_UNIFORMS - MT_assert((int)mDataLen <= UNIFORM_MAX_LEN); - mData = (void*)MEM_mallocN(mDataLen, "shader-uniform-alloc"); -#endif -} - -BL_Uniform::~BL_Uniform() -{ -#ifdef SORT_UNIFORMS - if(mData) { - MEM_freeN(mData); - mData=0; - } -#endif -} - -void BL_Uniform::Apply(class BL_Shader *shader) -{ -#ifdef SORT_UNIFORMS - MT_assert(mType > UNI_NONE && mType < UNI_MAX && mData); - - if(!mDirty) - return; - - switch(mType) - { - case UNI_FLOAT: { - float *f = (float*)mData; - glUniform1fARB(mLoc,(GLfloat)*f); - }break; - case UNI_INT: { - int *f = (int*)mData; - glUniform1iARB(mLoc, (GLint)*f); - }break; - case UNI_FLOAT2: { - float *f = (float*)mData; - glUniform2fvARB(mLoc,1, (GLfloat*)f); - }break; - case UNI_FLOAT3: { - float *f = (float*)mData; - glUniform3fvARB(mLoc,1,(GLfloat*)f); - }break; - case UNI_FLOAT4: { - float *f = (float*)mData; - glUniform4fvARB(mLoc,1,(GLfloat*)f); - }break; - case UNI_INT2: { - int *f = (int*)mData; - glUniform2ivARB(mLoc,1,(GLint*)f); - }break; - case UNI_INT3: { - int *f = (int*)mData; - glUniform3ivARB(mLoc,1,(GLint*)f); - }break; - case UNI_INT4: { - int *f = (int*)mData; - glUniform4ivARB(mLoc,1,(GLint*)f); - }break; - case UNI_MAT4: { - float *f = (float*)mData; - glUniformMatrix4fvARB(mLoc, 1, mTranspose?GL_TRUE:GL_FALSE,(GLfloat*)f); - }break; - case UNI_MAT3: { - float *f = (float*)mData; - glUniformMatrix3fvARB(mLoc, 1, mTranspose?GL_TRUE:GL_FALSE,(GLfloat*)f); - }break; - } - mDirty = false; -#endif -} - -void BL_Uniform::SetData(int location, int type,bool transpose) -{ -#ifdef SORT_UNIFORMS - mType = type; - mLoc = location; - mDirty = true; -#endif -} - -bool BL_Shader::Ok()const -{ - return (mShader !=0 && mOk && mUse); -} - -BL_Shader::BL_Shader() -: PyObjectPlus(), - mShader(0), - mPass(1), - mOk(0), - mUse(0), - mAttr(0), - vertProg(""), - fragProg(""), - mError(0), - mDirty(true) -{ - // if !GLEW_ARB_shader_objects this class will not be used - //for (int i=0; iDeleteTex(); - // } - //} - ClearUniforms(); - - if( mShader ) { - glDeleteObjectARB(mShader); - mShader = 0; - } - vertProg = 0; - fragProg = 0; - mOk = 0; - glUseProgramObjectARB(0); -} - -void BL_Shader::ClearUniforms() -{ - BL_UniformVec::iterator it = mUniforms.begin(); - while(it != mUniforms.end()){ - delete (*it); - it++; - } - mUniforms.clear(); - - - BL_UniformVecDef::iterator itp = mPreDef.begin(); - while(itp != mPreDef.end()) { - delete (*itp); - itp++; - } - mPreDef.clear(); - -} - - -BL_Uniform *BL_Shader::FindUniform(const int location) -{ -#ifdef SORT_UNIFORMS - BL_UniformVec::iterator it = mUniforms.begin(); - while(it != mUniforms.end()) { - if((*it)->GetLocation() == location) - return (*it); - it++; - } -#endif - return 0; -} - -void BL_Shader::SetUniformfv(int location, int type, float *param,int size, bool transpose) -{ -#ifdef SORT_UNIFORMS - BL_Uniform *uni= FindUniform(location); - if(uni) { - memcpy(uni->getData(), param, size); - uni->SetData(location, type, transpose); - } - else { - uni = new BL_Uniform(size); - memcpy(uni->getData(), param, size); - - uni->SetData(location, type, transpose); - mUniforms.push_back(uni); - } - mDirty = true; -#endif -} - -void BL_Shader::SetUniformiv(int location, int type, int *param,int size, bool transpose) -{ -#ifdef SORT_UNIFORMS - BL_Uniform *uni= FindUniform(location); - if(uni) { - memcpy(uni->getData(), param, size); - uni->SetData(location, type, transpose); - } - else { - uni = new BL_Uniform(size); - memcpy(uni->getData(), param, size); - uni->SetData(location, type, transpose); - mUniforms.push_back(uni); - } - mDirty = true; -#endif -} - - -void BL_Shader::ApplyShader() -{ -#ifdef SORT_UNIFORMS - if(!mDirty) - return; - - for(unsigned int i=0; iApply(this); - - mDirty = false; -#endif -} - -void BL_Shader::UnloadShader() -{ - // -} - - -bool BL_Shader::LinkProgram() -{ - int vertlen = 0, fraglen=0, proglen=0; - int vertstatus=0, fragstatus=0, progstatus=0; - unsigned int tmpVert=0, tmpFrag=0, tmpProg=0; - int char_len=0; - char *logInf =0; - - if(mError) - goto programError; - - if(!vertProg || !fragProg){ - spit("Invalid GLSL sources"); - return false; - } - if( !GLEW_ARB_fragment_shader) { - spit("Fragment shaders not supported"); - return false; - } - if( !GLEW_ARB_vertex_shader) { - spit("Vertex shaders not supported"); - return false; - } - - // -- vertex shader ------------------ - tmpVert = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); - glShaderSourceARB(tmpVert, 1, (const char**)&vertProg, 0); - glCompileShaderARB(tmpVert); - glGetObjectParameterivARB(tmpVert, GL_OBJECT_INFO_LOG_LENGTH_ARB,(GLint*) &vertlen); - - // print info if any - if( vertlen > 0 && vertlen < MAX_LOG_LEN){ - logInf = (char*)MEM_mallocN(vertlen, "vert-log"); - glGetInfoLogARB(tmpVert, vertlen, (GLsizei*)&char_len, logInf); - if(char_len >0) { - spit("---- Vertex Shader Error ----"); - spit(logInf); - } - MEM_freeN(logInf); - logInf=0; - } - // check for compile errors - glGetObjectParameterivARB(tmpVert, GL_OBJECT_COMPILE_STATUS_ARB,(GLint*)&vertstatus); - if(!vertstatus) { - spit("---- Vertex shader failed to compile ----"); - goto programError; - } - - // -- fragment shader ---------------- - tmpFrag = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); - glShaderSourceARB(tmpFrag, 1,(const char**)&fragProg, 0); - glCompileShaderARB(tmpFrag); - glGetObjectParameterivARB(tmpFrag, GL_OBJECT_INFO_LOG_LENGTH_ARB, (GLint*) &fraglen); - if(fraglen >0 && fraglen < MAX_LOG_LEN){ - logInf = (char*)MEM_mallocN(fraglen, "frag-log"); - glGetInfoLogARB(tmpFrag, fraglen,(GLsizei*) &char_len, logInf); - if(char_len >0) { - spit("---- Fragment Shader Error ----"); - spit(logInf); - } - MEM_freeN(logInf); - logInf=0; - } - - glGetObjectParameterivARB(tmpFrag, GL_OBJECT_COMPILE_STATUS_ARB, (GLint*) &fragstatus); - if(!fragstatus){ - spit("---- Fragment shader failed to compile ----"); - goto programError; - } - - - // -- program ------------------------ - // set compiled vert/frag shader & link - tmpProg = glCreateProgramObjectARB(); - glAttachObjectARB(tmpProg, tmpVert); - glAttachObjectARB(tmpProg, tmpFrag); - glLinkProgramARB(tmpProg); - glGetObjectParameterivARB(tmpProg, GL_OBJECT_INFO_LOG_LENGTH_ARB, (GLint*) &proglen); - glGetObjectParameterivARB(tmpProg, GL_OBJECT_LINK_STATUS_ARB, (GLint*) &progstatus); - - - if(proglen > 0 && proglen < MAX_LOG_LEN) { - logInf = (char*)MEM_mallocN(proglen, "prog-log"); - glGetInfoLogARB(tmpProg, proglen, (GLsizei*)&char_len, logInf); - if(char_len >0) { - spit("---- GLSL Program ----"); - spit(logInf); - } - MEM_freeN(logInf); - logInf=0; - } - - if(!progstatus){ - spit("---- GLSL program failed to link ----"); - goto programError; - } - - // set - mShader = tmpProg; - glDeleteObjectARB(tmpVert); - glDeleteObjectARB(tmpFrag); - mOk = 1; - mError = 0; - return true; - -programError: - if(tmpVert) { - glDeleteObjectARB(tmpVert); - tmpVert=0; - } - if(tmpFrag) { - glDeleteObjectARB(tmpFrag); - tmpFrag=0; - } - - if(tmpProg) { - glDeleteObjectARB(tmpProg); - tmpProg=0; - } - - mOk = 0; - mUse = 0; - mError = 1; - return false; -} - -const char *BL_Shader::GetVertPtr() -{ - return vertProg?vertProg:0; -} - -const char *BL_Shader::GetFragPtr() -{ - return fragProg?fragProg:0; -} - -void BL_Shader::SetVertPtr( char *vert ) -{ - vertProg = vert; -} - -void BL_Shader::SetFragPtr( char *frag ) -{ - fragProg = frag; -} - -unsigned int BL_Shader::GetProg() -{ - return mShader; -} -// -//const BL_Sampler* BL_Shader::GetSampler(int i) -//{ -// MT_assert(i<=MAXTEX); -// return &mSampler[i]; -//} - -void BL_Shader::SetSampler(int loc, int unit) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - glUniform1iARB(loc, unit); - } -} -// -//void BL_Shader::InitializeSampler(int unit, BL_Texture* texture) -//{ -// MT_assert(unit<=MAXTEX); -// mSampler[unit].mTexture = texture; -// mSampler[unit].mLoc =-1; -// mSampler[unit].mOwn = 0; -//} - -void BL_Shader::SetProg(bool enable) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - if( mShader != 0 && mOk && enable) { - glUseProgramObjectARB(mShader); - } - else { - glUseProgramObjectARB(0); - } - } -} - -void BL_Shader::Update( const RAS_MeshSlot & ms, RAS_IRasterizer* rasty ) -{ - if(!Ok() || !mPreDef.size()) - return; - - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - MT_Matrix4x4 model; - model.setValue(ms.m_OpenGLMatrix); - const MT_Matrix4x4& view = rasty->GetViewMatrix(); - - if(mAttr==SHD_TANGENT) - ms.m_mesh->SetMeshModified(true); - - BL_UniformVecDef::iterator it; - for(it = mPreDef.begin(); it!= mPreDef.end(); it++) - { - BL_DefUniform *uni = (*it); - if(uni->mLoc == -1) continue; - - switch (uni->mType) - { - case MODELMATRIX: - { - SetUniform(uni->mLoc, model); - break; - } - case MODELMATRIX_TRANSPOSE: - { - SetUniform(uni->mLoc, model, true); - break; - } - case MODELMATRIX_INVERSE: - { - model.invert(); - SetUniform(uni->mLoc, model); - break; - } - case MODELMATRIX_INVERSETRANSPOSE: - { - model.invert(); - SetUniform(uni->mLoc, model, true); - break; - } - case MODELVIEWMATRIX: - { - SetUniform(uni->mLoc, view*model); - break; - } - - case MODELVIEWMATRIX_TRANSPOSE: - { - MT_Matrix4x4 mat(view*model); - SetUniform(uni->mLoc, mat, true); - break; - } - case MODELVIEWMATRIX_INVERSE: - { - MT_Matrix4x4 mat(view*model); - mat.invert(); - SetUniform(uni->mLoc, mat); - break; - } - case MODELVIEWMATRIX_INVERSETRANSPOSE: - { - MT_Matrix4x4 mat(view*model); - mat.invert(); - SetUniform(uni->mLoc, mat, true); - break; - } - case CAM_POS: - { - MT_Point3 pos(rasty->GetCameraPosition()); - SetUniform(uni->mLoc, pos); - break; - } - case VIEWMATRIX: - { - SetUniform(uni->mLoc, view); - break; - } - case VIEWMATRIX_TRANSPOSE: - { - SetUniform(uni->mLoc, view, true); - break; - } - case VIEWMATRIX_INVERSE: - { - MT_Matrix4x4 viewinv = view; - viewinv.invert(); - SetUniform(uni->mLoc, view); - break; - } - case VIEWMATRIX_INVERSETRANSPOSE: - { - MT_Matrix4x4 viewinv = view; - viewinv.invert(); - SetUniform(uni->mLoc, view, true); - break; - } - case CONSTANT_TIMER: - { - SetUniform(uni->mLoc, (float)rasty->GetTime()); - break; - } - default: - break; - } - } - } -} - - -int BL_Shader::GetAttribLocation(const STR_String& name) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - return glGetAttribLocationARB(mShader, name.ReadPtr()); - } - - return -1; -} - -void BL_Shader::BindAttribute(const STR_String& attr, int loc) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - glBindAttribLocationARB(mShader, loc, attr.ReadPtr()); - } -} - -int BL_Shader::GetUniformLocation(const STR_String& name) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - MT_assert(mShader!=0); - int location = glGetUniformLocationARB(mShader, name.ReadPtr()); - if(location == -1) - spit("Invalid uniform value: " << name.ReadPtr() << "."); - return location; - } - - return -1; -} - -void BL_Shader::SetUniform(int uniform, const MT_Tuple2& vec) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - float value[2]; - vec.getValue(value); - glUniform2fvARB(uniform, 1, value); - } - -} - -void BL_Shader::SetUniform(int uniform, const MT_Tuple3& vec) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - float value[3]; - vec.getValue(value); - glUniform3fvARB(uniform, 1, value); - } -} - -void BL_Shader::SetUniform(int uniform, const MT_Tuple4& vec) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - float value[4]; - vec.getValue(value); - glUniform4fvARB(uniform, 1, value); - } -} - -void BL_Shader::SetUniform(int uniform, const unsigned int& val) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - glUniform1iARB(uniform, val); - } -} - -void BL_Shader::SetUniform(int uniform, const int val) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - glUniform1iARB(uniform, val); - } -} - -void BL_Shader::SetUniform(int uniform, const float& val) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - glUniform1fARB(uniform, val); - } -} - -void BL_Shader::SetUniform(int uniform, const MT_Matrix4x4& vec, bool transpose) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - float value[16]; - // note: getValue gives back column major as needed by OpenGL - vec.getValue(value); - glUniformMatrix4fvARB(uniform, 1, transpose?GL_TRUE:GL_FALSE, value); - } -} - -void BL_Shader::SetUniform(int uniform, const MT_Matrix3x3& vec, bool transpose) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - float value[9]; - value[0] = (float)vec[0][0]; value[1] = (float)vec[1][0]; value[2] = (float)vec[2][0]; - value[3] = (float)vec[0][1]; value[4] = (float)vec[1][1]; value[5] = (float)vec[2][1]; - value[6] = (float)vec[0][2]; value[7] = (float)vec[1][2]; value[7] = (float)vec[2][2]; - glUniformMatrix3fvARB(uniform, 1, transpose?GL_TRUE:GL_FALSE, value); - } -} - -void BL_Shader::SetUniform(int uniform, const float* val, int len) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - if(len == 2) - glUniform2fvARB(uniform, 1,(GLfloat*)val); - else if (len == 3) - glUniform3fvARB(uniform, 1,(GLfloat*)val); - else if (len == 4) - glUniform4fvARB(uniform, 1,(GLfloat*)val); - else - MT_assert(0); - } -} - -void BL_Shader::SetUniform(int uniform, const int* val, int len) -{ - if( GLEW_ARB_fragment_shader && - GLEW_ARB_vertex_shader && - GLEW_ARB_shader_objects - ) - { - if(len == 2) - glUniform2ivARB(uniform, 1, (GLint*)val); - else if (len == 3) - glUniform3ivARB(uniform, 1, (GLint*)val); - else if (len == 4) - glUniform4ivARB(uniform, 1, (GLint*)val); - else - MT_assert(0); - } -} - -#ifndef DISABLE_PYTHON - -PyMethodDef BL_Shader::Methods[] = -{ - // creation - KX_PYMETHODTABLE( BL_Shader, setSource ), - KX_PYMETHODTABLE( BL_Shader, delSource ), - KX_PYMETHODTABLE( BL_Shader, getVertexProg ), - KX_PYMETHODTABLE( BL_Shader, getFragmentProg ), - KX_PYMETHODTABLE( BL_Shader, setNumberOfPasses ), - KX_PYMETHODTABLE( BL_Shader, validate), - /// access functions - KX_PYMETHODTABLE( BL_Shader, isValid), - KX_PYMETHODTABLE( BL_Shader, setUniform1f ), - KX_PYMETHODTABLE( BL_Shader, setUniform2f ), - KX_PYMETHODTABLE( BL_Shader, setUniform3f ), - KX_PYMETHODTABLE( BL_Shader, setUniform4f ), - KX_PYMETHODTABLE( BL_Shader, setUniform1i ), - KX_PYMETHODTABLE( BL_Shader, setUniform2i ), - KX_PYMETHODTABLE( BL_Shader, setUniform3i ), - KX_PYMETHODTABLE( BL_Shader, setUniform4i ), - KX_PYMETHODTABLE( BL_Shader, setAttrib ), - - KX_PYMETHODTABLE( BL_Shader, setUniformfv ), - KX_PYMETHODTABLE( BL_Shader, setUniformiv ), - KX_PYMETHODTABLE( BL_Shader, setUniformDef ), - - KX_PYMETHODTABLE( BL_Shader, setSampler ), - KX_PYMETHODTABLE( BL_Shader, setUniformMatrix4 ), - KX_PYMETHODTABLE( BL_Shader, setUniformMatrix3 ), - - {NULL,NULL} //Sentinel -}; - -PyAttributeDef BL_Shader::Attributes[] = { - { NULL } //Sentinel -}; - -PyTypeObject BL_Shader::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BL_Shader", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &PyObjectPlus::Type, - 0,0,0,0,0,0, - py_base_new -}; - -KX_PYMETHODDEF_DOC( BL_Shader, setSource," setSource(vertexProgram, fragmentProgram)" ) -{ - if(mShader !=0 && mOk ) - { - // already set... - Py_RETURN_NONE; - } - char *v,*f; - int apply=0; - if( PyArg_ParseTuple(args, "ssi:setSource", &v, &f, &apply) ) - { - vertProg = v; - fragProg = f; - if( LinkProgram() ) { - glUseProgramObjectARB( mShader ); - mUse = apply!=0; - Py_RETURN_NONE; - } - vertProg = 0; - fragProg = 0; - mUse = 0; - Py_RETURN_NONE; - } - return NULL; -} - - -KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" ) -{ - ClearUniforms(); - glUseProgramObjectARB(0); - - glDeleteObjectARB(mShader); - mShader = 0; - mOk = 0; - mUse = 0; - Py_RETURN_NONE; -} - -KX_PYMETHODDEF_DOC( BL_Shader, isValid, "isValid()" ) -{ - return PyLong_FromSsize_t( ( mShader !=0 && mOk ) ); -} - -KX_PYMETHODDEF_DOC( BL_Shader, getVertexProg ,"getVertexProg( )" ) -{ - return PyUnicode_FromString(vertProg?vertProg:""); -} - -KX_PYMETHODDEF_DOC( BL_Shader, getFragmentProg ,"getFragmentProg( )" ) -{ - return PyUnicode_FromString(fragProg?fragProg:""); -} - -KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()") -{ - if(mError) { - Py_RETURN_NONE; - } - if(mShader==0) { - PyErr_SetString(PyExc_TypeError, "shader.validate(): BL_Shader, invalid shader object"); - return NULL; - } - int stat = 0; - glValidateProgramARB(mShader); - glGetObjectParameterivARB(mShader, GL_OBJECT_VALIDATE_STATUS_ARB,(GLint*) &stat); - - - if(stat > 0 && stat < MAX_LOG_LEN) { - int char_len=0; - char *logInf = (char*)MEM_mallocN(stat, "validate-log"); - - glGetInfoLogARB(mShader, stat,(GLsizei*) &char_len, logInf); - if(char_len >0) { - spit("---- GLSL Validation ----"); - spit(logInf); - } - MEM_freeN(logInf); - logInf=0; - } - Py_RETURN_NONE; -} - - -KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" ) -{ - if(mError) { - Py_RETURN_NONE; - } - - const char *uniform=""; - int index=-1; - if(PyArg_ParseTuple(args, "si:setSampler", &uniform, &index)) - { - int loc = GetUniformLocation(uniform); - if(loc != -1) { - if(index >= MAXTEX || index < 0) - spit("Invalid texture sample index: " << index); - -#ifdef SORT_UNIFORMS - SetUniformiv(loc, BL_Uniform::UNI_INT, &index, (sizeof(int)) ); -#else - SetUniform(loc, index); -#endif - //if(index <= MAXTEX) - // mSampler[index].mLoc = loc; - //else - // spit("Invalid texture sample index: " << index); - } - Py_RETURN_NONE; - } - return NULL; -} - -KX_PYMETHODDEF_DOC( BL_Shader, setNumberOfPasses, "setNumberOfPasses( max-pass )" ) -{ - int pass = 1; - if(!PyArg_ParseTuple(args, "i:setNumberOfPasses", &pass)) - return NULL; - - mPass = 1; - Py_RETURN_NONE; -} - -/// access functions -KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" ) -{ - if(mError) { - Py_RETURN_NONE; - } - - const char *uniform=""; - float value=0; - if(PyArg_ParseTuple(args, "sf:setUniform1f", &uniform, &value )) - { - int loc = GetUniformLocation(uniform); - if(loc != -1) - { -#ifdef SORT_UNIFORMS - SetUniformfv(loc, BL_Uniform::UNI_FLOAT, &value, sizeof(float)); -#else - SetUniform( loc, (float)value ); -#endif - } - Py_RETURN_NONE; - } - return NULL; -} - - -KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)") -{ - if(mError) { - Py_RETURN_NONE; - } - const char *uniform=""; - float array[2]={ 0,0 }; - if(PyArg_ParseTuple(args, "sff:setUniform2f", &uniform, &array[0],&array[1] )) - { - int loc = GetUniformLocation(uniform); - if(loc != -1) - { -#ifdef SORT_UNIFORMS - SetUniformfv(loc, BL_Uniform::UNI_FLOAT2, array, (sizeof(float)*2) ); -#else - SetUniform(loc, array, 2); -#endif - } - Py_RETURN_NONE; - } - return NULL; -} - - -KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ") -{ - if(mError) { - Py_RETURN_NONE; - } - const char *uniform=""; - float array[3]={0,0,0}; - if(PyArg_ParseTuple(args, "sfff:setUniform3f", &uniform, &array[0],&array[1],&array[2])) - { - int loc = GetUniformLocation(uniform); - if(loc != -1) - { -#ifdef SORT_UNIFORMS - SetUniformfv(loc, BL_Uniform::UNI_FLOAT3, array, (sizeof(float)*3) ); -#else - SetUniform(loc, array, 3); -#endif - } - Py_RETURN_NONE; - - } - return NULL; -} - - -KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) ") -{ - if(mError) { - Py_RETURN_NONE; - } - const char *uniform=""; - float array[4]={0,0,0,0}; - if(PyArg_ParseTuple(args, "sffff:setUniform4f", &uniform, &array[0],&array[1],&array[2], &array[3])) - { - int loc = GetUniformLocation(uniform); - if(loc != -1) - { -#ifdef SORT_UNIFORMS - SetUniformfv(loc, BL_Uniform::UNI_FLOAT4, array, (sizeof(float)*4) ); -#else - SetUniform(loc, array, 4); -#endif - } - Py_RETURN_NONE; - } - return NULL; -} - - -KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" ) -{ - if(mError) { - Py_RETURN_NONE; - } - const char *uniform=""; - int value=0; - if(PyArg_ParseTuple(args, "si:setUniform1i", &uniform, &value )) - { - int loc = GetUniformLocation(uniform); - if(loc != -1) - { -#ifdef SORT_UNIFORMS - SetUniformiv(loc, BL_Uniform::UNI_INT, &value, sizeof(int)); -#else - SetUniform(loc, (int)value); -#endif - } - Py_RETURN_NONE; - } - return NULL; -} - - -KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)") -{ - if(mError) { - Py_RETURN_NONE; - } - const char *uniform=""; - int array[2]={ 0,0 }; - if(PyArg_ParseTuple(args, "sii:setUniform2i", &uniform, &array[0],&array[1] )) - { - int loc = GetUniformLocation(uniform); - if(loc != -1) - { -#ifdef SORT_UNIFORMS - SetUniformiv(loc, BL_Uniform::UNI_INT2, array, sizeof(int)*2); -#else - SetUniform(loc, array, 2); -#endif - } - Py_RETURN_NONE; - } - return NULL; -} - - -KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ") -{ - if(mError) { - Py_RETURN_NONE; - } - - const char *uniform=""; - int array[3]={0,0,0}; - if(PyArg_ParseTuple(args, "siii:setUniform3i", &uniform, &array[0],&array[1],&array[2])) - { - int loc = GetUniformLocation(uniform); - if(loc != -1) - { -#ifdef SORT_UNIFORMS - SetUniformiv(loc, BL_Uniform::UNI_INT3, array, sizeof(int)*3); -#else - SetUniform(loc, array, 3); -#endif - } - Py_RETURN_NONE; - } - return NULL; -} - -KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) ") -{ - if(mError) { - Py_RETURN_NONE; - } - const char *uniform=""; - int array[4]={0,0,0, 0}; - if(PyArg_ParseTuple(args, "siiii:setUniform4i", &uniform, &array[0],&array[1],&array[2], &array[3] )) - { - int loc = GetUniformLocation(uniform); - if(loc != -1) - { -#ifdef SORT_UNIFORMS - SetUniformiv(loc, BL_Uniform::UNI_INT4, array, sizeof(int)*4); -#else - SetUniform(loc, array, 4); -#endif - } - Py_RETURN_NONE; - } - return NULL; -} - -KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or list3 or list4) )") -{ - if(mError) { - Py_RETURN_NONE; - } - const char *uniform = ""; - PyObject *listPtr =0; - float array_data[4] = {0.f,0.f,0.f,0.f}; - - if(PyArg_ParseTuple(args, "sO:setUniformfv", &uniform, &listPtr)) - { - int loc = GetUniformLocation(uniform); - if(loc != -1) - { - if(PySequence_Check(listPtr)) - { - unsigned int list_size = PySequence_Size(listPtr); - - for(unsigned int i=0; (imLoc == loc) { - defined = true; - break; - } - it++; - } - if(defined) - { - Py_RETURN_NONE; - } - - BL_DefUniform *uni = new BL_DefUniform(); - uni->mLoc = loc; - uni->mType = nloc; - uni->mFlag = 0; - mPreDef.push_back(uni); - Py_RETURN_NONE; - } - } - return NULL; -} - -#endif // DISABLE_PYTHON - -// eof diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h deleted file mode 100644 index ebd2e491f35..00000000000 --- a/source/gameengine/Ketsji/BL_Shader.h +++ /dev/null @@ -1,256 +0,0 @@ -#ifndef __BL_SHADER_H__ -#define __BL_SHADER_H__ - -#include "PyObjectPlus.h" -#include "BL_Material.h" -#include "BL_Texture.h" -// -- -#include "MT_Matrix4x4.h" -#include "MT_Matrix3x3.h" -#include "MT_Tuple2.h" -#include "MT_Tuple3.h" -#include "MT_Tuple4.h" - -#define SHADER_ATTRIBMAX 1 - -/** - * BL_Sampler - * Sampler access - */ -class BL_Sampler -{ -public: - BL_Sampler(): - mLoc(-1) - { - } - int mLoc; // Sampler location - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Sampler"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -/** - * BL_Uniform - * uniform storage - */ -class BL_Uniform -{ -private: - int mLoc; // Uniform location - void* mData; // Memory allocated for variable - bool mDirty; // Caching variable - int mType; // Enum UniformTypes - bool mTranspose; // Transpose matrices - const int mDataLen; // Length of our data -public: - BL_Uniform(int data_size); - ~BL_Uniform(); - - - void Apply(class BL_Shader *shader); - void SetData(int location, int type, bool transpose=false); - - enum UniformTypes { - UNI_NONE =0, - UNI_INT, - UNI_FLOAT, - UNI_INT2, - UNI_FLOAT2, - UNI_INT3, - UNI_FLOAT3, - UNI_INT4, - UNI_FLOAT4, - UNI_MAT3, - UNI_MAT4, - UNI_MAX - }; - - int GetLocation() { return mLoc; } - void* getData() { return mData; } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Uniform"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -/** - * BL_DefUniform - * pre defined uniform storage - */ -class BL_DefUniform -{ -public: - BL_DefUniform() : - mType(0), - mLoc(0), - mFlag(0) - { - } - int mType; - int mLoc; - unsigned int mFlag; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_DefUniform"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -/** - * BL_Shader - * shader access - */ -class BL_Shader : public PyObjectPlus -{ - Py_Header; -private: - typedef std::vector BL_UniformVec; - typedef std::vector BL_UniformVecDef; - - unsigned int mShader; // Shader object - int mPass; // 1.. unused - bool mOk; // Valid and ok - bool mUse; // ... -//BL_Sampler mSampler[MAXTEX]; // Number of samplers - int mAttr; // Tangent attribute - const char* vertProg; // Vertex program string - const char* fragProg; // Fragment program string - bool mError; // ... - bool mDirty; // - - // Compiles and links the shader - bool LinkProgram(); - - // Stored uniform variables - BL_UniformVec mUniforms; - BL_UniformVecDef mPreDef; - - // search by location - BL_Uniform* FindUniform(const int location); - // clears uniform data - void ClearUniforms(); - -public: - BL_Shader(); - virtual ~BL_Shader(); - - // Unused for now tangent is set as - // tex coords - enum AttribTypes { - SHD_TANGENT =1 - }; - - enum GenType { - MODELVIEWMATRIX, - MODELVIEWMATRIX_TRANSPOSE, - MODELVIEWMATRIX_INVERSE, - MODELVIEWMATRIX_INVERSETRANSPOSE, - - // Model matrix - MODELMATRIX, - MODELMATRIX_TRANSPOSE, - MODELMATRIX_INVERSE, - MODELMATRIX_INVERSETRANSPOSE, - - // View Matrix - VIEWMATRIX, - VIEWMATRIX_TRANSPOSE, - VIEWMATRIX_INVERSE, - VIEWMATRIX_INVERSETRANSPOSE, - - // Current camera position - CAM_POS, - - // RAS timer - CONSTANT_TIMER - }; - - const char* GetVertPtr(); - const char* GetFragPtr(); - void SetVertPtr( char *vert ); - void SetFragPtr( char *frag ); - - // --- - int getNumPass() {return mPass;} - bool GetError() {return mError;} - // --- - //const BL_Sampler* GetSampler(int i); - void SetSampler(int loc, int unit); - - bool Ok()const; - unsigned int GetProg(); - void SetProg(bool enable); - int GetAttribute(){return mAttr;}; - - // -- - // Apply methods : sets colected uniforms - void ApplyShader(); - void UnloadShader(); - - // Update predefined uniforms each render call - void Update(const class RAS_MeshSlot & ms, class RAS_IRasterizer* rasty); - - //// Set sampler units (copied) - //void InitializeSampler(int unit, BL_Texture* texture ); - - - void SetUniformfv(int location,int type, float *param, int size,bool transpose=false); - void SetUniformiv(int location,int type, int *param, int size,bool transpose=false); - - int GetAttribLocation(const STR_String& name); - void BindAttribute(const STR_String& attr, int loc); - int GetUniformLocation(const STR_String& name); - - void SetUniform(int uniform, const MT_Tuple2& vec); - void SetUniform(int uniform, const MT_Tuple3& vec); - void SetUniform(int uniform, const MT_Tuple4& vec); - void SetUniform(int uniform, const MT_Matrix4x4& vec, bool transpose=false); - void SetUniform(int uniform, const MT_Matrix3x3& vec, bool transpose=false); - void SetUniform(int uniform, const float& val); - void SetUniform(int uniform, const float* val, int len); - void SetUniform(int uniform, const int* val, int len); - void SetUniform(int uniform, const unsigned int& val); - void SetUniform(int uniform, const int val); - - // Python interface -#ifndef DISABLE_PYTHON - virtual PyObject* py_repr(void) { return PyUnicode_FromFormat("BL_Shader\n\tvertex shader:%s\n\n\tfragment shader%s\n\n", vertProg, fragProg); } - - // ----------------------------------- - KX_PYMETHOD_DOC( BL_Shader, setSource ); - KX_PYMETHOD_DOC( BL_Shader, delSource ); - KX_PYMETHOD_DOC( BL_Shader, getVertexProg ); - KX_PYMETHOD_DOC( BL_Shader, getFragmentProg ); - KX_PYMETHOD_DOC( BL_Shader, setNumberOfPasses ); - KX_PYMETHOD_DOC( BL_Shader, isValid); - KX_PYMETHOD_DOC( BL_Shader, validate); - - // ----------------------------------- - KX_PYMETHOD_DOC( BL_Shader, setUniform4f ); - KX_PYMETHOD_DOC( BL_Shader, setUniform3f ); - KX_PYMETHOD_DOC( BL_Shader, setUniform2f ); - KX_PYMETHOD_DOC( BL_Shader, setUniform1f ); - KX_PYMETHOD_DOC( BL_Shader, setUniform4i ); - KX_PYMETHOD_DOC( BL_Shader, setUniform3i ); - KX_PYMETHOD_DOC( BL_Shader, setUniform2i ); - KX_PYMETHOD_DOC( BL_Shader, setUniform1i ); - KX_PYMETHOD_DOC( BL_Shader, setUniformfv ); - KX_PYMETHOD_DOC( BL_Shader, setUniformiv ); - KX_PYMETHOD_DOC( BL_Shader, setUniformMatrix4 ); - KX_PYMETHOD_DOC( BL_Shader, setUniformMatrix3 ); - KX_PYMETHOD_DOC( BL_Shader, setUniformDef ); - KX_PYMETHOD_DOC( BL_Shader, setAttrib ); - KX_PYMETHOD_DOC( BL_Shader, setSampler); -#endif -}; - -#endif//__BL_SHADER_H__ diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp deleted file mode 100644 index 5d40ba7d75c..00000000000 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ /dev/null @@ -1,673 +0,0 @@ -// ------------------------------------ - -#include "GL/glew.h" - -#include -#include -#include - -#include "BL_Material.h" -#include "BL_Texture.h" -#include "MT_assert.h" - -#include "DNA_texture_types.h" -#include "DNA_image_types.h" -#include "IMB_imbuf_types.h" -#include "BKE_image.h" -#include "BLI_blenlib.h" - -#include "RAS_OpenGLRasterizer/RAS_GLExtensionManager.h" -#include "RAS_ICanvas.h" -#include "RAS_Rect.h" - -#include "KX_GameObject.h" - -#define spit(x) std::cout << x << std::endl; - -#include "MEM_guardedalloc.h" - -extern "C" { - // envmaps - #include "IMB_imbuf.h" - void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf); - void my_free_envmapdata(EnvMap *env); -} - -// (n&(n-1)) zeros the least significant bit of n -static int is_pow2(int num) { - return ((num)&(num-1))==0; -} -static int smaller_pow2(int num) { - while (!is_pow2(num)) - num= num&(num-1); - return num; -} - -// Place holder for a full texture manager -class BL_TextureObject -{ -public: - unsigned int gl_texture; - void* ref_buffer; -}; - -typedef std::map BL_TextureMap; -static BL_TextureMap g_textureManager; - - -BL_Texture::BL_Texture() -: mTexture(0), - mOk(0), - mNeedsDeleted(0), - mType(0), - mUnit(0), - mEnvState(0) -{ - // -- -} - -BL_Texture::~BL_Texture() -{ - // -- -} - -void BL_Texture::DeleteTex() -{ - if( mNeedsDeleted ) { - glDeleteTextures(1, (GLuint*)&mTexture); - mNeedsDeleted = 0; - mOk = 0; - } - - if(mEnvState) { - glDeleteLists((GLuint)mEnvState, 1); - mEnvState =0; - } - - if(mDisableState) { - glDeleteLists((GLuint)mDisableState, 1); - mDisableState =0; - } - g_textureManager.clear(); -} - - -bool BL_Texture::InitFromImage(int unit, Image *img, bool mipmap) -{ - - ImBuf *ibuf; - if (!img || img->ok==0) - { - mOk = false; - return mOk; - } - - ibuf= BKE_image_get_ibuf(img, NULL); - if (ibuf==NULL) - { - img->ok = 0; - mOk = false; - return mOk; - } - - - mTexture = img->bindcode; - mType = GL_TEXTURE_2D; - mUnit = unit; - - ActivateUnit(mUnit); - - if (mTexture != 0) { - glBindTexture(GL_TEXTURE_2D, mTexture ); - Validate(); - return mOk; - } - - // look for an existing gl image - BL_TextureMap::iterator mapLook = g_textureManager.find(img->id.name); - if (mapLook != g_textureManager.end()) - { - if (mapLook->second.gl_texture != 0) - { - mTexture = mapLook->second.gl_texture; - glBindTexture(GL_TEXTURE_2D, mTexture); - mOk = IsValid(); - return mOk; - } - } - - mNeedsDeleted = 1; - glGenTextures(1, (GLuint*)&mTexture); - InitGLTex(ibuf->rect, ibuf->x, ibuf->y, mipmap); - - // track created units - BL_TextureObject obj; - obj.gl_texture = mTexture; - obj.ref_buffer = img; - g_textureManager.insert(std::pair((char*)img->id.name, obj)); - - - glDisable(GL_TEXTURE_2D); - ActivateUnit(0); - Validate(); - return mOk; -} - -void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap) -{ - if (!is_pow2(x) || !is_pow2(y) ) { - InitNonPow2Tex(pix, x,y,mipmap); - return; - } - - glBindTexture(GL_TEXTURE_2D, mTexture ); - if( mipmap ) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, x, y, GL_RGBA, GL_UNSIGNED_BYTE, pix ); - } - else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, pix ); - } - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); -} - - -void BL_Texture::InitNonPow2Tex(unsigned int *pix,int x,int y,bool mipmap) -{ - int nx= smaller_pow2(x); - int ny= smaller_pow2(y); - - unsigned int *newPixels = (unsigned int *)malloc(nx*ny*sizeof(unsigned int)); - - gluScaleImage(GL_RGBA, x, y, GL_UNSIGNED_BYTE, pix, nx,ny, GL_UNSIGNED_BYTE, newPixels); - glBindTexture(GL_TEXTURE_2D, mTexture ); - - if( mipmap ) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, nx, ny, GL_RGBA, GL_UNSIGNED_BYTE, newPixels ); - } - else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nx, ny, 0, GL_RGBA, GL_UNSIGNED_BYTE, newPixels ); - } - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - free(newPixels); -} - - -bool BL_Texture::InitCubeMap(int unit, EnvMap *cubemap) -{ - if (!GLEW_ARB_texture_cube_map) - { - spit("cubemaps not supported"); - mOk = false; - return mOk; - } - else if (!cubemap || cubemap->ima->ok==0) - { - mOk = false; - return mOk; - } - - ImBuf *ibuf= BKE_image_get_ibuf(cubemap->ima, NULL); - if (ibuf==0) - { - cubemap->ima->ok = 0; - mOk = false; - return mOk; - } - - mNeedsDeleted = 1; - mType = GL_TEXTURE_CUBE_MAP_ARB; - mTexture = 0; - mUnit = unit; - - ActivateUnit(mUnit); - - BL_TextureMap::iterator mapLook = g_textureManager.find(cubemap->ima->id.name); - if (mapLook != g_textureManager.end()) - { - if (mapLook->second.gl_texture != 0 && mapLook->second.ref_buffer == cubemap->ima) - { - mTexture = mapLook->second.gl_texture; - glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mTexture); - mOk = IsValid(); - return mOk; - } - } - - - glGenTextures(1, (GLuint*)&mTexture); - glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mTexture); - - - // track created units - BL_TextureObject obj; - obj.gl_texture = mTexture; - obj.ref_buffer = cubemap->ima; - g_textureManager.insert(std::pair((char*)cubemap->ima->id.name, obj)); - - - bool needs_split = false; - if (!cubemap->cube[0]) - { - needs_split = true; - spit ("Re-Generating texture buffer"); - } - - if (needs_split) - my_envmap_split_ima(cubemap, ibuf); - - - if (!is_pow2(cubemap->cube[0]->x) || !is_pow2(cubemap->cube[0]->y)) - { - spit("invalid envmap size please render with CubeRes @ power of two"); - - my_free_envmapdata(cubemap); - mOk = false; - return mOk; - } - - -#define SetCubeMapFace(face, num) \ - glTexImage2D(face, 0,GL_RGBA, \ - cubemap->cube[num]->x, \ - cubemap->cube[num]->y, \ - 0, GL_RGBA, GL_UNSIGNED_BYTE, \ - cubemap->cube[num]->rect) - - SetCubeMapFace(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 5); - SetCubeMapFace(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, 3); - SetCubeMapFace(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, 0); - SetCubeMapFace(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, 1); - SetCubeMapFace(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, 2); - SetCubeMapFace(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, 4); - - glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); - glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); - if(GLEW_VERSION_1_2) - glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE ); - - if (needs_split) - my_free_envmapdata(cubemap); - - - - glDisable(GL_TEXTURE_CUBE_MAP_ARB); - ActivateUnit(0); - - mOk = IsValid(); - return mOk; -} - -bool BL_Texture::IsValid() -{ - return (mTexture!= 0)?glIsTexture(mTexture)!=0:false; -} - - -void BL_Texture::Validate() -{ - mOk = IsValid(); -} - - -bool BL_Texture::Ok() -{ - return (mTexture!= 0); -} - - -unsigned int BL_Texture::GetTextureType() const -{ - return mType; -} - -int BL_Texture::GetMaxUnits() -{ - GLint unit=0; - - if(GLEW_ARB_multitexture) { - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &unit); - return (MAXTEX>=unit?unit:MAXTEX); - } - - return 0; -} - -void BL_Texture::ActivateFirst() -{ - if(GLEW_ARB_multitexture) - glActiveTextureARB(GL_TEXTURE0_ARB); -} - -void BL_Texture::ActivateUnit(int unit) -{ - if(GLEW_ARB_multitexture) - if(unit <= MAXTEX) - glActiveTextureARB(GL_TEXTURE0_ARB+unit); -} - - -void BL_Texture::DisableUnit() -{ - if(GLEW_ARB_multitexture) - glActiveTextureARB(GL_TEXTURE0_ARB+mUnit); - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - - if(GLEW_ARB_texture_cube_map && glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) - glDisable(GL_TEXTURE_CUBE_MAP_ARB); - else - { - if (glIsEnabled(GL_TEXTURE_2D)) - glDisable(GL_TEXTURE_2D); - } - - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_GEN_T); - glDisable(GL_TEXTURE_GEN_R); - glDisable(GL_TEXTURE_GEN_Q); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); -} - - -void BL_Texture::DisableAllTextures() -{ - for(int i=0; iflag[mUnit] &TEXALPHA ) { - combiner = GL_COMBINE_ALPHA_ARB; - source0 = GL_SOURCE0_ALPHA_ARB; - source1 = GL_SOURCE1_ALPHA_ARB; - source2 = GL_SOURCE2_ALPHA_ARB; - op0 = GL_OPERAND0_ALPHA_ARB; - op1 = GL_OPERAND1_ALPHA_ARB; - op2 = GL_OPERAND2_ALPHA_ARB; - blend_operand = GL_SRC_ALPHA; - blend_operand_prev = GL_SRC_ALPHA; - // invert - if(mat->flag[mUnit] &TEXNEG) { - blend_operand_prev = GL_ONE_MINUS_SRC_ALPHA; - blend_operand = GL_ONE_MINUS_SRC_ALPHA; - } - } - else { - if(mat->flag[mUnit] &TEXNEG) { - blend_operand_prev=GL_ONE_MINUS_SRC_COLOR; - blend_operand = GL_ONE_MINUS_SRC_COLOR; - } - } - bool using_alpha = false; - - if(mat->flag[mUnit] &USEALPHA){ - alphaOp = GL_ONE_MINUS_SRC_ALPHA; - using_alpha=true; - } - else if(mat->flag[mUnit] &USENEGALPHA){ - alphaOp = GL_SRC_ALPHA; - using_alpha = true; - } - - switch( mat->blend_mode[mUnit] ) { - case BLEND_MIX: - { - // ------------------------------ - if(!using_alpha) { - GLfloat base_col[4]; - base_col[0] = base_col[1] = base_col[2] = 0.f; - base_col[3] = 1.f-mat->color_blend[mUnit]; - glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR,base_col ); - } - glTexEnvf( GL_TEXTURE_ENV, combiner, GL_INTERPOLATE_ARB); - glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB); - glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev ); - glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); - glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); - if(!using_alpha) - glTexEnvf( GL_TEXTURE_ENV, source2, GL_CONSTANT_ARB ); - else - glTexEnvf( GL_TEXTURE_ENV, source2, GL_TEXTURE ); - - glTexEnvf( GL_TEXTURE_ENV, op2, alphaOp); - }break; - case BLEND_MUL: - { - // ------------------------------ - glTexEnvf( GL_TEXTURE_ENV, combiner, GL_MODULATE); - glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB); - glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev); - glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); - if(using_alpha) - glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp); - else - glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); - }break; - case BLEND_ADD: - { - // ------------------------------ - glTexEnvf( GL_TEXTURE_ENV, combiner, GL_ADD_SIGNED_ARB); - glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB ); - glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev ); - glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); - if(using_alpha) - glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp); - else - glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); - }break; - case BLEND_SUB: - { - // ------------------------------ - glTexEnvf( GL_TEXTURE_ENV, combiner, GL_SUBTRACT_ARB); - glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB ); - glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev ); - glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); - glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); - }break; - case BLEND_SCR: - { - // ------------------------------ - glTexEnvf( GL_TEXTURE_ENV, combiner, GL_ADD); - glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB ); - glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev ); - glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); - if(using_alpha) - glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp); - else - glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); - } break; - } - glTexEnvf( GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0); - - glEndList(); -} - -int BL_Texture::GetPow2(int n) -{ - if(!is_pow2(n)) - n = smaller_pow2(n); - - return n; -} - -void BL_Texture::SplitEnvMap(EnvMap *map) -{ - if (!map || !map->ima || (map->ima && !map->ima->ok)) return; - ImBuf *ibuf= BKE_image_get_ibuf(map->ima, NULL); - if (ibuf) - my_envmap_split_ima(map, ibuf); -} - -unsigned int BL_Texture::mDisableState = 0; - -extern "C" { - -void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf) -{ - int dx, part; - - my_free_envmapdata(env); - - dx= ibuf->y; - dx/= 2; - if(3*dx != ibuf->x) { - printf("Incorrect envmap size\n"); - env->ok= 0; - env->ima->ok= 0; - } - else { - for(part=0; part<6; part++) { - env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect, 0); - } - IMB_rectcpy(env->cube[0], ibuf, - 0, 0, 0, 0, dx, dx); - IMB_rectcpy(env->cube[1], ibuf, - 0, 0, dx, 0, dx, dx); - IMB_rectcpy(env->cube[2], ibuf, - 0, 0, 2*dx, 0, dx, dx); - IMB_rectcpy(env->cube[3], ibuf, - 0, 0, 0, dx, dx, dx); - IMB_rectcpy(env->cube[4], ibuf, - 0, 0, dx, dx, dx, dx); - IMB_rectcpy(env->cube[5], ibuf, - 0, 0, 2*dx, dx, dx, dx); - - env->ok= 2;// ENV_OSA - } -} - - -void my_free_envmapdata(EnvMap *env) -{ - unsigned int part; - - for(part=0; part<6; part++) { - ImBuf *ibuf= env->cube[part]; - if(ibuf) { - IMB_freeImBuf(ibuf); - env->cube[part]= NULL; - } - } - env->ok= 0; -} - - -} // extern C - diff --git a/source/gameengine/Ketsji/BL_Texture.h b/source/gameengine/Ketsji/BL_Texture.h deleted file mode 100644 index 2dfd9c542d3..00000000000 --- a/source/gameengine/Ketsji/BL_Texture.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef __BL_TEXTURE_H__ -#define __BL_TEXTURE_H__ - -// #include -// #include - -#include "MT_Matrix4x4.h" -#include "KX_Camera.h" - -// -- -struct Image; -struct EnvMap; -class BL_Material; -class RAS_Rect; -class RAS_ICanvas; -//class RTData; - -#include "STR_String.h" - -class BL_Texture -{ -private: - unsigned int mTexture; // Bound texture unit data - bool mOk; // ... - bool mNeedsDeleted; // If generated - unsigned int mType; // enum TEXTURE_2D | CUBE_MAP - int mUnit; // Texture unit associated with mTexture - unsigned int mEnvState; // cache textureEnv - static unsigned int mDisableState; // speed up disabling calls - - void InitNonPow2Tex(unsigned int *p,int x,int y,bool mipmap ); - void InitGLTex(unsigned int *p,int x,int y,bool mipmap ); -public: - BL_Texture(); - ~BL_Texture( ); - - bool Ok(); - int GetUnit() {return mUnit;} - void SetUnit(int unit) {mUnit = unit;} - - unsigned int GetTextureType() const; - void DeleteTex(); - - bool InitFromImage(int unit, Image *img, bool mipmap); - bool InitCubeMap(int unit,EnvMap *cubemap ); - - bool IsValid(); - void Validate(); - - static void ActivateFirst(); - static void DisableAllTextures(); - static void ActivateUnit(int unit); - static int GetMaxUnits(); - static int GetPow2(int x); - static void SplitEnvMap(EnvMap *map); - - - void ActivateTexture(); - void SetMapping(int mode); - void DisableUnit(); - void setTexEnv(BL_Material *mat, bool modulate=false); - unsigned int swapTexture (unsigned int newTex) { - // swap texture codes - unsigned int tmp = mTexture; - mTexture = newTex; - // return original texture code - return tmp; - } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Texture"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif//__BL_TEXTURE_H__ diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt deleted file mode 100644 index c4af701f87b..00000000000 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ /dev/null @@ -1,83 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -FILE(GLOB SRC *.cpp) - -SET(INC - . - ../../../source/kernel/gen_system - ../../../intern/string - ../../../intern/guardedalloc - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/Converter - ../../../source/blender/imbuf - ../../../intern/ghost/include - ../../../intern/moto/include - ../../../source/gameengine/Ketsji - ../../../source/blender/blenlib - ../../../source/blender/blenkernel - ../../../source/blender/python - ../../../source/blender/python/generic - ../../../source/blender - ../../../source/blender/include - ../../../source/blender/makesdna - ../../../source/gameengine/Rasterizer - ../../../source/gameengine/GameLogic - ../../../source/gameengine/Expressions - ../../../source/gameengine/Ketsji/KXNetwork - ../../../source/gameengine/Network - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Physics/common - ../../../source/gameengine/Physics/Bullet - ../../../source/gameengine/Network/LoopBackNetwork - ../../../intern/audaspace/intern - ../../../source/blender/misc - ../../../source/blender/blenloader - ../../../source/blender/gpu - ../../../extern/bullet2/src - ../../../extern/glew/include -) - -ADD_DEFINITIONS(-DGLEW_STATIC) - -IF(WITH_SDL) - SET(INC ${INC} ${SDL_INCLUDE_DIR}) -ELSE(WITH_SDL) - ADD_DEFINITIONS(-DDISABLE_SDL) -ENDIF(WITH_SDL) - -IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) -ELSE(WITH_PYTHON) - ADD_DEFINITIONS(-DDISABLE_PYTHON) -ENDIF(WITH_PYTHON) - -IF(WITH_FFMPEG) - ADD_DEFINITIONS(-DWITH_FFMPEG) -ENDIF(WITH_FFMPEG) - -BLENDERLIB(bf_ketsji "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_ketsji', sources, Split(incs), [], libtype=['game','player'], priority=[25, 72], compileflags = cflags ) diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt deleted file mode 100644 index 40079f3f83e..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -FILE(GLOB SRC *.cpp) - -SET(INC - . - ../../../../source/kernel/gen_system - ../../../../intern/string - ../../../../intern/moto/include - ../../../../source/gameengine/Ketsji - ../../../../source/gameengine/GameLogic - ../../../../source/gameengine/Expressions - ../../../../source/gameengine/SceneGraph - ../../../../source/gameengine/Network -) - -IF(WITH_PYTHON) - SET(INC ${INC} ${PYTHON_INC}) -ELSE(WITH_PYTHON) - ADD_DEFINITIONS(-DDISABLE_PYTHON) -ENDIF(WITH_PYTHON) - -BLENDERLIB(kx_network "${SRC}" "${INC}") -#env.BlenderLib ( 'kx_network', Split(sources), Split(incs), defines=[],libtype=['game2', 'player'], priority=[5, 155] ) diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp deleted file mode 100644 index d922fb63b4f..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Ketsji Logic Extenstion: Network Event Manager generic implementation - */ - -// Ketsji specific sensor part -#include "SCA_ISensor.h" - -// Ketsji specific network part -#include "KX_NetworkEventManager.h" - -// Network module specific -#include "NG_NetworkDeviceInterface.h" -#include "NG_NetworkMessage.h" -#include "NG_NetworkObject.h" - -KX_NetworkEventManager::KX_NetworkEventManager(class SCA_LogicManager* -logicmgr, class NG_NetworkDeviceInterface *ndi) : -SCA_EventManager(logicmgr, NETWORK_EVENTMGR), m_ndi(ndi) -{ - //printf("KX_NetworkEventManager constructor\n"); -} - -KX_NetworkEventManager::~KX_NetworkEventManager() -{ - //printf("KX_NetworkEventManager destructor\n"); -} - -void KX_NetworkEventManager::NextFrame() -{ -// printf("KX_NetworkEventManager::proceed %.2f - %.2f\n", curtime, deltatime); - // each frame, the logicmanager will call the network - // eventmanager to look for network events, and process it's - // 'network' sensors - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { -// printf("KX_NetworkEventManager::proceed sensor %.2f\n", curtime); - // process queue - (*it)->Activate(m_logicmgr); - } - - // now a list of triggerer sensors has been built -} - -void KX_NetworkEventManager::EndFrame() -{ -} - diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h deleted file mode 100644 index 80139c67fd3..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Ketsji Logic Extenstion: Network Event Manager class - */ -#ifndef KX_NETWORK_EVENTMANAGER_H -#define KX_NETWORK_EVENTMANAGER_H - -#include "SCA_EventManager.h" - -class KX_NetworkEventManager : public SCA_EventManager -{ - class NG_NetworkDeviceInterface* m_ndi; - -public: - KX_NetworkEventManager(class SCA_LogicManager* logicmgr, - class NG_NetworkDeviceInterface *ndi); - virtual ~KX_NetworkEventManager (); - - virtual void NextFrame(); - virtual void EndFrame(); - - SCA_LogicManager* GetLogicManager() { return m_logicmgr; } - class NG_NetworkDeviceInterface* GetNetworkDevice() { - return m_ndi; } -}; - -#endif //KX_NETWORK_EVENTMANAGER_H - diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp deleted file mode 100644 index e047a9aa273..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Ketsji Logic Extenstion: Network Message Actuator generic implementation - */ - -#include "NG_NetworkScene.h" -#include "KX_NetworkMessageActuator.h" - -KX_NetworkMessageActuator::KX_NetworkMessageActuator( - SCA_IObject* gameobj, // the actuator controlling object - NG_NetworkScene* networkscene, // needed for replication - const STR_String &toPropName, - const STR_String &subject, - int bodyType, - const STR_String &body) : - SCA_IActuator(gameobj, KX_ACT_MESSAGE), - m_networkscene(networkscene), - m_toPropName(toPropName), - m_subject(subject), - m_bPropBody(bodyType), - m_body(body) -{ -} - -KX_NetworkMessageActuator::~KX_NetworkMessageActuator() -{ -} - -// returns true if the actuators needs to be running over several frames -bool KX_NetworkMessageActuator::Update() -{ - //printf("update messageactuator\n"); - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (bNegativeEvent) { - return false; // do nothing on negative events - //printf("messageactuator false event\n"); - } - //printf("messageactuator true event\n"); - - if (m_bPropBody) // ACT_MESG_PROP in DNA_actuator_types.h - { - m_networkscene->SendMessage( - m_toPropName, - GetParent()->GetName(), - m_subject, - GetParent()->GetPropertyText(m_body)); - } else - { - m_networkscene->SendMessage( - m_toPropName, - GetParent()->GetName(), - m_subject, - m_body); - } - return false; -} - -CValue* KX_NetworkMessageActuator::GetReplica() -{ - KX_NetworkMessageActuator* replica = - new KX_NetworkMessageActuator(*this); - replica->ProcessReplica(); - - return replica; -} - -#ifndef DISABLE_PYTHON - -/* -------------------------------------------------------------------- */ -/* Python interface --------------------------------------------------- */ -/* -------------------------------------------------------------------- */ - -/* Integration hooks -------------------------------------------------- */ -PyTypeObject KX_NetworkMessageActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_NetworkMessageActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_NetworkMessageActuator::Methods[] = { - {NULL,NULL} // Sentinel -}; - -PyAttributeDef KX_NetworkMessageActuator::Attributes[] = { - KX_PYATTRIBUTE_STRING_RW("propName", 0, 100, false, KX_NetworkMessageActuator, m_toPropName), - KX_PYATTRIBUTE_STRING_RW("subject", 0, 100, false, KX_NetworkMessageActuator, m_subject), - KX_PYATTRIBUTE_BOOL_RW("usePropBody", KX_NetworkMessageActuator, m_bPropBody), - KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, KX_NetworkMessageActuator, m_body), - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h deleted file mode 100644 index 62bcca19955..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h +++ /dev/null @@ -1,70 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Ketsji Logic Extenstion: Network Message Actuator class - */ -#ifndef __KX_NETWORKMESSAGEACTUATOR_H -#define __KX_NETWORKMESSAGEACTUATOR_H - -#include "STR_String.h" -#include "SCA_IActuator.h" -#include "NG_NetworkMessage.h" - -class KX_NetworkMessageActuator : public SCA_IActuator -{ - Py_Header; - bool m_lastEvent; - class NG_NetworkScene* m_networkscene; // needed for replication - STR_String m_toPropName; - STR_String m_subject; - bool m_bPropBody; - STR_String m_body; -public: - KX_NetworkMessageActuator( - SCA_IObject* gameobj, - NG_NetworkScene* networkscene, - const STR_String &toPropName, - const STR_String &subject, - int bodyType, - const STR_String &body); - virtual ~KX_NetworkMessageActuator(); - - virtual bool Update(); - virtual CValue* GetReplica(); - virtual void Replace_NetworkScene(NG_NetworkScene *val) - { - m_networkscene= val; - }; - - /* ------------------------------------------------------------ */ - /* Python interface ------------------------------------------- */ - /* ------------------------------------------------------------ */ - -}; - -#endif //__KX_NETWORKMESSAGEACTUATOR_H - diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp deleted file mode 100644 index 56ccac9a93e..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Ketsji Logic Extenstion: Network Message Sensor generic implementation - */ - -#include "KX_NetworkMessageSensor.h" -#include "KX_NetworkEventManager.h" -#include "NG_NetworkMessage.h" -#include "NG_NetworkScene.h" -#include "NG_NetworkObject.h" -#include "SCA_IObject.h" -#include "InputParser.h" -#include "ListValue.h" -#include "StringValue.h" - -#ifdef NAN_NET_DEBUG - #include -#endif - -KX_NetworkMessageSensor::KX_NetworkMessageSensor( - class KX_NetworkEventManager* eventmgr, // our eventmanager - class NG_NetworkScene *NetworkScene, // our scene - SCA_IObject* gameobj, // the sensor controlling object - const STR_String &subject -) : - SCA_ISensor(gameobj,eventmgr), - m_NetworkScene(NetworkScene), - m_subject(subject), - m_frame_message_count (0), - m_BodyList(NULL), - m_SubjectList(NULL) -{ - Init(); -} - -void KX_NetworkMessageSensor::Init() -{ - m_IsUp = false; -} - -KX_NetworkMessageSensor::~KX_NetworkMessageSensor() -{ -} - -CValue* KX_NetworkMessageSensor::GetReplica() { - // This is the standard sensor implementation of GetReplica - // There may be more network message sensor specific stuff to do here. - CValue* replica = new KX_NetworkMessageSensor(*this); - - if (replica == NULL) return NULL; - replica->ProcessReplica(); - - return replica; -} - -// Return true only for flank (UP and DOWN) -bool KX_NetworkMessageSensor::Evaluate() -{ - bool result = false; - bool WasUp = m_IsUp; - - m_IsUp = false; - - if (m_BodyList) { - m_BodyList->Release(); - m_BodyList = NULL; - } - - if (m_SubjectList) { - m_SubjectList->Release(); - m_SubjectList = NULL; - } - - STR_String& toname=GetParent()->GetName(); - STR_String& subject = this->m_subject; - - vector messages = - m_NetworkScene->FindMessages(toname,"",subject,true); - - m_frame_message_count = messages.size(); - - if (!messages.empty()) { -#ifdef NAN_NET_DEBUG - printf("KX_NetworkMessageSensor found one or more messages\n"); -#endif - m_IsUp = true; - m_BodyList = new CListValue(); - m_SubjectList = new CListValue(); - } - - vector::iterator mesit; - for (mesit=messages.begin();mesit!=messages.end();mesit++) - { - // save the body - const STR_String& body = (*mesit)->GetMessageText(); - // save the subject - const STR_String& messub = (*mesit)->GetSubject(); -#ifdef NAN_NET_DEBUG - if (body) { - cout << "body [" << body << "]\n"; - } -#endif - m_BodyList->Add(new CStringValue(body,"body")); - // Store Subject - m_SubjectList->Add(new CStringValue(messub,"subject")); - - // free the message - (*mesit)->Release(); - } - messages.clear(); - - result = (WasUp != m_IsUp); - - // Return always true if a message was received otherwise we can loose messages - if (m_IsUp) - return true; - // Is it usefull to return also true when the first frame without a message?? - // This will cause a fast on/off cycle that seems useless! - return result; -} - -// return true for being up (no flank needed) -bool KX_NetworkMessageSensor::IsPositiveTrigger() -{ -// printf("KX_NetworkMessageSensor IsPositiveTrigger\n"); - //attempt to fix [ #3809 ] IPO Actuator does not work with some Sensors - //a better solution is to properly introduce separate Edge and Level triggering concept - - return m_IsUp; -} - -#ifndef DISABLE_PYTHON - -/* --------------------------------------------------------------------- */ -/* Python interface ---------------------------------------------------- */ -/* --------------------------------------------------------------------- */ - -/* Integration hooks --------------------------------------------------- */ -PyTypeObject KX_NetworkMessageSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_NetworkMessageSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_NetworkMessageSensor::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_NetworkMessageSensor::Attributes[] = { - KX_PYATTRIBUTE_STRING_RW("subject", 0, 100, false, KX_NetworkMessageSensor, m_subject), - KX_PYATTRIBUTE_INT_RO("frameMessageCount", KX_NetworkMessageSensor, m_frame_message_count), - KX_PYATTRIBUTE_RO_FUNCTION("bodies", KX_NetworkMessageSensor, pyattr_get_bodies), - KX_PYATTRIBUTE_RO_FUNCTION("subjects", KX_NetworkMessageSensor, pyattr_get_subjects), - { NULL } //Sentinel -}; - -PyObject* KX_NetworkMessageSensor::pyattr_get_bodies(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_NetworkMessageSensor *self = static_cast(self_v); - if (self->m_BodyList) { - return self->m_BodyList->GetProxy(); - } else { - return (new CListValue())->NewProxy(true); - } -} - -PyObject* KX_NetworkMessageSensor::pyattr_get_subjects(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_NetworkMessageSensor *self = static_cast(self_v); - if (self->m_SubjectList) { - return self->m_SubjectList->GetProxy(); - } else { - return (new CListValue())->NewProxy(true); - } -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h deleted file mode 100644 index 1efd25dd65f..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h +++ /dev/null @@ -1,89 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Ketsji Logic Extenstion: Network Message Sensor class - */ -#ifndef __KX_NETWORKMESSAGE_SENSOR_H -#define __KX_NETWORKMESSAGE_SENSOR_H - -#include "SCA_ISensor.h" - -class KX_NetworkEventManager; -class NG_NetworkScene; - -class KX_NetworkMessageSensor : public SCA_ISensor -{ - // note: Py_Header MUST BE the first listed here - Py_Header; - NG_NetworkScene *m_NetworkScene; - - // The subject we filter on. - STR_String m_subject; - - // The number of messages caught since the last frame. - int m_frame_message_count; - - bool m_IsUp; - - class CListValue* m_BodyList; - class CListValue* m_SubjectList; -public: - KX_NetworkMessageSensor( - KX_NetworkEventManager* eventmgr, // our eventmanager - NG_NetworkScene *NetworkScene, // our scene - SCA_IObject* gameobj, // the sensor controlling object - const STR_String &subject - ); - virtual ~KX_NetworkMessageSensor(); - - virtual CValue* GetReplica(); - virtual bool Evaluate(); - virtual bool IsPositiveTrigger(); - virtual void Init(); - void EndFrame(); - - virtual void Replace_NetworkScene(NG_NetworkScene *val) - { - m_NetworkScene= val; - }; - -#ifndef DISABLE_PYTHON - - /* ------------------------------------------------------------- */ - /* Python interface -------------------------------------------- */ - /* ------------------------------------------------------------- */ - - /* attributes */ - static PyObject* pyattr_get_bodies(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_subjects(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - -#endif // DISABLE_PYTHON - -}; - -#endif //__KX_NETWORKMESSAGE_SENSOR_H - diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp deleted file mode 100644 index 5350c32fff7..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.h deleted file mode 100644 index aca0805c337..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp deleted file mode 100644 index aca0805c337..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.h deleted file mode 100644 index aca0805c337..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - diff --git a/source/gameengine/Ketsji/KXNetwork/Makefile b/source/gameengine/Ketsji/KXNetwork/Makefile deleted file mode 100644 index 365ed8fc9c3..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = KXNetwork -DIR = $(OCGDIR)/gameengine/ketsji/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) - -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I../../Expressions -CPPFLAGS += -I../../GameLogic -CPPFLAGS += -I../../SceneGraph -CPPFLAGS += -I../../Network -CPPFLAGS += -I../../../kernel/gen_system -CPPFLAGS += -I.. - diff --git a/source/gameengine/Ketsji/KXNetwork/SConscript b/source/gameengine/Ketsji/KXNetwork/SConscript deleted file mode 100644 index 64d00489c89..00000000000 --- a/source/gameengine/Ketsji/KXNetwork/SConscript +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = env.Glob('*.cpp') - -incs = '. #source/kernel/gen_system #intern/string #intern/moto/include #source/gameengine/Ketsji' -incs += ' #source/gameengine/GameLogic #source/gameengine/Expressions' -incs += ' #source/gameengine/Network #source/gameengine/SceneGraph' - -defs = [] - -if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] -else: - defs.append('DISABLE_PYTHON') - -env.BlenderLib ( 'bf_network', Split(sources), Split(incs), defines=defs,libtype=['core','player'], priority=[400,125], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Ketsji/KX_ArmatureSensor.cpp b/source/gameengine/Ketsji/KX_ArmatureSensor.cpp deleted file mode 100644 index a47a1972beb..00000000000 --- a/source/gameengine/Ketsji/KX_ArmatureSensor.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/** - * Armature sensor - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "DNA_action_types.h" -#include "DNA_constraint_types.h" -#include "BKE_constraint.h" -#include "DNA_sensor_types.h" - -#include "BL_ArmatureObject.h" -#include "KX_ArmatureSensor.h" -#include "SCA_EventManager.h" -#include "SCA_LogicManager.h" - -KX_ArmatureSensor::KX_ArmatureSensor(class SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - const char *posechannel, - const char *constraintname, - int type, - float value) - : SCA_ISensor(gameobj,eventmgr), - m_constraint(NULL), - m_posechannel(posechannel), - m_constraintname(constraintname), - m_type(type), - m_value(value) -{ - FindConstraint(); -} - -void KX_ArmatureSensor::Init() -{ - m_lastresult = m_invert?true:false; - m_result = false; - m_reset = true; -} - -void KX_ArmatureSensor::FindConstraint() -{ - m_constraint = NULL; - - if (m_gameobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) { - BL_ArmatureObject* armobj = (BL_ArmatureObject*)m_gameobj; - // get the persistent pose structure - bPose* pose = armobj->GetOrigPose(); - bPoseChannel* pchan; - bConstraint* pcon; - // and locate the constraint - for (pchan = (bPoseChannel*)pose->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { - if (!strcmp(pchan->name, m_posechannel)) { - // now locate the constraint - for (pcon = (bConstraint*)pchan->constraints.first; pcon; pcon=(bConstraint*)pcon->next) { - if (!strcmp(pcon->name, m_constraintname)) { - if (pcon->flag & CONSTRAINT_DISABLE) - /* this constraint is not valid, can't use it */ - break; - m_constraint = pcon; - break; - } - } - break; - } - } - } -} - - -CValue* KX_ArmatureSensor::GetReplica() -{ - KX_ArmatureSensor* replica = new KX_ArmatureSensor(*this); - // m_range_expr must be recalculated on replica! - replica->ProcessReplica(); - return replica; -} - -void KX_ArmatureSensor::ReParent(SCA_IObject* parent) -{ - SCA_ISensor::ReParent(parent); - // must remap the constraint - FindConstraint(); -} - -bool KX_ArmatureSensor::IsPositiveTrigger() -{ - return (m_invert) ? !m_result : m_result; -} - - -KX_ArmatureSensor::~KX_ArmatureSensor() -{ -} - -bool KX_ArmatureSensor::Evaluate() -{ - bool reset = m_reset && m_level; - - m_reset = false; - if (!m_constraint) - return false; - switch (m_type) { - case SENS_ARM_STATE_CHANGED: - m_result = !(m_constraint->flag & CONSTRAINT_OFF); - break; - case SENS_ARM_LIN_ERROR_BELOW: - m_result = (m_constraint->lin_error < m_value); - break; - case SENS_ARM_LIN_ERROR_ABOVE: - m_result = (m_constraint->lin_error > m_value); - break; - case SENS_ARM_ROT_ERROR_BELOW: - m_result = (m_constraint->rot_error < m_value); - break; - case SENS_ARM_ROT_ERROR_ABOVE: - m_result = (m_constraint->rot_error > m_value); - break; - } - if (m_lastresult!=m_result) - { - m_lastresult = m_result; - return true; - } - return (reset) ? true : false; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_ArmatureSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_ArmatureSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_ArmatureSensor::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_ArmatureSensor::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("constraint", KX_ArmatureSensor, pyattr_get_constraint), - KX_PYATTRIBUTE_FLOAT_RW("value",-FLT_MAX,FLT_MAX,KX_ArmatureSensor,m_value), - KX_PYATTRIBUTE_INT_RW("type",0,SENS_ARM_MAXTYPE,false,KX_ArmatureSensor,m_type), - { NULL } //Sentinel -}; - -PyObject* KX_ArmatureSensor::pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_ArmatureSensor* sensor = static_cast(self); - if (sensor->m_gameobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) { - BL_ArmatureObject* armobj = (BL_ArmatureObject*)sensor->m_gameobj; - BL_ArmatureConstraint* constraint = armobj->GetConstraint(sensor->m_posechannel, sensor->m_constraintname); - if (constraint) - return constraint->GetProxy(); - } - Py_RETURN_NONE; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_ArmatureSensor.h b/source/gameengine/Ketsji/KX_ArmatureSensor.h deleted file mode 100644 index 636309f5bdf..00000000000 --- a/source/gameengine/Ketsji/KX_ArmatureSensor.h +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Property sensor - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_ARMATURESENSOR -#define __KX_ARMATURESENSOR - -struct bConstraint; - -#include "SCA_ISensor.h" -#include "DNA_sensor_types.h" - -class KX_ArmatureSensor : public SCA_ISensor -{ - Py_Header; - //class CExpression* m_rightexpr; - -protected: - -public: - KX_ArmatureSensor(class SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - const char *posechannel, - const char *constraintname, - int type, - float value); - - /** - * For property sensor, it is used to release the pre-calculated expression - * so that self references are removed before the sensor itself is released - */ - virtual ~KX_ArmatureSensor(); - virtual CValue* GetReplica(); - virtual void ReParent(SCA_IObject* parent); - virtual void Init(); - virtual bool Evaluate(); - virtual bool IsPositiveTrigger(); - - // identify the constraint that this actuator controls - void FindConstraint(); - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - static PyObject* pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - -#endif // DISABLE_PYTHON - -private: - struct bConstraint* m_constraint; - STR_String m_posechannel; - STR_String m_constraintname; - int m_type; - float m_value; - bool m_result; - bool m_lastresult; -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp deleted file mode 100644 index 2ef7e55429f..00000000000 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ /dev/null @@ -1,939 +0,0 @@ - -// ------------------------------------ -// ... -// ------------------------------------ -#include "GL/glew.h" - -#include "KX_BlenderMaterial.h" -#include "BL_Material.h" -#include "KX_Scene.h" -#include "KX_Light.h" -#include "KX_GameObject.h" -#include "KX_MeshProxy.h" - -#include "MT_Vector3.h" -#include "MT_Vector4.h" -#include "MT_Matrix4x4.h" - -#include "RAS_BucketManager.h" -#include "RAS_MeshObject.h" -#include "RAS_IRasterizer.h" -#include "RAS_OpenGLRasterizer/RAS_GLExtensionManager.h" - -#include "GPU_draw.h" - -#include "STR_HashedString.h" - -// ------------------------------------ -#include "DNA_object_types.h" -#include "DNA_material_types.h" -#include "DNA_image_types.h" -#include "DNA_meshdata_types.h" -#include "BKE_mesh.h" -// ------------------------------------ -#define spit(x) std::cout << x << std::endl; - -BL_Shader *KX_BlenderMaterial::mLastShader = NULL; -BL_BlenderShader *KX_BlenderMaterial::mLastBlenderShader = NULL; - -//static PyObject *gTextureDict = 0; - -KX_BlenderMaterial::KX_BlenderMaterial() -: PyObjectPlus(), - RAS_IPolyMaterial(), - mMaterial(NULL), - mShader(0), - mBlenderShader(0), - mScene(NULL), - mUserDefBlend(0), - mModified(0), - mConstructed(false), - mPass(0) -{ -} - -void KX_BlenderMaterial::Initialize( - KX_Scene *scene, - BL_Material *data) -{ - RAS_IPolyMaterial::Initialize( - data->texname[0], - data->matname, - data->materialindex, - data->tile, - data->tilexrep[0], - data->tileyrep[0], - data->mode, - data->transp, - ((data->ras_mode &ALPHA)!=0), - ((data->ras_mode &ZSORT)!=0) - ); - mMaterial = data; - mShader = 0; - mBlenderShader = 0; - mScene = scene; - mUserDefBlend = 0; - mModified = 0; - mConstructed = false; - mPass = 0; - // -------------------------------- - // RAS_IPolyMaterial variables... - m_flag |= RAS_BLENDERMAT; - m_flag |= (mMaterial->IdMode>=ONETEX)? RAS_MULTITEX: 0; - m_flag |= ((mMaterial->ras_mode & USE_LIGHT)!=0)? RAS_MULTILIGHT: 0; - m_flag |= (mMaterial->glslmat)? RAS_BLENDERGLSL: 0; - - // figure max - int enabled = mMaterial->num_enabled; - int max = BL_Texture::GetMaxUnits(); - mMaterial->num_enabled = enabled>=max?max:enabled; - - // test the sum of the various modes for equality - // so we can ether accept or reject this material - // as being equal, this is rather important to - // prevent material bleeding - for(int i=0; inum_enabled; i++) { - m_multimode += - ( mMaterial->flag[i] + - mMaterial->blend_mode[i] - ); - } - m_multimode += mMaterial->IdMode+ (mMaterial->ras_mode & ~(COLLIDER|USE_LIGHT)); -} - -KX_BlenderMaterial::~KX_BlenderMaterial() -{ - // cleanup work - if (mConstructed) - // clean only if material was actually used - OnExit(); -} - -MTFace* KX_BlenderMaterial::GetMTFace(void) const -{ - // fonts on polys - MT_assert(mMaterial->tface); - return mMaterial->tface; -} - -unsigned int* KX_BlenderMaterial::GetMCol(void) const -{ - // fonts on polys - return mMaterial->rgb; -} - -void KX_BlenderMaterial::GetMaterialRGBAColor(unsigned char *rgba) const -{ - if (mMaterial) { - *rgba++ = (unsigned char) (mMaterial->matcolor[0]*255.0); - *rgba++ = (unsigned char) (mMaterial->matcolor[1]*255.0); - *rgba++ = (unsigned char) (mMaterial->matcolor[2]*255.0); - *rgba++ = (unsigned char) (mMaterial->matcolor[3]*255.0); - } else - RAS_IPolyMaterial::GetMaterialRGBAColor(rgba); -} - -Material *KX_BlenderMaterial::GetBlenderMaterial() const -{ - return mMaterial->material; -} - -Scene* KX_BlenderMaterial::GetBlenderScene() const -{ - return mScene->GetBlenderScene(); -} - -void KX_BlenderMaterial::ReleaseMaterial() -{ - if (mBlenderShader) - mBlenderShader->ReloadMaterial(); -} - -void KX_BlenderMaterial::OnConstruction(int layer) -{ - if (mConstructed) - // when material are reused between objects - return; - - if(mMaterial->glslmat) - SetBlenderGLSLShader(layer); - - // for each unique material... - int i; - for(i=0; inum_enabled; i++) { - if( mMaterial->mapping[i].mapping & USEENV ) { - if(!GLEW_ARB_texture_cube_map) { - spit("CubeMap textures not supported"); - continue; - } - if(!mTextures[i].InitCubeMap(i, mMaterial->cubemap[i] ) ) - spit("unable to initialize image("<matname<< ", image will not be available"); - } - - else { - if( mMaterial->img[i] ) { - if( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 )) - spit("unable to initialize image("<matname<< ", image will not be available"); - } - } - } - - mBlendFunc[0] =0; - mBlendFunc[1] =0; - mConstructed = true; -} - -void KX_BlenderMaterial::EndFrame() -{ - if(mLastBlenderShader) { - mLastBlenderShader->SetProg(false); - mLastBlenderShader = NULL; - } - - if(mLastShader) { - mLastShader->SetProg(false); - mLastShader = NULL; - } -} - -void KX_BlenderMaterial::OnExit() -{ - if( mShader ) { - //note, the shader here is allocated, per unique material - //and this function is called per face - if(mShader == mLastShader) { - mShader->SetProg(false); - mLastShader = NULL; - } - - delete mShader; - mShader = 0; - } - - if( mBlenderShader ) { - if(mBlenderShader == mLastBlenderShader) { - mBlenderShader->SetProg(false); - mLastBlenderShader = NULL; - } - - delete mBlenderShader; - mBlenderShader = 0; - } - - BL_Texture::ActivateFirst(); - for(int i=0; inum_enabled; i++) { - BL_Texture::ActivateUnit(i); - mTextures[i].DeleteTex(); - mTextures[i].DisableUnit(); - } - - if( mMaterial->tface ) - GPU_set_tpage(mMaterial->tface, 1); -} - - -void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras) -{ - MT_assert(GLEW_ARB_shader_objects && mShader); - - int i; - if( !enable || !mShader->Ok() ) { - // frame cleanup. - if(mShader == mLastShader) { - mShader->SetProg(false); - mLastShader = NULL; - } - - ras->SetBlendingMode(TF_SOLID); - BL_Texture::DisableAllTextures(); - return; - } - - BL_Texture::DisableAllTextures(); - mShader->SetProg(true); - mLastShader = mShader; - - BL_Texture::ActivateFirst(); - - mShader->ApplyShader(); - - // for each enabled unit - for(i=0; inum_enabled; i++) { - if(!mTextures[i].Ok()) continue; - mTextures[i].ActivateTexture(); - mTextures[0].SetMapping(mMaterial->mapping[i].mapping); - } - - if(!mUserDefBlend) { - ras->SetBlendingMode(mMaterial->transp); - } - else { - ras->SetBlendingMode(TF_SOLID); - ras->SetBlendingMode(-1); // indicates custom mode - - // tested to be valid enums - glEnable(GL_BLEND); - glBlendFunc(mBlendFunc[0], mBlendFunc[1]); - } -} - -void KX_BlenderMaterial::setBlenderShaderData( bool enable, RAS_IRasterizer *ras) -{ - if( !enable || !mBlenderShader->Ok() ) { - ras->SetBlendingMode(TF_SOLID); - - // frame cleanup. - if(mLastBlenderShader) { - mLastBlenderShader->SetProg(false); - mLastBlenderShader= NULL; - } - else - BL_Texture::DisableAllTextures(); - - return; - } - - if(!mBlenderShader->Equals(mLastBlenderShader)) { - ras->SetBlendingMode(mMaterial->transp); - - if(mLastBlenderShader) - mLastBlenderShader->SetProg(false); - else - BL_Texture::DisableAllTextures(); - - mBlenderShader->SetProg(true, ras->GetTime()); - mLastBlenderShader= mBlenderShader; - } -} - -void KX_BlenderMaterial::setTexData( bool enable, RAS_IRasterizer *ras) -{ - BL_Texture::DisableAllTextures(); - - if( !enable ) { - ras->SetBlendingMode(TF_SOLID); - return; - } - - BL_Texture::ActivateFirst(); - - if( mMaterial->IdMode == DEFAULT_BLENDER ) { - ras->SetBlendingMode(mMaterial->transp); - return; - } - - if( mMaterial->IdMode == TEXFACE ) { - // no material connected to the object - if( mTextures[0].Ok() ) { - mTextures[0].ActivateTexture(); - mTextures[0].setTexEnv(0, true); - mTextures[0].SetMapping(mMaterial->mapping[0].mapping); - ras->SetBlendingMode(mMaterial->transp); - } - return; - } - - int mode = 0,i=0; - for(i=0; (inum_enabled && imapping[i].mapping; - - if(mode &USEOBJ) - setObjectMatrixData(i, ras); - else - mTextures[i].SetMapping(mode); - - if(!(mode &USEOBJ)) - setTexMatrixData( i ); - } - - if(!mUserDefBlend) { - ras->SetBlendingMode(mMaterial->transp); - } - else { - ras->SetBlendingMode(TF_SOLID); - ras->SetBlendingMode(-1); // indicates custom mode - - glEnable(GL_BLEND); - glBlendFunc(mBlendFunc[0], mBlendFunc[1]); - } -} - -void -KX_BlenderMaterial::ActivatShaders( - RAS_IRasterizer* rasty, - TCachingInfo& cachingInfo)const -{ - KX_BlenderMaterial *tmp = const_cast(this); - - // reset... - if(tmp->mMaterial->IsShared()) - cachingInfo =0; - - if(mLastBlenderShader) { - mLastBlenderShader->SetProg(false); - mLastBlenderShader= NULL; - } - - if (GetCachingInfo() != cachingInfo) { - - if (!cachingInfo) - tmp->setShaderData(false, rasty); - - cachingInfo = GetCachingInfo(); - - if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) - tmp->setShaderData(true, rasty); - else - tmp->setShaderData(false, rasty); - - if(mMaterial->mode & RAS_IRasterizer::KX_TWOSIDE) - rasty->SetCullFace(false); - else - rasty->SetCullFace(true); - - if (((mMaterial->ras_mode &WIRE)!=0) || (mMaterial->mode & RAS_IRasterizer::KX_LINES) || - (rasty->GetDrawingMode() <= RAS_IRasterizer::KX_WIREFRAME)) - { - if((mMaterial->ras_mode &WIRE)!=0) - rasty->SetCullFace(false); - rasty->SetLines(true); - } - else - rasty->SetLines(false); - ActivatGLMaterials(rasty); - ActivateTexGen(rasty); - } - - //ActivatGLMaterials(rasty); - //ActivateTexGen(rasty); -} - -void -KX_BlenderMaterial::ActivateBlenderShaders( - RAS_IRasterizer* rasty, - TCachingInfo& cachingInfo)const -{ - KX_BlenderMaterial *tmp = const_cast(this); - - if(mLastShader) { - mLastShader->SetProg(false); - mLastShader= NULL; - } - - if (GetCachingInfo() != cachingInfo) { - if (!cachingInfo) - tmp->setBlenderShaderData(false, rasty); - - cachingInfo = GetCachingInfo(); - - if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) - tmp->setBlenderShaderData(true, rasty); - else - tmp->setBlenderShaderData(false, rasty); - - if(mMaterial->mode & RAS_IRasterizer::KX_TWOSIDE) - rasty->SetCullFace(false); - else - rasty->SetCullFace(true); - - if (((mMaterial->ras_mode & WIRE)!=0) || (mMaterial->mode & RAS_IRasterizer::KX_LINES) || - (rasty->GetDrawingMode() <= RAS_IRasterizer::KX_WIREFRAME)) - { - if((mMaterial->ras_mode &WIRE)!=0) - rasty->SetCullFace(false); - rasty->SetLines(true); - } - else - rasty->SetLines(false); - - ActivatGLMaterials(rasty); - mBlenderShader->SetAttribs(rasty, mMaterial); - } -} - -void -KX_BlenderMaterial::ActivateMat( - RAS_IRasterizer* rasty, - TCachingInfo& cachingInfo - )const -{ - KX_BlenderMaterial *tmp = const_cast(this); - - if(mLastShader) { - mLastShader->SetProg(false); - mLastShader= NULL; - } - - if(mLastBlenderShader) { - mLastBlenderShader->SetProg(false); - mLastBlenderShader= NULL; - } - - if (GetCachingInfo() != cachingInfo) { - if (!cachingInfo) - tmp->setTexData( false,rasty ); - - cachingInfo = GetCachingInfo(); - - if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) - tmp->setTexData( true,rasty ); - else - tmp->setTexData( false,rasty); - - if(mMaterial->mode & RAS_IRasterizer::KX_TWOSIDE) - rasty->SetCullFace(false); - else - rasty->SetCullFace(true); - - if (((mMaterial->ras_mode &WIRE)!=0) || (mMaterial->mode & RAS_IRasterizer::KX_LINES) || - (rasty->GetDrawingMode() <= RAS_IRasterizer::KX_WIREFRAME)) - { - if((mMaterial->ras_mode &WIRE)!=0) - rasty->SetCullFace(false); - rasty->SetLines(true); - } - else - rasty->SetLines(false); - ActivatGLMaterials(rasty); - ActivateTexGen(rasty); - } - - //ActivatGLMaterials(rasty); - //ActivateTexGen(rasty); -} - -bool -KX_BlenderMaterial::Activate( - RAS_IRasterizer* rasty, - TCachingInfo& cachingInfo - )const -{ - if(GLEW_ARB_shader_objects && (mShader && mShader->Ok())) { - if((mPass++) < mShader->getNumPass() ) { - ActivatShaders(rasty, cachingInfo); - return true; - } - else { - if(mShader == mLastShader) { - mShader->SetProg(false); - mLastShader = NULL; - } - mPass = 0; - return false; - } - } - else if( GLEW_ARB_shader_objects && (mBlenderShader && mBlenderShader->Ok() ) ) { - if(mPass++ == 0) { - ActivateBlenderShaders(rasty, cachingInfo); - return true; - } - else { - mPass = 0; - return false; - } - } - else { - if(mPass++ == 0) { - ActivateMat(rasty, cachingInfo); - return true; - } - else { - mPass = 0; - return false; - } - } -} - -bool KX_BlenderMaterial::UsesLighting(RAS_IRasterizer *rasty) const -{ - if(!RAS_IPolyMaterial::UsesLighting(rasty)) - return false; - - if(mShader && mShader->Ok()) - return true; - else if(mBlenderShader && mBlenderShader->Ok()) - return false; - else - return true; -} - -void KX_BlenderMaterial::ActivateMeshSlot(const RAS_MeshSlot & ms, RAS_IRasterizer* rasty) const -{ - if(mShader && GLEW_ARB_shader_objects) { - mShader->Update(ms, rasty); - } - else if(mBlenderShader && GLEW_ARB_shader_objects) { - int blendmode; - - mBlenderShader->Update(ms, rasty); - - /* we do blend modes here, because they can change per object - * with the same material due to obcolor/obalpha */ - blendmode = mBlenderShader->GetBlendMode(); - if((blendmode == TF_SOLID || blendmode == TF_ALPHA) && mMaterial->transp != TF_SOLID) - blendmode = mMaterial->transp; - - rasty->SetBlendingMode(blendmode); - } -} - -void KX_BlenderMaterial::ActivatGLMaterials( RAS_IRasterizer* rasty )const -{ - if(mShader || !mBlenderShader) { - rasty->SetSpecularity( - mMaterial->speccolor[0]*mMaterial->spec_f, - mMaterial->speccolor[1]*mMaterial->spec_f, - mMaterial->speccolor[2]*mMaterial->spec_f, - mMaterial->spec_f - ); - - rasty->SetShinyness( mMaterial->hard ); - - rasty->SetDiffuse( - mMaterial->matcolor[0]*mMaterial->ref+mMaterial->emit, - mMaterial->matcolor[1]*mMaterial->ref+mMaterial->emit, - mMaterial->matcolor[2]*mMaterial->ref+mMaterial->emit, - 1.0f); - - rasty->SetEmissive( - mMaterial->matcolor[0]*mMaterial->emit, - mMaterial->matcolor[1]*mMaterial->emit, - mMaterial->matcolor[2]*mMaterial->emit, - 1.0 ); - - rasty->SetAmbient(mMaterial->amb); - } - - if (mMaterial->material) - rasty->SetPolygonOffset(-mMaterial->material->zoffs, 0.0); -} - - -void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const -{ - if(ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) { - ras->SetAttribNum(0); - if(mShader && GLEW_ARB_shader_objects) { - if(mShader->GetAttribute() == BL_Shader::SHD_TANGENT) { - ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, 0); - ras->SetAttrib(RAS_IRasterizer::RAS_TEXTANGENT, 1); - ras->SetAttribNum(2); - } - } - - ras->SetTexCoordNum(mMaterial->num_enabled); - - for(int i=0; inum_enabled; i++) { - int mode = mMaterial->mapping[i].mapping; - - if (mode &USECUSTOMUV) - { - if (!mMaterial->mapping[i].uvCoName.IsEmpty()) - ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_UV2, i); - continue; - } - - if( mode &(USEREFL|USEOBJ)) - ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_GEN, i); - else if(mode &USEORCO) - ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_ORCO, i); - else if(mode &USENORM) - ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_NORM, i); - else if(mode &USEUV) - ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_UV1, i); - else if(mode &USETANG) - ras->SetTexCoord(RAS_IRasterizer::RAS_TEXTANGENT, i); - else - ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_DISABLE, i); - } - } -} - -void KX_BlenderMaterial::setTexMatrixData(int i) -{ - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - - if( GLEW_ARB_texture_cube_map && - mTextures[i].GetTextureType() == GL_TEXTURE_CUBE_MAP_ARB && - mMaterial->mapping[i].mapping & USEREFL) { - glScalef( - mMaterial->mapping[i].scale[0], - -mMaterial->mapping[i].scale[1], - -mMaterial->mapping[i].scale[2] - ); - } - else - { - glScalef( - mMaterial->mapping[i].scale[0], - mMaterial->mapping[i].scale[1], - mMaterial->mapping[i].scale[2] - ); - } - glTranslatef( - mMaterial->mapping[i].offsets[0], - mMaterial->mapping[i].offsets[1], - mMaterial->mapping[i].offsets[2] - ); - - glMatrixMode(GL_MODELVIEW); - -} - -static void GetProjPlane(BL_Material *mat, int index,int num, float*param) -{ - param[0]=param[1]=param[2]=param[3]=0.f; - if( mat->mapping[index].projplane[num] == PROJX ) - param[0] = 1.f; - else if( mat->mapping[index].projplane[num] == PROJY ) - param[1] = 1.f; - else if( mat->mapping[index].projplane[num] == PROJZ) - param[2] = 1.f; -} - -void KX_BlenderMaterial::setObjectMatrixData(int i, RAS_IRasterizer *ras) -{ - KX_GameObject *obj = - (KX_GameObject*) - mScene->GetObjectList()->FindValue(mMaterial->mapping[i].objconame); - - if(!obj) return; - - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); - glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); - - GLenum plane = GL_EYE_PLANE; - - // figure plane gen - float proj[4]= {0.f,0.f,0.f,0.f}; - GetProjPlane(mMaterial, i, 0, proj); - glTexGenfv(GL_S, plane, proj); - - GetProjPlane(mMaterial, i, 1, proj); - glTexGenfv(GL_T, plane, proj); - - GetProjPlane(mMaterial, i, 2, proj); - glTexGenfv(GL_R, plane, proj); - - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glEnable(GL_TEXTURE_GEN_R); - - const MT_Matrix4x4& mvmat = ras->GetViewMatrix(); - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glScalef( - mMaterial->mapping[i].scale[0], - mMaterial->mapping[i].scale[1], - mMaterial->mapping[i].scale[2] - ); - - MT_Point3 pos = obj->NodeGetWorldPosition(); - MT_Vector4 matmul = MT_Vector4(pos[0], pos[1], pos[2], 1.f); - MT_Vector4 t = mvmat*matmul; - - glTranslatef( (float)(-t[0]), (float)(-t[1]), (float)(-t[2]) ); - - glMatrixMode(GL_MODELVIEW); - -} - -// ------------------------------------ -void KX_BlenderMaterial::UpdateIPO( - MT_Vector4 rgba, - MT_Vector3 specrgb, - MT_Scalar hard, - MT_Scalar spec, - MT_Scalar ref, - MT_Scalar emit, - MT_Scalar alpha - ) -{ - // only works one deep now - mMaterial->speccolor[0] = (float)(specrgb)[0]; - mMaterial->speccolor[1] = (float)(specrgb)[1]; - mMaterial->speccolor[2] = (float)(specrgb)[2]; - mMaterial->matcolor[0] = (float)(rgba[0]); - mMaterial->matcolor[1] = (float)(rgba[1]); - mMaterial->matcolor[2] = (float)(rgba[2]); - mMaterial->alpha = (float)(alpha); - mMaterial->hard = (float)(hard); - mMaterial->emit = (float)(emit); - mMaterial->spec_f = (float)(spec); - mMaterial->ref = (float)(ref); -} - -void KX_BlenderMaterial::SetBlenderGLSLShader(int layer) -{ - if(!mBlenderShader) - mBlenderShader = new BL_BlenderShader(mScene, mMaterial->material, layer); - - if(!mBlenderShader->Ok()) { - delete mBlenderShader; - mBlenderShader = 0; - } -} - -#ifndef DISABLE_PYTHON - -PyMethodDef KX_BlenderMaterial::Methods[] = -{ - KX_PYMETHODTABLE( KX_BlenderMaterial, getShader ), - KX_PYMETHODTABLE( KX_BlenderMaterial, getMaterialIndex ), - KX_PYMETHODTABLE( KX_BlenderMaterial, setBlending ), - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_BlenderMaterial::Attributes[] = { - //KX_PYATTRIBUTE_TODO("shader"), - //KX_PYATTRIBUTE_TODO("materialIndex"), - //KX_PYATTRIBUTE_TODO("blending"), - { NULL } //Sentinel -}; - -PyTypeObject KX_BlenderMaterial::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_BlenderMaterial", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &PyObjectPlus::Type, - 0,0,0,0,0,0, - py_base_new -}; - -KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()") -{ - if( !GLEW_ARB_fragment_shader) { - if(!mModified) - spit("Fragment shaders not supported"); - - mModified = true; - Py_RETURN_NONE; - } - - if( !GLEW_ARB_vertex_shader) { - if(!mModified) - spit("Vertex shaders not supported"); - - mModified = true; - Py_RETURN_NONE; - } - - if(!GLEW_ARB_shader_objects) { - if(!mModified) - spit("GLSL not supported"); - mModified = true; - Py_RETURN_NONE; - } - else { - // returns Py_None on error - // the calling script will need to check - - if(!mShader && !mModified) { - mShader = new BL_Shader(); - mModified = true; - } - - if(mShader && !mShader->GetError()) { - m_flag &= ~RAS_BLENDERGLSL; - mMaterial->SetSharedMaterial(true); - mScene->GetBucketManager()->ReleaseDisplayLists(this); - return mShader->GetProxy(); - }else - { - // decref all references to the object - // then delete it! - // We will then go back to fixed functionality - // for this material - if(mShader) { - delete mShader; /* will handle python de-referencing */ - mShader=0; - } - } - Py_RETURN_NONE; - } - PyErr_SetString(PyExc_ValueError, "material.getShader(): KX_BlenderMaterial, GLSL Error"); - return NULL; -} - -KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getMaterialIndex, "getMaterialIndex()") -{ - return PyLong_FromSsize_t( GetMaterialIndex() ); -} - -KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getTexture, "getTexture( index )" ) -{ - // TODO: enable python switching - return NULL; -} - -KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setTexture , "setTexture( index, tex)") -{ - // TODO: enable python switching - return NULL; -} - -static unsigned int GL_array[11] = { - GL_ZERO, - GL_ONE, - GL_SRC_COLOR, - GL_ONE_MINUS_SRC_COLOR, - GL_DST_COLOR, - GL_ONE_MINUS_DST_COLOR, - GL_SRC_ALPHA, - GL_ONE_MINUS_SRC_ALPHA, - GL_DST_ALPHA, - GL_ONE_MINUS_DST_ALPHA, - GL_SRC_ALPHA_SATURATE -}; - -KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( GameLogic.src, GameLogic.dest)") -{ - unsigned int b[2]; - if(PyArg_ParseTuple(args, "ii:setBlending", &b[0], &b[1])) - { - bool value_found[2] = {false, false}; - for(int i=0; i<11; i++) - { - if(b[0] == GL_array[i]) { - value_found[0] = true; - mBlendFunc[0] = b[0]; - } - if(b[1] == GL_array[i]) { - value_found[1] = true; - mBlendFunc[1] = b[1]; - } - if(value_found[0] && value_found[1]) break; - } - if(!value_found[0] || !value_found[1]) { - PyErr_SetString(PyExc_ValueError, "material.setBlending(int, int): KX_BlenderMaterial, invalid enum."); - return NULL; - } - mUserDefBlend = true; - Py_RETURN_NONE; - } - return NULL; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h deleted file mode 100644 index c5f5e23c6e7..00000000000 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.h +++ /dev/null @@ -1,154 +0,0 @@ -#ifndef __KX_BLENDER_MATERIAL_H__ -#define __KX_BLENDER_MATERIAL_H__ - -#include - - -#include "RAS_IPolygonMaterial.h" -#include "BL_Material.h" -#include "BL_Texture.h" -#include "BL_Shader.h" -#include "BL_BlenderShader.h" - -#include "PyObjectPlus.h" - -#include "MT_Vector3.h" -#include "MT_Vector4.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -#include "SCA_IScene.h" /* only for Replace_IScene */ -#include "KX_Scene.h" - -struct MTFace; -class KX_Scene; - -class KX_BlenderMaterial : public PyObjectPlus, public RAS_IPolyMaterial -{ - Py_Header; -public: - // -------------------------------- - KX_BlenderMaterial(); - void Initialize( - class KX_Scene* scene, - BL_Material* mat - ); - - virtual ~KX_BlenderMaterial(); - - // -------------------------------- - virtual TCachingInfo GetCachingInfo(void) const { - return (void*) this; - } - - virtual - bool Activate( - RAS_IRasterizer* rasty, - TCachingInfo& cachingInfo - ) const; - - virtual - void ActivateMeshSlot( - const RAS_MeshSlot & ms, - RAS_IRasterizer* rasty - ) const; - - void ActivateMat( - RAS_IRasterizer* rasty, - TCachingInfo& cachingInfo - )const; - - void ActivatShaders( - RAS_IRasterizer* rasty, - TCachingInfo& cachingInfo - )const; - - void ActivateBlenderShaders( - RAS_IRasterizer* rasty, - TCachingInfo& cachingInfo - )const; - - Material* GetBlenderMaterial() const; - MTFace* GetMTFace(void) const; - unsigned int* GetMCol(void) const; - BL_Texture * getTex (unsigned int idx) { - return (idx < MAXTEX) ? mTextures + idx : NULL; - } - Image * getImage (unsigned int idx) { - return (idx < MAXTEX && mMaterial) ? mMaterial->img[idx] : NULL; - } - // for ipos - void UpdateIPO( - MT_Vector4 rgba, MT_Vector3 specrgb, - MT_Scalar hard, MT_Scalar spec, - MT_Scalar ref, MT_Scalar emit, MT_Scalar alpha - ); - - virtual void Replace_IScene(SCA_IScene *val) - { - mScene= static_cast(val); - }; - -#ifndef DISABLE_PYTHON - // -------------------------------- - virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); } - - KX_PYMETHOD_DOC( KX_BlenderMaterial, getShader ); - KX_PYMETHOD_DOC( KX_BlenderMaterial, getMaterialIndex ); - KX_PYMETHOD_DOC( KX_BlenderMaterial, getTexture ); - KX_PYMETHOD_DOC( KX_BlenderMaterial, setTexture ); - - KX_PYMETHOD_DOC( KX_BlenderMaterial, setBlending ); -#endif // DISABLE_PYTHON - - // -------------------------------- - // pre calculate to avoid pops/lag at startup - virtual void OnConstruction(int layer); - - static void EndFrame(); - -private: - BL_Material* mMaterial; - BL_Shader* mShader; - BL_BlenderShader* mBlenderShader; - KX_Scene* mScene; - BL_Texture mTextures[MAXTEX]; // texture array - bool mUserDefBlend; - unsigned int mBlendFunc[2]; - bool mModified; - bool mConstructed; // if false, don't clean on exit - - void SetBlenderGLSLShader(int layer); - - void ActivatGLMaterials( RAS_IRasterizer* rasty )const; - void ActivateTexGen( RAS_IRasterizer *ras ) const; - - bool UsesLighting(RAS_IRasterizer *rasty) const; - void GetMaterialRGBAColor(unsigned char *rgba) const; - Scene* GetBlenderScene() const; - void ReleaseMaterial(); - - // message centers - void setTexData( bool enable,RAS_IRasterizer *ras); - void setBlenderShaderData( bool enable, RAS_IRasterizer *ras); - void setShaderData( bool enable, RAS_IRasterizer *ras); - - void setObjectMatrixData(int i, RAS_IRasterizer *ras); - void setTexMatrixData(int i); - - void setLightData(); - - // cleanup stuff - void OnExit(); - - // shader chacing - static BL_BlenderShader *mLastBlenderShader; - static BL_Shader *mLastShader; - - mutable int mPass; -}; - - -#endif diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp deleted file mode 100644 index 1b2ceae6560..00000000000 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp +++ /dev/null @@ -1,524 +0,0 @@ -//under visual studio the #define in KX_ConvertPhysicsObject.h is quicker for recompilation -#include "KX_ConvertPhysicsObject.h" - -#ifdef USE_BULLET - -#include "KX_BulletPhysicsController.h" - -#include "btBulletDynamicsCommon.h" -#include "SG_Spatial.h" - -#include "KX_GameObject.h" -#include "KX_MotionState.h" -#include "KX_ClientObjectInfo.h" - -#include "PHY_IPhysicsEnvironment.h" -#include "CcdPhysicsEnvironment.h" -#include "BulletSoftBody/btSoftBody.h" - - -KX_BulletPhysicsController::KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound) -: KX_IPhysicsController(dyna,sensor,compound,(PHY_IPhysicsController*)this), -CcdPhysicsController(ci), -m_savedCollisionFlags(0), -m_savedCollisionFilterGroup(0), -m_savedCollisionFilterMask(0), -m_savedMass(0.0), -m_savedDyna(false), -m_suspended(false), -m_bulletChildShape(NULL) -{ -} - -KX_BulletPhysicsController::~KX_BulletPhysicsController () -{ - // The game object has a direct link to - if (m_pObject) - { - // If we cheat in SetObject, we must also cheat here otherwise the - // object will still things it has a physical controller - // Note that it requires that m_pObject is reset in case the object is deleted - // before the controller (usual case, see KX_Scene::RemoveNodeDestructObjec) - // The non usual case is when the object is not deleted because its reference is hanging - // in a AddObject actuator but the node is deleted. This case is covered here. - KX_GameObject* gameobj = (KX_GameObject*) m_pObject->GetSGClientObject(); - gameobj->SetPhysicsController(NULL,false); - } -} - -void KX_BulletPhysicsController::resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) -{ - CcdPhysicsController::resolveCombinedVelocities(linvelX,linvelY,linvelZ,angVelX,angVelY,angVelZ); - -} - - - /////////////////////////////////// - // KX_IPhysicsController interface - //////////////////////////////////// - -void KX_BulletPhysicsController::applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse) -{ - CcdPhysicsController::applyImpulse(attach[0],attach[1],attach[2],impulse[0],impulse[1],impulse[2]); - -} - -float KX_BulletPhysicsController::GetLinVelocityMin() -{ - return (float)CcdPhysicsController::GetLinVelocityMin(); -} -void KX_BulletPhysicsController::SetLinVelocityMin(float val) -{ - CcdPhysicsController::SetLinVelocityMin(val); -} - -float KX_BulletPhysicsController::GetLinVelocityMax() -{ - return (float)CcdPhysicsController::GetLinVelocityMax(); -} -void KX_BulletPhysicsController::SetLinVelocityMax(float val) -{ - CcdPhysicsController::SetLinVelocityMax(val); -} - -void KX_BulletPhysicsController::SetObject (SG_IObject* object) -{ - SG_Controller::SetObject(object); - - // cheating here... - //should not be necessary, is it for duplicates ? - - KX_GameObject* gameobj = (KX_GameObject*) object->GetSGClientObject(); - gameobj->SetPhysicsController(this,gameobj->IsDynamic()); - CcdPhysicsController::setNewClientInfo(gameobj->getClientInfo()); - - if (m_bSensor) - { - // use a different callback function for sensor object, - // bullet will not synchronize, we must do it explicitely - SG_Callbacks& callbacks = gameobj->GetSGNode()->GetCallBackFunctions(); - callbacks.m_updatefunc = KX_GameObject::SynchronizeTransformFunc; - } -} - -MT_Scalar KX_BulletPhysicsController::GetRadius() -{ - return MT_Scalar(CcdPhysicsController::GetRadius()); -} - -void KX_BulletPhysicsController::setMargin (float collisionMargin) -{ - CcdPhysicsController::SetMargin(collisionMargin); -} -void KX_BulletPhysicsController::RelativeTranslate(const MT_Vector3& dloc,bool local) -{ - CcdPhysicsController::RelativeTranslate(dloc[0],dloc[1],dloc[2],local); - -} - -void KX_BulletPhysicsController::RelativeRotate(const MT_Matrix3x3& drot,bool local) -{ - float rotval[12]; - drot.getValue(rotval); - CcdPhysicsController::RelativeRotate(rotval,local); -} - -void KX_BulletPhysicsController::ApplyTorque(const MT_Vector3& torque,bool local) -{ - CcdPhysicsController::ApplyTorque(torque.x(),torque.y(),torque.z(),local); -} -void KX_BulletPhysicsController::ApplyForce(const MT_Vector3& force,bool local) -{ - CcdPhysicsController::ApplyForce(force.x(),force.y(),force.z(),local); -} -MT_Vector3 KX_BulletPhysicsController::GetLinearVelocity() -{ - float angVel[3]; - //CcdPhysicsController::GetAngularVelocity(angVel[0],angVel[1],angVel[2]); - CcdPhysicsController::GetLinearVelocity(angVel[0],angVel[1],angVel[2]);//rcruiz - return MT_Vector3(angVel[0],angVel[1],angVel[2]); -} -MT_Vector3 KX_BulletPhysicsController::GetAngularVelocity() -{ - float angVel[3]; - //CcdPhysicsController::GetAngularVelocity(angVel[0],angVel[1],angVel[2]); - CcdPhysicsController::GetAngularVelocity(angVel[0],angVel[1],angVel[2]);//rcruiz - return MT_Vector3(angVel[0],angVel[1],angVel[2]); -} -MT_Vector3 KX_BulletPhysicsController::GetVelocity(const MT_Point3& pos) -{ - float linVel[3]; - CcdPhysicsController::GetVelocity(pos[0], pos[1], pos[2], linVel[0],linVel[1],linVel[2]); - return MT_Vector3(linVel[0],linVel[1],linVel[2]); -} - -void KX_BulletPhysicsController::SetAngularVelocity(const MT_Vector3& ang_vel,bool local) -{ - CcdPhysicsController::SetAngularVelocity(ang_vel.x(),ang_vel.y(),ang_vel.z(),local); - -} -void KX_BulletPhysicsController::SetLinearVelocity(const MT_Vector3& lin_vel,bool local) -{ - CcdPhysicsController::SetLinearVelocity(lin_vel.x(),lin_vel.y(),lin_vel.z(),local); -} -void KX_BulletPhysicsController::getOrientation(MT_Quaternion& orn) -{ - float myorn[4]; - CcdPhysicsController::getOrientation(myorn[0],myorn[1],myorn[2],myorn[3]); - orn = MT_Quaternion(myorn[0],myorn[1],myorn[2],myorn[3]); -} -void KX_BulletPhysicsController::setOrientation(const MT_Matrix3x3& orn) -{ - btMatrix3x3 btmat(orn[0][0], orn[0][1], orn[0][2], orn[1][0], orn[1][1], orn[1][2], orn[2][0], orn[2][1], orn[2][2]); - CcdPhysicsController::setWorldOrientation(btmat); -} -void KX_BulletPhysicsController::setPosition(const MT_Point3& pos) -{ - CcdPhysicsController::setPosition(pos.x(),pos.y(),pos.z()); -} -void KX_BulletPhysicsController::setScaling(const MT_Vector3& scaling) -{ - CcdPhysicsController::setScaling(scaling.x(),scaling.y(),scaling.z()); -} -void KX_BulletPhysicsController::SetTransform() -{ - btVector3 pos; - btVector3 scale; - float ori[12]; - m_MotionState->getWorldPosition(pos.m_floats[0],pos.m_floats[1],pos.m_floats[2]); - m_MotionState->getWorldScaling(scale.m_floats[0],scale.m_floats[1],scale.m_floats[2]); - m_MotionState->getWorldOrientation(ori); - btMatrix3x3 rot(ori[0], ori[4], ori[8], - ori[1], ori[5], ori[9], - ori[2], ori[6], ori[10]); - CcdPhysicsController::forceWorldTransform(rot, pos); -} - -MT_Scalar KX_BulletPhysicsController::GetMass() -{ - if (GetSoftBody()) - return GetSoftBody()->getTotalMass(); - - MT_Scalar invmass = 0.f; - if (GetRigidBody()) - invmass = GetRigidBody()->getInvMass(); - if (invmass) - return 1.f/invmass; - return 0.f; - -} - -MT_Vector3 KX_BulletPhysicsController::GetLocalInertia() -{ - MT_Vector3 inertia(0.f, 0.f, 0.f); - btVector3 inv_inertia; - if (GetRigidBody()) { - inv_inertia = GetRigidBody()->getInvInertiaDiagLocal(); - if (!btFuzzyZero(inv_inertia.getX()) && - !btFuzzyZero(inv_inertia.getY()) && - !btFuzzyZero(inv_inertia.getZ())) - inertia = MT_Vector3(1.f/inv_inertia.getX(), 1.f/inv_inertia.getY(), 1.f/inv_inertia.getZ()); - } - return inertia; -} - -MT_Vector3 KX_BulletPhysicsController::getReactionForce() -{ - assert(0); - return MT_Vector3(0.f,0.f,0.f); -} -void KX_BulletPhysicsController::setRigidBody(bool rigid) -{ -} - -/* This function dynamically adds the collision shape of another controller to - the current controller shape provided it is a compound shape. - The idea is that dynamic parenting on a compound object will dynamically extend the shape -*/ -void KX_BulletPhysicsController::AddCompoundChild(KX_IPhysicsController* child) -{ - if (child == NULL || !IsCompound()) - return; - // other controller must be a bullet controller too - // verify that body and shape exist and match - KX_BulletPhysicsController* childCtrl = dynamic_cast(child); - btRigidBody* rootBody = GetRigidBody(); - btRigidBody* childBody = childCtrl->GetRigidBody(); - if (!rootBody || !childBody) - return; - const btCollisionShape* rootShape = rootBody->getCollisionShape(); - const btCollisionShape* childShape = childBody->getCollisionShape(); - if (!rootShape || - !childShape || - rootShape->getShapeType() != COMPOUND_SHAPE_PROXYTYPE || - childShape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE) - return; - btCompoundShape* compoundShape = (btCompoundShape*)rootShape; - // compute relative transformation between parent and child - btTransform rootTrans; - btTransform childTrans; - rootBody->getMotionState()->getWorldTransform(rootTrans); - childBody->getMotionState()->getWorldTransform(childTrans); - btVector3 rootScale = rootShape->getLocalScaling(); - rootScale[0] = 1.0/rootScale[0]; - rootScale[1] = 1.0/rootScale[1]; - rootScale[2] = 1.0/rootScale[2]; - // relative scale = child_scale/parent_scale - btVector3 relativeScale = childShape->getLocalScaling()*rootScale; - btMatrix3x3 rootRotInverse = rootTrans.getBasis().transpose(); - // relative pos = parent_rot^-1 * ((parent_pos-child_pos)/parent_scale) - btVector3 relativePos = rootRotInverse*((childTrans.getOrigin()-rootTrans.getOrigin())*rootScale); - // relative rot = parent_rot^-1 * child_rot - btMatrix3x3 relativeRot = rootRotInverse*childTrans.getBasis(); - // create a proxy shape info to store the transformation - CcdShapeConstructionInfo* proxyShapeInfo = new CcdShapeConstructionInfo(); - // store the transformation to this object shapeinfo - proxyShapeInfo->m_childTrans.setOrigin(relativePos); - proxyShapeInfo->m_childTrans.setBasis(relativeRot); - proxyShapeInfo->m_childScale.setValue(relativeScale[0], relativeScale[1], relativeScale[2]); - // we will need this to make sure that we remove the right proxy later when unparenting - proxyShapeInfo->m_userData = childCtrl; - proxyShapeInfo->SetProxy(childCtrl->GetShapeInfo()->AddRef()); - // add to parent compound shapeinfo (increments ref count) - GetShapeInfo()->AddShape(proxyShapeInfo); - // create new bullet collision shape from the object shapeinfo and set scaling - btCollisionShape* newChildShape = proxyShapeInfo->CreateBulletShape(childCtrl->GetMargin(), childCtrl->getConstructionInfo().m_bGimpact, true); - newChildShape->setLocalScaling(relativeScale); - // add bullet collision shape to parent compound collision shape - compoundShape->addChildShape(proxyShapeInfo->m_childTrans,newChildShape); - // proxyShapeInfo is not needed anymore, release it - proxyShapeInfo->Release(); - // remember we created this shape - childCtrl->m_bulletChildShape = newChildShape; - // recompute inertia of parent - if (!rootBody->isStaticOrKinematicObject()) - { - btVector3 localInertia; - float mass = 1.f/rootBody->getInvMass(); - compoundShape->calculateLocalInertia(mass,localInertia); - rootBody->setMassProps(mass,localInertia); - } - // must update the broadphase cache, - GetPhysicsEnvironment()->refreshCcdPhysicsController(this); - // remove the children - GetPhysicsEnvironment()->disableCcdPhysicsController(childCtrl); -} - -/* Reverse function of the above, it will remove a shape from a compound shape - provided that the former was added to the later using AddCompoundChild() -*/ -void KX_BulletPhysicsController::RemoveCompoundChild(KX_IPhysicsController* child) -{ - if (child == NULL || !IsCompound()) - return; - // other controller must be a bullet controller too - // verify that body and shape exist and match - KX_BulletPhysicsController* childCtrl = dynamic_cast(child); - btRigidBody* rootBody = GetRigidBody(); - btRigidBody* childBody = childCtrl->GetRigidBody(); - if (!rootBody || !childBody) - return; - const btCollisionShape* rootShape = rootBody->getCollisionShape(); - if (!rootShape || - rootShape->getShapeType() != COMPOUND_SHAPE_PROXYTYPE) - return; - btCompoundShape* compoundShape = (btCompoundShape*)rootShape; - // retrieve the shapeInfo - CcdShapeConstructionInfo* childShapeInfo = childCtrl->GetShapeInfo(); - CcdShapeConstructionInfo* rootShapeInfo = GetShapeInfo(); - // and verify that the child is part of the parent - int i = rootShapeInfo->FindChildShape(childShapeInfo, childCtrl); - if (i < 0) - return; - rootShapeInfo->RemoveChildShape(i); - if (childCtrl->m_bulletChildShape) - { - int numChildren = compoundShape->getNumChildShapes(); - for (i=0; igetChildShape(i) == childCtrl->m_bulletChildShape) - { - compoundShape->removeChildShapeByIndex(i); - compoundShape->recalculateLocalAabb(); - break; - } - } - delete childCtrl->m_bulletChildShape; - childCtrl->m_bulletChildShape = NULL; - } - // recompute inertia of parent - if (!rootBody->isStaticOrKinematicObject()) - { - btVector3 localInertia; - float mass = 1.f/rootBody->getInvMass(); - compoundShape->calculateLocalInertia(mass,localInertia); - rootBody->setMassProps(mass,localInertia); - } - // must update the broadphase cache, - GetPhysicsEnvironment()->refreshCcdPhysicsController(this); - // reactivate the children - GetPhysicsEnvironment()->enableCcdPhysicsController(childCtrl); -} - -void KX_BulletPhysicsController::SetMass(MT_Scalar newmass) -{ - btRigidBody *body = GetRigidBody(); - if (body && !m_suspended && newmass>MT_EPSILON && GetMass()>MT_EPSILON) - { - btVector3 grav = body->getGravity(); - btVector3 accel = grav / GetMass(); - - btBroadphaseProxy* handle = body->getBroadphaseHandle(); - GetPhysicsEnvironment()->updateCcdPhysicsController(this, - newmass, - body->getCollisionFlags(), - handle->m_collisionFilterGroup, - handle->m_collisionFilterMask); - body->setGravity(accel); - } -} - -void KX_BulletPhysicsController::SuspendDynamics(bool ghost) -{ - btRigidBody *body = GetRigidBody(); - if (body && !m_suspended && !IsSensor()) - { - btBroadphaseProxy* handle = body->getBroadphaseHandle(); - m_savedCollisionFlags = body->getCollisionFlags(); - m_savedMass = GetMass(); - m_savedDyna = m_bDyna; - m_savedCollisionFilterGroup = handle->m_collisionFilterGroup; - m_savedCollisionFilterMask = handle->m_collisionFilterMask; - m_suspended = true; - GetPhysicsEnvironment()->updateCcdPhysicsController(this, - 0.0, - btCollisionObject::CF_STATIC_OBJECT|((ghost)?btCollisionObject::CF_NO_CONTACT_RESPONSE:(m_savedCollisionFlags&btCollisionObject::CF_NO_CONTACT_RESPONSE)), - btBroadphaseProxy::StaticFilter, - btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); - m_bDyna = false; - } -} - -void KX_BulletPhysicsController::RestoreDynamics() -{ - btRigidBody *body = GetRigidBody(); - if (body && m_suspended) - { - // before make sure any position change that was done in this logic frame are accounted for - SetTransform(); - GetPhysicsEnvironment()->updateCcdPhysicsController(this, - m_savedMass, - m_savedCollisionFlags, - m_savedCollisionFilterGroup, - m_savedCollisionFilterMask); - body->activate(); - m_bDyna = m_savedDyna; - m_suspended = false; - } -} - -SG_Controller* KX_BulletPhysicsController::GetReplica(class SG_Node* destnode) -{ - PHY_IMotionState* motionstate = new KX_MotionState(destnode); - - KX_BulletPhysicsController* physicsreplica = new KX_BulletPhysicsController(*this); - - //parentcontroller is here be able to avoid collisions between parent/child - - PHY_IPhysicsController* parentctrl = NULL; - KX_BulletPhysicsController* parentKxCtrl = NULL; - CcdPhysicsController* ccdParent = NULL; - - - if (destnode != destnode->GetRootSGParent()) - { - KX_GameObject* clientgameobj = (KX_GameObject*) destnode->GetRootSGParent()->GetSGClientObject(); - if (clientgameobj) - { - parentctrl = (KX_BulletPhysicsController*)clientgameobj->GetPhysicsController(); - } else - { - // it could be a false node, try the children - NodeList::const_iterator childit; - for ( - childit = destnode->GetSGChildren().begin(); - childit!= destnode->GetSGChildren().end(); - ++childit - ) { - KX_GameObject *clientgameobj_child = static_cast( (*childit)->GetSGClientObject()); - if (clientgameobj_child) - { - parentKxCtrl = (KX_BulletPhysicsController*)clientgameobj_child->GetPhysicsController(); - parentctrl = parentKxCtrl; - ccdParent = parentKxCtrl; - } - } - } - } - - physicsreplica->setParentCtrl(ccdParent); - physicsreplica->PostProcessReplica(motionstate,parentctrl); - physicsreplica->m_userdata = (PHY_IPhysicsController*)physicsreplica; - physicsreplica->m_bulletChildShape = NULL; - return physicsreplica; - -} - - - -void KX_BulletPhysicsController::SetSumoTransform(bool nondynaonly) -{ - - if (!m_bDyna && !m_bSensor) - { - btCollisionObject* object = GetRigidBody(); - object->setActivationState(ACTIVE_TAG); - object->setCollisionFlags(object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - } else - { - if (!nondynaonly) - { - /* - btTransform worldTrans; - if (GetRigidBody()) - { - GetRigidBody()->getMotionState()->getWorldTransform(worldTrans); - GetRigidBody()->setCenterOfMassTransform(worldTrans); - } - */ - /* - scaling? - if (m_bDyna) - { - m_sumoObj->setScaling(MT_Vector3(1,1,1)); - } else - { - MT_Vector3 scale; - GetWorldScaling(scale); - m_sumoObj->setScaling(scale); - } - */ - - } - } -} - -// todo: remove next line ! -void KX_BulletPhysicsController::SetSimulatedTime(double time) -{ -} - -// call from scene graph to update -bool KX_BulletPhysicsController::Update(double time) -{ - return false; - - // todo: check this code - //if (GetMass()) - //{ - // return false;//true; -// } -// return false; -} - -#endif //#ifdef USE_BULLET diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h deleted file mode 100644 index 7fc799abb7e..00000000000 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef KX_BULLET2PHYSICS_CONTROLLER -#define KX_BULLET2PHYSICS_CONTROLLER - - -#include "KX_IPhysicsController.h" -#include "CcdPhysicsController.h" - -class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysicsController -{ -private: - int m_savedCollisionFlags; - int m_savedActivationState; - short int m_savedCollisionFilterGroup; - short int m_savedCollisionFilterMask; - MT_Scalar m_savedMass; - bool m_savedDyna; - bool m_suspended; - btCollisionShape* m_bulletChildShape; - -public: - KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound); - virtual ~KX_BulletPhysicsController (); - - /////////////////////////////////// - // KX_IPhysicsController interface - //////////////////////////////////// - - virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse); - virtual void SetObject (SG_IObject* object); - virtual void setMargin (float collisionMargin); - virtual void RelativeTranslate(const MT_Vector3& dloc,bool local); - virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local); - virtual void ApplyTorque(const MT_Vector3& torque,bool local); - virtual void ApplyForce(const MT_Vector3& force,bool local); - virtual MT_Vector3 GetLinearVelocity(); - virtual MT_Vector3 GetAngularVelocity(); - virtual MT_Vector3 GetVelocity(const MT_Point3& pos); - virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local); - virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local); - virtual void getOrientation(MT_Quaternion& orn); - virtual void setOrientation(const MT_Matrix3x3& orn); - virtual void setPosition(const MT_Point3& pos); - virtual void setScaling(const MT_Vector3& scaling); - virtual void SetTransform(); - virtual MT_Scalar GetMass(); - virtual void SetMass(MT_Scalar newmass); - virtual MT_Vector3 GetLocalInertia(); - virtual MT_Vector3 getReactionForce(); - virtual void setRigidBody(bool rigid); - virtual void AddCompoundChild(KX_IPhysicsController* child); - virtual void RemoveCompoundChild(KX_IPhysicsController* child); - - virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ); - - virtual void SuspendDynamics(bool ghost); - virtual void RestoreDynamics(); - - virtual SG_Controller* GetReplica(class SG_Node* destnode); - - virtual MT_Scalar GetRadius(); - - virtual float GetLinVelocityMin(); - virtual void SetLinVelocityMin(float val); - virtual float GetLinVelocityMax(); - virtual void SetLinVelocityMax(float val); - - virtual void SetSumoTransform(bool nondynaonly); - // todo: remove next line ! - virtual void SetSimulatedTime(double time); - - // call from scene graph to update - virtual bool Update(double time); - void* GetUserData() { return m_userdata;} - - void - SetOption( - int option, - int value - ){ - // intentionally empty - }; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BulletPhysicsController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //KX_BULLET2PHYSICS_CONTROLLER - diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp deleted file mode 100644 index bba3b2219ed..00000000000 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ /dev/null @@ -1,1027 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Camera in the gameengine. Cameras are also used for views. - */ - -#include "GL/glew.h" -#include "KX_Camera.h" -#include "KX_Scene.h" -#include "KX_PythonInit.h" -#include "KX_Python.h" -#include "KX_PyMath.h" -KX_Camera::KX_Camera(void* sgReplicationInfo, - SG_Callbacks callbacks, - const RAS_CameraData& camdata, - bool frustum_culling, - bool delete_node) - : - KX_GameObject(sgReplicationInfo,callbacks), - m_camdata(camdata), - m_dirty(true), - m_normalized(false), - m_frustum_culling(frustum_culling), - m_set_projection_matrix(false), - m_set_frustum_center(false), - m_delete_node(delete_node) -{ - // setting a name would be nice... - m_name = "cam"; - m_projection_matrix.setIdentity(); - m_modelview_matrix.setIdentity(); -} - - -KX_Camera::~KX_Camera() -{ - if (m_delete_node && m_pSGNode) - { - // for shadow camera, avoids memleak - delete m_pSGNode; - m_pSGNode = NULL; - } -} - - -CValue* KX_Camera::GetReplica() -{ - KX_Camera* replica = new KX_Camera(*this); - - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - -void KX_Camera::ProcessReplica() -{ - KX_GameObject::ProcessReplica(); - // replicated camera are always registered in the scene - m_delete_node = false; -} - -MT_Transform KX_Camera::GetWorldToCamera() const -{ - MT_Transform camtrans; - camtrans.invert(MT_Transform(NodeGetWorldPosition(), NodeGetWorldOrientation())); - - return camtrans; -} - - - -MT_Transform KX_Camera::GetCameraToWorld() const -{ - return MT_Transform(NodeGetWorldPosition(), NodeGetWorldOrientation()); -} - - - -void KX_Camera::CorrectLookUp(MT_Scalar speed) -{ -} - - - -const MT_Point3 KX_Camera::GetCameraLocation() const -{ - /* this is the camera locatio in cam coords... */ - //return m_trans1.getOrigin(); - //return MT_Point3(0,0,0); <----- - /* .... I want it in world coords */ - //MT_Transform trans; - //trans.setBasis(NodeGetWorldOrientation()); - - return NodeGetWorldPosition(); -} - - - -/* I want the camera orientation as well. */ -const MT_Quaternion KX_Camera::GetCameraOrientation() const -{ - return NodeGetWorldOrientation().getRotation(); -} - - - -/** -* Sets the projection matrix that is used by the rasterizer. -*/ -void KX_Camera::SetProjectionMatrix(const MT_Matrix4x4 & mat) -{ - m_projection_matrix = mat; - m_dirty = true; - m_set_projection_matrix = true; - m_set_frustum_center = false; -} - - - -/** -* Sets the modelview matrix that is used by the rasterizer. -*/ -void KX_Camera::SetModelviewMatrix(const MT_Matrix4x4 & mat) -{ - m_modelview_matrix = mat; - m_dirty = true; - m_set_frustum_center = false; -} - - - -/** -* Gets the projection matrix that is used by the rasterizer. -*/ -const MT_Matrix4x4& KX_Camera::GetProjectionMatrix() const -{ - return m_projection_matrix; -} - - - -/** -* Gets the modelview matrix that is used by the rasterizer. -*/ -const MT_Matrix4x4& KX_Camera::GetModelviewMatrix() const -{ - return m_modelview_matrix; -} - - -bool KX_Camera::hasValidProjectionMatrix() const -{ - return m_set_projection_matrix; -} - -void KX_Camera::InvalidateProjectionMatrix(bool valid) -{ - m_set_projection_matrix = valid; -} - - -/* -* These getters retrieve the clip data and the focal length -*/ -float KX_Camera::GetLens() const -{ - return m_camdata.m_lens; -} - -float KX_Camera::GetScale() const -{ - return m_camdata.m_scale; -} - - - -float KX_Camera::GetCameraNear() const -{ - return m_camdata.m_clipstart; -} - - - -float KX_Camera::GetCameraFar() const -{ - return m_camdata.m_clipend; -} - -float KX_Camera::GetFocalLength() const -{ - return m_camdata.m_focallength; -} - - - -RAS_CameraData* KX_Camera::GetCameraData() -{ - return &m_camdata; -} - -void KX_Camera::ExtractClipPlanes() -{ - if (!m_dirty) - return; - - MT_Matrix4x4 m = m_projection_matrix * m_modelview_matrix; - // Left clip plane - m_planes[0] = m[3] + m[0]; - // Right clip plane - m_planes[1] = m[3] - m[0]; - // Top clip plane - m_planes[2] = m[3] - m[1]; - // Bottom clip plane - m_planes[3] = m[3] + m[1]; - // Near clip plane - m_planes[4] = m[3] + m[2]; - // Far clip plane - m_planes[5] = m[3] - m[2]; - - m_dirty = false; - m_normalized = false; -} - -void KX_Camera::NormalizeClipPlanes() -{ - if (m_normalized) - return; - - for (unsigned int p = 0; p < 6; p++) - { - MT_Scalar factor = sqrt(m_planes[p][0]*m_planes[p][0] + m_planes[p][1]*m_planes[p][1] + m_planes[p][2]*m_planes[p][2]); - if (!MT_fuzzyZero(factor)) - m_planes[p] /= factor; - } - - m_normalized = true; -} - -void KX_Camera::ExtractFrustumSphere() -{ - if (m_set_frustum_center) - return; - - // compute sphere for the general case and not only symmetric frustum: - // the mirror code in ImageRender can use very asymmetric frustum. - // We will put the sphere center on the line that goes from origin to the center of the far clipping plane - // This is the optimal position if the frustum is symmetric or very asymmetric and probably close - // to optimal for the general case. The sphere center position is computed so that the distance to - // the near and far extreme frustum points are equal. - - // get the transformation matrix from device coordinate to camera coordinate - MT_Matrix4x4 clip_camcs_matrix = m_projection_matrix; - clip_camcs_matrix.invert(); - - if (m_projection_matrix[3][3] == MT_Scalar(0.0)) - { - // frustrum projection - // detect which of the corner of the far clipping plane is the farthest to the origin - MT_Vector4 nfar; // far point in device normalized coordinate - MT_Point3 farpoint; // most extreme far point in camera coordinate - MT_Point3 nearpoint;// most extreme near point in camera coordinate - MT_Point3 farcenter(0.,0.,0.);// center of far cliping plane in camera coordinate - MT_Scalar F=-1.0, N; // square distance of far and near point to origin - MT_Scalar f, n; // distance of far and near point to z axis. f is always > 0 but n can be < 0 - MT_Scalar e, s; // far and near clipping distance (<0) - MT_Scalar c; // slope of center line = distance of far clipping center to z axis / far clipping distance - MT_Scalar z; // projection of sphere center on z axis (<0) - // tmp value - MT_Vector4 npoint(1., 1., 1., 1.); - MT_Vector4 hpoint; - MT_Point3 point; - MT_Scalar len; - for (int i=0; i<4; i++) - { - hpoint = clip_camcs_matrix*npoint; - point.setValue(hpoint[0]/hpoint[3], hpoint[1]/hpoint[3], hpoint[2]/hpoint[3]); - len = point.dot(point); - if (len > F) - { - nfar = npoint; - farpoint = point; - F = len; - } - // rotate by 90 degree along the z axis to walk through the 4 extreme points of the far clipping plane - len = npoint[0]; - npoint[0] = -npoint[1]; - npoint[1] = len; - farcenter += point; - } - // the far center is the average of the far clipping points - farcenter *= 0.25; - // the extreme near point is the opposite point on the near clipping plane - nfar.setValue(-nfar[0], -nfar[1], -1., 1.); - nfar = clip_camcs_matrix*nfar; - nearpoint.setValue(nfar[0]/nfar[3], nfar[1]/nfar[3], nfar[2]/nfar[3]); - // this is a frustrum projection - N = nearpoint.dot(nearpoint); - e = farpoint[2]; - s = nearpoint[2]; - // projection on XY plane for distance to axis computation - MT_Point2 farxy(farpoint[0], farpoint[1]); - // f is forced positive by construction - f = farxy.length(); - // get corresponding point on the near plane - farxy *= s/e; - // this formula preserve the sign of n - n = f*s/e - MT_Point2(nearpoint[0]-farxy[0], nearpoint[1]-farxy[1]).length(); - c = MT_Point2(farcenter[0], farcenter[1]).length()/e; - // the big formula, it simplifies to (F-N)/(2(e-s)) for the symmetric case - z = (F-N)/(2.0*(e-s+c*(f-n))); - m_frustum_center = MT_Point3(farcenter[0]*z/e, farcenter[1]*z/e, z); - m_frustum_radius = m_frustum_center.distance(farpoint); - } - else - { - // orthographic projection - // The most extreme points on the near and far plane. (normalized device coords) - MT_Vector4 hnear(1., 1., 1., 1.), hfar(-1., -1., -1., 1.); - - // Transform to hom camera local space - hnear = clip_camcs_matrix*hnear; - hfar = clip_camcs_matrix*hfar; - - // Tranform to 3d camera local space. - MT_Point3 nearpoint(hnear[0]/hnear[3], hnear[1]/hnear[3], hnear[2]/hnear[3]); - MT_Point3 farpoint(hfar[0]/hfar[3], hfar[1]/hfar[3], hfar[2]/hfar[3]); - - // just use mediant point - m_frustum_center = (farpoint + nearpoint)*0.5; - m_frustum_radius = m_frustum_center.distance(farpoint); - } - // Transform to world space. - m_frustum_center = GetCameraToWorld()(m_frustum_center); - m_frustum_radius /= fabs(NodeGetWorldScaling()[NodeGetWorldScaling().closestAxis()]); - - m_set_frustum_center = true; -} - -bool KX_Camera::PointInsideFrustum(const MT_Point3& x) -{ - ExtractClipPlanes(); - - for( unsigned int i = 0; i < 6 ; i++ ) - { - if (m_planes[i][0]*x[0] + m_planes[i][1]*x[1] + m_planes[i][2]*x[2] + m_planes[i][3] < 0.) - return false; - } - return true; -} - -int KX_Camera::BoxInsideFrustum(const MT_Point3 *box) -{ - ExtractClipPlanes(); - - unsigned int insideCount = 0; - // 6 view frustum planes - for( unsigned int p = 0; p < 6 ; p++ ) - { - unsigned int behindCount = 0; - // 8 box verticies. - for (unsigned int v = 0; v < 8 ; v++) - { - if (m_planes[p][0]*box[v][0] + m_planes[p][1]*box[v][1] + m_planes[p][2]*box[v][2] + m_planes[p][3] < 0.) - behindCount++; - } - - // 8 points behind this plane - if (behindCount == 8) - return OUTSIDE; - - // Every box vertex is on the front side of this plane - if (!behindCount) - insideCount++; - } - - // All box verticies are on the front side of all frustum planes. - if (insideCount == 6) - return INSIDE; - - return INTERSECT; -} - -int KX_Camera::SphereInsideFrustum(const MT_Point3& center, const MT_Scalar &radius) -{ - ExtractFrustumSphere(); - if (center.distance2(m_frustum_center) > (radius + m_frustum_radius)*(radius + m_frustum_radius)) - return OUTSIDE; - - unsigned int p; - ExtractClipPlanes(); - NormalizeClipPlanes(); - - MT_Scalar distance; - int intersect = INSIDE; - // distance: <-------- OUTSIDE -----|----- INTERSECT -----0----- INTERSECT -----|----- INSIDE --------> - // -radius radius - for (p = 0; p < 6; p++) - { - distance = m_planes[p][0]*center[0] + m_planes[p][1]*center[1] + m_planes[p][2]*center[2] + m_planes[p][3]; - if (fabs(distance) <= radius) - intersect = INTERSECT; - else if (distance < -radius) - return OUTSIDE; - } - - return intersect; -} - -bool KX_Camera::GetFrustumCulling() const -{ - return m_frustum_culling; -} - -void KX_Camera::EnableViewport(bool viewport) -{ - m_camdata.m_viewport = viewport; -} - -void KX_Camera::SetViewport(int left, int bottom, int right, int top) -{ - m_camdata.m_viewportleft = left; - m_camdata.m_viewportbottom = bottom; - m_camdata.m_viewportright = right; - m_camdata.m_viewporttop = top; -} - -bool KX_Camera::GetViewport() const -{ - return m_camdata.m_viewport; -} - -int KX_Camera::GetViewportLeft() const -{ - return m_camdata.m_viewportleft; -} - -int KX_Camera::GetViewportBottom() const -{ - return m_camdata.m_viewportbottom; -} - -int KX_Camera::GetViewportRight() const -{ - return m_camdata.m_viewportright; -} - -int KX_Camera::GetViewportTop() const -{ - return m_camdata.m_viewporttop; -} - -#ifndef DISABLE_PYTHON -//---------------------------------------------------------------------------- -//Python - - -PyMethodDef KX_Camera::Methods[] = { - KX_PYMETHODTABLE(KX_Camera, sphereInsideFrustum), - KX_PYMETHODTABLE_O(KX_Camera, boxInsideFrustum), - KX_PYMETHODTABLE_O(KX_Camera, pointInsideFrustum), - KX_PYMETHODTABLE_NOARGS(KX_Camera, getCameraToWorld), - KX_PYMETHODTABLE_NOARGS(KX_Camera, getWorldToCamera), - KX_PYMETHODTABLE(KX_Camera, setViewport), - KX_PYMETHODTABLE_NOARGS(KX_Camera, setOnTop), - KX_PYMETHODTABLE_O(KX_Camera, getScreenPosition), - KX_PYMETHODTABLE(KX_Camera, getScreenVect), - KX_PYMETHODTABLE(KX_Camera, getScreenRay), - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_Camera::Attributes[] = { - - KX_PYATTRIBUTE_BOOL_RW("frustum_culling", KX_Camera, m_frustum_culling), - KX_PYATTRIBUTE_RW_FUNCTION("perspective", KX_Camera, pyattr_get_perspective, pyattr_set_perspective), - - KX_PYATTRIBUTE_RW_FUNCTION("lens", KX_Camera, pyattr_get_lens, pyattr_set_lens), - KX_PYATTRIBUTE_RW_FUNCTION("near", KX_Camera, pyattr_get_near, pyattr_set_near), - KX_PYATTRIBUTE_RW_FUNCTION("far", KX_Camera, pyattr_get_far, pyattr_set_far), - - KX_PYATTRIBUTE_RW_FUNCTION("useViewport", KX_Camera, pyattr_get_use_viewport, pyattr_set_use_viewport), - - KX_PYATTRIBUTE_RW_FUNCTION("projection_matrix", KX_Camera, pyattr_get_projection_matrix, pyattr_set_projection_matrix), - KX_PYATTRIBUTE_RO_FUNCTION("modelview_matrix", KX_Camera, pyattr_get_modelview_matrix), - KX_PYATTRIBUTE_RO_FUNCTION("camera_to_world", KX_Camera, pyattr_get_camera_to_world), - KX_PYATTRIBUTE_RO_FUNCTION("world_to_camera", KX_Camera, pyattr_get_world_to_camera), - - /* Grrr, functions for constants? */ - KX_PYATTRIBUTE_RO_FUNCTION("INSIDE", KX_Camera, pyattr_get_INSIDE), - KX_PYATTRIBUTE_RO_FUNCTION("OUTSIDE", KX_Camera, pyattr_get_OUTSIDE), - KX_PYATTRIBUTE_RO_FUNCTION("INTERSECT", KX_Camera, pyattr_get_INTERSECT), - - { NULL } //Sentinel -}; - -PyTypeObject KX_Camera::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_Camera", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0, - &KX_GameObject::Sequence, - &KX_GameObject::Mapping, - 0,0,0, - NULL, - NULL, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &KX_GameObject::Type, - 0,0,0,0,0,0, - py_base_new -}; - -KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum, -"sphereInsideFrustum(center, radius) -> Integer\n" -"\treturns INSIDE, OUTSIDE or INTERSECT if the given sphere is\n" -"\tinside/outside/intersects this camera's viewing frustum.\n\n" -"\tcenter = the center of the sphere (in world coordinates.)\n" -"\tradius = the radius of the sphere\n\n" -"\tExample:\n" -"\timport GameLogic\n\n" -"\tco = GameLogic.getCurrentController()\n" -"\tcam = co.GetOwner()\n\n" -"\t# A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]\n" -"\tif (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):\n" -"\t\t# Sphere is inside frustum !\n" -"\t\t# Do something useful !\n" -"\telse:\n" -"\t\t# Sphere is outside frustum\n" -) -{ - PyObject *pycenter; - float radius; - if (PyArg_ParseTuple(args, "Of:sphereInsideFrustum", &pycenter, &radius)) - { - MT_Point3 center; - if (PyVecTo(pycenter, center)) - { - return PyLong_FromSsize_t(SphereInsideFrustum(center, radius)); /* new ref */ - } - } - - PyErr_SetString(PyExc_TypeError, "camera.sphereInsideFrustum(center, radius): KX_Camera, expected arguments: (center, radius)"); - - return NULL; -} - -KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum, -"boxInsideFrustum(box) -> Integer\n" -"\treturns INSIDE, OUTSIDE or INTERSECT if the given box is\n" -"\tinside/outside/intersects this camera's viewing frustum.\n\n" -"\tbox = a list of the eight (8) corners of the box (in world coordinates.)\n\n" -"\tExample:\n" -"\timport GameLogic\n\n" -"\tco = GameLogic.getCurrentController()\n" -"\tcam = co.GetOwner()\n\n" -"\tbox = []\n" -"\tbox.append([-1.0, -1.0, -1.0])\n" -"\tbox.append([-1.0, -1.0, 1.0])\n" -"\tbox.append([-1.0, 1.0, -1.0])\n" -"\tbox.append([-1.0, 1.0, 1.0])\n" -"\tbox.append([ 1.0, -1.0, -1.0])\n" -"\tbox.append([ 1.0, -1.0, 1.0])\n" -"\tbox.append([ 1.0, 1.0, -1.0])\n" -"\tbox.append([ 1.0, 1.0, 1.0])\n\n" -"\tif (cam.boxInsideFrustum(box) != cam.OUTSIDE):\n" -"\t\t# Box is inside/intersects frustum !\n" -"\t\t# Do something useful !\n" -"\telse:\n" -"\t\t# Box is outside the frustum !\n" -) -{ - unsigned int num_points = PySequence_Size(value); - if (num_points != 8) - { - PyErr_Format(PyExc_TypeError, "camera.boxInsideFrustum(box): KX_Camera, expected eight (8) points, got %d", num_points); - return NULL; - } - - MT_Point3 box[8]; - for (unsigned int p = 0; p < 8 ; p++) - { - PyObject *item = PySequence_GetItem(value, p); /* new ref */ - bool error = !PyVecTo(item, box[p]); - Py_DECREF(item); - if (error) - return NULL; - } - - return PyLong_FromSsize_t(BoxInsideFrustum(box)); /* new ref */ -} - -KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum, -"pointInsideFrustum(point) -> Bool\n" -"\treturns 1 if the given point is inside this camera's viewing frustum.\n\n" -"\tpoint = The point to test (in world coordinates.)\n\n" -"\tExample:\n" -"\timport GameLogic\n\n" -"\tco = GameLogic.getCurrentController()\n" -"\tcam = co.GetOwner()\n\n" -"\t# Test point [0.0, 0.0, 0.0]" -"\tif (cam.pointInsideFrustum([0.0, 0.0, 0.0])):\n" -"\t\t# Point is inside frustum !\n" -"\t\t# Do something useful !\n" -"\telse:\n" -"\t\t# Box is outside the frustum !\n" -) -{ - MT_Point3 point; - if (PyVecTo(value, point)) - { - return PyLong_FromSsize_t(PointInsideFrustum(point)); /* new ref */ - } - - PyErr_SetString(PyExc_TypeError, "camera.pointInsideFrustum(point): KX_Camera, expected point argument."); - return NULL; -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_Camera, getCameraToWorld, -"getCameraToWorld() -> Matrix4x4\n" -"\treturns the camera to world transformation matrix, as a list of four lists of four values.\n\n" -"\tie: [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]])\n" -) -{ - return PyObjectFrom(GetCameraToWorld()); /* new ref */ -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_Camera, getWorldToCamera, -"getWorldToCamera() -> Matrix4x4\n" -"\treturns the world to camera transformation matrix, as a list of four lists of four values.\n\n" -"\tie: [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]])\n" -) -{ - return PyObjectFrom(GetWorldToCamera()); /* new ref */ -} - -KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, setViewport, -"setViewport(left, bottom, right, top)\n" -"Sets this camera's viewport\n") -{ - int left, bottom, right, top; - if (!PyArg_ParseTuple(args,"iiii:setViewport",&left, &bottom, &right, &top)) - return NULL; - - SetViewport(left, bottom, right, top); - Py_RETURN_NONE; -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_Camera, setOnTop, -"setOnTop()\n" -"Sets this camera's viewport on top\n") -{ - class KX_Scene* scene = KX_GetActiveScene(); - scene->SetCameraOnTop(this); - Py_RETURN_NONE; -} - -PyObject* KX_Camera::pyattr_get_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Camera* self= static_cast(self_v); - return PyBool_FromLong(self->m_camdata.m_perspective); -} - -int KX_Camera::pyattr_set_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_Camera* self= static_cast(self_v); - int param = PyObject_IsTrue( value ); - if (param == -1) { - PyErr_SetString(PyExc_AttributeError, "camera.perspective = bool: KX_Camera, expected True/False or 0/1"); - return PY_SET_ATTR_FAIL; - } - - self->m_camdata.m_perspective= param; - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_Camera::pyattr_get_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Camera* self= static_cast(self_v); - return PyFloat_FromDouble(self->m_camdata.m_lens); -} - -int KX_Camera::pyattr_set_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_Camera* self= static_cast(self_v); - float param = PyFloat_AsDouble(value); - if (param == -1) { - PyErr_SetString(PyExc_AttributeError, "camera.lens = float: KX_Camera, expected a float greater then zero"); - return PY_SET_ATTR_FAIL; - } - - self->m_camdata.m_lens= param; - self->m_set_projection_matrix = false; - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_Camera::pyattr_get_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Camera* self= static_cast(self_v); - return PyFloat_FromDouble(self->m_camdata.m_clipstart); -} - -int KX_Camera::pyattr_set_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_Camera* self= static_cast(self_v); - float param = PyFloat_AsDouble(value); - if (param == -1) { - PyErr_SetString(PyExc_AttributeError, "camera.near = float: KX_Camera, expected a float greater then zero"); - return PY_SET_ATTR_FAIL; - } - - self->m_camdata.m_clipstart= param; - self->m_set_projection_matrix = false; - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_Camera::pyattr_get_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Camera* self= static_cast(self_v); - return PyFloat_FromDouble(self->m_camdata.m_clipend); -} - -int KX_Camera::pyattr_set_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_Camera* self= static_cast(self_v); - float param = PyFloat_AsDouble(value); - if (param == -1) { - PyErr_SetString(PyExc_AttributeError, "camera.far = float: KX_Camera, expected a float greater then zero"); - return PY_SET_ATTR_FAIL; - } - - self->m_camdata.m_clipend= param; - self->m_set_projection_matrix = false; - return PY_SET_ATTR_SUCCESS; -} - - -PyObject* KX_Camera::pyattr_get_use_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Camera* self= static_cast(self_v); - return PyBool_FromLong(self->GetViewport()); -} - -int KX_Camera::pyattr_set_use_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_Camera* self= static_cast(self_v); - int param = PyObject_IsTrue( value ); - if (param == -1) { - PyErr_SetString(PyExc_AttributeError, "camera.useViewport = bool: KX_Camera, expected True or False"); - return PY_SET_ATTR_FAIL; - } - self->EnableViewport((bool)param); - return PY_SET_ATTR_SUCCESS; -} - - -PyObject* KX_Camera::pyattr_get_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Camera* self= static_cast(self_v); - return PyObjectFrom(self->GetProjectionMatrix()); -} - -int KX_Camera::pyattr_set_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_Camera* self= static_cast(self_v); - MT_Matrix4x4 mat; - if (!PyMatTo(value, mat)) - return PY_SET_ATTR_FAIL; - - self->SetProjectionMatrix(mat); - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_Camera::pyattr_get_modelview_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Camera* self= static_cast(self_v); - return PyObjectFrom(self->GetModelviewMatrix()); -} - -PyObject* KX_Camera::pyattr_get_camera_to_world(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Camera* self= static_cast(self_v); - return PyObjectFrom(self->GetCameraToWorld()); -} - -PyObject* KX_Camera::pyattr_get_world_to_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Camera* self= static_cast(self_v); - return PyObjectFrom(self->GetWorldToCamera()); -} - - -PyObject* KX_Camera::pyattr_get_INSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ return PyLong_FromSsize_t(INSIDE); } -PyObject* KX_Camera::pyattr_get_OUTSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ return PyLong_FromSsize_t(OUTSIDE); } -PyObject* KX_Camera::pyattr_get_INTERSECT(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ return PyLong_FromSsize_t(INTERSECT); } - - -bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok, const char *error_prefix) -{ - if (value==NULL) { - PyErr_Format(PyExc_TypeError, "%s, python pointer NULL, should never happen", error_prefix); - *object = NULL; - return false; - } - - if (value==Py_None) { - *object = NULL; - - if (py_none_ok) { - return true; - } else { - PyErr_Format(PyExc_TypeError, "%s, expected KX_Camera or a KX_Camera name, None is invalid", error_prefix); - return false; - } - } - - if (PyUnicode_Check(value)) { - STR_String value_str = _PyUnicode_AsString(value); - *object = KX_GetActiveScene()->FindCamera(value_str); - - if (*object) { - return true; - } else { - PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_Camera in this scene", error_prefix, _PyUnicode_AsString(value)); - return false; - } - } - - if (PyObject_TypeCheck(value, &KX_Camera::Type)) { - *object = static_castBGE_PROXY_REF(value); - - /* sets the error */ - if (*object==NULL) { - PyErr_Format(PyExc_SystemError, "%s, " BGE_PROXY_ERROR_MSG, error_prefix); - return false; - } - - return true; - } - - *object = NULL; - - if (py_none_ok) { - PyErr_Format(PyExc_TypeError, "%s, expect a KX_Camera, a string or None", error_prefix); - } else { - PyErr_Format(PyExc_TypeError, "%s, expect a KX_Camera or a string", error_prefix); - } - - return false; -} - -KX_PYMETHODDEF_DOC_O(KX_Camera, getScreenPosition, -"getScreenPosition()\n" -) - -{ - MT_Vector3 vect; - KX_GameObject *obj = NULL; - - if (!PyVecTo(value, vect)) - { - if(ConvertPythonToGameObject(value, &obj, true, "")) - { - PyErr_Clear(); - vect = MT_Vector3(obj->NodeGetWorldPosition()); - } - else - { - PyErr_SetString(PyExc_TypeError, "Error in getScreenPosition. Expected a Vector3 or a KX_GameObject or a string for a name of a KX_GameObject"); - return NULL; - } - } - - GLint viewport[4]; - GLdouble win[3]; - GLdouble modelmatrix[16]; - GLdouble projmatrix[16]; - - MT_Matrix4x4 m_modelmatrix = this->GetModelviewMatrix(); - MT_Matrix4x4 m_projmatrix = this->GetProjectionMatrix(); - - m_modelmatrix.getValue(modelmatrix); - m_projmatrix.getValue(projmatrix); - - glGetIntegerv(GL_VIEWPORT, viewport); - - gluProject(vect[0], vect[1], vect[2], modelmatrix, projmatrix, viewport, &win[0], &win[1], &win[2]); - - vect[0] = (win[0] - viewport[0]) / viewport[2]; - vect[1] = (win[1] - viewport[1]) / viewport[3]; - - vect[1] = 1.0 - vect[1]; //to follow Blender window coordinate system (Top-Down) - - PyObject* ret = PyTuple_New(2); - if(ret){ - PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(vect[0])); - PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(vect[1])); - return ret; - } - - return NULL; -} - -KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenVect, -"getScreenVect()\n" -) -{ - double x,y; - if (!PyArg_ParseTuple(args,"dd:getScreenVect",&x,&y)) - return NULL; - - y = 1.0 - y; //to follow Blender window coordinate system (Top-Down) - - MT_Vector3 vect; - MT_Point3 campos, screenpos; - - GLint viewport[4]; - GLdouble win[3]; - GLdouble modelmatrix[16]; - GLdouble projmatrix[16]; - - MT_Matrix4x4 m_modelmatrix = this->GetModelviewMatrix(); - MT_Matrix4x4 m_projmatrix = this->GetProjectionMatrix(); - - m_modelmatrix.getValue(modelmatrix); - m_projmatrix.getValue(projmatrix); - - glGetIntegerv(GL_VIEWPORT, viewport); - - vect[0] = x * viewport[2]; - vect[1] = y * viewport[3]; - - vect[0] += viewport[0]; - vect[1] += viewport[1]; - - glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &vect[2]); - gluUnProject(vect[0], vect[1], vect[2], modelmatrix, projmatrix, viewport, &win[0], &win[1], &win[2]); - - campos = this->GetCameraLocation(); - screenpos = MT_Point3(win[0], win[1], win[2]); - vect = campos-screenpos; - - vect.normalize(); - return PyObjectFrom(vect); -} - -KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay, -"getScreenRay()\n" -) -{ - MT_Vector3 vect; - double x,y,dist; - char *propName = NULL; - - if (!PyArg_ParseTuple(args,"ddd|s:getScreenRay",&x,&y,&dist,&propName)) - return NULL; - - PyObject* argValue = PyTuple_New(2); - if (argValue) { - PyTuple_SET_ITEM(argValue, 0, PyFloat_FromDouble(x)); - PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(y)); - } - - if(!PyVecTo(PygetScreenVect(argValue), vect)) - { - Py_DECREF(argValue); - PyErr_SetString(PyExc_TypeError, - "Error in getScreenRay. Invalid 2D coordinate. Expected a normalized 2D screen coordinate, a distance and an optional property argument"); - return NULL; - } - Py_DECREF(argValue); - - dist = -dist; - vect += this->GetCameraLocation(); - - argValue = (propName?PyTuple_New(3):PyTuple_New(2)); - if (argValue) { - PyTuple_SET_ITEM(argValue, 0, PyObjectFrom(vect)); - PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(dist)); - if (propName) - PyTuple_SET_ITEM(argValue, 2, PyUnicode_FromString(propName)); - - PyObject* ret= this->PyrayCastTo(argValue,NULL); - Py_DECREF(argValue); - return ret; - } - - return NULL; -} -#endif diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h deleted file mode 100644 index e209f0461b9..00000000000 --- a/source/gameengine/Ketsji/KX_Camera.h +++ /dev/null @@ -1,314 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Camera in the gameengine. Cameras are also used for views. - */ - -#ifndef __KX_CAMERA -#define __KX_CAMERA - - -#include "MT_Transform.h" -#include "MT_Matrix3x3.h" -#include "MT_Matrix4x4.h" -#include "MT_Vector3.h" -#include "MT_Point3.h" -#include "KX_GameObject.h" -#include "IntValue.h" -#include "RAS_CameraData.h" - -#ifndef DISABLE_PYTHON -/* utility conversion function */ -bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok, const char *error_prefix); -#endif - -class KX_Camera : public KX_GameObject -{ - Py_Header; -protected: - friend class KX_Scene; - /** Camera parameters (clips distances, focal lenght). These - * params are closely tied to Blender. In the gameengine, only the - * projection and modelview matrices are relevant. There's a - * conversion being done in the engine class. Why is it stored - * here? It doesn't really have a function here. */ - RAS_CameraData m_camdata; - - // Never used, I think... -// void MoveTo(const MT_Point3& movevec) -// { - /*MT_Transform camtrans; - camtrans.invert(m_trans1); - MT_Matrix3x3 camorient = camtrans.getBasis(); - camtrans.translate(camorient.inverse()*movevec); - m_trans1.invert(camtrans); - */ -// } - - /** - * Storage for the projection matrix that is passed to the - * rasterizer. */ - MT_Matrix4x4 m_projection_matrix; - //MT_Matrix4x4 m_projection_matrix1; - - /** - * Storage for the modelview matrix that is passed to the - * rasterizer. */ - MT_Matrix4x4 m_modelview_matrix; - - /** - * true if the view frustum (modelview/projection matrix) - * has changed - the clip planes (m_planes) will have to be - * regenerated. - */ - bool m_dirty; - /** - * true if the frustum planes have been normalized. - */ - bool m_normalized; - - /** - * View Frustum clip planes. - */ - MT_Vector4 m_planes[6]; - - /** - * This camera is frustum culling. - * Some cameras (ie if the game was started from a non camera view should not cull.) - */ - bool m_frustum_culling; - - /** - * true if this camera has a valid projection matrix. - */ - bool m_set_projection_matrix; - - /** - * The center point of the frustum. - */ - MT_Point3 m_frustum_center; - MT_Scalar m_frustum_radius; - bool m_set_frustum_center; - - /** - * whether the camera should delete the node itself (only for shadow camera) - */ - bool m_delete_node; - - /** - * Extracts the camera clip frames from the projection and world-to-camera matrices. - */ - void ExtractClipPlanes(); - /** - * Normalize the camera clip frames. - */ - void NormalizeClipPlanes(); - /** - * Extracts the bound sphere of the view frustum. - */ - void ExtractFrustumSphere(); - /** - * return the clip plane - */ - MT_Vector4 *GetNormalizedClipPlanes() - { - ExtractClipPlanes(); - NormalizeClipPlanes(); - return m_planes; - } - -public: - - enum { INSIDE, INTERSECT, OUTSIDE } ; - - KX_Camera(void* sgReplicationInfo,SG_Callbacks callbacks,const RAS_CameraData& camdata, bool frustum_culling = true, bool delete_node = false); - virtual ~KX_Camera(); - - /** - * Inherited from CValue -- return a new copy of this - * instance allocated on the heap. Ownership of the new - * object belongs with the caller. - */ - virtual CValue* - GetReplica( - ); - virtual void ProcessReplica(); - - MT_Transform GetWorldToCamera() const; - MT_Transform GetCameraToWorld() const; - - /** - * Not implemented. - */ - void CorrectLookUp(MT_Scalar speed); - const MT_Point3 GetCameraLocation() const; - - /* I want the camera orientation as well. */ - const MT_Quaternion GetCameraOrientation() const; - - /** Sets the projection matrix that is used by the rasterizer. */ - void SetProjectionMatrix(const MT_Matrix4x4 & mat); - - /** Sets the modelview matrix that is used by the rasterizer. */ - void SetModelviewMatrix(const MT_Matrix4x4 & mat); - - /** Gets the projection matrix that is used by the rasterizer. */ - const MT_Matrix4x4& GetProjectionMatrix() const; - - /** returns true if this camera has been set a projection matrix. */ - bool hasValidProjectionMatrix() const; - - /** Sets the validity of the projection matrix. Call this if you change camera - data (eg lens, near plane, far plane) and require the projection matrix to be - recalculated. - */ - void InvalidateProjectionMatrix(bool valid = false); - - /** Gets the modelview matrix that is used by the rasterizer. - * @warning If the Camera is a dynamic object then this method may return garbage. Use GetCameraToWorld() instead. - */ - const MT_Matrix4x4& GetModelviewMatrix() const; - - /** Gets the aperture. */ - float GetLens() const; - /** Gets the ortho scale. */ - float GetScale() const; - /** Gets the near clip distance. */ - float GetCameraNear() const; - /** Gets the far clip distance. */ - float GetCameraFar() const; - /** Gets the focal length (only used for stereo rendering) */ - float GetFocalLength() const; - /** Gets all camera data. */ - RAS_CameraData* GetCameraData(); - - /** - * Tests if the given sphere is inside this camera's view frustum. - * - * @param center The center of the sphere, in world coordinates. - * @param radius The radius of the sphere. - * @return INSIDE, INTERSECT, or OUTSIDE depending on the sphere's relation to the frustum. - */ - int SphereInsideFrustum(const MT_Point3& center, const MT_Scalar &radius); - /** - * Tests the given eight corners of a box with the view frustum. - * - * @param box a pointer to eight MT_Point3 representing the world coordinates of the corners of the box. - * @return INSIDE, INTERSECT, or OUTSIDE depending on the box's relation to the frustum. - */ - int BoxInsideFrustum(const MT_Point3 *box); - /** - * Tests the given point against the view frustum. - * @return true if the given point is inside or on the view frustum; false if it is outside. - */ - bool PointInsideFrustum(const MT_Point3& x); - - /** - * Gets this camera's culling status. - */ - bool GetFrustumCulling() const; - - /** - * Sets this camera's viewport status. - */ - void EnableViewport(bool viewport); - - /** - * Sets this camera's viewport. - */ - void SetViewport(int left, int bottom, int right, int top); - - /** - * Gets this camera's viewport status. - */ - bool GetViewport() const; - - /** - * Gets this camera's viewport left. - */ - int GetViewportLeft() const; - - /** - * Gets this camera's viewport bottom. - */ - int GetViewportBottom() const; - - /** - * Gets this camera's viewport right. - */ - int GetViewportRight() const; - - /** - * Gets this camera's viewport top. - */ - int GetViewportTop() const; - - virtual int GetGameObjectType() { return OBJ_CAMERA; } - -#ifndef DISABLE_PYTHON - KX_PYMETHOD_DOC_VARARGS(KX_Camera, sphereInsideFrustum); - KX_PYMETHOD_DOC_O(KX_Camera, boxInsideFrustum); - KX_PYMETHOD_DOC_O(KX_Camera, pointInsideFrustum); - - KX_PYMETHOD_DOC_NOARGS(KX_Camera, getCameraToWorld); - KX_PYMETHOD_DOC_NOARGS(KX_Camera, getWorldToCamera); - - KX_PYMETHOD_DOC_VARARGS(KX_Camera, setViewport); - KX_PYMETHOD_DOC_NOARGS(KX_Camera, setOnTop); - - KX_PYMETHOD_DOC_O(KX_Camera, getScreenPosition); - KX_PYMETHOD_DOC_VARARGS(KX_Camera, getScreenVect); - KX_PYMETHOD_DOC_VARARGS(KX_Camera, getScreenRay); - - static PyObject* pyattr_get_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - static PyObject* pyattr_get_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - static PyObject* pyattr_get_use_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_use_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - static PyObject* pyattr_get_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - static PyObject* pyattr_get_modelview_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_camera_to_world(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_world_to_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - - static PyObject* pyattr_get_INSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_OUTSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_INTERSECT(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); -#endif -}; - -#endif //__KX_CAMERA - diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp deleted file mode 100644 index bc67ecbe1a5..00000000000 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ /dev/null @@ -1,419 +0,0 @@ -/** - * KX_CameraActuator.cpp - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -#include "KX_CameraActuator.h" -#include -#include -#include -#include "KX_GameObject.h" - -#include "PyObjectPlus.h" - - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_CameraActuator::KX_CameraActuator( - SCA_IObject* gameobj, - SCA_IObject *obj, - float hght, - float minhght, - float maxhght, - bool xytog -): - SCA_IActuator(gameobj, KX_ACT_CAMERA), - m_ob (obj), - m_height (hght), - m_minHeight (minhght), - m_maxHeight (maxhght), - m_x (xytog) -{ - if (m_ob) - m_ob->RegisterActuator(this); -} - -KX_CameraActuator::~KX_CameraActuator() -{ - if (m_ob) - m_ob->UnregisterActuator(this); -} - - CValue* -KX_CameraActuator:: -GetReplica( -) { - KX_CameraActuator* replica = new KX_CameraActuator(*this); - replica->ProcessReplica(); - return replica; -}; - -void KX_CameraActuator::ProcessReplica() -{ - if (m_ob) - m_ob->RegisterActuator(this); - SCA_IActuator::ProcessReplica(); -} - -bool KX_CameraActuator::UnlinkObject(SCA_IObject* clientobj) -{ - if (clientobj == m_ob) - { - // this object is being deleted, we cannot continue to track it. - m_ob = NULL; - return true; - } - return false; -} - - -void KX_CameraActuator::Relink(GEN_Map *obj_map) -{ - void **h_obj = (*obj_map)[m_ob]; - if (h_obj) { - if (m_ob) - m_ob->UnregisterActuator(this); - m_ob = (SCA_IObject*)(*h_obj); - m_ob->RegisterActuator(this); - } -} - -/* three functions copied from blender arith... don't know if there's an equivalent */ - -static float Kx_Normalize(float *n) -{ - float d; - - d= n[0]*n[0]+n[1]*n[1]+n[2]*n[2]; - /* FLT_EPSILON is too large! A larger value causes normalize errors in a scaled down utah teapot */ - if(d>0.0000000000001) { - d= sqrt(d); - - n[0]/=d; - n[1]/=d; - n[2]/=d; - } else { - n[0]=n[1]=n[2]= 0.0; - d= 0.0; - } - return d; -} - -static void Kx_Crossf(float *c, float *a, float *b) -{ - c[0] = a[1] * b[2] - a[2] * b[1]; - c[1] = a[2] * b[0] - a[0] * b[2]; - c[2] = a[0] * b[1] - a[1] * b[0]; -} - - -static void Kx_VecUpMat3(float *vec, float mat[][3], short axis) -{ - - // Construct a camera matrix s.t. the specified axis - - // maps to the given vector (*vec). Also defines the rotation - - // about this axis by mapping one of the other axis to the y-axis. - - - float inp; - short cox = 0, coy = 0, coz = 0; - - /* up varieeren heeft geen zin, is eigenlijk helemaal geen up! - * zie VecUpMat3old - */ - - if(axis==0) { - cox= 0; coy= 1; coz= 2; /* Y up Z tr */ - } - if(axis==1) { - cox= 1; coy= 2; coz= 0; /* Z up X tr */ - } - if(axis==2) { - cox= 2; coy= 0; coz= 1; /* X up Y tr */ - } - if(axis==3) { - cox= 0; coy= 1; coz= 2; /* Y op -Z tr */ - vec[0]= -vec[0]; - vec[1]= -vec[1]; - vec[2]= -vec[2]; - } - if(axis==4) { - cox= 1; coy= 0; coz= 2; /* */ - } - if(axis==5) { - cox= 2; coy= 1; coz= 0; /* Y up X tr */ - } - - mat[coz][0]= vec[0]; - mat[coz][1]= vec[1]; - mat[coz][2]= vec[2]; - if (Kx_Normalize((float *)mat[coz]) == 0.f) { - /* this is a very abnormal situation: the camera has reach the object center exactly - We will choose a completely arbitrary direction */ - mat[coz][0] = 1.0f; - mat[coz][1] = 0.0f; - mat[coz][2] = 0.0f; - } - - inp= mat[coz][2]; - mat[coy][0]= - inp*mat[coz][0]; - mat[coy][1]= - inp*mat[coz][1]; - mat[coy][2]= 1.0 - inp*mat[coz][2]; - - if (Kx_Normalize((float *)mat[coy]) == 0.f) { - /* the camera is vertical, chose the y axis arbitrary */ - mat[coy][0] = 0.f; - mat[coy][1] = 1.f; - mat[coy][2] = 0.f; - } - - Kx_Crossf(mat[cox], mat[coy], mat[coz]); - -} - -bool KX_CameraActuator::Update(double curtime, bool frame) -{ - /* wondering... is it really neccesary/desirable to suppress negative */ - /* events here? */ - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (bNegativeEvent || !m_ob) - return false; - - KX_GameObject *obj = (KX_GameObject*) GetParent(); - MT_Point3 from = obj->NodeGetWorldPosition(); - MT_Matrix3x3 frommat = obj->NodeGetWorldOrientation(); - /* These casts are _very_ dangerous!!! */ - MT_Point3 lookat = ((KX_GameObject*)m_ob)->NodeGetWorldPosition(); - MT_Matrix3x3 actormat = ((KX_GameObject*)m_ob)->NodeGetWorldOrientation(); - - float fp1[3], fp2[3], rc[3]; - float inp, fac; //, factor = 0.0; /* some factor... */ - float mindistsq, maxdistsq, distsq; - float mat[3][3]; - - /* The rules: */ - /* CONSTRAINT 1: not implemented */ - /* CONSTRAINT 2: can camera see actor? */ - /* CONSTRAINT 3: fixed height relative to floor below actor. */ - /* CONSTRAINT 4: camera rotates behind actor */ - /* CONSTRAINT 5: minimum / maximum distance */ - /* CONSTRAINT 6: again: fixed height relative to floor below actor */ - /* CONSTRAINT 7: track to floor below actor */ - /* CONSTRAINT 8: look a little bit left or right, depending on how the - - character is looking (horizontal x) - */ - - /* ...and then set the camera position. Since we assume the parent of */ - /* this actuator is always a camera, just set the parent position and */ - /* rotation. We do not check whether we really have a camera as parent. */ - /* It may be better to turn this into a general tracking actuator later */ - /* on, since lots of plausible relations can be filled in here. */ - - /* ... set up some parameters ... */ - /* missing here: the 'floorloc' of the actor's shadow */ - - mindistsq= m_minHeight*m_minHeight; - maxdistsq= m_maxHeight*m_maxHeight; - - /* C1: not checked... is a future option */ - - /* C2: blender test_visibility function. Can this be a ray-test? */ - - /* C3: fixed height */ - from[2] = (15.0*from[2] + lookat[2] + m_height)/16.0; - - - /* C4: camera behind actor */ - if (m_x) { - fp1[0] = actormat[0][0]; - fp1[1] = actormat[1][0]; - fp1[2] = actormat[2][0]; - - fp2[0] = frommat[0][0]; - fp2[1] = frommat[1][0]; - fp2[2] = frommat[2][0]; - } - else { - fp1[0] = actormat[0][1]; - fp1[1] = actormat[1][1]; - fp1[2] = actormat[2][1]; - - fp2[0] = frommat[0][1]; - fp2[1] = frommat[1][1]; - fp2[2] = frommat[2][1]; - } - - inp= fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2]; - fac= (-1.0 + inp)/32.0; - - from[0]+= fac*fp1[0]; - from[1]+= fac*fp1[1]; - from[2]+= fac*fp1[2]; - - /* alleen alstie ervoor ligt: cross testen en loodrechte bijtellen */ - if(inp<0.0) { - if(fp1[0]*fp2[1] - fp1[1]*fp2[0] > 0.0) { - from[0]-= fac*fp1[1]; - from[1]+= fac*fp1[0]; - } - else { - from[0]+= fac*fp1[1]; - from[1]-= fac*fp1[0]; - } - } - - /* CONSTRAINT 5: minimum / maximum afstand */ - - rc[0]= (lookat[0]-from[0]); - rc[1]= (lookat[1]-from[1]); - rc[2]= (lookat[2]-from[2]); - distsq= rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2]; - - if(distsq > maxdistsq) { - distsq = 0.15*(distsq-maxdistsq)/distsq; - - from[0] += distsq*rc[0]; - from[1] += distsq*rc[1]; - from[2] += distsq*rc[2]; - } - else if(distsq < mindistsq) { - distsq = 0.15*(mindistsq-distsq)/mindistsq; - - from[0] -= distsq*rc[0]; - from[1] -= distsq*rc[1]; - from[2] -= distsq*rc[2]; - } - - - /* CONSTRAINT 7: track to schaduw */ - rc[0]= (lookat[0]-from[0]); - rc[1]= (lookat[1]-from[1]); - rc[2]= (lookat[2]-from[2]); - Kx_VecUpMat3(rc, mat, 3); /* y up Track -z */ - - - - - /* now set the camera position and rotation */ - - obj->NodeSetLocalPosition(from); - - actormat[0][0]= mat[0][0]; actormat[0][1]= mat[1][0]; actormat[0][2]= mat[2][0]; - actormat[1][0]= mat[0][1]; actormat[1][1]= mat[1][1]; actormat[1][2]= mat[2][1]; - actormat[2][0]= mat[0][2]; actormat[2][1]= mat[1][2]; actormat[2][2]= mat[2][2]; - obj->NodeSetLocalOrientation(actormat); - - return true; -} - -CValue *KX_CameraActuator::findObject(char *obName) -{ - /* hook to object system */ - return NULL; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_CameraActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_CameraActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_CameraActuator::Methods[] = { - {NULL, NULL} //Sentinel -}; - -PyAttributeDef KX_CameraActuator::Attributes[] = { - KX_PYATTRIBUTE_FLOAT_RW("min",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_minHeight), - KX_PYATTRIBUTE_FLOAT_RW("max",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_maxHeight), - KX_PYATTRIBUTE_FLOAT_RW("height",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_height), - KX_PYATTRIBUTE_BOOL_RW("useXY",KX_CameraActuator,m_x), - KX_PYATTRIBUTE_RW_FUNCTION("object", KX_CameraActuator, pyattr_get_object, pyattr_set_object), - {NULL} -}; - -PyObject* KX_CameraActuator::pyattr_get_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_CameraActuator* self= static_cast(self_v); - if (self->m_ob==NULL) - Py_RETURN_NONE; - else - return self->m_ob->GetProxy(); -} - -int KX_CameraActuator::pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_CameraActuator* self= static_cast(self_v); - KX_GameObject *gameobj; - - if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.object = value: KX_CameraActuator")) - return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - - if (self->m_ob) - self->m_ob->UnregisterActuator(self); - - if ((self->m_ob = (SCA_IObject*)gameobj)) - self->m_ob->RegisterActuator(self); - - return PY_SET_ATTR_SUCCESS; -} - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h deleted file mode 100644 index 2bc0ee18593..00000000000 --- a/source/gameengine/Ketsji/KX_CameraActuator.h +++ /dev/null @@ -1,132 +0,0 @@ -/** - * KX_CameraActuator.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_CAMERAACTUATOR -#define __KX_CAMERAACTUATOR - -#include "SCA_IActuator.h" -#include "MT_Scalar.h" -#include "SCA_LogicManager.h" - -/** - * The camera actuator does a Robbie Muller prespective for you. This is a - * weird set of rules that positions the camera sort of behind the object, - * tracking, while avoiding any objects between the 'ideal' position and the - * actor being tracked. - */ - - -class KX_CameraActuator : public SCA_IActuator -{ - Py_Header; -private : - /** Object that will be tracked. */ - SCA_IObject *m_ob; - - /** height (float), */ - //const MT_Scalar m_height; - /** min (float), */ - //const MT_Scalar m_minHeight; - /** max (float), */ - //const MT_Scalar m_maxHeight; - - /** height (float), */ - float m_height; - - /** min (float), */ - float m_minHeight; - - /** max (float), */ - float m_maxHeight; - - /** xy toggle (pick one): true == x, false == y */ - bool m_x; - - /* get the KX_IGameObject with this name */ - CValue *findObject(char *obName); - - /* parse x or y to a toggle pick */ - bool string2axischoice(const char *axisString); - - public: - static STR_String X_AXIS_STRING; - static STR_String Y_AXIS_STRING; - - /** - * Set the bool toggle to true to use x lock, false for y lock - */ - KX_CameraActuator( - - SCA_IObject *gameobj, - //const CValue *ob, - SCA_IObject *ob, - float hght, - float minhght, - float maxhght, - bool xytog - ); - - - ~KX_CameraActuator(); - - - - /** Methods Inherited from CValue */ - CValue* GetReplica(); - virtual void ProcessReplica(); - - - /** Methods inherited from SCA_IActuator */ - virtual bool Update( - double curtime, - bool frame - ); - virtual bool UnlinkObject(SCA_IObject* clientobj); - - /** Methods inherited from SCA_ILogicBrick */ - virtual void Relink(GEN_Map *obj_map); - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - /* set object to look at */ - static PyObject* pyattr_get_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - -#endif // DISABLE_PYTHON - -}; - -#endif //__KX_CAMERAACTUATOR - diff --git a/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp b/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp deleted file mode 100644 index 0bfa1133a1c..00000000000 --- a/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_CameraIpoSGController.h" -#include "KX_ScalarInterpolator.h" -#include "KX_Camera.h" -#include "RAS_CameraData.h" - -#if defined(_WIN64) -typedef unsigned __int64 uint_ptr; -#else -typedef unsigned long uint_ptr; -#endif - -bool KX_CameraIpoSGController::Update(double currentTime) -{ - if (m_modified) - { - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - (*i)->Execute(m_ipotime); - } - - SG_Spatial* ob = (SG_Spatial*)m_pObject; - KX_Camera* kxcamera = (KX_Camera*) ob->GetSGClientObject(); - RAS_CameraData* camdata = kxcamera->GetCameraData(); - - if (m_modify_lens) - camdata->m_lens = m_lens; - - if (m_modify_clipstart ) - camdata->m_clipstart = m_clipstart; - - if (m_modify_clipend) - camdata->m_clipend = m_clipend; - - if (m_modify_lens || m_modify_clipstart || m_modify_clipend) - kxcamera->InvalidateProjectionMatrix(); - - m_modified=false; - } - return false; -} - - -void KX_CameraIpoSGController::AddInterpolator(KX_IInterpolator* interp) -{ - this->m_interpolators.push_back(interp); -} - -SG_Controller* KX_CameraIpoSGController::GetReplica(class SG_Node* destnode) -{ - KX_CameraIpoSGController* iporeplica = new KX_CameraIpoSGController(*this); - // clear object that ipo acts on - iporeplica->ClearObject(); - - // dirty hack, ask Gino for a better solution in the ipo implementation - // hacken en zagen, in what we call datahiding, not written for replication :( - - T_InterpolatorList oldlist = m_interpolators; - iporeplica->m_interpolators.clear(); - - T_InterpolatorList::iterator i; - for (i = oldlist.begin(); !(i == oldlist.end()); ++i) { - KX_ScalarInterpolator* copyipo = new KX_ScalarInterpolator(*((KX_ScalarInterpolator*)*i)); - iporeplica->AddInterpolator(copyipo); - - MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget(); - uint_ptr orgbase = (uint_ptr)this; - uint_ptr orgloc = (uint_ptr)scaal; - uint_ptr offset = orgloc-orgbase; - uint_ptr newaddrbase = (uint_ptr)iporeplica + offset; - MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; - copyipo->SetNewTarget((MT_Scalar*)blaptr); - } - - return iporeplica; -} - -KX_CameraIpoSGController::~KX_CameraIpoSGController() -{ - - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - delete (*i); - } - -} - - void -KX_CameraIpoSGController::SetOption( - int option, - int value) -{ - /* Setting options */ - -} diff --git a/source/gameengine/Ketsji/KX_CameraIpoSGController.h b/source/gameengine/Ketsji/KX_CameraIpoSGController.h deleted file mode 100644 index 3690043f4a9..00000000000 --- a/source/gameengine/Ketsji/KX_CameraIpoSGController.h +++ /dev/null @@ -1,97 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_CAMERAIPOSGCONTROLLER_H -#define KX_CAMERAIPOSGCONTROLLER_H - -#include "SG_Controller.h" -#include "SG_Spatial.h" - -#include "KX_IInterpolator.h" - -struct RAS_CameraData; - -class KX_CameraIpoSGController : public SG_Controller -{ -public: - MT_Scalar m_lens; - MT_Scalar m_clipstart; - MT_Scalar m_clipend; - -private: - T_InterpolatorList m_interpolators; - unsigned short m_modify_lens : 1; - unsigned short m_modify_clipstart : 1; - unsigned short m_modify_clipend : 1; - bool m_modified; - - double m_ipotime; -public: - KX_CameraIpoSGController() : - m_modify_lens(false), - m_modify_clipstart(false), - m_modify_clipend(false), - m_modified(true), - m_ipotime(0.0) - {} - - ~KX_CameraIpoSGController(); - SG_Controller* GetReplica(class SG_Node* destnode); - bool Update(double time); - - void - SetOption( - int option, - int value - ); - - void SetSimulatedTime(double time) { - m_ipotime = time; - m_modified = true; - } - void SetModifyLens(bool modify) { - m_modify_lens = modify; - } - void SetModifyClipEnd(bool modify) { - m_modify_clipend = modify; - } - void SetModifyClipStart(bool modify) { - m_modify_clipstart = modify; - } - void AddInterpolator(KX_IInterpolator* interp); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_CameraIpoSGController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // KX_CAMERAIPOSGCONTROLLER_H - diff --git a/source/gameengine/Ketsji/KX_ClientObjectInfo.h b/source/gameengine/Ketsji/KX_ClientObjectInfo.h deleted file mode 100644 index f08988c842a..00000000000 --- a/source/gameengine/Ketsji/KX_ClientObjectInfo.h +++ /dev/null @@ -1,87 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_CLIENTOBJECT_INFO_H -#define __KX_CLIENTOBJECT_INFO_H - -/* Note, the way this works with/without sumo is a bit odd */ - -#include - -class SCA_ISensor; -class KX_GameObject; -/** - * Client Type and Additional Info. This structure can be use instead of a bare void* pointer, for safeness, and additional info for callbacks - */ -struct KX_ClientObjectInfo -{ - enum clienttype { - STATIC, - ACTOR, - RESERVED1, - SENSOR, - OBSENSOR, - OBACTORSENSOR - } m_type; - KX_GameObject* m_gameobject; - void* m_auxilary_info; - std::list m_sensors; -public: - KX_ClientObjectInfo(KX_GameObject *gameobject, clienttype type = STATIC, void *auxilary_info = NULL) : - m_type(type), - m_gameobject(gameobject), - m_auxilary_info(auxilary_info) - {} - - KX_ClientObjectInfo(const KX_ClientObjectInfo ©) : - m_type(copy.m_type), - m_gameobject(copy.m_gameobject), - m_auxilary_info(copy.m_auxilary_info) - { - } - - virtual ~KX_ClientObjectInfo() {} - - virtual bool hasCollisionCallback() - { - return m_sensors.size() != 0; - } - - bool isActor() { return m_type <= ACTOR; } - bool isSensor() { return m_type >= SENSOR && m_type <= OBACTORSENSOR; } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ClientObjectInfo"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_CLIENTOBJECT_INFO_H - diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp deleted file mode 100644 index 9380f4b5d2f..00000000000 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp +++ /dev/null @@ -1,623 +0,0 @@ -/** - * Apply a constraint to a position or rotation value - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SCA_IActuator.h" -#include "KX_ConstraintActuator.h" -#include "SCA_IObject.h" -#include "MT_Point3.h" -#include "MT_Matrix3x3.h" -#include "KX_GameObject.h" -#include "KX_RayCast.h" -#include "KX_PythonInit.h" // KX_GetActiveScene - -#include - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_ConstraintActuator::KX_ConstraintActuator(SCA_IObject *gameobj, - int posDampTime, - int rotDampTime, - float minBound, - float maxBound, - float refDir[3], - int locrotxyz, - int time, - int option, - char *property) : - SCA_IActuator(gameobj, KX_ACT_CONSTRAINT), - m_refDirVector(refDir), - m_currentTime(0) -{ - m_refDirection[0] = refDir[0]; - m_refDirection[1] = refDir[1]; - m_refDirection[2] = refDir[2]; - m_posDampTime = posDampTime; - m_rotDampTime = rotDampTime; - m_locrot = locrotxyz; - m_option = option; - m_activeTime = time; - if (property) { - m_property = property; - } else { - m_property = ""; - } - /* The units of bounds are determined by the type of constraint. To */ - /* make the constraint application easier and more transparent later on, */ - /* I think converting the bounds to the applicable domain makes more */ - /* sense. */ - switch (m_locrot) { - case KX_ACT_CONSTRAINT_ORIX: - case KX_ACT_CONSTRAINT_ORIY: - case KX_ACT_CONSTRAINT_ORIZ: - { - MT_Scalar len = m_refDirVector.length(); - if (MT_fuzzyZero(len)) { - // missing a valid direction - std::cout << "WARNING: Constraint actuator " << GetName() << ": There is no valid reference direction!" << std::endl; - m_locrot = KX_ACT_CONSTRAINT_NODEF; - } else { - m_refDirection[0] /= len; - m_refDirection[1] /= len; - m_refDirection[2] /= len; - m_refDirVector /= len; - } - m_minimumBound = cos(minBound); - m_maximumBound = cos(maxBound); - m_minimumSine = sin(minBound); - m_maximumSine = sin(maxBound); - } - break; - default: - m_minimumBound = minBound; - m_maximumBound = maxBound; - m_minimumSine = 0.f; - m_maximumSine = 0.f; - break; - } - -} /* End of constructor */ - -KX_ConstraintActuator::~KX_ConstraintActuator() -{ - // there's nothing to be done here, really.... -} /* end of destructor */ - -bool KX_ConstraintActuator::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data) -{ - - m_hitObject = client->m_gameobject; - - bool bFound = false; - - if (m_property.IsEmpty()) - { - bFound = true; - } - else - { - if (m_option & KX_ACT_CONSTRAINT_MATERIAL) - { - if (client->m_auxilary_info) - { - bFound = !strcmp(m_property.Ptr(), ((char*)client->m_auxilary_info)); - } - } - else - { - bFound = m_hitObject->GetProperty(m_property) != NULL; - } - } - // update the hit status - result->m_hitFound = bFound; - // stop looking - return true; -} - -/* this function is used to pre-filter the object before casting the ray on them. - This is useful for "X-Ray" option when we want to see "through" unwanted object. - */ -bool KX_ConstraintActuator::NeedRayCast(KX_ClientObjectInfo* client) -{ - if (client->m_type > KX_ClientObjectInfo::ACTOR) - { - // Unknown type of object, skip it. - // Should not occur as the sensor objects are filtered in RayTest() - printf("Invalid client type %d found in ray casting\n", client->m_type); - return false; - } - // no X-Ray function yet - return true; -} - -bool KX_ConstraintActuator::Update(double curtime, bool frame) -{ - - bool result = false; - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (!bNegativeEvent) { - /* Constraint clamps the values to the specified range, with a sort of */ - /* low-pass filtered time response, if the damp time is unequal to 0. */ - - /* Having to retrieve location/rotation and setting it afterwards may not */ - /* be efficient enough... Somthing to look at later. */ - KX_GameObject *obj = (KX_GameObject*) GetParent(); - MT_Point3 position = obj->NodeGetWorldPosition(); - MT_Point3 newposition; - MT_Vector3 normal, direction, refDirection; - MT_Matrix3x3 rotation = obj->NodeGetWorldOrientation(); - MT_Scalar filter, newdistance, cosangle; - int axis, sign; - - if (m_posDampTime) { - filter = m_posDampTime/(1.0+m_posDampTime); - } else { - filter = 0.0; - } - switch (m_locrot) { - case KX_ACT_CONSTRAINT_ORIX: - case KX_ACT_CONSTRAINT_ORIY: - case KX_ACT_CONSTRAINT_ORIZ: - switch (m_locrot) { - case KX_ACT_CONSTRAINT_ORIX: - direction[0] = rotation[0][0]; - direction[1] = rotation[1][0]; - direction[2] = rotation[2][0]; - axis = 0; - break; - case KX_ACT_CONSTRAINT_ORIY: - direction[0] = rotation[0][1]; - direction[1] = rotation[1][1]; - direction[2] = rotation[2][1]; - axis = 1; - break; - default: - direction[0] = rotation[0][2]; - direction[1] = rotation[1][2]; - direction[2] = rotation[2][2]; - axis = 2; - break; - } - if ((m_maximumBound < (1.0f-FLT_EPSILON)) || (m_minimumBound < (1.0f-FLT_EPSILON))) { - // reference direction needs to be evaluated - // 1. get the cosine between current direction and target - cosangle = direction.dot(m_refDirVector); - if (cosangle >= (m_maximumBound-FLT_EPSILON) && cosangle <= (m_minimumBound+FLT_EPSILON)) { - // no change to do - result = true; - goto CHECK_TIME; - } - // 2. define a new reference direction - // compute local axis with reference direction as X and - // Y in direction X refDirection plane - MT_Vector3 zaxis = m_refDirVector.cross(direction); - if (MT_fuzzyZero2(zaxis.length2())) { - // direction and refDirection are identical, - // choose any other direction to define plane - if (direction[0] < 0.9999) - zaxis = m_refDirVector.cross(MT_Vector3(1.0,0.0,0.0)); - else - zaxis = m_refDirVector.cross(MT_Vector3(0.0,1.0,0.0)); - } - MT_Vector3 yaxis = zaxis.cross(m_refDirVector); - yaxis.normalize(); - if (cosangle > m_minimumBound) { - // angle is too close to reference direction, - // choose a new reference that is exactly at minimum angle - refDirection = m_minimumBound * m_refDirVector + m_minimumSine * yaxis; - } else { - // angle is too large, choose new reference direction at maximum angle - refDirection = m_maximumBound * m_refDirVector + m_maximumSine * yaxis; - } - } else { - refDirection = m_refDirVector; - } - // apply damping on the direction - direction = filter*direction + (1.0-filter)*refDirection; - obj->AlignAxisToVect(direction, axis); - result = true; - goto CHECK_TIME; - case KX_ACT_CONSTRAINT_DIRPX: - case KX_ACT_CONSTRAINT_DIRPY: - case KX_ACT_CONSTRAINT_DIRPZ: - case KX_ACT_CONSTRAINT_DIRNX: - case KX_ACT_CONSTRAINT_DIRNY: - case KX_ACT_CONSTRAINT_DIRNZ: - switch (m_locrot) { - case KX_ACT_CONSTRAINT_DIRPX: - normal[0] = rotation[0][0]; - normal[1] = rotation[1][0]; - normal[2] = rotation[2][0]; - axis = 0; // axis according to KX_GameObject::AlignAxisToVect() - sign = 0; // X axis will be parrallel to direction of ray - break; - case KX_ACT_CONSTRAINT_DIRPY: - normal[0] = rotation[0][1]; - normal[1] = rotation[1][1]; - normal[2] = rotation[2][1]; - axis = 1; - sign = 0; - break; - case KX_ACT_CONSTRAINT_DIRPZ: - normal[0] = rotation[0][2]; - normal[1] = rotation[1][2]; - normal[2] = rotation[2][2]; - axis = 2; - sign = 0; - break; - case KX_ACT_CONSTRAINT_DIRNX: - normal[0] = -rotation[0][0]; - normal[1] = -rotation[1][0]; - normal[2] = -rotation[2][0]; - axis = 0; - sign = 1; - break; - case KX_ACT_CONSTRAINT_DIRNY: - normal[0] = -rotation[0][1]; - normal[1] = -rotation[1][1]; - normal[2] = -rotation[2][1]; - axis = 1; - sign = 1; - break; - case KX_ACT_CONSTRAINT_DIRNZ: - normal[0] = -rotation[0][2]; - normal[1] = -rotation[1][2]; - normal[2] = -rotation[2][2]; - axis = 2; - sign = 1; - break; - } - normal.normalize(); - if (m_option & KX_ACT_CONSTRAINT_LOCAL) { - // direction of the ray is along the local axis - direction = normal; - } else { - switch (m_locrot) { - case KX_ACT_CONSTRAINT_DIRPX: - direction = MT_Vector3(1.0,0.0,0.0); - break; - case KX_ACT_CONSTRAINT_DIRPY: - direction = MT_Vector3(0.0,1.0,0.0); - break; - case KX_ACT_CONSTRAINT_DIRPZ: - direction = MT_Vector3(0.0,0.0,1.0); - break; - case KX_ACT_CONSTRAINT_DIRNX: - direction = MT_Vector3(-1.0,0.0,0.0); - break; - case KX_ACT_CONSTRAINT_DIRNY: - direction = MT_Vector3(0.0,-1.0,0.0); - break; - case KX_ACT_CONSTRAINT_DIRNZ: - direction = MT_Vector3(0.0,0.0,-1.0); - break; - } - } - { - MT_Point3 topoint = position + (m_maximumBound) * direction; - PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment(); - KX_IPhysicsController *spc = obj->GetPhysicsController(); - - if (!pe) { - std::cout << "WARNING: Constraint actuator " << GetName() << ": There is no physics environment!" << std::endl; - goto CHECK_TIME; - } - if (!spc) { - // the object is not physical, we probably want to avoid hitting its own parent - KX_GameObject *parent = obj->GetParent(); - if (parent) { - spc = parent->GetPhysicsController(); - parent->Release(); - } - } - KX_RayCast::Callback callback(this,spc); - result = KX_RayCast::RayTest(pe, position, topoint, callback); - if (result) { - MT_Vector3 newnormal = callback.m_hitNormal; - // compute new position & orientation - if ((m_option & (KX_ACT_CONSTRAINT_NORMAL|KX_ACT_CONSTRAINT_DISTANCE)) == 0) { - // if none option is set, the actuator does nothing but detect ray - // (works like a sensor) - goto CHECK_TIME; - } - if (m_option & KX_ACT_CONSTRAINT_NORMAL) { - MT_Scalar rotFilter; - // apply damping on the direction - if (m_rotDampTime) { - rotFilter = m_rotDampTime/(1.0+m_rotDampTime); - } else { - rotFilter = filter; - } - newnormal = rotFilter*normal - (1.0-rotFilter)*newnormal; - obj->AlignAxisToVect((sign)?-newnormal:newnormal, axis); - if (m_option & KX_ACT_CONSTRAINT_LOCAL) { - direction = newnormal; - direction.normalize(); - } - } - if (m_option & KX_ACT_CONSTRAINT_DISTANCE) { - if (m_posDampTime) { - newdistance = filter*(position-callback.m_hitPoint).length()+(1.0-filter)*m_minimumBound; - } else { - newdistance = m_minimumBound; - } - // logically we should cancel the speed along the ray direction as we set the - // position along that axis - spc = obj->GetPhysicsController(); - if (spc && spc->IsDyna()) { - MT_Vector3 linV = spc->GetLinearVelocity(); - // cancel the projection along the ray direction - MT_Scalar fallspeed = linV.dot(direction); - if (!MT_fuzzyZero(fallspeed)) - spc->SetLinearVelocity(linV-fallspeed*direction,false); - } - } else { - newdistance = (position-callback.m_hitPoint).length(); - } - newposition = callback.m_hitPoint-newdistance*direction; - } else if (m_option & KX_ACT_CONSTRAINT_PERMANENT) { - // no contact but still keep running - result = true; - goto CHECK_TIME; - } - } - break; - case KX_ACT_CONSTRAINT_FHPX: - case KX_ACT_CONSTRAINT_FHPY: - case KX_ACT_CONSTRAINT_FHPZ: - case KX_ACT_CONSTRAINT_FHNX: - case KX_ACT_CONSTRAINT_FHNY: - case KX_ACT_CONSTRAINT_FHNZ: - switch (m_locrot) { - case KX_ACT_CONSTRAINT_FHPX: - normal[0] = -rotation[0][0]; - normal[1] = -rotation[1][0]; - normal[2] = -rotation[2][0]; - direction = MT_Vector3(1.0,0.0,0.0); - break; - case KX_ACT_CONSTRAINT_FHPY: - normal[0] = -rotation[0][1]; - normal[1] = -rotation[1][1]; - normal[2] = -rotation[2][1]; - direction = MT_Vector3(0.0,1.0,0.0); - break; - case KX_ACT_CONSTRAINT_FHPZ: - normal[0] = -rotation[0][2]; - normal[1] = -rotation[1][2]; - normal[2] = -rotation[2][2]; - direction = MT_Vector3(0.0,0.0,1.0); - break; - case KX_ACT_CONSTRAINT_FHNX: - normal[0] = rotation[0][0]; - normal[1] = rotation[1][0]; - normal[2] = rotation[2][0]; - direction = MT_Vector3(-1.0,0.0,0.0); - break; - case KX_ACT_CONSTRAINT_FHNY: - normal[0] = rotation[0][1]; - normal[1] = rotation[1][1]; - normal[2] = rotation[2][1]; - direction = MT_Vector3(0.0,-1.0,0.0); - break; - case KX_ACT_CONSTRAINT_FHNZ: - normal[0] = rotation[0][2]; - normal[1] = rotation[1][2]; - normal[2] = rotation[2][2]; - direction = MT_Vector3(0.0,0.0,-1.0); - break; - } - normal.normalize(); - { - PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment(); - KX_IPhysicsController *spc = obj->GetPhysicsController(); - - if (!pe) { - std::cout << "WARNING: Constraint actuator " << GetName() << ": There is no physics environment!" << std::endl; - goto CHECK_TIME; - } - if (!spc || !spc->IsDyna()) { - // the object is not dynamic, it won't support setting speed - goto CHECK_TIME; - } - m_hitObject = NULL; - // distance of Fh area is stored in m_minimum - MT_Point3 topoint = position + (m_minimumBound+spc->GetRadius()) * direction; - KX_RayCast::Callback callback(this,spc); - result = KX_RayCast::RayTest(pe, position, topoint, callback); - // we expect a hit object - if (!m_hitObject) - result = false; - if (result) - { - MT_Vector3 newnormal = callback.m_hitNormal; - // compute new position & orientation - MT_Scalar distance = (callback.m_hitPoint-position).length()-spc->GetRadius(); - // estimate the velocity of the hit point - MT_Point3 relativeHitPoint; - relativeHitPoint = (callback.m_hitPoint-m_hitObject->NodeGetWorldPosition()); - MT_Vector3 velocityHitPoint = m_hitObject->GetVelocity(relativeHitPoint); - MT_Vector3 relativeVelocity = spc->GetLinearVelocity() - velocityHitPoint; - MT_Scalar relativeVelocityRay = direction.dot(relativeVelocity); - MT_Scalar springExtent = 1.0 - distance/m_minimumBound; - // Fh force is stored in m_maximum - MT_Scalar springForce = springExtent * m_maximumBound; - // damping is stored in m_refDirection [0] = damping, [1] = rot damping - MT_Scalar springDamp = relativeVelocityRay * m_refDirVector[0]; - MT_Vector3 newVelocity = spc->GetLinearVelocity()-(springForce+springDamp)*direction; - if (m_option & KX_ACT_CONSTRAINT_NORMAL) - { - newVelocity+=(springForce+springDamp)*(newnormal-newnormal.dot(direction)*direction); - } - spc->SetLinearVelocity(newVelocity, false); - if (m_option & KX_ACT_CONSTRAINT_DOROTFH) - { - MT_Vector3 angSpring = (normal.cross(newnormal))*m_maximumBound; - MT_Vector3 angVelocity = spc->GetAngularVelocity(); - // remove component that is parallel to normal - angVelocity -= angVelocity.dot(newnormal)*newnormal; - MT_Vector3 angDamp = angVelocity * ((m_refDirVector[1]>MT_EPSILON)?m_refDirVector[1]:m_refDirVector[0]); - spc->SetAngularVelocity(spc->GetAngularVelocity()+(angSpring-angDamp), false); - } - } else if (m_option & KX_ACT_CONSTRAINT_PERMANENT) { - // no contact but still keep running - result = true; - } - // don't set the position with this constraint - goto CHECK_TIME; - } - break; - case KX_ACT_CONSTRAINT_LOCX: - case KX_ACT_CONSTRAINT_LOCY: - case KX_ACT_CONSTRAINT_LOCZ: - newposition = position = obj->GetSGNode()->GetLocalPosition(); - switch (m_locrot) { - case KX_ACT_CONSTRAINT_LOCX: - Clamp(newposition[0], m_minimumBound, m_maximumBound); - break; - case KX_ACT_CONSTRAINT_LOCY: - Clamp(newposition[1], m_minimumBound, m_maximumBound); - break; - case KX_ACT_CONSTRAINT_LOCZ: - Clamp(newposition[2], m_minimumBound, m_maximumBound); - break; - } - result = true; - if (m_posDampTime) { - newposition = filter*position + (1.0-filter)*newposition; - } - obj->NodeSetLocalPosition(newposition); - goto CHECK_TIME; - } - if (result) { - // set the new position but take into account parent if any - obj->NodeSetWorldPosition(newposition); - } - CHECK_TIME: - if (result && m_activeTime > 0 ) { - if (++m_currentTime >= m_activeTime) - result = false; - } - } - if (!result) { - m_currentTime = 0; - } - return result; -} /* end of KX_ConstraintActuator::Update(double curtime,double deltatime) */ - -void KX_ConstraintActuator::Clamp(MT_Scalar &var, - float min, - float max) { - if (var < min) { - var = min; - } else if (var > max) { - var = max; - } -} - - -bool KX_ConstraintActuator::IsValidMode(KX_ConstraintActuator::KX_CONSTRAINTTYPE m) -{ - bool res = false; - - if ( (m > KX_ACT_CONSTRAINT_NODEF) && (m < KX_ACT_CONSTRAINT_MAX)) { - res = true; - } - - return res; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_ConstraintActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_ConstraintActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_ConstraintActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_ConstraintActuator::Attributes[] = { - KX_PYATTRIBUTE_INT_RW("damp",0,100,true,KX_ConstraintActuator,m_posDampTime), - KX_PYATTRIBUTE_INT_RW("rotDamp",0,100,true,KX_ConstraintActuator,m_rotDampTime), - KX_PYATTRIBUTE_FLOAT_ARRAY_RW_CHECK("direction",-FLT_MAX,FLT_MAX,KX_ConstraintActuator,m_refDirection,3,pyattr_check_direction), - KX_PYATTRIBUTE_INT_RW("option",0,0xFFFF,false,KX_ConstraintActuator,m_option), - KX_PYATTRIBUTE_INT_RW("time",0,1000,true,KX_ConstraintActuator,m_activeTime), - KX_PYATTRIBUTE_STRING_RW("propName",0,32,true,KX_ConstraintActuator,m_property), - KX_PYATTRIBUTE_FLOAT_RW("min",-FLT_MAX,FLT_MAX,KX_ConstraintActuator,m_minimumBound), - KX_PYATTRIBUTE_FLOAT_RW("distance",-FLT_MAX,FLT_MAX,KX_ConstraintActuator,m_minimumBound), - KX_PYATTRIBUTE_FLOAT_RW("max",-FLT_MAX,FLT_MAX,KX_ConstraintActuator,m_maximumBound), - KX_PYATTRIBUTE_FLOAT_RW("rayLength",0,2000.f,KX_ConstraintActuator,m_maximumBound), - KX_PYATTRIBUTE_INT_RW("limit",KX_ConstraintActuator::KX_ACT_CONSTRAINT_NODEF+1,KX_ConstraintActuator::KX_ACT_CONSTRAINT_MAX-1,false,KX_ConstraintActuator,m_locrot), - { NULL } //Sentinel -}; - -int KX_ConstraintActuator::pyattr_check_direction(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_ConstraintActuator* act = static_cast(self); - MT_Vector3 dir(act->m_refDirection); - MT_Scalar len = dir.length(); - if (MT_fuzzyZero(len)) { - PyErr_SetString(PyExc_ValueError, "actuator.direction = vec: KX_ConstraintActuator, invalid direction"); - return 1; - } - act->m_refDirVector = dir/len; - return 0; -} - -#endif - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.h b/source/gameengine/Ketsji/KX_ConstraintActuator.h deleted file mode 100644 index 7bde2c1d3f7..00000000000 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.h +++ /dev/null @@ -1,149 +0,0 @@ -/** - * KX_ConstraintActuator.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_CONSTRAINTACTUATOR -#define __KX_CONSTRAINTACTUATOR - -#include "SCA_IActuator.h" -#include "MT_Scalar.h" -#include "MT_Vector3.h" -#include "KX_ClientObjectInfo.h" - -class KX_RayCast; -class KX_GameObject; - -class KX_ConstraintActuator : public SCA_IActuator -{ - Py_Header; -protected: - // Damp time (int), - int m_posDampTime; - int m_rotDampTime; - // min (float) - float m_minimumBound; - // max (float) - float m_maximumBound; - // sinus of minimum angle - float m_minimumSine; - // sinus of maximum angle - float m_maximumSine; - // reference direction - float m_refDirection[3]; - MT_Vector3 m_refDirVector; // same as m_refDirection - // locrotxyz choice (pick one): only one choice allowed at a time! - int m_locrot; - // active time of actuator - int m_activeTime; - int m_currentTime; - // option - int m_option; - // property to check - STR_String m_property; - // hit object - KX_GameObject* m_hitObject; - - /** - * Clamp to , . Borders are included (in as far as - * float comparisons are good for equality...). - */ - void Clamp(MT_Scalar &var, float min, float max); - - - public: - // m_locrot - enum KX_CONSTRAINTTYPE { - KX_ACT_CONSTRAINT_NODEF = 0, - KX_ACT_CONSTRAINT_LOCX, - KX_ACT_CONSTRAINT_LOCY, - KX_ACT_CONSTRAINT_LOCZ, - KX_ACT_CONSTRAINT_ROTX, - KX_ACT_CONSTRAINT_ROTY, - KX_ACT_CONSTRAINT_ROTZ, - KX_ACT_CONSTRAINT_DIRPX, - KX_ACT_CONSTRAINT_DIRPY, - KX_ACT_CONSTRAINT_DIRPZ, - KX_ACT_CONSTRAINT_DIRNX, - KX_ACT_CONSTRAINT_DIRNY, - KX_ACT_CONSTRAINT_DIRNZ, - KX_ACT_CONSTRAINT_ORIX, - KX_ACT_CONSTRAINT_ORIY, - KX_ACT_CONSTRAINT_ORIZ, - KX_ACT_CONSTRAINT_FHPX, - KX_ACT_CONSTRAINT_FHPY, - KX_ACT_CONSTRAINT_FHPZ, - KX_ACT_CONSTRAINT_FHNX, - KX_ACT_CONSTRAINT_FHNY, - KX_ACT_CONSTRAINT_FHNZ, - KX_ACT_CONSTRAINT_MAX - }; - // match ACT_CONST_... values from BIF_interface.h - enum KX_CONSTRAINTOPT { - KX_ACT_CONSTRAINT_NORMAL = 64, - KX_ACT_CONSTRAINT_MATERIAL = 128, - KX_ACT_CONSTRAINT_PERMANENT = 256, - KX_ACT_CONSTRAINT_DISTANCE = 512, - KX_ACT_CONSTRAINT_LOCAL = 1024, - KX_ACT_CONSTRAINT_DOROTFH = 2048 - }; - bool IsValidMode(KX_CONSTRAINTTYPE m); - bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data); - bool NeedRayCast(KX_ClientObjectInfo*); - - KX_ConstraintActuator(SCA_IObject* gameobj, - int posDamptime, - int rotDampTime, - float min, - float max, - float refDir[3], - int locrot, - int time, - int option, - char *property); - virtual ~KX_ConstraintActuator(); - virtual CValue* GetReplica() { - KX_ConstraintActuator* replica = new KX_ConstraintActuator(*this); - replica->ProcessReplica(); - return replica; - }; - - virtual bool Update(double curtime, bool frame); - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - static int pyattr_check_direction(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_check_min(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - -}; - -#endif //__KX_CONSTRAINTACTUATOR - diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp deleted file mode 100644 index 8af6e63f343..00000000000 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "PyObjectPlus.h" -#include "KX_ConstraintWrapper.h" -#include "PHY_IPhysicsEnvironment.h" - -KX_ConstraintWrapper::KX_ConstraintWrapper( - PHY_ConstraintType ctype, - int constraintId, - PHY_IPhysicsEnvironment* physenv) : - PyObjectPlus(), - m_constraintId(constraintId), - m_constraintType(ctype), - m_physenv(physenv) -{ -} -KX_ConstraintWrapper::~KX_ConstraintWrapper() -{ -} - -#ifndef DISABLE_PYTHON - -PyObject* KX_ConstraintWrapper::PyGetConstraintId() -{ - return PyLong_FromSsize_t(m_constraintId); -} - - -PyObject* KX_ConstraintWrapper::PyGetParam(PyObject* args, PyObject* kwds) -{ - int dof; - float value; - - if (!PyArg_ParseTuple(args,"i:getParam",&dof)) - return NULL; - - value = m_physenv->getConstraintParam(m_constraintId,dof); - return PyFloat_FromDouble(value); - -} - -PyObject* KX_ConstraintWrapper::PySetParam(PyObject* args, PyObject* kwds) -{ - int dof; - float minLimit,maxLimit; - - if (!PyArg_ParseTuple(args,"iff:setParam",&dof,&minLimit,&maxLimit)) - return NULL; - - m_physenv->setConstraintParam(m_constraintId,dof,minLimit,maxLimit); - Py_RETURN_NONE; -} - - -//python specific stuff -PyTypeObject KX_ConstraintWrapper::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_ConstraintWrapper", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &PyObjectPlus::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_ConstraintWrapper::Methods[] = { - {"getConstraintId",(PyCFunction) KX_ConstraintWrapper::sPyGetConstraintId, METH_NOARGS}, - {"setParam",(PyCFunction) KX_ConstraintWrapper::sPySetParam, METH_VARARGS}, - {"getParam",(PyCFunction) KX_ConstraintWrapper::sPyGetParam, METH_VARARGS}, - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_ConstraintWrapper::Attributes[] = { - //KX_PYATTRIBUTE_TODO("constraintId"), - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.h b/source/gameengine/Ketsji/KX_ConstraintWrapper.h deleted file mode 100644 index 530ecf16fed..00000000000 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_CONSTRAINT_WRAPPER -#define KX_CONSTRAINT_WRAPPER - -#include "Value.h" -#include "PHY_DynamicTypes.h" - -class KX_ConstraintWrapper : public PyObjectPlus -{ - Py_Header; -public: - KX_ConstraintWrapper(PHY_ConstraintType ctype,int constraintId,class PHY_IPhysicsEnvironment* physenv); - virtual ~KX_ConstraintWrapper (); - int getConstraintId() { return m_constraintId;}; - -#ifndef DISABLE_PYTHON - KX_PYMETHOD_NOARGS(KX_ConstraintWrapper,GetConstraintId); - KX_PYMETHOD(KX_ConstraintWrapper,SetParam); - KX_PYMETHOD(KX_ConstraintWrapper,GetParam); -#endif - -private: - int m_constraintId; - PHY_ConstraintType m_constraintType; - PHY_IPhysicsEnvironment* m_physenv; -}; - -#endif //KX_CONSTRAINT_WRAPPER - diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h deleted file mode 100644 index 879bcd472c6..00000000000 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h +++ /dev/null @@ -1,171 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_CONVERTPHYSICSOBJECTS -#define KX_CONVERTPHYSICSOBJECTS - -/* These are defined by the build system... */ -//but the build system is broken, because it doesn't allow for 2 or more defines at once. -//Please leave Sumo _AND_ Bullet enabled -#define USE_BULLET - -//on visual studio 7/8, always enable BULLET for now -//you can have multiple physics engines running anyway, and -//the scons build system doesn't really support this at the moment. -//if you got troubles, just comment out USE_BULLET -#if 1300 <= _MSC_VER -#define USE_BULLET -#endif - -class RAS_MeshObject; -class KX_Scene; -struct DerivedMesh; - -typedef enum { - KX_BOUNDBOX, - KX_BOUNDSPHERE, - KX_BOUNDCYLINDER, - KX_BOUNDCONE, - KX_BOUNDMESH, - KX_BOUNDPOLYTOPE, - KX_BOUND_DYN_MESH -} KX_BoundBoxClass; - -struct KX_BoxBounds -{ - float m_center[3]; - float m_extends[3]; -}; - -/* Cone/Cylinder */ -struct KX_CBounds -{ - float m_radius; - float m_height; -}; - - -struct KX_ObjectProperties -{ - bool m_dyna; - bool m_softbody; - double m_radius; - bool m_angular_rigidbody; - bool m_in_active_layer; - bool m_ghost; - class KX_GameObject* m_dynamic_parent; - bool m_isactor; - bool m_sensor; - bool m_concave; - bool m_isdeformable; - bool m_disableSleeping; - bool m_hasCompoundChildren; - bool m_isCompoundChild; - - ///////////////////////// - - int m_gamesoftFlag; - float m_soft_linStiff; /* linear stiffness 0..1 */ - float m_soft_angStiff; /* angular stiffness 0..1 */ - float m_soft_volume; /* volume preservation 0..1 */ - - int m_soft_viterations; /* Velocities solver iterations */ - int m_soft_piterations; /* Positions solver iterations */ - int m_soft_diterations; /* Drift solver iterations */ - int m_soft_citerations; /* Cluster solver iterations */ - - float m_soft_kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */ - float m_soft_kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */ - float m_soft_kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */ - float m_soft_kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - - float m_soft_kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - float m_soft_kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - float m_soft_kVCF; /* Velocities correction factor (Baumgarte) */ - float m_soft_kDP; /* Damping coefficient [0,1] */ - - float m_soft_kDG; /* Drag coefficient [0,+inf] */ - float m_soft_kLF; /* Lift coefficient [0,+inf] */ - float m_soft_kPR; /* Pressure coefficient [-inf,+inf] */ - float m_soft_kVC; /* Volume conversation coefficient [0,+inf] */ - - float m_soft_kDF; /* Dynamic friction coefficient [0,1] */ - float m_soft_kMT; /* Pose matching coefficient [0,1] */ - float m_soft_kCHR; /* Rigid contacts hardness [0,1] */ - float m_soft_kKHR; /* Kinetic contacts hardness [0,1] */ - - float m_soft_kSHR; /* Soft contacts hardness [0,1] */ - float m_soft_kAHR; /* Anchors hardness [0,1] */ - int m_soft_collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ - int m_soft_numclusteriterations; /* number of iterations to refine collision clusters*/ - float m_soft_welding; /* threshold to remove duplicate/nearby vertices */ - - ///////////////////////// - - bool m_lockXaxis; - bool m_lockYaxis; - bool m_lockZaxis; - bool m_lockXRotaxis; - bool m_lockYRotaxis; - bool m_lockZRotaxis; - - ///////////////////////// - double m_margin; - float m_contactProcessingThreshold; - - KX_BoundBoxClass m_boundclass; - union { - KX_BoxBounds box; - KX_CBounds c; - } m_boundobject; -}; - -void KX_ConvertDynamoObject(KX_GameObject* gameobj, - RAS_MeshObject* meshobj, - KX_Scene* kxscene, - struct PHY_ShapeProps* shapeprops, - struct PHY_MaterialProps* smmaterial, - struct KX_ObjectProperties* objprop); - - -#ifdef USE_BULLET - -void KX_ConvertBulletObject( class KX_GameObject* gameobj, - class RAS_MeshObject* meshobj, - struct DerivedMesh* dm, - class KX_Scene* kxscene, - struct PHY_ShapeProps* shapeprops, - struct PHY_MaterialProps* smmaterial, - struct KX_ObjectProperties* objprop); - -void KX_ClearBulletSharedShapes(); -bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *from_gameobj, RAS_MeshObject* from_meshobj); - -#endif -#endif //KX_CONVERTPHYSICSOBJECTS - diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp deleted file mode 100644 index 44ae032179b..00000000000 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ /dev/null @@ -1,556 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif - -#include "MT_assert.h" - -#include "KX_SoftBodyDeformer.h" -#include "KX_ConvertPhysicsObject.h" -#include "BL_DeformableGameObject.h" -#include "RAS_MeshObject.h" -#include "KX_Scene.h" -#include "SYS_System.h" -#include "BulletSoftBody/btSoftBody.h" - -#include "PHY_Pro.h" //todo cleanup -#include "KX_ClientObjectInfo.h" - -#include "GEN_Map.h" -#include "GEN_HashedPtr.h" - -#include "KX_PhysicsEngineEnums.h" -#include "PHY_Pro.h" - -#include "KX_MotionState.h" // bridge between motionstate and scenegraph node - -extern "C"{ - #include "BKE_DerivedMesh.h" -} - -#ifdef USE_BULLET - -#include "CcdPhysicsEnvironment.h" -#include "CcdPhysicsController.h" -#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h" - -#include "KX_BulletPhysicsController.h" -#include "btBulletDynamicsCommon.h" - - #ifdef WIN32 -#if _MSC_VER >= 1310 -//only use SIMD Hull code under Win32 -//#define TEST_HULL 1 -#ifdef TEST_HULL -#define USE_HULL 1 -//#define TEST_SIMD_HULL 1 - -#include "NarrowPhaseCollision/Hull.h" -#endif //#ifdef TEST_HULL - -#endif //_MSC_VER -#endif //WIN32 - - - -// forward declarations - -void KX_ConvertBulletObject( class KX_GameObject* gameobj, - class RAS_MeshObject* meshobj, - struct DerivedMesh* dm, - class KX_Scene* kxscene, - struct PHY_ShapeProps* shapeprops, - struct PHY_MaterialProps* smmaterial, - struct KX_ObjectProperties* objprop) -{ - - CcdPhysicsEnvironment* env = (CcdPhysicsEnvironment*)kxscene->GetPhysicsEnvironment(); - assert(env); - - - bool isbulletdyna = false; - bool isbulletsensor = false; - bool useGimpact = false; - CcdConstructionInfo ci; - class PHY_IMotionState* motionstate = new KX_MotionState(gameobj->GetSGNode()); - class CcdShapeConstructionInfo *shapeInfo = new CcdShapeConstructionInfo(); - - - if (!objprop->m_dyna) - { - ci.m_collisionFlags |= btCollisionObject::CF_STATIC_OBJECT; - } - if (objprop->m_ghost) - { - ci.m_collisionFlags |= btCollisionObject::CF_NO_CONTACT_RESPONSE; - } - - ci.m_MotionState = motionstate; - ci.m_gravity = btVector3(0,0,0); - ci.m_localInertiaTensor =btVector3(0,0,0); - ci.m_mass = objprop->m_dyna ? shapeprops->m_mass : 0.f; - ci.m_clamp_vel_min = shapeprops->m_clamp_vel_min; - ci.m_clamp_vel_max = shapeprops->m_clamp_vel_max; - ci.m_margin = objprop->m_margin; - shapeInfo->m_radius = objprop->m_radius; - isbulletdyna = objprop->m_dyna; - isbulletsensor = objprop->m_sensor; - useGimpact = ((isbulletdyna || isbulletsensor) && !objprop->m_softbody); - - ci.m_localInertiaTensor = btVector3(ci.m_mass/3.f,ci.m_mass/3.f,ci.m_mass/3.f); - - btCollisionShape* bm = 0; - - switch (objprop->m_boundclass) - { - case KX_BOUNDSPHERE: - { - //float radius = objprop->m_radius; - //btVector3 inertiaHalfExtents ( - // radius, - // radius, - // radius); - - //blender doesn't support multisphere, but for testing: - - //bm = new MultiSphereShape(inertiaHalfExtents,,&trans.getOrigin(),&radius,1); - shapeInfo->m_shapeType = PHY_SHAPE_SPHERE; - bm = shapeInfo->CreateBulletShape(ci.m_margin); - break; - }; - case KX_BOUNDBOX: - { - shapeInfo->m_halfExtend.setValue( - objprop->m_boundobject.box.m_extends[0], - objprop->m_boundobject.box.m_extends[1], - objprop->m_boundobject.box.m_extends[2]); - - shapeInfo->m_halfExtend /= 2.0; - shapeInfo->m_halfExtend = shapeInfo->m_halfExtend.absolute(); - shapeInfo->m_shapeType = PHY_SHAPE_BOX; - bm = shapeInfo->CreateBulletShape(ci.m_margin); - break; - }; - case KX_BOUNDCYLINDER: - { - shapeInfo->m_halfExtend.setValue( - objprop->m_boundobject.c.m_radius, - objprop->m_boundobject.c.m_radius, - objprop->m_boundobject.c.m_height * 0.5f - ); - shapeInfo->m_shapeType = PHY_SHAPE_CYLINDER; - bm = shapeInfo->CreateBulletShape(ci.m_margin); - break; - } - - case KX_BOUNDCONE: - { - shapeInfo->m_radius = objprop->m_boundobject.c.m_radius; - shapeInfo->m_height = objprop->m_boundobject.c.m_height; - shapeInfo->m_shapeType = PHY_SHAPE_CONE; - bm = shapeInfo->CreateBulletShape(ci.m_margin); - break; - } - case KX_BOUNDPOLYTOPE: - { - shapeInfo->SetMesh(meshobj, dm,true); - bm = shapeInfo->CreateBulletShape(ci.m_margin); - break; - } - case KX_BOUNDMESH: - { - // mesh shapes can be shared, check first if we already have a shape on that mesh - class CcdShapeConstructionInfo *sharedShapeInfo = CcdShapeConstructionInfo::FindMesh(meshobj, dm, false); - if (sharedShapeInfo != NULL) - { - shapeInfo->Release(); - shapeInfo = sharedShapeInfo; - shapeInfo->AddRef(); - } else - { - shapeInfo->SetMesh(meshobj, dm, false); - } - - // Soft bodies require welding. Only avoid remove doubles for non-soft bodies! - if (objprop->m_softbody) - { - shapeInfo->setVertexWeldingThreshold1(objprop->m_soft_welding); //todo: expose this to the UI - } - - bm = shapeInfo->CreateBulletShape(ci.m_margin, useGimpact, !objprop->m_softbody); - //should we compute inertia for dynamic shape? - //bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); - - break; - } - } - - -// ci.m_localInertiaTensor.setValue(0.1f,0.1f,0.1f); - - if (!bm) - { - delete motionstate; - shapeInfo->Release(); - return; - } - - //bm->setMargin(ci.m_margin); - - - if (objprop->m_isCompoundChild) - { - //find parent, compound shape and add to it - //take relative transform into account! - KX_BulletPhysicsController* parentCtrl = (KX_BulletPhysicsController*)objprop->m_dynamic_parent->GetPhysicsController(); - assert(parentCtrl); - CcdShapeConstructionInfo* parentShapeInfo = parentCtrl->GetShapeInfo(); - btRigidBody* rigidbody = parentCtrl->GetRigidBody(); - btCollisionShape* colShape = rigidbody->getCollisionShape(); - assert(colShape->isCompound()); - btCompoundShape* compoundShape = (btCompoundShape*)colShape; - - // compute the local transform from parent, this may include several node in the chain - SG_Node* gameNode = gameobj->GetSGNode(); - SG_Node* parentNode = objprop->m_dynamic_parent->GetSGNode(); - // relative transform - MT_Vector3 parentScale = parentNode->GetWorldScaling(); - parentScale[0] = MT_Scalar(1.0)/parentScale[0]; - parentScale[1] = MT_Scalar(1.0)/parentScale[1]; - parentScale[2] = MT_Scalar(1.0)/parentScale[2]; - MT_Vector3 relativeScale = gameNode->GetWorldScaling() * parentScale; - MT_Matrix3x3 parentInvRot = parentNode->GetWorldOrientation().transposed(); - MT_Vector3 relativePos = parentInvRot*((gameNode->GetWorldPosition()-parentNode->GetWorldPosition())*parentScale); - MT_Matrix3x3 relativeRot = parentInvRot*gameNode->GetWorldOrientation(); - - shapeInfo->m_childScale.setValue(relativeScale[0],relativeScale[1],relativeScale[2]); - bm->setLocalScaling(shapeInfo->m_childScale); - shapeInfo->m_childTrans.getOrigin().setValue(relativePos[0],relativePos[1],relativePos[2]); - float rot[12]; - relativeRot.getValue(rot); - shapeInfo->m_childTrans.getBasis().setFromOpenGLSubMatrix(rot); - - parentShapeInfo->AddShape(shapeInfo); - compoundShape->addChildShape(shapeInfo->m_childTrans,bm); - //do some recalc? - //recalc inertia for rigidbody - if (!rigidbody->isStaticOrKinematicObject()) - { - btVector3 localInertia; - float mass = 1.f/rigidbody->getInvMass(); - compoundShape->calculateLocalInertia(mass,localInertia); - rigidbody->setMassProps(mass,localInertia); - } - shapeInfo->Release(); - // delete motionstate as it's not used - delete motionstate; - return; - } - - if (objprop->m_hasCompoundChildren) - { - // create a compound shape info - CcdShapeConstructionInfo *compoundShapeInfo = new CcdShapeConstructionInfo(); - compoundShapeInfo->m_shapeType = PHY_SHAPE_COMPOUND; - compoundShapeInfo->AddShape(shapeInfo); - // create the compound shape manually as we already have the child shape - btCompoundShape* compoundShape = new btCompoundShape(); - compoundShape->addChildShape(shapeInfo->m_childTrans,bm); - // now replace the shape - bm = compoundShape; - shapeInfo->Release(); - shapeInfo = compoundShapeInfo; - } - - - - - - -#ifdef TEST_SIMD_HULL - if (bm->IsPolyhedral()) - { - PolyhedralConvexShape* polyhedron = static_cast(bm); - if (!polyhedron->m_optionalHull) - { - //first convert vertices in 'Point3' format - int numPoints = polyhedron->GetNumVertices(); - Point3* points = new Point3[numPoints+1]; - //first 4 points should not be co-planar, so add central point to satisfy MakeHull - points[0] = Point3(0.f,0.f,0.f); - - btVector3 vertex; - for (int p=0;pGetVertex(p,vertex); - points[p+1] = Point3(vertex.getX(),vertex.getY(),vertex.getZ()); - } - - Hull* hull = Hull::MakeHull(numPoints+1,points); - polyhedron->m_optionalHull = hull; - } - - } -#endif //TEST_SIMD_HULL - - - ci.m_collisionShape = bm; - ci.m_shapeInfo = shapeInfo; - ci.m_friction = smmaterial->m_friction;//tweak the friction a bit, so the default 0.5 works nice - ci.m_restitution = smmaterial->m_restitution; - ci.m_physicsEnv = env; - // drag / damping is inverted - ci.m_linearDamping = 1.f - shapeprops->m_lin_drag; - ci.m_angularDamping = 1.f - shapeprops->m_ang_drag; - //need a bit of damping, else system doesn't behave well - ci.m_inertiaFactor = shapeprops->m_inertia/0.4f;//defaults to 0.4, don't want to change behaviour - - ci.m_do_anisotropic = shapeprops->m_do_anisotropic; - ci.m_anisotropicFriction.setValue(shapeprops->m_friction_scaling[0],shapeprops->m_friction_scaling[1],shapeprops->m_friction_scaling[2]); - - -////////// - //do Fh, do Rot Fh - ci.m_do_fh = shapeprops->m_do_fh; - ci.m_do_rot_fh = shapeprops->m_do_rot_fh ; - ci.m_fh_damping = smmaterial->m_fh_damping; - ci.m_fh_distance = smmaterial->m_fh_distance; - ci.m_fh_normal = smmaterial->m_fh_normal; - ci.m_fh_spring = smmaterial->m_fh_spring; - ci.m_radius = objprop->m_radius; - - - /////////////////// - ci.m_gamesoftFlag = objprop->m_gamesoftFlag; - ci.m_soft_linStiff = objprop->m_soft_linStiff; - ci.m_soft_angStiff = objprop->m_soft_angStiff; /* angular stiffness 0..1 */ - ci.m_soft_volume= objprop->m_soft_volume; /* volume preservation 0..1 */ - - ci.m_soft_viterations= objprop->m_soft_viterations; /* Velocities solver iterations */ - ci.m_soft_piterations= objprop->m_soft_piterations; /* Positions solver iterations */ - ci.m_soft_diterations= objprop->m_soft_diterations; /* Drift solver iterations */ - ci.m_soft_citerations= objprop->m_soft_citerations; /* Cluster solver iterations */ - - ci.m_soft_kSRHR_CL= objprop->m_soft_kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */ - ci.m_soft_kSKHR_CL= objprop->m_soft_kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */ - ci.m_soft_kSSHR_CL= objprop->m_soft_kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */ - ci.m_soft_kSR_SPLT_CL= objprop->m_soft_kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - - ci.m_soft_kSK_SPLT_CL= objprop->m_soft_kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - ci.m_soft_kSS_SPLT_CL= objprop->m_soft_kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - ci.m_soft_kVCF= objprop->m_soft_kVCF; /* Velocities correction factor (Baumgarte) */ - ci.m_soft_kDP= objprop->m_soft_kDP; /* Damping coefficient [0,1] */ - - ci.m_soft_kDG= objprop->m_soft_kDG; /* Drag coefficient [0,+inf] */ - ci.m_soft_kLF= objprop->m_soft_kLF; /* Lift coefficient [0,+inf] */ - ci.m_soft_kPR= objprop->m_soft_kPR; /* Pressure coefficient [-inf,+inf] */ - ci.m_soft_kVC= objprop->m_soft_kVC; /* Volume conversation coefficient [0,+inf] */ - - ci.m_soft_kDF= objprop->m_soft_kDF; /* Dynamic friction coefficient [0,1] */ - ci.m_soft_kMT= objprop->m_soft_kMT; /* Pose matching coefficient [0,1] */ - ci.m_soft_kCHR= objprop->m_soft_kCHR; /* Rigid contacts hardness [0,1] */ - ci.m_soft_kKHR= objprop->m_soft_kKHR; /* Kinetic contacts hardness [0,1] */ - - ci.m_soft_kSHR= objprop->m_soft_kSHR; /* Soft contacts hardness [0,1] */ - ci.m_soft_kAHR= objprop->m_soft_kAHR; /* Anchors hardness [0,1] */ - ci.m_soft_collisionflags= objprop->m_soft_collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ - ci.m_soft_numclusteriterations= objprop->m_soft_numclusteriterations; /* number of iterations to refine collision clusters*/ - - //////////////////// - ci.m_collisionFilterGroup = - (isbulletsensor) ? short(CcdConstructionInfo::SensorFilter) : - (isbulletdyna) ? short(CcdConstructionInfo::DefaultFilter) : - short(CcdConstructionInfo::StaticFilter); - ci.m_collisionFilterMask = - (isbulletsensor) ? short(CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::SensorFilter) : - (isbulletdyna) ? short(CcdConstructionInfo::AllFilter) : - short(CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::StaticFilter); - ci.m_bRigid = objprop->m_dyna && objprop->m_angular_rigidbody; - - ci.m_contactProcessingThreshold = objprop->m_contactProcessingThreshold;//todo: expose this in advanced settings, just like margin, default to 10000 or so - ci.m_bSoft = objprop->m_softbody; - ci.m_bSensor = isbulletsensor; - ci.m_bGimpact = useGimpact; - MT_Vector3 scaling = gameobj->NodeGetWorldScaling(); - ci.m_scaling.setValue(scaling[0], scaling[1], scaling[2]); - KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,isbulletdyna,isbulletsensor,objprop->m_hasCompoundChildren); - // shapeInfo is reference counted, decrement now as we don't use it anymore - if (shapeInfo) - shapeInfo->Release(); - - gameobj->SetPhysicsController(physicscontroller,isbulletdyna); - // don't add automatically sensor object, they are added when a collision sensor is registered - if (!isbulletsensor && objprop->m_in_active_layer) - { - env->addCcdPhysicsController( physicscontroller); - } - physicscontroller->setNewClientInfo(gameobj->getClientInfo()); - { - btRigidBody* rbody = physicscontroller->GetRigidBody(); - - if (rbody) - { - if (objprop->m_angular_rigidbody) - { - btVector3 linearFactor( - objprop->m_lockXaxis? 0 : 1, - objprop->m_lockYaxis? 0 : 1, - objprop->m_lockZaxis? 0 : 1); - btVector3 angularFactor( - objprop->m_lockXRotaxis? 0 : 1, - objprop->m_lockYRotaxis? 0 : 1, - objprop->m_lockZRotaxis? 0 : 1); - rbody->setLinearFactor(linearFactor); - rbody->setAngularFactor(angularFactor); - } - - if (rbody && objprop->m_disableSleeping) - { - rbody->setActivationState(DISABLE_DEACTIVATION); - } - } - } - - CcdPhysicsController* parentCtrl = objprop->m_dynamic_parent ? (KX_BulletPhysicsController*)objprop->m_dynamic_parent->GetPhysicsController() : 0; - physicscontroller->setParentCtrl(parentCtrl); - - - //Now done directly in ci.m_collisionFlags so that it propagates to replica - //if (objprop->m_ghost) - //{ - // rbody->setCollisionFlags(rbody->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE); - //} - - if (objprop->m_dyna && !objprop->m_angular_rigidbody) - { - /* - //setting the inertia could achieve similar results to constraint the up - //but it is prone to instability, so use special 'Angular' constraint - btVector3 inertia = physicscontroller->GetRigidBody()->getInvInertiaDiagLocal(); - inertia.setX(0.f); - inertia.setZ(0.f); - - physicscontroller->GetRigidBody()->setInvInertiaDiagLocal(inertia); - physicscontroller->GetRigidBody()->updateInertiaTensor(); - */ - - //env->createConstraint(physicscontroller,0,PHY_ANGULAR_CONSTRAINT,0,0,0,0,0,1); - - //Now done directly in ci.m_bRigid so that it propagates to replica - //physicscontroller->GetRigidBody()->setAngularFactor(0.f); - ; - } - - bool isActor = objprop->m_isactor; - gameobj->getClientInfo()->m_type = - (isbulletsensor) ? ((isActor) ? KX_ClientObjectInfo::OBACTORSENSOR : KX_ClientObjectInfo::OBSENSOR) : - (isActor) ? KX_ClientObjectInfo::ACTOR : KX_ClientObjectInfo::STATIC; - // store materialname in auxinfo, needed for touchsensors - if (meshobj) - { - const STR_String& matname=meshobj->GetMaterialName(0); - gameobj->getClientInfo()->m_auxilary_info = (matname.Length() ? (void*)(matname.ReadPtr()+2) : NULL); - } else - { - gameobj->getClientInfo()->m_auxilary_info = 0; - } - - - gameobj->GetSGNode()->AddSGController(physicscontroller); - - STR_String materialname; - if (meshobj) - materialname = meshobj->GetMaterialName(0); - - physicscontroller->SetObject(gameobj->GetSGNode()); - -#if 0 - ///test for soft bodies - if (objprop->m_softbody && physicscontroller) - { - btSoftBody* softBody = physicscontroller->GetSoftBody(); - if (softBody && gameobj->GetMesh(0))//only the first mesh, if any - { - //should be a mesh then, so add a soft body deformer - KX_SoftBodyDeformer* softbodyDeformer = new KX_SoftBodyDeformer( gameobj->GetMesh(0),(BL_DeformableGameObject*)gameobj); - gameobj->SetDeformer(softbodyDeformer); - } - } -#endif - -} - - -void KX_ClearBulletSharedShapes() -{ -} - -/* Refresh the physics object from either an object or a mesh. - * gameobj must be valid - * from_gameobj and from_meshobj can be NULL - * - * when setting the mesh, the following vars get priority - * 1) from_meshobj - creates the phys mesh from RAS_MeshObject - * 2) from_gameobj - creates the phys mesh from the DerivedMesh where possible, else the RAS_MeshObject - * 3) gameobj - update the phys mesh from DerivedMesh or RAS_MeshObject - * - * Most of the logic behind this is in shapeInfo->UpdateMesh(...) - */ -bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *from_gameobj, RAS_MeshObject* from_meshobj) -{ - KX_BulletPhysicsController *spc= static_cast((gameobj->GetPhysicsController())); - CcdShapeConstructionInfo *shapeInfo; - - /* if this is the child of a compound shape this can happen - * dont support compound shapes for now */ - if(spc==NULL) - return false; - - shapeInfo = spc->GetShapeInfo(); - - if(shapeInfo->m_shapeType != PHY_SHAPE_MESH/* || spc->GetSoftBody()*/) - return false; - - spc->DeleteControllerShape(); - - if(from_gameobj==NULL && from_meshobj==NULL) - from_gameobj= gameobj; - - /* updates the arrays used for making the new bullet mesh */ - shapeInfo->UpdateMesh(from_gameobj, from_meshobj); - - /* create the new bullet mesh */ - CcdConstructionInfo& cci = spc->getConstructionInfo(); - btCollisionShape* bm= shapeInfo->CreateBulletShape(cci.m_margin, cci.m_bGimpact, !cci.m_bSoft); - - spc->ReplaceControllerShape(bm); - return true; -} -#endif diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp deleted file mode 100644 index b62593b7911..00000000000 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ /dev/null @@ -1,2059 +0,0 @@ -/* $Id$ ------------------------------------------------------------------------------ - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. - -Contributor(s): Dalai Felinto - -This code is originally inspired on some of the ideas and codes from Paul Bourke. -Developed as part of a Research and Development project for SAT - La Soci�t� des arts technologiques. ------------------------------------------------------------------------------ -*/ - -#include "KX_Dome.h" - -#ifndef DISABLE_PYTHON -#include -#endif - -#include -#include - -#include "DNA_scene_types.h" -#include "RAS_CameraData.h" -#include "BLI_math.h" - -#include "GL/glew.h" - -// constructor -KX_Dome::KX_Dome ( - RAS_ICanvas* canvas, - /// rasterizer - RAS_IRasterizer* rasterizer, - /// render tools - RAS_IRenderTools* rendertools, - /// engine - KX_KetsjiEngine* engine, - - short res, //resolution of the mesh - short mode, //mode - fisheye, truncated, warped, panoramic, ... - short angle, - float resbuf, //size adjustment of the buffer - short tilt, - struct Text* warptext - -): - dlistSupported(false), - canvaswidth(-1), canvasheight(-1), - m_drawingmode(engine->GetDrawType()), - m_resolution(res), - m_mode(mode), - m_angle(angle), - m_resbuffer(resbuf), - m_tilt(tilt), - m_canvas(canvas), - m_rasterizer(rasterizer), - m_rendertools(rendertools), - m_engine(engine) -{ - warp.usemesh = false; - fboSupported = false; - - if (mode >= DOME_NUM_MODES) - m_mode = DOME_FISHEYE; - - if (warptext) // it there is a text data try to warp it - { - char *buf; - buf = txt_to_buf(warptext); - if (buf) - { - warp.usemesh = ParseWarpMesh(STR_String(buf)); - MEM_freeN(buf); - } - } - - //setting the viewport size - GLuint viewport[4]={0}; - glGetIntegerv(GL_VIEWPORT,(GLint *)viewport); - - SetViewPort(viewport); - - switch(m_mode){ - case DOME_FISHEYE: - if (m_angle <= 180){ - cubetop.resize(1); - cubebottom.resize(1); - cubeleft.resize(2); - cuberight.resize(2); - - CreateMeshDome180(); - m_numfaces = 4; - }else if (m_angle > 180){ - cubetop.resize(2); - cubebottom.resize(2); - cubeleft.resize(2); - cubefront.resize(2); - cuberight.resize(2); - - CreateMeshDome250(); - m_numfaces = 5; - } break; - case DOME_ENVMAP: - m_angle = 360; - m_numfaces = 6; - break; - case DOME_PANORAM_SPH: - cubeleft.resize(2); - cubeleftback.resize(2); - cuberight.resize(2); - cuberightback.resize(2); - cubetop.resize(2); - cubebottom.resize(2); - - m_angle = 360; - CreateMeshPanorama(); - m_numfaces = 6; - break; - default: //DOME_TRUNCATED_FRONT and DOME_TRUNCATED_REAR - if (m_angle <= 180){ - cubetop.resize(1); - cubebottom.resize(1); - cubeleft.resize(2); - cuberight.resize(2); - - CreateMeshDome180(); - m_numfaces = 4; - }else if (m_angle > 180){ - cubetop.resize(2); - cubebottom.resize(2); - cubeleft.resize(2); - cubefront.resize(2); - cuberight.resize(2); - - CreateMeshDome250(); - m_numfaces = 5; - } break; - } - - m_numimages =(warp.usemesh?m_numfaces+1:m_numfaces); - - CalculateCameraOrientation(); - - CreateGLImages(); - - if(warp.usemesh) - fboSupported = CreateFBO(); - - dlistSupported = CreateDL(); -} - -// destructor -KX_Dome::~KX_Dome (void) -{ - ClearGLImages(); - - if(fboSupported) - glDeleteFramebuffersEXT(1, &warp.fboId); - - if(dlistSupported) - glDeleteLists(dlistId, (GLsizei) m_numimages); -} - -void KX_Dome::SetViewPort(GLuint viewport[4]) -{ - if(canvaswidth != m_viewport.GetWidth() || canvasheight != m_viewport.GetHeight()) - { - m_viewport.SetLeft(viewport[0]); - m_viewport.SetBottom(viewport[1]); - m_viewport.SetRight(viewport[2]); - m_viewport.SetTop(viewport[3]); - - CalculateImageSize(); - } -} - -void KX_Dome::CreateGLImages(void) -{ - glGenTextures(m_numimages, (GLuint*)&domefacesId); - - for (int j=0;jGetWidth(); - canvasheight = m_canvas->GetHeight(); - - bool fullscreen(false); //XXX HACK - fullscreen = (canvaswidth != m_viewport.GetWidth()); - - m_buffersize = (canvaswidth > canvasheight?canvasheight:canvaswidth); - m_buffersize = (int)(m_buffersize*m_resbuffer); //reduce buffer size for better performance - - if (fullscreen) //XXX HACK - m_buffersize --; - - int i = 0; - while ((1 << i) <= m_buffersize) - i++; - m_imagesize = (1 << i); - - if (warp.usemesh){ - // warp FBO needs to be up to twice as big as m_buffersize to get more resolution - warp.imagesize = m_imagesize; - if (m_buffersize == m_imagesize) - warp.imagesize *= 2; - - //if FBO is not working/supported, we use the canvas dimension as buffer - warp.bufferwidth = canvaswidth; - warp.bufferheight = canvasheight; - } - - //XXX HACK - canvaswidth = m_viewport.GetWidth(); - canvasheight = m_viewport.GetHeight(); -} - -bool KX_Dome::CreateDL(){ - dlistId = glGenLists((GLsizei) m_numimages); - if (dlistId != 0) { - if(m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR){ - glNewList(dlistId, GL_COMPILE); - GLDrawTriangles(cubetop, nfacestop); - glEndList(); - - glNewList(dlistId+1, GL_COMPILE); - GLDrawTriangles(cubebottom, nfacesbottom); - glEndList(); - - glNewList(dlistId+2, GL_COMPILE); - GLDrawTriangles(cubeleft, nfacesleft); - glEndList(); - - glNewList(dlistId+3, GL_COMPILE); - GLDrawTriangles(cuberight, nfacesright); - glEndList(); - - if (m_angle > 180){ - glNewList(dlistId+4, GL_COMPILE); - GLDrawTriangles(cubefront, nfacesfront); - glEndList(); - } - } - else if (m_mode == DOME_PANORAM_SPH) - { - glNewList(dlistId, GL_COMPILE); - GLDrawTriangles(cubetop, nfacestop); - glEndList(); - - glNewList(dlistId+1, GL_COMPILE); - GLDrawTriangles(cubebottom, nfacesbottom); - glEndList(); - - glNewList(dlistId+2, GL_COMPILE); - GLDrawTriangles(cubeleft, nfacesleft); - glEndList(); - - glNewList(dlistId+3, GL_COMPILE); - GLDrawTriangles(cuberight, nfacesright); - glEndList(); - - glNewList(dlistId+4, GL_COMPILE); - GLDrawTriangles(cubeleftback, nfacesleftback); - glEndList(); - - glNewList(dlistId+5, GL_COMPILE); - GLDrawTriangles(cuberightback, nfacesrightback); - glEndList(); - } - - if(warp.usemesh){ - glNewList((dlistId + m_numfaces), GL_COMPILE); - GLDrawWarpQuads(); - glEndList(); - } - - //clearing the vectors - cubetop.clear(); - cubebottom.clear(); - cuberight.clear(); - cubeleft.clear(); - cubefront.clear(); - cubeleftback.clear(); - cuberightback.clear(); - warp.nodes.clear(); - - } else // genList failed - return false; - - return true; -} - -bool KX_Dome::CreateFBO(void) -{ - if (!GLEW_EXT_framebuffer_object) - { - printf("Dome Error: FrameBuffer unsupported. Using low resolution warp image."); - return false; - } - - glGenFramebuffersEXT(1, &warp.fboId); - if(warp.fboId==0) - { - printf("Dome Error: Invalid frame buffer object. Using low resolution warp image."); - return false; - } - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, warp.fboId); - - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_2D, domefacesId[m_numfaces], 0); - - GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - - if(status == GL_FRAMEBUFFER_UNSUPPORTED_EXT) - { - printf("Dome Error: FrameBuffer settings unsupported. Using low resolution warp image."); - return false; - } - else if(status != GL_FRAMEBUFFER_COMPLETE_EXT) - { - glDeleteFramebuffersEXT(1, &warp.fboId); - return false; - } - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - //nothing failed: we can use the whole FBO as buffersize - warp.bufferwidth = warp.bufferheight = warp.imagesize; - return true; -} - -void KX_Dome::GLDrawTriangles(vector & face, int nfaces) -{ - int i,j; - glBegin(GL_TRIANGLES); - for (i=0;i columns, lines; - - lines = text.Explode('\n'); - if(lines.size() < 6){ - printf("Dome Error: Warp Mesh File with insufficient data!\n"); - return false; - } - columns = lines[1].Explode(' '); - if(columns.size() == 1) - columns = lines[1].Explode('\t'); - - if(columns.size() !=2){ - printf("Dome Error: Warp Mesh File incorrect. The second line should contain: width height.\n"); - return false; - } - - warp.mode = atoi(lines[0]);// 1 = radial, 2 = fisheye - - warp.n_width = atoi(columns[0]); - warp.n_height = atoi(columns[1]); - - if ((int)lines.size() < 2 + (warp.n_width * warp.n_height)){ - printf("Dome Error: Warp Mesh File with insufficient data!\n"); - return false; - }else{ - warp.nodes = vector > (warp.n_height, vector(warp.n_width)); - - for(i=2; i-2 < (warp.n_width*warp.n_height); i++){ - columns = lines[i].Explode(' '); - if(columns.size() == 1) - columns = lines[i].Explode('\t'); - - if (columns.size() == 5){ - nodeX = (i-2)%warp.n_width; - nodeY = ((i-2) - nodeX) / warp.n_width; - - warp.nodes[nodeY][nodeX].x = atof(columns[0]); - warp.nodes[nodeY][nodeX].y = atof(columns[1]); - warp.nodes[nodeY][nodeX].u = atof(columns[2]); - warp.nodes[nodeY][nodeX].v = atof(columns[3]); - warp.nodes[nodeY][nodeX].i = atof(columns[4]); - } - else{ - warp.nodes.clear(); - printf("Dome Error: Warp Mesh File with wrong number of fields. You should use 5: x y u v i.\n"); - return false; - } - } - } - return true; -} - -void KX_Dome::CreateMeshDome180(void) -{ -/* -1)- Define the faces of half of a cube - - each face is made out of 2 triangles -2) Subdivide the faces - - more resolution == more curved lines -3) Spherize the cube - - normalize the verts -4) Flatten onto xz plane - - transform it onto an equidistant spherical projection techniques to transform the sphere onto a dome image -*/ - int i,j; - float sqrt_2 = sqrt(2.0); - float uv_ratio = (float)(m_buffersize-1) / m_imagesize; - - m_radangle = m_angle * M_PI/180.0;//calculates the radians angle, used for flattening - - //creating faces for the env mapcube 180� Dome - // Top Face - just a triangle - cubetop[0].verts[0][0] = -sqrt_2 / 2.0; - cubetop[0].verts[0][1] = 0.0; - cubetop[0].verts[0][2] = 0.5; - cubetop[0].u[0] = 0.0; - cubetop[0].v[0] = uv_ratio; - - cubetop[0].verts[1][0] = 0.0; - cubetop[0].verts[1][1] = sqrt_2 / 2.0; - cubetop[0].verts[1][2] = 0.5; - cubetop[0].u[1] = 0.0; - cubetop[0].v[1] = 0.0; - - cubetop[0].verts[2][0] = sqrt_2 / 2.0; - cubetop[0].verts[2][1] = 0.0; - cubetop[0].verts[2][2] = 0.5; - cubetop[0].u[2] = uv_ratio; - cubetop[0].v[2] = 0.0; - - nfacestop = 1; - - /* Bottom face - just a triangle */ - cubebottom[0].verts[0][0] = -sqrt_2 / 2.0; - cubebottom[0].verts[0][1] = 0.0; - cubebottom[0].verts[0][2] = -0.5; - cubebottom[0].u[0] = uv_ratio; - cubebottom[0].v[0] = 0.0; - - cubebottom[0].verts[1][0] = sqrt_2 / 2.0; - cubebottom[0].verts[1][1] = 0; - cubebottom[0].verts[1][2] = -0.5; - cubebottom[0].u[1] = 0.0; - cubebottom[0].v[1] = uv_ratio; - - cubebottom[0].verts[2][0] = 0.0; - cubebottom[0].verts[2][1] = sqrt_2 / 2.0; - cubebottom[0].verts[2][2] = -0.5; - cubebottom[0].u[2] = 0.0; - cubebottom[0].v[2] = 0.0; - - nfacesbottom = 1; - - /* Left face - two triangles */ - - cubeleft[0].verts[0][0] = -sqrt_2 / 2.0; - cubeleft[0].verts[0][1] = .0; - cubeleft[0].verts[0][2] = -0.5; - cubeleft[0].u[0] = 0.0; - cubeleft[0].v[0] = 0.0; - - cubeleft[0].verts[1][0] = 0.0; - cubeleft[0].verts[1][1] = sqrt_2 / 2.0; - cubeleft[0].verts[1][2] = -0.5; - cubeleft[0].u[1] = uv_ratio; - cubeleft[0].v[1] = 0.0; - - cubeleft[0].verts[2][0] = -sqrt_2 / 2.0; - cubeleft[0].verts[2][1] = 0.0; - cubeleft[0].verts[2][2] = 0.5; - cubeleft[0].u[2] = 0.0; - cubeleft[0].v[2] = uv_ratio; - - //second triangle - cubeleft[1].verts[0][0] = -sqrt_2 / 2.0; - cubeleft[1].verts[0][1] = 0.0; - cubeleft[1].verts[0][2] = 0.5; - cubeleft[1].u[0] = 0.0; - cubeleft[1].v[0] = uv_ratio; - - cubeleft[1].verts[1][0] = 0.0; - cubeleft[1].verts[1][1] = sqrt_2 / 2.0; - cubeleft[1].verts[1][2] = -0.5; - cubeleft[1].u[1] = uv_ratio; - cubeleft[1].v[1] = 0.0; - - cubeleft[1].verts[2][0] = 0.0; - cubeleft[1].verts[2][1] = sqrt_2 / 2.0; - cubeleft[1].verts[2][2] = 0.5; - cubeleft[1].u[2] = uv_ratio; - cubeleft[1].v[2] = uv_ratio; - - nfacesleft = 2; - - /* Right face - two triangles */ - cuberight[0].verts[0][0] = 0.0; - cuberight[0].verts[0][1] = sqrt_2 / 2.0; - cuberight[0].verts[0][2] = -0.5; - cuberight[0].u[0] = 0.0; - cuberight[0].v[0] = 0.0; - - cuberight[0].verts[1][0] = sqrt_2 / 2.0; - cuberight[0].verts[1][1] = 0.0; - cuberight[0].verts[1][2] = -0.5; - cuberight[0].u[1] = uv_ratio; - cuberight[0].v[1] = 0.0; - - cuberight[0].verts[2][0] = sqrt_2 / 2.0; - cuberight[0].verts[2][1] = 0.0; - cuberight[0].verts[2][2] = 0.5; - cuberight[0].u[2] = uv_ratio; - cuberight[0].v[2] = uv_ratio; - - //second triangle - cuberight[1].verts[0][0] = 0.0; - cuberight[1].verts[0][1] = sqrt_2 / 2.0; - cuberight[1].verts[0][2] = -0.5; - cuberight[1].u[0] = 0.0; - cuberight[1].v[0] = 0.0; - - cuberight[1].verts[1][0] = sqrt_2 / 2.0; - cuberight[1].verts[1][1] = 0.0; - cuberight[1].verts[1][2] = 0.5; - cuberight[1].u[1] = uv_ratio; - cuberight[1].v[1] = uv_ratio; - - cuberight[1].verts[2][0] = 0.0; - cuberight[1].verts[2][1] = sqrt_2 / 2.0; - cuberight[1].verts[2][2] = 0.5; - cuberight[1].u[2] = 0.0; - cuberight[1].v[2] = uv_ratio; - - nfacesright = 2; - - //Refine a triangular mesh by bisecting each edge forms 3 new triangles for each existing triangle on each iteration - //Could be made more efficient for drawing if the triangles were ordered in a fan. Not that important since we are using DisplayLists - - for(i=0;i 1.0){ - //round the border - verts[i][0] = cos(phi); - verts[i][1] = -3.0; - verts[i][2] = sin(phi); - } - } -} - -void KX_Dome::FlattenPanorama(MT_Vector3 verts[3]) -{ -// it creates a full spherical panoramic (360�) - int i; - double phi; - bool edge=false; - - for (i=0;i<3;i++){ - phi = atan2(verts[i][1], verts[i][0]); - phi *= -1.0; //flipping - - if (phi == -MT_PI) //It's on the edge - edge=true; - - verts[i][0] = phi / MT_PI; - verts[i][1] = 0; - - verts[i][2] = atan2(verts[i][2], 1.0); - verts[i][2] /= MT_PI / 2; - } - if(edge){ - bool right=false; - - for (i=0;i<3;i++){ - if(fmod(verts[i][0],1.0) > 0.0){ - right=true; - break; - } - } - if(right){ - for (i=0;i<3;i++){ - if(verts[i][0] < 0.0) - verts[i][0] *= -1.0; - } - } - } -} - -void KX_Dome::SplitFace(vector & face, int *nfaces) -{ - int i; - int n1, n2; - - n1 = n2 = *nfaces; - - for(i=0;iGetCameraNear(),cam->GetCameraFar()); - */ - - RAS_FrameFrustum m_frustrum; //90 deg. Frustum - - m_frustrum.camnear = cam->GetCameraNear(); - m_frustrum.camfar = cam->GetCameraFar(); - -// float top = tan(90.0*MT_PI/360.0) * m_frustrum.camnear; - float top = m_frustrum.camnear; // for deg = 90�, tan = 1 - - m_frustrum.x1 = -top; - m_frustrum.x2 = top; - m_frustrum.y1 = -top; - m_frustrum.y2 = top; - - m_projmat = m_rasterizer->GetFrustumMatrix( - m_frustrum.x1, m_frustrum.x2, m_frustrum.y1, m_frustrum.y2, m_frustrum.camnear, m_frustrum.camfar); - -} - -void KX_Dome::CalculateCameraOrientation() -{ -/* -Uses 4 cameras for angles up to 180� -Uses 5 cameras for angles up to 250� -Uses 6 cameras for angles up to 360� -*/ - int i; - float deg45 = MT_PI / 4; - MT_Scalar c = cos(deg45); - MT_Scalar s = sin(deg45); - - if (m_angle <= 180 && (m_mode == DOME_FISHEYE - || m_mode == DOME_TRUNCATED_FRONT - || m_mode == DOME_TRUNCATED_REAR)){ - - m_locRot[0] = MT_Matrix3x3( // 90� - Top - c, -s, 0.0, - 0.0,0.0, -1.0, - s, c, 0.0); - - m_locRot[1] = MT_Matrix3x3( // 90� - Bottom - -s, c, 0.0, - 0.0,0.0, 1.0, - s, c, 0.0); - - m_locRot[2] = MT_Matrix3x3( // 45� - Left - c, 0.0, s, - 0, 1.0, 0.0, - -s, 0.0, c); - - m_locRot[3] = MT_Matrix3x3( // 45� - Right - c, 0.0, -s, - 0.0, 1.0, 0.0, - s, 0.0, c); - - } else if (m_mode == DOME_ENVMAP || (m_angle > 180 && (m_mode == DOME_FISHEYE - || m_mode == DOME_TRUNCATED_FRONT - || m_mode == DOME_TRUNCATED_REAR))){ - - m_locRot[0] = MT_Matrix3x3( // 90� - Top - 1.0, 0.0, 0.0, - 0.0, 0.0,-1.0, - 0.0, 1.0, 0.0); - - m_locRot[1] = MT_Matrix3x3( // 90� - Bottom - 1.0, 0.0, 0.0, - 0.0, 0.0, 1.0, - 0.0,-1.0, 0.0); - - m_locRot[2] = MT_Matrix3x3( // -90� - Left - 0.0, 0.0, 1.0, - 0.0, 1.0, 0.0, - -1.0, 0.0, 0.0); - - m_locRot[3] = MT_Matrix3x3( // 90� - Right - 0.0, 0.0,-1.0, - 0.0, 1.0, 0.0, - 1.0, 0.0, 0.0); - - m_locRot[4] = MT_Matrix3x3( // 0� - Front - 1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0, 1.0); - - m_locRot[5] = MT_Matrix3x3( // 180� - Back - USED for ENVMAP only - -1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0,-1.0); - - } else if (m_mode == DOME_PANORAM_SPH){ - - m_locRot[0] = MT_Matrix3x3( // Top - c, s, 0.0, - 0.0,0.0, -1.0, - -s, c, 0.0); - - m_locRot[1] = MT_Matrix3x3( // Bottom - c, s, 0.0, - 0.0 ,0.0, 1.0, - s, -c, 0.0); - - m_locRot[2] = MT_Matrix3x3( // 45� - Left - -s, 0.0, c, - 0, 1.0, 0.0, - -c, 0.0, -s); - - m_locRot[3] = MT_Matrix3x3( // 45� - Right - c, 0.0, s, - 0, 1.0, 0.0, - -s, 0.0, c); - - m_locRot[4] = MT_Matrix3x3( // 135� - LeftBack - -s, 0.0, -c, - 0.0, 1.0, 0.0, - c, 0.0, -s); - - m_locRot[5] = MT_Matrix3x3( // 135� - RightBack - c, 0.0, -s, - 0.0, 1.0, 0.0, - s, 0.0, c); - } - - // rotating the camera in horizontal axis - if (m_tilt) - { - float tiltdeg = ((m_tilt % 360) * 2 * MT_PI) / 360; - c = cos(tiltdeg); - s = sin(tiltdeg); - - MT_Matrix3x3 tilt_mat = MT_Matrix3x3( - 1.0, 0.0, 0.0, - 0.0, c, -s, - 0.0, s, c - ); - - for (i =0;i<6;i++) - m_locRot[i] = tilt_mat * m_locRot[i]; - } -} - -void KX_Dome::RotateCamera(KX_Camera* cam, int i) -{ -// I'm not using it, I'm doing inline calls for these commands -// but it's nice to have it here in case I need it - - MT_Matrix3x3 camori = cam->GetSGNode()->GetLocalOrientation(); - - cam->NodeSetLocalOrientation(camori*m_locRot[i]); - cam->NodeUpdateGS(0.f); - - MT_Transform camtrans(cam->GetWorldToCamera()); - MT_Matrix4x4 viewmat(camtrans); - m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->GetCameraData()->m_perspective); - cam->SetModelviewMatrix(viewmat); - - // restore the original orientation - cam->NodeSetLocalOrientation(camori); - cam->NodeUpdateGS(0.f); -} - -void KX_Dome::Draw(void) -{ - - if (fboSupported){ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, warp.fboId); - - glViewport(0,0,warp.imagesize, warp.imagesize); - glScissor(0,0,warp.imagesize, warp.imagesize); - } - - switch(m_mode){ - case DOME_FISHEYE: - DrawDomeFisheye(); - break; - case DOME_ENVMAP: - DrawEnvMap(); - break; - case DOME_PANORAM_SPH: - DrawPanorama(); - break; - case DOME_TRUNCATED_FRONT: - DrawDomeFisheye(); - break; - case DOME_TRUNCATED_REAR: - DrawDomeFisheye(); - break; - } - - if(warp.usemesh) - { - if(fboSupported) - { - m_canvas->SetViewPort(0, 0, m_canvas->GetWidth(), m_canvas->GetHeight()); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } - else - { - glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_viewport.GetLeft(), m_viewport.GetBottom(), warp.bufferwidth, warp.bufferheight); - } - DrawDomeWarped(); - } -} - -void KX_Dome::DrawEnvMap(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - // Making the viewport always square - - int can_width = m_viewport.GetRight(); - int can_height = m_viewport.GetTop(); - - float ortho_width, ortho_height; - - if (warp.usemesh) - glOrtho((-1.0), 1.0, (-0.66), 0.66, -20.0, 10.0); //stretch the image to reduce resolution lost - - else { - if (can_width/3 <= can_height/2){ - ortho_width = 1.0; - ortho_height = (float)can_height/can_width; - }else{ - ortho_height = 2.0f / 3; - ortho_width = (float)can_width/can_height * ortho_height; - } - - glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0, 10.0); - } - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - gluLookAt(0.0,0.0,1.0, 0.0,0.0,0.0, 0.0,1.0,0.0); - - glPolygonMode(GL_FRONT, GL_FILL); - glShadeModel(GL_SMOOTH); - glDisable(GL_LIGHTING); - glDisable(GL_DEPTH_TEST); - - glEnable(GL_TEXTURE_2D); - glColor3f(1.0,1.0,1.0); - - float uv_ratio = (float)(m_buffersize-1) / m_imagesize; - double onebythree = 1.0f / 3; - - // domefacesId[0] => (top) - glBindTexture(GL_TEXTURE_2D, domefacesId[0]); - glBegin(GL_QUADS); - glTexCoord2f(uv_ratio,uv_ratio); - glVertex3f( onebythree, 0.0f, 3.0f); - glTexCoord2f(0.0,uv_ratio); - glVertex3f(-onebythree, 0.0f, 3.0f); - glTexCoord2f(0.0,0.0); - glVertex3f(-onebythree,-2 * onebythree, 3.0f); - glTexCoord2f(uv_ratio,0.0); - glVertex3f(onebythree,-2 * onebythree, 3.0f); - glEnd(); - - // domefacesId[1] => (bottom) - glBindTexture(GL_TEXTURE_2D, domefacesId[1]); - glBegin(GL_QUADS); - glTexCoord2f(uv_ratio,uv_ratio); - glVertex3f(-onebythree, 0.0f, 3.0f); - glTexCoord2f(0.0,uv_ratio); - glVertex3f(-1.0f, 0.0f, 3.0f); - glTexCoord2f(0.0,0.0); - glVertex3f(-1.0f,-2 * onebythree, 3.0f); - glTexCoord2f(uv_ratio,0.0); - glVertex3f(-onebythree,-2 * onebythree, 3.0f); - glEnd(); - - // domefacesId[2] => -90� (left) - glBindTexture(GL_TEXTURE_2D, domefacesId[2]); - glBegin(GL_QUADS); - glTexCoord2f(uv_ratio,uv_ratio); - glVertex3f(-onebythree, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,uv_ratio); - glVertex3f(-1.0f, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,0.0); - glVertex3f(-1.0f, 0.0f, 3.0f); - glTexCoord2f(uv_ratio,0.0); - glVertex3f(-onebythree, 0.0f, 3.0f); - glEnd(); - - // domefacesId[3] => 90� (right) - glBindTexture(GL_TEXTURE_2D, domefacesId[3]); - glBegin(GL_QUADS); - glTexCoord2f(uv_ratio,uv_ratio); - glVertex3f( 1.0f, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,uv_ratio); - glVertex3f( onebythree, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,0.0); - glVertex3f( onebythree, 0.0f, 3.0f); - glTexCoord2f(uv_ratio,0.0); - glVertex3f(1.0f, 0.0f, 3.0f); - glEnd(); - - // domefacesId[4] => 0� (front) - glBindTexture(GL_TEXTURE_2D, domefacesId[4]); - glBegin(GL_QUADS); - glTexCoord2f(uv_ratio,uv_ratio); - glVertex3f( 1.0f, 0.0f, 3.0f); - glTexCoord2f(0.0,uv_ratio); - glVertex3f( onebythree, 0.0f, 3.0f); - glTexCoord2f(0.0,0.0); - glVertex3f( onebythree,-2 * onebythree, 3.0f); - glTexCoord2f(uv_ratio,0.0); - glVertex3f(1.0f, -2 * onebythree, 3.0f); - glEnd(); - - // domefacesId[5] => 180� (back) - glBindTexture(GL_TEXTURE_2D, domefacesId[5]); - glBegin(GL_QUADS); - glTexCoord2f(uv_ratio,uv_ratio); - glVertex3f( onebythree, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,uv_ratio); - glVertex3f(-onebythree, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,0.0); - glVertex3f(-onebythree, 0.0f, 3.0f); - glTexCoord2f(uv_ratio,0.0); - glVertex3f(onebythree, 0.0f, 3.0f); - glEnd(); - - glDisable(GL_TEXTURE_2D); - glEnable(GL_DEPTH_TEST); -} - -void KX_Dome::DrawDomeFisheye(void) -{ - int i; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - // Making the viewport always square - - int can_width = m_viewport.GetRight(); - int can_height = m_viewport.GetTop(); - - float ortho_width, ortho_height; - - if(m_mode == DOME_FISHEYE) { - if (warp.usemesh) - glOrtho((-1.0), 1.0, (-1.0), 1.0, -20.0, 10.0); //stretch the image to reduce resolution lost - - else { - if (can_width < can_height){ - ortho_width = 1.0; - ortho_height = (float)can_height/can_width; - }else{ - ortho_width = (float)can_width/can_height; - ortho_height = 1.0; - } - - glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0, 10.0); - } - } - else if(m_mode == DOME_TRUNCATED_FRONT) - { - ortho_width = 1.0; - ortho_height = 2 * ((float)can_height/can_width) - 1.0 ; - - glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_width, -20.0, 10.0); - } - else { //m_mode == DOME_TRUNCATED_REAR - ortho_width = 1.0; - ortho_height = 2 * ((float)can_height/can_width) - 1.0 ; - - glOrtho((-ortho_width), ortho_width, (-ortho_width), ortho_height, -20.0, 10.0); - } - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - gluLookAt(0.0,-1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0); - - if(m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) - glPolygonMode(GL_FRONT, GL_LINE); - else - glPolygonMode(GL_FRONT, GL_FILL); - - glShadeModel(GL_SMOOTH); - glDisable(GL_LIGHTING); - glDisable(GL_DEPTH_TEST); - - glEnable(GL_TEXTURE_2D); - glColor3f(1.0,1.0,1.0); - - if (dlistSupported){ - for(i=0;i 180){ - // front triangle - glBindTexture(GL_TEXTURE_2D, domefacesId[4]); - GLDrawTriangles(cubefront, nfacesfront); - } - } - glDisable(GL_TEXTURE_2D); - glEnable(GL_DEPTH_TEST); -} - -void KX_Dome::DrawPanorama(void) -{ - int i; - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - // Making the viewport always square - - int can_width = m_viewport.GetRight(); - int can_height = m_viewport.GetTop(); - - float ortho_height = 1.0; - float ortho_width = 1.0; - - if (warp.usemesh) - glOrtho((-1.0), 1.0, (-0.5), 0.5, -20.0, 10.0); //stretch the image to reduce resolution lost - - else { - //using all the screen - if ((can_width / 2) <= (can_height)){ - ortho_width = 1.0; - ortho_height = (float)can_height/can_width; - }else{ - ortho_width = (float)can_width/can_height * 0.5; - ortho_height = 0.5; - } - - glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0, 10.0); - } - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - gluLookAt(0.0,-1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0); - - if(m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) - glPolygonMode(GL_FRONT, GL_LINE); - else - glPolygonMode(GL_FRONT, GL_FILL); - - glShadeModel(GL_SMOOTH); - glDisable(GL_LIGHTING); - glDisable(GL_DEPTH_TEST); - - glEnable(GL_TEXTURE_2D); - glColor3f(1.0,1.0,1.0); - - if (dlistSupported){ - for(i=0;i (top) - glBindTexture(GL_TEXTURE_2D, domefacesId[0]); - GLDrawTriangles(cubetop, nfacestop); - - // domefacesId[5] => (bottom) - glBindTexture(GL_TEXTURE_2D, domefacesId[1]); - GLDrawTriangles(cubebottom, nfacesbottom); - - // domefacesId[1] => -45� (left) - glBindTexture(GL_TEXTURE_2D, domefacesId[2]); - GLDrawTriangles(cubeleft, nfacesleft); - - // domefacesId[2] => 45� (right) - glBindTexture(GL_TEXTURE_2D, domefacesId[3]); - GLDrawTriangles(cuberight, nfacesright); - - // domefacesId[0] => -135� (leftback) - glBindTexture(GL_TEXTURE_2D, domefacesId[4]); - GLDrawTriangles(cubeleftback, nfacesleftback); - - // domefacesId[3] => 135� (rightback) - glBindTexture(GL_TEXTURE_2D, domefacesId[5]); - GLDrawTriangles(cuberightback, nfacesrightback); - } - glDisable(GL_TEXTURE_2D); - glEnable(GL_DEPTH_TEST); -} - -void KX_Dome::DrawDomeWarped(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - // Making the viewport always square - int can_width = m_viewport.GetRight(); - int can_height = m_viewport.GetTop(); - - double screen_ratio = can_width/ (double) can_height; - - glOrtho(-screen_ratio,screen_ratio,-1.0,1.0,-20.0,10.0); - - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - gluLookAt(0.0, 0.0, 1.0, 0.0,0.0,0.0, 0.0,1.0,0.0); - - if(m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) - glPolygonMode(GL_FRONT, GL_LINE); - else - glPolygonMode(GL_FRONT, GL_FILL); - - glShadeModel(GL_SMOOTH); - glDisable(GL_LIGHTING); - glDisable(GL_DEPTH_TEST); - - glEnable(GL_TEXTURE_2D); - glColor3f(1.0,1.0,1.0); - - if (dlistSupported){ - glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]); - glCallList(dlistId + m_numfaces); - } - else{ - glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]); - GLDrawWarpQuads(); - } - glDisable(GL_TEXTURE_2D); - glEnable(GL_DEPTH_TEST); -} - -void KX_Dome::BindImages(int i) -{ - glBindTexture(GL_TEXTURE_2D, domefacesId[i]); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_viewport.GetLeft(), m_viewport.GetBottom(), m_buffersize, m_buffersize); -} - -void KX_Dome::RenderDomeFrame(KX_Scene* scene, KX_Camera* cam, int i) -{ - if (!cam) - return; - - m_canvas->SetViewPort(0,0,m_buffersize-1,m_buffersize-1); - -// m_rasterizer->SetAmbient(); - m_rasterizer->DisplayFog(); - - CalculateFrustum(cam); //calculates m_projmat - cam->SetProjectionMatrix(m_projmat); - m_rasterizer->SetProjectionMatrix(cam->GetProjectionMatrix()); -// Dome_RotateCamera(cam,i); - - MT_Matrix3x3 camori = cam->GetSGNode()->GetLocalOrientation(); - - cam->NodeSetLocalOrientation(camori*m_locRot[i]); - cam->NodeUpdateGS(0.f); - - MT_Transform camtrans(cam->GetWorldToCamera()); - MT_Matrix4x4 viewmat(camtrans); - m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), 1.0); - cam->SetModelviewMatrix(viewmat); - - scene->CalculateVisibleMeshes(m_rasterizer,cam); - scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools); - - // restore the original orientation - cam->NodeSetLocalOrientation(camori); - cam->NodeUpdateGS(0.f); -} - diff --git a/source/gameengine/Ketsji/KX_Dome.h b/source/gameengine/Ketsji/KX_Dome.h deleted file mode 100644 index 9ff33fe2852..00000000000 --- a/source/gameengine/Ketsji/KX_Dome.h +++ /dev/null @@ -1,197 +0,0 @@ -/* $Id$ ------------------------------------------------------------------------------ - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. - -Contributor(s): Dalai Felinto - -This source uses some of the ideas and code from Paul Bourke. -Developed as part of a Research and Development project for SAT - La Soci�t� des arts technologiques. ------------------------------------------------------------------------------ -*/ - -#if !defined KX_DOME_H -#define KX_DOME_H - -#include "KX_Scene.h" -#include "KX_Camera.h" -#include "DNA_screen_types.h" -#include "RAS_ICanvas.h" -#include "RAS_IRasterizer.h" -#include "RAS_IRenderTools.h" -#include "KX_KetsjiEngine.h" - -#include "GL/glew.h" -#include - -#include "MEM_guardedalloc.h" -#include "BKE_text.h" - -//Dome modes: limit hardcoded in buttons_scene.c -#define DOME_FISHEYE 1 -#define DOME_TRUNCATED_FRONT 2 -#define DOME_TRUNCATED_REAR 3 -#define DOME_ENVMAP 4 -#define DOME_PANORAM_SPH 5 -#define DOME_NUM_MODES 6 - - -/// class for render 3d scene -class KX_Dome -{ -public: - /// constructor - KX_Dome ( - RAS_ICanvas* m_canvas, - /// rasterizer - RAS_IRasterizer* m_rasterizer, - /// render tools - RAS_IRenderTools* m_rendertools, - /// engine - KX_KetsjiEngine* m_engine, - - short res, - short mode, - short angle, - float resbuf, - short tilt, - struct Text* warptext - ); - - /// destructor - virtual ~KX_Dome (void); - - //openGL checks: - bool dlistSupported; - bool fboSupported; - - //openGL names: - GLuint domefacesId[7]; // ID of the images -- room for 7 images, using only 4 for 180� x 360� dome, 6 for panoramic and +1 for warp mesh - GLuint dlistId; // ID of the Display Lists of the images (used as an offset) - - typedef struct { - double u[3], v[3]; - MT_Vector3 verts[3]; //three verts - } DomeFace; - - //mesh warp functions - typedef struct { - double x, y, u, v, i; - } WarpMeshNode; - - struct { - bool usemesh; - int mode; - int n_width, n_height; //nodes width and height - int imagesize; - int bufferwidth, bufferheight; - GLuint fboId; - vector > nodes; - } warp; - - bool ParseWarpMesh(STR_String text); - - vector cubetop, cubebottom, cuberight, cubeleft, cubefront, cubeback; //for fisheye - vector cubeleftback, cuberightback; //for panorama - - int nfacestop, nfacesbottom, nfacesleft, nfacesright, nfacesfront, nfacesback; - int nfacesleftback, nfacesrightback; - - int GetNumberRenders(){return m_numfaces;}; - - void RenderDome(void); - void RenderDomeFrame(KX_Scene* scene, KX_Camera* cam, int i); - void BindImages(int i); - - void SetViewPort(GLuint viewport[4]); - void CalculateFrustum(KX_Camera* cam); - void RotateCamera(KX_Camera* cam, int i); - - //Mesh creation Functions - void CreateMeshDome180(void); - void CreateMeshDome250(void); - void CreateMeshPanorama(void); - - void SplitFace(vector & face, int *nfaces); - - void FlattenDome(MT_Vector3 verts[3]); - void FlattenPanorama(MT_Vector3 verts[3]); - - //Draw functions - void GLDrawTriangles(vector & face, int nfaces); - void GLDrawWarpQuads(void); - void Draw(void); - void DrawDomeFisheye(void); - void DrawEnvMap(void); - void DrawPanorama(void); - void DrawDomeWarped(void); - - //setting up openGL - void CreateGLImages(void); - void ClearGLImages(void);//called on resize - bool CreateDL(void); //create Display Lists - void ClearDL(void); //remove Display Lists - bool CreateFBO(void);//create FBO (for warp mesh) - void ClearFBO(void); //remove FBO - - void CalculateCameraOrientation(); - void CalculateImageSize(); //set m_imagesize - - int canvaswidth; - int canvasheight; - -protected: - int m_drawingmode; - - int m_imagesize; - int m_buffersize; // canvas small dimension - int m_numfaces; // 4 to 6 depending on the kind of dome image - int m_numimages; //numfaces +1 if we have warp mesh - - short m_resolution; //resolution to tesselate the mesh - short m_mode; // the mode (truncated, warped, panoramic,...) - short m_angle; //the angle of the fisheye - float m_radangle; //the angle of the fisheye in radians - float m_resbuffer; //the resolution of the buffer - short m_tilt; //the dome tilt (camera rotation on horizontal axis) - - RAS_Rect m_viewport; - - MT_Matrix4x4 m_projmat; - - MT_Matrix3x3 m_locRot [6];// the rotation matrix - - /// rendered scene - KX_Scene * m_scene; - - /// canvas - RAS_ICanvas* m_canvas; - /// rasterizer - RAS_IRasterizer* m_rasterizer; - /// render tools - RAS_IRenderTools* m_rendertools; - /// engine - KX_KetsjiEngine* m_engine; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_Dome"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_EmptyObject.cpp b/source/gameengine/Ketsji/KX_EmptyObject.cpp deleted file mode 100644 index 7dc66b3fb88..00000000000 --- a/source/gameengine/Ketsji/KX_EmptyObject.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "KX_EmptyObject.h" - -KX_EmptyObject::~KX_EmptyObject() -{ - -} diff --git a/source/gameengine/Ketsji/KX_EmptyObject.h b/source/gameengine/Ketsji/KX_EmptyObject.h deleted file mode 100644 index c82c2ec1657..00000000000 --- a/source/gameengine/Ketsji/KX_EmptyObject.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_EMPTYOBJECT -#define __KX_EMPTYOBJECT -#include "KX_GameObject.h" - -class KX_EmptyObject : public KX_GameObject -{ -public: - KX_EmptyObject(void* sgReplicationInfo,SG_Callbacks callbacks) : - KX_GameObject(sgReplicationInfo,callbacks) - {}; - virtual ~KX_EmptyObject(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_EmptyObject"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_EMPTYOBJECT - diff --git a/source/gameengine/Ketsji/KX_GameActuator.cpp b/source/gameengine/Ketsji/KX_GameActuator.cpp deleted file mode 100644 index 208c526398a..00000000000 --- a/source/gameengine/Ketsji/KX_GameActuator.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/** -* global game stuff -* -* $Id$ -* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** -*/ - -#include "SCA_IActuator.h" -#include "KX_GameActuator.h" -//#include -#include "KX_Scene.h" -#include "KX_KetsjiEngine.h" -#include "KX_PythonInit.h" /* for config load/saving */ - -#include -#include - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_GameActuator::KX_GameActuator(SCA_IObject *gameobj, - int mode, - const STR_String& filename, - const STR_String& loadinganimationname, - SCA_IScene* scene, - KX_KetsjiEngine* ketsjiengine) - : SCA_IActuator(gameobj, KX_ACT_GAME) -{ - m_mode = mode; - m_filename = filename; - m_loadinganimationname = loadinganimationname; - m_scene = scene; - m_ketsjiengine = ketsjiengine; -} /* End of constructor */ - - - -KX_GameActuator::~KX_GameActuator() -{ - // there's nothing to be done here, really.... -} /* end of destructor */ - - - -CValue* KX_GameActuator::GetReplica() -{ - KX_GameActuator* replica = new KX_GameActuator(*this); - replica->ProcessReplica(); - - return replica; -} - - - -bool KX_GameActuator::Update() -{ - // bool result = false; /*unused*/ - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (bNegativeEvent) - return false; // do nothing on negative events - - switch (m_mode) - { - case KX_GAME_LOAD: - case KX_GAME_START: - { - if (m_ketsjiengine) - { - STR_String exitstring = "start other game"; - m_ketsjiengine->RequestExit(KX_EXIT_REQUEST_START_OTHER_GAME); - m_ketsjiengine->SetNameNextGame(m_filename); - m_scene->AddDebugProperty((this)->GetParent(), exitstring); - } - - break; - } - case KX_GAME_RESTART: - { - if (m_ketsjiengine) - { - STR_String exitstring = "restarting game"; - m_ketsjiengine->RequestExit(KX_EXIT_REQUEST_RESTART_GAME); - m_ketsjiengine->SetNameNextGame(m_filename); - m_scene->AddDebugProperty((this)->GetParent(), exitstring); - } - break; - } - case KX_GAME_QUIT: - { - if (m_ketsjiengine) - { - STR_String exitstring = "quiting game"; - m_ketsjiengine->RequestExit(KX_EXIT_REQUEST_QUIT_GAME); - m_scene->AddDebugProperty((this)->GetParent(), exitstring); - } - break; - } - case KX_GAME_SAVECFG: - { -#ifndef DISABLE_PYTHON - if (m_ketsjiengine) - { - char mashal_path[512]; - char *marshal_buffer = NULL; - unsigned int marshal_length; - FILE *fp = NULL; - - pathGamePythonConfig(mashal_path); - marshal_length = saveGamePythonConfig(&marshal_buffer); - - if (marshal_length && marshal_buffer) { - fp = fopen(mashal_path, "wb"); - if (fp) { - if (fwrite(marshal_buffer, 1, marshal_length, fp) != marshal_length) { - printf("Warning: could not write marshal data\n"); - } - fclose(fp); - } else { - printf("Warning: could not open marshal file\n"); - } - } else { - printf("Warning: could not create marshal buffer\n"); - } - if (marshal_buffer) - delete [] marshal_buffer; - } - break; -#endif // DISABLE_PYTHON - } - case KX_GAME_LOADCFG: - { -#ifndef DISABLE_PYTHON - if (m_ketsjiengine) - { - char mashal_path[512]; - char *marshal_buffer; - int marshal_length; - FILE *fp = NULL; - int result; - - pathGamePythonConfig(mashal_path); - - fp = fopen(mashal_path, "rb"); - if (fp) { - // obtain file size: - fseek (fp , 0 , SEEK_END); - marshal_length = ftell(fp); - rewind(fp); - - marshal_buffer = (char*) malloc (sizeof(char)*marshal_length); - - result = fread (marshal_buffer, 1, marshal_length, fp); - - if (result == marshal_length) { - loadGamePythonConfig(marshal_buffer, marshal_length); - } else { - printf("warning: could not read all of '%s'\n", mashal_path); - } - - free(marshal_buffer); - fclose(fp); - } else { - printf("warning: could not open '%s'\n", mashal_path); - } - } - break; -#endif // DISABLE_PYTHON - } - default: - ; /* do nothing? this is an internal error !!! */ - } - - return false; -} - - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_GameActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_GameActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_GameActuator::Methods[] = -{ - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_GameActuator::Attributes[] = { - KX_PYATTRIBUTE_STRING_RW("fileName",0,100,false,KX_GameActuator,m_filename), - KX_PYATTRIBUTE_INT_RW("mode", KX_GAME_NODEF+1, KX_GAME_MAX-1, true, KX_GameActuator, m_mode), - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_GameActuator.h b/source/gameengine/Ketsji/KX_GameActuator.h deleted file mode 100644 index 273d6664e1d..00000000000 --- a/source/gameengine/Ketsji/KX_GameActuator.h +++ /dev/null @@ -1,90 +0,0 @@ - -// -// actuator for global game stuff -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// - -#ifndef __KX_GAMEACTUATOR -#define __KX_GAMEACTUATOR - -#include "SCA_IActuator.h" - -#include "SCA_IScene.h" /* Replace_IScene only */ -#include "KX_Scene.h" /* Replace_IScene only */ - -class KX_GameActuator : public SCA_IActuator -{ - Py_Header; -protected: - int m_mode; - bool m_restart; - STR_String m_filename; - STR_String m_loadinganimationname; - class SCA_IScene* m_scene; - class KX_KetsjiEngine* m_ketsjiengine; - - public: - enum KX_GameActuatorMode - { - KX_GAME_NODEF = 0, - KX_GAME_LOAD, - KX_GAME_START, - KX_GAME_RESTART, - KX_GAME_QUIT, - KX_GAME_SAVECFG, - KX_GAME_LOADCFG, - KX_GAME_MAX - - }; - - KX_GameActuator(SCA_IObject* gameobj, - int mode, - const STR_String& filename, - const STR_String& loadinganimationname, - SCA_IScene* scene, - KX_KetsjiEngine* ketsjiEngine); - virtual ~KX_GameActuator(); - - virtual CValue* GetReplica(); - - virtual bool Update(); - - virtual void Replace_IScene(SCA_IScene *val) - { - m_scene= val; - }; - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - -}; /* end of class KX_GameActuator */ - -#endif - diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp deleted file mode 100644 index abc597a9eae..00000000000 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ /dev/null @@ -1,3043 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Game object wrapper - */ - -#if defined(_WIN64) -typedef unsigned __int64 uint_ptr; -#else -typedef unsigned long uint_ptr; -#endif - -#ifdef WIN32 -// This warning tells us about truncation of __long__ stl-generated names. -// It can occasionally cause DevStudio to have internal compiler warnings. -#pragma warning( disable : 4786 ) -#endif - - -#define KX_INERTIA_INFINITE 10000 -#include "RAS_IPolygonMaterial.h" -#include "KX_BlenderMaterial.h" -#include "KX_GameObject.h" -#include "KX_Camera.h" // only for their ::Type -#include "KX_Light.h" // only for their ::Type -#include "RAS_MeshObject.h" -#include "KX_MeshProxy.h" -#include "KX_PolyProxy.h" -#include // printf -#include "SG_Controller.h" -#include "KX_IPhysicsController.h" -#include "PHY_IGraphicController.h" -#include "SG_Node.h" -#include "SG_Controller.h" -#include "KX_ClientObjectInfo.h" -#include "RAS_BucketManager.h" -#include "KX_RayCast.h" -#include "KX_PythonInit.h" -#include "KX_PyMath.h" -#include "KX_PythonSeq.h" -#include "KX_ConvertPhysicsObject.h" -#include "SCA_IActuator.h" -#include "SCA_ISensor.h" -#include "SCA_IController.h" -#include "NG_NetworkScene.h" //Needed for sendMessage() - -#include "PyObjectPlus.h" /* python stuff */ - -// This file defines relationships between parents and children -// in the game engine. - -#include "KX_SG_NodeRelationships.h" - -#include "BLI_math.h" - -static MT_Point3 dummy_point= MT_Point3(0.0, 0.0, 0.0); -static MT_Vector3 dummy_scaling = MT_Vector3(1.0, 1.0, 1.0); -static MT_Matrix3x3 dummy_orientation = MT_Matrix3x3( 1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0, 1.0); - -KX_GameObject::KX_GameObject( - void* sgReplicationInfo, - SG_Callbacks callbacks) - : SCA_IObject(), - m_bDyna(false), - m_layer(0), - m_pBlenderObject(NULL), - m_pBlenderGroupObject(NULL), - m_bSuspendDynamics(false), - m_bUseObjectColor(false), - m_bIsNegativeScaling(false), - m_bVisible(true), - m_bCulled(true), - m_bOccluder(false), - m_pPhysicsController1(NULL), - m_pGraphicController(NULL), - m_xray(false), - m_pHitObject(NULL), - m_isDeformable(false) -#ifndef DISABLE_PYTHON - , m_attr_dict(NULL) -#endif -{ - m_ignore_activity_culling = false; - m_pClient_info = new KX_ClientObjectInfo(this, KX_ClientObjectInfo::ACTOR); - m_pSGNode = new SG_Node(this,sgReplicationInfo,callbacks); - - // define the relationship between this node and it's parent. - - KX_NormalParentRelation * parent_relation = - KX_NormalParentRelation::New(); - m_pSGNode->SetParentRelation(parent_relation); -}; - - - -KX_GameObject::~KX_GameObject() -{ - RemoveMeshes(); - - // is this delete somewhere ? - //if (m_sumoObj) - // delete m_sumoObj; - delete m_pClient_info; - //if (m_pSGNode) - // delete m_pSGNode; - if (m_pSGNode) - { - // must go through controllers and make sure they will not use us anymore - // This is important for KX_BulletPhysicsControllers that unregister themselves - // from the object when they are deleted. - SGControllerList::iterator contit; - SGControllerList& controllers = m_pSGNode->GetSGControllerList(); - for (contit = controllers.begin();contit!=controllers.end();++contit) - { - (*contit)->ClearObject(); - } - m_pSGNode->SetSGClientObject(NULL); - - /* m_pSGNode is freed in KX_Scene::RemoveNodeDestructObject */ - } - if (m_pGraphicController) - { - delete m_pGraphicController; - } -#ifndef DISABLE_PYTHON - if (m_attr_dict) { - PyDict_Clear(m_attr_dict); /* incase of circular refs or other weired cases */ - Py_DECREF(m_attr_dict); - } -#endif // DISABLE_PYTHON -} - -KX_GameObject* KX_GameObject::GetClientObject(KX_ClientObjectInfo* info) -{ - if (!info) - return NULL; - return info->m_gameobject; -} - -CValue* KX_GameObject:: Calc(VALUE_OPERATOR op, CValue *val) -{ - return NULL; -} - - - -CValue* KX_GameObject::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) -{ - return NULL; -} - - - -const STR_String & KX_GameObject::GetText() -{ - return m_text; -} - - - -double KX_GameObject::GetNumber() -{ - return 0; -} - - - -STR_String& KX_GameObject::GetName() -{ - return m_name; -} - - - -void KX_GameObject::SetName(const char *name) -{ - m_name = name; -}; // Set the name of the value - -KX_IPhysicsController* KX_GameObject::GetPhysicsController() -{ - return m_pPhysicsController1; -} - -KX_GameObject* KX_GameObject::GetParent() -{ - KX_GameObject* result = NULL; - SG_Node* node = m_pSGNode; - - while (node && !result) - { - node = node->GetSGParent(); - if (node) - result = (KX_GameObject*)node->GetSGClientObject(); - } - - if (result) - result->AddRef(); - - return result; - -} - -void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj, bool addToCompound, bool ghost) -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (obj && - GetSGNode() && // object is not zombi - obj->GetSGNode() && // object is not zombi - GetSGNode()->GetSGParent() != obj->GetSGNode() && // not already parented to same object - !GetSGNode()->IsAncessor(obj->GetSGNode()) && // no parenting loop - this != obj) // not the object itself - { - // Make sure the objects have some scale - MT_Vector3 scale1 = NodeGetWorldScaling(); - MT_Vector3 scale2 = obj->NodeGetWorldScaling(); - if (fabs(scale2[0]) < FLT_EPSILON || - fabs(scale2[1]) < FLT_EPSILON || - fabs(scale2[2]) < FLT_EPSILON || - fabs(scale1[0]) < FLT_EPSILON || - fabs(scale1[1]) < FLT_EPSILON || - fabs(scale1[2]) < FLT_EPSILON) { return; } - - // Remove us from our old parent and set our new parent - RemoveParent(scene); - obj->GetSGNode()->AddChild(GetSGNode()); - - if (m_pPhysicsController1) - { - m_pPhysicsController1->SuspendDynamics(ghost); - } - // Set us to our new scale, position, and orientation - scale2[0] = 1.0/scale2[0]; - scale2[1] = 1.0/scale2[1]; - scale2[2] = 1.0/scale2[2]; - scale1 = scale1 * scale2; - MT_Matrix3x3 invori = obj->NodeGetWorldOrientation().inverse(); - MT_Vector3 newpos = invori*(NodeGetWorldPosition()-obj->NodeGetWorldPosition())*scale2; - - NodeSetLocalScale(scale1); - NodeSetLocalPosition(MT_Point3(newpos[0],newpos[1],newpos[2])); - NodeSetLocalOrientation(invori*NodeGetWorldOrientation()); - NodeUpdateGS(0.f); - // object will now be a child, it must be removed from the parent list - CListValue* rootlist = scene->GetRootParentList(); - if (rootlist->RemoveValue(this)) - // the object was in parent list, decrement ref count as it's now removed - Release(); - // if the new parent is a compound object, add this object shape to the compound shape. - // step 0: verify this object has physical controller - if (m_pPhysicsController1 && addToCompound) - { - // step 1: find the top parent (not necessarily obj) - KX_GameObject* rootobj = (KX_GameObject*)obj->GetSGNode()->GetRootSGParent()->GetSGClientObject(); - // step 2: verify it has a physical controller and compound shape - if (rootobj != NULL && - rootobj->m_pPhysicsController1 != NULL && - rootobj->m_pPhysicsController1->IsCompound()) - { - rootobj->m_pPhysicsController1->AddCompoundChild(m_pPhysicsController1); - } - } - // graphically, the object hasn't change place, no need to update m_pGraphicController - } -} - -void KX_GameObject::RemoveParent(KX_Scene *scene) -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (GetSGNode() && GetSGNode()->GetSGParent()) - { - // get the root object to remove us from compound object if needed - KX_GameObject* rootobj = (KX_GameObject*)GetSGNode()->GetRootSGParent()->GetSGClientObject(); - // Set us to the right spot - GetSGNode()->SetLocalScale(GetSGNode()->GetWorldScaling()); - GetSGNode()->SetLocalOrientation(GetSGNode()->GetWorldOrientation()); - GetSGNode()->SetLocalPosition(GetSGNode()->GetWorldPosition()); - - // Remove us from our parent - GetSGNode()->DisconnectFromParent(); - NodeUpdateGS(0.f); - // the object is now a root object, add it to the parentlist - CListValue* rootlist = scene->GetRootParentList(); - if (!rootlist->SearchValue(this)) - // object was not in root list, add it now and increment ref count - rootlist->Add(AddRef()); - if (m_pPhysicsController1) - { - // in case this controller was added as a child shape to the parent - if (rootobj != NULL && - rootobj->m_pPhysicsController1 != NULL && - rootobj->m_pPhysicsController1->IsCompound()) - { - rootobj->m_pPhysicsController1->RemoveCompoundChild(m_pPhysicsController1); - } - m_pPhysicsController1->RestoreDynamics(); - if (m_pPhysicsController1->IsDyna() && rootobj->m_pPhysicsController1) - { - // dynamic object should remember the velocity they had while being parented - MT_Point3 childPoint = GetSGNode()->GetWorldPosition(); - MT_Point3 rootPoint = rootobj->GetSGNode()->GetWorldPosition(); - MT_Point3 relPoint; - relPoint = (childPoint-rootPoint); - MT_Vector3 linVel = rootobj->m_pPhysicsController1->GetVelocity(relPoint); - MT_Vector3 angVel = rootobj->m_pPhysicsController1->GetAngularVelocity(); - m_pPhysicsController1->SetLinearVelocity(linVel, false); - m_pPhysicsController1->SetAngularVelocity(angVel, false); - } - } - // graphically, the object hasn't change place, no need to update m_pGraphicController - } -} - -void KX_GameObject::ProcessReplica() -{ - SCA_IObject::ProcessReplica(); - - m_pPhysicsController1 = NULL; - m_pGraphicController = NULL; - m_pSGNode = NULL; - m_pClient_info = new KX_ClientObjectInfo(*m_pClient_info); - m_pClient_info->m_gameobject = this; - m_state = 0; - -#ifndef DISABLE_PYTHON - if(m_attr_dict) - m_attr_dict= PyDict_Copy(m_attr_dict); -#endif - -} - -static void setGraphicController_recursive(SG_Node* node) -{ - NodeList& children = node->GetSGChildren(); - - for (NodeList::iterator childit = children.begin();!(childit==children.end());++childit) - { - SG_Node* childnode = (*childit); - KX_GameObject *clientgameobj = static_cast( (*childit)->GetSGClientObject()); - if (clientgameobj != NULL) // This is a GameObject - clientgameobj->ActivateGraphicController(false); - - // if the childobj is NULL then this may be an inverse parent link - // so a non recursive search should still look down this node. - setGraphicController_recursive(childnode); - } -} - - -void KX_GameObject::ActivateGraphicController(bool recurse) -{ - if (m_pGraphicController) - { - m_pGraphicController->Activate(m_bVisible); - } - if (recurse) - { - setGraphicController_recursive(GetSGNode()); - } -} - - -CValue* KX_GameObject::GetReplica() -{ - KX_GameObject* replica = new KX_GameObject(*this); - - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - - - -void KX_GameObject::ApplyForce(const MT_Vector3& force,bool local) -{ - if (m_pPhysicsController1) - m_pPhysicsController1->ApplyForce(force,local); -} - - - -void KX_GameObject::ApplyTorque(const MT_Vector3& torque,bool local) -{ - if (m_pPhysicsController1) - m_pPhysicsController1->ApplyTorque(torque,local); -} - - - -void KX_GameObject::ApplyMovement(const MT_Vector3& dloc,bool local) -{ - if (GetSGNode()) - { - if (m_pPhysicsController1) // (IsDynamic()) - { - m_pPhysicsController1->RelativeTranslate(dloc,local); - } - GetSGNode()->RelativeTranslate(dloc,GetSGNode()->GetSGParent(),local); - } -} - - - -void KX_GameObject::ApplyRotation(const MT_Vector3& drot,bool local) -{ - MT_Matrix3x3 rotmat(drot); - - if (GetSGNode()) { - GetSGNode()->RelativeRotate(rotmat,local); - - if (m_pPhysicsController1) { // (IsDynamic()) - m_pPhysicsController1->RelativeRotate(rotmat,local); - } - } -} - - - -/** -GetOpenGL Matrix, returns an OpenGL 'compatible' matrix -*/ -double* KX_GameObject::GetOpenGLMatrix() -{ - // todo: optimize and only update if necessary - double* fl = m_OpenGL_4x4Matrix.getPointer(); - if (GetSGNode()) { - MT_Transform trans; - - trans.setOrigin(GetSGNode()->GetWorldPosition()); - trans.setBasis(GetSGNode()->GetWorldOrientation()); - - MT_Vector3 scaling = GetSGNode()->GetWorldScaling(); - m_bIsNegativeScaling = ((scaling[0] < 0.0) ^ (scaling[1] < 0.0) ^ (scaling[2] < 0.0)) ? true : false; - trans.scale(scaling[0], scaling[1], scaling[2]); - trans.getValue(fl); - GetSGNode()->ClearDirty(); - } - return fl; -} - -void KX_GameObject::UpdateBlenderObjectMatrix(Object* blendobj) -{ - if (!blendobj) - blendobj = m_pBlenderObject; - if (blendobj) { - const MT_Matrix3x3& rot = NodeGetWorldOrientation(); - const MT_Vector3& scale = NodeGetWorldScaling(); - const MT_Vector3& pos = NodeGetWorldPosition(); - rot.getValue(blendobj->obmat[0]); - pos.getValue(blendobj->obmat[3]); - mul_v3_fl(blendobj->obmat[0], scale[0]); - mul_v3_fl(blendobj->obmat[1], scale[1]); - mul_v3_fl(blendobj->obmat[2], scale[2]); - } -} - -void KX_GameObject::AddMeshUser() -{ - for (size_t i=0;iAddMeshUser(this, &m_meshSlots, GetDeformer()); - } - // set the part of the mesh slot that never change - double* fl = GetOpenGLMatrixPtr()->getPointer(); - - SG_QList::iterator mit(m_meshSlots); -// RAS_MeshSlot* ms; - for(mit.begin(); !mit.end(); ++mit) - { - (*mit)->m_OpenGLMatrix = fl; - } - UpdateBuckets(false); -} - -static void UpdateBuckets_recursive(SG_Node* node) -{ - NodeList& children = node->GetSGChildren(); - - for (NodeList::iterator childit = children.begin();!(childit==children.end());++childit) - { - SG_Node* childnode = (*childit); - KX_GameObject *clientgameobj = static_cast( (*childit)->GetSGClientObject()); - if (clientgameobj != NULL) // This is a GameObject - clientgameobj->UpdateBuckets(0); - - // if the childobj is NULL then this may be an inverse parent link - // so a non recursive search should still look down this node. - UpdateBuckets_recursive(childnode); - } -} - -void KX_GameObject::UpdateBuckets( bool recursive ) -{ - if (GetSGNode()) { - RAS_MeshSlot *ms; - - if (GetSGNode()->IsDirty()) - GetOpenGLMatrix(); - - SG_QList::iterator mit(m_meshSlots); - for(mit.begin(); !mit.end(); ++mit) - { - ms = *mit; - ms->m_bObjectColor = m_bUseObjectColor; - ms->m_RGBAcolor = m_objectColor; - ms->m_bVisible = m_bVisible; - ms->m_bCulled = m_bCulled || !m_bVisible; - if (!ms->m_bCulled) - ms->m_bucket->ActivateMesh(ms); - - /* split if necessary */ -#ifdef USE_SPLIT - ms->Split(); -#endif - } - - if (recursive) { - UpdateBuckets_recursive(GetSGNode()); - } - } -} - -void KX_GameObject::RemoveMeshes() -{ - for (size_t i=0;iRemoveFromBuckets(this); - - //note: meshes can be shared, and are deleted by KX_BlenderSceneConverter - - m_meshes.clear(); -} - -void KX_GameObject::UpdateTransform() -{ - // HACK: saves function call for dynamic object, they are handled differently - if (m_pPhysicsController1 && !m_pPhysicsController1->IsDyna()) - // Note that for Bullet, this does not even update the transform of static object - // but merely sets there collision flag to "kinematic" because the synchronization is - // done during physics simulation - m_pPhysicsController1->SetSumoTransform(true); - if (m_pGraphicController) - // update the culling tree - m_pGraphicController->SetGraphicTransform(); - -} - -void KX_GameObject::UpdateTransformFunc(SG_IObject* node, void* gameobj, void* scene) -{ - ((KX_GameObject*)gameobj)->UpdateTransform(); -} - -void KX_GameObject::SynchronizeTransform() -{ - // only used for sensor object, do full synchronization as bullet doesn't do it - if (m_pPhysicsController1) - m_pPhysicsController1->SetTransform(); - if (m_pGraphicController) - m_pGraphicController->SetGraphicTransform(); -} - -void KX_GameObject::SynchronizeTransformFunc(SG_IObject* node, void* gameobj, void* scene) -{ - ((KX_GameObject*)gameobj)->SynchronizeTransform(); -} - - -void KX_GameObject::SetDebugColor(unsigned int bgra) -{ - for (size_t i=0;iDebugColor(bgra); -} - - - -void KX_GameObject::ResetDebugColor() -{ - SetDebugColor(0xff000000); -} - -void KX_GameObject::InitIPO(bool ipo_as_force, - bool ipo_add, - bool ipo_local) -{ - SGControllerList::iterator it = GetSGNode()->GetSGControllerList().begin(); - - while (it != GetSGNode()->GetSGControllerList().end()) { - (*it)->SetOption(SG_Controller::SG_CONTR_IPO_RESET, true); - (*it)->SetOption(SG_Controller::SG_CONTR_IPO_IPO_AS_FORCE, ipo_as_force); - (*it)->SetOption(SG_Controller::SG_CONTR_IPO_IPO_ADD, ipo_add); - (*it)->SetOption(SG_Controller::SG_CONTR_IPO_LOCAL, ipo_local); - it++; - } -} - -void KX_GameObject::UpdateIPO(float curframetime, - bool recurse) -{ - // just the 'normal' update procedure. - GetSGNode()->SetSimulatedTime(curframetime,recurse); - GetSGNode()->UpdateWorldData(curframetime); - UpdateTransform(); -} - -// IPO update -void -KX_GameObject::UpdateMaterialData( - dword matname_hash, - MT_Vector4 rgba, - MT_Vector3 specrgb, - MT_Scalar hard, - MT_Scalar spec, - MT_Scalar ref, - MT_Scalar emit, - MT_Scalar alpha - - ) -{ - int mesh = 0; - if (((unsigned int)mesh < m_meshes.size()) && mesh >= 0) { - list::iterator mit = m_meshes[mesh]->GetFirstMaterial(); - - for(; mit != m_meshes[mesh]->GetLastMaterial(); ++mit) - { - RAS_IPolyMaterial* poly = mit->m_bucket->GetPolyMaterial(); - - if(poly->GetFlag() & RAS_BLENDERMAT ) - { - KX_BlenderMaterial *m = static_cast(poly); - - if (matname_hash == 0) - { - m->UpdateIPO(rgba, specrgb,hard,spec,ref,emit, alpha); - // if mesh has only one material attached to it then use original hack with no need to edit vertices (better performance) - SetObjectColor(rgba); - } - else - { - if (matname_hash == poly->GetMaterialNameHash()) - { - m->UpdateIPO(rgba, specrgb,hard,spec,ref,emit, alpha); - m_meshes[mesh]->SetVertexColor(poly,rgba); - - // no break here, because one blender material can be split into several game engine materials - // (e.g. one uvsphere material is split into one material at poles with ras_mode TRIANGLE and one material for the body - // if here was a break then would miss some vertices if material was split - } - } - } - } - } -} -bool -KX_GameObject::GetVisible( - void - ) -{ - return m_bVisible; -} - -static void setVisible_recursive(SG_Node* node, bool v) -{ - NodeList& children = node->GetSGChildren(); - - for (NodeList::iterator childit = children.begin();!(childit==children.end());++childit) - { - SG_Node* childnode = (*childit); - KX_GameObject *clientgameobj = static_cast( (*childit)->GetSGClientObject()); - if (clientgameobj != NULL) // This is a GameObject - clientgameobj->SetVisible(v, 0); - - // if the childobj is NULL then this may be an inverse parent link - // so a non recursive search should still look down this node. - setVisible_recursive(childnode, v); - } -} - - -void -KX_GameObject::SetVisible( - bool v, - bool recursive - ) -{ - if (GetSGNode()) { - m_bVisible = v; - if (m_pGraphicController) - m_pGraphicController->Activate(m_bVisible); - if (recursive) - setVisible_recursive(GetSGNode(), v); - } -} - -static void setOccluder_recursive(SG_Node* node, bool v) -{ - NodeList& children = node->GetSGChildren(); - - for (NodeList::iterator childit = children.begin();!(childit==children.end());++childit) - { - SG_Node* childnode = (*childit); - KX_GameObject *clientgameobj = static_cast( (*childit)->GetSGClientObject()); - if (clientgameobj != NULL) // This is a GameObject - clientgameobj->SetOccluder(v, false); - - // if the childobj is NULL then this may be an inverse parent link - // so a non recursive search should still look down this node. - setOccluder_recursive(childnode, v); - } -} - -void -KX_GameObject::SetOccluder( - bool v, - bool recursive - ) -{ - if (GetSGNode()) { - m_bOccluder = v; - if (recursive) - setOccluder_recursive(GetSGNode(), v); - } -} - -void -KX_GameObject::SetLayer( - int l - ) -{ - m_layer = l; -} - -int -KX_GameObject::GetLayer( - void - ) -{ - return m_layer; -} - -void KX_GameObject::addLinearVelocity(const MT_Vector3& lin_vel,bool local) -{ - if (m_pPhysicsController1) - { - MT_Vector3 lv = local ? NodeGetWorldOrientation() * lin_vel : lin_vel; - m_pPhysicsController1->SetLinearVelocity(lv + m_pPhysicsController1->GetLinearVelocity(), 0); - } -} - - - -void KX_GameObject::setLinearVelocity(const MT_Vector3& lin_vel,bool local) -{ - if (m_pPhysicsController1) - m_pPhysicsController1->SetLinearVelocity(lin_vel,local); -} - - - -void KX_GameObject::setAngularVelocity(const MT_Vector3& ang_vel,bool local) -{ - if (m_pPhysicsController1) - m_pPhysicsController1->SetAngularVelocity(ang_vel,local); -} - - -void KX_GameObject::ResolveCombinedVelocities( - const MT_Vector3 & lin_vel, - const MT_Vector3 & ang_vel, - bool lin_vel_local, - bool ang_vel_local -){ - if (m_pPhysicsController1) - { - - MT_Vector3 lv = lin_vel_local ? NodeGetWorldOrientation() * lin_vel : lin_vel; - MT_Vector3 av = ang_vel_local ? NodeGetWorldOrientation() * ang_vel : ang_vel; - m_pPhysicsController1->resolveCombinedVelocities( - lv.x(),lv.y(),lv.z(),av.x(),av.y(),av.z()); - } -} - - -void KX_GameObject::SetObjectColor(const MT_Vector4& rgbavec) -{ - m_bUseObjectColor = true; - m_objectColor = rgbavec; -} - -const MT_Vector4& KX_GameObject::GetObjectColor() -{ - return m_objectColor; -} - -void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac) -{ - MT_Matrix3x3 orimat; - MT_Vector3 vect,ori,z,x,y; - MT_Scalar len; - - // check on valid node in case a python controller holds a reference to a deleted object - if (!GetSGNode()) - return; - - vect = dir; - len = vect.length(); - if (MT_fuzzyZero(len)) - { - cout << "alignAxisToVect() Error: Null vector!\n"; - return; - } - - if (fac<=0.0) { - return; - } - - // normalize - vect /= len; - orimat = GetSGNode()->GetWorldOrientation(); - switch (axis) - { - case 0: //x axis - ori.setValue(orimat[0][2], orimat[1][2], orimat[2][2]); //pivot axis - if (MT_abs(vect.dot(ori)) > 1.0-3.0*MT_EPSILON) //is the vector paralell to the pivot? - ori.setValue(orimat[0][1], orimat[1][1], orimat[2][1]); //change the pivot! - if (fac == 1.0) { - x = vect; - } else { - x = (vect * fac) + ((orimat * MT_Vector3(1.0, 0.0, 0.0)) * (1-fac)); - len = x.length(); - if (MT_fuzzyZero(len)) x = vect; - else x /= len; - } - y = ori.cross(x); - z = x.cross(y); - break; - case 1: //y axis - ori.setValue(orimat[0][0], orimat[1][0], orimat[2][0]); - if (MT_abs(vect.dot(ori)) > 1.0-3.0*MT_EPSILON) - ori.setValue(orimat[0][2], orimat[1][2], orimat[2][2]); - if (fac == 1.0) { - y = vect; - } else { - y = (vect * fac) + ((orimat * MT_Vector3(0.0, 1.0, 0.0)) * (1-fac)); - len = y.length(); - if (MT_fuzzyZero(len)) y = vect; - else y /= len; - } - z = ori.cross(y); - x = y.cross(z); - break; - case 2: //z axis - ori.setValue(orimat[0][1], orimat[1][1], orimat[2][1]); - if (MT_abs(vect.dot(ori)) > 1.0-3.0*MT_EPSILON) - ori.setValue(orimat[0][0], orimat[1][0], orimat[2][0]); - if (fac == 1.0) { - z = vect; - } else { - z = (vect * fac) + ((orimat * MT_Vector3(0.0, 0.0, 1.0)) * (1-fac)); - len = z.length(); - if (MT_fuzzyZero(len)) z = vect; - else z /= len; - } - x = ori.cross(z); - y = z.cross(x); - break; - default: //wrong input? - cout << "alignAxisToVect(): Wrong axis '" << axis <<"'\n"; - return; - } - x.normalize(); //normalize the vectors - y.normalize(); - z.normalize(); - orimat.setValue( x[0],y[0],z[0], - x[1],y[1],z[1], - x[2],y[2],z[2]); - if (GetSGNode()->GetSGParent() != NULL) - { - // the object is a child, adapt its local orientation so that - // the global orientation is aligned as we want. - MT_Matrix3x3 invori = GetSGNode()->GetSGParent()->GetWorldOrientation().inverse(); - NodeSetLocalOrientation(invori*orimat); - } - else - NodeSetLocalOrientation(orimat); -} - -MT_Scalar KX_GameObject::GetMass() -{ - if (m_pPhysicsController1) - { - return m_pPhysicsController1->GetMass(); - } - return 0.0; -} - -MT_Vector3 KX_GameObject::GetLocalInertia() -{ - MT_Vector3 local_inertia(0.0,0.0,0.0); - if (m_pPhysicsController1) - { - local_inertia = m_pPhysicsController1->GetLocalInertia(); - } - return local_inertia; -} - -MT_Vector3 KX_GameObject::GetLinearVelocity(bool local) -{ - MT_Vector3 velocity(0.0,0.0,0.0), locvel; - MT_Matrix3x3 ori; - if (m_pPhysicsController1) - { - velocity = m_pPhysicsController1->GetLinearVelocity(); - - if (local) - { - ori = GetSGNode()->GetWorldOrientation(); - - locvel = velocity * ori; - return locvel; - } - } - return velocity; -} - -MT_Vector3 KX_GameObject::GetAngularVelocity(bool local) -{ - MT_Vector3 velocity(0.0,0.0,0.0), locvel; - MT_Matrix3x3 ori; - if (m_pPhysicsController1) - { - velocity = m_pPhysicsController1->GetAngularVelocity(); - - if (local) - { - ori = GetSGNode()->GetWorldOrientation(); - - locvel = velocity * ori; - return locvel; - } - } - return velocity; -} - -MT_Vector3 KX_GameObject::GetVelocity(const MT_Point3& point) -{ - if (m_pPhysicsController1) - { - return m_pPhysicsController1->GetVelocity(point); - } - return MT_Vector3(0.0,0.0,0.0); -} - -// scenegraph node stuff - -void KX_GameObject::NodeSetLocalPosition(const MT_Point3& trans) -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (!GetSGNode()) - return; - - if (m_pPhysicsController1 && !GetSGNode()->GetSGParent()) - { - // don't update physic controller if the object is a child: - // 1) the transformation will not be right - // 2) in this case, the physic controller is necessarily a static object - // that is updated from the normal kinematic synchronization - m_pPhysicsController1->setPosition(trans); - } - - GetSGNode()->SetLocalPosition(trans); - -} - - - -void KX_GameObject::NodeSetLocalOrientation(const MT_Matrix3x3& rot) -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (!GetSGNode()) - return; - - if (m_pPhysicsController1 && !GetSGNode()->GetSGParent()) - { - // see note above - m_pPhysicsController1->setOrientation(rot); - } - GetSGNode()->SetLocalOrientation(rot); -} - -void KX_GameObject::NodeSetGlobalOrientation(const MT_Matrix3x3& rot) -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (!GetSGNode()) - return; - - if (GetSGNode()->GetSGParent()) - GetSGNode()->SetLocalOrientation(GetSGNode()->GetSGParent()->GetWorldOrientation().inverse()*rot); - else - GetSGNode()->SetLocalOrientation(rot); -} - -void KX_GameObject::NodeSetLocalScale(const MT_Vector3& scale) -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (!GetSGNode()) - return; - - if (m_pPhysicsController1 && !GetSGNode()->GetSGParent()) - { - // see note above - m_pPhysicsController1->setScaling(scale); - } - GetSGNode()->SetLocalScale(scale); -} - - - -void KX_GameObject::NodeSetRelativeScale(const MT_Vector3& scale) -{ - if (GetSGNode()) - { - GetSGNode()->RelativeScale(scale); - if (m_pPhysicsController1 && (!GetSGNode()->GetSGParent())) - { - // see note above - // we can use the local scale: it's the same thing for a root object - // and the world scale is not yet updated - MT_Vector3 newscale = GetSGNode()->GetLocalScale(); - m_pPhysicsController1->setScaling(newscale); - } - } -} - -void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans) -{ - if (!GetSGNode()) - return; - SG_Node* parent = GetSGNode()->GetSGParent(); - if (parent != NULL) - { - // Make sure the objects have some scale - MT_Vector3 scale = parent->GetWorldScaling(); - if (fabs(scale[0]) < FLT_EPSILON || - fabs(scale[1]) < FLT_EPSILON || - fabs(scale[2]) < FLT_EPSILON) - { - return; - } - scale[0] = 1.0/scale[0]; - scale[1] = 1.0/scale[1]; - scale[2] = 1.0/scale[2]; - MT_Matrix3x3 invori = parent->GetWorldOrientation().inverse(); - MT_Vector3 newpos = invori*(trans-parent->GetWorldPosition())*scale; - NodeSetLocalPosition(MT_Point3(newpos[0],newpos[1],newpos[2])); - } - else - { - NodeSetLocalPosition(trans); - } -} - - -void KX_GameObject::NodeUpdateGS(double time) -{ - if (GetSGNode()) - GetSGNode()->UpdateWorldData(time); -} - - - -const MT_Matrix3x3& KX_GameObject::NodeGetWorldOrientation() const -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (!GetSGNode()) - return dummy_orientation; - return GetSGNode()->GetWorldOrientation(); -} - -const MT_Matrix3x3& KX_GameObject::NodeGetLocalOrientation() const -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (!GetSGNode()) - return dummy_orientation; - return GetSGNode()->GetLocalOrientation(); -} - -const MT_Vector3& KX_GameObject::NodeGetWorldScaling() const -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (!GetSGNode()) - return dummy_scaling; - - return GetSGNode()->GetWorldScaling(); -} - -const MT_Vector3& KX_GameObject::NodeGetLocalScaling() const -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (!GetSGNode()) - return dummy_scaling; - - return GetSGNode()->GetLocalScale(); -} - -const MT_Point3& KX_GameObject::NodeGetWorldPosition() const -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (GetSGNode()) - return GetSGNode()->GetWorldPosition(); - else - return dummy_point; -} - -const MT_Point3& KX_GameObject::NodeGetLocalPosition() const -{ - // check on valid node in case a python controller holds a reference to a deleted object - if (GetSGNode()) - return GetSGNode()->GetLocalPosition(); - else - return dummy_point; -} - - -/* Suspend/ resume: for the dynamic behaviour, there is a simple - * method. For the residual motion, there is not. I wonder what the - * correct solution is for Sumo. Remove from the motion-update tree? - * - * So far, only switch the physics and logic. - * */ - -void KX_GameObject::Resume(void) -{ - if (m_suspended) { - SCA_IObject::Resume(); - if(GetPhysicsController()) - GetPhysicsController()->RestoreDynamics(); - - m_suspended = false; - } -} - -void KX_GameObject::Suspend() -{ - if ((!m_ignore_activity_culling) - && (!m_suspended)) { - SCA_IObject::Suspend(); - if(GetPhysicsController()) - GetPhysicsController()->SuspendDynamics(); - m_suspended = true; - } -} - -static void walk_children(SG_Node* node, CListValue* list, bool recursive) -{ - if (!node) - return; - NodeList& children = node->GetSGChildren(); - - for (NodeList::iterator childit = children.begin();!(childit==children.end());++childit) - { - SG_Node* childnode = (*childit); - CValue* childobj = (CValue*)childnode->GetSGClientObject(); - if (childobj != NULL) // This is a GameObject - { - // add to the list - list->Add(childobj->AddRef()); - } - - // if the childobj is NULL then this may be an inverse parent link - // so a non recursive search should still look down this node. - if (recursive || childobj==NULL) { - walk_children(childnode, list, recursive); - } - } -} - -CListValue* KX_GameObject::GetChildren() -{ - CListValue* list = new CListValue(); - walk_children(GetSGNode(), list, 0); /* GetSGNode() is always valid or it would have raised an exception before this */ - return list; -} - -CListValue* KX_GameObject::GetChildrenRecursive() -{ - CListValue* list = new CListValue(); - walk_children(GetSGNode(), list, 1); - return list; -} - -/* --------------------------------------------------------------------- - * Some stuff taken from the header - * --------------------------------------------------------------------- */ -void KX_GameObject::Relink(GEN_Map *map_parameter) -{ - // we will relink the sensors and actuators that use object references - // if the object is part of the replicated hierarchy, use the new - // object reference instead - SCA_SensorList& sensorlist = GetSensors(); - SCA_SensorList::iterator sit; - for (sit=sensorlist.begin(); sit != sensorlist.end(); sit++) - { - (*sit)->Relink(map_parameter); - } - SCA_ActuatorList& actuatorlist = GetActuators(); - SCA_ActuatorList::iterator ait; - for (ait=actuatorlist.begin(); ait != actuatorlist.end(); ait++) - { - (*ait)->Relink(map_parameter); - } -} - -#ifdef USE_MATHUTILS - -/* These require an SGNode */ -#define MATHUTILS_VEC_CB_POS_LOCAL 1 -#define MATHUTILS_VEC_CB_POS_GLOBAL 2 -#define MATHUTILS_VEC_CB_SCALE_LOCAL 3 -#define MATHUTILS_VEC_CB_SCALE_GLOBAL 4 -#define MATHUTILS_VEC_CB_INERTIA_LOCAL 5 -#define MATHUTILS_VEC_CB_OBJECT_COLOR 6 -#define MATHUTILS_VEC_CB_LINVEL_LOCAL 7 -#define MATHUTILS_VEC_CB_LINVEL_GLOBAL 8 -#define MATHUTILS_VEC_CB_ANGVEL_LOCAL 9 -#define MATHUTILS_VEC_CB_ANGVEL_GLOBAL 10 - -static int mathutils_kxgameob_vector_cb_index= -1; /* index for our callbacks */ - -static int mathutils_kxgameob_generic_check(BaseMathObject *bmo) -{ - KX_GameObject* self= static_castBGE_PROXY_REF(bmo->cb_user); - if(self==NULL) - return 0; - - return 1; -} - -static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype) -{ - KX_GameObject* self= static_castBGE_PROXY_REF(bmo->cb_user); - if(self==NULL) - return 0; - - switch(subtype) { - case MATHUTILS_VEC_CB_POS_LOCAL: - self->NodeGetLocalPosition().getValue(bmo->data); - break; - case MATHUTILS_VEC_CB_POS_GLOBAL: - self->NodeGetWorldPosition().getValue(bmo->data); - break; - case MATHUTILS_VEC_CB_SCALE_LOCAL: - self->NodeGetLocalScaling().getValue(bmo->data); - break; - case MATHUTILS_VEC_CB_SCALE_GLOBAL: - self->NodeGetWorldScaling().getValue(bmo->data); - break; - case MATHUTILS_VEC_CB_INERTIA_LOCAL: - if(!self->GetPhysicsController()) return 0; - self->GetPhysicsController()->GetLocalInertia().getValue(bmo->data); - break; - case MATHUTILS_VEC_CB_OBJECT_COLOR: - self->GetObjectColor().getValue(bmo->data); - break; - case MATHUTILS_VEC_CB_LINVEL_LOCAL: - if(!self->GetPhysicsController()) return 0; - self->GetLinearVelocity(true).getValue(bmo->data); - break; - case MATHUTILS_VEC_CB_LINVEL_GLOBAL: - if(!self->GetPhysicsController()) return 0; - self->GetLinearVelocity(false).getValue(bmo->data); - break; - case MATHUTILS_VEC_CB_ANGVEL_LOCAL: - if(!self->GetPhysicsController()) return 0; - self->GetAngularVelocity(true).getValue(bmo->data); - break; - case MATHUTILS_VEC_CB_ANGVEL_GLOBAL: - if(!self->GetPhysicsController()) return 0; - self->GetAngularVelocity(false).getValue(bmo->data); - break; - - } - - return 1; -} - -static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype) -{ - KX_GameObject* self= static_castBGE_PROXY_REF(bmo->cb_user); - if(self==NULL) - return 0; - - switch(subtype) { - case MATHUTILS_VEC_CB_POS_LOCAL: - self->NodeSetLocalPosition(MT_Point3(bmo->data)); - self->NodeUpdateGS(0.f); - break; - case MATHUTILS_VEC_CB_POS_GLOBAL: - self->NodeSetWorldPosition(MT_Point3(bmo->data)); - self->NodeUpdateGS(0.f); - break; - case MATHUTILS_VEC_CB_SCALE_LOCAL: - self->NodeSetLocalScale(MT_Point3(bmo->data)); - self->NodeUpdateGS(0.f); - break; - case MATHUTILS_VEC_CB_SCALE_GLOBAL: - break; - case MATHUTILS_VEC_CB_INERTIA_LOCAL: - /* read only */ - break; - case MATHUTILS_VEC_CB_OBJECT_COLOR: - self->SetObjectColor(MT_Vector4(bmo->data)); - break; - case MATHUTILS_VEC_CB_LINVEL_LOCAL: - self->setLinearVelocity(MT_Point3(bmo->data),true); - break; - case MATHUTILS_VEC_CB_LINVEL_GLOBAL: - self->setLinearVelocity(MT_Point3(bmo->data),false); - break; - case MATHUTILS_VEC_CB_ANGVEL_LOCAL: - self->setAngularVelocity(MT_Point3(bmo->data),true); - break; - case MATHUTILS_VEC_CB_ANGVEL_GLOBAL: - self->setAngularVelocity(MT_Point3(bmo->data),false); - break; - } - - return 1; -} - -static int mathutils_kxgameob_vector_get_index(BaseMathObject *bmo, int subtype, int index) -{ - /* lazy, avoid repeteing the case statement */ - if(!mathutils_kxgameob_vector_get(bmo, subtype)) - return 0; - return 1; -} - -static int mathutils_kxgameob_vector_set_index(BaseMathObject *bmo, int subtype, int index) -{ - float f= bmo->data[index]; - - /* lazy, avoid repeteing the case statement */ - if(!mathutils_kxgameob_vector_get(bmo, subtype)) - return 0; - - bmo->data[index]= f; - mathutils_kxgameob_vector_set(bmo, subtype); - - return 1; -} - -Mathutils_Callback mathutils_kxgameob_vector_cb = { - mathutils_kxgameob_generic_check, - mathutils_kxgameob_vector_get, - mathutils_kxgameob_vector_set, - mathutils_kxgameob_vector_get_index, - mathutils_kxgameob_vector_set_index -}; - -/* Matrix */ -#define MATHUTILS_MAT_CB_ORI_LOCAL 1 -#define MATHUTILS_MAT_CB_ORI_GLOBAL 2 - -static int mathutils_kxgameob_matrix_cb_index= -1; /* index for our callbacks */ - -static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype) -{ - KX_GameObject* self= static_castBGE_PROXY_REF(bmo->cb_user); - if(self==NULL) - return 0; - - switch(subtype) { - case MATHUTILS_MAT_CB_ORI_LOCAL: - self->NodeGetLocalOrientation().getValue3x3(bmo->data); - break; - case MATHUTILS_MAT_CB_ORI_GLOBAL: - self->NodeGetWorldOrientation().getValue3x3(bmo->data); - break; - } - - return 1; -} - - -static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype) -{ - KX_GameObject* self= static_castBGE_PROXY_REF(bmo->cb_user); - if(self==NULL) - return 0; - - MT_Matrix3x3 mat3x3; - switch(subtype) { - case MATHUTILS_MAT_CB_ORI_LOCAL: - mat3x3.setValue3x3(bmo->data); - self->NodeSetLocalOrientation(mat3x3); - self->NodeUpdateGS(0.f); - break; - case MATHUTILS_MAT_CB_ORI_GLOBAL: - mat3x3.setValue3x3(bmo->data); - self->NodeSetLocalOrientation(mat3x3); - self->NodeUpdateGS(0.f); - break; - } - - return 1; -} - -Mathutils_Callback mathutils_kxgameob_matrix_cb = { - mathutils_kxgameob_generic_check, - mathutils_kxgameob_matrix_get, - mathutils_kxgameob_matrix_set, - NULL, - NULL -}; - - -void KX_GameObject_Mathutils_Callback_Init(void) -{ - // register mathutils callbacks, ok to run more then once. - mathutils_kxgameob_vector_cb_index= Mathutils_RegisterCallback(&mathutils_kxgameob_vector_cb); - mathutils_kxgameob_matrix_cb_index= Mathutils_RegisterCallback(&mathutils_kxgameob_matrix_cb); -} - -#endif // USE_MATHUTILS - -#ifndef DISABLE_PYTHON -/* ------- python stuff ---------------------------------------------------*/ -PyMethodDef KX_GameObject::Methods[] = { - {"applyForce", (PyCFunction) KX_GameObject::sPyApplyForce, METH_VARARGS}, - {"applyTorque", (PyCFunction) KX_GameObject::sPyApplyTorque, METH_VARARGS}, - {"applyRotation", (PyCFunction) KX_GameObject::sPyApplyRotation, METH_VARARGS}, - {"applyMovement", (PyCFunction) KX_GameObject::sPyApplyMovement, METH_VARARGS}, - {"getLinearVelocity", (PyCFunction) KX_GameObject::sPyGetLinearVelocity, METH_VARARGS}, - {"setLinearVelocity", (PyCFunction) KX_GameObject::sPySetLinearVelocity, METH_VARARGS}, - {"getAngularVelocity", (PyCFunction) KX_GameObject::sPyGetAngularVelocity, METH_VARARGS}, - {"setAngularVelocity", (PyCFunction) KX_GameObject::sPySetAngularVelocity, METH_VARARGS}, - {"getVelocity", (PyCFunction) KX_GameObject::sPyGetVelocity, METH_VARARGS}, - {"getReactionForce", (PyCFunction) KX_GameObject::sPyGetReactionForce, METH_NOARGS}, - {"alignAxisToVect",(PyCFunction) KX_GameObject::sPyAlignAxisToVect, METH_VARARGS}, - {"getAxisVect",(PyCFunction) KX_GameObject::sPyGetAxisVect, METH_O}, - {"suspendDynamics", (PyCFunction)KX_GameObject::sPySuspendDynamics,METH_NOARGS}, - {"restoreDynamics", (PyCFunction)KX_GameObject::sPyRestoreDynamics,METH_NOARGS}, - {"enableRigidBody", (PyCFunction)KX_GameObject::sPyEnableRigidBody,METH_NOARGS}, - {"disableRigidBody", (PyCFunction)KX_GameObject::sPyDisableRigidBody,METH_NOARGS}, - {"applyImpulse", (PyCFunction) KX_GameObject::sPyApplyImpulse, METH_VARARGS}, - {"setCollisionMargin", (PyCFunction) KX_GameObject::sPySetCollisionMargin, METH_O}, - {"setParent", (PyCFunction)KX_GameObject::sPySetParent,METH_VARARGS}, - {"setVisible",(PyCFunction) KX_GameObject::sPySetVisible, METH_VARARGS}, - {"setOcclusion",(PyCFunction) KX_GameObject::sPySetOcclusion, METH_VARARGS}, - {"removeParent", (PyCFunction)KX_GameObject::sPyRemoveParent,METH_NOARGS}, - - - {"getPhysicsId", (PyCFunction)KX_GameObject::sPyGetPhysicsId,METH_NOARGS}, - {"getPropertyNames", (PyCFunction)KX_GameObject::sPyGetPropertyNames,METH_NOARGS}, - {"replaceMesh",(PyCFunction) KX_GameObject::sPyReplaceMesh, METH_VARARGS}, - {"endObject",(PyCFunction) KX_GameObject::sPyEndObject, METH_NOARGS}, - {"reinstancePhysicsMesh", (PyCFunction)KX_GameObject::sPyReinstancePhysicsMesh,METH_VARARGS}, - - KX_PYMETHODTABLE(KX_GameObject, rayCastTo), - KX_PYMETHODTABLE(KX_GameObject, rayCast), - KX_PYMETHODTABLE_O(KX_GameObject, getDistanceTo), - KX_PYMETHODTABLE_O(KX_GameObject, getVectTo), - KX_PYMETHODTABLE(KX_GameObject, sendMessage), - - // dict style access for props - {"get",(PyCFunction) KX_GameObject::sPyget, METH_VARARGS}, - - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_GameObject::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("name", KX_GameObject, pyattr_get_name), - KX_PYATTRIBUTE_RO_FUNCTION("parent", KX_GameObject, pyattr_get_parent), - KX_PYATTRIBUTE_RW_FUNCTION("mass", KX_GameObject, pyattr_get_mass, pyattr_set_mass), - KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMin", KX_GameObject, pyattr_get_lin_vel_min, pyattr_set_lin_vel_min), - KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMax", KX_GameObject, pyattr_get_lin_vel_max, pyattr_set_lin_vel_max), - KX_PYATTRIBUTE_RW_FUNCTION("visible", KX_GameObject, pyattr_get_visible, pyattr_set_visible), - KX_PYATTRIBUTE_BOOL_RW ("occlusion", KX_GameObject, m_bOccluder), - KX_PYATTRIBUTE_RW_FUNCTION("position", KX_GameObject, pyattr_get_worldPosition, pyattr_set_localPosition), - KX_PYATTRIBUTE_RO_FUNCTION("localInertia", KX_GameObject, pyattr_get_localInertia), - KX_PYATTRIBUTE_RW_FUNCTION("orientation",KX_GameObject,pyattr_get_worldOrientation,pyattr_set_localOrientation), - KX_PYATTRIBUTE_RW_FUNCTION("scaling", KX_GameObject, pyattr_get_worldScaling, pyattr_set_localScaling), - KX_PYATTRIBUTE_RW_FUNCTION("timeOffset",KX_GameObject, pyattr_get_timeOffset,pyattr_set_timeOffset), - KX_PYATTRIBUTE_RW_FUNCTION("state", KX_GameObject, pyattr_get_state, pyattr_set_state), - KX_PYATTRIBUTE_RO_FUNCTION("meshes", KX_GameObject, pyattr_get_meshes), - KX_PYATTRIBUTE_RW_FUNCTION("localOrientation",KX_GameObject,pyattr_get_localOrientation,pyattr_set_localOrientation), - KX_PYATTRIBUTE_RW_FUNCTION("worldOrientation",KX_GameObject,pyattr_get_worldOrientation,pyattr_set_worldOrientation), - KX_PYATTRIBUTE_RW_FUNCTION("localPosition", KX_GameObject, pyattr_get_localPosition, pyattr_set_localPosition), - KX_PYATTRIBUTE_RW_FUNCTION("worldPosition", KX_GameObject, pyattr_get_worldPosition, pyattr_set_worldPosition), - KX_PYATTRIBUTE_RW_FUNCTION("localScale", KX_GameObject, pyattr_get_localScaling, pyattr_set_localScaling), - KX_PYATTRIBUTE_RO_FUNCTION("worldScale", KX_GameObject, pyattr_get_worldScaling), - KX_PYATTRIBUTE_RW_FUNCTION("linearVelocity", KX_GameObject, pyattr_get_localLinearVelocity, pyattr_set_worldLinearVelocity), - KX_PYATTRIBUTE_RW_FUNCTION("localLinearVelocity", KX_GameObject, pyattr_get_localLinearVelocity, pyattr_set_localLinearVelocity), - KX_PYATTRIBUTE_RW_FUNCTION("worldLinearVelocity", KX_GameObject, pyattr_get_worldLinearVelocity, pyattr_set_worldLinearVelocity), - KX_PYATTRIBUTE_RW_FUNCTION("angularVelocity", KX_GameObject, pyattr_get_localAngularVelocity, pyattr_set_worldAngularVelocity), - KX_PYATTRIBUTE_RW_FUNCTION("localAngularVelocity", KX_GameObject, pyattr_get_localAngularVelocity, pyattr_set_localAngularVelocity), - KX_PYATTRIBUTE_RW_FUNCTION("worldAngularVelocity", KX_GameObject, pyattr_get_worldAngularVelocity, pyattr_set_worldAngularVelocity), - KX_PYATTRIBUTE_RO_FUNCTION("children", KX_GameObject, pyattr_get_children), - KX_PYATTRIBUTE_RO_FUNCTION("childrenRecursive", KX_GameObject, pyattr_get_children_recursive), - KX_PYATTRIBUTE_RO_FUNCTION("attrDict", KX_GameObject, pyattr_get_attrDict), - KX_PYATTRIBUTE_RW_FUNCTION("color", KX_GameObject, pyattr_get_obcolor, pyattr_set_obcolor), - - /* Experemental, dont rely on these yet */ - KX_PYATTRIBUTE_RO_FUNCTION("sensors", KX_GameObject, pyattr_get_sensors), - KX_PYATTRIBUTE_RO_FUNCTION("controllers", KX_GameObject, pyattr_get_controllers), - KX_PYATTRIBUTE_RO_FUNCTION("actuators", KX_GameObject, pyattr_get_actuators), - {NULL} //Sentinel -}; - -PyObject* KX_GameObject::PyReplaceMesh(PyObject* args) -{ - KX_Scene *scene = KX_GetActiveScene(); - - PyObject *value; - int use_gfx= 1, use_phys= 0; - RAS_MeshObject *new_mesh; - - if (!PyArg_ParseTuple(args,"O|ii:replaceMesh", &value, &use_gfx, &use_phys)) - return NULL; - - if (!ConvertPythonToMesh(value, &new_mesh, false, "gameOb.replaceMesh(value): KX_GameObject")) - return NULL; - - scene->ReplaceMesh(this, new_mesh, (bool)use_gfx, (bool)use_phys); - Py_RETURN_NONE; -} - -PyObject* KX_GameObject::PyEndObject() -{ - KX_Scene *scene = KX_GetActiveScene(); - - scene->DelayedRemoveObject(this); - - Py_RETURN_NONE; - -} - -PyObject* KX_GameObject::PyReinstancePhysicsMesh(PyObject* args) -{ - KX_GameObject *gameobj= NULL; - RAS_MeshObject *mesh= NULL; - - PyObject *gameobj_py= NULL; - PyObject *mesh_py= NULL; - - if ( !PyArg_ParseTuple(args,"|OO:reinstancePhysicsMesh",&gameobj_py, &mesh_py) || - (gameobj_py && !ConvertPythonToGameObject(gameobj_py, &gameobj, true, "gameOb.reinstancePhysicsMesh(obj, mesh): KX_GameObject")) || - (mesh_py && !ConvertPythonToMesh(mesh_py, &mesh, true, "gameOb.reinstancePhysicsMesh(obj, mesh): KX_GameObject")) - ) { - return NULL; - } - - /* gameobj and mesh can be NULL */ - if(KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh)) - Py_RETURN_TRUE; - - Py_RETURN_FALSE; -} - -static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) -{ - KX_GameObject* self= static_castBGE_PROXY_REF(self_v); - const char *attr_str= _PyUnicode_AsString(item); - CValue* resultattr; - PyObject* pyconvert; - - if (self==NULL) { - PyErr_SetString(PyExc_SystemError, "val = gameOb[key]: KX_GameObject, "BGE_PROXY_ERROR_MSG); - return NULL; - } - - /* first see if the attributes a string and try get the cvalue attribute */ - if(attr_str && (resultattr=self->GetProperty(attr_str))) { - pyconvert = resultattr->ConvertValueToPython(); - return pyconvert ? pyconvert:resultattr->GetProxy(); - } - /* no CValue attribute, try get the python only m_attr_dict attribute */ - else if (self->m_attr_dict && (pyconvert=PyDict_GetItem(self->m_attr_dict, item))) { - - if (attr_str) - PyErr_Clear(); - Py_INCREF(pyconvert); - return pyconvert; - } - else { - if(attr_str) PyErr_Format(PyExc_KeyError, "value = gameOb[key]: KX_GameObject, key \"%s\" does not exist", attr_str); - else PyErr_SetString(PyExc_KeyError, "value = gameOb[key]: KX_GameObject, key does not exist"); - return NULL; - } - -} - - -static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) -{ - KX_GameObject* self= static_castBGE_PROXY_REF(self_v); - const char *attr_str= _PyUnicode_AsString(key); - if(attr_str==NULL) - PyErr_Clear(); - - if (self==NULL) { - PyErr_SetString(PyExc_SystemError, "gameOb[key] = value: KX_GameObject, "BGE_PROXY_ERROR_MSG); - return -1; - } - - if (val==NULL) { /* del ob["key"] */ - int del= 0; - - /* try remove both just incase */ - if(attr_str) - del |= (self->RemoveProperty(attr_str)==true) ? 1:0; - - if(self->m_attr_dict) - del |= (PyDict_DelItem(self->m_attr_dict, key)==0) ? 1:0; - - if (del==0) { - if(attr_str) PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" could not be set", attr_str); - else PyErr_SetString(PyExc_KeyError, "del gameOb[key]: KX_GameObject, key could not be deleted"); - return -1; - } - else if (self->m_attr_dict) { - PyErr_Clear(); /* PyDict_DelItem sets an error when it fails */ - } - } - else { /* ob["key"] = value */ - int set= 0; - - /* as CValue */ - if(attr_str && PyObject_TypeCheck(val, &PyObjectPlus::Type)==0) /* dont allow GameObjects for eg to be assigned to CValue props */ - { - CValue* vallie = self->ConvertPythonToValue(val, ""); /* error unused */ - - if(vallie) - { - CValue* oldprop = self->GetProperty(attr_str); - - if (oldprop) - oldprop->SetValue(vallie); - else - self->SetProperty(attr_str, vallie); - - vallie->Release(); - set= 1; - - /* try remove dict value to avoid double ups */ - if (self->m_attr_dict){ - if (PyDict_DelItem(self->m_attr_dict, key) != 0) - PyErr_Clear(); - } - } - else { - PyErr_Clear(); - } - } - - if(set==0) - { - if (self->m_attr_dict==NULL) /* lazy init */ - self->m_attr_dict= PyDict_New(); - - - if(PyDict_SetItem(self->m_attr_dict, key, val)==0) - { - if(attr_str) - self->RemoveProperty(attr_str); /* overwrite the CValue if it exists */ - set= 1; - } - else { - if(attr_str) PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" not be added to internal dictionary", attr_str); - else PyErr_SetString(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key not be added to internal dictionary"); - } - } - - if(set==0) - return -1; /* pythons error value */ - - } - - return 0; /* success */ -} - -static int Seq_Contains(PyObject *self_v, PyObject *value) -{ - KX_GameObject* self= static_castBGE_PROXY_REF(self_v); - - if (self==NULL) { - PyErr_SetString(PyExc_SystemError, "val in gameOb: KX_GameObject, "BGE_PROXY_ERROR_MSG); - return -1; - } - - if(PyUnicode_Check(value) && self->GetProperty(_PyUnicode_AsString(value))) - return 1; - - if (self->m_attr_dict && PyDict_GetItem(self->m_attr_dict, value)) - return 1; - - return 0; -} - - -PyMappingMethods KX_GameObject::Mapping = { - (lenfunc)NULL , /*inquiry mp_length */ - (binaryfunc)Map_GetItem, /*binaryfunc mp_subscript */ - (objobjargproc)Map_SetItem, /*objobjargproc mp_ass_subscript */ -}; - -PySequenceMethods KX_GameObject::Sequence = { - NULL, /* Cant set the len otherwise it can evaluate as false */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - NULL, /* sq_item */ - NULL, /* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* sq_ass_slice */ - (objobjproc)Seq_Contains, /* sq_contains */ - (binaryfunc) NULL, /* sq_inplace_concat */ - (ssizeargfunc) NULL, /* sq_inplace_repeat */ -}; - -PyTypeObject KX_GameObject::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_GameObject", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0, - &Sequence, - &Mapping, - 0,0,0, - NULL, - NULL, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IObject::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyObject* KX_GameObject::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - return PyUnicode_FromString(self->GetName().ReadPtr()); -} - -PyObject* KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - KX_GameObject* parent = self->GetParent(); - if (parent) { - parent->Release(); /* self->GetParent() AddRef's */ - return parent->GetProxy(); - } - Py_RETURN_NONE; -} - -PyObject* KX_GameObject::pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - KX_IPhysicsController *spc = self->GetPhysicsController(); - return PyFloat_FromDouble(spc ? spc->GetMass() : 0.0f); -} - -int KX_GameObject::pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - KX_IPhysicsController *spc = self->GetPhysicsController(); - MT_Scalar val = PyFloat_AsDouble(value); - if (val < 0.0f) { /* also accounts for non float */ - PyErr_SetString(PyExc_AttributeError, "gameOb.mass = float: KX_GameObject, expected a float zero or above"); - return PY_SET_ATTR_FAIL; - } - - if (spc) - spc->SetMass(val); - - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - KX_IPhysicsController *spc = self->GetPhysicsController(); - return PyFloat_FromDouble(spc ? spc->GetLinVelocityMax() : 0.0f); -} - -int KX_GameObject::pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - KX_IPhysicsController *spc = self->GetPhysicsController(); - MT_Scalar val = PyFloat_AsDouble(value); - if (val < 0.0f) { /* also accounts for non float */ - PyErr_SetString(PyExc_AttributeError, "gameOb.linVelocityMin = float: KX_GameObject, expected a float zero or above"); - return PY_SET_ATTR_FAIL; - } - - if (spc) - spc->SetLinVelocityMin(val); - - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - KX_IPhysicsController *spc = self->GetPhysicsController(); - return PyFloat_FromDouble(spc ? spc->GetLinVelocityMax() : 0.0f); -} - -int KX_GameObject::pyattr_set_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - KX_IPhysicsController *spc = self->GetPhysicsController(); - MT_Scalar val = PyFloat_AsDouble(value); - if (val < 0.0f) { /* also accounts for non float */ - PyErr_SetString(PyExc_AttributeError, "gameOb.linVelocityMax = float: KX_GameObject, expected a float zero or above"); - return PY_SET_ATTR_FAIL; - } - - if (spc) - spc->SetLinVelocityMax(val); - - return PY_SET_ATTR_SUCCESS; -} - - -PyObject* KX_GameObject::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - return PyBool_FromLong(self->GetVisible()); -} - -int KX_GameObject::pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - int param = PyObject_IsTrue( value ); - if (param == -1) { - PyErr_SetString(PyExc_AttributeError, "gameOb.visible = bool: KX_GameObject, expected True or False"); - return PY_SET_ATTR_FAIL; - } - - self->SetVisible(param, false); - self->UpdateBuckets(false); - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_GLOBAL); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(self->NodeGetWorldPosition()); -#endif -} - -int KX_GameObject::pyattr_set_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - MT_Point3 pos; - if (!PyVecTo(value, pos)) - return PY_SET_ATTR_FAIL; - - self->NodeSetWorldPosition(pos); - self->NodeUpdateGS(0.f); - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_POS_LOCAL); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(self->NodeGetLocalPosition()); -#endif -} - -int KX_GameObject::pyattr_set_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - MT_Point3 pos; - if (!PyVecTo(value, pos)) - return PY_SET_ATTR_FAIL; - - self->NodeSetLocalPosition(pos); - self->NodeUpdateGS(0.f); - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_INERTIA_LOCAL); -#else - KX_GameObject* self= static_cast(self_v); - if (self->GetPhysicsController()) - return PyObjectFrom(self->GetPhysicsController()->GetLocalInertia()); - return Py_BuildValue("fff", 0.0f, 0.0f, 0.0f); -#endif -} - -PyObject* KX_GameObject::pyattr_get_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newMatrixObject_cb(BGE_PROXY_FROM_REF(self_v), 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_GLOBAL); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(self->NodeGetWorldOrientation()); -#endif -} - -int KX_GameObject::pyattr_set_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - - /* if value is not a sequence PyOrientationTo makes an error */ - MT_Matrix3x3 rot; - if (!PyOrientationTo(value, rot, "gameOb.worldOrientation = sequence: KX_GameObject, ")) - return PY_SET_ATTR_FAIL; - - self->NodeSetGlobalOrientation(rot); - - self->NodeUpdateGS(0.f); - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newMatrixObject_cb(BGE_PROXY_FROM_REF(self_v), 3, 3, mathutils_kxgameob_matrix_cb_index, MATHUTILS_MAT_CB_ORI_LOCAL); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(self->NodeGetLocalOrientation()); -#endif -} - -int KX_GameObject::pyattr_set_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - - /* if value is not a sequence PyOrientationTo makes an error */ - MT_Matrix3x3 rot; - if (!PyOrientationTo(value, rot, "gameOb.localOrientation = sequence: KX_GameObject, ")) - return PY_SET_ATTR_FAIL; - - self->NodeSetLocalOrientation(rot); - self->NodeUpdateGS(0.f); - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_worldScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_GLOBAL); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(self->NodeGetWorldScaling()); -#endif -} - -PyObject* KX_GameObject::pyattr_get_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_SCALE_LOCAL); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(self->NodeGetLocalScaling()); -#endif -} - -int KX_GameObject::pyattr_set_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - MT_Vector3 scale; - if (!PyVecTo(value, scale)) - return PY_SET_ATTR_FAIL; - - self->NodeSetLocalScale(scale); - self->NodeUpdateGS(0.f); - return PY_SET_ATTR_SUCCESS; -} - - -PyObject* KX_GameObject::pyattr_get_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_LINVEL_GLOBAL); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(GetLinearVelocity(false)); -#endif -} - -int KX_GameObject::pyattr_set_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - MT_Vector3 velocity; - if (!PyVecTo(value, velocity)) - return PY_SET_ATTR_FAIL; - - self->setLinearVelocity(velocity, false); - - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_LINVEL_LOCAL); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(GetLinearVelocity(true)); -#endif -} - -int KX_GameObject::pyattr_set_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - MT_Vector3 velocity; - if (!PyVecTo(value, velocity)) - return PY_SET_ATTR_FAIL; - - self->setLinearVelocity(velocity, true); - - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_ANGVEL_GLOBAL); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(GetAngularVelocity(false)); -#endif -} - -int KX_GameObject::pyattr_set_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - MT_Vector3 velocity; - if (!PyVecTo(value, velocity)) - return PY_SET_ATTR_FAIL; - - self->setAngularVelocity(velocity, false); - - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_ANGVEL_LOCAL); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(GetAngularVelocity(true)); -#endif -} - -int KX_GameObject::pyattr_set_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - MT_Vector3 velocity; - if (!PyVecTo(value, velocity)) - return PY_SET_ATTR_FAIL; - - self->setAngularVelocity(velocity, true); - - return PY_SET_ATTR_SUCCESS; -} - - -PyObject* KX_GameObject::pyattr_get_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - SG_Node* sg_parent; - if (self->GetSGNode() && (sg_parent = self->GetSGNode()->GetSGParent()) != NULL && sg_parent->IsSlowParent()) { - return PyFloat_FromDouble(static_cast(sg_parent->GetParentRelation())->GetTimeOffset()); - } else { - return PyFloat_FromDouble(0.0); - } -} - -int KX_GameObject::pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - if (self->GetSGNode()) { - MT_Scalar val = PyFloat_AsDouble(value); - SG_Node* sg_parent= self->GetSGNode()->GetSGParent(); - if (val < 0.0f) { /* also accounts for non float */ - PyErr_SetString(PyExc_AttributeError, "gameOb.timeOffset = float: KX_GameObject, expected a float zero or above"); - return PY_SET_ATTR_FAIL; - } - if (sg_parent && sg_parent->IsSlowParent()) - static_cast(sg_parent->GetParentRelation())->SetTimeOffset(val); - } - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - int state = 0; - state |= self->GetState(); - return PyLong_FromSsize_t(state); -} - -int KX_GameObject::pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - int state_i = PyLong_AsSsize_t(value); - unsigned int state = 0; - - if (state_i == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "gameOb.state = int: KX_GameObject, expected an int bit field"); - return PY_SET_ATTR_FAIL; - } - - state |= state_i; - if ((state & ((1<<30)-1)) == 0) { - PyErr_SetString(PyExc_AttributeError, "gameOb.state = int: KX_GameObject, state bitfield was not between 0 and 30 (1<<0 and 1<<29)"); - return PY_SET_ATTR_FAIL; - } - self->SetState(state); - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_GameObject::pyattr_get_meshes(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - PyObject *meshes= PyList_New(self->m_meshes.size()); - int i; - - for(i=0; i < (int)self->m_meshes.size(); i++) - { - KX_MeshProxy* meshproxy = new KX_MeshProxy(self->m_meshes[i]); - PyList_SET_ITEM(meshes, i, meshproxy->NewProxy(true)); - } - - return meshes; -} - -PyObject* KX_GameObject::pyattr_get_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ -#ifdef USE_MATHUTILS - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 4, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_OBJECT_COLOR); -#else - KX_GameObject* self= static_cast(self_v); - return PyObjectFrom(self->GetObjectColor()); -#endif -} - -int KX_GameObject::pyattr_set_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_GameObject* self= static_cast(self_v); - MT_Vector4 obcolor; - if (!PyVecTo(value, obcolor)) - return PY_SET_ATTR_FAIL; - - self->SetObjectColor(obcolor); - return PY_SET_ATTR_SUCCESS; -} - -/* These are experimental! */ -PyObject* KX_GameObject::pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - return KX_PythonSeq_CreatePyObject((static_cast(self_v))->m_proxy, KX_PYGENSEQ_OB_TYPE_SENSORS); -} - -PyObject* KX_GameObject::pyattr_get_controllers(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - return KX_PythonSeq_CreatePyObject((static_cast(self_v))->m_proxy, KX_PYGENSEQ_OB_TYPE_CONTROLLERS); -} - -PyObject* KX_GameObject::pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - return KX_PythonSeq_CreatePyObject((static_cast(self_v))->m_proxy, KX_PYGENSEQ_OB_TYPE_ACTUATORS); -} -/* End experimental */ - -PyObject* KX_GameObject::pyattr_get_children(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - return self->GetChildren()->NewProxy(true); -} - -PyObject* KX_GameObject::pyattr_get_children_recursive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - return self->GetChildrenRecursive()->NewProxy(true); -} - -PyObject* KX_GameObject::pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_GameObject* self= static_cast(self_v); - - if(self->m_attr_dict==NULL) - self->m_attr_dict= PyDict_New(); - - Py_INCREF(self->m_attr_dict); - return self->m_attr_dict; -} - -PyObject* KX_GameObject::PyApplyForce(PyObject* args) -{ - int local = 0; - PyObject* pyvect; - - if (PyArg_ParseTuple(args, "O|i:applyForce", &pyvect, &local)) { - MT_Vector3 force; - if (PyVecTo(pyvect, force)) { - ApplyForce(force, (local!=0)); - Py_RETURN_NONE; - } - } - return NULL; -} - -PyObject* KX_GameObject::PyApplyTorque(PyObject* args) -{ - int local = 0; - PyObject* pyvect; - - if (PyArg_ParseTuple(args, "O|i:applyTorque", &pyvect, &local)) { - MT_Vector3 torque; - if (PyVecTo(pyvect, torque)) { - ApplyTorque(torque, (local!=0)); - Py_RETURN_NONE; - } - } - return NULL; -} - -PyObject* KX_GameObject::PyApplyRotation(PyObject* args) -{ - int local = 0; - PyObject* pyvect; - - if (PyArg_ParseTuple(args, "O|i:applyRotation", &pyvect, &local)) { - MT_Vector3 rotation; - if (PyVecTo(pyvect, rotation)) { - ApplyRotation(rotation, (local!=0)); - Py_RETURN_NONE; - } - } - return NULL; -} - -PyObject* KX_GameObject::PyApplyMovement(PyObject* args) -{ - int local = 0; - PyObject* pyvect; - - if (PyArg_ParseTuple(args, "O|i:applyMovement", &pyvect, &local)) { - MT_Vector3 movement; - if (PyVecTo(pyvect, movement)) { - ApplyMovement(movement, (local!=0)); - Py_RETURN_NONE; - } - } - return NULL; -} - -PyObject* KX_GameObject::PyGetLinearVelocity(PyObject* args) -{ - // only can get the velocity if we have a physics object connected to us... - int local = 0; - if (PyArg_ParseTuple(args,"|i:getLinearVelocity",&local)) - { - return PyObjectFrom(GetLinearVelocity((local!=0))); - } - else - { - return NULL; - } -} - -PyObject* KX_GameObject::PySetLinearVelocity(PyObject* args) -{ - int local = 0; - PyObject* pyvect; - - if (PyArg_ParseTuple(args,"O|i:setLinearVelocity",&pyvect,&local)) { - MT_Vector3 velocity; - if (PyVecTo(pyvect, velocity)) { - setLinearVelocity(velocity, (local!=0)); - Py_RETURN_NONE; - } - } - return NULL; -} - -PyObject* KX_GameObject::PyGetAngularVelocity(PyObject* args) -{ - // only can get the velocity if we have a physics object connected to us... - int local = 0; - if (PyArg_ParseTuple(args,"|i:getAngularVelocity",&local)) - { - return PyObjectFrom(GetAngularVelocity((local!=0))); - } - else - { - return NULL; - } -} - -PyObject* KX_GameObject::PySetAngularVelocity(PyObject* args) -{ - int local = 0; - PyObject* pyvect; - - if (PyArg_ParseTuple(args,"O|i:setAngularVelocity",&pyvect,&local)) { - MT_Vector3 velocity; - if (PyVecTo(pyvect, velocity)) { - setAngularVelocity(velocity, (local!=0)); - Py_RETURN_NONE; - } - } - return NULL; -} - -PyObject* KX_GameObject::PySetVisible(PyObject* args) -{ - int visible, recursive = 0; - if (!PyArg_ParseTuple(args,"i|i:setVisible",&visible, &recursive)) - return NULL; - - SetVisible(visible ? true:false, recursive ? true:false); - UpdateBuckets(recursive ? true:false); - Py_RETURN_NONE; - -} - -PyObject* KX_GameObject::PySetOcclusion(PyObject* args) -{ - int occlusion, recursive = 0; - if (!PyArg_ParseTuple(args,"i|i:setOcclusion",&occlusion, &recursive)) - return NULL; - - SetOccluder(occlusion ? true:false, recursive ? true:false); - Py_RETURN_NONE; -} - -PyObject* KX_GameObject::PyGetVelocity(PyObject* args) -{ - // only can get the velocity if we have a physics object connected to us... - MT_Point3 point(0.0,0.0,0.0); - PyObject* pypos = NULL; - - if (!PyArg_ParseTuple(args, "|O:getVelocity", &pypos) || (pypos && !PyVecTo(pypos, point))) - return NULL; - - if (m_pPhysicsController1) - { - return PyObjectFrom(m_pPhysicsController1->GetVelocity(point)); - } - else { - return PyObjectFrom(MT_Vector3(0.0,0.0,0.0)); - } -} - -PyObject* KX_GameObject::PyGetReactionForce() -{ - // only can get the velocity if we have a physics object connected to us... - - // XXX - Currently not working with bullet intergration, see KX_BulletPhysicsController.cpp's getReactionForce - /* - if (GetPhysicsController()) - return PyObjectFrom(GetPhysicsController()->getReactionForce()); - return PyObjectFrom(dummy_point); - */ - - return Py_BuildValue("fff", 0.0f, 0.0f, 0.0f); - -} - - - -PyObject* KX_GameObject::PyEnableRigidBody() -{ - if(GetPhysicsController()) - GetPhysicsController()->setRigidBody(true); - - Py_RETURN_NONE; -} - - - -PyObject* KX_GameObject::PyDisableRigidBody() -{ - if(GetPhysicsController()) - GetPhysicsController()->setRigidBody(false); - - Py_RETURN_NONE; -} - - -PyObject* KX_GameObject::PySetParent(PyObject* args) -{ - KX_Scene *scene = KX_GetActiveScene(); - PyObject* pyobj; - KX_GameObject *obj; - int addToCompound=1, ghost=1; - - if (!PyArg_ParseTuple(args,"O|ii:setParent", &pyobj, &addToCompound, &ghost)) { - return NULL; // Python sets a simple error - } - if (!ConvertPythonToGameObject(pyobj, &obj, true, "gameOb.setParent(obj): KX_GameObject")) - return NULL; - if (obj) - this->SetParent(scene, obj, addToCompound, ghost); - Py_RETURN_NONE; -} - -PyObject* KX_GameObject::PyRemoveParent() -{ - KX_Scene *scene = KX_GetActiveScene(); - - this->RemoveParent(scene); - Py_RETURN_NONE; -} - - -PyObject* KX_GameObject::PySetCollisionMargin(PyObject* value) -{ - float collisionMargin = PyFloat_AsDouble(value); - - if (collisionMargin==-1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "expected a float"); - return NULL; - } - - if (m_pPhysicsController1) - { - m_pPhysicsController1->setMargin(collisionMargin); - Py_RETURN_NONE; - } - PyErr_SetString(PyExc_RuntimeError, "This object has no physics controller"); - return NULL; -} - - - -PyObject* KX_GameObject::PyApplyImpulse(PyObject* args) -{ - PyObject* pyattach; - PyObject* pyimpulse; - - if (!m_pPhysicsController1) { - PyErr_SetString(PyExc_RuntimeError, "This object has no physics controller"); - return NULL; - } - - if (PyArg_ParseTuple(args, "OO:applyImpulse", &pyattach, &pyimpulse)) - { - MT_Point3 attach; - MT_Vector3 impulse; - if (PyVecTo(pyattach, attach) && PyVecTo(pyimpulse, impulse)) - { - m_pPhysicsController1->applyImpulse(attach, impulse); - Py_RETURN_NONE; - } - - } - - return NULL; -} - - - -PyObject* KX_GameObject::PySuspendDynamics() -{ - SuspendDynamics(); - Py_RETURN_NONE; -} - - - -PyObject* KX_GameObject::PyRestoreDynamics() -{ - RestoreDynamics(); - Py_RETURN_NONE; -} - - -PyObject* KX_GameObject::PyAlignAxisToVect(PyObject* args) -{ - PyObject* pyvect; - int axis = 2; //z axis is the default - float fac = 1.0; - - if (PyArg_ParseTuple(args,"O|if:alignAxisToVect",&pyvect,&axis, &fac)) - { - MT_Vector3 vect; - if (PyVecTo(pyvect, vect)) - { - if (fac<=0.0) Py_RETURN_NONE; // Nothing to do. - if (fac> 1.0) fac= 1.0; - - AlignAxisToVect(vect,axis,fac); - NodeUpdateGS(0.f); - Py_RETURN_NONE; - } - } - return NULL; -} - -PyObject* KX_GameObject::PyGetAxisVect(PyObject* value) -{ - MT_Vector3 vect; - if (PyVecTo(value, vect)) - { - return PyObjectFrom(NodeGetWorldOrientation() * vect); - } - return NULL; -} - - -PyObject* KX_GameObject::PyGetPhysicsId() -{ - KX_IPhysicsController* ctrl = GetPhysicsController(); - uint_ptr physid=0; - if (ctrl) - { - physid= (uint_ptr)ctrl->GetUserData(); - } - return PyLong_FromSsize_t((long)physid); -} - -PyObject* KX_GameObject::PyGetPropertyNames() -{ - PyObject *list= ConvertKeysToPython(); - - if(m_attr_dict) { - PyObject *key, *value; - Py_ssize_t pos = 0; - - while (PyDict_Next(m_attr_dict, &pos, &key, &value)) { - PyList_Append(list, key); - } - } - return list; -} - -KX_PYMETHODDEF_DOC_O(KX_GameObject, getDistanceTo, -"getDistanceTo(other): get distance to another point/KX_GameObject") -{ - MT_Point3 b; - if (PyVecTo(value, b)) - { - return PyFloat_FromDouble(NodeGetWorldPosition().distance(b)); - } - PyErr_Clear(); - - KX_GameObject *other; - if (ConvertPythonToGameObject(value, &other, false, "gameOb.getDistanceTo(value): KX_GameObject")) - { - return PyFloat_FromDouble(NodeGetWorldPosition().distance(other->NodeGetWorldPosition())); - } - - return NULL; -} - -KX_PYMETHODDEF_DOC_O(KX_GameObject, getVectTo, -"getVectTo(other): get vector and the distance to another point/KX_GameObject\n" -"Returns a 3-tuple with (distance,worldVector,localVector)\n") -{ - MT_Point3 toPoint, fromPoint; - MT_Vector3 toDir, locToDir; - MT_Scalar distance; - - PyObject *returnValue; - - if (!PyVecTo(value, toPoint)) - { - PyErr_Clear(); - - KX_GameObject *other; - if (ConvertPythonToGameObject(value, &other, false, "")) /* error will be overwritten */ - { - toPoint = other->NodeGetWorldPosition(); - } else - { - PyErr_SetString(PyExc_TypeError, "gameOb.getVectTo(other): KX_GameObject, expected a 3D Vector or KX_GameObject type"); - return NULL; - } - } - - fromPoint = NodeGetWorldPosition(); - toDir = toPoint-fromPoint; - distance = toDir.length(); - - if (MT_fuzzyZero(distance)) - { - //cout << "getVectTo() Error: Null vector!\n"; - locToDir = toDir = MT_Vector3(0.0,0.0,0.0); - distance = 0.0; - } else { - toDir.normalize(); - locToDir = toDir * NodeGetWorldOrientation(); - } - - returnValue = PyTuple_New(3); - if (returnValue) { // very unlikely to fail, python sets a memory error here. - PyTuple_SET_ITEM(returnValue, 0, PyFloat_FromDouble(distance)); - PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(toDir)); - PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(locToDir)); - } - return returnValue; -} - -bool KX_GameObject::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data) -{ - KX_GameObject* hitKXObj = client->m_gameobject; - - // if X-ray option is selected, the unwnted objects were not tested, so get here only with true hit - // if not, all objects were tested and the front one may not be the correct one. - if (m_xray || m_testPropName.Length() == 0 || hitKXObj->GetProperty(m_testPropName) != NULL) - { - m_pHitObject = hitKXObj; - return true; - } - // return true to stop RayCast::RayTest from looping, the above test was decisive - // We would want to loop only if we want to get more than one hit point - return true; -} - -/* this function is used to pre-filter the object before casting the ray on them. - This is useful for "X-Ray" option when we want to see "through" unwanted object. - */ -bool KX_GameObject::NeedRayCast(KX_ClientObjectInfo* client) -{ - KX_GameObject* hitKXObj = client->m_gameobject; - - if (client->m_type > KX_ClientObjectInfo::ACTOR) - { - // Unknown type of object, skip it. - // Should not occur as the sensor objects are filtered in RayTest() - printf("Invalid client type %d found in ray casting\n", client->m_type); - return false; - } - - // if X-Ray option is selected, skip object that don't match the criteria as we see through them - // if not, test all objects because we don't know yet which one will be on front - if (!m_xray || m_testPropName.Length() == 0 || hitKXObj->GetProperty(m_testPropName) != NULL) - { - return true; - } - // skip the object - return false; -} - -KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo, -"rayCastTo(other,dist,prop): look towards another point/KX_GameObject and return first object hit within dist that matches prop\n" -" prop = property name that object must have; can be omitted => detect any object\n" -" dist = max distance to look (can be negative => look behind); 0 or omitted => detect up to other\n" -" other = 3-tuple or object reference") -{ - MT_Point3 toPoint; - PyObject* pyarg; - float dist = 0.0f; - char *propName = NULL; - - if (!PyArg_ParseTuple(args,"O|fs:rayCastTo", &pyarg, &dist, &propName)) { - return NULL; // python sets simple error - } - - if (!PyVecTo(pyarg, toPoint)) - { - KX_GameObject *other; - PyErr_Clear(); - - if (ConvertPythonToGameObject(pyarg, &other, false, "")) /* error will be overwritten */ - { - toPoint = other->NodeGetWorldPosition(); - } else - { - PyErr_SetString(PyExc_TypeError, "gameOb.rayCastTo(other,dist,prop): KX_GameObject, the first argument to rayCastTo must be a vector or a KX_GameObject"); - return NULL; - } - } - MT_Point3 fromPoint = NodeGetWorldPosition(); - - if (dist != 0.0f) - toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized(); - - PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment(); - KX_IPhysicsController *spc = GetPhysicsController(); - KX_GameObject *parent = GetParent(); - if (!spc && parent) - spc = parent->GetPhysicsController(); - if (parent) - parent->Release(); - - m_pHitObject = NULL; - if (propName) - m_testPropName = propName; - else - m_testPropName.SetLength(0); - KX_RayCast::Callback callback(this,spc); - KX_RayCast::RayTest(pe, fromPoint, toPoint, callback); - - if (m_pHitObject) - return m_pHitObject->GetProxy(); - - Py_RETURN_NONE; -} - -/* faster then Py_BuildValue since some scripts call raycast a lot */ -static PyObject *none_tuple_3() -{ - PyObject *ret= PyTuple_New(3); - PyTuple_SET_ITEM(ret, 0, Py_None); - PyTuple_SET_ITEM(ret, 1, Py_None); - PyTuple_SET_ITEM(ret, 2, Py_None); - - Py_INCREF(Py_None); - Py_INCREF(Py_None); - Py_INCREF(Py_None); - return ret; -} -static PyObject *none_tuple_4() -{ - PyObject *ret= PyTuple_New(4); - PyTuple_SET_ITEM(ret, 0, Py_None); - PyTuple_SET_ITEM(ret, 1, Py_None); - PyTuple_SET_ITEM(ret, 2, Py_None); - PyTuple_SET_ITEM(ret, 3, Py_None); - - Py_INCREF(Py_None); - Py_INCREF(Py_None); - Py_INCREF(Py_None); - Py_INCREF(Py_None); - return ret; -} - -static PyObject *none_tuple_5() -{ - PyObject *ret= PyTuple_New(5); - PyTuple_SET_ITEM(ret, 0, Py_None); - PyTuple_SET_ITEM(ret, 1, Py_None); - PyTuple_SET_ITEM(ret, 2, Py_None); - PyTuple_SET_ITEM(ret, 3, Py_None); - PyTuple_SET_ITEM(ret, 4, Py_None); - - Py_INCREF(Py_None); - Py_INCREF(Py_None); - Py_INCREF(Py_None); - Py_INCREF(Py_None); - Py_INCREF(Py_None); - return ret; -} - -KX_PYMETHODDEF_DOC(KX_GameObject, rayCast, - "rayCast(to,from,dist,prop,face,xray,poly): cast a ray and return 3-tuple (object,hit,normal) or 4-tuple (object,hit,normal,polygon) or 4-tuple (object,hit,normal,polygon,hituv) of contact point with object within dist that matches prop.\n" - " If no hit, return (None,None,None) or (None,None,None,None) or (None,None,None,None,None).\n" -" to = 3-tuple or object reference for destination of ray (if object, use center of object)\n" -" from = 3-tuple or object reference for origin of ray (if object, use center of object)\n" -" Can be None or omitted => start from self object center\n" -" dist = max distance to look (can be negative => look behind); 0 or omitted => detect up to to\n" -" prop = property name that object must have; can be omitted => detect any object\n" -" face = normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin\n" -" xray = X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object\n" -" poly = polygon option: 1=>return value is a 4-tuple and the 4th element is a KX_PolyProxy object\n" -" which can be None if hit object has no mesh or if there is no hit\n" -" 2=>return value is a 5-tuple, the 4th element is the KX_PolyProxy object\n" -" and the 5th element is the vector of UV coordinates at the hit point of the None if there is no UV mapping\n" -" If 0 or omitted, return value is a 3-tuple\n" -"Note: The object on which you call this method matters: the ray will ignore it.\n" -" prop and xray option interact as follow:\n" -" prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray\n" -" prop off, xray on : idem\n" -" prop on, xray off: return closest hit if it matches prop, no hit otherwise\n" -" prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray\n") -{ - MT_Point3 toPoint; - MT_Point3 fromPoint; - PyObject* pyto; - PyObject* pyfrom = NULL; - float dist = 0.0f; - char *propName = NULL; - KX_GameObject *other; - int face=0, xray=0, poly=0; - - if (!PyArg_ParseTuple(args,"O|Ofsiii:rayCast", &pyto, &pyfrom, &dist, &propName, &face, &xray, &poly)) { - return NULL; // Python sets a simple error - } - - if (!PyVecTo(pyto, toPoint)) - { - PyErr_Clear(); - - if (ConvertPythonToGameObject(pyto, &other, false, "")) /* error will be overwritten */ - { - toPoint = other->NodeGetWorldPosition(); - } else - { - PyErr_SetString(PyExc_TypeError, "the first argument to rayCast must be a vector or a KX_GameObject"); - return NULL; - } - } - if (!pyfrom || pyfrom == Py_None) - { - fromPoint = NodeGetWorldPosition(); - } - else if (!PyVecTo(pyfrom, fromPoint)) - { - PyErr_Clear(); - - if (ConvertPythonToGameObject(pyfrom, &other, false, "")) /* error will be overwritten */ - { - fromPoint = other->NodeGetWorldPosition(); - } else - { - PyErr_SetString(PyExc_TypeError, "gameOb.rayCast(to,from,dist,prop,face,xray,poly): KX_GameObject, the second optional argument to rayCast must be a vector or a KX_GameObject"); - return NULL; - } - } - - if (dist != 0.0f) { - MT_Vector3 toDir = toPoint-fromPoint; - if (MT_fuzzyZero(toDir.length2())) { - //return Py_BuildValue("OOO", Py_None, Py_None, Py_None); - return none_tuple_3(); - } - toDir.normalize(); - toPoint = fromPoint + (dist) * toDir; - } else if (MT_fuzzyZero((toPoint-fromPoint).length2())) { - //return Py_BuildValue("OOO", Py_None, Py_None, Py_None); - return none_tuple_3(); - } - - PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment(); - KX_IPhysicsController *spc = GetPhysicsController(); - KX_GameObject *parent = GetParent(); - if (!spc && parent) - spc = parent->GetPhysicsController(); - if (parent) - parent->Release(); - - m_pHitObject = NULL; - if (propName) - m_testPropName = propName; - else - m_testPropName.SetLength(0); - m_xray = xray; - // to get the hit results - KX_RayCast::Callback callback(this,spc,NULL,face,(poly==2)); - KX_RayCast::RayTest(pe, fromPoint, toPoint, callback); - - if (m_pHitObject) - { - PyObject* returnValue = (poly==2) ? PyTuple_New(5) : (poly) ? PyTuple_New(4) : PyTuple_New(3); - if (returnValue) { // unlikely this would ever fail, if it does python sets an error - PyTuple_SET_ITEM(returnValue, 0, m_pHitObject->GetProxy()); - PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(callback.m_hitPoint)); - PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(callback.m_hitNormal)); - if (poly) - { - if (callback.m_hitMesh) - { - // if this field is set, then we can trust that m_hitPolygon is a valid polygon - RAS_Polygon* polygon = callback.m_hitMesh->GetPolygon(callback.m_hitPolygon); - KX_PolyProxy* polyproxy = new KX_PolyProxy(callback.m_hitMesh, polygon); - PyTuple_SET_ITEM(returnValue, 3, polyproxy->NewProxy(true)); - if (poly == 2) - { - if (callback.m_hitUVOK) - PyTuple_SET_ITEM(returnValue, 4, PyObjectFrom(callback.m_hitUV)); - else { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(returnValue, 4, Py_None); - } - } - } - else - { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(returnValue, 3, Py_None); - if (poly==2) - { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(returnValue, 4, Py_None); - } - } - } - } - return returnValue; - } - // no hit - if (poly == 2) - return none_tuple_5(); - else if (poly) - return none_tuple_4(); - else - return none_tuple_3(); -} - -KX_PYMETHODDEF_DOC_VARARGS(KX_GameObject, sendMessage, - "sendMessage(subject, [body, to])\n" -"sends a message in same manner as a message actuator" -"subject = Subject of the message (string)" -"body = Message body (string)" -"to = Name of object to send the message to") -{ - KX_Scene *scene = KX_GetActiveScene(); - char* subject; - char* body = (char *)""; - char* to = (char *)""; - const STR_String& from = GetName(); - - if (!PyArg_ParseTuple(args, "s|ss:sendMessage", &subject, &body, &to)) - return NULL; - - scene->GetNetworkScene()->SendMessage(to, from, subject, body); - Py_RETURN_NONE; -} - -/* dict style access */ - - -/* Matches python dict.get(key, [default]) */ -PyObject* KX_GameObject::Pyget(PyObject *args) -{ - PyObject *key; - PyObject* def = Py_None; - PyObject* ret; - - if (!PyArg_ParseTuple(args, "O|O:get", &key, &def)) - return NULL; - - - if(PyUnicode_Check(key)) { - CValue *item = GetProperty(_PyUnicode_AsString(key)); - if (item) { - ret = item->ConvertValueToPython(); - if(ret) - return ret; - else - return item->GetProxy(); - } - } - - if (m_attr_dict && (ret=PyDict_GetItem(m_attr_dict, key))) { - Py_INCREF(ret); - return ret; - } - - Py_INCREF(def); - return def; -} - -bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok, const char *error_prefix) -{ - if (value==NULL) { - PyErr_Format(PyExc_TypeError, "%s, python pointer NULL, should never happen", error_prefix); - *object = NULL; - return false; - } - - if (value==Py_None) { - *object = NULL; - - if (py_none_ok) { - return true; - } else { - PyErr_Format(PyExc_TypeError, "%s, expected KX_GameObject or a KX_GameObject name, None is invalid", error_prefix); - return false; - } - } - - if (PyUnicode_Check(value)) { - *object = (KX_GameObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String( _PyUnicode_AsString(value) )); - - if (*object) { - return true; - } else { - PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_GameObject in this scene", error_prefix, _PyUnicode_AsString(value)); - return false; - } - } - - if ( PyObject_TypeCheck(value, &KX_GameObject::Type) || - PyObject_TypeCheck(value, &KX_LightObject::Type) || - PyObject_TypeCheck(value, &KX_Camera::Type) ) - { - *object = static_castBGE_PROXY_REF(value); - - /* sets the error */ - if (*object==NULL) { - PyErr_Format(PyExc_SystemError, "%s, " BGE_PROXY_ERROR_MSG, error_prefix); - return false; - } - - return true; - } - - *object = NULL; - - if (py_none_ok) { - PyErr_Format(PyExc_TypeError, "%s, expect a KX_GameObject, a string or None", error_prefix); - } else { - PyErr_Format(PyExc_TypeError, "%s, expect a KX_GameObject or a string", error_prefix); - } - - return false; -} -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h deleted file mode 100644 index 625ff2609df..00000000000 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ /dev/null @@ -1,913 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * General KX game object. - */ - -#ifndef __KX_GAMEOBJECT -#define __KX_GAMEOBJECT - -#ifdef WIN32 -// get rid of this stupid "warning 'this' used in initialiser list", generated by VC when including Solid/Sumo -#pragma warning (disable : 4355) -#endif - - -#include "ListValue.h" -#include "SCA_IObject.h" -#include "SG_Node.h" -#include "MT_Transform.h" -#include "MT_CmMatrix4x4.h" -#include "GEN_Map.h" -#include "GEN_HashedPtr.h" -#include "KX_Scene.h" -#include "KX_KetsjiEngine.h" /* for m_anim_framerate */ -#include "KX_IPhysicsController.h" /* for suspend/resume */ -#include "DNA_object_types.h" -#include "SCA_LogicManager.h" /* for ConvertPythonToGameObject to search object names */ -#define KX_OB_DYNAMIC 1 - -//Forward declarations. -struct KX_ClientObjectInfo; -class KX_RayCast; -class RAS_MeshObject; -class KX_IPhysicsController; -class PHY_IGraphicController; -class PHY_IPhysicsEnvironment; -struct Object; - -#ifndef DISABLE_PYTHON -/* utility conversion function */ -bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok, const char *error_prefix); -#endif - -#ifdef USE_MATHUTILS -void KX_GameObject_Mathutils_Callback_Init(void); -#endif - -/** - * KX_GameObject is the main class for dynamic objects. - */ -class KX_GameObject : public SCA_IObject -{ - Py_Header; -protected: - - bool m_bDyna; - KX_ClientObjectInfo* m_pClient_info; - STR_String m_name; - STR_String m_text; - int m_layer; - std::vector m_meshes; - SG_QList m_meshSlots; // head of mesh slots of this - struct Object* m_pBlenderObject; - struct Object* m_pBlenderGroupObject; - - bool m_bSuspendDynamics; - bool m_bUseObjectColor; - bool m_bIsNegativeScaling; - MT_Vector4 m_objectColor; - - // visible = user setting - // culled = while rendering, depending on camera - bool m_bVisible; - bool m_bCulled; - bool m_bOccluder; - - KX_IPhysicsController* m_pPhysicsController1; - PHY_IGraphicController* m_pGraphicController; - STR_String m_testPropName; - bool m_xray; - KX_GameObject* m_pHitObject; - - SG_Node* m_pSGNode; - - MT_CmMatrix4x4 m_OpenGL_4x4Matrix; - -public: - bool m_isDeformable; - - /** - * Helper function for modules that can't include KX_ClientObjectInfo.h - */ - static KX_GameObject* GetClientObject(KX_ClientObjectInfo* info); - -#ifndef DISABLE_PYTHON - // Python attributes that wont convert into CValue - // - // there are 2 places attributes can be stored, in the CValue, - // where attributes are converted into BGE's CValue types - // these can be used with property actuators - // - // For the python API, For types that cannot be converted into CValues (lists, dicts, GameObjects) - // these will be put into "m_attr_dict", logic bricks cannot access them. - // - // rules for setting attributes. - // - // * there should NEVER be a CValue and a m_attr_dict attribute with matching names. get/sets make sure of this. - // * if CValue conversion fails, use a PyObject in "m_attr_dict" - // * when assigning a value, first see if it can be a CValue, if it can remove the "m_attr_dict" and set the CValue - // - PyObject* m_attr_dict; -#endif - - virtual void /* This function should be virtual - derived classed override it */ - Relink( - GEN_Map *map - ); - - /** - * Compute an OpenGl compatable 4x4 matrix. Has the - * side effect of storing the result internally. The - * memory for the matrix remains the property of this class. - */ - double* - GetOpenGLMatrix( - ); - - /** - * Return a pointer to a MT_CmMatrix4x4 storing the - * opengl transformation for this object. This is updated - * by a call to GetOpenGLMatrix(). This class owns the - * memory for the returned matrix. - */ - - MT_CmMatrix4x4* - GetOpenGLMatrixPtr( - ) { - return &m_OpenGL_4x4Matrix; - }; - - /** - * Update the blender object obmat field from the object world position - * if blendobj is NULL, update the object pointed by m_pBlenderObject - * The user must take action to restore the matrix before leaving the GE. - * Used in Armature evaluation - */ - void - UpdateBlenderObjectMatrix(Object* blendobj=NULL); - - /** - * Get a pointer to the game object that is the parent of - * this object. Or NULL if there is no parent. The returned - * object is part of a reference counting scheme. Calling - * this function ups the reference count on the returned - * object. It is the responsibility of the caller to decrement - * the reference count when you have finished with it. - */ - KX_GameObject* - GetParent( - ); - - /** - * Sets the parent of this object to a game object - */ - void SetParent(KX_Scene *scene, KX_GameObject *obj, bool addToCompound=true, bool ghost=true); - - /** - * Removes the parent of this object to a game object - */ - void RemoveParent(KX_Scene *scene); - - /** - * Construct a game object. This class also inherits the - * default constructors - use those with care! - */ - - KX_GameObject( - void* sgReplicationInfo, - SG_Callbacks callbacks - ); - - virtual - ~KX_GameObject( - ); - - /** - * @section Stuff which is here due to poor design. - * Inherited from CValue and needs an implementation. - * Do not expect these functions do to anything sensible. - */ - - /** - * Inherited from CValue -- does nothing! - */ - CValue* - Calc( - VALUE_OPERATOR op, - CValue *val - ); - - /** - * Inherited from CValue -- does nothing! - */ - CValue* - CalcFinal( - VALUE_DATA_TYPE dtype, - VALUE_OPERATOR op, - CValue *val - ); - - /** - * Inherited from CValue -- does nothing! - */ - const - STR_String & - GetText( - ); - - /** - * Inherited from CValue -- does nothing! - */ - double - GetNumber( - ); - - /** - * @section Inherited from CValue. These are the useful - * part of the CValue interface that this class implements. - */ - - /** - * Inherited from CValue -- returns the name of this object. - */ - STR_String& - GetName( - ); - - /** - * Inherited from CValue -- set the name of this object. - */ - void - SetName( - const char *name - ); - - /** - * Inherited from CValue -- return a new copy of this - * instance allocated on the heap. Ownership of the new - * object belongs with the caller. - */ - virtual CValue* - GetReplica( - ); - - /** - * Inherited from CValue -- Makes sure any internal - * data owned by this class is deep copied. Called internally - */ - virtual void - ProcessReplica(); - - /** - * Return the linear velocity of the game object. - */ - MT_Vector3 - GetLinearVelocity( - bool local=false - ); - - /** - * Return the linear velocity of a given point in world coordinate - * but relative to center of object ([0,0,0]=center of object) - */ - MT_Vector3 - GetVelocity( - const MT_Point3& position - ); - - /** - * Return the mass of the object - */ - MT_Scalar - GetMass(); - - /** - * Return the local inertia vector of the object - */ - MT_Vector3 - GetLocalInertia(); - - /** - * Return the angular velocity of the game object. - */ - MT_Vector3 - GetAngularVelocity( - bool local=false - ); - - /** - * Align the object to a given normal. - */ - void - AlignAxisToVect( - const MT_Vector3& vect, - int axis = 2, - float fac = 1.0 - ); - - /** - * Quick'n'dirty obcolor ipo stuff - */ - - void - SetObjectColor( - const MT_Vector4& rgbavec - ); - - const MT_Vector4& - GetObjectColor(); - - - void - ResolveCombinedVelocities( - const MT_Vector3 & lin_vel, - const MT_Vector3 & ang_vel, - bool lin_vel_local, - bool ang_vel_local - ); - - /** - * @return a pointer to the physics controller owned by this class. - */ - - KX_IPhysicsController* GetPhysicsController() ; - - void SetPhysicsController(KX_IPhysicsController* physicscontroller,bool isDynamic) - { - m_bDyna = isDynamic; - m_pPhysicsController1 = physicscontroller; - } - - virtual class RAS_Deformer* GetDeformer() - { - return 0; - } - virtual void SetDeformer(class RAS_Deformer* deformer) - { - - } - - /** - * @return a pointer to the graphic controller owner by this class - */ - PHY_IGraphicController* GetGraphicController() - { - return m_pGraphicController; - } - - void SetGraphicController(PHY_IGraphicController* graphiccontroller) - { - m_pGraphicController = graphiccontroller; - } - /* - * @add/remove the graphic controller to the physic system - */ - void ActivateGraphicController(bool recurse); - - /** - * @section Coordinate system manipulation functions - */ - - void NodeSetLocalPosition(const MT_Point3& trans ); - - void NodeSetLocalOrientation(const MT_Matrix3x3& rot ); - void NodeSetGlobalOrientation(const MT_Matrix3x3& rot ); - - void NodeSetLocalScale( const MT_Vector3& scale ); - - void NodeSetRelativeScale( const MT_Vector3& scale ); - - // adapt local position so that world position is set to desired position - void NodeSetWorldPosition(const MT_Point3& trans); - - void - NodeUpdateGS( - double time - ); - - const MT_Matrix3x3& NodeGetWorldOrientation( ) const; - const MT_Vector3& NodeGetWorldScaling( ) const; - const MT_Point3& NodeGetWorldPosition( ) const; - - const MT_Matrix3x3& NodeGetLocalOrientation( ) const; - const MT_Vector3& NodeGetLocalScaling( ) const; - const MT_Point3& NodeGetLocalPosition( ) const; - - /** - * @section scene graph node accessor functions. - */ - - SG_Node* GetSGNode( ) - { - return m_pSGNode; - } - - const SG_Node* GetSGNode( ) const - { - return m_pSGNode; - } - - /** - * @section blender object accessor functions. - */ - - struct Object* GetBlenderObject( ) - { - return m_pBlenderObject; - } - - void SetBlenderObject( struct Object* obj) - { - m_pBlenderObject = obj; - } - - struct Object* GetBlenderGroupObject( ) - { - return m_pBlenderGroupObject; - } - - void SetBlenderGroupObject( struct Object* obj) - { - m_pBlenderGroupObject = obj; - } - - bool IsDupliGroup() - { - return (m_pBlenderObject && - (m_pBlenderObject->transflag & OB_DUPLIGROUP) && - m_pBlenderObject->dup_group != NULL) ? true : false; - } - - /** - * Set the Scene graph node for this game object. - * warning - it is your responsibility to make sure - * all controllers look at this new node. You must - * also take care of the memory associated with the - * old node. This class takes ownership of the new - * node. - */ - void SetSGNode(SG_Node* node ) - { - m_pSGNode = node; - } - - //Is it a dynamic/physics object ? - bool IsDynamic() const - { - return m_bDyna; - } - - /** - * Check if this object has a vertex parent relationship - */ - bool IsVertexParent( ) - { - return (m_pSGNode && m_pSGNode->GetSGParent() && m_pSGNode->GetSGParent()->IsVertexParent()); - } - - bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data); - bool NeedRayCast(KX_ClientObjectInfo* client); - - - /** - * @section Physics accessors for this node. - * - * All these calls get passed directly to the physics controller - * owned by this object. - * This is real interface bloat. Why not just use the physics controller - * directly? I think this is because the python interface is in the wrong - * place. - */ - - void - ApplyForce( - const MT_Vector3& force, bool local - ); - - void - ApplyTorque( - const MT_Vector3& torque, - bool local - ); - - void - ApplyRotation( - const MT_Vector3& drot, - bool local - ); - - void - ApplyMovement( - const MT_Vector3& dloc, - bool local - ); - - void - addLinearVelocity( - const MT_Vector3& lin_vel, - bool local - ); - - void - setLinearVelocity( - const MT_Vector3& lin_vel, - bool local - ); - - void - setAngularVelocity( - const MT_Vector3& ang_vel, - bool local - ); - - /** - * Update the physics object transform based upon the current SG_Node - * position. - */ - void - UpdateTransform( - ); - - static void UpdateTransformFunc(SG_IObject* node, void* gameobj, void* scene); - - /** - * only used for sensor objects - */ - void SynchronizeTransform(); - - static void SynchronizeTransformFunc(SG_IObject* node, void* gameobj, void* scene); - - /** - * Function to set IPO option at start of IPO - */ - void - InitIPO( - bool ipo_as_force, - bool ipo_add, - bool ipo_local - ); - - /** - * Odd function to update an ipo. ??? - */ - void - UpdateIPO( - float curframetime, - bool recurse - ); - /** - * Updates Material Ipo data - */ - void - UpdateMaterialData( - dword matname_hash, - MT_Vector4 rgba, - MT_Vector3 specrgb, - MT_Scalar hard, - MT_Scalar spec, - MT_Scalar ref, - MT_Scalar emit, - MT_Scalar alpha - ); - - /** - * @section Mesh accessor functions. - */ - - /** - * Update buckets to indicate that there is a new - * user of this object's meshes. - */ - void - AddMeshUser( - ); - - /** - * Update buckets with data about the mesh after - * creating or duplicating the object, changing - * visibility, object color, .. . - */ - void - UpdateBuckets( - bool recursive - ); - - /** - * Clear the meshes associated with this class - * and remove from the bucketing system. - * Don't think this actually deletes any of the meshes. - */ - void - RemoveMeshes( - ); - - /** - * Add a mesh to the set of meshes associated with this - * node. Meshes added in this way are not deleted by this class. - * Make sure you call RemoveMeshes() before deleting the - * mesh though, - */ - void - AddMesh( - RAS_MeshObject* mesh - ){ - m_meshes.push_back(mesh); - } - - /** - * Pick out a mesh associated with the integer 'num'. - */ - RAS_MeshObject* - GetMesh( - int num - ) const { - return m_meshes[num]; - } - - /** - * Return the number of meshes currently associated with this - * game object. - */ - int - GetMeshCount( - ) const { - return m_meshes.size(); - } - - /** - * Set the debug color of the meshes associated with this - * class. Does this still work? - */ - void - SetDebugColor( - unsigned int bgra - ); - - /** - * Reset the debug color of meshes associated with this class. - */ - void - ResetDebugColor( - ); - - /** - * Was this object marked visible? (only for the explicit - * visibility system). - */ - bool - GetVisible( - void - ); - - /** - * Set visibility flag of this object - */ - void - SetVisible( - bool b, - bool recursive - ); - - /** - * Was this object culled? - */ - inline bool - GetCulled( - void - ) { return m_bCulled; } - - /** - * Set culled flag of this object - */ - inline void - SetCulled( - bool c - ) { m_bCulled = c; } - - /** - * Is this object an occluder? - */ - inline bool - GetOccluder( - void - ) { return m_bOccluder; } - - /** - * Set occluder flag of this object - */ - void - SetOccluder( - bool v, - bool recursive - ); - - /** - * Change the layer of the object (when it is added in another layer - * than the original layer) - */ - void - SetLayer( - int l - ); - - /** - * Get the object layer - */ - int - GetLayer( - void - ); - - /** - * Get the negative scaling state - */ - bool - IsNegativeScaling( - void - ) { return m_bIsNegativeScaling; } - - /** - * @section Logic bubbling methods. - */ - - /** - * Stop making progress - */ - void Suspend(void); - - /** - * Resume making progress - */ - void Resume(void); - - void SuspendDynamics(void) { - if (m_bSuspendDynamics) - { - return; - } - - if (m_pPhysicsController1) - { - m_pPhysicsController1->SuspendDynamics(); - } - m_bSuspendDynamics = true; - } - - void RestoreDynamics(void) { - if (!m_bSuspendDynamics) - { - return; - } - - if (m_pPhysicsController1) - { - m_pPhysicsController1->RestoreDynamics(); - } - m_bSuspendDynamics = false; - } - - KX_ClientObjectInfo* getClientInfo() { return m_pClient_info; } - - CListValue* GetChildren(); - CListValue* GetChildrenRecursive(); - -#ifndef DISABLE_PYTHON - /** - * @section Python interface functions. - */ - virtual PyObject* py_repr(void) - { - return PyUnicode_FromString(GetName().ReadPtr()); - } - - KX_PYMETHOD_O(KX_GameObject,SetWorldPosition); - KX_PYMETHOD_VARARGS(KX_GameObject, ApplyForce); - KX_PYMETHOD_VARARGS(KX_GameObject, ApplyTorque); - KX_PYMETHOD_VARARGS(KX_GameObject, ApplyRotation); - KX_PYMETHOD_VARARGS(KX_GameObject, ApplyMovement); - KX_PYMETHOD_VARARGS(KX_GameObject,GetLinearVelocity); - KX_PYMETHOD_VARARGS(KX_GameObject,SetLinearVelocity); - KX_PYMETHOD_VARARGS(KX_GameObject,GetAngularVelocity); - KX_PYMETHOD_VARARGS(KX_GameObject,SetAngularVelocity); - KX_PYMETHOD_VARARGS(KX_GameObject,GetVelocity); - - KX_PYMETHOD_NOARGS(KX_GameObject,GetReactionForce); - - - KX_PYMETHOD_NOARGS(KX_GameObject,GetVisible); - KX_PYMETHOD_VARARGS(KX_GameObject,SetVisible); - KX_PYMETHOD_VARARGS(KX_GameObject,SetOcclusion); - KX_PYMETHOD_NOARGS(KX_GameObject,GetState); - KX_PYMETHOD_O(KX_GameObject,SetState); - KX_PYMETHOD_VARARGS(KX_GameObject,AlignAxisToVect); - KX_PYMETHOD_O(KX_GameObject,GetAxisVect); - KX_PYMETHOD_NOARGS(KX_GameObject,SuspendDynamics); - KX_PYMETHOD_NOARGS(KX_GameObject,RestoreDynamics); - KX_PYMETHOD_NOARGS(KX_GameObject,EnableRigidBody); - KX_PYMETHOD_NOARGS(KX_GameObject,DisableRigidBody); - KX_PYMETHOD_VARARGS(KX_GameObject,ApplyImpulse); - KX_PYMETHOD_O(KX_GameObject,SetCollisionMargin); - KX_PYMETHOD_NOARGS(KX_GameObject,GetParent); - KX_PYMETHOD_VARARGS(KX_GameObject,SetParent); - KX_PYMETHOD_NOARGS(KX_GameObject,RemoveParent); - KX_PYMETHOD_NOARGS(KX_GameObject,GetChildren); - KX_PYMETHOD_NOARGS(KX_GameObject,GetChildrenRecursive); - KX_PYMETHOD_VARARGS(KX_GameObject,GetMesh); - KX_PYMETHOD_NOARGS(KX_GameObject,GetPhysicsId); - KX_PYMETHOD_NOARGS(KX_GameObject,GetPropertyNames); - KX_PYMETHOD_VARARGS(KX_GameObject,ReplaceMesh); - KX_PYMETHOD_NOARGS(KX_GameObject,EndObject); - KX_PYMETHOD_DOC(KX_GameObject,rayCastTo); - KX_PYMETHOD_DOC(KX_GameObject,rayCast); - KX_PYMETHOD_DOC_O(KX_GameObject,getDistanceTo); - KX_PYMETHOD_DOC_O(KX_GameObject,getVectTo); - KX_PYMETHOD_DOC_VARARGS(KX_GameObject, sendMessage); - KX_PYMETHOD_VARARGS(KX_GameObject, ReinstancePhysicsMesh); - - /* Dict access */ - KX_PYMETHOD_VARARGS(KX_GameObject,get); - - /* attributes */ - static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - - static PyObject* pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_worldScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_meshes(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_children(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_children_recursive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_obcolor(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - /* Experemental! */ - static PyObject* pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_controllers(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - - /* getitem/setitem */ - static PyMappingMethods Mapping; - static PySequenceMethods Sequence; -#endif -}; - - - -#endif //__KX_GAMEOBJECT - diff --git a/source/gameengine/Ketsji/KX_IInterpolator.h b/source/gameengine/Ketsji/KX_IInterpolator.h deleted file mode 100644 index b08a2368e5b..00000000000 --- a/source/gameengine/Ketsji/KX_IInterpolator.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_IINTERPOLATOR_H -#define KX_IINTERPOLATOR_H - -#include - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class KX_IInterpolator { -public: - virtual ~KX_IInterpolator() {} - - virtual void Execute(float currentTime) const = 0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IInterpolator"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -typedef std::vector T_InterpolatorList; - -#endif - diff --git a/source/gameengine/Ketsji/KX_IPOTransform.h b/source/gameengine/Ketsji/KX_IPOTransform.h deleted file mode 100644 index ba2adfe2ef6..00000000000 --- a/source/gameengine/Ketsji/KX_IPOTransform.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * An abstract object you can move around in a 3d world, and has some logic - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef KX_IPOTRANSFORM_H -#define KX_IPOTRANSFORM_H - -#include "MT_Transform.h" - -class KX_IPOTransform { -public: - KX_IPOTransform() : - m_position(0.0, 0.0, 0.0), - m_eulerAngles(0.0, 0.0, 0.0), - m_scaling(1.0, 1.0, 1.0), - m_deltaPosition(0.0, 0.0, 0.0), - m_deltaEulerAngles(0.0, 0.0, 0.0), - m_deltaScaling(0.0, 0.0, 0.0) - {} - - MT_Transform GetTransform() const { - return MT_Transform(m_position + m_deltaPosition, - MT_Matrix3x3(m_eulerAngles + m_deltaEulerAngles, - m_scaling + m_deltaScaling)); - } - - MT_Point3& GetPosition() { return m_position; } - MT_Vector3& GetEulerAngles() { return m_eulerAngles; } - MT_Vector3& GetScaling() { return m_scaling; } - - const MT_Point3& GetPosition() const { return m_position; } - const MT_Vector3& GetEulerAngles() const { return m_eulerAngles; } - const MT_Vector3& GetScaling() const { return m_scaling; } - - MT_Vector3& GetDeltaPosition() { return m_deltaPosition; } - MT_Vector3& GetDeltaEulerAngles() { return m_deltaEulerAngles; } - MT_Vector3& GetDeltaScaling() { return m_deltaScaling; } - - void SetPosition(const MT_Point3& pos) { m_position = pos; } - void SetEulerAngles(const MT_Vector3& eul) { m_eulerAngles = eul; } - void SetScaling(const MT_Vector3& scaling) { m_scaling = scaling; } - - void ClearDeltaStuff() { - m_deltaPosition.setValue(0.0, 0.0, 0.0); - m_deltaEulerAngles.setValue(0.0, 0.0, 0.0); - m_deltaScaling.setValue(0.0, 0.0, 0.0); - } - -protected: - MT_Point3 m_position; - MT_Vector3 m_eulerAngles; - MT_Vector3 m_scaling; - MT_Vector3 m_deltaPosition; - MT_Vector3 m_deltaEulerAngles; - MT_Vector3 m_deltaScaling; -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp deleted file mode 100644 index 1d4c64483f5..00000000000 --- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Scenegraph controller for ipos. - */ - -#if defined(_WIN64) -typedef unsigned __int64 uint_ptr; -#else -typedef unsigned long uint_ptr; -#endif - -#ifdef WIN32 -// This warning tells us about truncation of __long__ stl-generated names. -// It can occasionally cause DevStudio to have internal compiler warnings. -#pragma warning( disable : 4786 ) -#endif - -#include "KX_IPO_SGController.h" -#include "KX_ScalarInterpolator.h" -#include "KX_GameObject.h" -#include "KX_IPhysicsController.h" -#include "DNA_ipo_types.h" -#include "BLI_math.h" - -// All objects should start on frame 1! Will we ever need an object to -// start on another frame, the 1.0 should change. -KX_IpoSGController::KX_IpoSGController() -: m_ipo_as_force(false), - m_ipo_add(false), - m_ipo_local(false), - m_modified(true), - m_ipotime(1.0), - m_ipo_start_initialized(false), - m_ipo_start_euler(0.0,0.0,0.0), - m_ipo_euler_initialized(false) -{ - m_game_object = NULL; - for (int i=0; i < KX_MAX_IPO_CHANNELS; i++) - m_ipo_channels_active[i] = false; -} - - -void KX_IpoSGController::SetOption( - int option, - int value) -{ - switch (option) { - case SG_CONTR_IPO_IPO_AS_FORCE: - m_ipo_as_force = (value != 0); - m_modified = true; - break; - case SG_CONTR_IPO_IPO_ADD: - m_ipo_add = (value != 0); - m_modified = true; - break; - case SG_CONTR_IPO_RESET: - if (m_ipo_start_initialized && value) { - m_ipo_start_initialized = false; - m_modified = true; - } - break; - case SG_CONTR_IPO_LOCAL: - if (value/* && ((SG_Node*)m_pObject)->GetSGParent() == NULL*/) { - // only accept local Ipo if the object has no parent - m_ipo_local = true; - } else { - m_ipo_local = false; - } - m_modified = true; - break; - default: - ; /* just ignore the rest */ - } -} - - void -KX_IpoSGController::UpdateSumoReference( - ) -{ - if (m_game_object) { - - } -} - - void -KX_IpoSGController::SetGameObject( - KX_GameObject* go - ) -{ - m_game_object = go; -} - - - -bool KX_IpoSGController::Update(double currentTime) -{ - if (m_modified) - { - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - (*i)->Execute(m_ipotime);//currentTime); - } - - SG_Spatial* ob = (SG_Spatial*)m_pObject; - - //initialization on the first frame of the IPO - if (! m_ipo_start_initialized && currentTime > 0.0) { - m_ipo_start_point = ob->GetLocalPosition(); - m_ipo_start_orient = ob->GetLocalOrientation(); - m_ipo_start_scale = ob->GetLocalScale(); - m_ipo_start_initialized = true; - if (!m_ipo_euler_initialized) { - // do it only once to avoid angle discontinuities - m_ipo_start_orient.getEuler(m_ipo_start_euler[0], m_ipo_start_euler[1], m_ipo_start_euler[2]); - m_ipo_euler_initialized = true; - } - } - - //modifies position? - if (m_ipo_channels_active[OB_LOC_X] || m_ipo_channels_active[OB_LOC_Y] || m_ipo_channels_active[OB_LOC_Z] || m_ipo_channels_active[OB_DLOC_X] || m_ipo_channels_active[OB_DLOC_Y] || m_ipo_channels_active[OB_DLOC_Z]) - { - if (m_ipo_as_force == true) - { - if (m_game_object && ob && m_game_object->GetPhysicsController()) - { - m_game_object->GetPhysicsController()->ApplyForce(m_ipo_local ? - ob->GetWorldOrientation() * m_ipo_xform.GetPosition() : - m_ipo_xform.GetPosition(), false); - } - } - else - { - // Local ipo should be defined with the object position at (0,0,0) - // Local transform is applied to the object based on initial position - MT_Point3 newPosition(0.0,0.0,0.0); - - if (!m_ipo_add) - newPosition = ob->GetLocalPosition(); - //apply separate IPO channels if there is any data in them - //Loc and dLoc act by themselves or are additive - //LocX and dLocX - if (m_ipo_channels_active[OB_LOC_X]) { - newPosition[0] = (m_ipo_channels_active[OB_DLOC_X] ? m_ipo_xform.GetPosition()[0] + m_ipo_xform.GetDeltaPosition()[0] : m_ipo_xform.GetPosition()[0]); - } - else if (m_ipo_channels_active[OB_DLOC_X] && m_ipo_start_initialized) { - newPosition[0] = (((!m_ipo_add)?m_ipo_start_point[0]:0.0) + m_ipo_xform.GetDeltaPosition()[0]); - } - //LocY and dLocY - if (m_ipo_channels_active[OB_LOC_Y]) { - newPosition[1] = (m_ipo_channels_active[OB_DLOC_Y] ? m_ipo_xform.GetPosition()[1] + m_ipo_xform.GetDeltaPosition()[1] : m_ipo_xform.GetPosition()[1]); - } - else if (m_ipo_channels_active[OB_DLOC_Y] && m_ipo_start_initialized) { - newPosition[1] = (((!m_ipo_add)?m_ipo_start_point[1]:0.0) + m_ipo_xform.GetDeltaPosition()[1]); - } - //LocZ and dLocZ - if (m_ipo_channels_active[OB_LOC_Z]) { - newPosition[2] = (m_ipo_channels_active[OB_DLOC_Z] ? m_ipo_xform.GetPosition()[2] + m_ipo_xform.GetDeltaPosition()[2] : m_ipo_xform.GetPosition()[2]); - } - else if (m_ipo_channels_active[OB_DLOC_Z] && m_ipo_start_initialized) { - newPosition[2] = (((!m_ipo_add)?m_ipo_start_point[2]:0.0) + m_ipo_xform.GetDeltaPosition()[2]); - } - if (m_ipo_add) { - if (m_ipo_local) - newPosition = m_ipo_start_point + m_ipo_start_scale*(m_ipo_start_orient*newPosition); - else - newPosition = m_ipo_start_point + newPosition; - } - if (m_game_object) - m_game_object->NodeSetLocalPosition(newPosition); - } - } - //modifies orientation? - if (m_ipo_channels_active[OB_ROT_X] || m_ipo_channels_active[OB_ROT_Y] || m_ipo_channels_active[OB_ROT_Z] || m_ipo_channels_active[OB_DROT_X] || m_ipo_channels_active[OB_DROT_Y] || m_ipo_channels_active[OB_DROT_Z]) { - if (m_ipo_as_force) { - - if (m_game_object && ob) { - m_game_object->ApplyTorque(m_ipo_local ? - ob->GetWorldOrientation() * m_ipo_xform.GetEulerAngles() : - m_ipo_xform.GetEulerAngles(), false); - } - } else if (m_ipo_add) { - if (m_ipo_start_initialized) { - double yaw=0, pitch=0, roll=0; //delta Euler angles - - //RotX and dRotX - if (m_ipo_channels_active[OB_ROT_X]) - yaw += m_ipo_xform.GetEulerAngles()[0]; - if (m_ipo_channels_active[OB_DROT_X]) - yaw += m_ipo_xform.GetDeltaEulerAngles()[0]; - - //RotY dRotY - if (m_ipo_channels_active[OB_ROT_Y]) - pitch += m_ipo_xform.GetEulerAngles()[1]; - if (m_ipo_channels_active[OB_DROT_Y]) - pitch += m_ipo_xform.GetDeltaEulerAngles()[1]; - - //RotZ and dRotZ - if (m_ipo_channels_active[OB_ROT_Z]) - roll += m_ipo_xform.GetEulerAngles()[2]; - if (m_ipo_channels_active[OB_DROT_Z]) - roll += m_ipo_xform.GetDeltaEulerAngles()[2]; - - MT_Matrix3x3 rotation(MT_Vector3(yaw, pitch, roll)); - if (m_ipo_local) - rotation = m_ipo_start_orient * rotation; - else - rotation = rotation * m_ipo_start_orient; - if (m_game_object) - m_game_object->NodeSetLocalOrientation(rotation); - } - } else if (m_ipo_channels_active[OB_ROT_X] || m_ipo_channels_active[OB_ROT_Y] || m_ipo_channels_active[OB_ROT_Z]) { - if (m_ipo_euler_initialized) { - // assume all channel absolute - // All 3 channels should be specified but if they are not, we will take - // the value at the start of the game to avoid angle sign reversal - double yaw=m_ipo_start_euler[0], pitch=m_ipo_start_euler[1], roll=m_ipo_start_euler[2]; - - //RotX and dRotX - if (m_ipo_channels_active[OB_ROT_X]) { - yaw = (m_ipo_channels_active[OB_DROT_X] ? (m_ipo_xform.GetEulerAngles()[0] + m_ipo_xform.GetDeltaEulerAngles()[0]) : m_ipo_xform.GetEulerAngles()[0] ); - } - else if (m_ipo_channels_active[OB_DROT_X]) { - yaw += m_ipo_xform.GetDeltaEulerAngles()[0]; - } - - //RotY dRotY - if (m_ipo_channels_active[OB_ROT_Y]) { - pitch = (m_ipo_channels_active[OB_DROT_Y] ? (m_ipo_xform.GetEulerAngles()[1] + m_ipo_xform.GetDeltaEulerAngles()[1]) : m_ipo_xform.GetEulerAngles()[1] ); - } - else if (m_ipo_channels_active[OB_DROT_Y]) { - pitch += m_ipo_xform.GetDeltaEulerAngles()[1]; - } - - //RotZ and dRotZ - if (m_ipo_channels_active[OB_ROT_Z]) { - roll = (m_ipo_channels_active[OB_DROT_Z] ? (m_ipo_xform.GetEulerAngles()[2] + m_ipo_xform.GetDeltaEulerAngles()[2]) : m_ipo_xform.GetEulerAngles()[2] ); - } - else if (m_ipo_channels_active[OB_DROT_Z]) { - roll += m_ipo_xform.GetDeltaEulerAngles()[2]; - } - if (m_game_object) - m_game_object->NodeSetLocalOrientation(MT_Vector3(yaw, pitch, roll)); - } - } else if (m_ipo_start_initialized) { - // only DROT, treat as Add - double yaw=0, pitch=0, roll=0; //delta Euler angles - - //dRotX - if (m_ipo_channels_active[OB_DROT_X]) - yaw = m_ipo_xform.GetDeltaEulerAngles()[0]; - - //dRotY - if (m_ipo_channels_active[OB_DROT_Y]) - pitch = m_ipo_xform.GetDeltaEulerAngles()[1]; - - //dRotZ - if (m_ipo_channels_active[OB_DROT_Z]) - roll = m_ipo_xform.GetDeltaEulerAngles()[2]; - - // dRot are always local - MT_Matrix3x3 rotation(MT_Vector3(yaw, pitch, roll)); - rotation = m_ipo_start_orient * rotation; - if (m_game_object) - m_game_object->NodeSetLocalOrientation(rotation); - } - } - //modifies scale? - if (m_ipo_channels_active[OB_SIZE_X] || m_ipo_channels_active[OB_SIZE_Y] || m_ipo_channels_active[OB_SIZE_Z] || m_ipo_channels_active[OB_DSIZE_X] || m_ipo_channels_active[OB_DSIZE_Y] || m_ipo_channels_active[OB_DSIZE_Z]) { - //default is no scale change - MT_Vector3 newScale(1.0,1.0,1.0); - if (!m_ipo_add) - newScale = ob->GetLocalScale(); - - if (m_ipo_channels_active[OB_SIZE_X]) { - newScale[0] = (m_ipo_channels_active[OB_DSIZE_X] ? (m_ipo_xform.GetScaling()[0] + m_ipo_xform.GetDeltaScaling()[0]) : m_ipo_xform.GetScaling()[0]); - } - else if (m_ipo_channels_active[OB_DSIZE_X] && m_ipo_start_initialized) { - newScale[0] = (m_ipo_xform.GetDeltaScaling()[0] + ((!m_ipo_add)?m_ipo_start_scale[0]:0.0)); - } - - //RotY dRotY - if (m_ipo_channels_active[OB_SIZE_Y]) { - newScale[1] = (m_ipo_channels_active[OB_DSIZE_Y] ? (m_ipo_xform.GetScaling()[1] + m_ipo_xform.GetDeltaScaling()[1]): m_ipo_xform.GetScaling()[1]); - } - else if (m_ipo_channels_active[OB_DSIZE_Y] && m_ipo_start_initialized) { - newScale[1] = (m_ipo_xform.GetDeltaScaling()[1] + ((!m_ipo_add)?m_ipo_start_scale[1]:0.0)); - } - - //RotZ and dRotZ - if (m_ipo_channels_active[OB_SIZE_Z]) { - newScale[2] = (m_ipo_channels_active[OB_DSIZE_Z] ? (m_ipo_xform.GetScaling()[2] + m_ipo_xform.GetDeltaScaling()[2]) : m_ipo_xform.GetScaling()[2]); - } - else if (m_ipo_channels_active[OB_DSIZE_Z] && m_ipo_start_initialized) { - newScale[2] = (m_ipo_xform.GetDeltaScaling()[2] + ((!m_ipo_add)?m_ipo_start_scale[2]:1.0)); - } - - if (m_ipo_add) { - newScale = m_ipo_start_scale * newScale; - } - if (m_game_object) - m_game_object->NodeSetLocalScale(newScale); - } - - m_modified=false; - } - return false; -} - - -void KX_IpoSGController::AddInterpolator(KX_IInterpolator* interp) -{ - this->m_interpolators.push_back(interp); -} - -SG_Controller* KX_IpoSGController::GetReplica(class SG_Node* destnode) -{ - KX_IpoSGController* iporeplica = new KX_IpoSGController(*this); - // clear object that ipo acts on in the replica. - iporeplica->ClearObject(); - iporeplica->SetGameObject((KX_GameObject*)destnode->GetSGClientObject()); - - // dirty hack, ask Gino for a better solution in the ipo implementation - // hacken en zagen, in what we call datahiding, not written for replication :( - - T_InterpolatorList oldlist = m_interpolators; - iporeplica->m_interpolators.clear(); - - T_InterpolatorList::iterator i; - for (i = oldlist.begin(); !(i == oldlist.end()); ++i) { - KX_ScalarInterpolator* copyipo = new KX_ScalarInterpolator(*((KX_ScalarInterpolator*)*i)); - iporeplica->AddInterpolator(copyipo); - - MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget(); - uint_ptr orgbase = (uint_ptr)&m_ipo_xform; - uint_ptr orgloc = (uint_ptr)scaal; - uint_ptr offset = orgloc-orgbase; - uint_ptr newaddrbase = (uint_ptr)&iporeplica->m_ipo_xform; - newaddrbase += offset; - MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; - copyipo->SetNewTarget((MT_Scalar*)blaptr); - } - - return iporeplica; -} - -KX_IpoSGController::~KX_IpoSGController() -{ - - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - delete (*i); - } - -} diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.h b/source/gameengine/Ketsji/KX_IPO_SGController.h deleted file mode 100644 index 3841cae88da..00000000000 --- a/source/gameengine/Ketsji/KX_IPO_SGController.h +++ /dev/null @@ -1,129 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __IPO_SGCONTROLLER_H -#define __IPO_SGCONTROLLER_H - -#include "SG_Controller.h" -#include "SG_Spatial.h" - -#include "KX_IPOTransform.h" -#include "KX_IInterpolator.h" - -#define KX_MAX_IPO_CHANNELS 19 //note- [0] is not used - -class KX_IpoSGController : public SG_Controller -{ - KX_IPOTransform m_ipo_xform; - T_InterpolatorList m_interpolators; - - /** Flag for each IPO channel that can be applied to a game object */ - bool m_ipo_channels_active[KX_MAX_IPO_CHANNELS]; - - /** Interpret the ipo as a force rather than a displacement? */ - bool m_ipo_as_force; - - /** Add Ipo curve to current loc/rot/scale */ - bool m_ipo_add; - - /** Ipo must be applied in local coordinate rather than in global coordinates (used for force and Add mode)*/ - bool m_ipo_local; - - /** Were settings altered since the last update? */ - bool m_modified; - - /** Local time of this ipo.*/ - double m_ipotime; - - /** Location of the object when the IPO is first fired (for local transformations) */ - class MT_Point3 m_ipo_start_point; - - /** Orientation of the object when the IPO is first fired (for local transformations) */ - class MT_Matrix3x3 m_ipo_start_orient; - - /** Scale of the object when the IPO is first fired (for local transformations) */ - class MT_Vector3 m_ipo_start_scale; - - /** if IPO initial position has been set for local normal IPO */ - bool m_ipo_start_initialized; - - /** Euler angles at the start of the game, needed for incomplete ROT Ipo curves */ - class MT_Vector3 m_ipo_start_euler; - - /** true is m_ipo_start_euler has been initialized */ - bool m_ipo_euler_initialized; - - /** A reference to the original game object. */ - class KX_GameObject* m_game_object; - -public: - KX_IpoSGController(); - - virtual ~KX_IpoSGController(); - - virtual SG_Controller* GetReplica(class SG_Node* destnode); - - void - SetOption( - int option, - int value - ); - - /** Set sumo data. */ - void UpdateSumoReference(); - /** Set reference to the corresponding game object. */ - void SetGameObject(class KX_GameObject*); - - void SetIPOChannelActive(int index, bool value) { - //indexes found in makesdna\DNA_ipo_types.h - m_ipo_channels_active[index] = value; - } - - - KX_IPOTransform& GetIPOTransform() - { - return m_ipo_xform; - } - void AddInterpolator(KX_IInterpolator* interp); - virtual bool Update(double time); - virtual void SetSimulatedTime(double time) - { - m_ipotime = time; - m_modified = true; - } - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IpoSGController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__IPO_SGCONTROLLER_H - - diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.cpp b/source/gameengine/Ketsji/KX_IPhysicsController.cpp deleted file mode 100644 index 18816e92bbb..00000000000 --- a/source/gameengine/Ketsji/KX_IPhysicsController.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file KX_IPhysicsController.cpp - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "KX_IPhysicsController.h" - -#include "PHY_DynamicTypes.h" - -KX_IPhysicsController::KX_IPhysicsController(bool dyna, bool sensor, bool compound, void* userdata) - -: m_bDyna(dyna), - m_bSensor(sensor), - m_bCompound(compound), - m_suspendDynamics(false), - m_userdata(userdata) -{ -} - -KX_IPhysicsController::~KX_IPhysicsController() -{ -} - - diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.h b/source/gameengine/Ketsji/KX_IPhysicsController.h deleted file mode 100644 index faab46c0673..00000000000 --- a/source/gameengine/Ketsji/KX_IPhysicsController.h +++ /dev/null @@ -1,139 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_IPHYSICSCONTROLLER_H -#define __KX_IPHYSICSCONTROLLER_H - -#include "SG_Controller.h" -#include "MT_Vector3.h" -#include "MT_Point3.h" -#include "MT_Transform.h" -#include "MT_Matrix3x3.h" - -struct KX_ClientObjectInfo; - -/** - Physics Controller, a special kind of Scene Graph Transformation Controller. - It get's callbacks from Physics in case a transformation change took place. - Each time the scene graph get's updated, the controller get's a chance - in the 'Update' method to reflect changed. -*/ - -class KX_IPhysicsController : public SG_Controller - -{ -protected: - bool m_bDyna; - bool m_bSensor; - bool m_bCompound; - bool m_suspendDynamics; - void* m_userdata; -public: - KX_IPhysicsController(bool dyna,bool sensor,bool compound, void* userdata); - virtual ~KX_IPhysicsController(); - - - virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse)=0; - virtual void SetObject (SG_IObject* object)=0; - virtual void setMargin (float collisionMargin)=0; - - virtual void RelativeTranslate(const MT_Vector3& dloc,bool local)=0; - virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local)=0; - virtual void ApplyTorque(const MT_Vector3& torque,bool local)=0; - virtual void ApplyForce(const MT_Vector3& force,bool local)=0; - virtual MT_Vector3 GetLinearVelocity()=0; - virtual MT_Vector3 GetAngularVelocity()=0; - virtual MT_Vector3 GetVelocity(const MT_Point3& pos)=0; - virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local)=0; - virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local)=0; - virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) = 0; - - virtual void getOrientation(MT_Quaternion& orn)=0; - virtual void setOrientation(const MT_Matrix3x3& orn)=0; - virtual void SetTransform()=0; - //virtual void setOrientation(const MT_Quaternion& orn)=0; - virtual void setPosition(const MT_Point3& pos)=0; - virtual void setScaling(const MT_Vector3& scaling)=0; - virtual MT_Scalar GetMass()=0; - virtual void SetMass(MT_Scalar newmass)=0; - - virtual float GetLinVelocityMin()=0; - virtual void SetLinVelocityMin(float newmass)=0; - virtual float GetLinVelocityMax()=0; - virtual void SetLinVelocityMax(float newmass)=0; - - virtual MT_Vector3 GetLocalInertia()=0; - virtual MT_Vector3 getReactionForce()=0; - virtual void setRigidBody(bool rigid)=0; - virtual void AddCompoundChild(KX_IPhysicsController* child) = 0; - virtual void RemoveCompoundChild(KX_IPhysicsController* child) = 0; - - virtual void SuspendDynamics(bool ghost=false)=0; - virtual void RestoreDynamics()=0; - - virtual SG_Controller* GetReplica(class SG_Node* destnode)=0; - - void SetDyna(bool isDynamic) { - m_bDyna = isDynamic; - } - - void SetSensor(bool isSensor) { - m_bSensor = isSensor; - } - - bool IsDyna(void) { - return m_bDyna; - } - - bool IsSensor(void) { - return m_bSensor; - } - - bool IsCompound(void) { - return m_bCompound; - } - - virtual MT_Scalar GetRadius()=0; - virtual void SetSumoTransform(bool nondynaonly)=0; - // todo: remove next line ! - virtual void SetSimulatedTime(double time)=0; - - // call from scene graph to update - virtual bool Update(double time)=0; - void* GetUserData() { return m_userdata;} - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IPhysicsController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_IPHYSICSCONTROLLER_H - diff --git a/source/gameengine/Ketsji/KX_IScalarInterpolator.h b/source/gameengine/Ketsji/KX_IScalarInterpolator.h deleted file mode 100644 index 43e07d69611..00000000000 --- a/source/gameengine/Ketsji/KX_IScalarInterpolator.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_ISCALARINTERPOLATOR_H -#define KX_ISCALARINTERPOLATOR_H - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class KX_IScalarInterpolator { -public: - virtual ~KX_IScalarInterpolator() {} - - virtual float GetValue(float currentTime) const = 0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IScalarInterpolator"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_ISceneConverter.h b/source/gameengine/Ketsji/KX_ISceneConverter.h deleted file mode 100644 index d4081daa2c4..00000000000 --- a/source/gameengine/Ketsji/KX_ISceneConverter.h +++ /dev/null @@ -1,96 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_ISCENECONVERTER_H -#define __KX_ISCENECONVERTER_H - -#include "STR_String.h" -#include "KX_Python.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -struct Scene; - -class KX_ISceneConverter -{ - -public: - KX_ISceneConverter() :addInitFromFrame(false) {}//this addInitFromFrame is a back hack, todo remove - virtual ~KX_ISceneConverter () {}; - - /* - scenename: name of the scene to be converted, - if the scenename is empty, convert the 'default' scene (whatever this means) - destinationscene: pass an empty scene, everything goes into this - dictobj: python dictionary (for pythoncontrollers) - */ - virtual void ConvertScene( - class KX_Scene* destinationscene, - class RAS_IRenderTools* rendertools, - class RAS_ICanvas* canvas)=0; - - virtual void RemoveScene(class KX_Scene *scene)=0; - - virtual void SetAlwaysUseExpandFraming(bool to_what) = 0; - - virtual void SetNewFileName(const STR_String& filename) = 0; - virtual bool TryAndLoadNewFile() = 0; - bool addInitFromFrame;//rcruiz - - virtual void ResetPhysicsObjectsAnimationIpo(bool clearIpo) = 0; - - - ///this generates ipo curves for position, rotation, allowing to use game physics in animation - virtual void WritePhysicsObjectToAnimationIpo(int frameNumber) = 0; - virtual void TestHandlesPhysicsObjectToAnimationIpo() = 0; - - ///this is for reseting the position,rotation and scale of the gameobjet that is not dynamic - virtual void resetNoneDynamicObjectToIpo()=0; - - // use blender materials - virtual void SetMaterials(bool val) =0; - virtual bool GetMaterials()=0; - - // use blender glsl materials - virtual void SetGLSLMaterials(bool val) =0; - virtual bool GetGLSLMaterials()=0; - - virtual struct Scene* GetBlenderSceneForName(const STR_String& name)=0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ISceneConverter"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_ISCENECONVERTER_H - diff --git a/source/gameengine/Ketsji/KX_ISystem.h b/source/gameengine/Ketsji/KX_ISystem.h deleted file mode 100644 index 027e6348729..00000000000 --- a/source/gameengine/Ketsji/KX_ISystem.h +++ /dev/null @@ -1,64 +0,0 @@ -/** -* Abstract system -* -* $Id$ -* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** -*/ - -#ifndef __KX_ISYSTEM -#define __KX_ISYSTEM - -#include -using namespace std; - -#include "STR_String.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -/** - * System Abstraction, needed only for getting some timing stuff from the host. - */ -class KX_ISystem -{ -public: - KX_ISystem() {}; - virtual ~KX_ISystem() {}; - - virtual double GetTimeInSeconds()=0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ISystem"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp deleted file mode 100644 index eca40cafb0e..00000000000 --- a/source/gameengine/Ketsji/KX_IpoActuator.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/** - * Do Ipo stuff - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#if defined (__sgi) -#include -#else -#include -#endif - -#include "KX_IpoActuator.h" -#include "KX_GameObject.h" -#include "FloatValue.h" - -#include "KX_KetsjiEngine.h" - -/* ------------------------------------------------------------------------- */ -/* Type strings */ -/* ------------------------------------------------------------------------- */ - -const char *KX_IpoActuator::S_KX_ACT_IPO_PLAY_STRING = "Play"; -const char *KX_IpoActuator::S_KX_ACT_IPO_PINGPONG_STRING = "PingPong"; -const char *KX_IpoActuator::S_KX_ACT_IPO_FLIPPER_STRING = "Flipper"; -const char *KX_IpoActuator::S_KX_ACT_IPO_LOOPSTOP_STRING = "LoopStop"; -const char *KX_IpoActuator::S_KX_ACT_IPO_LOOPEND_STRING = "LoopEnd"; -const char *KX_IpoActuator::S_KX_ACT_IPO_KEY2KEY_STRING = "Key2key"; -const char *KX_IpoActuator::S_KX_ACT_IPO_FROM_PROP_STRING = "FromProp"; - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_IpoActuator::KX_IpoActuator(SCA_IObject* gameobj, - const STR_String& propname, - const STR_String& framePropname, - float starttime, - float endtime, - bool recurse, - int acttype, - bool ipo_as_force, - bool ipo_add, - bool ipo_local) - : SCA_IActuator(gameobj, KX_ACT_IPO), - m_bNegativeEvent(false), - m_startframe (starttime), - m_endframe(endtime), - m_recurse(recurse), - m_localtime(starttime), - m_direction(1), - m_propname(propname), - m_framepropname(framePropname), - m_ipo_as_force(ipo_as_force), - m_ipo_add(ipo_add), - m_ipo_local(ipo_local), - m_type(acttype) -{ - m_starttime = -2.0*fabs(m_endframe - m_startframe) - 1.0; - m_bIpoPlaying = false; -} - -void KX_IpoActuator::SetStart(float starttime) -{ - m_startframe=starttime; -} - -void KX_IpoActuator::SetEnd(float endtime) -{ - m_endframe=endtime; -} - -bool KX_IpoActuator::ClampLocalTime() -{ - if (m_startframe < m_endframe) - { - if (m_localtime < m_startframe) - { - m_localtime = m_startframe; - return true; - } - else if (m_localtime > m_endframe) - { - m_localtime = m_endframe; - return true; - } - } else { - if (m_localtime > m_startframe) - { - m_localtime = m_startframe; - return true; - } - else if (m_localtime < m_endframe) - { - m_localtime = m_endframe; - return true; - } - } - return false; -} - -void KX_IpoActuator::SetStartTime(float curtime) -{ - float direction = m_startframe < m_endframe ? 1.0f : -1.0f; - - if (m_direction > 0) - m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate(); - else - m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate(); -} - -void KX_IpoActuator::SetLocalTime(float curtime) -{ - float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate(); - - // negative delta_time is caused by floating point inaccuracy - // perhaps the inaccuracy could be reduced a bit - if ((m_localtime==m_startframe || m_localtime==m_endframe) && delta_time<0.0) - { - delta_time = 0.0; - } - - if (m_endframe < m_startframe) - delta_time = -delta_time; - - if (m_direction > 0) - m_localtime = m_startframe + delta_time; - else - m_localtime = m_endframe - delta_time; -} - -bool KX_IpoActuator::Update(double curtime, bool frame) -{ - // result = true if animation has to be continued, false if animation stops - // maybe there are events for us in the queue ! - bool bNegativeEvent = false; - bool numevents = false; - bool bIpoStart = false; - - curtime -= KX_KetsjiEngine::GetSuspendedDelta(); - - if (frame) - { - numevents = m_posevent || m_negevent; - bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - } - - float start_smaller_then_end = ( m_startframe < m_endframe ? 1.0f : -1.0f); - - bool result=true; - if (!bNegativeEvent) - { - if (m_starttime < -2.0f*start_smaller_then_end*(m_endframe - m_startframe)) - { - // start for all Ipo, initial start for LOOP_STOP - m_starttime = curtime; - m_bIpoPlaying = true; - bIpoStart = true; - } - } - - switch ((IpoActType)m_type) - { - - case KX_ACT_IPO_PLAY: - { - // Check if playing forwards. result = ! finished - - if (start_smaller_then_end > 0.f) - result = (m_localtime < m_endframe && m_bIpoPlaying); - else - result = (m_localtime > m_endframe && m_bIpoPlaying); - - if (result) - { - SetLocalTime(curtime); - - /* Perform clamping */ - ClampLocalTime(); - - if (bIpoStart) - ((KX_GameObject*)GetParent())->InitIPO(m_ipo_as_force, m_ipo_add, m_ipo_local); - ((KX_GameObject*)GetParent())->UpdateIPO(m_localtime,m_recurse); - } else - { - m_localtime=m_startframe; - m_direction=1; - } - break; - } - case KX_ACT_IPO_PINGPONG: - { - result = true; - if (bNegativeEvent && !m_bIpoPlaying) - result = false; - else - SetLocalTime(curtime); - - if (ClampLocalTime()) - { - result = false; - m_direction = -m_direction; - } - - if (bIpoStart && m_direction > 0) - ((KX_GameObject*)GetParent())->InitIPO(m_ipo_as_force, m_ipo_add, m_ipo_local); - ((KX_GameObject*)GetParent())->UpdateIPO(m_localtime,m_recurse); - break; - } - case KX_ACT_IPO_FLIPPER: - { - if (bNegativeEvent && !m_bIpoPlaying) - result = false; - if (numevents) - { - float oldDirection = m_direction; - if (bNegativeEvent) - m_direction = -1; - else - m_direction = 1; - if (m_direction != oldDirection) - // changing direction, reset start time - SetStartTime(curtime); - } - - SetLocalTime(curtime); - - if (ClampLocalTime() && m_localtime == m_startframe) - result = false; - - if (bIpoStart) - ((KX_GameObject*)GetParent())->InitIPO(m_ipo_as_force, m_ipo_add, m_ipo_local); - ((KX_GameObject*)GetParent())->UpdateIPO(m_localtime,m_recurse); - break; - } - - case KX_ACT_IPO_LOOPSTOP: - { - if (numevents) - { - if (bNegativeEvent) - { - result = false; - m_bNegativeEvent = false; - numevents = false; - } - if (!m_bIpoPlaying) - { - // Ipo was stopped, make sure we will restart from where it stopped - SetStartTime(curtime); - if (!bNegativeEvent) - // positive signal will restart the Ipo - m_bIpoPlaying = true; - } - - } // fall through to loopend, and quit the ipo animation immediatly - } - case KX_ACT_IPO_LOOPEND: - { - if (numevents){ - if (bNegativeEvent && m_bIpoPlaying){ - m_bNegativeEvent = true; - } - } - - if (bNegativeEvent && !m_bIpoPlaying){ - result = false; - } - else - { - if (m_localtime*start_smaller_then_end < m_endframe*start_smaller_then_end) - { - SetLocalTime(curtime); - } - else{ - if (!m_bNegativeEvent){ - /* Perform wraparound */ - SetLocalTime(curtime); - if (start_smaller_then_end > 0.f) - m_localtime = m_startframe + fmod(m_localtime - m_startframe, m_endframe - m_startframe); - else - m_localtime = m_startframe - fmod(m_startframe - m_localtime, m_startframe - m_endframe); - SetStartTime(curtime); - bIpoStart = true; - } - else - { - /* Perform clamping */ - m_localtime=m_endframe; - result = false; - m_bNegativeEvent = false; - } - } - } - - if (m_bIpoPlaying && bIpoStart) - ((KX_GameObject*)GetParent())->InitIPO(m_ipo_as_force, m_ipo_add, m_ipo_local); - ((KX_GameObject*)GetParent())->UpdateIPO(m_localtime,m_recurse); - break; - } - - case KX_ACT_IPO_KEY2KEY: - { - // not implemented yet - result = false; - break; - } - - case KX_ACT_IPO_FROM_PROP: - { - result = !bNegativeEvent; - - CValue* propval = GetParent()->GetProperty(m_propname); - if (propval) - { - m_localtime = propval->GetNumber(); - - if (bIpoStart) - ((KX_GameObject*)GetParent())->InitIPO(m_ipo_as_force, m_ipo_add, m_ipo_local); - ((KX_GameObject*)GetParent())->UpdateIPO(m_localtime,m_recurse); - } else - { - result = false; - } - break; - } - - default: - result = false; - } - - /* Set the property if its defined */ - if (m_framepropname[0] != '\0') { - CValue* propowner = GetParent(); - CValue* oldprop = propowner->GetProperty(m_framepropname); - CValue* newval = new CFloatValue(m_localtime); - if (oldprop) { - oldprop->SetValue(newval); - } else { - propowner->SetProperty(m_framepropname, newval); - } - newval->Release(); - } - - if (!result) - { - if (m_type != KX_ACT_IPO_LOOPSTOP) - m_starttime = -2.0*start_smaller_then_end*(m_endframe - m_startframe) - 1.0; - m_bIpoPlaying = false; - } - - return result; -} - -int KX_IpoActuator::string2mode(char* modename) { - IpoActType res = KX_ACT_IPO_NODEF; - - if (strcmp(modename, S_KX_ACT_IPO_PLAY_STRING)==0) { - res = KX_ACT_IPO_PLAY; - } else if (strcmp(modename, S_KX_ACT_IPO_PINGPONG_STRING)==0) { - res = KX_ACT_IPO_PINGPONG; - } else if (strcmp(modename, S_KX_ACT_IPO_FLIPPER_STRING)==0) { - res = KX_ACT_IPO_FLIPPER; - } else if (strcmp(modename, S_KX_ACT_IPO_LOOPSTOP_STRING)==0) { - res = KX_ACT_IPO_LOOPSTOP; - } else if (strcmp(modename, S_KX_ACT_IPO_LOOPEND_STRING)==0) { - res = KX_ACT_IPO_LOOPEND; - } else if (strcmp(modename, S_KX_ACT_IPO_KEY2KEY_STRING)==0) { - res = KX_ACT_IPO_KEY2KEY; - } else if (strcmp(modename, S_KX_ACT_IPO_FROM_PROP_STRING)==0) { - res = KX_ACT_IPO_FROM_PROP; - } - - return res; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_IpoActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_IpoActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_IpoActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_IpoActuator::Attributes[] = { - KX_PYATTRIBUTE_FLOAT_RW("frameStart", 0, 300000, KX_IpoActuator, m_startframe), - KX_PYATTRIBUTE_FLOAT_RW("frameEnd", 0, 300000, KX_IpoActuator, m_endframe), - KX_PYATTRIBUTE_STRING_RW("propName", 0, 64, false, KX_IpoActuator, m_propname), - KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 64, false, KX_IpoActuator, m_framepropname), - KX_PYATTRIBUTE_INT_RW("mode", KX_ACT_IPO_NODEF+1, KX_ACT_IPO_MAX-1, true, KX_IpoActuator, m_type), - KX_PYATTRIBUTE_BOOL_RW("useIpoAsForce", KX_IpoActuator, m_ipo_as_force), - KX_PYATTRIBUTE_BOOL_RW("useIpoAdd", KX_IpoActuator, m_ipo_add), - KX_PYATTRIBUTE_BOOL_RW("useIpoLocal", KX_IpoActuator, m_ipo_local), - KX_PYATTRIBUTE_BOOL_RW("useChildren", KX_IpoActuator, m_recurse), - - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_IpoActuator.h b/source/gameengine/Ketsji/KX_IpoActuator.h deleted file mode 100644 index cefd00c4ae3..00000000000 --- a/source/gameengine/Ketsji/KX_IpoActuator.h +++ /dev/null @@ -1,144 +0,0 @@ -/** - * Do an object ipo - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_IPOACTUATOR -#define __KX_IPOACTUATOR - -#include "SCA_IActuator.h" - -class KX_IpoActuator : public SCA_IActuator -{ - Py_Header; -private: - /** Computes the IPO start time from the current time - and the current frame. */ - void SetStartTime(float curtime); - /** Computes the current frame from the current time - and the IPO start time. */ - void SetLocalTime(float curtime); - /** Ensures the current frame is between the start and - end frames. */ - bool ClampLocalTime(); - -protected: - bool m_bNegativeEvent; - - /** Begin frame of the ipo. */ - float m_startframe; - - /** End frame of the ipo. */ - float m_endframe; - - /** Include children in the transforms? */ - bool m_recurse; - - /** Current active frame of the ipo. */ - float m_localtime; - - /** The time this ipo started at. */ - float m_starttime; - - /** play backwards or forwards? (positive means forward). */ - float m_direction; - - /** Name of the property (only used in from_prop mode). */ - STR_String m_propname; - - /** Name of the property where we write the current frame number */ - STR_String m_framepropname; - - /** Interpret the ipo as a force? */ - bool m_ipo_as_force; - - /** Add Ipo curve to current loc/rot/scale */ - bool m_ipo_add; - - /** The Ipo curve is applied in local coordinates */ - bool m_ipo_local; - - bool m_bIpoPlaying; - -public: - enum IpoActType - { - KX_ACT_IPO_NODEF = 0, - KX_ACT_IPO_PLAY, - KX_ACT_IPO_PINGPONG, - KX_ACT_IPO_FLIPPER, - KX_ACT_IPO_LOOPSTOP, - KX_ACT_IPO_LOOPEND, - KX_ACT_IPO_KEY2KEY, - KX_ACT_IPO_FROM_PROP, - KX_ACT_IPO_MAX - }; - - static const char *S_KX_ACT_IPO_PLAY_STRING; - static const char *S_KX_ACT_IPO_PINGPONG_STRING; - static const char *S_KX_ACT_IPO_FLIPPER_STRING; - static const char *S_KX_ACT_IPO_LOOPSTOP_STRING; - static const char *S_KX_ACT_IPO_LOOPEND_STRING; - static const char *S_KX_ACT_IPO_KEY2KEY_STRING; - static const char *S_KX_ACT_IPO_FROM_PROP_STRING; - - int string2mode(char* modename); - - int m_type; - - KX_IpoActuator(SCA_IObject* gameobj, - const STR_String& propname, - const STR_String& framePropname, - float starttime, - float endtime, - bool recurse, - int acttype, - bool ipo_as_force, - bool ipo_add, - bool ipo_local); - virtual ~KX_IpoActuator() {}; - - virtual CValue* GetReplica() { - KX_IpoActuator* replica = new KX_IpoActuator(*this);//m_float,GetName()); - replica->ProcessReplica(); - return replica; - }; - - void SetStart(float starttime); - void SetEnd(float endtime); - virtual bool Update(double curtime, bool frame); - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - -}; - -#endif //__KX_IPOACTUATOR - diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp deleted file mode 100644 index 71cd8b36045..00000000000 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ /dev/null @@ -1,1918 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * The engine ties all game modules together. - */ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif //WIN32 - -#include - -#include "KX_KetsjiEngine.h" - -#include "ListValue.h" -#include "IntValue.h" -#include "VectorValue.h" -#include "BoolValue.h" -#include "FloatValue.h" - -#define KX_NUM_ITERATIONS 4 -#include "RAS_BucketManager.h" -#include "RAS_Rect.h" -#include "RAS_IRasterizer.h" -#include "RAS_IRenderTools.h" -#include "RAS_ICanvas.h" -#include "STR_String.h" -#include "MT_Vector3.h" -#include "MT_Transform.h" -#include "SCA_IInputDevice.h" -#include "KX_Scene.h" -#include "MT_CmMatrix4x4.h" -#include "KX_Camera.h" -#include "KX_Dome.h" -#include "KX_Light.h" -#include "KX_PythonInit.h" -#include "KX_PyConstraintBinding.h" -#include "PHY_IPhysicsEnvironment.h" - -#include "AUD_C-API.h" - -#include "NG_NetworkScene.h" -#include "NG_NetworkDeviceInterface.h" - -#include "KX_WorldInfo.h" -#include "KX_ISceneConverter.h" -#include "KX_TimeCategoryLogger.h" - -#include "RAS_FramingManager.h" -#include "stdio.h" -#include "DNA_world_types.h" -#include "DNA_scene_types.h" - -// If define: little test for Nzc: guarded drawing. If the canvas is -// not valid, skip rendering this frame. -//#define NZC_GUARDED_OUTPUT -#define DEFAULT_LOGIC_TIC_RATE 60.0 -#define DEFAULT_PHYSICS_TIC_RATE 60.0 - -const char KX_KetsjiEngine::m_profileLabels[tc_numCategories][15] = { - "Physics:", // tc_physics - "Logic", // tc_logic - "Network:", // tc_network - "Scenegraph:", // tc_scenegraph - "Sound:", // tc_sound - "Rasterizer:", // tc_rasterizer - "Services:", // tc_services - "Overhead:", // tc_overhead - "Outside:" // tc_outside -}; - -double KX_KetsjiEngine::m_ticrate = DEFAULT_LOGIC_TIC_RATE; -int KX_KetsjiEngine::m_maxLogicFrame = 5; -int KX_KetsjiEngine::m_maxPhysicsFrame = 5; -double KX_KetsjiEngine::m_anim_framerate = 25.0; -double KX_KetsjiEngine::m_suspendedtime = 0.0; -double KX_KetsjiEngine::m_suspendeddelta = 0.0; -double KX_KetsjiEngine::m_average_framerate = 0.0; - - -/** - * Constructor of the Ketsji Engine - */ -KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) - : m_canvas(NULL), - m_rasterizer(NULL), - m_kxsystem(system), - m_rendertools(NULL), - m_sceneconverter(NULL), - m_networkdevice(NULL), -#ifndef DISABLE_PYTHON - m_pythondictionary(NULL), -#endif - m_keyboarddevice(NULL), - m_mousedevice(NULL), - - m_propertiesPresent(false), - - m_bInitialized(false), - m_activecam(0), - m_bFixedTime(false), - - m_firstframe(true), - - m_frameTime(0.f), - m_clockTime(0.f), - m_previousClockTime(0.f), - - - m_exitcode(KX_EXIT_REQUEST_NO_REQUEST), - m_exitstring(""), - - m_drawingmode(5), - m_cameraZoom(1.0), - - m_overrideCam(false), - m_overrideCamUseOrtho(false), - m_overrideCamNear(0.0), - m_overrideCamFar(0.0), - - m_stereo(false), - m_curreye(0), - - m_logger(NULL), - - // Set up timing info display variables - m_show_framerate(false), - m_show_profile(false), - m_showProperties(false), - m_showBackground(false), - m_show_debug_properties(false), - - m_animation_record(false), - - // Default behavior is to hide the cursor every frame. - m_hideCursor(false), - - m_overrideFrameColor(false), - m_overrideFrameColorR(0.0), - m_overrideFrameColorG(0.0), - m_overrideFrameColorB(0.0), - - m_usedome(false) -{ - // Initialize the time logger - m_logger = new KX_TimeCategoryLogger (25); - - for (int i = tc_first; i < tc_numCategories; i++) - m_logger->AddCategory((KX_TimeCategory)i); - -} - - - -/** - * Destructor of the Ketsji Engine, release all memory - */ -KX_KetsjiEngine::~KX_KetsjiEngine() -{ - delete m_logger; - if(m_usedome) - delete m_dome; -} - - - -void KX_KetsjiEngine::SetKeyboardDevice(SCA_IInputDevice* keyboarddevice) -{ - MT_assert(keyboarddevice); - m_keyboarddevice = keyboarddevice; -} - - - -void KX_KetsjiEngine::SetMouseDevice(SCA_IInputDevice* mousedevice) -{ - MT_assert(mousedevice); - m_mousedevice = mousedevice; -} - - - -void KX_KetsjiEngine::SetNetworkDevice(NG_NetworkDeviceInterface* networkdevice) -{ - MT_assert(networkdevice); - m_networkdevice = networkdevice; -} - - -void KX_KetsjiEngine::SetCanvas(RAS_ICanvas* canvas) -{ - MT_assert(canvas); - m_canvas = canvas; -} - - - -void KX_KetsjiEngine::SetRenderTools(RAS_IRenderTools* rendertools) -{ - MT_assert(rendertools); - m_rendertools = rendertools; -} - - - -void KX_KetsjiEngine::SetRasterizer(RAS_IRasterizer* rasterizer) -{ - MT_assert(rasterizer); - m_rasterizer = rasterizer; -} - -#ifndef DISABLE_PYTHON -/* - * At the moment the GameLogic module is imported into 'pythondictionary' after this function is called. - * if this function ever changes to assign a copy, make sure the game logic module is imported into this dictionary before hand. - */ -void KX_KetsjiEngine::SetPyNamespace(PyObject* pythondictionary) -{ - MT_assert(pythondictionary); - m_pythondictionary = pythondictionary; -} -#endif - - -void KX_KetsjiEngine::SetSceneConverter(KX_ISceneConverter* sceneconverter) -{ - MT_assert(sceneconverter); - m_sceneconverter = sceneconverter; -} - -void KX_KetsjiEngine::InitDome(short res, short mode, short angle, float resbuf, short tilt, struct Text* text) -{ - m_dome = new KX_Dome(m_canvas, m_rasterizer, m_rendertools,this, res, mode, angle, resbuf, tilt, text); - m_usedome = true; -} - -void KX_KetsjiEngine::RenderDome() -{ - GLuint viewport[4]={0}; - glGetIntegerv(GL_VIEWPORT,(GLint *)viewport); - - m_dome->SetViewPort(viewport); - - KX_Scene* firstscene = *m_scenes.begin(); - const RAS_FrameSettings &framesettings = firstscene->GetFramingType(); - - m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true); - - // hiding mouse cursor each frame - // (came back when going out of focus and then back in again) - if (m_hideCursor) - m_canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); - - // clear the entire game screen with the border color - // only once per frame - - m_canvas->BeginDraw(); - - // BeginFrame() sets the actual drawing area. You can use a part of the window - if (!BeginFrame()) - return; - - KX_SceneList::iterator sceneit; - KX_Scene* scene; - - int n_renders=m_dome->GetNumberRenders();// usually 4 or 6 - for (int i=0;iClearBuffer(RAS_ICanvas::COLOR_BUFFER|RAS_ICanvas::DEPTH_BUFFER); - for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++) - // for each scene, call the proceed functions - { - scene = *sceneit; - KX_Camera* cam = scene->GetActiveCamera(); - - m_rendertools->BeginFrame(m_rasterizer); - // pass the scene's worldsettings to the rasterizer - SetWorldSettings(scene->GetWorldInfo()); - - // shadow buffers - if (i == 0){ - RenderShadowBuffers(scene); - } - // Avoid drawing the scene with the active camera twice when it's viewport is enabled - if(cam && !cam->GetViewport()) - { - if (scene->IsClearingZBuffer()) - m_rasterizer->ClearDepthBuffer(); - - m_rendertools->SetAuxilaryClientInfo(scene); - - // do the rendering - m_dome->RenderDomeFrame(scene,cam, i); - } - - list* cameras = scene->GetCameras(); - - // Draw the scene once for each camera with an enabled viewport - list::iterator it = cameras->begin(); - while(it != cameras->end()) - { - if((*it)->GetViewport()) - { - if (scene->IsClearingZBuffer()) - m_rasterizer->ClearDepthBuffer(); - - m_rendertools->SetAuxilaryClientInfo(scene); - - // do the rendering - m_dome->RenderDomeFrame(scene, (*it),i); - } - - it++; - } - // Part of PostRenderScene() - m_rendertools->MotionBlur(m_rasterizer); - scene->Render2DFilters(m_canvas); - // no RunDrawingCallBacks - // no FlushDebugLines - } - m_dome->BindImages(i); - } - - m_canvas->EndFrame();//XXX do we really need that? - - m_canvas->SetViewPort(0, 0, m_canvas->GetWidth(), m_canvas->GetHeight()); - - if (m_overrideFrameColor) //XXX why do we want - { - // Do not use the framing bar color set in the Blender scenes - m_canvas->ClearColor( - m_overrideFrameColorR, - m_overrideFrameColorG, - m_overrideFrameColorB, - 1.0 - ); - } - else - { - // Use the framing bar color set in the Blender scenes - m_canvas->ClearColor( - framesettings.BarRed(), - framesettings.BarGreen(), - framesettings.BarBlue(), - 1.0 - ); - } - m_dome->Draw(); - // Draw Callback for the last scene -#ifndef DISABLE_PYTHON - scene->RunDrawingCallbacks(scene->GetPostDrawCB()); -#endif - EndFrame(); -} - -/** - * Ketsji Init(), Initializes datastructures and converts data from - * Blender into Ketsji native (realtime) format also sets up the - * graphics context - */ -void KX_KetsjiEngine::StartEngine(bool clearIpo) -{ - m_clockTime = m_kxsystem->GetTimeInSeconds(); - m_frameTime = m_kxsystem->GetTimeInSeconds(); - m_previousClockTime = m_kxsystem->GetTimeInSeconds(); - - m_firstframe = true; - m_bInitialized = true; - // there is always one scene enabled at startup - Scene* scene = m_scenes[0]->GetBlenderScene(); - if (scene) - { - m_ticrate = scene->gm.ticrate ? scene->gm.ticrate : DEFAULT_LOGIC_TIC_RATE; - m_maxLogicFrame = scene->gm.maxlogicstep ? scene->gm.maxlogicstep : 5; - m_maxPhysicsFrame = scene->gm.maxphystep ? scene->gm.maxlogicstep : 5; - } - else - { - m_ticrate = DEFAULT_LOGIC_TIC_RATE; - m_maxLogicFrame = 5; - m_maxPhysicsFrame = 5; - } - - if (m_animation_record) - { - m_sceneconverter->ResetPhysicsObjectsAnimationIpo(clearIpo); - m_sceneconverter->WritePhysicsObjectToAnimationIpo(m_currentFrame); - } - -} - -void KX_KetsjiEngine::ClearFrame() -{ - // clear unless we're drawing overlapping stereo - if(m_rasterizer->InterlacedStereo() && - m_rasterizer->GetEye() == RAS_IRasterizer::RAS_STEREO_RIGHTEYE) - return; - - // clear the viewports with the background color of the first scene - bool doclear = false; - KX_SceneList::iterator sceneit; - RAS_Rect clearvp, area, viewport; - - for (sceneit = m_scenes.begin(); sceneit != m_scenes.end(); sceneit++) - { - KX_Scene* scene = *sceneit; - //const RAS_FrameSettings &framesettings = scene->GetFramingType(); - list* cameras = scene->GetCameras(); - - list::iterator it; - for(it = cameras->begin(); it != cameras->end(); it++) - { - GetSceneViewport(scene, (*it), area, viewport); - - if(!doclear) { - clearvp = viewport; - doclear = true; - } - else { - if(viewport.GetLeft() < clearvp.GetLeft()) - clearvp.SetLeft(viewport.GetLeft()); - if(viewport.GetBottom() < clearvp.GetBottom()) - clearvp.SetBottom(viewport.GetBottom()); - if(viewport.GetRight() > clearvp.GetRight()) - clearvp.SetRight(viewport.GetRight()); - if(viewport.GetTop() > clearvp.GetTop()) - clearvp.SetTop(viewport.GetTop()); - - } - } - } - - if(doclear) { - KX_Scene* firstscene = *m_scenes.begin(); - SetBackGround(firstscene->GetWorldInfo()); - - m_canvas->SetViewPort(clearvp.GetLeft(), clearvp.GetBottom(), - clearvp.GetRight(), clearvp.GetTop()); - m_rasterizer->ClearColorBuffer(); - } -} - -bool KX_KetsjiEngine::BeginFrame() -{ - // set the area used for rendering (stereo can assign only a subset) - m_rasterizer->SetRenderArea(); - - if (m_canvas->BeginDraw()) - { - ClearFrame(); - - m_rasterizer->BeginFrame(m_drawingmode , m_kxsystem->GetTimeInSeconds()); - m_rendertools->BeginFrame(m_rasterizer); - - return true; - } - - return false; -} - - -void KX_KetsjiEngine::EndFrame() -{ - // Show profiling info - m_logger->StartLog(tc_overhead, m_kxsystem->GetTimeInSeconds(), true); - if (m_show_framerate || m_show_profile || (m_show_debug_properties && m_propertiesPresent)) - { - RenderDebugProperties(); - } - - m_average_framerate = m_logger->GetAverage(); - if (m_average_framerate < 1e-6) - m_average_framerate = 1e-6; - m_average_framerate = 1.0/m_average_framerate; - - // Go to next profiling measurement, time spend after this call is shown in the next frame. - m_logger->NextMeasurement(m_kxsystem->GetTimeInSeconds()); - - m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true); - m_rasterizer->EndFrame(); - // swap backbuffer (drawing into this buffer) <-> front/visible buffer - m_rasterizer->SwapBuffers(); - m_rendertools->EndFrame(m_rasterizer); - - - m_canvas->EndDraw(); -} - -//#include "PIL_time.h" -//#include "LinearMath/btQuickprof.h" - - -bool KX_KetsjiEngine::NextFrame() -{ - double timestep = 1.0/m_ticrate; - double framestep = timestep; -// static hidden::Clock sClock; - -m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(),true); - -//float dt = sClock.getTimeMicroseconds() * 0.000001f; -//sClock.reset(); - -if (m_bFixedTime) - m_clockTime += timestep; -else -{ - -// m_clockTime += dt; - m_clockTime = m_kxsystem->GetTimeInSeconds(); -} - - double deltatime = m_clockTime - m_frameTime; - if (deltatime<0.f) - { - printf("problem with clock\n"); - deltatime = 0.f; - m_clockTime = 0.f; - m_frameTime = 0.f; - } - - - // Compute the number of logic frames to do each update (fixed tic bricks) - int frames =int(deltatime*m_ticrate+1e-6); -// if (frames>1) -// printf("****************************************"); -// printf("dt = %f, deltatime = %f, frames = %d\n",dt, deltatime,frames); - -// if (!frames) -// PIL_sleep_ms(1); - - KX_SceneList::iterator sceneit; - - if (frames>m_maxPhysicsFrame) - { - - // printf("framedOut: %d\n",frames); - m_frameTime+=(frames-m_maxPhysicsFrame)*timestep; - frames = m_maxPhysicsFrame; - } - - - bool doRender = frames>0; - - if (frames > m_maxLogicFrame) - { - framestep = (frames*timestep)/m_maxLogicFrame; - frames = m_maxLogicFrame; - } - - while (frames) - { - - - m_frameTime += framestep; - - for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit) - // for each scene, call the proceed functions - { - KX_Scene* scene = *sceneit; - - /* Suspension holds the physics and logic processing for an - * entire scene. Objects can be suspended individually, and - * the settings for that preceed the logic and physics - * update. */ - m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true); - - m_sceneconverter->resetNoneDynamicObjectToIpo();//this is for none dynamic objects with ipo - - scene->UpdateObjectActivity(); - - if (!scene->IsSuspended()) - { - // if the scene was suspended recalcutlate the delta tu "curtime" - m_suspendedtime = scene->getSuspendedTime(); - if (scene->getSuspendedTime()!=0.0) - scene->setSuspendedDelta(scene->getSuspendedDelta()+m_clockTime-scene->getSuspendedTime()); - m_suspendeddelta = scene->getSuspendedDelta(); - - - m_logger->StartLog(tc_network, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_NETWORK); - scene->GetNetworkScene()->proceed(m_frameTime); - - //m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); - //SG_SetActiveStage(SG_STAGE_NETWORK_UPDATE); - //scene->UpdateParents(m_frameTime); - - m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_PHYSICS1); - // set Python hooks for each scene -#ifndef DISABLE_PYTHON - PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment()); -#endif - KX_SetActiveScene(scene); - - scene->GetPhysicsEnvironment()->endFrame(); - - // Update scenegraph after physics step. This maps physics calculations - // into node positions. - //m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); - //SG_SetActiveStage(SG_STAGE_PHYSICS1_UPDATE); - //scene->UpdateParents(m_frameTime); - - // Process sensors, and controllers - m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_CONTROLLER); - scene->LogicBeginFrame(m_frameTime); - - // Scenegraph needs to be updated again, because Logic Controllers - // can affect the local matrices. - m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_CONTROLLER_UPDATE); - scene->UpdateParents(m_frameTime); - - // Process actuators - - // Do some cleanup work for this logic frame - m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_ACTUATOR); - scene->LogicUpdateFrame(m_frameTime, true); - - scene->LogicEndFrame(); - - // Actuators can affect the scenegraph - m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_ACTUATOR_UPDATE); - scene->UpdateParents(m_frameTime); - - m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_PHYSICS2); - scene->GetPhysicsEnvironment()->beginFrame(); - - // Perform physics calculations on the scene. This can involve - // many iterations of the physics solver. - scene->GetPhysicsEnvironment()->proceedDeltaTime(m_frameTime,timestep,framestep);//m_deltatimerealDeltaTime); - - m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_PHYSICS2_UPDATE); - scene->UpdateParents(m_frameTime); - - - if (m_animation_record) - { - m_sceneconverter->WritePhysicsObjectToAnimationIpo(++m_currentFrame); - } - - scene->setSuspendedTime(0.0); - } // suspended - else - if(scene->getSuspendedTime()==0.0) - scene->setSuspendedTime(m_clockTime); - - DoSound(scene); - - m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); - } - - // update system devices - m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true); - if (m_keyboarddevice) - m_keyboarddevice->NextFrame(); - - if (m_mousedevice) - m_mousedevice->NextFrame(); - - if (m_networkdevice) - m_networkdevice->NextFrame(); - - // scene management - ProcessScheduledScenes(); - - frames--; - } - - bool bUseAsyncLogicBricks= false;//true; - - if (bUseAsyncLogicBricks) - { - // Logic update sub frame: this will let some logic bricks run at the - // full frame rate. - for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit) - // for each scene, call the proceed functions - { - KX_Scene* scene = *sceneit; - - if (!scene->IsSuspended()) - { - // if the scene was suspended recalcutlate the delta tu "curtime" - m_suspendedtime = scene->getSuspendedTime(); - if (scene->getSuspendedTime()!=0.0) - scene->setSuspendedDelta(scene->getSuspendedDelta()+m_clockTime-scene->getSuspendedTime()); - m_suspendeddelta = scene->getSuspendedDelta(); - - // set Python hooks for each scene -#ifndef DISABLE_PYTHON - PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment()); -#endif - KX_SetActiveScene(scene); - - m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_PHYSICS1); - scene->UpdateParents(m_clockTime); - - // Perform physics calculations on the scene. This can involve - // many iterations of the physics solver. - m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true); - scene->GetPhysicsEnvironment()->proceedDeltaTime(m_clockTime,timestep,timestep); - // Update scenegraph after physics step. This maps physics calculations - // into node positions. - m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_PHYSICS2); - scene->UpdateParents(m_clockTime); - - // Do some cleanup work for this logic frame - m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true); - scene->LogicUpdateFrame(m_clockTime, false); - - // Actuators can affect the scenegraph - m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_ACTUATOR); - scene->UpdateParents(m_clockTime); - - scene->setSuspendedTime(0.0); - } // suspended - else - if(scene->getSuspendedTime()==0.0) - scene->setSuspendedTime(m_clockTime); - - DoSound(scene); - - m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); - } - } - - - m_previousClockTime = m_clockTime; - - // Start logging time spend outside main loop - m_logger->StartLog(tc_outside, m_kxsystem->GetTimeInSeconds(), true); - - return doRender; -} - - - -void KX_KetsjiEngine::Render() -{ - if(m_usedome){ - RenderDome(); - return; - } - KX_Scene* firstscene = *m_scenes.begin(); - const RAS_FrameSettings &framesettings = firstscene->GetFramingType(); - - m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_RENDER); - - // hiding mouse cursor each frame - // (came back when going out of focus and then back in again) - if (m_hideCursor) - m_canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); - - // clear the entire game screen with the border color - // only once per frame - m_canvas->BeginDraw(); - if (m_drawingmode == RAS_IRasterizer::KX_TEXTURED) { - m_canvas->SetViewPort(0, 0, m_canvas->GetWidth(), m_canvas->GetHeight()); - if (m_overrideFrameColor) - { - // Do not use the framing bar color set in the Blender scenes - m_canvas->ClearColor( - m_overrideFrameColorR, - m_overrideFrameColorG, - m_overrideFrameColorB, - 1.0 - ); - } - else - { - // Use the framing bar color set in the Blender scenes - m_canvas->ClearColor( - framesettings.BarRed(), - framesettings.BarGreen(), - framesettings.BarBlue(), - 1.0 - ); - } - // clear the -whole- viewport - m_canvas->ClearBuffer(RAS_ICanvas::COLOR_BUFFER|RAS_ICanvas::DEPTH_BUFFER); - } - - m_rasterizer->SetEye(RAS_IRasterizer::RAS_STEREO_LEFTEYE); - - // BeginFrame() sets the actual drawing area. You can use a part of the window - if (!BeginFrame()) - return; - - KX_SceneList::iterator sceneit; - for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++) - // for each scene, call the proceed functions - { - KX_Scene* scene = *sceneit; - KX_Camera* cam = scene->GetActiveCamera(); - // pass the scene's worldsettings to the rasterizer - SetWorldSettings(scene->GetWorldInfo()); - - // this is now done incrementatlly in KX_Scene::CalculateVisibleMeshes - //scene->UpdateMeshTransformations(); - - // shadow buffers - RenderShadowBuffers(scene); - - // Avoid drawing the scene with the active camera twice when it's viewport is enabled - if(cam && !cam->GetViewport()) - { - if (scene->IsClearingZBuffer()) - m_rasterizer->ClearDepthBuffer(); - - m_rendertools->SetAuxilaryClientInfo(scene); - - // do the rendering - RenderFrame(scene, cam); - } - - list* cameras = scene->GetCameras(); - - // Draw the scene once for each camera with an enabled viewport - list::iterator it = cameras->begin(); - while(it != cameras->end()) - { - if((*it)->GetViewport()) - { - if (scene->IsClearingZBuffer()) - m_rasterizer->ClearDepthBuffer(); - - m_rendertools->SetAuxilaryClientInfo(scene); - - // do the rendering - RenderFrame(scene, (*it)); - } - - it++; - } - PostRenderScene(scene); - } - - // only one place that checks for stereo - if(m_rasterizer->Stereo()) - { - m_rasterizer->SetEye(RAS_IRasterizer::RAS_STEREO_RIGHTEYE); - - if (!BeginFrame()) - return; - - - for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++) - // for each scene, call the proceed functions - { - KX_Scene* scene = *sceneit; - KX_Camera* cam = scene->GetActiveCamera(); - - // pass the scene's worldsettings to the rasterizer - SetWorldSettings(scene->GetWorldInfo()); - - if (scene->IsClearingZBuffer()) - m_rasterizer->ClearDepthBuffer(); - - //pass the scene, for picking and raycasting (shadows) - m_rendertools->SetAuxilaryClientInfo(scene); - - // do the rendering - //RenderFrame(scene); - RenderFrame(scene, cam); - - list* cameras = scene->GetCameras(); - - // Draw the scene once for each camera with an enabled viewport - list::iterator it = cameras->begin(); - while(it != cameras->end()) - { - if((*it)->GetViewport()) - { - if (scene->IsClearingZBuffer()) - m_rasterizer->ClearDepthBuffer(); - - m_rendertools->SetAuxilaryClientInfo(scene); - - // do the rendering - RenderFrame(scene, (*it)); - } - - it++; - } - PostRenderScene(scene); - } - } // if(m_rasterizer->Stereo()) - - EndFrame(); -} - - - -void KX_KetsjiEngine::RequestExit(int exitrequestmode) -{ - m_exitcode = exitrequestmode; -} - - - -void KX_KetsjiEngine::SetNameNextGame(const STR_String& nextgame) -{ - m_exitstring = nextgame; -} - - - -int KX_KetsjiEngine::GetExitCode() -{ - // if a gameactuator has set an exitcode or if there are no scenes left - if (!m_exitcode) - { - if (m_scenes.begin()==m_scenes.end()) - m_exitcode = KX_EXIT_REQUEST_NO_SCENES_LEFT; - } - - return m_exitcode; -} - - - -const STR_String& KX_KetsjiEngine::GetExitString() -{ - return m_exitstring; -} - - - -void KX_KetsjiEngine::DoSound(KX_Scene* scene) -{ - m_logger->StartLog(tc_sound, m_kxsystem->GetTimeInSeconds(), true); - - KX_Camera* cam = scene->GetActiveCamera(); - if (!cam) - return; - MT_Point3 listenerposition = cam->NodeGetWorldPosition(); - MT_Vector3 listenervelocity = cam->GetLinearVelocity(); - MT_Matrix3x3 listenerorientation = cam->NodeGetWorldOrientation(); - - { - AUD_3DData data; - float f; - - listenerorientation.getValue3x3(data.orientation); - listenerposition.getValue(data.position); - listenervelocity.getValue(data.velocity); - - f = data.position[1]; - data.position[1] = data.position[2]; - data.position[2] = -f; - - f = data.velocity[1]; - data.velocity[1] = data.velocity[2]; - data.velocity[2] = -f; - - f = data.orientation[1]; - data.orientation[1] = data.orientation[2]; - data.orientation[2] = -f; - - f = data.orientation[3]; - data.orientation[3] = -data.orientation[6]; - data.orientation[6] = f; - - f = data.orientation[4]; - data.orientation[4] = -data.orientation[8]; - data.orientation[8] = -f; - - f = data.orientation[5]; - data.orientation[5] = data.orientation[7]; - data.orientation[7] = f; - - AUD_updateListener(&data); - } -} - - - -void KX_KetsjiEngine::SetBackGround(KX_WorldInfo* wi) -{ - if (wi->hasWorld()) - { - if (m_drawingmode == RAS_IRasterizer::KX_TEXTURED) - { - m_rasterizer->SetBackColor( - wi->getBackColorRed(), - wi->getBackColorGreen(), - wi->getBackColorBlue(), - 0.0 - ); - } - } -} - - - -void KX_KetsjiEngine::SetWorldSettings(KX_WorldInfo* wi) -{ - if (wi->hasWorld()) - { - // ... - m_rasterizer->SetAmbientColor( - wi->getAmbientColorRed(), - wi->getAmbientColorGreen(), - wi->getAmbientColorBlue() - ); - - if (m_drawingmode >= RAS_IRasterizer::KX_SOLID) - { - if (wi->hasMist()) - { - m_rasterizer->SetFog( - wi->getMistStart(), - wi->getMistDistance(), - wi->getMistColorRed(), - wi->getMistColorGreen(), - wi->getMistColorBlue() - ); - } - } - } -} - - - -void KX_KetsjiEngine::SetDrawType(int drawingmode) -{ - m_drawingmode = drawingmode; -} - - - -void KX_KetsjiEngine::EnableCameraOverride(const STR_String& forscene) -{ - m_overrideCam = true; - m_overrideSceneName = forscene; -} - - - -void KX_KetsjiEngine::SetCameraZoom(float camzoom) -{ - m_cameraZoom = camzoom; -} - - - -void KX_KetsjiEngine::SetCameraOverrideUseOrtho(bool useOrtho) -{ - m_overrideCamUseOrtho = useOrtho; -} - - - -void KX_KetsjiEngine::SetCameraOverrideProjectionMatrix(const MT_CmMatrix4x4& mat) -{ - m_overrideCamProjMat = mat; -} - - -void KX_KetsjiEngine::SetCameraOverrideViewMatrix(const MT_CmMatrix4x4& mat) -{ - m_overrideCamViewMat = mat; -} - -void KX_KetsjiEngine::SetCameraOverrideClipping(float near, float far) -{ - m_overrideCamNear = near; - m_overrideCamFar = far; -} - -void KX_KetsjiEngine::SetCameraOverrideLens(float lens) -{ - m_overrideCamLens = lens; -} - -void KX_KetsjiEngine::GetSceneViewport(KX_Scene *scene, KX_Camera* cam, RAS_Rect& area, RAS_Rect& viewport) -{ - // In this function we make sure the rasterizer settings are upto - // date. We compute the viewport so that logic - // using this information is upto date. - - // Note we postpone computation of the projection matrix - // so that we are using the latest camera position. - if (cam->GetViewport()) { - RAS_Rect userviewport; - - userviewport.SetLeft(cam->GetViewportLeft()); - userviewport.SetBottom(cam->GetViewportBottom()); - userviewport.SetRight(cam->GetViewportRight()); - userviewport.SetTop(cam->GetViewportTop()); - - // Don't do bars on user specified viewport - RAS_FrameSettings settings = scene->GetFramingType(); - if(settings.FrameType() == RAS_FrameSettings::e_frame_bars) - settings.SetFrameType(RAS_FrameSettings::e_frame_extend); - - RAS_FramingManager::ComputeViewport( - scene->GetFramingType(), - userviewport, - viewport - ); - - area = userviewport; - } - else if ( !m_overrideCam || (scene->GetName() != m_overrideSceneName) || m_overrideCamUseOrtho ) { - RAS_FramingManager::ComputeViewport( - scene->GetFramingType(), - m_canvas->GetDisplayArea(), - viewport - ); - - area = m_canvas->GetDisplayArea(); - } else { - viewport.SetLeft(0); - viewport.SetBottom(0); - viewport.SetRight(int(m_canvas->GetWidth())); - viewport.SetTop(int(m_canvas->GetHeight())); - - area = m_canvas->GetDisplayArea(); - } -} - -void KX_KetsjiEngine::RenderShadowBuffers(KX_Scene *scene) -{ - CListValue *lightlist = scene->GetLightList(); - int i, drawmode; - - m_rendertools->SetAuxilaryClientInfo(scene); - - for(i=0; iGetCount(); i++) { - KX_GameObject *gameobj = (KX_GameObject*)lightlist->GetValue(i); - - KX_LightObject *light = (KX_LightObject*)gameobj; - - light->Update(); - - if(m_drawingmode == RAS_IRasterizer::KX_TEXTURED && light->HasShadowBuffer()) { - /* make temporary camera */ - RAS_CameraData camdata = RAS_CameraData(); - KX_Camera *cam = new KX_Camera(scene, scene->m_callbacks, camdata, true, true); - cam->SetName("__shadow__cam__"); - - MT_Transform camtrans; - - /* switch drawmode for speed */ - drawmode = m_rasterizer->GetDrawingMode(); - m_rasterizer->SetDrawingMode(RAS_IRasterizer::KX_SHADOW); - - /* binds framebuffer object, sets up camera .. */ - light->BindShadowBuffer(m_rasterizer, cam, camtrans); - - /* update scene */ - scene->CalculateVisibleMeshes(m_rasterizer, cam, light->GetShadowLayer()); - - /* render */ - m_rasterizer->ClearDepthBuffer(); - scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools); - - /* unbind framebuffer object, restore drawmode, free camera */ - light->UnbindShadowBuffer(m_rasterizer); - m_rasterizer->SetDrawingMode(drawmode); - cam->Release(); - } - } -} - -// update graphics -void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) -{ - bool override_camera; - RAS_Rect viewport, area; - float nearfrust, farfrust, focallength; -// KX_Camera* cam = scene->GetActiveCamera(); - - if (!cam) - return; - GetSceneViewport(scene, cam, area, viewport); - - // store the computed viewport in the scene - scene->SetSceneViewport(viewport); - - // set the viewport for this frame and scene - m_canvas->SetViewPort(viewport.GetLeft(), viewport.GetBottom(), - viewport.GetRight(), viewport.GetTop()); - - // see KX_BlenderMaterial::Activate - //m_rasterizer->SetAmbient(); - m_rasterizer->DisplayFog(); - - override_camera = m_overrideCam && (scene->GetName() == m_overrideSceneName); - override_camera = override_camera && (cam->GetName() == "__default__cam__"); - - if (override_camera && m_overrideCamUseOrtho) { - m_rasterizer->SetProjectionMatrix(m_overrideCamProjMat); - if (!cam->hasValidProjectionMatrix()) { - // needed to get frustrum planes for culling - MT_Matrix4x4 projmat; - projmat.setValue(m_overrideCamProjMat.getPointer()); - cam->SetProjectionMatrix(projmat); - } - } else if (cam->hasValidProjectionMatrix() && !cam->GetViewport() ) - { - m_rasterizer->SetProjectionMatrix(cam->GetProjectionMatrix()); - } else - { - RAS_FrameFrustum frustum; - bool orthographic = !cam->GetCameraData()->m_perspective; - nearfrust = cam->GetCameraNear(); - farfrust = cam->GetCameraFar(); - focallength = cam->GetFocalLength(); - MT_Matrix4x4 projmat; - - if(override_camera) { - nearfrust = m_overrideCamNear; - farfrust = m_overrideCamFar; - } - - if (orthographic) { - - RAS_FramingManager::ComputeOrtho( - scene->GetFramingType(), - area, - viewport, - cam->GetScale(), - nearfrust, - farfrust, - frustum - ); - if (!cam->GetViewport()) { - frustum.x1 *= m_cameraZoom; - frustum.x2 *= m_cameraZoom; - frustum.y1 *= m_cameraZoom; - frustum.y2 *= m_cameraZoom; - } - projmat = m_rasterizer->GetOrthoMatrix( - frustum.x1, frustum.x2, frustum.y1, frustum.y2, frustum.camnear, frustum.camfar); - - } else { - RAS_FramingManager::ComputeFrustum( - scene->GetFramingType(), - area, - viewport, - cam->GetLens(), - nearfrust, - farfrust, - frustum - ); - - if (!cam->GetViewport()) { - frustum.x1 *= m_cameraZoom; - frustum.x2 *= m_cameraZoom; - frustum.y1 *= m_cameraZoom; - frustum.y2 *= m_cameraZoom; - } - projmat = m_rasterizer->GetFrustumMatrix( - frustum.x1, frustum.x2, frustum.y1, frustum.y2, frustum.camnear, frustum.camfar, focallength); - } - cam->SetProjectionMatrix(projmat); - - // Otherwise the projection matrix for each eye will be the same... - if (!orthographic && m_rasterizer->Stereo()) - cam->InvalidateProjectionMatrix(); - } - - MT_Transform camtrans(cam->GetWorldToCamera()); - MT_Matrix4x4 viewmat(camtrans); - - m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->GetCameraData()->m_perspective); - cam->SetModelviewMatrix(viewmat); - - // The following actually reschedules all vertices to be - // redrawn. There is a cache between the actual rescheduling - // and this call though. Visibility is imparted when this call - // runs through the individual objects. - - m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_CULLING); - - scene->CalculateVisibleMeshes(m_rasterizer,cam); - - m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true); - SG_SetActiveStage(SG_STAGE_RENDER); - -#ifndef DISABLE_PYTHON - // Run any pre-drawing python callbacks - scene->RunDrawingCallbacks(scene->GetPreDrawCB()); -#endif - - scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools); - - if (scene->GetPhysicsEnvironment()) - scene->GetPhysicsEnvironment()->debugDrawWorld(); -} -/* -To run once per scene -*/ -void KX_KetsjiEngine::PostRenderScene(KX_Scene* scene) -{ - m_rendertools->MotionBlur(m_rasterizer); - scene->Render2DFilters(m_canvas); -#ifndef DISABLE_PYTHON - scene->RunDrawingCallbacks(scene->GetPostDrawCB()); -#endif - m_rasterizer->FlushDebugLines(); -} - -void KX_KetsjiEngine::StopEngine() -{ - if (m_bInitialized) - { - - if (m_animation_record) - { -// printf("TestHandlesPhysicsObjectToAnimationIpo\n"); - m_sceneconverter->TestHandlesPhysicsObjectToAnimationIpo(); - } - - KX_SceneList::iterator sceneit; - for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++) - { - KX_Scene* scene = *sceneit; - m_sceneconverter->RemoveScene(scene); - } - m_scenes.clear(); - - // cleanup all the stuff - m_rasterizer->Exit(); - } -} - -// Scene Management is able to switch between scenes -// and have several scene's running in parallel -void KX_KetsjiEngine::AddScene(KX_Scene* scene) -{ - m_scenes.push_back(scene); - PostProcessScene(scene); - SceneListsChanged(); -} - - - -void KX_KetsjiEngine::PostProcessScene(KX_Scene* scene) -{ - bool override_camera = (m_overrideCam && (scene->GetName() == m_overrideSceneName)); - - SG_SetActiveStage(SG_STAGE_SCENE); - - // if there is no activecamera, or the camera is being - // overridden we need to construct a temporarily camera - if (!scene->GetActiveCamera() || override_camera) - { - KX_Camera* activecam = NULL; - - RAS_CameraData camdata = RAS_CameraData(); - if (override_camera) camdata.m_lens = m_overrideCamLens; - - activecam = new KX_Camera(scene,KX_Scene::m_callbacks,camdata); - activecam->SetName("__default__cam__"); - - // set transformation - if (override_camera) { - const MT_CmMatrix4x4& cammatdata = m_overrideCamViewMat; - MT_Transform trans = MT_Transform(cammatdata.getPointer()); - MT_Transform camtrans; - camtrans.invert(trans); - - activecam->NodeSetLocalPosition(camtrans.getOrigin()); - activecam->NodeSetLocalOrientation(camtrans.getBasis()); - activecam->NodeUpdateGS(0); - } else { - activecam->NodeSetLocalPosition(MT_Point3(0.0, 0.0, 0.0)); - activecam->NodeSetLocalOrientation(MT_Vector3(0.0, 0.0, 0.0)); - activecam->NodeUpdateGS(0); - } - - scene->AddCamera(activecam); - scene->SetActiveCamera(activecam); - scene->GetObjectList()->Add(activecam->AddRef()); - scene->GetRootParentList()->Add(activecam->AddRef()); - //done with activecam - activecam->Release(); - } - - scene->UpdateParents(0.0); -} - - - -void KX_KetsjiEngine::RenderDebugProperties() -{ - STR_String debugtxt; - int xcoord = 10; // mmmm, these constants were taken from blender source - int ycoord = 14; // to 'mimic' behaviour - - float tottime = m_logger->GetAverage(); - if (tottime < 1e-6f) { - tottime = 1e-6f; - } - - // Set viewport to entire canvas - RAS_Rect viewport; - m_canvas->SetViewPort(0, 0, int(m_canvas->GetWidth()), int(m_canvas->GetHeight())); - - /* Framerate display */ - if (m_show_framerate) { - debugtxt.Format("swap : %.3f (%.3f frames per second)", tottime, 1.0/tottime); - m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, - debugtxt.Ptr(), - xcoord, - ycoord, - m_canvas->GetWidth() /* RdV, TODO ?? */, - m_canvas->GetHeight() /* RdV, TODO ?? */); - ycoord += 14; - } - - /* Profile and framerate display */ - if (m_show_profile) - { - for (int j = tc_first; j < tc_numCategories; j++) - { - debugtxt.Format(m_profileLabels[j]); - m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, - debugtxt.Ptr(), - xcoord,ycoord, - m_canvas->GetWidth(), - m_canvas->GetHeight()); - double time = m_logger->GetAverage((KX_TimeCategory)j); - debugtxt.Format("%.3fms (%2.2f %%)", time*1000.f, time/tottime * 100.f); - m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, - debugtxt.Ptr(), - xcoord + 60 ,ycoord, - m_canvas->GetWidth(), - m_canvas->GetHeight()); - ycoord += 14; - } - } - - /* Property display*/ - if (m_show_debug_properties && m_propertiesPresent) - { - KX_SceneList::iterator sceneit; - for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++) - { - KX_Scene* scene = *sceneit; - /* the 'normal' debug props */ - vector& debugproplist = scene->GetDebugProperties(); - - for (vector::iterator it = debugproplist.begin(); - !(it==debugproplist.end());it++) - { - CValue* propobj = (*it)->m_obj; - STR_String objname = propobj->GetName(); - STR_String propname = (*it)->m_name; - if (propname == "__state__") - { - // reserve name for object state - KX_GameObject* gameobj = static_cast(propobj); - unsigned int state = gameobj->GetState(); - debugtxt = objname + "." + propname + " = "; - bool first = true; - for (int statenum=1;state;state >>= 1, statenum++) - { - if (state & 1) - { - if (!first) - { - debugtxt += ","; - } - debugtxt += STR_String(statenum); - first = false; - } - } - m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, - debugtxt.Ptr(), - xcoord, - ycoord, - m_canvas->GetWidth(), - m_canvas->GetHeight()); - ycoord += 14; - } - else - { - CValue* propval = propobj->GetProperty(propname); - if (propval) - { - STR_String text = propval->GetText(); - debugtxt = objname + "." + propname + " = " + text; - m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, - debugtxt.Ptr(), - xcoord, - ycoord, - m_canvas->GetWidth(), - m_canvas->GetHeight()); - ycoord += 14; - } - } - } - } - } -} - - -KX_SceneList* KX_KetsjiEngine::CurrentScenes() -{ - return &m_scenes; -} - - - -KX_Scene* KX_KetsjiEngine::FindScene(const STR_String& scenename) -{ - KX_SceneList::iterator sceneit = m_scenes.begin(); - - // bit risky :) better to split the second clause - while ( (sceneit != m_scenes.end()) - && ((*sceneit)->GetName() != scenename)) - { - sceneit++; - } - - return ((sceneit == m_scenes.end()) ? NULL : *sceneit); -} - - - -void KX_KetsjiEngine::ConvertAndAddScene(const STR_String& scenename,bool overlay) -{ - // only add scene when it doesn't exist! - if (FindScene(scenename)) - { - STR_String tmpname = scenename; - printf("warning: scene %s already exists, not added!\n",tmpname.Ptr()); - } - else - { - if (overlay) - { - m_addingOverlayScenes.insert(scenename); - } - else - { - m_addingBackgroundScenes.insert(scenename); - } - } -} - - - - -void KX_KetsjiEngine::RemoveScene(const STR_String& scenename) -{ - if (FindScene(scenename)) - { - m_removingScenes.insert(scenename); - } - else - { -// STR_String tmpname = scenename; - std::cout << "warning: scene " << scenename << " does not exist, not removed!" << std::endl; - } -} - - - -void KX_KetsjiEngine::RemoveScheduledScenes() -{ - if (m_removingScenes.size()) - { - set::iterator scenenameit; - for (scenenameit=m_removingScenes.begin();scenenameit != m_removingScenes.end();scenenameit++) - { - STR_String scenename = *scenenameit; - - KX_SceneList::iterator sceneit; - for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++) - { - KX_Scene* scene = *sceneit; - if (scene->GetName()==scenename) - { - m_sceneconverter->RemoveScene(scene); - m_scenes.erase(sceneit); - break; - } - } - } - m_removingScenes.clear(); - } -} - -KX_Scene* KX_KetsjiEngine::CreateScene(Scene *scene) -{ - KX_Scene* tmpscene = new KX_Scene(m_keyboarddevice, - m_mousedevice, - m_networkdevice, - scene->id.name+2, - scene, - m_canvas); - - m_sceneconverter->ConvertScene(tmpscene, - m_rendertools, - m_canvas); - - return tmpscene; -} - -KX_Scene* KX_KetsjiEngine::CreateScene(const STR_String& scenename) -{ - Scene *scene = m_sceneconverter->GetBlenderSceneForName(scenename); - return CreateScene(scene); -} - -void KX_KetsjiEngine::AddScheduledScenes() -{ - set::iterator scenenameit; - - if (m_addingOverlayScenes.size()) - { - for (scenenameit = m_addingOverlayScenes.begin(); - scenenameit != m_addingOverlayScenes.end(); - scenenameit++) - { - STR_String scenename = *scenenameit; - KX_Scene* tmpscene = CreateScene(scenename); - m_scenes.push_back(tmpscene); - PostProcessScene(tmpscene); - } - m_addingOverlayScenes.clear(); - } - - if (m_addingBackgroundScenes.size()) - { - for (scenenameit = m_addingBackgroundScenes.begin(); - scenenameit != m_addingBackgroundScenes.end(); - scenenameit++) - { - STR_String scenename = *scenenameit; - KX_Scene* tmpscene = CreateScene(scenename); - m_scenes.insert(m_scenes.begin(),tmpscene); - PostProcessScene(tmpscene); - - } - m_addingBackgroundScenes.clear(); - } -} - - - -void KX_KetsjiEngine::ReplaceScene(const STR_String& oldscene,const STR_String& newscene) -{ - m_replace_scenes.insert(std::make_pair(oldscene,newscene)); -} - -// replace scene is not the same as removing and adding because the -// scene must be in exact the same place (to maintain drawingorder) -// (nzc) - should that not be done with a scene-display list? It seems -// stupid to rely on the mem allocation order... -void KX_KetsjiEngine::ReplaceScheduledScenes() -{ - if (m_replace_scenes.size()) - { - set >::iterator scenenameit; - - for (scenenameit = m_replace_scenes.begin(); - scenenameit != m_replace_scenes.end(); - scenenameit++) - { - STR_String oldscenename = (*scenenameit).first; - STR_String newscenename = (*scenenameit).second; - int i=0; - /* Scenes are not supposed to be included twice... I think */ - KX_SceneList::iterator sceneit; - for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++) - { - KX_Scene* scene = *sceneit; - if (scene->GetName() == oldscenename) - { - m_sceneconverter->RemoveScene(scene); - KX_Scene* tmpscene = CreateScene(newscenename); - m_scenes[i]=tmpscene; - PostProcessScene(tmpscene); - } - i++; - } - } - m_replace_scenes.clear(); - } -} - - - -void KX_KetsjiEngine::SuspendScene(const STR_String& scenename) -{ - KX_Scene* scene = FindScene(scenename); - if (scene) scene->Suspend(); -} - - - -void KX_KetsjiEngine::ResumeScene(const STR_String& scenename) -{ - KX_Scene* scene = FindScene(scenename); - if (scene) scene->Resume(); -} - - - -void KX_KetsjiEngine::SetUseFixedTime(bool bUseFixedTime) -{ - m_bFixedTime = bUseFixedTime; -} - - -void KX_KetsjiEngine::SetAnimRecordMode(bool animation_record, int startFrame) -{ - m_animation_record = animation_record; - if (animation_record) - { - //when recording physics keyframes, always run at a fixed framerate - m_bFixedTime = true; - } - m_currentFrame = startFrame; -} - -bool KX_KetsjiEngine::GetUseFixedTime(void) const -{ - return m_bFixedTime; -} - -double KX_KetsjiEngine::GetSuspendedDelta() -{ - return m_suspendeddelta; -} - -double KX_KetsjiEngine::GetTicRate() -{ - return m_ticrate; -} - -void KX_KetsjiEngine::SetTicRate(double ticrate) -{ - m_ticrate = ticrate; -} - -int KX_KetsjiEngine::GetMaxLogicFrame() -{ - return m_maxLogicFrame; -} - -void KX_KetsjiEngine::SetMaxLogicFrame(int frame) -{ - m_maxLogicFrame = frame; -} - -int KX_KetsjiEngine::GetMaxPhysicsFrame() -{ - return m_maxPhysicsFrame; -} - -void KX_KetsjiEngine::SetMaxPhysicsFrame(int frame) -{ - m_maxPhysicsFrame = frame; -} - -double KX_KetsjiEngine::GetAnimFrameRate() -{ - return m_anim_framerate; -} - -double KX_KetsjiEngine::GetClockTime(void) const -{ - return m_clockTime; -} - -double KX_KetsjiEngine::GetFrameTime(void) const -{ - return m_frameTime; -} - -double KX_KetsjiEngine::GetRealTime(void) const -{ - return m_kxsystem->GetTimeInSeconds(); -} - -void KX_KetsjiEngine::SetAnimFrameRate(double framerate) -{ - m_anim_framerate = framerate; -} - -double KX_KetsjiEngine::GetAverageFrameRate() -{ - return m_average_framerate; -} - -void KX_KetsjiEngine::SetTimingDisplay(bool frameRate, bool profile, bool properties) -{ - m_show_framerate = frameRate; - m_show_profile = profile; - m_show_debug_properties = properties; -} - - - -void KX_KetsjiEngine::GetTimingDisplay(bool& frameRate, bool& profile, bool& properties) const -{ - frameRate = m_show_framerate; - profile = m_show_profile; - properties = m_show_debug_properties; -} - - - -void KX_KetsjiEngine::ProcessScheduledScenes(void) -{ - // Check whether there will be changes to the list of scenes - if (m_addingOverlayScenes.size() || - m_addingBackgroundScenes.size() || - m_replace_scenes.size() || - m_removingScenes.size()) { - - // Change the scene list - ReplaceScheduledScenes(); - RemoveScheduledScenes(); - AddScheduledScenes(); - - // Notify - SceneListsChanged(); - } -} - - - -void KX_KetsjiEngine::SceneListsChanged(void) -{ - m_propertiesPresent = false; - KX_SceneList::iterator sceneit = m_scenes.begin(); - while ((sceneit != m_scenes.end()) && (!m_propertiesPresent)) - { - KX_Scene* scene = *sceneit; - vector& debugproplist = scene->GetDebugProperties(); - m_propertiesPresent = !debugproplist.empty(); - sceneit++; - } -} - - -void KX_KetsjiEngine::SetHideCursor(bool hideCursor) -{ - m_hideCursor = hideCursor; -} - - -bool KX_KetsjiEngine::GetHideCursor(void) const -{ - return m_hideCursor; -} - - -void KX_KetsjiEngine::SetUseOverrideFrameColor(bool overrideFrameColor) -{ - m_overrideFrameColor = overrideFrameColor; -} - - -bool KX_KetsjiEngine::GetUseOverrideFrameColor(void) const -{ - return m_overrideFrameColor; -} - - -void KX_KetsjiEngine::SetOverrideFrameColor(float r, float g, float b) -{ - m_overrideFrameColorR = r; - m_overrideFrameColorG = g; - m_overrideFrameColorB = b; -} - - -void KX_KetsjiEngine::GetOverrideFrameColor(float& r, float& g, float& b) const -{ - r = m_overrideFrameColorR; - g = m_overrideFrameColorG; - b = m_overrideFrameColorB; -} - - diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h deleted file mode 100644 index b3549c5fdab..00000000000 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ /dev/null @@ -1,422 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ -#ifndef __KX_KETSJI_ENGINE -#define __KX_KETSJI_ENGINE - -#include "MT_CmMatrix4x4.h" -#include "MT_Matrix4x4.h" -#include "STR_String.h" -#include "KX_ISystem.h" -#include "KX_Scene.h" -#include "KX_Python.h" -#include "KX_WorldInfo.h" -#include -#include - -class KX_TimeCategoryLogger; - -#define LEFT_EYE 1 -#define RIGHT_EYE 2 - -enum KX_ExitRequestMode -{ - KX_EXIT_REQUEST_NO_REQUEST = 0, - KX_EXIT_REQUEST_QUIT_GAME, - KX_EXIT_REQUEST_RESTART_GAME, - KX_EXIT_REQUEST_START_OTHER_GAME, - KX_EXIT_REQUEST_NO_SCENES_LEFT, - KX_EXIT_REQUEST_BLENDER_ESC, - KX_EXIT_REQUEST_OUTSIDE, - KX_EXIT_REQUEST_MAX -}; - -/** - * KX_KetsjiEngine is the core game engine class. - */ -class KX_KetsjiEngine -{ - -private: - class RAS_ICanvas* m_canvas; // 2D Canvas (2D Rendering Device Context) - class RAS_IRasterizer* m_rasterizer; // 3D Rasterizer (3D Rendering) - class KX_ISystem* m_kxsystem; - class RAS_IRenderTools* m_rendertools; - class KX_ISceneConverter* m_sceneconverter; - class NG_NetworkDeviceInterface* m_networkdevice; -#ifndef DISABLE_PYTHON - PyObject* m_pythondictionary; -#endif - class SCA_IInputDevice* m_keyboarddevice; - class SCA_IInputDevice* m_mousedevice; - class KX_Dome* m_dome; // dome stereo mode - - /** Lists of scenes scheduled to be removed at the end of the frame. */ - std::set m_removingScenes; - /** Lists of overley scenes scheduled to be added at the end of the frame. */ - std::set m_addingOverlayScenes; - /** Lists of background scenes scheduled to be added at the end of the frame. */ - std::set m_addingBackgroundScenes; - /** Lists of scenes scheduled to be replaced at the end of the frame. */ - std::set > m_replace_scenes; - - /* The current list of scenes. */ - KX_SceneList m_scenes; - /* State variable recording the presence of object debug info in the current scene list. */ - bool m_propertiesPresent; - - bool m_bInitialized; - int m_activecam; - bool m_bFixedTime; - - - bool m_firstframe; - int m_currentFrame; - - double m_frameTime;//discrete timestamp of the 'game logic frame' - double m_clockTime;//current time - double m_previousClockTime;//previous clock time - double m_remainingTime; - - static int m_maxLogicFrame; /* maximum number of consecutive logic frame */ - static int m_maxPhysicsFrame; /* maximum number of consecutive physics frame */ - static double m_ticrate; - static double m_anim_framerate; /* for animation playback only - ipo and action */ - - static double m_suspendedtime; - static double m_suspendeddelta; - - int m_exitcode; - STR_String m_exitstring; - /** - * Some drawing parameters, the drawing mode - * (wire/flat/texture), and the camera zoom - * factor. - */ - int m_drawingmode; - float m_cameraZoom; - - bool m_overrideCam; - STR_String m_overrideSceneName; - - bool m_overrideCamUseOrtho; - MT_CmMatrix4x4 m_overrideCamProjMat; - MT_CmMatrix4x4 m_overrideCamViewMat; - float m_overrideCamNear; - float m_overrideCamFar; - float m_overrideCamLens; - - bool m_stereo; - int m_curreye; - - /** Categories for profiling display. */ - typedef enum - { - tc_first = 0, - tc_physics = 0, - tc_logic, - tc_network, - tc_scenegraph, - tc_sound, - tc_rasterizer, - tc_services, // time spend in miscelaneous activities - tc_overhead, // profile info drawing overhead - tc_outside, // time spend outside main loop - tc_numCategories - } KX_TimeCategory; - - /** Time logger. */ - KX_TimeCategoryLogger* m_logger; - - /** Labels for profiling display. */ - static const char m_profileLabels[tc_numCategories][15]; - /** Last estimated framerate */ - static double m_average_framerate; - /** Show the framerate on the game display? */ - bool m_show_framerate; - /** Show profiling info on the game display? */ - bool m_show_profile; - /** Show any debug (scene) object properties on the game display? */ - bool m_showProperties; - /** Show background behind text for readability? */ - bool m_showBackground; - - bool m_show_debug_properties; - - /** record physics into keyframes */ - bool m_animation_record; - - /** Hide cursor every frame? */ - bool m_hideCursor; - - /** Override framing bars color? */ - bool m_overrideFrameColor; - /** Red component of framing bar color. */ - float m_overrideFrameColorR; - /** Green component of framing bar color. */ - float m_overrideFrameColorG; - /** Blue component of framing bar color. */ - float m_overrideFrameColorB; - - void RenderFrame(KX_Scene* scene, KX_Camera* cam); - void PostRenderScene(KX_Scene* scene); - void RenderDebugProperties(); - void RenderShadowBuffers(KX_Scene *scene); - void SetBackGround(KX_WorldInfo* worldinfo); - void DoSound(KX_Scene* scene); - -public: - KX_KetsjiEngine(class KX_ISystem* system); - virtual ~KX_KetsjiEngine(); - - // set the devices and stuff. the client must take care of creating these - void SetWorldSettings(KX_WorldInfo* worldinfo); - void SetKeyboardDevice(SCA_IInputDevice* keyboarddevice); - void SetMouseDevice(SCA_IInputDevice* mousedevice); - void SetNetworkDevice(NG_NetworkDeviceInterface* networkdevice); - void SetCanvas(RAS_ICanvas* canvas); - void SetRenderTools(RAS_IRenderTools* rendertools); - void SetRasterizer(RAS_IRasterizer* rasterizer); -#ifndef DISABLE_PYTHON - void SetPyNamespace(PyObject* pythondictionary); - PyObject* GetPyNamespace(){return m_pythondictionary;}; -#endif - void SetSceneConverter(KX_ISceneConverter* sceneconverter); - void SetAnimRecordMode(bool animation_record, int startFrame); - - RAS_IRasterizer* GetRasterizer(){return m_rasterizer;}; - RAS_ICanvas* GetCanvas(){return m_canvas;}; - RAS_IRenderTools* GetRenderTools(){return m_rendertools;}; - SCA_IInputDevice* GetKeyboardDevice(){return m_keyboarddevice;}; - SCA_IInputDevice* GetMouseDevice(){return m_mousedevice;}; - - /// Dome functions - void InitDome(short res, short mode, short angle, float resbuf, short tilt, struct Text* text); - void EndDome(); - void RenderDome(); - bool m_usedome; - - ///returns true if an update happened to indicate -> Render - bool NextFrame(); - void Render(); - - void StartEngine(bool clearIpo); - void StopEngine(); - void Export(const STR_String& filename); - - void RequestExit(int exitrequestmode); - void SetNameNextGame(const STR_String& nextgame); - int GetExitCode(); - const STR_String& GetExitString(); - - KX_SceneList* CurrentScenes(); - KX_Scene* FindScene(const STR_String& scenename); - void AddScene(class KX_Scene* scene); - void ConvertAndAddScene(const STR_String& scenename,bool overlay); - - void RemoveScene(const STR_String& scenename); - void ReplaceScene(const STR_String& oldscene,const STR_String& newscene); - void SuspendScene(const STR_String& scenename); - void ResumeScene(const STR_String& scenename); - - void GetSceneViewport(KX_Scene* scene, KX_Camera* cam, RAS_Rect& area, RAS_Rect& viewport); - - void SetDrawType(int drawingtype); - int GetDrawType(){return m_drawingmode;}; - - void SetCameraZoom(float camzoom); - - void EnableCameraOverride(const STR_String& forscene); - - void SetCameraOverrideUseOrtho(bool useOrtho); - void SetCameraOverrideProjectionMatrix(const MT_CmMatrix4x4& mat); - void SetCameraOverrideViewMatrix(const MT_CmMatrix4x4& mat); - void SetCameraOverrideClipping(float near, float far); - void SetCameraOverrideLens(float lens); - - /** - * Sets display of all frames. - * @param bUseFixedTime New setting for display all frames. - */ - void SetUseFixedTime(bool bUseFixedTime); - - /** - * Returns display of all frames. - * @return Current setting for display all frames. - */ - bool GetUseFixedTime(void) const; - - /** - * Returns current render frame clock time - */ - double GetClockTime(void) const; - /** - * Returns current logic frame clock time - */ - double GetFrameTime(void) const; - - double GetRealTime(void) const; - /** - * Returns the difference between the local time of the scene (when it - * was running and not suspended) and the "curtime" - */ - static double GetSuspendedDelta(); - - /** - * Gets the number of logic updates per second. - */ - static double GetTicRate(); - /** - * Sets the number of logic updates per second. - */ - static void SetTicRate(double ticrate); - /** - * Gets the maximum number of logic frame before render frame - */ - static int GetMaxLogicFrame(); - /** - * Sets the maximum number of logic frame before render frame - */ - static void SetMaxLogicFrame(int frame); - /** - * Gets the maximum number of physics frame before render frame - */ - static int GetMaxPhysicsFrame(); - /** - * Sets the maximum number of physics frame before render frame - */ - static void SetMaxPhysicsFrame(int frame); - - /** - * Gets the framerate for playing animations. (actions and ipos) - */ - static double GetAnimFrameRate(); - /** - * Sets the framerate for playing animations. (actions and ipos) - */ - static void SetAnimFrameRate(double framerate); - - /** - * Gets the last estimated average framerate - */ - static double GetAverageFrameRate(); - - /** - * Activates or deactivates timing information display. - * @param frameRate Display for frame rate on or off. - * @param profile Display for individual components on or off. - * @param properties Display of scene object debug properties on or off. - */ - void SetTimingDisplay(bool frameRate, bool profile, bool properties); - - /** - * Returns status of timing information display. - * @param frameRate Display for frame rate on or off. - * @param profile Display for individual components on or off. - * @param properties Display of scene object debug properties on or off. - */ - void GetTimingDisplay(bool& frameRate, bool& profile, bool& properties) const; - - /** - * Sets cursor hiding on every frame. - * @param hideCursor Turns hiding on or off. - */ - void SetHideCursor(bool hideCursor); - - /** - * Returns the current setting for cursor hiding. - * @return The current setting for cursor hiding. - */ - bool GetHideCursor(void) const; - - /** - * Enables/disables the use of the framing bar color of the Blender file's scenes. - * @param overrideFrameColor The new setting. - */ - void SetUseOverrideFrameColor(bool overrideFrameColor); - - /** - * Enables/disables the use of the framing bar color of the Blender file's scenes. - * @param useSceneFrameColor The new setting. - */ - bool GetUseOverrideFrameColor(void) const; - - /** - * Set the color used for framing bar color instead of the one in the Blender file's scenes. - * @param r Red component of the override color. - * @param g Green component of the override color. - * @param b Blue component of the override color. - */ - void SetOverrideFrameColor(float r, float g, float b); - - /** - * Returns the color used for framing bar color instead of the one in the Blender file's scenes. - * @param r Red component of the override color. - * @param g Green component of the override color. - * @param b Blue component of the override color. - */ - void GetOverrideFrameColor(float& r, float& g, float& b) const; - - KX_Scene* CreateScene(const STR_String& scenename); - KX_Scene* CreateScene(Scene *scene); - -protected: - /** - * Processes all scheduled scene activity. - * At the end, if the scene lists have changed, - * SceneListsChanged(void) is called. - * @see SceneListsChanged(void). - */ - void ProcessScheduledScenes(void); - - /** - * This method is invoked when the scene lists have changed. - */ - void SceneListsChanged(void); - - void RemoveScheduledScenes(void); - void AddScheduledScenes(void); - void ReplaceScheduledScenes(void); - void PostProcessScene(class KX_Scene* scene); - - bool BeginFrame(); - void ClearFrame(); - void EndFrame(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_KetsjiEngine"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_KETSJI_ENGINE - - diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp deleted file mode 100644 index 6ef4b873ead..00000000000 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ /dev/null @@ -1,389 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 - -#pragma warning (disable : 4786) -#endif - -#include "GL/glew.h" - -#include "KX_Light.h" -#include "KX_Camera.h" -#include "RAS_IRasterizer.h" -#include "RAS_IRenderTools.h" - -#include "KX_PyMath.h" - -#include "DNA_object_types.h" -#include "DNA_scene_types.h" -#include "GPU_material.h" - -KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks, - class RAS_IRenderTools* rendertools, - const RAS_LightObject& lightobj, - bool glsl) - : KX_GameObject(sgReplicationInfo,callbacks), - m_rendertools(rendertools) -{ - m_lightobj = lightobj; - m_lightobj.m_scene = sgReplicationInfo; - m_lightobj.m_light = this; - m_rendertools->AddLight(&m_lightobj); - m_glsl = glsl; - m_blenderscene = ((KX_Scene*)sgReplicationInfo)->GetBlenderScene(); -}; - - -KX_LightObject::~KX_LightObject() -{ - GPULamp *lamp; - - if((lamp = GetGPULamp())) { - float obmat[4][4] = {{0}}; - GPU_lamp_update(lamp, 0, obmat); - } - - m_rendertools->RemoveLight(&m_lightobj); -} - - -CValue* KX_LightObject::GetReplica() -{ - - KX_LightObject* replica = new KX_LightObject(*this); - - replica->ProcessReplica(); - - replica->m_lightobj.m_light = replica; - m_rendertools->AddLight(&replica->m_lightobj); - - return replica; -} - -bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot) -{ - KX_Scene* lightscene = (KX_Scene*)m_lightobj.m_scene; - float vec[4]; - int scenelayer = ~0; - - if(kxscene && kxscene->GetBlenderScene()) - scenelayer = kxscene->GetBlenderScene()->lay; - - /* only use lights in the same layer as the object */ - if(!(m_lightobj.m_layer & oblayer)) - return false; - /* only use lights in the same scene, and in a visible layer */ - if(kxscene != lightscene || !(m_lightobj.m_layer & scenelayer)) - return false; - - // lights don't get their openGL matrix updated, do it now - if(GetSGNode()->IsDirty()) - GetOpenGLMatrix(); - - MT_CmMatrix4x4& worldmatrix= *GetOpenGLMatrixPtr(); - - vec[0] = worldmatrix(0,3); - vec[1] = worldmatrix(1,3); - vec[2] = worldmatrix(2,3); - vec[3] = 1.0f; - - if(m_lightobj.m_type==RAS_LightObject::LIGHT_SUN) { - - vec[0] = worldmatrix(0,2); - vec[1] = worldmatrix(1,2); - vec[2] = worldmatrix(2,2); - //vec[0]= base->object->obmat[2][0]; - //vec[1]= base->object->obmat[2][1]; - //vec[2]= base->object->obmat[2][2]; - vec[3]= 0.0; - glLightfv((GLenum)(GL_LIGHT0+slot), GL_POSITION, vec); - } - else { - //vec[3]= 1.0; - glLightfv((GLenum)(GL_LIGHT0+slot), GL_POSITION, vec); - glLightf((GLenum)(GL_LIGHT0+slot), GL_CONSTANT_ATTENUATION, 1.0); - glLightf((GLenum)(GL_LIGHT0+slot), GL_LINEAR_ATTENUATION, m_lightobj.m_att1/m_lightobj.m_distance); - // without this next line it looks backward compatible. - //attennuation still is acceptable - glLightf((GLenum)(GL_LIGHT0+slot), GL_QUADRATIC_ATTENUATION, m_lightobj.m_att2/(m_lightobj.m_distance*m_lightobj.m_distance)); - - if(m_lightobj.m_type==RAS_LightObject::LIGHT_SPOT) { - vec[0] = -worldmatrix(0,2); - vec[1] = -worldmatrix(1,2); - vec[2] = -worldmatrix(2,2); - //vec[0]= -base->object->obmat[2][0]; - //vec[1]= -base->object->obmat[2][1]; - //vec[2]= -base->object->obmat[2][2]; - glLightfv((GLenum)(GL_LIGHT0+slot), GL_SPOT_DIRECTION, vec); - glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, m_lightobj.m_spotsize/2.0); - glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_EXPONENT, 128.0*m_lightobj.m_spotblend); - } - else - glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, 180.0); - } - - if (m_lightobj.m_nodiffuse) { - vec[0] = vec[1] = vec[2] = vec[3] = 0.0; - } - else { - vec[0]= m_lightobj.m_energy*m_lightobj.m_red; - vec[1]= m_lightobj.m_energy*m_lightobj.m_green; - vec[2]= m_lightobj.m_energy*m_lightobj.m_blue; - vec[3]= 1.0; - } - - glLightfv((GLenum)(GL_LIGHT0+slot), GL_DIFFUSE, vec); - if(m_lightobj.m_nospecular) - { - vec[0] = vec[1] = vec[2] = vec[3] = 0.0; - } - else if (m_lightobj.m_nodiffuse) { - vec[0]= m_lightobj.m_energy*m_lightobj.m_red; - vec[1]= m_lightobj.m_energy*m_lightobj.m_green; - vec[2]= m_lightobj.m_energy*m_lightobj.m_blue; - vec[3]= 1.0; - } - - glLightfv((GLenum)(GL_LIGHT0+slot), GL_SPECULAR, vec); - glEnable((GLenum)(GL_LIGHT0+slot)); - - return true; -} - -GPULamp *KX_LightObject::GetGPULamp() -{ - if(m_glsl) - return GPU_lamp_from_blender(m_blenderscene, GetBlenderObject(), GetBlenderGroupObject()); - else - return false; -} - -void KX_LightObject::Update() -{ - GPULamp *lamp; - - if((lamp = GetGPULamp()) != NULL && GetSGNode()) { - float obmat[4][4]; - // lights don't get their openGL matrix updated, do it now - if (GetSGNode()->IsDirty()) - GetOpenGLMatrix(); - double *dobmat = GetOpenGLMatrixPtr()->getPointer(); - - for(int i=0; i<4; i++) - for(int j=0; j<4; j++, dobmat++) - obmat[i][j] = (float)*dobmat; - - GPU_lamp_update(lamp, m_lightobj.m_layer, obmat); - GPU_lamp_update_colors(lamp, m_lightobj.m_red, m_lightobj.m_green, - m_lightobj.m_blue, m_lightobj.m_energy); - } -} - -bool KX_LightObject::HasShadowBuffer() -{ - GPULamp *lamp; - - if((lamp = GetGPULamp())) - return GPU_lamp_has_shadow_buffer(lamp); - else - return false; -} - -int KX_LightObject::GetShadowLayer() -{ - GPULamp *lamp; - - if((lamp = GetGPULamp())) - return GPU_lamp_shadow_layer(lamp); - else - return 0; -} - -void KX_LightObject::BindShadowBuffer(RAS_IRasterizer *ras, KX_Camera *cam, MT_Transform& camtrans) -{ - GPULamp *lamp; - float viewmat[4][4], winmat[4][4]; - int winsize; - - /* bind framebuffer */ - lamp = GetGPULamp(); - GPU_lamp_shadow_buffer_bind(lamp, viewmat, &winsize, winmat); - - /* setup camera transformation */ - MT_Matrix4x4 modelviewmat((float*)viewmat); - MT_Matrix4x4 projectionmat((float*)winmat); - - MT_Transform trans = MT_Transform((float*)viewmat); - camtrans.invert(trans); - - cam->SetModelviewMatrix(modelviewmat); - cam->SetProjectionMatrix(projectionmat); - - cam->NodeSetLocalPosition(camtrans.getOrigin()); - cam->NodeSetLocalOrientation(camtrans.getBasis()); - cam->NodeUpdateGS(0); - - /* setup rasterizer transformations */ - ras->SetProjectionMatrix(projectionmat); - ras->SetViewMatrix(modelviewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->GetCameraData()->m_perspective); -} - -void KX_LightObject::UnbindShadowBuffer(RAS_IRasterizer *ras) -{ - GPULamp *lamp = GetGPULamp(); - GPU_lamp_shadow_buffer_unbind(lamp); -} - -#ifndef DISABLE_PYTHON -/* ------------------------------------------------------------------------- */ -/* Python Integration Hooks */ -/* ------------------------------------------------------------------------- */ - -PyTypeObject KX_LightObject::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_LightObject", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0, - &KX_GameObject::Sequence, - &KX_GameObject::Mapping, - 0,0,0, - NULL, - NULL, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &KX_GameObject::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_LightObject::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_LightObject::Attributes[] = { - KX_PYATTRIBUTE_INT_RW("layer", 1, 20, true, KX_LightObject, m_lightobj.m_layer), - KX_PYATTRIBUTE_FLOAT_RW("energy", 0, 10, KX_LightObject, m_lightobj.m_energy), - KX_PYATTRIBUTE_FLOAT_RW("distance", 0.01, 5000, KX_LightObject, m_lightobj.m_distance), - KX_PYATTRIBUTE_RW_FUNCTION("color", KX_LightObject, pyattr_get_color, pyattr_set_color), - KX_PYATTRIBUTE_RW_FUNCTION("colour", KX_LightObject, pyattr_get_color, pyattr_set_color), - KX_PYATTRIBUTE_FLOAT_RW("lin_attenuation", 0, 1, KX_LightObject, m_lightobj.m_att1), - KX_PYATTRIBUTE_FLOAT_RW("quad_attenuation", 0, 1, KX_LightObject, m_lightobj.m_att2), - KX_PYATTRIBUTE_FLOAT_RW("spotsize", 1, 180, KX_LightObject, m_lightobj.m_spotsize), - KX_PYATTRIBUTE_FLOAT_RW("spotblend", 0, 1, KX_LightObject, m_lightobj.m_spotblend), - KX_PYATTRIBUTE_RO_FUNCTION("SPOT", KX_LightObject, pyattr_get_typeconst), - KX_PYATTRIBUTE_RO_FUNCTION("SUN", KX_LightObject, pyattr_get_typeconst), - KX_PYATTRIBUTE_RO_FUNCTION("NORMAL", KX_LightObject, pyattr_get_typeconst), - KX_PYATTRIBUTE_RW_FUNCTION("type", KX_LightObject, pyattr_get_type, pyattr_set_type), - { NULL } //Sentinel -}; - -PyObject* KX_LightObject::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_LightObject* self = static_cast(self_v); - return Py_BuildValue("[fff]", self->m_lightobj.m_red, self->m_lightobj.m_green, self->m_lightobj.m_blue); -} - -int KX_LightObject::pyattr_set_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_LightObject* self = static_cast(self_v); - - MT_Vector3 color; - if (PyVecTo(value, color)) - { - self->m_lightobj.m_red = color[0]; - self->m_lightobj.m_green = color[1]; - self->m_lightobj.m_blue = color[2]; - return PY_SET_ATTR_SUCCESS; - } - return PY_SET_ATTR_FAIL; -} - -PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - PyObject* retvalue; - - const char* type = attrdef->m_name; - - if(!strcmp(type, "SPOT")) { - retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SPOT); - } else if (!strcmp(type, "SUN")) { - retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SUN); - } else if (!strcmp(type, "NORMAL")) { - retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_NORMAL); - } - else { - /* should never happen */ - PyErr_SetString(PyExc_TypeError, "light.type: internal error, invalid light type"); - retvalue = NULL; - } - - return retvalue; -} - -PyObject* KX_LightObject::pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_LightObject* self = static_cast(self_v); - return PyLong_FromSsize_t(self->m_lightobj.m_type); -} - -int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value) -{ - KX_LightObject* self = static_cast(self_v); - int val = PyLong_AsSsize_t(value); - if((val==-1 && PyErr_Occurred()) || val<0 || val>2) { - PyErr_SetString(PyExc_ValueError, "light.type= val: KX_LightObject, expected an int between 0 and 2"); - return PY_SET_ATTR_FAIL; - } - - switch(val) { - case 0: - self->m_lightobj.m_type = self->m_lightobj.LIGHT_SPOT; - break; - case 1: - self->m_lightobj.m_type = self->m_lightobj.LIGHT_SUN; - break; - case 2: - self->m_lightobj.m_type = self->m_lightobj.LIGHT_NORMAL; - break; - } - - return PY_SET_ATTR_SUCCESS; -} -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h deleted file mode 100644 index 334aed1995d..00000000000 --- a/source/gameengine/Ketsji/KX_Light.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_LIGHT -#define __KX_LIGHT - -#include "RAS_LightObject.h" -#include "KX_GameObject.h" - -struct GPULamp; -struct Scene; -class KX_Camera; -class RAS_IRasterizer; -class RAS_IRenderTools; -class MT_Transform; - -class KX_LightObject : public KX_GameObject -{ - Py_Header; -protected: - RAS_LightObject m_lightobj; - class RAS_IRenderTools* m_rendertools; //needed for registering and replication of lightobj - bool m_glsl; - Scene* m_blenderscene; - -public: - KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,class RAS_IRenderTools* rendertools,const struct RAS_LightObject& lightobj, bool glsl); - virtual ~KX_LightObject(); - virtual CValue* GetReplica(); - RAS_LightObject* GetLightData() { return &m_lightobj;} - - /* OpenGL Light */ - bool ApplyLight(KX_Scene *kxscene, int oblayer, int slot); - - /* GLSL Light */ - struct GPULamp *GetGPULamp(); - bool HasShadowBuffer(); - int GetShadowLayer(); - void BindShadowBuffer(class RAS_IRasterizer *ras, class KX_Camera *cam, class MT_Transform& camtrans); - void UnbindShadowBuffer(class RAS_IRasterizer *ras); - void Update(); - - void UpdateScene(class KX_Scene *kxscene) {m_lightobj.m_scene = (void*)kxscene;} - - virtual int GetGameObjectType() { return OBJ_LIGHT; } - -#ifndef DISABLE_PYTHON - /* attributes */ - static PyObject* pyattr_get_color(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_color(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); - static PyObject* pyattr_get_typeconst(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); -#endif -}; - -#endif //__KX_LIGHT - diff --git a/source/gameengine/Ketsji/KX_LightIpoSGController.cpp b/source/gameengine/Ketsji/KX_LightIpoSGController.cpp deleted file mode 100644 index 3a010556cfe..00000000000 --- a/source/gameengine/Ketsji/KX_LightIpoSGController.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_LightIpoSGController.h" -#include "KX_ScalarInterpolator.h" -#include "KX_Light.h" -#include "RAS_LightObject.h" - -#if defined(_WIN64) -typedef unsigned __int64 uint_ptr; -#else -typedef unsigned long uint_ptr; -#endif - -bool KX_LightIpoSGController::Update(double currentTime) -{ - if (m_modified) - { - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - (*i)->Execute(m_ipotime);//currentTime); - } - - RAS_LightObject *lightobj; - - SG_Spatial* ob = (SG_Spatial*)m_pObject; - KX_LightObject* kxlight = (KX_LightObject*) ob->GetSGClientObject(); - lightobj = kxlight->GetLightData(); - //lightobj = (KX_Light*) - - if (m_modify_energy) { - lightobj->m_energy = m_energy; - } - - if (m_modify_color) { - lightobj->m_red = m_col_rgb[0]; - lightobj->m_green = m_col_rgb[1]; - lightobj->m_blue = m_col_rgb[2]; - } - - if (m_modify_dist) { - lightobj->m_distance = m_dist; - } - - m_modified=false; - } - return false; -} - - -void KX_LightIpoSGController::AddInterpolator(KX_IInterpolator* interp) -{ - this->m_interpolators.push_back(interp); -} - -SG_Controller* KX_LightIpoSGController::GetReplica(class SG_Node* destnode) -{ - KX_LightIpoSGController* iporeplica = new KX_LightIpoSGController(*this); - // clear object that ipo acts on - iporeplica->ClearObject(); - - // dirty hack, ask Gino for a better solution in the ipo implementation - // hacken en zagen, in what we call datahiding, not written for replication :( - - T_InterpolatorList oldlist = m_interpolators; - iporeplica->m_interpolators.clear(); - - T_InterpolatorList::iterator i; - for (i = oldlist.begin(); !(i == oldlist.end()); ++i) { - KX_ScalarInterpolator* copyipo = new KX_ScalarInterpolator(*((KX_ScalarInterpolator*)*i)); - iporeplica->AddInterpolator(copyipo); - - MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget(); - uint_ptr orgbase = (uint_ptr)this; - uint_ptr orgloc = (uint_ptr)scaal; - uint_ptr offset = orgloc-orgbase; - uint_ptr newaddrbase = (uint_ptr)iporeplica + offset; - MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; - copyipo->SetNewTarget((MT_Scalar*)blaptr); - } - - return iporeplica; -} - -KX_LightIpoSGController::~KX_LightIpoSGController() -{ - - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - delete (*i); - } - -} diff --git a/source/gameengine/Ketsji/KX_LightIpoSGController.h b/source/gameengine/Ketsji/KX_LightIpoSGController.h deleted file mode 100644 index 97034d34429..00000000000 --- a/source/gameengine/Ketsji/KX_LightIpoSGController.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_LIGHTIPOSGCONTROLLER_H -#define KX_LIGHTIPOSGCONTROLLER_H - -#include "SG_Controller.h" -#include "SG_Spatial.h" - -#include "KX_IInterpolator.h" - -struct RAS_LightObject; - -class KX_LightIpoSGController : public SG_Controller -{ -public: - MT_Scalar m_energy; - MT_Scalar m_col_rgb[3]; - MT_Scalar m_dist; - -private: - T_InterpolatorList m_interpolators; - unsigned short m_modify_energy : 1; - unsigned short m_modify_color : 1; - unsigned short m_modify_dist : 1; - bool m_modified; - - double m_ipotime; -public: - KX_LightIpoSGController() : - m_modify_energy(false), - m_modify_color(false), - m_modify_dist(false), - m_modified(true), - m_ipotime(0.0) - {} - - virtual ~KX_LightIpoSGController(); - - virtual SG_Controller* GetReplica(class SG_Node* destnode); - - virtual bool Update(double time); - - virtual void SetSimulatedTime(double time) { - m_ipotime = time; - m_modified = true; - } - - void SetModifyEnergy(bool modify) { - m_modify_energy = modify; - } - - void SetModifyColor(bool modify) { - m_modify_color = modify; - } - - void SetModifyDist(bool modify) { - m_modify_dist = modify; - } - - void - SetOption( - int option, - int value - ){ - // intentionally empty - }; - - void AddInterpolator(KX_IInterpolator* interp); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_LightIpoSGController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // KX_LIGHTIPOSGCONTROLLER_H - diff --git a/source/gameengine/Ketsji/KX_MaterialIpoController.cpp b/source/gameengine/Ketsji/KX_MaterialIpoController.cpp deleted file mode 100644 index 13d272ee92d..00000000000 --- a/source/gameengine/Ketsji/KX_MaterialIpoController.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -#include "KX_MaterialIpoController.h" -#include "KX_ScalarInterpolator.h" -#include "KX_GameObject.h" - -#include "BLO_sys_types.h" // for intptr_t support - -bool KX_MaterialIpoController::Update(double currentTime) -{ - if (m_modified) - { - m_rgba[0]=0; - m_rgba[1]=0; - m_rgba[2]=0; - m_rgba[3]=0; - - m_specrgb[0] =0; - m_specrgb[1] =0; - m_specrgb[2] =0; - m_hard =0; - m_spec=0; - m_ref=0; - m_emit=0; - m_alpha = 0; - - - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - (*i)->Execute(m_ipotime); - } - - - SG_Spatial* ob = (SG_Spatial*)m_pObject; - KX_GameObject* kxgameobj= (KX_GameObject*) ob->GetSGClientObject(); - - //kxgameobj->SetObjectColor(m_rgba); - kxgameobj->UpdateMaterialData( - m_matname_hash, - m_rgba, - m_specrgb, - m_hard, - m_spec, - m_ref, - m_emit, - m_alpha - ); - - m_modified=false; - } - return false; -} - - -void KX_MaterialIpoController::AddInterpolator(KX_IInterpolator* interp) -{ - this->m_interpolators.push_back(interp); -} - -SG_Controller* KX_MaterialIpoController::GetReplica(class SG_Node* destnode) -{ - KX_MaterialIpoController* iporeplica = new KX_MaterialIpoController(*this); - // clear object that ipo acts on - iporeplica->ClearObject(); - - // dirty hack, ask Gino for a better solution in the ipo implementation - // hacken en zagen, in what we call datahiding, not written for replication :( - - T_InterpolatorList oldlist = m_interpolators; - iporeplica->m_interpolators.clear(); - - T_InterpolatorList::iterator i; - for (i = oldlist.begin(); !(i == oldlist.end()); ++i) { - KX_ScalarInterpolator* copyipo = new KX_ScalarInterpolator(*((KX_ScalarInterpolator*)*i)); - iporeplica->AddInterpolator(copyipo); - - MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget(); - intptr_t orgbase = (intptr_t)this; - intptr_t orgloc = (intptr_t)scaal; - intptr_t offset = orgloc-orgbase; - intptr_t newaddrbase = (intptr_t)iporeplica + offset; - MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; - copyipo->SetNewTarget((MT_Scalar*)blaptr); - } - - return iporeplica; -} - -KX_MaterialIpoController::~KX_MaterialIpoController() -{ - - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - delete (*i); - } - -} - diff --git a/source/gameengine/Ketsji/KX_MaterialIpoController.h b/source/gameengine/Ketsji/KX_MaterialIpoController.h deleted file mode 100644 index 906c12426eb..00000000000 --- a/source/gameengine/Ketsji/KX_MaterialIpoController.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef __KX_MATERIALIPOCONTROLLER_H__ -#define __KX_MATERIALIPOCONTROLLER_H__ - - - -#include "SG_Controller.h" -#include "SG_Spatial.h" -#include "KX_IInterpolator.h" - -#include "STR_String.h" //typedef dword - -class KX_MaterialIpoController : public SG_Controller -{ -public: - MT_Vector4 m_rgba; - MT_Vector3 m_specrgb; - MT_Scalar m_hard; - MT_Scalar m_spec; - MT_Scalar m_ref; - MT_Scalar m_emit; - MT_Scalar m_alpha; - -private: - T_InterpolatorList m_interpolators; - bool m_modified; - - double m_ipotime; - dword m_matname_hash; -public: - KX_MaterialIpoController(dword matname_hash) : - m_modified(true), - m_ipotime(0.0), - m_matname_hash(matname_hash) - {} - virtual ~KX_MaterialIpoController(); - virtual SG_Controller* GetReplica(class SG_Node* destnode); - virtual bool Update(double time); - virtual void SetSimulatedTime(double time) { - m_ipotime = time; - m_modified = true; - } - - void - SetOption( - int option, - int value - ){ - // intentionally empty - }; - - - void AddInterpolator(KX_IInterpolator* interp); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_MaterialIpoController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - - - - -#endif//__KX_MATERIALIPOCONTROLLER_H__ diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp deleted file mode 100644 index a5ff7ebcbc1..00000000000 --- a/source/gameengine/Ketsji/KX_MeshProxy.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef DISABLE_PYTHON - -#include "KX_MeshProxy.h" -#include "RAS_IPolygonMaterial.h" -#include "RAS_MeshObject.h" - -#include "KX_VertexProxy.h" -#include "KX_PolyProxy.h" - -#include "KX_PolygonMaterial.h" -#include "KX_BlenderMaterial.h" - -#include "KX_PyMath.h" -#include "KX_ConvertPhysicsObject.h" - -#include "PyObjectPlus.h" - -PyTypeObject KX_MeshProxy::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_MeshProxy", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &CValue::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_MeshProxy::Methods[] = { -{"getMaterialName", (PyCFunction)KX_MeshProxy::sPyGetMaterialName,METH_VARARGS}, -{"getTextureName", (PyCFunction)KX_MeshProxy::sPyGetTextureName,METH_VARARGS}, -{"getVertexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetVertexArrayLength,METH_VARARGS}, -{"getVertex", (PyCFunction)KX_MeshProxy::sPyGetVertex,METH_VARARGS}, -{"getPolygon", (PyCFunction)KX_MeshProxy::sPyGetPolygon,METH_VARARGS}, -//{"getIndexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetIndexArrayLength,METH_VARARGS}, - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_MeshProxy::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("materials", KX_MeshProxy, pyattr_get_materials), - KX_PYATTRIBUTE_RO_FUNCTION("numPolygons", KX_MeshProxy, pyattr_get_numPolygons), - KX_PYATTRIBUTE_RO_FUNCTION("numMaterials", KX_MeshProxy, pyattr_get_numMaterials), - - { NULL } //Sentinel -}; - -void KX_MeshProxy::SetMeshModified(bool v) -{ - m_meshobj->SetMeshModified(v); -} - -KX_MeshProxy::KX_MeshProxy(RAS_MeshObject* mesh) - : CValue(), m_meshobj(mesh) -{ -} - -KX_MeshProxy::~KX_MeshProxy() -{ -} - - - -// stuff for cvalue related things -CValue* KX_MeshProxy::Calc(VALUE_OPERATOR op, CValue *val) { return NULL;} -CValue* KX_MeshProxy::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) { return NULL;} - -const STR_String & KX_MeshProxy::GetText() {return m_meshobj->GetName();}; -double KX_MeshProxy::GetNumber() { return -1;} -STR_String& KX_MeshProxy::GetName() { return m_meshobj->GetName();} -void KX_MeshProxy::SetName(const char *name) { }; -CValue* KX_MeshProxy::GetReplica() { return NULL;} - - -// stuff for python integration - -PyObject* KX_MeshProxy::PyGetMaterialName(PyObject* args, PyObject* kwds) -{ - int matid= 1; - STR_String matname; - - if (PyArg_ParseTuple(args,"i:getMaterialName",&matid)) - { - matname = m_meshobj->GetMaterialName(matid); - } - else { - return NULL; - } - - return PyUnicode_FromString(matname.Ptr()); - -} - - -PyObject* KX_MeshProxy::PyGetTextureName(PyObject* args, PyObject* kwds) -{ - int matid= 1; - STR_String matname; - - if (PyArg_ParseTuple(args,"i:getTextureName",&matid)) - { - matname = m_meshobj->GetTextureName(matid); - } - else { - return NULL; - } - - return PyUnicode_FromString(matname.Ptr()); - -} - -PyObject* KX_MeshProxy::PyGetVertexArrayLength(PyObject* args, PyObject* kwds) -{ - int matid= 0; - int length = 0; - - - if (!PyArg_ParseTuple(args,"i:getVertexArrayLength",&matid)) - return NULL; - - - RAS_MeshMaterial *mmat = m_meshobj->GetMeshMaterial(matid); /* can be NULL*/ - - if (mmat) - { - RAS_IPolyMaterial* mat = mmat->m_bucket->GetPolyMaterial(); - if (mat) - length = m_meshobj->NumVertices(mat); - } - - return PyLong_FromSsize_t(length); -} - - -PyObject* KX_MeshProxy::PyGetVertex(PyObject* args, PyObject* kwds) -{ - int vertexindex; - int matindex; - - if (!PyArg_ParseTuple(args,"ii:getVertex",&matindex,&vertexindex)) - return NULL; - - RAS_TexVert* vertex = m_meshobj->GetVertex(matindex,vertexindex); - - if(vertex==NULL) { - PyErr_SetString(PyExc_ValueError, "mesh.getVertex(mat_idx, vert_idx): KX_MeshProxy, could not get a vertex at the given indicies"); - return NULL; - } - - return (new KX_VertexProxy(this, vertex))->NewProxy(true); -} - -PyObject* KX_MeshProxy::PyGetPolygon(PyObject* args, PyObject* kwds) -{ - int polyindex= 1; - PyObject* polyob = NULL; - - if (!PyArg_ParseTuple(args,"i:getPolygon",&polyindex)) - return NULL; - - if (polyindex<0 || polyindex >= m_meshobj->NumPolygons()) - { - PyErr_SetString(PyExc_AttributeError, "mesh.getPolygon(int): KX_MeshProxy, invalid polygon index"); - return NULL; - } - - - RAS_Polygon* polygon = m_meshobj->GetPolygon(polyindex); - if (polygon) - { - polyob = (new KX_PolyProxy(m_meshobj, polygon))->NewProxy(true); - } - else { - PyErr_SetString(PyExc_AttributeError, "mesh.getPolygon(int): KX_MeshProxy, polygon is NULL, unknown reason"); - } - return polyob; -} - -PyObject* KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_MeshProxy* self= static_cast(self_v); - - int tot= self->m_meshobj->NumMaterials(); - int i; - - PyObject *materials = PyList_New( tot ); - - list::iterator mit= self->m_meshobj->GetFirstMaterial(); - - - for(i=0; im_bucket->GetPolyMaterial(); - - /* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject*)? - Campbell */ - if(polymat->GetFlag() & RAS_BLENDERMAT) - { - KX_BlenderMaterial *mat = static_cast(polymat); - PyList_SET_ITEM(materials, i, mat->GetProxy()); - } - else { - KX_PolygonMaterial *mat = static_cast(polymat); - PyList_SET_ITEM(materials, i, mat->GetProxy()); - } - } - return materials; -} - -PyObject * KX_MeshProxy::pyattr_get_numMaterials(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef) { - KX_MeshProxy * self = static_cast (selfv); - return PyLong_FromSsize_t(self->m_meshobj->NumMaterials()); -} - -PyObject * KX_MeshProxy::pyattr_get_numPolygons(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef) { - KX_MeshProxy * self = static_cast (selfv); - return PyLong_FromSsize_t(self->m_meshobj->NumPolygons()); -} - -/* a close copy of ConvertPythonToGameObject but for meshes */ -bool ConvertPythonToMesh(PyObject * value, RAS_MeshObject **object, bool py_none_ok, const char *error_prefix) -{ - if (value==NULL) { - PyErr_Format(PyExc_TypeError, "%s, python pointer NULL, should never happen", error_prefix); - *object = NULL; - return false; - } - - if (value==Py_None) { - *object = NULL; - - if (py_none_ok) { - return true; - } else { - PyErr_Format(PyExc_TypeError, "%s, expected KX_MeshProxy or a KX_MeshProxy name, None is invalid", error_prefix); - return false; - } - } - - if (PyUnicode_Check(value)) { - *object = (RAS_MeshObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetMeshByName(STR_String( _PyUnicode_AsString(value) )); - - if (*object) { - return true; - } else { - PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_MeshProxy in this scene", error_prefix, _PyUnicode_AsString(value)); - return false; - } - } - - if (PyObject_TypeCheck(value, &KX_MeshProxy::Type)) { - KX_MeshProxy *kx_mesh = static_castBGE_PROXY_REF(value); - - /* sets the error */ - if (kx_mesh==NULL) { - PyErr_Format(PyExc_SystemError, "%s, " BGE_PROXY_ERROR_MSG, error_prefix); - return false; - } - - *object = kx_mesh->GetMesh(); - return true; - } - - *object = NULL; - - if (py_none_ok) { - PyErr_Format(PyExc_TypeError, "%s, expect a KX_MeshProxy, a string or None", error_prefix); - } else { - PyErr_Format(PyExc_TypeError, "%s, expect a KX_MeshProxy or a string", error_prefix); - } - - return false; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_MeshProxy.h b/source/gameengine/Ketsji/KX_MeshProxy.h deleted file mode 100644 index 7b627040b4c..00000000000 --- a/source/gameengine/Ketsji/KX_MeshProxy.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_MESHPROXY -#define __KX_MESHPROXY - -#ifndef DISABLE_PYTHON - -#include "SCA_IObject.h" - -/* utility conversion function */ -bool ConvertPythonToMesh(PyObject * value, class RAS_MeshObject **object, bool py_none_ok, const char *error_prefix); - -class KX_MeshProxy : public CValue -{ - Py_Header; - - class RAS_MeshObject* m_meshobj; -public: - KX_MeshProxy(class RAS_MeshObject* mesh); - virtual ~KX_MeshProxy(); - - void SetMeshModified(bool v); - - // stuff for cvalue related things - virtual CValue* Calc(VALUE_OPERATOR op, CValue *val) ; - virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - virtual const STR_String & GetText(); - virtual double GetNumber(); - virtual RAS_MeshObject* GetMesh() { return m_meshobj; } - virtual STR_String& GetName(); - virtual void SetName(const char *name); // Set the name of the value - virtual CValue* GetReplica(); - -// stuff for python integration - - KX_PYMETHOD(KX_MeshProxy,GetNumMaterials); // Deprecated - KX_PYMETHOD(KX_MeshProxy,GetMaterialName); - KX_PYMETHOD(KX_MeshProxy,GetTextureName); - KX_PYMETHOD_NOARGS(KX_MeshProxy,GetNumPolygons); // Deprecated - - // both take materialid (int) - KX_PYMETHOD(KX_MeshProxy,GetVertexArrayLength); - KX_PYMETHOD(KX_MeshProxy,GetVertex); - KX_PYMETHOD(KX_MeshProxy,GetPolygon); - - static PyObject* pyattr_get_materials(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject * pyattr_get_numMaterials(void * self, const KX_PYATTRIBUTE_DEF * attrdef); - static PyObject * pyattr_get_numPolygons(void * self, const KX_PYATTRIBUTE_DEF * attrdef); -}; - -#endif // DISABLE_PYTHON - -#endif //__KX_MESHPROXY - diff --git a/source/gameengine/Ketsji/KX_MotionState.cpp b/source/gameengine/Ketsji/KX_MotionState.cpp deleted file mode 100644 index 08f8ee556d1..00000000000 --- a/source/gameengine/Ketsji/KX_MotionState.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "KX_MotionState.h" -#include "SG_Spatial.h" - -KX_MotionState::KX_MotionState(SG_Spatial* node) : m_node(node) -{ - -} - -KX_MotionState::~KX_MotionState() -{ -} - -void KX_MotionState::getWorldPosition(float& posX,float& posY,float& posZ) -{ - const MT_Point3& pos = m_node->GetWorldPosition(); - posX = pos[0]; - posY = pos[1]; - posZ = pos[2]; -} - -void KX_MotionState::getWorldScaling(float& scaleX,float& scaleY,float& scaleZ) -{ - const MT_Vector3& scale = m_node->GetWorldScaling(); - scaleX = scale[0]; - scaleY = scale[1]; - scaleZ = scale[2]; -} - -void KX_MotionState::getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal) -{ - MT_Quaternion orn = m_node->GetWorldOrientation().getRotation(); - quatIma0 = orn[0]; - quatIma1 = orn[1]; - quatIma2 = orn[2]; - quatReal = orn[3]; -} - -void KX_MotionState::getWorldOrientation(float* ori) -{ - const MT_Matrix3x3& mat = m_node->GetWorldOrientation(); - mat.getValue(ori); -} - -void KX_MotionState::setWorldOrientation(const float* ori) -{ - m_node->SetLocalOrientation(ori); -} - -void KX_MotionState::setWorldPosition(float posX,float posY,float posZ) -{ - m_node->SetLocalPosition(MT_Point3(posX,posY,posZ)); - //m_node->SetWorldPosition(MT_Point3(posX,posY,posZ)); -} - -void KX_MotionState::setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal) -{ - MT_Quaternion orn; - orn[0] = quatIma0; - orn[1] = quatIma1; - orn[2] = quatIma2; - orn[3] = quatReal; - - m_node->SetLocalOrientation(orn); - //m_node->SetWorldOrientation(orn); - -} - -void KX_MotionState::calculateWorldTransformations() -{ - //Not needed, will be done in KX_Scene::UpdateParents() after the physics simulation - //bool parentUpdated = false; - //m_node->ComputeWorldTransforms(NULL, parentUpdated); -} - - diff --git a/source/gameengine/Ketsji/KX_MotionState.h b/source/gameengine/Ketsji/KX_MotionState.h deleted file mode 100644 index 80bdd8bca48..00000000000 --- a/source/gameengine/Ketsji/KX_MotionState.h +++ /dev/null @@ -1,64 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_MOTIONSTATE -#define __KX_MOTIONSTATE - -#include "PHY_IMotionState.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class KX_MotionState : public PHY_IMotionState -{ - class SG_Spatial* m_node; - -public: - KX_MotionState(class SG_Spatial* spatial); - virtual ~KX_MotionState(); - - virtual void getWorldPosition(float& posX,float& posY,float& posZ); - virtual void getWorldScaling(float& scaleX,float& scaleY,float& scaleZ); - virtual void getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal); - virtual void setWorldPosition(float posX,float posY,float posZ); - virtual void setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal); - virtual void getWorldOrientation(float* ori); - virtual void setWorldOrientation(const float* ori); - - virtual void calculateWorldTransformations(); - - -#ifdef WITH_CXX_GUARDEDALLOC - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_MotionState"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_MOTIONSTATE - diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp deleted file mode 100644 index 63771ae08dc..00000000000 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ /dev/null @@ -1,448 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * KX_MouseFocusSensor determines mouse in/out/over events. - */ - -#ifdef WIN32 -// This warning tells us about truncation of __long__ stl-generated names. -// It can occasionally cause DevStudio to have internal compiler warnings. -#pragma warning( disable : 4786 ) -#endif - -#include "MT_Point3.h" -#include "RAS_FramingManager.h" -#include "RAS_ICanvas.h" -#include "RAS_IRasterizer.h" -#include "SCA_IScene.h" -#include "KX_Scene.h" -#include "KX_Camera.h" -#include "KX_MouseFocusSensor.h" -#include "KX_PyMath.h" - -#include "KX_RayCast.h" -#include "KX_IPhysicsController.h" -#include "PHY_IPhysicsController.h" -#include "PHY_IPhysicsEnvironment.h" - - -#include "KX_ClientObjectInfo.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_MouseFocusSensor::KX_MouseFocusSensor(SCA_MouseManager* eventmgr, - int startx, - int starty, - short int mousemode, - int focusmode, - bool bTouchPulse, - KX_Scene* kxscene, - KX_KetsjiEngine *kxengine, - SCA_IObject* gameobj) - : SCA_MouseSensor(eventmgr, startx, starty, mousemode, gameobj), - m_focusmode(focusmode), - m_bTouchPulse(bTouchPulse), - m_kxscene(kxscene), - m_kxengine(kxengine) -{ - Init(); -} - -void KX_MouseFocusSensor::Init() -{ - m_mouse_over_in_previous_frame = (m_invert)?true:false; - m_positive_event = false; - m_hitObject = 0; - m_hitObject_Last = NULL; - m_reset = true; - - m_hitPosition.setValue(0,0,0); - m_prevTargetPoint.setValue(0,0,0); - m_prevSourcePoint.setValue(0,0,0); - m_hitNormal.setValue(0,0,1); -} - -bool KX_MouseFocusSensor::Evaluate() -{ - bool result = false; - bool obHasFocus = false; - bool reset = m_reset && m_level; - -// cout << "evaluate focus mouse sensor "<m_gameobject; - - /* Is this me? In the ray test, there are a lot of extra checks - * for aliasing artefacts from self-hits. That doesn't happen - * here, so a simple test suffices. Or does the camera also get - * self-hits? (No, and the raysensor shouldn't do it either, since - * self-hits are excluded by setting the correct ignore-object.) - * Hitspots now become valid. */ - KX_GameObject* thisObj = (KX_GameObject*) GetParent(); - if ((m_focusmode == 2) || hitKXObj == thisObj) - { - m_hitObject = hitKXObj; - m_hitPosition = result->m_hitPoint; - m_hitNormal = result->m_hitNormal; - m_hitUV = result->m_hitUV; - return true; - } - - return true; // object must be visible to trigger - //return false; // occluded objects can trigger -} - - - -bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) -{ - /* All screen handling in the gameengine is done by GL, - * specifically the model/view and projection parts. The viewport - * part is in the creator. - * - * The theory is this: - * WCS - world coordinates - * -> wcs_camcs_trafo -> - * camCS - camera coordinates - * -> camcs_clip_trafo -> - * clipCS - normalized device coordinates? - * -> normview_win_trafo - * winCS - window coordinates - * - * The first two transforms are respectively the model/view and - * the projection matrix. These are passed to the rasterizer, and - * we store them in the camera for easy access. - * - * For normalized device coords (xn = x/w, yn = y/w/zw) the - * windows coords become (lb = left bottom) - * - * xwin = [(xn + 1.0) * width]/2 + x_lb - * ywin = [(yn + 1.0) * height]/2 + y_lb - * - * Inverting (blender y is flipped!): - * - * xn = 2(xwin - x_lb)/width - 1.0 - * yn = 2(ywin - y_lb)/height - 1.0 - * = 2(height - y_blender - y_lb)/height - 1.0 - * = 1.0 - 2(y_blender - y_lb)/height - * - * */ - - - /* Because we don't want to worry about resize events, camera - * changes and all that crap, we just determine this over and - * over. Stop whining. We have lots of other calculations to do - * here as well. These reads are not the main cost. If there is no - * canvas, the test is irrelevant. The 1.0 makes sure the - * calculations don't bomb. Maybe we should explicitly guard for - * division by 0.0...*/ - - RAS_Rect area, viewport; - short m_y_inv = m_kxengine->GetCanvas()->GetHeight()-m_y; - - m_kxengine->GetSceneViewport(m_kxscene, cam, area, viewport); - - /* Check if the mouse is in the viewport */ - if (( m_x < viewport.m_x2 && // less then right - m_x > viewport.m_x1 && // more then then left - m_y_inv < viewport.m_y2 && // below top - m_y_inv > viewport.m_y1) == 0) // above bottom - { - return false; - } - - float height = float(viewport.m_y2 - viewport.m_y1 + 1); - float width = float(viewport.m_x2 - viewport.m_x1 + 1); - - float x_lb = float(viewport.m_x1); - float y_lb = float(viewport.m_y1); - - MT_Vector4 frompoint; - MT_Vector4 topoint; - - /* m_y_inv - inverting for a bounds check is only part of it, now make relative to view bounds */ - m_y_inv = (viewport.m_y2 - m_y_inv) + viewport.m_y1; - - - /* There's some strangeness I don't fully get here... These values - * _should_ be wrong! - see from point Z values */ - - - /* build the from and to point in normalized device coordinates - * Looks like normailized device coordinates are [-1,1] in x [-1,1] in y - * [0,-1] in z - * - * The actual z coordinates used don't have to be exact just infront and - * behind of the near and far clip planes. - */ - frompoint.setValue( (2 * (m_x-x_lb) / width) - 1.0, - 1.0 - (2 * (m_y_inv - y_lb) / height), - /*cam->GetCameraData()->m_perspective ? 0.0:cdata->m_clipstart,*/ /* real clipstart is scaled in ortho for some reason, zero is ok */ - 0.0, /* nearclip, see above comments */ - 1.0 ); - - topoint.setValue( (2 * (m_x-x_lb) / width) - 1.0, - 1.0 - (2 * (m_y_inv-y_lb) / height), - cam->GetCameraData()->m_perspective ? 1.0:cam->GetCameraData()->m_clipend, /* farclip, see above comments */ - 1.0 ); - - /* camera to world */ - MT_Transform wcs_camcs_tranform = cam->GetWorldToCamera(); - MT_Transform cams_wcs_transform; - cams_wcs_transform.invert(wcs_camcs_tranform); - - MT_Matrix4x4 camcs_wcs_matrix = MT_Matrix4x4(cams_wcs_transform); - - /* badly defined, the first time round.... I wonder why... I might - * want to guard against floating point errors here.*/ - MT_Matrix4x4 clip_camcs_matrix = MT_Matrix4x4(cam->GetProjectionMatrix()); - clip_camcs_matrix.invert(); - - /* shoot-points: clip to cam to wcs . win to clip was already done.*/ - frompoint = clip_camcs_matrix * frompoint; - topoint = clip_camcs_matrix * topoint; - frompoint = camcs_wcs_matrix * frompoint; - topoint = camcs_wcs_matrix * topoint; - - /* from hom wcs to 3d wcs: */ - m_prevSourcePoint.setValue( frompoint[0]/frompoint[3], - frompoint[1]/frompoint[3], - frompoint[2]/frompoint[3]); - - m_prevTargetPoint.setValue( topoint[0]/topoint[3], - topoint[1]/topoint[3], - topoint[2]/topoint[3]); - - /* 2. Get the object from PhysicsEnvironment */ - /* Shoot! Beware that the first argument here is an - * ignore-object. We don't ignore anything... */ - KX_IPhysicsController* physics_controller = cam->GetPhysicsController(); - PHY_IPhysicsEnvironment* physics_environment = m_kxscene->GetPhysicsEnvironment(); - - // get UV mapping - KX_RayCast::Callback callback(this,physics_controller,NULL,false,true); - - KX_RayCast::RayTest(physics_environment, m_prevSourcePoint, m_prevTargetPoint, callback); - - if (m_hitObject) - return true; - - return false; -} - -bool KX_MouseFocusSensor::ParentObjectHasFocus() -{ - m_hitObject = 0; - m_hitPosition.setValue(0,0,0); - m_hitNormal.setValue(1,0,0); - - KX_Camera *cam= m_kxscene->GetActiveCamera(); - - if(ParentObjectHasFocusCamera(cam)) - return true; - - list* cameras = m_kxscene->GetCameras(); - list::iterator it = cameras->begin(); - - while(it != cameras->end()) - { - if(((*it) != cam) && (*it)->GetViewport()) - if (ParentObjectHasFocusCamera(*it)) - return true; - - it++; - } - - return false; -} - -const MT_Point3& KX_MouseFocusSensor::RaySource() const -{ - return m_prevSourcePoint; -} - -const MT_Point3& KX_MouseFocusSensor::RayTarget() const -{ - return m_prevTargetPoint; -} - -const MT_Point3& KX_MouseFocusSensor::HitPosition() const -{ - return m_hitPosition; -} - -const MT_Vector3& KX_MouseFocusSensor::HitNormal() const -{ - return m_hitNormal; -} - -const MT_Vector2& KX_MouseFocusSensor::HitUV() const -{ - return m_hitUV; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_MouseFocusSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_MouseFocusSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_MouseSensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_MouseFocusSensor::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_MouseFocusSensor::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("raySource", KX_MouseFocusSensor, pyattr_get_ray_source), - KX_PYATTRIBUTE_RO_FUNCTION("rayTarget", KX_MouseFocusSensor, pyattr_get_ray_target), - KX_PYATTRIBUTE_RO_FUNCTION("rayDirection", KX_MouseFocusSensor, pyattr_get_ray_direction), - KX_PYATTRIBUTE_RO_FUNCTION("hitObject", KX_MouseFocusSensor, pyattr_get_hit_object), - KX_PYATTRIBUTE_RO_FUNCTION("hitPosition", KX_MouseFocusSensor, pyattr_get_hit_position), - KX_PYATTRIBUTE_RO_FUNCTION("hitNormal", KX_MouseFocusSensor, pyattr_get_hit_normal), - KX_PYATTRIBUTE_RO_FUNCTION("hitUV", KX_MouseFocusSensor, pyattr_get_hit_uv), - KX_PYATTRIBUTE_BOOL_RW("usePulseFocus", KX_MouseFocusSensor,m_bTouchPulse), - { NULL } //Sentinel -}; - -/* Attributes */ -PyObject* KX_MouseFocusSensor::pyattr_get_ray_source(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_MouseFocusSensor* self= static_cast(self_v); - return PyObjectFrom(self->RaySource()); -} - -PyObject* KX_MouseFocusSensor::pyattr_get_ray_target(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_MouseFocusSensor* self= static_cast(self_v); - return PyObjectFrom(self->RayTarget()); -} - -PyObject* KX_MouseFocusSensor::pyattr_get_ray_direction(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_MouseFocusSensor* self= static_cast(self_v); - MT_Vector3 dir = self->RayTarget() - self->RaySource(); - if(MT_fuzzyZero(dir)) dir.setValue(0,0,0); - else dir.normalize(); - return PyObjectFrom(dir); -} - -PyObject* KX_MouseFocusSensor::pyattr_get_hit_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_MouseFocusSensor* self= static_cast(self_v); - - if(self->m_hitObject) - return self->m_hitObject->GetProxy(); - - Py_RETURN_NONE; -} - -PyObject* KX_MouseFocusSensor::pyattr_get_hit_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_MouseFocusSensor* self= static_cast(self_v); - return PyObjectFrom(self->HitPosition()); -} - -PyObject* KX_MouseFocusSensor::pyattr_get_hit_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_MouseFocusSensor* self= static_cast(self_v); - return PyObjectFrom(self->HitNormal()); -} - -PyObject* KX_MouseFocusSensor::pyattr_get_hit_uv(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_MouseFocusSensor* self= static_cast(self_v); - return PyObjectFrom(self->HitUV()); -} - -#endif // DISABLE_PYTHON - -/* eof */ - diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h deleted file mode 100644 index c969aa3ec74..00000000000 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h +++ /dev/null @@ -1,185 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * KX_MouseFocusSensor determines mouse in/out/over events. - */ - -#ifndef __KX_MOUSEFOCUSSENSOR -#define __KX_MOUSEFOCUSSENSOR - -#include "SCA_MouseSensor.h" - -class KX_RayCast; - -/** - * The mouse focus sensor extends the basic SCA_MouseSensor. It has - * been placed in KX because it needs access to the rasterizer and - * SuMO. - * - * - extend the valid modes? - * - */ -class KX_MouseFocusSensor : public SCA_MouseSensor -{ - - Py_Header; - - public: - - KX_MouseFocusSensor(class SCA_MouseManager* eventmgr, - int startx, - int starty, - short int mousemode, - int focusmode, - bool bTouchPulse, - KX_Scene* kxscene, - KX_KetsjiEngine* kxengine, - SCA_IObject* gameobj); - - virtual ~KX_MouseFocusSensor() { ; }; - virtual CValue* GetReplica() { - CValue* replica = new KX_MouseFocusSensor(*this); - // this will copy properties and so on... - replica->ProcessReplica(); - return replica; - }; - - virtual void Replace_IScene(SCA_IScene *val) - { - m_kxscene= static_cast(val); - }; - - - /** - * @attention Overrides default evaluate. - */ - virtual bool Evaluate(); - virtual void Init(); - - virtual bool IsPositiveTrigger() { - bool result = m_positive_event; - if (m_invert) result = !result; - return result; - }; - - bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data); - bool NeedRayCast(KX_ClientObjectInfo* client) { return true; } - - const MT_Point3& RaySource() const; - const MT_Point3& RayTarget() const; - const MT_Point3& HitPosition() const; - const MT_Vector3& HitNormal() const; - const MT_Vector2& HitUV() const; - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - /* attributes */ - static PyObject* pyattr_get_ray_source(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_ray_target(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_ray_direction(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_hit_object(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_hit_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_hit_normal(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_hit_uv(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - -#endif // DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - SCA_IObject* m_hitObject; - void* m_hitObject_Last; /* only use for comparison, never access */ - - private: - /** - * The focus mode. 1 for handling focus, 0 for not handling, 2 for focus on any object - */ - int m_focusmode; - - /** - * Flags whether the previous test showed a mouse-over. - */ - bool m_mouse_over_in_previous_frame; - - /** - * Flags whether changes in hit object should trigger a pulse - */ - bool m_bTouchPulse; - - /** - * Flags whether the previous test evaluated positive. - */ - bool m_positive_event; - - /** - * Tests whether the object is in mouse focus for this camera - */ - bool ParentObjectHasFocusCamera(KX_Camera *cam); - - /** - * Tests whether the object is in mouse focus in this scene. - */ - bool ParentObjectHasFocus(void); - - /** - * (in game world coordinates) the place where the object was hit. - */ - MT_Point3 m_hitPosition; - - /** - * (in game world coordinates) the position to which to shoot the ray. - */ - MT_Point3 m_prevTargetPoint; - - /** - * (in game world coordinates) the position from which to shoot the ray. - */ - MT_Point3 m_prevSourcePoint; - - /** - * (in game world coordinates) the face normal of the vertex where - * the object was hit. */ - MT_Vector3 m_hitNormal; - - /** - * UV texture coordinate of the hit point if any, (0,0) otherwise - */ - MT_Vector2 m_hitUV; - - /** - * The KX scene that holds the camera. The camera position - * determines a part of the start location of the picking ray. */ - KX_Scene* m_kxscene; - - /** - * The KX engine is needed for computing the viewport */ - KX_KetsjiEngine* m_kxengine; -}; - -#endif //__KX_MOUSESENSOR - diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp deleted file mode 100644 index 36c1b0f5bd1..00000000000 --- a/source/gameengine/Ketsji/KX_NearSensor.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/** - * Sense if other objects are near - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_NearSensor.h" -#include "SCA_LogicManager.h" -#include "KX_GameObject.h" -#include "KX_TouchEventManager.h" -#include "KX_Scene.h" // needed to create a replica -#include "PHY_IPhysicsEnvironment.h" -#include "PHY_IPhysicsController.h" -#include "PHY_IMotionState.h" - -KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr, - KX_GameObject* gameobj, - float margin, - float resetmargin, - bool bFindMaterial, - const STR_String& touchedpropname, - PHY_IPhysicsController* ctrl) - :KX_TouchSensor(eventmgr, - gameobj, - bFindMaterial, - false, - touchedpropname), - m_Margin(margin), - m_ResetMargin(resetmargin) - -{ - - gameobj->getClientInfo()->m_sensors.remove(this); - m_client_info = new KX_ClientObjectInfo(gameobj, KX_ClientObjectInfo::SENSOR); - m_client_info->m_sensors.push_back(this); - - //DT_ShapeHandle shape = (DT_ShapeHandle) vshape; - m_physCtrl = ctrl; - if (m_physCtrl) - { - m_physCtrl->SetMargin(m_Margin); - m_physCtrl->setNewClientInfo(m_client_info); - } - SynchronizeTransform(); -} - -void KX_NearSensor::SynchronizeTransform() -{ - // The near and radar sensors are using a different physical object which is - // not linked to the parent object, must synchronize it. - if (m_physCtrl) - { - PHY_IMotionState* motionState = m_physCtrl->GetMotionState(); - KX_GameObject* parent = ((KX_GameObject*)GetParent()); - const MT_Point3& pos = parent->NodeGetWorldPosition(); - float ori[12]; - parent->NodeGetWorldOrientation().getValue(ori); - motionState->setWorldPosition(pos[0], pos[1], pos[2]); - motionState->setWorldOrientation(ori); - m_physCtrl->WriteMotionStateToDynamics(true); - } -} - -CValue* KX_NearSensor::GetReplica() -{ - KX_NearSensor* replica = new KX_NearSensor(*this); - replica->ProcessReplica(); - return replica; -} - -void KX_NearSensor::ProcessReplica() -{ - KX_TouchSensor::ProcessReplica(); - - m_client_info = new KX_ClientObjectInfo(m_client_info->m_gameobject, KX_ClientObjectInfo::SENSOR); - - if (m_physCtrl) - { - m_physCtrl = m_physCtrl->GetReplica(); - if (m_physCtrl) - { - //static_cast(m_eventmgr)->GetPhysicsEnvironment()->addSensor(replica->m_physCtrl); - m_physCtrl->SetMargin(m_Margin); - m_physCtrl->setNewClientInfo(m_client_info); - } - - } -} - -void KX_NearSensor::ReParent(SCA_IObject* parent) -{ - SCA_ISensor::ReParent(parent); - m_client_info->m_gameobject = static_cast(parent); - m_client_info->m_sensors.push_back(this); - //Synchronize here with the actual parent. - SynchronizeTransform(); -} - - - -KX_NearSensor::~KX_NearSensor() -{ - // for nearsensor, the sensor is the 'owner' of sumoobj - // for touchsensor, it's the parent - if (m_physCtrl) - { - //static_cast(m_eventmgr)->GetPhysicsEnvironment()->removeSensor(m_physCtrl); - delete m_physCtrl; - m_physCtrl = NULL; - } - - - if (m_client_info) - delete m_client_info; -} - -void KX_NearSensor::SetPhysCtrlRadius() -{ - if (m_bTriggered) - { - if (m_physCtrl) - { - m_physCtrl->SetRadius(m_ResetMargin); - } - } else - { - if (m_physCtrl) - { - m_physCtrl->SetRadius(m_Margin); - } - } -} - -bool KX_NearSensor::Evaluate() -{ - bool result = false; -// KX_GameObject* parent = static_cast(GetParent()); - - if (m_bTriggered != m_bLastTriggered) - { - m_bLastTriggered = m_bTriggered; - - SetPhysCtrlRadius(); - - result = true; - } - - return result; -} - -// this function is called at broad phase stage to check if the two controller -// need to interact at all. It is used for Near/Radar sensor that don't need to -// check collision with object not included in filter -bool KX_NearSensor::BroadPhaseFilterCollision(void*obj1,void*obj2) -{ - KX_GameObject* parent = static_cast(GetParent()); - - // need the mapping from PHY_IPhysicsController to gameobjects now - assert(obj1==m_physCtrl && obj2); - KX_ClientObjectInfo* client_info = static_cast((static_cast(obj2))->getNewClientInfo()); - - KX_GameObject* gameobj = ( client_info ? - client_info->m_gameobject : - NULL); - - if (gameobj && (gameobj != parent)) - { - // only take valid colliders - if (client_info->m_type == KX_ClientObjectInfo::ACTOR) - { - if ((m_touchedpropname.Length() == 0) || - (gameobj->GetProperty(m_touchedpropname))) - { - return true; - } - } - } - - return false; -} - -bool KX_NearSensor::NewHandleCollision(void* obj1,void* obj2,const PHY_CollData * coll_data) -{ -// KX_TouchEventManager* toucheventmgr = static_cast(m_eventmgr); -// KX_GameObject* parent = static_cast(GetParent()); - - // need the mapping from PHY_IPhysicsController to gameobjects now - - KX_ClientObjectInfo* client_info =static_cast (obj1 == m_physCtrl? - ((PHY_IPhysicsController*)obj2)->getNewClientInfo() : - ((PHY_IPhysicsController*)obj1)->getNewClientInfo()); - - KX_GameObject* gameobj = ( client_info ? - client_info->m_gameobject : - NULL); - - // Add the same check as in SCA_ISensor::Activate(), - // we don't want to record collision when the sensor is not active. - if (m_links && !m_suspended && - gameobj /* done in BroadPhaseFilterCollision() && (gameobj != parent)*/) - { - if (!m_colliders->SearchValue(gameobj)) - m_colliders->Add(gameobj->AddRef()); - // only take valid colliders - // These checks are done already in BroadPhaseFilterCollision() - //if (client_info->m_type == KX_ClientObjectInfo::ACTOR) - //{ - // if ((m_touchedpropname.Length() == 0) || - // (gameobj->GetProperty(m_touchedpropname))) - // { - m_bTriggered = true; - m_hitObject = gameobj; - // } - //} - } - - return false; // was DT_CONTINUE; but this was defined in Sumo as false -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python Functions */ -/* ------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------- */ -/* Python Integration Hooks */ -/* ------------------------------------------------------------------------- */ - -PyTypeObject KX_NearSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_NearSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &KX_TouchSensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_NearSensor::Methods[] = { - //No methods - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_NearSensor::Attributes[] = { - KX_PYATTRIBUTE_FLOAT_RW_CHECK("distance", 0, 100, KX_NearSensor, m_Margin, CheckResetDistance), - KX_PYATTRIBUTE_FLOAT_RW_CHECK("resetDistance", 0, 100, KX_NearSensor, m_ResetMargin, CheckResetDistance), - {NULL} //Sentinel -}; - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_NearSensor.h b/source/gameengine/Ketsji/KX_NearSensor.h deleted file mode 100644 index 10dba22c4e9..00000000000 --- a/source/gameengine/Ketsji/KX_NearSensor.h +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Sense if other objects are near - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef KX_NEARSENSOR_H -#define KX_NEARSENSOR_H - -#include "KX_TouchSensor.h" -#include "KX_ClientObjectInfo.h" - -class KX_Scene; -struct PHY_CollData; - -class KX_NearSensor : public KX_TouchSensor -{ - Py_Header; -protected: - float m_Margin; - float m_ResetMargin; - - KX_ClientObjectInfo* m_client_info; -public: - KX_NearSensor(class SCA_EventManager* eventmgr, - class KX_GameObject* gameobj, - float margin, - float resetmargin, - bool bFindMaterial, - const STR_String& touchedpropname, - PHY_IPhysicsController* ctrl); -/* -public: - KX_NearSensor(class SCA_EventManager* eventmgr, - class KX_GameObject* gameobj, - double margin, - double resetmargin, - bool bFindMaterial, - const STR_String& touchedpropname, - class KX_Scene* scene); -*/ - virtual ~KX_NearSensor(); - virtual void SynchronizeTransform(); - virtual CValue* GetReplica(); - virtual void ProcessReplica(); - virtual void SetPhysCtrlRadius(); - virtual bool Evaluate(); - - virtual void ReParent(SCA_IObject* parent); - virtual bool NewHandleCollision(void* obj1,void* obj2, - const PHY_CollData * coll_data); - virtual bool BroadPhaseFilterCollision(void*obj1,void*obj2); - virtual bool BroadPhaseSensorFilterCollision(void*obj1,void*obj2) { return false; }; - virtual sensortype GetSensorType() { return ST_NEAR; } - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - //No methods - - //This method is used to make sure the distance does not exceed the reset distance - static int CheckResetDistance(void *self, const PyAttributeDef*) - { - KX_NearSensor* sensor = reinterpret_cast(self); - - if (sensor->m_Margin > sensor->m_ResetMargin) - sensor->m_ResetMargin = sensor->m_Margin; - - sensor->SetPhysCtrlRadius(); - - return 0; - } - -#endif // DISABLE_PYTHON - -}; - -#endif //KX_NEARSENSOR_H - diff --git a/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp b/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp deleted file mode 100644 index 108cff0232d..00000000000 --- a/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_ObColorIpoSGController.h" -#include "KX_ScalarInterpolator.h" -#include "KX_GameObject.h" - -#if defined(_WIN64) -typedef unsigned __int64 uint_ptr; -#else -typedef unsigned long uint_ptr; -#endif - - -bool KX_ObColorIpoSGController::Update(double currentTime) -{ - if (m_modified) - { - m_rgba[0]=0; - m_rgba[1]=0; - m_rgba[2]=0; - m_rgba[3]=0; - - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - (*i)->Execute(m_ipotime); - } - - - SG_Spatial* ob = (SG_Spatial*)m_pObject; - KX_GameObject* kxgameobj= (KX_GameObject*) ob->GetSGClientObject(); - - kxgameobj->SetObjectColor(m_rgba); - - - m_modified=false; - } - return false; -} - - -void KX_ObColorIpoSGController::AddInterpolator(KX_IInterpolator* interp) -{ - this->m_interpolators.push_back(interp); -} - -SG_Controller* KX_ObColorIpoSGController::GetReplica(class SG_Node* destnode) -{ - KX_ObColorIpoSGController* iporeplica = new KX_ObColorIpoSGController(*this); - // clear object that ipo acts on - iporeplica->ClearObject(); - - // dirty hack, ask Gino for a better solution in the ipo implementation - // hacken en zagen, in what we call datahiding, not written for replication :( - - T_InterpolatorList oldlist = m_interpolators; - iporeplica->m_interpolators.clear(); - - T_InterpolatorList::iterator i; - for (i = oldlist.begin(); !(i == oldlist.end()); ++i) { - KX_ScalarInterpolator* copyipo = new KX_ScalarInterpolator(*((KX_ScalarInterpolator*)*i)); - iporeplica->AddInterpolator(copyipo); - - MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget(); - uint_ptr orgbase = (uint_ptr)this; - uint_ptr orgloc = (uint_ptr)scaal; - uint_ptr offset = orgloc-orgbase; - uint_ptr newaddrbase = (uint_ptr)iporeplica + offset; - MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; - copyipo->SetNewTarget((MT_Scalar*)blaptr); - } - - return iporeplica; -} - -KX_ObColorIpoSGController::~KX_ObColorIpoSGController() -{ - - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - delete (*i); - } - -} diff --git a/source/gameengine/Ketsji/KX_ObColorIpoSGController.h b/source/gameengine/Ketsji/KX_ObColorIpoSGController.h deleted file mode 100644 index fd8de7a70d0..00000000000 --- a/source/gameengine/Ketsji/KX_ObColorIpoSGController.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_OBCOLORIPOSGCONTROLLER_H -#define KX_OBCOLORIPOSGCONTROLLER_H - -#include "SG_Controller.h" -#include "SG_Spatial.h" -#include "KX_IInterpolator.h" - -class KX_ObColorIpoSGController : public SG_Controller -{ -public: - MT_Vector4 m_rgba; - - -private: - T_InterpolatorList m_interpolators; - bool m_modified; - - double m_ipotime; -public: - KX_ObColorIpoSGController() : - m_modified(true), - m_ipotime(0.0) - {} - virtual ~KX_ObColorIpoSGController(); - virtual SG_Controller* GetReplica(class SG_Node* destnode); - virtual bool Update(double time); - virtual void SetSimulatedTime(double time) { - m_ipotime = time; - m_modified = true; - } - - void - SetOption( - int option, - int value - ){ - // intentionally empty - }; - - - void AddInterpolator(KX_IInterpolator* interp); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ObColorIpoSGController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // KX_OBCOLORIPOSGCONTROLLER_H - diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp deleted file mode 100644 index dff95551d70..00000000000 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ /dev/null @@ -1,639 +0,0 @@ -/** - * Do translation/rotation actions - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_ObjectActuator.h" -#include "KX_GameObject.h" -#include "KX_PyMath.h" // For PyVecTo - should this include be put in PyObjectPlus? -#include "KX_IPhysicsController.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_ObjectActuator:: -KX_ObjectActuator( - SCA_IObject* gameobj, - KX_GameObject* refobj, - const MT_Vector3& force, - const MT_Vector3& torque, - const MT_Vector3& dloc, - const MT_Vector3& drot, - const MT_Vector3& linV, - const MT_Vector3& angV, - const short damping, - const KX_LocalFlags& flag -) : - SCA_IActuator(gameobj, KX_ACT_OBJECT), - m_force(force), - m_torque(torque), - m_dloc(dloc), - m_drot(drot), - m_linear_velocity(linV), - m_angular_velocity(angV), - m_linear_length2(0.0), - m_current_linear_factor(0.0), - m_current_angular_factor(0.0), - m_damping(damping), - m_previous_error(0.0,0.0,0.0), - m_error_accumulator(0.0,0.0,0.0), - m_bitLocalFlag (flag), - m_reference(refobj), - m_active_combined_velocity (false), - m_linear_damping_active(false), - m_angular_damping_active(false) -{ - if (m_bitLocalFlag.ServoControl) - { - // in servo motion, the force is local if the target velocity is local - m_bitLocalFlag.Force = m_bitLocalFlag.LinearVelocity; - - m_pid = m_torque; - } - if (m_reference) - m_reference->RegisterActuator(this); - UpdateFuzzyFlags(); -} - -KX_ObjectActuator::~KX_ObjectActuator() -{ - if (m_reference) - m_reference->UnregisterActuator(this); -} - -bool KX_ObjectActuator::Update() -{ - - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - KX_GameObject *parent = static_cast(GetParent()); - - if (bNegativeEvent) { - // If we previously set the linear velocity we now have to inform - // the physics controller that we no longer wish to apply it and that - // it should reconcile the externally set velocity with it's - // own velocity. - if (m_active_combined_velocity) { - if (parent) - parent->ResolveCombinedVelocities( - m_linear_velocity, - m_angular_velocity, - (m_bitLocalFlag.LinearVelocity) != 0, - (m_bitLocalFlag.AngularVelocity) != 0 - ); - m_active_combined_velocity = false; - } - m_linear_damping_active = false; - m_angular_damping_active = false; - m_error_accumulator.setValue(0.0,0.0,0.0); - m_previous_error.setValue(0.0,0.0,0.0); - return false; - - } else if (parent) - { - if (m_bitLocalFlag.ServoControl) - { - // In this mode, we try to reach a target speed using force - // As we don't know the friction, we must implement a generic - // servo control to achieve the speed in a configurable - // v = current velocity - // V = target velocity - // e = V-v = speed error - // dt = time interval since previous update - // I = sum(e(t)*dt) - // dv = e(t) - e(t-1) - // KP, KD, KI : coefficient - // F = KP*e+KI*I+KD*dv - MT_Scalar mass = parent->GetMass(); - if (mass < MT_EPSILON) - return false; - MT_Vector3 v = parent->GetLinearVelocity(m_bitLocalFlag.LinearVelocity); - if (m_reference) - { - const MT_Point3& mypos = parent->NodeGetWorldPosition(); - const MT_Point3& refpos = m_reference->NodeGetWorldPosition(); - MT_Point3 relpos; - relpos = (mypos-refpos); - MT_Vector3 vel= m_reference->GetVelocity(relpos); - if (m_bitLocalFlag.LinearVelocity) - // must convert in local space - vel = parent->NodeGetWorldOrientation().transposed()*vel; - v -= vel; - } - MT_Vector3 e = m_linear_velocity - v; - MT_Vector3 dv = e - m_previous_error; - MT_Vector3 I = m_error_accumulator + e; - - m_force = m_pid.x()*e+m_pid.y()*I+m_pid.z()*dv; - // to automatically adapt the PID coefficient to mass; - m_force *= mass; - if (m_bitLocalFlag.Torque) - { - if (m_force[0] > m_dloc[0]) - { - m_force[0] = m_dloc[0]; - I[0] = m_error_accumulator[0]; - } else if (m_force[0] < m_drot[0]) - { - m_force[0] = m_drot[0]; - I[0] = m_error_accumulator[0]; - } - } - if (m_bitLocalFlag.DLoc) - { - if (m_force[1] > m_dloc[1]) - { - m_force[1] = m_dloc[1]; - I[1] = m_error_accumulator[1]; - } else if (m_force[1] < m_drot[1]) - { - m_force[1] = m_drot[1]; - I[1] = m_error_accumulator[1]; - } - } - if (m_bitLocalFlag.DRot) - { - if (m_force[2] > m_dloc[2]) - { - m_force[2] = m_dloc[2]; - I[2] = m_error_accumulator[2]; - } else if (m_force[2] < m_drot[2]) - { - m_force[2] = m_drot[2]; - I[2] = m_error_accumulator[2]; - } - } - m_previous_error = e; - m_error_accumulator = I; - parent->ApplyForce(m_force,(m_bitLocalFlag.LinearVelocity) != 0); - } else - { - if (!m_bitLocalFlag.ZeroForce) - { - parent->ApplyForce(m_force,(m_bitLocalFlag.Force) != 0); - } - if (!m_bitLocalFlag.ZeroTorque) - { - parent->ApplyTorque(m_torque,(m_bitLocalFlag.Torque) != 0); - } - if (!m_bitLocalFlag.ZeroDLoc) - { - parent->ApplyMovement(m_dloc,(m_bitLocalFlag.DLoc) != 0); - } - if (!m_bitLocalFlag.ZeroDRot) - { - parent->ApplyRotation(m_drot,(m_bitLocalFlag.DRot) != 0); - } - if (!m_bitLocalFlag.ZeroLinearVelocity) - { - if (m_bitLocalFlag.AddOrSetLinV) { - parent->addLinearVelocity(m_linear_velocity,(m_bitLocalFlag.LinearVelocity) != 0); - } else { - m_active_combined_velocity = true; - if (m_damping > 0) { - MT_Vector3 linV; - if (!m_linear_damping_active) { - // delta and the start speed (depends on the existing speed in that direction) - linV = parent->GetLinearVelocity(m_bitLocalFlag.LinearVelocity); - // keep only the projection along the desired direction - m_current_linear_factor = linV.dot(m_linear_velocity)/m_linear_length2; - m_linear_damping_active = true; - } - if (m_current_linear_factor < 1.0) - m_current_linear_factor += 1.0/m_damping; - if (m_current_linear_factor > 1.0) - m_current_linear_factor = 1.0; - linV = m_current_linear_factor * m_linear_velocity; - parent->setLinearVelocity(linV,(m_bitLocalFlag.LinearVelocity) != 0); - } else { - parent->setLinearVelocity(m_linear_velocity,(m_bitLocalFlag.LinearVelocity) != 0); - } - } - } - if (!m_bitLocalFlag.ZeroAngularVelocity) - { - m_active_combined_velocity = true; - if (m_damping > 0) { - MT_Vector3 angV; - if (!m_angular_damping_active) { - // delta and the start speed (depends on the existing speed in that direction) - angV = parent->GetAngularVelocity(m_bitLocalFlag.AngularVelocity); - // keep only the projection along the desired direction - m_current_angular_factor = angV.dot(m_angular_velocity)/m_angular_length2; - m_angular_damping_active = true; - } - if (m_current_angular_factor < 1.0) - m_current_angular_factor += 1.0/m_damping; - if (m_current_angular_factor > 1.0) - m_current_angular_factor = 1.0; - angV = m_current_angular_factor * m_angular_velocity; - parent->setAngularVelocity(angV,(m_bitLocalFlag.AngularVelocity) != 0); - } else { - parent->setAngularVelocity(m_angular_velocity,(m_bitLocalFlag.AngularVelocity) != 0); - } - } - } - - } - return true; -} - - - -CValue* KX_ObjectActuator::GetReplica() -{ - KX_ObjectActuator* replica = new KX_ObjectActuator(*this);//m_float,GetName()); - replica->ProcessReplica(); - - return replica; -} - -void KX_ObjectActuator::ProcessReplica() -{ - SCA_IActuator::ProcessReplica(); - if (m_reference) - m_reference->RegisterActuator(this); -} - -bool KX_ObjectActuator::UnlinkObject(SCA_IObject* clientobj) -{ - if (clientobj == (SCA_IObject*)m_reference) - { - // this object is being deleted, we cannot continue to use it as reference. - m_reference = NULL; - return true; - } - return false; -} - -void KX_ObjectActuator::Relink(GEN_Map *obj_map) -{ - void **h_obj = (*obj_map)[m_reference]; - if (h_obj) { - if (m_reference) - m_reference->UnregisterActuator(this); - m_reference = (KX_GameObject*)(*h_obj); - m_reference->RegisterActuator(this); - } -} - -/* some 'standard' utilities... */ -bool KX_ObjectActuator::isValid(KX_ObjectActuator::KX_OBJECT_ACT_VEC_TYPE type) -{ - bool res = false; - res = (type > KX_OBJECT_ACT_NODEF) && (type < KX_OBJECT_ACT_MAX); - return res; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_ObjectActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_ObjectActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_ObjectActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_ObjectActuator::Attributes[] = { - KX_PYATTRIBUTE_VECTOR_RW_CHECK("force", -1000, 1000, false, KX_ObjectActuator, m_force, PyUpdateFuzzyFlags), - KX_PYATTRIBUTE_BOOL_RW("useLocalForce", KX_ObjectActuator, m_bitLocalFlag.Force), - KX_PYATTRIBUTE_VECTOR_RW_CHECK("torque", -1000, 1000, false, KX_ObjectActuator, m_torque, PyUpdateFuzzyFlags), - KX_PYATTRIBUTE_BOOL_RW("useLocalTorque", KX_ObjectActuator, m_bitLocalFlag.Torque), - KX_PYATTRIBUTE_VECTOR_RW_CHECK("dLoc", -1000, 1000, false, KX_ObjectActuator, m_dloc, PyUpdateFuzzyFlags), - KX_PYATTRIBUTE_BOOL_RW("useLocalDLoc", KX_ObjectActuator, m_bitLocalFlag.DLoc), - KX_PYATTRIBUTE_VECTOR_RW_CHECK("dRot", -1000, 1000, false, KX_ObjectActuator, m_drot, PyUpdateFuzzyFlags), - KX_PYATTRIBUTE_BOOL_RW("useLocalDRot", KX_ObjectActuator, m_bitLocalFlag.DRot), -#ifdef USE_MATHUTILS - KX_PYATTRIBUTE_RW_FUNCTION("linV", KX_ObjectActuator, pyattr_get_linV, pyattr_set_linV), - KX_PYATTRIBUTE_RW_FUNCTION("angV", KX_ObjectActuator, pyattr_get_angV, pyattr_set_angV), -#else - KX_PYATTRIBUTE_VECTOR_RW_CHECK("linV", -1000, 1000, false, KX_ObjectActuator, m_linear_velocity, PyUpdateFuzzyFlags), - KX_PYATTRIBUTE_VECTOR_RW_CHECK("angV", -1000, 1000, false, KX_ObjectActuator, m_angular_velocity, PyUpdateFuzzyFlags), -#endif - KX_PYATTRIBUTE_BOOL_RW("useLocalLinV", KX_ObjectActuator, m_bitLocalFlag.LinearVelocity), - KX_PYATTRIBUTE_BOOL_RW("useLocalAngV", KX_ObjectActuator, m_bitLocalFlag.AngularVelocity), - KX_PYATTRIBUTE_SHORT_RW("damping", 0, 1000, false, KX_ObjectActuator, m_damping), - KX_PYATTRIBUTE_RW_FUNCTION("forceLimitX", KX_ObjectActuator, pyattr_get_forceLimitX, pyattr_set_forceLimitX), - KX_PYATTRIBUTE_RW_FUNCTION("forceLimitY", KX_ObjectActuator, pyattr_get_forceLimitY, pyattr_set_forceLimitY), - KX_PYATTRIBUTE_RW_FUNCTION("forceLimitZ", KX_ObjectActuator, pyattr_get_forceLimitZ, pyattr_set_forceLimitZ), - KX_PYATTRIBUTE_VECTOR_RW_CHECK("pid", -100, 200, true, KX_ObjectActuator, m_pid, PyCheckPid), - KX_PYATTRIBUTE_RW_FUNCTION("reference", KX_ObjectActuator,pyattr_get_reference,pyattr_set_reference), - { NULL } //Sentinel -}; - -/* Attribute get/set functions */ - -#ifdef USE_MATHUTILS - -/* These require an SGNode */ -#define MATHUTILS_VEC_CB_LINV 1 -#define MATHUTILS_VEC_CB_ANGV 2 - -static int mathutils_kxobactu_vector_cb_index= -1; /* index for our callbacks */ - -static int mathutils_obactu_generic_check(BaseMathObject *bmo) -{ - KX_ObjectActuator* self= static_castBGE_PROXY_REF(bmo->cb_user); - if(self==NULL) - return 0; - - return 1; -} - -static int mathutils_obactu_vector_get(BaseMathObject *bmo, int subtype) -{ - KX_ObjectActuator* self= static_castBGE_PROXY_REF(bmo->cb_user); - if(self==NULL) - return 0; - - switch(subtype) { - case MATHUTILS_VEC_CB_LINV: - self->m_linear_velocity.getValue(bmo->data); - break; - case MATHUTILS_VEC_CB_ANGV: - self->m_angular_velocity.getValue(bmo->data); - break; - } - - return 1; -} - -static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype) -{ - KX_ObjectActuator* self= static_castBGE_PROXY_REF(bmo->cb_user); - if(self==NULL) - return 0; - - switch(subtype) { - case MATHUTILS_VEC_CB_LINV: - self->m_linear_velocity.setValue(bmo->data); - break; - case MATHUTILS_VEC_CB_ANGV: - self->m_angular_velocity.setValue(bmo->data); - break; - } - - return 1; -} - -static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, int index) -{ - /* lazy, avoid repeteing the case statement */ - if(!mathutils_obactu_vector_get(bmo, subtype)) - return 0; - return 1; -} - -static int mathutils_obactu_vector_set_index(BaseMathObject *bmo, int subtype, int index) -{ - float f= bmo->data[index]; - - /* lazy, avoid repeteing the case statement */ - if(!mathutils_obactu_vector_get(bmo, subtype)) - return 0; - - bmo->data[index]= f; - mathutils_obactu_vector_set(bmo, subtype); - - return 1; -} - -Mathutils_Callback mathutils_obactu_vector_cb = { - mathutils_obactu_generic_check, - mathutils_obactu_vector_get, - mathutils_obactu_vector_set, - mathutils_obactu_vector_get_index, - mathutils_obactu_vector_set_index -}; - -PyObject* KX_ObjectActuator::pyattr_get_linV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxobactu_vector_cb_index, MATHUTILS_VEC_CB_LINV); -} - -int KX_ObjectActuator::pyattr_set_linV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_ObjectActuator* self= static_cast(self_v); - if (!PyVecTo(value, self->m_linear_velocity)) - return PY_SET_ATTR_FAIL; - - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_ObjectActuator::pyattr_get_angV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - return newVectorObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxobactu_vector_cb_index, MATHUTILS_VEC_CB_ANGV); -} - -int KX_ObjectActuator::pyattr_set_angV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_ObjectActuator* self= static_cast(self_v); - if (!PyVecTo(value, self->m_angular_velocity)) - return PY_SET_ATTR_FAIL; - - return PY_SET_ATTR_SUCCESS; -} - - -void KX_ObjectActuator_Mathutils_Callback_Init(void) -{ - // register mathutils callbacks, ok to run more then once. - mathutils_kxobactu_vector_cb_index= Mathutils_RegisterCallback(&mathutils_obactu_vector_cb); -} - -#endif // USE_MATHUTILS - -PyObject* KX_ObjectActuator::pyattr_get_forceLimitX(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_ObjectActuator* self = reinterpret_cast(self_v); - PyObject *retVal = PyList_New(3); - - PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(self->m_drot[0])); - PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(self->m_dloc[0])); - PyList_SET_ITEM(retVal, 2, PyBool_FromLong(self->m_bitLocalFlag.Torque)); - - return retVal; -} - -int KX_ObjectActuator::pyattr_set_forceLimitX(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_ObjectActuator* self = reinterpret_cast(self_v); - - PyObject* seq = PySequence_Fast(value, ""); - if (seq && PySequence_Fast_GET_SIZE(seq) == 3) - { - self->m_drot[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0)); - self->m_dloc[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1)); - self->m_bitLocalFlag.Torque = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0); - - if (!PyErr_Occurred()) - { - Py_DECREF(seq); - return PY_SET_ATTR_SUCCESS; - } - } - - Py_XDECREF(seq); - - PyErr_SetString(PyExc_ValueError, "expected a sequence of 2 floats and a bool"); - return PY_SET_ATTR_FAIL; -} - -PyObject* KX_ObjectActuator::pyattr_get_forceLimitY(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_ObjectActuator* self = reinterpret_cast(self_v); - PyObject *retVal = PyList_New(3); - - PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(self->m_drot[1])); - PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(self->m_dloc[1])); - PyList_SET_ITEM(retVal, 2, PyBool_FromLong(self->m_bitLocalFlag.DLoc)); - - return retVal; -} - -int KX_ObjectActuator::pyattr_set_forceLimitY(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_ObjectActuator* self = reinterpret_cast(self_v); - - PyObject* seq = PySequence_Fast(value, ""); - if (seq && PySequence_Fast_GET_SIZE(seq) == 3) - { - self->m_drot[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0)); - self->m_dloc[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1)); - self->m_bitLocalFlag.DLoc = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0); - - if (!PyErr_Occurred()) - { - Py_DECREF(seq); - return PY_SET_ATTR_SUCCESS; - } - } - - Py_XDECREF(seq); - - PyErr_SetString(PyExc_ValueError, "expected a sequence of 2 floats and a bool"); - return PY_SET_ATTR_FAIL; -} - -PyObject* KX_ObjectActuator::pyattr_get_forceLimitZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_ObjectActuator* self = reinterpret_cast(self_v); - PyObject *retVal = PyList_New(3); - - PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(self->m_drot[2])); - PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(self->m_dloc[2])); - PyList_SET_ITEM(retVal, 2, PyBool_FromLong(self->m_bitLocalFlag.DRot)); - - return retVal; -} - -int KX_ObjectActuator::pyattr_set_forceLimitZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_ObjectActuator* self = reinterpret_cast(self_v); - - PyObject* seq = PySequence_Fast(value, ""); - if (seq && PySequence_Fast_GET_SIZE(seq) == 3) - { - self->m_drot[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0)); - self->m_dloc[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1)); - self->m_bitLocalFlag.DRot = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0); - - if (!PyErr_Occurred()) - { - Py_DECREF(seq); - return PY_SET_ATTR_SUCCESS; - } - } - - Py_XDECREF(seq); - - PyErr_SetString(PyExc_ValueError, "expected a sequence of 2 floats and a bool"); - return PY_SET_ATTR_FAIL; -} - -PyObject* KX_ObjectActuator::pyattr_get_reference(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_ObjectActuator* actuator = static_cast(self); - if (!actuator->m_reference) - Py_RETURN_NONE; - - return actuator->m_reference->GetProxy(); -} - -int KX_ObjectActuator::pyattr_set_reference(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_ObjectActuator* actuator = static_cast(self); - KX_GameObject *refOb; - - if (!ConvertPythonToGameObject(value, &refOb, true, "actu.reference = value: KX_ObjectActuator")) - return PY_SET_ATTR_FAIL; - - if (actuator->m_reference) - actuator->m_reference->UnregisterActuator(actuator); - - if(refOb==NULL) { - actuator->m_reference= NULL; - } - else { - actuator->m_reference = refOb; - actuator->m_reference->RegisterActuator(actuator); - } - - return PY_SET_ATTR_SUCCESS; -} - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h deleted file mode 100644 index b12cf77d3e1..00000000000 --- a/source/gameengine/Ketsji/KX_ObjectActuator.h +++ /dev/null @@ -1,225 +0,0 @@ -/** - * Do translation/rotation actions - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_OBJECTACTUATOR -#define __KX_OBJECTACTUATOR - -#include "SCA_IActuator.h" -#include "MT_Vector3.h" - -#ifdef USE_MATHUTILS -void KX_ObjectActuator_Mathutils_Callback_Init(void); -#endif - -class KX_GameObject; - -// -// Stores the flags for each CValue derived class -// -struct KX_LocalFlags { - KX_LocalFlags() : - Force(false), - Torque(false), - DRot(false), - DLoc(false), - LinearVelocity(false), - AngularVelocity(false), - AddOrSetLinV(false), - ZeroForce(false), - ZeroDRot(false), - ZeroDLoc(false), - ZeroLinearVelocity(false), - ZeroAngularVelocity(false) - { - } - - bool Force; - bool Torque; - bool DRot; - bool DLoc; - bool LinearVelocity; - bool AngularVelocity; - bool AddOrSetLinV; - bool ServoControl; - bool ZeroForce; - bool ZeroTorque; - bool ZeroDRot; - bool ZeroDLoc; - bool ZeroLinearVelocity; - bool ZeroAngularVelocity; -}; - -class KX_ObjectActuator : public SCA_IActuator -{ - Py_Header; - - MT_Vector3 m_force; - MT_Vector3 m_torque; - MT_Vector3 m_dloc; - MT_Vector3 m_drot; - MT_Vector3 m_linear_velocity; - MT_Vector3 m_angular_velocity; - MT_Vector3 m_pid; - MT_Scalar m_linear_length2; - MT_Scalar m_angular_length2; - // used in damping - MT_Scalar m_current_linear_factor; - MT_Scalar m_current_angular_factor; - short m_damping; - // used in servo control - MT_Vector3 m_previous_error; - MT_Vector3 m_error_accumulator; - KX_LocalFlags m_bitLocalFlag; - KX_GameObject* m_reference; - // A hack bool -- oh no sorry everyone - // This bool is used to check if we have informed - // the physics object that we are no longer - // setting linear velocity. - - bool m_active_combined_velocity; - bool m_linear_damping_active; - bool m_angular_damping_active; - -public: - enum KX_OBJECT_ACT_VEC_TYPE { - KX_OBJECT_ACT_NODEF = 0, - KX_OBJECT_ACT_FORCE, - KX_OBJECT_ACT_TORQUE, - KX_OBJECT_ACT_DLOC, - KX_OBJECT_ACT_DROT, - KX_OBJECT_ACT_LINEAR_VELOCITY, - KX_OBJECT_ACT_ANGULAR_VELOCITY, - KX_OBJECT_ACT_MAX - }; - - /** - * Check whether this is a valid vector mode - */ - bool isValid(KX_OBJECT_ACT_VEC_TYPE type); - - KX_ObjectActuator( - SCA_IObject* gameobj, - KX_GameObject* refobj, - const MT_Vector3& force, - const MT_Vector3& torque, - const MT_Vector3& dloc, - const MT_Vector3& drot, - const MT_Vector3& linV, - const MT_Vector3& angV, - const short damping, - const KX_LocalFlags& flag - ); - ~KX_ObjectActuator(); - CValue* GetReplica(); - void ProcessReplica(); - bool UnlinkObject(SCA_IObject* clientobj); - void Relink(GEN_Map *obj_map); - - void SetForceLoc(const double force[3]) { /*m_force=force;*/ } - void UpdateFuzzyFlags() - { - m_bitLocalFlag.ZeroForce = MT_fuzzyZero(m_force); - m_bitLocalFlag.ZeroTorque = MT_fuzzyZero(m_torque); - m_bitLocalFlag.ZeroDLoc = MT_fuzzyZero(m_dloc); - m_bitLocalFlag.ZeroDRot = MT_fuzzyZero(m_drot); - m_bitLocalFlag.ZeroLinearVelocity = MT_fuzzyZero(m_linear_velocity); - m_linear_length2 = (m_bitLocalFlag.ZeroLinearVelocity) ? 0.0 : m_linear_velocity.length2(); - m_bitLocalFlag.ZeroAngularVelocity = MT_fuzzyZero(m_angular_velocity); - m_angular_length2 = (m_bitLocalFlag.ZeroAngularVelocity) ? 0.0 : m_angular_velocity.length2(); - } - virtual bool Update(); - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - /* Attributes */ - static PyObject* pyattr_get_forceLimitX(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_forceLimitX(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_forceLimitY(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_forceLimitY(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_forceLimitZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_forceLimitZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_reference(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_reference(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - -#ifdef USE_MATHUTILS - static PyObject* pyattr_get_linV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_linV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_angV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_angV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); -#endif - - // This lets the attribute macros use UpdateFuzzyFlags() - static int PyUpdateFuzzyFlags(void *self, const PyAttributeDef *attrdef) - { - KX_ObjectActuator* act = reinterpret_cast(self); - act->UpdateFuzzyFlags(); - return 0; - } - - // This is the keep the PID values in check after they are assigned with Python - static int PyCheckPid(void *self, const PyAttributeDef *attrdef) - { - KX_ObjectActuator* act = reinterpret_cast(self); - - //P 0 to 200 - if (act->m_pid[0] < 0) { - act->m_pid[0] = 0; - } else if (act->m_pid[0] > 200) { - act->m_pid[0] = 200; - } - - //I 0 to 3 - if (act->m_pid[1] < 0) { - act->m_pid[1] = 0; - } else if (act->m_pid[1] > 3) { - act->m_pid[1] = 3; - } - - //D -100 to 100 - if (act->m_pid[2] < -100) { - act->m_pid[2] = -100; - } else if (act->m_pid[2] > 100) { - act->m_pid[2] = 100; - } - - return 0; - } - -#endif // DISABLE_PYTHON - -}; - -#endif //__KX_OBJECTACTUATOR - diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp deleted file mode 100644 index 8949a85066c..00000000000 --- a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_OrientationInterpolator.h" -#include "MT_Matrix3x3.h" -#include "KX_IScalarInterpolator.h" - -void KX_OrientationInterpolator::Execute(float currentTime) const { - MT_Vector3 eul(m_ipos[0]->GetValue(currentTime), - m_ipos[1]->GetValue(currentTime), - m_ipos[2]->GetValue(currentTime)); - MT_Scalar ci = cos(eul[0]); - MT_Scalar cj = cos(eul[1]); - MT_Scalar ch = cos(eul[2]); - MT_Scalar si = sin(eul[0]); - MT_Scalar sj = sin(eul[1]); - MT_Scalar sh = sin(eul[2]); - MT_Scalar cc = ci*ch; - MT_Scalar cs = ci*sh; - MT_Scalar sc = si*ch; - MT_Scalar ss = si*sh; - - m_target.setValue(cj*ch, sj*sc-cs, sj*cc+ss, - cj*sh, sj*ss+cc, sj*cs-sc, - -sj, cj*si, cj*ci); -} diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.h b/source/gameengine/Ketsji/KX_OrientationInterpolator.h deleted file mode 100644 index fda331f126d..00000000000 --- a/source/gameengine/Ketsji/KX_OrientationInterpolator.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_ORIENTATIONINTERPOLATOR -#define KX_ORIENTATIONINTERPOLATOR - -#include "KX_IInterpolator.h" - -class MT_Matrix3x3; -class KX_IScalarInterpolator; - -class KX_OrientationInterpolator : public KX_IInterpolator { -public: - KX_OrientationInterpolator(MT_Matrix3x3& target, - KX_IScalarInterpolator **ipos) - : m_target(target) - { - m_ipos[0] = ipos[0]; - m_ipos[1] = ipos[1]; - m_ipos[2] = ipos[2]; - } - - virtual void Execute(float currentTime) const; - -private: - MT_Matrix3x3& m_target; - KX_IScalarInterpolator *m_ipos[3]; - - -#ifdef WITH_CXX_GUARDEDALLOC -private: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_OrientationInterpolator"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp deleted file mode 100644 index 62740585831..00000000000 --- a/source/gameengine/Ketsji/KX_ParentActuator.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/** - * Set or remove an objects parent - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_ParentActuator.h" -#include "KX_GameObject.h" -#include "KX_PythonInit.h" - -#include "PyObjectPlus.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_ParentActuator::KX_ParentActuator(SCA_IObject *gameobj, - int mode, - bool addToCompound, - bool ghost, - SCA_IObject *ob) - : SCA_IActuator(gameobj, KX_ACT_PARENT), - m_mode(mode), - m_addToCompound(addToCompound), - m_ghost(ghost), - m_ob(ob) -{ - if (m_ob) - m_ob->RegisterActuator(this); -} - - - -KX_ParentActuator::~KX_ParentActuator() -{ - if (m_ob) - m_ob->UnregisterActuator(this); -} - - - -CValue* KX_ParentActuator::GetReplica() -{ - KX_ParentActuator* replica = new KX_ParentActuator(*this); - // replication just copy the m_base pointer => common random generator - replica->ProcessReplica(); - return replica; -} - -void KX_ParentActuator::ProcessReplica() -{ - if (m_ob) - m_ob->RegisterActuator(this); - SCA_IActuator::ProcessReplica(); -} - - -bool KX_ParentActuator::UnlinkObject(SCA_IObject* clientobj) -{ - if (clientobj == m_ob) - { - // this object is being deleted, we cannot continue to track it. - m_ob = NULL; - return true; - } - return false; -} - -void KX_ParentActuator::Relink(GEN_Map *obj_map) -{ - void **h_obj = (*obj_map)[m_ob]; - if (h_obj) { - if (m_ob) - m_ob->UnregisterActuator(this); - m_ob = (SCA_IObject*)(*h_obj); - m_ob->RegisterActuator(this); - } -} - - - -bool KX_ParentActuator::Update() -{ - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (bNegativeEvent) - return false; // do nothing on negative events - - KX_GameObject *obj = (KX_GameObject*) GetParent(); - KX_Scene *scene = KX_GetActiveScene(); - switch (m_mode) { - case KX_PARENT_SET: - if (m_ob) - obj->SetParent(scene, (KX_GameObject*)m_ob, m_addToCompound, m_ghost); - break; - case KX_PARENT_REMOVE: - obj->RemoveParent(scene); - break; - }; - - return false; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_ParentActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_ParentActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_ParentActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_ParentActuator::Attributes[] = { - KX_PYATTRIBUTE_RW_FUNCTION("object", KX_ParentActuator, pyattr_get_object, pyattr_set_object), - KX_PYATTRIBUTE_INT_RW("mode", KX_PARENT_NODEF+1, KX_PARENT_MAX-1, true, KX_ParentActuator, m_mode), - KX_PYATTRIBUTE_BOOL_RW("compound", KX_ParentActuator, m_addToCompound), - KX_PYATTRIBUTE_BOOL_RW("ghost", KX_ParentActuator, m_ghost), - { NULL } //Sentinel -}; - -PyObject* KX_ParentActuator::pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_ParentActuator* actuator = static_cast(self); - if (!actuator->m_ob) - Py_RETURN_NONE; - else - return actuator->m_ob->GetProxy(); -} - -int KX_ParentActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_ParentActuator* actuator = static_cast(self); - KX_GameObject *gameobj; - - if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.object = value: KX_ParentActuator")) - return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - - if (actuator->m_ob != NULL) - actuator->m_ob->UnregisterActuator(actuator); - - actuator->m_ob = (SCA_IObject*) gameobj; - - if (actuator->m_ob) - actuator->m_ob->RegisterActuator(actuator); - - return PY_SET_ATTR_SUCCESS; -} - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_ParentActuator.h b/source/gameengine/Ketsji/KX_ParentActuator.h deleted file mode 100644 index 884b1829ae3..00000000000 --- a/source/gameengine/Ketsji/KX_ParentActuator.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Set or remove an objects parent - * - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_PARENTACTUATOR -#define __KX_PARENTACTUATOR - -#include "SCA_IActuator.h" -#include "SCA_LogicManager.h" - -class KX_ParentActuator : public SCA_IActuator -{ - Py_Header; - - /** Mode */ - int m_mode; - - /** option */ - bool m_addToCompound; - bool m_ghost; - /** Object to set as parent */ - SCA_IObject *m_ob; - - - - public: - enum KX_PARENTACT_MODE - { - KX_PARENT_NODEF = 0, - KX_PARENT_SET, - KX_PARENT_REMOVE, - KX_PARENT_MAX - - }; - - KX_ParentActuator(class SCA_IObject* gameobj, - int mode, - bool addToCompound, - bool ghost, - SCA_IObject *ob); - virtual ~KX_ParentActuator(); - virtual bool Update(); - - virtual CValue* GetReplica(); - virtual void ProcessReplica(); - virtual void Relink(GEN_Map *obj_map); - virtual bool UnlinkObject(SCA_IObject* clientobj); - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - /* These are used to get and set m_ob */ - static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - -#endif // DISABLE_PYTHON - -}; /* end of class KX_ParentActuator : public SCA_PropertyActuator */ - -#endif - diff --git a/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h b/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h deleted file mode 100644 index 506ba6365a0..00000000000 --- a/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_PHYSICSENGINEENUMS -#define __KX_PHYSICSENGINEENUMS - -enum e_PhysicsEngine -{ - NoSelection = -1, - UseNone = 0, - UseEnji = 1, - UseSumo = 2, - UseDynamo = 3, - UseODE = 4, - UseBullet = 5, -}; - -#endif //__KX_PHYSICSENGINEENUMS - diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp deleted file mode 100644 index 15fc3e5c471..00000000000 --- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "PyObjectPlus.h" - -#include "KX_PhysicsObjectWrapper.h" -#include "PHY_IPhysicsEnvironment.h" -#include "PHY_IPhysicsController.h" - -KX_PhysicsObjectWrapper::KX_PhysicsObjectWrapper( - PHY_IPhysicsController* ctrl, - PHY_IPhysicsEnvironment* physenv) : - PyObjectPlus(), - m_ctrl(ctrl), - m_physenv(physenv) -{ -} - -KX_PhysicsObjectWrapper::~KX_PhysicsObjectWrapper() -{ -} - -#ifndef DISABLE_PYTHON - -PyObject* KX_PhysicsObjectWrapper::PySetPosition(PyObject* args) -{ - float x,y,z; - if (PyArg_ParseTuple(args,"fff:setPosition",&x,&y,&z)) - { - m_ctrl->setPosition(x,y,z); - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - -PyObject* KX_PhysicsObjectWrapper::PySetLinearVelocity(PyObject* args) -{ - float x,y,z; - int local; - if (PyArg_ParseTuple(args,"fffi:setLinearVelocity",&x,&y,&z,&local)) - { - m_ctrl->SetLinearVelocity(x,y,z,local != 0); - } - else { - return NULL; - } - Py_RETURN_NONE; -} - -PyObject* KX_PhysicsObjectWrapper::PySetAngularVelocity(PyObject* args) -{ - float x,y,z; - int local; - if (PyArg_ParseTuple(args,"fffi:setAngularVelocity",&x,&y,&z,&local)) - { - m_ctrl->SetAngularVelocity(x,y,z,local != 0); - } - else { - return NULL; - } - Py_RETURN_NONE; -} - -PyObject* KX_PhysicsObjectWrapper::PySetActive(PyObject* args) -{ - int active; - if (PyArg_ParseTuple(args,"i:setActive",&active)) - { - m_ctrl->SetActive(active!=0); - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - -PyAttributeDef KX_PhysicsObjectWrapper::Attributes[] = { - { NULL } //Sentinel -}; - -//python specific stuff -PyTypeObject KX_PhysicsObjectWrapper::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_PhysicsObjectWrapper", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &PyObjectPlus::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_PhysicsObjectWrapper::Methods[] = { - {"setPosition",(PyCFunction) KX_PhysicsObjectWrapper::sPySetPosition, METH_VARARGS}, - {"setLinearVelocity",(PyCFunction) KX_PhysicsObjectWrapper::sPySetLinearVelocity, METH_VARARGS}, - {"setAngularVelocity",(PyCFunction) KX_PhysicsObjectWrapper::sPySetAngularVelocity, METH_VARARGS}, - {"setActive",(PyCFunction) KX_PhysicsObjectWrapper::sPySetActive, METH_VARARGS}, - {NULL,NULL} //Sentinel -}; - -#endif diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h deleted file mode 100644 index 01980c0f644..00000000000 --- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef PHYP_PHYSICSOBJECT_WRAPPER -#define PHYP_PHYSICSOBJECT_WRAPPER - -#include "Value.h" -#include "PHY_DynamicTypes.h" - -class KX_PhysicsObjectWrapper : public PyObjectPlus -{ - Py_Header; -public: - KX_PhysicsObjectWrapper(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsEnvironment* physenv); - virtual ~KX_PhysicsObjectWrapper(); - -#ifndef DISABLE_PYTHON - - KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetPosition); - KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetLinearVelocity); - KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetAngularVelocity); - KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetActive); - -#endif // DISABLE_PYTHON - -private: - class PHY_IPhysicsController* m_ctrl; - PHY_IPhysicsEnvironment* m_physenv; -}; - -#endif //PHYP_PHYSICSOBJECT_WRAPPER - diff --git a/source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h b/source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h deleted file mode 100644 index d94b5328488..00000000000 --- a/source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_PROPSH -#define KX_PROPSH - -#include - -// Properties of dynamic objects -struct KX_ShapeProps { - MT_Scalar m_mass; // Total mass - MT_Scalar m_inertia; // Inertia, should be a tensor some time - MT_Scalar m_lin_drag; // Linear drag (air, water) 0 = concrete, 1 = vacuum - MT_Scalar m_ang_drag; // Angular drag - MT_Scalar m_friction_scaling[3]; // Scaling for anisotropic friction. Component in range [0, 1] - bool m_do_anisotropic; // Should I do anisotropic friction? - bool m_do_fh; // Should the object have a linear Fh spring? - bool m_do_rot_fh; // Should the object have an angular Fh spring? -}; - - -// Properties of collidable objects (non-ghost objects) -struct KX_MaterialProps { - MT_Scalar m_restitution; // restitution of energie after a collision 0 = inelastic, 1 = elastic - MT_Scalar m_friction; // Coulomb friction (= ratio between the normal en maximum friction force) - MT_Scalar m_fh_spring; // Spring constant (both linear and angular) - MT_Scalar m_fh_damping; // Damping factor (linear and angular) in range [0, 1] - MT_Scalar m_fh_distance; // The range above the surface where Fh is active. - bool m_fh_normal; // Should the object slide off slopes? -}; - -#endif //KX_PROPSH - diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp deleted file mode 100644 index 837c79c77b3..00000000000 --- a/source/gameengine/Ketsji/KX_PolyProxy.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef DISABLE_PYTHON - -#include "KX_PolyProxy.h" -#include "KX_MeshProxy.h" -#include "RAS_MeshObject.h" -#include "KX_BlenderMaterial.h" -#include "KX_PolygonMaterial.h" - -#include "KX_PyMath.h" - -PyTypeObject KX_PolyProxy::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_PolyProxy", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &CValue::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_PolyProxy::Methods[] = { - KX_PYMETHODTABLE_NOARGS(KX_PolyProxy,getMaterialIndex), - KX_PYMETHODTABLE_NOARGS(KX_PolyProxy,getNumVertex), - KX_PYMETHODTABLE_NOARGS(KX_PolyProxy,isVisible), - KX_PYMETHODTABLE_NOARGS(KX_PolyProxy,isCollider), - KX_PYMETHODTABLE_NOARGS(KX_PolyProxy,getMaterialName), - KX_PYMETHODTABLE_NOARGS(KX_PolyProxy,getTextureName), - KX_PYMETHODTABLE(KX_PolyProxy,getVertexIndex), - KX_PYMETHODTABLE_NOARGS(KX_PolyProxy,getMesh), - KX_PYMETHODTABLE_NOARGS(KX_PolyProxy,getMaterial), - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_PolyProxy::Attributes[] = { - /* All dummy's so they come up in a dir() */ - //KX_PYATTRIBUTE_TODO("DummyProps"), - KX_PYATTRIBUTE_DUMMY("matname"), - KX_PYATTRIBUTE_DUMMY("texture"), - KX_PYATTRIBUTE_DUMMY("material"), - KX_PYATTRIBUTE_DUMMY("matid"), - KX_PYATTRIBUTE_DUMMY("v1"), - KX_PYATTRIBUTE_DUMMY("v2"), - KX_PYATTRIBUTE_DUMMY("v3"), - KX_PYATTRIBUTE_DUMMY("v4"), - KX_PYATTRIBUTE_DUMMY("visible"), - KX_PYATTRIBUTE_DUMMY("collide"), - { NULL } //Sentinel -}; - -#if 0 -PyObject* KX_PolyProxy::py_getattro(PyObject *attr) -{ - char *attr_str= _PyUnicode_AsString(attr); - if (!strcmp(attr_str, "matname")) - { - return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName()); - } - if (!strcmp(attr_str, "texture")) - { - return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName()); - } - if (!strcmp(attr_str, "material")) - { - RAS_IPolyMaterial *polymat = m_polygon->GetMaterial()->GetPolyMaterial(); - if(polymat->GetFlag() & RAS_BLENDERMAT) - { - KX_BlenderMaterial* mat = static_cast(polymat); - return mat->GetProxy(); - } - else - { - KX_PolygonMaterial* mat = static_cast(polymat); - return mat->GetProxy(); - } - } - if (!strcmp(attr_str, "matid")) - { - // we'll have to scan through the material bucket of the mes and compare with - // the one of the polygon - RAS_MaterialBucket* polyBucket = m_polygon->GetMaterial(); - unsigned int matid; - for (matid=0; matid<(unsigned int)m_mesh->NumMaterials(); matid++) - { - RAS_MeshMaterial* meshMat = m_mesh->GetMeshMaterial(matid); - if (meshMat->m_bucket == polyBucket) - // found it - break; - } - return PyLong_FromSsize_t(matid); - } - if (!strcmp(attr_str, "v1")) - { - return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 0)); - } - if (!strcmp(attr_str, "v2")) - { - return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 1)); - } - if (!strcmp(attr_str, "v3")) - { - return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 2)); - } - if (!strcmp(attr_str, "v4")) - { - return PyLong_FromSsize_t(((m_polygon->VertexCount()>3)?m_polygon->GetVertexOffsetAbs(m_mesh, 3):0)); - } - if (!strcmp(attr_str, "visible")) - { - return PyLong_FromSsize_t(m_polygon->IsVisible()); - } - if (!strcmp(attr_str, "collide")) - { - return PyLong_FromSsize_t(m_polygon->IsCollider()); - } - // py_getattro_up(CValue); // XXX -- todo, make all these attributes -} -#endif - -KX_PolyProxy::KX_PolyProxy(const RAS_MeshObject*mesh, RAS_Polygon* polygon) -: m_polygon(polygon), - m_mesh((RAS_MeshObject*)mesh) -{ -} - -KX_PolyProxy::~KX_PolyProxy() -{ -} - - -// stuff for cvalue related things -CValue* KX_PolyProxy::Calc(VALUE_OPERATOR, CValue *) { return NULL;} -CValue* KX_PolyProxy::CalcFinal(VALUE_DATA_TYPE, VALUE_OPERATOR, CValue *) { return NULL;} -STR_String sPolyName="polygone"; -const STR_String & KX_PolyProxy::GetText() {return sPolyName;}; -double KX_PolyProxy::GetNumber() { return -1;} -STR_String& KX_PolyProxy::GetName() { return sPolyName;} -void KX_PolyProxy::SetName(const char *) { }; -CValue* KX_PolyProxy::GetReplica() { return NULL;} - -// stuff for python integration - -KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex, -"getMaterialIndex() : return the material index of the polygon in the mesh\n") -{ - RAS_MaterialBucket* polyBucket = m_polygon->GetMaterial(); - unsigned int matid; - for (matid=0; matid<(unsigned int)m_mesh->NumMaterials(); matid++) - { - RAS_MeshMaterial* meshMat = m_mesh->GetMeshMaterial(matid); - if (meshMat->m_bucket == polyBucket) - // found it - break; - } - return PyLong_FromSsize_t(matid); -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getNumVertex, -"getNumVertex() : returns the number of vertex of the polygon, 3 or 4\n") -{ - return PyLong_FromSsize_t(m_polygon->VertexCount()); -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isVisible, -"isVisible() : returns whether the polygon is visible or not\n") -{ - return PyLong_FromSsize_t(m_polygon->IsVisible()); -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isCollider, -"isCollider() : returns whether the polygon is receives collision or not\n") -{ - return PyLong_FromSsize_t(m_polygon->IsCollider()); -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialName, -"getMaterialName() : returns the polygon material name, \"NoMaterial\" if no material\n") -{ - return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName()); -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getTextureName, -"getTexturelName() : returns the polygon texture name, \"NULL\" if no texture\n") -{ - return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName()); -} - -KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex, -"getVertexIndex(vertex) : returns the mesh vertex index of a polygon vertex\n" -"vertex: index of the vertex in the polygon: 0->3\n" -"return value can be used to retrieve the vertex details through mesh proxy\n" -"Note: getVertexIndex(3) on a triangle polygon returns 0\n") -{ - int index; - if (!PyArg_ParseTuple(args,"i:getVertexIndex",&index)) - { - return NULL; - } - if (index < 0 || index > 3) - { - PyErr_SetString(PyExc_AttributeError, "poly.getVertexIndex(int): KX_PolyProxy, expected an index between 0-3"); - return NULL; - } - if (index < m_polygon->VertexCount()) - { - return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, index)); - } - return PyLong_FromSsize_t(0); -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMesh, -"getMesh() : returns a mesh proxy\n") -{ - KX_MeshProxy* meshproxy = new KX_MeshProxy((RAS_MeshObject*)m_mesh); - return meshproxy->NewProxy(true); -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterial, -"getMaterial() : returns a material\n") -{ - RAS_IPolyMaterial *polymat = m_polygon->GetMaterial()->GetPolyMaterial(); - if(polymat->GetFlag() & RAS_BLENDERMAT) - { - KX_BlenderMaterial* mat = static_cast(polymat); - return mat->GetProxy(); - } - else - { - KX_PolygonMaterial* mat = static_cast(polymat); - return mat->GetProxy(); - } -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PolyProxy.h b/source/gameengine/Ketsji/KX_PolyProxy.h deleted file mode 100644 index 97d89b37435..00000000000 --- a/source/gameengine/Ketsji/KX_PolyProxy.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_POLYROXY -#define __KX_POLYPROXY - -#ifndef DISABLE_PYTHON - -#include "SCA_IObject.h" - -class KX_PolyProxy : public CValue -{ - Py_Header; -protected: - class RAS_Polygon* m_polygon; - class RAS_MeshObject* m_mesh; -public: - KX_PolyProxy(const class RAS_MeshObject*mesh, class RAS_Polygon* polygon); - virtual ~KX_PolyProxy(); - - // stuff for cvalue related things - CValue* Calc(VALUE_OPERATOR op, CValue *val) ; - CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - const STR_String & GetText(); - double GetNumber(); - STR_String& GetName(); - void SetName(const char *name); // Set the name of the value - CValue* GetReplica(); - - -// stuff for python integration - - KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getMaterialIndex) - KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getNumVertex) - KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,isVisible) - KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,isCollider) - KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getMaterialName) - KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getTextureName) - KX_PYMETHOD_DOC(KX_PolyProxy,getVertexIndex) - KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getMesh) - KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getMaterial) - -}; - -#endif // DISABLE_PYTHON - -#endif //__KX_POLYPROXY - diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp deleted file mode 100644 index 98544cdc925..00000000000 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp +++ /dev/null @@ -1,396 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "KX_PolygonMaterial.h" - -#include "BKE_mesh.h" -#include "BKE_global.h" -#include "BKE_image.h" - -#include "DNA_material_types.h" -#include "DNA_texture_types.h" -#include "DNA_image_types.h" -#include "DNA_meshdata_types.h" - -#include "IMB_imbuf_types.h" - -#include "GPU_draw.h" - -#include "MEM_guardedalloc.h" - -#include "RAS_LightObject.h" -#include "RAS_MaterialBucket.h" - -#include "KX_PyMath.h" - -KX_PolygonMaterial::KX_PolygonMaterial() - : PyObjectPlus(), - RAS_IPolyMaterial(), - - m_tface(NULL), - m_mcol(NULL), - m_material(NULL), -#ifndef DISABLE_PYTHON - m_pymaterial(NULL), -#endif - m_pass(0) -{ -} - -void KX_PolygonMaterial::Initialize( - const STR_String &texname, - Material* ma, - int materialindex, - int tile, - int tilexrep, - int tileyrep, - int mode, - int transp, - bool alpha, - bool zsort, - int lightlayer, - struct MTFace* tface, - unsigned int* mcol) -{ - RAS_IPolyMaterial::Initialize( - texname, - ma?ma->id.name:"", - materialindex, - tile, - tilexrep, - tileyrep, - mode, - transp, - alpha, - zsort); - m_tface = tface; - m_mcol = mcol; - m_material = ma; -#ifndef DISABLE_PYTHON - m_pymaterial = 0; -#endif - m_pass = 0; -} - -KX_PolygonMaterial::~KX_PolygonMaterial() -{ -#ifndef DISABLE_PYTHON - if (m_pymaterial) - { - Py_DECREF(m_pymaterial); - } -#endif // DISABLE_PYTHON -} - -bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const -{ - bool dopass = false; - -#ifndef DISABLE_PYTHON - if (m_pymaterial) - { - PyObject *pyRasty = PyCObject_FromVoidPtr((void*)rasty, NULL); /* new reference */ - PyObject *pyCachingInfo = PyCObject_FromVoidPtr((void*) &cachingInfo, NULL); /* new reference */ - PyObject *ret = PyObject_CallMethod(m_pymaterial, "activate", "(NNO)", pyRasty, pyCachingInfo, (PyObject*) this->m_proxy); - if (ret) - { - bool value = PyLong_AsSsize_t(ret); - Py_DECREF(ret); - dopass = value; - } - else - { - PyErr_Print(); - PyErr_Clear(); - PySys_SetObject( (char *)"last_traceback", NULL); - } - } - else -#endif // DISABLE_PYTHON - { - switch (m_pass++) - { - case 0: - DefaultActivate(rasty, cachingInfo); - dopass = true; - break; - default: - m_pass = 0; - dopass = false; - break; - } - } - - return dopass; -} - -void KX_PolygonMaterial::DefaultActivate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const -{ - if (GetCachingInfo() != cachingInfo) - { - if (!cachingInfo) - GPU_set_tpage(NULL, 0); - - cachingInfo = GetCachingInfo(); - - if ((m_drawingmode & 4)&& (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED)) - { - Image *ima = (Image*)m_tface->tpage; - GPU_update_image_time(ima, rasty->GetTime()); - GPU_set_tpage(m_tface, 1); - } - else - GPU_set_tpage(NULL, 0); - - if(m_drawingmode & RAS_IRasterizer::KX_TWOSIDE) - rasty->SetCullFace(false); - else - rasty->SetCullFace(true); - - if ((m_drawingmode & RAS_IRasterizer::KX_LINES) || - (rasty->GetDrawingMode() <= RAS_IRasterizer::KX_WIREFRAME)) - rasty->SetLines(true); - else - rasty->SetLines(false); - rasty->SetSpecularity(m_specular[0],m_specular[1],m_specular[2],m_specularity); - rasty->SetShinyness(m_shininess); - rasty->SetDiffuse(m_diffuse[0], m_diffuse[1],m_diffuse[2], 1.0); - if (m_material) - rasty->SetPolygonOffset(-m_material->zoffs, 0.0); - } - - //rasty->SetSpecularity(m_specular[0],m_specular[1],m_specular[2],m_specularity); - //rasty->SetShinyness(m_shininess); - //rasty->SetDiffuse(m_diffuse[0], m_diffuse[1],m_diffuse[2], 1.0); - //if (m_material) - // rasty->SetPolygonOffset(-m_material->zoffs, 0.0); -} - -void KX_PolygonMaterial::GetMaterialRGBAColor(unsigned char *rgba) const -{ - if (m_material) { - *rgba++ = (unsigned char) (m_material->r*255.0); - *rgba++ = (unsigned char) (m_material->g*255.0); - *rgba++ = (unsigned char) (m_material->b*255.0); - *rgba++ = (unsigned char) (m_material->alpha*255.0); - } else - RAS_IPolyMaterial::GetMaterialRGBAColor(rgba); -} - -#ifndef DISABLE_PYTHON - -//---------------------------------------------------------------------------- -//Python - - -PyMethodDef KX_PolygonMaterial::Methods[] = { - KX_PYMETHODTABLE(KX_PolygonMaterial, setCustomMaterial), - KX_PYMETHODTABLE(KX_PolygonMaterial, updateTexture), - KX_PYMETHODTABLE(KX_PolygonMaterial, setTexture), - KX_PYMETHODTABLE(KX_PolygonMaterial, activate), -// KX_PYMETHODTABLE(KX_PolygonMaterial, setPerPixelLights), - - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_PolygonMaterial::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("texture", KX_PolygonMaterial, pyattr_get_texture), - KX_PYATTRIBUTE_RO_FUNCTION("material", KX_PolygonMaterial, pyattr_get_material), /* should probably be .name ? */ - - KX_PYATTRIBUTE_INT_RW("tile", INT_MIN, INT_MAX, true, KX_PolygonMaterial, m_tile), - KX_PYATTRIBUTE_INT_RW("tilexrep", INT_MIN, INT_MAX, true, KX_PolygonMaterial, m_tilexrep), - KX_PYATTRIBUTE_INT_RW("tileyrep", INT_MIN, INT_MAX, true, KX_PolygonMaterial, m_tileyrep), - KX_PYATTRIBUTE_INT_RW("drawingmode", INT_MIN, INT_MAX, true, KX_PolygonMaterial, m_drawingmode), - //KX_PYATTRIBUTE_INT_RW("lightlayer", INT_MIN, INT_MAX, true, KX_PolygonMaterial, m_lightlayer), - - KX_PYATTRIBUTE_BOOL_RW("transparent", KX_PolygonMaterial, m_alpha), - KX_PYATTRIBUTE_BOOL_RW("zsort", KX_PolygonMaterial, m_zsort), - - KX_PYATTRIBUTE_FLOAT_RW("shininess", 0.0f, 1000.0f, KX_PolygonMaterial, m_shininess), - KX_PYATTRIBUTE_FLOAT_RW("specularity", 0.0f, 1000.0f, KX_PolygonMaterial, m_specularity), - - KX_PYATTRIBUTE_RW_FUNCTION("diffuse", KX_PolygonMaterial, pyattr_get_texture, pyattr_set_diffuse), - KX_PYATTRIBUTE_RW_FUNCTION("specular",KX_PolygonMaterial, pyattr_get_specular, pyattr_set_specular), - - KX_PYATTRIBUTE_RO_FUNCTION("tface", KX_PolygonMaterial, pyattr_get_tface), /* How the heck is this even useful??? - Campbell */ - KX_PYATTRIBUTE_RO_FUNCTION("gl_texture", KX_PolygonMaterial, pyattr_get_gl_texture), /* could be called 'bindcode' */ - - /* triangle used to be an attribute, removed for 2.49, nobody should be using it */ - { NULL } //Sentinel -}; - -PyTypeObject KX_PolygonMaterial::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_PolygonMaterial", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &PyObjectPlus::Type, - 0,0,0,0,0,0, - py_base_new -}; - -KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setCustomMaterial, "setCustomMaterial(material)") -{ - PyObject *material; - if (PyArg_ParseTuple(args, "O:setCustomMaterial", &material)) - { - if (m_pymaterial) { - Py_DECREF(m_pymaterial); - } - m_pymaterial = material; - Py_INCREF(m_pymaterial); - Py_RETURN_NONE; - } - - return NULL; -} - -KX_PYMETHODDEF_DOC(KX_PolygonMaterial, updateTexture, "updateTexture(tface, rasty)") -{ - PyObject *pyrasty, *pytface; - if (PyArg_ParseTuple(args, "O!O!:updateTexture", &PyCObject_Type, &pytface, &PyCObject_Type, &pyrasty)) - { - MTFace *tface = (MTFace*) PyCObject_AsVoidPtr(pytface); - RAS_IRasterizer *rasty = (RAS_IRasterizer*) PyCObject_AsVoidPtr(pyrasty); - Image *ima = (Image*)tface->tpage; - GPU_update_image_time(ima, rasty->GetTime()); - - Py_RETURN_NONE; - } - - return NULL; -} - -KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setTexture, "setTexture(tface)") -{ - PyObject *pytface; - if (PyArg_ParseTuple(args, "O!:setTexture", &PyCObject_Type, &pytface)) - { - MTFace *tface = (MTFace*) PyCObject_AsVoidPtr(pytface); - GPU_set_tpage(tface, 1); - Py_RETURN_NONE; - } - - return NULL; -} - -KX_PYMETHODDEF_DOC(KX_PolygonMaterial, activate, "activate(rasty, cachingInfo)") -{ - PyObject *pyrasty, *pyCachingInfo; - if (PyArg_ParseTuple(args, "O!O!:activate", &PyCObject_Type, &pyrasty, &PyCObject_Type, &pyCachingInfo)) - { - RAS_IRasterizer *rasty = static_cast(PyCObject_AsVoidPtr(pyrasty)); - TCachingInfo *cachingInfo = static_cast(PyCObject_AsVoidPtr(pyCachingInfo)); - if (rasty && cachingInfo) - { - DefaultActivate(rasty, *cachingInfo); - Py_RETURN_NONE; - } - } - - return NULL; -} - -PyObject* KX_PolygonMaterial::pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_PolygonMaterial* self= static_cast(self_v); - return PyUnicode_FromString(self->m_texturename.ReadPtr()); -} - -PyObject* KX_PolygonMaterial::pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_PolygonMaterial* self= static_cast(self_v); - return PyUnicode_FromString(self->m_materialname.ReadPtr()); -} - -/* this does not seem useful */ -PyObject* KX_PolygonMaterial::pyattr_get_tface(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_PolygonMaterial* self= static_cast(self_v); - return PyCObject_FromVoidPtr(self->m_tface, NULL); -} - -PyObject* KX_PolygonMaterial::pyattr_get_gl_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_PolygonMaterial* self= static_cast(self_v); - int bindcode= 0; - if (self->m_tface && self->m_tface->tpage) - bindcode= self->m_tface->tpage->bindcode; - - return PyLong_FromSsize_t(bindcode); -} - - -PyObject* KX_PolygonMaterial::pyattr_get_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_PolygonMaterial* self= static_cast(self_v); - return PyObjectFrom(self->m_diffuse); -} - -int KX_PolygonMaterial::pyattr_set_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_PolygonMaterial* self= static_cast(self_v); - MT_Vector3 vec; - - if (!PyVecTo(value, vec)) - return PY_SET_ATTR_FAIL; - - self->m_diffuse= vec; - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_PolygonMaterial::pyattr_get_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_PolygonMaterial* self= static_cast(self_v); - return PyObjectFrom(self->m_specular); -} - -int KX_PolygonMaterial::pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_PolygonMaterial* self= static_cast(self_v); - MT_Vector3 vec; - - if (!PyVecTo(value, vec)) - return PY_SET_ATTR_FAIL; - - self->m_specular= vec; - return PY_SET_ATTR_SUCCESS; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h deleted file mode 100644 index 9d538b4a3da..00000000000 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.h +++ /dev/null @@ -1,149 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_POLYGONMATERIAL_H__ -#define __KX_POLYGONMATERIAL_H__ - -#include "PyObjectPlus.h" - -#include "RAS_MaterialBucket.h" -#include "RAS_IRasterizer.h" -#include "DNA_ID.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -struct MTFace; -struct Material; -struct MTex; - -/** - * Material class. - * - * This holds the shader, textures and python methods for setting the render state before - * rendering. - */ -class KX_PolygonMaterial : public PyObjectPlus, public RAS_IPolyMaterial -{ - Py_Header; -private: - /** Blender texture face structure. */ - MTFace* m_tface; - unsigned int* m_mcol; - Material* m_material; - -#ifndef DISABLE_PYTHON - PyObject* m_pymaterial; -#endif - - mutable int m_pass; -public: - - KX_PolygonMaterial(); - void Initialize(const STR_String &texname, - Material* ma, - int materialindex, - int tile, - int tilexrep, - int tileyrep, - int mode, - int transp, - bool alpha, - bool zsort, - int lightlayer, - struct MTFace* tface, - unsigned int* mcol); - - virtual ~KX_PolygonMaterial(); - - /** - * Returns the caching information for this material, - * This can be used to speed up the rasterizing process. - * @return The caching information. - */ - virtual TCachingInfo GetCachingInfo(void) const - { - return (void*) this; - } - - /** - * Activates the material in the (OpenGL) rasterizer. - * On entry, the cachingInfo contains info about the last activated material. - * On exit, the cachingInfo should contain updated info about this material. - * @param rasty The rasterizer in which the material should be active. - * @param cachingInfo The information about the material used to speed up rasterizing. - */ - void DefaultActivate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const; - virtual bool Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const; - - Material *GetBlenderMaterial() const - { - return m_material; - } - - /** - * Returns the Blender texture face structure that is used for this material. - * @return The material's texture face. - */ - MTFace* GetMTFace(void) const - { - return m_tface; - } - - unsigned int* GetMCol(void) const - { - return m_mcol; - } - virtual void GetMaterialRGBAColor(unsigned char *rgba) const; - -#ifndef DISABLE_PYTHON - KX_PYMETHOD_DOC(KX_PolygonMaterial, updateTexture); - KX_PYMETHOD_DOC(KX_PolygonMaterial, setTexture); - KX_PYMETHOD_DOC(KX_PolygonMaterial, activate); - - KX_PYMETHOD_DOC(KX_PolygonMaterial, setCustomMaterial); - KX_PYMETHOD_DOC(KX_PolygonMaterial, loadProgram); - - virtual PyObject* py_repr(void) { return PyUnicode_FromString(m_material ? ((ID *)m_material)->name+2 : ""); } - - static PyObject* pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - - static PyObject* pyattr_get_tface(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_gl_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - - static PyObject* pyattr_get_diffuse(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_specular(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); -#endif -}; - -#endif // __KX_POLYGONMATERIAL_H__ - diff --git a/source/gameengine/Ketsji/KX_PositionInterpolator.cpp b/source/gameengine/Ketsji/KX_PositionInterpolator.cpp deleted file mode 100644 index 6e047180cdf..00000000000 --- a/source/gameengine/Ketsji/KX_PositionInterpolator.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_PositionInterpolator.h" -#include "MT_Point3.h" -#include "KX_IScalarInterpolator.h" - -void KX_PositionInterpolator::Execute(float currentTime) const { - m_target.setValue(m_ipos[0]->GetValue(currentTime), - m_ipos[1]->GetValue(currentTime), - m_ipos[2]->GetValue(currentTime)); -} diff --git a/source/gameengine/Ketsji/KX_PositionInterpolator.h b/source/gameengine/Ketsji/KX_PositionInterpolator.h deleted file mode 100644 index 3dd72a6b08f..00000000000 --- a/source/gameengine/Ketsji/KX_PositionInterpolator.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_POSITIONINTERPOLATOR -#define KX_POSITIONINTERPOLATOR - -#include "KX_IInterpolator.h" - -class MT_Point3; -class KX_IScalarInterpolator; - -class KX_PositionInterpolator : public KX_IInterpolator { -public: - KX_PositionInterpolator(MT_Point3& target, - KX_IScalarInterpolator *ipos[]) : - m_target(target) - { - m_ipos[0] = ipos[0]; - m_ipos[1] = ipos[1]; - m_ipos[2] = ipos[2]; - } - - virtual void Execute(float currentTime) const; - -private: - MT_Point3& m_target; - KX_IScalarInterpolator *m_ipos[3]; - - -#ifdef WITH_CXX_GUARDEDALLOC -private: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_PositionInterpolator"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp deleted file mode 100644 index bbf8152bd68..00000000000 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ /dev/null @@ -1,663 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "KX_PyConstraintBinding.h" -#include "PHY_IPhysicsEnvironment.h" -#include "KX_ConstraintWrapper.h" -#include "KX_VehicleWrapper.h" -#include "KX_PhysicsObjectWrapper.h" -#include "PHY_IPhysicsController.h" -#include "PHY_IVehicle.h" -#include "MT_Matrix3x3.h" - -#include "PyObjectPlus.h" - -#ifndef DISABLE_PYTHON - -// nasty glob variable to connect scripting language -// if there is a better way (without global), please do so! -static PHY_IPhysicsEnvironment* g_CurrentActivePhysicsEnvironment = NULL; - -static char PhysicsConstraints_module_documentation[] = -"This is the Python API for the Physics Constraints"; - - -static char gPySetGravity__doc__[] = "setGravity(float x,float y,float z)"; -static char gPySetDebugMode__doc__[] = "setDebugMode(int mode)"; - -static char gPySetNumIterations__doc__[] = "setNumIterations(int numiter) This sets the number of iterations for an iterative constraint solver"; -static char gPySetNumTimeSubSteps__doc__[] = "setNumTimeSubSteps(int numsubstep) This sets the number of substeps for each physics proceed. Tradeoff quality for performance."; - - -static char gPySetDeactivationTime__doc__[] = "setDeactivationTime(float time) This sets the time after which a resting rigidbody gets deactived"; -static char gPySetDeactivationLinearTreshold__doc__[] = "setDeactivationLinearTreshold(float linearTreshold)"; -static char gPySetDeactivationAngularTreshold__doc__[] = "setDeactivationAngularTreshold(float angularTreshold)"; -static char gPySetContactBreakingTreshold__doc__[] = "setContactBreakingTreshold(float breakingTreshold) Reasonable default is 0.02 (if units are meters)"; - -static char gPySetCcdMode__doc__[] = "setCcdMode(int ccdMode) Very experimental, not recommended"; -static char gPySetSorConstant__doc__[] = "setSorConstant(float sor) Very experimental, not recommended"; -static char gPySetSolverTau__doc__[] = "setTau(float tau) Very experimental, not recommended"; -static char gPySetSolverDamping__doc__[] = "setDamping(float damping) Very experimental, not recommended"; -static char gPySetLinearAirDamping__doc__[] = "setLinearAirDamping(float damping) Very experimental, not recommended"; -static char gPySetUseEpa__doc__[] = "setUseEpa(int epa) Very experimental, not recommended"; -static char gPySetSolverType__doc__[] = "setSolverType(int solverType) Very experimental, not recommended"; - - -static char gPyCreateConstraint__doc__[] = "createConstraint(ob1,ob2,float restLength,float restitution,float damping)"; -static char gPyGetVehicleConstraint__doc__[] = "getVehicleConstraint(int constraintId)"; -static char gPyRemoveConstraint__doc__[] = "removeConstraint(int constraintId)"; -static char gPyGetAppliedImpulse__doc__[] = "getAppliedImpulse(int constraintId)"; - - - - - - -static PyObject* gPySetGravity(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float x,y,z; - if (PyArg_ParseTuple(args,"fff",&x,&y,&z)) - { - if (PHY_GetActiveEnvironment()) - PHY_GetActiveEnvironment()->setGravity(x,y,z); - } - else { - return NULL; - } - - Py_RETURN_NONE; -} - -static PyObject* gPySetDebugMode(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - int mode; - if (PyArg_ParseTuple(args,"i",&mode)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setDebugMode(mode); - - } - - } - else { - return NULL; - } - - Py_RETURN_NONE; -} - - - -static PyObject* gPySetNumTimeSubSteps(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - int substep; - if (PyArg_ParseTuple(args,"i",&substep)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setNumTimeSubSteps(substep); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - -static PyObject* gPySetNumIterations(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - int iter; - if (PyArg_ParseTuple(args,"i",&iter)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setNumIterations(iter); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - - -static PyObject* gPySetDeactivationTime(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float deactive_time; - if (PyArg_ParseTuple(args,"f",&deactive_time)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setDeactivationTime(deactive_time); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - -static PyObject* gPySetDeactivationLinearTreshold(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float linearDeactivationTreshold; - if (PyArg_ParseTuple(args,"f",&linearDeactivationTreshold)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setDeactivationLinearTreshold( linearDeactivationTreshold); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - -static PyObject* gPySetDeactivationAngularTreshold(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float angularDeactivationTreshold; - if (PyArg_ParseTuple(args,"f",&angularDeactivationTreshold)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setDeactivationAngularTreshold( angularDeactivationTreshold); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - -static PyObject* gPySetContactBreakingTreshold(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float contactBreakingTreshold; - if (PyArg_ParseTuple(args,"f",&contactBreakingTreshold)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setContactBreakingTreshold( contactBreakingTreshold); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - -static PyObject* gPySetCcdMode(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float ccdMode; - if (PyArg_ParseTuple(args,"f",&ccdMode)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setCcdMode( ccdMode); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - -static PyObject* gPySetSorConstant(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float sor; - if (PyArg_ParseTuple(args,"f",&sor)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setSolverSorConstant( sor); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - -static PyObject* gPySetSolverTau(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float tau; - if (PyArg_ParseTuple(args,"f",&tau)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setSolverTau( tau); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - -static PyObject* gPySetSolverDamping(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float damping; - if (PyArg_ParseTuple(args,"f",&damping)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setSolverDamping( damping); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - -static PyObject* gPySetLinearAirDamping(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float damping; - if (PyArg_ParseTuple(args,"f",&damping)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setLinearAirDamping( damping); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - -static PyObject* gPySetUseEpa(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - int epa; - if (PyArg_ParseTuple(args,"i",&epa)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setUseEpa(epa); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} -static PyObject* gPySetSolverType(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - int solverType; - if (PyArg_ParseTuple(args,"i",&solverType)) - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->setSolverType(solverType); - } - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - - -static PyObject* gPyGetVehicleConstraint(PyObject* self, - PyObject* args, - PyObject* kwds) -{ -#if defined(_WIN64) - __int64 constraintid; - if (PyArg_ParseTuple(args,"L",&constraintid)) -#else - long constraintid; - if (PyArg_ParseTuple(args,"l",&constraintid)) -#endif - { - if (PHY_GetActiveEnvironment()) - { - - PHY_IVehicle* vehicle = PHY_GetActiveEnvironment()->getVehicleConstraint(constraintid); - if (vehicle) - { - KX_VehicleWrapper* pyWrapper = new KX_VehicleWrapper(vehicle,PHY_GetActiveEnvironment()); - return pyWrapper->NewProxy(true); - } - - } - } - else { - return NULL; - } - - Py_RETURN_NONE; -} - - - - - -static PyObject* gPyCreateConstraint(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - int physicsid=0,physicsid2 = 0,constrainttype=0,extrainfo=0; - int len = PyTuple_Size(args); - int success = 1; - int flag = 0; - - float pivotX=1,pivotY=1,pivotZ=1,axisX=0,axisY=0,axisZ=1; - if (len == 3) - { - success = PyArg_ParseTuple(args,"iii",&physicsid,&physicsid2,&constrainttype); - } - else - if (len ==6) - { - success = PyArg_ParseTuple(args,"iiifff",&physicsid,&physicsid2,&constrainttype, - &pivotX,&pivotY,&pivotZ); - } - else if (len == 9) - { - success = PyArg_ParseTuple(args,"iiiffffff",&physicsid,&physicsid2,&constrainttype, - &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ); - } - else if (len == 10) - { - success = PyArg_ParseTuple(args,"iiiffffffi",&physicsid,&physicsid2,&constrainttype, - &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ,&flag); - } - else if (len==4) - { - success = PyArg_ParseTuple(args,"iiii",&physicsid,&physicsid2,&constrainttype,&extrainfo); - pivotX=extrainfo; - } - - if (success) - { - if (PHY_GetActiveEnvironment()) - { - - PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) physicsid; - PHY_IPhysicsController* physctrl2 = (PHY_IPhysicsController*) physicsid2; - if (physctrl) //TODO:check for existence of this pointer! - { - PHY_ConstraintType ct = (PHY_ConstraintType) constrainttype; - int constraintid =0; - - if (ct == PHY_GENERIC_6DOF_CONSTRAINT) - { - //convert from euler angle into axis - float radsPerDeg = 6.283185307179586232f / 360.f; - - //we need to pass a full constraint frame, not just axis - //localConstraintFrameBasis - MT_Matrix3x3 localCFrame(MT_Vector3(radsPerDeg*axisX,radsPerDeg*axisY,radsPerDeg*axisZ)); - MT_Vector3 axis0 = localCFrame.getColumn(0); - MT_Vector3 axis1 = localCFrame.getColumn(1); - MT_Vector3 axis2 = localCFrame.getColumn(2); - - constraintid = PHY_GetActiveEnvironment()->createConstraint(physctrl,physctrl2,(enum PHY_ConstraintType)constrainttype, - pivotX,pivotY,pivotZ, - (float)axis0.x(),(float)axis0.y(),(float)axis0.z(), - (float)axis1.x(),(float)axis1.y(),(float)axis1.z(), - (float)axis2.x(),(float)axis2.y(),(float)axis2.z(),flag); - - } else - { - constraintid = PHY_GetActiveEnvironment()->createConstraint(physctrl,physctrl2,(enum PHY_ConstraintType)constrainttype,pivotX,pivotY,pivotZ,axisX,axisY,axisZ,0); - } - - KX_ConstraintWrapper* wrap = new KX_ConstraintWrapper((enum PHY_ConstraintType)constrainttype,constraintid,PHY_GetActiveEnvironment()); - - - return wrap->NewProxy(true); - } - - - } - } - else { - return NULL; - } - - Py_RETURN_NONE; -} - - - - -static PyObject* gPyGetAppliedImpulse(PyObject* self, - PyObject* args, - PyObject* kwds) -{ - float appliedImpulse = 0.f; - -#if defined(_WIN64) - __int64 constraintid; - if (PyArg_ParseTuple(args,"L",&constraintid)) -#else - long constraintid; - if (PyArg_ParseTuple(args,"l",&constraintid)) -#endif - { - if (PHY_GetActiveEnvironment()) - { - appliedImpulse = PHY_GetActiveEnvironment()->getAppliedImpulse(constraintid); - } - } - else { - return NULL; - } - - return PyFloat_FromDouble(appliedImpulse); -} - - -static PyObject* gPyRemoveConstraint(PyObject* self, - PyObject* args, - PyObject* kwds) -{ -#if defined(_WIN64) - __int64 constraintid; - if (PyArg_ParseTuple(args,"L",&constraintid)) -#else - long constraintid; - if (PyArg_ParseTuple(args,"l",&constraintid)) -#endif - { - if (PHY_GetActiveEnvironment()) - { - PHY_GetActiveEnvironment()->removeConstraint(constraintid); - } - } - else { - return NULL; - } - - Py_RETURN_NONE; -} - - -static struct PyMethodDef physicsconstraints_methods[] = { - {"setGravity",(PyCFunction) gPySetGravity, - METH_VARARGS, (const char *)gPySetGravity__doc__}, - {"setDebugMode",(PyCFunction) gPySetDebugMode, - METH_VARARGS, (const char *)gPySetDebugMode__doc__}, - - /// settings that influence quality of the rigidbody dynamics - {"setNumIterations",(PyCFunction) gPySetNumIterations, - METH_VARARGS, (const char *)gPySetNumIterations__doc__}, - - {"setNumTimeSubSteps",(PyCFunction) gPySetNumTimeSubSteps, - METH_VARARGS, (const char *)gPySetNumTimeSubSteps__doc__}, - - {"setDeactivationTime",(PyCFunction) gPySetDeactivationTime, - METH_VARARGS, (const char *)gPySetDeactivationTime__doc__}, - - {"setDeactivationLinearTreshold",(PyCFunction) gPySetDeactivationLinearTreshold, - METH_VARARGS, (const char *)gPySetDeactivationLinearTreshold__doc__}, - {"setDeactivationAngularTreshold",(PyCFunction) gPySetDeactivationAngularTreshold, - METH_VARARGS, (const char *)gPySetDeactivationAngularTreshold__doc__}, - - {"setContactBreakingTreshold",(PyCFunction) gPySetContactBreakingTreshold, - METH_VARARGS, (const char *)gPySetContactBreakingTreshold__doc__}, - {"setCcdMode",(PyCFunction) gPySetCcdMode, - METH_VARARGS, (const char *)gPySetCcdMode__doc__}, - {"setSorConstant",(PyCFunction) gPySetSorConstant, - METH_VARARGS, (const char *)gPySetSorConstant__doc__}, - {"setSolverTau",(PyCFunction) gPySetSolverTau, - METH_VARARGS, (const char *)gPySetSolverTau__doc__}, - {"setSolverDamping",(PyCFunction) gPySetSolverDamping, - METH_VARARGS, (const char *)gPySetSolverDamping__doc__}, - - {"setLinearAirDamping",(PyCFunction) gPySetLinearAirDamping, - METH_VARARGS, (const char *)gPySetLinearAirDamping__doc__}, - - {"setUseEpa",(PyCFunction) gPySetUseEpa, - METH_VARARGS, (const char *)gPySetUseEpa__doc__}, - {"setSolverType",(PyCFunction) gPySetSolverType, - METH_VARARGS, (const char *)gPySetSolverType__doc__}, - - - {"createConstraint",(PyCFunction) gPyCreateConstraint, - METH_VARARGS, (const char *)gPyCreateConstraint__doc__}, - {"getVehicleConstraint",(PyCFunction) gPyGetVehicleConstraint, - METH_VARARGS, (const char *)gPyGetVehicleConstraint__doc__}, - - {"removeConstraint",(PyCFunction) gPyRemoveConstraint, - METH_VARARGS, (const char *)gPyRemoveConstraint__doc__}, - {"getAppliedImpulse",(PyCFunction) gPyGetAppliedImpulse, - METH_VARARGS, (const char *)gPyGetAppliedImpulse__doc__}, - - - //sentinel - { NULL, (PyCFunction) NULL, 0, NULL } -}; - -static struct PyModuleDef PhysicsConstraints_module_def = { - {}, /* m_base */ - "PhysicsConstraints", /* m_name */ - PhysicsConstraints_module_documentation, /* m_doc */ - 0, /* m_size */ - physicsconstraints_methods, /* m_methods */ - 0, /* m_reload */ - 0, /* m_traverse */ - 0, /* m_clear */ - 0, /* m_free */ -}; - -PyObject* initPythonConstraintBinding() -{ - - PyObject* ErrorObject; - PyObject* m; - PyObject* d; - - /* Use existing module where possible - * be careful not to init any runtime vars after this */ - m = PyImport_ImportModule( "PhysicsConstraints" ); - if(m) { - Py_DECREF(m); - return m; - } - else { - PyErr_Clear(); - - m = PyModule_Create(&PhysicsConstraints_module_def); - PyDict_SetItemString(PySys_GetObject("modules"), PhysicsConstraints_module_def.m_name, m); - } - - // Add some symbolic constants to the module - d = PyModule_GetDict(m); - ErrorObject = PyUnicode_FromString("PhysicsConstraints.error"); - PyDict_SetItemString(d, "error", ErrorObject); - Py_DECREF(ErrorObject); - - // XXXX Add constants here - - // Check for errors - if (PyErr_Occurred()) - { - Py_FatalError("can't initialize module PhysicsConstraints"); - } - - return d; -} - - -void KX_RemovePythonConstraintBinding() -{ -} - -void PHY_SetActiveEnvironment(class PHY_IPhysicsEnvironment* env) -{ - g_CurrentActivePhysicsEnvironment = env; -} - -PHY_IPhysicsEnvironment* PHY_GetActiveEnvironment() -{ - return g_CurrentActivePhysicsEnvironment; -} - -#endif // DISABLE_PYTHON - diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.h b/source/gameengine/Ketsji/KX_PyConstraintBinding.h deleted file mode 100644 index a1b3c3d6da3..00000000000 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef PHY_PYTHON_CONSTRAINTBINDING -#define PHY_PYTHON_CONSTRAINTBINDING - -#ifndef DISABLE_PYTHON - -#include - -PyObject* initPythonConstraintBinding(); -void PHY_RemovePythonConstraintBinding(); -void PHY_SetActiveEnvironment(class PHY_IPhysicsEnvironment* env); -PHY_IPhysicsEnvironment* PHY_GetActiveEnvironment(); -#endif // DISABLE_PYTHON - -#endif //PHY_PYTHON_CONSTRAINTBINDING - diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp deleted file mode 100644 index 59d1c197cf3..00000000000 --- a/source/gameengine/Ketsji/KX_PyMath.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Initialize Python thingies. - */ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif //WIN32 - -#ifndef DISABLE_PYTHON - -#include "MT_Vector3.h" -#include "MT_Vector4.h" -#include "MT_Matrix4x4.h" -#include "MT_Point2.h" - -#include "ListValue.h" - -#include "KX_Python.h" -#include "KX_PyMath.h" - -bool PyOrientationTo(PyObject* pyval, MT_Matrix3x3 &rot, const char *error_prefix) -{ - int size= PySequence_Size(pyval); - - if (size == 4) - { - MT_Quaternion qrot; - if (PyQuatTo(pyval, qrot)) - { - rot.setRotation(qrot); - return true; - } - } - else if (size == 3) { - /* 3x3 matrix or euler */ - MT_Vector3 erot; - if (PyVecTo(pyval, erot)) - { - rot.setEuler(erot); - return true; - } - PyErr_Clear(); - - if (PyMatTo(pyval, rot)) - { - return true; - } - } - - PyErr_Format(PyExc_TypeError, "%s, could not set the orientation from a 3x3 matrix, quaternion or euler sequence", error_prefix); - return false; -} - -bool PyQuatTo(PyObject* pyval, MT_Quaternion &qrot) -{ - if(!PyVecTo(pyval, qrot)) - return false; - - /* annoying!, Blender/Mathutils have the W axis first! */ - MT_Scalar w= qrot[0]; /* from python, this is actually the W */ - qrot[0]= qrot[1]; - qrot[1]= qrot[2]; - qrot[2]= qrot[3]; - qrot[3]= w; - - return true; -} - -PyObject* PyObjectFrom(const MT_Matrix4x4 &mat) -{ -#ifdef USE_MATHUTILS - float fmat[16]; - mat.getValue(fmat); - return newMatrixObject(fmat, 4, 4, Py_NEW, NULL); -#else - PyObject *collist = PyList_New(4); - PyObject *col; - int i; - - for(i=0; i < 4; i++) { - col = PyList_New(4); - PyList_SET_ITEM(col, 0, PyFloat_FromDouble(mat[0][i])); - PyList_SET_ITEM(col, 1, PyFloat_FromDouble(mat[1][i])); - PyList_SET_ITEM(col, 2, PyFloat_FromDouble(mat[2][i])); - PyList_SET_ITEM(col, 3, PyFloat_FromDouble(mat[3][i])); - PyList_SET_ITEM(collist, i, col); - } - - return collist; -#endif -} - -PyObject* PyObjectFrom(const MT_Matrix3x3 &mat) -{ -#ifdef USE_MATHUTILS - float fmat[9]; - mat.getValue3x3(fmat); - return newMatrixObject(fmat, 3, 3, Py_NEW, NULL); -#else - PyObject *collist = PyList_New(3); - PyObject *col; - int i; - - for(i=0; i < 3; i++) { - col = PyList_New(3); - PyList_SET_ITEM(col, 0, PyFloat_FromDouble(mat[0][i])); - PyList_SET_ITEM(col, 1, PyFloat_FromDouble(mat[1][i])); - PyList_SET_ITEM(col, 2, PyFloat_FromDouble(mat[2][i])); - PyList_SET_ITEM(collist, i, col); - } - - return collist; -#endif -} - -#ifdef USE_MATHUTILS -PyObject* PyObjectFrom(const MT_Quaternion &qrot) -{ - /* NOTE, were re-ordering here for Mathutils compat */ - float fvec[4]= {qrot[3], qrot[0], qrot[1], qrot[2]}; - return newQuaternionObject(fvec, Py_NEW, NULL); -} -#endif - -PyObject* PyObjectFrom(const MT_Tuple4 &vec) -{ -#ifdef USE_MATHUTILS - float fvec[4]= {vec[0], vec[1], vec[2], vec[3]}; - return newVectorObject(fvec, 4, Py_NEW, NULL); -#else - PyObject *list = PyList_New(4); - PyList_SET_ITEM(list, 0, PyFloat_FromDouble(vec[0])); - PyList_SET_ITEM(list, 1, PyFloat_FromDouble(vec[1])); - PyList_SET_ITEM(list, 2, PyFloat_FromDouble(vec[2])); - PyList_SET_ITEM(list, 3, PyFloat_FromDouble(vec[3])); - return list; -#endif -} - -PyObject* PyObjectFrom(const MT_Tuple3 &vec) -{ -#ifdef USE_MATHUTILS - float fvec[3]= {vec[0], vec[1], vec[2]}; - return newVectorObject(fvec, 3, Py_NEW, NULL); -#else - PyObject *list = PyList_New(3); - PyList_SET_ITEM(list, 0, PyFloat_FromDouble(vec[0])); - PyList_SET_ITEM(list, 1, PyFloat_FromDouble(vec[1])); - PyList_SET_ITEM(list, 2, PyFloat_FromDouble(vec[2])); - return list; -#endif -} - -PyObject* PyObjectFrom(const MT_Tuple2 &vec) -{ -#ifdef USE_MATHUTILS - float fvec[2]= {vec[0], vec[1]}; - return newVectorObject(fvec, 2, Py_NEW, NULL); -#else - PyObject *list = PyList_New(2); - PyList_SET_ITEM(list, 0, PyFloat_FromDouble(vec[0])); - PyList_SET_ITEM(list, 1, PyFloat_FromDouble(vec[1])); - return list; -#endif -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h deleted file mode 100644 index 9c9688f79cd..00000000000 --- a/source/gameengine/Ketsji/KX_PyMath.h +++ /dev/null @@ -1,242 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Initialize Python thingies. - */ - -#ifndef __KX_PYMATH_H__ -#define __KX_PYMATH_H__ - -#include "MT_Point2.h" -#include "MT_Point3.h" -#include "MT_Vector2.h" -#include "MT_Vector3.h" -#include "MT_Vector4.h" -#include "MT_Matrix3x3.h" -#include "MT_Matrix4x4.h" - -#include "KX_Python.h" -#include "PyObjectPlus.h" - -#ifndef DISABLE_PYTHON -#ifdef USE_MATHUTILS -extern "C" { -#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */ -} -#endif - -inline unsigned int Size(const MT_Matrix4x4&) { return 4; } -inline unsigned int Size(const MT_Matrix3x3&) { return 3; } -inline unsigned int Size(const MT_Tuple2&) { return 2; } -inline unsigned int Size(const MT_Tuple3&) { return 3; } -inline unsigned int Size(const MT_Tuple4&) { return 4; } - -/** - * Converts the given python matrix (column-major) to an MT class (row-major). - */ -template -bool PyMatTo(PyObject* pymat, T& mat) -{ - bool noerror = true; - mat.setIdentity(); - if (PySequence_Check(pymat)) - { - unsigned int cols = PySequence_Size(pymat); - if (cols != Size(mat)) - return false; - - for (unsigned int x = 0; noerror && x < cols; x++) - { - PyObject *pycol = PySequence_GetItem(pymat, x); /* new ref */ - if (!PyErr_Occurred() && PySequence_Check(pycol)) - { - unsigned int rows = PySequence_Size(pycol); - if (rows != Size(mat)) - noerror = false; - else - { - for( unsigned int y = 0; y < rows; y++) - { - PyObject *item = PySequence_GetItem(pycol, y); /* new ref */ - mat[y][x] = PyFloat_AsDouble(item); - Py_DECREF(item); - } - } - } else - noerror = false; - Py_DECREF(pycol); - } - } else - noerror = false; - - if (noerror==false) - PyErr_SetString(PyExc_TypeError, "could not be converted to a matrix (sequence of sequences)"); - - return noerror; -} - -/** - * Converts a python sequence to a MT class. - */ -template -bool PyVecTo(PyObject* pyval, T& vec) -{ -#ifdef USE_MATHUTILS - /* no need for BaseMath_ReadCallback() here, reading the sequences will do this */ - - if(VectorObject_Check(pyval)) { - VectorObject *pyvec= (VectorObject *)pyval; - BaseMath_ReadCallback(pyvec); - if (pyvec->size != Size(vec)) { - PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", pyvec->size, Size(vec)); - return false; - } - vec.setValue((float *) pyvec->vec); - return true; - } - else if(QuaternionObject_Check(pyval)) { - QuaternionObject *pyquat= (QuaternionObject *)pyval; - BaseMath_ReadCallback(pyquat); - if (4 != Size(vec)) { - PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", 4, Size(vec)); - return false; - } - /* xyzw -> wxyz reordering is done by PyQuatTo */ - vec.setValue((float *) pyquat->quat); - return true; - } - else if(EulerObject_Check(pyval)) { - EulerObject *pyeul= (EulerObject *)pyval; - BaseMath_ReadCallback(pyeul); - if (3 != Size(vec)) { - PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", 3, Size(vec)); - return false; - } - vec.setValue((float *) pyeul->eul); - return true; - } else -#endif - if(PyTuple_Check(pyval)) - { - unsigned int numitems = PyTuple_GET_SIZE(pyval); - if (numitems != Size(vec)) { - PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec)); - return false; - } - - for (unsigned int x = 0; x < numitems; x++) - vec[x] = PyFloat_AsDouble(PyTuple_GET_ITEM(pyval, x)); /* borrow ref */ - - if (PyErr_Occurred()) { - PyErr_SetString(PyExc_AttributeError, "one or more of the items in the sequence was not a float"); - return false; - } - - return true; - } - else if (PyObject_TypeCheck(pyval, (PyTypeObject *)&PyObjectPlus::Type)) - { /* note, include this check because PySequence_Check does too much introspection - * on the PyObject (like getting its __class__, on a BGE type this means searching up - * the parent list each time only to discover its not a sequence. - * GameObjects are often used as an alternative to vectors so this is a common case - * better to do a quick check for it, likely the error below will be ignored. - * - * This is not 'correct' since we have proxy type CListValues's which could - * contain floats/ints but there no cases of CValueLists being this way - */ - PyErr_Format(PyExc_AttributeError, "expected a sequence type"); - return false; - } - else if (PySequence_Check(pyval)) - { - unsigned int numitems = PySequence_Size(pyval); - if (numitems != Size(vec)) { - PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec)); - return false; - } - - for (unsigned int x = 0; x < numitems; x++) - { - PyObject *item = PySequence_GetItem(pyval, x); /* new ref */ - vec[x] = PyFloat_AsDouble(item); - Py_DECREF(item); - } - - if (PyErr_Occurred()) { - PyErr_SetString(PyExc_AttributeError, "one or more of the items in the sequence was not a float"); - return false; - } - - return true; - } else - { - PyErr_Format(PyExc_AttributeError, "not a sequence type, expected a sequence of numbers size %d", Size(vec)); - } - - return false; -} - - -bool PyQuatTo(PyObject* pyval, MT_Quaternion &qrot); - -bool PyOrientationTo(PyObject* pyval, MT_Matrix3x3 &mat, const char *error_prefix); - -/** - * Converts an MT_Matrix4x4 to a python object. - */ -PyObject* PyObjectFrom(const MT_Matrix4x4 &mat); - -/** - * Converts an MT_Matrix3x3 to a python object. - */ -PyObject* PyObjectFrom(const MT_Matrix3x3 &mat); - -/** - * Converts an MT_Tuple2 to a python object. - */ -PyObject* PyObjectFrom(const MT_Tuple2 &vec); - -/** - * Converts an MT_Tuple3 to a python object - */ -PyObject* PyObjectFrom(const MT_Tuple3 &vec); - -#ifdef USE_MATHUTILS -/** - * Converts an MT_Quaternion to a python object. - */ -PyObject* PyObjectFrom(const MT_Quaternion &qrot); -#endif - -/** - * Converts an MT_Tuple4 to a python object. - */ -PyObject* PyObjectFrom(const MT_Tuple4 &pos); - -#endif - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp deleted file mode 100644 index 0198555753e..00000000000 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ /dev/null @@ -1,2417 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Initialize Python thingies. - */ - -#include "GL/glew.h" - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif //WIN32 - -#ifndef DISABLE_PYTHON - -extern "C" { - #include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */ - #include "mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use. - #include "geometry.h" // Blender.Geometry module copied here so the blenderlayer can use. - #include "bgl.h" - #include "blf_api.h" - - #include "marshal.h" /* python header for loading/saving dicts */ -} -#endif - -#include "KX_PythonInit.h" - -// directory header for py function getBlendFileList -#ifndef WIN32 - #include - #include -#else - #include - #include "BLI_winstuff.h" -#endif - -//python physics binding -#include "KX_PyConstraintBinding.h" - -#include "KX_KetsjiEngine.h" -#include "KX_RadarSensor.h" -#include "KX_RaySensor.h" -#include "KX_ArmatureSensor.h" -#include "KX_SceneActuator.h" -#include "KX_GameActuator.h" -#include "KX_ParentActuator.h" -#include "KX_SCA_DynamicActuator.h" - -#include "SCA_IInputDevice.h" -#include "SCA_PropertySensor.h" -#include "SCA_RandomActuator.h" -#include "SCA_KeyboardSensor.h" /* IsPrintable, ToCharacter */ -#include "SCA_PythonKeyboard.h" -#include "SCA_PythonMouse.h" -#include "KX_ConstraintActuator.h" -#include "KX_IpoActuator.h" -#include "KX_SoundActuator.h" -#include "KX_StateActuator.h" -#include "BL_ActionActuator.h" -#include "BL_ArmatureObject.h" -#include "RAS_IRasterizer.h" -#include "RAS_ICanvas.h" -#include "RAS_BucketManager.h" -#include "RAS_2DFilterManager.h" -#include "MT_Vector3.h" -#include "MT_Point3.h" -#include "ListValue.h" -#include "InputParser.h" -#include "KX_Scene.h" - -#include "NG_NetworkScene.h" //Needed for sendMessage() - -#include "BL_Shader.h" - -#include "KX_PyMath.h" - -#include "PyObjectPlus.h" - -#include "KX_PythonInitTypes.h" - -/* we only need this to get a list of libraries from the main struct */ -#include "DNA_ID.h" -#include "DNA_scene_types.h" - -#include "PHY_IPhysicsEnvironment.h" -#include "BKE_main.h" -#include "BKE_utildefines.h" -#include "BKE_global.h" -#include "BLI_blenlib.h" -#include "GPU_material.h" -#include "MEM_guardedalloc.h" - -/* for converting new scenes */ -#include "KX_BlenderSceneConverter.h" -#include "KX_MeshProxy.h" /* for creating a new library of mesh objects */ -extern "C" { - #include "BLO_readfile.h" -} - - -#include "NG_NetworkScene.h" //Needed for sendMessage() - -static void setSandbox(TPythonSecurityLevel level); - -// 'local' copy of canvas ptr, for window height/width python scripts -static RAS_ICanvas* gp_Canvas = NULL; -static KX_Scene* gp_KetsjiScene = NULL; -static KX_KetsjiEngine* gp_KetsjiEngine = NULL; -static RAS_IRasterizer* gp_Rasterizer = NULL; -static char gp_GamePythonPath[FILE_MAXDIR + FILE_MAXFILE] = ""; -static char gp_GamePythonPathOrig[FILE_MAXDIR + FILE_MAXFILE] = ""; // not super happy about this, but we need to remember the first loaded file for the global/dict load save - -void KX_SetActiveScene(class KX_Scene* scene) -{ - gp_KetsjiScene = scene; -} - -class KX_Scene* KX_GetActiveScene() -{ - return gp_KetsjiScene; -} - -class KX_KetsjiEngine* KX_GetActiveEngine() -{ - return gp_KetsjiEngine; -} - -/* why is this in python? */ -void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color) -{ - if (gp_Rasterizer) - gp_Rasterizer->DrawDebugLine(from,to,color); -} - -#ifndef DISABLE_PYTHON - -static PyObject *gp_OrigPythonSysPath= NULL; -static PyObject *gp_OrigPythonSysModules= NULL; - -/* Macro for building the keyboard translation */ -//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromSsize_t(SCA_IInputDevice::KX_##name)) -#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name)); Py_DECREF(item) -/* For the defines for types from logic bricks, we do stuff explicitly... */ -#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name2)); Py_DECREF(item) - - -// temporarily python stuff, will be put in another place later ! -#include "KX_Python.h" -#include "SCA_PythonController.h" -// List of methods defined in the module - -static PyObject* ErrorObject; -static const char *gPyGetRandomFloat_doc="getRandomFloat returns a random floating point value in the range [0..1]"; - -static PyObject* gPyGetRandomFloat(PyObject*) -{ - return PyFloat_FromDouble(MT_random()); -} - -static PyObject* gPySetGravity(PyObject*, PyObject* value) -{ - MT_Vector3 vec; - if (!PyVecTo(value, vec)) - return NULL; - - if (gp_KetsjiScene) - gp_KetsjiScene->SetGravity(vec); - - Py_RETURN_NONE; -} - -static char gPyExpandPath_doc[] = -"(path) - Converts a blender internal path into a proper file system path.\n\ -path - the string path to convert.\n\n\ -Use / as directory separator in path\n\ -You can use '//' at the start of the string to define a relative path;\n\ -Blender replaces that string by the directory of the startup .blend or runtime\n\ -file to make a full path name (doesn't change during the game, even if you load\n\ -other .blend).\n\ -The function also converts the directory separator to the local file system format."; - -static PyObject* gPyExpandPath(PyObject*, PyObject* args) -{ - char expanded[FILE_MAXDIR + FILE_MAXFILE]; - char* filename; - - if (!PyArg_ParseTuple(args,"s:ExpandPath",&filename)) - return NULL; - - BLI_strncpy(expanded, filename, FILE_MAXDIR + FILE_MAXFILE); - BLI_path_abs(expanded, gp_GamePythonPath); - return PyUnicode_FromString(expanded); -} - -static char gPyStartGame_doc[] = -"startGame(blend)\n\ -Loads the blend file"; - -static PyObject* gPyStartGame(PyObject*, PyObject* args) -{ - char* blendfile; - - if (!PyArg_ParseTuple(args, "s:startGame", &blendfile)) - return NULL; - - gp_KetsjiEngine->RequestExit(KX_EXIT_REQUEST_START_OTHER_GAME); - gp_KetsjiEngine->SetNameNextGame(blendfile); - - Py_RETURN_NONE; -} - -static char gPyEndGame_doc[] = -"endGame()\n\ -Ends the current game"; - -static PyObject* gPyEndGame(PyObject*) -{ - gp_KetsjiEngine->RequestExit(KX_EXIT_REQUEST_QUIT_GAME); - - //printf("%s\n", gp_GamePythonPath); - - Py_RETURN_NONE; -} - -static char gPyRestartGame_doc[] = -"restartGame()\n\ -Restarts the current game by reloading the .blend file"; - -static PyObject* gPyRestartGame(PyObject*) -{ - gp_KetsjiEngine->RequestExit(KX_EXIT_REQUEST_RESTART_GAME); - gp_KetsjiEngine->SetNameNextGame(gp_GamePythonPath); - - Py_RETURN_NONE; -} - -static char gPySaveGlobalDict_doc[] = -"saveGlobalDict()\n\ -Saves GameLogic.globalDict to a file"; - -static PyObject* gPySaveGlobalDict(PyObject*) -{ - char marshal_path[512]; - char *marshal_buffer = NULL; - unsigned int marshal_length; - FILE *fp = NULL; - - pathGamePythonConfig(marshal_path); - marshal_length = saveGamePythonConfig(&marshal_buffer); - - if (marshal_length && marshal_buffer) - { - fp = fopen(marshal_path, "wb"); - - if (fp) - { - if (fwrite(marshal_buffer, 1, marshal_length, fp) != marshal_length) - printf("Warning: could not write marshal data\n"); - - fclose(fp); - } else { - printf("Warning: could not open marshal file\n"); - } - } else { - printf("Warning: could not create marshal buffer\n"); - } - - if (marshal_buffer) - delete [] marshal_buffer; - - Py_RETURN_NONE; -} - -static char gPyLoadGlobalDict_doc[] = -"LoadGlobalDict()\n\ -Loads GameLogic.globalDict from a file"; - -static PyObject* gPyLoadGlobalDict(PyObject*) -{ - char marshal_path[512]; - char *marshal_buffer = NULL; - unsigned int marshal_length; - FILE *fp = NULL; - int result; - - pathGamePythonConfig(marshal_path); - - fp = fopen(marshal_path, "rb"); - - if (fp) { - // obtain file size: - fseek (fp, 0, SEEK_END); - marshal_length = ftell(fp); - rewind(fp); - - marshal_buffer = (char*)malloc (sizeof(char)*marshal_length); - - result = fread(marshal_buffer, 1, marshal_length, fp); - - if (result == marshal_length) { - loadGamePythonConfig(marshal_buffer, marshal_length); - } else { - printf("Warning: could not read all of '%s'\n", marshal_path); - } - - free(marshal_buffer); - fclose(fp); - } else { - printf("Warning: could not open '%s'\n", marshal_path); - } - - Py_RETURN_NONE; -} - -static char gPySendMessage_doc[] = -"sendMessage(subject, [body, to, from])\n\ -sends a message in same manner as a message actuator\ -subject = Subject of the message\ -body = Message body\ -to = Name of object to send the message to\ -from = Name of object to send the string from"; - -static PyObject* gPySendMessage(PyObject*, PyObject* args) -{ - char* subject; - char* body = (char *)""; - char* to = (char *)""; - char* from = (char *)""; - - if (!PyArg_ParseTuple(args, "s|sss:sendMessage", &subject, &body, &to, &from)) - return NULL; - - gp_KetsjiScene->GetNetworkScene()->SendMessage(to, from, subject, body); - - Py_RETURN_NONE; -} - -// this gets a pointer to an array filled with floats -static PyObject* gPyGetSpectrum(PyObject*) -{ - PyObject* resultlist = PyList_New(512); - - for (int index = 0; index < 512; index++) - { - PyList_SET_ITEM(resultlist, index, PyFloat_FromDouble(0.0)); - } - - return resultlist; -} - - -static PyObject* gPyStopDSP(PyObject*, PyObject* args) -{ - PyErr_SetString(PyExc_RuntimeError, "no audio device available"); - return NULL; - - Py_RETURN_NONE; -} - -static PyObject* gPySetLogicTicRate(PyObject*, PyObject* args) -{ - float ticrate; - if (!PyArg_ParseTuple(args, "f:setLogicTicRate", &ticrate)) - return NULL; - - KX_KetsjiEngine::SetTicRate(ticrate); - Py_RETURN_NONE; -} - -static PyObject* gPyGetLogicTicRate(PyObject*) -{ - return PyFloat_FromDouble(KX_KetsjiEngine::GetTicRate()); -} - -static PyObject* gPySetMaxLogicFrame(PyObject*, PyObject* args) -{ - int frame; - if (!PyArg_ParseTuple(args, "i:setMaxLogicFrame", &frame)) - return NULL; - - KX_KetsjiEngine::SetMaxLogicFrame(frame); - Py_RETURN_NONE; -} - -static PyObject* gPyGetMaxLogicFrame(PyObject*) -{ - return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxLogicFrame()); -} - -static PyObject* gPySetMaxPhysicsFrame(PyObject*, PyObject* args) -{ - int frame; - if (!PyArg_ParseTuple(args, "i:setMaxPhysicsFrame", &frame)) - return NULL; - - KX_KetsjiEngine::SetMaxPhysicsFrame(frame); - Py_RETURN_NONE; -} - -static PyObject* gPyGetMaxPhysicsFrame(PyObject*) -{ - return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxPhysicsFrame()); -} - -static PyObject* gPySetPhysicsTicRate(PyObject*, PyObject* args) -{ - float ticrate; - if (!PyArg_ParseTuple(args, "f:setPhysicsTicRate", &ticrate)) - return NULL; - - PHY_GetActiveEnvironment()->setFixedTimeStep(true,ticrate); - Py_RETURN_NONE; -} -#if 0 // unused -static PyObject* gPySetPhysicsDebug(PyObject*, PyObject* args) -{ - int debugMode; - if (!PyArg_ParseTuple(args, "i:setPhysicsDebug", &debugMode)) - return NULL; - - PHY_GetActiveEnvironment()->setDebugMode(debugMode); - Py_RETURN_NONE; -} -#endif - - -static PyObject* gPyGetPhysicsTicRate(PyObject*) -{ - return PyFloat_FromDouble(PHY_GetActiveEnvironment()->getFixedTimeStep()); -} - -static PyObject* gPyGetAverageFrameRate(PyObject*) -{ - return PyFloat_FromDouble(KX_KetsjiEngine::GetAverageFrameRate()); -} - -static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args) -{ - char cpath[sizeof(gp_GamePythonPath)]; - char *searchpath = NULL; - PyObject* list, *value; - - DIR *dp; - struct dirent *dirp; - - if (!PyArg_ParseTuple(args, "|s:getBlendFileList", &searchpath)) - return NULL; - - list = PyList_New(0); - - if (searchpath) { - BLI_strncpy(cpath, searchpath, FILE_MAXDIR + FILE_MAXFILE); - BLI_path_abs(cpath, gp_GamePythonPath); - } else { - /* Get the dir only */ - BLI_split_dirfile(gp_GamePythonPath, cpath, NULL); - } - - if((dp = opendir(cpath)) == NULL) { - /* todo, show the errno, this shouldnt happen anyway if the blendfile is readable */ - fprintf(stderr, "Could not read directoty (%s) failed, code %d (%s)\n", cpath, errno, strerror(errno)); - return list; - } - - while ((dirp = readdir(dp)) != NULL) { - if (BLI_testextensie(dirp->d_name, ".blend")) { - value = PyUnicode_FromString(dirp->d_name); - PyList_Append(list, value); - Py_DECREF(value); - } - } - - closedir(dp); - return list; -} - -static char gPyAddScene_doc[] = -"addScene(name, [overlay])\n\ -adds a scene to the game engine\n\ -name = Name of the scene\n\ -overlay = Overlay or underlay"; -static PyObject* gPyAddScene(PyObject*, PyObject* args) -{ - char* name; - int overlay = 1; - - if (!PyArg_ParseTuple(args, "s|i:addScene", &name , &overlay)) - return NULL; - - gp_KetsjiEngine->ConvertAndAddScene(name, (overlay != 0)); - - Py_RETURN_NONE; -} - -static const char *gPyGetCurrentScene_doc = -"getCurrentScene()\n" -"Gets a reference to the current scene.\n"; -static PyObject* gPyGetCurrentScene(PyObject* self) -{ - return gp_KetsjiScene->GetProxy(); -} - -static const char *gPyGetSceneList_doc = -"getSceneList()\n" -"Return a list of converted scenes.\n"; -static PyObject* gPyGetSceneList(PyObject* self) -{ - KX_KetsjiEngine* m_engine = KX_GetActiveEngine(); - PyObject* list; - KX_SceneList* scenes = m_engine->CurrentScenes(); - int numScenes = scenes->size(); - int i; - - list = PyList_New(numScenes); - - for (i=0;iat(i); - PyList_SET_ITEM(list, i, scene->GetProxy()); - } - - return list; -} - -static PyObject *pyPrintStats(PyObject *,PyObject *,PyObject *) -{ - gp_KetsjiScene->GetSceneConverter()->PrintStats(); - Py_RETURN_NONE; -} - -static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *) -{ -#define pprint(x) std::cout << x << std::endl; - bool count=0; - bool support=0; - pprint("Supported Extensions..."); - pprint(" GL_ARB_shader_objects supported? "<< (GLEW_ARB_shader_objects?"yes.":"no.")); - count = 1; - - support= GLEW_ARB_vertex_shader; - pprint(" GL_ARB_vertex_shader supported? "<< (support?"yes.":"no.")); - count = 1; - if(support){ - pprint(" ----------Details----------"); - int max=0; - glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, (GLint*)&max); - pprint(" Max uniform components." << max); - - glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, (GLint*)&max); - pprint(" Max varying floats." << max); - - glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, (GLint*)&max); - pprint(" Max vertex texture units." << max); - - glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, (GLint*)&max); - pprint(" Max combined texture units." << max); - pprint(""); - } - - support=GLEW_ARB_fragment_shader; - pprint(" GL_ARB_fragment_shader supported? "<< (support?"yes.":"no.")); - count = 1; - if(support){ - pprint(" ----------Details----------"); - int max=0; - glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, (GLint*)&max); - pprint(" Max uniform components." << max); - pprint(""); - } - - support = GLEW_ARB_texture_cube_map; - pprint(" GL_ARB_texture_cube_map supported? "<< (support?"yes.":"no.")); - count = 1; - if(support){ - pprint(" ----------Details----------"); - int size=0; - glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, (GLint*)&size); - pprint(" Max cubemap size." << size); - pprint(""); - } - - support = GLEW_ARB_multitexture; - count = 1; - pprint(" GL_ARB_multitexture supported? "<< (support?"yes.":"no.")); - if(support){ - pprint(" ----------Details----------"); - int units=0; - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint*)&units); - pprint(" Max texture units available. " << units); - pprint(""); - } - - pprint(" GL_ARB_texture_env_combine supported? "<< (GLEW_ARB_texture_env_combine?"yes.":"no.")); - count = 1; - - if(!count) - pprint("No extenstions are used in this build"); - - Py_RETURN_NONE; -} - -static PyObject *gLibLoad(PyObject*, PyObject* args) -{ - KX_Scene *kx_scene= gp_KetsjiScene; - char *path; - char *group; - char *err_str= NULL; - - if (!PyArg_ParseTuple(args,"ss:LibLoad",&path, &group)) - return NULL; - - if(kx_scene->GetSceneConverter()->LinkBlendFile(path, group, kx_scene, &err_str)) { - Py_RETURN_TRUE; - } - - if(err_str) { - PyErr_SetString(PyExc_ValueError, err_str); - return NULL; - } - - Py_RETURN_FALSE; -} - -static PyObject *gLibNew(PyObject*, PyObject* args) -{ - KX_Scene *kx_scene= gp_KetsjiScene; - char *path; - char *group; - char *name; - PyObject *names; - int idcode; - - if (!PyArg_ParseTuple(args,"ssO!:LibNew",&path, &group, &PyList_Type, &names)) - return NULL; - - if(kx_scene->GetSceneConverter()->GetMainDynamicPath(path)) - { - PyErr_SetString(PyExc_KeyError, "the name of the path given exists"); - return NULL; - } - - idcode= BLO_idcode_from_name(group); - if(idcode==0) { - PyErr_Format(PyExc_ValueError, "invalid group given \"%s\"", group); - return NULL; - } - - Main *maggie= (Main *)MEM_callocN( sizeof(Main), "BgeMain"); - kx_scene->GetSceneConverter()->GetMainDynamic().push_back(maggie); - strncpy(maggie->name, path, sizeof(maggie->name)-1); - - /* Copy the object into main */ - if(idcode==ID_ME) { - PyObject *ret= PyList_New(0); - PyObject *item; - for(int i= 0; i < PyList_GET_SIZE(names); i++) { - name= _PyUnicode_AsString(PyList_GET_ITEM(names, i)); - if(name) { - RAS_MeshObject *meshobj= kx_scene->GetSceneConverter()->ConvertMeshSpecial(kx_scene, maggie, name); - if(meshobj) { - KX_MeshProxy* meshproxy = new KX_MeshProxy(meshobj); - item= meshproxy->NewProxy(true); - PyList_Append(ret, item); - Py_DECREF(item); - } - } - else { - PyErr_Clear(); /* wasnt a string, ignore for now */ - } - } - - return ret; - } - else { - PyErr_Format(PyExc_ValueError, "only \"Mesh\" group currently supported"); - return NULL; - } - - Py_RETURN_NONE; -} - -static PyObject *gLibFree(PyObject*, PyObject* args) -{ - KX_Scene *kx_scene= gp_KetsjiScene; - char *path; - - if (!PyArg_ParseTuple(args,"s:LibFree",&path)) - return NULL; - - if (kx_scene->GetSceneConverter()->FreeBlendFile(path)) - { - Py_RETURN_TRUE; - } - else { - Py_RETURN_FALSE; - } -} - -static PyObject *gLibList(PyObject*, PyObject* args) -{ - vector &dynMaggie = gp_KetsjiScene->GetSceneConverter()->GetMainDynamic(); - int i= 0; - PyObject *list= PyList_New(dynMaggie.size()); - - for (vector::iterator it=dynMaggie.begin(); !(it==dynMaggie.end()); it++) - { - PyList_SET_ITEM(list, i++, PyUnicode_FromString( (*it)->name) ); - } - - return list; -} - -static struct PyMethodDef game_methods[] = { - {"expandPath", (PyCFunction)gPyExpandPath, METH_VARARGS, (const char *)gPyExpandPath_doc}, - {"startGame", (PyCFunction)gPyStartGame, METH_VARARGS, (const char *)gPyStartGame_doc}, - {"endGame", (PyCFunction)gPyEndGame, METH_NOARGS, (const char *)gPyEndGame_doc}, - {"restartGame", (PyCFunction)gPyRestartGame, METH_NOARGS, (const char *)gPyRestartGame_doc}, - {"saveGlobalDict", (PyCFunction)gPySaveGlobalDict, METH_NOARGS, (const char *)gPySaveGlobalDict_doc}, - {"loadGlobalDict", (PyCFunction)gPyLoadGlobalDict, METH_NOARGS, (const char *)gPyLoadGlobalDict_doc}, - {"sendMessage", (PyCFunction)gPySendMessage, METH_VARARGS, (const char *)gPySendMessage_doc}, - {"getCurrentController", (PyCFunction) SCA_PythonController::sPyGetCurrentController, METH_NOARGS, SCA_PythonController::sPyGetCurrentController__doc__}, - {"getCurrentScene", (PyCFunction) gPyGetCurrentScene, METH_NOARGS, gPyGetCurrentScene_doc}, - {"getSceneList", (PyCFunction) gPyGetSceneList, METH_NOARGS, (const char *)gPyGetSceneList_doc}, - {"addScene", (PyCFunction)gPyAddScene, METH_VARARGS, (const char *)gPyAddScene_doc}, - {"getRandomFloat",(PyCFunction) gPyGetRandomFloat, METH_NOARGS, (const char *)gPyGetRandomFloat_doc}, - {"setGravity",(PyCFunction) gPySetGravity, METH_O, (const char *)"set Gravitation"}, - {"getSpectrum",(PyCFunction) gPyGetSpectrum, METH_NOARGS, (const char *)"get audio spectrum"}, - {"stopDSP",(PyCFunction) gPyStopDSP, METH_VARARGS, (const char *)"stop using the audio dsp (for performance reasons)"}, - {"getMaxLogicFrame", (PyCFunction) gPyGetMaxLogicFrame, METH_NOARGS, (const char *)"Gets the max number of logic frame per render frame"}, - {"setMaxLogicFrame", (PyCFunction) gPySetMaxLogicFrame, METH_VARARGS, (const char *)"Sets the max number of logic frame per render frame"}, - {"getMaxPhysicsFrame", (PyCFunction) gPyGetMaxPhysicsFrame, METH_NOARGS, (const char *)"Gets the max number of physics frame per render frame"}, - {"setMaxPhysicsFrame", (PyCFunction) gPySetMaxPhysicsFrame, METH_VARARGS, (const char *)"Sets the max number of physics farme per render frame"}, - {"getLogicTicRate", (PyCFunction) gPyGetLogicTicRate, METH_NOARGS, (const char *)"Gets the logic tic rate"}, - {"setLogicTicRate", (PyCFunction) gPySetLogicTicRate, METH_VARARGS, (const char *)"Sets the logic tic rate"}, - {"getPhysicsTicRate", (PyCFunction) gPyGetPhysicsTicRate, METH_NOARGS, (const char *)"Gets the physics tic rate"}, - {"setPhysicsTicRate", (PyCFunction) gPySetPhysicsTicRate, METH_VARARGS, (const char *)"Sets the physics tic rate"}, - {"getAverageFrameRate", (PyCFunction) gPyGetAverageFrameRate, METH_NOARGS, (const char *)"Gets the estimated average frame rate"}, - {"getBlendFileList", (PyCFunction)gPyGetBlendFileList, METH_VARARGS, (const char *)"Gets a list of blend files in the same directory as the current blend file"}, - {"PrintGLInfo", (PyCFunction)pyPrintExt, METH_NOARGS, (const char *)"Prints GL Extension Info"}, - {"PrintMemInfo", (PyCFunction)pyPrintStats, METH_NOARGS, (const char *)"Print engine stastics"}, - - /* library functions */ - {"LibLoad", (PyCFunction)gLibLoad, METH_VARARGS, (const char *)""}, - {"LibNew", (PyCFunction)gLibNew, METH_VARARGS, (const char *)""}, - {"LibFree", (PyCFunction)gLibFree, METH_VARARGS, (const char *)""}, - {"LibList", (PyCFunction)gLibList, METH_VARARGS, (const char *)""}, - - {NULL, (PyCFunction) NULL, 0, NULL } -}; - -static PyObject* gPyGetWindowHeight(PyObject*, PyObject* args) -{ - return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetHeight() : 0)); -} - - - -static PyObject* gPyGetWindowWidth(PyObject*, PyObject* args) -{ - return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetWidth() : 0)); -} - - - -// temporarility visibility thing, will be moved to rasterizer/renderer later -bool gUseVisibilityTemp = false; - -static PyObject* gPyEnableVisibility(PyObject*, PyObject* args) -{ - int visible; - if (!PyArg_ParseTuple(args,"i:enableVisibility",&visible)) - return NULL; - - gUseVisibilityTemp = (visible != 0); - Py_RETURN_NONE; -} - - - -static PyObject* gPyShowMouse(PyObject*, PyObject* args) -{ - int visible; - if (!PyArg_ParseTuple(args,"i:showMouse",&visible)) - return NULL; - - if (visible) - { - if (gp_Canvas) - gp_Canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); - } else - { - if (gp_Canvas) - gp_Canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); - } - - Py_RETURN_NONE; -} - - - -static PyObject* gPySetMousePosition(PyObject*, PyObject* args) -{ - int x,y; - if (!PyArg_ParseTuple(args,"ii:setMousePosition",&x,&y)) - return NULL; - - if (gp_Canvas) - gp_Canvas->SetMousePosition(x,y); - - Py_RETURN_NONE; -} - -static PyObject* gPySetEyeSeparation(PyObject*, PyObject* args) -{ - float sep; - if (!PyArg_ParseTuple(args, "f:setEyeSeparation", &sep)) - return NULL; - - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setEyeSeparation(float), Rasterizer not available"); - return NULL; - } - - gp_Rasterizer->SetEyeSeparation(sep); - - Py_RETURN_NONE; -} - -static PyObject* gPyGetEyeSeparation(PyObject*) -{ - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.getEyeSeparation(), Rasterizer not available"); - return NULL; - } - - return PyFloat_FromDouble(gp_Rasterizer->GetEyeSeparation()); -} - -static PyObject* gPySetFocalLength(PyObject*, PyObject* args) -{ - float focus; - if (!PyArg_ParseTuple(args, "f:setFocalLength", &focus)) - return NULL; - - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setFocalLength(float), Rasterizer not available"); - return NULL; - } - - gp_Rasterizer->SetFocalLength(focus); - - Py_RETURN_NONE; -} - -static PyObject* gPyGetFocalLength(PyObject*, PyObject*, PyObject*) -{ - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.getFocalLength(), Rasterizer not available"); - return NULL; - } - - return PyFloat_FromDouble(gp_Rasterizer->GetFocalLength()); - - Py_RETURN_NONE; -} - -static PyObject* gPySetBackgroundColor(PyObject*, PyObject* value) -{ - - MT_Vector4 vec; - if (!PyVecTo(value, vec)) - return NULL; - - if (gp_Canvas) - { - gp_Rasterizer->SetBackColor(vec[0], vec[1], vec[2], vec[3]); - } - Py_RETURN_NONE; -} - - - -static PyObject* gPySetMistColor(PyObject*, PyObject* value) -{ - - MT_Vector3 vec; - if (!PyVecTo(value, vec)) - return NULL; - - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setMistColor(color), Rasterizer not available"); - return NULL; - } - gp_Rasterizer->SetFogColor(vec[0], vec[1], vec[2]); - - Py_RETURN_NONE; -} - -static PyObject* gPyDisableMist(PyObject*) -{ - - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setMistColor(color), Rasterizer not available"); - return NULL; - } - gp_Rasterizer->DisableFog(); - - Py_RETURN_NONE; -} - - -static PyObject* gPySetMistStart(PyObject*, PyObject* args) -{ - - float miststart; - if (!PyArg_ParseTuple(args,"f:setMistStart",&miststart)) - return NULL; - - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setMistStart(float), Rasterizer not available"); - return NULL; - } - - gp_Rasterizer->SetFogStart(miststart); - - Py_RETURN_NONE; -} - - - -static PyObject* gPySetMistEnd(PyObject*, PyObject* args) -{ - - float mistend; - if (!PyArg_ParseTuple(args,"f:setMistEnd",&mistend)) - return NULL; - - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setMistEnd(float), Rasterizer not available"); - return NULL; - } - - gp_Rasterizer->SetFogEnd(mistend); - - Py_RETURN_NONE; -} - - -static PyObject* gPySetAmbientColor(PyObject*, PyObject* value) -{ - - MT_Vector3 vec; - if (!PyVecTo(value, vec)) - return NULL; - - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setAmbientColor(color), Rasterizer not available"); - return NULL; - } - gp_Rasterizer->SetAmbientColor(vec[0], vec[1], vec[2]); - - Py_RETURN_NONE; -} - - - - -static PyObject* gPyMakeScreenshot(PyObject*, PyObject* args) -{ - char* filename; - if (!PyArg_ParseTuple(args,"s:makeScreenshot",&filename)) - return NULL; - - if (gp_Canvas) - { - gp_Canvas->MakeScreenShot(filename); - } - - Py_RETURN_NONE; -} - -static PyObject* gPyEnableMotionBlur(PyObject*, PyObject* args) -{ - float motionblurvalue; - if (!PyArg_ParseTuple(args,"f:enableMotionBlur",&motionblurvalue)) - return NULL; - - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.enableMotionBlur(float), Rasterizer not available"); - return NULL; - } - - gp_Rasterizer->EnableMotionBlur(motionblurvalue); - - Py_RETURN_NONE; -} - -static PyObject* gPyDisableMotionBlur(PyObject*) -{ - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.disableMotionBlur(), Rasterizer not available"); - return NULL; - } - - gp_Rasterizer->DisableMotionBlur(); - - Py_RETURN_NONE; -} - -int getGLSLSettingFlag(char *setting) -{ - if(strcmp(setting, "lights") == 0) - return GAME_GLSL_NO_LIGHTS; - else if(strcmp(setting, "shaders") == 0) - return GAME_GLSL_NO_SHADERS; - else if(strcmp(setting, "shadows") == 0) - return GAME_GLSL_NO_SHADOWS; - else if(strcmp(setting, "ramps") == 0) - return GAME_GLSL_NO_RAMPS; - else if(strcmp(setting, "nodes") == 0) - return GAME_GLSL_NO_NODES; - else if(strcmp(setting, "extra_textures") == 0) - return GAME_GLSL_NO_EXTRA_TEX; - else - return -1; -} - -static PyObject* gPySetGLSLMaterialSetting(PyObject*, - PyObject* args, - PyObject*) -{ - GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); - char *setting; - int enable, flag, sceneflag; - - if (!PyArg_ParseTuple(args,"si:setGLSLMaterialSetting",&setting,&enable)) - return NULL; - - flag = getGLSLSettingFlag(setting); - - if (flag==-1) { - PyErr_SetString(PyExc_ValueError, "Rasterizer.setGLSLMaterialSetting(string): glsl setting is not known"); - return NULL; - } - - sceneflag= gm->flag; - - if (enable) - gm->flag &= ~flag; - else - gm->flag |= flag; - - /* display lists and GLSL materials need to be remade */ - if(sceneflag != gm->flag) { - GPU_materials_free(); - if(gp_KetsjiEngine) { - KX_SceneList *scenes = gp_KetsjiEngine->CurrentScenes(); - KX_SceneList::iterator it; - - for(it=scenes->begin(); it!=scenes->end(); it++) - if((*it)->GetBucketManager()) { - (*it)->GetBucketManager()->ReleaseDisplayLists(); - (*it)->GetBucketManager()->ReleaseMaterials(); - } - } - } - - Py_RETURN_NONE; -} - -static PyObject* gPyGetGLSLMaterialSetting(PyObject*, - PyObject* args, - PyObject*) -{ - GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); - char *setting; - int enabled = 0, flag; - - if (!PyArg_ParseTuple(args,"s:getGLSLMaterialSetting",&setting)) - return NULL; - - flag = getGLSLSettingFlag(setting); - - if (flag==-1) { - PyErr_SetString(PyExc_ValueError, "Rasterizer.getGLSLMaterialSetting(string): glsl setting is not known"); - return NULL; - } - - enabled = ((gm->flag & flag) != 0); - return PyLong_FromSsize_t(enabled); -} - -#define KX_TEXFACE_MATERIAL 0 -#define KX_BLENDER_MULTITEX_MATERIAL 1 -#define KX_BLENDER_GLSL_MATERIAL 2 - -static PyObject* gPySetMaterialType(PyObject*, - PyObject* args, - PyObject*) -{ - GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); - int type; - - if (!PyArg_ParseTuple(args,"i:setMaterialType",&type)) - return NULL; - - if(type == KX_BLENDER_GLSL_MATERIAL) - gm->matmode= GAME_MAT_GLSL; - else if(type == KX_BLENDER_MULTITEX_MATERIAL) - gm->matmode= GAME_MAT_MULTITEX; - else if(type == KX_TEXFACE_MATERIAL) - gm->matmode= GAME_MAT_TEXFACE; - else { - PyErr_SetString(PyExc_ValueError, "Rasterizer.setMaterialType(int): material type is not known"); - return NULL; - } - - Py_RETURN_NONE; -} - -static PyObject* gPyGetMaterialType(PyObject*) -{ - GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); - int flag; - - if(gm->matmode == GAME_MAT_GLSL) - flag = KX_BLENDER_GLSL_MATERIAL; - else if(gm->matmode == GAME_MAT_MULTITEX) - flag = KX_BLENDER_MULTITEX_MATERIAL; - else - flag = KX_TEXFACE_MATERIAL; - - return PyLong_FromSsize_t(flag); -} - -static PyObject* gPyDrawLine(PyObject*, PyObject* args) -{ - PyObject* ob_from; - PyObject* ob_to; - PyObject* ob_color; - - if (!gp_Rasterizer) { - PyErr_SetString(PyExc_RuntimeError, "Rasterizer.drawLine(obFrom, obTo, color): Rasterizer not available"); - return NULL; - } - - if (!PyArg_ParseTuple(args,"OOO:drawLine",&ob_from,&ob_to,&ob_color)) - return NULL; - - MT_Vector3 from; - MT_Vector3 to; - MT_Vector3 color; - if (!PyVecTo(ob_from, from)) - return NULL; - if (!PyVecTo(ob_to, to)) - return NULL; - if (!PyVecTo(ob_color, color)) - return NULL; - - gp_Rasterizer->DrawDebugLine(from,to,color); - - Py_RETURN_NONE; -} - -static struct PyMethodDef rasterizer_methods[] = { - {"getWindowWidth",(PyCFunction) gPyGetWindowWidth, - METH_VARARGS, "getWindowWidth doc"}, - {"getWindowHeight",(PyCFunction) gPyGetWindowHeight, - METH_VARARGS, "getWindowHeight doc"}, - {"makeScreenshot",(PyCFunction)gPyMakeScreenshot, - METH_VARARGS, "make Screenshot doc"}, - {"enableVisibility",(PyCFunction) gPyEnableVisibility, - METH_VARARGS, "enableVisibility doc"}, - {"showMouse",(PyCFunction) gPyShowMouse, - METH_VARARGS, "showMouse(bool visible)"}, - {"setMousePosition",(PyCFunction) gPySetMousePosition, - METH_VARARGS, "setMousePosition(int x,int y)"}, - {"setBackgroundColor",(PyCFunction)gPySetBackgroundColor,METH_O,"set Background Color (rgb)"}, - {"setAmbientColor",(PyCFunction)gPySetAmbientColor,METH_O,"set Ambient Color (rgb)"}, - {"disableMist",(PyCFunction)gPyDisableMist,METH_NOARGS,"turn off mist"}, - {"setMistColor",(PyCFunction)gPySetMistColor,METH_O,"set Mist Color (rgb)"}, - {"setMistStart",(PyCFunction)gPySetMistStart,METH_VARARGS,"set Mist Start(rgb)"}, - {"setMistEnd",(PyCFunction)gPySetMistEnd,METH_VARARGS,"set Mist End(rgb)"}, - {"enableMotionBlur",(PyCFunction)gPyEnableMotionBlur,METH_VARARGS,"enable motion blur"}, - {"disableMotionBlur",(PyCFunction)gPyDisableMotionBlur,METH_NOARGS,"disable motion blur"}, - - - {"setEyeSeparation", (PyCFunction) gPySetEyeSeparation, METH_VARARGS, "set the eye separation for stereo mode"}, - {"getEyeSeparation", (PyCFunction) gPyGetEyeSeparation, METH_NOARGS, "get the eye separation for stereo mode"}, - {"setFocalLength", (PyCFunction) gPySetFocalLength, METH_VARARGS, "set the focal length for stereo mode"}, - {"getFocalLength", (PyCFunction) gPyGetFocalLength, METH_VARARGS, "get the focal length for stereo mode"}, - {"setMaterialMode",(PyCFunction) gPySetMaterialType, - METH_VARARGS, "set the material mode to use for OpenGL rendering"}, - {"getMaterialMode",(PyCFunction) gPyGetMaterialType, - METH_NOARGS, "get the material mode being used for OpenGL rendering"}, - {"setGLSLMaterialSetting",(PyCFunction) gPySetGLSLMaterialSetting, - METH_VARARGS, "set the state of a GLSL material setting"}, - {"getGLSLMaterialSetting",(PyCFunction) gPyGetGLSLMaterialSetting, - METH_VARARGS, "get the state of a GLSL material setting"}, - {"drawLine", (PyCFunction) gPyDrawLine, - METH_VARARGS, "draw a line on the screen"}, - { NULL, (PyCFunction) NULL, 0, NULL } -}; - -// Initialization function for the module (*must* be called initGameLogic) - -static char GameLogic_module_documentation[] = -"This is the Python API for the game engine of GameLogic" -; - -static char Rasterizer_module_documentation[] = -"This is the Python API for the game engine of Rasterizer" -; - -static struct PyModuleDef GameLogic_module_def = { - {}, /* m_base */ - "GameLogic", /* m_name */ - GameLogic_module_documentation, /* m_doc */ - 0, /* m_size */ - game_methods, /* m_methods */ - 0, /* m_reload */ - 0, /* m_traverse */ - 0, /* m_clear */ - 0, /* m_free */ -}; - -PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack to get gravity hook -{ - PyObject* m; - PyObject* d; - PyObject* item; /* temp PyObject* storage */ - - gp_KetsjiEngine = engine; - gp_KetsjiScene = scene; - - gUseVisibilityTemp=false; - - PyObjectPlus::ClearDeprecationWarning(); /* Not that nice to call here but makes sure warnings are reset between loading scenes */ - - /* Use existing module where possible - * be careful not to init any runtime vars after this */ - m = PyImport_ImportModule( "GameLogic" ); - if(m) { - Py_DECREF(m); - return m; - } - else { - PyErr_Clear(); - // Create the module and add the functions - m = PyModule_Create(&GameLogic_module_def); - PyDict_SetItemString(PySys_GetObject("modules"), GameLogic_module_def.m_name, m); - } - - // Add some symbolic constants to the module - d = PyModule_GetDict(m); - - // can be overwritten later for gameEngine instances that can load new blend files and re-initialize this module - // for now its safe to make sure it exists for other areas such as the web plugin - - PyDict_SetItemString(d, "globalDict", item=PyDict_New()); Py_DECREF(item); - - // Add keyboard and mouse attributes to this module - SCA_PythonKeyboard* pykeyb = new SCA_PythonKeyboard(gp_KetsjiEngine->GetKeyboardDevice()); - PyDict_SetItemString(d, "keyboard", pykeyb->NewProxy(true)); - - SCA_PythonMouse* pymouse = new SCA_PythonMouse(gp_KetsjiEngine->GetMouseDevice(), gp_Canvas); - PyDict_SetItemString(d, "mouse", pymouse->NewProxy(true)); - - ErrorObject = PyUnicode_FromString("GameLogic.error"); - PyDict_SetItemString(d, "error", ErrorObject); - Py_DECREF(ErrorObject); - - // XXXX Add constants here - /* To use logic bricks, we need some sort of constants. Here, we associate */ - /* constants and sumbolic names. Add them to dictionary d. */ - - /* 1. true and false: needed for everyone */ - KX_MACRO_addTypesToDict(d, KX_TRUE, SCA_ILogicBrick::KX_TRUE); - KX_MACRO_addTypesToDict(d, KX_FALSE, SCA_ILogicBrick::KX_FALSE); - - /* 2. Property sensor */ - KX_MACRO_addTypesToDict(d, KX_PROPSENSOR_EQUAL, SCA_PropertySensor::KX_PROPSENSOR_EQUAL); - KX_MACRO_addTypesToDict(d, KX_PROPSENSOR_NOTEQUAL, SCA_PropertySensor::KX_PROPSENSOR_NOTEQUAL); - KX_MACRO_addTypesToDict(d, KX_PROPSENSOR_INTERVAL, SCA_PropertySensor::KX_PROPSENSOR_INTERVAL); - KX_MACRO_addTypesToDict(d, KX_PROPSENSOR_CHANGED, SCA_PropertySensor::KX_PROPSENSOR_CHANGED); - KX_MACRO_addTypesToDict(d, KX_PROPSENSOR_EXPRESSION, SCA_PropertySensor::KX_PROPSENSOR_EXPRESSION); - - /* 3. Constraint actuator */ - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_LOCX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCX); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_LOCY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCY); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_LOCZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCZ); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ROTX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTX); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ROTY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTY); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ROTZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTZ); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRPX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPX); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRPY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPY); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRPY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRPY); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRNX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNX); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRNY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNY); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DIRNY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DIRNY); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ORIX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ORIY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIY); - KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_ORIZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIZ); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHPX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPX); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHPY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPY); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHPZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHPZ); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHNX, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNX); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHNY, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNY); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_FHNZ, KX_ConstraintActuator::KX_ACT_CONSTRAINT_FHNZ); - - /* 4. Ipo actuator, simple part */ - KX_MACRO_addTypesToDict(d, KX_IPOACT_PLAY, KX_IpoActuator::KX_ACT_IPO_PLAY); - KX_MACRO_addTypesToDict(d, KX_IPOACT_PINGPONG, KX_IpoActuator::KX_ACT_IPO_PINGPONG); - KX_MACRO_addTypesToDict(d, KX_IPOACT_FLIPPER, KX_IpoActuator::KX_ACT_IPO_FLIPPER); - KX_MACRO_addTypesToDict(d, KX_IPOACT_LOOPSTOP, KX_IpoActuator::KX_ACT_IPO_LOOPSTOP); - KX_MACRO_addTypesToDict(d, KX_IPOACT_LOOPEND, KX_IpoActuator::KX_ACT_IPO_LOOPEND); - KX_MACRO_addTypesToDict(d, KX_IPOACT_FROM_PROP,KX_IpoActuator::KX_ACT_IPO_FROM_PROP); - - /* 5. Random distribution types */ - KX_MACRO_addTypesToDict(d, KX_RANDOMACT_BOOL_CONST, SCA_RandomActuator::KX_RANDOMACT_BOOL_CONST); - KX_MACRO_addTypesToDict(d, KX_RANDOMACT_BOOL_UNIFORM, SCA_RandomActuator::KX_RANDOMACT_BOOL_UNIFORM); - KX_MACRO_addTypesToDict(d, KX_RANDOMACT_BOOL_BERNOUILLI, SCA_RandomActuator::KX_RANDOMACT_BOOL_BERNOUILLI); - KX_MACRO_addTypesToDict(d, KX_RANDOMACT_INT_CONST, SCA_RandomActuator::KX_RANDOMACT_INT_CONST); - KX_MACRO_addTypesToDict(d, KX_RANDOMACT_INT_UNIFORM, SCA_RandomActuator::KX_RANDOMACT_INT_UNIFORM); - KX_MACRO_addTypesToDict(d, KX_RANDOMACT_INT_POISSON, SCA_RandomActuator::KX_RANDOMACT_INT_POISSON); - KX_MACRO_addTypesToDict(d, KX_RANDOMACT_FLOAT_CONST, SCA_RandomActuator::KX_RANDOMACT_FLOAT_CONST); - KX_MACRO_addTypesToDict(d, KX_RANDOMACT_FLOAT_UNIFORM, SCA_RandomActuator::KX_RANDOMACT_FLOAT_UNIFORM); - KX_MACRO_addTypesToDict(d, KX_RANDOMACT_FLOAT_NORMAL, SCA_RandomActuator::KX_RANDOMACT_FLOAT_NORMAL); - KX_MACRO_addTypesToDict(d, KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL, SCA_RandomActuator::KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL); - - /* 6. Sound actuator */ - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_PLAYSTOP, KX_SoundActuator::KX_SOUNDACT_PLAYSTOP); - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_PLAYEND, KX_SoundActuator::KX_SOUNDACT_PLAYEND); - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPSTOP, KX_SoundActuator::KX_SOUNDACT_LOOPSTOP); - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPEND, KX_SoundActuator::KX_SOUNDACT_LOOPEND); - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL); - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP); - - /* 7. Action actuator */ - KX_MACRO_addTypesToDict(d, KX_ACTIONACT_PLAY, ACT_ACTION_PLAY); - KX_MACRO_addTypesToDict(d, KX_ACTIONACT_FLIPPER, ACT_ACTION_FLIPPER); - KX_MACRO_addTypesToDict(d, KX_ACTIONACT_LOOPSTOP, ACT_ACTION_LOOP_STOP); - KX_MACRO_addTypesToDict(d, KX_ACTIONACT_LOOPEND, ACT_ACTION_LOOP_END); - KX_MACRO_addTypesToDict(d, KX_ACTIONACT_PROPERTY, ACT_ACTION_FROM_PROP); - - /*8. GL_BlendFunc */ - KX_MACRO_addTypesToDict(d, BL_ZERO, GL_ZERO); - KX_MACRO_addTypesToDict(d, BL_ONE, GL_ONE); - KX_MACRO_addTypesToDict(d, BL_SRC_COLOR, GL_SRC_COLOR); - KX_MACRO_addTypesToDict(d, BL_ONE_MINUS_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR); - KX_MACRO_addTypesToDict(d, BL_DST_COLOR, GL_DST_COLOR); - KX_MACRO_addTypesToDict(d, BL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_DST_COLOR); - KX_MACRO_addTypesToDict(d, BL_SRC_ALPHA, GL_SRC_ALPHA); - KX_MACRO_addTypesToDict(d, BL_ONE_MINUS_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - KX_MACRO_addTypesToDict(d, BL_DST_ALPHA, GL_DST_ALPHA); - KX_MACRO_addTypesToDict(d, BL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA); - KX_MACRO_addTypesToDict(d, BL_SRC_ALPHA_SATURATE, GL_SRC_ALPHA_SATURATE); - - - /* 9. UniformTypes */ - KX_MACRO_addTypesToDict(d, SHD_TANGENT, BL_Shader::SHD_TANGENT); - KX_MACRO_addTypesToDict(d, MODELVIEWMATRIX, BL_Shader::MODELVIEWMATRIX); - KX_MACRO_addTypesToDict(d, MODELVIEWMATRIX_TRANSPOSE, BL_Shader::MODELVIEWMATRIX_TRANSPOSE); - KX_MACRO_addTypesToDict(d, MODELVIEWMATRIX_INVERSE, BL_Shader::MODELVIEWMATRIX_INVERSE); - KX_MACRO_addTypesToDict(d, MODELVIEWMATRIX_INVERSETRANSPOSE, BL_Shader::MODELVIEWMATRIX_INVERSETRANSPOSE); - KX_MACRO_addTypesToDict(d, MODELMATRIX, BL_Shader::MODELMATRIX); - KX_MACRO_addTypesToDict(d, MODELMATRIX_TRANSPOSE, BL_Shader::MODELMATRIX_TRANSPOSE); - KX_MACRO_addTypesToDict(d, MODELMATRIX_INVERSE, BL_Shader::MODELMATRIX_INVERSE); - KX_MACRO_addTypesToDict(d, MODELMATRIX_INVERSETRANSPOSE, BL_Shader::MODELMATRIX_INVERSETRANSPOSE); - KX_MACRO_addTypesToDict(d, VIEWMATRIX, BL_Shader::VIEWMATRIX); - KX_MACRO_addTypesToDict(d, VIEWMATRIX_TRANSPOSE, BL_Shader::VIEWMATRIX_TRANSPOSE); - KX_MACRO_addTypesToDict(d, VIEWMATRIX_INVERSE, BL_Shader::VIEWMATRIX_INVERSE); - KX_MACRO_addTypesToDict(d, VIEWMATRIX_INVERSETRANSPOSE, BL_Shader::VIEWMATRIX_INVERSETRANSPOSE); - KX_MACRO_addTypesToDict(d, CAM_POS, BL_Shader::CAM_POS); - KX_MACRO_addTypesToDict(d, CONSTANT_TIMER, BL_Shader::CONSTANT_TIMER); - - /* 10 state actuator */ - KX_MACRO_addTypesToDict(d, KX_STATE1, (1<<0)); - KX_MACRO_addTypesToDict(d, KX_STATE2, (1<<1)); - KX_MACRO_addTypesToDict(d, KX_STATE3, (1<<2)); - KX_MACRO_addTypesToDict(d, KX_STATE4, (1<<3)); - KX_MACRO_addTypesToDict(d, KX_STATE5, (1<<4)); - KX_MACRO_addTypesToDict(d, KX_STATE6, (1<<5)); - KX_MACRO_addTypesToDict(d, KX_STATE7, (1<<6)); - KX_MACRO_addTypesToDict(d, KX_STATE8, (1<<7)); - KX_MACRO_addTypesToDict(d, KX_STATE9, (1<<8)); - KX_MACRO_addTypesToDict(d, KX_STATE10, (1<<9)); - KX_MACRO_addTypesToDict(d, KX_STATE11, (1<<10)); - KX_MACRO_addTypesToDict(d, KX_STATE12, (1<<11)); - KX_MACRO_addTypesToDict(d, KX_STATE13, (1<<12)); - KX_MACRO_addTypesToDict(d, KX_STATE14, (1<<13)); - KX_MACRO_addTypesToDict(d, KX_STATE15, (1<<14)); - KX_MACRO_addTypesToDict(d, KX_STATE16, (1<<15)); - KX_MACRO_addTypesToDict(d, KX_STATE17, (1<<16)); - KX_MACRO_addTypesToDict(d, KX_STATE18, (1<<17)); - KX_MACRO_addTypesToDict(d, KX_STATE19, (1<<18)); - KX_MACRO_addTypesToDict(d, KX_STATE20, (1<<19)); - KX_MACRO_addTypesToDict(d, KX_STATE21, (1<<20)); - KX_MACRO_addTypesToDict(d, KX_STATE22, (1<<21)); - KX_MACRO_addTypesToDict(d, KX_STATE23, (1<<22)); - KX_MACRO_addTypesToDict(d, KX_STATE24, (1<<23)); - KX_MACRO_addTypesToDict(d, KX_STATE25, (1<<24)); - KX_MACRO_addTypesToDict(d, KX_STATE26, (1<<25)); - KX_MACRO_addTypesToDict(d, KX_STATE27, (1<<26)); - KX_MACRO_addTypesToDict(d, KX_STATE28, (1<<27)); - KX_MACRO_addTypesToDict(d, KX_STATE29, (1<<28)); - KX_MACRO_addTypesToDict(d, KX_STATE30, (1<<29)); - - /* All Sensors */ - KX_MACRO_addTypesToDict(d, KX_SENSOR_JUST_ACTIVATED, SCA_ISensor::KX_SENSOR_JUST_ACTIVATED); - KX_MACRO_addTypesToDict(d, KX_SENSOR_ACTIVE, SCA_ISensor::KX_SENSOR_ACTIVE); - KX_MACRO_addTypesToDict(d, KX_SENSOR_JUST_DEACTIVATED, SCA_ISensor::KX_SENSOR_JUST_DEACTIVATED); - KX_MACRO_addTypesToDict(d, KX_SENSOR_INACTIVE, SCA_ISensor::KX_SENSOR_INACTIVE); - - /* Radar Sensor */ - KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_POS_X, KX_RadarSensor::KX_RADAR_AXIS_POS_X); - KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_POS_Y, KX_RadarSensor::KX_RADAR_AXIS_POS_Y); - KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_POS_Z, KX_RadarSensor::KX_RADAR_AXIS_POS_Z); - KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_NEG_X, KX_RadarSensor::KX_RADAR_AXIS_NEG_Y); - KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_NEG_Y, KX_RadarSensor::KX_RADAR_AXIS_NEG_X); - KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_NEG_Z, KX_RadarSensor::KX_RADAR_AXIS_NEG_Z); - - /* Ray Sensor */ - KX_MACRO_addTypesToDict(d, KX_RAY_AXIS_POS_X, KX_RaySensor::KX_RAY_AXIS_POS_X); - KX_MACRO_addTypesToDict(d, KX_RAY_AXIS_POS_Y, KX_RaySensor::KX_RAY_AXIS_POS_Y); - KX_MACRO_addTypesToDict(d, KX_RAY_AXIS_POS_Z, KX_RaySensor::KX_RAY_AXIS_POS_Z); - KX_MACRO_addTypesToDict(d, KX_RAY_AXIS_NEG_X, KX_RaySensor::KX_RAY_AXIS_NEG_Y); - KX_MACRO_addTypesToDict(d, KX_RAY_AXIS_NEG_Y, KX_RaySensor::KX_RAY_AXIS_NEG_X); - KX_MACRO_addTypesToDict(d, KX_RAY_AXIS_NEG_Z, KX_RaySensor::KX_RAY_AXIS_NEG_Z); - - /* Dynamic actuator */ - KX_MACRO_addTypesToDict(d, KX_DYN_RESTORE_DYNAMICS, KX_SCA_DynamicActuator::KX_DYN_RESTORE_DYNAMICS); - KX_MACRO_addTypesToDict(d, KX_DYN_DISABLE_DYNAMICS, KX_SCA_DynamicActuator::KX_DYN_DISABLE_DYNAMICS); - KX_MACRO_addTypesToDict(d, KX_DYN_ENABLE_RIGID_BODY, KX_SCA_DynamicActuator::KX_DYN_ENABLE_RIGID_BODY); - KX_MACRO_addTypesToDict(d, KX_DYN_DISABLE_RIGID_BODY, KX_SCA_DynamicActuator::KX_DYN_DISABLE_RIGID_BODY); - KX_MACRO_addTypesToDict(d, KX_DYN_SET_MASS, KX_SCA_DynamicActuator::KX_DYN_SET_MASS); - - /* Input & Mouse Sensor */ - KX_MACRO_addTypesToDict(d, KX_INPUT_NONE, SCA_InputEvent::KX_NO_INPUTSTATUS); - KX_MACRO_addTypesToDict(d, KX_INPUT_JUST_ACTIVATED, SCA_InputEvent::KX_JUSTACTIVATED); - KX_MACRO_addTypesToDict(d, KX_INPUT_ACTIVE, SCA_InputEvent::KX_ACTIVE); - KX_MACRO_addTypesToDict(d, KX_INPUT_JUST_RELEASED, SCA_InputEvent::KX_JUSTRELEASED); - - KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_LEFT, SCA_IInputDevice::KX_LEFTMOUSE); - KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_MIDDLE, SCA_IInputDevice::KX_MIDDLEMOUSE); - KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_RIGHT, SCA_IInputDevice::KX_RIGHTMOUSE); - - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_ENABLED, RAS_2DFilterManager::RAS_2DFILTER_ENABLED); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_DISABLED, RAS_2DFilterManager::RAS_2DFILTER_DISABLED); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_NOFILTER, RAS_2DFilterManager::RAS_2DFILTER_NOFILTER); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_MOTIONBLUR, RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_BLUR, RAS_2DFilterManager::RAS_2DFILTER_BLUR); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_SHARPEN, RAS_2DFilterManager::RAS_2DFILTER_SHARPEN); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_DILATION, RAS_2DFilterManager::RAS_2DFILTER_DILATION); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_EROSION, RAS_2DFilterManager::RAS_2DFILTER_EROSION); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_LAPLACIAN, RAS_2DFilterManager::RAS_2DFILTER_LAPLACIAN); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_SOBEL, RAS_2DFilterManager::RAS_2DFILTER_SOBEL); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_PREWITT, RAS_2DFilterManager::RAS_2DFILTER_PREWITT); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_GRAYSCALE, RAS_2DFilterManager::RAS_2DFILTER_GRAYSCALE); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_SEPIA, RAS_2DFilterManager::RAS_2DFILTER_SEPIA); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_INVERT, RAS_2DFilterManager::RAS_2DFILTER_INVERT); - KX_MACRO_addTypesToDict(d, RAS_2DFILTER_CUSTOMFILTER, RAS_2DFilterManager::RAS_2DFILTER_CUSTOMFILTER); - - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_PLAYSTOP, KX_SoundActuator::KX_SOUNDACT_PLAYSTOP); - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_PLAYEND, KX_SoundActuator::KX_SOUNDACT_PLAYEND); - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPSTOP, KX_SoundActuator::KX_SOUNDACT_LOOPSTOP); - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPEND, KX_SoundActuator:: KX_SOUNDACT_LOOPEND); - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL); - KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP); - - KX_MACRO_addTypesToDict(d, KX_STATE_OP_CPY, KX_StateActuator::OP_CPY); - KX_MACRO_addTypesToDict(d, KX_STATE_OP_SET, KX_StateActuator::OP_SET); - KX_MACRO_addTypesToDict(d, KX_STATE_OP_CLR, KX_StateActuator::OP_CLR); - KX_MACRO_addTypesToDict(d, KX_STATE_OP_NEG, KX_StateActuator::OP_NEG); - - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_NORMAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_NORMAL); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_MATERIAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_MATERIAL); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_PERMANENT, KX_ConstraintActuator::KX_ACT_CONSTRAINT_PERMANENT); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_DISTANCE, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DISTANCE); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_LOCAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCAL); - KX_MACRO_addTypesToDict(d, KX_ACT_CONSTRAINT_DOROTFH, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DOROTFH); - - /* Game Actuator Modes */ - KX_MACRO_addTypesToDict(d, KX_GAME_LOAD, KX_GameActuator::KX_GAME_LOAD); - KX_MACRO_addTypesToDict(d, KX_GAME_START, KX_GameActuator::KX_GAME_START); - KX_MACRO_addTypesToDict(d, KX_GAME_RESTART, KX_GameActuator::KX_GAME_RESTART); - KX_MACRO_addTypesToDict(d, KX_GAME_QUIT, KX_GameActuator::KX_GAME_QUIT); - KX_MACRO_addTypesToDict(d, KX_GAME_SAVECFG, KX_GameActuator::KX_GAME_SAVECFG); - KX_MACRO_addTypesToDict(d, KX_GAME_LOADCFG, KX_GameActuator::KX_GAME_LOADCFG); - - /* Scene Actuator Modes */ - KX_MACRO_addTypesToDict(d, KX_SCENE_RESTART, KX_SceneActuator::KX_SCENE_RESTART); - KX_MACRO_addTypesToDict(d, KX_SCENE_SET_SCENE, KX_SceneActuator::KX_SCENE_SET_SCENE); - KX_MACRO_addTypesToDict(d, KX_SCENE_SET_CAMERA, KX_SceneActuator::KX_SCENE_SET_CAMERA); - KX_MACRO_addTypesToDict(d, KX_SCENE_ADD_FRONT_SCENE, KX_SceneActuator::KX_SCENE_ADD_FRONT_SCENE); - KX_MACRO_addTypesToDict(d, KX_SCENE_ADD_BACK_SCENE, KX_SceneActuator::KX_SCENE_ADD_BACK_SCENE); - KX_MACRO_addTypesToDict(d, KX_SCENE_REMOVE_SCENE, KX_SceneActuator::KX_SCENE_REMOVE_SCENE); - KX_MACRO_addTypesToDict(d, KX_SCENE_SUSPEND, KX_SceneActuator::KX_SCENE_SUSPEND); - KX_MACRO_addTypesToDict(d, KX_SCENE_RESUME, KX_SceneActuator::KX_SCENE_RESUME); - - /* Parent Actuator Modes */ - KX_MACRO_addTypesToDict(d, KX_PARENT_SET, KX_ParentActuator::KX_PARENT_SET); - KX_MACRO_addTypesToDict(d, KX_PARENT_REMOVE, KX_ParentActuator::KX_PARENT_REMOVE); - - /* BL_ArmatureConstraint type */ - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_TRACKTO, CONSTRAINT_TYPE_TRACKTO); - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_KINEMATIC); - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_ROTLIKE, CONSTRAINT_TYPE_ROTLIKE); - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_LOCLIKE, CONSTRAINT_TYPE_LOCLIKE); - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_MINMAX, CONSTRAINT_TYPE_MINMAX); - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_SIZELIKE, CONSTRAINT_TYPE_SIZELIKE); - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_LOCKTRACK, CONSTRAINT_TYPE_LOCKTRACK); - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_STRETCHTO, CONSTRAINT_TYPE_STRETCHTO); - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_CLAMPTO); - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_TRANSFORM, CONSTRAINT_TYPE_TRANSFORM); - KX_MACRO_addTypesToDict(d, CONSTRAINT_TYPE_DISTLIMIT, CONSTRAINT_TYPE_DISTLIMIT); - /* BL_ArmatureConstraint ik_type */ - KX_MACRO_addTypesToDict(d, CONSTRAINT_IK_COPYPOSE, CONSTRAINT_IK_COPYPOSE); - KX_MACRO_addTypesToDict(d, CONSTRAINT_IK_DISTANCE, CONSTRAINT_IK_DISTANCE); - /* BL_ArmatureConstraint ik_mode */ - KX_MACRO_addTypesToDict(d, CONSTRAINT_IK_MODE_INSIDE, LIMITDIST_INSIDE); - KX_MACRO_addTypesToDict(d, CONSTRAINT_IK_MODE_OUTSIDE, LIMITDIST_OUTSIDE); - KX_MACRO_addTypesToDict(d, CONSTRAINT_IK_MODE_ONSURFACE, LIMITDIST_ONSURFACE); - /* BL_ArmatureConstraint ik_flag */ - KX_MACRO_addTypesToDict(d, CONSTRAINT_IK_FLAG_TIP, CONSTRAINT_IK_TIP); - KX_MACRO_addTypesToDict(d, CONSTRAINT_IK_FLAG_ROT, CONSTRAINT_IK_ROT); - KX_MACRO_addTypesToDict(d, CONSTRAINT_IK_FLAG_STRETCH, CONSTRAINT_IK_STRETCH); - KX_MACRO_addTypesToDict(d, CONSTRAINT_IK_FLAG_POS, CONSTRAINT_IK_POS); - /* KX_ArmatureSensor type */ - KX_MACRO_addTypesToDict(d, KX_ARMSENSOR_STATE_CHANGED, SENS_ARM_STATE_CHANGED); - KX_MACRO_addTypesToDict(d, KX_ARMSENSOR_LIN_ERROR_BELOW, SENS_ARM_LIN_ERROR_BELOW); - KX_MACRO_addTypesToDict(d, KX_ARMSENSOR_LIN_ERROR_ABOVE, SENS_ARM_LIN_ERROR_ABOVE); - KX_MACRO_addTypesToDict(d, KX_ARMSENSOR_ROT_ERROR_BELOW, SENS_ARM_ROT_ERROR_BELOW); - KX_MACRO_addTypesToDict(d, KX_ARMSENSOR_ROT_ERROR_ABOVE, SENS_ARM_ROT_ERROR_ABOVE); - - /* BL_ArmatureActuator type */ - KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_RUN, ACT_ARM_RUN); - KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_ENABLE, ACT_ARM_ENABLE); - KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_DISABLE, ACT_ARM_DISABLE); - KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_SETTARGET, ACT_ARM_SETTARGET); - KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_SETWEIGHT, ACT_ARM_SETWEIGHT); - - /* BL_Armature Channel rotation_mode */ - KX_MACRO_addTypesToDict(d, ROT_MODE_QUAT, ROT_MODE_QUAT); - KX_MACRO_addTypesToDict(d, ROT_MODE_XYZ, ROT_MODE_XYZ); - KX_MACRO_addTypesToDict(d, ROT_MODE_XZY, ROT_MODE_XZY); - KX_MACRO_addTypesToDict(d, ROT_MODE_YXZ, ROT_MODE_YXZ); - KX_MACRO_addTypesToDict(d, ROT_MODE_YZX, ROT_MODE_YZX); - KX_MACRO_addTypesToDict(d, ROT_MODE_ZXY, ROT_MODE_ZXY); - KX_MACRO_addTypesToDict(d, ROT_MODE_ZYX, ROT_MODE_ZYX); - - // Check for errors - if (PyErr_Occurred()) - { - Py_FatalError("can't initialize module GameLogic"); - } - - return m; -} - -// Python Sandbox code -// override builtin functions import() and open() - - -PyObject *KXpy_open(PyObject *self, PyObject *args) { - PyErr_SetString(PyExc_RuntimeError, "Sandbox: open() function disabled!\nGame Scripts should not use this function."); - return NULL; -} - -PyObject *KXpy_file(PyObject *self, PyObject *args) { - PyErr_SetString(PyExc_RuntimeError, "Sandbox: file() function disabled!\nGame Scripts should not use this function."); - return NULL; -} - -PyObject *KXpy_execfile(PyObject *self, PyObject *args) { - PyErr_SetString(PyExc_RuntimeError, "Sandbox: execfile() function disabled!\nGame Scripts should not use this function."); - return NULL; -} - -PyObject *KXpy_compile(PyObject *self, PyObject *args) { - PyErr_SetString(PyExc_RuntimeError, "Sandbox: compile() function disabled!\nGame Scripts should not use this function."); - return NULL; -} - -PyObject *KXpy_import(PyObject *self, PyObject *args) -{ - char *name; - int found; - PyObject *globals = NULL; - PyObject *locals = NULL; - PyObject *fromlist = NULL; - PyObject *l, *m, *n; - int level; /* not used yet */ - - if (!PyArg_ParseTuple(args, "s|OOOi:m_import", - &name, &globals, &locals, &fromlist, &level)) - return NULL; - - /* check for builtin modules */ - m = PyImport_AddModule("sys"); - l = PyObject_GetAttrString(m, "builtin_module_names"); - n = PyUnicode_FromString(name); - - if (PySequence_Contains(l, n)) { - return PyImport_ImportModuleEx(name, globals, locals, fromlist); - } - - /* quick hack for GamePython modules - TODO: register builtin modules properly by ExtendInittab */ - if (!strcmp(name, "GameLogic") || !strcmp(name, "GameKeys") || !strcmp(name, "PhysicsConstraints") || - !strcmp(name, "Rasterizer") || !strcmp(name, "mathutils") || !strcmp(name, "bgl") || !strcmp(name, "geometry")) { - return PyImport_ImportModuleEx(name, globals, locals, fromlist); - } - - /* Import blender texts as python modules */ - m= bpy_text_import_name(name, &found); - if (m) - return m; - - if(found==0) /* if its found but could not import then it has its own error */ - PyErr_Format(PyExc_ImportError, "Import of external Module %.20s not allowed.", name); - - return NULL; - -} - -PyObject *KXpy_reload(PyObject *self, PyObject *args) { - - /* Used to be sandboxed, bettet to allow importing of internal text only */ -#if 0 - PyErr_SetString(PyExc_RuntimeError, "Sandbox: reload() function disabled!\nGame Scripts should not use this function."); - return NULL; -#endif - int found; - PyObject *module = NULL; - PyObject *newmodule = NULL; - - /* check for a module arg */ - if( !PyArg_ParseTuple( args, "O:bpy_reload_meth", &module ) ) - return NULL; - - newmodule= bpy_text_reimport( module, &found ); - if (newmodule) - return newmodule; - - if (found==0) /* if its found but could not import then it has its own error */ - PyErr_SetString(PyExc_ImportError, "reload(module): failed to reload from blenders internal text"); - - return newmodule; -} - -/* override python file type functions */ -#if 0 -static int -file_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - KXpy_file(NULL, NULL); - return -1; -} - -static PyObject * -file_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - return KXpy_file(NULL, NULL); -} -#endif - -static PyMethodDef meth_open[] = {{ "open", KXpy_open, METH_VARARGS, "(disabled)"}}; -static PyMethodDef meth_reload[] = {{ "reload", KXpy_reload, METH_VARARGS, "(disabled)"}}; -static PyMethodDef meth_file[] = {{ "file", KXpy_file, METH_VARARGS, "(disabled)"}}; -static PyMethodDef meth_execfile[] = {{ "execfile", KXpy_execfile, METH_VARARGS, "(disabled)"}}; -static PyMethodDef meth_compile[] = {{ "compile", KXpy_compile, METH_VARARGS, "(disabled)"}}; - -static PyMethodDef meth_import[] = {{ "import", KXpy_import, METH_VARARGS, "our own import"}}; - -//static PyObject *g_oldopen = 0; -//static PyObject *g_oldimport = 0; -//static int g_security = 0; - -void setSandbox(TPythonSecurityLevel level) -{ - PyObject *m = PyImport_AddModule("__builtin__"); - PyObject *d = PyModule_GetDict(m); - PyObject *item; - switch (level) { - case psl_Highest: - //if (!g_security) { - //g_oldopen = PyDict_GetItemString(d, "open"); - - // functions we cant trust - PyDict_SetItemString(d, "open", item=PyCFunction_New(meth_open, NULL)); Py_DECREF(item); - PyDict_SetItemString(d, "reload", item=PyCFunction_New(meth_reload, NULL)); Py_DECREF(item); - PyDict_SetItemString(d, "file", item=PyCFunction_New(meth_file, NULL)); Py_DECREF(item); - PyDict_SetItemString(d, "execfile", item=PyCFunction_New(meth_execfile, NULL)); Py_DECREF(item); - PyDict_SetItemString(d, "compile", item=PyCFunction_New(meth_compile, NULL)); Py_DECREF(item); - - // our own import - PyDict_SetItemString(d, "__import__", PyCFunction_New(meth_import, NULL)); - //g_security = level; - - // Overiding file dosnt stop it being accessed if your sneaky - // f = [ t for t in (1).__class__.__mro__[-1].__subclasses__() if t.__name__ == 'file'][0]('/some_file.txt', 'w') - // f.write('...') - // so overwrite the file types functions. be very careful here still, since python uses python. - // ps - python devs frown deeply upon this. - - /* this could mess up pythons internals, if we are serious about sandboxing - * issues like the one above need to be solved, possibly modify __subclasses__ is safer? */ -#if 0 - PyFile_Type.tp_init = file_init; - PyFile_Type.tp_new = file_new; -#endif - //} - break; - /* - case psl_Lowest: - if (g_security) { - PyDict_SetItemString(d, "open", g_oldopen); - PyDict_SetItemString(d, "__import__", g_oldimport); - g_security = level; - } - */ - default: - /* Allow importing internal text, from bpy_internal_import.py */ - PyDict_SetItemString(d, "reload", item=PyCFunction_New(bpy_reload_meth, NULL)); Py_DECREF(item); - PyDict_SetItemString(d, "__import__", item=PyCFunction_New(bpy_import_meth, NULL)); Py_DECREF(item); - break; - } -} - -/* Explanation of - * - * - backupPySysObjects() : stores sys.path in gp_OrigPythonSysPath - * - initPySysObjects(main) : initializes the blendfile and library paths - * - restorePySysObjects() : restores sys.path from gp_OrigPythonSysPath - * - * These exist so the current blend dir "//" can always be used to import modules from. - * the reason we need a few functions for this is that python is not only used by the game engine - * so we cant just add to sys.path all the time, it would leave pythons state in a mess. - * It would also be incorrect since loading blend files for new levels etc would alwasy add to sys.path - * - * To play nice with blenders python, the sys.path is backed up and the current blendfile along - * with all its lib paths are added to the sys path. - * When loading a new blendfile, the original sys.path is restored and the new paths are added over the top. - */ - -/** - * So we can have external modules mixed with our blend files. - */ -static void backupPySysObjects(void) -{ - PyObject *sys_path= PySys_GetObject("path"); /* should never fail */ - PyObject *sys_mods= PySys_GetObject("modules"); /* should never fail */ - - /* paths */ - Py_XDECREF(gp_OrigPythonSysPath); /* just incase its set */ - gp_OrigPythonSysPath = PyList_GetSlice(sys_path, 0, INT_MAX); /* copy the list */ - - /* modules */ - Py_XDECREF(gp_OrigPythonSysModules); /* just incase its set */ - gp_OrigPythonSysModules = PyDict_Copy(sys_mods); /* copy the list */ - -} - -/* for initPySysObjects only, - * takes a blend path and adds a scripts dir from it - * - * "/home/me/foo.blend" -> "/home/me/scripts" - */ -static void initPySysObjects__append(PyObject *sys_path, char *filename) -{ - PyObject *item; - char expanded[FILE_MAXDIR + FILE_MAXFILE]; - - BLI_split_dirfile(filename, expanded, NULL); /* get the dir part of filename only */ - BLI_path_abs(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */ - BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */ - item= PyUnicode_FromString(expanded); - -// printf("SysPath - '%s', '%s', '%s'\n", expanded, filename, gp_GamePythonPath); - - if(PySequence_Index(sys_path, item) == -1) { - PyErr_Clear(); /* PySequence_Index sets a ValueError */ - PyList_Insert(sys_path, 0, item); - } - - Py_DECREF(item); -} -static void initPySysObjects(Main *maggie) -{ - PyObject *sys_path= PySys_GetObject("path"); /* should never fail */ - - if (gp_OrigPythonSysPath==NULL) { - /* backup */ - backupPySysObjects(); - } - else { - /* get the original sys path when the BGE started */ - PyList_SetSlice(sys_path, 0, INT_MAX, gp_OrigPythonSysPath); - } - - Library *lib= (Library *)maggie->library.first; - - while(lib) { - /* lib->name wont work in some cases (on win32), - * even when expanding with gp_GamePythonPath, using lib->filename is less trouble */ - initPySysObjects__append(sys_path, lib->filename); - lib= (Library *)lib->id.next; - } - - initPySysObjects__append(sys_path, gp_GamePythonPath); - -// fprintf(stderr, "\nNew Path: %d ", PyList_Size(sys_path)); -// PyObject_Print(sys_path, stderr, 0); -} - -static void restorePySysObjects(void) -{ - if (gp_OrigPythonSysPath==NULL) - return; - - PyObject *sys_path= PySys_GetObject("path"); /* should never fail */ - PyObject *sys_mods= PySys_GetObject("modules"); /* should never fail */ - - /* paths */ - PyList_SetSlice(sys_path, 0, INT_MAX, gp_OrigPythonSysPath); - Py_DECREF(gp_OrigPythonSysPath); - gp_OrigPythonSysPath= NULL; - - /* modules */ - PyDict_Clear(sys_mods); - PyDict_Update(sys_mods, gp_OrigPythonSysModules); - Py_DECREF(gp_OrigPythonSysModules); - gp_OrigPythonSysModules= NULL; - - -// fprintf(stderr, "\nRestore Path: %d ", PyList_Size(sys_path)); -// PyObject_Print(sys_path, stderr, 0); -} - -/** - * Python is not initialised. - */ -PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level, Main *maggie, int argc, char** argv) -{ - /* Yet another gotcha in the py api - * Cant run PySys_SetArgv more then once because this adds the - * binary dir to the sys.path each time. - * Id have thaught python being totally restarted would make this ok but - * somehow it remembers the sys.path - Campbell - */ - static bool first_time = true; - -#if 0 // TODO - py3 - STR_String pname = progname; - Py_SetProgramName(pname.Ptr()); -#endif - Py_NoSiteFlag=1; - Py_FrozenFlag=1; - Py_Initialize(); - - if(argv && first_time) { /* browser plugins dont currently set this */ - // Until python support ascii again, we use our own. - // PySys_SetArgv(argc, argv); - int i; - PyObject *py_argv= PyList_New(argc); - - for (i=0; iSetPyNamespace(dictionaryobject); - initRasterizer(ketsjiengine->GetRasterizer(), ketsjiengine->GetCanvas()); - *gameLogic = initGameLogic(ketsjiengine, startscene); - - /* is set in initGameLogic so only set here if we want it to persist between scenes */ - if(pyGlobalDict) - PyDict_SetItemString(PyModule_GetDict(*gameLogic), "globalDict", pyGlobalDict); // Same as importing the module. - - *gameLogic_keys = PyDict_Keys(PyModule_GetDict(*gameLogic)); - PyDict_SetItemString(dictionaryobject, "GameLogic", *gameLogic); // Same as importing the module. - - initGameKeys(); - initPythonConstraintBinding(); - initMathutils(); - initGeometry(); - initBGL(); - initBLF(); - -#ifdef WITH_FFMPEG - initVideoTexture(); -#endif - - /* could be done a lot more nicely, but for now a quick way to get bge.* working */ - PyRun_SimpleString("__import__('sys').modules['bge']=[mod for mod in (type(__builtins__)('bge'), ) if mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')}) is None][0]"); -} - -static struct PyModuleDef Rasterizer_module_def = { - {}, /* m_base */ - "Rasterizer", /* m_name */ - Rasterizer_module_documentation, /* m_doc */ - 0, /* m_size */ - rasterizer_methods, /* m_methods */ - 0, /* m_reload */ - 0, /* m_traverse */ - 0, /* m_clear */ - 0, /* m_free */ -}; - -PyObject* initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas) -{ - gp_Canvas = canvas; - gp_Rasterizer = rasty; - - - PyObject* m; - PyObject* d; - PyObject* item; - - /* Use existing module where possible - * be careful not to init any runtime vars after this */ - m = PyImport_ImportModule( "Rasterizer" ); - if(m) { - Py_DECREF(m); - return m; - } - else { - PyErr_Clear(); - - // Create the module and add the functions - m = PyModule_Create(&Rasterizer_module_def); - PyDict_SetItemString(PySys_GetObject("modules"), Rasterizer_module_def.m_name, m); - } - - // Add some symbolic constants to the module - d = PyModule_GetDict(m); - ErrorObject = PyUnicode_FromString("Rasterizer.error"); - PyDict_SetItemString(d, "error", ErrorObject); - Py_DECREF(ErrorObject); - - /* needed for get/setMaterialType */ - KX_MACRO_addTypesToDict(d, KX_TEXFACE_MATERIAL, KX_TEXFACE_MATERIAL); - KX_MACRO_addTypesToDict(d, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL); - KX_MACRO_addTypesToDict(d, KX_BLENDER_GLSL_MATERIAL, KX_BLENDER_GLSL_MATERIAL); - - // XXXX Add constants here - - // Check for errors - if (PyErr_Occurred()) - { - Py_FatalError("can't initialize module Rasterizer"); - } - - return d; -} - - - -/* ------------------------------------------------------------------------- */ -/* GameKeys: symbolic constants for key mapping */ -/* ------------------------------------------------------------------------- */ - -static char GameKeys_module_documentation[] = -"This modules provides defines for key-codes" -; - -static char gPyEventToString_doc[] = -"EventToString(event) - Take a valid event from the GameKeys module or Keyboard Sensor and return a name" -; - -static PyObject* gPyEventToString(PyObject*, PyObject* value) -{ - PyObject* mod, *dict, *key, *val, *ret = NULL; - Py_ssize_t pos = 0; - - mod = PyImport_ImportModule( "GameKeys" ); - if (!mod) - return NULL; - - dict = PyModule_GetDict(mod); - - while (PyDict_Next(dict, &pos, &key, &val)) { - if (PyObject_RichCompareBool(value, val, Py_EQ)) { - ret = key; - break; - } - } - - PyErr_Clear(); // incase there was an error clearing - Py_DECREF(mod); - if (!ret) PyErr_SetString(PyExc_ValueError, "GameKeys.EventToString(int): expected a valid int keyboard event"); - else Py_INCREF(ret); - - return ret; -} - -static char gPyEventToCharacter_doc[] = -"EventToCharacter(event, is_shift) - Take a valid event from the GameKeys module or Keyboard Sensor and return a character" -; - -static PyObject* gPyEventToCharacter(PyObject*, PyObject* args) -{ - int event, shift; - if (!PyArg_ParseTuple(args,"ii:EventToCharacter", &event, &shift)) - return NULL; - - if(IsPrintable(event)) { - char ch[2] = {'\0', '\0'}; - ch[0] = ToCharacter(event, (bool)shift); - return PyUnicode_FromString(ch); - } - else { - return PyUnicode_FromString(""); - } -} - - -static struct PyMethodDef gamekeys_methods[] = { - {"EventToCharacter", (PyCFunction)gPyEventToCharacter, METH_VARARGS, (const char *)gPyEventToCharacter_doc}, - {"EventToString", (PyCFunction)gPyEventToString, METH_O, (const char *)gPyEventToString_doc}, - { NULL, (PyCFunction) NULL, 0, NULL } -}; - -static struct PyModuleDef GameKeys_module_def = { - {}, /* m_base */ - "GameKeys", /* m_name */ - GameKeys_module_documentation, /* m_doc */ - 0, /* m_size */ - gamekeys_methods, /* m_methods */ - 0, /* m_reload */ - 0, /* m_traverse */ - 0, /* m_clear */ - 0, /* m_free */ -}; - -PyObject* initGameKeys() -{ - PyObject* m; - PyObject* d; - PyObject* item; - - /* Use existing module where possible */ - m = PyImport_ImportModule( "GameKeys" ); - if(m) { - Py_DECREF(m); - return m; - } - else { - PyErr_Clear(); - - // Create the module and add the functions - m = PyModule_Create(&GameKeys_module_def); - PyDict_SetItemString(PySys_GetObject("modules"), GameKeys_module_def.m_name, m); - } - - // Add some symbolic constants to the module - d = PyModule_GetDict(m); - - // XXXX Add constants here - - KX_MACRO_addTypesToDict(d, AKEY, SCA_IInputDevice::KX_AKEY); - KX_MACRO_addTypesToDict(d, BKEY, SCA_IInputDevice::KX_BKEY); - KX_MACRO_addTypesToDict(d, CKEY, SCA_IInputDevice::KX_CKEY); - KX_MACRO_addTypesToDict(d, DKEY, SCA_IInputDevice::KX_DKEY); - KX_MACRO_addTypesToDict(d, EKEY, SCA_IInputDevice::KX_EKEY); - KX_MACRO_addTypesToDict(d, FKEY, SCA_IInputDevice::KX_FKEY); - KX_MACRO_addTypesToDict(d, GKEY, SCA_IInputDevice::KX_GKEY); - KX_MACRO_addTypesToDict(d, HKEY, SCA_IInputDevice::KX_HKEY); - KX_MACRO_addTypesToDict(d, IKEY, SCA_IInputDevice::KX_IKEY); - KX_MACRO_addTypesToDict(d, JKEY, SCA_IInputDevice::KX_JKEY); - KX_MACRO_addTypesToDict(d, KKEY, SCA_IInputDevice::KX_KKEY); - KX_MACRO_addTypesToDict(d, LKEY, SCA_IInputDevice::KX_LKEY); - KX_MACRO_addTypesToDict(d, MKEY, SCA_IInputDevice::KX_MKEY); - KX_MACRO_addTypesToDict(d, NKEY, SCA_IInputDevice::KX_NKEY); - KX_MACRO_addTypesToDict(d, OKEY, SCA_IInputDevice::KX_OKEY); - KX_MACRO_addTypesToDict(d, PKEY, SCA_IInputDevice::KX_PKEY); - KX_MACRO_addTypesToDict(d, QKEY, SCA_IInputDevice::KX_QKEY); - KX_MACRO_addTypesToDict(d, RKEY, SCA_IInputDevice::KX_RKEY); - KX_MACRO_addTypesToDict(d, SKEY, SCA_IInputDevice::KX_SKEY); - KX_MACRO_addTypesToDict(d, TKEY, SCA_IInputDevice::KX_TKEY); - KX_MACRO_addTypesToDict(d, UKEY, SCA_IInputDevice::KX_UKEY); - KX_MACRO_addTypesToDict(d, VKEY, SCA_IInputDevice::KX_VKEY); - KX_MACRO_addTypesToDict(d, WKEY, SCA_IInputDevice::KX_WKEY); - KX_MACRO_addTypesToDict(d, XKEY, SCA_IInputDevice::KX_XKEY); - KX_MACRO_addTypesToDict(d, YKEY, SCA_IInputDevice::KX_YKEY); - KX_MACRO_addTypesToDict(d, ZKEY, SCA_IInputDevice::KX_ZKEY); - - KX_MACRO_addTypesToDict(d, ZEROKEY, SCA_IInputDevice::KX_ZEROKEY); - KX_MACRO_addTypesToDict(d, ONEKEY, SCA_IInputDevice::KX_ONEKEY); - KX_MACRO_addTypesToDict(d, TWOKEY, SCA_IInputDevice::KX_TWOKEY); - KX_MACRO_addTypesToDict(d, THREEKEY, SCA_IInputDevice::KX_THREEKEY); - KX_MACRO_addTypesToDict(d, FOURKEY, SCA_IInputDevice::KX_FOURKEY); - KX_MACRO_addTypesToDict(d, FIVEKEY, SCA_IInputDevice::KX_FIVEKEY); - KX_MACRO_addTypesToDict(d, SIXKEY, SCA_IInputDevice::KX_SIXKEY); - KX_MACRO_addTypesToDict(d, SEVENKEY, SCA_IInputDevice::KX_SEVENKEY); - KX_MACRO_addTypesToDict(d, EIGHTKEY, SCA_IInputDevice::KX_EIGHTKEY); - KX_MACRO_addTypesToDict(d, NINEKEY, SCA_IInputDevice::KX_NINEKEY); - - KX_MACRO_addTypesToDict(d, CAPSLOCKKEY, SCA_IInputDevice::KX_CAPSLOCKKEY); - - KX_MACRO_addTypesToDict(d, LEFTCTRLKEY, SCA_IInputDevice::KX_LEFTCTRLKEY); - KX_MACRO_addTypesToDict(d, LEFTALTKEY, SCA_IInputDevice::KX_LEFTALTKEY); - KX_MACRO_addTypesToDict(d, RIGHTALTKEY, SCA_IInputDevice::KX_RIGHTALTKEY); - KX_MACRO_addTypesToDict(d, RIGHTCTRLKEY, SCA_IInputDevice::KX_RIGHTCTRLKEY); - KX_MACRO_addTypesToDict(d, RIGHTSHIFTKEY, SCA_IInputDevice::KX_RIGHTSHIFTKEY); - KX_MACRO_addTypesToDict(d, LEFTSHIFTKEY, SCA_IInputDevice::KX_LEFTSHIFTKEY); - - KX_MACRO_addTypesToDict(d, ESCKEY, SCA_IInputDevice::KX_ESCKEY); - KX_MACRO_addTypesToDict(d, TABKEY, SCA_IInputDevice::KX_TABKEY); - KX_MACRO_addTypesToDict(d, RETKEY, SCA_IInputDevice::KX_RETKEY); - KX_MACRO_addTypesToDict(d, SPACEKEY, SCA_IInputDevice::KX_SPACEKEY); - KX_MACRO_addTypesToDict(d, LINEFEEDKEY, SCA_IInputDevice::KX_LINEFEEDKEY); - KX_MACRO_addTypesToDict(d, BACKSPACEKEY, SCA_IInputDevice::KX_BACKSPACEKEY); - KX_MACRO_addTypesToDict(d, DELKEY, SCA_IInputDevice::KX_DELKEY); - KX_MACRO_addTypesToDict(d, SEMICOLONKEY, SCA_IInputDevice::KX_SEMICOLONKEY); - KX_MACRO_addTypesToDict(d, PERIODKEY, SCA_IInputDevice::KX_PERIODKEY); - KX_MACRO_addTypesToDict(d, COMMAKEY, SCA_IInputDevice::KX_COMMAKEY); - KX_MACRO_addTypesToDict(d, QUOTEKEY, SCA_IInputDevice::KX_QUOTEKEY); - KX_MACRO_addTypesToDict(d, ACCENTGRAVEKEY, SCA_IInputDevice::KX_ACCENTGRAVEKEY); - KX_MACRO_addTypesToDict(d, MINUSKEY, SCA_IInputDevice::KX_MINUSKEY); - KX_MACRO_addTypesToDict(d, SLASHKEY, SCA_IInputDevice::KX_SLASHKEY); - KX_MACRO_addTypesToDict(d, BACKSLASHKEY, SCA_IInputDevice::KX_BACKSLASHKEY); - KX_MACRO_addTypesToDict(d, EQUALKEY, SCA_IInputDevice::KX_EQUALKEY); - KX_MACRO_addTypesToDict(d, LEFTBRACKETKEY, SCA_IInputDevice::KX_LEFTBRACKETKEY); - KX_MACRO_addTypesToDict(d, RIGHTBRACKETKEY, SCA_IInputDevice::KX_RIGHTBRACKETKEY); - - KX_MACRO_addTypesToDict(d, LEFTARROWKEY, SCA_IInputDevice::KX_LEFTARROWKEY); - KX_MACRO_addTypesToDict(d, DOWNARROWKEY, SCA_IInputDevice::KX_DOWNARROWKEY); - KX_MACRO_addTypesToDict(d, RIGHTARROWKEY, SCA_IInputDevice::KX_RIGHTARROWKEY); - KX_MACRO_addTypesToDict(d, UPARROWKEY, SCA_IInputDevice::KX_UPARROWKEY); - - KX_MACRO_addTypesToDict(d, PAD2 , SCA_IInputDevice::KX_PAD2); - KX_MACRO_addTypesToDict(d, PAD4 , SCA_IInputDevice::KX_PAD4); - KX_MACRO_addTypesToDict(d, PAD6 , SCA_IInputDevice::KX_PAD6); - KX_MACRO_addTypesToDict(d, PAD8 , SCA_IInputDevice::KX_PAD8); - - KX_MACRO_addTypesToDict(d, PAD1 , SCA_IInputDevice::KX_PAD1); - KX_MACRO_addTypesToDict(d, PAD3 , SCA_IInputDevice::KX_PAD3); - KX_MACRO_addTypesToDict(d, PAD5 , SCA_IInputDevice::KX_PAD5); - KX_MACRO_addTypesToDict(d, PAD7 , SCA_IInputDevice::KX_PAD7); - KX_MACRO_addTypesToDict(d, PAD9 , SCA_IInputDevice::KX_PAD9); - - KX_MACRO_addTypesToDict(d, PADPERIOD, SCA_IInputDevice::KX_PADPERIOD); - KX_MACRO_addTypesToDict(d, PADSLASHKEY, SCA_IInputDevice::KX_PADSLASHKEY); - KX_MACRO_addTypesToDict(d, PADASTERKEY, SCA_IInputDevice::KX_PADASTERKEY); - - - KX_MACRO_addTypesToDict(d, PAD0, SCA_IInputDevice::KX_PAD0); - KX_MACRO_addTypesToDict(d, PADMINUS, SCA_IInputDevice::KX_PADMINUS); - KX_MACRO_addTypesToDict(d, PADENTER, SCA_IInputDevice::KX_PADENTER); - KX_MACRO_addTypesToDict(d, PADPLUSKEY, SCA_IInputDevice::KX_PADPLUSKEY); - - - KX_MACRO_addTypesToDict(d, F1KEY , SCA_IInputDevice::KX_F1KEY); - KX_MACRO_addTypesToDict(d, F2KEY , SCA_IInputDevice::KX_F2KEY); - KX_MACRO_addTypesToDict(d, F3KEY , SCA_IInputDevice::KX_F3KEY); - KX_MACRO_addTypesToDict(d, F4KEY , SCA_IInputDevice::KX_F4KEY); - KX_MACRO_addTypesToDict(d, F5KEY , SCA_IInputDevice::KX_F5KEY); - KX_MACRO_addTypesToDict(d, F6KEY , SCA_IInputDevice::KX_F6KEY); - KX_MACRO_addTypesToDict(d, F7KEY , SCA_IInputDevice::KX_F7KEY); - KX_MACRO_addTypesToDict(d, F8KEY , SCA_IInputDevice::KX_F8KEY); - KX_MACRO_addTypesToDict(d, F9KEY , SCA_IInputDevice::KX_F9KEY); - KX_MACRO_addTypesToDict(d, F10KEY, SCA_IInputDevice::KX_F10KEY); - KX_MACRO_addTypesToDict(d, F11KEY, SCA_IInputDevice::KX_F11KEY); - KX_MACRO_addTypesToDict(d, F12KEY, SCA_IInputDevice::KX_F12KEY); - KX_MACRO_addTypesToDict(d, F13KEY, SCA_IInputDevice::KX_F13KEY); - KX_MACRO_addTypesToDict(d, F14KEY, SCA_IInputDevice::KX_F14KEY); - KX_MACRO_addTypesToDict(d, F15KEY, SCA_IInputDevice::KX_F15KEY); - KX_MACRO_addTypesToDict(d, F16KEY, SCA_IInputDevice::KX_F16KEY); - KX_MACRO_addTypesToDict(d, F17KEY, SCA_IInputDevice::KX_F17KEY); - KX_MACRO_addTypesToDict(d, F18KEY, SCA_IInputDevice::KX_F18KEY); - KX_MACRO_addTypesToDict(d, F19KEY, SCA_IInputDevice::KX_F19KEY); - - KX_MACRO_addTypesToDict(d, PAUSEKEY, SCA_IInputDevice::KX_PAUSEKEY); - KX_MACRO_addTypesToDict(d, INSERTKEY, SCA_IInputDevice::KX_INSERTKEY); - KX_MACRO_addTypesToDict(d, HOMEKEY , SCA_IInputDevice::KX_HOMEKEY); - KX_MACRO_addTypesToDict(d, PAGEUPKEY, SCA_IInputDevice::KX_PAGEUPKEY); - KX_MACRO_addTypesToDict(d, PAGEDOWNKEY, SCA_IInputDevice::KX_PAGEDOWNKEY); - KX_MACRO_addTypesToDict(d, ENDKEY, SCA_IInputDevice::KX_ENDKEY); - - // MOUSE - KX_MACRO_addTypesToDict(d, LEFTMOUSE, SCA_IInputDevice::KX_LEFTMOUSE); - KX_MACRO_addTypesToDict(d, MIDDLEMOUSE, SCA_IInputDevice::KX_MIDDLEMOUSE); - KX_MACRO_addTypesToDict(d, RIGHTMOUSE, SCA_IInputDevice::KX_RIGHTMOUSE); - KX_MACRO_addTypesToDict(d, WHEELUPMOUSE, SCA_IInputDevice::KX_WHEELUPMOUSE); - KX_MACRO_addTypesToDict(d, WHEELDOWNMOUSE, SCA_IInputDevice::KX_WHEELDOWNMOUSE); - KX_MACRO_addTypesToDict(d, MOUSEX, SCA_IInputDevice::KX_MOUSEX); - KX_MACRO_addTypesToDict(d, MOUSEY, SCA_IInputDevice::KX_MOUSEY); - - // Check for errors - if (PyErr_Occurred()) - { - Py_FatalError("can't initialize module GameKeys"); - } - - return d; -} - -PyObject* initMathutils() -{ - return Mathutils_Init(); -} - -PyObject* initGeometry() -{ - return Geometry_Init(); -} - -PyObject* initBGL() -{ - return BGL_Init(); -} - -PyObject* initBLF() -{ - return BLF_Init(); -} - -// utility function for loading and saving the globalDict -int saveGamePythonConfig( char **marshal_buffer) -{ - int marshal_length = 0; - PyObject* gameLogic = PyImport_ImportModule("GameLogic"); - if (gameLogic) { - PyObject* pyGlobalDict = PyDict_GetItemString(PyModule_GetDict(gameLogic), "globalDict"); // Same as importing the module - if (pyGlobalDict) { -#ifdef Py_MARSHAL_VERSION - PyObject* pyGlobalDictMarshal = PyMarshal_WriteObjectToString( pyGlobalDict, 2); // Py_MARSHAL_VERSION == 2 as of Py2.5 -#else - PyObject* pyGlobalDictMarshal = PyMarshal_WriteObjectToString( pyGlobalDict ); -#endif - if (pyGlobalDictMarshal) { - // for testing only - // PyObject_Print(pyGlobalDictMarshal, stderr, 0); - char *marshal_cstring; - - marshal_cstring = PyBytes_AsString(pyGlobalDictMarshal); // py3 uses byte arrays - marshal_length= PyBytes_Size(pyGlobalDictMarshal); - *marshal_buffer = new char[marshal_length + 1]; - memcpy(*marshal_buffer, marshal_cstring, marshal_length); - Py_DECREF(pyGlobalDictMarshal); - } else { - printf("Error, GameLogic.globalDict could not be marshal'd\n"); - } - } else { - printf("Error, GameLogic.globalDict was removed\n"); - } - Py_DECREF(gameLogic); - } else { - PyErr_Clear(); - printf("Error, GameLogic failed to import GameLogic.globalDict will be lost\n"); - } - return marshal_length; -} - -int loadGamePythonConfig(char *marshal_buffer, int marshal_length) -{ - /* Restore the dict */ - if (marshal_buffer) { - PyObject* gameLogic = PyImport_ImportModule("GameLogic"); - - if (gameLogic) { - PyObject* pyGlobalDict = PyMarshal_ReadObjectFromString(marshal_buffer, marshal_length); - if (pyGlobalDict) { - PyObject* pyGlobalDict_orig = PyDict_GetItemString(PyModule_GetDict(gameLogic), "globalDict"); // Same as importing the module. - if (pyGlobalDict_orig) { - PyDict_Clear(pyGlobalDict_orig); - PyDict_Update(pyGlobalDict_orig, pyGlobalDict); - } else { - /* this should not happen, but cant find the original globalDict, just assign it then */ - PyDict_SetItemString(PyModule_GetDict(gameLogic), "globalDict", pyGlobalDict); // Same as importing the module. - } - Py_DECREF(gameLogic); - Py_DECREF(pyGlobalDict); - return 1; - } else { - Py_DECREF(gameLogic); - PyErr_Clear(); - printf("Error could not marshall string\n"); - } - } else { - PyErr_Clear(); - printf("Error, GameLogic failed to import GameLogic.globalDict will be lost\n"); - } - } - return 0; -} - -void pathGamePythonConfig( char *path ) -{ - int len = strlen(gp_GamePythonPathOrig); // Always use the first loaded blend filename - - BLI_strncpy(path, gp_GamePythonPathOrig, sizeof(gp_GamePythonPathOrig)); - - /* replace extension */ - if (BLI_testextensie(path, ".blend")) { - strcpy(path+(len-6), ".bgeconf"); - } else { - strcpy(path+len, ".bgeconf"); - } -} - -void setGamePythonPath(char *path) -{ - BLI_strncpy(gp_GamePythonPath, path, sizeof(gp_GamePythonPath)); - BLI_cleanup_file(NULL, gp_GamePythonPath); /* not absolutely needed but makes resolving path problems less confusing later */ - - if (gp_GamePythonPathOrig[0] == '\0') - BLI_strncpy(gp_GamePythonPathOrig, path, sizeof(gp_GamePythonPathOrig)); -} - -// we need this so while blender is open (not blenderplayer) -// loading new blendfiles will reset this on starting the -// engine but loading blend files within the BGE wont overwrite gp_GamePythonPathOrig -void resetGamePythonPath() -{ - gp_GamePythonPathOrig[0] = '\0'; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h deleted file mode 100644 index fb59a2f21eb..00000000000 --- a/source/gameengine/Ketsji/KX_PythonInit.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_PYTHON_INIT -#define __KX_PYTHON_INIT - -#include "KX_Python.h" -#include "STR_String.h" - -typedef enum { - psl_Lowest = 0, - psl_Highest -} TPythonSecurityLevel; - -extern bool gUseVisibilityTemp; - -#ifndef DISABLE_PYTHON -PyObject* initGameLogic(class KX_KetsjiEngine *engine, class KX_Scene* ketsjiscene); -PyObject* initGameKeys(); -PyObject* initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* canvas); -PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie, int argc, char** argv); -PyObject* initMathutils(); -PyObject* initGeometry(); -PyObject* initBGL(); -PyObject* initBLF(); -PyObject* initVideoTexture(void); -void exitGamePlayerPythonScripting(); -PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLevel level, struct Main *maggie); -void exitGamePythonScripting(); - -void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *blenderdata, PyObject *pyGlobalDict, PyObject **gameLogic, PyObject **gameLogic_keys, int argc, char** argv); - -void setGamePythonPath(char *path); -void resetGamePythonPath(); -void pathGamePythonConfig( char *path ); -int saveGamePythonConfig( char **marshal_buffer); -int loadGamePythonConfig(char *marshal_buffer, int marshal_length); -#endif - -class KX_KetsjiEngine; -class KX_Scene; - -void KX_SetActiveScene(class KX_Scene* scene); -class KX_Scene* KX_GetActiveScene(); -class KX_KetsjiEngine* KX_GetActiveEngine(); -#include "MT_Vector3.h" - -void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color); - -#endif //__KX_PYTHON_INIT - diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp deleted file mode 100644 index 6b9d7a2cccf..00000000000 --- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): Campbell Barton - * - * ***** END GPL LICENSE BLOCK ***** - */ - - - -#ifndef _adr_py_init_types_h_ // only process once, -#define _adr_py_init_types_h_ // even if multiply included - -#ifndef DISABLE_PYTHON - -/* Only for Class::Parents */ -#include "BL_BlenderShader.h" -#include "BL_ShapeActionActuator.h" -#include "BL_ArmatureActuator.h" -#include "BL_ArmatureConstraint.h" -#include "BL_ArmatureObject.h" -#include "BL_ArmatureChannel.h" -#include "KX_BlenderMaterial.h" -#include "KX_CameraActuator.h" -#include "KX_ConstraintActuator.h" -#include "KX_ConstraintWrapper.h" -#include "KX_GameActuator.h" -#include "KX_Light.h" -#include "KX_MeshProxy.h" -#include "KX_MouseFocusSensor.h" -#include "KX_NetworkMessageActuator.h" -#include "KX_NetworkMessageSensor.h" -#include "KX_ObjectActuator.h" -#include "KX_ParentActuator.h" -#include "KX_PhysicsObjectWrapper.h" -#include "KX_PolyProxy.h" -#include "KX_PolygonMaterial.h" -#include "KX_PythonSeq.h" -#include "KX_SCA_AddObjectActuator.h" -#include "KX_SCA_EndObjectActuator.h" -#include "KX_SCA_ReplaceMeshActuator.h" -#include "KX_SceneActuator.h" -#include "KX_StateActuator.h" -#include "KX_TrackToActuator.h" -#include "KX_VehicleWrapper.h" -#include "KX_VertexProxy.h" -#include "SCA_2DFilterActuator.h" -#include "SCA_ANDController.h" -#include "SCA_ActuatorSensor.h" -#include "SCA_AlwaysSensor.h" -#include "SCA_DelaySensor.h" -#include "SCA_JoystickSensor.h" -#include "SCA_KeyboardSensor.h" -#include "SCA_MouseSensor.h" -#include "SCA_NANDController.h" -#include "SCA_NORController.h" -#include "SCA_ORController.h" -#include "SCA_RandomSensor.h" -#include "SCA_XNORController.h" -#include "SCA_XORController.h" -#include "SCA_PythonKeyboard.h" -#include "SCA_PythonMouse.h" -#include "KX_IpoActuator.h" -#include "KX_NearSensor.h" -#include "KX_RadarSensor.h" -#include "KX_RaySensor.h" -#include "KX_SCA_DynamicActuator.h" -#include "KX_SoundActuator.h" -#include "KX_TouchSensor.h" -#include "KX_VisibilityActuator.h" -#include "SCA_PropertySensor.h" -#include "SCA_PythonController.h" -#include "SCA_RandomActuator.h" -#include "SCA_IController.h" - -static void PyType_Attr_Set(PyGetSetDef *attr_getset, PyAttributeDef *attr) -{ - attr_getset->name= (char *)attr->m_name; - attr_getset->doc= NULL; - - attr_getset->get= reinterpret_cast(PyObjectPlus::py_get_attrdef); - - if(attr->m_access==KX_PYATTRIBUTE_RO) - attr_getset->set= NULL; - else - attr_getset->set= reinterpret_cast(PyObjectPlus::py_set_attrdef); - - attr_getset->closure= reinterpret_cast(attr); -} - -static void PyType_Ready_ADD(PyObject *dict, PyTypeObject *tp, PyAttributeDef *attributes, PyAttributeDef *attributesPtr, int init_getset) -{ - PyAttributeDef *attr; - - if(init_getset) { - /* we need to do this for all types before calling PyType_Ready - * since they will call the parents PyType_Ready and those might not have initialized vars yet */ - - //if(tp->tp_base==NULL) - // printf("Debug: No Parents - '%s'\n" , tp->tp_name); - - if(tp->tp_getset==NULL && ((attributes && attributes->m_name) || (attributesPtr && attributesPtr->m_name))) { - PyGetSetDef *attr_getset; - int attr_tot= 0; - - if (attributes) { - for(attr= attributes; attr->m_name; attr++, attr_tot++) - attr->m_usePtr = false; - } - if (attributesPtr) { - for(attr= attributesPtr; attr->m_name; attr++, attr_tot++) - attr->m_usePtr = true; - } - - tp->tp_getset = attr_getset = reinterpret_cast(PyMem_Malloc((attr_tot+1) * sizeof(PyGetSetDef))); // XXX - Todo, free - - if (attributes) { - for(attr= attributes; attr->m_name; attr++, attr_getset++) { - PyType_Attr_Set(attr_getset, attr); - } - } - if (attributesPtr) { - for(attr= attributesPtr; attr->m_name; attr++, attr_getset++) { - PyType_Attr_Set(attr_getset, attr); - } - } - memset(attr_getset, 0, sizeof(PyGetSetDef)); - } - } else { - PyType_Ready(tp); - PyDict_SetItemString(dict, tp->tp_name, reinterpret_cast(tp)); - } - -} - - -#define PyType_Ready_Attr(d, n, i) PyType_Ready_ADD(d, &n::Type, n::Attributes, NULL, i) -#define PyType_Ready_AttrPtr(d, n, i) PyType_Ready_ADD(d, &n::Type, n::Attributes, n::AttributesPtr, i) - -void initPyTypes(void) -{ - -/* - initPyObjectPlusType(BL_ActionActuator::Parents); - ..... -*/ - - /* For now just do PyType_Ready */ - PyObject *mod= PyModule_New("GameTypes"); - PyObject *dict= PyModule_GetDict(mod); - PyDict_SetItemString(PySys_GetObject((char *)"modules"), (char *)"GameTypes", mod); - Py_DECREF(mod); - - - for(int init_getset= 1; init_getset > -1; init_getset--) { /* run twice, once to init the getsets another to run PyType_Ready */ - PyType_Ready_Attr(dict, BL_ActionActuator, init_getset); - PyType_Ready_Attr(dict, BL_Shader, init_getset); - PyType_Ready_Attr(dict, BL_ShapeActionActuator, init_getset); - PyType_Ready_Attr(dict, BL_ArmatureObject, init_getset); - PyType_Ready_Attr(dict, BL_ArmatureActuator, init_getset); - PyType_Ready_Attr(dict, BL_ArmatureConstraint, init_getset); - PyType_Ready_AttrPtr(dict, BL_ArmatureBone, init_getset); - PyType_Ready_AttrPtr(dict, BL_ArmatureChannel, init_getset); - PyType_Ready_Attr(dict, CListValue, init_getset); - PyType_Ready_Attr(dict, CValue, init_getset); - PyType_Ready_Attr(dict, KX_BlenderMaterial, init_getset); - PyType_Ready_Attr(dict, KX_Camera, init_getset); - PyType_Ready_Attr(dict, KX_CameraActuator, init_getset); - PyType_Ready_Attr(dict, KX_ConstraintActuator, init_getset); - PyType_Ready_Attr(dict, KX_ConstraintWrapper, init_getset); - PyType_Ready_Attr(dict, KX_GameActuator, init_getset); - PyType_Ready_Attr(dict, KX_GameObject, init_getset); - PyType_Ready_Attr(dict, KX_IpoActuator, init_getset); - PyType_Ready_Attr(dict, KX_LightObject, init_getset); - PyType_Ready_Attr(dict, KX_MeshProxy, init_getset); - PyType_Ready_Attr(dict, KX_MouseFocusSensor, init_getset); - PyType_Ready_Attr(dict, KX_NearSensor, init_getset); - PyType_Ready_Attr(dict, KX_NetworkMessageActuator, init_getset); - PyType_Ready_Attr(dict, KX_NetworkMessageSensor, init_getset); - PyType_Ready_Attr(dict, KX_ObjectActuator, init_getset); - PyType_Ready_Attr(dict, KX_ParentActuator, init_getset); - PyType_Ready_Attr(dict, KX_PhysicsObjectWrapper, init_getset); - PyType_Ready_Attr(dict, KX_PolyProxy, init_getset); - PyType_Ready_Attr(dict, KX_PolygonMaterial, init_getset); - PyType_Ready_Attr(dict, KX_RadarSensor, init_getset); - PyType_Ready_Attr(dict, KX_RaySensor, init_getset); - PyType_Ready_Attr(dict, KX_SCA_AddObjectActuator, init_getset); - PyType_Ready_Attr(dict, KX_SCA_DynamicActuator, init_getset); - PyType_Ready_Attr(dict, KX_SCA_EndObjectActuator, init_getset); - PyType_Ready_Attr(dict, KX_SCA_ReplaceMeshActuator, init_getset); - PyType_Ready_Attr(dict, KX_Scene, init_getset); - PyType_Ready_Attr(dict, KX_SceneActuator, init_getset); - PyType_Ready_Attr(dict, KX_SoundActuator, init_getset); - PyType_Ready_Attr(dict, KX_StateActuator, init_getset); - PyType_Ready_Attr(dict, KX_TouchSensor, init_getset); - PyType_Ready_Attr(dict, KX_TrackToActuator, init_getset); - PyType_Ready_Attr(dict, KX_VehicleWrapper, init_getset); - PyType_Ready_Attr(dict, KX_VertexProxy, init_getset); - PyType_Ready_Attr(dict, KX_VisibilityActuator, init_getset); - PyType_Ready_Attr(dict, PyObjectPlus, init_getset); - PyType_Ready_Attr(dict, SCA_2DFilterActuator, init_getset); - PyType_Ready_Attr(dict, SCA_ANDController, init_getset); - PyType_Ready_Attr(dict, SCA_ActuatorSensor, init_getset); - PyType_Ready_Attr(dict, SCA_AlwaysSensor, init_getset); - PyType_Ready_Attr(dict, SCA_DelaySensor, init_getset); - PyType_Ready_Attr(dict, SCA_ILogicBrick, init_getset); - PyType_Ready_Attr(dict, SCA_IObject, init_getset); - PyType_Ready_Attr(dict, SCA_ISensor, init_getset); - PyType_Ready_Attr(dict, SCA_JoystickSensor, init_getset); - PyType_Ready_Attr(dict, SCA_KeyboardSensor, init_getset); - PyType_Ready_Attr(dict, SCA_MouseSensor, init_getset); - PyType_Ready_Attr(dict, SCA_NANDController, init_getset); - PyType_Ready_Attr(dict, SCA_NORController, init_getset); - PyType_Ready_Attr(dict, SCA_ORController, init_getset); - PyType_Ready_Attr(dict, SCA_PropertyActuator, init_getset); - PyType_Ready_Attr(dict, SCA_PropertySensor, init_getset); - PyType_Ready_Attr(dict, SCA_PythonController, init_getset); - PyType_Ready_Attr(dict, SCA_RandomActuator, init_getset); - PyType_Ready_Attr(dict, SCA_RandomSensor, init_getset); - PyType_Ready_Attr(dict, SCA_XNORController, init_getset); - PyType_Ready_Attr(dict, SCA_XORController, init_getset); - PyType_Ready_Attr(dict, SCA_IController, init_getset); - PyType_Ready_Attr(dict, SCA_PythonKeyboard, init_getset); - PyType_Ready_Attr(dict, SCA_PythonMouse, init_getset); - } - - - /* Normal python type */ - PyType_Ready(&KX_PythonSeq_Type); - -#ifdef USE_MATHUTILS - /* Init mathutils callbacks */ - KX_GameObject_Mathutils_Callback_Init(); - KX_ObjectActuator_Mathutils_Callback_Init(); -#endif -} - -#endif // DISABLE_PYTHON - -#endif diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.h b/source/gameengine/Ketsji/KX_PythonInitTypes.h deleted file mode 100644 index c16fafedf93..00000000000 --- a/source/gameengine/Ketsji/KX_PythonInitTypes.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): Campbell Barton - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef _adr_py_init_types_h_ // only process once, -#define _adr_py_init_types_h_ // even if multiply included - -#ifndef DISABLE_PYTHON -void initPyTypes(void); -#endif - -#endif diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp deleted file mode 100644 index 8ffd58a781b..00000000000 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ /dev/null @@ -1,515 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: none of this file. - * - * Contributor(s): Campbell Barton - * - * ***** END GPL LICENSE BLOCK ***** - * Readonly sequence wrapper for lookups on logic bricks - */ - -#ifndef DISABLE_PYTHON - -#include "KX_PythonSeq.h" -#include "KX_GameObject.h" -#include "BL_ArmatureObject.h" -#include "SCA_ISensor.h" -#include "SCA_IController.h" -#include "SCA_IActuator.h" - - -PyObject *KX_PythonSeq_CreatePyObject( PyObject *base, short type ) -{ - KX_PythonSeq *seq = PyObject_NEW( KX_PythonSeq, &KX_PythonSeq_Type); - seq->base = base; - Py_INCREF(base); /* so we can always access to check if its valid */ - seq->type = type; - seq->iter = -1; /* init */ - return (PyObject *)seq; - } - - static void KX_PythonSeq_dealloc( KX_PythonSeq * self ) -{ - Py_DECREF(self->base); - PyObject_DEL( self ); -} - -static Py_ssize_t KX_PythonSeq_len( PyObject * self ) -{ - PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); - - if(self_plus==NULL) { - PyErr_SetString(PyExc_SystemError, "len(seq): "BGE_PROXY_ERROR_MSG); - return -1; - } - - switch(((KX_PythonSeq *)self)->type) { - case KX_PYGENSEQ_CONT_TYPE_SENSORS: - return ((SCA_IController *)self_plus)->GetLinkedSensors().size(); - case KX_PYGENSEQ_CONT_TYPE_ACTUATORS: - return ((SCA_IController *)self_plus)->GetLinkedActuators().size(); - case KX_PYGENSEQ_OB_TYPE_SENSORS: - return ((KX_GameObject *)self_plus)->GetSensors().size(); - case KX_PYGENSEQ_OB_TYPE_CONTROLLERS: - return ((KX_GameObject *)self_plus)->GetControllers().size(); - case KX_PYGENSEQ_OB_TYPE_ACTUATORS: - return ((KX_GameObject *)self_plus)->GetActuators().size(); - case KX_PYGENSEQ_OB_TYPE_CONSTRAINTS: - return ((BL_ArmatureObject *)self_plus)->GetConstraintNumber(); - case KX_PYGENSEQ_OB_TYPE_CHANNELS: - return ((BL_ArmatureObject *)self_plus)->GetChannelNumber(); - default: - /* Should never happen */ - PyErr_SetString(PyExc_SystemError, "invalid type, internal error"); - return -1; - } -} - -static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) -{ - PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); - - if(self_plus==NULL) { - PyErr_SetString(PyExc_SystemError, "val = seq[i]: "BGE_PROXY_ERROR_MSG); - return NULL; - } - - switch(((KX_PythonSeq *)self)->type) { - case KX_PYGENSEQ_CONT_TYPE_SENSORS: - { - vector& linkedsensors = ((SCA_IController *)self_plus)->GetLinkedSensors(); - if(index<0) index += linkedsensors.size(); - if(index<0 || index>= linkedsensors.size()) { - PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); - return NULL; - } - return linkedsensors[index]->GetProxy(); - } - case KX_PYGENSEQ_CONT_TYPE_ACTUATORS: - { - vector& linkedactuators = ((SCA_IController *)self_plus)->GetLinkedActuators(); - if(index<0) index += linkedactuators.size(); - if(index<0 || index>= linkedactuators.size()) { - PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); - return NULL; - } - return linkedactuators[index]->GetProxy(); - } - case KX_PYGENSEQ_OB_TYPE_SENSORS: - { - SCA_SensorList& linkedsensors= ((KX_GameObject *)self_plus)->GetSensors(); - if(index<0) index += linkedsensors.size(); - if(index<0 || index>= linkedsensors.size()) { - PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); - return NULL; - } - return linkedsensors[index]->GetProxy(); - } - case KX_PYGENSEQ_OB_TYPE_CONTROLLERS: - { - SCA_ControllerList& linkedcontrollers= ((KX_GameObject *)self_plus)->GetControllers(); - if(index<0) index += linkedcontrollers.size(); - if(index<0 || index>= linkedcontrollers.size()) { - PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); - return NULL; - } - return linkedcontrollers[index]->GetProxy(); - } - case KX_PYGENSEQ_OB_TYPE_ACTUATORS: - { - SCA_ActuatorList& linkedactuators= ((KX_GameObject *)self_plus)->GetActuators(); - if(index<0) index += linkedactuators.size(); - if(index<0 || index>= linkedactuators.size()) { - PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); - return NULL; - } - return linkedactuators[index]->GetProxy(); - } - case KX_PYGENSEQ_OB_TYPE_CONSTRAINTS: - { - int nb_constraint = ((BL_ArmatureObject *)self_plus)->GetConstraintNumber(); - if(index<0) - index += nb_constraint; - if(index<0 || index>= nb_constraint) { - PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); - return NULL; - } - return ((BL_ArmatureObject *)self_plus)->GetConstraint(index)->GetProxy(); - } - case KX_PYGENSEQ_OB_TYPE_CHANNELS: - { - int nb_channel = ((BL_ArmatureObject *)self_plus)->GetChannelNumber(); - if(index<0) - index += nb_channel; - if(index<0 || index>= nb_channel) { - PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range"); - return NULL; - } - return ((BL_ArmatureObject *)self_plus)->GetChannel(index)->GetProxy(); - } - - } - - PyErr_SetString(PyExc_SystemError, "invalid sequence type, this is a bug"); - return NULL; -} - -static PyObjectPlus * KX_PythonSeq_subscript__internal(PyObject *self, char *key) -{ - PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); - - switch(((KX_PythonSeq *)self)->type) { - case KX_PYGENSEQ_CONT_TYPE_SENSORS: - { - vector& linkedsensors = ((SCA_IController *)self_plus)->GetLinkedSensors(); - SCA_ISensor* sensor; - for (unsigned int index=0;indexGetName() == key) - return static_cast(sensor); - - } - break; - } - case KX_PYGENSEQ_CONT_TYPE_ACTUATORS: - { - vector& linkedactuators = ((SCA_IController *)self_plus)->GetLinkedActuators(); - SCA_IActuator* actuator; - for (unsigned int index=0;indexGetName() == key) - return static_cast(actuator); - } - break; - } - case KX_PYGENSEQ_OB_TYPE_SENSORS: - { - SCA_SensorList& linkedsensors= ((KX_GameObject *)self_plus)->GetSensors(); - SCA_ISensor *sensor; - for (unsigned int index=0;indexGetName() == key) - return static_cast(sensor); - } - break; - } - case KX_PYGENSEQ_OB_TYPE_CONTROLLERS: - { - SCA_ControllerList& linkedcontrollers= ((KX_GameObject *)self_plus)->GetControllers(); - SCA_IController *controller; - for (unsigned int index=0;indexGetName() == key) - return static_cast(controller); - } - break; - } - case KX_PYGENSEQ_OB_TYPE_ACTUATORS: - { - SCA_ActuatorList& linkedactuators= ((KX_GameObject *)self_plus)->GetActuators(); - SCA_IActuator *actuator; - for (unsigned int index=0;indexGetName() == key) - return static_cast(actuator); - } - break; - } - case KX_PYGENSEQ_OB_TYPE_CONSTRAINTS: - { - return ((BL_ArmatureObject*)self_plus)->GetConstraint(key); - } - case KX_PYGENSEQ_OB_TYPE_CHANNELS: - { - return ((BL_ArmatureObject*)self_plus)->GetChannel(key); - } - } - - return NULL; -} - - -static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key) -{ - PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); - - if(self_plus==NULL) { - PyErr_SetString(PyExc_SystemError, "val = seq[key], KX_PythonSeq: "BGE_PROXY_ERROR_MSG); - return NULL; - } - - if (PyLong_Check(key)) { - return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t( key )); - } - else if ( PyUnicode_Check(key) ) { - char *name = _PyUnicode_AsString(key); - PyObjectPlus *ret = KX_PythonSeq_subscript__internal(self, name); - - if(ret) { - return ret->GetProxy(); - } else { - PyErr_Format( PyExc_KeyError, "requested item \"%s\" does not exist", name); - return NULL; - } - } - else { - PyErr_SetString( PyExc_TypeError, "expected a string or an index" ); - return NULL; - } -} - - -static int KX_PythonSeq_contains(PyObject *self, PyObject *key) -{ - PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); - - if(self_plus==NULL) { - PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: "BGE_PROXY_ERROR_MSG); - return -1; - } - if(!PyUnicode_Check(key)) { - PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: key must be a string"); - return -1; - } - - if(KX_PythonSeq_subscript__internal(self, _PyUnicode_AsString(key))) - return 1; - - return 0; -} - -/* Matches python dict.get(key, [default]) */ -PyObject* KX_PythonSeq_get(PyObject * self, PyObject *args) -{ - char *key; - PyObject* def = Py_None; - PyObjectPlus* ret_plus; - - if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) - return NULL; - - if((ret_plus = KX_PythonSeq_subscript__internal(self, key))) - return ret_plus->GetProxy(); - - Py_INCREF(def); - return def; -} - -PySequenceMethods KX_PythonSeq_as_sequence = { - NULL, /* Cant set the len otherwise it can evaluate as false */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - NULL, /* sq_item */ - NULL, /* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* sq_ass_slice */ - (objobjproc)KX_PythonSeq_contains, /* sq_contains */ - (binaryfunc) NULL, /* sq_inplace_concat */ - (ssizeargfunc) NULL, /* sq_inplace_repeat */ -}; - -static PyMappingMethods KX_PythonSeq_as_mapping = { - KX_PythonSeq_len, /* mp_length */ - KX_PythonSeq_subscript, /* mp_subscript */ - 0, /* mp_ass_subscript */ -}; - -PyMethodDef KX_PythonSeq_methods[] = { - // dict style access for props - {"get",(PyCFunction) KX_PythonSeq_get, METH_VARARGS}, - {NULL,NULL} //Sentinel -}; - -/* - * Initialize the interator index - */ - -static PyObject *KX_PythonSeq_getIter(KX_PythonSeq *self) -{ - if(BGE_PROXY_REF(self->base)==NULL) { - PyErr_SetString(PyExc_SystemError, "for i in seq: "BGE_PROXY_ERROR_MSG); - return NULL; - } - - /* create a new iterator if were alredy using this one */ - if (self->iter == -1) { - self->iter = 0; - Py_INCREF(self); - return (PyObject *)self; - } else { - return KX_PythonSeq_CreatePyObject(self->base, self->type); - } - } - - -/* - * Return next KX_PythonSeq iter. - */ - -static PyObject *KX_PythonSeq_nextIter(KX_PythonSeq *self) -{ - PyObject *object = KX_PythonSeq_getIndex((PyObject *)self, self->iter); - - self->iter++; - if( object==NULL ) { - self->iter= -1; /* for reuse */ - PyErr_SetString(PyExc_StopIteration, "iterator at end"); - } - return object; /* can be NULL for end of iterator */ -} - - -static int KX_PythonSeq_compare( KX_PythonSeq * a, KX_PythonSeq * b ) -{ - return ( a->type == b->type && a->base == b->base) ? 0 : -1; -} - -static PyObject *KX_PythonSeq_richcmp(PyObject *a, PyObject *b, int op) -{ - PyObject *res; - int ok= -1; /* zero is true */ - - if(BPy_KX_PythonSeq_Check(a) && BPy_KX_PythonSeq_Check(b)) - ok= KX_PythonSeq_compare((KX_PythonSeq *)a, (KX_PythonSeq *)b); - - switch (op) { - case Py_NE: - ok = !ok; /* pass through */ - case Py_EQ: - res = ok ? Py_False : Py_True; - break; - - case Py_LT: - case Py_LE: - case Py_GT: - case Py_GE: - res = Py_NotImplemented; - break; - default: - PyErr_BadArgument(); - return NULL; - } - - Py_INCREF(res); - return res; -} - - -/* - * repr function - * convert to a list and get its string value - */ -static PyObject *KX_PythonSeq_repr( KX_PythonSeq * self ) -{ - PyObject *list = PySequence_List((PyObject *)self); - PyObject *repr = PyObject_Repr(list); - Py_DECREF(list); - return repr; -} - - -/*****************************************************************************/ -/* Python KX_PythonSeq_Type structure definition: */ -/*****************************************************************************/ -PyTypeObject KX_PythonSeq_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - /* For printing, in format "." */ - "KX_PythonSeq", /* char *tp_name; */ - sizeof( KX_PythonSeq ), /* int tp_basicsize; */ - 0, /* tp_itemsize; For allocation */ - - /* Methods to implement standard operations */ - - ( destructor ) KX_PythonSeq_dealloc, /* destructor tp_dealloc; */ - NULL, /* printfunc tp_print; */ - NULL, /* getattrfunc tp_getattr; */ - NULL, /* setattrfunc tp_setattr; */ - NULL, /* cmpfunc tp_compare; */ - ( reprfunc ) KX_PythonSeq_repr, /* reprfunc tp_repr; */ - - /* Method suites for standard classes */ - - NULL, /* PyNumberMethods *tp_as_number; */ - &KX_PythonSeq_as_sequence, /* PySequenceMethods *tp_as_sequence; */ - &KX_PythonSeq_as_mapping, /* PyMappingMethods *tp_as_mapping; */ - - /* More standard operations (here for binary compatibility) */ - - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - NULL, /* getattrofunc tp_getattro; */ - NULL, /* setattrofunc tp_setattro; */ - - /* Functions to access object as input/output buffer */ - NULL, /* PyBufferProcs *tp_as_buffer; */ - - /*** Flags to define presence of optional/expanded features ***/ - Py_TPFLAGS_DEFAULT, /* long tp_flags; */ - - NULL, /* char *tp_doc; Documentation string */ - /*** Assigned meaning in release 2.0 ***/ - /* call function for all accessible objects */ - NULL, /* traverseproc tp_traverse; */ - - /* delete references to contained objects */ - NULL, /* inquiry tp_clear; */ - - /*** Assigned meaning in release 2.1 ***/ - /*** rich comparisons ***/ - (richcmpfunc)KX_PythonSeq_richcmp, /* richcmpfunc tp_richcompare; */ - - /*** weak reference enabler ***/ - 0, /* long tp_weaklistoffset; */ - - /*** Added in release 2.2 ***/ - /* Iterators */ - ( getiterfunc) KX_PythonSeq_getIter, /* getiterfunc tp_iter; */ - ( iternextfunc ) KX_PythonSeq_nextIter, /* iternextfunc tp_iternext; */ - - /*** Attribute descriptor and subclassing stuff ***/ - KX_PythonSeq_methods, /* struct PyMethodDef *tp_methods; */ - NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ - NULL, /* struct _typeobject *tp_base; */ - NULL, /* PyObject *tp_dict; */ - NULL, /* descrgetfunc tp_descr_get; */ - NULL, /* descrsetfunc tp_descr_set; */ - 0, /* long tp_dictoffset; */ - NULL, /* initproc tp_init; */ - NULL, /* allocfunc tp_alloc; */ - NULL, /* newfunc tp_new; */ - /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ - /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ - NULL, /* PyObject *tp_bases; */ - /* method resolution order */ - NULL, /* PyObject *tp_mro; */ - NULL, /* PyObject *tp_cache; */ - NULL, /* PyObject *tp_subclasses; */ - NULL, /* PyObject *tp_weaklist; */ - NULL -}; - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_PythonSeq.h b/source/gameengine/Ketsji/KX_PythonSeq.h deleted file mode 100644 index ca8f667852a..00000000000 --- a/source/gameengine/Ketsji/KX_PythonSeq.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): Campbell Barton - * - * ***** END GPL LICENSE BLOCK ***** - * Readonly sequence wrapper for lookups on logic bricks - */ - -#ifndef _adr_py_seq_h_ // only process once, -#define _adr_py_seq_h_ // even if multiply included - -#ifndef DISABLE_PYTHON - -#include "PyObjectPlus.h" - -// ------------------------- -enum KX_PYGENSEQ_TYPE { - KX_PYGENSEQ_CONT_TYPE_SENSORS, - KX_PYGENSEQ_CONT_TYPE_ACTUATORS, - KX_PYGENSEQ_OB_TYPE_SENSORS, - KX_PYGENSEQ_OB_TYPE_CONTROLLERS, - KX_PYGENSEQ_OB_TYPE_ACTUATORS, - KX_PYGENSEQ_OB_TYPE_CONSTRAINTS, - KX_PYGENSEQ_OB_TYPE_CHANNELS, -}; - -/* The Main PyType Object defined in Main.c */ -extern PyTypeObject KX_PythonSeq_Type; - -#define BPy_KX_PythonSeq_Check(v) \ - ((v)->ob_type == &KX_PythonSeq_Type) - -typedef struct { - PyObject_VAR_HEAD - PyObject *base; - short type; - short iter; -} KX_PythonSeq; - -PyObject *KX_PythonSeq_CreatePyObject(PyObject *base, short type); - -#endif // DISABLE_PYTHON - -#endif // _adr_py_seq_h_ diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp deleted file mode 100644 index 041559158dd..00000000000 --- a/source/gameengine/Ketsji/KX_RadarSensor.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_RadarSensor.h" -#include "KX_GameObject.h" -#include "KX_PyMath.h" -#include "PHY_IPhysicsController.h" -#include "PHY_IMotionState.h" - -/** - * RadarSensor constructor. Creates a near-sensor derived class, with a cone collision shape. - */ -KX_RadarSensor::KX_RadarSensor(SCA_EventManager* eventmgr, - KX_GameObject* gameobj, - PHY_IPhysicsController* physCtrl, - double coneradius, - double coneheight, - int axis, - double margin, - double resetmargin, - bool bFindMaterial, - const STR_String& touchedpropname) - - : KX_NearSensor( - eventmgr, - gameobj, - //DT_NewCone(coneradius,coneheight), - margin, - resetmargin, - bFindMaterial, - touchedpropname, - physCtrl), - - m_coneradius(coneradius), - m_coneheight(coneheight), - m_axis(axis) -{ - m_client_info->m_type = KX_ClientObjectInfo::SENSOR; - //m_client_info->m_clientobject = gameobj; - //m_client_info->m_auxilary_info = NULL; - //sumoObj->setClientObject(&m_client_info); -} - -KX_RadarSensor::~KX_RadarSensor() -{ - -} - -CValue* KX_RadarSensor::GetReplica() -{ - KX_RadarSensor* replica = new KX_RadarSensor(*this); - replica->ProcessReplica(); - return replica; -} - -/** - * Transforms the collision object. A cone is not correctly centered - * for usage. */ -void KX_RadarSensor::SynchronizeTransform() -{ - // Getting the parent location was commented out. Why? - MT_Transform trans; - trans.setOrigin(((KX_GameObject*)GetParent())->NodeGetWorldPosition()); - trans.setBasis(((KX_GameObject*)GetParent())->NodeGetWorldOrientation()); - // What is the default orientation? pointing in the -y direction? - // is the geometry correctly converted? - - // a collision cone is oriented - // center the cone correctly - // depends on the radar 'axis' - switch (m_axis) - { - case 0: // +X Axis - { - MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(90)); - trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); - break; - }; - case 1: // +Y Axis - { - MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180)); - trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); - break; - }; - case 2: // +Z Axis - { - MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-90)); - trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); - break; - }; - case 3: // -X Axis - { - MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(-90)); - trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); - break; - }; - case 4: // -Y Axis - { - //MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180)); - //trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); - break; - }; - case 5: // -Z Axis - { - MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(90)); - trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); - break; - }; - default: - { - } - } - - //Using a temp variable to translate MT_Point3 to float[3]. - //float[3] works better for the Python interface. - MT_Point3 temp = trans.getOrigin(); - m_cone_origin[0] = temp[0]; - m_cone_origin[1] = temp[1]; - m_cone_origin[2] = temp[2]; - - temp = trans(MT_Point3(0, -m_coneheight/2.0 ,0)); - m_cone_target[0] = temp[0]; - m_cone_target[1] = temp[1]; - m_cone_target[2] = temp[2]; - - - if (m_physCtrl) - { - PHY_IMotionState* motionState = m_physCtrl->GetMotionState(); - const MT_Point3& pos = trans.getOrigin(); - float ori[12]; - trans.getBasis().getValue(ori); - motionState->setWorldPosition(pos[0], pos[1], pos[2]); - motionState->setWorldOrientation(ori); - m_physCtrl->WriteMotionStateToDynamics(true); - } - -} - -/* ------------------------------------------------------------------------- */ -/* Python Functions */ -/* ------------------------------------------------------------------------- */ - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python Integration Hooks */ -/* ------------------------------------------------------------------------- */ -PyTypeObject KX_RadarSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_RadarSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &KX_NearSensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_RadarSensor::Methods[] = { - {NULL} //Sentinel -}; - -PyAttributeDef KX_RadarSensor::Attributes[] = { - KX_PYATTRIBUTE_FLOAT_ARRAY_RO("coneOrigin", KX_RadarSensor, m_cone_origin, 3), - KX_PYATTRIBUTE_FLOAT_ARRAY_RO("coneTarget", KX_RadarSensor, m_cone_target, 3), - KX_PYATTRIBUTE_FLOAT_RO("distance", KX_RadarSensor, m_coneheight), - KX_PYATTRIBUTE_FLOAT_RW("angle", 0, 360, KX_RadarSensor, m_coneradius), - KX_PYATTRIBUTE_INT_RW("axis", 0, 5, true, KX_RadarSensor, m_axis), - {NULL} //Sentinel -}; - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_RadarSensor.h b/source/gameengine/Ketsji/KX_RadarSensor.h deleted file mode 100644 index 17305922385..00000000000 --- a/source/gameengine/Ketsji/KX_RadarSensor.h +++ /dev/null @@ -1,96 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_RADAR_SENSOR_H -#define __KX_RADAR_SENSOR_H - -#include "KX_NearSensor.h" -#include "MT_Point3.h" - -/** -* Radar 'cone' sensor. Very similar to a near-sensor, but instead of a sphere, a cone is used. -*/ -class KX_RadarSensor : public KX_NearSensor -{ - protected: - Py_Header; - - float m_coneradius; - - /** - * Height of the cone. - */ - float m_coneheight; - int m_axis; - - /** - * The previous position of the origin of the cone. - */ - float m_cone_origin[3]; - - /** - * The previous direction of the cone (origin to bottom plane). - */ - float m_cone_target[3]; - -public: - - KX_RadarSensor(SCA_EventManager* eventmgr, - KX_GameObject* gameobj, - PHY_IPhysicsController* physCtrl, - double coneradius, - double coneheight, - int axis, - double margin, - double resetmargin, - bool bFindMaterial, - const STR_String& touchedpropname); - KX_RadarSensor(); - virtual ~KX_RadarSensor(); - virtual void SynchronizeTransform(); - virtual CValue* GetReplica(); - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - enum RadarAxis { - KX_RADAR_AXIS_POS_X = 0, - KX_RADAR_AXIS_POS_Y, - KX_RADAR_AXIS_POS_Z, - KX_RADAR_AXIS_NEG_X, - KX_RADAR_AXIS_NEG_Y, - KX_RADAR_AXIS_NEG_Z - }; - - /* python */ - virtual sensortype GetSensorType() { return ST_RADAR; } - -}; - -#endif //__KX_RADAR_SENSOR_H - diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp deleted file mode 100644 index 7562265a536..00000000000 --- a/source/gameengine/Ketsji/KX_RayCast.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * KX_MouseFocusSensor determines mouse in/out/over events. - */ - -#include -#include - -#include "KX_RayCast.h" - -#include "MT_Point3.h" -#include "MT_Vector3.h" - -#include "KX_IPhysicsController.h" -#include "PHY_IPhysicsEnvironment.h" -#include "PHY_IPhysicsController.h" - -KX_RayCast::KX_RayCast(KX_IPhysicsController* ignoreController, bool faceNormal, bool faceUV) - :PHY_IRayCastFilterCallback(dynamic_cast(ignoreController), faceNormal, faceUV) -{ -} - -void KX_RayCast::reportHit(PHY_RayCastResult* result) -{ - m_hitFound = true; - m_hitPoint.setValue((const float*)result->m_hitPoint); - m_hitNormal.setValue((const float*)result->m_hitNormal); - m_hitUVOK = result->m_hitUVOK; - m_hitUV.setValue((const float*)result->m_hitUV); - m_hitMesh = result->m_meshObject; - m_hitPolygon = result->m_polygon; -} - -bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_Point3& _frompoint, const MT_Point3& topoint, KX_RayCast& callback) -{ - if(physics_environment==NULL) return false; /* prevents crashing in some cases */ - - // Loops over all physics objects between frompoint and topoint, - // calling callback.RayHit for each one. - // - // callback.RayHit should return true to stop looking, or false to continue. - // - // returns true if an object was found, false if not. - - MT_Point3 frompoint(_frompoint); - const MT_Vector3 todir( (topoint - frompoint).safe_normalized() ); - MT_Point3 prevpoint(_frompoint+todir*(-1.f)); - - PHY_IPhysicsController* hit_controller; - - while((hit_controller = physics_environment->rayTest(callback, - frompoint.x(),frompoint.y(),frompoint.z(), - topoint.x(),topoint.y(),topoint.z())) != NULL) - { - KX_ClientObjectInfo* info = static_cast(hit_controller->getNewClientInfo()); - - if (!info) - { - printf("no info!\n"); - MT_assert(info && "Physics controller with no client object info"); - break; - } - - // The biggest danger to endless loop, prevent this by checking that the - // hit point always progresses along the ray direction.. - prevpoint -= callback.m_hitPoint; - if (prevpoint.length2() < MT_EPSILON) - break; - - if (callback.RayHit(info)) - // caller may decide to stop the loop and still cancel the hit - return callback.m_hitFound; - - // Skip past the object and keep tracing. - // Note that retrieving in a single shot multiple hit points would be possible - // but it would require some change in Bullet. - prevpoint = callback.m_hitPoint; - /* We add 0.001 of fudge, so that if the margin && radius == 0., we don't endless loop. */ - MT_Scalar marg = 0.001 + hit_controller->GetMargin(); - marg *= 2.f; - /* Calculate the other side of this object */ - MT_Scalar h = MT_abs(todir.dot(callback.m_hitNormal)); - if (h <= 0.01) - // the normal is almost orthogonal to the ray direction, cannot compute the other side - break; - marg /= h; - frompoint = callback.m_hitPoint + marg * todir; - // verify that we are not passed the to point - if ((topoint - frompoint).dot(todir) < 0.f) - break; - } - return false; -} - diff --git a/source/gameengine/Ketsji/KX_RayCast.h b/source/gameengine/Ketsji/KX_RayCast.h deleted file mode 100644 index f2084b7669d..00000000000 --- a/source/gameengine/Ketsji/KX_RayCast.h +++ /dev/null @@ -1,143 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_RAYCAST_H__ -#define __KX_RAYCAST_H__ - -#include "PHY_IPhysicsEnvironment.h" -#include "PHY_IPhysicsController.h" -#include "MT_Vector2.h" -#include "MT_Point3.h" -#include "MT_Vector3.h" - -class RAS_MeshObject; -struct KX_ClientObjectInfo; -class KX_IPhysicsController; - -/** - * Defines a function for doing a ray cast. - * - * eg KX_RayCast::RayTest(ignore_physics_controller, physics_environment, frompoint, topoint, result_point, result_normal, KX_RayCast::Callback(this, data) - * - * Calls myclass->RayHit(client, hit_point, hit_normal, data) for all client - * between frompoint and topoint - * - * myclass->RayHit should return true to end the raycast, false to ignore the current client. - * - * Returns true if a client was accepted, false if nothing found. - */ -class KX_RayCast : public PHY_IRayCastFilterCallback -{ -public: - bool m_hitFound; - MT_Point3 m_hitPoint; - MT_Vector3 m_hitNormal; - const RAS_MeshObject* m_hitMesh; - int m_hitPolygon; - int m_hitUVOK; // !=0 if UV coordinate in m_hitUV is valid - MT_Vector2 m_hitUV; - - KX_RayCast(KX_IPhysicsController* ignoreController, bool faceNormal, bool faceUV); - virtual ~KX_RayCast() {} - - /** - * The physic environment returns the ray casting result through this function - */ - virtual void reportHit(PHY_RayCastResult* result); - - /** ray test callback. - * either override this in your class, or use a callback wrapper. - */ - virtual bool RayHit(KX_ClientObjectInfo* client) = 0; - - /** - * Callback wrapper. - * - * Construct with KX_RayCast::Callback(this, data) - * and pass to KX_RayCast::RayTest - */ - template class Callback; - - /// Public interface. - /// Implement bool RayHit in your class to receive ray callbacks. - static bool RayTest( - PHY_IPhysicsEnvironment* physics_environment, - const MT_Point3& frompoint, - const MT_Point3& topoint, - KX_RayCast& callback); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayCast"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -template class KX_RayCast::Callback : public KX_RayCast -{ - T *self; - void *data; -public: - Callback(T *_self, KX_IPhysicsController* controller=NULL, void *_data = NULL, bool faceNormal=false, bool faceUV=false) - : KX_RayCast(controller, faceNormal, faceUV), - self(_self), - data(_data) - { - } - - ~Callback() {} - - virtual bool RayHit(KX_ClientObjectInfo* client) - { - return self->RayHit(client, this, data); - } - - virtual bool needBroadphaseRayCast(PHY_IPhysicsController* controller) - { - KX_ClientObjectInfo* info = static_cast(controller->getNewClientInfo()); - - if (!info) - { - MT_assert(info && "Physics controller with no client object info"); - return false; - } - return self->NeedRayCast(info); - } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayCast::Callback"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - - -#endif diff --git a/source/gameengine/Ketsji/KX_RayEventManager.cpp b/source/gameengine/Ketsji/KX_RayEventManager.cpp deleted file mode 100644 index 9c9d6722784..00000000000 --- a/source/gameengine/Ketsji/KX_RayEventManager.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Manager for ray events - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "KX_RayEventManager.h" -#include "SCA_LogicManager.h" -#include "SCA_ISensor.h" -#include - -using namespace std; - -#include -#include - -void KX_RayEventManager::NextFrame() -{ - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - (*it)->Activate(m_logicmgr); - } -} - diff --git a/source/gameengine/Ketsji/KX_RayEventManager.h b/source/gameengine/Ketsji/KX_RayEventManager.h deleted file mode 100644 index 35bf57f130c..00000000000 --- a/source/gameengine/Ketsji/KX_RayEventManager.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Manager for ray events - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_RAYEVENTMGR -#define __KX_RAYEVENTMGR -#include "SCA_EventManager.h" -#include -using namespace std; - -class KX_RayEventManager : public SCA_EventManager -{ -public: - KX_RayEventManager(class SCA_LogicManager* logicmgr) - : SCA_EventManager(logicmgr, RAY_EVENTMGR) - {} - virtual void NextFrame(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayEventManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_RAYEVENTMGR - diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp deleted file mode 100644 index e745d1f0334..00000000000 --- a/source/gameengine/Ketsji/KX_RaySensor.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/** - * Cast a ray and feel for objects - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_RaySensor.h" -#include "SCA_EventManager.h" -#include "SCA_RandomEventManager.h" -#include "SCA_LogicManager.h" -#include "SCA_IObject.h" -#include "KX_ClientObjectInfo.h" -#include "KX_GameObject.h" -#include "KX_Scene.h" -#include "KX_RayCast.h" -#include "KX_PyMath.h" -#include "PHY_IPhysicsEnvironment.h" -#include "KX_IPhysicsController.h" -#include "PHY_IPhysicsController.h" - -#include - - -KX_RaySensor::KX_RaySensor(class SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - const STR_String& propname, - bool bFindMaterial, - bool bXRay, - double distance, - int axis, - KX_Scene* ketsjiScene) - : SCA_ISensor(gameobj,eventmgr), - m_propertyname(propname), - m_bFindMaterial(bFindMaterial), - m_bXRay(bXRay), - m_distance(distance), - m_scene(ketsjiScene), - m_axis(axis) - - -{ - Init(); -} - -void KX_RaySensor::Init() -{ - m_bTriggered = (m_invert)?true:false; - m_rayHit = false; - m_hitObject = NULL; - m_reset = true; -} - -KX_RaySensor::~KX_RaySensor() -{ - /* Nothing to be done here. */ -} - - - -CValue* KX_RaySensor::GetReplica() -{ - KX_RaySensor* replica = new KX_RaySensor(*this); - replica->ProcessReplica(); - replica->Init(); - - return replica; -} - - - -bool KX_RaySensor::IsPositiveTrigger() -{ - bool result = m_rayHit; - - if (m_invert) - result = !result; - - return result; -} - -bool KX_RaySensor::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data) -{ - - KX_GameObject* hitKXObj = client->m_gameobject; - bool bFound = false; - - if (m_propertyname.Length() == 0) - { - bFound = true; - } - else - { - if (m_bFindMaterial) - { - if (client->m_auxilary_info) - { - bFound = (m_propertyname== ((char*)client->m_auxilary_info)); - } - } - else - { - bFound = hitKXObj->GetProperty(m_propertyname) != NULL; - } - } - - if (bFound) - { - m_rayHit = true; - m_hitObject = hitKXObj; - m_hitPosition[0] = result->m_hitPoint[0]; - m_hitPosition[1] = result->m_hitPoint[1]; - m_hitPosition[2] = result->m_hitPoint[2]; - - m_hitNormal[0] = result->m_hitNormal[0]; - m_hitNormal[1] = result->m_hitNormal[1]; - m_hitNormal[2] = result->m_hitNormal[2]; - - } - // no multi-hit search yet - return true; -} - -/* this function is used to pre-filter the object before casting the ray on them. - This is useful for "X-Ray" option when we want to see "through" unwanted object. - */ -bool KX_RaySensor::NeedRayCast(KX_ClientObjectInfo* client) -{ - if (client->m_type > KX_ClientObjectInfo::ACTOR) - { - // Unknown type of object, skip it. - // Should not occur as the sensor objects are filtered in RayTest() - printf("Invalid client type %d found ray casting\n", client->m_type); - return false; - } - if (m_bXRay && m_propertyname.Length() != 0) - { - if (m_bFindMaterial) - { - // not quite correct: an object may have multiple material - // should check all the material and not only the first one - if (!client->m_auxilary_info || (m_propertyname != ((char*)client->m_auxilary_info))) - return false; - } - else - { - if (client->m_gameobject->GetProperty(m_propertyname) == NULL) - return false; - } - } - return true; -} - -bool KX_RaySensor::Evaluate() -{ - bool result = false; - bool reset = m_reset && m_level; - m_rayHit = false; - m_hitObject = NULL; - m_hitPosition[0] = 0; - m_hitPosition[1] = 0; - m_hitPosition[2] = 0; - - m_hitNormal[0] = 1; - m_hitNormal[1] = 0; - m_hitNormal[2] = 0; - - KX_GameObject* obj = (KX_GameObject*)GetParent(); - MT_Point3 frompoint = obj->NodeGetWorldPosition(); - MT_Matrix3x3 matje = obj->NodeGetWorldOrientation(); - MT_Matrix3x3 invmat = matje.inverse(); - - MT_Vector3 todir; - m_reset = false; - switch (m_axis) - { - case 1: // X - { - todir[0] = invmat[0][0]; - todir[1] = invmat[0][1]; - todir[2] = invmat[0][2]; - break; - } - case 0: // Y - { - todir[0] = invmat[1][0]; - todir[1] = invmat[1][1]; - todir[2] = invmat[1][2]; - break; - } - case 2: // Z - { - todir[0] = invmat[2][0]; - todir[1] = invmat[2][1]; - todir[2] = invmat[2][2]; - break; - } - case 3: // -X - { - todir[0] = -invmat[0][0]; - todir[1] = -invmat[0][1]; - todir[2] = -invmat[0][2]; - break; - } - case 4: // -Y - { - todir[0] = -invmat[1][0]; - todir[1] = -invmat[1][1]; - todir[2] = -invmat[1][2]; - break; - } - case 5: // -Z - { - todir[0] = -invmat[2][0]; - todir[1] = -invmat[2][1]; - todir[2] = -invmat[2][2]; - break; - } - } - todir.normalize(); - m_rayDirection[0] = todir[0]; - m_rayDirection[1] = todir[1]; - m_rayDirection[2] = todir[2]; - - MT_Point3 topoint = frompoint + (m_distance) * todir; - PHY_IPhysicsEnvironment* pe = m_scene->GetPhysicsEnvironment(); - - if (!pe) - { - std::cout << "WARNING: Ray sensor " << GetName() << ": There is no physics environment!" << std::endl; - std::cout << " Check universe for malfunction." << std::endl; - return false; - } - - KX_IPhysicsController *spc = obj->GetPhysicsController(); - KX_GameObject *parent = obj->GetParent(); - if (!spc && parent) - spc = parent->GetPhysicsController(); - - if (parent) - parent->Release(); - - - PHY_IPhysicsEnvironment* physics_environment = this->m_scene->GetPhysicsEnvironment(); - - - KX_RayCast::Callback callback(this, spc); - KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback); - - /* now pass this result to some controller */ - - if (m_rayHit) - { - if (!m_bTriggered) - { - // notify logicsystem that ray is now hitting - result = true; - m_bTriggered = true; - } - else - { - // notify logicsystem that ray is STILL hitting ... - result = false; - - } - } - else - { - if (m_bTriggered) - { - m_bTriggered = false; - // notify logicsystem that ray JUST left the Object - result = true; - } - else - { - result = false; - } - - } - if (reset) - // force an event - result = true; - - return result; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_RaySensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_RaySensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new - -}; - -PyMethodDef KX_RaySensor::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_RaySensor::Attributes[] = { - KX_PYATTRIBUTE_BOOL_RW("useMaterial", KX_RaySensor, m_bFindMaterial), - KX_PYATTRIBUTE_BOOL_RW("useXRay", KX_RaySensor, m_bXRay), - KX_PYATTRIBUTE_FLOAT_RW("range", 0, 10000, KX_RaySensor, m_distance), - KX_PYATTRIBUTE_STRING_RW("propName", 0, 100, false, KX_RaySensor, m_propertyname), - KX_PYATTRIBUTE_INT_RW("axis", 0, 5, true, KX_RaySensor, m_axis), - KX_PYATTRIBUTE_FLOAT_ARRAY_RO("hitPosition", KX_RaySensor, m_hitPosition, 3), - KX_PYATTRIBUTE_FLOAT_ARRAY_RO("rayDirection", KX_RaySensor, m_rayDirection, 3), - KX_PYATTRIBUTE_FLOAT_ARRAY_RO("hitNormal", KX_RaySensor, m_hitNormal, 3), - KX_PYATTRIBUTE_RO_FUNCTION("hitObject", KX_RaySensor, pyattr_get_hitobject), - { NULL } //Sentinel -}; - -PyObject* KX_RaySensor::pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_RaySensor* self = static_cast(self_v); - if (self->m_hitObject) - return self->m_hitObject->GetProxy(); - - Py_RETURN_NONE; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_RaySensor.h b/source/gameengine/Ketsji/KX_RaySensor.h deleted file mode 100644 index 34f7d8a7b1d..00000000000 --- a/source/gameengine/Ketsji/KX_RaySensor.h +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Cast a ray and feel for objects - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_RAYSENSOR_H -#define __KX_RAYSENSOR_H - -#include "SCA_ISensor.h" -#include "MT_Point3.h" -#include "SCA_IScene.h" /* only for scene replace */ -#include "KX_Scene.h" /* only for scene replace */ - -struct KX_ClientObjectInfo; -class KX_RayCast; - -class KX_RaySensor : public SCA_ISensor -{ - Py_Header; - STR_String m_propertyname; - bool m_bFindMaterial; - bool m_bXRay; - float m_distance; - class KX_Scene* m_scene; - bool m_bTriggered; - int m_axis; - bool m_rayHit; - float m_hitPosition[3]; - SCA_IObject* m_hitObject; - float m_hitNormal[3]; - float m_rayDirection[3]; - -public: - KX_RaySensor(class SCA_EventManager* eventmgr, - SCA_IObject* gameobj, - const STR_String& propname, - bool bFindMaterial, - bool bXRay, - double distance, - int axis, - class KX_Scene* ketsjiScene); - virtual ~KX_RaySensor(); - virtual CValue* GetReplica(); - - virtual bool Evaluate(); - virtual bool IsPositiveTrigger(); - virtual void Init(); - - bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data); - bool NeedRayCast(KX_ClientObjectInfo* client); - - virtual void Replace_IScene(SCA_IScene *val) - { - m_scene= static_cast(val); - } - - //Python Interface - enum RayAxis { - KX_RAY_AXIS_POS_Y = 0, - KX_RAY_AXIS_POS_X, - KX_RAY_AXIS_POS_Z, - KX_RAY_AXIS_NEG_X, - KX_RAY_AXIS_NEG_Y, - KX_RAY_AXIS_NEG_Z - }; - -#ifndef DISABLE_PYTHON - - /* Attributes */ - static PyObject* pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - -#endif // DISABLE_PYTHON - -}; - -#endif //__KX_RAYSENSOR_H - diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp deleted file mode 100644 index eee6146f6ed..00000000000 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp +++ /dev/null @@ -1,284 +0,0 @@ -// -// Add an object when this actuator is triggered -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// Previously existed as: - -// \source\gameengine\GameLogic\SCA_AddObjectActuator.cpp - -// Please look here for revision history. - - -#include "KX_SCA_AddObjectActuator.h" -#include "SCA_IScene.h" -#include "KX_GameObject.h" -#include "KX_IPhysicsController.h" -#include "PyObjectPlus.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_SCA_AddObjectActuator::KX_SCA_AddObjectActuator(SCA_IObject *gameobj, - SCA_IObject *original, - int time, - SCA_IScene* scene, - const float *linvel, - bool linv_local, - const float *angvel, - bool angv_local) - : - SCA_IActuator(gameobj, KX_ACT_ADD_OBJECT), - m_OriginalObject(original), - m_scene(scene), - - m_localLinvFlag(linv_local), - m_localAngvFlag(angv_local) -{ - m_linear_velocity[0] = linvel[0]; - m_linear_velocity[1] = linvel[1]; - m_linear_velocity[2] = linvel[2]; - m_angular_velocity[0] = angvel[0]; - m_angular_velocity[1] = angvel[1]; - m_angular_velocity[2] = angvel[2]; - - if (m_OriginalObject) - m_OriginalObject->RegisterActuator(this); - - m_lastCreatedObject = NULL; - m_timeProp = time; -} - - - -KX_SCA_AddObjectActuator::~KX_SCA_AddObjectActuator() -{ - if (m_OriginalObject) - m_OriginalObject->UnregisterActuator(this); - if (m_lastCreatedObject) - m_lastCreatedObject->UnregisterActuator(this); -} - - - -bool KX_SCA_AddObjectActuator::Update() -{ - //bool result = false; /*unused*/ - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (bNegativeEvent) return false; // do nothing on negative events - - InstantAddObject(); - - - return false; -} - - - - -SCA_IObject* KX_SCA_AddObjectActuator::GetLastCreatedObject() const -{ - return m_lastCreatedObject; -} - - - -CValue* KX_SCA_AddObjectActuator::GetReplica() -{ - KX_SCA_AddObjectActuator* replica = new KX_SCA_AddObjectActuator(*this); - - if (replica == NULL) - return NULL; - - // this will copy properties and so on... - replica->ProcessReplica(); - - return replica; -} - -void KX_SCA_AddObjectActuator::ProcessReplica() -{ - if (m_OriginalObject) - m_OriginalObject->RegisterActuator(this); - m_lastCreatedObject=NULL; - SCA_IActuator::ProcessReplica(); -} - -bool KX_SCA_AddObjectActuator::UnlinkObject(SCA_IObject* clientobj) -{ - if (clientobj == m_OriginalObject) - { - // this object is being deleted, we cannot continue to track it. - m_OriginalObject = NULL; - return true; - } - if (clientobj == m_lastCreatedObject) - { - // this object is being deleted, we cannot continue to track it. - m_lastCreatedObject = NULL; - return true; - } - return false; -} - -void KX_SCA_AddObjectActuator::Relink(GEN_Map *obj_map) -{ - void **h_obj = (*obj_map)[m_OriginalObject]; - if (h_obj) { - if (m_OriginalObject) - m_OriginalObject->UnregisterActuator(this); - m_OriginalObject = (SCA_IObject*)(*h_obj); - m_OriginalObject->RegisterActuator(this); - } -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_SCA_AddObjectActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_SCA_AddObjectActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_SCA_AddObjectActuator::Methods[] = { - {"instantAddObject", (PyCFunction) KX_SCA_AddObjectActuator::sPyInstantAddObject, METH_NOARGS,"instantAddObject() : immediately add object without delay\n"}, - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_SCA_AddObjectActuator::Attributes[] = { - KX_PYATTRIBUTE_RW_FUNCTION("object",KX_SCA_AddObjectActuator,pyattr_get_object,pyattr_set_object), - KX_PYATTRIBUTE_RO_FUNCTION("objectLastCreated",KX_SCA_AddObjectActuator,pyattr_get_objectLastCreated), - KX_PYATTRIBUTE_INT_RW("time",0,2000,true,KX_SCA_AddObjectActuator,m_timeProp), - KX_PYATTRIBUTE_FLOAT_ARRAY_RW("linearVelocity",-FLT_MAX,FLT_MAX,KX_SCA_AddObjectActuator,m_linear_velocity,3), - KX_PYATTRIBUTE_FLOAT_ARRAY_RW("angularVelocity",-FLT_MAX,FLT_MAX,KX_SCA_AddObjectActuator,m_angular_velocity,3), - { NULL } //Sentinel -}; - -PyObject* KX_SCA_AddObjectActuator::pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_SCA_AddObjectActuator* actuator = static_cast(self); - if (!actuator->m_OriginalObject) - Py_RETURN_NONE; - else - return actuator->m_OriginalObject->GetProxy(); -} - -int KX_SCA_AddObjectActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_SCA_AddObjectActuator* actuator = static_cast(self); - KX_GameObject *gameobj; - - if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.object = value: KX_SCA_AddObjectActuator")) - return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - - if (actuator->m_OriginalObject != NULL) - actuator->m_OriginalObject->UnregisterActuator(actuator); - - actuator->m_OriginalObject = (SCA_IObject*)gameobj; - - if (actuator->m_OriginalObject) - actuator->m_OriginalObject->RegisterActuator(actuator); - - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_SCA_AddObjectActuator::pyattr_get_objectLastCreated(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_SCA_AddObjectActuator* actuator = static_cast(self); - if (!actuator->m_lastCreatedObject) - Py_RETURN_NONE; - else - return actuator->m_lastCreatedObject->GetProxy(); -} - -PyObject* KX_SCA_AddObjectActuator::PyInstantAddObject() -{ - InstantAddObject(); - - Py_RETURN_NONE; -} - -#endif // DISABLE_PYTHON - -void KX_SCA_AddObjectActuator::InstantAddObject() -{ - if (m_OriginalObject) - { - // Add an identical object, with properties inherited from the original object - // Now it needs to be added to the current scene. - SCA_IObject* replica = m_scene->AddReplicaObject(m_OriginalObject,GetParent(),m_timeProp ); - KX_GameObject * game_obj = static_cast(replica); - game_obj->setLinearVelocity(m_linear_velocity ,m_localLinvFlag); - game_obj->setAngularVelocity(m_angular_velocity,m_localAngvFlag); - game_obj->ResolveCombinedVelocities(m_linear_velocity, m_angular_velocity, m_localLinvFlag, m_localAngvFlag); - - // keep a copy of the last object, to allow python scripters to change it - if (m_lastCreatedObject) - { - //Let's not keep a reference to the object: it's bad, if the object is deleted - //this will force to keep a "zombie" in the game for no good reason. - //m_scene->DelayedReleaseObject(m_lastCreatedObject); - //m_lastCreatedObject->Release(); - - //Instead we use the registration mechanism - m_lastCreatedObject->UnregisterActuator(this); - m_lastCreatedObject = NULL; - } - - m_lastCreatedObject = replica; - // no reference - //m_lastCreatedObject->AddRef(); - // but registration - m_lastCreatedObject->RegisterActuator(this); - // finished using replica? then release it - replica->Release(); - } -} diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h deleted file mode 100644 index c2068d157ee..00000000000 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h +++ /dev/null @@ -1,138 +0,0 @@ -// -// Add object to the game world on action of this actuator. A copy is made -// of a referenced object. The copy inherits some properties from the owner -// of this actuator. -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// -// Previously existed as: -// \source\gameengine\GameLogic\SCA_AddObjectActuator.h -// Please look here for revision history. - -#ifndef __KX_SCA_AddObjectActuator -#define __KX_SCA_AddObjectActuator - -/* Actuator tree */ -#include "SCA_IActuator.h" -#include "SCA_LogicManager.h" - -#include "MT_Vector3.h" - - - -class SCA_IScene; - -class KX_SCA_AddObjectActuator : public SCA_IActuator -{ - Py_Header; - - /// Time field: lifetime of the new object - int m_timeProp; - - /// Original object reference (object to replicate) - SCA_IObject* m_OriginalObject; - - /// Object will be added to the following scene - SCA_IScene* m_scene; - - /// Linear velocity upon creation of the object. - float m_linear_velocity[3]; - /// Apply the velocity locally - bool m_localLinvFlag; - - /// Angular velocity upon creation of the object. - float m_angular_velocity[3]; - /// Apply the velocity locally - bool m_localAngvFlag; - - - - - SCA_IObject* m_lastCreatedObject; - -public: - - /** - * This class also has the default constructors - * available. Use with care! - */ - - KX_SCA_AddObjectActuator( - SCA_IObject *gameobj, - SCA_IObject *original, - int time, - SCA_IScene* scene, - const float *linvel, - bool linv_local, - const float *angvel, - bool angv_local - ); - - ~KX_SCA_AddObjectActuator(void); - - CValue* - GetReplica( - ) ; - - virtual void - ProcessReplica(); - - virtual void Replace_IScene(SCA_IScene *val) - { - m_scene= val; - }; - - virtual bool - UnlinkObject(SCA_IObject* clientobj); - - virtual void - Relink(GEN_Map *obj_map); - - virtual bool - Update(); - - SCA_IObject* - GetLastCreatedObject( - ) const ; - - void InstantAddObject(); - -#ifndef DISABLE_PYTHON - - KX_PYMETHOD_DOC_NOARGS(KX_SCA_AddObjectActuator,InstantAddObject); - - static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_objectLastCreated(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - -#endif // DISABLE_PYTHON - -}; /* end of class KX_SCA_AddObjectActuator : public KX_EditObjectActuator */ - -#endif - diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp deleted file mode 100644 index bc59c63dc69..00000000000 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// -// Adjust dynamics settins for this object -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** - -// -// Previously existed as: - -// \source\gameengine\GameLogic\SCA_DynamicActuator.cpp - -// Please look here for revision history. - -#include "KX_SCA_DynamicActuator.h" - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ - -PyTypeObject KX_SCA_DynamicActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_SCA_DynamicActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_SCA_DynamicActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_SCA_DynamicActuator::Attributes[] = { - KX_PYATTRIBUTE_SHORT_RW("mode",0,4,false,KX_SCA_DynamicActuator,m_dyn_operation), - KX_PYATTRIBUTE_FLOAT_RW("mass",0.0,FLT_MAX,KX_SCA_DynamicActuator,m_setmass), - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_SCA_DynamicActuator::KX_SCA_DynamicActuator(SCA_IObject *gameobj, - short dyn_operation, - float setmass) : - - SCA_IActuator(gameobj, KX_ACT_DYNAMIC), - m_dyn_operation(dyn_operation), - m_setmass(setmass) -{ -} /* End of constructor */ - - -KX_SCA_DynamicActuator::~KX_SCA_DynamicActuator() -{ - // there's nothing to be done here, really.... -} /* end of destructor */ - - - -bool KX_SCA_DynamicActuator::Update() -{ - // bool result = false; /*unused*/ - KX_GameObject *obj = (KX_GameObject*) GetParent(); - bool bNegativeEvent = IsNegativeEvent(); - KX_IPhysicsController* controller; - RemoveAllEvents(); - - if (bNegativeEvent) - return false; // do nothing on negative events - - if (!obj) - return false; // object not accessible, shouldnt happen - controller = obj->GetPhysicsController(); - if (!controller) - return false; // no physic object - - switch (m_dyn_operation) - { - case 0: - obj->RestoreDynamics(); - break; - case 1: - obj->SuspendDynamics(); - break; - case 2: - controller->setRigidBody(true); - break; - case 3: - controller->setRigidBody(false); - break; - case 4: - controller->SetMass(m_setmass); - break; - } - - return false; -} - - - -CValue* KX_SCA_DynamicActuator::GetReplica() -{ - KX_SCA_DynamicActuator* replica = - new KX_SCA_DynamicActuator(*this); - - if (replica == NULL) - return NULL; - - replica->ProcessReplica(); - return replica; -}; - - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h deleted file mode 100644 index 43322fdfd96..00000000000 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h +++ /dev/null @@ -1,76 +0,0 @@ -// -// Add object to the game world on action of this actuator -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): Campbell Barton -// -// ***** END GPL LICENSE BLOCK ***** -// - -#ifndef __KX_SCA_DYNAMICACTUATOR -#define __KX_SCA_DYNAMICACTUATOR - -#include "SCA_IActuator.h" -#include "SCA_PropertyActuator.h" -#include "SCA_LogicManager.h" - -#include "KX_GameObject.h" -#include "KX_IPhysicsController.h" - -class KX_SCA_DynamicActuator : public SCA_IActuator -{ - Py_Header; - - // dynamics operation to apply to the game object - short m_dyn_operation; - float m_setmass; - public: - KX_SCA_DynamicActuator( - SCA_IObject* gameobj, - short dyn_operation, - float setmass - ); - - ~KX_SCA_DynamicActuator( - ); - - CValue* - GetReplica( - ); - - virtual bool - Update(); - - //Python Interface - enum DynamicOperation { - KX_DYN_RESTORE_DYNAMICS = 0, - KX_DYN_DISABLE_DYNAMICS, - KX_DYN_ENABLE_RIGID_BODY, - KX_DYN_DISABLE_RIGID_BODY, - KX_DYN_SET_MASS, - }; -}; - -#endif diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp deleted file mode 100644 index c9ead726905..00000000000 --- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -// - -// Remove the actuator's parent when triggered -// -// Previously existed as: -// \source\gameengine\GameLogic\SCA_EndObjectActuator.cpp -// Please look here for revision history. - -#include "SCA_IActuator.h" -#include "KX_SCA_EndObjectActuator.h" -#include "SCA_IScene.h" - -KX_SCA_EndObjectActuator::KX_SCA_EndObjectActuator(SCA_IObject *gameobj, - SCA_IScene* scene): - SCA_IActuator(gameobj, KX_ACT_END_OBJECT), - m_scene(scene) -{ - // intentionally empty -} /* End of constructor */ - - - -KX_SCA_EndObjectActuator::~KX_SCA_EndObjectActuator() -{ - // there's nothing to be done here, really.... -} /* end of destructor */ - - - -bool KX_SCA_EndObjectActuator::Update() -{ - // bool result = false; /*unused*/ - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (bNegativeEvent) - return false; // do nothing on negative events - m_scene->DelayedRemoveObject(GetParent()); - - return false; -} - - - -CValue* KX_SCA_EndObjectActuator::GetReplica() -{ - KX_SCA_EndObjectActuator* replica = - new KX_SCA_EndObjectActuator(*this); - if (replica == NULL) return NULL; - - replica->ProcessReplica(); - return replica; -}; - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions : integration hooks */ -/* ------------------------------------------------------------------------- */ - -PyTypeObject KX_SCA_EndObjectActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_SCA_EndObjectActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_SCA_EndObjectActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_SCA_EndObjectActuator::Attributes[] = { - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h deleted file mode 100644 index cedf17c599b..00000000000 --- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// Add object to the game world on action of this actuator -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// -// Previously existed as: -// \source\gameengine\GameLogic\SCA_EndObjectActuator.h -// Please look here for revision history. - -#ifndef __KX_SCA_ENDOBJECTACTUATOR -#define __KX_SCA_ENDOBJECTACTUATOR - -#include "SCA_IActuator.h" - -class SCA_IScene; - -class KX_SCA_EndObjectActuator : public SCA_IActuator -{ - Py_Header; - SCA_IScene* m_scene; - - public: - KX_SCA_EndObjectActuator( - SCA_IObject* gameobj, - SCA_IScene* scene - ); - - ~KX_SCA_EndObjectActuator(); - - CValue* - GetReplica( - ); - - virtual bool - Update(); - - virtual void Replace_IScene(SCA_IScene *val) - { - m_scene= val; - }; - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - -}; /* end of class KX_EditObjectActuator : public SCA_PropertyActuator */ - -#endif - diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp deleted file mode 100644 index 20c3168d7ba..00000000000 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp +++ /dev/null @@ -1,177 +0,0 @@ -// -// Replace the mesh for this actuator's parent -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** - -// -// Previously existed as: - -// \source\gameengine\GameLogic\SCA_ReplaceMeshActuator.cpp - -// Please look here for revision history. - -#include "KX_SCA_ReplaceMeshActuator.h" -#include "KX_MeshProxy.h" - -#include "PyObjectPlus.h" - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ - -PyTypeObject KX_SCA_ReplaceMeshActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_SCA_ReplaceMeshActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_SCA_ReplaceMeshActuator::Methods[] = { - KX_PYMETHODTABLE(KX_SCA_ReplaceMeshActuator, instantReplaceMesh), - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_SCA_ReplaceMeshActuator::Attributes[] = { - KX_PYATTRIBUTE_RW_FUNCTION("mesh", KX_SCA_ReplaceMeshActuator, pyattr_get_mesh, pyattr_set_mesh), - KX_PYATTRIBUTE_BOOL_RW ("useDisplayMesh", KX_SCA_ReplaceMeshActuator, m_use_gfx), - KX_PYATTRIBUTE_BOOL_RW ("usePhysicsMesh", KX_SCA_ReplaceMeshActuator, m_use_phys), - { NULL } //Sentinel -}; - -PyObject* KX_SCA_ReplaceMeshActuator::pyattr_get_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_SCA_ReplaceMeshActuator* actuator = static_cast(self); - if (!actuator->m_mesh) - Py_RETURN_NONE; - KX_MeshProxy* meshproxy = new KX_MeshProxy(actuator->m_mesh); - return meshproxy->NewProxy(true); -} - -int KX_SCA_ReplaceMeshActuator::pyattr_set_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_SCA_ReplaceMeshActuator* actuator = static_cast(self); - RAS_MeshObject* new_mesh; - - if (!ConvertPythonToMesh(value, &new_mesh, true, "actuator.mesh = value: KX_SCA_ReplaceMeshActuator")) - return PY_SET_ATTR_FAIL; - - actuator->m_mesh = new_mesh; - return PY_SET_ATTR_SUCCESS; -} - -KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, instantReplaceMesh, -"instantReplaceMesh() : immediately replace mesh without delay\n") -{ - InstantReplaceMesh(); - Py_RETURN_NONE; -} - -#endif // DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_SCA_ReplaceMeshActuator::KX_SCA_ReplaceMeshActuator(SCA_IObject *gameobj, - class RAS_MeshObject *mesh, - SCA_IScene* scene, - bool use_gfx, - bool use_phys) : - - SCA_IActuator(gameobj, KX_ACT_REPLACE_MESH), - m_mesh(mesh), - m_scene(scene), - m_use_gfx(use_gfx), - m_use_phys(use_phys) -{ -} /* End of constructor */ - - - -KX_SCA_ReplaceMeshActuator::~KX_SCA_ReplaceMeshActuator() -{ - // there's nothing to be done here, really.... -} /* end of destructor */ - - - -bool KX_SCA_ReplaceMeshActuator::Update() -{ - // bool result = false; /*unused*/ - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (bNegativeEvent) - return false; // do nothing on negative events - - if (m_mesh || m_use_phys) /* NULL mesh is ok if were updating physics */ - m_scene->ReplaceMesh(GetParent(),m_mesh, m_use_gfx, m_use_phys); - - return false; -} - - - -CValue* KX_SCA_ReplaceMeshActuator::GetReplica() -{ - KX_SCA_ReplaceMeshActuator* replica = - new KX_SCA_ReplaceMeshActuator(*this); - - if (replica == NULL) - return NULL; - - replica->ProcessReplica(); - - return replica; -}; - -void KX_SCA_ReplaceMeshActuator::InstantReplaceMesh() -{ - if (m_mesh) m_scene->ReplaceMesh(GetParent(),m_mesh, m_use_gfx, m_use_phys); -} - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h deleted file mode 100644 index 4a6ae9f8fce..00000000000 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h +++ /dev/null @@ -1,98 +0,0 @@ -// -// Add object to the game world on action of this actuator -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// -// Previously existed as: -// \source\gameengine\GameLogic\SCA_ReplaceMeshActuator.h -// Please look here for revision history. -// - -#ifndef __KX_SCA_REPLACEMESHACTUATOR -#define __KX_SCA_REPLACEMESHACTUATOR - -#include "SCA_IActuator.h" -#include "SCA_PropertyActuator.h" -#include "SCA_LogicManager.h" -#include "SCA_IScene.h" - -#include "RAS_MeshObject.h" - -class KX_SCA_ReplaceMeshActuator : public SCA_IActuator -{ - Py_Header; - - // mesh reference (mesh to replace) - RAS_MeshObject* m_mesh; - SCA_IScene* m_scene; - bool m_use_gfx; - bool m_use_phys; - - public: - KX_SCA_ReplaceMeshActuator( - SCA_IObject* gameobj, - RAS_MeshObject *mesh, - SCA_IScene* scene, - bool use_gfx, - bool use_phys - ); - - ~KX_SCA_ReplaceMeshActuator( - ); - - CValue* - GetReplica( - ); - - virtual bool - Update(); - - void InstantReplaceMesh(); - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - virtual void Replace_IScene(SCA_IScene *val) - { - m_scene= val; - }; - - static PyObject* pyattr_get_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_mesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,instantReplaceMesh); - -#endif // DISABLE_PYTHON - -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp deleted file mode 100644 index 0529195e933..00000000000 --- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include - -#include "KX_SG_BoneParentNodeRelationship.h" - -#include "MT_Matrix4x4.h" -#include "BL_ArmatureObject.h" - - -/** - * Implementation of classes defined in KX_SG_BoneParentNodeRelationship.h - */ - -/** - * first of all KX_SG_BoneParentRelation - */ - - KX_BoneParentRelation * -KX_BoneParentRelation:: -New(Bone* bone -) { - return new KX_BoneParentRelation(bone); -} - - bool -KX_BoneParentRelation:: -UpdateChildCoordinates( - SG_Spatial * child, - const SG_Spatial * parent, - bool& parentUpdated -){ - MT_assert(child != NULL); - - // This way of accessing child coordinates is a bit cumbersome - // be nice to have non constant reference access to these values. - - const MT_Vector3 & child_scale = child->GetLocalScale(); - const MT_Point3 & child_pos = child->GetLocalPosition(); - const MT_Matrix3x3 & child_rotation = child->GetLocalOrientation(); - // we don't know if the armature has been updated or not, assume yes - parentUpdated = true; - - // the childs world locations which we will update. - - MT_Vector3 child_w_scale; - MT_Point3 child_w_pos; - MT_Matrix3x3 child_w_rotation; - - bool valid_parent_transform = false; - - if (parent) - { - BL_ArmatureObject *armature = (BL_ArmatureObject*)(parent->GetSGClientObject()); - if (armature) - { - MT_Matrix4x4 parent_matrix; - if (armature->GetBoneMatrix(m_bone, parent_matrix)) - { - // Get the child's transform, and the bone matrix. - MT_Matrix4x4 child_transform ( - MT_Transform(child_pos + MT_Vector3(0.0, armature->GetBoneLength(m_bone), 0.0), - child_rotation.scaled( - child_scale[0], - child_scale[1], - child_scale[2]))); - - // The child's world transform is parent * child - parent_matrix = parent->GetWorldTransform() * parent_matrix; - child_transform = parent_matrix * child_transform; - - // Recompute the child transform components from the transform. - child_w_scale.setValue( - MT_Vector3(child_transform[0][0], child_transform[0][1], child_transform[0][2]).length(), - MT_Vector3(child_transform[1][0], child_transform[1][1], child_transform[1][2]).length(), - MT_Vector3(child_transform[2][0], child_transform[2][1], child_transform[2][2]).length()); - child_w_rotation.setValue(child_transform[0][0], child_transform[0][1], child_transform[0][2], - child_transform[1][0], child_transform[1][1], child_transform[1][2], - child_transform[2][0], child_transform[2][1], child_transform[2][2]); - child_w_rotation.scale(1.0/child_w_scale[0], 1.0/child_w_scale[1], 1.0/child_w_scale[2]); - - child_w_pos = MT_Point3(child_transform[0][3], child_transform[1][3], child_transform[2][3]); - - valid_parent_transform = true; - } - } - } - - if (valid_parent_transform) - { - child->SetWorldScale(child_w_scale); - child->SetWorldPosition(child_w_pos); - child->SetWorldOrientation(child_w_rotation); - } - else { - child->SetWorldFromLocalTransform(); - } - child->ClearModified(); - // this node must always be updated, so reschedule it for next time - child->ActivateRecheduleUpdateCallback(); - return valid_parent_transform; -} - - SG_ParentRelation * -KX_BoneParentRelation:: -NewCopy( -){ - KX_BoneParentRelation* bone_parent = new KX_BoneParentRelation(m_bone); - return bone_parent; -} - -KX_BoneParentRelation:: -~KX_BoneParentRelation( -){ - //nothing to do -} - - -KX_BoneParentRelation:: -KX_BoneParentRelation(Bone* bone -) -: m_bone(bone) -{ - // nothing to do -} diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h deleted file mode 100644 index be8c4951935..00000000000 --- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @mainpage KX_SG_NodeRelationships - - * @section - * - * This file provides common concrete implementations of - * SG_ParentRelation used by the game engine. These are - * KX_SlowParentRelation a slow parent relationship. - * KX_NormalParentRelation a normal parent relationship where - * orientation and position are inherited from the parent by - * the child. - * KX_VertexParentRelation only location information is - * inherited by the child. - * - * interface - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -#ifndef __KX_SG_BONEPARENTRELATION_H__ -#define __KX_SG_BONEPARENTRELATION_H__ - -#include "SG_Spatial.h" -#include "SG_ParentRelation.h" - -struct Bone; - -/** - * Bone parent relationship parents a child SG_Spatial frame to a - * bone in an armature object. - */ -class KX_BoneParentRelation : public SG_ParentRelation -{ - -public : - /** - * Allocate and construct a new KX_SG_BoneParentRelation - * on the heap. - * - * bone is the bone id to use. Currently it is a pointer - * to a Blender struct Bone - this should be fixed if - */ - - static - KX_BoneParentRelation * - New(Bone* bone - ); - - /** - * Updates the childs world coordinates relative to the parent's - * world coordinates. - * - * Parent should be a BL_ArmatureObject. - */ - bool - UpdateChildCoordinates( - SG_Spatial * child, - const SG_Spatial * parent, - bool& parentUpdated - ); - - /** - * Create a copy of this relationship - */ - SG_ParentRelation * - NewCopy( - ); - - ~KX_BoneParentRelation( - ); - -private : - Bone* m_bone; - KX_BoneParentRelation(Bone* bone - ); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BoneParentRelation"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp b/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp deleted file mode 100644 index ccdaac8edb7..00000000000 --- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_SG_NodeRelationships.h" - -/** - * Implementation of classes defined in KX_SG_NodeRelationships.h - */ - -/** - * first of all KX_NormalParentRelation - */ - - KX_NormalParentRelation * -KX_NormalParentRelation:: -New( -) { - return new KX_NormalParentRelation(); -} - - bool -KX_NormalParentRelation:: -UpdateChildCoordinates( - SG_Spatial * child, - const SG_Spatial * parent, - bool& parentUpdated -){ - MT_assert(child != NULL); - - if (!parentUpdated && !child->IsModified()) - return false; - - parentUpdated = true; - - if (parent==NULL) { /* Simple case */ - child->SetWorldFromLocalTransform(); - child->ClearModified(); - return true; //false; - } - else { - // the childs world locations which we will update. - const MT_Vector3 & p_world_scale = parent->GetWorldScaling(); - const MT_Point3 & p_world_pos = parent->GetWorldPosition(); - const MT_Matrix3x3 & p_world_rotation = parent->GetWorldOrientation(); - - child->SetWorldScale(p_world_scale * child->GetLocalScale()); - child->SetWorldOrientation(p_world_rotation * child->GetLocalOrientation()); - child->SetWorldPosition(p_world_pos + p_world_scale * (p_world_rotation * child->GetLocalPosition())); - child->ClearModified(); - return true; - } -} - - SG_ParentRelation * -KX_NormalParentRelation:: -NewCopy( -){ - return new KX_NormalParentRelation(); -} - -KX_NormalParentRelation:: -~KX_NormalParentRelation( -){ - //nothing to do -} - - -KX_NormalParentRelation:: -KX_NormalParentRelation( -){ - // nothing to do -} - -/** - * Next KX_VertexParentRelation - */ - - - KX_VertexParentRelation * -KX_VertexParentRelation:: -New( -){ - return new KX_VertexParentRelation(); -} - -/** - * Method inherited from KX_ParentRelation - */ - - bool -KX_VertexParentRelation:: -UpdateChildCoordinates( - SG_Spatial * child, - const SG_Spatial * parent, - bool& parentUpdated -){ - - MT_assert(child != NULL); - - if (!parentUpdated && !child->IsModified()) - return false; - - child->SetWorldScale(child->GetLocalScale()); - - if (parent) - child->SetWorldPosition(child->GetLocalPosition()+parent->GetWorldPosition()); - else - child->SetWorldPosition(child->GetLocalPosition()); - - child->SetWorldOrientation(child->GetLocalOrientation()); - child->ClearModified(); - return true; //parent != NULL; -} - -/** - * Method inherited from KX_ParentRelation - */ - - SG_ParentRelation * -KX_VertexParentRelation:: -NewCopy( -){ - return new KX_VertexParentRelation(); -}; - -KX_VertexParentRelation:: -~KX_VertexParentRelation( -){ - //nothing to do -} - - -KX_VertexParentRelation:: -KX_VertexParentRelation( -){ - //nothing to do -} - - -/** - * Slow parent relationship - */ - - KX_SlowParentRelation * -KX_SlowParentRelation:: -New( - MT_Scalar relaxation -){ - return new KX_SlowParentRelation(relaxation); -} - -/** - * Method inherited from KX_ParentRelation - */ - - bool -KX_SlowParentRelation:: -UpdateChildCoordinates( - SG_Spatial * child, - const SG_Spatial * parent, - bool& parentUpdated -){ - MT_assert(child != NULL); - - // the child will move even if the parent is not - parentUpdated = true; - - const MT_Vector3 & child_scale = child->GetLocalScale(); - const MT_Point3 & child_pos = child->GetLocalPosition(); - const MT_Matrix3x3 & child_rotation = child->GetLocalOrientation(); - - // the childs world locations which we will update. - - MT_Vector3 child_w_scale; - MT_Point3 child_w_pos; - MT_Matrix3x3 child_w_rotation; - - if (parent) { - - // This is a slow parent relation - // first compute the normal child world coordinates. - - MT_Vector3 child_n_scale; - MT_Point3 child_n_pos; - MT_Matrix3x3 child_n_rotation; - - const MT_Vector3 & p_world_scale = parent->GetWorldScaling(); - const MT_Point3 & p_world_pos = parent->GetWorldPosition(); - const MT_Matrix3x3 & p_world_rotation = parent->GetWorldOrientation(); - - child_n_scale = p_world_scale * child_scale; - child_n_rotation = p_world_rotation * child_rotation; - - child_n_pos = p_world_pos + p_world_scale * - (p_world_rotation * child_pos); - - - if (m_initialized) { - - // get the current world positions - - child_w_scale = child->GetWorldScaling(); - child_w_pos = child->GetWorldPosition(); - child_w_rotation = child->GetWorldOrientation(); - - // now 'interpolate' the normal coordinates with the last - // world coordinates to get the new world coordinates. - - MT_Scalar weight = MT_Scalar(1)/(m_relax + 1); - child_w_scale = (m_relax * child_w_scale + child_n_scale) * weight; - child_w_pos = (m_relax * child_w_pos + child_n_pos) * weight; - // for rotation we must go through quaternion - MT_Quaternion child_w_quat = child_w_rotation.getRotation().slerp(child_n_rotation.getRotation(), weight); - child_w_rotation.setRotation(child_w_quat); - //FIXME: update physics controller. - } else { - child_w_scale = child_n_scale; - child_w_pos = child_n_pos; - child_w_rotation = child_n_rotation; - m_initialized = true; - } - - } else { - - child_w_scale = child_scale; - child_w_pos = child_pos; - child_w_rotation = child_rotation; - } - - child->SetWorldScale(child_w_scale); - child->SetWorldPosition(child_w_pos); - child->SetWorldOrientation(child_w_rotation); - child->ClearModified(); - // this node must always be updated, so reschedule it for next time - child->ActivateRecheduleUpdateCallback(); - - return true; //parent != NULL; -} - -/** - * Method inherited from KX_ParentRelation - */ - - SG_ParentRelation * -KX_SlowParentRelation:: -NewCopy( -){ - return new KX_SlowParentRelation(m_relax); -} - -KX_SlowParentRelation:: -KX_SlowParentRelation( - MT_Scalar relaxation -): - m_relax(relaxation), - m_initialized(false) -{ - //nothing to do -} - -KX_SlowParentRelation:: -~KX_SlowParentRelation( -){ - //nothing to do -} - - - - diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h deleted file mode 100644 index f62e18b07c3..00000000000 --- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h +++ /dev/null @@ -1,241 +0,0 @@ -/** - * @mainpage KX_SG_NodeRelationships - - * @section - * - * This file provides common concrete implementations of - * SG_ParentRelation used by the game engine. These are - * KX_SlowParentRelation a slow parent relationship. - * KX_NormalParentRelation a normal parent relationship where - * orientation and position are inherited from the parent by - * the child. - * KX_VertexParentRelation only location information is - * inherited by the child. - * - * interface - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -#ifndef __KX_SG_NODERELATIONS_H__ -#define __KX_SG_NODERELATIONS_H__ - -#include "SG_Spatial.h" -#include "SG_ParentRelation.h" - -class KX_NormalParentRelation : public SG_ParentRelation -{ - -public : - /** - * Allocate and construct a new KX_NormalParentRelation - * on the heap. - */ - - static - KX_NormalParentRelation * - New( - ); - - /** - * Method inherited from KX_ParentRelation - */ - - bool - UpdateChildCoordinates( - SG_Spatial * child, - const SG_Spatial * parent, - bool& parentUpdated - ); - - /** - * Method inherited from KX_ParentRelation - */ - - SG_ParentRelation * - NewCopy( - ); - - ~KX_NormalParentRelation( - ); - -private : - - KX_NormalParentRelation( - ); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_NormalParentRelation"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - - -class KX_VertexParentRelation : public SG_ParentRelation -{ - -public : - - /** - * Allocate and construct a new KX_VertexParentRelation - * on the heap. - */ - - static - KX_VertexParentRelation * - New( - ); - - /** - * Method inherited from KX_ParentRelation - */ - - bool - UpdateChildCoordinates( - SG_Spatial * child, - const SG_Spatial * parent, - bool& parentUpdated - ); - - /** - * Method inherited from KX_ParentRelation - */ - - SG_ParentRelation * - NewCopy( - ); - - ~KX_VertexParentRelation( - ); - - bool - IsVertexRelation( - ) { - return true; - } - -private : - - KX_VertexParentRelation( - ); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_VertexParentRelation"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - - -class KX_SlowParentRelation : public SG_ParentRelation -{ - -public : - - /** - * Allocate and construct a new KX_VertexParentRelation - * on the heap. - */ - - static - KX_SlowParentRelation * - New( - MT_Scalar relaxation - ); - - /** - * Method inherited from KX_ParentRelation - */ - - bool - UpdateChildCoordinates( - SG_Spatial * child, - const SG_Spatial * parent, - bool& parentUpdated - ); - - /** - * Method inherited from KX_ParentRelation - */ - - SG_ParentRelation * - NewCopy( - ); - - MT_Scalar - GetTimeOffset( - ) { return m_relax; } - - void - SetTimeOffset( - MT_Scalar relaxation - ) { m_relax = relaxation; } - - ~KX_SlowParentRelation( - ); - - bool - IsSlowRelation( - ) { - return true; - } - -private : - - KX_SlowParentRelation( - MT_Scalar relaxation - ); - - // the relaxation coefficient. - - MT_Scalar m_relax; - - /** - * Looks like a hack flag to me. - * We need to compute valid world coordinates the first - * time we update spatial data of the child. This is done - * by just doing a normal parent relation the first time - * UpdateChildCoordinates is called and then doing the - * slow parent relation - */ - - bool m_initialized; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_SlowParentRelation"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif diff --git a/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp b/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp deleted file mode 100644 index 9fc544feaff..00000000000 --- a/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_ScalarInterpolator.h" -#include "KX_IScalarInterpolator.h" - -void KX_ScalarInterpolator::Execute(float currentTime) const { - *m_target = m_ipo->GetValue(currentTime); -} diff --git a/source/gameengine/Ketsji/KX_ScalarInterpolator.h b/source/gameengine/Ketsji/KX_ScalarInterpolator.h deleted file mode 100644 index 29962ddf686..00000000000 --- a/source/gameengine/Ketsji/KX_ScalarInterpolator.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_SCALARINTERPOLATOR -#define KX_SCALARINTERPOLATOR - -#include "MT_Scalar.h" -#include "KX_IInterpolator.h" - -class KX_IScalarInterpolator; - -class KX_ScalarInterpolator : public KX_IInterpolator { -public: - KX_ScalarInterpolator(MT_Scalar* target, - KX_IScalarInterpolator *ipo) : - m_target(target), - m_ipo(ipo) - {} - - virtual ~KX_ScalarInterpolator() {} - virtual void Execute(float currentTime) const; - void SetNewTarget(MT_Scalar* newtarget) - { - m_target=newtarget; - } - MT_Scalar* GetTarget() - { - return m_target; - } -private: - MT_Scalar* m_target; - KX_IScalarInterpolator *m_ipo; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ScalarInterpolator"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp b/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp deleted file mode 100644 index 3f5ac8ee8a4..00000000000 --- a/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_ScalingInterpolator.h" -#include "MT_Vector3.h" -#include "KX_IScalarInterpolator.h" - -void KX_ScalingInterpolator::Execute(float currentTime) const { - m_target.setValue(m_ipos[0]->GetValue(currentTime), - m_ipos[1]->GetValue(currentTime), - m_ipos[2]->GetValue(currentTime)); -} diff --git a/source/gameengine/Ketsji/KX_ScalingInterpolator.h b/source/gameengine/Ketsji/KX_ScalingInterpolator.h deleted file mode 100644 index 72e0e1185df..00000000000 --- a/source/gameengine/Ketsji/KX_ScalingInterpolator.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_SCALINGINTERPOLATOR -#define KX_SCALINGINTERPOLATOR - -#include "KX_IInterpolator.h" - -class MT_Vector3; -class KX_IScalarInterpolator; - -class KX_ScalingInterpolator : public KX_IInterpolator { -public: - KX_ScalingInterpolator(MT_Vector3& target, - KX_IScalarInterpolator *ipos[]) - : m_target(target) - { - m_ipos[0] = ipos[0]; - m_ipos[1] = ipos[1]; - m_ipos[2] = ipos[2]; - } - - virtual void Execute(float currentTime) const; - -private: - MT_Vector3& m_target; - KX_IScalarInterpolator *m_ipos[3]; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ScalingInterpolator"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp deleted file mode 100644 index d72fef166e6..00000000000 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ /dev/null @@ -1,2238 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Ketsji scene. Holds references to all scene data. - */ - -#ifdef WIN32 -#pragma warning (disable : 4786) -#endif //WIN32 - -#include "KX_Scene.h" -#include "KX_PythonInit.h" -#include "MT_assert.h" -#include "KX_KetsjiEngine.h" -#include "KX_BlenderMaterial.h" -#include "RAS_IPolygonMaterial.h" -#include "ListValue.h" -#include "SCA_LogicManager.h" -#include "SCA_TimeEventManager.h" -//#include "SCA_AlwaysEventManager.h" -//#include "SCA_RandomEventManager.h" -//#include "KX_RayEventManager.h" -#include "KX_TouchEventManager.h" -#include "SCA_KeyboardManager.h" -#include "SCA_MouseManager.h" -//#include "SCA_PropertyEventManager.h" -#include "SCA_ActuatorEventManager.h" -#include "SCA_BasicEventManager.h" -#include "KX_Camera.h" -#include "SCA_JoystickManager.h" - -#include "RAS_MeshObject.h" - -#include "RAS_IRasterizer.h" -#include "RAS_BucketManager.h" - -#include "FloatValue.h" -#include "SCA_IController.h" -#include "SCA_IActuator.h" -#include "SG_Node.h" -#include "SYS_System.h" -#include "SG_Controller.h" -#include "SG_IObject.h" -#include "SG_Tree.h" -#include "DNA_group_types.h" -#include "DNA_scene_types.h" -#include "BKE_anim.h" - -#include "KX_SG_NodeRelationships.h" - -#include "KX_NetworkEventManager.h" -#include "NG_NetworkScene.h" -#include "PHY_IPhysicsEnvironment.h" -#include "KX_IPhysicsController.h" -#include "PHY_IGraphicController.h" -#include "KX_BlenderSceneConverter.h" -#include "KX_MotionState.h" - -#include "BL_ModifierDeformer.h" -#include "BL_ShapeDeformer.h" -#include "BL_DeformableGameObject.h" -#include "KX_SoftBodyDeformer.h" - -// to get USE_BULLET! -#include "KX_ConvertPhysicsObject.h" - -#ifdef USE_BULLET -#include "CcdPhysicsEnvironment.h" -#include "CcdPhysicsController.h" -#endif - -#include "KX_Light.h" - -#include - -void* KX_SceneReplicationFunc(SG_IObject* node,void* gameobj,void* scene) -{ - KX_GameObject* replica = ((KX_Scene*)scene)->AddNodeReplicaObject(node,(KX_GameObject*)gameobj); - - if(replica) - replica->Release(); - - return (void*)replica; -} - -void* KX_SceneDestructionFunc(SG_IObject* node,void* gameobj,void* scene) -{ - ((KX_Scene*)scene)->RemoveNodeDestructObject(node,(KX_GameObject*)gameobj); - - return NULL; -}; - -bool KX_Scene::KX_ScenegraphUpdateFunc(SG_IObject* node,void* gameobj,void* scene) -{ - return ((SG_Node*)node)->Schedule(((KX_Scene*)scene)->m_sghead); -} - -bool KX_Scene::KX_ScenegraphRescheduleFunc(SG_IObject* node,void* gameobj,void* scene) -{ - return ((SG_Node*)node)->Reschedule(((KX_Scene*)scene)->m_sghead); -} - -SG_Callbacks KX_Scene::m_callbacks = SG_Callbacks( - KX_SceneReplicationFunc, - KX_SceneDestructionFunc, - KX_GameObject::UpdateTransformFunc, - KX_Scene::KX_ScenegraphUpdateFunc, - KX_Scene::KX_ScenegraphRescheduleFunc); - -// temporarily var until there is a button in the userinterface -// (defined in KX_PythonInit.cpp) -extern bool gUseVisibilityTemp; - -KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, - class SCA_IInputDevice* mousedevice, - class NG_NetworkDeviceInterface *ndi, - const STR_String& sceneName, - Scene *scene, - class RAS_ICanvas* canvas): - PyObjectPlus(), - m_keyboardmgr(NULL), - m_mousemgr(NULL), - m_sceneConverter(NULL), - m_physicsEnvironment(0), - m_sceneName(sceneName), - m_networkDeviceInterface(ndi), - m_active_camera(NULL), - m_ueberExecutionPriority(0), - m_blenderScene(scene) -{ - m_suspendedtime = 0.0; - m_suspendeddelta = 0.0; - - m_dbvt_culling = false; - m_dbvt_occlusion_res = 0; - m_activity_culling = false; - m_suspend = false; - m_isclearingZbuffer = true; - m_tempObjectList = new CListValue(); - m_objectlist = new CListValue(); - m_parentlist = new CListValue(); - m_lightlist= new CListValue(); - m_inactivelist = new CListValue(); - m_euthanasyobjects = new CListValue(); - - m_logicmgr = new SCA_LogicManager(); - - m_timemgr = new SCA_TimeEventManager(m_logicmgr); - m_keyboardmgr = new SCA_KeyboardManager(m_logicmgr,keyboarddevice); - m_mousemgr = new SCA_MouseManager(m_logicmgr,mousedevice, canvas); - - //SCA_AlwaysEventManager* alwaysmgr = new SCA_AlwaysEventManager(m_logicmgr); - //SCA_PropertyEventManager* propmgr = new SCA_PropertyEventManager(m_logicmgr); - SCA_ActuatorEventManager* actmgr = new SCA_ActuatorEventManager(m_logicmgr); - //SCA_RandomEventManager* rndmgr = new SCA_RandomEventManager(m_logicmgr); - SCA_BasicEventManager* basicmgr = new SCA_BasicEventManager(m_logicmgr); - //KX_RayEventManager* raymgr = new KX_RayEventManager(m_logicmgr); - - KX_NetworkEventManager* netmgr = new KX_NetworkEventManager(m_logicmgr, ndi); - - - - //m_logicmgr->RegisterEventManager(alwaysmgr); - //m_logicmgr->RegisterEventManager(propmgr); - m_logicmgr->RegisterEventManager(actmgr); - m_logicmgr->RegisterEventManager(m_keyboardmgr); - m_logicmgr->RegisterEventManager(m_mousemgr); - m_logicmgr->RegisterEventManager(m_timemgr); - //m_logicmgr->RegisterEventManager(rndmgr); - //m_logicmgr->RegisterEventManager(raymgr); - m_logicmgr->RegisterEventManager(netmgr); - m_logicmgr->RegisterEventManager(basicmgr); - - - SYS_SystemHandle hSystem = SYS_GetSystem(); - bool nojoystick= SYS_GetCommandLineInt(hSystem,"nojoystick",0); - if (!nojoystick) - { - SCA_JoystickManager *joymgr = new SCA_JoystickManager(m_logicmgr); - m_logicmgr->RegisterEventManager(joymgr); - } - - MT_assert (m_networkDeviceInterface != NULL); - m_networkScene = new NG_NetworkScene(m_networkDeviceInterface); - - m_rootnode = NULL; - - m_bucketmanager=new RAS_BucketManager(); - -#ifndef DISABLE_PYTHON - m_attr_dict = PyDict_New(); /* new ref */ - m_draw_call_pre = NULL; - m_draw_call_post = NULL; -#endif -} - - - -KX_Scene::~KX_Scene() -{ - // The release of debug properties used to be in SCA_IScene::~SCA_IScene - // It's still there but we remove all properties here otherwise some - // reference might be hanging and causing late release of objects - RemoveAllDebugProperties(); - - while (GetRootParentList()->GetCount() > 0) - { - KX_GameObject* parentobj = (KX_GameObject*) GetRootParentList()->GetValue(0); - this->RemoveObject(parentobj); - } - - if(m_objectlist) - m_objectlist->Release(); - - if (m_parentlist) - m_parentlist->Release(); - - if (m_inactivelist) - m_inactivelist->Release(); - - if (m_lightlist) - m_lightlist->Release(); - - if (m_tempObjectList) - m_tempObjectList->Release(); - - if (m_euthanasyobjects) - m_euthanasyobjects->Release(); - - if (m_logicmgr) - delete m_logicmgr; - - if (m_physicsEnvironment) - delete m_physicsEnvironment; - - if (m_networkScene) - delete m_networkScene; - - if (m_bucketmanager) - { - delete m_bucketmanager; - } - -#ifndef DISABLE_PYTHON - PyDict_Clear(m_attr_dict); - Py_DECREF(m_attr_dict); - - Py_XDECREF(m_draw_call_pre); - Py_XDECREF(m_draw_call_post); -#endif -} - -RAS_BucketManager* KX_Scene::GetBucketManager() -{ - return m_bucketmanager; -} - - -CListValue* KX_Scene::GetTempObjectList() -{ - return m_tempObjectList; -} - -CListValue* KX_Scene::GetObjectList() -{ - return m_objectlist; -} - - -CListValue* KX_Scene::GetRootParentList() -{ - return m_parentlist; -} - -CListValue* KX_Scene::GetInactiveList() -{ - return m_inactivelist; -} - - - -CListValue* KX_Scene::GetLightList() -{ - return m_lightlist; -} - -SCA_LogicManager* KX_Scene::GetLogicManager() -{ - return m_logicmgr; -} - -SCA_TimeEventManager* KX_Scene::GetTimeEventManager() -{ - return m_timemgr; -} - - - - -list* KX_Scene::GetCameras() -{ - return &m_cameras; -} - - - -void KX_Scene::SetFramingType(RAS_FrameSettings & frame_settings) -{ - m_frame_settings = frame_settings; -}; - -/** - * Return a const reference to the framing - * type set by the above call. - * The contents are not guarenteed to be sensible - * if you don't call the above function. - */ -const RAS_FrameSettings& KX_Scene::GetFramingType() const -{ - return m_frame_settings; -}; - - - -/** - * Store the current scene's viewport on the - * game engine canvas. - */ -void KX_Scene::SetSceneViewport(const RAS_Rect &viewport) -{ - m_viewport = viewport; -} - - - -const RAS_Rect& KX_Scene::GetSceneViewport() const -{ - return m_viewport; -} - - - -void KX_Scene::SetWorldInfo(class KX_WorldInfo* worldinfo) -{ - m_worldinfo = worldinfo; -} - - - -class KX_WorldInfo* KX_Scene::GetWorldInfo() -{ - return m_worldinfo; -} - - -const STR_String& KX_Scene::GetName() -{ - return m_sceneName; -} - - -void KX_Scene::Suspend() -{ - m_suspend = true; -} - -void KX_Scene::Resume() -{ - m_suspend = false; -} - -void KX_Scene::SetActivityCulling(bool b) -{ - m_activity_culling = b; -} - -bool KX_Scene::IsSuspended() -{ - return m_suspend; -} - -bool KX_Scene::IsClearingZBuffer() -{ - return m_isclearingZbuffer; -} - -void KX_Scene::EnableZBufferClearing(bool isclearingZbuffer) -{ - m_isclearingZbuffer = isclearingZbuffer; -} - -void KX_Scene::RemoveNodeDestructObject(class SG_IObject* node,class CValue* gameobj) -{ - KX_GameObject* orgobj = (KX_GameObject*)gameobj; - if (NewRemoveObject(orgobj) != 0) - { - // object is not yet deleted because a reference is hanging somewhere. - // This should not happen anymore since we use proxy object for Python - // confident enough to put an assert? - //assert(false); - printf("Zombie object! name=%s\n", orgobj->GetName().ReadPtr()); - orgobj->SetSGNode(NULL); - PHY_IGraphicController* ctrl = orgobj->GetGraphicController(); - if (ctrl) - { - // a graphic controller is set, we must delete it as the node will be deleted - delete ctrl; - orgobj->SetGraphicController(NULL); - } - } - if (node) - delete node; -} - -KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CValue* gameobj) -{ - // for group duplication, limit the duplication of the hierarchy to the - // objects that are part of the group. - if (!IsObjectInGroup(gameobj)) - return NULL; - - KX_GameObject* orgobj = (KX_GameObject*)gameobj; - KX_GameObject* newobj = (KX_GameObject*)orgobj->GetReplica(); - m_map_gameobject_to_replica.insert(orgobj, newobj); - - // also register 'timers' (time properties) of the replica - int numprops = newobj->GetPropertyCount(); - - for (int i = 0; i < numprops; i++) - { - CValue* prop = newobj->GetProperty(i); - - if (prop->GetProperty("timer")) - this->m_timemgr->AddTimeProperty(prop); - } - - if (node) - { - newobj->SetSGNode((SG_Node*)node); - } - else - { - m_rootnode = new SG_Node(newobj,this,KX_Scene::m_callbacks); - - // this fixes part of the scaling-added object bug - SG_Node* orgnode = orgobj->GetSGNode(); - m_rootnode->SetLocalScale(orgnode->GetLocalScale()); - m_rootnode->SetLocalPosition(orgnode->GetLocalPosition()); - m_rootnode->SetLocalOrientation(orgnode->GetLocalOrientation()); - - // define the relationship between this node and it's parent. - KX_NormalParentRelation * parent_relation = - KX_NormalParentRelation::New(); - m_rootnode->SetParentRelation(parent_relation); - - newobj->SetSGNode(m_rootnode); - } - - SG_IObject* replicanode = newobj->GetSGNode(); -// SG_Node* rootnode = (replicanode == m_rootnode ? NULL : m_rootnode); - - replicanode->SetSGClientObject(newobj); - - // this is the list of object that are send to the graphics pipeline - m_objectlist->Add(newobj->AddRef()); - if (newobj->GetGameObjectType()==SCA_IObject::OBJ_LIGHT) - m_lightlist->Add(newobj->AddRef()); - newobj->AddMeshUser(); - - // logic cannot be replicated, until the whole hierarchy is replicated. - m_logicHierarchicalGameObjects.push_back(newobj); - //replicate controllers of this node - SGControllerList scenegraphcontrollers = orgobj->GetSGNode()->GetSGControllerList(); - replicanode->RemoveAllControllers(); - SGControllerList::iterator cit; - //int numcont = scenegraphcontrollers.size(); - - for (cit = scenegraphcontrollers.begin();!(cit==scenegraphcontrollers.end());++cit) - { - // controller replication is quite complicated - // only replicate ipo and physics controller for now - - SG_Controller* replicacontroller = (*cit)->GetReplica((SG_Node*) replicanode); - if (replicacontroller) - { - replicacontroller->SetObject(replicanode); - replicanode->AddSGController(replicacontroller); - } - } - // replicate graphic controller - if (orgobj->GetGraphicController()) - { - PHY_IMotionState* motionstate = new KX_MotionState(newobj->GetSGNode()); - PHY_IGraphicController* newctrl = orgobj->GetGraphicController()->GetReplica(motionstate); - newctrl->setNewClientInfo(newobj->getClientInfo()); - newobj->SetGraphicController(newctrl); - } - return newobj; -} - - - -// before calling this method KX_Scene::ReplicateLogic(), make sure to -// have called 'GameObject::ReParentLogic' for each object this -// hierarchy that's because first ALL bricks must exist in the new -// replica of the hierarchy in order to make cross-links work properly -// ! -// It is VERY important that the order of sensors and actuators in -// the replicated object is preserved: it is used to reconnect the logic. -// This method is more robust then using the bricks name in case of complex -// group replication. The replication of logic bricks is done in -// SCA_IObject::ReParentLogic(), make sure it preserves the order of the bricks. -void KX_Scene::ReplicateLogic(KX_GameObject* newobj) -{ - // also relink the controller to sensors/actuators - SCA_ControllerList& controllers = newobj->GetControllers(); - //SCA_SensorList& sensors = newobj->GetSensors(); - //SCA_ActuatorList& actuators = newobj->GetActuators(); - - for (SCA_ControllerList::iterator itc = controllers.begin(); !(itc==controllers.end());itc++) - { - SCA_IController* cont = (*itc); - cont->SetUeberExecutePriority(m_ueberExecutionPriority); - vector linkedsensors = cont->GetLinkedSensors(); - vector linkedactuators = cont->GetLinkedActuators(); - - // disconnect the sensors and actuators - // do it directly on the list at this controller is not connected to anything at this stage - cont->GetLinkedSensors().clear(); - cont->GetLinkedActuators().clear(); - - // now relink each sensor - for (vector::iterator its = linkedsensors.begin();!(its==linkedsensors.end());its++) - { - SCA_ISensor* oldsensor = (*its); - SCA_IObject* oldsensorobj = oldsensor->GetParent(); - SCA_IObject* newsensorobj = NULL; - - // the original owner of the sensor has been replicated? - void **h_obj = m_map_gameobject_to_replica[oldsensorobj]; - if (h_obj) - newsensorobj = (SCA_IObject*)(*h_obj); - if (!newsensorobj) - { - // no, then the sensor points outside the hierachy, keep it the same - if (m_objectlist->SearchValue(oldsensorobj)) - // only replicate links that points to active objects - m_logicmgr->RegisterToSensor(cont,oldsensor); - } - else - { - // yes, then the new sensor has the same position - SCA_SensorList& sensorlist = oldsensorobj->GetSensors(); - SCA_SensorList::iterator sit; - SCA_ISensor* newsensor = NULL; - int sensorpos; - - for (sensorpos=0, sit=sensorlist.begin(); sit!=sensorlist.end(); sit++, sensorpos++) - { - if ((*sit) == oldsensor) - { - newsensor = newsensorobj->GetSensors().at(sensorpos); - break; - } - } - assert(newsensor != NULL); - m_logicmgr->RegisterToSensor(cont,newsensor); - } - } - - // now relink each actuator - for (vector::iterator ita = linkedactuators.begin();!(ita==linkedactuators.end());ita++) - { - SCA_IActuator* oldactuator = (*ita); - SCA_IObject* oldactuatorobj = oldactuator->GetParent(); - SCA_IObject* newactuatorobj = NULL; - - // the original owner of the sensor has been replicated? - void **h_obj = m_map_gameobject_to_replica[oldactuatorobj]; - if (h_obj) - newactuatorobj = (SCA_IObject*)(*h_obj); - - if (!newactuatorobj) - { - // no, then the sensor points outside the hierachy, keep it the same - if (m_objectlist->SearchValue(oldactuatorobj)) - // only replicate links that points to active objects - m_logicmgr->RegisterToActuator(cont,oldactuator); - } - else - { - // yes, then the new sensor has the same position - SCA_ActuatorList& actuatorlist = oldactuatorobj->GetActuators(); - SCA_ActuatorList::iterator ait; - SCA_IActuator* newactuator = NULL; - int actuatorpos; - - for (actuatorpos=0, ait=actuatorlist.begin(); ait!=actuatorlist.end(); ait++, actuatorpos++) - { - if ((*ait) == oldactuator) - { - newactuator = newactuatorobj->GetActuators().at(actuatorpos); - break; - } - } - assert(newactuator != NULL); - m_logicmgr->RegisterToActuator(cont,newactuator); - newactuator->SetUeberExecutePriority(m_ueberExecutionPriority); - } - } - } - // ready to set initial state - newobj->ResetState(); -} - -void KX_Scene::DupliGroupRecurse(CValue* obj, int level) -{ - KX_GameObject* groupobj = (KX_GameObject*) obj; - KX_GameObject* replica; - KX_GameObject* gameobj; - Object* blgroupobj = groupobj->GetBlenderObject(); - Group* group; - GroupObject *go; - vector duplilist; - - if (!groupobj->GetSGNode() || - !groupobj->IsDupliGroup() || - level>MAX_DUPLI_RECUR) - return; - - // we will add one group at a time - m_logicHierarchicalGameObjects.clear(); - m_map_gameobject_to_replica.clear(); - m_ueberExecutionPriority++; - // for groups will do something special: - // we will force the creation of objects to those in the group only - // Again, this is match what Blender is doing (it doesn't care of parent relationship) - m_groupGameObjects.clear(); - - group = blgroupobj->dup_group; - for(go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) - { - Object* blenderobj = go->ob; - if (blgroupobj == blenderobj) - // this check is also in group_duplilist() - continue; - - gameobj = (KX_GameObject*)m_logicmgr->FindGameObjByBlendObj(blenderobj); - if (gameobj == NULL) - { - // this object has not been converted!!! - // Should not happen as dupli group are created automatically - continue; - } - - gameobj->SetBlenderGroupObject(blgroupobj); - - if ((blenderobj->lay & group->layer)==0) - { - // object is not visible in the 3D view, will not be instantiated - continue; - } - m_groupGameObjects.insert(gameobj); - } - - set::iterator oit; - for (oit=m_groupGameObjects.begin(); oit != m_groupGameObjects.end(); oit++) - { - gameobj = (KX_GameObject*)(*oit); - - KX_GameObject *parent = gameobj->GetParent(); - if (parent != NULL) - { - parent->Release(); // GetParent() increased the refcount - - // this object is not a top parent. Either it is the child of another - // object in the group and it will be added automatically when the parent - // is added. Or it is the child of an object outside the group and the group - // is inconsistent, skip it anyway - continue; - } - replica = (KX_GameObject*) AddNodeReplicaObject(NULL,gameobj); - // add to 'rootparent' list (this is the list of top hierarchy objects, updated each frame) - m_parentlist->Add(replica->AddRef()); - - // recurse replication into children nodes - NodeList& children = gameobj->GetSGNode()->GetSGChildren(); - - replica->GetSGNode()->ClearSGChildren(); - for (NodeList::iterator childit = children.begin();!(childit==children.end());++childit) - { - SG_Node* orgnode = (*childit); - SG_Node* childreplicanode = orgnode->GetSGReplica(); - if (childreplicanode) - replica->GetSGNode()->AddChild(childreplicanode); - } - // don't replicate logic now: we assume that the objects in the group can have - // logic relationship, even outside parent relationship - // In order to match 3D view, the position of groupobj is used as a - // transformation matrix instead of the new position. This means that - // the group reference point is 0,0,0 - - // get the rootnode's scale - MT_Vector3 newscale = groupobj->NodeGetWorldScaling(); - // set the replica's relative scale with the rootnode's scale - replica->NodeSetRelativeScale(newscale); - - MT_Point3 offset(group->dupli_ofs); - MT_Point3 newpos = groupobj->NodeGetWorldPosition() + - newscale*(groupobj->NodeGetWorldOrientation() * (gameobj->NodeGetWorldPosition()-offset)); - replica->NodeSetLocalPosition(newpos); - // set the orientation after position for softbody! - MT_Matrix3x3 newori = groupobj->NodeGetWorldOrientation() * gameobj->NodeGetWorldOrientation(); - replica->NodeSetLocalOrientation(newori); - // update scenegraph for entire tree of children - replica->GetSGNode()->UpdateWorldData(0); - replica->GetSGNode()->SetBBox(gameobj->GetSGNode()->BBox()); - replica->GetSGNode()->SetRadius(gameobj->GetSGNode()->Radius()); - // we can now add the graphic controller to the physic engine - replica->ActivateGraphicController(true); - - // done with replica - replica->Release(); - } - - // the logic must be replicated first because we need - // the new logic bricks before relinking - vector::iterator git; - for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) - { - (*git)->ReParentLogic(); - } - - // relink any pointers as necessary, sort of a temporary solution - for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) - { - // this will also relink the actuator to objects within the hierarchy - (*git)->Relink(&m_map_gameobject_to_replica); - // add the object in the layer of the parent - (*git)->SetLayer(groupobj->GetLayer()); - // If the object was a light, we need to update it's RAS_LightObject as well - if ((*git)->GetGameObjectType()==SCA_IObject::OBJ_LIGHT) - { - KX_LightObject* lightobj = static_cast(*git); - lightobj->GetLightData()->m_layer = groupobj->GetLayer(); - } - } - - // replicate crosslinks etc. between logic bricks - for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) - { - ReplicateLogic((*git)); - } - - // now look if object in the hierarchy have dupli group and recurse - for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) - { - if ((*git) != groupobj && (*git)->IsDupliGroup()) - // can't instantiate group immediately as it destroys m_logicHierarchicalGameObjects - duplilist.push_back((*git)); - } - - for (git = duplilist.begin(); !(git == duplilist.end()); ++git) - { - DupliGroupRecurse((*git), level+1); - } -} - - -SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject, - class CValue* parentobject, - int lifespan) -{ - - m_logicHierarchicalGameObjects.clear(); - m_map_gameobject_to_replica.clear(); - m_groupGameObjects.clear(); - - // todo: place a timebomb in the object, for temporarily objects :) - // lifespan of zero means 'this object lives forever' - KX_GameObject* originalobj = (KX_GameObject*) originalobject; - KX_GameObject* parentobj = (KX_GameObject*) parentobject; - - m_ueberExecutionPriority++; - - // lets create a replica - KX_GameObject* replica = (KX_GameObject*) AddNodeReplicaObject(NULL,originalobj); - - if (lifespan > 0) - { - // add a timebomb to this object - // for now, convert between so called frames and realtime - m_tempObjectList->Add(replica->AddRef()); - CValue *fval = new CFloatValue(lifespan*0.02); - replica->SetProperty("::timebomb",fval); - fval->Release(); - } - - // add to 'rootparent' list (this is the list of top hierarchy objects, updated each frame) - m_parentlist->Add(replica->AddRef()); - - // recurse replication into children nodes - - NodeList& children = originalobj->GetSGNode()->GetSGChildren(); - - replica->GetSGNode()->ClearSGChildren(); - for (NodeList::iterator childit = children.begin();!(childit==children.end());++childit) - { - SG_Node* orgnode = (*childit); - SG_Node* childreplicanode = orgnode->GetSGReplica(); - if (childreplicanode) - replica->GetSGNode()->AddChild(childreplicanode); - } - - // At this stage all the objects in the hierarchy have been duplicated, - // we can update the scenegraph, we need it for the duplication of logic - MT_Point3 newpos = ((KX_GameObject*) parentobject)->NodeGetWorldPosition(); - replica->NodeSetLocalPosition(newpos); - - MT_Matrix3x3 newori = ((KX_GameObject*) parentobject)->NodeGetWorldOrientation(); - replica->NodeSetLocalOrientation(newori); - - // get the rootnode's scale - MT_Vector3 newscale = parentobj->GetSGNode()->GetRootSGParent()->GetLocalScale(); - - // set the replica's relative scale with the rootnode's scale - replica->NodeSetRelativeScale(newscale); - - replica->GetSGNode()->UpdateWorldData(0); - replica->GetSGNode()->SetBBox(originalobj->GetSGNode()->BBox()); - replica->GetSGNode()->SetRadius(originalobj->GetSGNode()->Radius()); - // the size is correct, we can add the graphic controller to the physic engine - replica->ActivateGraphicController(true); - - // now replicate logic - vector::iterator git; - for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) - { - (*git)->ReParentLogic(); - } - - // relink any pointers as necessary, sort of a temporary solution - for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) - { - // this will also relink the actuators in the hierarchy - (*git)->Relink(&m_map_gameobject_to_replica); - // add the object in the layer of the parent - (*git)->SetLayer(parentobj->GetLayer()); - // If the object was a light, we need to update it's RAS_LightObject as well - if ((*git)->GetGameObjectType()==SCA_IObject::OBJ_LIGHT) - { - KX_LightObject* lightobj = static_cast(*git); - lightobj->GetLightData()->m_layer = parentobj->GetLayer(); - } - } - - // replicate crosslinks etc. between logic bricks - for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) - { - ReplicateLogic((*git)); - } - - // check if there are objects with dupligroup in the hierarchy - vector duplilist; - for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) - { - if ((*git)->IsDupliGroup()) - { - // separate list as m_logicHierarchicalGameObjects is also used by DupliGroupRecurse() - duplilist.push_back(*git); - } - } - for (git = duplilist.begin();!(git==duplilist.end());++git) - { - DupliGroupRecurse(*git, 0); - } - // don't release replica here because we are returning it, not done with it... - return replica; -} - - - -void KX_Scene::RemoveObject(class CValue* gameobj) -{ - KX_GameObject* newobj = (KX_GameObject*) gameobj; - - // disconnect child from parent - SG_Node* node = newobj->GetSGNode(); - - if (node) - { - node->DisconnectFromParent(); - - // recursively destruct - node->Destruct(); - } - //no need to do that: the object is destroyed and memory released - //newobj->SetSGNode(0); -} - -void KX_Scene::DelayedRemoveObject(class CValue* gameobj) -{ - //KX_GameObject* newobj = (KX_GameObject*) gameobj; - if (!m_euthanasyobjects->SearchValue(gameobj)) - { - m_euthanasyobjects->Add(gameobj->AddRef()); - } -} - - - -int KX_Scene::NewRemoveObject(class CValue* gameobj) -{ - int ret; - KX_GameObject* newobj = (KX_GameObject*) gameobj; - - /* Invalidate the python reference, since the object may exist in script lists - * its possible that it wont be automatically invalidated, so do it manually here, - * - * if for some reason the object is added back into the scene python can always get a new Proxy - */ - newobj->InvalidateProxy(); - - // keep the blender->game object association up to date - // note that all the replicas of an object will have the same - // blender object, that's why we need to check the game object - // as only the deletion of the original object must be recorded - m_logicmgr->UnregisterGameObj(newobj->GetBlenderObject(), gameobj); - - //todo: look at this - //GetPhysicsEnvironment()->RemovePhysicsController(gameobj->getPhysicsController()); - - // remove all sensors/controllers/actuators from logicsystem... - - SCA_SensorList& sensors = newobj->GetSensors(); - for (SCA_SensorList::iterator its = sensors.begin(); - !(its==sensors.end());its++) - { - m_logicmgr->RemoveSensor(*its); - } - - SCA_ControllerList& controllers = newobj->GetControllers(); - for (SCA_ControllerList::iterator itc = controllers.begin(); - !(itc==controllers.end());itc++) - { - m_logicmgr->RemoveController(*itc); - } - - SCA_ActuatorList& actuators = newobj->GetActuators(); - for (SCA_ActuatorList::iterator ita = actuators.begin(); - !(ita==actuators.end());ita++) - { - m_logicmgr->RemoveActuator(*ita); - } - // the sensors/controllers/actuators must also be released, this is done in ~SCA_IObject - - // now remove the timer properties from the time manager - int numprops = newobj->GetPropertyCount(); - - for (int i = 0; i < numprops; i++) - { - CValue* propval = newobj->GetProperty(i); - if (propval->GetProperty("timer")) - { - m_timemgr->RemoveTimeProperty(propval); - } - } - - newobj->RemoveMeshes(); - ret = 1; - if (newobj->GetGameObjectType()==SCA_IObject::OBJ_LIGHT && m_lightlist->RemoveValue(newobj)) - ret = newobj->Release(); - if (m_objectlist->RemoveValue(newobj)) - ret = newobj->Release(); - if (m_tempObjectList->RemoveValue(newobj)) - ret = newobj->Release(); - if (m_parentlist->RemoveValue(newobj)) - ret = newobj->Release(); - if (m_inactivelist->RemoveValue(newobj)) - ret = newobj->Release(); - if (m_euthanasyobjects->RemoveValue(newobj)) - ret = newobj->Release(); - - if (newobj == m_active_camera) - { - //no AddRef done on m_active_camera so no Release - //m_active_camera->Release(); - m_active_camera = NULL; - } - - // in case this is a camera - m_cameras.remove((KX_Camera*)newobj); - - /* currently does nothing, keep incase we need to Unregister something */ -#if 0 - if (m_sceneConverter) - m_sceneConverter->UnregisterGameObject(newobj); -#endif - - // return value will be 0 if the object is actually deleted (all reference gone) - - return ret; -} - - - -void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool use_phys) -{ - KX_GameObject* gameobj = static_cast(obj); - RAS_MeshObject* mesh = static_cast(meshobj); - - if(!gameobj) { - std::cout << "KX_Scene::ReplaceMesh Warning: invalid object, doing nothing" << std::endl; - return; - } - - if(use_gfx && mesh != NULL) - { - gameobj->RemoveMeshes(); - gameobj->AddMesh(mesh); - - if (gameobj->m_isDeformable) - { - BL_DeformableGameObject* newobj = static_cast( gameobj ); - - if (newobj->GetDeformer()) - { - delete newobj->GetDeformer(); - newobj->SetDeformer(NULL); - } - - if (mesh->GetMesh()) - { - // we must create a new deformer but which one? - KX_GameObject* parentobj = newobj->GetParent(); - // this always return the original game object (also for replicate) - Object* blendobj = newobj->GetBlenderObject(); - // object that owns the new mesh - Object* oldblendobj = static_cast(m_logicmgr->FindBlendObjByGameMeshName(mesh->GetName())); - Mesh* blendmesh = mesh->GetMesh(); - - bool bHasModifier = BL_ModifierDeformer::HasCompatibleDeformer(blendobj); - bool bHasShapeKey = blendmesh->key != NULL && blendmesh->key->type==KEY_RELATIVE; - bool bHasDvert = blendmesh->dvert != NULL; - bool bHasArmature = - BL_ModifierDeformer::HasArmatureDeformer(blendobj) && - parentobj && // current parent is armature - parentobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE && - oldblendobj && // needed for mesh deform - blendobj->parent && // original object had armature (not sure this test is needed) - blendobj->parent->type == OB_ARMATURE && - blendmesh->dvert!=NULL; // mesh has vertex group - bool bHasSoftBody = (!parentobj && (blendobj->gameflag & OB_SOFT_BODY)); - - bool releaseParent = true; - - - if (oldblendobj==NULL) { - if (bHasModifier || bHasShapeKey || bHasDvert || bHasArmature) { - std::cout << "warning: ReplaceMesh() new mesh is not used in an object from the current scene, you will get incorrect behavior" << std::endl; - bHasShapeKey= bHasDvert= bHasArmature=bHasModifier= false; - } - } - - if (bHasModifier) - { - BL_ModifierDeformer* modifierDeformer; - if (bHasShapeKey || bHasArmature) - { - modifierDeformer = new BL_ModifierDeformer( - newobj, - m_blenderScene, - oldblendobj, blendobj, - mesh, - true, - static_cast( parentobj ) - ); - releaseParent= false; - modifierDeformer->LoadShapeDrivers(blendobj->parent); - } - else - { - modifierDeformer = new BL_ModifierDeformer( - newobj, - m_blenderScene, - oldblendobj, blendobj, - mesh, - false, - NULL - ); - } - newobj->SetDeformer(modifierDeformer); - } - else if (bHasShapeKey) - { - BL_ShapeDeformer* shapeDeformer; - if (bHasArmature) - { - shapeDeformer = new BL_ShapeDeformer( - newobj, - oldblendobj, blendobj, - mesh, - true, - true, - static_cast( parentobj ) - ); - releaseParent= false; - shapeDeformer->LoadShapeDrivers(blendobj->parent); - } - else - { - shapeDeformer = new BL_ShapeDeformer( - newobj, - oldblendobj, blendobj, - mesh, - false, - true, - NULL - ); - } - newobj->SetDeformer( shapeDeformer); - } - else if (bHasArmature) - { - BL_SkinDeformer* skinDeformer = new BL_SkinDeformer( - newobj, - oldblendobj, blendobj, - mesh, - true, - true, - static_cast( parentobj ) - ); - releaseParent= false; - newobj->SetDeformer(skinDeformer); - } - else if (bHasDvert) - { - BL_MeshDeformer* meshdeformer = new BL_MeshDeformer( - newobj, oldblendobj, mesh - ); - newobj->SetDeformer(meshdeformer); - } - else if (bHasSoftBody) - { - KX_SoftBodyDeformer *softdeformer = new KX_SoftBodyDeformer(mesh, newobj); - newobj->SetDeformer(softdeformer); - } - - // release parent reference if its not being used - if( releaseParent && parentobj) - parentobj->Release(); - } - } - - gameobj->AddMeshUser(); - } - - if(use_phys) { /* update the new assigned mesh with the physics mesh */ - KX_ReInstanceBulletShapeFromMesh(gameobj, NULL, use_gfx?NULL:mesh); - } -} - -KX_Camera* KX_Scene::FindCamera(KX_Camera* cam) -{ - list::iterator it = m_cameras.begin(); - - while ( (it != m_cameras.end()) - && ((*it) != cam) ) { - it++; - } - - return ((it == m_cameras.end()) ? NULL : (*it)); -} - - -KX_Camera* KX_Scene::FindCamera(STR_String& name) -{ - list::iterator it = m_cameras.begin(); - - while ( (it != m_cameras.end()) - && ((*it)->GetName() != name) ) { - it++; - } - - return ((it == m_cameras.end()) ? NULL : (*it)); -} - -void KX_Scene::AddCamera(KX_Camera* cam) -{ - if (!FindCamera(cam)) - m_cameras.push_back(cam); -} - - -KX_Camera* KX_Scene::GetActiveCamera() -{ - // NULL if not defined - return m_active_camera; -} - - -void KX_Scene::SetActiveCamera(KX_Camera* cam) -{ - // only set if the cam is in the active list? Or add it otherwise? - if (!FindCamera(cam)){ - AddCamera(cam); - if (cam) std::cout << "Added cam " << cam->GetName() << std::endl; - } - - m_active_camera = cam; -} - -void KX_Scene::SetCameraOnTop(KX_Camera* cam) -{ - if (!FindCamera(cam)){ - // adding is always done at the back, so that's all that needs to be done - AddCamera(cam); - if (cam) std::cout << "Added cam " << cam->GetName() << std::endl; - } else { - m_cameras.remove(cam); - m_cameras.push_back(cam); - } -} - - -void KX_Scene::UpdateMeshTransformations() -{ - // do this incrementally in the future - for (int i = 0; i < m_objectlist->GetCount(); i++) - { - KX_GameObject* gameobj = (KX_GameObject*)m_objectlist->GetValue(i); - gameobj->GetOpenGLMatrix(); - } -} - -void KX_Scene::MarkVisible(SG_Tree *node, RAS_IRasterizer* rasty, KX_Camera* cam, int layer) -{ - int intersect = KX_Camera::INTERSECT; - KX_GameObject *gameobj = node->Client()?(KX_GameObject*) node->Client()->GetSGClientObject():NULL; - bool visible = (gameobj && gameobj->GetVisible() && (!layer || (gameobj->GetLayer() & layer))); - bool dotest = visible || node->Left() || node->Right(); - - /* If the camera is inside the box, assume intersect. */ - if (dotest && !node->inside( cam->NodeGetWorldPosition())) - { - MT_Scalar radius = node->Radius(); - MT_Point3 center = node->Center(); - - intersect = cam->SphereInsideFrustum(center, radius); - - if (intersect == KX_Camera::INTERSECT) - { - MT_Point3 box[8]; - node->get(box); - intersect = cam->BoxInsideFrustum(box); - } - } - - switch (intersect) - { - case KX_Camera::OUTSIDE: - MarkSubTreeVisible(node, rasty, false, cam); - break; - case KX_Camera::INTERSECT: - if (gameobj) - MarkVisible(rasty, gameobj, cam, layer); - if (node->Left()) - MarkVisible(node->Left(), rasty, cam, layer); - if (node->Right()) - MarkVisible(node->Right(), rasty, cam, layer); - break; - case KX_Camera::INSIDE: - MarkSubTreeVisible(node, rasty, true, cam, layer); - break; - } -} - -void KX_Scene::MarkSubTreeVisible(SG_Tree *node, RAS_IRasterizer* rasty, bool visible, KX_Camera* cam, int layer) -{ - if (node->Client()) - { - KX_GameObject *gameobj = (KX_GameObject*) node->Client()->GetSGClientObject(); - if (gameobj->GetVisible()) - { - if (visible) - { - int nummeshes = gameobj->GetMeshCount(); - - // this adds the vertices to the display list - for (int m=0;mGetMesh(m))->SchedulePolygons(rasty->GetDrawingMode()); - } - - gameobj->SetCulled(!visible); - gameobj->UpdateBuckets(false); - } - } - if (node->Left()) - MarkSubTreeVisible(node->Left(), rasty, visible, cam, layer); - if (node->Right()) - MarkSubTreeVisible(node->Right(), rasty, visible, cam, layer); -} - -void KX_Scene::MarkVisible(RAS_IRasterizer* rasty, KX_GameObject* gameobj,KX_Camera* cam,int layer) -{ - // User (Python/Actuator) has forced object invisible... - if (!gameobj->GetSGNode() || !gameobj->GetVisible()) - return; - - // Shadow lamp layers - if(layer && !(gameobj->GetLayer() & layer)) { - gameobj->SetCulled(true); - gameobj->UpdateBuckets(false); - return; - } - - // If Frustum culling is off, the object is always visible. - bool vis = !cam->GetFrustumCulling(); - - // If the camera is inside this node, then the object is visible. - if (!vis) - { - vis = gameobj->GetSGNode()->inside( cam->GetCameraLocation() ); - } - - // Test the object's bound sphere against the view frustum. - if (!vis) - { - MT_Vector3 scale = gameobj->GetSGNode()->GetWorldScaling(); - MT_Scalar radius = fabs(scale[scale.closestAxis()] * gameobj->GetSGNode()->Radius()); - switch (cam->SphereInsideFrustum(gameobj->NodeGetWorldPosition(), radius)) - { - case KX_Camera::INSIDE: - vis = true; - break; - case KX_Camera::OUTSIDE: - vis = false; - break; - case KX_Camera::INTERSECT: - // Test the object's bound box against the view frustum. - MT_Point3 box[8]; - gameobj->GetSGNode()->getBBox(box); - vis = cam->BoxInsideFrustum(box) != KX_Camera::OUTSIDE; - break; - } - } - - if (vis) - { - int nummeshes = gameobj->GetMeshCount(); - - for (int m=0;mGetMesh(m))->SchedulePolygons(rasty->GetDrawingMode()); - } - // Visibility/ non-visibility are marked - // elsewhere now. - gameobj->SetCulled(false); - gameobj->UpdateBuckets(false); - } else { - gameobj->SetCulled(true); - gameobj->UpdateBuckets(false); - } -} - -void KX_Scene::PhysicsCullingCallback(KX_ClientObjectInfo* objectInfo, void* cullingInfo) -{ - KX_GameObject* gameobj = objectInfo->m_gameobject; - if (!gameobj->GetVisible()) - // ideally, invisible objects should be removed from the culling tree temporarily - return; - if(((CullingInfo*)cullingInfo)->m_layer && !(gameobj->GetLayer() & ((CullingInfo*)cullingInfo)->m_layer)) - // used for shadow: object is not in shadow layer - return; - - // make object visible - gameobj->SetCulled(false); - gameobj->UpdateBuckets(false); -} - -void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* rasty,KX_Camera* cam, int layer) -{ - bool dbvt_culling = false; - if (m_dbvt_culling) - { - // test culling through Bullet - PHY__Vector4 planes[6]; - // get the clip planes - MT_Vector4* cplanes = cam->GetNormalizedClipPlanes(); - // and convert - planes[0].setValue(cplanes[4].getValue()); // near - planes[1].setValue(cplanes[5].getValue()); // far - planes[2].setValue(cplanes[0].getValue()); // left - planes[3].setValue(cplanes[1].getValue()); // right - planes[4].setValue(cplanes[2].getValue()); // top - planes[5].setValue(cplanes[3].getValue()); // bottom - CullingInfo info(layer); - dbvt_culling = m_physicsEnvironment->cullingTest(PhysicsCullingCallback,&info,planes,5,m_dbvt_occlusion_res); - } - if (!dbvt_culling) { - // the physics engine couldn't help us, do it the hard way - for (int i = 0; i < m_objectlist->GetCount(); i++) - { - MarkVisible(rasty, static_cast(m_objectlist->GetValue(i)), cam, layer); - } - } -} - -// logic stuff -void KX_Scene::LogicBeginFrame(double curtime) -{ - // have a look at temp objects ... - int lastobj = m_tempObjectList->GetCount() - 1; - - for (int i = lastobj; i >= 0; i--) - { - CValue* objval = m_tempObjectList->GetValue(i); - CFloatValue* propval = (CFloatValue*) objval->GetProperty("::timebomb"); - - if (propval) - { - float timeleft = propval->GetNumber() - 1.0/KX_KetsjiEngine::GetTicRate(); - - if (timeleft > 0) - { - propval->SetFloat(timeleft); - } - else - { - DelayedRemoveObject(objval); - // remove obj - } - } - else - { - // all object is the tempObjectList should have a clock - } - } - m_logicmgr->BeginFrame(curtime, 1.0/KX_KetsjiEngine::GetTicRate()); -} - - - -void KX_Scene::LogicUpdateFrame(double curtime, bool frame) -{ - m_logicmgr->UpdateFrame(curtime, frame); -} - - - -void KX_Scene::LogicEndFrame() -{ - m_logicmgr->EndFrame(); - int numobj = m_euthanasyobjects->GetCount(); - - KX_GameObject* obj; - - while ((numobj = m_euthanasyobjects->GetCount()) > 0) - { - // remove the object from this list to make sure we will not hit it again - obj = (KX_GameObject*)m_euthanasyobjects->GetValue(numobj-1); - m_euthanasyobjects->Remove(numobj-1); - obj->Release(); - RemoveObject(obj); - } -} - - - -/** - * UpdateParents: SceneGraph transformation update. - */ -void KX_Scene::UpdateParents(double curtime) -{ - // we use the SG dynamic list - SG_Node* node; - - while ((node = SG_Node::GetNextScheduled(m_sghead)) != NULL) - { - node->UpdateWorldData(curtime); - } - - //for (int i=0; iGetCount(); i++) - //{ - // KX_GameObject* parentobj = (KX_GameObject*)GetRootParentList()->GetValue(i); - // parentobj->NodeUpdateGS(curtime); - //} - - // the list must be empty here - assert(m_sghead.Empty()); - // some nodes may be ready for reschedule, move them to schedule list for next time - while ((node = SG_Node::GetNextRescheduled(m_sghead)) != NULL) - { - node->Schedule(m_sghead); - } -} - - -RAS_MaterialBucket* KX_Scene::FindBucket(class RAS_IPolyMaterial* polymat, bool &bucketCreated) -{ - return m_bucketmanager->FindBucket(polymat, bucketCreated); -} - - - -void KX_Scene::RenderBuckets(const MT_Transform & cameratransform, - class RAS_IRasterizer* rasty, - class RAS_IRenderTools* rendertools) -{ - m_bucketmanager->Renderbuckets(cameratransform,rasty,rendertools); - KX_BlenderMaterial::EndFrame(); -} - -void KX_Scene::UpdateObjectActivity(void) -{ - if (m_activity_culling) { - /* determine the activity criterium and set objects accordingly */ - int i=0; - - MT_Point3 camloc = GetActiveCamera()->NodeGetWorldPosition(); //GetCameraLocation(); - - for (i=0;iGetCount();i++) - { - KX_GameObject* ob = (KX_GameObject*) GetObjectList()->GetValue(i); - - if (!ob->GetIgnoreActivityCulling()) { - /* Simple test: more than 10 away from the camera, count - * Manhattan distance. */ - MT_Point3 obpos = ob->NodeGetWorldPosition(); - - if ( (fabs(camloc[0] - obpos[0]) > m_activity_box_radius) - || (fabs(camloc[1] - obpos[1]) > m_activity_box_radius) - || (fabs(camloc[2] - obpos[2]) > m_activity_box_radius) ) - { - ob->Suspend(); - } else { - ob->Resume(); - } - } - } - } -} - -void KX_Scene::SetActivityCullingRadius(float f) -{ - if (f < 0.5) - f = 0.5; - m_activity_box_radius = f; -} - -NG_NetworkDeviceInterface* KX_Scene::GetNetworkDeviceInterface() -{ - return m_networkDeviceInterface; -} - -NG_NetworkScene* KX_Scene::GetNetworkScene() -{ - return m_networkScene; -} - -void KX_Scene::SetNetworkDeviceInterface(NG_NetworkDeviceInterface* newInterface) -{ - m_networkDeviceInterface = newInterface; -} - -void KX_Scene::SetNetworkScene(NG_NetworkScene *newScene) -{ - m_networkScene = newScene; -} - - -void KX_Scene::SetGravity(const MT_Vector3& gravity) -{ - GetPhysicsEnvironment()->setGravity(gravity[0],gravity[1],gravity[2]); -} - -void KX_Scene::SetSceneConverter(class KX_BlenderSceneConverter* sceneConverter) -{ - m_sceneConverter = sceneConverter; -} - -void KX_Scene::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* physEnv) -{ - m_physicsEnvironment = physEnv; - if(m_physicsEnvironment) { - KX_TouchEventManager* touchmgr = new KX_TouchEventManager(m_logicmgr, physEnv); - m_logicmgr->RegisterEventManager(touchmgr); - } -} - -void KX_Scene::setSuspendedTime(double suspendedtime) -{ - m_suspendedtime = suspendedtime; -} -double KX_Scene::getSuspendedTime() -{ - return m_suspendedtime; -} -void KX_Scene::setSuspendedDelta(double suspendeddelta) -{ - m_suspendeddelta = suspendeddelta; -} -double KX_Scene::getSuspendedDelta() -{ - return m_suspendeddelta; -} - -#include "KX_BulletPhysicsController.h" - -static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) -{ - SCA_LogicManager *logicmgr= to->GetLogicManager(); - - brick->Replace_IScene(to); - brick->Replace_NetworkScene(to->GetNetworkScene()); - - SCA_ISensor *sensor= dynamic_cast(brick); - if(sensor) { - sensor->Replace_EventManager(logicmgr); - } - - /* near sensors have physics controllers */ - KX_TouchSensor *touch_sensor = dynamic_cast(brick); - if(touch_sensor) { - touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); - } -} - -#include "CcdGraphicController.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); -#include "CcdPhysicsEnvironment.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); -#include "KX_BulletPhysicsController.h" - - -static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene *from) -{ - { - SCA_ActuatorList& actuators= gameobj->GetActuators(); - SCA_ActuatorList::iterator ita; - - for (ita = actuators.begin(); !(ita==actuators.end()); ++ita) - { - MergeScene_LogicBrick(*ita, to); - } - } - - - { - SCA_SensorList& sensors= gameobj->GetSensors(); - SCA_SensorList::iterator its; - - for (its = sensors.begin(); !(its==sensors.end()); ++its) - { - MergeScene_LogicBrick(*its, to); - } - } - - { - SCA_ControllerList& controllers= gameobj->GetControllers(); - SCA_ControllerList::iterator itc; - - for (itc = controllers.begin(); !(itc==controllers.end()); ++itc) - { - SCA_IController *cont= *itc; - MergeScene_LogicBrick(cont, to); - - vector linkedsensors = cont->GetLinkedSensors(); - vector linkedactuators = cont->GetLinkedActuators(); - - for (vector::iterator ita = linkedactuators.begin();!(ita==linkedactuators.end());++ita) { - MergeScene_LogicBrick(*ita, to); - } - - for (vector::iterator its = linkedsensors.begin();!(its==linkedsensors.end());++its) { - MergeScene_LogicBrick(*its, to); - } - } - } - - /* graphics controller */ - PHY_IGraphicController *ctrl = gameobj->GetGraphicController(); - if(ctrl) { - /* SHOULD update the m_cullingTree */ - ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); - } - - /* SG_Node can hold a scene reference */ - SG_Node *sg= gameobj->GetSGNode(); - if(sg) { - if(sg->GetSGClientInfo() == from) { - sg->SetSGClientInfo(to); - } - - SGControllerList::iterator contit; - SGControllerList& controllers = sg->GetSGControllerList(); - for (contit = controllers.begin();contit!=controllers.end();++contit) - { - KX_BulletPhysicsController *phys_ctrl= dynamic_cast(*contit); - if (phys_ctrl) - phys_ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); - } - } - /* If the object is a light, update it's scene */ - if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) - ((KX_LightObject*)gameobj)->UpdateScene(to); - - /* Add the object to the scene's logic manager */ - to->GetLogicManager()->RegisterGameObjectName(gameobj->GetName(), gameobj); - to->GetLogicManager()->RegisterGameObj(gameobj->GetBlenderObject(), gameobj); - - for (int i=0; iGetMeshCount(); ++i) - to->GetLogicManager()->RegisterGameMeshName(gameobj->GetMesh(i)->GetName(), gameobj->GetBlenderObject()); -} - -bool KX_Scene::MergeScene(KX_Scene *other) -{ - CcdPhysicsEnvironment *env= dynamic_cast(this->GetPhysicsEnvironment()); - CcdPhysicsEnvironment *env_other= dynamic_cast(other->GetPhysicsEnvironment()); - - if((env==NULL) != (env_other==NULL)) /* TODO - even when both scenes have NONE physics, the other is loaded with bullet enabled, ??? */ - { - printf("KX_Scene::MergeScene: physics scenes type differ, aborting\n"); - printf("\tsource %d, terget %d\n", (int)(env!=NULL), (int)(env_other!=NULL)); - return false; - } - - if(GetSceneConverter() != other->GetSceneConverter()) { - printf("KX_Scene::MergeScene: converters differ, aborting\n"); - return false; - } - - - GetBucketManager()->MergeBucketManager(other->GetBucketManager()); - - /* move materials across, assume they both use the same scene-converters */ - GetSceneConverter()->MergeScene(this, other); - - /* active + inactive == all ??? - lets hope so */ - for (int i = 0; i < other->GetObjectList()->GetCount(); i++) - { - KX_GameObject* gameobj = (KX_GameObject*)other->GetObjectList()->GetValue(i); - MergeScene_GameObject(gameobj, this, other); - - gameobj->UpdateBuckets(false); /* only for active objects */ - } - - for (int i = 0; i < other->GetInactiveList()->GetCount(); i++) - { - KX_GameObject* gameobj = (KX_GameObject*)other->GetInactiveList()->GetValue(i); - MergeScene_GameObject(gameobj, this, other); - } - - GetTempObjectList()->MergeList(other->GetTempObjectList()); - other->GetTempObjectList()->ReleaseAndRemoveAll(); - - GetObjectList()->MergeList(other->GetObjectList()); - other->GetObjectList()->ReleaseAndRemoveAll(); - - GetInactiveList()->MergeList(other->GetInactiveList()); - other->GetInactiveList()->ReleaseAndRemoveAll(); - - GetRootParentList()->MergeList(other->GetRootParentList()); - other->GetRootParentList()->ReleaseAndRemoveAll(); - - GetLightList()->MergeList(other->GetLightList()); - other->GetLightList()->ReleaseAndRemoveAll(); - - if(env) /* bullet scene? - dummy scenes dont need touching */ - env->MergeEnvironment(env_other); - - /* merge logic */ - { - SCA_LogicManager *logicmgr= GetLogicManager(); - SCA_LogicManager *logicmgr_other= other->GetLogicManager(); - - vectorevtmgrs= logicmgr->GetEventManagers(); - //vectorevtmgrs_others= logicmgr_other->GetEventManagers(); - - //SCA_EventManager *evtmgr; - SCA_EventManager *evtmgr_other; - - for(unsigned int i= 0; i < evtmgrs.size(); i++) { - evtmgr_other= logicmgr_other->FindEventManager(evtmgrs[i]->GetType()); - - if(evtmgr_other) /* unlikely but possible one scene has a joystick and not the other */ - evtmgr_other->Replace_LogicManager(logicmgr); - - /* when merging objects sensors are moved across into the new manager, dont need to do this here */ - } - } - return true; -} - -void KX_Scene::Update2DFilter(vector& propNames, void* gameObj, RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, int pass, STR_String& text) -{ - m_filtermanager.EnableFilter(propNames, gameObj, filtermode, pass, text); -} - -void KX_Scene::Render2DFilters(RAS_ICanvas* canvas) -{ - m_filtermanager.RenderFilters(canvas); -} - -#ifndef DISABLE_PYTHON - -void KX_Scene::RunDrawingCallbacks(PyObject* cb_list) -{ - int len; - - if (cb_list && (len=PyList_GET_SIZE(cb_list))) - { - PyObject* args= PyTuple_New(0); // save python creating each call - PyObject* func; - PyObject* ret; - - // Iterate the list and run the callbacks - for (int pos=0; pos < len; pos++) - { - func= PyList_GET_ITEM(cb_list, pos); - ret= PyObject_Call(func, args, NULL); - if (ret==NULL) { - PyErr_Print(); - PyErr_Clear(); - } - else { - Py_DECREF(ret); - } - } - - Py_DECREF(args); - } -} - -//---------------------------------------------------------------------------- -//Python - -PyTypeObject KX_Scene::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_Scene", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0, - &Sequence, - &Mapping, - 0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &CValue::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_Scene::Methods[] = { - KX_PYMETHODTABLE(KX_Scene, addObject), - KX_PYMETHODTABLE(KX_Scene, end), - KX_PYMETHODTABLE(KX_Scene, restart), - KX_PYMETHODTABLE(KX_Scene, replace), - KX_PYMETHODTABLE(KX_Scene, suspend), - KX_PYMETHODTABLE(KX_Scene, resume), - - /* dict style access */ - KX_PYMETHODTABLE(KX_Scene, get), - - {NULL,NULL} //Sentinel -}; -static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) -{ - KX_Scene* self= static_castBGE_PROXY_REF(self_v); - const char *attr_str= _PyUnicode_AsString(item); - PyObject* pyconvert; - - if (self==NULL) { - PyErr_SetString(PyExc_SystemError, "val = scene[key]: KX_Scene, "BGE_PROXY_ERROR_MSG); - return NULL; - } - - if (self->m_attr_dict && (pyconvert=PyDict_GetItem(self->m_attr_dict, item))) { - - if (attr_str) - PyErr_Clear(); - Py_INCREF(pyconvert); - return pyconvert; - } - else { - if(attr_str) PyErr_Format(PyExc_KeyError, "value = scene[key]: KX_Scene, key \"%s\" does not exist", attr_str); - else PyErr_SetString(PyExc_KeyError, "value = scene[key]: KX_Scene, key does not exist"); - return NULL; - } - -} - -static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) -{ - KX_Scene* self= static_castBGE_PROXY_REF(self_v); - const char *attr_str= _PyUnicode_AsString(key); - if(attr_str==NULL) - PyErr_Clear(); - - if (self==NULL) { - PyErr_SetString(PyExc_SystemError, "scene[key] = value: KX_Scene, "BGE_PROXY_ERROR_MSG); - return -1; - } - - if (val==NULL) { /* del ob["key"] */ - int del= 0; - - if(self->m_attr_dict) - del |= (PyDict_DelItem(self->m_attr_dict, key)==0) ? 1:0; - - if (del==0) { - if(attr_str) PyErr_Format(PyExc_KeyError, "scene[key] = value: KX_Scene, key \"%s\" could not be set", attr_str); - else PyErr_SetString(PyExc_KeyError, "del scene[key]: KX_Scene, key could not be deleted"); - return -1; - } - else if (self->m_attr_dict) { - PyErr_Clear(); /* PyDict_DelItem sets an error when it fails */ - } - } - else { /* ob["key"] = value */ - int set = 0; - - if (self->m_attr_dict==NULL) /* lazy init */ - self->m_attr_dict= PyDict_New(); - - - if(PyDict_SetItem(self->m_attr_dict, key, val)==0) - set= 1; - else - PyErr_SetString(PyExc_KeyError, "scene[key] = value: KX_Scene, key not be added to internal dictionary"); - - if(set==0) - return -1; /* pythons error value */ - - } - - return 0; /* success */ -} - -static int Seq_Contains(PyObject *self_v, PyObject *value) -{ - KX_Scene* self= static_castBGE_PROXY_REF(self_v); - - if (self==NULL) { - PyErr_SetString(PyExc_SystemError, "val in scene: KX_Scene, "BGE_PROXY_ERROR_MSG); - return -1; - } - - if (self->m_attr_dict && PyDict_GetItem(self->m_attr_dict, value)) - return 1; - - return 0; -} - -PyMappingMethods KX_Scene::Mapping = { - (lenfunc)NULL , /*inquiry mp_length */ - (binaryfunc)Map_GetItem, /*binaryfunc mp_subscript */ - (objobjargproc)Map_SetItem, /*objobjargproc mp_ass_subscript */ -}; - -PySequenceMethods KX_Scene::Sequence = { - NULL, /* Cant set the len otherwise it can evaluate as false */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - NULL, /* sq_item */ - NULL, /* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* sq_ass_slice */ - (objobjproc)Seq_Contains, /* sq_contains */ - (binaryfunc) NULL, /* sq_inplace_concat */ - (ssizeargfunc) NULL, /* sq_inplace_repeat */ -}; - -PyObject* KX_Scene::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Scene* self= static_cast(self_v); - return PyUnicode_FromString(self->GetName().ReadPtr()); -} - -PyObject* KX_Scene::pyattr_get_objects(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Scene* self= static_cast(self_v); - return self->GetObjectList()->GetProxy(); -} - -PyObject* KX_Scene::pyattr_get_objects_inactive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Scene* self= static_cast(self_v); - return self->GetInactiveList()->GetProxy(); -} - -PyObject* KX_Scene::pyattr_get_lights(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Scene* self= static_cast(self_v); - return self->GetLightList()->GetProxy(); -} - -PyObject* KX_Scene::pyattr_get_cameras(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - /* With refcounts in this case... - * the new CListValue is owned by python, so its possible python holds onto it longer then the BGE - * however this is the same with "scene.objects + []", when you make a copy by adding lists. - */ - - KX_Scene* self= static_cast(self_v); - CListValue* clist = new CListValue(); - - /* return self->GetCameras()->GetProxy(); */ - - list::iterator it = self->GetCameras()->begin(); - while (it != self->GetCameras()->end()) { - clist->Add((*it)->AddRef()); - it++; - } - - return clist->NewProxy(true); -} - -PyObject* KX_Scene::pyattr_get_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Scene* self= static_cast(self_v); - return self->GetActiveCamera()->GetProxy(); -} - - -int KX_Scene::pyattr_set_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_Scene* self= static_cast(self_v); - KX_Camera *camOb; - - if (!ConvertPythonToCamera(value, &camOb, false, "scene.active_camera = value: KX_Scene")) - return PY_SET_ATTR_FAIL; - - self->SetActiveCamera(camOb); - return PY_SET_ATTR_SUCCESS; -} - -PyObject* KX_Scene::pyattr_get_drawing_callback_pre(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Scene* self = static_cast(self_v); - - if(self->m_draw_call_pre==NULL) - self->m_draw_call_pre= PyList_New(0); - else - Py_INCREF(self->m_draw_call_pre); - return self->m_draw_call_pre; -} - -PyObject* KX_Scene::pyattr_get_drawing_callback_post(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_Scene* self = static_cast(self_v); - - if(self->m_draw_call_post==NULL) - self->m_draw_call_post= PyList_New(0); - else - Py_INCREF(self->m_draw_call_post); - return self->m_draw_call_post; -} - -int KX_Scene::pyattr_set_drawing_callback_pre(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_Scene* self = static_cast(self_v); - - if (!PyList_CheckExact(value)) - { - PyErr_SetString(PyExc_ValueError, "Expected a list"); - return PY_SET_ATTR_FAIL; - } - Py_XDECREF(self->m_draw_call_pre); - - Py_INCREF(value); - self->m_draw_call_pre = value; - - return PY_SET_ATTR_SUCCESS; -} - -int KX_Scene::pyattr_set_drawing_callback_post(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_Scene* self = static_cast(self_v); - - if (!PyList_CheckExact(value)) - { - PyErr_SetString(PyExc_ValueError, "Expected a list"); - return PY_SET_ATTR_FAIL; - } - Py_XDECREF(self->m_draw_call_post); - - Py_INCREF(value); - self->m_draw_call_post = value; - - return PY_SET_ATTR_SUCCESS; -} - -PyAttributeDef KX_Scene::Attributes[] = { - KX_PYATTRIBUTE_RO_FUNCTION("name", KX_Scene, pyattr_get_name), - KX_PYATTRIBUTE_RO_FUNCTION("objects", KX_Scene, pyattr_get_objects), - KX_PYATTRIBUTE_RO_FUNCTION("objectsInactive", KX_Scene, pyattr_get_objects_inactive), - KX_PYATTRIBUTE_RO_FUNCTION("lights", KX_Scene, pyattr_get_lights), - KX_PYATTRIBUTE_RO_FUNCTION("cameras", KX_Scene, pyattr_get_cameras), - KX_PYATTRIBUTE_RO_FUNCTION("lights", KX_Scene, pyattr_get_lights), - KX_PYATTRIBUTE_RW_FUNCTION("active_camera", KX_Scene, pyattr_get_active_camera, pyattr_set_active_camera), - KX_PYATTRIBUTE_RW_FUNCTION("pre_draw", KX_Scene, pyattr_get_drawing_callback_pre, pyattr_set_drawing_callback_pre), - KX_PYATTRIBUTE_RW_FUNCTION("post_draw", KX_Scene, pyattr_get_drawing_callback_post, pyattr_set_drawing_callback_post), - KX_PYATTRIBUTE_BOOL_RO("suspended", KX_Scene, m_suspend), - KX_PYATTRIBUTE_BOOL_RO("activity_culling", KX_Scene, m_activity_culling), - KX_PYATTRIBUTE_FLOAT_RW("activity_culling_radius", 0.5f, FLT_MAX, KX_Scene, m_activity_box_radius), - KX_PYATTRIBUTE_BOOL_RO("dbvt_culling", KX_Scene, m_dbvt_culling), - { NULL } //Sentinel -}; - -KX_PYMETHODDEF_DOC(KX_Scene, addObject, -"addObject(object, other, time=0)\n" -"Returns the added object.\n") -{ - PyObject *pyob, *pyother; - KX_GameObject *ob, *other; - - int time = 0; - - if (!PyArg_ParseTuple(args, "OO|i:addObject", &pyob, &pyother, &time)) - return NULL; - - if ( !ConvertPythonToGameObject(pyob, &ob, false, "scene.addObject(object, other, time): KX_Scene (first argument)") || - !ConvertPythonToGameObject(pyother, &other, false, "scene.addObject(object, other, time): KX_Scene (second argument)") ) - return NULL; - - - SCA_IObject* replica = AddReplicaObject((SCA_IObject*)ob, other, time); - - // release here because AddReplicaObject AddRef's - // the object is added to the scene so we dont want python to own a reference - replica->Release(); - return replica->GetProxy(); -} - -KX_PYMETHODDEF_DOC(KX_Scene, end, -"end()\n" -"Removes this scene from the game.\n") -{ - - KX_GetActiveEngine()->RemoveScene(m_sceneName); - - Py_RETURN_NONE; -} - -KX_PYMETHODDEF_DOC(KX_Scene, restart, - "restart()\n" - "Restarts this scene.\n") -{ - KX_GetActiveEngine()->ReplaceScene(m_sceneName, m_sceneName); - - Py_RETURN_NONE; -} - -KX_PYMETHODDEF_DOC(KX_Scene, replace, - "replace(newScene)\n" - "Replaces this scene with another one.\n") -{ - char* name; - - if (!PyArg_ParseTuple(args, "s:replace", &name)) - return NULL; - - KX_GetActiveEngine()->ReplaceScene(m_sceneName, name); - - Py_RETURN_NONE; -} - -KX_PYMETHODDEF_DOC(KX_Scene, suspend, - "suspend()\n" - "Suspends this scene.\n") -{ - Suspend(); - - Py_RETURN_NONE; -} - -KX_PYMETHODDEF_DOC(KX_Scene, resume, - "resume()\n" - "Resumes this scene.\n") -{ - Resume(); - - Py_RETURN_NONE; -} - -/* Matches python dict.get(key, [default]) */ -KX_PYMETHODDEF_DOC(KX_Scene, get, "") -{ - PyObject *key; - PyObject* def = Py_None; - PyObject* ret; - - if (!PyArg_ParseTuple(args, "O|O:get", &key, &def)) - return NULL; - - if (m_attr_dict && (ret=PyDict_GetItem(m_attr_dict, key))) { - Py_INCREF(ret); - return ret; - } - - Py_INCREF(def); - return def; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h deleted file mode 100644 index 4755eee6a6b..00000000000 --- a/source/gameengine/Ketsji/KX_Scene.h +++ /dev/null @@ -1,620 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_SCENE_H -#define __KX_SCENE_H - - -#include "KX_PhysicsEngineEnums.h" - -#include -#include -#include - -#include "GEN_Map.h" -#include "GEN_HashedPtr.h" -#include "SG_IObject.h" -#include "SCA_IScene.h" -#include "MT_Transform.h" - -#include "RAS_FramingManager.h" -#include "RAS_Rect.h" - - -#include "PyObjectPlus.h" -#include "RAS_2DFilterManager.h" - -/** - * @section Forward declarations - */ -struct SM_MaterialProps; -struct SM_ShapeProps; -struct Scene; - -class GEN_HashedPtr; -class CListValue; -class CValue; -class SCA_LogicManager; -class SCA_KeyboardManager; -class SCA_TimeEventManager; -class SCA_MouseManager; -class SCA_ISystem; -class SCA_IInputDevice; -class NG_NetworkDeviceInterface; -class NG_NetworkScene; -class SG_IObject; -class SG_Node; -class SG_Tree; -class KX_WorldInfo; -class KX_Camera; -class KX_GameObject; -class KX_LightObject; -class RAS_BucketManager; -class RAS_MaterialBucket; -class RAS_IPolyMaterial; -class RAS_IRasterizer; -class RAS_IRenderTools; -class SCA_JoystickManager; -class btCollisionShape; -class KX_BlenderSceneConverter; -struct KX_ClientObjectInfo; - -/* for ID freeing */ -#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->flag & LIB_DOIT)) - -/** - * The KX_Scene holds all data for an independent scene. It relates - * KX_Objects to the specific objects in the modules. - * */ -class KX_Scene : public PyObjectPlus, public SCA_IScene -{ - Py_Header; - -#ifndef DISABLE_PYTHON - PyObject* m_attr_dict; - PyObject* m_draw_call_pre; - PyObject* m_draw_call_post; -#endif - - struct CullingInfo { - int m_layer; - CullingInfo(int layer) : m_layer(layer) {} - }; - -protected: - RAS_BucketManager* m_bucketmanager; - CListValue* m_tempObjectList; - - /** - * The list of objects which have been removed during the - * course of one frame. They are actually destroyed in - * LogicEndFrame() via a call to RemoveObject(). - */ - CListValue* m_euthanasyobjects; - - CListValue* m_objectlist; - CListValue* m_parentlist; // all 'root' parents - CListValue* m_lightlist; - CListValue* m_inactivelist; // all objects that are not in the active layer - - SG_QList m_sghead; // list of nodes that needs scenegraph update - // the Dlist is not object that must be updated - // the Qlist is for objects that needs to be rescheduled - // for updates after udpate is over (slow parent, bone parent) - - - /** - * The set of cameras for this scene - */ - list m_cameras; - /** - * Various SCA managers used by the scene - */ - SCA_LogicManager* m_logicmgr; - SCA_KeyboardManager* m_keyboardmgr; - SCA_MouseManager* m_mousemgr; - SCA_TimeEventManager* m_timemgr; - - // Scene converter where many scene entities are registered - // Used to deregister objects that are deleted - class KX_BlenderSceneConverter* m_sceneConverter; - /** - * physics engine abstraction - */ - //e_PhysicsEngine m_physicsEngine; //who needs this ? - class PHY_IPhysicsEnvironment* m_physicsEnvironment; - - /** - * Does this scene clear the z-buffer? - */ - bool m_isclearingZbuffer; - - /** - * The name of the scene - */ - STR_String m_sceneName; - - /** - * stores the worldsettings for a scene - */ - KX_WorldInfo* m_worldinfo; - - /** - * @section Different scenes, linked to ketsji scene - */ - - /** - * Network scene. - */ - NG_NetworkDeviceInterface* m_networkDeviceInterface; - NG_NetworkScene* m_networkScene; - - /** - * A temoprary variable used to parent objects together on - * replication. Don't get confused by the name it is not - * the scene's root node! - */ - SG_Node* m_rootnode; - - /** - * The active camera for the scene - */ - KX_Camera* m_active_camera; - - /** - * Another temporary variable outstaying its welcome - * used in AddReplicaObject to map game objects to their - * replicas so pointers can be updated. - */ - GEN_Map m_map_gameobject_to_replica; - - /** - * Another temporary variable outstaying its welcome - * used in AddReplicaObject to keep a record of all added - * objects. Logic can only be updated when all objects - * have been updated. This stores a list of the new objects. - */ - std::vector m_logicHierarchicalGameObjects; - - /** - * This temporary variable will contain the list of - * object that can be added during group instantiation. - * objects outside this list will not be added (can - * happen with children that are outside the group). - * Used in AddReplicaObject. If the list is empty, it - * means don't care. - */ - std::set m_groupGameObjects; - - /** - * Pointer to system variable passed in in constructor - * only used in constructor so we do not need to keep it - * around in this class. - */ - - SCA_ISystem* m_kxsystem; - - /** - * The execution priority of replicated object actuators? - */ - int m_ueberExecutionPriority; - - /** - * Activity 'bubble' settings : - * Suspend (freeze) the entire scene. - */ - bool m_suspend; - - /** - * Radius in Manhattan distance of the box for activity culling. - */ - float m_activity_box_radius; - - /** - * Toggle to enable or disable activity culling. - */ - bool m_activity_culling; - - /** - * Toggle to enable or disable culling via DBVT broadphase of Bullet. - */ - bool m_dbvt_culling; - - /** - * Occlusion culling resolution - */ - int m_dbvt_occlusion_res; - - /** - * The framing settings used by this scene - */ - - RAS_FrameSettings m_frame_settings; - - /** - * This scenes viewport into the game engine - * canvas.Maintained externally, initially [0,0] -> [0,0] - */ - RAS_Rect m_viewport; - - /** - * Visibility testing functions. - */ - void MarkVisible(SG_Tree *node, RAS_IRasterizer* rasty, KX_Camera*cam,int layer=0); - void MarkSubTreeVisible(SG_Tree *node, RAS_IRasterizer* rasty, bool visible, KX_Camera*cam,int layer=0); - void MarkVisible(RAS_IRasterizer* rasty, KX_GameObject* gameobj, KX_Camera*cam, int layer=0); - static void PhysicsCullingCallback(KX_ClientObjectInfo* objectInfo, void* cullingInfo); - - double m_suspendedtime; - double m_suspendeddelta; - - struct Scene* m_blenderScene; - - RAS_2DFilterManager m_filtermanager; -public: - KX_Scene(class SCA_IInputDevice* keyboarddevice, - class SCA_IInputDevice* mousedevice, - class NG_NetworkDeviceInterface* ndi, - const STR_String& scenename, - struct Scene* scene, - class RAS_ICanvas* canvas); - - virtual - ~KX_Scene(); - - RAS_BucketManager* GetBucketManager(); - RAS_MaterialBucket* FindBucket(RAS_IPolyMaterial* polymat, bool &bucketCreated); - void RenderBuckets(const MT_Transform& cameratransform, - RAS_IRasterizer* rasty, - RAS_IRenderTools* rendertools); - - /** - * Update all transforms according to the scenegraph. - */ - static bool KX_ScenegraphUpdateFunc(SG_IObject* node,void* gameobj,void* scene); - static bool KX_ScenegraphRescheduleFunc(SG_IObject* node,void* gameobj,void* scene); - void UpdateParents(double curtime); - void DupliGroupRecurse(CValue* gameobj, int level); - bool IsObjectInGroup(CValue* gameobj) - { - return (m_groupGameObjects.empty() || - m_groupGameObjects.find(gameobj) != m_groupGameObjects.end()); - } - SCA_IObject* AddReplicaObject(CValue* gameobj, - CValue* locationobj, - int lifespan=0); - KX_GameObject* AddNodeReplicaObject(SG_IObject* node, - CValue* gameobj); - void RemoveNodeDestructObject(SG_IObject* node, - CValue* gameobj); - void RemoveObject(CValue* gameobj); - void DelayedRemoveObject(CValue* gameobj); - - int NewRemoveObject(CValue* gameobj); - void ReplaceMesh(CValue* gameobj, - void* meshob, bool use_gfx, bool use_phys); - /** - * @section Logic stuff - * Initiate an update of the logic system. - */ - void LogicBeginFrame(double curtime); - void LogicUpdateFrame(double curtime, bool frame); - - void - LogicEndFrame( - ); - - CListValue* - GetTempObjectList( - ); - - CListValue* - GetObjectList( - ); - - CListValue* - GetInactiveList( - ); - - CListValue* - GetRootParentList( - ); - - CListValue* - GetLightList( - ); - - SCA_LogicManager* - GetLogicManager( - ); - - SCA_TimeEventManager* - GetTimeEventManager( - ); - - list* - GetCameras( - ); - - - /** Find a camera in the scene by pointer. */ - KX_Camera* - FindCamera( - KX_Camera* - ); - - /** Find a scene in the scene by name. */ - KX_Camera* - FindCamera( - STR_String& - ); - - /** Add a camera to this scene. */ - void - AddCamera( - KX_Camera* - ); - - /** Find the currently active camera. */ - KX_Camera* - GetActiveCamera( - ); - - /** - * Set this camera to be the active camera in the scene. If the - * camera is not present in the camera list, it will be added - */ - - void - SetActiveCamera( - class KX_Camera* - ); - - /** - * Move this camera to the end of the list so that it is rendered last. - * If the camera is not on the list, it will be added - */ - void - SetCameraOnTop( - class KX_Camera* - ); - - /** - * Activates new desired canvas width set at design time. - * @param width The new desired width. - */ - void - SetCanvasDesignWidth( - unsigned int width - ); - /** - * Activates new desired canvas height set at design time. - * @param width The new desired height. - */ - void - SetCanvasDesignHeight( - unsigned int height - ); - /** - * Returns the current desired canvas width set at design time. - * @return The desired width. - */ - unsigned int - GetCanvasDesignWidth( - void - ) const; - - /** - * Returns the current desired canvas height set at design time. - * @return The desired height. - */ - unsigned int - GetCanvasDesignHeight( - void - ) const; - - /** - * Set the framing options for this scene - */ - - void - SetFramingType( - RAS_FrameSettings & frame_settings - ); - - /** - * Return a const reference to the framing - * type set by the above call. - * The contents are not guarenteed to be sensible - * if you don't call the above function. - */ - - const - RAS_FrameSettings & - GetFramingType( - ) const; - - /** - * Store the current scene's viewport on the - * game engine canvas. - */ - void SetSceneViewport(const RAS_Rect &viewport); - - /** - * Get the current scene's viewport on the - * game engine canvas. This maintained - * externally in KX_GameEngine - */ - const RAS_Rect& GetSceneViewport() const; - - /** - * @section Accessors to different scenes of this scene - */ - void SetNetworkDeviceInterface(NG_NetworkDeviceInterface* newInterface); - void SetNetworkScene(NG_NetworkScene *newScene); - void SetWorldInfo(class KX_WorldInfo* wi); - KX_WorldInfo* GetWorldInfo(); - void CalculateVisibleMeshes(RAS_IRasterizer* rasty, KX_Camera *cam, int layer=0); - void UpdateMeshTransformations(); - KX_Camera* GetpCamera(); - NG_NetworkDeviceInterface* GetNetworkDeviceInterface(); - NG_NetworkScene* GetNetworkScene(); - KX_BlenderSceneConverter *GetSceneConverter() { return m_sceneConverter; } - - /** - * Replicate the logic bricks associated to this object. - */ - - void ReplicateLogic(class KX_GameObject* newobj); - static SG_Callbacks m_callbacks; - - const STR_String& GetName(); - - // Suspend the entire scene. - void Suspend(); - - // Resume a suspended scene. - void Resume(); - - // Update the activity box settings for objects in this scene, if needed. - void UpdateObjectActivity(void); - - // Enable/disable activity culling. - void SetActivityCulling(bool b); - - // Set the radius of the activity culling box. - void SetActivityCullingRadius(float f); - bool IsSuspended(); - bool IsClearingZBuffer(); - void EnableZBufferClearing(bool isclearingZbuffer); - // use of DBVT tree for camera culling - void SetDbvtCulling(bool b) { m_dbvt_culling = b; }; - bool GetDbvtCulling() { return m_dbvt_culling; }; - void SetDbvtOcclusionRes(int i) { m_dbvt_occlusion_res = i; }; - int GetDbvtOcclusionRes() { return m_dbvt_occlusion_res; }; - - void SetSceneConverter(class KX_BlenderSceneConverter* sceneConverter); - - class PHY_IPhysicsEnvironment* GetPhysicsEnvironment() - { - return m_physicsEnvironment; - } - - void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* physEnv); - - void SetGravity(const MT_Vector3& gravity); - - /** - * Sets the node tree for this scene. - */ - void SetNodeTree(SG_Tree* root); - - /** - * 2D Filters - */ - void Update2DFilter(vector& propNames, void* gameObj, RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, int pass, STR_String& text); - void Render2DFilters(RAS_ICanvas* canvas); - -#ifndef DISABLE_PYTHON - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - KX_PYMETHOD_DOC(KX_Scene, addObject); - KX_PYMETHOD_DOC(KX_Scene, end); - KX_PYMETHOD_DOC(KX_Scene, restart); - KX_PYMETHOD_DOC(KX_Scene, replace); - KX_PYMETHOD_DOC(KX_Scene, suspend); - KX_PYMETHOD_DOC(KX_Scene, resume); - KX_PYMETHOD_DOC(KX_Scene, get); - - /* attributes */ - static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_objects(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_objects_inactive(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_lights(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_cameras(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_active_camera(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_drawing_callback_pre(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_drawing_callback_pre(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static PyObject* pyattr_get_drawing_callback_post(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_drawing_callback_post(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - virtual PyObject* py_repr(void) { return PyUnicode_FromString(GetName().ReadPtr()); } - - /* getitem/setitem */ - static PyMappingMethods Mapping; - static PySequenceMethods Sequence; - - /** - * Run the registered python drawing functions. - */ - void RunDrawingCallbacks(PyObject* cb_list); - - PyObject* GetPreDrawCB() { return m_draw_call_pre; }; - PyObject* GetPostDrawCB() { return m_draw_call_post; }; -#endif - - /** - * Sets the time the scene was suspended - */ - void setSuspendedTime(double suspendedtime); - /** - * Returns the "curtime" the scene was suspended - */ - double getSuspendedTime(); - /** - * Sets the difference between the local time of the scene (when it - * was running and not suspended) and the "curtime" - */ - void setSuspendedDelta(double suspendeddelta); - /** - * Returns the difference between the local time of the scene (when it - * was running and not suspended) and the "curtime" - */ - double getSuspendedDelta(); - /** - * Returns the Blender scene this was made from - */ - struct Scene *GetBlenderScene() { return m_blenderScene; } - - bool MergeScene(KX_Scene *other); - - - //void PrintStats(int verbose_level) { - // m_bucketmanager->PrintStats(verbose_level) - //} - - -}; - -typedef std::vector KX_SceneList; - -#endif //__KX_SCENE_H - diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp deleted file mode 100644 index 8f6000ebc3d..00000000000 --- a/source/gameengine/Ketsji/KX_SceneActuator.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/** -* Set scene/camera stuff -* -* $Id$ -* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** -*/ - -#include "SCA_IActuator.h" -#include "KX_SceneActuator.h" -#include -#include "KX_Scene.h" -#include "KX_Camera.h" -#include "KX_KetsjiEngine.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -KX_SceneActuator::KX_SceneActuator(SCA_IObject *gameobj, - int mode, - KX_Scene *scene, - KX_KetsjiEngine* ketsjiEngine, - const STR_String& nextSceneName, - KX_Camera* camera) - : SCA_IActuator(gameobj, KX_ACT_SCENE) -{ - m_mode = mode; - m_scene = scene; - m_KetsjiEngine=ketsjiEngine; - m_camera = camera; - m_nextSceneName = nextSceneName; - if (m_camera) - m_camera->RegisterActuator(this); -} /* End of constructor */ - - - -KX_SceneActuator::~KX_SceneActuator() -{ - if (m_camera) - m_camera->UnregisterActuator(this); -} /* end of destructor */ - - - -CValue* KX_SceneActuator::GetReplica() -{ - KX_SceneActuator* replica = new KX_SceneActuator(*this); - replica->ProcessReplica(); - return replica; -} - -void KX_SceneActuator::ProcessReplica() -{ - if (m_camera) - m_camera->RegisterActuator(this); - SCA_IActuator::ProcessReplica(); -} - -bool KX_SceneActuator::UnlinkObject(SCA_IObject* clientobj) -{ - if (clientobj == (SCA_IObject*)m_camera) - { - // this object is being deleted, we cannot continue to track it. - m_camera = NULL; - return true; - } - return false; -} - -void KX_SceneActuator::Relink(GEN_Map *obj_map) -{ - void **h_obj = (*obj_map)[m_camera]; - if (h_obj) { - if (m_camera) - m_camera->UnregisterActuator(this); - m_camera = (KX_Camera*)(*h_obj); - m_camera->RegisterActuator(this); - } -} - - -bool KX_SceneActuator::Update() -{ - // bool result = false; /*unused*/ - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (bNegativeEvent) - return false; // do nothing on negative events - - switch (m_mode) - { - case KX_SCENE_RESTART: - { - m_KetsjiEngine->ReplaceScene(m_scene->GetName(),m_scene->GetName()); - break; - } - case KX_SCENE_SET_CAMERA: - if (m_camera) - { - m_scene->SetActiveCamera(m_camera); - } - else - { - // if no camera is set and the parent object is a camera, use it as the camera - SCA_IObject* parent = GetParent(); - if (parent->GetGameObjectType()==SCA_IObject::OBJ_CAMERA) - { - m_scene->SetActiveCamera((KX_Camera*)parent); - } - } - break; - default: - break; - } - - if (!m_nextSceneName.Length()) - return false; - - switch (m_mode) - { - case KX_SCENE_SET_SCENE: - { - m_KetsjiEngine->ReplaceScene(m_scene->GetName(),m_nextSceneName); - break; - } - case KX_SCENE_ADD_FRONT_SCENE: - { - bool overlay=true; - m_KetsjiEngine->ConvertAndAddScene(m_nextSceneName,overlay); - break; - } - case KX_SCENE_ADD_BACK_SCENE: - { - bool overlay=false; - m_KetsjiEngine->ConvertAndAddScene(m_nextSceneName,overlay); - break; - } - case KX_SCENE_REMOVE_SCENE: - { - m_KetsjiEngine->RemoveScene(m_nextSceneName); - break; - } - case KX_SCENE_SUSPEND: - { - m_KetsjiEngine->SuspendScene(m_nextSceneName); - break; - } - case KX_SCENE_RESUME: - { - m_KetsjiEngine->ResumeScene(m_nextSceneName); - break; - } - default: - ; /* do nothing? this is an internal error !!! */ - } - - return false; -} - - - -/* returns a camera if the name is valid */ -KX_Camera* KX_SceneActuator::FindCamera(char *camName) -{ - KX_SceneList* sl = m_KetsjiEngine->CurrentScenes(); - STR_String name = STR_String(camName); - KX_SceneList::iterator it = sl->begin(); - KX_Camera* cam = NULL; - - while ((it != sl->end()) && (!cam)) - { - cam = (*it)->FindCamera(name); - it++; - } - - return cam; -} - - - -KX_Scene* KX_SceneActuator::FindScene(char * sceneName) -{ - return m_KetsjiEngine->FindScene(sceneName); -} - - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_SceneActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_SceneActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_SceneActuator::Methods[] = -{ - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_SceneActuator::Attributes[] = { - KX_PYATTRIBUTE_STRING_RW("scene",0,32,true,KX_SceneActuator,m_nextSceneName), - KX_PYATTRIBUTE_RW_FUNCTION("camera",KX_SceneActuator,pyattr_get_camera,pyattr_set_camera), - KX_PYATTRIBUTE_BOOL_RW("useRestart", KX_SceneActuator, m_restart), - KX_PYATTRIBUTE_INT_RW("mode", KX_SCENE_NODEF+1, KX_SCENE_MAX-1, true, KX_SceneActuator, m_mode), - { NULL } //Sentinel -}; - -PyObject* KX_SceneActuator::pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_SceneActuator* actuator = static_cast(self); - if (!actuator->m_camera) - Py_RETURN_NONE; - - return actuator->m_camera->GetProxy(); -} - -int KX_SceneActuator::pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_SceneActuator* actuator = static_cast(self); - KX_Camera *camOb; - - if (!ConvertPythonToCamera(value, &camOb, true, "actu.camera = value: KX_SceneActuator")) - return PY_SET_ATTR_FAIL; - - if (actuator->m_camera) - actuator->m_camera->UnregisterActuator(actuator); - - if(camOb==NULL) { - actuator->m_camera= NULL; - } - else { - actuator->m_camera = camOb; - actuator->m_camera->RegisterActuator(actuator); - } - - return PY_SET_ATTR_SUCCESS; -} - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_SceneActuator.h b/source/gameengine/Ketsji/KX_SceneActuator.h deleted file mode 100644 index 360488f9f74..00000000000 --- a/source/gameengine/Ketsji/KX_SceneActuator.h +++ /dev/null @@ -1,111 +0,0 @@ - -// -// Add object to the game world on action of this actuator -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// - -#ifndef __KX_SCENEACTUATOR -#define __KX_SCENEACTUATOR - -#include "SCA_IActuator.h" -#include "SCA_IScene.h" /* Replace_IScene only */ -#include "KX_Scene.h" /* Replace_IScene only */ - -class KX_SceneActuator : public SCA_IActuator -{ - Py_Header; - - int m_mode; - // (restart) has become a toggle internally... not in the interface though - bool m_restart; - // (set Scene) Scene - /** The current scene. */ - class KX_Scene* m_scene; - class KX_KetsjiEngine* m_KetsjiEngine; - /** The scene to switch to. */ - STR_String m_nextSceneName; - - // (Set Camera) Object - class KX_Camera* m_camera; - - /** Is this a valid scene? */ - class KX_Scene* FindScene(char* sceneName); - /** Is this a valid camera? */ - class KX_Camera* FindCamera(char* cameraName); - - public: - enum SCA_SceneActuatorMode - { - KX_SCENE_NODEF = 0, - KX_SCENE_RESTART, - KX_SCENE_SET_SCENE, - KX_SCENE_SET_CAMERA, - KX_SCENE_ADD_FRONT_SCENE, - KX_SCENE_ADD_BACK_SCENE, - KX_SCENE_REMOVE_SCENE, - KX_SCENE_SUSPEND, - KX_SCENE_RESUME, - KX_SCENE_MAX - }; - - KX_SceneActuator(SCA_IObject* gameobj, - int mode, - KX_Scene* scene, - KX_KetsjiEngine* ketsjiEngine, - const STR_String& nextSceneName, - KX_Camera* camera); - virtual ~KX_SceneActuator(); - - virtual CValue* GetReplica(); - virtual void ProcessReplica(); - virtual bool UnlinkObject(SCA_IObject* clientobj); - virtual void Relink(GEN_Map *obj_map); - - virtual bool Update(); - -#ifndef DISABLE_PYTHON - - virtual void Replace_IScene(SCA_IScene *val) - { - m_scene= static_cast(val); - }; - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - static PyObject* pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - -#endif // DISABLE_PYTHON - -}; /* end of class KXSceneActuator */ - -#endif - diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp deleted file mode 100644 index 7f9b090d680..00000000000 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ /dev/null @@ -1,544 +0,0 @@ -/** - * KX_SoundActuator.cpp - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -#include "KX_SoundActuator.h" -#include "KX_GameObject.h" -#include "KX_PyMath.h" // needed for PyObjectFrom() -#include - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ -KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj, - AUD_Sound* sound, - float volume, - float pitch, - bool is3d, - KX_3DSoundSettings settings, - KX_SOUNDACT_TYPE type)//, - : SCA_IActuator(gameobj, KX_ACT_SOUND) -{ - m_sound = sound; - m_volume = volume; - m_pitch = pitch; - m_is3d = is3d; - m_3d = settings; - m_handle = NULL; - m_type = type; - m_isplaying = false; -} - - - -KX_SoundActuator::~KX_SoundActuator() -{ - if(m_handle) - AUD_stop(m_handle); -} - -void KX_SoundActuator::play() -{ - if(m_handle) - AUD_stop(m_handle); - - if(!m_sound) - return; - - // this is the sound that will be played and not deleted afterwards - AUD_Sound* sound = m_sound; - // this sounds are for temporary stacked sounds, will be deleted if not NULL - AUD_Sound* sound2 = NULL; - AUD_Sound* sound3 = NULL; - - switch (m_type) - { - case KX_SOUNDACT_LOOPBIDIRECTIONAL: - case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: - // create a ping pong sound on sound2 stacked on the orignal sound - sound2 = AUD_pingpongSound(sound); - // create a loop sound on sound3 stacked on the pingpong sound and let that one play (save it to sound) - sound = sound3 = AUD_loopSound(sound2); - break; - case KX_SOUNDACT_LOOPEND: - case KX_SOUNDACT_LOOPSTOP: - // create a loop sound on sound2 stacked on the pingpong sound and let that one play (save it to sound) - sound = sound2 = AUD_loopSound(sound); - break; - case KX_SOUNDACT_PLAYSTOP: - case KX_SOUNDACT_PLAYEND: - default: - break; - } - - if(m_is3d) - { - // sound shall be played 3D - m_handle = AUD_play3D(sound, 0); - - AUD_set3DSourceSetting(m_handle, AUD_3DSS_MAX_GAIN, m_3d.max_gain); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_MIN_GAIN, m_3d.min_gain); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_REFERENCE_DISTANCE, m_3d.reference_distance); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_MAX_DISTANCE, m_3d.max_distance); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_ROLLOFF_FACTOR, m_3d.rolloff_factor); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_CONE_INNER_ANGLE, m_3d.cone_inner_angle); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_CONE_OUTER_ANGLE, m_3d.cone_outer_angle); - AUD_set3DSourceSetting(m_handle, AUD_3DSS_CONE_OUTER_GAIN, m_3d.cone_outer_gain); - } - else - m_handle = AUD_play(sound, 0); - - AUD_setSoundPitch(m_handle, m_pitch); - AUD_setSoundVolume(m_handle, m_volume); - m_isplaying = true; - - // now we unload the pingpong and loop sounds, as we don't need them anymore - // the started sound will continue playing like it was created, don't worry! - if(sound3) - AUD_unload(sound3); - if(sound2) - AUD_unload(sound2); -} - -CValue* KX_SoundActuator::GetReplica() -{ - KX_SoundActuator* replica = new KX_SoundActuator(*this); - replica->ProcessReplica(); - return replica; -}; - -void KX_SoundActuator::ProcessReplica() -{ - SCA_IActuator::ProcessReplica(); - m_handle = 0; -} - -bool KX_SoundActuator::Update(double curtime, bool frame) -{ - if (!frame) - return true; - bool result = false; - - // do nothing on negative events, otherwise sounds are played twice! - bool bNegativeEvent = IsNegativeEvent(); - bool bPositiveEvent = m_posevent; - - RemoveAllEvents(); - - if(!m_sound) - return false; - - // actual audio device playing state - bool isplaying = AUD_getStatus(m_handle) == AUD_STATUS_PLAYING; - - if (bNegativeEvent) - { - // here must be a check if it is still playing - if (m_isplaying && isplaying) - { - switch (m_type) - { - case KX_SOUNDACT_PLAYSTOP: - case KX_SOUNDACT_LOOPSTOP: - case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: - { - // stop immediately - AUD_stop(m_handle); - break; - } - case KX_SOUNDACT_PLAYEND: - { - // do nothing, sound will stop anyway when it's finished - break; - } - case KX_SOUNDACT_LOOPEND: - case KX_SOUNDACT_LOOPBIDIRECTIONAL: - { - // stop the looping so that the sound stops when it finished - AUD_setLoop(m_handle, 0, -1); - break; - } - default: - // implement me !! - break; - } - } - // remember that we tried to stop the actuator - m_isplaying = false; - } - -#if 1 - // Warning: when de-activating the actuator, after a single negative event this runs again with... - // m_posevent==false && m_posevent==false, in this case IsNegativeEvent() returns false - // and assumes this is a positive event. - // check that we actually have a positive event so as not to play sounds when being disabled. - else if(bPositiveEvent) { // <- added since 2.49 -#else - else { // <- works in most cases except a loop-end sound will never stop unless - // the negative pulse is done continuesly -#endif - if (!m_isplaying) - play(); - } - // verify that the sound is still playing - isplaying = AUD_getStatus(m_handle) == AUD_STATUS_PLAYING ? true : false; - - if (isplaying) - { - if(m_is3d) - { - AUD_3DData data; - float f; - ((KX_GameObject*)this->GetParent())->NodeGetWorldPosition().getValue(data.position); - ((KX_GameObject*)this->GetParent())->GetLinearVelocity().getValue(data.velocity); - ((KX_GameObject*)this->GetParent())->NodeGetWorldOrientation().getValue3x3(data.orientation); - - /* - * The 3D data from blender has to be transformed for OpenAL: - * - In blender z is up and y is forwards - * - In OpenAL y is up and z is backwards - * We have to do that for all 5 vectors. - */ - f = data.position[1]; - data.position[1] = data.position[2]; - data.position[2] = -f; - - f = data.velocity[1]; - data.velocity[1] = data.velocity[2]; - data.velocity[2] = -f; - - f = data.orientation[1]; - data.orientation[1] = data.orientation[2]; - data.orientation[2] = -f; - - f = data.orientation[4]; - data.orientation[4] = data.orientation[5]; - data.orientation[5] = -f; - - f = data.orientation[7]; - data.orientation[7] = data.orientation[8]; - data.orientation[8] = -f; - - AUD_update3DSource(m_handle, &data); - } - result = true; - } - else - { - m_isplaying = false; - result = false; - } - return result; -} - - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - - - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_SoundActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_SoundActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_SoundActuator::Methods[] = { - KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, startSound), - KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, pauseSound), - KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, stopSound), - {NULL, NULL} //Sentinel -}; - -PyAttributeDef KX_SoundActuator::Attributes[] = { - KX_PYATTRIBUTE_BOOL_RO("is3D", KX_SoundActuator, m_is3d), - KX_PYATTRIBUTE_RW_FUNCTION("maxGain3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("minGain3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("referenceDistance3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("maxDistance3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("rolloffFactor3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("coneInnerAngle3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("coneOuterAngle3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - KX_PYATTRIBUTE_RW_FUNCTION("coneOuterGain3D", KX_SoundActuator, pyattr_get_3d_property, pyattr_set_3d_property), - - KX_PYATTRIBUTE_RW_FUNCTION("time", KX_SoundActuator, pyattr_get_audposition, pyattr_set_audposition), - KX_PYATTRIBUTE_RW_FUNCTION("volume", KX_SoundActuator, pyattr_get_gain, pyattr_set_gain), - KX_PYATTRIBUTE_RW_FUNCTION("pitch", KX_SoundActuator, pyattr_get_pitch, pyattr_set_pitch), - KX_PYATTRIBUTE_RW_FUNCTION("rollOffFactor", KX_SoundActuator, pyattr_get_rollOffFactor, pyattr_set_rollOffFactor), - KX_PYATTRIBUTE_ENUM_RW("mode",KX_SoundActuator::KX_SOUNDACT_NODEF+1,KX_SoundActuator::KX_SOUNDACT_MAX-1,false,KX_SoundActuator,m_type), - { NULL } //Sentinel -}; - -/* Methods ----------------------------------------------------------------- */ -KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, startSound, -"startSound()\n" -"\tStarts the sound.\n") -{ - switch(AUD_getStatus(m_handle)) - { - case AUD_STATUS_PLAYING: - break; - case AUD_STATUS_PAUSED: - AUD_resume(m_handle); - break; - default: - play(); - } - Py_RETURN_NONE; -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, pauseSound, -"pauseSound()\n" -"\tPauses the sound.\n") -{ - AUD_pause(m_handle); - Py_RETURN_NONE; -} - -KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, stopSound, -"stopSound()\n" -"\tStops the sound.\n") -{ - AUD_stop(m_handle); - Py_RETURN_NONE; -} - -/* Atribute setting and getting -------------------------------------------- */ -PyObject* KX_SoundActuator::pyattr_get_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_SoundActuator * actuator = static_cast (self); - const char* prop = attrdef->m_name; - float result_value = 0.0; - - if(!strcmp(prop, "maxGain3D")) { - result_value = actuator->m_3d.max_gain; - - } else if (!strcmp(prop, "minGain3D")) { - result_value = actuator->m_3d.min_gain; - - } else if (!strcmp(prop, "referenceDistance3D")) { - result_value = actuator->m_3d.reference_distance; - - } else if (!strcmp(prop, "maxDistance3D")) { - result_value = actuator->m_3d.max_distance; - - } else if (!strcmp(prop, "rolloffFactor3D")) { - result_value = actuator->m_3d.rolloff_factor; - - } else if (!strcmp(prop, "coneInnerAngle3D")) { - result_value = actuator->m_3d.cone_inner_angle; - - } else if (!strcmp(prop, "coneOuterAngle3D")) { - result_value = actuator->m_3d.cone_outer_angle; - - } else if (!strcmp(prop, "coneOuterGain3D")) { - result_value = actuator->m_3d.cone_outer_gain; - - } else { - Py_RETURN_NONE; - } - - PyObject* result = PyFloat_FromDouble(result_value); - return result; -} - -PyObject* KX_SoundActuator::pyattr_get_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_SoundActuator * actuator = static_cast (self); - float position = 0.0; - - if(actuator->m_handle) - position = AUD_getPosition(actuator->m_handle); - - PyObject* result = PyFloat_FromDouble(position); - - return result; -} - -PyObject* KX_SoundActuator::pyattr_get_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_SoundActuator * actuator = static_cast (self); - float gain = actuator->m_volume; - - PyObject* result = PyFloat_FromDouble(gain); - - return result; -} - -PyObject* KX_SoundActuator::pyattr_get_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_SoundActuator * actuator = static_cast (self); - float pitch = actuator->m_pitch; - - PyObject* result = PyFloat_FromDouble(pitch); - - return result; -} - -PyObject* KX_SoundActuator::pyattr_get_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_SoundActuator * actuator = static_cast (self); - float rollofffactor = actuator->m_3d.rolloff_factor; - PyObject* result = PyFloat_FromDouble(rollofffactor); - - return result; -} - -int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_SoundActuator * actuator = static_cast (self); - const char* prop = attrdef->m_name; - float prop_value = 0.0; - AUD_3DSourceSetting setting = AUD_3DSS_NONE; - - if (!PyArg_Parse(value, "f", &prop_value)) - return PY_SET_ATTR_FAIL; - - // update the internal value - if(!strcmp(prop, "maxGain3D")) { - actuator->m_3d.max_gain = prop_value; - setting = AUD_3DSS_MAX_GAIN; - - } else if (!strcmp(prop, "minGain3D")) { - actuator->m_3d.min_gain = prop_value; - setting = AUD_3DSS_MIN_GAIN; - - } else if (!strcmp(prop, "referenceDistance3D")) { - actuator->m_3d.reference_distance = prop_value; - setting = AUD_3DSS_REFERENCE_DISTANCE; - - } else if (!strcmp(prop, "maxDistance3D")) { - actuator->m_3d.max_distance = prop_value; - setting = AUD_3DSS_MAX_DISTANCE; - - } else if (!strcmp(prop, "rolloffFactor3D")) { - actuator->m_3d.rolloff_factor = prop_value; - setting = AUD_3DSS_ROLLOFF_FACTOR; - - } else if (!!strcmp(prop, "coneInnerAngle3D")) { - actuator->m_3d.cone_inner_angle = prop_value; - setting = AUD_3DSS_CONE_INNER_ANGLE; - - } else if (!strcmp(prop, "coneOuterAngle3D")) { - actuator->m_3d.cone_outer_angle = prop_value; - setting = AUD_3DSS_CONE_OUTER_ANGLE; - - } else if (!strcmp(prop, "coneOuterGain3D")) { - actuator->m_3d.cone_outer_gain = prop_value; - setting = AUD_3DSS_CONE_OUTER_GAIN; - - } else { - return PY_SET_ATTR_FAIL; - } - - // if sound is working and 3D, set the new setting - if(actuator->m_handle && actuator->m_is3d && setting != AUD_3DSS_NONE) - AUD_set3DSourceSetting(actuator->m_handle, setting, prop_value); - - return PY_SET_ATTR_SUCCESS; -} - -int KX_SoundActuator::pyattr_set_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_SoundActuator * actuator = static_cast (self); - - float position = 1.0; - if (!PyArg_Parse(value, "f", &position)) - return PY_SET_ATTR_FAIL; - - if(actuator->m_handle) - AUD_seek(actuator->m_handle, position); - return PY_SET_ATTR_SUCCESS; -} - -int KX_SoundActuator::pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - float gain = 1.0; - KX_SoundActuator * actuator = static_cast (self); - if (!PyArg_Parse(value, "f", &gain)) - return PY_SET_ATTR_FAIL; - - actuator->m_volume = gain; - if(actuator->m_handle) - AUD_setSoundVolume(actuator->m_handle, gain); - - return PY_SET_ATTR_SUCCESS; -} - -int KX_SoundActuator::pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - float pitch = 1.0; - KX_SoundActuator * actuator = static_cast (self); - if (!PyArg_Parse(value, "f", &pitch)) - return PY_SET_ATTR_FAIL; - - actuator->m_pitch = pitch; - if(actuator->m_handle) - AUD_setSoundPitch(actuator->m_handle, pitch); - - return PY_SET_ATTR_SUCCESS; -} - -int KX_SoundActuator::pyattr_set_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_SoundActuator * actuator = static_cast (self); - float rollofffactor = 1.0; - if (!PyArg_Parse(value, "f", &rollofffactor)) - return PY_SET_ATTR_FAIL; - - actuator->m_3d.rolloff_factor = rollofffactor; - if(actuator->m_handle) - AUD_set3DSourceSetting(actuator->m_handle, AUD_3DSS_ROLLOFF_FACTOR, rollofffactor); - - return PY_SET_ATTR_SUCCESS; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h deleted file mode 100644 index 1eaea276191..00000000000 --- a/source/gameengine/Ketsji/KX_SoundActuator.h +++ /dev/null @@ -1,125 +0,0 @@ -/** - * KX_SoundActuator.h - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_SOUNDACTUATOR -#define __KX_SOUNDACTUATOR - -#include "SCA_IActuator.h" - -#include "AUD_C-API.h" -#include "BKE_sound.h" - -typedef struct KX_3DSoundSettings -{ - float min_gain; - float max_gain; - float reference_distance; - float max_distance; - float rolloff_factor; - float cone_inner_angle; - float cone_outer_angle; - float cone_outer_gain; -} KX_3DSoundSettings; - -class KX_SoundActuator : public SCA_IActuator -{ - Py_Header; - bool m_isplaying; - AUD_Sound* m_sound; - float m_volume; - float m_pitch; - bool m_is3d; - KX_3DSoundSettings m_3d; - AUD_Handle* m_handle; - - void play(); - -public: - - enum KX_SOUNDACT_TYPE - { - KX_SOUNDACT_NODEF = 0, - KX_SOUNDACT_PLAYSTOP, - KX_SOUNDACT_PLAYEND, - KX_SOUNDACT_LOOPSTOP, - KX_SOUNDACT_LOOPEND, - KX_SOUNDACT_LOOPBIDIRECTIONAL, - KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP, - KX_SOUNDACT_MAX - }; - - KX_SOUNDACT_TYPE m_type; - - KX_SoundActuator(SCA_IObject* gameobj, - AUD_Sound* sound, - float volume, - float pitch, - bool is3d, - KX_3DSoundSettings settings, - KX_SOUNDACT_TYPE type); - - ~KX_SoundActuator(); - - virtual bool Update(double curtime, bool frame); - - CValue* GetReplica(); - void ProcessReplica(); - -#ifndef DISABLE_PYTHON - - /* -------------------------------------------------------------------- */ - /* Python interface --------------------------------------------------- */ - /* -------------------------------------------------------------------- */ - - KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, startSound); - KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, pauseSound); - KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, stopSound); - - static int pyattr_set_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static int pyattr_set_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static int pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static int pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static int pyattr_set_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - static int pyattr_set_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - - static PyObject* pyattr_get_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - -#endif // DISABLE_PYTHON - -}; - -#endif //__KX_SOUNDACTUATOR - diff --git a/source/gameengine/Ketsji/KX_StateActuator.cpp b/source/gameengine/Ketsji/KX_StateActuator.cpp deleted file mode 100644 index 33f21f49810..00000000000 --- a/source/gameengine/Ketsji/KX_StateActuator.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Actuator to toggle visibility/invisibility of objects - */ - -#include "KX_StateActuator.h" -#include "KX_GameObject.h" - -KX_StateActuator::KX_StateActuator( - SCA_IObject* gameobj, - int operation, - unsigned int mask - ) - : SCA_IActuator(gameobj, KX_ACT_STATE), - m_operation(operation), - m_mask(mask) -{ - // intentionally empty -} - -KX_StateActuator::~KX_StateActuator( - void - ) -{ - // intentionally empty -} - -// used to put state actuator to be executed before any other actuators -SG_QList KX_StateActuator::m_stateActuatorHead; - -CValue* -KX_StateActuator::GetReplica( - void - ) -{ - KX_StateActuator* replica = new KX_StateActuator(*this); - replica->ProcessReplica(); - return replica; -} - -bool -KX_StateActuator::Update() -{ - bool bNegativeEvent = IsNegativeEvent(); - unsigned int objMask; - - // execution of state actuator means that we are in the execution phase, reset this pointer - // because all the active actuator of this object will be removed for sure. - m_gameobj->m_firstState = NULL; - RemoveAllEvents(); - if (bNegativeEvent) return false; - - KX_GameObject *obj = (KX_GameObject*) GetParent(); - - objMask = obj->GetState(); - switch (m_operation) - { - case OP_CPY: - objMask = m_mask; - break; - case OP_SET: - objMask |= m_mask; - break; - case OP_CLR: - objMask &= ~m_mask; - break; - case OP_NEG: - objMask ^= m_mask; - break; - default: - // unsupported operation, no nothing - return false; - } - obj->SetState(objMask); - return false; -} - -// this function is only used to deactivate actuators outside the logic loop -// e.g. when an object is deleted. -void KX_StateActuator::Deactivate() -{ - if (QDelink()) - { - // the actuator was in the active list - if (m_stateActuatorHead.QEmpty()) - // no more state object active - m_stateActuatorHead.Delink(); - } -} - -void KX_StateActuator::Activate(SG_DList& head) -{ - // sort the state actuators per object on the global list - if (QEmpty()) - { - InsertSelfActiveQList(m_stateActuatorHead, &m_gameobj->m_firstState); - // add front to make sure it runs before other actuators - head.AddFront(&m_stateActuatorHead); - } -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - - - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_StateActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_StateActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_StateActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_StateActuator::Attributes[] = { - KX_PYATTRIBUTE_INT_RW("operation",KX_StateActuator::OP_NOP+1,KX_StateActuator::OP_COUNT-1,false,KX_StateActuator,m_operation), - KX_PYATTRIBUTE_INT_RW("mask",0,0x3FFFFFFF,false,KX_StateActuator,m_mask), - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_StateActuator.h b/source/gameengine/Ketsji/KX_StateActuator.h deleted file mode 100644 index 3af03f5d1fb..00000000000 --- a/source/gameengine/Ketsji/KX_StateActuator.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Actuator to toggle visibility/invisibility of objects - */ - -#ifndef __KX_STATEACTUATOR -#define __KX_STATEACTUATOR - -#include "SCA_IActuator.h" - - -/* - * Use of SG_DList : element of actuator being deactivated - * Head: SCA_LogicManager::m_removedActuators - * Use of SG_QList : element of global activated state actuator list - * Head: KX_StateActuator::m_stateActuatorHead - */ -class KX_StateActuator : public SCA_IActuator -{ - Py_Header; - - /** Make visible? */ - enum { - OP_NOP = -1, - OP_CPY = 0, - OP_SET, - OP_CLR, - OP_NEG, - OP_COUNT - }; - // SG_Dlist: element of objects with active actuators, always put in front of the list - // Head: SCA_LogicManager::m_activeActuators - // SG_QList: Head of active state actuators list globally - // Elements: KX_StateActuator - static SG_QList m_stateActuatorHead; - int m_operation; - int m_mask; - - public: - - KX_StateActuator( - SCA_IObject* gameobj, - int operation, - unsigned int mask - ); - - virtual - ~KX_StateActuator( - void - ); - - virtual CValue* - GetReplica( - void - ); - - virtual bool - Update(); - - virtual void Deactivate(); - virtual void Activate(SG_DList& head); - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp b/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp deleted file mode 100644 index 4f10c72b50b..00000000000 --- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_TimeCategoryLogger.h" - -KX_TimeCategoryLogger::KX_TimeCategoryLogger(unsigned int maxNumMeasurements) -: m_maxNumMeasurements(maxNumMeasurements) -{ -} - - -KX_TimeCategoryLogger::~KX_TimeCategoryLogger(void) -{ - DisposeLoggers(); -} - - -void KX_TimeCategoryLogger::SetMaxNumMeasurements(unsigned int maxNumMeasurements) -{ - KX_TimeLoggerMap::iterator it; - for (it = m_loggers.begin(); it != m_loggers.end(); it++) { - it->second->SetMaxNumMeasurements(maxNumMeasurements); - } - m_maxNumMeasurements = maxNumMeasurements; -} - - -unsigned int KX_TimeCategoryLogger::GetMaxNumMeasurements(void) const -{ - return m_maxNumMeasurements; -} - - -void KX_TimeCategoryLogger::AddCategory(TimeCategory tc) -{ - // Only add if not already present - if (m_loggers.find(tc) == m_loggers.end()) { - KX_TimeLogger* logger = new KX_TimeLogger(m_maxNumMeasurements); - //assert(logger); - m_loggers.insert(KX_TimeLoggerMap::value_type(tc, logger)); - } -} - - -void KX_TimeCategoryLogger::StartLog(TimeCategory tc, double now, bool endOtherCategories) -{ - if (endOtherCategories) { - KX_TimeLoggerMap::iterator it; - for (it = m_loggers.begin(); it != m_loggers.end(); it++) { - if (it->first != tc) { - it->second->EndLog(now); - } - } - } - //assert(m_loggers[tc] != m_loggers.end()); - m_loggers[tc]->StartLog(now); -} - - -void KX_TimeCategoryLogger::EndLog(TimeCategory tc, double now) -{ - //assert(m_loggers[tc] != m_loggers.end()); - m_loggers[tc]->EndLog(now); -} - - -void KX_TimeCategoryLogger::EndLog(double now) -{ - KX_TimeLoggerMap::iterator it; - for (it = m_loggers.begin(); it != m_loggers.end(); it++) { - it->second->EndLog(now); - } -} - - -void KX_TimeCategoryLogger::NextMeasurement(double now) -{ - KX_TimeLoggerMap::iterator it; - for (it = m_loggers.begin(); it != m_loggers.end(); it++) { - it->second->NextMeasurement(now); - } -} - - -double KX_TimeCategoryLogger::GetAverage(TimeCategory tc) -{ - //assert(m_loggers[tc] != m_loggers.end()); - return m_loggers[tc]->GetAverage(); -} - - -double KX_TimeCategoryLogger::GetAverage(void) -{ - double time = 0.; - - KX_TimeLoggerMap::iterator it; - for (it = m_loggers.begin(); it != m_loggers.end(); it++) { - time += it->second->GetAverage(); - } - - return time; -} - - -void KX_TimeCategoryLogger::DisposeLoggers(void) -{ - KX_TimeLoggerMap::iterator it; - for (it = m_loggers.begin(); it != m_loggers.end(); it++) { - delete it->second; - } -} - diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h deleted file mode 100644 index 7eda71c0798..00000000000 --- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h +++ /dev/null @@ -1,137 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_TIME_CATEGORY_LOGGER_H -#define __KX_TIME_CATEGORY_LOGGER_H - -#ifdef WIN32 -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif - -#include - -#include "KX_TimeLogger.h" - -/** - * Stores and manages time measurements by category. - * Categories can be added dynamically. - * Average measurements can be established for each separate category - * or for all categories together. - */ -class KX_TimeCategoryLogger { -public: - typedef int TimeCategory; - - /** - * Constructor. - * @param maxNumMesasurements Maximum number of measurements stored (> 1). - */ - KX_TimeCategoryLogger(unsigned int maxNumMeasurements = 10); - - /** - * Destructor. - */ - virtual ~KX_TimeCategoryLogger(void); - - /** - * Changes the maximum number of measurements that can be stored. - */ - virtual void SetMaxNumMeasurements(unsigned int maxNumMeasurements); - - /** - * Changes the maximum number of measurements that can be stored. - */ - virtual unsigned int GetMaxNumMeasurements(void) const; - - /** - * Adds a category. - * @param category The new category. - */ - virtual void AddCategory(TimeCategory tc); - - /** - * Starts logging in current measurement for the given category. - * @param tc The category to log to. - * @param now The current time. - * @param endOtherCategories Whether to stop logging to other categories. - */ - virtual void StartLog(TimeCategory tc, double now, bool endOtherCategories = true); - - /** - * End logging in current measurement for the given category. - * @param tc The category to log to. - * @param now The current time. - */ - virtual void EndLog(TimeCategory tc, double now); - - /** - * End logging in current measurement for all categories. - * @param now The current time. - */ - virtual void EndLog(double now); - - /** - * Logs time in next measurement. - * @param now The current time. - */ - virtual void NextMeasurement(double now); - - /** - * Returns average of all but the current measurement time. - * @return The average of all but the current measurement. - */ - virtual double GetAverage(TimeCategory tc); - - /** - * Returns average for grand total. - */ - virtual double GetAverage(void); - -protected: - /** - * Disposes loggers. - */ - virtual void DisposeLoggers(void); - - /** Storage for the loggers. */ - typedef std::map KX_TimeLoggerMap; - KX_TimeLoggerMap m_loggers; - /** Maximum number of measurements. */ - unsigned int m_maxNumMeasurements; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TimeCategoryLogger"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // __KX_TIME_CATEGORY_LOGGER_H - diff --git a/source/gameengine/Ketsji/KX_TimeLogger.cpp b/source/gameengine/Ketsji/KX_TimeLogger.cpp deleted file mode 100644 index 5ec09df2791..00000000000 --- a/source/gameengine/Ketsji/KX_TimeLogger.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_TimeLogger.h" - -KX_TimeLogger::KX_TimeLogger(unsigned int maxNumMeasurements) : - m_maxNumMeasurements(maxNumMeasurements), - m_logStart(0), - m_logging(false) -{ -} - - -KX_TimeLogger::~KX_TimeLogger(void) -{ -} - - -void KX_TimeLogger::SetMaxNumMeasurements(unsigned int maxNumMeasurements) -{ - if ((m_maxNumMeasurements != maxNumMeasurements) && maxNumMeasurements) { - // Actual removing is done in NextMeasurement() - m_maxNumMeasurements = maxNumMeasurements; - } -} - - -unsigned int KX_TimeLogger::GetMaxNumMeasurements(void) const -{ - return m_maxNumMeasurements; -} - - -void KX_TimeLogger::StartLog(double now) -{ - if (!m_logging) { - m_logging = true; - m_logStart = now; - } -} - - -void KX_TimeLogger::EndLog(double now) -{ - if (m_logging) { - m_logging = false; - double time = now - m_logStart; - if (m_measurements.size() > 0) { - m_measurements[0] += time; - } - } -} - - -void KX_TimeLogger::NextMeasurement(double now) -{ - // End logging to current measurement - EndLog(now); - - // Add a new measurement at the front - double m = 0.; - m_measurements.push_front(m); - - // Remove measurement if we grow beyond the maximum size - if ((m_measurements.size()) > m_maxNumMeasurements) { - while (m_measurements.size() > m_maxNumMeasurements) { - m_measurements.pop_back(); - } - } -} - - - -double KX_TimeLogger::GetAverage(void) const -{ - double avg = 0.; - - unsigned int numMeasurements = m_measurements.size(); - if (numMeasurements > 1) { - for (unsigned int i = 1; i < numMeasurements; i++) { - avg += m_measurements[i]; - } - avg /= (float)numMeasurements - 1; - } - - return avg; -} - diff --git a/source/gameengine/Ketsji/KX_TimeLogger.h b/source/gameengine/Ketsji/KX_TimeLogger.h deleted file mode 100644 index b17000c98d0..00000000000 --- a/source/gameengine/Ketsji/KX_TimeLogger.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_TIME_LOGGER_H -#define __KX_TIME_LOGGER_H - -#ifdef WIN32 -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif - -#include - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -/** - * Stores and manages time measurements. - */ -class KX_TimeLogger { -public: - /** - * Constructor. - * @param maxNumMesasurements Maximum number of measurements stored (>1). - */ - KX_TimeLogger(unsigned int maxNumMeasurements = 10); - - /** - * Destructor. - */ - virtual ~KX_TimeLogger(void); - - /** - * Changes the maximum number of measurements that can be stored. - */ - virtual void SetMaxNumMeasurements(unsigned int maxNumMeasurements); - - /** - * Changes the maximum number of measurements that can be stored. - */ - virtual unsigned int GetMaxNumMeasurements(void) const; - - /** - * Starts logging in current measurement. - * @param now The current time. - */ - virtual void StartLog(double now); - - /** - * End logging in current measurement. - * @param now The current time. - */ - virtual void EndLog(double now); - - /** - * Logs time in next measurement. - * @param now The current time. - */ - virtual void NextMeasurement(double now); - - /** - * Returns average of all but the current measurement. - * @return The average of all but the current measurement. - */ - virtual double GetAverage(void) const; - -protected: - /** Storage for the measurements. */ - std::deque m_measurements; - - /** Maximum number of measurements. */ - unsigned int m_maxNumMeasurements; - - /** Time at start of logging. */ - double m_logStart; - - /** State of logging. */ - bool m_logging; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TimeLogger"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // __KX_TIME_LOGGER_H - diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp deleted file mode 100644 index eb55d0272f6..00000000000 --- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_TouchEventManager.h" -#include "SCA_ISensor.h" -#include "KX_TouchSensor.h" -#include "KX_GameObject.h" -#include "PHY_IPhysicsEnvironment.h" -#include "PHY_IPhysicsController.h" - - -KX_TouchEventManager::KX_TouchEventManager(class SCA_LogicManager* logicmgr, - PHY_IPhysicsEnvironment* physEnv) - : SCA_EventManager(logicmgr, TOUCH_EVENTMGR), - m_physEnv(physEnv) -{ - //notm_scene->addTouchCallback(STATIC_RESPONSE, KX_TouchEventManager::collisionResponse, this); - - //m_scene->addTouchCallback(OBJECT_RESPONSE, KX_TouchEventManager::collisionResponse, this); - //m_scene->addTouchCallback(SENSOR_RESPONSE, KX_TouchEventManager::collisionResponse, this); - - m_physEnv->addTouchCallback(PHY_OBJECT_RESPONSE, KX_TouchEventManager::newCollisionResponse, this); - m_physEnv->addTouchCallback(PHY_SENSOR_RESPONSE, KX_TouchEventManager::newCollisionResponse, this); - m_physEnv->addTouchCallback(PHY_BROADPH_RESPONSE, KX_TouchEventManager::newBroadphaseResponse, this); - -} - -bool KX_TouchEventManager::NewHandleCollision(void* object1, void* object2, const PHY_CollData *coll_data) -{ - - PHY_IPhysicsController* obj1 = static_cast(object1); - PHY_IPhysicsController* obj2 = static_cast(object2); - - m_newCollisions.insert(std::pair(obj1, obj2)); - - return false; -} - - -bool KX_TouchEventManager::newCollisionResponse(void *client_data, - void *object1, - void *object2, - const PHY_CollData *coll_data) -{ - KX_TouchEventManager *touchmgr = (KX_TouchEventManager *) client_data; - touchmgr->NewHandleCollision(object1, object2, coll_data); - return false; -} - -bool KX_TouchEventManager::newBroadphaseResponse(void *client_data, - void *object1, - void *object2, - const PHY_CollData *coll_data) -{ - PHY_IPhysicsController* ctrl = static_cast(object1); - KX_ClientObjectInfo* info = (ctrl) ? static_cast(ctrl->getNewClientInfo()) : NULL; - // This call back should only be called for controllers of Near and Radar sensor - if (!info) - return true; - - switch (info->m_type) - { - case KX_ClientObjectInfo::SENSOR: - if (info->m_sensors.size() == 1) - { - // only one sensor for this type of object - KX_TouchSensor* touchsensor = static_cast(*info->m_sensors.begin()); - return touchsensor->BroadPhaseFilterCollision(object1,object2); - } - break; - case KX_ClientObjectInfo::OBSENSOR: - case KX_ClientObjectInfo::OBACTORSENSOR: - // this object may have multiple collision sensors, - // check is any of them is interested in this object - for(std::list::iterator it = info->m_sensors.begin(); - it != info->m_sensors.end(); - ++it) - { - if ((*it)->GetSensorType() == SCA_ISensor::ST_TOUCH) - { - KX_TouchSensor* touchsensor = static_cast(*it); - if (touchsensor->BroadPhaseSensorFilterCollision(object1, object2)) - return true; - } - } - return false; - } - return true; -} - -void KX_TouchEventManager::RegisterSensor(SCA_ISensor* sensor) -{ - KX_TouchSensor* touchsensor = static_cast(sensor); - if (m_sensors.AddBack(touchsensor)) - // the sensor was effectively inserted, register it - touchsensor->RegisterSumo(this); -} - -void KX_TouchEventManager::RemoveSensor(SCA_ISensor* sensor) -{ - KX_TouchSensor* touchsensor = static_cast(sensor); - if (touchsensor->Delink()) - // the sensor was effectively removed, unregister it - touchsensor->UnregisterSumo(this); -} - - - -void KX_TouchEventManager::EndFrame() -{ - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - { - (*it)->EndFrame(); - } -} - - - -void KX_TouchEventManager::NextFrame() -{ - if (!m_sensors.Empty()) - { - SG_DList::iterator it(m_sensors); - for (it.begin();!it.end();++it) - (*it)->SynchronizeTransform(); - - for (std::set::iterator cit = m_newCollisions.begin(); cit != m_newCollisions.end(); ++cit) - { - PHY_IPhysicsController* ctrl1 = (*cit).first; -// PHY_IPhysicsController* ctrl2 = (*cit).second; -// KX_GameObject* gameOb1 = ctrl1->getClientInfo(); -// KX_GameObject* gameOb1 = ctrl1->getClientInfo(); - - KX_ClientObjectInfo *client_info = static_cast(ctrl1->getNewClientInfo()); - list::iterator sit; - if (client_info) { - for ( sit = client_info->m_sensors.begin(); sit != client_info->m_sensors.end(); ++sit) { - static_cast(*sit)->NewHandleCollision((*cit).first, (*cit).second, NULL); - } - } - client_info = static_cast((*cit).second->getNewClientInfo()); - if (client_info) { - for ( sit = client_info->m_sensors.begin(); sit != client_info->m_sensors.end(); ++sit) { - static_cast(*sit)->NewHandleCollision((*cit).second, (*cit).first, NULL); - } - } - } - - m_newCollisions.clear(); - - for (it.begin();!it.end();++it) - (*it)->Activate(m_logicmgr); - } -} diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.h b/source/gameengine/Ketsji/KX_TouchEventManager.h deleted file mode 100644 index 57d2894498a..00000000000 --- a/source/gameengine/Ketsji/KX_TouchEventManager.h +++ /dev/null @@ -1,88 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_TOUCHEVENTMANAGER -#define __KX_TOUCHEVENTMANAGER - - -#include "SCA_EventManager.h" -#include "KX_TouchSensor.h" -#include "KX_GameObject.h" - -#include -#include - -class SCA_ISensor; -class PHY_IPhysicsEnvironment; - -class KX_TouchEventManager : public SCA_EventManager -{ - typedef std::pair NewCollision; - PHY_IPhysicsEnvironment* m_physEnv; - - std::set m_newCollisions; - - - static bool newCollisionResponse(void *client_data, - void *object1, - void *object2, - const PHY_CollData *coll_data); - - static bool newBroadphaseResponse(void *client_data, - void *object1, - void *object2, - const PHY_CollData *coll_data); - - virtual bool NewHandleCollision(void* obj1,void* obj2, - const PHY_CollData * coll_data); - - - - - -public: - KX_TouchEventManager(class SCA_LogicManager* logicmgr, - PHY_IPhysicsEnvironment* physEnv); - virtual void NextFrame(); - virtual void EndFrame(); - virtual void RegisterSensor(SCA_ISensor* sensor); - virtual void RemoveSensor(SCA_ISensor* sensor); - SCA_LogicManager* GetLogicManager() { return m_logicmgr;} - PHY_IPhysicsEnvironment *GetPhysicsEnvironment() { return m_physEnv; } - virtual void Replace_PhysicsScene(PHY_IPhysicsEnvironment* env) { m_physEnv= env; } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TouchEventManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_TOUCHEVENTMANAGER - diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp deleted file mode 100644 index 9b44f487682..00000000000 --- a/source/gameengine/Ketsji/KX_TouchSensor.cpp +++ /dev/null @@ -1,347 +0,0 @@ -/** - * Senses touch and collision events - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_TouchSensor.h" -#include "SCA_EventManager.h" -#include "SCA_LogicManager.h" -#include "KX_GameObject.h" -#include "KX_TouchEventManager.h" - -#include "PHY_IPhysicsController.h" - -#include -#include "PHY_IPhysicsEnvironment.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - -void KX_TouchSensor::SynchronizeTransform() -{ - // the touch sensor does not require any synchronization: it uses - // the same physical object which is already synchronized by Blender -} - - -void KX_TouchSensor::EndFrame() { - m_colliders->ReleaseAndRemoveAll(); - m_hitObject = NULL; - m_bTriggered = false; - m_bColliderHash = 0; -} - -void KX_TouchSensor::UnregisterToManager() -{ - // before unregistering the sensor, make sure we release all references - EndFrame(); - SCA_ISensor::UnregisterToManager(); -} - -bool KX_TouchSensor::Evaluate() -{ - bool result = false; - bool reset = m_reset && m_level; - m_reset = false; - if (m_bTriggered != m_bLastTriggered) - { - m_bLastTriggered = m_bTriggered; - if (!m_bTriggered) - m_hitObject = NULL; - result = true; - } - if (reset) - // force an event - result = true; - - if (m_bTouchPulse) { /* pulse on changes to the colliders */ - int count = m_colliders->GetCount(); - - if (m_bLastCount!=count || m_bColliderHash!=m_bLastColliderHash) { - m_bLastCount = count; - m_bLastColliderHash= m_bColliderHash; - result = true; - } - } - return result; -} - -KX_TouchSensor::KX_TouchSensor(SCA_EventManager* eventmgr,KX_GameObject* gameobj,bool bFindMaterial,bool bTouchPulse,const STR_String& touchedpropname) -:SCA_ISensor(gameobj,eventmgr), -m_touchedpropname(touchedpropname), -m_bFindMaterial(bFindMaterial), -m_bTouchPulse(bTouchPulse) -/*m_sumoObj(sumoObj),*/ -{ -// KX_TouchEventManager* touchmgr = (KX_TouchEventManager*) eventmgr; -// m_resptable = touchmgr->GetResponseTable(); - -// m_solidHandle = m_sumoObj->getObjectHandle(); - - m_colliders = new CListValue(); - - KX_ClientObjectInfo *client_info = gameobj->getClientInfo(); - //client_info->m_gameobject = gameobj; - //client_info->m_auxilary_info = NULL; - client_info->m_sensors.push_back(this); - - m_physCtrl = dynamic_cast(gameobj->GetPhysicsController()); - MT_assert( !gameobj->GetPhysicsController() || m_physCtrl ); - Init(); -} - -void KX_TouchSensor::Init() -{ - m_bCollision = false; - m_bTriggered = false; - m_bLastTriggered = (m_invert)?true:false; - m_bLastCount = 0; - m_bColliderHash = m_bLastColliderHash = 0; - m_hitObject = NULL; - m_reset = true; -} - -KX_TouchSensor::~KX_TouchSensor() -{ - //DT_ClearObjectResponse(m_resptable,m_solidHandle); - m_colliders->Release(); -} - -CValue* KX_TouchSensor::GetReplica() -{ - KX_TouchSensor* replica = new KX_TouchSensor(*this); - replica->ProcessReplica(); - return replica; -} - -void KX_TouchSensor::ProcessReplica() -{ - SCA_ISensor::ProcessReplica(); - m_colliders = new CListValue(); - Init(); -} - -void KX_TouchSensor::ReParent(SCA_IObject* parent) -{ - KX_GameObject *gameobj = static_cast(parent); - PHY_IPhysicsController *sphy = dynamic_cast(((KX_GameObject*)parent)->GetPhysicsController()); - if (sphy) - m_physCtrl = sphy; - -// m_solidHandle = m_sumoObj->getObjectHandle(); - KX_ClientObjectInfo *client_info = gameobj->getClientInfo(); - //client_info->m_gameobject = gameobj; - //client_info->m_auxilary_info = NULL; - - client_info->m_sensors.push_back(this); - SCA_ISensor::ReParent(parent); -} - -void KX_TouchSensor::RegisterSumo(KX_TouchEventManager *touchman) -{ - if (m_physCtrl) - { - if (touchman->GetPhysicsEnvironment()->requestCollisionCallback(m_physCtrl)) - { - KX_ClientObjectInfo* client_info = static_cast(m_physCtrl->getNewClientInfo()); - if (client_info->isSensor()) - touchman->GetPhysicsEnvironment()->addSensor(m_physCtrl); - } - } -} -void KX_TouchSensor::UnregisterSumo(KX_TouchEventManager* touchman) -{ - if (m_physCtrl) - { - if (touchman->GetPhysicsEnvironment()->removeCollisionCallback(m_physCtrl)) - { - // no more sensor on the controller, can remove it if it is a sensor object - KX_ClientObjectInfo* client_info = static_cast(m_physCtrl->getNewClientInfo()); - if (client_info->isSensor()) - touchman->GetPhysicsEnvironment()->removeSensor(m_physCtrl); - } - } -} - -// this function is called only for sensor objects -// return true if the controller can collide with the object -bool KX_TouchSensor::BroadPhaseSensorFilterCollision(void*obj1,void*obj2) -{ - assert(obj1==m_physCtrl && obj2); - - KX_GameObject* myobj = (KX_GameObject*)GetParent(); - KX_GameObject* myparent = myobj->GetParent(); - KX_ClientObjectInfo* client_info = static_cast(((PHY_IPhysicsController*)obj2)->getNewClientInfo()); - KX_ClientObjectInfo* my_client_info = static_cast(m_physCtrl->getNewClientInfo()); - KX_GameObject* otherobj = ( client_info ? client_info->m_gameobject : NULL); - - // first, decrement refcount as GetParent() increases it - if (myparent) - myparent->Release(); - - // we can only check on persistent characteristic: m_link and m_suspended are not - // good candidate because they are transient. That must be handled at another level - if (!otherobj || - otherobj == myparent || // don't interact with our parent - (my_client_info->m_type == KX_ClientObjectInfo::OBACTORSENSOR && - client_info->m_type != KX_ClientObjectInfo::ACTOR)) // only with actor objects - return false; - - bool found = m_touchedpropname.IsEmpty(); - if (!found) - { - if (m_bFindMaterial) - { - if (client_info->m_auxilary_info) - { - found = (!strcmp(m_touchedpropname.Ptr(), (char*)client_info->m_auxilary_info)); - } - } else - { - found = (otherobj->GetProperty(m_touchedpropname) != NULL); - } - } - return found; -} - -bool KX_TouchSensor::NewHandleCollision(void*object1,void*object2,const PHY_CollData* colldata) -{ -// KX_TouchEventManager* toucheventmgr = (KX_TouchEventManager*)m_eventmgr; - KX_GameObject* parent = (KX_GameObject*)GetParent(); - - // need the mapping from PHY_IPhysicsController to gameobjects now - - KX_ClientObjectInfo* client_info = static_cast (object1 == m_physCtrl? - ((PHY_IPhysicsController*)object2)->getNewClientInfo(): - ((PHY_IPhysicsController*)object1)->getNewClientInfo()); - - KX_GameObject* gameobj = ( client_info ? - client_info->m_gameobject : - NULL); - - // add the same check as in SCA_ISensor::Activate(), - // we don't want to record collision when the sensor is not active. - if (m_links && !m_suspended && - gameobj && (gameobj != parent) && client_info->isActor()) - { - - bool found = m_touchedpropname.IsEmpty(); - if (!found) - { - if (m_bFindMaterial) - { - if (client_info->m_auxilary_info) - { - found = (!strcmp(m_touchedpropname.Ptr(), (char*)client_info->m_auxilary_info)); - } - } else - { - found = (gameobj->GetProperty(m_touchedpropname) != NULL); - } - } - if (found) - { - if (!m_colliders->SearchValue(gameobj)) { - m_colliders->Add(gameobj->AddRef()); - - if (m_bTouchPulse) - m_bColliderHash += (uint_ptr)(static_cast(&gameobj)); - } - m_bTriggered = true; - m_hitObject = gameobj; - //printf("KX_TouchSensor::HandleCollision\n"); - } - - } - return false; // was DT_CONTINUE but this was defined in sumo as false. -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_TouchSensor::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_TouchSensor", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_ISensor::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_TouchSensor::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_TouchSensor::Attributes[] = { - KX_PYATTRIBUTE_STRING_RW("propName",0,100,false,KX_TouchSensor,m_touchedpropname), - KX_PYATTRIBUTE_BOOL_RW("useMaterial",KX_TouchSensor,m_bFindMaterial), - KX_PYATTRIBUTE_BOOL_RW("usePulseCollision",KX_TouchSensor,m_bTouchPulse), - KX_PYATTRIBUTE_RO_FUNCTION("hitObject", KX_TouchSensor, pyattr_get_object_hit), - KX_PYATTRIBUTE_RO_FUNCTION("hitObjectList", KX_TouchSensor, pyattr_get_object_hit_list), - { NULL } //Sentinel -}; - -/* Python API */ - -PyObject* KX_TouchSensor::pyattr_get_object_hit(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_TouchSensor* self= static_cast(self_v); - - if (self->m_hitObject) - return self->m_hitObject->GetProxy(); - else - Py_RETURN_NONE; -} - -PyObject* KX_TouchSensor::pyattr_get_object_hit_list(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_TouchSensor* self= static_cast(self_v); - return self->m_colliders->GetProxy(); -} - -#endif - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_TouchSensor.h b/source/gameengine/Ketsji/KX_TouchSensor.h deleted file mode 100644 index c9448897936..00000000000 --- a/source/gameengine/Ketsji/KX_TouchSensor.h +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Senses touch and collision events - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __KX_TOUCHSENSOR -#define __KX_TOUCHSENSOR - -#include "SCA_ISensor.h" -#include "ListValue.h" - -struct PHY_CollData; - -#include "KX_ClientObjectInfo.h" - -#if defined(_WIN64) -typedef unsigned __int64 uint_ptr; -#else -typedef unsigned long uint_ptr; -#endif - -class KX_TouchEventManager; - -class KX_TouchSensor : public SCA_ISensor -{ -protected: - Py_Header; - - /** - * The sensor should only look for objects with this property. - */ - STR_String m_touchedpropname; - bool m_bFindMaterial; - bool m_bTouchPulse; /* changes in the colliding objects trigger pulses */ - - class PHY_IPhysicsController* m_physCtrl; - - bool m_bCollision; - bool m_bTriggered; - bool m_bLastTriggered; - - // Use with m_bTouchPulse to detect changes - int m_bLastCount; /* size of m_colliders last tick */ - uint_ptr m_bColliderHash; /* hash collision objects pointers to trigger incase one object collides and another takes its place */ - uint_ptr m_bLastColliderHash; - - SCA_IObject* m_hitObject; - class CListValue* m_colliders; - -public: - KX_TouchSensor(class SCA_EventManager* eventmgr, - class KX_GameObject* gameobj, - bool bFindMaterial, - bool bTouchPulse, - const STR_String& touchedpropname) ; - virtual ~KX_TouchSensor(); - - virtual CValue* GetReplica(); - virtual void ProcessReplica(); - virtual void SynchronizeTransform(); - virtual bool Evaluate(); - virtual void Init(); - virtual void ReParent(SCA_IObject* parent); - - virtual void RegisterSumo(KX_TouchEventManager* touchman); - virtual void UnregisterSumo(KX_TouchEventManager* touchman); - virtual void UnregisterToManager(); - -// virtual DT_Bool HandleCollision(void* obj1,void* obj2, -// const DT_CollData * coll_data); - - virtual bool NewHandleCollision(void*obj1,void*obj2,const PHY_CollData* colldata); - - // Allows to do pre-filtering and save computation time - // obj1 = sensor physical controller, obj2 = physical controller of second object - // return value = true if collision should be checked on pair of object - virtual bool BroadPhaseFilterCollision(void*obj1,void*obj2) { return true; } - virtual bool BroadPhaseSensorFilterCollision(void*obj1,void*obj2); - virtual sensortype GetSensorType() { return ST_TOUCH; } - - - virtual bool IsPositiveTrigger() { - bool result = m_bTriggered; - if (m_invert) result = !result; - return result; - } - - virtual void EndFrame(); - - class PHY_IPhysicsController* GetPhysicsController() { return m_physCtrl; } - - - // todo: put some info for collision maybe - -#ifndef DISABLE_PYTHON - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - - static PyObject* pyattr_get_object_hit(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - static PyObject* pyattr_get_object_hit_list(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - -#endif - -}; - -#endif //__KX_TOUCHSENSOR - diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp deleted file mode 100644 index ae8d2f6459b..00000000000 --- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp +++ /dev/null @@ -1,491 +0,0 @@ -// -// Replace the mesh for this actuator's parent -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** - -// todo: not all trackflags / upflags are implemented/tested ! -// m_trackflag is used to determine the forward tracking direction -// m_upflag for the up direction -// normal situation is +y for forward, +z for up - -#include "MT_Scalar.h" -#include "SCA_IActuator.h" -#include "KX_TrackToActuator.h" -#include "SCA_IScene.h" -#include "SCA_LogicManager.h" -#include -#include -#include "KX_GameObject.h" - -#include "PyObjectPlus.h" - -/* ------------------------------------------------------------------------- */ -/* Native functions */ -/* ------------------------------------------------------------------------- */ - - - -KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj, - SCA_IObject *ob, - int time, - bool allow3D, - int trackflag, - int upflag) - : SCA_IActuator(gameobj, KX_ACT_TRACKTO) -{ - m_time = time; - m_allow3D = allow3D; - m_object = ob; - m_trackflag = trackflag; - m_upflag = upflag; - m_parentobj = 0; - - if (m_object) - m_object->RegisterActuator(this); - - { - // if the object is vertex parented, don't check parent orientation as the link is broken - if (!((KX_GameObject*)gameobj)->IsVertexParent()){ - m_parentobj = ((KX_GameObject*)gameobj)->GetParent(); // check if the object is parented - if (m_parentobj) { - // if so, store the initial local rotation - // this is needed to revert the effect of the parent inverse node (TBC) - m_parentlocalmat = m_parentobj->GetSGNode()->GetLocalOrientation(); - // use registration mechanism rather than AddRef, it creates zombie objects - m_parentobj->RegisterActuator(this); - // GetParent did AddRef, undo here - m_parentobj->Release(); - } - } - } - -} /* End of constructor */ - - - -/* old function from Blender */ -MT_Matrix3x3 EulToMat3(float *eul) -{ - MT_Matrix3x3 mat; - float ci, cj, ch, si, sj, sh, cc, cs, sc, ss; - - ci = cos(eul[0]); - cj = cos(eul[1]); - ch = cos(eul[2]); - si = sin(eul[0]); - sj = sin(eul[1]); - sh = sin(eul[2]); - cc = ci*ch; - cs = ci*sh; - sc = si*ch; - ss = si*sh; - - mat[0][0] = cj*ch; - mat[1][0] = sj*sc-cs; - mat[2][0] = sj*cc+ss; - mat[0][1] = cj*sh; - mat[1][1] = sj*ss+cc; - mat[2][1] = sj*cs-sc; - mat[0][2] = -sj; - mat[1][2] = cj*si; - mat[2][2] = cj*ci; - - return mat; -} - - - -/* old function from Blender */ -void Mat3ToEulOld(MT_Matrix3x3 mat, float *eul) -{ - MT_Scalar cy; - - cy = sqrt(mat[0][0]*mat[0][0] + mat[0][1]*mat[0][1]); - - if (cy > 16.0*FLT_EPSILON) { - eul[0] = atan2(mat[1][2], mat[2][2]); - eul[1] = atan2(-mat[0][2], cy); - eul[2] = atan2(mat[0][1], mat[0][0]); - } else { - eul[0] = atan2(-mat[2][1], mat[1][1]); - eul[1] = atan2(-mat[0][2], cy); - eul[2] = 0.0; - } -} - - - -/* old function from Blender */ -void compatible_eulFast(float *eul, float *oldrot) -{ - float dx, dy, dz; - - /* angular difference of 360 degrees */ - - dx= eul[0] - oldrot[0]; - dy= eul[1] - oldrot[1]; - dz= eul[2] - oldrot[2]; - - if( fabs(dx) > MT_PI) { - if(dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI; - } - if( fabs(dy) > MT_PI) { - if(dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI; - } - if( fabs(dz) > MT_PI ) { - if(dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI; - } -} - - - -MT_Matrix3x3 matrix3x3_interpol(MT_Matrix3x3 oldmat, MT_Matrix3x3 mat, int m_time) -{ - float eul[3], oldeul[3]; - - Mat3ToEulOld(oldmat, oldeul); - Mat3ToEulOld(mat, eul); - compatible_eulFast(eul, oldeul); - - eul[0]= (m_time*oldeul[0] + eul[0])/(1.0+m_time); - eul[1]= (m_time*oldeul[1] + eul[1])/(1.0+m_time); - eul[2]= (m_time*oldeul[2] + eul[2])/(1.0+m_time); - - return EulToMat3(eul); -} - - - -KX_TrackToActuator::~KX_TrackToActuator() -{ - if (m_object) - m_object->UnregisterActuator(this); - if (m_parentobj) - m_parentobj->UnregisterActuator(this); -} /* end of destructor */ - -void KX_TrackToActuator::ProcessReplica() -{ - // the replica is tracking the same object => register it - if (m_object) - m_object->RegisterActuator(this); - if (m_parentobj) - m_parentobj->RegisterActuator(this); - SCA_IActuator::ProcessReplica(); -} - - -bool KX_TrackToActuator::UnlinkObject(SCA_IObject* clientobj) -{ - if (clientobj == m_object) - { - // this object is being deleted, we cannot continue to track it. - m_object = NULL; - return true; - } - if (clientobj == m_parentobj) - { - m_parentobj = NULL; - return true; - } - return false; -} - -void KX_TrackToActuator::Relink(GEN_Map *obj_map) -{ - void **h_obj = (*obj_map)[m_object]; - if (h_obj) { - if (m_object) - m_object->UnregisterActuator(this); - m_object = (SCA_IObject*)(*h_obj); - m_object->RegisterActuator(this); - } - - void **h_parobj = (*obj_map)[m_parentobj]; - if (h_parobj) { - if (m_parentobj) - m_parentobj->UnregisterActuator(this); - m_parentobj= (KX_GameObject*)(*h_parobj); - m_parentobj->RegisterActuator(this); - } -} - - -bool KX_TrackToActuator::Update(double curtime, bool frame) -{ - bool result = false; - bool bNegativeEvent = IsNegativeEvent(); - RemoveAllEvents(); - - if (bNegativeEvent) - { - // do nothing on negative events - } - else if (m_object) - { - KX_GameObject* curobj = (KX_GameObject*) GetParent(); - MT_Vector3 dir = ((KX_GameObject*)m_object)->NodeGetWorldPosition() - curobj->NodeGetWorldPosition(); - if (dir.length2()) - dir.normalize(); - MT_Vector3 up(0,0,1); - - -#ifdef DSADSA - switch (m_upflag) - { - case 0: - { - up.setValue(1.0,0,0); - break; - } - case 1: - { - up.setValue(0,1.0,0); - break; - } - case 2: - default: - { - up.setValue(0,0,1.0); - } - } -#endif - if (m_allow3D) - { - up = (up - up.dot(dir) * dir).safe_normalized(); - - } - else - { - dir = (dir - up.dot(dir)*up).safe_normalized(); - } - - MT_Vector3 left; - MT_Matrix3x3 mat; - - switch (m_trackflag) - { - case 0: // TRACK X - { - // (1.0 , 0.0 , 0.0 ) x direction is forward, z (0.0 , 0.0 , 1.0 ) up - left = dir.safe_normalized(); - dir = (left.cross(up)).safe_normalized(); - mat.setValue ( - left[0], dir[0],up[0], - left[1], dir[1],up[1], - left[2], dir[2],up[2] - ); - - break; - }; - case 1: // TRACK Y - { - // (0.0 , 1.0 , 0.0 ) y direction is forward, z (0.0 , 0.0 , 1.0 ) up - left = (dir.cross(up)).safe_normalized(); - mat.setValue ( - left[0], dir[0],up[0], - left[1], dir[1],up[1], - left[2], dir[2],up[2] - ); - - break; - } - - case 2: // track Z - { - left = up.safe_normalized(); - up = dir.safe_normalized(); - dir = left; - left = (dir.cross(up)).safe_normalized(); - mat.setValue ( - left[0], dir[0],up[0], - left[1], dir[1],up[1], - left[2], dir[2],up[2] - ); - break; - } - - case 3: // TRACK -X - { - // (1.0 , 0.0 , 0.0 ) x direction is forward, z (0.0 , 0.0 , 1.0 ) up - left = -dir.safe_normalized(); - dir = -(left.cross(up)).safe_normalized(); - mat.setValue ( - left[0], dir[0],up[0], - left[1], dir[1],up[1], - left[2], dir[2],up[2] - ); - - break; - }; - case 4: // TRACK -Y - { - // (0.0 , -1.0 , 0.0 ) -y direction is forward, z (0.0 , 0.0 , 1.0 ) up - left = (-dir.cross(up)).safe_normalized(); - mat.setValue ( - left[0], -dir[0],up[0], - left[1], -dir[1],up[1], - left[2], -dir[2],up[2] - ); - break; - } - case 5: // track -Z - { - left = up.safe_normalized(); - up = -dir.safe_normalized(); - dir = left; - left = (dir.cross(up)).safe_normalized(); - mat.setValue ( - left[0], dir[0],up[0], - left[1], dir[1],up[1], - left[2], dir[2],up[2] - ); - - break; - } - - default: - { - // (1.0 , 0.0 , 0.0 ) -x direction is forward, z (0.0 , 0.0 , 1.0 ) up - left = -dir.safe_normalized(); - dir = -(left.cross(up)).safe_normalized(); - mat.setValue ( - left[0], dir[0],up[0], - left[1], dir[1],up[1], - left[2], dir[2],up[2] - ); - } - } - - MT_Matrix3x3 oldmat; - oldmat= curobj->NodeGetWorldOrientation(); - - /* erwin should rewrite this! */ - mat= matrix3x3_interpol(oldmat, mat, m_time); - - - if(m_parentobj){ // check if the model is parented and calculate the child transform - - MT_Point3 localpos; - localpos = curobj->GetSGNode()->GetLocalPosition(); - // Get the inverse of the parent matrix - MT_Matrix3x3 parentmatinv; - parentmatinv = m_parentobj->NodeGetWorldOrientation ().inverse (); - // transform the local coordinate system into the parents system - mat = parentmatinv * mat; - // append the initial parent local rotation matrix - mat = m_parentlocalmat * mat; - - // set the models tranformation properties - curobj->NodeSetLocalOrientation(mat); - curobj->NodeSetLocalPosition(localpos); - //curobj->UpdateTransform(); - } - else - { - curobj->NodeSetLocalOrientation(mat); - } - - result = true; - } - - return result; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_TrackToActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_TrackToActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_TrackToActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_TrackToActuator::Attributes[] = { - KX_PYATTRIBUTE_INT_RW("time",0,1000,true,KX_TrackToActuator,m_time), - KX_PYATTRIBUTE_BOOL_RW("use3D",KX_TrackToActuator,m_allow3D), - KX_PYATTRIBUTE_RW_FUNCTION("object", KX_TrackToActuator, pyattr_get_object, pyattr_set_object), - - { NULL } //Sentinel -}; - -PyObject* KX_TrackToActuator::pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) -{ - KX_TrackToActuator* actuator = static_cast(self); - if (!actuator->m_object) - Py_RETURN_NONE; - else - return actuator->m_object->GetProxy(); -} - -int KX_TrackToActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -{ - KX_TrackToActuator* actuator = static_cast(self); - KX_GameObject *gameobj; - - if (!ConvertPythonToGameObject(value, &gameobj, true, "actuator.object = value: KX_TrackToActuator")) - return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - - if (actuator->m_object != NULL) - actuator->m_object->UnregisterActuator(actuator); - - actuator->m_object = (SCA_IObject*) gameobj; - - if (actuator->m_object) - actuator->m_object->RegisterActuator(actuator); - - return PY_SET_ATTR_SUCCESS; -} - -#endif // DISABLE_PYTHON - -/* eof */ diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.h b/source/gameengine/Ketsji/KX_TrackToActuator.h deleted file mode 100644 index 2b44994f103..00000000000 --- a/source/gameengine/Ketsji/KX_TrackToActuator.h +++ /dev/null @@ -1,85 +0,0 @@ -// -// Add object to the game world on action of this actuator -// -// $Id$ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute 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. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// - -#ifndef __KX_TrackToActuator -#define __KX_TrackToActuator - -#include "SCA_IActuator.h" -#include "SCA_IObject.h" -#include "MT_Matrix3x3.h" -#include "KX_GameObject.h" - - -class KX_TrackToActuator : public SCA_IActuator -{ - Py_Header; - // Object reference. Actually, we use the object's 'life' - SCA_IObject* m_object; - // 3d toggle - bool m_allow3D; - // time field - int m_time; - int m_trackTime; - int m_trackflag; - int m_upflag; - - MT_Matrix3x3 m_parentlocalmat; - KX_GameObject* m_parentobj; - - public: - KX_TrackToActuator(SCA_IObject* gameobj, SCA_IObject *ob, int time, - bool threedee,int trackflag,int upflag); - virtual ~KX_TrackToActuator(); - virtual CValue* GetReplica() { - KX_TrackToActuator* replica = new KX_TrackToActuator(*this); - replica->ProcessReplica(); - return replica; - }; - - virtual void ProcessReplica(); - virtual bool UnlinkObject(SCA_IObject* clientobj); - virtual void Relink(GEN_Map *obj_map); - virtual bool Update(double curtime, bool frame); - -#ifndef DISABLE_PYTHON - - /* Python part */ - - /* These are used to get and set m_ob */ - static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - -#endif // DISABLE_PYTHON - -}; /* end of class KX_TrackToActuator : public KX_EditObjectActuator */ - -#endif - diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp deleted file mode 100644 index 4ee80c64570..00000000000 --- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp +++ /dev/null @@ -1,322 +0,0 @@ - - -#include "PyObjectPlus.h" - -#include "KX_VehicleWrapper.h" -#include "PHY_IPhysicsEnvironment.h" -#include "PHY_IVehicle.h" -#include "KX_PyMath.h" -#include "KX_GameObject.h" -#include "KX_MotionState.h" - -KX_VehicleWrapper::KX_VehicleWrapper( - PHY_IVehicle* vehicle, - PHY_IPhysicsEnvironment* physenv) : - PyObjectPlus(), - m_vehicle(vehicle), - m_physenv(physenv) -{ -} - -KX_VehicleWrapper::~KX_VehicleWrapper() -{ - int numMotion = m_motionStates.size(); - for (int i=0;iGetSGNode()) - { - PHY_IMotionState* motionState = new KX_MotionState(gameOb->GetSGNode()); - - /* TODO - no error checking here! - bad juju */ - MT_Vector3 attachPos,attachDir,attachAxle; - PyVecTo(pylistPos,attachPos); - PyVecTo(pylistDir,attachDir); - PyVecTo(pylistAxleDir,attachAxle); - PHY__Vector3 aPos,aDir,aAxle; - aPos[0] = attachPos[0]; - aPos[1] = attachPos[1]; - aPos[2] = attachPos[2]; - aDir[0] = attachDir[0]; - aDir[1] = attachDir[1]; - aDir[2] = attachDir[2]; - aAxle[0] = -attachAxle[0];//someone reverse some conventions inside Bullet (axle winding) - aAxle[1] = -attachAxle[1]; - aAxle[2] = -attachAxle[2]; - - printf("attempt for addWheel: suspensionRestLength%f wheelRadius %f, hasSteering:%d\n",suspensionRestLength,wheelRadius,hasSteering); - m_vehicle->AddWheel(motionState,aPos,aDir,aAxle,suspensionRestLength,wheelRadius,hasSteering); - } - - } else { - return NULL; - } - Py_RETURN_NONE; -} - - - - -PyObject* KX_VehicleWrapper::PyGetWheelPosition(PyObject* args) -{ - - int wheelIndex; - - if (PyArg_ParseTuple(args,"i:getWheelPosition",&wheelIndex)) - { - float position[3]; - m_vehicle->GetWheelPosition(wheelIndex,position[0],position[1],position[2]); - MT_Vector3 pos(position[0],position[1],position[2]); - return PyObjectFrom(pos); - } - return NULL; -} - -PyObject* KX_VehicleWrapper::PyGetWheelRotation(PyObject* args) -{ - int wheelIndex; - if (PyArg_ParseTuple(args,"i:getWheelRotation",&wheelIndex)) - { - return PyFloat_FromDouble(m_vehicle->GetWheelRotation(wheelIndex)); - } - return NULL; -} - -PyObject* KX_VehicleWrapper::PyGetWheelOrientationQuaternion(PyObject* args) -{ - int wheelIndex; - if (PyArg_ParseTuple(args,"i:getWheelOrientationQuaternion",&wheelIndex)) - { - float orn[4]; - m_vehicle->GetWheelOrientationQuaternion(wheelIndex,orn[0],orn[1],orn[2],orn[3]); - MT_Quaternion quatorn(orn[0],orn[1],orn[2],orn[3]); - MT_Matrix3x3 ornmat(quatorn); - return PyObjectFrom(ornmat); - } - return NULL; - -} - - -PyObject* KX_VehicleWrapper::PyGetNumWheels(PyObject* args) -{ - return PyLong_FromSsize_t(m_vehicle->GetNumWheels()); -} - - -PyObject* KX_VehicleWrapper::PyGetConstraintId(PyObject* args) -{ - return PyLong_FromSsize_t(m_vehicle->GetUserConstraintId()); -} - - - -PyObject* KX_VehicleWrapper::PyApplyEngineForce(PyObject* args) -{ - float force; - int wheelIndex; - - if (PyArg_ParseTuple(args,"fi:applyEngineForce",&force,&wheelIndex)) - { - force *= -1.f;//someone reverse some conventions inside Bullet (axle winding) - m_vehicle->ApplyEngineForce(force,wheelIndex); - } - else { - return NULL; - } - Py_RETURN_NONE; -} - -PyObject* KX_VehicleWrapper::PySetTyreFriction(PyObject* args) -{ - float wheelFriction; - int wheelIndex; - - if (PyArg_ParseTuple(args,"fi:setTyreFriction",&wheelFriction,&wheelIndex)) - { - m_vehicle->SetWheelFriction(wheelFriction,wheelIndex); - } - else { - return NULL; - } - Py_RETURN_NONE; -} - -PyObject* KX_VehicleWrapper::PySetSuspensionStiffness(PyObject* args) -{ - float suspensionStiffness; - int wheelIndex; - - if (PyArg_ParseTuple(args,"fi:setSuspensionStiffness",&suspensionStiffness,&wheelIndex)) - { - m_vehicle->SetSuspensionStiffness(suspensionStiffness,wheelIndex); - } - else { - return NULL; - } - Py_RETURN_NONE; -} - -PyObject* KX_VehicleWrapper::PySetSuspensionDamping(PyObject* args) -{ - float suspensionDamping; - int wheelIndex; - - if (PyArg_ParseTuple(args,"fi:setSuspensionDamping",&suspensionDamping,&wheelIndex)) - { - m_vehicle->SetSuspensionDamping(suspensionDamping,wheelIndex); - } else { - return NULL; - } - Py_RETURN_NONE; -} - -PyObject* KX_VehicleWrapper::PySetSuspensionCompression(PyObject* args) -{ - float suspensionCompression; - int wheelIndex; - - if (PyArg_ParseTuple(args,"fi:setSuspensionCompression",&suspensionCompression,&wheelIndex)) - { - m_vehicle->SetSuspensionCompression(suspensionCompression,wheelIndex); - } else { - return NULL; - } - Py_RETURN_NONE; -} - -PyObject* KX_VehicleWrapper::PySetRollInfluence(PyObject* args) -{ - float rollInfluence; - int wheelIndex; - - if (PyArg_ParseTuple(args,"fi:setRollInfluence",&rollInfluence,&wheelIndex)) - { - m_vehicle->SetRollInfluence(rollInfluence,wheelIndex); - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - -PyObject* KX_VehicleWrapper::PyApplyBraking(PyObject* args) -{ - float braking; - int wheelIndex; - - if (PyArg_ParseTuple(args,"fi:applyBraking",&braking,&wheelIndex)) - { - m_vehicle->ApplyBraking(braking,wheelIndex); - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - - - -PyObject* KX_VehicleWrapper::PySetSteeringValue(PyObject* args) -{ - float steeringValue; - int wheelIndex; - - if (PyArg_ParseTuple(args,"fi:setSteeringValue",&steeringValue,&wheelIndex)) - { - m_vehicle->SetSteeringValue(steeringValue,wheelIndex); - } - else { - return NULL; - } - Py_RETURN_NONE; -} - - -PyObject* KX_VehicleWrapper::PyGetConstraintType(PyObject* args) -{ - return PyLong_FromSsize_t(m_vehicle->GetUserConstraintType()); -} - - - - - -//python specific stuff -PyTypeObject KX_VehicleWrapper::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_VehicleWrapper", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &PyObjectPlus::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_VehicleWrapper::Methods[] = { - {"addWheel",(PyCFunction) KX_VehicleWrapper::sPyAddWheel, METH_VARARGS}, - {"getNumWheels",(PyCFunction) KX_VehicleWrapper::sPyGetNumWheels, METH_VARARGS}, - {"getWheelOrientationQuaternion",(PyCFunction) KX_VehicleWrapper::sPyGetWheelOrientationQuaternion, METH_VARARGS}, - {"getWheelRotation",(PyCFunction) KX_VehicleWrapper::sPyGetWheelRotation, METH_VARARGS}, - {"getWheelPosition",(PyCFunction) KX_VehicleWrapper::sPyGetWheelPosition, METH_VARARGS}, - {"getConstraintId",(PyCFunction) KX_VehicleWrapper::sPyGetConstraintId, METH_VARARGS}, - {"getConstraintType",(PyCFunction) KX_VehicleWrapper::sPyGetConstraintType, METH_VARARGS}, - {"setSteeringValue",(PyCFunction) KX_VehicleWrapper::sPySetSteeringValue, METH_VARARGS}, - {"applyEngineForce",(PyCFunction) KX_VehicleWrapper::sPyApplyEngineForce, METH_VARARGS}, - {"applyBraking",(PyCFunction) KX_VehicleWrapper::sPyApplyBraking, METH_VARARGS}, - - {"setTyreFriction",(PyCFunction) KX_VehicleWrapper::sPySetTyreFriction, METH_VARARGS}, - - {"setSuspensionStiffness",(PyCFunction) KX_VehicleWrapper::sPySetSuspensionStiffness, METH_VARARGS}, - - {"setSuspensionDamping",(PyCFunction) KX_VehicleWrapper::sPySetSuspensionDamping, METH_VARARGS}, - - {"setSuspensionCompression",(PyCFunction) KX_VehicleWrapper::sPySetSuspensionCompression, METH_VARARGS}, - - {"setRollInfluence",(PyCFunction) KX_VehicleWrapper::sPySetRollInfluence, METH_VARARGS}, - - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_VehicleWrapper::Attributes[] = { - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.h b/source/gameengine/Ketsji/KX_VehicleWrapper.h deleted file mode 100644 index 2ca06da18fc..00000000000 --- a/source/gameengine/Ketsji/KX_VehicleWrapper.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef KX_VEHICLE_WRAPPER -#define KX_VEHICLE_WRAPPER - -#include "Value.h" -#include "PHY_DynamicTypes.h" -class PHY_IVehicle; -class PHY_IMotionState; - -#include - -///Python interface to physics vehicles (primarily 4-wheel cars and 2wheel bikes) -class KX_VehicleWrapper : public PyObjectPlus -{ - Py_Header; - - std::vector m_motionStates; - -public: - KX_VehicleWrapper(PHY_IVehicle* vehicle,class PHY_IPhysicsEnvironment* physenv); - virtual ~KX_VehicleWrapper (); - int getConstraintId(); - -#ifndef DISABLE_PYTHON - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,AddWheel); - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetNumWheels); - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetWheelOrientationQuaternion); - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetWheelRotation); - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetWheelPosition); - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetConstraintId); - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetConstraintType); - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetSteeringValue); - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,ApplyEngineForce); - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,ApplyBraking); - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetTyreFriction); - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetSuspensionStiffness); - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetSuspensionDamping); - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetSuspensionCompression); - - KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetRollInfluence); -#endif // DISABLE_PYTHON - -private: - PHY_IVehicle* m_vehicle; - PHY_IPhysicsEnvironment* m_physenv; -}; - -#endif //KX_VEHICLE_WRAPPER diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp deleted file mode 100644 index 652bf5eafed..00000000000 --- a/source/gameengine/Ketsji/KX_VertexProxy.cpp +++ /dev/null @@ -1,444 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef DISABLE_PYTHON - -#include "KX_VertexProxy.h" -#include "KX_MeshProxy.h" -#include "RAS_TexVert.h" - -#include "KX_PyMath.h" - -PyTypeObject KX_VertexProxy::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_VertexProxy", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &CValue::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_VertexProxy::Methods[] = { -{"getXYZ", (PyCFunction)KX_VertexProxy::sPyGetXYZ,METH_NOARGS}, -{"setXYZ", (PyCFunction)KX_VertexProxy::sPySetXYZ,METH_O}, -{"getUV", (PyCFunction)KX_VertexProxy::sPyGetUV,METH_NOARGS}, -{"setUV", (PyCFunction)KX_VertexProxy::sPySetUV,METH_O}, - -{"getUV2", (PyCFunction)KX_VertexProxy::sPyGetUV2,METH_NOARGS}, -{"setUV2", (PyCFunction)KX_VertexProxy::sPySetUV2,METH_VARARGS}, - -{"getRGBA", (PyCFunction)KX_VertexProxy::sPyGetRGBA,METH_NOARGS}, -{"setRGBA", (PyCFunction)KX_VertexProxy::sPySetRGBA,METH_O}, -{"getNormal", (PyCFunction)KX_VertexProxy::sPyGetNormal,METH_NOARGS}, -{"setNormal", (PyCFunction)KX_VertexProxy::sPySetNormal,METH_O}, - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_VertexProxy::Attributes[] = { - //KX_PYATTRIBUTE_TODO("DummyProps"), - - KX_PYATTRIBUTE_DUMMY("x"), - KX_PYATTRIBUTE_DUMMY("y"), - KX_PYATTRIBUTE_DUMMY("z"), - - KX_PYATTRIBUTE_DUMMY("r"), - KX_PYATTRIBUTE_DUMMY("g"), - KX_PYATTRIBUTE_DUMMY("b"), - KX_PYATTRIBUTE_DUMMY("a"), - - KX_PYATTRIBUTE_DUMMY("u"), - KX_PYATTRIBUTE_DUMMY("v"), - - KX_PYATTRIBUTE_DUMMY("u2"), - KX_PYATTRIBUTE_DUMMY("v2"), - - KX_PYATTRIBUTE_DUMMY("XYZ"), - KX_PYATTRIBUTE_DUMMY("UV"), - - KX_PYATTRIBUTE_DUMMY("color"), - KX_PYATTRIBUTE_DUMMY("colour"), - - KX_PYATTRIBUTE_DUMMY("normal"), - - { NULL } //Sentinel -}; - -#if 0 -PyObject* -KX_VertexProxy::py_getattro(PyObject *attr) -{ - char *attr_str= _PyUnicode_AsString(attr); - if (attr_str[1]=='\0') { // Group single letters - // pos - if (attr_str[0]=='x') - return PyFloat_FromDouble(m_vertex->getXYZ()[0]); - if (attr_str[0]=='y') - return PyFloat_FromDouble(m_vertex->getXYZ()[1]); - if (attr_str[0]=='z') - return PyFloat_FromDouble(m_vertex->getXYZ()[2]); - - // Col - if (attr_str[0]=='r') - return PyFloat_FromDouble(m_vertex->getRGBA()[0]/255.0); - if (attr_str[0]=='g') - return PyFloat_FromDouble(m_vertex->getRGBA()[1]/255.0); - if (attr_str[0]=='b') - return PyFloat_FromDouble(m_vertex->getRGBA()[2]/255.0); - if (attr_str[0]=='a') - return PyFloat_FromDouble(m_vertex->getRGBA()[3]/255.0); - - // UV - if (attr_str[0]=='u') - return PyFloat_FromDouble(m_vertex->getUV1()[0]); - if (attr_str[0]=='v') - return PyFloat_FromDouble(m_vertex->getUV1()[1]); - } - - - if (!strcmp(attr_str, "XYZ")) - return PyObjectFrom(MT_Vector3(m_vertex->getXYZ())); - - if (!strcmp(attr_str, "UV")) - return PyObjectFrom(MT_Point2(m_vertex->getUV1())); - - if (!strcmp(attr_str, "color") || !strcmp(attr_str, "colour")) - { - const unsigned char *colp = m_vertex->getRGBA(); - MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]); - color /= 255.0; - return PyObjectFrom(color); - } - - if (!strcmp(attr_str, "normal")) - { - return PyObjectFrom(MT_Vector3(m_vertex->getNormal())); - } - - py_getattro_up(CValue); -} -#endif - - -#if 0 -int KX_VertexProxy::py_setattro(PyObject *attr, PyObject *pyvalue) -{ - char *attr_str= _PyUnicode_AsString(attr); - if (PySequence_Check(pyvalue)) - { - if (!strcmp(attr_str, "XYZ")) - { - MT_Point3 vec; - if (PyVecTo(pyvalue, vec)) - { - m_vertex->SetXYZ(vec); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - return PY_SET_ATTR_FAIL; - } - - if (!strcmp(attr_str, "UV")) - { - MT_Point2 vec; - if (PyVecTo(pyvalue, vec)) - { - m_vertex->SetUV(vec); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - return PY_SET_ATTR_FAIL; - } - - if (!strcmp(attr_str, "color") || !strcmp(attr_str, "colour")) - { - MT_Vector4 vec; - if (PyVecTo(pyvalue, vec)) - { - m_vertex->SetRGBA(vec); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - return PY_SET_ATTR_FAIL; - } - - if (!strcmp(attr_str, "normal")) - { - MT_Vector3 vec; - if (PyVecTo(pyvalue, vec)) - { - m_vertex->SetNormal(vec); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - return PY_SET_ATTR_FAIL; - } - } - - if (PyFloat_Check(pyvalue)) - { - float val = PyFloat_AsDouble(pyvalue); - // pos - MT_Point3 pos(m_vertex->getXYZ()); - if (!strcmp(attr_str, "x")) - { - pos.x() = val; - m_vertex->SetXYZ(pos); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - - if (!strcmp(attr_str, "y")) - { - pos.y() = val; - m_vertex->SetXYZ(pos); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - - if (!strcmp(attr_str, "z")) - { - pos.z() = val; - m_vertex->SetXYZ(pos); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - - // uv - MT_Point2 uv = m_vertex->getUV1(); - if (!strcmp(attr_str, "u")) - { - uv[0] = val; - m_vertex->SetUV(uv); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - - if (!strcmp(attr_str, "v")) - { - uv[1] = val; - m_vertex->SetUV(uv); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - - // uv - MT_Point2 uv2 = m_vertex->getUV2(); - if (!strcmp(attr_str, "u2")) - { - uv[0] = val; - m_vertex->SetUV2(uv); - m_mesh->SetMeshModified(true); - return 0; - } - - if (!strcmp(attr_str, "v2")) - { - uv[1] = val; - m_vertex->SetUV2(uv); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - - // col - unsigned int icol = *((const unsigned int *)m_vertex->getRGBA()); - unsigned char *cp = (unsigned char*) &icol; - val *= 255.0; - if (!strcmp(attr_str, "r")) - { - cp[0] = (unsigned char) val; - m_vertex->SetRGBA(icol); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - if (!strcmp(attr_str, "g")) - { - cp[1] = (unsigned char) val; - m_vertex->SetRGBA(icol); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - if (!strcmp(attr_str, "b")) - { - cp[2] = (unsigned char) val; - m_vertex->SetRGBA(icol); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - if (!strcmp(attr_str, "a")) - { - cp[3] = (unsigned char) val; - m_vertex->SetRGBA(icol); - m_mesh->SetMeshModified(true); - return PY_SET_ATTR_SUCCESS; - } - } - - return CValue::py_setattro(attr, pyvalue); -} -#endif - -KX_VertexProxy::KX_VertexProxy(KX_MeshProxy*mesh, RAS_TexVert* vertex) -: m_vertex(vertex), - m_mesh(mesh) -{ -} - -KX_VertexProxy::~KX_VertexProxy() -{ -} - - - -// stuff for cvalue related things -CValue* KX_VertexProxy::Calc(VALUE_OPERATOR, CValue *) { return NULL;} -CValue* KX_VertexProxy::CalcFinal(VALUE_DATA_TYPE, VALUE_OPERATOR, CValue *) { return NULL;} -STR_String sVertexName="vertex"; -const STR_String & KX_VertexProxy::GetText() {return sVertexName;}; -double KX_VertexProxy::GetNumber() { return -1;} -STR_String& KX_VertexProxy::GetName() { return sVertexName;} -void KX_VertexProxy::SetName(const char *) { }; -CValue* KX_VertexProxy::GetReplica() { return NULL;} - -// stuff for python integration - -PyObject* KX_VertexProxy::PyGetXYZ() -{ - return PyObjectFrom(MT_Point3(m_vertex->getXYZ())); -} - -PyObject* KX_VertexProxy::PySetXYZ(PyObject* value) -{ - MT_Point3 vec; - if (!PyVecTo(value, vec)) - return NULL; - - m_vertex->SetXYZ(vec); - m_mesh->SetMeshModified(true); - Py_RETURN_NONE; -} - -PyObject* KX_VertexProxy::PyGetNormal() -{ - return PyObjectFrom(MT_Vector3(m_vertex->getNormal())); -} - -PyObject* KX_VertexProxy::PySetNormal(PyObject* value) -{ - MT_Vector3 vec; - if (!PyVecTo(value, vec)) - return NULL; - - m_vertex->SetNormal(vec); - m_mesh->SetMeshModified(true); - Py_RETURN_NONE; -} - - -PyObject* KX_VertexProxy::PyGetRGBA() -{ - int *rgba = (int *) m_vertex->getRGBA(); - return PyLong_FromSsize_t(*rgba); -} - -PyObject* KX_VertexProxy::PySetRGBA(PyObject* value) -{ - if PyLong_Check(value) { - int rgba = PyLong_AsSsize_t(value); - m_vertex->SetRGBA(rgba); - m_mesh->SetMeshModified(true); - Py_RETURN_NONE; - } - else { - MT_Vector4 vec; - if (PyVecTo(value, vec)) - { - m_vertex->SetRGBA(vec); - m_mesh->SetMeshModified(true); - Py_RETURN_NONE; - } - } - - PyErr_SetString(PyExc_TypeError, "vert.setRGBA(value): KX_VertexProxy, expected a 4D vector or an int"); - return NULL; -} - - -PyObject* KX_VertexProxy::PyGetUV() -{ - return PyObjectFrom(MT_Vector2(m_vertex->getUV1())); -} - -PyObject* KX_VertexProxy::PySetUV(PyObject* value) -{ - MT_Point2 vec; - if (!PyVecTo(value, vec)) - return NULL; - - m_vertex->SetUV(vec); - m_mesh->SetMeshModified(true); - Py_RETURN_NONE; -} - -PyObject* KX_VertexProxy::PyGetUV2() -{ - return PyObjectFrom(MT_Vector2(m_vertex->getUV2())); -} - -PyObject* KX_VertexProxy::PySetUV2(PyObject* args) -{ - MT_Point2 vec; - unsigned int unit= RAS_TexVert::SECOND_UV; - - PyObject* list= NULL; - if(!PyArg_ParseTuple(args, "O|i:setUV2", &list, &unit)) - return NULL; - - if (!PyVecTo(list, vec)) - return NULL; - - m_vertex->SetFlag((m_vertex->getFlag()|RAS_TexVert::SECOND_UV)); - m_vertex->SetUnit(unit); - m_vertex->SetUV2(vec); - m_mesh->SetMeshModified(true); - Py_RETURN_NONE; -} - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h b/source/gameengine/Ketsji/KX_VertexProxy.h deleted file mode 100644 index 08fe0e7e2f8..00000000000 --- a/source/gameengine/Ketsji/KX_VertexProxy.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_VERTEXPROXY -#define __KX_VERTEXPROXY - -#ifndef DISABLE_PYTHON - -#include "SCA_IObject.h" - -class KX_VertexProxy : public CValue -{ - Py_Header; -protected: - - class RAS_TexVert* m_vertex; - class KX_MeshProxy* m_mesh; -public: - KX_VertexProxy(class KX_MeshProxy*mesh, class RAS_TexVert* vertex); - virtual ~KX_VertexProxy(); - - // stuff for cvalue related things - CValue* Calc(VALUE_OPERATOR op, CValue *val) ; - CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - const STR_String & GetText(); - double GetNumber(); - STR_String& GetName(); - void SetName(const char *name); // Set the name of the value - CValue* GetReplica(); - - -// stuff for python integration - - KX_PYMETHOD_NOARGS(KX_VertexProxy,GetXYZ); - KX_PYMETHOD_O(KX_VertexProxy,SetXYZ); - KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV); - KX_PYMETHOD_O(KX_VertexProxy,SetUV); - - KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV2); - KX_PYMETHOD_VARARGS(KX_VertexProxy,SetUV2); - - KX_PYMETHOD_NOARGS(KX_VertexProxy,GetRGBA); - KX_PYMETHOD_O(KX_VertexProxy,SetRGBA); - KX_PYMETHOD_NOARGS(KX_VertexProxy,GetNormal); - KX_PYMETHOD_O(KX_VertexProxy,SetNormal); - -}; - -#endif // DISABLE_PYTHON - -#endif //__KX_VERTEXPROXY - diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp deleted file mode 100644 index e2f2badf051..00000000000 --- a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Actuator to toggle visibility/invisibility of objects - */ - -#include "KX_VisibilityActuator.h" -#include "KX_GameObject.h" - -KX_VisibilityActuator::KX_VisibilityActuator( - SCA_IObject* gameobj, - bool visible, - bool occlusion, - bool recursive - ) - : SCA_IActuator(gameobj, KX_ACT_VISIBILITY), - m_visible(visible), - m_occlusion(occlusion), - m_recursive(recursive) -{ - // intentionally empty -} - -KX_VisibilityActuator::~KX_VisibilityActuator( - void - ) -{ - // intentionally empty -} - -CValue* -KX_VisibilityActuator::GetReplica( - void - ) -{ - KX_VisibilityActuator* replica = new KX_VisibilityActuator(*this); - replica->ProcessReplica(); - return replica; -} - -bool -KX_VisibilityActuator::Update() -{ - bool bNegativeEvent = IsNegativeEvent(); - - RemoveAllEvents(); - if (bNegativeEvent) return false; - - KX_GameObject *obj = (KX_GameObject*) GetParent(); - - obj->SetVisible(m_visible, m_recursive); - obj->SetOccluder(m_occlusion, m_recursive); - obj->UpdateBuckets(m_recursive); - - return false; -} - -#ifndef DISABLE_PYTHON - -/* ------------------------------------------------------------------------- */ -/* Python functions */ -/* ------------------------------------------------------------------------- */ - - - -/* Integration hooks ------------------------------------------------------- */ -PyTypeObject KX_VisibilityActuator::Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "KX_VisibilityActuator", - sizeof(PyObjectPlus_Proxy), - 0, - py_base_dealloc, - 0, - 0, - 0, - 0, - py_base_repr, - 0,0,0,0,0,0,0,0,0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - 0,0,0,0,0,0,0, - Methods, - 0, - 0, - &SCA_IActuator::Type, - 0,0,0,0,0,0, - py_base_new -}; - -PyMethodDef KX_VisibilityActuator::Methods[] = { - {NULL,NULL} //Sentinel -}; - -PyAttributeDef KX_VisibilityActuator::Attributes[] = { - KX_PYATTRIBUTE_BOOL_RW("visibility", KX_VisibilityActuator, m_visible), - KX_PYATTRIBUTE_BOOL_RW("useOcclusion", KX_VisibilityActuator, m_occlusion), - KX_PYATTRIBUTE_BOOL_RW("useRecursion", KX_VisibilityActuator, m_recursive), - { NULL } //Sentinel -}; - -#endif // DISABLE_PYTHON diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.h b/source/gameengine/Ketsji/KX_VisibilityActuator.h deleted file mode 100644 index 4969dda1158..00000000000 --- a/source/gameengine/Ketsji/KX_VisibilityActuator.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Actuator to toggle visibility/invisibility of objects - */ - -#ifndef __KX_VISIBILITYACTUATOR -#define __KX_VISIBILITYACTUATOR - -#include "SCA_IActuator.h" - -class KX_VisibilityActuator : public SCA_IActuator -{ - Py_Header; - - /** Make visible? */ - bool m_visible; - bool m_occlusion; - bool m_recursive; - - public: - - KX_VisibilityActuator( - SCA_IObject* gameobj, - bool visible, - bool occlusion, - bool recursive); - - virtual - ~KX_VisibilityActuator( - void - ); - - virtual CValue* - GetReplica( - void - ); - - virtual bool - Update(); - - /* --------------------------------------------------------------------- */ - /* Python interface ---------------------------------------------------- */ - /* --------------------------------------------------------------------- */ - -}; - -#endif - diff --git a/source/gameengine/Ketsji/KX_WorldInfo.cpp b/source/gameengine/Ketsji/KX_WorldInfo.cpp deleted file mode 100644 index bf059ca543c..00000000000 --- a/source/gameengine/Ketsji/KX_WorldInfo.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_WorldInfo.h" - -KX_WorldInfo::~KX_WorldInfo() -{ -} - diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h deleted file mode 100644 index 21f8f521ef5..00000000000 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __KX_WORLDINFO_H -#define __KX_WORLDINFO_H - -#include "MT_Scalar.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class MT_CmMatrix4x4; - -class KX_WorldInfo -{ -public: - KX_WorldInfo(){} - virtual ~KX_WorldInfo(); - - virtual bool hasWorld()=0; - virtual bool hasMist()=0; - virtual float getBackColorRed()=0; - virtual float getBackColorGreen()=0; - virtual float getBackColorBlue()=0; - virtual float getMistStart()=0; - virtual float getMistDistance()=0; - virtual float getMistColorRed()=0; - virtual float getMistColorGreen()=0; - virtual float getMistColorBlue()=0; - - virtual float getAmbientColorRed()=0; - virtual float getAmbientColorGreen()=0; - virtual float getAmbientColorBlue()=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; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_WorldInfo"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__KX_WORLDINFO_H - diff --git a/source/gameengine/Ketsji/KX_WorldIpoController.cpp b/source/gameengine/Ketsji/KX_WorldIpoController.cpp deleted file mode 100644 index 476b23a5cbf..00000000000 --- a/source/gameengine/Ketsji/KX_WorldIpoController.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "KX_WorldIpoController.h" -#include "KX_ScalarInterpolator.h" -#include "KX_WorldInfo.h" - -#if defined(_WIN64) -typedef unsigned __int64 uint_ptr; -#else -typedef unsigned long uint_ptr; -#endif - -bool KX_WorldIpoController::Update(double currentTime) -{ - if (m_modified) - { - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - (*i)->Execute(m_ipotime);//currentTime); - } - - /* TODO, this will crash! */ - KX_WorldInfo *world = NULL; - - if (m_modify_mist_start) { - world->setMistStart(m_mist_start); - } - - if (m_modify_mist_color) { - world->setMistColorRed(m_mist_rgb[0]); - world->setMistColorGreen(m_mist_rgb[1]); - world->setMistColorBlue(m_mist_rgb[2]); - } - - if (m_modify_mist_dist) { - world->setMistDistance(m_mist_dist); - } - - m_modified=false; - } - return false; -} - - -void KX_WorldIpoController::AddInterpolator(KX_IInterpolator* interp) -{ - this->m_interpolators.push_back(interp); -} - - -SG_Controller* KX_WorldIpoController::GetReplica(class SG_Node* destnode) -{ - KX_WorldIpoController* iporeplica = new KX_WorldIpoController(*this); - // clear object that ipo acts on - iporeplica->ClearObject(); - - // dirty hack, ask Gino for a better solution in the ipo implementation - // hacken en zagen, in what we call datahiding, not written for replication :( - - T_InterpolatorList oldlist = m_interpolators; - iporeplica->m_interpolators.clear(); - - T_InterpolatorList::iterator i; - for (i = oldlist.begin(); !(i == oldlist.end()); ++i) { - KX_ScalarInterpolator* copyipo = new KX_ScalarInterpolator(*((KX_ScalarInterpolator*)*i)); - iporeplica->AddInterpolator(copyipo); - - MT_Scalar* scaal = ((KX_ScalarInterpolator*)*i)->GetTarget(); - uint_ptr orgbase = (uint_ptr)this; - uint_ptr orgloc = (uint_ptr)scaal; - uint_ptr offset = orgloc-orgbase; - uint_ptr newaddrbase = (uint_ptr)iporeplica + offset; - MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; - copyipo->SetNewTarget((MT_Scalar*)blaptr); - } - - return iporeplica; -} - -KX_WorldIpoController::~KX_WorldIpoController() -{ - - T_InterpolatorList::iterator i; - for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { - delete (*i); - } - -} diff --git a/source/gameengine/Ketsji/KX_WorldIpoController.h b/source/gameengine/Ketsji/KX_WorldIpoController.h deleted file mode 100644 index c89f893458f..00000000000 --- a/source/gameengine/Ketsji/KX_WorldIpoController.h +++ /dev/null @@ -1,103 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef KX_WORLDIPOCONTROLLER_H -#define KX_WORLDIPOCONTROLLER_H - -#include "SG_Controller.h" -#include "SG_Spatial.h" -#include "KX_IInterpolator.h" - -class KX_WorldIpoController : public SG_Controller -{ -public: - MT_Scalar m_mist_rgb[3]; - MT_Scalar m_mist_start; - MT_Scalar m_mist_dist; - -private: - T_InterpolatorList m_interpolators; - unsigned short m_modify_mist_color : 1; - unsigned short m_modify_mist_start : 1; - unsigned short m_modify_mist_dist : 1; - bool m_modified; - - double m_ipotime; - -public: - KX_WorldIpoController() : - m_modify_mist_color(false), - m_modify_mist_start(false), - m_modify_mist_dist(false), - m_modified(true), - m_ipotime(0.0) - {} - - virtual ~KX_WorldIpoController(); - - virtual SG_Controller* GetReplica(class SG_Node* destnode); - - virtual bool Update(double time); - - virtual void SetSimulatedTime(double time) { - m_ipotime = time; - m_modified = true; - } - - void SetModifyMistStart(bool modify) { - m_modify_mist_start = modify; - } - - void SetModifyMistColor(bool modify) { - m_modify_mist_color = modify; - } - - void SetModifyMistDist(bool modify) { - m_modify_mist_dist = modify; - } - - void - SetOption( - int option, - int value - ){ - // intentionally empty - }; - - void AddInterpolator(KX_IInterpolator* interp); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_WorldIpoController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // KX_LIGHTIPOSGCONTROLLER_H - diff --git a/source/gameengine/Ketsji/Makefile b/source/gameengine/Ketsji/Makefile deleted file mode 100644 index 4ecd23fc1a2..00000000000 --- a/source/gameengine/Ketsji/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = ketsji -DIR = $(OCGDIR)/gameengine/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += $(NAN_SDLCFLAGS) -CPPFLAGS += $(OGL_CPPFLAGS) -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(OPENGL_HEADERS) -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) -CPPFLAGS += -I../../blender/python -CPPFLAGS += -I../../blender/python/generic -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I$(NAN_BULLET2)/include -CPPFLAGS += -I$(NAN_AUDASPACE)/include - -CPPFLAGS += -I../Rasterizer/RAS_OpenGLRasterizer -CPPFLAGS += -I../Rasterizer -I../GameLogic -I../SceneGraph -CPPFLAGS += -I../BlenderRoutines -I../Expressions -CPPFLAGS += -I../../kernel/gen_system -CPPFLAGS += -I../Network -IKXNetwork -CPPFLAGS += -I../Physics/common -CPPFLAGS += -I../Physics/Dummy -CPPFLAGS += -I../Physics/Bullet -CPPFLAGS += -I. -CPPFLAGS += -I../Converter -CPPFLAGS += -I../../blender/blenkernel -CPPFLAGS += -I../../blender/blenlib -CPPFLAGS += -I../../blender/blenloader -CPPFLAGS += -I../../blender/makesdna -CPPFLAGS += -I../../blender/imbuf -CPPFLAGS += -I../../blender/gpu -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include - -########################### - -SOURCEDIR = source/gameengine/Ketsji -DIRS = KXNetwork - -include nan_subdirs.mk - diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript deleted file mode 100644 index 58dc8a314bf..00000000000 --- a/source/gameengine/Ketsji/SConscript +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/python -import sys - -Import ('env') - -sources = env.Glob('*.cpp') -defs = [ 'GLEW_STATIC' ] - -incs = '. #source/blender/python/generic' # Only for Mathutils! and bpy_internal_import.h, be very careful - -incs += ' #source/kernel/gen_system #intern/string #intern/guardedalloc' -incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer' -incs += ' #intern/audaspace/intern #source/gameengine/Converter' -incs += ' #source/gameengine/BlenderRoutines #source/blender/imbuf #intern/moto/include' -incs += ' #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork #source/blender/blenlib' -incs += ' #source/blender/blenkernel #source/blender #source/blender/editors/include' -incs += ' #source/blender/makesdna #source/blender/python #source/gameengine/Rasterizer' -incs += ' #source/gameengine/GameLogic #source/gameengine/Expressions #source/gameengine/Network' -incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common #source/gameengine/Physics/Bullet' -incs += ' #source/gameengine/Physics/Dummy' -incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #source/blender/gpu' - -incs += ' ' + env['BF_BULLET_INC'] -incs += ' ' + env['BF_OPENGL_INC'] - -if env['WITH_BF_SDL']: - incs += ' ' + env['BF_SDL_INC'] -else: - defs.append('DISABLE_SDL') - -if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] -else: - defs.append('DISABLE_PYTHON') - -if env['WITH_BF_FFMPEG']: - defs.append('WITH_FFMPEG') - -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): - if env['BF_DEBUG']: - defs.append('_DEBUG') # for Python - -env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Makefile b/source/gameengine/Makefile deleted file mode 100644 index bcb4b9098e7..00000000000 --- a/source/gameengine/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# Bounces make to subdirectories. - -include nan_definitions.mk - -SOURCEDIR = source/gameengine -DIR = $(OCGDIR)/gameengine -DIRS = BlenderRoutines -DIRS += Converter -DIRS += Expressions GameLogic Ketsji Rasterizer SceneGraph -DIRS += Network Physics VideoTexture - -ifeq ($(WITH_BF_BLENDERGAMEENGINE),true) -# DIRS += GamePlayer -endif - -include nan_subdirs.mk diff --git a/source/gameengine/Network/CMakeLists.txt b/source/gameengine/Network/CMakeLists.txt deleted file mode 100644 index 2478715e0ab..00000000000 --- a/source/gameengine/Network/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -FILE(GLOB SRC *.cpp) - -SET(INC - . - ../../../source/kernel/gen_system - ../../../intern/string - ../../../intern/moto/include -) - -BLENDERLIB(bf_ngnetwork "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_ngnetwork', sources, Split(incs), [], libtype=['game2', 'player'], priority=[15, 160] ) diff --git a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt deleted file mode 100644 index 6b43a1561a1..00000000000 --- a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -SET(SRC NG_LoopBackNetworkDeviceInterface.cpp) - -SET(INC - . - ../../../../source/kernel/gen_system - ../../../../intern/string - ../../../../source/gameengine/Network -) - -BLENDERLIB(bf_loopbacknetwork "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_loopbacknetwork', Split(sources), Split(incs), defines=[],libtype=['game2', 'player'], priority=[25, 165] ) diff --git a/source/gameengine/Network/LoopBackNetwork/Makefile b/source/gameengine/Network/LoopBackNetwork/Makefile deleted file mode 100644 index 690fd644094..00000000000 --- a/source/gameengine/Network/LoopBackNetwork/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = LoopBackNetwork -DIR = $(OCGDIR)/gameengine/Network/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I.. -CPPFLAGS += -I../../../kernel/gen_system - diff --git a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp deleted file mode 100644 index 6556219413e..00000000000 --- a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * LoopbackNetworkDeviceInterface derived from NG_NetworkDeviceInterface - */ - -#include "NG_LoopBackNetworkDeviceInterface.h" -#include "NG_NetworkMessage.h" - -// temporary debugging printf's -#ifdef NAN_NET_DEBUG - #include -#endif - -NG_LoopBackNetworkDeviceInterface::NG_LoopBackNetworkDeviceInterface() -{ - m_currentQueue=0; - Online(); // LoopBackdevices are 'online' immediately -} - -NG_LoopBackNetworkDeviceInterface::~NG_LoopBackNetworkDeviceInterface() -{ -} - -// perhaps this should go to the shared/common implementation too -void NG_LoopBackNetworkDeviceInterface::NextFrame() -{ - // Release reference to the messages while emptying the queue - while (m_messages[m_currentQueue].size() > 0) { -#ifdef NAN_NET_DEBUG - printf("NG_LBNDI::NextFrame %d '%s'\n", m_currentQueue, m_messages[m_currentQueue][0]->GetSubject().ReadPtr()); -#endif - // Should do assert(m_events[0]); - m_messages[m_currentQueue][0]->Release(); - m_messages[m_currentQueue].pop_front(); - } - //m_messages[m_currentQueue].clear(); - - m_currentQueue=1-m_currentQueue; -} - -STR_String NG_LoopBackNetworkDeviceInterface::GetNetworkVersion() -{ - return LOOPBACK_NETWORK_VERSION; -} - -void NG_LoopBackNetworkDeviceInterface::SendNetworkMessage(NG_NetworkMessage* nwmsg) -{ -#ifdef NAN_NET_DEBUG - printf("NG_LBNDI::SendNetworkMessage %d, '%s'->'%s' '%s' '%s'\n", - 1-m_currentQueue, - nwmsg->GetDestinationName().ReadPtr(), - nwmsg->GetSenderName().ReadPtr(), - nwmsg->GetSubject().ReadPtr(), - nwmsg->GetMessageText().ReadPtr()); -#endif - int backqueue = 1-m_currentQueue; - - nwmsg->AddRef(); - m_messages[backqueue].push_back(nwmsg); -} - -vector NG_LoopBackNetworkDeviceInterface::RetrieveNetworkMessages() -{ - vector messages; - - std::deque::iterator mesit=m_messages[m_currentQueue].begin(); - for (; !(mesit == m_messages[m_currentQueue].end()); ++mesit) - { - - // We don't increase the reference count for these messages. We - // are passing a vector of messages in the interface and not - // explicitily storing the messgaes for long term usage - - messages.push_back(*mesit); - -#ifdef NAN_NET_DEBUG - printf("NG_LBNDI::RetrieveNetworkMessages %d '%s'->'%s' '%s' '%s'\n", - m_currentQueue, - (*mesit)->GetDestinationName().ReadPtr(), - (*mesit)->GetSenderName().ReadPtr(), - (*mesit)->GetSubject().ReadPtr(), - (*mesit)->GetMessageText().ReadPtr()); -#endif - } - return messages; -} - diff --git a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h deleted file mode 100644 index fdc066b424b..00000000000 --- a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * LoopbackNetworkDeviceInterface derived from NG_NetworkDeviceInterface - */ -#ifndef NG_LOOPBACKNETWORKDEVICEINTERFACE_H -#define NG_LOOPBACKNETWORKDEVICEINTERFACE_H - -#include -#include "NG_NetworkDeviceInterface.h" - -class NG_LoopBackNetworkDeviceInterface : public NG_NetworkDeviceInterface -{ - enum { - LOOPBACK_NETWORK_VERSION=28022001 - }; - - std::deque m_messages[2]; - int m_currentQueue; - -public: - NG_LoopBackNetworkDeviceInterface(); - virtual ~NG_LoopBackNetworkDeviceInterface(); - - /** - * Clear message buffer - */ - virtual void NextFrame(); - - bool Connect(char *address, unsigned int port, char *password, - unsigned int localport, unsigned int timeout) { - return true;} - bool Disconnect(void) {return true;} - - virtual void SendNetworkMessage(class NG_NetworkMessage* msg); - virtual vector RetrieveNetworkMessages(); - - STR_String GetNetworkVersion(); -}; - -#endif //NG_LOOPBACKNETWORKDEVICEINTERFACE_H - diff --git a/source/gameengine/Network/LoopBackNetwork/SConscript b/source/gameengine/Network/LoopBackNetwork/SConscript deleted file mode 100644 index dd23e1327eb..00000000000 --- a/source/gameengine/Network/LoopBackNetwork/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = 'NG_LoopBackNetworkDeviceInterface.cpp' - -incs = '. #source/kernel/gen_system #intern/string #source/gameengine/Network' - -env.BlenderLib ( 'bf_loopbacknetwork', Split(sources), Split(incs), defines=[],libtype=['core','player'], priority=[400,135] ) diff --git a/source/gameengine/Network/Makefile b/source/gameengine/Network/Makefile deleted file mode 100644 index c6b22276113..00000000000 --- a/source/gameengine/Network/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = Network -DIR = $(OCGDIR)/gameengine/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I../GameLogic -CPPFLAGS += -I../../kernel/gen_system - -############## - -DIRS = LoopBackNetwork -SOURCEDIR = source/gameengine/Network - -include nan_subdirs.mk diff --git a/source/gameengine/Network/NG_NetworkDeviceInterface.h b/source/gameengine/Network/NG_NetworkDeviceInterface.h deleted file mode 100644 index 446aa7dab6c..00000000000 --- a/source/gameengine/Network/NG_NetworkDeviceInterface.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * NetworkGameengine_NetworkDeviceInterface - * Functions like (de)initialize network, get library version - * To be derived by loopback and network libraries - */ -#ifndef NG_NETWORKDEVICEINTERFACE_H -#define NG_NETWORKDEVICEINTERFACE_H - -#include "NG_NetworkMessage.h" -#include - -class NG_NetworkDeviceInterface -{ -private: - // candidates for shared/common implementation class - bool m_online; -public: - NG_NetworkDeviceInterface() {}; - virtual ~NG_NetworkDeviceInterface() {}; - - virtual void NextFrame()=0; - - /** - * Mark network connection online - */ - void Online(void) { m_online = true; } - /** - * Mark network connection offline - */ - void Offline(void) { m_online = false; } - /** - * Is the network connection established ? - */ - bool IsOnline(void) { return m_online; } - - virtual bool Connect(char *address, unsigned int port, char *password, - unsigned int localport, unsigned int timeout)=0; - virtual bool Disconnect(void)=0; - - virtual void SendNetworkMessage(NG_NetworkMessage* msg)=0; - /** - * read NG_NetworkMessage from library buffer, may be - * irrelevant for loopbackdevices - */ - - virtual std::vector RetrieveNetworkMessages()=0; - - /** - * number of messages in device hash for this frame - */ - - virtual STR_String GetNetworkVersion(void)=0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:NG_NetworkDeviceInterface"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //NG_NETWORKDEVICEINTERFACE_H - diff --git a/source/gameengine/Network/NG_NetworkMessage.cpp b/source/gameengine/Network/NG_NetworkMessage.cpp deleted file mode 100644 index cb9b25c756a..00000000000 --- a/source/gameengine/Network/NG_NetworkMessage.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * generic Network Message implementation - */ -#include "NG_NetworkMessage.h" -#include - -int NG_NetworkMessage::s_nextID = 3; // just some number to start with - -NG_NetworkMessage::NG_NetworkMessage( - const STR_String& to, - const STR_String& from, - const STR_String& subject, - const STR_String& body) : - m_uniqueMessageID(s_nextID++), - m_refcount(1), - m_to(to), - m_from(from), - m_subject(subject), - m_message(body) -{ -} - -NG_NetworkMessage::~NG_NetworkMessage() -{ - assert(m_refcount==0); -} diff --git a/source/gameengine/Network/NG_NetworkMessage.h b/source/gameengine/Network/NG_NetworkMessage.h deleted file mode 100644 index fd6dbd027e9..00000000000 --- a/source/gameengine/Network/NG_NetworkMessage.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * NetworkGame_NetworkMessage generic Network Message class - */ -#ifndef NG_NETWORKMESSAGE_H -#define NG_NETWORKMESSAGE_H - -#include "STR_HashedString.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class NG_NetworkMessage -{ - static int s_nextID; - int m_uniqueMessageID; // intern counting MessageID - unsigned int m_ClientId; - int m_refcount; - - STR_String m_to; // receiver - STR_String m_from; // sender - STR_String m_subject; // empty or propName - STR_String m_message; // message or propValue - -protected: - ~NG_NetworkMessage(); - -public: - NG_NetworkMessage( - const STR_String& to, - const STR_String& from, - const STR_String& subject, - const STR_String& body); - - void AddRef() { - m_refcount++; - } - - // This is not nice code you should'nt need to resort to - // delete this. - void Release() - { - if (! --m_refcount) - { - delete this; - } - } - - /** - * set the content of this message - */ - void SetMessageText(const STR_String& msgtext) { - m_message = msgtext; - } - - /** - * get the (read-only) To part of this message - */ - const STR_String& GetDestinationName() { return m_to;}; - - /** - * get the (read-only) From part of this message - */ - const STR_String& GetSenderName() { return m_from;}; - - /** - * get the (read-only) Subject part of this message - */ - const STR_String& GetSubject() { return m_subject;}; - - /** - * get the (read-only) Body part of this message - */ - const STR_String& GetMessageText() { -//cout << "GetMessageText " << m_message << "\n"; - return m_message; - } - const STR_String& GetMessageText() const { -//cout << "GetMessageText " << m_message << "\n"; - return m_message; - } - - /** - * Set the NetworkMessage sender identifier - */ - void SetSender(unsigned int ClientId) { - m_ClientId = ClientId; - } - - /** - * Get the NetworkMessage sender identifier - */ - unsigned int GetSender(void) { - return m_ClientId; - } - - /** - * get the unique Network Message ID - */ - int GetMessageID() { - return m_uniqueMessageID; - } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:NG_NetworkMessage"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //NG_NETWORKMESSAGE_H - diff --git a/source/gameengine/Network/NG_NetworkObject.cpp b/source/gameengine/Network/NG_NetworkObject.cpp deleted file mode 100644 index 36aef6e44c8..00000000000 --- a/source/gameengine/Network/NG_NetworkObject.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * NetworkGame_NetworkObject generic Network Object implementation - */ -#include "NG_NetworkObject.h" - -NG_NetworkObject::NG_NetworkObject() -{ -} - -NG_NetworkObject::~NG_NetworkObject() -{ -} - -const STR_String& NG_NetworkObject::GetName() -{ - return m_name; -} diff --git a/source/gameengine/Network/NG_NetworkObject.h b/source/gameengine/Network/NG_NetworkObject.h deleted file mode 100644 index ae185f85098..00000000000 --- a/source/gameengine/Network/NG_NetworkObject.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * NetworkGame_NetworkObject generic Network Object class - */ -#ifndef NG_NETWORKOBJECT_H -#define NG_NETWORKOBJECT_H - -#include "STR_String.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class NG_NetworkObject -{ - STR_String m_name; -public: - NG_NetworkObject(); - ~NG_NetworkObject(); - const STR_String& GetName(); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:NG_NetworkObject"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //NG_NETWORKOBJECT_H - diff --git a/source/gameengine/Network/NG_NetworkScene.cpp b/source/gameengine/Network/NG_NetworkScene.cpp deleted file mode 100644 index 355ebe5c475..00000000000 --- a/source/gameengine/Network/NG_NetworkScene.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * NetworkSceneManagement generic implementation - */ -#include -#include -#include - -#include "NG_NetworkScene.h" -#include "NG_NetworkDeviceInterface.h" -#include "NG_NetworkMessage.h" -#include "NG_NetworkObject.h" - -NG_NetworkScene::NG_NetworkScene(NG_NetworkDeviceInterface* nic) -{ - m_networkdevice = nic; -} - -NG_NetworkScene::~NG_NetworkScene() -{ - ClearAllMessageMaps(); -} - -/** - * progress one frame, handle all network traffic - */ -void NG_NetworkScene::proceed(double curtime) -{ - if (!m_networkdevice) return; - if (!m_networkdevice->IsOnline()) return; - - ClearAllMessageMaps(); - - // read all NetworkMessages from the device - vector messages = - m_networkdevice->RetrieveNetworkMessages(); - - vector::iterator mesit = messages.begin(); - for (; !(mesit == messages.end()); mesit++) { - NG_NetworkMessage* message = (*mesit); - vector* tmplist=NULL; - - vector** tmplistptr = - m_messagesByDestinationName[message->GetDestinationName()]; - // if there is already a vector of messages, append, else create - // a new vector and insert into map - if (!tmplistptr) { - tmplist = new vector; - m_messagesByDestinationName.insert(message->GetDestinationName(), - tmplist); - } else { - tmplist = *tmplistptr; - } - message->AddRef(); - tmplist->push_back(message); - tmplist = NULL; - - tmplistptr = m_messagesBySenderName[message->GetSenderName()]; - // if there is already a vector of messages, append, else create - // a new vector and insert into map - if (!tmplistptr) { - tmplist = new vector; - m_messagesBySenderName.insert(message->GetSenderName(), tmplist); - } else { - tmplist = *tmplistptr; - } - message->AddRef(); - tmplist->push_back(message); - tmplist = NULL; - - tmplistptr = m_messagesBySubject[message->GetSubject()]; - // if there is already a vector of messages, append, else create - // a new vector and insert into map - if (!tmplistptr) { - tmplist = new vector; - m_messagesBySubject.insert(message->GetSubject(), tmplist); - } else { - tmplist = *tmplistptr; - } - message->AddRef(); - tmplist->push_back(message); - tmplist = NULL; - } -} - -/** - * add a network object to the network scene - */ -void NG_NetworkScene::AddObject(NG_NetworkObject* object) -{ - if (! m_networkdevice->IsOnline()) return; - - const STR_String& name = object->GetName(); - m_networkObjects.insert(name, object); -} - -/** - * remove a network object from the network scene - */ -void NG_NetworkScene::RemoveObject(NG_NetworkObject* object) -{ - if (! m_networkdevice->IsOnline()) return; - - const STR_String& name = object->GetName(); - m_networkObjects.remove(name); -} - -/** - * remove all network scene objects at once - */ -void NG_NetworkScene::RemoveAllObjects() -{ - m_networkObjects.clear(); -} - -/** - * get a single network object given its name - */ -NG_NetworkObject* NG_NetworkScene::FindNetworkObject(const STR_String& objname) { - NG_NetworkObject *nwobj = NULL; - if (! m_networkdevice->IsOnline()) return nwobj; - - NG_NetworkObject **nwobjptr = m_networkObjects[objname]; - if (nwobjptr) { - nwobj = *nwobjptr; - } - - return nwobj; -} - -bool NG_NetworkScene::ConstraintsAreValid( - const STR_String& from, - const STR_String& subject, - NG_NetworkMessage* message) -{ - vector** fromlistptr = m_messagesBySenderName[from]; - vector** subjectlistptr = m_messagesBySubject[subject]; - - vector* fromlist = (fromlistptr ? *fromlistptr : NULL); - vector* subjectlist = (subjectlistptr ? *subjectlistptr : NULL); - - return ( - ( from.IsEmpty() || (!fromlist ? false : (!(std::find(fromlist->begin(), fromlist->end(), message) == fromlist->end()))) - ) && - ( subject.IsEmpty() || (!subjectlist ? false : (!(std::find(subjectlist->begin(), subjectlist->end(), message) == subjectlist->end()))) - )); -} - -vector NG_NetworkScene::FindMessages( - const STR_String& to, - const STR_String& from, - const STR_String& subject, - bool spamallowed) -{ - vector foundmessages; - bool notfound = false; - - // broad phase - notfound = ((to.IsEmpty() || spamallowed) ? notfound : m_messagesByDestinationName[to] == NULL); - if (!notfound) - notfound = (from.IsEmpty() ? notfound : m_messagesBySenderName[from] == NULL); - if (!notfound) - notfound = (subject.IsEmpty() ? notfound : m_messagesBySubject[subject] == NULL); - if (notfound) { - // it's definately NOT in the scene, so stop looking - } else { // narrow phase - // possibly it's there, but maybe not (false hit) - if (to.IsEmpty()) { - // take all messages, and check other fields - MT_assert(!"objectnames that are empty are not valid, so make it a hobby project :)\n"); - } else { - //todo: find intersection of messages (that are in other 2 maps) - vector** tolistptr = m_messagesByDestinationName[to]; - if (tolistptr) { - vector* tolist = *tolistptr; - vector::iterator listit; - for (listit=tolist->begin();!(listit==tolist->end());listit++) { - NG_NetworkMessage* message = *listit; - if (ConstraintsAreValid(from, subject, message)) { - message->AddRef(); - foundmessages.push_back(message); - } - } - } - // TODO find intersection of messages (that are in other 2 maps) - if (spamallowed) { - tolistptr = m_messagesByDestinationName[""]; - if (tolistptr) { - vector* tolist = *tolistptr; - vector::iterator listit; - for (listit=tolist->begin();!(listit==tolist->end());listit++) { - NG_NetworkMessage* message = *listit; - if (ConstraintsAreValid(from, subject, message)) { - message->AddRef(); - foundmessages.push_back(message); - } - } - } - } - } - } - return foundmessages; -} - -void NG_NetworkScene::SendMessage( - const STR_String& to, - const STR_String& from, - const STR_String& subject, - const STR_String& message) -{ - NG_NetworkMessage* msg = new NG_NetworkMessage(to, from, subject, message); - m_networkdevice->SendNetworkMessage(msg); - msg->Release(); -} - -void NG_NetworkScene::ClearAllMessageMaps(void) -{ - ClearMessageMap(m_messagesByDestinationName); - ClearMessageMap(m_messagesBySenderName); - ClearMessageMap(m_messagesBySubject); -} - -void NG_NetworkScene::ClearMessageMap(TMessageMap& map) -{ - // Release the messages in the map - for (int i = 0; i < map.size(); i++) { - vector* msglist; - msglist = *(map.at(i)); - - // Iterate through the current vector and release all it's messages - vector::iterator msgit; - for (msgit = msglist->begin(); msgit != msglist->end(); msgit++) { - (*msgit)->Release(); - } - - // Delete the actual vector - delete (msglist); - } - - // Empty the map - map.clear(); -} - diff --git a/source/gameengine/Network/NG_NetworkScene.h b/source/gameengine/Network/NG_NetworkScene.h deleted file mode 100644 index 7da949dfe0c..00000000000 --- a/source/gameengine/Network/NG_NetworkScene.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * NetworkSceneManagement generic class - */ -#ifndef __NG_NETWORKSCENE_H -#define __NG_NETWORKSCENE_H - -#include "GEN_Map.h" -#include "STR_HashedString.h" -#include - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -//MSVC defines SendMessage as a win api function, even though we aren't using it -#ifdef SendMessage - #undef SendMessage -#endif - -class NG_NetworkDeviceInterface; - -class NG_NetworkScene -{ - class NG_NetworkDeviceInterface *m_networkdevice; - GEN_Map m_networkObjects; - - // GEN_Maps used as a 'Bloom' filter - typedef GEN_Map* > TMessageMap; - TMessageMap m_messagesByDestinationName; - TMessageMap m_messagesBySenderName; - TMessageMap m_messagesBySubject; - -public: - NG_NetworkScene(NG_NetworkDeviceInterface *nic); - ~NG_NetworkScene(); - - /** - * progress one frame, handle all network traffic - */ - void proceed(double curtime); - - /** - * add a networkobject to the scene - */ - void AddObject(NG_NetworkObject* object); - - /** - * remove a networkobject to the scene - */ - void RemoveObject(NG_NetworkObject* object); - - /** - * remove all objects at once - */ - void RemoveAllObjects(); - - /** - * send a message (ascii text) over the network - */ - void SendMessage(const STR_String& to,const STR_String& from,const STR_String& subject,const STR_String& message); - - /** - * find an object by name - */ - NG_NetworkObject* FindNetworkObject(const STR_String& objname); - - bool ConstraintsAreValid(const STR_String& from,const STR_String& subject,class NG_NetworkMessage* message); - vector FindMessages(const STR_String& to,const STR_String& from,const STR_String& subject,bool spamallowed); - -protected: - /** - * Releases messages in message map members. - */ - void ClearAllMessageMaps(void); - - /** - * Releases messages for the given message map. - * @param map Message map with messages. - */ - void ClearMessageMap(TMessageMap& map); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:NG_NetworkScene"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__NG_NETWORKSCENE_H - diff --git a/source/gameengine/Network/SConscript b/source/gameengine/Network/SConscript deleted file mode 100644 index 3883dc71c9c..00000000000 --- a/source/gameengine/Network/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = env.Glob('*.cpp') #'NG_NetworkMessage.cpp NG_NetworkObject.cpp NG_NetworkScene.cpp' - -incs = '. #source/kernel/gen_system #intern/string #intern/moto/include' - -env.BlenderLib ( 'bf_ngnetwork', sources, Split(incs), [], libtype=['core','player'], priority=[400,130] ) diff --git a/source/gameengine/Network/TerraplayNetwork/Makefile b/source/gameengine/Network/TerraplayNetwork/Makefile deleted file mode 100644 index d987263d433..00000000000 --- a/source/gameengine/Network/TerraplayNetwork/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = TerraPlayNetwork -DIR = $(OCGDIR)/gameengine/Network/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(LCGDIR)/terraplay/include -CPPFLAGS += -I../../../kernel/gen_system -CPPFLAGS += -I.. - diff --git a/source/gameengine/Network/TerraplayNetwork/NG_TerraplayNetworkDeviceInterface.cpp b/source/gameengine/Network/TerraplayNetwork/NG_TerraplayNetworkDeviceInterface.cpp deleted file mode 100644 index 301a056f25c..00000000000 --- a/source/gameengine/Network/TerraplayNetwork/NG_TerraplayNetworkDeviceInterface.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * TerraplayNetworkDeviceInterface derived from NG_NetworkDeviceInterface - */ - -#include "NG_TerraplayNetworkDeviceInterface.h" -#include "NG_NetworkMessage.h" - -//---- relocate these -void NG_TerraplayNetworkDeviceInterface::interface_error(char *str, GASResult error) { - GASRString err_str = GAS->ErrorTranslate(error); - if (err_str.result == GASOK) - printf("%s: %s\n",str,err_str.ptr); - else - printf("%s: UNKNOWN (Error code %d)", error); -} -//---- END relocate these - -NG_TerraplayNetworkDeviceInterface::NG_TerraplayNetworkDeviceInterface() -{ - group_id = GASCLIENTIDNULL; - group_id_request_valid = false; - this->Offline(); - - if ((GAS = new GASInterface()) == NULL) { - // terror - printf("ERROR GAS Common Network Interface NOT created\n"); - // do something useful - } else { - printf("GAS Common Network Interface created\n"); - } -} - -NG_TerraplayNetworkDeviceInterface::~NG_TerraplayNetworkDeviceInterface() -{ - if (GAS != NULL) { - delete GAS; - printf("GAS Common Network Interface deleted\n"); - } -} - -bool NG_TerraplayNetworkDeviceInterface::Connect(char *GAS_address, - unsigned int GAS_port, char *GAS_password, unsigned int localport, - unsigned int timeout) -{ - GASResult result; - printf("Establishing connection to GAS...\n"); - result = GAS->ConnectionRequest(GAS_address, GAS_port, - GAS_password,localport, timeout); - if (result == GASOK) { - this->Online(); - GASRClientId client_id = GAS->Connected(); - if (client_id.result != GASOK) { - printf("... connected, but no client ID\n"); - return false; - } else { - printf("Connected with client ID %d\n", - client_id.clientid); - return true; - } - } else { - interface_error("Connection", result); - return false; - } -} - -bool NG_TerraplayNetworkDeviceInterface::Disconnect(void) -{ - int i = 0; - printf("Disconnecting...\n"); - if (! this->IsOnline()) { - printf("ehh... /me was not connected\n"); - return false; - } - - GASRRequestId req = GAS->ConnectionClose(); - if (req.result != GASWAITING) { - interface_error("ConnectionClose",req.result); - this->~NG_TerraplayNetworkDeviceInterface(); - } - this->Offline(); -// dit is erg fout :( ik wil helemaal geen ~NG_ hier - - while (true) { - GASRMessage gas_message; - GASResult result = GAS->GasActivity(GASBLOCK, 100); - if (++i>5000) { - printf("\nGiving up on waiting for connection close\n"); - this->~NG_TerraplayNetworkDeviceInterface(); - } - switch (result) { - case GASCONNECTIONOK: - break; - case GASGASMESSAGE: - gas_message = GAS->GasMessageGetNext(); - if (gas_message.type == GASRCONNECTIONCLOSE) { - if (gas_message.result == GASOK || - gas_message.result == GASALREADYDONE) { - return true; - } else { - interface_error("GasMessageGetNext", - gas_message.result); - return false; - } - } - // no break ... - default: - interface_error("GasActivity",result); - } - } - return true; -} - -STR_String NG_TerraplayNetworkDeviceInterface::GetNetworkVersion() -{ - GASRString version = GAS->Version(); - if (version.result != GASOK) { - interface_error("GetNetworkVersion", version.result); - return NULL; - } else { - return version.ptr; - } -} - -int NG_TerraplayNetworkDeviceInterface::mytest() { - return (3); -} - -void NG_TerraplayNetworkDeviceInterface::SendNetworkMessage(NG_NetworkMessage* nwmsg) -{ - GASPayload payload; - GASResult result; - STR_String mystring; - - if (group_id == GASCLIENTIDNULL) { - printf("Oops, no group to send to yet\n"); - return; - } - - mystring = nwmsg->GetMessageText().ReadPtr(); - payload.ptr = (void *) mystring.Ptr(); - payload.size = mystring.Length() + 1; - - result = GAS->ClientMessageSend(group_id, payload, GASBESTEFFORT); - - switch (result) { - case GASOK: - break; - default: - interface_error("ClientMessageSend",result); - } - // NOTE. You shall NOT free the payload with PayloadFree(). - // This is your own payload, allocated and freed by yourself - // anyway you want. -} - -vector NG_TerraplayNetworkDeviceInterface::RetrieveNetworkMessages() -{ - - vector messages; - //todo: spend your expensive time here! - - return messages; -} diff --git a/source/gameengine/Network/TerraplayNetwork/NG_TerraplayNetworkDeviceInterface.h b/source/gameengine/Network/TerraplayNetwork/NG_TerraplayNetworkDeviceInterface.h deleted file mode 100644 index 1d9242850cc..00000000000 --- a/source/gameengine/Network/TerraplayNetwork/NG_TerraplayNetworkDeviceInterface.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * TerraplayNetworkDeviceInterface derived from NG_NetworkDeviceInterface - */ -#ifndef NG_TERRAPLAYNETWORKDEVICEINTERFACE_H -#define NG_TERRAPLAYNETWORKDEVICEINTERFACE_H - -#include -#include "GASInterface.h" -#include "NG_NetworkDeviceInterface.h" - -class NG_TerraplayNetworkDeviceInterface : public NG_NetworkDeviceInterface -{ - std::deque m_messages; - - // Terraplay GAS stuff - GASInterface *GAS; - GASClientId group_id; - GASRequestId group_id_request; - int group_id_request_valid; - - void interface_error(char *str, GASResult error); -public: - NG_TerraplayNetworkDeviceInterface(); - ~NG_TerraplayNetworkDeviceInterface(); - - bool Connect(char *GAS_address, unsigned int GAS_port, - char *GAS_password, unsigned int localport, - unsigned int timeout); - bool Disconnect(void); - - void SendNetworkMessage(NG_NetworkMessage* nwmsg); - vector RetrieveNetworkMessages(void); - - STR_String GetNetworkVersion(void); - - int mytest(void); -}; - -#endif //NG_TERRAPLAYNETWORKDEVICEINTERFACE_H - diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt deleted file mode 100644 index 11a535b35c8..00000000000 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -SET(SRC CcdPhysicsEnvironment.cpp CcdPhysicsController.cpp CcdGraphicController.cpp) - -SET(INC - . - ../common - ../../../../extern/bullet2/src - ../../../../extern/glew/include - ../../../../intern/moto/include - ../../../../intern/guardedalloc - ../../../kernel/gen_system - ../../../../intern/string - ../../Rasterizer - ../../Ketsji - ../../Expressions - ../../GameLogic - ../../SceneGraph - ../../../../source/blender/makesdna - ../../../../source/blender/blenlib - ../../../../source/blender/blenkernel - ${PYTHON_INC} -) - -BLENDERLIB(bf_bullet "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), [], libtype=['game','player'], priority=[15,90] ) diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp deleted file mode 100644 index 73ac789edf7..00000000000 --- a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "CcdPhysicsEnvironment.h" -#include "CcdGraphicController.h" -#include "btBulletDynamicsCommon.h" -#include "MT_Point3.h" - - -CcdGraphicController::CcdGraphicController (CcdPhysicsEnvironment* phyEnv, PHY_IMotionState* motionState) : - m_localAabbMin(0.f, 0.f, 0.f), - m_localAabbMax(0.f, 0.f, 0.f), - m_motionState(motionState), - m_phyEnv(phyEnv), - m_handle(NULL), - m_newClientInfo(NULL) -{ -} - -CcdGraphicController::~CcdGraphicController() -{ - if (m_phyEnv) - m_phyEnv->removeCcdGraphicController(this); - - if (m_motionState) - delete m_motionState; -} - -void CcdGraphicController::setLocalAabb(const btVector3& aabbMin,const btVector3& aabbMax) -{ - m_localAabbMin = aabbMin; - m_localAabbMax = aabbMax; - SetGraphicTransform(); -} - -void CcdGraphicController::setLocalAabb(const MT_Point3& aabbMin,const MT_Point3& aabbMax) -{ - m_localAabbMin.setValue(aabbMin[0],aabbMin[1],aabbMin[2]); - m_localAabbMax.setValue(aabbMax[0],aabbMax[1],aabbMax[2]); - SetGraphicTransform(); -} - -void CcdGraphicController::setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax) -{ - m_localAabbMin.setValue(aabbMin[0],aabbMin[1],aabbMin[2]); - m_localAabbMax.setValue(aabbMax[0],aabbMax[1],aabbMax[2]); - SetGraphicTransform(); -} - -void CcdGraphicController::setLocalAabb(const float* aabbMin,const float* aabbMax) -{ - m_localAabbMin.setValue(aabbMin[0],aabbMin[1],aabbMin[2]); - m_localAabbMax.setValue(aabbMax[0],aabbMax[1],aabbMax[2]); - SetGraphicTransform(); -} - -void CcdGraphicController::getAabb(btVector3& aabbMin, btVector3& aabbMax) -{ - btVector3 pos; - btVector3 scale; - float ori[12]; - m_motionState->getWorldPosition(pos.m_floats[0],pos.m_floats[1],pos.m_floats[2]); - m_motionState->getWorldScaling(scale.m_floats[0],scale.m_floats[1],scale.m_floats[2]); - m_motionState->getWorldOrientation(ori); - btMatrix3x3 rot(ori[0], ori[4], ori[8], - ori[1], ori[5], ori[9], - ori[2], ori[6], ori[10]); - - btVector3 localAabbMin = m_localAabbMin; - btVector3 localAabbMax = m_localAabbMax; - btVector3 tmpAabbMin = m_localAabbMin * scale; - btVector3 tmpAabbMax = m_localAabbMax * scale; - - localAabbMin[0] = (scale.getX() >= 0.) ? tmpAabbMin[0] : tmpAabbMax[0]; - localAabbMin[1] = (scale.getY() >= 0.) ? tmpAabbMin[1] : tmpAabbMax[1]; - localAabbMin[2] = (scale.getZ() >= 0.) ? tmpAabbMin[2] : tmpAabbMax[2]; - localAabbMax[0] = (scale.getX() <= 0.) ? tmpAabbMin[0] : tmpAabbMax[0]; - localAabbMax[1] = (scale.getY() <= 0.) ? tmpAabbMin[1] : tmpAabbMax[1]; - localAabbMax[2] = (scale.getZ() <= 0.) ? tmpAabbMin[2] : tmpAabbMax[2]; - - btVector3 localHalfExtents = btScalar(0.5)*(localAabbMax-localAabbMin); - btVector3 localCenter = btScalar(0.5)*(localAabbMax+localAabbMin); - - btMatrix3x3 abs_b = rot.absolute(); - btVector3 center = rot*localCenter + pos; - btVector3 extent = abs_b*localHalfExtents; - aabbMin = center - extent; - aabbMax = center + extent; -} - -bool CcdGraphicController::SetGraphicTransform() -{ - if (!m_handle) - return false; - btVector3 aabbMin; - btVector3 aabbMax; - getAabb(aabbMin, aabbMax); - // update Aabb in broadphase - m_phyEnv->getCullingTree()->setAabb(m_handle,aabbMin,aabbMax,NULL); - return true; -} - -PHY_IGraphicController* CcdGraphicController::GetReplica(class PHY_IMotionState* motionState) -{ - CcdGraphicController* replica = new CcdGraphicController(*this); - replica->m_motionState = motionState; - replica->m_newClientInfo = NULL; - replica->m_handle = NULL; - // don't add the graphic controller now: work around a bug in Bullet with rescaling, - // (the scale of the controller is not yet defined). - //m_phyEnv->addCcdGraphicController(replica); - return replica; -} - -void CcdGraphicController::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* env) -{ - CcdPhysicsEnvironment* phyEnv = static_cast(env); - /* Updates the m_phyEnv's m_cullingTree & m_cullingCache */ - if(getBroadphaseHandle()) { - /* insert into the new physics scene */ - Activate(false); - m_phyEnv= phyEnv; - Activate(true); - } - else { - m_phyEnv= phyEnv; - } -} - -void CcdGraphicController::Activate(bool active) -{ - if (active) - m_phyEnv->addCcdGraphicController(this); - else - m_phyEnv->removeCcdGraphicController(this); - -} diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.h b/source/gameengine/Physics/Bullet/CcdGraphicController.h deleted file mode 100644 index 07cf6d940cb..00000000000 --- a/source/gameengine/Physics/Bullet/CcdGraphicController.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef BULLET2_GRAPHICCONTROLLER_H -#define BULLET2_GRAPHICCONTROLLER_H - -#include "PHY_IGraphicController.h" - -#include "btBulletDynamicsCommon.h" -#include "LinearMath/btTransform.h" - -#include "PHY_IMotionState.h" -#include "MT_Point3.h" - -class CcdPhysicsEnvironment; -class btCollisionObject; - -///CcdGraphicController is a graphic object that supports view frustrum culling and occlusion -class CcdGraphicController : public PHY_IGraphicController -{ -public: - CcdGraphicController(CcdPhysicsEnvironment* phyEnv, PHY_IMotionState* motionState); - - virtual ~CcdGraphicController(); - - void setLocalAabb(const btVector3& aabbMin,const btVector3& aabbMax); - void setLocalAabb(const MT_Point3& aabbMin,const MT_Point3& aabbMax); - virtual void setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax); - virtual void setLocalAabb(const float aabbMin[3],const float aabbMax[3]); - - PHY_IMotionState* GetMotionState() { return m_motionState; } - void getAabb(btVector3& aabbMin, btVector3& aabbMax); - - virtual void setBroadphaseHandle(btBroadphaseProxy* handle) { m_handle = handle; } - virtual btBroadphaseProxy* getBroadphaseHandle() { return m_handle; } - - virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* env); - - //////////////////////////////////// - // PHY_IGraphicController interface - //////////////////////////////////// - - /** - * Updates the Aabb based on the motion state - */ - virtual bool SetGraphicTransform(); - /** - * Add/remove to environment - */ - virtual void Activate(bool active); - - // client info for culling - virtual void* getNewClientInfo() { return m_newClientInfo; } - virtual void setNewClientInfo(void* clientinfo) { m_newClientInfo = clientinfo; } - virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate); - -private: - // unscaled aabb corner - btVector3 m_localAabbMin; - btVector3 m_localAabbMax; - - PHY_IMotionState* m_motionState; - CcdPhysicsEnvironment* m_phyEnv; - btBroadphaseProxy* m_handle; - void* m_newClientInfo; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdGraphicController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //BULLET2_PHYSICSCONTROLLER_H diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp deleted file mode 100644 index fe429200dd4..00000000000 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ /dev/null @@ -1,2165 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "CcdPhysicsController.h" -#include "btBulletDynamicsCommon.h" -#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h" - -#include "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h" - -#include "PHY_IMotionState.h" -#include "CcdPhysicsEnvironment.h" -#include "RAS_MeshObject.h" -#include "KX_GameObject.h" - -#include "BulletSoftBody/btSoftBody.h" -#include "BulletSoftBody//btSoftBodyInternals.h" -#include "BulletSoftBody/btSoftBodyHelpers.h" -#include "LinearMath/btConvexHull.h" -#include "BulletCollision/Gimpact/btGImpactShape.h" -#include "BulletCollision/Gimpact/btGImpactShape.h" - - -#include "BulletSoftBody/btSoftRigidDynamicsWorld.h" - -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" - -extern "C"{ -#include "BKE_cdderivedmesh.h" -} - -class BP_Proxy; - -///todo: fill all the empty CcdPhysicsController methods, hook them up to the btRigidBody class - -//'temporarily' global variables -//float gDeactivationTime = 2.f; -//bool gDisableDeactivation = false; -extern float gDeactivationTime; -extern bool gDisableDeactivation; - - -float gLinearSleepingTreshold = 0.8f; -float gAngularSleepingTreshold = 1.0f; - - -btVector3 startVel(0,0,0);//-10000); - -CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci) -:m_cci(ci) -{ - m_prototypeTransformInitialized = false; - m_softbodyMappingDone = false; - m_collisionDelay = 0; - m_newClientInfo = 0; - m_registerCount = 0; - m_softBodyTransformInitialized = false; - m_parentCtrl = 0; - // copy pointers locally to allow smart release - m_MotionState = ci.m_MotionState; - m_collisionShape = ci.m_collisionShape; - // apply scaling before creating rigid body - m_collisionShape->setLocalScaling(m_cci.m_scaling); - if (m_cci.m_mass) - m_collisionShape->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor); - // shape info is shared, increment ref count - m_shapeInfo = ci.m_shapeInfo; - if (m_shapeInfo) - m_shapeInfo->AddRef(); - - m_bulletMotionState = 0; - - - CreateRigidbody(); - - -///??? -/*#ifdef WIN32 - if (GetRigidBody() && !GetRigidBody()->isStaticObject()) - GetRigidBody()->setLinearVelocity(startVel); -#endif*/ - -} - -btTransform& CcdPhysicsController::GetTransformFromMotionState(PHY_IMotionState* motionState) -{ - static btTransform trans; - btVector3 tmp; - motionState->getWorldPosition(tmp.m_floats[0], tmp.m_floats[1], tmp.m_floats[2]); - trans.setOrigin(tmp); - - float ori[12]; - motionState->getWorldOrientation(ori); - trans.getBasis().setFromOpenGLSubMatrix(ori); - //btQuaternion orn; - //motionState->getWorldOrientation(orn[0],orn[1],orn[2],orn[3]); - //trans.setRotation(orn); - return trans; - -} - -class BlenderBulletMotionState : public btMotionState -{ - PHY_IMotionState* m_blenderMotionState; - -public: - - BlenderBulletMotionState(PHY_IMotionState* bms) - :m_blenderMotionState(bms) - { - - } - - void getWorldTransform(btTransform& worldTrans ) const - { - btVector3 pos; - float ori[12]; - - m_blenderMotionState->getWorldPosition(pos.m_floats[0],pos.m_floats[1],pos.m_floats[2]); - m_blenderMotionState->getWorldOrientation(ori); - worldTrans.setOrigin(pos); - worldTrans.getBasis().setFromOpenGLSubMatrix(ori); - } - - void setWorldTransform(const btTransform& worldTrans) - { - m_blenderMotionState->setWorldPosition(worldTrans.getOrigin().getX(),worldTrans.getOrigin().getY(),worldTrans.getOrigin().getZ()); - btQuaternion rotQuat = worldTrans.getRotation(); - m_blenderMotionState->setWorldOrientation(rotQuat[0],rotQuat[1],rotQuat[2],rotQuat[3]); - m_blenderMotionState->calculateWorldTransformations(); - } - -}; - - -btRigidBody* CcdPhysicsController::GetRigidBody() -{ - return btRigidBody::upcast(m_object); -} -btCollisionObject* CcdPhysicsController::GetCollisionObject() -{ - return m_object; -} -btSoftBody* CcdPhysicsController::GetSoftBody() -{ - return btSoftBody::upcast(m_object); -} - -#include "BulletSoftBody/btSoftBodyHelpers.h" - - -bool CcdPhysicsController::CreateSoftbody() -{ - int shapeType = m_cci.m_collisionShape ? m_cci.m_collisionShape->getShapeType() : 0; - - //disable soft body until first sneak preview is ready - if (!m_cci.m_bSoft || !m_cci.m_collisionShape || - ((shapeType != CONVEX_HULL_SHAPE_PROXYTYPE)&& - (shapeType != TRIANGLE_MESH_SHAPE_PROXYTYPE) && - (shapeType != SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE))) - { - return false; - } - - btRigidBody::btRigidBodyConstructionInfo rbci(m_cci.m_mass,m_bulletMotionState,m_collisionShape,m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor); - rbci.m_linearDamping = m_cci.m_linearDamping; - rbci.m_angularDamping = m_cci.m_angularDamping; - rbci.m_friction = m_cci.m_friction; - rbci.m_restitution = m_cci.m_restitution; - - btVector3 p(0,0,0);// = getOrigin(); - //btSoftBody* psb=btSoftBodyHelpers::CreateRope(worldInfo, btVector3(-10,0,i*0.25),btVector3(10,0,i*0.25), 16,1+2); - btSoftBody* psb = 0; - btSoftBodyWorldInfo& worldInfo = m_cci.m_physicsEnv->getDynamicsWorld()->getWorldInfo(); - - if (m_cci.m_collisionShape->getShapeType() == CONVEX_HULL_SHAPE_PROXYTYPE) - { - btConvexHullShape* convexHull = (btConvexHullShape* )m_cci.m_collisionShape; - { - int nvertices = convexHull->getNumPoints(); - const btVector3* vertices = convexHull->getPoints(); - - HullDesc hdsc(QF_TRIANGLES,nvertices,vertices); - HullResult hres; - HullLibrary hlib;/*??*/ - hdsc.mMaxVertices=nvertices; - hlib.CreateConvexHull(hdsc,hres); - - psb=new btSoftBody(&worldInfo,(int)hres.mNumOutputVertices, - &hres.m_OutputVertices[0],0); - for(int i=0;i<(int)hres.mNumFaces;++i) - { - const int idx[]={ hres.m_Indices[i*3+0], - hres.m_Indices[i*3+1], - hres.m_Indices[i*3+2]}; - if(idx[0]appendLink( idx[0],idx[1]); - if(idx[1]appendLink( idx[1],idx[2]); - if(idx[2]appendLink( idx[2],idx[0]); - psb->appendFace(idx[0],idx[1],idx[2]); - } - hlib.ReleaseResult(hres); - } - } else - { - int numtris = 0; - if (m_cci.m_collisionShape->getShapeType() ==SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE) - { - btScaledBvhTriangleMeshShape* scaledtrimeshshape = (btScaledBvhTriangleMeshShape*) m_cci.m_collisionShape; - btBvhTriangleMeshShape* trimeshshape = scaledtrimeshshape->getChildShape(); - - ///only deal with meshes that have 1 sub part/component, for now - if (trimeshshape->getMeshInterface()->getNumSubParts()==1) - { - unsigned char* vertexBase; - PHY_ScalarType vertexType; - int numverts; - int vertexstride; - unsigned char* indexbase; - int indexstride; - PHY_ScalarType indexType; - trimeshshape->getMeshInterface()->getLockedVertexIndexBase(&vertexBase,numverts,vertexType,vertexstride,&indexbase,indexstride,numtris,indexType); - - psb = btSoftBodyHelpers::CreateFromTriMesh(worldInfo,(const btScalar*)vertexBase,(const int*)indexbase,numtris,false); - } - } else - { - btTriangleMeshShape* trimeshshape = (btTriangleMeshShape*) m_cci.m_collisionShape; - ///only deal with meshes that have 1 sub part/component, for now - if (trimeshshape->getMeshInterface()->getNumSubParts()==1) - { - unsigned char* vertexBase; - PHY_ScalarType vertexType; - int numverts; - int vertexstride; - unsigned char* indexbase; - int indexstride; - PHY_ScalarType indexType; - trimeshshape->getMeshInterface()->getLockedVertexIndexBase(&vertexBase,numverts,vertexType,vertexstride,&indexbase,indexstride,numtris,indexType); - - psb = btSoftBodyHelpers::CreateFromTriMesh(worldInfo,(const btScalar*)vertexBase,(const int*)indexbase,numtris,false); - } - } - // store face tag so that we can find our original face when doing ray casting - btSoftBody::Face* ft; - int i; - for (i=0, ft=&psb->m_faces[0]; im_tag = (void*)((uintptr_t)(i+1)); - } - } - if (m_cci.m_margin > 0.f) - { - psb->getCollisionShape()->setMargin(m_cci.m_margin); - psb->updateBounds(); - } - m_object = psb; - - //btSoftBody::Material* pm=psb->appendMaterial(); - btSoftBody::Material* pm=psb->m_materials[0]; - pm->m_kLST = m_cci.m_soft_linStiff; - pm->m_kAST = m_cci.m_soft_angStiff; - pm->m_kVST = m_cci.m_soft_volume; - psb->m_cfg.collisions = 0; - - if (m_cci.m_soft_collisionflags & CCD_BSB_COL_CL_RS) - { - psb->m_cfg.collisions += btSoftBody::fCollision::CL_RS; - } else - { - psb->m_cfg.collisions += btSoftBody::fCollision::SDF_RS; - } - if (m_cci.m_soft_collisionflags & CCD_BSB_COL_CL_SS) - { - psb->m_cfg.collisions += btSoftBody::fCollision::CL_SS; - } else - { - psb->m_cfg.collisions += btSoftBody::fCollision::VF_SS; - } - - - psb->m_cfg.kSRHR_CL = m_cci.m_soft_kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */ - psb->m_cfg.kSKHR_CL = m_cci.m_soft_kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */ - psb->m_cfg.kSSHR_CL = m_cci.m_soft_kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */ - psb->m_cfg.kSR_SPLT_CL = m_cci.m_soft_kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - - psb->m_cfg.kSK_SPLT_CL = m_cci.m_soft_kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - psb->m_cfg.kSS_SPLT_CL = m_cci.m_soft_kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - psb->m_cfg.kVCF = m_cci.m_soft_kVCF; /* Velocities correction factor (Baumgarte) */ - psb->m_cfg.kDP = m_cci.m_soft_kDP; /* Damping coefficient [0,1] */ - - psb->m_cfg.kDG = m_cci.m_soft_kDG; /* Drag coefficient [0,+inf] */ - psb->m_cfg.kLF = m_cci.m_soft_kLF; /* Lift coefficient [0,+inf] */ - psb->m_cfg.kPR = m_cci.m_soft_kPR; /* Pressure coefficient [-inf,+inf] */ - psb->m_cfg.kVC = m_cci.m_soft_kVC; /* Volume conversation coefficient [0,+inf] */ - - psb->m_cfg.kDF = m_cci.m_soft_kDF; /* Dynamic friction coefficient [0,1] */ - psb->m_cfg.kMT = m_cci.m_soft_kMT; /* Pose matching coefficient [0,1] */ - psb->m_cfg.kCHR = m_cci.m_soft_kCHR; /* Rigid contacts hardness [0,1] */ - psb->m_cfg.kKHR = m_cci.m_soft_kKHR; /* Kinetic contacts hardness [0,1] */ - - psb->m_cfg.kSHR = m_cci.m_soft_kSHR; /* Soft contacts hardness [0,1] */ - psb->m_cfg.kAHR = m_cci.m_soft_kAHR; /* Anchors hardness [0,1] */ - - if (m_cci.m_gamesoftFlag & CCD_BSB_BENDING_CONSTRAINTS)//OB_SB_GOAL) - { - psb->generateBendingConstraints(2,pm); - } - - psb->m_cfg.piterations = m_cci.m_soft_piterations; - psb->m_cfg.viterations = m_cci.m_soft_viterations; - psb->m_cfg.diterations = m_cci.m_soft_diterations; - psb->m_cfg.citerations = m_cci.m_soft_citerations; - - if (m_cci.m_gamesoftFlag & CCD_BSB_SHAPE_MATCHING)//OB_SB_GOAL) - { - psb->setPose(false,true);// - } else - { - psb->setPose(true,false); - } - - psb->randomizeConstraints(); - - if (m_cci.m_soft_collisionflags & (CCD_BSB_COL_CL_RS+CCD_BSB_COL_CL_SS)) - { - psb->generateClusters(m_cci.m_soft_numclusteriterations); - } - - psb->setTotalMass(m_cci.m_mass); - - psb->setCollisionFlags(0); - - ///create a mapping between graphics mesh vertices and soft body vertices - { - RAS_MeshObject* rasMesh= GetShapeInfo()->GetMesh(); - - if (rasMesh && !m_softbodyMappingDone) - { - //printf("apply\n"); - RAS_MeshSlot::iterator it; - RAS_MeshMaterial *mmat; - RAS_MeshSlot *slot; - size_t i; - - //for each material - for (int m=0;mNumMaterials();m++) - { - mmat = rasMesh->GetMeshMaterial(m); - - slot = mmat->m_baseslot; - for(slot->begin(it); !slot->end(it); slot->next(it)) - { - int index = 0; - for(i=it.startvertex; isetSoftBodyIndex(0); - btScalar maxDistSqr = 1e30; - btSoftBody::tNodeArray& nodes(psb->m_nodes); - btVector3 xyz = btVector3(vertex->getXYZ()[0],vertex->getXYZ()[1],vertex->getXYZ()[2]); - for (int n=0;nsetSoftBodyIndex(n); - } - } - } - } - } - } - } - m_softbodyMappingDone = true; - - btTransform startTrans; - rbci.m_motionState->getWorldTransform(startTrans); - - m_MotionState->setWorldPosition(startTrans.getOrigin().getX(),startTrans.getOrigin().getY(),startTrans.getOrigin().getZ()); - m_MotionState->setWorldOrientation(0,0,0,1); - - if (!m_prototypeTransformInitialized) - { - m_prototypeTransformInitialized = true; - m_softBodyTransformInitialized = true; - psb->transform(startTrans); - } - m_object->setCollisionFlags(m_object->getCollisionFlags() | m_cci.m_collisionFlags); - if (m_cci.m_do_anisotropic) - m_object->setAnisotropicFriction(m_cci.m_anisotropicFriction); - return true; -} - - -void CcdPhysicsController::CreateRigidbody() -{ - - //btTransform trans = GetTransformFromMotionState(m_MotionState); - m_bulletMotionState = new BlenderBulletMotionState(m_MotionState); - - ///either create a btCollisionObject, btRigidBody or btSoftBody - if (CreateSoftbody()) - // soft body created, done - return; - - //create a rgid collision object - btRigidBody::btRigidBodyConstructionInfo rbci(m_cci.m_mass,m_bulletMotionState,m_collisionShape,m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor); - rbci.m_linearDamping = m_cci.m_linearDamping; - rbci.m_angularDamping = m_cci.m_angularDamping; - rbci.m_friction = m_cci.m_friction; - rbci.m_restitution = m_cci.m_restitution; - m_object = new btRigidBody(rbci); - - // - // init the rigidbody properly - // - - //setMassProps this also sets collisionFlags - //convert collision flags! - //special case: a near/radar sensor controller should not be defined static or it will - //generate loads of static-static collision messages on the console - if (m_cci.m_bSensor) - { - // reset the flags that have been set so far - GetCollisionObject()->setCollisionFlags(0); - // sensor must never go to sleep: they need to detect continously - GetCollisionObject()->setActivationState(DISABLE_DEACTIVATION); - } - GetCollisionObject()->setCollisionFlags(m_object->getCollisionFlags() | m_cci.m_collisionFlags); - btRigidBody* body = GetRigidBody(); - - if (body) - { - body->setGravity( m_cci.m_gravity); - body->setDamping(m_cci.m_linearDamping, m_cci.m_angularDamping); - - if (!m_cci.m_bRigid) - { - body->setAngularFactor(0.f); - } - body->setContactProcessingThreshold(m_cci.m_contactProcessingThreshold); - - } - if (m_object && m_cci.m_do_anisotropic) - { - m_object->setAnisotropicFriction(m_cci.m_anisotropicFriction); - } - -} - -static void DeleteBulletShape(btCollisionShape* shape, bool free) -{ - if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE) - { - // shapes based on meshes use an interface that contains the vertices. - btTriangleMeshShape* meshShape = static_cast(shape); - btStridingMeshInterface* meshInterface = meshShape->getMeshInterface(); - if (meshInterface) - delete meshInterface; - } - if(free) { - delete shape; - } -} - -bool CcdPhysicsController::DeleteControllerShape( ) -{ - if (m_collisionShape) - { - // collision shape is always unique to the controller, can delete it here - if (m_collisionShape->isCompound()) - { - // bullet does not delete the child shape, must do it here - btCompoundShape* compoundShape = (btCompoundShape*)m_collisionShape; - int numChild = compoundShape->getNumChildShapes(); - for (int i=numChild-1 ; i >= 0; i--) - { - btCollisionShape* childShape = compoundShape->getChildShape(i); - DeleteBulletShape(childShape, true); - } - } - DeleteBulletShape(m_collisionShape, true); - - return true; - } - - return false; -} - -bool CcdPhysicsController::ReplaceControllerShape(btCollisionShape *newShape) -{ - - /* Note, deleting the previous collision shape must be done alredy */ - /* if (m_collisionShape) DeleteControllerShape(); */ - - m_object->setCollisionShape(newShape); - m_collisionShape= newShape; - m_cci.m_collisionShape= newShape; - - if (GetSoftBody()) { - // soft body must be recreated - m_cci.m_physicsEnv->removeCcdPhysicsController(this); - delete m_object; - m_object = NULL; - // force complete reinitialization - m_softbodyMappingDone = false; - m_prototypeTransformInitialized = false; - m_softBodyTransformInitialized = false; - CreateSoftbody(); - assert(m_object); - // reinsert the new body - m_cci.m_physicsEnv->addCcdPhysicsController(this); - } - - /* Copied from CcdPhysicsEnvironment::addCcdPhysicsController() */ - - /* without this, an object can rest on the old physics mesh - * and not move to account for the physics mesh, even with 'nosleep' */ - btSoftRigidDynamicsWorld* dw= GetPhysicsEnvironment()->getDynamicsWorld(); - btCollisionObjectArray &obarr= dw->getCollisionObjectArray(); - btCollisionObject *ob; - btBroadphaseProxy* proxy; - - for(int i= 0; i < obarr.size(); i++) { - ob= obarr[i]; - if (ob->getCollisionShape() == newShape) { - proxy = ob->getBroadphaseHandle(); - - if(proxy) - dw->getPairCache()->cleanProxyFromPairs(proxy,dw->getDispatcher()); - } - } - - return true; -} - -CcdPhysicsController::~CcdPhysicsController() -{ - //will be reference counted, due to sharing - if (m_cci.m_physicsEnv) - m_cci.m_physicsEnv->removeCcdPhysicsController(this); - - if (m_MotionState) - delete m_MotionState; - if (m_bulletMotionState) - delete m_bulletMotionState; - delete m_object; - - DeleteControllerShape(); - - if (m_shapeInfo) - { - m_shapeInfo->Release(); - } -} - - - /** - SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ -bool CcdPhysicsController::SynchronizeMotionStates(float time) -{ - //sync non-static to motionstate, and static from motionstate (todo: add kinematic etc.) - - btSoftBody* sb = GetSoftBody(); - if (sb) - { - if (sb->m_pose.m_bframe) - { - btVector3 worldPos = sb->m_pose.m_com; - btQuaternion worldquat; - btMatrix3x3 trs = sb->m_pose.m_rot*sb->m_pose.m_scl; - trs.getRotation(worldquat); - m_MotionState->setWorldPosition(worldPos[0],worldPos[1],worldPos[2]); - m_MotionState->setWorldOrientation(worldquat[0],worldquat[1],worldquat[2],worldquat[3]); - } - else - { - btVector3 aabbMin,aabbMax; - sb->getAabb(aabbMin,aabbMax); - btVector3 worldPos = (aabbMax+aabbMin)*0.5f; - m_MotionState->setWorldPosition(worldPos[0],worldPos[1],worldPos[2]); - } - m_MotionState->calculateWorldTransformations(); - return true; - } - - btRigidBody* body = GetRigidBody(); - - if (body && !body->isStaticObject()) - { - - if ((m_cci.m_clamp_vel_max>0.0) || (m_cci.m_clamp_vel_min>0.0)) - { - const btVector3& linvel = body->getLinearVelocity(); - float len= linvel.length(); - - if((m_cci.m_clamp_vel_max>0.0) && (len > m_cci.m_clamp_vel_max)) - body->setLinearVelocity(linvel * (m_cci.m_clamp_vel_max / len)); - - else if ((m_cci.m_clamp_vel_min>0.0) && btFuzzyZero(len)==0 && (len < m_cci.m_clamp_vel_min)) - body->setLinearVelocity(linvel * (m_cci.m_clamp_vel_min / len)); - } - - const btTransform& xform = body->getCenterOfMassTransform(); - const btMatrix3x3& worldOri = xform.getBasis(); - const btVector3& worldPos = xform.getOrigin(); - float ori[12]; - worldOri.getOpenGLSubMatrix(ori); - m_MotionState->setWorldOrientation(ori); - m_MotionState->setWorldPosition(worldPos[0],worldPos[1],worldPos[2]); - m_MotionState->calculateWorldTransformations(); - - float scale[3]; - m_MotionState->getWorldScaling(scale[0],scale[1],scale[2]); - btVector3 scaling(scale[0],scale[1],scale[2]); - GetCollisionShape()->setLocalScaling(scaling); - } else - { - btVector3 worldPos; - btQuaternion worldquat; - -/* m_MotionState->getWorldPosition(worldPos[0],worldPos[1],worldPos[2]); - m_MotionState->getWorldOrientation(worldquat[0],worldquat[1],worldquat[2],worldquat[3]); - btTransform oldTrans = m_body->getCenterOfMassTransform(); - btTransform newTrans(worldquat,worldPos); - - SetCenterOfMassTransform(newTrans); - //need to keep track of previous position for friction effects... - - m_MotionState->calculateWorldTransformations(); -*/ - float scale[3]; - m_MotionState->getWorldScaling(scale[0],scale[1],scale[2]); - btVector3 scaling(scale[0],scale[1],scale[2]); - GetCollisionShape()->setLocalScaling(scaling); - } - return true; - -} - - /** - WriteMotionStateToDynamics synchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - -void CcdPhysicsController::WriteMotionStateToDynamics(bool nondynaonly) -{ - btTransform& xform = CcdPhysicsController::GetTransformFromMotionState(m_MotionState); - SetCenterOfMassTransform(xform); -} - -void CcdPhysicsController::WriteDynamicsToMotionState() -{ -} - // controller replication -void CcdPhysicsController::PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl) -{ - - m_softBodyTransformInitialized=false; - m_MotionState = motionstate; - m_registerCount = 0; - m_collisionShape = NULL; - - // always create a new shape to avoid scaling bug - if (m_shapeInfo) - { - m_shapeInfo->AddRef(); - m_collisionShape = m_shapeInfo->CreateBulletShape(m_cci.m_margin, m_cci.m_bGimpact, !m_cci.m_bSoft); - - if (m_collisionShape) - { - // new shape has no scaling, apply initial scaling - //m_collisionShape->setMargin(m_cci.m_margin); - m_collisionShape->setLocalScaling(m_cci.m_scaling); - - if (m_cci.m_mass) - m_collisionShape->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor); - } - } - - // load some characterists that are not - btRigidBody* oldbody = GetRigidBody(); - m_object = 0; - CreateRigidbody(); - btRigidBody* body = GetRigidBody(); - if (body) - { - if (m_cci.m_mass) - { - body->setMassProps(m_cci.m_mass, m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor); - } - - if (oldbody) - { - body->setLinearFactor(oldbody->getLinearFactor()); - body->setAngularFactor(oldbody->getAngularFactor()); - if (oldbody->getActivationState() == DISABLE_DEACTIVATION) - body->setActivationState(DISABLE_DEACTIVATION); - } - } - // sensor object are added when needed - if (!m_cci.m_bSensor) - m_cci.m_physicsEnv->addCcdPhysicsController(this); - - -/* SM_Object* dynaparent=0; - SumoPhysicsController* sumoparentctrl = (SumoPhysicsController* )parentctrl; - - if (sumoparentctrl) - { - dynaparent = sumoparentctrl->GetSumoObject(); - } - - SM_Object* orgsumoobject = m_sumoObj; - - - m_sumoObj = new SM_Object( - orgsumoobject->getShapeHandle(), - orgsumoobject->getMaterialProps(), - orgsumoobject->getShapeProps(), - dynaparent); - - m_sumoObj->setRigidBody(orgsumoobject->isRigidBody()); - - m_sumoObj->setMargin(orgsumoobject->getMargin()); - m_sumoObj->setPosition(orgsumoobject->getPosition()); - m_sumoObj->setOrientation(orgsumoobject->getOrientation()); - //if it is a dyna, register for a callback - m_sumoObj->registerCallback(*this); - - m_sumoScene->add(* (m_sumoObj)); - */ - - - -} - -void CcdPhysicsController::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment *env) -{ - // can safely assume CCD environment - CcdPhysicsEnvironment *physicsEnv = static_cast(env); - - if (m_cci.m_physicsEnv != physicsEnv) - { - // since the environment is changing, we must also move the controler to the - // new environement. Note that we don't handle sensor explicitely: this - // function can be called on sensor but only when they are not registered - if (m_cci.m_physicsEnv->removeCcdPhysicsController(this)) - { - physicsEnv->addCcdPhysicsController(this); - } - m_cci.m_physicsEnv = physicsEnv; - } -} - -void CcdPhysicsController::SetCenterOfMassTransform(btTransform& xform) -{ - btRigidBody* body = GetRigidBody(); - if (body) - { - body->setCenterOfMassTransform(xform); - } else - { - //either collision object or soft body? - if (GetSoftBody()) - { - - } else - { - - if (m_object->isStaticOrKinematicObject()) - { - m_object->setInterpolationWorldTransform(m_object->getWorldTransform()); - } else - { - m_object->setInterpolationWorldTransform(xform); - } - if (body) - { - body->setInterpolationLinearVelocity(body->getLinearVelocity()); - body->setInterpolationAngularVelocity(body->getAngularVelocity()); - body->updateInertiaTensor(); - } - m_object->setWorldTransform(xform); - } - } -} - - // kinematic methods -void CcdPhysicsController::RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local) -{ - if (m_object) - { - m_object->activate(true); - if (m_object->isStaticObject()) - { - if (!m_cci.m_bSensor) - m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - // kinematic object should not set the transform, it disturbs the velocity interpolation - return; - } - - // btRigidBody* body = GetRigidBody(); // not used anymore - - btVector3 dloc(dlocX,dlocY,dlocZ); - btTransform xform = m_object->getWorldTransform(); - - if (local) - { - dloc = xform.getBasis()*dloc; - } - - xform.setOrigin(xform.getOrigin() + dloc); - SetCenterOfMassTransform(xform); - } - -} - -void CcdPhysicsController::RelativeRotate(const float rotval[9],bool local) -{ - if (m_object) - { - m_object->activate(true); - if (m_object->isStaticObject()) - { - if (!m_cci.m_bSensor) - m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - // kinematic object should not set the transform, it disturbs the velocity interpolation - return; - } - - btMatrix3x3 drotmat( rotval[0],rotval[4],rotval[8], - rotval[1],rotval[5],rotval[9], - rotval[2],rotval[6],rotval[10]); - - - btMatrix3x3 currentOrn; - GetWorldOrientation(currentOrn); - - btTransform xform = m_object->getWorldTransform(); - - xform.setBasis(xform.getBasis()*(local ? - drotmat : (currentOrn.inverse() * drotmat * currentOrn))); - - SetCenterOfMassTransform(xform); - } -} - - -void CcdPhysicsController::GetWorldOrientation(btMatrix3x3& mat) -{ - float ori[12]; - m_MotionState->getWorldOrientation(ori); - mat.setFromOpenGLSubMatrix(ori); -} - -void CcdPhysicsController::getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal) -{ - btQuaternion q = m_object->getWorldTransform().getRotation(); - quatImag0 = q[0]; - quatImag1 = q[1]; - quatImag2 = q[2]; - quatReal = q[3]; -} -void CcdPhysicsController::setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal) -{ - if (m_object) - { - m_object->activate(true); - if (m_object->isStaticObject()) - { - if (!m_cci.m_bSensor) - m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - // kinematic object should not set the transform, it disturbs the velocity interpolation - return; - } - // not required - //m_MotionState->setWorldOrientation(quatImag0,quatImag1,quatImag2,quatReal); - btTransform xform = m_object->getWorldTransform(); - xform.setRotation(btQuaternion(quatImag0,quatImag1,quatImag2,quatReal)); - SetCenterOfMassTransform(xform); - // not required - //m_bulletMotionState->setWorldTransform(xform); - - - - } - -} - -void CcdPhysicsController::setWorldOrientation(const btMatrix3x3& orn) -{ - if (m_object) - { - m_object->activate(true); - if (m_object->isStaticObject() && !m_cci.m_bSensor) - { - m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - } - // not required - //m_MotionState->setWorldOrientation(quatImag0,quatImag1,quatImag2,quatReal); - btTransform xform = m_object->getWorldTransform(); - xform.setBasis(orn); - SetCenterOfMassTransform(xform); - // not required - //m_bulletMotionState->setWorldTransform(xform); - //only once! - if (!m_softBodyTransformInitialized && GetSoftBody()) - { - m_softbodyStartTrans.setBasis(orn); - xform.setOrigin(m_softbodyStartTrans.getOrigin()); - GetSoftBody()->transform(xform); - m_softBodyTransformInitialized = true; - } - - } - -} - -void CcdPhysicsController::setPosition(float posX,float posY,float posZ) -{ - if (m_object) - { - m_object->activate(true); - if (m_object->isStaticObject()) - { - if (!m_cci.m_bSensor) - m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - // kinematic object should not set the transform, it disturbs the velocity interpolation - return; - } - // not required, this function is only used to update the physic controller - //m_MotionState->setWorldPosition(posX,posY,posZ); - btTransform xform = m_object->getWorldTransform(); - xform.setOrigin(btVector3(posX,posY,posZ)); - SetCenterOfMassTransform(xform); - if (!m_softBodyTransformInitialized) - m_softbodyStartTrans.setOrigin(xform.getOrigin()); - // not required - //m_bulletMotionState->setWorldTransform(xform); - } -} - -void CcdPhysicsController::forceWorldTransform(const btMatrix3x3& mat, const btVector3& pos) -{ - if (m_object) - { - btTransform& xform = m_object->getWorldTransform(); - xform.setBasis(mat); - xform.setOrigin(pos); - } -} - - -void CcdPhysicsController::resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) -{ -} - -void CcdPhysicsController::getPosition(PHY__Vector3& pos) const -{ - const btTransform& xform = m_object->getWorldTransform(); - pos[0] = xform.getOrigin().x(); - pos[1] = xform.getOrigin().y(); - pos[2] = xform.getOrigin().z(); -} - -void CcdPhysicsController::setScaling(float scaleX,float scaleY,float scaleZ) -{ - if (!btFuzzyZero(m_cci.m_scaling.x()-scaleX) || - !btFuzzyZero(m_cci.m_scaling.y()-scaleY) || - !btFuzzyZero(m_cci.m_scaling.z()-scaleZ)) - { - m_cci.m_scaling = btVector3(scaleX,scaleY,scaleZ); - - if (m_object && m_object->getCollisionShape()) - { - m_object->activate(true); // without this, sleeping objects scale wont be applied in bullet if python changes the scale - Campbell. - m_object->getCollisionShape()->setLocalScaling(m_cci.m_scaling); - - //printf("no inertia recalc for fixed objects with mass=0\n"); - btRigidBody* body = GetRigidBody(); - if (body && m_cci.m_mass) - { - body->getCollisionShape()->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor); - body->setMassProps(m_cci.m_mass, m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor); - } - - } - } -} - - // physics methods -void CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local) -{ - btVector3 torque(torqueX,torqueY,torqueZ); - btTransform xform = m_object->getWorldTransform(); - - - if (m_object && torque.length2() > (SIMD_EPSILON*SIMD_EPSILON)) - { - btRigidBody* body = GetRigidBody(); - m_object->activate(); - if (m_object->isStaticObject()) - { - if (!m_cci.m_bSensor) - m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - return; - } - if (local) - { - torque = xform.getBasis()*torque; - } - if (body) - { - if (m_cci.m_bRigid) - { - body->applyTorque(torque); - } - else - { - //workaround for incompatibility between 'DYNAMIC' game object, and angular factor - //a DYNAMIC object has some inconsistency: it has no angular effect due to collisions, but still has torque - const btVector3& angFac = body->getAngularFactor(); - btVector3 tmpFac(1,1,1); - body->setAngularFactor(tmpFac); - body->applyTorque(torque); - body->setAngularFactor(angFac); - } - } - } -} - -void CcdPhysicsController::ApplyForce(float forceX,float forceY,float forceZ,bool local) -{ - btVector3 force(forceX,forceY,forceZ); - - - if (m_object && force.length2() > (SIMD_EPSILON*SIMD_EPSILON)) - { - m_object->activate(); - if (m_object->isStaticObject()) - { - if (!m_cci.m_bSensor) - m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - return; - } - btTransform xform = m_object->getWorldTransform(); - - if (local) - { - force = xform.getBasis()*force; - } - btRigidBody* body = GetRigidBody(); - if (body) - body->applyCentralForce(force); - btSoftBody* soft = GetSoftBody(); - if (soft) - { - // the force is applied on each node, must reduce it in the same extend - if (soft->m_nodes.size() > 0) - force /= soft->m_nodes.size(); - soft->addForce(force); - } - } -} -void CcdPhysicsController::SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local) -{ - btVector3 angvel(ang_velX,ang_velY,ang_velZ); - if (m_object && angvel.length2() > (SIMD_EPSILON*SIMD_EPSILON)) - { - m_object->activate(true); - if (m_object->isStaticObject()) - { - if (!m_cci.m_bSensor) - m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - return; - } - btTransform xform = m_object->getWorldTransform(); - if (local) - { - angvel = xform.getBasis()*angvel; - } - btRigidBody* body = GetRigidBody(); - if (body) - body->setAngularVelocity(angvel); - } - -} -void CcdPhysicsController::SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local) -{ - - btVector3 linVel(lin_velX,lin_velY,lin_velZ); - if (m_object/* && linVel.length2() > (SIMD_EPSILON*SIMD_EPSILON)*/) - { - m_object->activate(true); - if (m_object->isStaticObject()) - { - if (!m_cci.m_bSensor) - m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - return; - } - - btSoftBody* soft = GetSoftBody(); - if (soft) - { - if (local) - { - linVel = m_softbodyStartTrans.getBasis()*linVel; - } - soft->setVelocity(linVel); - } else - { - btTransform xform = m_object->getWorldTransform(); - if (local) - { - linVel = xform.getBasis()*linVel; - } - btRigidBody* body = GetRigidBody(); - if (body) - body->setLinearVelocity(linVel); - } - } -} -void CcdPhysicsController::applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ) -{ - btVector3 impulse(impulseX,impulseY,impulseZ); - - if (m_object && impulse.length2() > (SIMD_EPSILON*SIMD_EPSILON)) - { - m_object->activate(); - if (m_object->isStaticObject()) - { - if (!m_cci.m_bSensor) - m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); - return; - } - - btVector3 pos(attachX,attachY,attachZ); - btRigidBody* body = GetRigidBody(); - if (body) - body->applyImpulse(impulse,pos); - - } - -} -void CcdPhysicsController::SetActive(bool active) -{ -} - // reading out information from physics -void CcdPhysicsController::GetLinearVelocity(float& linvX,float& linvY,float& linvZ) -{ - btRigidBody* body = GetRigidBody(); - if (body) - { - const btVector3& linvel = body->getLinearVelocity(); - linvX = linvel.x(); - linvY = linvel.y(); - linvZ = linvel.z(); - } else - { - linvX = 0.f; - linvY = 0.f; - linvZ = 0.f; - } - -} - -void CcdPhysicsController::GetAngularVelocity(float& angVelX,float& angVelY,float& angVelZ) -{ - btRigidBody* body = GetRigidBody(); - if (body) - { - const btVector3& angvel= body->getAngularVelocity(); - angVelX = angvel.x(); - angVelY = angvel.y(); - angVelZ = angvel.z(); - } else - { - angVelX = 0.f; - angVelY = 0.f; - angVelZ = 0.f; - } -} - -void CcdPhysicsController::GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ) -{ - btVector3 pos(posX,posY,posZ); - btRigidBody* body = GetRigidBody(); - if (body) - { - btVector3 linvel = body->getVelocityInLocalPoint(pos); - linvX = linvel.x(); - linvY = linvel.y(); - linvZ = linvel.z(); - } else - { - linvX = 0.f; - linvY = 0.f; - linvZ = 0.f; - } -} -void CcdPhysicsController::getReactionForce(float& forceX,float& forceY,float& forceZ) -{ -} - - // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted -void CcdPhysicsController::setRigidBody(bool rigid) -{ - if (!rigid) - { - btRigidBody* body = GetRigidBody(); - if (body) - { - //fake it for now - btVector3 inertia = body->getInvInertiaDiagLocal(); - inertia[1] = 0.f; - body->setInvInertiaDiagLocal(inertia); - body->updateInertiaTensor(); - } - } -} - - // clientinfo for raycasts for example -void* CcdPhysicsController::getNewClientInfo() -{ - return m_newClientInfo; -} -void CcdPhysicsController::setNewClientInfo(void* clientinfo) -{ - m_newClientInfo = clientinfo; -} - - -void CcdPhysicsController::UpdateDeactivation(float timeStep) -{ - btRigidBody* body = GetRigidBody(); - if (body) - { - body->updateDeactivation( timeStep); - } -} - -bool CcdPhysicsController::wantsSleeping() -{ - btRigidBody* body = GetRigidBody(); - if (body) - { - return body->wantsSleeping(); - } - //check it out - return true; -} - -PHY_IPhysicsController* CcdPhysicsController::GetReplica() -{ - // This is used only to replicate Near and Radar sensor controllers - // The replication of object physics controller is done in KX_BulletPhysicsController::GetReplica() - CcdConstructionInfo cinfo = m_cci; - if (m_shapeInfo) - { - // This situation does not normally happen - cinfo.m_collisionShape = m_shapeInfo->CreateBulletShape(m_cci.m_margin, m_cci.m_bGimpact, !m_cci.m_bSoft); - } - else if (m_collisionShape) - { - switch (m_collisionShape->getShapeType()) - { - case SPHERE_SHAPE_PROXYTYPE: - { - btSphereShape* orgShape = (btSphereShape*)m_collisionShape; - cinfo.m_collisionShape = new btSphereShape(*orgShape); - break; - } - - case CONE_SHAPE_PROXYTYPE: - { - btConeShape* orgShape = (btConeShape*)m_collisionShape; - cinfo.m_collisionShape = new btConeShape(*orgShape); - break; - } - - default: - { - return 0; - } - } - } - - cinfo.m_MotionState = new DefaultMotionState(); - cinfo.m_shapeInfo = m_shapeInfo; - - CcdPhysicsController* replica = new CcdPhysicsController(cinfo); - return replica; -} - -/////////////////////////////////////////////////////////// -///A small utility class, DefaultMotionState -/// -/////////////////////////////////////////////////////////// - -DefaultMotionState::DefaultMotionState() -{ - m_worldTransform.setIdentity(); - m_localScaling.setValue(1.f,1.f,1.f); -} - - -DefaultMotionState::~DefaultMotionState() -{ - -} - -void DefaultMotionState::getWorldPosition(float& posX,float& posY,float& posZ) -{ - posX = m_worldTransform.getOrigin().x(); - posY = m_worldTransform.getOrigin().y(); - posZ = m_worldTransform.getOrigin().z(); -} - -void DefaultMotionState::getWorldScaling(float& scaleX,float& scaleY,float& scaleZ) -{ - scaleX = m_localScaling.getX(); - scaleY = m_localScaling.getY(); - scaleZ = m_localScaling.getZ(); -} - -void DefaultMotionState::getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal) -{ - btQuaternion quat = m_worldTransform.getRotation(); - quatIma0 = quat.x(); - quatIma1 = quat.y(); - quatIma2 = quat.z(); - quatReal = quat[3]; -} - -void DefaultMotionState::getWorldOrientation(float* ori) -{ - m_worldTransform.getBasis().getOpenGLSubMatrix(ori); -} - -void DefaultMotionState::setWorldOrientation(const float* ori) -{ - m_worldTransform.getBasis().setFromOpenGLSubMatrix(ori); -} -void DefaultMotionState::setWorldPosition(float posX,float posY,float posZ) -{ - btVector3 pos(posX,posY,posZ); - m_worldTransform.setOrigin( pos ); -} - -void DefaultMotionState::setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal) -{ - btQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal); - m_worldTransform.setRotation( orn ); -} - -void DefaultMotionState::calculateWorldTransformations() -{ - -} - -// Shape constructor -std::map CcdShapeConstructionInfo::m_meshShapeMap; - -CcdShapeConstructionInfo* CcdShapeConstructionInfo::FindMesh(RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope) -{ - if (polytope || dm) - // not yet supported - return NULL; - - std::map::const_iterator mit = m_meshShapeMap.find(mesh); - if (mit != m_meshShapeMap.end()) - return mit->second; - return NULL; -} - -bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, bool polytope) -{ - int numpolys, numverts; - - // assume no shape information - // no support for dynamic change of shape yet - assert(IsUnused()); - m_shapeType = PHY_SHAPE_NONE; - m_meshObject = NULL; - bool free_dm = false; - - // No mesh object or mesh has no polys - if (!meshobj || meshobj->HasColliderPolygon()==false) { - m_vertexArray.clear(); - m_polygonIndexArray.clear(); - m_triFaceArray.clear(); - m_triFaceUVcoArray.clear(); - return false; - } - - if (!dm) { - free_dm = true; - dm = CDDM_from_mesh(meshobj->GetMesh(), NULL); - } - - MVert *mvert = dm->getVertArray(dm); - MFace *mface = dm->getFaceArray(dm); - numpolys = dm->getNumFaces(dm); - numverts = dm->getNumVerts(dm); - int* index = (int*)dm->getFaceDataArray(dm, CD_ORIGINDEX); - MTFace *tface = (MTFace *)dm->getFaceDataArray(dm, CD_MTFACE); - - m_shapeType = (polytope) ? PHY_SHAPE_POLYTOPE : PHY_SHAPE_MESH; - - /* Convert blender geometry into bullet mesh, need these vars for mapping */ - vector vert_tag_array(numverts, false); - unsigned int tot_bt_verts= 0; - - if (polytope) - { - // Tag verts we're using - for (int p2=0; p2GetPolygon((index)? index[p2]: p2); - - // only add polygons that have the collision flag set - if (poly->IsCollider()) - { - if (vert_tag_array[mf->v1]==false) {vert_tag_array[mf->v1]= true;tot_bt_verts++;} - if (vert_tag_array[mf->v2]==false) {vert_tag_array[mf->v2]= true;tot_bt_verts++;} - if (vert_tag_array[mf->v3]==false) {vert_tag_array[mf->v3]= true;tot_bt_verts++;} - if (mf->v4 && vert_tag_array[mf->v4]==false) {vert_tag_array[mf->v4]= true;tot_bt_verts++;} - } - } - - m_vertexArray.resize(tot_bt_verts*3); - - btScalar *bt= &m_vertexArray[0]; - - for (int p2=0; p2GetPolygon((index)? index[p2]: p2); - - // only add polygons that have the collisionflag set - if (poly->IsCollider()) - { - if (vert_tag_array[mf->v1]==true) - { - const float* vtx = mvert[mf->v1].co; - vert_tag_array[mf->v1]= false; - *bt++ = vtx[0]; - *bt++ = vtx[1]; - *bt++ = vtx[2]; - } - if (vert_tag_array[mf->v2]==true) - { - const float* vtx = mvert[mf->v2].co; - vert_tag_array[mf->v2]= false; - *bt++ = vtx[0]; - *bt++ = vtx[1]; - *bt++ = vtx[2]; - } - if (vert_tag_array[mf->v3]==true) - { - const float* vtx = mvert[mf->v3].co; - vert_tag_array[mf->v3]= false; - *bt++ = vtx[0]; - *bt++ = vtx[1]; - *bt++ = vtx[2]; - } - if (mf->v4 && vert_tag_array[mf->v4]==true) - { - const float* vtx = mvert[mf->v4].co; - vert_tag_array[mf->v4]= false; - *bt++ = vtx[0]; - *bt++ = vtx[1]; - *bt++ = vtx[2]; - } - } - } - } - else { - unsigned int tot_bt_tris= 0; - vector vert_remap_array(numverts, 0); - - // Tag verts we're using - for (int p2=0; p2GetPolygon((index)? index[p2]: p2); - - // only add polygons that have the collision flag set - if (poly->IsCollider()) - { - if (vert_tag_array[mf->v1]==false) - {vert_tag_array[mf->v1]= true;vert_remap_array[mf->v1]= tot_bt_verts;tot_bt_verts++;} - if (vert_tag_array[mf->v2]==false) - {vert_tag_array[mf->v2]= true;vert_remap_array[mf->v2]= tot_bt_verts;tot_bt_verts++;} - if (vert_tag_array[mf->v3]==false) - {vert_tag_array[mf->v3]= true;vert_remap_array[mf->v3]= tot_bt_verts;tot_bt_verts++;} - if (mf->v4 && vert_tag_array[mf->v4]==false) - {vert_tag_array[mf->v4]= true;vert_remap_array[mf->v4]= tot_bt_verts;tot_bt_verts++;} - tot_bt_tris += (mf->v4 ? 2:1); /* a quad or a tri */ - } - } - - m_vertexArray.resize(tot_bt_verts*3); - m_polygonIndexArray.resize(tot_bt_tris); - m_triFaceArray.resize(tot_bt_tris*3); - btScalar *bt= &m_vertexArray[0]; - int *poly_index_pt= &m_polygonIndexArray[0]; - int *tri_pt= &m_triFaceArray[0]; - - UVco *uv_pt = NULL; - if (tface) - { - m_triFaceUVcoArray.resize(tot_bt_tris*3); - uv_pt = &m_triFaceUVcoArray[0]; - } - else - m_triFaceUVcoArray.clear(); - - for (int p2=0; p2GetPolygon((index)? index[p2]: p2); - - // only add polygons that have the collisionflag set - if (poly->IsCollider()) - { - MVert *v1= &mvert[mf->v1]; - MVert *v2= &mvert[mf->v2]; - MVert *v3= &mvert[mf->v3]; - - // the face indicies - tri_pt[0]= vert_remap_array[mf->v1]; - tri_pt[1]= vert_remap_array[mf->v2]; - tri_pt[2]= vert_remap_array[mf->v3]; - tri_pt= tri_pt+3; - if (tf) - { - uv_pt[0].uv[0] = tf->uv[0][0]; - uv_pt[0].uv[1] = tf->uv[0][1]; - uv_pt[1].uv[0] = tf->uv[1][0]; - uv_pt[1].uv[1] = tf->uv[1][1]; - uv_pt[2].uv[0] = tf->uv[2][0]; - uv_pt[2].uv[1] = tf->uv[2][1]; - uv_pt += 3; - } - - // m_polygonIndexArray - *poly_index_pt= (index)? index[p2]: p2; - poly_index_pt++; - - // the vertex location - if (vert_tag_array[mf->v1]==true) { /* *** v1 *** */ - vert_tag_array[mf->v1]= false; - *bt++ = v1->co[0]; - *bt++ = v1->co[1]; - *bt++ = v1->co[2]; - } - if (vert_tag_array[mf->v2]==true) { /* *** v2 *** */ - vert_tag_array[mf->v2]= false; - *bt++ = v2->co[0]; - *bt++ = v2->co[1]; - *bt++ = v2->co[2]; - } - if (vert_tag_array[mf->v3]==true) { /* *** v3 *** */ - vert_tag_array[mf->v3]= false; - *bt++ = v3->co[0]; - *bt++ = v3->co[1]; - *bt++ = v3->co[2]; - } - - if (mf->v4) - { - MVert *v4= &mvert[mf->v4]; - - tri_pt[0]= vert_remap_array[mf->v1]; - tri_pt[1]= vert_remap_array[mf->v3]; - tri_pt[2]= vert_remap_array[mf->v4]; - tri_pt= tri_pt+3; - if (tf) - { - uv_pt[0].uv[0] = tf->uv[0][0]; - uv_pt[0].uv[1] = tf->uv[0][1]; - uv_pt[1].uv[0] = tf->uv[2][0]; - uv_pt[1].uv[1] = tf->uv[2][1]; - uv_pt[2].uv[0] = tf->uv[3][0]; - uv_pt[2].uv[1] = tf->uv[3][1]; - uv_pt += 3; - } - - // m_polygonIndexArray - *poly_index_pt= (index)? index[p2]: p2; - poly_index_pt++; - - // the vertex location - if (vert_tag_array[mf->v4]==true) { /* *** v4 *** */ - vert_tag_array[mf->v4]= false; - *bt++ = v4->co[0]; - *bt++ = v4->co[1]; - *bt++ = v4->co[2]; - } - } - } - } - - - /* If this ever gets confusing, print out an OBJ file for debugging */ -#if 0 - printf("# vert count %d\n", m_vertexArray.size()); - for(i=0; irelease(dm); - dm = NULL; - } - - // sharing only on static mesh at present, if you change that, you must also change in FindMesh - if (!polytope && !dm) - { - // triangle shape can be shared, store the mesh object in the map - m_meshShapeMap.insert(std::pair(meshobj,this)); - } - return true; -} - -#include - -/* Updates the arrays used by CreateBulletShape(), - * take care that recalcLocalAabb() runs after CreateBulletShape is called. - * */ -bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RAS_MeshObject* meshobj) -{ - int numpolys; - int numverts; - - unsigned int tot_bt_tris= 0; - unsigned int tot_bt_verts= 0; - - int i, j; - int v_orig; - - /* Use for looping over verts in a face as a try or 2 tris */ - const int quad_verts[7]= {0,1,2, 0,2,3, -1}; - const int tri_verts[4]= {0,1,2, -1}; - const int *fv_pt; - - if(gameobj==NULL && meshobj==NULL) - return false; - - if(m_shapeType != PHY_SHAPE_MESH) - return false; - - RAS_Deformer *deformer= gameobj ? gameobj->GetDeformer():NULL; - - /* get the mesh from the object if not defined */ - if(meshobj==NULL) { - - /* modifier mesh */ - if(deformer && deformer->GetFinalMesh()) - meshobj= deformer->GetRasMesh(); - - /* game object first mesh */ - if(meshobj==NULL) { - if(gameobj->GetMeshCount() > 0) { - meshobj= gameobj->GetMesh(0); - } - } - } - - if(deformer && deformer->GetFinalMesh() && deformer->GetRasMesh() == meshobj) - { /* - * Derived Mesh Update - * - * */ - - DerivedMesh* dm= gameobj->GetDeformer()->GetFinalMesh(); - - MVert *mvert = dm->getVertArray(dm); - MFace *mface = dm->getFaceArray(dm); - numpolys = dm->getNumFaces(dm); - numverts = dm->getNumVerts(dm); - int* index = (int*)dm->getFaceDataArray(dm, CD_ORIGINDEX); - - MFace *mf; - MVert *mv; - - int flen; - - if(CustomData_has_layer(&dm->faceData, CD_MTFACE)) - { - MTFace *tface = (MTFace *)dm->getFaceDataArray(dm, CD_MTFACE); - MTFace *tf; - - vector vert_tag_array(numverts, false); - vector vert_remap_array(numverts, 0); - - for(mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) { - if(tf->mode & TF_DYNAMIC) - { - if(mf->v4) { - tot_bt_tris+= 2; - flen= 4; - } else { - tot_bt_tris++; - flen= 3; - } - - for(j=0; jv1 + j)); - - if(vert_tag_array[v_orig]==false) - { - vert_tag_array[v_orig]= true; - vert_remap_array[v_orig]= tot_bt_verts; - tot_bt_verts++; - } - } - } - } - - m_vertexArray.resize(tot_bt_verts*3); - btScalar *bt= &m_vertexArray[0]; - - m_triFaceArray.resize(tot_bt_tris*3); - int *tri_pt= &m_triFaceArray[0]; - - m_triFaceUVcoArray.resize(tot_bt_tris*3); - UVco *uv_pt= &m_triFaceUVcoArray[0]; - - m_polygonIndexArray.resize(tot_bt_tris); - int *poly_index_pt= &m_polygonIndexArray[0]; - - for(mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) - { - if(tf->mode & TF_DYNAMIC) - { - int origi = (index)? index[i]: i; - - if(mf->v4) { - fv_pt= quad_verts; - *poly_index_pt++ = origi; - *poly_index_pt++ = origi; - flen= 4; - } else { - fv_pt= tri_verts; - *poly_index_pt++ = origi; - flen= 3; - } - - for(; *fv_pt > -1; fv_pt++) - { - v_orig = (*(&mf->v1 + (*fv_pt))); - - if(vert_tag_array[v_orig]) - { - mv= mvert + v_orig; - *bt++ = mv->co[0]; - *bt++ = mv->co[1]; - *bt++ = mv->co[2]; - - vert_tag_array[v_orig]= false; - } - *tri_pt++ = vert_remap_array[v_orig]; - uv_pt->uv[0] = tf->uv[*fv_pt][0]; - uv_pt->uv[1] = tf->uv[*fv_pt][1]; - uv_pt++; - } - } - } - } - else { - /* no need for a vertex mapping. simple/fast */ - - tot_bt_verts= numverts; - - for(mf= mface, i=0; i < numpolys; mf++, i++) { - tot_bt_tris += (mf->v4 ? 2:1); - } - - m_vertexArray.resize(tot_bt_verts*3); - btScalar *bt= &m_vertexArray[0]; - - m_triFaceArray.resize(tot_bt_tris*3); - int *tri_pt= &m_triFaceArray[0]; - - m_polygonIndexArray.resize(tot_bt_tris); - int *poly_index_pt= &m_polygonIndexArray[0]; - - m_triFaceUVcoArray.clear(); - - for(mv= mvert, i=0; i < numverts; mv++, i++) { - *bt++ = mv->co[0]; *bt++ = mv->co[1]; *bt++ = mv->co[2]; - } - - for(mf= mface, i=0; i < numpolys; mf++, i++) { - int origi = (index)? index[i]: i; - - if(mf->v4) { - fv_pt= quad_verts; - *poly_index_pt++ = origi; - *poly_index_pt++ = origi; - } - else { - fv_pt= tri_verts; - *poly_index_pt++ = origi; - } - - for(; *fv_pt > -1; fv_pt++) - *tri_pt++ = (*(&mf->v1 + (*fv_pt))); - } - } - } - else { /* - * RAS Mesh Update - * - * */ - - /* Note!, gameobj can be NULL here */ - - /* transverts are only used for deformed RAS_Meshes, the RAS_TexVert data - * is too hard to get at, see below for details */ - float (*transverts)[3]= NULL; - int transverts_tot= 0; /* with deformed meshes - should always be greater then the max orginal index, or we get crashes */ - - if(deformer) { - /* map locations from the deformed array - * - * Could call deformer->Update(); but rely on redraw updating. - * */ - transverts= deformer->GetTransVerts(&transverts_tot); - } - - // Tag verts we're using - numpolys= meshobj->NumPolygons(); - numverts= meshobj->m_sharedvertex_map.size(); - const float *xyz; - - - vector vert_tag_array(numverts, false); - vector vert_remap_array(numverts, 0); - - for(int p=0; pGetPolygon(p); - if (poly->IsCollider()) - { - for(i=0; i < poly->VertexCount(); i++) - { - v_orig= poly->GetVertex(i)->getOrigIndex(); - if(vert_tag_array[v_orig]==false) - { - vert_tag_array[v_orig]= true; - vert_remap_array[v_orig]= tot_bt_verts; - tot_bt_verts++; - } - } - tot_bt_tris += (poly->VertexCount()==4 ? 2:1); - } - } - - m_vertexArray.resize(tot_bt_verts*3); - btScalar *bt= &m_vertexArray[0]; - - m_triFaceArray.resize(tot_bt_tris*3); - int *tri_pt= &m_triFaceArray[0]; - - /* cant be used for anything useful in this case, since we dont rely on the original mesh - * will just be an array like pythons range(tot_bt_tris) */ - m_polygonIndexArray.resize(tot_bt_tris); - - - for(int p=0; pGetPolygon(p); - - if (poly->IsCollider()) - { - /* quad or tri loop */ - fv_pt= (poly->VertexCount()==3 ? tri_verts:quad_verts); - - for(; *fv_pt > -1; fv_pt++) - { - v_orig= poly->GetVertex(*fv_pt)->getOrigIndex(); - - if(vert_tag_array[v_orig]) - { - if(transverts) { - /* deformed mesh, using RAS_TexVert locations would be too troublesome - * because they are use the gameob as a hash in the material slot */ - *bt++ = transverts[v_orig][0]; - *bt++ = transverts[v_orig][1]; - *bt++ = transverts[v_orig][2]; - } - else { - /* static mesh python may have modified */ - xyz= meshobj->GetVertexLocation( v_orig ); - *bt++ = xyz[0]; - *bt++ = xyz[1]; - *bt++ = xyz[2]; - } - - vert_tag_array[v_orig]= false; - } - - *tri_pt++ = vert_remap_array[v_orig]; - } - } - - m_polygonIndexArray[p]= p; /* dumb counting */ - } - } - -#if 0 - /* needs #include */ - printf("# vert count %d\n", m_vertexArray.size()); - for(int i=0; iCreateBulletShape(margin, useGimpact, useBvh); - - switch (m_shapeType) - { - default: - break; - - case PHY_SHAPE_BOX: - collisionShape = new btBoxShape(m_halfExtend); - collisionShape->setMargin(margin); - break; - - case PHY_SHAPE_SPHERE: - collisionShape = new btSphereShape(m_radius); - collisionShape->setMargin(margin); - break; - - case PHY_SHAPE_CYLINDER: - collisionShape = new btCylinderShapeZ(m_halfExtend); - collisionShape->setMargin(margin); - break; - - case PHY_SHAPE_CONE: - collisionShape = new btConeShapeZ(m_radius, m_height); - collisionShape->setMargin(margin); - break; - - case PHY_SHAPE_POLYTOPE: - collisionShape = new btConvexHullShape(&m_vertexArray[0], m_vertexArray.size()/3, 3*sizeof(btScalar)); - collisionShape->setMargin(margin); - break; - - case PHY_SHAPE_MESH: - // Let's use the latest btScaledBvhTriangleMeshShape: it allows true sharing of - // triangle mesh information between duplicates => drastic performance increase when - // duplicating complex mesh objects. - // BUT it causes a small performance decrease when sharing is not required: - // 9 multiplications/additions and one function call for each triangle that passes the mid phase filtering - // One possible optimization is to use directly the btBvhTriangleMeshShape when the scale is 1,1,1 - // and btScaledBvhTriangleMeshShape otherwise. - if (useGimpact) - { - btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray( - m_polygonIndexArray.size(), - &m_triFaceArray[0], - 3*sizeof(int), - m_vertexArray.size()/3, - &m_vertexArray[0], - 3*sizeof(btScalar) - ); - - btGImpactMeshShape* gimpactShape = new btGImpactMeshShape(indexVertexArrays); - gimpactShape->setMargin(margin); - collisionShape = gimpactShape; - gimpactShape->updateBound(); - - } else - { - if (!m_unscaledShape || m_forceReInstance) - { - - btTriangleIndexVertexArray* indexVertexArrays = 0; - - ///enable welding, only for the objects that need it (such as soft bodies) - if (0.f != m_weldingThreshold1) - { - btTriangleMesh* collisionMeshData = new btTriangleMesh(true,false); - collisionMeshData->m_weldingThreshold = m_weldingThreshold1; - bool removeDuplicateVertices=true; - // m_vertexArray not in multiple of 3 anymore, use m_triFaceArray - for(unsigned int i=0; iaddTriangle(v1, v2, v3, removeDuplicateVertices); - } - indexVertexArrays = collisionMeshData; - - } else - { - indexVertexArrays = new btTriangleIndexVertexArray( - m_polygonIndexArray.size(), - &m_triFaceArray[0], - 3*sizeof(int), - m_vertexArray.size()/3, - &m_vertexArray[0], - 3*sizeof(btScalar)); - } - - // this shape will be shared and not deleted until shapeInfo is deleted - - // for UpdateMesh, reuse the last memory location so instancing wont crash. - if(m_unscaledShape) { - DeleteBulletShape(m_unscaledShape, false); - m_unscaledShape->~btBvhTriangleMeshShape(); - m_unscaledShape = new(m_unscaledShape) btBvhTriangleMeshShape( indexVertexArrays, true, useBvh ); - } else { - m_unscaledShape = new btBvhTriangleMeshShape( indexVertexArrays, true, useBvh ); - } - m_forceReInstance= false; - } else if (useBvh && m_unscaledShape->getOptimizedBvh() == NULL) { - // the existing unscaledShape was not build with Bvh, do it now - m_unscaledShape->buildOptimizedBvh(); - } - collisionShape = new btScaledBvhTriangleMeshShape(m_unscaledShape, btVector3(1.0f,1.0f,1.0f)); - collisionShape->setMargin(margin); - } - break; - - case PHY_SHAPE_COMPOUND: - if (m_shapeArray.size() > 0) - { - compoundShape = new btCompoundShape(); - for (std::vector::iterator sit = m_shapeArray.begin(); - sit != m_shapeArray.end(); - sit++) - { - collisionShape = (*sit)->CreateBulletShape(margin, useGimpact, useBvh); - if (collisionShape) - { - collisionShape->setLocalScaling((*sit)->m_childScale); - compoundShape->addChildShape((*sit)->m_childTrans, collisionShape); - } - } - collisionShape = compoundShape; - } - } - return collisionShape; -} - -void CcdShapeConstructionInfo::AddShape(CcdShapeConstructionInfo* shapeInfo) -{ - m_shapeArray.push_back(shapeInfo); - shapeInfo->AddRef(); -} - -CcdShapeConstructionInfo::~CcdShapeConstructionInfo() -{ - for (std::vector::iterator sit = m_shapeArray.begin(); - sit != m_shapeArray.end(); - sit++) - { - (*sit)->Release(); - } - m_shapeArray.clear(); - if (m_unscaledShape) - { - DeleteBulletShape(m_unscaledShape, true); - } - m_vertexArray.clear(); - if (m_shapeType == PHY_SHAPE_MESH && m_meshObject != NULL) - { - std::map::iterator mit = m_meshShapeMap.find(m_meshObject); - if (mit != m_meshShapeMap.end() && mit->second == this) - { - m_meshShapeMap.erase(mit); - } - } - if (m_shapeType == PHY_SHAPE_PROXY && m_shapeProxy != NULL) - { - m_shapeProxy->Release(); - } -} - - diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h deleted file mode 100644 index 607602a4d0d..00000000000 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ /dev/null @@ -1,619 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef BULLET2_PHYSICSCONTROLLER_H -#define BULLET2_PHYSICSCONTROLLER_H - -#include -#include - -#include "PHY_IPhysicsController.h" - -/// PHY_IPhysicsController is the abstract simplified Interface to a physical object. -/// It contains the IMotionState and IDeformableMesh Interfaces. -#include "btBulletDynamicsCommon.h" -#include "LinearMath/btTransform.h" - -#include "PHY_IMotionState.h" - -extern float gDeactivationTime; -extern float gLinearSleepingTreshold; -extern float gAngularSleepingTreshold; -extern bool gDisableDeactivation; -class CcdPhysicsEnvironment; -class btMotionState; -class RAS_MeshObject; -struct DerivedMesh; -class btCollisionShape; - - -#define CCD_BSB_SHAPE_MATCHING 2 -#define CCD_BSB_BENDING_CONSTRAINTS 8 -#define CCD_BSB_AERO_VPOINT 16 /* aero model, Vertex normals are oriented toward velocity*/ -#define CCD_BSB_AERO_VTWOSIDE 32 /* aero model, Vertex normals are flipped to match velocity */ - -/* BulletSoftBody.collisionflags */ -#define CCD_BSB_COL_SDF_RS 2 /* SDF based rigid vs soft */ -#define CCD_BSB_COL_CL_RS 4 /* Cluster based rigid vs soft */ -#define CCD_BSB_COL_CL_SS 8 /* Cluster based soft vs soft */ -#define CCD_BSB_COL_VF_SS 16 /* Vertex/Face based soft vs soft */ - - -// Shape contructor -// It contains all the information needed to create a simple bullet shape at runtime -class CcdShapeConstructionInfo -{ -public: - struct UVco - { - float uv[2]; - }; - - static CcdShapeConstructionInfo* FindMesh(class RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope); - - CcdShapeConstructionInfo() : - m_shapeType(PHY_SHAPE_NONE), - m_radius(1.0), - m_height(1.0), - m_halfExtend(0.f,0.f,0.f), - m_childScale(1.0f,1.0f,1.0f), - m_userData(NULL), - m_refCount(1), - m_meshObject(NULL), - m_unscaledShape(NULL), - m_forceReInstance(false), - m_weldingThreshold1(0.f), - m_shapeProxy(NULL) - { - m_childTrans.setIdentity(); - } - - ~CcdShapeConstructionInfo(); - - CcdShapeConstructionInfo* AddRef() - { - m_refCount++; - return this; - } - - int Release() - { - if (--m_refCount > 0) - return m_refCount; - delete this; - return 0; - } - - bool IsUnused(void) - { - return (m_meshObject==NULL && m_shapeArray.size() == 0 && m_shapeProxy == NULL); - } - - void AddShape(CcdShapeConstructionInfo* shapeInfo); - - btTriangleMeshShape* GetMeshShape(void) - { - return (m_unscaledShape); - } - CcdShapeConstructionInfo* GetChildShape(int i) - { - if (i < 0 || i >= (int)m_shapeArray.size()) - return NULL; - - return m_shapeArray.at(i); - } - int FindChildShape(CcdShapeConstructionInfo* shapeInfo, void* userData) - { - if (shapeInfo == NULL) - return -1; - for (int i=0; i<(int)m_shapeArray.size(); i++) - { - CcdShapeConstructionInfo* childInfo = m_shapeArray.at(i); - if ((userData == NULL || userData == childInfo->m_userData) && - (childInfo == shapeInfo || - (childInfo->m_shapeType == PHY_SHAPE_PROXY && - childInfo->m_shapeProxy == shapeInfo))) - return i; - } - return -1; - } - - bool RemoveChildShape(int i) - { - if (i < 0 || i >= (int)m_shapeArray.size()) - return false; - m_shapeArray.at(i)->Release(); - if (i < (int)m_shapeArray.size()-1) - m_shapeArray[i] = m_shapeArray.back(); - m_shapeArray.pop_back(); - return true; - } - - bool SetMesh(class RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope); - RAS_MeshObject* GetMesh(void) - { - return m_meshObject; - } - - bool UpdateMesh(class KX_GameObject* gameobj, class RAS_MeshObject* mesh); - - - bool SetProxy(CcdShapeConstructionInfo* shapeInfo); - CcdShapeConstructionInfo* GetProxy(void) - { - return m_shapeProxy; - } - - btCollisionShape* CreateBulletShape(btScalar margin, bool useGimpact=false, bool useBvh=true); - - // member variables - PHY_ShapeType m_shapeType; - btScalar m_radius; - btScalar m_height; - btVector3 m_halfExtend; - btTransform m_childTrans; - btVector3 m_childScale; - void* m_userData; - btAlignedObjectArray m_vertexArray; // Contains both vertex array for polytope shape and - // triangle array for concave mesh shape. Each vertex is 3 consecutive values - // In this case a triangle is made of 3 consecutive points - std::vector m_polygonIndexArray; // Contains the array of polygon index in the - // original mesh that correspond to shape triangles. - // only set for concave mesh shape. - - std::vector m_triFaceArray; // Contains an array of triplets of face indicies - // quads turn into 2 tris - - std::vector m_triFaceUVcoArray; // Contains an array of pair of UV coordinate for each vertex of faces - // quads turn into 2 tris - - void setVertexWeldingThreshold1(float threshold) - { - m_weldingThreshold1 = threshold*threshold; - } -protected: - static std::map m_meshShapeMap; - int m_refCount; // this class is shared between replicas - // keep track of users so that we can release it - RAS_MeshObject* m_meshObject; // Keep a pointer to the original mesh - btBvhTriangleMeshShape* m_unscaledShape;// holds the shared unscale BVH mesh shape, - // the actual shape is of type btScaledBvhTriangleMeshShape - std::vector m_shapeArray; // for compound shapes - bool m_forceReInstance; //use gimpact for concave dynamic/moving collision detection - float m_weldingThreshold1; //welding closeby vertices together can improve softbody stability etc. - CcdShapeConstructionInfo* m_shapeProxy; // only used for PHY_SHAPE_PROXY, pointer to actual shape info - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdShapeConstructionInfo"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -struct CcdConstructionInfo -{ - - ///CollisionFilterGroups provides some optional usage of basic collision filtering - ///this is done during broadphase, so very early in the pipeline - ///more advanced collision filtering should be done in btCollisionDispatcher::NeedsCollision - enum CollisionFilterGroups - { - DefaultFilter = 1, - StaticFilter = 2, - KinematicFilter = 4, - DebrisFilter = 8, - SensorFilter = 16, - AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorFilter, - }; - - - CcdConstructionInfo() - : m_localInertiaTensor(1.f, 1.f, 1.f), - m_gravity(0,0,0), - m_scaling(1.f,1.f,1.f), - m_mass(0.f), - m_clamp_vel_min(-1.f), - m_clamp_vel_max(-1.f), - m_restitution(0.1f), - m_friction(0.5f), - m_linearDamping(0.1f), - m_angularDamping(0.1f), - m_margin(0.06f), - m_gamesoftFlag(0), - m_collisionFlags(0), - m_bRigid(false), - m_bSoft(false), - m_bSensor(false), - m_bGimpact(false), - m_collisionFilterGroup(DefaultFilter), - m_collisionFilterMask(AllFilter), - m_collisionShape(0), - m_MotionState(0), - m_shapeInfo(0), - m_physicsEnv(0), - m_inertiaFactor(1.f), - m_do_anisotropic(false), - m_anisotropicFriction(1.f,1.f,1.f), - m_contactProcessingThreshold(1e10) - { - } - - btVector3 m_localInertiaTensor; - btVector3 m_gravity; - btVector3 m_scaling; - btScalar m_mass; - btScalar m_clamp_vel_min; - btScalar m_clamp_vel_max; - btScalar m_restitution; - btScalar m_friction; - btScalar m_linearDamping; - btScalar m_angularDamping; - btScalar m_margin; - - //////////////////// - int m_gamesoftFlag; - float m_soft_linStiff; /* linear stiffness 0..1 */ - float m_soft_angStiff; /* angular stiffness 0..1 */ - float m_soft_volume; /* volume preservation 0..1 */ - - int m_soft_viterations; /* Velocities solver iterations */ - int m_soft_piterations; /* Positions solver iterations */ - int m_soft_diterations; /* Drift solver iterations */ - int m_soft_citerations; /* Cluster solver iterations */ - - float m_soft_kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */ - float m_soft_kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */ - float m_soft_kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */ - float m_soft_kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - - float m_soft_kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - float m_soft_kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - float m_soft_kVCF; /* Velocities correction factor (Baumgarte) */ - float m_soft_kDP; /* Damping coefficient [0,1] */ - - float m_soft_kDG; /* Drag coefficient [0,+inf] */ - float m_soft_kLF; /* Lift coefficient [0,+inf] */ - float m_soft_kPR; /* Pressure coefficient [-inf,+inf] */ - float m_soft_kVC; /* Volume conversation coefficient [0,+inf] */ - - float m_soft_kDF; /* Dynamic friction coefficient [0,1] */ - float m_soft_kMT; /* Pose matching coefficient [0,1] */ - float m_soft_kCHR; /* Rigid contacts hardness [0,1] */ - float m_soft_kKHR; /* Kinetic contacts hardness [0,1] */ - - float m_soft_kSHR; /* Soft contacts hardness [0,1] */ - float m_soft_kAHR; /* Anchors hardness [0,1] */ - int m_soft_collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ - int m_soft_numclusteriterations; /* number of iterations to refine collision clusters*/ -/////////////////// - - - - int m_collisionFlags; - bool m_bRigid; - bool m_bSoft; - bool m_bSensor; - bool m_bGimpact; // use Gimpact for mesh body - - ///optional use of collision group/mask: - ///only collision with object goups that match the collision mask. - ///this is very basic early out. advanced collision filtering should be - ///done in the btCollisionDispatcher::NeedsCollision and NeedsResponse - ///both values default to 1 - short int m_collisionFilterGroup; - short int m_collisionFilterMask; - - ///these pointers are used as argument passing for the CcdPhysicsController constructor - ///and not anymore after that - class btCollisionShape* m_collisionShape; - class PHY_IMotionState* m_MotionState; - class CcdShapeConstructionInfo* m_shapeInfo; - - CcdPhysicsEnvironment* m_physicsEnv; //needed for self-replication - float m_inertiaFactor;//tweak the inertia (hooked up to Blender 'formfactor' - bool m_do_anisotropic; - btVector3 m_anisotropicFriction; - - bool m_do_fh; ///< Should the object have a linear Fh spring? - bool m_do_rot_fh; ///< Should the object have an angular Fh spring? - btScalar m_fh_spring; ///< Spring constant (both linear and angular) - btScalar m_fh_damping; ///< Damping factor (linear and angular) in range [0, 1] - btScalar m_fh_distance; ///< The range above the surface where Fh is active. - bool m_fh_normal; ///< Should the object slide off slopes? - float m_radius;//for fh backwards compatibility - - ///m_contactProcessingThreshold allows to process contact points with positive distance - ///normally only contacts with negative distance (penetration) are solved - ///however, rigid body stacking is more stable when positive contacts are still passed into the constraint solver - ///this might sometimes lead to collisions with 'internal edges' such as a sliding character controller - ///so disable/set m_contactProcessingThreshold to zero for sliding characters etc. - float m_contactProcessingThreshold;///< Process contacts with positive distance in range [0..INF] - -}; - - -class btRigidBody; -class btCollisionObject; -class btSoftBody; - -///CcdPhysicsController is a physics object that supports continuous collision detection and time of impact based physics resolution. -class CcdPhysicsController : public PHY_IPhysicsController -{ -protected: - btCollisionObject* m_object; - - - class PHY_IMotionState* m_MotionState; - btMotionState* m_bulletMotionState; - class btCollisionShape* m_collisionShape; - class CcdShapeConstructionInfo* m_shapeInfo; - - friend class CcdPhysicsEnvironment; // needed when updating the controller - - //some book keeping for replication - bool m_softbodyMappingDone; - bool m_softBodyTransformInitialized; - bool m_prototypeTransformInitialized; - btTransform m_softbodyStartTrans; - - - void* m_newClientInfo; - int m_registerCount; // needed when multiple sensors use the same controller - CcdConstructionInfo m_cci;//needed for replication - - CcdPhysicsController* m_parentCtrl; - - void GetWorldOrientation(btMatrix3x3& mat); - - void CreateRigidbody(); - bool CreateSoftbody(); - - bool Register() { - return (m_registerCount++ == 0) ? true : false; - } - bool Unregister() { - return (--m_registerCount == 0) ? true : false; - } - - void setWorldOrientation(const btMatrix3x3& mat); - void forceWorldTransform(const btMatrix3x3& mat, const btVector3& pos); - - public: - - int m_collisionDelay; - - - CcdPhysicsController (const CcdConstructionInfo& ci); - - bool DeleteControllerShape(); - bool ReplaceControllerShape(btCollisionShape *newShape); - - virtual ~CcdPhysicsController(); - - CcdConstructionInfo& getConstructionInfo() - { - return m_cci; - } - const CcdConstructionInfo& getConstructionInfo() const - { - return m_cci; - } - - - btRigidBody* GetRigidBody(); - btCollisionObject* GetCollisionObject(); - btSoftBody* GetSoftBody(); - - CcdShapeConstructionInfo* GetShapeInfo() { return m_shapeInfo; } - - btCollisionShape* GetCollisionShape() { - return m_object->getCollisionShape(); - } - //////////////////////////////////// - // PHY_IPhysicsController interface - //////////////////////////////////// - - - /** - SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - virtual bool SynchronizeMotionStates(float time); - /** - WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - - virtual void WriteMotionStateToDynamics(bool nondynaonly); - virtual void WriteDynamicsToMotionState(); - - // controller replication - virtual void PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl); - virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment *env); - - // kinematic methods - virtual void RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local); - virtual void RelativeRotate(const float drot[9],bool local); - virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal); - virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal); - virtual void setPosition(float posX,float posY,float posZ); - virtual void getPosition(PHY__Vector3& pos) const; - - virtual void setScaling(float scaleX,float scaleY,float scaleZ); - - // physics methods - virtual void ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local); - virtual void ApplyForce(float forceX,float forceY,float forceZ,bool local); - virtual void SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local); - virtual void SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local); - virtual void applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ); - virtual void SetActive(bool active); - - // reading out information from physics - virtual void GetLinearVelocity(float& linvX,float& linvY,float& linvZ); - virtual void GetAngularVelocity(float& angVelX,float& angVelY,float& angVelZ); - virtual void GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ); - virtual void getReactionForce(float& forceX,float& forceY,float& forceZ); - - // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted - virtual void setRigidBody(bool rigid); - - - virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ); - - // clientinfo for raycasts for example - virtual void* getNewClientInfo(); - virtual void setNewClientInfo(void* clientinfo); - virtual PHY_IPhysicsController* GetReplica(); - - ///There should be no 'SetCollisionFilterGroup' method, as changing this during run-time is will result in errors - short int GetCollisionFilterGroup() const - { - return m_cci.m_collisionFilterGroup; - } - ///There should be no 'SetCollisionFilterGroup' method, as changing this during run-time is will result in errors - short int GetCollisionFilterMask() const - { - return m_cci.m_collisionFilterMask; - } - - virtual void calcXform() {} ; - virtual void SetMargin(float margin) - { - if (m_collisionShape) - m_collisionShape->setMargin(btScalar(margin)); - } - virtual float GetMargin() const - { - return (m_collisionShape) ? m_collisionShape->getMargin() : 0.f; - } - virtual float GetRadius() const - { - // this is not the actual shape radius, it's only used for Fh support - return m_cci.m_radius; - } - virtual void SetRadius(float margin) - { - if (m_collisionShape && m_collisionShape->getShapeType() == SPHERE_SHAPE_PROXYTYPE) - { - btSphereShape* sphereShape = static_cast(m_collisionShape); - sphereShape->setUnscaledRadius(margin); - } - m_cci.m_radius = margin; - } - - // velocity clamping - virtual void SetLinVelocityMin(float val) - { - m_cci.m_clamp_vel_min= val; - } - virtual float GetLinVelocityMin() const - { - return m_cci.m_clamp_vel_min; - } - virtual void SetLinVelocityMax(float val) - { - m_cci.m_clamp_vel_max= val; - } - virtual float GetLinVelocityMax() const - { - return m_cci.m_clamp_vel_max; - } - - bool wantsSleeping(); - - void UpdateDeactivation(float timeStep); - - void SetCenterOfMassTransform(btTransform& xform); - - static btTransform& GetTransformFromMotionState(PHY_IMotionState* motionState); - - void setAabb(const btVector3& aabbMin,const btVector3& aabbMax); - - - class PHY_IMotionState* GetMotionState() - { - return m_MotionState; - } - - const class PHY_IMotionState* GetMotionState() const - { - return m_MotionState; - } - - class CcdPhysicsEnvironment* GetPhysicsEnvironment() - { - return m_cci.m_physicsEnv; - } - - void setParentCtrl(CcdPhysicsController* parentCtrl) - { - m_parentCtrl = parentCtrl; - } - - CcdPhysicsController* getParentCtrl() - { - return m_parentCtrl; - } - - const CcdPhysicsController* getParentCtrl() const - { - return m_parentCtrl; - } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdPhysicsController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - - - - -///DefaultMotionState implements standard motionstate, using btTransform -class DefaultMotionState : public PHY_IMotionState - -{ - public: - DefaultMotionState(); - - virtual ~DefaultMotionState(); - - virtual void getWorldPosition(float& posX,float& posY,float& posZ); - virtual void getWorldScaling(float& scaleX,float& scaleY,float& scaleZ); - virtual void getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal); - - virtual void setWorldPosition(float posX,float posY,float posZ); - virtual void setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal); - virtual void getWorldOrientation(float* ori); - virtual void setWorldOrientation(const float* ori); - - virtual void calculateWorldTransformations(); - - btTransform m_worldTransform; - btVector3 m_localScaling; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:DefaultMotionState"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - - -#endif //BULLET2_PHYSICSCONTROLLER_H diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp deleted file mode 100644 index 477a2c35d4f..00000000000 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ /dev/null @@ -1,2721 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - - -#include "CcdPhysicsEnvironment.h" -#include "CcdPhysicsController.h" -#include "CcdGraphicController.h" - -#include -#include "btBulletDynamicsCommon.h" -#include "LinearMath/btIDebugDraw.h" -#include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h" -#include "BulletSoftBody/btSoftRigidDynamicsWorld.h" -#include "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h" -#include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h" - -//profiling/timings -#include "LinearMath/btQuickprof.h" - - -#include "PHY_IMotionState.h" -#include "KX_GameObject.h" -#include "RAS_MeshObject.h" -#include "RAS_Polygon.h" -#include "RAS_TexVert.h" - -#define CCD_CONSTRAINT_DISABLE_LINKED_COLLISION 0x80 - -bool useIslands = true; - -#ifdef NEW_BULLET_VEHICLE_SUPPORT -#include "BulletDynamics/Vehicle/btRaycastVehicle.h" -#include "BulletDynamics/Vehicle/btVehicleRaycaster.h" -#include "BulletDynamics/Vehicle/btWheelInfo.h" -#include "PHY_IVehicle.h" -btRaycastVehicle::btVehicleTuning gTuning; - -#endif //NEW_BULLET_VEHICLE_SUPPORT -#include "LinearMath/btAabbUtil2.h" -#include "MT_Matrix4x4.h" -#include "MT_Vector3.h" -#include "GL/glew.h" - -#ifdef WIN32 -void DrawRasterizerLine(const float* from,const float* to,int color); -#endif - - -#include "BulletDynamics/ConstraintSolver/btContactConstraint.h" - - -#include -#include // for memset - -#ifdef NEW_BULLET_VEHICLE_SUPPORT -class WrapperVehicle : public PHY_IVehicle -{ - - btRaycastVehicle* m_vehicle; - PHY_IPhysicsController* m_chassis; - -public: - - WrapperVehicle(btRaycastVehicle* vehicle,PHY_IPhysicsController* chassis) - :m_vehicle(vehicle), - m_chassis(chassis) - { - } - - btRaycastVehicle* GetVehicle() - { - return m_vehicle; - } - - PHY_IPhysicsController* GetChassis() - { - return m_chassis; - } - - virtual void AddWheel( - PHY_IMotionState* motionState, - PHY__Vector3 connectionPoint, - PHY__Vector3 downDirection, - PHY__Vector3 axleDirection, - float suspensionRestLength, - float wheelRadius, - bool hasSteering - ) - { - btVector3 connectionPointCS0(connectionPoint[0],connectionPoint[1],connectionPoint[2]); - btVector3 wheelDirectionCS0(downDirection[0],downDirection[1],downDirection[2]); - btVector3 wheelAxle(axleDirection[0],axleDirection[1],axleDirection[2]); - - - btWheelInfo& info = m_vehicle->addWheel(connectionPointCS0,wheelDirectionCS0,wheelAxle, - suspensionRestLength,wheelRadius,gTuning,hasSteering); - info.m_clientInfo = motionState; - - } - - void SyncWheels() - { - int numWheels = GetNumWheels(); - int i; - for (i=0;igetWheelInfo(i); - PHY_IMotionState* motionState = (PHY_IMotionState*)info.m_clientInfo ; - // m_vehicle->updateWheelTransformsWS(info,false); - m_vehicle->updateWheelTransform(i,false); - btTransform trans = m_vehicle->getWheelInfo(i).m_worldTransform; - btQuaternion orn = trans.getRotation(); - const btVector3& pos = trans.getOrigin(); - motionState->setWorldOrientation(orn.x(),orn.y(),orn.z(),orn[3]); - motionState->setWorldPosition(pos.x(),pos.y(),pos.z()); - - } - } - - virtual int GetNumWheels() const - { - return m_vehicle->getNumWheels(); - } - - virtual void GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const - { - btTransform trans = m_vehicle->getWheelTransformWS(wheelIndex); - posX = trans.getOrigin().x(); - posY = trans.getOrigin().y(); - posZ = trans.getOrigin().z(); - } - virtual void GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const - { - btTransform trans = m_vehicle->getWheelTransformWS(wheelIndex); - btQuaternion quat = trans.getRotation(); - btMatrix3x3 orn2(quat); - - quatX = trans.getRotation().x(); - quatY = trans.getRotation().y(); - quatZ = trans.getRotation().z(); - quatW = trans.getRotation()[3]; - - - //printf("test"); - - - } - - virtual float GetWheelRotation(int wheelIndex) const - { - float rotation = 0.f; - - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) - { - btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); - rotation = info.m_rotation; - } - return rotation; - - } - - - - virtual int GetUserConstraintId() const - { - return m_vehicle->getUserConstraintId(); - } - - virtual int GetUserConstraintType() const - { - return m_vehicle->getUserConstraintType(); - } - - virtual void SetSteeringValue(float steering,int wheelIndex) - { - m_vehicle->setSteeringValue(steering,wheelIndex); - } - - virtual void ApplyEngineForce(float force,int wheelIndex) - { - m_vehicle->applyEngineForce(force,wheelIndex); - } - - virtual void ApplyBraking(float braking,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) - { - btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); - info.m_brake = braking; - } - } - - virtual void SetWheelFriction(float friction,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) - { - btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); - info.m_frictionSlip = friction; - } - - } - - virtual void SetSuspensionStiffness(float suspensionStiffness,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) - { - btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); - info.m_suspensionStiffness = suspensionStiffness; - - } - } - - virtual void SetSuspensionDamping(float suspensionDamping,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) - { - btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); - info.m_wheelsDampingRelaxation = suspensionDamping; - } - } - - virtual void SetSuspensionCompression(float suspensionCompression,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) - { - btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); - info.m_wheelsDampingCompression = suspensionCompression; - } - } - - - - virtual void SetRollInfluence(float rollInfluence,int wheelIndex) - { - if ((wheelIndex>=0) && (wheelIndex< m_vehicle->getNumWheels())) - { - btWheelInfo& info = m_vehicle->getWheelInfo(wheelIndex); - info.m_rollInfluence = rollInfluence; - } - } - - virtual void SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) - { - m_vehicle->setCoordinateSystem(rightIndex,upIndex,forwardIndex); - } - - - -}; -#endif //NEW_BULLET_VEHICLE_SUPPORT - -class CcdOverlapFilterCallBack : public btOverlapFilterCallback -{ -private: - class CcdPhysicsEnvironment* m_physEnv; -public: - CcdOverlapFilterCallBack(CcdPhysicsEnvironment* env) : - m_physEnv(env) - { - } - virtual ~CcdOverlapFilterCallBack() - { - } - // return true when pairs need collision - virtual bool needBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const; -}; - - -void CcdPhysicsEnvironment::setDebugDrawer(btIDebugDraw* debugDrawer) -{ - if (debugDrawer && m_dynamicsWorld) - m_dynamicsWorld->setDebugDrawer(debugDrawer); - m_debugDrawer = debugDrawer; -} - -static void DrawAabb(btIDebugDraw* debugDrawer,const btVector3& from,const btVector3& to,const btVector3& color) -{ - btVector3 halfExtents = (to-from)* 0.5f; - btVector3 center = (to+from) *0.5f; - int i,j; - - btVector3 edgecoord(1.f,1.f,1.f),pa,pb; - for (i=0;i<4;i++) - { - for (j=0;j<3;j++) - { - pa = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], - edgecoord[2]*halfExtents[2]); - pa+=center; - - int othercoord = j%3; - edgecoord[othercoord]*=-1.f; - pb = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1], - edgecoord[2]*halfExtents[2]); - pb+=center; - - debugDrawer->drawLine(pa,pb,color); - } - edgecoord = btVector3(-1.f,-1.f,-1.f); - if (i<3) - edgecoord[i]*=-1.f; - } - - -} - - - - - - -CcdPhysicsEnvironment::CcdPhysicsEnvironment(bool useDbvtCulling,btDispatcher* dispatcher,btOverlappingPairCache* pairCache) -:m_cullingCache(NULL), -m_cullingTree(NULL), -m_numIterations(10), -m_numTimeSubSteps(1), -m_ccdMode(0), -m_solverType(-1), -m_profileTimings(0), -m_enableSatCollisionDetection(false), -m_solver(NULL), -m_ownPairCache(NULL), -m_filterCallback(NULL), -m_ownDispatcher(NULL), -m_scalingPropagated(false) -{ - - for (int i=0;isetConvexConvexMultipointIterations(); - - if (!dispatcher) - { - btCollisionDispatcher* disp = new btCollisionDispatcher(m_collisionConfiguration); - dispatcher = disp; - btGImpactCollisionAlgorithm::registerAlgorithm(disp); - m_ownDispatcher = dispatcher; - } - - //m_broadphase = new btAxisSweep3(btVector3(-1000,-1000,-1000),btVector3(1000,1000,1000)); - //m_broadphase = new btSimpleBroadphase(); - m_broadphase = new btDbvtBroadphase(); - // avoid any collision in the culling tree - if (useDbvtCulling) { - m_cullingCache = new btNullPairCache(); - m_cullingTree = new btDbvtBroadphase(m_cullingCache); - } - - m_filterCallback = new CcdOverlapFilterCallBack(this); - m_broadphase->getOverlappingPairCache()->setOverlapFilterCallback(m_filterCallback); - - setSolverType(1);//issues with quickstep and memory allocations -// m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,m_broadphase,m_solver,m_collisionConfiguration); - m_dynamicsWorld = new btSoftRigidDynamicsWorld(dispatcher,m_broadphase,m_solver,m_collisionConfiguration); - //m_dynamicsWorld->getSolverInfo().m_linearSlop = 0.01f; - //m_dynamicsWorld->getSolverInfo().m_solverMode= SOLVER_USE_WARMSTARTING + SOLVER_USE_2_FRICTION_DIRECTIONS + SOLVER_RANDMIZE_ORDER + SOLVER_USE_FRICTION_WARMSTARTING; - - m_debugDrawer = 0; - setGravity(0.f,0.f,-9.81f); -} - -void CcdPhysicsEnvironment::addCcdPhysicsController(CcdPhysicsController* ctrl) -{ - btRigidBody* body = ctrl->GetRigidBody(); - btCollisionObject* obj = ctrl->GetCollisionObject(); - - //this m_userPointer is just used for triggers, see CallbackTriggers - obj->setUserPointer(ctrl); - if (body) - body->setGravity( m_gravity ); - - m_controllers.insert(ctrl); - - if (body) - { - //use explicit group/filter for finer control over collision in bullet => near/radar sensor - m_dynamicsWorld->addRigidBody(body, ctrl->GetCollisionFilterGroup(), ctrl->GetCollisionFilterMask()); - } else - { - if (ctrl->GetSoftBody()) - { - btSoftBody* softBody = ctrl->GetSoftBody(); - m_dynamicsWorld->addSoftBody(softBody); - } else - { - if (obj->getCollisionShape()) - { - m_dynamicsWorld->addCollisionObject(obj,ctrl->GetCollisionFilterGroup(), ctrl->GetCollisionFilterMask()); - } - } - } - if (obj->isStaticOrKinematicObject()) - { - obj->setActivationState(ISLAND_SLEEPING); - } - - assert(obj->getBroadphaseHandle()); -} - - - -bool CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctrl) -{ - //also remove constraint - btRigidBody* body = ctrl->GetRigidBody(); - if (body) - { - for (int i=body->getNumConstraintRefs()-1;i>=0;i--) - { - btTypedConstraint* con = body->getConstraintRef(i); - m_dynamicsWorld->removeConstraint(con); - body->removeConstraintRef(con); - //delete con; //might be kept by python KX_ConstraintWrapper - } - m_dynamicsWorld->removeRigidBody(ctrl->GetRigidBody()); - } else - { - //if a softbody - if (ctrl->GetSoftBody()) - { - m_dynamicsWorld->removeSoftBody(ctrl->GetSoftBody()); - } else - { - m_dynamicsWorld->removeCollisionObject(ctrl->GetCollisionObject()); - } - } - if (ctrl->m_registerCount != 0) - printf("Warning: removing controller with non-zero m_registerCount: %d\n", ctrl->m_registerCount); - - //remove it from the triggers - m_triggerControllers.erase(ctrl); - - return (m_controllers.erase(ctrl) != 0); -} - -void CcdPhysicsEnvironment::updateCcdPhysicsController(CcdPhysicsController* ctrl, btScalar newMass, int newCollisionFlags, short int newCollisionGroup, short int newCollisionMask) -{ - // this function is used when the collisionning group of a controller is changed - // remove and add the collistioning object - btRigidBody* body = ctrl->GetRigidBody(); - btCollisionObject* obj = ctrl->GetCollisionObject(); - if (obj) - { - btVector3 inertia(0.0,0.0,0.0); - m_dynamicsWorld->removeCollisionObject(obj); - obj->setCollisionFlags(newCollisionFlags); - if (body) - { - if (newMass) - body->getCollisionShape()->calculateLocalInertia(newMass, inertia); - body->setMassProps(newMass, inertia); - } - m_dynamicsWorld->addCollisionObject(obj, newCollisionGroup, newCollisionMask); - } - // to avoid nasty interaction, we must update the property of the controller as well - ctrl->m_cci.m_mass = newMass; - ctrl->m_cci.m_collisionFilterGroup = newCollisionGroup; - ctrl->m_cci.m_collisionFilterMask = newCollisionMask; - ctrl->m_cci.m_collisionFlags = newCollisionFlags; -} - -void CcdPhysicsEnvironment::enableCcdPhysicsController(CcdPhysicsController* ctrl) -{ - if (m_controllers.insert(ctrl).second) - { - btCollisionObject* obj = ctrl->GetCollisionObject(); - obj->setUserPointer(ctrl); - // update the position of the object from the user - if (ctrl->GetMotionState()) - { - btTransform xform = CcdPhysicsController::GetTransformFromMotionState(ctrl->GetMotionState()); - ctrl->SetCenterOfMassTransform(xform); - } - m_dynamicsWorld->addCollisionObject(obj, - ctrl->GetCollisionFilterGroup(), ctrl->GetCollisionFilterMask()); - } -} - -void CcdPhysicsEnvironment::disableCcdPhysicsController(CcdPhysicsController* ctrl) -{ - if (m_controllers.erase(ctrl)) - { - btRigidBody* body = ctrl->GetRigidBody(); - if (body) - { - m_dynamicsWorld->removeRigidBody(body); - } else - { - if (ctrl->GetSoftBody()) - { - } else - { - m_dynamicsWorld->removeCollisionObject(ctrl->GetCollisionObject()); - } - } - } -} - -void CcdPhysicsEnvironment::refreshCcdPhysicsController(CcdPhysicsController* ctrl) -{ - btCollisionObject* obj = ctrl->GetCollisionObject(); - if (obj) - { - btBroadphaseProxy* proxy = obj->getBroadphaseHandle(); - if (proxy) - { - m_dynamicsWorld->getPairCache()->cleanProxyFromPairs(proxy,m_dynamicsWorld->getDispatcher()); - } - } -} - -void CcdPhysicsEnvironment::addCcdGraphicController(CcdGraphicController* ctrl) -{ - if (m_cullingTree && !ctrl->getBroadphaseHandle()) - { - btVector3 minAabb; - btVector3 maxAabb; - ctrl->getAabb(minAabb, maxAabb); - - ctrl->setBroadphaseHandle(m_cullingTree->createProxy( - minAabb, - maxAabb, - INVALID_SHAPE_PROXYTYPE, // this parameter is not used - ctrl, - 0, // this object does not collision with anything - 0, - NULL, // dispatcher => this parameter is not used - 0)); - - assert(ctrl->getBroadphaseHandle()); - } -} - -void CcdPhysicsEnvironment::removeCcdGraphicController(CcdGraphicController* ctrl) -{ - if (m_cullingTree) - { - btBroadphaseProxy* bp = ctrl->getBroadphaseHandle(); - if (bp) - { - m_cullingTree->destroyProxy(bp,NULL); - ctrl->setBroadphaseHandle(0); - } - } -} - -void CcdPhysicsEnvironment::beginFrame() -{ - -} - -void CcdPhysicsEnvironment::debugDrawWorld() -{ - if (m_dynamicsWorld->getDebugDrawer() && m_dynamicsWorld->getDebugDrawer()->getDebugMode() >0) - m_dynamicsWorld->debugDrawWorld(); -} - -bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep,float interval) -{ - std::set::iterator it; - int i; - - for (it=m_controllers.begin(); it!=m_controllers.end(); it++) - { - (*it)->SynchronizeMotionStates(timeStep); - } - - float subStep = timeStep / float(m_numTimeSubSteps); - i = m_dynamicsWorld->stepSimulation(interval,25,subStep);//perform always a full simulation step - processFhSprings(curTime,i*subStep); - - for (it=m_controllers.begin(); it!=m_controllers.end(); it++) - { - (*it)->SynchronizeMotionStates(timeStep); - } - - //for (it=m_controllers.begin(); it!=m_controllers.end(); it++) - //{ - // (*it)->SynchronizeMotionStates(timeStep); - //} - - for (i=0;iSyncWheels(); - } - - - CallbackTriggers(); - - return true; -} - -class ClosestRayResultCallbackNotMe : public btCollisionWorld::ClosestRayResultCallback -{ - btCollisionObject* m_owner; - btCollisionObject* m_parent; - -public: - ClosestRayResultCallbackNotMe(const btVector3& rayFromWorld,const btVector3& rayToWorld,btCollisionObject* owner,btCollisionObject* parent) - :btCollisionWorld::ClosestRayResultCallback(rayFromWorld,rayToWorld), - m_owner(owner), - m_parent(parent) - { - - } - - virtual bool needsCollision(btBroadphaseProxy* proxy0) const - { - //don't collide with self - if (proxy0->m_clientObject == m_owner) - return false; - - if (proxy0->m_clientObject == m_parent) - return false; - - return btCollisionWorld::ClosestRayResultCallback::needsCollision(proxy0); - } - -}; - -void CcdPhysicsEnvironment::processFhSprings(double curTime,float interval) -{ - std::set::iterator it; - // dynamic of Fh spring is based on a timestep of 1/60 - int numIter = (int)(interval*60.0001f); - - for (it=m_controllers.begin(); it!=m_controllers.end(); it++) - { - CcdPhysicsController* ctrl = (*it); - btRigidBody* body = ctrl->GetRigidBody(); - - if (body && (ctrl->getConstructionInfo().m_do_fh || ctrl->getConstructionInfo().m_do_rot_fh)) - { - //printf("has Fh or RotFh\n"); - //re-implement SM_FhObject.cpp using btCollisionWorld::rayTest and info from ctrl->getConstructionInfo() - //send a ray from {0.0, 0.0, 0.0} towards {0.0, 0.0, -10.0}, in local coordinates - CcdPhysicsController* parentCtrl = ctrl->getParentCtrl(); - btRigidBody* parentBody = parentCtrl?parentCtrl->GetRigidBody() : 0; - btRigidBody* cl_object = parentBody ? parentBody : body; - - if (body->isStaticOrKinematicObject()) - continue; - - btVector3 rayDirLocal(0,0,-10); - - //m_dynamicsWorld - //ctrl->GetRigidBody(); - btVector3 rayFromWorld = body->getCenterOfMassPosition(); - //btVector3 rayToWorld = rayFromWorld + body->getCenterOfMassTransform().getBasis() * rayDirLocal; - //ray always points down the z axis in world space... - btVector3 rayToWorld = rayFromWorld + rayDirLocal; - - ClosestRayResultCallbackNotMe resultCallback(rayFromWorld,rayToWorld,body,parentBody); - - m_dynamicsWorld->rayTest(rayFromWorld,rayToWorld,resultCallback); - if (resultCallback.hasHit()) - { - //we hit this one: resultCallback.m_collisionObject; - CcdPhysicsController* controller = static_cast(resultCallback.m_collisionObject->getUserPointer()); - - if (controller) - { - if (controller->getConstructionInfo().m_fh_distance < SIMD_EPSILON) - continue; - - btRigidBody* hit_object = controller->GetRigidBody(); - if (!hit_object) - continue; - - CcdConstructionInfo& hitObjShapeProps = controller->getConstructionInfo(); - - float distance = resultCallback.m_closestHitFraction*rayDirLocal.length()-ctrl->getConstructionInfo().m_radius; - if (distance >= hitObjShapeProps.m_fh_distance) - continue; - - - - //btVector3 ray_dir = cl_object->getCenterOfMassTransform().getBasis()* rayDirLocal.normalized(); - btVector3 ray_dir = rayDirLocal.normalized(); - btVector3 normal = resultCallback.m_hitNormalWorld; - normal.normalize(); - - for (int i=0; igetConstructionInfo().m_do_fh) - { - btVector3 lspot = cl_object->getCenterOfMassPosition() - + rayDirLocal * resultCallback.m_closestHitFraction; - - - - - lspot -= hit_object->getCenterOfMassPosition(); - btVector3 rel_vel = cl_object->getLinearVelocity() - hit_object->getVelocityInLocalPoint(lspot); - btScalar rel_vel_ray = ray_dir.dot(rel_vel); - btScalar spring_extent = 1.0 - distance / hitObjShapeProps.m_fh_distance; - - btScalar i_spring = spring_extent * hitObjShapeProps.m_fh_spring; - btScalar i_damp = rel_vel_ray * hitObjShapeProps.m_fh_damping; - - cl_object->setLinearVelocity(cl_object->getLinearVelocity() + (-(i_spring + i_damp) * ray_dir)); - if (hitObjShapeProps.m_fh_normal) - { - cl_object->setLinearVelocity(cl_object->getLinearVelocity()+(i_spring + i_damp) *(normal - normal.dot(ray_dir) * ray_dir)); - } - - btVector3 lateral = rel_vel - rel_vel_ray * ray_dir; - - - if (ctrl->getConstructionInfo().m_do_anisotropic) { - //Bullet basis contains no scaling/shear etc. - const btMatrix3x3& lcs = cl_object->getCenterOfMassTransform().getBasis(); - btVector3 loc_lateral = lateral * lcs; - const btVector3& friction_scaling = cl_object->getAnisotropicFriction(); - loc_lateral *= friction_scaling; - lateral = lcs * loc_lateral; - } - - btScalar rel_vel_lateral = lateral.length(); - - if (rel_vel_lateral > SIMD_EPSILON) { - btScalar friction_factor = hit_object->getFriction();//cl_object->getFriction(); - - btScalar max_friction = friction_factor * btMax(btScalar(0.0), i_spring); - - btScalar rel_mom_lateral = rel_vel_lateral / cl_object->getInvMass(); - - btVector3 friction = (rel_mom_lateral > max_friction) ? - -lateral * (max_friction / rel_vel_lateral) : - -lateral; - - cl_object->applyCentralImpulse(friction); - } - } - - - if (ctrl->getConstructionInfo().m_do_rot_fh) { - btVector3 up2 = cl_object->getWorldTransform().getBasis().getColumn(2); - - btVector3 t_spring = up2.cross(normal) * hitObjShapeProps.m_fh_spring; - btVector3 ang_vel = cl_object->getAngularVelocity(); - - // only rotations that tilt relative to the normal are damped - ang_vel -= ang_vel.dot(normal) * normal; - - btVector3 t_damp = ang_vel * hitObjShapeProps.m_fh_damping; - - cl_object->setAngularVelocity(cl_object->getAngularVelocity() + (t_spring - t_damp)); - } - } - } - } - } - } -} - -void CcdPhysicsEnvironment::setDebugMode(int debugMode) -{ - if (m_debugDrawer){ - m_debugDrawer->setDebugMode(debugMode); - } -} - -void CcdPhysicsEnvironment::setNumIterations(int numIter) -{ - m_numIterations = numIter; -} -void CcdPhysicsEnvironment::setDeactivationTime(float dTime) -{ - gDeactivationTime = dTime; -} -void CcdPhysicsEnvironment::setDeactivationLinearTreshold(float linTresh) -{ - gLinearSleepingTreshold = linTresh; -} -void CcdPhysicsEnvironment::setDeactivationAngularTreshold(float angTresh) -{ - gAngularSleepingTreshold = angTresh; -} - -void CcdPhysicsEnvironment::setContactBreakingTreshold(float contactBreakingTreshold) -{ - gContactBreakingThreshold = contactBreakingTreshold; - -} - - -void CcdPhysicsEnvironment::setCcdMode(int ccdMode) -{ - m_ccdMode = ccdMode; -} - - -void CcdPhysicsEnvironment::setSolverSorConstant(float sor) -{ - m_solverInfo.m_sor = sor; -} - -void CcdPhysicsEnvironment::setSolverTau(float tau) -{ - m_solverInfo.m_tau = tau; -} -void CcdPhysicsEnvironment::setSolverDamping(float damping) -{ - m_solverInfo.m_damping = damping; -} - - -void CcdPhysicsEnvironment::setLinearAirDamping(float damping) -{ - //gLinearAirDamping = damping; -} - -void CcdPhysicsEnvironment::setUseEpa(bool epa) -{ - //gUseEpa = epa; -} - -void CcdPhysicsEnvironment::setSolverType(int solverType) -{ - - switch (solverType) - { - case 1: - { - if (m_solverType != solverType) - { - - m_solver = new btSequentialImpulseConstraintSolver(); - - - break; - } - } - - case 0: - default: - if (m_solverType != solverType) - { -// m_solver = new OdeConstraintSolver(); - - break; - } - - }; - - m_solverType = solverType ; -} - - - -void CcdPhysicsEnvironment::getGravity(PHY__Vector3& grav) -{ - const btVector3& gravity = m_dynamicsWorld->getGravity(); - grav[0] = gravity.getX(); - grav[1] = gravity.getY(); - grav[2] = gravity.getZ(); -} - - -void CcdPhysicsEnvironment::setGravity(float x,float y,float z) -{ - m_gravity = btVector3(x,y,z); - m_dynamicsWorld->setGravity(m_gravity); - m_dynamicsWorld->getWorldInfo().m_gravity.setValue(x,y,z); -} - - - - -static int gConstraintUid = 1; - -//Following the COLLADA physics specification for constraints -int CcdPhysicsEnvironment::createUniversalD6Constraint( - class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther, - btTransform& frameInA, - btTransform& frameInB, - const btVector3& linearMinLimits, - const btVector3& linearMaxLimits, - const btVector3& angularMinLimits, - const btVector3& angularMaxLimits,int flags -) -{ - - bool disableCollisionBetweenLinkedBodies = (0!=(flags & CCD_CONSTRAINT_DISABLE_LINKED_COLLISION)); - - //we could either add some logic to recognize ball-socket and hinge, or let that up to the user - //perhaps some warning or hint that hinge/ball-socket is more efficient? - - - btGeneric6DofConstraint* genericConstraint = 0; - CcdPhysicsController* ctrl0 = (CcdPhysicsController*) ctrlRef; - CcdPhysicsController* ctrl1 = (CcdPhysicsController*) ctrlOther; - - btRigidBody* rb0 = ctrl0->GetRigidBody(); - btRigidBody* rb1 = ctrl1->GetRigidBody(); - - if (rb1) - { - - - bool useReferenceFrameA = true; - genericConstraint = new btGeneric6DofSpringConstraint( - *rb0,*rb1, - frameInA,frameInB,useReferenceFrameA); - genericConstraint->setLinearLowerLimit(linearMinLimits); - genericConstraint->setLinearUpperLimit(linearMaxLimits); - genericConstraint->setAngularLowerLimit(angularMinLimits); - genericConstraint->setAngularUpperLimit(angularMaxLimits); - } else - { - // TODO: Implement single body case... - //No, we can use a fixed rigidbody in above code, rather then unnecessary duplation of code - - } - - if (genericConstraint) - { - // m_constraints.push_back(genericConstraint); - m_dynamicsWorld->addConstraint(genericConstraint,disableCollisionBetweenLinkedBodies); - - genericConstraint->setUserConstraintId(gConstraintUid++); - genericConstraint->setUserConstraintType(PHY_GENERIC_6DOF_CONSTRAINT); - //64 bit systems can't cast pointer to int. could use size_t instead. - return genericConstraint->getUserConstraintId(); - } - return 0; -} - - - -void CcdPhysicsEnvironment::removeConstraint(int constraintId) -{ - - int i; - int numConstraints = m_dynamicsWorld->getNumConstraints(); - for (i=0;igetConstraint(i); - if (constraint->getUserConstraintId() == constraintId) - { - constraint->getRigidBodyA().activate(); - constraint->getRigidBodyB().activate(); - m_dynamicsWorld->removeConstraint(constraint); - break; - } - } -} - - -struct FilterClosestRayResultCallback : public btCollisionWorld::ClosestRayResultCallback -{ - PHY_IRayCastFilterCallback& m_phyRayFilter; - const btCollisionShape* m_hitTriangleShape; - int m_hitTriangleIndex; - - - FilterClosestRayResultCallback (PHY_IRayCastFilterCallback& phyRayFilter,const btVector3& rayFrom,const btVector3& rayTo) - : btCollisionWorld::ClosestRayResultCallback(rayFrom,rayTo), - m_phyRayFilter(phyRayFilter), - m_hitTriangleShape(NULL), - m_hitTriangleIndex(0) - { - } - - virtual ~FilterClosestRayResultCallback() - { - } - - virtual bool needsCollision(btBroadphaseProxy* proxy0) const - { - if (!(proxy0->m_collisionFilterGroup & m_collisionFilterMask)) - return false; - if (!(m_collisionFilterGroup & proxy0->m_collisionFilterMask)) - return false; - btCollisionObject* object = (btCollisionObject*)proxy0->m_clientObject; - CcdPhysicsController* phyCtrl = static_cast(object->getUserPointer()); - if (phyCtrl == m_phyRayFilter.m_ignoreController) - return false; - return m_phyRayFilter.needBroadphaseRayCast(phyCtrl); - } - - virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace) - { - //CcdPhysicsController* curHit = static_cast(rayResult.m_collisionObject->getUserPointer()); - // save shape information as ClosestRayResultCallback::AddSingleResult() does not do it - if (rayResult.m_localShapeInfo) - { - m_hitTriangleShape = rayResult.m_collisionObject->getCollisionShape(); - m_hitTriangleIndex = rayResult.m_localShapeInfo->m_triangleIndex; - } else - { - m_hitTriangleShape = NULL; - m_hitTriangleIndex = 0; - } - return ClosestRayResultCallback::addSingleResult(rayResult,normalInWorldSpace); - } - -}; - -static bool GetHitTriangle(btCollisionShape* shape, CcdShapeConstructionInfo* shapeInfo, int hitTriangleIndex, btVector3 triangle[]) -{ - // this code is copied from Bullet - const unsigned char *vertexbase; - int numverts; - PHY_ScalarType type; - int stride; - const unsigned char *indexbase; - int indexstride; - int numfaces; - PHY_ScalarType indicestype; - btStridingMeshInterface* meshInterface = NULL; - btTriangleMeshShape* triangleShape = shapeInfo->GetMeshShape(); - - if (triangleShape) - meshInterface = triangleShape->getMeshInterface(); - else - { - // other possibility is gImpact - if (shape->getShapeType() == GIMPACT_SHAPE_PROXYTYPE) - meshInterface = (static_cast(shape))->getMeshInterface(); - } - if (!meshInterface) - return false; - - meshInterface->getLockedReadOnlyVertexIndexBase( - &vertexbase, - numverts, - type, - stride, - &indexbase, - indexstride, - numfaces, - indicestype, - 0); - - unsigned int* gfxbase = (unsigned int*)(indexbase+hitTriangleIndex*indexstride); - const btVector3& meshScaling = shape->getLocalScaling(); - for (int j=2;j>=0;j--) - { - int graphicsindex = indicestype==PHY_SHORT?((unsigned short*)gfxbase)[j]:gfxbase[j]; - - btScalar* graphicsbase = (btScalar*)(vertexbase+graphicsindex*stride); - - triangle[j] = btVector3(graphicsbase[0]*meshScaling.getX(),graphicsbase[1]*meshScaling.getY(),graphicsbase[2]*meshScaling.getZ()); - } - meshInterface->unLockReadOnlyVertexBase(0); - return true; -} - -PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ) -{ - btVector3 rayFrom(fromX,fromY,fromZ); - btVector3 rayTo(toX,toY,toZ); - - btVector3 hitPointWorld,normalWorld; - - //Either Ray Cast with or without filtering - - //btCollisionWorld::ClosestRayResultCallback rayCallback(rayFrom,rayTo); - FilterClosestRayResultCallback rayCallback(filterCallback,rayFrom,rayTo); - - - PHY_RayCastResult result; - memset(&result, 0, sizeof(result)); - - // don't collision with sensor object - rayCallback.m_collisionFilterMask = CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::SensorFilter; - //, ,filterCallback.m_faceNormal); - - m_dynamicsWorld->rayTest(rayFrom,rayTo,rayCallback); - if (rayCallback.hasHit()) - { - CcdPhysicsController* controller = static_cast(rayCallback.m_collisionObject->getUserPointer()); - result.m_controller = controller; - result.m_hitPoint[0] = rayCallback.m_hitPointWorld.getX(); - result.m_hitPoint[1] = rayCallback.m_hitPointWorld.getY(); - result.m_hitPoint[2] = rayCallback.m_hitPointWorld.getZ(); - - if (rayCallback.m_hitTriangleShape != NULL) - { - // identify the mesh polygon - CcdShapeConstructionInfo* shapeInfo = controller->m_shapeInfo; - if (shapeInfo) - { - btCollisionShape* shape = controller->GetCollisionObject()->getCollisionShape(); - if (shape->isCompound()) - { - btCompoundShape* compoundShape = (btCompoundShape*)shape; - CcdShapeConstructionInfo* compoundShapeInfo = shapeInfo; - // need to search which sub-shape has been hit - for (int i=0; igetNumChildShapes(); i++) - { - shapeInfo = compoundShapeInfo->GetChildShape(i); - shape=compoundShape->getChildShape(i); - if (shape == rayCallback.m_hitTriangleShape) - break; - } - } - if (shape == rayCallback.m_hitTriangleShape && - rayCallback.m_hitTriangleIndex < shapeInfo->m_polygonIndexArray.size()) - { - // save original collision shape triangle for soft body - int hitTriangleIndex = rayCallback.m_hitTriangleIndex; - - result.m_meshObject = shapeInfo->GetMesh(); - if (shape->isSoftBody()) - { - // soft body using different face numbering because of randomization - // hopefully we have stored the original face number in m_tag - btSoftBody* softBody = static_cast(rayCallback.m_collisionObject); - if (softBody->m_faces[hitTriangleIndex].m_tag != 0) - { - rayCallback.m_hitTriangleIndex = (int)((uintptr_t)(softBody->m_faces[hitTriangleIndex].m_tag)-1); - } - } - // retrieve the original mesh polygon (in case of quad->tri conversion) - result.m_polygon = shapeInfo->m_polygonIndexArray.at(rayCallback.m_hitTriangleIndex); - // hit triangle in world coordinate, for face normal and UV coordinate - btVector3 triangle[3]; - bool triangleOK = false; - if (filterCallback.m_faceUV && (3*rayCallback.m_hitTriangleIndex) < shapeInfo->m_triFaceUVcoArray.size()) - { - // interpolate the UV coordinate of the hit point - CcdShapeConstructionInfo::UVco* uvCo = &shapeInfo->m_triFaceUVcoArray[3*rayCallback.m_hitTriangleIndex]; - // 1. get the 3 coordinate of the triangle in world space - btVector3 v1, v2, v3; - if (shape->isSoftBody()) - { - // soft body give points directly in world coordinate - btSoftBody* softBody = static_cast(rayCallback.m_collisionObject); - v1 = softBody->m_faces[hitTriangleIndex].m_n[0]->m_x; - v2 = softBody->m_faces[hitTriangleIndex].m_n[1]->m_x; - v3 = softBody->m_faces[hitTriangleIndex].m_n[2]->m_x; - } else - { - // for rigid body we must apply the world transform - triangleOK = GetHitTriangle(shape, shapeInfo, hitTriangleIndex, triangle); - if (!triangleOK) - // if we cannot get the triangle, no use to continue - goto SKIP_UV_NORMAL; - v1 = rayCallback.m_collisionObject->getWorldTransform()(triangle[0]); - v2 = rayCallback.m_collisionObject->getWorldTransform()(triangle[1]); - v3 = rayCallback.m_collisionObject->getWorldTransform()(triangle[2]); - } - // 2. compute barycentric coordinate of the hit point - btVector3 v = v2-v1; - btVector3 w = v3-v1; - btVector3 u = v.cross(w); - btScalar A = u.length(); - - v = v2-rayCallback.m_hitPointWorld; - w = v3-rayCallback.m_hitPointWorld; - u = v.cross(w); - btScalar A1 = u.length(); - - v = rayCallback.m_hitPointWorld-v1; - w = v3-v1; - u = v.cross(w); - btScalar A2 = u.length(); - - btVector3 baryCo; - baryCo.setX(A1/A); - baryCo.setY(A2/A); - baryCo.setZ(1.0f-baryCo.getX()-baryCo.getY()); - // 3. compute UV coordinate - result.m_hitUV[0] = baryCo.getX()*uvCo[0].uv[0] + baryCo.getY()*uvCo[1].uv[0] + baryCo.getZ()*uvCo[2].uv[0]; - result.m_hitUV[1] = baryCo.getX()*uvCo[0].uv[1] + baryCo.getY()*uvCo[1].uv[1] + baryCo.getZ()*uvCo[2].uv[1]; - result.m_hitUVOK = 1; - } - - // Bullet returns the normal from "outside". - // If the user requests the real normal, compute it now - if (filterCallback.m_faceNormal) - { - if (shape->isSoftBody()) - { - // we can get the real normal directly from the body - btSoftBody* softBody = static_cast(rayCallback.m_collisionObject); - rayCallback.m_hitNormalWorld = softBody->m_faces[hitTriangleIndex].m_normal; - } else - { - if (!triangleOK) - triangleOK = GetHitTriangle(shape, shapeInfo, hitTriangleIndex, triangle); - if (triangleOK) - { - btVector3 triangleNormal; - triangleNormal = (triangle[1]-triangle[0]).cross(triangle[2]-triangle[0]); - rayCallback.m_hitNormalWorld = rayCallback.m_collisionObject->getWorldTransform().getBasis()*triangleNormal; - } - } - } - SKIP_UV_NORMAL: - ; - } - } - } - if (rayCallback.m_hitNormalWorld.length2() > (SIMD_EPSILON*SIMD_EPSILON)) - { - rayCallback.m_hitNormalWorld.normalize(); - } else - { - rayCallback.m_hitNormalWorld.setValue(1,0,0); - } - result.m_hitNormal[0] = rayCallback.m_hitNormalWorld.getX(); - result.m_hitNormal[1] = rayCallback.m_hitNormalWorld.getY(); - result.m_hitNormal[2] = rayCallback.m_hitNormalWorld.getZ(); - filterCallback.reportHit(&result); - } - - - return result.m_controller; -} - -// Handles occlusion culling. -// The implementation is based on the CDTestFramework -struct OcclusionBuffer -{ - struct WriteOCL - { - static inline bool Process(btScalar& q,btScalar v) { if(q - void CMmat4mul(btScalar* m, const T1* m1, const T2* m2) - { - m[ 0] = btScalar(m1[ 0]*m2[ 0]+m1[ 4]*m2[ 1]+m1[ 8]*m2[ 2]+m1[12]*m2[ 3]); - m[ 1] = btScalar(m1[ 1]*m2[ 0]+m1[ 5]*m2[ 1]+m1[ 9]*m2[ 2]+m1[13]*m2[ 3]); - m[ 2] = btScalar(m1[ 2]*m2[ 0]+m1[ 6]*m2[ 1]+m1[10]*m2[ 2]+m1[14]*m2[ 3]); - m[ 3] = btScalar(m1[ 3]*m2[ 0]+m1[ 7]*m2[ 1]+m1[11]*m2[ 2]+m1[15]*m2[ 3]); - - m[ 4] = btScalar(m1[ 0]*m2[ 4]+m1[ 4]*m2[ 5]+m1[ 8]*m2[ 6]+m1[12]*m2[ 7]); - m[ 5] = btScalar(m1[ 1]*m2[ 4]+m1[ 5]*m2[ 5]+m1[ 9]*m2[ 6]+m1[13]*m2[ 7]); - m[ 6] = btScalar(m1[ 2]*m2[ 4]+m1[ 6]*m2[ 5]+m1[10]*m2[ 6]+m1[14]*m2[ 7]); - m[ 7] = btScalar(m1[ 3]*m2[ 4]+m1[ 7]*m2[ 5]+m1[11]*m2[ 6]+m1[15]*m2[ 7]); - - m[ 8] = btScalar(m1[ 0]*m2[ 8]+m1[ 4]*m2[ 9]+m1[ 8]*m2[10]+m1[12]*m2[11]); - m[ 9] = btScalar(m1[ 1]*m2[ 8]+m1[ 5]*m2[ 9]+m1[ 9]*m2[10]+m1[13]*m2[11]); - m[10] = btScalar(m1[ 2]*m2[ 8]+m1[ 6]*m2[ 9]+m1[10]*m2[10]+m1[14]*m2[11]); - m[11] = btScalar(m1[ 3]*m2[ 8]+m1[ 7]*m2[ 9]+m1[11]*m2[10]+m1[15]*m2[11]); - - m[12] = btScalar(m1[ 0]*m2[12]+m1[ 4]*m2[13]+m1[ 8]*m2[14]+m1[12]*m2[15]); - m[13] = btScalar(m1[ 1]*m2[12]+m1[ 5]*m2[13]+m1[ 9]*m2[14]+m1[13]*m2[15]); - m[14] = btScalar(m1[ 2]*m2[12]+m1[ 6]*m2[13]+m1[10]*m2[14]+m1[14]*m2[15]); - m[15] = btScalar(m1[ 3]*m2[12]+m1[ 7]*m2[13]+m1[11]*m2[14]+m1[15]*m2[15]); - } - void setup(int size) - { - m_initialized=false; - m_occlusion=false; - // compute the size of the buffer - GLint v[4]; - GLdouble m[16],p[16]; - int maxsize; - double ratio; - glGetIntegerv(GL_VIEWPORT,v); - maxsize = (v[2] > v[3]) ? v[2] : v[3]; - assert(maxsize > 0); - ratio = 1.0/(2*maxsize); - // ensure even number - m_sizes[0] = 2*((int)(size*v[2]*ratio+0.5)); - m_sizes[1] = 2*((int)(size*v[3]*ratio+0.5)); - m_scales[0]=btScalar(m_sizes[0]/2); - m_scales[1]=btScalar(m_sizes[1]/2); - m_offsets[0]=m_scales[0]+0.5f; - m_offsets[1]=m_scales[1]+0.5f; - // prepare matrix - // at this time of the rendering, the modelview matrix is the - // world to camera transformation and the projection matrix is - // camera to clip transformation. combine both so that - glGetDoublev(GL_MODELVIEW_MATRIX,m); - glGetDoublev(GL_PROJECTION_MATRIX,p); - CMmat4mul(m_wtc,p,m); - } - void initialize() - { - size_t newsize = (m_sizes[0]*m_sizes[1])*sizeof(btScalar); - if (m_buffer) - { - // see if we can reuse - if (newsize > m_bufferSize) - { - free(m_buffer); - m_buffer = NULL; - m_bufferSize = 0; - } - } - if (!m_buffer) - { - m_buffer = (btScalar*)calloc(1, newsize); - m_bufferSize = newsize; - } else - { - // buffer exists already, just clears it - memset(m_buffer, 0, newsize); - } - // memory allocate must succeed - assert(m_buffer != NULL); - m_initialized = true; - m_occlusion = false; - } - void SetModelMatrix(double *fl) - { - CMmat4mul(m_mtc,m_wtc,fl); - if (!m_initialized) - initialize(); - } - - // transform a segment in world coordinate to clip coordinate - void transformW(const btVector3& x, btVector4& t) - { - t[0] = x[0]*m_wtc[0]+x[1]*m_wtc[4]+x[2]*m_wtc[8]+m_wtc[12]; - t[1] = x[0]*m_wtc[1]+x[1]*m_wtc[5]+x[2]*m_wtc[9]+m_wtc[13]; - t[2] = x[0]*m_wtc[2]+x[1]*m_wtc[6]+x[2]*m_wtc[10]+m_wtc[14]; - t[3] = x[0]*m_wtc[3]+x[1]*m_wtc[7]+x[2]*m_wtc[11]+m_wtc[15]; - } - void transformM(const float* x, btVector4& t) - { - t[0] = x[0]*m_mtc[0]+x[1]*m_mtc[4]+x[2]*m_mtc[8]+m_mtc[12]; - t[1] = x[0]*m_mtc[1]+x[1]*m_mtc[5]+x[2]*m_mtc[9]+m_mtc[13]; - t[2] = x[0]*m_mtc[2]+x[1]*m_mtc[6]+x[2]*m_mtc[10]+m_mtc[14]; - t[3] = x[0]*m_mtc[3]+x[1]*m_mtc[7]+x[2]*m_mtc[11]+m_mtc[15]; - } - // convert polygon to device coordinates - static bool project(btVector4* p,int n) - { - for(int i=0;i - static int clip(const btVector4* pi,btVector4* po) - { - btScalar s[2*NP]; - btVector4 pn[2*NP]; - int i, j, m, n, ni; - // deal with near clipping - for(i=0, m=0;i0)&&(t<1)) - { - pn[n][0] = a[0]+(b[0]-a[0])*t; - pn[n][1] = a[1]+(b[1]-a[1])*t; - pn[n][2] = a[2]+(b[2]-a[2])*t; - pn[n][3] = a[3]+(b[3]-a[3])*t; - ++n; - } - if(s[j]>0) pn[n++]=b; - } - // ready to test far clipping, start from the modified polygon - pi = pn; - ni = n; - } else - { - // no clipping on the near plane, keep same vector - ni = NP; - } - // now deal with far clipping - for(i=0, m=0;i0) m+=1<0)&&(t<1)) - { - po[n][0] = a[0]+(b[0]-a[0])*t; - po[n][1] = a[1]+(b[1]-a[1])*t; - po[n][2] = a[2]+(b[2]-a[2])*t; - po[n][3] = a[3]+(b[3]-a[3])*t; - ++n; - } - if(s[j]<0) po[n++]=b; - } - return(n); - } - for(int i=0;i - inline bool draw( const btVector4& a, - const btVector4& b, - const btVector4& c, - const float face, - const btScalar minarea) - { - const btScalar a2=cross(b-a,c-a)[2]; - if((face*a2)<0.f || btFabs(a2) must - // change the order of b and c otherwise the algorithm doesn't work - ib=2; - ic=1; - } - x[ib]=(int)(b.x()*m_scales[0]+m_offsets[0]); - x[ic]=(int)(c.x()*m_scales[0]+m_offsets[0]); - y[ib]=(int)(b.y()*m_scales[1]+m_offsets[1]); - y[ic]=(int)(c.y()*m_scales[1]+m_offsets[1]); - z[ib]=b.z(); - z[ic]=c.z(); - const int mix=btMax(0,btMin(x[0],btMin(x[1],x[2]))); - const int mxx=btMin(m_sizes[0],1+btMax(x[0],btMax(x[1],x[2]))); - const int miy=btMax(0,btMin(y[0],btMin(y[1],y[2]))); - const int mxy=btMin(m_sizes[1],1+btMax(y[0],btMax(y[1],y[2]))); - const int width=mxx-mix; - const int height=mxy-miy; - if ((width*height) <= 1) - { - // degenerated in at most one single pixel - btScalar* scan=&m_buffer[miy*m_sizes[0]+mix]; - // use for loop to detect the case where width or height == 0 - for(int iy=miy;iy y[1]) { ytmp=y[1];y[1]=y[0];y[0]=ytmp;ztmp=z[1];z[1]=z[0];z[0]=ztmp; } - if (y[0] > y[2]) { ytmp=y[2];y[2]=y[0];y[0]=ytmp;ztmp=z[2];z[2]=z[0];z[0]=ztmp; } - if (y[1] > y[2]) { ytmp=y[2];y[2]=y[1];y[1]=ytmp;ztmp=z[2];z[2]=z[1];z[1]=ztmp; } - int dy[]={ y[0]-y[1], - y[1]-y[2], - y[2]-y[0]}; - btScalar dzy[3]; - dzy[0] = (dy[0]) ? (z[0]-z[1])/dy[0] : btScalar(0.f); - dzy[1] = (dy[1]) ? (z[1]-z[2])/dy[1] : btScalar(0.f); - dzy[2] = (dy[2]) ? (z[2]-z[0])/dy[2] : btScalar(0.f); - btScalar v[3] = { dzy[0]*(miy-y[0])+z[0], - dzy[1]*(miy-y[1])+z[1], - dzy[2]*(miy-y[2])+z[2] }; - dy[0] = y[1]-y[0]; - dy[1] = y[0]-y[1]; - dy[2] = y[2]-y[0]; - btScalar* scan=&m_buffer[miy*m_sizes[0]+mix]; - for(int iy=miy;iy= 0 && POLICY::Process(*scan,v[0])) - return(true); - if(dy[1] >= 0 && POLICY::Process(*scan,v[1])) - return(true); - if(dy[2] >= 0 && POLICY::Process(*scan,v[2])) - return(true); - scan+=m_sizes[0]; - v[0] += dzy[0]; v[1] += dzy[1]; v[2] += dzy[2]; - dy[0]--; dy[1]++, dy[2]--; - } - } else if (height == 1) - { - // Degenerated in at least 2 horizontal lines - // The algorithm below doesn't work when face has a single pixel width - // We cannot use general formulas because the plane is degenerated. - // We have to interpolate along the 3 edges that overlaps and process each pixel. - int xtmp; - btScalar ztmp; - if (x[0] > x[1]) { xtmp=x[1];x[1]=x[0];x[0]=xtmp;ztmp=z[1];z[1]=z[0];z[0]=ztmp; } - if (x[0] > x[2]) { xtmp=x[2];x[2]=x[0];x[0]=xtmp;ztmp=z[2];z[2]=z[0];z[0]=ztmp; } - if (x[1] > x[2]) { xtmp=x[2];x[2]=x[1];x[1]=xtmp;ztmp=z[2];z[2]=z[1];z[1]=ztmp; } - int dx[]={ x[0]-x[1], - x[1]-x[2], - x[2]-x[0]}; - btScalar dzx[3]; - dzx[0] = (dx[0]) ? (z[0]-z[1])/dx[0] : btScalar(0.f); - dzx[1] = (dx[1]) ? (z[1]-z[2])/dx[1] : btScalar(0.f); - dzx[2] = (dx[2]) ? (z[2]-z[0])/dx[2] : btScalar(0.f); - btScalar v[3] = { dzx[0]*(mix-x[0])+z[0], - dzx[1]*(mix-x[1])+z[1], - dzx[2]*(mix-x[2])+z[2] }; - dx[0] = x[1]-x[0]; - dx[1] = x[0]-x[1]; - dx[2] = x[2]-x[0]; - btScalar* scan=&m_buffer[miy*m_sizes[0]+mix]; - for(int ix=mix;ix= 0 && POLICY::Process(*scan,v[0])) - return(true); - if(dx[1] >= 0 && POLICY::Process(*scan,v[1])) - return(true); - if(dx[2] >= 0 && POLICY::Process(*scan,v[2])) - return(true); - scan++; - v[0] += dzx[0]; v[1] += dzx[1]; v[2] += dzx[2]; - dx[0]--; dx[1]++, dx[2]--; - } - } else - { - // general case - const int dx[]={ y[0]-y[1], - y[1]-y[2], - y[2]-y[0]}; - const int dy[]={ x[1]-x[0]-dx[0]*width, - x[2]-x[1]-dx[1]*width, - x[0]-x[2]-dx[2]*width}; - const int a=x[2]*y[0]+x[0]*y[1]-x[2]*y[1]-x[0]*y[2]+x[1]*y[2]-x[1]*y[0]; - const btScalar ia=1/(btScalar)a; - const btScalar dzx=ia*(y[2]*(z[1]-z[0])+y[1]*(z[0]-z[2])+y[0]*(z[2]-z[1])); - const btScalar dzy=ia*(x[2]*(z[0]-z[1])+x[0]*(z[1]-z[2])+x[1]*(z[2]-z[0]))-(dzx*width); - int c[]={ miy*x[1]+mix*y[0]-x[1]*y[0]-mix*y[1]+x[0]*y[1]-miy*x[0], - miy*x[2]+mix*y[1]-x[2]*y[1]-mix*y[2]+x[1]*y[2]-miy*x[1], - miy*x[0]+mix*y[2]-x[0]*y[2]-mix*y[0]+x[2]*y[0]-miy*x[2]}; - btScalar v=ia*((z[2]*c[0])+(z[0]*c[1])+(z[1]*c[2])); - btScalar* scan=&m_buffer[miy*m_sizes[0]]; - for(int iy=miy;iy=0)&&(c[1]>=0)&&(c[2]>=0)) - { - if(POLICY::Process(scan[ix],v)) - return(true); - } - c[0]+=dx[0];c[1]+=dx[1];c[2]+=dx[2];v+=dzx; - } - c[0]+=dy[0];c[1]+=dy[1];c[2]+=dy[2];v+=dzy; - scan+=m_sizes[0]; - } - } - return(false); - } - // clip than write or check a polygon - template - inline bool clipDraw( const btVector4* p, - const float face, - btScalar minarea) - { - btVector4 o[NP*2]; - int n=clip(p,o); - bool earlyexit=false; - if (n) - { - project(o,n); - for(int i=2;i(o[0],o[i-1],o[i],face,minarea); - } - } - return(earlyexit); - } - // add a triangle (in model coordinate) - // face = 0.f if face is double side, - // = 1.f if face is single sided and scale is positive - // = -1.f if face is single sided and scale is negative - void appendOccluderM(const float* a, - const float* b, - const float* c, - const float face) - { - btVector4 p[3]; - transformM(a,p[0]); - transformM(b,p[1]); - transformM(c,p[2]); - clipDraw<3,WriteOCL>(p,face,btScalar(0.f)); - } - // add a quad (in model coordinate) - void appendOccluderM(const float* a, - const float* b, - const float* c, - const float* d, - const float face) - { - btVector4 p[4]; - transformM(a,p[0]); - transformM(b,p[1]); - transformM(c,p[2]); - transformM(d,p[3]); - clipDraw<4,WriteOCL>(p,face,btScalar(0.f)); - } - // query occluder for a box (c=center, e=extend) in world coordinate - inline bool queryOccluderW( const btVector3& c, - const btVector3& e) - { - if (!m_occlusion) - // no occlusion yet, no need to check - return true; - btVector4 x[8]; - transformW(btVector3(c[0]-e[0],c[1]-e[1],c[2]-e[2]),x[0]); - transformW(btVector3(c[0]+e[0],c[1]-e[1],c[2]-e[2]),x[1]); - transformW(btVector3(c[0]+e[0],c[1]+e[1],c[2]-e[2]),x[2]); - transformW(btVector3(c[0]-e[0],c[1]+e[1],c[2]-e[2]),x[3]); - transformW(btVector3(c[0]-e[0],c[1]-e[1],c[2]+e[2]),x[4]); - transformW(btVector3(c[0]+e[0],c[1]-e[1],c[2]+e[2]),x[5]); - transformW(btVector3(c[0]+e[0],c[1]+e[1],c[2]+e[2]),x[6]); - transformW(btVector3(c[0]-e[0],c[1]+e[1],c[2]+e[2]),x[7]); - for(int i=0;i<8;++i) - { - // the box is clipped, it's probably a large box, don't waste our time to check - if((x[i][2]+x[i][3])<=0) return(true); - } - static const int d[]={ 1,0,3,2, - 4,5,6,7, - 4,7,3,0, - 6,5,1,2, - 7,6,2,3, - 5,4,0,1}; - for(unsigned int i=0;i<(sizeof(d)/sizeof(d[0]));) - { - const btVector4 p[]={ x[d[i++]], - x[d[i++]], - x[d[i++]], - x[d[i++]]}; - if(clipDraw<4,QueryOCL>(p,1.f,0.f)) - return(true); - } - return(false); - } -}; - - -struct DbvtCullingCallback : btDbvt::ICollide -{ - PHY_CullingCallback m_clientCallback; - void* m_userData; - OcclusionBuffer *m_ocb; - - DbvtCullingCallback(PHY_CullingCallback clientCallback, void* userData) - { - m_clientCallback = clientCallback; - m_userData = userData; - m_ocb = NULL; - } - bool Descent(const btDbvtNode* node) - { - return(m_ocb->queryOccluderW(node->volume.Center(),node->volume.Extents())); - } - void Process(const btDbvtNode* node,btScalar depth) - { - Process(node); - } - void Process(const btDbvtNode* leaf) - { - btBroadphaseProxy* proxy=(btBroadphaseProxy*)leaf->data; - // the client object is a graphic controller - CcdGraphicController* ctrl = static_cast(proxy->m_clientObject); - KX_ClientObjectInfo* info = (KX_ClientObjectInfo*)ctrl->getNewClientInfo(); - if (m_ocb) - { - // means we are doing occlusion culling. Check if this object is an occluders - KX_GameObject* gameobj = KX_GameObject::GetClientObject(info); - if (gameobj && gameobj->GetOccluder()) - { - double* fl = gameobj->GetOpenGLMatrixPtr()->getPointer(); - // this will create the occlusion buffer if not already done - // and compute the transformation from model local space to clip space - m_ocb->SetModelMatrix(fl); - float face = (gameobj->IsNegativeScaling()) ? -1.0f : 1.0f; - // walk through the meshes and for each add to buffer - for (int i=0; iGetMeshCount(); i++) - { - RAS_MeshObject* meshobj = gameobj->GetMesh(i); - const float *v1, *v2, *v3, *v4; - - int polycount = meshobj->NumPolygons(); - for (int j=0; jGetPolygon(j); - switch (poly->VertexCount()) - { - case 3: - v1 = poly->GetVertex(0)->getXYZ(); - v2 = poly->GetVertex(1)->getXYZ(); - v3 = poly->GetVertex(2)->getXYZ(); - m_ocb->appendOccluderM(v1,v2,v3,((poly->IsTwoside())?0.f:face)); - break; - case 4: - v1 = poly->GetVertex(0)->getXYZ(); - v2 = poly->GetVertex(1)->getXYZ(); - v3 = poly->GetVertex(2)->getXYZ(); - v4 = poly->GetVertex(3)->getXYZ(); - m_ocb->appendOccluderM(v1,v2,v3,v4,((poly->IsTwoside())?0.f:face)); - break; - } - } - } - } - } - if (info) - (*m_clientCallback)(info, m_userData); - } -}; - -static OcclusionBuffer gOcb; -bool CcdPhysicsEnvironment::cullingTest(PHY_CullingCallback callback, void* userData, PHY__Vector4 *planes, int nplanes, int occlusionRes) -{ - if (!m_cullingTree) - return false; - DbvtCullingCallback dispatcher(callback, userData); - btVector3 planes_n[6]; - btScalar planes_o[6]; - if (nplanes > 6) - nplanes = 6; - for (int i=0; i occlusion culling - if (occlusionRes) - { - gOcb.setup(occlusionRes); - dispatcher.m_ocb = &gOcb; - // occlusion culling, the direction of the view is taken from the first plan which MUST be the near plane - btDbvt::collideOCL(m_cullingTree->m_sets[1].m_root,planes_n,planes_o,planes_n[0],nplanes,dispatcher); - btDbvt::collideOCL(m_cullingTree->m_sets[0].m_root,planes_n,planes_o,planes_n[0],nplanes,dispatcher); - }else - { - btDbvt::collideKDOP(m_cullingTree->m_sets[1].m_root,planes_n,planes_o,nplanes,dispatcher); - btDbvt::collideKDOP(m_cullingTree->m_sets[0].m_root,planes_n,planes_o,nplanes,dispatcher); - } - return true; -} - -int CcdPhysicsEnvironment::getNumContactPoints() -{ - return 0; -} - -void CcdPhysicsEnvironment::getContactPoint(int i,float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ) -{ - -} - - - - -btBroadphaseInterface* CcdPhysicsEnvironment::getBroadphase() -{ - return m_dynamicsWorld->getBroadphase(); -} - -btDispatcher* CcdPhysicsEnvironment::getDispatcher() -{ - return m_dynamicsWorld->getDispatcher(); -} - -void CcdPhysicsEnvironment::MergeEnvironment(CcdPhysicsEnvironment *other) -{ - std::set::iterator it; - - while (other->m_controllers.begin() != other->m_controllers.end()) - { - it= other->m_controllers.begin(); - CcdPhysicsController* ctrl= (*it); - - other->removeCcdPhysicsController(ctrl); - this->addCcdPhysicsController(ctrl); - } -} - -CcdPhysicsEnvironment::~CcdPhysicsEnvironment() -{ - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - m_wrapperVehicles.clear(); -#endif //NEW_BULLET_VEHICLE_SUPPORT - - //m_broadphase->DestroyScene(); - //delete broadphase ? release reference on broadphase ? - - //first delete scene, then dispatcher, because pairs have to release manifolds on the dispatcher - //delete m_dispatcher; - delete m_dynamicsWorld; - - - if (NULL != m_ownPairCache) - delete m_ownPairCache; - - if (NULL != m_ownDispatcher) - delete m_ownDispatcher; - - if (NULL != m_solver) - delete m_solver; - - if (NULL != m_debugDrawer) - delete m_debugDrawer; - - if (NULL != m_filterCallback) - delete m_filterCallback; - - if (NULL != m_collisionConfiguration) - delete m_collisionConfiguration; - - if (NULL != m_broadphase) - delete m_broadphase; - - if (NULL != m_cullingTree) - delete m_cullingTree; - - if (NULL != m_cullingCache) - delete m_cullingCache; - -} - - -float CcdPhysicsEnvironment::getConstraintParam(int constraintId,int param) -{ - btTypedConstraint* typedConstraint = getConstraintById(constraintId); - switch (typedConstraint->getUserConstraintType()) - { - case PHY_GENERIC_6DOF_CONSTRAINT: - { - - switch (param) - { - case 0: case 1: case 2: - { - //param = 0..2 are linear constraint values - btGeneric6DofConstraint* genCons = (btGeneric6DofConstraint*)typedConstraint; - genCons->calculateTransforms(); - return genCons->getRelativePivotPosition(param); - break; - } - case 3: case 4: case 5: - { - //param = 3..5 are relative constraint (Euler) angles - btGeneric6DofConstraint* genCons = (btGeneric6DofConstraint*)typedConstraint; - genCons->calculateTransforms(); - return genCons->getAngle(param-3); - break; - } - default: - { - } - } - break; - }; - default: - { - }; - }; - return 0.f; -} - -void CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float value0,float value1) -{ - btTypedConstraint* typedConstraint = getConstraintById(constraintId); - switch (typedConstraint->getUserConstraintType()) - { - case PHY_GENERIC_6DOF_CONSTRAINT: - { - - switch (param) - { - case 0: case 1: case 2: case 3: case 4: case 5: - { - //param = 0..5 are constraint limits, with low/high limit value - btGeneric6DofConstraint* genCons = (btGeneric6DofConstraint*)typedConstraint; - genCons->setLimit(param,value0,value1); - break; - } - case 6: case 7: case 8: - { - //param = 6,7,8 are translational motors, with value0=target velocity, value1 = max motor force - btGeneric6DofConstraint* genCons = (btGeneric6DofConstraint*)typedConstraint; - int transMotorIndex = param-6; - btTranslationalLimitMotor* transMotor = genCons->getTranslationalLimitMotor(); - transMotor->m_targetVelocity[transMotorIndex]= value0; - transMotor->m_maxMotorForce[transMotorIndex]=value1; - transMotor->m_enableMotor[transMotorIndex] = (value1>0.f); - break; - } - case 9: case 10: case 11: - { - //param = 9,10,11 are rotational motors, with value0=target velocity, value1 = max motor force - btGeneric6DofConstraint* genCons = (btGeneric6DofConstraint*)typedConstraint; - int angMotorIndex = param-9; - btRotationalLimitMotor* rotMotor = genCons->getRotationalLimitMotor(angMotorIndex); - rotMotor->m_enableMotor = (value1 > 0.f); - rotMotor->m_targetVelocity = value0; - rotMotor->m_maxMotorForce = value1; - break; - } - - case 12: case 13: case 14: case 15: case 16: case 17: - { - //param 13-17 are for motorized springs on each of the degrees of freedom - btGeneric6DofSpringConstraint* genCons = (btGeneric6DofSpringConstraint*)typedConstraint; - int springIndex = param-12; - if (value0!=0.f) - { - bool springEnabled = true; - genCons->setStiffness(springIndex,value0); - genCons->setDamping(springIndex,value1); - genCons->enableSpring(springIndex,springEnabled); - genCons->setEquilibriumPoint(springIndex); - } else - { - bool springEnabled = false; - genCons->enableSpring(springIndex,springEnabled); - } - break; - } - - default: - { - } - } - break; - }; - default: - { - }; - }; -} - -btTypedConstraint* CcdPhysicsEnvironment::getConstraintById(int constraintId) -{ - - int numConstraints = m_dynamicsWorld->getNumConstraints(); - int i; - for (i=0;igetConstraint(i); - if (constraint->getUserConstraintId()==constraintId) - { - return constraint; - } - } - return 0; -} - - -void CcdPhysicsEnvironment::addSensor(PHY_IPhysicsController* ctrl) -{ - - CcdPhysicsController* ctrl1 = (CcdPhysicsController* )ctrl; - // addSensor() is a "light" function for bullet because it is used - // dynamically when the sensor is activated. Use enableCcdPhysicsController() instead - //if (m_controllers.insert(ctrl1).second) - //{ - // addCcdPhysicsController(ctrl1); - //} - enableCcdPhysicsController(ctrl1); -} - -bool CcdPhysicsEnvironment::removeCollisionCallback(PHY_IPhysicsController* ctrl) -{ - CcdPhysicsController* ccdCtrl = (CcdPhysicsController*)ctrl; - if (!ccdCtrl->Unregister()) - return false; - m_triggerControllers.erase(ccdCtrl); - return true; -} - - -void CcdPhysicsEnvironment::removeSensor(PHY_IPhysicsController* ctrl) -{ - disableCcdPhysicsController((CcdPhysicsController*)ctrl); -} - -void CcdPhysicsEnvironment::addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user) -{ - /* printf("addTouchCallback\n(response class = %i)\n",response_class); - - //map PHY_ convention into SM_ convention - switch (response_class) - { - case PHY_FH_RESPONSE: - printf("PHY_FH_RESPONSE\n"); - break; - case PHY_SENSOR_RESPONSE: - printf("PHY_SENSOR_RESPONSE\n"); - break; - case PHY_CAMERA_RESPONSE: - printf("PHY_CAMERA_RESPONSE\n"); - break; - case PHY_OBJECT_RESPONSE: - printf("PHY_OBJECT_RESPONSE\n"); - break; - case PHY_STATIC_RESPONSE: - printf("PHY_STATIC_RESPONSE\n"); - break; - default: - assert(0); - return; - } - */ - - m_triggerCallbacks[response_class] = callback; - m_triggerCallbacksUserPtrs[response_class] = user; - -} -bool CcdPhysicsEnvironment::requestCollisionCallback(PHY_IPhysicsController* ctrl) -{ - CcdPhysicsController* ccdCtrl = static_cast(ctrl); - - if (!ccdCtrl->Register()) - return false; - m_triggerControllers.insert(ccdCtrl); - return true; -} - -void CcdPhysicsEnvironment::CallbackTriggers() -{ - if (m_triggerCallbacks[PHY_OBJECT_RESPONSE] || (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints))) - { - //walk over all overlapping pairs, and if one of the involved bodies is registered for trigger callback, perform callback - btDispatcher* dispatcher = m_dynamicsWorld->getDispatcher(); - int numManifolds = dispatcher->getNumManifolds(); - for (int i=0;igetManifoldByIndexInternal(i); - int numContacts = manifold->getNumContacts(); - if (numContacts) - { - btRigidBody* rb0 = static_cast(manifold->getBody0()); - btRigidBody* rb1 = static_cast(manifold->getBody1()); - if (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints)) - { - for (int j=0;jgetContactPoint(j); - if (m_debugDrawer) - m_debugDrawer->drawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.getDistance(),cp.getLifeTime(),color); - } - } - btRigidBody* obj0 = rb0; - btRigidBody* obj1 = rb1; - - //m_internalOwner is set in 'addPhysicsController' - CcdPhysicsController* ctrl0 = static_cast(obj0->getUserPointer()); - CcdPhysicsController* ctrl1 = static_cast(obj1->getUserPointer()); - - std::set::const_iterator i = m_triggerControllers.find(ctrl0); - if (i == m_triggerControllers.end()) - { - i = m_triggerControllers.find(ctrl1); - } - - if (!(i == m_triggerControllers.end())) - { - m_triggerCallbacks[PHY_OBJECT_RESPONSE](m_triggerCallbacksUserPtrs[PHY_OBJECT_RESPONSE], - ctrl0,ctrl1,0); - } - // Bullet does not refresh the manifold contact point for object without contact response - // may need to remove this when a newer Bullet version is integrated - if (!dispatcher->needsResponse(rb0, rb1)) - { - // Refresh algorithm fails sometimes when there is penetration - // (usuall the case with ghost and sensor objects) - // Let's just clear the manifold, in any case, it is recomputed on each frame. - manifold->clearManifold(); //refreshContactPoints(rb0->getCenterOfMassTransform(),rb1->getCenterOfMassTransform()); - } - } - } - - - - } - - -} - -// This call back is called before a pair is added in the cache -// Handy to remove objects that must be ignored by sensors -bool CcdOverlapFilterCallBack::needBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const -{ - btCollisionObject *colObj0, *colObj1; - CcdPhysicsController *sensorCtrl, *objCtrl; - bool collides; - // first check the filters - collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0; - collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask); - if (!collides) - return false; - - // additional check for sensor object - if (proxy0->m_collisionFilterGroup & btBroadphaseProxy::SensorTrigger) - { - // this is a sensor object, the other one can't be a sensor object because - // they exclude each other in the above test - assert(!(proxy1->m_collisionFilterGroup & btBroadphaseProxy::SensorTrigger)); - colObj0 = (btCollisionObject*)proxy0->m_clientObject; - colObj1 = (btCollisionObject*)proxy1->m_clientObject; - } - else if (proxy1->m_collisionFilterGroup & btBroadphaseProxy::SensorTrigger) - { - colObj0 = (btCollisionObject*)proxy1->m_clientObject; - colObj1 = (btCollisionObject*)proxy0->m_clientObject; - } - else - { - return true; - } - if (!colObj0 || !colObj1) - return false; - sensorCtrl = static_cast(colObj0->getUserPointer()); - objCtrl = static_cast(colObj1->getUserPointer()); - if (m_physEnv->m_triggerCallbacks[PHY_BROADPH_RESPONSE]) - { - return m_physEnv->m_triggerCallbacks[PHY_BROADPH_RESPONSE](m_physEnv->m_triggerCallbacksUserPtrs[PHY_BROADPH_RESPONSE], sensorCtrl, objCtrl, 0); - } - return true; -} - - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - -//complex constraint for vehicles -PHY_IVehicle* CcdPhysicsEnvironment::getVehicleConstraint(int constraintId) -{ - int i; - - int numVehicles = m_wrapperVehicles.size(); - for (i=0;iGetVehicle()->getUserConstraintId() == constraintId) - return wrapperVehicle; - } - - return 0; -} - -#endif //NEW_BULLET_VEHICLE_SUPPORT - - -int currentController = 0; -int numController = 0; - - - - -PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radius,const PHY__Vector3& position) -{ - - CcdConstructionInfo cinfo; - memset(&cinfo, 0, sizeof(cinfo)); /* avoid uninitialized values */ - cinfo.m_collisionShape = new btSphereShape(radius); // memory leak! The shape is not deleted by Bullet and we cannot add it to the KX_Scene.m_shapes list - cinfo.m_MotionState = 0; - cinfo.m_physicsEnv = this; - // declare this object as Dyamic rather then static!! - // The reason as it is designed to detect all type of object, including static object - // It would cause static-static message to be printed on the console otherwise - cinfo.m_collisionFlags |= btCollisionObject::CF_NO_CONTACT_RESPONSE | btCollisionObject::CF_STATIC_OBJECT; - DefaultMotionState* motionState = new DefaultMotionState(); - cinfo.m_MotionState = motionState; - // we will add later the possibility to select the filter from option - cinfo.m_collisionFilterMask = CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::SensorFilter; - cinfo.m_collisionFilterGroup = CcdConstructionInfo::SensorFilter; - cinfo.m_bSensor = true; - motionState->m_worldTransform.setIdentity(); - motionState->m_worldTransform.setOrigin(btVector3(position[0],position[1],position[2])); - - CcdPhysicsController* sphereController = new CcdPhysicsController(cinfo); - - return sphereController; -} - -int findClosestNode(btSoftBody* sb,const btVector3& worldPoint); -int findClosestNode(btSoftBody* sb,const btVector3& worldPoint) -{ - int node = -1; - - btSoftBody::tNodeArray& nodes(sb->m_nodes); - float maxDistSqr = 1e30f; - - for (int n=0;nGetRigidBody() : 0; - btRigidBody* rb1 = c1 ? c1->GetRigidBody() : 0; - - - - - bool rb0static = rb0 ? rb0->isStaticOrKinematicObject() : true; - bool rb1static = rb1 ? rb1->isStaticOrKinematicObject() : true; - - btCollisionObject* colObj0 = c0->GetCollisionObject(); - if (!colObj0) - { - return 0; - } - - btVector3 pivotInA(pivotX,pivotY,pivotZ); - - - - //it might be a soft body, let's try - btSoftBody* sb0 = c0 ? c0->GetSoftBody() : 0; - btSoftBody* sb1 = c1 ? c1->GetSoftBody() : 0; - if (sb0 && sb1) - { - //not between two soft bodies? - return 0; - } - - if (sb0) - { - //either cluster or node attach, let's find closest node first - //the soft body doesn't have a 'real' world transform, so get its initial world transform for now - btVector3 pivotPointSoftWorld = sb0->m_initialWorldTransform(pivotInA); - int node=findClosestNode(sb0,pivotPointSoftWorld); - if (node >=0) - { - bool clusterconstaint = false; -/* - switch (type) - { - case PHY_LINEHINGE_CONSTRAINT: - { - if (sb0->clusterCount() && rb1) - { - btSoftBody::LJoint::Specs ls; - ls.erp=0.5f; - ls.position=sb0->clusterCom(0); - sb0->appendLinearJoint(ls,rb1); - clusterconstaint = true; - break; - } - } - case PHY_GENERIC_6DOF_CONSTRAINT: - { - if (sb0->clusterCount() && rb1) - { - btSoftBody::AJoint::Specs as; - as.erp = 1; - as.cfm = 1; - as.axis.setValue(axisX,axisY,axisZ); - sb0->appendAngularJoint(as,rb1); - clusterconstaint = true; - break; - } - - break; - } - default: - { - - } - }; - */ - - if (!clusterconstaint) - { - if (rb1) - { - sb0->appendAnchor(node,rb1,disableCollisionBetweenLinkedBodies); - } else - { - sb0->setMass(node,0.f); - } - } - - - } - return 0;//can't remove soft body anchors yet - } - - if (sb1) - { - btVector3 pivotPointAWorld = colObj0->getWorldTransform()(pivotInA); - int node=findClosestNode(sb1,pivotPointAWorld); - if (node >=0) - { - bool clusterconstaint = false; - - /* - switch (type) - { - case PHY_LINEHINGE_CONSTRAINT: - { - if (sb1->clusterCount() && rb0) - { - btSoftBody::LJoint::Specs ls; - ls.erp=0.5f; - ls.position=sb1->clusterCom(0); - sb1->appendLinearJoint(ls,rb0); - clusterconstaint = true; - break; - } - } - case PHY_GENERIC_6DOF_CONSTRAINT: - { - if (sb1->clusterCount() && rb0) - { - btSoftBody::AJoint::Specs as; - as.erp = 1; - as.cfm = 1; - as.axis.setValue(axisX,axisY,axisZ); - sb1->appendAngularJoint(as,rb0); - clusterconstaint = true; - break; - } - - break; - } - default: - { - - - } - };*/ - - - if (!clusterconstaint) - { - if (rb0) - { - sb1->appendAnchor(node,rb0,disableCollisionBetweenLinkedBodies); - } else - { - sb1->setMass(node,0.f); - } - } - - - } - return 0;//can't remove soft body anchors yet - } - - if (rb0static && rb1static) - { - - return 0; - } - - - if (!rb0) - return 0; - - - btVector3 pivotInB = rb1 ? rb1->getCenterOfMassTransform().inverse()(rb0->getCenterOfMassTransform()(pivotInA)) : - rb0->getCenterOfMassTransform() * pivotInA; - btVector3 axisInA(axisX,axisY,axisZ); - - - bool angularOnly = false; - - switch (type) - { - case PHY_POINT2POINT_CONSTRAINT: - { - - btPoint2PointConstraint* p2p = 0; - - if (rb1) - { - p2p = new btPoint2PointConstraint(*rb0, - *rb1,pivotInA,pivotInB); - } else - { - p2p = new btPoint2PointConstraint(*rb0, - pivotInA); - } - - m_dynamicsWorld->addConstraint(p2p,disableCollisionBetweenLinkedBodies); -// m_constraints.push_back(p2p); - - p2p->setUserConstraintId(gConstraintUid++); - p2p->setUserConstraintType(type); - //64 bit systems can't cast pointer to int. could use size_t instead. - return p2p->getUserConstraintId(); - - break; - } - - case PHY_GENERIC_6DOF_CONSTRAINT: - { - btGeneric6DofConstraint* genericConstraint = 0; - - if (rb1) - { - btTransform frameInA; - btTransform frameInB; - - btVector3 axis1(axis1X,axis1Y,axis1Z), axis2(axis2X,axis2Y,axis2Z); - if (axis1.length() == 0.0) - { - btPlaneSpace1( axisInA, axis1, axis2 ); - } - - frameInA.getBasis().setValue( axisInA.x(), axis1.x(), axis2.x(), - axisInA.y(), axis1.y(), axis2.y(), - axisInA.z(), axis1.z(), axis2.z() ); - frameInA.setOrigin( pivotInA ); - - btTransform inv = rb1->getCenterOfMassTransform().inverse(); - - btTransform globalFrameA = rb0->getCenterOfMassTransform() * frameInA; - - frameInB = inv * globalFrameA; - bool useReferenceFrameA = true; - - genericConstraint = new btGeneric6DofSpringConstraint( - *rb0,*rb1, - frameInA,frameInB,useReferenceFrameA); - - - } else - { - static btRigidBody s_fixedObject2( 0,0,0); - btTransform frameInA; - btTransform frameInB; - - btVector3 axis1, axis2; - btPlaneSpace1( axisInA, axis1, axis2 ); - - frameInA.getBasis().setValue( axisInA.x(), axis1.x(), axis2.x(), - axisInA.y(), axis1.y(), axis2.y(), - axisInA.z(), axis1.z(), axis2.z() ); - - frameInA.setOrigin( pivotInA ); - - ///frameInB in worldspace - frameInB = rb0->getCenterOfMassTransform() * frameInA; - - bool useReferenceFrameA = true; - genericConstraint = new btGeneric6DofSpringConstraint( - *rb0,s_fixedObject2, - frameInA,frameInB,useReferenceFrameA); - } - - if (genericConstraint) - { - //m_constraints.push_back(genericConstraint); - m_dynamicsWorld->addConstraint(genericConstraint,disableCollisionBetweenLinkedBodies); - genericConstraint->setUserConstraintId(gConstraintUid++); - genericConstraint->setUserConstraintType(type); - //64 bit systems can't cast pointer to int. could use size_t instead. - return genericConstraint->getUserConstraintId(); - } - - break; - } - case PHY_CONE_TWIST_CONSTRAINT: - { - btConeTwistConstraint* coneTwistContraint = 0; - - - if (rb1) - { - btTransform frameInA; - btTransform frameInB; - - btVector3 axis1(axis1X,axis1Y,axis1Z), axis2(axis2X,axis2Y,axis2Z); - if (axis1.length() == 0.0) - { - btPlaneSpace1( axisInA, axis1, axis2 ); - } - - frameInA.getBasis().setValue( axisInA.x(), axis1.x(), axis2.x(), - axisInA.y(), axis1.y(), axis2.y(), - axisInA.z(), axis1.z(), axis2.z() ); - frameInA.setOrigin( pivotInA ); - - btTransform inv = rb1->getCenterOfMassTransform().inverse(); - - btTransform globalFrameA = rb0->getCenterOfMassTransform() * frameInA; - - frameInB = inv * globalFrameA; - - coneTwistContraint = new btConeTwistConstraint( *rb0,*rb1, - frameInA,frameInB); - - - } else - { - static btRigidBody s_fixedObject2( 0,0,0); - btTransform frameInA; - btTransform frameInB; - - btVector3 axis1, axis2; - btPlaneSpace1( axisInA, axis1, axis2 ); - - frameInA.getBasis().setValue( axisInA.x(), axis1.x(), axis2.x(), - axisInA.y(), axis1.y(), axis2.y(), - axisInA.z(), axis1.z(), axis2.z() ); - - frameInA.setOrigin( pivotInA ); - - ///frameInB in worldspace - frameInB = rb0->getCenterOfMassTransform() * frameInA; - - coneTwistContraint = new btConeTwistConstraint( - *rb0,s_fixedObject2, - frameInA,frameInB); - } - - if (coneTwistContraint) - { - //m_constraints.push_back(genericConstraint); - m_dynamicsWorld->addConstraint(coneTwistContraint,disableCollisionBetweenLinkedBodies); - coneTwistContraint->setUserConstraintId(gConstraintUid++); - coneTwistContraint->setUserConstraintType(type); - //64 bit systems can't cast pointer to int. could use size_t instead. - return coneTwistContraint->getUserConstraintId(); - } - - - - break; - } - case PHY_ANGULAR_CONSTRAINT: - angularOnly = true; - - - case PHY_LINEHINGE_CONSTRAINT: - { - btHingeConstraint* hinge = 0; - - if (rb1) - { - btVector3 axisInB = rb1 ? - (rb1->getCenterOfMassTransform().getBasis().inverse()*(rb0->getCenterOfMassTransform().getBasis() * axisInA)) : - rb0->getCenterOfMassTransform().getBasis() * axisInA; - - hinge = new btHingeConstraint( - *rb0, - *rb1,pivotInA,pivotInB,axisInA,axisInB); - - - } else - { - hinge = new btHingeConstraint(*rb0, - pivotInA,axisInA); - - } - hinge->setAngularOnly(angularOnly); - - //m_constraints.push_back(hinge); - m_dynamicsWorld->addConstraint(hinge,disableCollisionBetweenLinkedBodies); - hinge->setUserConstraintId(gConstraintUid++); - hinge->setUserConstraintType(type); - //64 bit systems can't cast pointer to int. could use size_t instead. - return hinge->getUserConstraintId(); - break; - } -#ifdef NEW_BULLET_VEHICLE_SUPPORT - - case PHY_VEHICLE_CONSTRAINT: - { - btRaycastVehicle::btVehicleTuning* tuning = new btRaycastVehicle::btVehicleTuning(); - btRigidBody* chassis = rb0; - btDefaultVehicleRaycaster* raycaster = new btDefaultVehicleRaycaster(m_dynamicsWorld); - btRaycastVehicle* vehicle = new btRaycastVehicle(*tuning,chassis,raycaster); - WrapperVehicle* wrapperVehicle = new WrapperVehicle(vehicle,ctrl0); - m_wrapperVehicles.push_back(wrapperVehicle); - m_dynamicsWorld->addVehicle(vehicle); - vehicle->setUserConstraintId(gConstraintUid++); - vehicle->setUserConstraintType(type); - return vehicle->getUserConstraintId(); - - break; - }; -#endif //NEW_BULLET_VEHICLE_SUPPORT - - default: - { - } - }; - - //btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB - - return 0; - -} - - - -PHY_IPhysicsController* CcdPhysicsEnvironment::CreateConeController(float coneradius,float coneheight) -{ - CcdConstructionInfo cinfo; - memset(&cinfo, 0, sizeof(cinfo)); /* avoid uninitialized values */ - // we don't need a CcdShapeConstructionInfo for this shape: - // it is simple enough for the standard copy constructor (see CcdPhysicsController::GetReplica) - cinfo.m_collisionShape = new btConeShape(coneradius,coneheight); - cinfo.m_MotionState = 0; - cinfo.m_physicsEnv = this; - cinfo.m_collisionFlags |= btCollisionObject::CF_NO_CONTACT_RESPONSE | btCollisionObject::CF_STATIC_OBJECT; - DefaultMotionState* motionState = new DefaultMotionState(); - cinfo.m_MotionState = motionState; - - // we will add later the possibility to select the filter from option - cinfo.m_collisionFilterMask = CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::SensorFilter; - cinfo.m_collisionFilterGroup = CcdConstructionInfo::SensorFilter; - cinfo.m_bSensor = true; - motionState->m_worldTransform.setIdentity(); -// motionState->m_worldTransform.setOrigin(btVector3(position[0],position[1],position[2])); - - CcdPhysicsController* sphereController = new CcdPhysicsController(cinfo); - - - return sphereController; -} - -float CcdPhysicsEnvironment::getAppliedImpulse(int constraintid) -{ - int i; - int numConstraints = m_dynamicsWorld->getNumConstraints(); - for (i=0;igetConstraint(i); - if (constraint->getUserConstraintId() == constraintid) - { - return constraint->getAppliedImpulse(); - } - } - - return 0.f; -} diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h deleted file mode 100644 index 21f74e95ed4..00000000000 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ /dev/null @@ -1,285 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef CCDPHYSICSENVIRONMENT -#define CCDPHYSICSENVIRONMENT - -#include "PHY_IPhysicsEnvironment.h" -#include -#include -class CcdPhysicsController; -class CcdGraphicController; -#include "LinearMath/btVector3.h" -#include "LinearMath/btTransform.h" - - - - -class btTypedConstraint; -class btSimulationIslandManager; -class btCollisionDispatcher; -class btDispatcher; -//#include "btBroadphaseInterface.h" - -//switch on/off new vehicle support -#define NEW_BULLET_VEHICLE_SUPPORT 1 - -#include "BulletDynamics/ConstraintSolver/btContactSolverInfo.h" - -class WrapperVehicle; -class btPersistentManifold; -class btBroadphaseInterface; -struct btDbvtBroadphase; -class btOverlappingPairCache; -class btIDebugDraw; -class PHY_IVehicle; -class CcdOverlapFilterCallBack; - -/// CcdPhysicsEnvironment is an experimental mainloop for physics simulation using optional continuous collision detection. -/// Physics Environment takes care of stepping the simulation and is a container for physics entities. -/// It stores rigidbodies,constraints, materials etc. -/// A derived class may be able to 'construct' entities by loading and/or converting -class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment -{ - friend class CcdOverlapFilterCallBack; - btVector3 m_gravity; - -protected: - btIDebugDraw* m_debugDrawer; - - class btDefaultCollisionConfiguration* m_collisionConfiguration; - class btBroadphaseInterface* m_broadphase; // broadphase for dynamic world - // for culling only - btOverlappingPairCache* m_cullingCache; - struct btDbvtBroadphase* m_cullingTree; // broadphase for culling - - //solver iterations - int m_numIterations; - - //timestep subdivisions - int m_numTimeSubSteps; - - - int m_ccdMode; - int m_solverType; - int m_profileTimings; - bool m_enableSatCollisionDetection; - - btContactSolverInfo m_solverInfo; - - void processFhSprings(double curTime,float timeStep); - - public: - CcdPhysicsEnvironment(bool useDbvtCulling, btDispatcher* dispatcher=0, btOverlappingPairCache* pairCache=0); - - virtual ~CcdPhysicsEnvironment(); - - ///////////////////////////////////// - //PHY_IPhysicsEnvironment interface - ///////////////////////////////////// - - /// Perform an integration step of duration 'timeStep'. - - virtual void setDebugDrawer(btIDebugDraw* debugDrawer); - - virtual void setNumIterations(int numIter); - virtual void setNumTimeSubSteps(int numTimeSubSteps) - { - m_numTimeSubSteps = numTimeSubSteps; - } - virtual void setDeactivationTime(float dTime); - virtual void setDeactivationLinearTreshold(float linTresh) ; - virtual void setDeactivationAngularTreshold(float angTresh) ; - virtual void setContactBreakingTreshold(float contactBreakingTreshold) ; - virtual void setCcdMode(int ccdMode); - virtual void setSolverType(int solverType); - virtual void setSolverSorConstant(float sor); - virtual void setSolverTau(float tau); - virtual void setSolverDamping(float damping); - virtual void setLinearAirDamping(float damping); - virtual void setUseEpa(bool epa) ; - - virtual void beginFrame(); - virtual void endFrame() {}; - /// Perform an integration step of duration 'timeStep'. - virtual bool proceedDeltaTime(double curTime,float timeStep,float interval); - - virtual void debugDrawWorld(); -// virtual bool proceedDeltaTimeOneStep(float timeStep); - - virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep){}; - //returns 0.f if no fixed timestep is used - - virtual float getFixedTimeStep(){ return 0.f;}; - - virtual void setDebugMode(int debugMode); - - virtual void setGravity(float x,float y,float z); - virtual void getGravity(PHY__Vector3& grav); - - - virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type, - float pivotX,float pivotY,float pivotZ, - float axisX,float axisY,float axisZ, - float axis1X=0,float axis1Y=0,float axis1Z=0, - float axis2X=0,float axis2Y=0,float axis2Z=0,int flag=0 - ); - - - //Following the COLLADA physics specification for constraints - virtual int createUniversalD6Constraint( - class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther, - btTransform& localAttachmentFrameRef, - btTransform& localAttachmentOther, - const btVector3& linearMinLimits, - const btVector3& linearMaxLimits, - const btVector3& angularMinLimits, - const btVector3& angularMaxLimits,int flags - ); - - - virtual void setConstraintParam(int constraintId,int param,float value,float value1); - - virtual float getConstraintParam(int constraintId,int param); - - virtual void removeConstraint(int constraintid); - - virtual float getAppliedImpulse(int constraintid); - - - virtual void CallbackTriggers(); - - -#ifdef NEW_BULLET_VEHICLE_SUPPORT - //complex constraint for vehicles - virtual PHY_IVehicle* getVehicleConstraint(int constraintId); -#else - virtual class PHY_IVehicle* getVehicleConstraint(int constraintId) - { - return 0; - } -#endif //NEW_BULLET_VEHICLE_SUPPORT - - btTypedConstraint* getConstraintById(int constraintId); - - virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ); - virtual bool cullingTest(PHY_CullingCallback callback, void* userData, PHY__Vector4* planes, int nplanes, int occlusionRes); - - - //Methods for gamelogic collision/physics callbacks - virtual void addSensor(PHY_IPhysicsController* ctrl); - virtual void removeSensor(PHY_IPhysicsController* ctrl); - virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user); - virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl); - virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl); - //These two methods are used *solely* to create controllers for Near/Radar sensor! Don't use for anything else - virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position); - virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight); - - - virtual int getNumContactPoints(); - - virtual void getContactPoint(int i,float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ); - - ////////////////////// - //CcdPhysicsEnvironment interface - //////////////////////// - - void addCcdPhysicsController(CcdPhysicsController* ctrl); - - bool removeCcdPhysicsController(CcdPhysicsController* ctrl); - - void updateCcdPhysicsController(CcdPhysicsController* ctrl, btScalar newMass, int newCollisionFlags, short int newCollisionGroup, short int newCollisionMask); - - void disableCcdPhysicsController(CcdPhysicsController* ctrl); - - void enableCcdPhysicsController(CcdPhysicsController* ctrl); - - void refreshCcdPhysicsController(CcdPhysicsController* ctrl); - - void addCcdGraphicController(CcdGraphicController* ctrl); - - void removeCcdGraphicController(CcdGraphicController* ctrl); - - btBroadphaseInterface* getBroadphase(); - btDbvtBroadphase* getCullingTree() { return m_cullingTree; } - - btDispatcher* getDispatcher(); - - - bool IsSatCollisionDetectionEnabled() const - { - return m_enableSatCollisionDetection; - } - - void EnableSatCollisionDetection(bool enableSat) - { - m_enableSatCollisionDetection = enableSat; - } - - - const btPersistentManifold* GetManifold(int index) const; - - - void SyncMotionStates(float timeStep); - - class btSoftRigidDynamicsWorld* getDynamicsWorld() - { - return m_dynamicsWorld; - } - - class btConstraintSolver* GetConstraintSolver(); - - void MergeEnvironment(CcdPhysicsEnvironment *other); - - protected: - - - - std::set m_controllers; - std::set m_triggerControllers; - - PHY_ResponseCallback m_triggerCallbacks[PHY_NUM_RESPONSE]; - void* m_triggerCallbacksUserPtrs[PHY_NUM_RESPONSE]; - - std::vector m_wrapperVehicles; - - //use explicit btSoftRigidDynamicsWorld/btDiscreteDynamicsWorld* so that we have access to - //btDiscreteDynamicsWorld::addRigidBody(body,filter,group) - //so that we can set the body collision filter/group at the time of creation - //and not afterwards (breaks the collision system for radar/near sensor) - //Ideally we would like to have access to this function from the btDynamicsWorld interface - //class btDynamicsWorld* m_dynamicsWorld; - class btSoftRigidDynamicsWorld* m_dynamicsWorld; - - class btConstraintSolver* m_solver; - - class btOverlappingPairCache* m_ownPairCache; - - class CcdOverlapFilterCallBack* m_filterCallback; - - class btDispatcher* m_ownDispatcher; - - bool m_scalingPropagated; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdPhysicsEnvironment"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //CCDPHYSICSENVIRONMENT diff --git a/source/gameengine/Physics/Bullet/Makefile b/source/gameengine/Physics/Bullet/Makefile deleted file mode 100644 index 433d1df3d2f..00000000000 --- a/source/gameengine/Physics/Bullet/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = blbullet -DIR = $(OCGDIR)/gameengine/blphys/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_BULLET2)/include -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) -CPPFLAGS += -I../../../kernel/gen_system -CPPFLAGS += -I../../Physics/common -CPPFLAGS += -I../../Physics/Dummy -CPPFLAGS += -I../../Rasterizer -CPPFLAGS += -I../../Ketsji -CPPFLAGS += -I../../Expressions -CPPFLAGS += -I../../GameLogic -CPPFLAGS += -I../../SceneGraph -CPPFLAGS += -I../../../../source/blender/makesdna -CPPFLAGS += -I../../../../source/blender/blenkernel -CPPFLAGS += -I../../../../source/blender/blenlib - diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript deleted file mode 100644 index 976c6825351..00000000000 --- a/source/gameengine/Physics/Bullet/SConscript +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = 'CcdPhysicsEnvironment.cpp CcdPhysicsController.cpp CcdGraphicController.cpp' - -incs = '. ../common' -incs += ' #source/kernel/gen_system' -incs += ' #intern/string' -incs += ' #intern/moto/include' -incs += ' #extern/glew/include' -incs += ' #source/gameengine/Rasterizer' -incs += ' #source/gameengine/Ketsji' -incs += ' #source/gameengine/Expressions' -incs += ' #source/gameengine/GameLogic' -incs += ' #source/gameengine/SceneGraph' -incs += ' #source/blender/makesdna' -incs += ' #source/blender/blenkernel' -incs += ' #source/blender/blenlib' -incs += ' #intern/guardedalloc' - -incs += ' ' + env['BF_BULLET_INC'] - -defs = [] - -if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] -else: - defs.append('DISABLE_PYTHON') - -env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Physics/Dummy/CMakeLists.txt b/source/gameengine/Physics/Dummy/CMakeLists.txt deleted file mode 100644 index cb7a467dde9..00000000000 --- a/source/gameengine/Physics/Dummy/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -SET(SRC DummyPhysicsEnvironment.cpp) - -SET(INC - . - ../common -) - -BLENDERLIB(bf_dummy "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_dummy', Split(sources), Split(incs), [], libtype=['game','player'], priority=[10,100] ) diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp deleted file mode 100644 index 524cffc2732..00000000000 --- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "DummyPhysicsEnvironment.h" -#include "PHY_IMotionState.h" - -DummyPhysicsEnvironment::DummyPhysicsEnvironment() -{ - // create physicsengine data -} - - - -DummyPhysicsEnvironment::~DummyPhysicsEnvironment() -{ - //destroy physicsengine data -} - -void DummyPhysicsEnvironment::beginFrame() -{ - // beginning of logic frame: apply forces -} - -void DummyPhysicsEnvironment::endFrame() -{ - // end of logic frame: clear forces -} - - - -bool DummyPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep,float interval) -{ - //step physics simulation, typically perform - - //collision detection - //solve constraints - //integrate solution - // return true if an update was done. - return true; -} -void DummyPhysicsEnvironment::setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep) -{ -} - -float DummyPhysicsEnvironment::getFixedTimeStep() -{ - return 0.f; -} - - - - -void DummyPhysicsEnvironment::setGravity(float x,float y,float z) -{ -} - - - - - - - -int DummyPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type, - float pivotX,float pivotY,float pivotZ,float axisX,float axisY,float axisZ, - float axis1X,float axis1Y,float axis1Z, - float axis2X,float axis2Y,float axis2Z,int flag - ) -{ - - int constraintid = 0; - return constraintid; - -} - -void DummyPhysicsEnvironment::removeConstraint(int constraintid) -{ - if (constraintid) - { - } -} - -PHY_IPhysicsController* DummyPhysicsEnvironment::rayTest(PHY_IRayCastFilterCallback &filterCallback,float fromX,float fromY,float fromZ, float toX,float toY,float toZ) -{ - //collision detection / raytesting - return NULL; -} - diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h deleted file mode 100644 index 9cf125f3e3f..00000000000 --- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef _DUMMYPHYSICSENVIRONMENT -#define _DUMMYPHYSICSENVIRONMENT - -#include "PHY_IPhysicsEnvironment.h" - -/** -* DummyPhysicsEnvironment is an empty placeholder -* Alternatives are ODE,Sumo and Dynamo PhysicsEnvironments -* Use DummyPhysicsEnvironment as a base to integrate your own physics engine -* Physics Environment takes care of stepping the simulation and is a container for physics entities (rigidbodies,constraints, materials etc.) -* -* A derived class may be able to 'construct' entities by loading and/or converting -*/ -class DummyPhysicsEnvironment : public PHY_IPhysicsEnvironment -{ - -public: - DummyPhysicsEnvironment (); - virtual ~DummyPhysicsEnvironment (); - virtual void beginFrame(); - virtual void endFrame(); -// Perform an integration step of duration 'timeStep'. - virtual bool proceedDeltaTime(double curTime,float timeStep,float interval); - virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep); - virtual float getFixedTimeStep(); - - virtual void setGravity(float x,float y,float z); - - virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type, - float pivotX,float pivotY,float pivotZ, - float axisX,float axisY,float axisZ, - float axis1X=0,float axis1Y=0,float axis1Z=0, - float axis2X=0,float axis2Y=0,float axis2Z=0,int flag=0 - ); - - virtual void removeConstraint(int constraintid); - - //complex constraint for vehicles - virtual PHY_IVehicle* getVehicleConstraint(int constraintId) - { - return 0; - } - - virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ); - virtual bool cullingTest(PHY_CullingCallback callback, void* userData, PHY__Vector4* planes, int nplanes, int occlusionRes) { return false; } - - - //gamelogic callbacks - virtual void addSensor(PHY_IPhysicsController* ctrl) {} - virtual void removeSensor(PHY_IPhysicsController* ctrl) {} - virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user) - { - } - virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl) { return false; } - virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl) { return false;} - virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position) {return 0;} - virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight) { return 0;} - - virtual void setConstraintParam(int constraintId,int param,float value,float value1) - { - } - - virtual float getConstraintParam(int constraintId,int param) - { - return 0.f; - } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:DummyPhysicsEnvironment"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //_DUMMYPHYSICSENVIRONMENT - diff --git a/source/gameengine/Physics/Dummy/Makefile b/source/gameengine/Physics/Dummy/Makefile deleted file mode 100644 index 0e36266ae09..00000000000 --- a/source/gameengine/Physics/Dummy/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = dummy -DIR = $(OCGDIR)/gameengine/blphys/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(OPENGL_HEADERS) -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) - -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include -CPPFLAGS += -I../../Physics/common -CPPFLAGS += -I../../Physics/Dummy diff --git a/source/gameengine/Physics/Dummy/SConscript b/source/gameengine/Physics/Dummy/SConscript deleted file mode 100644 index dc76e8046a0..00000000000 --- a/source/gameengine/Physics/Dummy/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = 'DummyPhysicsEnvironment.cpp' - -incs = '. ../common' - -env.BlenderLib ( 'bf_dummy', Split(sources), Split(incs), [], libtype=['core','player'], priority=[350,60] ) diff --git a/source/gameengine/Physics/Makefile b/source/gameengine/Physics/Makefile deleted file mode 100644 index da0d4cafd2e..00000000000 --- a/source/gameengine/Physics/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# Bounces make to subdirectories. - -include nan_definitions.mk - -SOURCEDIR = source/gameengine/Physics -DIR = $(OCGDIR)/gameengine/blphys -DIRS = common Dummy Bullet - -include nan_subdirs.mk diff --git a/source/gameengine/Physics/common/CMakeLists.txt b/source/gameengine/Physics/common/CMakeLists.txt deleted file mode 100644 index 3618725c2bf..00000000000 --- a/source/gameengine/Physics/common/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -SET(SRC PHY_IMotionState.cpp PHY_IController.cpp PHY_IPhysicsController.cpp PHY_IGraphicController.cpp PHY_IPhysicsEnvironment.cpp PHY_IVehicle.cpp) - -SET(INC - . - ../Dummy - ../../../intern/moto/include -) - -BLENDERLIB(bf_common "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_common', Split(sources), Split(incs), [], libtype=['game', 'game2','player'], priority=[20, 35, 95] ) diff --git a/source/gameengine/Physics/common/Makefile b/source/gameengine/Physics/common/Makefile deleted file mode 100644 index f87da383520..00000000000 --- a/source/gameengine/Physics/common/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = common -DIR = $(OCGDIR)/gameengine/blphys/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(OPENGL_HEADERS) -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) - -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I../../blender -# these two needed because of blenkernel -CPPFLAGS += -I../../blender/makesdna -CPPFLAGS += -I../../blender/include -CPPFLAGS += -I../../blender/blenlib -CPPFLAGS += -I../../blender/blenkernel -CPPFLAGS += -I../../blender/render/extern/include -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include -CPPFLAGS += -I../Expressions -I../Rasterizer -I../GameLogic -CPPFLAGS += -I../Ketsji -I../BlenderRoutines -I../SceneGraph -CPPFLAGS += -I../../kernel/gen_system -CPPFLAGS += -I../Rasterizer/RAS_OpenGLRasterizer -CPPFLAGS += -I../Network -I../Ketsji/KXNetwork -CPPFLAGS += -I../Physics -CPPFLAGS += -I../Physics/Dummy diff --git a/source/gameengine/Physics/common/PHY_DynamicTypes.h b/source/gameengine/Physics/common/PHY_DynamicTypes.h deleted file mode 100644 index 08d94a2850a..00000000000 --- a/source/gameengine/Physics/common/PHY_DynamicTypes.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef __PHY_DYNAMIC_TYPES -#define __PHY_DYNAMIC_TYPES - - - -struct KX_ClientObjectInfo; -class PHY_Shape; - -struct PHY__Vector2 -{ - float m_vec[2]; - - operator const float* () const - { - return &m_vec[0]; - } - operator float* () - { - return &m_vec[0]; - } -}; - -struct PHY__Vector3 -{ - float m_vec[4]; - - operator const float* () const - { - return &m_vec[0]; - } - operator float* () - { - return &m_vec[0]; - } -}; - -struct PHY__Vector4 -{ - float m_vec[4]; - PHY__Vector4() {} - void setValue(const float *value) - { - m_vec[0] = *value++; - m_vec[1] = *value++; - m_vec[2] = *value++; - m_vec[3] = *value++; - } - void setValue(const double *value) - { - m_vec[0] = (float)(*value++); - m_vec[1] = (float)(*value++); - m_vec[2] = (float)(*value++); - m_vec[3] = (float)(*value++); - } - - operator const float* () const - { - return &m_vec[0]; - } - operator float* () - { - return &m_vec[0]; - } -}; - -//typedef float PHY__Vector3[4]; - -enum -{ - PHY_FH_RESPONSE, - PHY_SENSOR_RESPONSE, /* Touch Sensors */ - PHY_CAMERA_RESPONSE, /* Visibility Culling */ - PHY_OBJECT_RESPONSE, /* Object Dynamic Geometry Response */ - PHY_STATIC_RESPONSE, /* Static Geometry Response */ - PHY_BROADPH_RESPONSE, /* broadphase Response */ - - PHY_NUM_RESPONSE -}; - - typedef struct PHY_CollData { - PHY__Vector3 m_point1; /* Point in object1 in world coordinates */ - PHY__Vector3 m_point2; /* Point in object2 in world coordinates */ - PHY__Vector3 m_normal; /* point2 - point1 */ - } PHY_CollData; - - - typedef bool (*PHY_ResponseCallback)(void *client_data, - void *client_object1, - void *client_object2, - const PHY_CollData *coll_data); - typedef void (*PHY_CullingCallback)(KX_ClientObjectInfo* info, void* param); - - -/// PHY_PhysicsType enumerates all possible Physics Entities. -/// It is mainly used to create/add Physics Objects - -typedef enum PHY_PhysicsType { - PHY_CONVEX_RIGIDBODY=16386, - PHY_CONCAVE_RIGIDBODY=16399, - PHY_CONVEX_FIXEDBODY=16388,//'collision object' - PHY_CONCAVE_FIXEDBODY=16401, - PHY_CONVEX_KINEMATICBODY=16387,// - PHY_CONCAVE_KINEMATICBODY=16400, - PHY_CONVEX_PHANTOMBODY=16398, - PHY_CONCAVE_PHANTOMBODY=16402 -} PHY_PhysicsType; - -/// PHY_ConstraintType enumerates all supported Constraint Types -typedef enum PHY_ConstraintType { - PHY_POINT2POINT_CONSTRAINT=1, - PHY_LINEHINGE_CONSTRAINT=2, - PHY_ANGULAR_CONSTRAINT = 3,//hinge without ball socket - PHY_CONE_TWIST_CONSTRAINT = 4, - PHY_VEHICLE_CONSTRAINT=11,//complex 'constraint' that turns a rigidbody into a vehicle - PHY_GENERIC_6DOF_CONSTRAINT=12,//can leave any of the 6 degree of freedom 'free' or 'locked' - -} PHY_ConstraintType; - -typedef enum PHY_ShapeType { - PHY_SHAPE_NONE, - PHY_SHAPE_BOX, - PHY_SHAPE_SPHERE, - PHY_SHAPE_CYLINDER, - PHY_SHAPE_CONE, - PHY_SHAPE_MESH, - PHY_SHAPE_POLYTOPE, - PHY_SHAPE_COMPOUND, - PHY_SHAPE_PROXY -} PHY_ShapeType; - - -typedef float PHY_Vector3[3]; - -#endif //__PHY_DYNAMIC_TYPES - diff --git a/source/gameengine/Physics/common/PHY_IController.cpp b/source/gameengine/Physics/common/PHY_IController.cpp deleted file mode 100644 index 577e25b4336..00000000000 --- a/source/gameengine/Physics/common/PHY_IController.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "PHY_IController.h" - -PHY_IController::~PHY_IController() -{ - -} - diff --git a/source/gameengine/Physics/common/PHY_IController.h b/source/gameengine/Physics/common/PHY_IController.h deleted file mode 100644 index 8fd9a37dea0..00000000000 --- a/source/gameengine/Physics/common/PHY_IController.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef PHY_ICONTROLLER_H -#define PHY_ICONTROLLER_H - -#include "PHY_DynamicTypes.h" - -class PHY_IPhysicsEnvironment; - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -/** - PHY_IController is the abstract simplified Interface to objects - controlled by the physics engine. This includes the physics objects - and the graphics object for view frustrum and occlusion culling. -*/ -class PHY_IController -{ - public: - virtual ~PHY_IController(); - // clientinfo for raycasts for example - virtual void* getNewClientInfo()=0; - virtual void setNewClientInfo(void* clientinfo)=0; - virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment *env)=0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //PHY_ICONTROLLER_H - diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.cpp b/source/gameengine/Physics/common/PHY_IGraphicController.cpp deleted file mode 100644 index dc4b31d9a76..00000000000 --- a/source/gameengine/Physics/common/PHY_IGraphicController.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "PHY_IGraphicController.h" - -PHY_IGraphicController::~PHY_IGraphicController() -{ - -} - diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.h b/source/gameengine/Physics/common/PHY_IGraphicController.h deleted file mode 100644 index adca10cc1b4..00000000000 --- a/source/gameengine/Physics/common/PHY_IGraphicController.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef PHY_IGRAPHICCONTROLLER_H -#define PHY_IGRAPHICCONTROLLER_H - -#include "PHY_IController.h" - - -/** - PHY_IPhysicsController is the abstract simplified Interface to a physical object. - It contains the IMotionState and IDeformableMesh Interfaces. -*/ -class PHY_IGraphicController : public PHY_IController -{ - public: - virtual ~PHY_IGraphicController(); - /** - SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - virtual bool SetGraphicTransform()=0; - virtual void Activate(bool active=true)=0; - virtual void setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax)=0; - virtual void setLocalAabb(const float* aabbMin,const float* aabbMax)=0; - - virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate) {return 0;} - -#ifdef WITH_CXX_GUARDEDALLOC - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //PHY_IGRAPHICCONTROLLER_H - diff --git a/source/gameengine/Physics/common/PHY_IMotionState.cpp b/source/gameengine/Physics/common/PHY_IMotionState.cpp deleted file mode 100644 index 78505231895..00000000000 --- a/source/gameengine/Physics/common/PHY_IMotionState.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "PHY_IMotionState.h" - -PHY_IMotionState::~PHY_IMotionState() -{ - -} diff --git a/source/gameengine/Physics/common/PHY_IMotionState.h b/source/gameengine/Physics/common/PHY_IMotionState.h deleted file mode 100644 index 41dc45e6e32..00000000000 --- a/source/gameengine/Physics/common/PHY_IMotionState.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef PHY__MOTIONSTATE_H -#define PHY__MOTIONSTATE_H - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -/** - PHY_IMotionState is the Interface to explicitly synchronize the world transformation. - Default implementations for mayor graphics libraries like OpenGL and DirectX can be provided. -*/ -class PHY_IMotionState - -{ - public: - virtual ~PHY_IMotionState(); - - virtual void getWorldPosition(float& posX,float& posY,float& posZ)=0; - virtual void getWorldScaling(float& scaleX,float& scaleY,float& scaleZ)=0; - virtual void getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal)=0; - // ori = array 12 floats, [0..3] = first column + 0, [4..7] = second colum, [8..11] = third column - virtual void getWorldOrientation(float* ori)=0; - virtual void setWorldOrientation(const float* ori)=0; - - virtual void setWorldPosition(float posX,float posY,float posZ)=0; - virtual void setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)=0; - - - virtual void calculateWorldTransformations()=0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IMotionState"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //PHY__MOTIONSTATE_H - diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.cpp b/source/gameengine/Physics/common/PHY_IPhysicsController.cpp deleted file mode 100644 index 00c0bbe6477..00000000000 --- a/source/gameengine/Physics/common/PHY_IPhysicsController.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "PHY_IPhysicsController.h" - -PHY_IPhysicsController::~PHY_IPhysicsController() -{ - -} - diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.h b/source/gameengine/Physics/common/PHY_IPhysicsController.h deleted file mode 100644 index 07ae3a01c91..00000000000 --- a/source/gameengine/Physics/common/PHY_IPhysicsController.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef PHY_IPHYSICSCONTROLLER_H -#define PHY_IPHYSICSCONTROLLER_H - -#include "PHY_IController.h" - -class PHY_IMotionState; -class PHY_IPhysicsEnvironment; - -/** - PHY_IPhysicsController is the abstract simplified Interface to a physical object. - It contains the IMotionState and IDeformableMesh Interfaces. -*/ -class PHY_IPhysicsController : public PHY_IController -{ - - public: - virtual ~PHY_IPhysicsController(); - /** - SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - virtual bool SynchronizeMotionStates(float time)=0; - /** - WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding') - */ - - virtual void WriteMotionStateToDynamics(bool nondynaonly)=0; - virtual void WriteDynamicsToMotionState()=0; - virtual class PHY_IMotionState* GetMotionState() = 0; - // controller replication - virtual void PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl)=0; - - // kinematic methods - virtual void RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local)=0; - virtual void RelativeRotate(const float drot[12],bool local)=0; - virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal)=0; - virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal)=0; - virtual void setPosition(float posX,float posY,float posZ)=0; - virtual void getPosition(PHY__Vector3& pos) const=0; - virtual void setScaling(float scaleX,float scaleY,float scaleZ)=0; - - // physics methods - virtual void ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local)=0; - virtual void ApplyForce(float forceX,float forceY,float forceZ,bool local)=0; - virtual void SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local)=0; - virtual void SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local)=0; - virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) = 0; - - virtual void applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ)=0; - virtual void SetActive(bool active)=0; - - // reading out information from physics - virtual void GetLinearVelocity(float& linvX,float& linvY,float& linvZ)=0; - virtual void GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ)=0; - virtual void getReactionForce(float& forceX,float& forceY,float& forceZ)=0; - - // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted - virtual void setRigidBody(bool rigid)=0; - - virtual PHY_IPhysicsController* GetReplica() {return 0;} - - virtual void calcXform() =0; - virtual void SetMargin(float margin) =0; - virtual float GetMargin() const=0; - virtual float GetRadius() const=0; - virtual void SetRadius(float margin) = 0; - - virtual float GetLinVelocityMin() const=0; - virtual void SetLinVelocityMin(float val) = 0; - virtual float GetLinVelocityMax() const=0; - virtual void SetLinVelocityMax(float val) = 0; - - PHY__Vector3 GetWorldPosition(PHY__Vector3& localpos); - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IPhysicsController"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //PHY_IPHYSICSCONTROLLER_H - diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp deleted file mode 100644 index f56dc5c0aa7..00000000000 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "PHY_IPhysicsEnvironment.h" - -/** -* Physics Environment takes care of stepping the simulation and is a container for physics entities (rigidbodies,constraints, materials etc.) -* A derived class may be able to 'construct' entities by loading and/or converting -*/ - - - -PHY_IPhysicsEnvironment::~PHY_IPhysicsEnvironment() -{ - -} diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h deleted file mode 100644 index b557d4edc07..00000000000 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h +++ /dev/null @@ -1,188 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef _IPHYSICSENVIRONMENT -#define _IPHYSICSENVIRONMENT - -#include -#include "PHY_DynamicTypes.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class PHY_IVehicle; -class RAS_MeshObject; -class PHY_IPhysicsController; - -/** - * pass back information from rayTest - */ -struct PHY_RayCastResult -{ - PHY_IPhysicsController* m_controller; - PHY__Vector3 m_hitPoint; - PHY__Vector3 m_hitNormal; - const RAS_MeshObject* m_meshObject; // !=NULL for mesh object (only for Bullet controllers) - int m_polygon; // index of the polygon hit by the ray, - // only if m_meshObject != NULL - int m_hitUVOK; // !=0 if UV coordinate in m_hitUV is valid - PHY__Vector2 m_hitUV; // UV coordinates of hit point -}; - -/** - * This class replaces the ignoreController parameter of rayTest function. - * It allows more sophisticated filtering on the physics controller before computing the ray intersection to save CPU. - * It is only used to its full extend by the Ccd physics environement (Bullet). - */ -class PHY_IRayCastFilterCallback -{ -public: - PHY_IPhysicsController* m_ignoreController; - bool m_faceNormal; - bool m_faceUV; - - virtual ~PHY_IRayCastFilterCallback() - { - } - - virtual bool needBroadphaseRayCast(PHY_IPhysicsController* controller) - { - return true; - } - - virtual void reportHit(PHY_RayCastResult* result) = 0; - - PHY_IRayCastFilterCallback(PHY_IPhysicsController* ignoreController, bool faceNormal=false, bool faceUV=false) - :m_ignoreController(ignoreController), - m_faceNormal(faceNormal), - m_faceUV(faceUV) - { - } - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IRayCastFilterCallback"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -/** -* Physics Environment takes care of stepping the simulation and is a container for physics entities (rigidbodies,constraints, materials etc.) -* A derived class may be able to 'construct' entities by loading and/or converting -*/ -class PHY_IPhysicsEnvironment -{ - public: - virtual ~PHY_IPhysicsEnvironment(); - virtual void beginFrame() = 0; - virtual void endFrame() = 0; - /// Perform an integration step of duration 'timeStep'. - virtual bool proceedDeltaTime(double curTime,float timeStep,float interval)=0; - ///draw debug lines (make sure to call this during the render phase, otherwise lines are not drawn properly) - virtual void debugDrawWorld(){} - virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)=0; - //returns 0.f if no fixed timestep is used - virtual float getFixedTimeStep()=0; - - ///setDebugMode is used to support several ways of debug lines, contact point visualization - virtual void setDebugMode(int debugMode) {} - ///setNumIterations set the number of iterations for iterative solvers - virtual void setNumIterations(int numIter) {} - ///setNumTimeSubSteps set the number of divisions of the timestep. Tradeoff quality versus performance. - virtual void setNumTimeSubSteps(int numTimeSubSteps){} - ///setDeactivationTime sets the minimum time that an objects has to stay within the velocity tresholds until it gets fully deactivated - virtual void setDeactivationTime(float dTime) {} - ///setDeactivationLinearTreshold sets the linear velocity treshold, see setDeactivationTime - virtual void setDeactivationLinearTreshold(float linTresh) {} - ///setDeactivationAngularTreshold sets the angular velocity treshold, see setDeactivationTime - virtual void setDeactivationAngularTreshold(float angTresh) {} - ///setContactBreakingTreshold sets tresholds to do with contact point management - virtual void setContactBreakingTreshold(float contactBreakingTreshold) {} - ///continuous collision detection mode, very experimental for Bullet - virtual void setCcdMode(int ccdMode) {} - ///successive overrelaxation constant, in case PSOR is used, values in between 1 and 2 guarantee converging behaviour - virtual void setSolverSorConstant(float sor) {} - ///setSolverType, internal setting, chooses solvertype, PSOR, Dantzig, impulse based, penalty based - virtual void setSolverType(int solverType) {} - ///setTau sets the spring constant of a penalty based solver - virtual void setSolverTau(float tau) {} - ///setDamping sets the damper constant of a penalty based solver - virtual void setSolverDamping(float damping) {} - ///linear air damping for rigidbodies - virtual void setLinearAirDamping(float damping) {} - /// penetrationdepth setting - virtual void setUseEpa(bool epa) {} - - virtual void setGravity(float x,float y,float z)=0; - - virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type, - float pivotX,float pivotY,float pivotZ, - float axis0X,float axis0Y,float axis0Z, - float axis1X=0,float axis1Y=0,float axis1Z=0, - float axis2X=0,float axis2Y=0,float axis2Z=0,int flag=0 - )=0; - virtual void removeConstraint(int constraintid)=0; - virtual float getAppliedImpulse(int constraintid){ return 0.f;} - - - //complex constraint for vehicles - virtual PHY_IVehicle* getVehicleConstraint(int constraintId) =0; - - virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ)=0; - - //culling based on physical broad phase - // the plane number must be set as follow: near, far, left, right, top, botton - // the near plane must be the first one and must always be present, it is used to get the direction of the view - virtual bool cullingTest(PHY_CullingCallback callback, void *userData, PHY__Vector4* planeNormals, int planeNumber, int occlusionRes) = 0; - - //Methods for gamelogic collision/physics callbacks - //todo: - virtual void addSensor(PHY_IPhysicsController* ctrl)=0; - virtual void removeSensor(PHY_IPhysicsController* ctrl)=0; - virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user)=0; - virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl)=0; - virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl)=0; - //These two methods are *solely* used to create controllers for sensor! Don't use for anything else - virtual PHY_IPhysicsController* CreateSphereController(float radius,const PHY__Vector3& position) =0; - virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight)=0; - - virtual void setConstraintParam(int constraintId,int param,float value,float value1) = 0; - virtual float getConstraintParam(int constraintId,int param) = 0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IPhysicsEnvironment"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //_IPHYSICSENVIRONMENT - diff --git a/source/gameengine/Physics/common/PHY_IVehicle.cpp b/source/gameengine/Physics/common/PHY_IVehicle.cpp deleted file mode 100644 index 3879e83396f..00000000000 --- a/source/gameengine/Physics/common/PHY_IVehicle.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "PHY_IVehicle.h" - -PHY_IVehicle::~PHY_IVehicle() -{ - -} diff --git a/source/gameengine/Physics/common/PHY_IVehicle.h b/source/gameengine/Physics/common/PHY_IVehicle.h deleted file mode 100644 index 261bae480f5..00000000000 --- a/source/gameengine/Physics/common/PHY_IVehicle.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef PHY_IVEHICLE_H -#define PHY_IVEHICLE_H - -//PHY_IVehicle provides a generic interface for (raycast based) vehicles. Mostly targetting 4 wheel cars and 2 wheel motorbikes. - -class PHY_IMotionState; -#include "PHY_DynamicTypes.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class PHY_IVehicle -{ -public: - virtual ~PHY_IVehicle(); - - virtual void AddWheel( - PHY_IMotionState* motionState, - PHY__Vector3 connectionPoint, - PHY__Vector3 downDirection, - PHY__Vector3 axleDirection, - float suspensionRestLength, - float wheelRadius, - bool hasSteering - ) = 0; - - - virtual int GetNumWheels() const = 0; - - virtual void GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const = 0; - virtual void GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const = 0; - virtual float GetWheelRotation(int wheelIndex) const = 0; - - virtual int GetUserConstraintId() const =0; - virtual int GetUserConstraintType() const =0; - - //some basic steering/braking/tuning/balancing (bikes) - - virtual void SetSteeringValue(float steering,int wheelIndex) = 0; - - virtual void ApplyEngineForce(float force,int wheelIndex) = 0; - - virtual void ApplyBraking(float braking,int wheelIndex) = 0; - - virtual void SetWheelFriction(float friction,int wheelIndex) = 0; - - virtual void SetSuspensionStiffness(float suspensionStiffness,int wheelIndex) = 0; - - virtual void SetSuspensionDamping(float suspensionStiffness,int wheelIndex) = 0; - - virtual void SetSuspensionCompression(float suspensionStiffness,int wheelIndex) = 0; - - virtual void SetRollInfluence(float rollInfluence,int wheelIndex) = 0; - - virtual void SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) =0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IVehicle"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //PHY_IVEHICLE_H diff --git a/source/gameengine/Physics/common/PHY_Pro.h b/source/gameengine/Physics/common/PHY_Pro.h deleted file mode 100644 index d51992da372..00000000000 --- a/source/gameengine/Physics/common/PHY_Pro.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef PHY_PROPSH -#define PHY_PROPSH - -#include - -// Properties of dynamic objects -struct PHY_ShapeProps { - MT_Scalar m_mass; // Total mass - MT_Scalar m_inertia; // Inertia, should be a tensor some time - MT_Scalar m_lin_drag; // Linear drag (air, water) 0 = concrete, 1 = vacuum, inverted and called dampening in blenders UI - MT_Scalar m_ang_drag; // Angular drag, inverted and called dampening in blenders UI - MT_Scalar m_friction_scaling[3]; // Scaling for anisotropic friction. Component in range [0, 1] - MT_Scalar m_clamp_vel_min; // Clamp the minimum velocity, this ensures an object moves at a minimum speed unless its stationary - MT_Scalar m_clamp_vel_max; // Clamp max velocity - bool m_do_anisotropic; // Should I do anisotropic friction? - bool m_do_fh; // Should the object have a linear Fh spring? - bool m_do_rot_fh; // Should the object have an angular Fh spring? -}; - - -// Properties of collidable objects (non-ghost objects) -struct PHY_MaterialProps { - MT_Scalar m_restitution; // restitution of energie after a collision 0 = inelastic, 1 = elastic - MT_Scalar m_friction; // Coulomb friction (= ratio between the normal en maximum friction force) - MT_Scalar m_fh_spring; // Spring constant (both linear and angular) - MT_Scalar m_fh_damping; // Damping factor (linear and angular) in range [0, 1] - MT_Scalar m_fh_distance; // The range above the surface where Fh is active. - bool m_fh_normal; // Should the object slide off slopes? -}; - -#endif //PHY_PROPSH - diff --git a/source/gameengine/Physics/common/SConscript b/source/gameengine/Physics/common/SConscript deleted file mode 100644 index 719c028ee8f..00000000000 --- a/source/gameengine/Physics/common/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = 'PHY_IMotionState.cpp PHY_IController.cpp PHY_IPhysicsController.cpp PHY_IGraphicController.cpp PHY_IPhysicsEnvironment.cpp PHY_IVehicle.cpp' - -incs = '. ../Dummy #intern/moto/include' - -env.BlenderLib ( 'bf_physics_common', Split(sources), Split(incs), [], libtype=['core','player'], priority=[360,55], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/PyDoc/API_intro.py b/source/gameengine/PyDoc/API_intro.py deleted file mode 100644 index 097abbfbf1a..00000000000 --- a/source/gameengine/PyDoc/API_intro.py +++ /dev/null @@ -1,110 +0,0 @@ -# This is not a real module, it's simply an introductory text. - -""" -The Blender Game Engine Python API Reference -============================================ - - See U{release notes} for updates, changes and new functionality in the Game Engine Python API. - - Blender Game Engine Modules: - ---------------------------- - - Modules that include methods for accessing GameEngine data and functions. - - - L{GameLogic} utility functons for game logic. - - L{GameKeys} keyboard input and event conversion. - - L{Rasterizer} display and rendering. - - L{GameTypes} contains all the python types spesific to the GameEngine. - - Modules with documentation in progress: - --------------------- - - L{VideoTexture} - - L{PhysicsConstraints} - - Additional Modules: - ------------------- - - These modules have no GameEngine specific functionality but are useful in many cases. - - - L{mathutils} - - L{Geometry} - - L{BGL} - - -Introduction: -============= - - This reference documents the Blender Python API, a growing collection of - Python modules (libraries) that give access to part of the program's internal - data and functions. - - Through scripting Blender can be extended in real-time via - U{Python }, an impressive high level, multi-paradigm, open - source language. Newcomers are recommended to start with the tutorial that - comes with it. - - This opens many interesting possibilities not available with logic bricks. - - Game Engine API Stability: - -------------------------- - - When writing python scripts there are a number of situations you should avoid to prevent crashes or unstable behavior. - While the API tries to prevent problems there are some situations where error checking would be too time consuming. - - Known cases: - - Memory Limits. - - There is nothing stopping you from filling a list or making a string so big that that causes blender to run out of memory, in this case python should rasie a MemoryError, but its likely blender will crash before this point. - - - Accessing any data that has been freed. - - For instance accessing a KX_GameObject after its End Object actuator runs. - This will cause a SystemError, however for L{KX_MeshProxy}, L{KX_VertexProxy} and L{KX_VertexProxy} it will crash the blender game engine. - - See: L{GameTypes.PyObjectPlus.invalid} which many types inherit. - - - Mixing L{KX_GameObject} between scenes. - - For instance tracking/parenting an L{KX_GameObject} object to an object from other scene. - - External Modules: - ----------------- - - Since 2.49 support for importing modules has been added. - - This allows you to import any blender textblock with a .py extension. - - External python scripts may be imported as modules when the script is in the same directory as the blend file. - - The current blend files path is included in the sys.path for loading modules. - All linked libraries will also be included so you can be sure when linking in assets from another blend file the scripts will load too. - - A note to newbie script writers: - -------------------------------- - - Interpreted languages are known to be much slower than compiled code, but for - many applications the difference is negligible or acceptable. Also, with - profiling (or even simple direct timing with L{Blender.sys.time}) to - identify slow areas and well thought optimizations, the speed can be - I{considerably} improved in many cases. Try some of the best BPython scripts - to get an idea of what can be done, you may be surprised. - -@author: The Blender Python Team -@requires: Blender 2.49 or newer. -@version: 2.49 -@see: U{www.blender.org}: documentation and forum -@see: U{blenderartists.org}: user forum -@see: U{projects.blender.org} -@see: U{www.python.org} -@see: U{www.python.org/doc} -@see: U{Blending into Python}: User contributed documentation, featuring a blender/python cookbook with many examples. - -@note: the official version of this reference guide is only updated for each - new Blender release. But you can build the current SVN - version yourself: install epydoc, grab all files in the - source/gameengine/PyDoc/ folder of Blender's SVN and use the - epy_docgen.sh script also found there to generate the html docs. - Naturally you will also need a recent Blender binary to try the new - features. If you prefer not to compile it yourself, there is a testing - builds forum at U{blender.org}. -""" diff --git a/source/gameengine/PyDoc/PhysicsConstraints.py b/source/gameengine/PyDoc/PhysicsConstraints.py deleted file mode 100644 index 2859aedd2d1..00000000000 --- a/source/gameengine/PyDoc/PhysicsConstraints.py +++ /dev/null @@ -1,294 +0,0 @@ -# $Id$ -""" -Documentation for the PhysicsConstraints module. -================================================ - -Example:: - - - # Adding a point constraint # - ############################### - - - # import BGE internal module - import PhysicsConstraints - - # get object list - obj_list = GameLogic.getCurrentScene().objects - - # get object named Obj_1 - root = obj_list["root"] - obj = obj_list["obj"] - - # get object physics ID - phido = obj.getPhysicsId() - - # get root physics ID - phidr = root.getPhysicsId() - - # want to use point constraint type - constraint_type = 1 - - # Use bottom right front corner of object for point constraint position - point_pos_x = 1.0 - point_pos_y = -1.0 - point_pos_z = -1.0 - - # create a point constraint - const = PhysicsConstraints.createConstraint( phido, phidr, constraint_type, point_pos_x, point_pos_y, point_pos_z) - - # stores the new constraint ID to be used later - obj["constraint_ID"] = const.getConstraintId() - - -Example:: - - - # Removing a point constraint # - ################################# - - - # import BGE internal module - import PhysicsConstraints - - # get object list - obj_list = GameLogic.getCurrentScene().objects - - # get object 1 - obj = obj_list["obj"] - - # get constraint ID that was saved as an obj property - # when the constraint was created - constraint_ID = obj["constraint_ID"] - - # remove constraint - PhysicsConstraints.removeConstraint(constraint_ID) - -""" - -def createConstraint(obj_PhysicsID, root_PhysicsID, constraintType, pointPos_x, pointPos_y, pointPos_z, edgePos_x, edgePos_y, edgePos_z, edgeAngle_x, edgeAngle_y, edgeAngle_z): - """ - Create a point constraint between two objects, an edge constraint between two objects, or a vehicle constraint on an object. - - You only have to input the needed parammeters depending on the type of constraint you are trying to create. - - - B{Point Constraint} :: - - While creating a point constraint, the "pointPos" values define where you want the pivot point to be located. - If you are creating a point constraint be sure to assing the integer "1" as the constraintType value. - - Parameters to use: - obj_PhysicsID, root_PhysicsID, constraintType, pointPos_x, pointPos_y, pointPos_z - - B{Edge Constraint} :: - - While creating an edge constraint, the "edgePos" values define where you want the center of the edge constraint to be. - Also, the "edgeAngle" values define in which direction you want the edge constraint to point (As a 3 dimensions vector). - If you want to create an edge constraint be sure to assing the integer "2" as the constraintType value. - - Parameters to use: - obj_PhysicsID, root_PhysicsID, constraintType, edgePos_x, edgePos_y, edgePos_z, edgeAngle_x, edgeAngle_y, edgeAngle_z} - - B{Vehicle Constraint} :: - - While creating a point constraint, the "pointPos" values define where you want the pivot point to be located. - If you want to create an edge constraint be sure to assing the integer "0" as the constraintType value. - - Parameters to use : - obj_PhysicsID, root_PhysicsID, constraintType - - @type obj_PhysicsID: integer - @param obj_PhysicsID: The physic ID of the first object to constraint. - - @type root_PhysicsID: integer - @param root_PhysicsID: The physic ID of the second object to constraint. - - @type constraintType: integer - @param constraintType: The type of constraint. - - @type pointPos_x: float - @param pointPos_x: The X position of the point constraint. - - @type pointPos_y: float - @param pointPos_y: The Y position of the point constraint. - - @type pointPos_z: float - @param pointPos_z: The Z position of the point constraint. - - @type edgePos_x: float - @param edgePos_x: The X value of the center of the edge constraint. - - @type edgePos_y: float - @param edgePos_y: The Y value of the center of the edge constraint. - - @type edgePos_z: float - @param edgePos_z: The Z value of the center of the edge constraint. - - @type edgeAngle_x: float - @param edgeAngle_x: The X value of the edge's orientation vector. - - @type edgeAngle_y: float - @param edgeAngle_y: The Y value of the edge's orientation vector. - - @type edgeAngle_z: float - @param edgeAngle_z: The Z value of the edge's orientation vector. - - @rtype: integer - @return: The created constraint ID - """ - - -def getAppliedImpulse(constraint_ID): - """ - Returns the applied impulse. - - @param constraint_ID: The constraint ID that was saved on the creation of the constraint. - @type constraint_ID: integer - @rtype: float - @return: Measure the stress on a constraint. - """ - - -def getVehicleConstraint(constraint_ID): - """ - Returns the vehicle constraint ID. - - @param constraint_ID: The constraint ID that was saved on the creation of the constraint. - @type constraint_ID: integer - @rtype: integer - """ -def removeConstraint(constraint_ID): - """ - - Removes the constraint between 2 game objects (point and edge constraints). - - It does not remove vehicle constraints. - - @param constraint_ID: The constraint ID that was saved on the creation of the constraint. - @type constraint_ID: integer - """ -def setDeactivationLinearTreshold(linearTreshold): - """ - - Sets the linear velocity that an object must be below before the deactivation timer can start. - - This affects every object in the scene, except for game objects that have 'No sleeping' turned on. - - @param linearTreshold: The linear velocity. - @type linearTreshold: float - """ -def setDeactivationAngularTreshold(angularTreshold): - """ - - Sets the angular velocity that an object must be below before the deactivation timer can start. - - This affects every object in the scene, except for game objects that have 'No sleeping' turned on. - - @param angularTreshold: The angular velocity. - @type angularTreshold: float - """ -def setDeactivationTime(time): - """ - - Time (in seconds) after objects with velocity less then thresholds (see below) are deactivated. - - This affects every object in the scene, except for game objects that have 'No sleeping' turned on. - - This function is directly related with the 2 above functions. - - - @param time: The time in seconds. - @type time: float - """ -def setGravity(gx, gy, gz): - """ - Sets the gravity for the actual scene only. - - All other scenes remain unaffected. - - This affects every object in the scene that has physics enabled. - - @param gx: The force of gravity on world x axis. - @type gx: float - @param gy: The force of gravity on world y axis. - @type gy: float - @param gz: The force of gravity on world z axis. - @type gz: float - """ -def setLinearAirDamping(damping): - """ - - Sets the linear air resistance for all objects in the scene. - - @param damping: The linear air resistance. - @type damping: float - """ -def setNumIterations(numIter): - """ - Sets the number of times an iterative constraint solver is repeated. - - Increasing the number of iterations improves the constraint solver at the cost of performances & the speed of the game engine. - - @param numIter: The number of timesubsteps. (Input 0 to suspend simulation numSubStep) - @type numIter: integer - """ -def setNumTimeSubSteps(numSubStep): - """ - Set the quality of the entire physics simulation including collision detection and constraint solver. - - Increase the number of time substeps to improves the quality of the entire physics simulation at the cost of the performance & the speed of the game engine. - - @param numSubStep: The number of timesubsteps. (Input 0 to suspend simulation numSubStep) - @type numSubStep: integer - """ -#def setDebugMode(): -# """ -# -# -# -# @param numIter: -# @type numIter: -# """ -#def setCcdMode(): -# """ -# Does something -# -# @rtype: -# """ -#def setContactBreakingTreshold(): -# """ -# Does something -# -# @rtype: -# """ -#def setSolverDamping(): -# """ -# Does something -# -# @rtype: -# """ -#def setSolverTau(): -# """ -# Does something -# -# @rtype: -# """ -#def setSolverType(): -# """ -# Does something -# -# @rtype: -# """ -#def setSorConstant(): -# """ -# Does something -# -# @rtype: -# """ -#def setUseEpa(): -# """ -# Does something -# -# @rtype: -# """ \ No newline at end of file diff --git a/source/gameengine/PyDoc/SConscript b/source/gameengine/PyDoc/SConscript deleted file mode 100644 index dabe004ae6a..00000000000 --- a/source/gameengine/PyDoc/SConscript +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/python -Import ('env') -import os - -if env['WITH_BF_FHS']: - BLENDERPATH = os.path.join(env['BF_INSTALLDIR'], 'share', 'blender', env['BF_VERSION']) -else: - BLENDERPATH = env['BF_INSTALLDIR'] - -from optparse import OptionParser -import epydoc -from epydoc.docbuilder import build_doc_index -from epydoc import cli -names = env.Glob("source/gameengine/PyDoc/*.py") -docindex = build_doc_index(names) -optvalues = cli.OPTION_DEFAULTS -optvalues["verbose"] = 1 -optvalues["quiet"] = 0 -optvalues["include_source_code"] = 0 -optvalues["inheritance"] = "included" -optvalues["show_private"] = 0 -optvalues["target"] = os.path.join(BLENDERPATH, 'doc') -optvalues["url"] = "http://www.blender.org" -optvalues["top"] = "Game Engine API" -optvalues["name"] = "Blender" -optvalues["noprivate"] = 1 -optvalues["noframes"] = 1 -optvalues["names"] = names -optparser = OptionParser() -optparser.set_defaults(**optvalues) -(options, args) = optparser.parse_args([]) -print "Writing Game Engine epydocs to \"%s\"" % optvalues["target"] -cli.write_html(docindex, options) - diff --git a/source/gameengine/PyDoc/VideoTexture.py b/source/gameengine/PyDoc/VideoTexture.py deleted file mode 100644 index 186d621557f..00000000000 --- a/source/gameengine/PyDoc/VideoTexture.py +++ /dev/null @@ -1,218 +0,0 @@ -# $Id$ -""" -The VideoTexture module allows you to manipulate textures during the game. - -Several sources for texture are possible: video files, image files, -video capture, memory buffer, camera render or a mix of that. - -The video and image files can be loaded from the internet using an URL -instead of a file name. - -In addition, you can apply filters on the images before sending them to the GPU, allowing video effect: blue screen, -color band, gray, normal map. - -VideoTexture uses FFmpeg to load images and videos. All the formats and codecs -that FFmpeg supports are supported by VideoTexture, including but not limited to:: - - * AVI - * Ogg - * Xvid - * Theora - * dv1394 camera - * video4linux capture card (this includes many webcams) - * videoForWindows capture card (this includes many webcams) - * JPG - -The principle is simple: first you identify a texture on an existing object using -the L{materialID} function, then you create a new texture with dynamic content -and swap the two textures in the GPU. - -The GE is not aware of the substitution and continues to display the object as always, -except that you are now in control of the texture. - -When the texture object is deleted, the new texture is deleted and the old texture restored. - -Example:: - import VideoTexture - import GameLogic - - contr = GameLogic.getCurrentController() - obj = contr.owner - - # the creation of the texture must be done once: save the - # texture object in an attribute of GameLogic module makes it persistent - if not hasattr(GameLogic, 'video'): - - # identify a static texture by name - matID = VideoTexture.materialID(obj, 'IMvideo.png') - - # create a dynamic texture that will replace the static texture - GameLogic.video = VideoTexture.Texture(obj, matID) - - # define a source of image for the texture, here a movie - movie = GameLogic.expandPath('//trailer_400p.ogg') - GameLogic.video.source = VideoTexture.VideoFFmpeg(movie) - GameLogic.video.source.scale = True - - # quick off the movie, but it wont play in the background - GameLogic.video.source.play() - - # you need to call this function every frame to ensure update of the texture. - GameLogic.video.refresh(True) - - -""" -def getLastError(): - """ - Returns the description of the last error that occured in a VideoTexture function. - - @rtype: string - """ -def imageToArray(image,mode): - """ - Returns a BGL.buffer corresponding to the current image stored in a texture source object - - @param image: Image source object. - @type image: object of type L{VideoFFmpeg}, L{ImageFFmpeg}, L{ImageBuff}, L{ImageMix}, L{ImageRender}, L{ImageMirror} or L{ImageViewport} - @param mode: optional argument representing the pixel format. - You can use the characters R, G, B for the 3 color channels, A for the alpha channel, - 0 to force a fixed 0 color channel and 1 to force a fixed 255 color channel. - Example: "BGR" will return 3 bytes per pixel with the Blue, Green and Red channels in that order. \ - "RGB1" will return 4 bytes per pixel with the Red, Green, Blue channels in that order and the alpha channel forced to 255. - The default mode is "RGBA". - @type mode: string - @rtype: BGL.buffer - @returns: object representing the image as one dimensional array of bytes of size (pixel_size*width*height), line by line starting from the bottom of the image. The pixel size and format is determined by the mode parameter. - """ - -def materialID(object,name): - """ - Returns a numeric value that can be used in L{Texture} to create a dynamic texture. - - The value corresponds to an internal material number that uses the texture identified - by name. name is a string representing a texture name with IM prefix if you want to - identify the texture directly. This method works for basic tex face and for material, - provided the material has a texture channel using that particular texture in first - position of the texture stack. name can also have MA prefix if you want to identify - the texture by material. In that case the material must have a texture channel in first - position. - - If the object has no material that matches name, it generates a runtime error. Use try/except to catch the exception. - - Ex: VideoTexture.materialID(obj, 'IMvideo.png') - - @param object: the game object that uses the texture you want to make dynamic - @type object: game object - @param name: name of the texture/material you want to make dynamic. - @type name: string - @rtype: integer - """ -def setLogFile(filename): - """ - Sets the name of a text file in which runtime error messages will be written, in addition to the printing - of the messages on the Python console. Only the runtime errors specific to the VideoTexture module - are written in that file, ordinary runtime time errors are not written. - - @param filename: name of error log file - @type filename: string - @rtype: integer - """ -def FilterBGR24(): - """ - Returns a new input filter object to be used with L{ImageBuff} object when the image passed - to the ImageBuff.load() function has the 3-bytes pixel format BGR. - - @rtype: object of type FilterBGR24 - """ -def FilterBlueScreen(): - """ - Does something - - @rtype: - """ -def FilterColor(): - """ - Does something - - @rtype: - """ -def FilterGray(): - """ - Does something - - @rtype: - """ -def FilterLevel(): - """ - Does something - - @rtype: - """ -def FilterNormal(): - """ - Does something - - @rtype: - """ -def FilterRGB24(): - """ - Returns a new input filter object to be used with L{ImageBuff} object when the image passed - to the ImageBuff.load() function has the 3-bytes pixel format RBG. - - @rtype: object of type FilterRGB24 - """ -def FilterRGBA32(): - """ - Returns a new input filter object to be used with L{ImageBuff} object when the image passed - to the ImageBuff.load() function has the 4-bytes pixel format RGBA. - - @rtype: object of type FilterRGBA32 - """ -def ImageBuff(): - """ - Does something - - @rtype: - """ -def ImageFFmpeg(): - """ - Does something - - @rtype: - """ -def ImageMirror(): - """ - Does something - - @rtype: - """ -def ImageMix(): - """ - Does something - - @rtype: - """ -def ImageRender(): - """ - Does something - - @rtype: - """ -def ImageViewport(): - """ - Does something - - @rtype: - """ -def Texture(): - """ - Does something - - @rtype: L{Texture} - """ -def VideoFFmpeg(): - """ - Does something - - @rtype: - """ \ No newline at end of file diff --git a/source/gameengine/PyDoc/bge.events.rst b/source/gameengine/PyDoc/bge.events.rst deleted file mode 100644 index afdcf39f178..00000000000 --- a/source/gameengine/PyDoc/bge.events.rst +++ /dev/null @@ -1,194 +0,0 @@ - -Game Engine bge.events module. -============================== - -This module holds key constants for the SCA_KeyboardSensor. - -.. module:: bge.events - -.. code-block:: python - - # Set a connected keyboard sensor to accept F1 - import bge - - co = bge.logic.getCurrentController() - # 'Keyboard' is a keyboard sensor - sensor = co.sensors["Keyboard"] - sensor.key = bge.keys.F1KEY - -.. code-block:: python - - # Do the all keys thing - import bge - - co = bge.logic.getCurrentController() - # 'Keyboard' is a keyboard sensor - sensor = co.sensors["Keyboard"] - - for key,status in sensor.events: - # key[0] == bge.keys.keycode, key[1] = status - if status == bge.logic.KX_INPUT_JUST_ACTIVATED: - if key == bge.keys.WKEY: - # Activate Forward! - if key == bge.keys.SKEY: - # Activate Backward! - if key == bge.keys.AKEY: - # Activate Left! - if key == bge.keys.DKEY: - # Activate Right! - -.. function:: EventToString(event) - - Return the string name of a key event. Will raise a ValueError error if its invalid. - - :arg event: key event from bge.keys or the keyboard sensor. - :type event: int - :rtype: string - -.. function:: EventToCharacter(event, shift) - - Return the string name of a key event. Returns an empty string if the event cant be represented as a character. - - :type event: int - :arg event: key event from :mod:`bge.keys` or the keyboard sensor. - :type shift: bool - :arg shift: set to true if shift is held. - :rtype: string - - -**Alphabet keys** - -.. data:: AKEY -.. data:: BKEY -.. data:: CKEY -.. data:: DKEY -.. data:: EKEY -.. data:: FKEY -.. data:: GKEY -.. data:: HKEY -.. data:: IKEY -.. data:: JKEY -.. data:: KKEY -.. data:: LKEY -.. data:: MKEY -.. data:: NKEY -.. data:: OKEY -.. data:: PKEY -.. data:: QKEY -.. data:: RKEY -.. data:: SKEY -.. data:: TKEY -.. data:: UKEY -.. data:: VKEY -.. data:: WKEY -.. data:: XKEY -.. data:: YKEY -.. data:: ZKEY - -**Number keys** - -.. data:: ZEROKEY -.. data:: ONEKEY -.. data:: TWOKEY -.. data:: THREEKEY -.. data:: FOURKEY -.. data:: FIVEKEY -.. data:: SIXKEY -.. data:: SEVENKEY -.. data:: EIGHTKEY -.. data:: NINEKEY - -**Modifiers** - -.. data:: CAPSLOCKKEY -.. data:: LEFTCTRLKEY -.. data:: LEFTALTKEY -.. data:: RIGHTALTKEY -.. data:: RIGHTCTRLKEY -.. data:: RIGHTSHIFTKEY -.. data:: LEFTSHIFTKEY - -**Arrow Keys** - -.. data:: LEFTARROWKEY -.. data:: DOWNARROWKEY -.. data:: RIGHTARROWKEY -.. data:: UPARROWKEY - -**Numberpad Keys** - -.. data:: PAD0 -.. data:: PAD1 -.. data:: PAD2 -.. data:: PAD3 -.. data:: PAD4 -.. data:: PAD5 -.. data:: PAD6 -.. data:: PAD7 -.. data:: PAD8 -.. data:: PAD9 -.. data:: PADPERIOD -.. data:: PADSLASHKEY -.. data:: PADASTERKEY -.. data:: PADMINUS -.. data:: PADENTER -.. data:: PADPLUSKEY - -**Function Keys** - -.. data:: F1KEY -.. data:: F2KEY -.. data:: F3KEY -.. data:: F4KEY -.. data:: F5KEY -.. data:: F6KEY -.. data:: F7KEY -.. data:: F8KEY -.. data:: F9KEY -.. data:: F10KEY -.. data:: F11KEY -.. data:: F12KEY -.. data:: F13KEY -.. data:: F14KEY -.. data:: F15KEY -.. data:: F16KEY -.. data:: F17KEY -.. data:: F18KEY -.. data:: F19KEY - -**Other Keys** - -.. data:: ACCENTGRAVEKEY -.. data:: BACKSLASHKEY -.. data:: BACKSPACEKEY -.. data:: COMMAKEY -.. data:: DELKEY -.. data:: ENDKEY -.. data:: EQUALKEY -.. data:: ESCKEY -.. data:: HOMEKEY -.. data:: INSERTKEY -.. data:: LEFTBRACKETKEY -.. data:: LINEFEEDKEY -.. data:: MINUSKEY -.. data:: PAGEDOWNKEY -.. data:: PAGEUPKEY -.. data:: PAUSEKEY -.. data:: PERIODKEY -.. data:: QUOTEKEY -.. data:: RIGHTBRACKETKEY -.. data:: RETKEY -.. data:: SEMICOLONKEY -.. data:: SLASHKEY -.. data:: SPACEKEY -.. data:: TABKEY - -**Mouse Events** - -.. data:: LEFTMOUSE -.. data:: MIDDLEMOUSE -.. data:: RIGHTMOUSE -.. data:: WHEELUPMOUSE -.. data:: WHEELDOWNMOUSE -.. data:: MOUSEX -.. data:: MOUSEY: diff --git a/source/gameengine/PyDoc/bge.logic.rst b/source/gameengine/PyDoc/bge.logic.rst deleted file mode 100644 index 7fb2c3df67a..00000000000 --- a/source/gameengine/PyDoc/bge.logic.rst +++ /dev/null @@ -1,622 +0,0 @@ - -Game Engine bge.logic Module. -============================= - -Module to access logic functions, imported automatically into the python controllers namespace. - -.. module:: bge.logic - -.. code-block:: python - - # To get the controller thats running this python script: - cont = bge.logic.getCurrentController() # bge.logic is automatically imported - - # To get the game object this controller is on: - obj = cont.owner - -:class:`bge.types.KX_GameObject` and :class:`bge.types.KX_Camera` or :class:`bge.types.KX_LightObject` methods are available depending on the type of object - -.. code-block:: python - - # To get a sensor linked to this controller. - # "sensorname" is the name of the sensor as defined in the Blender interface. - # +---------------------+ +--------+ - # | Sensor "sensorname" +--+ Python + - # +---------------------+ +--------+ - sens = cont.sensors["sensorname"] - - # To get a sequence of all sensors: - sensors = co.sensors - -See the sensor's reference for available methods: - -* :class:`bge.types.SCA_DelaySensor` -* :class:`bge.types.SCA_JoystickSensor` -* :class:`bge.types.SCA_KeyboardSensor` -* :class:`bge.types.KX_MouseFocusSensor` -* :class:`bge.types.SCA_MouseSensor` -* :class:`bge.types.KX_NearSensor` -* :class:`bge.types.KX_NetworkMessageSensor` -* :class:`bge.types.SCA_PropertySensor` -* :class:`bge.types.KX_RadarSensor` -* :class:`bge.types.SCA_RandomSensor` -* :class:`bge.types.KX_RaySensor` -* :class:`bge.types.KX_TouchSensor` - -You can also access actuators linked to the controller - -.. code-block:: python - - # To get an actuator attached to the controller: - # +--------+ +-------------------------+ - # + Python +--+ Actuator "actuatorname" | - # +--------+ +-------------------------+ - actuator = co.actuators["actuatorname"] - - # Activate an actuator - controller.activate(actuator) - - -See the actuator's reference for available methods - -* :class:`bge.types.SCA_2DFilterActuator` -* :class:`bge.types.BL_ActionActuator` -* :class:`bge.types.KX_SCA_AddObjectActuator` -* :class:`bge.types.KX_CameraActuator` -* :class:`bge.types.KX_ConstraintActuator` -* :class:`bge.types.KX_SCA_DynamicActuator` -* :class:`bge.types.KX_SCA_EndObjectActuator` -* :class:`bge.types.KX_GameActuator` -* :class:`bge.types.KX_IpoActuator` -* :class:`bge.types.KX_NetworkMessageActuator` -* :class:`bge.types.KX_ObjectActuator` -* :class:`bge.types.KX_ParentActuator` -* :class:`bge.types.SCA_PropertyActuator` -* :class:`bge.types.SCA_RandomActuator` -* :class:`bge.types.KX_SCA_ReplaceMeshActuator` -* :class:`bge.types.KX_SceneActuator` -* :class:`bge.types.BL_ShapeActionActuator` -* :class:`bge.types.KX_SoundActuator` -* :class:`bge.types.KX_StateActuator` -* :class:`bge.types.KX_TrackToActuator` -* :class:`bge.types.KX_VisibilityActuator` - -Most logic brick's methods are accessors for the properties available in the logic buttons. -Consult the logic bricks documentation for more information on how each logic brick works. - -There are also methods to access the current :class:`bge.types.KX_Scene` - -.. code-block:: python - - # Get the current scene - scene = bge.logic.getCurrentScene() - - # Get the current camera - cam = scene.active_camera - -Matricies as used by the game engine are **row major** -``matrix[row][col] = float`` - -:class:`bge.types.KX_Camera` has some examples using matricies. - - -.. data:: globalDict - - A dictionary that is saved between loading blend files so you can use it to store inventory and other variables you want to store between scenes and blend files. - It can also be written to a file and loaded later on with the game load/save actuators. - - .. note:: only python built in types such as int/string/bool/float/tuples/lists can be saved, GameObjects, Actuators etc will not work as expectred. - -.. data:: keyboard: The current keyboard wrapped in an SCA_PythonKeyboard object. -.. data:: mouse: The current mouse wrapped in an SCA_PythonMouse object. - -.. function:: getCurrentController() - - Gets the Python controller associated with this Python script. - - :rtype: :class:`bge.types.SCA_PythonController` - -.. function:: getCurrentScene() - - Gets the current Scene. - - :rtype: :class:`bge.types.KX_Scene` - -.. function:: getSceneList() - - Gets a list of the current scenes loaded in the game engine. - - :rtype: list of :class:`bge.types.KX_Scene` - - .. note:: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes. - -.. function:: loadGlobalDict() - - Loads bge.logic.globalDict from a file. - -.. function:: saveGlobalDict() - - Saves bge.logic.globalDict to a file. - -.. function:: addScene(name, overlay=1) - - Loads a scene into the game engine. - - :arg name: The name of the scene - :type name: string - :arg overlay: Overlay or underlay (optional) - :type overlay: integer - -.. function:: sendMessage(subject, body="", to="", message_from="") - - Sends a message to sensors in any active scene. - - :arg subject: The subject of the message - :type subject: string - :arg body: The body of the message (optional) - :type body: string - :arg to: The name of the object to send the message to (optional) - :type to: string - :arg message_from: The name of the object that the message is coming from (optional) - :type message_from: string - -.. function:: setGravity(gravity) - - Sets the world gravity. - - :type gravity: list [fx, fy, fz] - -.. function:: getSpectrum() - - Returns a 512 point list from the sound card. - This only works if the fmod sound driver is being used. - - :rtype: list [float], len(getSpectrum()) == 512 - -.. function:: stopDSP() - - Stops the sound driver using DSP effects. - - Only the fmod sound driver supports this. - DSP can be computationally expensive. - -.. function:: getMaxLogicFrame() - - Gets the maximum number of logic frame per render frame. - - :return: The maximum number of logic frame per render frame - :rtype: integer - -.. function:: setMaxLogicFrame(maxlogic) - - Sets the maximum number of logic frame that are executed per render frame. - This does not affect the physic system that still runs at full frame rate. - - :arg maxlogic: The new maximum number of logic frame per render frame. Valid values: 1..5 - :type maxlogic: integer - -.. function:: getMaxPhysicsFrame() - - Gets the maximum number of physics frame per render frame. - - :return: The maximum number of physics frame per render frame - :rtype: integer - -.. function:: setMaxPhysicsFrame(maxphysics) - - Sets the maximum number of physics timestep that are executed per render frame. - Higher value allows physics to keep up with realtime even if graphics slows down the game. - Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate) - maxphysics/ticrate is the maximum delay of the renderer that physics can compensate. - - :arg maxphysics: The new maximum number of physics timestep per render frame. Valid values: 1..5. - :type maxphysics: integer - -.. function:: getLogicTicRate() - - Gets the logic update frequency. - - :return: The logic frequency in Hz - :rtype: float - -.. function:: setLogicTicRate(ticrate) - - Sets the logic update frequency. - - The logic update frequency is the number of times logic bricks are executed every second. - The default is 60 Hz. - - :arg ticrate: The new logic update frequency (in Hz). - :type ticrate: float - -.. function:: getPhysicsTicRate() - - Gets the physics update frequency - - :return: The physics update frequency in Hz - :rtype: float - - .. warning: Not implimented yet - -.. function:: setPhysicsTicRate(ticrate) - - Sets the physics update frequency - - The physics update frequency is the number of times the physics system is executed every second. - The default is 60 Hz. - - :arg ticrate: The new update frequency (in Hz). - :type ticrate: float - - .. warning: Not implimented yet - -.. function:: saveGlobalDict() - - Saves bge.logic.globalDict to a file. - -.. function:: loadGlobalDict() - - Loads bge.logic.globalDict from a file. - - -Utility functions - -.. function:: getAverageFrameRate() - - Gets the estimated average framerate - - :return: The estimed average framerate in frames per second - :rtype: float - -.. function:: expandPath(path) - - Converts a blender internal path into a proper file system path. - - Use / as directory separator in path - You can use '//' at the start of the string to define a relative path; - Blender replaces that string by the directory of the startup .blend or runtime file - to make a full path name (doesn't change during the game, even if you load other .blend). - The function also converts the directory separator to the local file system format. - - :arg path: The path string to be converted/expanded. - :type path: string - :return: The converted string - :rtype: string - - -.. function:: getBlendFileList(path = "//") - - Returns a list of blend files in the same directory as the open blend file, or from using the option argument. - - :arg path: Optional directory argument, will be expanded (like expandPath) into the full path. - :type path: string - :return: A list of filenames, with no directory prefix - :rtype: list - -.. function:: PrintGLInfo() - - Prints GL Extension Info into the console - -.. function:: getRandomFloat() - - Returns a random floating point value in the range [0 - 1) - -========= -Constants -========= - -.. data:: KX_TRUE: True value used by some modules. -.. data:: KX_FALSE: False value used by some modules. - ---------------- -Property Sensor ---------------- - -.. data:: KX_PROPSENSOR_EQUAL - - Activate when the property is equal to the sensor value. - -.. data:: KX_PROPSENSOR_NOTEQUAL - - Activate when the property is not equal to the sensor value. - -.. data:: KX_PROPSENSOR_INTERVAL - - Activate when the property is between the specified limits. - -.. data:: KX_PROPSENSOR_CHANGED - - Activate when the property changes - -.. data:: KX_PROPSENSOR_EXPRESSION - - Activate when the expression matches - -------------------- -Constraint Actuator -------------------- - -See :class:`bge.types.KX_ConstraintActuator` - -.. data:: KX_CONSTRAINTACT_LOCX -.. data:: KX_CONSTRAINTACT_LOCY -.. data:: KX_CONSTRAINTACT_LOCZ -.. data:: KX_CONSTRAINTACT_ROTX -.. data:: KX_CONSTRAINTACT_ROTY -.. data:: KX_CONSTRAINTACT_ROTZ -.. data:: KX_CONSTRAINTACT_DIRNX -.. data:: KX_CONSTRAINTACT_DIRNY -.. data:: KX_CONSTRAINTACT_DIRPX -.. data:: KX_CONSTRAINTACT_DIRPY -.. data:: KX_CONSTRAINTACT_ORIX -.. data:: KX_CONSTRAINTACT_ORIY -.. data:: KX_CONSTRAINTACT_ORIZ - ------------- -IPO Actuator ------------- - -See :class:`bge.types.KX_IpoActuator` - -.. data:: KX_IPOACT_PLAY -.. data:: KX_IPOACT_PINGPONG -.. data:: KX_IPOACT_FLIPPER -.. data:: KX_IPOACT_LOOPSTOP -.. data:: KX_IPOACT_LOOPEND -.. data:: KX_IPOACT_FROM_PROP - --------------------- -Random Distributions --------------------- - -See :class:`bge.types.SCA_RandomActuator` - -.. data:: KX_RANDOMACT_BOOL_CONST -.. data:: KX_RANDOMACT_BOOL_UNIFORM -.. data:: KX_RANDOMACT_BOOL_BERNOUILLI -.. data:: KX_RANDOMACT_INT_CONST -.. data:: KX_RANDOMACT_INT_UNIFORM -.. data:: KX_RANDOMACT_INT_POISSON -.. data:: KX_RANDOMACT_FLOAT_CONST -.. data:: KX_RANDOMACT_FLOAT_UNIFORM -.. data:: KX_RANDOMACT_FLOAT_NORMAL -.. data:: KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL - ---------------- -Action Actuator ---------------- - -See :class:`bge.types.BL_ActionActuator` - -.. data:: KX_ACTIONACT_PLAY -.. data:: KX_ACTIONACT_FLIPPER -.. data:: KX_ACTIONACT_LOOPSTOP -.. data:: KX_ACTIONACT_LOOPEND -.. data:: KX_ACTIONACT_PROPERTY - --------------- -Sound Actuator --------------- - -See :class:`bge.types.KX_SoundActuator` - -.. data:: KX_SOUNDACT_PLAYSTOP -.. data:: KX_SOUNDACT_PLAYEND -.. data:: KX_SOUNDACT_LOOPSTOP -.. data:: KX_SOUNDACT_LOOPEND -.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL -.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP - ------------- -Radar Sensor ------------- - -See :class:`bge.types.KX_RadarSensor` - -.. data:: KX_RADAR_AXIS_POS_X -.. data:: KX_RADAR_AXIS_POS_Y -.. data:: KX_RADAR_AXIS_POS_Z -.. data:: KX_RADAR_AXIS_NEG_X -.. data:: KX_RADAR_AXIS_NEG_Y -.. data:: KX_RADAR_AXIS_NEG_Z - ----------- -Ray Sensor ----------- - -See :class:`bge.types.KX_RaySensor` - -.. data:: KX_RAY_AXIS_POS_X -.. data:: KX_RAY_AXIS_POS_Y -.. data:: KX_RAY_AXIS_POS_Z -.. data:: KX_RAY_AXIS_NEG_X -.. data:: KX_RAY_AXIS_NEG_Y -.. data:: KX_RAY_AXIS_NEG_Z - ----------------- -Dynamic Actuator ----------------- - -See :class:`bge.types.KX_SCA_DynamicActuator` - -.. data:: KX_DYN_RESTORE_DYNAMICS -.. data:: KX_DYN_DISABLE_DYNAMICS -.. data:: KX_DYN_ENABLE_RIGID_BODY -.. data:: KX_DYN_DISABLE_RIGID_BODY -.. data:: KX_DYN_SET_MASS - -------------- -Game Actuator -------------- - -See :class:`bge.types.KX_GameActuator` - -.. data:: KX_GAME_LOAD -.. data:: KX_GAME_START -.. data:: KX_GAME_RESTART -.. data:: KX_GAME_QUIT -.. data:: KX_GAME_SAVECFG -.. data:: KX_GAME_LOADCFG - --------------- -Scene Actuator --------------- - -See :class:`bge.types.KX_SceneActuator` - -.. data:: KX_SCENE_RESTART -.. data:: KX_SCENE_SET_SCENE -.. data:: KX_SCENE_SET_CAMERA -.. data:: KX_SCENE_ADD_FRONT_SCENE -.. data:: KX_SCENE_ADD_BACK_SCENE -.. data:: KX_SCENE_REMOVE_SCENE -.. data:: KX_SCENE_SUSPEND -.. data:: KX_SCENE_RESUME - ------------- -Input Status ------------- - -See :class:`bge.types.SCA_MouseSensor` - -.. data:: KX_INPUT_NONE -.. data:: KX_INPUT_JUST_ACTIVATED -.. data:: KX_INPUT_ACTIVE -.. data:: KX_INPUT_JUST_RELEASED - -------------- -Mouse Buttons -------------- - -See :class:`bge.types.SCA_MouseSensor` - -.. data:: KX_MOUSE_BUT_LEFT -.. data:: KX_MOUSE_BUT_MIDDLE -.. data:: KX_MOUSE_BUT_RIGHT - ------- -States ------- - -See :class:`bge.types.KX_StateActuator` - -.. data:: KX_STATE1 -.. data:: KX_STATE2 -.. data:: KX_STATE3 -.. data:: KX_STATE4 -.. data:: KX_STATE5 -.. data:: KX_STATE6 -.. data:: KX_STATE7 -.. data:: KX_STATE8 -.. data:: KX_STATE9 -.. data:: KX_STATE10 -.. data:: KX_STATE11 -.. data:: KX_STATE12 -.. data:: KX_STATE13 -.. data:: KX_STATE14 -.. data:: KX_STATE15 -.. data:: KX_STATE16 -.. data:: KX_STATE17 -.. data:: KX_STATE18 -.. data:: KX_STATE19 -.. data:: KX_STATE20 -.. data:: KX_STATE21 -.. data:: KX_STATE22 -.. data:: KX_STATE23 -.. data:: KX_STATE24 -.. data:: KX_STATE25 -.. data:: KX_STATE26 -.. data:: KX_STATE27 -.. data:: KX_STATE28 -.. data:: KX_STATE29 -.. data:: KX_STATE30 -.. data:: KX_STATE_OP_CLR -.. data:: KX_STATE_OP_CPY -.. data:: KX_STATE_OP_NEG -.. data:: KX_STATE_OP_SET - ---------- -2D Filter ---------- - -.. data:: RAS_2DFILTER_BLUR -.. data:: RAS_2DFILTER_CUSTOMFILTER -.. data:: RAS_2DFILTER_DILATION -.. data:: RAS_2DFILTER_DISABLED -.. data:: RAS_2DFILTER_ENABLED -.. data:: RAS_2DFILTER_EROSION -.. data:: RAS_2DFILTER_GRAYSCALE -.. data:: RAS_2DFILTER_INVERT -.. data:: RAS_2DFILTER_LAPLACIAN -.. data:: RAS_2DFILTER_MOTIONBLUR -.. data:: RAS_2DFILTER_NOFILTER -.. data:: RAS_2DFILTER_PREWITT -.. data:: RAS_2DFILTER_SEPIA -.. data:: RAS_2DFILTER_SHARPEN -.. data:: RAS_2DFILTER_SOBEL - -------------------- -Constraint Actuator -------------------- - -.. data:: KX_ACT_CONSTRAINT_DISTANCE -.. data:: KX_ACT_CONSTRAINT_DOROTFH -.. data:: KX_ACT_CONSTRAINT_FHNX -.. data:: KX_ACT_CONSTRAINT_FHNY -.. data:: KX_ACT_CONSTRAINT_FHNZ -.. data:: KX_ACT_CONSTRAINT_FHPX -.. data:: KX_ACT_CONSTRAINT_FHPY -.. data:: KX_ACT_CONSTRAINT_FHPZ -.. data:: KX_ACT_CONSTRAINT_LOCAL -.. data:: KX_ACT_CONSTRAINT_MATERIAL -.. data:: KX_ACT_CONSTRAINT_NORMAL -.. data:: KX_ACT_CONSTRAINT_PERMANENT - ---------------- -Parent Actuator ---------------- - -.. data:: KX_PARENT_REMOVE -.. data:: KX_PARENT_SET - ------- -Shader ------- - -.. data:: VIEWMATRIX -.. data:: VIEWMATRIX_INVERSE -.. data:: VIEWMATRIX_INVERSETRANSPOSE -.. data:: VIEWMATRIX_TRANSPOSE -.. data:: MODELMATRIX -.. data:: MODELMATRIX_INVERSE -.. data:: MODELMATRIX_INVERSETRANSPOSE -.. data:: MODELMATRIX_TRANSPOSE -.. data:: MODELVIEWMATRIX -.. data:: MODELVIEWMATRIX_INVERSE -.. data:: MODELVIEWMATRIX_INVERSETRANSPOSE -.. data:: MODELVIEWMATRIX_TRANSPOSE -.. data:: CAM_POS - - Current camera position - -.. data:: CONSTANT_TIMER - - User a timer for the uniform value. - -.. data:: SHD_TANGENT - ----------------- -Blender Material ----------------- - -.. data:: BL_DST_ALPHA -.. data:: BL_DST_COLOR -.. data:: BL_ONE -.. data:: BL_ONE_MINUS_DST_ALPHA -.. data:: BL_ONE_MINUS_DST_COLOR -.. data:: BL_ONE_MINUS_SRC_ALPHA -.. data:: BL_ONE_MINUS_SRC_COLOR -.. data:: BL_SRC_ALPHA -.. data:: BL_SRC_ALPHA_SATURATE -.. data:: BL_SRC_COLOR -.. data:: BL_ZERO diff --git a/source/gameengine/PyDoc/bge.render.rst b/source/gameengine/PyDoc/bge.render.rst deleted file mode 100644 index d1a35019165..00000000000 --- a/source/gameengine/PyDoc/bge.render.rst +++ /dev/null @@ -1,231 +0,0 @@ - -Game Engine bge.render Module. -============================== - -.. module:: bge.render - -.. code-block:: python - - # Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook:: - # To use a mouse movement sensor "Mouse" and a - # motion actuator to mouse look: - import bge.render - import bge.logic - - # SCALE sets the speed of motion - SCALE=[1, 0.5] - - co = bge.logic.getCurrentController() - obj = co.getOwner() - mouse = co.getSensor("Mouse") - lmotion = co.getActuator("LMove") - wmotion = co.getActuator("WMove") - - # Transform the mouse coordinates to see how far the mouse has moved. - def mousePos(): - x = (bge.render.getWindowWidth()/2 - mouse.getXPosition())*SCALE[0] - y = (bge.render.getWindowHeight()/2 - mouse.getYPosition())*SCALE[1] - return (x, y) - - pos = mousePos() - - # Set the amount of motion: X is applied in world coordinates... - lmotion.setTorque(0.0, 0.0, pos[0], False) - # ...Y is applied in local coordinates - wmotion.setTorque(-pos[1], 0.0, 0.0, True) - - # Activate both actuators - bge.logic.addActiveActuator(lmotion, True) - bge.logic.addActiveActuator(wmotion, True) - - # Centre the mouse - bge.render.setMousePosition(bge.render.getWindowWidth()/2, bge.render.getWindowHeight()/2) - - -.. data:: KX_TEXFACE_MATERIAL - - Materials as defined by the texture face settings. - -.. data:: KX_BLENDER_MULTITEX_MATERIAL - - Materials approximating blender materials with multitexturing. - -.. data:: KX_BLENDER_GLSL_MATERIAL - - Materials approximating blender materials with GLSL. - -.. function:: getWindowWidth() - - Gets the width of the window (in pixels) - - :rtype: integer - -.. function:: getWindowHeight() - - Gets the height of the window (in pixels) - - :rtype: integer - -.. function:: makeScreenshot(filename) - - Writes a screenshot to the given filename. - - If filename starts with // the image will be saved relative to the current directory. - If the filename contains # it will be replaced with the frame number. - - The standalone player saves .png files. It does not support colour space conversion - or gamma correction. - - When run from Blender, makeScreenshot supports Iris, IrisZ, TGA, Raw TGA, PNG, HamX, and Jpeg. - Gamma, Colourspace conversion and Jpeg compression are taken from the Render settings panels. - - :type filename: string - - -.. function:: enableVisibility(visible) - - Doesn't really do anything... - - -.. function:: showMouse(visible) - - Enables or disables the operating system mouse cursor. - - :type visible: boolean - - -.. function:: setMousePosition(x, y) - - Sets the mouse cursor position. - - :type x: integer - :type y: integer - - -.. function:: setBackgroundColor(rgba) - - Sets the window background colour. - - :type rgba: list [r, g, b, a] - - -.. function:: setMistColor(rgb) - - Sets the mist colour. - - :type rgb: list [r, g, b] - - -.. function:: setAmbientColor(rgb) - - Sets the color of ambient light. - - :type rgb: list [r, g, b] - - -.. function:: setMistStart(start) - - Sets the mist start value. Objects further away than start will have mist applied to them. - - :type start: float - - -.. function:: setMistEnd(end) - - Sets the mist end value. Objects further away from this will be coloured solid with - the colour set by setMistColor(). - - :type end: float - - -.. function:: disableMist() - - Disables mist. - - .. note:: Set any of the mist properties to enable mist. - - -.. function:: setEyeSeparation(eyesep) - - Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value. - - :arg eyesep: The distance between the left and right eye. - :type eyesep: float - - -.. function:: getEyeSeparation() - - Gets the current eye separation for stereo mode. - - :rtype: float - - -.. function:: setFocalLength(focallength) - - Sets the focal length for stereo mode. It uses the current camera focal length as initial value. - - :arg focallength: The focal length. - :type focallength: float - -.. function:: getFocalLength() - - Gets the current focal length for stereo mode. - - :rtype: float - -.. function:: setMaterialMode(mode) - - Set the material mode to use for OpenGL rendering. - - :type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL - - .. note:: Changes will only affect newly created scenes. - - -.. function:: getMaterialMode(mode) - - Get the material mode to use for OpenGL rendering. - - :rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL - - -.. function:: setGLSLMaterialSetting(setting, enable) - - Enables or disables a GLSL material setting. - - :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) - :type enable: boolean - - -.. function:: getGLSLMaterialSetting(setting, enable) - - Get the state of a GLSL material setting. - - :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures) - :rtype: boolean - - -.. function:: drawLine(fromVec,toVec,color) - - Draw a line in the 3D scene. - - :arg fromVec: the origin of the line - :type fromVec: list [x, y, z] - :arg toVec: the end of the line - :type toVec: list [x, y, z] - :arg color: the color of the line - :type color: list [r, g, b] - - -.. function:: enableMotionBlur(factor) - - Enable the motion blue effect. - - :arg factor: the ammount of motion blur to display. - :type factor: float [0.0 - 1.0] - - -.. function:: disableMotionBlur() - - Disable the motion blue effect. - diff --git a/source/gameengine/PyDoc/bge.types.rst b/source/gameengine/PyDoc/bge.types.rst deleted file mode 100644 index 6cfb3377cac..00000000000 --- a/source/gameengine/PyDoc/bge.types.rst +++ /dev/null @@ -1,4339 +0,0 @@ - -Game Engine bge.types Module. -============================== - -.. module:: bge.types - -.. class:: PyObjectPlus - - PyObjectPlus base class of most other types in the Game Engine. - - .. attribute:: invalid - - Test if the object has been freed by the game engine and is no longer valid. - - Normally this is not a problem but when storing game engine data in the GameLogic module, - KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data. - Calling an attribute or method on an invalid object will raise a SystemError. - - The invalid attribute allows testing for this case without exception handling. - - *type* bool - - .. method:: isA(game_type) - - Check if this is a type or a subtype game_type. - - :arg game_type: the name of the type or the type its self from the :mod:`bge.types` module. - :type game_type: string or type - :return: True if this object is a type or a subtype of game_type. - :rtype: bool - -.. class:: CValue(PyObjectPlus) - - This class is a basis for other classes. - - .. attribute:: name - - The name of this CValue derived object (read-only). **type** string - -.. class:: CPropValue(CValue) - - This class has no python functions - -.. class:: SCA_ILogicBrick(CValue) - - Base class for all logic bricks. - - .. attribute:: executePriority - - This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first). - - *type* executePriority: int - - .. attribute:: owner - - The game object this logic brick is attached to (read-only). **type** :class:`KX_GameObject` or None in exceptional cases. - - .. attribute:: name - - The name of this logic brick (read-only). **type** string - -.. class:: SCA_PythonKeyboard(PyObjectPlus) - - The current keyboard. - - .. attribute:: events - - A list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). - - * 'keycode' matches the values in :mod:`bge.keys`. - * 'status' uses... - * :mod:`bge.logic.KX_INPUT_NONE` - * :mod:`bge.logic.KX_INPUT_JUST_ACTIVATED` - * :mod:`bge.logic.KX_INPUT_ACTIVE` - * :mod:`bge.logic.KX_INPUT_JUST_RELEASED` - - *type* list [[keycode, status], ...] - -.. class:: SCA_PythonMouse(PyObjectPlus) - - The current mouse. - - .. attribute:: events - - a list of pressed buttons that have either been pressed, or just released, or are active this frame. (read-only). - - * 'keycode' matches the values in :mod:`bge.keys`. - * 'status' uses... - * :mod:`bge.logic.KX_INPUT_NONE` - * :mod:`bge.logic.KX_INPUT_JUST_ACTIVATED` - * :mod:`bge.logic.KX_INPUT_ACTIVE` - * :mod:`bge.logic.KX_INPUT_JUST_RELEASED` - - *type* list [[keycode, status], ...] - - .. attribute:: position - - The normalized x and y position of the mouse cursor. **type** list [x, y] - - .. attribute:: visible - - The visibility of the mouse cursor. **type** boolean - -.. class:: SCA_IObject(CValue) - - This class has no python functions - -.. class:: SCA_ISensor(SCA_ILogicBrick) - - Base class for all sensor logic bricks. - - .. attribute:: usePosPulseMode - - Flag to turn positive pulse mode on and off. **type** boolean - - .. attribute:: useNegPulseMode - - Flag to turn negative pulse mode on and off. **type** boolean - - .. attribute:: frequency - - The frequency for pulse mode sensors. **type** integer - - .. attribute:: level - - level Option whether to detect level or edge transition when entering a state. - It makes a difference only in case of logic state transition (state actuator). - A level detector will immediately generate a pulse, negative or positive - depending on the sensor condition, as soon as the state is activated. - A edge detector will wait for a state change before generating a pulse. - note: mutually exclusive with :data:`tap`, enabling will disable :data:`tap`. - - *type* boolean - - .. attribute:: tap - - When enabled only sensors that are just activated will send a positive event, - after this they will be detected as negative by the controllers. - This will make a key thats held act as if its only tapped for an instant. - note: mutually exclusive with :data:`level`, enabling will disable :data:`level`. - - *type* boolean - - .. attribute:: invert - - Flag to set if this sensor activates on positive or negative events. **type** boolean - - .. attribute:: triggered - - True if this sensor brick is in a positive state. (read-only). **type** boolean - - .. attribute:: positive - - True if this sensor brick is in a positive state. (read-only). **type** boolean - - .. attribute:: status - - The status of the sensor. (read-only). **type** int from 0-3. - - * KX_SENSOR_INACTIVE - * KX_SENSOR_JUST_ACTIVATED - * KX_SENSOR_ACTIVE - * KX_SENSOR_JUST_DEACTIVATED - - .. note:: this convenient attribute combines the values of triggered and positive attributes. - - .. method:: reset() - - Reset sensor internal state, effect depends on the type of sensor and settings. - - The sensor is put in its initial state as if it was just activated. - -.. class:: SCA_IController(SCA_ILogicBrick) - - Base class for all controller logic bricks. - - .. attribute:: state - - The controllers state bitmask. This can be used with the GameObject's state to test if the controller is active. **type** int bitmask - - .. attribute:: sensors - - A list of sensors linked to this controller. **type** sequence supporting index/string lookups and iteration. - - .. note:: The sensors are not necessarily owned by the same object. - .. note:: When objects are instanced in dupligroups links may be lost from objects outside the dupligroup. - - .. attribute:: actuators - - A list of actuators linked to this controller. **type** sequence supporting index/string lookups and iteration. - - .. note:: The sensors are not necessarily owned by the same object. - .. note:: When objects are instanced in dupligroups links may be lost from objects outside the dupligroup. - - .. attribute:: useHighPriority - - When set the controller executes always before all other controllers that dont have this set. **type** bool - - .. note:: Order of execution between high priority controllers is not guaranteed. - -.. class:: SCA_IActuator(SCA_ILogicBrick) - - Base class for all actuator logic bricks. - -.. class:: BL_ActionActuator(SCA_IActuator) - - Action Actuators apply an action to an actor. - - .. attribute:: action - - The name of the action to set as the current action. **type** string - - .. attribute:: channelNames - - A list of channel names that may be used with :data:`setChannel` and :data:`getChannel`. **type** list of strings - - .. attribute:: frameStart - - Specifies the starting frame of the animation. **type** float - - .. attribute:: frameEnd - - Specifies the ending frame of the animation. **type** float - - .. attribute:: blendIn - - Specifies the number of frames of animation to generate when making transitions between actions. **type** float - - .. attribute:: priority - - Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers. **type** integer - - .. attribute:: frame - - Sets the current frame for the animation. **type** float - - .. attribute:: propName - - Sets the property to be used in FromProp playback mode. **type** string - - .. attribute:: blendTime - - Sets the internal frame timer. This property must be in the range from 0.0 to blendIn. **type** float - - .. attribute:: mode - - The operation mode of the actuator. KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND. **type** integer - - .. attribute:: useContinue - - The actions continue option, True or False. When True, the action will always play from where last left off, otherwise negative events to this actuator will reset it to its start frame. **type** boolean - - .. attribute:: framePropName - - The name of the property that is set to the current frame number. **type** string - - .. method:: setChannel(channel, matrix) - - Alternative to the 2 arguments, 4 arguments (channel, matrix, loc, size, quat) are also supported. - - :arg channel: A string specifying the name of the bone channel, error raised if not in :data:`channelNames`. - :type channel: string - :arg matrix: A 4x4 matrix specifying the overriding transformation as an offset from the bone's rest position. - :arg matrix: list [[float]] - - .. note:: These values are relative to the bones rest position, currently the api has no way to get this info (which is annoying), but can be worked around by using bones with a rest pose that has no translation. - - .. method:: getChannel(channel) - - :arg channel: A string specifying the name of the bone channel. error raised if not in :data:`channelNames`. - :type channel: string - :return: (loc, size, quat) - :rtype: tuple - -.. class:: BL_Shader(PyObjectPlus) - - BL_Shader GLSL shaders. - - TODO - Description - - .. method:: setUniformfv(name, fList) - - Set a uniform with a list of float values - - :arg name: the uniform name - :type name: string - :arg fList: a list (2, 3 or 4 elements) of float values - :type fList: list[float] - - .. method:: delSource() - - Clear the shader. Use this method before the source is changed with :data:`setSource`. - - .. method:: getFragmentProg() - - Returns the fragment program. - - :return: The fragment program. - :rtype: string - - .. method:: getVertexProg() - - Get the vertex program. - - :return: The vertex program. - :rtype: string - - .. method:: isValid() - - Check if the shader is valid. - - :return: True if the shader is valid - :rtype: bool - - .. method:: setAttrib(enum) - - Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.) - - :arg enum: attribute location value - :type enum: integer - - .. method:: setNumberOfPasses( max_pass ) - - Set the maximum number of passes. Not used a.t.m. - - :arg max_pass: the maximum number of passes - :type max_pass: integer - - .. method:: setSampler(name, index) - - Set uniform texture sample index. - - :arg name: Uniform name - :type name: string - :arg index: Texture sample index. - :type index: integer - - .. method:: setSource(vertexProgram, fragmentProgram) - - Set the vertex and fragment programs - - :arg vertexProgram: Vertex program - :type vertexProgram: string - :arg fragmentProgram: Fragment program - :type fragmentProgram: string - - .. method:: setUniform1f(name, fx) - - Set a uniform with 1 float value. - - :arg name: the uniform name - :type name: string - :arg fx: Uniform value - :type fx: float - - .. method:: setUniform1i(name, ix) - - Set a uniform with an integer value. - - :arg name: the uniform name - :type name: string - :arg ix: the uniform value - :type ix: integer - - .. method:: setUniform2f(name, fx, fy) - - Set a uniform with 2 float values - - :arg name: the uniform name - :type name: string - :arg fx: first float value - :type fx: float - - :arg fy: second float value - :type fy: float - - .. method:: setUniform2i(name, ix, iy) - - Set a uniform with 2 integer values - - :arg name: the uniform name - :type name: string - :arg ix: first integer value - :type ix: integer - :arg iy: second integer value - :type iy: integer - - .. method:: setUniform3f(name, fx, fy, fz) - - Set a uniform with 3 float values. - - :arg name: the uniform name - :type name: string - :arg fx: first float value - :type fx: float - :arg fy: second float value - :type fy: float - :arg fz: third float value - :type fz: float - - .. method:: setUniform3i(name, ix, iy, iz) - - Set a uniform with 3 integer values - - :arg name: the uniform name - :type name: string - :arg ix: first integer value - :type ix: integer - :arg iy: second integer value - :type iy: integer - :arg iz: third integer value - :type iz: integer - - .. method:: setUniform4f(name, fx, fy, fz, fw) - - Set a uniform with 4 float values. - - :arg name: the uniform name - :type name: string - :arg fx: first float value - :type fx: float - :arg fy: second float value - :type fy: float - :arg fz: third float value - :type fz: float - :arg fw: fourth float value - :type fw: float - - .. method:: setUniform4i(name, ix, iy, iz, iw) - - Set a uniform with 4 integer values - - :arg name: the uniform name - :type name: string - :arg ix: first integer value - :type ix: integer - :arg iy: second integer value - :type iy: integer - :arg iz: third integer value - :type iz: integer - :arg iw: fourth integer value - :type iw: integer - - .. method:: setUniformDef(name, type) - - Define a new uniform - - :arg name: the uniform name - :type name: string - :arg type: uniform type - :type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX - - .. method:: setUniformMatrix3(name, mat, transpose) - - Set a uniform with a 3x3 matrix value - - :arg name: the uniform name - :type name: string - :arg mat: A 3x3 matrix [[f, f, f], [f, f, f], [f, f, f]] - :type mat: 3x3 matrix - :arg transpose: set to True to transpose the matrix - :type transpose: bool - - .. method:: setUniformMatrix4(name, mat, transpose) - - Set a uniform with a 4x4 matrix value - - :arg name: the uniform name - :type name: string - :arg mat: A 4x4 matrix [[f, f, f, f], [f, f, f, f], [f, f, f, f], [f, f, f, f]] - :type mat: 4x4 matrix - :arg transpose: set to True to transpose the matrix - :type transpose: bool - - .. method:: setUniformiv(name, iList) - - Set a uniform with a list of integer values - - :arg name: the uniform name - :type name: string - :arg iList: a list (2, 3 or 4 elements) of integer values - :type iList: list[integer] - - .. method:: validate() - - Validate the shader object. - -.. class:: BL_ShapeActionActuator(SCA_IActuator) - - ShapeAction Actuators apply an shape action to an mesh object. - - .. attribute:: action - - The name of the action to set as the current shape action. **type** string - - .. attribute:: frameStart - - Specifies the starting frame of the shape animation. **type** float - - .. attribute:: frameEnd - - Specifies the ending frame of the shape animation. **type** float - - .. attribute:: blendIn - - Specifies the number of frames of animation to generate when making transitions between actions. **type** float - - .. attribute:: priority - - Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers. **type** integer - - .. attribute:: frame - - Sets the current frame for the animation. **type** float - - .. attribute:: propName - - Sets the property to be used in FromProp playback mode. **type** string - - .. attribute:: blendTime - - Sets the internal frame timer. This property must be in the range from 0.0 to blendin. **type** float - - .. attribute:: mode - - The operation mode of the actuator in [KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND] **type** integer - - .. attribute:: framePropName - - The name of the property that is set to the current frame number. **type** string - -.. class:: CListValue(CPropValue) - - CListValue - - This is a list like object used in the game engine internally that behaves similar to a python list in most ways. - - As well as the normal index lookup. - ``val= clist[i]`` - - CListValue supports string lookups. - ``val= scene.objects["Cube"]`` - - Other operations such as ``len(clist), list(clist), clist[0:10]`` are also supported. - - .. method:: append(val) - - Add an item to the list (like pythons append) - - .. warning:: Appending values to the list can cause crashes when the list is used internally by the game engine. - - .. method:: count(val) - - Count the number of instances of a value in the list. - - :return: number of instances - :rtype: integer - - .. method:: index(val) - - Return the index of a value in the list. - - :return: The index of the value in the list. - :rtype: integer - - .. method:: reverse() - - Reverse the order of the list. - - .. method:: get(key, default=None) - - Return the value matching key, or the default value if its not found. - - :return: The key value or a default. - - .. method:: from_id(id) - - This is a funtion especially for the game engine to return a value with a spesific id. - - Since object names are not always unique, the id of an object can be used to get an object from the CValueList. - - Example. - - ``myObID=id(gameObject)`` - ``ob= scene.objects.from_id(myObID)`` - - Where myObID is an int or long from the id function. - - This has the advantage that you can store the id in places you could not store a gameObject. - - .. warning:: the id is derived from a memory location and will be different each time the game engine starts. - -.. class:: KX_BlenderMaterial(PyObjectPlus) - - KX_BlenderMaterial - - .. method:: getShader() - - Returns the material's shader. - - :return: the material's shader - :rtype: :class:`BL_Shader` - - .. method:: setBlending(src, dest) - - Set the pixel color arithmetic functions. - - :arg src: Specifies how the red, green, blue, and alpha source blending factors are computed. - :type src: Value in... - - * GL_ZERO, - * GL_ONE, - * GL_SRC_COLOR, - * GL_ONE_MINUS_SRC_COLOR, - * GL_DST_COLOR, - * GL_ONE_MINUS_DST_COLOR, - * GL_SRC_ALPHA, - * GL_ONE_MINUS_SRC_ALPHA, - * GL_DST_ALPHA, - * GL_ONE_MINUS_DST_ALPHA, - * GL_SRC_ALPHA_SATURATE - - :arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed. - :type dest: Value in... - - * GL_ZERO - * GL_ONE - * GL_SRC_COLOR - * GL_ONE_MINUS_SRC_COLOR - * GL_DST_COLOR - * GL_ONE_MINUS_DST_COLOR - * GL_SRC_ALPHA - * GL_ONE_MINUS_SRC_ALPHA - * GL_DST_ALPHA - * GL_ONE_MINUS_DST_ALPHA - * GL_SRC_ALPHA_SATURATE - - .. method:: getMaterialIndex() - - Returns the material's index. - - :return: the material's index - :rtype: integer - -.. class:: KX_CameraActuator(SCA_IActuator) - - Applies changes to a camera. - - .. attribute:: min - - minimum distance to the target object maintained by the actuator. **type** float - - .. attribute:: max - - maximum distance to stay from the target object. **type** float - - .. attribute:: height - - height to stay above the target object. **type** float - - .. attribute:: useXY - - axis this actuator is tracking, True=X, False=Y. **type** boolean - - .. attribute:: object - - the object this actuator tracks. **type** :class:`KX_GameObject` or None - - @author: snail - -.. class:: KX_ConstraintActuator(SCA_IActuator) - - A constraint actuator limits the position, rotation, distance or orientation of an object. - - Properties: - - .. attribute:: damp - - Time constant of the constraint expressed in frame (not use by Force field constraint). **type** integer - - .. attribute:: rotDamp - - Time constant for the rotation expressed in frame (only for the distance constraint), 0 = use damp for rotation as well. **type** integer - - .. attribute:: direction - - The reference direction in world coordinate for the orientation constraint. **type** 3-tuple of float: (x, y, z) - - .. attribute:: option - - Binary combination of the following values. **type** integer - - * Applicable to Distance constraint - * KX_ACT_CONSTRAINT_NORMAL ( 64) : Activate alignment to surface - * KX_ACT_CONSTRAINT_DISTANCE ( 512) : Activate distance control - * KX_ACT_CONSTRAINT_LOCAL (1024) : direction of the ray is along the local axis - * Applicable to Force field constraint: - * KX_ACT_CONSTRAINT_DOROTFH (2048) : Force field act on rotation as well - * Applicable to both: - * KX_ACT_CONSTRAINT_MATERIAL ( 128) : Detect material rather than property - * KX_ACT_CONSTRAINT_PERMANENT ( 256) : No deactivation if ray does not hit target - - .. attribute:: time - - activation time of the actuator. The actuator disables itself after this many frame. If set to 0, the actuator is not limited in time. **type** integer - - .. attribute:: propName - - the name of the property or material for the ray detection of the distance constraint. **type** string - - .. attribute:: min - - The lower bound of the constraint. For the rotation and orientation constraint, it represents radiant **type** float - - .. attribute:: distance - - the target distance of the distance constraint **type** float - - .. attribute:: max - - the upper bound of the constraint. For rotation and orientation constraints, it represents radiant. **type** float - - .. attribute:: rayLength - - the length of the ray of the distance constraint. - - *type* float - - .. attribute:: limit - - type of constraint. **type** integer. - - use one of the following constant: - - * KX_ACT_CONSTRAINT_LOCX ( 1) : limit X coord - * KX_ACT_CONSTRAINT_LOCY ( 2) : limit Y coord - * KX_ACT_CONSTRAINT_LOCZ ( 3) : limit Z coord - * KX_ACT_CONSTRAINT_ROTX ( 4) : limit X rotation - * KX_ACT_CONSTRAINT_ROTY ( 5) : limit Y rotation - * KX_ACT_CONSTRAINT_ROTZ ( 6) : limit Z rotation - * KX_ACT_CONSTRAINT_DIRPX ( 7) : set distance along positive X axis - * KX_ACT_CONSTRAINT_DIRPY ( 8) : set distance along positive Y axis - * KX_ACT_CONSTRAINT_DIRPZ ( 9) : set distance along positive Z axis - * KX_ACT_CONSTRAINT_DIRNX (10) : set distance along negative X axis - * KX_ACT_CONSTRAINT_DIRNY (11) : set distance along negative Y axis - * KX_ACT_CONSTRAINT_DIRNZ (12) : set distance along negative Z axis - * KX_ACT_CONSTRAINT_ORIX (13) : set orientation of X axis - * KX_ACT_CONSTRAINT_ORIY (14) : set orientation of Y axis - * KX_ACT_CONSTRAINT_ORIZ (15) : set orientation of Z axis - * KX_ACT_CONSTRAINT_FHPX (16) : set force field along positive X axis - * KX_ACT_CONSTRAINT_FHPY (17) : set force field along positive Y axis - * KX_ACT_CONSTRAINT_FHPZ (18) : set force field along positive Z axis - * KX_ACT_CONSTRAINT_FHNX (19) : set force field along negative X axis - * KX_ACT_CONSTRAINT_FHNY (20) : set force field along negative Y axis - * KX_ACT_CONSTRAINT_FHNZ (21) : set force field along negative Z axis - -.. class:: KX_ConstraintWrapper(PyObjectPlus) - - KX_ConstraintWrapper - - .. method:: getConstraintId(val) - - Returns the contraint's ID - - :return: the constraint's ID - :rtype: integer - -.. class:: KX_GameActuator(SCA_IActuator) - - The game actuator loads a new .blend file, restarts the current .blend file or quits the game. - - Properties: - - .. attribute:: fileName - - the new .blend file to load **type** string. - - .. attribute:: mode - - The mode of this actuator **type** Constant in... - - * :mod:`bge.logic.KX_GAME_LOAD` - * :mod:`bge.logic.KX_GAME_START` - * :mod:`bge.logic.KX_GAME_RESTART` - * :mod:`bge.logic.KX_GAME_QUIT` - * :mod:`bge.logic.KX_GAME_SAVECFG` - * :mod:`bge.logic.KX_GAME_LOADCFG` - -.. class:: KX_GameObject(SCA_IObject) - - All game objects are derived from this class. - - Properties assigned to game objects are accessible as attributes of this class. - - .. note:: Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError, if an object may have been removed since last accessing it use the :data:`invalid` attribute to check. - - .. attribute:: name - - The object's name. (read-only). **type** string. - - .. attribute:: mass - - The object's mass - - .. note:: The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0 **type** float - - .. attribute:: linVelocityMin - - Enforces the object keeps moving at a minimum velocity. - - .. note:: Applies to dynamic and rigid body objects only. - .. note:: A value of 0.0 disables this option. - .. note:: While objects are stationary the minimum velocity will not be applied. **type** float - - .. attribute:: linVelocityMax - - Clamp the maximum linear velocity to prevent objects moving beyond a set speed. - - .. note:: Applies to dynamic and rigid body objects only. - .. note:: A value of 0.0 disables this option (rather then setting it stationary). **type** float - - .. attribute:: localInertia - - the object's inertia vector in local coordinates. Read only. **type** list [ix, iy, iz] - - .. attribute:: parent - - The object's parent object. (read-only). **type** :class:`KX_GameObject` or None - - .. attribute:: visible - - visibility flag. - - .. note:: Game logic will still run for invisible objects. **type** boolean - - .. attribute:: color - - The object color of the object **type** list [r, g, b, a] - - .. attribute:: occlusion - - occlusion capability flag. **type** boolean - - .. attribute:: position - - The object's position. - - .. deprecated:: use :data:`localPosition` and :data:`worldPosition`. **type** list [x, y, z] On write: local position, on read: world position - - .. attribute:: orientation - - The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. - - .. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`. **type** 3x3 Matrix [[float]] On write: local orientation, on read: world orientation - - .. attribute:: scaling - - The object's scaling factor. list [sx, sy, sz] - - .. deprecated:: use :data:`localScale` and :data:`worldScale`. **type** list [sx, sy, sz] On write: local scaling, on read: world scaling - - .. attribute:: localOrientation - - The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. **type** 3x3 Matrix [[float]] - - .. attribute:: worldOrientation - - The object's world orientation. **type** 3x3 Matrix [[float]] - - .. attribute:: localScale - - The object's local scaling factor. **type** list [sx, sy, sz] - - .. attribute:: worldScale - - The object's world scaling factor. Read-only **type** list [sx, sy, sz] - - .. attribute:: localPosition - - The object's local position. **type** list [x, y, z] - - .. attribute:: worldPosition - - The object's world position. **type** list [x, y, z] - - .. attribute:: timeOffset - - adjust the slowparent delay at runtime. **type** float - - .. attribute:: state - - the game object's state bitmask, using the first 30 bits, one bit must always be set. **type** int - - .. attribute:: meshes - - a list meshes for this object. - - .. note:: Most objects use only 1 mesh. - .. note:: Changes to this list will not update the KX_GameObject. **type** list of :class:`KX_MeshProxy` - - .. attribute:: sensors - - a sequence of :class:`SCA_ISensor` objects with string/index lookups and iterator support. - - .. note:: This attribute is experemental and may be removed (but probably wont be). - .. note:: Changes to this list will not update the KX_GameObject. **type** list - - .. attribute:: controllers - - a sequence of :class:`SCA_IController` objects with string/index lookups and iterator support. - .. note:: This attribute is experemental and may be removed (but probably wont be). - .. note:: Changes to this list will not update the KX_GameObject. **type** list of :class:`SCA_ISensor`. - - .. attribute:: actuators - - a list of :class:`SCA_IActuator` with string/index lookups and iterator support. - - .. note:: This attribute is experemental and may be removed (but probably wont be). - .. note:: Changes to this list will not update the KX_GameObject. **type** list - - .. attribute:: attrDict - - get the objects internal python attribute dictionary for direct (faster) access. **type** dict - - .. attribute:: children - - direct children of this object, (read-only). **type** :class:`CListValue` of :class:`KX_GameObject`'s - - .. attribute:: childrenRecursive - - all children of this object including childrens children, (read-only). **type** :class:`CListValue` of :class:`KX_GameObject`'s - - .. method:: endObject() - - Delete this object, can be used in place of the EndObject Actuator. - - The actual removal of the object from the scene is delayed. - - .. method:: replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False) - - Replace the mesh of this object with a new mesh. This works the same was as the actuator. - - :arg mesh: mesh to replace or the meshes name. - :type mesh: :class:`MeshProxy` or string - :arg useDisplayMesh: when enabled the display mesh will be replaced (optional argument). - :type useDisplayMesh: bool - :arg usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument). - :type usePhysicsMesh: bool - - .. method:: setVisible(visible, recursive) - - Sets the game object's visible flag. - - :arg visible: the visible state to set. - :type visible: boolean - :arg recursive: optional argument to set all childrens visibility flag too. - :type recursive: boolean - - .. method:: setOcclusion(occlusion, recursive) - - Sets the game object's occlusion capability. - - :arg occlusion: the state to set the occlusion to. - :type occlusion: boolean - :arg recursive: optional argument to set all childrens occlusion flag too. - :type recursive: boolean - - .. method:: alignAxisToVect(vect, axis=2, factor=1.0) - - Aligns any of the game object's axis along the given vector. - - - :arg vect: a vector to align the axis. - :type vect: 3D vector - :arg axis: The axis you want to align - - * 0: X axis - * 1: Y axis - * 2: Z axis - - :type axis: integer - :arg factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0) - :type factor: float - - .. method:: getAxisVect(vect) - - Returns the axis vector rotates by the objects worldspace orientation. - This is the equivalent of multiplying the vector by the orientation matrix. - - :arg vect: a vector to align the axis. - :type vect: 3D Vector - :return: The vector in relation to the objects rotation. - :rtype: 3d vector. - - .. method:: applyMovement(movement, local=False) - - Sets the game object's movement. - - :arg movement: movement vector. - :type movement: 3D Vector - :arg local: - * False: you get the "global" movement ie: relative to world orientation. - * True: you get the "local" movement ie: relative to object orientation. - :arg local: boolean - - .. method:: applyRotation(rotation, local=False) - - Sets the game object's rotation. - - :arg rotation: rotation vector. - :type rotation: 3D Vector - :arg local: - * False: you get the "global" rotation ie: relative to world orientation. - * True: you get the "local" rotation ie: relative to object orientation. - :arg local: boolean - - .. method:: applyForce(force, local=False) - - Sets the game object's force. - - This requires a dynamic object. - - :arg force: force vector. - :type force: 3D Vector - :arg local: - * False: you get the "global" force ie: relative to world orientation. - * True: you get the "local" force ie: relative to object orientation. - :type local: boolean - - .. method:: applyTorque(torque, local=False) - - Sets the game object's torque. - - This requires a dynamic object. - - :arg torque: torque vector. - :type torque: 3D Vector - :arg local: - * False: you get the "global" torque ie: relative to world orientation. - * True: you get the "local" torque ie: relative to object orientation. - :type local: boolean - - .. method:: getLinearVelocity(local=False) - - Gets the game object's linear velocity. - - This method returns the game object's velocity through it's centre of mass, ie no angular velocity component. - - :arg local: - * False: you get the "global" velocity ie: relative to world orientation. - * True: you get the "local" velocity ie: relative to object orientation. - :type local: boolean - :return: the object's linear velocity. - :rtype: list [vx, vy, vz] - - .. method:: setLinearVelocity(velocity, local=False) - - Sets the game object's linear velocity. - - This method sets game object's velocity through it's centre of mass, - ie no angular velocity component. - - This requires a dynamic object. - - :arg velocity: linear velocity vector. - :type velocity: 3D Vector - :arg local: - * False: you get the "global" velocity ie: relative to world orientation. - * True: you get the "local" velocity ie: relative to object orientation. - :type local: boolean - - .. method:: getAngularVelocity(local=False) - - Gets the game object's angular velocity. - - :arg local: - * False: you get the "global" velocity ie: relative to world orientation. - * True: you get the "local" velocity ie: relative to object orientation. - :type local: boolean - :return: the object's angular velocity. - :rtype: list [vx, vy, vz] - - .. method:: setAngularVelocity(velocity, local=False) - - Sets the game object's angular velocity. - - This requires a dynamic object. - - :arg velocity: angular velocity vector. - :type velocity: boolean - :arg local: - * False: you get the "global" velocity ie: relative to world orientation. - * True: you get the "local" velocity ie: relative to object orientation. - - .. method:: getVelocity(point=(0, 0, 0)) - - Gets the game object's velocity at the specified point. - - Gets the game object's velocity at the specified point, including angular - components. - - :arg point: optional point to return the velocity for, in local coordinates. - :type point: 3D Vector - :return: the velocity at the specified point. - :rtype: list [vx, vy, vz] - - .. method:: getReactionForce() - - Gets the game object's reaction force. - - The reaction force is the force applied to this object over the last simulation timestep. - This also includes impulses, eg from collisions. - - :return: the reaction force of this object. - :rtype: list [fx, fy, fz] - - .. note:: This is not implimented at the moment. - - .. method:: applyImpulse(point, impulse) - - Applies an impulse to the game object. - - This will apply the specified impulse to the game object at the specified point. - If point != position, applyImpulse will also change the object's angular momentum. - Otherwise, only linear momentum will change. - - :arg point: the point to apply the impulse to (in world coordinates) - :type point: the point to apply the impulse to (in world coordinates) - - .. method:: suspendDynamics() - - Suspends physics for this object. - - .. method:: restoreDynamics() - - Resumes physics for this object. - - .. note:: The objects linear velocity will be applied from when the dynamics were suspended. - - .. method:: enableRigidBody() - - Enables rigid body physics for this object. - - Rigid body physics allows the object to roll on collisions. - - .. note:: This is not working with bullet physics yet. - - .. method:: disableRigidBody() - - Disables rigid body physics for this object. - - .. note:: This is not working with bullet physics yet. The angular is removed but rigid body physics can still rotate it later. - - .. method:: setParent(parent, compound=True, ghost=True) - - Sets this object's parent. - Control the shape status with the optional compound and ghost parameters: - - In that case you can control if it should be ghost or not: - - :arg parent: new parent object. - :type parent: :class:`KX_GameObject` - :arg compound: whether the shape should be added to the parent compound shape. - - * True: the object shape should be added to the parent compound shape. - * False: the object should keep its individual shape. - - :type compound: boolean - :arg ghost: whether the object should be ghost while parented. - - * True: if the object should be made ghost while parented. - * False: if the object should be solid while parented. - - :type ghost: boolean - - .. note:: if the object type is sensor, it stays ghost regardless of ghost parameter - - .. method:: removeParent() - - Removes this objects parent. - - .. method:: getPhysicsId() - - Returns the user data object associated with this game object's physics controller. - - .. method:: getPropertyNames() - - Gets a list of all property names. - - :return: All property names for this object. - :rtype: list - - .. method:: getDistanceTo(other) - - :arg other: a point or another :class:`KX_GameObject` to measure the distance to. - :type other: :class:`KX_GameObject` or list [x, y, z] - :return: distance to another object or point. - :rtype: float - - .. method:: getVectTo(other) - - Returns the vector and the distance to another object or point. - The vector is normalized unless the distance is 0, in which a zero length vector is returned. - - :arg other: a point or another :class:`KX_GameObject` to get the vector and distance to. - :type other: :class:`KX_GameObject` or list [x, y, z] - :return: (distance, globalVector(3), localVector(3)) - :rtype: 3-tuple (float, 3-tuple (x, y, z), 3-tuple (x, y, z)) - - .. method:: rayCastTo(other, dist, prop) - - Look towards another point/object and find first object hit within dist that matches prop. - - The ray is always casted from the center of the object, ignoring the object itself. - The ray is casted towards the center of another object or an explicit [x, y, z] point. - Use rayCast() if you need to retrieve the hit point - - :arg other: [x, y, z] or object towards which the ray is casted - :type other: :class:`KX_GameObject` or 3-tuple - :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other - :type dist: float - :arg prop: property name that object must have; can be omitted => detect any object - :type prop: string - :return: the first object hit or None if no object or object does not match prop - :rtype: :class:`KX_GameObject` - - .. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly) - - Look from a point/object to another point/object and find first object hit within dist that matches prop. - if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit. - if poly is 1, returns a 4-tuple with in addition a :class:`KX_PolyProxy` as 4th element. - if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element. - - .. code-block:: python - - # shoot along the axis gun-gunAim (gunAim should be collision-free) - obj, point, normal = gun.rayCast(gunAim, None, 50) - if obj: - # do something - pass - - The face paremeter determines the orientation of the normal. - - * 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside) - * 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect) - - The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray. - The prop and xray parameters interact as follow. - - * prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray. - * prop off, xray on : idem. - * prop on, xray off: return closest hit if it matches prop, no hit otherwise. - * prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray. - - The :class:`KX_PolyProxy` 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray. - If there is no hit or the hit object is not a static mesh, None is returned as 4th element. - - The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects. - - :arg objto: [x, y, z] or object to which the ray is casted - :type objto: :class:`KX_GameObject` or 3-tuple - :arg objfrom: [x, y, z] or object from which the ray is casted; None or omitted => use self object center - :type objfrom: :class:`KX_GameObject` or 3-tuple or None - :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to - :type dist: float - :arg prop: property name that object must have; can be omitted or "" => detect any object - :type prop: string - :arg face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin - :type face: integer - :arg xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object - :type xray: integer - :arg poly: polygon option: 0, 1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit. - - * 0 or omitted: return value is a 3-tuple (object, hitpoint, hitnormal) or (None, None, None) if no hit - * 1: return value is a 4-tuple and the 4th element is a :class:`KX_PolyProxy` or None if no hit or the object doesn't use a mesh collision shape. - * 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping. - - :type poly: integer - :return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv). - - * object, hitpoint and hitnormal are None if no hit. - * polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None - * hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None - - :rtype: - - * 3-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz)) - * or 4-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`) - * or 5-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`, 2-tuple (u, v)) - - .. note:: The ray ignores the object on which the method is called. It is casted from/to object center or explicit [x, y, z] points. - - .. method:: setCollisionMargin(margin) - - Set the objects collision margin. - - .. note:: If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError. - - :arg margin: the collision margin distance in blender units. - :type margin: float - - .. method:: sendMessage(subject, body="", to="") - - Sends a message. - - :arg subject: The subject of the message - :type subject: string - :arg body: The body of the message (optional) - :type body: string - :arg to: The name of the object to send the message to (optional) - :type to: string - - .. method:: reinstancePhysicsMesh(gameObject, meshObject) - - Updates the physics system with the changed mesh. - - If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object. - - :arg gameObject: optional argument, set the physics shape from this gameObjets mesh. - :type gameObject: string, :class:`KX_GameObject` or None - :arg meshObject: optional argument, set the physics shape from this mesh. - :type meshObject: string, :class:`MeshProxy` or None - - .. note:: if this object has instances the other instances will be updated too. - .. note:: the gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf). - .. warning:: only triangle mesh type objects are supported currently (not convex hull) - .. warning:: if the object is a part of a combound object it will fail (parent or child) - .. warning:: rebuilding the physics mesh can be slow, running many times per second will give a performance hit. - - :return: True if reinstance succeeded, False if it failed. - :rtype: boolean - - .. method:: get(key, default=None) - - Return the value matching key, or the default value if its not found. - :return: The key value or a default. - -.. class:: KX_IpoActuator(SCA_IActuator) - - IPO actuator activates an animation. - - .. attribute:: frameStart - - Start frame. **type** float - - .. attribute:: frameEnd - - End frame. **type** float - - .. attribute:: propName - - Use this property to define the Ipo position **type** string - - .. attribute:: framePropName - - Assign this property this action current frame number **type** string - - .. attribute:: mode - - Play mode for the ipo. (In GameLogic.KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND, KX_IPOACT_FROM_PROP) **type** integer - - .. attribute:: useIpoAsForce - - Apply Ipo as a global or local force depending on the local option (dynamic objects only) **type** bool - - .. attribute:: useIpoAdd - - Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag **type** bool - - .. attribute:: useIpoLocal - - Let the ipo acts in local coordinates, used in Force and Add mode. **type** bool - - .. attribute:: useChildren - - Update IPO on all children Objects as well **type** bool - -.. class:: KX_LightObject(KX_GameObject) - - A Light object. - - .. code-block:: python - - # Turn on a red alert light. - import bge - - co = bge.logic.getCurrentController() - light = co.owner - - light.energy = 1.0 - light.colour = [1.0, 0.0, 0.0] - - .. data:: SPOT - - A spot light source. See attribute :data:`type` - - .. data:: SUN - - A point light source with no attenuation. See attribute :data:`type` - - .. data:: NORMAL - - A point light source. See attribute :data:`type` - - .. attribute:: type - - The type of light - must be SPOT, SUN or NORMAL - - .. attribute:: layer - - The layer mask that this light affects object on. **type** bitfield - - .. attribute:: energy - - The brightness of this light. **type** float - - .. attribute:: distance - - The maximum distance this light can illuminate. (SPOT and NORMAL lights only) **type** float - - .. attribute:: colour - - The colour of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0]. **type** list [r, g, b] - - .. attribute:: color - - Synonym for colour. - - .. attribute:: lin_attenuation - - The linear component of this light's attenuation. (SPOT and NORMAL lights only) **type** float - - .. attribute:: quad_attenuation - - The quadratic component of this light's attenuation (SPOT and NORMAL lights only) **type** float - - .. attribute:: spotsize - - The cone angle of the spot light, in degrees (SPOT lights only). **type** float in [0 - 180]. - - .. attribute:: spotblend - - Specifies the intensity distribution of the spot light (SPOT lights only). **type** float in [0 - 1] - - .. note:: Higher values result in a more focused light source. - -.. class:: KX_MeshProxy(SCA_IObject) - - A mesh object. - - You can only change the vertex properties of a mesh object, not the mesh topology. - - To use mesh objects effectively, you should know a bit about how the game engine handles them. - - #. Mesh Objects are converted from Blender at scene load. - #. The Converter groups polygons by Material. This means they can be sent to the renderer efficiently. A material holds: - - #. The texture. - #. The Blender material. - #. The Tile properties - #. The face properties - (From the "Texture Face" panel) - #. Transparency & z sorting - #. Light layer - #. Polygon shape (triangle/quad) - #. Game Object - - #. Verticies will be split by face if necessary. Verticies can only be shared between faces if: - - #. They are at the same position - #. UV coordinates are the same - #. Their normals are the same (both polygons are "Set Smooth") - #. They are the same colour, for example: a cube has 24 verticies: 6 faces with 4 verticies per face. - - The correct method of iterating over every :class:`KX_VertexProxy` in a game object - - .. code-block:: python - - import GameLogic - - co = GameLogic.getCurrentController() - obj = co.owner - - m_i = 0 - mesh = obj.getMesh(m_i) # There can be more than one mesh... - while mesh != None: - for mat in range(mesh.getNumMaterials()): - for v_index in range(mesh.getVertexArrayLength(mat)): - vertex = mesh.getVertex(mat, v_index) - # Do something with vertex here... - # ... eg: colour the vertex red. - vertex.colour = [1.0, 0.0, 0.0, 1.0] - m_i += 1 - mesh = obj.getMesh(m_i) - - .. attribute:: materials - - **type** list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types - - .. attribute:: numPolygons - - **type** integer - - .. attribute:: numMaterials - - **type** integer - - .. method:: getNumMaterials() - - :return: number of materials associated with this object - :rtype: integer - - .. method:: getMaterialName(matid) - - Gets the name of the specified material. - - :arg matid: the specified material. - :type matid: integer - :return: the attached material name. - :rtype: string - - .. method:: getTextureName(matid) - - Gets the name of the specified material's texture. - - :arg matid: the specified material - :type matid: integer - :return: the attached material's texture name. - :rtype: string - - .. method:: getVertexArrayLength(matid) - - Gets the length of the vertex array associated with the specified material. - - There is one vertex array for each material. - - :arg matid: the specified material - :type matid: integer - :return: the number of verticies in the vertex array. - :rtype: integer - - .. method:: getVertex(matid, index) - - Gets the specified vertex from the mesh object. - - :arg matid: the specified material - :type matid: integer - :arg index: the index into the vertex array. - :type index: integer - :return: a vertex object. - :rtype: :class:`KX_VertexProxy` - - .. method:: getNumPolygons() - - :return: The number of polygon in the mesh. - :rtype: integer - - .. method:: getPolygon(index) - - Gets the specified polygon from the mesh. - - :arg index: polygon number - :type index: integer - :return: a polygon object. - :rtype: :class:`PolyProxy` - -.. class:: SCA_MouseSensor(SCA_ISensor) - - Mouse Sensor logic brick. - - Properties: - - .. attribute:: position - - current [x, y] coordinates of the mouse, in frame coordinates (pixels) **type** [integer, interger] - - .. attribute:: mode - - sensor mode. **type** integer - - * KX_MOUSESENSORMODE_LEFTBUTTON(1) - * KX_MOUSESENSORMODE_MIDDLEBUTTON(2) - * KX_MOUSESENSORMODE_RIGHTBUTTON(3) - * KX_MOUSESENSORMODE_WHEELUP(4) - * KX_MOUSESENSORMODE_WHEELDOWN(5) - * KX_MOUSESENSORMODE_MOVEMENT(6) - - .. method:: getButtonStatus(button) - - Get the mouse button status. - - :arg button: value in GameLogic members KX_MOUSE_BUT_LEFT, KX_MOUSE_BUT_MIDDLE, KX_MOUSE_BUT_RIGHT - :type button: integer - :return: value in GameLogic members KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED - :rtype: integer - -.. class:: KX_MouseFocusSensor(SCA_MouseSensor) - - The mouse focus sensor detects when the mouse is over the current game object. - - The mouse focus sensor works by transforming the mouse coordinates from 2d device - space to 3d space then raycasting away from the camera. - - .. attribute:: raySource - - The worldspace source of the ray (the view position) **type** list (vector of 3 floats) - - .. attribute:: rayTarget - - The worldspace target of the ray. **type** list (vector of 3 floats) - - .. attribute:: rayDirection - - The :data:`rayTarget` - :class:`raySource` normalized. **type** list (normalized vector of 3 floats) - - .. attribute:: hitObject - - the last object the mouse was over. **type** :class:`KX_GameObject` or None - - .. attribute:: hitPosition - - The worldspace position of the ray intersecton. **type** list (vector of 3 floats) - - .. attribute:: hitNormal - - the worldspace normal from the face at point of intersection. **type** list (normalized vector of 3 floats) - - .. attribute:: hitUV - - the UV coordinates at the point of intersection. **type** list (vector of 2 floats) - - If the object has no UV mapping, it returns [0, 0]. - - The UV coordinates are not normalized, they can be < 0 or > 1 depending on the UV mapping. - - .. attribute:: usePulseFocus - - When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set) **type** bool - -.. class:: KX_TouchSensor(SCA_ISensor) - - Touch sensor detects collisions between objects. - - .. attribute:: propName - - The property or material to collide with. **type** string - - .. attribute:: useMaterial - - Determines if the sensor is looking for a property or material. KX_True = Find material; KX_False = Find property. **type** boolean - - .. attribute:: usePulseCollision - - When enabled, changes to the set of colliding objects generate a pulse. **type** bool - - .. attribute:: hitObject - - The last collided object. (read-only) **type** :class:`KX_GameObject` or None - - .. attribute:: hitObjectList - - A list of colliding objects. (read-only) **type** :class:`CListValue` of :class:`KX_GameObject` - -.. class:: KX_NearSensor(KX_TouchSensor) - - A near sensor is a specialised form of touch sensor. - - .. attribute:: distance - - The near sensor activates when an object is within this distance. **type** float - - .. attribute:: resetDistance - - The near sensor deactivates when the object exceeds this distance. **type** float - -.. class:: KX_NetworkMessageActuator(SCA_IActuator) - - Message Actuator - - .. attribute:: propName - - Messages will only be sent to objects with the given property name. **type** string - - .. attribute:: subject - - The subject field of the message. **type** string - - .. attribute:: body - - The body of the message. **type** string - - .. attribute:: usePropBody - - Send a property instead of a regular body message. **type** boolean - -.. class:: KX_NetworkMessageSensor(SCA_ISensor) - - The Message Sensor logic brick. - - Currently only loopback (local) networks are supported. - - .. attribute:: subject - - The subject the sensor is looking for. **type** string - - .. attribute:: frameMessageCount - - The number of messages received since the last frame. (read-only). **type** integer - - .. attribute:: subjects - - The list of message subjects received. (read-only). **type** list of strings - - .. attribute:: bodies - - The list of message bodies received. (read-only) **type** list of strings - -.. class:: KX_ObjectActuator(SCA_IActuator) - - The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement, - velocity, or angular velocity to an object. - Servo control allows to regulate force to achieve a certain speed target. - - .. attribute:: force - - The force applied by the actuator **type** list [x, y, z] - - .. attribute:: useLocalForce - - A flag specifying if the force is local **type** bool - - .. attribute:: torque - - The torque applied by the actuator **type** list [x, y, z] - - .. attribute:: useLocalTorque - - A flag specifying if the torque is local **type** bool - - .. attribute:: dLoc - - The displacement vector applied by the actuator **type** list [x, y, z] - - .. attribute:: useLocalDLoc - - A flag specifying if the dLoc is local **type** bool - - .. attribute:: dRot - - The angular displacement vector applied by the actuator - - .. note:: Since the displacement is applied every frame, you must adjust the displacement based on the frame rate, or you game experience will depend on the player's computer speed. **type** list [x, y, z] - - .. attribute:: useLocalDRot - - A flag specifying if the dRot is local **type** bool - - .. attribute:: linV - - The linear velocity applied by the actuator **type** list [x, y, z] - - .. attribute:: useLocalLinV - - A flag specifying if the linear velocity is local. - - .. note:: This is the target speed for servo controllers **type** bool - - .. attribute:: angV - - The angular velocity applied by the actuator **type** list [x, y, z] - - .. attribute:: useLocalAngV - - A flag specifying if the angular velocity is local **type** bool - - .. attribute:: damping - - The damping parameter of the servo controller **type** short - - .. attribute:: forceLimitX - - The min/max force limit along the X axis and activates or deactivates the limits in the servo controller **type** list [min(float), max(float), bool] - - .. attribute:: forceLimitY - - The min/max force limit along the Y axis and activates or deactivates the limits in the servo controller **type** list [min(float), max(float), bool] - - .. attribute:: forceLimitZ - - The min/max force limit along the Z axis and activates or deactivates the limits in the servo controller **type** list [min(float), max(float), bool] - - .. attribute:: pid - - The PID coefficients of the servo controller **type** list of floats [proportional, integral, derivate] - - .. attribute:: reference - - The object that is used as reference to compute the velocity for the servo controller. **type** :class:`KX_GameObject` or None - -.. class:: KX_ParentActuator(SCA_IActuator) - - The parent actuator can set or remove an objects parent object. - - .. attribute:: object - - the object this actuator sets the parent too. **type** :class:`KX_GameObject` or None - - .. attribute:: mode - - The mode of this actuator **type** integer from 0 to 1. - - .. attribute:: compound - - Whether the object shape should be added to the parent compound shape when parenting. - - Effective only if the parent is already a compound shape **type** bool - - .. attribute:: ghost - - whether the object should be made ghost when parenting - Effective only if the shape is not added to the parent compound shape **type** bool - -.. class:: KX_PhysicsObjectWrapper(PyObjectPlus) - - KX_PhysicsObjectWrapper - - .. method:: setActive(active) - - Set the object to be active. - - :arg active: set to True to be active - :type active: bool - - .. method:: setAngularVelocity(x, y, z, local) - - Set the angular velocity of the object. - - :arg x: angular velocity for the x-axis - :type x: float - - :arg y: angular velocity for the y-axis - :type y: float - - :arg z: angular velocity for the z-axis - :type z: float - - :arg local: set to True for local axis - :type local: bool - - .. method:: setLinearVelocity(x, y, z, local) - - Set the linear velocity of the object. - - :arg x: linear velocity for the x-axis - :type x: float - - :arg y: linear velocity for the y-axis - :type y: float - - :arg z: linear velocity for the z-axis - :type z: float - - :arg local: set to True for local axis - :type local: bool - -.. class:: KX_PolyProxy(SCA_IObject) - - A polygon holds the index of the vertex forming the poylgon. - - Note: - The polygon attributes are read-only, you need to retrieve the vertex proxy if you want - to change the vertex settings. - - .. attribute:: matname - - The name of polygon material, empty if no material. **type** string - - .. attribute:: material - - The material of the polygon **type** :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial` - - .. attribute:: texture - - The texture name of the polygon. **type** string - - .. attribute:: matid - - The material index of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer - - .. attribute:: v1 - - vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer - - .. attribute:: v2 - - vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer - - .. attribute:: v3 - - vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer - - .. attribute:: v4 - - vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex - use this to retrieve vertex proxy from mesh proxy **type** integer - - .. attribute:: visible - - visible state of the polygon: 1=visible, 0=invisible **type** integer - - .. attribute:: collide - - collide state of the polygon: 1=receives collision, 0=collision free. **type** integer - - .. method:: getMaterialName() - - Returns the polygon material name with MA prefix - - :return: material name - :rtype: string - - .. method:: getMaterial() - - :return: The polygon material - :rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial` - - .. method:: getTextureName() - - :return: The texture name - :rtype: string - - .. method:: getMaterialIndex() - - Returns the material bucket index of the polygon. - This index and the ones returned by getVertexIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`. - - :return: the material index in the mesh - :rtype: integer - - .. method:: getNumVertex() - - Returns the number of vertex of the polygon. - - :return: number of vertex, 3 or 4. - :rtype: integer - - .. method:: isVisible() - - Returns whether the polygon is visible or not - - :return: 0=invisible, 1=visible - :rtype: boolean - - .. method:: isCollider() - - Returns whether the polygon is receives collision or not - - :return: 0=collision free, 1=receives collision - :rtype: integer - - .. method:: getVertexIndex(vertex) - - Returns the mesh vertex index of a polygon vertex - This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`. - - :arg vertex: index of the vertex in the polygon: 0->3 - :arg vertex: integer - :return: mesh vertex index - :rtype: integer - - .. method:: getMesh() - - Returns a mesh proxy - - :return: mesh proxy - :rtype: :class:`MeshProxy` - -.. class:: KX_PolygonMaterial - - This is the interface to materials in the game engine. - - Materials define the render state to be applied to mesh objects. - - .. warning:: Some of the methods/variables are CObjects. If you mix these up, you will crash blender. - - This example requires - - * PyOpenGL - * GLEWPy - - .. code-block:: python - - import GameLogic - import OpenGL - from OpenGL.GL import * - from OpenGL.GLU import * - import glew - from glew import * - - glewInit() - - vertex_shader = """ - - void main(void) - { - gl_Position = ftransform(); - } - """ - - fragment_shader =""" - - void main(void) - { - gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); - } - """ - - class MyMaterial: - def __init__(self): - self.pass_no = 0 - # Create a shader - self.m_program = glCreateProgramObjectARB() - # Compile the vertex shader - self.shader(GL_VERTEX_SHADER_ARB, (vertex_shader)) - # Compile the fragment shader - self.shader(GL_FRAGMENT_SHADER_ARB, (fragment_shader)) - # Link the shaders together - self.link() - - def PrintInfoLog(self, tag, object): - """ - PrintInfoLog prints the GLSL compiler log - """ - print "Tag: def PrintGLError(self, tag = ""): - - def PrintGLError(self, tag = ""): - """ - Prints the current GL error status - """ - if len(tag): - print tag - err = glGetError() - if err != GL_NO_ERROR: - print "GL Error: %s\\n"%(gluErrorString(err)) - - def shader(self, type, shaders): - """ - shader compiles a GLSL shader and attaches it to the current - program. - - type should be either GL_VERTEX_SHADER_ARB or GL_FRAGMENT_SHADER_ARB - shaders should be a sequence of shader source to compile. - """ - # Create a shader object - shader_object = glCreateShaderObjectARB(type) - - # Add the source code - glShaderSourceARB(shader_object, len(shaders), shaders) - - # Compile the shader - glCompileShaderARB(shader_object) - - # Print the compiler log - self.PrintInfoLog("vertex shader", shader_object) - - # Check if compiled, and attach if it did - compiled = glGetObjectParameterivARB(shader_object, GL_OBJECT_COMPILE_STATUS_ARB) - if compiled: - glAttachObjectARB(self.m_program, shader_object) - - # Delete the object (glAttachObjectARB makes a copy) - glDeleteObjectARB(shader_object) - - # print the gl error log - self.PrintGLError() - - def link(self): - """ - Links the shaders together. - """ - # clear error indicator - glGetError() - - glLinkProgramARB(self.m_program) - - self.PrintInfoLog("link", self.m_program) - - linked = glGetObjectParameterivARB(self.m_program, GL_OBJECT_LINK_STATUS_ARB) - if not linked: - print "Shader failed to link" - return - - glValidateProgramARB(self.m_program) - valid = glGetObjectParameterivARB(self.m_program, GL_OBJECT_VALIDATE_STATUS_ARB) - if not valid: - print "Shader failed to validate" - return - - def activate(self, rasty, cachingInfo, mat): - self.pass_no+=1 - if (self.pass_no == 1): - glDisable(GL_COLOR_MATERIAL) - glUseProgramObjectARB(self.m_program) - return True - - glEnable(GL_COLOR_MATERIAL) - glUseProgramObjectARB(0) - self.pass_no = 0 - return False - - obj = GameLogic.getCurrentController().owner - - mesh = obj.meshes[0] - - for mat in mesh.materials: - mat.setCustomMaterial(MyMaterial()) - print mat.texture - - .. attribute:: texture - - Texture name **type** string (read-only) - - .. attribute:: gl_texture - - OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture) **type** integer (read-only) - - .. attribute:: material - - Material name **type** string (read-only) - - .. attribute:: tface - - Texture face properties **type** CObject (read-only) - - .. attribute:: tile - - Texture is tiling **type** boolean - - .. attribute:: tilexrep - - Number of tile repetitions in x direction. **type** integer - - .. attribute:: tileyrep - - Number of tile repetitions in y direction. **type** integer - - .. attribute:: drawingmode - - Drawing mode for the material. - - 2 (drawingmode & 4) Textured - - 4 (drawingmode & 16) Light - - 14 (drawingmode & 16384) 3d Polygon Text **type** bitfield - - .. attribute:: transparent - - This material is transparent. All meshes with this - material will be rendered after non transparent meshes from back - to front. **type** boolean - - .. attribute:: zsort - - Transparent polygons in meshes with this material will be sorted back to - front before rendering. - Non-Transparent polygons will be sorted front to back before rendering. **type** boolean - - .. attribute:: lightlayer - - Light layers this material affects. **type** bitfield. - - .. attribute:: triangle - - Mesh data with this material is triangles. It's probably not safe to change this. **type** boolean - - .. attribute:: diffuse - - The diffuse colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0] **type** list [r, g, b] - - .. attribute:: specular - - The specular colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0] **type** list [r, g, b] - - .. attribute:: shininess - - The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0 **type** float - - .. attribute:: specularity - - The amount of specular of the material. 0.0 <= specularity <= 1.0 **type** float - - .. method:: updateTexture(tface, rasty) - - Updates a realtime animation. - - :arg tface: Texture face (eg mat.tface) - :type tface: CObject - :arg rasty: Rasterizer - :type rasty: CObject - - .. method:: setTexture(tface) - - Sets texture render state. - - .. code-block:: python - - mat.setTexture(mat.tface) - - :arg tface: Texture face - :type tface: CObject - - .. method:: activate(rasty, cachingInfo) - - Sets material parameters for this object for rendering. - - Material Parameters set: - - #. Texture - #. Backface culling - #. Line drawing - #. Specular Colour - #. Shininess - #. Diffuse Colour - #. Polygon Offset. - - :arg rasty: Rasterizer instance. - :type rasty: CObject - :arg cachingInfo: Material cache instance. - :type cachingInfo: CObject - - .. method:: setCustomMaterial(material) - - Sets the material state setup object. - - Using this method, you can extend or completely replace the gameengine material - to do your own advanced multipass effects. - - Use this method to register your material class. Instead of the normal material, - your class's activate method will be called just before rendering the mesh. - This should setup the texture, material, and any other state you would like. - It should return True to render the mesh, or False if you are finished. You should - clean up any state Blender does not set before returning False. - - Activate Method Definition:: - `def activate(self, rasty, cachingInfo, material):` - - .. code-block:: python - - class PyMaterial: - def __init__(self): - self.pass_no = -1 - - def activate(self, rasty, cachingInfo, material): - # Activate the material here. - # - # The activate method will be called until it returns False. - # Every time the activate method returns True the mesh will - # be rendered. - # - # rasty is a CObject for passing to material.updateTexture() - # and material.activate() - # cachingInfo is a CObject for passing to material.activate() - # material is the KX_PolygonMaterial instance this material - # was added to - - # default material properties: - self.pass_no += 1 - if self.pass_no == 0: - material.activate(rasty, cachingInfo) - # Return True to do this pass - return True - - # clean up and return False to finish. - self.pass_no = -1 - return False - - # Create a new Python Material and pass it to the renderer. - mat.setCustomMaterial(PyMaterial()) - - :arg material: The material object. - :type material: instance - -.. class:: KX_RadarSensor(KX_NearSensor) - - Radar sensor is a near sensor with a conical sensor object. - - .. attribute:: coneOrigin - - The origin of the cone with which to test. The origin is in the middle of the cone. (read-only) **type** list of floats [x, y, z] - - .. attribute:: coneTarget - - The center of the bottom face of the cone with which to test. (read-only) **type** list of floats [x, y, z] - - .. attribute:: distance - - The height of the cone with which to test. **type** float - - .. attribute:: angle - - The angle of the cone (in degrees) with which to test. **type** float from 0 to 360 - - .. attribute:: axis - - The axis on which the radar cone is cast **type** integer from 0 to 5 - - KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z, - KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z - - .. method:: getConeHeight() - - :return: The height of the cone with which to test. - :rtype: float - -.. class:: KX_RaySensor(SCA_ISensor) - - A ray sensor detects the first object in a given direction. - - .. attribute:: propName - - The property the ray is looking for. **type** string - - .. attribute:: range - - The distance of the ray. **type** float - - .. attribute:: useMaterial - - Whether or not to look for a material (false = property) **type** boolean - - .. attribute:: useXRay - - Whether or not to use XRay. **type** boolean - - .. attribute:: hitObject - - The game object that was hit by the ray. (read-only) **type** :class:`KX_GameObject` - - .. attribute:: hitPosition - - The position (in worldcoordinates) where the object was hit by the ray. (read-only) **type** list [x, y, z] - - .. attribute:: hitNormal - - The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (read-only) **type** list [x, y, z] - - .. attribute:: rayDirection - - The direction from the ray (in worldcoordinates). (read-only) **type** list [x, y, z] - - .. attribute:: axis - - The axis the ray is pointing on. **type** integer from 0 to 5 - - * KX_RAY_AXIS_POS_X - * KX_RAY_AXIS_POS_Y - * KX_RAY_AXIS_POS_Z - * KX_RAY_AXIS_NEG_X - * KX_RAY_AXIS_NEG_Y - * KX_RAY_AXIS_NEG_Z - -.. class:: KX_SCA_AddObjectActuator(SCA_IActuator) - - Edit Object Actuator (in Add Object Mode) - - .. attribute:: object - - the object this actuator adds. **type** :class:`KX_GameObject` or None - - .. attribute:: objectLastCreated - - the last added object from this actuator (read-only). **type** :class:`KX_GameObject` or None - - .. attribute:: time - - the lifetime of added objects, in frames. Set to 0 to disable automatic deletion. **type** integer - - .. attribute:: linearVelocity - - the initial linear velocity of added objects. **type** list [vx, vy, vz] - - .. attribute:: angularVelocity - - the initial angular velocity of added objects. **type** list [vx, vy, vz] - - .. warning:: An Add Object actuator will be ignored if at game start, the linked object doesn't exist - (or is empty) or the linked object is in an active layer. - - This will genereate a warning in the console: - - ``Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer)`` - - .. method:: instantAddObject() - - :return: The last object created by this actuator. The object can then be accessed from :data:`objectLastCreated`. - :rtype: None - -.. class:: KX_SCA_DynamicActuator(SCA_IActuator) - - Dynamic Actuator. - - .. attribute:: mode - - **type** integer - - the type of operation of the actuator, 0-4 - - * KX_DYN_RESTORE_DYNAMICS(0) - * KX_DYN_DISABLE_DYNAMICS(1) - * KX_DYN_ENABLE_RIGID_BODY(2) - * KX_DYN_DISABLE_RIGID_BODY(3) - * KX_DYN_SET_MASS(4) - - .. attribute:: mass - - the mass value for the KX_DYN_SET_MASS operation **type** float - -.. class:: KX_SCA_EndObjectActuator(SCA_IActuator) - - Edit Object Actuator (in End Object mode) - - This actuator has no python methods. - -.. class:: KX_SCA_ReplaceMeshActuator(SCA_IActuator) - - Edit Object actuator, in Replace Mesh mode. - - .. code-block:: python - - # Level-of-detail - # Switch a game object's mesh based on its depth in the camera view. - # +----------+ +-----------+ +-------------------------------------+ - # | Always +-----+ Python +-----+ Edit Object (Replace Mesh) LOD.Mesh | - # +----------+ +-----------+ +-------------------------------------+ - import GameLogic - - # List detail meshes here - # Mesh (name, near, far) - # Meshes overlap so that they don't 'pop' when on the edge of the distance. - meshes = ((".Hi", 0.0, -20.0), - (".Med", -15.0, -50.0), - (".Lo", -40.0, -100.0) - ) - - co = GameLogic.getCurrentController() - obj = co.owner - act = co.actuators["LOD." + obj.name] - cam = GameLogic.getCurrentScene().active_camera - - def Depth(pos, plane): - return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3] - - # Depth is negative and decreasing further from the camera - depth = Depth(obj.position, cam.world_to_camera[2]) - - newmesh = None - curmesh = None - # Find the lowest detail mesh for depth - for mesh in meshes: - if depth < mesh[1] and depth > mesh[2]: - newmesh = mesh - if "ME" + obj.name + mesh[0] == act.getMesh(): - curmesh = mesh - - if newmesh != None and "ME" + obj.name + newmesh[0] != act.getMesh(): - # The mesh is a different mesh - switch it. - # Check the current mesh is not a better fit. - if curmesh == None or curmesh[1] < depth or curmesh[2] > depth: - act.mesh = obj.getName() + newmesh[0] - GameLogic.addActiveActuator(act, True) - - .. warning:: Replace mesh actuators will be ignored if at game start, the named mesh doesn't exist. - - This will generate a warning in the console - - ``Error: GameObject 'Name' ReplaceMeshActuator 'ActuatorName' without object`` - - .. attribute:: mesh - - :class:`MeshProxy` or the name of the mesh that will replace the current one. - - Set to None to disable actuator **type** :class:`MeshProxy` or None if no mesh is set - - .. attribute:: useDisplayMesh - - when true the displayed mesh is replaced. **type** boolean - - .. attribute:: usePhysicsMesh - - when true the physics mesh is replaced. **type** boolean - - .. method:: instantReplaceMesh() - - Immediately replace mesh without delay. - -.. class:: KX_Scene(PyObjectPlus) - - An active scene that gives access to objects, cameras, lights and scene attributes. - - The activity culling stuff is supposed to disable logic bricks when their owner gets too far - from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows - what it does! - - .. code-block:: python - - import GameLogic - - # get the scene - scene = GameLogic.getCurrentScene() - - # print all the objects in the scene - for obj in scene.objects: - print obj.name - - # get an object named 'Cube' - obj = scene.objects["Cube"] - - # get the first object in the scene. - obj = scene.objects[0] - - .. code-block:: python - - # Get the depth of an object in the camera view. - import GameLogic - - obj = GameLogic.getCurrentController().owner - cam = GameLogic.getCurrentScene().active_camera - - # Depth is negative and decreasing further from the camera - depth = obj.position[0]*cam.world_to_camera[2][0] + obj.position[1]*cam.world_to_camera[2][1] + obj.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3] - - @bug: All attributes are read only at the moment. - - .. attribute:: name - - The scene's name, (read-only). **type** string - - .. attribute:: objects - - A list of objects in the scene, (read-only). **type** :class:`CListValue` of :class:`KX_GameObject` - - .. attribute:: objectsInactive - - A list of objects on background layers (used for the addObject actuator), (read-only). **type** :class:`CListValue` of :class:`KX_GameObject` - - .. attribute:: lights - - A list of lights in the scene, (read-only). **type** :class:`CListValue` of :class:`KX_LightObject` - - .. attribute:: cameras - - A list of cameras in the scene, (read-only). **type** :class:`CListValue` of :class:`KX_Camera` - - .. attribute:: active_camera - - The current active camera. - - .. note:: this can be set directly from python to avoid using the :class:`KX_SceneActuator`. **type** :class:`KX_Camera` - - .. attribute:: suspended - - True if the scene is suspended, (read-only). **type** boolean - - .. attribute:: activity_culling - - True if the scene is activity culling **type** boolean - - .. attribute:: activity_culling_radius - - The distance outside which to do activity culling. Measured in manhattan distance. **type** float - - .. attribute:: dbvt_culling - - True when Dynamic Bounding box Volume Tree is set (read-only). **type** bool - - .. attribute:: pre_draw - - A list of callables to be run before the render step. **type** list - - .. attribute:: post_draw - - A list of callables to be run after the render step. **type** list - - .. method:: addObject(object, other, time=0) - - Adds an object to the scene like the Add Object Actuator would. - - :arg object: The object to add - :type object: :class:`KX_GameObject` or string - :arg other: The object's center to use when adding the object - :type other: :class:`KX_GameObject` or string - :arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever. - :type time: integer - :return: The newly added object. - :rtype: :class:`KX_GameObject` - - .. method:: end() - - Removes the scene from the game. - - .. method:: restart() - - Restarts the scene. - - .. method:: replace(scene) - - Replaces this scene with another one. - - :arg scene: The name of the scene to replace this scene with. - :type scene: string - - .. method:: suspend() - - Suspends this scene. - - .. method:: resume() - - Resume this scene. - - .. method:: get(key, default=None) - - Return the value matching key, or the default value if its not found. - :return: The key value or a default. - -.. class:: KX_SceneActuator(SCA_IActuator) - - Scene Actuator logic brick. - - .. warning:: Scene actuators that use a scene name will be ignored if at game start, the named scene doesn't exist or is empty - - This will generate a warning in the console: - - ``Error: GameObject 'Name' has a SceneActuator 'ActuatorName' (SetScene) without scene`` - - .. attribute:: scene - - the name of the scene to change to/overlay/underlay/remove/suspend/resume **type** string. - - .. attribute:: camera - - the camera to change to. - - .. note:: When setting the attribute, you can use either a :class:`KX_Camera` or the name of the camera. **type** :class:`KX_Camera` on read, string or :class:`KX_Camera` on write - - .. attribute:: useRestart - - Set flag to True to restart the sene **type** bool - - .. attribute:: mode - - The mode of the actuator **type** integer from 0 to 5. - -.. class:: KX_SoundActuator(SCA_IActuator) - - Sound Actuator. - - The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not requirethe actuator to be activated - they act instantly provided that the actuator has been activated once at least. - - .. attribute:: fileName - - The filename of the sound this actuator plays. **type** string - - .. attribute:: volume - - The volume (gain) of the sound. **type** float - - .. attribute:: pitch - - The pitch of the sound. **type** float - - .. attribute:: rollOffFactor - - The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away. **type** float - - .. attribute:: looping - - The loop mode of the actuator. **type** integer - - .. attribute:: position - - The position of the sound as a list: [x, y, z]. **type** float array - - .. attribute:: velocity - - The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z]. **type** float array - - .. attribute:: orientation - - The orientation of the sound. When setting the orientation you can also use quaternion [float, float, float, float] or euler angles [float, float, float] **type** 3x3 matrix [[float]] - - .. attribute:: mode - - The operation mode of the actuator. **type** integer - - You can use one of the following constants: - * KX_SOUNDACT_PLAYSTOP (1) - * KX_SOUNDACT_PLAYEND (2) - * KX_SOUNDACT_LOOPSTOP (3) - * KX_SOUNDACT_LOOPEND (4) - * KX_SOUNDACT_LOOPBIDIRECTIONAL (5) - * KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP (6) - -.. class:: KX_StateActuator(SCA_IActuator) - - State actuator changes the state mask of parent object. - - Property: - - .. attribute:: operation - - type of bit operation to be applied on object state mask. - - You can use one of the following constant: - - * KX_STATE_OP_CPY (0) : Copy state mask - * KX_STATE_OP_SET (1) : Add bits to state mask - * KX_STATE_OP_CLR (2) : Substract bits to state mask - * KX_STATE_OP_NEG (3) : Invert bits to state mask **type** integer - - .. attribute:: mask - - value that defines the bits that will be modified by the operation. - The bits that are 1 in the mask will be updated in the object state, - the bits that are 0 are will be left unmodified expect for the Copy operation - which copies the mask to the object state **type** integer - -.. class:: KX_TrackToActuator(SCA_IActuator) - - Edit Object actuator in Track To mode. - - .. warning:: Track To Actuators will be ignored if at game start, the - object to track to is invalid. - - This will generate a warning in the console: - - ``Error: GameObject 'Name' no object in EditObjectActuator 'ActuatorName'`` - - .. attribute:: object - - the object this actuator tracks. **type** :class:`KX_GameObject` or None - - .. attribute:: time - - the time in frames with which to delay the tracking motion **type** integer - - .. attribute:: use3D - - the tracking motion to use 3D **type** boolean - -.. class:: KX_VehicleWrapper(PyObjectPlus) - - KX_VehicleWrapper - - TODO - description - - .. method:: addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering) - - Add a wheel to the vehicle - - :arg wheel: The object to use as a wheel. - :type wheel: :class:`KX_GameObject` or a KX_GameObject name - :arg attachPos: The position that this wheel will attach to. - :type attachPos: vector of 3 floats - :arg attachDir: The direction this wheel points. - :type attachDir: vector of 3 floats - :arg axleDir: The direction of this wheels axle. - :type axleDir: vector of 3 floats - :arg suspensionRestLength: TODO - Description - :type suspensionRestLength: float - :arg wheelRadius: The size of the wheel. - :type wheelRadius: float - - .. method:: applyBraking(force, wheelIndex) - - Apply a braking force to the specified wheel - - :arg force: the brake force - :type force: float - - :arg wheelIndex: index of the wheel where the force needs to be applied - :type wheelIndex: integer - - .. method:: applyEngineForce(force, wheelIndex) - - Apply an engine force to the specified wheel - - :arg force: the engine force - :type force: float - - :arg wheelIndex: index of the wheel where the force needs to be applied - :type wheelIndex: integer - - .. method:: getConstraintId() - - Get the constraint ID - - :return: the constraint id - :rtype: integer - - .. method:: getConstraintType() - - Returns the constraint type. - - :return: constraint type - :rtype: integer - - .. method:: getNumWheels() - - Returns the number of wheels. - - :return: the number of wheels for this vehicle - :rtype: integer - - .. method:: getWheelOrientationQuaternion(wheelIndex) - - Returns the wheel orientation as a quaternion. - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - :return: TODO Description - :rtype: TODO - type should be quat as per method name but from the code it looks like a matrix - - .. method:: getWheelPosition(wheelIndex) - - Returns the position of the specified wheel - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - :return: position vector - :rtype: list[x, y, z] - - .. method:: getWheelRotation(wheelIndex) - - Returns the rotation of the specified wheel - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - :return: the wheel rotation - :rtype: float - - .. method:: setRollInfluence(rollInfluece, wheelIndex) - - Set the specified wheel's roll influence. - The higher the roll influence the more the vehicle will tend to roll over in corners. - - :arg rollInfluece: the wheel roll influence - :type rollInfluece: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - .. method:: setSteeringValue(steering, wheelIndex) - - Set the specified wheel's steering - - :arg steering: the wheel steering - :type steering: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - .. method:: setSuspensionCompression(compression, wheelIndex) - - Set the specified wheel's compression - - :arg compression: the wheel compression - :type compression: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - .. method:: setSuspensionDamping(damping, wheelIndex) - - Set the specified wheel's damping - - :arg damping: the wheel damping - :type damping: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - .. method:: setSuspensionStiffness(stiffness, wheelIndex) - - Set the specified wheel's stiffness - - :arg stiffness: the wheel stiffness - :type stiffness: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - - .. method:: setTyreFriction(friction, wheelIndex) - - Set the specified wheel's tyre friction - - :arg friction: the tyre friction - :type friction: float - - :arg wheelIndex: the wheel index - :type wheelIndex: integer - -.. class:: KX_VertexProxy(SCA_IObject) - - A vertex holds position, UV, colour and normal information. - - Note: - The physics simulation is NOT currently updated - physics will not respond - to changes in the vertex position. - - .. attribute:: XYZ - - The position of the vertex. **type** list [x, y, z] - - .. attribute:: UV - - The texture coordinates of the vertex. **type** list [u, v] - - .. attribute:: normal - - The normal of the vertex **type** list [nx, ny, nz] - - .. attribute:: colour - - The colour of the vertex. **type** list [r, g, b, a] - - Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0] - - .. attribute:: color - - Synonym for colour. - - .. attribute:: x - - The x coordinate of the vertex. **type** float - - .. attribute:: y - - The y coordinate of the vertex. **type** float - - .. attribute:: z - - The z coordinate of the vertex. **type** float - - .. attribute:: u - - The u texture coordinate of the vertex. **type** float - - .. attribute:: v - - The v texture coordinate of the vertex. **type** float - - .. attribute:: u2 - - The second u texture coordinate of the vertex. **type** float - - .. attribute:: v2 - - The second v texture coordinate of the vertex. **type** float - - .. attribute:: r - - The red component of the vertex colour. 0.0 <= r <= 1.0 **type** float - - .. attribute:: g - - The green component of the vertex colour. 0.0 <= g <= 1.0 **type** float - - .. attribute:: b - - The blue component of the vertex colour. 0.0 <= b <= 1.0 **type** float - - .. attribute:: a - - The alpha component of the vertex colour. 0.0 <= a <= 1.0 **type** float - - .. method:: getXYZ() - - Gets the position of this vertex. - - :return: this vertexes position in local coordinates. - :rtype: list [x, y, z] - - .. method:: setXYZ(pos) - - Sets the position of this vertex. - - **type** list [x, y, z] - - :arg pos: the new position for this vertex in local coordinates. - - .. method:: getUV() - - Gets the UV (texture) coordinates of this vertex. - - :return: this vertexes UV (texture) coordinates. - :rtype: list [u, v] - - .. method:: setUV(uv) - - Sets the UV (texture) coordinates of this vertex. - - **type** list [u, v] - - .. method:: getUV2() - - Gets the 2nd UV (texture) coordinates of this vertex. - - :return: this vertexes UV (texture) coordinates. - :rtype: list [u, v] - - .. method:: setUV2(uv, unit) - - Sets the 2nd UV (texture) coordinates of this vertex. - - **type** list [u, v] - - :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV - :arg unit: integer - - .. method:: getRGBA() - - Gets the colour of this vertex. - - The colour is represented as four bytes packed into an integer value. The colour is - packed as RGBA. - - Since Python offers no way to get each byte without shifting, you must use the struct module to - access colour in an machine independent way. - - Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead. - - .. code-block:: python - - import struct; - col = struct.unpack('4B', struct.pack('I', v.getRGBA())) - # col = (r, g, b, a) - # black = ( 0, 0, 0, 255) - # white = (255, 255, 255, 255) - - :return: packed colour. 4 byte integer with one byte per colour channel in RGBA format. - :rtype: integer - - .. method:: setRGBA(col) - - Sets the colour of this vertex. - - See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes - or the colour attribute instead. - - setRGBA() also accepts a four component list as argument col. The list represents the colour as [r, g, b, a] - with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0] - - .. code-block:: python - - v.setRGBA(0xff0000ff) # Red - v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian - v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red - v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms. - - :arg col: the new colour of this vertex in packed RGBA format. - :type col: integer or list [r, g, b, a] - - .. method:: getNormal() - - Gets the normal vector of this vertex. - - :return: normalised normal vector. - :rtype: list [nx, ny, nz] - - .. method:: setNormal(normal) - - Sets the normal vector of this vertex. - - **type** sequence of floats [r, g, b] - - :arg normal: the new normal of this vertex. - -.. class:: KX_VisibilityActuator(SCA_IActuator) - - Visibility Actuator. - - .. attribute:: visibility - - whether the actuator makes its parent object visible or invisible **type** boolean - - .. attribute:: useOcclusion - - whether the actuator makes its parent object an occluder or not **type** boolean - - .. attribute:: useRecursion - - whether the visibility/occlusion should be propagated to all children of the object **type** boolean - -.. class:: SCA_2DFilterActuator(SCA_IActuator) - - Create, enable and disable 2D filters - - Properties: - - The following properties don't have an immediate effect. - You must active the actuator to get the result. - The actuator is not persistent: it automatically stops itself after setting up the filter - but the filter remains active. To stop a filter you must activate the actuator with 'type' - set to RAS_2DFILTER_DISABLED or RAS_2DFILTER_NOFILTER. - - .. attribute:: shaderText - - shader source code for custom shader **type** string - - .. attribute:: disableMotionBlur - - action on motion blur: 0=enable, 1=disable **type** integer - - .. attribute:: mode - - type of 2D filter, use one of the following constants: - - * RAS_2DFILTER_ENABLED (-2) : enable the filter that was previously disabled - * RAS_2DFILTER_DISABLED (-1) : disable the filter that is currently active - * RAS_2DFILTER_NOFILTER (0) : disable and destroy the filter that is currently active - * RAS_2DFILTER_MOTIONBLUR (1) : create and enable preset filters - * RAS_2DFILTER_BLUR (2) - * RAS_2DFILTER_SHARPEN (3) - * RAS_2DFILTER_DILATION (4) - * RAS_2DFILTER_EROSION (5) - * RAS_2DFILTER_LAPLACIAN (6) - * RAS_2DFILTER_SOBEL (7) - * RAS_2DFILTER_PREWITT (8) - * RAS_2DFILTER_GRAYSCALE (9) - * RAS_2DFILTER_SEPIA (10) - * RAS_2DFILTER_INVERT (11) - * RAS_2DFILTER_CUSTOMFILTER (12) : customer filter, the code code is set via shaderText property **type** integer - - .. attribute:: passNumber - - order number of filter in the stack of 2D filters. Filters are executed in increasing order of passNb. - - Only be one filter can be defined per passNb. **type** integer (0-100) - - .. attribute:: value - - argument for motion blur filter **type** float (0.0-100.0) - -.. class:: SCA_ANDController(SCA_IController) - - An AND controller activates only when all linked sensors are activated. - - There are no special python methods for this controller. - -.. class:: SCA_ActuatorSensor(SCA_ISensor) - - Actuator sensor detect change in actuator state of the parent object. - It generates a positive pulse if the corresponding actuator is activated - and a negative pulse if the actuator is deactivated. - - Properties: - - .. attribute:: actuator - - the name of the actuator that the sensor is monitoring. **type** string - -.. class:: SCA_AlwaysSensor(SCA_ISensor) - - This sensor is always activated. - -.. class:: SCA_DelaySensor(SCA_ISensor) - - The Delay sensor generates positive and negative triggers at precise time, - expressed in number of frames. The delay parameter defines the length of the initial OFF period. A positive trigger is generated at the end of this period. - - The duration parameter defines the length of the ON period following the OFF period. - There is a negative trigger at the end of the ON period. If duration is 0, the sensor stays ON and there is no negative trigger. - - The sensor runs the OFF-ON cycle once unless the repeat option is set: the OFF-ON cycle repeats indefinately (or the OFF cycle if duration is 0). - - Use :class:`SCA_ISensor.reset` at any time to restart sensor. - - Properties: - - .. attribute:: delay - - length of the initial OFF period as number of frame, 0 for immediate trigger. **type** integer. - - .. attribute:: duration - - length of the ON period in number of frame after the initial OFF period. - - If duration is greater than 0, a negative trigger is sent at the end of the ON pulse. **type** integer - - .. attribute:: repeat - - 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once. **type** integer - -.. class:: SCA_JoystickSensor(SCA_ISensor) - - This sensor detects player joystick events. - - Properties: - - .. attribute:: axisValues - - The state of the joysticks axis as a list of values :data:`numAxis` long. (read-only). **type** list of ints. - - Each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing. - The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls. - - * left:[-32767, 0, ...] - * right:[32767, 0, ...] - * up:[0, -32767, ...] - * down:[0, 32767, ...] - - .. attribute:: axisSingle - - like :data:`axisValues` but returns a single axis value that is set by the sensor. (read-only). **type** integer - - .. note:: only use this for "Single Axis" type sensors otherwise it will raise an error. - - .. attribute:: hatValues - - The state of the joysticks hats as a list of values :data:`numHats` long. (read-only) **type** list of ints - - Each spesifying the direction of the hat from 1 to 12, 0 when inactive. - - Hat directions are as follows... - - * 0:None - * 1:Up - * 2:Right - * 4:Down - * 8:Left - * 3:Up - Right - * 6:Down - Right - * 12:Down - Left - * 9:Up - Left - - .. attribute:: hatSingle - - Like :data:`hatValues` but returns a single hat direction value that is set by the sensor. (read-only). **type** integer - - .. attribute:: numAxis - - The number of axes for the joystick at this index. (read-only). **type** integer - - .. attribute:: numButtons - - The number of buttons for the joystick at this index. (read-only). **type** integer - - .. attribute:: numHats - - The number of hats for the joystick at this index. (read-only). **type** integer - - .. attribute:: connected - - True if a joystick is connected at this joysticks index. (read-only). **type** boolean - - .. attribute:: index - - The joystick index to use (from 0 to 7). The first joystick is always 0. **type** integer - - .. attribute:: threshold - - Axis threshold. Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive. **type** integer - - .. attribute:: button - - The button index the sensor reacts to (first button = 0). When the "All Events" toggle is set, this option has no effect. **type** integer - - .. attribute:: axis - - The axis this sensor reacts to, as a list of two values [axisIndex, axisDirection] - - * axisIndex: the axis index to use when detecting axis movement, 1=primary directional control, 2=secondary directional control. - * axisDirection: 0=right, 1=up, 2=left, 3=down. **type** [integer, integer] - - .. attribute:: hat - - The hat the sensor reacts to, as a list of two values: [hatIndex, hatDirection] - - * hatIndex: the hat index to use when detecting hat movement, 1=primary hat, 2=secondary hat (4 max). - * hatDirection: 1-12 **type** [integer, integer] - - .. method:: getButtonActiveList() - - :return: A list containing the indicies of the currently pressed buttons. - :rtype: list - - .. method:: getButtonStatus(buttonIndex) - - :arg buttonIndex: the button index, 0=first button - :type buttonIndex: integer - :return: The current pressed state of the specified button. - :rtype: boolean - -.. class:: SCA_KeyboardSensor(SCA_ISensor) - - A keyboard sensor detects player key presses. - - See module :mod:`bge.keys` for keycode values. - - .. attribute:: key - - The key code this sensor is looking for. **type** keycode from :mod:`bge.keys` module - - .. attribute:: hold1 - - The key code for the first modifier this sensor is looking for. **type** keycode from :mod:`bge.keys` module - - .. attribute:: hold2 - - The key code for the second modifier this sensor is looking for. **type** keycode from :mod:`bge.keys` module - - .. attribute:: toggleProperty - - The name of the property that indicates whether or not to log keystrokes as a string. **type** string - - .. attribute:: targetProperty - - The name of the property that receives keystrokes in case in case a string is logged. **type** string - - .. attribute:: useAllKeys - - Flag to determine whether or not to accept all keys. **type** boolean - - .. attribute:: events - - a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). **type** list [[keycode, status], ...] - - * 'keycode' matches the values in :mod:`bge.keys`. - * 'status' uses... - - * :mod:`bge.logic.KX_INPUT_NONE` - * :mod:`bge.logic.KX_INPUT_JUST_ACTIVATED` - * :mod:`bge.logic.KX_INPUT_ACTIVE` - * :mod:`bge.logic.KX_INPUT_JUST_RELEASED` - - .. method:: getKeyStatus(keycode) - - Get the status of a key. - - :arg keycode: The code that represents the key you want to get the state of - :type keycode: integer - :return: The state of the given key - :rtype: key state :mod:`bge.logic` members (KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED) - -.. class:: SCA_NANDController(SCA_IController) - - An NAND controller activates when all linked sensors are not active. - - There are no special python methods for this controller. - -.. class:: SCA_NORController(SCA_IController) - - An NOR controller activates only when all linked sensors are de-activated. - - There are no special python methods for this controller. - -.. class:: SCA_ORController(SCA_IController) - - An OR controller activates when any connected sensor activates. - - There are no special python methods for this controller. - -.. class:: SCA_PropertyActuator(SCA_IActuator) - - Property Actuator - - Properties: - - .. attribute:: propName - - the property on which to operate. **type** string - - .. attribute:: value - - the value with which the actuator operates. **type** string - - .. attribute:: mode - - TODO - add constants to game logic dict!. **type** integer - -.. class:: SCA_PropertySensor(SCA_ISensor) - - Activates when the game object property matches. - - Properties: - - .. attribute:: mode - - Type of check on the property. **type** integer - - * KX_PROPSENSOR_EQUAL(1) - * KX_PROPSENSOR_NOTEQUAL(2) - * KX_PROPSENSOR_INTERVAL(3) - * KX_PROPSENSOR_CHANGED(4) - * KX_PROPSENSOR_EXPRESSION(5) - - .. attribute:: propName - - the property the sensor operates. **type** string - - .. attribute:: value - - the value with which the sensor compares to the value of the property. **type** string - - .. attribute:: min - - the minimum value of the range used to evaluate the property when in interval mode. **type** string - - .. attribute:: max - - the maximum value of the range used to evaluate the property when in interval mode. **type** string - -.. class:: SCA_PythonController(SCA_IController) - - A Python controller uses a Python script to activate it's actuators, - based on it's sensors. - - Properties: - - .. attribute:: script - - The value of this variable depends on the execution methid. - - * When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts. - * When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts. - - .. note:: once this is set the script name given for warnings will remain unchanged. **type** string - - .. attribute:: mode - - the execution mode for this controller (read-only). - - * Script: 0, Execite the :data:`script` as a python code. - * Module: 1, Execite the :data:`script` as a module and function. **type** integer - - .. method:: activate(actuator) - - Activates an actuator attached to this controller. - - :arg actuator: The actuator to operate on. - :type actuator: actuator or the actuator name as a string - - .. method:: deactivate(actuator) - - Deactivates an actuator attached to this controller. - - :arg actuator: The actuator to operate on. - :type actuator: actuator or the actuator name as a string - -.. class:: SCA_RandomActuator(SCA_IActuator) - - Random Actuator - - Properties: - - .. attribute:: seed - - Seed of the random number generator. **type** integer. - - Equal seeds produce equal series. If the seed is 0, the generator will produce the same value on every call. - - .. attribute:: para1 - - the first parameter of the active distribution. **type** float, read-only. - - Refer to the documentation of the generator types for the meaning of this value. - - .. attribute:: para2 - - the second parameter of the active distribution. **type** float, read-only - - Refer to the documentation of the generator types for the meaning of this value. - - .. attribute:: distribution - - distribution type. (read-only). **type** integer - - * KX_RANDOMACT_BOOL_CONST - * KX_RANDOMACT_BOOL_UNIFORM - * KX_RANDOMACT_BOOL_BERNOUILLI - * KX_RANDOMACT_INT_CONST - * KX_RANDOMACT_INT_UNIFORM - * KX_RANDOMACT_INT_POISSON - * KX_RANDOMACT_FLOAT_CONST - * KX_RANDOMACT_FLOAT_UNIFORM - * KX_RANDOMACT_FLOAT_NORMAL - * KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL - - .. attribute:: propName - - the name of the property to set with the random value. **type** string - - If the generator and property types do not match, the assignment is ignored. - - .. method:: setBoolConst(value) - - Sets this generator to produce a constant boolean value. - - :arg value: The value to return. - :type value: boolean - - .. method:: setBoolUniform() - - Sets this generator to produce a uniform boolean distribution. - - The generator will generate True or False with 50% chance. - - .. method:: setBoolBernouilli(value) - - Sets this generator to produce a Bernouilli distribution. - - :arg value: Specifies the proportion of False values to produce. - - * 0.0: Always generate True - * 1.0: Always generate False - :type value: float - - .. method:: setIntConst(value) - - Sets this generator to always produce the given value. - - :arg value: the value this generator produces. - :type value: integer - - .. method:: setIntUniform(lower_bound, upper_bound) - - Sets this generator to produce a random value between the given lower and - upper bounds (inclusive). - - :type lower_bound: integer - :type upper_bound: integer - - .. method:: setIntPoisson(value) - - Generate a Poisson-distributed number. - - This performs a series of Bernouilli tests with parameter value. - It returns the number of tries needed to achieve succes. - - :type value: float - - .. method:: setFloatConst(value) - - Always generate the given value. - - :type value: float - - .. method:: setFloatUniform(lower_bound, upper_bound) - - Generates a random float between lower_bound and upper_bound with a - uniform distribution. - - :type lower_bound: float - :type upper_bound: float - - .. method:: setFloatNormal(mean, standard_deviation) - - Generates a random float from the given normal distribution. - - :arg mean: The mean (average) value of the generated numbers - :type mean: float - :arg standard_deviation: The standard deviation of the generated numbers. - :type standard_deviation: float - - .. method:: setFloatNegativeExponential(half_life) - - Generate negative-exponentially distributed numbers. - - The half-life 'time' is characterized by half_life. - - :type half_life: float - -.. class:: SCA_RandomSensor(SCA_ISensor) - - This sensor activates randomly. - - .. attribute:: lastDraw - - The seed of the random number generator. **type** integer - - .. attribute:: seed - - The seed of the random number generator. **type** integer - - .. method:: setSeed(seed) - - Sets the seed of the random number generator. - - If the seed is 0, the generator will produce the same value on every call. - - :type seed: integer - - .. method:: getSeed() - - :return: The initial seed of the generator. Equal seeds produce equal random series. - :rtype: integer - - .. method:: getLastDraw() - - :return: The last random number generated. - :rtype: integer - -.. class:: SCA_XNORController(SCA_IController) - - An XNOR controller activates when all linked sensors are the same (activated or inative). - - There are no special python methods for this controller. - -.. class:: SCA_XORController(SCA_IController) - - An XOR controller activates when there is the input is mixed, but not when all are on or off. - - There are no special python methods for this controller. - -.. class:: KX_Camera(KX_GameObject) - - A Camera object. - - .. attribute:: INSIDE - - see :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` - - .. attribute:: INTERSECT - - see :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` - - .. attribute:: OUTSIDE - - see :data:`sphereInsideFrustum` and :data:`boxInsideFrustum` - - .. attribute:: lens - - The camera's lens value. **type** float - - .. attribute:: near - - The camera's near clip distance. **type** float - - .. attribute:: far - - The camera's far clip distance. **type** float - - .. attribute:: perspective - - True if this camera has a perspective transform, False for an orthographic projection. **type** boolean - - .. attribute:: frustum_culling - - True if this camera is frustum culling. **type** boolean - - .. attribute:: projection_matrix - - This camera's 4x4 projection matrix. **type** 4x4 Matrix [[float]] - - .. attribute:: modelview_matrix - - This camera's 4x4 model view matrix. (read-only). **type** 4x4 Matrix [[float]] - - .. note:: This matrix is regenerated every frame from the camera's position and orientation. - - .. attribute:: camera_to_world - - This camera's camera to world transform. (read-only). **type** 4x4 Matrix [[float]] - - .. note:: This matrix is regenerated every frame from the camera's position and orientation. - - .. attribute:: world_to_camera - - This camera's world to camera transform. (read-only). **type** 4x4 Matrix [[float]] - - .. note:: Regenerated every frame from the camera's position and orientation. - .. note:: This is camera_to_world inverted. - - .. attribute:: useViewport - - True when the camera is used as a viewport, set True to enable a viewport for this camera. **type** boolean - - .. method:: sphereInsideFrustum(centre, radius) - - Tests the given sphere against the view frustum. - - :arg centre: The centre of the sphere (in world coordinates.) - :type centre: list [x, y, z] - :arg radius: the radius of the sphere - :type radius: float - :return: INSIDE, OUTSIDE or INTERSECT - :rtype: integer - - .. code-block:: python - - import GameLogic - co = GameLogic.getCurrentController() - cam = co.owner - - # A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0] - if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE): - # Sphere is inside frustum ! - # Do something useful ! - else: - # Sphere is outside frustum - - .. note:: when the camera is first initialized the result will be invalid because the projection matrix has not been set. - - .. method:: boxInsideFrustum(box) - - Tests the given box against the view frustum. - - .. code-block:: python - - import GameLogic - co = GameLogic.getCurrentController() - cam = co.owner - - # Box to test... - box = [] - box.append([-1.0, -1.0, -1.0]) - box.append([-1.0, -1.0, 1.0]) - box.append([-1.0, 1.0, -1.0]) - box.append([-1.0, 1.0, 1.0]) - box.append([ 1.0, -1.0, -1.0]) - box.append([ 1.0, -1.0, 1.0]) - box.append([ 1.0, 1.0, -1.0]) - box.append([ 1.0, 1.0, 1.0]) - - if (cam.boxInsideFrustum(box) != cam.OUTSIDE): - # Box is inside/intersects frustum ! - # Do something useful ! - else: - # Box is outside the frustum ! - - :arg box: Eight (8) corner points of the box (in world coordinates.) - :type box: list of lists - :return: INSIDE, OUTSIDE or INTERSECT - - .. note:: when the camera is first initialized the result will be invalid because the projection matrix has not been set. - - .. method:: pointInsideFrustum(point) - - Tests the given point against the view frustum. - - .. code-block:: python - - import GameLogic - co = GameLogic.getCurrentController() - cam = co.owner - - # Test point [0.0, 0.0, 0.0] - if (cam.pointInsideFrustum([0.0, 0.0, 0.0])): - # Point is inside frustum ! - # Do something useful ! - else: - # Box is outside the frustum ! - - :arg point: The point to test (in world coordinates.) - :type point: 3D Vector - :return: True if the given point is inside this camera's viewing frustum. - :rtype: boolean - - .. note:: when the camera is first initialized the result will be invalid because the projection matrix has not been set. - - .. method:: getCameraToWorld() - - Returns the camera-to-world transform. - - :return: the camera-to-world transform matrix. - :rtype: matrix (4x4 list) - - .. method:: getWorldToCamera() - - Returns the world-to-camera transform. - - This returns the inverse matrix of getCameraToWorld(). - - :return: the world-to-camera transform matrix. - :rtype: matrix (4x4 list) - - .. method:: setOnTop() - - Set this cameras viewport ontop of all other viewport. - - .. method:: setViewport(left, bottom, right, top) - - Sets the region of this viewport on the screen in pixels. - - Use :data:`bge.render.getWindowHeight` and :data:`bge.render.getWindowWidth` to calculate values relative to the entire display. - - :arg left: left pixel coordinate of this viewport - :type left: integer - :arg bottom: bottom pixel coordinate of this viewport - :type bottom: integer - :arg right: right pixel coordinate of this viewport - :type right: integer - :arg top: top pixel coordinate of this viewport - :type top: integer - - .. method:: getScreenPosition(object) - - Gets the position of an object projected on screen space. - - .. code-block:: python - - # For an object in the middle of the screen, coord = [0.5, 0.5] - coord = camera.getScreenPosition(object) - - :arg object: object name or list [x, y, z] - :type object: :class:`KX_GameObject` or 3D Vector - :return: the object's position in screen coordinates. - :rtype: list [x, y] - - .. method:: getScreenVect(x, y) - - Gets the vector from the camera position in the screen coordinate direction. - - .. code-block:: python - - # Gets the vector of the camera front direction: - m_vect = camera.getScreenVect(0.5, 0.5) - - - :arg x: X Axis - :type x: float - :arg y: Y Axis - :type y: float - :rtype: 3D Vector - :return: The vector from screen coordinate. - - .. method:: getScreenRay(x, y, dist=inf, property=None) - - Look towards a screen coordinate (x, y) and find first object hit within dist that matches prop. - The ray is similar to KX_GameObject->rayCastTo. - - .. code-block:: python - - # Gets an object with a property "wall" in front of the camera within a distance of 100: - target = camera.getScreenRay(0.5, 0.5, 100, "wall") - - :arg x: X Axis - :type x: float - :arg y: Y Axis - :type y: float - :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other - :type dist: float - :arg property: property name that object must have; can be omitted => detect any object - :type property: string - :rtype: :class:`KX_GameObject` - :return: the first object hit or None if no object or object does not match prop - -.. class:: BL_ArmatureObject(KX_GameObject) - - An armature object. - - .. attribute:: constraints - - The list of armature constraint defined on this armature. - Elements of the list can be accessed by index or string. - The key format for string access is ':' **type** list of :class:`BL_ArmatureConstraint` - - .. attribute:: channels - - The list of armature channels. - Elements of the list can be accessed by index or name the bone. **type** list of :class:`BL_ArmatureChannel` - - .. method:: update() - - Ensures that the armature will be updated on next graphic frame. - - This action is unecessary if a KX_ArmatureActuator with mode run is active - or if an action is playing. Use this function in other cases. It must be called - on each frame to ensure that the armature is updated continously. - -.. class:: BL_ArmatureActuator(SCA_IActuator) - - Armature Actuators change constraint condition on armatures. - - .. attribute:: KX_ACT_ARMATURE_RUN - - see type - - .. attribute:: KX_ACT_ARMATURE_ENABLE - - see type - - .. attribute:: KX_ACT_ARMATURE_DISABLE - - see type - - .. attribute:: KX_ACT_ARMATURE_SETTARGET - - see type - - .. attribute:: KX_ACT_ARMATURE_SETWEIGHT - - see type - - .. attribute:: type - - The type of action that the actuator executes when it is active. - - * KX_ACT_ARMATURE_RUN(0) just make sure the armature will be updated on the next graphic frame. This is the only persistent mode of the actuator: it executes automatically once per frame until stopped by a controller - * KX_ACT_ARMATURE_ENABLE(1) enable the constraint. - * KX_ACT_ARMATURE_DISABLE(2) disable the constraint (runtime constraint values are not updated). - * KX_ACT_ARMATURE_SETTARGET(3) change target and subtarget of constraint. - * KX_ACT_ARMATURE_SETWEIGHT(4) change weight of (only for IK constraint). **type** integer - - .. attribute:: constraint - - The constraint object this actuator is controlling. **type** :class:`BL_ArmatureConstraint` - - .. attribute:: target - - The object that this actuator will set as primary target to the constraint it controls **type** :class:`KX_GameObject` - - .. attribute:: subtarget - - The object that this actuator will set as secondary target to the constraint it controls. **type** :class:`KX_GameObject`. - - .. note:: Currently, the only secondary target is the pole target for IK constraint. - - .. attribute:: weight - - The weight this actuator will set on the constraint it controls. **type** float. - - .. note:: Currently only the IK constraint has a weight. It must be a value between 0 and 1. - - .. note:: A weight of 0 disables a constraint while still updating constraint runtime values (see :class:`BL_ArmatureConstraint`) - -.. class:: KX_ArmatureSensor(SCA_ISensor) - - Armature sensor detect conditions on armatures. - - See :data:`type` - - .. data:: KX_ARMSENSOR_STATE_CHANGED - .. data:: KX_ARMSENSOR_LIN_ERROR_BELOW - .. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE - .. data:: KX_ARMSENSOR_ROT_ERROR_BELOW - .. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE - - .. attribute:: type - - The type of measurement that the sensor make when it is active. **type** integer. - - * KX_ARMSENSOR_STATE_CHANGED(0) detect that the constraint is changing state (active/inactive) - * KX_ARMSENSOR_LIN_ERROR_BELOW(1) detect that the constraint linear error is above a threshold - * KX_ARMSENSOR_LIN_ERROR_ABOVE(2) detect that the constraint linear error is below a threshold - * KX_ARMSENSOR_ROT_ERROR_BELOW(3) detect that the constraint rotation error is above a threshold - * KX_ARMSENSOR_ROT_ERROR_ABOVE(4) detect that the constraint rotation error is below a threshold - - .. attribute:: constraint - - The constraint object this sensor is watching. **type** :class:`BL_ArmatureConstraint` - - .. attribute:: value - - **type** float - - The threshold used in the comparison with the constraint error - The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver - The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver - The linear error on CopyPose is always >= 0: it is the norm of the distance between the target and the bone - The rotation error on CopyPose is always >= 0: it is the norm of the equivalent rotation vector between the bone and the target orientations - The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller. - -.. class:: BL_ArmatureConstraint(PyObjectPlus) - - Proxy to Armature Constraint. Allows to change constraint on the fly. - Obtained through :class:`BL_ArmatureObject`.constraints. - - .. note:: not all armature constraints are supported in the GE. - - - Constants related to see :data:`type` - - .. data:: CONSTRAINT_TYPE_TRACKTO - .. data:: CONSTRAINT_TYPE_KINEMATIC - .. data:: CONSTRAINT_TYPE_ROTLIKE - .. data:: CONSTRAINT_TYPE_LOCLIKE - .. data:: CONSTRAINT_TYPE_MINMAX - .. data:: CONSTRAINT_TYPE_SIZELIKE - .. data:: CONSTRAINT_TYPE_LOCKTRACK - .. data:: CONSTRAINT_TYPE_STRETCHTO - .. data:: CONSTRAINT_TYPE_CLAMPTO - .. data:: CONSTRAINT_TYPE_TRANSFORM - .. data:: CONSTRAINT_TYPE_DISTLIMIT - - - Constants related to see :data:`ik_type` - - .. data:: CONSTRAINT_IK_COPYPOSE - .. data:: CONSTRAINT_IK_DISTANCE - .. data:: CONSTRAINT_IK_MODE_INSIDE - .. data:: CONSTRAINT_IK_MODE_OUTSIDE - .. data:: CONSTRAINT_IK_MODE_ONSURFACE - .. data:: CONSTRAINT_IK_FLAG_TIP - .. data:: CONSTRAINT_IK_FLAG_ROT - .. data:: CONSTRAINT_IK_FLAG_STRETCH - .. data:: CONSTRAINT_IK_FLAG_POS - - .. attribute:: type - - Type of constraint, (read-only) **type** integer, one of CONSTRAINT_TYPE_* constants - - .. attribute:: name - - Name of constraint constructed as :. constraints list **type** string - - This name is also the key subscript on :class:`BL_ArmatureObject`. - - .. attribute:: enforce - - fraction of constraint effect that is enforced. Between 0 and 1. **type** float - - .. attribute:: headtail - - Position of target between head and tail of the target bone: 0=head, 1=tail. **type** float. - - .. note:: Only used if the target is a bone (i.e target object is an armature. - - .. attribute:: lin_error - - runtime linear error (in Blender units) on constraint at the current frame. - - This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. **type** float - - .. attribute:: rot_error - - Runtime rotation error (in radiant) on constraint at the current frame. **type** float. - - This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. - - It is only set if the constraint has a rotation part, for example, a CopyPose+Rotation IK constraint. - - .. attribute:: target - - Primary target object for the constraint. The position of this object in the GE will be used as target for the constraint. **type** :class:`KX_GameObject`. - - .. attribute:: subtarget - - Secondary target object for the constraint. The position of this object in the GE will be used as secondary target for the constraint. **type** :class:`KX_GameObject`. - - Currently this is only used for pole target on IK constraint. - - .. attribute:: active - - True if the constraint is active. - - .. note:: an inactive constraint does not update lin_error and rot_error. **type** boolean - - .. attribute:: ik_weight - - Weight of the IK constraint between 0 and 1. - - Only defined for IK constraint. **type** float - - .. attribute:: ik_type - - Type of IK constraint, (read-only). **type** integer. - - * CONSTRAINT_IK_COPYPOSE(0) constraint is trying to match the position and eventually the rotation of the target. - * CONSTRAINT_IK_DISTANCE(1) constraint is maintaining a certain distance to target subject to ik_mode - - .. attribute:: ik_flag - - Combination of IK constraint option flags, read-only - - * CONSTRAINT_IK_FLAG_TIP(1) : set when the constraint operates on the head of the bone and not the tail - * CONSTRAINT_IK_FLAG_ROT(2) : set when the constraint tries to match the orientation of the target - * CONSTRAINT_IK_FLAG_STRETCH(16) : set when the armature is allowed to stretch (only the bones with stretch factor > 0.0) - * CONSTRAINT_IK_FLAG_POS(32) : set when the constraint tries to match the position of the target **type** integer - - .. attribute:: ik_dist - - Distance the constraint is trying to maintain with target, only used when ik_type=CONSTRAINT_IK_DISTANCE **type** float - - .. attribute:: ik_mode - - Additional mode for IK constraint. Currently only used for Distance constraint: - - * CONSTRAINT_IK_MODE_INSIDE(0) : the constraint tries to keep the bone within ik_dist of target - * CONSTRAINT_IK_MODE_OUTSIDE(1) : the constraint tries to keep the bone outside ik_dist of the target - * CONSTRAINT_IK_MODE_ONSURFACE(2) : the constraint tries to keep the bone exactly at ik_dist of the target **type** integer - -.. class:: BL_ArmatureChannel(PyObjectPlus) - - Proxy to armature pose channel. Allows to read and set armature pose. - The attributes are identical to RNA attributes, but mostly in read-only mode. - - See :data:`rotation_mode` - - .. data:: PCHAN_ROT_QUAT - .. data:: PCHAN_ROT_XYZ - .. data:: PCHAN_ROT_XZY - .. data:: PCHAN_ROT_YXZ - .. data:: PCHAN_ROT_YZX - .. data:: PCHAN_ROT_ZXY - .. data:: PCHAN_ROT_ZYX - - .. attribute:: name - - channel name (=bone name), read-only. **type** string - - .. attribute:: bone - - return the bone object corresponding to this pose channel, read-only. **type** :class:`BL_ArmatureBone` - - .. attribute:: parent - - return the parent channel object, None if root channel, read-only. **type** :class:`BL_ArmatureChannel` - - .. attribute:: has_ik - - true if the bone is part of an active IK chain, read-only. - This flag is not set when an IK constraint is defined but not enabled (miss target information for example) **type** boolean - - .. attribute:: ik_dof_x - - true if the bone is free to rotation in the X axis, read-only. **type** boolean - - .. attribute:: ik_dof_y - - true if the bone is free to rotation in the Y axis, read-only. **type** boolean - - .. attribute:: ik_dof_z - - true if the bone is free to rotation in the Z axis, read-only. **type** boolean - - .. attribute:: ik_limit_x - - true if a limit is imposed on X rotation, read-only. **type** boolean - - .. attribute:: ik_limit_y - - true if a limit is imposed on Y rotation, read-only. **type** boolean - - .. attribute:: ik_limit_z - - true if a limit is imposed on Z rotation, read-only. **type** boolean - - .. attribute:: ik_rot_control - - true if channel rotation should applied as IK constraint, read-only. **type** boolean - - .. attribute:: ik_lin_control - - true if channel size should applied as IK constraint, read-only. **type** boolean - - .. attribute:: location - - displacement of the bone head in armature local space, read-write. **type** vector [X, Y, Z]. - - .. note:: You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. - .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`). - - .. attribute:: scale - - scale of the bone relative to its parent, read-write. **type** vector [sizeX, sizeY, sizeZ]. - - .. note:: An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. - .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) - - .. attribute:: rotation - - rotation of the bone relative to its parent expressed as a quaternion, read-write. **type** vector [qr, qi, qj, qk]. - - .. note:: This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation. - .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) - - .. attribute:: euler_rotation - - rotation of the bone relative to its parent expressed as a set of euler angles, read-write. **type** vector [X, Y, Z]. - - .. note:: This field is only used if rotation_mode is > 0. You must always pass the angles in [X, Y, Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation. - .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) - - .. attribute:: rotation_mode - - Method of updating the bone rotation, read-write. **type** integer - - Use the following constants (euler mode are named as in Blender UI but the actual axis order is reversed). - - * PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation - * PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively - * PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively - * PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively - * PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively - * PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively - * PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively - - .. attribute:: channel_matrix - - pose matrix in bone space (deformation of the bone due to action, constraint, etc), Read-only. - This field is updated after the graphic render, it represents the current pose. **type** matrix [4][4] - - .. attribute:: pose_matrix - - pose matrix in armature space, read-only, - This field is updated after the graphic render, it represents the current pose. **type** matrix [4][4] - - .. attribute:: pose_head - - position of bone head in armature space, read-only. **type** vector [x, y, z] - - .. attribute:: pose_tail - - position of bone tail in armature space, read-only. **type** vector [x, y, z] - - .. attribute:: ik_min_x - - minimum value of X rotation in degree (<= 0) when X rotation is limited (see ik_limit_x), read-only. **type** float - - .. attribute:: ik_max_x - - maximum value of X rotation in degree (>= 0) when X rotation is limited (see ik_limit_x), read-only. **type** float - - .. attribute:: ik_min_y - - minimum value of Y rotation in degree (<= 0) when Y rotation is limited (see ik_limit_y), read-only. **type** float - - .. attribute:: ik_max_y - - maximum value of Y rotation in degree (>= 0) when Y rotation is limited (see ik_limit_y), read-only. **type** float - - .. attribute:: ik_min_z - - minimum value of Z rotation in degree (<= 0) when Z rotation is limited (see ik_limit_z), read-only. **type** float - - .. attribute:: ik_max_z - - maximum value of Z rotation in degree (>= 0) when Z rotation is limited (see ik_limit_z), read-only. **type** float - - .. attribute:: ik_stiffness_x - - bone rotation stiffness in X axis, read-only **type** float between 0 and 1 - - .. attribute:: ik_stiffness_y - - bone rotation stiffness in Y axis, read-only **type** float between 0 and 1 - - .. attribute:: ik_stiffness_z - - bone rotation stiffness in Z axis, read-only **type** float between 0 and 1 - - .. attribute:: ik_stretch - - ratio of scale change that is allowed, 0=bone can't change size, read-only. **type** float - - .. attribute:: ik_rot_weight - - weight of rotation constraint when ik_rot_control is set, read-write. **type** float between 0 and 1 - - .. attribute:: ik_lin_weight - - weight of size constraint when ik_lin_control is set, read-write. **type** float between 0 and 1 - - .. attribute:: joint_rotation - - Control bone rotation in term of joint angle (for robotic applications), read-write. **type** vector [x, y, z] - - When writing to this attribute, you pass a [x, y, z] vector and an appropriate set of euler angles or quaternion is calculated according to the rotation_mode. - - When you read this attribute, the current pose matrix is converted into a [x, y, z] vector representing the joint angles. - - The value and the meaning of the x, y, z depends on the ik_dof_x/ik_dof_y/ik_dof_z attributes: - - * 1DoF joint X, Y or Z: the corresponding x, y, or z value is used an a joint angle in radiant - * 2DoF joint X+Y or Z+Y: treated as 2 successive 1DoF joints: first X or Z, then Y. The x or z value is used as a joint angle in radiant along the X or Z axis, followed by a rotation along the new Y axis of y radiants. - * 2DoF joint X+Z: treated as a 2DoF joint with rotation axis on the X/Z plane. The x and z values are used as the coordinates of the rotation vector in the X/Z plane. - * 3DoF joint X+Y+Z: treated as a revolute joint. The [x, y, z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose. - - .. note:: The bone must be part of an IK chain if you want to set the ik_dof_x/ik_dof_y/ik_dof_z attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target) the IK solver will not run but the IK panel will show up on the UI for each bone in the chain. - .. note:: [0, 0, 0] always corresponds to the rest pose. - .. note:: You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see :data:`BL_ArmatureObject.update`). - .. note:: You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute. - -.. class:: BL_ArmatureBone(PyObjectPlus) - - Proxy to Blender bone structure. All fields are read-only and comply to RNA names. - All space attribute correspond to the rest pose. - - .. attribute:: name - - bone name **type** string - - .. attribute:: connected - - true when the bone head is struck to the parent's tail **type** boolean - - .. attribute:: hinge - - true when bone doesn't inherit rotation or scale from parent bone **type** boolean - - .. attribute:: inherit_scale - - true when bone inherits scaling from parent bone **type** boolean - - .. attribute:: bbone_segments - - number of B-bone segments **type** integer - - .. attribute:: roll - - bone rotation around head-tail axis **type** float - - .. attribute:: head - - location of head end of the bone in parent bone space **type** vector [x, y, z] - - .. attribute:: tail - - location of head end of the bone in parent bone space **type** vector [x, y, z] - - .. attribute:: length - - bone length **type** float - - .. attribute:: arm_head - - location of head end of the bone in armature space **type** vector [x, y, z] - - .. attribute:: arm_tail - - location of tail end of the bone in armature space **type** vector [x, y, z] - - .. attribute:: arm_mat - - matrix of the bone head in armature space **type** matrix [4][4] - - .. note:: This matrix has no scale part. - - .. attribute:: bone_mat - - rotation matrix of the bone in parent bone space. **type** matrix [3][3] - - .. attribute:: parent - - parent bone, or None for root bone **type** :class:`BL_ArmatureBone` - - .. attribute:: children - - list of bone's children. **type** list of :class:`BL_ArmatureBone` diff --git a/source/gameengine/PyDoc/bge_api_validate_py.txt b/source/gameengine/PyDoc/bge_api_validate_py.txt deleted file mode 100644 index ebd74c06bb3..00000000000 --- a/source/gameengine/PyDoc/bge_api_validate_py.txt +++ /dev/null @@ -1,136 +0,0 @@ -#~ This program is free software; you can redistribute it and/or modify -#~ it under the terms of the GNU General Public License as published by -#~ the Free Software Foundation; version 2 of the License. - -#~ This program is distributed in the hope that it will be useful, -#~ but WITHOUT ANY WARRANTY; without even the implied warranty of -#~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#~ GNU General Public License for more details. - -# This script must run from a logic brick so it has access to the game engine api -# it assumes the root blender source directory is the current working directory -# -# Currently it only prints missing modules and methods (not attributes) - -import sys, os - -BGE_API_DOC_PATH = 'source/gameengine/PyDoc' - - -mods = ['GameLogic', 'Rasterizer', 'GameKeys'] -mods_dict = {} -for m in mods: - mods_dict[m] = sys.modules[m] - - -import GameTypes -type_members = {} - -for type_name in dir(GameTypes): - if type_name.startswith('__'): - continue - - type_object = getattr(GameTypes, type_name) - - members = [] - type_members[type_object.__name__] = members - - for member in type_object.__dict__.keys(): - if member.startswith('__'): - continue - - # print type_object.__name__ + '.' + k - members.append(member) - - - -doc_dir= os.path.join(os.getcwd(), BGE_API_DOC_PATH) - -if doc_dir not in sys.path: - sys.path.append(doc_dir) - - -def check_attribute(class_ob, member): - doc = class_ob.__doc__ - if not doc: - return False - - for l in doc.split('\n'): - l = l.strip() - - ''' - @ivar foo: blah blah - to - foo - - ''' - - if l.startswith('@ivar') or l.startswith('@var'): - var = l.split()[1].split(':')[0] - - if var == member: - return True - - return False - - - - - - -print '\n\n\nChecking Docs' - -PRINT_OK = False - -pymod = sys.modules['GameTypes'] -del sys.modules['GameTypes'] # temp remove -mod = __import__('GameTypes') # get the python module -reload(mod) # incase were editing it -sys.modules['GameTypes'] = pymod - -for type_name in sorted(type_members.keys()): - members = type_members[type_name] - - try: - type_class = getattr(mod, type_name) - except: - print "missing class: %s.%s - %s" % (type_name, type_name, str(sorted(members))) - continue - - for member in sorted(members): - try: - getattr(type_class, member) - if PRINT_OK: - print "\tfound: %s.%s" % (type_name, member) - except: - if check_attribute(type_class, member): - if PRINT_OK: - print "\tfound attr: %s.%s" % (type_name, member) - else: - print "\tmissing: %s.%s" % (type_name, member) - - -# Now check the modules -for mod_name, pymod in mods_dict.iteritems(): - print pymod - del sys.modules[mod_name] - - # Now well get the python version - pydoc = __import__(mod_name) - pydoc = reload(pydoc) # avoid using the out dated pyc file only - print pydoc.__file__ - - for member in sorted(dir(pymod)): - if hasattr(pydoc, member) or check_attribute(pydoc, member): - if PRINT_OK: - print "\tfound module attr: %s.%s" % (mod_name, member) - else: - print "\tmissing module attr: %s.%s" % (mod_name, member) - - # Restore real module - sys.modules[mod_name] = pymod - - -sys.path.pop() # remove the pydoc dir from our import paths - - diff --git a/source/gameengine/PyDoc/epy_docgen.sh b/source/gameengine/PyDoc/epy_docgen.sh deleted file mode 100755 index dd30256f42f..00000000000 --- a/source/gameengine/PyDoc/epy_docgen.sh +++ /dev/null @@ -1,16 +0,0 @@ -# epy_docgen.sh -# generates blender python doc using epydoc -# requires epydoc in your PATH. -# run from the doc directory containing the .py files -# usage: sh epy_docgen.sh - -# set posix locale so regex works properly for [A-Z]*.py -LC_ALL=POSIX - -epydoc --debug -v -o BPY_GE --url "http://www.blender.org" --top API_intro \ - --name "Blender GameEngine" --no-private --no-sourcecode --inheritance=included \ - *.py \ - ../../../source/blender/python/api2_2x/doc/BGL.py \ - ../../../source/blender/python/api2_2x/doc/Mathutils.py \ - ../../../source/blender/python/api2_2x/doc/Geometry.py - diff --git a/source/gameengine/PyDoc/how_to_build_win.txt b/source/gameengine/PyDoc/how_to_build_win.txt deleted file mode 100644 index 018a28a9bfd..00000000000 --- a/source/gameengine/PyDoc/how_to_build_win.txt +++ /dev/null @@ -1,16 +0,0 @@ -How To Build the BGE Documentation in Windows -------------------------------------------------------------------------- -1) download and install Python 2.6 - http://www.python.org -2) download and install Epydocs - http://epydoc.sourceforge.net - -* for the following lines we will assume that your installation of Python is in C:\Python26 and epydocs is installed in the default folder Scripts\epydoc. - -3) creates a epy_docgen.bat file in this folder (source\gameengine\PyDoc\) and paste the following line into it: - -:::::: -C:\Python26\python.exe C:\Python26\Scripts\epydoc.py --debug -v -o BPY_GE --url "http://www.blender.org" --top API_intro --name "Blender GameEngine" --no-private --no-sourcecode --inheritance=included *.py ../../../source/blender/python/api2_2x/doc/BGL.py ../../../source/blender/python/api2_2x/doc/Mathutils.py ../../../source/blender/python/api2_2x/doc/Geometry.py -:::::: - -4) run your created batch file. If everything goes well it creates a folder named BPY_GE with all the generated documentation. - -Documentation valid in March of 2010 - Blender 2.5alpha2 \ No newline at end of file diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt deleted file mode 100644 index 096b1583e3e..00000000000 --- a/source/gameengine/Rasterizer/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -FILE(GLOB SRC *.cpp) - -SET(INC - . - ../../../source/kernel/gen_system - ../../../source/blender/makesdna - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Ketsji - ../../../intern/string - ../../../intern/moto/include - ../../../extern/glew/include - ../../../intern/guardedalloc - ../Expressions - ${PYTHON_INC} -) - -ADD_DEFINITIONS(-DGLEW_STATIC) - -BLENDERLIB(bf_rasterizer "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), [], libtype=['game','player'], priority=[35,115], compileflags = cflags ) diff --git a/source/gameengine/Rasterizer/Makefile b/source/gameengine/Rasterizer/Makefile deleted file mode 100644 index a12d599b60b..00000000000 --- a/source/gameengine/Rasterizer/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = rasterizer -DIR = $(OCGDIR)/gameengine/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(OPENGL_HEADERS) -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include -CPPFLAGS += -I../../kernel/gen_system -CPPFLAGS += -I../../blender/makesdna -CPPFLAGS += -I../SceneGraph -CPPFLAGS += -I../BlenderRoutines -CPPFLAGS += -I../Expressions -CPPFLAGS += -I../Ketsji - -CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) - -ifeq ($(OS),darwin) - CPPFLAGS += -fpascal-strings -endif - -############### - -SOURCEDIR = source/gameengine/Rasterizer -DIRS = RAS_OpenGLRasterizer - -include nan_subdirs.mk diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp deleted file mode 100644 index 4527850a8e9..00000000000 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ /dev/null @@ -1,520 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#define STRINGIFY(A) #A - -#include "RAS_OpenGLFilters/RAS_Blur2DFilter.h" -#include "RAS_OpenGLFilters/RAS_Sharpen2DFilter.h" -#include "RAS_OpenGLFilters/RAS_Dilation2DFilter.h" -#include "RAS_OpenGLFilters/RAS_Erosion2DFilter.h" -#include "RAS_OpenGLFilters/RAS_Laplacian2DFilter.h" -#include "RAS_OpenGLFilters/RAS_Sobel2DFilter.h" -#include "RAS_OpenGLFilters/RAS_Prewitt2DFilter.h" -#include "RAS_OpenGLFilters/RAS_GrayScale2DFilter.h" -#include "RAS_OpenGLFilters/RAS_Sepia2DFilter.h" -#include "RAS_OpenGLFilters/RAS_Invert2DFilter.h" - -#include "STR_String.h" -#include "RAS_ICanvas.h" -#include "RAS_Rect.h" -#include "RAS_2DFilterManager.h" -#include - -#include "GL/glew.h" - -#include - -#include "Value.h" - -RAS_2DFilterManager::RAS_2DFilterManager(): -texturewidth(-1), textureheight(-1), -canvaswidth(-1), canvasheight(-1), -numberoffilters(0), need_tex_update(true) -{ - isshadersupported = GLEW_ARB_shader_objects && - GLEW_ARB_fragment_shader && GLEW_ARB_multitexture; - - /* used to return before 2.49 but need to initialize values so dont */ - if(!isshadersupported) - std::cout<<"shaders not supported!" << std::endl; - - int passindex; - for(passindex =0; passindex& propNames) -{ - texflag[passindex] = 0; - if(glGetUniformLocationARB(m_filters[passindex], "bgl_DepthTexture") != -1) - { - if(GLEW_ARB_depth_texture) - texflag[passindex] |= 0x1; - } - if(glGetUniformLocationARB(m_filters[passindex], "bgl_LuminanceTexture") != -1) - { - texflag[passindex] |= 0x2; - } - - if(m_gameObjects[passindex]) - { - int objProperties = propNames.size(); - int i; - for(i=0; iGetPropertyNumber(m_properties[passindex][i], 0.0); - glUniform1fARB(uniformLoc,value); - } - } -} - -void RAS_2DFilterManager::EndShaderProgram() -{ - glUseProgramObjectARB(0); -} - -void RAS_2DFilterManager::FreeTextures() -{ - if(texname[0]!=(unsigned int)-1) - glDeleteTextures(1, (GLuint*)&texname[0]); - if(texname[1]!=(unsigned int)-1) - glDeleteTextures(1, (GLuint*)&texname[1]); - if(texname[2]!=(unsigned int)-1) - glDeleteTextures(1, (GLuint*)&texname[2]); -} - -void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance) -{ - FreeTextures(); - - glGenTextures(1, (GLuint*)&texname[0]); - glBindTexture(GL_TEXTURE_2D, texname[0]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texturewidth, textureheight, 0, GL_RGBA, - GL_UNSIGNED_BYTE, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - - if(depth){ - glGenTextures(1, (GLuint*)&texname[1]); - glBindTexture(GL_TEXTURE_2D, texname[1]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, texturewidth,textureheight, - 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE,NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, - GL_NONE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - } - - if(luminance){ - glGenTextures(1, (GLuint*)&texname[2]); - glBindTexture(GL_TEXTURE_2D, texname[2]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE16, texturewidth, textureheight, - 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - } -} - -void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas) -{ - RAS_Rect canvas_rect = canvas->GetWindowArea(); - canvaswidth = canvas->GetWidth(); - canvasheight = canvas->GetHeight(); - - texturewidth = canvaswidth + canvas_rect.GetLeft(); - textureheight = canvasheight + canvas_rect.GetBottom(); - GLint i,j; - i = 0; - while ((1 << i) <= texturewidth) - i++; - texturewidth = (1 << (i)); - - // Now for height - i = 0; - while ((1 << i) <= textureheight) - i++; - textureheight = (1 << (i)); - - GLfloat xInc = 1.0f / (GLfloat)texturewidth; - GLfloat yInc = 1.0f / (GLfloat)textureheight; - - for (i = 0; i < 3; i++) - { - for (j = 0; j < 3; j++) - { - textureoffsets[(((i*3)+j)*2)+0] = (-1.0f * xInc) + ((GLfloat)i * xInc); - textureoffsets[(((i*3)+j)*2)+1] = (-1.0f * yInc) + ((GLfloat)j * yInc); - } - } -} - -void RAS_2DFilterManager::UpdateCanvasTextureCoord(unsigned int * viewport) -{ - /* - This function update canvascoord[]. - These parameters are used to create texcoord[1] - That way we can access the texcoord relative to the canvas: - (0.0,0.0) bottom left, (1.0,1.0) top right, (0.5,0.5) center - */ - canvascoord[0] = (GLfloat) viewport[0] / viewport[2]; - canvascoord[0] *= -1; - canvascoord[1] = (GLfloat) (texturewidth - viewport[0]) / viewport[2]; - - canvascoord[2] = (GLfloat) viewport[1] / viewport[3]; - canvascoord[2] *= -1; - canvascoord[3] = (GLfloat)(textureheight - viewport[1]) / viewport[3]; -} - -void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) -{ - bool need_depth=false; - bool need_luminance=false; - int num_filters = 0; - - int passindex; - - if(!isshadersupported) - return; - - for(passindex =0; passindexGetWidth() || canvasheight != canvas->GetHeight()) - { - UpdateOffsetMatrix(canvas); - UpdateCanvasTextureCoord((unsigned int*)viewport); - need_tex_update = true; - } - - if(need_tex_update) - { - SetupTextures(need_depth, need_luminance); - need_tex_update = false; - } - - if(need_depth){ - glActiveTextureARB(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, texname[1]); - glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, 0, 0, texturewidth,textureheight, 0); - } - - if(need_luminance){ - glActiveTextureARB(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D, texname[2]); - glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 0, 0, texturewidth,textureheight, 0); - } - - glViewport(0,0, texturewidth, textureheight); - - glDisable(GL_DEPTH_TEST); - glPushMatrix(); //GL_MODELVIEW - glLoadIdentity(); // GL_MODELVIEW - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - - for(passindex =0; passindex& propNames, void* gameObj, RAS_2DFILTER_MODE mode, int pass, STR_String& text) -{ - if(!isshadersupported) - return; - if(pass<0 || pass>=MAX_RENDER_PASS) - return; - need_tex_update = true; - if(mode == RAS_2DFILTER_DISABLED) - { - m_enabled[pass] = 0; - return; - } - - if(mode == RAS_2DFILTER_ENABLED) - { - m_enabled[pass] = 1; - return; - } - - if(mode == RAS_2DFILTER_NOFILTER) - { - if(m_filters[pass]) - glDeleteObjectARB(m_filters[pass]); - m_enabled[pass] = 0; - m_filters[pass] = 0; - m_gameObjects[pass] = NULL; - m_properties[pass].clear(); - texflag[pass] = 0; - return; - } - - if(mode == RAS_2DFILTER_CUSTOMFILTER) - { - if(m_filters[pass]) - glDeleteObjectARB(m_filters[pass]); - m_filters[pass] = CreateShaderProgram(text.Ptr()); - m_gameObjects[pass] = gameObj; - AnalyseShader(pass, propNames); - m_enabled[pass] = 1; - return; - } - - if(mode>=RAS_2DFILTER_MOTIONBLUR && mode<=RAS_2DFILTER_INVERT) - { - if(m_filters[pass]) - glDeleteObjectARB(m_filters[pass]); - m_filters[pass] = CreateShaderProgram(mode); - m_enabled[pass] = 1; - } -} diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.h b/source/gameengine/Rasterizer/RAS_2DFilterManager.h deleted file mode 100644 index 7ff7cde7882..00000000000 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.h +++ /dev/null @@ -1,113 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_I2DFILTER -#define __RAS_I2DFILTER - -#include "RAS_ICanvas.h" -#define MAX_RENDER_PASS 100 - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class RAS_2DFilterManager -{ -private: - unsigned int CreateShaderProgram(const char* shadersource); - unsigned int CreateShaderProgram(int filtermode); - void AnalyseShader(int passindex, vector& propNames); - void StartShaderProgram(int passindex); - void EndShaderProgram(); - void PrintShaderErrors(unsigned int shader, const char *task, const char *code); - - void SetupTextures(bool depth, bool luminance); - void FreeTextures(); - - void UpdateOffsetMatrix(RAS_ICanvas* canvas); - void UpdateCanvasTextureCoord(unsigned int * viewport); - - float canvascoord[4]; - float textureoffsets[18]; - float view[4]; - /* texname[0] contains render to texture, texname[1] contains depth texture, texname[2] contains luminance texture*/ - unsigned int texname[3]; - int texturewidth; - int textureheight; - int canvaswidth; - int canvasheight; - int numberoffilters; - /* bit 0: enable/disable depth texture - * bit 1: enable/disable luminance texture*/ - short texflag[MAX_RENDER_PASS]; - - bool isshadersupported; - bool errorprinted; - bool need_tex_update; - - unsigned int m_filters[MAX_RENDER_PASS]; - short m_enabled[MAX_RENDER_PASS]; - - // stores object properties to send to shaders in each pass - vector m_properties[MAX_RENDER_PASS]; - void* m_gameObjects[MAX_RENDER_PASS]; -public: - enum RAS_2DFILTER_MODE { - RAS_2DFILTER_ENABLED = -2, - RAS_2DFILTER_DISABLED = -1, - RAS_2DFILTER_NOFILTER = 0, - RAS_2DFILTER_MOTIONBLUR, - RAS_2DFILTER_BLUR, - RAS_2DFILTER_SHARPEN, - RAS_2DFILTER_DILATION, - RAS_2DFILTER_EROSION, - RAS_2DFILTER_LAPLACIAN, - RAS_2DFILTER_SOBEL, - RAS_2DFILTER_PREWITT, - RAS_2DFILTER_GRAYSCALE, - RAS_2DFILTER_SEPIA, - RAS_2DFILTER_INVERT, - RAS_2DFILTER_CUSTOMFILTER, - RAS_2DFILTER_NUMBER_OF_FILTERS - }; - - RAS_2DFilterManager(); - - ~RAS_2DFilterManager(); - - void RenderFilters(RAS_ICanvas* canvas); - - void EnableFilter(vector& propNames, void* gameObj, RAS_2DFILTER_MODE mode, int pass, STR_String& text); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_2DFilterManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; -#endif diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp deleted file mode 100644 index 4c22f4dcfc7..00000000000 --- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifdef WIN32 -// don't show these anoying STL warnings -#pragma warning (disable:4786) -#endif - -#include "GEN_Map.h" -#include "RAS_MaterialBucket.h" -#include "STR_HashedString.h" -#include "RAS_MeshObject.h" -#include "RAS_IRasterizer.h" -#include "RAS_IRenderTools.h" - -#include "RAS_BucketManager.h" - -#include -#include - -/* sorting */ - -struct RAS_BucketManager::sortedmeshslot -{ -public: - MT_Scalar m_z; /* depth */ - RAS_MeshSlot *m_ms; /* mesh slot */ - RAS_MaterialBucket *m_bucket; /* buck mesh slot came from */ - - sortedmeshslot() {} - - void set(RAS_MeshSlot *ms, RAS_MaterialBucket *bucket, const MT_Vector3& pnorm) - { - // would be good to use the actual bounding box center instead - MT_Point3 pos(ms->m_OpenGLMatrix[12], ms->m_OpenGLMatrix[13], ms->m_OpenGLMatrix[14]); - - m_z = MT_dot(pnorm, pos); - m_ms = ms; - m_bucket = bucket; - } -}; - -struct RAS_BucketManager::backtofront -{ - bool operator()(const sortedmeshslot &a, const sortedmeshslot &b) - { - return (a.m_z < b.m_z) || (a.m_z == b.m_z && a.m_ms < b.m_ms); - } -}; - -struct RAS_BucketManager::fronttoback -{ - bool operator()(const sortedmeshslot &a, const sortedmeshslot &b) - { - return (a.m_z > b.m_z) || (a.m_z == b.m_z && a.m_ms > b.m_ms); - } -}; - -/* bucket manager */ - -RAS_BucketManager::RAS_BucketManager() -{ - -} - -RAS_BucketManager::~RAS_BucketManager() -{ - BucketList::iterator it; - - for (it = m_SolidBuckets.begin(); it != m_SolidBuckets.end(); it++) - delete (*it); - - for (it = m_AlphaBuckets.begin(); it != m_AlphaBuckets.end(); it++) - delete(*it); - - m_SolidBuckets.clear(); - m_AlphaBuckets.clear(); -} - -void RAS_BucketManager::OrderBuckets(const MT_Transform& cameratrans, BucketList& buckets, vector& slots, bool alpha) -{ - BucketList::iterator bit; - list::iterator mit; - size_t size = 0, i = 0; - - /* Camera's near plane equation: pnorm.dot(point) + pval, - * but we leave out pval since it's constant anyway */ - const MT_Vector3 pnorm(cameratrans.getBasis()[2]); - - for (bit = buckets.begin(); bit != buckets.end(); ++bit) - { - SG_DList::iterator mit((*bit)->GetActiveMeshSlots()); - for(mit.begin(); !mit.end(); ++mit) - size++; - } - - slots.resize(size); - - for (bit = buckets.begin(); bit != buckets.end(); ++bit) - { - RAS_MaterialBucket* bucket = *bit; - RAS_MeshSlot* ms; - // remove the mesh slot form the list, it culls them automatically for next frame - while((ms = bucket->GetNextActiveMeshSlot())) { - slots[i++].set(ms, bucket, pnorm); - } - } - - if(alpha) - sort(slots.begin(), slots.end(), backtofront()); - else - sort(slots.begin(), slots.end(), fronttoback()); -} - -void RAS_BucketManager::RenderAlphaBuckets( - const MT_Transform& cameratrans, RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools) -{ - vector slots; - vector::iterator sit; - - // Having depth masks disabled/enabled gives different artifacts in - // case no sorting is done or is done inexact. For compatibility, we - // disable it. - rasty->SetDepthMask(RAS_IRasterizer::KX_DEPTHMASK_DISABLED); - - OrderBuckets(cameratrans, m_AlphaBuckets, slots, true); - - for(sit=slots.begin(); sit!=slots.end(); ++sit) { - rendertools->SetClientObject(rasty, sit->m_ms->m_clientObj); - - while(sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools)) - sit->m_bucket->RenderMeshSlot(cameratrans, rasty, rendertools, *(sit->m_ms)); - - // make this mesh slot culled automatically for next frame - // it will be culled out by frustrum culling - sit->m_ms->SetCulled(true); - } - - rasty->SetDepthMask(RAS_IRasterizer::KX_DEPTHMASK_ENABLED); -} - -void RAS_BucketManager::RenderSolidBuckets( - const MT_Transform& cameratrans, RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools) -{ - BucketList::iterator bit; - - rasty->SetDepthMask(RAS_IRasterizer::KX_DEPTHMASK_ENABLED); - - for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) { -#if 1 - RAS_MaterialBucket* bucket = *bit; - RAS_MeshSlot* ms; - // remove the mesh slot form the list, it culls them automatically for next frame - while((ms = bucket->GetNextActiveMeshSlot())) - { - rendertools->SetClientObject(rasty, ms->m_clientObj); - while (bucket->ActivateMaterial(cameratrans, rasty, rendertools)) - bucket->RenderMeshSlot(cameratrans, rasty, rendertools, *ms); - - // make this mesh slot culled automatically for next frame - // it will be culled out by frustrum culling - ms->SetCulled(true); - } -#else - list::iterator mit; - for (mit = (*bit)->msBegin(); mit != (*bit)->msEnd(); ++mit) { - if (mit->IsCulled()) - continue; - - rendertools->SetClientObject(rasty, mit->m_clientObj); - - while ((*bit)->ActivateMaterial(cameratrans, rasty, rendertools)) - (*bit)->RenderMeshSlot(cameratrans, rasty, rendertools, *mit); - - // make this mesh slot culled automatically for next frame - // it will be culled out by frustrum culling - mit->SetCulled(true); - } -#endif - } - - /* this code draws meshes order front-to-back instead to reduce overdraw. - * it turned out slower due to much material state switching, a more clever - * algorithm might do better. */ -#if 0 - vector slots; - vector::iterator sit; - - OrderBuckets(cameratrans, m_SolidBuckets, slots, false); - - for(sit=slots.begin(); sit!=slots.end(); ++sit) { - rendertools->SetClientObject(rasty, sit->m_ms->m_clientObj); - - while(sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools)) - sit->m_bucket->RenderMeshSlot(cameratrans, rasty, rendertools, *(sit->m_ms)); - } -#endif -} - -void RAS_BucketManager::Renderbuckets( - const MT_Transform& cameratrans, RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools) -{ - /* beginning each frame, clear (texture/material) caching information */ - rasty->ClearCachingInfo(); - - RenderSolidBuckets(cameratrans, rasty, rendertools); - RenderAlphaBuckets(cameratrans, rasty, rendertools); - - rendertools->SetClientObject(rasty, NULL); -} - -RAS_MaterialBucket* RAS_BucketManager::FindBucket(RAS_IPolyMaterial * material, bool &bucketCreated) -{ - BucketList::iterator it; - - bucketCreated = false; - - for (it = m_SolidBuckets.begin(); it != m_SolidBuckets.end(); it++) - if (*(*it)->GetPolyMaterial() == *material) - return *it; - - for (it = m_AlphaBuckets.begin(); it != m_AlphaBuckets.end(); it++) - if (*(*it)->GetPolyMaterial() == *material) - return *it; - - RAS_MaterialBucket *bucket = new RAS_MaterialBucket(material); - bucketCreated = true; - - if (bucket->IsAlpha()) - m_AlphaBuckets.push_back(bucket); - else - m_SolidBuckets.push_back(bucket); - - return bucket; -} - -void RAS_BucketManager::OptimizeBuckets(MT_Scalar distance) -{ - BucketList::iterator bit; - - distance = 10.0; - - for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) - (*bit)->Optimize(distance); - for (bit = m_AlphaBuckets.begin(); bit != m_AlphaBuckets.end(); ++bit) - (*bit)->Optimize(distance); -} - -void RAS_BucketManager::ReleaseDisplayLists(RAS_IPolyMaterial *mat) -{ - BucketList::iterator bit; - list::iterator mit; - - for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) { - if (mat == NULL || (mat == (*bit)->GetPolyMaterial())) { - for (mit = (*bit)->msBegin(); mit != (*bit)->msEnd(); ++mit) { - if(mit->m_DisplayList) { - mit->m_DisplayList->Release(); - mit->m_DisplayList = NULL; - } - } - } - } - - for (bit = m_AlphaBuckets.begin(); bit != m_AlphaBuckets.end(); ++bit) { - if (mat == NULL || (mat == (*bit)->GetPolyMaterial())) { - for (mit = (*bit)->msBegin(); mit != (*bit)->msEnd(); ++mit) { - if(mit->m_DisplayList) { - mit->m_DisplayList->Release(); - mit->m_DisplayList = NULL; - } - } - } - } -} - -void RAS_BucketManager::ReleaseMaterials(RAS_IPolyMaterial * mat) -{ - BucketList::iterator bit; - list::iterator mit; - - for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) { - if (mat == NULL || (mat == (*bit)->GetPolyMaterial())) { - (*bit)->GetPolyMaterial()->ReleaseMaterial(); - } - } - - for (bit = m_AlphaBuckets.begin(); bit != m_AlphaBuckets.end(); ++bit) { - if (mat == NULL || (mat == (*bit)->GetPolyMaterial())) { - (*bit)->GetPolyMaterial()->ReleaseMaterial(); - } - } -} - -/* frees the bucket, only used when freeing scenes */ -void RAS_BucketManager::RemoveMaterial(RAS_IPolyMaterial * mat) -{ - BucketList::iterator bit, bitp; - list::iterator mit; - int i; - - - for(i=0; iGetPolyMaterial()) { - m_SolidBuckets.erase(m_SolidBuckets.begin()+i); - delete bucket; - i--; - } - } - - for(int i=0; iGetPolyMaterial()) { - m_AlphaBuckets.erase(m_AlphaBuckets.begin()+i); - delete bucket; - i--; - } - } -} - -//#include - -void RAS_BucketManager::MergeBucketManager(RAS_BucketManager *other) -{ - /* concatinate lists */ - // printf("BEFORE %d %d\n", GetSolidBuckets().size(), GetAlphaBuckets().size()); - GetSolidBuckets().insert( GetSolidBuckets().end(), other->GetSolidBuckets().begin(), other->GetSolidBuckets().end() ); - other->GetSolidBuckets().clear(); - - GetAlphaBuckets().insert( GetAlphaBuckets().end(), other->GetAlphaBuckets().begin(), other->GetAlphaBuckets().end() ); - other->GetAlphaBuckets().clear(); - //printf("AFTER %d %d\n", GetSolidBuckets().size(), GetAlphaBuckets().size()); -} - diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.h b/source/gameengine/Rasterizer/RAS_BucketManager.h deleted file mode 100644 index 0c871a87428..00000000000 --- a/source/gameengine/Rasterizer/RAS_BucketManager.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -// this will be put in a class later on - -#ifndef __RAS_BUCKETMANAGER -#define __RAS_BUCKETMANAGER - -#include "MT_Transform.h" -#include "RAS_MaterialBucket.h" -#include "GEN_Map.h" - -#include - -class RAS_BucketManager -{ - typedef std::vector BucketList; - BucketList m_SolidBuckets; - BucketList m_AlphaBuckets; - - struct sortedmeshslot; - struct backtofront; - struct fronttoback; - -public: - RAS_BucketManager(); - virtual ~RAS_BucketManager(); - - void Renderbuckets(const MT_Transform & cameratrans, - RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools); - - RAS_MaterialBucket* FindBucket(RAS_IPolyMaterial * material, bool &bucketCreated); - void OptimizeBuckets(MT_Scalar distance); - - void ReleaseDisplayLists(RAS_IPolyMaterial * material = NULL); - void ReleaseMaterials(RAS_IPolyMaterial * material = NULL); - - void RemoveMaterial(RAS_IPolyMaterial * mat); // freeing scenes only - - /* for merging */ - void MergeBucketManager(RAS_BucketManager *other); - BucketList & GetSolidBuckets() {return m_SolidBuckets;}; - BucketList & GetAlphaBuckets() {return m_AlphaBuckets;}; - - /*void PrintStats(int verbose_level) { - printf("\nMappings...\n"); - printf("\t m_SolidBuckets: %d\n", m_SolidBuckets.size()); - printf("\t\t m_SolidBuckets: %d\n", m_SolidBuckets.size()); - printf("\t m_AlphaBuckets: %d\n", m_AlphaBuckets.size()); - }*/ - - -private: - void OrderBuckets(const MT_Transform& cameratrans, BucketList& buckets, vector& slots, bool alpha); - - void RenderSolidBuckets(const MT_Transform& cameratrans, - RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools); - void RenderAlphaBuckets(const MT_Transform& cameratrans, - RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools); - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_BucketManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__RAS_BUCKETMANAGER - diff --git a/source/gameengine/Rasterizer/RAS_CameraData.h b/source/gameengine/Rasterizer/RAS_CameraData.h deleted file mode 100644 index 01f8d491a35..00000000000 --- a/source/gameengine/Rasterizer/RAS_CameraData.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_CAMERADATA_H -#define __RAS_CAMERADATA_H - -struct RAS_CameraData -{ - float m_lens; - float m_scale; - float m_clipstart; - float m_clipend; - bool m_perspective; - bool m_viewport; - int m_viewportleft; - int m_viewportbottom; - int m_viewportright; - int m_viewporttop; - float m_focallength; - - RAS_CameraData(float lens = 35.0, float scale = 6.0, float clipstart = 0.1, float clipend = 5000.0, bool perspective = true, - float focallength = 3.0, bool viewport = false, int viewportleft = 0, int viewportbottom = 0, - int viewportright = 0, int viewporttop = 0) : - m_lens(lens), - m_scale(scale), - m_clipstart(clipstart), - m_clipend(clipend), - m_perspective(perspective), - m_viewport(viewport), - m_viewportleft(viewportleft), - m_viewportbottom(viewportbottom), - m_viewportright(viewportright), - m_viewporttop(viewporttop), - m_focallength(focallength) - { - } -}; - -#endif //__RAS_CAMERADATA_H - diff --git a/source/gameengine/Rasterizer/RAS_Deformer.h b/source/gameengine/Rasterizer/RAS_Deformer.h deleted file mode 100644 index 396b6717144..00000000000 --- a/source/gameengine/Rasterizer/RAS_Deformer.h +++ /dev/null @@ -1,98 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef RAS_DEFORMER -#define RAS_DEFORMER - -#ifdef WIN32 -#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning -#endif //WIN32 - -#include -#include "GEN_Map.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -struct DerivedMesh; -class RAS_MeshObject; - -class RAS_Deformer -{ -public: - RAS_Deformer() : m_pMesh(NULL), m_bDynamic(false) {}; - virtual ~RAS_Deformer(){}; - virtual void Relink(GEN_Map*map)=0; - virtual bool Apply(class RAS_IPolyMaterial *polymat)=0; - virtual bool Update(void)=0; - virtual bool UpdateBuckets(void)=0; - virtual RAS_Deformer *GetReplica()=0; - virtual void ProcessReplica()=0; - virtual bool SkipVertexTransform() - { - return false; - } - virtual bool ShareVertexArray() - { - return true; - } - virtual bool UseVertexArray() - { - return true; - } - // true when deformer produces varying vertex (shape or armature) - bool IsDynamic() - { - return m_bDynamic; - } - virtual struct DerivedMesh* GetFinalMesh() - { - return NULL; - } - virtual class RAS_MeshObject* GetRasMesh() - { - /* m_pMesh does not seem to be being used?? */ - return NULL; - } - virtual float (* GetTransVerts(int *tot))[3] { *tot= 0; return NULL; } - -protected: - class RAS_MeshObject *m_pMesh; - bool m_bDynamic; - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_Deformer"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp deleted file mode 100644 index 61734e89236..00000000000 --- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "RAS_FramingManager.h" -#include "RAS_Rect.h" - - void -RAS_FramingManager:: -ComputeDefaultFrustum( - const float camnear, - const float camfar, - const float lens, - const float design_aspect_ratio, - RAS_FrameFrustum & frustum -){ - - /* - * Magic Blender calculation. - * Blender does not give a Field of View as lens but a size - * at 16 units away from the lens. - */ - float halfSize = 16.f * camnear / lens; - float sizeX; - float sizeY; - - if (design_aspect_ratio > 1.f) { - // halfsize defines the width - sizeX = halfSize; - sizeY = halfSize/design_aspect_ratio; - } else { - // halfsize defines the height - sizeX = halfSize * design_aspect_ratio; - sizeY = halfSize; - } - - frustum.x2 = sizeX; - frustum.x1 = -frustum.x2; - frustum.y2 = sizeY; - frustum.y1 = -frustum.y2; - frustum.camnear = camnear; - frustum.camfar = camfar; -} - - void -RAS_FramingManager:: -ComputeDefaultOrtho( - const float camnear, - const float camfar, - const float scale, - const float design_aspect_ratio, - RAS_FrameFrustum & frustum -) -{ - float halfSize = scale*0.5f; - float sizeX; - float sizeY; - - if (design_aspect_ratio > 1.f) { - // halfsize defines the width - sizeX = halfSize; - sizeY = halfSize/design_aspect_ratio; - } else { - // halfsize defines the height - sizeX = halfSize * design_aspect_ratio; - sizeY = halfSize; - } - - frustum.x2 = sizeX; - frustum.x1 = -frustum.x2; - frustum.y2 = sizeY; - frustum.y1 = -frustum.y2; - frustum.camnear = -camfar; - frustum.camfar = camfar; -} - - - void -RAS_FramingManager:: -ComputeBestFitViewRect( - const RAS_Rect &availableViewport, - const float design_aspect_ratio, - RAS_Rect &viewport -){ - // try and honour the aspect ratio when setting the - // drawable area. If we don't do this we are liable - // to get a lot of distortion in the rendered image. - - int width = availableViewport.GetWidth(); - int height = availableViewport.GetHeight(); - float window_aspect = float(width)/float(height); - - if (window_aspect < design_aspect_ratio) { - int v_height = (int)(width / design_aspect_ratio); - int left_over = (height - v_height) / 2; - - viewport.SetLeft(availableViewport.GetLeft()); - viewport.SetBottom(availableViewport.GetBottom() + left_over); - viewport.SetRight(availableViewport.GetLeft() + width); - viewport.SetTop(availableViewport.GetBottom() + left_over + v_height); - - } else { - int v_width = (int)(height * design_aspect_ratio); - int left_over = (width - v_width) / 2; - - viewport.SetLeft(availableViewport.GetLeft() + left_over); - viewport.SetBottom(availableViewport.GetBottom()); - viewport.SetRight(availableViewport.GetLeft() + v_width + left_over); - viewport.SetTop(availableViewport.GetBottom() + height); - } -} - - void -RAS_FramingManager:: -ComputeViewport( - const RAS_FrameSettings &settings, - const RAS_Rect &availableViewport, - RAS_Rect &viewport -){ - - RAS_FrameSettings::RAS_FrameType type = settings.FrameType(); - const int winx = availableViewport.GetWidth(); - const int winy = availableViewport.GetHeight(); - - const float design_width = float(settings.DesignAspectWidth()); - const float design_height = float(settings.DesignAspectHeight()); - - float design_aspect_ratio = float(1); - - if (design_height == float(0)) { - // well this is ill defined - // lets just scale the thing - - type = RAS_FrameSettings::e_frame_scale; - } else { - design_aspect_ratio = design_width/design_height; - } - - switch (type) { - - case RAS_FrameSettings::e_frame_scale : - case RAS_FrameSettings::e_frame_extend: - { - viewport.SetLeft(availableViewport.GetLeft()); - viewport.SetBottom(availableViewport.GetBottom()); - viewport.SetRight(availableViewport.GetLeft() + int(winx)); - viewport.SetTop(availableViewport.GetBottom() + int(winy)); - - break; - } - - case RAS_FrameSettings::e_frame_bars: - { - ComputeBestFitViewRect( - availableViewport, - design_aspect_ratio, - viewport - ); - - break; - } - default : - break; - } -} - - void -RAS_FramingManager:: -ComputeFrustum( - const RAS_FrameSettings &settings, - const RAS_Rect &availableViewport, - const RAS_Rect &viewport, - const float lens, - const float camnear, - const float camfar, - RAS_FrameFrustum &frustum -){ - - RAS_FrameSettings::RAS_FrameType type = settings.FrameType(); - - const float design_width = float(settings.DesignAspectWidth()); - const float design_height = float(settings.DesignAspectHeight()); - - float design_aspect_ratio = float(1); - - if (design_height == float(0)) { - // well this is ill defined - // lets just scale the thing - - type = RAS_FrameSettings::e_frame_scale; - } else { - design_aspect_ratio = design_width/design_height; - } - - ComputeDefaultFrustum( - camnear, - camfar, - lens, - design_aspect_ratio, - frustum - ); - - switch (type) { - - case RAS_FrameSettings::e_frame_extend: - { - RAS_Rect vt; - ComputeBestFitViewRect( - availableViewport, - design_aspect_ratio, - vt - ); - - // now scale the calculated frustum by the difference - // between vt and the viewport in each axis. - // These are always > 1 - - float x_scale = float(viewport.GetWidth())/float(vt.GetWidth()); - float y_scale = float(viewport.GetHeight())/float(vt.GetHeight()); - - frustum.x1 *= x_scale; - frustum.x2 *= x_scale; - frustum.y1 *= y_scale; - frustum.y2 *= y_scale; - - break; - } - case RAS_FrameSettings::e_frame_scale : - case RAS_FrameSettings::e_frame_bars: - default : - break; - } -} - - void -RAS_FramingManager:: - ComputeOrtho( - const RAS_FrameSettings &settings, - const RAS_Rect &availableViewport, - const RAS_Rect &viewport, - const float scale, - const float camnear, - const float camfar, - RAS_FrameFrustum &frustum - ) -{ - RAS_FrameSettings::RAS_FrameType type = settings.FrameType(); - - const float design_width = float(settings.DesignAspectWidth()); - const float design_height = float(settings.DesignAspectHeight()); - - float design_aspect_ratio = float(1); - - if (design_height == float(0)) { - // well this is ill defined - // lets just scale the thing - type = RAS_FrameSettings::e_frame_scale; - } else { - design_aspect_ratio = design_width/design_height; - } - - - ComputeDefaultOrtho( - camnear, - camfar, - scale, - design_aspect_ratio, - frustum - ); - - switch (type) { - - case RAS_FrameSettings::e_frame_extend: - { - RAS_Rect vt; - ComputeBestFitViewRect( - availableViewport, - design_aspect_ratio, - vt - ); - - // now scale the calculated frustum by the difference - // between vt and the viewport in each axis. - // These are always > 1 - - float x_scale = float(viewport.GetWidth())/float(vt.GetWidth()); - float y_scale = float(viewport.GetHeight())/float(vt.GetHeight()); - - frustum.x1 *= x_scale; - frustum.x2 *= x_scale; - frustum.y1 *= y_scale; - frustum.y2 *= y_scale; - - break; - } - case RAS_FrameSettings::e_frame_scale : - case RAS_FrameSettings::e_frame_bars: - default : - break; - } - -} - - diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.h b/source/gameengine/Rasterizer/RAS_FramingManager.h deleted file mode 100644 index c058c8cd3e8..00000000000 --- a/source/gameengine/Rasterizer/RAS_FramingManager.h +++ /dev/null @@ -1,297 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef RAS_FRAMINGMANAGER_H -#define RAS_FRAMINGMANAGER_H - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class RAS_Rect; - -/** - * @section RAS_FrameSettings - * This is a value type describing the framing used - * by a particular scene in the game engine. - * Each KX_Scene contains a RAS_FrameSetting describing - * how the frustum and viewport are to be modified - * depending on the canvas size. - * - * e_frame_scale means that the viewport is set to the current - * canvas size. If the view frustum aspect ratio is different - * to the canvas aspect this will lead to stretching. - * - * e_frame_extend means that the best fit viewport will be - * computed based upon the design aspect ratio - * and the view frustum will be adjusted so that - * more of the scene is visible. - * - * e_frame_bars means that the best fit viewport will be - * be computed based upon the design aspect ratio. - */ - -class RAS_FrameSettings -{ -public : - /** - * enum defining the policy to use - * in each axis. - */ - enum RAS_FrameType { - e_frame_scale, - e_frame_extend, - e_frame_bars - }; - - /** - * Contructor - */ - - RAS_FrameSettings( - RAS_FrameType frame_type, - float bar_r, - float bar_g, - float bar_b, - unsigned int design_aspect_width, - unsigned int design_aspect_height - ): - m_frame_type(frame_type), - m_bar_r(bar_r), - m_bar_g(bar_g), - m_bar_b(bar_b), - m_design_aspect_width(design_aspect_width), - m_design_aspect_height(design_aspect_height) - { - }; - - RAS_FrameSettings( - ): - m_frame_type(e_frame_scale), - m_bar_r(0), - m_bar_g(0), - m_bar_b(0), - m_design_aspect_width(1), - m_design_aspect_height(1) - { - }; - - /** - * Accessors - */ - - const - RAS_FrameType & - FrameType( - ) const { - return m_frame_type; - }; - - void - SetFrameType( - RAS_FrameType type - ) { - m_frame_type = type; - }; - - float - BarRed( - ) const { - return m_bar_r; - }; - - float - BarGreen( - ) const { - return m_bar_g; - }; - - float - BarBlue( - ) const { - return m_bar_b; - }; - - unsigned int - DesignAspectWidth( - ) const { - return m_design_aspect_width; - }; - - unsigned int - DesignAspectHeight( - ) const { - return m_design_aspect_height; - }; - -private : - - RAS_FrameType m_frame_type; - float m_bar_r; - float m_bar_g; - float m_bar_b; - unsigned int m_design_aspect_width; - unsigned int m_design_aspect_height; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_FrameSettings"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -struct RAS_FrameFrustum -{ - float camnear,camfar; - float x1,y1; - float x2,y2; -}; - -/* must match R_CULLING_... from DNA_scene_types.h */ -enum RAS_CullingMode -{ - RAS_CULLING_DBVT = 0, - RAS_CULLING_NORMAL, - RAS_CULLING_NONE -}; - -/** - * @section RAS_FramingManager - * This class helps to compute a view frustum - * and a viewport rectangle given the - * above settings and a description of the - * current canvas dimensions. - * - * You do not have to instantiate this class - * directly, it only contains static helper functions - */ - -class RAS_FramingManager -{ -public : - - /** - * Compute a viewport given - * a RAS_FrameSettings and a description of the - * canvas. - */ - - static - void - ComputeViewport( - const RAS_FrameSettings &settings, - const RAS_Rect &availableViewport, - RAS_Rect &viewport - ); - - - /** - * compute a frustrum given a valid viewport, - * RAS_FrameSettings, canvas description - * and camera description - */ - - static - void - ComputeOrtho( - const RAS_FrameSettings &settings, - const RAS_Rect &availableViewport, - const RAS_Rect &viewport, - const float scale, - const float camnear, - const float camfar, - RAS_FrameFrustum &frustum - ); - - static - void - ComputeFrustum( - const RAS_FrameSettings &settings, - const RAS_Rect &availableViewport, - const RAS_Rect &viewport, - const float lens, - const float camnear, - const float camfar, - RAS_FrameFrustum &frustum - ); - - static - void - ComputeDefaultFrustum( - const float camnear, - const float camfar, - const float lens, - const float design_aspect_ratio, - RAS_FrameFrustum & frustum - ); - - static - void - ComputeDefaultOrtho( - const float camnear, - const float camfar, - const float scale, - const float design_aspect_ratio, - RAS_FrameFrustum & frustum - ); - -private : - - static - void - ComputeBestFitViewRect( - const RAS_Rect &availableViewport, - const float design_aspect_ratio, - RAS_Rect &viewport - ); - - - - /** - * Private constructor - this class is not meant - * for instanciation. - */ - - RAS_FramingManager( - ); - - RAS_FramingManager( - const RAS_FramingManager & - ); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_FramingManager"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Rasterizer/RAS_ICanvas.h b/source/gameengine/Rasterizer/RAS_ICanvas.h deleted file mode 100644 index 339521cb093..00000000000 --- a/source/gameengine/Rasterizer/RAS_ICanvas.h +++ /dev/null @@ -1,219 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_ICANVAS -#define __RAS_ICANVAS - -/** - * 2D rendering device context. The connection from 3d rendercontext to 2d surface. - */ - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class RAS_Rect; - - -class RAS_ICanvas -{ -public: - enum BufferType { - COLOR_BUFFER=1, - DEPTH_BUFFER=2 - }; - - enum RAS_MouseState - { - MOUSE_INVISIBLE=1, - MOUSE_WAIT, - MOUSE_NORMAL - }; - - virtual - ~RAS_ICanvas( - ) { - }; - - virtual - void - Init( - ) = 0; - - virtual - void - BeginFrame( - )=0; - - virtual - void - EndFrame( - )=0; - - /** - * Initializes the canvas for drawing. Drawing to the canvas is - * only allowed between BeginDraw() and EndDraw(). - * - * @retval false Acquiring the canvas failed. - * @retval true Acquiring the canvas succeeded. - * - */ - - virtual - bool - BeginDraw( - )=0; - - /** - * Unitializes the canvas for drawing. - */ - - virtual - void - EndDraw( - )=0; - - - /// probably needs some arguments for PS2 in future - virtual - void - SwapBuffers( - )=0; - - virtual - void - ClearBuffer( - int type - )=0; - - virtual - void - ClearColor( - float r, - float g, - float b, - float a - )=0; - - virtual - int - GetWidth( - ) const = 0; - - virtual - int - GetHeight( - ) const = 0; - - virtual - int - GetMouseX( int x - )=0; - - virtual - int - GetMouseY( int y - )= 0; - - virtual - float - GetMouseNormalizedX( int x - )=0; - - virtual - float - GetMouseNormalizedY( int y - )= 0; - - virtual - const RAS_Rect & - GetDisplayArea( - ) const = 0; - - virtual - void - SetDisplayArea(RAS_Rect *rect - ) = 0; - - /** - * Used to get canvas area within blender. - */ - virtual - RAS_Rect & - GetWindowArea( - ) = 0; - - /** - * Set the visible vieport - */ - - virtual - void - SetViewPort( - int x1, int y1, - int x2, int y2 - ) = 0; - - virtual - void - SetMouseState( - RAS_MouseState mousestate - )=0; - - virtual - void - SetMousePosition( - int x, - int y - )=0; - - virtual - RAS_MouseState - GetMouseState() - { - return m_mousestate; - } - - virtual - void - MakeScreenShot( - const char* filename - )=0; - -protected: - RAS_MouseState m_mousestate; - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_ICanvas"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__RAS_ICANVAS - diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp deleted file mode 100644 index 0c81d7d8274..00000000000 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "RAS_IPolygonMaterial.h" -#include "RAS_IRasterizer.h" - -#include "DNA_image_types.h" -#include "DNA_meshdata_types.h" - -void RAS_IPolyMaterial::Initialize( - const STR_String& texname, - const STR_String& matname, - int materialindex, - int tile, - int tilexrep, - int tileyrep, - int mode, - int transp, - bool alpha, - bool zsort) -{ - m_texturename = texname; - m_materialname = matname; - m_materialindex = materialindex; - m_tile = tile; - m_tilexrep = tilexrep; - m_tileyrep = tileyrep; - m_drawingmode = mode; - m_transp = transp; - m_alpha = alpha; - m_zsort = zsort; - m_polymatid = m_newpolymatid++; - m_flag = 0; - m_multimode = 0; - m_shininess = 35.0; - m_specular.setValue(0.5,0.5,0.5); - m_specularity = 1.0; - m_diffuse.setValue(0.5,0.5,0.5); -} - -RAS_IPolyMaterial::RAS_IPolyMaterial() - : m_texturename("__Dummy_Texture_Name__"), - m_materialname("__Dummy_Material_Name__"), - m_tile(0), - m_tilexrep(0), - m_tileyrep(0), - m_drawingmode (0), - m_transp(0), - m_alpha(false), - m_zsort(false), - m_materialindex(0), - m_polymatid(0), - m_flag(0), - m_multimode(0) -{ - m_shininess = 35.0; - m_specular = MT_Vector3(0.5,0.5,0.5); - m_specularity = 1.0; - m_diffuse = MT_Vector3(0.5,0.5,0.5); -} - -RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname, - const STR_String& matname, - int materialindex, - int tile, - int tilexrep, - int tileyrep, - int mode, - int transp, - bool alpha, - bool zsort) - : m_texturename(texname), - m_materialname(matname), - m_tile(tile), - m_tilexrep(tilexrep), - m_tileyrep(tileyrep), - m_drawingmode (mode), - m_transp(transp), - m_alpha(alpha), - m_zsort(zsort), - m_materialindex(materialindex), - m_polymatid(m_newpolymatid++), - m_flag(0), - m_multimode(0) -{ - m_shininess = 35.0; - m_specular = MT_Vector3(0.5,0.5,0.5); - m_specularity = 1.0; - m_diffuse = MT_Vector3(0.5,0.5,0.5); -} - - -bool RAS_IPolyMaterial::Equals(const RAS_IPolyMaterial& lhs) const -{ - if(m_flag &RAS_BLENDERMAT) - { - bool test = ( - this->m_multimode == lhs.m_multimode && - this->m_flag == lhs.m_flag && - this->m_drawingmode == lhs.m_drawingmode && - this->m_transp == lhs.m_transp && - this->m_texturename.hash() == lhs.m_texturename.hash() && - this->m_materialname.hash() == lhs.m_materialname.hash() - ); - - return test; - } - else - { - return ( - this->m_tile == lhs.m_tile && - this->m_tilexrep == lhs.m_tilexrep && - this->m_tileyrep == lhs.m_tileyrep && - this->m_transp == lhs.m_transp && - this->m_alpha == lhs.m_alpha && - this->m_zsort == lhs.m_zsort && - this->m_drawingmode == lhs.m_drawingmode && - this->m_texturename.hash() == lhs.m_texturename.hash() && - this->m_materialname.hash() == lhs.m_materialname.hash() - ); - } -} - - -void RAS_IPolyMaterial::GetMaterialRGBAColor(unsigned char *rgba) const -{ - *rgba++ = 0xFF; - *rgba++ = 0xFF; - *rgba++ = 0xFF; - *rgba++ = 0xFF; -} - -bool RAS_IPolyMaterial::Less(const RAS_IPolyMaterial& rhs) const -{ - if (Equals(rhs)) - return false; - - return m_polymatid < rhs.m_polymatid; -} - -bool RAS_IPolyMaterial::IsAlpha() const -{ - return m_alpha || m_zsort; -} - -bool RAS_IPolyMaterial::IsZSort() const -{ - return m_zsort; -} - -unsigned int RAS_IPolyMaterial::hash() const -{ - return m_texturename.hash(); -} - -int RAS_IPolyMaterial::GetDrawingMode() const -{ - return m_drawingmode; -} - -const STR_String& RAS_IPolyMaterial::GetMaterialName() const -{ - return m_materialname; -} - -dword RAS_IPolyMaterial::GetMaterialNameHash() const -{ - return m_materialname.hash(); -} - -const STR_String& RAS_IPolyMaterial::GetTextureName() const -{ - return m_texturename; -} - -int RAS_IPolyMaterial::GetMaterialIndex() const -{ - return m_materialindex; -} - -Material *RAS_IPolyMaterial::GetBlenderMaterial() const -{ - return NULL; -} - -Scene* RAS_IPolyMaterial::GetBlenderScene() const -{ - return NULL; -} - -void RAS_IPolyMaterial::ReleaseMaterial() -{ -} - -unsigned int RAS_IPolyMaterial::GetFlag() const -{ - return m_flag; -} - -bool RAS_IPolyMaterial::UsesLighting(RAS_IRasterizer *rasty) const -{ - bool dolights = false; - - if(m_flag & RAS_BLENDERMAT) - dolights = (m_flag &RAS_MULTILIGHT)!=0; - else if(rasty->GetDrawingMode() < RAS_IRasterizer::KX_SOLID); - else if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW); - else - dolights = (m_drawingmode & 16)!=0; - - return dolights; -} - -bool RAS_IPolyMaterial::UsesObjectColor() const -{ - return !(m_flag & RAS_BLENDERGLSL); -} - -unsigned int RAS_IPolyMaterial::m_newpolymatid = 0; - diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h deleted file mode 100644 index bcc8c32e54e..00000000000 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h +++ /dev/null @@ -1,195 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_IPOLYGONMATERIAL -#define __RAS_IPOLYGONMATERIAL - -#include "STR_HashedString.h" - -/** - * Polygon Material on which the material buckets are sorted - * - */ -#include "MT_Vector3.h" -#include "STR_HashedString.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class RAS_IRasterizer; -struct MTFace; -struct Material; -struct Scene; -class SCA_IScene; - -enum MaterialProps -{ - RAS_ZSORT =1, - RAS_TRANSPARENT =2, - RAS_TRIANGLE =4, - RAS_MULTITEX =8, - RAS_MULTILIGHT =16, - RAS_BLENDERMAT =32, - RAS_GLSHADER =64, - RAS_AUTOGEN =128, - RAS_NORMAL =256, - RAS_DEFMULTI =512, - RAS_BLENDERGLSL =1024 -}; - -/** - * Material properties. - */ -class RAS_IPolyMaterial -{ - //todo: remove these variables from this interface/protocol class -protected: - STR_HashedString m_texturename; - STR_HashedString m_materialname; //also needed for touchsensor - int m_tile; - int m_tilexrep,m_tileyrep; - int m_drawingmode; // tface->mode - int m_transp; - bool m_alpha; - bool m_zsort; - int m_materialindex; - - unsigned int m_polymatid; - static unsigned int m_newpolymatid; - - // will move... - unsigned int m_flag;//MaterialProps - int m_multimode; // sum of values -public: - MT_Vector3 m_diffuse; - float m_shininess; - MT_Vector3 m_specular; - float m_specularity; - - /** Used to store caching information for materials. */ - typedef void* TCachingInfo; - - // care! these are taken from blender polygonflags, see file DNA_mesh_types.h for #define TF_BILLBOARD etc. - enum MaterialFlags - { - BILLBOARD_SCREENALIGNED = 256, - BILLBOARD_AXISALIGNED = 4096, - SHADOW =8192 - }; - - RAS_IPolyMaterial(); - RAS_IPolyMaterial(const STR_String& texname, - const STR_String& matname, - int materialindex, - int tile, - int tilexrep, - int tileyrep, - int mode, - int transp, - bool alpha, - bool zsort); - void Initialize(const STR_String& texname, - const STR_String& matname, - int materialindex, - int tile, - int tilexrep, - int tileyrep, - int mode, - int transp, - bool alpha, - bool zsort); - virtual ~RAS_IPolyMaterial() {}; - - /** - * Returns the caching information for this material, - * This can be used to speed up the rasterizing process. - * @return The caching information. - */ - virtual TCachingInfo GetCachingInfo(void) const { return 0; } - - /** - * Activates the material in the rasterizer. - * On entry, the cachingInfo contains info about the last activated material. - * On exit, the cachingInfo should contain updated info about this material. - * @param rasty The rasterizer in which the material should be active. - * @param cachingInfo The information about the material used to speed up rasterizing. - */ - virtual bool Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const - { - return false; - } - virtual void ActivateMeshSlot(const class RAS_MeshSlot & ms, RAS_IRasterizer* rasty) const {} - - virtual bool Equals(const RAS_IPolyMaterial& lhs) const; - bool Less(const RAS_IPolyMaterial& rhs) const; - //int GetLightLayer() const; - bool IsAlpha() const; - bool IsZSort() const; - unsigned int hash() const; - int GetDrawingMode() const; - const STR_String& GetMaterialName() const; - dword GetMaterialNameHash() const; - const STR_String& GetTextureName() const; - unsigned int GetFlag() const; - int GetMaterialIndex() const; - - virtual Material* GetBlenderMaterial() const; - virtual Scene* GetBlenderScene() const; - virtual void ReleaseMaterial(); - virtual void GetMaterialRGBAColor(unsigned char *rgba) const; - virtual bool UsesLighting(RAS_IRasterizer *rasty) const; - virtual bool UsesObjectColor() const; - - virtual void Replace_IScene(SCA_IScene *val) {}; /* overridden by KX_BlenderMaterial */ - - /* - * PreCalculate texture gen - */ - virtual void OnConstruction(int layer){} - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_IPolyMaterial"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -inline bool operator ==( const RAS_IPolyMaterial & rhs,const RAS_IPolyMaterial & lhs) -{ - return ( rhs.Equals(lhs)); -} - -inline bool operator < ( const RAS_IPolyMaterial & lhs, const RAS_IPolyMaterial & rhs) -{ - return lhs.Less(rhs); -} - -#endif //__RAS_IPOLYGONMATERIAL - diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h deleted file mode 100644 index 3ffbfcd5a8a..00000000000 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ /dev/null @@ -1,424 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_IRASTERIZER -#define __RAS_IRASTERIZER - -#ifdef WIN32 -#pragma warning (disable:4786) -#endif - -#include "STR_HashedString.h" - -#include "MT_CmMatrix4x4.h" -#include "MT_Matrix4x4.h" - -#include "RAS_TexVert.h" - -#include -using namespace std; - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class RAS_ICanvas; -class RAS_IPolyMaterial; - -typedef vector KX_IndexArray; -typedef vector KX_VertexArray; -typedef vector< KX_VertexArray* > vecVertexArray; -typedef vector< KX_IndexArray* > vecIndexArrays; - -/** - * 3D rendering device context interface. - */ -class RAS_IRasterizer -{ -public: - RAS_IRasterizer(RAS_ICanvas* canv){}; - virtual ~RAS_IRasterizer(){}; - /** - */ - enum { - RAS_RENDER_3DPOLYGON_TEXT = 16384 - }; - /** - * Drawing types - */ - enum DrawType { - KX_BOUNDINGBOX = 1, - KX_WIREFRAME, - KX_SOLID, - KX_SHADED, - KX_TEXTURED, - KX_SHADOW - }; - - /** - * Drawing modes - */ - - enum DrawMode { - KX_MODE_LINES = 1, - KX_MODE_TRIANGLES, - KX_MODE_QUADS - }; - - /** - * Valid SetDepthMask parameters - */ - enum DepthMask { - KX_DEPTHMASK_ENABLED =1, - KX_DEPTHMASK_DISABLED - }; - - /** - */ - enum { - KX_TWOSIDE = 512, - KX_LINES = 32768 - }; - - /** - * Stereo mode types - */ - enum StereoMode { - RAS_STEREO_NOSTEREO = 1, - RAS_STEREO_QUADBUFFERED, - RAS_STEREO_ABOVEBELOW, - RAS_STEREO_INTERLACED, - RAS_STEREO_ANAGLYPH, - RAS_STEREO_SIDEBYSIDE, - RAS_STEREO_VINTERLACE, - RAS_STEREO_DOME, - - RAS_STEREO_MAXSTEREO - }; - - /** - * Texture gen modes. - */ - enum TexCoGen { - RAS_TEXCO_GEN, //< GPU will generate texture coordinates - RAS_TEXCO_ORCO, //< Vertex coordinates (object space) - RAS_TEXCO_GLOB, //< Vertex coordinates (world space) - RAS_TEXCO_UV1, //< UV coordinates - RAS_TEXCO_OBJECT, //< Use another object's position as coordinates - RAS_TEXCO_LAVECTOR, //< Light vector as coordinates - RAS_TEXCO_VIEW, //< View vector as coordinates - RAS_TEXCO_STICKY, //< Sticky coordinates - RAS_TEXCO_WINDOW, //< Window coordinates - RAS_TEXCO_NORM, //< Normal coordinates - RAS_TEXTANGENT, //< - RAS_TEXCO_UV2, //< - RAS_TEXCO_VCOL, //< Vertex Color - RAS_TEXCO_DISABLE //< Disable this texture unit (cached) - }; - - /** - * Render pass identifiers for stereo. - */ - enum StereoEye { - RAS_STEREO_LEFTEYE = 1, - RAS_STEREO_RIGHTEYE - }; - - /** - * SetDepthMask enables or disables writing a fragment's depth value - * to the Z buffer. - */ - virtual void SetDepthMask(DepthMask depthmask)=0; - /** - * SetMaterial sets the material settings for subsequent primitives - * to be rendered with. - * The material will be cached. - */ - virtual bool SetMaterial(const RAS_IPolyMaterial& mat)=0; - /** - * Init initialises the renderer. - */ - virtual bool Init()=0; - /** - * Exit cleans up the renderer. - */ - virtual void Exit()=0; - /** - * BeginFrame is called at the start of each frame. - */ - virtual bool BeginFrame(int drawingmode, double time)=0; - /** - * ClearColorBuffer clears the color buffer. - */ - virtual void ClearColorBuffer()=0; - /** - * ClearDepthBuffer clears the depth buffer. - */ - virtual void ClearDepthBuffer()=0; - /** - * ClearCachingInfo clears the currently cached material. - */ - virtual void ClearCachingInfo(void)=0; - /** - * EndFrame is called at the end of each frame. - */ - virtual void EndFrame()=0; - /** - * SetRenderArea sets the render area from the 2d canvas. - * Returns true if only of subset of the canvas is used. - */ - virtual void SetRenderArea()=0; - - // Stereo Functions - /** - * SetStereoMode will set the stereo mode - */ - virtual void SetStereoMode(const StereoMode stereomode)=0; - /** - * Stereo can be used to query if the rasterizer is in stereo mode. - * @return true if stereo mode is enabled. - */ - virtual bool Stereo()=0; - virtual StereoMode GetStereoMode()=0; - virtual bool InterlacedStereo()=0; - /** - * Sets which eye buffer subsequent primitives will be rendered to. - */ - virtual void SetEye(const StereoEye eye)=0; - virtual StereoEye GetEye()=0; - /** - * Sets the distance between eyes for stereo mode. - */ - virtual void SetEyeSeparation(const float eyeseparation)=0; - virtual float GetEyeSeparation() = 0; - /** - * Sets the focal length for stereo mode. - */ - virtual void SetFocalLength(const float focallength)=0; - virtual float GetFocalLength() = 0; - /** - * SwapBuffers swaps the back buffer with the front buffer. - */ - virtual void SwapBuffers()=0; - - // Drawing Functions - /** - * IndexPrimitives: Renders primitives from mesh slot. - */ - virtual void IndexPrimitives(class RAS_MeshSlot& ms)=0; - virtual void IndexPrimitivesMulti(class RAS_MeshSlot& ms)=0; - - /** - * IndexPrimitives_3DText will render text into the polygons. - * The text to be rendered is from @param rendertools client object's text property. - */ - virtual void IndexPrimitives_3DText(class RAS_MeshSlot& ms, - class RAS_IPolyMaterial* polymat, - class RAS_IRenderTools* rendertools)=0; - - virtual void SetProjectionMatrix(MT_CmMatrix4x4 & mat)=0; - /* This one should become our final version, methinks. */ - /** - * Set the projection matrix for the rasterizer. This projects - * from camera coordinates to window coordinates. - * @param mat The projection matrix. - */ - virtual void SetProjectionMatrix(const MT_Matrix4x4 & mat)=0; - /** - * Sets the modelview matrix. - */ - virtual void SetViewMatrix(const MT_Matrix4x4 & mat, - const MT_Matrix3x3 & ori, - const MT_Point3 & pos, - bool perspective)=0; - /** - */ - virtual const MT_Point3& GetCameraPosition()=0; - virtual bool GetCameraOrtho()=0; - - /** - */ - virtual void SetFog(float start, - float dist, - float r, - float g, - float b)=0; - - virtual void SetFogColor(float r, - float g, - float b)=0; - - virtual void SetFogStart(float start)=0; - /** - */ - virtual void SetFogEnd(float end)=0; - /** - */ - virtual void DisplayFog()=0; - /** - */ - virtual void DisableFog()=0; - virtual bool IsFogEnabled()=0; - - virtual void SetBackColor(float red, - float green, - float blue, - float alpha)=0; - - /** - * @param drawingmode = KX_BOUNDINGBOX, KX_WIREFRAME, KX_SOLID, KX_SHADED or KX_TEXTURED. - */ - virtual void SetDrawingMode(int drawingmode)=0; - /** - * @return the current drawing mode: KX_BOUNDINGBOX, KX_WIREFRAME, KX_SOLID, KX_SHADED or KX_TEXTURED. - */ - virtual int GetDrawingMode()=0; - /** - * Sets face culling - */ - virtual void SetCullFace(bool enable)=0; - /** - * Sets wireframe mode. - */ - virtual void SetLines(bool enable)=0; - /** - */ - virtual double GetTime()=0; - /** - * Generates a projection matrix from the specified frustum. - * @param left the left clipping plane - * @param right the right clipping plane - * @param bottom the bottom clipping plane - * @param top the top clipping plane - * @param frustnear the near clipping plane - * @param frustfar the far clipping plane - * @return a 4x4 matrix representing the projection transform. - */ - virtual MT_Matrix4x4 GetFrustumMatrix( - float left, - float right, - float bottom, - float top, - float frustnear, - float frustfar, - float focallength = 0.0f, - bool perspective = true - )=0; - - /** - * Generates a orthographic projection matrix from the specified frustum. - * @param left the left clipping plane - * @param right the right clipping plane - * @param bottom the bottom clipping plane - * @param top the top clipping plane - * @param frustnear the near clipping plane - * @param frustfar the far clipping plane - * @return a 4x4 matrix representing the projection transform. - */ - virtual MT_Matrix4x4 GetOrthoMatrix( - float left, - float right, - float bottom, - float top, - float frustnear, - float frustfar - )=0; - - /** - * Sets the specular color component of the lighting equation. - */ - virtual void SetSpecularity(float specX, - float specY, - float specZ, - float specval)=0; - - /** - * Sets the specular exponent component of the lighting equation. - */ - virtual void SetShinyness(float shiny)=0; - /** - * Sets the diffuse color component of the lighting equation. - */ - virtual void SetDiffuse(float difX, - float difY, - float difZ, - float diffuse)=0; - /** - * Sets the emissive color component of the lighting equation. - */ - virtual void SetEmissive(float eX, - float eY, - float eZ, - float e - )=0; - - virtual void SetAmbientColor(float red, float green, float blue)=0; - virtual void SetAmbient(float factor)=0; - - /** - * Sets a polygon offset. z depth will be: z1 = mult*z0 + add - */ - virtual void SetPolygonOffset(float mult, float add) = 0; - - virtual void DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)=0; - virtual void FlushDebugLines()=0; - - - - virtual void SetTexCoordNum(int num) = 0; - virtual void SetAttribNum(int num) = 0; - virtual void SetTexCoord(TexCoGen coords, int unit) = 0; - virtual void SetAttrib(TexCoGen coords, int unit) = 0; - - virtual const MT_Matrix4x4& GetViewMatrix() const = 0; - virtual const MT_Matrix4x4& GetViewInvMatrix() const = 0; - - virtual bool QueryLists(){return false;} - virtual bool QueryArrays(){return false;} - - virtual void EnableMotionBlur(float motionblurvalue)=0; - virtual void DisableMotionBlur()=0; - - virtual float GetMotionBlurValue()=0; - virtual int GetMotionBlurState()=0; - virtual void SetMotionBlurState(int newstate)=0; - - virtual void SetBlendingMode(int blendmode)=0; - virtual void SetFrontFace(bool ccw)=0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_IRasterizer"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__RAS_IRASTERIZER - - diff --git a/source/gameengine/Rasterizer/RAS_IRenderTools.cpp b/source/gameengine/Rasterizer/RAS_IRenderTools.cpp deleted file mode 100644 index f33f5ae058d..00000000000 --- a/source/gameengine/Rasterizer/RAS_IRenderTools.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "RAS_IRenderTools.h" - -void RAS_IRenderTools::SetClientObject(RAS_IRasterizer* rasty, void *obj) -{ - if (m_clientobject != obj) - m_clientobject = obj; -} - -void RAS_IRenderTools::SetAuxilaryClientInfo(void* inf) -{ - m_auxilaryClientInfo = inf; -} - -void RAS_IRenderTools::AddLight(struct RAS_LightObject* lightobject) -{ - m_lights.push_back(lightobject); -} - -void RAS_IRenderTools::RemoveLight(struct RAS_LightObject* lightobject) -{ - std::vector::iterator lit = - std::find(m_lights.begin(),m_lights.end(),lightobject); - - if (!(lit==m_lights.end())) - m_lights.erase(lit); -} - diff --git a/source/gameengine/Rasterizer/RAS_IRenderTools.h b/source/gameengine/Rasterizer/RAS_IRenderTools.h deleted file mode 100644 index 0d89cb41e3c..00000000000 --- a/source/gameengine/Rasterizer/RAS_IRenderTools.h +++ /dev/null @@ -1,191 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_IRENDERTOOLS -#define __RAS_IRENDERTOOLS - -#include "MT_Transform.h" -#include "RAS_IRasterizer.h" -#include "RAS_2DFilterManager.h" - -#include -#include - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class RAS_IPolyMaterial; -struct RAS_LightObject; - - -class RAS_IRenderTools -{ - -protected: - void* m_clientobject; - void* m_auxilaryClientInfo; - - std::vector m_lights; - - RAS_2DFilterManager m_filtermanager; - -public: - enum RAS_TEXT_RENDER_MODE { - RAS_TEXT_RENDER_NODEF = 0, - RAS_TEXT_NORMAL, - RAS_TEXT_PADDED, - RAS_TEXT_MAX - }; - - RAS_IRenderTools( - ) : - m_clientobject(NULL) - { - }; - - virtual - ~RAS_IRenderTools( - ) {}; - - virtual - void - BeginFrame( - RAS_IRasterizer* rasty - )=0; - - virtual - void - EndFrame( - RAS_IRasterizer* rasty - )=0; - - // the following function was formerly called 'Render' - // by it doesn't render anymore - // It only sets the transform for the rasterizer - // so must be renamed to 'applyTransform' or something - - virtual - void - applyTransform( - class RAS_IRasterizer* rasty, - double* oglmatrix, - int drawingmode - )=0; - - /** - * Renders 2D text string. - * @param mode The type of text - * @param text The string to render. - * @param xco Position on the screen (origin in lower left corner). - * @param yco Position on the screen (origin in lower left corner). - * @param width Width of the canvas to draw to. - * @param height Height of the canvas to draw to. - */ - virtual - void - RenderText2D( - RAS_TEXT_RENDER_MODE mode, - const char* text, - int xco, - int yco, - int width, - int height - ) = 0; - - // 3d text, mapped on polygon - virtual - void - RenderText( - int mode, - RAS_IPolyMaterial* polymat, - float v1[3], - float v2[3], - float v3[3], - float v4[3], - int glattrib - )=0; - - virtual - void - ProcessLighting( - RAS_IRasterizer *rasty, - bool uselights, - const MT_Transform& trans - )=0; - - virtual - void - SetClientObject( - RAS_IRasterizer* rasty, - void* obj - ); - - void - SetAuxilaryClientInfo( - void* inf - ); - - virtual - void - PushMatrix( - )=0; - - virtual - void - PopMatrix( - )=0; - - virtual - void - AddLight( - struct RAS_LightObject* lightobject - ); - - virtual - void - RemoveLight( - struct RAS_LightObject* lightobject - ); - - virtual - void - MotionBlur(RAS_IRasterizer* rasterizer)=0; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_IRenderTools"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__RAS_IRENDERTOOLS - - - diff --git a/source/gameengine/Rasterizer/RAS_LightObject.h b/source/gameengine/Rasterizer/RAS_LightObject.h deleted file mode 100644 index 54bc5730564..00000000000 --- a/source/gameengine/Rasterizer/RAS_LightObject.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_LIGHTOBJECT_H -#define __RAS_LIGHTOBJECT_H - -#include "MT_CmMatrix4x4.h" - -struct RAS_LightObject -{ - enum LightType{ - LIGHT_SPOT, - LIGHT_SUN, - LIGHT_NORMAL - }; - bool m_modified; - int m_layer; - void *m_scene; - void *m_light; - - float m_energy; - float m_distance; - - float m_red; - float m_green; - float m_blue; - - float m_att1; - float m_att2; - float m_spotsize; - float m_spotblend; - - LightType m_type; - - bool m_nodiffuse; - bool m_nospecular; -}; - -#endif //__RAS_LIGHTOBJECT_H - diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp deleted file mode 100644 index 14acd0259da..00000000000 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp +++ /dev/null @@ -1,664 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "RAS_MaterialBucket.h" - -#ifdef WIN32 -#pragma warning (disable:4786) -#include -#endif // WIN32 - -#include "RAS_Polygon.h" -#include "RAS_TexVert.h" -#include "RAS_IRasterizer.h" -#include "RAS_IRenderTools.h" -#include "RAS_MeshObject.h" -#include "RAS_Deformer.h" // __NLA - -/* mesh slot */ - -RAS_MeshSlot::RAS_MeshSlot() : SG_QList() -{ - m_clientObj = NULL; - m_pDeformer = NULL; - m_OpenGLMatrix = NULL; - m_mesh = NULL; - m_bucket = NULL; - m_bVisible = false; - m_bCulled = true; - m_bObjectColor = false; - m_RGBAcolor = MT_Vector4(0.0, 0.0, 0.0, 0.0); - m_DisplayList = NULL; - m_bDisplayList = true; - m_joinSlot = NULL; - m_pDerivedMesh = NULL; -} - -RAS_MeshSlot::~RAS_MeshSlot() -{ - RAS_DisplayArrayList::iterator it; - -#ifdef USE_SPLIT - Split(true); - - while(m_joinedSlots.size()) - m_joinedSlots.front()->Split(true); -#endif - - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { - (*it)->m_users--; - if((*it)->m_users == 0) - delete *it; - } - - if (m_DisplayList) { - m_DisplayList->Release(); - m_DisplayList = NULL; - } -} - -RAS_MeshSlot::RAS_MeshSlot(const RAS_MeshSlot& slot) : SG_QList() -{ - RAS_DisplayArrayList::iterator it; - - m_clientObj = NULL; - m_pDeformer = NULL; - m_pDerivedMesh = NULL; - m_OpenGLMatrix = NULL; - m_mesh = slot.m_mesh; - m_bucket = slot.m_bucket; - m_bVisible = slot.m_bVisible; - m_bCulled = slot.m_bCulled; - m_bObjectColor = slot.m_bObjectColor; - m_RGBAcolor = slot.m_RGBAcolor; - m_DisplayList = NULL; - m_bDisplayList = slot.m_bDisplayList; - m_joinSlot = NULL; - m_currentArray = slot.m_currentArray; - m_displayArrays = slot.m_displayArrays; - m_joinedSlots = slot.m_joinedSlots; - - m_startarray = slot.m_startarray; - m_startvertex = slot.m_startvertex; - m_startindex = slot.m_startindex; - m_endarray = slot.m_endarray; - m_endvertex = slot.m_endvertex; - m_endindex = slot.m_endindex; - - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { - // don't copy display arrays for now because it breaks python - // access to vertices, but we'll need a solution if we want to - // join display arrays for reducing draw calls. - //*it = new RAS_DisplayArray(**it); - //(*it)->m_users = 1; - - (*it)->m_users++; - } -} - -void RAS_MeshSlot::init(RAS_MaterialBucket *bucket, int numverts) -{ - m_bucket = bucket; - - SetDisplayArray(numverts); - - m_startarray = 0; - m_startvertex = 0; - m_startindex = 0; - m_endarray = 0; - m_endvertex = 0; - m_endindex = 0; -} - -void RAS_MeshSlot::begin(RAS_MeshSlot::iterator& it) -{ - int startvertex, endvertex; - int startindex, endindex; - - it.array = (m_displayArrays.size() > 0)? m_displayArrays[m_startarray]: NULL; - - if(it.array == NULL || it.array->m_index.size() == 0 || it.array->m_vertex.size() == 0) { - it.array = NULL; - it.vertex = NULL; - it.index = NULL; - it.startvertex = 0; - it.endvertex = 0; - it.totindex = 0; - } - else { - startvertex = m_startvertex; - endvertex = (m_startarray == m_endarray)? m_endvertex: it.array->m_vertex.size(); - startindex = m_startindex; - endindex = (m_startarray == m_endarray)? m_endindex: it.array->m_index.size(); - - it.vertex = &it.array->m_vertex[0]; - it.index = &it.array->m_index[startindex]; - it.startvertex = startvertex; - it.endvertex = endvertex; - it.totindex = endindex-startindex; - it.arraynum = m_startarray; - } -} - -void RAS_MeshSlot::next(RAS_MeshSlot::iterator& it) -{ - int startvertex, endvertex; - int startindex, endindex; - - if(it.arraynum == (size_t)m_endarray) { - it.array = NULL; - it.vertex = NULL; - it.index = NULL; - it.startvertex = 0; - it.endvertex = 0; - it.totindex = 0; - } - else { - it.arraynum++; - it.array = m_displayArrays[it.arraynum]; - - startindex = 0; - endindex = (it.arraynum == (size_t)m_endarray)? m_endindex: it.array->m_index.size(); - startvertex = 0; - endvertex = (it.arraynum == (size_t)m_endarray)? m_endvertex: it.array->m_vertex.size(); - - it.vertex = &it.array->m_vertex[0]; - it.index = &it.array->m_index[startindex]; - it.startvertex = startvertex; - it.endvertex = endvertex; - it.totindex = endindex-startindex; - } -} - -bool RAS_MeshSlot::end(RAS_MeshSlot::iterator& it) -{ - return (it.array == NULL); -} - -RAS_DisplayArray *RAS_MeshSlot::CurrentDisplayArray() -{ - return m_currentArray; -} - -void RAS_MeshSlot::SetDisplayArray(int numverts) -{ - RAS_DisplayArrayList::iterator it; - RAS_DisplayArray *darray = NULL; - - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { - darray = *it; - - if(darray->m_type == numverts) { - if(darray->m_index.size()+numverts >= RAS_DisplayArray::BUCKET_MAX_INDEX) - darray = NULL; - else if(darray->m_vertex.size()+numverts >= RAS_DisplayArray::BUCKET_MAX_VERTEX) - darray = NULL; - else - break; - } - else - darray = NULL; - } - - if(!darray) { - darray = new RAS_DisplayArray(); - darray->m_users = 1; - - if(numverts == 2) darray->m_type = RAS_DisplayArray::LINE; - else if(numverts == 3) darray->m_type = RAS_DisplayArray::TRIANGLE; - else darray->m_type = RAS_DisplayArray::QUAD; - - m_displayArrays.push_back(darray); - - if(numverts == 2) - darray->m_type = RAS_DisplayArray::LINE; - else if(numverts == 3) - darray->m_type = RAS_DisplayArray::TRIANGLE; - else if(numverts == 4) - darray->m_type = RAS_DisplayArray::QUAD; - - m_endarray = m_displayArrays.size()-1; - m_endvertex = 0; - m_endindex = 0; - } - - m_currentArray = darray; -} - -void RAS_MeshSlot::AddPolygon(int numverts) -{ - SetDisplayArray(numverts); -} - -int RAS_MeshSlot::AddVertex(const RAS_TexVert& tv) -{ - RAS_DisplayArray *darray; - int offset; - - darray = m_currentArray; - darray->m_vertex.push_back(tv); - offset = darray->m_vertex.size()-1; - - if(darray == m_displayArrays[m_endarray]) - m_endvertex++; - - return offset; -} - -void RAS_MeshSlot::AddPolygonVertex(int offset) -{ - RAS_DisplayArray *darray; - - darray = m_currentArray; - darray->m_index.push_back(offset); - - if(darray == m_displayArrays[m_endarray]) - m_endindex++; -} - -void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer) -{ - if (deformer && m_pDeformer != deformer) { - RAS_DisplayArrayList::iterator it; - if (deformer->ShareVertexArray()) { - // this deformer uses the base vertex array, first release the current ones - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { - (*it)->m_users--; - if((*it)->m_users == 0) - delete *it; - } - m_displayArrays.clear(); - // then hook to the base ones - RAS_MeshMaterial *mmat = m_mesh->GetMeshMaterial(m_bucket->GetPolyMaterial()); - if (mmat && mmat->m_baseslot) { - m_displayArrays = mmat->m_baseslot->m_displayArrays; - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { - (*it)->m_users++; - } - } - } - else { - // no sharing - // we create local copy of RAS_DisplayArray when we have a deformer: - // this way we can avoid conflict between the vertex cache of duplicates - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { - if (deformer->UseVertexArray()) { - // the deformer makes use of vertex array, make sure we have our local copy - if ((*it)->m_users > 1) { - // only need to copy if there are other users - // note that this is the usual case as vertex arrays are held by the material base slot - RAS_DisplayArray *newarray = new RAS_DisplayArray(*(*it)); - newarray->m_users = 1; - (*it)->m_users--; - *it = newarray; - } - } else { - // the deformer is not using vertex array (Modifier), release them - (*it)->m_users--; - if((*it)->m_users == 0) - delete *it; - } - } - if (!deformer->UseVertexArray()) { - m_displayArrays.clear(); - m_startarray = 0; - m_startvertex = 0; - m_startindex = 0; - m_endarray = 0; - m_endvertex = 0; - m_endindex = 0; - } - } - } - m_pDeformer = deformer; -} - -bool RAS_MeshSlot::Equals(RAS_MeshSlot *target) -{ - if(!m_OpenGLMatrix || !target->m_OpenGLMatrix) - return false; - if(m_pDeformer || target->m_pDeformer) - return false; - if(m_bVisible != target->m_bVisible) - return false; - if(m_bObjectColor != target->m_bObjectColor) - return false; - if(m_bObjectColor && !(m_RGBAcolor == target->m_RGBAcolor)) - return false; - - return true; -} - -bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance) -{ - RAS_DisplayArrayList::iterator it; - iterator mit; - size_t i; - - // verify if we can join - if(m_joinSlot || m_joinedSlots.size() || target->m_joinSlot) - return false; - - if(!Equals(target)) - return false; - - MT_Vector3 co(&m_OpenGLMatrix[12]); - MT_Vector3 targetco(&target->m_OpenGLMatrix[12]); - - if((co - targetco).length() > distance) - return false; - - MT_Matrix4x4 mat(m_OpenGLMatrix); - MT_Matrix4x4 targetmat(target->m_OpenGLMatrix); - targetmat.invert(); - - MT_Matrix4x4 transform = targetmat*mat; - - // m_mesh, clientobj - m_joinSlot = target; - m_joinInvTransform = transform; - m_joinInvTransform.invert(); - target->m_joinedSlots.push_back(this); - - MT_Matrix4x4 ntransform = m_joinInvTransform.transposed(); - ntransform[0][3]= ntransform[1][3]= ntransform[2][3]= 0.0f; - - for(begin(mit); !end(mit); next(mit)) - for(i=mit.startvertex; im_displayArrays.reserve(target->m_displayArrays.size() + m_displayArrays.size()); - - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { - target->m_displayArrays.push_back(*it); - target->m_endarray++; - target->m_endvertex = target->m_displayArrays.back()->m_vertex.size(); - target->m_endindex = target->m_displayArrays.back()->m_index.size(); - } - - if (m_DisplayList) { - m_DisplayList->Release(); - m_DisplayList = NULL; - } - if (target->m_DisplayList) { - target->m_DisplayList->Release(); - target->m_DisplayList = NULL; - } - - return true; -#if 0 - return false; -#endif -} - -bool RAS_MeshSlot::Split(bool force) -{ - list::iterator jit; - RAS_MeshSlot *target = m_joinSlot; - RAS_DisplayArrayList::iterator it, jt; - iterator mit; - size_t i, found0 = 0, found1 = 0; - - if(target && (force || !Equals(target))) { - m_joinSlot = NULL; - - for(jit=target->m_joinedSlots.begin(); jit!=target->m_joinedSlots.end(); jit++) { - if(*jit == this) { - target->m_joinedSlots.erase(jit); - found0 = 1; - break; - } - } - - if(!found0) - abort(); - - for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { - found1 = 0; - for(jt=target->m_displayArrays.begin(); jt!=target->m_displayArrays.end(); jt++) { - if(*jt == *it) { - target->m_displayArrays.erase(jt); - target->m_endarray--; - found1 = 1; - break; - } - } - - if(!found1) - abort(); - } - - if(target->m_displayArrays.size()) { - target->m_endvertex = target->m_displayArrays.back()->m_vertex.size(); - target->m_endindex = target->m_displayArrays.back()->m_index.size(); - } - else { - target->m_endvertex = 0; - target->m_endindex = 0; - } - - MT_Matrix4x4 ntransform = m_joinInvTransform.inverse().transposed(); - ntransform[0][3]= ntransform[1][3]= ntransform[2][3]= 0.0f; - - for(begin(mit); !end(mit); next(mit)) - for(i=mit.startvertex; im_DisplayList) { - target->m_DisplayList->Release(); - target->m_DisplayList = NULL; - } - - return true; - } - - return false; -} - - -#ifdef USE_SPLIT -bool RAS_MeshSlot::IsCulled() -{ - if(m_joinSlot) - return true; - if(!m_bCulled) - return false; - list::iterator it; - for(it=m_joinedSlots.begin(); it!=m_joinedSlots.end(); it++) - if(!(*it)->m_bCulled) - return false; - return true; -} -#endif - -/* material bucket sorting */ - -struct RAS_MaterialBucket::less -{ - bool operator()(const RAS_MaterialBucket* x, const RAS_MaterialBucket* y) const - { - return *x->GetPolyMaterial() < *y->GetPolyMaterial(); - } -}; - -/* material bucket */ - -RAS_MaterialBucket::RAS_MaterialBucket(RAS_IPolyMaterial* mat) -{ - m_material = mat; -} - -RAS_MaterialBucket::~RAS_MaterialBucket() -{ -} - -RAS_IPolyMaterial* RAS_MaterialBucket::GetPolyMaterial() const -{ - return m_material; -} - -bool RAS_MaterialBucket::IsAlpha() const -{ - return (m_material->IsAlpha()); -} - -bool RAS_MaterialBucket::IsZSort() const -{ - return (m_material->IsZSort()); -} - -RAS_MeshSlot* RAS_MaterialBucket::AddMesh(int numverts) -{ - RAS_MeshSlot *ms; - - m_meshSlots.push_back(RAS_MeshSlot()); - - ms = &m_meshSlots.back(); - ms->init(this, numverts); - - return ms; -} - -RAS_MeshSlot* RAS_MaterialBucket::CopyMesh(RAS_MeshSlot *ms) -{ - m_meshSlots.push_back(RAS_MeshSlot(*ms)); - - return &m_meshSlots.back(); -} - -void RAS_MaterialBucket::RemoveMesh(RAS_MeshSlot* ms) -{ - list::iterator it; - - for(it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++) { - if(&*it == ms) { - m_meshSlots.erase(it); - return; - } - } -} - -list::iterator RAS_MaterialBucket::msBegin() -{ - return m_meshSlots.begin(); -} - -list::iterator RAS_MaterialBucket::msEnd() -{ - return m_meshSlots.end(); -} - -bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty, - RAS_IRenderTools *rendertools) -{ - bool uselights; - - if(!rasty->SetMaterial(*m_material)) - return false; - - uselights= m_material->UsesLighting(rasty); - rendertools->ProcessLighting(rasty, uselights, cameratrans); - - return true; -} - -void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRasterizer* rasty, - RAS_IRenderTools* rendertools, RAS_MeshSlot &ms) -{ - m_material->ActivateMeshSlot(ms, rasty); - - if (ms.m_pDeformer) - { - ms.m_pDeformer->Apply(m_material); - // KX_ReInstanceShapeFromMesh(ms.m_mesh); // Recompute the physics mesh. (Can't call KX_* from RAS_) - } - - if(IsZSort() && rasty->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID) - ms.m_mesh->SortPolygons(ms, cameratrans*MT_Transform(ms.m_OpenGLMatrix)); - - rendertools->PushMatrix(); - if (!ms.m_pDeformer || !ms.m_pDeformer->SkipVertexTransform()) - { - rendertools->applyTransform(rasty,ms.m_OpenGLMatrix,m_material->GetDrawingMode()); - } - - if(rasty->QueryLists()) - if(ms.m_DisplayList) - ms.m_DisplayList->SetModified(ms.m_mesh->MeshModified()); - - // verify if we can use display list, not for deformed object, and - // also don't create a new display list when drawing shadow buffers, - // then it won't have texture coordinates for actual drawing. also - // for zsort we can't make a display list, since the polygon order - // changes all the time. - if(ms.m_pDeformer && ms.m_pDeformer->IsDynamic()) - ms.m_bDisplayList = false; - else if(!ms.m_DisplayList && rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW) - ms.m_bDisplayList = false; - else if (IsZSort()) - ms.m_bDisplayList = false; - else if(m_material->UsesObjectColor() && ms.m_bObjectColor) - ms.m_bDisplayList = false; - else - ms.m_bDisplayList = true; - - // for text drawing using faces - if (m_material->GetDrawingMode() & RAS_IRasterizer::RAS_RENDER_3DPOLYGON_TEXT) - rasty->IndexPrimitives_3DText(ms, m_material, rendertools); - // for multitexturing - else if((m_material->GetFlag() & (RAS_MULTITEX|RAS_BLENDERGLSL))) - rasty->IndexPrimitivesMulti(ms); - // use normal IndexPrimitives - else - rasty->IndexPrimitives(ms); - - if(rasty->QueryLists()) - if(ms.m_DisplayList) - ms.m_mesh->SetMeshModified(false); - - rendertools->PopMatrix(); -} - -void RAS_MaterialBucket::Optimize(MT_Scalar distance) -{ - /* TODO: still have to check before this works correct: - * - lightlayer, frontface, text, billboard - * - make it work with physics */ - -#if 0 - list::iterator it; - list::iterator jt; - - // greed joining on all following buckets - for(it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++) - for(jt=it, jt++; jt!=m_meshSlots.end(); jt++) - jt->Join(&*it, distance); -#endif -} - diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h deleted file mode 100644 index 0f7db93049d..00000000000 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h +++ /dev/null @@ -1,261 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_MATERIALBUCKET -#define __RAS_MATERIALBUCKET - -#include "RAS_TexVert.h" -#include "GEN_Map.h" -#include "STR_HashedString.h" -#include "SG_QList.h" - -#include "MT_Transform.h" -#include "RAS_IPolygonMaterial.h" -#include "RAS_IRasterizer.h" -#include "RAS_Deformer.h" - -#include -#include -#include -using namespace std; - -/* Display List Slot */ - -class KX_ListSlot -{ -protected: - int m_refcount; -public: - KX_ListSlot(){ m_refcount=1; } - virtual ~KX_ListSlot() {} - virtual int Release() { - if (--m_refcount > 0) - return m_refcount; - delete this; - return 0; - } - virtual KX_ListSlot* AddRef() { - m_refcount++; - return this; - } - virtual void SetModified(bool mod)=0; -}; - -class RAS_DisplayArray; -class RAS_MeshSlot; -class RAS_MeshMaterial; -class RAS_MaterialBucket; -struct DerivedMesh; - -/* An array with data used for OpenGL drawing */ - -class RAS_DisplayArray -{ -public: - vector m_vertex; - vector m_index; - /* LINE currently isnt used */ - enum { LINE = 2, TRIANGLE = 3, QUAD = 4 } m_type; - //RAS_MeshSlot *m_origSlot; - - /* Number of RAS_MeshSlot using this array */ - int m_users; - - enum { BUCKET_MAX_INDEX = 65535 }; - enum { BUCKET_MAX_VERTEX = 65535 }; -}; - -/* Entry of a RAS_MeshObject into RAS_MaterialBucket */ -typedef std::vector RAS_DisplayArrayList; - -// The QList is used to link the mesh slots to the object -// The DList is used to link the visible mesh slots to the material bucket -class RAS_MeshSlot : public SG_QList -{ - friend class RAS_ListRasterizer; -private: - // indices into display arrays - int m_startarray; - int m_endarray; - int m_startindex; - int m_endindex; - int m_startvertex; - int m_endvertex; - RAS_DisplayArrayList m_displayArrays; - - // for construction only - RAS_DisplayArray* m_currentArray; - -public: - // for rendering - RAS_MaterialBucket* m_bucket; - RAS_MeshObject* m_mesh; - void* m_clientObj; - RAS_Deformer* m_pDeformer; - DerivedMesh* m_pDerivedMesh; - double* m_OpenGLMatrix; - // visibility - bool m_bVisible; - bool m_bCulled; - // object color - bool m_bObjectColor; - MT_Vector4 m_RGBAcolor; - // display lists - KX_ListSlot* m_DisplayList; - bool m_bDisplayList; - // joined mesh slots - RAS_MeshSlot* m_joinSlot; - MT_Matrix4x4 m_joinInvTransform; - list m_joinedSlots; - - RAS_MeshSlot(); - RAS_MeshSlot(const RAS_MeshSlot& slot); - virtual ~RAS_MeshSlot(); - - void init(RAS_MaterialBucket *bucket, int numverts); - - struct iterator { - RAS_DisplayArray *array; - RAS_TexVert *vertex; - unsigned short *index; - size_t startvertex; - size_t endvertex; - size_t totindex; - size_t arraynum; - }; - - void begin(iterator& it); - void next(iterator& it); - bool end(iterator& it); - - /* used during construction */ - void SetDisplayArray(int numverts); - RAS_DisplayArray *CurrentDisplayArray(); - void SetDeformer(RAS_Deformer* deformer); - - void AddPolygon(int numverts); - int AddVertex(const RAS_TexVert& tv); - void AddPolygonVertex(int offset); - - /* optimization */ - bool Split(bool force=false); - bool Join(RAS_MeshSlot *target, MT_Scalar distance); - bool Equals(RAS_MeshSlot *target); -#ifdef USE_SPLIT - bool IsCulled(); -#else - bool IsCulled() { return m_bCulled; } -#endif - void SetCulled(bool culled) { m_bCulled = culled; } - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_MeshSlot"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -/* Used by RAS_MeshObject, to point to it's slots in a bucket */ - -class RAS_MeshMaterial -{ -public: - RAS_MeshSlot *m_baseslot; - class RAS_MaterialBucket *m_bucket; - GEN_Map m_slots; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_MeshMaterial"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -/* Contains a list of display arrays with the same material, - * and a mesh slot for each mesh that uses display arrays in - * this bucket */ - -class RAS_MaterialBucket -{ -public: - RAS_MaterialBucket(RAS_IPolyMaterial* mat); - virtual ~RAS_MaterialBucket(); - - /* Bucket Sorting */ - struct less; - typedef set Set; - - /* Material Properties */ - RAS_IPolyMaterial* GetPolyMaterial() const; - bool IsAlpha() const; - bool IsZSort() const; - - /* Rendering */ - bool ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty, - RAS_IRenderTools *rendertools); - void RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRasterizer* rasty, - RAS_IRenderTools* rendertools, RAS_MeshSlot &ms); - - /* Mesh Slot Access */ - list::iterator msBegin(); - list::iterator msEnd(); - - class RAS_MeshSlot* AddMesh(int numverts); - class RAS_MeshSlot* CopyMesh(class RAS_MeshSlot *ms); - void RemoveMesh(class RAS_MeshSlot* ms); - void Optimize(MT_Scalar distance); - void ActivateMesh(RAS_MeshSlot* slot) - { - m_activeMeshSlotsHead.AddBack(slot); - } - SG_DList& GetActiveMeshSlots() - { - return m_activeMeshSlotsHead; - } - RAS_MeshSlot* GetNextActiveMeshSlot() - { - return (RAS_MeshSlot*)m_activeMeshSlotsHead.Remove(); - } - -private: - list m_meshSlots; // all the mesh slots - RAS_IPolyMaterial* m_material; - SG_DList m_activeMeshSlotsHead; // only those which must be rendered - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_MaterialBucket"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__RAS_MATERIAL_BUCKET - diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.cpp b/source/gameengine/Rasterizer/RAS_MeshObject.cpp deleted file mode 100644 index bd85e6e4504..00000000000 --- a/source/gameengine/Rasterizer/RAS_MeshObject.cpp +++ /dev/null @@ -1,616 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "MEM_guardedalloc.h" - -#include "DNA_object_types.h" -#include "DNA_key_types.h" -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" - -#include "RAS_MeshObject.h" -#include "RAS_IRasterizer.h" -#include "MT_MinMax.h" -#include "MT_Point3.h" - -#include - -/* polygon sorting */ - -struct RAS_MeshObject::polygonSlot -{ - float m_z; - int m_index[4]; - - polygonSlot() {} - - /* pnorm is the normal from the plane equation that the distance from is - * used to sort again. */ - void get(const RAS_TexVert *vertexarray, const unsigned short *indexarray, - int offset, int nvert, const MT_Vector3& pnorm) - { - MT_Vector3 center(0, 0, 0); - int i; - - for(i=0; i b.m_z; - } -}; - -/* mesh object */ - -STR_String RAS_MeshObject::s_emptyname = ""; - -RAS_MeshObject::RAS_MeshObject(Mesh* mesh) - : m_bModified(true), - m_bMeshModified(true), - m_mesh(mesh) -{ - if (m_mesh && m_mesh->key) - { - KeyBlock *kb; - int count=0; - // initialize weight cache for shape objects - // count how many keys in this mesh - for(kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) - count++; - m_cacheWeightIndex.resize(count,-1); - } -} - -RAS_MeshObject::~RAS_MeshObject() -{ - vector::iterator it; - - if (m_mesh && m_mesh->key) - { - KeyBlock *kb; - // remove the weight cache to avoid memory leak - for(kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) { - if(kb->weights) - MEM_freeN(kb->weights); - kb->weights= NULL; - } - } - - for(it=m_Polygons.begin(); it!=m_Polygons.end(); it++) - delete (*it); - - m_sharedvertex_map.clear(); - m_Polygons.clear(); - m_materials.clear(); -} - -bool RAS_MeshObject::MeshModified() -{ - return m_bMeshModified; -} - -//unsigned int RAS_MeshObject::GetLightLayer() -//{ -// return m_lightlayer; -//} - - - -int RAS_MeshObject::NumMaterials() -{ - return m_materials.size(); -} - -const STR_String& RAS_MeshObject::GetMaterialName(unsigned int matid) -{ - RAS_MeshMaterial* mmat = GetMeshMaterial(matid); - - if(mmat) - return mmat->m_bucket->GetPolyMaterial()->GetMaterialName(); - - return s_emptyname; -} - -RAS_MeshMaterial* RAS_MeshObject::GetMeshMaterial(unsigned int matid) -{ - if (m_materials.size() > 0 && (matid < m_materials.size())) - { - list::iterator it = m_materials.begin(); - while (matid--) ++it; - return &*it; - } - - return NULL; -} - - - -int RAS_MeshObject::NumPolygons() -{ - return m_Polygons.size(); -} - - - -RAS_Polygon* RAS_MeshObject::GetPolygon(int num) const -{ - return m_Polygons[num]; -} - - - - - list::iterator GetFirstMaterial(); - list::iterator GetLastMaterial(); -list::iterator RAS_MeshObject::GetFirstMaterial() -{ - return m_materials.begin(); -} - - - -list::iterator RAS_MeshObject::GetLastMaterial() -{ - return m_materials.end(); -} - - - -void RAS_MeshObject::SetName(const char *name) -{ - m_name = name; -} - - - -STR_String& RAS_MeshObject::GetName() -{ - return m_name; -} - - - -const STR_String& RAS_MeshObject::GetTextureName(unsigned int matid) -{ - RAS_MeshMaterial* mmat = GetMeshMaterial(matid); - - if(mmat) - return mmat->m_bucket->GetPolyMaterial()->GetTextureName(); - - return s_emptyname; -} - -RAS_MeshMaterial *RAS_MeshObject::GetMeshMaterial(RAS_IPolyMaterial *mat) -{ - list::iterator mit; - - /* find a mesh material */ - for(mit = m_materials.begin(); mit != m_materials.end(); mit++) - if(mit->m_bucket->GetPolyMaterial() == mat) - return &*mit; - - return NULL; -} - -int RAS_MeshObject::GetMaterialId(RAS_IPolyMaterial *mat) -{ - list::iterator mit; - int imat; - - /* find a mesh material */ - for(imat=0, mit = m_materials.begin(); mit != m_materials.end(); mit++, imat++) - if(mit->m_bucket->GetPolyMaterial() == mat) - return imat; - - return -1; -} - -RAS_Polygon* RAS_MeshObject::AddPolygon(RAS_MaterialBucket *bucket, int numverts) -{ - RAS_MeshMaterial *mmat; - RAS_Polygon *poly; - RAS_MeshSlot *slot; - - /* find a mesh material */ - mmat = GetMeshMaterial(bucket->GetPolyMaterial()); - - /* none found, create a new one */ - if(!mmat) { - RAS_MeshMaterial meshmat; - meshmat.m_bucket = bucket; - meshmat.m_baseslot = meshmat.m_bucket->AddMesh(numverts); - meshmat.m_baseslot->m_mesh = this; - m_materials.push_back(meshmat); - mmat = &m_materials.back(); - } - - /* add it to the bucket, this also adds new display arrays */ - slot = mmat->m_baseslot; - slot->AddPolygon(numverts); - - /* create a new polygon */ - RAS_DisplayArray *darray = slot->CurrentDisplayArray(); - poly = new RAS_Polygon(bucket, darray, numverts); - m_Polygons.push_back(poly); - - return poly; -} - -void RAS_MeshObject::DebugColor(unsigned int abgr) -{ - /*int numpolys = NumPolygons(); - - for (int i=0;iVertexCount();v++) - RAS_TexVert* vtx = poly->GetVertex(v)->setDebugRGBA(abgr); - } - */ - - /* m_debugcolor = abgr; */ -} - -void RAS_MeshObject::SetVertexColor(RAS_IPolyMaterial* mat,MT_Vector4 rgba) -{ - RAS_MeshMaterial *mmat = GetMeshMaterial(mat); - RAS_MeshSlot *slot = mmat->m_baseslot; - RAS_MeshSlot::iterator it; - size_t i; - - for(slot->begin(it); !slot->end(it); slot->next(it)) - for(i=it.startvertex; iGetMaterial()->GetPolyMaterial()); - slot = mmat->m_baseslot; - darray = slot->CurrentDisplayArray(); - - { /* Shared Vertex! */ - /* find vertices shared between faces, with the restriction - * that they exist in the same display array, and have the - * same uv coordinate etc */ - vector& sharedmap = m_sharedvertex_map[origindex]; - vector::iterator it; - - for(it = sharedmap.begin(); it != sharedmap.end(); it++) - { - if(it->m_darray != darray) - continue; - if(!it->m_darray->m_vertex[it->m_offset].closeTo(&texvert)) - continue; - - /* found one, add it and we're done */ - if(poly->IsVisible()) - slot->AddPolygonVertex(it->m_offset); - poly->SetVertexOffset(i, it->m_offset); - return; - } - } - - /* no shared vertex found, add a new one */ - offset = slot->AddVertex(texvert); - if(poly->IsVisible()) - slot->AddPolygonVertex(offset); - poly->SetVertexOffset(i, offset); - - { /* Shared Vertex! */ - SharedVertex shared; - shared.m_darray = darray; - shared.m_offset = offset; - m_sharedvertex_map[origindex].push_back(shared); - } -} - -int RAS_MeshObject::NumVertices(RAS_IPolyMaterial* mat) -{ - RAS_MeshMaterial *mmat; - RAS_MeshSlot *slot; - RAS_MeshSlot::iterator it; - size_t len = 0; - - mmat = GetMeshMaterial(mat); - slot = mmat->m_baseslot; - for(slot->begin(it); !slot->end(it); slot->next(it)) - len += it.endvertex - it.startvertex; - - return len; -} - - -RAS_TexVert* RAS_MeshObject::GetVertex(unsigned int matid, - unsigned int index) -{ - RAS_MeshMaterial *mmat; - RAS_MeshSlot *slot; - RAS_MeshSlot::iterator it; - size_t len; - - mmat = GetMeshMaterial(matid); - - if(!mmat) - return NULL; - - slot = mmat->m_baseslot; - len = 0; - for(slot->begin(it); !slot->end(it); slot->next(it)) { - if(index >= len + it.endvertex - it.startvertex) - len += it.endvertex - it.startvertex; - else - return &it.vertex[index - len]; - } - - return NULL; -} - -const float* RAS_MeshObject::GetVertexLocation(unsigned int orig_index) -{ - vector& sharedmap = m_sharedvertex_map[orig_index]; - vector::iterator it= sharedmap.begin(); - return it->m_darray->m_vertex[it->m_offset].getXYZ(); -} - -void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer* deformer) -{ - list::iterator it; - list::iterator mit; - - for(it = m_materials.begin();it!=m_materials.end();++it) { - /* always copy from the base slot, which is never removed - * since new objects can be created with the same mesh data */ - if (deformer && !deformer->UseVertexArray()) - { - // HACK! - // this deformer doesn't use vertex array => derive mesh - // we must keep only the mesh slots that have unique material id - // this is to match the derived mesh drawing function - // Need a better solution in the future: scan the derive mesh and create vertex array - RAS_IPolyMaterial* curmat = it->m_bucket->GetPolyMaterial(); - if (curmat->GetFlag() & RAS_BLENDERGLSL) - { - for(mit = m_materials.begin(); mit != it; ++mit) - { - RAS_IPolyMaterial* mat = mit->m_bucket->GetPolyMaterial(); - if ((mat->GetFlag() & RAS_BLENDERGLSL) && - mat->GetMaterialIndex() == curmat->GetMaterialIndex()) - // no need to convert current mesh slot - break; - } - if (mit != it) - continue; - } - } - RAS_MeshSlot *ms = it->m_bucket->CopyMesh(it->m_baseslot); - ms->m_clientObj = clientobj; - ms->SetDeformer(deformer); - it->m_slots.insert(clientobj, ms); - head->QAddBack(ms); - } -} - -void RAS_MeshObject::RemoveFromBuckets(void *clientobj) -{ - list::iterator it; - - for(it = m_materials.begin();it!=m_materials.end();++it) { - RAS_MeshSlot **msp = it->m_slots[clientobj]; - - if(!msp) - continue; - - RAS_MeshSlot *ms = *msp; - - it->m_bucket->RemoveMesh(ms); - it->m_slots.remove(clientobj); - } -} - -//void RAS_MeshObject::Transform(const MT_Transform& trans) -//{ - //m_trans.translate(MT_Vector3(0,0,1));//.operator *=(trans); - -// for (int i=0;iTransform(trans); -// } -//} - - -/* -void RAS_MeshObject::RelativeTransform(const MT_Vector3& vec) -{ - for (int i=0;iRelativeTransform(vec); - } -} -*/ - -void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transform) -{ - // Limitations: sorting is quite simple, and handles many - // cases wrong, partially due to polygons being sorted per - // bucket. - // - // a) mixed triangles/quads are sorted wrong - // b) mixed materials are sorted wrong - // c) more than 65k faces are sorted wrong - // d) intersecting objects are sorted wrong - // e) intersecting polygons are sorted wrong - // - // a) can be solved by making all faces either triangles or quads - // if they need to be z-sorted. c) could be solved by allowing - // larger buckets, b) and d) cannot be solved easily if we want - // to avoid excessive state changes while drawing. e) would - // require splitting polygons. - - RAS_MeshSlot::iterator it; - size_t j; - - for(ms.begin(it); !ms.end(it); ms.next(it)) { - unsigned int nvert = (int)it.array->m_type; - unsigned int totpoly = it.totindex/nvert; - - if(totpoly <= 1) - continue; - if(it.array->m_type == RAS_DisplayArray::LINE) - continue; - - // Extract camera Z plane... - const MT_Vector3 pnorm(transform.getBasis()[2]); - // unneeded: const MT_Scalar pval = transform.getOrigin()[2]; - - vector slots(totpoly); - - /* get indices and z into temporary array */ - for(j=0; jdefbase.first; curdef; curdef=(bDeformGroup*)curdef->next, index++) - if (!strcmp(curdef->name, vgroup)) - return index; - - return -1; -} - -void RAS_MeshObject::CheckWeightCache(Object* obj) -{ - KeyBlock *kb; - int kbindex, defindex; - MDeformVert *dvert= NULL; - int totvert, i, j; - float *weights; - - if (!m_mesh->key) - return; - - for(kbindex=0, kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next, kbindex++) - { - // first check the cases where the weight must be cleared - if (kb->vgroup[0] == 0 || - m_mesh->dvert == NULL || - (defindex = get_def_index(obj, kb->vgroup)) == -1) { - if (kb->weights) { - MEM_freeN(kb->weights); - kb->weights = NULL; - } - m_cacheWeightIndex[kbindex] = -1; - } else if (m_cacheWeightIndex[kbindex] != defindex) { - // a weight array is required but the cache is not matching - if (kb->weights) { - MEM_freeN(kb->weights); - kb->weights = NULL; - } - - dvert= m_mesh->dvert; - totvert= m_mesh->totvert; - - weights= (float*)MEM_callocN(totvert*sizeof(float), "weights"); - - for (i=0; i < totvert; i++, dvert++) { - for(j=0; jtotweight; j++) { - if (dvert->dw[j].def_nr == defindex) { - weights[i]= dvert->dw[j].weight; - break; - } - } - } - kb->weights = weights; - m_cacheWeightIndex[kbindex] = defindex; - } - } -} - - diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.h b/source/gameengine/Rasterizer/RAS_MeshObject.h deleted file mode 100644 index 87314a104d1..00000000000 --- a/source/gameengine/Rasterizer/RAS_MeshObject.h +++ /dev/null @@ -1,180 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_MESHOBJECT -#define __RAS_MESHOBJECT - -#ifdef WIN32 -// disable the STL warnings ("debug information length > 255") -#pragma warning (disable:4786) -#endif - -#include -#include -#include - -#include "RAS_Polygon.h" -#include "RAS_MaterialBucket.h" -#include "MT_Transform.h" - -#include "GEN_HashedPtr.h" - -struct Mesh; -class RAS_Deformer; - -/* RAS_MeshObject is a mesh used for rendering. It stores polygons, - * but the actual vertices and index arrays are stored in material - * buckets, referenced by the list of RAS_MeshMaterials. */ - -class RAS_MeshObject -{ -private: - unsigned int m_debugcolor; - - bool m_bModified; - bool m_bMeshModified; - - STR_String m_name; - static STR_String s_emptyname; - - vector m_Polygons; - - /* polygon sorting */ - struct polygonSlot; - struct backtofront; - struct fronttoback; - -protected: - vector m_cacheWeightIndex; - list m_materials; - Mesh* m_mesh; - -public: - // for now, meshes need to be in a certain layer (to avoid sorting on lights in realtime) - RAS_MeshObject(Mesh* mesh); - virtual ~RAS_MeshObject(); - - - // for shape keys, - void CheckWeightCache(struct Object* obj); - - /* materials */ - int NumMaterials(); - const STR_String& GetMaterialName(unsigned int matid); - const STR_String& GetTextureName(unsigned int matid); - - RAS_MeshMaterial* GetMeshMaterial(unsigned int matid); - RAS_MeshMaterial* GetMeshMaterial(RAS_IPolyMaterial *mat); - int GetMaterialId(RAS_IPolyMaterial *mat); - - list::iterator GetFirstMaterial(); - list::iterator GetLastMaterial(); - - //unsigned int GetLightLayer(); - - /* name */ - void SetName(const char *name); - STR_String& GetName(); - - /* modification state */ - bool MeshModified(); - void SetMeshModified(bool v){m_bMeshModified = v;} - - /* original blender mesh */ - Mesh* GetMesh() { return m_mesh; } - - /* mesh construction */ - - virtual RAS_Polygon* AddPolygon(RAS_MaterialBucket *bucket, int numverts); - virtual void AddVertex(RAS_Polygon *poly, int i, - const MT_Point3& xyz, - const MT_Point2& uv, - const MT_Point2& uv2, - const MT_Vector4& tangent, - const unsigned int rgbacolor, - const MT_Vector3& normal, - bool flat, - int origindex); - - void SchedulePolygons(int drawingmode); - - /* vertex and polygon acces */ - int NumVertices(RAS_IPolyMaterial* mat); - RAS_TexVert* GetVertex(unsigned int matid, unsigned int index); - const float* GetVertexLocation(unsigned int orig_index); - - int NumPolygons(); - RAS_Polygon* GetPolygon(int num) const; - - /* buckets */ - virtual void AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer* deformer); - - void RemoveFromBuckets(void *clientobj); - void EndConversion() { -#if 0 - m_sharedvertex_map.clear(); // SharedVertex - vector > shared_null(0); - shared_null.swap( m_sharedvertex_map ); /* really free the memory */ -#endif - } - - /* colors */ - void DebugColor(unsigned int abgr); - void SetVertexColor(RAS_IPolyMaterial* mat,MT_Vector4 rgba); - - /* polygon sorting by Z for alpha */ - void SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transform); - - - bool HasColliderPolygon() { - int numpolys= NumPolygons(); - for (int p=0; pIsCollider()) - return true; - - return false; - } - - /* for construction to find shared vertices */ - struct SharedVertex { - RAS_DisplayArray *m_darray; - int m_offset; - }; - - vector > m_sharedvertex_map; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_MeshObject"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__RAS_MESHOBJECT - diff --git a/source/gameengine/Rasterizer/RAS_ObjectColor.h b/source/gameengine/Rasterizer/RAS_ObjectColor.h deleted file mode 100644 index e4bca39ff3a..00000000000 --- a/source/gameengine/Rasterizer/RAS_ObjectColor.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_OBJECTCOLOR_H -#define __RAS_OBJECTCOLOR_H - -struct RAS_ObjectColor { - float m_red; - float m_green; - float m_blue; -}; - -#endif //__RAS_OBJECTCOLOR_H - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h deleted file mode 100644 index ff92a912ec1..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_BLUR2DFILTER -#define __RAS_BLUR2DFILTER - -const char * BlurFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; -uniform vec2 bgl_TextureCoordinateOffset[9]; - -void main(void) -{ - vec4 sample[9]; - - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - } - - gl_FragColor = (sample[0] + (2.0*sample[1]) + sample[2] + - (2.0*sample[3]) + sample[4] + (2.0*sample[5]) + - sample[6] + (2.0*sample[7]) + sample[8]) / 13.0; -} -); -#endif - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h deleted file mode 100644 index 87335761729..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_DILATION2DFILTER -#define __RAS_DILATION2DFILTER - -const char * DilationFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; -uniform vec2 bgl_TextureCoordinateOffset[9]; - -void main(void) -{ - vec4 sample[9]; - vec4 maxValue = vec4(0.0); - - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - maxValue = max(sample[i], maxValue); - } - - gl_FragColor = maxValue; -} -); -#endif - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h deleted file mode 100644 index 476f5820158..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_EROSION2DFILTER -#define __RAS_EROSION2DFILTER - -const char * ErosionFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; -uniform vec2 bgl_TextureCoordinateOffset[9]; - -void main(void) -{ - vec4 sample[9]; - vec4 minValue = vec4(1.0); - - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - minValue = min(sample[i], minValue); - } - - gl_FragColor = minValue; -} -); -#endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h deleted file mode 100644 index 914151944a5..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_GRAYSCALE2DFILTER -#define __RAS_GRAYSCALE2DFILTER - -const char * GrayScaleFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; - -void main(void) -{ - vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st); - float gray = dot(texcolor.rgb, vec3(0.299, 0.587, 0.114)); - gl_FragColor = vec4(gray, gray, gray, texcolor.a); -} -); -#endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h deleted file mode 100644 index afab58d4048..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_INVERT2DFILTER -#define __RAS_INVERT2DFILTER - -const char * InvertFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; - -void main(void) -{ - vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st); - gl_FragColor.rgb = 1.0 - texcolor.rgb; - gl_FragColor.a = texcolor.a; -} -); -#endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h deleted file mode 100644 index 51a835706bf..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_LAPLACION2DFILTER -#define __RAS_LAPLACION2DFILTER - -const char * LaplacionFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; -uniform vec2 bgl_TextureCoordinateOffset[9]; - -void main(void) -{ - vec4 sample[9]; - - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - } - - gl_FragColor = (sample[4] * 8.0) - - (sample[0] + sample[1] + sample[2] + - sample[3] + sample[5] + - sample[6] + sample[7] + sample[8]); - gl_FragColor = vec4(gl_FragColor.rgb, 1.0); -} -); -#endif - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h deleted file mode 100644 index 62842d5f0a8..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_PREWITT2DFILTER -#define __RAS_PREWITT2DFILTER - -const char * PrewittFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; -uniform vec2 bgl_TextureCoordinateOffset[9]; - -void main(void) -{ - vec4 sample[9]; - - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - } - - vec4 horizEdge = sample[2] + sample[5] + sample[8] - - (sample[0] + sample[3] + sample[6]); - - vec4 vertEdge = sample[0] + sample[1] + sample[2] - - (sample[6] + sample[7] + sample[8]); - - gl_FragColor.rgb = sqrt((horizEdge.rgb * horizEdge.rgb) + - (vertEdge.rgb * vertEdge.rgb)); - gl_FragColor.a = 1.0; -} - -); -#endif - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h deleted file mode 100644 index 296b54242bf..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_SEPIA2DFILTER -#define __RAS_SEPIA2DFILTER - -const char * SepiaFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; - -void main(void) -{ - vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st); - float gray = dot(texcolor.rgb, vec3(0.299, 0.587, 0.114)); - gl_FragColor = vec4(gray * vec3(1.2, 1.0, 0.8), texcolor.a); -} -); -#endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h deleted file mode 100644 index 6b9cc74f424..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_SHARPEN2DFILTER -#define __RAS_SHARPEN2DFILTER - -const char * SharpenFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; -uniform vec2 bgl_TextureCoordinateOffset[9]; - -void main(void) -{ - vec4 sample[9]; - - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - } - - gl_FragColor = (sample[4] * 9.0) - - (sample[0] + sample[1] + sample[2] + - sample[3] + sample[5] + - sample[6] + sample[7] + sample[8]); -} -); -#endif - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h deleted file mode 100644 index f8efe469bfc..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_SOBEL2DFILTER -#define __RAS_SOBEL2DFILTER - -const char * SobelFragmentShader=STRINGIFY( -uniform sampler2D bgl_RenderedTexture; -uniform vec2 bgl_TextureCoordinateOffset[9]; - -void main(void) -{ - vec4 sample[9]; - - for (int i = 0; i < 9; i++) - { - sample[i] = texture2D(bgl_RenderedTexture, - gl_TexCoord[0].st + bgl_TextureCoordinateOffset[i]); - } - - vec4 horizEdge = sample[2] + (2.0*sample[5]) + sample[8] - - (sample[0] + (2.0*sample[3]) + sample[6]); - - vec4 vertEdge = sample[0] + (2.0*sample[1]) + sample[2] - - (sample[6] + (2.0*sample[7]) + sample[8]); - - gl_FragColor.rgb = sqrt((horizEdge.rgb * horizEdge.rgb) + - (vertEdge.rgb * vertEdge.rgb)); - gl_FragColor.a = 1.0; -} -); -#endif - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt deleted file mode 100644 index 5d6f61ebfa1..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -FILE(GLOB SRC *.cpp) - -SET(INC - ../../../../source/kernel/gen_system - ../../../../intern/string - ../../../../intern/moto/include - ../../../../source/gameengine/Rasterizer - ../../../../source/gameengine/Ketsji - ../../../../source/gameengine/SceneGraph - ../../../../extern/glew/include - ../../../../source/blender/gpu - ../../../../source/blender/makesdna - ../../../../source/blender/blenkernel - ../../../../source/blender/blenlib - ../../../../source/blender/blenloader -) - -ADD_DEFINITIONS(-DGLEW_STATIC) - -BLENDERLIB(bf_oglrasterizer "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_oglrasterizer', Split(sources), Split(incs), [], libtype=['game','player'], priority=[40, 120] ) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile deleted file mode 100644 index 0327714dc5f..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# Bounce make to subdirectories. -# - -LIBNAME = OpenGLrasterizer -DIR = $(OCGDIR)/gameengine/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_GLEW)/include -CPPFLAGS += -I$(OPENGL_HEADERS) -CPPFLAGS += -I$(NAN_STRING)/include -CPPFLAGS += -I$(NAN_MOTO)/include -CPPFLAGS += -I../../../kernel/gen_system -CPPFLAGS += -I../../../blender/gpu -CPPFLAGS += -I../../../blender/makesdna -CPPFLAGS += -I../../../blender/blenlib -CPPFLAGS += -I../../../blender/blenkernel -CPPFLAGS += -I../../BlenderRoutines -CPPFLAGS += -I../../Ketsji -CPPFLAGS += -I../../SceneGraph -CPPFLAGS += -I.. -CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include - -ifeq ($(OS),darwin) - CPPFLAGS += -fpascal-strings -endif - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp deleted file mode 100644 index e29cd185be3..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include - -#include "RAS_GLExtensionManager.h" - -namespace bgl -{ - void InitExtensions(bool debug) - { - static bool firsttime = true; - - if(firsttime) { - firsttime = false; - - if(debug) { - if(GLEW_ATI_pn_triangles) - std::cout << "Enabled GL_ATI_pn_triangles" << std::endl; - if(GLEW_ARB_texture_env_combine) - std::cout << "Detected GL_ARB_texture_env_combine" << std::endl; - if(GLEW_ARB_texture_cube_map) - std::cout << "Detected GL_ARB_texture_cube_map" << std::endl; - if(GLEW_ARB_multitexture) - std::cout << "Detected GL_ARB_multitexture" << std::endl; - if(GLEW_ARB_shader_objects) - std::cout << "Detected GL_ARB_shader_objects" << std::endl; - if(GLEW_ARB_vertex_shader) - std::cout << "Detected GL_ARB_vertex_shader" << std::endl; - if(GLEW_ARB_fragment_shader) - std::cout << "Detected GL_ARB_fragment_shader" << std::endl; - if(GLEW_ARB_vertex_program) - std::cout << "Detected GL_ARB_vertex_program" << std::endl; - if(GLEW_ARB_depth_texture) - std::cout << "Detected GL_ARB_depth_texture" << std::endl; - if(GLEW_EXT_separate_specular_color) - std::cout << "Detected GL_EXT_separate_specular_color" << std::endl; - } - } - } -} // namespace bgl - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h deleted file mode 100644 index 2f5d90d4bb5..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __RAS_GLEXTENSIONMANAGER_H__ -#define __RAS_GLEXTENSIONMANAGER_H__ - -#include "GL/glew.h" - -/* Note: this used to have a lot more code, but now extension handling - * is done by GLEW, so it does mostly debug stuff */ - -namespace bgl -{ - void InitExtensions(bool debug); -} /* namespace bgl */ - -#endif /* __RAS_GLEXTENSIONMANAGER_H__ */ diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp deleted file mode 100644 index 12a255b4e4e..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp +++ /dev/null @@ -1,308 +0,0 @@ -// -#include - -#include "RAS_ListRasterizer.h" - -#ifdef WIN32 -#include -#endif // WIN32 - -#include "GL/glew.h" - -#include "RAS_MaterialBucket.h" -#include "RAS_TexVert.h" -#include "MT_assert.h" - -//#ifndef NDEBUG -//#ifdef WIN32 -//#define spit(x) std::cout << x << std::endl; -//#endif //WIN32 -//#else -#define spit(x) -//#endif - -RAS_ListSlot::RAS_ListSlot(RAS_ListRasterizer* rasty) -: KX_ListSlot(), - m_list(0), - m_flag(LIST_MODIFY|LIST_CREATE), - m_matnr(0), - m_rasty(rasty) -{ -} - -int RAS_ListSlot::Release() -{ - if (--m_refcount > 0) - return m_refcount; - m_rasty->RemoveListSlot(this); - delete this; - return 0; -} - -RAS_ListSlot::~RAS_ListSlot() -{ - RemoveList(); -} - - -void RAS_ListSlot::RemoveList() -{ - if(m_list != 0) { - spit("Releasing display list (" << m_list << ")"); - glDeleteLists((GLuint)m_list, 1); - m_list =0; - } -} - -void RAS_ListSlot::DrawList() -{ - if(m_flag &LIST_STREAM || m_flag& LIST_NOCREATE) { - RemoveList(); - return; - } - if(m_flag &LIST_MODIFY) { - if(m_flag &LIST_CREATE) { - if(m_list == 0) { - m_list = (unsigned int)glGenLists(1); - m_flag = m_flag &~ LIST_CREATE; - spit("Created display list (" << m_list << ")"); - } - } - if(m_list != 0) - glNewList((GLuint)m_list, GL_COMPILE); - - m_flag |= LIST_BEGIN; - return; - } - glCallList(m_list); -} - -void RAS_ListSlot::EndList() -{ - if(m_flag & LIST_BEGIN) { - glEndList(); - m_flag = m_flag &~(LIST_BEGIN|LIST_MODIFY); - m_flag |= LIST_END; - glCallList(m_list); - } -} - -void RAS_ListSlot::SetModified(bool mod) -{ - if(mod && !(m_flag & LIST_MODIFY)) { - spit("Modifying list (" << m_list << ")"); - m_flag = m_flag &~ LIST_END; - m_flag |= LIST_STREAM; - } -} - -bool RAS_ListSlot::End() -{ - return (m_flag &LIST_END)!=0; -} - - - -RAS_ListRasterizer::RAS_ListRasterizer(RAS_ICanvas* canvas, bool useVertexArrays, bool lock) -: RAS_VAOpenGLRasterizer(canvas, lock), - mUseVertexArrays(useVertexArrays), - mATI(false) -{ - if (!strcmp((const char*)glGetString(GL_VENDOR), "ATI Technologies Inc.")) - mATI = true; -} - -RAS_ListRasterizer::~RAS_ListRasterizer() -{ - ReleaseAlloc(); -} - -void RAS_ListRasterizer::RemoveListSlot(RAS_ListSlot* list) -{ - if (list->m_flag & LIST_DERIVEDMESH) { - RAS_DerivedMeshLists::iterator it = mDerivedMeshLists.begin(); - while(it != mDerivedMeshLists.end()) { - RAS_ListSlots *slots = it->second; - if (slots->size() > list->m_matnr && slots->at(list->m_matnr) == list) { - (*slots)[list->m_matnr] = NULL; - // check if all slots are NULL and if yes, delete the entry - int i; - for (i=slots->size(); i-- > 0; ) { - if (slots->at(i) != NULL) - break; - } - if (i < 0) { - slots->clear(); - delete slots; - mDerivedMeshLists.erase(it); - } - break; - } - ++it; - } - } else { - RAS_ArrayLists::iterator it = mArrayLists.begin(); - while(it != mArrayLists.end()) { - if (it->second == list) { - mArrayLists.erase(it); - break; - } - it++; - } - } -} - -RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms) -{ - /* - Keep a copy of constant lists submitted for rendering, - this guards against (replicated)new...delete every frame, - and we can reuse lists! - :: sorted by mesh slot - */ - RAS_ListSlot* localSlot = (RAS_ListSlot*)ms.m_DisplayList; - if(!localSlot) { - if (ms.m_pDerivedMesh) { - // that means that we draw based on derived mesh, a display list is possible - // Note that we come here only for static derived mesh - int matnr = ms.m_bucket->GetPolyMaterial()->GetMaterialIndex(); - RAS_ListSlot* nullSlot = NULL; - RAS_ListSlots *listVector; - RAS_DerivedMeshLists::iterator it = mDerivedMeshLists.find(ms.m_pDerivedMesh); - if(it == mDerivedMeshLists.end()) { - listVector = new RAS_ListSlots(matnr+4, nullSlot); - localSlot = new RAS_ListSlot(this); - localSlot->m_flag |= LIST_DERIVEDMESH; - localSlot->m_matnr = matnr; - listVector->at(matnr) = localSlot; - mDerivedMeshLists.insert(std::pair(ms.m_pDerivedMesh, listVector)); - } else { - listVector = it->second; - if (listVector->size() <= matnr) - listVector->resize(matnr+4, nullSlot); - if ((localSlot = listVector->at(matnr)) == NULL) { - localSlot = new RAS_ListSlot(this); - localSlot->m_flag |= LIST_DERIVEDMESH; - localSlot->m_matnr = matnr; - listVector->at(matnr) = localSlot; - } else { - localSlot->AddRef(); - } - } - } else { - RAS_ArrayLists::iterator it = mArrayLists.find(ms.m_displayArrays); - if(it == mArrayLists.end()) { - localSlot = new RAS_ListSlot(this); - mArrayLists.insert(std::pair(ms.m_displayArrays, localSlot)); - } else { - localSlot = static_cast(it->second->AddRef()); - } - } - } - MT_assert(localSlot); - return localSlot; -} - -void RAS_ListRasterizer::ReleaseAlloc() -{ - for(RAS_ArrayLists::iterator it = mArrayLists.begin();it != mArrayLists.end();++it) - delete it->second; - mArrayLists.clear(); - for (RAS_DerivedMeshLists::iterator it = mDerivedMeshLists.begin();it != mDerivedMeshLists.end();++it) { - RAS_ListSlots* slots = it->second; - for (int i=slots->size(); i-- > 0; ) { - RAS_ListSlot* slot = slots->at(i); - if (slot) - delete slot; - } - slots->clear(); - delete slots; - } - mDerivedMeshLists.clear(); -} - -void RAS_ListRasterizer::IndexPrimitives(RAS_MeshSlot& ms) -{ - RAS_ListSlot* localSlot =0; - - if(ms.m_bDisplayList) { - localSlot = FindOrAdd(ms); - localSlot->DrawList(); - if(localSlot->End()) { - // save slot here too, needed for replicas and object using same mesh - // => they have the same vertexarray but different mesh slot - ms.m_DisplayList = localSlot; - return; - } - } - // derived mesh cannot use vertex array - if (mUseVertexArrays && !ms.m_pDerivedMesh) - RAS_VAOpenGLRasterizer::IndexPrimitives(ms); - else - RAS_OpenGLRasterizer::IndexPrimitives(ms); - - if(ms.m_bDisplayList) { - localSlot->EndList(); - ms.m_DisplayList = localSlot; - } -} - - -void RAS_ListRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms) -{ - RAS_ListSlot* localSlot =0; - - if(ms.m_bDisplayList) { - localSlot = FindOrAdd(ms); - localSlot->DrawList(); - - if(localSlot->End()) { - // save slot here too, needed for replicas and object using same mesh - // => they have the same vertexarray but different mesh slot - ms.m_DisplayList = localSlot; - return; - } - } - - // workaround: note how we do not use vertex arrays for making display - // lists, since glVertexAttribPointerARB doesn't seem to work correct - // in display lists on ATI? either a bug in the driver or in Blender .. - if (mUseVertexArrays && !mATI && !ms.m_pDerivedMesh) - RAS_VAOpenGLRasterizer::IndexPrimitivesMulti(ms); - else - RAS_OpenGLRasterizer::IndexPrimitivesMulti(ms); - - if(ms.m_bDisplayList) { - localSlot->EndList(); - ms.m_DisplayList = localSlot; - } -} - -bool RAS_ListRasterizer::Init(void) -{ - if (mUseVertexArrays) { - return RAS_VAOpenGLRasterizer::Init(); - } else { - return RAS_OpenGLRasterizer::Init(); - } -} - -void RAS_ListRasterizer::SetDrawingMode(int drawingmode) -{ - if (mUseVertexArrays) { - RAS_VAOpenGLRasterizer::SetDrawingMode(drawingmode); - } else { - RAS_OpenGLRasterizer::SetDrawingMode(drawingmode); - } -} - -void RAS_ListRasterizer::Exit() -{ - if (mUseVertexArrays) { - RAS_VAOpenGLRasterizer::Exit(); - } else { - RAS_OpenGLRasterizer::Exit(); - } -} - -// eof diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h deleted file mode 100644 index d3c14b4758c..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef __RAS_LISTRASTERIZER_H__ -#define __RAS_LISTRASTERIZER_H__ - -#include "RAS_MaterialBucket.h" -#include "RAS_VAOpenGLRasterizer.h" -#include -#include - -class RAS_ListRasterizer; -class RAS_ListSlot : public KX_ListSlot -{ - friend class RAS_ListRasterizer; - unsigned int m_list; - unsigned int m_flag; - unsigned int m_matnr; - RAS_ListRasterizer* m_rasty; -public: - RAS_ListSlot(RAS_ListRasterizer* rasty); - virtual ~RAS_ListSlot(); - virtual void SetModified(bool mod); - virtual int Release(); - - void RemoveList(); - void DrawList(); - void EndList(); - bool End(); - -}; - -enum RAS_ListSlotFlags { - LIST_CREATE =1, - LIST_MODIFY =2, - LIST_STREAM =4, - LIST_NOCREATE =8, - LIST_BEGIN =16, - LIST_END =32, - LIST_REGEN =64, - LIST_DERIVEDMESH=128, -}; - -struct DerivedMesh; - -typedef std::map RAS_ArrayLists; -typedef std::vector RAS_ListSlots; // indexed by material slot number -typedef std::map RAS_DerivedMeshLists; - -class RAS_ListRasterizer : public RAS_VAOpenGLRasterizer -{ - bool mUseVertexArrays; - bool mATI; - RAS_ArrayLists mArrayLists; - RAS_DerivedMeshLists mDerivedMeshLists; - - RAS_ListSlot* FindOrAdd(class RAS_MeshSlot& ms); - void ReleaseAlloc(); - -public: - void RemoveListSlot(RAS_ListSlot* list); - RAS_ListRasterizer(RAS_ICanvas* canvas, bool useVertexArrays=false, bool lock=false); - virtual ~RAS_ListRasterizer(); - - virtual void IndexPrimitives(class RAS_MeshSlot& ms); - virtual void IndexPrimitivesMulti(class RAS_MeshSlot& ms); - - virtual bool Init(); - virtual void Exit(); - - virtual void SetDrawingMode(int drawingmode); - - virtual bool QueryLists(){return true;} - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_ListRasterizer"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp deleted file mode 100644 index 122a738e4f3..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ /dev/null @@ -1,1155 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include -#include - -#include "RAS_OpenGLRasterizer.h" - -#include "GL/glew.h" - -#include "RAS_Rect.h" -#include "RAS_TexVert.h" -#include "RAS_MeshObject.h" -#include "MT_CmMatrix4x4.h" -#include "RAS_IRenderTools.h" // rendering text - -#include "GPU_draw.h" -#include "GPU_material.h" -#include "GPU_extensions.h" - -#include "DNA_image_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_material_types.h" -#include "DNA_scene_types.h" - -#include "BKE_DerivedMesh.h" - -/** - * 32x32 bit masks for vinterlace stereo mode - */ -static GLuint left_eye_vinterlace_mask[32]; -static GLuint right_eye_vinterlace_mask[32]; - -/** - * 32x32 bit masks for hinterlace stereo mode. - * Left eye = &hinterlace_mask[0] - * Right eye = &hinterlace_mask[1] - */ -static GLuint hinterlace_mask[33]; - -RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas) - :RAS_IRasterizer(canvas), - m_2DCanvas(canvas), - m_fogenabled(false), - m_time(0.0), - m_campos(0.0f, 0.0f, 0.0f), - m_camortho(false), - m_stereomode(RAS_STEREO_NOSTEREO), - m_curreye(RAS_STEREO_LEFTEYE), - m_eyeseparation(0.0), - m_focallength(0.0), - m_setfocallength(false), - m_noOfScanlines(32), - m_motionblur(0), - m_motionblurvalue(-1.0), - m_texco_num(0), - m_attrib_num(0), - //m_last_blendmode(GPU_BLEND_SOLID), - m_last_frontface(true), - m_materialCachingInfo(0) -{ - m_viewmatrix.setIdentity(); - m_viewinvmatrix.setIdentity(); - - for (int i = 0; i < 32; i++) - { - left_eye_vinterlace_mask[i] = 0x55555555; - right_eye_vinterlace_mask[i] = 0xAAAAAAAA; - hinterlace_mask[i] = (i&1)*0xFFFFFFFF; - } - hinterlace_mask[32] = 0; -} - - - -RAS_OpenGLRasterizer::~RAS_OpenGLRasterizer() -{ -} - -bool RAS_OpenGLRasterizer::Init() -{ - GPU_state_init(); - - - m_ambr = 0.0f; - m_ambg = 0.0f; - m_ambb = 0.0f; - - glDisable(GL_BLEND); - glDisable(GL_ALPHA_TEST); - //m_last_blendmode = GPU_BLEND_SOLID; - GPU_set_material_blend_mode(GPU_BLEND_SOLID); - - glFrontFace(GL_CCW); - m_last_frontface = true; - - glClearColor(m_redback,m_greenback,m_blueback,m_alphaback); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - - m_redback = 0.4375; - m_greenback = 0.4375; - m_blueback = 0.4375; - m_alphaback = 0.0; - - glShadeModel(GL_SMOOTH); - - return true; -} - - -void RAS_OpenGLRasterizer::SetAmbientColor(float red, float green, float blue) -{ - m_ambr = red; - m_ambg = green; - m_ambb = blue; -} - - -void RAS_OpenGLRasterizer::SetAmbient(float factor) -{ - float ambient[] = { m_ambr*factor, m_ambg*factor, m_ambb*factor, 1.0f }; - glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); -} - - -void RAS_OpenGLRasterizer::SetBackColor(float red, - float green, - float blue, - float alpha) -{ - m_redback = red; - m_greenback = green; - m_blueback = blue; - m_alphaback = alpha; -} - - - -void RAS_OpenGLRasterizer::SetFogColor(float r, - float g, - float b) -{ - m_fogr = r; - m_fogg = g; - m_fogb = b; - m_fogenabled = true; -} - - - -void RAS_OpenGLRasterizer::SetFogStart(float start) -{ - m_fogstart = start; - m_fogenabled = true; -} - - - -void RAS_OpenGLRasterizer::SetFogEnd(float fogend) -{ - m_fogdist = fogend; - m_fogenabled = true; -} - - - -void RAS_OpenGLRasterizer::SetFog(float start, - float dist, - float r, - float g, - float b) -{ - m_fogstart = start; - m_fogdist = dist; - m_fogr = r; - m_fogg = g; - m_fogb = b; - m_fogenabled = true; -} - - - -void RAS_OpenGLRasterizer::DisableFog() -{ - m_fogenabled = false; -} - -bool RAS_OpenGLRasterizer::IsFogEnabled() -{ - return m_fogenabled; -} - - -void RAS_OpenGLRasterizer::DisplayFog() -{ - if ((m_drawingmode >= KX_SOLID) && m_fogenabled) - { - float params[5]; - glFogi(GL_FOG_MODE, GL_LINEAR); - glFogf(GL_FOG_DENSITY, 0.1f); - glFogf(GL_FOG_START, m_fogstart); - glFogf(GL_FOG_END, m_fogstart + m_fogdist); - params[0]= m_fogr; - params[1]= m_fogg; - params[2]= m_fogb; - params[3]= 0.0; - glFogfv(GL_FOG_COLOR, params); - glEnable(GL_FOG); - } - else - { - glDisable(GL_FOG); - } -} - - - -bool RAS_OpenGLRasterizer::SetMaterial(const RAS_IPolyMaterial& mat) -{ - return mat.Activate(this, m_materialCachingInfo); -} - - - -void RAS_OpenGLRasterizer::Exit() -{ - - glEnable(GL_CULL_FACE); - glEnable(GL_DEPTH_TEST); - glClearDepth(1.0); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glClearColor(m_redback, m_greenback, m_blueback, m_alphaback); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glDepthMask (GL_TRUE); - glDepthFunc(GL_LEQUAL); - glBlendFunc(GL_ONE, GL_ZERO); - - glDisable(GL_POLYGON_STIPPLE); - - glDisable(GL_LIGHTING); - if (GLEW_EXT_separate_specular_color || GLEW_VERSION_1_2) - glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR); - - EndFrame(); -} - -bool RAS_OpenGLRasterizer::BeginFrame(int drawingmode, double time) -{ - m_time = time; - m_drawingmode = drawingmode; - - // Blender camera routine destroys the settings - if (m_drawingmode < KX_SOLID) - { - glDisable (GL_CULL_FACE); - glDisable (GL_DEPTH_TEST); - } - else - { - glEnable(GL_DEPTH_TEST); - glEnable (GL_CULL_FACE); - } - - glDisable(GL_BLEND); - glDisable(GL_ALPHA_TEST); - //m_last_blendmode = GPU_BLEND_SOLID; - GPU_set_material_blend_mode(GPU_BLEND_SOLID); - - glFrontFace(GL_CCW); - m_last_frontface = true; - - glShadeModel(GL_SMOOTH); - - m_2DCanvas->BeginFrame(); - - return true; -} - - - -void RAS_OpenGLRasterizer::SetDrawingMode(int drawingmode) -{ - m_drawingmode = drawingmode; - - if(m_drawingmode == KX_WIREFRAME) - glDisable(GL_CULL_FACE); -} - -int RAS_OpenGLRasterizer::GetDrawingMode() -{ - return m_drawingmode; -} - - -void RAS_OpenGLRasterizer::SetDepthMask(DepthMask depthmask) -{ - glDepthMask(depthmask == KX_DEPTHMASK_DISABLED ? GL_FALSE : GL_TRUE); -} - - -void RAS_OpenGLRasterizer::ClearColorBuffer() -{ - m_2DCanvas->ClearColor(m_redback,m_greenback,m_blueback,m_alphaback); - m_2DCanvas->ClearBuffer(RAS_ICanvas::COLOR_BUFFER); -} - - -void RAS_OpenGLRasterizer::ClearDepthBuffer() -{ - m_2DCanvas->ClearBuffer(RAS_ICanvas::DEPTH_BUFFER); -} - - -void RAS_OpenGLRasterizer::ClearCachingInfo(void) -{ - m_materialCachingInfo = 0; -} - -void RAS_OpenGLRasterizer::FlushDebugLines() -{ - if(!m_debugLines.size()) - return; - - // DrawDebugLines - GLboolean light, tex; - - light= glIsEnabled(GL_LIGHTING); - tex= glIsEnabled(GL_TEXTURE_2D); - - if(light) glDisable(GL_LIGHTING); - if(tex) glDisable(GL_TEXTURE_2D); - - glBegin(GL_LINES); - for (unsigned int i=0;iEndFrame(); -} - -void RAS_OpenGLRasterizer::SetRenderArea() -{ - RAS_Rect area; - // only above/below stereo method needs viewport adjustment - switch (m_stereomode) - { - case RAS_STEREO_ABOVEBELOW: - switch(m_curreye) - { - case RAS_STEREO_LEFTEYE: - // upper half of window - area.SetLeft(0); - area.SetBottom(m_2DCanvas->GetHeight() - - int(m_2DCanvas->GetHeight() - m_noOfScanlines) / 2); - - area.SetRight(int(m_2DCanvas->GetWidth())); - area.SetTop(int(m_2DCanvas->GetHeight())); - m_2DCanvas->SetDisplayArea(&area); - break; - case RAS_STEREO_RIGHTEYE: - // lower half of window - area.SetLeft(0); - area.SetBottom(0); - area.SetRight(int(m_2DCanvas->GetWidth())); - area.SetTop(int(m_2DCanvas->GetHeight() - m_noOfScanlines) / 2); - m_2DCanvas->SetDisplayArea(&area); - break; - } - break; - case RAS_STEREO_SIDEBYSIDE: - switch (m_curreye) - { - case RAS_STEREO_LEFTEYE: - // Left half of window - area.SetLeft(0); - area.SetBottom(0); - area.SetRight(m_2DCanvas->GetWidth()/2); - area.SetTop(m_2DCanvas->GetHeight()); - m_2DCanvas->SetDisplayArea(&area); - break; - case RAS_STEREO_RIGHTEYE: - // Right half of window - area.SetLeft(m_2DCanvas->GetWidth()/2); - area.SetBottom(0); - area.SetRight(m_2DCanvas->GetWidth()); - area.SetTop(m_2DCanvas->GetHeight()); - m_2DCanvas->SetDisplayArea(&area); - break; - } - break; - default: - // every available pixel - area.SetLeft(0); - area.SetBottom(0); - area.SetRight(int(m_2DCanvas->GetWidth())); - area.SetTop(int(m_2DCanvas->GetHeight())); - m_2DCanvas->SetDisplayArea(&area); - break; - } -} - -void RAS_OpenGLRasterizer::SetStereoMode(const StereoMode stereomode) -{ - m_stereomode = stereomode; -} - -RAS_IRasterizer::StereoMode RAS_OpenGLRasterizer::GetStereoMode() -{ - return m_stereomode; -} - -bool RAS_OpenGLRasterizer::Stereo() -{ - if(m_stereomode > RAS_STEREO_NOSTEREO) // > 0 - return true; - else - return false; -} - -bool RAS_OpenGLRasterizer::InterlacedStereo() -{ - return m_stereomode == RAS_STEREO_VINTERLACE || m_stereomode == RAS_STEREO_INTERLACED; -} - -void RAS_OpenGLRasterizer::SetEye(const StereoEye eye) -{ - m_curreye = eye; - switch (m_stereomode) - { - case RAS_STEREO_QUADBUFFERED: - glDrawBuffer(m_curreye == RAS_STEREO_LEFTEYE ? GL_BACK_LEFT : GL_BACK_RIGHT); - break; - case RAS_STEREO_ANAGLYPH: - if (m_curreye == RAS_STEREO_LEFTEYE) - { - glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE); - } else { - //glAccum(GL_LOAD, 1.0); - glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); - ClearDepthBuffer(); - } - break; - case RAS_STEREO_VINTERLACE: - { - glEnable(GL_POLYGON_STIPPLE); - glPolygonStipple((const GLubyte*) ((m_curreye == RAS_STEREO_LEFTEYE) ? left_eye_vinterlace_mask : right_eye_vinterlace_mask)); - if (m_curreye == RAS_STEREO_RIGHTEYE) - ClearDepthBuffer(); - break; - } - case RAS_STEREO_INTERLACED: - { - glEnable(GL_POLYGON_STIPPLE); - glPolygonStipple((const GLubyte*) &hinterlace_mask[m_curreye == RAS_STEREO_LEFTEYE?0:1]); - if (m_curreye == RAS_STEREO_RIGHTEYE) - ClearDepthBuffer(); - break; - } - default: - break; - } -} - -RAS_IRasterizer::StereoEye RAS_OpenGLRasterizer::GetEye() -{ - return m_curreye; -} - - -void RAS_OpenGLRasterizer::SetEyeSeparation(const float eyeseparation) -{ - m_eyeseparation = eyeseparation; -} - -float RAS_OpenGLRasterizer::GetEyeSeparation() -{ - return m_eyeseparation; -} - -void RAS_OpenGLRasterizer::SetFocalLength(const float focallength) -{ - m_focallength = focallength; - m_setfocallength = true; -} - -float RAS_OpenGLRasterizer::GetFocalLength() -{ - return m_focallength; -} - - -void RAS_OpenGLRasterizer::SwapBuffers() -{ - m_2DCanvas->SwapBuffers(); -} - - - -const MT_Matrix4x4& RAS_OpenGLRasterizer::GetViewMatrix() const -{ - return m_viewmatrix; -} - -const MT_Matrix4x4& RAS_OpenGLRasterizer::GetViewInvMatrix() const -{ - return m_viewinvmatrix; -} - -void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms, - class RAS_IPolyMaterial* polymat, - class RAS_IRenderTools* rendertools) -{ - bool obcolor = ms.m_bObjectColor; - MT_Vector4& rgba = ms.m_RGBAcolor; - RAS_MeshSlot::iterator it; - - // handle object color - if (obcolor) { - glDisableClientState(GL_COLOR_ARRAY); - glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]); - } - else - glEnableClientState(GL_COLOR_ARRAY); - - for(ms.begin(it); !ms.end(it); ms.next(it)) { - RAS_TexVert *vertex; - size_t i, j, numvert; - - numvert = it.array->m_type; - - if(it.array->m_type == RAS_DisplayArray::LINE) { - // line drawing, no text - glBegin(GL_LINES); - - for(i=0; igetXYZ()); - - vertex = &it.vertex[it.index[i+1]]; - glVertex3fv(vertex->getXYZ()); - } - - glEnd(); - } - else { - // triangle and quad text drawing - for(i=0; igetXYZ()[0]; - v[j][1] = vertex->getXYZ()[1]; - v[j][2] = vertex->getXYZ()[2]; - } - - // find the right opengl attribute - glattrib = -1; - if(GLEW_ARB_vertex_program) - for(unit=0; unitRenderText(polymat->GetDrawingMode(), polymat, - v[0], v[1], v[2], (numvert == 4)? v[3]: NULL, glattrib); - - ClearCachingInfo(); - } - } - } - - glDisableClientState(GL_COLOR_ARRAY); -} - -void RAS_OpenGLRasterizer::SetTexCoordNum(int num) -{ - m_texco_num = num; - if(m_texco_num > RAS_MAX_TEXCO) - m_texco_num = RAS_MAX_TEXCO; -} - -void RAS_OpenGLRasterizer::SetAttribNum(int num) -{ - m_attrib_num = num; - if(m_attrib_num > RAS_MAX_ATTRIB) - m_attrib_num = RAS_MAX_ATTRIB; -} - -void RAS_OpenGLRasterizer::SetTexCoord(TexCoGen coords, int unit) -{ - // this changes from material to material - if(unit < RAS_MAX_TEXCO) - m_texco[unit] = coords; -} - -void RAS_OpenGLRasterizer::SetAttrib(TexCoGen coords, int unit) -{ - // this changes from material to material - if(unit < RAS_MAX_ATTRIB) - m_attrib[unit] = coords; -} - -void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv) -{ - int unit; - - if(GLEW_ARB_multitexture) { - for(unit=0; unit= 0 && index < current_mesh->NumPolygons()) ? - current_mesh->GetPolygon(index) : NULL; - if (polygon && polygon->GetMaterial() == current_bucket) { - // must handle color. - if (current_wireframe) - return 2; - if (current_ms->m_bObjectColor) { - MT_Vector4& rgba = current_ms->m_RGBAcolor; - glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]); - // don't use mcol - return 2; - } - if (!mcol) { - // we have to set the color from the material - unsigned char rgba[4]; - current_polymat->GetMaterialRGBAColor(rgba); - glColor4ubv((const GLubyte *)rgba); - return 2; - } - return 1; - } - return 0; -} - -void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi) -{ - bool obcolor = ms.m_bObjectColor; - bool wireframe = m_drawingmode <= KX_WIREFRAME; - MT_Vector4& rgba = ms.m_RGBAcolor; - RAS_MeshSlot::iterator it; - - if (ms.m_pDerivedMesh) { - // mesh data is in derived mesh, - current_bucket = ms.m_bucket; - current_polymat = current_bucket->GetPolyMaterial(); - current_ms = &ms; - current_mesh = ms.m_mesh; - current_wireframe = wireframe; - MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); - if (current_polymat->GetFlag() & RAS_BLENDERGLSL) { - // GetMaterialIndex return the original mface material index, - // increment by 1 to match what derived mesh is doing - current_blmat_nr = current_polymat->GetMaterialIndex()+1; - // For GLSL we need to retrieve the GPU material attribute - Material* blmat = current_polymat->GetBlenderMaterial(); - Scene* blscene = current_polymat->GetBlenderScene(); - if (!wireframe && blscene && blmat) - GPU_material_vertex_attributes(GPU_material_from_blender(blscene, blmat), ¤t_gpu_attribs); - else - memset(¤t_gpu_attribs, 0, sizeof(current_gpu_attribs)); - // DM draw can mess up blending mode, restore at the end - int current_blend_mode = GPU_get_material_blend_mode(); - ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM); - GPU_set_material_blend_mode(current_blend_mode); - } else { - ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol); - } - return; - } - // iterate over display arrays, each containing an index + vertex array - for(ms.begin(it); !ms.end(it); ms.next(it)) { - RAS_TexVert *vertex; - size_t i, j, numvert; - - numvert = it.array->m_type; - - if(it.array->m_type == RAS_DisplayArray::LINE) { - // line drawing - glBegin(GL_LINES); - - for(i=0; igetXYZ()); - - vertex = &it.vertex[it.index[i+1]]; - glVertex3fv(vertex->getXYZ()); - } - - glEnd(); - } - else { - // triangle and quad drawing - if(it.array->m_type == RAS_DisplayArray::TRIANGLE) - glBegin(GL_TRIANGLES); - else - glBegin(GL_QUADS); - - for(i=0; igetRGBA())); - - glNormal3fv(vertex->getNormal()); - - if(multi) - TexCoord(*vertex); - else - glTexCoord2fv(vertex->getUV1()); - } - - glVertex3fv(vertex->getXYZ()); - } - } - - glEnd(); - } - } -} - -void RAS_OpenGLRasterizer::SetProjectionMatrix(MT_CmMatrix4x4 &mat) -{ - glMatrixMode(GL_PROJECTION); - double* matrix = &mat(0,0); - glLoadMatrixd(matrix); - - m_camortho= (mat(3, 3) != 0.0f); -} - -void RAS_OpenGLRasterizer::SetProjectionMatrix(const MT_Matrix4x4 & mat) -{ - glMatrixMode(GL_PROJECTION); - double matrix[16]; - /* Get into argument. Looks a bit dodgy, but it's ok. */ - mat.getValue(matrix); - /* Internally, MT_Matrix4x4 uses doubles (MT_Scalar). */ - glLoadMatrixd(matrix); - - m_camortho= (mat[3][3] != 0.0f); -} - -MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( - float left, - float right, - float bottom, - float top, - float frustnear, - float frustfar, - float focallength, - bool -){ - MT_Matrix4x4 result; - double mat[16]; - - // correction for stereo - if(Stereo()) - { - float near_div_focallength; - float offset; - - // if Rasterizer.setFocalLength is not called we use the camera focallength - if (!m_setfocallength) - // if focallength is null we use a value known to be reasonable - m_focallength = (focallength == 0.f) ? m_eyeseparation * 30.0 - : focallength; - - near_div_focallength = frustnear / m_focallength; - offset = 0.5 * m_eyeseparation * near_div_focallength; - switch(m_curreye) - { - case RAS_STEREO_LEFTEYE: - left += offset; - right += offset; - break; - case RAS_STEREO_RIGHTEYE: - left -= offset; - right -= offset; - break; - } - // leave bottom and top untouched - } - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(left, right, bottom, top, frustnear, frustfar); - - glGetDoublev(GL_PROJECTION_MATRIX, mat); - result.setValue(mat); - - return result; -} - -MT_Matrix4x4 RAS_OpenGLRasterizer::GetOrthoMatrix( - float left, - float right, - float bottom, - float top, - float frustnear, - float frustfar -){ - MT_Matrix4x4 result; - double mat[16]; - - // stereo is meaning less for orthographic, disable it - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(left, right, bottom, top, frustnear, frustfar); - - glGetDoublev(GL_PROJECTION_MATRIX, mat); - result.setValue(mat); - - return result; -} - - -// next arguments probably contain redundant info, for later... -void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, - const MT_Matrix3x3 & camOrientMat3x3, - const MT_Point3 & pos, - bool perspective) -{ - m_viewmatrix = mat; - - // correction for stereo - if(Stereo() && perspective) - { - MT_Vector3 unitViewDir(0.0, -1.0, 0.0); // minus y direction, Blender convention - MT_Vector3 unitViewupVec(0.0, 0.0, 1.0); - MT_Vector3 viewDir, viewupVec; - MT_Vector3 eyeline; - - // actual viewDir - viewDir = camOrientMat3x3 * unitViewDir; // this is the moto convention, vector on right hand side - // actual viewup vec - viewupVec = camOrientMat3x3 * unitViewupVec; - - // vector between eyes - eyeline = viewDir.cross(viewupVec); - - switch(m_curreye) - { - case RAS_STEREO_LEFTEYE: - { - // translate to left by half the eye distance - MT_Transform transform; - transform.setIdentity(); - transform.translate(-(eyeline * m_eyeseparation / 2.0)); - m_viewmatrix *= transform; - } - break; - case RAS_STEREO_RIGHTEYE: - { - // translate to right by half the eye distance - MT_Transform transform; - transform.setIdentity(); - transform.translate(eyeline * m_eyeseparation / 2.0); - m_viewmatrix *= transform; - } - break; - } - } - - m_viewinvmatrix = m_viewmatrix; - m_viewinvmatrix.invert(); - - // note: getValue gives back column major as needed by OpenGL - MT_Scalar glviewmat[16]; - m_viewmatrix.getValue(glviewmat); - - glMatrixMode(GL_MODELVIEW); - glLoadMatrixd(glviewmat); - m_campos = pos; -} - - -const MT_Point3& RAS_OpenGLRasterizer::GetCameraPosition() -{ - return m_campos; -} - -bool RAS_OpenGLRasterizer::GetCameraOrtho() -{ - return m_camortho; -} - -void RAS_OpenGLRasterizer::SetCullFace(bool enable) -{ - if (enable) - glEnable(GL_CULL_FACE); - else - glDisable(GL_CULL_FACE); -} - -void RAS_OpenGLRasterizer::SetLines(bool enable) -{ - if (enable) - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - else - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); -} - -void RAS_OpenGLRasterizer::SetSpecularity(float specX, - float specY, - float specZ, - float specval) -{ - GLfloat mat_specular[] = {specX, specY, specZ, specval}; - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular); -} - - - -void RAS_OpenGLRasterizer::SetShinyness(float shiny) -{ - GLfloat mat_shininess[] = { shiny }; - glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess); -} - - - -void RAS_OpenGLRasterizer::SetDiffuse(float difX,float difY,float difZ,float diffuse) -{ - GLfloat mat_diffuse [] = {difX, difY,difZ, diffuse}; - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse); -} - -void RAS_OpenGLRasterizer::SetEmissive(float eX, float eY, float eZ, float e) -{ - GLfloat mat_emit [] = {eX,eY,eZ,e}; - glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, mat_emit); -} - - -double RAS_OpenGLRasterizer::GetTime() -{ - return m_time; -} - -void RAS_OpenGLRasterizer::SetPolygonOffset(float mult, float add) -{ - glPolygonOffset(mult, add); - GLint mode = GL_POLYGON_OFFSET_FILL; - if (m_drawingmode < KX_SHADED) - mode = GL_POLYGON_OFFSET_LINE; - if (mult != 0.0f || add != 0.0f) - glEnable(mode); - else - glDisable(mode); -} - -void RAS_OpenGLRasterizer::EnableMotionBlur(float motionblurvalue) -{ - /* don't just set m_motionblur to 1, but check if it is 0 so - * we don't reset a motion blur that is already enabled */ - if(m_motionblur == 0) - m_motionblur = 1; - m_motionblurvalue = motionblurvalue; -} - -void RAS_OpenGLRasterizer::DisableMotionBlur() -{ - m_motionblur = 0; - m_motionblurvalue = -1.0; -} - -void RAS_OpenGLRasterizer::SetBlendingMode(int blendmode) -{ - GPU_set_material_blend_mode(blendmode); -/* - if(blendmode == m_last_blendmode) - return; - - if(blendmode == GPU_BLEND_SOLID) { - glDisable(GL_BLEND); - glDisable(GL_ALPHA_TEST); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - else if(blendmode == GPU_BLEND_ADD) { - glBlendFunc(GL_ONE, GL_ONE); - glEnable(GL_BLEND); - glDisable(GL_ALPHA_TEST); - } - else if(blendmode == GPU_BLEND_ALPHA) { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GREATER, 0.0f); - } - else if(blendmode == GPU_BLEND_CLIP) { - glDisable(GL_BLEND); - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GREATER, 0.5f); - } - - m_last_blendmode = blendmode; -*/ -} - -void RAS_OpenGLRasterizer::SetFrontFace(bool ccw) -{ - if(m_last_frontface == ccw) - return; - - if(ccw) - glFrontFace(GL_CCW); - else - glFrontFace(GL_CW); - - m_last_frontface = ccw; -} - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h deleted file mode 100644 index 6bbf65f72a4..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ /dev/null @@ -1,302 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_OPENGLRASTERIZER -#define __RAS_OPENGLRASTERIZER - -#ifdef WIN32 -#pragma warning (disable:4786) -#endif - -#include "MT_CmMatrix4x4.h" -#include -using namespace std; - -#include "RAS_IRasterizer.h" -#include "RAS_MaterialBucket.h" -#include "RAS_ICanvas.h" - -#define RAS_MAX_TEXCO 8 // match in BL_Material -#define RAS_MAX_ATTRIB 16 // match in BL_BlenderShader - -struct OglDebugLine -{ - MT_Vector3 m_from; - MT_Vector3 m_to; - MT_Vector3 m_color; -}; - -/** - * 3D rendering device context. - */ -class RAS_OpenGLRasterizer : public RAS_IRasterizer -{ - - RAS_ICanvas* m_2DCanvas; - - // fogging vars - bool m_fogenabled; - float m_fogstart; - float m_fogdist; - float m_fogr; - float m_fogg; - float m_fogb; - - float m_redback; - float m_greenback; - float m_blueback; - float m_alphaback; - - float m_ambr; - float m_ambg; - float m_ambb; - - double m_time; - MT_Matrix4x4 m_viewmatrix; - MT_Matrix4x4 m_viewinvmatrix; - MT_Point3 m_campos; - bool m_camortho; - - StereoMode m_stereomode; - StereoEye m_curreye; - float m_eyeseparation; - float m_focallength; - bool m_setfocallength; - int m_noOfScanlines; - - //motion blur - int m_motionblur; - float m_motionblurvalue; - -protected: - int m_drawingmode; - TexCoGen m_texco[RAS_MAX_TEXCO]; - TexCoGen m_attrib[RAS_MAX_ATTRIB]; - int m_texco_num; - int m_attrib_num; - //int m_last_blendmode; - bool m_last_frontface; - - /** Stores the caching information for the last material activated. */ - RAS_IPolyMaterial::TCachingInfo m_materialCachingInfo; - -public: - double GetTime(); - RAS_OpenGLRasterizer(RAS_ICanvas* canv); - virtual ~RAS_OpenGLRasterizer(); - - /*enum DrawType - { - KX_BOUNDINGBOX = 1, - KX_WIREFRAME, - KX_SOLID, - KX_SHADED, - KX_TEXTURED - }; - - enum DepthMask - { - KX_DEPTHMASK_ENABLED =1, - KX_DEPTHMASK_DISABLED, - };*/ - virtual void SetDepthMask(DepthMask depthmask); - - virtual bool SetMaterial(const RAS_IPolyMaterial& mat); - virtual bool Init(); - virtual void Exit(); - virtual bool BeginFrame(int drawingmode, double time); - virtual void ClearColorBuffer(); - virtual void ClearDepthBuffer(); - virtual void ClearCachingInfo(void); - virtual void EndFrame(); - virtual void SetRenderArea(); - - virtual void SetStereoMode(const StereoMode stereomode); - virtual RAS_IRasterizer::StereoMode GetStereoMode(); - virtual bool Stereo(); - virtual bool InterlacedStereo(); - virtual void SetEye(const StereoEye eye); - virtual StereoEye GetEye(); - virtual void SetEyeSeparation(const float eyeseparation); - virtual float GetEyeSeparation(); - virtual void SetFocalLength(const float focallength); - virtual float GetFocalLength(); - - virtual void SwapBuffers(); - - virtual void IndexPrimitives(class RAS_MeshSlot& ms); - virtual void IndexPrimitivesMulti(class RAS_MeshSlot& ms); - virtual void IndexPrimitives_3DText( - class RAS_MeshSlot& ms, - class RAS_IPolyMaterial* polymat, - class RAS_IRenderTools* rendertools); - - void IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi); - - virtual void SetProjectionMatrix(MT_CmMatrix4x4 & mat); - virtual void SetProjectionMatrix(const MT_Matrix4x4 & mat); - virtual void SetViewMatrix( - const MT_Matrix4x4 & mat, - const MT_Matrix3x3 & ori, - const MT_Point3 & pos, - bool perspective - ); - - virtual const MT_Point3& GetCameraPosition(); - virtual bool GetCameraOrtho(); - - virtual void SetFog( - float start, - float dist, - float r, - float g, - float b - ); - - virtual void SetFogColor( - float r, - float g, - float b - ); - - virtual void SetFogStart(float fogstart); - virtual void SetFogEnd(float fogend); - - void DisableFog(); - virtual void DisplayFog(); - virtual bool IsFogEnabled(); - - virtual void SetBackColor( - float red, - float green, - float blue, - float alpha - ); - - virtual void SetDrawingMode(int drawingmode); - virtual int GetDrawingMode(); - - virtual void SetCullFace(bool enable); - virtual void SetLines(bool enable); - - virtual MT_Matrix4x4 GetFrustumMatrix( - float left, - float right, - float bottom, - float top, - float frustnear, - float frustfar, - float focallength, - bool perspective - ); - - virtual MT_Matrix4x4 GetOrthoMatrix( - float left, - float right, - float bottom, - float top, - float frustnear, - float frustfar - ); - - virtual void SetSpecularity( - float specX, - float specY, - float specZ, - float specval - ); - - virtual void SetShinyness(float shiny); - virtual void SetDiffuse( - float difX, - float difY, - float difZ, - float diffuse - ); - virtual void SetEmissive(float eX, - float eY, - float eZ, - float e - ); - - virtual void SetAmbientColor(float red, float green, float blue); - virtual void SetAmbient(float factor); - - virtual void SetPolygonOffset(float mult, float add); - - virtual void FlushDebugLines(); - - virtual void DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color) - { - OglDebugLine line; - line.m_from = from; - line.m_to = to; - line.m_color = color; - m_debugLines.push_back(line); - } - - std::vector m_debugLines; - - virtual void SetTexCoordNum(int num); - virtual void SetAttribNum(int num); - virtual void SetTexCoord(TexCoGen coords, int unit); - virtual void SetAttrib(TexCoGen coords, int unit); - - void TexCoord(const RAS_TexVert &tv); - - const MT_Matrix4x4& GetViewMatrix() const; - const MT_Matrix4x4& GetViewInvMatrix() const; - - virtual void EnableMotionBlur(float motionblurvalue); - virtual void DisableMotionBlur(); - virtual float GetMotionBlurValue(){return m_motionblurvalue;}; - virtual int GetMotionBlurState(){return m_motionblur;}; - virtual void SetMotionBlurState(int newstate) - { - if(newstate<0) - m_motionblur = 0; - else if(newstate>2) - m_motionblur = 2; - else - m_motionblur = newstate; - }; - - virtual void SetBlendingMode(int blendmode); - virtual void SetFrontFace(bool ccw); - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_OpenGLRasterizer"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__RAS_OPENGLRASTERIZER - - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp deleted file mode 100644 index 087b5d052c3..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "RAS_VAOpenGLRasterizer.h" -#include - -#include "GL/glew.h" -#include "GPU_extensions.h" - -#include "STR_String.h" -#include "RAS_TexVert.h" -#include "MT_CmMatrix4x4.h" -#include "RAS_IRenderTools.h" // rendering text - -RAS_VAOpenGLRasterizer::RAS_VAOpenGLRasterizer(RAS_ICanvas* canvas, bool lock) -: RAS_OpenGLRasterizer(canvas), - m_Lock(lock && GLEW_EXT_compiled_vertex_array), - m_last_texco_num(0), - m_last_attrib_num(0) -{ -} - -RAS_VAOpenGLRasterizer::~RAS_VAOpenGLRasterizer() -{ -} - -bool RAS_VAOpenGLRasterizer::Init(void) -{ - - bool result = RAS_OpenGLRasterizer::Init(); - - if (result) - { - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - } - - return result; -} - -void RAS_VAOpenGLRasterizer::SetDrawingMode(int drawingmode) -{ - m_drawingmode = drawingmode; - - switch (m_drawingmode) - { - case KX_BOUNDINGBOX: - case KX_WIREFRAME: - //glDisableClientState(GL_COLOR_ARRAY); - //glDisable(GL_CULL_FACE); - break; - case KX_SOLID: - //glDisableClientState(GL_COLOR_ARRAY); - break; - case KX_TEXTURED: - case KX_SHADED: - case KX_SHADOW: - //glEnableClientState(GL_COLOR_ARRAY); - default: - break; - } -} - -void RAS_VAOpenGLRasterizer::Exit() -{ - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - - RAS_OpenGLRasterizer::Exit(); -} - -void RAS_VAOpenGLRasterizer::IndexPrimitives(RAS_MeshSlot& ms) -{ - static const GLsizei stride = sizeof(RAS_TexVert); - bool wireframe = m_drawingmode <= KX_WIREFRAME; - RAS_MeshSlot::iterator it; - GLenum drawmode; - - if (ms.m_pDerivedMesh) { - // cannot be handled here, pass to RAS_OpenGLRasterizer - RAS_OpenGLRasterizer::IndexPrimitivesInternal(ms, false); - return; - } - - if(!wireframe) - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - - // use glDrawElements to draw each vertexarray - for(ms.begin(it); !ms.end(it); ms.next(it)) { - if(it.totindex == 0) - continue; - - // drawing mode - if(it.array->m_type == RAS_DisplayArray::TRIANGLE) - drawmode = GL_TRIANGLES; - else if(it.array->m_type == RAS_DisplayArray::QUAD) - drawmode = GL_QUADS; - else - drawmode = GL_LINES; - - // colors - if (drawmode != GL_LINES && !wireframe) { - if (ms.m_bObjectColor) { - const MT_Vector4& rgba = ms.m_RGBAcolor; - - glDisableClientState(GL_COLOR_ARRAY); - glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]); - } - else { - glColor4f(0.0f, 0.0f, 0.0f, 1.0f); - glEnableClientState(GL_COLOR_ARRAY); - } - } - else - glColor4f(0.0f, 0.0f, 0.0f, 1.0f); - - glVertexPointer(3, GL_FLOAT, stride, it.vertex->getXYZ()); - glNormalPointer(GL_FLOAT, stride, it.vertex->getNormal()); - if(!wireframe) { - glTexCoordPointer(2, GL_FLOAT, stride, it.vertex->getUV1()); - if(glIsEnabled(GL_COLOR_ARRAY)) - glColorPointer(4, GL_UNSIGNED_BYTE, stride, it.vertex->getRGBA()); - } - - // here the actual drawing takes places - glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index); - } - - if(!wireframe) { - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - } -} - -void RAS_VAOpenGLRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms) -{ - static const GLsizei stride = sizeof(RAS_TexVert); - bool wireframe = m_drawingmode <= KX_WIREFRAME; - RAS_MeshSlot::iterator it; - GLenum drawmode; - - if (ms.m_pDerivedMesh) { - // cannot be handled here, pass to RAS_OpenGLRasterizer - RAS_OpenGLRasterizer::IndexPrimitivesInternal(ms, true); - return; - } - - if(!wireframe) - EnableTextures(true); - - // use glDrawElements to draw each vertexarray - for(ms.begin(it); !ms.end(it); ms.next(it)) { - if(it.totindex == 0) - continue; - - // drawing mode - if(it.array->m_type == RAS_DisplayArray::TRIANGLE) - drawmode = GL_TRIANGLES; - else if(it.array->m_type == RAS_DisplayArray::QUAD) - drawmode = GL_QUADS; - else - drawmode = GL_LINES; - - // colors - if (drawmode != GL_LINES && !wireframe) { - if (ms.m_bObjectColor) { - const MT_Vector4& rgba = ms.m_RGBAcolor; - - glDisableClientState(GL_COLOR_ARRAY); - glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]); - } - else { - glColor4f(0.0f, 0.0f, 0.0f, 1.0f); - glEnableClientState(GL_COLOR_ARRAY); - } - } - else - glColor4f(0.0f, 0.0f, 0.0f, 1.0f); - - glVertexPointer(3, GL_FLOAT, stride, it.vertex->getXYZ()); - glNormalPointer(GL_FLOAT, stride, it.vertex->getNormal()); - if(!wireframe) { - TexCoordPtr(it.vertex); - if(glIsEnabled(GL_COLOR_ARRAY)) - glColorPointer(4, GL_UNSIGNED_BYTE, stride, it.vertex->getRGBA()); - } - - // here the actual drawing takes places - glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index); - } - - if(!wireframe) { - glDisableClientState(GL_COLOR_ARRAY); - EnableTextures(false); - } -} - -void RAS_VAOpenGLRasterizer::TexCoordPtr(const RAS_TexVert *tv) -{ - /* note: this function must closely match EnableTextures to enable/disable - * the right arrays, otherwise coordinate and attribute pointers from other - * materials can still be used and cause crashes */ - int unit; - - if(GLEW_ARB_multitexture) - { - for(unit=0; unitgetFlag() & RAS_TexVert::SECOND_UV && (int)tv->getUnit() == unit) { - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(RAS_TexVert), tv->getUV2()); - continue; - } - switch(m_texco[unit]) - { - case RAS_TEXCO_ORCO: - case RAS_TEXCO_GLOB: - glTexCoordPointer(3, GL_FLOAT, sizeof(RAS_TexVert),tv->getXYZ()); - break; - case RAS_TEXCO_UV1: - glTexCoordPointer(2, GL_FLOAT, sizeof(RAS_TexVert),tv->getUV1()); - break; - case RAS_TEXCO_NORM: - glTexCoordPointer(3, GL_FLOAT, sizeof(RAS_TexVert),tv->getNormal()); - break; - case RAS_TEXTANGENT: - glTexCoordPointer(4, GL_FLOAT, sizeof(RAS_TexVert),tv->getTangent()); - break; - case RAS_TEXCO_UV2: - glTexCoordPointer(2, GL_FLOAT, sizeof(RAS_TexVert),tv->getUV2()); - break; - default: - break; - } - } - - glClientActiveTextureARB(GL_TEXTURE0_ARB); - } - - if(GLEW_ARB_vertex_program) { - for(unit=0; unitgetXYZ()); - break; - case RAS_TEXCO_UV1: - glVertexAttribPointerARB(unit, 2, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getUV1()); - break; - case RAS_TEXCO_NORM: - glVertexAttribPointerARB(unit, 3, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getNormal()); - break; - case RAS_TEXTANGENT: - glVertexAttribPointerARB(unit, 4, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getTangent()); - break; - case RAS_TEXCO_UV2: - glVertexAttribPointerARB(unit, 2, GL_FLOAT, GL_FALSE, sizeof(RAS_TexVert), tv->getUV2()); - break; - case RAS_TEXCO_VCOL: - glVertexAttribPointerARB(unit, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(RAS_TexVert), tv->getRGBA()); - break; - default: - break; - } - } - } -} - -void RAS_VAOpenGLRasterizer::EnableTextures(bool enable) -{ - TexCoGen *texco, *attrib; - int unit, texco_num, attrib_num; - - /* we cache last texcoords and attribs to ensure we disable the ones that - * were actually last set */ - if(enable) { - texco = m_texco; - texco_num = m_texco_num; - attrib = m_attrib; - attrib_num = m_attrib_num; - - memcpy(m_last_texco, m_texco, sizeof(TexCoGen)*m_texco_num); - m_last_texco_num = m_texco_num; - memcpy(m_last_attrib, m_attrib, sizeof(TexCoGen)*m_attrib_num); - m_last_attrib_num = m_attrib_num; - } - else { - texco = m_last_texco; - texco_num = m_last_texco_num; - attrib = m_last_attrib; - attrib_num = m_last_attrib_num; - } - - if(GLEW_ARB_multitexture) { - for(unit=0; unitm_vertex[m_offset[i]]; -} - -int RAS_Polygon::GetVertexOffset(int i) -{ - return m_offset[i]; -} - -int RAS_Polygon::GetVertexOffsetAbs(RAS_MeshObject *mesh, int i) -{ - /* hack that only works because there can only ever be 2 different - * GetDisplayArray's per mesh. if this uses a different display array to the first - * then its incices are offset. - * if support for edges is added back this would need to be changed. */ - RAS_DisplayArray* darray= mesh->GetPolygon(0)->GetDisplayArray(); - - if(m_darray != darray) - return m_offset[i] + darray->m_vertex.size(); - - return m_offset[i]; -} - -/* -int RAS_Polygon::GetEdgeCode() -{ - return m_edgecode; -} - -void RAS_Polygon::SetEdgeCode(int edgecode) -{ - m_edgecode = edgecode; -}*/ - - -bool RAS_Polygon::IsVisible() -{ - return (m_polyflags & VISIBLE) != 0; -} - -void RAS_Polygon::SetVisible(bool visible) -{ - if(visible) m_polyflags |= VISIBLE; - else m_polyflags &= ~VISIBLE; -} - -bool RAS_Polygon::IsCollider() -{ - return (m_polyflags & COLLIDER) != 0; -} - -void RAS_Polygon::SetCollider(bool visible) -{ - if(visible) m_polyflags |= COLLIDER; - else m_polyflags &= ~COLLIDER; -} - -bool RAS_Polygon::IsTwoside() -{ - return (m_polyflags & TWOSIDE) != 0; -} - -void RAS_Polygon::SetTwoside(bool twoside) -{ - if(twoside) m_polyflags |= TWOSIDE; - else m_polyflags &= ~TWOSIDE; -} - -RAS_MaterialBucket* RAS_Polygon::GetMaterial() -{ - return m_bucket; -} - -RAS_DisplayArray* RAS_Polygon::GetDisplayArray() -{ - return m_darray; -} diff --git a/source/gameengine/Rasterizer/RAS_Polygon.h b/source/gameengine/Rasterizer/RAS_Polygon.h deleted file mode 100644 index 48fa4a206f0..00000000000 --- a/source/gameengine/Rasterizer/RAS_Polygon.h +++ /dev/null @@ -1,102 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_POLYGON -#define __RAS_POLYGON - -#include "RAS_TexVert.h" -#include "RAS_MaterialBucket.h" - -#include -using namespace std; - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -/* polygon flags */ - -class RAS_Polygon -{ - /* location */ - RAS_MaterialBucket* m_bucket; - RAS_DisplayArray* m_darray; - unsigned short m_offset[4]; - unsigned short m_numvert; - - /* flags */ -#if 1 - unsigned short m_polyflags; -#else - unsigned char m_edgecode; - unsigned char m_polyflags; -#endif - -public: - enum { - VISIBLE = 1, - COLLIDER = 2, - TWOSIDE = 4 - }; - - RAS_Polygon(RAS_MaterialBucket* bucket, RAS_DisplayArray* darray, int numvert); - virtual ~RAS_Polygon() {}; - - int VertexCount(); - RAS_TexVert* GetVertex(int i); - - void SetVertexOffset(int i, unsigned short offset); - int GetVertexOffset(int i); - int GetVertexOffsetAbs(RAS_MeshObject *mesh, int i); /* accounts for quad and tri arrays, slower, for python */ - - // each bit is for a visible edge, starting with bit 1 for the first edge, bit 2 for second etc. - // - Not used yet! -/* int GetEdgeCode(); - void SetEdgeCode(int edgecode); */ - - bool IsVisible(); - void SetVisible(bool visible); - - bool IsCollider(); - void SetCollider(bool collider); - - bool IsTwoside(); - void SetTwoside(bool twoside); - - RAS_MaterialBucket* GetMaterial(); - RAS_DisplayArray* GetDisplayArray(); - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_Polygon"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif - diff --git a/source/gameengine/Rasterizer/RAS_Rect.h b/source/gameengine/Rasterizer/RAS_Rect.h deleted file mode 100644 index 828257dcecc..00000000000 --- a/source/gameengine/Rasterizer/RAS_Rect.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef _RAS_RECT -#define _RAS_RECT - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -/** - * @section interface class. - * RAS_Rect just encodes a simple rectangle. - * Should be part of a generic library - */ - -class RAS_Rect -{ -public: // todo: make a decent class, and make private - int m_x1, m_y1; - int m_x2, m_y2; - -public: - RAS_Rect() : m_x1(0), m_y1(0), m_x2(0), m_y2(0) {} - int GetWidth( - ) const { - return m_x2 - m_x1; - } - int GetHeight( - ) const { - return m_y2 - m_y1; - } - int GetLeft( - ) const { - return m_x1; - } - int GetRight( - ) const { - return m_x2; - } - int GetBottom( - ) const { - return m_y1; - } - int GetTop( - ) const { - return m_y2; - } - - void SetLeft( - int x1) - { - m_x1 = x1; - } - void SetBottom( - int y1) - { - m_y1 = y1; - } - void SetRight( - int x2) - { - m_x2 = x2; - } - void SetTop( - int y2) - { - m_y2 = y2; - } - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_Rect"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif // _RAS_RECT - diff --git a/source/gameengine/Rasterizer/RAS_TexMatrix.h b/source/gameengine/Rasterizer/RAS_TexMatrix.h deleted file mode 100644 index ef500a8084b..00000000000 --- a/source/gameengine/Rasterizer/RAS_TexMatrix.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RASTEXMATRIX -#define __RASTEXMATRIX - -#include "MT_Matrix3x3.h" -#include "MT_Point3.h" -#include "MT_Point2.h" -#include "RAS_TexVert.h" - -void RAS_CalcTexMatrix(RAS_TexVert p[3],MT_Point3& origin,MT_Vector3& udir,MT_Vector3& vdir); - -#endif //__RASTEXMATRIX - diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp deleted file mode 100644 index 2d2fd6deddd..00000000000 --- a/source/gameengine/Rasterizer/RAS_TexVert.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "RAS_TexVert.h" -#include "MT_Matrix4x4.h" - -RAS_TexVert::RAS_TexVert(const MT_Point3& xyz, - const MT_Point2& uv, - const MT_Point2& uv2, - const MT_Vector4& tangent, - const unsigned int rgba, - const MT_Vector3& normal, - const bool flat, - const unsigned int origindex) -{ - xyz.getValue(m_localxyz); - uv.getValue(m_uv1); - uv2.getValue(m_uv2); - SetRGBA(rgba); - SetNormal(normal); - tangent.getValue(m_tangent); - m_flag = (flat)? FLAT: 0; - m_origindex = origindex; - m_unit = 2; - m_softBodyIndex = -1; -} - -const MT_Point3& RAS_TexVert::xyz() -{ - g_pt3.setValue(m_localxyz); - return g_pt3; -} - -void RAS_TexVert::SetRGBA(const MT_Vector4& rgba) -{ - unsigned char *colp = (unsigned char*) &m_rgba; - colp[0] = (unsigned char) (rgba[0]*255.0f); - colp[1] = (unsigned char) (rgba[1]*255.0f); - colp[2] = (unsigned char) (rgba[2]*255.0f); - colp[3] = (unsigned char) (rgba[3]*255.0f); -} - - -void RAS_TexVert::SetXYZ(const MT_Point3& xyz) -{ - xyz.getValue(m_localxyz); -} - -void RAS_TexVert::SetXYZ(const float *xyz) -{ - m_localxyz[0]= xyz[0]; m_localxyz[1]= xyz[1]; m_localxyz[2]= xyz[2]; -} - -void RAS_TexVert::SetUV(const MT_Point2& uv) -{ - uv.getValue(m_uv1); -} - -void RAS_TexVert::SetUV2(const MT_Point2& uv) -{ - uv.getValue(m_uv2); -} - - -void RAS_TexVert::SetRGBA(const unsigned int rgba) -{ - m_rgba = rgba; -} - - -void RAS_TexVert::SetFlag(const short flag) -{ - m_flag = flag; -} - -void RAS_TexVert::SetUnit(const unsigned int u) -{ - m_unit = u<=MAX_UNIT?u:MAX_UNIT; -} - -void RAS_TexVert::SetNormal(const MT_Vector3& normal) -{ - normal.getValue(m_normal); -} - -void RAS_TexVert::SetTangent(const MT_Vector3& tangent) -{ - tangent.getValue(m_tangent); -} - - -// compare two vertices, and return TRUE if both are almost identical (they can be shared) -bool RAS_TexVert::closeTo(const RAS_TexVert* other) -{ - return ( - /* m_flag == other->m_flag && */ - /* at the moment the face only stores the smooth/flat setting so dont bother comparing it */ - m_rgba == other->m_rgba && - MT_fuzzyEqual(MT_Vector3(m_normal), MT_Vector3(other->m_normal)) && - MT_fuzzyEqual(MT_Vector3(m_tangent), MT_Vector3(other->m_tangent)) && - MT_fuzzyEqual(MT_Vector2(m_uv1), MT_Vector2(other->m_uv1)) && - MT_fuzzyEqual(MT_Vector2(m_uv2), MT_Vector2(other->m_uv2)) /* && - MT_fuzzyEqual(MT_Vector3(m_localxyz), MT_Vector3(other->m_localxyz))*/) ; - /* dont bother comparing m_localxyz since we know there from the same vert */ -} - -short RAS_TexVert::getFlag() const -{ - return m_flag; -} - - -unsigned int RAS_TexVert::getUnit() const -{ - return m_unit; -} - -void RAS_TexVert::Transform(const MT_Matrix4x4& mat, const MT_Matrix4x4& nmat) -{ - SetXYZ((mat*MT_Vector4(m_localxyz[0], m_localxyz[1], m_localxyz[2], 1.0)).getValue()); - SetNormal((nmat*MT_Vector4(m_normal[0], m_normal[1], m_normal[2], 1.0)).getValue()); - SetTangent((nmat*MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0)).getValue()); -} - diff --git a/source/gameengine/Rasterizer/RAS_TexVert.h b/source/gameengine/Rasterizer/RAS_TexVert.h deleted file mode 100644 index b74cfb47152..00000000000 --- a/source/gameengine/Rasterizer/RAS_TexVert.h +++ /dev/null @@ -1,150 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __RAS_TEXVERT -#define __RAS_TEXVERT - - -#include "MT_Point3.h" -#include "MT_Point2.h" -#include "MT_Transform.h" - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -static MT_Point3 g_pt3; -static MT_Point2 g_pt2; - -class RAS_TexVert -{ - - float m_localxyz[3]; // 3*4 = 12 - float m_uv1[2]; // 2*4 = 8 - float m_uv2[2]; // 2*4 = 8 - unsigned int m_rgba; // 4 - float m_tangent[4]; // 4*4 = 16 - float m_normal[3]; // 3*4 = 12 - short m_flag; // 2 - short m_softBodyIndex; //2 - unsigned int m_unit; // 4 - unsigned int m_origindex; // 4 - //--------- - // 56+6+8+2=72 - // 32 bytes total size, fits nice = 56 = not fit nice. - -public: - enum { - FLAT = 1, - SECOND_UV = 2, - MAX_UNIT = 8 - }; - - short getFlag() const; - unsigned int getUnit() const; - - RAS_TexVert()// :m_xyz(0,0,0),m_uv(0,0),m_rgba(0) - {} - RAS_TexVert(const MT_Point3& xyz, - const MT_Point2& uv, - const MT_Point2& uv2, - const MT_Vector4& tangent, - const unsigned int rgba, - const MT_Vector3& normal, - const bool flat, - const unsigned int origindex); - ~RAS_TexVert() {}; - - const float* getUV1 () const { - return m_uv1; - }; - - const float* getUV2 () const { - return m_uv2; - }; - - const float* getXYZ() const { - return m_localxyz; - }; - - const float* getNormal() const { - return m_normal; - } - - short int getSoftBodyIndex() const - { - return m_softBodyIndex; - } - - void setSoftBodyIndex(short int sbIndex) - { - m_softBodyIndex = sbIndex; - } - - const float* getTangent() const { - return m_tangent; - } - - const unsigned char* getRGBA() const { - return (unsigned char *) &m_rgba; - } - - unsigned int getOrigIndex() const { - return m_origindex; - } - - void SetXYZ(const MT_Point3& xyz); - void SetXYZ(const float *xyz); - void SetUV(const MT_Point2& uv); - void SetUV2(const MT_Point2& uv); - - void SetRGBA(const unsigned int rgba); - void SetNormal(const MT_Vector3& normal); - void SetTangent(const MT_Vector3& tangent); - void SetFlag(const short flag); - void SetUnit(const unsigned u); - - void SetRGBA(const MT_Vector4& rgba); - const MT_Point3& xyz(); - - void Transform(const class MT_Matrix4x4& mat, - const class MT_Matrix4x4& nmat); - - // compare two vertices, to test if they can be shared, used for - // splitting up based on uv's, colors, etc - bool closeTo(const RAS_TexVert* other); - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_TexVert"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif //__RAS_TEXVERT - diff --git a/source/gameengine/Rasterizer/RAS_texmatrix.cpp b/source/gameengine/Rasterizer/RAS_texmatrix.cpp deleted file mode 100644 index e69601fe091..00000000000 --- a/source/gameengine/Rasterizer/RAS_texmatrix.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "RAS_TexMatrix.h" - -void RAS_CalcTexMatrix(RAS_TexVert p[3],MT_Point3& origin,MT_Vector3& udir,MT_Vector3& vdir) -{ -// precondition: 3 vertices are non-colinear - - MT_Vector3 vec1 = p[1].xyz()-p[0].xyz(); - MT_Vector3 vec2 = p[2].xyz()-p[0].xyz(); - MT_Vector3 normal = vec1.cross(vec2); - normal.normalize(); - - // determine which coordinate we drop, ie. max coordinate in the normal - - - int ZCOORD = normal.closestAxis(); - int XCOORD = (ZCOORD+1)%3; - int YCOORD = (ZCOORD+2)%3; - - // ax+by+cz+d=0 - MT_Scalar d = -p[0].xyz().dot(normal); - - - MT_Matrix3x3 mat3( p[0].getUV1()[0],p[0].getUV1()[1], 1, - p[1].getUV1()[0],p[1].getUV1()[1], 1, - p[2].getUV1()[0],p[2].getUV1()[1], 1); - - - MT_Matrix3x3 mat3inv = mat3.inverse(); - - MT_Vector3 p123x(p[0].xyz()[XCOORD],p[1].xyz()[XCOORD],p[2].xyz()[XCOORD]); - MT_Vector3 resultx = mat3inv*p123x; - MT_Vector3 p123y(p[0].xyz()[YCOORD],p[1].xyz()[YCOORD],p[2].xyz()[YCOORD]); - MT_Vector3 resulty = mat3inv*p123y; - - // normal[ZCOORD] is not zero, because it's chosen to be maximal (absolute), and normal has length 1, - // so at least on of the coords is <> 0 - - //droppedvalue udir.dot(normal) =0 - MT_Scalar droppedu = -(resultx.x()*normal[XCOORD]+resulty.x()*normal[YCOORD])/normal[ZCOORD]; - udir[XCOORD] = resultx.x(); - udir[YCOORD] = resulty.x(); - udir[ZCOORD] = droppedu; - MT_Scalar droppedv = -(resultx.y()*normal[XCOORD]+resulty.y()*normal[YCOORD])/normal[ZCOORD]; - vdir[XCOORD] = resultx.y(); - vdir[YCOORD] = resulty.y(); - vdir[ZCOORD] = droppedv; - // droppedvalue b = -(ax+cz+d)/y; - MT_Scalar droppedvalue = -((resultx.z()*normal[XCOORD] + resulty.z()*normal[YCOORD]+d))/normal[ZCOORD]; - origin[XCOORD] = resultx.z(); - origin[YCOORD] = resulty.z(); - origin[ZCOORD] = droppedvalue; - - -} - -#ifdef _TEXOWNMAIN - -int main() -{ - - MT_Point2 puv0={0,0}; - MT_Point3 pxyz0 (0,0,128); - - MT_Scalar puv1[2]={1,0}; - MT_Point3 pxyz1(128,0,128); - - MT_Scalar puv2[2]={1,1}; - MT_Point3 pxyz2(128,0,0); - - RAS_TexVert p0(pxyz0,puv0); - RAS_TexVert p1(pxyz1,puv1); - RAS_TexVert p2(pxyz2,puv2); - - RAS_TexVert vertices[3] = - { - p0, - p1, - p2 - }; - - MT_Vector3 udir,vdir; - MT_Point3 origin; - CalcTexMatrix(vertices,origin,udir,vdir); - - MT_Point3 testpoint(128,32,64); - - MT_Scalar lenu = udir.length2(); - MT_Scalar lenv = vdir.length2(); - - MT_Scalar testu=((pxyz2-origin).dot(udir))/lenu; - MT_Scalar testv=((pxyz2-origin).dot(vdir))/lenv; - - - - - return 0; -} - -#endif // _TEXOWNMAIN diff --git a/source/gameengine/Rasterizer/SConscript b/source/gameengine/Rasterizer/SConscript deleted file mode 100644 index 8bc99f1596e..00000000000 --- a/source/gameengine/Rasterizer/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/python -Import ('env') - -sources = env.Glob('*.cpp') - - -incs = '. #intern/guardedalloc #source/kernel/gen_system #intern/string #intern/moto/include #source/gameengine/BlenderRoutines #extern/glew/include #source/gameengine/Expressions #source/gameengine/SceneGraph #source/blender/blenkernel #source/blender/makesdna' - -defs = [ 'GLEW_STATIC' ] - -if env['WITH_BF_PYTHON']: - incs += ' ' + env['BF_PYTHON_INC'] -else: - defs.append('DISABLE_PYTHON') - -env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), defs, libtype=['core','player'], priority=[350,70], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/SConscript b/source/gameengine/SConscript deleted file mode 100644 index e7c9328688f..00000000000 --- a/source/gameengine/SConscript +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/python -Import ('env') - -SConscript(['BlenderRoutines/SConscript', - 'Converter/SConscript', - 'Expressions/SConscript', #310 - 'GameLogic/SConscript', - 'Ketsji/SConscript', - 'Ketsji/KXNetwork/SConscript', - 'Network/SConscript', - 'Network/LoopBackNetwork/SConscript', - 'Physics/common/SConscript', - 'Physics/Dummy/SConscript', - 'Rasterizer/SConscript', - 'Rasterizer/RAS_OpenGLRasterizer/SConscript', - 'SceneGraph/SConscript', - 'Physics/Bullet/SConscript' - ]) - -if env['WITH_BF_PYTHON']: - SConscript(['VideoTexture/SConscript']) - -if env['WITH_BF_PLAYER']: - SConscript(['GamePlayer/SConscript']) diff --git a/source/gameengine/SceneGraph/CMakeLists.txt b/source/gameengine/SceneGraph/CMakeLists.txt deleted file mode 100644 index 3242ec57d94..00000000000 --- a/source/gameengine/SceneGraph/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -# $Id$ -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# The Original Code is Copyright (C) 2006, Blender Foundation -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -FILE(GLOB SRC *.cpp) - -SET(INC - . - ../../../intern/moto/include -) - -BLENDERLIB(bf_scenegraph "${SRC}" "${INC}") -#env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), [], libtype=['game','player'], priority=[50,130] ) diff --git a/source/gameengine/SceneGraph/Makefile b/source/gameengine/SceneGraph/Makefile deleted file mode 100644 index acec1b729e8..00000000000 --- a/source/gameengine/SceneGraph/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = scenegraph -DIR = $(OCGDIR)/gameengine/$(LIBNAME) - -include nan_compile.mk - -CCFLAGS += $(LEVEL_1_CPP_WARNINGS) - -CPPFLAGS += -I$(NAN_MOTO)/include diff --git a/source/gameengine/SceneGraph/SConscript b/source/gameengine/SceneGraph/SConscript deleted file mode 100644 index 2a33cd67b5e..00000000000 --- a/source/gameengine/SceneGraph/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/python - -Import ('env') - -sources = env.Glob('*.cpp') - -incs = '. #intern/moto/include' - -env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), [], libtype=['core','player'], priority=[325,85], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/SceneGraph/SG_BBox.cpp b/source/gameengine/SceneGraph/SG_BBox.cpp deleted file mode 100644 index f46c1088466..00000000000 --- a/source/gameengine/SceneGraph/SG_BBox.cpp +++ /dev/null @@ -1,257 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Bounding Box - */ - -#include - - #include "SG_BBox.h" - #include "SG_Node.h" - -SG_BBox::SG_BBox() : - m_min(0., 0., 0.), - m_max(0., 0., 0.) -{ -} - -SG_BBox::SG_BBox(const MT_Point3 &min, const MT_Point3 &max) : - m_min(min), - m_max(max) -{ -} - -SG_BBox::SG_BBox(const SG_BBox &other, const MT_Transform &world) : - m_min(world(other.m_min)), - m_max(world(other.m_max)) -{ - *this += world(MT_Point3(m_min[0], m_min[1], m_max[2])); - *this += world(MT_Point3(m_min[0], m_max[1], m_min[2])); - *this += world(MT_Point3(m_min[0], m_max[1], m_max[2])); - *this += world(MT_Point3(m_max[0], m_min[1], m_min[2])); - *this += world(MT_Point3(m_max[0], m_min[1], m_max[2])); - *this += world(MT_Point3(m_max[0], m_max[1], m_min[2])); -} - -SG_BBox::SG_BBox(const SG_BBox &other) : - m_min(other.m_min), - m_max(other.m_max) -{ -} - -SG_BBox::~ SG_BBox() -{ -} - -SG_BBox& SG_BBox::operator +=(const MT_Point3 &point) -{ - if (point[0] < m_min[0]) - m_min[0] = point[0]; - else if (point[0] > m_max[0]) - m_max[0] = point[0]; - - if (point[1] < m_min[1]) - m_min[1] = point[1]; - else if (point[1] > m_max[1]) - m_max[1] = point[1]; - - if (point[2] < m_min[2]) - m_min[2] = point[2]; - else if (point[2] > m_max[2]) - m_max[2] = point[2]; - - return *this; -} - -SG_BBox& SG_BBox::operator += (const SG_BBox &bbox) -{ - *this += bbox.m_min; - *this += bbox.m_max; - - return *this; -} - -SG_BBox SG_BBox::operator +(const SG_BBox &bbox2) const -{ - SG_BBox ret = *this; - ret += bbox2; - return ret; -} - -MT_Scalar SG_BBox::volume() const -{ - MT_Vector3 size = m_max - m_min; - return size[0]*size[1]*size[2]; -} -#if 0 -void SG_BBox::translate(const MT_Vector3& dx) -{ - m_min += dx; - m_max += dx; -} - -void SG_BBox::scale(const MT_Vector3& size, const MT_Point3& point) -{ - MT_Vector3 center = (m_max - m_min)/2. + point; - m_max = (m_max - center)*size; - m_min = (m_min - center)*size; -} -#endif - -SG_BBox SG_BBox::transform(const MT_Transform &world) const -{ - SG_BBox bbox(world(m_min), world(m_max)); - bbox += world(MT_Point3(m_min[0], m_min[1], m_max[2])); - bbox += world(MT_Point3(m_min[0], m_max[1], m_min[2])); - bbox += world(MT_Point3(m_min[0], m_max[1], m_max[2])); - bbox += world(MT_Point3(m_max[0], m_min[1], m_min[2])); - bbox += world(MT_Point3(m_max[0], m_min[1], m_max[2])); - bbox += world(MT_Point3(m_max[0], m_max[1], m_min[2])); - return bbox; -} - -bool SG_BBox::inside(const MT_Point3 &point) const -{ - return point[0] >= m_min[0] && point[0] <= m_max[0] && - point[1] >= m_min[1] && point[1] <= m_max[1] && - point[2] >= m_min[2] && point[2] <= m_max[2]; -} - -bool SG_BBox::inside(const SG_BBox& other) const -{ - return inside(other.m_min) && inside(other.m_max); -} - -bool SG_BBox::intersects(const SG_BBox& other) const -{ - return inside(other.m_min) != inside(other.m_max); -} - -bool SG_BBox::outside(const SG_BBox& other) const -{ - return !inside(other.m_min) && !inside(other.m_max); -} - -SG_BBox::intersect SG_BBox::test(const SG_BBox& other) const -{ - bool point1(inside(other.m_min)), point2(inside(other.m_max)); - - return point1?(point2?INSIDE:INTERSECT):(point2?INTERSECT:OUTSIDE); -} - -void SG_BBox::get(MT_Point3 *box, const MT_Transform &world) const -{ - *box++ = world(m_min); - *box++ = world(MT_Point3(m_min[0], m_min[1], m_max[2])); - *box++ = world(MT_Point3(m_min[0], m_max[1], m_min[2])); - *box++ = world(MT_Point3(m_min[0], m_max[1], m_max[2])); - *box++ = world(MT_Point3(m_max[0], m_min[1], m_min[2])); - *box++ = world(MT_Point3(m_max[0], m_min[1], m_max[2])); - *box++ = world(MT_Point3(m_max[0], m_max[1], m_min[2])); - *box++ = world(m_max); -} - -void SG_BBox::getaa(MT_Point3 *box, const MT_Transform &world) const -{ - const MT_Point3 min(world(m_min)), max(world(m_max)); - *box++ = min; - *box++ = MT_Point3(min[0], min[1], max[2]); - *box++ = MT_Point3(min[0], max[1], min[2]); - *box++ = MT_Point3(min[0], max[1], max[2]); - *box++ = MT_Point3(max[0], min[1], min[2]); - *box++ = MT_Point3(max[0], min[1], max[2]); - *box++ = MT_Point3(max[0], max[1], min[2]); - *box++ = max; -} - -void SG_BBox::getmm(MT_Point3 *box, const MT_Transform &world) const -{ - const MT_Point3 min(world(m_min)), max(world(m_max)); - *box++ = min; - *box++ = max; -} - -void SG_BBox::split(SG_BBox &left, SG_BBox &right) const -{ - MT_Scalar sizex = m_max[0] - m_min[0]; - MT_Scalar sizey = m_max[1] - m_min[1]; - MT_Scalar sizez = m_max[2] - m_min[2]; - if (sizex < sizey) - { - if (sizey > sizez) - { - left.m_min = m_min; - left.m_max[0] = m_max[0]; - left.m_max[1] = m_min[1] + sizey/2.0; - left.m_max[2] = m_max[2]; - - right.m_min[0] = m_min[0]; - right.m_min[1] = m_min[1] + sizey/2.0; - right.m_min[2] = m_min[2]; - right.m_max = m_max; - std::cout << "splity" << std::endl; - } else { - left.m_min = m_min; - left.m_max[0] = m_max[0]; - left.m_max[1] = m_max[1]; - left.m_max[2] = m_min[2] + sizez/2.0; - - right.m_min[0] = m_min[0]; - right.m_min[1] = m_min[1]; - right.m_min[2] = m_min[2] + sizez/2.0; - right.m_max = m_max; - std::cout << "splitz" << std::endl; - } - } else { - if (sizex > sizez) - { - left.m_min = m_min; - left.m_max[0] = m_min[0] + sizex/2.0; - left.m_max[1] = m_max[1]; - left.m_max[2] = m_max[2]; - - right.m_min[0] = m_min[0] + sizex/2.0; - right.m_min[1] = m_min[1]; - right.m_min[2] = m_min[2]; - right.m_max = m_max; - std::cout << "splitx" << std::endl; - } else { - left.m_min = m_min; - left.m_max[0] = m_max[0]; - left.m_max[1] = m_max[1]; - left.m_max[2] = m_min[2] + sizez/2.0; - - right.m_min[0] = m_min[0]; - right.m_min[1] = m_min[1]; - right.m_min[2] = m_min[2] + sizez/2.0; - right.m_max = m_max; - std::cout << "splitz" << std::endl; - } - } - - //std::cout << "Left: " << left.m_min << " -> " << left.m_max << " Right: " << right.m_min << " -> " << right.m_max << std::endl; -} diff --git a/source/gameengine/SceneGraph/SG_BBox.h b/source/gameengine/SceneGraph/SG_BBox.h deleted file mode 100644 index cc9dfc2db4e..00000000000 --- a/source/gameengine/SceneGraph/SG_BBox.h +++ /dev/null @@ -1,143 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * Bounding Box - */ - -#ifndef __SG_BBOX_H__ -#define __SG_BBOX_H__ - -#include "MT_Scalar.h" -#include "MT_Point3.h" -#include "MT_Vector3.h" -#include "MT_Transform.h" - -#include - -#ifdef WITH_CXX_GUARDEDALLOC -#include "MEM_guardedalloc.h" -#endif - -class SG_Node; - -/** - * Bounding box class. - * Holds the minimum and maximum axis aligned points of a node's bounding box, - * in world coordinates. - */ -class SG_BBox -{ - MT_Point3 m_min; - MT_Point3 m_max; -public: - typedef enum { INSIDE, INTERSECT, OUTSIDE } intersect; - SG_BBox(); - SG_BBox(const MT_Point3 &min, const MT_Point3 &max); - SG_BBox(const SG_BBox &other, const MT_Transform &world); - SG_BBox(const SG_BBox &other); - ~SG_BBox(); - - /** - * Enlarges the bounding box to contain the specified point. - */ - SG_BBox& operator +=(const MT_Point3 &point); - /** - * Enlarges the bounding box to contain the specified bound box. - */ - SG_BBox& operator +=(const SG_BBox &bbox); - - SG_BBox operator + (const SG_BBox &bbox2) const; -#if 0 - /** - * Translates the bounding box. - */ - void translate(const MT_Vector3 &dx); - /** - * Scales the bounding box about the optional point. - */ - void scale(const MT_Vector3 &size, const MT_Point3 &point = MT_Point3(0., 0., 0.)); -#endif - SG_BBox transform(const MT_Transform &world) const; - /** - * Computes the volume of the bounding box. - */ - MT_Scalar volume() const; - - /** - * Test if the given point is inside this bounding box. - */ - bool inside(const MT_Point3 &point) const; - - /** - * Test if the given bounding box is inside this bounding box. - */ - bool inside(const SG_BBox &other) const; - - /** - * Test if the given bounding box is outside this bounding box. - */ - bool outside(const SG_BBox &other) const; - - /** - * Test if the given bounding box intersects this bounding box. - */ - bool intersects(const SG_BBox &other) const; - - /** - * Test the given bounding box with this bounding box. - */ - intersect test(const SG_BBox &other) const; - - /** - * Get the eight points that define this bounding box. - * - * @param world a world transform to apply to the produced points bounding box. - */ - void get(MT_Point3 *box, const MT_Transform &world) const; - /** - * Get the eight points that define this axis aligned bounding box. - * This differs from SG_BBox::get() in that the produced box will be world axis aligned. - * The maximum & minimum local points will be transformed *before* splitting to 8 points. - * @param world a world transform to be applied. - */ - void getaa(MT_Point3 *box, const MT_Transform &world) const; - - void getmm(MT_Point3 *box, const MT_Transform &world) const; - - void split(SG_BBox &left, SG_BBox &right) const; - - friend class SG_Tree; - - -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SG_BBox"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; - -#endif /* __SG_BBOX_H__ */ diff --git a/source/gameengine/SceneGraph/SG_Controller.cpp b/source/gameengine/SceneGraph/SG_Controller.cpp deleted file mode 100644 index d2464b22608..00000000000 --- a/source/gameengine/SceneGraph/SG_Controller.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file SG_Controller.cpp - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "SG_Controller.h" - - void -SG_Controller:: -SetObject(SG_IObject* obj) -{ - m_pObject = obj; // no checks yet ? -} - - void -SG_Controller:: -ClearObject( -){ - m_pObject = NULL; -} - - diff --git a/source/gameengine/SceneGraph/SG_Controller.h b/source/gameengine/SceneGraph/SG_Controller.h deleted file mode 100644 index 6e44e05cb0b..00000000000 --- a/source/gameengine/SceneGraph/SG_Controller.h +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Implementationclass to derive controllers from - * - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __SG_CONTROLLER_H -#define __SG_CONTROLLER_H - -#include "SG_IObject.h" - -/** - * A scenegraph controller - */ -class SG_Controller -{ -public: - -#ifdef WITH_CXX_GUARDEDALLOC - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "SG_Controller"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif - - SG_Controller( - ) : - m_pObject(NULL) { - } - - virtual - ~SG_Controller( - ) {}; - - virtual - bool - Update( - double time - )=0; - - virtual - void - SetObject ( - SG_IObject* object - ); - - void - ClearObject( - ); - - virtual - void - SetSimulatedTime( - double time - )=0; - - virtual - SG_Controller* - GetReplica( - class SG_Node* destnode - )=0; - - /** - * Hacky way of passing options to specific controllers - * @param option An integer identifying the option. - * @param value The value of this option. - * @attention This has been placed here to give sca-elements - * @attention some control over the controllers. This is - * @attention necessary because the identity of the controller - * @attention is lost on the way here. - */ - virtual - void - SetOption( - int option, - int value - )=0; - - /** - * Option-identifiers: SG_CONTR__