VolumeInterface Class Reference

#include <volume.h>

Inheritance diagram for VolumeInterface:

Detailed Description

VolumeInterface represents a core volume object in cinema.

Public Member Functions

MAXON_METHOD Result< void > LoadFromFile (const Url &url, Float scale, Int gridIndex)
 
MAXON_METHOD Result< void > WriteToFile (const Url &url, Float scale, const DataDictionary &metaData=DataDictionary()) const
 
MAXON_METHOD Bool HasGrid () const
 
MAXON_METHOD GRIDTYPE GetGridType () const
 
MAXON_METHOD GRIDCLASS GetGridClass () const
 
MAXON_METHOD void SetGridClass (GRIDCLASS gridClass)
 
MAXON_METHOD void SetGridTransform (Matrix newTransform)
 
MAXON_METHOD Matrix GetGridTransform () const
 
MAXON_METHOD Vector GetGridSize () const
 
MAXON_METHOD void SetGridName (String name) const
 
MAXON_METHOD String GetGridName () const
 
MAXON_METHOD const Range< Vector > & GetWorldBoundingBox () const
 
MAXON_METHOD IntVector32 GetActiveVoxelDim () const
 
MAXON_METHOD Int GetActiveVoxelCount () const
 
MAXON_METHOD Data GetBackground () const
 
MAXON_METHOD Int GetMemUsage () const
 
MAXON_METHOD Range< FloatGetMinMaxValues (Bool includeBackground=false) const
 
MAXON_METHOD Result< void > SetVecType (VECTORGRIDTYPE gridType)
 
MAXON_METHOD VECTORGRIDTYPE GetVecType () const
 
MAXON_METHOD Result< void > MergeVolume (Volume &otherVolume, Bool keepOldVolume=false)
 
MAXON_METHOD Result< void > SetMinMaxValues (const Range< Float > &minMaxRange)
 

Static Public Member Functions

static MAXON_METHOD Result< Volume > CreateFromFile (const Url &url, Float scale, Int gridIndex)
 

