Skip to content

Commit

Permalink
webgl_materials_modified: replaced wave with twist
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jun 9, 2017
1 parent bf54dba commit 70780f3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/webgl_materials_modified.html
Expand Up @@ -100,7 +100,14 @@
shader.vertexShader = 'uniform float time;\n' + shader.vertexShader;
shader.vertexShader = shader.vertexShader.replace(
'#include <begin_vertex>',
'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;
Expand Down

0 comments on commit 70780f3

Please sign in to comment.