FieldOutput Struct Reference

#include <c4d_fielddata.h>

详细描述

The full result from sampling a field. Struct own the sampled data if it is not a sub block of the full sample. FieldOutput used as subblock don't own the memory and don't carry a ref count on the allocated memory, hence the real block must stay valid during the use of a subblock.

公共成员函数

  FieldOutput ()=default
  FieldOutput ( FieldOutput &&moveRef)
  ~FieldOutput ()
  MAXON_OPERATOR_MOVE_ASSIGNMENT ( FieldOutput )
  operator FieldOutputBlock () const
FieldOutputBlock   GetBlock () const
maxon::Result < FieldOutputBlock GetSubBlock ( Int offset, Int blockSize= FIELD_EXECUTION_BLOCK_SIZE ) const
void  重置 ()
void  Flush ()
Int   GetCount () const
Bool   IsValid () const
Bool   IsPopulated () const
Bool   IsEqual (const FieldOutput &comp) const
maxon::Result < void >  CopyFrom (const FieldOutput &src)
maxon::Result < void >  CopyArrayContentFrom (const FieldOutput &src)
maxon::Result < void >  CopyArrayContentFrom (const FieldOutputBlock &src)
maxon::Result < void >  Resize ( Int newSize, FIELDSAMPLE_FLAG sampleFlags= FIELDSAMPLE_FLAG::ALL , maxon::COLLECTION_RESIZE_FLAGS resizeFlags= maxon::COLLECTION_RESIZE_FLAGS::DEFAULT )
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

静态公共成员函数

static maxon::Result < FieldOutput * >  Alloc ( Int size, FIELDSAMPLE_FLAG flags= FIELDSAMPLE_FLAG::ALL )
static void  Free ( FieldOutput *&p)
static maxon::Result < FieldOutput 创建 ( Int size, FIELDSAMPLE_FLAG flags= FIELDSAMPLE_FLAG::ALL )
static maxon::Result < FieldOutput 创建 ( FieldOutputBlock &src)

Public Attributes

maxon::BaseArray < Float _value
maxon::BaseArray < Float _alpha
maxon::BaseArray < 向量 _color
maxon::BaseArray < 向量 _direction
maxon::BaseArray < 向量 _rotation
maxon::BaseArray < 向量 _pivot
maxon::BaseArray < Bool _deactivated

私有成员函数

  MAXON_DISALLOW_COPY_AND_ASSIGN ( FieldOutput )

Private Attributes

Int   _count

构造函数 & 析构函数文档编制

◆  FieldOutput() [1/2]

FieldOutput ( )
default

Creates and empty sample.

◆  FieldOutput() [2/2]

FieldOutput ( FieldOutput &&  moveRef )

Move construction. Takes ownership of the sample memory.

参数
[in] moveRef The source sample.

◆  ~FieldOutput()

~ FieldOutput ( )

Frees sample memory if not a sub block.

成员函数文档编制

◆  MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( FieldOutput   )

◆  operator FieldOutputBlock()

operator FieldOutputBlock ( ) const

Casting operator, equivalent to GetBlock() .

返回
A sub block for the whole FieldOutput .

◆  GetBlock()

FieldOutputBlock GetBlock ( ) const

Gets the total arrays in a FieldOutputBlock .

返回
A sub block for the whole FieldOutput .

◆  GetSubBlock()

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

Gets a sub-section of the total arrays.

参数
[in] offset The offset index to retrieve a sub-block starting at.
[in] blockSize Suggested size of the block, will be clamped against the maximum number of entries.
返回
The sub block.

◆  Reset()

void Reset ( )

Resets the FieldOutput to an empty state. All memory will be deallocated.

◆  Flush()

void Flush ( )

Flush the FieldOutput content, keeping the arrays allocated for future resize.

◆  GetCount()

Int GetCount ( ) const

Gets the number of elements in the FieldOutput

返回
The count.

◆  IsValid()

Bool IsValid ( ) const

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

◆  IsPopulated()

Bool IsPopulated ( ) const

