[GameEngine] Commit all Kester's changes made to the gameengine to restore 2.25 like...
authorNathan Letwory <nathan@letworyinteractive.com>
Mon, 22 Mar 2004 22:02:18 +0000 (22:02 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Mon, 22 Mar 2004 22:02:18 +0000 (22:02 +0000)
[SCons] Build with Solid as default when enabling the gameengine in the build process
[SCons] Build solid and qhull from the extern directory and link statically against them

That was about it.

There are a few things that needs double checking:

* Makefiles
* Projectfiles
* All the other systems than Linux and Windows on which the build (with scons) has been successfully tested.

133 files changed:
SConstruct
extern/qhull/SConscript
extern/solid/SConscript
extern/solid/SOLID/SOLID.h [new file with mode: 0644]
extern/solid/SOLID/SOLID_broad.h [new file with mode: 0644]
extern/solid/SOLID/SOLID_types.h [new file with mode: 0644]
source/blender/blenkernel/intern/mesh.c
source/blender/include/BIF_resources.h
source/blender/include/butspace.h
source/blender/include/mydevice.h
source/blender/makesdna/DNA_constraint_types.h
source/blender/makesdna/DNA_mesh_types.h
source/blender/makesdna/DNA_object_types.h
source/blender/src/buttons_logic.c
source/blender/src/buttons_scene.c
source/blender/src/editobject.c
source/blender/src/editsound.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.cpp
source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
source/gameengine/BlenderRoutines/Makefile
source/gameengine/BlenderRoutines/SConscript
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ActionActuator.h
source/gameengine/Converter/BL_ArmatureObject.h
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/BL_DeformableGameObject.cpp
source/gameengine/Converter/BL_MeshDeformer.cpp
source/gameengine/Converter/BL_MeshDeformer.h
source/gameengine/Converter/BL_SkinDeformer.cpp
source/gameengine/Converter/BL_SkinDeformer.h
source/gameengine/Converter/BL_SkinMeshObject.cpp
source/gameengine/Converter/BL_SkinMeshObject.h
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Converter/KX_ConvertActuators.cpp
source/gameengine/Converter/KX_ConvertSensors.cpp
source/gameengine/Converter/Makefile
source/gameengine/Converter/SConscript
source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_KeyboardManager.cpp
source/gameengine/GameLogic/SCA_LogicManager.cpp
source/gameengine/GameLogic/SCA_MouseManager.cpp
source/gameengine/GameLogic/SCA_PropertyActuator.cpp
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/GameLogic/SCA_RandomEventManager.cpp
source/gameengine/GamePlayer/common/GPC_Engine.cpp
source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp
source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
source/gameengine/GamePlayer/common/Makefile
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_CameraActuator.cpp
source/gameengine/Ketsji/KX_CameraIpoSGController.h
source/gameengine/Ketsji/KX_ClientObjectInfo.h
source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
source/gameengine/Ketsji/KX_GameActuator.cpp
source/gameengine/Ketsji/KX_GameActuator.h
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_IPO_SGController.cpp
source/gameengine/Ketsji/KX_IPhysicsController.cpp
source/gameengine/Ketsji/KX_IpoActuator.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.cpp
source/gameengine/Ketsji/KX_LightIpoSGController.h
source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
source/gameengine/Ketsji/KX_NearSensor.cpp
source/gameengine/Ketsji/KX_NearSensor.h
source/gameengine/Ketsji/KX_ObColorIpoSGController.h
source/gameengine/Ketsji/KX_ObjectActuator.cpp
source/gameengine/Ketsji/KX_PhysicsEngineEnums.h
source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
source/gameengine/Ketsji/KX_RadarSensor.cpp
source/gameengine/Ketsji/KX_RadarSensor.h
source/gameengine/Ketsji/KX_RayEventManager.h
source/gameengine/Ketsji/KX_RaySensor.cpp
source/gameengine/Ketsji/KX_RaySensor.h
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_Scene.h
source/gameengine/Ketsji/KX_SceneActuator.cpp
source/gameengine/Ketsji/KX_SumoPhysicsController.cpp
source/gameengine/Ketsji/KX_SumoPhysicsController.h
source/gameengine/Ketsji/KX_TimeLogger.cpp
source/gameengine/Ketsji/KX_TouchEventManager.cpp
source/gameengine/Ketsji/KX_TouchEventManager.h
source/gameengine/Ketsji/KX_TouchSensor.cpp
source/gameengine/Ketsji/KX_TouchSensor.h
source/gameengine/Ketsji/KX_WorldIpoController.h
source/gameengine/Ketsji/Makefile
source/gameengine/Ketsji/SConscript
source/gameengine/Physics/Sumo/Fuzzics/include/SM_Debug.h [new file with mode: 0644]
source/gameengine/Physics/Sumo/Fuzzics/include/SM_FhObject.h
source/gameengine/Physics/Sumo/Fuzzics/include/SM_Object.h
source/gameengine/Physics/Sumo/Fuzzics/include/SM_Scene.h
source/gameengine/Physics/Sumo/Fuzzics/sample/particle.cpp
source/gameengine/Physics/Sumo/Fuzzics/src/Makefile
source/gameengine/Physics/Sumo/Fuzzics/src/SM_FhObject.cpp
source/gameengine/Physics/Sumo/Fuzzics/src/SM_Object.cpp
source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp
source/gameengine/Physics/Sumo/Makefile
source/gameengine/Physics/Sumo/SConscript
source/gameengine/Physics/Sumo/SumoPhysicsController.cpp
source/gameengine/Physics/Sumo/SumoPhysicsController.h
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h
source/gameengine/Rasterizer/RAS_BucketManager.cpp
source/gameengine/Rasterizer/RAS_BucketManager.h
source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
source/gameengine/Rasterizer/RAS_IRasterizer.h
source/gameengine/Rasterizer/RAS_IRenderTools.h
source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
source/gameengine/Rasterizer/RAS_MaterialBucket.h
source/gameengine/Rasterizer/RAS_MeshObject.cpp
source/gameengine/Rasterizer/RAS_MeshObject.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_CheckVertexArrays.cpp [deleted file]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_CheckVertexArrays.h [deleted file]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/mkglext.py [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_TexVert.cpp
source/gameengine/Rasterizer/RAS_TexVert.h
source/gameengine/SceneGraph/SG_Node.cpp

index 0e1f0fce27bef52c98dc69d089275246ab8d46a6..e18fcdb221a12c6972fcb96054a6b389a25b193d 100644 (file)
@@ -68,7 +68,7 @@ if sys.platform == 'linux2' or sys.platform == 'linux-i386':
     # SOLID library information
     solid_lib = []                                              # TODO
     solid_libpath = []                                          # TODO
-    solid_include = ['#extern/solid/include']
+    solid_include = ['#extern/solid']
     qhull_lib = []                                              # TODO
     qhull_libpath = []                                          # TODO
     qhull_include = ['#extern/qhull/include']
@@ -156,7 +156,7 @@ elif sys.platform == 'darwin':
     # SOLID library information
     solid_lib = []                                              # TODO
     solid_libpath = []                                          # TODO
-    solid_include = ['#extern/solid/include']
+    solid_include = ['#extern/solid']
     qhull_lib = []                                              # TODO
     qhull_libpath = []                                          # TODO
     qhull_include = ['#extern/qhull/include']
@@ -247,8 +247,8 @@ elif sys.platform == 'win32':
     use_openal = 'true'
     use_fmod = 'false'
     use_quicktime = 'true'
-    use_sumo = 'false'
-    use_ode = 'true'
+    use_sumo = 'true'
+    use_ode = 'false'
     use_buildinfo = 'false'
     build_blender_dynamic = 'true'
     build_blender_static = 'false'
@@ -313,7 +313,7 @@ elif sys.platform == 'win32':
     # SOLID library information
     solid_lib = ['extern/solid']
     solid_libpath = ['#../lib/windows/solid/lib']
-    solid_include = ['#../lib/windows/solid/include']
+    solid_include = ['#extern/solid']
     qhull_lib = ['qhull']
     qhull_libpath = ['#../lib/windows/qhull/lib']
     qhull_include = ['#extern/qhull/include']
@@ -391,7 +391,7 @@ elif string.find (sys.platform, 'sunos') != -1:
     # SOLID library information
     solid_lib = []                                              # TODO
     solid_libpath = []                                          # TODO
-    solid_include = ['#extern/solid/include']
+    solid_include = ['#extern/solid']
     qhull_lib = []                                              # TODO
     qhull_libpath = []                                          # TODO
     qhull_include = ['#extern/qhull/include']
@@ -558,7 +558,7 @@ elif sys.platform=='openbsd3':
     # SOLID library information
     solid_lib = []                     # TODO
     solid_libpath = []        # TODO
-    solid_include = ['#extern/solid/include']
+    solid_include = ['#extern/solid']
     qhull_lib = []       # TODO
     qhull_libpath = []  # TODO
     qhull_include = ['#extern/qhull/include']
@@ -617,10 +617,10 @@ else:
     config.write ("BUILD_DIR = %r\n"%(root_build_dir))
     config.write ("USE_INTERNATIONAL = %r\n"%(use_international))
     config.write ("BUILD_GAMEENGINE = %r\n"%(use_gameengine))
-    if use_sumo == 'true':
-        config.write ("USE_PHYSICS = 'solid'\n")
-    else:
+    if use_ode == 'true':
         config.write ("USE_PHYSICS = 'ode'\n")
+    else:
+        config.write ("USE_PHYSICS = 'solid'\n")
     config.write ("USE_OPENAL = %r\n"%(use_openal))
     config.write ("USE_FMOD = %r\n"%(use_fmod))
     config.write ("USE_QUICKTIME = %r\n"%(use_quicktime))
@@ -903,9 +903,7 @@ if user_options_dict['BUILD_GAMEENGINE'] == 1:
                            'NG_network',
                            'NG_loopbacknetwork'])
     if user_options_dict['USE_PHYSICS'] == 'solid':
-        link_env.Append (LIBS=['PHY_Sumo'])
-        link_env.Append (LIBS=['extern_qhull',
-                               'extern_solid'])
+        link_env.Append (LIBS=['PHY_Sumo', 'PHY_Physics', 'blender_MT', 'extern_solid', 'extern_qhull'])
     else:
         link_env.Append (LIBS=['PHY_Ode',
                                'PHY_Physics'])
index 3af54e31e62d2d1383ac74771e25eb25e851bb86..22a09a99345f012bee118d8dbf4c3dbd008d6336 100644 (file)
@@ -1,10 +1,17 @@
+import sys
+
 qhull_env = Environment()
 
 # Import the C flags set in the SConstruct file
 Import ('cflags')
 Import ('defines')
 Import ('user_options_dict')
-qhull_env.Append (CCFLAGS = cflags)
+if sys.platform=='linux2' or sys.platform=='linux-i386':
+       qhull_env.Append (CCFLAGS = ['-O2', '-ansi'])
+elif sys.platform=='sunos':
+       qhull_env.Append (CCFLAGS = ['Xc', '-v', '-fast'])
+else:
+       qhull_env.Append (CCFLAGS = cflags)
 qhull_env.Append (CPPDEFINES = defines)
 
 source_files = ['src/geom.c',
index e23da8f59ee220fd61a1204018cfc678e7727e02..5e55b21efec6edc6e1503edd46c1149b67e7c165 100644 (file)
@@ -13,6 +13,9 @@ cxxflags = []
 if sys.platform=='win32':
     defines += ['WIN32','NDEBUG', '_WINDOWS', '_LIB']
     cflags += ['/MT', '/W3', '/GX', '/O2']
+elif sys.platform=='linux2' or sys.platform=='linux-i386':
+    defines += ['NDEBUG']
+    cflags += ['-O2']
 else:
     print "################################################"
     print 
diff --git a/extern/solid/SOLID/SOLID.h b/extern/solid/SOLID/SOLID.h
new file mode 100644 (file)
index 0000000..906be72
--- /dev/null
@@ -0,0 +1,276 @@
+/*
+ * SOLID - Software Library for Interference Detection
+ * 
+ * Copyright (C) 2001-2003  Dtecta.  All rights reserved.
+ *
+ * This library may be distributed under the terms of the Q Public License
+ * (QPL) as defined by Trolltech AS of Norway and appearing in the file
+ * LICENSE.QPL included in the packaging of this file.
+ *
+ * This library may be distributed and/or modified under the terms of the
+ * GNU General Public License (GPL) version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Commercial use or any other use of this library not covered by either 
+ * the QPL or the GPL requires an additional license from Dtecta. 
+ * Please contact info@dtecta.com for enquiries about the terms of commercial
+ * use of this library.
+ */
+
+#ifndef SOLID_H
+#define SOLID_H
+
+#include "SOLID_types.h"
+
+#ifdef __cplusplus
+extern "C" { 
+#endif
+    
+       DT_DECLARE_HANDLE(DT_ObjectHandle);
+       DT_DECLARE_HANDLE(DT_SceneHandle);
+       DT_DECLARE_HANDLE(DT_ShapeHandle);
+       DT_DECLARE_HANDLE(DT_VertexBaseHandle);
+       DT_DECLARE_HANDLE(DT_RespTableHandle);
+       DT_DECLARE_HANDLE(DT_ArchiveHandle);
+
+       typedef unsigned int DT_ResponseClass;
+
+       typedef enum DT_ResponseType { 
+               DT_NO_RESPONSE,                  /* No response (obsolete) */              
+               DT_SIMPLE_RESPONSE,              /* No collision data */
+               DT_WITNESSED_RESPONSE,           /* A point common to both objects
+                                                                                       is returned as collision data
+                                                                                */
+               DT_DEPTH_RESPONSE                /* The penetration depth is returned
+                                                                                       as collision data. The penetration depth
+                                                                                       is the shortest vector over which one 
+                                                                                       object needs to be translated in order
+                                                                                       to bring the objects in touching contact. 
+                                                                                */ 
+       } DT_ResponseType;
+    
+/* For witnessed response, the following structure represents a common point. The world 
+   coordinates of 'point1' and 'point2' coincide. 'normal' is the zero vector.
+   
+   For depth response, the following structure represents the penetration depth. 
+   'point1' en 'point2' are the witness points of the penetration depth in world coordinates.
+   The penetration depth vector in world coordinates is represented by 'normal'.
+*/
+
+       typedef struct DT_CollData {
+               DT_Vector3 point1;               /* Point in object1 in world coordinates */ 
+               DT_Vector3 point2;               /* Point in object2 in world coordinates */
+               DT_Vector3 normal;               /* point2 - point1 */ 
+       } DT_CollData;
+
+/* A response callback is called by SOLID for each pair of collding objects. 'client-data'
+   is a pointer to an arbitrary structure in the client application. The client objects are
+   pointers to structures in the client application associated with the coliding objects.
+   'coll_data' is the collision data computed by SOLID.
+*/
+
+       typedef DT_Bool (*DT_ResponseCallback)(void *client_data,
+                                                                                  void *client_object1,
+                                                                                  void *client_object2,
+                                                                                  const DT_CollData *coll_data);
+                                                                               
+/* Shape definition */
+
+
+       extern DECLSPEC DT_ShapeHandle DT_NewBox(DT_Scalar x, DT_Scalar y, DT_Scalar z);
+       extern DECLSPEC DT_ShapeHandle DT_NewCone(DT_Scalar radius, DT_Scalar height);
+       extern DECLSPEC DT_ShapeHandle DT_NewCylinder(DT_Scalar radius, DT_Scalar height);
+       extern DECLSPEC DT_ShapeHandle DT_NewSphere(DT_Scalar radius);
+       extern DECLSPEC DT_ShapeHandle DT_NewPoint(const DT_Vector3 point);
+       extern DECLSPEC DT_ShapeHandle DT_NewLineSegment(const DT_Vector3 source, const DT_Vector3 target);
+       extern DECLSPEC DT_ShapeHandle DT_NewMinkowski(DT_ShapeHandle shape1, DT_ShapeHandle shape2);
+       extern DECLSPEC DT_ShapeHandle DT_NewHull(DT_ShapeHandle shape1, DT_ShapeHandle shape2);
+
+       extern DECLSPEC DT_VertexBaseHandle DT_NewVertexBase(const void *pointer, DT_Size stride);
+       extern DECLSPEC void DT_DeleteVertexBase(DT_VertexBaseHandle vertexBase);       
+       extern DECLSPEC void DT_ChangeVertexBase(DT_VertexBaseHandle vertexBase, const void *pointer);
+
+       extern DECLSPEC DT_ShapeHandle DT_NewComplexShape(DT_VertexBaseHandle vertexBase);
+       extern DECLSPEC void           DT_EndComplexShape();
+
+       extern DECLSPEC DT_ShapeHandle DT_NewPolytope(DT_VertexBaseHandle vertexBase);
+       extern DECLSPEC void           DT_EndPolytope();
+
+       extern DECLSPEC void DT_Begin();
+       extern DECLSPEC void DT_End();
+
+       extern DECLSPEC void DT_Vertex(const DT_Vector3 vertex);
+       extern DECLSPEC void DT_VertexIndex(DT_Index index);
+
+       extern DECLSPEC void DT_VertexIndices(DT_Count count, const DT_Index *indices);
+       extern DECLSPEC void DT_VertexRange(DT_Index first, DT_Count count); 
+
+       extern DECLSPEC void DT_DeleteShape(DT_ShapeHandle shape);
+
+/* Object  */
+
+       extern DECLSPEC DT_ObjectHandle DT_CreateObject(
+               void *client_object,      /* pointer to object in client memory */
+               DT_ShapeHandle shape  /* the shape or geometry of the object */
+               );
+
+       extern DECLSPEC void DT_DestroyObject(DT_ObjectHandle object);
+
+
+
+       extern DECLSPEC void DT_SetPosition(DT_ObjectHandle object, const DT_Vector3 position);
+       extern DECLSPEC void DT_SetOrientation(DT_ObjectHandle object, const DT_Quaternion orientation);
+       extern DECLSPEC void DT_SetScaling(DT_ObjectHandle object, const DT_Vector3 scaling);
+
+/* The margin is an offset from the actual shape. The actual geometry of an
+   object is the set of points whose distance to the transformed shape is at 
+   most the  margin. During the lifetime of an object the margin can be 
+   modified. 
+*/
+   
+       extern DECLSPEC void DT_SetMargin(DT_ObjectHandle object, DT_Scalar margin);
+
+
+/* These commands assume a column-major 4x4 OpenGL matrix representation */
+
+       extern DECLSPEC void DT_SetMatrixf(DT_ObjectHandle object, const float *m); 
+       extern DECLSPEC void DT_GetMatrixf(DT_ObjectHandle object, float *m); 
+
+       extern DECLSPEC void DT_SetMatrixd(DT_ObjectHandle object, const double *m); 
+       extern DECLSPEC void DT_GetMatrixd(DT_ObjectHandle object, double *m); 
+
+       extern DECLSPEC void DT_GetBBox(DT_ObjectHandle object, DT_Vector3 min, DT_Vector3 max);
+
+
+/* This next command returns the distance between the objects. De returned
+   closest points are given in world coordinates.
+*/
+       extern DECLSPEC DT_Scalar DT_GetClosestPair(DT_ObjectHandle object1, DT_ObjectHandle object2,
+                                                                                               DT_Vector3 point1, DT_Vector3 point2);  
+
+       extern DECLSPEC DT_Bool   DT_GetCommonPoint(DT_ObjectHandle object1, DT_ObjectHandle object2,
+                                                                                               DT_Vector3 point);
+
+       extern DECLSPEC DT_Bool   DT_GetPenDepth(DT_ObjectHandle object1, DT_ObjectHandle object2,
+                                                                                        DT_Vector3 point1, DT_Vector3 point2);  
+
+/* Scene */
+
+       extern DECLSPEC DT_SceneHandle DT_CreateScene(); 
+       extern DECLSPEC void           DT_DestroyScene(DT_SceneHandle scene);
+
+       extern DECLSPEC void DT_AddObject(DT_SceneHandle scene, DT_ObjectHandle object);
+       extern DECLSPEC void DT_RemoveObject(DT_SceneHandle scene, DT_ObjectHandle object);
+
+/* Note that objects can be assigned to multiple scenes! */
+
+/* Response */
+
+/* Response tables are defined independent of the scenes in which they are used.
+   Multiple response tables can be used in one scene, and a response table
+   can be shared among scenes.
+*/
+       extern DECLSPEC DT_RespTableHandle DT_CreateRespTable(); 
+       extern DECLSPEC void               DT_DestroyRespTable(DT_RespTableHandle respTable); 
+
+/* Responses are defined on (pairs of) response classes. Each response table 
+   maintains its set of response classes.
+*/
+       extern DECLSPEC DT_ResponseClass DT_GenResponseClass(DT_RespTableHandle respTable);
+
+/* To each object for which a response is defined in the response table a
+   response class needs to be assigned. 
+*/
+
+       extern DECLSPEC void DT_SetResponseClass(DT_RespTableHandle respTable,
+                                                                                        DT_ObjectHandle object,
+                                                                                        DT_ResponseClass responseClass);
+
+       extern DECLSPEC void DT_ClearResponseClass(DT_RespTableHandle respTable, 
+                                                                                          DT_ObjectHandle object);
+
+       extern DECLSPEC void DT_CallResponse(DT_RespTableHandle respTable,
+                                                                                DT_ObjectHandle object1,
+                                                                                DT_ObjectHandle object2,
+                                                                                const DT_CollData *coll_data);
+
+/* For each pair of objects multiple responses can be defined. A response is a callback
+   together with its response type and client data. */
+    
+/* Responses can be defined for all pairs of response classes... */
+       extern DECLSPEC void DT_AddDefaultResponse(DT_RespTableHandle respTable,
+                                                                                          DT_ResponseCallback response, 
+                                                                                          DT_ResponseType type, void *client_data);
+
+       extern DECLSPEC void DT_RemoveDefaultResponse(DT_RespTableHandle respTable,
+                                                                                                 DT_ResponseCallback response);
+/* ...per response class... */
+       extern DECLSPEC void DT_AddClassResponse(DT_RespTableHandle respTable,
+                                                                                        DT_ResponseClass responseClass,
+                                                                                        DT_ResponseCallback response,
+                                                                                        DT_ResponseType type, void *client_data);
+
+       extern DECLSPEC void DT_RemoveClassResponse(DT_RespTableHandle respTable,
+                                                                                               DT_ResponseClass responseClass,
+                                                                                               DT_ResponseCallback response);
+
+/* ... and per pair of response classes...*/
+       extern DECLSPEC void DT_AddPairResponse(DT_RespTableHandle respTable,
+                                                                                       DT_ResponseClass responseClass1,
+                                                                                       DT_ResponseClass responseClass2, 
+                                                                                       DT_ResponseCallback response,
+                                                                                       DT_ResponseType type, void *client_data);
+       extern DECLSPEC void DT_RemovePairResponse(DT_RespTableHandle respTable,
+                                                                                          DT_ResponseClass responseClass1,
+                                                                                          DT_ResponseClass responseClass2,
+                                                                                          DT_ResponseCallback response);
+
+/* The next command calls the response callbacks for all intersecting pairs of objects in a scene. 
+   'DT_Test' returns the number of pairs of objects for which callbacks have been called. 
+*/
+       extern DECLSPEC DT_Count DT_Test(DT_SceneHandle scene, DT_RespTableHandle respTable);
+
+/* Set the maximum relative error in the closest points and penetration depth
+   computation. The default for `max_error' is 1.0e-3. Larger errors result
+   in better performance. Non-positive error tolerances are ignored.
+*/ 
+
+       extern DECLSPEC void DT_SetAccuracy(DT_Scalar max_error);
+
+/* Set the maximum tolerance on relative errors due to rounding.  The default for `tol_error' 
+   is the machine epsilon. Very large tolerances result in false collisions. Setting tol_error too small 
+   results in missed collisions. Non-positive error tolerances are ignored. 
+*/ 
+    
+       extern DECLSPEC void DT_SetTolerance(DT_Scalar tol_error);
+
+
+/* This function returns the client pointer to the first object in a scene hit by the ray 
+   (actually a line segment) defined by the points 'from' en 'to'. The spot is the hit point 
+   on the object in local coordinates. 'normal' is the normal to the surface of the object in
+   world coordinates. The ignore_client pointer is used to make one of the objects transparent.
+
+   NB: Currently ray tests are implemented for spheres, boxes, and meshes only!!
+*/   
+
+       extern DECLSPEC void *DT_RayCast(DT_SceneHandle scene, void *ignore_client,
+                                                                        const DT_Vector3 source, const DT_Vector3 target,
+                                                                        DT_Scalar max_param, DT_Scalar *param, DT_Vector3 normal);
+
+/* Similar, only here a single object is tested and a boolean is returned */
+
+       extern DECLSPEC DT_Bool DT_ObjectRayCast(DT_ObjectHandle object,
+                                                                                        const DT_Vector3 source, const DT_Vector3 target,
+                                                                                        DT_Scalar max_param, DT_Scalar *param, DT_Vector3 normal);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/extern/solid/SOLID/SOLID_broad.h b/extern/solid/SOLID/SOLID_broad.h
new file mode 100644 (file)
index 0000000..74e4214
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * SOLID - Software Library for Interference Detection
+ * 
+ * Copyright (C) 2001-2003  Dtecta.  All rights reserved.
+ *
+ * This library may be distributed under the terms of the Q Public License
+ * (QPL) as defined by Trolltech AS of Norway and appearing in the file
+ * LICENSE.QPL included in the packaging of this file.
+ *
+ * This library may be distributed and/or modified under the terms of the
+ * GNU General Public License (GPL) version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Commercial use or any other use of this library not covered by either 
+ * the QPL or the GPL requires an additional license from Dtecta. 
+ * Please contact info@dtecta.com for enquiries about the terms of commercial
+ * use of this library.
+ */
+
+#ifndef SOLID_BROAD_H
+#define SOLID_BROAD_H
+
+#include "SOLID_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+    
+       DT_DECLARE_HANDLE(BP_SceneHandle);
+       DT_DECLARE_HANDLE(BP_ProxyHandle);
+       
+       typedef void (*BP_Callback)(void *client_data,
+                                                               void *object1,
+                                                               void *object2);
+
+       typedef bool (*BP_RayCastCallback)(void *client_data,
+                                                                          void *object,
+                                                                          const DT_Vector3 source,
+                                                                          const DT_Vector3 target,
+                                                                          DT_Scalar *lambda);
+       
+       extern DECLSPEC BP_SceneHandle BP_CreateScene(void *client_data,
+                                                                                                 BP_Callback beginOverlap,
+                                                                                                 BP_Callback endOverlap);
+       
+       extern DECLSPEC void           BP_DestroyScene(BP_SceneHandle scene);
+       
+       extern DECLSPEC BP_ProxyHandle BP_CreateProxy(BP_SceneHandle scene, 
+                                                                                                 void *object,
+                                                                                                 const DT_Vector3 min, 
+                                                                                                 const DT_Vector3 max);
+       
+       extern DECLSPEC void           BP_DestroyProxy(BP_SceneHandle scene, 
+                                                                                                 BP_ProxyHandle proxy);
+       
+       extern DECLSPEC void BP_SetBBox(BP_ProxyHandle proxy, 
+                                                                       const DT_Vector3 min, 
+                                                                       const DT_Vector3 max);
+       
+       extern DECLSPEC void *BP_RayCast(BP_SceneHandle scene, 
+                                                                        BP_RayCastCallback objectRayCast, 
+                                                                        void *client_data,
+                                                                        const DT_Vector3 source,
+                                                                        const DT_Vector3 target,
+                                                                        DT_Scalar *lambda);            
+       
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/extern/solid/SOLID/SOLID_types.h b/extern/solid/SOLID/SOLID_types.h
new file mode 100644 (file)
index 0000000..630594e
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * SOLID - Software Library for Interference Detection
+ * 
+ * Copyright (C) 2001-2003  Dtecta.  All rights reserved.
+ *
+ * This library may be distributed under the terms of the Q Public License
+ * (QPL) as defined by Trolltech AS of Norway and appearing in the file
+ * LICENSE.QPL included in the packaging of this file.
+ *
+ * This library may be distributed and/or modified under the terms of the
+ * GNU General Public License (GPL) version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * This library is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Commercial use or any other use of this library not covered by either 
+ * the QPL or the GPL requires an additional license from Dtecta. 
+ * Please contact info@dtecta.com for enquiries about the terms of commercial
+ * use of this library.
+ */
+
+#ifndef SOLID_TYPES_H
+#define SOLID_TYPES_H
+
+#ifndef DECLSPEC
+# ifdef WIN32
+#  define DECLSPEC __declspec(dllexport)
+# else
+#  define DECLSPEC
+# endif
+#endif
+
+#define DT_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
+    
+
+typedef unsigned short DT_Index;
+typedef unsigned short DT_Count;
+typedef unsigned int   DT_Size;
+typedef float          DT_Scalar; 
+typedef int            DT_Bool;
+
+#define DT_FALSE 0
+#define DT_TRUE  1
+
+#define DT_CONTINUE 0
+#define DT_DONE 1
+
+typedef DT_Scalar DT_Vector3[3]; 
+typedef DT_Scalar DT_Quaternion[4]; 
+
+#endif
index 30221bc21dd2e686cba1cd0758605be388e58de0..b8fb750e74cfd3d314db7f5895e8f4668734ac51 100644 (file)
@@ -217,7 +217,7 @@ Mesh *add_mesh()
        
        me->size[0]= me->size[1]= me->size[2]= 1.0;
        me->smoothresh= 30;
-       me->texflag= ME_AUTOSPACE;
+       me->texflag= AUTOSPACE;
        me->flag= ME_TWOSIDED;
        me->subdiv= 1;
        me->subdivr = 1;
@@ -398,7 +398,7 @@ void tex_space_mesh(Mesh *me)
 
        boundbox_mesh(me, loc, size);
 
-       if(me->texflag & ME_AUTOSPACE) {
+       if(me->texflag & AUTOSPACE) {
                if(me->key) {
                        kb= me->key->refkey;
                        if (kb) {
index 8900df470cac39396e1657c9e9f8aa52edbeaab4..2fa361a985e20a10fcf55e00469083b5c54755b6 100644 (file)
@@ -258,8 +258,72 @@ typedef enum {
 #define BIFNICONIDS                    (BIFICONID_LAST-BIFICONID_FIRST + 1)
 } BIFIconID;
 
+typedef enum {
+#define BIFCOLORSHADE_FIRST     (COLORSHADE_DARK)
+        COLORSHADE_DARK,
+        COLORSHADE_GREY,
+        COLORSHADE_MEDIUM,
+        COLORSHADE_HILITE,
+        COLORSHADE_LIGHT,
+        COLORSHADE_WHITE,
+#define BIFCOLORSHADE_LAST      (COLORSHADE_WHITE)
+#define BIFNCOLORSHADES         (BIFCOLORSHADE_LAST-BIFCOLORSHADE_FIRST + 1)
+} BIFColorShade;
+
+typedef enum {
+#define BIFCOLORID_FIRST       (BUTGREY)
+       BUTGREY = 0,
+       BUTGREEN,
+       BUTBLUE,
+       BUTSALMON,
+       MIDGREY,
+       BUTPURPLE,
+       BUTYELLOW,
+       REDALERT,
+       BUTRUST,
+       BUTWHITE,
+       BUTDBLUE,
+       BUTPINK,
+       BUTDPINK,
+       BUTMACTIVE,
 
-/* ---------- theme ----------- */
+       BUTIPO,
+       BUTAUDIO,
+       BUTCAMERA,
+       BUTRANDOM,
+       BUTEDITOBJECT,
+       BUTPROPERTY,
+       BUTSCENE,
+       BUTMOTION,
+       BUTMESSAGE,
+       BUTACTION,
+       BUTCD,
+       BUTGAME,
+       BUTVISIBILITY,
+       BUTYUCK,
+       BUTSEASICK,
+       BUTCHOKE,
+       BUTIMPERIAL,
+
+       BUTTEXTCOLOR,
+       BUTTEXTPRESSED,
+       BUTSBACKGROUND,
+       
+       VIEWPORTBACKCOLOR,
+       VIEWPORTGRIDCOLOR,
+       VIEWPORTACTIVECOLOR,
+       VIEWPORTSELECTEDCOLOR,
+       VIEWPORTUNSELCOLOR,
+       
+       EDITVERTSEL, 
+       EDITVERTUNSEL, 
+       EDITEDGESEL, 
+       EDITEDGEUNSEL,
+       
+#define BIFCOLORID_LAST                (EDITEDGEUNSEL)
+#define BIFNCOLORIDS           (BIFCOLORID_LAST-BIFCOLORID_FIRST + 1)
+
+} BIFColorID;
 
 enum {
        TH_AUTO,        /* for buttons, to signal automatic color assignment */
@@ -355,6 +419,8 @@ void        BIF_InitTheme(void);
 void   BIF_SetTheme(struct ScrArea *sa);
 void   BIF_resources_init              (void);
 void   BIF_resources_free              (void);
+void   BIF_colors_init                 (void);
+void   BIF_load_ui_colors              (void);
 
 
 // icon API
@@ -368,4 +434,6 @@ char        *BIF_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
 char   *BIF_ThemeColorsPup(int spacetype);
 
 
+void   BIF_def_color                   (BIFColorID colorid, unsigned char r, unsigned char g, unsigned char b);
+
 #endif /*  BIF_ICONS_H */
index 63dcd0376c9575b0f2a1dc4f9f16ac844bc220e9..a2e153ef519504d047e394dcec97be2c799ccad8 100644 (file)
@@ -74,6 +74,9 @@ extern void do_mballbuts(unsigned short event);
 extern void do_latticebuts(unsigned short event);
 extern void do_fpaintbuts(unsigned short event);
 
+/* dont like it here , rather make a BIF_Buttons_Editing.h or so BM*/
+extern int Buttons_Editing_GetFaceShadows();
+
 /* shading */
 extern void material_panels(void);
 extern void do_matbuts(unsigned short event);
@@ -97,6 +100,9 @@ extern void do_scriptbuts(unsigned short event);
 /* ipowindow */
 extern void do_ipobuts(unsigned short event);  // drawipo.c (bad! ton)
 
+/* uvautocalculation */
+void do_uvautocalculationbuts(unsigned short event);
+void get_uvautocalculationsettings(float *radius,float *cubesize, int *mapdir, int *mapalign);
 /* butspace.c */
 void test_meshpoin_but(char *name, struct ID **idpp);
 void test_obpoin_but(char *name, struct ID **idpp);
@@ -337,6 +343,14 @@ enum {
 #define B_VERTEXSMOOTH 2080
 #define B_MAKESTICKY   2082
 #define B_MAKEVERTCOL  2083
+#define B_CHROMADEPTH  2084
+#define B_ISDEFLECTOR   2085
+#define B_PDEFDAMPING   2086
+#define B_GRAVITY       2087
+#define B_GRAVSTRENGTH  2088
+#define B_GRAVPOWER     2089
+#define B_PDEFRDAMP     2090
+#define B_PDEFPERM      2091
 
 /* *********************** */
 #define B_CURVEBUTS            2200
@@ -416,6 +430,12 @@ enum {
 
 #define B_SOUNDACT_BROWSE      2712
 
+#define B_SETSECTOR                    2713
+#define B_SETPROP                      2714
+#define B_SETACTOR                     2715
+#define B_SETMAINACTOR         2716
+#define B_SETDYNA                      2717
+
 /* *********************** */
 #define B_FPAINTBUTS   2900
 
@@ -508,8 +528,37 @@ enum {
        B_CONSTRAINT_ADD_LOCLIKE,
        B_CONSTRAINT_ADD_ACTION,
        B_CONSTRAINT_ADD_LOCKTRACK,
-       B_CONSTRAINT_ADD_FOLLOWPATH
+       B_CONSTRAINT_ADD_FOLLOWPATH,
+       B_CONSTRAINT_ADD_DISTANCELIMIT
 };
+
+/*+++ BM */
+/* *********************** */
+#define B_UVAUTOCALCBUTS       3400
+enum {
+       B_UVAUTO_REDRAW = 3301,
+               B_UVAUTO_SPHERE,
+               B_UVAUTO_CYLINDER,
+               B_UVAUTO_CYLRADIUS,
+               B_UVAUTO_WINDOW,
+               B_UVAUTO_CUBE,
+               B_UVAUTO_CUBESIZE,
+               B_UVAUTO_STD1,
+               B_UVAUTO_STD2,
+               B_UVAUTO_STD4,
+               B_UVAUTO_STD8,
+               B_UVAUTO_BOUNDS1,
+               B_UVAUTO_BOUNDS2,
+               B_UVAUTO_BOUNDS4,
+               B_UVAUTO_BOUNDS8,
+               B_UVAUTO_TOP,
+               B_UVAUTO_FACE,
+               B_UVAUTO_OBJECT,
+               B_UVAUTO_ALIGNX,
+               B_UVAUTO_ALIGNY         
+};
+/* *********************** */
+/*--- BM */
 /* *********************** */
 
 
index aad025fa759062b4527c616deed73e6860cbfe0f..6b8c2d305a025c39cda64c4ea93482f03585f7df 100644 (file)
 #define REDRAWBUTSSCRIPT       0x401A
 #define REDRAWBUTSLOGIC                0x401B
 #define REDRAWBUTSSHADING      0x401C
+#define REDRAWBUTSGAME         0x401D
 
 #define REDRAWINFO                     0x4021
 #define RENDERPREVIEW          0x4022
 #define REDRAWTEXT             0x402E
 #define REDRAWSOUND                    0x402F
 #define REDRAWACTION           0x4030
+#define REDRAWBUTSCONSTRAINT   0x4034
 #define REDRAWNLA                      0x4031
 #define REDRAWSCRIPT   0x4032
 
index d48e18c177acbb7a3f2359c3a30332471645a296..568baf80845d39d1718a633af402046adfb13619 100644 (file)
@@ -79,8 +79,8 @@ typedef struct bKinematicConstraint{
 
 typedef struct bTrackToConstraint{
        Object          *tar;
-       int                     reserved1; /* Track Axis */
-       int                     reserved2; /* Up Axis */
+       int                     reserved1; /* I'll be using reserved1 and reserved2 as Track and Up flags, not sure if that's what they were intented for anyway. Not sure either if it would create backward incompatibility if I were to rename them. - theeth*/
+       int                     reserved2;
        char            subtarget[32];
 } bTrackToConstraint;
 
@@ -126,6 +126,17 @@ typedef struct bFollowPathConstraint{
        int                     upflag;
 } bFollowPathConstraint;
 
+/* Distance Limiting constraints */
+typedef struct bDistanceLimitConstraint{
+       Object  *tar;
+       char            subtarget[32];
+       float           pad1;
+       float           pad2;
+       float           distance;
+       float           offset[3];
+} bDistanceLimitConstraint;    
+
+
 /* Zero-target constraints */
 typedef struct bRotationConstraint{
        float xmin, xmax;
@@ -133,6 +144,8 @@ typedef struct bRotationConstraint{
        float zmin, zmax;
 } bRotationConstraint;
 
+
+
 /* bConstraint.type */
 #define CONSTRAINT_TYPE_NULL           0
 #define CONSTRAINT_TYPE_CHILDOF                1       /* Unimplemented */
@@ -148,6 +161,7 @@ typedef struct bRotationConstraint{
 #define CONSTRAINT_TYPE_PYTHON         11      /* Unimplemented */
 #define CONSTRAINT_TYPE_ACTION         12
 #define CONSTRAINT_TYPE_LOCKTRACK      13      /* New Tracking constraint that locks an axis in place - theeth */
+#define CONSTRAINT_TYPE_DISTANCELIMIT  14 
 
 /* bConstraint.flag */
 #define CONSTRAINT_EXPAND              0x00000001
@@ -167,6 +181,39 @@ typedef struct bRotationConstraint{
 #define LOCLIKE_X              0x00000001
 #define LOCLIKE_Y              0x00000002
 #define LOCLIKE_Z              0x00000004
+#define LOCSPACE               0x00000008
+
+/* Tracking flags */
+#define LOCK_X         0x00000000
+#define LOCK_Y         0x00000001
+#define LOCK_Z         0x00000002
+
+#define UP_X           0x00000000
+#define UP_Y           0x00000001
+#define UP_Z           0x00000002
+
+#define TRACK_X                0x00000000
+#define TRACK_Y                0x00000001
+#define TRACK_Z                0x00000002
+#define TRACK_nX       0x00000003
+#define TRACK_nY       0x00000004
+#define TRACK_nZ       0x00000005
+
+/* Tracking flags */
+#define LOCK_X         0x00000000
+#define LOCK_Y         0x00000001
+#define LOCK_Z         0x00000002
+
+#define UP_X           0x00000000
+#define UP_Y           0x00000001
+#define UP_Z           0x00000002
+
+#define TRACK_X                0x00000000
+#define TRACK_Y                0x00000001
+#define TRACK_Z                0x00000002
+#define TRACK_nX       0x00000003
+#define TRACK_nY       0x00000004
+#define TRACK_nZ       0x00000005
 
 /* Tracking flags */
 #define LOCK_X         0x00000000
index ebfa3818ef889ece59ffdb292251b626d157f149..8198e5329cd2a2cc4eb492e94b8597319b60c8d8 100644 (file)
@@ -100,7 +100,7 @@ typedef struct Mesh {
 /* **************** MESH ********************* */
 
 /* texflag */
-#define ME_AUTOSPACE   1
+#define AUTOSPACE      1
 
 /* me->flag */
 #define ME_ISDONE              1
index c5fa7aeafd5053a1bdec157e5cfab3541d0f12fb..4553696435183acac523b5c2791a3506057144ea 100644 (file)
@@ -64,6 +64,18 @@ typedef struct BoundBox {
        float vec[8][3];
 } BoundBox;
 
+/* OcInfo and LBuf structs are for the Enji gameengine */
+
+typedef struct OcInfo {
+       float dvec[3];
+       float size[3];
+} OcInfo;
+
+typedef struct LBuf {
+       short tot, max;
+       int pad;
+       struct Object **ob;
+} LBuf;
 
 typedef struct Object {
        ID id;
@@ -153,6 +165,7 @@ typedef struct Object {
         * bit 8: Friction is anisotropic
         * bit 9: Object is a ghost
         * bit 10: Do rigid body dynamics.
+        * bit 11: Use bounding object for physics
         */
        int gameflag;
        /**
@@ -165,6 +178,13 @@ typedef struct Object {
 
        ListBase constraints;
        ListBase nlastrips;
+
+       struct Life *life;
+
+       LBuf lbuf;
+       LBuf port;
+
+       float toonedge, pad2;
 } Object;
 
 /* this work object is defined in object.c */
@@ -250,6 +270,11 @@ extern Object workob;
 #define OB_SOLID               3
 #define OB_SHADED              4
 #define OB_TEXTURE             5
+#define OB_TOON_MONO    6
+#define OB_TOON_COLOR   7
+#define OB_TOON_TRANSP  8
+#define OB_TOON_FLAT    9
+#define OB_TOON_SMOOTH  10
 
 /* dtx: flags */
 #define OB_AXIS                        2
@@ -291,6 +316,7 @@ extern Object workob;
 #define OB_ANISOTROPIC_FRICTION 256
 #define OB_GHOST                       512
 #define OB_RIGID_BODY          1024
+#define OB_BOUNDS              2048
 
 #define OB_COLLISION_RESPONSE  4096
 #define OB_SECTOR              8192
index 9781d3ea1f84b0aa8afbb8dd3d2dff2a72f03fe4..3d6987fe9b78946dd39617e7fdee5f0c85219817 100644 (file)
@@ -63,6 +63,8 @@
 #include "DNA_sound_types.h"
 #include "DNA_text_types.h"
 #include "DNA_view3d_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_world_types.h"
 
 #include "BKE_library.h"
 #include "BKE_global.h"
@@ -87,7 +89,6 @@
 #include "nla.h"       /* For __NLA : Important, do not remove */
 #include "butspace.h" // own module
 
-
 /* internals */
 
 /****/
@@ -346,7 +347,31 @@ void do_logic_buts(unsigned short event)
        if(ob==0) return;
        
        switch(event) {
+
+       case B_SETSECTOR:
+               /* check for inconsistant types */
+               ob->gameflag &= ~(OB_PROP|OB_MAINACTOR|OB_DYNAMIC|OB_ACTOR);
+               ob->dtx |= OB_BOUNDBOX;
+               allqueue(REDRAWBUTSGAME, 0);
+               allqueue(REDRAWVIEW3D, 0);
+               break;
                
+       case B_SETPROP:
+               /* check for inconsistant types */
+               ob->gameflag &= ~(OB_SECTOR|OB_MAINACTOR|OB_DYNAMIC|OB_ACTOR);
+               allqueue(REDRAWBUTSGAME, 0);
+               allqueue(REDRAWVIEW3D, 0);
+               break;
+
+       case B_SETACTOR:
+       case B_SETDYNA:
+       case B_SETMAINACTOR:
+               ob->gameflag &= ~(OB_SECTOR|OB_PROP);
+               allqueue(REDRAWBUTSGAME, 0);
+               allqueue(REDRAWVIEW3D, 0);
+               break;
+
+
        case B_ADD_PROP:
                prop= new_property(PROP_FLOAT);
                make_unique_prop_names(prop->name);
@@ -2246,12 +2271,128 @@ static uiBlock *actuator_menu(void *arg_unused)
        return block;
 }
 
+
+void buttons_enji(uiBlock *block, Object *ob)
+{
+       uiDefBut(block, TOG|INT|BIT|13, B_SETSECTOR, "Sector",
+                        10,205,65,19, &ob->gameflag, 0, 0, 0, 0, 
+                        "All game elements should be in the Sector boundbox");
+       uiDefBut(block, TOG|INT|BIT|14, B_SETPROP, "Prop",
+                        75,205,65,19, &ob->gameflag, 0, 0, 0, 0, 
+                        "An Object fixed within a sector");
+       uiBlockSetCol(block, BUTPURPLE);
+       uiDefBut(block, TOG|INT|BIT|2, B_SETACTOR, "Actor",
+                        140,205,65,19, &ob->gameflag, 0, 0, 0, 0, 
+                        "Objects that are evaluated by the engine ");
+       if(ob->gameflag & OB_ACTOR) {   
+               uiDefBut(block, TOG|INT|BIT|0, B_SETDYNA, "Dynamic",
+                                205,205,75,19, &ob->gameflag, 0, 0, 0, 0, 
+                                "Motion defined by laws of physics");
+               uiDefBut(block, TOG|INT|BIT|15, B_SETMAINACTOR, "MainActor",
+                                280,205,70,19, &ob->gameflag, 0, 0, 0, 0, "");
+               
+               if(ob->gameflag & OB_DYNAMIC) {
+                       uiDefBut(block, TOG|INT|BIT|6, B_DIFF, "Do Fh",
+                                        10,185,50,19, &ob->gameflag, 0, 0, 0, 0, 
+                                        "Use Fh settings in Materials");
+                       uiDefBut(block, TOG|INT|BIT|7, B_DIFF, "Rot Fh",
+                                        60,185,50,19, &ob->gameflag, 0, 0, 0, 0, 
+                                        "Use face normal to rotate Object");
+               
+                       uiBlockSetCol(block, BUTGREY);
+                       uiDefBut(block, NUM|FLO, B_DIFF, "Mass:",
+                                        110, 185, 120, 19, &ob->mass, 0.01, 100.0, 10, 0, 
+                                        "The mass of the Object");
+                       uiDefBut(block, NUM|FLO, REDRAWVIEW3D, "Size:",
+                                        230, 185, 120, 19, &ob->inertia, 0.01, 10.0, 10, 0, 
+                                        "Bounding sphere size");
+                       uiDefBut(block, NUM|FLO, B_DIFF, "Damp:",
+                                        10, 165, 100, 19, &ob->damping, 0.0, 1.0, 10, 0, 
+                                        "General movement damping");
+                       uiDefBut(block, NUM|FLO, B_DIFF, "RotDamp:",
+                                        110, 165, 120, 19, &ob->rdamping, 0.0, 1.0, 10, 0, 
+                                        "General rotation damping");
+               }
+       }
+
+}
+
+void buttons_ketsji(uiBlock *block, Object *ob)
+{
+       uiDefButI(block, TOG|BIT|2, B_REDR, "Actor",
+                         10,205,75,19, &ob->gameflag, 0, 0, 0, 0,
+                         "Objects that are evaluated by the engine ");
+       if(ob->gameflag & OB_ACTOR) {   
+               uiDefButI(block, TOG|BIT|9, B_REDR, "Ghost", 85,205,65,19, 
+                                 &ob->gameflag, 0, 0, 0, 0, 
+                                 "Objects that don't restitute collisions (like a ghost)");
+               uiDefButI(block, TOG|BIT|0, B_REDR, "Dynamic", 150,205,65,19, 
+                                 &ob->gameflag, 0, 0, 0, 0, 
+                                 "Motion defined by laws of physics");
+       
+               if(ob->gameflag & OB_DYNAMIC) {
+                       uiDefButI(block, TOG|BIT|10, B_REDR, "Rigid Body", 215,205,135,19, 
+                                         &ob->gameflag, 0, 0, 0, 0, 
+                                         "Enable rolling physics");
+                       uiDefButI(block, TOG|BIT|6, B_DIFF, "Do Fh", 10,185,50,19, 
+                                         &ob->gameflag, 0, 0, 0, 0, 
+                                         "Use Fh settings in Materials");
+                       uiDefButI(block, TOG|BIT|7, B_DIFF, "Rot Fh", 60,185,50,19, 
+                                         &ob->gameflag, 0, 0, 0, 0, 
+                                         "Use face normal to rotate Object");
+                       uiDefButF(block, NUM, B_DIFF, "Mass:", 110, 185, 80, 19, 
+                                         &ob->mass, 0.01, 100.0, 10, 0, 
+                                         "The mass of the Object");
+                       uiDefButF(block, NUM, REDRAWVIEW3D, "Size:", 190, 185, 80, 19, 
+                                         &ob->inertia, 0.01, 10.0, 10, 0, 
+                                         "Bounding sphere size");
+                       uiDefButF(block, NUM, B_DIFF, "Form:", 270, 185, 80, 19, 
+                                         &ob->formfactor, 0.01, 100.0, 10, 0, 
+                                         "Form factor");
+
+                       uiDefButF(block, NUM, B_DIFF, "Damp:", 10, 165, 100, 19, 
+                                         &ob->damping, 0.0, 1.0, 10, 0, 
+                                         "General movement damping");
+                       uiDefButF(block, NUM, B_DIFF, "RotDamp:", 110, 165, 120, 19, 
+                                         &ob->rdamping, 0.0, 1.0, 10, 0, 
+                                         "General rotation damping");
+                       uiDefButI(block, TOG|BIT|8, B_REDR, "Anisotropic", 
+                                         230, 165, 120, 19,
+                                         &ob->gameflag, 0.0, 1.0, 10, 0,
+                                         "Enable anisotropic friction");                       
+               }
+
+               if (ob->gameflag & OB_ANISOTROPIC_FRICTION) {
+                       uiDefButF(block, NUM, B_DIFF, "x friction:", 10, 145, 114, 19,
+                                         &ob->anisotropicFriction[0], 0.0, 1.0, 10, 0,
+                                         "Relative friction coefficient in the x-direction.");
+                       uiDefButF(block, NUM, B_DIFF, "y friction:", 124, 145, 113, 19,
+                                         &ob->anisotropicFriction[1], 0.0, 1.0, 10, 0,
+                                         "Relative friction coefficient in the y-direction.");
+                       uiDefButF(block, NUM, B_DIFF, "z friction:", 237, 145, 113, 19,
+                                         &ob->anisotropicFriction[2], 0.0, 1.0, 10, 0,
+                                         "Relative friction coefficient in the z-direction.");
+               }
+       }
+
+       if (!(ob->gameflag & OB_GHOST)) {
+               uiDefButI(block, TOG|BIT|11, B_REDR, "Bounds", 10, 125, 75, 19,
+                               &ob->gameflag, 0, 0,0, 0,
+                               "Specify a bounds object for physics");
+               if (ob->gameflag & OB_BOUNDS) {
+                       uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Polyheder%x4",
+                               85, 125, 100, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the boundary display type");
+               }
+       }
+}
+
 /* never used, see CVS 1.134 for the code */
 /*  static FreeCamera *new_freecamera(void) */
 
 /* never used, see CVS 1.120 for the code */
 /*  static uiBlock *freecamera_menu(void) */
 
+
 void logic_buts(void)
 {
        ID **idar;
@@ -2262,11 +2403,15 @@ void logic_buts(void)
        bActuator *act;
        uiBlock *block;
        uiBut *but;
+       World *wrld;
        int a;
        short xco, yco, count, width, ycoo;
        char *pupstr, name[32];
        int butreturn = 0;
 
+       wrld= G.scene->world;
+       if(wrld==0) return;
+
        ob= OBACT;
 
        if(ob==0) return;
@@ -2277,47 +2422,13 @@ void logic_buts(void)
        
        uiBlockSetCol(block, TH_BUT_SETTING2);
 
-       uiDefButI(block, TOG|BIT|2, B_REDR, "Actor",
-                        25,205,60,19, &ob->gameflag, 0, 0, 0, 0,
-                        "Objects that are evaluated by the engine ");
-
-       if(ob->gameflag & OB_ACTOR) {   
-               uiDefButI(block, TOG|BIT|9, B_REDR, "Ghost",                    85,205,65,19, &ob->gameflag, 0, 0, 0, 0, "Objects that don't restitute collisions (like a ghost)");
-               uiDefButI(block, TOG|BIT|0, B_REDR, "Dynamic",          150,205,65,19, &ob->gameflag, 0, 0, 0, 0, "Motion defined by laws of physics");
-       
-               if(ob->gameflag & OB_DYNAMIC) {
-                               
-                       uiDefButI(block, TOG|BIT|10, B_REDR, "Rigid Body",      215,205,135,19, &ob->gameflag, 0, 0, 0, 0, "");
-
-                       uiDefButI(block, TOG|BIT|6, B_DIFF, "Do Fh",            10,185,50,19, &ob->gameflag, 0, 0, 0, 0, "Use Fh settings in Materials");
-                       uiDefButI(block, TOG|BIT|7, B_DIFF, "Rot Fh",   60,185,50,19, &ob->gameflag, 0, 0, 0, 0, "Use face normal to rotate Object");
-       
-                       uiDefButF(block, NUM, B_DIFF, "Mass:",                  110, 185, 80, 19, &ob->mass, 0.01, 100.0, 10, 0, "The mass of the Object");
-                       uiDefButF(block, NUM, REDRAWVIEW3D, "Size:",            190, 185, 80, 19, &ob->inertia, 0.01, 10.0, 10, 0, "Bounding sphere size");
-                       uiDefButF(block, NUM, B_DIFF, "Form:",                  270, 185, 80, 19, &ob->formfactor, 0.01, 100.0, 10, 0, "Form factor");
-
-                       uiDefButF(block, NUM, B_DIFF, "Damp:",                  10, 165, 100, 19, &ob->damping, 0.0, 1.0, 10, 0, "General movement damping");
-                       uiDefButF(block, NUM, B_DIFF, "RotDamp:",               110, 165, 120, 19, &ob->rdamping, 0.0, 1.0, 10, 0, "General rotation damping");
-                       uiDefButI(block, TOG|BIT|8, B_REDR, "Anisotropic",              230, 165, 120, 19,
-                                        &ob->gameflag, 0.0, 1.0, 10, 0,
-                                        "Enable anisotropic friction");                        
-               }
-       }
-
-       if (ob->gameflag & OB_ANISOTROPIC_FRICTION) {
-               uiDefButF(block, NUM, B_DIFF, "x friction:",                    10, 145, 114, 19,
-                                &ob->anisotropicFriction[0], 0.0, 1.0, 10, 0,
-                                "Relative friction coefficient in the x-direction.");
-               uiDefButF(block, NUM, B_DIFF, "y friction:",                    124, 145, 113, 19,
-                                &ob->anisotropicFriction[1], 0.0, 1.0, 10, 0,
-                                "Relative friction coefficient in the y-direction.");
-               uiDefButF(block, NUM, B_DIFF, "z friction:",                    237, 145, 113, 19,
-                                &ob->anisotropicFriction[2], 0.0, 1.0, 10, 0,
-                                "Relative friction coefficient in the z-direction.");
-       }
-       
+       if (wrld->physicsEngine == 1)
+               buttons_enji(block, ob);
+       if ( (wrld->physicsEngine == 4) || (wrld->physicsEngine == 2) )
+               buttons_ketsji(block, ob);
+                       
        uiBlockSetCol(block, TH_AUTO);
-       uiDefBut(block, BUT, B_ADD_PROP, "ADD property",                10, 110, 340, 24,
+       uiDefBut(block, BUT, B_ADD_PROP, "ADD property",                10, 90, 340, 24,
                         NULL, 0.0, 100.0, 100, 0,
                         "");
        
@@ -2327,10 +2438,10 @@ void logic_buts(void)
        prop= ob->prop.first;
        while(prop) {
                
-               but= uiDefBut(block, BUT, 1, "Del",             10, (short)(90-20*a), 40, 19, NULL, 0.0, 0.0, 1, (float)a, "");
+               but= uiDefBut(block, BUT, 1, "Del",             10, (short)(70-20*a), 40, 19, NULL, 0.0, 0.0, 1, (float)a, "");
                uiButSetFunc(but, del_property, prop, NULL);
-               uiDefButS(block, MENU, B_CHANGE_PROP, pupstr,           50, (short)(90-20*a), 60, 19, &prop->type, 0, 0, 0, 0, "");
-               but= uiDefBut(block, TEX, 1, "Name:",                                   110, (short)(90-20*a), 105, 19, prop->name, 0, 31, 0, 0, "");
+               uiDefButS(block, MENU, B_CHANGE_PROP, pupstr,           50, (short)(70-20*a), 60, 19, &prop->type, 0, 0, 0, 0, "");
+               but= uiDefBut(block, TEX, 1, "Name:",                                   110, (short)(70-20*a), 105, 19, prop->name, 0, 31, 0, 0, "");
                uiButSetFunc(but, make_unique_prop_names_cb, prop->name, (void*) 1);
                
                if (strcmp(prop->name, "Text") == 0) {
@@ -2340,19 +2451,19 @@ void logic_buts(void)
                }
 
                if(prop->type==PROP_BOOL) {
-                       uiDefButI(block, TOG|BIT|0, B_REDR, "True",             215, (short)(90-20*a), 55, 19, &prop->data, 0, 0, 0, 0, "");
-                       uiDefButI(block, TOGN|BIT|0, B_REDR, "False",   270, (short)(90-20*a), 55, 19, &prop->data, 0, 0, 0, 0, "");
+                       uiDefButI(block, TOG|BIT|0, B_REDR, "True",             215, (short)(70-20*a), 55, 19, &prop->data, 0, 0, 0, 0, "");
+                       uiDefButI(block, TOGN|BIT|0, B_REDR, "False",   270, (short)(70-20*a), 55, 19, &prop->data, 0, 0, 0, 0, "");
                }
                else if(prop->type==PROP_INT) 
-                       uiDefButI(block, NUM, butreturn, "",                    215, (short)(90-20*a), 110, 19, &prop->data, -10000, 10000, 0, 0, "");
+                       uiDefButI(block, NUM, butreturn, "",                    215, (short)(70-20*a), 110, 19, &prop->data, -10000, 10000, 0, 0, "");
                else if(prop->type==PROP_FLOAT) 
-                       uiDefButF(block, NUM, butreturn, "",                    215, (short)(90-20*a), 110, 19, (float*) &prop->data, -10000, 10000, 100, 0, "");
+                       uiDefButF(block, NUM, butreturn, "",                    215, (short)(70-20*a), 110, 19, (float*) &prop->data, -10000, 10000, 100, 0, "");
                else if(prop->type==PROP_STRING) 
-                       uiDefBut(block, TEX, butreturn, "",                             215, (short)(90-20*a), 110, 19, prop->poin, 0, 127, 0, 0, "");
+                       uiDefBut(block, TEX, butreturn, "",                             215, (short)(70-20*a), 110, 19, prop->poin, 0, 127, 0, 0, "");
                else if(prop->type==PROP_TIME) 
-                       uiDefButF(block, NUM, butreturn, "",                    215, (short)(90-20*a), 110, 19, (float*) &prop->data, -10000, 10000, 0, 0, "");
+                       uiDefButF(block, NUM, butreturn, "",                    215, (short)(70-20*a), 110, 19, (float*) &prop->data, -10000, 10000, 0, 0, "");
                
-               uiDefButS(block, TOG|BIT|0, 0, "D",             325, (short)(90-20*a), 20, 19, &prop->flag, 0, 0, 0, 0, "Print Debug info");
+               uiDefButS(block, TOG|BIT|0, 0, "D",             325, (short)(70-20*a), 20, 19, &prop->flag, 0, 0, 0, 0, "Print Debug info");
                
                a++;
                prop= prop->next;
index 950e880f03724979cdc82aa62709347bf4dbc916..70bd128686b5730c297f5f675c1c99c4718465ce 100644 (file)
@@ -1066,10 +1066,10 @@ static void render_panel_render(void)
        uiDefButI(block, TOG|BIT|7,0,"x",               665,50,20,23,&G.scene->r.mode, 0, 0, 0, 0, "Disables time difference in field calculations");
 
        uiDefButI(block, TOG|BIT|17,0,"Gauss",  564,30,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Gaussian sampling filter for antialiasing");
-       uiDefButF(block, NUM,B_DIFF,"",                 624,30,60,20,&G.scene->r.gauss,0.5, 1.5, 100, 2, "Sets the Gaussian filter size)");
+       uiDefButF(block, NUM,B_DIFF,"",                 624,30,60,20,&G.scene->r.gauss,0.5, 1.5, 100, 2, "Sets the Gaussian filter size");
        
        uiDefButI(block, TOG|BIT|9,REDRAWVIEWCAM, "Border",     564,10,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Render a small cut-out of the image");
-       uiDefButI(block, TOG|BIT|2,B_REDR, "Gamma",     624,10,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Enable gamma correction");
+       uiDefButI(block, TOG|BIT|2,0, "Gamma",  624,10,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Enable gamma correction");
 
 
 }
index 27d319df53be4c326273711cd7d0df7b47673e14..39a451ae74e2e4791f1d6edca76a5d63d10ce3aa 100644 (file)
@@ -3229,7 +3229,7 @@ void ob_to_tex_transob(Object *ob, TransOb *tob)
        if(id==0);
        else if( GS(id->name)==ID_ME) {
                me= ob->data;
-               me->texflag &= ~ME_AUTOSPACE;
+               me->texflag &= ~AUTOSPACE;
                tob->loc= me->loc;
                tob->rot= me->rot;
                tob->size= me->size;
index 150a9eca289ceb01f354dc738997c3a65e8cfbb3..2e7a2375ce4cd65807b406c699ebd470f482be9d 100644 (file)
@@ -991,7 +991,7 @@ void sound_init_audio(void)
        hSystem = SYS_GetSystem();
        noaudio = SYS_GetCommandLineInt(hSystem,"noaudio",0);
        
-       if (1)/*(noaudio) intrr: disable game engine audio (openal) */
+       if (noaudio)/*(noaudio) intrr: disable game engine audio (openal) */
                SND_SetDeviceType(snd_e_dummydevice);
 
        ghAudioDeviceInterface = SND_GetAudioDevice();
index a70bd6c6f30a678256c649acf4e60879a4c6e5ee..490fc56c7752838088469e924fbf59c5edbe5022 100644 (file)
 #include "KX_PyConstraintBinding.h"
 
 #include "RAS_OpenGLRasterizer.h"
-#include "RAS_CheckVertexArrays.h"
-
-
-#ifdef WIN32
 #include "RAS_VAOpenGLRasterizer.h"
-#endif
+#include "RAS_GLExtensionManager.h"
 
 #include "NG_LoopBackNetworkDeviceInterface.h"
 #include "SND_DeviceManager.h"
@@ -102,6 +98,9 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
        strcpy (pathname, maggie->name);
        STR_String exitstring = "";
        BlendFileData *bfd= NULL;
+       
+       RAS_GLExtensionManager *extman = new RAS_GLExtensionManager(SYS_GetCommandLineInt(SYS_GetSystem(), "show_extensions", 1));
+       extman->LinkExtensions();
 
        do
        {
@@ -121,17 +120,13 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
                RAS_IRasterizer* rasterizer = NULL;
                
                // let's see if we want to use vertexarrays or not
-#ifdef WIN32
                int usevta = SYS_GetCommandLineInt(syshandle,"vertexarrays",1);
                bool useVertexArrays = (usevta > 0);
                
-               if (useVertexArrays && RAS_SystemSupportsVertexArrays())
+               if (useVertexArrays && extman->QueryVersion(1, 1))
                        rasterizer = new RAS_VAOpenGLRasterizer(canvas);
                else
                        rasterizer = new RAS_OpenGLRasterizer(canvas);
-#else
-               rasterizer = new RAS_OpenGLRasterizer(canvas);
-#endif
                
                // create the inputdevices
                KX_BlenderKeyboardDevice* keyboarddevice = new KX_BlenderKeyboardDevice();
@@ -374,5 +369,10 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
                }
        } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);
 
+       if (extman)
+       {
+               delete extman;
+               extman = NULL;
+       }
        if (bfd) BLO_blendfiledata_free(bfd);
 }
index be87fb0adc2104c0837cced09a9d0cce614d4186..6d85956172e3f4966d42f7bbc8f6067a786a1b94 100644 (file)
@@ -88,8 +88,7 @@ void KX_BlenderPolyMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cach
                        rasty->EnableTextures(false);
                }
                
-               //TF_TWOSIDE == 512, todo, make this a ketsji enum
-               if(m_drawingmode & 512)
+               if(m_drawingmode & RAS_IRasterizer::KX_TWOSIDE)
                {
                        rasty->SetCullFace(false);
                }
@@ -97,6 +96,13 @@ void KX_BlenderPolyMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cach
                {
                        rasty->SetCullFace(true);
                }
+
+               if (m_drawingmode & RAS_IRasterizer::KX_LINES) {
+                       rasty->SetLines(true);
+               }
+               else {
+                       rasty->SetLines(false);
+               }
        }
 
        rasty->SetSpecularity(m_specular[0],m_specular[1],m_specular[2],m_specularity);
index b04ae2a9557f1602a7da7b6feab96d1c411b3d4a..bc3f2ac40358ae007f0ed2dd571ea1faa1d9a07d 100644 (file)
 #include "STR_String.h"
 #include "RAS_BucketManager.h" // for polymaterial (needed for textprinting)
 
+#include "SM_Scene.h"
+#include "SumoPhysicsEnvironment.h"
+#include "KX_SumoPhysicsController.h"
+#include "KX_Scene.h"
+
 KX_BlenderRenderTools::KX_BlenderRenderTools()
 {
 }
@@ -174,29 +179,32 @@ void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmat
                if (objectdrawmode & RAS_IPolyMaterial::SHADOW)
                {
                        // shadow must be cast to the ground, physics system needed here!
-                       // KX_GameObject* gameobj = (KX_GameObject*) this->m_clientobject;
                        MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]);
+                       KX_GameObject *gameobj = (KX_GameObject*) this->m_clientobject;
                        MT_Vector3 direction = MT_Vector3(0,0,-1);
 
                        
                        direction.normalize();
                        direction *= 100000;
 
-                       // MT_Point3 topoint = frompoint + direction;
+                       MT_Point3 topoint = frompoint + direction;
                        MT_Point3 resultpoint;
                        MT_Vector3 resultnormal;
 
                        //todo:
                        //use physics abstraction
-
+                       KX_Scene* kxscene = (KX_Scene*) m_auxilaryClientInfo;
+                       SumoPhysicsEnvironment *spe = dynamic_cast<SumoPhysicsEnvironment *>( kxscene->GetPhysicsEnvironment());
+                       SM_Scene *scene = spe->GetSumoScene();
+                       KX_SumoPhysicsController *spc = dynamic_cast<KX_SumoPhysicsController *>( gameobj->GetPhysicsController());
+                       KX_GameObject *parent = gameobj->GetParent();
+                       if (!spc && parent)
+                               spc = dynamic_cast<KX_SumoPhysicsController *>(parent->GetPhysicsController());
+                       if (parent)
+                               parent->Release();
+                       SM_Object *thisObj = spc?spc->GetSumoObject():NULL;
                        
-                       //SM_Scene* scene = (SM_Scene*) m_auxilaryClientInfo;
-
-                       //SM_Object* hitObj = scene->rayTest(gameobj->GetSumoObject(),frompoint,topoint,
-                       //                                                                       resultpoint, resultnormal);
-
-                       
-                       if (0) //hitObj)
+                       if (scene->rayTest(thisObj, frompoint, topoint, resultpoint, resultnormal))
                        {
                                MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]);
                                MT_Vector3 dir = -(left.cross(resultnormal)).normalized();
@@ -204,19 +212,17 @@ void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmat
                                // for the up vector, we take the 'resultnormal' returned by the physics
                                
                                double maat[16]={
-                                       left[0], left[1],left[2], 0,
-                                       dir[0], dir[1],dir[2],0,
-                                       resultnormal[0],resultnormal[1],resultnormal[2],0,
-                                       0,0,0,1};
+                                               left[0],        left[1],        left[2], 0,
+                                                dir[0],         dir[1],         dir[2], 0,
+                                       resultnormal[0],resultnormal[1],resultnormal[2], 0,
+                                                     0,              0,              0, 1};
                                glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]);
+                               //glMultMatrixd(oglmatrix);
                                glMultMatrixd(maat);
-                                       //      glMultMatrixd(oglmatrix);
                        } else
                        {
                                glMultMatrixd(oglmatrix);
                        }
-
-                       
                } else
                {
 
index 5bc924f642d39fe9a574b1ccd1e9978dd6ef45e7..7f8cc9d152d024f5b5837bbae4a90d0a77a7cd3d 100644 (file)
@@ -39,7 +39,7 @@ include nan_compile.mk
 CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
 
 CPPFLAGS += -I$(OPENGL_HEADERS)
-CPPFLAGS += -I$(NAN_SUMO)/include
+CPPFLAGS += -I$(NAN_SUMO)/include -I$(NAN_SOLID)/include
 CPPFLAGS += -I$(NAN_STRING)/include    
 CPPFLAGS += -I$(NAN_MOTO)/include
 CPPFLAGS += -I$(NAN_BMFONT)/include
@@ -65,6 +65,9 @@ CPPFLAGS += -I../SceneGraph
 CPPFLAGS += -I../../kernel/gen_system
 CPPFLAGS += -I../Network
 CPPFLAGS += -I../Network/LoopBackNetwork
+CPPFLAGS += -I../Physics/common
+CPPFLAGS += -I../Physics/Sumo
+
 ifeq ($(OS),windows)
     CPPFLAGS += -I../../blender
 endif
index 594f516dc77c9f61d8eb69a30b855f36b88e57b4..bb0b31ac49c71356200472ec37174ea28e3d5dec 100755 (executable)
@@ -1,3 +1,4 @@
+import sys
 Import ('user_options_dict')
 Import ('library_env')
 
@@ -33,7 +34,8 @@ kx_blenderhook_env.Append (CPPPATH=['.',
                                     '#source/gameengine/Expressions',
                                     '#source/gameengine/Network',
                                     '#source/gameengine/SceneGraph',
-                                    '#source/gameengine/Physics/Sumo/include',
+                                    '#source/gameengine/Physics/common',
+                                    '#source/gameengine/Physics/Sumo',
                                     '#source/gameengine/Physics/Sumo/Fuzzics/include',
                                     '#source/gameengine/Network/LoopBackNetwork',
                                     '#intern/SoundSystem',
@@ -44,4 +46,7 @@ kx_blenderhook_env.Append (CPPPATH=['.',
 kx_blenderhook_env.Append (CPPPATH = user_options_dict['PYTHON_INCLUDE'])
 kx_blenderhook_env.Append (CPPPATH = user_options_dict['SOLID_INCLUDE'])
 
+if sys.platform=='win32':
+    kx_blenderhook_env.Append (CXXFLAGS = ['/GR'])
+
 kx_blenderhook_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/KX_blenderhook', source=source_files)
index 78967a55ac1fc2945f333efc28c031a14222b0f4..59d7ce16361de688124db225ef323d2b14766447 100644 (file)
@@ -72,8 +72,8 @@ BL_ActionActuator::~BL_ActionActuator()
 }
 
 void BL_ActionActuator::ProcessReplica(){
-       bPose *oldpose = m_pose;
-       bPose *oldbpose = m_blendpose;
+//     bPose *oldpose = m_pose;
+//     bPose *oldbpose = m_blendpose;
        
        m_pose = NULL;
        m_blendpose = NULL;
@@ -99,7 +99,6 @@ bool BL_ActionActuator::Update(double curtime,double deltatime)
 {
        bool bNegativeEvent = false;
        bool bPositiveEvent = false;
-       int numevents = m_events.size();
        bool keepgoing = true;
        bool wrap = false;
        bool apply=true;
@@ -114,7 +113,6 @@ bool BL_ActionActuator::Update(double curtime,double deltatime)
                i--;
                if ((*i)->GetNumber() == 0.0f)
                {
-                       int ka=0;
                        bNegativeEvent = true;
                }
                else
index 962f807f9076abee2d682eb4b4a53f425a8b9100..e3708bc6832cfba115555459c02dc53500550e7b 100644 (file)
@@ -51,22 +51,23 @@ public:
                                                float   stride,
                                                PyTypeObject* T=&Type) 
                : SCA_IActuator(gameobj,T),
+               
+               m_blendframe(0),
+               m_lastpos(0, 0, 0),
+               m_flag(0),
                m_starttime (starttime),
                m_endtime(endtime) ,
                m_localtime(starttime),
                m_lastUpdate(-1),
-               m_propname(propname), 
-               m_action(action),
                m_playtype(playtype),
-               m_flag(0),
                m_blendin(blendin),
-               m_blendframe(0),
-               m_pose(NULL),
-               m_userpose(NULL),
-               m_blendpose(NULL),
                m_priority(priority),
                m_stridelength(stride),
-               m_lastpos(0, 0, 0)
+               m_pose(NULL),
+               m_blendpose(NULL),
+               m_userpose(NULL),
+               m_propname(propname), 
+               m_action(action)
        {
        };
        virtual ~BL_ActionActuator();
index a438eced5d28a96b2275f5e79865dac46b96fb58..b81a6f0eddd175a4f457e7a8ddedbeb286b98213 100644 (file)
@@ -50,9 +50,10 @@ public:
                struct bArmature *arm,
                struct bPose *pose) :
        KX_GameObject(sgReplicationInfo,callbacks),
+               m_armature(arm),
                m_pose(pose),
                m_mrdPose(NULL),
-               m_armature(arm),
+               m_lastframe(0.),
                m_activeAct(NULL),
                m_activePriority(999)
        {}
index c1923bea2d96b82ccee6b1753d1e7186cb1d1cdf..0a5b30118a381fbc3fd9de32a8e26b01b2e0f750 100644 (file)
@@ -62,7 +62,6 @@
 #include "KX_ConvertControllers.h"
 #include "KX_ConvertSensors.h"
 
-#include "KX_GameObject.h"
 #include "SCA_LogicManager.h"
 #include "SCA_EventManager.h"
 #include "SCA_TimeEventManager.h"
@@ -71,6 +70,7 @@
 #include "KX_EmptyObject.h"
 #include "MT_Point3.h"
 #include "MT_Transform.h"
+#include "MT_MinMax.h"
 #include "SCA_IInputDevice.h"
 #include "RAS_TexMatrix.h"
 #include "RAS_ICanvas.h"
@@ -175,9 +175,9 @@ static unsigned int KX_Mcol2uint_new(MCol col)
        unsigned int temp=0;
        unsigned char *cp= (unsigned char *)&temp;
        cp[3]=255;
-       cp[2]= col.r;
+       cp[0]= col.r;
        cp[1]= col.g;
-       cp[0]= col.b;
+       cp[2]= col.b;
        return temp;
 }
 
@@ -580,7 +580,7 @@ void my_tex_space_mesh(Mesh *me)
 
        my_boundbox_mesh(me, loc, size);
        
-       if(me->texflag & ME_AUTOSPACE) {
+       if(me->texflag & AUTOSPACE) {
                if(me->key) {
                        kb= me->key->refkey;
                        if (kb) {
@@ -650,9 +650,9 @@ void my_get_local_bounds(Object *ob, float *centre, float *size)
                size[1]= 0.5*fabs(bb->vec[0][1] - bb->vec[2][1]);
                size[2]= 0.5*fabs(bb->vec[0][2] - bb->vec[1][2]);
                                        
-               centre[0]= (bb->vec[0][0] + bb->vec[4][0])/2.0;
-               centre[1]= (bb->vec[0][1] + bb->vec[2][1])/2.0;
-               centre[2]= (bb->vec[0][2] + bb->vec[1][2])/2.0;
+               centre[0]= 0.5*(bb->vec[0][0] + bb->vec[4][0]);
+               centre[1]= 0.5*(bb->vec[0][1] + bb->vec[2][1]);
+               centre[2]= 0.5*(bb->vec[0][2] + bb->vec[1][2]);
                                        }
 }
        
@@ -699,13 +699,42 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
        objprop.m_ghost = (blenderobject->gameflag & OB_GHOST) != 0;
        objprop.m_dynamic_parent=NULL;
        objprop.m_isdeformable = ((blenderobject->gameflag2 & 2)) != 0;
-       objprop.m_implicitsphere = false;
-       objprop.m_implicitbox = false;
+       objprop.m_boundclass = objprop.m_dyna?KX_BOUNDSPHERE:KX_BOUNDMESH;
        
-       if (blenderobject->dtx & OB_BOUNDBOX)
+       KX_BoxBounds bb;
+       my_get_local_bounds(blenderobject,objprop.m_boundobject.box.m_center,bb.m_extends);
+       if (blenderobject->gameflag & OB_BOUNDS)
        {
-               objprop.m_implicitsphere = (blenderobject->boundtype == OB_BOUND_SPHERE);
-               objprop.m_implicitbox = (blenderobject->boundtype == OB_BOUND_BOX);
+               switch (blenderobject->boundtype)
+               {
+                       case OB_BOUND_BOX:
+                               objprop.m_boundclass = KX_BOUNDBOX;
+                               //mmm, has to be divided by 2 to be proper extends
+                               objprop.m_boundobject.box.m_extends[0]=2.f*bb.m_extends[0];
+                               objprop.m_boundobject.box.m_extends[1]=2.f*bb.m_extends[1];
+                               objprop.m_boundobject.box.m_extends[2]=2.f*bb.m_extends[2];
+                               break;
+                       case OB_BOUND_SPHERE:
+                       {
+                               objprop.m_boundclass = KX_BOUNDSPHERE;
+                               objprop.m_boundobject.c.m_radius = MT_max(bb.m_extends[0], MT_max(bb.m_extends[1], bb.m_extends[2]));
+                               break;
+                       }
+                       case OB_BOUND_CYLINDER:
+                       {
+                               objprop.m_boundclass = KX_BOUNDCYLINDER;
+                               objprop.m_boundobject.c.m_radius = MT_max(bb.m_extends[0], bb.m_extends[1]);
+                               objprop.m_boundobject.c.m_height = 2.f*bb.m_extends[2];
+                               break;
+                       }
+                       case OB_BOUND_CONE:
+                       {
+                               objprop.m_boundclass = KX_BOUNDCONE;
+                               objprop.m_boundobject.c.m_radius = MT_max(bb.m_extends[0], bb.m_extends[1]);
+                               objprop.m_boundobject.c.m_height = 2.f*bb.m_extends[2];
+                               break;
+                       }
+               }
        }
 
        // get Root Parent of blenderobject
@@ -724,13 +753,6 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
        objprop.m_isactor = (blenderobject->gameflag & OB_ACTOR)!=0;
        objprop.m_concave = (blenderobject->boundtype & 4) != 0;
        
-       
-       my_get_local_bounds(blenderobject,objprop.m_boundingbox.m_center,objprop.m_boundingbox.m_extends);
-       //mmm, has to be divided by 2 to be proper extends
-       objprop.m_boundingbox.m_extends[0]*=2.f;
-       objprop.m_boundingbox.m_extends[1]*=2.f;
-       objprop.m_boundingbox.m_extends[2]*=2.f;
-       
        switch (physics_engine)
                {
                        case UseSumo:
index 6395dc26617ceb943da313ba466660e264aa270d..a17ca6a7c19baa895ba08249153f79d132631cd1 100644 (file)
@@ -62,5 +62,4 @@ CValue*               BL_DeformableGameObject::GetReplica()
 
        ProcessReplica(replica);
        return replica;
-
 }
index 7608d98dd1f9d7900937941ca8b5fd294ce6ef55..e9aeb547409efe63af4a063644e951ceccd3aa01 100644 (file)
@@ -54,7 +54,7 @@
 
 bool BL_MeshDeformer::Apply(RAS_IPolyMaterial *mat)
 {
-       int                     i, j, index;
+       size_t                  i, j, index;
        vecVertexArray  array;
        vecIndexArrays  mvarray;
        vecIndexArrays  diarray;
index 90b4dd8328cdfb747e7519745501a9daf66f710a..04e0f3b0628f5fa3e4b82a0e26df84aee76ad2e4 100644 (file)
@@ -49,11 +49,12 @@ public:
        void RecalcNormals();
        virtual void Relink(GEN_Map<class GEN_HashedPtr, void*>*map){};
        BL_MeshDeformer(struct Object* obj, class BL_SkinMeshObject *meshobj):
-               m_transverts(NULL),
-               m_tvtot(0),
-               m_transnors(NULL),
                m_pMeshObject(meshobj),
-               m_bmesh((struct Mesh*)(obj->data)){};
+               m_bmesh((struct Mesh*)(obj->data)),
+               m_transnors(NULL),
+               m_transverts(NULL),
+               m_tvtot(0)
+       {};
        virtual ~BL_MeshDeformer();
        virtual void SetSimulatedTime(double time){};
        virtual bool Apply(class RAS_IPolyMaterial *mat);
index f25bf3bf728f0e96d9e0d2777e8a0f6ecf845ba5..4701422a71f66b5bde95f0f5c0add607cecf340d 100644 (file)
@@ -65,7 +65,7 @@ BL_SkinDeformer::~BL_SkinDeformer()
 
 bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat)
 {
-       int                     i, j, index;
+       size_t                  i, j, index;
        vecVertexArray  array;
 #ifdef __NLA_OLDDEFORM
        vecMVertArray   mvarray;
index 97d3d78073cbb32b40afe0497ec1dba7ca4aa514..549f915a285911fd5ec1aa160437d6fd20ca7899 100644 (file)
@@ -66,8 +66,8 @@ public:
                                                class BL_SkinMeshObject *mesh)
                                                :BL_MeshDeformer(bmeshobj, mesh),
                                                m_armobj(NULL),
-                                               m_defbase(&bmeshobj->defbase),
-                                               m_lastUpdate(-1)
+                                               m_lastUpdate(-1),
+                                               m_defbase(&bmeshobj->defbase)
        {
                /* Build all precalculatable matrices for bones */
 
index 98a5566242154dde36534ec5e186252b8e28538c..2994f4245727952b2fb30e4bcf30e6267aaab83e 100644 (file)
@@ -66,7 +66,7 @@ int BL_SkinMeshObject::FindOrAddDeform(int vtxarray, int mv, struct MDeformVert
        int numvert = ao->m_MvertArrayCache1[vtxarray]->size();
        
        /* Check to see if this has already been pushed */
-       for (int i=0; i<ao->m_MvertArrayCache1[vtxarray]->size(); i++){
+       for (size_t i=0; i<ao->m_MvertArrayCache1[vtxarray]->size(); i++){
                if (mv == (*ao->m_MvertArrayCache1[vtxarray])[i])
                        return i;
        }
@@ -84,7 +84,7 @@ int   BL_SkinMeshObject::FindVertexArray(int numverts,RAS_IPolyMaterial* polymat)
        BL_SkinArrayOptimizer* ao = (BL_SkinArrayOptimizer*)GetArrayOptimizer(polymat);
 
 
-       for (int i=0;i<ao->m_VertexArrayCache1.size();i++)
+       for (size_t i=0;i<ao->m_VertexArrayCache1.size();i++)
        {
                if ( (ao->m_TriangleArrayCount[i] + (numverts-2)) < BUCKET_MAX_TRIANGLES) 
                {
index 40628bd4ee048eb16a0ebfcae34dd55a860d41a5..c81a667ebdd72487de9d042158ee06295b19447a 100644 (file)
@@ -114,7 +114,7 @@ public:
 
        int FindVertexArray(int numverts,RAS_IPolyMaterial* polymat);
        BL_SkinMeshObject(int lightlayer) : RAS_MeshObject (lightlayer)
-       {};
+       { m_class = 1;};
 
        virtual ~BL_SkinMeshObject(){
        };
index 15100cc3a009e8cded1dcf46668c28116816b394..4f5804da9b629497124c99f379ddb3e959481569 100644 (file)
@@ -34,7 +34,6 @@
 #endif
 
 #ifdef WIN32
-
        #pragma warning (disable:4786) // suppress stl-MSVC debug info warning
 #endif
 
@@ -171,120 +170,92 @@ void KX_BlenderSceneConverter::ConvertScene(const STR_String& scenename,
                                                                                        class RAS_IRenderTools* rendertools,
                                                                                        class RAS_ICanvas* canvas)
 {
-       //find out which physics engine
-       Scene *blenderscene = GetSceneForName2(m_maggie, scenename);
+//find out which physics engine
+  Scene *blenderscene = GetSceneForName2(m_maggie, scenename);
 
-       e_PhysicsEngine physics_engine = UseSumo;
+  e_PhysicsEngine physics_engine = UseSumo;
 
-       if (blenderscene)
+  /* FIXME: Force physics engine = sumo.
+     This isn't really a problem - no other physics engines are available. 
+  if (blenderscene)
        {
-               int i=0;
+         int i=0;
                
-               if (blenderscene->world)
+         if (blenderscene->world)
                {
-                       
-                       switch (blenderscene->world->physicsEngine)
+                 switch (blenderscene->world->physicsEngine)
                        {
-                               
-                       case 1:
-                               {
-                                       physics_engine = UseNone;
-                                       break;
-                               };
-                       case 2:
-                               {
-                                       physics_engine = UseSumo;
-                                       break;
-                               }
-                       case 3:
-                               {
-                                       physics_engine = UseODE;
-                                       break;
-                               }
+                                
                        case 4:
-                               {
-                                       physics_engine = UseDynamo;
-                                       break;
-                               }
-                       default:
-                               {
-                                       physics_engine = UseODE;
-                               }
+                         {
+                               physics_engine = UseODE;
+                               break;
+                         }
+                       case 3:
+                         {
+                               physics_engine = UseDynamo;
+                               break;
+                         }
+                       case 2:
+                         {
+                               physics_engine = UseSumo;
+                               break;
+                         };
+                       case 0:
+                         {
+                               physics_engine = UseNone;
+                         }
                        }
+                 
                }
        }
-
-       switch (physics_engine)
+*/
+  switch (physics_engine)
        {
 
-       case UseSumo:
-               {
 #ifdef USE_SUMO_SOLID
-
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new SumoPhysicsEnvironment();
-#else
-                       physics_engine = UseNone;
-                       
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new DummyPhysicsEnvironment();
-
+       case UseSumo:
+               destinationscene ->SetPhysicsEnvironment(new SumoPhysicsEnvironment());
+               break;
 #endif
-                       destinationscene ->SetPhysicsEnvironment(physEnv);
-                       break;
-               }
-       case UseODE:
-               {
 #ifdef USE_ODE
-
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new ODEPhysicsEnvironment();
-#else
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new DummyPhysicsEnvironment();
-
+       case UseODE:
+               destinationscene ->SetPhysicsEnvironment(new ODEPhysicsEnvironment());
+               break;
 #endif //USE_ODE
 
-                       destinationscene ->SetPhysicsEnvironment(physEnv);
-                       break;
-               }
        case UseDynamo:
-               {
-               }
+         {
+         }
 
        case UseNone:
-               {
-               };
+         {
+         }
        default:
-               {
-                       physics_engine = UseNone;
-                       
-                       PHY_IPhysicsEnvironment* physEnv = 
-                               new DummyPhysicsEnvironment();
-                       destinationscene ->SetPhysicsEnvironment(physEnv);
-
-               }
+               physics_engine = UseNone;
+               destinationscene ->SetPhysicsEnvironment(new DummyPhysicsEnvironment());
+               break;
        }
 
-       BL_ConvertBlenderObjects(m_maggie,
-                                                        scenename,
-                                                        destinationscene,
-                                                        m_ketsjiEngine,
-                                                        physics_engine,
-                                                        dictobj,
-                                                        keyinputdev,
-                                                        rendertools,
-                                                        canvas,
-                                                        this,
-                                                        m_alwaysUseExpandFraming
-                                                        );
-
-       m_map_blender_to_gameactuator.clear();
-       m_map_blender_to_gamecontroller.clear();
-
-       m_map_blender_to_gameobject.clear();
-       m_map_mesh_to_gamemesh.clear();
-       m_map_gameobject_to_blender.clear();
+  BL_ConvertBlenderObjects(m_maggie,
+                                                  scenename,
+                                                  destinationscene,
+                                                  m_ketsjiEngine,
+                                                  physics_engine,
+                                                  dictobj,
+                                                  keyinputdev,
+                                                  rendertools,
+                                                  canvas,
+                                                  this,
+                                                  m_alwaysUseExpandFraming
+                                                  );
+
+  m_map_blender_to_gameactuator.clear();
+  m_map_blender_to_gamecontroller.clear();
+
+  m_map_blender_to_gameobject.clear();
+  m_map_mesh_to_gamemesh.clear();
+  m_map_gameobject_to_blender.clear();
 }
 
 
index 0de9ce4bfc367a1eef055925f686ddcad356bff5..1b65158e8c03b7ffcc5f2b23eccc5d5a152ce03c 100644 (file)
@@ -618,7 +618,7 @@ void BL_ConvertActuators(char* maggiename,
                case ACT_CONSTRAINT:
                        {
                                float min = 0.0, max = 0.0;
-                               int locrot;
+                               KX_ConstraintActuator::KX_CONSTRAINTTYPE locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_NODEF;
                                bConstraintActuator *conact 
                                        = (bConstraintActuator*) bact->data;
                                /* convert settings... degrees in the ui become radians  */ 
index 3ec2c3596e5b0f1379f772da47e00874776a2ebb..525674e188799ec8b0e8c6f7d468a6e78ca94c40 100644 (file)
@@ -297,15 +297,13 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                        (blendertouchsensor->name ? blendertouchsensor->name: ""));
                                        
                                        
-                                       //if (gameobj->GetSumoObject())
-                                       //{     
-                                       //      gamesensor = 0;
-                                                       //new KX_TouchSensor(eventmgr,
-                                                       //gameobj,
-                                                       //gameobj->GetSumoObject(),
-                                                       //bFindMaterial,
-                                                       //touchPropOrMatName);
-                                       //}
+                                       if (gameobj->GetPhysicsController())
+                                       {       
+                                               gamesensor = new KX_TouchSensor(eventmgr,
+                                                       gameobj,
+                                                       bFindMaterial,
+                                                       touchPropOrMatName);
+                                       }
                                        
                                }
                                
@@ -324,15 +322,13 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                                touchpropertyname = (char*) (blendertouchsensor->ma->id.name+2);
                                        }
                                        bool bFindMaterial = true;
-                                       //if (gameobj->GetSumoObject())
-                                       //{
-                                       //      gamesensor = 0;
-                                               //new KX_TouchSensor(eventmgr,
-                                               //      gameobj,
-                                               //      gameobj->GetSumoObject(),
-                                               //      bFindMaterial,
-                                               //      touchpropertyname);
-                                       //}
+                                       if (gameobj->GetPhysicsController())
+                                       {       
+                                               gamesensor = new KX_TouchSensor(eventmgr,
+                                                       gameobj,
+                                                       bFindMaterial,
+                                                       touchpropertyname);
+                                       }
                                }
                                break;
                        }
@@ -380,7 +376,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                        //sumoObj->setMargin(blendernearsensor->dist);
                                        //sumoObj->setPosition(gameobj->NodeGetWorldPosition());
                                        bool bFindMaterial = false;
-                                       gamesensor = 0;//new KX_NearSensor(eventmgr,gameobj,blendernearsensor->dist,blendernearsensor->resetdist,bFindMaterial,nearpropertyname,kxscene);
+                                       gamesensor = new KX_NearSensor(eventmgr,gameobj,blendernearsensor->dist,blendernearsensor->resetdist,bFindMaterial,nearpropertyname,kxscene);
                                        
                                }
                                break;
@@ -514,7 +510,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                        
                case SENS_RADAR:
                        {
-                               /*
+                               
                                SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::TOUCH_EVENTMGR);
                                if (eventmgr)
                                {
@@ -540,14 +536,9 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                        //MT_Scalar coneradius = coneheight * (factor / 2);
                                        MT_Scalar coneradius = coneheight * factor;
                                        
-                                       DT_ShapeHandle shape = DT_Cone(coneradius,coneheight);
                                        
                                        // this sumoObject is not deleted by a gameobj, so delete it ourself
                                        // later (memleaks)!
-                                       SM_Object* sumoObj = new SM_Object(shape,NULL,NULL,NULL);
-                                       sumoObj->setMargin(0.0);
-                                       
-                                       sumoObj->setPosition(gameobj->NodeGetWorldPosition());
                                        MT_Scalar smallmargin = 0.0;
                                        MT_Scalar largemargin = 0.1;
                                        
@@ -560,13 +551,12 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                                radaraxis,
                                                smallmargin,
                                                largemargin,
-                                               sumoObj,
                                                bFindMaterial,
                                                radarpropertyname,
                                                kxscene);
                                                
                                }
-                       */
+                       
                                break;
                        }
                case SENS_RAY:
@@ -586,15 +576,13 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                        int axis = blenderraysensor->axisflag;
 
                                        
-                                       gamesensor = 0;
-                                       /*new KX_RaySensor(eventmgr,
+                                       gamesensor = new KX_RaySensor(eventmgr,
                                                                                                  gameobj,
                                                                                                  checkname,
                                                                                                  bFindMaterial,
                                                                                                  distance,
                                                                                                  axis,
-                                                                                                 kxscene->GetSumoScene());
-                               */
+                                                                                                 kxscene);
 
                                }
                                break;
index 7340e933a25a7b1e67e6845aa3dad98df9e3aee1..0350c86ebc815b861ead8eb9ca0dbef26a4efa45 100644 (file)
@@ -42,7 +42,8 @@ CPPFLAGS += -I$(OPENGL_HEADERS)
 CPPFLAGS += -I$(NAN_STRING)/include    
 CPPFLAGS += -I$(NAN_SOUNDSYSTEM)/include    
 CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
-CPPFLAGS += -I$(NAN_FUZZICS)/include -I$(NAN_SUMO)/include -I$(NAN_MOTO)/include
+CPPFLAGS += -I$(NAN_FUZZICS)/include -I$(NAN_SUMO) -I$(NAN_MOTO)/include
+CPPFLAGS += -I$(NAN_SOLID)/include
 CPPFLAGS += -I../../blender
 # these two needed because of blenkernel
 CPPFLAGS += -I../../blender/imbuf
index a488ce8e5244f9c09f9d5faca5162f178dbd1722..315e1be08b945f648be968fb04911a37929da34a 100755 (executable)
@@ -50,7 +50,7 @@ kx_converter_env.Append (CPPPATH = ['.',
                                     '#source/gameengine/Physics/common',
                                     '#source/gameengine/Physics/BlOde',
                                     '#source/gameengine/Physics/Dummy',
-                                    '#source/gameengine/Physics/Sumo/include',
+                                    '#source/gameengine/Physics/Sumo',
                                     '#source/gameengine/Physics/Sumo/Fuzzics/include',
                                     '#source/gameengine/Network/LoopBackNetwork',
                                     '#source/blender/misc',
index 41b9e45df53087fa10210999ab57368dced097d3..18423c4171ff4c8eecef12eef885771e15bfb432 100644 (file)
@@ -45,8 +45,8 @@
 using namespace std;
 
 SCA_AlwaysEventManager::SCA_AlwaysEventManager(class SCA_LogicManager* logicmgr)
-       : m_logicmgr(logicmgr),
-       SCA_EventManager(ALWAYS_EVENTMGR)
+       : SCA_EventManager(ALWAYS_EVENTMGR),
+       m_logicmgr(logicmgr)
 {
 }
 
index b95c42b0baecba138fb787151d3f2ee6f957e081..613a44b09f30d9e5de3632fb09713fd3dabc3560 100644 (file)
@@ -156,6 +156,10 @@ PyMethodDef SCA_ISensor::Methods[] = {
         METH_VARARGS, GetUseNegPulseMode_doc},
        {"setUseNegPulseMode", (PyCFunction) SCA_ISensor::sPySetUseNegPulseMode, 
         METH_VARARGS, SetUseNegPulseMode_doc},
+       {"getInvert", (PyCFunction) SCA_ISensor::sPyGetInvert, 
+        METH_VARARGS, GetInvert_doc},
+       {"setInvert", (PyCFunction) SCA_ISensor::sPySetInvert, 
+        METH_VARARGS, SetInvert_doc},
        {NULL,NULL} //Sentinel
 };
 
index 79dbdbe0dc680a50894094b943e5b18a681a2df9..039f0c148010a9f88b6683422265260d228594a1 100644 (file)
@@ -46,8 +46,8 @@
 SCA_KeyboardManager::SCA_KeyboardManager(SCA_LogicManager* logicmgr,
                                                                                 SCA_IInputDevice* inputdev)
        :       SCA_EventManager(KEYBOARD_EVENTMGR),
-               m_logicmanager(logicmgr),
-               m_inputDevice(inputdev)
+               m_inputDevice(inputdev),
+               m_logicmanager(logicmgr)
 {
 }
 
@@ -70,7 +70,7 @@ void SCA_KeyboardManager::NextFrame(double curtime,double deltatime)
 {
        //const SCA_InputEvent& event = GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
   //   cerr << "SCA_KeyboardManager::NextFrame"<< endl;
-       for (int i=0;i<m_sensors.size();i++)
+       for (unsigned int i=0;i<m_sensors.size();i++)
        {
                SCA_KeyboardSensor* keysensor = (SCA_KeyboardSensor*)m_sensors[i];
                keysensor->Activate(m_logicmanager,NULL);
index f33b73199ceb6e4a4987d5dde557ce166e4043da..62b532ee5a0dc62b0adf5149a81207052abce8ac 100644 (file)
@@ -50,13 +50,6 @@ SCA_LogicManager::SCA_LogicManager()
 
 SCA_LogicManager::~SCA_LogicManager()
 {
-       for (vector<SCA_EventManager*>::iterator it = m_eventmanagers.begin();!(it==m_eventmanagers.end());it++)
-       {
-               delete (*it);
-       }
-       m_eventmanagers.clear();
-       m_sensorcontrollermapje.clear();
-
        int numgameobj = m_mapStringToGameObjects.size();
        for (int i = 0; i < numgameobj; i++)
        {
@@ -73,6 +66,12 @@ SCA_LogicManager::~SCA_LogicManager()
                delete controllerarray;
        }
        */
+       for (vector<SCA_EventManager*>::iterator it = m_eventmanagers.begin();!(it==m_eventmanagers.end());it++)
+       {
+               delete (*it);
+       }
+       m_eventmanagers.clear();
+       m_sensorcontrollermapje.clear();
 }
 
 
index 8d968e0e54d536d0b0d1627dbd3b74b902d30b68..96abe2c9135db4bde568d1d744c3c927a8128655 100644 (file)
@@ -52,8 +52,8 @@
 SCA_MouseManager::SCA_MouseManager(SCA_LogicManager* logicmgr,
                                                                   SCA_IInputDevice* mousedev)
        :       SCA_EventManager(MOUSE_EVENTMGR),
-               m_logicmanager(logicmgr),
-               m_mousedevice (mousedev)
+               m_mousedevice (mousedev),
+               m_logicmanager(logicmgr)
 {
        m_xpos = 0;
        m_ypos = 0;
@@ -78,7 +78,7 @@ void SCA_MouseManager::NextFrame(double curtime,double deltatime)
 {
        if (m_mousedevice)
        {
-               for (int i = 0; i < m_sensors.size(); i++)
+               for (unsigned int i = 0; i < m_sensors.size(); i++)
                {
                        SCA_MouseSensor* mousesensor = (SCA_MouseSensor*) m_sensors[i];
                        // (0,0) is the Upper Left corner in our local window
index dfb6e3f644b9283684067699854d4c67d68f94f5..e4820e00f70ed24809a4d6d305512ea4e36b9305 100644 (file)
 /* ------------------------------------------------------------------------- */
 
 SCA_PropertyActuator::SCA_PropertyActuator(SCA_IObject* gameobj,CValue* sourceObj,const STR_String& propname,const STR_String& expr,int acttype,PyTypeObject* T )
-:  SCA_IActuator(gameobj,T),
-m_propname(propname),
-m_exprtxt(expr),
-m_type(acttype),
-m_sourceObj(sourceObj)
+   :   SCA_IActuator(gameobj,T),
+       m_type(acttype),
+       m_propname(propname),
+       m_exprtxt(expr),
+       m_sourceObj(sourceObj)
 {
 }
 
index 6fceddcb5f889a0a79eeb9d4d15e3480d3095928..448de10738182b55cb618ce0250033104f9ac436 100644 (file)
@@ -53,12 +53,12 @@ SCA_PropertySensor::SCA_PropertySensor(SCA_EventManager* eventmgr,
                                                                         KX_PROPSENSOR_TYPE checktype,
                                                                         PyTypeObject* T )
        : SCA_ISensor(gameobj,eventmgr,T),
-         m_checkpropname(propname),
+         m_checktype(checktype),
          m_checkpropval(propval),
          m_checkpropmaxval(propmaxval),
-         m_checktype(checktype),
-         m_range_expr(NULL),
-         m_lastresult(false)
+         m_checkpropname(propname),
+         m_lastresult(false),
+         m_range_expr(NULL)
 {
        m_recentresult=false;
        //CParser pars;
index 0d2f74c14cc416bdcd6359b63d0afc350daa7f5d..a96e17e67d280558eff5ed89531833c4f52ffe86 100644 (file)
@@ -50,9 +50,9 @@ SCA_PythonController* SCA_PythonController::m_sCurrentController = NULL;
 SCA_PythonController::SCA_PythonController(SCA_IObject* gameobj,
                                                                                   PyTypeObject* T)
        : SCA_IController(gameobj, T),
-       m_pythondictionary(NULL),
        m_bytecode(NULL),
-       m_bModified(true)
+       m_bModified(true),
+       m_pythondictionary(NULL)
 {
 }
 
@@ -285,10 +285,8 @@ PyObject* SCA_PythonController::PyGetActuators(PyObject* self,
                                                                   PyObject* args, 
                                                                   PyObject* kwds)
 {
-       int index;
-       
        PyObject* resultlist = PyList_New(m_linkedactuators.size());
-       for (index=0;index<m_linkedactuators.size();index++)
+       for (unsigned int index=0;index<m_linkedactuators.size();index++)
        {
                PyList_SetItem(resultlist,index,m_linkedactuators[index]->AddRef());
        }
@@ -310,8 +308,7 @@ SCA_PythonController::PyGetSensor(PyObject* self,
                return NULL;
        }
        
-       int index;
-       for (index=0;index<m_linkedsensors.size();index++)
+       for (unsigned int index=0;index<m_linkedsensors.size();index++)
        {
                SCA_ISensor* sensor = m_linkedsensors[index];
                STR_String realname = sensor->GetName();
@@ -341,8 +338,7 @@ SCA_PythonController::PyGetActuator(PyObject* self,
                return NULL;
        }
        
-       int index;
-       for (index=0;index<m_linkedactuators.size();index++)
+       for (unsigned int index=0;index<m_linkedactuators.size();index++)
        {
                SCA_IActuator* actua = m_linkedactuators[index];
                STR_String realname = actua->GetName();
@@ -363,10 +359,8 @@ SCA_PythonController::PyGetSensors(PyObject* self,
                                                                 PyObject* args, 
                                                                 PyObject* kwds)
 {
-       int index;
-       
        PyObject* resultlist = PyList_New(m_linkedsensors.size());
-       for (index=0;index<m_linkedsensors.size();index++)
+       for (unsigned int index=0;index<m_linkedsensors.size();index++)
        {
                PyList_SetItem(resultlist,index,m_linkedsensors[index]->AddRef());
        }
index 350b2f58b06c09d5158468e9af4150b80e4b71ff..4347e5cef6767a1b57ee876d16fc786973583bbe 100644 (file)
@@ -56,10 +56,10 @@ SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj,
                                                                         const STR_String &propName,
                                                                         PyTypeObject* T)
        : SCA_IActuator(gameobj, T),
-         m_distribution(mode),
          m_propname(propName),
          m_parameter1(para1),
-         m_parameter2(para2) 
+         m_parameter2(para2),
+         m_distribution(mode)
 {
        m_base = new SCA_RandomNumberGenerator(seed);
        m_counter = 0;
@@ -94,7 +94,7 @@ bool SCA_RandomActuator::Update(double curtime,double deltatime)
        RemoveAllEvents();
 
 
-       CValue *tmpval;
+       CValue *tmpval = NULL;
 
        if (bNegativeEvent)
                return false; // do nothing on negative events
@@ -241,7 +241,15 @@ bool SCA_RandomActuator::Update(double curtime,double deltatime)
        }
        break;
        default:
-               ; /* unknown distribution... */
+       {
+               /* unknown distribution... */
+               static bool randomWarning = false;
+               if (!randomWarning) {
+                       randomWarning = true;
+                       std::cout << "RandomActuator '" << GetName() << "' has an unknown distribution." << std::endl;
+               }
+               return false;
+       }
        }
 
        /* Round up: assign it */
index ee517e5b91596c783da483e2574fa69d6fae7f8e..17cfa351994f64fc3506ef2c0397fb2be12aace8 100644 (file)
@@ -45,8 +45,8 @@ using namespace std;
 #endif
 
 SCA_RandomEventManager::SCA_RandomEventManager(class SCA_LogicManager* logicmgr)
-               : m_logicmgr(logicmgr),
-               SCA_EventManager(RANDOM_EVENTMGR)
+               : SCA_EventManager(RANDOM_EVENTMGR),
+               m_logicmgr(logicmgr)
 {
 }
 
index a9a099bf070510a80e960fad5f8db5a7ad3eb207..7316c62f88ee367593c02732bd1e2fffa4256faf 100644 (file)
@@ -245,13 +245,13 @@ float GPC_Engine::DetermineProgress(void)
        
 void GPC_Engine::UpdateLoadingAnimation(void)
 {
-       int delta;
+       //int delta;
 
        float progress = DetermineProgress();
 
        if(progress > m_previousProgress)
        {
-               delta = progress - m_previousProgress;
+//             delta = progress - m_previousProgress;
                m_previousProgress = progress;
                if(m_previousProgress > 1.0)
                        m_previousProgress = 1.0;  // limit to 1.0 (has to change !)
index df34afac615a6d721cac08b855ebf6db8e43a994..26b4926ec97006f483fe0f6a31896e27ce8d3ec2 100644 (file)
@@ -324,14 +324,14 @@ int my_set_tpage(TFace *tface)
                
                if (!fDoMipMap)
                {
-                       glTexImage2D(GL_TEXTURE_2D, 0,  GL_RGBA,  rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+                       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,  rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
                } else
                {
                        int minfilter= fLinearMipMap?GL_LINEAR_MIPMAP_LINEAR:GL_LINEAR_MIPMAP_NEAREST;
                        
-                       gluBuild2DMipmaps(GL_TEXTURE_2D, 4, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect);
+                       gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect);
                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minfilter);
                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
                }
index 2c455f44b7275f24ccbbf5e45d3be804c13d219e..3a7520861f9d4c0b499353ae3ba2875ea5b120e8 100644 (file)
 #include "IMB_imbuf_types.h"
 // End of Blender includes
 
+#include "SM_Scene.h"
+#include "SumoPhysicsEnvironment.h"
+#include "KX_SumoPhysicsController.h"
+#include "KX_Scene.h"
+
 
 GPC_RenderTools::GPC_RenderTools()
 {
@@ -454,8 +459,8 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in
                if (objectdrawmode & RAS_IPolyMaterial::SHADOW)
                {
                        // shadow must be cast to the ground, physics system needed here!
-                       KX_GameObject* gameobj = (KX_GameObject*) this->m_clientobject;
                        MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]);
+                       KX_GameObject *gameobj = (KX_GameObject*) this->m_clientobject;
                        MT_Vector3 direction = MT_Vector3(0,0,-1);
 
                        
@@ -466,16 +471,20 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in
                        MT_Point3 resultpoint;
                        MT_Vector3 resultnormal;
 
-                       //todo: replace by physicsenvironment raycast
-
-                       //SM_Scene* scene = (SM_Scene*) m_auxilaryClientInfo;
-
-                       SM_Object* hitObj = 0;
-                       //scene->rayTest(gameobj->GetSumoObject(),frompoint,topoint,
-                       //                                                                               resultpoint, resultnormal);
-
+                       //todo:
+                       //use physics abstraction
+                       KX_Scene* kxscene = (KX_Scene*) m_auxilaryClientInfo;
+                       SumoPhysicsEnvironment *spe = dynamic_cast<SumoPhysicsEnvironment *>( kxscene->GetPhysicsEnvironment());
+                       SM_Scene *scene = spe->GetSumoScene();
+                       KX_SumoPhysicsController *spc = dynamic_cast<KX_SumoPhysicsController *>( gameobj->GetPhysicsController());
+                       KX_GameObject *parent = gameobj->GetParent();
+                       if (!spc && parent)
+                               spc = dynamic_cast<KX_SumoPhysicsController *>(parent->GetPhysicsController());
+                       if (parent)
+                               parent->Release();
+                       SM_Object *thisObj = spc?spc->GetSumoObject():NULL;
                        
-                       if (hitObj)
+                       if (scene->rayTest(thisObj, frompoint, topoint, resultpoint, resultnormal))
                        {
                                MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]);
                                MT_Vector3 dir = -(left.cross(resultnormal)).normalized();
@@ -483,19 +492,17 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in
                                // for the up vector, we take the 'resultnormal' returned by the physics
                                
                                double maat[16]={
-                                       left[0], left[1],left[2], 0,
-                                       dir[0], dir[1],dir[2],0,
-                                       resultnormal[0],resultnormal[1],resultnormal[2],0,
-                                       0,0,0,1};
+                                               left[0],        left[1],        left[2], 0,
+                                                dir[0],         dir[1],         dir[2], 0,
+                                       resultnormal[0],resultnormal[1],resultnormal[2], 0,
+                                                     0,              0,              0, 1};
                                glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]);
+                               //glMultMatrixd(oglmatrix);
                                glMultMatrixd(maat);
-                                       //      glMultMatrixd(oglmatrix);
                        } else
                        {
                                glMultMatrixd(oglmatrix);
                        }
-
-                       
                } else
                {
 
index 535c2efebcbdfb9d43eb17d33fe9607798a876c6..d10c1f059e018034cd8d586dce2e8c241fc49c5c 100644 (file)
@@ -52,6 +52,7 @@ CPPFLAGS += -I$(NAN_FUZZICS)/include
 CPPFLAGS += -I$(NAN_STRING)/include    
 CPPFLAGS += -I$(NAN_MOTO)/include
 CPPFLAGS += -I$(NAN_SUMO)/include
+CPPFLAGS += -I$(NAN_SOLID)/include
 CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
 
 CPPFLAGS += -I$(NAN_BMFONT)/include
@@ -67,6 +68,8 @@ CPPFLAGS += -I../../../gameengine/Network/LoopBackNetwork
 CPPFLAGS += -I../../../gameengine/Rasterizer
 CPPFLAGS += -I../../../gameengine/SceneGraph
 CPPFLAGS += -I../../../gameengine/Rasterizer/RAS_OpenGLRasterizer
+CPPFLAGS += -I../../../gameengine/Physics/Sumo
+CPPFLAGS += -I../../../gameengine/Physics/common
 
 ###############################
 
index 17e9e77b5d3e0d40dd2c94e5cd70879dfe8679d1..8aedb666c8791b5d62dd001ea23dd57ac44dd861 100644 (file)
@@ -153,6 +153,7 @@ bool GPG_Application::startWindow(STR_String& title,
         * so that the client rectangle has the size requested.
         */
        m_mainWindow->setClientSize(windowWidth, windowHeight);
+       m_mainWindow->setCursorVisibility(false);
 
        success = initEngine(m_mainWindow, stereoMode);
        if (success) {
@@ -179,6 +180,7 @@ bool GPG_Application::startFullScreen(
        setting.frequency = frequency;
 
        fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual);
+       m_mainWindow->setCursorVisibility(false);
 
        success = initEngine(m_mainWindow, stereoMode);
        if (success) {
index 1d631a6f740241223e1fb92e1988e263dce5ba2b..253a7e47b2d242b737dfc33dd0ee63c27479ba38 100644 (file)
@@ -81,6 +81,7 @@ extern "C"
 #include "RAS_IRasterizer.h"
 
 #include "BKE_main.h"
+#include "BKE_utildefines.h"
 
 #ifdef WIN32
 #ifdef NDEBUG
@@ -92,6 +93,8 @@ extern "C"
 const int kMinWindowWidth = 100;
 const int kMinWindowHeight = 100;
 
+char bprogname[FILE_MAXDIR+FILE_MAXFILE];
+
 void usage(char* program)
 {
        char * consoleoption;
@@ -101,18 +104,19 @@ void usage(char* program)
        consoleoption = "";
 #endif
        
-       printf("usage:   %s [-p l t w h] [-f fw fh fb ff] %s[-g gamengineoptions] "
+       printf("usage:   %s -w [-p l t w h] %s[-g gamengineoptions] "
                "-s stereomode filename.blend\n", program, consoleoption);
+       printf("  -w: display in a window\n");
        printf("  -p: specify window position\n");
        printf("       l = window left coordinate\n");
        printf("       t = window top coordinate\n");
        printf("       w = window width\n");
        printf("       h = window height\n");
-       printf("  -f: start game in full screen mode\n");
+/*     printf("  -f: start game in full screen mode\n");
        printf("       fw = full screen mode pixel width\n");
        printf("       fh = full screen mode pixel height\n");
        printf("       fb = full screen mode bits per pixel\n");
-       printf("       ff = full screen mode frequency\n");
+       printf("       ff = full screen mode frequency\n"); */
        printf("  -s: start player in stereo\n");
        printf("       stereomode = hwpageflip or syncdoubling depending on the type of stereo you want\n");
 #ifdef _WIN32
@@ -204,8 +208,8 @@ int main(int argc, char** argv)
        int i;
        bool error = false;
        SYS_SystemHandle syshandle = SYS_GetSystem();
-       bool fullScreen = false;
-       bool fullScreenParFound = false;
+       bool fullScreen = true;
+       bool fullScreenParFound = true;
        bool windowParFound = false;
        bool closeConsole = true;
        int stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO;
@@ -215,8 +219,8 @@ int main(int argc, char** argv)
        int windowTop = 100;
        int windowWidth = 640;
        int windowHeight = 480;
-       int fullScreenWidth = 640;
-       int fullScreenHeight= 480;
+       GHOST_TUns32 fullScreenWidth = 0;
+       GHOST_TUns32 fullScreenHeight= 0;
        int fullScreenBpp = 16;
        int fullScreenFrequency = 60;
        
@@ -225,6 +229,7 @@ int main(int argc, char** argv)
        signal (SIGFPE, SIG_IGN);
 #endif /* __alpha__ */
 #endif /* __linux__ */
+       BLI_where_am_i(bprogname, argv[0]);
        
 #ifdef __APPLE__
     // Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh)
@@ -315,24 +320,12 @@ int main(int argc, char** argv)
                                }
                                break;
                                
-                       case 'f':
+                       case 'w':
                                // Parse window position and size options
                                {
-                                       fullScreen = true;
-                                       i++;
-                                       if ((i + 4) < argc)
-                                       {
-                                               fullScreenWidth = atoi(argv[i++]);
-                                               fullScreenHeight = atoi(argv[i++]);
-                                               fullScreenBpp = atoi(argv[i++]);
-                                               fullScreenFrequency = atoi(argv[i]);
+                                       fullScreen = false;
                                                fullScreenParFound = true;
-                                       }
-                                       else
-                                       {
-                                               error = true;
-                                               printf("error: too few options for fullscreen argument.\n");
-                                       }
+                                       i++;
                                }
                                break;
                        case 'c':
@@ -403,6 +396,7 @@ int main(int argc, char** argv)
                        GHOST_ISystem* system = GHOST_ISystem::getSystem();
                        assertd(system);
                        
+                       system->getMainDisplayDimensions(fullScreenWidth, fullScreenHeight);
                        // process first batch of events. If the user
                        // drops a file on top off the blenderplayer icon, we 
                        // recieve an event with the filename
@@ -570,7 +564,7 @@ int main(int argc, char** argv)
                                                bool run = true;
                                                while (run)
                                                {
-                                                       system->processEvents(true);
+                                                       system->processEvents(false);
                                                        system->dispatchEvents();
                                                        if (exitcode = app.getExitRequested())
                                                        {
index 6b669bcd936cf04f40e7ff84f576077dabaec3ac..69bf4dd69ce70398f066651da824045ef8c170b8 100644 (file)
@@ -64,7 +64,7 @@ MT_Transform KX_Camera::GetWorldToCamera() const
        
        trans.setBasis(NodeGetWorldOrientation());
        trans.setOrigin(NodeGetWorldPosition());
-
+       
        camtrans.invert(trans);
        
        return camtrans;
@@ -95,8 +95,8 @@ const MT_Point3 KX_Camera::GetCameraLocation()
        //return m_trans1.getOrigin();
        //return MT_Point3(0,0,0);   <-----
        /* .... I want it in world coords */
-       MT_Transform trans;
-       trans.setBasis(NodeGetWorldOrientation());
+       //MT_Transform trans;
+       //trans.setBasis(NodeGetWorldOrientation());
        
        return NodeGetWorldPosition();          
 }
index df61aaf5243b27af68a11a184cc72a537db0ba0d..f1286de1bd4afd096edc2c188c6891bdac09ec8b 100644 (file)
@@ -183,8 +183,6 @@ bool KX_CameraActuator::Update(double curtime,double deltatime)
        MT_Point3 lookat = ((KX_GameObject*)m_ob)->NodeGetWorldPosition();
        MT_Matrix3x3 actormat = ((KX_GameObject*)m_ob)->NodeGetWorldOrientation();
 
-
-
        float fp1[3], fp2[3], rc[3];
        float inp, fac; //, factor = 0.0; /* some factor...                                    */
        float mindistsq, maxdistsq, distsq;
index 029aa6d7156e86741592444dfaeccc81e56a4251..d80847fa5fb9001dc7b09828c3f51d43719c9a0d 100644 (file)
@@ -55,11 +55,12 @@ private:
 
        double                  m_ipotime;
 public:
-       KX_CameraIpoSGController() : m_ipotime(0.0),
-                                                               m_modify_lens(false),
-                                                               m_modify_clipstart(false),
-                                                               m_modify_clipend(false),
-                                                               m_modified(true)
+       KX_CameraIpoSGController() : 
+                               m_modify_lens(false),
+                               m_modify_clipstart(false),
+                               m_modify_clipend(false),
+                               m_modified(true),
+                               m_ipotime(0.0)
                {}
 
        ~KX_CameraIpoSGController();
index 0981463ed44bc8748e1a141e986d2787b5bc4a24..51cb19e893528ca8b21f7d4d7f0a2df873465752 100644 (file)
 /**
  * Client Type and Additional Info. This structure can be use instead of a bare void* pointer, for safeness, and additional info for callbacks
  */
-
 struct KX_ClientObjectInfo
 {
-       int                     m_type;
+       enum {
+               STATIC,
+               ACTOR,
+               RESERVED1,
+               RADAR,
+               NEAR
+       }               m_type;
        void*           m_clientobject;
        void*           m_auxilary_info;
+public:
+       KX_ClientObjectInfo(void *clientobject) :
+               m_clientobject(clientobject) 
+       {}
 };
 
 #endif //__KX_CLIENTOBJECT_INFO_H
index 04bec5cb37c66b60752ddd848c0a7fea788623a1..e42ae59e2bb5dfb091c4af2bacffa2ffb0877352 100644 (file)
 KX_ConstraintWrapper::KX_ConstraintWrapper(
                                                PHY_ConstraintType ctype,
                                                int constraintId,
-                                               PHY_IPhysicsEnvironment* physenv,PyTypeObject *T)
-: m_constraintType(ctype),m_constraintId(constraintId),m_physenv(physenv),PyObjectPlus(T)
+                                               PHY_IPhysicsEnvironment* physenv,PyTypeObject *T) :
+               PyObjectPlus(T),
+               m_constraintId(constraintId),
+               m_constraintType(ctype),
+               m_physenv(physenv)
 {
 }
 KX_ConstraintWrapper::~KX_ConstraintWrapper()
index bf40baf5594729c787ed0f0911690442b45bcf03..3ed3e2bfa8fec756b296153cb946fe5cb4aceeea 100644 (file)
 #ifndef KX_CONVERTPHYSICSOBJECTS
 #define KX_CONVERTPHYSICSOBJECTS
 
-
+/* These are defined by the build system... */
 //#define USE_SUMO_SOLID
-//solid is not available yet
-
-#define USE_ODE
+//#define USE_ODE
 
 class RAS_MeshObject;
 class KX_Scene;
 
+typedef enum {
+       KX_BOUNDBOX,
+       KX_BOUNDSPHERE,
+       KX_BOUNDCYLINDER,
+       KX_BOUNDCONE,
+       KX_BOUNDMESH
+} KX_BoundBoxClass;
 
-struct KX_Bounds
+struct KX_BoxBounds
 {
        float m_center[3];
        float m_extends[3];
 };
 
+/* Cone/Cylinder */
+struct KX_CBounds
+{
+       float m_radius;
+       float m_height;
+};
+
+
 struct KX_ObjectProperties
 {
        bool    m_dyna;
@@ -59,9 +72,11 @@ struct KX_ObjectProperties
        bool    m_isactor;
        bool    m_concave;
        bool    m_isdeformable;
-       bool    m_implicitsphere ;
-       bool    m_implicitbox;
-       KX_Bounds       m_boundingbox;
+       KX_BoundBoxClass        m_boundclass;
+       union {
+               KX_BoxBounds    box;
+               KX_CBounds      c;
+       } m_boundobject;
 };
 
 #ifdef USE_ODE
index a6e7daadb2c04bbc1d61df1b848d0d5a7a5e8e37..96716214edc55eddca66b3f1e59c8a5da4199558 100644 (file)
@@ -29,7 +29,9 @@
  *
  * ***** END GPL/BL DUAL LICENSE BLOCK *****
  */
+#ifdef WIN32
 #pragma warning (disable : 4786)
+#endif
 
 // defines USE_ODE to choose physics engine
 #include "KX_ConvertPhysicsObject.h"
@@ -63,7 +65,6 @@
 // USE_SUMO_SOLID is defined in headerfile KX_ConvertPhysicsObject.h
 #ifdef USE_SUMO_SOLID
 
-
 #include "SumoPhysicsEnvironment.h"
 #include "KX_SumoPhysicsController.h"
 
@@ -83,16 +84,15 @@ void        BL_RegisterSumoObject(KX_GameObject* gameobj,class SM_Scene* sumoScene,DT_S
 DT_ShapeHandle CreateShapeFromMesh(RAS_MeshObject* meshobj);
 
 
-void   KX_ConvertSumoObject(   class   KX_GameObject* gameobj,
-                                                       class   RAS_MeshObject* meshobj,
-                                                       class   KX_Scene* kxscene,
-                                                       PHY_ShapeProps* kxshapeprops,
-                                                       PHY_MaterialProps*      kxmaterial,
-                                                       struct  KX_ObjectProperties*    objprop)
+void   KX_ConvertSumoObject(   KX_GameObject* gameobj,
+                               RAS_MeshObject* meshobj,
+                               KX_Scene* kxscene,
+                               PHY_ShapeProps* kxshapeprops,
+                               PHY_MaterialProps*      kxmaterial,
+                               struct  KX_ObjectProperties*    objprop)
 
 
 {
-
        SM_ShapeProps* smprop = new SM_ShapeProps;
 
        smprop->m_ang_drag = kxshapeprops->m_ang_drag;
@@ -105,6 +105,7 @@ void        KX_ConvertSumoObject(   class   KX_GameObject* gameobj,
        smprop->m_inertia = kxshapeprops->m_inertia;
        smprop->m_lin_drag = kxshapeprops->m_lin_drag;
        smprop->m_mass = kxshapeprops->m_mass;
+       smprop->m_radius = objprop->m_radius;
 
 
        SM_MaterialProps* smmaterial = new SM_MaterialProps;
@@ -116,55 +117,48 @@ void      KX_ConvertSumoObject(   class   KX_GameObject* gameobj,
        smmaterial->m_friction = kxmaterial->m_friction;
        smmaterial->m_restitution = kxmaterial->m_restitution;
 
-       class SumoPhysicsEnvironment* sumoEnv =
+       SumoPhysicsEnvironment* sumoEnv =
                (SumoPhysicsEnvironment*)kxscene->GetPhysicsEnvironment();
 
        SM_Scene*       sceneptr = sumoEnv->GetSumoScene();
 
-
-
        SM_Object*      sumoObj=NULL;
 
        if (objprop->m_dyna)
        {
-               
-               DT_ShapeHandle shape    =       DT_Sphere(0.0);
-
-               if (objprop->m_ghost)
+               DT_ShapeHandle shape = NULL;
+               switch (objprop->m_boundclass)
                {
-
-                       sumoObj                                 =       new SM_Object(shape,NULL,smprop,NULL);
-               } else
-               {
-                       sumoObj                                 =       new SM_Object(shape,smmaterial,smprop,NULL);
+                       case KX_BOUNDBOX:
+                               shape = DT_NewBox(objprop->m_boundobject.box.m_extends[0], objprop->m_boundobject.box.m_extends[1], objprop->m_boundobject.box.m_extends[2]);
+                               break;
+                       case KX_BOUNDCYLINDER:
+                               shape = DT_NewCylinder(objprop->m_radius, objprop->m_boundobject.c.m_height);
+                               break;
+                       case KX_BOUNDCONE:
+                               shape = DT_NewCone(objprop->m_radius, objprop->m_boundobject.c.m_height);
+                               break;
+/* Enabling this allows you to use dynamic mesh objects.  It's disabled 'cause it's really slow. */
+                       case KX_BOUNDMESH:
+                               if (meshobj && meshobj->NumPolygons() > 0)
+                               {
+                                       if ((shape = CreateShapeFromMesh(meshobj)))
+                                               break;
+                               }
+                               /* If CreateShapeFromMesh fails, fall through and use sphere */
+                       default:
+                       case KX_BOUNDSPHERE:
+                               shape = DT_NewSphere(objprop->m_radius);
+                               break;
+                               
                }
                
-               double radius =                 objprop->m_radius;
+               sumoObj = new SM_Object(shape, !objprop->m_ghost?smmaterial:NULL,smprop,NULL);
                
-               MT_Scalar margin = radius;//0.5;
-               sumoObj->setMargin(margin);
+               sumoObj->setRigidBody(objprop->m_angular_rigidbody?true:false);
                
-               //if (bRigidBody) 
-               //{
-                       if (objprop->m_in_active_layer)
-                       {
-                               DT_AddObject(sumoEnv->GetSolidScene(),
-                                       sumoObj->getObjectHandle());
-                       }
-               //}
-               
-               if (objprop->m_angular_rigidbody)
-               {
-                       sumoObj->setRigidBody(true);
-               } else
-               {
-                       sumoObj->setRigidBody(false);
-               }
-
-               bool isDynamic = true;
-               bool isActor = true;
-
-               BL_RegisterSumoObject(gameobj,sceneptr,sumoEnv->GetSolidScene(),sumoObj,NULL,isDynamic,isActor);
+               objprop->m_isactor = objprop->m_dyna = true;
+               BL_RegisterSumoObject(gameobj,sceneptr,sumoEnv->GetSolidScene(),sumoObj,NULL,true, true);
                
        } 
        else {
@@ -172,20 +166,40 @@ void      KX_ConvertSumoObject(   class   KX_GameObject* gameobj,
                if (meshobj)
                {
                        int numpolys = meshobj->NumPolygons();
-
                        {
 
                                DT_ShapeHandle complexshape=0;
 
-                               if (objprop->m_implicitbox)
-                               {
-                                       complexshape = DT_Box(objprop->m_boundingbox.m_extends[0],objprop->m_boundingbox.m_extends[1],objprop->m_boundingbox.m_extends[2]);
-                               } else
+                               switch (objprop->m_boundclass)
                                {
-                                       if (numpolys>0)
-                                       {
-                                               complexshape    =       CreateShapeFromMesh(meshobj);
-                                       }
+                                       case KX_BOUNDBOX:
+                                               complexshape = DT_NewBox(objprop->m_boundobject.box.m_extends[0], objprop->m_boundobject.box.m_extends[1], objprop->m_boundobject.box.m_extends[2]);
+                                               break;
+                                       case KX_BOUNDSPHERE:
+                                               complexshape = DT_NewSphere(objprop->m_boundobject.c.m_radius);
+                                               break;
+                                       case KX_BOUNDCYLINDER:
+                                               complexshape = DT_NewCylinder(objprop->m_boundobject.c.m_radius, objprop->m_boundobject.c.m_height);
+                                               break;
+                                       case KX_BOUNDCONE:
+                                               complexshape = DT_NewCone(objprop->m_boundobject.c.m_radius, objprop->m_boundobject.c.m_height);
+                                               break;
+                                       default:
+                                       case KX_BOUNDMESH:
+                                               if (numpolys>0)
+                                               {
+                                                       complexshape = CreateShapeFromMesh(meshobj);
+                                                       //std::cout << "Convert Physics Mesh: " << meshobj->GetName() << std::endl;
+/*                                                     if (!complexshape) 
+                                                       {
+                                                               // Something has to be done here - if the object has no polygons, it will not be able to have
+                                                               //   sensors attached to it. 
+                                                               DT_Vector3 pt = {0., 0., 0.};
+                                                               complexshape = DT_NewSphere(1.0);
+                                                               objprop->m_ghost = evilObject = true;
+                                                       } */
+                                               }
+                                               break;
                                }
                                
                                if (complexshape)
@@ -209,21 +223,7 @@ void       KX_ConvertSumoObject(   class   KX_GameObject* gameobj,
                                        }
                                
                                        
-                                       if (objprop->m_ghost)
-                                       {
-                                               sumoObj = new SM_Object(complexshape,NULL,NULL, dynamicParent); 
-                                       } else
-                                       {
-                                               sumoObj = new SM_Object(complexshape,smmaterial,NULL, dynamicParent);   
-                                       }
-                                       
-                                       if (objprop->m_in_active_layer)
-                                       {
-                                               DT_AddObject(sumoEnv->GetSolidScene(),
-                                                       sumoObj->getObjectHandle());
-                                       }
-                                       
-                                       
+                                       sumoObj = new SM_Object(complexshape,!objprop->m_ghost?smmaterial:NULL,NULL, dynamicParent);    
                                        const STR_String& matname=meshobj->GetMaterialName(0);
 
                                        
@@ -232,7 +232,6 @@ void        KX_ConvertSumoObject(   class   KX_GameObject* gameobj,
                                                matname.ReadPtr(),
                                                objprop->m_dyna,
                                                objprop->m_isactor);
-
                                }
                        }
                }
@@ -264,35 +263,34 @@ void      BL_RegisterSumoObject(KX_GameObject* gameobj,class SM_Scene* sumoScene,DT_S
                KX_SumoPhysicsController* physicscontroller = new KX_SumoPhysicsController(sumoScene,solidscene,sumoObj,motionstate,isDynamic);
                gameobj->SetPhysicsController(physicscontroller);
                physicscontroller->setClientInfo(gameobj);
+               
+               if (!gameobj->getClientInfo())
+                       std::cout << "BL_RegisterSumoObject: WARNING: Object " << gameobj->GetName() << " has no client info" << std::endl;
+               sumoObj->setClientObject(gameobj->getClientInfo());
 
                gameobj->GetSGNode()->AddSGController(physicscontroller);
 
-               //gameobj->GetClientInfo()->m_type = (isActor ? 1 : 0);
+               gameobj->getClientInfo()->m_type = (isActor ? KX_ClientObjectInfo::ACTOR : KX_ClientObjectInfo::STATIC);
                //gameobj->GetClientInfo()->m_clientobject = gameobj;
 
                // store materialname in auxinfo, needed for touchsensors
-               //gameobj->GetClientInfo()->m_auxilary_info = (matname? (void*)(matname+2) : NULL);
+               gameobj->getClientInfo()->m_auxilary_info = (matname? (void*)(matname+2) : NULL);
 
                physicscontroller->SetObject(gameobj->GetSGNode());
-                               
+               
                //gameobj->SetDynamicsScaling(MT_Vector3(1.0, 1.0, 1.0));
 
 };
 
-
-
 DT_ShapeHandle CreateShapeFromMesh(RAS_MeshObject* meshobj)
 {
 
-       DT_ShapeHandleshapeptr = map_gamemesh_to_sumoshape[GEN_HashedPtr(meshobj)];
+       DT_ShapeHandle *shapeptr = map_gamemesh_to_sumoshape[GEN_HashedPtr(meshobj)];
        if (shapeptr)
        {
                return *shapeptr;
        }
        
-       // todo: shared meshes
-       DT_ShapeHandle shape = DT_NewComplexShape();
-       int p=0;
        int numpolys = meshobj->NumPolygons();
        if (!numpolys)
        {
@@ -300,38 +298,80 @@ DT_ShapeHandle CreateShapeFromMesh(RAS_MeshObject* meshobj)
        }
        int numvalidpolys = 0;
 
-
-
-       for (p=0;p<meshobj->m_triangle_indices.size();p++)
+       for (int p=0; p<numpolys; p++)
        {
-               RAS_TriangleIndex& idx = meshobj->m_triangle_indices[p];
-               
+               RAS_Polygon* poly = meshobj->GetPolygon(p);
+       
                // only add polygons that have the collisionflag set
-               if (idx.m_collider)
+               if (poly->IsCollider())
                {
-                       DT_Begin();
-                       for (int v=0;v<3;v++)
-                       {
-                               int num = meshobj->m_xyz_index_to_vertex_index_mapping[idx.m_index[v]].size();
-                               if (num != 1)
-                               {
-                                       int i=0;
-                               }
-                               RAS_MatArrayIndex& vertindex = meshobj->m_xyz_index_to_vertex_index_mapping[idx.m_index[v]][0];
+                       numvalidpolys++;
+                       break;
+               }
+       }
+       
+       if (numvalidpolys < 1)
+               return NULL;
+       
+       DT_ShapeHandle shape = DT_NewComplexShape(NULL);
+       
+       
+       numvalidpolys = 0;
 
-                               numvalidpolys++;
+       for (int p2=0; p2<numpolys; p2++)
+       {
+               RAS_Polygon* poly = meshobj->GetPolygon(p2);
        
-                               {
-                                       const MT_Point3& pt = meshobj->GetVertex(vertindex.m_array, 
-                                                                                                         vertindex.m_index,
-                                                                                                         (RAS_IPolyMaterial*)vertindex.m_matid)->xyz();
-                                       DT_Vertex(pt[0],pt[1],pt[2]);
-                               }
+               // only add polygons that have the collisionflag set
+               if (poly->IsCollider())
+               {   /* We have to tesselate here because SOLID can only raycast triangles */
+                   DT_Begin();
+                       DT_Vector3 pt;
+                       /* V1 */
+                       meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, 
+                               poly->GetVertexIndexBase().m_indexarray[0],
+                               poly->GetMaterial()->GetPolyMaterial())->xyz().getValue(pt);
+                       DT_Vertex(pt);
+                       /* V2 */
+                       meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, 
+                               poly->GetVertexIndexBase().m_indexarray[1],
+                               poly->GetMaterial()->GetPolyMaterial())->xyz().getValue(pt);
+                       DT_Vertex(pt);
+                       /* V3 */
+                       meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, 
+                               poly->GetVertexIndexBase().m_indexarray[2],
+                               poly->GetMaterial()->GetPolyMaterial())->xyz().getValue(pt);
+                       DT_Vertex(pt);
+                       
+                       numvalidpolys++;
+                   DT_End();
+                       
+                       if (poly->VertexCount() == 4)
+                       {
+                           DT_Begin();
+                               /* V1 */
+                               meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, 
+                                       poly->GetVertexIndexBase().m_indexarray[0],
+                                       poly->GetMaterial()->GetPolyMaterial())->xyz().getValue(pt);
+                               DT_Vertex(pt);
+                               /* V3 */
+                               meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, 
+                                       poly->GetVertexIndexBase().m_indexarray[2],
+                                       poly->GetMaterial()->GetPolyMaterial())->xyz().getValue(pt);
+                               DT_Vertex(pt);
+                               /* V4 */
+                               meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, 
+                                       poly->GetVertexIndexBase().m_indexarray[3],
+                                       poly->GetMaterial()->GetPolyMaterial())->xyz().getValue(pt);
+                               DT_Vertex(pt);
+                       
+                               numvalidpolys++;
+                           DT_End();
                        }
-                       DT_End();
+       
                }
        }
-
+       
        DT_EndComplexShape();
 
        if (numvalidpolys > 0)
@@ -340,7 +380,7 @@ DT_ShapeHandle CreateShapeFromMesh(RAS_MeshObject* meshobj)
                return shape;
        }
 
-       // memleak... todo: delete shape
+       delete shape;
        return NULL;
 }
 
index b3e503592243ab79782001008c6d29609777c38e..dcdb9b00087febc13e45a024e7a08c1a6b447ea5 100644 (file)
@@ -113,6 +113,7 @@ bool KX_GameActuator::Update(double curtime, double deltatime)
                        {
                                STR_String exitstring = "restarting game";
                                m_ketsjiengine->RequestExit(KX_EXIT_REQUEST_RESTART_GAME);
+                               m_ketsjiengine->SetNameNextGame(m_filename);
                                m_scene->AddDebugProperty((this)->GetParent(), exitstring);
                        }
                        break;
@@ -146,7 +147,7 @@ bool KX_GameActuator::Update(double curtime, double deltatime)
 PyTypeObject KX_GameActuator::Type = {
        PyObject_HEAD_INIT(&PyType_Type)
                0,
-               "KX_SceneActuator",
+               "KX_GameActuator",
                sizeof(KX_GameActuator),
                0,
                PyDestructor,
@@ -177,9 +178,39 @@ PyParentObject KX_GameActuator::Parents[] =
 
 PyMethodDef KX_GameActuator::Methods[] =
 {
+       {"getFile",     (PyCFunction) KX_GameActuator::sPyGetFile, METH_VARARGS, GetFile_doc},
+       {"setFile", (PyCFunction) KX_GameActuator::sPySetFile, METH_VARARGS, SetFile_doc},
        {NULL,NULL} //Sentinel
 };
 
+/* getFile */
+char KX_GameActuator::GetFile_doc[] = 
+"getFile()\n"
+"get the name of the file to start.\n";
+PyObject* KX_GameActuator::PyGetFile(PyObject* self, PyObject* args, PyObject* kwds)
+{      
+       return PyString_FromString(m_filename);
+}
+
+/* setFile */
+char KX_GameActuator::SetFile_doc[] =
+"setFile(name)\n"
+"set the name of the file to start.\n";
+PyObject* KX_GameActuator::PySetFile(PyObject* self, PyObject* args, PyObject* kwds)
+{
+       char* new_file;
+       
+       if (!PyArg_ParseTuple(args, "s", &new_file))
+       {
+               return NULL;
+       }
+       
+       m_filename = STR_String(new_file);
+
+       Py_Return;
+
+}
+       
 
 
 PyObject* KX_GameActuator::_getattr(char* attr)
index 7f2af86db42d37de039139b38fc5cf46b37d24e6..4f197cf584159c0986342de9934a09e66c6780b3 100644 (file)
@@ -78,7 +78,8 @@ class KX_GameActuator : public SCA_IActuator
        /* --------------------------------------------------------------------- */
 
        virtual PyObject*  _getattr(char *attr);
-
+       KX_PYMETHOD_DOC(KX_GameActuator,GetFile);
+       KX_PYMETHOD_DOC(KX_GameActuator,SetFile);
        
 }; /* end of class KX_GameActuator */
 
index 24f0a36b152ed1924c3b08a1b1c55903d982b87d..2f30ac645a0ed92c75bf23b2f81ebe926b248b26 100644 (file)
@@ -66,14 +66,15 @@ KX_GameObject::KX_GameObject(
        PyTypeObject* T
 ) : 
        SCA_IObject(T),
-       m_bUseObjectColor(false),
        m_bDyna(false),
        m_bSuspendDynamics(false),
-       m_pPhysicsController1(NULL),
-       m_bVisible(true)
+       m_bUseObjectColor(false),
+       m_bVisible(true),
+       m_pPhysicsController1(NULL)
 {
        m_ignore_activity_culling = false;
-       m_pClient_info = new KX_ClientObjectInfo();
+       m_pClient_info = new KX_ClientObjectInfo(this);
+       m_pClient_info->m_type = KX_ClientObjectInfo::ACTOR;
        m_pSGNode = new SG_Node(this,sgReplicationInfo,callbacks);
        
        // define the relationship between this node and it's parent.
@@ -198,7 +199,7 @@ CValue* KX_GameObject::GetReplica()
        // this will copy properties and so on...
        CValue::AddDataToReplica(replica);
        ProcessReplica(replica);
-
+       
        return replica;
 }
 
@@ -222,14 +223,11 @@ void KX_GameObject::ApplyTorque(const MT_Vector3& torque,bool local)
 
 void KX_GameObject::ApplyMovement(const MT_Vector3& dloc,bool local)
 {
-       if (this->IsDynamic()) 
+       if (m_pPhysicsController1) // (IsDynamic())
        {
                m_pPhysicsController1->RelativeTranslate(dloc,local);
        }
-       else
-       {
-               GetSGNode()->RelativeTranslate(dloc,GetSGNode()->GetSGParent(),local);
-       }
+       GetSGNode()->RelativeTranslate(dloc,GetSGNode()->GetSGParent(),local);
 }
 
 
@@ -237,12 +235,14 @@ void KX_GameObject::ApplyMovement(const MT_Vector3& dloc,bool local)
 void KX_GameObject::ApplyRotation(const MT_Vector3& drot,bool local)
 {
        MT_Matrix3x3 rotmat(drot);
+       rotmat.transpose();
        
-       if (this->IsDynamic()) //m_pPhysicsController)
-               m_pPhysicsController1->RelativeRotate(rotmat.transposed(),local);
-       else
-               // in worldspace
-               GetSGNode()->RelativeRotate(rotmat.transposed(),local);
+       //if (m_pPhysicsController1) // (IsDynamic())
+       //      m_pPhysicsController1->RelativeRotate(rotmat_,local); 
+       // in worldspace
+       GetSGNode()->RelativeRotate(rotmat,local);
+       if (m_pPhysicsController1)
+               m_pPhysicsController1->setOrientation(NodeGetWorldOrientation().getRotation());
 }
 
 
@@ -273,7 +273,7 @@ void KX_GameObject::Bucketize()
 {
        double* fl = GetOpenGLMatrix();
 
-       for (int i=0;i<m_meshes.size();i++)
+       for (size_t i=0;i<m_meshes.size();i++)
                m_meshes[i]->Bucketize(fl, this, m_bUseObjectColor, m_objectColor);
 }
 
@@ -283,7 +283,7 @@ void KX_GameObject::RemoveMeshes()
 {
        double* fl = GetOpenGLMatrix();
 
-       for (int i=0;i<m_meshes.size();i++)
+       for (size_t i=0;i<m_meshes.size();i++)
                m_meshes[i]->RemoveFromBuckets(fl, this);
 
        //note: meshes can be shared, and are deleted by KX_BlenderSceneConverter
@@ -315,7 +315,7 @@ void KX_GameObject::UpdateTransform()
 
 void KX_GameObject::SetDebugColor(unsigned int bgra)
 {
-       for (int i=0;i<m_meshes.size();i++)
+       for (size_t i=0;i<m_meshes.size();i++)
                m_meshes[i]->DebugColor(bgra);  
 }
 
@@ -411,9 +411,9 @@ KX_GameObject::MarkVisible(
         * determined on this level. Maybe change this to mesh level
         * later on? */
        
-       for (int i=0;i<m_meshes.size();i++)
+       double* fl = GetOpenGLMatrix();
+       for (size_t i=0;i<m_meshes.size();i++)
        {
-               double* fl = GetOpenGLMatrix();
                m_meshes[i]->MarkVisible(fl,this,visible,m_bUseObjectColor,m_objectColor);
        }
 }
@@ -425,9 +425,9 @@ KX_GameObject::MarkVisible(
        void
        )
 {
-       for (int i=0;i<m_meshes.size();i++)
+       double* fl = GetOpenGLMatrix();
+       for (size_t i=0;i<m_meshes.size();i++)
        {
-               double* fl = GetOpenGLMatrix();
                m_meshes[i]->MarkVisible(fl,
                                         this,
                                         m_bVisible,
@@ -439,8 +439,8 @@ KX_GameObject::MarkVisible(
 
 void KX_GameObject::addLinearVelocity(const MT_Vector3& lin_vel,bool local)
 {
-//     if (m_pPhysicsController1)
-//             m_pPhysicsController1->AddLinearVelocity(lin_vel,local);
+       if (m_pPhysicsController1)
+               m_pPhysicsController1->SetLinearVelocity(lin_vel + m_pPhysicsController1->GetLinearVelocity(),local);
 }
 
 
@@ -972,7 +972,6 @@ PyObject* KX_GameObject::PyGetOrientation(PyObject* self,
        int row,col;
        const MT_Matrix3x3& orient = NodeGetWorldOrientation();
        
-       int index = 0;
        for (row=0;row<3;row++)
        {
                PyObject* veclist = PyList_New(3);
index e23a9a53957c7a4c1bcd3f4caf7916f4364b4a25..6b3101be34d6e105c1237cf6db45ea0760224028 100644 (file)
@@ -217,7 +217,7 @@ public:
         * instance allocated on the heap. Ownership of the new 
         * object belongs with the caller.
         */
-               CValue*                         
+       virtual CValue*                         
        GetReplica(
        );
        
@@ -225,7 +225,7 @@ public:
         * Inherited from CValue -- Makes sure any internal 
         * data owned by this class is deep copied. Called internally
         */
-               void                            
+       virtual void                            
        ProcessReplica(
                KX_GameObject* replica
        );
@@ -340,6 +340,9 @@ public:
                m_pSGNode = node; 
        }
        
+       /**
+        * Deprecated & broken
+        */
                bool                                            
        IsDynamic(
        ) const { 
@@ -549,6 +552,7 @@ public:
         */
        void Resume(void);
        
+       KX_ClientObjectInfo* getClientInfo() { return m_pClient_info; }
        /**
         * @section Python interface functions.
         */
index 8dfced41c1e9096fc055bbefc984f49dad0782de..2152fa35cd1170716fa606fa9a435589dbb35b59 100644 (file)
 #include "KX_IPO_SGController.h"
 #include "KX_ScalarInterpolator.h"
 #include "KX_GameObject.h"
+#include "KX_IPhysicsController.h"
 
 // All objects should start on frame 1! Will we ever need an object to 
 // start on another frame, the 1.0 should change.
 KX_IpoSGController::KX_IpoSGController() 
-: m_ipotime(1.0),
-  m_modify_position(false),
+: m_modify_position(false),
   m_modify_orientation(false),
   m_modify_scaling(false),
-  m_modified(true),
   m_ipo_as_force(false),
-  m_force_ipo_acts_local(false)
+  m_force_ipo_acts_local(false),
+  m_modified(true),
+  m_ipotime(1.0)
 {
        m_sumo_object = NULL;
        m_game_object = NULL;
@@ -121,6 +122,11 @@ bool KX_IpoSGController::Update(double currentTime)
                                        m_sumo_object->calcXform();
                                }
                                */
+                               if (m_game_object && ob) {
+                                       m_game_object->GetPhysicsController()->ApplyForce(m_force_ipo_acts_local ?
+                                               ob->GetWorldOrientation() * m_ipo_xform.GetPosition() :
+                                               m_ipo_xform.GetPosition(), false);
+                               }
 
                        } else {
                                ob->SetLocalPosition(m_ipo_xform.GetPosition());
@@ -137,6 +143,11 @@ bool KX_IpoSGController::Update(double currentTime)
                                        m_sumo_object->calcXform();
                                }
                                */
+                               if (m_game_object && ob) {
+                                       m_game_object->ApplyTorque(m_force_ipo_acts_local ?
+                                               ob->GetWorldOrientation() * m_ipo_xform.GetEulerAngles() :
+                                               m_ipo_xform.GetEulerAngles(), false);
+                               }
 
                        } else {
                                ob->SetLocalOrientation(MT_Matrix3x3(m_ipo_xform.GetEulerAngles()));
index fe43261c0beabdccbfcbdd9e9ca8469fb3daf50c..475ae0dfba8553bfbdc6ca31438fcb1c1d34f93e 100644 (file)
@@ -38,8 +38,8 @@
 KX_IPhysicsController::KX_IPhysicsController(bool dyna,void* userdata)
 
 :      m_bDyna(dyna),
-       m_userdata(userdata),
-       m_suspendDynamics(false) 
+       m_suspendDynamics(false),
+       m_userdata(userdata)
 {
 };
 
index de2b31684e042ca35fe9530cde8d51bd48838075..92333329f9e5b70de980848fdbcfea85e2fbdb24 100644 (file)
@@ -89,7 +89,6 @@ public:
 
 };
 
-
 KX_IpoActuator::KX_IpoActuator(SCA_IObject* gameobj,
                                                           const STR_String& propname,
                                                           float starttime,
@@ -100,16 +99,16 @@ KX_IpoActuator::KX_IpoActuator(SCA_IObject* gameobj,
                                                           bool force_ipo_local,
                                                           PyTypeObject* T) 
        : SCA_IActuator(gameobj,T),
+       m_bNegativeEvent(false),
        m_starttime (starttime),
-       m_endtime(endtime) ,
-       m_localtime(starttime),
+       m_endtime(endtime),
        m_recurse(recurse),
-       m_type((IpoActType)acttype) ,
+       m_localtime(starttime),
        m_direction(1),
-       m_bNegativeEvent(false),
        m_propname(propname),
        m_ipo_as_force(ipo_as_force),
-       m_force_ipo_local(force_ipo_local)
+       m_force_ipo_local(force_ipo_local),
+       m_type((IpoActType)acttype)
 {
        // intentionally empty
 }
index 80a4d13c916277e1d3d042dd6c53300d6f156d58..37f5a16de838ad426bd2fabf294f33762a7d7a69 100644 (file)
@@ -102,9 +102,10 @@ const char KX_KetsjiEngine::m_profileLabels[tc_numCategories][15] = {
  *     Constructor of the Ketsji Engine
  */
 KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
-:      m_bInitialized(false),
-       m_activecam(0),
-       m_rasterizer(NULL)
+:
+       m_rasterizer(NULL),
+       m_bInitialized(false),
+       m_activecam(0)
 {
        m_kxsystem = system;
        m_bFixedTime = false;
@@ -587,6 +588,8 @@ void KX_KetsjiEngine::DoSound(KX_Scene* scene)
        m_logger->StartLog(tc_sound, m_kxsystem->GetTimeInSeconds(), true);
 
        KX_Camera* cam = scene->GetActiveCamera();
+       if (!cam)
+               return;
        MT_Point3 listenerposition = cam->NodeGetWorldPosition();
        MT_Vector3 listenervelocity = cam->GetLinearVelocity();
        MT_Matrix3x3 listenerorientation = cam->NodeGetWorldOrientation();
@@ -734,6 +737,9 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene)
 {
        float left, right, bottom, top, nearfrust, farfrust;
        KX_Camera* cam = scene->GetActiveCamera();
+       
+       if (!cam)
+               return;
 
        m_rasterizer->DisplayFog();
 
@@ -998,8 +1004,8 @@ void KX_KetsjiEngine::RemoveScene(const STR_String& scenename)
        }
        else
        {
-               STR_String tmpname = scenename;
-               printf("warning: scene %s does not exist, not removed!\n",tmpname.Ptr());
+//             STR_String tmpname = scenename;
+               std::cout << "warning: scene " << scenename << " does not exist, not removed!" << std::endl;
        }
 }
 
index 459d091ce80e71836f758610d85ff5b8f2792225..deba37540d5183e107966b22a2eea9efc465ac88 100644 (file)
@@ -55,11 +55,12 @@ private:
 
        double                  m_ipotime;
 public:
-       KX_LightIpoSGController() : m_ipotime(0.0),
-                                                               m_modify_energy(false),
-                                                               m_modify_color(false),
-                                                               m_modify_dist(false),
-                                                               m_modified(true)
+       KX_LightIpoSGController() : 
+                               m_modify_energy(false),
+                               m_modify_color(false),
+                               m_modify_dist(false),
+                               m_modified(true),
+                               m_ipotime(0.0)
                {}
 
        virtual ~KX_LightIpoSGController();
index c6f412656905eee40436ff7434504353de5469fc..4e2a731c421c6d1ceeb53fb3c6e7124fef3a1410 100644 (file)
 #include "KX_Camera.h"
 #include "KX_MouseFocusSensor.h"
 
+#include "KX_ClientObjectInfo.h"
+#include "SM_Object.h"
+#include "SM_Scene.h"
+#include "SumoPhysicsEnvironment.h"
+
 /* ------------------------------------------------------------------------- */
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
@@ -233,23 +238,23 @@ bool KX_MouseFocusSensor::ParentObjectHasFocus(void)
         * ignore-object. We don't ignore anything... */
        KX_GameObject* thisObj = (KX_GameObject*) GetParent();
        
-
-       //SM_Object* hitSMObj = m_sumoScene->rayTest(NULL, 
-       //                                                                                 frompoint3,
-       //                                                                                 topoint3,
-       //                                                                                 resultpoint, 
-       //                                                                                 resultnormal);
-       
-       KX_GameObject* hitKXObj = 0;
+       SumoPhysicsEnvironment *spe = dynamic_cast<SumoPhysicsEnvironment* > (m_kxscene->GetPhysicsEnvironment());
+       SM_Scene *sumoScene = spe->GetSumoScene();
+
+       SM_Object* hitSMObj = sumoScene->rayTest(NULL, 
+                                               frompoint3,
+                                               topoint3,
+                                               resultpoint, 
+                                               resultnormal);
        
        /* all this casting makes me nervous... */
-       //SM_ClientObjectInfo* client_info 
-       //      = ( hitSMObj ?
-       //              (SM_ClientObjectInfo*) ((SM_Object*)hitSMObj)->getClientObject() :
-       //              NULL);
-       //KX_GameObject* hitKXObj = ( client_info ? 
-       //                                                      (KX_GameObject*)client_info->m_clientobject : 
-       //                                                      NULL);
+       KX_ClientObjectInfo* client_info 
+               = ( hitSMObj ?
+                       (KX_ClientObjectInfo*) ((SM_Object*)hitSMObj)->getClientObject() :
+                       NULL);
+       KX_GameObject* hitKXObj = ( client_info ? 
+                                                               (KX_GameObject*)client_info->m_clientobject : 
+                                                               NULL);
                
        
        /* Is this me? In the ray test, there are a lot of extra checks
index 8008e85843fc746532d2be8cd4642af6646e0ca7..0b32c748646f78381e6d80661cdf296607a0c2b0 100644 (file)
 #include "KX_TouchEventManager.h"
 #include "KX_Scene.h" // needed to create a replica
 
+#include "SM_Object.h"
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr,
+                                                        KX_GameObject* gameobj,
+                                                        void *vshape,
+                                                        double margin,
+                                                        double resetmargin,
+                                                        bool bFindMaterial,
+                                                        const STR_String& touchedpropname,
+                                                        class KX_Scene* scene,
+                                                        PyTypeObject* T)
+                        :KX_TouchSensor(eventmgr,
+                                                        gameobj,
+                                                        bFindMaterial,
+                                                        touchedpropname,
+                                                        /* scene, */
+                                                        T),
+                        m_Margin(margin),
+                        m_ResetMargin(resetmargin)
 
-#ifdef PHYSICS_NOT_YET
+{
+       m_client_info = new KX_ClientObjectInfo(gameobj);
+       m_client_info->m_type = KX_ClientObjectInfo::NEAR;
+       
+       DT_ShapeHandle shape = (DT_ShapeHandle) vshape;
+       m_sumoObj = new SM_Object(shape,NULL,NULL,NULL);
+       m_sumoObj->setMargin(m_Margin);
+       m_sumoObj->setClientObject(m_client_info);
+       
+       SynchronizeTransform();
+}
 
 KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr,
                                                         KX_GameObject* gameobj,
@@ -56,20 +85,27 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr,
                                                         gameobj,
                                                         bFindMaterial,
                                                         touchedpropname,
-                                                        scene,
+                                                        /* scene, */
                                                         T),
                         m_Margin(margin),
-                        m_ResetMargin(resetmargin),
-                        m_sumoScene(sumoscene)
+                        m_ResetMargin(resetmargin)
 
 {
-       m_client_info.m_type = 4;
-       m_client_info.m_clientobject = gameobj;
-       m_client_info.m_auxilary_info = NULL;
-       sumoObj->setClientObject(&m_client_info);
+       m_client_info = new KX_ClientObjectInfo(gameobj);
+       m_client_info->m_type = KX_ClientObjectInfo::NEAR;
+       m_client_info->m_auxilary_info = NULL;
+       
+       m_sumoObj = new SM_Object(DT_NewSphere(0.0),NULL,NULL,NULL);
+       m_sumoObj->setMargin(m_Margin);
+       m_sumoObj->setClientObject(m_client_info);
+       
+       SynchronizeTransform();
 }
 
-
+void KX_NearSensor::RegisterSumo(KX_TouchEventManager *touchman)
+{
+       touchman->GetSumoScene()->addSensor(*m_sumoObj);
+}
 
 CValue* KX_NearSensor::GetReplica()
 {
@@ -82,6 +118,16 @@ CValue* KX_NearSensor::GetReplica()
        // this will copy properties and so on...
        CValue::AddDataToReplica(replica);
        
+       replica->m_client_info = new KX_ClientObjectInfo(m_client_info->m_clientobject);
+       replica->m_client_info->m_type = KX_ClientObjectInfo::NEAR;
+       replica->m_client_info->m_auxilary_info = NULL;
+       
+       replica->m_sumoObj = new SM_Object(DT_NewSphere(0.0),NULL,NULL,NULL);
+       replica->m_sumoObj->setMargin(m_Margin);
+       replica->m_sumoObj->setClientObject(replica->m_client_info);
+       
+       replica->SynchronizeTransform();
+       
        return replica;
 }
 
@@ -89,42 +135,11 @@ CValue* KX_NearSensor::GetReplica()
 
 void KX_NearSensor::ReParent(SCA_IObject* parent)
 {
-       DT_ShapeHandle shape = DT_Sphere(0.0);
-                               
-       // this sumoObject is not deleted by a gameobj, so delete it ourself
-       // later (memleaks)!
-
-       SM_Object* sumoObj = new SM_Object(shape,NULL,NULL,NULL);
-       sumoObj->setMargin(m_Margin);
-
-       //sumoObj->setPosition(gameobj->NodeGetWorldPosition());
-       //sumoobj->setPosition(m_sumoObj->getPosition());
-       //sumoobj->setOrientation(m_sumoObj->getOrientation());
-       //newobj->setRigidBody(this->m_sumoObj->isRigidBody());
-
-       m_sumoObj = sumoObj;
-       m_solidHandle = m_sumoObj->getObjectHandle();
-
-       double radius = m_sumoObj->getMargin();
-       sumoObj->setMargin(m_sumoObj->getMargin());
+       SCA_ISensor::ReParent(parent);
        
-       m_client_info.m_type = 4;
-       m_client_info.m_clientobject = parent;
-       m_client_info.m_auxilary_info = NULL;
-       sumoObj->setClientObject(&m_client_info);
-
-       //m_sumoScene->add(*newobj);
+       m_client_info->m_clientobject = static_cast<KX_GameObject*>(parent); 
        
-       if (m_sumoObj)
-       {
-               DT_SetObjectResponse(m_resptable,
-                       m_sumoObj->getObjectHandle(),
-                       collisionResponse,
-                       DT_SIMPLE_RESPONSE,
-                       this);
-       }
-
-       SCA_ISensor::ReParent(parent);
+       SynchronizeTransform();
 }
 
 
@@ -133,19 +148,20 @@ KX_NearSensor::~KX_NearSensor()
 {
        // for nearsensor, the sensor is the 'owner' of sumoobj
        // for touchsensor, it's the parent
-
-       m_sumoScene->remove(*m_sumoObj);
+       static_cast<KX_TouchEventManager*>(m_eventmgr)->GetSumoScene()->remove(*m_sumoObj);
 
        if (m_sumoObj)
                delete m_sumoObj;
+               
+       if (m_client_info)
+               delete m_client_info;
 }
 
 
-
 bool KX_NearSensor::Evaluate(CValue* event)
 {
        bool result = false;
-       KX_GameObject* parent = (KX_GameObject*)GetParent();
+       KX_GameObject* parent = static_cast<KX_GameObject*>(GetParent());
 
        if (m_bTriggered != m_bLastTriggered)
        {
@@ -172,28 +188,27 @@ bool KX_NearSensor::Evaluate(CValue* event)
 
 
 
-void KX_NearSensor::HandleCollision(void* obj1,void* obj2,const DT_CollData * coll_data)
+DT_Bool KX_NearSensor::HandleCollision(void* obj1,void* obj2,const DT_CollData * coll_data)
 {
-       KX_TouchEventManager* toucheventmgr = (KX_TouchEventManager*)m_eventmgr;
-       KX_GameObject* parent = (KX_GameObject*)GetParent();
-
+       KX_TouchEventManager* toucheventmgr = static_cast<KX_TouchEventManager*>(m_eventmgr);
+       KX_GameObject* parent = static_cast<KX_GameObject*>(GetParent());
+       
        // need the mapping from SM_Objects to gameobjects now
        
-       SM_ClientObjectInfo* client_info =(SM_ClientObjectInfo*) (obj1 == m_sumoObj? 
+       KX_ClientObjectInfo* client_info =static_cast<KX_ClientObjectInfo*> (obj1 == m_sumoObj? 
                                        ((SM_Object*)obj2)->getClientObject() : 
                                        ((SM_Object*)obj1)->getClientObject());
 
        KX_GameObject* gameobj = ( client_info ? 
-                       (KX_GameObject*)client_info->m_clientobject : 
+                       static_cast<KX_GameObject*>(client_info->m_clientobject) : 
                        NULL);
-
+       
        if (gameobj && (gameobj != parent))
        {
                if (!m_colliders->SearchValue(gameobj))
                        m_colliders->Add(gameobj->AddRef());
-               
                // only take valid colliders
-               if (client_info->m_type == 1)
+               if (client_info->m_type == KX_ClientObjectInfo::ACTOR)
                {
                        if ((m_touchedpropname.Length() == 0) || 
                                (gameobj->GetProperty(m_touchedpropname)))
@@ -202,10 +217,9 @@ void KX_NearSensor::HandleCollision(void* obj1,void* obj2,const DT_CollData * co
                                m_hitObject = gameobj;
                        }
                }
-       } else
-       {
-               
        }
+       
+       return DT_CONTINUE;
 }
 
 
@@ -262,4 +276,3 @@ KX_NearSensor::_getattr(char* attr)
   _getattr_up(KX_TouchSensor);
 }
 
-#endif //PHYSICS_NOT_YET
index 2240cb0d5896b7d3e7e02d92b1e150ca913cc79a..335edbb97ca921bd35563d4b91f8c82144c001f5 100644 (file)
 #define KX_NEARSENSOR_H
 
 #include "KX_TouchSensor.h"
+#include "KX_ClientObjectInfo.h"
 
 class KX_Scene;
+class KX_ClientObjectInfo;
 
 class KX_NearSensor : public KX_TouchSensor
 {
@@ -45,17 +47,36 @@ class KX_NearSensor : public KX_TouchSensor
        double  m_Margin;
        double  m_ResetMargin;
        KX_Scene*       m_scene;
+       KX_ClientObjectInfo*    m_client_info;
+protected:
+       KX_NearSensor(class SCA_EventManager* eventmgr,
+                       class KX_GameObject* gameobj,
+                       void *shape,
+                       double margin,
+                       double resetmargin,
+                       bool bFindMaterial,
+                       const STR_String& touchedpropname,
+                       class KX_Scene* scene,
+                       PyTypeObject* T=&Type);
 
 public:
-       KX_NearSensor(class SCA_EventManager* eventmgr,class KX_GameObject* gameobj,double margin,double resetmargin,bool bFindMaterial,const STR_String& touchedpropname,class KM_Scene* scene,PyTypeObject* T=&Type);
+       KX_NearSensor(class SCA_EventManager* eventmgr,
+                       class KX_GameObject* gameobj,
+                       double margin,
+                       double resetmargin,
+                       bool bFindMaterial,
+                       const STR_String& touchedpropname,
+                       class KX_Scene* scene,
+                       PyTypeObject* T=&Type);
        virtual ~KX_NearSensor(); 
        virtual CValue* GetReplica();
        virtual bool Evaluate(CValue* event);
 
        virtual void ReParent(SCA_IObject* parent);
-       //virtual void HandleCollision(void* obj1,void* obj2,
-       //                                       const DT_CollData * coll_data); 
-
+       virtual DT_Bool HandleCollision(void* obj1,void* obj2,
+                                                const DT_CollData * coll_data); 
+       virtual void RegisterSumo(KX_TouchEventManager *touchman);
+       
        virtual PyObject*  _getattr(char *attr);
 
 };
index 2fa37a6369cbf8ddead47ee84c5b192c1ac830fc..02a58ffd95aa032b6d1ff99ace7298dbe43641d1 100644 (file)
@@ -48,9 +48,9 @@ private:
 
        double                  m_ipotime;
 public:
-       KX_ObColorIpoSGController() : m_ipotime(0.0),
-
-                                                               m_modified(true)
+       KX_ObColorIpoSGController() : 
+                               m_modified(true),
+                               m_ipotime(0.0)
                {}
        virtual ~KX_ObColorIpoSGController();
        virtual SG_Controller*  GetReplica(class SG_Node* destnode);
index bcbabc384e977e7b5003d2234e8c9d698371221e..1d913fe6e44416bd0faf1504f66654f2bef0e5d1 100644 (file)
@@ -44,7 +44,6 @@
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
 
-
 KX_ObjectActuator::
 KX_ObjectActuator(
        SCA_IObject* gameobj,
@@ -64,8 +63,8 @@ KX_ObjectActuator(
        m_drot(drot),
        m_linear_velocity(linV),
        m_angular_velocity(angV),
-       m_active_combined_velocity (false),
-       m_bitLocalFlag (flag)
+       m_bitLocalFlag (flag),
+       m_active_combined_velocity (false)
 {
 }
 
@@ -83,6 +82,11 @@ bool KX_ObjectActuator::Update(double curtime,double deltatime)
                // it should reconcile the externally set velocity with it's 
                // own velocity.
                if (m_active_combined_velocity) {
+                       static bool update_resolve_warning = 0;
+                       if (!update_resolve_warning) {
+                               update_resolve_warning = 1;
+                               std::cout << "FIXME: KX_ObjectActuator::Update ResolveCombinedVelocities undefined!" << std::endl;
+                       }
                        //if (parent->GetSumoObject()) {
                                //parent->GetPhysicsController()->ResolveCombinedVelocities(
                                //      m_linear_velocity,
index 9f6bd6d8f0b05705bca32950734036026d5c6143..9c1267ff34c8346d9c81e89a782b75ac329fafd8 100644 (file)
 
 enum   e_PhysicsEngine
 {
-               UseNone=1,
-               UseSumo,
-               UseODE,
-               UseDynamo,
-               NoSelection
+               NoSelection = -1,
+               UseNone     =  0,
+               UseEnji     =  1,
+               UseSumo     =  2,
+               UseDynamo   =  3,
+               UseODE      =  4
 };
 
 #endif //__KX_PHYSICSENGINEENUMS
index 2bba77a966a2a2a1239e56048608238cfe8c372c..d692af82b7a915d97d46dde3969a1a0244f02a07 100644 (file)
 
 KX_PhysicsObjectWrapper::KX_PhysicsObjectWrapper(
                                                PHY_IPhysicsController* ctrl,
-                                               PHY_IPhysicsEnvironment* physenv,PyTypeObject *T)
-: m_ctrl(ctrl),m_physenv(physenv),PyObjectPlus(T)
+                                               PHY_IPhysicsEnvironment* physenv,PyTypeObject *T) :
+                                       PyObjectPlus(T),
+                                       m_ctrl(ctrl),
+                                       m_physenv(physenv)
 {
 }
 
index 19e26b6f484cdb17e559f472f495ffa30a94a330..923a38cb7cc177051483e241cc5c2fb1c2b3c8f2 100644 (file)
 /**
  *     RadarSensor constructor. Creates a near-sensor derived class, with a cone collision shape.
  */
-
-#ifdef PHYSICS_NOT_YET
-
-KX_RadarSensor::KX_RadarSensor(class SCA_EventManager* eventmgr,
-               class KX_GameObject* gameobj,
+KX_RadarSensor::KX_RadarSensor(SCA_EventManager* eventmgr,
+               KX_GameObject* gameobj,
                        double coneradius,
                        double coneheight,
                        int     axis,
@@ -57,20 +54,21 @@ KX_RadarSensor::KX_RadarSensor(class SCA_EventManager* eventmgr,
                        : KX_NearSensor(
                                eventmgr,
                                gameobj,
+                               DT_NewCone(coneradius,coneheight),
                                margin,
                                resetmargin,
                                bFindMaterial,
                                touchedpropname,
                                kxscene,
                                T),
-                               m_coneheight(coneheight),
                                m_coneradius(coneradius),
+                               m_coneheight(coneheight),
                                m_axis(axis)
 {
-       m_client_info.m_type = 3;
-       m_client_info.m_clientobject = gameobj;
-       m_client_info.m_auxilary_info = NULL;
-       sumoObj->setClientObject(&m_client_info);
+       m_client_info->m_type = KX_ClientObjectInfo::RADAR;
+       //m_client_info->m_clientobject = gameobj;
+       //m_client_info->m_auxilary_info = NULL;
+       //sumoObj->setClientObject(&m_client_info);
 }
                        
 
@@ -221,4 +219,3 @@ PyObject* KX_RadarSensor::PyGetConeHeight(PyObject* self,
 }
 
 
-#endif //PHYSICS_NOT_YET
index 77e085d29a312524069541bff95897e1f5bce226..03364ae9c29d7b1534a9e2db87834eb0af93b069 100644 (file)
@@ -62,18 +62,18 @@ class KX_RadarSensor : public KX_NearSensor
        MT_Point3       m_cone_target;
        
 public:
-       KX_RadarSensor(class SCA_EventManager* eventmgr,
-               class KX_GameObject* gameobj,
+
+       KX_RadarSensor(SCA_EventManager* eventmgr,
+               KX_GameObject* gameobj,
                        double coneradius,
                        double coneheight,
                        int     axis,
                        double margin,
                        double resetmargin,
-                       class SM_Object* sumoObj,
                        bool bFindMaterial,
                        const STR_String& touchedpropname,
-                       class SM_Scene* sumoscene,
-                       PyTypeObject* T=&Type);
+                       class KX_Scene* kxscene,
+                       PyTypeObject* T = &Type);
        KX_RadarSensor();
        virtual ~KX_RadarSensor();
        virtual void SynchronizeTransform();
index f5280f1fec695ba12f1d96a24432b5c54ffdd77d..7acc0b04dedb8aeef035097d91eb290807ae8902 100644 (file)
@@ -44,8 +44,8 @@ class KX_RayEventManager : public SCA_EventManager
        class SCA_LogicManager* m_logicmgr;
 public:
        KX_RayEventManager(class SCA_LogicManager* logicmgr)
-               : m_logicmgr(logicmgr),
-               SCA_EventManager(RAY_EVENTMGR)
+               : SCA_EventManager(RAY_EVENTMGR),
+                 m_logicmgr(logicmgr)
        {}
        virtual void NextFrame(double curtime,double deltatime);
        virtual void    RegisterSensor(SCA_ISensor* sensor);
index 5cca436327a31a0cecff190d4aa8d34de3814070..c53651712a84abaa692010eb50c127850927f522 100644 (file)
@@ -41,6 +41,9 @@
 #include "KX_GameObject.h"
 #include "KX_Scene.h"
 
+#include "SumoPhysicsEnvironment.h"
+#include "KX_SumoPhysicsController.h"
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -57,10 +60,10 @@ KX_RaySensor::KX_RaySensor(class SCA_EventManager* eventmgr,
                                        m_propertyname(propname),
                                        m_bFindMaterial(bFindMaterial),
                                        m_distance(distance),
+                                       m_scene(ketsjiScene),
+                                       m_bTriggered(false),
                                        m_axis(axis),
-                                       m_ketsjiScene(ketsjiScene),
                                        m_rayHit(false),
-                                       m_bTriggered(false),
                                        m_hitObject(NULL)
 
                                
@@ -139,56 +142,78 @@ bool KX_RaySensor::Evaluate(CValue* event)
                }
        case 3: // -X
                {
-                       todir[0] = invmat[0][0] * -1;
-                       todir[1] = invmat[0][1] * -1;
-                       todir[2] = invmat[0][2] * -1;
+                       todir[0] = -invmat[0][0];
+                       todir[1] = -invmat[0][1];
+                       todir[2] = -invmat[0][2];
                        break;
                }
        case 4: // -Y
                {
-                       todir[0] = invmat[1][0] * -1;
-                       todir[1] = invmat[1][1] * -1;
-                       todir[2] = invmat[1][2] * -1;
+                       todir[0] = -invmat[1][0];
+                       todir[1] = -invmat[1][1];
+                       todir[2] = -invmat[1][2];
                        break;
                }
        case 5: // -Z
                {
-                       todir[0] = invmat[2][0] * -1;
-                       todir[1] = invmat[2][1] * -1;
-                       todir[2] = invmat[2][2] * -1;
+                       todir[0] = -invmat[2][0];
+                       todir[1] = -invmat[2][1];
+                       todir[2] = -invmat[2][2];
                        break;
                }
        }
        todir.normalize();
        m_rayDirection = todir;
-       
-
 
        MT_Point3 topoint = frompoint + (m_distance) * todir;
        MT_Point3 resultpoint;
        MT_Vector3 resultnormal;
        bool ready = false;
-       /*
-       do {
+       SumoPhysicsEnvironment *spe = dynamic_cast<SumoPhysicsEnvironment *>(m_scene->GetPhysicsEnvironment());
+       SM_Scene *scene = spe->GetSumoScene();
+       KX_SumoPhysicsController *spc = dynamic_cast<KX_SumoPhysicsController *>(obj->GetPhysicsController());
+       KX_GameObject *parent = obj->GetParent();
+       if (!spc && parent)
+               spc = dynamic_cast<KX_SumoPhysicsController *>(parent->GetPhysicsController());
+       if (parent)
+               parent->Release();
+       SM_Object *thisObj = spc?spc->GetSumoObject():NULL;
        
-               
-               
-               SM_Object* hitObj = m_sumoScene->rayTest(obj->GetSumoObject(),
-                                                                                                frompoint,
-                                                                                                topoint,
-                                                                                                resultpoint,
-                                                                                                resultnormal);
+       do {
+               SM_Object* hitObj = scene->rayTest(thisObj,
+                       frompoint,
+                       topoint,
+                       resultpoint,
+                       resultnormal);
+                       
                if (hitObj)
                {
-                       KX_ClientObjectInfo* info = (SM_ClientObjectInfo*)hitObj->getClientObject();
-                       SCA_IObject* hitgameobj = (SCA_IObject*)info->m_clientobject;
+       
+                       KX_ClientObjectInfo* info = (KX_ClientObjectInfo*)hitObj->getClientObject();
                        bool bFound = false;
-
-                       if (hitgameobj == obj)
+                       
+                       if (!info)
+                       {
+                               std::cout<< "WARNING:  Ray sensor " << GetName() << " cannot sense SM_Object " << hitObj << " - no client info.\n" << std::endl;
+                               ready = true;
+                               break;
+                       } 
+                       
+                       SCA_IObject *hitgameobj = (SCA_IObject*)info->m_clientobject;
+                       
+                       if (hitgameobj == obj || info->m_type > KX_ClientObjectInfo::ACTOR)
                        {
                                // false hit
-                               MT_Scalar marg = obj->GetSumoObject()->getMargin() ;
-                               frompoint = resultpoint + marg * todir;
+                               KX_SumoPhysicsController *hitspc = dynamic_cast<KX_SumoPhysicsController *> (static_cast<KX_GameObject*> (hitgameobj) ->GetPhysicsController());
+                               if (hitspc)
+                               {
+                                       MT_Scalar marg = hitspc->GetSumoObject()->getMargin();
+                                       if (hitspc->GetSumoObject()->getShapeProps())
+                                               marg += hitspc->GetSumoObject()->getShapeProps()->m_radius;
+                                       frompoint = resultpoint + marg * todir;
+                               } else {
+                                       ready = true;
+                               }
                        }
                        else
                        {
@@ -208,10 +233,7 @@ bool KX_RaySensor::Evaluate(CValue* event)
                                        }
                                        else
                                        {
-                                               if (hitgameobj->GetProperty(m_propertyname) != NULL)
-                                               {
-                                                       bFound = true;
-                                               }
+                                               bFound = hitgameobj->GetProperty(m_propertyname) != NULL;
                                        }
                                }
 
@@ -231,7 +253,7 @@ bool KX_RaySensor::Evaluate(CValue* event)
                }
        }
        while (!ready);
-       */
+       
        
        
        /* now pass this result to some controller */
index 4a783b398b4ca84d73516c4db1f79a61d29c1e49..528f52f27a7abb337d062d711e477ee4cee41df2 100644 (file)
@@ -44,7 +44,7 @@ class KX_RaySensor : public SCA_ISensor
        STR_String              m_propertyname;
        bool                    m_bFindMaterial;
        double                  m_distance;
-       class KX_Scene* m_ketsjiScene;
+       class KX_Scene* m_scene;
        bool                    m_bTriggered;
        int                             m_axis;
        bool                    m_rayHit;
index 784a3e015dfdf765bd6ca9243fa908fe2408f7e1..060afe060ee3565cc5553284f66e6a699eac073a 100644 (file)
@@ -135,8 +135,8 @@ KX_SCA_ReplaceMeshActuator::KX_SCA_ReplaceMeshActuator(SCA_IObject *gameobj,
                                                                                                           PyTypeObject* T) : 
 
        SCA_IActuator(gameobj, T),
-       m_scene(scene),
-       m_mesh(mesh)
+       m_mesh(mesh),
+       m_scene(scene)
 {
 } /* End of constructor */
 
index c2cb001cce88d95d0a047e5d82d6a3b52786fce4..8a964e07eb53da5d0c9eab95ddbefa2036250a9a 100644 (file)
@@ -73,6 +73,8 @@
 #include "PHY_IPhysicsEnvironment.h"
 #include "KX_IPhysicsController.h"
 
+#include "SM_Scene.h"
+#include "SumoPhysicsEnvironment.h"
 
 void* KX_SceneReplicationFunc(SG_IObject* node,void* gameobj,void* scene)
 {
@@ -95,23 +97,20 @@ SG_Callbacks KX_Scene::m_callbacks = SG_Callbacks(KX_SceneReplicationFunc,KX_Sce
 // (defined in KX_PythonInit.cpp)
 extern bool gUseVisibilityTemp;
 
-
-
-
 KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
                                   class SCA_IInputDevice* mousedevice,
                                   class NG_NetworkDeviceInterface *ndi,
                                   class SND_IAudioDevice* adi,
                                   const STR_String& sceneName): 
 
-       m_mousemgr(NULL),
        m_keyboardmgr(NULL),
-       m_active_camera(NULL),
-       m_ueberExecutionPriority(0),
-       m_adi(adi),
+       m_mousemgr(NULL),
+       m_physicsEnvironment(0),
        m_sceneName(sceneName),
+       m_adi(adi),
        m_networkDeviceInterface(ndi),
-       m_physicsEnvironment(0)
+       m_active_camera(NULL),
+       m_ueberExecutionPriority(0)
 {
                
 
@@ -130,11 +129,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
        m_keyboardmgr = new SCA_KeyboardManager(m_logicmgr,keyboarddevice);
        m_mousemgr = new SCA_MouseManager(m_logicmgr,mousedevice);
        
-//     m_solidScene = DT_CreateScene();
-//     m_respTable = DT_CreateRespTable();
-
        SCA_AlwaysEventManager* alwaysmgr = new SCA_AlwaysEventManager(m_logicmgr);
-       //KX_TouchEventManager* touchmgr = new KX_TouchEventManager(m_logicmgr, m_respTable, m_solidScene);
        SCA_PropertyEventManager* propmgr = new SCA_PropertyEventManager(m_logicmgr);
        SCA_RandomEventManager* rndmgr = new SCA_RandomEventManager(m_logicmgr);
        KX_RayEventManager* raymgr = new KX_RayEventManager(m_logicmgr);
@@ -145,14 +140,11 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
        m_logicmgr->RegisterEventManager(propmgr);
        m_logicmgr->RegisterEventManager(m_keyboardmgr);
        m_logicmgr->RegisterEventManager(m_mousemgr);
-       //m_logicmgr->RegisterEventManager(touchmgr);
        m_logicmgr->RegisterEventManager(m_timemgr);
        m_logicmgr->RegisterEventManager(rndmgr);
        m_logicmgr->RegisterEventManager(raymgr);
        m_logicmgr->RegisterEventManager(netmgr);
 
-       //m_sumoScene = new SM_Scene();
-       //m_sumoScene->setSecondaryRespTable(m_respTable);
        m_soundScene = new SND_Scene(adi);
        assert (m_networkDeviceInterface != NULL);
        m_networkScene = new NG_NetworkScene(m_networkDeviceInterface);
@@ -169,6 +161,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
 
 KX_Scene::~KX_Scene()
 {
+       
 //     int numobj = m_objectlist->GetCount();
 
        //int numrootobjects = GetRootParentList()->GetCount();
@@ -708,6 +701,11 @@ void KX_Scene::NewRemoveObject(class CValue* gameobj)
                newobj->Release();
        if (m_euthanasyobjects->RemoveValue(newobj))
                newobj->Release();
+               
+       if (newobj == m_active_camera)
+       {
+               m_active_camera = NULL;
+       }
 }
 
 
@@ -979,3 +977,15 @@ void       KX_Scene::SetGravity(const MT_Vector3& gravity)
 {
        GetPhysicsEnvironment()->setGravity(gravity[0],gravity[1],gravity[2]);
 }
+
+void KX_Scene::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* physEnv)
+{
+       SumoPhysicsEnvironment *sme = dynamic_cast<SumoPhysicsEnvironment *>(physEnv);
+       m_physicsEnvironment = physEnv;
+       if (sme)
+       {
+               KX_TouchEventManager* touchmgr = new KX_TouchEventManager(m_logicmgr, sme->GetSumoScene());
+               m_logicmgr->RegisterEventManager(touchmgr);
+               return;
+       }
+}
index 818368561e6d61a8390b1210564c5642c5227294..35f2f9dbb7157b307cf2c8df92fafd0cbc501fea 100644 (file)
@@ -466,10 +466,7 @@ public:
                return m_physicsEnvironment;
        }
 
-       void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment*       physEnv)
-       {
-               m_physicsEnvironment = physEnv;
-       }
+       void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment*       physEnv);
 
        void    SetGravity(const MT_Vector3& gravity);
 };
index 4a1d8c74b77dd439211b5724fda0c7796cfbc006..e07719ea680d9fe4dcdc305fae6acd2ece0703c8 100644 (file)
@@ -295,12 +295,9 @@ PyObject* KX_SceneActuator::PySetScene(PyObject* self,
                return NULL;
        }
 
-       if (m_KetsjiEngine->FindScene(scene_name))
-       {
-               /* Scene switch is done by name. */
-               m_nextSceneName = scene_name;
-       }
-       
+       /* Scene switch is done by name. */
+       m_nextSceneName = scene_name;
+
        Py_Return;
 }
 
index 12b8775b5cd9ffbcd3958f03c32f77c03ad75bce..57986cd7b78426933ae0ed62d64071a4bdd90f4a 100644 (file)
@@ -1,4 +1,7 @@
+
+#ifdef WIN32
 #pragma warning (disable : 4786)
+#endif
 
 #include "KX_SumoPhysicsController.h"
 #include "SG_Spatial.h"
@@ -107,7 +110,7 @@ SG_Controller*      KX_SumoPhysicsController::GetReplica(SG_Node* destnode)
        //parentcontroller is here be able to avoid collisions between parent/child
 
        PHY_IPhysicsController* parentctrl = NULL;
-
+       
        if (destnode != destnode->GetRootSGParent())
        {
                KX_GameObject* clientgameobj = (KX_GameObject*) destnode->GetRootSGParent()->GetSGClientObject();
@@ -123,7 +126,7 @@ SG_Controller*      KX_SumoPhysicsController::GetReplica(SG_Node* destnode)
                        childit!= destnode->GetSGChildren().end();
                        ++childit
                                ) {
-                               KX_GameObjectclientgameobj = static_cast<KX_GameObject*>( (*childit)->GetSGClientObject());
+                               KX_GameObject *clientgameobj = static_cast<KX_GameObject*>( (*childit)->GetSGClientObject());
                                if (clientgameobj)
                                {
                                        parentctrl = (KX_SumoPhysicsController*)clientgameobj->GetPhysicsController();
@@ -145,8 +148,7 @@ void        KX_SumoPhysicsController::SetObject (SG_IObject* object)
        // cheating here...
        KX_GameObject* gameobj = (KX_GameObject*)       object->GetSGClientObject();
        gameobj->SetPhysicsController(this);
-
-
+       GetSumoObject()->setClientObject(gameobj->getClientInfo());
 }
 
 
index 523e139fc69223e98d5b6e526311a7430281bb09..465dd799c2a8c254f395868069fe0f7795bb9c80 100644 (file)
@@ -1,3 +1,34 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License.  See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
 #ifndef __KX_SUMOPHYSICSCONTROLLER_H
 #define __KX_SUMOPHYSICSCONTROLLER_H
 
@@ -27,8 +58,8 @@ public:
                class SM_Object* sumoObj,       
                class PHY_IMotionState* motionstate
                ,bool dyna) 
-               : SumoPhysicsController(sumoScene,solidscene,sumoObj,motionstate,dyna),
-       KX_IPhysicsController(dyna,NULL) 
+               : KX_IPhysicsController(dyna,NULL) ,
+                 SumoPhysicsController(sumoScene,solidscene,sumoObj,motionstate,dyna)
        {
        };
        virtual ~KX_SumoPhysicsController();
index 509f7e13234412afe36aa8d577f2139caa66dc2f..766c541b4fc8167ccf6bd578f98f32bfc684d49f 100644 (file)
 #include <config.h>
 #endif
 
-KX_TimeLogger::KX_TimeLogger(unsigned int maxNumMeasurements)
-: m_maxNumMeasurements(maxNumMeasurements), m_logging(false), m_logStart(0)
+KX_TimeLogger::KX_TimeLogger(unsigned int maxNumMeasurements) : 
+       m_maxNumMeasurements(maxNumMeasurements), 
+       m_logStart(0),
+       m_logging(false)
 {
 }
 
@@ -108,7 +110,7 @@ double KX_TimeLogger::GetAverage(void) const
 
        unsigned int numMeasurements = m_measurements.size();
        if (numMeasurements > 1) {
-               for (int i = 1; i < numMeasurements; i++) {
+               for (unsigned int i = 1; i < numMeasurements; i++) {
                        avg += m_measurements[i];
                }
                avg /= (float)numMeasurements - 1;
index 8c7f18983e5eb8b478153daab3cc1e7566e0b118..2186c442f3284ffb38af9d141ab3c97075af0eb6 100644 (file)
 #include <config.h>
 #endif
 
-#ifdef PHYSICS_NOT_YET
+#include "SM_Object.h"
 
 KX_TouchEventManager::KX_TouchEventManager(class SCA_LogicManager* logicmgr,
-                                                                                  DT_RespTableHandle resphandle,
-                                                                                  DT_SceneHandle scenehandle)
+       SM_Scene *scene)
        : SCA_EventManager(TOUCH_EVENTMGR),
-         m_resphandle(resphandle),
-         m_scenehandle(scenehandle),
-         m_logicmgr(logicmgr) {}
+         m_logicmgr(logicmgr),
+         m_scene(scene)
+{
+       //m_scene->addTouchCallback(STATIC_RESPONSE, KX_TouchEventManager::collisionResponse, this);
+       m_scene->addTouchCallback(OBJECT_RESPONSE, KX_TouchEventManager::collisionResponse, this);
+       m_scene->addTouchCallback(SENSOR_RESPONSE, KX_TouchEventManager::collisionResponse, this);
+}
 
-void KX_TouchEventManager::RegisterSensor(SCA_ISensor* sensor)
+DT_Bool KX_TouchEventManager::HandleCollision(void* object1,void* object2,
+                                                const DT_CollData * coll_data)
 {
+       SM_Object * obj1 = (SM_Object *) object1;
+       SM_Object * obj2 = (SM_Object *) object2;
+
+       for ( vector<SCA_ISensor*>::iterator it = m_sensors.begin(); !(it==m_sensors.end()); it++)
+       {
+               KX_GameObject* gameobj = ((KX_GameObject*)((KX_TouchSensor*)*it)->GetParent());
+               KX_ClientObjectInfo *client_info = (KX_ClientObjectInfo *) obj1->getClientObject();
+// Enable these printfs to create excesive debug info
+//             printf("KX_TEM::HC: Sensor %s\tGO: %p o1: %s (%p)", (const char *) (*it)->GetName(), gameobj, (const char *) ((KX_GameObject *) client_info->m_clientobject)->GetName(), client_info->m_clientobject);
+               if (client_info && client_info->m_clientobject == gameobj)
+                       ((KX_TouchSensor*)*it)->HandleCollision(object1,object2,coll_data);
+
+               client_info = (KX_ClientObjectInfo *) obj2->getClientObject();
+//             printf(" o2: %s (%p)\n", (const char *) ((KX_GameObject *) client_info->m_clientobject)->GetName(), client_info->m_clientobject);
+               if (client_info && client_info->m_clientobject == gameobj)
+                        ((KX_TouchSensor*)*it)->HandleCollision(object1,object2,coll_data);
 
+       }
+       
+       return DT_CONTINUE;
+}
 
+DT_Bool KX_TouchEventManager::collisionResponse(void *client_data, 
+                                                       void *object1,
+                                                       void *object2,
+                                                       const DT_CollData *coll_data)
+{
+       KX_TouchEventManager *touchmgr = (KX_TouchEventManager *) client_data;
+       touchmgr->HandleCollision(object1, object2, coll_data);
+       return DT_CONTINUE;
+}
+
+void KX_TouchEventManager::RegisterSensor(SCA_ISensor* sensor)
+{
        KX_TouchSensor* touchsensor = static_cast<KX_TouchSensor*>(sensor);
        m_sensors.push_back(touchsensor);
 
-       touchsensor->RegisterSumo();//this,m_resphandle);
-
-       //KX_GameObject* gameobj = ((KX_GameObject*)sensor->GetParent());
-//     SM_Object* smobj = touchsensor->GetSumoObject();//gameobj->GetSumoObject();
-//     if (smobj)
-//     {
-//             smobj->calcXform();
-//             DT_AddObject(m_scenehandle,
-//                              smobj->getObjectHandle()); 
-//     }
+       touchsensor->RegisterSumo(this);
 }
 
 
@@ -89,10 +116,7 @@ void KX_TouchEventManager::NextFrame(double curtime,double deltatime)
                vector<SCA_ISensor*>::iterator it;
                
                for (it = m_sensors.begin();!(it==m_sensors.end());it++)
-                       ((KX_TouchSensor*)*it)->SynchronizeTransform();
-               
-               if (DT_Test(m_scenehandle,m_resphandle))
-                       int i = 0;
+                       static_cast<KX_TouchSensor*>(*it)->SynchronizeTransform();
                
                for (it = m_sensors.begin();!(it==m_sensors.end());it++)
                        (*it)->Activate(m_logicmgr,NULL);
@@ -107,14 +131,10 @@ void KX_TouchEventManager::RemoveSensor(class SCA_ISensor* sensor)
        std::find(m_sensors.begin(), m_sensors.end(), sensor);
        if (!(i == m_sensors.end()))
        {
-               //std::swap(*i, m_sensors.back());
-               //m_sensors.pop_back();
-               //SM_Object* smobj = ((KX_TouchSensor*)*i)->GetSumoObject();
-               //DT_RemoveObject(m_scenehandle,
-               //               smobj->getObjectHandle()); 
+               std::swap(*i, m_sensors.back());
+               m_sensors.pop_back();
        }
        // remove the sensor forever :)
        SCA_EventManager::RemoveSensor(sensor);
 }
 
-#endif
index 711a3abb99651359a69f92a133da07f7c89d2809..e53dc2644946ed33aef1608da54360840e9e244b 100644 (file)
 #include "KX_GameObject.h"
 
 #include <vector>
-using namespace std;
 
 class KX_TouchEventManager : public SCA_EventManager
 {
        class SCA_LogicManager* m_logicmgr;
+       SM_Scene *m_scene;
+
+       static DT_Bool KX_TouchEventManager::collisionResponse(void *client_data, 
+                                                       void *object1,
+                                                       void *object2,
+                                                       const DT_CollData *coll_data);
+       
+       virtual DT_Bool HandleCollision(void* obj1,void* obj2,
+                                                const DT_CollData * coll_data); 
+       
 
 public:
-       KX_TouchEventManager(class SCA_LogicManager* logicmgr);
+       KX_TouchEventManager(class SCA_LogicManager* logicmgr,  
+               SM_Scene *scene);
        virtual void NextFrame(double curtime,double deltatime);
        virtual void    EndFrame();
        virtual void    RemoveSensor(class SCA_ISensor* sensor);
        virtual void RegisterSensor(SCA_ISensor* sensor);
        SCA_LogicManager* GetLogicManager() { return m_logicmgr;}
+       SM_Scene *GetSumoScene() { return m_scene; }
 };
 
 #endif //__KX_TOUCHEVENTMANAGER
index ee2226d03ad8ff9e7f9a0281e9e1f3f03d0b97ba..6ae670a842ca7fbf6b737f30446b0d5aefb5b520 100644 (file)
 #include "SCA_LogicManager.h"
 #include "KX_GameObject.h"
 #include "KX_TouchEventManager.h"
+#include "SM_Object.h"
+#include "KX_SumoPhysicsController.h"
 #include <iostream>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef PHYSICS_NOT_YET
-
 /* ------------------------------------------------------------------------- */
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
@@ -84,78 +84,81 @@ bool KX_TouchSensor::Evaluate(CValue* event)
        return result;
 }
 
-KX_TouchSensor::KX_TouchSensor(SCA_EventManager* eventmgr,KX_GameObject* gameobj,SM_Object* sumoObj,bool bFindMaterial,const STR_String& touchedpropname,PyTypeObject* T)
+KX_TouchSensor::KX_TouchSensor(SCA_EventManager* eventmgr,KX_GameObject* gameobj,/*SM_Object* sumoObj,*/bool bFindMaterial,const STR_String& touchedpropname,PyTypeObject* T)
 :SCA_ISensor(gameobj,eventmgr,T),
 m_touchedpropname(touchedpropname),
 m_bFindMaterial(bFindMaterial),
-m_sumoObj(sumoObj),
+m_eventmgr(eventmgr),
+/*m_sumoObj(sumoObj),*/
 m_bCollision(false),
 m_bTriggered(false),
 m_bLastTriggered(false)
 {
-       m_eventmgr = eventmgr;
        KX_TouchEventManager* touchmgr = (KX_TouchEventManager*) eventmgr;
+//     m_resptable = touchmgr->GetResponseTable();
        
-       m_resptable = touchmgr->GetResponseTable();
-       
-       m_solidHandle = m_sumoObj->getObjectHandle();
+//     m_solidHandle = m_sumoObj->getObjectHandle();
 
        m_hitObject =  NULL;
        m_colliders = new CListValue();
+       
+       KX_ClientObjectInfo *client_info = gameobj->getClientInfo();
+       client_info->m_clientobject = gameobj;
+       client_info->m_auxilary_info = NULL;
+       
+       KX_SumoPhysicsController *sphy = dynamic_cast<KX_SumoPhysicsController *>(gameobj->GetPhysicsController());
+       if (sphy)
+               m_sumoObj = sphy->GetSumoObject();
+
 }
 
 
 KX_TouchSensor::~KX_TouchSensor()
 {
-       DT_ClearObjectResponse(m_resptable,m_solidHandle);
+       //DT_ClearObjectResponse(m_resptable,m_solidHandle);
        m_colliders->Release();
 }
 
 void   KX_TouchSensor::ReParent(SCA_IObject* parent)
 {
-
-       m_sumoObj = ((KX_GameObject*)parent)->GetSumoObject();
-       m_solidHandle = m_sumoObj->getObjectHandle();
-
-       m_client_info.m_clientobject = NULL;//parent;
-       m_client_info.m_auxilary_info = NULL;
+       KX_GameObject *gameobj = static_cast<KX_GameObject *>(parent);
+       KX_SumoPhysicsController *sphy = dynamic_cast<KX_SumoPhysicsController *>(((KX_GameObject*)parent)->GetPhysicsController());
+       if (sphy)
+               m_sumoObj = sphy->GetSumoObject();
+
+//     m_solidHandle = m_sumoObj->getObjectHandle();
+       KX_ClientObjectInfo *client_info = gameobj->getClientInfo();
+       client_info->m_clientobject = parent;
+       client_info->m_auxilary_info = NULL;
        SCA_ISensor::ReParent(parent);
 }
 
-
-void KX_TouchSensor::RegisterSumo()
+void KX_TouchSensor::RegisterSumo(KX_TouchEventManager *touchman)
 {
+       if (m_sumoObj)
+       {
+               touchman->GetSumoScene()->requestCollisionCallback(*m_sumoObj);
+               // collision
+               // Deprecated   
 
-               if (m_sumoObj)
-               {
-                       // collision
-                       DT_SetObjectResponse(
-                               m_resptable,
-                               m_solidHandle,
-                               collisionResponse,
-                               DT_SIMPLE_RESPONSE,
-                               this);
-
-               }
-
+       }
 }
 
-void    KX_TouchSensor::HandleCollision(void* obj1,void* obj2,const DT_CollData * coll_data)
+DT_Bool    KX_TouchSensor::HandleCollision(void* obj1,void* obj2,const DT_CollData * coll_data)
 {
        KX_TouchEventManager* toucheventmgr = (KX_TouchEventManager*)m_eventmgr;
        KX_GameObject* parent = (KX_GameObject*)GetParent();
 
        // need the mapping from SM_Objects to gameobjects now
        
-       SM_ClientObjectInfo* client_info =(SM_ClientObjectInfo*) (obj1 == m_sumoObj? 
+       KX_ClientObjectInfo* client_info =(KX_ClientObjectInfo*) (obj1 == m_sumoObj? 
                                        ((SM_Object*)obj2)->getClientObject() : 
                                        ((SM_Object*)obj1)->getClientObject());
 
-
        KX_GameObject* gameobj = ( client_info ? 
                        (KX_GameObject*)client_info->m_clientobject : 
                        NULL);
-
+       
        if (gameobj && (gameobj != parent))
        {
                if (!m_colliders->SearchValue(gameobj))
@@ -185,12 +188,14 @@ void    KX_TouchSensor::HandleCollision(void* obj1,void* obj2,const DT_CollData
                {
                        m_bTriggered = true;
                        m_hitObject = gameobj;
+                       //printf("KX_TouchSensor::HandleCollision\n");
                }
                
        } 
-       
+       return DT_CONTINUE;
 }
 
+
 /* ------------------------------------------------------------------------- */
 /* Python functions                                                          */
 /* ------------------------------------------------------------------------- */
@@ -322,10 +327,11 @@ PyObject* KX_TouchSensor::PyGetHitObjectList(PyObject* self,
                                 * - this also doesn't work (obviously) for multi-materials... 
                                 */
                                KX_GameObject* gameob = (KX_GameObject*) m_colliders->GetValue(i);
-                               SM_Object* smob = (SM_Object*) gameob->GetSumoObject();
+                               KX_SumoPhysicsController* spc = dynamic_cast<KX_SumoPhysicsController*>(gameob->GetPhysicsController());
+                               SM_Object* smob = spc?spc->GetSumoObject():NULL;
                                
                                if (smob) {
-                                       SM_ClientObjectInfo* cl_inf = (SM_ClientObjectInfo*) smob->getClientObject();
+                                       KX_ClientObjectInfo* cl_inf = (KX_ClientObjectInfo*) smob->getClientObject();
                                        
                                        if (m_touchedpropname == ((char*)cl_inf->m_auxilary_info)) {
                                                newList->Add(m_colliders->GetValue(i)->AddRef());
@@ -392,6 +398,5 @@ PyObject* KX_TouchSensor::PySetTouchMaterial(PyObject* self, PyObject* args, PyO
        Py_Return;
 }
 
-#endif //#ifdef PHYSICS_NOT_YET
 
 /* eof */
index 35b23ecc60addb3e2772b83b21f0abdedfc9103f..503388276940d825ab30ea92941198488f96574a 100644 (file)
 #include "SCA_ISensor.h"
 #include "ListValue.h"
 
+#include <SOLID/SOLID.h>
+#include "SM_Scene.h"
+
 #include "KX_ClientObjectInfo.h"
 
+class KX_TouchEventManager;
+
 class KX_TouchSensor : public SCA_ISensor
 {
 protected:
@@ -52,10 +57,9 @@ protected:
        bool                                    m_bFindMaterial;
        class SCA_EventManager* m_eventmgr;
        
-       //class SM_Object*              m_sumoObj;
-       //DT_ObjectHandle                       m_solidHandle;
-       //SM_ClientObjectInfo           m_client_info;
-       //DT_RespTableHandle            m_resptable;
+       class SM_Object*                m_sumoObj;
+       DT_ObjectHandle                 m_solidHandle;
+       DT_RespTableHandle              m_resptable;
 
 
        bool                                    m_bCollision;
@@ -67,7 +71,7 @@ protected:
 public:
        KX_TouchSensor(class SCA_EventManager* eventmgr,
                class KX_GameObject* gameobj,
-               class SM_Object* sumoObj,
+               /*class SM_Object* sumoObj,*/
                bool fFindMaterial,
                const STR_String& touchedpropname,
                PyTypeObject* T=&Type) ;
@@ -88,25 +92,15 @@ public:
        virtual bool Evaluate(CValue* event);
        virtual void ReParent(SCA_IObject* parent);
        
-/*     static void collisionResponse(void *client_data, 
-                                                                 void *object1,
-                                                                 void *object2,
-                                                                 const DT_CollData *coll_data) {
-               class KX_TouchSensor* sensor = (class KX_TouchSensor*) client_data;
-               sensor->HandleCollision(object1,object2,coll_data);
-       }
-       
-
-       
-       void RegisterSumo();
+       virtual void RegisterSumo(KX_TouchEventManager* touchman);
 
-       virtual void HandleCollision(void* obj1,void* obj2,
+       virtual DT_Bool HandleCollision(void* obj1,void* obj2,
                                                 const DT_CollData * coll_data); 
 
 
-  //   SM_Object*      GetSumoObject() { return m_sumoObj; };
+       SM_Object*      GetSumoObject() { return m_sumoObj; };
 
-  */
+  
 
        virtual bool IsPositiveTrigger() {
                bool result = m_bTriggered;
@@ -115,7 +109,7 @@ public:
        }
 
        
-       void EndFrame();
+       virtual void EndFrame();
 
        // todo: put some info for collision maybe
 
index 5967db42235f206869fed52f166e360f19ae1ed9..562a276980728c6cef6258cc81bd315137b99612 100644 (file)
@@ -53,11 +53,12 @@ private:
        double                  m_ipotime;
 
 public:
-       KX_WorldIpoController() : m_ipotime(0.0),
-                                                         m_modify_mist_color(false),
-                                                         m_modify_mist_start(false),
-                                                         m_modify_mist_dist(false),
-                                                         m_modified(true)
+       KX_WorldIpoController() : 
+                               m_modify_mist_color(false),
+                               m_modify_mist_start(false),
+                               m_modify_mist_dist(false),
+                               m_modified(true),
+                               m_ipotime(0.0)
                {}
 
        virtual ~KX_WorldIpoController();
index 3884be14ded7923984cca2f137f843b9d13ac24e..f12e1c08ed400dae01c59586c9c465cef46ec285 100644 (file)
@@ -42,7 +42,8 @@ CPPFLAGS += $(OGL_CPPFLAGS)
 CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
 CPPFLAGS += -I$(NAN_STRING)/include    
 CPPFLAGS += -I$(NAN_SOUNDSYSTEM)/include    
-CPPFLAGS += -I$(NAN_FUZZICS)/include -I$(NAN_SUMO)/include -I$(NAN_MOTO)/include
+CPPFLAGS += -I$(NAN_FUZZICS)/include -I$(NAN_SUMO) -I$(NAN_MOTO)/include
+CPPFLAGS += -I$(NAN_SOLID)/include
 CPPFLAGS += -I../Rasterizer -I../GameLogic -I../SceneGraph
 CPPFLAGS += -I../BlenderRoutines -I../Expressions
 CPPFLAGS += -I../../kernel/gen_system
index fddf476201321821afa95348b361c28dab98818e..4789138d1c236ee17ca6df21fbe182a6b45303ae 100644 (file)
@@ -1,3 +1,5 @@
+import sys
+
 Import ('user_options_dict')
 Import ('library_env')
 
@@ -59,6 +61,7 @@ if user_options_dict['USE_PHYSICS'] == 'solid':
 
 if user_options_dict['USE_PHYSICS'] == 'ode':
     source_files += ['