4#ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED
5#define OPENVDB_TYPES_HAS_BEEN_INCLUDED
11#ifdef OPENVDB_USE_IMATH_HALF
12#ifdef OPENVDB_IMATH_VERSION
13#include <Imath/half.h>
15#include <OpenEXR/half.h>
114template<
typename T>
using SharedPtr = std::shared_ptr<T>;
115template<
typename T>
using WeakPtr = std::weak_ptr<T>;
155template<
typename IntType_, Index Kind>
158 static_assert(std::is_integral<IntType_>::value,
"PointIndex requires an integer value type");
191template <
typename T,
template <
typename...>
class Template>
194template <
typename... Args,
template <
typename...>
class Template>
201template<typename T, bool = IsSpecializationOf<T, math::Vec2>::value ||
207 static const int Size = T::size;
219template<typename T, bool = IsSpecializationOf<T, math::Quat>::value>
223 static const int Size = T::size;
235template<typename T, bool = IsSpecializationOf<T, math::Mat3>::value ||
240 static const int Size = T::size;
252template<typename T, bool = VecTraits<T>::IsVec ||
261 static const int Size = T::size;
292template <
size_t Bits,
bool Signed>
struct int_t;
293template <>
struct int_t<8ul, true> {
using type = int8_t; };
294template <>
struct int_t<16ul, true> {
using type = int16_t; };
295template <>
struct int_t<32ul, true> {
using type = int32_t; };
296template <>
struct int_t<64ul, true> {
using type = int64_t; };
297template <>
struct int_t<8ul, false> {
using type = uint8_t; };
298template <>
struct int_t<16ul, false> {
using type = uint16_t; };
299template <>
struct int_t<32ul, false> {
using type = uint32_t; };
300template <>
struct int_t<64ul, false> {
using type = uint64_t; };
317 template <
size_t bits>
318 using TypeT =
typename std::conditional<std::is_integral<T>::value,
322 static_assert(
sizeof(T) <= 8ul,
"Unsupported source type for promotion");
324#define OPENVDB_TARGET_BITS(SHIFT, PROMOTE) \
325 std::max(size_t(8), \
326 std::min(size_t(64), (PROMOTE ? size_t(8)*(sizeof(T)<<SHIFT) : \
327 size_t(8)*(sizeof(T)>>SHIFT))))
330#undef OPENVDB_TARGET_BITS
333 using Lowest =
typename TypeT<8ul>::type;
338template <
typename T,
template <
typename>
class ContainerT>
342 template <
size_t Shift = ~0UL>
using Demote = ContainerT<typename PromoteType<T>::template
Demote<Shift>>;
343 using Highest = ContainerT<typename PromoteType<T>::Highest>;
344 using Lowest = ContainerT<typename PromoteType<T>::Lowest>;
345 using Next = ContainerT<typename PromoteType<T>::Next>;
346 using Previous = ContainerT<typename PromoteType<T>::Previous>;
363template<
typename FromType,
typename ToType>
375template<
typename T0,
typename T1>
377template<
typename T0,
typename T1>
379template<
typename T0,
typename T1>
400 using Type =
typename std::remove_const<ToType>::type;
404template<
typename FromType,
typename ToType>
struct CopyConstness<const FromType, ToType> {
405 using Type =
const ToType;
528template<
typename AValueType,
typename BValueType = AValueType>
547 bool aOn =
false,
bool bOn =
false)
558 CombineArgs(
const AValueType&
a,
const BValueType&
b,
bool aOn =
false,
bool bOn =
false)
619template<
typename ValueType,
typename CombineOp>
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
A TypeList provides a compile time sequence of heterogeneous types which can be accessed,...
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition Types.h:530
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition Types.h:582
bool bIsActive() const
Definition Types.h:591
const AValueType & result() const
Get the output value.
Definition Types.h:574
CombineArgs(const AValueType &a, const BValueType &b, AValueType &result, bool aOn=false, bool bOn=false)
Use this constructor when the result value is stored externally.
Definition Types.h:546
bool mAIsActive
Definition Types.h:611
AValueType * mResultValPtr
Definition Types.h:610
void updateResultActive()
Definition Types.h:605
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition Types.h:600
const AValueType * mAValPtr
Definition Types.h:607
AValueType mResultVal
Definition Types.h:609
bool aIsActive() const
Definition Types.h:589
bool mBIsActive
Definition Types.h:611
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition Types.h:598
const BValueType & b() const
Get the B input value.
Definition Types.h:571
const BValueType * mBValPtr
Definition Types.h:608
CombineArgs(const AValueType &a, const BValueType &b, bool aOn=false, bool bOn=false)
Use this constructor when the result value should be stored in this struct.
Definition Types.h:558
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition Types.h:586
AValueType & result()
Definition Types.h:575
AValueType AValueT
Definition Types.h:532
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition Types.h:584
const AValueType & a() const
Get the A input value.
Definition Types.h:569
bool resultIsActive() const
Definition Types.h:593
bool mResultIsActive
Definition Types.h:612
BValueType BValueT
Definition Types.h:533
CombineArgs()
Definition Types.h:535
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition Types.h:579
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition Types.h:596
Tag dispatch class that distinguishes constructors that deep copy.
Definition Types.h:646
Tag dispatch class that distinguishes constructors during file input.
Definition Types.h:650
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition Types.h:641
Tag dispatch class that distinguishes constructors that steal.
Definition Types.h:648
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition Types.h:644
Axis-aligned bounding box.
Definition BBox.h:24
Axis-aligned bounding box of signed integer coordinates.
Definition Coord.h:249
Signed (x, y, z) 32-bit integer coordinates.
Definition Coord.h:25
3x3 matrix class.
Definition Mat3.h:29
4x4 -matrix class.
Definition Mat4.h:31
Vec2< int32_t > Vec2i
Definition Vec2.h:530
Mat4< float > Mat4s
Definition Mat4.h:1353
Vec2< double > Vec2d
Definition Vec2.h:533
Mat3< double > Mat3d
Definition Mat3.h:834
Vec2< float > Vec2s
Definition Vec2.h:532
Vec4< float > Vec4s
Definition Vec4.h:561
Mat3< float > Mat3s
Definition Mat3.h:833
Vec3< double > Vec3d
Definition Vec3.h:664
Mat4< double > Mat4d
Definition Mat4.h:1354
Vec4< int32_t > Vec4i
Definition Vec4.h:559
Quat< double > Quatd
Definition Quat.h:601
internal::half half
Definition Types.h:29
Vec3< int32_t > Vec3i
Definition Vec3.h:661
Vec4< double > Vec4d
Definition Vec4.h:562
Quat< float > Quats
Definition Quat.h:600
Vec3< float > Vec3s
Definition Vec3.h:663
static const Real LEVEL_SET_HALF_WIDTH
Definition Types.h:422
math::Vec4< float > Vec4f
Definition Types.h:89
math::Vec2< math::half > Vec2H
Definition Types.h:66
Index32 Index
Definition Types.h:54
math::Vec4< Index32 > Vec4I
Definition Types.h:88
math::Vec3< uint16_t > Vec3U16
Definition Types.h:77
PointIndex< Index64, 1 > PointDataIndex64
Definition Types.h:182
math::Vec2< Real > Vec2R
Definition Types.h:63
int16_t Int16
Definition Types.h:55
math::Vec3< math::half > Vec3H
Definition Types.h:75
PointIndex< Index64, 0 > PointIndex64
Definition Types.h:179
unsigned char Byte
Definition Types.h:59
math::Vec3< float > Vec3f
Definition Types.h:74
double Real
Definition Types.h:60
GridClass
Definition Types.h:414
@ GRID_FOG_VOLUME
Definition Types.h:417
@ GRID_STAGGERED
Definition Types.h:418
@ GRID_LEVEL_SET
Definition Types.h:416
@ GRID_UNKNOWN
Definition Types.h:415
int64_t Int64
Definition Types.h:57
PointIndex< Index32, 0 > PointIndex32
Definition Types.h:178
Int32 Int
Definition Types.h:58
math::Vec2< Index32 > Vec2I
Definition Types.h:64
std::weak_ptr< T > WeakPtr
Definition Types.h:115
math::Mat4< Real > Mat4R
Definition Types.h:101
uint32_t Index32
Definition Types.h:52
SharedPtr< T > ConstPtrCast(const SharedPtr< U > &ptr)
Return a new shared pointer that points to the same object as the given pointer but with possibly dif...
Definition Types.h:126
math::BBox< Vec3d > BBoxd
Definition Types.h:84
math::Mat3< Real > Mat3R
Definition Types.h:96
math::Vec3< Index32 > Vec3I
Definition Types.h:73
math::Vec3< Real > Vec3R
Definition Types.h:72
SharedPtr< T > DynamicPtrCast(const SharedPtr< U > &ptr)
Return a new shared pointer that is either null or points to the same object as the given pointer aft...
Definition Types.h:136
math::Vec4< math::half > Vec4H
Definition Types.h:90
int32_t Int32
Definition Types.h:56
uint64_t Index64
Definition Types.h:53
@ NUM_GRID_CLASSES
Definition Types.h:420
math::Vec2< float > Vec2f
Definition Types.h:65
std::shared_ptr< T > SharedPtr
Definition Types.h:114
MergePolicy
Definition Types.h:467
@ MERGE_ACTIVE_STATES
Definition Types.h:468
@ MERGE_NODES
Definition Types.h:469
@ MERGE_ACTIVE_STATES_AND_NODES
Definition Types.h:470
math::Vec4< Real > Vec4R
Definition Types.h:87
math::Vec3< uint8_t > Vec3U8
Definition Types.h:76
VecType
Definition Types.h:444
@ VEC_CONTRAVARIANT_ABSOLUTE
Definition Types.h:449
@ VEC_CONTRAVARIANT_RELATIVE
Definition Types.h:448
@ VEC_COVARIANT
Definition Types.h:446
@ VEC_COVARIANT_NORMALIZE
Definition Types.h:447
@ VEC_INVARIANT
Definition Types.h:445
@ NUM_VEC_TYPES
Definition Types.h:451
SharedPtr< T > StaticPtrCast(const SharedPtr< U > &ptr)
Return a new shared pointer that points to the same object as the given pointer after a static_cast.
Definition Types.h:146
math::Quat< Real > QuatR
Definition Types.h:106
const char * typeNameAsString()
Definition Types.h:477
PointIndex< Index32, 1 > PointDataIndex32
Definition Types.h:181
Definition Exceptions.h:13
#define OPENVDB_TARGET_BITS(SHIFT, PROMOTE)
Definition Types.h:324
@ value
Definition Types.h:382
@ value
Definition Types.h:381
@ value
Definition Types.h:376
@ value
Definition Types.h:378
@ value
Definition Types.h:380
@ value
Definition Types.h:384
@ value
Definition Types.h:369
@ value
Definition Types.h:370
@ value
Definition Types.h:371
@ value
Definition Types.h:386
@ value
Definition Types.h:372
@ value
Definition Types.h:373
@ value
Definition Types.h:374
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition Types.h:364
@ value
Definition Types.h:364
math::Mat3< SubT > Type
Definition Types.h:286
math::Mat4< SubT > Type
Definition Types.h:287
math::Quat< SubT > Type
Definition Types.h:285
math::Vec2< SubT > Type
Definition Types.h:282
math::Vec3< SubT > Type
Definition Types.h:283
math::Vec4< SubT > Type
Definition Types.h:284
Conversion classes for changing the underlying type of VDB types.
Definition Types.h:281
SubT Type
Definition Types.h:281
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition Types.h:399
typename std::remove_const< ToType >::type Type
Definition Types.h:400
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition Types.h:192
T ElementType
Definition Types.h:249
static const int Size
Definition Types.h:248
static const bool IsMat
Definition Types.h:247
static const int Size
Definition Types.h:240
typename T::ValueType ElementType
Definition Types.h:241
static const bool IsMat
Definition Types.h:239
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition Types.h:157
PointIndex(T i)
Explicit type conversion constructor.
Definition Types.h:165
PointIndex(IntType i=IntType(0))
Definition Types.h:162
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition Types.h:171
IntType_ IntType
Definition Types.h:160
T ElementType
Definition Types.h:232
static const int Size
Definition Types.h:231
static const bool IsQuat
Definition Types.h:230
static const int Size
Definition Types.h:223
typename T::ValueType ElementType
Definition Types.h:224
static const bool IsQuat
Definition Types.h:222
SwappedCombineOp(CombineOp &_op)
Definition Types.h:622
void operator()(CombineArgs< ValueType > &args)
Definition Types.h:624
CombineOp & op
Definition Types.h:632
T ElementType
Definition Types.h:275
static const int Elements
Definition Types.h:274
static const bool IsVec
Definition Types.h:269
static const int Size
Definition Types.h:273
static const bool IsQuat
Definition Types.h:270
static const bool IsScalar
Definition Types.h:272
static const bool IsMat
Definition Types.h:271
static const int Elements
Definition Types.h:262
static const bool IsVec
Definition Types.h:257
static const int Size
Definition Types.h:261
typename T::ValueType ElementType
Definition Types.h:263
static const bool IsQuat
Definition Types.h:258
static const bool IsScalar
Definition Types.h:260
static const bool IsMat
Definition Types.h:259
T ElementType
Definition Types.h:216
static const bool IsVec
Definition Types.h:214
static const int Size
Definition Types.h:215
static const bool IsVec
Definition Types.h:206
static const int Size
Definition Types.h:207
typename T::ValueType ElementType
Definition Types.h:208
math::half type
Definition Types.h:303
float type
Definition Types.h:304
double type
Definition Types.h:305
uint16_t type
Definition Types.h:298
int16_t type
Definition Types.h:294
uint32_t type
Definition Types.h:299
int32_t type
Definition Types.h:295
uint64_t type
Definition Types.h:300
int64_t type
Definition Types.h:296
uint8_t type
Definition Types.h:297
int8_t type
Definition Types.h:293
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:212