The renderer also acts as the device-independent interface to the LYMB objects. Those tasks that are performed for all types of devices are implemented in the renderer. Requests that are specific to a device are implemented as subclass methods. This two level rendering model ensures that LYMB animation scripts appear similar among different devices, even though the underlying processes may be quite different (animations and images on one device will look the same on another, within the limits of each device).
actors A list of actor instances (or subclasses of actor) that define the physical objects in a scene. An actor provides an interface between the rendering class and the geometric modelling classes.
background The RGB color of the background.
backlit If non-zero, all lights that are on in a scene will have a counterpart light source at the opposite location (with respect to the origin).
cameras A collection of the names of the camera objects in the scene. A camera object describes the viewer's location, focal point, field of view, and other characteristics that define the view volume.
force_render If non-zero, causes the rendering process to continue, regardless if the actors, lights and cameras have been modified since the last render.
frame_counter Indicates which frame in an animation sequence was last rendered.
interframe_counter A counter that keeps track of time slices between each frame.
lights A collection of the names of the light objects in the scene. A light describes the position, direction and color of a light source.
render_time The time that the last image was rendered.
renderer_resolution The number of time slices between each frame of animation.
start_frame The frame number to first begin rendering on.
viewport The screen coordinates of the viewport as (left,bottom,right,top). By default these are (0,0,1,1) indicating that the image should extend from the lower-left corner of the window (0,0) to the upper-right corner (1,1). Subportions of the window can be drawn on by specifying coordinates that fall inside the range (0,0) and (1,1).
aspect The aspect ratio (height/width) of the image.
double_buffer If non-zero, then the image is updated using the double-buffering technique - each image is rendered to a non-visible buffer and then copied rapidly to the visible buffer. This prevents the user from seeing the image while its being drawn and makes frame to frame transitions in animations appear smooth.
erase If non-zero, the image is not erased before the next render.
stereo Typically not set by the user, this scalar has three values: 0 stereo off, 1 stereo on, 2 stereo in the process of being turned on.
actors[=?+-] Set/get/add/subtract the specified names to the current list of actors.
background[=?+] Set/get/add the background RGB color value.
backlit[=?] Set/get the value of the backlighting flag.
backlit_on! Turn backlighting on.
backlit_off! Turn backlighting off.
cameras[=?+-] Set/get/add/subtract the specified names to the current list of cameras.
force_render[=?] Set get the value of the flag forcing the rendering process to continue.
frame_counter[=?+] Set/get/add the frame counter variable.
interframe_counter[=?+] Set/get/add the interframe counter variable.
lights[=?+-] Set/get/add/subtract the specified names to the current list of lights.
renderer_resolution[=?+] Set/get/add the number of time slices between each frame.
start_frame[=?+] Set/get/add the start_frame number.
viewport[=?+] Set/get/add the viewport coordinates.
aspect[=?] Set/get the aspect ratio.
double_buffer[=?] Set/get the value of the double_buffer flag.
double_buffer! Turn double_buffering on.
single_buffer! Turn double_buffering off.
erase[=?] Set/get the value of the screen erase flag.
erase_on! Turn erase on - erase the image before drawing the next one.
erase_off! Turn erase off - draw the next image on top of the old one.
actors! Traverses the list of actors and sends an "update_actor: (actor name)" message to itself if the actor has been modified since the last render. If a modified actor is found, force_render is set to TRUE. If no modified actors are found, "no_actors!" is sent to itself.
cameras! Traverses the list of cameras, ignoring those that are off. If the current camera is not the active_camera, force_render is set TRUE and active_camera is set to this camera's name. If this camera has been modified since the last render, or if force_render is TRUE, the renderer sends itself an "update_camera: (camera name)" message and sets force_render TRUE. If no modified cameras are found, "no_cameras!" is sent to itself.
lights! Traverses the list of lights and sends an "update_light: (light name)" message to itself for each light that is on and has been modified since the last render. If no modified lights are found, "no_lights!" is sent to itself.
render! Traverses the actors, lights and cameras lists and produce an image on the corresponding device. The sequence of steps performed is as follows: If the interframe_counter is a multiple of the renderer_resolution then the rendering process continues. If not, the interframe_counter is incremented. The rendering process starts by examining the
render_time. If it is zero, the renderer sends itself a "start!" message and the start_time is set to the frame_counter. The renderer then sends itself "cameras!", "lights!" and "actors!" messages. If force_render is TRUE, then "frame!" is sent to itself. Then "update_render_time!" is sent to itself. The force_render variable is then set to FALSE and an "expose!" message is sent. Finally, the interframe_counter is incremented.
update_render_time! Sets the render_time to the current clock time.
no_actors! A warning message is printed out.
no_cameras! Handles the case when no cameras that are on can be found. Tries to create one if enough information is available. The actor list is checked to locate the first visible actor. If none are found, an "instances?" message is sent to the actor class and the renderer's actor list is set to the list returned by the "instances?" message. The actor list is examined once again for the first visible actor. If one still cannot be found, a warning is printed out. Otherwise a camera is created with the name (render_name)_c1, where (render_name) is the name of this renderer instance. The camera is set to look down the z-axis and its view volume is set to enclose the bounding box of the located actor.
no_lights! Handles the case when no lights are on. Tries to create a default one if enough information is available. The camera list is first checked to see if an active camera exists. If not, a warning is printed out (we can't render without a camera). Otherwise a default light, located at the camera is created and given the name (render_name)_l1, where (render_name) is the name of this rendering instance. The renderer then sends itself a "lights!" message to process this new light.
compute_aspect! Computes the aspect ratio of the region drawn on the display device by sending itself a "display_size?" message and clipping the returned region to the subregion defined by the viewport. The aspect instance variable is then set to (1.0, y/x) if x is the dominant dimension or (x/y, 1.0) if y is the dominant dimension. Note that if pixels are non-square, the computed aspect ratio will not
be the same as the aspect ratio measured on the display device.
class_name? Returns the class name of this rendering instance. An alias for "class?" which is inherited from object.
update_actor: Gets the transformation matrix and property information from the actor and performs the equivalent operations in the renderer-specific library. Then it sends a "load: render_name" (where render_name is the name of the rendering instance) to the actor to draw the actor's modeller.
update_camera: Gets the characteristics of the camera (position, focal point, view up, etc.) and specifies an equivalent camera in the rendering library.
update_light: Gets the characteristics of the lights (position, color, etc.) and specifies an equivalent light in the renderer-specific library.
start! Performs any initialization required before each image is rendered (clearing the display, initializing the z-buffer, etc.).
complete! Performs any tasks required immediately after each image is rendered.
frame! Causes the computed image to be displayed. Usually just swaps the buffers when double buffering is being used.
expose! For devices that perform some type of recording, the expose! message records the image on the media.
display_size? Returns the dimensions of the image in device coordinates (usually pixels).
stereo_on! Turns on stereo viewing. Takes effect at the next render!. Currently only available on SGI/Cheetah.
stereo_off! Turns off stereo viewing. Takes effect immediately. This should be sent before exiting a stereo program to restore the screen to its proper operating mode.