Open Search
    GridAccessorInterface< TYPE > Class Template Reference

    #include <volumeaccessors.h>

    Detailed Description

    template<typename TYPE>
    class maxon::GridAccessorInterface< TYPE >

    GridAccessorInterface allows to access volume data.

    Public Member Functions

    MAXON_METHOD Result< void > Init (const Volume &volumeObject, VOLUMESAMPLER sampler=VOLUMESAMPLER::NEAREST)
     
    MAXON_METHOD Result< void > InitWithWriteAccess (Volume &volumeObject, VOLUMESAMPLER sampler=VOLUMESAMPLER::NEAREST)
     
    MAXON_METHOD Result< void > SetSampler (VOLUMESAMPLER sampler)
     
    MAXON_METHOD TYPE GetValue (const IntVector32 &coords) const
     
    MAXON_METHOD TYPE GetValue (const Vector &position) const
     
    MAXON_METHOD Vector GetCoords (const Vector &position) const
     
    MAXON_METHOD Result< void > SetValue (const IntVector32 &coords, const TYPE val)
     
    MAXON_METHOD Result< void > SetValueOnly (const IntVector32 &coords, const TYPE val)
     
    MAXON_METHOD Result< void > SetActiveState (const IntVector32 &coords, Bool state)
     
    MAXON_METHOD Bool GetActiveState (const IntVector32 &coords) const
     

    Static Public Member Functions

    static MAXON_FUNCTION Result< GridAccessorRef< TYPE > > Create ()
     

    Private Member Functions

     MAXON_INTERFACE_SIMPLE_VIRTUAL (GridAccessorInterface, MAXON_REFERENCE_NORMAL)
     

    Member Function Documentation

    ◆ MAXON_INTERFACE_SIMPLE_VIRTUAL()

    MAXON_INTERFACE_SIMPLE_VIRTUAL ( GridAccessorInterface< TYPE >  ,
    MAXON_REFERENCE_NORMAL   
    )
    private

    ◆ Create()

    static MAXON_FUNCTION Result<GridAccessorRef<TYPE> > Create ( )
    static

    ◆ Init()

    MAXON_METHOD Result<void> Init ( const Volume &  volumeObject,
    VOLUMESAMPLER  sampler = VOLUMESAMPLER::NEAREST 
    )

    Initialize the accessor with a volume object in a read only state.

    Note
    if GetValue at a world position wants to be used a VOLUMESAMPLER needs to be passed or SetSampler needs to be called.
    Parameters
    [in]volumeObjectThe volume object to initialize this accessor for.
    [in]samplerThe used sampler for position sampling.
    Returns
    True if the accessor was initialized with a volume, false otherwise.

    ◆ InitWithWriteAccess()

    MAXON_METHOD Result<void> InitWithWriteAccess ( Volume &  volumeObject,
    VOLUMESAMPLER  sampler = VOLUMESAMPLER::NEAREST 
    )

    Initialize the accessor with a volume object with both read and write access.

    Note
    if GetValue() at a world position is needed, a VOLUMESAMPLER must be passed or SetSampler needs to be called.
    Parameters
    [in]volumeObjectThe volume object to initialize this accessor for.
    [in]samplerThe sampler to use for position sampling.
    Returns
    True if the accessor was initialized with a volume, false otherwise.

    ◆ SetSampler()

    MAXON_METHOD Result<void> SetSampler ( VOLUMESAMPLER  sampler)

    Changes the sampler Type.

    Parameters
    [in]samplerThe used sampler for position sampling.

    ◆ GetValue() [1/2]

    MAXON_METHOD TYPE GetValue ( const IntVector32 coords) const

    Retrieve the value of the volume at the given voxel index.

    Parameters
    [in]coordsThe voxel index at which the data should be retrieved.
    Returns
    The voxel value at the voxel index.

    ◆ GetValue() [2/2]

    MAXON_METHOD TYPE GetValue ( const Vector position) const

    Retrieve the value of the volume at the given world position.

    Note
    the returned value depends on the VOLUMESAMPLER that was set.
    Parameters
    [in]positionThe world position at which the data should be retrieved.
    Returns
    The voxel value at the world position.

    ◆ GetCoords()

    MAXON_METHOD Vector GetCoords ( const Vector position) const

    Retrieve the sub voxel index position of the volume at the given world position.

    Note
    this value depends on the VOLUMESAMPLER that was set.
    Parameters
    [in]positionThe world position at which the sub voxel index position should be retrieved.
    Returns
    The sub voxel index position at the passed position.

    ◆ SetValue()

    MAXON_METHOD Result<void> SetValue ( const IntVector32 coords,
    const TYPE  val 
    )

    Sets a voxel value at a voxel index.

    Note
    this will activate a voxel
    Parameters
    [in]coordsThe voxel index at which the value will be set.
    [in]valThe value to set.

    ◆ SetValueOnly()

    MAXON_METHOD Result<void> SetValueOnly ( const IntVector32 coords,
    const TYPE  val 
    )

    Sets a voxel value at a voxel index.

    Note
    same as SetValue, but this will not activate a voxel
    Parameters
    [in]coordsThe voxel index at which the value will be set.
    [in]valThe value to set.

    ◆ SetActiveState()

    MAXON_METHOD Result<void> SetActiveState ( const IntVector32 coords,
    Bool  state 
    )

    Sets the active state of a voxel at a voxel index.

    Parameters
    [in]coordsThe voxel index at which the active state will be set.
    [in]stateThe state to set, true means active, false inactive.

    ◆ GetActiveState()

    MAXON_METHOD Bool GetActiveState ( const IntVector32 coords) const

    Retrieve the active state of a voxel at a voxel index.

    Parameters
    [in]coordsThe voxel index at which the active state will be checked.
    Returns
    The active state of the voxel at that voxel index.