src/sampler.cc
branchpyrit
changeset 95 ca7d4c665531
parent 94 4c8abb8977dc
--- a/src/sampler.cc	Thu May 08 09:21:25 2008 +0200
+++ b/src/sampler.cc	Sat May 10 14:29:37 2008 +0200
@@ -29,6 +29,40 @@
 #include "common.h"
 #include "scene.h"
 
+/* grid oversampling look up tables */
+static const int gridsamples[] = {1,4,9,16};
+static const Float osa4x[] = { -0.25f, +0.25f, +0.25f, -0.25f };
+static const Float osa4y[] = { -0.25f, -0.25f, +0.25f, +0.25f };
+static const Float osa9x[] =
+{
+	-0.34f,  0.00f, +0.34f,
+	-0.34f,  0.00f, +0.34f,
+	-0.34f,  0.00f, +0.34f
+};
+static const Float osa9y[] =
+{
+	-0.34f, -0.34f, -0.34f,
+	 0.00f,  0.00f,  0.00f,
+	+0.34f, +0.34f, +0.34f
+};
+static const Float osa16x[] =
+{
+	-0.375f, -0.125f, +0.125f, +0.375f,
+	-0.375f, -0.125f, +0.125f, +0.375f,
+	-0.375f, -0.125f, +0.125f, +0.375f,
+	-0.375f, -0.125f, +0.125f, +0.375f
+};
+static const Float osa16y[] =
+{
+	-0.375f, -0.375f, -0.375f, -0.375f,
+	-0.125f, -0.125f, -0.125f, -0.125f,
+	+0.125f, +0.125f, +0.125f, +0.125f,
+	+0.375f, +0.375f, +0.375f, +0.375f
+};
+static const Float *osaSx[] = {NULL, osa4x, osa9x, osa16x};
+static const Float *osaSy[] = {NULL, osa4y, osa9y, osa16y};
+
+
 void DefaultSampler::init()
 {
 	phase = 0;
@@ -37,7 +71,6 @@
 
 int DefaultSampler::initSampleSet()
 {
-	static const int gridsamples[] = {1,5,9,16};
 	const int samples = gridsamples[oversample];
 	const int &w = pixmap.getWidth(), &h = pixmap.getHeight();
 	Float *&buffer = pixmap.getFloatData();
@@ -184,21 +217,6 @@
 	else if (phase == 2)
 	{
 		/* grid oversampling */
-		static const int gridsamples[] = {1,4,9,16};
-		static const Float osa4x[] = {-0.25f, +0.25f, +0.25f, -0.25f};
-		static const Float osa4y[] = {-0.25f, -0.25f, +0.25f, +0.25f};
-		static const Float osa9x[] = {-0.34f,  0.00f, +0.34f,
-			-0.34f,  0.00f, +0.34f, -0.34f,  0.00f, +0.34f};
-		static const Float osa9y[] = {-0.34f, -0.34f, -0.34f,
-				0.00f,  0.00f,  0.00f, +0.34f, +0.34f, +0.34f};
-		static const Float osa16x[] = {-0.375f, -0.125f, +0.125f, +0.375f,
-			-0.375f, -0.125f, +0.125f, +0.375f, -0.375f, -0.125f, +0.125f, +0.375f,
-			-0.375f, -0.125f, +0.125f, +0.375f};
-		static const Float osa16y[] = {-0.375f, -0.375f, -0.375f, -0.375f,
-			-0.125f, -0.125f, -0.125f, -0.125f, +0.125f, +0.125f, +0.125f, +0.125f,
-			+0.375f, +0.375f, +0.375f, +0.375f};
-		static const Float *osaSx[] = {NULL, osa4x, osa9x, osa16x};
-		static const Float *osaSy[] = {NULL, osa4y, osa9y, osa16y};
 		const int samples = gridsamples[oversample];
 		const Float *osax = osaSx[oversample];
 		const Float *osay = osaSy[oversample];