home previous next contents # Shout3D™ 1.0 - User Guide |

## html Files, Applet Tags, and Applet Parameters In order to view a VRML97, .s3d, or .s3z file with Shout3D 1.0, you need to create an html file that instructs the browser to load the file into a Shout3DApplet (or subclass) and then display that applet in your browser. The Shout3DWizard automates this process, but sometimes you may need to create or hand edit your own html files. Or you may just want to understand what is really going on inside the demo html files and/or those published by the the Shout3DWizard. This document explains the anatomy of a Shout3D html file. In point of fact, the only piece of an html file that is needed to run Shout3D is an applet tag. This is the standard way of telling browsers to load and run a java applet. An applet tag starts like this: <APPLET and ends like this: /APPLET> All the things that go in between are what control and specify the Shout3D applet. ## Attributes The first things after the applet tag opens are called "attributes." These lie between the text "<APPLET" and the first closing bracket (>) that follows. The attributes describe the applet to the browser, telling it where to look for the applet and its supporting files, and how much real estate to allot for the applet. There is nothing Shout3D-specific about these attributes; they are common to all Java applets. The attributes commonly used in Shout3D's applet tags are the following: The CODEBASE attribute gives the location of the codebase directory relative to the directory in which the html file lives. The codebase directory must contain all the Java class files and media assets used by the applet The CODE attribute must show the location of the applet class (relative to the CODEBASE directory) that you wish to display in the browser. This is the attribute that will distinguish between applets such as WalkApplet.class versus ExamineApplet.class The ARCHIVE attribute specifies an archive file -- a large bundled file containing many smaller files that are fetched together. Shout3D typically specifies shout3dClasses.zip, an archive containing all the Java classes most commonly used by Shout3D applets. (Click here for more information on the shout3dClasses.zip archive) The WIDTH and HEIGHT attributes specify the size, in pixels, of the applet. When the attributes are filled in, the applet tag then looks like this: <APPLET CODEBASE="codebase" CODE="shout3d/Shout3DApplet.class" ARCHIVE="shout3dClasses.zip" WIDTH=320 HEIGHT=240> </APPLET> ## Applet Parameters The rest of the things that control the applet are called applet parameters. Each parameter is enclosed between its own pair of pointy brackets, and has both a name and a value. An applet tag containing two parameters might look like this: <APPLET CODEBASE="codebase" CODE="shout3d/Shout3DApplet.class" ARCHIVE="shout3dClasses.zip" WIDTH=320 HEIGHT=240> <param name="src" value="models/modswing.s3d"> <param name="gzip_src" value="models/modswing.s3z"> </APPLET> Applet parameters are custom to the applet, and new applets may define parameters to make it convenient to change the applet's behavior. For example, the "src" applet parameter passes the name of a VRML97 or s3d file to the applet; this may seem trivial but it's the reason why you don't need to create a separate, custom applet for each and every file you want to display. Instead of 'hard coding' the file, the applet parameter lets the applet look for a 3D model that you specify at run-time, right in the html file. Tje following list shows the applet parameters of the Shout3DApplet. This is the base class of all Shout3D applets, so all others will respond to them as well. Other applets may define their own parameters (for example, see MultiTestApplet and WalkApplet in the following section) The "src" parameter denotes an .s3d or VRML97 file to view, given relative to the CODEBASE directory. The "gzip_src" parameter denotes an .s3z file to view, given relative to the CODEBASE directory. Note: if both a gzip_src and src tag are specified, the gzip_src will take precedence in browsers that support Java 1.1.0 or above. Other browsers will ignore the gzip_src parameter and read the file specified by "src." Also, you can send a gzipped file as the "src" parameter, but this practice is not recommended as it will crash browsers that are running early versions of Java. The "background" parameter denotes a gif/jpg file to view as the backdrop, given relative to the CODEBASE directory. If this parameter is specified, it will override any Background node contained in the input 3D scene as the starting background. The "backgroundColorR" "backgroundColorG" and "backgroundColorB" parameters set the value of a solid background color. If any of these is included, then the specified color will override any Background node contained in the input 3D scene as the starting background. The "backgroundStretchToFit" parameter sets the value of the background node's stretchToFit field to true or false. (Default is false). The "headlightOn" parameter has values "true" or "false" to create a headlight that is on or off. If this parameter is specified, its value will override the headlight setting of any NavigationInfo node specified as the starting NavigationInfo. The "antiAliasingEnabled" parameter controls whether anti-aliasing is to be performed. Anti-aliasing is only applied at edges between the scene geometry and the background. Anti-aliasing looks good, but slows down rendering. (default = false) The "bilinearFiltering" parameter controls bilinear filtering of textures. If true, it is turned on and the applet smooths out the pixellated artifact that occurs when small textures are applied to large surfaces. Bilinear filtering improves image quality but slows down rendering (default = true) The "loadResourcesInSeparateThread" parameter, if true, specifies that the Shout3D scene will progressively load in one or more background threads. The scene may appear more quickly this way, prior to the completion of the fetching of all textures. The disadvantage here is that some textured objects will appear 'naked' (without their textures) until their textures have been fetched. If the value of this option is false, then textures and sounds will load as part of the main thread; this results in a longer delay before the Shout3D scene will be displayed, but no objects will ever be seen 'naked'. (default = true) Copyright© 1999-2000, Shout Interactive, Inc.