Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h	(revision 2839)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h	(revision 2840)
@@ -17,5 +17,6 @@
 class Geometry;
 class RenderState;
-struct RenderQueueBucket;
+class Transform3;
+
 
 /** Class representing a scene entity.
@@ -30,5 +31,5 @@
 	/** Creates a scene entity.
 	*/
-	SceneEntity(Transformation *trafo);
+	SceneEntity(Transform3 *trafo);
 
 	~SceneEntity();
@@ -47,5 +48,5 @@
 	/** Set pointer to the geometry
 	*/
-	void SetTransformation(Transformation *trafo);
+	void SetTransform(Transform3 *trafo);
 	/** Returns the transformed bounding box.
 	*/
@@ -59,15 +60,18 @@
 	/** Returns the trafo of this scene entity.
 	*/
-	inline Transformation *GetTransformation() const  { return mTransform; }
+	inline Transform3 *GetTransform() const  { return mTransform; }
+
 
 protected:
 
+	ShapeContainer *GetCurrentLOD();
+
 	/// transform matrix 
-	Transformation *mTransform;
-
+	Transform3 *mTransform;
+	/// Stores information about the LOD levels
 	LODInfoContainer mLODInfos;
-
+	/// the renderable shapes
 	ShapeContainer mShapes;
-		
+	/// when this entity was last rendered
 	int mLastRendered;
 };
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h	(revision 2823)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h	(revision 2840)
@@ -1,4 +1,4 @@
-#ifndef GEOMETRY_H
-#define GEOMETRY_H
+#ifndef __GEOMETRY_H
+#define __GEOMETRY_H
 
 #include "common.h"
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.h	(revision 2840)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.h	(revision 2840)
@@ -0,0 +1,49 @@
+#ifndef __TRANSFORM3_H
+#define __TRANSFORM3_H
+
+#include "glInterface.h"
+#include <Cg/cg.h>
+#include <Cg/cgGL.h>
+#include "common.h"
+
+namespace CHCDemoEngine 
+{
+
+class RenderState;
+class Matrix4x4;
+
+
+/** Class representing a transformation
+*/
+class Transform3
+{
+public:
+	
+	/** Creates a scene entity.
+	*/
+	Transform3(Matrix4x4 *trafo);
+
+	~Transform3();
+	/** Loads this transformation.
+	*/
+	void Load(RenderState *state);	
+	/** Unloads this transformation
+	*/
+	void Unload(RenderState *state);
+	/** Returns the trafo of this scene entity.
+	*/
+	inline Matrix4x4 *GetMatrix() const  { return mMatrix; }
+
+	static CGparameter sModelMatrixParam;
+
+
+protected:
+
+	/// transform matrix 
+	Matrix4x4 *mMatrix;
+};
+
+
+}
+
+#endif // __TRANSFORM_H
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.cpp	(revision 2839)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.cpp	(revision 2840)
@@ -1,7 +1,9 @@
-#include "glInterface.h"
 #include "Shape.h"
 #include "Material.h"
 #include "RenderState.h"
 #include "Geometry.h"
+#include "SceneEntity.h"
+
+#include "glInterface.h"
 #include <Cg/cg.h>
 #include <Cg/cgGL.h>
@@ -11,7 +13,9 @@
 {
 
-Shape::Shape(Geometry *geometry, 
-			 Material *mat):
-mGeometry(geometry), mMaterial(mat), mRenderQueueBucket(NULL)
+Shape::Shape(Geometry *geometry, Material *mat, SceneEntity *parent):
+mGeometry(geometry), 
+mMaterial(mat), 
+mParent(parent), 
+mRenderQueueBucket(NULL)
 {
 }
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.h	(revision 2806)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.h	(revision 2840)
@@ -23,5 +23,5 @@
 	    as parameters
 	*/
-	Visualization(Bvh *bvh, Camera *camera, Camera *vizCamera, RenderState *renderState);
+	Visualization(Bvh *bvh, Camera *camera, Camera *vizCamera, RenderState *state);
 
 	~Visualization();
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2839)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2840)
@@ -8,4 +8,5 @@
 #include "Matrix4x4.h"
 #include "Vector3.h"
