Blender V5.0
type_conversions.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
8
9#include "BLI_color.hh"
10#include "BLI_math_euler.hh"
12#include "BLI_math_vector.hh"
14
15namespace blender::bke {
16
17using mf::DataType;
18
19template<typename From, typename To, To (*ConversionF)(const From &)>
21{
22 static const CPPType &from_type = CPPType::get<From>();
23 static const CPPType &to_type = CPPType::get<To>();
24 static const std::string conversion_name = from_type.name() + " to " + to_type.name();
25
26 static auto multi_function = mf::build::SI1_SO<From, To>(
27 conversion_name.c_str(),
28 /* Use lambda instead of passing #ConversionF directly, because otherwise the compiler won't
29 * inline the function. */
30 [](const From &a) { return ConversionF(a); },
31 mf::build::exec_presets::AllSpanOrSingle());
32 static auto convert_single_to_initialized = [](const void *src, void *dst) {
33 *(To *)dst = ConversionF(*(const From *)src);
34 };
35 static auto convert_single_to_uninitialized = [](const void *src, void *dst) {
36 new (dst) To(ConversionF(*(const From *)src));
37 };
38 conversions.add(mf::DataType::ForSingle<From>(),
39 mf::DataType::ForSingle<To>(),
40 multi_function,
41 convert_single_to_initialized,
42 convert_single_to_uninitialized);
43}
44
45static float2 float_to_float2(const float &a)
46{
47 return float2(a);
48}
49static float3 float_to_float3(const float &a)
50{
51 return float3(a);
52}
53static float4 float_to_float4(const float &a)
54{
55 return float4(a);
56}
57static int32_t float_to_int(const float &a)
58{
59 return int32_t(a);
60}
61static short2 float_to_short2(const float &a)
62{
63 return short2(a);
64}
65static int2 float_to_int2(const float &a)
66{
67 return int2(a);
68}
69static bool float_to_bool(const float &a)
70{
71 return a > 0.0f;
72}
73static int8_t float_to_int8(const float &a)
74{
75 return std::clamp(
76 a, float(std::numeric_limits<int8_t>::min()), float(std::numeric_limits<int8_t>::max()));
77}
78static ColorGeometry4f float_to_color(const float &a)
79{
80 return ColorGeometry4f(a, a, a, 1.0f);
81}
83{
85}
87{
89}
90
92{
93 return float3(a.x, a.y, 0.0f);
94}
96{
97 return float4(a.x, a.y, 0.0f, 0.0f);
98}
99static float float2_to_float(const float2 &a)
100{
101 return (a.x + a.y) / 2.0f;
102}
103static int float2_to_int(const float2 &a)
104{
105 return int32_t((a.x + a.y) / 2.0f);
106}
108{
109 return short2(a.x, a.y);
110}
111static int2 float2_to_int2(const float2 &a)
112{
113 return int2(a.x, a.y);
114}
115static bool float2_to_bool(const float2 &a)
116{
117 return !math::is_zero(a);
118}
119static int8_t float2_to_int8(const float2 &a)
120{
121 return float_to_int8((a.x + a.y) / 2.0f);
122}
124{
125 return ColorGeometry4f(a.x, a.y, 0.0f, 1.0f);
126}
131
132static bool float3_to_bool(const float3 &a)
133{
134 return !math::is_zero(a);
135}
136static int8_t float3_to_int8(const float3 &a)
137{
138 return float_to_int8((a.x + a.y + a.z) / 3.0f);
139}
140static float float3_to_float(const float3 &a)
141{
142 return (a.x + a.y + a.z) / 3.0f;
143}
144static int float3_to_int(const float3 &a)
145{
146 return int((a.x + a.y + a.z) / 3.0f);
147}
149{
150 return short2(a.x, a.y);
151}
152static int2 float3_to_int2(const float3 &a)
153{
154 return int2(a.x, a.y);
155}
157{
158 return float2(a);
159}
161{
162 return float4(a, 0.0f);
163}
165{
166 return ColorGeometry4f(a.x, a.y, a.z, 1.0f);
167}
176
177static bool float4_to_bool(const float4 &a)
178{
179 return !math::is_zero(a);
180}
181static int8_t float4_to_int8(const float4 &a)
182{
183 return float_to_int8((a.x + a.y + a.z + a.w) / 4.0f);
184}
185static float float4_to_float(const float4 &a)
186{
187 return (a.x + a.y + a.z + a.w) / 4.0f;
188}
189static int float4_to_int(const float4 &a)
190{
191 return int((a.x + a.y + a.z + a.w) / 4.0f);
192}
194{
195 return short2(a.x, a.y);
196}
197static int2 float4_to_int2(const float4 &a)
198{
199 return int2(a.x, a.y);
200}
202{
203 return a.xy();
204}
206{
207 return a.xyz();
208}
210{
211 return ColorGeometry4f(a);
212}
218{
219 return math::Quaternion(a);
220}
221
222static bool int_to_bool(const int32_t &a)
223{
224 return a > 0;
225}
226static int8_t int_to_int8(const int32_t &a)
227{
228 return std::clamp(
229 a, int(std::numeric_limits<int8_t>::min()), int(std::numeric_limits<int8_t>::max()));
230}
232{
233 return short2(a);
234}
235static int2 int_to_int2(const int32_t &a)
236{
237 return int2(a);
238}
239static float int_to_float(const int32_t &a)
240{
241 return float(a);
242}
244{
245 return float2(float(a));
246}
248{
249 return float3(float(a));
250}
252{
253 return float4(float(a));
254}
256{
257 return ColorGeometry4f(float(a), float(a), float(a), 1.0f);
258}
260{
261 return color::encode(int_to_color(a));
262}
263
264static bool short2_to_bool(const short2 &a)
265{
266 return !math::is_zero(a);
267}
269{
270 return float2(a);
271}
272static int short2_to_int(const short2 &a)
273{
274 return math::midpoint(a.x, a.y);
275}
276static int2 short2_to_int2(const short2 &a)
277{
278 return int2(a.x, a.y);
279}
280static int8_t short2_to_int8(const short2 &a)
281{
282 return int_to_int8(short2_to_int(a));
283}
284static float short2_to_float(const short2 &a)
285{
286 return float2_to_float(float2(a));
287}
289{
290 return float3(float(a.x), float(a.y), 0.0f);
291}
293{
294 return float4(float(a.x), float(a.y), 0.0f, 0.0f);
295}
297{
298 return ColorGeometry4f(float(a.x), float(a.y), 0.0f, 1.0f);
299}
304
305static bool int2_to_bool(const int2 &a)
306{
307 return !math::is_zero(a);
308}
309static float2 int2_to_float2(const int2 &a)
310{
311 return float2(a);
312}
313static int int2_to_int(const int2 &a)
314{
315 return math::midpoint(a.x, a.y);
316}
317static short2 int2_to_short2(const int2 &a)
318{
319 return short2(a.x, a.y);
320}
321static int8_t int2_to_int8(const int2 &a)
322{
323 return int_to_int8(int2_to_int(a));
324}
325static float int2_to_float(const int2 &a)
326{
327 return float2_to_float(float2(a));
328}
329static float3 int2_to_float3(const int2 &a)
330{
331 return float3(float(a.x), float(a.y), 0.0f);
332}
333static float4 int2_to_float4(const int2 &a)
334{
335 return float4(float(a.x), float(a.y), 0.0f, 0.0f);
336}
338{
339 return ColorGeometry4f(float(a.x), float(a.y), 0.0f, 1.0f);
340}
342{
343 return color::encode(int2_to_color(a));
344}
345
346static bool int8_to_bool(const int8_t &a)
347{
348 return a > 0;
349}
350static int int8_to_int(const int8_t &a)
351{
352 return int(a);
353}
354static short2 int8_to_short2(const int8_t &a)
355{
356 return short2(a);
357}
358static int2 int8_to_int2(const int8_t &a)
359{
360 return int2(a);
361}
362static float int8_to_float(const int8_t &a)
363{
364 return float(a);
365}
366static float2 int8_to_float2(const int8_t &a)
367{
368 return float2(float(a));
369}
370static float3 int8_to_float3(const int8_t &a)
371{
372 return float3(float(a));
373}
374static float4 int8_to_float4(const int8_t &a)
375{
376 return float4(float(a));
377}
378static ColorGeometry4f int8_to_color(const int8_t &a)
379{
380 return ColorGeometry4f(float(a), float(a), float(a), 1.0f);
381}
382static ColorGeometry4b int8_to_byte_color(const int8_t &a)
383{
384 return color::encode(int8_to_color(a));
385}
386
387static float bool_to_float(const bool &a)
388{
389 return bool(a);
390}
391static int8_t bool_to_int8(const bool &a)
392{
393 return int8_t(a);
394}
395static int32_t bool_to_int(const bool &a)
396{
397 return int32_t(a);
398}
399static short2 bool_to_short2(const bool &a)
400{
401 return short2(a);
402}
403static int2 bool_to_int2(const bool &a)
404{
405 return int2(a);
406}
407static float2 bool_to_float2(const bool &a)
408{
409 return (a) ? float2(1.0f) : float2(0.0f);
410}
411static float3 bool_to_float3(const bool &a)
412{
413 return (a) ? float3(1.0f) : float3(0.0f);
414}
415static float4 bool_to_float4(const bool &a)
416{
417 return (a) ? float4(1.0f) : float4(0.0f);
418}
419static ColorGeometry4f bool_to_color(const bool &a)
420{
421 return (a) ? ColorGeometry4f(1.0f, 1.0f, 1.0f, 1.0f) : ColorGeometry4f(0.0f, 0.0f, 0.0f, 1.0f);
422}
424{
425 return color::encode(bool_to_color(a));
426}
427
428static bool color_to_bool(const ColorGeometry4f &a)
429{
430 return IMB_colormanagement_get_luminance(a) > 0.0f;
431}
432static float color_to_float(const ColorGeometry4f &a)
433{
435}
437{
439}
441{
442 return short2(a.r, a.g);
443}
445{
446 return int2(a.r, a.g);
447}
448static int8_t color_to_int8(const ColorGeometry4f &a)
449{
450 return int_to_int8(color_to_int(a));
451}
453{
454 return float2(a.r, a.g);
455}
457{
458 return float3(a.r, a.g, a.b);
459}
461{
462 return float4(a);
463}
465{
466 return color::encode(a);
467}
468
470{
471 return a.r > 0 || a.g > 0 || a.b > 0;
472}
474{
475 return color_to_float(color::decode(a));
476}
478{
479 return color_to_int(color::decode(a));
480}
482{
483 return short2(a.r, a.g);
484}
486{
487 return int2(a.r, a.g);
488}
489static int8_t byte_color_to_int8(const ColorGeometry4b &a)
490{
491 return color_to_int8(color::decode(a));
492}
506{
507 return color::decode(a);
508}
509
514
516{
517 return float3(math::to_euler(a).xyz());
518}
520{
521 return float4(a);
522}
527
529{
530 DataTypeConversions conversions;
531
543
554
566
578
589
600
611
622
633
644
655
657
661
662 return conversions;
663}
664
666{
667 static const DataTypeConversions conversions = create_implicit_conversions();
668 return conversions;
669}
670
672 const CPPType &to_type,
673 const void *from_value,
674 void *to_value) const
675{
676 if (from_type == to_type) {
677 from_type.copy_construct(from_value, to_value);
678 return;
679 }
680
681 const ConversionFunctions *functions = this->get_conversion_functions(
682 DataType::ForSingle(from_type), DataType::ForSingle(to_type));
683 BLI_assert(functions != nullptr);
684
685 functions->convert_single_to_uninitialized(from_value, to_value);
686}
687
689 const mf::MultiFunction &fn,
690 const IndexMask &mask,
691 GMutableSpan to)
692{
693 mf::ParamsBuilder params{fn, &mask};
694 params.add_readonly_single_input(from);
695 params.add_uninitialized_single_output(to);
696 mf::ContextBuilder context;
697 fn.call_auto(mask, params, context);
698}
699
701 const mf::MultiFunction &fn,
702 GMutableSpan to)
703{
705}
706
708{
709 const CPPType &from_type = from_span.type();
710 const CPPType &to_type = to_span.type();
711
712 BLI_assert(from_span.size() == to_span.size());
713 BLI_assert(this->is_convertible(from_type, to_type));
714
715 const mf::MultiFunction *fn = this->get_conversion_multi_function(DataType::ForSingle(from_type),
716 DataType::ForSingle(to_type));
717
718 to_type.destruct_n(to_span.data(), to_span.size());
720}
721
723 private:
724 GVArray varray_;
725 const CPPType &from_type_;
726 ConversionFunctions old_to_new_conversions_;
727
728 public:
730 const CPPType &to_type,
731 const DataTypeConversions &conversions)
732 : GVArrayImpl(to_type, varray.size()), varray_(std::move(varray)), from_type_(varray_.type())
733 {
734 old_to_new_conversions_ = *conversions.get_conversion_functions(from_type_, to_type);
735 }
736
737 private:
738 void get(const int64_t index, void *r_value) const override
739 {
740 BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
741 varray_.get(index, buffer);
742 old_to_new_conversions_.convert_single_to_initialized(buffer, r_value);
743 from_type_.destruct(buffer);
744 }
745
746 void get_to_uninitialized(const int64_t index, void *r_value) const override
747 {
748 BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
749 varray_.get(index, buffer);
750 old_to_new_conversions_.convert_single_to_uninitialized(buffer, r_value);
751 from_type_.destruct(buffer);
752 }
753
754 void materialize(const IndexMask &mask,
755 void *dst,
756 const bool dst_is_uninitialized) const override
757 {
758 if (!dst_is_uninitialized) {
759 type_->destruct_n(dst, mask.min_array_size());
760 }
762 *old_to_new_conversions_.multi_function,
763 mask,
764 {this->type(), dst, mask.min_array_size()});
765 }
766};
767
769 private:
770 GVMutableArray varray_;
771 const CPPType &from_type_;
772 ConversionFunctions old_to_new_conversions_;
773 ConversionFunctions new_to_old_conversions_;
774
775 public:
777 const CPPType &to_type,
778 const DataTypeConversions &conversions)
779 : GVMutableArrayImpl(to_type, varray.size()),
780 varray_(std::move(varray)),
781 from_type_(varray_.type())
782 {
783 old_to_new_conversions_ = *conversions.get_conversion_functions(from_type_, to_type);
784 new_to_old_conversions_ = *conversions.get_conversion_functions(to_type, from_type_);
785 }
786
787 private:
788 void get(const int64_t index, void *r_value) const override
789 {
790 BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
791 varray_.get(index, buffer);
792 old_to_new_conversions_.convert_single_to_initialized(buffer, r_value);
793 from_type_.destruct(buffer);
794 }
795
796 void get_to_uninitialized(const int64_t index, void *r_value) const override
797 {
798 BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
799 varray_.get(index, buffer);
800 old_to_new_conversions_.convert_single_to_uninitialized(buffer, r_value);
801 from_type_.destruct(buffer);
802 }
803
804 void set_by_move(const int64_t index, void *value) override
805 {
806 BUFFER_FOR_CPP_TYPE_VALUE(from_type_, buffer);
807 new_to_old_conversions_.convert_single_to_uninitialized(value, buffer);
808 varray_.set_by_relocate(index, buffer);
809 }
810
811 void materialize(const IndexMask &mask,
812 void *dst,
813 const bool dst_is_uninitialized) const override
814 {
815 if (!dst_is_uninitialized) {
816 type_->destruct_n(dst, mask.min_array_size());
817 }
819 *old_to_new_conversions_.multi_function,
820 mask,
821 {this->type(), dst, mask.min_array_size()});
822 }
823};
824
826{
827 const CPPType &from_type = varray.type();
828 if (from_type == to_type) {
829 return varray;
830 }
831 if (!this->is_convertible(from_type, to_type)) {
832 return {};
833 }
834 return GVArray::from<GVArray_For_ConvertedGVArray>(std::move(varray), to_type, *this);
835}
836
838 const CPPType &to_type) const
839{
840 const CPPType &from_type = varray.type();
841 if (from_type == to_type) {
842 return varray;
843 }
844 if (!this->is_convertible(from_type, to_type)) {
845 return {};
846 }
848 std::move(varray), to_type, *this);
849}
850
852{
853 const CPPType &from_type = field.cpp_type();
854 if (from_type == to_type) {
855 return field;
856 }
857 if (!this->is_convertible(from_type, to_type)) {
858 return {};
859 }
860 const mf::MultiFunction &fn = *this->get_conversion_multi_function(
861 mf::DataType::ForSingle(from_type), mf::DataType::ForSingle(to_type));
862 return {fn::FieldOperation::from(fn, {std::move(field)})};
863}
864
865} // namespace blender::bke
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BUFFER_FOR_CPP_TYPE_VALUE(type, variable_name)
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
long long int int64_t
static const CPPType & get()
void destruct_n(void *ptr, int64_t n) const
StringRefNull name() const
void copy_construct(const void *src, void *dst) const
void destruct(void *ptr) const
ChannelStorageType r
ChannelStorageType g
ChannelStorageType b
const CPPType & type() const
const CPPType & type() const
int64_t size() const
void get(int64_t index, void *r_value) const
GVArrayImpl(const CPPType &type, int64_t size)
const CPPType & type() const
static GVArray from(Args &&...args)
static GVArray from_span(GSpan span)
GVMutableArrayImpl(const CPPType &type, int64_t size)
static GVMutableArray from(Args &&...args)
void set_by_relocate(int64_t index, void *value)
void convert_to_uninitialized(const CPPType &from_type, const CPPType &to_type, const void *from_value, void *to_value) const
void add(mf::DataType from_type, mf::DataType to_type, const mf::MultiFunction &fn, void(*convert_single_to_initialized)(const void *src, void *dst), void(*convert_single_to_uninitialized)(const void *src, void *dst))
void convert_to_initialized_n(GSpan from_span, GMutableSpan to_span) const
const ConversionFunctions * get_conversion_functions(mf::DataType from, mf::DataType to) const
bool is_convertible(const CPPType &from_type, const CPPType &to_type) const
GVArray try_convert(GVArray varray, const CPPType &to_type) const
const mf::MultiFunction * get_conversion_multi_function(mf::DataType from, mf::DataType to) const
GVArray_For_ConvertedGVArray(GVArray varray, const CPPType &to_type, const DataTypeConversions &conversions)
GVMutableArray_For_ConvertedGVMutableArray(GVMutableArray varray, const CPPType &to_type, const DataTypeConversions &conversions)
static std::shared_ptr< FieldOperation > from(std::shared_ptr< const mf::MultiFunction > function, Vector< GField > inputs={})
Definition FN_field.hh:242
const CPPType & cpp_type() const
Definition FN_field.hh:130
nullptr float
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static float4 float_to_float4(const float &a)
static int2 bool_to_int2(const bool &a)
static float3 quaternion_to_float3(const math::Quaternion &a)
static float2 short2_to_float2(const short2 &a)
static float3 color_to_float3(const ColorGeometry4f &a)
static float bool_to_float(const bool &a)
static int2 int_to_int2(const int32_t &a)
static short2 float_to_short2(const float &a)
static short2 bool_to_short2(const bool &a)
static short2 float4_to_short2(const float4 &a)
static ColorGeometry4b float_to_byte_color(const float &a)
static ColorGeometry4f float_to_color(const float &a)
static int short2_to_int(const short2 &a)
static ColorGeometry4f byte_color_to_color(const ColorGeometry4b &a)
static int8_t float_to_int8(const float &a)
static float2 float4_to_float2(const float4 &a)
static float color_to_float(const ColorGeometry4f &a)
static ColorGeometry4b float4_to_byte_color(const float4 &a)
static int2 int8_to_int2(const int8_t &a)
static int float4_to_int(const float4 &a)
static float2 float_to_float2(const float &a)
static float int2_to_float(const int2 &a)
static ColorGeometry4b int_to_byte_color(const int32_t &a)
static int2 float_to_int2(const float &a)
static float2 int2_to_float2(const int2 &a)
static bool float_to_bool(const float &a)
static void add_implicit_conversion(DataTypeConversions &conversions)
static int8_t int2_to_int8(const int2 &a)
static bool int2_to_bool(const int2 &a)
static ColorGeometry4f float4_to_color(const float4 &a)
static float4 float2_to_float4(const float2 &a)
static int8_t float4_to_int8(const float4 &a)
static float4 float3_to_float4(const float3 &a)
static int8_t float2_to_int8(const float2 &a)
static ColorGeometry4b int2_to_byte_color(const int2 &a)
const DataTypeConversions & get_implicit_type_conversions()
static short2 int2_to_short2(const int2 &a)
static float float3_to_float(const float3 &a)
static float3 float2_to_float3(const float2 &a)
static float float2_to_float(const float2 &a)
static float3 float4_to_float3(const float4 &a)
static math::Quaternion float_to_quaternion(const float &a)
static float2 bool_to_float2(const bool &a)
static int8_t bool_to_int8(const bool &a)
static short2 color_to_short2(const ColorGeometry4f &a)
static ColorGeometry4b float3_to_byte_color(const float3 &a)
static float4 color_to_float4(const ColorGeometry4f &a)
static float short2_to_float(const short2 &a)
static float3 int8_to_float3(const int8_t &a)
static ColorGeometry4f short2_to_color(const short2 &a)
static int32_t color_to_int(const ColorGeometry4f &a)
static float3 float_to_float3(const float &a)
static float4 byte_color_to_float4(const ColorGeometry4b &a)
static ColorGeometry4f float3_to_color(const float3 &a)
static int2 byte_color_to_int2(const ColorGeometry4b &a)
static math::Quaternion float4_to_quaternion(const float4 &a)
static int2 float3_to_int2(const float3 &a)
static int float2_to_int(const float2 &a)
static bool byte_color_to_bool(const ColorGeometry4b &a)
static bool float2_to_bool(const float2 &a)
static bool color_to_bool(const ColorGeometry4f &a)
static float3 short2_to_float3(const short2 &a)
static short2 int_to_short2(const int32_t &a)
static ColorGeometry4f float2_to_color(const float2 &a)
static float2 int_to_float2(const int32_t &a)
static float int8_to_float(const int8_t &a)
static int2 color_to_int2(const ColorGeometry4f &a)
static bool short2_to_bool(const short2 &a)
static short2 int8_to_short2(const int8_t &a)
static float4 bool_to_float4(const bool &a)
static DataTypeConversions create_implicit_conversions()
static bool float3_to_bool(const float3 &a)
static ColorGeometry4b short2_to_byte_color(const short2 &a)
static float4 int8_to_float4(const int8_t &a)
static float4 int_to_float4(const int32_t &a)
static float2 int8_to_float2(const int8_t &a)
static bool int8_to_bool(const int8_t &a)
static float4x4 quaternion_to_float4x4(const math::Quaternion &a)
static int int2_to_int(const int2 &a)
static float3 int_to_float3(const int32_t &a)
static float float4_to_float(const float4 &a)
static float4 short2_to_float4(const short2 &a)
static float byte_color_to_float(const ColorGeometry4b &a)
static float3 int2_to_float3(const int2 &a)
static ColorGeometry4b float2_to_byte_color(const float2 &a)
static int32_t byte_color_to_int(const ColorGeometry4b &a)
static int32_t bool_to_int(const bool &a)
static int float3_to_int(const float3 &a)
static int2 short2_to_int2(const short2 &a)
static float int_to_float(const int32_t &a)
static short2 float3_to_short2(const float3 &a)
static math::Quaternion float3_to_quaternion(const float3 &a)
static ColorGeometry4f int_to_color(const int32_t &a)
static ColorGeometry4b bool_to_byte_color(const bool &a)
static ColorGeometry4f int2_to_color(const int2 &a)
static int32_t float_to_int(const float &a)
static bool int_to_bool(const int32_t &a)
static math::Quaternion float4x4_to_quaternion(const float4x4 &a)
static short2 byte_color_to_short2(const ColorGeometry4b &a)
static ColorGeometry4f int8_to_color(const int8_t &a)
static int8_t byte_color_to_int8(const ColorGeometry4b &a)
static bool float4_to_bool(const float4 &a)
static float2 float3_to_float2(const float3 &a)
static int2 float4_to_int2(const float4 &a)
static short2 float2_to_short2(const float2 &a)
static int8_t int_to_int8(const int32_t &a)
static float2 byte_color_to_float2(const ColorGeometry4b &a)
static int2 float2_to_int2(const float2 &a)
static int8_t float3_to_int8(const float3 &a)
static ColorGeometry4b int8_to_byte_color(const int8_t &a)
static ColorGeometry4b color_to_byte_color(const ColorGeometry4f &a)
static float2 color_to_float2(const ColorGeometry4f &a)
static float4 quaternion_to_float4(const math::Quaternion &a)
static int int8_to_int(const int8_t &a)
static int8_t color_to_int8(const ColorGeometry4f &a)
static void call_convert_to_uninitialized_fn(const GVArray &from, const mf::MultiFunction &fn, const IndexMask &mask, GMutableSpan to)
static ColorGeometry4f bool_to_color(const bool &a)
static int8_t short2_to_int8(const short2 &a)
static float3 byte_color_to_float3(const ColorGeometry4b &a)
static float4 int2_to_float4(const int2 &a)
static float3 bool_to_float3(const bool &a)
BLI_INLINE ColorSceneLinear4f< Alpha > decode(const ColorSceneLinearByteEncoded4b< Alpha > &color)
Definition BLI_color.hh:77
BLI_INLINE ColorSceneLinearByteEncoded4b< Alpha > encode(const ColorSceneLinear4f< Alpha > &color)
Definition BLI_color.hh:50
QuaternionBase< float > Quaternion
QuaternionBase< T > to_quaternion(const AxisAngleBase< T, AngleT > &axis_angle)
EulerXYZBase< float > EulerXYZ
bool is_zero(const T &a)
T midpoint(const T &a, const T &b)
QuaternionBase< T > normalized_to_quaternion_safe(const MatBase< T, 3, 3 > &mat)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
MatT from_rotation(const RotationT &rotation)
Euler3Base< T > to_euler(const AxisAngleBase< T, AngleT > &axis_angle, EulerOrder order)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
MatBase< float, 3, 3 > float3x3
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
blender::VecBase< int16_t, 2 > short2
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
VecBase< T, 2 > xy() const
VecBase< T, 3 > xyz() const
void(* convert_single_to_uninitialized)(const void *src, void *dst)
void(* convert_single_to_initialized)(const void *src, void *dst)