Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctree.h
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctree.h	(revision 158)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctree.h	(revision 193)
@@ -36,5 +36,7 @@
 #define OCTREE_H
 
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 #include "OgreTerrainPrerequisites.h"
+#endif
 #include <OgreAxisAlignedBox.h>
 #include <OgreWireBoundingBox.h>
@@ -58,5 +60,9 @@
 */
 
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 class _OgreTerrainExport Octree
+#else
+class Octree
+#endif // GTP_VISIBILITY_MODIFIED_OGRE
 {
 public:
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeNode.h
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeNode.h	(revision 187)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeNode.h	(revision 193)
@@ -47,6 +47,9 @@
 *
 */
-
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 class _OgreTerrainExport OctreeNode : public SceneNode
+#else
+class OctreeNode : public SceneNode
+#endif // GTP_VISIBILITY_MODIFIED_OGRE
 {
 public:
@@ -104,4 +107,6 @@
     };
 
+
+
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
 	/// scale for node visualization
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreTerrainRenderable.h
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreTerrainRenderable.h	(revision 159)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreTerrainRenderable.h	(revision 193)
@@ -231,5 +231,9 @@
         inline int getRenderLevel() const
         {
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
             return mRenderLevel[msCurrentRenderLevelIndex];
+#else
+            return mRenderLevel;
+#endif // GTP_VISIBILITY_MODIFIED_OGRE
         };
 
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeCamera.h
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeCamera.h	(revision 61)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeCamera.h	(revision 193)
@@ -59,4 +59,5 @@
 than the default.
 */
+
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
 class _OgreTerrainExport OctreeCamera : public Camera
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeSceneManager.h
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeSceneManager.h	(revision 139)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/include/OgreOctreeSceneManager.h	(revision 193)
@@ -35,5 +35,7 @@
 #define OCTREESCENEMANAGER_H
 
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 #include "OgreTerrainPrerequisites.h"
+#endif // GTP_VISIBILITY_MODIFIED_OGRE
 #include "OgreSceneManager.h"
 #include "OgreRenderOperation.h"
@@ -71,5 +73,9 @@
 */
 
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 class _OgreTerrainExport OctreeSceneManager : public SceneManager
+#else
+class OctreeSceneManager : public SceneManager
+#endif GTP_VISIBILITY_MODIFIED_OGRE
 {
     friend class OctreeIntersectionSceneQuery;
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp	(revision 160)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctree.cpp	(revision 193)
@@ -36,5 +36,4 @@
 #include <OgreOctree.h>
 #include <OgreOctreeNode.h>
-#include <OgreLogManager.h>
 
 namespace Ogre
@@ -174,7 +173,9 @@
     if(mWireBoundingBox == 0)
         mWireBoundingBox = new WireBoundingBox();
-
-	//mWireBoundingBox->setupBoundingBox(mBox);
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 	mWireBoundingBox->setupBoundingBox(mWorldAABB);
+#else
+	mWireBoundingBox->setupBoundingBox(mBox);
+#endif	
 
     return mWireBoundingBox;
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeNode.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeNode.cpp	(revision 187)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeNode.cpp	(revision 193)
@@ -38,5 +38,4 @@
 #include <OgreOctreeNode.h>
 #include <OgreOctreeSceneManager.h>
-#include <OgreLogManager.h>
 #include <OgreMeshManager.h>
 #include <OgreSubMesh.h>
@@ -157,10 +156,8 @@
         MovableObject * mo = mit->second;
 
-		//LogManager::getSingleton().logMessage("notify");
         mo->_notifyCurrentCamera(cam);
         if ( mo->isVisible() &&
             (!onlyShadowCasters || mo->getCastShadows()))
         {
-			//LogManager::getSingleton().logMessage("update queue");
             mo -> _updateRenderQueue( queue );
         }
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreTerrainRenderable.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreTerrainRenderable.cpp	(revision 159)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreTerrainRenderable.cpp	(revision 193)
@@ -67,5 +67,5 @@
     //-----------------------------------------------------------------------
     TerrainRenderable::TerrainRenderable(const String& name)
-        : mTerrain(0), mName(name),  mDeltaBuffers(0), mPositionBuffer(0)
+        : Renderable(), mTerrain(0), mName(name),  mDeltaBuffers(0), mPositionBuffer(0)
     {
         mForcedRenderLevel = -1;
@@ -220,9 +220,9 @@
                 *pSysPos++ = *pPos++ = ( float ) j * msOptions->scale.z; //z
 
-                *pTex0++ = ( float ) i / ( float ) msOptions->pageSize;
-                *pTex0++ = ( float ) ( float ) j / ( float ) msOptions->pageSize;
-
-                *pTex1++ = ( ( float ) i / ( float ) msOptions->tileSize ) * msOptions->detailTile;
-                *pTex1++ = ( ( float ) ( float ) j / ( float ) msOptions->tileSize ) * msOptions->detailTile;
+                *pTex0++ = ( float ) i / ( float ) ( msOptions->pageSize - 1 );
+                *pTex0++ = ( float ) j / ( float ) ( msOptions->pageSize - 1 );
+
+                *pTex1++ = ( ( float ) i / ( float ) ( msOptions->tileSize - 1 ) ) * msOptions->detailTile;
+                *pTex1++ = ( ( float ) j / ( float ) ( msOptions->tileSize - 1 ) ) * msOptions->detailTile;
 
                 if ( height < min )
@@ -261,6 +261,4 @@
 
         _calculateMinLevelDist2( C );
-        if (msOptions->lit)
-            _calculateNormals();
 
     }
@@ -301,4 +299,5 @@
     void TerrainRenderable::_calculateNormals()
     {
+
         Vector3 norm;
 
@@ -342,4 +341,5 @@
             return ;
         }
+
 
 		Vector3 cpos = cam -> getDerivedPosition();
@@ -381,5 +381,5 @@
             int nextLevel = mNextLevelDown[getRenderLevel()];
 #else
-			int nextLevel = mNextLevelDown;
+			int nextLevel = mNextLevelDown[mRenderLevel];
 #endif // GTP_VISIBILITY_MODIFIED_OGRE
             
@@ -393,8 +393,16 @@
                 // Set the morph such that the morph happens in the last 0.25 of
                 // the distance range
-                Real range = mMinLevelDistSqr[nextLevel] - mMinLevelDistSqr[getRenderLevel()];
+ #ifdef GTP_VISIBILITY_MODIFIED_OGRE
+Real range = mMinLevelDistSqr[nextLevel] - mMinLevelDistSqr[getRenderLevel()];
+#else
+                Real range = mMinLevelDistSqr[nextLevel] - mMinLevelDistSqr[mRenderLevel];
+#endif // GTP_VISIBILITY_MODIFIED_OGRE               
                 if (range)
                 {
-                    Real percent = (L - mMinLevelDistSqr[getRenderLevel()]) / range;
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
+Real percent = (L - mMinLevelDistSqr[getRenderLevel()]) / range;
+#else
+                    Real percent = (L - mMinLevelDistSqr[mRenderLevel]) / range;
+#endif // GTP_VISIBILITY_MODIFIED_OGRE
                     // scale result so that msLODMorphStart == 0, 1 == 1, clamp to 0 below that
                     Real rescale = 1.0f / (1.0f - msOptions->lodMorphStart);
@@ -430,4 +438,5 @@
 
         }
+
     }
     //-----------------------------------------------------------------------
@@ -668,9 +677,12 @@
             return ;
 
+
 	    if ( mLevelIndex.size() == 0 )
         {
             for ( int i = 0; i < 16; i++ )
             {
+
 				mLevelIndex.push_back( new IndexMap() );
+
             }
 
@@ -695,4 +707,5 @@
     void TerrainRenderable::_adjustRenderLevel( int i )
     {
+
 #ifdef GTP_VISIBILITY_MODIFIED_OGRE
         mRenderLevel[msCurrentRenderLevelIndex] = i;
