I've seen different code snippets using these types, but I haven't seen if they are defined in some <standard header file> or just defined in a "local header file" or even at file level.
So what Im wondering is: Is there any standard header file that defines these types? Or is there some standard definitions that everyone uses that I should copy?
I guess that a possible and common use to these types are representing coordinates, am I wrong?
Is there anything else I should think about if I want to use these to represent positions in a grid? Any reasons why or why not to use them?
EDIT:
Clarification: int2 means a pair of ints, float3 means a triplet of floats.
If these types were predefined somewhere it would be nice to use them instead of having to write it from scratch including the standard algebraic functions (operator+, operator-, etc.).
INT2. A 2-byte signed integer. signed short. INT4. A 4-byte signed integer.
Clarification: int2 means a pair of ints, float3 means a triplet of floats. If these types were predefined somewhere it would be nice to use them instead of having to write it from scratch including the standard algebraic functions (operator+, operator-, etc.).
float3(Boolean)Constructs a float3 vector from a single bool value by converting it to float and assigning it to every component.
These types aren't a part of standard C++. They might either be defined in some third-party library, or you're looking at some other dialect or language.
GPU code (Shader languages such as GLSL, Cg or HLSL, or GPGPU stuff like CUDA or OpenCL) typically defines types like these though, as names for the corresponding SIMD datatypes.
They are used in CUDA (and openCL?) where you have specific sized floats and memory usage and alignment is a big deal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With