Blender  V3.3
multires_inline.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2018 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include "BKE_multires.h"
11 #include "BLI_math_vector.h"
12 #include "BLI_utildefines.h"
13 
14 BLI_INLINE void BKE_multires_construct_tangent_matrix(float tangent_matrix[3][3],
15  const float dPdu[3],
16  const float dPdv[3],
17  const int corner)
18 {
19  if (corner == 0) {
20  copy_v3_v3(tangent_matrix[0], dPdv);
21  copy_v3_v3(tangent_matrix[1], dPdu);
22  mul_v3_fl(tangent_matrix[0], -1.0f);
23  mul_v3_fl(tangent_matrix[1], -1.0f);
24  }
25  else if (corner == 1) {
26  copy_v3_v3(tangent_matrix[0], dPdu);
27  copy_v3_v3(tangent_matrix[1], dPdv);
28  mul_v3_fl(tangent_matrix[1], -1.0f);
29  }
30  else if (corner == 2) {
31  copy_v3_v3(tangent_matrix[0], dPdv);
32  copy_v3_v3(tangent_matrix[1], dPdu);
33  }
34  else if (corner == 3) {
35  copy_v3_v3(tangent_matrix[0], dPdu);
36  copy_v3_v3(tangent_matrix[1], dPdv);
37  mul_v3_fl(tangent_matrix[0], -1.0f);
38  }
39  else {
40  BLI_assert_msg(0, "Unhandled corner index");
41  }
42  cross_v3_v3v3(tangent_matrix[2], dPdu, dPdv);
43  normalize_v3(tangent_matrix[0]);
44  normalize_v3(tangent_matrix[1]);
45  normalize_v3(tangent_matrix[2]);
46 }
#define BLI_assert_msg(a, msg)
Definition: BLI_assert.h:53
#define BLI_INLINE
MINLINE float normalize_v3(float r[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
BLI_INLINE void BKE_multires_construct_tangent_matrix(float tangent_matrix[3][3], const float dPdu[3], const float dPdv[3], const int corner)