summaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorjjesswan <jessica_wan@brown.edu>2024-05-06 19:11:27 -0400
committerjjesswan <jessica_wan@brown.edu>2024-05-06 19:11:27 -0400
commitd8bf256cf18327f48061ed875c98109200288733 (patch)
treec33234e5fe9a0b69925cfee16b8ba5f627b54595 /resources
parent8d6fd1befd53948cfb4f44ba84bfdb54ac97cf81 (diff)
trial with vbo
Diffstat (limited to 'resources')
-rw-r--r--resources/shaders/foam.frag6
-rw-r--r--resources/shaders/foam.vert8
2 files changed, 7 insertions, 7 deletions
diff --git a/resources/shaders/foam.frag b/resources/shaders/foam.frag
index 30fe241..8f5df85 100644
--- a/resources/shaders/foam.frag
+++ b/resources/shaders/foam.frag
@@ -21,7 +21,7 @@ float getSaturation(vec2 k, vec2 xzPos, float adjWaveLength, float phaseC){
//k = normalize(k);
float result = dot(k, xzPos) * 3.14f / adjWaveLength;
result = result + phaseC*time*.5f;
- result = -tan(result) + 1.57f;
+ result = -tan(result + 1.57f);
result = exp(result) / 20.f;
return result;
@@ -32,7 +32,7 @@ float getSaturation(vec2 k, vec2 xzPos, float adjWaveLength, float phaseC){
void main() {
float height = pos.y;
- float saturation = getSaturation(dir, vec2(pos.x,pos.z), 100.f, 1.f);
+ float saturation = constants[0];//getSaturation(dir, vec2(pos.x, pos.z), 512.f, constants[0]);
vec4 m_uv = texture(halftone_texture, tex);
float m_threshold = m_uv.r * m_uv.g * m_uv.b;
@@ -49,5 +49,5 @@ void main() {
if (saturation > m_threshold) j = vec4(vec3(g*foam), 1);
- // fragColor = vec4(vec3(saturation), 1);
+ fragColor = vec4(vec3(saturation), 1);
}
diff --git a/resources/shaders/foam.vert b/resources/shaders/foam.vert
index 76f2af7..a33e343 100644
--- a/resources/shaders/foam.vert
+++ b/resources/shaders/foam.vert
@@ -2,9 +2,9 @@
layout(location = 0) in vec3 position; // Position of the vertex
layout(location = 1) in float wavelength; // wavelenth adjusted for ocean depth
-layout(location = 2) in vec2 direction; // wave slope
-layout(location = 3) in vec2 texCoords; // texture coords
-layout(location = 3) in vec3 norm; // texture coords
+//layout(location = 2) in vec2 direction; // wave slope
+//layout(location = 3) in vec2 texCoords; // texture coords
+//layout(location = 3) in vec3 norm; // texture coords
out vec2 constants;
@@ -43,7 +43,7 @@ vec2 calculateTexCoord(vec3 pos){
}
void main() {
- dir = direction;
+ dir = vec2(0,0);
constants = vec2(wavelength, phaseC);
gl_Position = proj * view * model * vec4(position, 1);