Browse Source

Rename calcLookAtMatrix => look_mat

master
gradient 8 years ago
parent
commit
56b5a7c7de
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      examples/test/shaders/test.frag
  2. +2
    -2
      examples/test/shaders/utils.glsl

+ 1
- 1
examples/test/shaders/test.frag View File

@ -70,7 +70,7 @@ void main() {
uv.x *= u_Resolution.x/u_Resolution.y; uv.x *= u_Resolution.x/u_Resolution.y;
vec3 eye = vec3(0., 0., -5.); vec3 eye = vec3(0., 0., -5.);
mat3 lookAt = calcLookAtMatrix(eye, vec3(0., 0., 0.), u_Time);
mat3 lookAt = look_mat(eye, target, 0);
vec3 dir = normalize(lookAt * ray_dir(FOV, uv)); vec3 dir = normalize(lookAt * ray_dir(FOV, uv));
color = vec4(0.); color = vec4(0.);


+ 2
- 2
examples/test/shaders/utils.glsl View File

@ -1,8 +1,8 @@
mat3 calcLookAtMatrix(vec3 origin, vec3 target, float roll) {
mat3 look_mat(vec3 origin, vec3 target, float roll) {
vec3 rr = vec3(sin(roll), cos(roll), 0.0); vec3 rr = vec3(sin(roll), cos(roll), 0.0);
vec3 ww = normalize(target - origin); vec3 ww = normalize(target - origin);
vec3 uu = normalize(cross(ww, rr)); vec3 uu = normalize(cross(ww, rr));
vec3 vv = normalize(cross(uu, ww)); vec3 vv = normalize(cross(uu, ww));
return mat3(uu, vv, ww); return mat3(uu, vv, ww);
}
}

Loading…
Cancel
Save