Blender V5.3
gpu_shader_math_matrix.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
8
9/* -------------------------------------------------------------------- */
12
16// float3x3 transpose(float3x3 mat); /* Built-In using shading languages. */
17
22// float determinant(float3x3 mat); /* Built-In using shading languages. */
23
29{
30 return inverse(mat);
31}
32
37{
38 return inverse(mat);
39}
40
45{
46 return inverse(mat);
47}
48
53float2x2 invert(float2x2 mat, bool &r_success)
54{
55 r_success = determinant(mat) != 0.0f;
56 return r_success ? inverse(mat) : float2x2(0.0f);
57}
58
62float3x3 invert(float3x3 mat, bool &r_success)
63{
64 r_success = determinant(mat) != 0.0f;
65 return r_success ? inverse(mat) : float3x3(0.0f);
66}
67
71float4x4 invert(float4x4 mat, bool &r_success)
72{
73 r_success = determinant(mat) != 0.0f;
74 return r_success ? inverse(mat) : float4x4(0.0f);
75}
76
81{
82 mat[3].xyz += translation[0] * mat[0].xyz;
83 mat[3].xyz += translation[1] * mat[1].xyz;
84 mat[3].xyz += translation[2] * mat[2].xyz;
85 return mat;
86}
87
91{
92 mat[3].xyz += translation[0] * mat[0].xyz;
93 mat[3].xyz += translation[1] * mat[1].xyz;
94 return mat;
95}
96
101{
102 mat[0] *= scale[0];
103 mat[1] *= scale[1];
104 return mat;
105}
106
110{
111 mat[0] *= scale[0];
112 mat[1] *= scale[1];
113 mat[2] *= scale[2];
114 return mat;
115}
116
120{
121 mat[0] *= scale[0];
122 mat[1] *= scale[1];
123 return mat;
124}
125
129{
130 mat[0] *= scale[0];
131 mat[1] *= scale[1];
132 mat[2] *= scale[2];
133 return mat;
134}
135
b[1] b &&[1] b &&[1] b &&[1] b &&[1] b[3] b &&[1] b[3] float determinant(MatBase< C, R >) RET
MatBase< C, R > inverse(MatBase< C, R >) RET
float2x2 invert(float2x2 mat)
float3x3 scale(float3x3 mat, float2 scale)
float4x4 translate(float4x4 mat, float3 translation)
MatBase< float, 2, 2 > float2x2
MatBase< float, 4, 4 > float4x4