Created
November 13, 2019 21:17
-
-
Save yiwenl/daa1dfa3fba1362e1c86c66079d52cf6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec3 align(vec3 pos, vec3 dir) { | |
vec3 initDir = vec3(1.0, 0.0, 0.0); | |
vec3 axis = cross(dir, initDir); | |
float angle = acos(dot(dir, initDir)); | |
return rotate(pos, axis, angle); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment