mitm001 5 rokov pred
rodič
commit
dceacfb1e5

+ 17 - 21
docs/modules/ROOT/pages/jme3/advanced/spatial.adoc

@@ -1,11 +1,7 @@
 = Spatial
-:author:
-:revnumber:
-:revdate: 2016/03/17 20:48
+:revnumber: 2.0
+:revdate: 2020/07/15
 :keywords: spatial, node, mesh, geometry, scenegraph
-:relfileprefix: ../../
-:imagesdir: ../..
-ifdef::env-github,env-browser[:outfilesuffix: .adoc]
 
 
 This is an introduction to the concept of Spatials, the elements of the 3D scene graph. The scene graph is a data structure that manages all objects in your 3D world. For example, the scene graph keeps track of the 3D models that you load and position. When you extend a Java class from com.jme3.app.SimpleApplication, you automatically inherit the scene graph and its rootNode.
@@ -29,7 +25,7 @@ a|
 2+a|com.jme3.scene.Spatial
 
 a| Purpose:
-2+a| A Spatial is an abstract data structure that stores user data and transformations (= translation, rotation, scale) of elements of the 3D scene graph. Spatials can be saved and loaded using the <<jme3/advanced/asset_manager#,Asset Manager>>.
+2+a| A Spatial is an abstract data structure that stores user data and transformations (= translation, rotation, scale) of elements of the 3D scene graph. Spatials can be saved and loaded using the xref:jme3/advanced/asset_manager.adoc[Asset Manager].
 
 <a|
 a| com.jme3.scene.Geometry
@@ -67,23 +63,23 @@ You never create a Spatial with `+++<strike>Spatial s = new Spatial();</strike>+
 
 === Mesh
 
-The polygon <<jme3/advanced/mesh#,Mesh>> inside a Geometry can be one of three things:
+The polygon xref:jme3/advanced/mesh.adoc[Mesh] inside a Geometry can be one of three things:
 
-*  *Shapes:* The simplest type of Meshes are jME's default <<jme3/advanced/shape#,Shape>>s such as cubes and spheres. You can use several Shapes to build complex Geometries. Shapes are built-in and can be created without using the AssetManager.
-*  *3D Models:* <<jme3/advanced/3d_models#,3D models and scenes>> are also made up of meshes, but are more complex than Shapes. You create Models and Scenes in external 3D Mesh Editors and export them as Ogre XML or Wavefront OBJ. Use the <<jme3/advanced/asset_manager#,Asset Manager>> to load models into a your jME3 game.
-*  *Custom Meshes:* Advanced users can create <<jme3/advanced/custom_meshes#,Custom Meshes>> programmatically.
+*  *Shapes:* The simplest type of Meshes are jME's default xref:jme3/advanced/shape.adoc[Shape]s such as cubes and spheres. You can use several Shapes to build complex Geometries. Shapes are built-in and can be created without using the AssetManager.
+*  *3D Models:* xref:jme3/advanced/3d_models.adoc[3D models and scenes] are also made up of meshes, but are more complex than Shapes. You create Models and Scenes in external 3D Mesh Editors and export them as Ogre XML or Wavefront OBJ. Use the xref:jme3/advanced/asset_manager.adoc[Asset Manager] to load models into a your jME3 game.
+*  *Custom Meshes:* Advanced users can create xref:jme3/advanced/custom_meshes.adoc[Custom Meshes] programmatically.
 
 
 == What is a Clone?
 
-Cloned spatials share the same mesh, while each cloned spatial can have its own local transformation (translation, rotation, and scale) in the scene. This means you only use `clone()` on spatials whose meshes never change. The most common use case for cloning is when you use several Spatials that are based on the same <<jme3/advanced/shape#,Shape>>s (e.g. trees, crates).
+Cloned spatials share the same mesh, while each cloned spatial can have its own local transformation (translation, rotation, and scale) in the scene. This means you only use `clone()` on spatials whose meshes never change. The most common use case for cloning is when you use several Spatials that are based on the same xref:jme3/advanced/shape.adoc[Shape]s (e.g. trees, crates).
 
 The second use case is: When you load a model using `loadModel()` from the AssetManager, you may automatically get a `clone()`ed object. In particular:
 
-*  If the model is not animated (it has no `<<jme3/advanced/animation#,AnimControl>>`), jME loads a clone. All clones share one mesh object in order to use less memory.
-*  If the model is animated (it has a `<<jme3/advanced/animation#,AnimControl>>`), then `loadModel()` duplicates the mesh for each loaded instance. (Uses more memory, but can animate.)
+*  If the model is not animated (it has no `xref:jme3/advanced/animation.adoc[AnimControl]`), jME loads a clone. All clones share one mesh object in order to use less memory.
+*  If the model is animated (it has a `xref:jme3/advanced/animation.adoc[AnimControl]`), then `loadModel()` duplicates the mesh for each loaded instance. (Uses more memory, but can animate.)
 
-Usually there is no need to manually use any of the `clone()` methods on models. Using the <<jme3/advanced/asset_manager#,Asset Manager>>'s `loadModel()` method will automatically do the right thing for your models.
+Usually there is no need to manually use any of the `clone()` methods on models. Using the xref:jme3/advanced/asset_manager.adoc[Asset Manager]'s `loadModel()` method will automatically do the right thing for your models.
 
 
 [NOTE]
@@ -100,7 +96,7 @@ You can include custom user data –that is, custom Java objects and methods–
 
 [IMPORTANT]
 ====
-You want to add custom accessor methods to a spatial? Do not extend `Node` or `Geometry`, use <<jme3/advanced/custom_controls#,Custom Controls>> instead. You want to add custom fields to a spatial? Do not extend `Node` or `Geometry`, use the built-in `setUserData()` method instead. Where ever the Spatial is accessible, you can easily access the object's class fields (user data) and accessors (control methods) this way.
+You want to add custom accessor methods to a spatial? Do not extend `Node` or `Geometry`, use xref:jme3/advanced/custom_controls.adoc[Custom Controls] instead. You want to add custom fields to a spatial? Do not extend `Node` or `Geometry`, use the built-in `setUserData()` method instead. Where ever the Spatial is accessible, you can easily access the object's class fields (user data) and accessors (control methods) this way.
 ====
 
 
@@ -111,7 +107,7 @@ This first example adds an integer field named `health` to the Spatial `playerNo
 playerNode.setUserData("health", 100);
 ----
 
-The second example adds a set of custom accessor methods to the player object. You create a <<jme3/advanced/custom_controls#,custom PlayerControl() class>> and you add this control to the Spatial:
+The second example adds a set of custom accessor methods to the player object. You create a xref:jme3/advanced/custom_controls.adoc[custom PlayerControl() class] and you add this control to the Spatial:
 
 [source,java]
 ----
@@ -144,7 +140,7 @@ playerNode.getControl(PlayerControl.class).setHealth(99);
 ----
 
 *  You can add as many data objects (of String, Boolean, Integer, Float, Array types) to a Spatial as you want. Just make sure to label them with unique case-sensitive strings (`health`, `Inventory`, `equipment`, etc).
-*  The saved data can even be a custom Java object if you make the custom Java class <<jme3/advanced/save_and_load#custom_savable_class,implement the Savable interface>>!
+*  The saved data can even be a custom Java object if you make the custom Java class xref:jme3/advanced/save_and_load.adoc#custom-savable-class[implement the Savable interface]!
 *  When you save a Spatial as a .j3o file, the custom data is saved, too, and all Savables are restored the next time you load the .j3o!
 
 This is how you list all data keys that are already defined for one Spatial:
@@ -181,7 +177,7 @@ There are two types of culling: Face culling, and view frustrum culling.
 
 *Face culling* means not drawing certain polygons of a mesh. Face culling behaviour is a property of the material.
 
-Usage: The “inside of a mesh (the so called backface) is typically never visible to the player, and as an optimization, the `Back` mode skips calculating all backfaces by default. Activating the `Off` or `Front` modes can be useful when you are debugging <<jme3/advanced/custom_meshes#,custom meshes>> and try to identify accidental inside-out faces.
+Usage: The “inside of a mesh (the so called backface) is typically never visible to the player, and as an optimization, the `Back` mode skips calculating all backfaces by default. Activating the `Off` or `Front` modes can be useful when you are debugging xref:jme3/advanced/custom_meshes.adoc[custom meshes] and try to identify accidental inside-out faces.
 
 You can switch the com.jme3.material.RenderState.FaceCullMode to either:
 
@@ -216,5 +212,5 @@ spatial.setCullHint(CullHint.Never); // always drawn
 
 == See also
 
-*  <<jme3/intermediate/optimization#,Optimization>> – The GeometryBatchFactory class batches several Geometries into meshes with each their own texture.
-*  <<jme3/advanced/traverse_scenegraph#,Traverse SceneGraph>> – Find any Node or Geometry in the scenegraph.
+*  xref:tutorials:intermediate/optimization.adoc[Optimization] – The GeometryBatchFactory class batches several Geometries into meshes with each their own texture.
+*  xref:jme3/advanced/traverse_scenegraph.adoc[Traverse SceneGraph] – Find any Node or Geometry in the scenegraph.