MeshLib Documentation
Loading...
Searching...
No Matches
MRVDBFloatGrid.h
Go to the documentation of this file.
1#pragma once
2#include "MRVoxelsFwd.h"
3// this header includes the whole OpenVDB, so please include it from .cpp files only
4#include "MRMesh/MRVector3.h"
5
6#include "MROpenVDB.h"
7#include "MRPch/MRBindingMacros.h"
8
9namespace MR
10{
11
19struct OpenVdbFloatGrid : openvdb::FloatGrid
20{
21 OpenVdbFloatGrid() noexcept = default;
22 MR_BIND_IGNORE OpenVdbFloatGrid( openvdb::FloatGrid && in ) : openvdb::FloatGrid( std::move( in ) ) {}
23 [[nodiscard]] size_t heapBytes() const { return memUsage(); }
24};
25
26MR_BIND_IGNORE inline openvdb::FloatGrid & ovdb( OpenVdbFloatGrid & v ) { return v; }
27MR_BIND_IGNORE inline const openvdb::FloatGrid & ovdb( const OpenVdbFloatGrid & v ) { return v; }
28
30MR_BIND_IGNORE inline FloatGrid MakeFloatGrid( openvdb::FloatGrid::Ptr&& p )
31{
32 if ( !p )
33 return {};
34 return std::make_shared<OpenVdbFloatGrid>( std::move( *p ) );
35}
36
37MR_BIND_IGNORE inline Vector3i fromVdb( const openvdb::Coord & v )
38{
39 return Vector3i( v.x(), v.y(), v.z() );
40}
41
42MR_BIND_IGNORE inline openvdb::Coord toVdb( const Vector3i & v )
43{
44 return openvdb::Coord( v.x, v.y, v.z );
45}
46
48
49}
MR_BIND_IGNORE FloatGrid MakeFloatGrid(openvdb::FloatGrid::Ptr &&p)
makes MR::FloatGrid shared pointer taking the contents of the input pointer
Definition MRVDBFloatGrid.h:30
MR_BIND_IGNORE openvdb::FloatGrid & ovdb(OpenVdbFloatGrid &v)
Definition MRVDBFloatGrid.h:26
MR_BIND_IGNORE Vector3i fromVdb(const openvdb::Coord &v)
Definition MRVDBFloatGrid.h:37
MR_BIND_IGNORE openvdb::Coord toVdb(const Vector3i &v)
Definition MRVDBFloatGrid.h:42
Definition MRCameraOrientationPlugin.h:8
std::shared_ptr< OpenVdbFloatGrid > FloatGrid
Definition MRVoxelsFwd.h:25
this class just hides very complex type of typedef openvdb::FloatGrid
Definition MRVDBFloatGrid.h:20
OpenVdbFloatGrid() noexcept=default
size_t heapBytes() const
Definition MRVDBFloatGrid.h:23