+#include "Transform3.h"
 
 
@@ -41,5 +42,5 @@
 	str.read(reinterpret_cast<char *>(&hasTrafo), sizeof(bool));
 
-	Matrix4x4 *trafo;
+	Matrix4x4 *m;
 	
 	SceneEntity *sceneGeom;
@@ -47,13 +48,15 @@
 	if (!hasTrafo)
 	{
-		trafo = NULL;
+		m = NULL;
 	}
 	else
 	{
-		trafo = new Matrix4x4();
-		str.read(reinterpret_cast<char *>(trafo->x), sizeof(Matrix4x4));
-		mTrafos.push_back(trafo);
-	}
-
+		m = new Matrix4x4();
+		str.read(reinterpret_cast<char *>(m->x), sizeof(Matrix4x4));
+	}
+
+	Transform3 *trafo = new Transform3(m);
+	mTrafos.push_back(trafo);
+	
 	// use instancing
 	sceneGeom = new SceneEntity(trafo);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp	(revision 2839)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp	(revision 2840)
@@ -5,4 +5,5 @@
 #include "Material.h"
 #include "Camera.h"
+#include "Shape.h"
 
 
@@ -138,6 +139,8 @@
 		entity->mRenderQueueBucket = bucket;
 	}
+
+	bucket->mEntities.push_back(entity);
 #endif
-	bucket->mEntities.push_back(entity);
+
 }
 
