The Java 3D™ API Specification
Total Page:16
File Type:pdf, Size:1020Kb
The Java 3D™ API Specification Version 1.2, April 2000 JavaSoft A Sun Microsystems, Inc. Business 901 San Antonio Road Palo Alto, CA 94303 USA 415 960-1300 fax 415 969-9131 1997, 1998, 1999, 2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California 94303 U.S.A. All rights reserved. RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the United States Government is subject to the restrictions set forth in DFARS 252.227-7013 (c)(1)(ii) and FAR 52.227-19. The release described in this document may be protected by one or more U.S. patents, for- eign patents, or pending applications. Sun Microsystems, Inc. (SUN) hereby grants to you a fully paid, nonexclusive, nontrans- ferable, perpetual, worldwide limited license (without the right to sublicense) under SUN’s intellectual property rights that are essential to practice this specification. This license allows and is limited to the creation and distribution of clean-room implementa- tions of this specification that (i) are complete implementations of this specification, (ii) pass all test suites relating to this specification that are available from SUN, (iii) do not derive from SUN source code or binary materials, and (iv) do not include any SUN binary materials without an appropriate and separate license from SUN. Java, JavaScript, and Java 3D are trademarks of Sun Microsystems, Inc. Sun, Sun Micro- systems, the Sun logo, Java, and HotJava are trademarks or registered trademarks of Sun Microsystems, Inc. UNIX® is a registered trademark in the United States and other coun- tries, exclusively licensed through X/Open Company, Ltd. All other product names men- tioned herein are the trademarks of their respective owners. THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THIS PUBLICATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPO- GRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFOR- MATION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THE PUBLICATION. SUN MICROSYSTEMS, INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PRO- GRAM(S) DESCRIBED IN THIS PUBLICATION AT ANY TIME. Contents Figures . xv Preface . xvii 1 Introduction to Java 3D . 1 1.1 Goals . .1 1.2 Programming Paradigm. .2 1.2.1 The Scene Graph Programming Model . .2 1.2.2 Rendering Modes . .2 1.2.3 Extensibility . .3 1.3 High Performance . .4 1.3.1 Layered Implementation. .4 1.3.2 Target Hardware Platforms . .5 1.4 Support for Building Applications and Applets . .5 1.4.1 Browsers . .5 1.4.2 Games . .6 1.5 Overview of Java 3D Object Hierarchy. .6 1.6 Structuring the Java 3D Program. .6 1.6.1 Java 3D Application Scene Graph . .6 1.6.2 Recipe for a Java 3D Program . .8 1.6.3 HelloUniverse: A Sample Java 3D Program . .9 2 Java 3D Concepts . 11 2.1 Basic Scene Graph Concepts. .11 2.1.1 Constructing a Simple Scene Graph. .12 2.1.2 A Place For Scene Graphs . .12 2.1.3 SimpleUniverse Utility. .15 2.1.4 Processing a Scene Graph. .15 2.2 Features of Java 3D . .16 2.2.1 Bounds . .16 2.2.2 Nodes . .17 2.2.3 Live and/or Compiled. .17 3 Scene Graph Basics. 19 3.1 Scene Graph Structure . .19 3.1.1 Spatial Separation. .19 Version 1.2, April 2000 iii CONTENTS 3.1.2 State Inheritance . 20 3.1.3 Rendering . 21 3.2 Scene Graph Objects . 21 3.2.1 Node Objects . 23 3.2.2 NodeComponent Objects . 26 3.3 Scene Graph Superstructure Objects . 27 3.3.1 VirtualUniverse Object . 27 3.3.2 Locale Object . 27 3.4 Scene Graph Viewing Objects . 27 3.4.1 Canvas3D Object. 28 3.4.2 Screen3D Object . 28 3.4.3 View Object. 28 3.4.4 PhysicalBody Object . 28 3.4.5 PhysicalEnvironment Object. 28 4 Scene Graph Superstructure . 31 4.1 The Virtual Universe . 31 4.2 Establishing a Scene. 32 4.3 Loading a Virtual Universe . 33 4.4 Coordinate Systems . 33 4.5 High-Resolution Coordinates . 33 4.5.1 Java 3D High-Resolution Coordinates . 33 4.5.2 Java 3D Virtual World Coordinates . 34 4.5.3 Details of High-Resolution Coordinates . 34 4.6 API for Superstructure Objects . 36 4.6.1 VirtualUniverse Object . 36 4.6.2 Locale Object . 37 4.6.3 HiResCoord Object . 38 5 Group Node Objects . 41 5.1 Group Node . 41 5.2 BranchGroup Node. 44 5.3 TransformGroup Node . 45 5.4 OrderedGroup Node . 47 5.5 DecalGroup Node. 47 5.6 Switch Node . 48 5.7 SharedGroup Node . 50 6 Leaf Node Objects . 51 6.1 Leaf Node . 51 6.2 Shape3D Node . 51 6.2.1 OrientedShape3D Node. 55 6.3 BoundingLeaf Node . 58 6.4 Background Node. 59 6.5 Clip Node . 61 6.6 ModelClip Node . 63 6.7 Fog Node . 66 6.7.1 ExponentialFog Node . 68 iv The Java 3D API Specification 6.7.2 LinearFog Node . .69 6.8 Light Node. .71 6.8.1 AmbientLight Node . .73 6.8.2 DirectionalLight Node . .73 6.8.3 PointLight Node . .74 6.8.4 SpotLight Node. .76 6.9 Sound Node . .77 6.9.1 BackgroundSound Node. .84 6.9.2 PointSound Node . .84 6.9.3 ConeSound Node . .88 6.10 Soundscape Node. ..