Why not just call rebuild instead?
Thiago
James Bigler wrote:
Author: bigler
Date: Mon Feb 25 22:28:02 2008
New Revision: 2124
Modified:
trunk/Interface/AccelerationStructure.h
trunk/Model/Groups/DynBVH.cc
trunk/Model/Groups/DynBVH.h
trunk/Model/Groups/KDTree.h
trunk/Model/Groups/private/CGT.h
Log:
Interface/AccelerationStructure.h
Model/Groups/DynBVH.cc
Model/Groups/DynBVH.h
Model/Groups/KDTree.h
Model/Groups/private/CGT.h
Added groupDirty function to call if the underlying group has changed. I'm
not sold that this is the best way to do this. DynBVH tries to be clever when
you set the group and set a dirty flag if the pointers weren't the same. I
think that explicitly telling the AccelerationStructure that the group has
changed is more clear.
Modified: trunk/Interface/AccelerationStructure.h
===================================================================== =========
--- trunk/Interface/AccelerationStructure.h (original)
+++ trunk/Interface/AccelerationStructure.h Mon Feb 25 22:28:02 2008
@@ -15,6 +15,9 @@
// rebuild functions which are called during the preprocess phases
// of Manta. setGroup can be called when "building" your scene.
virtual void setGroup(Group* new_group) = 0;
+ // If you modify the group (such as add or remove a piece of geometry), you
+ // should call this function to let the acceleration structure know.
+ virtual void groupDirty() = 0;
virtual Group* getGroup() const = 0;
Modified: trunk/Model/Groups/DynBVH.cc
===================================================================== =========
--- trunk/Model/Groups/DynBVH.cc (original)
+++ trunk/Model/Groups/DynBVH.cc Mon Feb 25 22:28:02 2008
@@ -575,6 +575,11 @@
return currGroup;
}
+void DynBVH::groupDirty()
+{
+ group_changed = true;
+}
+
void DynBVH::addToUpdateGraph(ObjectUpdateGraph* graph,
ObjectUpdateGraphNode* parent) {
cerr << MANTA_FUNC << endl;
Modified: trunk/Model/Groups/DynBVH.h
===================================================================== =========
--- trunk/Model/Groups/DynBVH.h (original)
+++ trunk/Model/Groups/DynBVH.h Mon Feb 25 22:28:02 2008
@@ -102,6 +102,7 @@
void setGroup(Group* new_group);
Group* getGroup() const;
+ void groupDirty(); // tells the acceleration structure that the group has changed
virtual void addToUpdateGraph(ObjectUpdateGraph* graph,
ObjectUpdateGraphNode* parent);
Modified: trunk/Model/Groups/KDTree.h
===================================================================== =========
--- trunk/Model/Groups/KDTree.h (original)
+++ trunk/Model/Groups/KDTree.h Mon Feb 25 22:28:02 2008
@@ -157,6 +157,7 @@
}
void setGroup(Group* new_group);
+ void groupDirty() {} // does nothing for now
Group* getGroup() const { return currGroup; }
virtual void addToUpdateGraph(ObjectUpdateGraph* graph,
Modified: trunk/Model/Groups/private/CGT.h
===================================================================== =========
--- trunk/Model/Groups/private/CGT.h (original)
+++ trunk/Model/Groups/private/CGT.h Mon Feb 25 22:28:02 2008
@@ -169,6 +169,7 @@
void computeBounds(const PreprocessContext& context, BBox& bbox) const;
void setGroup(Group* new_group);
+ void groupDirty() {} // does nothing for now
Group* getGroup() const;
virtual void addToUpdateGraph(ObjectUpdateGraph* graph,
ObjectUpdateGraphNode* parent);
Archive powered by MHonArc 2.6.16.