Advertisement
Guest User

Untitled

a guest
Feb 7th, 2015
561
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. uniform mat4 g_WorldViewProjectionMatrix;
  2. uniform mat4 g_WorldViewMatrix;
  3. attribute vec3 inPosition;
  4. attribute vec3 inNormal;
  5.  
  6. //out
  7. varying vec2 texCoord1;
  8.  
  9. vec2 getTexCoord(vec3 normal, vec3 position){
  10. vec2 tileUV = vec2(dot(normal.zxy, position),
  11. dot(normal.yzx, position));
  12. vec2 tileOffset = vec2(0,0);
  13. return tileOffset + (1.0/16.0) * fract(tileUV);
  14. }
  15. void main() {
  16. // Vertex transformation
  17. vec4 local = g_WorldViewProjectionMatrix * vec4(inPosition,1.0);
  18. gl_Position = local;
  19.  
  20. texCoord1 = getTexCoord(inNormal,local.xyz);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement