InitRenderStruct Struct Reference

#include <c4d_shader.h>

Detailed Description

The InitRenderStruct is usually filled by Cinema 4D and then passed to the shader or channel InitRender().
However to evaluate a BaseChannel for own purposes then create an InitRenderStruct on the stack.

Public Member Functions

 InitRenderStruct ()
 
 InitRenderStruct (BaseDocument *t_doc)
 
void Init (BaseDocument *t_doc)
 
Int32 GetThreadCount () const
 
Vector TransformColor (const Vector &input) const
 

Public Attributes

Int32 version
 
BaseTime time
 
Int32 fps
 
Filename docpath
 
Stringmatname
 
RootTextureString * errorlist
 
VolumeDatavd
 
BaseDocumentdoc
 
BaseThreadthread
 
INITRENDERFLAG flags
 
Bool linear_workflow
 
Int32 document_colorprofile
 

Constructor & Destructor Documentation

§ InitRenderStruct() [1/2]

Default constructor.

§ InitRenderStruct() [2/2]

InitRenderStruct ( BaseDocument t_doc)
explicit

Creates the structure accordingly to the passed document.

Parameters
[in]t_docThe document to initialize the structure. The caller owns the pointed document.

Member Function Documentation

§ Init()

void Init ( BaseDocument t_doc)

Initializes the structure accordingly to the passed document.

Parameters
[in]t_docThe document to initialize the structure. The caller owns the pointed document.

§ GetThreadCount()

Int32 GetThreadCount ( ) const

Retrieves the number of render threads.

Returns
The number of render threads.

§ TransformColor()

Vector TransformColor ( const Vector input) const

If linear workflow is enabled the passed color is transformed into the color profile specified by document_colorprofile.

Parameters
[in]inputThe color to transform.
Returns
The transformed color.

Member Data Documentation

§ version

Int32 version

The version of Cinema 4D.

§ time

BaseTime time

The current time.

§ fps

Int32 fps

The framerate.

§ docpath

Filename docpath

The path for the document.

§ matname

String* matname

The material name.

§ errorlist

RootTextureString* errorlist

A private error list. Can be nullptr, always check.

§ vd

The volume data. Can be nullptr, always check.

Note
When initializing an InitRenderStruct, if the following line is missing, Cinema 4D assumes that there will be only one render thread.
(Without VolumeData no multi-threaded calculation can be done.). Access to VolumeData::Sample() will then crash or overwrite memory.
Here is a safe initialization of vd:
irs.vd = render->GetInitialVolumeData(0);
Warning
To accurately rebuild a host environment for shader, material or channel sampling all members that VolumeData offers need to be filled.
Any pointer that is not initialized can cause a crash. Members like BaseVolumeData::recursion_data, BaseVolumeData::multipass and BaseVolumeData::intersection can be set to nullptr.

§ doc

The document to render. Can be nullptr, always check.

§ thread

BaseThread* thread

The current thread or nullptr for the main Cinema 4D thread.

§ flags

The flags; INITRENDERFLAG.

§ linear_workflow

Bool linear_workflow

Linear workflow enabled/disabled.

§ document_colorprofile

Int32 document_colorprofile

The document color profile: DOCUMENT_COLORPROFILE.