Blender
V4.3
source
blender
blenkernel
intern
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
15
BLI_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
}
BKE_multires.hh
BLI_assert_msg
#define BLI_assert_msg(a, msg)
Definition
BLI_assert.h:57
BLI_INLINE
#define BLI_INLINE
Definition
BLI_compiler_compat.h:37
BLI_math_vector.h
mul_v3_fl
MINLINE void mul_v3_fl(float r[3], float f)
Definition
math_vector_inline.c:546
copy_v3_v3
MINLINE void copy_v3_v3(float r[3], const float a[3])
Definition
math_vector_inline.c:43
cross_v3_v3v3
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
Definition
math_vector_inline.c:937
normalize_v3
MINLINE float normalize_v3(float n[3])
Definition
math_vector_inline.c:1243
BLI_utildefines.h
BKE_multires_construct_tangent_matrix
BLI_INLINE void BKE_multires_construct_tangent_matrix(float tangent_matrix[3][3], const float dPdu[3], const float dPdv[3], const int corner)
Definition
multires_inline.hh:15
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0