Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Pvs.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Pvs.h	(revision 177)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Pvs.h	(revision 191)
@@ -5,4 +5,5 @@
 
 class KdNode;
+class Ray;
 
 struct LtKdNode
@@ -29,4 +30,7 @@
   int mSamples;
   KdPvsMap mEntries;
+  
+  KdPvs():mSamples(0),mEntries() {}
+  
   KdPvsData *Find(KdNode *node);
   int AddNodeSample(KdNode *node);
@@ -40,4 +44,6 @@
 };
 
+
+
 #endif
 
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/KdTree.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/KdTree.h	(revision 177)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/KdTree.h	(revision 191)
@@ -8,4 +8,5 @@
 #include "AxisAlignedBox3.h"
 #include "Ray.h"
+#include "Pvs.h"
 
   
@@ -159,8 +160,14 @@
     mObjects.reserve(objects);
   }
-
+  
+  void AddPassingRay(const Ray &ray, const int contributions) {
+    mPassingRays.AddRay(ray, contributions);
+  }
   
   /** \sa KdNode::IsLeaf() */
   virtual bool IsLeaf() const { return true; }
+  
+
+  
 
   /** pointers to occluders contained in this node */
@@ -169,4 +176,11 @@
   /** pointers to viewcells contained in this node */
   //  ViewCellContainer mViewCells;
+
+  /** Ray set description of the rays passing through this node */
+  PassingRaySet mPassingRays;
+
+  /** PVS consisting of visible KdTree nodes */
+  KdPvs mKdPvs;
+  
 };
   
@@ -268,6 +282,9 @@
   void
   CollectObjects(KdNode *n, ObjectContainer &objects);
-  
-    AxisAlignedBox3 GetBox(const KdNode *node) const {
+
+  void
+  CollectLeaves(vector<KdLeaf *> &leaves);
+
+  AxisAlignedBox3 GetBox(const KdNode *node) const {
     KdInterior *parent = node->mParent;
     if (parent == NULL)
@@ -295,5 +312,8 @@
 		bool onlyUnmailed
 		);
-  
+
+  int
+  CollectLeafPvs();
+
 protected:
 
@@ -469,5 +489,5 @@
   AxisAlignedBox3 mBox;
   KdTreeStatistics mStat;
-
+  
 };
   
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/MutualVisibility.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/MutualVisibility.h	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/MutualVisibility.h	(revision 191)
@@ -0,0 +1,138 @@
+#ifndef __MUTUAL_VISIBILITY_H
+#define __MUTUAL_VISIBILITY_H
+
+#include "Vector3.h"
+#include "Ray.h"
+#include "Triangle3.h"
+
+class Intersectable;
+class AxisAlignedBox3;
+
+
+
+
+struct SimpleRay {
+  Vector3 mOrigin;
+  Vector3 mDirection;
+};
+
+
+struct TriangleSample {
+public:
+  /// evaluted sampling error
+  float mError;
+  /// depth in recursion
+  int mDepth;
+  /// The source triangle
+  Triangle3 mSource;
+  /// The target triangle
+  Triangle3 mTarget;
+  
+  /// intersections with the scene
+  vector<Ray::Intersection> mIntersections[9];
+  
+  void ComputeError();
+  
+  TriangleSample () {}
+  
+  TriangleSample (
+		  const Triangle3 &source,
+		  const Triangle3 &target)
+  {
+    Init(source, target);
+  }
+
+  // initial triangle sample
+  void Init(
+	    const Triangle3 &source,
+	    const Triangle3 &target);
+  
+  Vector3
+  GetIntersectionPoint(const int rayIndex,
+		       const int depth) const;
+
+  void GetRay(const int rayIndex,
+	      Vector3 &origin,
+	      Vector3 &direction) const;
+
+};
+
+enum { VISIBLE, INVISIBLE };
+
+  
+class MutualVisibilitySampler {
+public:
+  KdTree *mKdTree;
+  AxisAlignedBox3 mSource;
+  AxisAlignedBox3 mTarget;
+  float mSolidAngleThreshold;
+
+
+  MutualVisibilitySampler(KdTree *kdTree,
+			  AxisAlignedBox3 &source,
+			  AxisAlignedBox3 &target,
+			  const float solidAngleThreshold);
+  int
+  ComputeVisibility();
+
+  void
+  ConstructInitialSamples(
+			  const AxisAlignedBox3 &source,
+			  const AxisAlignedBox3 &target,
+			  vector<TriangleSample *> &samples
+			  );
+
+  void
+  AddInitialSamples(
+		    const Rectangle3 &sourceRect,
+		    const Rectangle3 &targetRect,
+		    vector<TriangleSample *> &samples
+		    );
+
+  // the split sample method contains a methodology to create new samples
+  // or terminate the sampling
+  bool
+  SplitSample(
+	      const TriangleSample &source,
+	      TriangleSample &sample1,
+	      TriangleSample &sample2
+	      );
+  void
+  PerformSplit(
+	       const TriangleSample &sample,
+	       const bool splitSource,
+	       const int edge,
+	       const Vector3 &splitPoint,
+	       const Ray &ray,
+	       TriangleSample &sample1,
+	       TriangleSample &sample2
+	       );
+  
+
+  bool
+  SampleTerminationCriteriaMet(
+			       const TriangleSample &sample);
+  
+  float
+  GetSpatialAngle(const TriangleSample &sample,
+		  const Vector3 &point
+		  );
+
+  void
+  ComputeError(TriangleSample &sample);
+
+
+};
+  
+int
+ComputeBoxVisibility(KdTree *kdTree,
+		     AxisAlignedBox3 &source,
+		     AxisAlignedBox3 &target,
+		     float solidAngleThreshold);
+
+
+
+
+
+
+#endif
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp	(revision 176)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp	(revision 191)
@@ -45,5 +45,6 @@
     Camera camera;
     camera.LookAtBox(p->mKdTree->GetBox());
-    camera.SnapImage("camera.png", p->mKdTree);
+    camera.SnapImage("camera.jpg", p->mKdTree);
+
     
     camera.LookInBox(p->mKdTree->GetBox());
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h	(revision 176)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h	(revision 191)
@@ -24,5 +24,8 @@
 
   int
-  AddNodeSamples(Intersectable *object, const Ray &ray);
+  AddNodeSamples(Intersectable *object, const Ray &ray, const int pass);
+
+  void
+  HoleSamplingPass();
 
 };
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp	(revision 176)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp	(revision 191)
@@ -145,5 +145,5 @@
 
 
-  if (wireframe)
+  if (mWireframe)
     stream<<"<IndexedLineSet ccw=\"TRUE\" coordIndex=\""<<endl;
   else
@@ -174,5 +174,5 @@
   stream<<"</Coordinate>"<<endl;
 
-  if (wireframe)
+  if (mWireframe)
     stream<<"</IndexedLineSet>"<<endl;
   else
@@ -211,4 +211,8 @@
 X3dExporter::ExportKdTree(const KdTree &tree)
 {
+  if (mExportRayDensity) {
+    return ExportKdTreeRayDensity(tree);
+  }
+  
   stack<KdNode *> tStack;
 
@@ -249,2 +253,59 @@
 
 
+bool
+X3dExporter::ExportKdTreeRayDensity(const KdTree &tree)
+{
+  stack<KdNode *> tStack;
+
+  tStack.push(tree.GetRoot());
+
+  bool fm = mUseForcedMaterial;
+  mUseForcedMaterial = true;
+  mForcedMaterial.mDiffuseColor.g = 1.0f;
+  mForcedMaterial.mDiffuseColor.b = 1.0f;
+  while (!tStack.empty()) {
+    KdNode *node = tStack.top();
+    tStack.pop();
+    if (node->IsLeaf()) {
+      AxisAlignedBox3 box = tree.GetBox(node);
+      Mesh *mesh = new Mesh;
+      
+      // add 6 vertices of the box
+      int index = mesh->mVertices.size();
+      for (int i=0; i < 8; i++) {
+	Vector3 v;
+	box.GetVertex(i, v);
+	mesh->mVertices.push_back(v);
+      }
+      mesh->AddFace(new Face(index + 0, index + 1, index + 3, index + 2) );
+      mesh->AddFace(new Face(index + 0, index + 2, index + 6, index + 4) );
+      mesh->AddFace(new Face(index + 4, index + 6, index + 7, index + 5) );
+      
+      mesh->AddFace(new Face(index + 3, index + 1, index + 5, index + 7) );
+      mesh->AddFace(new Face(index + 0, index + 4, index + 5, index + 1) );
+      mesh->AddFace(new Face(index + 2, index + 3, index + 7, index + 6) );
+
+
+      // set the mesh material according to the ray density
+      KdLeaf *leaf = (KdLeaf *) node;
+      if (leaf->mPassingRays.mRays) {
+	float importance = leaf->mPassingRays.mContributions/(float)leaf->mPassingRays.mRays;
+	//	float importance = leaf->mPassingRays.mContributions/1000.0f;
+	//	float importance = leaf->mPassingRays.mRays/1000.0f;
+	///(float)leaf->mPassingRays.mRays;
+	// mForcedMaterial.mDiffuseColor.r = log10(leaf->mPassingRays.mRays)/3.0f;
+	mForcedMaterial.mDiffuseColor.r = importance;
+	mForcedMaterial.mDiffuseColor.g = 1.0f - mForcedMaterial.mDiffuseColor.r;
+	ExportMesh(mesh);
+      }
+      delete mesh;
+    } else {
+      KdInterior *interior = (KdInterior *)node;
+      tStack.push(interior->mFront);
+      tStack.push(interior->mBack);
+    }
+  }
+  // restore the state of forced material
+  mUseForcedMaterial = fm;
+  return true;
+}
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.h	(revision 177)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.h	(revision 191)
@@ -2,5 +2,5 @@
 #define _AxisAlignedBox3_H__
 
-
+#include "Rectangle3.h"
 #include "Matrix4x4.h"
 #include "Vector3.h"
@@ -232,9 +232,21 @@
   // x,y,z are either 0 or 1; (0 .. lower coordinate, 1 .. large coordinate)
   // (xmin,ymin, zmin) .. N = 0, (xmax, ymax, zmax) .. N= 7
-  void GetVertex(int N, Vector3 &vertex) const;
-  
+  void GetVertex(const int N, Vector3 &vertex) const;
+
+  Vector3 GetVertex(const int N) const {
+    Vector3 v;
+    GetVertex(N, v);
+    return v;
+  }
+
   // Returns 1, if the box includes on arbitrary face a given box
   int IsPiercedByBox(const AxisAlignedBox3 &box, int &axis) const;
 
+
+  int GetFaceVisibilityMask(const Vector3 &position) const;
+  int GetFaceVisibilityMask(const Rectangle3 &rectangle) const;
+
+  Rectangle3 GetFace(const int face) const;
+  
   // For a given point returns the region, where the point is located
   // there are 27 regions (0..26) .. determined by the planes embedding in the
@@ -243,5 +255,5 @@
   // R = 9*x + 3*y + z  ; e.g. region .. inside the box is 13.
   int GetRegionID(const Vector3 &point) const;
-
+  
   // Set the corner point of rectangle on the face of bounding box
   // given by the index number and the rectangle lying on this face
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/default.env
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/default.env	(revision 177)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/default.env	(revision 191)
@@ -8,6 +8,7 @@
 #	filename glasgow1.x3d
 #	filename vienna.x3d
-	filename atlanta2.x3d
+#	filename atlanta2.x3d
 #	filename soda.dat
+	filename soda5.dat
 
 }
@@ -53,5 +54,5 @@
 
 Sampling {
-	totalSamples	500000
-	samplesPerPass  2
+	totalSamples	1000000
+	samplesPerPass  5
 }
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Rectangle3.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Rectangle3.h	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Rectangle3.h	(revision 191)
@@ -0,0 +1,34 @@
+#ifndef __RECTANGLE3_H
+#define __RECTANGLE3_H
+
+#include "Vector3.h"
+
+class Rectangle3 {
+public:
+  Vector3 mVertices[4];
+
+  Rectangle3(const Vector3 &v0,
+	     const Vector3 &v1,
+	     const Vector3 &v2,
+	     const Vector3 &v3) {
+    mVertices[0] = v0;
+    mVertices[1] = v1;
+    mVertices[2] = v2;
+    mVertices[3] = v3;
+  }
+  
+  Vector3 GetNormal() {
+    return Normalize(CrossProd(mVertices[0]-mVertices[1],
+			       mVertices[2]-mVertices[1]
+			       ));
+  }
+  
+  Vector3 GetCenter() {
+    return (mVertices[0] + mVertices[1] + mVertices[2] + mVertices[3])/4.0f;
+  }
+
+  
+};
+
+
+#endif
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Makefile
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Makefile	(revision 181)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Makefile	(revision 191)
@@ -1,5 +1,5 @@
 #############################################################################
 # Makefile for building: preprocessor
-# Generated by qmake (1.07a) (Qt 3.3.2) on: Mon Jul 18 20:55:14 2005
+# Generated by qmake (1.07a) (Qt 3.3.2) on: Tue Aug 02 22:47:09 2005
 # Project:  preprocessor.pro
 # Template: app
@@ -13,12 +13,12 @@
 LEX		= flex
 YACC		= byacc
-CFLAGS	=	-nologo -Zm200 -W0 -MDd -Zi -GX  -DUNICODE -DQT_DLL -DQT_THREAD_SUPPORT
-CXXFLAGS	=	-nologo -Zm200 -W0 -MDd -Zi -GX  -DUNICODE -DQT_DLL -DQT_THREAD_SUPPORT
+CFLAGS	=	-nologo -Zm200 -W0 -MD -O2 -GX  -DUNICODE -DQT_DLL -DQT_THREAD_SUPPORT -DQT_NO_DEBUG
+CXXFLAGS	=	-nologo -Zm200 -W0 -MD -O2 -GX  -DUNICODE -DQT_DLL -DQT_THREAD_SUPPORT -DQT_NO_DEBUG
 LEXFLAGS	=
 YACCFLAGS	=-d
-INCPATH	=	 -I"..\src" -I"..\support\xerces\include" -I"..\support\zlib\include" -I"..\support\boost" -I"$(QTDIR)\include" -I"d:\gametools\svn\trunk\VUT\GtpVisibilityPreprocessor\src" -I"C:\Qt\3.3.2\mkspecs\win32-msvc"
+INCPATH	=	 -I"..\src" -I"..\support\xerces\include" -I"..\support\zlib\include" -I"..\support\boost" -I"..\support\devil\include" -I"$(QTDIR)\include" -I"d:\gametools\svn\trunk\VUT\GtpVisibilityPreprocessor\src" -I"C:\Qt\3.3.2\mkspecs\win32-msvc"
 LINK	=	link
-LFLAGS	=	/NOLOGO /DEBUG /SUBSYSTEM:console /LIBPATH:"../support/xerces/lib" /LIBPATH:"$(QTDIR)\lib"
-LIBS	=	 "qt-mt332.lib" "qtmain.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "imm32.lib" "winmm.lib" "wsock32.lib" "winspool.lib" "xerces-c_2.lib" "opengl32.lib" "glu32.lib" "delayimp.lib"
+LFLAGS	=	/NOLOGO delayimp.lib /DELAYLOAD:comdlg32.dll /DELAYLOAD:oleaut32.dll /DELAYLOAD:winmm.dll /DELAYLOAD:wsock32.dll /DELAYLOAD:winspool.dll /SUBSYSTEM:console /LIBPATH:"../support/xerces/lib" /LIBPATH:"../support/devil/lib" /LIBPATH:"$(QTDIR)\lib"
+LIBS	=	 "qt-mt332.lib" "qtmain.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "imm32.lib" "winmm.lib" "wsock32.lib" "winspool.lib" "xerces-c_2.lib" "devil.lib" "ilu.lib" "ilut.lib" "opengl32.lib" "glu32.lib" "delayimp.lib"
 MOC		=	$(QTDIR)\bin\moc.exe
 UIC		=	$(QTDIR)\bin\uic.exe
@@ -61,5 +61,7 @@
 		X3dParser.cpp \
 		MeshKdTree.cpp \
-		Pvs.cpp
+		Pvs.cpp \
+		MutualVisibility.cpp \
+		Triangle3.cpp
 OBJECTS =	Preprocessor.obj \
 		SamplingPreprocessor.obj \
@@ -83,5 +85,7 @@
 		X3dParser.obj \
 		MeshKdTree.obj \
-		Pvs.obj
+		Pvs.obj \
+		MutualVisibility.obj \
+		Triangle3.obj
 FORMS =	
 UICDECLS =	
@@ -167,9 +171,6 @@
 	-$(DEL_FILE) MeshKdTree.obj
 	-$(DEL_FILE) Pvs.obj
-	-$(DEL_FILE) preprocessor.pdb
-	-$(DEL_FILE) preprocessor.ilk
-	-$(DEL_FILE) vc*.pdb
-	-$(DEL_FILE) vc*.idb
-
+	-$(DEL_FILE) MutualVisibility.obj
+	-$(DEL_FILE) Triangle3.obj
 
 
@@ -190,4 +191,5 @@
 		Containers.h \
 		AxisAlignedBox3.h \
+		Rectangle3.h \
 		Matrix4x4.h \
 		Vector3.h \
