summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xresources/shaders/shader.frag15
-rw-r--r--src/arap.h4
-rw-r--r--src/graphics/shape.cpp6
-rw-r--r--src/graphics/shape.h2
4 files changed, 17 insertions, 10 deletions
diff --git a/resources/shaders/shader.frag b/resources/shaders/shader.frag
index ea7569b..80a65a2 100755
--- a/resources/shaders/shader.frag
+++ b/resources/shaders/shader.frag
@@ -18,7 +18,8 @@ uniform float red = 1.0;
uniform float green = 1.0;
uniform float blue = 1.0;
uniform float alpha = 1.0;
-uniform sampler2D sampler;
+uniform sampler2D groundSampler;
+uniform sampler2D skySampler;
uniform vec2 widthBounds;
uniform vec2 lengthBounds;
//uniform float test = 0;
@@ -53,7 +54,7 @@ void main() {
vec3 posToCam = normalize(camera_worldSpace - pos);
float spec = pow(clamp(dot(posToCam, reflectedLight), 0, 1), 2.f);
-// fragColor = texture(sampler, vec2(0.5f, 0.5f));
+// fragColor = texture(groundSampler, vec2(0.5f, 0.5f));
// fragColor = vec4(abs(pos.x / 160.f), pos.y, 0.f, 1.f);
// fragColor = vec4(uv.y, uv.y, 0.f, 1.f);
// fragColor = vec4(camera_worldSpace.x - pos[0], camera_worldSpace.y - pos[1], pos[2], 1.f);
@@ -75,13 +76,15 @@ void main() {
// vec4 transmissive = vec4(vec3(refrUV, 1.f - refrUV.y), 1.f);
float waterBlurriness = 0.f;
vec2 refrUVBlurry = (1 - beerAtt) * vec2(rand(refrUV), rand(vec4(pos, d))) * waterBlurriness + refrUV;
- vec4 transmissive = texture(sampler, vec2(refrUVBlurry));
+ vec4 transmissive = texture(groundSampler, vec2(refrUVBlurry));
vec4 murk = (vec4(waterVolumeColor * d * murkDiffuse + waterVolumeColor * murkAmbient, 1.0f));
// refrProb *= beerAtt;
fragColor = 0.75f * diffuse; // Diffuse
- fragColor = vec4(0,0,0,0);
+// fragColor = vec4(0, 0, 0, 1.f);
+// fragColor = vec4(.9f,1.f,1.f,0);
+ fragColor = vec4(red * .2f, green * .2f, blue * .2f,1.f);
fragColor += 1.f * specular; // Specular TODO: Pass multiplications as uniforms.
fragColor = clamp(fragColor, 0.f, 1.f); // Clamp
fragColor *= ((1 - refrProb) / 1.f);
@@ -91,7 +94,7 @@ void main() {
fragColor += refrProb * volumetric;
// fragColor = transmissive * refrProb;
- fragColor = vec4(vec3(fragColor), 1.5f);
+ fragColor = vec4(vec3(fragColor), 1.f);
// Dividing refrProb by 2 just for heuristic. Want more phong to show through.
// fragColor = clamp(fragColor, 0.f, 1.f);
// fragColor = vec4(refrProb, 0.f, 0.f, 1.f);
@@ -101,7 +104,7 @@ void main() {
// (1 - refrProb) * SPECULAR
// refrProb * (BEER * TRANSMISSIVE + (1 - beerAtt) * VOLUME (which is somewhat diffuse too?))
// Transmissive shouldn't just get darker, but blurrier as beer attenuation lowers.
-// fragColor = texture(sampler, vec2(refrUV));
+// fragColor = texture(groundSampler, vec2(refrUV));
// fragColor = vec4(normal_worldSpace[0], 0, normal_worldSpace[1], 1.f);
// fragColor = diffuse;
}
diff --git a/src/arap.h b/src/arap.h
index fe0d628..331cc3d 100644
--- a/src/arap.h
+++ b/src/arap.h
@@ -47,6 +47,10 @@ public:
m_shape.initGroundPlane(texturePath, depth, shader);
}
+ void initSkyPlane(std::string texturePath, float height, Shader* shader) {
+ m_shape.initSkyPlane(texturePath, height, shader);
+ }
+
SelectMode select(Shader *shader, int vertex)
{
return m_shape.select(shader, vertex);
diff --git a/src/graphics/shape.cpp b/src/graphics/shape.cpp
index fb0178f..e3612e5 100644
--- a/src/graphics/shape.cpp
+++ b/src/graphics/shape.cpp
@@ -363,11 +363,11 @@ void Shape::initGroundPlane(std::string texturePath, float depth, Shader* shader
// // TASK 10: set the texture.frag uniform for our texture
shader->bind();
- shader->setUniform("sampler", 0);
+ shader->setUniform("groundSampler", 0);
shader->unbind();
}
-void Shape::initSkyPlane(std::string texturePath, float depth, Shader* shader) {
+void Shape::initSkyPlane(std::string texturePath, float height, Shader* shader) {
//TODO: Complete
QString ground_texture_filepath = QString(texturePath.c_str());
@@ -401,7 +401,7 @@ void Shape::initSkyPlane(std::string texturePath, float depth, Shader* shader) {
// // TASK 10: set the texture.frag uniform for our texture
shader->bind();
- shader->setUniform("sampler", 1);
+ shader->setUniform("skySampler", 1);
shader->unbind();
}
diff --git a/src/graphics/shape.h b/src/graphics/shape.h
index 165fa96..b993b28 100644
--- a/src/graphics/shape.h
+++ b/src/graphics/shape.h
@@ -38,7 +38,7 @@ public:
void setColor(float r, float g, float b);
void initGroundPlane(std::string texturePath, float depth, Shader* shader);
- void initSkyPlane(std::string texturePath, float depth, Shader* shader);
+ void initSkyPlane(std::string texturePath, float height, Shader* shader);
void draw(Shader *shader, GLenum mode);
SelectMode select(Shader *shader, int vertex);