1. Check material names passed to the physics engine (for collision sensors.)
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>
Sun, 11 Apr 2004 02:50:02 +0000 (02:50 +0000)
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>
Sun, 11 Apr 2004 02:50:02 +0000 (02:50 +0000)
Consider:
gameobj->getClientInfo()->m_auxilary_info = (matname ? (void*)(matname+2) : NULL);
It works if matname is "MAblah", but not if matname is "".

2. Added constructor for struct RAS_CameraData.
3. Added initializers to the struct KX_ClientObjectInfo constructor
4. Collision sensors won't detect near sensors.
5. A stack of minor tweaks, adjusting whitespace, using ++it for stl stuff.

25 files changed:
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/GamePlayer/Makefile
source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/KX_ClientObjectInfo.h
source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_NearSensor.cpp
source/gameengine/Ketsji/KX_TouchSensor.cpp
source/gameengine/Ketsji/KX_TouchSensor.h
source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp
source/gameengine/Physics/Sumo/Fuzzics/src/SM_Object.cpp
source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp
source/gameengine/Physics/Sumo/SumoPhysicsController.cpp
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp
source/gameengine/Physics/Sumo/include/solid.h [deleted file]
source/gameengine/Physics/Sumo/include/solid_broadphase.h [deleted file]
source/gameengine/Physics/Sumo/include/solid_types.h [deleted file]
source/gameengine/Rasterizer/RAS_CameraData.h
source/gameengine/Rasterizer/RAS_IRasterizer.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp

