<<<<<<<<<<<<<<<<<

dcube(dcube) Dividing Cubes dcube(dcube)

NAME

dcube - a zbuffer-based renderer for dividing cubes points list

DESCRIPTION

The dcube class renders points defined with LYMB objects (camera, lights, actors and modellers) using a zbuffer algorithm. Rendering is performed to a 512x512 8-bit image that is suitable for mapping through the ivm_mapper class.

SUPERCLASS

renderer

INSTANCE VARIABLES

xy The current xy index into the image and zbuffer.

interval How many points from the data set to render. An interval of 10 would render every tenth point.

MESSAGES

xy= (x,y) Set the value of the xy instance variable.

@ (x,y) An alias for xy=.

zbuffer_value? Returns the zbuffer value at the current (x,y) index.

image? Return a pointer to the renderer's image buffer. (Internal)

zbuffer? Return a pointer to the renderer's zbuffer. (Internal)

interval= arg Set the current interval to arg.

interval? Return the current interval.

no_lights! Overrides the default message implemented in the renderer superclass. No user-defined lights are used by this renderer, so no warngin should be issued if the user doesn't define one.

erase_image! Clear the image and zbuffer.

initialize! Perform renderer specific initialization. (Internal)

start! Lead-in to the rendering process. (Internal)

update_actor: For each visible actor, concatenate its composite transformation matrix to the current one, send it a render: and pop the transformation matrix stack. (Internal)

update_camera: Update the viewing transformation using the camera's transformation matrix. (Internal)

update_light: No op. (Internal)

render_all! Renders all instances of dcube deferring a buffer update (via frame!) until the last instance is rendered. (Internal)

update_render_time! Overrides the inherited method to update the last time an image was rendered. This method always sets render_time to 0, forcing the start! message to initiate each frame of animation. (Internal)

debugon!/debugoff! The normal debugon! and debugoff! messages are overridden to also set/reset the debug flag for the internal transform object.

free! Free the dcube object and its dynamic resources.

transform? Returns a pointer to the renderer's internal transfomr object. (Internal)

EXAMPLES

The following LYMB script demonstrates one way to use the dcube renderer to display a dividing cubes point list on an X display.

-- generate a display_data object from a dividing cubes points list dcube_reader new: read filename="/home/moose/u2/montnaro/oscar/viva/tooth/rootlist" ;

display_points new: points data_in=read ;

actor new: a modeller=points ;

camera new: c1 range=[points bbox?] focal_point=(0,0,0) position=(0,0,-5) default! on! ;

dcube new: ren cameras=[camera instances?] actors="a" render! ;

-- dcube object functions behind the scenes - a mio_dcube object fronts it mio_dcube new: jawlist renderer=`ren' camera=`c1' actor=`a' points=`points' reader=`read' prefix="/home/moose/u2/montnaro/oscar/viva/tooth/rootlist" ;

xpseudo_color_visual new: the_visual

match! ;

xcolormap new: cmap visual= the_visual ;

string new: the_map = "cmap"; string new: cell_type = "xprivate_cells"; scalar new: number_of_cells = 256; -- ivm_mapper maps the rendered image into a grayscale ramp ivm_mapper new: mapper width= 512 height= 512 cells= the_cells image= jawlist ;

-- an ximage object takes the mapped data ... xz_pixmap new: image width=512 height=512 data=[mapper data?]

create! ;

xwindow new: win width=512 height=512 colormap: cmap create! map! ;

-- after the window is mapped, issue the lymb command: -- win put_image: image;

SEE ALSO

actor, camera, light, renderer, model, phigs, gl, starbase, vogle

NOTES AND BUGS

Speed == Slow The current implementation converts the (unsigned short) data in the points list to the display_data model (floats), and does not bother converting the data back before rendering. Consequently, it is slower than it might be.

Lighting A crude lighting model is used that always places the light at the camera position. Any user-defined lights are ignored. Ambient lighting is currently not supported.

Image holes There still appear to be holes in the generated images from time-to-time. It may be back-facing normals, but who knows?

Manipulating Rendered images Dividing Cubes is an image-resolution renderer. Most dividing cubes points lists are generated at an image resolution of 512x512. Zooming in with the camera will cause the image to "explode", as the screen distance between individual points increases. Similarly, rotating the image will cause some "drop-out", due to round-off error.

Inverse transform Dcube supports the ability to take the inverse transform of an (x,y) location and return the world coordinates of the selected point. Because of this, one can currently display only a single actor (the actor's composite transform is needed to perform the inverse transformation). This may change in the

future if a more complex zbuffer scheme is implemented, perhaps using indirection through multiple zbuffers.

Lines and Polygons not supported Only point rendering is currently supported. All other rendering primitives are silently ignored.


Please send comments and suggestions to
consult@rpi.edu