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.
This commit is contained in:
Campbell Barton
2009-02-25 06:43:03 +00:00
parent 2eb85c01f3
commit c77af31166
18 changed files with 164 additions and 318 deletions

View File

@@ -350,7 +350,7 @@ PyObject *quat_rotation(PyObject *arg1, PyObject *arg2)
PyObject *M_Mathutils_Rand(PyObject * self, PyObject * args)
{
float high, low, range;
double rand;
double drand;
//initializers
high = 1.0;
low = 0.0;
@@ -364,14 +364,14 @@ PyObject *M_Mathutils_Rand(PyObject * self, PyObject * args)
"Mathutils.Rand(): high value should be larger than low value\n"));
//get the random number 0 - 1
rand = BLI_drand();
drand = BLI_drand();
//set it to range
range = high - low;
rand = rand * range;
rand = rand + low;
drand = drand * range;
drand = drand + low;
return PyFloat_FromDouble(rand);
return PyFloat_FromDouble(drand);
}
//----------------------------------VECTOR FUNCTIONS---------------------
//----------------------------------Mathutils.Vector() ------------------