FieldOutputBlock Struct Reference

#include <c4d_fielddata.h>

Detailed Description

FieldOutput sub block class. FieldOutputBlock never own the memory of the sampling arrays, it is owned by the FieldOutput structure. Lifetime of a block is the same as its owner. Resizing, resetting the owner, or any other operation that will have the owner reallocate or deallocate memory will invalidate the blocks.

Public Member Functions

 FieldOutputBlock ()=default
 
 FieldOutputBlock (FieldOutputBlock &&moveRef)=default
 
 MAXON_OPERATOR_MOVE_ASSIGNMENT (FieldOutputBlock)
 
maxon::Result< FieldOutputBlockGetSubBlock (Int offset, Int blockSize=FIELD_EXECUTION_BLOCK_SIZE) const
 
void Reset ()
 
MAXON_ATTRIBUTE_FORCE_INLINE Int GetCount () const
 
Int GetFullCount () const
 
MAXON_ATTRIBUTE_FORCE_INLINE Int GetOffset () const
 
MAXON_ATTRIBUTE_FORCE_INLINE const FieldOutputGetOwner () const
 
void CopyFrom (const FieldOutputBlock &src)
 
maxon::Result< void > CopyArrayContentFrom (const FieldOutputBlock &src)
 
void ClearMemory (Bool deactivatedOnly=true, Bool deactivatedState=false)
 
void ClearMemory (Int startIdx, Int count, Bool deactivatedOnly, Bool deactivatedState)
 
void ClearDeactivated (Bool state=false)
 
maxon::Crc32C CalculateCrc () const
 
Bool IsValid () const
 
Bool IsPopulated () const
 

Public Attributes

maxon::Block< Float_value
 
maxon::Block< Float_alpha
 
maxon::Block< Vector_color
 
maxon::Block< Vector_direction
 
maxon::Block< Vector_rotation
 
maxon::Block< Bool_deactivated
 

Private Member Functions

 MAXON_DISALLOW_COPY_AND_ASSIGN (FieldOutputBlock)
 

Private Attributes

Int _count
 
Int _offset
 
const FieldOutput_owner
 

Friends

FieldOutputBlock FieldOutput::GetBlock () const
 
maxon::Result< FieldOutputBlockFieldOutput::GetSubBlock (Int offset, Int blockSize) const
 

Constructor & Destructor Documentation

◆ FieldOutputBlock() [1/2]

FieldOutputBlock ( )
default

Creates and empty sampling block, with not data.

◆ FieldOutputBlock() [2/2]

FieldOutputBlock ( FieldOutputBlock &&  moveRef)
default

Move construction. Does not actually steal anything as FieldOutputBlock never owns the memory.

Parameters
[in]moveRefThe source sample.

Member Function Documentation

◆ MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( FieldOutputBlock  )

◆ GetSubBlock()

maxon::Result<FieldOutputBlock> GetSubBlock ( Int  offset,
Int  blockSize = FIELD_EXECUTION_BLOCK_SIZE 
) const

Gets a sub-section of "this" which can be indexed from 0 to "blockSize".

Parameters
[in]offsetThe offset index to retrieve a sub-block starting at.
[in]blockSizeSuggested size of the block, will be clamped against the maximum number of entries.
Returns
The sub block.

◆ Reset()

void Reset ( )

Resets the FieldOutputBlock to default state (i.e. null count, no owner, no data, empty).

◆ GetCount()

MAXON_ATTRIBUTE_FORCE_INLINE Int GetCount ( void  ) const

Gets the number of elements in the sub block.

Returns
The count.

◆ GetFullCount()

Int GetFullCount ( ) const

Gets the number of elements used in the owning FieldOutput.

Returns
The count.

◆ GetOffset()

MAXON_ATTRIBUTE_FORCE_INLINE Int GetOffset ( void  ) const

Gets the offset of the sub block in the FieldOutput.

Returns
The offset.

◆ GetOwner()

MAXON_ATTRIBUTE_FORCE_INLINE const FieldOutput* GetOwner ( ) const

Returns the owner FieldOutput.

◆ CopyFrom()

void CopyFrom ( const FieldOutputBlock src)

Copies from the FieldOutputBlock described by src. Note that FieldOutputBlock never owns the arrays, so the copy only copies the raw pointers.

Parameters
[in]srcSource for the duplication.

◆ CopyArrayContentFrom()

maxon::Result<void> CopyArrayContentFrom ( const FieldOutputBlock src)

Copies from the FieldOutput array content from src. Block size and flags will not be affected by this action. The destination allocated size must be big enough to accept the full content of the src block. Destination block will own memory if it is a normal block or not own it if it is a subblock.

Parameters
[in]srcSource for the duplication.
Returns
OK on success.

◆ ClearMemory() [1/2]

void ClearMemory ( Bool  deactivatedOnly = true,
Bool  deactivatedState = false 
)

Reset the sample's data to default values, optionally only the deactivated content too. Values are reset to 0, colors to 1.0, direction to 0, deactivated to 0.

Parameters
[in]deactivatedOnlyTrue to deactivated only.
[in]deactivatedState(Optional) The state the deactivated should be cleared to

◆ ClearMemory() [2/2]

void ClearMemory ( Int  startIdx,
Int  count,
Bool  deactivatedOnly,
Bool  deactivatedState 
)

Reset the sample's data to default values, optionally only the deactivated content too. Values are reset to 0, colors to 1.0, direction to 0, deactivated to 0.

Parameters
[in]startIdxArray clear start index.
[in]countNumber of array items to reset to default value.
[in]deactivatedOnlyTrue to deactivated only.
[in]deactivatedState(Optional) The state the deactivated should be cleared to

◆ ClearDeactivated()

void ClearDeactivated ( Bool  state = false)

Clears the deactivated array.

◆ CalculateCrc()

maxon::Crc32C CalculateCrc ( ) const

Calculates a crc on all internal data using maxon::Crc32C. Crc is not kept internally and will be calculated from scratch on each CalculateCrc call.

Returns
The crc.

◆ IsValid()

Bool IsValid ( ) const

Checks if the FieldOutputBlock allocations and sizes are valid (empty is considered valid).

◆ IsPopulated()

Bool IsPopulated ( ) const

Checks if the FieldOutputBlock is valid and non-empty.

◆ MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( FieldOutputBlock  )
private

Friends And Related Function Documentation

◆ FieldOutput::GetBlock

◆ FieldOutput::GetSubBlock

maxon::Result<FieldOutputBlock> FieldOutput::GetSubBlock ( Int  offset,
Int  blockSize 
) const
friend

Member Data Documentation

◆ _value

◆ _alpha

The weight value at this point in space.

◆ _color

The alpha value for color and direction at this point in space, only available when color or direction are allocated.

◆ _direction

maxon::Block<Vector> _direction

The color at this point in space.

◆ _rotation

maxon::Block<Vector> _rotation

The slope at this point in space.

◆ _deactivated

maxon::Block<Bool> _deactivated

The rotational velocity.

◆ _count

Int _count
private

The deactivated state for this point (i.e. cut from interior shape will be true) this skips remapping.

◆ _offset

Int _offset
private

The number of elements in the sample arrays.

◆ _owner

const FieldOutput* _owner
private

Data offset in the original arrays (owner).