Index: /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp	(revision 2171)
+++ /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp	(revision 2176)
@@ -1838,5 +1838,5 @@
 	if (mNormalExecution)
 	{
-		// not in the normal workflow
+		// problems using this function in the normal workflow
 		return;
 	}
Index: /GTP/trunk/Lib/Vis/Preprocessing/include/Containers.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/include/Containers.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/include/Containers.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <vector>
-//using namespace std;
+//
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.h	(revision 2105)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.h	(revision 2176)
@@ -29,5 +29,5 @@
 	*/
 	IntelRayCaster(const Preprocessor &preprocessor,
-				   const string externKdTree);
+				   const std::string externKdTree);
 
 	virtual ~IntelRayCaster();
@@ -75,5 +75,5 @@
 protected:
 
-	bool InitRayCast(const string externKdTree);
+	bool InitRayCast(const std::string externKdTree);
 };
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.h	(revision 2003)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.h	(revision 2176)
@@ -5,5 +5,5 @@
 #include "Containers.h"
 #include <string>
-using namespace std;
+//
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SubdivisionCandidate.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SubdivisionCandidate.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SubdivisionCandidate.h	(revision 2176)
@@ -5,5 +5,5 @@
 #include "FlexibleHeap.h"
 
-//using namespace std;
+//
 
 namespace GtpVisibilityPreprocessor {
@@ -11,5 +11,5 @@
 class SubdivisionCandidate;
 
-typedef vector<SubdivisionCandidate *> SubdivisionCandidateContainer;
+typedef std::vector<SubdivisionCandidate *> SubdivisionCandidateContainer;
 typedef FlexibleHeap<SubdivisionCandidate *> SplitQueue;
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.h	(revision 2123)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.h	(revision 2176)
@@ -5,5 +5,5 @@
 #include "PvsDefinitions.h"
 
-using namespace std;
+//
 
 namespace GtpVisibilityPreprocessor {
@@ -25,5 +25,5 @@
 	float EvalPvsCost() const;
 
-	friend ostream &operator<<(ostream &s, const ObjectPvs &p) 
+	friend std::ostream &operator<<(std::ostream &s, const ObjectPvs &p) 
 	{
 		ObjectPvsIterator pit = p.GetIterator();
@@ -32,5 +32,5 @@
 		{		
 			Intersectable *obj = pit.Next();
-			cout << obj << " ";
+			std::cout << obj << " ";
 		}
 		
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj	(revision 2162)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj	(revision 2176)
@@ -198,5 +198,5 @@
 				OptimizeForProcessor="3"
 				OptimizeForWindowsApplication="TRUE"
-				AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;;QtInterface;..\src\sparsehash\src\;$(NOINHERIT)"
+				AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;;QtInterface;..\src\sparsehash\src\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;$(NOINHERIT)"
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG;USE_HASH_PVS"
 				ExceptionHandling="TRUE"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp	(revision 2017)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp	(revision 2176)
@@ -17,4 +17,6 @@
 #include "Triangle3.h"
 
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParser.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParser.h	(revision 2119)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParser.h	(revision 2176)
@@ -18,5 +18,5 @@
 	ObjectsParser(): Parser() {}
   
-	bool ParseObjects(const string &filename, 
+	bool ParseObjects(const std::string &filename, 
 					  ObjectContainer &pvsObjects,
 					  const ObjectContainer &preprocessorObjects);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h	(revision 2053)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h	(revision 2176)
@@ -4,5 +4,4 @@
 #include <fstream>
 #include <stack>
-using namespace std;
 
 #include "Preprocessor.h"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp	(revision 2116)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp	(revision 2176)
@@ -5,5 +5,4 @@
 #include <stdlib.h>
 #include <iostream>
-using namespace std;
 #include <xercesc/util/PlatformUtils.hpp>
 
@@ -33,4 +32,7 @@
 #include <assert.h>
 #include "Polygon3.h"
+
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.h	(revision 2123)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.h	(revision 2176)
@@ -18,5 +18,5 @@
   ViewCellsParser(): Parser() {}
   
-  bool ParseViewCellsFile(const string &filename, 
+  bool ParseViewCellsFile(const std::string &filename, 
 						  ViewCellsManager **viewCells,
 						  ObjectContainer &pvsObjects,
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h	(revision 1923)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h	(revision 2176)
@@ -93,11 +93,11 @@
 	bool Valid() const;
 	
-	friend ostream &operator<<(ostream &s, const BspNodeGeometry &a)
+	friend std::ostream &operator<<(std::ostream &s, const BspNodeGeometry &a)
 	{
 		PolygonContainer::const_iterator it, it_end = a.mPolys.end();
 
 		for (it = a.mPolys.begin(); it != it_end; ++ it)
-			s << *(*it) << endl;
-		return s << endl;
+			s << *(*it) << std::endl;
+		return s << std::endl;
 	}
 
@@ -259,7 +259,7 @@
 	}
 
-	void Print(ostream &app) const;
-
-	friend ostream &operator<<(ostream &s, const BspTreeStatistics &stat) 
+	void Print(std::ostream &app) const;
+
+	friend std::ostream &operator<<(std::ostream &s, const BspTreeStatistics &stat) 
 	{
 		stat.Print(s);
@@ -394,5 +394,5 @@
 	void SetupChildLinks(BspNode *b, BspNode *f);
 
-	friend ostream &operator<<(ostream &s, const BspInterior &A)
+	friend std::ostream &operator<<(std::ostream &s, const BspInterior &A)
 	{
 		return s << A.mPlane;
@@ -1084,5 +1084,5 @@
 
 	//int mSplits;
-	ofstream  mSubdivisionStats;
+	std::ofstream  mSubdivisionStats;
 
 	ViewCellsTree *mViewCellsTree;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <string>
-//using namespace std;
+//
 
 #include "Containers.h"
@@ -31,5 +31,5 @@
 	~SceneGraph();
 	
-	bool Export(const string filename);
+	bool Export(const std::string filename);
   
 	int CollectObjects(ObjectContainer *instances);
@@ -43,9 +43,9 @@
 	/** Exports binary version of the scene.
 	*/
-	void ExportScene(const string filename);
+	void ExportScene(const std::string filename);
 
 	/** Loads binary version of the scene.
 	*/
-	void LoadScene(const string filename);
+	void LoadScene(const std::string filename);
 
 	SceneGraphNode *GetRoot();
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RenderSimulator.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RenderSimulator.h	(revision 860)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RenderSimulator.h	(revision 2176)
@@ -44,7 +44,7 @@
 	}
 
-	void Print(ostream &app) const;
+	void Print(std::ostream &app) const;
 
-	friend ostream &operator<<(ostream &s, const SimulationStatistics &stat) 
+	friend std::ostream &operator<<(std::ostream &s, const SimulationStatistics &stat) 
 	{
 		stat.Print(s);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.h	(revision 2176)
@@ -3,8 +3,10 @@
 
 #include <iostream>
-//using namespace std;
+//
 #include <math.h>
 #include "common.h"
 
+//using std::ostream;
+//using std::istream;
 
 namespace GtpVisibilityPreprocessor {
@@ -14,6 +16,5 @@
 class Vector2;
 
-
-// HACK of returning vector components as array fields.
+// HACK of returning std::vector components as array fields.
 // NOT guarrantied to work with some strange variable allignment !
 #define __VECTOR_HACK
@@ -39,5 +40,5 @@
   Vector3(const Vector3 &v) { x = v.x; y = v.y; z = v.z; }
 
-  // Functions to get at the vector components
+  // Functions to get at the std::vector components
   float& operator[] (int inx) {
 #ifndef __VECTOR_HACK
@@ -80,8 +81,8 @@
   void SetValue(const float a) { x = y = z = a; }
   
-  // returns the axis, where the vector has the largest value
+  // returns the axis, where the std::vector has the largest value
   int DrivingAxis(void) const;
 
-  // returns the axis, where the vector has the smallest value
+  // returns the axis, where the std::vector has the smallest value
   int TinyAxis(void) const;
 
@@ -95,8 +96,8 @@
    }
 
-  // normalizes the vector of unit size corresponding to given vector
+  // normalizes the std::vector of unit size corresponding to given std::vector
   inline void Normalize();
   
-  /** Returns false if this vector has a nan component.
+  /** Returns false if this std::vector has a nan component.
   */
   bool CheckValidity() const;
@@ -109,9 +110,9 @@
      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 vector and is much faster than to use
+     non-degenareted std::vector and is much faster than to use
      TangentVectors.
 
-     @param v(in) The vector we want to find normal for.
-     @return The normal vector to v.
+     @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); 
@@ -140,10 +141,10 @@
   void RightHandedBase(Vector3& U, Vector3& V) const;
 
-  /// Transforms a vector to the global coordinate frame.
+  /// Transforms a std::vector to the global coordinate frame.
   /**
     Given a local coordinate frame (U,V,N) (i.e. U,V,N are 
     the x,y,z axes of the local coordinate system) and
-    a vector 'loc' in the local coordiante system, this
-    function returns a the coordinates of the same vector
+    a std::vector 'loc' in the local coordiante system, this
+    function returns a the coordinates of the same std::vector
     in global frame (i.e. frame (1,0,0), (0,1,0), (0,0,1).
   */
@@ -153,10 +154,10 @@
 	  const Vector3& N);
   
-  /// Transforms a vector to a local coordinate frame.
+  /// Transforms a std::vector to a local coordinate frame.
   /**
     Given a local coordinate frame (U,V,N) (i.e. U,V,N are 
     the x,y,z axes of the local coordinate system) and
-    a vector 'loc' in the global coordiante system, this
-    function returns a the coordinates of the same vector
+    a std::vector 'loc' in the global coordiante system, this
+    function returns a the coordinates of the same std::vector
     in the local frame.
   */
@@ -166,7 +167,7 @@
 	  const Vector3& N);
 
-  /// the magnitude=size of the vector
+  /// the magnitude=size of the std::vector
   friend inline float Magnitude(const Vector3 &v);
-  /// the squared magnitude of the vector .. for efficiency in some cases
+  /// the squared magnitude of the std::vector .. for efficiency in some cases
   friend inline float SqrMagnitude(const Vector3 &v);
   /// Magnitude(v1-v2)
@@ -175,12 +176,12 @@
   friend inline float SqrDistance(const Vector3 &v1, const Vector3 &v2);
 
-  // creates the vector of unit size corresponding to given vector
+  // creates the std::vector of unit size corresponding to given std::vector
   friend inline Vector3 Normalize(const Vector3 &A);
 
-  // Rotate a normal vector.
+  // Rotate a normal std::vector.
   friend Vector3 PlaneRotate(const Matrix4x4 &, const Vector3 &);
 
   // construct view vectors .. DirAt is the main viewing direction
-  // Viewer is the coordinates of viewer location, UpL is the vector.
+  // Viewer is the coordinates of viewer location, UpL is the std::vector.
   friend void ViewVectors(const Vector3 &DirAt, const Vector3 &Viewer,
 						  const Vector3 &UpL, Vector3 &ViewV,
@@ -224,6 +225,6 @@
   friend inline Vector3 CrossProd (const Vector3 &A, const Vector3 &B);
 
-  friend ostream& operator<< (ostream &s, const Vector3 &A);
-  friend istream& operator>> (istream &s, Vector3 &A);
+  friend std::ostream& operator<< (std::ostream &s, const Vector3 &A);
+  friend std::istream& operator>> (std::istream &s, Vector3 &A);
     
   friend void Minimize(Vector3 &min, const Vector3 &candidate);
@@ -477,6 +478,6 @@
 
 // Overload << operator for C++-style output
-inline ostream&
-operator<< (ostream &s, const Vector3 &A)
+inline std::ostream&
+operator<< (std::ostream &s, const Vector3 &A)
 {
   return s << "(" << A.x << ", " << A.y << ", " << A.z << ")";
@@ -484,6 +485,6 @@
 
 // Overload >> operator for C++-style input
-inline istream&
-operator>> (istream &s, Vector3 &A)
+inline std::istream&
+operator>> (std::istream &s, Vector3 &A)
 {
   char a;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Halton.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Halton.h	(revision 2105)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Halton.h	(revision 2176)
@@ -3,5 +3,4 @@
 
 #include <iostream>
-using namespace std;
 
 namespace GtpVisibilityPreprocessor {
@@ -198,5 +197,5 @@
 	}
 	else {
-	  cerr<<"Error generating Halton sequence."<<endl;
+	  std::cerr<<"Error generating Halton sequence."<<std::endl;
 	  exit(1);
 	}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 2176)
@@ -7,5 +7,5 @@
 #include "Containers.h"
 #include "ViewCell.h"
-//#include "ootl_map.hpp"
+
 
 namespace GtpVisibilityPreprocessor {
@@ -183,5 +183,5 @@
 	/** Prints out statistics of the view cells.
 	*/
-	virtual void PrintStatistics(ostream &s) const;
+	virtual void PrintStatistics(std::ostream &s) const;
 
 	/** Post processes view cells givemŽa number of rays.
@@ -297,5 +297,5 @@
 	ViewCell *GetViewCell(const int idx) const {return mViewCells[idx];}
 
-	virtual void PrintPvsStatistics(ostream &s);
+	virtual void PrintPvsStatistics(std::ostream &s);
 
 	/** Updates pvs of the view cell hierarchy if necessary.
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.cpp	(revision 2123)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectPvs.cpp	(revision 2176)
@@ -8,4 +8,5 @@
 #include "BvHierarchy.h"
 
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.h	(revision 2105)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.h	(revision 2176)
@@ -72,8 +72,8 @@
   Intersection sourceObject;
   
-  vector<Intersection> intersections;
- // vector<BspIntersection> bspIntersections;
-  vector<KdLeaf *> kdLeaves;
-  vector<Intersectable *> testedObjects;
+  std::vector<Intersection> intersections;
+ // std::vector<BspIntersection> bspIntersections;
+  std::vector<KdLeaf *> kdLeaves;
+  std::vector<Intersectable *> testedObjects;
 
   // various flags
@@ -244,5 +244,5 @@
 
 private:
-  Vector3 loc, dir;		// Describes ray origin and vector
+  Vector3 loc, dir;		// Describes ray origin and std::vector
   
   // The inverted direction of the ray components. It is computed optionally
@@ -284,5 +284,5 @@
   friend int MakeIntersectLine(const Plane3 &p, const Plane3 &q, Ray &ray);
 
-	friend ostream &operator<<(ostream &s, const Ray &r) {
+	friend std::ostream &operator<<(std::ostream &s, const Ray &r) {
 		return s<<"Ray:loc="<<r.loc<<" dir="<<r.dir;
 	}
@@ -311,5 +311,5 @@
   int GetEntryIndex(const Vector3 &direction) const;
 
-  friend ostream &operator<<(ostream &s, const PassingRaySet &set);
+  friend std::ostream &operator<<(std::ostream &s, const PassingRaySet &set);
 
 };
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h	(revision 2164)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h	(revision 2176)
@@ -7,5 +7,5 @@
 #include "VssRay.h"
 
-using namespace std;
+//
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ObjExporter.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ObjExporter.cpp	(revision 1694)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ObjExporter.cpp	(revision 2176)
@@ -4,4 +4,6 @@
 #include "ObjExporter.h"
 
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RenderSampler.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RenderSampler.h	(revision 871)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RenderSampler.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <fstream>
-using namespace std;
+//
 
 #include "Preprocessor.h"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Beam.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Beam.h	(revision 863)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Beam.h	(revision 2176)
@@ -6,5 +6,4 @@
 #include "Statistics.h"
 
-using namespace std;
 
 namespace GtpVisibilityPreprocessor {
@@ -47,7 +46,7 @@
 	}
 
-	void Print(ostream &app) const;
+	void Print(std::ostream &app) const;
 
-	friend ostream &operator<<(ostream &s, const BeamSampleStatistics &stat) 
+	friend std::ostream &operator<<(std::ostream &s, const BeamSampleStatistics &stat) 
 	{
 		stat.Print(s);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h	(revision 2124)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h	(revision 2176)
@@ -4,5 +4,4 @@
 #include <string>
 #include <vector>
-using namespace std;
 
 
@@ -39,5 +38,5 @@
 {
 protected:
-  string mFilename;
+  std::string mFilename;
   bool mWireframe;
   bool mUseForcedMaterial;
@@ -48,5 +47,6 @@
 public:
   
-  Exporter(const string filename):mFilename(filename),
+  Exporter(const std::string filename): 
+				  mFilename(filename),
 				  mWireframe(false),
 				  mUseForcedMaterial(false),
@@ -154,5 +154,5 @@
     
   static Exporter *
-  GetExporter(const string filename);
+  GetExporter(const std::string filename);
 
   virtual void ExportViewpoint(const Vector3 &point, const Vector3 &direction) = 0;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RenderSimulator.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RenderSimulator.cpp	(revision 1020)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RenderSimulator.cpp	(revision 2176)
@@ -6,4 +6,6 @@
 #include "ViewCellsManager.h"
 
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp	(revision 1958)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp	(revision 2176)
@@ -6,4 +6,6 @@
 #include "Intersectable.h"
 
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/HashPvs.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/HashPvs.h	(revision 2164)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/HashPvs.h	(revision 2176)
@@ -2,6 +2,5 @@
 #define __HASHPVS_H
 
-
-#include <hash_set>
+//#include <hash_set>
 #include "common.h"
 #include <math.h>
@@ -11,6 +10,4 @@
 
 
-using namespace std;
-
 namespace GtpVisibilityPreprocessor {
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.cpp	(revision 2066)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.cpp	(revision 2176)
@@ -1,3 +1,5 @@
 #include "Intersectable.h"
+
+using namespace std;
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.cpp	(revision 1883)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.cpp	(revision 2176)
@@ -2,4 +2,6 @@
 #include "Plane3.h"
 #include "VssRay.h"
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj	(revision 2176)
@@ -221,5 +221,5 @@
 				OptimizeForProcessor="3"
 				OptimizeForWindowsApplication="TRUE"
-				AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(CG_INC_PATH)&quot;;Timer;..\src\ootl\src\;..\src\ootl\src\cpp;..\src\ootl\src\include\ootl\sandbox;..\src\ootl\src;..\src\ootl\src\include\ootl;..\src\sparsehash\src\google\sparsehash;..\src\sparsehash\src\windows;..\src\sparsehash\src\google;..\src\sparsehash\src;..\src\ootl\;..\src\ootl\src\cpp\include\;..\src\ootl\src\cpp\include\ootl\mswin"
+				AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(CG_INC_PATH)&quot;;Timer;..\src\sparsehash\src\google\sparsehash;..\src\sparsehash\src\windows;..\src\sparsehash\src\google;..\src\sparsehash\src;..\src\ootl\;..\src\ootl\src\;..\src\ootl\src\cpp;..\src\ootl\src\cpp\include\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;..\src\ootl\src\cpp\include\ootl\mswin"
 				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_HASH_PVS"
 				ExceptionHandling="TRUE"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.h	(revision 1692)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <vector>
-using namespace std;
+
 
 namespace GtpVisibilityPreprocessor {
@@ -13,5 +13,5 @@
 
 
-typedef vector<RayInfo> RayInfoContainer;
+typedef std::vector<RayInfo> RayInfoContainer;
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h	(revision 2130)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h	(revision 2176)
@@ -102,7 +102,7 @@
 	}
 
-	void Print(ostream &app) const;
-
-	friend ostream &operator<<(ostream &s, const HierarchyStatistics &stat) 
+	void Print(std::ostream &app) const;
+
+	friend std::ostream &operator<<(std::ostream &s, const HierarchyStatistics &stat) 
 	{
 		stat.Print(s);
@@ -154,7 +154,7 @@
 
 
-	void Print(ostream &app) const;
-
-	friend ostream &operator<<(ostream &s, const HierarchySubdivisionStats &stat)
+	void Print(std::ostream &app) const;
+
+	friend std::ostream &operator<<(std::ostream &s, const HierarchySubdivisionStats &stat)
 	{
 		stat.Print(s);
@@ -251,5 +251,5 @@
 	/** Print out statistics.
 	*/
-	void PrintHierarchyStatistics(ostream &stream) const;
+	void PrintHierarchyStatistics(std::ostream &stream) const;
 
 	/** Returns the view space partition tree.
@@ -279,5 +279,5 @@
 	void ExportBoundingBoxes(OUT_STREAM &stream, const ObjectContainer &objects);
 
-	friend ostream &operator<<(ostream &s, const HierarchyManager &hm) 
+	friend std::ostream &operator<<(std::ostream &s, const HierarchyManager &hm) 
 	{
 		hm.PrintHierarchyStatistics(s);
@@ -291,7 +291,7 @@
 	void EvaluateSubdivision(const VssRayContainer &sampleRays,											 
 							 const ObjectContainer &objects,
-							 const string &filename);
-
-	void EvaluateSubdivision2(ofstream &splitsStats,
+							 const std::string &filename);
+
+	void EvaluateSubdivision2(std::ofstream &splitsStats,
 							  const int splitsStepSize,
 							  const bool useFilter,
@@ -532,5 +532,5 @@
 	///////////////////////////
 
-	void ExportStats(ofstream &stats, 
+	void ExportStats(std::ofstream &stats, 
 					 SplitQueue &tQueue, 
 					 const ObjectContainer &objects);
@@ -644,5 +644,5 @@
 	//int mMinRenderCostDecrease;
 
-	ofstream mSubdivisionStats;
+	std::ofstream mSubdivisionStats;
 
 	/// if the queue should be repaired after a subdivision steps
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.h	(revision 1779)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.h	(revision 2176)
@@ -129,7 +129,7 @@
 
 
-	void Print(ostream &app) const;
-
-	friend ostream &operator<<(ostream &s, const OspTreeStatistics &stat) 
+	void Print(std::ostream &app) const;
+
+	friend std::ostream &operator<<(std::ostream &s, const OspTreeStatistics &stat) 
 	{
 		stat.Print(s);
@@ -830,5 +830,5 @@
 	float mEpsilon;
 	/// subdivision stats output file
-	ofstream  mSubdivisionStats;
+	std::ofstream  mSubdivisionStats;
 	/// keeps track of cost during subdivision
 	float mTotalCost;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PlyParser.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PlyParser.h	(revision 1379)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PlyParser.h	(revision 2176)
@@ -14,13 +14,13 @@
   PlyParser():Parser() {}
   
-  bool ParseFile(const string filename,
+  bool ParseFile(const std::string filename,
 				 SceneGraphNode *root,
 				 const bool loadMeshes = true,
-				 vector<FaceParentInfo> *parents = NULL);
+				 std::vector<FaceParentInfo> *parents = NULL);
 
-  bool ParseFile(const string filename, ViewCellsManager &viewCells) { return false; }
+  bool ParseFile(const std::string filename, ViewCellsManager &viewCells) { return false; }
 
   bool
-  ParseSingleFile(const string filename,
+  ParseSingleFile(const std::string filename,
 				  SceneGraphNode *root);
 	
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp	(revision 2124)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp	(revision 2176)
@@ -15,4 +15,7 @@
 #include "Beam.h"
 
+
+using namespace std;
+
 namespace GtpVisibilityPreprocessor {
 
@@ -101,5 +104,5 @@
 	result = ExportRays(*ri, color);
 	if (!result) {
-	  cerr<<"Error while exporting rays!\n";
+	  std::cerr<<"Error while exporting rays!\n";
 	  break;
 	}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 2115)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <string>
-using namespace std;
+//
 #include "Containers.h"
 #include "Mesh.h"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h	(revision 2170)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h	(revision 2176)
@@ -132,7 +132,7 @@
 	}
 
-	void Print(ostream &app) const;
-
-	friend ostream &operator<<(ostream &s, const VspTreeStatistics &stat) 
+	void Print(std::ostream &app) const;
+
+	friend std::ostream &operator<<(std::ostream &s, const VspTreeStatistics &stat) 
 	{
 		stat.Print(s);
@@ -278,5 +278,5 @@
 	void SetupChildLinks(VspNode *front, VspNode *back);
 
-	friend ostream &operator<<(ostream &s, const VspInterior &A)
+	friend std::ostream &operator<<(std::ostream &s, const VspInterior &A)
 	{
 		return s << A.mPlane.mAxis << " " << A.mPlane.mPosition;
@@ -1077,4 +1077,6 @@
 	int CompressObjects(VspLeaf *leaf);
 
+	void TraverseRayPacket();
+
 protected:
 
@@ -1159,5 +1161,5 @@
 
 	/// subdivision stats output file
-	ofstream  mSubdivisionStats;
+	std::ofstream mSubdivisionStats;
 	/// keeps track of cost during subdivision
 	float mTotalCost;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.h	(revision 1933)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.h	(revision 2176)
@@ -32,6 +32,6 @@
 	int CastRay(const Ray &ray, float &t, const float nearestT, Vector3 &normal) const;
 
-	friend ostream& operator<< (ostream &s, const Triangle3 &A);
-	friend istream& operator>> (istream &s, Triangle3 &A);
+	friend std::ostream& operator<< (std::ostream &s, const Triangle3 &A);
+	friend std::istream& operator>> (std::istream &s, Triangle3 &A);
 
 	/** Checks if this triangle is ill-defined.
@@ -56,6 +56,6 @@
 
 // Overload << operator for C++-style output
-inline ostream&
-operator<< (ostream &s, const Triangle3 &A)
+inline std::ostream&
+operator<< (std::ostream &s, const Triangle3 &A)
 {
   return s << "(" << A.mVertices[0] << ", " << A.mVertices[1] << ", " << A.mVertices[2] << ")";
@@ -63,6 +63,6 @@
 
 // Overload >> operator for C++-style input
-inline istream&
-operator>> (istream &s, Triangle3 &A)
+inline std::istream&
+operator>> (std::istream &s, Triangle3 &A)
 {
   char a;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <vector>
-//using namespace std;
+//
 
 #include "common.h"
@@ -280,5 +280,5 @@
    
   // container for the distributions
-  vector<SamplingStrategy *> mDistributions;
+	std::vector<SamplingStrategy *> mDistributions;
   
   MixtureDistribution(Preprocessor &preprocessor):
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.cpp	(revision 1149)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.cpp	(revision 2176)
@@ -3,4 +3,6 @@
 #include "VssRay.h"
 #include "Plane3.h"
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Containers.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Containers.h	(revision 2116)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Containers.h	(revision 2176)
@@ -6,5 +6,5 @@
 #include <map>
 
-using namespace std;
+using std::vector;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorFactory.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorFactory.h	(revision 1486)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorFactory.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <string>
-using namespace std;
+//
 
 namespace GtpVisibilityPreprocessor {
@@ -18,5 +18,5 @@
 		does not exist.
 	*/
-	static Preprocessor *CreatePreprocessor(const string &preprocessorName);
+	static Preprocessor *CreatePreprocessor(const std::string &preprocessorName);
 
 protected:
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.h	(revision 2002)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <fstream>
-using namespace std;
+//
 
 #include "Preprocessor.h"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <fstream>
-//using namespace std;
+//
 
 #include "Preprocessor.h"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2170)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2176)
@@ -24,5 +24,4 @@
 #include "SamplingStrategy.h"
 #include "SceneGraph.h"
-
 #include "PerfTimer.h"
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParserXerces.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParserXerces.h	(revision 1379)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParserXerces.h	(revision 2176)
@@ -36,5 +36,5 @@
 	};
 
-	typedef map<string, int, ltstr> ResourceDefinitions;
+	typedef std::map<std::string, int, ltstr> ResourceDefinitions;
 
   // -----------------------------------------------------------------------
@@ -90,5 +90,5 @@
   bool mLoadMeshes;
 
-  typedef stack<Matrix4x4> TrafoStack;
+  typedef std::stack<Matrix4x4> TrafoStack;
 
   bool mUsingMeshDefinition;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/common.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/common.h	(revision 2123)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/common.h	(revision 2176)
@@ -20,6 +20,4 @@
 #include <fstream>
 #include <limits.h>
-
-using namespace std;
 
 
@@ -253,5 +251,5 @@
 // This routine is located in main.cpp, for lack of a better place.
 // -------------------------------------------------------------------
-void indent(ostream &app, int ind);
+void indent(std::ostream &app, int ind);
 
 // ---------------------------------------------------------
@@ -335,6 +333,6 @@
 
 // manipulator
-inline ostream &DEBUGINFO( ostream &s ) {
-  return s<<"FILE "<<__FILE__<<",LINE "<<__LINE__<<endl;
+inline std::ostream &DEBUGINFO( std::ostream &s ) {
+  return s<<"FILE "<<__FILE__<<",LINE "<<__LINE__<<std::endl;
 }
 
@@ -492,5 +490,5 @@
   
 // debug stream
-extern ofstream Debug;
+extern std::ofstream Debug;
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/BitVectorPvs.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/BitVectorPvs.h	(revision 2117)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/BitVectorPvs.h	(revision 2176)
@@ -6,5 +6,4 @@
 #include "PvsBase.h"
 
-using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h	(revision 1667)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.h	(revision 2176)
@@ -863,5 +863,5 @@
 
 	/// subdivision stats output file
-	ofstream mSubdivisionStats;
+	std::ofstream mSubdivisionStats;
 	float mTotalCost;
 	int mTotalPvsSize;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Beam.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Beam.cpp	(revision 863)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Beam.cpp	(revision 2176)
@@ -131,5 +131,5 @@
 
 
-void BeamSampleStatistics::Print(ostream &app) const
+void BeamSampleStatistics::Print(std::ostream &app) const
 {
   app << "===== Beam sample statistics ===============\n";
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp	(revision 2124)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp	(revision 2176)
@@ -9,4 +9,6 @@
 #include "TraversalTree.h"
 
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Matrix4x4.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Matrix4x4.h	(revision 1001)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Matrix4x4.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <iostream>
-using namespace std;
+//
 
 namespace GtpVisibilityPreprocessor {
@@ -100,5 +100,5 @@
 
   // Overloaded output operator.
-  friend ostream& operator<< (ostream &s, const Matrix4x4 &M);
+  friend std::ostream& operator<< (std::ostream &s, const Matrix4x4 &M);
 };
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SimpleRay.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SimpleRay.h	(revision 2116)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SimpleRay.h	(revision 2176)
@@ -74,5 +74,5 @@
   }
 
-  friend ostream &operator<<(ostream &s, const SimpleRay &r)
+  friend std::ostream &operator<<(std::ostream &s, const SimpleRay &r)
   {
 	  return s << "origin=" << r.mOrigin << " dir=" << r.mDirection;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h	(revision 2124)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h	(revision 2176)
@@ -137,7 +137,7 @@
 	int maxRayContriNodes;
 
-	void Print(ostream &app) const;
-
-	friend ostream &operator<<(ostream &s, const BvhStatistics &stat) 
+	void Print(std::ostream &app) const;
+
+	friend std::ostream &operator<<(std::ostream &s, const BvhStatistics &stat) 
 	{
 		stat.Print(s);
@@ -241,5 +241,5 @@
 	}
 
-	ostream &Describe(ostream &s) { return s; }
+	std::ostream &Describe(std::ostream &s) { return s; }
 
 	///////////////////////////////////
@@ -283,5 +283,5 @@
 	void SetupChildLinks(BvhNode *front, BvhNode *back);
 
-	friend ostream &operator<<(ostream &s, const BvhInterior &A)
+	friend std::ostream &operator<<(std::ostream &s, const BvhInterior &A)
 	{
 		return s << A.mBoundingBox;
@@ -1000,5 +1000,5 @@
 	bool mStoreRays;
 	// subdivision stats output file
-	ofstream  mSubdivisionStats;
+	std::ofstream  mSubdivisionStats;
 	/// keeps track of cost during subdivision
 	float mTotalCost;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h	(revision 2117)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h	(revision 2176)
@@ -8,5 +8,5 @@
 
 
-using namespace std;
+//
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.h	(revision 2116)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.h	(revision 2176)
@@ -170,6 +170,6 @@
 
 // Overload << operator for C++-style output
-inline ostream&
-operator<< (ostream &s, const Polygon3 &A)
+inline std::ostream&
+operator<< (std::ostream &s, const Polygon3 &A)
 {
 	VertexContainer::const_iterator it;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.h	(revision 1926)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <vector>
-using namespace std;
+//
 namespace GtpVisibilityPreprocessor 
 {
@@ -15,5 +15,5 @@
 {
 public:
-	static vector<PreprocessorThread *> sThreads;
+	static std::vector<PreprocessorThread *> sThreads;
 
 	PreprocessorThread(Preprocessor *p);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/TraversalTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/TraversalTree.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/TraversalTree.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <functional>
-//using namespace std;
+//
 
 #include "Containers.h"
@@ -87,7 +87,7 @@
   }
 
-  void Print(ostream &app) const;
-
-  friend ostream &operator<<(ostream &s, const TraversalTreeStatistics &stat) 
+  void Print(std::ostream &app) const;
+
+  friend std::ostream &operator<<(std::ostream &s, const TraversalTreeStatistics &stat) 
   {
 	  stat.Print(s);
@@ -266,5 +266,5 @@
 		// comparator for the 
 		struct less_priority: public 
-				binary_function<const TraversalData, const TraversalData, bool> 
+				std::binary_function<const TraversalData, const TraversalData, bool> 
 		{
 			bool operator()(const TraversalData a, const TraversalData b) 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h	(revision 2124)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h	(revision 2176)
@@ -255,5 +255,5 @@
   // Writes a brief description of the object, indenting by the given
   // number of spaces first.
-  virtual void Describe(ostream& app, int ind) const;
+  virtual void Describe(std::ostream& app, int ind) const;
 
   // For edge .. number <0..11> returns two incident vertices
@@ -434,6 +434,6 @@
 
   // input and output operator with stream
-  friend ostream& operator<<(ostream &s, const AxisAlignedBox3 &A);
-  friend istream& operator>>(istream &s, AxisAlignedBox3 &A);
+  friend std::ostream& operator<<(std::ostream &s, const AxisAlignedBox3 &A);
+  friend std::istream& operator>>(std::istream &s, AxisAlignedBox3 &A);
 
 protected:
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp	(revision 1627)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp	(revision 2176)
@@ -3,5 +3,4 @@
 #include <list>
 #include <map>
-using namespace std;
 
 #include "Vector3.h"
@@ -17,4 +16,5 @@
 #include "Polygon3.h"
 
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.h	(revision 1900)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.h	(revision 2176)
@@ -116,7 +116,7 @@
   
   void
-  Print(ostream &app) const;
-
-  friend ostream &operator<<(ostream &s, const RssStatistics &stat) {
+  Print(std::ostream &app) const;
+
+  friend std::ostream &operator<<(std::ostream &s, const RssStatistics &stat) {
     stat.Print(s);
     return s;
@@ -330,5 +330,5 @@
   bool IsLeaf() const { return axis == -1; }
   
-  virtual void Print(ostream &s) const = 0;
+  virtual void Print(std::ostream &s) const = 0;
 
   virtual int GetAccessTime() {
@@ -399,5 +399,5 @@
   }
   
-  virtual void Print(ostream &s) const {
+  virtual void Print(std::ostream &s) const {
     if (axis == 0)
       s<<"x ";
@@ -454,8 +454,8 @@
   virtual int Type() const  { return ELeaf; }
 
-  virtual void Print(ostream &s) const {
+  virtual void Print(std::ostream &s) const {
     s<<
 	  "L: rays="<<(int)rays.size()<<
-	  " pvs="<<mPvsSize<<" importance="<<mImportance<<endl;
+	  " pvs="<<mPvsSize<<" importance="<<mImportance<<std::endl;
   };
   
@@ -515,5 +515,5 @@
   // comparator for the 
   struct less_contribution : public
-  binary_function<const RssTreeLeaf *, const RssTreeLeaf *, bool> {
+  std::binary_function<const RssTreeLeaf *, const RssTreeLeaf *, bool> {
 	
 	bool operator()(const RssTreeLeaf * a, const RssTreeLeaf *b) {
@@ -523,5 +523,5 @@
   
   struct greater_contribution : public
-  binary_function<const RssTreeLeaf *, const RssTreeLeaf *, bool> {
+  std::binary_function<const RssTreeLeaf *, const RssTreeLeaf *, bool> {
 	
 	bool operator()(const RssTreeLeaf * a, const RssTreeLeaf *b) {
@@ -570,5 +570,5 @@
     // comparator for the 
     struct less_priority : public
-    binary_function<const TraversalData, const TraversalData, bool> {
+    std::binary_function<const TraversalData, const TraversalData, bool> {
 			
       bool operator()(const TraversalData a, const TraversalData b) {
@@ -956,5 +956,5 @@
   TraverseInternalNode(
 					   RayTraversalData &data,
-					   stack<RayTraversalData> &tstack);
+					   std::stack<RayTraversalData> &tstack);
 
   void
@@ -1094,11 +1094,11 @@
 
   void
-  PushRoots(priority_queue<TraversalData> &stack) const;
-
-  void
-  PushRoots(stack<RssTreeNode *> &st) const;
-
-  void
-  PushRoots(stack<RayTraversalData> &st, RssTreeNode::RayInfo &info) const;
+  PushRoots(std::priority_queue<TraversalData> &stack) const;
+
+  void
+  PushRoots(std::stack<RssTreeNode *> &st) const;
+
+  void
+  PushRoots(std::stack<RayTraversalData> &st, RssTreeNode::RayInfo &info) const;
 
   void
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Camera.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Camera.h	(revision 1583)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Camera.h	(revision 2176)
@@ -67,5 +67,5 @@
   
   bool
-  SnapImage(string filename,
+	  SnapImage(std::string filename,
 			KdTree *tree,
 			SceneGraph *sceneGraph
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.h	(revision 2105)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.h	(revision 2176)
@@ -99,7 +99,7 @@
   
   void
-  Print(ostream &app) const;
-
-  friend ostream &operator<<(ostream &s, const VssStatistics &stat) {
+  Print(std::ostream &app) const;
+
+  friend std::ostream &operator<<(std::ostream &s, const VssStatistics &stat) {
     stat.Print(s);
     return s;
@@ -303,5 +303,5 @@
   bool IsLeaf() const { return axis == -1; }
   
-  virtual void Print(ostream &s) const = 0;
+  virtual void Print(std::ostream &s) const = 0;
 
   virtual int GetAccessTime() {
@@ -369,5 +369,5 @@
   }
   
-  virtual void Print(ostream &s) const {
+  virtual void Print(std::ostream &s) const {
     if (axis == 0)
       s<<"x ";
@@ -422,6 +422,6 @@
   virtual int Type() const  { return ELeaf; }
 
-  virtual void Print(ostream &s) const {
-    s<<endl<<"L: r="<<(int)rays.size()<<endl;
+  virtual void Print(std::ostream &s) const {
+    s<<std::endl<<"L: r="<<(int)rays.size()<<std::endl;
   };
   
@@ -478,5 +478,5 @@
   // comparator for the 
   struct less_contribution : public
-  binary_function<const VssTreeLeaf *, const VssTreeLeaf *, bool> {
+  std::binary_function<const VssTreeLeaf *, const VssTreeLeaf *, bool> {
 	
 	bool operator()(const VssTreeLeaf * a, const VssTreeLeaf *b) {
@@ -486,5 +486,5 @@
   
   struct greater_contribution : public
-  binary_function<const VssTreeLeaf *, const VssTreeLeaf *, bool> {
+  std::binary_function<const VssTreeLeaf *, const VssTreeLeaf *, bool> {
 	
 	bool operator()(const VssTreeLeaf * a, const VssTreeLeaf *b) {
@@ -532,5 +532,5 @@
     // comparator for the 
     struct less_priority : public
-    binary_function<const TraversalData, const TraversalData, bool> {
+    std::binary_function<const TraversalData, const TraversalData, bool> {
 			
       bool operator()(const TraversalData a, const TraversalData b) {
@@ -866,5 +866,5 @@
   TraverseInternalNode(
 					   RayTraversalData &data,
-					   stack<RayTraversalData> &tstack);
+					   std::stack<RayTraversalData> &tstack);
 
   void
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h	(revision 1763)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <vector>
-using namespace std;
+//
 #include "Intersectable.h"
 #include "Plane3.h"
@@ -56,5 +56,5 @@
 
 /// default vertex container for Mesh
-typedef vector<Vector3> VertexContainer;
+typedef std::vector<Vector3> VertexContainer;
 
 /// default patch container for Mesh
@@ -164,5 +164,5 @@
   CastRayToSelectedFaces(
 						 Ray &ray,
-						 const vector<int> &faces,
+						 const std::vector<int> &faces,
 						 Intersectable *instance
 						 );
@@ -213,7 +213,7 @@
   bool CheckMesh() const;
 
-  void Print(ostream &app) const;
-
-  virtual ostream &Describe(ostream &s) const {
+  void Print(std::ostream &app) const;
+
+  virtual std::ostream &Describe(std::ostream &s) const {
 	return s<<"Mesh #vertices="<<(int)mVertices.size()<<" #faces="<<(int)mFaces.size();
   }
@@ -224,5 +224,5 @@
   friend Mesh *CreateMeshFromBox(const AxisAlignedBox3 &box);
 
-  friend ostream& operator<< (ostream &s, const Vector3 &A);
+  friend std::ostream& operator<< (std::ostream &s, const Vector3 &A);
 
 protected:
@@ -234,6 +234,6 @@
 
 // Overload << operator for C++-style output
-inline ostream&
-operator<< (ostream &s, const Mesh &A)
+inline std::ostream&
+operator<< (std::ostream &s, const Mesh &A)
 {
 	A.Print(s);
@@ -280,9 +280,9 @@
 		CastRay(
 		Ray &ray,
-		const vector<int> &faces
+		const std::vector<int> &faces
 		);
 
 
-	virtual ostream &Describe(ostream &s) {
+	virtual std::ostream &Describe(std::ostream &s) {
 		s<<"MeshInstance Id="<<GetId();
 		return mMesh->Describe(s);
@@ -323,5 +323,5 @@
   virtual int CastRay(Ray &ray);
 
-  virtual int CastRay(Ray &ray, const vector<int> &faces);
+  virtual int CastRay(Ray &ray, const std::vector<int> &faces);
 
   virtual int Type() const { return TRANSFORMED_MESH_INSTANCE; }
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/gzstream.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/gzstream.h	(revision 1264)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/gzstream.h	(revision 2176)
@@ -35,5 +35,4 @@
 #include <iostream>
 #include <fstream>
-using namespace std;
 
 #ifdef GZSTREAM_NAMESPACE
@@ -50,11 +49,11 @@
 
 
-//  #define STREAMBUF std::streambuf 
-//  #define ISTREAM std::istream
-//  #define OSTREAM std::ostream
+#define STREAMBUF std::streambuf 
+#define ISTREAM std::istream
+#define OSTREAM std::ostream
 
-#define STREAMBUF streambuf 
-#define ISTREAM istream
-#define OSTREAM ostream
+//#define STREAMBUF streambuf 
+//#define ISTREAM istream
+//#define OSTREAM ostream
 
 class gzstreambuf : public STREAMBUF {
@@ -88,5 +87,5 @@
 };
 
-class gzstreambase : virtual public ios {
+class gzstreambase : virtual public std::ios {
 
 protected:
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.h	(revision 2076)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <vector>
-using namespace std;
+//
 
 #include "common.h"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h	(revision 2176)
@@ -5,5 +5,5 @@
 #include "Containers.h"
 
-//using namespace std;
+//
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 2124)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp	(revision 2176)
@@ -10,4 +10,6 @@
 #include "IntersectableWrapper.h"
 
+
+using namespace std;
 
 // $$JB HACK
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/MutualVisibility.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/MutualVisibility.cpp	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/MutualVisibility.cpp	(revision 2176)
@@ -1,5 +1,4 @@
 #include <assert.h>
 #include <stack>
-using namespace std;
 #include "KdTree.h"
 #include "AxisAlignedBox3.h"
@@ -10,4 +9,6 @@
 #include "Triangle3.h"
 #include "SceneGraph.h"
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h	(revision 2124)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h	(revision 2176)
@@ -74,7 +74,7 @@
 	}
 
-	void Print(ostream &app) const;
-
-	friend ostream &operator<<(ostream &s, const ViewCellsStatistics &stat)
+	void Print(std::ostream &app) const;
+
+	friend std::ostream &operator<<(std::ostream &s, const ViewCellsStatistics &stat)
 	{
 		stat.Print(s);
@@ -132,7 +132,7 @@
 
 
-	void Print(ostream &app) const;
-
-	friend ostream &operator<<(ostream &s, const ViewCellsTreeStats &stat)
+	void Print(std::ostream &app) const;
+
+	friend std::ostream &operator<<(std::ostream &s, const ViewCellsTreeStats &stat)
 	{
 		stat.Print(s);
@@ -540,5 +540,5 @@
 	/** Export statistics of this view cell tree.
 	*/
-	void ExportStats(const string &mergeStats);
+	void ExportStats(const std::string &mergeStats);
 
 	/** Sets root of hierarchy.
@@ -685,5 +685,5 @@
 	/** Update stats for the log.
 	*/
-	void UpdateStats(ofstream &stats,
+	void UpdateStats(std::ofstream &stats,
 					 const ViewCellsTreeStats &vcStats);
 
@@ -723,5 +723,5 @@
 	float mMergeMaxCostRatio;
 
-	typedef priority_queue<MergeCandidate> MergeQueue;
+	typedef std::priority_queue<MergeCandidate> MergeQueue;
 
 	MergeQueue mMergeQueue;
@@ -846,7 +846,7 @@
 	}
 
-	void Print(ostream &app) const;
-
-	friend ostream &operator<<(ostream &s, const MergeStatistics &stat) 
+	void Print(std::ostream &app) const;
+
+	friend std::ostream &operator<<(std::ostream &s, const MergeStatistics &stat) 
 	{
 		stat.Print(s);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/TraversalTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/TraversalTree.cpp	(revision 2149)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/TraversalTree.cpp	(revision 2176)
@@ -9,4 +9,6 @@
 #include "Exporter.h"
 
+
+using namespace std;
 
 // $$JB HACK
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h	(revision 1932)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h	(revision 2176)
@@ -70,5 +70,5 @@
   friend SimpleRay GetPlaneIntersection(const Plane3 &plane1, const Plane3 &plane2);
 
-  friend ostream &operator<<(ostream &s, const Plane3 &p) {
+  friend std::ostream &operator<<(std::ostream &s, const Plane3 &p) {
     s<<p.mNormal<<" "<<p.mD;
     return s;
@@ -89,4 +89,5 @@
 	  {
 	  }
+
 	Plane3 GetPlane() const
 	{
@@ -104,5 +105,5 @@
 	bool mOrientation;
 
-	friend ostream &operator<<(ostream &s, const AxisAlignedPlane &p) 
+	friend std::ostream &operator<<(std::ostream &s, const AxisAlignedPlane &p) 
 	{
 		s << "a: " << p.mAxis << " p: " << p.mPosition;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.cpp	(revision 1933)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.cpp	(revision 2176)
@@ -5,4 +5,6 @@
 #include "Polygon3.h"
 
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp	(revision 2170)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp	(revision 2176)
@@ -22,4 +22,7 @@
 #include "OspTree.h"
 
+#if USE_SSE
+#include <xmmintrin.h>
+#endif
 
 
@@ -3500,4 +3503,137 @@
 }
 
-
-}
+#if 0
+void VspTree::TraverseRayPacket(RayBundle &rays);
+{
+	float splitPos [3];
+	float dist[3];
+
+	const int allValid = 1xf;
+	int mask = all_valid;
+
+	int comparisonResult = 0;
+
+	while (!node->IsLeaf())
+	{
+		comparisonResult = 0;
+
+		for (int i = 0; i < 4; ++ i)
+		{
+			splitPos[i] = node->splitPos;
+			dist[i] = (splitpos[i]  rp.origin[i][axis]) / (rp.dir[i][axis]);
+
+			comparisonresult |= ((dist[i] <= tnear[i]) << i);
+		}
+		
+		comparisonresult &= mask;
+
+		if (comparisonresult == allValid)
+		{ 
+			node = node->far;
+			continue
+		}
+
+		comparisonresult = 0;
+
+		for (int i = 0; i < 4; ++ i){
+            
+			comparisonresult |= (dist[i] >= tfar[i]);
+		}
+        
+		comparisonresult &= mask;
+        
+		if (comparisonresult == allValid)
+		{
+			node = node->near;
+			continue;
+		}
+		
+		if (comparisonresult)	
+		{
+		
+			Push( node->far, dist[0...3], tfar[0...3] )
+		
+			node = node->near;
+
+			mask = 0;
+
+			for (int i = 0; i < 4; ++ i)
+			{
+				bool b = (tnear[i] < tfar[i]);
+				mask |= b;
+                
+				if (b)
+				{
+					tfar[i] = dist[i];
+				}
+
+			}
+
+		}
+}
+#endif
+/*
+struct RayPacket
+{
+	union { float ox[4]; __m128 ox4; };
+	union { float oy[4]; __m128 oy4; };
+	union { float oz[4]; __m128 oz4; };
+	union { float dx[4]; __m128 dx4; };
+	union { float dy[4]; __m128 dy4; };
+	union { float dz[4]; __m128 dz4; };
+};
+*/
+void VspTree::TraverseRayPacket()//RayBundle &rays)
+{
+#if USE_SSE
+	VspNode *node;
+
+	RayPacket rp;
+
+	__m128 mask;
+	__m128 tf4;
+	__m128 tn4;
+	//const int offs[4] = { (RP->dcell[0] >= 0)?1:0,  (RP->dcell[4] >= 0)?1:0,  (RP->dcell[8] >= 0)?1:0, 0 };
+	
+	const int offs[4] = { 0, 0, 0, 0 };
+
+	while (!node->IsLeaf())
+	{
+		VspInterior *interior = static_cast<VspInterior *>(node);
+
+		float pos = interior->GetPosition();
+		const __m128 spos = _mm_load_ps(&pos);
+		
+		const int aidx = interior->GetAxis();
+		const __m128 d4;// = _mm_mul_ps( _mm_sub_ps( spos, RP->oc4[aidx] ), RP->rdc4[aidx] );
+		
+		VspNode* ln = interior->GetBack();// + offs[aidx];
+		
+		if (!_mm_movemask_ps( _mm_and_ps( _mm_cmpgt_ps( d4, tn4 ), mask ) )) 
+		{ 
+			node = ln; 
+			continue; 
+		}
+		
+		node = interior->GetBack();// + (offs[aidx]^1);
+		
+		if (_mm_movemask_ps( _mm_and_ps( _mm_cmplt_ps( d4, tf4 ), mask ) ))
+		{
+			const __m128 mask2 = _mm_cmpgt_ps( d4, tn4 );
+			const __m128 mask3 = _mm_cmplt_ps( d4, tf4 );
+			
+			//m_Stack[stackptr].tf4 = tf4;
+
+			tf4 = _mm_or_ps( _mm_and_ps( mask3, d4 ), _mm_andnot_ps( mask3, tf4 ) );
+
+			//m_Stack[stackptr].node = (KdTreeNode*)ln;
+			//m_Stack[stackptr].mask = mask;
+			//m_Stack[stackptr++].tn4 = _mm_or_ps( _mm_and_ps( mask2, d4 ), _mm_andnot_ps( mask2, tn4 ) );
+			mask = _mm_cmplt_ps( tn4, tf4 );
+		}
+	}
+#endif
+
+}
+
+}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.h	(revision 1966)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.h	(revision 2176)
@@ -1,7 +1,4 @@
 #ifndef _CombinedPreprocessor_H__
 #define _CombinedPreprocessor_H__
-
-#include <fstream>
-using namespace std;
 
 #include "Preprocessor.h"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h	(revision 2176)
@@ -7,5 +7,5 @@
 #include "Containers.h"
 
-//using namespace std;
+//
 
 
@@ -208,5 +208,5 @@
 		mRefCount++;
       else {
-		cerr<<"Trying to unref already deleted ray!"<<endl;
+		std::cerr<<"Trying to unref already deleted ray!"<<std::endl;
 		exit(1);
       }
@@ -249,5 +249,5 @@
 	  KdNode **node) const;
 
-  friend ostream& operator<< (ostream &s, const VssRay &vssRay);
+  friend std::ostream& operator<< (std::ostream &s, const VssRay &vssRay);
     
 };
@@ -286,6 +286,6 @@
 
 // Overload << operator for C++-style output
-inline ostream&
-operator<< (ostream &s, const VssRay &vssRay)
+inline std::ostream&
+operator<< (std::ostream &s, const VssRay &vssRay)
 {
 	return s 
@@ -320,5 +320,5 @@
 struct VssRayContainer : public vector<VssRay *>
 {
-  void PrintStatistics(ostream &s);
+  void PrintStatistics(std::ostream &s);
   int SelectRays(const int number, VssRayContainer &selected, const bool copy=false) const;
   int
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Environment.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Environment.h	(revision 1004)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Environment.h	(revision 2176)
@@ -71,5 +71,5 @@
   char *description;
   void *pointer;
-  friend ostream &operator <<(ostream &s, const COption &o) {
+  friend std::ostream &operator <<(std::ostream &s, const COption &o) {
     s<<o.name<<"\t";
     if (o.abbrev)
@@ -89,5 +89,5 @@
     s<<"\t";
     if (o.description)
-      s<<endl<<o.description;
+      s<<std::endl<<o.description;
     return s;
   }
@@ -184,5 +184,5 @@
 
     /// This method is used as a help on available command line options.
-	virtual void PrintUsage(ostream &s) const;
+	virtual void PrintUsage(std::ostream &s) const;
 
 	virtual void SetStaticOptions();
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h	(revision 2117)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <functional>
-using namespace std;
+//
 
 #include "Containers.h"
@@ -83,7 +83,7 @@
 
   void
-  Print(ostream &app) const;
-
-  friend ostream &operator<<(ostream &s, const KdTreeStatistics &stat) {
+  Print(std::ostream &app) const;
+
+  friend std::ostream &operator<<(std::ostream &s, const KdTreeStatistics &stat) {
     stat.Print(s);
     return s;
@@ -268,5 +268,5 @@
     // comparator for the 
     struct less_priority : public
-    binary_function<const TraversalData, const TraversalData, bool> {
+    std::binary_function<const TraversalData, const TraversalData, bool> {
       
       bool operator()(const TraversalData a, const TraversalData b) {
@@ -425,6 +425,6 @@
   CollectLeafPvs();
 
-  bool ExportBinTree(const string &filename);
-  bool LoadBinTree(const string &filename, ObjectContainer &object);
+  bool ExportBinTree(const std::string &filename);
+  bool LoadBinTree(const std::string &filename, ObjectContainer &object);
 
 protected:
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 2161)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 2176)
@@ -5,4 +5,5 @@
 #endif
 
+#define NOMINMAX
 #include <windows.h>
 #include <stdio.h>
@@ -15,10 +16,9 @@
 #include "Preprocessor.h"
 #include "common.h"
-
 #include "PreprocessorThread.h"
 #include "ObjExporter.h"
 #include "SceneGraph.h"
 #include "GlobalLinesRenderer.h"
-//#include "PvsDefinitions.h"
+
 
 #include "ViewCellsManager.h"
@@ -218,5 +218,5 @@
 	}
 
-	Debug << "using pvs type " << PVS_TYPE << endl;
+	//Debug << "using pvs type " << PVS_TYPE << endl;
 
 	/////////////
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParserXerces.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParserXerces.h	(revision 2119)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParserXerces.h	(revision 2176)
@@ -94,5 +94,5 @@
 
 	void StartBvhLeaf(AttributeList& attributes);
-	void StartBvhElement(string element, AttributeList& attributes);
+	void StartBvhElement(std::string element, AttributeList& attributes);
 
 	void EndObjectSpaceHierarchy();
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.h	(revision 2168)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <fstream>
-//using namespace std;
+//
 
 #include "Preprocessor.h"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ResourceManager.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ResourceManager.h	(revision 1197)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ResourceManager.h	(revision 2176)
@@ -91,5 +91,5 @@
 	}
 	
-	bool ExportEntries(const string &filename)
+	bool ExportEntries(const std::string &filename)
 	{
 		ofstream stream(filename.c_str(), ios::binary);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp	(revision 2123)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp	(revision 2176)
@@ -4,6 +4,4 @@
 #include <map>
 #include <math.h>
-
-using namespace std;
 
 #include "Vector3.h"
@@ -18,4 +16,6 @@
 #include "IntersectableWrapper.h"
 
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp	(revision 2173)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp	(revision 2176)
@@ -315,5 +315,5 @@
 
 void
-VssRayContainer::PrintStatistics(ostream &s)
+VssRayContainer::PrintStatistics(std::ostream &s)
 {
 
@@ -329,8 +329,8 @@
   
   s<<"##### VSS RAY STAT ##########\n";
-  s<<"#RAYS\n"<<(int)size()<<endl;
-  s<<"#AVG_RAY_PVS_CONTRIBUTION\n"<<sumContributions/(float)size()<<endl;
+  s<<"#RAYS\n"<<(int)size()<<std::endl;
+  s<<"#AVG_RAY_PVS_CONTRIBUTION\n"<<sumContributions/(float)size()<<std::endl;
   s<<"#AVG_RAY_RELATIVE_PVS_CONTRIBUTION\n"<<sumRelContributions/
-	(float)size()<<endl;
+	(float)size()<<std::endl;
   
 }
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/common.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/common.cpp	(revision 2123)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/common.cpp	(revision 2176)
@@ -22,4 +22,7 @@
 #include <sys/timeb.h>
 #endif
+
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h	(revision 2164)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h	(revision 2176)
@@ -118,5 +118,5 @@
   // vector3 &normal) = 0;
 
-  virtual ostream &Describe(ostream &s) = 0;
+  virtual std::ostream &Describe(std::ostream &s) = 0;
 
   //////////////////////////////////////
@@ -140,5 +140,5 @@
   /** Returns the name of the type of this intersectable
   */
-  static string GetTypeName(Intersectable *obj);
+  static std::string GetTypeName(Intersectable *obj);
 
    /** Returns normal from the face with the specified index.
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h	(revision 2123)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h	(revision 2176)
@@ -8,6 +8,7 @@
 #include "Mesh.h"
 #include "BoundingBoxConverter.h"
+#include <hash_map>
+
 #include "PerfTimer.h"
-#include <hash_map>
 
 namespace GtpVisibilityPreprocessor {
@@ -183,6 +184,6 @@
   void EndBoundingBoxes();
 
-  void StartBspElement(string element, AttributeList& attributes);
-  void StartVspElement(string element, AttributeList& attributes);
+  void StartBspElement(std::string element, AttributeList& attributes);
+  void StartVspElement(std::string element, AttributeList& attributes);
 
   void StartViewSpaceHierarchy(AttributeList& attributes);
@@ -197,5 +198,5 @@
   void StartViewCellHierarchyElement(const std::string &element, AttributeList& attributes);
 
-  void StartOspElement(string element, AttributeList& attributes);
+  void StartOspElement(std::string element, AttributeList& attributes);
 
   void StartOspLeaf(AttributeList& attributes);
@@ -206,5 +207,5 @@
   void StartBvhLeaf(AttributeList& attributes);
   void StartBvhInterior(AttributeList& attributes);
-  void StartBvhElement(string element, AttributeList& attributes);
+  void StartBvhElement(std::string element, AttributeList& attributes);
 
   void EndViewSpaceHierarchyInterior();
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Rectangle3.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Rectangle3.h	(revision 1772)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Rectangle3.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <iostream>
-using namespace std;
+//
 #include "Vector3.h"
 
@@ -60,5 +60,5 @@
 	) const;
 
-  friend ostream& operator<< (ostream &s, const Rectangle3 &r) {
+  friend std::ostream& operator<< (std::ostream &s, const Rectangle3 &r) {
     return s<<"Rectangle3:"<<r.mVertices[0]<<r.mVertices[1]<<r.mVertices[2]<<r.mVertices[3];
   }
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/FlexibleHeap.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/FlexibleHeap.h	(revision 1667)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/FlexibleHeap.h	(revision 2176)
@@ -4,5 +4,4 @@
 #include <vector>
 
-using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 2116)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 2176)
@@ -2,4 +2,5 @@
 #define __GLRENDERER_H
 
+#include "ObjectPvs.h"
 #include "Vector3.h"
 #include "Containers.h"
@@ -7,5 +8,5 @@
 #include "Renderer.h"
 #include "Beam.h"
-#include "ObjectPvs.h"
+
 
 
@@ -25,6 +26,6 @@
 class TransformedMeshInstance;
 class TriangleIntersectable;
- class BvhNode;
-  class SimpleRayContainer;
+class BvhNode;
+class SimpleRayContainer;
 
 struct VssRayContainer;
@@ -166,8 +167,8 @@
 
   inline const bool GetSnapErrorFrames() { return mSnapErrorFrames; }
-  inline const string GetSnapPrefix() { return mSnapPrefix; }
+  inline const std::string GetSnapPrefix() { return mSnapPrefix; }
 
   inline void SetSnapErrorFrames(bool snapframes) { mSnapErrorFrames = snapframes; }
-  inline void SetSnapPrefix(const string &pref) { mSnapPrefix = pref; }
+  inline void SetSnapPrefix(const std::string &pref) { mSnapPrefix = pref; }
 
   virtual void ClearErrorBuffer();
@@ -228,5 +229,5 @@
   bool mUseGlLists;
   
-  string mSnapPrefix;
+  std::string mSnapPrefix;
 
   GLUquadric *mSphere;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.h	(revision 1486)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.h	(revision 2176)
@@ -3,5 +3,5 @@
 
 #include <functional>
-using namespace std;
+//
 
 #include "Containers.h"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParser.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParser.cpp	(revision 2130)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ObjectsParser.cpp	(revision 2176)
@@ -5,7 +5,4 @@
 #include <stdlib.h>
 #include <iostream>
-//#include <ext/algorithm>
-
-using namespace std;
 #include <xercesc/util/PlatformUtils.hpp>
 
@@ -34,4 +31,6 @@
 #include "BvHierarchy.h"
 
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h	(revision 2122)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PvsDefinitions.h	(revision 2176)
@@ -10,4 +10,5 @@
 #ifdef USE_HASH_PVS
 
+	//#include "HashPvs2.h"
 	#include "HashPvs.h"
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp	(revision 2123)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp	(revision 2176)
@@ -5,7 +5,4 @@
 #include <stdlib.h>
 #include <iostream>
-//#include <ext/algorithm>
-
-using namespace std;
 #include <xercesc/util/PlatformUtils.hpp>
 
@@ -38,4 +35,6 @@
 #include "HierarchyManager.h"
 
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.h	(revision 1379)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.h	(revision 2176)
@@ -16,10 +16,10 @@
   
 	bool ParseFile(
-				   const string filename, 
+				   const std::string filename, 
 				   SceneGraphNode *root, 
 				   const bool loadMeshes = false,
 				   vector<FaceParentInfo> *parents = NULL);
 
-	bool ParseFile(const string filename, ViewCellsManager &viewCells);
+	bool ParseFile(const std::string filename, ViewCellsManager &viewCells);
  
 	/// height of a loaded view cell
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PlyParser.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PlyParser.cpp	(revision 1419)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PlyParser.cpp	(revision 2176)
@@ -1,4 +1,3 @@
 #include <iostream>
-using namespace std;
 #include <ply.h>
 #include <stdio.h>
@@ -8,4 +7,6 @@
 #include "SceneGraph.h"
 #include "Mesh.h"
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
@@ -54,5 +55,5 @@
 
 bool
-PlyParser::ParseSingleFile(const string filename,
+PlyParser::ParseSingleFile(const std::string filename,
 						   SceneGraphNode *root)
 {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp	(revision 2116)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp	(revision 2176)
@@ -20,4 +20,6 @@
 #include "VspTree.h"
 
+using namespace std;
+
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp	(revision 2124)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp	(revision 2176)
@@ -3,5 +3,4 @@
 #include <assert.h>
 #include <iostream>
-using namespace std;
 #include "AxisAlignedBox3.h"
 #include "Ray.h"
@@ -12,4 +11,6 @@
 #include "VssRay.h"
 
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Camera.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Camera.cpp	(revision 1583)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Camera.cpp	(revision 2176)
@@ -13,4 +13,5 @@
 #include "SceneGraph.h"
 
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h	(revision 2113)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/IntersectableWrapper.h	(revision 2176)
@@ -55,5 +55,5 @@
 									 const int maxTries);
   
-	ostream &Describe(ostream &s);
+	std::ostream &Describe(std::ostream &s);
 	
 	int GetRandomEdgePoint(Vector3 &point, Vector3 &normal);
@@ -150,5 +150,5 @@
   
 template<typename T>
-ostream &IntersectableWrapper<T>::Describe(ostream &s)
+std::ostream &IntersectableWrapper<T>::Describe(std::ostream &s)
 {
 	s << mItem;
@@ -176,5 +176,5 @@
 
 
-typedef map<KdNode *, KdIntersectable *> KdIntersectableMap;
+typedef std::map<KdNode *, KdIntersectable *> KdIntersectableMap;
 
 
@@ -220,5 +220,5 @@
 public:
 	DummyIntersectable(const int item):
-	  IntersectableWrapper<int>(item) {}
+	  IntersectableWrapper<int>(item) { SetId(item); }
 
 	int Type() const
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.cpp	(revision 1486)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.cpp	(revision 2176)
@@ -5,4 +5,6 @@
 #include "Mesh.h"
 #include "MeshKdTree.h"
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp	(revision 1990)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp	(revision 2176)
@@ -4,4 +4,6 @@
 #include "Triangle3.h"
 #include "ResourceManager.h"
+
+using namespace std;
 
 namespace GtpVisibilityPreprocessor {
