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
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>;
135 template<
typename T,
typename U>
inline SharedPtr<T>
145 template<
typename T,
typename U>
inline SharedPtr<T>
155 template<
typename IntType_, Index Kind>
191 template <
typename T,
template <
typename...>
class Template>
194 template <
typename... Args,
template <
typename...>
class Template>
222 template <std::size_t... Ns>
225 template <std::size_t
N, std::size_t... Is>
232 template <std::
size_t N>
234 std::decay_t<decltype(make_index_sequence_impl<N>())>;
291 template<typename T, bool = VecTraits<T>::IsVec ||
329 namespace types_internal
331 template <
size_t Bits,
bool Signed>
struct int_t;
332 template <>
struct int_t<8ul, true> {
using type = int8_t; };
333 template <>
struct int_t<16ul, true> {
using type = int16_t; };
334 template <>
struct int_t<32ul, true> {
using type = int32_t; };
335 template <>
struct int_t<64ul, true> {
using type = int64_t; };
336 template <>
struct int_t<8ul, false> {
using type = uint8_t; };
337 template <>
struct int_t<16ul, false> {
using type = uint16_t; };
338 template <>
struct int_t<32ul, false> {
using type = uint32_t; };
339 template <>
struct int_t<64ul, false> {
using type = uint64_t; };
341 template <
size_t Bits>
struct flt_t;
344 template <>
struct flt_t<64ul> {
using type = double; };
356 template <
size_t bits>
361 static_assert(
sizeof(
T) <= 8ul,
"Unsupported source type for promotion");
363 #define OPENVDB_TARGET_BITS(SHIFT, PROMOTE) \
364 std::max(size_t(8), \
365 std::min(size_t(64), (PROMOTE ? size_t(8)*(sizeof(T)<<SHIFT) : \
366 size_t(8)*(sizeof(T)>>SHIFT))))
367 template <
size_t Shift = ~0UL>
using Promote =
typename TypeT<OPENVDB_TARGET_BITS(Shift, true)>::type;
368 template <
size_t Shift = ~0UL>
using Demote =
typename TypeT<OPENVDB_TARGET_BITS(Shift, false)>::type;
369 #undef OPENVDB_TARGET_BITS
372 using Lowest =
typename TypeT<8ul>::type;
377 template <
typename T,
template <
typename>
class ContainerT>
381 template <
size_t Shift = ~0UL>
using Demote = ContainerT<typename PromoteType<T>::template
Demote<Shift>>;
382 using Highest = ContainerT<typename PromoteType<T>::Highest>;
383 using Lowest = ContainerT<typename PromoteType<T>::Lowest>;
384 using Next = ContainerT<typename PromoteType<T>::Next>;
385 using Previous = ContainerT<typename PromoteType<T>::Previous>;
402 template<
typename FromType,
typename ToType>
414 template<
typename T0,
typename T1>
416 template<
typename T0,
typename T1>
418 template<
typename T0,
typename T1>
443 template<
typename FromType,
typename ToType>
struct CopyConstness<const FromType, ToType> {
444 using Type =
const ToType;
461 static const Real LEVEL_SET_HALF_WIDTH = 3;
519 template<>
inline const char* typeNameAsString<math::half>() {
return "half"; }
540 template<>
inline const char* typeNameAsString<std::string>() {
return "string"; }
545 template<>
inline const char* typeNameAsString<math::Quats>() {
return "quats"; }
546 template<>
inline const char* typeNameAsString<math::Quatd>() {
return "quatd"; }
567 template<
typename AValueType,
typename BValueType = AValueType>
586 bool aOn =
false,
bool bOn =
false)
597 CombineArgs(
const AValueType&
a,
const BValueType&
b,
bool aOn =
false,
bool bOn =
false)
658 template<
typename ValueType,
typename CombineOp>
695 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
const AValueType & result() const
Get the output value.
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...
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
const char * typeNameAsString< ValueMask >()
const BValueType * mBValPtr
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
typename T::ValueType ElementType
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
const char * typeNameAsString< PointIndex32 >()
typename T::ValueType ElementType
const char * typeNameAsString< int32_t >()
const char * typeNameAsString< Vec3i >()
const char * typeNameAsString< uint16_t >()
GLsizei const GLfloat * value
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.
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
const char * typeNameAsString< int8_t >()
const char * typeNameAsString< int16_t >()
GLboolean GLboolean GLboolean GLboolean a
#define OPENVDB_USE_VERSION_NAMESPACE
const char * typeNameAsString< Mat3s >()
void updateResultActive()
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
Signed (x, y, z) 32-bit integer coordinates.
Tag dispatch class that distinguishes constructors during file input.
const char * typeNameAsString< PointIndex64 >()
const char * typeNameAsString< Vec3d >()
std::decay_t< decltype(make_index_sequence_impl< N >())> make_index_sequence
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...
const char * typeNameAsString< Mat4s >()
std::shared_ptr< T > SharedPtr
const AValueType & a() const
Get the A input value.
SwappedCombineOp(CombineOp &_op)
const char * typeNameAsString< Vec3U16 >()
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
const char * typeNameAsString< Vec3f >()
const char * typeNameAsString< PointDataIndex32 >()
Re-implementation of C++17's index_sequence and the helper alias make_index_sequence. This was introduced to fix an issue with clang's builtin implementation which treats template specializations of builtin templates differently when a subsequent parameter is dependent. The result is a resolution failure during partial specialization selection. For example, the following will fail to specialize:
const char * typeNameAsString< uint32_t >()
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 hboost::mpl::vector however provides most of its content through using declarations rather than additional typed classes.
IMATH_NAMESPACE::V2f float
std::weak_ptr< T > WeakPtr
PointIndex(T i)
Explicit type conversion constructor.
const char * typeNameAsString< uint8_t >()
bool resultIsActive() const
const char * typeNameAsString< float >()
const char * typeNameAsString< Vec2i >()
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
typename std::remove_const< ToType >::type Type
const char * typeNameAsString()
const char * typeNameAsString< int64_t >()
Tag dispatch class that distinguishes constructors that steal.
static const bool IsScalar
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
GLuint const GLchar * name
GLboolean GLboolean GLboolean b
const char * typeNameAsString< Vec4d >()
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.
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
const char * typeNameAsString< double >()
const AValueType * mAValPtr
AValueType * mResultValPtr
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
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...
typename T::ValueType ElementType
Library and file format version numbers.
const char * typeNameAsString< bool >()
static const int Elements
AValueType & result()
Get the output value.
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
const char * typeNameAsString< Mat4d >()
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
const char * typeNameAsString< Vec3U8 >()
const char * typeNameAsString< Vec2d >()
void operator()(CombineArgs< ValueType > &args)
GA_API const UT_StringHolder N
**If you just want to fire and args
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
const char * typeNameAsString< Vec4f >()
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
const BValueType & b() const
Get the B input value.
Tag dispatch class that distinguishes constructors that deep copy.
const char * typeNameAsString< Vec4i >()
auto make_index_sequence_impl()
typename T::ValueType ElementType
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Conversion classes for changing the underlying type of VDB types.
const char * typeNameAsString< PointDataIndex64 >()
CombineArgs & setResult(const AValueType &val)
Set the output value.
const char * typeNameAsString< Vec2s >()
PointIndex(IntType i=IntType(0))
const char * typeNameAsString< Mat3d >()