Index: /GTP/trunk/Lib/Vis/Preprocessing/src/run_test2
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/run_test2	(revision 1877)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/run_test2	(revision 1883)
@@ -2,5 +2,5 @@
 
 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+"
-COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter-"
+COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter+"
 
 #SCENE="../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d"
@@ -29,5 +29,5 @@
 VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz
 
-PREFIX=../work/plots/osp-rss-1e5
+PREFIX=../work/plots/osp-rss2-1e5
 
 #SCENE=../data/atlanta/atlanta2.x3d
@@ -40,9 +40,13 @@
 
 
+# $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \
+# -rss_update_subdivision+ -rss_split=hybrid -hybrid_depth=10 \
+# -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-i-combined-update-ccb12-nn.log \
+# -preprocessor_histogram_file=$PREFIX-i-combined-update-ccb12-nn.hlog
+
 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \
- -rss_use_importance+ -rss_use_rss_tree+ -rss_update_subdivision+ -rss_split=hybrid -hybrid_depth=10 \
- -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-i-combined-update-ccb12-nn.log \
--preprocessor_histogram_file=$PREFIX-i-combined-update-ccb12-nn.hlog
-
+-rss_update_subdivision- -rss_split=hybrid -hybrid_depth=10 \
+-view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-i-combined-ccb12-nn.log \
+-preprocessor_histogram_file=$PREFIX-i-combined-ccb12-nn.hlog
 
 
@@ -60,8 +64,8 @@
 
 
-$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \
- -rss_use_importance+ -rss_use_rss_tree- -view_cells_filter_max_size=1 \
- -preprocessor_stats=$PREFIX-i-mixed-b1-n.log \
- -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n.hlog
+#$COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \
+#-rss_distributions=spatial+object_direction -view_cells_filter_max_size=1 \
+# -preprocessor_stats=$PREFIX-i-mixed-b1-n.log \
+# -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n.hlog
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.h	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.h	(revision 1883)
@@ -240,8 +240,9 @@
   UniformRandomVector(const float r1, const float r2);
 
-  friend Vector3 UniformRandomVector(const Vector3 &normal,
-									 const float r1,
-									 const float r2
-									 );
+  friend Vector3 CosineRandomVector(
+									const float r1,
+									const float r2,
+									const Vector3 &normal
+									);
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.h	(revision 1877)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.h	(revision 1883)
@@ -316,20 +316,27 @@
 struct SimpleRay
 {
-  int mId;
   Vector3 mOrigin;
   Vector3 mDirection;
+  short mType;
+  short mDistribution;
   float mPdf;
-  int mType;
-
-  static int sSimpleRayId;
+  
   SimpleRay(): mType(Ray::LOCAL_RAY) {
+  }
+  
+  SimpleRay(const Vector3 &o,
+			const Vector3 &d,
+			const short distribution,
+			const float weight
+			):
+	mOrigin(o),
+	mDirection(d),
+	mType(Ray::LOCAL_RAY),
+	mDistribution(distribution),
+	mPdf(weight)
+  {	
 	//	mId = sSimpleRayId++;
   }
   
-  SimpleRay(const Vector3 &o, const Vector3 &d, const float p=1.0f):
-	mOrigin(o), mDirection(d), mPdf(p), mType(Ray::LOCAL_RAY) {	
-	//	mId = sSimpleRayId++;
-  }
-	
   Vector3 Extrap(const float t) const {
 	return mOrigin + mDirection * t;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 1883)
@@ -1193,5 +1193,5 @@
 		//const Vector3 newOrigin = mainRay.mOrigin;
 
-		rayBundle.push_back(SimpleRay(newOrigin, newDir, 0));
+		rayBundle.push_back(SimpleRay(newOrigin, newDir, 0, 1.0f));
 	}
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.cpp	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Ray.cpp	(revision 1883)
@@ -18,6 +18,4 @@
   
   
-  int
-  SimpleRay::sSimpleRayId = 1;
   
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp	(revision 1877)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp	(revision 1883)
@@ -19,4 +19,5 @@
 
 
+
   const bool pruneInvalidRays = false;
   
@@ -91,5 +92,4 @@
   //  CLEAR_CONTAINER(mVssRays);
 }
-
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp	(revision 1771)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp	(revision 1883)
@@ -15,4 +15,5 @@
 #include "Intersectable.h"
 #include "RayCaster.h"
+#include "SamplingStrategy.h"
 
 
@@ -422,6 +423,11 @@
 				const Vector3 direction = GetDirection(viewpoint, &mViewCellsManager->GetViewSpaceBox());
 
-				const SimpleRay sray(viewpoint, direction);
-				sampleContributions = mRayCaster->CastRay(sray, mVssRays, mViewCellsManager->GetViewSpaceBox(), true);
+				const SimpleRay sray(viewpoint, direction,
+									 SamplingStrategy::DIRECTION_BOX_BASED_DISTRIBUTION,
+									 1.0f);
+				sampleContributions = mRayCaster->CastRay(sray,
+														  mVssRays,
+														  mViewCellsManager->GetViewSpaceBox(),
+														  true);
 
 				if (sampleContributions) {
@@ -545,5 +551,8 @@
 				mViewCellsManager->GetViewPoint(viewpoint);
 				Vector3 direction = GetDirection(viewpoint, NULL);
-				rays.push_back(SimpleRay(viewpoint, direction));
+				rays.push_back(SimpleRay(viewpoint, direction,
+										 SamplingStrategy::DIRECTION_BOX_BASED_DISTRIBUTION,
+										 1.0f)
+							   );
 			}
 		} else {
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/default.env
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/default.env	(revision 1877)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/default.env	(revision 1883)
@@ -90,5 +90,6 @@
 RssPreprocessor {
 
-	distributions rss+spatial+object
+	distributions rss+spatial+object_direction
+#	distributions object_direction
 
 	samplesPerPass 1000
@@ -127,5 +128,5 @@
 #	splitType heuristic
 
-	minRays		200
+	minRays		100
 	minSize		0.001
  	maxCostRatio 1.0
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h	(revision 1877)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h	(revision 1883)
@@ -1,4 +1,7 @@
 #ifndef _SamplingStategy_H__
 #define _SamplingStategy_H__
+
+#include <vector>
+using namespace std;
 
 #include "Halton.h"
@@ -10,4 +13,5 @@
 struct SimpleRay;
 class SimpleRayContainer;
+class VssRayContainer;
 
 /** This class generates a specific sampling strategy.
@@ -21,11 +25,12 @@
 	enum 
 	{
+	  DUMMY_DISTRIBUTION = 0,
+	  DIRECTION_BASED_DISTRIBUTION,
 		OBJECT_BASED_DISTRIBUTION,
-		DIRECTION_BASED_DISTRIBUTION,
 		DIRECTION_BOX_BASED_DISTRIBUTION,
 		SPATIAL_BOX_BASED_DISTRIBUTION,
+		VSS_BASED_DISTRIBUTION,
 		RSS_BASED_DISTRIBUTION,
 		RSS_SILHOUETTE_BASED_DISTRIBUTION,
-		VSS_BASED_DISTRIBUTION,
 		OBJECT_DIRECTION_BASED_DISTRIBUTION,
 		OBJECTS_INTERIOR_DISTRIBUTION,
@@ -34,5 +39,6 @@
 		VIEWSPACE_BORDER_BASED_DISTRIBUTION,
 		REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION,
-		GLOBAL_LINES_DISTRIBUTION
+	  GLOBAL_LINES_DISTRIBUTION,
+	  GVS
 	};
 
@@ -101,5 +107,7 @@
 class ObjectDirectionBasedDistribution: public SamplingStrategy
 {
- public:
+  HaltonSequence mHalton;
+  
+public:
 	 ObjectDirectionBasedDistribution(const Preprocessor &preprocessor):
 	 SamplingStrategy(preprocessor) {
@@ -208,6 +216,6 @@
 {
 public:
-  HaltonSequence mHalton;
-  //HaltonSequence mHalton;
+  //Halton<4> halton;
+  HaltonSequence mHalton;
 
   GlobalLinesDistribution(const Preprocessor &preprocessor):
@@ -232,4 +240,34 @@
 };
 */
+
+class MixtureDistribution : public SamplingStrategy {
+public:
+  // halton sequence generator for deciding between distributions
+  HaltonSequence mHalton;
+  
+  // container for the distributions
+  vector<SamplingStrategy *> mDistributions;
+
+  MixtureDistribution(const Preprocessor &preprocessor):
+	SamplingStrategy(preprocessor)
+  {
+  }
+
+  // has to called before first usage
+  void Init();
+  
+  // Generate a new sample according to a mixture distribution
+  virtual bool GenerateSample(SimpleRay &ray);
+
+  // add contributions of the sample to the strategies
+  void UpdateContributions(VssRayContainer &vssRays);
+  
+protected:
+  // distributions sorted according to their contribution
+  // used for new sample generation accordint to the pdf
+  vector<SamplingStrategy *> mSortedDistributions;
+  
+};
+
 };
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp	(revision 1771)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp	(revision 1883)
@@ -10,4 +10,5 @@
 #include "RenderSimulator.h"
 #include "VssRay.h"
+#include "SamplingStrategy.h"
 
 
@@ -108,5 +109,8 @@
 		  // cast rays in both directions to make the number of samples comparable
 		  // with the global sampling method which also casts a "double" ray per sample
-		  rays.push_back(SimpleRay(origin, direction));
+		  rays.push_back(SimpleRay(origin,
+								   direction,
+								   SamplingStrategy::DIRECTION_BASED_DISTRIBUTION,
+								   1.0f));
 		  i++;
 		  samples++;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1877)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1883)
