17 # pragma warning(disable : 4127)
33 #define OIIO_TYPEDESC_VECTOR2 1
133 int arraylen=0) noexcept
134 : basetype(static_cast<
unsigned char>(btype)),
135 aggregate(static_cast<
unsigned char>(agg)),
136 vecsemantics(static_cast<
unsigned char>(semantics)), reserved(0),
147 :
TypeDesc(btype, agg, NOSEMANTICS, arraylen) {}
166 : basetype(
t.basetype), aggregate(
t.aggregate),
167 vecsemantics(
t.vecsemantics), reserved(0), arraylen(
t.arraylen)
173 const char *c_str()
const;
176 o << t.
c_str();
return o;
183 "of array with unspecified length (%d)", arraylen);
184 return (arraylen >= 1 ? arraylen : 1);
191 return numelements() * aggregate;
208 "of array with unspecified length (%d)", arraylen);
209 size_t a = (size_t) (arraylen > 0 ? arraylen : 1);
210 if (
sizeof(
size_t) >
sizeof(
int)) {
212 return a * elementsize();
215 unsigned long long s = (
unsigned long long) a * elementsize();
217 return s < toobig ? (size_t)s : toobig;
237 size_t basesize ()
const noexcept;
241 bool is_floating_point ()
const noexcept;
247 constexpr
bool is_unknown ()
const noexcept {
return (basetype == UNKNOWN); }
250 constexpr
operator bool ()
const noexcept {
return (basetype != UNKNOWN); }
261 return basetype ==
t.basetype && aggregate ==
t.aggregate &&
262 vecsemantics ==
t.vecsemantics && arraylen ==
t.arraylen;
290 return a.basetype ==
b.basetype &&
a.aggregate ==
b.aggregate &&
291 (
a.arraylen ==
b.arraylen || (
a.is_unsized_array() &&
b.is_sized_array())
292 || (
a.is_sized_array() &&
b.is_unsized_array()));
296 return this->basetype ==
b.basetype && this->aggregate ==
b.aggregate &&
297 (this->arraylen ==
b.arraylen || (this->is_unsized_array() &&
b.is_sized_array())
298 || (this->is_sized_array() &&
b.is_unsized_array()));
303 return this->aggregate == VEC2 && this->basetype ==
b && !is_array();
308 return this->aggregate == VEC3 && this->basetype ==
b && !is_array();
313 return this->aggregate == VEC4 && this->basetype ==
b && !is_array();
318 void unarray (
void) noexcept { arraylen = 0; }
366 static constexpr
TypeDesc TypeMatrix = TypeMatrix44;
370 static constexpr
TypeDesc TypeVector4 = TypeFloat4;
392 const char *float_fmt,
393 const char *string_fmt =
"%s",
394 const char aggregate_delim[2] =
"()",
395 const char *aggregate_sep =
",",
396 const char array_delim[2] =
"{}",
397 const char *array_sep =
",");
435 #ifdef INCLUDED_IMATHVEC_H
441 #ifdef INCLUDED_IMATHCOLOR_H
444 #ifdef INCLUDED_IMATHMATRIX_H
565 auto it = ctx.begin(),
end = ctx.end();
566 if (it !=
end && (*it ==
's')) ++it;
568 if (it !=
end && *it !=
'}')
574 template <
typename FormatContext>
575 auto format(
const OIIO::TypeDesc&
t, FormatContext& ctx) -> decltype(ctx.out()){
16-bit IEEE floating point values (OpenEXR half).
static const TypeDesc TypeFloat
GLboolean GLboolean GLboolean b
A VEC2 representing a rational number val[0] / val[1]
static const TypeDesc TypeColor
32-bit IEEE floating point values, (C/C++ float).
3 values representing a 3D vector.
constexpr bool equivalent(const TypeDesc &b) const noexcept
Member version of equivalent.
size_t elementsize() const noexcept
static const TypeDesc TypeVector
static const TypeDesc TypeMatrix
Vector: a spatial direction.
4 values representing a 4D vector.
constexpr bool is_vec3(BASETYPE b=FLOAT) const noexcept
Is this a 3-vector aggregate (of the given type, float by default)?
auto format_to(OutputIt out, const S &format_str, Args &&...args) -> typename std::enable_if< enable, OutputIt >::type
constexpr bool is_unsized_array() const noexcept
static const constexpr TypeDesc value()
static const TypeDesc TypeHalf
64-bit IEEE floating point values, (C/C++ double).
static const TypeDesc TypePoint
static const TypeDesc TypeRational
constexpr bool is_vec2(BASETYPE b=FLOAT) const noexcept
Is this a 2-vector aggregate (of the given type, float by default)?
unsigned char basetype
C data type at the heart of our type.
OIIO_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=",")
std::integral_constant< bool, std::numeric_limits< T >::is_signed||std::is_same< T, int128_t >::value > is_signed
String-related utilities, all in namespace Strutil.
unsigned char reserved
Reserved for future expansion.
constexpr bool is_sized_array() const noexcept
Does this TypeDesc describe an array, whose length is specified?
#define FMT_END_NAMESPACE
9 values representing a 3x3 matrix.
std::ostream & operator<<(std::ostream &ostr, const DataType &a)
16 values representing a 4x4 matrix.
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
constexpr TypeDesc(BASETYPE btype=UNKNOWN, AGGREGATE agg=SCALAR, VECSEMANTICS semantics=NOSEMANTICS, int arraylen=0) noexcept
2 values representing a 2D vector.
Point: a spatial location.
typedef INT(WINAPI *PFNWGLGETGPUINFOAMDPROC)(UINT id
static const TypeDesc TypeKeyCode
GLint GLint GLsizei GLint GLenum GLenum type
static const TypeDesc TypeNormal
size_t size() const noexcept
static const TypeDesc TypeMatrix44
MX_GENSHADER_API const TypeDesc * MATRIX44
unsigned char aggregate
What kind of AGGREGATE is it?
static const TypeDesc TypeTimeCode
constexpr TypeDesc(const TypeDesc &t) noexcept
Copy constructor.
GLboolean GLboolean GLboolean GLboolean a
GLsizei const GLchar *const * string
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
friend constexpr bool equivalent(const TypeDesc &a, const TypeDesc &b) noexcept
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
static const TypeDesc TypeMatrix33
void unarray(void) noexcept
OIIO_CONSTEXPR14 size_t numelements() const noexcept
constexpr TypeDesc(BASETYPE btype, AGGREGATE agg, int arraylen) noexcept
static const TypeDesc TypeString
Normal: a surface normal.
signed 32-bit int values (C/C++ int).
constexpr TypeDesc scalartype() const
static const TypeDesc TypeInt
const char * c_str() const
#define SCALAR(T)
Simplify checking for scalar types.
static const TypeDesc TypeFloat4
constexpr bool is_vec4(BASETYPE b=FLOAT) const noexcept
Is this a 4-vector aggregate (of the given type, float by default)?
OIIO_CONSTEXPR14 TypeDesc elementtype() const noexcept
constexpr bool is_array() const noexcept
Does this TypeDesc describe an array?
OIIO_API bool convert_type(TypeDesc srctype, const void *src, TypeDesc dsttype, void *dst, int n=1)
int arraylen
Array length, 0 = not array, -1 = unsized.
GLsizei const GLfloat * value
static const constexpr TypeDesc value()
typedef INT64(WINAPI *PFNWGLSWAPBUFFERSMSCOMLPROC)(HDC hdc
#define FMT_BEGIN_NAMESPACE
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
32-bit unsigned int values (C/C++ unsigned int).
#define OIIO_NAMESPACE_END
OIIO_CONSTEXPR14 size_t basevalues() const noexcept
static const constexpr TypeDesc value()
static const constexpr TypeDesc value()
MX_GENSHADER_API const TypeDesc * MATRIX33
constexpr TypeDesc(BASETYPE btype, int arraylen) noexcept
Construct an array of a non-aggregate BASETYPE.
unsigned char vecsemantics
Hint: What does the aggregate represent?
static const constexpr TypeDesc value()
#define OIIO_NAMESPACE_BEGIN