Go to the documentation of this file.
4 #ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED
5 #define OPENVDB_TYPES_HAS_BEEN_INCLUDED
10 #include <OpenEXR/half.h>
22 #include <type_traits>
37 using Byte =
unsigned char;
92 template<
typename T>
using SharedPtr = std::shared_ptr<T>;
93 template<
typename T>
using WeakPtr = std::weak_ptr<T>;
133 template<
typename IntType_, Index Kind>
136 static_assert(std::is_integral<IntType_>::value,
"PointIndex requires an integer value type");
169 template <
typename T,
template <
typename...>
class Template>
172 template <
typename... Args,
template <
typename...>
class Template>
179 template<typename T, bool = IsSpecializationOf<T, math::Vec2>::value ||
184 static const bool IsVec =
true;
185 static const int Size = T::size;
192 static const bool IsVec =
false;
193 static const int Size = 1;
197 template<typename T, bool = IsSpecializationOf<T, math::Quat>::value>
200 static const bool IsQuat =
true;
201 static const int Size = T::size;
208 static const bool IsQuat =
false;
209 static const int Size = 1;
213 template<typename T, bool = IsSpecializationOf<T, math::Mat3>::value ||
217 static const bool IsMat =
true;
218 static const int Size = T::size;
225 static const bool IsMat =
false;
226 static const int Size = 1;
230 template<typename T, bool = VecTraits<T>::IsVec ||
238 static const bool IsScalar =
false;
239 static const int Size = T::size;
240 static const int Elements = IsMat ? Size*Size : Size;
247 static const bool IsVec =
false;
248 static const bool IsQuat =
false;
249 static const bool IsMat =
false;
250 static const bool IsScalar =
true;
251 static const int Size = 1;
252 static const int Elements = 1;
262 template<
typename FromType,
typename ToType>
263 struct CanConvertType {
enum { value = std::is_constructible<ToType, FromType>::value }; };
274 template<
typename T0,
typename T1>
276 template<
typename T0,
typename T1>
278 template<
typename T0,
typename T1>
299 using Type =
typename std::remove_const<ToType>::type;
303 template<
typename FromType,
typename ToType>
struct CopyConstness<const FromType, ToType> {
304 using Type =
const ToType;
400 template<>
inline const char* typeNameAsString<std::string>() {
return "string"; }
405 template<>
inline const char* typeNameAsString<math::Quats>() {
return "quats"; }
406 template<>
inline const char* typeNameAsString<math::Quatd>() {
return "quatd"; }
427 template<
typename AValueType,
typename BValueType = AValueType>
437 , mResultValPtr(&mResultVal)
440 , mResultIsActive(false)
445 CombineArgs(
const AValueType& a,
const BValueType& b, AValueType& result,
446 bool aOn =
false,
bool bOn =
false)
449 , mResultValPtr(&result)
453 this->updateResultActive();
457 CombineArgs(
const AValueType& a,
const BValueType& b,
bool aOn =
false,
bool bOn =
false)
460 , mResultValPtr(&mResultVal)
464 this->updateResultActive();
468 const AValueType&
a()
const {
return *mAValPtr; }
470 const BValueType&
b()
const {
return *mBValPtr; }
472 const AValueType& result()
const {
return *mResultValPtr; }
474 AValueType&
result() {
return *mResultValPtr; }
518 template<
typename ValueType,
typename CombineOp>
554 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
typename std::remove_const< ToType >::type Type
Definition: openvdb/Types.h:299
const BValueType * mBValPtr
Definition: openvdb/Types.h:507
Index32 Index
Definition: openvdb/Types.h:32
int64_t Int64
Definition: openvdb/Types.h:35
Vec3< int32_t > Vec3i
Definition: Vec3.h:665
const char * typeNameAsString< uint8_t >()
Definition: openvdb/Types.h:383
Definition: openvdb/Types.h:183
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition: openvdb/Types.h:170
const char * typeNameAsString< half >()
Definition: openvdb/Types.h:379
@ GRID_FOG_VOLUME
Definition: openvdb/Types.h:316
CombineOp & op
Definition: openvdb/Types.h:530
const char * typeNameAsString< int32_t >()
Definition: openvdb/Types.h:386
double Real
Definition: openvdb/Types.h:38
const char * typeNameAsString< Mat4d >()
Definition: openvdb/Types.h:404
const char * typeNameAsString< Vec2s >()
Definition: openvdb/Types.h:390
@ GRID_LEVEL_SET
Definition: openvdb/Types.h:315
typename T::ValueType ElementType
Definition: openvdb/Types.h:202
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: openvdb/Types.h:481
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: openvdb/Types.h:542
@ VEC_CONTRAVARIANT_ABSOLUTE
Definition: openvdb/Types.h:348
@ NUM_GRID_CLASSES
Definition: openvdb/Types.h:319
const char * typeNameAsString< PointIndex32 >()
Definition: openvdb/Types.h:407
BValueType BValueT
Definition: openvdb/Types.h:432
const AValueType & a() const
Get the A input value.
Definition: openvdb/Types.h:468
@ VEC_INVARIANT
Definition: openvdb/Types.h:344
Mat4< double > Mat4d
Definition: Mat4.h:1368
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:26
@ MERGE_ACTIVE_STATES
Definition: openvdb/Types.h:367
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: openvdb/Types.h:539
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: openvdb/Types.h:457
uint32_t Index32
Definition: openvdb/Types.h:30
3x3 matrix class.
Definition: Mat3.h:29
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: openvdb/Types.h:478
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: openvdb/Types.h:135
const char * typeNameAsString< Vec4d >()
Definition: openvdb/Types.h:399
Vec4< double > Vec4d
Definition: Vec4.h:566
Vec4< float > Vec4s
Definition: Vec4.h:565
uint64_t Index64
Definition: openvdb/Types.h:31
Definition: openvdb/Types.h:216
@ MERGE_NODES
Definition: openvdb/Types.h:368
const char * typeNameAsString< Vec3f >()
Definition: openvdb/Types.h:395
const char * typeNameAsString< Vec3d >()
Definition: openvdb/Types.h:396
Library and file format version numbers.
Mat3< double > Mat3d
Definition: Mat3.h:848
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: openvdb/Types.h:114
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: openvdb/Types.h:124
AValueType * mResultValPtr
Definition: openvdb/Types.h:509
bool bIsActive() const
Definition: openvdb/Types.h:490
typename T::ValueType ElementType
Definition: openvdb/Types.h:219
SwappedCombineOp(CombineOp &_op)
Definition: openvdb/Types.h:521
const char * typeNameAsString< int64_t >()
Definition: openvdb/Types.h:388
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: openvdb/Types.h:485
const char * typeNameAsString< int8_t >()
Definition: openvdb/Types.h:382
const char * typeNameAsString< double >()
Definition: openvdb/Types.h:381
const char * typeNameAsString< Vec3U8 >()
Definition: openvdb/Types.h:392
const char * typeNameAsString< Vec3i >()
Definition: openvdb/Types.h:394
Vec4< int32_t > Vec4i
Definition: Vec4.h:563
Definition: openvdb/Types.h:520
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: openvdb/Types.h:483
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
const AValueType * mAValPtr
Definition: openvdb/Types.h:506
const char * typeNameAsString< uint32_t >()
Definition: openvdb/Types.h:387
void operator()(CombineArgs< ValueType > &args)
Definition: openvdb/Types.h:523
AValueType AValueT
Definition: openvdb/Types.h:431
@ VEC_CONTRAVARIANT_RELATIVE
Definition: openvdb/Types.h:347
PointIndex(IntType i=IntType(0))
Definition: openvdb/Types.h:140
Vec3< double > Vec3d
Definition: Vec3.h:668
GridClass
Definition: openvdb/Types.h:313
const AValueType & result() const
Get the output value.
Definition: openvdb/Types.h:473
AValueType mResultVal
Definition: openvdb/Types.h:508
@ VEC_COVARIANT
Definition: openvdb/Types.h:345
const char * typeNameAsString< ValueMask >()
Definition: openvdb/Types.h:378
const char * typeNameAsString()
Definition: openvdb/Types.h:376
@ GRID_UNKNOWN
Definition: openvdb/Types.h:314
Quat< double > Quatd
Definition: Quat.h:626
const char * typeNameAsString< Vec4i >()
Definition: openvdb/Types.h:397
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: openvdb/Types.h:429
Vec2< double > Vec2d
Definition: Vec2.h:537
Definition: openvdb/Types.h:234
const char * typeNameAsString< bool >()
Definition: openvdb/Types.h:377
T ElementType
Definition: openvdb/Types.h:253
bool resultIsActive() const
Definition: openvdb/Types.h:492
@ VEC_COVARIANT_NORMALIZE
Definition: openvdb/Types.h:346
std::weak_ptr< T > WeakPtr
Definition: openvdb/Types.h:93
@ MERGE_ACTIVE_STATES_AND_NODES
Definition: openvdb/Types.h:369
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: openvdb/Types.h:149
Definition: openvdb/Types.h:199
A TypeList provides a compile time sequence of heterogeneous types which can be accessed,...
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition: openvdb/Types.h:298
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: openvdb/Types.h:104
unsigned char Byte
Definition: openvdb/Types.h:37
@ NUM_VEC_TYPES
Definition: openvdb/Types.h:350
int32_t Int32
Definition: openvdb/Types.h:34
MergePolicy
Definition: openvdb/Types.h:366
Vec2< int32_t > Vec2i
Definition: Vec2.h:534
PointIndex(T i)
Explicit type conversion constructor.
Definition: openvdb/Types.h:143
const char * typeNameAsString< Mat3s >()
Definition: openvdb/Types.h:401
typename T::ValueType ElementType
Definition: openvdb/Types.h:186
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:153
const char * typeNameAsString< int16_t >()
Definition: openvdb/Types.h:384
CombineArgs()
Definition: openvdb/Types.h:434
const char * typeNameAsString< Vec3U16 >()
Definition: openvdb/Types.h:393
const char * typeNameAsString< PointDataIndex64 >()
Definition: openvdb/Types.h:410
VecType
Definition: openvdb/Types.h:343
Tag dispatch class that distinguishes constructors that deep copy.
Definition: openvdb/Types.h:544
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: openvdb/Types.h:445
const char * typeNameAsString< Vec4f >()
Definition: openvdb/Types.h:398
const char * typeNameAsString< Vec2i >()
Definition: openvdb/Types.h:389
typename T::ValueType ElementType
Definition: openvdb/Types.h:241
static const Real LEVEL_SET_HALF_WIDTH
Definition: openvdb/Types.h:321
Definition: openvdb/Types.h:89
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: openvdb/Types.h:495
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: openvdb/Types.h:499
bool mResultIsActive
Definition: openvdb/Types.h:511
const char * typeNameAsString< float >()
Definition: openvdb/Types.h:380
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:101
Vec2< float > Vec2s
Definition: Vec2.h:536
Mat4< float > Mat4s
Definition: Mat4.h:1367
void updateResultActive()
Definition: openvdb/Types.h:504
int16_t Int16
Definition: openvdb/Types.h:33
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: openvdb/Types.h:497
IntType_ IntType
Definition: openvdb/Types.h:138
AValueType & result()
Definition: openvdb/Types.h:474
bool aIsActive() const
Definition: openvdb/Types.h:488
Tag dispatch class that distinguishes constructors during file input.
Definition: openvdb/Types.h:548
const char * typeNameAsString< PointDataIndex32 >()
Definition: openvdb/Types.h:409
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:249
Definition: openvdb/Exceptions.h:13
Mat3< float > Mat3s
Definition: Mat3.h:847
const char * typeNameAsString< Vec2d >()
Definition: openvdb/Types.h:391
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: openvdb/Types.h:263
const char * typeNameAsString< Mat4s >()
Definition: openvdb/Types.h:403
T ElementType
Definition: openvdb/Types.h:227
Tag dispatch class that distinguishes constructors that steal.
Definition: openvdb/Types.h:546
@ GRID_STAGGERED
Definition: openvdb/Types.h:317
const char * typeNameAsString< Mat3d >()
Definition: openvdb/Types.h:402
T ElementType
Definition: openvdb/Types.h:210
bool mBIsActive
Definition: openvdb/Types.h:510
Vec3< float > Vec3s
Definition: Vec3.h:667
const char * typeNameAsString< uint16_t >()
Definition: openvdb/Types.h:385
const char * typeNameAsString< PointIndex64 >()
Definition: openvdb/Types.h:408
std::shared_ptr< T > SharedPtr
Definition: openvdb/Types.h:92
const BValueType & b() const
Get the B input value.
Definition: openvdb/Types.h:470
Int32 Int
Definition: openvdb/Types.h:36
T ElementType
Definition: openvdb/Types.h:194
Quat< float > Quats
Definition: Quat.h:625