@@ -24,6 +24,4 @@
 #include "SamplingStrategy.h"
 #include "SceneGraph.h"
-
-
 
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.cpp	(revision 1524)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.cpp	(revision 1883)
@@ -97,5 +97,5 @@
 
 	Normalize(dir);
-	return SimpleRay(point, dir);
+	return SimpleRay(point, dir, 0, 1.0f);
 }
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Makefile	(revision 1877)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Makefile	(revision 1883)
@@ -1,5 +1,5 @@
 #############################################################################
 # Makefile for building: preprocessor
-# Generated by qmake (2.00a) (Qt 4.1.2) on: ne 10. XII 21:55:07 2006
+# Generated by qmake (2.00a) (Qt 4.1.2) on: po 11. XII 10:42:23 2006
 # Project:  preprocessor.pro
 # Template: app
@@ -63,5 +63,5 @@
 	$(MAKE) -f $(MAKEFILE).Debug uninstall
 
-Makefile: preprocessor.pro  C:/Qt/4.1.2/mkspecs/win32-msvc.net\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \
+Makefile: preprocessor.pro  C:/Qt/4.1.2/mkspecs/win32-msvc2005\qmake.conf C:/Qt/4.1.2/mkspecs/qconfig.pri \
 		C:\Qt\4.1.2\mkspecs\features\qt_config.prf \
 		C:\Qt\4.1.2\mkspecs\features\exclusive_builds.prf \
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.cpp	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Vector3.cpp	(revision 1883)
@@ -228,42 +228,42 @@
 }
 
-
 Vector3
 CosineRandomVector(const Vector3 &normal)
 {
-  //  float r1 = RandomValue(0.0f, 1.0f);
-  //  float r2 = RandomValue(0.0f, 1.0f);
   float r1, r2;
   
-#if USE_HALTON 
-  halton2.GetNext(r1, r2);
-#else
-   r1 = RandomValue(0.0f, 1.0f);
-   r2 = RandomValue(0.0f, 1.0f);
-#endif
-
-   float theta = 2.0f*M_PI*r2;
-   float radius = sqrt(r1);
-   float x = radius*sin(theta);
-   float z = radius*cos(theta);
-   float y = sqrt(1.0f - x*x - z*z);
-
+  r1 = RandomValue(0.0f, 1.0f);
+  r2 = RandomValue(0.0f, 1.0f);
+  
+  return CosineRandomVector(r1, r2, normal);
+}
+
+Vector3
+CosineRandomVector(const float r1,
+				   const float r2,
+				   const Vector3 &normal)
+{
+  float theta = 2.0f*M_PI*r2;
+  float radius = sqrt(r1);
+  float x = radius*sin(theta);
+  float z = radius*cos(theta);
+  float y = sqrt(1.0f - x*x - z*z);
+  
+  Vector3 dir(x,
+			  y,
+			  z);
+  
+  //  return Normalize(dir);
    
-   Vector3 dir(x,
-			   y,
-			   z);
-   
-   
-   //  return Normalize(dir);
-   
-   Matrix4x4 m = RotationVectorsMatrix(
-									   normal,
-									   Vector3(0,1,0));
-   Matrix4x4 mi = Invert(m);
-   m = m*RotationVectorsMatrix(
-							   Vector3(0,1,0),
-							   Normalize(dir))*mi;
-  
-   return TransformNormal(m, normal);
+  Matrix4x4 m = RotationVectorsMatrix(
+									  normal,
+									  Vector3(0,1,0)
+									  );
+  Matrix4x4 mi = Invert(m);
+  m = m*RotationVectorsMatrix(
+							  Vector3(0,1,0),
+							  Normalize(dir))*mi;
+  
+  return TransformNormal(m, normal);
 }
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp	(revision 1877)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp	(revision 1883)
@@ -28,4 +28,5 @@
 #include "Preprocessor.h"
 #include "SceneGraph.h"
