From 70780f3b940ca51f4e3490d2374f4b98685cde75 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Thu, 8 Jun 2017 23:23:19 -0700 Subject: [PATCH] webgl_materials_modified: replaced wave with twist --- examples/webgl_materials_modified.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/webgl_materials_modified.html b/examples/webgl_materials_modified.html index f1e8f11883686..0cd0ec4860984 100644 --- a/examples/webgl_materials_modified.html +++ b/examples/webgl_materials_modified.html @@ -100,7 +100,14 @@ shader.vertexShader = 'uniform float time;\n' + shader.vertexShader; shader.vertexShader = shader.vertexShader.replace( '#include ', - 'vec3 transformed = vec3( position.x + sin( time + position.y ) / 2.0, position.y, position.z );' + [ + 'float theta = sin( time + position.y ) / 2.0;', + 'float c = cos( theta );', + 'float s = sin( theta );', + 'mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );', + 'vec3 transformed = vec3( position ) * m;', + 'vNormal = vNormal * m;' + ].join( '\n' ) ); materialShader = shader;