Applet Usage Instructions: Tiny3D.class

by Andrzej Kapolka, ey6es@alumni.cse.ucsc.edu
(see my home page for more applets)


Disclaimer

I am providing this applet "as-is," without accepting any responsibility for the effects it may have on your computer, network, or livelihood. Because I am not a full time author of freeware Java applets, I cannot offer you any significant technical support. If you decide to use this applet in your web site, I would be pleased to be attributed, and to have my site linked to--but this is not at all necessary. Do not charge money for this applet, as it is intended to be freely distributed. Include this documentation--and, in particular, this disclaimer--in any distribution of this applet.

Introduction

Tiny3D is a 3D object slide show; the objects displayed are rendered with texture mapped, environment mapped, perspective correct, Gouraud shaded, w-buffered triangles. Textures and object descriptions are loaded asynchronously in a dedicated thread while the primary thread transforms and rasterizes the current object's primitives for display. The objects are lit by a single directional light, and a crude approximation of accumulation buffer blending increases the apparent smoothness of each object's movement.

Instructions

Place the class files contained in this package into your web space--that is, into a directory that is publicly accessible via the World Wide Web. Usually, it is easiest to place the class files into the same directory that contains the referring page. Place a set of object files (files ending in .3d) and associated texture image files (in any image format supported by Java) into the directory containing the referring web page. Also, place the included file envmap.jpg into this directory. In the HTML source file of the page into which you wish to place the applet instance, add the following lines of code:
<APPLET CODE="Tiny3D.class" WIDTH={desired width} HEIGHT={desired height}>
<PARAM NAME="objList" VALUE="{list of object files to display}">
<PARAM NAME="texList" VALUE="{list of associated texture image files}">
</APPLET>
Replace {desired width} and {desired height} in the example with the width and height, in pixels, of the space that you would like the applet instance to occupy. Replace {list of object files to display} with the list of object files (the files ending in .3d) that you would like the applet to use, and replace {list of associated texture image files} with a list of texture image files--one for each object file--to map onto the rendered objects.

Parameters

objList A list of object files to display.
texList A list of texture files--one for each object in the objList parameter.

Note that both of these parameters are mandatory.

Technical Notes

All texture images (including envmap.jpg) must be square, and their dimensions must be one of the following: 8, 16, 32, 64, 128, or 256 pixels.

Note that the .3d file format used by this applet is a simple proprietary ASCII geometry description format. You may use the example objects included in this package--torus.3d, cone.3d, cube.3d, and sphere.3d--to learn the .3d file structure.

This applet does not perform clipping; thus, attempting to draw outside the view volume will likely cause the applet to crash. Keep this in mind when creating your own .3d files.


Example



For this example, I used the following HTML snippet:
<APPLET CODE="Tiny3D.class" WIDTH=320 HEIGHT=240>
<PARAM NAME="objList" VALUE="torus.3d cone.3d cube.3d sphere.3d">
<PARAM NAME="texList" VALUE="torus.jpg cone.jpg cube.jpg sphere.jpg">
</APPLET>

copyright © 1999-2000, andrzej kapolka