+#include "SamplingStrategy.h"
 
 
@@ -1949,5 +1950,9 @@
 		Vector3 direction = VssRay::GetDirection(dirVector.x, dirVector.y);
 		//cout<<"dir vector.x="<<dirVector.x<<"direction'.x="<<atan2(direction.x, direction.y)<<endl;
-		rays.push_back(SimpleRay(origin, direction));
+		rays.push_back(SimpleRay(origin,
+								 direction,
+								 SamplingStrategy::RSS_BASED_DISTRIBUTION,
+								 1.0f
+								 ));
 	  }
 	} else {
@@ -2308,5 +2313,9 @@
 
   //Debug<<"dir vector.x="<<dirVector.x<<"direction'.x="<<atan2(direction.x, direction.y)<<endl;
-  rays.push_back(SimpleRay(origin, direction));
+  rays.push_back(SimpleRay(origin,
+						   direction,
+						   SamplingStrategy::RSS_BASED_DISTRIBUTION,
+						   1.0f
+						   ));
 }
 
@@ -2472,5 +2481,9 @@
 	if (!intersects) {
 	  //cout<<"dir vector.x="<<dirVector.x<<"direction'.x="<<atan2(direction.x, direction.y)<<endl;
-	  rays.push_back(SimpleRay(origin, direction));
+	  rays.push_back(SimpleRay(origin,
+							   direction,
+							   SamplingStrategy::RSS_BASED_DISTRIBUTION,
+							   1.0f
+							   ));
 	  generated++;
 	}
@@ -2588,6 +2601,6 @@
 	if (node->IsLeaf()) {
 	  RssTreeLeaf *leaf = (RssTreeLeaf *)node;
-	  prunned += PruneRaysRandom(leaf, ratio);
-	  //prunned += PruneRaysContribution(leaf, ratio);
+	  //prunned += PruneRaysRandom(leaf, ratio);
+	  prunned += PruneRaysContribution(leaf, ratio);
 	} else {
 	  RssTreeInterior *in = (RssTreeInterior *)node;
@@ -2722,6 +2735,6 @@
 // if small very high importance of the last sample
 // if 1.0f then weighs = 1 1/2 1/3 1/4
-//float passSampleWeightDecay = 1.0f;
-float passSampleWeightDecay = 1000.0f;
+float passSampleWeightDecay = 1.0f;
+//float passSampleWeightDecay = 1000.0f;
 
 float
@@ -2730,5 +2743,5 @@
   int passDiff = mCurrentPass - pass;
   float weight;
-  if (1) 
+  if (0) 
 	weight = 1.0f/(passDiff + passSampleWeightDecay);
   else 
@@ -2777,9 +2790,11 @@
 RssTree::ComputeImportance(RssTreeLeaf *leaf) 
 {
+#if 1
   if (leaf->mTotalRays)
 	leaf->mImportance = leaf->mTotalContribution / leaf->mTotalRays;
   else
-	leaf->mImportance = 0.0f;
+	leaf->mImportance = Limits::Small;
   return;
+#endif
   
   if (0) 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.cpp	(revision 1824)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VssTree.cpp	(revision 1883)
@@ -24,4 +24,5 @@
 #include "Intersectable.h"
 #include "Ray.h"
+#include "SamplingStrategy.h"
 
 namespace GtpVisibilityPreprocessor {
@@ -1672,5 +1673,5 @@
 		Vector3 direction = VssRay::GetDirection(dirVector.x, dirVector.y);
 		//cout<<"dir vector.x="<<dirVector.x<<"direction'.x="<<atan2(direction.x, direction.y)<<endl;
-		rays.push_back(SimpleRay(origin, direction));
+		rays.push_back(SimpleRay(origin, direction, SamplingStrategy::VSS_BASED_DISTRIBUTION, 1.0f));
 	  }
 			
@@ -1754,5 +1755,5 @@
 	}
 	//cout<<"dir vector.x="<<dirVector.x<<"direction'.x="<<atan2(direction.x, direction.y)<<endl;
-	rays.push_back(SimpleRay(origin, direction));
+	rays.push_back(SimpleRay(origin, direction, SamplingStrategy::VSS_BASED_DISTRIBUTION, 1.0f));
   }
 }
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h	(revision 1883)
@@ -14,5 +14,5 @@
 class KdNode;
 
