OpenSceneGraph 3.0: Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Components

The computing infrastructure of OSG is designed to be highly scalable in order to enable runtime access to extended functionalities. In addition to the standard core libraries, a set of additional modular libraries known as NodeKits have been delivered to meet specific development requirements.

The core OSG functionality consists of four libraries:

  1. The OpenThreads library: This library is intended to provide a minimal and complete Object-Oriented (OO) thread interface for C++ programmers. It is used by OSG as the main threading model implementation.
  2. The osg library: This library provides basic elements used to build scene graphs, such as nodes, geometries, rendering states and textures, as well as related management tools and methods. It also contains a few necessary math classes, which are used to implement vector and matrix operations that are commonly used in two-dimensional and three-dimensional spaces.
  3. The osgDB library: This library provides a plugin mechanism for reading and writing 2D and 3D files, with a derivable class containing access to data files and stream I/O operations. Its built-in database pager also supports dynamic loading and unloading of scene graph segments, in order to achieve the scheduling of huge collections of user data.
  4. The osgUtil library: This library is designed for building the OSG rendering backend, which traverses the scene tree, performs culling in each frame, and finally converts the OSG scene into a series of OpenGL calls. There are also functionalities for user intersections, and polygon modification algorithms.

The extra NodeKits and utilities available with current OSG distributions are:

  • The osgAnimation library: This library provides a range of general purpose utilities for various animations, including skeleton and morphing. It uses generic templates to construct multiple kinds of key frames and animation channels.
  • The osgFX library: This library has a framework for implementing special effects in the 3D space, and contains several useful effect classes.
  • The osgGA library, which stands for OSG GUI abstraction: This library is an abstract user interface on top of various windowing systems. It helps to handle interactive events from peripheral devices, for example, a keyboard or mouse.
  • The osgManipulator library: This library extends the scene graph to support 3D interactive manipulation, such as moving, rotating, and scaling of transformable nodes.
  • The osgParticle library: This library makes it possible to render explosions, fire, smoke, and other particle-based effects.
  • The osgShadow library: This library provides a framework for various shadow rendering techniques.
  • The osgSim library: This library meets some special requirements from simulation systems, especially from the OpenFlight databases.
  • The osgTerrain library: This library provides geographic terrain rendering support using height field and imagery data.
  • The osgText library: This library fully supports the rendering of TypeType and a series of other font formats, based on the FreeType project. It can draw 2D and 3D texts in 3D space or on the screen.
  • The osgViewer library: This library defines a set of viewer-related classes, and therefore integrates OSG scene graphs and renders the backend with a wide variety of windowing systems, including Win32, X11, Carbon, and Cocoa, as well as providing indirect support for many other famous GUI toolkits.
  • The osgVolume library: This library includes an initial support for volume rendering techniques.
  • The osgWidget library: This library extends the core OSG elements and provides a 2D GUI widget set for 3D applications.
  • The osgQt library: This library embeds the Qt GUI into scene graphs and thus has the ability to display web pages and common Qt widgets in space.

All OSG core libraries and NodeKits, no matter what kind of features they implement or who contributed them, have the same prefix "osg", and a short word or abbreviation followed as the keyword.

The whole OSG architecture can be illustrated as follows:

Components

In most cases, the osg, osgDB, osgUtil, and osgViewer libraries are the major components of an OSG-based application, and will be discussed in more detail in the following chapters of this book, while other less frequently used NodeKits may also be mentioned in specific chapters.