diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2011-07-29 10:32:30 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2011-07-29 10:32:30 +0400 |
commit | b46d8955509e805f06b76a6fd800ecb4edee113b (patch) | |
tree | 7ed0b1a3b5d04ab48d3e9062ff02ce54961ecb06 /source/gameengine | |
parent | 6960127d2609620d52620539388ada5cb466bab2 (diff) | |
parent | 26589497529ca3c8da85391d4976d286a371e258 (diff) |
Merging r36529-38806bge_components
Diffstat (limited to 'source/gameengine')
51 files changed, 597 insertions, 349 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 571cc9087b3..a3ea85b605c 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -81,6 +81,8 @@ extern "C" { #include "DNA_windowmanager_types.h" #include "BKE_global.h" #include "BKE_report.h" +/* #include "BKE_screen.h" */ /* cant include this because of 'new' function name */ +extern float BKE_screen_view3d_zoom_to_fac(float camzoom); //XXX #include "BIF_screen.h" @@ -93,7 +95,9 @@ extern "C" { #include "BKE_ipo.h" /***/ -#include "AUD_C-API.h" +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif //XXX #include "BSE_headerbuttons.h" #include "BKE_context.h" @@ -248,15 +252,15 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // some blender stuff float camzoom; + int draw_letterbox = 0; if(rv3d->persp==RV3D_CAMOB) { if(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */ camzoom = 1.0f; + draw_letterbox = 1; } else { - camzoom = (1.41421 + (rv3d->camzoom / 50.0)); - camzoom *= camzoom; - camzoom = 4.0 / camzoom; + camzoom = 1.0 / BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); } } else { @@ -433,6 +437,16 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c if (render) { + if(draw_letterbox) { + // Clear screen to border color + // We do this here since we set the canvas to be within the frames. This means the engine + // itself is unaware of the extra space, so we clear the whole region for it. + glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); + glViewport(ar->winrct.xmin, ar->winrct.ymin, + ar->winrct.xmax - ar->winrct.xmin, ar->winrct.ymax - ar->winrct.ymin); + glClear(GL_COLOR_BUFFER_BIT); + } + // render the frame ketsjiengine->Render(); } diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt index 6a17017f261..5a7304765e4 100644 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ b/source/gameengine/BlenderRoutines/CMakeLists.txt @@ -1,37 +1,40 @@ set(INC . - ../../../intern/string + ../Converter + ../Expressions + ../GameLogic + ../Ketsji + ../Network + ../Network/LoopBackNetwork + ../Physics/Bullet + ../Physics/common + ../Rasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../SceneGraph + ../../blender + ../../blender/blenfont + ../../blender/blenkernel + ../../blender/blenlib + ../../blender/blenloader + ../../blender/editors/include + ../../blender/gpu + ../../blender/imbuf + ../../blender/makesdna + ../../blender/makesrna + ../../blender/windowmanager + ../../../extern/bullet2/src ../../../intern/container ../../../intern/guardedalloc - ../../../intern/audaspace/intern - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/Converter - ../../../source/blender/imbuf ../../../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/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/blenloader - ../../../source/blender/gpu - ../../../extern/bullet2/src + ../../../intern/string ${GLEW_INCLUDE_PATH} ) +set(INC_SYS + +) + set(SRC BL_KetsjiEmbedStart.cpp BL_System.cpp @@ -55,8 +58,15 @@ set(SRC add_definitions(-DGLEW_STATIC) +if(WITH_AUDASPACE) + list(APPEND INC + ../../../intern/audaspace/intern + ) + add_definitions(-DWITH_AUDASPACE) +endif() + if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() -blender_add_lib(ge_blen_routines "${SRC}" "${INC}") +blender_add_lib(ge_blen_routines "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index c00e7ec7e29..7e353d590bb 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -405,7 +405,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) // 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); +// what_does_obaction(obj->GetArmatureObject(), &workob, m_pose, m_action, NULL, m_localtime); } // done getting the pose from the action diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 1d90d97f824..c331b878178 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -145,9 +145,11 @@ extern "C" { #include "BKE_customdata.h" #include "BKE_cdderivedmesh.h" #include "BKE_DerivedMesh.h" +#include "BKE_material.h" /* give_current_material */ + +extern Material defmaterial; /* material.c */ } -#include "BKE_material.h" /* give_current_material */ /* end of blender include block */ #include "KX_BlenderInputDevice.h" @@ -462,7 +464,9 @@ bool ConvertMaterial( } } } - material->flag[i] |= (mat->ipo!=0)?HASIPO:0; +#if 0 /* this flag isnt used anymore */ + material->flag[i] |= (BKE_animdata_from_id(mat->id) != NULL) ? HASIPO : 0; +#endif /// -------------------------------- // mapping methods material->mapping[i].mapping |= ( mttmp->texco & TEXCO_REFL )?USEREFL:0; @@ -837,6 +841,11 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, else ma = mesh->mat ? mesh->mat[mface->mat_nr]:NULL; + /* ckeck for texface since texface _only_ is used as a fallback */ + if(ma == NULL && tface == NULL) { + ma= &defmaterial; + } + { bool visible = true; bool twoside = false; @@ -1969,8 +1978,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie, frame_type = RAS_FrameSettings::e_frame_scale; } - aspect_width = blenderscene->gm.xsch; - aspect_height = blenderscene->gm.ysch; + aspect_width = blenderscene->r.xsch*blenderscene->r.xasp; + aspect_height = blenderscene->r.ysch*blenderscene->r.yasp; } RAS_FrameSettings frame_settings( @@ -2600,6 +2609,9 @@ void BL_ConvertBlenderObjects(struct Main* maggie, bConstraint *curcon; conlist = get_active_constraints2(blenderobject); + if((gameobj->GetLayer()&activeLayerBitInfo)==0) + continue; + if (conlist) { for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) { if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT){ @@ -2613,7 +2625,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, if (dat->tar) { KX_GameObject *gotar=getGameOb(dat->tar->id.name+2,sumolist); - if (gotar && gotar->GetPhysicsController()) + if (gotar && ((gotar->GetLayer()&activeLayerBitInfo)!=0) && gotar->GetPhysicsController()) physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData(); } diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index bdd0769e0a3..45a7701d404 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -26,37 +26,39 @@ set(INC . - ../../../intern/string - ../../../intern/guardedalloc + ../BlenderRoutines + ../Expressions + ../GameLogic + ../Ketsji + ../Ketsji/KXNetwork + ../Network + ../Network/LoopBackNetwork + ../Physics/Bullet + ../Physics/Dummy + ../Physics/common + ../Rasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../SceneGraph + ../../blender + ../../blender/blenkernel + ../../blender/blenlib + ../../blender/blenloader + ../../blender/gpu + ../../blender/ikplugin + ../../blender/imbuf + ../../blender/makesdna + ../../blender/makesrna + ../../blender/windowmanager + ../../../extern/bullet2/src ../../../intern/container - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../intern/audaspace/intern - ../../../source/gameengine/Converter - ../../../source/gameengine/BlenderRoutines - ../../../source/blender/imbuf + ../../../intern/guardedalloc ../../../intern/moto/include - ../../../source/gameengine/Ketsji - ../../../source/gameengine/Ketsji/KXNetwork - ../../../source/blender/blenlib - ../../../source/blender/blenkernel - ../../../source/blender/windowmanager - ../../../source/blender - ../../../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/blenloader - ../../../source/blender/gpu - ../../../source/blender/ikplugin - ../../../extern/bullet2/src + ../../../intern/string +) + +set(INC_SYS + ) set(SRC @@ -109,4 +111,11 @@ if(WITH_BULLET) add_definitions(-DUSE_BULLET) endif() -blender_add_lib(ge_converter "${SRC}" "${INC}") +if(WITH_AUDASPACE) + list(APPEND INC + ../../../intern/audaspace/intern + ) + add_definitions(-DWITH_AUDASPACE) +endif() + +blender_add_lib(ge_converter "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 684ed0b06f9..58089cc4b2d 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -994,7 +994,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha int i=0; LinkNode *n= names; while(n) { - BLO_library_append_named_part(C, main_tmp, &bpy_openlib, (char *)n->link, idcode, 0); + BLO_library_append_named_part(main_tmp, &bpy_openlib, (char *)n->link, idcode); n= (LinkNode *)n->next; i++; } @@ -1012,7 +1012,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha int i=0; LinkNode *n= names; while(n) { - BLO_library_append_named_part(C, main_tmp, &bpy_openlib, (char *)n->link, ID_AC, 0); + BLO_library_append_named_part(main_tmp, &bpy_openlib, (char *)n->link, ID_AC); n= (LinkNode *)n->next; i++; } diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 01516a24182..51e0449a32e 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -43,7 +43,11 @@ #include "KX_BlenderSceneConverter.h" #include "KX_ConvertActuators.h" -#include "AUD_C-API.h" + +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif + // Actuators //SCA logiclibrary native logicbricks #include "SCA_PropertyActuator.h" @@ -77,6 +81,7 @@ /* This little block needed for linking to Blender... */ #include "BKE_text.h" #include "BLI_blenlib.h" +#include "BLI_math_base.h" #define FILE_MAX 240 // repeated here to avoid dependency from BKE_utildefines.h @@ -286,7 +291,8 @@ void BL_ConvertActuators(char* maggiename, camact->height, camact->min, camact->max, - camact->axis=='x'); + camact->axis=='x', + camact->damping); baseact = tmpcamact; } break; @@ -397,7 +403,7 @@ void BL_ConvertActuators(char* maggiename, new KX_SoundActuator(gameobj, snd_sound, soundact->volume, - (float)(exp((soundact->pitch / 12.0) * log(2.0))), + (float)(exp((soundact->pitch / 12.0) * M_LN2)), is3d, settings, soundActuatorType); diff --git a/source/gameengine/Expressions/CMakeLists.txt b/source/gameengine/Expressions/CMakeLists.txt index 8cda0e2dc77..ad987091790 100644 --- a/source/gameengine/Expressions/CMakeLists.txt +++ b/source/gameengine/Expressions/CMakeLists.txt @@ -26,11 +26,15 @@ set(INC . - ../../../intern/string + ../SceneGraph + ../../blender/blenloader ../../../intern/guardedalloc ../../../intern/moto/include - ../../../source/gameengine/SceneGraph - ../../../source/blender/blenloader + ../../../intern/string +) + +set(INC_SYS + ) set(SRC @@ -77,4 +81,4 @@ set(SRC VoidValue.h ) -blender_add_lib(ge_logic_expressions "${SRC}" "${INC}") +blender_add_lib(ge_logic_expressions "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index c340d13b3d4..92be769ed71 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -179,7 +179,7 @@ PyObject * PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObjec return NULL; } - /* use base_type rather then Py_TYPE(base) because we could already be subtyped */ + /* use base_type rather than Py_TYPE(base) because we could already 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; @@ -1147,7 +1147,7 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v BGE_PROXY_REF(proxy) = NULL; BGE_PROXY_PTR(proxy) = ptr; #ifdef USE_WEAKREFS - BGE_PROXY_WKREF(self->m_proxy) = NULL; + BGE_PROXY_WKREF(proxy) = NULL; #endif return proxy; } @@ -1184,47 +1184,10 @@ 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(); + PyC_LineSpit(); } void PyObjectPlus::ClearDeprecationWarning() diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index 157124ebc81..51cfb5471c0 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -54,7 +54,8 @@ #ifdef WITH_PYTHON #ifdef USE_MATHUTILS extern "C" { -#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */ +#include "../../blender/python/mathutils/mathutils.h" /* so we can have mathutils callbacks */ +#include "../../blender/python/generic/py_capi_utils.h" /* for PyC_LineSpit only */ } #endif diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index 2acf07584b1..bd417165337 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -25,18 +25,20 @@ # ***** END GPL LICENSE BLOCK ***** set(INC - . - ../../../intern/string + . + ../Expressions + ../Rasterizer + ../SceneGraph ../../../intern/container - ../../../source/gameengine/Expressions - ../../../source/gameengine/SceneGraph ../../../intern/moto/include - ../../../source/gameengine/Rasterizer + ../../../intern/string +) + +set(INC_SYS + ) set(SRC - Joystick/SCA_Joystick.cpp - Joystick/SCA_JoystickEvents.cpp SCA_2DFilterActuator.cpp SCA_ANDController.cpp SCA_ActuatorEventManager.cpp @@ -77,10 +79,9 @@ set(SRC SCA_TimeEventManager.cpp SCA_XNORController.cpp SCA_XORController.cpp + Joystick/SCA_Joystick.cpp + Joystick/SCA_JoystickEvents.cpp - Joystick/SCA_Joystick.h - Joystick/SCA_JoystickDefines.h - Joystick/SCA_JoystickPrivate.h SCA_2DFilterActuator.h SCA_ANDController.h SCA_ActuatorEventManager.h @@ -121,12 +122,17 @@ set(SRC SCA_TimeEventManager.h SCA_XNORController.h SCA_XORController.h + Joystick/SCA_Joystick.h + Joystick/SCA_JoystickDefines.h + Joystick/SCA_JoystickPrivate.h ) if(WITH_SDL) - set(INC ${INC} ${SDL_INCLUDE_DIR}) + list(APPEND INC_SYS + ${SDL_INCLUDE_DIR} + ) else() add_definitions(-DDISABLE_SDL) endif() -blender_add_lib(ge_logic "${SRC}" "${INC}") +blender_add_lib(ge_logic "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index a73a6d4631b..48ba09e67d2 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -89,7 +89,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) { int i; // do this once only - if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO ) == -1 ){ + if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ){ echo("Error-Initializing-SDL: " << SDL_GetError()); return NULL; } @@ -124,7 +124,7 @@ void SCA_Joystick::ReleaseInstance() m_instance[i]= NULL; } - SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO ); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO); #endif } } diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp index 0a65fc1584a..c270d9a312b 100644 --- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp +++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp @@ -55,10 +55,10 @@ SCA_2DFilterActuator::SCA_2DFilterActuator( m_rasterizer(rasterizer), m_scene(scene) { - m_gameObj = NULL; + m_gameobj = NULL; if(gameobj){ m_propNames = gameobj->GetPropertyNames(); - m_gameObj = gameobj; + m_gameobj = gameobj; } } @@ -91,7 +91,7 @@ bool SCA_2DFilterActuator::Update() } 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); + 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; diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.h b/source/gameengine/GameLogic/SCA_2DFilterActuator.h index 87d2e8ddbcf..7f31c1713f4 100644 --- a/source/gameengine/GameLogic/SCA_2DFilterActuator.h +++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.h @@ -42,7 +42,6 @@ class SCA_2DFilterActuator : public SCA_IActuator private: vector<STR_String> m_propNames; - void * m_gameObj; RAS_2DFilterManager::RAS_2DFILTER_MODE m_type; short m_disableMotionBlur; float m_float_arg; diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index d0c1155de96..19ddce13757 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -357,14 +357,7 @@ bool SCA_PythonController::Import() 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 */ - } + m_function_argc= ((PyCodeObject *)PyFunction_GET_CODE(m_function))->co_argcount; } if(m_function_argc > 1) { diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt index afbc49ea38d..8c5897fa48e 100644 --- a/source/gameengine/GamePlayer/common/CMakeLists.txt +++ b/source/gameengine/GamePlayer/common/CMakeLists.txt @@ -26,31 +26,34 @@ set(INC . - ../../../../intern/string + ../ghost + ../../BlenderRoutines + ../../Converter + ../../Expressions + ../../GameLogic + ../../Ketsji + ../../Network + ../../Network/LoopBackNetwork + ../../Physics/common + ../../Rasterizer + ../../Rasterizer/RAS_OpenGLRasterizer + ../../SceneGraph + ../../../blender + ../../../blender/blenfont + ../../../blender/blenkernel + ../../../blender/blenlib + ../../../blender/blenloader + ../../../blender/gpu + ../../../blender/imbuf + ../../../blender/makesdna + ../../../../intern/container ../../../../intern/ghost ../../../../intern/guardedalloc - ../../../../intern/container ../../../../intern/moto/include - ../../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../../source/gameengine/Converter - ../../../../source/gameengine/BlenderRoutines - ../../../../source/blender/imbuf - ../../../../source/gameengine/Ketsji - ../../../../source/blender/blenlib - ../../../../source/blender/blenfont - ../../../../source/blender/blenkernel - ../../../../source/blender - ../../../../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/blenloader - ../../../../source/blender/gpu + ../../../../intern/string +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ${PYTHON_INCLUDE_DIRS} ${PNG_INCLUDE_DIR} @@ -58,7 +61,6 @@ set(INC ) set(SRC - bmfont.cpp GPC_Canvas.cpp GPC_Engine.cpp GPC_KeyboardDevice.cpp @@ -68,6 +70,7 @@ set(SRC GPC_RawLogoArrays.cpp GPC_RenderTools.cpp GPC_System.cpp + bmfont.cpp GPC_Canvas.h GPC_Engine.h @@ -82,4 +85,4 @@ set(SRC add_definitions(-DGLEW_STATIC) -blender_add_lib_nolist(ge_player_common "${SRC}" "${INC}") +blender_add_lib_nolist(ge_player_common "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index edf0839f747..944ec9abd67 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -26,33 +26,35 @@ set(INC . - ../../../../intern/string + ../common + ../../BlenderRoutines + ../../Converter + ../../Expressions + ../../GameLogic + ../../Ketsji + ../../Network + ../../Network/LoopBackNetwork + ../../Physics/common + ../../Rasterizer + ../../Rasterizer/RAS_OpenGLRasterizer + ../../SceneGraph + ../../../blender + ../../../blender/blenfont + ../../../blender/blenkernel + ../../../blender/blenlib + ../../../blender/blenloader + ../../../blender/gpu + ../../../blender/imbuf + ../../../blender/makesdna + ../../../blender/makesrna + ../../../../intern/container ../../../../intern/ghost ../../../../intern/guardedalloc - ../../../../intern/container ../../../../intern/moto/include - ../../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../../source/gameengine/BlenderRoutines - ../../../../source/gameengine/Converter - ../../../../source/blender/imbuf - ../../../../source/gameengine/Ketsji - ../../../../source/blender/blenfont - ../../../../source/blender/blenlib - ../../../../source/blender/blenkernel - ../../../../source/blender/readblenfile - ../../../../source/blender - ../../../../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/blenloader - ../../../../source/blender/gpu + ../../../../intern/string +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ${PYTHON_INCLUDE_DIRS} ) @@ -60,9 +62,9 @@ set(INC set(SRC GPG_Application.cpp GPG_Canvas.cpp - GPG_ghost.cpp GPG_KeyboardDevice.cpp GPG_System.cpp + GPG_ghost.cpp GPG_Application.h GPG_Canvas.h @@ -76,4 +78,4 @@ if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() -blender_add_lib_nolist(ge_player_ghost "${SRC}" "${INC}") +blender_add_lib_nolist(ge_player_ghost "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 6487d0298c7..f2b322084ed 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -448,6 +448,7 @@ bool GPG_Application::processEvent(GHOST_IEvent* event) case GHOST_kEventWindowClose: + case GHOST_kEventQuit: m_exitRequested = KX_EXIT_REQUEST_OUTSIDE; break; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index a4f1391b1b0..cbbeb9419d1 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -62,14 +62,17 @@ extern "C" #include "BKE_global.h" #include "BKE_icons.h" #include "BKE_node.h" -#include "BKE_report.h" +#include "BKE_report.h" +#include "BKE_library.h" +#include "BLI_threads.h" #include "BLI_blenlib.h" #include "DNA_scene_types.h" #include "DNA_userdef_types.h" #include "BLO_readfile.h" -#include "BLO_readblenfile.h" +#include "BLO_runtime.h" #include "IMB_imbuf.h" #include "BKE_text.h" +#include "BKE_sound.h" int GHOST_HACK_getFirstFile(char buf[]); @@ -313,8 +316,8 @@ static BlendFileData *load_game_data(char *progname, char *filename = NULL, char 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 (BLO_is_a_runtime(progname)) { + bfd= BLO_read_runtime(progname, &reports); if (bfd) { bfd->type= BLENFILETYPE_RUNTIME; strcpy(bfd->main->name, progname); @@ -345,7 +348,9 @@ int main(int argc, char** argv) bool fullScreen = false; bool fullScreenParFound = false; bool windowParFound = false; +#ifdef WIN32 bool closeConsole = true; +#endif RAS_IRasterizer::StereoMode stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; bool stereoWindow = false; bool stereoParFound = false; @@ -395,13 +400,21 @@ int main(int argc, char** argv) ::DisposeNibReference(nibRef); */ #endif // __APPLE__ - + + // We don't use threads directly in the BGE, but we need to call this so things like + // freeing up GPU_Textures works correctly. + BLI_threadapi_init(); + RNA_init(); init_nodesystem(); initglobals(); + // We load our own G.main, so free the one that initglobals() gives us + free_main(G.main); + G.main = NULL; + IMB_init(); // Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c) @@ -443,8 +456,13 @@ int main(int argc, char** argv) U.audioformat = 0x24; U.audiochannels = 2; + // XXX this one too + U.anisotropic_filter = 2; + + sound_init_once(); + /* if running blenderplayer the last argument can't be parsed since it has to be the filename. */ - isBlenderPlayer = !blo_is_a_runtime(argv[0]); + isBlenderPlayer = !BLO_is_a_runtime(argv[0]); if (isBlenderPlayer) validArguments = argc - 1; else @@ -570,7 +588,9 @@ int main(int argc, char** argv) break; case 'c': i++; +#ifdef WIN32 closeConsole = false; +#endif break; case 's': // stereo i++; @@ -694,6 +714,8 @@ int main(int argc, char** argv) { GPU_set_mipmap(0); } + + GPU_set_anisotropic(U.anisotropic_filter); // Create the system if (GHOST_ISystem::createSystem() == GHOST_kSuccess) diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index 65bd55f95d7..de063f5e297 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -22,7 +22,6 @@ incs = ['.', '#source/blender/blenfont', '#source/blender/blenlib', '#source/blender/blenkernel', - '#source/blender/readblenfile', '#source/blender', '#source/blender/include', '#source/blender/makesdna', @@ -41,6 +40,8 @@ incs = ['.', '#source/blender/gpu', '#extern/glew/include'] +incs.append(env['BF_PTHREADS_INC']) + defs = [ 'GLEW_STATIC' ] if env['WITH_BF_PYTHON']: diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h index 126135f3d46..ef25c9218a3 100644 --- a/source/gameengine/Ketsji/BL_Material.h +++ b/source/gameengine/Ketsji/BL_Material.h @@ -144,7 +144,7 @@ enum BL_flag USEALPHA=4, // use actual alpha channel TEXALPHA=8, // use alpha combiner functions TEXNEG=16, // negate blending - HASIPO=32, + /*HASIPO=32,*/ // unused, commeted for now. USENEGALPHA=64 }; diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp index d2438a66367..a306e059442 100644 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ b/source/gameengine/Ketsji/BL_Texture.cpp @@ -28,6 +28,7 @@ #define spit(x) std::cout << x << std::endl; #include "MEM_guardedalloc.h" +#include "GPU_draw.h" extern "C" { // envmaps @@ -175,6 +176,8 @@ void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap) glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, pix ); } + if (GLEW_EXT_texture_filter_anisotropic) + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic()); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); } @@ -199,6 +202,9 @@ void BL_Texture::InitNonPow2Tex(unsigned int *pix,int x,int y,bool mipmap) 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 ); } + + if (GLEW_EXT_texture_filter_anisotropic) + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic()); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); free(newPixels); } diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 5726977b96a..e964b07b156 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -26,33 +26,35 @@ set(INC . - ../../../intern/string - ../../../intern/guardedalloc + KXNetwork + ../BlenderRoutines + ../Converter + ../Expressions + ../GameLogic + ../Network + ../Network/LoopBackNetwork + ../Physics/common + ../Rasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../SceneGraph + ../../blender + ../../blender/blenfont + ../../blender/blenkernel + ../../blender/blenlib + ../../blender/blenloader + ../../blender/gpu + ../../blender/imbuf + ../../blender/makesdna + ../../blender/python + ../../blender/python/generic + ../../blender/python/mathutils ../../../intern/container - ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer - ../../../source/gameengine/Converter - ../../../source/gameengine/BlenderRoutines - ../../../source/blender/imbuf + ../../../intern/guardedalloc ../../../intern/moto/include - ../../../source/gameengine/Ketsji - ../../../source/blender/blenlib - ../../../source/blender/blenfont - ../../../source/blender/blenkernel - ../../../source/blender/python - ../../../source/blender/python/generic - ../../../source/blender - ../../../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/Network/LoopBackNetwork - ../../../intern/audaspace/intern - ../../../source/blender/blenloader - ../../../source/blender/gpu + ../../../intern/string +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ) @@ -127,6 +129,10 @@ set(SRC KX_WorldInfo.cpp KX_WorldIpoController.cpp + BL_BlenderShader.h + BL_Material.h + BL_Shader.h + BL_Texture.h KX_ArmatureSensor.h KX_BlenderMaterial.h KX_BulletPhysicsController.h @@ -200,16 +206,14 @@ set(SRC KX_VisibilityActuator.h KX_WorldInfo.h KX_WorldIpoController.h - BL_BlenderShader.h - BL_Material.h - BL_Shader.h - BL_Texture.h ) add_definitions(-DGLEW_STATIC) if(WITH_SDL) - set(INC ${INC} ${SDL_INCLUDE_DIR}) + list(APPEND INC_SYS + ${SDL_INCLUDE_DIR} + ) else() add_definitions(-DDISABLE_SDL) endif() @@ -218,10 +222,19 @@ if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() +if(WITH_AUDASPACE) + list(APPEND INC + ../../../intern/audaspace/intern + ) + add_definitions(-DWITH_AUDASPACE) +endif() + if(WITH_BULLET) + list(APPEND INC + ../../../extern/bullet2/src + ../Physics/Bullet + ) add_definitions(-DUSE_BULLET) - list(APPEND INC ../../../extern/bullet2/src) - list(APPEND INC ../../../source/gameengine/Physics/Bullet ) endif() -blender_add_lib(ge_logic_ketsji "${SRC}" "${INC}") +blender_add_lib(ge_logic_ketsji "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt index 17a5929420d..1ebf1153150 100644 --- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt +++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt @@ -26,14 +26,18 @@ set(INC . - ../../../../intern/string + .. + ../../Expressions + ../../GameLogic + ../../Network + ../../SceneGraph ../../../../intern/container ../../../../intern/moto/include - ../../../../source/gameengine/Ketsji - ../../../../source/gameengine/GameLogic - ../../../../source/gameengine/Expressions - ../../../../source/gameengine/SceneGraph - ../../../../source/gameengine/Network + ../../../../intern/string +) + +set(INC_SYS + ) set(SRC @@ -50,4 +54,4 @@ set(SRC KX_NetworkObjectSensor.h ) -blender_add_lib(ge_logic_network "${SRC}" "${INC}") +blender_add_lib(ge_logic_network "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 98ea25c135a..c60c931c33b 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -923,6 +923,8 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, getScreenPosition, if (!PyVecTo(value, vect)) { + PyErr_Clear(); + if(ConvertPythonToGameObject(value, &obj, true, "")) { PyErr_Clear(); @@ -1020,10 +1022,8 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay, 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)); - } + PyTuple_SET_ITEM(argValue, 0, PyFloat_FromDouble(x)); + PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(y)); if(!PyVecTo(PygetScreenVect(argValue), vect)) { diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index d68cb453fe8..ebb291b2284 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -54,14 +54,16 @@ KX_CameraActuator::KX_CameraActuator( float hght, float minhght, float maxhght, - bool xytog + bool xytog, + float damping ): SCA_IActuator(gameobj, KX_ACT_CAMERA), m_ob (obj), m_height (hght), m_minHeight (minhght), m_maxHeight (maxhght), - m_x (xytog) + m_x (xytog), + m_damping (damping) { if (m_ob) m_ob->RegisterActuator(this); @@ -283,7 +285,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame) } inp= fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2]; - fac= (-1.0 + inp)/32.0; + fac= (-1.0 + inp) * m_damping; from[0]+= fac*fp1[0]; from[1]+= fac*fp1[1]; @@ -390,6 +392,7 @@ PyAttributeDef KX_CameraActuator::Attributes[] = { 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), + KX_PYATTRIBUTE_FLOAT_RW("damping",0.f,10.f,KX_CameraActuator,m_damping), {NULL} }; diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h index d59fcff9370..f844f6418b8 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.h +++ b/source/gameengine/Ketsji/KX_CameraActuator.h @@ -73,6 +73,9 @@ private : /** xy toggle (pick one): true == x, false == y */ bool m_x; + + /** damping (float), */ + float m_damping; /* get the KX_IGameObject with this name */ CValue *findObject(char *obName); @@ -95,7 +98,8 @@ private : float hght, float minhght, float maxhght, - bool xytog + bool xytog, + float damping ); diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 41efbe27095..2d548ae6d54 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -339,7 +339,7 @@ void KX_GameObject::RemoveParent(KX_Scene *scene) rootobj->m_pPhysicsController1->RemoveCompoundChild(m_pPhysicsController1); } m_pPhysicsController1->RestoreDynamics(); - if (m_pPhysicsController1->IsDyna() && rootobj->m_pPhysicsController1) + if (m_pPhysicsController1->IsDyna() && (rootobj != NULL && rootobj->m_pPhysicsController1)) { // dynamic object should remember the velocity they had while being parented MT_Point3 childPoint = GetSGNode()->GetWorldPosition(); diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 1b35219a36d..0aa36b4cd5f 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -68,7 +68,9 @@ #include "KX_PyConstraintBinding.h" #include "PHY_IPhysicsEnvironment.h" -#include "AUD_C-API.h" +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif #include "NG_NetworkScene.h" #include "NG_NetworkDeviceInterface.h" @@ -1218,7 +1220,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) projmat.setValue(m_overrideCamProjMat.getPointer()); cam->SetProjectionMatrix(projmat); } - } else if (cam->hasValidProjectionMatrix() && !cam->GetViewport() ) + } else if (cam->hasValidProjectionMatrix()) { m_rasterizer->SetProjectionMatrix(cam->GetProjectionMatrix()); } else diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index bf288e1f1ad..12024657149 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -405,8 +405,13 @@ static PyObject* gPyCreateConstraint(PyObject* self, PyObject* args, PyObject* kwds) { - /* FIXME - physicsid is an int being cast to a pointer, should at least use PyCapsule */ - int physicsid=0,physicsid2 = 0,constrainttype=0,extrainfo=0; + /* FIXME - physicsid is a long being cast to a pointer, should at least use PyCapsule */ +#if defined(_WIN64) + __int64 physicsid=0,physicsid2 = 0; +#else + long physicsid=0,physicsid2 = 0; +#endif + int constrainttype=0, extrainfo=0; int len = PyTuple_Size(args); int success = 1; int flag = 0; @@ -414,27 +419,51 @@ static PyObject* gPyCreateConstraint(PyObject* self, float pivotX=1,pivotY=1,pivotZ=1,axisX=0,axisY=0,axisZ=1; if (len == 3) { - success = PyArg_ParseTuple(args,"iii",&physicsid,&physicsid2,&constrainttype); +#if defined(_WIN64) + success = PyArg_ParseTuple(args,"LLi",&physicsid,&physicsid2,&constrainttype); +#else + success = PyArg_ParseTuple(args,"lli",&physicsid,&physicsid2,&constrainttype); +#endif } else if (len ==6) { - success = PyArg_ParseTuple(args,"iiifff",&physicsid,&physicsid2,&constrainttype, +#if defined(_WIN64) + success = PyArg_ParseTuple(args,"LLifff",&physicsid,&physicsid2,&constrainttype, &pivotX,&pivotY,&pivotZ); +#else + success = PyArg_ParseTuple(args,"llifff",&physicsid,&physicsid2,&constrainttype, + &pivotX,&pivotY,&pivotZ); +#endif } else if (len == 9) { - success = PyArg_ParseTuple(args,"iiiffffff",&physicsid,&physicsid2,&constrainttype, +#if defined(_WIN64) + success = PyArg_ParseTuple(args,"LLiffffff",&physicsid,&physicsid2,&constrainttype, &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ); +#else + success = PyArg_ParseTuple(args,"lliffffff",&physicsid,&physicsid2,&constrainttype, + &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ); +#endif + } else if (len == 10) { - success = PyArg_ParseTuple(args,"iiiffffffi",&physicsid,&physicsid2,&constrainttype, +#if defined(_WIN64) + success = PyArg_ParseTuple(args,"LLiffffffi",&physicsid,&physicsid2,&constrainttype, &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ,&flag); +#else + success = PyArg_ParseTuple(args,"lliffffffi",&physicsid,&physicsid2,&constrainttype, + &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ,&flag); +#endif } else if (len==4) { - success = PyArg_ParseTuple(args,"iiii",&physicsid,&physicsid2,&constrainttype,&extrainfo); +#if defined(_WIN64) + success = PyArg_ParseTuple(args,"LLii",&physicsid,&physicsid2,&constrainttype,&extrainfo); +#else + success = PyArg_ParseTuple(args,"llii",&physicsid,&physicsid2,&constrainttype,&extrainfo); +#endif pivotX=extrainfo; } diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h index 9b198f85664..4864482c33b 100644 --- a/source/gameengine/Ketsji/KX_PyMath.h +++ b/source/gameengine/Ketsji/KX_PyMath.h @@ -49,7 +49,7 @@ #ifdef WITH_PYTHON #ifdef USE_MATHUTILS extern "C" { -#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */ +#include "../../blender/python/mathutils/mathutils.h" /* so we can have mathutils callbacks */ } #endif diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index a3738995db3..f643030e3a2 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -54,7 +54,7 @@ extern "C" { #include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */ #include "py_capi_utils.h" - #include "mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use. + #include "mathutils.h" // 'mathutils' module copied here so the blenderlayer can use. #include "bgl.h" #include "blf_py_api.h" @@ -327,7 +327,7 @@ static PyObject* gPyLoadGlobalDict(PyObject*) { char marshal_path[512]; char *marshal_buffer = NULL; - unsigned int marshal_length; + size_t marshal_length; FILE *fp = NULL; int result; @@ -338,7 +338,7 @@ static PyObject* gPyLoadGlobalDict(PyObject*) if (fp) { // obtain file size: fseek (fp, 0, SEEK_END); - marshal_length = ftell(fp); + marshal_length = (size_t)ftell(fp); rewind(fp); marshal_buffer = (char*)malloc (sizeof(char)*marshal_length); @@ -1749,7 +1749,7 @@ static void restorePySysObjects(void) // Copied from bpy_interface.c static struct _inittab bge_internal_modules[]= { - {(char *)"mathutils", BPyInit_mathutils}, + {(char *)"mathutils", PyInit_mathutils}, {(char *)"bgl", BPyInit_bgl}, {(char *)"blf", BPyInit_blf}, {(char *)"aud", AUD_initPython}, @@ -1781,7 +1781,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur PyImport_ExtendInittab(bge_internal_modules); /* find local python installation */ - PyC_SetHomePath(BLI_get_folder(BLENDER_PYTHON, NULL)); + PyC_SetHomePath(BLI_get_folder(BLENDER_SYSTEM_PYTHON, NULL)); Py_Initialize(); diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 45ba827a1b8..75012181ac2 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -36,7 +36,11 @@ #include "KX_SoundActuator.h" -#include "AUD_C-API.h" + +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif + #include "KX_GameObject.h" #include "KX_PyMath.h" // needed for PyObjectFrom() #include <iostream> diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h index e7257245a80..eb6717f78f0 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.h +++ b/source/gameengine/Ketsji/KX_SoundActuator.h @@ -36,7 +36,10 @@ #include "SCA_IActuator.h" -#include "AUD_C-API.h" +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +#endif + #include "BKE_sound.h" typedef struct KX_3DSoundSettings diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 08642262724..62caa602c23 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -6,7 +6,8 @@ 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/blender/python/generic' # Only for bpy_internal_import.h, be very careful +incs += ' #source/blender/python/mathutils' # Only for mathutils, be very careful incs += ' #intern/string #intern/guardedalloc #intern/container' incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer' diff --git a/source/gameengine/Network/CMakeLists.txt b/source/gameengine/Network/CMakeLists.txt index 7f4c7c357da..4d6d035c63d 100644 --- a/source/gameengine/Network/CMakeLists.txt +++ b/source/gameengine/Network/CMakeLists.txt @@ -26,9 +26,13 @@ set(INC . - ../../../intern/string ../../../intern/container ../../../intern/moto/include + ../../../intern/string +) + +set(INC_SYS + ) set(SRC @@ -42,4 +46,4 @@ set(SRC NG_NetworkScene.h ) -blender_add_lib(ge_logic_ngnetwork "${SRC}" "${INC}") +blender_add_lib(ge_logic_ngnetwork "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt index d7b88304474..c816a30f1a8 100644 --- a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt +++ b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt @@ -26,9 +26,13 @@ set(INC . - ../../../../intern/string + .. ../../../../intern/container - ../../../../source/gameengine/Network + ../../../../intern/string +) + +set(INC_SYS + ) set(SRC @@ -37,4 +41,4 @@ set(SRC NG_LoopBackNetworkDeviceInterface.h ) -blender_add_lib(ge_logic_loopbacknetwork "${SRC}" "${INC}") +blender_add_lib(ge_logic_loopbacknetwork "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt index a984d0436f0..971c8f979f3 100644 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ b/source/gameengine/Physics/Bullet/CMakeLists.txt @@ -30,19 +30,22 @@ remove_strict_flags() set(INC . ../common - ../../../../extern/bullet2/src - ../../../../intern/moto/include - ../../../../intern/guardedalloc - ../../../../intern/container - ../../../../intern/string - ../../Rasterizer - ../../Ketsji ../../Expressions ../../GameLogic + ../../Ketsji + ../../Rasterizer ../../SceneGraph - ../../../../source/blender/makesdna - ../../../../source/blender/blenlib - ../../../../source/blender/blenkernel + ../../../blender/blenkernel + ../../../blender/blenlib + ../../../blender/makesdna + ../../../../extern/bullet2/src + ../../../../intern/container + ../../../../intern/guardedalloc + ../../../../intern/moto/include + ../../../../intern/string +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ${PYTHON_INCLUDE_DIRS} ) @@ -61,4 +64,4 @@ if(WITH_BULLET) add_definitions(-DUSE_BULLET) endif() -blender_add_lib(ge_phys_bullet "${SRC}" "${INC}") +blender_add_lib(ge_phys_bullet "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 0c5cbb22fbc..2bc11ef5f5b 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -2142,6 +2142,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b } collisionShape = compoundShape; } + break; } return collisionShape; } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index 97dc65c5850..08445654916 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -226,18 +226,43 @@ struct CcdConstructionInfo CcdConstructionInfo() - : m_localInertiaTensor(1.f, 1.f, 1.f), + :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_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_soft_linStiff(1.f), + m_soft_angStiff(1.f), + m_soft_volume(1.f), + m_soft_viterations(0), + m_soft_piterations(1), + m_soft_diterations(0), + m_soft_citerations(4), + m_soft_kSRHR_CL(0.1f), + m_soft_kSKHR_CL(1.f), + m_soft_kSSHR_CL(0.5f), + m_soft_kSR_SPLT_CL(0.5f), + m_soft_kSK_SPLT_CL(0.5f), + m_soft_kSS_SPLT_CL(0.5f), + m_soft_kVCF(1.f), + m_soft_kDP(0.f), + m_soft_kDG(0.f), + m_soft_kLF(0.f), + m_soft_kPR(0.f), + m_soft_kVC(0.f), + m_soft_kDF(0.2f), + m_soft_kMT(0), + m_soft_kCHR(1.0f), + m_soft_kKHR(0.1f), + m_soft_kSHR(1.0f), + m_soft_kAHR(0.7f), m_collisionFlags(0), m_bRigid(false), m_bSoft(false), @@ -252,38 +277,13 @@ struct CcdConstructionInfo m_inertiaFactor(1.f), m_do_anisotropic(false), m_anisotropicFriction(1.f,1.f,1.f), - m_contactProcessingThreshold(1e10f), - m_soft_linStiff(1.f), - m_soft_angStiff(1.f), - m_soft_volume(1.f), - m_soft_viterations(0), - m_soft_piterations(1), - m_soft_diterations(0), - m_soft_citerations(4), m_do_fh(false), m_do_rot_fh(false), m_fh_spring(0.f), m_fh_damping(0.f), m_fh_distance(1.f), m_fh_normal(false), - m_soft_kVCF(1.f), - m_soft_kDG(0.f), - m_soft_kLF(0.f), - m_soft_kDP(0.f), - m_soft_kPR(0.f), - m_soft_kVC(0.f), - m_soft_kDF(0.2f), - m_soft_kMT(0), - m_soft_kCHR(1.0f), - m_soft_kKHR(0.1f), - m_soft_kSHR(1.0f), - m_soft_kAHR(0.7f), - m_soft_kSRHR_CL(0.1f), - m_soft_kSKHR_CL(1.f), - m_soft_kSSHR_CL(0.5f), - m_soft_kSR_SPLT_CL(0.5f), - m_soft_kSK_SPLT_CL(0.5f), - m_soft_kSS_SPLT_CL(0.5f) + m_contactProcessingThreshold(1e10f) { } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 416cef71067..3f0c4cb95a1 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -939,7 +939,7 @@ int CcdPhysicsEnvironment::createUniversalD6Constraint( } else { // TODO: Implement single body case... - //No, we can use a fixed rigidbody in above code, rather then unnecessary duplation of code + //No, we can use a fixed rigidbody in above code, rather than unnecessary duplation of code } @@ -2271,7 +2271,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radi 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!! + // declare this object as Dyamic rather than 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; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index 51e00b9111f..18e1282b111 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -128,7 +128,7 @@ protected: virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep) { //based on DEFAULT_PHYSICS_TIC_RATE of 60 hertz - setNumTimeSubSteps(fixedTimeStep/60.f); + setNumTimeSubSteps((int)(fixedTimeStep / 60.f)); } //returns 0.f if no fixed timestep is used diff --git a/source/gameengine/Physics/Dummy/CMakeLists.txt b/source/gameengine/Physics/Dummy/CMakeLists.txt index fd7f37897eb..11230bbe571 100644 --- a/source/gameengine/Physics/Dummy/CMakeLists.txt +++ b/source/gameengine/Physics/Dummy/CMakeLists.txt @@ -29,10 +29,14 @@ set(INC ../common ) +set(INC_SYS + +) + set(SRC DummyPhysicsEnvironment.cpp DummyPhysicsEnvironment.h ) -blender_add_lib(ge_phys_dummy "${SRC}" "${INC}") +blender_add_lib(ge_phys_dummy "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Physics/common/CMakeLists.txt b/source/gameengine/Physics/common/CMakeLists.txt index 50aa9083089..9da7aaa6ba7 100644 --- a/source/gameengine/Physics/common/CMakeLists.txt +++ b/source/gameengine/Physics/common/CMakeLists.txt @@ -29,6 +29,10 @@ set(INC ../Dummy ) +set(INC_SYS + +) + set(SRC PHY_IMotionState.cpp PHY_IController.cpp @@ -47,4 +51,4 @@ set(SRC PHY_Pro.h ) -blender_add_lib(ge_phys_common "${SRC}" "${INC}") +blender_add_lib(ge_phys_common "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt index 2bfb3f8f328..23d746f88bc 100644 --- a/source/gameengine/Rasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/CMakeLists.txt @@ -26,14 +26,17 @@ set(INC . - ../../../source/blender/makesdna - ../../../source/gameengine/SceneGraph - ../../../source/gameengine/Ketsji - ../../../intern/string + ../Expressions + ../Ketsji + ../SceneGraph + ../../blender/makesdna ../../../intern/container - ../../../intern/moto/include ../../../intern/guardedalloc - ../Expressions + ../../../intern/moto/include + ../../../intern/string +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ${PYTHON_INCLUDE_DIRS} ) @@ -81,4 +84,4 @@ set(SRC add_definitions(-DGLEW_STATIC) -blender_add_lib(ge_rasterizer "${SRC}" "${INC}") +blender_add_lib(ge_rasterizer "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt index 99068aa1bb8..b0ef6fab251 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt @@ -25,18 +25,21 @@ # ***** END GPL LICENSE BLOCK ***** set(INC - ../../../../intern/string + .. + ../../BlenderRoutines + ../../Ketsji + ../../SceneGraph + ../../../blender/blenkernel + ../../../blender/blenlib + ../../../blender/blenloader + ../../../blender/gpu + ../../../blender/makesdna ../../../../intern/container ../../../../intern/moto/include - ../../../../source/gameengine/Rasterizer - ../../../../source/gameengine/Ketsji - ../../../../source/gameengine/SceneGraph - ../../../../source/gameengine/BlenderRoutines - ../../../../source/blender/gpu - ../../../../source/blender/makesdna - ../../../../source/blender/blenkernel - ../../../../source/blender/blenlib - ../../../../source/blender/blenloader + ../../../../intern/string +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ) @@ -54,4 +57,4 @@ set(SRC add_definitions(-DGLEW_STATIC) -blender_add_lib(ge_oglrasterizer "${SRC}" "${INC}") +blender_add_lib(ge_oglrasterizer "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/SceneGraph/CMakeLists.txt b/source/gameengine/SceneGraph/CMakeLists.txt index a054252ea0b..2f6b90a21a7 100644 --- a/source/gameengine/SceneGraph/CMakeLists.txt +++ b/source/gameengine/SceneGraph/CMakeLists.txt @@ -29,6 +29,10 @@ set(INC ../../../intern/moto/include ) +set(INC_SYS + +) + set(SRC SG_BBox.cpp SG_Controller.cpp @@ -48,4 +52,4 @@ set(SRC SG_Tree.h ) -blender_add_lib(ge_scenegraph "${SRC}" "${INC}") +blender_add_lib(ge_scenegraph "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt index fb10b619f17..56600a30b0f 100644 --- a/source/gameengine/VideoTexture/CMakeLists.txt +++ b/source/gameengine/VideoTexture/CMakeLists.txt @@ -1,3 +1,4 @@ +<<<<<<< .working # $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # @@ -92,3 +93,106 @@ if(WITH_CODEC_FFMPEG) endif() blender_add_lib(ge_videotex "${SRC}" "${INC}") +======= +# $Id$ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if 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(INC + . + ../BlenderRoutines + ../Expressions + ../GameLogic + ../Ketsji + ../Rasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../SceneGraph + ../../blender/blenkernel + ../../blender/blenlib + ../../blender/editors/include + ../../blender/gpu + ../../blender/imbuf + ../../blender/makesdna + ../../blender/python + ../../blender/python/generic + ../../../intern/container + ../../../intern/ffmpeg + ../../../intern/guardedalloc + ../../../intern/moto/include + ../../../intern/string +) + +set(INC_SYS + ${GLEW_INCLUDE_PATH} +) + +set(SRC + Exception.cpp + FilterBase.cpp + FilterBlueScreen.cpp + FilterColor.cpp + FilterNormal.cpp + FilterSource.cpp + ImageBase.cpp + ImageBuff.cpp + ImageMix.cpp + ImageRender.cpp + ImageViewport.cpp + PyTypeList.cpp + Texture.cpp + VideoBase.cpp + VideoFFmpeg.cpp + blendVideoTex.cpp + + BlendType.h + Common.h + Exception.h + FilterBase.h + FilterBlueScreen.h + FilterColor.h + FilterNormal.h + FilterSource.h + ImageBase.h + ImageBuff.h + ImageMix.h + ImageRender.h + ImageViewport.h + PyTypeList.h + Texture.h + VideoBase.h + VideoFFmpeg.h +) + +if(WITH_CODEC_FFMPEG) + list(APPEND INC_SYS + ${FFMPEG_INCLUDE_DIRS} + ${PTHREADS_INCLUDE_DIRS} + ) + add_definitions(-DWITH_FFMPEG) + add_definitions(-D__STDC_CONSTANT_MACROS) +endif() + +blender_add_lib(ge_videotex "${SRC}" "${INC}" "${INC_SYS}") +>>>>>>> .merge-right.r38806 diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript index 5091082e87a..b39a59e4504 100644 --- a/source/gameengine/VideoTexture/SConscript +++ b/source/gameengine/VideoTexture/SConscript @@ -13,6 +13,7 @@ incs += ' #source/blender/editors/include #source/blender/blenlib #source/blende incs += ' #source/blender/makesdna #source/blender/imbuf #source/blender/python #source/blender/python/generic' incs += ' #source/blender/gpu #intern/string #intern/moto/include' incs += ' #intern/guardedalloc #intern/container #extern/glew/include' +incs += ' #intern/ffmpeg' defs = [] if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw'): diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp index 63dbc5bb7ba..f8274756c8b 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp +++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp @@ -182,7 +182,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV { if(formatCtx->streams[i] && get_codec_from_stream(formatCtx->streams[i]) && - (get_codec_from_stream(formatCtx->streams[i])->codec_type==CODEC_TYPE_VIDEO)) + (get_codec_from_stream(formatCtx->streams[i])->codec_type==AVMEDIA_TYPE_VIDEO)) { videoStream=i; break; @@ -368,9 +368,9 @@ void *VideoFFmpeg::cacheThread(void *data) BLI_remlink(&video->m_packetCacheBase, cachePacket); // use m_frame because when caching, it is not used in main thread // we can't use currentFrame directly because we need to convert to RGB first - avcodec_decode_video(video->m_codecCtx, + avcodec_decode_video2(video->m_codecCtx, video->m_frame, &frameFinished, - cachePacket->packet.data, cachePacket->packet.size); + &cachePacket->packet); if(frameFinished) { AVFrame * input = video->m_frame; @@ -641,7 +641,7 @@ void VideoFFmpeg::openCam (char * file, short camIdx) if (m_captRate <= 0.f) m_captRate = defFrameRate; sprintf(rateStr, "%f", m_captRate); - av_parse_video_frame_rate(&frameRate, rateStr); + av_parse_video_rate(&frameRate, rateStr); // populate format parameters // need to specify the time base = inverse of rate formatParams.time_base.num = frameRate.den; @@ -924,10 +924,10 @@ AVFrame *VideoFFmpeg::grabFrame(long position) { if (packet.stream_index == m_videoStream) { - avcodec_decode_video( + avcodec_decode_video2( m_codecCtx, m_frame, &frameFinished, - packet.data, packet.size); + &packet); if (frameFinished) { m_curPosition = (long)((packet.dts-startTs) * (m_baseFrameRate*timeBase) + 0.5); @@ -999,9 +999,9 @@ AVFrame *VideoFFmpeg::grabFrame(long position) { if(packet.stream_index == m_videoStream) { - avcodec_decode_video(m_codecCtx, + avcodec_decode_video2(m_codecCtx, m_frame, &frameFinished, - packet.data, packet.size); + &packet); // remember dts to compute exact frame number dts = packet.dts; if (frameFinished && !posFound) diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h index 9b09c485329..139b90dc463 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.h +++ b/source/gameengine/VideoTexture/VideoFFmpeg.h @@ -31,17 +31,15 @@ http://www.gnu.org/copyleft/lesser.txt. extern "C" { #undef __cplusplus #include <pthread.h> -#include <libavformat/avformat.h> -#include <libavcodec/avcodec.h> -#include <libavutil/rational.h> -#include <libswscale/swscale.h> + +#include "ffmpeg_compat.h" + #include "DNA_listBase.h" #include "BLI_threads.h" #include "BLI_blenlib.h" #define __cplusplus } - #if LIBAVFORMAT_VERSION_INT < (49 << 16) #define FFMPEG_OLD_FRAME_RATE 1 #else |