diff options
author | Sebastian Park <SebPark03@gmail.com> | 2024-04-23 21:54:06 -0400 |
---|---|---|
committer | Sebastian Park <SebPark03@gmail.com> | 2024-04-23 21:54:06 -0400 |
commit | ee37315e203286eba679c910e19544648abdcacf (patch) | |
tree | 1dbb8ef6d72f0945d4eaf607e442b7c36edf075e | |
parent | 8efd1990da43eefac85e6449881795ae9d974954 (diff) |
Change sampler names to ground sampler .
-rwxr-xr-x | resources/shaders/shader.frag | 9 | ||||
-rw-r--r-- | src/arap.h | 4 | ||||
-rw-r--r-- | src/graphics/shape.cpp | 6 | ||||
-rw-r--r-- | src/graphics/shape.h | 2 |
4 files changed, 13 insertions, 8 deletions
diff --git a/resources/shaders/shader.frag b/resources/shaders/shader.frag index 9f7b55e..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,7 +76,7 @@ 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; @@ -103,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; } @@ -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); |