📄 viewmodel.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Java 3D API - View Model</title></head><body><h2>View Model</h2><p>Java 3D introduces a new view model that takes Java'svision of "write once, run anywhere" and generalizes it to includedisplay devices and six-degrees-of-freedom input peripherals such ashead trackers. This "write once, view everywhere" nature of the newview model means that an application or applet written using the Java3D view model can render images to a broad range of display devices,including standard computer displays, multiple-projection displayrooms, and head-mounted displays, without modification of the scenegraph. It also means that the same application, once again withoutmodification, can render stereoscopic views and can take advantage ofthe input from a head tracker to control the rendered view.</p><p>Java 3D's view model achieves this versatility by cleanlyseparatingthe virtual and the physical world. This model distinguishes betweenhow an application positions, orients, and scales a ViewPlatform object(a viewpoint) within the virtual world and how the Java 3Drendererconstructs the final view from that viewpoint's position andorientation. The application controls the ViewPlatform's position andorientation; the renderer computes what view to render using thisposition and orientation, a description of the end-user's physicalenvironment, and the user's position and orientation within thephysical environment.</p><p>This document first explains why Java 3D chose a different viewmodeland some of the philosophy behind that choice. It next describes howthat model operates in the simple case of a standard computer screenwithout head tracking—the most common case. Finally, it presentsadvanced material that was originally published in Appendix C of theAPI specification guide.</p><p></p><h2>Why a New Model?</h2><p>Camera-based view models, as found in low-level APIs, givedeveloperscontrol over all rendering parameters. This makes sense when dealingwith custom applications, less sense when dealing with systems thatwish to have broader applicability: systems such as viewers or browsersthat load and display whole worlds as a single unit or systems wherethe end users view, navigate, display, and even interact with thevirtual world.</p><p>Camera-based view models emulate a camera in the virtual world, notahuman in a virtual world. Developers must continuously reposition acamera to emulate "a human in the virtual world."</p><p>The Java 3D view model incorporates head tracking directly, ifpresent,with no additional effort from the developer, thus providing end userswith the illusion that they actually exist inside a virtual world.</p><p>The Java 3D view model, when operating in a non-head-trackedenvironment and rendering to a single, standard display, acts very muchlike a traditional camera-based view model, with the addedfunctionality of being able to generate stereo views transparently.</p><p></p><h3>The Physical EnvironmentInfluences the View</h3><p>Letting the application control all viewing parameters is notreasonable in systems in which the physical environment dictates someof the view parameters.</p><p>One example of this is a head-mounted display (HMD), where theopticsof the head-mounted display directly determine the field of view thatthe application should use. Different HMDs have different optics,making it unreasonable for application developers to hard-wire suchparameters or to allow end users to vary that parameter at will.</p><p>Another example is a system that automatically computes viewparametersas a function of the user's current head position. The specification ofa world and a predefined flight path through that world may not exactlyspecify an end-user's view. HMD users would expect to look and thus seeto their left or right even when following a fixed path through theenvironment-imagine an amusement park ride with vehicles that followfixed paths to present content to their visitors, but visitors cancontinue to move their heads while on those rides.</p><p>Depending on the physical details of the end-user's environment, thevalues of the viewing parameters, particularly the viewing andprojection matrices, will vary widely. The factors that influence theviewing and projection matrices include the size of the physicaldisplay, how the display is mounted (on the user's head or on a table),whether the computer knows the user's head location in three space, thehead mount's actual field of view, the display's pixels per inch, andother such parameters. For more information, see "<a href="#View_Model_Details">View Model Details</a>."</p><p></p><h2>Separation of Physical andVirtual</h2><p>The Java 3D view model separates the virtual environment, wheretheapplication programmer has placed objects in relation to one another,from the physical environment, where the user exists, sees computerdisplays, and manipulates input devices.</p><p>Java 3D also defines a fundamental correspondence between theuser'sphysical world and the virtual world of the graphic application. Thisphysical-to-virtual-world correspondence defines a single common space,a space where an action taken by an end user affects objects within thevirtual world and where any activity by objects in the virtual worldaffects the end user's view.</p><p></p><h3>The Virtual World</h3><p>The virtual world is a common space in which virtual objects exist.Thevirtual world coordinate system exists relative to a high-resolutionLocale-each Locale object defines the origin of virtual worldcoordinates for all of the objects attached to that Locale. The Localethat contains the currently active ViewPlatform object defines thevirtual world coordinates that are used for rendering. Java3Deventually transforms all coordinates associated with scene graphelements into this common virtual world space.</p><h3>The Physical World</h3><p>The physical world is just that-the real, physical world. This isthespace in which the physical user exists and within which he or shemoves his or her head and hands. This is the space in which anyphysical trackers define their local coordinates and in which severalcalibration coordinate systems are described.</p><p>The physical world is a space, not a common coordinate systembetweendifferent execution instances of Java 3D. So while two differentcomputers at two different physical locations on the globe may berunning at the same time, there is no mechanism directly withinJava 3Dto relate their local physical world coordinate systems with eachother. Because of calibration issues, the local tracker (if any)defines the local physical world coordinate system known to aparticular instance of Java 3D.</p><p></p><h2>The Objects That Define theView</h2><p>Java 3D distributes its view model parameters across severalobjects,specifically, the View object and its associated component objects, thePhysicalBody object, the PhysicalEnvironment object, the Canvas3Dobject, and the Screen3D object. <a href="#Figure_1">Figure1</a> shows graphically the central role of the View object and thesubsidiary role of its component objects.</p><p><a name="Figure_1"></a><img style="width: 500px; height: 355px;" alt="View Object + Other Components" title="View Object + Other Components" src="ViewModel1.gif"></p><p></p><ul> <font size="-1"><b><i>Figure 1</i> – View Object, Its ComponentObjects, and TheirInterconnection</b></font></ul><p>The view-related objects shown in <a href="#Figure_1">Figure1</a>and their roles are as follows. For each of these objects, the portionof the API that relates to modifying the virtual world and the portionof the API that is relevant to non-head-tracked standard displayconfigurations are derived in this chapter. The remainder of thedetails are described in "<a href="#View_Model_Details">View ModelDetails</a>."</p><ul> <li><a href="../ViewPlatform.html"><em>ViewPlatform</em></a>: A leafnode that locates a view within ascene graph. The ViewPlatform's parents specify its location,orientation, and scale within the virtual universe. See "<a href="#ViewPlatform_Place">ViewPlatform: A Place in the Virtual World</a>,"for moreinformation. </li></ul><ul> <li><a href="../View.html"><em>View</em></a>: The main view object.It contains many pieces ofview state.</li></ul><ul> <li><a href="../Canvas3D.html"><em>Canvas3D</em></a>: The 3D versionof the Abstract WindowingToolkit(AWT) Canvas object. It represents a window in which Java 3D willdrawimages. It contains a reference to a Screen3D object and informationdescribing the Canvas3D's size, shape, and location within the Screen3Dobject.</li></ul><ul> <li><a href="../Screen3D.html"><em>Screen3D</em></a>: An object thatcontains information describingthe display screen's physical properties. Java 3D placesdisplay-screeninformation in a separate object to prevent the duplication of screeninformation within every Canvas3D object that shares a common screen.</li></ul><ul> <li><a href="../PhysicalBody.html">PhysicalBody</a>: An object thatcontains calibration informationdescribing the user's physical body.</li></ul><ul> <li><a href="../PhysicalEnvironment.html">PhysicalEnvironment</a>: Anobject that contains calibrationinformation describing the physical world, mainly information thatdescribes the environment's six-degrees-of freedom tracking hardware,if present.</li></ul><p>Together, these objects describe the geometry of viewing rather thanexplicitly providing a viewing or projection matrix. The Java 3Drenderer uses this information to construct the appropriate viewing andprojection matrices. The geometric focus of these view objects providesmore flexibility in generating views-a flexibility needed to supportalternative display configurations.</p><h2><a name="ViewPlatform_Place"></a>ViewPlatform: A Place in theVirtual World</h2><p>A ViewPlatform leaf node defines a coordinate system, and thus areference frame with its associated origin or reference point, withinthe virtual world. The ViewPlatform serves as a point of attachment forView objects and as a base for determining a renderer's view.</p><p><a href="#Figure_2">Figure2</a>shows a portion of a scene graph containing a ViewPlatform node. Thenodes directly above a ViewPlatform determine where that ViewPlatformis located and how it is oriented within the virtual world. Bymodifying the Transform3D object associated with a TransformGroup nodeanywhere directly above a ViewPlatform, an application or behavior canmove that ViewPlatform anywhere within the virtual world. A simpleapplication might define one TransformGroup node directly above aViewPlatform, as shown in <a href="#Figure_2">Figure2</a>.</p><p>A VirtualUniverse may have many different ViewPlatforms, but aparticular View object can attach itself only to a single ViewPlatform.Thus, each rendering onto a Canvas3D is done from the point of view ofa single ViewPlatform.</p><p><a name="Figure_2"></a><img style="width: 500px; height: 359px;" alt="View Platform Branch Graph" title="View Platform Branch Graph" src="ViewModel2.gif"></p><p></p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -