BaseChannel Class Reference

#include <c4d_basechannel.h>

Inheritance diagram for BaseChannel:

Detailed Description

Represents a channel in a material. Call BaseMaterial::GetChannel() to retrieve an instance.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Private Member Functions

 BaseChannel ()
 
 ~BaseChannel ()
 

Alloc/Free

static BaseChannelAlloc ()
 
static void Free (BaseChannel *&bc)
 

Init/Free Texture

INITRENDERRESULT InitTexture (const InitRenderStruct &irs)
 
void FreeTexture ()
 

Get/Set Data

BaseContainer GetData ()
 
void SetData (const BaseContainer &ct)
 

Shader/Bitmap Access

Int32 GetShaderID ()
 
BaseShaderGetShader ()
 
BaseBitmapGetBitmap ()
 

Sampling

Vector Sample (VolumeData *vd, Vector *p, Vector *delta, Vector *n, Float t, Int32 tflag, Float off, Float scale)
 

Miscellaneous

Bool Compare (BaseChannel *dst)
 
Bool Attach (GeListNode *element)
 

Additional Inherited Members

- Public Member Functions inherited from C4DAtom
Int32 GetType () const
 
Int32 GetRealType () const
 
Int32 GetDiskType () const
 
Bool IsInstanceOf (Int32 id) const
 
Int32 GetClassification () const
 
Bool Message (Int32 type, void *data=nullptr)
 
Bool MultiMessage (MULTIMSG_ROUTE flags, Int32 type, void *data)
 
C4DAtomGetClone (COPYFLAGS flags, AliasTrans *trn)
 
Bool CopyTo (C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn)
 
Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Bool Write (HyperFile *hf)
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf)
 
Bool GetDescription (Description *description, DESCFLAGS_DESC flags)
 
Bool GetParameter (const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
 
Bool SetParameter (const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
 
DynamicDescriptionGetDynamicDescription ()
 
Bool GetEnabling (const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
 
Bool TranslateDescID (const DescID &id, DescID &res_id, C4DAtom *&res_at)
 
UInt32 GetDirty (DIRTYFLAGS flags) const
 
void SetDirty (DIRTYFLAGS flags)
 
UInt32 GetHDirty (HDIRTYFLAGS mask) const
 
void SetHDirty (HDIRTYFLAGS mask)
 

Constructor & Destructor Documentation

◆ BaseChannel()

BaseChannel ( )
private

◆ ~BaseChannel()

~BaseChannel ( )
private

Member Function Documentation

◆ Alloc()

static BaseChannel* Alloc ( )
static

Allocates a channel. Destroy the allocated channel with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated channel, or nullptr if the allocation failed.

◆ Free()

static void Free ( BaseChannel *&  bc)
static

Destructs channels allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in]bcThe channel to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ InitTexture()

INITRENDERRESULT InitTexture ( const InitRenderStruct irs)

Initializes the channel texture, loading any files required.

Note
InitTexture() can only be called once before releasing it with FreeTexture(), this includes using it from multiple threads.
Parameters
[in]irsA structure with information about the upcoming rendering.
Returns
The result of the initialization: INITRENDERRESULT

◆ FreeTexture()

void FreeTexture ( )

Frees all resources used by this channel.

Note
The texture itself might still be in memory, only the lock to the texture or the data required by a shader is freed. The texture will only be flushed if no other channel holds a lock.
The texture may also be flushed at certain times such as a call to FlushUnusedTextures(), after starting the renderer, when opening a new document or during low memory conditions.

◆ GetData()

BaseContainer GetData ( )

Gets the settings container for the channel with these IDs: BASECHANNEL

Returns
The container with the settings for this channel.

◆ SetData()

void SetData ( const BaseContainer ct)

Sets the settings for this channel.

Note
The container is always merged.
Parameters
[in]ctThe settings container for the channel with these IDs: BASECHANNEL

◆ GetShaderID()

Int32 GetShaderID ( )

Gets the ID of the shader.

Returns
The shader ID, or nullptr if it is a texture.

◆ GetShader()

BaseShader* GetShader ( )

Retrieves the shader of a channel.

Returns
The shader, or nullptr if the channel does not contain a shader. The channel owns the pointed shader.

◆ GetBitmap()

BaseBitmap* GetBitmap ( )

Retrieves the bitmap of a texture image.

Note
This method has to be called within a pair of /@ref FreeTexture() calls.
Returns
The bitmap, or nullptr if no bitmap is used. The channel owns the pointed bitmap.

◆ Sample()

Vector Sample ( VolumeData vd,
Vector p,
Vector delta,
Vector n,
Float  t,
Int32  tflag,
Float  off,
Float  scale 
)

Retrieves the color vector for a position in the texture.

Note
This method has to be called within a pair of /@ref FreeTexture() calls.
Parameters
[in]vdA pointer to the structure containing information for volumetric shaders. This can be nullptr for evaluation of a preview image. The caller owns the pointed VolumeData.
[in]pThe UVW coordinate to sample the color value for in world coordinates. The caller owns the pointed Vector.
[in]deltaThe MIP sample radius in UVW coordinates. The caller owns the pointed Vector.
[in]nThe surface normal at the UVW coordinate for the sample. The caller owns the pointed Vector.
[in]tThe current time in seconds.
[in]tflagThe texture flags: TEX
[in]offThe MIP blur offset.
[in]scaleThe MIP blur scale.
Returns
The color at the given point.

◆ Compare()

Bool Compare ( BaseChannel dst)

Checks if *this is similar to *dst. For plugin shaders this means an automatic comparison of container values.

Parameters
[in]dstThe channel to compare with. The caller owns the pointed channel.
Returns
true if the channels have the same settings, otherwise false.

◆ Attach()

Bool Attach ( GeListNode element)

Private.