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