Chapter 6. Graphics and Sound
<< previous |  | next >>

## Chapter 6. Graphics and Sound

This chapter discusses customizing graphics and sound in a breve simulation.

The first section, Lighting (the section called “Lighting”) shows how to enable and use lighting. Shadows and Reflections (the section called “Shadows and Reflections”) shows how shadows and reflections can be added to simulated objects.

Loading Image Files (the section called “Loading Image Files”) shows how to load images into a simulation. Once an object has been loaded into a simulation, it can be used to display an agent as an image (the section called “Displaying Objects as Bitmaps”), to texture an object (the section called “Texturing Objects”) or to display an object as a translucent "lightmap" (the section called “Displaying Objects as "Lightmaps"”). In addition, the image data may be accessed and manipulated, as described in Using the "Image" Class (the section called “Using the "Image" Class”).

Users can also create custom drawings in the world which are not associated with simulated objects. This feature is described in Custom Drawings with the "Drawing" Class (the section called “Custom Drawings with the "Drawing" Class”).

Finally, Playing Sound Effects (the section called “Playing Sound Effects”) and Sounds Included With breve the section called “Sounds Included With breve”) describe how sound files can be loaded and played as part of a breve simulation.

## Lighting

Lighting can be used to aid in the visualization of a simulation. By default, lighting is enabled for physical simulations (those which use a controller subclassed from PhysicalControl.tz) and disabled all other simulations.

To enable lighting or disable lighting, use the Control.tz methods enable-lighting and disable-lighting. To move the location of the light, use the method move-light. The following example shows how lighting could be enabled and setup as part of the controller object's init method:

            self enable-lighting.
            self move-light to (0, 50, 0).

<< previous |  | next >>
Scheduling Events for a Specific Time | Table of Contents | Shadows and Reflections