Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
The Scene Database

The Inventor scene database consists of information representing one or more 3D scenes. This database, SoDB, can contain several scene graphs, as shown in An Inventor Database . Each scene graph consists of a related set of 3D objects and attributes. In An Inventor Database , for example, the scene graphs might represent a car, a small house, another car, a large house, and a person.

An Inventor Database

You can perform two basic operations, or methods, directly on the scene database. First, you initialize it:

C++ :

SoDB::init()

This must be the first Inventor call you make. If you use the Inventor Component Library, the database is initialized automatically when you call SoXt::init() (see Open Inventor Component Library). If you are not using components, but you are using interaction or node kits, or both, call SoInteraction::init(), which initializes the database, interaction, and node kits.

Second, you can read from a file into the scene database, which adds new scene graphs to it:

C++ :

SoSeparator** readAll**( SoInput*\* in* ) or SbBool** read**( SoInput** in*, SoNode*&* rootNode* ) const

C# :

SoSeparator** ReadAll**( SoInput* in* ) or bool** Read**( SoInput* in*, SoNode* rootNode* )

Java :

SoSeparator** readAll**( SoInput* in* ) or SoNode** read**( SoInput* in* )

or

C++ :

SbBool** read**( SoInput** in*, SoPath*&* path* ) const

C# :

bool** Read**( SoInput* in*, SoPath* path* )

Java :

SoPath** readPath**( SoInput* in* )

Using the first syntax, Inventor reads all graphs from a file specified by in and returns a pointer to a separator that contains the root nodes of all the scene graphs in the file. Using the second syntax, Inventor reads from a file specified by in and returns a pointer to the resulting root node (rootNode). Using the third syntax, Inventor reads a file specified by in and returns a pointer to the resulting path (path). (See Paths.) If an error occurs, the methods return FALSE. (Also see Importing data for more information on SoInput.)