FieldInput Struct Reference

#include <c4d_fielddata.h>

Detailed Description

The structure holding the arrays of points and optionally their directions to be sampled. Caller owns the pointed data and must ensure they are valid. FieldInput will not deallocate the data under any circumstance.

Public Member Functions

 FieldInput ()=default
 
 FieldInput (const Vector &pos, Matrix transform=Matrix())
 
 FieldInput (const Vector *pos, Int allocatedCount, Matrix transform=Matrix(), Int fullCount=0)
 
 FieldInput (const Vector &pos, const Vector &dir, Matrix transform=Matrix())
 
 FieldInput (const Vector *pos, const Vector *dir, Int allocatedCount, Matrix transform=Matrix(), Int fullCount=0)
 
 FieldInput (const Vector &pos, const Vector &dir, const Vector &uvw, Matrix transform=Matrix())
 
 FieldInput (const Vector *pos, const Vector *dir, const Vector *uvw, Int allocatedCount, Matrix transform=Matrix(), Int fullCount=0)
 
 FieldInput (const Vector *pos, const maxon::Block< const Vector > &dir, const maxon::Block< const Vector > &uvw, Int allocatedCount, Matrix transform=Matrix(), Int fullCount=0)
 
 FieldInput (const maxon::Block< const Vector > &pos, const maxon::Block< const Vector > &dir, const maxon::Block< const Vector > &uvw, Int allocatedCount, Matrix transform=Matrix(), Int fullCount=0)
 
 ~FieldInput ()=default
 
 FieldInput (const FieldInput &src)
 
 FieldInput (FieldInput &&src)
 
 MAXON_OPERATOR_MOVE_ASSIGNMENT (FieldInput)
 
 MAXON_OPERATOR_COPY_ASSIGNMENT (FieldInput)
 
void CopyFromRaw (const FieldInput &src)
 
FieldInput GetSubBlock (Int offset, Int blockSize=FIELD_EXECUTION_BLOCK_SIZE) const
 
Int GetCount () const
 
Int GetOffset () const
 
Bool IsValid () const
 
Bool IsPopulated () const
 

Public Attributes

maxon::Block< const Vector_position
 
maxon::Block< const Vector_direction
 
maxon::Block< const Vector_uvw
 
Int _blockCount
 
Int _blockOffset
 
Int _fullArraySize
 
Matrix _transform
 

Private Attributes

Int _allocatedArraySize
 

Constructor & Destructor Documentation

◆ FieldInput() [1/11]

FieldInput ( )
default

◆ FieldInput() [2/11]

FieldInput ( const Vector pos,
Matrix  transform = Matrix() 
)

Constructor with single position value

Parameters
[in]posThe position.
[in]transform(Optional) The transform matrix required to convert the position and direction inputs to global space.

◆ FieldInput() [3/11]

FieldInput ( const Vector pos,
Int  allocatedCount,
Matrix  transform = Matrix(),
Int  fullCount = 0 
)

Constructor with position data only.

Parameters
[in]posThe position array to sample.
[in]allocatedCountThe allocated length of the pos array.
[in]transformThe transform matrix required to convert the position and direction inputs to global space.
[in]fullCountThe full position count if count was to big to allocate in pos. Will be allocatedCount unless specified otherwise.

◆ FieldInput() [4/11]

FieldInput ( const Vector pos,
const Vector dir,
Matrix  transform = Matrix() 
)

Constructor with single position and direction

Parameters
[in]posThe position.
[in]dirThe direction that the sample is facing in space.
[in]transform(Optional) The transform matrix required to convert the position and direction inputs to global space.

◆ FieldInput() [5/11]

FieldInput ( const Vector pos,
const Vector dir,
Int  allocatedCount,
Matrix  transform = Matrix(),
Int  fullCount = 0 
)

Constructor with position and direction data.

Parameters
[in]posThe position array to sample.
[in]dirThe direction array to sample.
[in]allocatedCountThe allocated length of the pos and dir arrays.
[in]transformThe transform matrix required to convert the position and direction inputs to global space.
[in]fullCountThe full position count if count was to big to allocate in pos. Will be allocatedCount unless specified otherwise.

◆ FieldInput() [6/11]

FieldInput ( const Vector pos,
const Vector dir,
const Vector uvw,
Matrix  transform = Matrix() 
)

Constructor with single position, direction and UVW entry

Parameters
[in]posThe position array to sample.
[in]dirThe direction array to sample.
[in]uvwThe uvw array to sample.
[in]transformThe transform matrix required to convert the position and direction inputs to global space.

◆ FieldInput() [7/11]

FieldInput ( const Vector pos,
const Vector dir,
const Vector uvw,
Int  allocatedCount,
Matrix  transform = Matrix(),
Int  fullCount = 0 
)

Constructor with position, direction and uvw data.

Parameters
[in]posThe position array to sample.
[in]dirThe direction array to sample.
[in]uvwThe uvw array to sample.
[in]allocatedCountThe allocated length of the pos and dir arrays.
[in]transformThe transform matrix required to convert the position and direction inputs to global space.
[in]fullCount(optional) The full position count if count was to big to allocate in pos. Will be allocatedCount unless specified otherwise.

