Index: trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp	(revision 103)
+++ trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp	(revision 112)
@@ -124,3 +124,9 @@
 	return &mBox;
 }
+//-----------------------------------------------------------------------
+void SceneNodeHierarchyInterface::VisualizeCulledNode(GtpVisibility::HierarchyNode *node, 
+													  GtpVisibility::CullingType type)
+{
+	// TODO
+}
 } // namespace Ogre	
Index: trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 111)
+++ trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 112)
@@ -19,5 +19,6 @@
 mUseVisibilityCulling(true),
 mShowVisualization(false),
-mRenderNodesForViz(false)
+mRenderNodesForViz(false),
+mVisualizeCulledNodes(false)
 {
 	mHierarchyInterface = 
@@ -66,4 +67,14 @@
 		for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it)
 		{
+			MaterialPtr mp = (*it)->getMaterial();
+			
+			mp.get()->setLightingEnabled(false);
+			mp.get()->setAmbient(ColourValue(1,0,0));
+			mp.get()->setDiffuse(ColourValue(1,1,1));
+			mp.get()->setSpecular(ColourValue(1,1,1));
+			
+			mp.get()->getTechnique(0)->getPass(0)->removeAllTextureUnitStates();
+			//*mp = MaterialManager::getSingleton().getByName("BaseWhiteNoLighting");
+			//(*it)->setMaterialName("BaseWhiteNoLighting");
 			getRenderQueue()->addRenderable(*it);
 
@@ -85,5 +96,4 @@
 void VisibilityTerrainSceneManager::_renderVisibleObjects()
 {
-
 	if (!mShowVisualization)
 	{
@@ -93,7 +103,7 @@
 
 		// call initframe to reset culling manager stats
-		mVisibilityManager->GetCullingManager()->InitFrame();
-	}
-
+		mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes);
+	}
+	
 	// standard terrain scenemanager rendering without hierarchical culling
 	if (!mUseVisibilityCulling || mShowVisualization)
@@ -184,4 +194,9 @@
 	{
 		mSkyDomeEnabled = (*static_cast<const bool *>(val));
+		return true;
+	}
+	if (key == "VisualizeCulledNodes")
+	{
+		mVisualizeCulledNodes = (*static_cast<const bool *>(val));
 		return true;
 	}
Index: trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp	(revision 111)
+++ trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp	(revision 112)
@@ -87,7 +87,6 @@
 {
 	Matrix3 mat;
-	mat.FromEulerAnglesYXZ(Degree(rotation.x),//.valueRadians(), 
-						   Degree(rotation.y),//.valueRadians(), 
-						   Degree(rotation.z));//.valueRadians());
+	mat.FromEulerAnglesYXZ(Degree(rotation.x), Degree(rotation.y),
+						   Degree(rotation.z));
 
 	return GenerateSceneObject(position, Quaternion(mat), objName);
Index: trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp	(revision 111)
+++ trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp	(revision 112)
@@ -38,9 +38,12 @@
 void VisibilitySceneManager::_renderVisibleObjects()
 {
-	// two cameras (one for culling, one for rendering)
-	mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress);
+	if (!mShowVisualization)
+	{
+		// two cameras (one for culling, one for rendering)
+		mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress);
 
-	// call initframe to reset culling manager stats
-	mVisibilityManager->GetCullingManager()->InitFrame();
+		// call initframe to reset culling manager stats
+		mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes);
+	}
 
 	// standard terrain scenemanager rendering without hierarchical culling
@@ -48,7 +51,8 @@
 	{	
 		SceneManager::_renderVisibleObjects();
+	
 		return;
 	} 
-	
+
 	//-- hierarchical culling
 	// the objects of different layers (e.g., background, scene, 
Index: trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp	(revision 103)
+++ trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp	(revision 112)
@@ -142,4 +142,20 @@
 	return &mBox;
 }
+//-----------------------------------------------------------------------
+void OctreeHierarchyInterface::VisualizeCulledNode(GtpVisibility::HierarchyNode *node, 
+												   GtpVisibility::CullingType type)
+{
+	WireBoundingBox *box = static_cast<Octree *>(node)->getWireBoundingBox();
 
+	if (type == GtpVisibility::FRUSTUM_CULLED)
+	{
+		box->setMaterial("FrustumCulledNodesMaterial");
+	}
+	else // type == GtpVisibility::QUERY_CULLED
+	{
+		box->setMaterial("QueryCulledNodesMaterial");
+	}
+	static_cast<OctreeSceneManager *>(mSceneManager)->getBoxes()->push_back(box);
+	//LogManager::getSingleton().logMessage("pushing box");
+}
 } // namespace Ogre
