31 #ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED
32 #define OPENVDB_TYPES_HAS_BEEN_INCLUDED
36 #include <OpenEXR/half.h>
37 #include <openvdb/math/Math.h>
38 #include <openvdb/math/BBox.h>
39 #include <openvdb/math/Quat.h>
40 #include <openvdb/math/Vec2.h>
41 #include <openvdb/math/Vec3.h>
42 #include <openvdb/math/Vec4.h>
43 #include <openvdb/math/Mat3.h>
44 #include <openvdb/math/Mat4.h>
45 #include <openvdb/math/Coord.h>
46 #include <openvdb/math/Hermite.h>
47 #include <boost/type_traits/is_convertible.hpp>
62 typedef unsigned char Byte;
115 static const bool IsVec =
false;
116 static const int Size = 1;
119 static const bool IsVec =
true;
120 static const int Size = 2;
123 static const bool IsVec =
true;
124 static const int Size = 3;
127 static const bool IsVec =
true;
128 static const int Size = 4;
144 template<
typename FromType,
typename ToType>
145 struct CanConvertType {
enum { value = boost::is_convertible<FromType, ToType>::value }; };
150 template<
typename T>
struct CanConvertType<T, math::Vec2<T> > {
enum { value =
true }; };
151 template<
typename T>
struct CanConvertType<T, math::Vec3<T> > {
enum { value =
true }; };
152 template<
typename T>
struct CanConvertType<T, math::Vec4<T> > {
enum { value =
true }; };
156 template<
typename T0,
typename T1>
158 template<
typename T0,
typename T1>
160 template<
typename T0,
typename T1>
245 template<>
inline const char* typeNameAsString<std::string>() {
return "string"; }
264 template<
typename AValueType,
typename BValueType = AValueType>
272 mAValPtr(NULL), mBValPtr(NULL), mResultValPtr(&mResultVal),
273 mAIsActive(false), mBIsActive(false), mResultIsActive(false)
277 CombineArgs(
const AValueType& a,
const BValueType& b, AValueType& result,
278 bool aOn =
false,
bool bOn =
false):
279 mAValPtr(&a), mBValPtr(&b), mResultValPtr(&result),
280 mAIsActive(aOn), mBIsActive(bOn)
281 { updateResultActive(); }
284 CombineArgs(
const AValueType& a,
const BValueType& b,
bool aOn =
false,
bool bOn =
false):
285 mAValPtr(&a), mBValPtr(&b), mResultValPtr(&mResultVal),
286 mAIsActive(aOn), mBIsActive(bOn)
287 { updateResultActive(); }
290 const AValueType&
a()
const {
return *mAValPtr; }
292 const BValueType&
b()
const {
return *mBValPtr; }
294 const AValueType& result()
const {
return *mResultValPtr; }
296 AValueType&
result() {
return *mResultValPtr; }
340 template<
typename ValueType,
typename CombineOp>
390 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710))
391 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710))
392 #define OPENVDB_START_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711))
393 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711))
394 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712))
395 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712))
399 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710))
400 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710))
401 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711))
402 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711))
403 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712))
404 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712))
407 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) \
408 __pragma(warning(disable:1710)); CODE; __pragma(warning(default:1710))
409 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) \
410 __pragma(warning(disable:1711)); CODE; __pragma(warning(default:1711))
411 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) \
412 __pragma(warning(disable:1712)); CODE; __pragma(warning(default:1712))
414 #else // GCC does not support these compiler warnings
416 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE
417 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE
418 #define OPENVDB_START_THREADSAFE_STATIC_WRITE
419 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE
420 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS
421 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS
423 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE
424 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE
425 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE
426 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE
427 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS
428 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS
430 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) CODE
431 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) CODE
432 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) CODE
434 #endif // defined(__ICC)
436 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
bool resultIsActive() const
Definition: Types.h:314
const char * typeNameAsString< Vec3d >()
Definition: Types.h:244
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: Types.h:317
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:229
int16_t Int16
Definition: Types.h:58
math::Vec3< Real > Vec3R
Definition: Types.h:75
Vec2< int32_t > Vec2i
Definition: Vec2.h:518
Vec2< double > Vec2d
Definition: Vec2.h:521
AValueType AValueT
Definition: Types.h:268
math::Vec3< float > Vec3f
Definition: Types.h:77
CanConvertType::value is true if a value of type ToType can be constructed from a v...
Definition: Types.h:145
math::BBox< Vec3d > BBoxd
Definition: Types.h:85
math::Vec3< Index32 > Vec3I
Definition: Types.h:76
VecType
Definition: Types.h:198
const char * typeNameAsString< Vec3i >()
Definition: Types.h:242
math::Vec2< Real > Vec2R
Definition: Types.h:66
math::Vec2< Index32 > Vec2I
Definition: Types.h:67
math::Vec4< half > Vec4H
Definition: Types.h:91
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:303
Index32 Index
Definition: Types.h:57
const char * typeNameAsString< Mat4d >()
Definition: Types.h:247
const char * typeNameAsString< Vec2i >()
Definition: Types.h:239
const char * typeNameAsString< int64_t >()
Definition: Types.h:237
const char * typeNameAsString()
Definition: Types.h:231
const AValueType * mAValPtr
Definition: Types.h:328
math::Vec4< float > Vec4f
Definition: Types.h:90
bool aIsActive() const
Definition: Types.h:310
MergePolicy
Definition: Types.h:221
math::Vec2< float > Vec2f
Definition: Types.h:68
Vec4< int32_t > Vec4i
Definition: Vec4.h:543
const char * typeNameAsString< float >()
Definition: Types.h:233
math::Vec2< half > Vec2H
Definition: Types.h:69
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: Types.h:300
3x3 matrix class.
Definition: Mat3.h:54
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:176
bool bIsActive() const
Definition: Types.h:312
const AValueType & result() const
Get the output value.
Definition: Types.h:295
math::Quat< Real > QuatR
Definition: Types.h:108
const char * typeNameAsString< int32_t >()
Definition: Types.h:235
GridClass
Definition: Types.h:168
const BValueType * mBValPtr
Definition: Types.h:329
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:307
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:265
math::Mat4< Real > Mat4R
Definition: Types.h:100
bool mBIsActive
Definition: Types.h:332
math::Mat4< double > Mat4d
Definition: Types.h:101
uint64_t Index64
Definition: Types.h:56
#define OPENVDB_VERSION_NAME
Definition: version.h:45
void operator()(CombineArgs< ValueType > &args)
Definition: Types.h:345
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:47
CopyPolicy
Definition: Types.h:372
math::Hermite Hermite
Definition: Types.h:105
const char * typeNameAsString< uint32_t >()
Definition: Types.h:236
CombineOp & op
Definition: Types.h:352
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:319
const AValueType & a() const
Get the A input value.
Definition: Types.h:290
bool mResultIsActive
Definition: Types.h:333
Vec3< int32_t > Vec3i
Definition: Vec3.h:622
unsigned char Byte
Definition: Types.h:62
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:305
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:284
uint32_t Index32
Definition: Types.h:55
const char * typeNameAsString< Mat4s >()
Definition: Types.h:246
const char * typeNameAsString< bool >()
Definition: Types.h:232
int32_t Int32
Definition: Types.h:59
math::Mat4< float > Mat4s
Definition: Types.h:102
math::Vec4< Index32 > Vec4I
Definition: Types.h:89
Vec2< float > Vec2s
Definition: Vec2.h:520
const BValueType & b() const
Get the B input value.
Definition: Types.h:292
Vec3< double > Vec3d
Definition: Vec3.h:625
math::Vec3< half > Vec3H
Definition: Types.h:78
AValueType mResultVal
Definition: Types.h:330
int64_t Int64
Definition: Types.h:60
Vec3< float > Vec3s
Definition: Vec3.h:624
math::Vec4< Real > Vec4R
Definition: Types.h:88
AValueType * mResultValPtr
Definition: Types.h:331
void updateResultActive()
Definition: Types.h:326
Vec4< float > Vec4s
Definition: Vec4.h:545
CombineArgs()
Definition: Types.h:271
math::Mat3< Real > Mat3R
Definition: Types.h:97
SwappedCombineOp(CombineOp &_op)
Definition: Types.h:343
double Real
Definition: Types.h:63
Int32 Int
Definition: Types.h:61
const char * typeNameAsString< double >()
Definition: Types.h:234
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:277
Vec4< double > Vec4d
Definition: Vec4.h:546
const char * typeNameAsString< Vec2d >()
Definition: Types.h:241
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:67
const char * typeNameAsString< Vec3f >()
Definition: Types.h:243
const char * typeNameAsString< Vec2s >()
Definition: Types.h:240
AValueType & result()
Get the output value.
Definition: Types.h:296
BValueType BValueT
Definition: Types.h:269
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: Types.h:321
Quantized Hermite data object that stores compressed intersection information (offsets and normlas) f...
Definition: Hermite.h:66
const char * typeNameAsString< Hermite >()
Definition: Types.h:238