Skip to content
Snippets Groups Projects
Commit 3c47bbd6 authored by Pascal Engeler's avatar Pascal Engeler
Browse files

further fragment shader optimizations

parent 7c7ab7e3
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,6 @@ uniform float t; ...@@ -27,7 +27,6 @@ uniform float t;
uniform sampler2D texture1; //other state uniform sampler2D texture1; //other state
uniform sampler2D texture2; //damping uniform sampler2D texture2; //damping
uniform sampler2D texture3; //unnecessary
//red is position, green is velocity //red is position, green is velocity
...@@ -38,13 +37,14 @@ void main() ...@@ -38,13 +37,14 @@ void main()
float right = texture(texture1, rightCoordinates).r; float right = texture(texture1, rightCoordinates).r;
float up = texture(texture1, upCoordinates).r; float up = texture(texture1, upCoordinates).r;
float down = texture(texture1, downCoordinates).r; float down = texture(texture1, downCoordinates).r;
float old_center = texture(texture2, textureCoordinates).r
float damping = texture(texture2, textureCoordinates).r;
//trial optimizations //trial optimizations
vec4 sum = vec4(left,right,up,down); vec4 sum = vec4(left,right,up,down);
const vec4 A = vec4(c1); const vec4 A = vec4(c1);
float dp = dot(A,sum); float dp = dot(A,sum);
float newred = (dp + c2*onsite.r - onsite.g) * onsite.b; float newred = (dp + c2*onsite.r - onsite.g) * damping;
FragColor = vec4(newred, onsite.rb, 1.); FragColor = vec4(newred + onsite.b*source, onsite.rb, 1.);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment