Loading...
Searching...
No Matches
openvdb.h
Go to the documentation of this file.
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-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<bool, 5, 4, 3>::Type;
using DoubleTree = tree::Tree4<double, 5, 4, 3>::Type;
using FloatTree = tree::Tree4<float, 5, 4, 3>::Type;
using Int32Tree = tree::Tree4<int32_t, 5, 4, 3>::Type;
using Int64Tree = tree::Tree4<int64_t, 5, 4, 3>::Type;
using MaskTree = tree::Tree4<ValueMask, 5, 4, 3>::Type;
using UInt32Tree = tree::Tree4<uint32_t, 5, 4, 3>::Type;
using Vec2DTree = tree::Tree4<Vec2d, 5, 4, 3>::Type;
using Vec2ITree = tree::Tree4<Vec2i, 5, 4, 3>::Type;
using Vec2STree = tree::Tree4<Vec2s, 5, 4, 3>::Type;
using Vec3DTree = tree::Tree4<Vec3d, 5, 4, 3>::Type;
using Vec3ITree = tree::Tree4<Vec3i, 5, 4, 3>::Type;
using Vec3STree = tree::Tree4<Vec3f, 5, 4, 3>::Type;
using ScalarTree = FloatTree;
using TopologyTree = MaskTree;
using Vec3dTree = Vec3DTree;
using Vec3fTree = Vec3STree;
using VectorTree = Vec3fTree;
/// Common grid types
using BoolGrid = Grid<BoolTree>;
using DoubleGrid = Grid<DoubleTree>;
using FloatGrid = Grid<FloatTree>;
using Int32Grid = Grid<Int32Tree>;
using Int64Grid = Grid<Int64Tree>;
using MaskGrid = Grid<MaskTree>;
using Vec3DGrid = Grid<Vec3DTree>;
using Vec3IGrid = Grid<Vec3ITree>;
using Vec3SGrid = Grid<Vec3STree>;
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<FloatGrid, DoubleGrid>;
/// The integer Grid types which OpenVDB will register by default.
using IntegerGridTypes = TypeList<Int32Grid, Int64Grid>;
/// 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<IntegerGridTypes>;
/// The Vec3 Grid types which OpenVDB will register by default.
using Vec3GridTypes = TypeList<Vec3IGrid, Vec3SGrid, Vec3DGrid>;
/// The Grid types which OpenVDB will register by default.
using GridTypes =
NumericGridTypes::
Append<Vec3GridTypes>::
Append<tools::PointIndexGrid>::
// #define unfortunately required for one of the tests that removes this alias
#ifndef OPENVDB_DISABLE_POINT_DATA_TREE_ALIAS
Append<points::PointDataGrid>::
#endif
Append<BoolGrid, MaskGrid>;
/// @}
namespace internal {
template <typename T> using ToTreeType = typename T::TreeType;
}
/// @name Lists of native Tree Types
/// @{
using RealTreeTypes = RealGridTypes::Transform<internal::ToTreeType>;
using IntegerTreeTypes = IntegerGridTypes::Transform<internal::ToTreeType>;
using NumericTreeTypes = NumericGridTypes::Transform<internal::ToTreeType>;
using Vec3TreeTypes = Vec3GridTypes::Transform<internal::ToTreeType>;
using TreeTypes = GridTypes::Transform<internal::ToTreeType>;
/// @}
/// @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<float>,
points::TypedAttributeArray<double>,
points::TypedAttributeArray<float, points::TruncateCodec>,
points::TypedAttributeArray<float, points::FixedPointCodec<true, points::UnitRange>>,
points::TypedAttributeArray<float, points::FixedPointCodec<false, points::UnitRange>>
>;
/// The integer attribute array types which OpenVDB will register by default.
using IntegerAttributeTypes = TypeList<
points::TypedAttributeArray<int8_t>,
points::TypedAttributeArray<int16_t>,
points::TypedAttributeArray<int32_t>,
points::TypedAttributeArray<int64_t>
>;
/// 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<IntegerAttributeTypes>;
/// The Vec3 attribute array types which OpenVDB will register by default.
using Vec3AttributeTypes = TypeList<
points::TypedAttributeArray<math::Vec3<int32_t>>,
points::TypedAttributeArray<math::Vec3<float>>,
points::TypedAttributeArray<math::Vec3<double>>,
points::TypedAttributeArray<math::Vec3<float>, points::TruncateCodec>,
points::TypedAttributeArray<math::Vec3<float>, points::FixedPointCodec<true, points::PositionRange>>,
points::TypedAttributeArray<math::Vec3<float>, points::FixedPointCodec<false, points::PositionRange>>,
points::TypedAttributeArray<math::Vec3<float>, points::FixedPointCodec<true, points::UnitRange>>,
points::TypedAttributeArray<math::Vec3<float>, points::FixedPointCodec<false, points::UnitRange>>,
points::TypedAttributeArray<math::Vec3<float>, points::UnitVecCodec>
>;
/// The Mat3 attribute array types which OpenVDB will register by default.
using Mat3AttributeTypes = TypeList<
points::TypedAttributeArray<math::Mat3<float>>,
points::TypedAttributeArray<math::Mat3<double>>
>;
/// The Mat4 attribute array types which OpenVDB will register by default.
using Mat4AttributeTypes = TypeList<
points::TypedAttributeArray<math::Mat4<float>>,
points::TypedAttributeArray<math::Mat4<double>>
>;
/// The Quat attribute array types which OpenVDB will register by default.
using QuatAttributeTypes = TypeList<
points::TypedAttributeArray<math::Quat<float>>,
points::TypedAttributeArray<math::Quat<double>>
>;
/// The attribute array types which OpenVDB will register by default.
using AttributeTypes =
NumericAttributeTypes::
Append<Vec3AttributeTypes>::
Append<Mat3AttributeTypes>::
Append<Mat4AttributeTypes>::
Append<QuatAttributeTypes>::
Append<points::GroupAttributeArray>::
Append<points::StringAttributeArray>::
Append<points::TypedAttributeArray<bool>>;
/// @}
/// 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
File.h
Grid.h
Maps.h
Metadata.h
Platform.h
OPENVDB_API
#define OPENVDB_API
Definition Platform.h:274
PointDataGrid.h
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
Transform.h
Tree.h
TypeList.h
A TypeList provides a compile time sequence of heterogeneous types which can be accessed,...
Types.h
openvdb::v11_0::Grid
Container class that associates a tree with a transform and metadata.
Definition Grid.h:571
openvdb::v11_0::TypedMetadata
Templated metadata class to hold specific types.
Definition Metadata.h:122
openvdb::v11_0::io::DelayedLoadMetadata
Store a buffer of data that can be optionally used during reading for faster delayed-load I/O perform...
Definition DelayedLoadMetadata.h:22
openvdb::v11_0::math::AffineMap
A general linear transform using homogeneous coordinates to perform rotation, scaling,...
Definition Maps.h:296
openvdb::v11_0::math::NonlinearFrustumMap
This map is composed of three steps. First it will take a box of size (Lx X Ly X Lz) defined by a mem...
Definition Maps.h:1892
openvdb::v11_0::math::ScaleMap
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition Maps.h:656
openvdb::v11_0::math::ScaleTranslateMap
A specialized Affine transform that scales along the principal axis the scaling need not be uniform i...
Definition Maps.h:1163
openvdb::v11_0::math::TranslationMap
A specialized linear transform that performs a translation.
Definition Maps.h:978
openvdb::v11_0::math::UniformScaleMap
A specialized Affine transform that scales along the principal axis the scaling is uniform in the thr...
Definition Maps.h:906
openvdb::v11_0::math::UniformScaleTranslateMap
A specialized Affine transform that uniformaly scales along the principal axis and then translates th...
Definition Maps.h:1479
openvdb::v11_0::math::UnitaryMap
A specialized linear transform that performs a unitary maping i.e. rotation and or reflection.
Definition Maps.h:1621
openvdb::v11_0::points::TypedAttributeArray
Typed class for storing attribute data.
Definition AttributeArray.h:545
openvdb::v11_0::tree::Tree
Definition Tree.h:178
openvdb::v11_0::internal::ToTreeType
typename T::TreeType ToTreeType
Definition openvdb.h:115
openvdb::v11_0::AttributeTypes
NumericAttributeTypes::Append< Vec3AttributeTypes >::Append< Mat3AttributeTypes >::Append< Mat4AttributeTypes >::Append< QuatAttributeTypes >::Append< points::GroupAttributeArray >::Append< points::StringAttributeArray >::Append< points::TypedAttributeArray< bool > > AttributeTypes
The attribute array types which OpenVDB will register by default.
Definition openvdb.h:186
openvdb::v11_0::TreeTypes
GridTypes::Transform< internal::ToTreeType > TreeTypes
Definition openvdb.h:123
openvdb::v11_0::IntegerTreeTypes
IntegerGridTypes::Transform< internal::ToTreeType > IntegerTreeTypes
Definition openvdb.h:120
openvdb::v11_0::RealTreeTypes
RealGridTypes::Transform< internal::ToTreeType > RealTreeTypes
Definition openvdb.h:119
openvdb::v11_0::NumericGridTypes
RealGridTypes::Append< IntegerGridTypes > NumericGridTypes
Definition openvdb.h:97
openvdb::v11_0::initialize
OPENVDB_IMPORT void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types....
openvdb::v11_0::Vec3TreeTypes
Vec3GridTypes::Transform< internal::ToTreeType > Vec3TreeTypes
Definition openvdb.h:122
openvdb::v11_0::NumericAttributeTypes
RealAttributeTypes::Append< IntegerAttributeTypes > NumericAttributeTypes
Definition openvdb.h:148
openvdb::v11_0::uninitialize
OPENVDB_IMPORT void uninitialize()
Global deregistration of native Grid, Transform, Metadata and Point attribute types.
openvdb::v11_0::NumericTreeTypes
NumericGridTypes::Transform< internal::ToTreeType > NumericTreeTypes
Definition openvdb.h:121
openvdb::v11_0::GridTypes
NumericGridTypes::Append< Vec3GridTypes >::Append< tools::PointIndexGrid >::Append< points::PointDataGrid >::Append< BoolGrid, MaskGrid > GridTypes
The Grid types which OpenVDB will register by default.
Definition openvdb.h:110
openvdb
Definition Exceptions.h:13
openvdb::v11_0::TypeList
A list of types (not necessarily unique)
Definition TypeList.h:578
openvdb::v11_0::TypeList::Transform
typename typelist_internal::TSTranformImpl< OpT, Ts... >::type Transform
Transform each type of this TypeList, rebuiling a new list of converted types. This method instantiat...
Definition TypeList.h:736
openvdb::v11_0::TypeList::Append
typename typelist_internal::TSAppendImpl< Self, TypesToAppend... >::type Append
Append types, or the members of another TypeList, to this list.
Definition TypeList.h:656
openvdb::v11_0::points::FixedPointCodec
Definition AttributeArray.h:511
openvdb::v11_0::points::TruncateCodec
Definition AttributeArray.h:481
openvdb::v11_0::points::UnitVecCodec
Definition AttributeArray.h:526
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:212