This section describes the high-level API which provides an easy-to-use scene definition layer for geometry shaders. The high-level API functions are mainly concerned with atomic creation of high-level elements like those found in the .mi language. Many such elements, especially geometric objects, are built from multiple scene database entries with numerous internal references. This internal complexity is hidden by the API module and expanded automatically. However, simple elements such as cameras are created by API calls but filling in certain parameters requires struct member assignment. To simplify the API call interface, API calls that would do nothing but assign a variable to another have been omitted.
Conceptually, database storage is performed on four layers:
This section should be read in conjunction with the section Geometry Shader Data Structures, which describes simple data structures that the API module requires assignments to. For example, API contains functions to begin and finish the creation of a camera, but provides no functions for setting each of the many fields of these structures. Instead, they are simply written to the fields directly.
The API module has been patterned after the .mi language, to the point where the .mi yacc grammar consists almost entirely of one or very few API calls or variable assignments for every statement and clause. To understand the correct order of API calls, refer to the Scene Description Language. The complete yacc Scene File Grammar to parse the .mi language, including C code, is appended to this manual. For information on the syntax of a yacc grammar description, refer to the Unix manual page for yacc.
Note All character string arguments passed to any of the API functions below are expected to have been allocated with mi_mem_allocate, or, more commonly, mi_mem_strdup. All API functions will automatically release such strings using mi_mem_release, so the same allocated string may not be passed to API twice. For example:mi_api_object_begin(mi_mem_strdup("my_object"));
Note that many of these functions come in begin and end pairs, such as:
mi_api_object_begin() // ... create the object mi_api_object_end()
These calls may not be interleaved in any way; there may be only one open unfinished begin ... end bracket at any time in a single thread. Multiple threads can have such an open bracket each.
Copyright © 1986, 2015 NVIDIA ARC GmbH. All rights reserved.