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 }; };
268 template<
typename T>
struct CanConvertType<T, math::Vec2<T> > {
enum { value =
true }; };
269 template<
typename T>
struct CanConvertType<T, math::Vec3<T> > {
enum { value =
true }; };
270 template<
typename T>
struct CanConvertType<T, math::Vec4<T> > {
enum { value =
true }; };
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 Definition: openvdb/Types.h:367
const BValueType * mBValPtr
Definition: openvdb/Types.h:507
typename T::ValueType ElementType
Definition: openvdb/Types.h:202
AValueType & result()
Get the output value.
Definition: openvdb/Types.h:474
int32_t Int32
Definition: openvdb/Types.h:34
GridClass
Definition: openvdb/Types.h:313
Vec4< int32_t > Vec4i
Definition: Vec4.h:557
Definition: openvdb/Types.h:317
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: openvdb/Types.h:134
Definition: openvdb/Types.h:344
const char * typeNameAsString< Vec3d >()
Definition: openvdb/Types.h:396
Definition: openvdb/Types.h:215
Mat3< float > Mat3s
Definition: Mat3.h:840
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: openvdb/Types.h:497
const char * typeNameAsString< PointIndex32 >()
Definition: openvdb/Types.h:407
VecType
Definition: openvdb/Types.h:343
bool aIsActive() const
Definition: openvdb/Types.h:488
Quat< double > Quatd
Definition: Quat.h:620
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
const char * typeNameAsString< Vec4f >()
Definition: openvdb/Types.h:398
Vec2< double > Vec2d
Definition: Vec2.h:532
const char * typeNameAsString< half >()
Definition: openvdb/Types.h:379
const char * typeNameAsString< ValueMask >()
Definition: openvdb/Types.h:378
const AValueType * mAValPtr
Definition: openvdb/Types.h:506
CombineArgs()
Definition: openvdb/Types.h:434
MergePolicy
Definition: openvdb/Types.h:366
const char * typeNameAsString< int8_t >()
Definition: openvdb/Types.h:382
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: openvdb/Types.h:481
Definition: openvdb/Types.h:316
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
bool mBIsActive
Definition: openvdb/Types.h:510
const char * typeNameAsString< Vec3f >()
Definition: openvdb/Types.h:395
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:25
const char * typeNameAsString< int16_t >()
Definition: openvdb/Types.h:384
Definition: openvdb/Types.h:315
int16_t Int16
Definition: openvdb/Types.h:33
bool resultIsActive() const
Definition: openvdb/Types.h:492
const char * typeNameAsString< Vec3U8 >()
Definition: openvdb/Types.h:392
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: openvdb/Types.h:483
SwappedCombineOp(CombineOp &_op)
Definition: openvdb/Types.h:521
Mat4< double > Mat4d
Definition: Mat4.h:1362
const char * typeNameAsString< Vec4d >()
Definition: openvdb/Types.h:399
Vec4< float > Vec4s
Definition: Vec4.h:559
const char * typeNameAsString()
Definition: openvdb/Types.h:376
Vec3< double > Vec3d
Definition: Vec3.h:662
IntType_ IntType
Definition: openvdb/Types.h:138
T ElementType
Definition: openvdb/Types.h:210
typename T::ValueType ElementType
Definition: openvdb/Types.h:186
const char * typeNameAsString< double >()
Definition: openvdb/Types.h:381
Definition: openvdb/Types.h:319
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: openvdb/Types.h:495
Definition: openvdb/Types.h:350
const AValueType & a() const
Get the A input value.
Definition: openvdb/Types.h:468
const char * typeNameAsString< uint8_t >()
Definition: openvdb/Types.h:383
const char * typeNameAsString< Mat3s >()
Definition: openvdb/Types.h:401
Vec3< int32_t > Vec3i
Definition: Vec3.h:659
void updateResultActive()
Definition: openvdb/Types.h:504
const char * typeNameAsString< Vec3i >()
Definition: openvdb/Types.h:394
uint64_t Index64
Definition: openvdb/Types.h:31
typename std::remove_const< ToType >::type Type
Definition: openvdb/Types.h:299
Definition: openvdb/Types.h:368
const char * typeNameAsString< Vec3U16 >()
Definition: openvdb/Types.h:393
const char * typeNameAsString< bool >()
Definition: openvdb/Types.h:377
const char * typeNameAsString< Vec2d >()
Definition: openvdb/Types.h:391
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
Definition: openvdb/Types.h:89
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:94
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
const char * typeNameAsString< float >()
Definition: openvdb/Types.h:380
T ElementType
Definition: openvdb/Types.h:227
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition: openvdb/Types.h:298
T ElementType
Definition: openvdb/Types.h:253
bool bIsActive() const
Definition: openvdb/Types.h:490
Definition: openvdb/Types.h:347
typename T::ValueType ElementType
Definition: openvdb/Types.h:219
Vec3< float > Vec3s
Definition: Vec3.h:661
typename T::ValueType ElementType
Definition: openvdb/Types.h:241
Definition: openvdb/Types.h:345
3x3 matrix class.
Definition: Mat3.h:28
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: openvdb/Types.h:485
Definition: openvdb/Exceptions.h:13
Definition: openvdb/Types.h:369
CombineOp & op
Definition: openvdb/Types.h:530
AValueType * mResultValPtr
Definition: openvdb/Types.h:509
const char * typeNameAsString< int64_t >()
Definition: openvdb/Types.h:388
Vec4< double > Vec4d
Definition: Vec4.h:560
T ElementType
Definition: openvdb/Types.h:194
Tag dispatch class that distinguishes constructors that steal.
Definition: openvdb/Types.h:546
Mat4< float > Mat4s
Definition: Mat4.h:1361
bool mResultIsActive
Definition: openvdb/Types.h:511
Definition: openvdb/Types.h:182
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition: openvdb/Types.h:170
Vec2< int32_t > Vec2i
Definition: Vec2.h:529
Library and file format version numbers.
const char * typeNameAsString< PointDataIndex64 >()
Definition: openvdb/Types.h:410
void operator()(CombineArgs< ValueType > &args)
Definition: openvdb/Types.h:523
A TypeList provides a compile time sequence of heterogeneous types which can be accessed, transformed and executed over in various ways. It incorporates a subset of functionality similar to boost::mpl::vector however provides most of its content through using declarations rather than additional typed classes.
Definition: openvdb/Types.h:233
uint32_t Index32
Definition: openvdb/Types.h:30
PointIndex(IntType i=IntType(0))
Definition: openvdb/Types.h:140
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: openvdb/Types.h:149
std::weak_ptr< T > WeakPtr
Definition: openvdb/Types.h:93
const char * typeNameAsString< Mat3d >()
Definition: openvdb/Types.h:402
const char * typeNameAsString< Mat4s >()
Definition: openvdb/Types.h:403
const char * typeNameAsString< Vec2s >()
Definition: openvdb/Types.h:390
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:248
std::shared_ptr< T > SharedPtr
Definition: openvdb/Types.h:92
const char * typeNameAsString< int32_t >()
Definition: openvdb/Types.h:386
const AValueType & result() const
Get the output value.
Definition: openvdb/Types.h:473
const char * typeNameAsString< uint32_t >()
Definition: openvdb/Types.h:387
unsigned char Byte
Definition: openvdb/Types.h:37
const char * typeNameAsString< PointIndex64 >()
Definition: openvdb/Types.h:408
double Real
Definition: openvdb/Types.h:38
const char * typeNameAsString< Mat4d >()
Definition: openvdb/Types.h:404
Definition: openvdb/Types.h:346
const char * typeNameAsString< uint16_t >()
Definition: openvdb/Types.h:385
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: openvdb/Types.h:263
Definition: openvdb/Types.h:519
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: openvdb/Types.h:478
PointIndex(T i)
Explicit type conversion constructor.
Definition: openvdb/Types.h:143
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: openvdb/Types.h:542
Definition: openvdb/Types.h:198
const BValueType & b() const
Get the B input value.
Definition: openvdb/Types.h:470
const char * typeNameAsString< Vec4i >()
Definition: openvdb/Types.h:397
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:146
static const Real LEVEL_SET_HALF_WIDTH
Definition: openvdb/Types.h:321
AValueType mResultVal
Definition: openvdb/Types.h:508
const char * typeNameAsString< PointDataIndex32 >()
Definition: openvdb/Types.h:409
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
Int32 Int
Definition: openvdb/Types.h:36
int64_t Int64
Definition: openvdb/Types.h:35
Mat3< double > Mat3d
Definition: Mat3.h:841
Index32 Index
Definition: openvdb/Types.h:32
Tag dispatch class that distinguishes constructors during file input.
Definition: openvdb/Types.h:548
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: openvdb/Types.h:428
BValueType BValueT
Definition: openvdb/Types.h:432
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: openvdb/Types.h:539
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
Definition: openvdb/Types.h:348
Definition: openvdb/Types.h:314
const char * typeNameAsString< Vec2i >()
Definition: openvdb/Types.h:389
Quat< float > Quats
Definition: Quat.h:619
AValueType AValueT
Definition: openvdb/Types.h:431
Vec2< float > Vec2s
Definition: Vec2.h:531
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: openvdb/Types.h:499