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 <boost/type_traits/is_convertible.hpp> 47 #include <boost/type_traits/is_integral.hpp> 48 #include <boost/static_assert.hpp> 63 typedef unsigned char Byte;
115 template<
typename IntType_, Index Kind>
118 BOOST_STATIC_ASSERT(boost::is_integral<IntType_>::value);
124 operator IntType()
const {
return mIndex; }
146 static const bool IsVec =
false;
147 static const int Size = 1;
151 static const bool IsVec =
true;
152 static const int Size = 2;
156 static const bool IsVec =
true;
157 static const int Size = 3;
161 static const bool IsVec =
true;
162 static const int Size = 4;
179 template<
typename FromType,
typename ToType>
180 struct CanConvertType {
enum { value = boost::is_convertible<FromType, ToType>::value }; };
185 template<
typename T>
struct CanConvertType<T, math::Vec2<T> > {
enum { value =
true }; };
186 template<
typename T>
struct CanConvertType<T, math::Vec3<T> > {
enum { value =
true }; };
187 template<
typename T>
struct CanConvertType<T, math::Vec4<T> > {
enum { value =
true }; };
191 template<
typename T0,
typename T1>
193 template<
typename T0,
typename T1>
195 template<
typename T0,
typename T1>
197 template<>
struct CanConvertType<PointIndex32, PointDataIndex32> {
enum {value =
true}; };
198 template<>
struct CanConvertType<PointDataIndex32, PointIndex32> {
enum {value =
true}; };
280 template<>
inline const char* typeNameAsString<std::string>() {
return "string"; }
303 template<
typename AValueType,
typename BValueType = AValueType>
311 mAValPtr(NULL), mBValPtr(NULL), mResultValPtr(&mResultVal),
312 mAIsActive(false), mBIsActive(false), mResultIsActive(false)
316 CombineArgs(
const AValueType& a,
const BValueType& b, AValueType& result,
317 bool aOn =
false,
bool bOn =
false):
318 mAValPtr(&a), mBValPtr(&b), mResultValPtr(&result),
319 mAIsActive(aOn), mBIsActive(bOn)
320 { updateResultActive(); }
323 CombineArgs(
const AValueType& a,
const BValueType& b,
bool aOn =
false,
bool bOn =
false):
324 mAValPtr(&a), mBValPtr(&b), mResultValPtr(&mResultVal),
325 mAIsActive(aOn), mBIsActive(bOn)
326 { updateResultActive(); }
329 const AValueType&
a()
const {
return *mAValPtr; }
331 const BValueType&
b()
const {
return *mBValPtr; }
333 const AValueType& result()
const {
return *mResultValPtr; }
335 AValueType&
result() {
return *mResultValPtr; }
379 template<
typename ValueType,
typename CombineOp>
431 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710)) 432 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710)) 433 #define OPENVDB_START_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711)) 434 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711)) 435 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712)) 436 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712)) 440 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710)) 441 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710)) 442 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711)) 443 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711)) 444 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712)) 445 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712)) 448 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) \ 449 __pragma(warning(disable:1710)); CODE; __pragma(warning(default:1710)) 450 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) \ 451 __pragma(warning(disable:1711)); CODE; __pragma(warning(default:1711)) 452 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) \ 453 __pragma(warning(disable:1712)); CODE; __pragma(warning(default:1712)) 455 #else // GCC does not support these compiler warnings 457 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE 458 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE 459 #define OPENVDB_START_THREADSAFE_STATIC_WRITE 460 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE 461 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS 462 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS 464 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE 465 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE 466 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE 467 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE 468 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS 469 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS 471 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) CODE 472 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) CODE 473 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) CODE 475 #endif // defined(__ICC) 477 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED AValueType & result()
Get the output value.
Definition: Types.h:335
3x3 matrix class.
Definition: Mat3.h:54
Index32 Index
Definition: Types.h:58
const char * typeNameAsString< Mat4d >()
Definition: Types.h:282
const BValueType & b() const
Get the B input value.
Definition: Types.h:331
math::Vec4< float > Vec4f
Definition: Types.h:91
PointIndex< Index64, 0 > PointIndex64
Definition: Types.h:136
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:344
unsigned char Byte
Definition: Types.h:63
PointIndex(IntType i=IntType(0))
Definition: Types.h:122
const char * typeNameAsString< Vec3i >()
Definition: Types.h:277
T ElementType
Definition: Types.h:148
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: Types.h:128
Vec4< double > Vec4d
Definition: Vec4.h:576
const char * typeNameAsString< Vec2i >()
Definition: Types.h:274
bool resultIsActive() const
Definition: Types.h:353
math::Vec3< Real > Vec3R
Definition: Types.h:76
const char * typeNameAsString< uint32_t >()
Definition: Types.h:272
math::Vec3< float > Vec3f
Definition: Types.h:78
MergePolicy
Definition: Types.h:257
math::Vec2< half > Vec2H
Definition: Types.h:70
Vec4< int32_t > Vec4i
Definition: Vec4.h:573
const char * typeNameAsString< float >()
Definition: Types.h:269
uint32_t Index32
Definition: Types.h:56
math::Vec2< float > Vec2f
Definition: Types.h:69
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:47
math::Vec2< Real > Vec2R
Definition: Types.h:67
Vec2< int32_t > Vec2i
Definition: Vec2.h:532
math::Vec4< half > Vec4H
Definition: Types.h:92
math::Mat4< Real > Mat4R
Definition: Types.h:101
CombineArgs()
Definition: Types.h:310
bool bIsActive() const
Definition: Types.h:351
Vec3< int32_t > Vec3i
Definition: Vec3.h:640
const char * typeNameAsString< PointDataIndex32 >()
Definition: Types.h:285
AValueType AValueT
Definition: Types.h:307
AValueType * mResultValPtr
Definition: Types.h:370
T ElementType
Definition: Types.h:158
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: Types.h:116
T ElementType
Definition: Types.h:163
int64_t Int64
Definition: Types.h:61
const AValueType & a() const
Get the A input value.
Definition: Types.h:329
GridClass
Definition: Types.h:204
math::Mat4< double > Mat4d
Definition: Types.h:102
void operator()(CombineArgs< ValueType > &args)
Definition: Types.h:384
math::BBox< Vec3d > BBoxd
Definition: Types.h:86
const char * typeNameAsString< PointIndex32 >()
Definition: Types.h:283
#define OPENVDB_VERSION_NAME
Definition: version.h:43
math::Vec2< Index32 > Vec2I
Definition: Types.h:68
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:346
math::Quat< Real > QuatR
Definition: Types.h:106
const char * typeNameAsString< Vec3d >()
Definition: Types.h:279
const char * typeNameAsString< int32_t >()
Definition: Types.h:271
math::Mat4< float > Mat4s
Definition: Types.h:103
T ElementType
Definition: Types.h:153
const char * typeNameAsString< PointIndex64 >()
Definition: Types.h:284
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:342
VecType
Definition: Types.h:234
const BValueType * mBValPtr
Definition: Types.h:368
SwappedCombineOp(CombineOp &_op)
Definition: Types.h:382
Vec4< float > Vec4s
Definition: Vec4.h:575
Definition: Exceptions.h:39
const AValueType * mAValPtr
Definition: Types.h:367
const char * typeNameAsString< Vec2d >()
Definition: Types.h:276
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: Types.h:339
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: Types.h:360
const char * typeNameAsString< Mat4s >()
Definition: Types.h:281
Vec3< double > Vec3d
Definition: Vec3.h:643
bool mResultIsActive
Definition: Types.h:372
Int32 Int
Definition: Types.h:62
const AValueType & result() const
Get the output value.
Definition: Types.h:334
BValueType BValueT
Definition: Types.h:308
bool mBIsActive
Definition: Types.h:371
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:358
const char * typeNameAsString< bool >()
Definition: Types.h:268
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:316
double Real
Definition: Types.h:64
math::Vec3< half > Vec3H
Definition: Types.h:79
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:304
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: Types.h:356
int32_t Int32
Definition: Types.h:60
uint64_t Index64
Definition: Types.h:57
const char * typeNameAsString< Vec2s >()
Definition: Types.h:275
math::Vec3< Index32 > Vec3I
Definition: Types.h:77
CopyPolicy
Definition: Types.h:411
int16_t Int16
Definition: Types.h:59
void updateResultActive()
Definition: Types.h:365
math::Vec4< Index32 > Vec4I
Definition: Types.h:90
const char * typeNameAsString< PointDataIndex64 >()
Definition: Types.h:286
const char * typeNameAsString< int64_t >()
Definition: Types.h:273
const char * typeNameAsString()
Definition: Types.h:267
bool aIsActive() const
Definition: Types.h:349
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: Types.h:180
Vec2< float > Vec2s
Definition: Vec2.h:534
PointIndex< Index64, 1 > PointDataIndex64
Definition: Types.h:139
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
AValueType mResultVal
Definition: Types.h:369
const char * typeNameAsString< Vec3f >()
Definition: Types.h:278
const char * typeNameAsString< double >()
Definition: Types.h:270
Vec3< float > Vec3s
Definition: Vec3.h:642
PointIndex< Index32, 0 > PointIndex32
Definition: Types.h:135
math::Vec4< Real > Vec4R
Definition: Types.h:89
IntType_ IntType
Definition: Types.h:120
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:212
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:252
Vec2< double > Vec2d
Definition: Vec2.h:535
CombineOp & op
Definition: 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: Types.h:323
math::Mat3< Real > Mat3R
Definition: Types.h:98
PointIndex< Index32, 1 > PointDataIndex32
Definition: Types.h:138