Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r--source/gameengine/Ketsji/BL_Material.h2
-rw-r--r--source/gameengine/Ketsji/BL_Texture.cpp6
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt79
-rw-r--r--source/gameengine/Ketsji/KXNetwork/CMakeLists.txt18
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp9
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.h6
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.cpp43
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.h2
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.h5
-rw-r--r--source/gameengine/Ketsji/SConscript3
15 files changed, 137 insertions, 68 deletions
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'