Rendering Settings Layer

Rendering Settings

Class

inc/real/layer/r3lislay.h

Description

Rendering settings layer manages rendering settings objects. Rendering setting objects define properties which are not part of the actual scene to be rendered but which are needed to control the process of generating photo realistic image from the scene. Properties include options for controlling shadow generation, rendering quality, number of reflections to be traced and so on.

Examples:

To fetch the rendering settings sub layer from the current project and to enumerate all rendering settings objects in it:

    R3OBJ *unitcv;

    R3GetAttrs(currentlayer, R3T(R3LAYLA_RenderSpecs, &rspeclayer), R3TAG_END);

    int print_rspecs(R3OBJ *obj, void *hookdata) {
        char *name;
        R3GetAttrs(obj, R3RA_Name, &name, R3TAG_END);
        printf("found rendering setting object %s\n", name);
    }

    R3Do(rspec, R3OLAYM_ENUMOBJECTS,
         R3T(R3RA_Hook, print_rspecs),
         R3T(R3RA_HookName, NULL),
         R3TAG_END);

To find out the number of rendering settings objects, call:

    int count = 0;
    R3OBJ *rspec;
    
    int count_rspecs(R3OBJ *rspec, int *count) {
        (*count)++;
        return TRUE;
    }

    R3GetAttrs(layer_list, 
               R3T(R3LAYLA_RenderSpecs, &rspec),
               R3TAG_END);
    
    R3DoA(rspec, R3OLAYM_LOCKSHARED, NULL);
    R3Do(rspec, R3OLAYM_ENUMOBJECTS,
         R3T(R3RA_Hook, count_rspec),
         R3T(R3RA_HookData, &count),
         R3TAG_END);
    R3DoA(rspec, R3OLAYM_RELEASE, NULL);

    R3Info("Number of rendering settings: %d", count);

Or, to print out the name of the currently selected rendering setting call:

    int print_rspec(R3OBJ *rspec, void *unused) {
        char *name;
        R3GetAttrs(rspec, R3T(R3RA_Name, &name), R3TAG_END);
        R3Info("Rendering setting object %s", name);
        return TRUE;
    }

    R3DoA(rspec, R3OLAYM_LOCKSHARED, NULL);
    R3Do(rspec, R3OLAYM_ENUMSELECTLIST,
         R3T(R3RA_Hook, print_rspec),
         R3TAG_END);
    R3DoA(rspec, R3OLAYM_RELEASE, NULL);

You can also create new rendering settings by calling:

    R3DoA(rspec, R3OLAYM_LOCKEXCLUSIVE, NULL);
    obj = R3DoA(rspec, R3OLAYM_NEWOBJECT, NULL);

    // set some attributes
    R3SetAttrs(obj,
               R3T(R3SPCA_AntialiasingLevel, 3),
               R3T(R3SPCA_StepX, 2),
               R3T(R3SPCA_StepY, 2),
               R3TAG_END);
    R3DoA(rspec, R3OLAYM_RELEASE, NULL);

To delete the selected rendering settings object, call:

    R3DoA(rspec, R3OLAYM_LOCKEXCLUSIVE, NULL);
    R3DoA(rspec, R3OLAYM_DELETESELECTION, NULL);
    R3DoA(rspec, R3OLAYM_RELEASE, NULL);

To apply a method to the selected objects, call:

    R3DoA(rspec, R3OLAYM_LOCKEXCLUSIVE, NULL);
    R3Do(rspec, R3OLAYM_PERFORMONSELECTED,
         R3T(R3OLAYA_PMethod, method),
         R3T(R3OLAYA_PMsg, p1),
         R3T(R3OLAYA_PMsg2, p2),
         R3T(R3OLAYA_PMsg3, p3),
         R3TAG_END);
    R3DoA(rspec, R3OLAYM_RELEASE, NULL);

[Note] Note

Many objects, such as grids, post effects and materials, just to name a few, are managed in r3lislay.h type of layers, so the above examples apply to all of them.