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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-02-25 09:43:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-02-25 09:43:03 +0300
commitc77af311665d230ed933138cd20962d021ad5c2b (patch)
tree5c2f89032fb773a046aab0a7a6c9a17162260b99 /source/gameengine/Ketsji/KX_RadarSensor.cpp
parent2eb85c01f3e0ea2ba9dd129ae70e8b370953d7b5 (diff)
Minor speedups for the BGE
* Where possible use vec.setValue(x,y,z) to assign values to a vector instead of vec= MT_Vector3(x,y,z), for MT_Point and MT_Matrix types too. * Comparing TexVerts was creating 10 MT_Vector types - instead compare as floats. * Added SG_Spatial::SetWorldFromLocalTransform() since the local transform is use for world transform in some cases. * removed some unneeded vars from UpdateChildCoordinates functions * Py API - Mouse, Ray, Radar sensors - use PyObjectFrom(vec) rather then filling the lists in each function. Use METH_NOARGS for get*() functions.
Diffstat (limited to 'source/gameengine/Ketsji/KX_RadarSensor.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_RadarSensor.cpp35
1 files changed, 9 insertions, 26 deletions
diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp
index 1321b862463..2ba1126a633 100644
--- a/source/gameengine/Ketsji/KX_RadarSensor.cpp
+++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp
@@ -28,6 +28,7 @@
#include "KX_RadarSensor.h"
#include "KX_GameObject.h"
+#include "KX_PyMath.h"
#include "PHY_IPhysicsController.h"
#ifdef HAVE_CONFIG_H
@@ -221,11 +222,11 @@ PyParentObject KX_RadarSensor::Parents[] = {
PyMethodDef KX_RadarSensor::Methods[] = {
{"getConeOrigin", (PyCFunction) KX_RadarSensor::sPyGetConeOrigin,
- METH_VARARGS, (PY_METHODCHAR)GetConeOrigin_doc},
+ METH_NOARGS, (PY_METHODCHAR)GetConeOrigin_doc},
{"getConeTarget", (PyCFunction) KX_RadarSensor::sPyGetConeTarget,
- METH_VARARGS, (PY_METHODCHAR)GetConeTarget_doc},
+ METH_NOARGS, (PY_METHODCHAR)GetConeTarget_doc},
{"getConeHeight", (PyCFunction) KX_RadarSensor::sPyGetConeHeight,
- METH_VARARGS, (PY_METHODCHAR)GetConeHeight_doc},
+ METH_NOARGS, (PY_METHODCHAR)GetConeHeight_doc},
{NULL,NULL,NULL,NULL} //Sentinel
};
@@ -238,41 +239,23 @@ const char KX_RadarSensor::GetConeOrigin_doc[] =
"getConeOrigin()\n"
"\tReturns the origin of the cone with which to test. The origin\n"
"\tis in the middle of the cone.";
-PyObject* KX_RadarSensor::PyGetConeOrigin(PyObject* self,
- PyObject* args,
- PyObject* kwds) {
- PyObject *retVal = PyList_New(3);
-
- PyList_SetItem(retVal, 0, PyFloat_FromDouble(m_cone_origin[0]));
- PyList_SetItem(retVal, 1, PyFloat_FromDouble(m_cone_origin[1]));
- PyList_SetItem(retVal, 2, PyFloat_FromDouble(m_cone_origin[2]));
-
- return retVal;
+PyObject* KX_RadarSensor::PyGetConeOrigin(PyObject* self) {
+ return PyObjectFrom(m_cone_origin);
}
/* getConeOrigin */
const char KX_RadarSensor::GetConeTarget_doc[] =
"getConeTarget()\n"
"\tReturns the center of the bottom face of the cone with which to test.\n";
-PyObject* KX_RadarSensor::PyGetConeTarget(PyObject* self,
- PyObject* args,
- PyObject* kwds) {
- PyObject *retVal = PyList_New(3);
-
- PyList_SetItem(retVal, 0, PyFloat_FromDouble(m_cone_target[0]));
- PyList_SetItem(retVal, 1, PyFloat_FromDouble(m_cone_target[1]));
- PyList_SetItem(retVal, 2, PyFloat_FromDouble(m_cone_target[2]));
-
- return retVal;
+PyObject* KX_RadarSensor::PyGetConeTarget(PyObject* self) {
+ return PyObjectFrom(m_cone_target);
}
/* getConeOrigin */
const char KX_RadarSensor::GetConeHeight_doc[] =
"getConeHeight()\n"
"\tReturns the height of the cone with which to test.\n";
-PyObject* KX_RadarSensor::PyGetConeHeight(PyObject* self,
- PyObject* args,
- PyObject* kwds) {
+PyObject* KX_RadarSensor::PyGetConeHeight(PyObject* self) {
return PyFloat_FromDouble(m_coneheight);
}