Blender V5.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
8
9#pragma once
10
11#include "BKE_multires.hh"
13#include "BLI_math_vector.hh"
15
16namespace blender {
17
19 const float3 &dPdu,
20 const float3 &dPdv,
21 const int corner)
22{
23 if (corner == 0) {
24 tangent_matrix.x_axis() = dPdv * -1.0f;
25 tangent_matrix.y_axis() = dPdu * -1.0f;
26 }
27 else if (corner == 1) {
28 tangent_matrix.x_axis() = dPdu;
29 tangent_matrix.y_axis() = dPdv * -1.0f;
30 }
31 else if (corner == 2) {
32 tangent_matrix.x_axis() = dPdv;
33 tangent_matrix.y_axis() = dPdu;
34 }
35 else if (corner == 3) {
36 tangent_matrix.x_axis() = dPdu * -1.0f;
37 tangent_matrix.y_axis() = dPdv;
38 }
39 else {
40 BLI_assert_msg(0, "Unhandled corner index");
41 }
42 tangent_matrix.z_axis() = math::cross(dPdu, dPdv);
43
44 tangent_matrix.x_axis() = math::normalize(tangent_matrix.x_axis());
45 tangent_matrix.y_axis() = math::normalize(tangent_matrix.y_axis());
46 tangent_matrix.z_axis() = math::normalize(tangent_matrix.z_axis());
47}
48
49} // namespace blender
#define BLI_INLINE
#define BLI_assert_msg(a, msg)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
BMesh Iterators.
BLI_INLINE void BKE_multires_construct_tangent_matrix(float3x3 &tangent_matrix, const float3 &dPdu, const float3 &dPdv, int corner)
MatBase< float, 3, 3 > float3x3
VecBase< float, 3 > float3