FieldOutputBlockTemplate< CONSTBLOCK > Struct Template Reference

#include <c4d_fielddata.h>

Detailed Description

template<Bool CONSTBLOCK>
struct FieldOutputBlockTemplate< CONSTBLOCK >

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

maxon::Result< FieldOutputBlockTemplateGetSubBlock (Int offset, Int blockSize=FIELD_EXECUTION_BLOCK_SIZE)
 
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 FieldOutputBlockTemplate &src)
 
maxon::Result< void > CopyArrayContentFrom (const typename std::conditional< CONSTBLOCK, maxon::DummyParamType, ConstFieldOutputBlock >::type &src)
 
void ClearMemory (Bool deactivatedOnly=true, Bool deactivatedState=false)
 
void ClearMemory (Int startIdx, Int count, Bool deactivatedOnly, Bool deactivatedState)
 
void ClearDeactivated (Bool state=false)
 
UInt32 CalculateCrc () const
 
Bool IsValid () const
 
Bool IsPopulated () const
 
 operator const typename std::conditional< CONSTBLOCK, maxon::DeleteReturnType01, ConstFieldOutputBlock >::type & () const
 

Public Attributes

maxon::Block< BFloat_value
 
maxon::Block< BFloat_alpha
 
maxon::Block< BVector_color
 
maxon::Block< BVector_direction
 
maxon::Block< BVector_rotation
 
maxon::Block< BVector_pivot
 
maxon::Block< BBool_deactivated
 

Private Types

using BFloat = typename maxon::ConstIf< Float, CONSTBLOCK >::type
 
using BVector = typename maxon::ConstIf< Vector, CONSTBLOCK >::type
 
using BBool = typename maxon::ConstIf< Bool, CONSTBLOCK >::type
 

Private Attributes

Int _count
 
Int _offset
 
const FieldOutput_owner
 

Friends

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

Member Typedef Documentation

◆ BFloat

using BFloat = typename maxon::ConstIf<Float, CONSTBLOCK>::type
private

◆ BVector

using BVector = typename maxon::ConstIf<Vector, CONSTBLOCK>::type
private

◆ BBool

using BBool = typename maxon::ConstIf<Bool, CONSTBLOCK>::type
private

Member Function Documentation

◆ GetSubBlock()

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

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 ( ) 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 ( ) 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 FieldOutputBlockTemplate< CONSTBLOCK > &  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 typename std::conditional< CONSTBLOCK, maxon::DummyParamType, ConstFieldOutputBlock >::type 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()

UInt32 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.

◆ operator const typename std::conditional< CONSTBLOCK, maxon::DeleteReturnType01, ConstFieldOutputBlock >::type &()

operator const typename std::conditional< CONSTBLOCK, maxon::DeleteReturnType01, ConstFieldOutputBlock >::type & ( ) const

Friends And Related Function Documentation

◆ FieldOutput::GetBlock [1/2]

◆ FieldOutput::GetBlock [2/2]

◆ FieldOutput::GetSubBlock [1/2]

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

◆ FieldOutput::GetSubBlock [2/2]

maxon::Result<ConstFieldOutputBlock> 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<BVector> _direction

The color at this point in space.

◆ _rotation

maxon::Block<BVector> _rotation

The slope at this point in space.

◆ _pivot

The rotational velocity (axle + magnitude)

◆ _deactivated

maxon::Block<BBool> _deactivated

The rotational pivot point in space.

◆ _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).