◆ FieldInput() [8/11]

FieldInput ( const Vector pos,
const maxon::Block< const Vector > &  dir,
const maxon::Block< const Vector > &  uvw,
Int  allocatedCount,
Matrix  transform = Matrix(),
Int  fullCount = 0 
)

Constructor with position, direction and uvw data.

Parameters
[in]posThe position array to sample.
[in]dirThe direction array to sample.
[in]uvwThe uvw array to sample.
[in]allocatedCountThe allocated length of the pos and dir arrays.
[in]transformThe transform matrix required to convert the position and direction inputs to global space.
[in]fullCount(optional) The full position count if count was to big to allocate in pos. Will be allocatedCount unless specified otherwise.

◆ FieldInput() [9/11]

FieldInput ( const maxon::Block< const Vector > &  pos,
const maxon::Block< const Vector > &  dir,
const maxon::Block< const Vector > &  uvw,
Int  allocatedCount,
Matrix  transform = Matrix(),
Int  fullCount = 0 
)

Constructor with position, direction and uvw data.

Parameters
[in]posThe position array to sample.
[in]dirThe direction array to sample.
[in]uvwThe uvw array to sample.
[in]allocatedCountThe allocated length of the pos and dir arrays.
[in]transformThe transform matrix required to convert the position and direction inputs to global space.
[in]fullCount(optional) The full position count if count was to big to allocate in pos. Will be allocatedCount unless specified otherwise.

◆ ~FieldInput()

~FieldInput ( )
default

Destructor. FieldInput owns no memory.

◆ FieldInput() [10/11]

FieldInput ( const FieldInput src)

Copy constructor NOTE: This performs a dumb raw copy of the FieldInput instance. I.e. internal pointers will be copied and point to the content of the original owner. Field point never owns the data, this is why a standard CopyFrom is not part of this class.

Parameters
[in]srcCopy source.

◆ FieldInput() [11/11]

FieldInput ( FieldInput &&  src)

Move constructor

Parameters
[in]srcMove source.

Member Function Documentation

◆ MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( FieldInput  )

◆ MAXON_OPERATOR_COPY_ASSIGNMENT()

MAXON_OPERATOR_COPY_ASSIGNMENT ( FieldInput  )

◆ CopyFromRaw()

void CopyFromRaw ( const FieldInput src)

Performs a raw copy of the the FieldInput described by src. Equivalent to copy construction. NOTE: this is not a CopyFrom, see copy constructor note above.

Parameters
[in]srcSource for the duplication.

◆ GetSubBlock()

FieldInput GetSubBlock ( Int  offset,
Int  blockSize = FIELD_EXECUTION_BLOCK_SIZE 
) const

Return a FieldInput struct for a subset of the original array. This can be used to pass smaller blocks to the field processing threads.

Parameters
[in]offsetThe subblock start offset in the full array (0 based).
[in]blockSizeThe size of the desired subblock.
Returns
The sub FieldInput structure. Will be empty if request is out of bounds.

◆ GetCount()

Int GetCount ( void  ) const

Gets the number of elements in the FieldInput

Returns
The count.

◆ GetOffset()

Int GetOffset ( ) const

Gets the offset of the first element in the full arrays.

Returns
The offset.

◆ IsValid()

Bool IsValid ( ) const

Checks if the FieldInput allocations and sizes are valid. Empty FieldInput is considered valid.

◆ IsPopulated()

Bool IsPopulated ( ) const

Checks if the FieldInput is valid and non-empty.

Member Data Documentation

◆ _position

maxon::Block<const Vector> _position

The position values for the array of points, if this is a sub-block then element 0 is at _blockOffset within the larger array, caller owns this array, size must match or be greater than count value @required.

◆ _direction

maxon::Block<const Vector> _direction

The (optional) direction values for the array of points, if this is a sub-block then element 0 is at _blockOffset within the larger array, caller owns this array, size must match or be greater than count value.

◆ _uvw

maxon::Block<const Vector> _uvw

The (optional) uvw values for the array of points, if this is a sub-block then element 0 is at _blockOffset within the larger array, caller owns this array, size must match or be greater than count value.

◆ _blockCount

Int _blockCount

The number of elements in the array to be processed (for this processing block, this should be treated as the count to use when iterating over elements in FieldObject and FieldLayer.

◆ _blockOffset

Int _blockOffset

The offset (starting point) of the elements if a portion of a larger array, used e.g. to get the actual index in the array actualIndex = index - points._blockOffset;.

◆ _fullArraySize

Int _fullArraySize

The full size of the source data, this may be larger than blockCount, also might be larger then the size of the allocated pointers within the FieldInput class. Do no use this size to browse the arrays!

◆ _transform

Matrix _transform

The transform matrix for the points in the input block, use this to bring the _position and _direction arrays into world space or the local space of your FieldObject.

◆ _allocatedArraySize

Int _allocatedArraySize
private

The allocated size of the vector arrays. Use this with _blockOffset to browse all the input vectors safely. Might be larger than blockCount.