Checks if the FieldOutput is valid and non-empty.

◆  IsEqual()

Bool IsEqual ( const FieldOutput comp ) const

Compares the content of both FieldOutput . Count and array content must be the same.

参数
[in] comp Source for the comparison.
返回
True if equal.

◆  CopyFrom()

maxon::Result <void> CopyFrom ( const FieldOutput src )

Copies from the FieldOutput described by src. Performs a deep copy.

参数
[in] src Source for the duplication.
返回
OK on success.

◆  CopyArrayContentFrom() [1/2]

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

Copies from the FieldOutput array content from src. Size and flags will not be affected by this action. Source data content will be copied into target up to current size. If target is bigger than source, the remaining items are cleared.

参数
[in] src Source for the duplication.
返回
OK on success.

◆  CopyArrayContentFrom() [2/2]

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

Copies from the FieldOutput array content from src. Size and flags will not be affected by this action. Source data content will be copied into target up to current size. If target is bigger than source, the remaining items are cleared.

参数
[in] src Source for the duplication.
返回
OK on success.

◆  Resize()

maxon::Result <void> Resize ( Int   newSize ,
FIELDSAMPLE_FLAG   sampleFlags = FIELDSAMPLE_FLAG::ALL ,
maxon::COLLECTION_RESIZE_FLAGS   resizeFlags = maxon::COLLECTION_RESIZE_FLAGS::DEFAULT  
)

Resizes the arrays held in the FieldOutput . Unspecified channel arrays will be resized to 0 length (according to resizeFlags).

参数
[in] newSize The size that the arrays should become.
[in] sampleFlags The channels to sample.
[in] resizeFlags The flags for which channels should be resized.
返回
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.

参数
[in] deactivatedOnly True 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.

参数
[in] startIdx Array clear start index.
[in] count Number of array items to reset to default value.
[in] deactivatedOnly True 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.

返回
The crc.

◆  Alloc()

static maxon::Result < FieldOutput *> Alloc ( Int   size ,
FIELDSAMPLE_FLAG   flags = FIELDSAMPLE_FLAG::ALL  
)
static

Allocate a heap FieldOutput with all specified sampling arrays. Equivalent of calling empty constructor followed by Resize. Use FieldOutputRef to have a scoped or auto deleted FieldOutput .

参数
[in] size The size.
[in] flags The flags.
返回
A MemoryError if it fails, else a FieldOutput*.

◆  Free()

static void Free ( FieldOutput *&  p )
static

Frees the given FieldOutput and all internal allocations.

参数
[in] p The FieldOutput to free.

◆  Create() [1/2]

static maxon::Result < FieldOutput > Create ( Int   size ,
FIELDSAMPLE_FLAG   flags = FIELDSAMPLE_FLAG::ALL  
)
static

创建 FieldOutput with all specified sampling arrays. Same as Alloc, but on the stack. Equivalent of calling empty constructor followed by Resize.

参数
[in] size The size.
[in] flags The flags.
返回
The resulting FieldOutput .

◆  Create() [2/2]

static maxon::Result < FieldOutput > Create ( FieldOutputBlock src )
static

创建 FieldOutput with all specified sampling arrays. Size will be fetched from the source FieldOutput . Array content will be copied from source FieldOutput . Equivalent of calling empty constructor followed by CopyFrom.

参数
[in] src The source FieldOutput .
返回
The resulting FieldOutput .

◆  MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( FieldOutput   )
private

Member Data Documentation

◆  _value

maxon::BaseArray < Float > _value

◆  _alpha

maxon::BaseArray < Float > _alpha

The weight value at this point in space.

◆  _color

maxon::BaseArray < 向量 > _color

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

◆  _direction

maxon::BaseArray < 向量 > _direction

The color at this point in space.

◆  _rotation

maxon::BaseArray < 向量 > _rotation

The direction at this point in space.

◆  _pivot

maxon::BaseArray < 向量 > _pivot

The rotational velocity (axle + magnitude)

◆  _deactivated

maxon::BaseArray < Bool > _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.