FieldObject Manual

内容表

关于

A FieldObject represents a field in the Cinema 4D scene. Such a field can be sampled in 3D space to obtain values and colors. Field objects are typically used with MoGraph effectors.

A FieldObject is an instance of Ofield .

FieldObject

A new FieldObjects is created with the usual tools:

// This example creates a new "Random" field object.

// allocate random field object FieldObject * const fieldObject = FieldObject::Alloc ( Frandom ); if (fieldObject == nullptr ) return maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION );

// insert into the document doc-> InsertObject (fieldObject, nullptr , nullptr );

Sampling Fields

A FieldObject can be sampled using FieldObject::Sample() . How the field is sampled is defined using the classes FieldInfo , FieldShared , FieldInput and FieldOutput .

// This example samples the given FieldObject.

// prepare arrays for sample points maxon::BaseArray<maxon::Vector> positions; positions. Resize (sampleCnt) iferr_return ;

maxon::BaseArray<maxon::Vector> uvws; uvws. Resize (sampleCnt) iferr_return ; maxon::BaseArray<maxon::Vector> directions; directions. Resize (sampleCnt) iferr_return ;

// set positions Float64 xOffset = 0.0; for ( maxon::Vector & pos : positions) { pos. x = xOffset; xOffset += stepSize; }

// prepare results FieldOutput results; results. Resize (sampleCnt, FIELDSAMPLE_FLAG::VALUE ) iferr_return ; FieldOutputBlock block = results. GetBlock ();

// define points to sample FieldInput points(positions.GetFirst(), directions. GetFirst (), uvws. GetFirst (), sampleCnt, 矩阵 ());

// context const FieldInfo info = FieldInfo::Create (caller, points, FIELDSAMPLE_FLAG::VALUE ) iferr_return ;

// shared data FieldShared shared;

// sample the object fieldObject-> InitSampling (info, shared) iferr_return ; fieldObject-> Sample (points, block, info) iferr_return ; fieldObject-> FreeSampling (info, shared);

FieldInfo

A FieldInfo object provides information on the context of the sampling operation.

A FieldInfo object is created with:

Members:

Flags FIELDSAMPLE_FLAG :

FieldShared

FieldShared is the object reponsible to share data between fields.

The public members are:

FieldInput

A FieldInput object defines points in space that should be sampled. Optionally further data like directions or UV-coordinates can be added.

The public members are:

FieldOutput

A FieldOutput object stores the data generated by the sampling process.

A FieldOutput can be created with:

These functions are provided:

The public members are:

FieldCallerStack

The FieldCallerStack defines the list of BaseList2D objects calling the sampling function. If no object is calling the sampling function, an unique ID (UInt) must be provided.

The stack data is accessed with:

Public members are:

延伸阅读

FieldObject
定义: c4d_fielddata.h:1086
FieldObject::InitSampling
maxon::Result< void > InitSampling(const FieldInfo &info, FieldShared &shared)
定义: c4d_fielddata.h:1121
BaseDocument::InsertObject
void InsertObject(BaseObject *op, BaseObject *parent, BaseObject *pred, Bool checknames=false)
maxon::Mat3< maxon::Vector64 >
FieldObject::Alloc
static FieldObject * Alloc(Int32 type)
定义: c4d_fielddata.h:1099
FieldOutputBlock
定义: c4d_fielddata.h:342
FieldInfo::Create
static maxon::Result< FieldInfo > Create(BaseList2D *caller, FIELDSAMPLE_FLAG callingFlags=FIELDSAMPLE_FLAG::VALUE)
maxon::BaseArray::Resize
ResultMem Resize(Int newCnt, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::DEFAULT)
定义: basearray.h:1077
maxon::BaseArray::GetFirst
const MAXON_ATTRIBUTE_FORCE_INLINE T * GetFirst() const
定义: basearray.h:1034
iferr_return
#define iferr_return
定义: resultbase.h:1434
MAXON_SOURCE_LOCATION
#define MAXON_SOURCE_LOCATION
定义: memoryallocationbase.h:66
maxon::BaseArray
定义: basearray.h:366
FieldInfo
Thread local information for this field sample invocation.
定义: c4d_fielddata.h:904
FIELDSAMPLE_FLAG::VALUE
@ VALUE
Sample only the value at the current point (minimum must still sample the value)
FieldOutput::Resize
maxon::Result< void > Resize(Int newSize, FIELDSAMPLE_FLAG sampleFlags=FIELDSAMPLE_FLAG::ALL, maxon::COLLECTION_RESIZE_FLAGS resizeFlags=maxon::COLLECTION_RESIZE_FLAGS::DEFAULT)
maxon::Vec3< Float, 1 >
maxon::Vec3::x
T x
定义: vec.h:32
FieldShared
定义: c4d_fielddata.h:478
FieldOutput
定义: c4d_fielddata.h:119
FieldOutput::GetBlock
FieldOutputBlock GetBlock() const
FieldInput
定义: c4d_fielddata.h:537
FieldObject::Sample
maxon::Result< void > Sample(const FieldInput &inputs, FieldOutputBlock &outputs, const FieldInfo &info, const FIELDOBJECTSAMPLE_FLAG &objectSampleFlags=FIELDOBJECTSAMPLE_FLAG::NONE) const
定义: c4d_fielddata.h:1141
Frandom
static const Int32 Frandom
Random/noise field.
定义: c4d_fielddata.h:58
Float64
maxon::Float64 Float64
定义: ge_sys_math.h:65
FieldObject::FreeSampling
void FreeSampling(const FieldInfo &info, FieldShared &shared)
定义: c4d_fielddata.h:1129

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1