-#define ABS_CONTRIBUTION_WEIGHT 0.9f
+#define ABS_CONTRIBUTION_WEIGHT 1.0f
 
 class VssRay {
@@ -67,6 +67,9 @@
   short mPass;
 
+  // Distribution used to generate this ray
+  short mDistribution;
+  
   // number of cells where this ray made a contribution to the PVS
-  short mPvsContribution;
+  int mPvsContribution;
   
   // sum of relative ray contributions per object
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp	(revision 1883)
@@ -146,5 +146,5 @@
 		if (validA)
 		  vssRay->mFlags |= VssRay::Valid;
-		vssRay->mGeneratingRayId = simpleRay.mId;
+		vssRay->mDistribution = simpleRay.mDistribution;
 		vssRays.push_back(vssRay);
 		++ hits;
@@ -169,5 +169,5 @@
 			vssRay->mFlags |= VssRay::Valid;
 		  
-		  vssRay->mGeneratingRayId = simpleRay.mId;
+		  vssRay->mDistribution = simpleRay.mDistribution;
 		  vssRays.push_back(vssRay);
 		  ++ hits;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.cpp	(revision 1876)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.cpp	(revision 1883)
@@ -125,4 +125,5 @@
 
 	  vssRay->mFlags |= VssRay::Valid;
+	  vssRay->mDistribution = simpleRay.mDistribution;
 	  vssRays.push_back(vssRay);
 	  ++hits;
@@ -143,4 +144,5 @@
 						  );
 	  vssRay->mFlags |= VssRay::Valid;
+	  vssRay->mDistribution = simpleRay.mDistribution;
 	  vssRays.push_back(vssRay);
 	  ++hits;
@@ -165,4 +167,5 @@
 							  );
 		  vssRay->mFlags |= VssRay::Valid;
+		  vssRay->mDistribution = simpleRay.mDistribution;
 		  vssRays.push_back(vssRay);
 		  ++hits;
@@ -178,4 +181,5 @@
 		  
 		  vssRay->mFlags |= VssRay::Valid;
+		  vssRay->mDistribution = simpleRay.mDistribution;
 		  vssRays.push_back(vssRay);
 		  ++hits;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro	(revision 1876)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro	(revision 1883)
@@ -19,6 +19,6 @@
 
 CONFIG(qt) {
-win32:INCLUDEPATH += "d:/Programs/NVIDIA Corporation/Cg/include"
-#win32:INCLUDEPATH += "c:/Program Files/NVIDIA Corporation/Cg/include"
+#win32:INCLUDEPATH += "d:/Programs/NVIDIA Corporation/Cg/include"
+win32:INCLUDEPATH += "$$(CG_INC_PATH)"
 }
 
@@ -32,6 +32,6 @@
 
 CONFIG(qt) {
-win32:LIBPATH += "d:/Programs/NVIDIA Corporation/Cg/lib"
-#win32:LIBPATH += "c:/Program Files/NVIDIA Corporation/Cg/lib"
+#win32:LIBPATH += "d:/Programs/NVIDIA Corporation/Cg/lib"
+win32:LIBPATH += "$$(CG_LIB_PATH)"
 }
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp	(revision 1696)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp	(revision 1883)
@@ -196,5 +196,5 @@
 		cout << "s";
 		const Vector3 p = (p1 + p2) * 0.5f;
