# Palomino - Graph Module

©2004,2008 Jim E. Brooks http://www.palomino3d.org

# Contents

- Main Contents

- Overview
- SceneGraph
- Graph
- Subgraph
- Visitors
- ModelCache

## Overview

[2008/02]

There are 3 levels of graph classes: SceneGraph, Graph, Subgraph.
These are Facade classes that abstract the exact arrangement of nodes.

## SceneGraph

[2008/06]

SceneGraph defines the entire scene graph.

SceneGraph is a simple struct. It defines the absolute root node (osg::Group) which is passed to Viewer::setSceneData(). Window contains a SceneGraph object.

A scene is rendered by Window and View objects. A scene is constructed by attaching Objects using the interface of the World class.

## Graph

[2008/02]

The Graph class represents a per-Object graph (ObjectGraph would be its long name). A Graph is passed as an arg to Object ctor. Graph is a Facade over the implemented arrangement of OSG nodes.

### Graph May Have Two Transform Nodes

Graph ctor may be passed a transform node as the root node. However, the Graph class isn't aware of that fact, Graph ctor always proceeds to create a transform node and places under it the incoming root node. This allows, transparently to Graph, correcting the orientation of a 3D model prior to encapsulating it as a Graph object.

## Subgraph

[2008/02]

Subgraph defines a partition of a Graph. Subgraph is typically used to define parts of an aircraft's 3D model. Optionally, Subgraph can model a part that has a limited range of movement such as landing gear.

3D model files (.ac) typically name a part of a mesh. A Visitor is created to searche for a named node in a Graph, which becomes the root node of a Subgraph. A transform node is spliced in order to rotate the part.

## Visitors

[2007/12]

The Visitor design pattern is ideal for graphs. Extended Graph functionality is provided in the form of Visitor classes. This Visitor pattern keeps Graph class minimal. Graph can be extended by adding new Visitor classes (rather than adding new Graph methods or Graph derivatives).

## ModelCache

[2008/02]

ModelCache caches the results of osgDB::readNodeFile(). Sharing the same node saves enormous amounts of memory. A shared node has multiple parent nodes. The reason a 3D model can exist in multiple locations is because its shared node is placed under separate transform nodes.

Last modified: Thu Jun 12 19:26:14 EDT 2008