@@ -210,6 +212,8 @@
 		X3dExporter.h \
 		Environment.h \
-		Containers.h \
-		AxisAlignedBox3.h \
+		MutualVisibility.h \
+		Containers.h \
+		AxisAlignedBox3.h \
+		Rectangle3.h \
 		Matrix4x4.h \
 		Vector3.h \
@@ -239,4 +243,5 @@
 		Material.h \
 		Pvs.h \
+		Rectangle3.h \
 		Vector3.h \
 		common.h \
@@ -255,4 +260,5 @@
 		Material.h \
 		Pvs.h \
+		Rectangle3.h \
 		Vector3.h \
 		Containers.h \
@@ -288,4 +294,5 @@
 		AxisAlignedBox3.h \
 		Pvs.h \
+		Rectangle3.h \
 		Containers.h \
 		Parser.h \
@@ -300,4 +307,5 @@
 		Containers.h \
 		AxisAlignedBox3.h \
+		Rectangle3.h \
 		Matrix4x4.h \
 		Vector3.h \
@@ -315,4 +323,5 @@
 		Containers.h \
 		AxisAlignedBox3.h \
+		Rectangle3.h \
 		Matrix4x4.h \
 		Vector3.h \
@@ -343,4 +352,5 @@
 		AxisAlignedBox3.h \
 		Ray.h \
+		Rectangle3.h \
 		Matrix4x4.h \
 		Vector3.h \
@@ -376,4 +386,5 @@
 		Material.h \
 		Pvs.h \
+		Rectangle3.h \
 		Vector3.h \
 		common.h \
@@ -393,4 +404,5 @@
 		Material.h \
 		Pvs.h \
+		Rectangle3.h \
 		Containers.h \
 		
@@ -411,4 +423,5 @@
 		AxisAlignedBox3.h \
 		common.h \
+		Rectangle3.h \
 		Matrix4x4.h \
 		Plane3.h \
@@ -431,4 +444,5 @@
 		Material.h \
 		Pvs.h \
+		Rectangle3.h \
 		Vector3.h \
 		common.h \
@@ -447,4 +461,5 @@
 		Material.h \
 		Pvs.h \
+		Rectangle3.h \
 		Vector3.h \
 		Containers.h \
@@ -456,4 +471,23 @@
 		
 
+MutualVisibility.obj: MutualVisibility.cpp  \
+		KdTree.h \
+		AxisAlignedBox3.h \
+		Ray.h \
+		MutualVisibility.h \
+		Containers.h \
+		Rectangle3.h \
+		Matrix4x4.h \
+		Vector3.h \
+		Plane3.h \
+		common.h \
+		
+
+Triangle3.obj: Triangle3.cpp  \
+		Triangle3.h \
+		Vector3.h \
+		common.h \
+		
+
 ####### Install
 
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Triangle3.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Triangle3.h	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Triangle3.h	(revision 191)
@@ -0,0 +1,43 @@
+#ifndef __TRIANGLE3_H
+#define __TRIANGLE3_H
+
+#include "Vector3.h"
+
+struct Triangle3 {
+  
+  Vector3 mVertices[3];
+  
+  Triangle3() {}
+  Triangle3(const Vector3 &a,
+		 const Vector3 &b,
+		 const Vector3 &c
+		 ) {
+    Init(a, b, c);
+  }
+
+  void
+  Init(const Vector3 &a,
+       const Vector3 &b,
+       const Vector3 &c
+       ) {
+    mVertices[0] = a;
+    mVertices[1] = b;
+    mVertices[2] = c;
+    
+  }
+
+  Vector3 GetNormal() const {
+    Vector3 v1=mVertices[0]-mVertices[1], v2=mVertices[2]-mVertices[1];
+    return Normalize(CrossProd(v2,v1));
+  }
+
+  Vector3 GetCenter() const {
+    return (mVertices[0] + mVertices[1] + mVertices[2])/3.0f;
+  }
+
+  float GetSpatialAngle(const Vector3 &point) const;
+};
+
+
+#endif
+
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Ray.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Ray.h	(revision 176)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Ray.h	(revision 191)
@@ -25,5 +25,5 @@
   enum { NO_INTERSECTION=0, INTERSECTION_OUT_OF_LIMITS, INTERSECTION };
 
-  struct RayIntersection {
+  struct Intersection {
     // the point of intersection
     float mT;
@@ -35,12 +35,12 @@
     int mFace;
 
-    RayIntersection(const float t,
-		    Intersectable *object,
-		    const int face):mT(t), mObject(object), mFace(face) {}
-
-    RayIntersection() {}
+    Intersection(const float t,
+		 Intersectable *object,
+		 const int face):mT(t), mObject(object), mFace(face) {}
+
+    Intersection() {}
 
     bool operator<(
-		   const RayIntersection &b) const {
+		   const Intersection &b) const {
       return 
 	mT
@@ -54,7 +54,7 @@
   // corresponds to the spatial elementary cell
   /** intersection with the source object if any */
-  RayIntersection sourceObject;
-  
-  vector<RayIntersection> intersections;
+  Intersection sourceObject;
+  
+  vector<Intersection> intersections;
   vector<KdLeaf *> leaves;
   vector<MeshInstance *> meshes;
@@ -74,4 +74,11 @@
   Ray() {}
 
+  Intersectable *GetIntersectionObject(const int i) const {
+    return intersections[i].mObject;
+  }
+  
+  Vector3 GetIntersectionPoint(const int i) const {
+    return Extrap(intersections[i].mT);
+  }
   
   // Inititalize the ray again when already constructed
@@ -151,6 +158,6 @@
 
   // the object on which the ray starts at
-  const RayIntersection* GetStartObject() const { return &intersections[0]; }
-  const RayIntersection* GetStopObject() const { return &intersections[intersections.size()-1]; }
+  const Intersection* GetStartObject() const { return &intersections[0]; }
+  const Intersection* GetStopObject() const { return &intersections[intersections.size()-1]; }
   
   
@@ -220,4 +227,22 @@
 
 
+class PassingRaySet {
+public:
+  enum { Resolution = 2 };
+  int mDirectionalContributions[3*Resolution*Resolution];
+  int mRays;
+  int mContributions;
+  PassingRaySet() {
+    Reset();
+  }
+  void
+  Reset();
+  
+  void AddRay(const Ray &ray, const int contributions);
+  int GetEntryIndex(const Vector3 &direction) const;
+
+  friend ostream &operator<<(ostream &s, const PassingRaySet &set);
+
+};
 
 
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.h	(revision 176)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.h	(revision 191)
@@ -10,5 +10,5 @@
 #include "Material.h"
 
-
+class Triangle3;
 class MeshInstance;
 class MeshKdTree;
@@ -73,4 +73,6 @@
       delete mFaces[i];
   }
+
+  void AddTriangle(const Triangle3 &triangle);
   
   void AddFace(Face *face) 
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro	(revision 181)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/preprocessor.pro	(revision 191)
@@ -6,12 +6,12 @@
 #win32:INCLUDEPATH += c:/STLport-4.6.2/stlport
 
-INCLUDEPATH += ../src ../support/xerces/include  ../support/zlib/include ../support/boost
+INCLUDEPATH += ../src ../support/xerces/include  ../support/zlib/include ../support/boost ../support/devil/include
 
-win32:LIBPATH += ../support/xerces/lib
+win32:LIBPATH += ../support/xerces/lib ../support/devil/lib
 
 #win32:LIBPATH += c:/STLport-4.6.2/lib
 
 # debuc config
-CONFIG		+= console warn_off thread debug
+CONFIG		+= console warn_off thread release
 
 # RELEASE CONFIG
@@ -20,5 +20,5 @@
 # DEPENDPATH	= ../../include
 
-win32:LIBS += xerces-c_2.lib
+win32:LIBS += xerces-c_2.lib devil.lib ilu.lib ilut.lib
 
 # Input
@@ -31,5 +31,6 @@
 UnigraphicsParser.cpp X3dExporter.cpp SceneGraph.cpp Material.cpp \
 Matrix4x4.cpp Vector3.cpp AxisAlignedBox3.cpp Ray.cpp main.cpp Mesh.cpp \
-Exporter.cpp Camera.cpp X3dParser.cpp MeshKdTree.cpp Pvs.cpp
+Exporter.cpp Camera.cpp X3dParser.cpp MeshKdTree.cpp Pvs.cpp \
+MutualVisibility.cpp Triangle3.cpp
 
 
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Pvs.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Pvs.cpp	(revision 177)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Pvs.cpp	(revision 191)
@@ -39,5 +39,4 @@
   KdPvsMap::iterator i = mEntries.begin();
   for (int k = 0; k!=index && i != mEntries.end(); i++, k++);
-
   node = (*i).first;
   data = (*i).second;
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h	(revision 176)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h	(revision 191)
@@ -18,13 +18,16 @@
 protected:
   string mFilename;
-  bool wireframe;
+  bool mWireframe;
   bool mUseForcedMaterial;
   Material mForcedMaterial;
 
+  bool mExportRayDensity;
+  
 public:
   
   Exporter(const string filename):mFilename(filename),
-				  wireframe(false),
-				  mUseForcedMaterial(false)
+				  mWireframe(false),
+				  mUseForcedMaterial(false),
+				  mExportRayDensity(false)
   {
   }
@@ -49,6 +52,8 @@
   ExportIntersectable(Intersectable *object) = 0;
 
-  void SetWireframe() { wireframe = true; }
-  void SetFilled() { wireframe = false; }
+  void SetExportRayDensity(const bool d) { mExportRayDensity = d; }
+  
+  void SetWireframe() { mWireframe = true; }
+  void SetFilled() { mWireframe = false; }
 
   void SetForcedMaterial(const Material &m) {
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/KdTree.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/KdTree.cpp	(revision 181)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/KdTree.cpp	(revision 191)
@@ -710,2 +710,61 @@
   return neighbors.size();
 }
+
+void
+KdTree::CollectLeaves(vector<KdLeaf *> &leaves)
+{
+  stack<KdNode *> nodeStack;
+  nodeStack.push(mRoot);
+
+  while (!nodeStack.empty()) {
+    KdNode *node = nodeStack.top();
+    nodeStack.pop();
+    if (node->IsLeaf()) {
+      KdLeaf *leaf = (KdLeaf *)node;
+      leaves.push_back(leaf);
+    } else {
+      KdInterior *interior = (KdInterior *)node;
+      nodeStack.push(interior->mBack);
+      nodeStack.push(interior->mFront);
+    }
+  }
+}
+
+
+int
+KdTree::CollectLeafPvs()
+{
+  int totalPvsSize = 0;
+  stack<KdNode *> nodeStack;
+  
+  nodeStack.push(mRoot);
+  
+  while (!nodeStack.empty()) {
+    KdNode *node = nodeStack.top();
+    nodeStack.pop();
+    if (node->IsLeaf()) {
+      KdLeaf *leaf = (KdLeaf *)node;
+      for (int j=0; j < leaf->mObjects.size(); j++) {
+	Intersectable *object = leaf->mObjects[j];
+	if (!object->Mailed()) {
+	  object->Mail();
+	  // add this node to pvs of all nodes it can see
+	  KdPvsMap::iterator ni = object->mKdPvs.mEntries.begin();
+	  for (; ni != object->mKdPvs.mEntries.end(); ni++) {
+	    KdNode *node = (*ni).first;
+	    // $$ JB TEMPORARY solution -> should add object PVS or explictly computed
+	    // kd tree PVS
+	    if (leaf->mKdPvs.AddNodeSample(node))
+	      totalPvsSize++;
+	  }
+	}
+      }
+    } else {
+      KdInterior *interior = (KdInterior *)node;
+      nodeStack.push(interior->mFront);
+      nodeStack.push(interior->mBack);
+    }
+  }
+
+  return totalPvsSize;
+}
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/MutualVisibility.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/MutualVisibility.cpp	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/MutualVisibility.cpp	(revision 191)
@@ -0,0 +1,288 @@
+#include <stack>
+using namespace std;
+#include "KdTree.h"
+#include "AxisAlignedBox3.h"
+#include "Ray.h"
+#include "MutualVisibility.h"
+
+
+void
+TriangleSample::Init(
+		     const Triangle3 &source,
+		     const Triangle3 &target)
+{
+  mDepth = 0;
+  mSource = source;
+  mTarget = target;
+}
+
+
+Vector3
+TriangleSample::GetIntersectionPoint(const int rayIndex,
+				     const int depth) const
+{
+  Vector3 origin, direction;
+  GetRay(rayIndex, origin, direction);
+  return origin + direction*mIntersections[rayIndex][depth].mT;
+}
+
+void
+TriangleSample::GetRay(const int rayIndex,
+		       Vector3 &origin,
+		       Vector3 &direction) const
+{
+  const int indices[][2] = {
+    {0,0}, {0,1}, {0,2},
+    {1,0}, {1,1}, {1,2},
+    {2,0}, {2,1}, {2,2}
+  };
+  
+  origin = mSource.mVertices[indices[rayIndex][0]];
+  direction = mTarget.mVertices[indices[rayIndex][1]] - origin;
+}
+
+void
+MutualVisibilitySampler::PerformSplit(
+				      const TriangleSample &sample,
+				      const bool splitSource,
+				      const int edge,
+				      const Vector3 &splitPoint,
+				      const Ray &ray,
+				      TriangleSample &sample1,
+				      TriangleSample &sample2
+				      )
+{
+
+
+  const Triangle3 *triangle;
+  Triangle3 *triangle1, *triangle2;
+  // split the triangles
+  if (splitSource) {
+    sample1.mTarget = sample.mTarget;
+    sample2.mTarget = sample.mTarget;
+    triangle1 = &sample1.mSource;
+    triangle2 = &sample2.mSource;
+    triangle = &sample.mSource;
+  } else {
+    sample1.mSource = sample.mSource;
+    sample2.mSource = sample.mSource;
+    triangle1 = &sample1.mTarget;
+    triangle2 = &sample2.mTarget;
+    triangle = &sample.mTarget;
+  }
+  
+  // split the intersections
+  switch (edge) {
+  case 0:
+    sample1.mIntersections[0] = sample.mIntersections[0];
+    sample1.mIntersections[1] = sample.mIntersections[1];
+    triangle1->mVertices[0] = triangle->mVertices[0];
+    triangle1->mVertices[1] = triangle->mVertices[1];
+    
+    sample2.mIntersections[0] = sample.mIntersections[2];
+    sample2.mIntersections[1] = sample.mIntersections[0];
+    triangle2->mVertices[0] = triangle->mVertices[2];
+    triangle2->mVertices[1] = triangle->mVertices[0];
+    break;
+
+  case 1:
+    sample1.mIntersections[0] = sample.mIntersections[0];
+    sample1.mIntersections[1] = sample.mIntersections[1];
+    triangle1->mVertices[0] = triangle->mVertices[0];
+    triangle1->mVertices[1] = triangle->mVertices[1];
+
+    sample2.mIntersections[0] = sample.mIntersections[1];
+    sample2.mIntersections[1] = sample.mIntersections[2];
+    triangle2->mVertices[0] = triangle->mVertices[1];
+    triangle2->mVertices[1] = triangle->mVertices[2];
+    break;
+    
+  case 2:
+    sample1.mIntersections[0] = sample.mIntersections[2];
+    sample1.mIntersections[1] = sample.mIntersections[0];
+    triangle1->mVertices[0] = triangle->mVertices[2];
+    triangle1->mVertices[1] = triangle->mVertices[0];
+
+    sample2.mIntersections[0] = sample.mIntersections[1];
+    sample2.mIntersections[1] = sample.mIntersections[2];
+    triangle2->mVertices[0] = triangle->mVertices[1];
+    triangle2->mVertices[1] = triangle->mVertices[2];
+    break;
+  }
+  
+  // the new sample
+  sample1.mIntersections[2] = ray.intersections;
+  sample2.mIntersections[2] = ray.intersections;
+  triangle1->mVertices[2] = splitPoint;
+  triangle2->mVertices[2] = splitPoint;
+  
+  // establish the new samples
+  sample1.mDepth = sample2.mDepth = sample.mDepth+1;
+}
+
+float
+MutualVisibilitySampler::GetSpatialAngle(const TriangleSample &sample,
+					 const Vector3 &point
+					 )
+{
+  const int sampleIndices[][3]={
+    (0,0,0),
+    (0,1,0),
+    (-1,-1,-1)
+  };
+  
+  float sum = 0.0f;
+  int i;
+  
+  for (i=0; i < 10; i++) {
+    Triangle3 triangle(sample.GetIntersectionPoint(sampleIndices[i][0], 0),
+			    sample.GetIntersectionPoint(sampleIndices[i][1], 0),
+			    sample.GetIntersectionPoint(sampleIndices[i][2], 0));
+    
+    sum += triangle.GetSpatialAngle(point);
+  }
+  return sum;
+}
+
+
+void
+MutualVisibilitySampler::ComputeError(TriangleSample &sample)
+{
+  // evaluate minimal error which can be achieved by more precise evaluation
+  // if this is above the threshold do not proceed further
+
+  float maxAngle = GetSpatialAngle(sample,
+				   sample.mSource.GetCenter());
+  
+  for (int i=0; i < 3; i++) {
+    float angle = GetSpatialAngle(sample,
+				  sample.mSource.mVertices[i]);
+    if (angle > maxAngle)
+      maxAngle = angle;
+  }
+  
+  sample.mError = maxAngle;
+}
+
+
+
+
+
+void
+MutualVisibilitySampler::ConstructInitialSamples(
+						 const AxisAlignedBox3 &source,
+						 const AxisAlignedBox3 &target,
+						 vector<TriangleSample *> &samples
+						 )
+{
+  // get all rectangles potentially visible from the source box
+  int i;
+  int sourceMask = 0;
+  for (i=0; i < 8; i++)
+    sourceMask |= source.GetFaceVisibilityMask(target.GetVertex(i));
+
+  // now for each visble source face find all visible target faces
+  for (i=0; i < 6; i++) {
+    Rectangle3 sourceFace = source.GetFace(i);
+    if ( sourceMask &(1<<i) ) {
+      int mask = target.GetFaceVisibilityMask(sourceFace);
+      // construct triangle samples for all visible rectangles
+      for (int j=0; j < 6; j++)
+	if (mask & (1<<j)) {
+	  AddInitialSamples(sourceFace, target.GetFace(j), samples);
+	}
+    }
+  }
+}
+
+void
+MutualVisibilitySampler::AddInitialSamples(
+					   const Rectangle3 &sourceRect,
+					   const Rectangle3 &targetRect,
+					   vector<TriangleSample *> &samples
+					   )
+{
+  Triangle3 sourceTriangles[2];
+  Triangle3 targetTriangles[2];
+
+  sourceTriangles[0].Init(sourceRect.mVertices[0],
+			  sourceRect.mVertices[1],
+			  sourceRect.mVertices[2]);
+
+  sourceTriangles[1].Init(sourceRect.mVertices[0],
+			  sourceRect.mVertices[2],
+			  sourceRect.mVertices[3]);
+
+  targetTriangles[0].Init(targetRect.mVertices[0],
+			  targetRect.mVertices[1],
+			  targetRect.mVertices[2]);
+
+  targetTriangles[1].Init(targetRect.mVertices[0],
+			  targetRect.mVertices[2],
+			  targetRect.mVertices[3]);
+  int i, j;
+  for (i=0; i < 2; i++)
+    for (j=0; j < 2; j++) {
+      TriangleSample *sample = new TriangleSample(sourceTriangles[i], 
+						  targetTriangles[j]);
+      samples.push_back(sample);
+    }
+}
+
+int
+MutualVisibilitySampler::ComputeVisibility()
+{
+  stack<TriangleSample *> sampleStack;
+  
+  Ray ray;
+  // now process the samples as long as we have something to do
+  while (!sampleStack.empty()) {
+    TriangleSample *sample = sampleStack.top();
+    sampleStack.pop();
+    
+//      // cast a new ray
+//      int triangleSplitEdge = SetupExtremalRay(sample, source, ray);
+    
+//      if (!kdTree->CastRay(ray))
+//        return VISIBLE;
+    
+//      // generate 2 new samples
+//      TriangleSample newSamples[2];
+//      sample.Split(triangleSplitEdge, ray, newSamples[0], newSamples[1]);
+//      for (i=0; i < 2; i++) {
+//        newSamples[i].ComputeError();
+//        if (newSamples[i].mError > solidAngleThreshold) {
+//  	sampleStack.push(newSamples[i]);
+//        }
+//      }
+//    }
+  }
+  return INVISIBLE;
+}
+
+MutualVisibilitySampler::MutualVisibilitySampler(KdTree *kdTree,
+						 AxisAlignedBox3 &source,
+						 AxisAlignedBox3 &target,
+						 const float solidAngleThreshold)
+{
+  mKdTree = kdTree;
+  mSource = source;
+  mTarget = target;
+  mSolidAngleThreshold = solidAngleThreshold;
+}
+  
+
+int
+ComputeBoxVisibility(KdTree *kdTree,
+		     AxisAlignedBox3 &source,
+		     AxisAlignedBox3 &target,
+		     const float solidAngleThreshold)
+{
+  MutualVisibilitySampler sampler(kdTree, source, target, solidAngleThreshold);
+
+  int visibility = sampler.ComputeVisibility();
+
+  return visibility;
+  
+}
+  
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp	(revision 181)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp	(revision 191)
@@ -4,4 +4,6 @@
 #include "X3dExporter.h"
 #include "Environment.h"
+#include "MutualVisibility.h"
+
 SamplingPreprocessor::SamplingPreprocessor()
 {
@@ -33,14 +35,35 @@
 
 int
-SamplingPreprocessor::AddNodeSamples(Intersectable *object, const Ray &ray)
+SamplingPreprocessor::AddNodeSamples(Intersectable *object,
+				     const Ray &ray,
+				     const int pass)
 {
   int contributingSamples = 0;
-
-  for (int j=0; j < ray.leaves.size(); j++) {
+  int j;
+  for (j=0; j < ray.leaves.size(); j++) {
     KdNode *node = GetNodeForPvs( ray.leaves[j] );
     contributingSamples += object->mKdPvs.AddNodeSample(node);
   }
   
+  if (pass > 10)
+    for (j=1; j < ray.leaves.size() - 1; j++) {
+      ray.leaves[j]->AddPassingRay(ray, contributingSamples ? 1 : 0);
+    }
+  
   return contributingSamples;
+}
+
+
+void
+SamplingPreprocessor::HoleSamplingPass()
+{
+  vector<KdLeaf *> leaves;
+  mKdTree->CollectLeaves(leaves);
+  
+  // go through all the leaves and evaluate their passing contribution
+  for (int i=0 ; i < leaves.size(); i++) {
+    KdLeaf *leaf = leaves[i];
+    cout<<leaf->mPassingRays<<endl;
+  }
 }
 
@@ -63,5 +86,4 @@
   int totalSamples = 0;
 
-
   int pvsOut = Min((int)objects.size(), 10);
   
@@ -73,108 +95,118 @@
     int passSampleContributions = 0;
     int passSamples = 0;
-	int index = 0;
-    KdNode *visibleNode = NULL;
+    int index = 0;
 
     for (i =0; i < objects.size(); i++) {
       KdNode *nodeToSample = NULL;
       Intersectable *object = objects[i];
-
+      
       int pvsSize = object->mKdPvs.GetSize();
-
-      
-    if (pvsSize) {
-		// mail all nodes from the pvs
-		Intersectable::NewMail();
-		KdPvsMap::iterator i = object->mKdPvs.mEntries.begin();
-		for (; i != object->mKdPvs.mEntries.end(); i++) {
-			KdNode *node = (*i).first;
-			node->Mail();
-		}
-		int maxTries = 2*pvsSize;
-	
-		for (int tries = 0; tries < 10; tries++) {
-			index = RandomValue(0, pvsSize - 1);
-			KdPvsData data;
-			object->mKdPvs.GetData(index, visibleNode, data);
-			nodeToSample = mKdTree->FindRandomNeighbor(visibleNode, true);
-			if (nodeToSample)
-			break;
-		}
-	}
-
-    if (0 && pvsSize) {
-		// mail all nodes from the pvs
-		Intersectable::NewMail();
-		KdPvsMap::iterator i = object->mKdPvs.mEntries.begin();
-		for (; i != object->mKdPvs.mEntries.end(); i++) {
-			KdNode *node = (*i).first;
-			node->Mail();
-		}
-	
-		vector<KdNode *> invisibleNeighbors;
-		// get all neighbors of all PVS nodes
-		i = object->mKdPvs.mEntries.begin();
-		for (; i != object->mKdPvs.mEntries.end(); i++) {
-			KdNode *node = (*i).first;
-			mKdTree->FindNeighbors(visibleNode, invisibleNeighbors, true);
-		}
-
-		KdPvsData data;
-		KdNode *visibleNode;
-		object->mKdPvs.GetData(index, visibleNode, data);
-		nodeToSample = mKdTree->FindRandomNeighbor(visibleNode, true);
-		if (nodeToSample)
-			break;
-      }
-      
+      
+      if (0 && pvsSize) {
+	// mail all nodes from the pvs
+	Intersectable::NewMail();
+	KdPvsMap::iterator i = object->mKdPvs.mEntries.begin();
+	for (; i != object->mKdPvs.mEntries.end(); i++) {
+	  KdNode *node = (*i).first;
+	  node->Mail();
+	}
+	int maxTries = 2*pvsSize;
+	
+	for (int tries = 0; tries < 10; tries++) {
+	  index = RandomValue(0, pvsSize - 1);
+	  KdPvsData data;
+	  KdNode *node;
+	  object->mKdPvs.GetData(index, node, data);
+	  nodeToSample = mKdTree->FindRandomNeighbor(node, true);
+	  if (nodeToSample)
+	    break;
+	}
+      }
+      
+      if (0 && pvsSize && pass == 100 ) {
+	// mail all nodes from the pvs
+	Intersectable::NewMail();
+	KdPvsMap::iterator i = object->mKdPvs.mEntries.begin();
+	for (; i != object->mKdPvs.mEntries.end(); i++) {
+	  KdNode *node = (*i).first;
+	  node->Mail();
+	}
+	
+	vector<KdNode *> invisibleNeighbors;
+	// get all neighbors of all PVS nodes
+	i = object->mKdPvs.mEntries.begin();
+	for (; i != object->mKdPvs.mEntries.end(); i++) {
+	  KdNode *node = (*i).first;
+	  mKdTree->FindNeighbors(node, invisibleNeighbors, true);
+	  AxisAlignedBox3 box = object->GetBox();
+	  for (int j=0; j < invisibleNeighbors.size(); j++) {
+	    int visibility = ComputeBoxVisibility(mKdTree,
+						  box,
+						  mKdTree->GetBox(invisibleNeighbors[j]),
+						  1.0f);
+	    
+	  }
+	  
+	
+	  // now rank all the neighbors according to probability that a new
+	  // sample creates some contribution
+	}
+      }
 
       for (int k=0; k < mSamplesPerPass; k++) {
-		  object->GetRandomSurfacePoint(point, normal);
-		  if (nodeToSample) {
-			  int maxTries = 5;
-			  for (int tries = 0; tries < maxTries; tries++) {
-				  direction = mKdTree->GetBox(nodeToSample).GetRandomPoint() - point;
-				  if (DotProd(direction, normal) > Limits::Small)
-					break;
-			  }
+	object->GetRandomSurfacePoint(point, normal);
+	if (nodeToSample) {
+	  int maxTries = 5;
+	  for (int tries = 0; tries < maxTries; tries++) {
+	    direction = mKdTree->GetBox(nodeToSample).GetRandomPoint() - point;
+	    if (DotProd(direction, normal) > Limits::Small)
+	      break;
+	  }
 		
-			  if (tries == maxTries)
-				  direction = UniformRandomVector(normal);
-		  } else
-			  direction = UniformRandomVector(normal);
-	
-		  // construct a ray
-		  SetupRay(ray, point, direction);
-		  mKdTree->CastRay(ray);
-
-		  if (i < pvsOut)
-			  rays[i].push_back(ray);
-	
-		  int sampleContributions = 0;
+	  if (tries == maxTries)
+	    direction = UniformRandomVector(normal);
+	} else
+	  direction = UniformRandomVector(normal);
+	
+	// construct a ray
+	SetupRay(ray, point, direction);
+	mKdTree->CastRay(ray);
+
+	if (i < pvsOut)
+	  rays[i].push_back(ray);
+	
+	int sampleContributions = 0;
 	
 		  
-		  if (ray.leaves.size()) {
-			  sampleContributions += AddNodeSamples(object, ray);
+	if (ray.leaves.size()) {
+	  sampleContributions += AddNodeSamples(object, ray, pass);
 	  
-			  if (ray.intersections.size()) {
-				  sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray);
-				  // check whether we can add this to the rays
-				  for (int j = 0; j < pvsOut; j++) {
-					  if (objects[j] == ray.intersections[0].mObject) {
-						  rays[j].push_back(ray);
-					  }
-				  }
-			  }
+	  if (ray.intersections.size()) {
+	    sampleContributions += AddNodeSamples(ray.intersections[0].mObject, ray, pass);
+	    // check whether we can add this to the rays
+	    for (int j = 0; j < pvsOut; j++) {
+	      if (objects[j] == ray.intersections[0].mObject) {
+		rays[j].push_back(ray);
+	      }
+	    }
+	  }
 		
-			  passSamples++;
+	  passSamples++;
 			
-			  if (sampleContributions) {
-				  passContributingSamples++;
-				  passSampleContributions += sampleContributions;
-			  }
-		  }
-	  }
-	}
+	  if (sampleContributions) {
+	    passContributingSamples++;
+	    passSampleContributions += sampleContributions;
+	  }
+	}
+      }
+    }
+
+
     totalSamples += passSamples;
+
+    //    if (pass>10)
+    //      HoleSamplingPass();
+    
+
     pass++;
     
@@ -193,4 +225,16 @@
       endl;
   }