@@ -146,5 +149,5 @@
 {
 	for (size_t i = 0; i < mBuckets.size(); ++ i)
-		mBuckets[i]->mEntities.clear();
+		mBuckets[i]->mShapes.clear();
 
 	mSize = 0;
@@ -165,9 +168,10 @@
 	for (size_t i = 0; i < mBuckets.size(); ++ i)
 	{
-		SceneEntityContainer::const_iterator sit, sit_end = mBuckets[i]->mEntities.end();
-		for (sit = mBuckets[i]->mEntities.begin(); sit != sit_end; ++ sit)
-		{
-			SceneEntity *ent = *sit;
-			ent->Render(mState);
+		ShapeContainer::const_iterator sit, sit_end = mBuckets[i]->mShapes.end();
+
+		for (sit = mBuckets[i]->mShapes.begin(); sit != sit_end; ++ sit)
+		{
+			Shape *shape = *sit;
+			shape->Render(mState);
 		}
 	}
@@ -183,15 +187,18 @@
 		Debug << "\n******\nbucket " << (int)i << endl;
 
-		SceneEntityContainer::const_iterator sit, sit_end = mBuckets[i]->mEntities.end();
-
-		for (sit = mBuckets[i]->mEntities.begin(); sit != sit_end; ++ sit)
-		{
-			SceneEntity *ent = *sit;
-	#ifdef TODO
-			Material *mat = ent->GetMaterial();
+		ShapeContainer::const_iterator sit, sit_end = mBuckets[i]->mShapes.end();
+
+		for (sit = mBuckets[i]->mShapes.begin(); sit != sit_end; ++ sit)
+		{
+			Shape *shape = *sit;
+			
+			Material *mat = shape->GetMaterial();
 			int tsize = mat->GetTexture() ? mat->GetTexture()->GetByteSize() : 0;
-			float dist = SqrMagnitude(ent->GetBoundingBox().Center() - mCamera->GetPosition());
-			Debug << "e: " << ent << " a: " << mat->IsAlphaTestEnabled() << " s: " << tsize << " d: " << dist << " " << endl;
+#ifdef TODO
+			float dist = SqrMagnitude(shape->GetBoundingBox().Center() - mCamera->GetPosition());
+#else
+			float dist = -1;
 #endif
+			Debug << "e: " << shape << " a: " << mat->IsAlphaTestEnabled() << " s: " << tsize << " d: " << dist << " " << endl;
 		}
 	}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.h	(revision 2839)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.h	(revision 2840)
@@ -50,5 +50,6 @@
 	Geometry *mGeometry;
 	Material *mMaterial;
-	
+	SceneEntity *mParent;
+
 	/// pointer to the renderqueue bucket this entity belongs to
 	RenderQueueBucket *mRenderQueueBucket;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h	(revision 2795)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h	(revision 2840)
@@ -7,6 +7,6 @@
 #include <fstream>
 #include <map>
+#include "common.h"
 
-#include "common.h"
 
 class igzstream;
@@ -21,4 +21,6 @@
 class Texture;
 class Matrix4x4;
+class Transform3;
+
 
 /** Loads a scene and also handles the cleanup
@@ -52,5 +54,5 @@
 	std::vector<Geometry *> mGeometry;
 	std::vector<SceneEntity *> mSceneEntities;
-	std::vector<Matrix4x4 *> mTrafos;
+	std::vector<Transform3 *> mTrafos;
 };
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp	(revision 2839)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp	(revision 2840)
@@ -4,4 +4,5 @@
 #include "Material.h"
 #include "RenderState.h"
+#include "Shape.h"
 #include <Cg/cg.h>
 #include <Cg/cgGL.h>
@@ -11,7 +12,5 @@
 {
 
-CGparameter SceneEntity::sModelMatrixParam;
-
-SceneEntity::SceneEntity(Matrix4x4 *trafo): mTransform(trafo)
+SceneEntity::SceneEntity(Transform3 *trafo): mTransform(trafo)
 {
 }
@@ -25,5 +24,5 @@
 ShapeContainer *SceneEntity::GetCurrentLOD()
 {
-	if (mLODInfos.empty())
+/*	if (mLODInfos->empty())
 		return &mShapes;
 
@@ -32,11 +31,13 @@
 	int i = 0;
 
-	for (int i = 0; i < mLODInfos.size(); ++ i)
+	for (int i = 0; i < mLODInfos->size(); ++ i)
 	{
-		if (mLODInfos[i].mDistance > mDistance)
-			return mShapes[i];
+		if ((mLODInfos*)[i].mDistance > mDistance)
+			return &(mLODInfos*)[i].mShapes;
 	}
 
-	return mShapes.last();
+	return &(mLODInfos->last().mShapes);
+	*/
+	return NULL;
 }
 
@@ -49,9 +50,9 @@
 	ShapeContainer *shapes;
 
-	shspes = GetCurrentLOD(mDistance);
+	shapes = GetCurrentLOD();
 
 	for (int i = 0; i < shapes->size(); ++ i)
 	{
-		(shapes*)[i]->Render(state);
+		(*shapes)[i]->Render(state);
 	}
 }
@@ -64,5 +65,5 @@
 
 
-void SceneEntity::SetTransformation(Matrix4x4 *trafo)
+void SceneEntity::SetTransform(Transform3 *trafo)
 {
 	mTransform = trafo;
@@ -86,8 +87,9 @@
 #ifdef TODO
 	AxisAlignedBox3 box = mGeometry->GetBoundingBox();
+	if (mTransform) Transform(box, *mTransform);
 #else
 	AxisAlignedBox3 box;
 #endif
-	if (mTransform) Transform(box, *mTransform);
+	
 
 	return box;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.cpp	(revision 2840)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform3.cpp	(revision 2840)
@@ -0,0 +1,53 @@
+#include "Transform3.h"
+#include "Matrix4x4.h"
+#include "RenderState.h"
+
+
+namespace CHCDemoEngine 
+{
+
+CGparameter Transform3::sModelMatrixParam;
+
+Transform3::Transform3(Matrix4x4 *trafo): mMatrix(trafo)
+{
+}
+
+
+Transform3::~Transform3()
+{
+	DEL_PTR(mMatrix);
+}
+
+
+void Transform3::Load(RenderState *state)
+{
+	if (!mMatrix) return;
+
+	if (state->GetRenderType() == RenderState::DEFERRED)
+	{
+		cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)mMatrix->x);
+	}
+	else
+	{
+		glPushMatrix();
+		glMultMatrixf((float *)mMatrix->x);
+	}
+}
+
+
+void Transform3::Unload(RenderState *state)
+{
+	if (!mMatrix) return;
+
+	if (state->GetRenderType() == RenderState::DEFERRED)
+	{
+		static Matrix4x4 identity = IdentityMatrix();
+		cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)identity.x);
+	}
+	else
+	{
+		glPopMatrix();
+	}
+}
+
+}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2838)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2840)
@@ -30,4 +30,5 @@
 #include "Environment.h"
 #include "Halton.h"
