Blender V5.0
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
17 const blender::float3 &dPdu,
18 const blender::float3 &dPdv,
19 const int corner)
20{
21 if (corner == 0) {
22 tangent_matrix.x_axis() = dPdv * -1.0f;
23 tangent_matrix.y_axis() = dPdu * -1.0f;
24 }
25 else if (corner == 1) {
26 tangent_matrix.x_axis() = dPdu;
27 tangent_matrix.y_axis() = dPdv * -1.0f;
28 }
29 else if (corner == 2) {
30 tangent_matrix.x_axis() = dPdv;
31 tangent_matrix.y_axis() = dPdu;
32 }
33 else if (corner == 3) {
34 tangent_matrix.x_axis() = dPdu * -1.0f;
35 tangent_matrix.y_axis() = dPdv;
36 }
37 else {
38 BLI_assert_msg(0, "Unhandled corner index");
39 }
40 tangent_matrix.z_axis() = blender::math::cross(dPdu, dPdv);
41
42 tangent_matrix.x_axis() = blender::math::normalize(tangent_matrix.x_axis());
43 tangent_matrix.y_axis() = blender::math::normalize(tangent_matrix.y_axis());
44 tangent_matrix.z_axis() = blender::math::normalize(tangent_matrix.z_axis());
45}
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
#define BLI_INLINE
BLI_INLINE void BKE_multires_construct_tangent_matrix(blender::float3x3 &tangent_matrix, const blender::float3 &dPdu, const blender::float3 &dPdv, const int corner)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
MatBase< float, 3, 3 > float3x3
VecBase< float, 3 > float3