summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Froehlich <Mathias.Froehlich@web.de>2011-01-31 07:35:12 +0100
committerMathias Froehlich <Mathias.Froehlich@web.de>2011-01-31 07:35:12 +0100
commitc55d8e466750b279a0b5bb4cc02212cd1a065f7d (patch)
tree6f4ba09c25bfcf3d06a252a352d856cd8123dd85
parentdebc0308161e2a7b6203e84d853933072730c196 (diff)
compiles
-rw-r--r--Main.cpp2
-rw-r--r--common.glsl9
2 files changed, 11 insertions, 0 deletions
diff --git a/Main.cpp b/Main.cpp
index d07879e..44d1eee 100644
--- a/Main.cpp
+++ b/Main.cpp
@@ -37,6 +37,8 @@
#include <iostream>
#include <fstream>
#include <cmath>
+#include <cstring>
+#include <cstdlib>
#include <GL/glew.h>
#include <GL/glut.h>
diff --git a/common.glsl b/common.glsl
index ca244c6..138fb4a 100644
--- a/common.glsl
+++ b/common.glsl
@@ -96,8 +96,10 @@ vec2 getTransmittanceUV(float r, float mu) {
}
void getTransmittanceRMu(out float r, out float muS) {
+#ifdef _FRAGMENT_
r = gl_FragCoord.y / float(TRANSMITTANCE_H);
muS = gl_FragCoord.x / float(TRANSMITTANCE_W);
+#endif
#ifdef TRANSMITTANCE_NON_LINEAR
r = Rg + (r * r) * (Rt - Rg);
muS = -0.15 + tan(1.5 * muS) / tan(1.5) * (1.0 + 0.15);
@@ -114,8 +116,10 @@ vec2 getIrradianceUV(float r, float muS) {
}
void getIrradianceRMuS(out float r, out float muS) {
+#ifdef _FRAGMENT_
r = Rg + (gl_FragCoord.y - 0.5) / (float(SKY_H) - 1.0) * (Rt - Rg);
muS = -0.2 + (gl_FragCoord.x - 0.5) / (float(SKY_W) - 1.0) * (1.0 + 0.2);
+#endif
}
vec4 texture4D(sampler3D table, float r, float mu, float muS, float nu)
@@ -145,8 +149,13 @@ vec4 texture4D(sampler3D table, float r, float mu, float muS, float nu)
}
void getMuMuSNu(float r, vec4 dhdH, out float mu, out float muS, out float nu) {
+#ifdef _FRAGMENT_
float x = gl_FragCoord.x - 0.5;
float y = gl_FragCoord.y - 0.5;
+#else
+ float x = 0.5;
+ float y = 0.5;
+#endif
#ifdef INSCATTER_NON_LINEAR
if (y < float(RES_MU) / 2.0) {
float d = 1.0 - y / (float(RES_MU) / 2.0 - 1.0);