mirror of
https://github.com/3b1b/manim.git
synced 2025-11-14 22:47:45 +00:00
Delete get_xyz_to_uv
This commit is contained in:
parent
05796654f4
commit
4b652be492
1 changed files with 0 additions and 26 deletions
|
|
@ -84,29 +84,3 @@ mat3 get_xy_to_uv(vec2 controls[3], float temp_is_linear, out float is_linear){
|
|||
controls[0], controls[2], dest[0], dest[1]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Orthogonal matrix to convert to a uv space defined so that
|
||||
// b0 goes to [0, 0] and b1 goes to [1, 0]
|
||||
mat4 get_xyz_to_uv(vec3 b0, vec3 b1, vec3 unit_normal){
|
||||
mat4 shift = mat4(
|
||||
1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
-b0.x, -b0.y, -b0.z, 1
|
||||
);
|
||||
|
||||
float scale_factor = length(b1 - b0);
|
||||
vec3 I = (b1 - b0) / scale_factor;
|
||||
vec3 K = unit_normal;
|
||||
vec3 J = cross(K, I);
|
||||
// Transpose (hence inverse) of matrix taking
|
||||
// i-hat to I, k-hat to unit_normal, and j-hat to their cross
|
||||
mat4 rotate = mat4(
|
||||
I.x, J.x, K.x, 0.0,
|
||||
I.y, J.y, K.y, 0.0,
|
||||
I.z, J.z, K.z, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0
|
||||
);
|
||||
return (1.0 / scale_factor) * rotate * shift;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue