⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 virtualuniverse.html

📁 JAVA多媒体开发类库说明
💻 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 - Scene Graph Superstructure</title></head><body><h2>Scene Graph Superstructure</h2><p>Java 3D's superstructure consists of one or moreVirtualUniverse objects, each of which contains a set of one or morehigh-resolution Locale objects. The Locale objects, in turn, containcollections of subgraphs that comprise the scene graph (see <a href="#Figure_1">Figure1</a>).</p><p></p><h2>The Virtual Universe</h2>Java 3D defines the concept of a <em>virtual universe</em>as a three-dimensional space with an associated set of objects. Virtualuniverses serve as the largest unit of aggregate representation, andcan also be thought of as databases. Virtual universes can be verylarge, both in physical space units and in content. Indeed, in mostcases a single virtual universe will serve an application's entireneeds.<p>Virtual universes are separate entities in that no node object mayexist in more than one virtual universe at any one time. Likewise, theobjects in one virtual universe are not visible in, nor do theyinteract with objects in, any other virtual universe.</p><p>To support large virtual universes, Java 3D introduces the conceptof Locales that have <em>high-resolution coordinates</em>as an origin. Think of high-resolution coordinates as "tie-downs" thatprecisely anchor the locations of objects specified using less precisefloating-point coordinates that are within the range of influence ofthe high-resolution coordinates.</p><p>A Locale, with its associated high-resolution coordinates, serves asthe next level of representation down from a virtual universe. Allvirtual universes contain one or more high-resolution-coordinateLocales, and all other objects are attached to a Locale.High-resolution coordinates act as an upper-level translation-onlytransform node. For example, the coordinates of all objects that areattached to a particular Locale are all relative to the location ofthat Locale's high-resolution coordinates.</p><p><a name="Figure_1"></a><img style="width: 500px; height: 340px;" alt="The Virtual Universe" title="The Virtual Universe" src="VirtualUniverse.gif"></p><p></p><ul>  <font size="-1"><b><i>Figure 1</i> &#8211; The Virtual Universe</b></font></ul><p>While a virtual universe is similar to the traditional computergraphics concept of a scene graph, a given virtual universe can becomeso large that it is often better to think of a scene graph as thedescendant of a high-resolution-coordinate Locale.</p><p></p><h2>Establishing a Scene</h2>To construct a three-dimensional scene, the programmer must execute aJava 3D program. The Java 3D application must first create aVirtualUniverse object and attach at least one Locale to it. Then thedesired scene graph is constructed, starting with a BranchGroup nodeand including at least one ViewPlatform object, and the scene graph isattached to the Locale. Finally, a View object that references theViewPlatform object (see "<a href="intro.html#Structuring">Structuringthe Java 3D Program</a>")is constructed. As soon as a scene graph containing a ViewPlatform isattached to the VirtualUniverse, Java 3D's rendering loop is engaged,and the scene will appear on the drawing canvas(es) associated with theView object.<h2>Loading a Virtual Universe</h2>Java 3D is a runtime application programminginterface (API), not a file format. As an API, Java 3D provides nodirect mechanism for loading or storing a virtual universe.Constructing a scene graph involves the execution of a Java 3D program.However, loaders to convert a number of standard 3D file formats to orfrom Java 3D virtual universes are expected to be generally available.<h2>Coordinate Systems</h2>By default, Java 3D coordinate systems are right-handed, with theorientation semantics being that +<em>y</em> is the local gravitationalup, +<em>x</em> is horizontal to the right, and +<em>z</em> is directlytoward the viewer. The default units are meters.<h2>High-Resolution Coordinates</h2>Double-precision floating-point, single-precision floating-point, oreven fixed-point representations of three-dimensional coordinates aresufficient to represent and display rich 3D scenes. Unfortunately,scenes are not worlds, let alone universes. If one ventures even ahundred miles away from the (0.0, 0.0, 0.0) origin using onlysingle-precision floating-point coordinates, representable pointsbecome quite quantized, to at very best a third of an inch (and muchmore coarsely than that in practice).<p>To "shrink" down to a small size (say the size of an IC transistor),even very near (0.0, 0.0, 0.0), the same problem arises.</p><p>If a large contiguous virtual universe is to be supported, some formofhigher-resolution addressing is required. Thus the choice of 256-bitpositional components for "high-resolution" positions.</p><p></p><h3>Java 3D High-ResolutionCoordinates</h3>Java 3D high-resolution coordinates consist of three 256-bitfixed-point numbers, one each for <em>x</em>, <em>y</em>, and <em>z</em>.The fixed point is at bit 128, and the value 1.0 is defined to beexactly 1 meter. This coordinate system is sufficient to describe auniverse in excess of several hundred billion light years across, yetstill define objects smaller than a proton (down to below the plancklength). <a href="#Table_1">Table1</a> shows how many bits are needed above or below the fixed pointto represent the range of interesting physical dimensions.<p><a name="Table_1"></a><table bordercolorlight="#FFFFFF" bordercolordark="#000000" border="1" cellpadding="5" cellspacing="0">  <caption><font size="-1"><b> <i>Table 1</i> &#8211;Java 3D High-Resolution Coordinates </b></font></caption><tbody>    <tr bgcolor="#cccccc" valign="top">      <th><font color="#003366" size="-1">2<sup>n</sup> Meters </font></th>      <th><font color="#003366" size="-1">Units </font></th>    </tr>    <tr valign="top">      <td> 87.29</td>      <td>Universe (20 billion light years)&nbsp; <br>      </td>    </tr>    <tr valign="top">      <td> 69.68</td>      <td>Galaxy (100,000 light years) </td>    </tr>    <tr valign="top">      <td> 53.07</td>      <td>Light year </td>    </tr>    <tr valign="top">      <td> 43.43</td>      <td>Solar system diameter </td>    </tr>    <tr valign="top">      <td> 23.60</td>      <td>Earth diameter </td>    </tr>    <tr valign="top">      <td> 10.65</td>      <td>Mile </td>    </tr>    <tr valign="top">      <td> 9.97</td>      <td>Kilometer </td>    </tr>    <tr valign="top">      <td> 0.00</td>      <td>Meter </td>    </tr>    <tr valign="top">      <td> -19.93</td>      <td>Micron </td>    </tr>    <tr valign="top">      <td> -33.22</td>      <td>Angstrom </td>    </tr>    <tr valign="top">      <td> -115.57</td>      <td>Planck length </td>    </tr>  </tbody></table></p><p>A 256-bit fixed-point number also has the advantage of being able todirectly represent nearly any reasonable single-precisionfloating-point value <em>exactly</em>.</p><p>High-resolution coordinates in Java 3D are used only to embed moretraditional floating point coordinate systems within a muchhigher-resolution substrate. In this way a visually seamless virtualuniverse of any conceivable size or scale can be created, without worryabout numerical accuracy.</p><p></p><h3>Java 3D Virtual WorldCoordinates</h3>Within a given virtual world coordinate system, positions are expressedby three floating point numbers. The virtual world coordinate scale isin meters, but this can be affected by scale changes in the objecthierarchy.<h3>Details of High-ResolutionCoordinates</h3>High-resolution coordinates are represented as signed,two's-complement, fixed-point numbers consisting of 256 bits. AlthoughJava 3D keeps the internal representation of high-resolutioncoordinates opaque, users specify such coordinates using 8-elementinteger arrays. Java 3D treats the integer found at index 0 ascontaining the most significant bits and the integer found at index 7as containing the least significant bits of the high-resolutioncoordinate. The binary point is located at bit position 128, or betweenthe integers at index 3 and 4. A high-resolution coordinate of 1.0 is 1meter.<p>The semantics of how file loaders deal with high-resolutioncoordinatesis up to the individual file loader, as Java 3D does not directlydefine any file-loading semantics. However, some general advice can begiven (note that this advice is <em>not</em> officially part of theJava 3D specification).</p><p>For "small" virtual universes (on the order of hundreds of metersacross in relative scale), a single Locale with high-resolutioncoordinates at location (0.0, 0.0, 0.0) as the root node (below theVirtualUniverse object) is sufficient; a loader can automaticallyconstruct this node during the loading process, and the point inhigh-resolution coordinates does not need any direct representation inthe external file.</p><p>Larger virtual universes are expected to be constructed usually likecomputer directory hierarchies, that is, as a "root" virtual universecontaining mostly external file references to embedded virtualuniverses. In this case, the file reference object (user-specific datahung off a Java 3D group or hi-res node) defines the location for thedata to be read into the current virtual universe.</p><p>The data file's contents should be parented to the file object nodewhile being read, thus inheriting the high-resolution coordinates ofthe file object as the new relative virtual universe origin of theembedded scene graph. If this scene graph itself containshigh-resolution coordinates, it will need to be offset (translated) bythe amount in the file object's high-resolution coordinates and thenadded to the larger virtual universe as new high-resolutioncoordinates, with their contents hung off below them. Once again, thisprocedure is not part of the official Java 3D specification, but somemore details on the care and use of high-resolution coordinates inexternal file formats will probably be available as a Java 3Dapplication note.</p><p>Authoring tools that directly support high-resolution coordinatesshould create additional high-resolution coordinates as a user createsnew geometry "sufficiently" far away (or of different scale) fromexisting high-resolution coordinates.</p><p><strong>Semantics of widely moving objects</strong>. Most fixed andnearly-fixed objects stay attached to the same high-resolution Locale.Objects that make wide changes in position or scale may periodicallyneed to be reparented to a more appropriate high-resolution Locale. Ifno appropriate high-resolution Locale exists, the application may needto create a new one.</p><p><strong>Semantics of viewing</strong>. The ViewPlatform object andtheassociated nodes in its hierarchy are very often widely moving objects.Applications will typically attach the view platform to the mostappropriate high-resolution Locale. For display, all objects will firsthave their positions translated by the difference between the locationof their high-resolution Locale and the view platform's high-resolutionLocale. (In the common case of the Locales being the same, notranslation is necessary.)</p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -