Skip to content

Commit

Permalink
Back to stretched custom shader material
Browse files Browse the repository at this point in the history
  • Loading branch information
deathcap committed Jan 11, 2014
1 parent fd8c2fb commit 416548c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function Texture(game, opts) {
'void main() {',
//' vec3 position = attrib0.xyz', // three.js passes position in attribute 0 already
//' vNormal = 128.0 - normal.xyz;', // and normal in attribute 1. but TODO: why 128.0-?
/*
' vNormal = normal;',
'',
' vec2 tileUV = vec2(dot(normal.zxy, position), dot(normal.yzx, position));',
Expand All @@ -86,6 +87,8 @@ function Texture(game, opts) {
//' vTexCoord = tileOffset + tileSize * fract(tileUV);',
' vTexCoord = tileSizeUV * floor(tileUV);',
*/
' vTexCoord = uv;',
//' vTexCoord = vec2(dot(position, vec3(normal.y - normal.z, 0, normal.x)),',
//' dot(position, vec3(0, -abs(normal.x + normal.z), normal.y)));',
'',
Expand Down Expand Up @@ -115,12 +118,12 @@ function Texture(game, opts) {
'',
//' vec2 texCoord = tileOffset + tileSize * fract(tileUV);',
'',
//' gl_FragColor = texture2D(map, vUv);',
//' gl_FragColor = texture2D(tileMap, vUv);',
'',
' gl_FragColor = texture2D(tileMap, vTexCoord);',
//' fract(vTexCoord * tileSizeUV));',
'',
//' gl_FragColor = texture2D(map, fract(vec2(vNormal.x, vNormal.y)));',
//' gl_FragColor = texture2D(tileMap, fract(vec2(vNormal.x, vNormal.y)));',
'}'
].join('\n')
},
Expand Down

0 comments on commit 416548c

Please sign in to comment.