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:
authorMiika Hamalainen <blender@miikah.org>2011-09-05 21:06:09 +0400
committerMiika Hamalainen <blender@miikah.org>2011-09-05 21:06:09 +0400
commit42faf7ae41d807c2f9a94f40b774038af0c065ec (patch)
tree8460e4d70cf287da04b656748297521d0d3ef381 /source/gameengine/SceneGraph
parent79ef35889f850aa7173800bcf67918c14f3b1291 (diff)
parent59dbd53e72ae25edf247e49ea1e291af277fecc4 (diff)
Merge with trunk r39928
Diffstat (limited to 'source/gameengine/SceneGraph')
-rw-r--r--source/gameengine/SceneGraph/SG_BBox.cpp4
-rw-r--r--source/gameengine/SceneGraph/SG_DList.h130
-rw-r--r--source/gameengine/SceneGraph/SG_IObject.cpp12
-rw-r--r--source/gameengine/SceneGraph/SG_IObject.h13
-rw-r--r--source/gameengine/SceneGraph/SG_QList.h100
-rw-r--r--source/gameengine/SceneGraph/SG_Spatial.cpp17
6 files changed, 149 insertions, 127 deletions
diff --git a/source/gameengine/SceneGraph/SG_BBox.cpp b/source/gameengine/SceneGraph/SG_BBox.cpp
index b5618ebbf03..01107557481 100644
--- a/source/gameengine/SceneGraph/SG_BBox.cpp
+++ b/source/gameengine/SceneGraph/SG_BBox.cpp
@@ -142,8 +142,8 @@ SG_BBox SG_BBox::transform(const MT_Transform &world) const
bool SG_BBox::inside(const MT_Point3 &point) const
{
return point[0] >= m_min[0] && point[0] <= m_max[0] &&
- point[1] >= m_min[1] && point[1] <= m_max[1] &&
- point[2] >= m_min[2] && point[2] <= m_max[2];
+ point[1] >= m_min[1] && point[1] <= m_max[1] &&
+ point[2] >= m_min[2] && point[2] <= m_max[2];
}
bool SG_BBox::inside(const SG_BBox& other) const
diff --git a/source/gameengine/SceneGraph/SG_DList.h b/source/gameengine/SceneGraph/SG_DList.h
index b82e51e0d2f..9e7e514b27a 100644
--- a/source/gameengine/SceneGraph/SG_DList.h
+++ b/source/gameengine/SceneGraph/SG_DList.h
@@ -134,88 +134,88 @@ public:
}
};
- SG_DList()
- {
- m_flink = m_blink = this;
- }
+ SG_DList()
+ {
+ m_flink = m_blink = this;
+ }
SG_DList(const SG_DList& other)
{
- m_flink = m_blink = this;
+ m_flink = m_blink = this;
}
- virtual ~SG_DList()
- {
+ virtual ~SG_DList()
+ {
Delink();
- }
+ }
- inline bool Empty() // Check for empty queue
- {
- return ( m_flink == this );
- }
- bool AddBack( SG_DList *item ) // Add to the back
- {
+ inline bool Empty() // Check for empty queue
+ {
+ return ( m_flink == this );
+ }
+ bool AddBack( SG_DList *item ) // Add to the back
+ {
if (!item->Empty())
return false;
- item->m_blink = m_blink;
- item->m_flink = this;
- m_blink->m_flink = item;
- m_blink = item;
+ item->m_blink = m_blink;
+ item->m_flink = this;
+ m_blink->m_flink = item;
+ m_blink = item;
return true;
- }
- bool AddFront( SG_DList *item ) // Add to the back
- {
+ }
+ bool AddFront( SG_DList *item ) // Add to the back
+ {
if (!item->Empty())
return false;
- item->m_flink = m_flink;
- item->m_blink = this;
- m_flink->m_blink = item;
- m_flink = item;
+ item->m_flink = m_flink;
+ item->m_blink = this;
+ m_flink->m_blink = item;
+ m_flink = item;
return true;
- }
- SG_DList *Remove() // Remove from the front
- {
- if (Empty())
- {
- return NULL;
- }
- SG_DList* item = m_flink;
- m_flink = item->m_flink;
- m_flink->m_blink = this;
- item->m_flink = item->m_blink = item;
- return item;
- }
- bool Delink() // Remove from the middle
- {
+ }
+ SG_DList *Remove() // Remove from the front
+ {
+ if (Empty())
+ {
+ return NULL;
+ }
+ SG_DList* item = m_flink;
+ m_flink = item->m_flink;
+ m_flink->m_blink = this;
+ item->m_flink = item->m_blink = item;
+ return item;
+ }
+ bool Delink() // Remove from the middle
+ {
if (Empty())
return false;
m_blink->m_flink = m_flink;
m_flink->m_blink = m_blink;
m_flink = m_blink = this;
return true;
- }
- inline SG_DList *Peek() // Look at front without removing
- {
- return m_flink;
- }
- inline SG_DList *Back() // Look at front without removing
- {
- return m_blink;
- }
- inline SG_DList *Self()
- {
- return this;
- }
- inline const SG_DList *Peek() const // Look at front without removing
- {
- return (const SG_DList*)m_flink;
- }
- inline const SG_DList *Back() const // Look at front without removing
- {
- return (const SG_DList*)m_blink;
- }
- inline const SG_DList *Self() const
- {
- return this;
- }
+ }
+ inline SG_DList *Peek() // Look at front without removing
+ {
+ return m_flink;
+ }
+ inline SG_DList *Back() // Look at front without removing
+ {
+ return m_blink;
+ }
+ inline SG_DList *Self()
+ {
+ return this;
+ }
+ inline const SG_DList *Peek() const // Look at front without removing
+ {
+ return (const SG_DList*)m_flink;
+ }
+ inline const SG_DList *Back() const // Look at front without removing
+ {
+ return (const SG_DList*)m_blink;
+ }
+ inline const SG_DList *Self() const
+ {
+ return this;
+ }
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/SceneGraph/SG_IObject.cpp b/source/gameengine/SceneGraph/SG_IObject.cpp
index 3064e6662b9..b22d210984d 100644
--- a/source/gameengine/SceneGraph/SG_IObject.cpp
+++ b/source/gameengine/SceneGraph/SG_IObject.cpp
@@ -34,6 +34,8 @@
#include "SG_IObject.h"
#include "SG_Controller.h"
+#include <algorithm>
+
SG_Stage gSG_Stage = SG_STAGE_UNKNOWN;
SG_IObject::
@@ -71,6 +73,16 @@ AddSGController(
void
SG_IObject::
+RemoveSGController(
+ SG_Controller* cont
+) {
+ SGControllerList::iterator contit;
+
+ m_SGcontrollers.erase(std::remove(m_SGcontrollers.begin(), m_SGcontrollers.end(), cont));
+}
+
+ void
+SG_IObject::
RemoveAllControllers(
) {
m_SGcontrollers.clear();
diff --git a/source/gameengine/SceneGraph/SG_IObject.h b/source/gameengine/SceneGraph/SG_IObject.h
index 26e317bdcd9..8c0159fe8d4 100644
--- a/source/gameengine/SceneGraph/SG_IObject.h
+++ b/source/gameengine/SceneGraph/SG_IObject.h
@@ -49,6 +49,7 @@ enum SG_Stage
SG_STAGE_CONTROLLER_UPDATE,
SG_STAGE_ACTUATOR,
SG_STAGE_ACTUATOR_UPDATE,
+ SG_STAGE_ANIMATION_UPDATE,
SG_STAGE_PHYSICS2,
SG_STAGE_PHYSICS2_UPDATE,
SG_STAGE_SCENE,
@@ -180,10 +181,20 @@ public:
SG_Controller* cont
);
+ /**
+ * Remove a pointer to a controller from this node.
+ * This does not delete the controller itself! Be careful to
+ * avoid memory leaks.
+ */
+ void
+ RemoveSGController(
+ SG_Controller* cont
+ );
+
/**
* Clear the array of pointers to controllers associated with
* this node. This does not delete the controllers themselves!
- * This should be used very carefully to avoid memory
+ * This should be used very carefully to avoid memory
* leaks.
*/
diff --git a/source/gameengine/SceneGraph/SG_QList.h b/source/gameengine/SceneGraph/SG_QList.h
index de79c35821e..eb404b1a5a5 100644
--- a/source/gameengine/SceneGraph/SG_QList.h
+++ b/source/gameengine/SceneGraph/SG_QList.h
@@ -91,73 +91,73 @@ public:
};
SG_QList() : SG_DList()
- {
- m_fqlink = m_bqlink = this;
- }
+ {
+ m_fqlink = m_bqlink = this;
+ }
SG_QList(const SG_QList& other) : SG_DList()
{
- m_fqlink = m_bqlink = this;
+ m_fqlink = m_bqlink = this;
}
- virtual ~SG_QList()
- {
+ virtual ~SG_QList()
+ {
QDelink();
- }
+ }
- inline bool QEmpty() // Check for empty queue
- {
- return ( m_fqlink == this );
- }
- bool QAddBack( SG_QList *item ) // Add to the back
- {
+ inline bool QEmpty() // Check for empty queue
+ {
+ return ( m_fqlink == this );
+ }
+ bool QAddBack( SG_QList *item ) // Add to the back
+ {
if (!item->QEmpty())
return false;
- item->m_bqlink = m_bqlink;
- item->m_fqlink = this;
- m_bqlink->m_fqlink = item;
- m_bqlink = item;
+ item->m_bqlink = m_bqlink;
+ item->m_fqlink = this;
+ m_bqlink->m_fqlink = item;
+ m_bqlink = item;
return true;
- }
- bool QAddFront( SG_QList *item ) // Add to the back
- {
+ }
+ bool QAddFront( SG_QList *item ) // Add to the back
+ {
if (!item->Empty())
return false;
- item->m_fqlink = m_fqlink;
- item->m_bqlink = this;
- m_fqlink->m_bqlink = item;
- m_fqlink = item;
+ item->m_fqlink = m_fqlink;
+ item->m_bqlink = this;
+ m_fqlink->m_bqlink = item;
+ m_fqlink = item;
return true;
- }
- SG_QList *QRemove() // Remove from the front
- {
- if (QEmpty())
- {
- return NULL;
- }
- SG_QList* item = m_fqlink;
- m_fqlink = item->m_fqlink;
- m_fqlink->m_bqlink = this;
- item->m_fqlink = item->m_bqlink = item;
- return item;
- }
- bool QDelink() // Remove from the middle
- {
+ }
+ SG_QList *QRemove() // Remove from the front
+ {
+ if (QEmpty())
+ {
+ return NULL;
+ }
+ SG_QList* item = m_fqlink;
+ m_fqlink = item->m_fqlink;
+ m_fqlink->m_bqlink = this;
+ item->m_fqlink = item->m_bqlink = item;
+ return item;
+ }
+ bool QDelink() // Remove from the middle
+ {
if (QEmpty())
return false;
m_bqlink->m_fqlink = m_fqlink;
m_fqlink->m_bqlink = m_bqlink;
m_fqlink = m_bqlink = this;
return true;
- }
- inline SG_QList *QPeek() // Look at front without removing
- {
- return m_fqlink;
- }
- inline SG_QList *QBack() // Look at front without removing
- {
- return m_bqlink;
- }
-
-
+ }
+ inline SG_QList *QPeek() // Look at front without removing
+ {
+ return m_fqlink;
+ }
+ inline SG_QList *QBack() // Look at front without removing
+ {
+ return m_bqlink;
+ }
+
+
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SG_QList"); }
diff --git a/source/gameengine/SceneGraph/SG_Spatial.cpp b/source/gameengine/SceneGraph/SG_Spatial.cpp
index ca778d164c8..09fb7278bfa 100644
--- a/source/gameengine/SceneGraph/SG_Spatial.cpp
+++ b/source/gameengine/SceneGraph/SG_Spatial.cpp
@@ -109,18 +109,17 @@ SetParentRelation(
*/
- bool
+ bool
SG_Spatial::
UpdateSpatialData(
- const SG_Spatial *parent,
- double time,
- bool& parentUpdated
-){
-
- bool bComputesWorldTransform = false;
+ const SG_Spatial *parent,
+ double time,
+ bool& parentUpdated
+ ){
+ bool bComputesWorldTransform = false;
// update spatial controllers
-
+
SGControllerList::iterator cit = GetSGControllerList().begin();
SGControllerList::const_iterator c_end = GetSGControllerList().end();
@@ -131,7 +130,7 @@ UpdateSpatialData(
}
// If none of the objects updated our values then we ask the
- // parent_relation object owned by this class to update
+ // parent_relation object owned by this class to update
// our world coordinates.
if (!bComputesWorldTransform)