+#include "Transform3.h"
 
 
@@ -499,5 +500,5 @@
 		cgGLLoadProgram(sCgMrtVertexProgram);
 
-		SceneEntity::sModelMatrixParam = cgGetNamedParameter(sCgMrtVertexProgram, "ModelMatrix");
+		Transform3::sModelMatrixParam = cgGetNamedParameter(sCgMrtVertexProgram, "ModelMatrix");
 		sModelViewProjMatrixParam = cgGetNamedParameter(sCgMrtVertexProgram, "ModelViewProj");
 	}
@@ -1066,5 +1067,5 @@
 
 		static Matrix4x4 identity = IdentityMatrix();
-		cgGLSetMatrixParameterfc(SceneEntity::sModelMatrixParam, (const float *)identity.x);
+		cgGLSetMatrixParameterfc(Transform3::sModelMatrixParam, (const float *)identity.x);
 	}		
 }
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform.h	(revision 2839)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#ifndef __SCENEENTITY_H
-#define __SCENEENTITY_H
-
-#include "glInterface.h"
-#include <Cg/cg.h>
-#include <Cg/cgGL.h>
-#include "common.h"
-
-namespace CHCDemoEngine 
-{
-
-class RenderState;
-
-
-/** Class representing a transformation
-*/
-class Transformation
-{
-public:
-	
-	static CGparameter sModelMatrixParam;
-
-	/** Creates a scene entity.
-	*/
-	Transformation(Matrix4x4 *trafo);
-
-	~Transformation();
-	/** Loads this transformation.
-	*/
-	void Load(RenderState *state);	
-	/** Unloads this transformation
-	*/
-	void Unload(RenderState *state);
-	/** Returns the trafo of this scene entity.
-	*/
-	inline Matrix4x4 *GetMatrix() const  { return mMatrix; }
-
-protected:
-
-	/// transform matrix 
-	Matrix4x4 *mMatrix;
-};
-
-
-}
-
-#endif // __SCENEENTITY_H
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Transform.cpp	(revision 2839)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#include "Transformation.h"
-
-
-
-namespace CHCDemoEngine 
-{
-
-CGparameter Transformation::sModelMatrixParam;
-
-Transformation::Transformation(Matrix4x4 *trafo): mMatrix(trafo)
-{
-}
-
-
-Transformation::~Transformation
-{
-}
-
-
-void Transformation::Load(RenderState *state)
-{
-	if (!mMatrix) return;
-
-	if (state->GetRenderType() == RenderState::DEFERRED)
-	{
-		cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)mTransform->x);
-	}
-	else
-	{
-		glPushMatrix();
-		glMultMatrixf((float *)mTransform->x);
-	}
-}
-
-
-void Transformation::Unload(RenderState *state)
-{
-	if (!mMatrix) return;
-
-	if (state->GetRenderType() == RenderState::DEFERRED)
-	{
-		static Matrix4x4 identity = IdentityMatrix();
-		cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)identity.x);
-	}
-	else
-	{
-		glPopMatrix();
-	}
-}
-
-}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2839)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2840)
@@ -547,5 +547,5 @@
 				</File>
 				<File
-					RelativePath=".\src\Transform.h"
+					RelativePath=".\src\Transform3.h"
 					>
 				</File>
@@ -717,5 +717,5 @@
 				</File>
 				<File
-					RelativePath=".\src\Transform.cpp"
+					RelativePath=".\src\Transform3.cpp"
 					>
 				</File>
