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

@@ -44,13 +44,13 @@ SG_Spatial(
):
SG_IObject(clientobj,clientinfo,callbacks),
m_localPosition(MT_Point3(0.0,0.0,0.0)),
m_localRotation(MT_Matrix3x3(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)),
m_localScaling(MT_Vector3(1.f,1.f,1.f)),
m_localPosition(0.0,0.0,0.0),
m_localRotation(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),
m_localScaling(1.f,1.f,1.f),
m_worldPosition(MT_Point3(0.0,0.0,0.0)),
m_worldRotation(MT_Matrix3x3(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0)),
m_worldScaling(MT_Vector3(1.f,1.f,1.f)),
m_worldPosition(0.0,0.0,0.0),
m_worldRotation(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),
m_worldScaling(1.f,1.f,1.f),
m_parent_relation (NULL),
@@ -297,6 +297,13 @@ GetWorldScaling(
return m_worldScaling;
}
void SG_Spatial::SetWorldFromLocalTransform()
{
m_worldPosition= m_localPosition;
m_worldScaling= m_localScaling;
m_worldRotation= m_localRotation;
}
SG_BBox& SG_Spatial::BBox()
{
return m_bbox;