|
6 | 6 |
|
7 | 7 | #include "Platform.h" |
8 | 8 | #include "Types.h" |
| 9 | +#include "TypeList.h" |
9 | 10 | #include "Metadata.h" |
10 | 11 | #include "math/Maps.h" |
11 | 12 | #include "math/Transform.h" |
12 | 13 | #include "Grid.h" |
13 | 14 | #include "tree/Tree.h" |
| 15 | +#include "points/PointDataGrid.h" |
14 | 16 | #include "io/File.h" |
15 | 17 |
|
16 | 18 |
|
17 | 19 | namespace openvdb { |
18 | 20 | OPENVDB_USE_VERSION_NAMESPACE |
19 | 21 | namespace OPENVDB_VERSION_NAME { |
20 | 22 |
|
| 23 | +/// @brief Global registration of native Grid, Transform, Metadata and Point |
| 24 | +/// attribute types. Also initializes blosc (if enabled). |
| 25 | +/// @details Calling this methods registers factory callbacks for the set of |
| 26 | +/// native grid, transform, metadata and point attribute types that OpenVDB |
| 27 | +/// supports by default. For most types, calling openvdb::initialize is only |
| 28 | +/// required for serialization support. However, openvdb::initialize must be |
| 29 | +/// called for PointDataGrid attribute usage as these callbacks are used in |
| 30 | +/// various tools. |
| 31 | +/// @note This method is thread safe - it can be concurrently called multiple |
| 32 | +/// times, early exiting if it has already been called so long as |
| 33 | +/// openvdb::uninitialize() has not been called. |
| 34 | +OPENVDB_API void initialize(); |
| 35 | + |
| 36 | +/// @brief Global deregistration of native Grid, Transform, Metadata and Point |
| 37 | +/// attribute types. |
| 38 | +/// @details Clears all registered factory callbacks. This includes everything |
| 39 | +/// registered by openvdb::initialize() but will also include any manually |
| 40 | +/// registered types. |
| 41 | +/// @note This method is thread safe - it can be concurrently called multiple |
| 42 | +/// times. |
| 43 | +/// @warning This method does *not* uninitialize blosc. This is to avoid |
| 44 | +/// changing program states should another library also be using blosc. If |
| 45 | +/// blosc is enabled, consider calling blosc_destroy() in your application. |
| 46 | +OPENVDB_API void uninitialize(); |
| 47 | + |
| 48 | + |
| 49 | +// foward declare some default types |
| 50 | +namespace io { class DelayedLoadMetadata; } |
| 51 | + |
21 | 52 | /// Common tree types |
22 | 53 | using BoolTree = tree::Tree4<bool, 5, 4, 3>::Type; |
23 | 54 | using DoubleTree = tree::Tree4<double, 5, 4, 3>::Type; |
@@ -54,11 +85,127 @@ using Vec3dGrid = Vec3DGrid; |
54 | 85 | using Vec3fGrid = Vec3SGrid; |
55 | 86 | using VectorGrid = Vec3fGrid; |
56 | 87 |
|
57 | | -/// Global registration of basic types |
58 | | -OPENVDB_API void initialize(); |
| 88 | +/// @name Lists of native Grid Types |
| 89 | +/// @{ |
| 90 | +/// The floating point Grid types which OpenVDB will register by default. |
| 91 | +using NativeFloatGridTypes = TypeList<FloatGrid, DoubleGrid>; |
| 92 | +/// The integer Grid types which OpenVDB will register by default. |
| 93 | +using NativeIntegerGridTypes = TypeList<Int32Grid, Int64Grid>; |
| 94 | +/// The scalar Grid types which OpenVDB will register by default. This is a |
| 95 | +/// combination of native floating point and integer grid types. Note that |
| 96 | +/// this list does not include Bool or Mask Grids. |
| 97 | +using NativeScalarGridTypes = NativeFloatGridTypes::Append<NativeIntegerGridTypes>; |
| 98 | +/// The Vec3 Grid types which OpenVDB will register by default. |
| 99 | +using NativeVec3GridTypes = TypeList<Vec3IGrid, Vec3SGrid, Vec3DGrid>; |
59 | 100 |
|
60 | | -/// Global deregistration of basic types |
61 | | -OPENVDB_API void uninitialize(); |
| 101 | +/// The Grid types which OpenVDB will register by default. |
| 102 | +using NativeGridTypes = |
| 103 | + NativeScalarGridTypes:: |
| 104 | + Append<NativeVec3GridTypes>:: |
| 105 | + Append<tools::PointIndexGrid>:: |
| 106 | + // #define unfortunately required for one of the tests that removes this alias |
| 107 | +#ifndef OPENVDB_DISABLE_POINT_DATA_TREE_ALIAS |
| 108 | + Append<points::PointDataGrid>:: |
| 109 | +#endif |
| 110 | + Append<BoolGrid, MaskGrid>; |
| 111 | +/// @} |
| 112 | + |
| 113 | + |
| 114 | +/// @name Lists of native TypedAttributeArray Types (for PointDataGrids) |
| 115 | +/// @{ |
| 116 | +/// The floating point attribute array types which OpenVDB will register by default. |
| 117 | +using NativeFloatAttributeTypes = TypeList< |
| 118 | + points::TypedAttributeArray<float>, |
| 119 | + points::TypedAttributeArray<double>, |
| 120 | + points::TypedAttributeArray<float, points::TruncateCodec>, |
| 121 | + points::TypedAttributeArray<float, points::FixedPointCodec<true, points::UnitRange>>, |
| 122 | + points::TypedAttributeArray<float, points::FixedPointCodec<false, points::UnitRange>> |
| 123 | + >; |
| 124 | +/// The integer attribute array types which OpenVDB will register by default. |
| 125 | +using NativeIntegerAttributeTypes = TypeList< |
| 126 | + points::TypedAttributeArray<int8_t>, |
| 127 | + points::TypedAttributeArray<int16_t>, |
| 128 | + points::TypedAttributeArray<int32_t>, |
| 129 | + points::TypedAttributeArray<int64_t> |
| 130 | + >; |
| 131 | +/// The scalar attribute array types which OpenVDB will register by default. |
| 132 | +/// This is a combination of native floating point and integer array types. |
| 133 | +/// Note that this list does not include bool arrays. |
| 134 | +using NativeScalarAttributeTypes = |
| 135 | + NativeFloatAttributeTypes::Append<NativeIntegerAttributeTypes>; |
| 136 | +/// The Vec3 attribute array types which OpenVDB will register by default. |
| 137 | +using NativeVec3AttributeTypes = TypeList< |
| 138 | + points::TypedAttributeArray<math::Vec3<int32_t>>, |
| 139 | + points::TypedAttributeArray<math::Vec3<float>>, |
| 140 | + points::TypedAttributeArray<math::Vec3<double>>, |
| 141 | + points::TypedAttributeArray<math::Vec3<float>, points::TruncateCodec>, |
| 142 | + points::TypedAttributeArray<math::Vec3<float>, points::FixedPointCodec<true, points::PositionRange>>, |
| 143 | + points::TypedAttributeArray<math::Vec3<float>, points::FixedPointCodec<false, points::PositionRange>>, |
| 144 | + points::TypedAttributeArray<math::Vec3<float>, points::FixedPointCodec<true, points::UnitRange>>, |
| 145 | + points::TypedAttributeArray<math::Vec3<float>, points::FixedPointCodec<false, points::UnitRange>>, |
| 146 | + points::TypedAttributeArray<math::Vec3<float>, points::UnitVecCodec> |
| 147 | + >; |
| 148 | +/// The Mat3 attribute array types which OpenVDB will register by default. |
| 149 | +using NativeMat3AttributeTypes = TypeList< |
| 150 | + points::TypedAttributeArray<math::Mat3<float>>, |
| 151 | + points::TypedAttributeArray<math::Mat3<double>> |
| 152 | + >; |
| 153 | +/// The Mat4 attribute array types which OpenVDB will register by default. |
| 154 | +using NativeMat4AttributeTypes = TypeList< |
| 155 | + points::TypedAttributeArray<math::Mat4<float>>, |
| 156 | + points::TypedAttributeArray<math::Mat4<double>> |
| 157 | + >; |
| 158 | +/// The Quat attribute array types which OpenVDB will register by default. |
| 159 | +using NativeQuatAttributeTypes = TypeList< |
| 160 | + points::TypedAttributeArray<math::Quat<float>>, |
| 161 | + points::TypedAttributeArray<math::Quat<double>> |
| 162 | + >; |
| 163 | + |
| 164 | +/// The attribute array types which OpenVDB will register by default. |
| 165 | +using NativeAttributeTypes = |
| 166 | + NativeScalarAttributeTypes:: |
| 167 | + Append<NativeVec3AttributeTypes>:: |
| 168 | + Append<NativeMat3AttributeTypes>:: |
| 169 | + Append<NativeMat4AttributeTypes>:: |
| 170 | + Append<NativeQuatAttributeTypes>:: |
| 171 | + Append<points::GroupAttributeArray>:: |
| 172 | + Append<points::StringAttributeArray>:: |
| 173 | + Append<points::TypedAttributeArray<bool>>; |
| 174 | +/// @} |
| 175 | + |
| 176 | + |
| 177 | +/// The Map types which OpenVDB will register by default. |
| 178 | +using NativeMapTypes = TypeList< |
| 179 | + math::AffineMap, |
| 180 | + math::UnitaryMap, |
| 181 | + math::ScaleMap, |
| 182 | + math::UniformScaleMap, |
| 183 | + math::TranslationMap, |
| 184 | + math::ScaleTranslateMap, |
| 185 | + math::UniformScaleTranslateMap, |
| 186 | + math::NonlinearFrustumMap>; |
| 187 | + |
| 188 | + |
| 189 | +/// The Metadata types which OpenVDB will register by default. |
| 190 | +using NativeMetaTypes = TypeList< |
| 191 | + BoolMetadata, |
| 192 | + DoubleMetadata, |
| 193 | + FloatMetadata, |
| 194 | + Int32Metadata, |
| 195 | + Int64Metadata, |
| 196 | + StringMetadata, |
| 197 | + Vec2IMetadata, |
| 198 | + Vec2SMetadata, |
| 199 | + Vec2DMetadata, |
| 200 | + Vec3IMetadata, |
| 201 | + Vec3SMetadata, |
| 202 | + Vec3DMetadata, |
| 203 | + Vec4IMetadata, |
| 204 | + Vec4SMetadata, |
| 205 | + Vec4DMetadata, |
| 206 | + Mat4SMetadata, |
| 207 | + Mat4DMetadata, |
| 208 | + io::DelayedLoadMetadata>; |
62 | 209 |
|
63 | 210 |
|
64 | 211 | // Deprecated types |
|
0 commit comments