Table of Contents
preface xvii
acknowledgments xix
about this book xx
about the cover illustration xxiii
- 1 What is Java 3D and is it for me? 1
- 1.1 Strengths 2
- 1.2 Weaknesses 3
- 1.3 System requirements (developer and end user) 5
- 1.4 Expected performance 6
- Memory footprint 7
- 1.5 Running the examples 8
- 1.6 Summary 8
- 2 3D graphics programming 10
- 2.1 Learning 3D graphics programming 10
- 2.2 Projecting from 3D world coordinates to 2D screen coordinates 13
- A simple 3D projection routine 13 ♦ Comparing output 15 ♦ Drawing filled triangles 16
- 2.3 Lighting effects 19
- 2.4 Putting it together?MyJava3D 21
- 2.5 Summary 26
- 3 Getting started, Hello Java 3D! 27
- 3.1 Installation 27
- Java 2 SDK 27 ♦ Java 3D 1.2 JDK 28 ♦ Documentation 28 ♦ Java 2 development environment (optional) 30 ♦ Performance analysis tools (optional) 30 ♦ Java class decompiler (optional) 30
- 3.2 Your first Java 3D application 30
- 3.3 Exercises for the reader 37
- Colors and lighting 37 ♦ Animation parameters 37 ♦ Background geometry 38 ♦ Scheduling bounds 38 ♦ Capability bits 38 ♦ The position of the viewer of the scene 38 ♦ Size of sphere primitives 38
- 3.4 Summary 38
- 4 The scenegraph 39
- 4.1 Overview 39
- 4.2 What is a scenegraph? 42
- 4.3 Java 3D and the scenegraph 46
- 4.4 Elements of scenegraph design 51
- Object-oriented 51 ♦ Compilable 51 ♦ Level of detail independent 51 ♦ Polymorphic (customizable) 51 ♦ Bounds and level of detail aware 51
- 4.5 Scenegraph advantages 52
- Object management 52 ♦ Rendering optimization 52 ♦ Picking support 52 ♦ Behavior model 52 Collision detection 52 ♦ Multiple thread aware 52 ♦ Hierarchical control 52
- 4.6 Hierarchical control 53
- 4.7 Immediate mode vs. retained mode vs. mixed mode 56
- Immediate mode 57 ♦ Mixed mode 61 ♦ Summary of modes 62
- 4.8 Summary 64
- 5 Scenegraph node reference 65
- 5.1 Scenegraph compilation 65
- Appearance merging and sorting 66 ♦ Geometry merging 66
- 5.2 Node 66
- 5.3 Bounds and CollisionBounds 67
- Bounds and CollisionBounds propagation 69
- 5.4 Group 71
- Remove a child Node by reference 72
- 5.5 Switch 73
- 5.6 BranchGroup 75
- 5.7 OrderedGroup 77
- 5.8 SharedGroup and link 78
- 5.9 Primitive 80
- 5.10 TransformGroup 80
- 5.11 Summary 81
- 6 Defining the universe 82
- 6.1 Locales and HiResCoord 82
- 6.2 View, ViewPlatform, and Locale 85
- 6.3 SimpleUniverse 87
- Avatars and platform geometry 92
- 6.4 Background geometry 94
- 6.5 Using multiple views 95
- Billboards and LOD behaviors 95
- 6.6 Summary 96
- 7 Data model design 97
- 7.1 Choosing a data model 97
- Surface models 98 ♦ Volumetric and mathematical models 100 ♦ Implementing in Java 3D 103
- 7.2 Performance objectives 104
- Rendering quality 105 ♦ Load time 106 ♦ Memory footprint 106 ♦ Development time and asset management 106
- 7.3 Summary 107
- 8 Geometry reference 108
- 8.1 Shape3D 108
- The user data field 109
- 8.2 Primitive 109
- Box 111 ♦ Cone 113 ♦ Cylinder 114 ♦ Sphere 115 ♦ Primitive flags 115 ♦ Primitives and the geometry cache 116
- 8.3 GeomBuffer 116
- 8.4 Rasters 116
- Rendering an image using a Raster 117 ♦ Retrieving scene depth components using a Raster 117
- 8.5 Text2D 121
- 8.6 Text3D 122
- Complex geometry 123 ♦ SetString problems 124
- 8.7 Morph 124
- 8.8 Summary 125
- 9 Setting geometry appearances 126
- 9.1 Introduction 126
- 9.2 Appearance 128
- 9.3 ColoringAttributes 129
- 9.4 LineAttributes 131
- 9.5 Material 132
- 9.6 PointAttributes 133
- 9.7 PolygonAttributes 136
- 9.8 RenderingAttributes 138
- 9.9 TexCoordGeneration 140
- 9.10 TextureAttributes 140
- 9.11 Texture 140
- 9.12 TransparencyAttributes 141
- A warning about transparency 144
- 9.13 Summary 148
- 10 Lights 149
- 10.1 Lights 150
- Lighting equations 151 ♦ Normal vectors and lighting 152 ♦ Lighting and material properties 154 ♦ What about shadows? 154
- 10.2 Light node 155
- Light properties 155
- 10.3 AmbientLight 157
- 10.4 DirectionalLight 157
- 10.5 PointLight 157
- 10.6 SpotLight 158
- 10.7 Lighting, material attributes, and per-vertex colors 161
- 10.8 Summary 162
- 11 Behaviors?navigation, alignment, and LOD 163
- 11.1 Introduction 164
- 11.2 Behavior class 165
- Scheduling bounds 165 ♦ Enable State 166 ♦ WakeUp Condition 166 ♦ processStimulus method 166 ♦ initialize method 166 ♦ When do Behaviors run? 166
- 11.3 Anatomy of a typical behavior 166
- Constructor 167 ♦ initialize method 167 ♦ processStimulus method 167
- 11.4 Overview of the built-in behaviors 167
- 11.5 Overview of Wakeup criteria 169
- WakeupCriterion 170 ♦ WakeupCondition 170 ♦ Summary 171
- 11.6 Using keyboard behaviors 172
- KeyNavigatorBehavior 173 ♦ Writing a simple keyboard behavior 174 ♦ Implementing DOOM and DOOM-style keyboard navigation 176 ♦ Conclusions 186
- 11.7 Using mouse behaviors 186
- Java 3D and the mouse 187 ♦ Building improved mouse behaviors 188
- 11.8 Billboard behavior 192
- 11.9 Using LOD behaviors 195
- DistanceLOD Class 195
- 11.10 Summary 197
- 12 Using Interpolator behaviors 198
- 12.1 The Interpolator class 198
- 12.2 The Alpha class 199
- Using a custom Alpha class 201 ♦ Summary 202
- 12.3 Example of Interpolator usage 203
- SwitchValueInterpolator 203 ♦ ColorInterpolator 204 ♦ PositionInterpolator 204 ♦ RotationInterpolator 205 ♦ ScaleInterpolator 205 ♦ TransparencyInterpolator 205 ♦ RotPosScalePathInterpolator 205 ♦ Design of the InterpolatorTest example 208
- 12.4 Using a cubic-spline interpolator 210
- Tension parameter 210 ♦ Continuity 211 ♦ Bias 211 ♦ The SplineInterpolatorTest example 211 ♦ Creating the LOD behavior 214 ♦ Reading spline key frames from disk 215 ♦ Creating the texture-mapped sky backdrop 218 ♦ Controlling the extent of the audio for the helicopters 218
- 12.5 Summary 219
- 13 Writing custom behaviors 220
- 13.1 The BehaviorTest example 220
- 13.2 ObjectSizeBehavior 221
- 13.3 ExplodeBehavior 224
- 13.4 StretchBehavior 227
- 13.5 Using behaviors for debugging 230
- Calculating the rendered FPS using a behavior 231
- 13.6 Summary 232
- 14 Using texture images 234
- 14.1 Introduction 235
- Static mapping using per-vertex texture coordinates 237 ♦ Dynamic mapping using TexCoordGeneration 245
- 14.2 3D texture coordinates 251
- 14.3 Texture and multiple levels of detail 252
- Boundary color 252 ♦ Boundary mode 252 ♦ Setting the image 253 ♦ MIPMAP mode, filter, and multiple texture images 253
- 14.4 TextureAttributes 257
- Blend color 257 Mode 258 Transform 260
- 14.5 Using transparent geometry with transparent texture images 262
- 14.6 Animated (video) texture mapping 265
- 14.7 Summary 266
- 15 Geometry utility classes and object loaders 267
- 15.1 Introduction 267
- 15.2 Triangulator, normal vector generator, stripifier 268
- 15.3 Object loaders 270
- LoaderBase 270 SceneBase interface 270 Using the ObjectFile loader 271 Third-party object loaders 273
- 15.4 Summary 274
- 16 Object interaction?picking and collision detection 275
- 16.1 Introduction to picking 275
- 16.2 PickShapes 276
- 16.3 PickTool 277
- 16.4 PickCanvas 278
- 16.5 PickIntersection 278
- 16.6 PickResult 279
- 16.7 VRML picking example 280
- 16.8 Using picking for collision detection 293
- 16.9 Conclusions 300
- 17 Java 3D, Swing, and applets 301
- 17.1 Building the Java 3D Swing application 301
- 17.2 Adding support for running as an applet 318
- Original HTML applet code 319 ♦ Using the Java 2 plug-in HTMLConverter 320 ♦ The end-user experience 321 ♦ Automatic Java 3D installation 323 ♦ Applets and security 324
- 17.3 Conclusions 324
- 18 Java 3D system architecture 325
- 18.1 Introduction 325
- 18.2 Threads running a Java 3D application 326
- Native Windows threads running a Java 3D application 327
- 18.3 MasterControl 327
- System properties read by Java 3D 335
- 18.4 BehaviorScheduler 335
- 18.5 InputDeviceScheduler 336
- 18.6 Renderer 336
- GraphicsContext3D commands 337 ♦ RenderAtoms and RenderMolecule 337
- 18.7 StructureUpdateThread 338
- 18.8 TimerThread 338
- 18.9 SceneGraphObject 338
- 18.10 Node types 339
- 18.11 Exception Strings 340
- 18.12 J3D DLL 340
- Exported methods 340 ♦ Imported methods 344
- 18.13 Summary 348
- A Example code 349
- A.1 List of examples 349
- A.2 Installation notes 351
- A.3 Instructions for running the examples 352
- Running applet examples 352
- B Programming and graphics resources online 353
- C Primitives, the geometry cache, and GeomBuffer 358
- C.1 Box objects and GeomBuffer 358
- C.2 Primitives and the geometry cache 362
- C.3 GeomBuffer 363
 
bibliography 365
index 367