Echo Types

The following types are defined by the echo:

typedef struct {
    miBoolean     prefer_approx_polygons; /* triangles from polygons */
    miBoolean     prefer_approx_faces;    /* triangles from surfaces */
    miBoolean     ascii_output;           /* non-binary output */
    miBoolean     verbatim_textures;      /* dump textures verbatim ? */
    miBoolean     norendercommand;        /* disable rendercmd echo? */
    miUint        explode_objects;        /* write objects to subfiles */
    miTag         leaf_insts;             /* for prefer_approx_* lookup */
    miBoolean     nolinkcommand;          /* don't echo link statements */
    miUint        dont_echo;              /* EO_* bitmap: omit these */
    miUint        dont_recurse;           /* EO_* bitmap: no prereqs */
} miEchoOptions;

prefer_approx_polygons and prefer_approx_faces specify whether the original source geometry is preferred for output. If these flags are set to miTRUE, the boxes containing triangles will be echoed. Depending on the SCENE preprocessing control structure flag delete_objects the source geometry might not be available in the scene because it is deleted to save memory. In this case the boxes triangles will be echoed instead of the source geometry if source geometry was requested. The reverse case can also happen; if ECHO is called before scene preprocessing, the tessellated geometry might not be available so the source geometry is echoed instead, regardless of the preferences set in the echo options. Echoing of non-source geometry is not recommended when displacement or geometry shaders are used in the scene since the geometry in the boxes is already modified by those shaders.

If ascii_output is set to miFALSE, the three dimensional vectors in objects are echoed in binary format. All other scalar values in the scene are echoed always in ascii format.

verbatim_textures specifies whether textures should be copied into the .mi file instead of printing a file texture definition. Verbatim textures will increase the size of .mi files. Textures which are entered verbatim into the scene database either by an .mi file or by API calls are always echoed verbatim.

norendercommand disables the output of the render command when set to miTRUE.

explode_objects3.x causes objects that have at least the specified number of vectors to be echoed to a separate file, and a placeholder object that references this file to be echoed to the main echo scene. The separate file names begin with autoload_, followed by the object name. This permits parallel parsing, but it should be used only for large objects (say, 1000 vectors) because finding and opening a file on disk incurs some overhead.

leaf_insts must be specified in order for the approx options above to work. The tag can be obtained from mi_rc_run_query. The scene must have been preprocessed for this to exist. mental ray uses the tag to find the tessellated versions of echoed objects.

nolinkcommand suppresses echoing link statements.

dont_echo suppresses echoing certain scene element types.

dont_recurse suppresses the subfields of certain scene element types. For example, this can be used to echo light instances, but not the lights being instanced because mental ray no longer descends through the light instance. Both dont_echo and dont_recurse are bitmaps, composed of the following flags:

#define miEO_INST_GROUP    0x00000001      /* instance of a group */
#define miEO_INST_OBJECT   0x00000002      /* instance of a object/box */
#define miEO_INST_CAMERA   0x00000004      /* instance of a camera */
#define miEO_INST_LIGHT    0x00000008      /* instance of a light */
#define miEO_INST_FUNCTION 0x00000010      /* instance of a geom shader */
#define miEO_GROUP         0x00000020      /* group of instances */
#define miEO_OBJECT        0x00000040      /* geometric object or box */
#define miEO_CAMERA        0x00000080      /* camera */
#define miEO_LIGHT         0x00000100      /* light source */
#define miEO_MATERIAL      0x00000200      /* material */
#define miEO_IMAGE         0x00000400      /* pixel rectangle */
#define miEO_OPTIONS       0x00000800      /* options block */
#define miEO_FUNCTION      0x00001000      /* shader (dont_echo: named) */
#define miEO_FUNCTION_DECL 0x00002000      /* shader declaration */
#define miEO_USERDATA      0x00004000      /* user data block */

To echo complete scenes, set both bitmaps to 0. If they are not 0, the resulting scene is probably not renderable directly.

Echo Function Calls

mi_echo_scene
miBoolean mi_echo_scene(
    FILE            *fp,             /* file to print to */
    miTag           group_tag,       /* root group */
    miTag           camera_inst_tag, /* camera instance tag */
    miTag           options_tag,     /* rendering options tag */
    miEchoOptions   *options)        /* echo options */

This function combines several ECHO calls and can be used for echoing a complete scene. The scene is defined by the root group group_tag, a camera instance tag camera_inst_tag and the rendering options options_tag of type miOptions.

This function echoes the header, link and code statements, the rendering options, the given camera instance and camera, the scene DAG which is anchored at group_tag, and puts a render command into the .mi file which references the given parameters.

The echoing can be controlled by specifying various options in options. Note that multiple scene DAGs defined in raylib can be echoed by calling this function for each root group separately.

The scene is echoed to the file fp. This file pointer must be opened by the caller. mental ray writes the scene with standard stdio operations such as fprintf, so the caller may write a comment header first without interfering with mental ray. It is important that the file is opened in binary mode ( fopen(name, "wb")) because otherwise binary vectors in the scene, if enabled, may be corrupted by carriage returns inserted by the OS (for example on Windows platforms).

mi_geoshader_echo_tag
miBoolean mi_geoshader_echo_tag(
    FILE            *fp,
    miTag           tag,
    miEchoOptions   *options)

Print the contents of the given tag to the open file fp. In addition to the scene element, all dependent elements, such as subtags and declarations of echoed shaders, are recursively echoed. No dependent element is echoed twice. Echoing can be controlled by specifying various options in options. If options is null, default options are chosen. This function is primarily intended for debugging translators and geometry shaders.

Copyright © 1986, 2015 NVIDIA ARC GmbH. All rights reserved.