Saving Scene Graphs
75
Saving Scene Graphs
The data in the scene graph database is not necessarily static. You might, therefore, need
to save scene graph data into a file. To do so, you use the following method:
csGlobal::storeFile(NameOfFile, *dataStructure);
where NameOfFile is the name of the file where you want to store the data and
dataStructure is the Cosmo 3D in-memory data structure to store. The method returns
TRUE if the file is stored successfully, FALSE otherwise.
Note: storeFile() is used with Cosmo 3D-only applications. If you are writing an
Optimizer application, do not use storeFile().
Troubleshooting Scene Graph Construction
A common mistake in Cosmo 3D applications is forgetting to include a csLight or
csCamera node. The csDrawAction::setCamera() method specifies the camera and
points it at the shapes in the scene graph.
For more information about csLight or csCamera, see Chapter 8, “Lighting and Fog” and
Chapter 9, “Viewing the Scene,” respectively.
Another common error in Cosmo 3D applications is pointing the camera in the wrong
direction in which case the camera may produce a blank image.