## Chapter 22. XFF Player

## Introduction

The XFF Player example is a simple example on how to build an 3d engine on top of xfcore. XFFPlayer implements a simple gamegraph and can load a scene from XFF file. The example is kept as simple as possible, and as such, it contains little or no speed optimizations to preserve clarity. NOTE: Even though the lite exporter exports node attributes, they are just skipped in the xff loader. Adding support for them is straightforward, and is left as an exercise for the reader.

## Principal classes

### XFFPlayer

The main application class. XFFPlayer class contains one instance of Gamegraph object. See chapter Getting started for details on GL initialization etc.

### Gamegraph

The Gamegraph class contains everything that is needed to render the scene. It takes care of all the resources connected under it and also holds pointer to the root node of the scene graph. The gamegraph class can be accessed for example to find a node of a certain id.

### Node

The node class is the base class for everything that the gamegraph contains. Every object (group, mesh, camera, texture, material etc) in gamegraph is inherited from Node. Node contains the object's id and the actual type of the node. It also introduces virtual initLoad()-method that the class can hook up to init itself after all the nodes have been loaded.

### Group

Group class is the main 'object' class in the gamegraph. A group has local transformation matrix, a parent group and child groups. All the groups in the scene form the actual scene graph of the 3d world. Cameras and meshes inherit from Group.

### Mesh

Mesh inherits from a group. Mesh contains 0 or more submeshes of which each has its own material and triangleinfo / vertexbuffers.

### Material

Material contains the info on how the submesh needs to be rendered.

### PRSAnimation

A simple controller class to animate groups. To keep the implementation simple, the controller just streams the PRS data to the group every time the controller is ticked.

|  | X-Forge Documentation Confidential Copyright © 2003 Fathammer