Blender V4.5
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
8
9#pragma once
10
11#include "BKE_multires.hh"
12#include "BLI_math_vector.h"
13
14BLI_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 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)