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>
44 #include <type_traits>
59 using Byte =
unsigned char;
114 template<
typename T>
using SharedPtr = std::shared_ptr<T>;
115 template<
typename T>
using WeakPtr = std::weak_ptr<T>;
155 template<
typename IntType_, Index Kind>
191 template <
typename T,
template <
typename...>
class Template>
194 template <
typename... Args,
template <
typename...>
class Template>
206 static const bool IsVec =
true;
207 static const int Size = T::size;
214 static const bool IsVec =
false;
215 static const int Size = 1;
222 static const bool IsQuat =
true;
223 static const int Size = T::size;
230 static const bool IsQuat =
false;
231 static const int Size = 1;
239 static const bool IsMat =
true;
240 static const int Size = T::size;
247 static const bool IsMat =
false;
248 static const int Size = 1;
252 template<typename T, bool = VecTraits<T>::IsVec ||
260 static const bool IsScalar =
false;
261 static const int Size = T::size;
262 static const int Elements = IsMat ? Size*Size : Size;
269 static const bool IsVec =
false;
270 static const bool IsQuat =
false;
271 static const bool IsMat =
false;
272 static const bool IsScalar =
true;
273 static const int Size = 1;
274 static const int Elements = 1;
284 template<
typename FromType,
typename ToType>
296 template<
typename T0,
typename T1>
298 template<
typename T0,
typename T1>
300 template<
typename T0,
typename T1>
321 using Type =
typename std::remove_const<ToType>::type;
325 template<
typename FromType,
typename ToType>
struct CopyConstness<const FromType, ToType> {
326 using Type =
const ToType;
401 template<>
inline const char* typeNameAsString<math::half>() {
return "half"; }
422 template<>
inline const char* typeNameAsString<std::string>() {
return "string"; }
427 template<>
inline const char* typeNameAsString<math::Quats>() {
return "quats"; }
428 template<>
inline const char* typeNameAsString<math::Quatd>() {
return "quatd"; }
449 template<
typename AValueType,
typename BValueType = AValueType>
459 , mResultValPtr(&mResultVal)
462 , mResultIsActive(false)
467 CombineArgs(
const AValueType& a,
const BValueType& b, AValueType& result,
468 bool aOn =
false,
bool bOn =
false)
471 , mResultValPtr(&result)
475 this->updateResultActive();
479 CombineArgs(
const AValueType& a,
const BValueType& b,
bool aOn =
false,
bool bOn =
false)
482 , mResultValPtr(&mResultVal)
486 this->updateResultActive();
490 const AValueType&
a()
const {
return *mAValPtr; }
492 const BValueType&
b()
const {
return *mBValPtr; }
495 const AValueType&
result()
const {
return *mResultValPtr; }
496 AValueType&
result() {
return *mResultValPtr; }
540 template<
typename ValueType,
typename CombineOp>
ValueT value
Definition: GridBuilder.h:1287
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:451
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: Types.h:500
bool bIsActive() const
Definition: Types.h:512
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:467
bool mAIsActive
Definition: Types.h:532
AValueType * mResultValPtr
Definition: Types.h:531
void updateResultActive()
Definition: Types.h:526
const AValueType * mAValPtr
Definition: Types.h:528
AValueType mResultVal
Definition: Types.h:530
bool aIsActive() const
Definition: Types.h:510
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:507
const AValueType & a() const
Get the A input value.
Definition: Types.h:490
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:519
const BValueType * mBValPtr
Definition: Types.h:529
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:479
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:503
const BValueType & b() const
Get the B input value.
Definition: Types.h:492
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: Types.h:517
const AValueType & result() const
Get the output value.
Definition: Types.h:495
AValueType AValueT
Definition: Types.h:453
AValueType & result()
Definition: Types.h:496
bool resultIsActive() const
Definition: Types.h:514
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:505
bool mResultIsActive
Definition: Types.h:533
BValueType BValueT
Definition: Types.h:454
CombineArgs()
Definition: Types.h:456
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: Types.h:521
Tag dispatch class that distinguishes constructors that deep copy.
Definition: Types.h:566
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:570
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: Types.h:561
Tag dispatch class that distinguishes constructors that steal.
Definition: Types.h:568
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:564
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:25
3x3 matrix class.
Definition: Mat3.h:29
BBox< Coord > CoordBBox
Definition: NanoVDB.h:1658
Vec2< int32_t > Vec2i
Definition: Vec2.h:534
Mat4< float > Mat4s
Definition: Mat4.h:1367
Vec2< double > Vec2d
Definition: Vec2.h:537
Mat3< double > Mat3d
Definition: Mat3.h:848
Vec2< float > Vec2s
Definition: Vec2.h:536
Vec4< float > Vec4s
Definition: Vec4.h:565
Mat3< float > Mat3s
Definition: Mat3.h:847
Vec3< double > Vec3d
Definition: Vec3.h:668
Mat4< double > Mat4d
Definition: Mat4.h:1368
Vec4< int32_t > Vec4i
Definition: Vec4.h:563
Quat< double > Quatd
Definition: Quat.h:626
internal::half half
Definition: Types.h:29
Vec3< int32_t > Vec3i
Definition: Vec3.h:665
Vec4< double > Vec4d
Definition: Vec4.h:566
Quat< float > Quats
Definition: Quat.h:625
Vec3< float > Vec3s
Definition: Vec3.h:667
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:343
const char * typeNameAsString< uint8_t >()
Definition: Types.h:405
@ NUM_GRID_CLASSES
Definition: Types.h:341
const char * typeNameAsString< int32_t >()
Definition: Types.h:408
const char * typeNameAsString< PointIndex32 >()
Definition: Types.h:429
Index32 Index
Definition: Types.h:54
const char * typeNameAsString< float >()
Definition: Types.h:402
const char * typeNameAsString< ValueMask >()
Definition: Types.h:400
const char * typeNameAsString< Vec3d >()
Definition: Types.h:418
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
int16_t Int16
Definition: Types.h:55
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
unsigned char Byte
Definition: Types.h:59
double Real
Definition: Types.h:60
const char * typeNameAsString< Vec4i >()
Definition: Types.h:419
GridClass
Definition: Types.h:335
@ GRID_FOG_VOLUME
Definition: Types.h:338
@ GRID_STAGGERED
Definition: Types.h:339
@ GRID_LEVEL_SET
Definition: Types.h:337
@ GRID_UNKNOWN
Definition: Types.h:336
int64_t Int64
Definition: Types.h:57
const char * typeNameAsString< PointDataIndex64 >()
Definition: Types.h:432
const char * typeNameAsString< Mat4s >()
Definition: Types.h:425
const char * typeNameAsString< Vec3U8 >()
Definition: Types.h:414
const char * typeNameAsString< int16_t >()
Definition: Types.h:406
const char * typeNameAsString< Vec3i >()
Definition: Types.h:416
Int32 Int
Definition: Types.h:58
const char * typeNameAsString< PointIndex64 >()
Definition: Types.h:430
std::weak_ptr< T > WeakPtr
Definition: Types.h:115
const char * typeNameAsString< uint16_t >()
Definition: Types.h:407
const char * typeNameAsString< Mat3d >()
Definition: Types.h:424
const char * typeNameAsString< Vec3U16 >()
Definition: Types.h:415
const char * typeNameAsString< Vec2s >()
Definition: Types.h:412
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
const char * typeNameAsString< PointDataIndex32 >()
Definition: Types.h:431
const char * typeNameAsString< Vec4f >()
Definition: Types.h:420
const char * typeNameAsString()
Definition: Types.h:398
uint32_t Index32
Definition: Types.h:52
const char * typeNameAsString< Vec3f >()
Definition: Types.h:417
const char * typeNameAsString< bool >()
Definition: Types.h:399
const char * typeNameAsString< int64_t >()
Definition: Types.h:410
const char * typeNameAsString< double >()
Definition: Types.h:403
int32_t Int32
Definition: Types.h:56
uint64_t Index64
Definition: Types.h:53
const char * typeNameAsString< Vec4d >()
Definition: Types.h:421
const char * typeNameAsString< int8_t >()
Definition: Types.h:404
const char * typeNameAsString< Vec2d >()
Definition: Types.h:413
const char * typeNameAsString< Vec2i >()
Definition: Types.h:411
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
MergePolicy
Definition: Types.h:388
@ MERGE_ACTIVE_STATES
Definition: Types.h:389
@ MERGE_NODES
Definition: Types.h:390
@ MERGE_ACTIVE_STATES_AND_NODES
Definition: Types.h:391
@ NUM_VEC_TYPES
Definition: Types.h:372
VecType
Definition: Types.h:365
@ VEC_CONTRAVARIANT_ABSOLUTE
Definition: Types.h:370
@ VEC_CONTRAVARIANT_RELATIVE
Definition: Types.h:369
@ VEC_COVARIANT
Definition: Types.h:367
@ VEC_COVARIANT_NORMALIZE
Definition: Types.h:368
@ VEC_INVARIANT
Definition: Types.h:366
const char * typeNameAsString< uint32_t >()
Definition: Types.h:409
const char * typeNameAsString< Mat3s >()
Definition: Types.h:423
const char * typeNameAsString< Mat4d >()
Definition: Types.h:426
Definition: Exceptions.h:13
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: Types.h:285
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition: Types.h:320
typename std::remove_const< ToType >::type Type
Definition: Types.h:321
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
typename T::ValueType ElementType
Definition: Types.h:241
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
typename T::ValueType ElementType
Definition: Types.h:224
SwappedCombineOp(CombineOp &_op)
Definition: Types.h:543
void operator()(CombineArgs< ValueType > &args)
Definition: Types.h:545
CombineOp & op
Definition: Types.h:552
T ElementType
Definition: Types.h:275
typename T::ValueType ElementType
Definition: Types.h:263
T ElementType
Definition: Types.h:216
typename T::ValueType ElementType
Definition: Types.h:208
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:202