diff options
Diffstat (limited to 'source/gameengine')
31 files changed, 192 insertions, 72 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 571cc9087b3..cac801c80ef 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" @@ -248,15 +250,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 = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom)*4.0f; } } else { @@ -433,6 +435,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..a67e2eb7038 100644 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ b/source/gameengine/BlenderRoutines/CMakeLists.txt @@ -32,6 +32,10 @@ set(INC ${GLEW_INCLUDE_PATH} ) +set(INC_SYS + +) + set(SRC BL_KetsjiEmbedStart.cpp BL_System.cpp @@ -59,4 +63,4 @@ 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_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 1591e3b8f94..4b475a4b5e7 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -143,9 +143,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" @@ -463,7 +465,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; @@ -838,6 +842,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; @@ -2609,6 +2618,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){ @@ -2622,7 +2634,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 8fd0a765932..fcb608a5830 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -60,6 +60,10 @@ set(INC ../../../extern/recastnavigation/Detour/Include ) +set(INC_SYS + +) + set(SRC BL_ActionActuator.cpp BL_ArmatureActuator.cpp @@ -110,4 +114,4 @@ if(WITH_BULLET) add_definitions(-DUSE_BULLET) endif() -blender_add_lib(ge_converter "${SRC}" "${INC}") +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/Expressions/CMakeLists.txt b/source/gameengine/Expressions/CMakeLists.txt index 8cda0e2dc77..83d44e1b318 100644 --- a/source/gameengine/Expressions/CMakeLists.txt +++ b/source/gameengine/Expressions/CMakeLists.txt @@ -33,6 +33,10 @@ set(INC ../../../source/blender/blenloader ) +set(INC_SYS + +) + set(SRC BoolValue.cpp ConstExpr.cpp @@ -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..10906cdae02 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; @@ -1198,14 +1198,13 @@ void PyDebugLine() 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"); + co_filename= ((PyCodeObject *)f_code)->co_filename; /* borrow */ 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; } diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index 2acf07584b1..b6721650bad 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -34,6 +34,10 @@ set(INC ../../../source/gameengine/Rasterizer ) +set(INC_SYS + +) + set(SRC Joystick/SCA_Joystick.cpp Joystick/SCA_JoystickEvents.cpp @@ -124,9 +128,9 @@ set(SRC ) 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/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..d16ec6a2f22 100644 --- a/source/gameengine/GamePlayer/common/CMakeLists.txt +++ b/source/gameengine/GamePlayer/common/CMakeLists.txt @@ -51,6 +51,9 @@ set(INC ../../../../source/gameengine/GamePlayer/ghost ../../../../source/blender/blenloader ../../../../source/blender/gpu +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ${PYTHON_INCLUDE_DIRS} ${PNG_INCLUDE_DIR} @@ -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..5ac121099c3 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -39,7 +39,6 @@ set(INC ../../../../source/blender/blenfont ../../../../source/blender/blenlib ../../../../source/blender/blenkernel - ../../../../source/blender/readblenfile ../../../../source/blender ../../../../source/blender/makesdna ../../../../source/blender/makesrna @@ -53,6 +52,9 @@ set(INC ../../../../source/gameengine/GamePlayer/common ../../../../source/blender/blenloader ../../../../source/blender/gpu +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ${PYTHON_INCLUDE_DIRS} ) @@ -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_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index a4f1391b1b0..121f38eef02 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -62,14 +62,16 @@ 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_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 +315,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 +347,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; @@ -402,6 +406,9 @@ int main(int argc, char** argv) initglobals(); + // We load our own G.main, so free the one that initglobals() gives us + free_main(G.main); + IMB_init(); // Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c) @@ -443,8 +450,10 @@ int main(int argc, char** argv) U.audioformat = 0x24; U.audiochannels = 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 +579,9 @@ int main(int argc, char** argv) break; case 'c': i++; +#ifdef WIN32 closeConsole = false; +#endif break; case 's': // stereo i++; diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index 65bd55f95d7..e3ffc1a406b 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', 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/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 61c635c7b5a..b32fd9e7a44 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -53,6 +53,9 @@ set(INC ../../../intern/audaspace/intern ../../../source/blender/blenloader ../../../source/blender/gpu +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ../../../extern/recastnavigation/Recast/Include ../../../extern/recastnavigation/Detour/Include @@ -216,7 +219,7 @@ set(SRC 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() @@ -226,9 +229,11 @@ if(WITH_CODEC_FFMPEG) endif() if(WITH_BULLET) + list(APPEND INC + ../../../extern/bullet2/src + ../../../source/gameengine/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..b8149566801 100644 --- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt +++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt @@ -36,6 +36,10 @@ set(INC ../../../../source/gameengine/Network ) +set(INC_SYS + +) + set(SRC KX_NetworkEventManager.cpp KX_NetworkMessageActuator.cpp @@ -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_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_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 69d6ebc0bed..f984538fa5b 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1800,7 +1800,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/Network/CMakeLists.txt b/source/gameengine/Network/CMakeLists.txt index 7f4c7c357da..e1f3bfaac77 100644 --- a/source/gameengine/Network/CMakeLists.txt +++ b/source/gameengine/Network/CMakeLists.txt @@ -31,6 +31,10 @@ set(INC ../../../intern/moto/include ) +set(INC_SYS + +) + set(SRC NG_NetworkMessage.cpp NG_NetworkObject.cpp @@ -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..9c3936987f2 100644 --- a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt +++ b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt @@ -31,10 +31,14 @@ set(INC ../../../../source/gameengine/Network ) +set(INC_SYS + +) + set(SRC NG_LoopBackNetworkDeviceInterface.cpp 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..aadd11cc036 100644 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ b/source/gameengine/Physics/Bullet/CMakeLists.txt @@ -43,6 +43,9 @@ set(INC ../../../../source/blender/makesdna ../../../../source/blender/blenlib ../../../../source/blender/blenkernel +) + +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/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/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..b705d3151b2 100644 --- a/source/gameengine/Rasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/CMakeLists.txt @@ -34,6 +34,9 @@ set(INC ../../../intern/moto/include ../../../intern/guardedalloc ../Expressions +) + +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..a005bb1108d 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt @@ -37,6 +37,9 @@ set(INC ../../../../source/blender/blenkernel ../../../../source/blender/blenlib ../../../../source/blender/blenloader +) + +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..201714be74a 100644 --- a/source/gameengine/VideoTexture/CMakeLists.txt +++ b/source/gameengine/VideoTexture/CMakeLists.txt @@ -45,6 +45,10 @@ set(INC ../../../intern/string ../../../intern/moto/include ../../../intern/guardedalloc + ../../../intern/ffmpeg +) + +set(INC_SYS ${GLEW_INCLUDE_PATH} ) @@ -86,9 +90,12 @@ set(SRC ) if(WITH_CODEC_FFMPEG) - set(INC ${INC} ${FFMPEG_INC} ${PTHREADS_INC}) + list(APPEND INC_SYS + ${FFMPEG_INC} + ${PTHREADS_INC} + ) add_definitions(-DWITH_FFMPEG) add_definitions(-D__STDC_CONSTANT_MACROS) endif() -blender_add_lib(ge_videotex "${SRC}" "${INC}") +blender_add_lib(ge_videotex "${SRC}" "${INC}" "${INC_SYS}") 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 |