no need to store the physics env in each KX_GameObject

This commit is contained in:
Campbell Barton 2009-08-04 05:14:10 +00:00
parent d595f6f203
commit 856dba000b
5 changed files with 7 additions and 30 deletions

@ -1806,7 +1806,6 @@ static KX_GameObject *gameobject_from_blenderobject(
}
if (gameobj)
{
gameobj->SetPhysicsEnvironment(kxscene->GetPhysicsEnvironment());
gameobj->SetLayer(ob->lay);
gameobj->SetBlenderObject(ob);
/* set the visibility state based on the objects render option in the outliner */

@ -36,6 +36,7 @@
#include "MT_Matrix3x3.h"
#include "KX_GameObject.h"
#include "KX_RayCast.h"
#include "KX_PythonInit.h" // KX_GetActiveScene
#include "blendef.h"
#ifdef HAVE_CONFIG_H
@ -329,7 +330,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame)
}
{
MT_Point3 topoint = position + (m_maximumBound) * direction;
PHY_IPhysicsEnvironment* pe = obj->GetPhysicsEnvironment();
PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
KX_IPhysicsController *spc = obj->GetPhysicsController();
if (!pe) {
@ -442,7 +443,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame)
}
normal.normalize();
{
PHY_IPhysicsEnvironment* pe = obj->GetPhysicsEnvironment();
PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
KX_IPhysicsController *spc = obj->GetPhysicsController();
if (!pe) {

@ -103,7 +103,6 @@ KX_GameObject::KX_GameObject(
m_bOccluder(false),
m_pPhysicsController1(NULL),
m_pGraphicController(NULL),
m_pPhysicsEnvironment(NULL),
m_xray(false),
m_pHitObject(NULL),
m_isDeformable(false),
@ -2604,8 +2603,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
toDir.normalize();
toPoint = fromPoint + (dist) * toDir;
}
PHY_IPhysicsEnvironment* pe = GetPhysicsEnvironment();
PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
KX_IPhysicsController *spc = GetPhysicsController();
KX_GameObject *parent = GetParent();
if (!spc && parent)
@ -2732,7 +2730,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
return none_tuple_3();
}
PHY_IPhysicsEnvironment* pe = GetPhysicsEnvironment();
PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
KX_IPhysicsController *spc = GetPhysicsController();
KX_GameObject *parent = GetParent();
if (!spc && parent)

@ -94,8 +94,6 @@ protected:
KX_IPhysicsController* m_pPhysicsController1;
PHY_IGraphicController* m_pGraphicController;
// used for ray casting
PHY_IPhysicsEnvironment* m_pPhysicsEnvironment;
STR_String m_testPropName;
bool m_xray;
KX_GameObject* m_pHitObject;
@ -334,20 +332,6 @@ public:
bool ang_vel_local
);
/**
* @return a pointer to the physics environment in use during the game, for rayCasting
*/
PHY_IPhysicsEnvironment* GetPhysicsEnvironment()
{
return m_pPhysicsEnvironment;
}
void SetPhysicsEnvironment(PHY_IPhysicsEnvironment* physicsEnvironment)
{
m_pPhysicsEnvironment = physicsEnvironment;
}
/**
* @return a pointer to the physics controller owned by this class.
*/

@ -126,10 +126,7 @@ void RAS_BucketManager::OrderBuckets(const MT_Transform& cameratrans, BucketList
RAS_MaterialBucket* bucket = *bit;
RAS_MeshSlot* ms;
// remove the mesh slot form the list, it culls them automatically for next frame
for(ms = bucket->GetNextActiveMeshSlot();
ms!= NULL;
ms = bucket->GetNextActiveMeshSlot())
{
while((ms = bucket->GetNextActiveMeshSlot())) {
slots[i++].set(ms, bucket, pnorm);
}
}
@ -179,9 +176,7 @@ void RAS_BucketManager::RenderSolidBuckets(
RAS_MaterialBucket* bucket = *bit;
RAS_MeshSlot* ms;
// remove the mesh slot form the list, it culls them automatically for next frame
for(ms = bucket->GetNextActiveMeshSlot();
ms!= NULL;
ms = bucket->GetNextActiveMeshSlot())
while((ms = bucket->GetNextActiveMeshSlot()))
{
rendertools->SetClientObject(rasty, ms->m_clientObj);
while (bucket->ActivateMaterial(cameratrans, rasty, rendertools))