Private Member Functions

 MAXON_INTERFACE (VolumeInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.volume.interface.volume")
 

Private Attributes

 MAXON_INTERFACE_SINGLE_IMPLEMENTATION
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( VolumeInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE  ,
"net.maxon.volume.interface.volume"   
)
private

◆ CreateFromFile()

static MAXON_METHOD Result<Volume> CreateFromFile ( const Url url,
Float  scale,
Int  gridIndex 
)
static

Creates a new volume from a .vdb file.

Parameters
[in]urlThe url of the file.
[in]scaleThe scale to load the volume with.
[in]gridIndexThe index of the grid in the file.
Returns
The newly created Volume.

◆ LoadFromFile()

MAXON_METHOD Result<void> LoadFromFile ( const Url url,
Float  scale,
Int  gridIndex 
)

Loads a grid from .vdb file into this volume object.

Parameters
[in]urlThe url of the file.
[in]scaleThe scale to load the volume with.
[in]gridIndexThe index of the grid in the file.
Returns
OK on success.

◆ WriteToFile()

MAXON_METHOD Result<void> WriteToFile ( const Url url,
Float  scale,
const DataDictionary &  metaData = DataDictionary() 
) const

Writes the attached grid to a .vdb file.

Parameters
[in]urlThe url of the file.
[in]scaleThe scale to write the volume with.
[in]metaDataOptional meta data to write to the file. These need to be stored with a string key in the data dictionary.
Returns
OK on success.

◆ HasGrid()

MAXON_METHOD Bool HasGrid ( ) const

Retrieve if a grid is attached to this volume.

Returns
True if this volume holds a grid.

◆ GetGridType()

MAXON_METHOD GRIDTYPE GetGridType ( ) const

Retrieve the datatype of this grid.

Returns
The GRIDTYPE of this volume.

◆ GetGridClass()

MAXON_METHOD GRIDCLASS GetGridClass ( ) const

Retrieve the grid class of this grid.

Returns
The GRIDCLASS of this volume.

◆ SetGridClass()

MAXON_METHOD void SetGridClass ( GRIDCLASS  gridClass)

Set the grid class for this grid.

Parameters
[in]gridClassThe GRIDCLASS to set for this volume.

◆ SetGridTransform()

MAXON_METHOD void SetGridTransform ( Matrix  newTransform)

Set the grid transform for this grid.

Parameters
[in]newTransformThe transformation matrix to set for this volume.

◆ GetGridTransform()

MAXON_METHOD Matrix GetGridTransform ( ) const

Retrieve the grid transform for this grid.

Returns
The transformation matrix of this volume.

◆ GetGridSize()

MAXON_METHOD Vector GetGridSize ( ) const

Retrieve the grid size for this grid.

Returns
The size vector of this volume.

◆ SetGridName()

MAXON_METHOD void SetGridName ( String  name) const

Set the grid name for this grid.

Parameters
[in]nameThe name to set for this volume.

◆ GetGridName()

MAXON_METHOD String GetGridName ( ) const

Retrieve the grid name for this grid.

Returns
The name of this volume.

◆ GetWorldBoundingBox()

MAXON_METHOD const Range<Vector>& GetWorldBoundingBox ( ) const

Retrieve the bounding box of all active voxels of this grid.

Returns
The bounding box of the active voxels of this volume.

◆ GetActiveVoxelDim()

MAXON_METHOD IntVector32 GetActiveVoxelDim ( ) const

Retrieve the active voxel dimensions.

Returns
The active voxel dimensions of this volume.

◆ GetActiveVoxelCount()

MAXON_METHOD Int GetActiveVoxelCount ( ) const

Retrieve the active voxel count.

Returns
The amount of active voxels in this volume.

◆ GetBackground()

MAXON_METHOD Data GetBackground ( ) const

Retrieve the background value of the grid.

Returns
The background value of the grid.

◆ GetMemUsage()

MAXON_METHOD Int GetMemUsage ( ) const

Returns the amount of memory in bytes used by this volume.

Returns
The memory usage in bytes.

◆ GetMinMaxValues()

MAXON_METHOD Range<Float> GetMinMaxValues ( Bool  includeBackground = false) const

Returns the Min and Max values of the volume. If it is the first time being called the resulting values are being cached. Only works for numerical gridtypes. If the volume is a vector volume, the magnitude of the vectors will be used.

Parameters
[in]includeBackgroundIf true the volume background will be part of the Range, otherwise not.
Returns
The Minimum and Maximum Value of this volume.

◆ SetVecType()

MAXON_METHOD Result<void> SetVecType ( VECTORGRIDTYPE  gridType)

Set the Vector grid type to indicate how transformations should be applied.

Parameters
[in]gridTypeThe grid type to set.
Returns
OK on success.

◆ GetVecType()

MAXON_METHOD VECTORGRIDTYPE GetVecType ( ) const

Get the Vector grid type to indicate how transformations should be applied.

Returns
The set vec grid type.

◆ MergeVolume()

MAXON_METHOD Result<void> MergeVolume ( Volume &  otherVolume,
Bool  keepOldVolume = false 
)

Merges two volumes of same Type and Class.

Parameters
[in]otherVolumeThe volume to merge into the current one.
[in]keepOldVolumeIf false the otherVolume will be flushed/emptied.

◆ SetMinMaxValues()

MAXON_METHOD Result<void> SetMinMaxValues ( const Range< Float > &  minMaxRange)

Sets the Min and Max values of the volume. This will be returned when GetMinMaxValues is called instead of the underlying data. Only works for numerical gridtypes. If the volume is a vector volume, the magnitude of the vectors will be used. Be careful as settings this carelessly can break some stuff.

Parameters
[in]minMaxRangeThe range including the minimum and maximum value.

Member Data Documentation

◆ MAXON_INTERFACE_SINGLE_IMPLEMENTATION

MAXON_INTERFACE_SINGLE_IMPLEMENTATION
private