summaryrefslogtreecommitdiff
path: root/resources/shaders
diff options
context:
space:
mode:
authorjjesswan <jessica_wan@brown.edu>2024-04-22 21:56:26 -0400
committerjjesswan <jessica_wan@brown.edu>2024-04-22 21:56:26 -0400
commita556b45abf18f1bd509daaf63b66b7d55e9fd291 (patch)
treebc9b8a2d184c12aee236e7f9f276a34b84ca552d /resources/shaders
parentcd7c76017a12bb548036571c1ff13e551369d06d (diff)
add engine version
Diffstat (limited to 'resources/shaders')
-rw-r--r--resources/shaders/anchorPoint.vert1
-rwxr-xr-xresources/shaders/shader.frag8
-rwxr-xr-xresources/shaders/shader.vert4
3 files changed, 12 insertions, 1 deletions
diff --git a/resources/shaders/anchorPoint.vert b/resources/shaders/anchorPoint.vert
index c074d00..784dbfb 100644
--- a/resources/shaders/anchorPoint.vert
+++ b/resources/shaders/anchorPoint.vert
@@ -3,6 +3,7 @@
layout(location = 0) in vec3 position; // Position of the vertex
layout(location = 2) in vec3 vcolor; // Normal of the vertex
+
uniform mat4 proj;
uniform mat4 view;
uniform mat4 model;
diff --git a/resources/shaders/shader.frag b/resources/shaders/shader.frag
index 141915e..fc78890 100755
--- a/resources/shaders/shader.frag
+++ b/resources/shaders/shader.frag
@@ -9,6 +9,9 @@ in vec3 refrPos;
in float refrProb;
in vec2 uv;
+uniform sampler2D texture_img;
+
+
uniform int wire = 0;
uniform float red = 1.0;
uniform float green = 1.0;
@@ -56,4 +59,9 @@ void main() {
// 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);
+
+
+ // assign texture
+ fragColor = texture(texture_img, uv);
+
}
diff --git a/resources/shaders/shader.vert b/resources/shaders/shader.vert
index 8dda424..8447dd9 100755
--- a/resources/shaders/shader.vert
+++ b/resources/shaders/shader.vert
@@ -2,6 +2,8 @@
layout(location = 0) in vec3 position; // Position of the vertex
layout(location = 1) in vec3 normal; // Normal of the vertex
+layout(location = 3) in vec3 texCoords; // Normal of the vertex
+
uniform mat4 proj;
uniform mat4 view;
@@ -65,7 +67,7 @@ void main() {
vec3 groundContactPoint = -(normal * depthScale) + position; // carries down to ground
groundContactPoint = vec3(model * vec4(position, 1));
uv = vec2((position.x + 81.f) / (162.f), groundContactPoint.z);
-// uv = vec2(normal);
+ uv = vec2(texCoords);
vec4 refrPos_and_prob = getRefrPos();
refrPos = vec3(refrPos_and_prob);
refrProb = clamp(refrPos_and_prob.w, 0.f, 1.f);