Index: trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp	(revision 103)
+++ trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp	(revision 112)
@@ -12,6 +12,10 @@
 VisibilityOctreeSceneManager::VisibilityOctreeSceneManager(
 	GtpVisibility::VisibilityManager *visManager)
-: mVisibilityManager(visManager), mUseVisibilityCulling(true),
-mShowVisualization(false)
+: 
+mVisibilityManager(visManager), 
+mUseVisibilityCulling(true),
+mShowVisualization(false),
+mRenderNodesForViz(false),
+mVisualizeCulledNodes(false)
 {
 	mHierarchyInterface = 
@@ -37,13 +41,13 @@
 							mCullCamera ? getCamera("CullCamera") : NULL);
 
-	// call initframe to reset culling manager stats
-	mVisibilityManager->GetCullingManager()->InitFrame();
-
-	// standard terrain scenemanager rendering without hierarchical culling
-	if (!mUseVisibilityCulling || mShowVisualization)
-	{	
-		OctreeSceneManager::_renderVisibleObjects();
-		return;
-	} 
+	if (!mShowVisualization)
+	{
+		// two cameras (one for culling, one for rendering)
+		mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, 
+								mCullCamera ? getCamera("CullCamera") : NULL);
+
+		// call initframe to reset culling manager stats
+		mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes);
+	}
 	
 	//-- hierarchical culling
@@ -136,4 +140,29 @@
 		return true;
 	}
+	if (key == "RenderNodesForViz")
+	{
+		mRenderNodesForViz = (*static_cast<const bool *>(val));
+		return true;
+	}
+	if (key == "SkyBoxEnabled")
+	{
+		mSkyBoxEnabled = (*static_cast<const bool *>(val));
+		return true;
+	}
+	if (key == "SkyPlaneEnabled")
+	{
+		mSkyPlaneEnabled = (*static_cast<const bool *>(val));
+		return true;
+	}
+	if (key == "SkyDomeEnabled")
+	{
+		mSkyDomeEnabled = (*static_cast<const bool *>(val));
+		return true;
+	}
+	if (key == "VisualizeCulledNodes")
+	{
+		mVisualizeCulledNodes = (*static_cast<const bool *>(val));
+		return true;
+	}
 	return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).
 		setOption(key, val) || OctreeSceneManager::setOption(key, val);
Index: trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp	(revision 111)
+++ trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp	(revision 112)
@@ -12,4 +12,36 @@
 mCamera(NULL), mCullCamera(NULL), mOnlyShadowCasters(false)
 {
+	CreateCulledNodeMaterials();
+	
+}
+//-----------------------------------------------------------------------
+void PlatformHierarchyInterface::CreateCulledNodeMaterials()
+{
+	// material for frustum culled nodes
+	MaterialPtr mat = MaterialManager::getSingleton().getByName("FrustumCulledNodesMaterial");
+	MaterialPtr baseWhite = MaterialManager::getSingleton().getByName("BaseWhiteNoLighting");
+	if (mat.isNull())
+	{
+		mat = MaterialManager::getSingleton().create("FrustumCulledNodesMaterial", 
+			ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		//baseWhite.get()->copyDetailsTo(mat);
+		//mat->setColourWriteEnabled(true);
+		mat->setLightingEnabled(false);
+		//mat->setAmbient(ColourValue(1,0,0));
+	}
+
+	// material for query culled nodes
+	MaterialPtr mat2 = MaterialManager::getSingleton().getByName("QueryCulledNodesMaterial");
+
+	if (mat2.isNull())
+	{
+		mat2 = MaterialManager::getSingleton().create("QueryCulledNodesMaterial", 
+			ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+		//baseWhite.get()->copyDetailsTo(mat2);
+	//	mat2->setColourWriteEnabled(true);
+		mat2->setLightingEnabled(false);
+		//mat2->setAmbient(ColourValue(0,0,1));		
+	}
 }
 //-----------------------------------------------------------------------
@@ -162,6 +194,4 @@
 	// Set colour write mode off
 	mRenderSystem->_setColourBufferWriteEnabled(false, false, false, false);
-	// Set colour write mode pff
-    mRenderSystem->_setColourBufferWriteEnabled(false, false, false, false);
 }
 //-----------------------------------------------------------------------
@@ -177,5 +207,5 @@
 {
 	mOnlyShadowCasters = onlyShadowCasters;
-	mDummy = mOnlyShadowCasters ;
+	//mIsShadowPass = mOnlyShadowCasters ;
 }
 //-----------------------------------------------------------------------
