Open Search
    InitRenderStruct Class 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 (const BaseDocument *t_doc, Int32 overrideViewTransform=-1)
     
    void Init (const BaseDocument *t_doc, Int32 overrideViewTransform=-1)
     
    MAXON_ATTRIBUTE_FORCE_INLINE Int32 GetC4DVersion () const
     
    MAXON_ATTRIBUTE_FORCE_INLINE Int32 GetStructureVersion () const
     
    Int32 GetThreadCount () const
     
    Vector TransformColor (const Vector &input) const
     
    maxon::Color TransformColor (const maxon::Color &input) const
     

    Public Attributes

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

    Private Attributes

    UInt32 version
     

    Static Private Attributes

    static constexpr UInt32 CURRENT_VERSION
     

    Constructor & Destructor Documentation

    ◆ InitRenderStruct() [1/2]

    Default constructor.

    ◆ InitRenderStruct() [2/2]

    InitRenderStruct ( const BaseDocument t_doc,
    Int32  overrideViewTransform = -1 
    )
    explicit

    Creates the structure accordingly to the passed document.

    Parameters
    [in]t_docThe document to initialize the structure. The caller owns the pointed document.
    [in]overrideViewTransformIndex within the viewtransform array to override the view transform. Ignored, if the value is not a valid index.

    Member Function Documentation

    ◆ Init()

    void Init ( const BaseDocument t_doc,
    Int32  overrideViewTransform = -1 
    )

    Initializes the structure accordingly to the passed document.

    Parameters
    [in]t_docThe document to initialize the structure. The caller owns the pointed document.
    [in]overrideViewTransformIndex within the viewtransform array to override the view transform. Ignored, if the value is not a valid index.

    ◆ GetC4DVersion()

    MAXON_ATTRIBUTE_FORCE_INLINE Int32 GetC4DVersion ( ) const

    Gets the current Cinema 4D version.

    Returns
    The C4D version.

    ◆ GetStructureVersion()

    MAXON_ATTRIBUTE_FORCE_INLINE Int32 GetStructureVersion ( ) const

    Gets the version of this structure.

    Returns
    The version of this structure.

    ◆ GetThreadCount()

    Int32 GetThreadCount ( ) const

    Retrieves the number of render threads.

    Returns
    The number of render threads.

    ◆ TransformColor() [1/2]

    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.

    ◆ TransformColor() [2/2]

    maxon::Color TransformColor ( const maxon::Color input) const

    Member Data Documentation

    ◆ CURRENT_VERSION

    constexpr UInt32 CURRENT_VERSION
    staticconstexprprivate

    Current version number of this structure.

    ◆ version

    UInt32 version
    private

    The version of this structure in the upper 8 bits, version of Cinema 4D in the lowes 24 bits.

    ◆ 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 : irs.vd = render->GetInitialVolumeData(0); 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

    const BaseDocument* 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.

    ◆ ocioConverter

    OcioConverterRef ocioConverter

    OCIO converter. This is always a valid pointer (see BaseDocument::GetColorConverter()).