Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp	(revision 3054)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp	(revision 3060)
@@ -15,14 +15,10 @@
 
 
-inline static bool CompDist(RenderQueueBucket *b1, RenderQueueBucket *b2)
+/*inline static bool CompDist(RenderQueueBucket *b1, RenderQueueBucket *b2)
 {
 	return (b1->mMinDistance < b2->mMinDistance);
-}
-
-
-
+}*/
 RenderQueue::RenderQueue(): 
 mState(NULL), 
-mMinSizeForSorting(3),
 mCamera(NULL),
 mNumEntries(0)
@@ -33,5 +29,4 @@
 RenderQueue::RenderQueue(RenderState *state, Camera *cam):
 mState(state), 
-mMinSizeForSorting(3),
 mCamera(cam),
 mNumEntries(0)
@@ -118,5 +113,5 @@
 		{
 			RenderQueueBucket *bucket = new RenderQueueBucket();
-			bucket->mMinDistance = -1;
+			//bucket->mMinDistance = -1;
 
 			bucket->mAlphaTestEnabled = tech->IsAlphaTestEnabled();
@@ -161,13 +156,17 @@
 	}
 
-	if (bucket->mMinDistance < .0f)
-	{
+	if (bucket->IsEmpty())
+	{
+		// add to currently active buckets that will be rendered
 		// assume that the incoming nodes are ordered by distance 
+		// => active buckets are sorted by distance
+		mActiveBuckets.push_back(bucket);
+	
 		// => set min dist on first incoming node
-		const Vector3 v = shape->GetCenter() - mCamera->GetPosition();
-		
-		const float dist = SqrMagnitude(v);
-		bucket->mMinDistance = dist;
-	}
+		//const Vector3 v = shape->GetCenter() - mCamera->GetPosition();
+		//const float dist = SqrMagnitude(v);
+		//bucket->mMinDistance = dist;
+
+		}
 
 	bucket->mShapes.push_back(shape);
@@ -177,11 +176,13 @@
 void RenderQueue::Clear()
 {
-	for (size_t i = 0; i < mBuckets.size(); ++ i)
-	{
-		mBuckets[i]->mMinDistance = -1;
-		mBuckets[i]->mShapes.clear();
+	for (size_t i = 0; i < mActiveBuckets.size(); ++ i)
+	{
+		//mBuckets[i]->mMinDistance = -1;
+		mActiveBuckets[i]->mShapes.clear();
 	}
 
 	mNumEntries = 0;
+
+	mActiveBuckets.clear();
 }
 
@@ -196,5 +197,5 @@
 {
 	// sort the buckets
-	Sort();
+	//Sort();
 
 	// render all buckets
@@ -236,9 +237,9 @@
 
 
-void RenderQueue::Sort()
+/*void RenderQueue::Sort()
 {
 	// sort buckets itself by distance
 	sort(mBuckets.begin(), mBuckets.end(), CompDist);
-}
+}*/
 
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.h	(revision 3054)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.h	(revision 3060)
@@ -17,7 +17,10 @@
 struct RenderQueueBucket
 {
+	inline bool IsEmpty() const { return mShapes.empty();}
+
 	////////
 	//-- the attributes used to sort the materials
-	/// texture parameters
+	
+	// texture related parameters
 	int mTexHeight;
 	int mTexWidth;
@@ -39,5 +42,5 @@
 
 	/// minimal distance to the camera
-	float mMinDistance;
+	//float mMinDistance;
 
 	/// the shapes that belong to a bucket
@@ -49,6 +52,7 @@
 	to minimize state changes while approximately keeping front-to-back order
 	The implementation roughly follows the suggested implementation in 
-	Tom Forsyth's article on render state changes. It requires sorting only on 
-	bucket level and therefore has very	low overhead.
+	Tom Forsyth's article on render state changes. It assumes that the incoming
+	objecs are roughly front to back level and therefore does not require any sorting 
+	and therefore has very	low overhead.
 */
 class RenderQueue
@@ -88,5 +92,5 @@
 protected:
 
-	void Sort();
+	//void Sort();
 
 	inline bool FitsInBucket(Shape *shape, size_t idx) const;
@@ -100,12 +104,14 @@
 
 	///////////
+	//-- members
 
+	// the current render state
 	RenderState *mState;
 	
 	Camera *mCamera;
-	//SceneEntityContainer mEntities;
-	int mMinSizeForSorting;
 	/// each bucket contains objects with similar materials that don't cause a hard state change
 	std::vector<RenderQueueBucket *> mBuckets;
+	/// this are the buckets that where touched until the last clear. They are sorted by distance
+	std::vector<RenderQueueBucket *> mActiveBuckets;
 
 	int mNumEntries;
