Blender V5.0
blender::VecBase< T, Size > Struct Template Reference

#include <BLI_math_vector_types.hh>

Inherits blender::vec_struct_base< T, Size >.

Public Types

using base_type = T
using uint_type = VecBase<as_uint_type<T>, Size>

Public Member Functions

 BLI_STATIC_ASSERT (alignof(T)<=sizeof(T), "VecBase is not compatible with aligned type for now.")
 VecBase ()=default
template<BLI_ENABLE_IF_VEC(Size, > 1)>
 VecBase (T value)
template<typename U, BLI_ENABLE_IF((std::is_convertible_v< U, T >))>
 VecBase (U value)
template<BLI_ENABLE_IF_VEC(Size,==1)>
 VecBase (T _x)
template<BLI_ENABLE_IF_VEC(Size,==2)>
 VecBase (T _x, T _y)
template<BLI_ENABLE_IF_VEC(Size,==3)>
 VecBase (T _x, T _y, T _z)
template<BLI_ENABLE_IF_VEC(Size,==4)>
 VecBase (T _x, T _y, T _z, T _w)
template<typename U, BLI_ENABLE_IF_VEC(Size,==3)>
constexpr VecBase (const VecBase< U, 2 > &xy, T z)
template<typename U, BLI_ENABLE_IF_VEC(Size,==3)>
constexpr VecBase (T x, const VecBase< U, 2 > &yz)
template<typename U, BLI_ENABLE_IF_VEC(Size,==4)>
 VecBase (VecBase< U, 3 > xyz, T w)
template<typename U, BLI_ENABLE_IF_VEC(Size,==4)>
 VecBase (T x, VecBase< U, 3 > yzw)
template<typename U, typename V, BLI_ENABLE_IF_VEC(Size,==4)>
 VecBase (VecBase< U, 2 > xy, VecBase< V, 2 > zw)
template<typename U, BLI_ENABLE_IF_VEC(Size,==4)>
 VecBase (VecBase< U, 2 > xy, T z, T w)
template<typename U, BLI_ENABLE_IF_VEC(Size,==4)>
 VecBase (T x, VecBase< U, 2 > yz, T w)
template<typename U, BLI_ENABLE_IF_VEC(Size,==4)>
 VecBase (T x, T y, VecBase< U, 2 > zw)
template<typename U, int OtherSize, BLI_ENABLE_IF(OtherSize< Size)>
 VecBase (const VecBase< U, OtherSize > &other)=delete
template<typename U, int OtherSize, BLI_ENABLE_IF(OtherSize > Size)>
 VecBase (const VecBase< U, OtherSize > &other)
template<BLI_ENABLE_IF_VEC(Size, >=2)>
VecBase< T, 2 > xy () const
template<BLI_ENABLE_IF_VEC(Size, >=3)>
VecBase< T, 2 > yz () const
template<BLI_ENABLE_IF_VEC(Size, >=4)>
VecBase< T, 2 > zw () const
template<BLI_ENABLE_IF_VEC(Size, >=3)>
VecBase< T, 3 > xyz () const
template<BLI_ENABLE_IF_VEC(Size, >=4)>
VecBase< T, 3 > yzw () const
template<BLI_ENABLE_IF_VEC(Size, >=4)>
VecBase< T, 4 > xyzw () const
 VecBase (const T *ptr)
template<typename U, BLI_ENABLE_IF((std::is_convertible_v< U, T >))>
 VecBase (const U *ptr)
 VecBase (const T(*ptr)[Size])
template<typename U>
 VecBase (const VecBase< U, Size > &vec)
 operator const T * () const
 operator T* ()
const Toperator[] (int index) const
Toperator[] (int index)
VecBaseoperator+= (const VecBase &b) &
VecBaseoperator+= (const T &b) &
VecBaseoperator-= (const VecBase &b) &
VecBaseoperator-= (const T &b) &
VecBaseoperator*= (T b) &
VecBaseoperator*= (const VecBase &b) &
VecBaseoperator/= (T b) &
VecBaseoperator/= (const VecBase &b) &
 BLI_INT_OP (T) friend VecBase operator&(const VecBase &a
 BLI_INT_OP (T) friend VecBase operator&(const VecBase &a
 BLI_INT_OP (T) friend VecBase operator&(T a

Public Attributes

const VecBaseb
T b
Public Attributes inherited from blender::vec_struct_base< T, Size >
std::array< T, Size > values

Static Public Attributes

static constexpr int type_length = Size

Friends

VecBase operator+ (const VecBase &a, const VecBase &b)
VecBase operator+ (const VecBase &a, const T &b)
VecBase operator+ (const T &a, const VecBase &b)
VecBase operator- (const VecBase &a)
VecBase operator- (const VecBase &a, const VecBase &b)
VecBase operator- (const VecBase &a, const T &b)
VecBase operator- (const T &a, const VecBase &b)
VecBase operator* (const VecBase &a, const VecBase &b)
template<typename FactorT>
VecBase operator* (const VecBase &a, FactorT b)
VecBase operator* (T a, const VecBase &b)
VecBase operator/ (const VecBase &a, const VecBase &b)
VecBase operator/ (const VecBase &a, T b)
VecBase operator/ (T a, const VecBase &b)

Detailed Description

template<typename T, int Size>
struct blender::VecBase< T, Size >

Definition at line 66 of file BLI_math_vector_types.hh.

Member Typedef Documentation

◆ base_type

template<typename T, int Size>
using blender::VecBase< T, Size >::base_type = T

Definition at line 76 of file BLI_math_vector_types.hh.

◆ uint_type

template<typename T, int Size>
using blender::VecBase< T, Size >::uint_type = VecBase<as_uint_type<T>, Size>

Definition at line 77 of file BLI_math_vector_types.hh.

Constructor & Destructor Documentation

◆ VecBase() [1/21]

template<typename T, int Size>
blender::VecBase< T, Size >::VecBase ( )
default

◆ VecBase() [2/21]

template<typename T, int Size>
template<BLI_ENABLE_IF_VEC(Size, > 1)>
blender::VecBase< T, Size >::VecBase ( T value)
inlineexplicit

Definition at line 81 of file BLI_math_vector_types.hh.

◆ VecBase() [3/21]

template<typename T, int Size>
template<typename U, BLI_ENABLE_IF((std::is_convertible_v< U, T >))>
blender::VecBase< T, Size >::VecBase ( U value)
inlineexplicit

Definition at line 89 of file BLI_math_vector_types.hh.

◆ VecBase() [4/21]

template<typename T, int Size>
template<BLI_ENABLE_IF_VEC(Size,==1)>
blender::VecBase< T, Size >::VecBase ( T _x)
inline

Definition at line 93 of file BLI_math_vector_types.hh.

◆ VecBase() [5/21]

template<typename T, int Size>
template<BLI_ENABLE_IF_VEC(Size,==2)>
blender::VecBase< T, Size >::VecBase ( T _x,
T _y )
inline

Definition at line 98 of file BLI_math_vector_types.hh.

◆ VecBase() [6/21]

template<typename T, int Size>
template<BLI_ENABLE_IF_VEC(Size,==3)>
blender::VecBase< T, Size >::VecBase ( T _x,
T _y,
T _z )
inline

Definition at line 104 of file BLI_math_vector_types.hh.

◆ VecBase() [7/21]

template<typename T, int Size>
template<BLI_ENABLE_IF_VEC(Size,==4)>
blender::VecBase< T, Size >::VecBase ( T _x,
T _y,
T _z,
T _w )
inline

Definition at line 111 of file BLI_math_vector_types.hh.

◆ VecBase() [8/21]

template<typename T, int Size>
template<typename U, BLI_ENABLE_IF_VEC(Size,==3)>
blender::VecBase< T, Size >::VecBase ( const VecBase< U, 2 > & xy,
T z )
inlineconstexpr

Mixed scalar-vector constructors.

Definition at line 122 of file BLI_math_vector_types.hh.

◆ VecBase() [9/21]

template<typename T, int Size>
template<typename U, BLI_ENABLE_IF_VEC(Size,==3)>
blender::VecBase< T, Size >::VecBase ( T x,
const VecBase< U, 2 > & yz )
inlineconstexpr

Definition at line 127 of file BLI_math_vector_types.hh.

◆ VecBase() [10/21]

template<typename T, int Size>
template<typename U, BLI_ENABLE_IF_VEC(Size,==4)>
blender::VecBase< T, Size >::VecBase ( VecBase< U, 3 > xyz,
T w )
inline

Definition at line 132 of file BLI_math_vector_types.hh.

◆ VecBase() [11/21]

template<typename T, int Size>
template<typename U, BLI_ENABLE_IF_VEC(Size,==4)>
blender::VecBase< T, Size >::VecBase ( T x,
VecBase< U, 3 > yzw )
inline

Definition at line 137 of file BLI_math_vector_types.hh.

◆ VecBase() [12/21]

template<typename T, int Size>
template<typename U, typename V, BLI_ENABLE_IF_VEC(Size,==4)>
blender::VecBase< T, Size >::VecBase ( VecBase< U, 2 > xy,
VecBase< V, 2 > zw )
inline

Definition at line 142 of file BLI_math_vector_types.hh.

◆ VecBase() [13/21]

template<typename T, int Size>
template<typename U, BLI_ENABLE_IF_VEC(Size,==4)>
blender::VecBase< T, Size >::VecBase ( VecBase< U, 2 > xy,
T z,
T w )
inline

Definition at line 147 of file BLI_math_vector_types.hh.

◆ VecBase() [14/21]

template<typename T, int Size>
template<typename U, BLI_ENABLE_IF_VEC(Size,==4)>
blender::VecBase< T, Size >::VecBase ( T x,
VecBase< U, 2 > yz,
T w )
inline

Definition at line 152 of file BLI_math_vector_types.hh.

◆ VecBase() [15/21]

template<typename T, int Size>
template<typename U, BLI_ENABLE_IF_VEC(Size,==4)>
blender::VecBase< T, Size >::VecBase ( T x,
T y,
VecBase< U, 2 > zw )
inline

Definition at line 157 of file BLI_math_vector_types.hh.

◆ VecBase() [16/21]

template<typename T, int Size>
template<typename U, int OtherSize, BLI_ENABLE_IF(OtherSize< Size)>
blender::VecBase< T, Size >::VecBase ( const VecBase< U, OtherSize > & other)
delete

Prevent up-cast of dimensions (creating a bigger vector initialized with data from a smaller one) by deleting all copy constructors accepting smaller vectors as source.

◆ VecBase() [17/21]

template<typename T, int Size>
template<typename U, int OtherSize, BLI_ENABLE_IF(OtherSize > Size)>
blender::VecBase< T, Size >::VecBase ( const VecBase< U, OtherSize > & other)
inlineexplicit

Masking.

Definition at line 172 of file BLI_math_vector_types.hh.

◆ VecBase() [18/21]

template<typename T, int Size>
blender::VecBase< T, Size >::VecBase ( const T * ptr)
inline

Conversion from pointers (from C-style vectors).

Definition at line 223 of file BLI_math_vector_types.hh.

◆ VecBase() [19/21]

template<typename T, int Size>
template<typename U, BLI_ENABLE_IF((std::is_convertible_v< U, T >))>
blender::VecBase< T, Size >::VecBase ( const U * ptr)
inlineexplicit

Definition at line 228 of file BLI_math_vector_types.hh.

◆ VecBase() [20/21]

template<typename T, int Size>
blender::VecBase< T, Size >::VecBase ( const T(*) ptr[Size])
inline

Definition at line 233 of file BLI_math_vector_types.hh.

◆ VecBase() [21/21]

template<typename T, int Size>
template<typename U>
blender::VecBase< T, Size >::VecBase ( const VecBase< U, Size > & vec)
inlineexplicit

Conversion from other vector types.

Definition at line 241 of file BLI_math_vector_types.hh.

Member Function Documentation

◆ BLI_INT_OP() [1/3]

template<typename T, int Size>
blender::VecBase< T, Size >::BLI_INT_OP ( T ) const &

◆ BLI_INT_OP() [2/3]

template<typename T, int Size>
blender::VecBase< T, Size >::BLI_INT_OP ( T ) const &

Binary operators.

◆ BLI_INT_OP() [3/3]

template<typename T, int Size>
blender::VecBase< T, Size >::BLI_INT_OP ( T ) &

◆ BLI_STATIC_ASSERT()

template<typename T, int Size>
blender::VecBase< T, Size >::BLI_STATIC_ASSERT ( alignof(T)<=sizeof(T) ,
"VecBase< T, Size > is not compatible with aligned type for now."  )

◆ operator const T *()

template<typename T, int Size>
blender::VecBase< T, Size >::operator const T * ( ) const
inline

C-style pointer dereference.

Definition at line 248 of file BLI_math_vector_types.hh.

◆ operator T*()

template<typename T, int Size>
blender::VecBase< T, Size >::operator T* ( )
inline

Definition at line 253 of file BLI_math_vector_types.hh.

◆ operator*=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator*= ( const VecBase< T, Size > & b) &
inline

Definition at line 355 of file BLI_math_vector_types.hh.

◆ operator*=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator*= ( T b) &
inline

Definition at line 350 of file BLI_math_vector_types.hh.

◆ operator+=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator+= ( const T & b) &
inline

Definition at line 300 of file BLI_math_vector_types.hh.

◆ operator+=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator+= ( const VecBase< T, Size > & b) &
inline

Definition at line 295 of file BLI_math_vector_types.hh.

◆ operator-=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator-= ( const T & b) &
inline

Definition at line 330 of file BLI_math_vector_types.hh.

◆ operator-=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator-= ( const VecBase< T, Size > & b) &
inline

Definition at line 325 of file BLI_math_vector_types.hh.

◆ operator/=() [1/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator/= ( const VecBase< T, Size > & b) &
inline

Definition at line 388 of file BLI_math_vector_types.hh.

◆ operator/=() [2/2]

template<typename T, int Size>
VecBase & blender::VecBase< T, Size >::operator/= ( T b) &
inline

Definition at line 382 of file BLI_math_vector_types.hh.

◆ operator[]() [1/2]

template<typename T, int Size>
T & blender::VecBase< T, Size >::operator[] ( int index)
inline

Definition at line 267 of file BLI_math_vector_types.hh.

◆ operator[]() [2/2]

template<typename T, int Size>
const T & blender::VecBase< T, Size >::operator[] ( int index) const
inline

Array access.

Definition at line 260 of file BLI_math_vector_types.hh.

◆ xy()

template<typename T, int Size>
template<BLI_ENABLE_IF_VEC(Size, >=2)>
VecBase< T, 2 > blender::VecBase< T, Size >::xy ( ) const
inline

Swizzling.

Definition at line 181 of file BLI_math_vector_types.hh.

Referenced by blender::ed::greasepencil::boundary_to_curves(), blender::nodes::node_composite_vec_blur_cc::compute_max_tile_velocity_cpu(), blender::nodes::node_composite_cornerpin_cc::CornerPinOperation::compute_plane_cpu(), blender::nodes::node_composite_planetrackdeform_cc::PlaneTrackDeformOperation::compute_plane_cpu(), blender::nodes::node_composite_cornerpin_cc::CornerPinOperation::compute_plane_mask_cpu(), blender::nodes::node_composite_planetrackdeform_cc::PlaneTrackDeformOperation::compute_plane_mask_cpu(), blender::nodes::node_composite_vec_blur_cc::dilate_max_velocity_cpu(), blender::eevee::VolumeModule::draw_prepass(), blender::draw::overlay::MeshUVs::end_sync(), blender::eevee::VolumeModule::end_sync(), blender::bke::float4_to_float2(), blender::nodes::node_composite_vec_blur_cc::gather_sample(), blender::ed::greasepencil::generate_arc_from_point_to_point(), blender::ed::sculpt_paint::grease_pencil_fill_extension_cut(), blender::ed::sculpt_paint::grease_pencil_fill_extension_lines_from_circles(), blender::imbuf::transform::TransformContext::init(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_invoke(), blender::ed::transform::nla_transform_apply(), blender::ed::transform::EdgeSlideData::project(), blender::ed::transform::VertSlideData::project(), blender::eevee::IrradianceBake::raylists_build(), blender::compositor::SMAABlendingWeightCalculationPS(), blender::compositor::SMAABlendingWeightCalculationVS(), blender::compositor::SMAACalculateDiagWeights(), blender::compositor::SMAADetectHorizontalCornerPattern(), blender::compositor::SMAADetectVerticalCornerPattern(), blender::compositor::SMAAEdgeDetectionVS(), blender::compositor::SMAALumaEdgeDetectionPS(), blender::compositor::SMAANeighborhoodBlendingPS(), blender::compositor::SMAASearchDiag1(), blender::compositor::SMAASearchDiag2(), blender::eevee::Camera::sync(), blender::tests::TEST(), blender::image_engine::OneTexture::update_bounds(), blender::image_engine::ScreenTileTextures< Divisions >::update_bounds(), viewdolly_invoke(), viewroll_invoke(), and blender::eevee::VolumeObjectBounds::VolumeObjectBounds().

◆ xyz()

template<typename T, int Size>
template<BLI_ENABLE_IF_VEC(Size, >=3)>
VecBase< T, 3 > blender::VecBase< T, Size >::xyz ( ) const
inline

Definition at line 196 of file BLI_math_vector_types.hh.

Referenced by blender::apply_gradient_tint(), blender::ed::sculpt_paint::calc_brush_plane(), blender::nodes::node_composite_glare_cc::GlareOperation::compute_bloom_upsample_cpu(), blender::nodes::node_composite_channel_matte_cc::compute_channels(), blender::nodes::node_composite_kuwahara_cc::ConvertKuwaharaOperation::compute_classic(), blender::nodes::node_composite_inpaint_cc::InpaintOperation::compute_inpainting_region_cpu(), blender::nodes::node_composite_color_spill_cc::compute_spill_scale(), blender::nodes::node_composite_distance_matte_cc::distance_key(), blender::color::encode(), blender::nodes::node_composite_kuwahara_cc::ConvertKuwaharaOperation::execute_anisotropic_cpu(), blender::nodes::node_composite_glare_cc::GlareOperation::execute_highlights_cpu(), blender::bke::float4_to_float3(), blender::nodes::node_composite_glare_cc::GlareOperation::get_tint(), blender::ed::sculpt_paint::grease_pencil_brush_cursor_draw(), blender::noise::hash_int4_to_float3(), blender::nodes::node_composite_glare_cc::GlareOperation::karis_brightness_weighted_sum(), blender::nodes::node_composite_colorbalance_cc::lift_gamma_gain(), blender::ed::sculpt_paint::mask::mask_by_color_contiguous_mesh(), blender::ed::sculpt_paint::mask::mask_by_color_full_mesh(), blender::nodes::node_composite_colorbalance_cc::offset_power_slope(), blender::nodes::node_composite_alpha_over_cc::preprocess_foreground(), RE_bake_normal_world_to_tangent(), blender::compositor::SMAASearchDiag1(), blender::compositor::SMAASearchDiag2(), blender::tests::TEST(), WM_window_pixels_read_sample_from_frontbuffer(), and blender::nodes::node_composite_glare_cc::GlareOperation::write_glare_output_cpu().

◆ xyzw()

template<typename T, int Size>
template<BLI_ENABLE_IF_VEC(Size, >=4)>
VecBase< T, 4 > blender::VecBase< T, Size >::xyzw ( ) const
inline

Definition at line 206 of file BLI_math_vector_types.hh.

Referenced by blender::tests::TEST().

◆ yz()

template<typename T, int Size>
template<BLI_ENABLE_IF_VEC(Size, >=3)>
VecBase< T, 2 > blender::VecBase< T, Size >::yz ( ) const
inline

◆ yzw()

template<typename T, int Size>
template<BLI_ENABLE_IF_VEC(Size, >=4)>
VecBase< T, 3 > blender::VecBase< T, Size >::yzw ( ) const
inline

◆ zw()

◆ operator* [1/3]

template<typename T, int Size>
VecBase operator* ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Definition at line 335 of file BLI_math_vector_types.hh.

◆ operator* [2/3]

template<typename T, int Size>
template<typename FactorT>
VecBase operator* ( const VecBase< T, Size > & a,
FactorT b )
friend

Definition at line 340 of file BLI_math_vector_types.hh.

◆ operator* [3/3]

template<typename T, int Size>
VecBase operator* ( T a,
const VecBase< T, Size > & b )
friend

Definition at line 345 of file BLI_math_vector_types.hh.

◆ operator+ [1/3]

template<typename T, int Size>
VecBase operator+ ( const T & a,
const VecBase< T, Size > & b )
friend

Definition at line 290 of file BLI_math_vector_types.hh.

◆ operator+ [2/3]

template<typename T, int Size>
VecBase operator+ ( const VecBase< T, Size > & a,
const T & b )
friend

Definition at line 285 of file BLI_math_vector_types.hh.

◆ operator+ [3/3]

template<typename T, int Size>
VecBase operator+ ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Arithmetic operators.

Definition at line 280 of file BLI_math_vector_types.hh.

◆ operator- [1/4]

template<typename T, int Size>
VecBase operator- ( const T & a,
const VecBase< T, Size > & b )
friend

Definition at line 320 of file BLI_math_vector_types.hh.

◆ operator- [2/4]

template<typename T, int Size>
VecBase operator- ( const VecBase< T, Size > & a)
friend

Definition at line 305 of file BLI_math_vector_types.hh.

◆ operator- [3/4]

template<typename T, int Size>
VecBase operator- ( const VecBase< T, Size > & a,
const T & b )
friend

Definition at line 315 of file BLI_math_vector_types.hh.

◆ operator- [4/4]

template<typename T, int Size>
VecBase operator- ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Definition at line 310 of file BLI_math_vector_types.hh.

◆ operator/ [1/3]

template<typename T, int Size>
VecBase operator/ ( const VecBase< T, Size > & a,
const VecBase< T, Size > & b )
friend

Definition at line 360 of file BLI_math_vector_types.hh.

◆ operator/ [2/3]

template<typename T, int Size>
VecBase operator/ ( const VecBase< T, Size > & a,
T b )
friend

Definition at line 368 of file BLI_math_vector_types.hh.

◆ operator/ [3/3]

template<typename T, int Size>
VecBase operator/ ( T a,
const VecBase< T, Size > & b )
friend

Definition at line 374 of file BLI_math_vector_types.hh.

Member Data Documentation

◆ b [1/2]

template<typename T, int Size>
T blender::VecBase< T, Size >::b
Initial value:
{
#define BLI_UNROLL_MATH_VEC_OP_VEC_SCALAR(op, a, b)

Definition at line 403 of file BLI_math_vector_types.hh.

◆ b [2/2]

template<typename T, int Size>
const VecBase & VecBase< T, Sz >::b
Initial value:
{
#define BLI_UNROLL_MATH_VEC_OP_VEC_VEC(op, a, b)

Definition at line 398 of file BLI_math_vector_types.hh.

◆ type_length

template<typename T, int Size>
int blender::VecBase< T, Size >::type_length = Size
staticconstexpr

Definition at line 74 of file BLI_math_vector_types.hh.


The documentation for this struct was generated from the following file: