Blender V5.3
gpu_shader_math_vector.bsl.hh File Reference

Go to the source code of this file.

Functions

template<typename VecT, typename FacT>
VecT endvalue_preserving_mix (VecT a, VecT b, FacT t)
template float2 endvalue_preserving_mix< float2, float > (float2, float2, float)
template float3 endvalue_preserving_mix< float3, float > (float3, float3, float)
template float4 endvalue_preserving_mix< float4, float > (float4, float4, float)
template float2 endvalue_preserving_mix< float2, float2 > (float2, float2, float2)
template float3 endvalue_preserving_mix< float3, float3 > (float3, float3, float3)
template float4 endvalue_preserving_mix< float4, float4 > (float4, float4, float4)
template<typename VecT>
VecT ceil_to_multiple (VecT a, VecT b)
template int2 ceil_to_multiple< int2 > (int2, int2)
template int3 ceil_to_multiple< int3 > (int3, int3)
template int4 ceil_to_multiple< int4 > (int4, int4)
template uint2 ceil_to_multiple< uint2 > (uint2, uint2)
template uint3 ceil_to_multiple< uint3 > (uint3, uint3)
template uint4 ceil_to_multiple< uint4 > (uint4, uint4)
template<typename VecT>
VecT divide_ceil (VecT a, VecT b)
template int2 divide_ceil< int2 > (int2, int2)
template int3 divide_ceil< int3 > (int3, int3)
template int4 divide_ceil< int4 > (int4, int4)
template uint2 divide_ceil< uint2 > (uint2, uint2)
template uint3 divide_ceil< uint3 > (uint3, uint3)
template uint4 divide_ceil< uint4 > (uint4, uint4)
template<typename VecT>
void min_max (VecT vector, VecT &min_v, VecT &max_v)
template void min_max< float2 > (float2, float2 &, float2 &)
template void min_max< float3 > (float3, float3 &, float3 &)
template void min_max< float4 > (float4, float4 &, float4 &)
template<typename VecT>
float length_manhattan (VecT a)
template float length_manhattan< float2 > (float2)
template float length_manhattan< float3 > (float3)
template float length_manhattan< float4 > (float4)
template<typename VecT>
float length_squared (VecT a)
template float length_squared< float2 > (float2)
template float length_squared< float3 > (float3)
template float length_squared< float4 > (float4)
template<typename VecT>
float distance_manhattan (VecT a, VecT b)
template float distance_manhattan< float2 > (float2, float2)
template float distance_manhattan< float3 > (float3, float3)
template float distance_manhattan< float4 > (float4, float4)
template<typename VecT>
float distance_squared (VecT a, VecT b)
template float distance_squared< float2 > (float2, float2)
template float distance_squared< float3 > (float3, float3)
template float distance_squared< float4 > (float4, float4)
template<typename VecT>
float angle_normalized (VecT v1, VecT v2)
template float angle_normalized< float2 > (float2, float2)
template float angle_normalized< float3 > (float3, float3)
template float angle_normalized< float4 > (float4, float4)
template<typename VecT>
VecT normalize_and_get_length (VecT vector, float &out_length)
template float2 normalize_and_get_length< float2 > (float2, float &)
template float3 normalize_and_get_length< float3 > (float3, float &)
template float4 normalize_and_get_length< float4 > (float4, float &)
template<typename VecT>
VecT interpolate (VecT a, VecT b, float t)
template float2 interpolate< float2 > (float2, float2, float)
template float3 interpolate< float3 > (float3, float3, float)
template float4 interpolate< float4 > (float4, float4, float)
template<typename VecT>
VecT midpoint (VecT a, VecT b)
template float2 midpoint< float2 > (float2, float2)
template float3 midpoint< float3 > (float3, float3)
template float4 midpoint< float4 > (float4, float4)
int dominant_axis (float3 a)
template<typename VecT>
VecT orthogonal (VecT v)
template int2 orthogonal< int2 > (int2)
template float2 orthogonal< float2 > (float2)
template<>
float3 orthogonal< float3 > (float3 v)

Function Documentation

◆ angle_normalized()

◆ angle_normalized< float2 >()

template float angle_normalized< float2 > ( float2 ,
float2  )

References angle_normalized().

◆ angle_normalized< float3 >()

template float angle_normalized< float3 > ( float3 ,
float3  )

References angle_normalized().

◆ angle_normalized< float4 >()

template float angle_normalized< float4 > ( float4 ,
float4  )

References angle_normalized().

◆ ceil_to_multiple()

template<typename VecT>
VecT ceil_to_multiple ( VecT a,
VecT b )

Returns a if it is a multiple of b or the next multiple or b after a . In other words, it is equivalent to divide_ceil(a, b) * b. It is undefined if a is negative or b is not strictly positive.

Definition at line 37 of file gpu_shader_math_vector.bsl.hh.

References b, and ceil_to_multiple().

◆ ceil_to_multiple< int2 >()

template int2 ceil_to_multiple< int2 > ( int2 ,
int2  )

References ceil_to_multiple().

◆ ceil_to_multiple< int3 >()

template int3 ceil_to_multiple< int3 > ( int3 ,
int3  )

References ceil_to_multiple().

◆ ceil_to_multiple< int4 >()

template int4 ceil_to_multiple< int4 > ( int4 ,
int4  )

References ceil_to_multiple().

◆ ceil_to_multiple< uint2 >()

template uint2 ceil_to_multiple< uint2 > ( uint2 ,
uint2  )

References ceil_to_multiple().

◆ ceil_to_multiple< uint3 >()

template uint3 ceil_to_multiple< uint3 > ( uint3 ,
uint3  )

References ceil_to_multiple().

◆ ceil_to_multiple< uint4 >()

template uint4 ceil_to_multiple< uint4 > ( uint4 ,
uint4  )

References ceil_to_multiple().

◆ distance_manhattan()

template<typename VecT>
float distance_manhattan ( VecT a,
VecT b )

Return the manhattan distance between a and b.

Definition at line 101 of file gpu_shader_math_vector.bsl.hh.

References b, distance_manhattan(), and length_manhattan().

Referenced by distance_manhattan(), distance_manhattan< float2 >(), distance_manhattan< float3 >(), and distance_manhattan< float4 >().

◆ distance_manhattan< float2 >()

◆ distance_manhattan< float3 >()

◆ distance_manhattan< float4 >()

◆ distance_squared()

template<typename VecT>
float distance_squared ( VecT a,
VecT b )

Return the squared distance between a and b.

Definition at line 112 of file gpu_shader_math_vector.bsl.hh.

References b, distance_squared(), and length_squared().

Referenced by blender::bone_envelope_falloff(), blender::ed::sculpt_paint::greasepencil::brush_point_influence_mask(), blender::cast_ray_highpoly(), blender::noise::compute_2d_gabor_kernel(), compute_2d_gabor_kernel(), compute_2d_gabor_kernel(), blender::noise::compute_3d_gabor_kernel(), compute_3d_gabor_kernel(), compute_3d_gabor_kernel(), blender::nodes::node_composite_lens_distortion_cc::compute_chromatic_distortion_scale(), blender::nodes::node_composite_lens_distortion_cc::compute_distortion_scale(), blender::nodes::node_composite_lens_distortion_cc::compute_number_of_integration_steps(), distance_squared(), distance_squared< float2 >(), distance_squared< float3 >(), distance_squared< float4 >(), blender::distfactor_to_bone(), blender::ed_tracking_pick_plane_track(), blender::ed_tracking_pick_point_track(), blender::meshintersect::fill_crossdata_for_intersect(), overlay::edit_vert::frag(), blender::nodes::node_composite_lens_distortion_cc::integrate_distortion(), intersect(), builtin::socket::main_frag(), blender::mouse_to_closest_corners_edge_distance_squared(), blender::mouse_to_closest_pattern_corner_distance_squared(), blender::ed::curves::pen_tool::pen_find_closest_edge_point(), blender::ed::curves::pen_tool::pen_find_closest_handle(), blender::ed::curves::pen_tool::pen_find_closest_point(), blender::ed::greasepencil::primitive_check_ui_hover(), blender::nodes::node_composite_lens_distortion_cc::radial_lens_distortion(), and blender::meshintersect::remove_non_constraint_edges_leave_valid_bmesh().

◆ distance_squared< float2 >()

template float distance_squared< float2 > ( float2 ,
float2  )

References distance_squared().

◆ distance_squared< float3 >()

template float distance_squared< float3 > ( float3 ,
float3  )

References distance_squared().

◆ distance_squared< float4 >()

template float distance_squared< float4 > ( float4 ,
float4  )

References distance_squared().

◆ divide_ceil()

template<typename VecT>
VecT divide_ceil ( VecT a,
VecT b )

Integer division that returns the ceiling, instead of flooring like normal C division. It is undefined if a is negative or b is not strictly positive.

Definition at line 52 of file gpu_shader_math_vector.bsl.hh.

References b, and divide_ceil().

◆ divide_ceil< int2 >()

template int2 divide_ceil< int2 > ( int2 ,
int2  )

References divide_ceil().

◆ divide_ceil< int3 >()

template int3 divide_ceil< int3 > ( int3 ,
int3  )

References divide_ceil().

◆ divide_ceil< int4 >()

template int4 divide_ceil< int4 > ( int4 ,
int4  )

References divide_ceil().

◆ divide_ceil< uint2 >()

template uint2 divide_ceil< uint2 > ( uint2 ,
uint2  )

References divide_ceil().

◆ divide_ceil< uint3 >()

template uint3 divide_ceil< uint3 > ( uint3 ,
uint3  )

References divide_ceil().

◆ divide_ceil< uint4 >()

template uint4 divide_ceil< uint4 > ( uint4 ,
uint4  )

References divide_ceil().

◆ dominant_axis()

int dominant_axis ( float3 a)

Return the index of the component with the greatest absolute value.

