Index: GTP/trunk/App/Demos/Vis/CHC_revisited/Geometry.h
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/Geometry.h	(revision 2751)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/Geometry.h	(revision 2752)
@@ -1,8 +1,16 @@
 #ifndef GEOMETRY_H
 #define GEOMETRY_H
+
+#include "common.h"
+#include "AxisAlignedBox3.h"
+
 
 
 namespace CHCDemo 
 {
+
+class Material;
+
+
 
 /** Represents drawable geometry consisting of triangles
@@ -19,5 +27,5 @@
 	AxisAlignedBox3 mBoundingBox;
 	TriangleContainer mTriangles;
-}
+};
 
 
@@ -65,3 +73,4 @@
 
 }
+
 #endif // GEOMETRY_H
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp	(revision 2751)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp	(revision 2752)
@@ -1,15 +1,5 @@
-#if TOIMPLEMENT
-
 #include <queue>
 #include <stack>
 #include "Bvh.h"
-#include "yare.h"
-#include "PerfTimer.h"
-#include "Camera.h"
-#include "Settings.h"
-#include "Context.h"
-#include "TriangleBvh.h"
-#include "NodeGeometry.h"
-#include "Viewer.h"
 
 #include <fstream>
@@ -18,7 +8,8 @@
 
 
-
 namespace CHCDemo
 {
+
+#if TOIMPLEMENT
 
 #define INVALID_TEST ((unsigned int)-1)
@@ -2593,5 +2584,5 @@
 } 
 
-}
-
 #endif
+
+}
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/Vector3.h
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/Vector3.h	(revision 2751)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/Vector3.h	(revision 2752)
@@ -67,5 +67,4 @@
 		return (const float*) this; 
 	}
-
 
 	const float &operator[] (const int inx) const 
@@ -81,5 +80,4 @@
 	}
 
-	
 	void SetValue(float a) 
 	{ 
@@ -90,5 +88,4 @@
 	*/
 	int DrivingAxis(void) const;
-
 	/** returns the axis, where the std::vector has the smallest value
 	*/
@@ -100,5 +97,4 @@
 		return (x > y) ? ( (x > z) ? x : z) : ( (y > z) ? y : z);
 	}
-	
 	/** Returns copy of this vector where all components are positiv.
 	*/
@@ -107,27 +103,10 @@
 		return Vector3(fabs(x), fabs(y), fabs(z));
 	}
-
-	// normalizes the std::vector of unit size corresponding to given std::vector
+	/** normalizes the std::vector of unit size corresponding to given std::vector
+	*/
 	inline void Normalize();
-
 	/** Returns false if this std::vector has a nan component.
 	*/
 	bool CheckValidity() const;
-
-	/**
-	===> Using ArbitraryNormal() for constructing coord systems 
-	===> is obsoleted by RightHandedBase() method (<JK> 12/20/03).   
-
-	Return an arbitrary normal to `v'.
-	In fact it tries v x (0,0,1) an if the result is too small,
-	it definitely does v x (0,1,0). It will always work for
-	non-degenareted std::vector and is much faster than to use
-	TangentVectors.
-
-	@param v(in) The std::vector we want to find normal for.
-	@return The normal std::vector to v.
-	*/
-	friend inline Vector3 ArbitraryNormal(const Vector3 &v); 
-
 	/**
 	Find a right handed coordinate system with (*this) being
@@ -152,4 +131,37 @@
 	*/
 	void RightHandedBase(Vector3& U, Vector3& V) const;
+	
+	
+	// Unary operators
+
+	Vector3 operator+ () const;
+	Vector3 operator- () const;
+
+	// Assignment operators
+	
+	Vector3& operator+= (const Vector3 &A);
+	Vector3& operator-= (const Vector3 &A);
+	Vector3& operator*= (const Vector3 &A);
+	Vector3& operator*= (float A);
+	Vector3& operator/= (float A);
+
+
+	//////////
+	//-- friends
+	
+	/**
+	===> Using ArbitraryNormal() for constructing coord systems 
+	===> is obsoleted by RightHandedBase() method (<JK> 12/20/03).   
+
+	Return an arbitrary normal to `v'.
+	In fact it tries v x (0,0,1) an if the result is too small,
+	it definitely does v x (0,1,0). It will always work for
+	non-degenareted std::vector and is much faster than to use
+	TangentVectors.
+
+	@param v(in) The std::vector we want to find normal for.
+	@return The normal std::vector to v.
+	*/
+	friend inline Vector3 ArbitraryNormal(const Vector3 &v); 
 
 	/// Transforms a std::vector to the global coordinate frame.
