OSDN Git Service

41e8329b65b4b4365cf5f2b60284e4c2a2380846
[mikumikustudio/MikuMikuStudio.git] / sdk / jme3-documentation / src / com / jme3 / gde / docs / jme3 / the_scene_graph.html
1
2 <h1><a>The Scene Graph and Other jME3 Terminology</a></h1>
3 <div>
4
5 <p>
6
7 Before you start making games, make sure you understand general <a href="/com/jme3/gde/docs/jme3/terminology.html">3D Gaming terminology</a>.
8 </p>
9
10 <p>
11 Second, if you are a beginner, we recommend our <a href="/com/jme3/gde/docs/jme3/scenegraph_for_dummies.html">Scene Graph for Dummies</a> presentation for a visual introduction to the concept of a scene graph. 
12 </p>
13
14 <p>
15 Then continue learning about jME3 concepts here.
16 </p>
17
18 </div>
19 <!-- EDIT1 SECTION "The Scene Graph and Other jME3 Terminology" [1-396] -->
20 <h2><a>Coordinate System</a></h2>
21 <div>
22
23 <p>
24
25 <img src="nbdocs:/com/jme3/gde/docs/jme3/intermediate/coordinate-system.png">
26 </p>
27
28 <p>
29 The jMonkeyEngine uses a right-handed coordinate system, just as OpenGL does.
30 </p>
31
32 <p>
33 The coordinate system consists of:
34
35 </p>
36 <ul>
37 <li><div> The origin, a single point in space.</div>
38 <ul>
39 <li><div> This point is always at coordinate (0,0,0)</div>
40 </li>
41 </ul>
42 </li>
43 <li><div> Three coordinate axes that are mutually perpendicular, and meet in the origin. </div>
44 <ul>
45 <li><div> The X axis is &quot;right/left&quot;</div>
46 </li>
47 <li><div> The Y axis is &quot;up/down&quot;</div>
48 </li>
49 <li><div> The Z axis is &quot;towards you/away from you&quot;</div>
50 </li>
51 </ul>
52 </li>
53 </ul>
54
55 <p>
56
57 Every point in 3D space is defined by its (x,y,z) coordinates. The data type for vectors is com.jme3.math.Vector3f. 
58 </p>
59
60 <p>
61 For your orientation, the default camera&#039;s location is (0.0f,0.0f,10.0f), and it is looking in the direction described by the unit vector (0.0f, 0.0f, -1.0f). This means your point of view is on the positive side of the Z axis, looking towards the origin, down the Z axis.
62 </p>
63
64 <p>
65 The unit of meassurement is <code>world unit</code> (wu). Typically, 1 wu is considered to be one meter. All scales, vectors and points are relative to this coordinate system.
66 </p>
67
68 </div>
69 <!-- EDIT2 SECTION "Coordinate System" [397-1443] -->
70 <h2><a>Scene Graph and RootNode</a></h2>
71 <div>
72
73 <p>
74
75 The scene graph represents your 3D world. Objects in the jME3 scene graph are called <a href="/com/jme3/gde/docs/jme3/advanced/spatial.html">Spatial</a>s. Everything attached to the <em>rootNode</em> is part of the scene graph. <em>Attaching</em> a Spatial to the rootNode (or other nodes) adds the Spatial to the scene; <em>detaching</em> removes it.
76 </p>
77
78 <p>
79 <img src="nbdocs:/com/jme3/gde/docs/jme3/intermediate/scene-graph.png">
80 </p>
81
82 </div>
83 <!-- EDIT3 SECTION "Scene Graph and RootNode" [1444-1820] -->
84 <h2><a>Spatials: Node vs Geometry</a></h2>
85 <div>
86
87 <p>
88
89 A Spatial can be transformed, loaded and saved. There are two types of Spatials, <em>Nodes</em> and <em>Geometries</em>.
90
91 </p>
92 <div><table>
93         <tr>
94                 <td>  </td><th> Spatial </th>
95         </tr>
96         <tr>
97                 <th> Purpose: </th><td> A Spatial is an abstract data structure that stores transformations (translation, rotation, scale). </td>
98         </tr>
99         <tr>
100                 <td>  </td><th> Geometry </th><th> Node </th>
101         </tr>
102         <tr>
103                 <th> Visibility: </th><td> A visible 3-D object. </td><td> An invisible &quot;handle&quot; for a group of objects. </td>
104         </tr>
105         <tr>
106                 <th> Purpose: </th><td> Represents the &quot;look&quot; of an object: Shape, color, texture, opacity/transparency. </td><td> Groups Geometries and other Nodes together: You transform a Node to affect all attached Nodes. </td>
107         </tr>
108         <tr>
109                 <th> Content: </th><td> Transformations, mesh, material. </td><td> Transformations. No mesh, no material. </td>
110         </tr>
111         <tr>
112                 <th> Examples: </th><td> A box, a sphere, player, a building, a piece of terrain, a vehicle, missiles, NPCs, etc??? </td><td> The rootNode, the guiNode, an audio node, a custom grouping node, etc. </td>
113         </tr>
114 </table></div>
115 <!-- EDIT5 TABLE [1973-2678] -->
116 </div>
117 <!-- EDIT4 SECTION "Spatials: Node vs Geometry" [1821-2679] -->
118 <h2><a>How to Use This Knowledge?</a></h2>
119 <div>
120
121 <p>
122
123 Before you start creating your game, you should plan your scene graph: Which Nodes and Geometries will you need? Complete the <a href="/com/jme3/gde/docs/jme3/beginner.html">Hello World tutorial series</a> to learn how to load and create Spatials, how to lay out a scene by attaching, detaching, and transforming Spatials, and how to add interaction and effects to a game.
124 </p>
125
126 <p>
127 The <a href="/com/jme3/gde/docs/jme3.html">intermediate and advanced documentation</a> gives you more details on how to put all the parts together to create an awesome 3D game in Java!
128 </p>
129
130 </div>
131 <!-- EDIT6 SECTION "How to Use This Knowledge?" [2680-3212] -->
132 <h2><a>See also</a></h2>
133 <div>
134 <ul>
135 <li><div> <a href="/com/jme3/gde/docs/jme3/advanced/spatial.html">Spatial</a> ??? More details about working with Nodes and Geometries</div>
136 </li>
137 <li><div> <a href="/com/jme3/gde/docs/jme3/advanced/traverse_scenegraph.html">Traverse SceneGraph</a> ??? Find any Node or Geometry in the scenegraph.</div>
138 </li>
139 </ul>
140 <div><span>
141         <a href="/wiki/doku.php/tag:spatial?do=showtag&amp;tag=tag%3Aspatial">spatial</a>,
142         <a href="/wiki/doku.php/tag:node?do=showtag&amp;tag=tag%3Anode">node</a>,
143         <a href="/wiki/doku.php/tag:mesh?do=showtag&amp;tag=tag%3Amesh">mesh</a>,
144         <a href="/wiki/doku.php/tag:geometry?do=showtag&amp;tag=tag%3Ageometry">geometry</a>,
145         <a href="/wiki/doku.php/tag:scenegraph?do=showtag&amp;tag=tag%3Ascenegraph">scenegraph</a>,
146         <a href="/wiki/doku.php/tag:rootnode?do=showtag&amp;tag=tag%3Arootnode">rootnode</a>
147 </span></div>
148
149 </div>
150 <!-- EDIT7 SECTION "See also" [3213-] -->
151 <p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:the_scene_graph?do=export_xhtmlbody">view online version</a></em></p>