added a new function lookAt.
This commit is contained in:
parent
a4836d5854
commit
037746bee6
10
lookAt.glsl
Normal file
10
lookAt.glsl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma glslify: rotateAxisAngle = require(./rotateAxisAngle);
|
||||||
|
|
||||||
|
vec3 lookAt(vec3 base, vec3 p1, vec3 p2, vec3 up) {
|
||||||
|
vec3 diff = normalize(p2 - p1);
|
||||||
|
float d = dot(diff, up);
|
||||||
|
vec3 c = cross(p1, p2);
|
||||||
|
float a = acos(d);
|
||||||
|
return rotateAxisAngle(base, c, a);
|
||||||
|
}
|
||||||
|
#pragma glslify: export(lookAt)
|
Loading…
Reference in New Issue
Block a user