diff options
Diffstat (limited to 'source')
16 files changed, 76 insertions, 61 deletions
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 6984e5663db..3ee8a5a3501 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -28,8 +28,6 @@ int listvalue_bufferlen(PyObject* list) return ( ((CListValue*)list)->GetCount()); } - - PyObject* listvalue_buffer_item(PyObject* list,int index) { if (index >= 0 && index < ((CListValue*) list)->GetCount()) @@ -45,6 +43,19 @@ PyObject* listvalue_buffer_item(PyObject* list,int index) return NULL; } +PyObject* listvalue_mapping_subscript(PyObject* list,PyObject* pyindex) +{ + if (PyString_Check(pyindex)) + { + STR_String index(PyString_AsString(pyindex)); + CValue *item = ((CListValue*) list)->FindValue(index); + if (item) + return (PyObject*) item; + + } + Py_Error(PyExc_IndexError, "Python ListIndex out of range"); + Py_Return; +} /* just slice it into a python list... */ @@ -157,7 +168,7 @@ static PySequenceMethods listvalue_as_sequence = { /* Is this one used ? */ static PyMappingMethods instance_as_mapping = { (inquiry)listvalue_bufferlen, /*mp_length*/ - 0,//(binaryfunc)instance_subscript, /*mp_subscript*/ + (binaryfunc)listvalue_mapping_subscript, /*mp_subscript*/ 0,//(objobjargproc)instance_ass_subscript, /*mp_ass_subscript*/ }; diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.h b/source/gameengine/GameLogic/SCA_ILogicBrick.h index 5199f66f409..588c5ca7aba 100644 --- a/source/gameengine/GameLogic/SCA_ILogicBrick.h +++ b/source/gameengine/GameLogic/SCA_ILogicBrick.h @@ -39,6 +39,7 @@ class SCA_ILogicBrick : public CValue { Py_Header; +protected: SCA_IObject* m_gameobj; int m_Execute_Priority; int m_Execute_Ueber_Priority; @@ -48,7 +49,6 @@ class SCA_ILogicBrick : public CValue STR_String m_text; STR_String m_name; //unsigned long m_drawcolor; -protected: void RegisterEvent(CValue* eventval); void RemoveEvent(); CValue* GetEvent(); diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp index 4bc0e2539f0..d483f400064 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp @@ -495,7 +495,7 @@ PyObject* SCA_RandomActuator::PySetBoolBernouilli(PyObject* self, return NULL; } - m_distribution = KX_RANDOMACT_BOOL_CONST; + m_distribution = KX_RANDOMACT_BOOL_BERNOUILLI; m_parameter1 = paraArg; enforceConstraints(); Py_Return; diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h index 21d4af64135..cb061206a21 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.h +++ b/source/gameengine/Ketsji/KX_CameraActuator.h @@ -48,10 +48,8 @@ class KX_CameraActuator : public SCA_IActuator { - -private : Py_Header; - +private : /** Object that will be tracked. */ const CValue *m_ob; diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.h b/source/gameengine/Ketsji/KX_ConstraintActuator.h index 800a1ae10fb..c1c58b3b664 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.h +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.h @@ -41,7 +41,7 @@ class KX_ConstraintActuator : public SCA_IActuator { Py_Header; - +protected: // Damp time (int), int m_dampTime; // min (float), diff --git a/source/gameengine/Ketsji/KX_GameActuator.h b/source/gameengine/Ketsji/KX_GameActuator.h index b3acd3b7400..19908a37e54 100644 --- a/source/gameengine/Ketsji/KX_GameActuator.h +++ b/source/gameengine/Ketsji/KX_GameActuator.h @@ -41,6 +41,7 @@ class KX_GameActuator : public SCA_IActuator { Py_Header; +protected: int m_mode; bool m_restart; STR_String m_filename; diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp index 6d2b8dc49eb..7a894db6647 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.cpp +++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp @@ -428,6 +428,10 @@ PyMethodDef KX_IpoActuator::Methods[] = { METH_VARARGS, SetType_doc}, {"getType", (PyCFunction) KX_IpoActuator::sPyGetType, METH_VARARGS, GetType_doc}, + {"setForceIpoActsLocal", (PyCFunction) KX_IpoActuator::sPySetForceIpoActsLocal, + METH_VARARGS, SetForceIpoActsLocal_doc}, + {"getForceIpoActsLocal", (PyCFunction) KX_IpoActuator::sPyGetForceIpoActsLocal, + METH_VARARGS, GetForceIpoActsLocal_doc}, {NULL,NULL} //Sentinel }; @@ -494,6 +498,8 @@ PyObject* KX_IpoActuator::PySetProperty(PyObject* self, return NULL; } + m_propname = propertyName; + Py_Return; } diff --git a/source/gameengine/Ketsji/KX_IpoActuator.h b/source/gameengine/Ketsji/KX_IpoActuator.h index 49c06a74ece..e2f877c7f7c 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.h +++ b/source/gameengine/Ketsji/KX_IpoActuator.h @@ -40,7 +40,7 @@ class KX_IpoActuator : public SCA_IActuator { Py_Header; - +protected: bool m_bNegativeEvent; /** Begin frame of the ipo. */ diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp index d167349789c..798ebdfc944 100644 --- a/source/gameengine/Ketsji/KX_RadarSensor.cpp +++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp @@ -77,6 +77,29 @@ KX_RadarSensor::~KX_RadarSensor() } +CValue* KX_RadarSensor::GetReplica() +{ + KX_RadarSensor* replica = new KX_RadarSensor(*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); + + replica->m_client_info = new KX_ClientObjectInfo(m_client_info->m_clientobject, KX_ClientObjectInfo::RADAR); + + replica->m_sumoObj = new SM_Object(DT_NewCone(m_coneradius, m_coneheight),NULL,NULL,NULL); + replica->m_sumoObj->setMargin(m_Margin); + replica->m_sumoObj->setClientObject(replica->m_client_info); + + replica->SynchronizeTransform(); + + return replica; +} + + /** * Transforms the collision object. A cone is not correctly centered * for usage. */ diff --git a/source/gameengine/Ketsji/KX_RadarSensor.h b/source/gameengine/Ketsji/KX_RadarSensor.h index 055041f749c..0e055357f18 100644 --- a/source/gameengine/Ketsji/KX_RadarSensor.h +++ b/source/gameengine/Ketsji/KX_RadarSensor.h @@ -77,6 +77,7 @@ public: KX_RadarSensor(); virtual ~KX_RadarSensor(); virtual void SynchronizeTransform(); + virtual CValue* GetReplica(); /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp index b5b47598b1b..babecdd585a 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp @@ -57,7 +57,8 @@ RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname, m_transparant(transparant), m_zsort(zsort), m_lightlayer(lightlayer), - m_bIsTriangle(bIsTriangle) + m_bIsTriangle(bIsTriangle), + m_polymatid(m_newpolymatid++) { m_shininess = 35.0; m_specular = MT_Vector3(0.5,0.5,0.5); @@ -84,48 +85,10 @@ bool RAS_IPolyMaterial::Equals(const RAS_IPolyMaterial& lhs) const bool RAS_IPolyMaterial::Less(const RAS_IPolyMaterial& rhs) const { - /** - * @warning STL requires lhs.Less(rhs) == rhs.Less(lhs) implies lhs.Equals(rhs). - * This function *must* return different values for lhs.Less(rhs) and rhs.Less(lhs) if - * !lhs.Equals(rhs) !! - */ - if (m_materialname.hash() < rhs.m_materialname.hash()) - return true; - - if (m_materialname.hash() > rhs.m_materialname.hash() || - m_texturename.hash() > rhs.m_texturename.hash()) + if (Equals(rhs)) return false; - - if (m_texturename.hash() < rhs.m_texturename.hash() || - m_lightlayer < rhs.m_lightlayer) - return true; - - if (m_lightlayer > rhs.m_lightlayer || - m_bIsTriangle > rhs.m_bIsTriangle) - return false; - - if (m_bIsTriangle < rhs.m_bIsTriangle || - m_drawingmode < rhs.m_drawingmode) - return true; - - if (m_drawingmode > rhs.m_drawingmode || - m_transparant > !rhs.m_transparant) - return false; - - if (m_transparant < rhs.m_transparant || - m_tileyrep < rhs.m_tileyrep) - return true; - - if (m_tileyrep > rhs.m_tileyrep || - m_tilexrep > rhs.m_tilexrep) - return false; - - if (m_tilexrep < rhs.m_tilexrep || - m_tile < rhs.m_tile) - return true; - - return !(m_tile > rhs.m_tile || - m_zsort > rhs.m_zsort); + + return m_polymatid < rhs.m_polymatid; } int RAS_IPolyMaterial::GetLightLayer() const @@ -167,3 +130,5 @@ const STR_String& RAS_IPolyMaterial::GetTextureName() const { return m_texturename; } + +unsigned int RAS_IPolyMaterial::m_newpolymatid = 0; diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h index 93c6d829e85..648a8b63464 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h @@ -60,6 +60,10 @@ protected: int m_lightlayer; bool m_bIsTriangle; + unsigned int m_polymatid; + + static unsigned int m_newpolymatid; + public: MT_Vector3 m_diffuse; diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index 815c095e583..21e47e12050 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -299,13 +299,21 @@ public: float frustfar, bool perspective = true )=0; - + /** + * Sets the specular colour component of the lighting equation. + */ virtual void SetSpecularity(float specX, float specY, float specZ, float specval)=0; - + + /** + * Sets the specular exponent component of the lighting equation. + */ virtual void SetShinyness(float shiny)=0; + /** + * Sets the diffuse colour component of the lighting equation. + */ virtual void SetDiffuse(float difX, float difY, float difZ, diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp index faaeafb0d05..83e981b840a 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp @@ -257,9 +257,9 @@ void RAS_MaterialBucket::Render(const MT_Transform& cameratrans, if (m_meshSlots.begin()== m_meshSlots.end()) return; - rendertools->SetViewMat(cameratrans); + //rendertools->SetViewMat(cameratrans); - rasty->SetMaterial(*m_material); + //rasty->SetMaterial(*m_material); if (m_meshSlots.size() >0) { diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 5df296970a3..3e93a7a74b9 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -686,7 +686,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray numindices = indexarray.size(); if (!numindices) - break; + continue; int vindex=0; switch (mode) @@ -777,7 +777,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray mv1 = MT_Point3(vertexarray[(indexarray[vindex])].getLocalXYZ()); mv2 = MT_Point3(vertexarray[(indexarray[vindex+1])].getLocalXYZ()); mv3 = MT_Point3(vertexarray[(indexarray[vindex+2])].getLocalXYZ()); - mv4 = MT_Point3(vertexarray[(indexarray[vindex+2])].getLocalXYZ()); + mv4 = MT_Point3(vertexarray[(indexarray[vindex+3])].getLocalXYZ()); fnor = (((mv2-mv1).cross(mv3-mv2))+((mv4-mv3).cross(mv1-mv4))).safe_normalized(); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp index c0d90bb3c09..50b786bb120 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp @@ -183,8 +183,6 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays glColor3d(0,0,0); } // use glDrawElements to draw each vertexarray - static bool doWarning = true; - for (vt=0;vt<vertexarrays.size();vt++) { vertexarray = &((*vertexarrays[vt]) [0]); @@ -193,7 +191,7 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays int numverts = vertexarrays[vt]->size(); if (!numindices) - break; + continue; glVertexPointer(3,GL_FLOAT,vtxstride,vertexarray->getLocalXYZ()); glTexCoordPointer(2,GL_FLOAT,vtxstride,vertexarray->getUV1()); |