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

📄 scenegraphoverview.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 Overview</title></head><body><h2>Scene Graph Basics</h2><p>A scene graph consists of Java 3Dobjects, called <em>nodes</em>,arranged in a tree structure. The user creates one or more scenesubgraphs and attaches them to a virtual universe. The individualconnections between Java 3D nodes always represent a directedrelationship: parent to child. Java 3D restricts scene graphs in onemajor way: Scene graphs may not contain cycles. Thus, a Java 3D scenegraph is a directed acyclic graph (DAG). See <a href="#Figure_1">Figure1</a>.</p><p>Java 3D refines the <a href="../Node.html">Node</a> object classinto two subclasses: <a href="../Group.html">Group</a>and<a href="../Leaf.html">Leaf</a> node objects. Group node objects grouptogether one or more childnodes. A group node can point to zero or more children but can haveonly one parent. The SharedGroup node cannot have any parents (althoughit allows sharing portions of a scene graph, as described in "<a href="SceneGraphSharing.html">Reusing Scene Graphs</a>").Leaf node objects contain the actual definitions of shapes (geometry),lights, fog, sounds, and so forth. A leaf node has no children and onlyone parent. The semantics of the various group and leaf nodes aredescribed in subsequent chapters. </p><h2>Scene Graph Structure</h2><p>A scene graph organizes and controls the renderingof its constituent objects. The Java 3D renderer draws a scene graph ina consistent way that allows for concurrence. The Java 3D renderer candraw one object independently of other objects. Java 3D can allow suchindependence because its scene graphs have a particular form and cannotshare state among branches of a tree.</p><h3>Spatial Separation</h3><p>The hierarchy of the scene graph encourages a natural spatialgroupingon the geometric objects found at the leaves of the graph. Internalnodes act to group their children together. A group node also defines aspatial bound that contains all the geometry defined by itsdescendants. Spatial grouping allows for efficient implementation ofoperations such as proximity detection, collision detection, viewfrustum culling, and occlusion culling.</p><p><a name="Figure_1"></a><img style="width: 500px; height: 341px;" alt="Directed Acyclic Graph" title="Directed Acyclic Graph" src="DAG.gif"></p><p> </p><ul>  <font size="-1"><b><i>Figure 1</i> &#8211; A Java3D Scene Graph Is a DAG(Directed Acyclic Graph)</b></font></ul><p> </p><h3>State Inheritance</h3><p>A leaf node's state is defined by the nodes in a direct path betweenthe scene graph's root and the leaf. Because a leaf's graphics contextrelies only on a linear path between the root and that node, the Java3D renderer can decide to traverse the scene graph in whatever order itwishes. It can traverse the scene graph from left to right and top tobottom, in level order from right to left, or even in parallel. Theonly exceptions to this rule are spatially bounded attributes such aslights and fog.</p><p>This characteristic is in marked contrast to many older scenegraph-based APIs (including PHIGS and SGI's Inventor) where, if a nodeabove or to the left of a node changes the graphics state, the changeaffects the graphics state of all nodes below it or to its right. </p><p>The most common node object, along the path from the root to theleaf,that changes the graphics state is the TransformGroup object. TheTransformGroup object can change the position, orientation, and scaleof the objects below it. </p><p>Most graphics state attributes are set by a Shape3D leaf nodethroughits constituent Appearance object, thus allowing parallel rendering.The Shape3D node also has a constituent Geometry object that specifiesits geometry-this permits different shape objects to share commongeometry without sharing material attributes (or vice versa). </p><p> </p><h3>Rendering</h3><p>The Java 3D renderer incorporates all graphics state changes made inadirect path from a scene graph root to a leaf object in the drawing ofthat leaf object. Java 3D provides this semantic for both retained andcompiled-retained modes.</p><p> </p><h2>Scene Graph Objects</h2><p>A Java 3D scene graph consists of a collection of Java 3D nodeobjectsconnected in a tree structure. These node objects reference other scenegraph objects called <em>node component objects</em>.All scene graph node and component objects are subclasses of a common<a href="../SceneGraphObject.html">SceneGraphObject</a> class. TheSceneGraphObject class is an abstract classthat defines methods that are common among nodes and component objects.</p><p>Scene graph objects are constructed by creating a new instance ofthedesired class and are accessed and manipulated using the object's <code>set</code>and <code>get</code>methods. Once a scene graph object is created and connected to otherscene graph objects to form a subgraph, the entire subgraph can beattached to a virtual universe---via a high-resolution <a href="../Locale.html">Locale</a>object-making the object <em>live</em>. Prior to attaching a subgraphto a virtualuniverse, the entire subgraph can be <em>compiled</em> into anoptimized, internal format (see the<code><a href="../BranchGroup.html#compile%28%29">BranchGroup.compile()</a></code>method). </p><p>An important characteristic of all scene graph objects is thatthey canbe accessed or modified only during the creation of a scene graph,except where explicitly allowed. Access to most <code>set</code> and <code>get</code>methods of objects that are part of a live or compiled scene graph isrestricted. Such restrictions provide the scene graph compiler withusage information it can use in optimally compiling or rendering ascene graph. Each object has a set of capability bits that enablecertain functionality when the object is live or compiled. By default,all capability bits are disabled (cleared). Only those <code>set</code>and <code>get</code>methods corresponding to capability bits that are explicitly enabled(set) prior to the object being compiled or made live are legal.<br></p><p> </p><h2>Scene Graph SuperstructureObjects</h2>Java 3D defines two scene graph superstructure objects,<a href="../VirtualUniverse.html">VirtualUniverse</a>and <a href="../Locale.html">Locale</a>, which are used to containcollections of subgraphs thatcomprise the scene graph. These objects are described in more detail in"<a href="VirtualUniverse.html">Scene Graph Superstructure</a>."<p> </p><h3>VirtualUniverse Object</h3>A <a href="../VirtualUniverse.html">VirtualUniverse</a> objectconsists of a list of Locale objects thatcontain a collection of scene graph nodes that exist in the universe.Typically, an application will need only one VirtualUniverse, even forvery large virtual databases. Operations on a VirtualUniverse includeenumerating the Locale objects contained within the universe.<p> </p><h3>Locale Object</h3>The <a href="../Locale.html">Locale</a> object acts as a container fora collection of subgraphs ofthe scene graph that are rooted by a BranchGroup node. A Locale alsodefines a location within the virtual universe using high-resolutioncoordinates (HiResCoord) to specify its position. The HiResCoord servesas the origin for all scene graph objects contained within the Locale.<p>A Locale has no parent in the scene graph but is implicitlyattached toa virtual universe when it is constructed. A Locale may reference anarbitrary number of BranchGroup nodes but has no explicit children. </p><p>The coordinates of all scene graph objects are relative to theHiResCoord of the Locale in which they are contained. Operations on aLocale include setting or getting the HiResCoord of the Locale, addinga subgraph, and removing a subgraph. </p><p> </p><h2>Scene Graph Viewing Objects</h2>Java 3D defines five scene graph viewing objects that are not part ofthe scene graph per se but serve to define the viewing parameters andto provide hooks into the physical world. These objects are <a href="../Canvas3D.html">Canvas3D</a>,<a href="../Screen3D.html">Screen3D</a>, <a href="../View.html">View</a>,<a href="../PhysicalBody.html">PhysicalBody</a>, and <a href="../PhysicalEnvironment.html">PhysicalEnvironment</a>. They aredescribed in more detail in the "<a href="ViewModel.html">View Model</a>"document.<br><p> </p><h3>Canvas3D Object</h3>The <a href="../Canvas3D.html">Canvas3D</a> object encapsulates all ofthe parameters associated withthe window being rendered into.When a Canvas3D object is attached to a View object, the Java 3Dtraverser renders the specified view onto the canvas. Multiple Canvas3Dobjects can point to the same View object.<p> </p><h3>Screen3D Object</h3>The <a href="../Screen3D.html">Screen3D</a> object encapsulates all oftheparameters associated with the physical screen containing the canvas,such as the width and height of the screen in pixels, the physicaldimensions of the screen, and various physical calibration values.<p> </p><h3>View Object</h3>The <a href="../View.html">View</a> object specifies informationneeded to render the scene graph.<a href="#Figure_2">Figure2</a> shows a View object attached to a simple scene graph forviewing the scene.<p>The View object is the central Java 3D object for coordinating allaspects of viewing.All viewing parameters in Java 3D are directly contained either withinthe View object or within objects pointed to by a View object. Java 3Dsupports multiple simultaneously active View objects, each of which canrender to one or more canvases. </p><p> </p><h3>PhysicalBody Object</h3>The PhysicalBody object encapsulates all of theparameters associated with the physical body, such as head position,right and left eye position, and so forth.<p> </p><h3>PhysicalEnvironment Object</h3><p>The PhysicalEnvironment object encapsulates all of the parametersassociated with the physical environment, such as calibrationinformation for the tracker base for the head or hand tracker.<br></p><p><a name="Figure_2"></a><br></p><p><img style="width: 489px; height: 339px;" alt="Viewing a Scene Graph" title="Viewing a Scene Graph" src="ViewBranch.gif"></p><p> </p><ul>  <font size="-1"><b><i>Figure 2</i> &#8211; Viewing a Scene Graph</b></font></ul></body></html>

⌨️ 快捷键说明

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