-
首页
-
C4D R23.110 C++ SDK
VolumeToolsInterface Class Reference
#include <volumetools.h>
详细描述
VolumeToolsInterface
provides methods to process volumes.
静态公共成员函数
|
static
MAXON_METHOD
Result
<
BaseArray
<
String
> >
|
GetGridNamesFromFile
(const
Url
&filename)
|
static
MAXON_METHOD
Result
< DataDictionary >
|
GetMetaDataFromFile
(const
Url
&filename)
|
static
MAXON_METHOD
Result
<
BaseArray
< Volume > >
|
LoadVDBFile
(const
Url
&filename,
Float
scale,
BaseArray
<
String
> *gridNames=nullptr, const
BaseArray
<
Int
> *gridIndices=nullptr, DataDictionary *metaData=nullptr)
|
static
MAXON_METHOD
Result
< void >
|
LoadGridIntoVolume
(const
Url
&filename,
Float
scale,
Int
gridIndex, Volume &volume, DataDictionary *metaData=nullptr)
|
static
MAXON_METHOD
Result
< void >
|
LoadAllGridsIntoVolumes
(const
Url
&filename,
Float
scale,
maxon::BaseArray
< Volume > &volume, DataDictionary *metaData=nullptr)
|
static
MAXON_METHOD
Result
< void >
|
SaveVDBFile
(const
Url
&filename,
Float
scale,
BaseArray
< Volume > &volumes, const DataDictionary &metaData=DataDictionary())
|
static
MAXON_METHOD
Result
< Volume >
|
BoolVolumes
(const Volume &volumeOne, const Volume &volumeTwo,
BOOLTYPE
type)
|
static
MAXON_METHOD
Result
< Volume >
|
MixVolumes
(const Volume &volumeOne, const Volume &volumeTwo,
MIXTYPE
type)
|
static
MAXON_METHOD
Result
<
PolygonObject
* >
|
VolumeToMesh
(const Volume &volume,
Float
iso,
Float
adaptiveValue)
|
static
MAXON_METHOD
Result
< Volume >
|
MeshToVolume
(const
Block
<
向量
> &vertices, const
Block
<
VolumeConversionPolygon
> &polygons,
矩阵
polygonObjectMatrix,
Float
gridSize,
Int32
bandWidthInterior,
Int32
bandWidthExterior, const
ThreadRef
&thread,
POLYGONCONVERSIONFLAGS
conversionSettings=
POLYGONCONVERSIONFLAGS::NONE
, const
矩阵
*creationTransform=nullptr)
|
static
MAXON_METHOD
Result
< Volume >
|
PointsToVolume
(const
DelegatePointObjectsPairList
&pointObjects,
Float
gridSize,
Int32
bandWidth, const
ThreadRef
&thread, const
矩阵
*creationTransform=nullptr,
Float
velocityScale=0.0)
|
static
MAXON_METHOD
Result
< Volume >
|
ApplySDFFilterToVolume
(const Volume &volume, const
SDFFilterSettings
&filterType, const
ThreadRef
&thread, const Volume *maskVolume=nullptr,
FieldSampleData
*maskField=nullptr)
|
static
MAXON_METHOD
Result
< Volume >
|
ApplyFilterToVolume
(const Volume &volume, const
FilterSettings
&filterType, const
ThreadRef
&thread, const Volume *maskVolume=nullptr,
FieldSampleData
*maskField=nullptr)
|
static
MAXON_METHOD
Result
< Volume >
|
ConvertFieldsToVolume
(
FieldSampleData
&fieldData,
Float
gridSize, const
Range
<
向量
> &sampleBox, const
ThreadRef
&thread, const Volume *volumeReference=nullptr, const
矩阵
*creationTransform=nullptr)
|
static
MAXON_METHOD
Result
< Volume >
|
ConvertSDFToFog
(const Volume &volume,
Float
cutoff=
LIMIT
<
Float
>::MAX)
|
static
MAXON_METHOD
Result
< Volume >
|
ConvertFogToSDF
(const Volume &volume,
Float
iso, const
ThreadRef
&thread)
|
static
MAXON_METHOD
Result
< Volume >
|
ResampleVolume
(const Volume &volume, const
矩阵
&resampleTransform, const
RESAMPLEINTERPOLATIONTYPE
interpolationType, const
ThreadRef
&thread)
|
static
MAXON_METHOD
Result
< Volume >
|
CreateMaskFromField
(
FieldSampleData
&fieldData, const Volume &volumeReference,
Float
background, const
ThreadRef
&thread)
|
static
MAXON_METHOD
Result
< Volume >
|
CreateNewFloat32Volume
(
Float32
background)
|
static
MAXON_METHOD
Result
< Volume >
|
CreateGradientVolume
(const Volume &volume, const
ThreadRef
&thread)
|
static
MAXON_METHOD
Result
< Volume >
|
CreateSphereVolume
(
Float
radius, const
向量
&position,
Float
gridSize,
Int32
bandWidth, const
ThreadRef
&thread, const
矩阵
*creationTransform=nullptr)
|
static
MAXON_METHOD
Result
< Volume >
|
CreatePlatonicVolume
(
Int32
sides,
Float
size, const
向量
&position,
Float
gridSize,
Int32
bandWidth, const
ThreadRef
&thread, const
矩阵
*creationTransform=nullptr)
|
static
MAXON_METHOD
Result
< Volume >
|
CreateNewVector32Volume
(
Vector32
background)
|
static
MAXON_METHOD
Result
< Volume >
|
MixVectorVolumes
(const Volume &volumeOne, const Volume &volumeTwo,
MIXVECTORTYPE
type)
|
static
MAXON_METHOD
Result
< Volume >
|
ConvertFieldsToVectorVolume
(
FieldSampleData
&fieldData,
Float
gridSize, const
Range
<
向量
> &sampleBox, const
ThreadRef
&thread, const Volume *volumeReference=nullptr, const
矩阵
*creationTransform=nullptr)
|
static
MAXON_METHOD
Result
< Volume >
|
NormalizeVectorVolume
(const Volume &volume, const
ThreadRef
&thread)
|
static
MAXON_METHOD
Result
< Volume >
|
CreateCurlVolume
(const Volume &volume, const
ThreadRef
&thread)
|
static
MAXON_METHOD
Result
< Volume >
|
CreateMeanCurvatureVolume
(const Volume &volume, const
ThreadRef
&thread)
|
static
MAXON_METHOD
Result
< Volume >
|
RotateVectorVolume
(const Volume &volume, const
向量
&rotationAxis, const
Float
angle, const
ThreadRef
&thread,
FieldSampleData
*maskField=nullptr)
|
static
MAXON_METHOD
Result
< Volume >
|
ConvertVectorToFog
(const Volume &volume, const
ThreadRef
&thread)
|
static
MAXON_METHOD
Result
< Volume >
|
BlendVolumes
(const Volume &volumeA, const Volume &volumeB, const
Float
blendValue, const
ThreadRef
&thread)
|
成员函数文档编制
◆
MAXON_INTERFACE_NONVIRTUAL()
◆
GetGridNamesFromFile()
Read and return the gridnames from a .vdb file.
-
参数
-
[in]
|
filename
|
The url of the file.
|
-
返回
-
A list of strings that represent the grid names in the .vdb file.
◆
GetMetaDataFromFile()
Read and return the metadata from a .vdb file.
-
参数
-
[in]
|
filename
|
The url of the file.
|
-
返回
-
A data dictionary with metadata stored under string keys.
◆
LoadVDBFile()
Loads volumes from a .vdb file.
-
参数
-
[in]
|
filename
|
The url of the file to load from.
|
[in]
|
scale
|
A scale factor for loading the grids.
|
[out]
|
gridNames
|
若
BaseArray
is passed, it will be filled with the grid names.
|
[in]
|
gridIndices
|
Optional list of indices that should be loaded from the file.
|
[out]
|
metaData
|
If passed, will be filled with the metadata from the file.
|
-
返回
-
A list of volumes that were loaded from the .vdb file.
◆
LoadGridIntoVolume()
static
MAXON_METHOD
Result
<void> LoadGridIntoVolume
|
(
|
const
Url
&
|
filename
,
|
|
|
Float
|
scale
,
|
|
|
Int
|
gridIndex
,
|
|
|
Volume &
|
volume
,
|
|
|
DataDictionary *
|
metaData
=
nullptr
|
|
)
|
|
|
|
static
|
Loads a grid into a volume from a .vdb file.
-
参数
-
[in]
|
filename
|
The url of the file to load from.
|
[in]
|
scale
|
A scale factor for loading the grids.
|
[in]
|
gridIndex
|
The index of the grid in the .vdb file.
|
[out]
|
volume
|
The volume reference to load the grid into.
|
[out]
|
metaData
|
If passed, will be filled with the metadata from the file.
|
-
返回
-
OK on success.
◆
LoadAllGridsIntoVolumes()
Loads all grids into a list of volumes from a .vdb file.
-
参数
-
[in]
|
filename
|
The url of the file to load from.
|
[in]
|
scale
|
A scale factor for loading the grids.
|
[out]
|
volume
|
The output list of loaded volumes.
|
[out]
|
metaData
|
If passed, will be filled with the metadata from the file.
|
-
返回
-
OK on success.
◆
SaveVDBFile()
Saves volumes to a .vdb file.
-
参数
-
[in]
|
filename
|
The url of the file to save to.
|
[in]
|
scale
|
A scale factor for saving the grids.
|
[in]
|
volumes
|
A list of volumes that should be saved to the .vdb file.
|
[in]
|
metaData
|
Optional Metadata to write to the file. Have to be added under string keys to the data dictionary.
|
-
返回
-
OK on success.
◆
BoolVolumes()
Bools two SDF volumes into one with a given bool type of
BOOLTYPE
.
-
参数
-
[in]
|
volumeOne
|
The first SDF volume for the boolean operation.
|
[in]
|
volumeTwo
|
The second SDF volume for the boolean operation.
|
[in]
|
type
|
The bool type
BOOLTYPE
.
|
-
返回
-
The booled volume.
◆
MixVolumes()
Mix two volumes into one with a given mix type of ::MIXTYPE.
-
参数
-
[in]
|
volumeOne
|
The first volume for the mix operation.
|
[in]
|
volumeTwo
|
The second volume for the mix operation.
|
[in]
|
type
|
The mix type ::MIXTYPE.
|
-
返回
-
The mixed volume.
◆
VolumeToMesh()
Extracts a polygon object iso surface from a volume. This is done by a marching cube algorithm.
-
参数
-
[in]
|
volume
|
The volume to extract a surface from.
|
[in]
|
iso
|
The iso value at which a surface should be extracted.
|
[in]
|
adaptiveValue
|
An adaptive value between 0.0 and 1.0 that reduces the polygon count based on curvature.
|
-
返回
-
The extracted polygon object.
◆
MeshToVolume()
Converts a polygon object to a SDF volume.
-
参数
-
[in]
|
vertices
|
The vertex positions of the polygon object.
|
[in]
|
polygons
|
The polygon information. This needs to be a list of ::VolumeConversionPolygon
|
[in]
|
polygonObjectMatrix
|
The global position, scale and rotation matrix of the polygon object.
|
[in]
|
gridSize
|
The desired gridsize of the created volume.
|
[in]
|
bandWidthInterior
|
The amount of exterior voxels that distance information is calculated for.
|
[in]
|
bandWidthExterior
|
The amount of interior voxels that distance information is calculated for.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
[in]
|
conversionSettings
|
Optional settings for the conversion to Volume
POLYGONCONVERSIONFLAGS
.
|
[in]
|
creationTransform
|
An optional override to the target grid matrix. If this is used the
gridSize
is ignored.
|
-
返回
-
The converted SDF volume representing the input polygon object.
◆
PointsToVolume()
Converts points in space to a SDF volume. This can be used to convert particles, vertices, spline sampling points or other points to a volume.
// maxon scope is assumed
// the polygon object to convert its vertices from
PolygonObject
* somePolyObject = ...;
auto
addVertices = [&](
void
* object, PointsToVolumeListRef& pointsList) -> Result<void>
{
iferr_scope
;
if
(!
object
)
return
IllegalArgumentError(CREATE);
PolygonObject
* polyObj = (
PolygonObject
*)
object
;
const
向量
* points = polyObj->
GetPointR
();
矩阵
objectPosition = polyObj->
GetMg
();
for
(
Int32
pointIndex = 0; pointIndex < pointCount; pointIndex++)
{
// add the points to the particlelist, the radius is captured by reference
pointsList.AppendPoint(objectPosition * points[pointIndex], radius)
iferr_return
;
}
return
OK
;
};
// create a delegate/object pair
DelegatePointObjectsPair
polySampling;
// set the delegate to the pair
polySampling.first = addVertices;
// add the one polygon object to the list of converted objects. This can be multiple objects processed by the delegate
polySampling.second.Resize(1)
iferr_return
;
polySampling.second[0] = polygonObject;
// add the pair to the list for the conversion
DelegatePointObjectsPairList
pointObjects;
pointObjects.Append(polySampling)
iferr_return
;
// call the conversion
Volume newVolume =
VolumeToolsInterface::PointsToVolume
(pointObjects, gridSize, bandWidth, thread, gridMatrix)
iferr_return
;
}
-
参数
-
[in]
|
pointObjects
|
A list of Delegate/Object pairs that specify how to get point positions from the object.
|
[in]
|
gridSize
|
The desired gridsize of the created volume.
|
[in]
|
bandWidth
|
The amount of voxels around the creates spheres that distance information is calculated for.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
[in]
|
creationTransform
|
An optional override to the target grid matrix. If this is used the
gridSize
is ignored.
|
[in]
|
velocityScale
|
A velocity scale that the volumes will be extended to if they have a direction set.
|
-
返回
-
The converted SDF volume representing the input polygon object.
◆
ApplySDFFilterToVolume()
Applies a filter operation to a SDF volume. This work only on SDF volumes.
-
参数
-
[in]
|
volume
|
The volume that should be filtered.
|
[in]
|
filterType
|
Settings for the filter operation. See ::SDFFilterSettings.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
[in]
|
maskVolume
|
An optional volume object to be used as mask.
|
[in]
|
maskField
|
An optional field data struct to be used as field mask.
|
-
返回
-
A new filtered version of the input volume.
◆
ApplyFilterToVolume()
Applies a filter operation to a volume.
-
参数
-
[in]
|
volume
|
The volume that should be filtered.
|
[in]
|
filterType
|
Settings for the filter operation. See ::FilterSettings.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
[in]
|
maskVolume
|
An optional volume object to be used as mask.
|
[in]
|
maskField
|
An optional field data struct to be used as field mask.
|
-
返回
-
A new filtered version of the input volume.
◆
ConvertFieldsToVolume()
Convert a field list or a field object into a volume. This can either be done in a box that samples the grid fully or with a volume reference. In case of a volume the active voxels of the volume will be sampled and the result will have the same structure as the reference volume. Note that
FieldSampleData
can have information for a field list or a field object. If
FieldSampleData
's
fieldOwner
is a field object,
fieldList
can be nullptr.
-
参数
-
[in]
|
fieldData
|
A data struct about the fieldlist data.
|
[in]
|
gridSize
|
The voxel size of the resulting volume.
|
[in]
|
sampleBox
|
A bounding box.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
[in]
|
volumeReference
|
An optional volume object that will define the sampling positions by it's active voxels. If this is used the
voxelSize
and
sampleBox
被忽略。
|
[in]
|
creationTransform
|
An optional override to the target grid matrix. If this is used the
gridSize
is ignored.
|
-
返回
-
A volume that contains the values of the field in the active voxels.
◆
ConvertSDFToFog()
Convert a SDF Volume to a fog volume. The interiour of the SDF object will be filled with data ranging from 0.0 to 1.0 with a falloff.
-
参数
-
[in]
|
volume
|
The SDF volume that should be converted.
|
[in]
|
cutoff
|
The distance for the falloff from 0.0 (SDF 0.0 value) to 1.0.
|
-
返回
-
A fog volume.
◆
ConvertFogToSDF()
Convert a fog Volume to a SDF volume. The resulting surface of the SDF volume is defined by the passed iso value.
-
参数
-
[in]
|
volume
|
The fog volume that should be converted.
|
[in]
|
iso
|
The iso value at which the surface should be created.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
-
返回
-
A SDF volume.
◆
ResampleVolume()
Resample a volume into a new transformation matrix.
-
参数
-
[in]
|
volume
|
The volume that should be resampled.
|
[in]
|
resampleTransform
|
The transformation matrix in which the volume should be resampled into.
|
[in]
|
interpolationType
|
The resample interpolation type. See
RESAMPLEINTERPOLATIONTYPE
.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
-
返回
-
The created resampled volume.
◆
CreateMaskFromField()
Creates a volume mask for a volume reference with values sampled from a field.
-
参数
-
[in]
|
fieldData
|
A data struct about the fieldlist data.
|
[in]
|
volumeReference
|
The reference volume that samples the field into the mask.
|
[in]
|
background
|
The background of the mask. This will become the maskvalue in areas that have no active voxel in the
volumeReference
.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
-
返回
-
The created mask volume.
◆
CreateNewFloat32Volume()
Creates a new float volume with default transform. The gridtype will be
GRIDCLASS::UNKNOWN
.
-
参数
-
[in]
|
background
|
The background value for the volume.
|
-
返回
-
The newly created volume.
◆
CreateGradientVolume()
Creates a gradient volume from a numeric volume.
-
参数
-
[in]
|
volume
|
The numeric volume.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
-
返回
-
The newly created gradient volume.
◆
CreateSphereVolume()
Creates a SDF volume of a spherical shape.
-
参数
-
[in]
|
radius
|
The radius of the created sphere.
|
[in]
|
position
|
The position of the sphere.
|
[in]
|
gridSize
|
The desired gridsize of the created volume.
|
[in]
|
bandWidth
|
The amount of interior and exterior voxels that distance information is calculated for. Should be greater than 1.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
[in]
|
creationTransform
|
An optional override to the target grid matrix. If this is used the
gridSize
is ignored.
|
-
返回
-
The created SDF volume representing the input sphere settings.
◆
CreatePlatonicVolume()
Creates a SDF volume of a platonic shape. If invalid Arguments are set the function returns an empty volume
-
参数
-
[in]
|
sides
|
The number of sides of the platonic. Define the valid Arguments in the description of the parameter
|
[in]
|
size
|
The size of the created platonic.
|
[in]
|
position
|
The position of the platonic.
|
[in]
|
gridSize
|
The desired gridsize of the created volume.
|
[in]
|
bandWidth
|
The amount of interior and exterior voxels that distance information is calculated for. Should be greater than 1.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
[in]
|
creationTransform
|
An optional override to the target grid matrix. If this is used the
gridSize
is ignored.
|
-
返回
-
The created SDF volume representing the input platonic settings.
◆
CreateNewVector32Volume()
Creates a new float vector volume with default transform. The gridtype will be
GRIDCLASS::UNKNOWN
.
-
参数
-
[in]
|
background
|
The background vector value for the volume.
|
-
返回
-
The newly created volume.
◆
MixVectorVolumes()
Mix two vector volumes into one with a given mix type of
MIXVECTORTYPE
.
-
参数
-
[in]
|
volumeOne
|
The first vector volume for the mix operation.
|
[in]
|
volumeTwo
|
The second vector volume for the mix operation.
|
[in]
|
type
|
The mix type
MIXVECTORTYPE
.
|
-
返回
-
The mixed vector volume.
◆
ConvertFieldsToVectorVolume()
Convert a field lists directional channel or a field object into a vector volume. This can either be done in a box that samples the grid fully or with a volume reference. In case of a volume the active voxels of the volume will be sampled and the result will have the same structure as the reference volume. Note that
FieldSampleData
can have information for a field list or a field object. If
FieldSampleData
's
fieldOwner
is a field object,
fieldList
can be nullptr.
-
参数
-
[in]
|
fieldData
|
A data struct about the fieldlist data.
|
[in]
|
gridSize
|
The voxel size of the resulting volume.
|
[in]
|
sampleBox
|
A bounding box.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
[in]
|
volumeReference
|
An optional volume object that will define the sampling positions by it's active voxels. If this is used the
voxelSize
and
sampleBox
被忽略。
|
[in]
|
creationTransform
|
An optional override to the target grid matrix. If this is used the
gridSize
is ignored.
|
-
返回
-
A vector volume that contains the directions of the field in the active voxels.
◆
NormalizeVectorVolume()
Creates a normalized vector volume from an input vector volume.
-
参数
-
[in]
|
volume
|
The vector volume that should be normalized.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
-
返回
-
The newly created normalized vector volume.
◆
CreateCurlVolume()
Creates a vector volume representing the curl of a vector volume.
-
参数
-
[in]
|
volume
|
The vector volume the curl should be calculated from.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
-
返回
-
The newly created curl vector volume.
◆
CreateMeanCurvatureVolume()
Creates a curvature volume from a numeric volume.
-
参数
-
[in]
|
volume
|
The numeric volume.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
-
返回
-
The newly created curvature volume.
◆
RotateVectorVolume()
Rotate the vectors of a vector volume by a specified angle around a rotation axis.
-
参数
-
[in]
|
volume
|
The vector volume to rotate.
|
[in]
|
rotationAxis
|
The rotation axis to rotate around.
|
[in]
|
angle
|
The angle in radians to rotate.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
[in]
|
maskField
|
An optional field data struct to be used as field mask.
|
-
返回
-
The newly created curvature volume.
◆
ConvertVectorToFog()
Convert a vector volume to a fog volume. The resulting volume will have the length of the vectors stored at the original voxel position.
-
参数
-
[in]
|
volume
|
The fog volume that should be converted.
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
-
返回
-
A fog volume with the length of the vectors stored.
◆
BlendVolumes()
Does a linear blend operation of two volume grids. Both grids need to have the same type and this type needs to be blendable.
-
参数
-
[in]
|
volumeA
|
The first volume of the blend operation.
|
[in]
|
volumeB
|
The second volume of the blend operation.
|
[in]
|
blendValue
|
The linear blend value between A and B. 1.0 results in A, 0.0 in B
|
[in]
|
thread
|
A thread reference that cancellation is tested against.
|
-
返回
-
A Volume that is the blend between Volume A and Volume B.
Matrix GetMg() const
定义:
c4d_baseobject.h:482
return OK
定义:
apibase.h:2532
Pair< Delegate< Result< void >(void *, PointsToVolumeListRef &)>, BaseArray< void * > > DelegatePointObjectsPair
定义:
volumetools.h:149
#define iferr_return
定义:
resultbase.h:1434
BaseArray< DelegatePointObjectsPair > DelegatePointObjectsPairList
定义:
volumetools.h:150
#define iferr_scope
定义:
resultbase.h:1343
maxon::Int32 Int32
定义:
ge_sys_math.h:58
定义:
c4d_baseobject.h:1597
const Vector * GetPointR(void) const
定义:
c4d_baseobject.h:1425