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:
Diffstat (limited to 'source/gameengine/SceneGraph')
-rw-r--r--source/gameengine/SceneGraph/SG_IObject.cpp11
-rw-r--r--source/gameengine/SceneGraph/SG_IObject.h20
-rw-r--r--source/gameengine/SceneGraph/SG_Node.cpp3
-rw-r--r--source/gameengine/SceneGraph/SG_Node.h2
-rw-r--r--source/gameengine/SceneGraph/SG_ParentRelation.h2
-rw-r--r--source/gameengine/SceneGraph/SG_Spatial.cpp13
-rw-r--r--source/gameengine/SceneGraph/SG_Spatial.h4
7 files changed, 39 insertions, 16 deletions
diff --git a/source/gameengine/SceneGraph/SG_IObject.cpp b/source/gameengine/SceneGraph/SG_IObject.cpp
index 5433b5017eb..232ceb06958 100644
--- a/source/gameengine/SceneGraph/SG_IObject.cpp
+++ b/source/gameengine/SceneGraph/SG_IObject.cpp
@@ -130,6 +130,17 @@ ActivateDestructionCallback(
}
}
+ void
+SG_IObject::
+ActivateUpdateTransformCallback(
+){
+ if (m_callbacks.m_updatefunc)
+ {
+ // Call client provided update func.
+ m_callbacks.m_updatefunc(this, m_SGclientObject, m_SGclientInfo);
+ }
+}
+
void
SG_IObject::
SetControllerTime(
diff --git a/source/gameengine/SceneGraph/SG_IObject.h b/source/gameengine/SceneGraph/SG_IObject.h
index f3af9a68d85..b0c1d64cf69 100644
--- a/source/gameengine/SceneGraph/SG_IObject.h
+++ b/source/gameengine/SceneGraph/SG_IObject.h
@@ -51,6 +51,12 @@ typedef void* (*SG_DestructionNewCallback)(
void* clientinfo
);
+typedef void (*SG_UpdateTransformCallback)(
+ SG_IObject* sgobject,
+ void* clientobj,
+ void* clientinfo
+);
+
/**
* SG_Callbacks hold 2 call backs to the outside world.
@@ -72,21 +78,25 @@ struct SG_Callbacks
SG_Callbacks(
):
m_replicafunc(NULL),
- m_destructionfunc(NULL)
+ m_destructionfunc(NULL),
+ m_updatefunc(NULL)
{
};
SG_Callbacks(
SG_ReplicationNewCallback repfunc,
- SG_DestructionNewCallback destructfunc
+ SG_DestructionNewCallback destructfunc,
+ SG_UpdateTransformCallback updatefunc
):
m_replicafunc(repfunc),
- m_destructionfunc(destructfunc)
+ m_destructionfunc(destructfunc),
+ m_updatefunc(updatefunc)
{
};
SG_ReplicationNewCallback m_replicafunc;
SG_DestructionNewCallback m_destructionfunc;
+ SG_UpdateTransformCallback m_updatefunc;
};
/**
@@ -203,6 +213,10 @@ protected :
void
ActivateDestructionCallback(
);
+
+ void
+ ActivateUpdateTransformCallback(
+ );
SG_IObject(
void* clientobj,
diff --git a/source/gameengine/SceneGraph/SG_Node.cpp b/source/gameengine/SceneGraph/SG_Node.cpp
index b083d79bb70..c2a662c1fa2 100644
--- a/source/gameengine/SceneGraph/SG_Node.cpp
+++ b/source/gameengine/SceneGraph/SG_Node.cpp
@@ -186,7 +186,8 @@ void SG_Node::RemoveChild(SG_Node* child)
void SG_Node::UpdateWorldData(double time)
{
- UpdateSpatialData(GetSGParent(),time);
+ if (UpdateSpatialData(GetSGParent(),time))
+ ActivateUpdateTransformCallback();
// update children's worlddata
for (NodeList::iterator it = m_children.begin();it!=m_children.end();++it)
diff --git a/source/gameengine/SceneGraph/SG_Node.h b/source/gameengine/SceneGraph/SG_Node.h
index fe30213614f..ef5af717d60 100644
--- a/source/gameengine/SceneGraph/SG_Node.h
+++ b/source/gameengine/SceneGraph/SG_Node.h
@@ -188,8 +188,6 @@ public:
Destruct(
);
-
-
private:
void
diff --git a/source/gameengine/SceneGraph/SG_ParentRelation.h b/source/gameengine/SceneGraph/SG_ParentRelation.h
index b26c4758480..d4a8e7e8cb3 100644
--- a/source/gameengine/SceneGraph/SG_ParentRelation.h
+++ b/source/gameengine/SceneGraph/SG_ParentRelation.h
@@ -69,7 +69,7 @@ public :
*/
virtual
- void
+ bool
UpdateChildCoordinates(
SG_Spatial * child,
const SG_Spatial * parent
diff --git a/source/gameengine/SceneGraph/SG_Spatial.cpp b/source/gameengine/SceneGraph/SG_Spatial.cpp
index c65542c98ce..a91b462b3ae 100644
--- a/source/gameengine/SceneGraph/SG_Spatial.cpp
+++ b/source/gameengine/SceneGraph/SG_Spatial.cpp
@@ -103,7 +103,7 @@ SetParentRelation(
*/
- void
+ bool
SG_Spatial::
UpdateSpatialData(
const SG_Spatial *parent,
@@ -128,17 +128,16 @@ UpdateSpatialData(
// our world coordinates.
if (!bComputesWorldTransform)
- {
- ComputeWorldTransforms(parent);
- }
+ bComputesWorldTransform = ComputeWorldTransforms(parent);
+
+ return bComputesWorldTransform;
}
-void SG_Spatial::ComputeWorldTransforms(const SG_Spatial *parent)
+bool SG_Spatial::ComputeWorldTransforms(const SG_Spatial *parent)
{
- m_parent_relation->UpdateChildCoordinates(this,parent);
+ return m_parent_relation->UpdateChildCoordinates(this,parent);
}
-
/**
* Position and translation methods
*/
diff --git a/source/gameengine/SceneGraph/SG_Spatial.h b/source/gameengine/SceneGraph/SG_Spatial.h
index e58e45bb451..1f1e97a5b56 100644
--- a/source/gameengine/SceneGraph/SG_Spatial.h
+++ b/source/gameengine/SceneGraph/SG_Spatial.h
@@ -177,7 +177,7 @@ public:
MT_Transform GetWorldTransform() const;
- void ComputeWorldTransforms( const SG_Spatial *parent);
+ bool ComputeWorldTransforms( const SG_Spatial *parent);
/**
* Bounding box functions.
@@ -217,7 +217,7 @@ protected:
* any controllers to update this object.
*/
- void
+ bool
UpdateSpatialData(
const SG_Spatial *parent,
double time