+
+  int totalPvsSize = mKdTree->CollectLeafPvs();
+  cout<<"#totalPvsSize="<<totalPvsSize<<endl;
+  
+  //  HoleSamplingPass();
+  if (1) {
+    Exporter *exporter = Exporter::GetExporter("ray-density.x3d");
+    exporter->SetExportRayDensity(true);
+    exporter->ExportKdTree(*mKdTree);
+    delete exporter;
+  }
+  
   bool exportRays = false;
   if (exportRays) {
@@ -214,5 +258,5 @@
       KdPvsMap::iterator i = object->mKdPvs.mEntries.begin();
       Intersectable::NewMail();
-	// avoid adding the object to the list
+      // avoid adding the object to the list
       object->Mail();
       ObjectContainer visibleObjects;
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.cpp	(revision 177)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.cpp	(revision 191)
@@ -549,5 +549,5 @@
 // x,y,z are either 0 or 1; (0 .. min coordinate, 1 .. max coordinate)
 void
-AxisAlignedBox3::GetVertex(int N, Vector3 &vertex) const
+AxisAlignedBox3::GetVertex(const int N, Vector3 &vertex) const
 {
   switch (N) {
@@ -1526,2 +1526,91 @@
   return (m == M) ? m : m + M;
 }
+
+int
+AxisAlignedBox3::GetFaceVisibilityMask(const Rectangle3 &rectangle) const
+{
+  int mask = 0;
+  for (int i=0; i < 4; i++)
+    mask |= GetFaceVisibilityMask(rectangle.mVertices[i]);
+  return mask;
+}
+
+int
+AxisAlignedBox3::GetFaceVisibilityMask(const Vector3 &position) const {
+  
+  // assume that we are not inside the box
+  int c=0;
+  
+  if (position.x<(mMin.x-Limits::Small))
+    c|=1;
+  else
+    if (position.x>(mMax.x+Limits::Small))
+      c|=2;
+  
+  if (position.y<(mMin.y-Limits::Small))
+    c|=4;
+  else
+    if (position.y>(mMax.y+Limits::Small))
+      c|=8;
+  
+  if (position.z<(mMin.z-Limits::Small))
+    c|=16;
+  else
+    if (position.z>(mMax.z+Limits::Small))
+      c|=32;
+  
+  return c;
+}
+
+
+Rectangle3
+AxisAlignedBox3::GetFace(const int face) const
+{
+  Vector3 v[4];
+  switch (face) {
+    
+  case 0:
+    v[3].SetValue(mMin.x,mMin.y,mMin.z);
+    v[2].SetValue(mMin.x,mMax.y,mMin.z);
+    v[1].SetValue(mMin.x,mMax.y,mMax.z);
+    v[0].SetValue(mMin.x,mMin.y,mMax.z);
+    break;
+    
+  case 1: 
+    v[0].SetValue(mMax.x,mMin.y,mMin.z);
+    v[1].SetValue(mMax.x,mMax.y,mMin.z);
+    v[2].SetValue(mMax.x,mMax.y,mMax.z);
+    v[3].SetValue(mMax.x,mMin.y,mMax.z);
+    break;
+    
+  case 2:
+    v[3].SetValue(mMin.x,mMin.y,mMin.z);
+    v[2].SetValue(mMin.x,mMin.y,mMax.z);
+    v[1].SetValue(mMax.x,mMin.y,mMax.z);
+    v[0].SetValue(mMax.x,mMin.y,mMin.z);
+    break;
+  
+  case 3:
+    v[0].SetValue(mMin.x,mMax.y,mMin.z);
+    v[1].SetValue(mMin.x,mMax.y,mMax.z);
+    v[2].SetValue(mMax.x,mMax.y,mMax.z);
+    v[3].SetValue(mMax.x,mMax.y,mMin.z);
+    break;
+
+  case 4:
+    v[3].SetValue(mMin.x,mMin.y,mMin.z);
+    v[2].SetValue(mMax.x,mMin.y,mMin.z);
+    v[1].SetValue(mMax.x,mMax.y,mMin.z);
+    v[0].SetValue(mMin.x,mMax.y,mMin.z);
+    break;
+  
+  case 5:
+    v[0].SetValue(mMin.x,mMin.y,mMax.z);
+    v[1].SetValue(mMax.x,mMin.y,mMax.z);
+    v[2].SetValue(mMax.x,mMax.y,mMax.z);
+    v[3].SetValue(mMin.x,mMax.y,mMax.z);
+    break;
+  }
+  
+  return Rectangle3(v[0], v[1], v[2], v[3]);
+}
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Camera.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Camera.cpp	(revision 182)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Camera.cpp	(revision 191)
@@ -1,5 +1,9 @@
 #include <algorithm>
-#include <qstring.h>
-#include <qimage.h>
+
+// the devil library
+#include <IL/il.h>
+#include <IL/ilu.h>
+#include <IL/ilut.h>
+
 #include "Camera.h"
 #include "Ray.h"
@@ -7,4 +11,23 @@
 #include "Mesh.h"
 #include "Exporter.h"
+
+
+
+
+void
+InitDevIl()
+{
+  ilInit();
+  ILuint ImageName;
+  ilGenImages(1, &ImageName);
+  ilBindImage(ImageName);
+  ilEnable(IL_FILE_OVERWRITE);
+
+  //  ilRegisterFormat(IL_RGBA);
+  //  ilRegisterType(IL_FLOAT);
+
+  //  ilEnable(IL_ORIGIN_SET);
+  //  ilOriginFunc(IL_ORIGIN_UPPER_LEFT);
+}
 
 bool
@@ -19,9 +42,9 @@
 
   
-#if QT_VERSION < 0x040000
-  QImage image(mWidth, mHeight, 32);
-#else
-  //QImage image(mWidth, mHeight, QImage::Format_RGB32);
-#endif
+  InitDevIl();
+  int components = 4;
+  float *buffer = new float[components*mWidth*mHeight];
+  float *pbuffer = buffer;
+  //  - components*mWidth;
   
   vector<Ray> rays;
@@ -30,8 +53,9 @@
 
   Ray ray;
+
   for (y = 0; y < mHeight; y++) {
     cout<<"+";
     for (x = 0; x < mWidth; x++) {
-      SetupRay(ray, x, y);
+      SetupRay(ray, x, mHeight - (y + 1));
       if (tree->CastRay(ray))
 	if (ray.intersections.size()) {
@@ -41,16 +65,17 @@
 	  if (mesh->GetMesh()->mMaterial)
 	    color = mesh->GetMesh()->mMaterial->mDiffuseColor;
-#if QT_VERSION < 0x040000
-	  image.setPixel(x, y, qRgb(color.r*255,
-				    color.g*255,
-				    color.b*255
-				    ));
-#endif
+
+	  pbuffer[0] = color.r;
+	  pbuffer[1] = color.g;
+	  pbuffer[2] = color.b;
+	  pbuffer[3] = 1.0f;
 
 	}
+      pbuffer+=components;
       
       if (exportRays && (x==222) && (y==97))
 	rays.push_back(ray);
     }
+    //    pbuffer-=2*components*mWidth;
   }
   
@@ -58,9 +83,13 @@
   cout<<"#RAY_CAST_TIME\n";
   cout<<TimeDiff(t1, t2)<<"\n";
+
   
   cout<<"Saving image"<<endl;
-#if QT_VERSION < 0x040000
-  image.save(filename.c_str(), "PNG");
-#endif
+
+  ilRegisterType(IL_FLOAT);
+  ilTexImage(mWidth, mHeight, 1, 4, IL_RGBA, IL_FLOAT, buffer);
+  ilSaveImage((char *const)filename.c_str());
+  delete buffer;
+  
   Exporter *exporter = NULL;
   if (exportRays) {
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Triangle3.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Triangle3.cpp	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Triangle3.cpp	(revision 191)
@@ -0,0 +1,7 @@
+#include "Triangle3.h"
+
+float
+Triangle3::GetSpatialAngle(const Vector3 &point) const
+{
+  return 0.0f;
+}
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Ray.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Ray.cpp	(revision 162)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Ray.cpp	(revision 191)
@@ -121,2 +121,48 @@
 }
 
+void
+PassingRaySet::Reset()
+{
+  for (int i=0; i < 3*Resolution*Resolution; i++)
+    mDirectionalContributions[i] = 0;
+  mRays = 0;
+  mContributions = 0;
+}
+  
+void
+PassingRaySet::AddRay(const Ray &ray, const int contributions)
+{
+  int i = GetEntryIndex(ray.GetDir());
+  mRays++;
+  mContributions += contributions;
+  mDirectionalContributions[i] += contributions;
+}
+
+int
+PassingRaySet::GetEntryIndex(const Vector3 &direction) const
+{
+  // get face
+  int axis = direction.DrivingAxis();
+  Vector3 dir;
+  float k = direction[axis];
+  if ( k < 0.0f)
+    k = -k;
+
+  dir = direction/k;
+  float x, y;
+  dir.ExtractVerts(&x, &y, axis);
+  int ix = (x + 1.0f)*0.5f*Resolution;
+  int iy = (y + 1.0f)*0.5f*Resolution;
+
+  return Resolution*(Resolution*axis + iy) + ix;
+}
+
+ostream &
+operator<<(ostream &s, const PassingRaySet &set)
+{
+  s<<"Ray Set #rays="<<set.mRays<<" #contributions="<<set.mContributions<<endl;
+  for (int i=0; i < 3*sqr(PassingRaySet::Resolution); i++)
+    s<<set.mDirectionalContributions[i]<<" ";
+  s<<endl;
+  return s;
+}
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.cpp
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.cpp	(revision 176)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.cpp	(revision 191)
@@ -2,4 +2,5 @@
 #include "Mesh.h"
 #include "MeshKdTree.h"
+#include "Triangle3.h"
 
 int MeshInstance::mailID = 21843194198;
@@ -60,5 +61,5 @@
     switch (ray.GetType()) {
     case Ray::GLOBAL_RAY:
-      ray.intersections.push_back(Ray::RayIntersection(t, instance, faceIndex));
+      ray.intersections.push_back(Ray::Intersection(t, instance, faceIndex));
       hit++;
       break;
@@ -101,7 +102,7 @@
   if ( hits && ray.GetType() == Ray::LOCAL_RAY ) {
     if (ray.intersections.size())
-      ray.intersections[0] = Ray::RayIntersection(nearestT, instance, nearestFace);
+      ray.intersections[0] = Ray::Intersection(nearestT, instance, nearestFace);
     else
-      ray.intersections.push_back(Ray::RayIntersection(nearestT, instance, nearestFace));
+      ray.intersections.push_back(Ray::Intersection(nearestT, instance, nearestFace));
   }
   
@@ -135,7 +136,7 @@
   if ( hits && ray.GetType() == Ray::LOCAL_RAY ) {
     if (ray.intersections.size())
-      ray.intersections[0] = Ray::RayIntersection(nearestT, instance, nearestFace);
+      ray.intersections[0] = Ray::Intersection(nearestT, instance, nearestFace);
     else
-      ray.intersections.push_back(Ray::RayIntersection(nearestT, instance, nearestFace));
+      ray.intersections.push_back(Ray::Intersection(nearestT, instance, nearestFace));
   }
   
@@ -333,2 +334,13 @@
 }
 
+void
+Mesh::AddTriangle(const Triangle3 &triangle)
+{
+  int index = mVertices.size();
+
+  for (int i=0; i < 3; i++) {
+    mVertices.push_back(triangle.mVertices[i]);
+  }
+  
+  AddFace(new Face(index + 0, index + 1, index + 2) );
+}
Index: /trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h	(revision 176)
+++ /trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h	(revision 191)
@@ -57,5 +57,7 @@
   virtual void
   ExportSceneNode(SceneGraphNode *node);
-  
+
+  bool
+  ExportKdTreeRayDensity(const KdTree &tree);
 
   
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/ilu.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/ilu.h	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/ilu.h	(revision 191)
@@ -0,0 +1,190 @@
+//-----------------------------------------------------------------------------
+//
+// ImageLib Utility Sources
+// Copyright (C) 2000-2002 by Denton Woods
+// Last modified: 06/23/2002 <--Y2K Compliant! =]
+//
+// Filename: IL/ilu.h
+//
+// Description: The main include file for ILU
+//
+//-----------------------------------------------------------------------------
+
+
+#ifndef __ilu_h_
+#ifndef __ILU_H__
+
+#define __ilu_h_
+#define __ILU_H__
+
+#include <IL/il.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+#ifdef _WIN32
+	#if defined(_MSC_VER) || defined(__BORLANDC__)
+		#ifndef IL_STATIC_LIB
+			#pragma comment(lib, "DevIL_DLL.lib")
+			#ifndef _IL_BUILD_LIBRARY
+				#pragma comment(lib, "DevILU_DLL.lib")
+			#endif
+		#else
+			#ifndef _IL_BUILD_LIBRARY
+				#ifdef  IL_DEBUG
+					#pragma comment(lib, "DevILU_DBG.lib")
+				#else
+					#pragma comment(lib, "DevILU.lib")
+				#endif//IL_DEBUG
+			#endif
+		#endif
+	#endif
+#endif
+*/
+
+
+#define ILU_VERSION_1_6_7					1
+#define ILU_VERSION							167
+
+
+#define ILU_FILTER							0x2600
+#define ILU_NEAREST							0x2601
+#define ILU_LINEAR							0x2602
+#define ILU_BILINEAR						0x2603
+#define ILU_SCALE_BOX						0x2604
+#define ILU_SCALE_TRIANGLE					0x2605
+#define ILU_SCALE_BELL						0x2606
+#define ILU_SCALE_BSPLINE					0x2607
+#define ILU_SCALE_LANCZOS3					0x2608
+#define ILU_SCALE_MITCHELL					0x2609
+
+
+// Error types
+#define ILU_INVALID_ENUM					0x0501
+#define ILU_OUT_OF_MEMORY					0x0502
+#define ILU_INTERNAL_ERROR					0x0504
+#define ILU_INVALID_VALUE					0x0505
+#define ILU_ILLEGAL_OPERATION				0x0506
+#define ILU_INVALID_PARAM					0x0509
+
+
+// Values
+#define ILU_PLACEMENT						0x0700
+#define ILU_LOWER_LEFT						0x0701
+#define ILU_LOWER_RIGHT						0x0702
+#define ILU_UPPER_LEFT						0x0703
+#define ILU_UPPER_RIGHT						0x0704
+#define ILU_CENTER							0x0705
+#define ILU_CONVOLUTION_MATRIX				0x0710
+#define ILU_VERSION_NUM						IL_VERSION_NUM
+#define ILU_VENDOR							IL_VENDOR
+
+
+// Filters
+/*
+#define ILU_FILTER_BLUR						0x0803
+#define ILU_FILTER_GAUSSIAN_3x3				0x0804
+#define ILU_FILTER_GAUSSIAN_5X5				0x0805
+#define ILU_FILTER_EMBOSS1					0x0807
+#define ILU_FILTER_EMBOSS2					0x0808
+#define ILU_FILTER_LAPLACIAN1				0x080A
+#define ILU_FILTER_LAPLACIAN2				0x080B
+#define ILU_FILTER_LAPLACIAN3				0x080C
+#define ILU_FILTER_LAPLACIAN4				0x080D
+#define ILU_FILTER_SHARPEN1					0x080E
+#define ILU_FILTER_SHARPEN2					0x080F
+#define ILU_FILTER_SHARPEN3					0x0810
+*/
+
+
+typedef struct ILinfo
+{
+	ILuint	Id;					// the image's id
+	ILubyte	*Data;				// the image's data
+	ILuint	Width;				// the image's width
+	ILuint	Height;				// the image's height
+	ILuint	Depth;				// the image's depth
+	ILubyte	Bpp;				// bytes per pixel (not bits) of the image
+	ILuint	SizeOfData;			// the total size of the data (in bytes)
+	ILenum	Format;				// image format (in IL enum style)
+	ILenum	Type;				// image type (in IL enum style)
+	ILenum	Origin;				// origin of the image
+	ILubyte	*Palette;			// the image's palette
+	ILenum	PalType;			// palette type
+	ILuint	PalSize;			// palette size
+	ILenum	CubeFlags;			// flags for what cube map sides are present
+	ILuint	NumNext;			// number of images following
+	ILuint	NumMips;			// number of mipmaps
+	ILuint	NumLayers;			// number of layers
+} ILinfo;
+
+
+typedef struct ILpointf
+{
+	ILfloat x, y;
+} ILpointf;
+
+typedef struct ILpointi
+{
+	ILint x, y;
+} ILpointi;
+
+
+// ImageLib Utility Functions
+ILAPI ILboolean			ILAPIENTRY iluAlienify(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluBlurAvg(ILuint Iter);
+ILAPI ILboolean			ILAPIENTRY iluBlurGaussian(ILuint Iter);
+ILAPI ILboolean			ILAPIENTRY iluBuildMipmaps(ILvoid);
+ILAPI ILuint			ILAPIENTRY iluColoursUsed(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluCompareImage(ILuint Comp);
+ILAPI ILboolean			ILAPIENTRY iluContrast(ILfloat Contrast);
+ILAPI ILboolean			ILAPIENTRY iluCrop(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth);
+ILAPI ILvoid			ILAPIENTRY iluDeleteImage(ILuint Id);
+ILAPI ILboolean			ILAPIENTRY iluEdgeDetectE(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluEdgeDetectP(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluEdgeDetectS(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluEmboss(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluEnlargeCanvas(ILuint Width, ILuint Height, ILuint Depth);
+ILAPI ILboolean			ILAPIENTRY iluEnlargeImage(ILfloat XDim, ILfloat YDim, ILfloat ZDim);
+ILAPI ILboolean			ILAPIENTRY iluEqualize(ILvoid);
+ILAPI const ILstring	ILAPIENTRY iluErrorString(ILenum Error);
+ILAPI ILboolean			ILAPIENTRY iluFlipImage(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluGammaCorrect(ILfloat Gamma);
+ILAPI ILuint			ILAPIENTRY iluGenImage(ILvoid);
+ILAPI ILvoid			ILAPIENTRY iluGetImageInfo(ILinfo *Info);
+ILAPI ILint				ILAPIENTRY iluGetInteger(ILenum Mode);
+ILAPI ILvoid			ILAPIENTRY iluGetIntegerv(ILenum Mode, ILint *Param);
+ILAPI const ILstring	ILAPIENTRY iluGetString(ILenum StringName);
+ILAPI ILvoid			ILAPIENTRY iluImageParameter(ILenum PName, ILenum Param);
+ILAPI ILvoid			ILAPIENTRY iluInit(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluInvertAlpha(ILvoid);
+ILAPI ILuint			ILAPIENTRY iluLoadImage(const ILstring FileName);
+ILAPI ILboolean			ILAPIENTRY iluMirror(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluNegative(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluNoisify(ILclampf Tolerance);
+ILAPI ILboolean			ILAPIENTRY iluPixelize(ILuint PixSize);
+ILAPI ILvoid			ILAPIENTRY iluRegionfv(ILpointf *Points, ILuint n);
+ILAPI ILvoid			ILAPIENTRY iluRegioniv(ILpointi *Points, ILuint n);
+ILAPI ILboolean			ILAPIENTRY iluReplaceColour(ILubyte Red, ILubyte Green, ILubyte Blue, ILfloat Tolerance);
+ILAPI ILboolean			ILAPIENTRY iluRotate(ILfloat Angle);
+ILAPI ILboolean			ILAPIENTRY iluRotate3D(ILfloat x, ILfloat y, ILfloat z, ILfloat Angle);
+ILAPI ILboolean			ILAPIENTRY iluSaturate1f(ILfloat Saturation);
+ILAPI ILboolean			ILAPIENTRY iluSaturate4f(ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation);
+ILAPI ILboolean			ILAPIENTRY iluScale(ILuint Width, ILuint Height, ILuint Depth);
+ILAPI ILboolean			ILAPIENTRY iluScaleColours(ILfloat r, ILfloat g, ILfloat b);
+ILAPI ILboolean			ILAPIENTRY iluSharpen(ILfloat Factor, ILuint Iter);
+ILAPI ILboolean			ILAPIENTRY iluSwapColours(ILvoid);
+ILAPI ILboolean			ILAPIENTRY iluWave(ILfloat Angle);
+
+#define iluColorsUsed	iluColoursUsed
+#define iluSwapColors	iluSwapColours
+#define iluReplaceColor	iluReplaceColour
+#define iluScaleColor	iluScaleColour
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __ILU_H__
+#endif // __ilu_h_
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/config.h.in
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/config.h.in	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/config.h.in	(revision 191)
@@ -0,0 +1,62 @@
+/* include/IL/config.h.in.  Generated automatically from configure.in by autoheader.  */
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+
+/* Supported images formats (il) */
+
+#undef IL_NO_BMP
+#undef IL_NO_CUT
+#undef IL_NO_DCX
+#undef IL_NO_DDS
+#undef IL_NO_DOOM
+#undef IL_NO_GIF
+#undef IL_NO_ICO
+#undef IL_NO_JPG
+#undef IL_NO_LCMS
+#undef IL_NO_LIF
+#undef IL_NO_MDL
+#undef IL_NO_MNG
+#undef IL_NO_PCD
+#undef IL_NO_PCX
+#undef IL_NO_PIC
+#undef IL_NO_PIX
+#undef IL_NO_PNG
+#undef IL_NO_PNM
+#undef IL_NO_PSD
+#undef IL_NO_PSP
+#undef IL_NO_PXR
+#undef IL_NO_RAW
+#undef IL_NO_SGI
+#undef IL_NO_TGA
+#undef IL_NO_TIF
+#undef IL_NO_WAL
+#undef IL_NO_XPM
+#undef IL_USE_JPEGLIB_UNMODIFIED
+
+/* Supported api (ilut) */
+
+#undef ILUT_USE_ALLEGRO
+#undef ILUT_USE_DIRECTX8
+#undef ILUT_USE_DIRECTX9
+#undef ILUT_USE_OPENGL
+#undef ILUT_USE_SDL
+#undef ILUT_USE_WIN32
+
+
+/* Define if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if your processor stores words with the most significant byte first
+   (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+/* Define if the X Window System is missing or not being used. */
+#undef X_DISPLAY_MISSING
+#endif /* __CONFIG_H__ */
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/Makefile.in
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/Makefile.in	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/Makefile.in	(revision 191)
@@ -0,0 +1,433 @@
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEVIL_LTVERSION = @DEVIL_LTVERSION@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+HALLEGRO = @HALLEGRO@
+HSDL = @HSDL@
+IL_NO_BMP_FALSE = @IL_NO_BMP_FALSE@
+IL_NO_BMP_TRUE = @IL_NO_BMP_TRUE@
+IL_NO_DCX_FALSE = @IL_NO_DCX_FALSE@
+IL_NO_DCX_TRUE = @IL_NO_DCX_TRUE@
+IL_NO_DDS_FALSE = @IL_NO_DDS_FALSE@
+IL_NO_DDS_TRUE = @IL_NO_DDS_TRUE@
+IL_NO_DOOM_FALSE = @IL_NO_DOOM_FALSE@
+IL_NO_DOOM_TRUE = @IL_NO_DOOM_TRUE@
+IL_NO_GIF_FALSE = @IL_NO_GIF_FALSE@
+IL_NO_GIF_TRUE = @IL_NO_GIF_TRUE@
+IL_NO_ICO_FALSE = @IL_NO_ICO_FALSE@
+IL_NO_ICO_TRUE = @IL_NO_ICO_TRUE@
+IL_NO_JPG_FALSE = @IL_NO_JPG_FALSE@
+IL_NO_JPG_TRUE = @IL_NO_JPG_TRUE@
+IL_NO_LCMS_FALSE = @IL_NO_LCMS_FALSE@
+IL_NO_LCMS_TRUE = @IL_NO_LCMS_TRUE@
+IL_NO_LIF_FALSE = @IL_NO_LIF_FALSE@
+IL_NO_LIF_TRUE = @IL_NO_LIF_TRUE@
+IL_NO_MDL_FALSE = @IL_NO_MDL_FALSE@
+IL_NO_MDL_TRUE = @IL_NO_MDL_TRUE@
+IL_NO_MNG_FALSE = @IL_NO_MNG_FALSE@
+IL_NO_MNG_TRUE = @IL_NO_MNG_TRUE@
+IL_NO_PCD_FALSE = @IL_NO_PCD_FALSE@
+IL_NO_PCD_TRUE = @IL_NO_PCD_TRUE@
+IL_NO_PCX_FALSE = @IL_NO_PCX_FALSE@
+IL_NO_PCX_TRUE = @IL_NO_PCX_TRUE@
+IL_NO_PIC_FALSE = @IL_NO_PIC_FALSE@
+IL_NO_PIC_TRUE = @IL_NO_PIC_TRUE@
+IL_NO_PIX_FALSE = @IL_NO_PIX_FALSE@
+IL_NO_PIX_TRUE = @IL_NO_PIX_TRUE@
+IL_NO_PNG_FALSE = @IL_NO_PNG_FALSE@
+IL_NO_PNG_TRUE = @IL_NO_PNG_TRUE@
+IL_NO_PNM_FALSE = @IL_NO_PNM_FALSE@
+IL_NO_PNM_TRUE = @IL_NO_PNM_TRUE@
+IL_NO_PSD_FALSE = @IL_NO_PSD_FALSE@
+IL_NO_PSD_TRUE = @IL_NO_PSD_TRUE@
+IL_NO_PSP_FALSE = @IL_NO_PSP_FALSE@
+IL_NO_PSP_TRUE = @IL_NO_PSP_TRUE@
+IL_NO_PXR_FALSE = @IL_NO_PXR_FALSE@
+IL_NO_PXR_TRUE = @IL_NO_PXR_TRUE@
+IL_NO_RAW_FALSE = @IL_NO_RAW_FALSE@
+IL_NO_RAW_TRUE = @IL_NO_RAW_TRUE@
+IL_NO_SGI_FALSE = @IL_NO_SGI_FALSE@
+IL_NO_SGI_TRUE = @IL_NO_SGI_TRUE@
+IL_NO_TGA_FALSE = @IL_NO_TGA_FALSE@
+IL_NO_TGA_TRUE = @IL_NO_TGA_TRUE@
+IL_NO_TIF_FALSE = @IL_NO_TIF_FALSE@
+IL_NO_TIF_TRUE = @IL_NO_TIF_TRUE@
+IL_NO_WAL_FALSE = @IL_NO_WAL_FALSE@
+IL_NO_WAL_TRUE = @IL_NO_WAL_TRUE@
+IL_NO_XPM_FALSE = @IL_NO_XPM_FALSE@
+IL_NO_XPM_TRUE = @IL_NO_XPM_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBALLEGRO = @LIBALLEGRO@
+LIBGDI32 = @LIBGDI32@
+LIBGL = @LIBGL@
+LIBILUT_CFLAGS = @LIBILUT_CFLAGS@
+LIBILUT_WIN32LIBPATH = @LIBILUT_WIN32LIBPATH@
+LIBILU_CFLAGS = @LIBILU_CFLAGS@
+LIBIL_CFLAGS = @LIBIL_CFLAGS@
+LIBJPG = @LIBJPG@
+LIBLCMS = @LIBLCMS@
+LIBMNG = @LIBMNG@
+LIBOBJS = @LIBOBJS@
+LIBPNG = @LIBPNG@
+LIBS = @LIBS@
+LIBSDL = @LIBSDL@
+LIBTIFF = @LIBTIFF@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+VERSIONINFO = @VERSIONINFO@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+allegro_config = @allegro_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sdl_major_version = @sdl_major_version@
+sdl_micro_version = @sdl_micro_version@
+sdl_minor_version = @sdl_minor_version@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+ILincludedir = $(includedir)/IL
+
+ILinclude_HEADERS = il.h ilu.h ilut.h il_wrap.h config.h devil_internal_exports.h ilu_region.h
+subdir = include/IL
+mkinstalldirs = $(SHELL) $(top_srcdir)/libtools/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+depcomp =
+am__depfiles_maybe =
+DIST_SOURCES =
+HEADERS = $(ILinclude_HEADERS)
+
+all: config.h
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --cygnus  include/IL/Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+config.h: stamp-h1
+	@if test ! -f $@; then \
+	  rm -f stamp-h1; \
+	  $(MAKE) stamp-h1; \
+	else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+	@rm -f stamp-h1
+	cd $(top_builddir) && $(SHELL) ./config.status include/IL/config.h
+
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h
+	cd $(top_srcdir) && $(AUTOHEADER)
+	touch $(srcdir)/config.h.in
+
+distclean-hdr:
+	-rm -f config.h stamp-h1
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+ILincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+install-ILincludeHEADERS: $(ILinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(ILincludedir)
+	@list='$(ILinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " $(ILincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(ILincludedir)/$$f"; \
+	  $(ILincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(ILincludedir)/$$f; \
+	done
+
+uninstall-ILincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(ILinclude_HEADERS)'; for p in $$list; do \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " rm -f $(DESTDIR)$(ILincludedir)/$$f"; \
+	  rm -f $(DESTDIR)$(ILincludedir)/$$f; \
+	done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+check-am:
+check: check-am
+all-am: Makefile $(HEADERS) config.h
+
+installdirs:
+	$(mkinstalldirs) $(DESTDIR)$(ILincludedir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-ILincludeHEADERS
+
+install-exec-am:
+
+install-info:
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-ILincludeHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool ctags distclean distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags dvi dvi-am info info-am \
+	install install-ILincludeHEADERS install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+	uninstall-ILincludeHEADERS uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/ilu_region.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/ilu_region.h	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/ilu_region.h	(revision 191)
@@ -0,0 +1,27 @@
+//-----------------------------------------------------------------------------
+//
+// ImageLib Utility Sources
+// Copyright (C) 2000-2002 by Denton Woods
+// Last modified: 07/09/2002 <--Y2K Compliant! =]
+//
+// Filename: src-ILU/src/ilu_region.h
+//
+// Description: Creates an image region.
+//
+//-----------------------------------------------------------------------------
+
+#ifndef ILU_REGION_H
+#define ILU_REGION_H
+
+#include "ilu_internal.h"
+
+
+typedef struct Edge
+{
+	ILint	yUpper;
+	ILfloat	xIntersect, dxPerScan;
+	struct	Edge *next;
+} Edge;
+
+
+#endif//ILU_REGION_H
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/il_wrap.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/il_wrap.h	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/il_wrap.h	(revision 191)
@@ -0,0 +1,205 @@
+#ifndef WRAPPER_H
+#define WRAPPER_H
+
+/*#include <il/il.h>
+#include <il/ilu.h>*/
+#include <il/ilut.h>  // Probably only have to #include this one
+
+#ifdef _MSC_VER
+	#ifndef _IL_WRAP_BUILD_LIB
+		#pragma comment(lib, "il_wrap.lib")
+	#endif
+#endif
+
+class ilImage
+{
+public:
+				ilImage();
+				ilImage(char *);
+				ilImage(const ilImage &);
+	virtual		~ilImage();
+
+	ILboolean	Load(char *);
+	ILboolean	Load(char *, ILenum);
+	ILboolean	Save(char *);
+	ILboolean	Save(char *, ILenum);
+
+
+	// ImageLib functions
+	ILboolean	ActiveImage(ILuint);
+	ILboolean	ActiveLayer(ILuint);
+	ILboolean	ActiveMipmap(ILuint);
+	ILboolean	Clear(ILvoid);
+	ILvoid		ClearColour(ILubyte, ILubyte, ILubyte, ILubyte);
+	ILboolean	Convert(ILenum);
+	ILboolean	Copy(ILuint);
+	ILboolean	Default(ILvoid);
+	ILboolean	Flip(ILvoid);
+	ILboolean	SwapColours(ILvoid);
+	ILboolean	Resize(ILuint, ILuint, ILuint);
+	ILboolean	TexImage(ILuint, ILuint, ILuint, ILubyte, ILenum, ILenum, ILvoid*);
+
+	
+	// Image handling
+	ILvoid		Bind(ILvoid) const;
+	ILvoid		Bind(ILuint);
+	ILvoid		Close(ILvoid) { this->Delete(); }
+	ILvoid		Delete(ILvoid);
+	ILvoid		iGenBind();
+
+
+	// Image characteristics
+	ILuint		Width(ILvoid);
+	ILuint		Height(ILvoid);
+	ILuint		Depth(ILvoid);
+	ILubyte		Bpp(ILvoid);
+	ILubyte		Bitpp(ILvoid);
+	ILenum		PaletteType(ILvoid);
+	ILenum		Format(ILvoid);
+	ILenum		Type(ILvoid);
+	ILuint		NumImages(ILvoid);
+	ILuint		NumMipmaps(ILvoid);
+	ILuint		GetId(ILvoid) const;
+    ILenum      GetOrigin(ILvoid);
+	ILubyte		*GetData(ILvoid);
+	ILubyte		*GetPalette(ILvoid);
+
+
+	// Rendering
+	ILuint		BindImage(ILvoid);
+	ILuint		BindImage(ILenum);
+
+
+	// Operators
+	ilImage&	operator = (ILuint);
+	ilImage&	operator = (const ilImage &);
+
+
+protected:
+	ILuint		Id;
+
+private:
+	ILvoid		iStartUp();
+
+
+};
+
+
+class ilFilters
+{
+public:
+	static ILboolean	Alienify(ilImage &);
+	static ILboolean	BlurAvg(ilImage &, ILuint Iter);
+	static ILboolean	BlurGaussian(ilImage &, ILuint Iter);
+	static ILboolean	Contrast(ilImage &, ILfloat Contrast);
+	static ILboolean	EdgeDetectE(ilImage &);
+	static ILboolean	EdgeDetectP(ilImage &);
+	static ILboolean	EdgeDetectS(ilImage &);
+	static ILboolean	Emboss(ilImage &);
+	static ILboolean	Gamma(ilImage &, ILfloat Gamma);
+	static ILboolean	Negative(ilImage &);
+	static ILboolean	Noisify(ilImage &, ILubyte Factor);
+	static ILboolean	Pixelize(ilImage &, ILuint PixSize);
+	static ILboolean	Saturate(ilImage &, ILfloat Saturation);
+	static ILboolean	Saturate(ilImage &, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation);
+	static ILboolean	ScaleColours(ilImage &, ILfloat r, ILfloat g, ILfloat b);
+	static ILboolean	Sharpen(ilImage &, ILfloat Factor, ILuint Iter);
+};
+
+
+#ifdef ILUT_USE_OPENGL
+class ilOgl
+{
+public:
+	static ILvoid		Init(ILvoid);
+	static GLuint		BindTex(ilImage &);
+	static ILboolean	Upload(ilImage &, ILuint);
+	static GLuint		Mipmap(ilImage &);
+	static ILboolean	Screen(ILvoid);
+	static ILboolean	Screenie(ILvoid);
+};
+#endif//ILUT_USE_OPENGL
+
+
+#ifdef ILUT_USE_ALLEGRO
+class ilAlleg
+{
+public:
+	static ILvoid	Init(ILvoid);
+	static BITMAP	*Convert(ilImage &);
+};
+#endif//ILUT_USE_ALLEGRO
+
+
+#ifdef ILUT_USE_WIN32
+class ilWin32
+{
+public:
+	static ILvoid		Init(ILvoid);
+	static HBITMAP		Convert(ilImage &);
+	static ILboolean	GetClipboard(ilImage &);
+	static ILvoid		GetInfo(ilImage &, BITMAPINFO *Info);
+	static ILubyte		*GetPadData(ilImage &);
+	static HPALETTE		GetPal(ilImage &);
+	static ILboolean	GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType);
+	static ILboolean	GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type);
+	static ILboolean	SetClipboard(ilImage &);
+};
+#endif//ILUT_USE_WIN32
+
+
+class ilValidate
+{
+public:
+	static ILboolean	Valid(ILenum, char *);
+	static ILboolean	Valid(ILenum, FILE *);
+	static ILboolean	Valid(ILenum, ILvoid *, ILuint);
+
+protected:
+
+private:
+
+};
+
+
+class ilState
+{
+public:
+	static ILboolean		Disable(ILenum);
+	static ILboolean		Enable(ILenum);
+	static ILvoid			Get(ILenum, ILboolean &);
+	static ILvoid			Get(ILenum, ILint &);
+	static ILboolean		GetBool(ILenum);
+	static ILint			GetInt(ILenum);
+	static const char		*GetString(ILenum);
+	static ILboolean		IsDisabled(ILenum);
+	static ILboolean		IsEnabled(ILenum);
+	static ILboolean		Origin(ILenum);
+	static ILvoid			Pop(ILvoid);
+	static ILvoid			Push(ILuint);
+
+
+protected:
+
+private:
+
+};
+
+
+class ilError
+{
+public:
+	static ILvoid		Check(ILvoid (*Callback)(const char*));
+	static ILvoid		Check(ILvoid (*Callback)(ILenum));
+	static ILenum		Get(ILvoid);
+	static const char	*String(ILvoid);
+	static const char	*String(ILenum);
+
+protected:
+
+private:
+
+};
+
+
+#endif//WRAPPER_H
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/ilut.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/ilut.h	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/ilut.h	(revision 191)
@@ -0,0 +1,281 @@
+//-----------------------------------------------------------------------------
+//
+// ImageLib Utility Toolkit Sources
+// Copyright (C) 2000-2002 by Denton Woods
+// Last modified: 06/23/2002 <--Y2K Compliant! =]
+//
+// Filename: IL/ilut.h
+//
+// Description: The main include file for ILUT
+//
+//-----------------------------------------------------------------------------
+
+
+#ifndef __ilut_h_
+#ifndef __ILUT_H__
+
+#define __ilut_h_
+#define __ILUT_H__
+
+#include <IL/il.h>
+#include <IL/ilu.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+#ifdef _WIN32
+	#if defined(_MSC_VER) || defined(__BORLANDC__)
+		#ifndef IL_STATIC_LIB
+			#pragma comment(lib, "DevILU_DLL.lib")
+			#ifndef _IL_BUILD_LIBRARY
+				#pragma comment(lib, "DevILUT_DLL.lib")
+			#endif
+		#else
+			#ifndef _IL_BUILD_LIBRARY
+				#ifdef  IL_DEBUG
+					#pragma comment(lib, "DevILUT_DBG.lib")
+				#else
+					#pragma comment(lib, "DevILUT.lib")
+				#endif//IL_DEBUG
+			#endif
+		#endif
+	#endif
+#endif
+*/
+
+#define ILUT_VERSION_1_6_7					1
+#define ILUT_VERSION						167
+
+
+// Attribute Bits
+#define ILUT_OPENGL_BIT						0x00000001
+#define ILUT_D3D_BIT						0x00000002
+#define ILUT_ALL_ATTRIB_BITS				0x000FFFFF
+
+
+// Error Types
+#define ILUT_INVALID_ENUM					0x0501
+#define ILUT_OUT_OF_MEMORY					0x0502
+#define ILUT_INVALID_VALUE					0x0505
+#define ILUT_ILLEGAL_OPERATION				0x0506
+#define ILUT_INVALID_PARAM					0x0509
+#define ILUT_COULD_NOT_OPEN_FILE			0x050A
+#define ILUT_STACK_OVERFLOW					0x050E
+#define ILUT_STACK_UNDERFLOW				0x050F
+#define ILUT_BAD_DIMENSIONS					0x0511
+#define ILUT_NOT_SUPPORTED					0x0550
+
+
+// State Definitions
+#define ILUT_PALETTE_MODE					0x0600
+#define ILUT_OPENGL_CONV					0x0610
+#define ILUT_D3D_MIPLEVELS					0x0620
+#define ILUT_MAXTEX_WIDTH					0x0630
+#define ILUT_MAXTEX_HEIGHT					0x0631
+#define ILUT_MAXTEX_DEPTH					0x0632
+#define ILUT_GL_USE_S3TC					0x0634
+#define ILUT_D3D_USE_DXTC					0x0634
+#define ILUT_GL_GEN_S3TC					0x0635
+#define ILUT_D3D_GEN_DXTC					0x0635
+#define ILUT_S3TC_FORMAT					0x0705
+#define ILUT_DXTC_FORMAT					0x0705
+#define ILUT_D3D_POOL						0x0706
+#define ILUT_D3D_ALPHA_KEY_COLOR			0x0707
+#define ILUT_D3D_ALPHA_KEY_COLOUR			0x0707
+
+//This new state does automatic texture target detection
+//if enabled. Currently, only cubemap detection is supported.
+//if the current image is no cubemap, the 2d texture is chosen.
+#define ILUT_GL_AUTODETECT_TEXTURE_TARGET	0x0807
+
+
+// Values
+#define ILUT_VERSION_NUM					IL_VERSION_NUM
+#define ILUT_VENDOR							IL_VENDOR
+
+
+// ImageLib Utility Toolkit Functions
+ILAPI ILboolean		ILAPIENTRY ilutDisable(ILenum Mode);
+ILAPI ILboolean		ILAPIENTRY ilutEnable(ILenum Mode);
+ILAPI ILboolean		ILAPIENTRY ilutGetBoolean(ILenum Mode);
+ILAPI ILvoid		ILAPIENTRY ilutGetBooleanv(ILenum Mode, ILboolean *Param);
+ILAPI ILint			ILAPIENTRY ilutGetInteger(ILenum Mode);
+ILAPI ILvoid		ILAPIENTRY ilutGetIntegerv(ILenum Mode, ILint *Param);
+ILAPI const ILstring		ILAPIENTRY ilutGetString(ILenum StringName);
+ILAPI ILvoid		ILAPIENTRY ilutInit(ILvoid);
+ILAPI ILboolean		ILAPIENTRY ilutIsDisabled(ILenum Mode);
+ILAPI ILboolean		ILAPIENTRY ilutIsEnabled(ILenum Mode);
+ILAPI ILvoid		ILAPIENTRY ilutPopAttrib(ILvoid);
+ILAPI ILvoid		ILAPIENTRY ilutPushAttrib(ILuint Bits);
+ILAPI ILvoid		ILAPIENTRY ilutSetInteger(ILenum Mode, ILint Param);
+
+
+// The different rendering api's...more to be added later?
+#define ILUT_OPENGL		0
+#define ILUT_ALLEGRO	1
+#define ILUT_WIN32		2
+#define ILUT_DIRECT3D8	3
+#define	ILUT_DIRECT3D9	4
+
+
+ILAPI ILboolean	ILAPIENTRY ilutRenderer(ILenum Renderer);
+
+// Includes specific config
+#ifdef DJGPP
+	#define ILUT_USE_ALLEGRO
+#elif _WIN32_WCE
+	#define ILUT_USE_WIN32
+#elif _WIN32
+	//#ifdef __GNUC__ //__CYGWIN32__ (Cygwin seems to not define this with DevIL builds)
+		#include "config.h"
+
+		/*// Temporary fix for the SDL main() linker bug.
+		#ifdef  ILUT_USE_SDL
+		#undef  ILUT_USE_SDL
+		#endif//ILUT_USE_SDL*/
+
+	/*#else
+	  	#define ILUT_USE_WIN32
+		#define ILUT_USE_OPENGL
+		#define ILUT_USE_SDL
+		#define ILUT_USE_DIRECTX8
+	#endif*/
+#elif BEOS  // Don't know the #define
+	#define ILUT_USE_BEOS
+	#define ILUT_USE_OPENGL
+#elif MACOSX
+	#define ILUT_USE_OPENGL
+#else
+	/*
+	* We are surely using a *nix so the configure script
+	* may have written the configured config.h header
+	*/
+	#include "config.h"
+#endif
+
+// ImageLib Utility Toolkit's OpenGL Functions
+#ifdef ILUT_USE_OPENGL
+	#if defined(_MSC_VER) || defined(_WIN32)
+		//#define WIN32_LEAN_AND_MEAN
+		#include <windows.h>
+	#endif//_MSC_VER
+
+	#ifdef __APPLE__
+		#include <OpenGL/gl.h>
+		#include <OpenGL/glu.h>
+	#else
+	 	#include <GL/gl.h>
+ 		#include <GL/glu.h>
+	#endif//__APPLE__
+
+	ILAPI GLuint	ILAPIENTRY ilutGLBindTexImage();
+	ILAPI GLuint	ILAPIENTRY ilutGLBindMipmaps(ILvoid);
+	ILAPI ILboolean	ILAPIENTRY ilutGLBuildMipmaps(ILvoid);
+	ILAPI GLuint	ILAPIENTRY ilutGLLoadImage(const ILstring FileName);
+	ILAPI ILboolean	ILAPIENTRY ilutGLScreen(ILvoid);
+	ILAPI ILboolean	ILAPIENTRY ilutGLScreenie(ILvoid);
+	ILAPI ILboolean	ILAPIENTRY ilutGLSaveImage(const ILstring FileName, GLuint TexID);
+	ILAPI ILboolean	ILAPIENTRY ilutGLSetTex(GLuint TexID);
+	ILAPI ILboolean	ILAPIENTRY ilutGLTexImage(GLuint Level);
+
+#endif//ILUT_USE_OPENGL
+
+
+// ImageLib Utility Toolkit's Allegro Functions
+#ifdef ILUT_USE_ALLEGRO
+	#include <allegro.h>
+	ILAPI BITMAP* ILAPIENTRY ilutAllegLoadImage(const ILstring FileName);
+	ILAPI BITMAP* ILAPIENTRY ilutConvertToAlleg(PALETTE Pal);
+#endif//ILUT_USE_ALLEGRO
+
+
+// ImageLib Utility Toolkit's SDL Functions
+#ifdef ILUT_USE_SDL
+	#include <SDL.h>
+	ILAPI SDL_Surface*	ILAPIENTRY ilutConvertToSDLSurface(unsigned int flags);
+	ILAPI SDL_Surface*	ILAPIENTRY ilutSDLSurfaceLoadImage(const ILstring FileName);
+	ILAPI ILboolean		ILAPIENTRY ilutSDLSurfaceFromBitmap(SDL_Surface *Bitmap);
+#endif//ILUT_USE_SDL
+
+
+// ImageLib Utility Toolkit's BeOS Functions
+#ifdef  ILUT_USE_BEOS
+	ILAPI BBitmap ILAPIENTRY ilutConvertToBBitmap(ILvoid);
+#endif//ILUT_USE_BEOS
+
+
+// ImageLib Utility Toolkit's Win32 GDI Functions
+#ifdef ILUT_USE_WIN32
+	#ifdef _WIN32
+		//#define WIN32_LEAN_AND_MEAN
+		#include <windows.h>
+		ILAPI HBITMAP	ILAPIENTRY ilutConvertToHBitmap(HDC hDC);
+		ILAPI ILvoid	ILAPIENTRY ilutFreePaddedData(ILubyte *Data);
+		ILAPI ILvoid	ILAPIENTRY ilutGetBmpInfo(BITMAPINFO *Info);
+		ILAPI HPALETTE	ILAPIENTRY ilutGetHPal(ILvoid);
+		ILAPI ILubyte*	ILAPIENTRY ilutGetPaddedData(ILvoid);
+		ILAPI ILboolean	ILAPIENTRY ilutGetWinClipboard(ILvoid);
+		ILAPI ILboolean	ILAPIENTRY ilutLoadResource(HINSTANCE hInst, ILint ID, const ILstring ResourceType, ILenum Type);
+		ILAPI ILboolean	ILAPIENTRY ilutSetHBitmap(HBITMAP Bitmap);
+		ILAPI ILboolean	ILAPIENTRY ilutSetHPal(HPALETTE Pal);
+		ILAPI ILboolean	ILAPIENTRY ilutSetWinClipboard(ILvoid);
+		ILAPI HBITMAP	ILAPIENTRY ilutWinLoadImage(const ILstring FileName, HDC hDC);
+		ILAPI ILboolean	ILAPIENTRY ilutWinLoadUrl(const ILstring Url);
+		ILAPI ILboolean ILAPIENTRY ilutWinPrint(ILuint XPos, ILuint YPos, ILuint Width, ILuint Height, HDC hDC);
+		ILAPI ILboolean	ILAPIENTRY ilutWinSaveImage(const ILstring FileName, HBITMAP Bitmap);
+
+	#endif//_WIN32
+#endif//ILUT_USE_WIN32
+
+
+#ifdef ILUT_USE_DIRECTX9
+	#ifdef _WIN32
+//		#include <d3d9.h>
+//		ILAPI ILvoid	ILAPIENTRY ilutD3D9MipFunc(ILuint NumLevels);
+		ILAPI struct IDirect3DTexture9* ILAPIENTRY ilutD3D9Texture(struct IDirect3DDevice9 *Device);
+		ILAPI struct IDirect3DVolumeTexture9* ILAPIENTRY ilutD3D9VolumeTexture(struct IDirect3DDevice9 *Device);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D9TexFromFile(struct IDirect3DDevice9 *Device, char *FileName, struct IDirect3DTexture9 **Texture);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D9VolTexFromFile(struct IDirect3DDevice9 *Device, char *FileName, struct IDirect3DVolumeTexture9 **Texture);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D9TexFromFileInMemory(struct IDirect3DDevice9 *Device, ILvoid *Lump, ILuint Size, struct IDirect3DTexture9 **Texture);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D9VolTexFromFileInMemory(struct IDirect3DDevice9 *Device, ILvoid *Lump, ILuint Size, struct IDirect3DVolumeTexture9 **Texture);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D9TexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DTexture9 **Texture);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D9VolTexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DVolumeTexture9 **Texture);
+		// These two are not tested yet.
+		ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DTexture9 **Texture);
+		ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DVolumeTexture9 **Texture);
+
+		ILAPI ILboolean ILAPIENTRY ilutD3D9LoadSurface(struct IDirect3DDevice9 *Device, struct IDirect3DSurface9 *Surface);
+	#endif//_WIN32
+#endif//ILUT_USE_DIRECTX9
+
+// ImageLib Utility Toolkit's DirectX 8 Functions
+#ifdef ILUT_USE_DIRECTX8
+	#ifdef _WIN32
+//		#ifndef	_D3D8_H_
+//		#include <d3d8.h>
+//		#endif
+//		ILAPI ILvoid	ILAPIENTRY ilutD3D8MipFunc(ILuint NumLevels);
+		ILAPI struct IDirect3DTexture8* ILAPIENTRY ilutD3D8Texture(struct IDirect3DDevice8 *Device);
+		ILAPI struct IDirect3DVolumeTexture8* ILAPIENTRY ilutD3D8VolumeTexture(struct IDirect3DDevice8 *Device);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D8TexFromFile(struct IDirect3DDevice8 *Device, char *FileName, struct IDirect3DTexture8 **Texture);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D8VolTexFromFile(struct IDirect3DDevice8 *Device, char *FileName, struct IDirect3DVolumeTexture8 **Texture);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D8TexFromFileInMemory(struct IDirect3DDevice8 *Device, ILvoid *Lump, ILuint Size, struct IDirect3DTexture8 **Texture);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D8VolTexFromFileInMemory(struct IDirect3DDevice8 *Device, ILvoid *Lump, ILuint Size, struct IDirect3DVolumeTexture8 **Texture);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D8TexFromFileHandle(struct IDirect3DDevice8 *Device, ILHANDLE File, struct IDirect3DTexture8 **Texture);
+		ILAPI ILboolean	ILAPIENTRY ilutD3D8VolTexFromFileHandle(struct IDirect3DDevice8 *Device, ILHANDLE File, struct IDirect3DVolumeTexture8 **Texture);
+		// These two are not tested yet.
+		ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromResource(struct IDirect3DDevice8 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DTexture8 **Texture);
+		ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromResource(struct IDirect3DDevice8 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DVolumeTexture8 **Texture);
+
+		ILAPI ILboolean ILAPIENTRY ilutD3D8LoadSurface(struct IDirect3DDevice8 *Device, struct IDirect3DSurface8 *Surface);
+	#endif//_WIN32
+#endif//ILUT_USE_DIRECTX8
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __ILUT_H__
+#endif // __ilut_h_
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/Makefile.am
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/Makefile.am	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/Makefile.am	(revision 191)
@@ -0,0 +1,3 @@
+ILincludedir = $(includedir)/IL
+
+ILinclude_HEADERS = il.h ilu.h ilut.h il_wrap.h config.h devil_internal_exports.h ilu_region.h
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/devil_internal_exports.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/devil_internal_exports.h	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/devil_internal_exports.h	(revision 191)
@@ -0,0 +1,125 @@
+//-----------------------------------------------------------------------------
+//
+// ImageLib Sources
+// Copyright (C) 2000-2002 by Denton Woods
+// Last modified: 02/19/2002 <--Y2K Compliant! =]
+//
+// Filename: IL/devil_internal_exports.h
+//
+// Description: Internal stuff for DevIL (IL, ILU and ILUT)
+//
+//-----------------------------------------------------------------------------
+
+#ifndef IL_EXPORTS_H
+#define IL_EXPORTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define IL_MAX(a,b) (((a) > (b)) ? (a) : (b))
+#define IL_MIN(a,b) (((a) < (b)) ? (a) : (b))
+
+
+// Basic Palette struct
+typedef struct ILpal
+{
+	ILubyte	*Palette;		// the image palette (if any)
+	ILuint	PalSize;		// size of the palette (in bytes)
+	ILenum	PalType;		// the palette types below (0x0500 range)
+} ILpal;
+
+
+// The Fundamental Image struct
+typedef struct ILimage
+{
+	ILuint	Width;				// the image's width
+	ILuint	Height;				// the image's height
+	ILuint	Depth;				// the image's depth
+	ILubyte	Bpp;				// bytes per pixel (now number of channels)
+	ILubyte	Bpc;				// bytes per channel
+	ILuint	Bps;				// bytes per scanline (components for IL)
+	ILubyte	*Data;				// the image data
+	ILuint	SizeOfData;			// the total size of the data (in bytes)
+	ILuint	SizeOfPlane;		// SizeOfData in a 2d image, size of each plane slice in a 3d image (in bytes)
+	ILenum	Format;				// image format (in IL enum style)
+	ILenum	Type;				// image type (in IL enum style)
+	ILenum	Origin;				// origin of the image
+	ILpal	Pal;				// palette details
+	ILuint	Duration;			// length of the time to display this "frame"
+	ILenum	CubeFlags;			// cube map flags for sides present in chain
+	struct	ILimage *Mipmaps;	// mipmapped versions of this image terminated by a NULL - usu. NULL
+	struct	ILimage *Next;		// next image in the chain - usu. NULL
+	struct	ILimage *Layers;	// subsequent layers in the chain - usu. NULL
+	ILuint	NumNext;			// number of images following this one (0 when not parent)
+	ILuint	NumMips;			// number of mipmaps (0 when not parent)
+	ILuint	NumLayers;			// number of layers (0 when not parent)
+	ILuint	*AnimList;			// animation list
+	ILuint	AnimSize;			// animation list size
+	ILvoid	*Profile;			// colour profile
+	ILuint	ProfileSize;		// colour profile size
+	ILuint	OffX, OffY;			// offset of the image
+	ILubyte	*DxtcData;			// compressed data
+	ILenum	DxtcFormat;			// compressed data format
+	ILuint	DxtcSize;			// compressed data size
+} ILimage;
+
+
+// Memory functions
+ILAPI ILvoid*	ILAPIENTRY ialloc(ILuint Size);
+ILAPI ILvoid	ILAPIENTRY ifree(ILvoid *Ptr);
+ILAPI ILvoid*	ILAPIENTRY icalloc(ILuint Size, ILuint Num);
+
+
+
+// Internal library functions in IL
+ILAPI ILimage*		ILAPIENTRY ilGetCurImage(ILvoid);
+ILAPI ILvoid		ILAPIENTRY ilSetCurImage(ILimage *Image);
+ILAPI ILvoid		ILAPIENTRY ilSetError(ILenum Error);
+ILAPI ILvoid		ILAPIENTRY ilSetPal(ILpal *Pal);
+
+//
+// Utility functions
+//
+ILAPI ILubyte	ILAPIENTRY ilGetBppFormat(ILenum Format);
+ILAPI ILubyte	ILAPIENTRY ilGetBppPal(ILenum PalType);
+ILAPI ILubyte	ILAPIENTRY ilGetBppType(ILenum Type);
+ILAPI ILenum	ILAPIENTRY ilGetTypeBpc(ILubyte Bpc);
+ILAPI ILenum	ILAPIENTRY ilGetPalBaseType(ILenum PalType);
+ILAPI ILuint	ILAPIENTRY ilNextPower2(ILuint Num);
+ILAPI ILenum	ILAPIENTRY ilTypeFromExt(const ILstring FileName);
+ILAPI ILvoid ILAPIENTRY ilReplaceCurImage(ILimage *Image);
+
+//
+// Image functions
+//
+ILAPI ILvoid	ILAPIENTRY	iBindImageTemp(ILvoid);
+ILAPI ILboolean ILAPIENTRY	ilClearImage_(ILimage *Image);
+ILAPI ILvoid	ILAPIENTRY	ilCloseImage(ILimage *Image);
+ILAPI ILvoid	ILAPIENTRY	ilClosePal(ILpal *Palette);
+ILAPI ILpal*	ILAPIENTRY	iCopyPal(ILvoid);
+ILAPI ILboolean	ILAPIENTRY	ilCopyImageAttr(ILimage *Dest, ILimage *Src);
+ILAPI ILimage*	ILAPIENTRY	ilCopyImage_(ILimage *Src);
+ILAPI ILvoid	ILAPIENTRY	ilGetClear(ILvoid *Colours, ILenum Format, ILenum Type);
+ILAPI ILuint	ILAPIENTRY	ilGetCurName(ILvoid);
+ILAPI ILboolean	ILAPIENTRY	ilIsValidPal(ILpal *Palette);
+ILAPI ILimage*	ILAPIENTRY	ilNewImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILubyte Bpc);
+ILAPI ILboolean ILAPIENTRY	ilResizeImage(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILubyte Bpc);
+ILAPI ILboolean ILAPIENTRY	ilTexImage_(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, ILvoid *Data);
+ILAPI ILboolean ILAPIENTRY	ilTexSubImage_(ILimage *Image, ILvoid *Data);
+ILAPI ILvoid*	ILAPIENTRY	ilConvertBuffer(ILuint SizeOfData, ILenum SrcFormat, ILenum DestFormat, ILenum SrcType, ILenum DestType, ILvoid *Buffer);
+ILAPI ILimage*	ILAPIENTRY	iConvertImage(ILimage *Image, ILenum DestFormat, ILenum DestType);
+ILAPI ILpal*	ILAPIENTRY	iConvertPal(ILpal *Pal, ILenum DestFormat);
+ILAPI ILubyte*	ILAPIENTRY	iGetFlipped(ILimage *Image);
+
+
+// Internal library functions in ILU
+ILAPI ILimage* ILAPIENTRY iluRotate_(ILimage *Image, ILfloat Angle);
+ILAPI ILimage* ILAPIENTRY iluRotate3D_(ILimage *Image, ILfloat x, ILfloat y, ILfloat z, ILfloat Angle);
+ILAPI ILimage* ILAPIENTRY iluScale_(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif//IL_EXPORTS_H
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/il.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/il.h	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/il.h	(revision 191)
@@ -0,0 +1,594 @@
+//-----------------------------------------------------------------------------
+//
+// ImageLib Sources
+// Copyright (C) 2000-2002 by Denton Woods
+// Last modified: 06/23/2002 <--Y2K Compliant! =]
+//
+// Filename: IL/il.h
+//
+// Description: The main include file for DevIL
+//
+//-----------------------------------------------------------------------------
+
+
+#ifndef __il_h_
+#ifndef __IL_H__
+
+#define __il_h_
+#define __IL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//#define IL_NO_BMP
+//#define IL_NO_CUT
+//#define IL_NO_CHEAD
+//#define IL_NO_DCX
+//#define IL_NO_DDS
+//#define IL_NO_DOOM
+//#define IL_NO_GIF
+//#define IL_NO_ICO
+//#define IL_NO_JPG
+//#define IL_NO_LIF
+//#define IL_NO_MDL
+//#define IL_NO_MNG
+//#define IL_NO_PCD
+//#define IL_NO_PCX
+//#define IL_NO_PIC
+//#define IL_NO_PIX
+//#define IL_NO_PNG
+//#define IL_NO_PNM
+//#define IL_NO_PSD
+//#define IL_NO_PSP
+//#define IL_NO_PXR
+//#define IL_NO_RAW
+//#define IL_NO_SGI
+//#define IL_NO_TGA
+//#define IL_NO_TIF
+//#define IL_NO_WAL
+//#define IL_NO_XPM
+
+// Compiling Options
+#define IL_INLINE_ASM
+//#define IL_DEBUG
+//#define IL_STATIC_LIB
+//#define IL_NO_LCMS
+#ifdef _WIN32
+	#ifndef IL_USE_JPEGLIB_UNMODIFIED
+		#define IL_USE_JPEGLIB_UNMODIFIED
+	#endif
+#endif
+
+#ifdef _WIN32_WCE
+	#define IL_NO_GIF
+	#define IL_NO_JPG
+	#define IL_NO_MNG
+	#define IL_NO_PNG
+	#define IL_NO_TIF
+	#define IL_NO_LCMS
+#endif//_WIN32_WCE
+
+#ifdef DJGPP
+	#define IL_NO_GIF
+	#define IL_NO_JPG
+	#define IL_NO_MNG
+	#define IL_NO_PNG
+	#define IL_NO_TIF
+	#define IL_NO_LCMS
+#endif//DJGPP
+
+/*#ifdef __APPLE__
+	#define IL_NO_GIF
+	#define IL_NO_JPG
+	#define IL_NO_MNG
+	#define IL_NO_PNG
+	#define IL_NO_TIF
+	#define IL_NO_LCMS
+#endif//__APPLE__*/
+
+/*
+#ifdef _WIN32
+	#if defined(_MSC_VER) || defined(__BORLANDC__)
+		#ifndef IL_STATIC_LIB
+			#ifndef _IL_BUILD_LIBRARY
+				#pragma comment(lib, "Devil_DLL.lib")
+			#endif
+		#else
+			#ifndef _IL_BUILD_LIBRARY
+				#ifdef  IL_DEBUG
+					#pragma comment(lib, "Devil_DBG.lib")
+				#else
+					#pragma comment(lib, "Devil.lib")
+				#endif//IL_DEBUG
+			#endif
+		#endif
+	#endif
+#endif
+*/
+#include <stdio.h>
+
+typedef unsigned int	ILenum;
+typedef unsigned char	ILboolean;
+typedef unsigned int	ILbitfield;
+typedef char			ILbyte;
+typedef short			ILshort;
+typedef int				ILint;
+typedef int				ILsizei;
+typedef unsigned char	ILubyte;
+typedef unsigned short	ILushort;
+typedef unsigned int	ILuint;
+typedef float			ILfloat;
+typedef float			ILclampf;
+typedef double			ILdouble;
+typedef double			ILclampd;
+typedef void			ILvoid;
+
+#ifdef _UNICODE
+	#ifndef _WIN32_WCE
+		#include <wchar.h>
+	#endif
+	typedef wchar_t* ILstring;
+#else
+	typedef char* ILstring;
+#endif//_UNICODE
+
+
+#define IL_FALSE							0
+#define IL_TRUE								1
+
+
+// Matches OpenGL's right now.
+#define IL_COLOUR_INDEX							0x1900
+#define IL_COLOR_INDEX							0x1900
+#define IL_RGB								0x1907
+#define IL_RGBA								0x1908
+#define IL_BGR								0x80E0
+#define IL_BGRA								0x80E1
+#define IL_LUMINANCE							0x1909
+#define IL_LUMINANCE_ALPHA						0x190A
+
+
+#define IL_BYTE								0x1400
+#define IL_UNSIGNED_BYTE						0x1401
+#define IL_SHORT							0x1402
+#define IL_UNSIGNED_SHORT						0x1403
+#define IL_INT								0x1404
+#define IL_UNSIGNED_INT							0x1405
+#define IL_FLOAT							0x1406
+#define IL_DOUBLE							0x140A
+
+
+#define IL_VENDOR							0x1F00
+#define IL_LOAD_EXT							0x1F01
+#define IL_SAVE_EXT							0x1F02
+
+
+//
+// IL-specific #define's
+//
+
+#define IL_VERSION_1_6_7					1
+#define IL_VERSION							167
+
+
+// Attribute Bits
+#define IL_ORIGIN_BIT						0x00000001
+#define IL_FILE_BIT						0x00000002
+#define IL_PAL_BIT						0x00000004
+#define IL_FORMAT_BIT						0x00000008
+#define IL_TYPE_BIT						0x00000010
+#define IL_COMPRESS_BIT						0x00000020
+#define IL_LOADFAIL_BIT						0x00000040
+#define IL_FORMAT_SPECIFIC_BIT					0x00000080
+#define IL_ALL_ATTRIB_BITS					0x000FFFFF
+
+
+// Palette types
+#define IL_PAL_NONE						0x0400
+#define IL_PAL_RGB24						0x0401
+#define IL_PAL_RGB32						0x0402
+#define IL_PAL_RGBA32						0x0403
+#define IL_PAL_BGR24						0x0404
+#define IL_PAL_BGR32						0x0405
+#define IL_PAL_BGRA32						0x0406
+
+
+// Image types
+#define IL_TYPE_UNKNOWN						0x0000
+#define IL_BMP								0x0420
+#define IL_CUT								0x0421
+#define IL_DOOM								0x0422
+#define IL_DOOM_FLAT						0x0423
+#define IL_ICO								0x0424
+#define IL_JPG								0x0425
+#define IL_JFIF								0x0425
+#define IL_LBM								0x0426
+#define IL_PCD								0x0427
+#define IL_PCX								0x0428
+#define IL_PIC								0x0429
+#define IL_PNG								0x042A
+#define IL_PNM								0x042B
+#define IL_SGI								0x042C
+#define IL_TGA								0x042D
+#define IL_TIF								0x042E
+#define IL_CHEAD							0x042F
+#define IL_RAW								0x0430
+#define IL_MDL								0x0431
+#define IL_WAL								0x0432
+#define IL_LIF								0x0434
+#define IL_MNG								0x0435
+#define IL_JNG								0x0435
+#define IL_GIF								0x0436
+#define IL_DDS								0x0437
+#define IL_DCX								0x0438
+#define IL_PSD								0x0439
+#define IL_EXIF								0x043A
+#define IL_PSP								0x043B
+#define IL_PIX								0x043C
+#define IL_PXR								0x043D
+#define IL_XPM								0x043E
+
+#define IL_JASC_PAL							0x0475
+
+
+// Error Types
+#define IL_NO_ERROR							0x0000
+#define IL_INVALID_ENUM						0x0501
+#define IL_OUT_OF_MEMORY					0x0502
+#define IL_FORMAT_NOT_SUPPORTED				0x0503
+#define IL_INTERNAL_ERROR					0x0504
+#define IL_INVALID_VALUE					0x0505
+#define IL_ILLEGAL_OPERATION				0x0506
+#define IL_ILLEGAL_FILE_VALUE				0x0507
+#define IL_INVALID_FILE_HEADER				0x0508
+#define IL_INVALID_PARAM					0x0509
+#define IL_COULD_NOT_OPEN_FILE				0x050A
+#define IL_INVALID_EXTENSION				0x050B
+#define IL_FILE_ALREADY_EXISTS				0x050C
+#define IL_OUT_FORMAT_SAME					0x050D
+#define IL_STACK_OVERFLOW					0x050E
+#define IL_STACK_UNDERFLOW					0x050F
+#define IL_INVALID_CONVERSION				0x0510
+#define IL_BAD_DIMENSIONS					0x0511
+#define IL_FILE_READ_ERROR					0x0512  // 05/12/2002: Addition by Sam.
+#define IL_FILE_WRITE_ERROR					0x0512
+
+#define IL_LIB_GIF_ERROR					0x05E1
+#define IL_LIB_JPEG_ERROR					0x05E2
+#define IL_LIB_PNG_ERROR					0x05E3
+#define IL_LIB_TIFF_ERROR					0x05E4
+#define IL_LIB_MNG_ERROR					0x05E5
+#define IL_UNKNOWN_ERROR					0x05FF
+
+
+// Origin Definitions
+#define IL_ORIGIN_SET						0x0600
+#define IL_ORIGIN_LOWER_LEFT				0x0601
+#define IL_ORIGIN_UPPER_LEFT				0x0602
+#define IL_ORIGIN_MODE						0x0603
+
+
+// Format and Type Mode Definitions
+#define IL_FORMAT_SET						0x0610
+#define IL_FORMAT_MODE						0x0611
+#define IL_TYPE_SET							0x0612
+#define IL_TYPE_MODE						0x0613
+
+
+// File definitions
+#define IL_FILE_OVERWRITE					0x0620
+#define IL_FILE_MODE						0x0621
+
+
+// Palette definitions
+#define IL_CONV_PAL							0x0630
+
+
+// Load fail definitions
+#define IL_DEFAULT_ON_FAIL					0x0632
+
+
+// Key colour definitions
+#define IL_USE_KEY_COLOUR					0x0635
+#define IL_USE_KEY_COLOR					0x0635
+
+
+// Interlace definitions
+#define IL_SAVE_INTERLACED					0x0639
+#define IL_INTERLACE_MODE					0x063A
+
+
+// Quantization definitions
+#define IL_QUANTIZATION_MODE				0x0640
+#define IL_WU_QUANT							0x0641
+#define IL_NEU_QUANT						0x0642
+#define IL_NEU_QUANT_SAMPLE					0x0643
+#define IL_MAX_QUANT_INDEXS					0x0644	//XIX : ILint : Maximum number of colors to reduce to, default of 256. and has a range of 2-256
+
+
+// Hints
+#define IL_FASTEST							0x0660
+#define IL_LESS_MEM							0x0661
+#define IL_DONT_CARE						0x0662
+#define IL_MEM_SPEED_HINT					0x0665
+#define IL_USE_COMPRESSION					0x0666
+#define IL_NO_COMPRESSION					0x0667
+#define IL_COMPRESSION_HINT					0x0668
+
+
+// Subimage types
+#define IL_SUB_NEXT							0x0680
+#define IL_SUB_MIPMAP						0x0681
+#define IL_SUB_LAYER						0x0682
+
+
+// Compression definitions
+#define IL_COMPRESS_MODE					0x0700
+#define IL_COMPRESS_NONE					0x0701
+#define IL_COMPRESS_RLE						0x0702
+#define IL_COMPRESS_LZO						0x0703
+#define IL_COMPRESS_ZLIB					0x0704
+
+
+// File format-specific values
+#define IL_TGA_CREATE_STAMP					0x0710
+#define IL_JPG_QUALITY						0x0711
+#define IL_PNG_INTERLACE					0x0712
+#define IL_TGA_RLE							0x0713
+#define IL_BMP_RLE							0x0714
+#define IL_SGI_RLE							0x0715
+#define IL_TGA_ID_STRING					0x0717
+#define IL_TGA_AUTHNAME_STRING				0x0718
+#define IL_TGA_AUTHCOMMENT_STRING			0x0719
+#define IL_PNG_AUTHNAME_STRING				0x071A
+#define IL_PNG_TITLE_STRING					0x071B
+#define IL_PNG_DESCRIPTION_STRING			0x071C
+#define IL_TIF_DESCRIPTION_STRING			0x071D
+#define IL_TIF_HOSTCOMPUTER_STRING			0x071E
+#define IL_TIF_DOCUMENTNAME_STRING			0x071F
+#define IL_TIF_AUTHNAME_STRING				0x0720
+#define IL_JPG_SAVE_FORMAT					0x0721
+#define IL_CHEAD_HEADER_STRING				0x0722
+#define IL_PCD_PICNUM						0x0723
+
+#define IL_PNG_ALPHA_INDEX					0x0724	//XIX : ILint : the color in the pallete at this index value (0-255) is considered transparent, -1 for no trasparent color
+
+// DXTC definitions
+#define IL_DXTC_FORMAT						0x0705
+#define IL_DXT1								0x0706
+#define IL_DXT2								0x0707
+#define IL_DXT3								0x0708
+#define IL_DXT4								0x0709
+#define IL_DXT5								0x070A
+#define IL_DXT_NO_COMP						0x070B
+#define IL_KEEP_DXTC_DATA					0x070C
+#define IL_DXTC_DATA_FORMAT					0x070D
+
+
+// Cube map definitions
+#define IL_CUBEMAP_POSITIVEX				0x00000400
+#define IL_CUBEMAP_NEGATIVEX				0x00000800
+#define IL_CUBEMAP_POSITIVEY				0x00001000
+#define IL_CUBEMAP_NEGATIVEY				0x00002000
+#define IL_CUBEMAP_POSITIVEZ				0x00004000
+#define IL_CUBEMAP_NEGATIVEZ				0x00008000
+
+
+// Values
+#define IL_VERSION_NUM						0x0DE2
+#define IL_IMAGE_WIDTH						0x0DE4
+#define IL_IMAGE_HEIGHT						0x0DE5
+#define IL_IMAGE_DEPTH						0x0DE6
+#define IL_IMAGE_SIZE_OF_DATA				0x0DE7
+#define IL_IMAGE_BPP						0x0DE8
+#define IL_IMAGE_BYTES_PER_PIXEL			0x0DE8
+#define IL_IMAGE_BITS_PER_PIXEL				0x0DE9
+#define IL_IMAGE_FORMAT						0x0DEA
+#define IL_IMAGE_TYPE						0x0DEB
+#define IL_PALETTE_TYPE						0x0DEC
+#define IL_PALETTE_SIZE						0x0DED
+#define IL_PALETTE_BPP						0x0DEE
+#define IL_PALETTE_NUM_COLS					0x0DEF
+#define IL_PALETTE_BASE_TYPE				0x0DF0
+#define IL_NUM_IMAGES						0x0DF1
+#define IL_NUM_MIPMAPS						0x0DF2
+#define IL_NUM_LAYERS						0x0DF3
+#define IL_ACTIVE_IMAGE						0x0DF4
+#define IL_ACTIVE_MIPMAP					0x0DF5
+#define IL_ACTIVE_LAYER						0x0DF6
+#define IL_CUR_IMAGE						0x0DF7
+#define IL_IMAGE_DURATION					0x0DF8
+#define IL_IMAGE_PLANESIZE					0x0DF9
+#define IL_IMAGE_BPC						0x0DFA
+#define IL_IMAGE_OFFX						0x0DFB
+#define IL_IMAGE_OFFY						0x0DFC
+#define IL_IMAGE_CUBEFLAGS					0x0DFD
+#define IL_IMAGE_ORIGIN						0x0DFE
+
+
+//
+// Section shamelessly modified from the glut header.
+//
+
+// This is from Win32's <windef.h>
+#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
+	#define ILAPIENTRY __stdcall 
+	#define IL_PACKSTRUCT
+//#elif defined(linux) || defined(MACOSX) || defined(__CYGWIN__) //fix bug 840364
+#elif defined( __GNUC__ )
+  // this should work for any of the above commented platforms 
+  // plus any platform using GCC
+	#define ILAPIENTRY
+	#define IL_PACKSTRUCT __attribute__ ((packed))
+#else
+	#define ILAPIENTRY
+	#define IL_PACKSTRUCT
+#endif
+
+// This is from Win32's <wingdi.h> and <winnt.h>
+#if defined(__LCC__)
+	#define ILAPI __stdcall
+#elif defined(_WIN32) //changed 20031221 to fix bug 840421
+	#ifdef IL_STATIC_LIB
+		#define ILAPI
+	#else
+		#ifdef _IL_BUILD_LIBRARY
+			#define ILAPI __declspec(dllexport)
+		#else
+			#define ILAPI __declspec(dllimport)
+		#endif
+	#endif
+#elif __APPLE__
+	#define ILAPI extern
+#else
+	#define ILAPI
+#endif
+
+
+#define IL_SEEK_SET	0
+#define IL_SEEK_CUR	1
+#define IL_SEEK_END	2
+#define IL_EOF		-1
+
+
+// Callback functions for file reading
+typedef void* ILHANDLE;
+typedef ILvoid		(ILAPIENTRY *fCloseRProc)(ILHANDLE);
+typedef ILboolean	(ILAPIENTRY *fEofProc)   (ILHANDLE);
+typedef ILint		(ILAPIENTRY *fGetcProc)  (ILHANDLE);
+typedef ILHANDLE	(ILAPIENTRY *fOpenRProc) (const ILstring);
+typedef ILint		(ILAPIENTRY *fReadProc)  (void*, ILuint, ILuint, ILHANDLE);
+typedef ILint		(ILAPIENTRY *fSeekRProc) (ILHANDLE, ILint, ILint);
+typedef ILint		(ILAPIENTRY *fTellRProc) (ILHANDLE);
+
+// Callback functions for file writing
+typedef ILvoid		(ILAPIENTRY *fCloseWProc)(ILHANDLE);
+typedef ILHANDLE	(ILAPIENTRY *fOpenWProc) (const ILstring);
+typedef ILint		(ILAPIENTRY *fPutcProc)  (ILubyte, ILHANDLE);
+typedef ILint		(ILAPIENTRY *fSeekWProc) (ILHANDLE, ILint, ILint);
+typedef ILint		(ILAPIENTRY *fTellWProc) (ILHANDLE);
+typedef ILint		(ILAPIENTRY *fWriteProc) (const void*, ILuint, ILuint, ILHANDLE);
+
+// Callback functions for allocation and deallocation
+typedef ILvoid*		(ILAPIENTRY *mAlloc)(ILuint);
+typedef ILvoid		(ILAPIENTRY *mFree) (ILvoid*);
+
+// Registered format procedures
+typedef ILenum		(ILAPIENTRY *IL_LOADPROC)(const ILstring);
+typedef ILenum		(ILAPIENTRY *IL_SAVEPROC)(const ILstring);
+
+
+// ImageLib Functions
+ILAPI ILboolean		ILAPIENTRY ilActiveImage(ILuint Number);
+ILAPI ILboolean		ILAPIENTRY ilActiveLayer(ILuint Number);
+ILAPI ILboolean		ILAPIENTRY ilActiveMipmap(ILuint Number);
+ILAPI ILboolean		ILAPIENTRY ilApplyPal(const ILstring FileName);
+ILAPI ILboolean		ILAPIENTRY ilApplyProfile(const ILstring InProfile, const ILstring OutProfile);
+ILAPI ILvoid		ILAPIENTRY ilBindImage(ILuint Image);
+ILAPI ILboolean		ILAPIENTRY ilBlit(ILuint Source, ILint DestX, ILint DestY, ILint DestZ, ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width, ILuint Height, ILuint Depth);
+ILAPI ILvoid		ILAPIENTRY ilClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
+ILAPI ILboolean		ILAPIENTRY ilClearImage(ILvoid);
+ILAPI ILuint		ILAPIENTRY ilCloneCurImage(ILvoid);
+ILAPI ILboolean		ILAPIENTRY ilCompressFunc(ILenum Mode);
+ILAPI ILboolean		ILAPIENTRY ilConvertImage(ILenum DestFormat, ILenum DestType);
+ILAPI ILboolean		ILAPIENTRY ilConvertPal(ILenum DestFormat);
+ILAPI ILboolean		ILAPIENTRY ilCopyImage(ILuint Src);
+ILAPI ILuint		ILAPIENTRY ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, ILvoid *Data);
+ILAPI ILuint		ILAPIENTRY ilCreateSubImage(ILenum Type, ILuint Num);
+ILAPI ILboolean		ILAPIENTRY ilDefaultImage(ILvoid);
+ILAPI ILvoid		ILAPIENTRY ilDeleteImages(ILsizei Num, const ILuint *Images);
+ILAPI ILboolean		ILAPIENTRY ilDisable(ILenum Mode);
+ILAPI ILboolean		ILAPIENTRY ilEnable(ILenum Mode);
+ILAPI ILboolean		ILAPIENTRY ilFormatFunc(ILenum Mode);
+ILAPI ILvoid		ILAPIENTRY ilGenImages(ILsizei Num, ILuint *Images);
+ILAPI ILubyte*		ILAPIENTRY ilGetAlpha(ILenum Type);
+ILAPI ILvoid            ILAPIENTRY ilModAlpha( ILint AlphaValue );
+ILAPI ILvoid            ILAPIENTRY ilSetAlpha( ILuint AlphaValue );
+ILAPI ILboolean		ILAPIENTRY ilGetBoolean(ILenum Mode);
+ILAPI ILvoid		ILAPIENTRY ilGetBooleanv(ILenum Mode, ILboolean *Param);
+ILAPI ILubyte*		ILAPIENTRY ilGetData(ILvoid);
+ILAPI ILuint		ILAPIENTRY ilGetDXTCData(ILvoid *Buffer, ILuint BufferSize, ILenum DXTCFormat);
+ILAPI ILenum		ILAPIENTRY ilGetError(ILvoid);
+ILAPI ILint             ILAPIENTRY ilGetInteger(ILenum Mode);
+ILAPI ILvoid		ILAPIENTRY ilGetIntegerv(ILenum Mode, ILint *Param);
+ILAPI ILuint		ILAPIENTRY ilGetLumpPos(ILvoid);
+ILAPI ILubyte*		ILAPIENTRY ilGetPalette(ILvoid);
+ILAPI const ILstring    ILAPIENTRY ilGetString(ILenum StringName);
+ILAPI ILvoid		ILAPIENTRY ilHint(ILenum Target, ILenum Mode);
+ILAPI ILvoid		ILAPIENTRY ilInit(ILvoid);
+ILAPI ILboolean		ILAPIENTRY ilIsDisabled(ILenum Mode);
+ILAPI ILboolean		ILAPIENTRY ilIsEnabled(ILenum Mode);
+ILAPI ILboolean		ILAPIENTRY ilIsImage(ILuint Image);
+ILAPI ILboolean		ILAPIENTRY ilIsValid(ILenum Type, const ILstring FileName);
+ILAPI ILboolean		ILAPIENTRY ilIsValidF(ILenum Type, ILHANDLE File);
+ILAPI ILboolean		ILAPIENTRY ilIsValidL(ILenum Type, ILvoid *Lump, ILuint Size);
+ILAPI ILvoid		ILAPIENTRY ilKeyColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha);
+ILAPI ILboolean		ILAPIENTRY ilLoad(ILenum Type, const ILstring FileName);
+ILAPI ILboolean		ILAPIENTRY ilLoadF(ILenum Type, ILHANDLE File);
+ILAPI ILboolean		ILAPIENTRY ilLoadImage(const ILstring FileName);
+ILAPI ILboolean		ILAPIENTRY ilLoadL(ILenum Type, ILvoid *Lump, ILuint Size);
+ILAPI ILboolean		ILAPIENTRY ilLoadPal(const ILstring FileName);
+ILAPI ILboolean		ILAPIENTRY ilOriginFunc(ILenum Mode);
+ILAPI ILboolean		ILAPIENTRY ilOverlayImage(ILuint Source, ILint XCoord, ILint YCoord, ILint ZCoord);
+ILAPI ILvoid		ILAPIENTRY ilPopAttrib(ILvoid);
+ILAPI ILvoid		ILAPIENTRY ilPushAttrib(ILuint Bits);
+ILAPI ILvoid		ILAPIENTRY ilRegisterFormat(ILenum Format);
+ILAPI ILboolean		ILAPIENTRY ilRegisterLoad(const ILstring Ext, IL_LOADPROC Load);
+ILAPI ILboolean		ILAPIENTRY ilRegisterMipNum(ILuint Num);
+ILAPI ILboolean		ILAPIENTRY ilRegisterNumImages(ILuint Num);
+ILAPI ILvoid		ILAPIENTRY ilRegisterOrigin(ILenum Origin);
+ILAPI ILvoid		ILAPIENTRY ilRegisterPal(ILvoid *Pal, ILuint Size, ILenum Type);
+ILAPI ILboolean		ILAPIENTRY ilRegisterSave(const ILstring Ext, IL_SAVEPROC Save);
+ILAPI ILvoid		ILAPIENTRY ilRegisterType(ILenum Type);
+ILAPI ILboolean		ILAPIENTRY ilRemoveLoad(const ILstring Ext);
+ILAPI ILboolean		ILAPIENTRY ilRemoveSave(const ILstring Ext);
+ILAPI ILvoid		ILAPIENTRY ilResetMemory(ILvoid);
+ILAPI ILvoid		ILAPIENTRY ilResetRead(ILvoid);
+ILAPI ILvoid		ILAPIENTRY ilResetWrite(ILvoid);
+ILAPI ILboolean		ILAPIENTRY ilSave(ILenum Type, const ILstring FileName);
+ILAPI ILuint		ILAPIENTRY ilSaveF(ILenum Type, ILHANDLE File);
+ILAPI ILboolean		ILAPIENTRY ilSaveImage(const ILstring FileName);
+ILAPI ILuint		ILAPIENTRY ilSaveL(ILenum Type, ILvoid *Lump, ILuint Size);
+ILAPI ILboolean		ILAPIENTRY ilSavePal(const ILstring FileName);
+ILAPI ILboolean		ILAPIENTRY ilSetData(ILvoid *Data);
+ILAPI ILboolean		ILAPIENTRY ilSetDuration(ILuint Duration);
+ILAPI ILvoid		ILAPIENTRY ilSetInteger(ILenum Mode, ILint Param);
+ILAPI ILvoid		ILAPIENTRY ilSetMemory(mAlloc, mFree);
+ILAPI ILvoid		ILAPIENTRY ilSetPixels(ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, ILvoid *Data);
+ILAPI ILvoid		ILAPIENTRY ilSetRead(fOpenRProc, fCloseRProc, fEofProc, fGetcProc, fReadProc, fSeekRProc, fTellRProc);
+ILAPI ILvoid		ILAPIENTRY ilSetString(ILenum Mode, const char *String);
+ILAPI ILvoid		ILAPIENTRY ilSetWrite(fOpenWProc, fCloseWProc, fPutcProc, fSeekWProc, fTellWProc, fWriteProc);
+ILAPI ILvoid		ILAPIENTRY ilShutDown(ILvoid);
+ILAPI ILboolean		ILAPIENTRY ilTexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, ILvoid *Data);
+ILAPI ILboolean		ILAPIENTRY ilTypeFunc(ILenum Mode);
+
+ILAPI ILboolean		ILAPIENTRY ilLoadData(const ILstring FileName, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
+ILAPI ILboolean		ILAPIENTRY ilLoadDataF(ILHANDLE File, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
+ILAPI ILboolean		ILAPIENTRY ilLoadDataL(ILvoid *Lump, ILuint Size, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp);
+ILAPI ILboolean		ILAPIENTRY ilSaveData(const ILstring FileName);
+
+ILAPI ILboolean		ILAPIENTRY ilLoadFromJpegStruct(ILvoid* JpegDecompressorPtr);
+ILAPI ILboolean		ILAPIENTRY ilSaveFromJpegStruct(ILvoid* JpegCompressorPtr);
+
+// For all those weirdos that spell "colour" without the 'u'.
+#define ilClearColor	ilClearColour
+#define ilKeyColor		ilKeyColour
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __IL_H__
+#endif // __il_h__
+
+#ifdef ALTIVEC
+    #define imemclear(x,y) vec_memclear(x,y);
+#else
+    #define imemclear(x,y) memset(x,0,y);
+#endif
+    
+#ifdef ALTIVEC
+    void vec_memclear( ILvoid *, ILuint );
+#endif
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/config.h
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/config.h	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/config.h	(revision 191)
@@ -0,0 +1,64 @@
+/* include/IL/config.h.  Generated by configure.  */
+/* include/IL/config.h.in.  Generated automatically from configure.in by autoheader.  */
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+/* Supported images formats (il) */
+
+/* #undef IL_NO_BMP */
+/* #undef IL_NO_CUT */
+/* #undef IL_NO_DCX */
+/* #undef IL_NO_DDS */
+/* #undef IL_NO_DOOM */
+/* #undef IL_NO_GIF */
+/* #undef IL_NO_ICO */
+/* #undef IL_NO_JPG */
+//#define IL_NO_LCMS 1
+/* #undef IL_NO_LIF */
+/* #undef IL_NO_MDL */
+//#define IL_NO_MNG 1
+/* #undef IL_NO_PCD */
+/* #undef IL_NO_PCX */
+/* #undef IL_NO_PIC */
+/* #undef IL_NO_PIX */
+/* #undef IL_NO_PNG */
+/* #undef IL_NO_PNM */
+/* #undef IL_NO_PSD */
+/* #undef IL_NO_PSP */
+/* #undef IL_NO_PXR */
+/* #undef IL_NO_RAW */
+/* #undef IL_NO_SGI */
+/* #undef IL_NO_TGA */
+/* #undef IL_NO_TIF */
+/* #undef IL_NO_WAL */
+/* #undef IL_NO_XPM */
+#undef IL_USE_JPEGLIB_UNMODIFIED
+#define IL_USE_JPEGLIB_UNMODIFIED 1
+#define IL_NO_LCMS
+
+/* Supported api (ilut) */
+
+/* #undef ILUT_USE_ALLEGRO */
+//#define ILUT_USE_DIRECTX8 1
+//#define ILUT_USE_DIRECTX9 1
+#define ILUT_USE_OPENGL 1
+//#define ILUT_USE_SDL 1
+#define ILUT_USE_WIN32 1
+
+
+/* Define if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Name of package */
+#define PACKAGE "DevIL"
+
+/* Version number of package */
+#define VERSION "1.6.6"
+
+/* Define if your processor stores words with the most significant byte first
+   (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define if the X Window System is missing or not being used. */
+#define X_DISPLAY_MISSING 1
+#endif /* __CONFIG_H__ */
Index: /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/stamp-h.in
===================================================================
--- /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/stamp-h.in	(revision 191)
+++ /trunk/VUT/GtpVisibilityPreprocessor/support/devil/include/IL/stamp-h.in	(revision 191)
@@ -0,0 +1,1 @@
+timestamp
