diff options
author | Lukas Stockner <lukasstockner97> | 2020-02-15 03:49:50 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2020-02-15 05:37:20 +0300 |
commit | f6aafd5186bd921637df755797c7ff6f3036a361 (patch) | |
tree | 8a09a244cb18e926907cfeb9df7674063b702ae0 /source/blender/blenlib | |
parent | fa4ab69abf5750857e0b79295b13efa73aef0766 (diff) |
Modifiers: Add option to directly specify a 2D transform for UVWarp
Currently the only option is to warp based on the transform of other
objects, which is inconvenient if you want to e.g. control it through
a driver - you need to set up a dummy object and go through that,
which is clunky and should be unneccessary.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6690
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_matrix.h | 3 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index ac0f5f44c74..acefe18fd40 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -60,6 +60,9 @@ void copy_m4d_m4(double R[4][4], const float A[4][4]); void swap_m3m3(float A[3][3], float B[3][3]); void swap_m4m4(float A[4][4], float B[4][4]); +/* Build index shuffle matrix */ +void shuffle_m4(float R[4][4], int index[4]); + /******************************** Arithmetic *********************************/ void add_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]); diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 4d8a2f72eca..86a08a42247 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -210,6 +210,16 @@ void swap_m4m4(float m1[4][4], float m2[4][4]) } } +void shuffle_m4(float R[4][4], int index[4]) +{ + zero_m4(R); + for (int k = 0; k < 4; k++) { + if (index[k] >= 0) { + R[index[k]][k] = 1.0f; + } + } +} + /******************************** Arithmetic *********************************/ void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]) |