Skip to content

Commit

Permalink
chore: examples house cleaning (#215)
Browse files Browse the repository at this point in the history
* chore: remove unused time uniforms

* chore: examples house cleaning
  • Loading branch information
pschroen authored May 27, 2024
1 parent c5cef51 commit 81adcd3
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 14 deletions.
6 changes: 3 additions & 3 deletions examples/gpgpu-particles.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@
for (let i = 0; i < numParticles; i++) {
initialPositionData.set(
[
(Math.random() - 0.5) * 2.0,
(Math.random() - 0.5) * 2.0,
(Math.random() - 0.5) * 2,
(Math.random() - 0.5) * 2,
0, // the Green and Alpha channels go unused in this example, however I set
1, // unused Alpha to 1 so that texture is visible in WebGL debuggers
],
Expand Down Expand Up @@ -230,7 +230,7 @@
}

// Get mouse value in -1 to 1 range, with y flipped
mouse.value.set((e.x / gl.renderer.width) * 2 - 1, (1.0 - e.y / gl.renderer.height) * 2 - 1);
mouse.value.set((e.x / gl.renderer.width) * 2 - 1, (1 - e.y / gl.renderer.height) * 2 - 1);
}

requestAnimationFrame(update);
Expand Down
4 changes: 2 additions & 2 deletions examples/load-json.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@
const fragment = /* glsl */ `
precision highp float;
uniform float uTime;
uniform sampler2D tMap;
varying vec2 vUv;
varying vec3 vNormal;
void main() {
vec3 normal = normalize(vNormal);
vec3 tex = texture2D(tMap, vUv).rgb;
vec3 normal = normalize(vNormal);
vec3 light = normalize(vec3(0.5, 1.0, -0.3));
float shading = dot(normal, light) * 0.15;
gl_FragColor.rgb = tex + shading;
gl_FragColor.a = 1.0;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/mouse-flowmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
vec3 tex = texture2D(tWater, uv).rgb;
// Oscillate between raw values and the affected texture above
tex = mix(tex, flow * 0.5 + 0.5, smoothstep( -0.3, 0.7, sin(uTime)));
tex = mix(tex, flow * 0.5 + 0.5, smoothstep(-0.3, 0.7, sin(uTime)));
gl_FragColor.rgb = tex;
gl_FragColor.a = 1.0;
Expand Down Expand Up @@ -125,7 +125,7 @@
}

// Get mouse value in 0 to 1 range, with y flipped
mouse.set(e.x / gl.renderer.width, 1.0 - e.y / gl.renderer.height);
mouse.set(e.x / gl.renderer.width, 1 - e.y / gl.renderer.height);

// Calculate velocity
if (!lastTime) {
Expand Down
1 change: 0 additions & 1 deletion examples/normal-maps.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
void main() {
vec3 tex = texture2D(tDiffuse, vUv).rgb;
vec3 normal = getNormal();
vec3 light = normalize(vec3(sin(uTime), 1.0, cos(uTime)));
Expand Down
4 changes: 2 additions & 2 deletions examples/orbit-controls.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@
const fragment = /* glsl */ `
precision highp float;
uniform float uTime;
uniform sampler2D tMap;
varying vec2 vUv;
varying vec3 vNormal;
void main() {
vec3 normal = normalize(vNormal);
vec3 tex = texture2D(tMap, vUv).rgb;
vec3 normal = normalize(vNormal);
vec3 light = normalize(vec3(0.5, 1.0, -0.3));
float shading = dot(normal, light) * 0.15;
gl_FragColor.rgb = tex + shading;
gl_FragColor.a = 1.0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/skinning.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
void main() {
vec3 tex = texture2D(tMap, vUv).rgb;
vec3 normal = normalize(vNormal);
vec3 light = vec3(0.0, 1.0, 0.0);
float shading = min(0.0, dot(normal, light) * 0.2);
Expand Down
2 changes: 1 addition & 1 deletion examples/textures.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
varying vec3 vNormal;
void main() {
vec3 normal = normalize(vNormal);
vec3 tex = texture2D(tMap, vUv).rgb;
vec3 normal = normalize(vNormal);
vec3 light = normalize(vec3(0.5, 1.0, -0.3));
float shading = dot(normal, light) * 0.15;
Expand Down
4 changes: 2 additions & 2 deletions examples/wireframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@
const fragment = /* glsl */ `
precision highp float;
uniform float uTime;
uniform sampler2D tMap;
varying vec2 vUv;
varying vec3 vNormal;
void main() {
vec3 normal = normalize(vNormal);
vec3 tex = texture2D(tMap, vUv).rgb;
vec3 normal = normalize(vNormal);
vec3 light = normalize(vec3(0.5, 1.0, -0.3));
float shading = dot(normal, light) * 0.15;
gl_FragColor.rgb = tex + shading;
gl_FragColor.a = 1.0;
}
Expand Down

0 comments on commit 81adcd3

Please sign in to comment.