// Copyright Contributors to the OpenVDB Project // SPDX-License-Identifier: Apache-2.0 #ifndef OPENVDB_OPENVDB_HAS_BEEN_INCLUDED #define OPENVDB_OPENVDB_HAS_BEEN_INCLUDED #include "Platform.h" #include "Types.h" #include "TypeList.h" #include "Metadata.h" #include "math/Maps.h" #include "math/Transform.h" #include "Grid.h" #include "tree/Tree.h" #include "points/PointDataGrid.h" #include "io/File.h" namespace openvdb { OPENVDB_USE_VERSION_NAMESPACE namespace OPENVDB_VERSION_NAME { /// @brief Global registration of native Grid, Transform, Metadata and Point /// attribute types. Also initializes blosc (if enabled). /// @details Calling this methods registers factory callbacks for the set of /// native grid, transform, metadata and point attribute types that OpenVDB /// supports by default. For most types, calling openvdb::initialize is only /// required for serialization support. However, openvdb::initialize must be /// called for PointDataGrid attribute usage as these callbacks are used in /// various tools. /// @note This method is thread safe - it can be concurrently called multiple /// times, early exiting if it has already been called so long as /// openvdb::uninitialize() has not been called. OPENVDB_API void initialize(); /// @brief Global deregistration of native Grid, Transform, Metadata and Point /// attribute types. /// @details Clears all registered factory callbacks. This includes everything /// registered by openvdb::initialize() but will also include any manually /// registered types. /// @note This method is thread safe - it can be concurrently called multiple /// times. /// @warning This method does *not* uninitialize blosc. This is to avoid /// changing program states should another library also be using blosc. If /// blosc is enabled, consider calling blosc_destroy() in your application. OPENVDB_API void uninitialize(); // foward declare some default types namespace io { class DelayedLoadMetadata; } /// Common tree types using BoolTree = tree::Tree4::Type; using DoubleTree = tree::Tree4::Type; using FloatTree = tree::Tree4::Type; using Int32Tree = tree::Tree4::Type; using Int64Tree = tree::Tree4::Type; using MaskTree = tree::Tree4::Type; using UInt32Tree = tree::Tree4::Type; using Vec2DTree = tree::Tree4::Type; using Vec2ITree = tree::Tree4::Type; using Vec2STree = tree::Tree4::Type; using Vec3DTree = tree::Tree4::Type; using Vec3ITree = tree::Tree4::Type; using Vec3STree = tree::Tree4::Type; using ScalarTree = FloatTree; using TopologyTree = MaskTree; using Vec3dTree = Vec3DTree; using Vec3fTree = Vec3STree; using VectorTree = Vec3fTree; /// Common grid types using BoolGrid = Grid; using DoubleGrid = Grid; using FloatGrid = Grid; using Int32Grid = Grid; using Int64Grid = Grid; using MaskGrid = Grid; using Vec3DGrid = Grid; using Vec3IGrid = Grid; using Vec3SGrid = Grid; using ScalarGrid = FloatGrid; using TopologyGrid = MaskGrid; using Vec3dGrid = Vec3DGrid; using Vec3fGrid = Vec3SGrid; using VectorGrid = Vec3fGrid; /// @name Lists of native Grid Types /// @{ /// The floating point Grid types which OpenVDB will register by default. using RealGridTypes = TypeList; /// The integer Grid types which OpenVDB will register by default. using IntegerGridTypes = TypeList; /// The scalar Grid types which OpenVDB will register by default. This is a /// combination of native floating point and integer grid types. Note that /// this list does not include Bool or Mask Grids. using NumericGridTypes = RealGridTypes::Append; /// The Vec3 Grid types which OpenVDB will register by default. using Vec3GridTypes = TypeList; /// The Grid types which OpenVDB will register by default. using GridTypes = NumericGridTypes:: Append:: Append:: // #define unfortunately required for one of the tests that removes this alias #ifndef OPENVDB_DISABLE_POINT_DATA_TREE_ALIAS Append:: #endif Append; /// @} namespace internal { template using ToTreeType = typename T::TreeType; } /// @name Lists of native Tree Types /// @{ using RealTreeTypes = RealGridTypes::Transform; using IntegerTreeTypes = IntegerGridTypes::Transform; using NumericTreeTypes = NumericGridTypes::Transform; using Vec3TreeTypes = Vec3GridTypes::Transform; using TreeTypes = GridTypes::Transform; /// @} /// @name Lists of native TypedAttributeArray Types (for PointDataGrids) /// @{ /// The floating point attribute array types which OpenVDB will register by default. using RealAttributeTypes = TypeList< points::TypedAttributeArray, points::TypedAttributeArray, points::TypedAttributeArray, points::TypedAttributeArray>, points::TypedAttributeArray> >; /// The integer attribute array types which OpenVDB will register by default. using IntegerAttributeTypes = TypeList< points::TypedAttributeArray, points::TypedAttributeArray, points::TypedAttributeArray, points::TypedAttributeArray >; /// The scalar attribute array types which OpenVDB will register by default. /// This is a combination of native floating point and integer array types. /// Note that this list does not include bool arrays. using NumericAttributeTypes = RealAttributeTypes::Append; /// The Vec3 attribute array types which OpenVDB will register by default. using Vec3AttributeTypes = TypeList< points::TypedAttributeArray>, points::TypedAttributeArray>, points::TypedAttributeArray>, points::TypedAttributeArray, points::TruncateCodec>, points::TypedAttributeArray, points::FixedPointCodec>, points::TypedAttributeArray, points::FixedPointCodec>, points::TypedAttributeArray, points::FixedPointCodec>, points::TypedAttributeArray, points::FixedPointCodec>, points::TypedAttributeArray, points::UnitVecCodec> >; /// The Mat3 attribute array types which OpenVDB will register by default. using Mat3AttributeTypes = TypeList< points::TypedAttributeArray>, points::TypedAttributeArray> >; /// The Mat4 attribute array types which OpenVDB will register by default. using Mat4AttributeTypes = TypeList< points::TypedAttributeArray>, points::TypedAttributeArray> >; /// The Quat attribute array types which OpenVDB will register by default. using QuatAttributeTypes = TypeList< points::TypedAttributeArray>, points::TypedAttributeArray> >; /// The attribute array types which OpenVDB will register by default. using AttributeTypes = NumericAttributeTypes:: Append:: Append:: Append:: Append:: Append:: Append:: Append>; /// @} /// The Map types which OpenVDB will register by default. using MapTypes = TypeList< math::AffineMap, math::UnitaryMap, math::ScaleMap, math::UniformScaleMap, math::TranslationMap, math::ScaleTranslateMap, math::UniformScaleTranslateMap, math::NonlinearFrustumMap>; /// The Metadata types which OpenVDB will register by default. using MetaTypes = TypeList< BoolMetadata, DoubleMetadata, FloatMetadata, Int32Metadata, Int64Metadata, StringMetadata, Vec2IMetadata, Vec2SMetadata, Vec2DMetadata, Vec3IMetadata, Vec3SMetadata, Vec3DMetadata, Vec4IMetadata, Vec4SMetadata, Vec4DMetadata, Mat4SMetadata, Mat4DMetadata, io::DelayedLoadMetadata>; } // namespace OPENVDB_VERSION_NAME } // namespace openvdb #endif // OPENVDB_OPENVDB_HAS_BEEN_INCLUDED