BRender Tutorial Guide:1 Setting The Scene:Describing Scenes in BRender
Next|Prev|Up
BRender Data Types
The Registry
BRender Program Structure
Conventions

Describing Scenes in BRender


So how does the applications programmer go about describing a scene to BRender? What `scene description language' does BRender understand? How is the interface between the applications programmer and BRender defined and structured?

BRender data structures are used to convey scene description information to the renderer. The actor data structure is fundamental to scene description. All participants in a scene are categorised as actors. An actor can have a number of children, each of whom is also an actor. In this way a tree of actors is built up representing the world.

Figure 28 Simple tree of actors

Different types of actors are used to represent different entities. Commonly used actor types include Models, Lights, Cameras and None (a reference actor used to assist in the layout and organisation of actor hierarchies - invariably found at the root of an actor tree). The smallest actor hierarchy that will produce a rendered scene is depicted in Figure 29.

Figure 29 Four-actor tree

This scene contains a single model actor that references information describing its shape, colour, texture and position. The light actor references information describing the type of lighting used to illuminate the scene (point, direct or spot), its position, orientation and colour. The camera actor references information describing the view volume including the view position, the field of view and how the scene is projected onto the viewing surface. The None, or dummy, actor doesn't usually reference any data (although it can) but is used to build the hierarchical tree structure. It forms the root of the actor tree used to describe the world.

A model actor may specify, or inherit from a parent, a default `material'. If a material is not explicitely assigned to a model, it inherits its parent's default material. If no material is associated with the parent actor (or if no parent actor exists) a default flat-shaded grey material is used. The br_material data structure contains information about the appearance of a surface - its colour, whether the finish is flat or Gouraud, etc. The material data structure may reference a texture map. Texture mapping is considered in more detail in Chapter 6. Fundamentally, it's a process whereby a two-dimensional pattern is wrapped around a three-dimensional model.

Figure 30 Models can reference materials and texture maps

This is how the world is represented in BRender - a tree of actors referencing models that reference materials that reference texture maps.

BRender Data Types

BRender defines certain data type classes in order to ensure cross platform portability. Macros are provided to convert standard C data types to appropriate BRender data types.

The Registry

Some items used to describe actors are preprocessed by BRender to minimize rendering time. These items are made available for such preprocessing by placing them in the Registry. The Registry is a database that keeps track of registered items (models, materials, texture maps and shade tables) and manages the resources used in rendering.

Registry operations are largely transparent to the user. However, it is important to remember that actors, models, materials and pixel maps (described below) must be registered before they can be used. They can then be referred to by name. A Registry update should be performed whenever registered items are changed.

BRender Program Structure

The structure of a typical BRender program is depicted below:

Conventions

Some function calls, particularly those concerned with I/O operations, are platform specific. When platform specific function calls are included in program listings in this manual, they appear in italics. The sample programs on your Tutorial Programs disk contain the appropriate format for your platform. Refer to these sample program listings and to your installation guide for further details.


Generated with
CERN WebMaker