Figure 6.2 The SimpleUniverse class encapsulates the details (Web site layout)
Figure 6.2 The SimpleUniverse class encapsulates the details of the view side of the scenegraph (lower branch). The ViewingPlatform has been highlighted and contains a MultiTransformGroup composed of two TransformGroups. Attached to the ViewPlatform are a PlatformGeometry Group and a ViewerAvatar Group. By attaching a Key behavior to one of the TransformGroups in the MultiTransformGroup, the View, PlatformGeometry, and ViewerAvatar can all be moved simultaneously and rendered into the Canvas3D attached to the view SimpleUniverseis a bit of a misnomer since the class is anything but simple, and this can cause initial confusion because of the plethora of support classes that it relies upon. SimpleUniverseintroduces five new (non-core-API) classes: Viewer, a container class that keeps references to the following: ViewerAvatar, a representation of the viewer of the scene. Canvas3D, used for rendering the scene. AWT Framecontains the Canvas3Dused for rendering. PhysicalBodyreferences the view s PhysicalBody. PhysicalEnvironmentreferences the view s PhysicalEnvironment. View is used for the viewer of the scene. ViewingPlatform(extends BranchGroup) helps set up the Viewside of the scenegraph by creating a hierarchy of TransformGroupsabove the ViewPlatformwhere the view is attached to the scenegraph. The hierarchy of TransformGroupsis encapsulated in a MultiTransformGroup. In this way a series of transformations can be applied to the view irrespective of transformations that are applied on the geometry side of the scenegraph. ViewerAvatar(extends BranchGroup) contains the geometry used to render the viewer s virtual self in the virtual environment. MultiTransformGroupis a simple encapsulation of a Vectorof TransformGroups. PlatformGeometry(extends BranchGroup) contains the geometry associated with the viewer s ViewingPlatform. For example, in a multiplayer gaming scenario, each player might be able to drive one of several vehicles. A ViewingPlatformwould represent each vehicle in the scenegraph, and the geometry for the vehicle would be attached to the ViewingPlatform. The player would be represented by geometry attached to the ViewerAvatar, which in turn would govern another player s view of the player, while the ViewingPlatformwould contain the geometry to describe the internal characteristics of the vehicle the player was riding in. By attaching the view to different ViewingPlatforms, the player can move between vehicles. In the PlatformTest example, two avatars (Dan and Jim) and three views are created: overhead, Dan s, and Jim s (figures 6.3 6.5). Each Avataris assigned ViewerAvatargeometry (a simple Cone pointing in the direction of view) and PlatformGeometry(a text label to identify the avatar). 88
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.