-		SimpleRay sray(oldRay.mOrigin, p - oldRay.mOrigin);
+		SimpleRay sray(oldRay.mOrigin, p - oldRay.mOrigin, SamplingStrategy::GVS, 1.0f);
 	
 		// cast ray into the new subdivision point
@@ -250,5 +250,5 @@
 	{
 		const Vector3 rayDir = (*vit) - currentRay.GetOrigin();
-		SimpleRay sr(currentRay.GetOrigin(), rayDir);
+		SimpleRay sr(currentRay.GetOrigin(), rayDir, SamplingStrategy::GVS, 1.0f);
 		simpleRays.AddRay(sr);
 	}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp	(revision 1877)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp	(revision 1883)
@@ -70,66 +70,73 @@
 bool ObjectBasedDistribution::GenerateSample(SimpleRay &ray)
 {
-	Vector3 origin, direction; 
-
-	float r[5];
-	mHalton.GetNext(5, r);
-
-	mPreprocessor.mViewCellsManager->GetViewPoint(origin, Vector3(r[2],r[3],r[4]));
-	
-	Vector3 point;
-	Vector3 normal;
-
-	r[0] *= mPreprocessor.mObjects.size()-1;
-	const int i = (int)r[0];
-
-	Intersectable *object = mPreprocessor.mObjects[i];
-
-	// take the remainder as a parameter over objects surface
-	r[0] -= (float)i;
-	
-	object->GetRandomSurfacePoint(r[0], r[1], point, normal);
-
-	direction = point - origin;
-	
-	const float c = Magnitude(direction);
-	
-	if (c <= Limits::Small) 
-		return false;
-
-	// $$ jb the pdf is yet not correct for all sampling methods!
-	const float pdf = 1.0f;
-	
-	direction *= 1.0f / c;
-	ray = SimpleRay(origin, direction, pdf);
-
-	return true;
-}
-
-
-bool ObjectDirectionBasedDistribution::GenerateSample(SimpleRay &ray)
+  Vector3 origin, direction; 
+  
+  float r[5];
+  mHalton.GetNext(5, r);
+  
+  mPreprocessor.mViewCellsManager->GetViewPoint(origin,
+												Vector3(r[2],r[3],r[4]));
+  
+
+  Vector3 point, normal;
+  
+  r[0] *= mPreprocessor.mObjects.size()-1;
+  const int i = (int)r[0];
+  
+  Intersectable *object = mPreprocessor.mObjects[i];
+  
+  // take the remainder as a parameter over objects surface
+  r[0] -= (float)i;
+  
+  object->GetRandomSurfacePoint(r[0], r[1], point, normal);
+  
+  direction = point - origin;
+  
+  const float c = Magnitude(direction);
+  
+  if (c <= Limits::Small) 
+	return false;
+  
+  // $$ jb the pdf is yet not correct for all sampling methods!
+  const float pdf = 1.0f;
+  
+  direction *= 1.0f / c;
+  ray = SimpleRay(origin, direction, OBJECT_BASED_DISTRIBUTION, pdf);
+  
+  return true;
+}
+
+
+bool
+ObjectDirectionBasedDistribution::GenerateSample(SimpleRay &ray)
 {	
-	Vector3 origin, direction; 
-    const int i = (int)RandomValue(0, (Real)mPreprocessor.mObjects.size() - 0.5f);
-	Intersectable *object = mPreprocessor.mObjects[i];
-	
-	Vector3 normal;
-	//cout << "x";
-	object->GetRandomSurfacePoint(origin, normal);
-	direction = UniformRandomVector(normal);
-	
-	origin += 0.1f * direction;
-
-	const float c = Magnitude(direction);
-
-	if (c <= Limits::Small) 
-		return false;
-	
-	// $$ jb the pdf is yet not correct for all sampling methods!
-	const float pdf = 1.0f;
-	
-	direction *= 1.0f / c;
-	ray = SimpleRay(origin, direction, pdf);
-
-	return true;
+  Vector3 origin, direction; 
+
+
+  float r[4];
+  mHalton.GetNext(4, r);
+
+  r[0] *= mPreprocessor.mObjects.size()-1;
+  const int i = (int)r[0];
+  
+  Intersectable *object = mPreprocessor.mObjects[i];
+  
+  // take the remainder as a parameter over objects surface
+  r[0] -= (float)i;
+
+  Vector3 normal;
+
+  object->GetRandomSurfacePoint(r[0], r[1], origin, normal);
+  
+  direction = Normalize(CosineRandomVector(r[2], r[3], normal));
+  
+  origin += 1e-2*direction;
+  
+  // $$ jb the pdf is yet not correct for all sampling methods!
+  const float pdf = 1.0f;
+  
+  ray = SimpleRay(origin, direction, OBJECT_DIRECTION_BASED_DISTRIBUTION, pdf);
+  
+  return true;
 }
 
@@ -149,5 +156,5 @@
 
 	direction *= 1.0f / c;
-	ray = SimpleRay(origin, direction, pdf);
+	ray = SimpleRay(origin, direction, DIRECTION_BASED_DISTRIBUTION, pdf);
 
 	return true;
@@ -173,5 +180,5 @@
 
 	direction *= 1.0f / c;
-	ray = SimpleRay(origin, direction, pdf);
+	ray = SimpleRay(origin, direction, DIRECTION_BOX_BASED_DISTRIBUTION, pdf);
 
 	return true;
@@ -200,5 +207,5 @@
   
   direction *= 1.0f / c;
-  ray = SimpleRay(origin, direction, pdf);
+  ray = SimpleRay(origin, direction, SPATIAL_BOX_BASED_DISTRIBUTION, pdf);
   
   return true;
@@ -238,5 +245,5 @@
 	point += direction * 0.001f;
 
-	ray = SimpleRay(point, direction, pdf);
+	ray = SimpleRay(point, direction, REVERSE_OBJECT_BASED_DISTRIBUTION, pdf);
 	
 	return true;
@@ -279,5 +286,5 @@
 	//cout << "p: " << point << " ";
 	direction *= 1.0f / c;
-	ray = SimpleRay(origin, direction, pdf);
+	ray = SimpleRay(origin, direction, VIEWCELL_BORDER_BASED_DISTRIBUTION, pdf);
 
 	//cout << "ray: " << ray.mOrigin << " " << ray.mDirection << endl;
@@ -352,5 +359,5 @@
 	point += direction * 0.001f;
 
-	ray = SimpleRay(point, direction, pdf);
+	ray = SimpleRay(point, direction, REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION, pdf);
 	
 	return true;
@@ -388,5 +395,5 @@
 	origin += direction * 0.001f;
 
-	ray = SimpleRay(origin, direction, pdf);
+	ray = SimpleRay(origin, direction, VIEWSPACE_BORDER_BASED_DISTRIBUTION, pdf);
 
 	return true;
@@ -415,23 +422,8 @@
 	mHalton.GetNext(4, r);
 	
-#if 0
-#if 0
-	r[0] = RandomValue(0,1);
-	r[1] = RandomValue(0,1);
-	r[2] = RandomValue(0,1);
-	r[3] = RandomValue(0,1);
-#else
-	r[0] = mHalton.GetNumber(1);
-	r[1] = mHalton.GetNumber(2);
-	r[2] = mHalton.GetNumber(3);
-	r[3] = mHalton.GetNumber(4);
-	mHalton.GenerateNext();
-#endif
-#endif
 	origin = center + (radius*UniformRandomVector(r[0], r[1]));
 	termination = center + (radius*UniformRandomVector(r[2], r[3]));
 	
 	direction = termination - origin;
-	//direction = UniformRandomVector();
 	
 	
@@ -458,5 +450,5 @@
 	
 	
-	ray = SimpleRay(origin, direction, pdf);
+	ray = SimpleRay(origin, direction, GLOBAL_LINES_DISTRIBUTION, pdf);
 	ray.mType = Ray::GLOBAL_RAY;
 	return true;
@@ -466,5 +458,28 @@
 }
 
-}
-
-
+
+  // has to called before first usage
+void
+MixtureDistribution::Init()
+{
+  
+}
+  
+  // Generate a new sample according to a mixture distribution
+bool
+MixtureDistribution::GenerateSample(SimpleRay &ray)
+{
+
+  return false;
+}
+
+  // add contributions of the sample to the strategies
+void
+MixtureDistribution::UpdateContributions(VssRayContainer &vssRays)
+{
+
+}
+
+}
+
+
