Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchySceneManager.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchySceneManager.h	(revision 1319)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchySceneManager.h	(revision 1320)
@@ -8,6 +8,6 @@
 */
 
-#ifndef _KdTreeSceneManager_H__
-#define _KdTreeSceneManager_H__
+#ifndef _BvHierarchySceneManager_H__
+#define _BvHierarchySceneManager_H__
 
 #include <OgreSceneManager.h>
@@ -19,24 +19,24 @@
 #include "OgreBvHierarchyInterface.h"
 
-#define KDTREE_MAX_DEPTH 12
+#define BvHierarchy_MAX_DEPTH 12
 
 namespace Ogre
 {
 
-class KdTreeSceneNode;
-
-class KdTreeSceneManager : public SceneManager
+class BvHierarchySceneNode;
+
+class BvHierarchySceneManager : public SceneManager
 {
 public:
-	KdTreeSceneManager(const String& name, GtpVisibility::VisibilityManager *vm);
-	~KdTreeSceneManager(void);
+	BvHierarchySceneManager(const String& name, GtpVisibility::VisibilityManager *vm);
+	~BvHierarchySceneManager(void);
 
 	virtual const String& getTypeName(void) const;
 
-	//typedef std::list<KdTreeSceneNode *> NodeList;
+	//typedef std::list<BvHierarchySceneNode *> NodeList;
 	//typedef std::list<WireBoundingBox *> BoxList;
 
 	/************************************************************************/
-	/* Functions overridden form SceneManager for KdTree                    */
+	/* Functions overridden form SceneManager for BvHierarchy                    */
 	/************************************************************************/
 
@@ -45,8 +45,8 @@
 	virtual Camera* createCamera(const String& name);
 
-	/** Override from SceneManager to create SceneNodes as instance of KdTreeSceneNode
+	/** Override from SceneManager to create SceneNodes as instance of BvHierarchySceneNode
 	*/
 	virtual SceneNode* createSceneNode(void);
-	/** Override from SceneManager to create SceneNodes as instance of KdTreeSceneNode
+	/** Override from SceneManager to create SceneNodes as instance of BvHierarchySceneNode
 	*/
 	virtual SceneNode* createSceneNode(const String& name);
@@ -62,5 +62,5 @@
 	bool getOptionKeys(StringVector &refKeys);
 
-	/** Overide from scene manager to destroy kdtree properly (before the scene graph is destroyed)
+	/** Overide from scene manager to destroy BvHierarchy properly (before the scene graph is destroyed)
 	*/
 	virtual void clearScene();
@@ -110,12 +110,12 @@
 
 	/************************************************************************/
-	/* Functions which are specific to the KdTree                           */
+	/* Functions which are specific to the BvHierarchy                           */
 	/************************************************************************/
 	
-	/** Update the KdTree with the node (more or less disabled now)
-	*/
-	virtual void _updateNode(KdTreeSceneNode *node); // TODO: 
-
-	/** Show or hide the bounding boxes of KdTree nodes - obsolete, use options
+	/** Update the BvHierarchy with the node (more or less disabled now)
+	*/
+	virtual void _updateNode(BvHierarchySceneNode *node); // TODO: 
+
+	/** Show or hide the bounding boxes of BvHierarchy nodes - obsolete, use options
 	*/
 	virtual void setShowBoxes(bool showboxes);
@@ -124,5 +124,5 @@
 	virtual bool getShowBoxes(void) const;
 
-	/** Recurses the kdtree, adding any nodes intersecting with the 
+	/** Recurses the BvHierarchy, adding any nodes intersecting with the 
 	box/sphere/volume/ray into the given list.
 	It ignores the exclude scene node.
@@ -162,7 +162,7 @@
 	/** Render a list of scenenodes
 	*/
-	//virtual void _renderNodes(const BvRenderableList& nodelist, Camera * cam,
+	//virtual void _renderNodes(const BvhRenderableList& nodelist, Camera * cam,
 	//	bool onlyShadowCasters, int leavePassesInQueue);
-	virtual void _renderNode(KdTree::NodePtr node, Camera * cam,
+	virtual void _renderNode(BvHierarchy::NodePtr node, Camera * cam,
 		bool onlyShadowCasters, int leavePassesInQueue);
 
@@ -181,5 +181,5 @@
 	/** Returns hierarchy interface.
 	*/
-	KdTreeHierarchyInterface *GetHierarchyInterface();
+	BvHierarchyInterface *GetHierarchyInterface();
 
 protected:
@@ -223,5 +223,5 @@
 
 	// the hierarchy interface for CHC
-	KdTreeHierarchyInterface *mHierarchyInterface;
+	BvHierarchyInterface *mHierarchyInterface;
 
 	// if hierarchical culling is currently in use
@@ -273,16 +273,16 @@
 
 	// remember visited scene nodes for viz
-	KdTree::NodeList mVisibleNodes;
+	BvHierarchy::NodeList mVisibleNodes;
 
 	/************************************************************************/
 	/* Kd-Tree specific options & members                                   */
 	/************************************************************************/
-	// maximum depth of the kdtree
+	// maximum depth of the BvHierarchy
 	int mMaxDepth;
 
-	// the kdtree which holds the scene
-	KdTree *mBvHierarchy;
-
-	// if bounding boxes of kdtree nodes are shown
+	// the BvHierarchy which holds the scene
+	BvHierarchy *mBvHierarchy;
+
+	// if bounding boxes of BvHierarchy nodes are shown
 	bool mShowBoxes;
 	// bounding boxes of kd nodes will be highlighted on this level of the kd tree
@@ -290,5 +290,5 @@
 	// if all bounding boxes shall be displayed, not only the highlighted level
 	bool mShowAllBoxes;
-	// visualize kdtree nodes or bounding boxes of objects in nodes
+	// visualize BvHierarchy nodes or bounding boxes of objects in nodes
 	bool mShowNodes;
 
@@ -297,8 +297,8 @@
 
 	// the method/algorithm used when rendering the scene
-	KdTree::RenderMethod mRenderMethod;
+	BvHierarchy::RenderMethod mRenderMethod;
 
 	// the method of building the tree
-	KdTree::BuildMethod mBuildMethod;
+	BvHierarchy::BuildMethod mBuildMethod;
 
 	/************************************************************************/
@@ -327,6 +327,6 @@
 
 
-/// Factory for KdTreeSceneManager
-class BvHierarchySceneManagerFactory : public SceneManagerFactory
+/// Factory for BvHierarchySceneManager
+class BvHierarchySceneManagerFactory: public SceneManagerFactory
 {
 protected:
@@ -337,5 +337,5 @@
 	{
 		visManager = vm;
-	};
+	}
 	~BvHierarchySceneManagerFactory(void) {};
 	/// Factory type name
@@ -347,3 +347,3 @@
 } // namespace Ogre
 
-#endif // _KdTreeSceneManager_H__
+#endif // _BvHierarchySceneManager_H__
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchy.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchy.h	(revision 1319)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchy.h	(revision 1320)
@@ -11,12 +11,12 @@
 #define _OgreBvHierarchy_H__
 
-#define KDNODE_CAST(a) (static_cast<KdTree::Node>(a))
-#define KDBRANCH_CAST(a) (static_cast<KdTree::Branch>(a))
-#define KDLEAF_CAST(a) (static_cast<KdTree::Leaf>(a))
-#define KDNODEPTR_CAST(a) (static_cast<KdTree::Node *>(a))
-#define KDBRANCHPTR_CAST(a) (static_cast<KdTree::Branch *>(a))
-#define KDLEAFPTR_CAST(a) (static_cast<KdTree::Leaf *>(a))
-
-#define KDTREE_LOGNAME "KdTreeBuild.log"
+#define BVHNODE_CAST(a) (static_cast<BvHierarchy::Node>(a))
+#define BVHBRANCH_CAST(a) (static_cast<BvHierarchy::Branch>(a))
+#define BVHLEAF_CAST(a) (static_cast<BvHierarchy::Leaf>(a))
+#define BVHNODEPTR_CAST(a) (static_cast<BvHierarchy::Node *>(a))
+#define BVHBRANCHPTR_CAST(a) (static_cast<BvHierarchy::Branch *>(a))
+#define BVHLEAFPTR_CAST(a) (static_cast<BvHierarchy::Leaf *>(a))
+
+#define BvHierarchy_LOGNAME "BvHierarchyBuild.log"
 
 #include <OgreAxisAlignedBox.h>
@@ -31,13 +31,13 @@
 #include "OgreBvHierarchyCamera.h"
 #include "HierarchyInterface.h"
-
+#include "OgreKdTree.h"
 
 namespace Ogre
 {
 	class BvHierarchyCamera;
-	class BvRenderable;
-	struct SplitInfo;
-
-	class PlaneEvent
+	class BvhRenderable;
+	struct BvhSplitInfo;
+	
+	class BvhPlaneEvent
 	{
 	public:
@@ -63,16 +63,16 @@
 		};
 
-		PlaneEvent(): mRenderable(0), mPosition(Vector3()), mDimension(PED_X), mType(PET_ON)
+		BvhPlaneEvent(): mRenderable(0), mPosition(Vector3()), mDimension(PED_X), mType(PET_ON)
 		{ };
 
-		PlaneEvent(BvRenderable *rend, const Vector3& pos, PlaneEvent::Dimension dim, PlaneEvent::Type type):
+		BvhPlaneEvent(BvhRenderable *rend, const Vector3& pos, BvhPlaneEvent::Dimension dim, BvhPlaneEvent::Type type):
 			mRenderable(rend), mPosition(pos), mDimension(dim), mType(type) 
 		{ };
 
-		~PlaneEvent() {};
+		~BvhPlaneEvent() {};
 
 		// the less operator for plane events
 		// first sort by position, then by dimension and finally by type
-		bool operator < (const PlaneEvent& e) const
+		bool operator < (const BvhPlaneEvent& e) const
 		{
 			if(mPosition[mDimension] < e.mPosition[e.mDimension])
@@ -100,5 +100,5 @@
 
 		// the equals operator for tree events
-		bool operator == (const PlaneEvent& e) const
+		bool operator == (const BvhPlaneEvent& e) const
 		{
 			return	(mPosition[mDimension] == e.mPosition[e.mDimension]) &&
@@ -107,5 +107,5 @@
 		};
 
-		bool equalsType(const PlaneEvent& e, PlaneEvent::Type t)
+		bool equalsType(const BvhPlaneEvent& e, BvhPlaneEvent::Type t)
 		{
 			return	(mPosition[mDimension] == e.mPosition[e.mDimension]) &&
@@ -114,7 +114,7 @@
 		};
 
-		void classify(const PlaneEvent& e, PlaneEvent::Side side);
-
-		PlaneEvent clip(AxisAlignedBox& box, PlaneEvent::Dimension dim);
+		void classify(const BvhPlaneEvent& e, BvhPlaneEvent::Side side);
+
+		BvhPlaneEvent clip(AxisAlignedBox& box, BvhPlaneEvent::Dimension dim);
 
 		Plane * getSplitPlane() const
@@ -125,10 +125,10 @@
 		}
 
-		BvRenderable * getRenderable() const //??
+		BvhRenderable * getRenderable() const //??
 		{
 			return mRenderable;
 		};
 
-		PlaneEvent::Dimension getDimension() const //??
+		BvhPlaneEvent::Dimension getDimension() const //??
 		{
 			return mDimension;
@@ -139,8 +139,8 @@
 	protected:
 		// event info
-		BvRenderable *			mRenderable;
+		BvhRenderable *			mRenderable;
 		Vector3					mPosition;
-		PlaneEvent::Dimension	mDimension;
-		PlaneEvent::Type		mType;
+		BvhPlaneEvent::Dimension	mDimension;
+		BvhPlaneEvent::Type		mType;
 
 		// ------------------------------------------------------------------------------//
@@ -149,13 +149,13 @@
 		// TODO discuss if these functions really belong here, OO & SE - wise
 		// pros: convenient, don't have to pass internal data to the outside
-		// cons: SplitInfo ... 
+		// cons: BvhSplitInfo ... 
 	public:
 		// compute "global" surface area heuristic (SAH) for the plane represented by this event
 		// use only with priority queue build method
-		void pqSAH(Real globalSA, Real parentSA, int nLeft, int nPlane, int nRight, AxisAlignedBox& parentBox, SplitInfo& split);
+		void pqSAH(Real globalSA, Real parentSA, int nLeft, int nPlane, int nRight, AxisAlignedBox& parentBox, BvhSplitInfo& split);
 		static Real pqSplitCost(Real p, Real pl, Real pr, int nLeft, int nRight, Real mu);
 
 		// compute the surface area heuristic (SAH) for the plane represented by this event
-		void SAH(const AxisAlignedBox& parent, int nLeft, int nPlane, int nRight, SplitInfo& split);
+		void SAH(const AxisAlignedBox& parent, int nLeft, int nPlane, int nRight, BvhSplitInfo& split);
 		// the variables determining the cost of a branch traversal (KT) and a leaf intersection (KI)
 		static Real KT;
@@ -171,5 +171,5 @@
 
 	// Holds all the important information on a split
-	struct SplitInfo
+	struct BvhSplitInfo
 	{
 		AxisAlignedBox bleft;
@@ -178,6 +178,6 @@
 		int nright;
 		Real cost;
-		PlaneEvent::Side side;
-		PlaneEvent event;
+		BvhPlaneEvent::Side side;
+		BvhPlaneEvent event;
 
 		// DEBUG
@@ -185,8 +185,8 @@
 	};
 
-	typedef std::list<PlaneEvent> PlaneEventList;
-	typedef std::list<BvRenderable *> BvRenderableList;
+	typedef std::list<BvhRenderable *> BvhRenderableList;
+	typedef std::list<BvhPlaneEvent> BvhPlaneEventList;
 	
-	class KdTree
+	class BvHierarchy
 	{
 	protected:
@@ -197,5 +197,5 @@
 		{
 		public:
-			Node(KdTree * owner, int level, AxisAlignedBox& aabb, Branch * parent):
+			Node(BvHierarchy * owner, int level, AxisAlignedBox& aabb, Branch * parent):
 			mOwner(owner),
 			mLevel(level),
@@ -217,9 +217,9 @@
 
 			// Gets this node's parent (NULL if this is the root).
-			KdTree::Node *getParent(void) const { return mParent; };
+			BvHierarchy::Node *getParent(void) const { return mParent; };
 
 			// Gets the nodes left & right child nodes, or NULL if not present or node is leaf
-			virtual KdTree::Node *getLeftChild(void) const = 0;
-			virtual KdTree::Node *getRightChild(void) const = 0;
+			virtual BvHierarchy::Node *getLeftChild(void) const = 0;
+			virtual BvHierarchy::Node *getRightChild(void) const = 0;
 
 			// add contained objects to render queue
@@ -242,5 +242,5 @@
 
 				if (mOwner->getHiLiteLevel() == mLevel)
-					mWBB->setMaterial("KdTree/BoxHiLite");
+					mWBB->setMaterial("BvHierarchy/BoxHiLite");
 				else
 					mWBB->setMaterial("BaseWhiteNoLighting");
@@ -275,8 +275,8 @@
 			*/
 			void setLastRendered(unsigned int frameid) { mLastRendered = frameid; };
-			/** Returns real extent of the kdtree, i.e., the merged extent of the bounding boxes. 
+			/** Returns real extent of the BvHierarchy, i.e., the merged extent of the bounding boxes. 
 			*/
 			AxisAlignedBox _getWorldAABB(void) const { return mAABB; };
-			/** Updates bound of the real aabb of kdtree
+			/** Updates bound of the real aabb of BvHierarchy
 			*/
 			virtual void _updateBounds(bool recurse = true) = 0;
@@ -288,5 +288,5 @@
 			AxisAlignedBox mWorldAABB;
 		protected:
-			KdTree * mOwner;
+			BvHierarchy * mOwner;
 			Branch * mParent;
 			int mLevel;
@@ -303,6 +303,6 @@
 		{
 		public:
-			Branch(KdTree * owner, int level, AxisAlignedBox& aabb, Branch * parent, 
-				Plane * splitplane, PlaneEvent::Side side):
+			Branch(BvHierarchy * owner, int level, AxisAlignedBox& aabb, Branch * parent, 
+				Plane * splitplane, BvhPlaneEvent::Side side):
 			Node(owner, level, aabb, parent), 
 			mSplitPlane(splitplane), 
@@ -335,6 +335,6 @@
 
 			// a branch should have at least one child
-			virtual KdTree::Node * getLeftChild() const { return mLeft; };
-			virtual KdTree::Node * getRightChild() const { return mRight; };
+			virtual BvHierarchy::Node * getLeftChild() const { return mLeft; };
+			virtual BvHierarchy::Node * getRightChild() const { return mRight; };
 
 			virtual void queueVisibleObjects(unsigned long currentFrame, 
@@ -379,5 +379,5 @@
 			Node * mRight;
 			Plane  * mSplitPlane;
-			PlaneEvent::Side mPlaneSide;
+			BvhPlaneEvent::Side mPlaneSide;
 		protected:
 			std::set<Leaf *> mLeaves;
@@ -387,5 +387,5 @@
 		{
 		public:
-			Leaf(KdTree * owner, int level, AxisAlignedBox& aabb, Branch * parent):
+			Leaf(BvHierarchy * owner, int level, AxisAlignedBox& aabb, Branch * parent):
 			Node(owner, level, aabb, parent) 
 			{};
@@ -397,8 +397,8 @@
 
 			// a leaf is empty when it does not posses renderables
-			virtual bool isEmpty() const { return mBvRenderables.empty(); }
+			virtual bool isEmpty() const { return mBvhRenderables.empty(); }
 
 			// a leaf has geometry when it has renderables
-			virtual bool hasGeometry() const { return !mBvRenderables.empty(); }
+			virtual bool hasGeometry() const { return !mBvhRenderables.empty(); }
 
 			// a leaf adds itself to the leaf set
@@ -406,6 +406,6 @@
 
 			// a leaf never has children 
-			virtual KdTree::Node * getLeftChild() const { return 0; };
-			virtual KdTree::Node * getRightChild() const { return 0; };
+			virtual BvHierarchy::Node * getLeftChild() const { return 0; };
+			virtual BvHierarchy::Node * getRightChild() const { return 0; };
 
 			virtual void queueVisibleObjects(unsigned long currentFrame, 
@@ -417,31 +417,31 @@
 			virtual void _updateBounds(bool recurse = true);
 
-			virtual void remove(BvRenderable * rend)
-			{
-				mBvRenderables.remove(rend);
-				//mBvRenderables.erase(find(mBvRenderables.begin(), mBvRenderables.end(), rend));
+			virtual void remove(BvhRenderable * rend)
+			{
+				mBvhRenderables.remove(rend);
+				//mBvhRenderables.erase(find(mBvhRenderables.begin(), mBvhRenderables.end(), rend));
 			};
 
-			virtual void insert(BvRenderable * rend)
-			{
-				mBvRenderables.push_back(rend);
+			virtual void insert(BvhRenderable * rend)
+			{
+				mBvhRenderables.push_back(rend);
 			};
 
-			BvRenderableList mBvRenderables;
-		};
-
-		struct SplitCandidate
-		{
-			SplitCandidate(PlaneEventList * e, int n, AxisAlignedBox& a,
-				KdTree::Branch * p, Real c, Real d, SplitInfo * b, PlaneEvent::Side s):
+			BvhRenderableList mBvhRenderables;
+		};
+
+		struct BvhSubdivisionCandidate
+		{
+			BvhSubdivisionCandidate(BvhPlaneEventList * e, int n, AxisAlignedBox& a,
+				BvHierarchy::Branch * p, Real c, Real d, BvhSplitInfo * b, BvhPlaneEvent::Side s):
 			events(e), nObjects(n), aabb(a), parent(p), cost(c), decrease(d), best(b), side(s)
 			{ };
 
-			bool operator < (const SplitCandidate& rhs) const
+			bool operator < (const BvhSubdivisionCandidate& rhs) const
 			{
 				return decrease < rhs.decrease;
 			};
 
-			void operator = (const SplitCandidate& rhs)
+			void operator = (const BvhSubdivisionCandidate& rhs)
 			{
 				decrease = rhs.decrease;
@@ -461,22 +461,22 @@
 			Real cost;
 			int nObjects;
-			PlaneEvent::Side side;
+			BvhPlaneEvent::Side side;
 			AxisAlignedBox aabb;
-			PlaneEventList * events;
-			KdTree::Branch * parent;
-			SplitInfo * best;
-		};
-
-		// typedef std::stack<SplitCandidate> SplitCandidatePQ;
-		typedef std::priority_queue<SplitCandidate> SplitCandidatePQ;
+			BvhPlaneEventList *events;
+			BvHierarchy::Branch * parent;
+			BvhSplitInfo * best;
+		};
+
+		// typedef std::stack<BvhSubdivisionCandidate> SplitCandidatePQ;
+		typedef std::priority_queue<BvhSubdivisionCandidate> SplitCandidatePQ;
 
 		// nodestack for the stack-based rendering function
-		typedef std::stack<KdTree::Node *> NodeStack;
+		typedef std::stack<BvHierarchy::Node *> NodeStack;
 	public:
-		friend class KdTreeHierarchyInterface;
-
-		typedef KdTree::Node * NodePtr;
-		typedef KdTree::Branch * BranchPtr;
-		typedef KdTree::Leaf * LeafPtr;
+		friend class BvHierarchyInterface;
+
+		typedef BvHierarchy::Node * NodePtr;
+		typedef BvHierarchy::Branch * BranchPtr;
+		typedef BvHierarchy::Leaf * LeafPtr;
 
 		typedef std::list<NodePtr> NodeList;
@@ -513,20 +513,20 @@
 		enum RenderMethod
 		{
-			KDRM_INTERNAL,
-			KDRM_GTP_VFC,
-			KDRM_GTP_SWC,
-			KDRM_GTP_CHC,
+			BVHRM_INTERNAL,
+			BVHRM_GTP_VFC,
+			BVHRM_GTP_SWC,
+			BVHRM_GTP_CHC,
 			// invalid modes, just for convenience
-			KDRM_SIZE,
-			KDRM_NOTSET
+			BVHRM_SIZE,
+			BVHRM_NOTSET
 		};
 
 		enum BuildMethod
 		{
-			KDBM_RECURSIVE,
-			KDBM_PRIORITYQUEUE,
+			BVHBM_RECURSIVE,
+			BVHBM_PRIORITYQUEUE,
 			// invalid modes, just for convenience
-			KDBM_SIZE,
-			KDBM_NOTSET
+			BVHBM_SIZE,
+			BVHBM_NOTSET
 		};
 
@@ -534,7 +534,7 @@
 		const static int HILITE_OFF  = -1;
 		
-		KdTree(int maxdepth, BuildMethod bm);
-		KdTree(int maxdepth, BuildMethod bm, int hilite, bool allboxes, bool shownodes);
-		virtual ~KdTree();
+		BvHierarchy(int maxdepth, BuildMethod bm);
+		BvHierarchy(int maxdepth, BuildMethod bm, int hilite, bool allboxes, bool shownodes);
+		virtual ~BvHierarchy();
 
 		// DEBUG
@@ -546,5 +546,5 @@
 		inline int  getHiLiteLevel(void) { return mHiLiteLevel; };
 
-		// toggles displaying the kdtree boxes
+		// toggles displaying the BvHierarchy boxes
 		inline void setShowAllBoxes(bool show) { mShowAllBoxes = show; };
 		inline bool getShowAllBoxes(void) { return mShowAllBoxes; };
@@ -559,21 +559,21 @@
 		bool getEnhancedVis(void);
 
-		NodePtr getRoot(void) const { return mKdRoot; };
-
-		// insert a new scene node into an existing kd-tree
-		void insert(BvRenderable * rend);
+		NodePtr getRoot(void) const { return mBvhRoot; };
+
+		// insert a new scene node into an existing bvhierarchy
+		void insert(BvhRenderable * rend);
 		// remove a scene node from the tree
-		void remove(BvRenderable * rend);
+		void remove(BvhRenderable * rend);
 		// function to initialize a kd-tree based on the contents of the scene
-		void build(BvRenderable * sceneRoot);
+		void build(BvhRenderable * sceneRoot);
 
 		// test visibility of objects and add to render	queue
 		void queueVisibleObjects(BvHierarchyCamera* cam, RenderQueue* queue, bool onlyShadowCasters, 
-			bool showBoxes, KdTree::NodeList& visibleNodes);
+			bool showBoxes, BvHierarchy::NodeList& visibleNodes);
 
 		// find visible nodes & place in list
 		//void findVisibleNodes(NodeList& visibleNodes, Camera * cam);
 
-		/** Recurses the kdtree, adding any nodes intersecting with the 
+		/** Recurses the BvHierarchy, adding any nodes intersecting with the 
 		box/sphere/volume/ray into the given list.
 		It ignores the exclude scene node.
@@ -588,5 +588,5 @@
 		const TreeStats& getTreeStats(void) const { return mTreeStats; }
 		const FrameStats& getFramesStats(void) const { return mFrameStats; }
-		AxisAlignedBox getBox(void) { if (mKdRoot) return mKdRoot->mAABB; else return AxisAlignedBox(); }
+		AxisAlignedBox getBox(void) { if (mBvhRoot) return mBvhRoot->mAABB; else return AxisAlignedBox(); }
 		void setBuildMethod(BuildMethod bm) { mBuildMethod = bm; }
 	protected:
@@ -594,33 +594,33 @@
 		void init();
 		// recursive insert funciton
-		void recInsert(KdTree::Node * node, BvRenderable * rend);
+		void recInsert(BvHierarchy::Node * node, BvhRenderable * rend);
 		// helper functions for insert
-		void recInsertNew(KdTree::Branch * parent, PlaneEvent::Side side, BvRenderable * rend);
-		void splitBox(const KdTree::Branch& parent, AxisAlignedBox& left, AxisAlignedBox& right);
-		void rebuildSubtree(KdTree::Node * node, BvRenderable * rend);
+		void recInsertNew(BvHierarchy::Branch * parent, BvhPlaneEvent::Side side, BvhRenderable * rend);
+		void splitBox(const BvHierarchy::Branch& parent, AxisAlignedBox& left, AxisAlignedBox& right);
+		void rebuildSubtree(BvHierarchy::Node * node, BvhRenderable * rend);
 		// build scene from a list of nodes rather than a hierarchy
-		KdTree::Node * buildFromList(BvRenderableList& nodelist, KdTree::Branch * parent, AxisAlignedBox& aabb);
-		void addRendToList(KdTree::Node * node, BvRenderableList& nodelist);
+		BvHierarchy::Node * buildFromList(BvhRenderableList& nodelist, BvHierarchy::Branch * parent, AxisAlignedBox& aabb);
+		void addRendToList(BvHierarchy::Node * node, BvhRenderableList& nodelist);
 
 		// recursively delete empty nodes
-		void recDelete(KdTree::Node * node);
+		void recDelete(BvHierarchy::Node * node);
 
 		// find the best plane for node division
-		SplitInfo * pqFindPlane(PlaneEventList * events, int nObjects, AxisAlignedBox& aabb, Real globalSA);
+		BvhSplitInfo * pqFindPlane(BvhPlaneEventList * events, int nObjects, AxisAlignedBox& aabb, Real globalSA);
 
 		// priority queue based build function
-		KdTree::Node * pqBuild(PlaneEventList& events, int nObjects, AxisAlignedBox& aabb, KdTree::Branch * parent);
+		BvHierarchy::Node * pqBuild(BvhPlaneEventList& events, int nObjects, AxisAlignedBox& aabb, BvHierarchy::Branch * parent);
 		// recursive build function
-		KdTree::Node * recBuild(PlaneEventList& events, int nObjects, AxisAlignedBox& aabb, KdTree::Branch * parent);
+		BvHierarchy::Node * recBuild(BvhPlaneEventList& events, int nObjects, AxisAlignedBox& aabb, BvHierarchy::Branch * parent);
 
 		// recursive rendering function
-		void recQueueVisibleObjects(KdTree::Node * node, unsigned long currentFrame, BvHierarchyCamera* cam,
+		void recQueueVisibleObjects(BvHierarchy::Node * node, unsigned long currentFrame, BvHierarchyCamera* cam,
 			RenderQueue* queue, bool onlyShadowCasters, bool showBoxes, 
-			KdTree::NodeList& visibleNodes, bool fullVis = false);
+			BvHierarchy::NodeList& visibleNodes, bool fullVis = false);
 
 		// recursively find visible nodes
-		//void recFindVisibleNodes(KdTree::Node * node, NodeList& visibleNodes, Camera * cam);
-
-		/** Recurses the kdtree, adding any nodes intersecting with the 
+		//void recFindVisibleNodes(BvHierarchy::Node * node, NodeList& visibleNodes, Camera * cam);
+
+		/** Recurses the BvHierarchy, adding any nodes intersecting with the 
 		box/sphere/volume/ray into the given list.
 		It ignores the exclude scene node.
@@ -631,6 +631,6 @@
 		void recFindNodesIn(const Ray &ray, std::list<SceneNode *> &list, SceneNode *exclude, Node * node, bool full = false);
 
-		// the root node of the kdtree
-		KdTree::Node * mKdRoot;
+		// the root node of the BvHierarchy
+		BvHierarchy::Node * mBvhRoot;
 		// Maximum depth of the tree
 		int mMaxDepth;
@@ -649,5 +649,5 @@
 
 		/** Visualization flags **/
-		// show/highlight selected level in kdtree
+		// show/highlight selected level in BvHierarchy
 		int mHiLiteLevel;
 		// show whole kd-tree
@@ -662,7 +662,7 @@
 
 		// DEBUG
-		void KdTree::dump(KdTree::Node * node);
-		Real KdTree::calcCost(KdTree::Node * node, Real vs);
-	}; // class KdTree
+		void BvHierarchy::dump(BvHierarchy::Node * node);
+		Real BvHierarchy::calcCost(BvHierarchy::Node * node, Real vs);
+	}; // class BvHierarchy
 
 } // namespace Ogre
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchyCamera.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchyCamera.h	(revision 1319)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchyCamera.h	(revision 1320)
@@ -13,5 +13,5 @@
 #include <OgreCamera.h>
 
-#define KDCAMPTR_CAST(cam) (static_cast<BvHierarchyCamera *>(cam))
+#define BVHCAMPTR_CAST(cam) (static_cast<BvHierarchyCamera *>(cam))
 
 namespace Ogre
@@ -23,7 +23,7 @@
 	enum NodeVisibility
 	{
-		KDNV_NONE,
-		KDNV_PART,
-		KDNV_FULL
+		BVHNV_NONE,
+		BVHNV_PART,
+		BVHNV_FULL
 	};
 
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchyInterface.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchyInterface.h	(revision 1319)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchyInterface.h	(revision 1320)
@@ -16,12 +16,12 @@
 {
 
-class KdTreeSceneManager;
+class BvHierarchySceneManager;
 
-class KdTreeHierarchyInterface : public PlatformHierarchyInterface
+class BvHierarchyInterface : public PlatformHierarchyInterface
 {
 public:
-	KdTreeHierarchyInterface(KdTreeSceneManager *sm, RenderSystem *rsys);
+	BvHierarchyInterface(BvHierarchySceneManager *sm, RenderSystem *rsys);
 
-	virtual ~KdTreeHierarchyInterface() {};
+	virtual ~BvHierarchyInterface() {};
 
 	/** Returns true if current node is leaf of the hierarchy. 
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchySceneNode.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchySceneNode.h	(revision 1319)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchySceneNode.h	(revision 1320)
@@ -12,22 +12,22 @@
 
 #include <OgreSceneNode.h>
-#include "OgreBvRenderable.h"
+#include "OgreBvhRenderable.h"
 
 namespace Ogre
 {
 
-	class KdTreeSceneNode : public SceneNode, public BvRenderable
+	class BvHierarchySceneNode : public SceneNode, public BvhRenderable
 	{
 	public:
-		KdTreeSceneNode(SceneManager *creator):
+		BvHierarchySceneNode(SceneManager *creator):
 		  SceneNode(creator) {};
 
-		KdTreeSceneNode(SceneManager *creator, const String& name):
+		BvHierarchySceneNode(SceneManager *creator, const String& name):
 		  SceneNode(creator, name) {};
 
-		~KdTreeSceneNode() {};
+		~BvHierarchySceneNode() {};
 
 		// gather info for kd-tree creation
-		virtual void computeScene(PlaneEventList& events, AxisAlignedBox& aabb, int& nObjects, bool includeChildren = true);
+		virtual void computeScene(BvhPlaneEventList& events, AxisAlignedBox& aabb, int& nObjects, bool includeChildren = true);
 
 		// add all contained objects to render queue
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvhRenderable.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvhRenderable.h	(revision 1320)
+++ GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvhRenderable.h	(revision 1320)
@@ -0,0 +1,128 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of the GameTools Project
+http://www.gametools.org
+
+Author: Martin Szydlowski
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OgreBvhRenderable_H__
+#define _OgreBvhRenderable_H__
+
+#include "OgreBvHierarchy.h"
+
+namespace Ogre
+{
+
+	// interface which must be implemented by all objects which desire to be
+	// placed in the kd-tree
+	class BvhRenderable
+	{
+	public:
+		BvhRenderable():mSide(BvhPlaneEvent::PES_BOTH), mClassified(false), mLastQueued(0), mBvHierarchy(0) {};
+		virtual ~BvhRenderable()
+		{
+			if (mBvHierarchy)
+				mBvHierarchy->remove(this);
+		}
+
+		// gather the information required for the creation of the kd-tree
+		virtual void computeScene(BvhPlaneEventList& events, AxisAlignedBox& aabb, int& nObjects, bool includeChildren = true) = 0;
+
+		// put all objects this element holds in the renedering queue
+		virtual void queueObjects(Camera* cam, RenderQueue* queue, bool onlyShadowCasters) = 0;
+
+		// place all entities in geometry queue (for CHC)
+		virtual void getGeometryList(GtpVisibility::GeometryVector *geometryList) = 0;
+
+		// return a bounding box enclosing all objects
+		virtual AxisAlignedBox getBoundingBox() const = 0;
+
+		// TODO: reconsider getters/setters !!!
+		inline bool isClassified()
+		{
+			return mClassified;
+		};
+		inline void setClassified(bool q)
+		{
+			mClassified = q;
+		};
+
+		inline BvhPlaneEvent::Side getSide()
+		{
+			return mSide;
+		};
+		inline void setSide(BvhPlaneEvent::Side s)
+		{
+			mSide = s;
+		};
+
+		// funcions for attachment/detachment of renderables to/from the kd-tree
+		inline bool isAttached()
+		{
+			return mLeaves.size() != 0;
+		};
+		// the following functions should work in O(log N)
+		inline bool isAttached(BvHierarchy::LeafPtr leaf)
+		{
+			return mLeaves.find(leaf) != mLeaves.end();
+		};
+		inline bool attachTo(BvHierarchy::LeafPtr leaf, BvHierarchy * BvHierarchy)
+		{
+			if (mBvHierarchy == 0 || mBvHierarchy == BvHierarchy)
+				mBvHierarchy = BvHierarchy;
+			else
+				return false;
+
+			BvHierarchy::LeafSet::_Pairib p = mLeaves.insert(leaf);
+			return p.second;
+		};
+		inline bool detachFrom(BvHierarchy::LeafPtr leaf)
+		{
+			bool success = (mLeaves.erase(leaf) == 1);
+			if (mLeaves.size() == 0)
+				mBvHierarchy = 0;
+
+			return success;
+		};
+
+		inline bool isQueued(unsigned long currentFrame, Camera * currentCam)
+		{
+			if (mLastQueued == currentFrame && mLastCam == currentCam)
+			{
+				return true;
+			}
+			else
+			{
+				mLastQueued = currentFrame;
+				mLastCam = currentCam;
+				return false;
+			}
+		};
+
+		BvHierarchy::LeafSet& getLeaves()
+		{
+			return mLeaves;
+		};
+
+	protected:
+		// number of the frame in which this renderable was last queued for rendering
+		unsigned long mLastQueued;
+		// the camera for which this renderable was last queued for rendering
+		Camera * mLastCam;
+		
+		// BvHierarchy to which this renderable is attached
+		BvHierarchy * mBvHierarchy;
+		// BvHierarchy leaves which overlap this renderable
+		BvHierarchy::LeafSet mLeaves;
+
+		// Flag for the SAH determining the "cheaper" side of the split plane
+		BvhPlaneEvent::Side mSide;
+		// Flag for the SAH which marks if this renderable was already placed in the list after a split
+		bool mClassified;
+	}; // class BvhRenderable
+
+} // namespace Ogre
+
+#endif // _OgreBvhRenderable_H__
Index: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvRenderable.h
===================================================================
--- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvRenderable.h	(revision 1319)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of the GameTools Project
-http://www.gametools.org
-
-Author: Martin Szydlowski
------------------------------------------------------------------------------
-*/
-
-#ifndef _OgreBvRenderable_H__
-#define _OgreBvRenderable_H__
-
-#include "OgreBvHierarchy.h"
-
-namespace Ogre
-{
-
-	// interface which must be implemented by all objects which desire to be
-	// placed in the kd-tree
-	class BvRenderable
-	{
-	public:
-		BvRenderable():mSide(PlaneEvent::PES_BOTH), mClassified(false), mLastQueued(0), mBvHierarchy(0) {};
-		virtual ~BvRenderable()
-		{
-			if (mBvHierarchy)
-				mBvHierarchy->remove(this);
-		}
-
-		// gather the information required for the creation of the kd-tree
-		virtual void computeScene(PlaneEventList& events, AxisAlignedBox& aabb, int& nObjects, bool includeChildren = true) = 0;
-
-		// put all objects this element holds in the renedering queue
-		virtual void queueObjects(Camera* cam, RenderQueue* queue, bool onlyShadowCasters) = 0;
-
-		// place all entities in geometry queue (for CHC)
-		virtual void getGeometryList(GtpVisibility::GeometryVector *geometryList) = 0;
-
-		// return a bounding box enclosing all objects
-		virtual AxisAlignedBox getBoundingBox() const = 0;
-
-		// TODO: reconsider getters/setters !!!
-		inline bool isClassified()
-		{
-			return mClassified;
-		};
-		inline void setClassified(bool q)
-		{
-			mClassified = q;
-		};
-
-		inline PlaneEvent::Side getSide()
-		{
-			return mSide;
-		};
-		inline void setSide(PlaneEvent::Side s)
-		{
-			mSide = s;
-		};
-
-		// funcions for attachment/detachment of renderables to/from the kd-tree
-		inline bool isAttached()
-		{
-			return mLeaves.size() != 0;
-		};
-		// the following functions should work in O(log N)
-		inline bool isAttached(KdTree::LeafPtr leaf)
-		{
-			return mLeaves.find(leaf) != mLeaves.end();
-		};
-		inline bool attachTo(KdTree::LeafPtr leaf, KdTree * kdTree)
-		{
-			if (mBvHierarchy == 0 || mBvHierarchy == kdTree)
-				mBvHierarchy = kdTree;
-			else
-				return false;
-
-			KdTree::LeafSet::_Pairib p = mLeaves.insert(leaf);
-			return p.second;
-		};
-		inline bool detachFrom(KdTree::LeafPtr leaf)
-		{
-			bool success = (mLeaves.erase(leaf) == 1);
-			if (mLeaves.size() == 0)
-				mBvHierarchy = 0;
-
-			return success;
-		};
-
-		inline bool isQueued(unsigned long currentFrame, Camera * currentCam)
-		{
-			if (mLastQueued == currentFrame && mLastCam == currentCam)
-			{
-				return true;
-			}
-			else
-			{
-				mLastQueued = currentFrame;
-				mLastCam = currentCam;
-				return false;
-			}
-		};
-
-		KdTree::LeafSet& getLeaves()
-		{
-			return mLeaves;
-		};
-
-	protected:
-		// number of the frame in which this renderable was last queued for rendering
-		unsigned long mLastQueued;
-		// the camera for which this renderable was last queued for rendering
-		Camera * mLastCam;
-		
-		// kdtree to which this renderable is attached
-		KdTree * mBvHierarchy;
-		// kdtree leaves which overlap this renderable
-		KdTree::LeafSet mLeaves;
-
-		// Flag for the SAH determining the "cheaper" side of the split plane
-		PlaneEvent::Side mSide;
-		// Flag for the SAH which marks if this renderable was already placed in the list after a split
-		bool mClassified;
-	}; // class BvRenderable
-
-} // namespace Ogre
-
-#endif // _OgreBvRenderable_H__
