Blender V5.3
gpu_shader_math_matrix_transform.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
17{
18 return mat * point;
19}
20
25{
26 return (mat * float4(point, 1.0f)).xyz;
27}
28
33{
34 return (mat * float3(point, 1.0f)).xy;
35}
36
41{
42 return mat * direction;
43}
44
49{
50 return to_float3x3(mat) * direction;
51}
52
57{
58 float3 tmp = mat * float3(point, 1.0f);
59 /* Absolute value to not flip the frustum upside down behind the camera. */
60 return tmp.xy / abs(tmp.z);
61}
62
67{
68 float3 tmp = mat * float3(point, 1.0f);
69 /* Absolute value to not flip the frustum upside down behind the camera. */
70 float divisor = abs(tmp.z);
71 return (divisor != 0.0f) ? (tmp.xy / divisor) : float2(0.0f);
72}
73
78{
79 float4 tmp = mat * float4(point, 1.0f);
80 /* Absolute value to not flip the frustum upside down behind the camera. */
81 return tmp.xyz / abs(tmp.w);
82}
83
88{
89 float4 tmp = mat * float4(point, 1.0f);
90 /* Absolute value to not flip the frustum upside down behind the camera. */
91 float divisor = abs(tmp.w);
92 return (divisor != 0.0f) ? (tmp.xyz / divisor) : float3(0.0f);
93}
94
#define abs
float2 project_point_safe(float3x3 mat, float2 point)
float3 transform_direction(float3x3 mat, float3 direction)
float3 transform_point(float3x3 mat, float3 point)
float2 project_point(float3x3 mat, float2 point)
MatBase< float, 4, 4 > float4x4
float z
Definition sky_math.h:136
float w
Definition sky_math.h:225