17 # pragma warning(disable : 4127)
33 #define OIIO_TYPEDESC_VECTOR2 1
134 int arraylen=0) noexcept
135 : basetype(static_cast<
unsigned char>(btype)),
136 aggregate(static_cast<
unsigned char>(agg)),
137 vecsemantics(static_cast<
unsigned char>(semantics)), reserved(0),
148 :
TypeDesc(btype, agg, NOSEMANTICS, arraylen) {}
167 : basetype(
t.basetype), aggregate(
t.aggregate),
168 vecsemantics(
t.vecsemantics), reserved(0), arraylen(
t.arraylen)
174 const char *c_str()
const;
177 o << t.
c_str();
return o;
184 "of array with unspecified length (%d)", arraylen);
185 return (arraylen >= 1 ? arraylen : 1);
192 return numelements() * aggregate;
209 "of array with unspecified length (%d)", arraylen);
210 size_t a = (size_t) (arraylen > 0 ? arraylen : 1);
211 if (
sizeof(
size_t) >
sizeof(
int)) {
213 return a * elementsize();
216 unsigned long long s = (
unsigned long long) a * elementsize();
218 return s < toobig ? (size_t)s : toobig;
238 size_t basesize () const noexcept;
242 bool is_floating_point () const noexcept;
248 OIIO_HOSTDEVICE constexpr
bool is_unknown () const noexcept {
return (basetype == UNKNOWN); }
251 OIIO_HOSTDEVICE constexpr
operator bool () const noexcept {
return (basetype != UNKNOWN); }
262 return basetype ==
t.basetype && aggregate ==
t.aggregate &&
263 vecsemantics ==
t.vecsemantics && arraylen ==
t.arraylen;
291 return a.basetype ==
b.basetype &&
a.aggregate ==
b.aggregate &&
292 (
a.arraylen ==
b.arraylen || (
a.is_unsized_array() &&
b.is_sized_array())
293 || (
a.is_sized_array() &&
b.is_unsized_array()));
297 return this->basetype ==
b.basetype && this->aggregate ==
b.aggregate &&
298 (this->arraylen ==
b.arraylen || (this->is_unsized_array() &&
b.is_sized_array())
299 || (this->is_sized_array() &&
b.is_unsized_array()));
304 return this->aggregate == VEC2 && this->basetype ==
b && !is_array();
309 return this->aggregate == VEC3 && this->basetype ==
b && !is_array();
314 return this->aggregate == VEC4 && this->basetype ==
b && !is_array();
319 return this->aggregate == VEC2 && this->basetype ==
b && arraylen == 2
320 && this->vecsemantics == BOX;
325 return this->aggregate == VEC3 && this->basetype ==
b && arraylen == 2
326 && this->vecsemantics == BOX;
381 static constexpr
TypeDesc TypeMatrix = TypeMatrix44;
385 static constexpr
TypeDesc TypeVector4 = TypeFloat4;
413 const char *float_fmt,
414 const char *string_fmt =
"%s",
415 const char aggregate_delim[2] =
"()",
416 const char *aggregate_sep =
",",
417 const char array_delim[2] =
"{}",
418 const char *array_sep =
",");
433 #if defined(_HALF_H_) || defined(IMATH_HALF_H_)
456 #ifdef INCLUDED_IMATHVEC_H
462 #ifdef INCLUDED_IMATHCOLOR_H
465 #ifdef INCLUDED_IMATHMATRIX_H
471 #ifdef INCLUDED_IMATHBOX_H
490 #if defined(_HALF_H_) || defined(IMATH_HALF_H_)
592 auto it = ctx.begin(),
end = ctx.end();
593 if (it !=
end && (*it ==
's')) ++it;
595 if (it !=
end && *it !=
'}')
601 template <
typename FormatContext>
602 auto format(
const OIIO::TypeDesc&
t, FormatContext& ctx) -> decltype(ctx.out())
const {
OIIO_HOSTDEVICE constexpr bool is_box3(BASETYPE b=FLOAT) const noexcept
Is this an array of aggregates that represents a 3D bounding box?
32-bit IEEE floating point values, (C/C++ float).
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
unsigned char reserved
Reserved for future expansion.
static const TypeDesc TypeTimeCode
64-bit IEEE floating point values, (C/C++ double).
16-bit IEEE floating point values (OpenEXR half).
static const TypeDesc TypeString
MX_GENSHADER_API const TypeDesc * MATRIX44
OIIO_HOSTDEVICE constexpr bool is_vec4(BASETYPE b=FLOAT) const noexcept
Is this a 4-vector aggregate (of the given type, float by default)?
static const TypeDesc TypeFloat4
OIIO_HOSTDEVICE constexpr bool equivalent(const TypeDesc &b) const noexcept
Member version of equivalent.
unsigned char aggregate
What kind of AGGREGATE is it?
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
GLsizei const GLchar *const * string
OIIO_HOSTDEVICE constexpr TypeDesc(BASETYPE btype=UNKNOWN, AGGREGATE agg=SCALAR, VECSEMANTICS semantics=NOSEMANTICS, int arraylen=0) noexcept
OIIO_HOSTDEVICE constexpr TypeDesc scalartype() const
Vector: a spatial direction.
GLboolean GLboolean GLboolean GLboolean a
static const constexpr TypeDesc value()
9 values representing a 3x3 matrix.
static const TypeDesc TypePoint
const char * c_str() const
OIIO_UTIL_API std::string tostring(TypeDesc type, const void *data, const char *float_fmt, const char *string_fmt="%s", const char aggregate_delim[2]="()", const char *aggregate_sep=",", const char array_delim[2]="{}", const char *array_sep=",")
int arraylen
Array length, 0 = not array, -1 = unsized.
String-related utilities, all in namespace Strutil.
A VEC2 representing a rational number val[0] / val[1]
#define FMT_END_NAMESPACE
OIIO_HOSTDEVICE friend constexpr bool equivalent(const TypeDesc &a, const TypeDesc &b) noexcept
MX_GENSHADER_API const TypeDesc * MATRIX33
OIIO_HOSTDEVICE OIIO_CONSTEXPR14 size_t numelements() const noexcept
std::ostream & operator<<(std::ostream &ostr, const DataType &a)
static const TypeDesc TypeHalf
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
static const TypeDesc TypeKeyCode
OIIO_HOSTDEVICE constexpr bool is_vec2(BASETYPE b=FLOAT) const noexcept
Is this a 2-vector aggregate (of the given type, float by default)?
OIIO_HOSTDEVICE OIIO_CONSTEXPR14 size_t basevalues() const noexcept
16 values representing a 4x4 matrix.
OIIO_HOSTDEVICE void unarray(void) noexcept
static const TypeDesc TypeNormal
IMATH_NAMESPACE::V2f float
static const TypeDesc TypeMatrix44
OIIO_HOSTDEVICE constexpr bool is_sized_array() const noexcept
Does this TypeDesc describe an array, whose length is specified?
signed 32-bit int values (C/C++ int).
static const TypeDesc TypeFloat
2 values representing a 2D vector.
3 values representing a 3D vector.
OIIO_HOSTDEVICE constexpr bool is_vec3(BASETYPE b=FLOAT) const noexcept
Is this a 3-vector aggregate (of the given type, float by default)?
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
OIIO_HOSTDEVICE constexpr bool is_unsized_array() const noexcept
OIIO_HOSTDEVICE size_t size() const noexcept
GLboolean GLboolean GLboolean b
OIIO_UTIL_API bool convert_type(TypeDesc srctype, const void *src, TypeDesc dsttype, void *dst, int n=1)
4 values representing a 4D vector.
static const TypeDesc TypeVector
Normal: a surface normal.
#define SCALAR(T)
Simplify checking for scalar types.
static const TypeDesc TypeMatrix
static const TypeDesc TypeColor
static const TypeDesc TypeMatrix33
Point: a spatial location.
unsigned char basetype
C data type at the heart of our type.
OIIO_HOSTDEVICE constexpr TypeDesc(const TypeDesc &t) noexcept
Copy constructor.
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
FMT_INLINE auto format_to(OutputIt out, format_string< T...> fmt, T &&...args) -> OutputIt
static const constexpr TypeDesc value()
unsigned char vecsemantics
Hint: What does the aggregate represent?
OIIO_HOSTDEVICE constexpr TypeDesc(BASETYPE btype, AGGREGATE agg, int arraylen) noexcept
#define FMT_BEGIN_NAMESPACE
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
#define OIIO_NAMESPACE_END
OIIO_HOSTDEVICE constexpr TypeDesc(BASETYPE btype, int arraylen) noexcept
Construct an array of a non-aggregate BASETYPE.
OIIO_HOSTDEVICE OIIO_CONSTEXPR14 TypeDesc elementtype() const noexcept
static const constexpr TypeDesc value()
A VEC2[2] or VEC3[2] that represents a 2D or 3D bounds (min/max)
static const TypeDesc TypeInt
OIIO_HOSTDEVICE constexpr bool is_array() const noexcept
Does this TypeDesc describe an array?
OIIO_HOSTDEVICE size_t elementsize() const noexcept
static const constexpr TypeDesc value()
static const TypeDesc TypeRational
OIIO_HOSTDEVICE constexpr bool is_box2(BASETYPE b=FLOAT) const noexcept
Is this an array of aggregates that represents a 2D bounding box?
32-bit unsigned int values (C/C++ unsigned int).
static const constexpr TypeDesc value()
#define OIIO_NAMESPACE_BEGIN