@@ -162,7 +174,7 @@
 	*/
 	friend inline Vector3 ToGlobalFrame(const Vector3& loc,
-		const Vector3& U,
-		const Vector3& V,
-		const Vector3& N);
+		                                const Vector3& U,
+										const Vector3& V,
+										const Vector3& N);
 
 	/// Transforms a std::vector to a local coordinate frame.
@@ -175,7 +187,7 @@
 	*/
 	friend inline Vector3 ToLocalFrame(const Vector3& loc,
-		const Vector3& U,
-		const Vector3& V,
-		const Vector3& N);
+                                	   const Vector3& U,
+									   const Vector3& V,
+									   const Vector3& N);
 
 	/// the magnitude=size of the std::vector
@@ -187,9 +199,7 @@
 	/// SqrMagnitude(v1-v2)
 	friend inline float SqrDistance(const Vector3 &v1, const Vector3 &v2);
-
-	// creates the std::vector of unit size corresponding to given std::vector
+	/// creates the std::vector of unit size corresponding to given std::vector
 	friend inline Vector3 Normalize(const Vector3 &A);
-
-	// Rotate a normal std::vector.
+	/// // Rotate a direction vector
 	friend Vector3 PlaneRotate(const Matrix4x4 &, const Vector3 &);
 
@@ -209,21 +219,11 @@
 	// to the vectors `N','D', and `V'. Then 'N', 'U', and 'V' create
 	// the orthonormal base in space R3.
-	friend void TangentVectors(Vector3 &U, 
- 		                       Vector3 &V, // output
+	friend void TangentVectors(Vector3 &U, Vector3 &V, // output
 							   const Vector3 &normal, // input
 							   const Vector3 &dirIncoming);
 
-	// Unary operators
-	Vector3 operator+ () const;
-	Vector3 operator- () const;
-
-	// Assignment operators
-	Vector3& operator+= (const Vector3 &A);
-	Vector3& operator-= (const Vector3 &A);
-	Vector3& operator*= (const Vector3 &A);
-	Vector3& operator*= (float A);
-	Vector3& operator/= (float A);
 
 	// Binary operators
+	
 	friend inline Vector3 operator+ (const Vector3 &A, const Vector3 &B);
 	friend inline Vector3 operator- (const Vector3 &A, const Vector3 &B);
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/Matrix4x4.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/Matrix4x4.cpp	(revision 2751)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/Matrix4x4.cpp	(revision 2752)
@@ -615,7 +615,6 @@
 }
 
-// Rotate a direction vector...
-Vector3
-PlaneRotate(const Matrix4x4& tform, const Vector3& p)
+
+Vector3 PlaneRotate(const Matrix4x4& tform, const Vector3& p)
 {
 	// I sure hope that matrix is invertible...
@@ -626,6 +625,5 @@
 
 // Transform a normal
-Vector3
-TransformNormal(const Matrix4x4& tform, const Vector3& n)
+Vector3 TransformNormal(const Matrix4x4& tform, const Vector3& n)
 {
 	Matrix4x4 use = NormalTransformMatrix(tform);
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.h
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.h	(revision 2751)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.h	(revision 2752)
@@ -4,36 +4,21 @@
 #define __BVH_H
 
-
-#if TOIMPLEMENT
-
-#include "Bounds.h"
-#include "PerfTimer.h"
-#include "NV_RenderPredictorRenderAction.h"
-#include "VisibilityPredictor.h"
-#include "HierarchyNode.h"
-#include "FlexibleHeap.h"
-
+#include "Geometry.h"
+//#include "FlexibleHeap.h"
 
 
 namespace CHCDemo
 {
-
 
 ////////
 // Forward declarations
 
-class Scene;
-class Node;
+class SceneGeometry;
 class Camera;
-class Box;
-class BvhLeaf;
-class BvhNode;
-class TriangleBvh;
-
 
 
 /** A node in the bv hierarchy.
 */
-class BvhNode: public RenderableHierarchyNode, public Heapable
+class BvhNode
 {
 	friend class Bvh;
@@ -50,38 +35,15 @@
 		void Reset();
 
-
 		/// if the node is visible
 		bool mIsVisible;
-		/// if all the leaves are visible
-		bool mIsFullyVisible;
-		
-		/// #pixels this node was visible for the last test
-		int mVisiblePixels;		
 		/// #frames this node is assumed to stay visible
 		int mAssumedVisibleFrames;
-		/// #frames this node is assumed to stay visible
-		int mRemainingVisibleFrames;
-		
-		/// the frame in which the node was last tested visible
-		int mLastTestedVisibleFrame;
 		/// the frame when this node was last touched during traversal
 		int mLastVisitedFrame;
-		/// frame id when the node turned visible
-		int mTurnedVisibleFrame;
-		/// when was the node last tested
-		int mLastTestedFrame;
-
 		/// #times this node was invisible (only valid if the node actually is invisible)
 		int mTimesInvisible;
-		/// #times this node was tested
-		int mTimesTested;
-		/// #times this node was tested
-		int mTimesChangedClassification;
-		/// The ratio of classification changes / tests
-		float mAvgChangedClassification;
-		
 		/// if the node is view frustum culled
 		bool mIsFrustumCulled;
-
+		/// if the node is newly processed with no prior history available
 		bool mIsNew;
 	};
@@ -99,8 +61,8 @@
 	/** Returns unique id for this node.
 	*/
-	inline int GetId() {return mId;}
+	//inline int GetId() {return mId;}
 	/** Depth of this node in the tree.
 	*/
-	inline int GetDepth() const {return (int)mDepth;}
+	inline int GetDepth() const {return mDepth;}
 	/** Returns parent of this bvh node, NULL if it is root.
 	*/
@@ -109,12 +71,9 @@
 	*/
 	inline int GetNumLeaves() const {return mNumLeaves;}
-	/** Box used for visualization.
-	*/
-	Box *GetOrCreateVizBox();
 	/** Reset the status of this node.
 	*/
 	virtual void ResetVisibility();
 
-	virtual int GetType() { return BVH_NODE; }
+	virtual int GetType() = 0; //{ return BVH_NODE; }
 
 
@@ -140,26 +99,12 @@
 	*/
 	inline void SetRemainingVisibleFrames(const int t);
-	/** See set.
-	*/
-	inline int GetRemainingVisibleFrames() const;
 	/** Decrease the time this node is considered visible.
 	*/
-	inline void DecRemainingVisibleFrames();
-	/** Returns the frame id when this node was tested
-		visible.
-	*/
-	inline void SetLastTestedVisibleFrame(const int t);
-	/** See set.
-	*/
-	inline int GetLastTestedVisibleFrame() const;
+	inline void DecAssumedVisibleFrames();
 	/** Increases the #times this node was
 		successfully tested invisible.
 	*/
 	inline void IncTimesInvisible();
-	/** If the subtree induced by this node
-		is fully visible.
-	*/
-	inline bool IsFullyVisible();
-
+	
 	inline int GetTimesInvisible() const;
 	inline void SetTimesInvisible(const int t);
@@ -170,13 +115,4 @@
 	inline int GetLastTestedFrame();
 	inline void SetLastTestedFrame(const int lastTested);
-
-	inline void SetVisiblePixels(const int pixels);
-	inline int GetVisiblePixels();
-
-	inline void IncTimesTested();
-	inline void IncTimesChangedClassficiation();
-
-	inline int GetTimesTested();
-	inline int GetTimesChangedClassification();
 	
 	inline bool IsViewFrustumCulled() const;
@@ -196,6 +132,4 @@
 	*/
 	inline void SetLastRenderedFrame(int lastRenderedFrame);
-	
-	
 	/** Does this node contain renderable geometry?
 	*/
@@ -206,24 +140,10 @@
 
 
-	///////////////
-	//-- public stuff
-
-	/// Visibility measurements for the period this node was visible
-	VisibilityMeasurementBuffer mMeasurements;
+protected:
+
+	/////////////
+	
 	/// some flags
 	int mFlags;
-
-	//int mNumFailedTests;
-
-protected:
-
-	/** Marks the subtree induced by this node
-		as fully visible.
-	*/
-	inline void SetFullyVisible(const bool visible);
-
-
-	/////////////
-
 	/// the depth of this node
 	unsigned char mDepth;
@@ -232,5 +152,4 @@
 	/// the parent node
 	BvhNode *mParent;
-	
 	/// stores the visibility related parameters
 	VisibilityInfo mVisibility;
@@ -252,5 +171,5 @@
 	
 	// Indices to first and last triangle in the triangle array
-	// assumes the traingle are placed in continuous chunk of memory
+	// assumes the triangle are placed in continuous chunk of memory
 	// however this need not be a global array!
 	
@@ -264,5 +183,4 @@
 	int mNumTestNodes;
 	int mIndicesPtr;
-
 	/// Area of this node
 	float mArea;
@@ -297,16 +215,4 @@
 
 
-void BvhNode::SetLastTestedVisibleFrame(const int t) 
-{ 
-	mVisibility.mLastTestedVisibleFrame = t; 
-}
-
-
-int BvhNode::GetLastTestedVisibleFrame() const 
-{ 
-	return mVisibility.mLastTestedVisibleFrame; 
-}
-
-
 void BvhNode::IncTimesInvisible() 
 { 
@@ -315,10 +221,4 @@
 
 
-bool BvhNode::IsFullyVisible() 
-{ 
-	return mVisibility.mIsFullyVisible; 
-}
-
-
 int BvhNode::GetTimesInvisible() const 
 { 
@@ -333,64 +233,4 @@
 
 
-int BvhNode::GetTurnedVisibleFrame() const 
-{ 
-	return mVisibility.mTurnedVisibleFrame; 
-}
-
-
-void BvhNode::SetTurnedVisibleFrame(const int turnedVisibleFrame) 
-{ 
-	mVisibility.mTurnedVisibleFrame = turnedVisibleFrame; 
-}
-
-
-int BvhNode::GetLastTestedFrame() 
-{ 
-	return mVisibility.mLastTestedFrame; 
-}
-
-
-void BvhNode::SetLastTestedFrame(const int lastTested)
-{ 
-	mVisibility.mLastTestedFrame = lastTested; 
-}
-
-
-void BvhNode::SetVisiblePixels(const int pixels)
-{ 
-	mVisibility.mVisiblePixels = pixels; 
-}
-
-
-int BvhNode::GetVisiblePixels() 
-{
-	return mVisibility.mVisiblePixels;
-}
-
-
-void BvhNode::IncTimesTested() 
-{ 
-	++ mVisibility.mTimesTested; 
-}
-
-
-void BvhNode::IncTimesChangedClassficiation() 
-{ 
-	++ mVisibility.mTimesChangedClassification; 
-}
-
-
-int BvhNode::GetTimesTested() 
-{ 
-	return mVisibility.mTimesTested; 
-}
-
-
-int BvhNode::GetTimesChangedClassification() 
-{ 
-	return mVisibility.mTimesChangedClassification; 
-}
-
-
 bool BvhNode::IsViewFrustumCulled() const 
 { 
@@ -452,22 +292,8 @@
 }
 
-
-void BvhNode::SetRemainingVisibleFrames(const int t) 
-{ 
-	mVisibility.mRemainingVisibleFrames = t; 
-}
-
-
-int BvhNode::GetRemainingVisibleFrames() const 
-{ 
-	return mVisibility.mRemainingVisibleFrames;
-}
-
-
-void BvhNode::DecRemainingVisibleFrames() 
-{
-	-- mVisibility.mRemainingVisibleFrames; 
-}
-
+void BvhNode::DecAssumedVisibleFrames() 
+{
+	-- mVisibility.mAssumedVisibleFrames; 
+}
 
 
@@ -515,5 +341,5 @@
 public:
 
-	BvhLeaf(BvhNode *parent): BvhNode(parent), mTriangleBvh(NULL)
+	BvhLeaf(BvhNode *parent): BvhNode(parent)
 	{}
 
@@ -521,22 +347,4 @@
 
 	virtual bool IsLeaf() { return true; }
-};
-
-
-struct NodeGeometry
-{
-	virtual AxisAlignedBox3 GetBoundingBox() = 0;
-};
-
-
-struct ObjectGeometry
-{
-	virtual AxisAlignedBox3 GetBoundingBox() = 0;
-};
-
-
-struct TriangleGeometry
-{
-	virtual AxisAlignedBox3 GetBoundingBox() = 0;
 };
 
@@ -608,5 +416,5 @@
 	/** Returns geometry by reference (faster).
 	*/
-	NodeGeometry **GetGeometry(BvhNode *node, int &size);
+	SceneGeometry **GetGeometry(BvhNode *node, int &size);
 
 
@@ -636,6 +444,6 @@
 	/** sets frame dependent values.
 	*/
-	void InitFrame(Camera *camera, const int currentFrameId, Viewer *viewer);
-	/** this gives the orthogonal distance from the viewpoint to the nearest BBox-Vertex
+	void InitFrame(Camera *camera, const int currentFrameId);
+	/** this gives the orthogonal distance from the viewpoint to the nearest bounding box vertex
 		note that negative values can appear because culling is done only afterwards
 	*/
@@ -645,9 +453,4 @@
 	*/
 	void SetMaxDepthForTestingChildren(const int maxDepth);
-	/** Resize the visibility buffers of the bvh nodes.
-	*/
-	void ResizeVisibilityBuffers(const int size);
-
-	
 	/** Pulls up the fully visible classification in the bvh.
 	*/
@@ -681,9 +484,4 @@
 	void SetAreaRatioThresholdForTestingChildren(const float ratio);
 
-	void SetVolRatioThresholdForTestingChildren(const float ratio);
-	/** Returns depth of bvh hierarchy.
-	*/
-	float GetAvgDepth() const;
-
 
 	const BvhStats &GetBvhStats() const {return mBvhStats;}
@@ -691,12 +489,4 @@
 	void SetCollectTighterBoundsWithMaxLevel(bool t);
 
-
-	/////////////
-	//-- timers
-
-	mutable PerfTimer timeSetup;
-	mutable PerfTimer timeIssueDrawElements;
-	mutable PerfTimer timeViewFrustumCulling;
-	mutable PerfTimer timeDistance;
 
 	//////////////
@@ -719,11 +509,10 @@
 	////////////////////
 
-	/** Constructor taking the geometry and a pointer to the current render action.
-	*/
-	Bvh(const GeometryVector &geometry, 
-		DistanceSortedRenderAction *const renderer);
+	/** Constructor loading the bvh from disc
+	*/
+	Bvh(const std::string &filename);
 	/** protected constructor: do nothing.
 	*/
-	Bvh(): mCamera(NULL), mFrameId(-1), mVertices(NULL), mRenderer(NULL) {}
+	//Bvh(): mCamera(NULL), mFrameId(-1), mVertices(NULL), mRenderer(NULL) {}
 	/** Destructor.
 	*/
@@ -731,57 +520,9 @@
 
 
-
-	//-- sorting functions
-
-	/** The method of subdividing objects into halves in some axis using spatial median
-	*/
-	int	SortTrianglesSpatialMedian(BvhLeaf *leaf, const int axis);
-	/** The method of subdividing objects into halves in some axis
-		using object median.
-	*/
-	int	SortTrianglesObjectMedian(BvhLeaf *leaf, const int axis, float &pos);
-	/** sort triangles along the axis with respect to the splitting plane 
-		given by axis/position return index of the first tiangles belong 
-		to the front of the splitting plane.
-	*/
-	int	SortTriangles(BvhLeaf *leaf, const int axis, const float position);
-	/** sort triangles by their area.
-	*/
-	int SortTrianglesSurfaceArea(BvhLeaf *leaf, const float sa);
-
-
 	/////////////
-
-
-	/** Subdivides the current leaf.
-	*/
-	BvhNode *SubdivideLeaf(BvhLeaf *leaf, const int parentAxis);	
-	/** select splitting plane using SAH - returns the position of the splitting plane.
-	*/
-	float SelectPlaneSah(BvhLeaf *leaf, int &axis, float &minCost);
-	/** evaluate the SAH cost of a particulkar splitting plane
-	*/
-	float EvaluateSahCost(BvhLeaf *leaf, const int axis, const float position);
 
 	void ComputeBvhStats();
 	void PrintBvhStats() const;
 
-	/** Update children nodes recursively.
-	*/
-	void UpdateBoxes(BvhNode *node);
-	/** Update box for a leaf node
-	*/
-	void UpdateLeafBox(BvhLeaf *leaf);
-	/** Returns true if termination criteria met.
-	*/
-	bool TerminationCriteriaMet(BvhLeaf *leaf) const;
-	/** Compute unique ids for the bvh nodes.
-	*/
-	void ComputeIds();
-	/** Helper method that updates the number of leaves in the subtree under
-		this node.
-	*/
-	void UpdateNumLeaves(BvhNode *node) const;
-
 
 	//////////
@@ -791,5 +532,5 @@
 
 	int PrepareBoundingBoxesWithDrawArrays(const BvhNodeContainer &nodes);
-	void RenderBoundingBoxesWithDrawArrays(const int numNodes);
+	void RenderBoundingBoxesWithDrawArrays(int numNodes);
 
 	int RenderBoundingBoxesImmediate(const BvhNodeContainer &nodes);
@@ -797,5 +538,5 @@
 		and restarts the strip only if wished.
 	*/
-	void RenderBoundingBoxImmediate(const BoundingBox &box, const bool restartStrip);
+	void RenderBoundingBoxImmediate(const AxisAlignedBox3 &box, bool restartStrip);
 	/** Create the indices that each node needs to use vbo rendering.
 	*/
@@ -818,21 +559,14 @@
 	int PostProcessLeaves(BvhLeafContainer &leaves);
 
-	bool CreateTighterBoundsForLeaf(BvhLeaf *leaf, Point3f *triangles, const int triangleCount);
-
-	Point3f *CollectTriangles(BvhLeaf *leaf, int &triangleCount);
+	//bool CreateTighterBoundsForLeaf(BvhLeaf *leaf, Point3f *triangles, int triangleCount);
+
+	///Point3f *CollectTriangles(BvhLeaf *leaf, int &triangleCount);
 
 	int	IsWithinViewFrustumLocal(BvhNode *node);
 
-	int	IsWithinViewFrustum(const BoundingBox &box, const int planeMask, const int preferredPlane);
-	/** Compute screen space projection of a bounding box.
-	*/
-	float ComputeScreenSpaceProjection(const BoundingBox &box) const;
-
-	float GetMinSquareDistance(const BoundingBox &box) const;
-	/** Computes the area of the triangles in a leaf.
-	*/
-	float ComputeGeometryArea(BvhLeaf *leaf, Point3f *triangles, const int triangleCount) const;
-
-
+	int	IsWithinViewFrustum(const AxisAlignedBox3 &box, int planeMask, int preferredPlane);
+	
+	float GetMinSquareDistance(const AxisAlignedBox3 &box) const;
+	
 	
 	////////////////////////
@@ -841,18 +575,8 @@
 	BvhNode *mRoot;
 	/// pointers to the geometry associated with this node
-	NodeGeometry **mGeometry;
-	/// #of entities of geometry
+	SceneGeometry **mGeometry;
+	/// #of entities
 	size_t mGeometrySize;
 
-
-	/////////
-	//-- termination criteria
-
-	int mMaxGeometry;
-	int mMaxTriangles;
-	int mSplitType;
-	int mNumNodes;
-	int mMaxDepth;
-	float mMinArea;
 
 	////////////////
@@ -868,5 +592,5 @@
 	int mFrameId;
 	/// a vertex array used if working with indexed arrays (without vbo)
-	Point3f *mVertices;
+	//Point3f *mVertices;
 	/// indices used for draw array rendering
 	unsigned int *mIndices;
@@ -880,13 +604,9 @@
 	float mVolRatioThreshold;
 
-	/// pointer to the renderaction
-	DistanceSortedRenderAction *const mRenderer;
-
 	BvhStats mBvhStats;
 
-	HierarchyNodeContainer mTestNodes;
+	//HierarchyNodeContainer mTestNodes;
 	
 	unsigned int *mTestIndices;
-
 	/// a pointer to the end of the indices array
 	int mCurrentIndicesPtr;
@@ -894,12 +614,10 @@
 	float mScale;
 
-	float mAvgDepth;
-
-	Vector3f mNearPlane;
+	Vector3 mNearPlane;
 	float mNearPlaneD;
+	int mNumNodes;
 };
 
 }
 
-#endif
 #endif // __BVH_H
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/common.h
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/common.h	(revision 2751)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/common.h	(revision 2752)
@@ -20,5 +20,8 @@
 
 struct Triangle3;
-  
+class BvhNode;
+class BvhLeaf;
+
+
 #if defined(_MSC_VER)
 // use perftimer only on msvc
@@ -454,15 +457,22 @@
 
 
+
+///////////
+//-- typedefs
+
+typedef std::vector<BvhNode *> BvhNodeContainer;
+typedef std::vector<BvhLeaf *> BvhLeafContainer;
 typedef std::vector<Triangle3> TriangleContainer;
 
-}
-
-#endif
-
-
-
-
-
-
-
-
+
+}
+
+#endif
+
+
+
+
+
+
+
+