index 0a5b30118a381fbc3fd9de32a8e26b01b2e0f750..ac66bfba4b861bd631295e9ed9c61ae857c7d5b0 100644 (file)
@@ -820,13 +820,9 @@ static KX_LightObject *gamelight_from_blamp(Lamp *la, unsigned int layerflag, KX
 }
 
 static KX_Camera *gamecamera_from_bcamera(Camera *ca, KX_Scene *kxscene, KX_BlenderSceneConverter *converter) {
-       RAS_CameraData camdata;
+       RAS_CameraData camdata(ca->lens, ca->clipsta, ca->clipend, ca->type == CAM_PERSP);
        KX_Camera *gamecamera;
        
-       camdata.m_lens= ca->lens;
-       camdata.m_clipend= ca->clipend;
-       camdata.m_clipstart= ca->clipsta;
-       
        gamecamera= new KX_Camera(kxscene, KX_Scene::m_callbacks, camdata);
        gamecamera->SetName(ca->id.name + 2);
        
index fab44ad9bc743abbce52ffaac83cdd3a8ac9a170..c9a568f708d2da8d1c8a582368c78b979f9b7744 100644 (file)
@@ -37,6 +37,7 @@ SOURCEDIR = source/gameengine/GamePlayer
 DIR = $(OCGDIR)/gameengine/GamePlayer
 DIRS = common ghost
 
+ifneq ($(NAN_NO_PLUGIN),true)
 ifeq ($(OS),$(findstring $(OS), "freebsd irix windows"))
        ifneq ($(FREE_WINDOWS),true)
            DIRS += netscape
@@ -54,5 +55,6 @@ ifeq ($(OS),$(findstring $(OS), "solaris"))
     DIRS += netscape
   endif
 endif
+endif
 
 include nan_subdirs.mk
index 26b4926ec97006f483fe0f6a31896e27ce8d3ec2..75286c4fbadeae2c444b86a34f3c958245a0b2ab 100644 (file)
@@ -118,7 +118,7 @@ int my_set_tpage(TFace *tface)
        unsigned int *rect, *bind;
        int tpx, tpy, tilemode, tileXRep,tileYRep;
 
-       /* afschakelen */
+       /* disable */
        if(tface==0) {
                if(lasttface==0) return 0;
                
index 8aedb666c8791b5d62dd001ea23dd57ac44dd861..68ff43f73c8ea410255ed295acaccfec45f6e9dd 100644 (file)
@@ -144,10 +144,10 @@ bool GPG_Application::startWindow(STR_String& title,
        //STR_String title ("Blender Player - GHOST");
        m_mainWindow = fSystem->createWindow(title, windowLeft, windowTop, windowWidth, windowHeight, GHOST_kWindowStateNormal,
                GHOST_kDrawingContextTypeOpenGL, stereoVisual);
-    if (!m_mainWindow) {
+       if (!m_mainWindow) {
                printf("error: could not create main window\n");
-        exit(-1);
-    }
+               exit(-1);
+       }
 
        /* Check the size of the client rectangle of the window and resize the window
         * so that the client rectangle has the size requested.
@@ -396,14 +396,14 @@ bool GPG_Application::startEngine(void)
        }
        
        // Temporary hack to disable banner display for NaN approved content.
-       /*
+       
        m_canvas->SetBannerDisplayEnabled(true);        
-       Camera* cam;
+/*     Camera* cam;
        cam = (Camera*)G.scene->camera->data;
        if (cam) {
-       if (((cam->flag) & 48)==48) {
-       m_canvas->SetBannerDisplayEnabled(false);
-       }
+               if (((cam->flag) & 48)==48) {
+                       m_canvas->SetBannerDisplayEnabled(false);
+               }
        }
        else {
        showError(CString("Camera data invalid."));
index 253a7e47b2d242b737dfc33dd0ee63c27479ba38..acdf3027f19b82f95b6cbc1c421a917e024e637f 100644 (file)
@@ -104,8 +104,8 @@ void usage(char* program)
        consoleoption = "";
 #endif
        
-       printf("usage:   %s -w [-p l t w h] %s[-g gamengineoptions] "
-               "-s stereomode filename.blend\n", program, consoleoption);
+       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");
index 51cb19e893528ca8b21f7d4d7f0a2df873465752..0ef1a1b86fe849c372ecf715edca2c268912aac6 100644 (file)
@@ -37,7 +37,7 @@
  */
 struct KX_ClientObjectInfo
 {
-       enum {
+       enum clienttype {
                STATIC,
                ACTOR,
                RESERVED1,
@@ -47,9 +47,13 @@ struct KX_ClientObjectInfo
        void*           m_clientobject;
        void*           m_auxilary_info;
 public:
-       KX_ClientObjectInfo(void *clientobject) :
-               m_clientobject(clientobject) 
+       KX_ClientObjectInfo(void *clientobject, clienttype type = STATIC, void *auxilary_info = NULL) :
+               m_type(type),
+               m_clientobject(clientobject),
+               m_auxilary_info(auxilary_info)
        {}
+       
+       bool isActor() { return m_type <= ACTOR; }
 };
 
 #endif //__KX_CLIENTOBJECT_INFO_H
index 96716214edc55eddca66b3f1e59c8a5da4199558..488584b05678dcdc5405c27ac81b2f03dbfb1811 100644 (file)
@@ -80,7 +80,7 @@
 GEN_Map<GEN_HashedPtr,DT_ShapeHandle> map_gamemesh_to_sumoshape;
 
 // forward declarations
-void   BL_RegisterSumoObject(KX_GameObject* gameobj,class SM_Scene* sumoScene,DT_SceneHandle solidscene,class SM_Object* sumoObj,const char* matname,bool isDynamic,bool isActor);
+void   BL_RegisterSumoObject(KX_GameObject* gameobj,class SM_Scene* sumoScene,DT_SceneHandle solidscene,class SM_Object* sumoObj,const STR_String& matname,bool isDynamic,bool isActor);
 DT_ShapeHandle CreateShapeFromMesh(RAS_MeshObject* meshobj);
 
 
@@ -158,7 +158,7 @@ void        KX_ConvertSumoObject(   KX_GameObject* gameobj,
                sumoObj->setRigidBody(objprop->m_angular_rigidbody?true:false);
                
                objprop->m_isactor = objprop->m_dyna = true;
-               BL_RegisterSumoObject(gameobj,sceneptr,sumoEnv->GetSolidScene(),sumoObj,NULL,true, true);
+               BL_RegisterSumoObject(gameobj,sceneptr,sumoEnv->GetSolidScene(),sumoObj,"",true, true);
                
        } 
        else {
@@ -229,7 +229,7 @@ void        KX_ConvertSumoObject(   KX_GameObject* gameobj,
                                        
                                        BL_RegisterSumoObject(gameobj,sceneptr,
                                                sumoEnv->GetSolidScene(),sumoObj,
-                                               matname.ReadPtr(),
+                                               matname,
                                                objprop->m_dyna,
                                                objprop->m_isactor);
                                }
@@ -251,7 +251,15 @@ void       KX_ConvertSumoObject(   KX_GameObject* gameobj,
 
 
 
-void   BL_RegisterSumoObject(KX_GameObject* gameobj,class SM_Scene* sumoScene,DT_SceneHandle solidscene,class SM_Object* sumoObj,const char* matname,bool isDynamic,bool isActor) {
+void   BL_RegisterSumoObject(
+       KX_GameObject* gameobj,
+       class SM_Scene* sumoScene,
+       DT_SceneHandle solidscene,
+       class SM_Object* sumoObj,
+       const STR_String& matname,
+       bool isDynamic,
+       bool isActor) 
+{
 
 
 
@@ -274,7 +282,7 @@ void        BL_RegisterSumoObject(KX_GameObject* gameobj,class SM_Scene* sumoScene,DT_S
                //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.Length() ? (void*)(matname.ReadPtr()+2) : NULL);
 
                physicscontroller->SetObject(gameobj->GetSGNode());
                
index f49090acc0d55f5065a78a0c7b17de6f4221b2c1..91ff9e624595b4a5173f445181fa26abf3dc2c3b 100644 (file)
@@ -73,8 +73,7 @@ KX_GameObject::KX_GameObject(
        m_pPhysicsController1(NULL)
 {
        m_ignore_activity_culling = false;
-       m_pClient_info = new KX_ClientObjectInfo(this);
-       m_pClient_info->m_type = KX_ClientObjectInfo::ACTOR;
+       m_pClient_info = new KX_ClientObjectInfo(this, KX_ClientObjectInfo::ACTOR);
        m_pSGNode = new SG_Node(this,sgReplicationInfo,callbacks);
        
        // define the relationship between this node and it's parent.
index 9fb11f1f31dab136097b287b2e23b52f0db46f9c..84ce0778fbb78c54f36b133e5f81d66374ec82c8 100644 (file)
@@ -63,25 +63,25 @@ class KX_GameObject : public SCA_IObject
 {
        Py_Header;
 
-       bool                                                            m_bDyna;
-       KX_ClientObjectInfo*                            m_pClient_info;
-       STR_String                                                      m_name;
-       STR_String                                                      m_text;
+       bool                                    m_bDyna;
+       KX_ClientObjectInfo*                    m_pClient_info;
+       STR_String                              m_name;
+       STR_String                              m_text;
        std::vector<RAS_MeshObject*>            m_meshes;
        
-       bool                                                            m_bSuspendDynamics;
-       bool                                                            m_bUseObjectColor;
-       MT_Vector4                                                      m_objectColor;
+       bool                                    m_bSuspendDynamics;
+       bool                                    m_bUseObjectColor;
+       MT_Vector4                              m_objectColor;
 
        // Is this object set to be visible? Only useful for the
        // visibility subsystem right now.
-       bool       m_bVisible; 
+       bool                                    m_bVisible; 
 
-       KX_IPhysicsController*                          m_pPhysicsController1;
-       SG_Node*                                                        m_pSGNode;
+       KX_IPhysicsController*                  m_pPhysicsController1;
+       SG_Node*                                m_pSGNode;
 
 protected:
-       MT_CmMatrix4x4                                          m_OpenGL_4x4Matrix;
+       MT_CmMatrix4x4                          m_OpenGL_4x4Matrix;
        
 public:
        virtual void    /* This function should be virtual - derived classed override it */
index 0b32c748646f78381e6d80661cdf296607a0c2b0..880d0d61c1660e54d462ecf6be1b08826ad562eb 100644 (file)
@@ -62,8 +62,7 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr,
                         m_ResetMargin(resetmargin)
 
 {
-       m_client_info = new KX_ClientObjectInfo(gameobj);
-       m_client_info->m_type = KX_ClientObjectInfo::NEAR;
+       m_client_info = new KX_ClientObjectInfo(gameobj, KX_ClientObjectInfo::NEAR);
        
        DT_ShapeHandle shape = (DT_ShapeHandle) vshape;
        m_sumoObj = new SM_Object(shape,NULL,NULL,NULL);
@@ -91,9 +90,7 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr,
                         m_ResetMargin(resetmargin)
 
 {
-       m_client_info = new KX_ClientObjectInfo(gameobj);
-       m_client_info->m_type = KX_ClientObjectInfo::NEAR;
-       m_client_info->m_auxilary_info = NULL;
+       m_client_info = new KX_ClientObjectInfo(gameobj, KX_ClientObjectInfo::NEAR);
        
        m_sumoObj = new SM_Object(DT_NewSphere(0.0),NULL,NULL,NULL);
        m_sumoObj->setMargin(m_Margin);
@@ -118,9 +115,7 @@ 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_client_info = new KX_ClientObjectInfo(m_client_info->m_clientobject, KX_ClientObjectInfo::NEAR);
        
        replica->m_sumoObj = new SM_Object(DT_NewSphere(0.0),NULL,NULL,NULL);
        replica->m_sumoObj->setMargin(m_Margin);
index 6ae670a842ca7fbf6b737f30446b0d5aefb5b520..29d9109c27248150fe16b9f8b7a33f14bd3f77c1 100644 (file)
@@ -119,6 +119,19 @@ KX_TouchSensor::~KX_TouchSensor()
        m_colliders->Release();
 }
 
+CValue* KX_TouchSensor::GetReplica() 
+{
+       KX_TouchSensor* replica = new KX_TouchSensor(*this);
+       replica->m_colliders = new CListValue();
+       replica->m_bCollision = false;
+       replica->m_bTriggered= false;
+       replica->m_hitObject = NULL;
+       replica->m_bLastTriggered = false;
+       // this will copy properties and so on...
+       CValue::AddDataToReplica(replica);
+       return replica;
+}
+
 void   KX_TouchSensor::ReParent(SCA_IObject* parent)
 {
        KX_GameObject *gameobj = static_cast<KX_GameObject *>(parent);
@@ -159,7 +172,7 @@ DT_Bool    KX_TouchSensor::HandleCollision(void* obj1,void* obj2,const DT_CollDa
                        (KX_GameObject*)client_info->m_clientobject : 
                        NULL);
        
-       if (gameobj && (gameobj != parent))
+       if (gameobj && (gameobj != parent) && client_info->isActor())
        {
                if (!m_colliders->SearchValue(gameobj))
                        m_colliders->Add(gameobj->AddRef());
@@ -171,14 +184,8 @@ DT_Bool    KX_TouchSensor::HandleCollision(void* obj1,void* obj2,const DT_CollDa
                        {
                                if (client_info->m_auxilary_info)
                                {
-                                       found = (m_touchedpropname == ((char*)client_info->m_auxilary_info));
+                                       found = (m_touchedpropname == STR_String((char*)client_info->m_auxilary_info));
                                }
-
-                               if (found)
-                               {
-                                       int i=0;
-                               }
-
                        } else
                        {
                                found = (gameobj->GetProperty(m_touchedpropname) != NULL);
index 503388276940d825ab30ea92941198488f96574a..4f2ac2d99fa1d202792b47459fd2b155295ca458 100644 (file)
@@ -77,17 +77,7 @@ public:
                PyTypeObject* T=&Type) ;
        virtual ~KX_TouchSensor();
 
-       virtual CValue* GetReplica() {
-               KX_TouchSensor* replica = new KX_TouchSensor(*this);
-               replica->m_colliders = new CListValue();
-               replica->m_bCollision = false;
-               replica->m_bTriggered= false;
-               replica->m_hitObject = NULL;
-               replica->m_bLastTriggered = false;
-               // this will copy properties and so on...
-               CValue::AddDataToReplica(replica);
-               return replica;
-       };
+       virtual CValue* GetReplica();
        virtual void SynchronizeTransform();
        virtual bool Evaluate(CValue* event);
        virtual void ReParent(SCA_IObject* parent);
index fe135210b91afdc8eda1e4e000349e59ac1c102f..ec86e510c497a5caf6fdf77ede9055caa1ca7a55 100644 (file)
@@ -92,7 +92,7 @@ vector<NG_NetworkMessage*> NG_LoopBackNetworkDeviceInterface::RetrieveNetworkMes
        vector<NG_NetworkMessage*> messages;
        
        std::deque<NG_NetworkMessage*>::iterator mesit=m_messages[m_currentQueue].begin();
-       for (; !(mesit == m_messages[m_currentQueue].end());mesit++)
+       for (; !(mesit == m_messages[m_currentQueue].end()); ++mesit)
        {
 
                // We don't increase the reference count for these messages. We
index ee8a7da953c1897f7d7a7e678046ba6abad6d873..fb02091d4f9cad928630888fe9bb0a358d718bef 100644 (file)
@@ -374,6 +374,8 @@ DT_Bool SM_Object::boing(
        if (obj2->isDynamic())
                obj2->dynamicCollision(local2, -normal, dist, -rel_vel, restitution, friction_factor, invMass);
        
+       //fix(client_data, (void*) obj1, (void*) obj2, coll_data);
+       
        return DT_CONTINUE;
 }
 
@@ -411,6 +413,9 @@ DT_Bool SM_Object::fix(
        MT_Point3 local1(p1), local2(p2);
        // Get collision data from SOLID
        MT_Vector3 normal(local2 - local1);
+       
+       if (normal.dot(normal) < MT_EPSILON)
+               return DT_CONTINUE;
 
        // This distinction between dynamic and non-dynamic objects should not be 
        // necessary. Non-dynamic objects are assumed to have infinite mass.
@@ -439,7 +444,7 @@ DT_Bool SM_Object::fix(
                        MT_Scalar  rel_vel_normal = -0.99*(normal.dot(rel_vel));
 
                        obj2->addLinearVelocity(rel_vel_normal*normal);
-               }
+               } 
        }
        
        return DT_CONTINUE;
@@ -461,9 +466,34 @@ void SM_Object::relax(void)
        notifyClient();
 }
        
-SM_Object::SM_Object(
-) {
+SM_Object::SM_Object() :
+       m_dynamicParent(0),
+       m_client_object(0),
+       
+       m_shape(0),
+       m_materialProps(0),
+       m_materialPropsBackup(0),
+       m_shapeProps(0),
+       m_shapePropsBackup(0),
+       m_object(0),
+       m_margin(0.0),
+       m_scaling(1.0, 1.0, 1.0),
+       m_reaction_impulse(0.0, 0.0, 0.0),
+       m_reaction_force(0.0, 0.0, 0.0),
+       m_kinematic(false),
+       m_prev_kinematic(false),
+       m_is_rigid_body(false),
+       m_lin_mom(0.0, 0.0, 0.0),
+       m_ang_mom(0.0, 0.0, 0.0),
+       m_force(0.0, 0.0, 0.0),
+       m_torque(0.0, 0.0, 0.0),
+       m_error(0.0, 0.0, 0.0),
+       m_combined_lin_vel (0.0, 0.0, 0.0),
+       m_combined_ang_vel (0.0, 0.0, 0.0),
+       m_fh_object(0) 
+{
        // warning no initialization of variables done by moto.
+       std::cout << "SM_Object::SM_Object()" << std::endl;
 }
 
 SM_Object::
index 38c2b48e460a3a87f562c5fff7be425fb1f898cd..f7057fecb6ec67f19eecb86f272b68826635b00d 100644 (file)
@@ -162,8 +162,8 @@ void SM_Scene::remove(SM_Object& object) {
 
 void SM_Scene::proceed(MT_Scalar timeStep, MT_Scalar subSampling) {
        // Don't waste time...but it's OK to spill a little.
-       if (timeStep < 0.001)
-               return;
+       //if (timeStep < 0.001)
+       //      return;
 
        // Divide the timeStep into a number of subsamples of size roughly 
        // equal to subSampling (might be a little smaller).
@@ -208,14 +208,16 @@ void SM_Scene::proceed(MT_Scalar timeStep, MT_Scalar subSampling) {
 #if 0
        clearObjectCombinedVelocities();
 #endif
-       if (DT_Test(m_scene, m_fixRespTable))
+/*     if (DT_Test(m_scene, m_fixRespTable))
                for (i = m_objectList.begin(); i != m_objectList.end(); ++i)
-                       (*i)->relax(); 
+                       (*i)->relax();  */
+       DT_Test(m_scene, m_fixRespTable);
        
        // Finish this timestep by saving al state information for the next
        // timestep and clearing the accumulated forces. 
 
        for (i = m_objectList.begin(); i != m_objectList.end(); ++i) {
+               (*i)->relax();
                (*i)->proceedKinematic(timeStep);
                (*i)->saveReactionForce(timeStep);
                (*i)->clearForce();
index c08c20cf9b9a263dec904a4f0437f94dea3a0e08..5a3c6e19e9b74c5dbacd47d61d07a724695839c9 100644 (file)
@@ -71,6 +71,7 @@ SumoPhysicsController::~SumoPhysicsController()
                m_sumoScene->remove(*m_sumoObj);
                
                delete m_sumoObj;
+               m_sumoObj = NULL;
        }
 }
 
index 3e59be6a8168040993d280159508a7003a336c39..a44642de0566a83e4f8d27001f0feeb8d34c41b0 100644 (file)
@@ -56,6 +56,7 @@ SumoPhysicsEnvironment::SumoPhysicsEnvironment()
 
 SumoPhysicsEnvironment::~SumoPhysicsEnvironment()
 {
+       std::cout << "delete m_sumoScene " << m_sumoScene << std::endl;
        delete m_sumoScene;
        DT_DestroyScene(m_solidScene);
        //DT_DestroyRespTable(m_respTable);
diff --git a/source/gameengine/Physics/Sumo/include/solid.h b/source/gameengine/Physics/Sumo/include/solid.h
deleted file mode 100644 (file)
index 00f282e..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-#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_RespTableHandle);
-
-typedef enum DT_ScalarType {
-       DT_FLOAT,
-       DT_DOUBLE
-} DT_ScalarType;
-
-typedef enum DT_ResponseType { 
-       DT_NO_RESPONSE,              
-       DT_SIMPLE_RESPONSE,
-       DT_WITNESSED_RESPONSE,
-       DT_DEPTH_RESPONSE,
-} DT_ResponseType;
-    
-typedef struct DT_CollData {
-       DT_Vector3 point1;
-       DT_Vector3 point2;
-       DT_Vector3 normal;
-} DT_CollData;
-
-typedef void (*DT_ResponseCallback)(
-       void *client_data,
-       void *client_object1,
-       void *client_object2,
-       const DT_CollData *coll_data);
-
-/* Shape definition, similar to OpenGL  */
-
-extern DT_ShapeHandle DT_Box(DT_Scalar x, DT_Scalar y, DT_Scalar z);
-extern DT_ShapeHandle DT_Cone(DT_Scalar radius, DT_Scalar height);
-extern DT_ShapeHandle DT_Cylinder(DT_Scalar radius, DT_Scalar height);
-extern DT_ShapeHandle DT_Sphere(DT_Scalar radius);
-extern DT_ShapeHandle DT_Ray(DT_Scalar x, DT_Scalar y, DT_Scalar z);
-
-extern DT_ShapeHandle DT_NewComplexShape();
-extern void           DT_EndComplexShape();
-
-extern DT_ShapeHandle DT_NewPolyhedron();
-extern void           DT_EndPolyhedron();
-
-extern void DT_Begin();
-extern void DT_End();
-
-extern void DT_Vertex(DT_Scalar x, DT_Scalar y, DT_Scalar z);
-
-/* Vertex arrays maintained by the client application can be accessed directly
-   by SUMO. For instance, you have a vertex struct in the client of the form:
-   
-   struct Vertex {
-   float xyz[3];
-   float uv[2];
-   float normal[3];
-   };
-   
-   And maintain vertex arrays e.g. as
-
-   struct Vertex vertices[328];
-
-   Within a Polyhedron or a ComplexShape you can use this data by specifying
-
-   DT_VertexBase(vertices, DT_FLOAT, sizeof(struct Vertex));
-
-   and refer to vertices in the array using   
-
-   DT_VertexIndex(10);
-
-   or 
-
-   DT_Index indices[5] = { 6, 4, 8, 1, 3 };
-   DT_VertexIndices(5, indices);
-
-   or even
-
-   DT_VertexRange(8, 4);
-
-   for the range 8, 9, 10, 11.
-*/
-
-
-extern void DT_SetVertexBase(const void *base, DT_ScalarType type,
-                                                        DT_Size stride);
-extern void DT_VertexIndex(DT_Index index);
-extern void DT_VertexIndices(DT_Count count, const DT_Index *indices);
-extern void DT_VertexRange(DT_Index first, DT_Count count); 
-
-
-/* currently not implemented */
-extern void DT_ChangeVertexBase(DT_ShapeHandle shape, const void *base);
-
-extern void DT_DeleteShape(DT_ShapeHandle shape);
-
-/* Scene */
-
-extern DT_SceneHandle DT_CreateScene(); 
-extern void           DT_DeleteScene(DT_SceneHandle scene);
-
-extern void DT_AddObject(DT_SceneHandle scene, DT_ObjectHandle object);
-extern void DT_RemoveObject(DT_SceneHandle scene, DT_ObjectHandle object);
-
-
-
-/* Object  */
-
-extern DT_ObjectHandle DT_CreateObject(
-       void *client_object,      /* pointer to object in client memory */
-       DT_ShapeHandle shape  /* the shape or geometry of the object */
-       );
-
-extern void DT_DeleteObject(DT_ObjectHandle object);
-
-extern void DT_SetScaling(DT_ObjectHandle object, const DT_Vector3 scaling);
-extern void DT_SetPosition(DT_ObjectHandle object, const DT_Vector3 position);
-extern void DT_SetOrientation(DT_ObjectHandle object, const DT_Quaternion orientation);
-
-extern void DT_SetMargin(DT_ObjectHandle object, DT_Scalar margin);
-
-extern void DT_SetMatrixf(DT_ObjectHandle object, const float *m); 
-extern void DT_GetMatrixf(DT_ObjectHandle object, float *m); 
-
-extern void DT_SetMatrixd(DT_ObjectHandle object, const double *m); 
-extern void DT_GetMatrixd(DT_ObjectHandle object, double *m); 
-
-extern void DT_GetWorldCoord(DT_ObjectHandle object,
-                                                        const DT_Vector3 local,
-                                                        DT_Vector3 world);
-
-extern DT_Scalar DT_GetClosestPair(DT_ObjectHandle object1, DT_ObjectHandle object2,
-                                                                  DT_Vector3 point1, DT_Vector3 point2);  
-
-
-/* Response, see SOLID user manual */
-
-extern DT_RespTableHandle DT_CreateRespTable(); 
-extern void               DT_DeleteRespTable(DT_RespTableHandle respTable); 
-
-extern void DT_CallResponse(DT_RespTableHandle respTable,
-                                                       DT_ObjectHandle object1,
-                                                       DT_ObjectHandle object2,
-                                                       const DT_CollData *coll_data);
-
-extern void DT_SetDefaultResponse(DT_RespTableHandle respTable,
-                                                                 DT_ResponseCallback response, 
-                                                                 DT_ResponseType type, 
-                                                                 void *client_data);
-
-extern void DT_ClearDefaultResponse(DT_RespTableHandle respTable);
-
-extern void DT_SetObjectResponse(DT_RespTableHandle respTable,
-                                                                DT_ObjectHandle object,
-                                                                DT_ResponseCallback response,
-                                                                DT_ResponseType type, void *client_data);
-extern void DT_ClearObjectResponse(DT_RespTableHandle respTable,
-                                                                  DT_ObjectHandle object);
-
-extern void DT_SetPairResponse(DT_RespTableHandle respTable,
-                                                          DT_ObjectHandle object1,
-                                                          DT_ObjectHandle object2, 
-                                                          DT_ResponseCallback  response,
-                                                          DT_ResponseType type, 
-                                                          void *client_data);
-extern void DT_ClearPairResponse(DT_RespTableHandle respTable,
-                                                                DT_ObjectHandle object1, 
-                                                                DT_ObjectHandle object2);
-
-
-
-/* Perform a collision test for a given scene, using a response table */
-extern DT_Count DT_Test(DT_SceneHandle scene, DT_RespTableHandle respTable);
-
-extern void *DT_RayTest(DT_SceneHandle scene, void *ignore_client,
-                                               const DT_Vector3 from, const DT_Vector3 to,
-                                               DT_Vector3 spot, DT_Vector3 normal);
-
-extern int DT_ObjectRayTest(DT_ObjectHandle object,
-                                                       const DT_Vector3 from, const DT_Vector3 to,
-                                                       DT_Vector3 spot, DT_Vector3 normal);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/source/gameengine/Physics/Sumo/include/solid_broadphase.h b/source/gameengine/Physics/Sumo/include/solid_broadphase.h
deleted file mode 100644 (file)
index 2084789..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef SOLID_BROADPHASE_H
-#define SOLID_BROADPHASE_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);
-
-extern BP_SceneHandle BP_CreateScene(void *client_data,
-                                                                        BP_Callback beginOverlap,
-                                                                        BP_Callback endOverlap);
-extern void           BP_DeleteScene(BP_SceneHandle scene);
-       
-extern BP_ProxyHandle BP_CreateProxy(BP_SceneHandle scene, void *object,
-                                                                        const DT_Vector3 lower, 
-                                                                        const DT_Vector3 upper);
-
-extern void           BP_DeleteProxy(BP_SceneHandle scene, 
-                                                                        BP_ProxyHandle proxy);
-
-extern void BP_SetBBox(BP_ProxyHandle proxy, 
-                                          const DT_Vector3 lower, 
-                                          const DT_Vector3 upper);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/source/gameengine/Physics/Sumo/include/solid_types.h b/source/gameengine/Physics/Sumo/include/solid_types.h
deleted file mode 100644 (file)
index 64b345c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef SOLID_TYPES_H
-#define SOLID_TYPES_H
-
-#define DT_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
-    
-typedef double        DT_Scalar;        
-typedef unsigned int  DT_Count;
-typedef unsigned int  DT_Index;
-typedef unsigned int  DT_Size;
-
-typedef DT_Scalar DT_Vector3[3]; 
-typedef DT_Scalar DT_Quaternion[4]; 
-
-#endif
-
index b136aedf4055d8465a021ba873b83989ff50556c..a4245025f2ae51d781be4191d9fe23c0ebc0fd66 100644 (file)
@@ -37,6 +37,15 @@ struct RAS_CameraData
        float m_lens;
        float m_clipstart;
        float m_clipend;
+       bool m_perspective;
+       
+       RAS_CameraData(float lens = 35., float clipstart = 0.1, float clipend = 100., bool perspective = true) :
+               m_lens(lens),
+               m_clipstart(clipstart),
+               m_clipend(clipend),
+               m_perspective(perspective)
+       {
+       }
 };
 
 #endif //__RAS_CAMERADATA_H
index 144342e86cf3011713bf746372af5eba0188d124..9871c0b67d68f8b36f434b37b8421720f0bd9217 100644 (file)
@@ -94,8 +94,12 @@ public:
        virtual void    ClearDepthBuffer()=0;
        virtual void    ClearCachingInfo(void)=0;
        virtual void    EndFrame()=0;
+       /**
+        * SetRenderArea sets the render area in the 2d canvas
+        */
        virtual void    SetRenderArea()=0;
 
+       // Stereo Functions
        virtual void    SetStereoMode(const int stereomode)=0;
        virtual bool    Stereo()=0;
        virtual void    SetEye(const int eye)=0;
@@ -103,6 +107,20 @@ public:
        virtual void    SetFocalLength(const float focallength)=0;
 
        virtual void    SwapBuffers()=0;
+       
+       // Drawing Functions
+       /**
+        * IndexPrimitives: Renders primitives.
+        * @param vertexarrays is an array of vertex arrays
+        * @param indexarrays is an array of index arrays
+        * @param mode determines the type of primitive stored in the vertex/index arrays:
+        *              0 triangles
+        *              1 lines (default)
+        *              2 quads
+        * @param polymat (reserved)
+        * @param useObjectColor will render the object using @param rgbacolor instead of 
+        *  vertex colours.
+        */
        virtual void    IndexPrimitives( const vecVertexArray& vertexarrays,
                                                        const vecIndexArrays & indexarrays,
                                                        int mode,
@@ -110,6 +128,10 @@ public:
                                                        class RAS_IRenderTools* rendertools,
                                                        bool useObjectColor,
                                                        const MT_Vector4& rgbacolor)=0;
+       /**
+        * IndexPrimitivesEx: See IndexPrimitives.
+        * IndexPrimitivesEx will renormalize faces if @param vertexarrays[i].getFlag() & TV_CALCFACENORMAL
+        */
        virtual void    IndexPrimitives_Ex( const vecVertexArray& vertexarrays,
                                                        const vecIndexArrays & indexarrays,
                                                        int mode,
@@ -117,6 +139,10 @@ public:
                                                        class RAS_IRenderTools* rendertools,
                                                        bool useObjectColor,
                                                        const MT_Vector4& rgbacolor)=0;
+       /**
+        * IndexPrimitives_3DText will render text into the polygons.
+        * The text to be rendered is from @param rendertools client object's text property.
+        */
        virtual void    IndexPrimitives_3DText( const vecVertexArray& vertexarrays,
                                                        const vecIndexArrays & indexarrays,
                                                        int mode,
@@ -161,12 +187,18 @@ public:
                                                                 float blue,
                                                                 float alpha)=0;
        
+       /**
+        * @param drawingmode = KX_BOUNDINGBOX, KX_WIREFRAME, KX_SOLID, KX_SHADED or KX_TEXTURED.
+        */
        virtual void    SetDrawingMode(int drawingmode)=0;
        virtual int             GetDrawingMode()=0;
 
        virtual void    EnableTextures(bool enable)=0;
        
        virtual void    SetCullFace(bool enable)=0;
+       /**
+        * Sets wireframe mode.
+        */
        virtual void    SetLines(bool enable)=0;
 
        virtual double  GetTime()=0;
@@ -177,7 +209,8 @@ public:
                float bottom,
                float top,
                float frustnear,
-               float frustfar
+               float frustfar,
+               bool perspective = true
        )=0;
 
        virtual void    SetSpecularity(float specX,
index b7f375e770c042d0b44f733c00c7631167b54659..647fb21988a24d3378fa3ac921bf8394830a970d 100644 (file)
@@ -68,7 +68,7 @@ RAS_OpenGLRasterizer::~RAS_OpenGLRasterizer()
 
 
 
-void Myinit_gl_stuff(void)     
+static void Myinit_gl_stuff(void)      
 {
        float mat_specular[] = { 0.5, 0.5, 0.5, 1.0 };
        float mat_shininess[] = { 35.0 };
@@ -259,7 +259,7 @@ void RAS_OpenGLRasterizer::Exit()
        glClearDepth(1.0); 
        glClearColor(m_redback, m_greenback, m_blueback, m_alphaback);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-    glDepthMask (GL_TRUE);
+       glDepthMask (GL_TRUE);
        glDepthFunc(GL_LEQUAL);
        glBlendFunc(GL_ONE, GL_ZERO);
 
@@ -292,7 +292,7 @@ bool RAS_OpenGLRasterizer::BeginFrame(int drawingmode, double time)
 
        glShadeModel(GL_SMOOTH);
 
-   m_2DCanvas->BeginFrame();
+       m_2DCanvas->BeginFrame();
        
        return true;
 }
@@ -1083,7 +1083,8 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
        float bottom,
        float top,
        float frustnear,
-       float frustfar
+       float frustfar,
+       bool perspective
 ){
        MT_Matrix4x4 result;
        double mat[16];
@@ -1110,10 +1111,11 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
                        }
                        // leave bottom, top, bottom and top untouched
        }
-
+       
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glFrustum(left, right, bottom, top, frustnear, frustfar);
+               
        glGetDoublev(GL_PROJECTION_MATRIX, mat);
        result.setValue(mat);
 
index 24f0e42c91df52e7e2c78d04d69aa23bd1534a9d..d7488b9901a4786feb93d31c25a9727f49da1c88 100644 (file)
@@ -203,7 +203,8 @@ public:
                                                        float bottom,
                                                        float top,
                                                        float frustnear,
-                                                       float frustfar
+                                                       float frustfar,
+                                                       bool perspective
                                                );
 
        virtual void    SetSpecularity(
index 4ce030ed484775884840afc9d6be47097faa532d..8a51a25e6aa3576ddc7ac2b611b8b1a310c2f6e7 100644 (file)
@@ -73,10 +73,6 @@ bool RAS_VAOpenGLRasterizer::Init(void)
        
        if (result)
        {
-               // if possible, add extensions to other platforms too, if this
-               // rasterizer becomes messy just derive one for each platform 
-               // (ie. KX_Win32Rasterizer, KX_LinuxRasterizer etc.)
-
                glEnableClientState(GL_VERTEX_ARRAY);
                glDisableClientState(GL_TEXTURE_COORD_ARRAY);
                glDisableClientState(GL_NORMAL_ARRAY);
@@ -187,6 +183,17 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays
                glColor3d(0,0,0);
        }
        // use glDrawElements to draw each vertexarray
+       static bool doWarning = true;
+       if (vertexarrays.size() > 1 && doWarning)
+       {
+               /* TODO: if vertexarrays.size() == 1 then if we are multitexturing
+                  we can glLockArraysEXT the vertex arrays - GL will be able to cache
+                  the vertex transforms. */
+               std::cout << "# vertex arrays: " << vertexarrays.size() << std::endl;
+               std::cout << "I wondered if this could happen: please inform the proper authorities." << std::endl;
+               doWarning = false;
+       }
+       
        for (vt=0;vt<vertexarrays.size();vt++)
        {
                vertexarray = &((*vertexarrays[vt]) [0]);