Definition at line 185 of file gpu_shader_math_vector.bsl.hh.

References abs, b, and dominant_axis().

Referenced by dominant_axis(), orthogonal< float3 >(), and eevee::surf_capture().

◆ endvalue_preserving_mix()

template<typename VecT, typename FacT>
VecT endvalue_preserving_mix ( VecT a,
VecT b,
FacT t )

Definition at line 21 of file gpu_shader_math_vector.bsl.hh.

References b, and endvalue_preserving_mix().

◆ endvalue_preserving_mix< float2, float >()

◆ endvalue_preserving_mix< float2, float2 >()

◆ endvalue_preserving_mix< float3, float >()

◆ endvalue_preserving_mix< float3, float3 >()

◆ endvalue_preserving_mix< float4, float >()

◆ endvalue_preserving_mix< float4, float4 >()

◆ interpolate()

template<typename VecT>
VecT interpolate ( VecT a,
VecT b,
float t )

Per component linear interpolation.

Definition at line 163 of file gpu_shader_math_vector.bsl.hh.

References b, interpolate(), and mix.

◆ interpolate< float2 >()

template float2 interpolate< float2 > ( float2 ,
float2 ,
float  )

References interpolate().

◆ interpolate< float3 >()

template float3 interpolate< float3 > ( float3 ,
float3 ,
float  )

References interpolate().

◆ interpolate< float4 >()

template float4 interpolate< float4 > ( float4 ,
float4 ,
float  )

References interpolate().

◆ length_manhattan()

template<typename VecT>
float length_manhattan ( VecT a)

Return the manhattan length of a. This is also the sum of the absolute value of all components.

Definition at line 79 of file gpu_shader_math_vector.bsl.hh.

References abs, dot(), and length_manhattan().

Referenced by distance_manhattan(), length_manhattan(), length_manhattan< float2 >(), length_manhattan< float3 >(), length_manhattan< float4 >(), gbuffer::normal_pack(), and to_euler().

◆ length_manhattan< float2 >()

References length_manhattan().

◆ length_manhattan< float3 >()

References length_manhattan().

◆ length_manhattan< float4 >()

References length_manhattan().

◆ length_squared()

◆ length_squared< float2 >()

template float length_squared< float2 > ( float2 )

References length_squared().

◆ length_squared< float3 >()

template float length_squared< float3 > ( float3 )

References length_squared().

◆ length_squared< float4 >()

template float length_squared< float4 > ( float4 )

References length_squared().

◆ midpoint()

template<typename VecT>
VecT midpoint ( VecT a,
VecT b )

Return half-way point between a and b.

Definition at line 174 of file gpu_shader_math_vector.bsl.hh.

References b, and midpoint().

◆ midpoint< float2 >()

template float2 midpoint< float2 > ( float2 ,
float2  )

References midpoint().

◆ midpoint< float3 >()

template float3 midpoint< float3 > ( float3 ,
float3  )

References midpoint().

◆ midpoint< float4 >()

template float4 midpoint< float4 > ( float4 ,
float4  )

References midpoint().

◆ min_max()

template<typename VecT>
void min_max ( VecT vector,
VecT & min_v,
VecT & max_v )

Component wise, use vector to replace min if it is smaller and max if bigger.

Definition at line 66 of file gpu_shader_math_vector.bsl.hh.

References max, min, and min_max().

◆ min_max< float2 >()

template void min_max< float2 > ( float2 ,
float2 & ,
float2 &  )

References min_max().

◆ min_max< float3 >()

template void min_max< float3 > ( float3 ,
float3 & ,
float3 &  )

References min_max().

◆ min_max< float4 >()

template void min_max< float4 > ( float4 ,
float4 & ,
float4 &  )

References min_max().

◆ normalize_and_get_length()

◆ normalize_and_get_length< float2 >()

◆ normalize_and_get_length< float3 >()

◆ normalize_and_get_length< float4 >()

◆ orthogonal()

template<typename VecT>
VecT orthogonal ( VecT v)

Calculates a perpendicular vector to v.

Note
Returned vector is always rotated 90 degrees counter clock wise.

Definition at line 195 of file gpu_shader_math_vector.bsl.hh.

References orthogonal().

Referenced by axes_to_rotation(), eevee::fast_gi::eval(), orthogonal(), orthogonal< float2 >(), orthogonal< float3 >(), orthogonal< int2 >(), blender::eevee::IrradianceBake::raylists_build(), and eevee::raytracing::denoise::spatial_main().

◆ orthogonal< float2 >()

template float2 orthogonal< float2 > ( float2 )

References orthogonal().

◆ orthogonal< float3 >()

template<>
float3 orthogonal< float3 > ( float3 v)

Calculates a perpendicular vector to v.

Note
Returned vector can be in any perpendicular direction.
Returned vector might not the same length as v.

Definition at line 207 of file gpu_shader_math_vector.bsl.hh.

References dominant_axis(), and orthogonal().

◆ orthogonal< int2 >()

template int2 orthogonal< int2 > ( int2 )

References orthogonal().