JAVA 3D原创翻译 Getting Started with the Java 3D API。- 第一章 1.3 (上)

来源:互联网 发布:golang 调用c动态库 编辑:程序博客网 时间:2024/05/16 09:01

原创中英文对照  
本节讲解场景结构图的概念。和编程的流程图差不多,很重要,对于初学者了解数据结构很有价值。

 

1.3 Building a Scene Graph

 

 

 

A Java 3D virtual universe is created from a scene graph. A scene graph is created using instances of Java3D classes. The scene graph is assembled from objects to define the geometry, sound, lights, location, orientation, and appearance of visual and audio objects.

 


Java3D的虚拟世界是从场景图(Scene graph)中创建而来。场景图是用java3d类的势力来创建的。场景图由定义几何图形、声音、光照、地点、方向的物体构成。

 


A common definition of a graph is a data structure composed of nodes and arcs. A node is a data element,and arc is a relationship between data elements. The nodes in the scene graph are the instances of Java 3D classes. The arcs represent the two kinds of relationships between the Java 3D instances.

 


场景图通常的定义是用节点和线条来构成的一个数据结构图。节点是数据原始而线条则是两个元素之间的关系。场景图的节点是JAVA3D类的实例。线条描绘JAVA3D实例之间的两种关系。

 


The most common relationship is a parent-child relationship. A group node can have any number of children but only one parent. A leaf node can have one parent and no children. The other relationship is a reference. A reference associates a NodeComponent object with a scene graph Node. NodeComponent objects define the geometry and appearance attributes used to render the visual objects.

 


最普通的关系是父-子关系。一个Group节点可以拥有任意多个子节点,但仅允许存在一个父节点。一个Leaf节点可以拥有一个父节点并且不允许有子节点。另一种关系是引用。引用关系使NodeComponent对象与场景图节点产生联系。NodeComponent对象描述几何图形与其要被渲染的显示属性。

 

 

 

 

 

 

A Java 3D scene graphs is constructed of Node objects in parent-child relationships forming a tree structure. In a tree structure, one node is the root. Other nodes are accessible following arcs from the root. The arcs of a tree form no cycles. A scene graph is formed from the trees rooted at the Locale objects. The NodeComponents and reference arcs are not part of the scene graph tree.

 


JAVA3D的场景图是Node对象用父子关系构建起来一种树状结构。在这个树结构中,一个节点是跟,其他节点顺着线很容易顺藤摸瓜。树图的线是没有循环结构的。场景图是用在树状结构中的Local对象。NodeComponents和线条不是场景结构树的一部分。

 


Only one path exists from the root of a tree to each of the leaves; therefore, there is only one path from the root of a scene graph to each leaf node. The path from the root of a scene graph to a specific leaf node is the leaf node’s scene graph path. Since a scene graph path leads to exactly one leaf, there is one scene graph path for each leaf in the scene graph.

 


从根到各个子叶仅有一条路径存在;所以场景图中也只有一个路径从根到每个子节点。场景图中从根到特定的子节点的路径被称为这个子节点的场景结构路径(scene graph path)。因为只有一条路径到达各个子节点,所以每个子节也只有一个场景图路径。

 


Each scene graph path in a Java 3D scene graph completely specifies the state information of its leaf. State information includes the location, orientation, and size of a visual object. Consequently, the visual attributes of each visual object depend only on its scene graph path. The Java 3D renderer takes advantage of this fact and renders the leaves in the order it determines to be most efficient. The Java 3D programmer normally does not have control over the rendering order of objects2.

 


每个JAVA3D的场景结构路径都完全描述了他的子节点的状态信息。状态信息包括位置、方向、物体的大小。所以每个可视物体的可视属性只取决于它的场景图路径。JAVA3D的渲染器利用这个事实来保证它的高效率。JAVA3D的程序员通常不去控制物体渲染的过程。

 

 

 

 

 

 

                     本文为本人原创翻译,未经许可,不得转载。                          
                     仅供爱好者学习使用,喜欢可以收藏,不喜勿扰。                   
                     英语水平不高,如果纰漏欢迎高手斧正,感激先。                   

下集预告:1.3 创建场景图     (下)                                                                  

原创粉丝点击