Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [VERT]
- attribute vec4 a_position;
- varying vec3 texCoord;
- uniform mat4 u_worldTrans;
- uniform mat4 u_projTrans;
- ...
- void main()
- {
- gl_Position = u_projTrans * u_worldTrans * a_position;
- texCoord = vec3(a_position);
- }
- [FRAG]
- varying vec3 texCoord;
- uniform samplerCube u_cubemapTex;
- void main()
- {
- gl_FragColor = textureCube(u_cubemapTex, texCoord);
- }
- [VERT]
- attribute vec3 a_normal;
- varying vec3 v_reflection;
- uniform mat4 u_matViewInverseTranspose;
- uniform vec3 u_cameraPos;
- ...
- void main()
- {
- mat3 normalMatrix = mat3(u_matViewInverseTranspose);
- vec3 n = normalize(normalMatrix * a_normal);
- //calculate reflection
- vec3 vView = a_position.xyz - u_cameraPos.xyz;
- v_reflection = reflect(vView, n);
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement