- update manual from wiki

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9388 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 7c18281818
commit eca1fae8bc
  1. 3
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/core-toc.xml
  2. 71
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/animation.html
  3. 228
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/application_states.html
  4. 135
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html
  5. 12
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio.html
  6. 9
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bloom_and_glow.html
  7. 8
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/camera.html
  8. 16
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/capture_audio_video_to_a_file.html
  9. 283
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html
  10. 7
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/custom_meshes.html
  11. 8
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html
  12. 27
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/input_handling.html
  13. 19
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html
  14. 32
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html
  15. 14
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/making_the_camera_follow_a_character.html
  16. 105
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/material_definitions.html
  17. 230
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html
  18. 9
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/monkey_zone.html
  19. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/mouse_picking.html
  20. 29
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multithreading.html
  21. 124
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html
  22. 4
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html
  23. 4
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html
  24. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html
  25. 6
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_popup_menu.html
  26. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html
  27. 36
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_scenarios.html
  28. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html
  29. 5
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/particle_emitters.html
  30. 447
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics.html
  31. 119
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html
  32. 16
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/post-processor_water.html
  33. 5
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/remote-controlling_the_camera.html
  34. 101
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/save_and_load.html
  35. 22
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/shape.html
  36. 4
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/spatial.html
  37. 43
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain.html
  38. 127
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/walking_character.html
  39. 11
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/android.html
  40. 9
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_animation.html
  41. 8
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html
  42. 4
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_audio.html
  43. 10
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html
  44. 6
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_effects.html
  45. 41
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html
  46. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html
  47. 10
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_material.html
  48. 16
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_node.html
  49. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_physics.html
  50. 5
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_picking.html
  51. 4
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_simpleapplication.html
  52. 10
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html
  53. 10
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_from_sources.html
  54. 39
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_jme3_sources_with_netbeans.html
  55. 95
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/faq.html
  56. 443
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/best_practices.html
  57. 106
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/headlessserver.html
  58. 368
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/how_to_use_materials.html
  59. 15
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/math.html
  60. 384
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/multi-media_asset_pipelinejme3/intermediate/optimization.html
  61. 61
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html
  62. 6
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/simpleapplication_from_the_commandline.html
  63. 342
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/terminology.html
  64. 14
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/application_deployment.html
  65. 17
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/asset_packs.html
  66. 62
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/blender.html
  67. 7
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/code_editor.html
  68. 14
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html
  69. 8
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/default_build_script.html
  70. 5
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development.html
  71. 18
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/model_loader.html
  72. 6
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/setup.html
  73. 11
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/filters.html
  74. 7
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/log_files.html
  75. 31
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/material_editing.html
  76. 12
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html
  77. 6
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/project_creation.html
  78. 11
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/scene_composer.html
  79. 7
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/scene_explorer.html
  80. 10
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/terrain_editor.html
  81. 95
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/troubleshooting.html
  82. 6
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/use_own_jme.html
  83. 32
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/vehicle_creator.html
  84. 10
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/version_control.html
  85. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/wiki-map.xml

@ -76,7 +76,8 @@
<tocitem text="Integrate a new model filetype and loader" target="sdk.development.model_loader"/>
<!-- </tocitem>-->
</tocitem>
<tocitem text="Updating jMP" target="com.jme3.gde.core.updating"/>
<tocitem text="Updating the SDK and Engine" target="com.jme3.gde.core.updating"/>
<tocitem text="Troubleshooting the SDK" target="sdk.troubleshooting"/>
</tocitem>
<tocitem text="jMonkeyEngine3 Engine" expand="true">
<tocitem text="Beginner Tutorials" expand="false">

@ -4,16 +4,26 @@
<p>
In 3D games, you do not only load static 3D models, you also want to be able to trigger animations in the model from the Java code. Animated models must be created in an external mesh editor (for example, Blender).
In 3D games, you do not only load static 3D models, you also want to be able to trigger animations in the model from the Java code.
</p>
</div>
<h2><a>Requirements</a></h2>
<div>
<p>
What is required for the model?
JME3 only loads and plays animated models, it does not create them.
</p>
<p>
What is required for an animated model? (<a href="/com/jme3/gde/core/docs/jme3/terminology#animation.html">See also: Animation terminology</a>)
</p>
<ol>
<li><div> For each model, you have to define a skeleton (bones rigging). </div>
<li><div> For each model, you have to segment the model into a skeleton (bone rigging). </div>
</li>
<li><div> For each motion, you have to specify how it distorts the model (skinning). </div>
<li><div> For each motion, you have to specify how the animation distorts parts of the model (skinning). </div>
</li>
<li><div> For each animation, you have to specify a series of snapshots of how the bones are positioned (keyframes).</div>
</li>
@ -23,16 +33,31 @@ What is required for the model?
<p>
More information: <a href="/com/jme3/gde/core/docs/jme3/terminology#animation.html">Animation</a>
Unless you download free models, or buy them from a 3D artist, you must create your animated models in an <strong>external mesh editor</strong> (for example, Blender) yourself.
</p>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/sdk/blender.html">Converting Blender Models to JME3 (.J3o files)</a></div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.youtube.com/user/aramakara"><param name="text" value="<html><u>Video Series: Creating models in Blender, OgreMax, 3dsMax</u></html>"><param name="textColor" value="blue"></object></div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.youtube.com/watch?v=NdjC9sCRV0s"><param name="text" value="<html><u>Video: Creating and Exporting OgreXML Animations from Blender 2.61 to JME3 </u></html>"><param name="textColor" value="blue"></object></div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://docs.google.com/fileview?id=0B9hhZie2D-fENDBlZDU5MzgtNzlkYi00YmQzLTliNTQtNzZhYTJhYjEzNWNk&amp;hl=en"><param name="text" value="<html><u>Scene Workflow: Exporting OgreXML scenes from Blender to JME3</u></html>"><param name="textColor" value="blue"></object></div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://docs.google.com/leaf?id=0B9hhZie2D-fEYmRkMTYwN2YtMzQ0My00NTM4LThhOTYtZTk1MTRlYTNjYTc3&amp;hl=en"><param name="text" value="<html><u>Animation Workflow: Create Animated UV-Mapped OgreXML Models in Blender, and use them in JME3</u></html>"><param name="textColor" value="blue"></object></div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.youtube.com/watch?v=IDHMWsu_PqA"><param name="text" value="<html><u>Video: Creating Worlds with Instances in Blender</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<p>
What is required in your java class?
What is required in your JME3-based Java class?
</p>
<ul>
<li><div> One animation controller per animated Model</div>
<li><div> One Animation Control per animated model</div>
</li>
<li><div> As many channels per controller as you need to play several animations in parallel. In simple cases one channel is enough, sometimes you need two or more per model.</div>
<li><div> As many Animation Channels per Control as you need to play your animations. In simple cases one channel is enough, sometimes you need two or more Channels per model to play gestures and motions in parallel.</div>
</li>
</ul>
@ -62,26 +87,26 @@ What is required in your java class?
</div>
<h3><a>The Controller</a></h3>
<h3><a>The Animation Control</a></h3>
<div>
<p>
Create one <code>com.jme3.animation.AnimControl</code> object in your JME3 application for each animated model that you want to control. You have to register each animated model to one of these Animation Controllers. The control object gives you access to the available animation sequences in the model.
Create one <code>com.jme3.animation.AnimControl</code> object in your JME3 application for each animated model that you want to control. You have to register each animated model to one of these Animation Controls. The control object gives you access to the available animation sequences in the model.
</p>
<pre> AnimControl playerControl; // you need one controller per model
<pre> AnimControl playerControl; // you need one Control per model
Node player = &#40;Node&#41; assetManager.loadModel&#40;&quot;Models/Oto/Oto.mesh.xml&quot;&#41;; // load a model
playerControl = player.getControl&#40;AnimControl.class&#41;; // get control over this model
playerControl.addListener&#40;this&#41;; // add listener</pre>
</div>
<h3><a>Channels</a></h3>
<h3><a>Animation Channels</a></h3>
<div>
<p>
A controller has several animation channels (<code>com.jme3.animation.AnimChannel</code>). Each channel can play one animation sequence at a time.
An Animation Control has several Animation Channels (<code>com.jme3.animation.AnimChannel</code>). Each channel can play one animation sequence at a time.
</p>
<p>
@ -92,7 +117,7 @@ There often are situations where you want to run several animation sequences at
...</pre>
<p>
To reset a controller, call <code>control.clearChannels();</code>
To reset a Control, call <code>control.clearChannels();</code>
</p>
</div>
@ -127,7 +152,7 @@ removeListener(animEventListener) <br/>
clearListeners() </td><td>Adds or removes listeners to receive animation related events.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [3269-3738] --><div><table>
<!-- EDIT1 TABLE [4347-4816] --><div><table>
<tr>
<th>AnimControl Property</th><th>Usage</th>
</tr>
@ -148,7 +173,7 @@ removeAnim(boneAnim)</td><td>Adds or removes an animation from this Control.</td
<td>getAnimationLength(&quot;anim&quot;)</td><td>Returns the length of the given named animation in seconds</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [3740-4300] --><div><table>
<!-- EDIT2 TABLE [4818-5378] --><div><table>
<tr>
<th>AnimControl Property</th><th>Usage</th>
</tr>
@ -162,7 +187,7 @@ removeAnim(boneAnim)</td><td>Adds or removes an animation from this Control.</td
<td>getAttachmentsNode(&quot;bone&quot;)</td><td>Returns the attachment node of a bone. Attach models and effects to this node to make them follow this bone&#039;s motions.</td>
</tr>
</table></div>
<!-- EDIT3 TABLE [4302-4617] -->
<!-- EDIT3 TABLE [5380-5695] -->
</div>
<h2><a>Animation Channel Properties</a></h2>
@ -193,7 +218,7 @@ The following properties are set per AnimChannel.
<td>setTime(1.3f); </td><td> Fast-forward or rewind to a certain moment in time of this animation. </td>
</tr>
</table></div>
<!-- EDIT4 TABLE [4713-5337] -->
<!-- EDIT4 TABLE [5791-6415] -->
<p>
The following information is available for a channel.
@ -219,7 +244,7 @@ The following information is available for a channel.
<td>getControl()</td><td>The AnimControl that belongs to this AnimChannel.</td>
</tr>
</table></div>
<!-- EDIT5 TABLE [5394-6027] -->
<!-- EDIT5 TABLE [6472-7105] -->
<p>
Use the following methods to add or remove individual bones to an AnimChannel. This is useful when you play two animations in parallel on two channels, and each controls a subset of the bones (e.g. one the arms, and the other the legs).
@ -245,7 +270,7 @@ addToRootBone(bone1) </td><td>Add a series of bones to be influenced by this ani
addFromRootBone(bone1) </td><td>Add a series of bones to be influenced by this animation channel: Add all bones, starting from the given root bone, going towards the children bones.</td>
</tr>
</table></div>
<!-- EDIT6 TABLE [6267-6888] -->
<!-- EDIT6 TABLE [7345-7966] -->
</div>
<h2><a>Playing Animations</a></h2>
@ -265,7 +290,7 @@ Animations are played by channel. <strong>Note:</strong> Whether the animation c
The float value specifies the time how long the animation should overlap with the previous one on this channel. If set to 0f, then no blending will occur and the new animation will be applied instantly.</td>
</tr>
</table></div>
<!-- EDIT7 TABLE [7076-7402] -->
<!-- EDIT7 TABLE [8154-8480] -->
<p>
<strong>Tip:</strong> Use the AnimEventLister below to react at the end or start of an animation cycle.
@ -328,7 +353,7 @@ The onAnimCycleDone() event is invoked when an animation cycle has ended. For no
You have access to the following objects:
</p>
<ul>
<li><div> The controller to which the listener is assigned.</div>
<li><div> The Control to which the listener is assigned.</div>
</li>
<li><div> The animation channel being played.</div>
</li>
@ -357,7 +382,7 @@ The onAnimChange() event is invoked every time before an animation is set by the
You have access to the following objects
</p>
<ul>
<li><div> The controller to which the listener is assigned.</div>
<li><div> The Control to which the listener is assigned.</div>
</li>
<li><div> The animation channel being played.</div>
</li>

@ -3,56 +3,91 @@
<div>
<p>
<code>com.jme3.app.state.AppState</code> is a customizable jME3 interface that allows you to control the global game logic (game mechanics). To control the behaviour of a type of Spatial, see <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Custom Controls</a> instead – both can be used together.
The <code>com.jme3.app.state.AppState</code> class is a customizable jME3 interface that allows you to control the global game logic – the overall game mechanics. (To control the behaviour of a Spatial, see <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Custom Controls</a> instead. Controls and AppStates can be used together.)
</p>
</div>
<h2><a>Use Case</a></h2>
<h2><a>Overview</a></h2>
<div>
</div>
<h3><a>Use Case Examples</a></h3>
<div>
<p>
There will be situations during your game development where you think:
There are situations during your game development where you think:
</p>
<ul>
<li><div> Can I group a set of input handler settings, and activate and deactivate them all in one step? (e.g. mouse and key inputs are handled different in-game versus in the main menu.) </div>
<li><div> Mouse and key inputs are handled differently in-game versus in the main menu. Can I group a set of input handler settings, and activate and deactivate them all in one step? </div>
</li>
<li><div> Can I group a bunch of nodes and swap them in and out in one step? (e.g. the in-game scene, versus a character editor, versus a Captain&#039;s Quarters screen)</div>
<li><div> I have the in-game scene, and a character editor, and a Captain&#039;s Quarters screen. Can I group a set of nodes and behaviours, and swap them in and out in one step?</div>
</li>
<li><div> Can I define what happens while the game is paused/unpaused, and toggle that in one step? </div>
<li><div> When I pause the game, I want the character&#039;s &quot;idle&quot; animation to continue, but all other loops and game events should stop. How do I define what happens when the game is paused/unpaused? </div>
</li>
<li><div> Can I wrap up one set of game mechanics and switch it on and off in one step? (e.g. a conditional block that takes up a lot of space in my update loop)</div>
<li><div> I have a conditional block that takes up a lot of space in my simpleUpdate() loop. Can I wrap up this block of code, and switch it on and off in one step?</div>
</li>
<li><div> Can I package all of the above that belongs <em>in-game</em>, and also everthing that belongs to the main menu, and switch between these two &quot;big&quot; states in one step? </div>
<li><div> Can I package everything that belongs in-game, and everything that belongs to the menu screen, and switch between these two &quot;big states&quot; in one step? </div>
</li>
</ul>
<p>
Yes you can! This is what AppStates are there for. A game state can be a subset of class fields (game data), <acronym title="Graphical User Interface">GUI</acronym> elements and their interactions, a subset of input handlers, a subset of nodes in the simpleInitApp() method, a subset of actions that you branch to in the simpleUpdate() loop, a set of AppStates and Controls – or combinations thereof.
You can! This is what AppStates are there for. An AppState class is subset of (or an extension to) your application. Every AppState class has access to all fields in your main application (AssetManager, ViewPort, StateManager, InputManager, RootNode, GuiNode, etc) and hooks into the main update loop. An AppState can contain:
</p>
<ul>
<li><div> a subset of class fields, functions, methods (game state data and accessors), </div>
</li>
<li><div> a subset of <acronym title="Graphical User Interface">GUI</acronym> elements and their listeners, </div>
</li>
<li><div> a subset of input handlers and mappings, </div>
</li>
<li><div> a subset of nodes that you load and attach to the rootNode, </div>
</li>
<li><div> a subset of conditional actions that you branch to in the simpleUpdate() loop, </div>
</li>
<li><div> a subset of other AppStates and Controls</div>
</li>
<li><div> … or combinations thereof. </div>
</li>
</ul>
</div>
<h3><a>Supported Features</a></h3>
<div>
<p>
Each AppState is such a grouped subset of such game states. Each AppState has hooks that let you define what happens to this set in the following situations:
Each AppState lets you define what happens in the following situations:
</p>
<ul>
<li><div> the AppState is initialized: You load and initialize game data, InputHandlers, AppStates and Controls and attach nodes.</div>
<li><div> <strong>The AppState is initialized:</strong> You load and initialize game data, InputHandlers, AppStates and Controls and attach nodes. <br/>
The AppState has its own simpleInitApp() method, so to speak.</div>
</li>
<li><div> <strong>The AppState has been enabled (unpaused):</strong> This toggles a boolean isEnabled() to true. Here you attach nodes and listeners that should become active while it&#039;s running. </div>
</li>
<li><div> <strong>While the AppState is running/paused:</strong> You can poll isEnabled() to define paused and unpaused game behaviour in the update() loop that. Polls and modify the game state, modify the scene graph, and triggers events. If !isEnabled(), write code that skips the running sections of this AppState&#039;s <code>update()</code> loop. <br/>
Each AppState has its own update loop, which hooks into the main simpleUpdate() loop (callback). </div>
</li>
<li><div> the AppState is cleaned up: You save the game state, unregister Controls, AppStates and InputHandlers, and detach nodes.</div>
<li><div> <strong>The AppState has been disabled (paused):</strong> This toggles a boolean isEnabled() to false. Switch to your specific &quot;paused&quot; state. </div>
</li>
<li><div> the AppState is temporarly disabled/enabled (paused/unpaused): You toggle a boolean to skip certain actions of the update loop, you display a paused screen <acronym title="Graphical User Interface">GUI</acronym>, and change the input handlers. </div>
<li><div> <strong>The AppState is cleaned up:</strong> Here you decide whether to save this AppState&#039;s game state, unregister Controls and InputHandlers, detach related AppStates, and detach nodes from the rootNode.</div>
</li>
</ul>
<p>
<strong>Tip:</strong> You can create AppStates that enable and disable sets of other AppStates, e.g. InGameState versus MainScreenState.
<p><div>Tip: AppStates are extremely handy to swap out, or pause/unpause whole sets of other AppStates. For example, an InGameState (loads in-game <acronym title="Graphical User Interface">GUI</acronym>, activates click-to-shoot input mappings, inits game content, starts game loop) versus MainScreenState (stops game loop, saves and detaches game content, switches to menu screen <acronym title="Graphical User Interface">GUI</acronym>, switches to click-to-select input mappings).
</div></p>
</p>
</div>
<h2><a>Usage</a></h2>
<h3><a>Usage</a></h3>
<div>
<p>
@ -60,7 +95,9 @@ Each AppState is such a grouped subset of such game states. Each AppState has ho
To implement game logic:
</p>
<ol>
<li><div> You define a custom AppState and implement its behaviour in the AppState&#039;s update() method.</div>
<li><div> Create one AbstractAppState instance for each set of game mechanics. </div>
</li>
<li><div> Implement game behaviour in the AppState&#039;s update() method.</div>
<ul>
<li><div> You can pass custom data as arguments in the constructor.</div>
</li>
@ -68,20 +105,20 @@ To implement game logic:
</li>
</ul>
</li>
<li><div> Attach all AppStates to your application&#039;s AppStateManager (<code>stateManager.attach(myAppState);</code>), and activate and deactivate the ones you need.</div>
<li><div> Attach the AppState to the AppStateManager (<code>stateManager.attach(myAppState);</code>).</div>
</li>
<li><div> Create one AppState for each set of game mechanics. </div>
<li><div> Activate and deactivate (unpause and pause) the AppStates that you need.</div>
</li>
</ol>
<p>
When you add several AppStates to one Application and activate them, their init methods and update loops are executed in the order in which the AppStates were added.
When you add several AppStates to one Application and activate them, their initialize() methods and update() loops are executed in the order in which the AppStates were added to the AppStateManager.
</p>
</div>
<h2><a>Examples</a></h2>
<h3><a>Code Samples</a></h3>
<div>
<p>
@ -89,7 +126,7 @@ When you add several AppStates to one Application and activate them, their init
JME3 comes with a BulletAppState that implements Physical behaviour (using the jBullet library). You, for example, could write an Artificial Intelligence AppState to control all your enemy units. Existing examples in the code base include:
</p>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/jbullet/com/jme3/bullet/"><param name="text" value="<html><u>BulletAppState</u></html>"><param name="textColor" value="blue"></object> controls physical behaviour in PhysicsControl&#039;ed Spatials.</div>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/bullet-common/com/jme3/bullet/BulletAppState.java"><param name="text" value="<html><u>BulletAppState</u></html>"><param name="textColor" value="blue"></object> controls physical behaviour in PhysicsControl&#039;ed Spatials.</div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/app/state/TestAppStates.java"><param name="text" value="<html><u>TestAppStates.java</u></html>"><param name="textColor" value="blue"></object> an example of a custom AppState</div>
<ul>
@ -106,7 +143,7 @@ JME3 comes with a BulletAppState that implements Physical behaviour (using the j
<p>
The AppState interface allows you to initialize sets of objects, and hook a sets of continously executing code into the main loop.
The AppState interface lets you initialize sets of objects, and hook a set of continously executing code into the main loop.
</p>
<div><table>
@ -114,36 +151,38 @@ The AppState interface allows you to initialize sets of objects, and hook a sets
<th>AppState Method</th><th>Usage</th>
</tr>
<tr>
<td>stateAttached(asm) <br/>
stateDetached(asm)</td><td>The AppState knows when it is attached to, or detached from, the AppStateManager, and triggers these two methods. Here you implement what happens then.</td>
<td>initialize(asm,app)</td><td>When this AppState is added to the game, the RenderThread initializes the AppState and then calls this method. You can modify the scene graph from here (e.g. attach nodes). To get access to the main app, call: <pre>super.initialize&#40;stateManager, app&#41;;
this.app = &#40;SimpleApplication&#41; app;</pre>
</td>
</tr>
<tr>
<td>initialize(asm,app)</td><td>The RenderThread initialized the AppState and then calls this method. Here you implement initSimpleApp()-style initialization code. </td>
<td>cleanup()</td><td>This methid is executed after you remove the AppState from the game. Here you implement clean-up code for when this state is detached. You can modify the scene graph from here (e.g. detach nodes).</td>
</tr>
<tr>
<td>isInitialized()</td><td>Your implementations of this interface should return the correct respective boolean value.</td>
<td>update(float tpf)</td><td>Here you implement the behaviour that you want to hook into the simpleUpdate() loop while this state is attached to the game. You can modify the scene graph from here.</td>
</tr>
<tr>
<td>setActive(true) <br/>
setActive(false)</td><td>Temporarily enables or disables an AppState. </td>
<td>isInitialized()</td><td>Your implementations of this interface should return the correct respective boolean value. (See AbstractAppState)</td>
</tr>
<tr>
<td>isActive()</td><td>Test whether AppState is enabled or disabled. Your implementation should consider the boolean.</td>
<td>setActive(true) <br/>
setActive(false)</td><td>Temporarily enables or disables an AppState. (See AbstractAppState) </td>
</tr>
<tr>
<td>update(float tpf)</td><td>Here you implement the behaviour that you want to hook into the simpleUpdate() loop.</td>
<td>isActive()</td><td>Test whether AppState is enabled or disabled. Your implementation should consider the boolean. (See AbstractAppState)</td>
</tr>
<tr>
<td>cleanup()</td><td>Called when when the AppState is de-initialized. Here you implement what clean-up code for this state.</td>
<td>stateAttached(asm) <br/>
stateDetached(asm)</td><td>The AppState knows when it is attached to, or detached from, the AppStateManager, and triggers these two methods. Don&#039;t modify the scene graph from here! (Typically not used.) </td>
</tr>
<tr>
<td>render(RenderManager rm)</td><td>Renders the state, plus your optional customizations.</td>
<td>render(RenderManager rm)</td><td>Renders the state, plus your optional customizations. (Typically not used.)</td>
</tr>
<tr>
<td>postRender()</td><td>Called after all rendering commands are flushed, including your optional customizations.</td>
<td>postRender()</td><td>Called after all rendering commands are flushed, including your optional customizations. (Typically not used.)</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [3823-4902] -->
<!-- EDIT1 TABLE [5293-6855] -->
</div>
<h2><a>AbstractAppState</a></h2>
@ -151,55 +190,101 @@ setActive(false)</td><td>Temporarily enables or disables an AppState. </td>
<p>
The AbstractAppState class already implements some common methods and makes creation of custom AppStates a bit easier: isInitialized(), setActive(), isActive(), cleanUp(). Just extend it and override the remaining AppState methods.
The AbstractAppState class already implements some common methods (<code>isInitialized(), setActive(), isActive()</code>) and makes creation of custom AppStates a bit easier. We recommend you extend AbstractAppState and override the remaining AppState methods: <code>initialize(), setEnabled(), cleanUp()</code>.
</p>
<p>
Definition:
</p>
<pre>public class MyAppState extends AbstractAppState &#123;
private Node x = new Node&#40;&quot;x&quot;&#41;; // some class field
&nbsp;
private SimpleApplication app;
&nbsp;
public Node getX&#40;&#41;&#123;
return x; // implement custom methods for this field
private Node x = new Node&#40;&quot;x&quot;&#41;; // some custom class fields...
public Node getX&#40;&#41;&#123; return x; &#125; // some custom methods...
&nbsp;
@Override
public void initialize&#40;AppStateManager stateManager, Application app&#41; &#123;
super.initialize&#40;stateManager, app&#41;;
this.app = &#40;SimpleApplication&#41;app; // cast to a more specific class
&nbsp;
// init stuff that is independent of whether state is PAUSED or RUNNING
this.app.getRootNode&#40;&#41;.attachChild&#40;getX&#40;&#41;&#41;; // modify scene graph...
this.app.doSomething&#40;&#41;; // call custom methods...
&#125;
&nbsp;
@Override
public void update&#40;float tpf&#41; &#123;
x.doSomething&#40;&#41;; // call some methods here
public void cleanup&#40;&#41; &#123;
super.cleanup&#40;&#41;;
// unregister all my listeners, detach all my nodes, etc...
this.app.getRootNode&#40;&#41;.detachChild&#40;getX&#40;&#41;&#41;; // modify scene graph...
this.app.doSomethingElse&#40;&#41;; // call custom methods...
&#125;
&nbsp;
@Override
public void initialize&#40;AppStateManager stateManager, Application app&#41; &#123;
super.initialize&#40;stateManager, app&#41;;
this.app=&#40;SimpleApplication&#41;app;
app.doSomething&#40;&#41;; // call some methods elsewhere
public void setEnabled&#40;boolean enabled&#41; &#123;
// Pause and unpause
super.setEnabled&#40;enabled&#41;;
if&#40;enabled&#41;&#123;
// init stuff that is in use while this state is RUNNING
this.app.getRootNode&#40;&#41;.attachChild&#40;getX&#40;&#41;&#41;; // modify scene graph...
this.app.doSomethingElse&#40;&#41;; // call custom methods...
&#125; else &#123;
// take away everything not needed while this state is PAUSED
...
&#125;
&#125;
&nbsp;
@Override
public void update&#40;float tpf&#41; &#123;
if&#40;isEnabled&#40;&#41;&#41;&#123;
// do the following while game is RUNNING
this.app.getRootNode&#40;&#41;.getChild&#40;&quot;blah&quot;&#41;.scale&#40;tpf&#41;; // modify scene graph...
x.setUserData&#40;...&#41;; // call some methods...
&#125; else &#123;
// do the following while game is PAUSED, e.g. play an idle animation.
...
&#125;
&#125;
&nbsp;
&#125;</pre>
</div>
<h2><a>Pausing and Unpausing</a></h2>
<div>
<p>
You define what an AppState does when Paused or Unpaused, in the <code>setEnabled()</code> and <code>update()</code> methods. Call <code>myState.setEnabled(false)</code> on all states that you want to pause. Call <code>myState.setEnabled(true)</code> on all states that you want to unpause.
</p>
</div>
<h2><a>AppStateManager</a></h2>
<div>
<p>
The com.jme3.app.state.AppStateManager holds the list of AppStates for an application. AppStateManager ensures that active AppStates are updated and rendered. When an AppState is attached, AppStateManager calls its stateAttached() method. When an AppState is detached, AppStateManager calls its stateDetached() method.
There is one AppStateManager per application. You can attach several AppStates to one AppStateManager, but the same state can only be attached once.
The com.jme3.app.state.AppStateManager holds the list of AppStates for an application. AppStateManager ensures that activate AppStates can modify the scene graph, and that the update() loops of active AppStates is executed. There is one AppStateManager per application. You typically attach several AppStates to one AppStateManager, but the same state can only be attached once.
</p>
<div><table>
<tr>
<th>AppStateManager Method</th><th>Usage</th>
</tr>
<tr>
<td>hasState(s)</td><td>Is AppState s attached?</td>
<td>hasState(myState)</td><td>Is AppState object &#039;myState&#039; attached?</td>
</tr>
<tr>
<td>getState(Class&lt;T&gt; stateClass)</td><td>Returns the first state that is an instance of a subclass of the specified class.</td>
<td>getState(MyAppState.class)</td><td>Returns the first attached state that is an instance of a subclass of <code>MyAppState.class</code>.</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [6328-6510] -->
<!-- EDIT2 TABLE [9796-10006] -->
<p>
The AppStateManager&#039;s update(), render(), postRender(), and cleanUp() methods are internal, users never call them directly.
The AppStateManager&#039;s <code>render(), postRender(), cleanUp()</code> methods are internal, ignore them, users never call them directly.
</p>
</div>
@ -207,32 +292,49 @@ The AppStateManager&#039;s update(), render(), postRender(), and cleanUp() metho
<h2><a>Best Practices</a></h2>
<div>
<p>
You can only change AppStates, or read and write to them, from certain places: In a Control&#039;s update() method, in an AppState&#039;s update() method, and in the SimpleApplication&#039;s simpleUpdate() loop (or the Application&#039;s update() loop).
To get data from the AppState <code>MyAppState</code>:
</div>
</p>
<pre>app.getState&#40;MyAppState.class&#41;.getInfoAboutSomething&#40;&#41;;</pre>
<h3><a>Communication Among AppStates</a></h3>
<div>
<p>
To pass new data into the AppState <code>MyAppState</code>:
You can only access other AppStates (read from and write to them) from certain places: From a Control&#039;s update() method, from an AppState&#039;s update() method, and from the SimpleApplication&#039;s simpleUpdate() loop. Don&#039;t mess with the AppState from other places, because from other methods you have no control over the order of modifications; the game can go out of sync because you can&#039;t know when (during which half-finished step of another state change) your modification will be performed.
</p>
<pre>app.getState&#40;MyAppState.class&#41;.setSomething&#40;blah&#41;;</pre>
<p>
To trigger a one-off method in the AppState <code>MyAppState</code>:
You can use custom accessors to get data from AppStates, to set data in AppStates, or to trigger methods in AppStates.
</p>
<pre>app.getState&#40;MyAppState.class&#41;.doSomeMoreStuff&#40;&#41;;</pre>
<pre>this.app.getStateManager&#40;&#41;.getState&#40;MyAppState.class&#41;.doSomeCustomStuffInThisState&#40;&#41;;</pre>
<p>
</div>
<h3><a>Initialize Familiar Class Fields</a></h3>
<div>
Don&#039;t mess with the AppState from other places, because from other methods you have no control over the order of updates. You don&#039;t know when (during which half-finished step of an update), your call was received.
<p>
To access class fields of the application the way you are used to, initialize them to local variables:
</p>
<pre>private SimpleApplication app;
private Node rootNode;
private AssetManager assetManager;
private AppStateManager stateManager;
private InputManager inputManager;
private ViewPort viewPort;
private BulletAppState bullet;
&nbsp;
public void initialize&#40;AppStateManager stateManager, Application app&#41; &#123;
super.initialize&#40;stateManager, app&#41;;
this.app = &#40;SimpleApplication&#41; app; // can cast Application to something more specific
this.rootNode = this.app.getRootNode&#40;&#41;;
this.assetManager = this.app.getAssetManager&#40;&#41;;
this.stateManager = this.app.getStateManager&#40;&#41;;
this.inputManager = this.app.getInputManager&#40;&#41;;
this.viewPort = this.app.getViewPort&#40;&#41;;
this.bullet = this.stateManager.getState&#40;BulletAppState.class&#41;;
&#125;</pre>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:application_states?do=export_xhtmlbody">view online version</a></em></p>

@ -7,31 +7,54 @@
JME3 has an integrated an asset manager that helps you keep your project assets organized. By assets we mean media files, such as 3D models, materials, textures, scenes, shaders, sounds, and fonts. Think of the asset manager as the filesystem of your game, independent of the actual deployment platform. It also manages the appropriate managing of OpenGL objects like textures so that they are e.g. not uploaded to the graphics card multiple times when multiple models use them.
</p>
</div>
<h4><a>Context</a></h4>
<div>
<pre>jMonkeyProjects/MyGame/assets/ # You store assets in subfolders here! &lt;------
jMonkeyProjects/MyGame/build/ # SDK generates built classes here (*)
jMonkeyProjects/MyGame/build.xml # You customize Ant build script here
jMonkeyProjects/MyGame/nbproject/ # SDK stores default build.xml and meta data (*)
jMonkeyProjects/MyGame/dist/ # SDK generates executable distribution here (*)
jMonkeyProjects/MyGame/src/ # You store Java sources here
jMonkeyProjects/MyGame/test/ # You store test classes here (optional)
(*) Managed by jMonkeyEngine SDK -- don&#039;t edit!</pre>
<p>
See also <a href="/com/jme3/gde/core/docs/jme3/intermediate/best_practices.html">Best Practices</a>.
</p>
</div>
<h2><a>Usage</a></h2>
<div>
<p>
The <code>assetManager</code> object is an com.jme3.asset.AssetManager instance that every com.jme3.app.Application can access. It maintains a root that also includes your project&#039;s classpath by default, so you can load any asset that&#039;s on the classpath, that is, the top level of your project directory.
</p>
<p>
You can use the inherited <code>assetManager</code> object directly, or use the accessor <code>getAssetManager()</code>.
You can use the inherited <code>assetManager</code> object directly, or use the accessor <code>app.getAssetManager()</code>.
</p>
<p>
Here is an example how you load assets using the AssetManager. This lines loads a default Material from the Common directory:
Here is an example how you load assets using the AssetManager. This lines loads a default Material from the built-in <code>Common/</code> directory:
</p>
<pre>Material mat = &#40;Material&#41; assetManager.loadAsset&#40;
new AssetKey&#40;&quot;Common/Materials/RedColor.j3m&quot;&#41;&#41;;</pre>
<p>
The Material is &quot;somewhere&quot; in the jME3 JAR, but the default Asset Manager is configured to handle a <code>Common/…</code> path correctly, so you don&#039;t have to specify the whole path.
This Material is &quot;somewhere&quot; in the jME3 JAR; the default Asset Manager is configured to handle a <code>Common/…</code> path correctly, so you don&#039;t have to specify the whole path when referring to built-in assets (such as default Materials).
</p>
<p>
Additionally, You can configure the Asset Manager and add any path to its root. This means, you can load assets from any project directory you specify.
Additionally, you can configure the Asset Manager and add any path to its root. This means, you can load assets from any project directory you specify. The next example shows how you load assets from your project&#039;s assets directory.
</p>
</div>
<h2><a>Asset Folder</a></h2>
<h2><a>Asset Directory</a></h2>
<div>
<p>
@ -42,24 +65,34 @@ By default, jME3 searches for models in a directory named <code>assets</code>. <
<p>
This is our recommended directory structure for storing assets:
</p>
<pre>MyGame/assets/Interface/
MyGame/assets/MatDefs/
MyGame/assets/Materials/
MyGame/assets/Models/
MyGame/assets/Scenes/
MyGame/assets/Shaders/
MyGame/assets/Sounds/
MyGame/assets/Textures/
MyGame/build.xml # build script
MyGame/src/... # source code</pre>
<pre>jMonkeyProjects/MyGame/src/... # Packages, .java source code.
jMonkeyProjects/MyGame/assets/... # The assets directory:
jMonkeyProjects/MyGame/assets/Interface/ # .font, .jpg, .png, .xml
jMonkeyProjects/MyGame/assets/MatDefs/ # .j3md
jMonkeyProjects/MyGame/assets/Materials/ # .j3m
jMonkeyProjects/MyGame/assets/Models/ # .j3o
jMonkeyProjects/MyGame/assets/Scenes/ # .j3o
jMonkeyProjects/MyGame/assets/Shaders/ # .j3f, .vert, .frag
jMonkeyProjects/MyGame/assets/Sounds/ # .ogg, .wav
jMonkeyProjects/MyGame/assets/Textures/ # .jpg, .png; also .mesh.xml+.material, .mtl+.obj, .blend (!) </pre>
<p>
These are just the most common examples. <strong>You can rename/delete/add directories and subdirectories inside the <code>assets</code> directory</strong> in any way you like. Note however that there is no automatic refactoring for asset paths in the <acronym title="Software Development Kit">SDK</acronym>, so if you modify them late in the development process, you have to refactor all paths manually.
</p>
<p>
These are just the most common examples. You can name the directories inside the <code>assets</code> directory what ever you like.
<strong>Examples:</strong> You can rename <code>assets/Sounds</code> to <code>assets/Audio</code>, you can delete <code>assets/MatDefs</code> if you don&#039;t use it, you can create <code>assets/AIscripts</code>, etc. You can rename/move the <code>assets/Textures</code> directory or its subdirectories, but then you have to re-export all models, and re-convert them all to .j3o, so plan ahead!
</p>
<p>
<p><div>Store textures in <code>assets/Textures/</code> before you work with them in a mesh editor! Export and save 3D model files (.mesh.xml+.material, .mtl+.obj, .blend) into the <code>assets/Textures/</code> (!) before you convert the model to binary format (.j3o)! This ensures that texture paths correctly point to the <code>assets/Textures</code> directory. <br/>
After the conversion, you move the .j3o file into the <code>assets/Models/</code> or <code>assets/Scenes/</code> directories. This way, you can reuse textures, your binaries consistently link the correct textures, and the <code>assets/Models</code> and <code>assets/Scenes</code> directories don&#039;t become cluttered.
</div></p>
</p>
</div>
<h2><a>Examples: Loading Assets</a></h2>
<h2><a>Example Code: Loading Assets</a></h2>
<div>
<p>
@ -71,7 +104,6 @@ Creating a material instance with the definition &quot;Unshaded.j3md&quot;:
assetManager, &quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;</pre>
<p>
Applying a texture to the material:
</p>
@ -111,7 +143,8 @@ jME3 also offers a ClasspathLocator, ZipLocator, FileLocator, HttpZipLocator, an
</p>
<p>
<strong>Note:</strong> The custom build script does not automatically include ZIP files in the executable build.
<p><div>The custom build script does not automatically include all ZIP files in the executable build. See &quot;Cannot Locate Resource&quot; solution below.
</div></p>
</p>
</div>
@ -142,7 +175,7 @@ rootNode.attachChild&#40;scene&#41;;</pre>
</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [3755-4683] -->
<!-- EDIT1 TABLE [6199-7127] -->
</div>
<h2><a>NullPointerException: Cannot locate resource?</a></h2>
@ -150,7 +183,11 @@ rootNode.attachChild&#40;scene&#41;;</pre>
<p>
Even if the game runs fine when started from the jMoneykPlatform, an error message similar to the following can occur in the console when you run the stand-alone executables (.JAR, .JNLP, etc).
<strong>Problem:</strong>
</p>
<p>
My game runs fine when I run it right from the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>. But when I run the stand-alone executables (.jar, .jnlp .exe, .app), a DesktopAssetManager error message occurs in the console, and it quits?
</p>
<pre>com.jme3.asset.DesktopAssetManager loadAsset
WARNING: Cannot locate resource: Scenes/town/main.scene
@ -163,7 +200,7 @@ java.lang.NullPointerException</pre>
</p>
<p>
If you use the default build script created by the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> then <strong>the original OgreXML files are not included in the executable.</strong> A stand-alone executable <strong>works with .j3o files only</strong>. The default build script makes sure to include .j3o files in the executable.
If you use the default build script, <strong>original models and scenes, and ZIP files, are excluded from the distribution</strong> automatically. A stand-alone executable includes <strong>converted .j3o models and scenes only</strong>. The default build script makes sure to include existing .j3o files in the distribution, but you need to convert the models manually.
</p>
<p>
@ -171,41 +208,73 @@ If you use the default build script created by the jMonkeyEngine <acronym title=
</p>
<p>
Before building the executable, you must use the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s context menu action to <a href="/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html">convert OgreXML models to .j3o format</a>.
Before building the executable, you must use the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s context menu action to <a href="/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html">convert 3D models to .j3o binary format</a>.
</p>
<ol>
<li><div> Open the jME3 Project in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>.</div>
</li>
<li><div> Browse the <code>assets</code> directory in the Projects window. </div>
<li><div> Browse to the <code>assets</code> directory in the Projects window. </div>
</li>
<li><div> Right-click a .mesh.xml or .obj or .scene file, and choose &quot;convert to JME3 binary&quot;. </div>
<li><div> Right-click a .mesh.xml/.scene/.obj file, and choose &quot;convert to JME3 binary&quot;. </div>
</li>
<li><div> The converted file appears in the same directory as the .mesh.xml file. It has the same name and a .j3o suffix. </div>
</li>
<li><div> Make sure to change the loading code to load the file with a .j3o suffix now.</div>
<li><div> Move the .j3o file into the <code>assets/Models/</code> or <code>assets/Scenes/</code> directories.</div>
</li>
<li><div> Update the file name in the <code>load()</code> code to access the .j3o file.</div>
</li>
</ol>
<p>
If you load the scene from a non.j3o ZIP file, expand the <a href="/com/jme3/gde/core/docs/sdk/default_build_script.html">default_build_script</a> to copy the ZIP files.
<p><div>If you load the scene from a non-.j3o ZIP file, ammend the <a href="/com/jme3/gde/core/docs/sdk/default_build_script.html">default_build_script</a> manully to copy the ZIP files into the distribution.
</div></p>
</p>
</div>
<h2><a>Asset Handling: Codeless Projects</a></h2>
<h2><a>Asset Handling For Other IDEs: Codeless Projects</a></h2>
<div>
<p>
If you are using another IDE than jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> for coding, you should create a so-called codeless project in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> to maintain assets. This method will not meddle with your sources or custom build scripts. It simply makes it easier for you to browse game assets, and preview, arrange, and especially convert models to binary.
<strong>Problem:</strong>
</p>
<p>
I use another IDE than jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> for coding (Eclipse, IntelliJ, text editor). Where is my <code>asset</code> folder and .j3o converter?
</p>
<p>
<strong>Solution:</strong>
</p>
<p>
You can code in any IDE, but you must create a so-called codeless project in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> to maintain assets. <strong>A code-less jMonkeyEngine project does not meddle with your sources or custom build scripts.</strong> You merely use it to convert models to .j3o binaries.
</p>
<ul>
<li><div> You use your favorite IDE to code and use the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> only for jME3 assets maintenance.</div>
<ol>
<li><div> Create your (Eclipse or whatever) project as you like.</div>
</li>
<li><div> Create a directory in your project folder and name it, for example, <code>assets</code>. <br/>
Store your assets there as described above.</div>
</li>
<li><div> Download and install the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>.</div>
</li>
<li><div> In the <acronym title="Software Development Kit">SDK</acronym>, go to File → Import Projects → External Project Assets.</div>
</li>
<li><div> Select your (Eclipse or whatever) project and your assets folder in the Import Wizard.</div>
</li>
<li><div> You can also ask the graphic designers in your team to install the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> and give them access to such a codeless project.</div>
<li><div> You can now open this (Eclipse or whatever) project in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>. <br/>
Convert assets as described above.</div>
</li>
</ul>
</ol>
<p>
<p><div>Use file version control and let team members check out the project. Your developers open the project in Eclipse (etc) as they are used to. Additionally to their graphic tools, ask your graphic designers to install the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>, and to check out the codeless project that you just prepared. This makes it easy for non-coding team member to browse and preview game assets, to arrange scenes, and to convert files. At the same time, non-coders don&#039;t accidentally mess with code, and developers don&#039;t accidentally mess with assets. :)
</div></p>
</p>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:asset_manager?do=export_xhtmlbody">view online version</a></em></p>

@ -66,10 +66,10 @@ There are other obvious getters to poll the status of corresponding setters belo
<td>setVolume(1)</td><td>Sets the volume gain. 1 is the default volume, 2 is twice as loud, etc. 0 is silent/mute. </td>
</tr>
<tr>
<td>setPitch(1)</td><td>Makes the sound play in a higher or lower pitch. Default is 1. 2 is twice as high, .5f is half as low. </td>
<td>setPitch(1)</td><td>Makes the sound play in a higher or lower pitch. Default is 1. 2 is twice as high, .5f is half as high. </td>
</tr>
</table></div>
<!-- EDIT2 TABLE [1368-1616] --><div><table>
<!-- EDIT2 TABLE [1368-1617] --><div><table>
<tr>
<th>AudioNode Method</th><th>Usage</th>
</tr>
@ -91,7 +91,7 @@ setDirectional(false)</td><td>All 3D effects switched off. This sound is global
<td>setMaxDistance(100f)</td><td>Maximum distance the sound can be heard, in world units. Default is 20.</td>
</tr>
</table></div>
<!-- EDIT3 TABLE [1618-2352] --><div><table>
<!-- EDIT3 TABLE [1619-2353] --><div><table>
<tr>
<th>AudioNode Method</th><th>Usage</th>
</tr>
@ -103,7 +103,7 @@ setLocalTranslation(…)</td><td>Activates 3D audio: The sound appears to come f
<td>setReverbEnabled(true)</td><td>A 3D echo effect that only makes sense to use with positional AudioNodes. The reverb effect is influenced by the environment that the audio renderer is in. See &quot;Setting Environment Properties&quot; below. </td>
</tr>
</table></div>
<!-- EDIT4 TABLE [2354-2826] --><div><table>
<!-- EDIT4 TABLE [2355-2827] --><div><table>
<tr>
<th>AudioNode Method</th><th>Usage</th>
</tr>
@ -116,7 +116,7 @@ setDirection(…) </td><td>Activates 3D audio: This sound can only be heard from
setOuterAngle()</td><td>Set the angle in degrees for the directional audio. The angle is relative to the direction. Note: By default, both angles are 360° and the sound can be heard from all directions!</td>
</tr>
</table></div>
<!-- EDIT5 TABLE [2828-3355] -->
<!-- EDIT5 TABLE [2829-3356] -->
</div>
<h2><a>Play, Pause, Stop</a></h2>
@ -185,7 +185,7 @@ Optionally, You can choose from the following environmental presets from <code>c
<td>Closet </td><td>1.00f</td><td>1.0f</td><td>1.0f</td><td>1.00f</td><td>0.15f</td><td>1.0f</td><td>0.600f</td><td>0.0025f</td><td>0.500f</td><td>0.0006f</td>
</tr>
</table></div>
<!-- EDIT6 TABLE [4930-5419] -->
<!-- EDIT6 TABLE [4931-5420] -->
<p>
Activate the preset with setEnvironment(). E.g. in a dungeon environment:

@ -86,8 +86,8 @@ Here you can see the diffuse map of the tank, and the associated glow map that o
</p>
<p>
Glow maps works with Lighting.j3md, Particles.j3md and SolidColor.j3md material definitions.
The tank material looks like that :
Glow maps work with Lighting.j3md, Particles.j3md and SolidColor.j3md material definitions.
The tank material looks like this :
</p>
<pre>Material My Material : Common/MatDefs/Light/Lighting.j3md {
@ -279,6 +279,11 @@ If you are using a glow color, set it to black
</p>
<pre>material.setColor(&quot;GlowColor&quot;,ColorRGBA.Black);</pre>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:effect?do=showtag&amp;tag=tag%3Aeffect">effect</a>,
<a href="/wiki/doku.php/tag:light?do=showtag&amp;tag=tag%3Alight">light</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:bloom_and_glow?do=export_xhtmlbody">view online version</a></em></p>

@ -94,7 +94,7 @@ The camera object is created with the following defaults:
<p>
The flyby camera is an extension of the default camera in com.jme3.app.SimpleApplication. It is preconfigured to respond to the WASD keys for walking forwards and backwards, and for strafing to the sides. Move the mouse to rotate the camera, scroll the mouse wheel for zooming in or out. The QZ keys raise or lower the camera.
The flyby camera is an AppState that extends the default camera in com.jme3.app.SimpleApplication. It is preconfigured to respond to the WASD keys for walking forwards and backwards, and strafing to the sides; move the mouse to rotate the camera (&quot;Mouse Look&quot;), scroll the mouse wheel for zooming in or out. The QZ keys raise or lower the camera vertically.
</p>
<div><table>
@ -111,10 +111,10 @@ The flyby camera is an extension of the default camera in com.jme3.app.SimpleApp
<td>flyCam.setRotationSpeed(10);</td><td>Control the rotation speed</td>
</tr>
<tr>
<td>flyCam.setDragToRotate(true)</td><td>Must keep mouse button pressed to rotate camera. Used e.g. for Applets. if false, all mouse movement will be captured and interpreted as rotations.</td>
<td>flyCam.setDragToRotate(true)</td><td>Forces the player to keep mouse button pressed to rotate camera, typically used for Applets. If false (default), all mouse movement will be captured and interpreted as rotations.</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [2295-2646] -->
<!-- EDIT2 TABLE [2326-2708] -->
</div>
<h2><a>Chase Camera</a></h2>
@ -164,7 +164,7 @@ ChaseCamera chaseCam = new ChaseCamera&#40;cam, target, inputManager&#41;;</pre>
<td>chaseCam.setDefaultHorizontalRotation(-FastMath.PI/2);</td><td>The default horizontal rotation angle of the camera around the target at the start of the application.</td>
</tr>
</table></div>
<!-- EDIT3 TABLE [2955-4427] --><div><span>
<!-- EDIT3 TABLE [3017-4489] --><div><span>
<a href="/wiki/doku.php/tag:camera?do=showtag&amp;tag=tag%3Acamera">camera</a>,
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>
</span></div>

@ -4,14 +4,6 @@
<p>
<p><div>A/V recording is still in development.
It works for all of jMonkeyEngine&#039;s test cases.
If you experience any problems or
if something isn&#039;t clear, please <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/members/bortreb/"><param name="text" value="<html><u>let me know</u></html>"><param name="textColor" value="blue"></object>. – bortreb
</div></p>
</p>
<p>
So you&#039;ve made your cool new JMonkeyEngine3 game and you want to
create a demo video to show off your hard work. Or maybe you want to
make a cutscene for your game using the physics and characters in the
@ -64,6 +56,14 @@ That&#039;s all!
<p>
<p><div>This way of A/V recording is still in development.
It works for all of jMonkeyEngine&#039;s test cases.
If you experience any problems or
if something isn&#039;t clear, please <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/members/bortreb/"><param name="text" value="<html><u>let me know</u></html>"><param name="textColor" value="blue"></object>. – bortreb
</div></p>
</p>
<p>
If you want to record audio as well, record at different framerates,
or record from multiple viewpoints at once, then there&#039;s a full
solution for doing this already made for you here:

@ -3,7 +3,11 @@
<div>
<p>
A <code>com.jme3.scene.control.Control</code> is a customizable jME3 interface that allows you to cleanly steer the behaviour of game entities: Traps, alarms, doors, animal NPCs, self-steering vehicles, artificially intelligent behaviour in NPCs, anything that moves. Several instances of Controls together implement the behaviours of a type of Spatial. To control global game behaviour see <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">Application States</a> – you can also use both together.
A <code>com.jme3.scene.control.Control</code> is a customizable jME3 interface that allows you to cleanly steer the behaviour of game entities (Spatials), such as artificially intelligent behaviour in NPCs, traps, automatic alarms and doors, animals and pets, self-steering vehicles or platforms – anything that moves and interacts. Several instances of customs Controls together implement the behaviours of a type of Spatial.
</p>
<p>
To control global game behaviour see <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">Application States</a> – you often use AppStates and Control together.
</p>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.youtube.com/watch?v=MNDiZ9YHIpM"><param name="text" value="<html><u>Quick video introduction to Custom Controls</u></html>"><param name="textColor" value="blue"></object></div>
@ -12,222 +16,306 @@ A <code>com.jme3.scene.control.Control</code> is a customizable jME3 interface t
<p>
To control the behaviour of types of entities:
To control the behaviour of spatials:
</p>
<ol>
<li><div> Create one control for each type of behavior. When you add several controls to one spatial, they will be executed in the order they were added. <br/>
For example, an NPC can be controlled by a PhysicsControl and an AIControl.</div>
<li><div> Create one control for each <em>type of behavior</em>. When you add several controls to one spatial, they will be executed in the order they were added. <br/>
For example, one NPC can be controlled by a PhysicsControl instance and an AIControl instance.</div>
</li>
<li><div> Define the custom control and implement its behaviour in the Control&#039;s update() method:</div>
<li><div> Define the custom control and implement its behaviour in the Control&#039;s update method:</div>
<ul>
<li><div> You can pass arguments into your custom control.</div>
</li>
<li><div> In the control class, the object <code>spatial</code> gives you access to the spatial that the control is attached to.</div>
<li><div> In the control class, the object <code>spatial</code> gives you access to the spatial and subspatials that the control is attached to.</div>
</li>
<li><div> Modify the <code>spatial</code>&#039;s transformation (move, scale, rotate), play animations, check for enemies around it and react, etc. </div>
<li><div> Here you modify the <code>spatial</code>&#039;s transformation (move, scale, rotate), play animations, check its environement, define how it acts and reacts. </div>
</li>
</ul>
</li>
<li><div> Add an instance of the control to a spatial, and the Spatial&#039;s game state is updated automatically from now on. <pre>spatial.addControl&#40;myControl&#41;;</pre>
<li><div> Add an instance of the Control to a spatial to give it this behavior. The spatial&#039;s game state is updated automatically from now on. <pre>spatial.addControl&#40;myControl&#41;;</pre>
</div>
</li>
</ol>
<p>
To implement game logic for a type of spatial, you will either extend AbstractControl, or implement the Control interface, as explained in this article.
To implement game logic for a type of spatial, you will either extend AbstractControl (most common case), or implement the Control interface, as explained in this article.
</p>
</div>
<h2><a>Usage Examples</a></h2>
<h2><a>Usage</a></h2>
<div>
<p>
For example, you could write a CharacterAnimControl that animates a character accordingly while it is being moved by a CharacterControl. Or you can write an AIControl that remote-controls NPC behaviour in fight situatons. Or you could write a DestructionControl that automatically replaces a structure with an appropriate piece of debris after collision with a projectile… The possibilities are endless. <img src="/wiki/lib/images/smileys/icon_smile.gif" class="middle" alt=":-)" />
Existing examples in the code base include:
Use <span><a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Controls</a></span> to implement the <em>behaviour of types of game entities</em>.
</p>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/animation/AnimControl.java"><param name="text" value="<html><u>AnimControl.java</u></html>"><param name="textColor" value="blue"></object> allows manipulation of skeletal animation, including blending and multiple channels.</div>
<li><div> Use Controls add a type of behaviour (that is, methods and fields) to individual Spatials. </div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/scene/control/CameraControl.java"><param name="text" value="<html><u>CameraControl.java</u></html>"><param name="textColor" value="blue"></object> allows you to sync the camera position with the position of a given spatial.</div>
<li><div> Each Control has its own <code>update()</code> loop that hooks into <code>simpleUpdate()</code>. Use Controls to move blocks of code out of the <code>simpleUpdate()</code> loop.</div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/scene/control/BillboardControl.java"><param name="text" value="<html><u>BillboardControl.java</u></html>"><param name="textColor" value="blue"></object> displays a flat picture orthogonally, e.g. a speech bubble or informational dialog.</div>
<li><div> One Spatial can be influenced by several Controls. (Very powerful and modular!) </div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/#src%2Fjbullet%2Fcom%2Fjme3%2Fbullet%2Fcontrol"><param name="text" value="<html><u>PhysicsControl</u></html>"><param name="textColor" value="blue"></object> subclasses (such as CharacterControl, RigidBodyControl, VehicleControl) allow you to add physical properties to any spatial. PhysicsControls tie into capabilities provided by the BulletAppState.</div>
<li><div> Each Spatial needs its own instance of the Control. </div>
</li>
<li><div> A Control only has access to and control over the Spatial it is attached to.</div>
</li>
</ul>
<p>
Examples: You can write
</p>
<ul>
<li><div> A WalkerNavControl, SwimmerNavControl, FlyerNavControl… that defines how a type of NPC finds their way around. All NPCs can walk, some can fly, others can swim, and some can all three, etc.</div>
</li>
<li><div> A PlayerNavControl that is steered by user-configurable keyboard and mouse input.</div>
</li>
<li><div> A generic animation control that acts as a common interface that triggers animations (walk, stand, attack, defend) for various entities.</div>
</li>
<li><div> A DefensiveBehaviourControl that remote-controls NPC behaviour in fight situations. </div>
</li>
<li><div> An IdleBehaviourControl that remote-controls NPC behaviour in neutral situations. </div>
</li>
<li><div> A DestructionControl that automatically replaces a structure with an appropriate piece of debris after collision with a projectile… </div>
</li>
</ul>
<p>
The possibilities are endless. <img src="/wiki/lib/images/smileys/icon_smile.gif" class="middle" alt=":-)" />
</p>
</div>
<h2><a>The Control Interface</a></h2>
<h2><a>Example Code</a></h2>
<div>
<p>
The interface can be found under <code>com.jme3.scene.control.Control</code>. It has the following method signatures:
Other examples include the built-in RigidBodyControl in JME&#039;s physics integration, the built-in TerrainLODControl that updates the terrain&#039;s level of detail depending on the viewer&#039;s perspective, etc.
</p>
<p>
Existing examples in the code base include:
</p>
<ul>
<li><div> <code>cloneForSpatial(Spatial)</code>: Clones the Control and attaches it to a clone of the given Spatial. The AssetManager uses this method if the same spatial is loaded twice. You can specify which fields you want your object to reuse (e.g. collisionshapes) in this case. </div>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/animation/AnimControl.java"><param name="text" value="<html><u>AnimControl.java</u></html>"><param name="textColor" value="blue"></object> allows manipulation of skeletal animation, including blending and multiple channels.</div>
</li>
<li><div> <code>setEnabled(boolean)</code>: Enable or disable the control. If disabled, update() does nothing. Goes with accessor <code>isEnabled();</code>.</div>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/scene/control/CameraControl.java"><param name="text" value="<html><u>CameraControl.java</u></html>"><param name="textColor" value="blue"></object> allows you to sync the camera position with the position of a given spatial.</div>
</li>
<li><div> There are also some internal methods that you do not call from user code: <code>setSpatial(Spatial s)</code>, <code>update(float tpf);</code>, <code>render(RenderManager rm, ViewPort vp)</code>.</div>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/scene/control/BillboardControl.java"><param name="text" value="<html><u>BillboardControl.java</u></html>"><param name="textColor" value="blue"></object> displays a flat picture orthogonally, e.g. a speech bubble or informational dialog.</div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/#src%2Fjbullet%2Fcom%2Fjme3%2Fbullet%2Fcontrol"><param name="text" value="<html><u>PhysicsControl</u></html>"><param name="textColor" value="blue"></object> subclasses (such as CharacterControl, RigidBodyControl, VehicleControl) allow you to add physical properties to any spatial. PhysicsControls tie into capabilities provided by the BulletAppState.</div>
</li>
</ul>
</div>
<h2><a>AbstractControl Class</a></h2>
<div>
<p>
If you want to create a Control that also extends an existing class, then create a custom extension of the Control Interface. Usage example:
1. Create a custom control interface
<p><div>The most common way to create a Control is to create a class that extends AbstractControl.
</div></p>
</p>
<pre>public interface MyControl extends Control &#123;
public void setSomething&#40;int x&#41;; // add your custom methods
&#125;</pre>
<p>
The AbstractControl can be found under <code>com.jme3.scene.control.AbstractControl</code>. This is a default abstract class that implements the Control interface.
</p>
<ul>
<li><div> You have access to a boolean <code>isEnabled()</code>.</div>
</li>
<li><div> You have access to the Spatial object <code>spatial</code>. </div>
</li>
<li><div> You override the <code>controlUpdate()</code> method to implement the Spatial&#039;s behaviour. </div>
</li>
<li><div> You have access to a <code>setEnabled(boolean)</code> method. This activates or deactivates this Control&#039;s behaviour in this spatial temporarily. While the AbstractControl is toggled to be disabled, the <code>controlUpdate()</code> loop is no longer executed. <br/>
For example, you disable your IdleBehaviourControl when you enable your DefensiveBehaviourControl in a spatial.</div>
</li>
</ul>
2. Create custom classes implementing your control interface
<p>
Usage: Your custom subclass implements the three methods <code>controlUpdate()</code>, <code>controlRender()</code>, <code>setSpatial()</code>, and <code>cloneForSpatial()</code> as shown here:
</p>
<pre>public class ControlledThing extends MyThing implements MyControl &#123;
&nbsp;
protected Spatial spatial;
&nbsp;
protected boolean enabled = true;
<pre>public class MyControl extends AbstractControl implements Savable, Cloneable &#123;
privat int index; // can have custom fields -- example
&nbsp;
public ControlledThing&#40;&#41; &#123; &#125; // empty serialization constructor
public MyControl&#40;&#41;&#123;&#125; // empty serialization constructor
&nbsp;
public ControlledThing&#40;int x&#41; &#123; // custom constructor
super&#40;x&#41;;
<span>/** Optional custom constructor with arguments that can init custom fields.
* Note: you cannot modify the spatial here yet! */</span>
public MyControl&#40;int i&#41;&#123;
// index=i; // example
&#125;
&nbsp;
<span>/** This is your init method. Optionally, you can modify
* the spatial from here (transform it, initialize userdata, etc). */</span>
@Override
public void update&#40;float tpf&#41; &#123;
if &#40;enabled &amp;&amp; spatial != null&#41; &#123;
// ...
// Write custom code to control the spatial here!
&#125;
public void setSpatial&#40;Spatial spatial&#41; &#123;
super.setSpatial&#40;spatial&#41;;
// spatial.setUserData(&quot;index&quot;, i); // example
&#125;
&nbsp;
&nbsp;
<span>/** Implement your spatial's behaviour here.
* From here you can modify the scene graph and the spatial
* (transform them, get and set userdata, etc).
* This loop controls the spatial while the Control is enabled. */</span>
@Override
public void render&#40;RenderManager rm, ViewPort vp&#41; &#123;
// optional for advanced users, e.g. to display a debug shape
protected void controlUpdate&#40;float tpf&#41;&#123;
if&#40;spatial != null&#41; &#123;
// spatial.rotate(tpf,tpf,tpf); // example behaviour
&#125;
&#125;
&nbsp;
@Override
public Control cloneForSpatial&#40;Spatial spatial&#41;&#123;
ControlledThing control = new ControlledThing&#40;y&#41;;
// set custom properties
spatial.setControl&#40;control&#41;;
final MyControl control = new MyControl&#40;&#41;;
/* Optional: use setters to copy userdata into the cloned control */
// control.setIndex(i); // example
control.setSpatial&#40;spatial&#41;;
return control;
&#125;
&nbsp;
@Override
public void setEnabled&#40;boolean enabled&#41; &#123;
this.enabled = enabled;
// ...
&#125;
&nbsp;
@Override
public boolean isEnabled&#40;&#41; &#123;
return enabled;
protected void controlRender&#40;RenderManager rm, ViewPort vp&#41;&#123;
/* Optional: rendering manipulation (for advanced users) */
&#125;
&nbsp;
@Override
public void setSomething&#40;int z&#41; &#123;
// You can add custom methods ...
public void read&#40;JmeImporter im&#41; throws IOException &#123;
super.read&#40;im&#41;;
// im.getCapsule(this).read(...);
&#125;
&nbsp;
@Override
public void write&#40;JmeExporter ex&#41; throws IOException &#123;
super.write&#40;ex&#41;;
OutputCapsule oc = ex.getCapsule&#40;this&#41;;
oc.write&#40;enabled, &quot;enabled&quot;, true&#41;;
oc.write&#40;spatial, &quot;spatial&quot;, null&#41;;
// write custom variables ....
&#125;
@Override
public void read&#40;JmeImporter im&#41; throws IOException &#123;
super.read&#40;im&#41;;
InputCapsule ic = im.getCapsule&#40;this&#41;;
enabled = ic.readBoolean&#40;&quot;enabled&quot;, true&#41;;
spatial = &#40;Spatial&#41; ic.readSavable&#40;&quot;spatial&quot;, null&#41;;
// read custom variables ....
// ex.getCapsule(this).write(...);
&#125;
&nbsp;
&#125;</pre>
<p>
See also:
</p>
<ul>
<li><div> To learn more about <code>write()</code> and <code>read()</code>, see <a href="/com/jme3/gde/core/docs/jme3/advanced/save_and_load.html">Save and Load</a></div>
</li>
<li><div> To learn more about <code>setUserData()</code>, see <a href="/com/jme3/gde/core/docs/jme3/advanced/spatial.html">Spatial</a>.</div>
</li>
</ul>
</div>
<h2><a>AbstractControl</a></h2>
<h2><a>The Control Interface</a></h2>
<div>
<p>
This class can be found under <code>com.jme3.scene.control.AbstractControl</code>.
<p><div>If you want to create a Control that also extends another existing class (rare, but possible), then create a custom extension of the Control Interface. You custom Control implements your custom interface.
</div></p>
</p>
<p>
The Control interface can be found under <code>com.jme3.scene.control.Control</code>. It has the following method signatures:
</p>
<ul>
<li><div> This is a default abstract class that implements the Control interface.</div>
<li><div> <code>cloneForSpatial(Spatial)</code>: Clones the Control and attaches it to a clone of the given Spatial. <br/>
Implement this method to be able to <a href="/com/jme3/gde/core/docs/jme3/advanced/save_and_load.html">save() and load()</a> Spatials carrying this Control. <br/>
The AssetManager also uses this method if the same spatial is loaded twice. You can specify which fields you want your object to reuse (e.g. collisionshapes) in this case. </div>
</li>
<li><div> It gives you access to a boolean <code>enabled</code>, and a Spatial <code>spatial</code>.</div>
<li><div> <code>setEnabled(boolean)</code>: Toggles a boolean that enables or disables the Control. Goes with accessor <code>isEnabled();</code>. You test for it in the <code>update(float tpf)</code> loop before you execute anything.</div>
</li>
<li><div> Extend AbstractControl to create a custom Control.</div>
<li><div> There are also some internal methods that you do not call from user code: <code>setSpatial(Spatial s)</code>, <code>update(float tpf);</code>, <code>render(RenderManager rm, ViewPort vp)</code>.</div>
</li>
</ul>
<p>
Usage: Your custom subclass implements the three methods <code>controlUpdate()</code>, <code>controlRender()</code>, <code>setSpatial()</code>, and <code>cloneForSpatial()</code> as shown here:
Usage example:
1. Create a custom control interface
</p>
<pre>public class MyControl extends AbstractControl implements Savable, Cloneable &#123;
<pre>public interface MyControlInterface extends Control &#123;
public void setSomething&#40;int x&#41;; // optionally, add custom methods
&#125;</pre>
<p>
2. Create custom Controls implementing your Control interface.
</p>
<pre>public class MyControl extends MyCustomClass implements MyControlInterface &#123;
&nbsp;
private Thing thing; // some custom field of yours
protected Spatial spatial;
&nbsp;
public MyControl&#40;&#41;&#123;&#125; // empty serialization constructor
protected boolean enabled = true;
&nbsp;
public MyControl&#40;thing&#41; &#123; // some custom constructor
this.thing = thing;
// Note: you can not access spatial here
&#125;
public MyControl&#40;&#41; &#123; &#125; // empty serialization constructor
&nbsp;
@Override
public void setSpatial&#40;Spatial spatial&#41; &#123;
super.setSpatial&#40;spatial&#41;;
// optional init method
// you can get and set user data in the spatial here
public MyControl&#40;int x&#41; &#123; // custom constructor
super&#40;x&#41;;
&#125;
&nbsp;
@Override
protected void controlUpdate&#40;float tpf&#41;&#123;
if&#40;spatial != null &amp;&amp; thing != null&#41; &#123;
// Implement your custom control here ...
// Change scene graph, access and modify userdata in the spatial, etc
public void update&#40;float tpf&#41; &#123;
if &#40;enabled &amp;&amp; spatial != null&#41; &#123;
// Write custom code to control the spatial here!
&#125;
&#125;
&nbsp;
@Override
protected void controlRender&#40;RenderManager rm, ViewPort vp&#41;&#123;
// optional rendering manipulation (for advanced users)
public void render&#40;RenderManager rm, ViewPort vp&#41; &#123;
// optional for advanced users, e.g. to display a debug shape
&#125;
&nbsp;
@Override
public Control cloneForSpatial&#40;Spatial spatial&#41; &#123;
final MyControl control = new MyControl&#40;...&#41;;
MyControl control = new MyControl&#40;&#41;;
// set custom properties
control.setSpatial&#40;spatial&#41;;
control.setEnabled&#40;isEnabled&#40;&#41;&#41;;
// set some more properties here...
return control;
&#125;
&nbsp;
@Override
public void read&#40;JmeImporter im&#41; throws IOException &#123;
super.read&#40;im&#41;;
// im.getCapsule(this).read(...);
public void setEnabled&#40;boolean enabled&#41; &#123;
this.enabled = enabled;
&#125;
&nbsp;
@Override
public boolean isEnabled&#40;&#41; &#123;
return enabled;
&#125;
&nbsp;
@Override
public void setSomething&#40;int z&#41; &#123;
// You can add custom methods ...
&#125;
&nbsp;
@Override
public void write&#40;JmeExporter ex&#41; throws IOException &#123;
super.write&#40;ex&#41;;
// ex.getCapsule(this).write(...);
OutputCapsule oc = ex.getCapsule&#40;this&#41;;
oc.write&#40;enabled, &quot;enabled&quot;, true&#41;;
oc.write&#40;spatial, &quot;spatial&quot;, null&#41;;
// write custom variables ....
&#125;
@Override
public void read&#40;JmeImporter im&#41; throws IOException &#123;
super.read&#40;im&#41;;
InputCapsule ic = im.getCapsule&#40;this&#41;;
enabled = ic.readBoolean&#40;&quot;enabled&quot;, true&#41;;
spatial = &#40;Spatial&#41; ic.readSavable&#40;&quot;spatial&quot;, null&#41;;
// read custom variables ....
&#125;
&nbsp;
&#125;</pre>
</div>
@ -236,6 +324,7 @@ Usage: Your custom subclass implements the three methods <code>controlUpdate()</
<div>
<p>
<strong>Tip:</strong> Use the getControl() accessor to get Control objects from Spatials. No need to pass around lots of object references.
Here an example from the <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/monkeyzone/"><param name="text" value="<html><u>MonkeyZone</u></html>"><param name="textColor" value="blue"></object> code:

@ -115,14 +115,14 @@ The Mesh data is stored in a buffer.
</li>
<li><div> We assign the data to the appropriate type of buffer inside the mesh object. The three buffer types are taken from an enum in <code>com.jme3.scene.VertexBuffer.Type</code>.</div>
</li>
<li><div> The third parameter describes the number of components of the values. Vertex postions are 3 float values, texture coordinates are 2 float values, and the indices are single ints.</div>
<li><div> The third parameter describes the number of components of the values. Vertex postions are 3 float values, texture coordinates are 2 float values, and the indices are 3 ints representing 3 vertices in a triangle.</div>
</li>
<li><div> In order for jMonkey to correctly show the mesh in the scene, it needs to know the bounds of our new mesh. This can easily be achieved by calling the updateBound() method on it.</div>
</li>
</ol>
<pre>mesh.setBuffer&#40;Type.Position, 3, BufferUtils.createFloatBuffer&#40;vertices&#41;&#41;;
mesh.setBuffer&#40;Type.TexCoord, 2, BufferUtils.createFloatBuffer&#40;texCoord&#41;&#41;;
mesh.setBuffer&#40;Type.Index, 1, BufferUtils.createIntBuffer&#40;indexes&#41;&#41;;
mesh.setBuffer&#40;Type.Index, 3, BufferUtils.createIntBuffer&#40;indexes&#41;&#41;;
mesh.updateBound&#40;&#41;;</pre>
<p>
@ -172,7 +172,8 @@ Vertex coloring is a simple way of coloring meshes. Instead of just assigning on
</p>
<pre>Geometry geo = new Geometry &#40;&quot;ColoredMesh&quot;, mesh&#41;;
Material matVC = new Material&#40;assetManager, &quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;</pre>
Material matVC = new Material&#40;assetManager, &quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;
matVC.setBoolean&#40;&quot;VertexColor&quot;, true&#41;;</pre>
<p>

@ -1,5 +1,5 @@
<h1><a>jME3 Effects -- Overview</a></h1>
<h1><a>jME3 Post-Processor Filters and Effects -- Overview</a></h1>
<div>
<p>
@ -256,6 +256,12 @@ See also:
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.smashingmagazine.com/2008/08/07/50-photoshop-tutorials-for-sky-and-space-effects/"><param name="text" value="<html><u>Photoshop Tutorial for Sky and space effects (article)</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:effect?do=showtag&amp;tag=tag%3Aeffect">effect</a>,
<a href="/wiki/doku.php/tag:light?do=showtag&amp;tag=tag%3Alight">light</a>,
<a href="/wiki/doku.php/tag:water?do=showtag&amp;tag=tag%3Awater">water</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:effects_overview?do=export_xhtmlbody">view online version</a></em></p>

@ -133,7 +133,30 @@ In your IDE, use code completion to quickly look up Trigger literals. In the jMo
</div>
<h2><a>2. Add a Trigger Mapping</a></h2>
<h2><a>2. Remove Default Trigger Mappings</a></h2>
<div>
<pre>inputManager.deleteMapping( SimpleApplication.INPUT_MAPPING_MEMORY );</pre>
<div><table>
<tr>
<th>Default Mapping</th><th>Key</th><th>Description</th>
</tr>
<tr>
<td>INPUT_MAPPING_HIDE_STATS</td><td>F5</td><td>Hides the statistics in the bottom left.</td>
</tr>
<tr>
<td>INPUT_MAPPING_CAMERA_POS</td><td>KEY_C</td><td>Prints debug output about the camera.</td>
</tr>
<tr>
<td>INPUT_MAPPING_MEMORY</td><td>KEY_M</td><td>Prints debug output for memtory usage.</td>
</tr>
<tr>
<td>INPUT_MAPPING_EXIT</td><td>KEY_ESCAPE</td><td>Closes the application by calling <code>stop();</code>. Typically you do not remove this, unless you replace it by another way of quitting gracefully.</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [3404-3821] -->
</div>
<h2><a>3. Add Custom Trigger Mapping</a></h2>
<div>
<p>
@ -159,7 +182,7 @@ inputManager.addMapping&#40;&quot;Right&quot;, new KeyTrigger&#40;KeyInput.KEY_D
</div>
<h2><a>3. Create Listeners</a></h2>
<h2><a>4. Create Listeners</a></h2>
<div>
<p>

@ -7,6 +7,10 @@
In the <a href="/com/jme3/gde/core/docs/jme3/advanced/material_definitions.html">Material Definitions</a> article you learned how to configure <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials</a> programmatically in Java code. If you have certain commonly used Materials that never change, you can clean up the amount of Java code that clutters your init method, by moving material settings into .j3m files. Then later in your code, you only need to call one setter instead of several to apply the material.
</p>
<p>
If you want to colorize simple shapes (one texture all around), then .j3m are the most easily customizable solution. J3m files can contain texture mapped materials, but as usual you have to create the textures in an external editor, especially if you use UV-mapped textures.
</p>
</div>
<h2><a>Writing the .j3m File</a></h2>
@ -57,7 +61,8 @@ How to this file is structured:
<p>
<strong>Tip:</strong> In the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>, use File&gt;New File&gt;Material&gt;Empty Material File to create .j3m files.
<p><div>In the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>, use File→New File→Material→Empty Material File to create .j3m files. You can edit .j3m files directly in the <acronym title="Software Development Kit">SDK</acronym>. On the other hand, they are plain text files, so you can also create them in any plain text editor.
</div></p>
</p>
</div>
@ -175,7 +180,7 @@ All data types (except Color) are specified in com.jme3.shader.VarType.
<td> TextureArray</td><td> </td><td> (Currently not supported in J3M) </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [3132-4546] -->
<!-- EDIT1 TABLE [3565-4979] -->
</div>
<h3><a>Flip and Repeat Syntax</a></h3>
@ -239,7 +244,7 @@ See the <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><p
<td> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/javadoc/com/jme3/material/RenderState.html#setPointSprite(boolean)"><param name="text" value="<html><u>PointSprite</u></html>"><param name="textColor" value="blue"></object> </td><td>(Boolean)</td><td> Enable point sprite rendering for point meshes </td>
</tr>
</table></div>
<!-- EDIT2 TABLE [5184-6752] -->
<!-- EDIT2 TABLE [5617-7185] -->
</div>
<h2><a>Examples</a></h2>
@ -334,6 +339,14 @@ The file <code>assets/Models/Tree/Leaves.j3m</code> contains:
<p>
The <acronym title="Portable Network Graphics">PNG</acronym> file is in the same directory, <code>assets/Models/Tree/…</code>
</p>
<div><span>
<a href="/wiki/doku.php/tag:material?do=showtag&amp;tag=tag%3Amaterial">material</a>,
<a href="/wiki/doku.php/tag:texture?do=showtag&amp;tag=tag%3Atexture">texture</a>,
<a href="/wiki/doku.php/tag:file?do=showtag&amp;tag=tag%3Afile">file</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:wireframe?do=showtag&amp;tag=tag%3Awireframe">wireframe</a>,
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:j3m_material_files?do=export_xhtmlbody">view online version</a></em></p>

@ -60,6 +60,10 @@ You control the color and intensity of each light source. Typically you set the
You can choose to use lights in other colors than white, or darker colors. This influences the scene&#039;s atmosphere and will make the scene appear colder (e.g. <code>ColorRGBA.Cyan</code>) or warmer (<code>ColorRGBA.Yellow</code>), brighter (higher values) or darker (lower values).
</p>
<p>
You can get a list of all lights added to a Spatial by calling <code>getWorldLightList()</code> (includes inherited lights) or <code>getLocalLightList()</code> (only directly added lights), and iterating over the result.
</p>
</div>
<h3><a>PointLight</a></h3>
@ -71,7 +75,7 @@ You can choose to use lights in other colors than white, or darker colors. This
</p>
<p>
A PointLight has a location and shines from there in all directions as far as its radius reaches. The light intensity decreases with increased distance from the light source. A PointLight can be used together with shadows.
A PointLight has a location and shines from there in all directions as far as its radius reaches. The light intensity decreases with increased distance from the light source. A PointLight can at the moment not be used for casting shadows (using the PssmShadowRenderer - read more about this below).
</p>
<p>
@ -102,7 +106,7 @@ A DirectionalLight has no position, only a direction. It sends out parallel beam
</p>
<pre>DirectionalLight sun = new DirectionalLight&#40;&#41;;
sun.setColor&#40;ColorRGBA.White&#41;;
sun.setDirection&#40;new Vector3f&#40;-1,13, -1,13, 1,13&#41;.normalizeLocal&#40;&#41;&#41;;
sun.setDirection&#40;new Vector3f&#40;-.5f,-.5f,-.5f&#41;.normalizeLocal&#40;&#41;&#41;;
rootNode.addLight&#40;sun&#41;;</pre>
</div>
@ -122,14 +126,18 @@ A SpotLight sends out a distinct beam or cone of light. A SpotLight has a direct
<p>
<strong>Typical Example:</strong> Flashlight
</p>
<pre>SpotLight sl = new SpotLight&#40;&#41;;
sl.setDirection&#40;new Vector3f&#40;1,0,1&#41;&#41;; // direction
sl.setPosition&#40;new Vector3f&#40;0,0,0&#41;&#41;;
sl.setSpotInnerAngle&#40;15f&#41;; // inner light cone (maximum)
sl.setSpotOuterAngle&#40;35f&#41;; // outer light cone (edge of the light)
sl.setSpotRange&#40;10f&#41;; // distance
sl.setColor&#40;ColorRGBA.White.mult&#40;1.3f&#41;&#41;;
rootNode.addLight&#40;sl&#41;;</pre>
<pre>SpotLight spot = new SpotLight&#40;&#41;;
spot.setSpotRange&#40;100f&#41;; // distance
spot.setSpotInnerAngle&#40;15f * FastMath.DEG_TO_RAD&#41;; // inner light cone (central beam)
spot.setSpotOuterAngle&#40;35f * FastMath.DEG_TO_RAD&#41;; // outer light cone (edge of the light)
spot.setColor&#40;ColorRGBA.White.mult&#40;1.3f&#41;&#41;; // light color
spot.setPosition&#40;cam.getLocation&#40;&#41;&#41;; // shine from camera loc
spot.setDirection&#40;cam.getDirection&#40;&#41;&#41;; // shine forward from camera loc
rootNode.addLight&#40;spot&#41;;</pre>
<p>
If you want the spotlight to follow the flycam, repeat the setDirection(…) and setPosition(…) calls in the update loop, and kee syncing them with the camera position and direction.
</p>
</div>
@ -258,7 +266,7 @@ Use the Shadow Renderer to make Geometries with Lighting.j3md-based Materials ca
public void simpleInitApp&#40;&#41; &#123;
...
bsr = new BasicShadowRenderer&#40;assetManager, 256&#41;;
bsr.setDirection&#40;new Vector3f&#40;-1, -1, -1&#41;.normalizeLocal&#40;&#41;&#41;; // light direction
bsr.setDirection&#40;new Vector3f&#40;-.5f,-.5f,-.5f&#41;.normalizeLocal&#40;&#41;&#41;; // light direction
viewPort.addProcessor&#40;bsr&#41;;
...</pre>
@ -298,7 +306,7 @@ The more advanced PSSM shadow renderer can cast real-time shadows, even on curve
public void simpleInitApp&#40;&#41; &#123;
....
pssmRenderer = new PssmShadowRenderer&#40;assetManager, 1024, 3&#41;;
pssmRenderer.setDirection&#40;new Vector3f&#40;-1, -1, -1&#41;.normalizeLocal&#40;&#41;&#41;; // light direction
pssmRenderer.setDirection&#40;new Vector3f&#40;-.5f,-.5f,-.5f&#41;.normalizeLocal&#40;&#41;&#41;; // light direction
viewPort.addProcessor&#40;pssmRenderer&#41;;</pre>
<p>

@ -51,12 +51,12 @@ flyCam.setEnabled&#40;false&#41;;
camNode = new CameraNode&#40;&quot;Camera Node&quot;, cam&#41;;
//This mode means that camera copies the movements of the target:
camNode.setControlDir&#40;ControlDirection.SpatialToCamera&#41;;
//Attach the camNode to the target:
target.attachChild&#40;camNode&#41;;
//Move camNode, e.g. behind and above the target:
camNode.setLocalTranslation&#40;new Vector3f&#40;0, 5, -5&#41;&#41;;
//Rotate the camNode to look at the target:
camNode.lookAt&#40;target.getLocalTranslation&#40;&#41;, Vector3f.UNIT_Y&#41;;
//Attach the camNode to the target:
target.attachChild&#40;camNode&#41;;</pre>
camNode.lookAt&#40;target.getLocalTranslation&#40;&#41;, Vector3f.UNIT_Y&#41;;</pre>
<p>
<strong>Important:</strong> Where the example says <code>camNode.setLocalTranslation(new Vector3f(0, 5, -5));</code>, you have to supply your own start position for the camera. This depends on the size of your target (the player character) and its position in your particular scene. Optimally, you set this to a spot a bit behind and above the target.
@ -73,10 +73,10 @@ Example: Use with <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">C
</tr>
<tr>
<td>setControlDir(ControlDirection.CameraToSpatial)</td><td>User input steers the camera, and the target spatial follows the camera. <br/>
The camera&#039;s transformation is copied over the spatial&#039;s transformation.</td>
The camera&#039;s transformation is copied over the spatial&#039;s transformation. Use with first-person flyCam.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [2445-2926] -->
<!-- EDIT1 TABLE [2445-2956] -->
<p>
<strong>Code sample:</strong>
@ -137,7 +137,7 @@ new KeyTrigger(KeyInput.KEY_SPACE))</td><td>Activate mutiple triggers for the ro
<td>setRotationSensitivity(5f)</td><td>How fast the camera rotates. Use values around &lt;1.0f (all bigger values are ignored).</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [3702-5114] -->
<!-- EDIT2 TABLE [3732-5144] -->
<p>
<strong>Code sample:</strong>
@ -171,6 +171,6 @@ What is the difference of the two code samples above?
<td>Drag-to-Rotate rotates the target and the camera. You always see the target from behind.</td><td>Drag-to-Rotate rotates only the camera. You can see the target from various sides.</td>
</tr>
</table></div>
<!-- EDIT3 TABLE [5443-5914] -->
<!-- EDIT3 TABLE [5473-5944] -->
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:making_the_camera_follow_a_character?do=export_xhtmlbody">view online version</a></em></p>

@ -4,27 +4,38 @@
<p>
Typically, you create a set of custom materials, and use them throughout the game. For example, you can initialize and configure your materials objects in the <code>initSimpleApp()</code> method, and then load 3D models (Geometries) and use setMaterial() on them.
All Geometries need a Materual. Every Material is based on a Material Definition. The most common Material Definitions are included in the engine, advanced users can create custom ones.
</p>
<pre>Spatial myGeometry = assetManager.loadModel&#40;&quot;Models/Teapot/Teapot.j3o&quot;&#41;;
Material mat = new Material&#40;assetManager, // Create new material and...
&quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;; // ... specify a Material Definition file, here &quot;Unshaded.j3md&quot;!
mat.setColor&#40;&quot;Color&quot;, ColorRGBA.Blue&#41;; // Set one or more material parameters.
myGeometry.setMaterial&#40;mat&#41;; // Use material on this Geometry.</pre>
<p>
<strong>Tip:</strong> If you use one custom material very often, additionally read about storing material configurations in user-friendly <a href="/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html">j3m Material Files</a>.
<p><div>If you use one custom material very often, read about storing material configurations in user-friendly <a href="/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html">j3m Material Files</a>. Either <a href="/com/jme3/gde/core/docs/sdk/material_editing.html">use the jMonkeyEngine SDK to create .j3m files</a> (easier), or <a href="/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html">write .j3m files in a text editor</a>.
</div></p>
</p>
</div>
<h2><a>Preparing a Material</a></h2>
<div>
<p>
In the <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a> list,
</p>
<ol>
<li><div> Choose a Material Definition from the <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a> list that has the features that you need. </div>
<li><div> Choose a Material Definition that has the features that you need. </div>
<ul>
<li><div> Tip: If you don&#039;t know, you can always start with <code>Unshaded.j3md</code>.</div>
</li>
</ul>
</li>
<li><div> Look at the applicable parameters of the Material Definition and determine which ones you need to achieve the desired effect. Most parameters are optional.</div>
<ol>
<li><div> Create and save the necessary Texture files to the assets directory.</div>
<li><div> Look at the applicable parameters of the Material Definition and determine which parameters you need to achieve the desired effect (e.g. &quot;glow&quot; or &quot;color&quot;). Most parameters are optional. </div>
</li>
<li><div> Create and save the necessary Texture files to your assets directory.</div>
<ul>
<li><div> E.g. ColorMap; DiffuseMap, NormalMap, AlphaMap, etc…</div>
</li>
@ -37,18 +48,45 @@ Typically, you create a set of custom materials, and use them throughout the gam
</ul>
</li>
</ol>
</li>
</ol>
</div>
<h2><a>Using a Material</a></h2>
<div>
<p>
In your Java code,
</p>
<ol>
<li><div> In you Java code, create a Material object based on the .j3md file: e.g. <pre>Material mat = new Material&#40;assetManager, &quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;</pre>
<li><div> Create a Material object based on the chosen Material Definition (.j3md file): <pre>Material mat = new Material&#40;assetManager, &quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;</pre>
</div>
</li>
<li><div> Configure your Material by setting the appropriate values listed in the <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a> table. <pre>mat.setColor&#40;&quot;Color&quot;, ColorRGBA.Yellow &#41;; // and more</pre>
</div>
</li>
<li><div> Apply your prepared Material to a Geometry: <pre>myGeometry.setMaterial&#40;mat&#41;;</pre>
</div>
</li>
<li><div> (Optional) Adjust the texture scale: <pre>geometry.scaleTextureCoordinates&#40;new Vector2f&#40;1f, .5f&#41;&#41;;</pre>
</div>
</li>
<li><div> Configure your Material by setting the appropriate values listed in the <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a> table. Here are examples of the methods that set the different data types:</div>
</ol>
<p>
For details see also: <a href="/com/jme3/gde/core/docs/jme3/intermediate/how_to_use_materials.html">How to Use Materials</a>
</p>
</div>
<h3><a>Examples</a></h3>
<div>
<p>
Here are examples of the methods that set the different data types:
</p>
<ul>
<li><div> <code>mat.setColor( &quot;Color&quot;, ColorRGBA.White );</code> </div>
</li>
@ -61,19 +99,6 @@ Typically, you create a set of custom materials, and use them throughout the gam
<li><div> <code>mat.setVector3( &quot;NormalScale&quot;, new Vector3f(1f,1f,1f));</code></div>
</li>
</ul>
</li>
<li><div> Use your prepared material on a Geometry: <pre>myGeometry.setMaterial&#40;mat&#41;;</pre>
</div>
</li>
<li><div> (Optional) Adjust the texture scale: <pre>geometry.scaleTextureCoordinates&#40;new Vector2f&#40;1f, .5f&#41;&#41;;</pre>
</div>
</li>
</ol>
</div>
<h2><a>Examples</a></h2>
<div>
<p>
@ -105,9 +130,41 @@ geom.setMaterial&#40;mat&#41;;
rootNode.attachChild&#40;geom&#41;;</pre>
<p>
<strong>Tip:</strong> You can find these and other common code snippets in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> Code Palette. Drag and drop them into your source code.
<p><div>You can find these and other common code snippets in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> Code Palette. Drag and drop them into your source code.
</div></p>
</p>
</div>
<h2><a>Creating a Custom Material Definition</a></h2>
<div>
<p>
Check out the <a href="/com/jme3/gde/core/docs/jme3/build_from_sources.html">engine source code</a> and have a look at how Material Definitions are implemented. You can create your own Material Definitions and place them in your projects MatDefs directory.
</p>
<ol>
<li><div> Find the existing MatDefs are in <code>engine/src/core-data/Common/MatDefs/</code>. </div>
</li>
<li><div> Open a Something.j3md file in a text editor. You see that this jme3 file defines Material Parameters and Techniques.</div>
<ul>
<li><div> Material Parameters are the ones that you set in Materials, as shown in the examples above.</div>
</li>
<li><div> The Techniques rely on VertexShaders and FragmentShaders: You find those in the files Something.vert and Something.frag in the same directory.</div>
</li>
</ul>
</li>
<li><div> Learn about GLSL (OpenGL Shading Language) to understand the .vert and .frag syntax, and write your own.</div>
</li>
</ol>
<div><span>
<a href="/wiki/doku.php/tag:material?do=showtag&amp;tag=tag%3Amaterial">material</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">SDK</a>,
<a href="/wiki/doku.php/tag:matdef?do=showtag&amp;tag=tag%3Amatdef">MatDef</a>,
<a href="/wiki/doku.php/tag:file?do=showtag&amp;tag=tag%3Afile">file</a>,
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:material_definitions?do=export_xhtmlbody">view online version</a></em></p>

@ -1,55 +1,55 @@
<h1><a>Materials Overview</a></h1>
<h1><a>Material Definition Properties</a></h1>
<div>
<p>
A Geometry (mesh) is just the shape of the object. jMonkeyEngine cannot render a shape without knowing anything about its surface properties. You need to apply a color or texture to the surface of your Geometries to make them visible. In jMonkeyEngine, colors and textures are represented as Material objects.
</p>
In jMonkeyEngine 3, colors and textures are represented as Material objects.
<p>
All Geometries have Materials: You either use the setters described here to specifiy the Material&#039;s properties in your Java code, or you load a custom .j3m file that lists the properties. To improve performance, reuse Materials for similar models, don&#039;t create a new Material object for every Geometry. (E.g. use one bark Material for many tree models.)
</p>
<ul>
<li><div> All Geometries must have Materials. To improve performance, reuse Materials for similar models, don&#039;t create a new Material object for every Geometry. (E.g. use one bark Material for several tree models.) </div>
</li>
<li><div> Each Material is based on one of jme3&#039;s default Material Definitions (.j3md files) that are included in the engine. Advanced users can create additional custom Material Definitions (see how it&#039;s done in the <a href="/com/jme3/gde/core/docs/jme3/build_from_sources.html">jme3 sources</a>).</div>
</li>
</ul>
<p>
You can <a href="/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html">write .j3m files in a text editor</a>, or <a href="/com/jme3/gde/core/docs/sdk/material_editing.html">use the jMonkeyEngine SDK to create .j3m files</a> for you. (Advanced users can also create custom Material Definitions.)
</p>
<p>
Each Material is based on one of the default material definitions (.j3md files) that are included in the engine. The Materials table shows you the material definitions that jMonkeyEngine supports by default. You want to make the most of your models by setting good looking material parameters: The developers should be in contact with the graphic designer regarding which of the available jMonkeyEngine features (listed here) are intended to be used in individual Models&#039; Materials. You must have an understanding what <a href="/com/jme3/gde/core/docs/jme3/terminology#materialstextures.html">texture maps</a> are to be able to use textured materials.
<p><div>Find out quickly <a href="/com/jme3/gde/core/docs/jme3/intermediate/how_to_use_materials.html">How to Use Materials</a>, including the most commonly used code samples and RenderStates. <br/>
Or find more background info on <a href="/com/jme3/gde/core/docs/jme3/advanced/material_definitions.html">How to use Material Definitions</a>.
</div></p>
</p>
</div>
<h2><a>Code Sample</a></h2>
<h2><a>All Materials Definition Properties</a></h2>
<div>
<p>
The following samples assume that you loaded a Geometry, e.g. <code>Spatial myGeometry = assetManager.loadModel(&quot;Models/Teapot/Teapot.j3o&quot;);</code>
The following Materials table shows you the Material Definitions that jMonkeyEngine 3 supports.
</p>
<pre>Material mat = new Material&#40;assetManager, // Create new material and
&quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;; // specify .j3md file path.
mat.setColor&#40;&quot;Color&quot;, ColorRGBA.Blue&#41;; // Set one or more parameters.
myGeometry.setMaterial&#40;mat&#41;; // Use material on Geometry.</pre>
<p>
or
<p><div>Looks confusing? <br/>
1) Start learning about <code>Unshaded.j3md</code> and <code>Lighting.j3md</code>, they cover 90% of the cases. <br/>
2) Use <a href="/com/jme3/gde/core/docs/sdk/material_editing.html">the SDK&#039;s visual material editor</a> to try out and save material settings easily. <br/>
3) The <a href="/com/jme3/gde/core/docs/sdk/code_editor.html">SDK&#039;s Palette</a> contains drag&amp;drop code snippets for loading materials.
</div></p>
</p>
<pre>myGeometry.setMaterial&#40; &#40;Material&#41;assetManager.loadAsset&#40; &quot;myMaterial.j3m&quot;&#41; &#41;;</pre>
<p>
Most Material parameters are not mandatory. For example, it is normal to specify solely the <code>DiffuseMap</code> and <code>NormalMap</code> when using <code>Lighting.j3md</code>, and leave the rest empty. You are only using a subset of the advanced features, but that&#039;s acceptable if it results in the material looking the way you want. You can always add more texture maps later.
Most Material parameters are optional. For example, it is okay to specify solely the <code>DiffuseMap</code> and <code>NormalMap</code> when using <code>Lighting.j3md</code>, and leave the other texture maps empty. In this case, you are only using a subset of the possible features, but that&#039;s fine if it already makes in the material look the way that you want. You can always add more texture maps later.
</p>
<p>
<p><div>1) Looks confusing? Start with <code>Unshaded.j3md</code>, then look into <code>Lighting.j3md</code>. <br/>
2) The jMonkeyEngine <a href="/com/jme3/gde/core/docs/sdk.html">SDK</a> offers a visual editor where you can set properties and preview the outcome. The <acronym title="Software Development Kit">SDK</acronym> Palette contains code snippets to load materials. <br/>
3) If you don&#039;t know what an obscure parameter means, you&#039;re likely not using it.
</div></p>
</p>
</div>
<h3><a>Unshaded Coloring and Textures</a></h3>
<div>
<p>
jMonkeyEngine supports illuminated and unshaded Material Definitions.
</p>
<ul>
@ -59,11 +59,6 @@ jMonkeyEngine supports illuminated and unshaded Material Definitions.
</li>
</ul>
</div>
<h2><a>Unshaded Coloring and Textures</a></h2>
<div>
<p>
&quot;Unshaded&quot; materials look somewhat abstract because they ignore lighting and shading. Unshaded Materials work even if the scene does not include a light source. These Materials can be single-colored or textured. For example, they are used for cards and tiles, for the sky, billboards and UI elements, for toon-style games, or for testing.
@ -71,7 +66,7 @@ jMonkeyEngine supports illuminated and unshaded Material Definitions.
</p>
<div><table>
<tr>
<th> Basic Material Definition </th><th> Usage </th><th> Parameter </th>
<th> Standard Unshaded Material Definition </th><th> Usage </th><th> Material Parameters </th>
</tr>
<tr>
<td> Common/MatDefs/Misc/Unshaded.j3md </td><td> Standard, non-illuminated Materials. <br/>
@ -88,7 +83,7 @@ setTexture(&quot;GlowMap&quot;, assetManager.loadTexture(&quot;&quot;)); <br/>
setColor(&quot;GlowColor&quot;, ColorRGBA.White); </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [3394-4032] -->
<!-- EDIT1 TABLE [2273-2913] -->
<p>
Other useful, but less commonly used material definitions:
@ -96,7 +91,7 @@ Other useful, but less commonly used material definitions:
</p>
<div><table>
<tr>
<th> Special Material Definitions </th><th> Usage </th><th> Setter, Parameter, Type </th>
<th> Special Unshaded Material Definitions </th><th> Usage </th><th> Material Parameters </th>
</tr>
<tr>
<td> Common/MatDefs/Misc/Sky.j3md </td><td> A solid skyblue, or use with a custom SkyDome texture. <br/>
@ -148,20 +143,31 @@ setColor(&quot;GlowColor&quot;, ColorRGBA.White); <br/>
setBoolean(&quot;PointSprite&quot;,true); </td>
</tr>
</table></div>
<!-- EDIT2 TABLE [4094-6616] -->
<!-- EDIT2 TABLE [2975-5491] -->
</div>
<h2><a>Phong Illuminated</a></h2>
<h3><a>Phong Illuminated</a></h3>
<div>
<p>
jMonkeyEngine supports illuminated and unshaded Material Definitions.
</p>
<ul>
<li><div> Phong Illuminated materials look more naturalistic.</div>
</li>
<li><div> Unshaded materials look more abstract.</div>
</li>
</ul>
<p>
Illuminated materials require a <a href="/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html">light source</a> added to at least one of their parent nodes! (e.g. rootNode.) Illuminated materials are darker on the sides facing away from light sources. They use Phong illumination model (default), or the Ward isotropic gaussian specular shader (WardIso) which looks more like plastic. They do not cast <a href="/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html">drop shadows</a> unless you use a FilterPostProcessor.
</p>
<div><table>
<tr>
<th>Illuminated Material Definition </th><th> Usage </th><th> Setter, Parameter, Type </th>
<th>Standard Illuminated Material Definition </th><th> Usage </th><th> Material Parameters </th>
</tr>
<tr>
<td> Common/MatDefs/Light/Lighting.j3md </td><td> Commonly used Material with Phong illumination. <br/>
@ -197,9 +203,9 @@ setColor(&quot;Specular&quot;, ColorRGBA.White); <br/>
setBoolean(&quot;WardIso&quot;,true);<sup><a href="#fn__4">4)</a></sup> </td>
</tr>
</table></div>
<!-- EDIT3 TABLE [7108-8822] --><div><table>
<!-- EDIT3 TABLE [6152-7870] --><div><table>
<tr>
<th>Special Illuminated Material Definitions </th><th> Usage </th><th> Setter, Parameter, Type </th>
<th>Special Illuminated Material Definitions </th><th> Usage </th><th> Material Parameters </th>
</tr>
<tr>
<td>Common/MatDefs/Terrain/TerrainLighting.j3md</td><td>Same kind of multi-layered splat texture as Terrain.j3md, but with illumination and shading. <br/>
@ -244,121 +250,35 @@ setBoolean(&quot;WardIso&quot;,true); <br/>
setBoolean(&quot;SphereMap&quot;,true); </td>
</tr>
</table></div>
<!-- EDIT4 TABLE [8824-11115] -->
<!-- EDIT4 TABLE [7872-10158] -->
</div>
<h2><a>Testing and Debugging</a></h2>
<h3><a>Other: Test and Debug</a></h3>
<div>
<div><table>
<tr>
<th> Material Definition </th><th> Usage </th>
</tr>
<tr>
<td> Common/MatDefs/Misc/ShowNormals.j3md </td><td> A color gradient calculated from the model&#039;s surface normals. You can use this built-in material to debug the generation of normals in meshes, to preview models that have no material, or as fall-back default material. This built-in material has no parameters. </td>
<td> Common/MatDefs/Misc/ShowNormals.j3md </td><td> A color gradient calculated from the model&#039;s surface normals. You can use this built-in material to debug the generation of normals in meshes, to preview models that have no material and no lights, or as fall-back default material. This built-in material has no parameters. </td>
</tr>
</table></div>
<!-- EDIT5 TABLE [11152-11509] -->
<!-- EDIT5 TABLE [10193-10564] -->
</div>
<h2><a>Activate Special Features</a></h2>
<h2><a>RenderStates</a></h2>
<div>
</div>
<h3><a>NormalMap (Bumpiness)</a></h3>
<div>
<p>
A NormalMap (alos called BumpMap) describes the fine bumpy details of the Material surface that are not part of the mesh itself. E.g. cracks, pores, creases, notches.
</p>
<ol>
<li><div> Generate normals for the Mesh (not for the Geometry!) <pre>TangentBinormalGenerator.generate&#40;mesh&#41;;</pre>
</div>
</li>
<li><div> Specify the <code>NormalMap</code> texture. (<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Bump_mapping"><param name="text" value="<html><u>More about BumpMaps here.</u></html>"><param name="textColor" value="blue"></object>)</div>
</li>
</ol>
</div>
<h3><a>Specular (Shininess)</a></h3>
<div>
<p>
To activate Shininess:
</p>
<ol>
<li><div> Specify the <code>Shininess</code> intensity. <br/>
A float value between 1 (rough surface with blurry shininess) and 128 (very smooth surface with focused shininess)</div>
</li>
<li><div> Specify a Color as <code>Specular</code> value. <br/>
The ColorRGBA value of the light source, e.g. often RGBA.White.</div>
</li>
<li><div> (Optionally for some Materials) Specify a <code>SpecularMap</code> texture. <br/>
This grayscale texture outlines in detail where the DiffuseMap texture should be shiny (white) and were not (black), instead of rendering the whole material evenly shiny.</div>
</li>
</ol>
<p>
To deactivate shininess
</p>
<ul>
<li><div> Set the <code>Specular</code> color to <code>ColorRGBA.Black</code>. Do not just set <code>Shininess</code> to 0.</div>
</li>
</ul>
</div>
<h3><a>Glow</a></h3>
<div>
<p>
To activate glow:
</p>
<ol>
<li><div> Add a <a href="/com/jme3/gde/core/docs/jme3/advanced/bloom_and_glow.html">FilterPostProcessor</a> in your simpleInit() method.</div>
</li>
<li><div> Specify a Color as <code>Glow</code> value. <br/>
A ColorRGBA value of your choice, e.g. choose a warm or cold color for different effects.</div>
</li>
<li><div> (Optionally for some Materials) Specify a <code>GlowMap</code> texture. <br/>
This texture outlines in detail where the DiffuseMap texture glows, instead of making the whole material glow everwhere evenly.</div>
</li>
</ol>
<p>
To deactivate glow
</p>
<ul>
<li><div> Set the <code>Glow</code> color to <code>ColorRGBA.Black</code>.</div>
</li>
</ul>
</div>
<h3><a>Transparency</a></h3>
<div>
<p>
Most Material Definitions support an alpha channel for opaqueness and transparency in textures. In an RGBA color, the last float is the alpha channel: 0.0f is transparent and 1.0f is opaque. For example, <code>mat.setColor(&quot;Color&quot;, new ColorRGBA(1,0,0,0.5f));</code> is a half-opaque red.
</p>
<p>
Additionally, you must specify a blendmode:
</p>
<div><table>
<tr>
<th>Material option</th><th>Usage</th><th>Example</th>
<th>Material Option</th><th>Description</th><th>Example</th>
</tr>
<tr>
<td>getAdditionalRenderState().setBlendMode(BlendMode.Off);</td><td>Opaque</td><td></td>
<td>getAdditionalRenderState().setBlendMode(BlendMode.Off);</td><td>This is the default, no transparency.</td><td>Use for all opaque objects like walls, floors, people…</td>
</tr>
<tr>
<td>getAdditionalRenderState().setBlendMode(BlendMode.Alpha);</td><td>Interpolates the background pixel with the current pixel by using the current pixel&#039;s alpha.</td><td>Use this for normal every-day translucency: Frosted window panes, ice, glass, alpha-blended vegetation textures… </td>
@ -368,14 +288,15 @@ Additionally, you must specify a blendmode:
</tr>
<tr>
<td>getAdditionalRenderState().setAlphaFallOff(0.5f); <br/>
getAdditionalRenderState().setAlphaTest(true)</td><td>Enables alpha test. Works the same way as &quot;AlphaDiscardThreshold&quot;.</td><td>Used for textures that have fully opaque pixels next to fully transparent pixels, e.g. foliage, hair, vegetation.</td>
getAdditionalRenderState().setAlphaTest(true)</td><td>Enables Alpha Testing with a &quot;AlphaDiscardThreshold&quot; in the AlphaMap.</td><td>Activate Alpha Testing for (partially) <strong>transparent</strong> objects such as foliage, hair, etc. <br/>
Deactivate Alpha Testing for gradually <strong>translucent</strong> objects, such as colored glass, smoked glass, ghosts.</td>
</tr>
<tr>
<td>getAdditionalRenderState().setBlendMode(BlendMode.Additive);</td><td>Additive alpha blending adds colors in a commutative way, i.e. the result does not depend on the order of transparent layers, since it adds the scene&#039;s background pixel color to the current pixel color. This is useful if you have lots of transparent textures overlapping and don&#039;t care about the order. <br/>
Viewed in front of a white background, Additive textures become fully transparent! </td><td>Used for particle effect textures that have a black color background. </td>
<strong>Note:</strong> Viewed in front of a white background, Additive textures become fully transparent! </td><td> This is the default for Particle.j3md-based textures that have a black color background. </td>
</tr>
<tr>
<td>getAdditionalRenderState().setBlendMode(BlendMode.AlphaAdditive);</td><td>Same as &quot;Additive&quot;, except first it multiplies the current pixel color by the pixel alpha.</td><td>Used for particle effects that have alpha as background. </td>
<td>getAdditionalRenderState().setBlendMode(BlendMode.AlphaAdditive);</td><td>Same as &quot;Additive&quot;, except first it multiplies the current pixel color by the pixel alpha.</td><td>This can be used for particle effects that have alpha as background. </td>
</tr>
<tr>
<td>getAdditionalRenderState().setBlendMode(BlendMode.Color);</td><td>Blends by color.</td><td>Generally useless.</td>
@ -390,25 +311,34 @@ Viewed in front of a white background, Additive textures become fully transparen
<td>getAdditionalRenderState().setBlendMode(BlendMode.PremultAlpha);</td><td>Pre-multiplied alpha blending. E.g. if the color of the object has already been multiplied by its alpha, this is used instead of &quot;Alpha&quot; blend mode.</td><td>For use with Premult Alpha textures.</td>
</tr>
</table></div>
<!-- EDIT6 TABLE [13546-15768] -->
<!-- EDIT6 TABLE [10616-13066] -->
<p>
<p><div>For partially transparent Materials based on Lighting.j3md, consider setting the <code>AlphaDiscardThreshold</code> value. The renderer only renders pixels above your alpha threshold, and does not render pixels below the threshold. This means, that gradients in the AlphaMap are no longer interpreted as soft translucency, but parts of the texture become either fully opaque or fully transparent. You typically activate Alpha Testing for partially transparent objects such as foliage, hair, etc.
If the DiffuseMap has an alpha channel, use:
</div></p>
</p>
<pre>mat.setBoolean&#40;&quot;UseAlpha&quot;,true&#41;;</pre>
<p>
Later, put the Geometry (not the Material!) in the appropriate render queue
</p>
<ul>
<li><div> <pre>geo.setQueueBucket&#40;Bucket.Translucent&#41;;</pre>
</div>
</li>
<li><div> <pre>geo.setQueueBucket&#40;Bucket.Transparent&#41;;</pre>
</div>
</li>
</ul>
</div>
<h3><a>Advanced Options</a></h3>
<h3><a>Culling</a></h3>
<div>
<div><table>
<tr>
<th>Material Option</th><th>Usage</th><th>Example</th>
</tr>
<tr>
<td>getAdditionalRenderState().setWireframe(true);</td><td>Switch to showing the (textured) Material in wireframe mode. For debugging or &quot;matrix/holodeck&quot; effect.</td><td></td>
</tr>
<tr>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back); </td><td>Activate back-face culling. Mesh faces that are not facing the camera are not rendered, which saves time. Backface culling is activated by default as a major optimization.</td><td>The backside of mesh polygons (and the inside of models) is invisible. </td>
</tr>
@ -416,11 +346,18 @@ Viewed in front of a white background, Additive textures become fully transparen
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off); </td><td>Nothing is culled. Both mesh faces are rendered, even if they face away from the camera. Slow.</td><td>Sometimes used to debug custom meshes if you messed up some of the polygon sides, or for special shadow effects.</td>
</tr>
<tr>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.Front); </td><td>Activate front-face culling. Mesh faces facing the camera are not rendered.</td><td>Typically not used.</td>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.Front); </td><td>Activate front-face culling. Mesh faces facing the camera are not rendered.</td><td>Typically not used because you wouldn&#039;t see anything.</td>
</tr>
<tr>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack)</td><td>Cull both backfaces and frontfaces.</td><td>Use this as an efficient way to make an object temporarily invisible, while keeping all its other in-game properties (node attachment, collision shapes, interactions, etc) active.</td>
</tr>
</table></div>
<!-- EDIT7 TABLE [13385-14484] -->
</div>
<h3><a>Miscellaneous</a></h3>
<div>
<div><table>
<tr>
<td>getAdditionalRenderState().setColorWrite(false);</td><td>Disable writing the color of pixels.</td><td>Use this together with setDepthWrite(true) to write pixels only to the depth buffer, for example. </td>
</tr>
@ -431,7 +368,16 @@ Viewed in front of a white background, Additive textures become fully transparen
<td>getAdditionalRenderState().setPolyOffset();</td><td>Enable polygon offset.</td><td>Use this when you have meshes that have triangles really close to each over (e.g. <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Coplanarity"><param name="text" value="<html><u>Coplanar</u></html>"><param name="textColor" value="blue"></object>), it will shift the depth values to prevent <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Z-fighting"><param name="text" value="<html><u>Z-fighting</u></html>"><param name="textColor" value="blue"></object>.</td>
</tr>
</table></div>
<!-- EDIT7 TABLE [16304-18289] -->
<!-- EDIT8 TABLE [14511-15277] --><div><span>
<a href="/wiki/doku.php/tag:material?do=showtag&amp;tag=tag%3Amaterial">material</a>,
<a href="/wiki/doku.php/tag:texture?do=showtag&amp;tag=tag%3Atexture">texture</a>,
<a href="/wiki/doku.php/tag:matdefs?do=showtag&amp;tag=tag%3Amatdefs">MatDefs</a>,
<a href="/wiki/doku.php/tag:light?do=showtag&amp;tag=tag%3Alight">light</a>,
<a href="/wiki/doku.php/tag:culling?do=showtag&amp;tag=tag%3Aculling">culling</a>,
<a href="/wiki/doku.php/tag:renderstates?do=showtag&amp;tag=tag%3Arenderstates">RenderStates</a>,
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>
</span></div>
</div>
<div>
<div><sup><a href="#fnt__1">1)</a></sup>

@ -319,6 +319,15 @@ MonkeyZone is hosted at GoogleCode, where you can check out the jMonkeyEngine <a
<li><div> Run the server first (com.jme3.monkeyzone.ServerMain), and then a client (com.jme3.monkeyzone.ClientMain).</div>
</li>
</ol>
</div>
<h2><a>Troubleshooting</a></h2>
<div>
<ol>
<li><div> After download error coud appear that in jme3tools.navmesh.util\NavMeshGenerator.java import com.jme3.terrain.Terrain is not known, you should correct this by setting Project Properties &gt; Libraries &gt; Add Library &gt; jme3-libraries-terrain </div>
</li>
</ol>
<div><span>
<a href="/wiki/doku.php/tag:network?do=showtag&amp;tag=tag%3Anetwork">network</a>,
<a href="/wiki/doku.php/tag:basegame?do=showtag&amp;tag=tag%3Abasegame">basegame</a>,

@ -108,7 +108,7 @@ The following example rotates Spatials named &quot;Red Box&quot; or &quot;Blue B
// Convert screen click to 3d position
Vector2f click2d = inputManager.getCursorPosition&#40;&#41;;
Vector3f click3d = cam.getWorldCoordinates&#40;new Vector2f&#40;click2d.x, click2d.y&#41;, 0f&#41;.clone&#40;&#41;;
Vector3f dir = cam.getWorldCoordinates&#40;new Vector2f&#40;click2d.x, click2d.y&#41;, 1f&#41;.subtractLocal&#40;click3d&#41;;
Vector3f dir = cam.getWorldCoordinates&#40;new Vector2f&#40;click2d.x, click2d.y&#41;, 1f&#41;.subtractLocal&#40;click3d&#41;.normalizeLocal&#40;&#41;;
// Aim the ray from the clicked spot forwards.
Ray ray = new Ray&#40;click3d, dir&#41;;
// Collect intersections between ray and all nodes in results list.

@ -194,12 +194,39 @@ private Callable&lt;MyWayList&gt; findWay = new Callable&lt;MyWayList&gt;&#40;&#
</div>
<h3><a>The jME3 Threading Model</a></h3>
<div>
<p>
jME3 is similar to Swing in that for speed and efficiency all changes to the world must be made in a single update thread. This is handled automatically for you if using Controllers or simpleUpdate however whenever you pass work to another thread you need to hand the results back to the main jME3 thread before making any changes to the scene graph.
</p>
<pre> public void rotateGeography(final Geography goe, final Quaternian rot) {
mainApp.enqueue(new Callable&lt;Spatial&gt;() {
public Spatial call() throws Exception {
return geo.rotate(rot);
}
});
}</pre>
<p>
Note that this example does not fetch the returned value by calling <code>get()</code> on the Future object returned from <code>enqueue()</code>. This means that the example method <code>rotateGeography()</code> will return immediately and will not wait for the rotation to be processed before continuing.
</p>
<p>
If the processing thread needs to wait or needs the return value then <code>get()</code> or the other methods in the returned Future object such as <code>isDone()</code> can be used.
</p>
</div>
<h2><a>Conclusion</a></h2>
<div>
<p>
The cool thing about this appraoch is that every entity creates one self-contained Callable for the Executor, and they are all executed in parallel. In theory, you can have one thread per entity without changing anything else but the settings of the executor.
The cool thing about this approach is that every entity creates one self-contained Callable for the Executor, and they are all executed in parallel. In theory, you can have one thread per entity without changing anything else but the settings of the executor.
</p>
<div><span>

@ -1,5 +1,5 @@
<h1><a>Creating User Interfaces with Nifty GUI</a></h1>
<h1><a>Creating JME3 User Interfaces with Nifty GUI</a></h1>
<div>
<p>
@ -21,19 +21,21 @@ This document introduces you to <object classid="java:org.netbeans.modules.javah
</div>
<h2><a>Overview</a></h2>
<h2><a>Tutorial Overview</a></h2>
<div>
<p>
To add a Nifty <acronym title="Graphical User Interface">GUI</acronym> to your jME3 game:
Learn to add a Nifty <acronym title="Graphical User Interface">GUI</acronym> to your jME3 game by going through this multi-part tutorial:
</p>
<ol>
<li><div> <span><a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html">Understand the Nifty GUI Concepts</a></span> described on this page.</div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_best_practices.html">Browse this short list of Best Practices</a></div>
</li>
<li><div> Lay out your graphical user interface:</div>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html">Lay out the GUI in XML</a> </div>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html">Lay out the GUI in XML</a> – or –</div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html">Lay out the GUI in Java</a></div>
</li>
@ -53,7 +55,7 @@ To add a Nifty <acronym title="Graphical User Interface">GUI</acronym> to your j
</div>
<h2><a>Nifty GUI Concepts</a></h2>
<h2><a>Must Know: Nifty GUI Concepts</a></h2>
<div>
<p>
@ -66,27 +68,27 @@ Nifty GUIs are made up of the following <strong>elements</strong>:
</p>
<ul>
<li><div> A Nifty <acronym title="Graphical User Interface">GUI</acronym> is made up of one or more <strong>screens</strong>.</div>
<li><div> A Nifty <acronym title="Graphical User Interface">GUI</acronym> contains one or more <strong>screens</strong>.</div>
<ul>
<li><div> Nifty displays exactly one screen at a time.</div>
<li><div> Only one screen is visible at a time.</div>
</li>
<li><div> Name the first screen <code>start</code>. Name any others whatever you like.</div>
</li>
<li><div> Every screen is <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">controlled by a Java Controller class</a>.</div>
<li><div> Screen are <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">controlled by a Java Controller class</a>.</div>
</li>
</ul>
</li>
<li><div> A screen contains one or more <strong>layers</strong>.</div>
<ul>
<li><div> Layers are containers that impose an alignment on their content (vertical, horizontal, centered)</div>
<li><div> Layers are containers that impose alignment on their contents (vertical, horizontal, or centered)</div>
</li>
<li><div> Layers overlap (z-order), and cannot be nested.</div>
<li><div> Layers can overlap (z-order), and cannot be nested.</div>
</li>
</ul>
</li>
<li><div> A layer contains <strong>panels</strong>.</div>
<ul>
<li><div> Panels are containers that impose an alignment on their content (vertical, horizontal, centered)</div>
<li><div> Panels are containers that impose alignment on their contents (vertical, horizontal, or centered)</div>
</li>
<li><div> Panels can be nested, and cannot overlap.</div>
</li>
@ -96,90 +98,18 @@ Nifty GUIs are made up of the following <strong>elements</strong>:
</li>
</ul>
<p>
</div>
General usage tips about elements:
</p>
<ul>
<li><div> You give an element an ID String if you want to interact with it. <br/>
You can also use transparent, ID-less panels as spacers.</div>
</li>
<li><div> For layers and panels, you specify width and height in percent, or use <code>*</code> to fill the remaining space automatically.</div>
</li>
<li><div> Screen, layers, and panels… </div>
<h2><a>Resources</a></h2>
<div>
<ul>
<li><div> can have an RGBA background color: You can use colors during layout development to highlight which container is which.</div>
</li>
<li><div> can be transparent: In the finished <acronym title="Graphical User Interface">GUI</acronym>, the visible elements are images, text, and controls inside the panels.</div>
</li>
</ul>
</li>
<li><div> The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s Nifty editor lets you switch between the <acronym title="Extensible Markup Language">XML</acronym> editor and a <acronym title="Graphical User Interface">GUI</acronym> preview, so you see the effects of your code changes.</div>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_best_practices.html">Browse this short list of Best Practices before you start</a></div>
</li>
</ul>
</div>
<h2><a>Some Pro Tips...</a></h2>
<div>
</div>
<h4><a>XML or Java? Both!</a></h4>
<div>
<p>
The <acronym title="Extensible Markup Language">XML</acronym> and Java syntax are equivalent, so is it an either-or choice? Not quite.
We recommend to use <acronym title="Extensible Markup Language">XML</acronym> to lay out the static parts of the <acronym title="Graphical User Interface">GUI</acronym>. Then use Java syntax to control the dynamic parts of the <acronym title="Graphical User Interface">GUI</acronym> at runtime.
</p>
</div>
<h4><a>Activate Debug Highlighting</a></h4>
<div>
<p>
During development (and during this tutorial), the following debug code makes all panels visible. This helps you arrange them and find errors.
</p>
<pre>nifty.setDebugOptionPanelColors&#40;true&#41;;</pre>
<p>
Before the release, and for testing, set it to false again.
</p>
</div>
<h4><a>Use the jMonkeyEngine SDK</a></h4>
<div>
<p>
The <a href="/com/jme3/gde/core/docs/sdk.html">SDK</a> includes an <acronym title="Extensible Markup Language">XML</acronym> editor and previewer for Nifty <acronym title="Graphical User Interface">GUI</acronym> files. Open an <acronym title="Extensible Markup Language">XML</acronym> file, and switch between <acronym title="Extensible Markup Language">XML</acronym> and Preview mode.
</p>
</div>
<h4><a>Use XML Schema</a></h4>
<div>
<p>
Include the following <acronym title="Extensible Markup Language">XML</acronym> schema in the first line of your NiftyGUI <acronym title="Extensible Markup Language">XML</acronym> files and your IDE gives you hints and code completion.
</p>
<pre><span>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<span>&lt;nifty xmlns=&quot;http://nifty-gui.sourceforge.net/nifty-1.3.xsd&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>
<span> xsi:schemaLocation=&quot;http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd&quot;&gt;</span>
&lt;!-- Your IDE now tells you that one &lt;screen&gt;&lt;/screen&gt; element is expected here, etc. --&gt;
<span><span>&lt;/nifty&gt;</span></span></pre>
</div>
<h2><a>JME-Nifty Sample Code</a></h2>
<h3><a>JME-Nifty Sample Code</a></h3>
<div>
<ul>
<li><div> <acronym title="Extensible Markup Language">XML</acronym> examples</div>
@ -208,12 +138,12 @@ Include the following <acronym title="Extensible Markup Language">XML</acronym>
</div>
<h2><a>External Documentation</a></h2>
<h3><a>External Documentation</a></h3>
<div>
<p>
Learn more from the NiftyGUI page!
Learn more from the NiftyGUI page:
</p>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://sourceforge.net/projects/nifty-gui/files/nifty-gui/nifty-gui-the-manual-v1.0.pdf/download"><param name="text" value="<html><u>Nifty GUI - the Manual</u></html>"><param name="textColor" value="blue"></object></div>
@ -233,7 +163,7 @@ Learn more from the NiftyGUI page!
<p>
Next, learn how to lay out your graphical user interface. Typically, you start with <acronym title="Extensible Markup Language">XML</acronym>.
Now that you understand the concepts and know where to find more information, learn how to lay out a simple graphical user interface. Typically, you start doing this in <acronym title="Extensible Markup Language">XML</acronym>.
</p>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html">Lay out the GUI in XML</a> (recommended)</div>
@ -241,6 +171,18 @@ Next, learn how to lay out your graphical user interface. Typically, you start w
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html">Lay out the GUI in Java</a> (optional)</div>
</li>
</ul>
</div>
<h2><a>Nifty Logging (Nifty 1.3.1)</a></h2>
<div>
<p>
If you want to disable the nifty log lines, add this code after you created nifty:
</p>
<pre>Logger.getLogger(&quot;de.lessvoid.nifty&quot;).setLevel(Level.SEVERE);
Logger.getLogger(&quot;NiftyInputEventHandlingLog&quot;).setLevel(Level.SEVERE); </pre>
<div><span>
<a href="/wiki/doku.php/tag:gui?do=showtag&amp;tag=tag%3Agui">gui</a>,
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,

@ -4,6 +4,8 @@
<ol>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html">Nifty GUI Concepts</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_best_practices.html">Nifty GUI Best Practices</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html">Nifty GUI XML Layout</a> or <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html">Nifty GUI Java Layout</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html">Nifty GUI Overlay</a> or <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html">Nifty GUI Projection</a></div>
@ -49,7 +51,7 @@ public class MyStartScreen extends AbstractAppState implements ScreenController
/** custom methods */
&nbsp;
public MyStartScreen&#40;String data&#41; &#123;
/** You custom constructor, can accept arguments */
/** Your custom constructor, can accept arguments */
&#125;
&nbsp;
/** Nifty GUI ScreenControl methods */

@ -4,6 +4,8 @@
<ol>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html">Nifty GUI Concepts</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_best_practices.html">Nifty GUI Best Practices</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html">Nifty GUI XML Layout</a> or <strong>Nifty <acronym title="Graphical User Interface">GUI</acronym> Java Layout</strong></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html">Nifty GUI Overlay</a> or <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html">Nifty GUI Projection</a></div>
@ -606,7 +608,7 @@ Before initializing the nifty screens, you set up properties and register media.
<td> setDebugOptionPanelColors(true);</td><td> Highlight all panels, makes it easier to arrange them. </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [17261-17584] -->
<!-- EDIT1 TABLE [17309-17632] -->
<p>
Example:

@ -4,6 +4,8 @@
<ol>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html">Nifty GUI Concepts</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_best_practices.html">Nifty GUI Best Practices</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html">Nifty GUI XML Layout</a> or <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html">Nifty GUI Java Layout</a></div>
</li>
<li><div> <strong>Nifty <acronym title="Graphical User Interface">GUI</acronym> Overlay</strong> or <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html">Nifty GUI Projection</a></div>

@ -5,7 +5,7 @@
<p>
Even though you create and populate the popup menu in Java, you still need a &quot;placeholder&quot; in your <acronym title="Extensible Markup Language">XML</acronym> file.
The popup menu <code>niftyPopupMenu</code> is a default Control from <code>nifty-default-controls.xml</code>.
The popup element needs to be placed <em>outside</em> of any screen!
</p>
<pre><span>&lt;useControls filename=&quot;nifty-default-controls.xml&quot;/&gt;</span>
...
@ -24,7 +24,7 @@ A brief explanation of some the attributes above:
</li>
<li><div> The Controller tells Nifty which Java class handles MenuItemActivatedEvent.</div>
</li>
<li><div> The on(Secondary/Tertiary)Click tells Nifty to close the popup if the user clicks anywhere except on the menu items (in this example)</div>
<li><div> The on(Secondary/Tertiary)Click tells Nifty to close the popup if the user clicks anywhere except on the menu items (in this example; you have to define the closePopup()-method yourself, in the screen controller)</div>
</li>
<li><div> The control id is used by the Java class to define a control type (i.e. Menu)</div>
</li>
@ -70,6 +70,8 @@ private class menuItem &#123;
</li>
<li><div> The showMenu() method is called by something to trigger the menu (i.e. could be a Key or some other method).</div>
</li>
<li><div> Note: if you want to be able to access the popup via your id, use createPopupWithId(id, id) instead.</div>
</li>
</ul>
<p>

@ -4,6 +4,8 @@
<ol>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html">Nifty GUI Concepts</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_best_practices.html">Nifty GUI Best Practices</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html">Nifty GUI XML Layout</a> or <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html">Nifty GUI Java Layout</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html">Nifty GUI Overlay</a> or <strong>Nifty <acronym title="Graphical User Interface">GUI</acronym> Projection</strong></div>

@ -1,31 +1,14 @@
<h1><a>Nifty GUI 1.3 Scenarios</a></h1>
<h1><a>Nifty GUI 1.3 - Usecase Scenarios</a></h1>
<div>
<p>
This document contains best practices for typical NiftyGUI usercase scenarios. These tips assume that you have read the <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html">Introduction to jME3&#039;s Nifty GUI integration</a> first, and have laid out a basic <acronym title="Graphical User Interface">GUI</acronym> that interacts with your Java application. Here you learn how you integrate the <acronym title="Graphical User Interface">GUI</acronym> better, and add effects and advanced controls.
This document contains typical NiftyGUI usecase scenarios, such as adding effects, game states, and creating typical game screens.
</p>
</div>
<h2><a>Java or XML?</a></h2>
<div>
<p>
You can build Nifty GUIs using <acronym title="Extensible Markup Language">XML</acronym> or Java syntax. Which one should you choose?
</p>
<ul>
<li><div> Build your basic static UI layout using <acronym title="Extensible Markup Language">XML</acronym> - it&#039;s cleaner to write and read. </div>
</li>
<li><div> While the game runs, you dynamically change the UI content using Java code. </div>
</li>
</ul>
<p>
This approach has the advantage that you can, for example, switch between a phone and a desktop UI by simply swapping one base <acronym title="Extensible Markup Language">XML</acronym> file. You design the swappable UI with different layouts, but use the same element IDs, so your dynamic Java code works the same no matetr which base <acronym title="Extensible Markup Language">XML</acronym> layout you use it on.
Requirements: These tips assume that you have read and understood the <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html">Creating JME3 User Interfaces with Nifty GUI</a> tutorial, and have already laid out a basic <acronym title="Graphical User Interface">GUI</acronym> that interacts with your JME3 application. Here you learn how you integrate the <acronym title="Graphical User Interface">GUI</acronym> better, and add effects and advanced controls.
</p>
</div>
@ -142,7 +125,7 @@ public StartScreenState&#40;SimpleApplication app&#41;&#123;
<td>${PROP.key}</td><td> looks up <code>key</code> in the Nifty properties. Use Nifty.setGlobalproperties(properties) and Nifty.getGlobalproperties(&quot;key&quot;). Or SystemGetProperties(key);</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [4107-4638] -->
<!-- EDIT1 TABLE [3632-4163] -->
<p>
See also: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=MarkUp"><param name="text" value="<html><u>http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=MarkUp</u></html>"><param name="textColor" value="blue"></object>
@ -170,12 +153,12 @@ For example, create a <code>MyHudScreen.java</code> for the <code>hud</code> scr
</div>
<h2><a>Create a Load Screen</a></h2>
<h2><a>Create a &quot;Loading...&quot; Screen</a></h2>
<div>
<p>
<a href="/com/jme3/gde/core/docs/jme3/advanced/loading_screen.html">loading_screen</a>
Get the full <a href="/com/jme3/gde/core/docs/jme3/advanced/loading_screen.html">Loading Screen</a> tutorial here.
</p>
</div>
@ -184,7 +167,8 @@ For example, create a <code>MyHudScreen.java</code> for the <code>hud</code> scr
<div>
<p>
<a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_popup_menu.html">nifty GUI PopUp Menu</a>
Get the full <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_popup_menu.html">Nifty GUI PopUp Menu</a> tutorial here.
</p>
</div>
@ -270,13 +254,13 @@ You can name the method (here <code>clicked</code>) what ever you like, as long
</div>
<h2><a>Loading Several XML Files</a></h2>
<h2><a>Load Several XML Files</a></h2>
<div>
<p>
The basic Nifty <acronym title="Graphical User Interface">GUI</acronym> example showed how to use the <code>nifty.fromXML()</code> method to load one <acronym title="Extensible Markup Language">XML</acronym> file containing all Nifty <acronym title="Graphical User Interface">GUI</acronym> screens.
The following code sample shows how you can load several <acronym title="Extensible Markup Language">XML</acronym> files into one nifty object. Loading several files with <code>nifty.addXml()</code> allows you to use one <acronym title="Extensible Markup Language">XML</acronym> file per one screen layout.
The following code sample shows how you can load several <acronym title="Extensible Markup Language">XML</acronym> files into one nifty object. Loading several files with <code>nifty.addXml()</code> allows you to split up each screen into one <acronym title="Extensible Markup Language">XML</acronym> file, insetad of all into one hard-to-read <acronym title="Extensible Markup Language">XML</acronym> file.
</p>
<pre>NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay&#40;assetManager, inputManager, audioRenderer, viewPort&#41;;
Nifty nifty = niftyDisplay.getNifty&#40;&#41;;

@ -4,6 +4,8 @@
<ol>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html">Nifty GUI Concepts</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_best_practices.html">Nifty GUI Best Practices</a></div>
</li>
<li><div> <strong>Nifty <acronym title="Graphical User Interface">GUI</acronym> <acronym title="Extensible Markup Language">XML</acronym> Layout</strong> or <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html">Nifty GUI Java Layout</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html">Nifty GUI Overlay</a> or <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html">Nifty GUI Projection</a></div>

@ -230,8 +230,11 @@ Browse the full source code of all <object classid="java:org.netbeans.modules.ja
<p>
See also: <a href="/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html">Effects Overview</a>
</p>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:effect?do=showtag&amp;tag=tag%3Aeffect">effect</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:particle_emitters?do=export_xhtmlbody">view online version</a></em></p>

@ -4,15 +4,15 @@
<p>
The jMonkeyEngine3 has built-in support for <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jbullet.advel.cz"><param name="text" value="<html><u>jBullet physics</u></html>"><param name="textColor" value="blue"></object> via the <code>com.jme3.bullet</code> package.
A physics simulation is used in games and applications where objects are exposed to physical forces: Think of games like pool billiard and car racing simulators. Massive objects are pulled by gravity, forces cause objects to gain momentum, friction slows them down, solid objects collide and bounce off one another, etc. Action and Adventure games also make use of physics to implement solid obstacles, falling, and jumping.
</p>
<p>
Game Physics are used in applications that simulate mass/gravity, collisions, and friction. Think of pool billiard or car racing simulations.
The jMonkeyEngine3 has built-in support for <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jbullet.advel.cz"><param name="text" value="<html><u>jBullet Physics</u></html>"><param name="textColor" value="blue"></object> (based on <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://bulletphysics.org"><param name="text" value="<html><u>Bullet Physics</u></html>"><param name="textColor" value="blue"></object>) via the <code>com.jme3.bullet</code> package. This article focuses mostly on the RigidBodyControl, but also introduces you to others.
</p>
<p>
If you are looking for info on how to respond to physics events, read about <a href="/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html">Physics Listeners</a>.
If you are looking for info on how to respond to physics events such as collisions, read about <a href="/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html">Physics Listeners</a>.
</p>
</div>
@ -22,30 +22,35 @@ If you are looking for info on how to respond to physics events, read about <a h
<p>
Bullet physics runs internally at 60fps by default. This rate is not dependent on the actual framerate and it does not lock the framerate at 60fps. Instead, when the actual fps is higher than the physics framerate the system will display interpolated positions for the physics entities. When the framerate is lower than the physics framerate the physics space will be stepped multiple times per frame to make up for the missing calculations.
Bullet physics runs internally at 60fps by default. This rate is not dependent on the actual framerate and it does not lock the framerate at 60fps. Instead, when the actual fps is higher than the physics framerate the system will display interpolated positions for the physics objects. When the framerate is lower than the physics framerate, the physics space will be stepped multiple times per frame to make up for the missing calculations. You create a Bullet PhysicsSpace in jME3 with a <code>com.jme3.bullet.BulletAppState</code>.
</p>
<p>
A bullet physics space can be created with a BulletAppState. The updating and syncing of the actual physics entities happens in the following way:
</p>
<p>
A &quot;normal&quot; update loop with physics looks like this:
Internally, the updating and syncing of the actual physics objects happens in the following way:
</p>
<ol>
<li><div> collision callbacks (BulletAppState.update())</div>
<li><div> collision callbacks (<code>BulletAppState.update()</code>)</div>
</li>
<li><div> user update (simpleUpdate / update)</div>
<li><div> user update (<code>simpleUpdate</code> in main loop, <code>update()</code> in Controls and AppStates)</div>
</li>
<li><div> physics to scenegraph syncing/applying (updateLogicalState())</div>
<li><div> physics to scenegraph syncing and applying (<code>updateLogicalState()</code>)</div>
</li>
<li><div> stepping physics (before / in parallel to Application.render())</div>
<li><div> stepping physics (before or in parallel to <code>Application.render()</code>)</div>
</li>
</ol>
<p>
When you use physics, 1 unit (1.0f) equals 1 meter, weight is expressed in kilograms, most torque and rotation values are expressed in radians.
When you use this physics simulation, values correspond to the following units:
</p>
<ul>
<li><div> 1 length unit (1.0f) equals 1 meter, </div>
</li>
<li><div> 1 weight unit (1.0f) equals 1 kilogram,</div>
</li>
<li><div> most torque and rotation values are expressed in radians.</div>
</li>
</ul>
</div>
@ -88,17 +93,21 @@ Do the following once per application to gain access to the <code>physicsSpace</
</li>
<li><div> Initialize your bulletAppState and attach it to the state manager: <pre>public void simpleInitApp&#40;&#41; &#123;
bulletAppState = new BulletAppState&#40;&#41;;
stateManager.attach&#40;bulletAppState&#41;;
...</pre>
stateManager.attach&#40;bulletAppState&#41;;</pre>
</div>
</li>
</ol>
<p>
You can also access the BulletAppState via the state manager:
<p><div>In your application, you can always access the <code>BulletAppState</code> via the ApplicationStateManager:
</p>
<pre>BulletAppState bas = app.getStateManager&#40;&#41;.getState&#40;BulletAppState.class&#41;;</pre>
<p>
</div></p>
</p>
<pre>stateManager.getState&#40;BulletAppState.class&#41;</pre>
<p>
For each Spatial that you want to be physical:
@ -106,25 +115,26 @@ For each Spatial that you want to be physical:
<ol>
<li><div> Create a CollisionShape.</div>
</li>
<li><div> Create a PhysicsControl by supplying the CollisionShape and mass.</div>
<ul>
<li><div> E.g. <code>com.jme3.bullet.control.RigidBodyControl</code></div>
<li><div> Create the PhysicsControl from the CollisionShape and a mass value.</div>
</li>
</ul>
</li>
<li><div> Add the PhysicsControl to the Spatial.</div>
<li><div> Add the PhysicsControl to its Spatial.</div>
</li>
<li><div> Add the PhysicsControl to the physicsSpace object.</div>
<li><div> Add the PhysicsControl to the PhysicsSpace.</div>
</li>
<li><div> Attach the Spatial to the rootNode, as usual.</div>
<li><div> Attach the Spatial to the rootNode (as usual).</div>
</li>
<li><div> (Optional) Implement the <code>PhysicsCollisionListener</code> interface to respond to <code>PhysicsCollisionEvent</code>s if desired.</div>
<li><div> (Optional) Implement the <code>PhysicsCollisionListener</code> interface to respond to <code>PhysicsCollisionEvent</code>s.</div>
</li>
</ol>
<p>
Let&#039;s look at the details:
</p>
</div>
<h3><a>Collision Shapes</a></h3>
<h2><a>Create a CollisionShape</a></h2>
<div>
<p>
@ -133,118 +143,153 @@ A Collision Shape is a simplified shape for which physics are easier to calculat
</p>
<p>
Before you can create a Physics Control, you must create a Collision Shape from the <code>com.jme3.bullet.collision.shapes</code> package. (Read the tip under &quot;PhysicsControls Code Samples&quot; to learn how to use default CollisionShapes for Boxes and Spheres.)
Before you can create a Physics Control, you must create a CollisionShape from the <code>com.jme3.bullet.collision.shapes</code> package. (Read the tip under &quot;PhysicsControls Code Samples&quot; how to use default CollisionShapes for Boxes and Spheres.)
</p>
<div><table>
<tr>
<th> Shape </th><th> Usage </th><th> Examples </th>
<th> Non-Mesh CollisionShape </th><th> Usage </th><th> Examples </th>
</tr>
<tr>
<td> BoxCollisionShape </td><td> Box shaped entities Does not roll.</td><td> Bricks, crates, simple oblong entities. </td>
<td> BoxCollisionShape() </td><td> Box-shaped behaviour, does not roll. </td><td> Oblong or cubic objects like bricks, crates, furniture. </td>
</tr>
<tr>
<td> SphereCollisionShape </td><td> Spherical entities. Can roll. </td><td> Balls, simple compact entities. </td>
<td> SphereCollisionShape() </td><td> Spherical behaviour, can roll. </td><td> Compact objects like apples, soccer balls, cannon balls, compact spaceships. </td>
</tr>
<tr>
<td> CylinderCollisionShape </td><td> Tube-shaped and disc-shaped entities. Can roll on one side. </td><td> Pillars, wheels. </td>
<td> CylinderCollisionShape() </td><td> Tube-shaped and disc-shaped behaviour, can roll on one side. </td><td> Oblong objects like pillars. <br/>
Disc-shaped objects like wheels, plates. </td>
</tr>
<tr>
<td> CapsuleCollisionShape </td><td> A compound of a cylinder plus two spheres at the top and bottom. Is locked to stay upright, does not roll. </td><td> Optimized for CharacterControls: A cylinder-shaped body does not get stuck at corners and vertical obstacles; the rounded top and bottom do not get stuck on stair steps and ground obstacles. </td>
<td> CompoundCollisionShape() </td><td> A CompoundCollisionShape allows custom combinations of shapes. Use the <code>addChildShape()</code> method on the compound object to add other shapes to it and position them relative to one another. </td><td> A car with wheels (1 box + 4 cylinders), etc. </td>
</tr>
<tr>
<td> CompoundCollisionShape </td><td> A CompoundCollisionShape allows custom combinations of box/sphere/cylinder shapes to form another more complex shape. </td><td> Complex shapes. </td>
<td> CapsuleCollisionShape() </td><td> A built-in compound shape of a vertical cylinder with one sphere at the top and one sphere at the bottom. Typically used with <a href="/com/jme3/gde/core/docs/jme3/advanced/walking_character.html">CharacterControls</a>: A cylinder-shaped body does not get stuck at corners and vertical obstacles; the rounded top and bottom do not get stuck on stair steps and ground obstacles. </td><td> Persons, animals. </td>
</tr>
<tr>
<td> MeshCollisionShape </td><td> A free-form mesh-accurate shape that wraps itself around a static entity. <br/>
<strong>Limitations:</strong> Only non-mesh collision shapes (sphere, box, cylinder, compound) can collide with mesh-accurate collision shapes. Only works for static obstacles. </td><td> A whole static game level model. </td>
<td> SimplexCollisionShape() </td><td> A physical point, line, triangle, or rectangle Shape, defined by one to four points.</td><td>Guardrails</td>
</tr>
<tr>
<td> GImpactCollisionShape </td><td> This free-form Mesh Collision Shape that wraps itself around dynamically moving entities. Uses <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://gimpact.sourceforge.net/"><param name="text" value="<html><u>http://gimpact.sourceforge.net/</u></html>"><param name="textColor" value="blue"></object>. <br/>
<strong>Limitations:</strong> CPU intensive, use sparingly! We recommend using HullCollisionShapes or CompoundShapes made of simple shapes if you need improved performance. </td><td> Physics simulation of a complex object. </td>
<td> PlaneCollisionShape() </td><td> A 2D plane. Very fast. </td><td> Flat solid floor or wall. </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [4303-5700] -->
<p>
All non-mesh CollisionShapes can be used for dynamic, kinematic, as well as static Spatials. (Code samples see below)
</p>
<div><table>
<tr>
<th> Mesh CollisionShapes </th><th> Usage </th><th> Examples </th>
</tr>
<tr>
<td> HeightFieldCollisionShape </td><td> Optimized Mesh Collision Shape for static terrains. This shape is much faster than a other Free-Form Mesh Shapes. Requires heightmap data.</td><td>Optimized for terrains.</td>
<td> MeshCollisionShape </td><td> A mesh-accurate shape for static or kinematic Spatials. Can have complex shapes with openings and appendages. <br/>
<strong>Limitations:</strong> Collisions between two mesh-accurate shapes cannot be detected, only non-mesh shapes can collide with this shape. This Shape does not work with dynamic Spatials. </td><td> A whole static game level model. </td>
</tr>
<tr>
<td> HullCollisionShape </td><td> A collision shape that is based on a mesh but is a simplified convex version. </td><td></td>
<td> HullCollisionShape </td><td> A less accurate shape for dynamic Spatials that cannot easily be represented by a CompoundShape. <br/>
<strong>Limitations:</strong> The shape is convex (behaves as if you gift-wrapped the object), i.e. openings, appendages, etc, are not individually represented. </td><td> A dynamic 3D model. </td>
</tr>
<tr>
<td> SimplexCollisionShape </td><td>A physical point, line, triangle, or quad Collision Shape, defined by one to four points.</td><td>Guardrails</td>
<td> GImpactCollisionShape </td><td> A mesh-accurate shape for dynamic Spatials. It uses <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://gimpact.sourceforge.net/"><param name="text" value="<html><u>http://gimpact.sourceforge.net/</u></html>"><param name="textColor" value="blue"></object>. <br/>
<strong>Limitations:</strong> CPU intensive, use sparingly! We recommend using HullCollisionShape (or CompoundShape) instead to improve performance. Collisions between two mesh-accurate shapes cannot be detected, only non-mesh shapes can collide with this shape. </td><td> Complex dynamic objects (like spiders) in Virtual Reality or scientific simulations. </td>
</tr>
<tr>
<td> PlaneCollisionShape </td><td> A 2D plane </td><td> Flat solid floor or wall. </td>
<td> HeightFieldCollisionShape </td><td> A mesh-accurate shape optimized for static terrains. This shape is much faster than other mesh-accurate shapes. <br/>
<strong>Limitations:</strong> Requires heightmap data. Collisions between two mesh-accurate shapes cannot be detected, only non-mesh shapes can collide with this shape.</td><td>Static terrains.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [3694-5743] -->
<!-- EDIT2 TABLE [5821-7338] -->
<p>
<p><div>Pick the right shape for the mesh for what you want to do: If you give a box a sphere collision shape, it will roll; if you give a ball a box collision shape, it will sit on a slope. Make collision shapes visible by adding the following line after the bulletAppState initialization: <br/>
<code>bulletAppState.getPhysicsSpace().enableDebug(assetManager);</code>
</div></p>
The mesh-accurate shapes can use a CollisionShapeFactory as constructor (code samples see below).
</p>
<p>
Let&#039;s look at examples of how to use the CollisionShape constructor:
<p><div>Pick the simplest and most applicable shape for the mesh for what you want to do: If you give a box a sphere collision shape, it will roll; if you give a ball a box collision shape, it will sit on a slope. If the shape is too big, the object will seem to float; if the shape is too small it will seem to sink into the ground. During development and debugging, you can make collision shapes visible by adding the following line after the bulletAppState initialization:
</p>
</div>
<h3><a>CollisionShape Code Samples</a></h3>
<div>
<pre>bulletAppState.getPhysicsSpace&#40;&#41;.enableDebug&#40;assetManager&#41;;</pre>
<p>
MeshCompoundShape and MeshCollisionShape are both mesh-accurate and are intended for immobile scene entities, such as terrains, buildings, or whole shooter levels. Limitation: Only collisions of non-mesh-accurate shapes (sphere, box, etc) shapes can be detected against mesh-accurate shapes.
</div></p>
</p>
<pre>CompoundCollisionShape myComplexShape =
CollisionShapeFactory.createMeshShape&#40;&#40;Node&#41; myComplexGeometry &#41;;</pre>
<p>
An angular, non-mesh-accurate compound shape:
</p>
<pre>CompoundCollisionShape boxShape =
CollisionShapeFactory.createBoxCompoundShape&#40;&#40;Node&#41; someBox&#41;;</pre>
</div>
<p>
SphereCollisionShape, BoxCollisionShape, CapsuleCollisionShape are also not mesh-accurate, but have better performance. The can be added to anything, and collisions between them and any other shape can be detected.
</p>
<pre>SphereCollisionShape sphereShape =
<h3><a>CollisionShape Code Samples</a></h3>
<div>
<ul>
<li><div> One way of using a constructor and a Geometry&#039;s mesh for static Spatials:<pre>MeshCollisionShape level_shape =
new MeshCollisionShape&#40;level_geo.getMesh&#40;&#41;&#41;;</pre>
</div>
</li>
<li><div> One way of using a constructor and a Geometry&#039;s mesh for dynamic Spatials:<pre>HullCollisionShape shape =
new HullCollisionShape&#40;katamari_geo.getMesh&#40;&#41;&#41;;</pre>
</div>
</li>
<li><div> Creating a dynamic compound shape for a whole Node and subnodes:<pre>CompoundCollisionShape myComplexShape =
CollisionShapeFactory.createMeshShape&#40;&#40;Node&#41; myComplexGeometry &#41;;</pre>
</div>
</li>
<li><div> Creating a dynamic HullCollisionShape shape (or CompoundCollisionShape with HullCollisionShapes as children) for a Geometry:<pre>CollisionShape shape =
CollisionShapeFactory.createDynamicMeshShape&#40;spaceCraft&#41;;</pre>
</div>
</li>
<li><div> An angular, non-mesh-accurate compound shape:<pre>CompoundCollisionShape boxShape =
CollisionShapeFactory.createBoxCompoundShape&#40;&#40;Node&#41; crate_geo&#41;;</pre>
</div>
</li>
<li><div> A round, non-mesh-accurate compound shape: <pre>SphereCollisionShape sphereShape =
new SphereCollisionShape&#40;1.0f&#41;;</pre>
</div>
</li>
</ul>
</div>
<h2><a>PhysicsControls</a></h2>
<h2><a>Create PhysicsControl</a></h2>
<div>
<p>
BulletPhysics are available in jME3 through Bullet Physics Controls from the com.jme3.bullet.control package. PhysicsControls are the recommended way to use physics in a jME3 application. PhysicsControls are flexible and can be added to any Spatial to make it act according to physical properties. jME&#039;s PhysicsControl classes directly extend Bullet Physics objects.
BulletPhysics are available in jME3 through PhysicsControls classes from the com.jme3.bullet.control package. jME3&#039;s PhysicsControl classes directly extend BulletPhysics objects and are the recommended way to use physics in a jME3 application. PhysicsControls are flexible and can be added to any Spatial to make it act according to physical properties.
</p>
<div><table>
<tr>
<th>Physics Control</th><th>Purpose</th>
<th>Standard PhysicsControls</th><th> Usage</th><th> Examples </th>
</tr>
<tr>
<td>RigidBodyControl</td><td>Use for dynamic physical entities in the scene – things that are freely affected by physical forces such as collisions, forces, or changing gravity. For example: Impacting projectiles, moving obstacles like crates, rolling and bouncing balls, space ships…</td>
<td>RigidBodyControl</td><td>The most commonly used PhysicsControl. You can use it for dynamic objects (solid objects that freely affected by collisions, forces, or gravity), for static objects (solid but not affected by any forces), or kinematic objects (remote-controlled solid objects). </td><td>Impacting projectiles, moving obstacles like crates, rolling and bouncing balls, elevators, flying aircaft or space ships. <br/>
Solid immobile floors, walls, static obstacles.</td>
</tr>
<tr>
<td>CharacterControl</td><td>Use for upright characters (persons, animals) that moves and stands orthogonally to the X/Z plane. It is not affected by directional forces or gravity and it does not fall over (as a RigidBodyControl&#039;ed spatial would), a CharacterControl&#039;s spatial is permanently locked locked upright (as a walking character would). </td>
<td>GhostControl</td><td>Use for collision and intersection detection between physical objects. A GhostControl itself is <em>non-solid</em> and invisible. GhostControl moves with the Spatial it is attached to. Use GhostControls to <a href="/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html">implement custom game interactions</a> by adding it to a visible Geometry. </td><td>A monster&#039;s &quot;aggro radius&quot;, CharacterControl collisions, motion detectors, photo-electric alarm sensors, poisonous or radioactive perimeters, life-draining ghosts, etc. </td>
</tr>
</table></div>
<!-- EDIT3 TABLE [9527-10506] --><div><table>
<tr>
<td>GhostControl</td><td>Use for collision and intersection detection between physical entities. A GhostControl is <em>non-solid</em> and invisible, and it moves with the Spatial it is attached to. Use this for interactive game elements that do not have a visible solid Geometry: A monster&#039;s &quot;aggro radius&quot;, motion detectors, photoelectric alarm sensors, poisonous or radioactive perimeters, life-draining ghosts, etc. </td>
<th>Special PhysicsControls</th><th> Usage</th><th> Examples </th>
</tr>
<tr>
<td>VehicleControl <br/>
PhysicsVehicleWheel</td><td> Use for <a href="/com/jme3/gde/core/docs/jme3/advanced/vehicles.html">vehicles</a> such as cars, tanks, hover crafts, ships, motorcycles.</td>
PhysicsVehicleWheel</td><td> Special Control used for <a href="/com/jme3/gde/core/docs/jme3/advanced/vehicles.html">&quot;terrestrial&quot; vehicles with suspension and wheels</a>. </td><td>Cars, tanks, hover crafts, ships, motorcycles…</td>
</tr>
<tr>
<td>RagDollControl</td><td> Use for collapsing, flailing, or loosely falling characters or with a <a href="/com/jme3/gde/core/docs/jme3/advanced/ragdoll.html">Ragdoll</a> (or puppet-on-strings) behaviour.</td>
<td>CharacterControl</td><td>Special Control used for <a href="/com/jme3/gde/core/docs/jme3/advanced/walking_character.html">Walking Character</a>s.</td><td>Upright walking persons, animals, robots… </td>
</tr>
<tr>
<td>RagDollControl</td><td>Special Control used for <a href="/com/jme3/gde/core/docs/jme3/advanced/ragdoll.html">collapsing, flailing, or falling characters</a> </td><td>Falling persons, animals, robots, &quot;Rag dolls&quot;</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [7519-8845] -->
<!-- EDIT4 TABLE [10508-11020] -->
<p>
Click the links for details on the special PhysicsControls. This article is about RigidBodyControl.
</p>
</div>
<h3><a>PhysicsControls Code Samples</a></h3>
@ -252,137 +297,168 @@ PhysicsVehicleWheel</td><td> Use for <a href="/com/jme3/gde/core/docs/jme3/advan
<p>
The various Physics Control constructors expect a Collision Shape (here thingShape) and a mass (a float).
The PhysicsControl constructors expect a Collision Shape and a mass (a float in kilogram). The most commonly used PhysicsControl is the RigidBodyControl:
</p>
<pre>RigidBodyControl myControl=new RigidBodyControl&#40; thingShape , 1.0f &#41;;</pre>
<pre>RigidBodyControl myThing_phys =
new RigidBodyControl&#40; myThing_shape , 123.0f &#41;; // dynamic</pre>
<pre>RigidBodyControl myDungeon_phys =
new RigidBodyControl&#40; myDungeon_shape , 0.0f &#41;; // static </pre>
<p>
To make the Physics Control visible in the scene, you must attach the Control to a Geometry (e.g. a model named myGeometry):
<p><div>When you create the PhysicsControl, the mass value makes an important distinction: Set the mass to a non-zero value to create a dynamic object that can fall or roll, etc. Set the mass value to zero to create a static object, such as floor, wall, etc. If you give your floor a mass, it will fall out of the scene!
</div></p>
</p>
<pre>myGeometry.addControl&#40;myControl&#41;;</pre>
<p>
This code sample creates a physical Character:
The following creates a box Geometry with the correct default BoxCollisionShape:
</p>
<pre>// Load any model
Node model = &#40;Node&#41; assetManager.loadModel&#40;&quot;Models/myCharacterModel.mesh.xml&quot;&#41;;
rootNode.attachChild&#40;model&#41;;
// Create a appropriate physical shape for it
CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape&#40;1.5f, 6f, 1&#41;;
CharacterControl character_phys = new CharacterControl&#40;capsuleShape, 0.01f&#41;;
// Attach physical properties to model and PhysicsSpace
model.addControl&#40;character_phys&#41;;
bulletAppState.getPhysicsSpace&#40;&#41;.add&#40;character_phys&#41;;</pre>
<pre>Box&#40;1,1,1&#41;;
Geometry box_geo = new Geometry&#40;&quot;Box&quot;, b&#41;;
box_geo.addControl&#40;new RigidBodyControl&#40; 1.0f &#41;&#41;; // explicit non-zero mass, implicit BoxCollisionShape</pre>
<p>
<p><div>Spheres and Boxes can fall back to the correct default CollisionShape if you do not specify a CollisionShape in the RigidBodyControl constructor.
</div></p>
The following creates a MeshCollisionShape for a whole loaded (static) scene:
</p>
<pre>...
gameLevel.addControl&#40;new RigidBodyControl&#40;0.0f&#41;&#41;; // explicit zero mass, implicit MeshCollisionShape</pre>
<p>
For example, the following creates a box with the correct Box Collision Shape:
<p><div>Spheres and Boxes automatically fall back on the correct default CollisionShape if you do not specify a CollisionShape in the RigidBodyControl constructor. Complex static objects can fall back on MeshCollisionShapes.
</div></p>
</p>
<pre>Box&#40;1,1,1&#41;;
myBox.addControl&#40;new RigidBodyControl&#40; 1.0f &#41;&#41;; // implicit BoxCollisionShape
bulletAppState.getPhysicsSpace&#40;&#41;.add&#40;myBox&#41;;</pre>
</div>
<h2><a>Physics Space</a></h2>
<h2><a>Add PhysicsControl to Spatial</a></h2>
<div>
<p>
The Physics Space is an object in BulletAppState that is like a rootNode for Physics Controls. It manages global settings.
For each physical Spatial in the scene:
</p>
<ol>
<li><div> You can specify parameters such as gravity and accuracy.<pre>bulletAppState.getPhysicsSpace&#40;&#41;.setGravity&#40;new Vector3f&#40;0f,-1f,0f&#41;&#41;;
bulletAppState.getPhysicsSpace&#40;&#41;.setAccuracy&#40;0.005f&#41;;</pre>
<li><div> Add a PhysicsControl to a Spatial. <pre>myThing_geo.addControl&#40;myThing_phys&#41;;</pre>
</div>
</li>
<li><div> Add all PhysicsControls to the PhysicsSpace.<pre>bulletAppState.getPhysicsSpace&#40;&#41;.add&#40;myPhysicsControl&#41;; ...</pre>
</div>
<li><div> Remember to also attach the Spatial to the rootNode, as always!</div>
</li>
<li><div> Add each PhysicsControl to a Spatial. <pre>myModel.addControl&#40;myPhysicsControl&#41;; ...</pre>
</ol>
</div>
<h2><a>Add PhysicsControl to PhysicsSpace</a></h2>
<div>
<p>
The PhysicsSpace is an object in BulletAppState that is like a rootNode for Physics Controls.
</p>
<ul>
<li><div> Add the PhysicsControl to the PhysicsSpace. <pre>bulletAppState.getPhysicsSpace&#40;&#41;.add&#40;myThing_phys&#41;; ...</pre>
</div>
</li>
<li><div> Attach the Spatial to the rootNode, as always. <pre>rootNode.attachChild&#40;myModel&#41;; ...</pre>
<li><div> When you remove a physical object from the scene, remove the PhysicsControl from the PhysicsSpace, and (as always) remove the Spatial from the rootNode: <pre>bulletAppState.getPhysicsSpace&#40;&#41;.remove&#40;myThing_phys&#41;;
myModel.removeFromParent&#40;&#41;;</pre>
</div>
</li>
</ol>
</ul>
<p>
You remove physical entities from the scene by removing their PhysicsControl from the PhysicsSpace and also their Spatial from the rootNode:
<p><div>You can register the PhysicsControl to the PhysicsSpace, or register the Geometry to the PhysicsSpace after you added the PhysicsControl to it.
</div></p>
</p>
</div>
<h3><a>PhysicsSpace Code Samples</a></h3>
<div>
<p>
The PhysicsSpace also manages global physics settings. Typically, you can leave the defaults, and you don&#039;t need to change the following settings:
</p>
<pre>bulletAppState.getPhysicsSpace&#40;&#41;.remove&#40;myPhysicsControl&#41;;
myModel.removeFromParent&#40;&#41;;</pre>
<ul>
<li><div> Specify physics accuracy.<pre>bulletAppState.getPhysicsSpace&#40;&#41;.setAccuracy&#40;1f/60f;&#41;;</pre>
</div>
</li>
<li><div> Specify global gravity. <pre>bulletAppState.getPhysicsSpace&#40;&#41;.setGravity&#40;new Vector3f&#40;0, -9.81f, 0&#41;&#41;;</pre>
</div>
</li>
<li><div> Specify the size of the physics space as two opposite corners (only applies to AXIS_SWEEP broadphase).<pre>bulletAppState.getPhysicsSpace&#40;&#41;.setWorldMax&#40;new Vector3f&#40;10000f, 10000f, 10000f&#41;&#41;;
bulletAppState.getPhysicsSpace&#40;&#41;.setWorldMin&#40;new Vector3f&#40;-10000f, -10000f, -10000f&#41;&#41;;</pre>
</div>
</li>
</ul>
</div>
<h2><a>Properties of Physical Entities</a></h2>
<h2><a>Specify Physical Properties</a></h2>
<div>
<p>
On a PhysicsControl, you can set the following physical properties.
After you have registered, attached, and added everything, you can adjust physical properties or apply forces.
</p>
<p>
On a RigidBodyControl, you can set the following physical properties.
</p>
<div><table>
<tr>
<th> RigidBodyControl Method </th><th> Property </th>
</tr>
<tr>
<td> setGravity(new Vector3f(0f,-10f,0f)) </td><td> You can change the gravity of individual physics entities after they were added to the physics space. Gravity is a vector pointing towards the center of gravity. The longer the vector, the stronger is gravity. If gravity is the same absolute direction for all entities, set this vector globally on the physics space. If the center of gravity is relative (e.g. towards a planet&#039;s core or towards a black hole) then you have to use this method to adjust the vectors of all entities at each tick of the update loop.</td>
</tr>
<tr>
<td> setFriction(1f) </td><td> Friction. Ice and slides have low friction, the are slippery. Soil, concrete and rock have high friction. </td>
</tr>
<tr>
<td> setMass(1f) </td><td> Sets the mass. Dynamic entities have masses &gt; 0.0f. Heavy dynamic entities need more force to be moved and light ones move with small amounts of force. <br/>
Static immobile entities (obstacles, including buildings and terrains) must have mass = 0.0f. </td>
<th> RigidBodyControl Method </th><th> Property </th><th> Examples </th>
</tr>
<tr>
<td> setPhysicsLocation()</td><td>Positions the entity. Do not use setLocalTranslation() for physical entities.. Important: Make certain not to make CollisionShapes overlap when positioning them (Use the debug mode to check the shapes). </td>
<td> setGravity(new Vector3f(0f,-9.81f,0f)) </td><td> You can change the gravity of individual physics objects after they were added to the PhysicsSpace. Gravity is a vector pointing from this Spatial towards the source of gravity. The longer the vector, the stronger is gravity. <br/>
If gravity is the same absolute direction for all objects (e.g. on a planet surface), set this vector globally on the PhysicsSpace object and not individually. <br/>
If the center of gravity is relative (e.g. towards a black hole) then setGravity() on each Spatial to constantly adjust the gravity vectors at each tick of their update() loops.</td><td>For planet earth: <br/>
<code>new Vector3f(0f,-9.81f,0f)</code></td>
</tr>
<tr>
<td> setPhysicsRotation()</td><td>Rotates the entity. Do not use setLocalRotate() for physical entities.</td>
<td> setMass(1f) </td><td> Sets the mass in kilogram. Dynamic objects have masses &gt; 0.0f. Heavy dynamic objects need more force to be moved and light ones move with small amounts of force. <br/>
Static immobile objects (walls, floors, including buildings and terrains) must have a mass of zero! </td><td> Person: 60f, ball: 1.0f <br/>
Floor: 0.0f (!)</td>
</tr>
<tr>
<td> setRestitution(0.0f) </td><td> How bouncy an entity is, normally 0.0f. <br/>
For a bouncy, such as rubber balls, set this &gt; 0.0f. This setting has an impact on performance, so use it sparingly. </td>
<td> setFriction(1f) </td><td> Friction. <br/>
Slippery objects have low friction. The ground has high friction. </td><td> Ice, slides: 0.0f <br/>
Soil, concrete, rock: 1.0f </td>
</tr>
<tr>
<td> setKinematic(true) </td><td> A kinematic RigidBodyControl&#039;ed entity is not affected by gravity or other forces! You write translation and rotation code in the update loop to describe the motion of physical entities. A kinematic has a mass and is solid (e.g. characters can stand on it), this means a kinematic affects other physics entities that bump into it (e.g. pushes them away). You also can attach <a href="/com/jme3/gde/core/docs/jme3/advanced/joints_and_hinges.html">joints and hinges</a> to it (&quot;air hook&quot;). The position of a kinematic RigidBodyControl is updated depending on its spatial&#039;s translation. <br/>
By default, PhysicsControls are not kinematic.</td>
</tr>
<tr>
<td> setCcdMotionThreshold(0.1f) </td><td> The amount of motion in 1 physics tick to trigger the continuous motion detection. Rarely used, but necessary if you need to fiddle with details. </td>
<td> setRestitution(0.0f) </td><td> Bounciness. By default objects are not bouncy (0.0f). For a bouncy rubber object set this &gt; 0.0f. <br/>
This setting has an impact on performance, so use it sparingly. </td><td> Brick: 0.0f <br/>
Rubber ball: 1.0f </td>
</tr>
</table></div>
<!-- EDIT3 TABLE [11266-13531] --><div><table>
<tr>
<th> CharacterControl Method </th><th> Property </th>
</tr>
<!-- EDIT5 TABLE [14458-15879] -->
<p>
On a RigidBodyControl, you can apply the following physical forces:
</p>
<div><table>
<tr>
<td> setUpAxis(1)</td><td> CharacterControls have a fixed upward axis! This means they cannot fall over. <br/>
Values: 0 = X axis , 1 = Y axis , 2 = Z axis. <br/>
Default: 1, because for characters and vehicle, up is typically along the Y axis.</td>
<th> RigidBodyControl Method </th><th> Motion </th>
</tr>
<tr>
<td> setJumpSpeed(1f) </td><td> Jump speed (movement along up axis) </td>
<td> setPhysicsLocation()</td><td>Positions the objects. Do not use setLocalTranslation() for physical objects. Important: Make certain not to make CollisionShapes overlap when positioning them. </td>
</tr>
<tr>
<td> setFallSpeed(1f) </td><td> Fall speed (movement along negative up axis) </td>
<td> setPhysicsRotation()</td><td>Rotates the object. Do not use setLocalRotate() for physical objects.</td>
</tr>
<tr>
<td> setMaxSlope(1.5f) </td><td> How steep the slopes and steps are that the character can climb without considering them an obstacle. Higher obstacles need to be jumped. In world units. </td>
<td> setCcdMotionThreshold(0.1f) </td><td> The amount of motion in 1 physics tick to trigger the continuous motion detection. Rarely used, but necessary if you need to fiddle with details. </td>
</tr>
<tr>
<td> setGravity(1f) </td><td> The intensity of gravity for this CharacterControl&#039;ed entity. To change the direction of gravity for a character, modify the up axis.</td>
<td> setKinematic(true) </td><td> By default, RigidBodyControls are dynamic (kinematic=false) and are affected by forces. If you set kinematic=true, the object is no longer affected by forces, but it still affects others. A kinematic is solid, and must have a mass. <br/>
(See detailed explanation below.) </td>
</tr>
</table></div>
<!-- EDIT4 TABLE [13533-14261] -->
<!-- EDIT6 TABLE [15950-16740] -->
</div>
<h3><a>Kinematic vs Dynamic vs Static</a></h3>
@ -390,14 +466,14 @@ Default: 1, because for characters and vehicle, up is typically along the Y axis
<p>
All physical entities…
All physical objects…
</p>
<ul>
<li><div> must not overlap. </div>
</li>
<li><div> can detect collisions and report several values about the impact.</div>
</li>
<li><div> can respond dynamically, or statically, or kinematically to collisions.</div>
<li><div> can respond to collisions dynamically, or statically, or kinematically.</div>
</li>
</ul>
<div><table>
@ -405,7 +481,7 @@ All physical entities…
<td> Property </td><th> Static </th><th> Kinematic </th><th> Dynamic </th>
</tr>
<tr>
<th> Examples</th><td>Immobile obstacles: Floors, walls, buildings, …</td><td>Remote-controlled entities: Airships, meteorites, doors; networked or remote-controlled NPCs; invisible &quot;airhooks&quot; for hinges and joints.</td><td>Interactive entities: Rolling balls, movable crates, falling pillar, space ship…</td>
<th> Examples</th><td>Immobile obstacles: Floors, walls, buildings, …</td><td>Remote-controlled solid objects: Airships, meteorites, elevators, doors; networked or remote-controlled NPCs; invisible &quot;airhooks&quot; for hinges and joints.</td><td>Interactive objects: Rolling balls, movable crates, falling pillars, zero-g space ship…</td>
</tr>
<tr>
<th> Does it have a mass?</th><td>no, 0.0f</td><td>yes<sup><a href="#fn__1">1)</a></sup>, &gt;0.0f </td><td>yes, &gt;0.0f</td>
@ -428,45 +504,62 @@ setLocalRotation();</td><td>setPhysicsLocation(); <br/>
(Falls when it mid-air? Can be pushed by others?)</th><td>no</td><td>no</td><td>yes</td>
</tr>
<tr>
<th> How to activate? </th><td>setMass(0f); <br/>
<th> How to activate this behaviour? </th><td>setMass(0f); <br/>
setKinematic(false); </td><td>setMass(1f); <br/>
setKinematic(true);</td><td>setMass(1f); <br/>
setKinematic(false);</td>
</tr>
</table></div>
<!-- EDIT5 TABLE [14499-15521] -->
<!-- EDIT7 TABLE [16978-18037] -->
</div>
<h4><a>When Do I Use Kinematic Objects?</a></h4>
<div>
<ul>
<li><div> Kinematics are solid and characters can &quot;stand&quot; on them.</div>
</li>
<li><div> When they collide, Kinematics push dynamic objects, but a dynamic object never pushes a Kinematic. </div>
</li>
<li><div> You can hang kinematics up &quot;in mid-air&quot; and attach other PhysicsControls to them using <a href="/com/jme3/gde/core/docs/jme3/advanced/hinges_and_joints.html">hinges and joints</a>. Picture them as &quot;air hooks&quot; for flying aircraft carriers, floating islands in the clouds, suspension bridges, swings, chains… </div>
</li>
<li><div> You can use Kinematics to create mobile remote-controlled physical objects, such as moving elevator platforms, flying blimps/airships. You have full control how Kinematics move, they never &quot;fall&quot; or &quot;topple over&quot;.</div>
</li>
</ul>
<p>
<p><div>You move Spatials with a kinematic RigidBodyControl programmatically, that is by using setLocalTranslation() or move() in the update() loop, or using a <a href="/com/jme3/gde/core/docs/jme3/advanced/motionpath.html">MotionPath</a>. You can also &quot;hang them up in mid-air&quot; and attach other PhysicsControls to them using <a href="/com/jme3/gde/core/docs/jme3/advanced/hinges_and_joints.html">hinges and joints</a>.
<p><div>The position of a kinematic RigidBodyControl is updated automatically depending on its spatial&#039;s translation. You move Spatials with a kinematic RigidBodyControl programmatically, that means you write translation and rotation code in the update loop. You describe the motion of kinematic objects either by using methods such as <code>setLocalTranslation()</code> or <code>move()</code>, or by using a <a href="/com/jme3/gde/core/docs/jme3/advanced/motionpath.html">MotionPath</a>.
</div></p>
</p>
</div>
<h2><a>Forces: Moving Physical Entities</a></h2>
<h2><a>Forces: Moving Dynamic Objects</a></h2>
<div>
<p>
Use the following methods to move physics entities.
Use the following methods to move dynamic physical objects.
</p>
<div><table>
<tr>
<th> PhysicsControl Method </th><th> Motion </th>
</tr>
<tr>
<td> setLinearVelocity(new Vector3f(0f,0f,1f)) </td><td> Set the linear speed of this entity. </td>
<td> setLinearVelocity(new Vector3f(0f,0f,1f)) </td><td> Set the linear speed of this object. </td>
</tr>
<tr>
<td> setAngularVelocity(new Vector3f(0f,0f,1f)) </td><td> Set the rotational speed of the entity; the x, y and z component are the speed of rotation around that axis. </td>
<td> setAngularVelocity(new Vector3f(0f,0f,1f)) </td><td> Set the rotational speed of the object; the x, y and z component are the speed of rotation around that axis. </td>
</tr>
<tr>
<td> applyCentralForce(…) </td><td> Move (push) the entity once with a certain moment, expressed as a Vector3f. </td>
<td> applyCentralForce(…) </td><td> Move (push) the object once with a certain moment, expressed as a Vector3f. </td>
</tr>
<tr>
<td> applyForce(…) </td><td> Move (push) the entity once with a certain moment, expressed as a Vector3f. Optionally, you can specify where on the entity the pushing force hits. </td>
<td> applyForce(…) </td><td> Move (push) the object once with a certain moment, expressed as a Vector3f. Optionally, you can specify where on the object the pushing force hits. </td>
</tr>
<tr>
<td> applyTorque(…) </td><td> Rotate (twist) the entity once around its axes, expressed as a Vector3f. </td>
<td> applyTorque(…) </td><td> Rotate (twist) the object once around its axes, expressed as a Vector3f. </td>
</tr>
<tr>
<td> applyImpulse(…) </td><td> An idealised change of momentum. This is the kind of push that you would use on a pool billiard ball. </td>
@ -474,72 +567,74 @@ Use the following methods to move physics entities.
<tr>
<td> applyTorqueImpulse(…) </td><td> An idealised change of momentum. This is the kind of push that you would use on a pool billiard ball. </td>
</tr>
<tr>
<td> setWalkDirection(new Vector3f(0f,0f,0.1f))</td><td> (CharacterControl only) Make a physical character walk. CharacterControls are locked upright to prevent falling over. Use <code>setWalkDirection(Vector3f.ZERO)</code> to stop a directional motion. </td>
</tr>
<tr>
<td> clearForces()</td><td>Cancels out all forces (force, torque) etc and stops the motion.</td>
</tr>
</table></div>
<!-- EDIT6 TABLE [15937-17161] -->
<!-- EDIT8 TABLE [19249-20238] -->
<p>
<p><div>It is technically possible to position PhysicsControls using setLocalTranslation(), e.g. to place them in their start position in the scene. However you must be very careful not to cause an &quot;impossible state&quot; where one physical entity overlaps with another! Within the game, you typically use the setters shown here exclusively.
<p><div>It is technically possible to position PhysicsControls using setLocalTranslation(), e.g. to place them in their start position in the scene. However you must be very careful not to cause an &quot;impossible state&quot; where one physical object overlaps with another! Within the game, you typically use the setters shown here exclusively.
</div></p>
</p>
<p>
PhysicsControls also supports the following features:
PhysicsControls also support the following advanced features:
</p>
<div><table>
<tr>
<th> PhysicsControl Method </th><th> Property </th>
</tr>
<tr>
<td> setCollisionShape(collisionShape)</td><td>Changes the collision shape.</td>
<td> setCollisionShape(collisionShape)</td><td>Changes the collision shape after creation.</td>
</tr>
<tr>
<td> setCollideWithGroups() <br/>
setCollisionGroup() <br/>
addCollideWithGroup(COLLISION_GROUP_01) <br/>
removeCollideWithGroup(COLLISION_GROUP_01)</td><td>Collision Groups are integer bit masks – enums are available in CollisionObject. All physics entities are by default in COLLISION_GROUP_01. Two entities collide when the collideWithGroups set of one contains, the Collision Group of the other.</td>
removeCollideWithGroup(COLLISION_GROUP_01)</td><td>Collision Groups are integer bit masks – enums are available in the CollisionObject. All physics objects are by default in COLLISION_GROUP_01. Two objects collide when the collideWithGroups set of one contains the Collision Group of the other. Use this to improve performance by grouping objects that will never collide in different groups (the the engine saves times because it does not need to check on them).</td>
</tr>
<tr>
<td> setDamping(float, float)</td><td>The first value is the linear threshold and the second the angular. This simulates dampening of forces, for example for underwater scenes.</td>
</tr>
<tr>
<td> setDamping(float, float)</td><td>The first value is the linear threshold and the second the angular.</td>
<td> setAngularFactor(1f)</td><td>Set the amount of rotation that will be applied. A value of zero will cancel all rotational force outcome. (?)</td>
</tr>
<tr>
<td> setAngularFactor(1f)</td><td>Set the amount of rotation that will be applied. A value of zero will cancel all rotational force outcome.</td>
<td> setSleepingThreshold(float,float)</td><td>Sets the sleeping thresholds which define when the object gets deactivated to save resources. The first value is the linear threshold and the second the angular. Low values keep the object active when it barely moves (slow precise performance), high values put the object to sleep immediately (imprecise fast performance). (?) </td>
</tr>
<tr>
<td> setCcdSweptSphereRadius()</td><td>?</td>
<td> setCcdMotionThreshold(0f) </td><td>Sets the amount of motion that has to happen in one physics tick to trigger the continuous motion detection. This avoids the problem of fast objects moving through other objects. Set to zero to disable (default).</td>
</tr>
<tr>
<td> setSleepingThreshold(float,float)</td><td>Sets the sleeping thresholds which define when the entity gets deactivated to save resources. Low values keep the entity active when it barely moves. The first value is the linear threshold and the second the angular.</td>
<td> setCcdSweptSphereRadius(.5f)</td><td>Bullet does not use the full collision shape for continuous collision detection, insteadit uses a &quot;swept sphere&quot; shape to approximate a motion. Only relevant for fast moving dynamic bodies. (?) </td>
</tr>
</table></div>
<!-- EDIT7 TABLE [17570-18567] -->
<!-- EDIT9 TABLE [20656-22461] -->
</div>
<h2><a>Best Practices</a></h2>
<div>
<ul>
<li><div> You can control the game by triggering forces; or may want to respond to collisions, e.g. by substracting health points, or by playing a sound. To specify how the game responds to physics events, you use <a href="/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html">Physics Listeners</a>.</div>
<li><div> <strong>Multiple Objects Too Slow?</strong> Do not overuse PhysicsControls. Although PhysicsControls are put to “sleep” when they are not moving, creating a world solely out of dynamic physics objects will quickly bring you to the limits of your computer&#039;s capabilities. <br/>
<strong>Solution:</strong> Improve performance by replacing some physical Spatials with non-physical Spatials. Use the non-physical ones for non-solid things for which you do not need to detect collisions – foliage, plants, effects, ghosts, all remote or unreachable objects.</div>
</li>
</ul>
<ul>
<li><div> Do not overuse PhysicsControls. Although PhysicsControls are put to “sleep” when they are not moving, creating a world solely out of dynamic physics nodes will quickly bring you to the limits of your computer&#039;s capabilities.</div>
<li><div> <strong>Complex Shape Too Slow?</strong> Breaking the level into manageable pieces helps the engine improve performance: The less CPU-intensive <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Sweep_and_prune"><param name="text" value="<html><u>broadphase</u></html>"><param name="textColor" value="blue"></object> filters out parts of the scene that are out of reach. It only calculates the collisions for objects that are actually close to the action. <br/>
<strong>Solution:</strong> A huge static city or terrain model should never be loaded as one huge mesh. Divide the scene into multiple physics objects, with each its own CollisionShape. Choose the most simple CollisionShape possible; use mesh-accurate shapes only for the few cases where precision is more important than speed. For example, you can use the very fast <code>PlaneCollisionShape</code> for flat streets, floors and the outside edge of the scene, if you keep these pieces separate.</div>
</li>
</ul>
<ul>
<li><div> You can use normal non-physical Spatials in the same scene next to physical ones. Use the non-physical ones for non-solid things for which you do not want to detect collisions (ghost, foliage, plants, effects, …). This improves performance.</div>
</li>
</ul>
<ul>
<li><div> If you get weird behaviour, such as physical nodes jittering wildy and being ejected &quot;for no apparent reason&quot;, it usually means you have created an impossible state. Verify that none of the collision shapes overlap. This can happen when you create physical nodes in positions that are too close to other nodes; or if you position a physical node using setLocalTranslation() and it touches another node&#039;s collision shape. </div>
<li><div> <strong>Buggy?</strong> If you get weird behaviour, such as physical nodes jittering wildy and being ejected &quot;for no apparent reason&quot;, it means you have created an impossible state – solid objects overlapping. This can happen when you position solid spatials too close to other solid spatials, e.g. when moving them with setLocalTranslation(). <br/>
<strong>Solution:</strong> Use the debug mode to make CollisionShapes visible and verify that CollisionShapes do not overlap. <pre>bulletAppState.getPhysicsSpace&#40;&#41;.enableDebug&#40;assetManager&#41;;</pre>
</div>
</li>
</ul>
<ul>
<li><div> For large static meshes like shooter levels or terrain it is best to divide the scene model into multiple physics entities, with each its own CollisionShape. A huge city level should not be one huge mesh (model) of pavement and streets and buildings. Instead, you make individual models for buildings, for pieces of pavement, for pieces of streets, etc. Position them next to one another to form the whole city, and give each piece its own optimal CollisionShape. E.g. streets can use a fast PlaneCollisionShape if you keep them separate for buildings. Breaking the level into manageable pieces helps the engine improve performance: The less CPU-intensive <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Sweep_and_prune"><param name="text" value="<html><u>broadphase</u></html>"><param name="textColor" value="blue"></object> can now filter out parts of the scene that are behind you or out of reach, and it only calculates the details of collisions for parts that are actually close to the action.</div>
<li><div> <strong>Need more interactivity?</strong> You can actively <em>control</em> a physical game by triggering forces. You may also want to be able <em>respond</em> to collisions, e.g. by substracting health, awarding points, or by playing a sound. <br/>
<strong>Solution:</strong> To specify how the game responds to collisions, you use <a href="/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html">Physics Listeners</a>.</div>
</li>
</ul>
<div><span>
@ -551,6 +646,6 @@ removeCollideWithGroup(COLLISION_GROUP_01)</td><td>Collision Groups are integer
</div>
<div>
<div><sup><a href="#fnt__1">1)</a></sup>
Inertia is calculated for kinematic entities, and you need mass to do that.</div>
Inertia is calculated for kinematic objects, and you need mass to do that.</div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:physics?do=export_xhtmlbody">view online version</a></em></p>

@ -3,19 +3,72 @@
<div>
<p>
You can control physical objects by triggering forces. Or maybe you want to respond to collisions, e.g. by substracting health points, or by playing a sound. To specify how the game responds to such physics events, you use Physics Listeners.
You can control physical objects (push them around) by applying physical forces to them. Typically, you also want to respond to the resulting collisions, e.g. by substracting health points or by playing a sound. To specify how the game responds to such physics events, you use Physics Listeners.
</p>
</div>
<h2><a>Sample Code</a></h2>
<div>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/bullet/TestCollisionListener.java"><param name="text" value="<html><u>TestCollisionListener.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/bullet/TestAttachGhostObject.java"><param name="text" value="<html><u>TestAttachGhostObject.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/bullet/TestGhostObject.java"><param name="text" value="<html><u>TestGhostObject.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>PhysicsGhostObjects</a></h2>
<div>
<p>
Attach a com.jme3.bullet.control.GhostControl to any Spatial to turn it into a PhysicsGhostObject. Ghost objects automatically follow their spatial and detect collisions. The attached ghost itself is invisible and non-solid (!) and doesn&#039;t interfere with your game otherwise, it only passively reports collisions.
</p>
<p>
You can leave the GhostControl non-solid and invisible and attach it to an (invisible) Node in the scene to create something like a motion detector. But a GhostControl also works fine when added to spatials that are solid (with RigidBodyControl) and visible (with Geometry). One use case for GhostControls is to check for collisions among <a href="/com/jme3/gde/core/docs/jme3/advanced/walking_character.html">CharacterControls</a> when the characters are walking.
</p>
<p>
The shape of the ghost depends on the CollisionShape that you gave the GhostControl. This means that the GhostControl&#039;s shape can be different from the RigidBodyControl&#039;s shape. For example, the non-solid ghost shape can be bigger than the solid shape of the Spatial (so you can &quot;feel&quot; ahead).
</p>
<pre>GhostControl ghost = new GhostControl&#40;
new BoxCollisionShape&#40;new Vector3f&#40;1,1,1&#41;&#41;&#41;; // a box-shaped ghost
Node node = new Node&#40;&quot;a ghost-controlled thing&quot;&#41;;
node.addControl&#40;ghost&#41;; // the ghost follows this node
// Optional: Add a Geometry, or other controls, to the node if you need to
...
// attach everything to activate it
rootNode.attachChild&#40;node&#41;;
getPhysicsSpace&#40;&#41;.add&#40;ghost&#41;;</pre>
<div><table>
<tr>
<th>Ghost methods</th><th>Usage</th>
</tr>
<tr>
<td>getOverlappingObjects()</td><td>Returns the List of objects that are currently colliding (overlapping) with the ghost.</td>
</tr>
<tr>
<td>getOverlappingCount()</td><td>Returns the number of currently colliding objects.</td>
</tr>
<tr>
<td>getOverlapping(i)</td><td>Get PhysicsCollisionObject number i.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [2299-2565] -->
</div>
<h2><a>Physics Tick Listener</a></h2>
<div>
<p>
The jBullet Physics implementation is stepped at a constant 60 physics ticks per second frame rate.
Applying forces or checking for overlaps only has an effect right at a physics update cycle, which is not every frame. If you do physics interactions at arbitrary spots in the simpleUpdate() loop, calls will be dropped at irregular intervals, because they happen out of cycle.
</p>
</div>
@ -24,10 +77,16 @@ Applying forces or checking for overlaps only has an effect right at a physics u
<div>
<p>
When you write game mechanics that apply forces, you must implement a tick listener (com.jme3.bullet.PhysicsTickListener) for it. The tick listener makes certain the forces are not dropped, but applied in time for the next physics tick.
Also, when you check for overlaps of physical objects with a PhysicsGhostObject, you cannot just go <code>physicsSpace.add(ghost); ghost.getOverLappingObjects()</code> somewhere. You have to make certain 1 physics tick has passed before the overlapping objects list is filled with data. Again, the PhysicsTickListener does that for you.
When your game mechanics however just poll the current state (e.g. location) of physical objects, or if you only use the Ghost control like a sphere trigger, then you don&#039;t need a PhysicsTickListener.
</p>
<p>
Also, when you check for overlaps of two physical objects using a GhostControl, you cannot just go <code>ghost.getOverLappingObjects()</code> somewhere outside the update loop. You have to make certain 1 physics tick has passed before the overlapping objects list is filled with data. Again, the PhysicsTickListener does the timing for you.
</p>
<p>
When your game mechanics however just poll the current state (e.g. getPhysicsLocation()) of physical objects, or if you only use the GhostControl like a sphere trigger inside an update loop, then you don&#039;t need an extra PhysicsTickListener.
</p>
</div>
@ -36,28 +95,31 @@ When your game mechanics however just poll the current state (e.g. location) of
<div>
<p>
Here&#039;s is the declaration of an examplary Physics Control that listens to ticks.
Here&#039;s is the declaration of an examplary Physics Control that listens to ticks. (The example shows a RigidBodyControl, but it can also be GhostControl.)
</p>
<pre>public class MyCustomControl
extends RigidBodyControl implements PhysicsTickListener &#123; ... &#125;</pre>
<p>
When you implement the interface, you have to implement preTick() and postTick() methods.
When you implement the interface, you have to implement <code>physicsTick()</code> and <code>preTick()</code> methods.
</p>
<ul>
<li><div> <code>prePhysicsTick()</code> is called before the step, here you apply forces (change the state).</div>
<li><div> <code>prePhysicsTick(PhysicsSpace space, float tpf)</code> is called before each step, here you apply forces (change the state).</div>
</li>
<li><div> <code>physicsTick()</code> is called after the step, here you poll the results (get the current state).</div>
<li><div> <code>physicsTick(PhysicsSpace space, float tpf)</code> is called after each step, here you poll the results (get the current state).</div>
</li>
</ul>
<p>
The tpf value is time per frame in seconds. You can use it as a factor to time actions so they run equally on slow and fast machines.
</p>
<pre>@override
public void prePhysicsTick&#40;PhysicsSpace space, float f&#41;&#123;
public void prePhysicsTick&#40;PhysicsSpace space, float tpf&#41;&#123;
// apply state changes ...
&#125;
@override
public void physicsTick&#40;PhysicsSpace space, float f&#41;&#123;
public void physicsTick&#40;PhysicsSpace space, float tpf&#41;&#123;
// poll game state ...
&#125;</pre>
@ -72,7 +134,11 @@ public void physicsTick&#40;PhysicsSpace space, float f&#41;&#123;
<div>
<p>
If you do not implement the Collision Listener interface (com.jme3.bullet.collision.PhysicsCollisionListener), a collisions will just mean that physical forces are applied automatically. If you just want &quot;Balls rolling, bricks falling&quot; you do not need a listener.
If you do not implement the Collision Listener interface (com.jme3.bullet.collision.PhysicsCollisionListener), a collisions will just mean that physical forces between solid objects are applied automatically. If you just want &quot;Balls rolling, bricks falling&quot; you do not need a listener.
</p>
<p>
If however you want to respond to a collision event (com.jme3.bullet.collision.PhysicsCollisionEvent) with a custom action, then you need to implement the PhysicsCollisionListener interface. Typical actions triggered by collisions include:
</p>
<ul>
@ -94,11 +160,10 @@ If however you want to respond to a collision event (com.jme3.bullet.collision.P
<div>
<p>
You need to add the PhysicsCollisionListener to the physics space before collisions will be listened for. Again, here&#039;s the example declaration of a Physics Control that uses a collision listener.
You need to add the PhysicsCollisionListener to the physics space before collisions will be listened for. Here&#039;s an example of a Physics Control that uses a collision listener. (The example shows a RigidBodyControl, but it can also be GhostControl.)
</p>
<pre>public class MyCustomControl
extends RigidBodyControl
<pre>public class MyCustomControl extends RigidBodyControl
implements PhysicsCollisionListener &#123;
public MyCustomControl&#40;&#41; &#123;
bulletAppState.getPhysicsSpace&#40;&#41;.addCollisionListener&#40;this&#41;;
@ -106,10 +171,11 @@ You need to add the PhysicsCollisionListener to the physics space before collisi
&#125;</pre>
<p>
To respond to the PhysicsCollisionEvent you now have to override the <code>collision()</code> method in MyCustomControl. This gives you access to the <code>event</code> object. Mostly you will be interested in the identity of any two nodes that collided: <code>event.getNodeA()</code> and <code>event.getNodeB()</code>.
</p>
To respond to the PhysicsCollisionEvent you have to override the <code>collision()</code> method. This gives you access to the event object. Mostly you will be interested in the identity of any two nodes that collided: <code>event.getNodeA()</code> and <code>event.getNodeB()</code>.
<p>
After you identify the colliding nodes, specify the action to trigger when this pair collides. Note that you cannot know which one will be Node A or Node B, you have to deal with either variant.
</p>
<pre> public void collision&#40;PhysicsCollisionEvent event&#41; &#123;
if &#40; event.getNodeA&#40;&#41;.getName&#40;&#41;.equals&#40;&quot;player&quot;&#41; &#41; &#123;
@ -125,7 +191,6 @@ After you identify the colliding nodes, specify the action to trigger when this
<p><div>Note that after the collision() method ends, the PhysicsCollisionEvent is cleared. You must get all objects and values you need within the collision() method.
</div></p>
</p>
</div>
@ -134,6 +199,7 @@ After you identify the colliding nodes, specify the action to trigger when this
<div>
<p>
The PhysicsCollisionEvent <code>event</code> gives you access to detailed information about the collision. You already know the event objects can identify which nodes collided, but it even knows how hard they collided:
</p>
<div><table>
@ -160,11 +226,26 @@ getObjectB() </td><td> The two participants in the collision. You cannot kno
<td> getCombinedRestitution() </td><td> A float value representing the collision restitution (bounciness) </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [4836-5521] -->
<!-- EDIT2 TABLE [7578-8263] -->
<p>
Note that after the collision method has been called the object is not valid anymore so you should copy any data you want to keep into local variables.
</p>
</div>
<h3><a>Collision Groups</a></h3>
<div>
<p>
You can improve performance by resricting the number of tests that collision detection has to perform. If you have a case where you are only interested in collisions between certain objects but not others, you can assign sets of physical obejcts to different collision groups.
</p>
<p>
For example, for a click-to-select, you only care if the selection ray collides with a few selectable objects such as dropped weapons or powerups (one group), but not with non-selectables such as floors or walls (different group).
</p>
<pre>myNode.getControl&#40;RigidBodyControl.class&#41;.setCollisionGroup&#40;PhysicsCollisionObject.COLLISION_GROUP_02&#41;;
myNode.getControl&#40;RigidBodyControl.class&#41;.setCollideWithGroups&#40;PhysicsCollisionObject.COLLISION_GROUP_02&#41;;</pre>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:physics?do=showtag&amp;tag=tag%3Aphysics">physics</a>,

@ -11,6 +11,10 @@ The awesome SeaMonkey water Filter is highly configurable. It can render any typ
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/water-post.png">
</p>
<p>
Need simpler <a href="/com/jme3/gde/core/docs/jme3/advanced/water.html">water</a>?
</p>
</div>
<h2><a>The Theory</a></h2>
@ -171,7 +175,7 @@ manager.loadTexture(&quot;Textures/wavenormals.png&quot;) )</td><td>This normal
<td>water.setNormalScale(0.5f)</td><td>Sets the normal scaling factors to apply to the normal map. The higher the value, the more small ripples will be visible on the waves.</td><td>1.0f</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [4858-6022] --><div><table>
<!-- EDIT1 TABLE [4898-6062] --><div><table>
<tr>
<th> Water method example</th><th> Effects: Color</th><th>Default</th>
</tr>
@ -196,7 +200,7 @@ Vector3f(0.0f, 0.0f,0.2f,1.0f)</td>
<td>water.setColorExtinction(new Vector3f(10f,20f,30f));</td><td>Sets At what depth the refraction color extincts. The three values are RGB (red, green, blue) in this order. Play with these parameters to &quot;muddy&quot; the water.</td><td>Vector3f(5f,20f,30f)</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [6024-7028] --><div><table>
<!-- EDIT2 TABLE [6064-7068] --><div><table>
<tr>
<th> Water method example</th><th> Effects: Shore</th><th>Default</th>
</tr>
@ -207,7 +211,7 @@ Vector3f(0.0f, 0.0f,0.2f,1.0f)</td>
<td>water.setUseHQShoreline(false);</td><td>Renders shoreline with better quality ?</td><td>true</td>
</tr>
</table></div>
<!-- EDIT3 TABLE [7030-7319] --><div><table>
<!-- EDIT3 TABLE [7070-7359] --><div><table>
<tr>
<th> Water method example</th><th> Effects: Foam</th><th>Default</th>
</tr>
@ -225,7 +229,7 @@ Vector3f(0.0f, 0.0f,0.2f,1.0f)</td>
manager.loadTexture(&quot;Textures/foam.png&quot;) )</td><td>This foam texture will be used with WrapMode.Repeat</td><td>&quot;Common/MatDefs/Water/Textures/foam.jpg&quot;</td>
</tr>
</table></div>
<!-- EDIT4 TABLE [7321-7966] --><div><table>
<!-- EDIT4 TABLE [7361-8006] --><div><table>
<tr>
<th> Water method example</th><th> Effects: Light</th><th>Default</th>
</tr>
@ -251,7 +255,7 @@ manager.loadTexture(&quot;Textures/foam.png&quot;) )</td><td>This foam texture w
<td>water.setReflectionMapSize(256)</td><td>Sets the size of the reflection map. The higher, the better the quality, but the slower the effect.</td><td>512</td>
</tr>
</table></div>
<!-- EDIT5 TABLE [7968-8883] -->
<!-- EDIT5 TABLE [8008-8923] -->
</div>
<h3><a>Sound Effects</a></h3>
@ -272,6 +276,8 @@ See also:
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/2011/01/15/new-advanced-water-effect-for-jmonkeyengine-3/#comment-609"><param name="text" value="<html><u>JME3&#039;s Water Post-Process Effect</u></html>"><param name="textColor" value="blue"></object> by Nehon</div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme/advanced/water.html">Simple water</a></div>
</li>
</ul>
</div>

@ -48,6 +48,11 @@ camNodeSide.getControl&#40;0&#41;.setEnabled&#40;false&#41;;</pre>
If desired, attach the camNode to a MotionTrack to let it travel along waypoints. This is demonstrated in the <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/animation/TestCinematic.java"><param name="text" value="<html><u>TestCameraMotionPath.java example</u></html>"><param name="textColor" value="blue"></object>.
</p>
<div><span>
<a href="/wiki/doku.php/tag:camera?do=showtag&amp;tag=tag%3Acamera">camera</a>,
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:cinematics?do=showtag&amp;tag=tag%3Acinematics">cinematics</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:remote-controlling_the_camera?do=export_xhtmlbody">view online version</a></em></p>

@ -4,7 +4,12 @@
<p>
You can save and load scenes and individual Nodes using com.jme3.export.binary.BinaryExporter and com.jme3.export.binary.BinaryImporter. Use standard Java serialization to load game data or use the Savable interface. The jMonkeyEngine binary file format is .j3o. You can open, view, and edit .j3o files in the jMonkeyEngine <a href="/com/jme3/gde/core/docs/jme3/advanced/sdk.html">SDK</a>.
Spatials can contain Nodes, Geometries, and user data (player score, health, inventory, etc). You can save and load individual Nodes or Geometries, as well as whole scenes using <code>com.jme3.export.binary.BinaryExporter</code> and <code>com.jme3.export.binary.BinaryImporter</code>. The jMonkeyEngine&#039;s serialization system is the <code>com.jme3.export.Savable</code> interface; the jMonkeyEngine&#039;s binary file format is called <code>.j3o</code>. You can open, view, and edit .j3o files in the jMonkeyEngine <a href="/com/jme3/gde/core/docs/sdk.html">SDK</a>.
</p>
<p>
<p><div>JME&#039;s BinaryExporter/BinaryImporter can read and write standard Java objects, JME objects, and primitive data types that are included in a <a href="/com/jme3/gde/core/docs/jme3/advanced/spatial.html">spatial&#039;s user data</a>. See below how to make additional custom classes &quot;Savable&quot;.
</div></p>
</p>
</div>
@ -20,47 +25,99 @@ You can save and load scenes and individual Nodes using com.jme3.export.binary.B
<h2><a>Saving a Node</a></h2>
<div>
<pre> @Override
<p>
The following example overrides <code>destroy()</code> to save the rootNode to a file when the user quits the application. The saved rootNode is a normal .j3o binary file that you open in the <a href="/com/jme3/gde/core/docs/sdk.html">SDK</a>.
</p>
<p>
<p><div>Note that when you save a model that has textures the textures are references to those textures are stored as absolute paths, so when loading the j3o file they have to be accessible at the exact location (relative to the assetmanager root) they were loaded from. This is why the <acronym title="Software Development Kit">SDK</acronym> manages the conversion on the project level.
</div></p>
</p>
<pre> /* This is called when the user quits the app. */
@Override
public void destroy&#40;&#41; &#123;
System.getProperty&#40;&quot;user.home&quot;&#41;;
BinaryExporter exporter = BinaryExporter.getInstance&#40;&#41;;
File&#40;userHome+&quot;/somefile.j3o&quot;&#41;;
File&#40;userHome+&quot;/MySuperGame/&quot;+&quot;LastSavedGame.j3o&quot;&#41;;
try &#123;
exporter.save&#40;rootNode, file&#41;;
&#125; catch &#40;IOException ex&#41; &#123;
Logger.getLogger&#40;Main.class.getName&#40;&#41;&#41;.log&#40;Level.SEVERE, &quot;Failed to save node!&quot;, ex&#41;;
Logger.getLogger&#40;Main.class.getName&#40;&#41;&#41;.log&#40;Level.SEVERE, &quot;Error: Failed to save game!&quot;, ex&#41;;
&#125;
super.destroy&#40;&#41;;
super.destroy&#40;&#41;; // continue quitting the game
&#125;</pre>
<p>
<p><div>You can add a timestamp to your saved files:
</p>
<pre>long timestamp = System.currentTimeMillis&#40;&#41;/1000;
File&#40;userHome+&quot;/MySuperGame/&quot;+&quot;/SavedGame-&quot;+timestamp+&quot;.j3o&quot;&#41;;</pre>
<p>
</div></p>
</p>
</div>
<h2><a>Loading a Node</a></h2>
<div>
<p>
The following example uses simpleInitApp() to load the last saved game when the game is initialized.
</p>
<pre> @Override
public void simpleInitApp&#40;&#41; &#123;
System.getProperty&#40;&quot;user.home&quot;&#41;;
BinaryImporter importer = BinaryImporter.getInstance&#40;&#41;;
importer.setAssetManager&#40;assetManager&#41;;
File&#40;userHome+&quot;/somefile.j3o&quot;&#41;;
File&#40;userHome+&quot;/MySuperGame/&quot;+&quot;LastSavedGame.j3o&quot;&#41;;
if&#40;file.exists&#40;&#41;&#41;&#123;
try &#123;
Node loadedNode = &#40;Node&#41;importer.load&#40;file&#41;;
loadedNode.setName&#40;&quot;loaded node&quot;&#41;;
rootNode.attachChild&#40;loadedNode&#41;;
&#125; catch &#40;IOException ex&#41; &#123;
Logger.getLogger&#40;Main.class.getName&#40;&#41;&#41;.log&#40;Level.SEVERE, &quot;No saved node loaded.&quot;, ex&#41;;
Logger.getLogger&#40;Main.class.getName&#40;&#41;&#41;.log&#40;Level.SEVERE, &quot;Could not load saved game.&quot;, ex&#41;;
&#125;
else &#123;
// No previous game. Create new game, or let user browse to file, etc...
&#125;
...
&nbsp;</pre>
<p>
<p><div>Here you see why we save user data inside spatials – so it can be saved and loaded together with the .j3o file. If you have game data outside Spatials, you have to remember to save() and load(), and get() and set() it yourself.
</div></p>
</p>
</div>
<h2><a>Custom Savable</a></h2>
<h2><a>Custom Savable Class</a></h2>
<div>
<p>
If you have a custom class that you want to save or assign using <code>setUserData()</code>, the class must implement the <code>com.jme3.export.Savable</code> interface.
JME&#039;s BinaryExporter/BinaryImporter can read and write standard Java objects (String, ArrayList, buffers, etc), JME objects (Savables, such as Material), and primitive data types (int, float, etc). If you are using any custom class together with a Spatial, then the custom class must implement the <code>com.jme3.export.Savable</code> interface. There are two common cases where this is relevant:
</p>
<ul>
<li><div> The Spatial is carrying any <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Custom Controls</a>. <br/>
Example: You used something like <code>mySpatial.addControl(myControl);</code></div>
</li>
<li><div> The Spatial&#039;s user data can contain a custom Java object. <br/>
Example: You used something like <code>mySpatial.setUserData(&quot;inventory&quot;, myInventory);</code></div>
</li>
</ul>
<p>
If your custom classes (the user data or the Controls) do not implement Savable, then the BinaryImporter/BinaryExporter cannot save the Spatial!
</p>
<p>
So every time you create a custom Control or custom user data class, remember to implement Savable:
</p>
<pre>import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
@ -71,9 +128,9 @@ import com.jme3.material.Material;
import java.io.IOException;
&nbsp;
public class MyCustomClass implements Savable &#123;
private int someIntValue;
private float someFloatValue;
private Material someJmeObject;
private int someIntValue; // some custom user data
private float someFloatValue; // some custom user data
private Material someJmeObject; // some custom user data
&nbsp;
...
// your other code...
@ -95,12 +152,16 @@ public class MyCustomClass implements Savable &#123;
&#125;</pre>
<p>
For each class field that you want to save and load,
To make a custom class savable:
</p>
<ol>
<li><div> Implement <code>Savable</code> and add the <code>write()</code> and <code>read()</code> methods as shown in the example above.</div>
</li>
<li><div> Do the following for each non-temporary class field: </div>
<ul>
<li><div> Add one line that <code>write()</code>s the data to the JmeExport output capsule. </div>
<ul>
<li><div> Specify the variable to save, give it String name (can be the same as the variable name), and specify a default value.</div>
<li><div> Specify the variable to save, give it a String name (can be the same as the variable name), and specify a default value.</div>
</li>
</ul>
</li>
@ -108,11 +169,19 @@ For each class field that you want to save and load,
<ul>
<li><div> On the left side of the assignment, specify the class field that you are restoring</div>
</li>
<li><div> One the right side, use the appropriate <code>capsule.read…()</code> method for the data type. Specify the String name of the variable (must be the same ones that you used in the <code>write() method</code>) and a default value.</div>
<li><div> On the right side, use the appropriate <code>capsule.read…()</code> method for the data type. Specify the String name of the variable (must be the same as you used in the <code>write() method</code>), and again specify a default value.</div>
</li>
</ul>
</li>
</ul>
</li>
</ol>
<p>
<p><div>As with all serialization, remember that if you ever change data types in custom classes, the updated read() methods will no longer be able to read your old files.
</div></p>
</p>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:save_and_load?do=export_xhtmlbody">view online version</a></em></p>

@ -58,7 +58,7 @@ The simplest type of Meshes are the built-in JME Shapes. You can create Shapes w
<h2><a>Non-3D shapes</a></h2>
<div>
<ul>
<li><div> com.jme3.scene.shape.Quad – A flat 2D rectangle (has two sides)</div>
<li><div> com.jme3.scene.shape.Quad – A flat 2D rectangle (single-sided, center is in bottom-left corner)</div>
</li>
<li><div> com.jme3.scene.shape.Line – A straight 1D line defined by a start and end point.</div>
</li>
@ -68,12 +68,12 @@ The simplest type of Meshes are the built-in JME Shapes. You can create Shapes w
</div>
<h4><a>Math versus Shape?</a></h4>
<h4><a>com.jme3.math versus com.jme3.shape?</a></h4>
<div>
<p>
Do not mix up these visible Shapes with similarly named classes from the maths package. Choose the right package when letting your IDE fill in the import statements!
Do not mix up these visible com.jme3.shapes with similarly named classes from the com.jme3.math package. Choose the right package when letting your IDE fill in the import statements!
</p>
<ul>
<li><div> com.jme3.math.Line – is invisible, has a direction, goes through a point, infinite length.</div>
@ -120,6 +120,7 @@ To add a shape to the scene:
<div>
<p>
You can compose more complex custom Geometries out of simple Shapes. Think of the buildings in games like Angry Birds, or the building blocks in Second Life (&quot;prims&quot;) and in Tetris (&quot;Tetrominos&quot;).
</p>
<ol>
@ -143,6 +144,12 @@ The order is important: First arrange around origin, then transform. Otherwise,
<h2><a>Code Examples</a></h2>
<div>
<p>
Create the Mesh shape:
</p>
<pre>Sphere mesh = new Sphere&#40;32, 32, 10, false, true&#41;;</pre>
<pre>Dome mesh = new Dome&#40;Vector3f.ZERO, 2, 4, 1f,false&#41;; // Pyramid</pre>
<pre>Dome mesh = new Dome&#40;Vector3f.ZERO, 2, 32, 1f,false&#41;; // Cone</pre>
@ -156,11 +163,12 @@ The order is important: First arrange around origin, then transform. Otherwise,
Use one of the above examples together with the following geometry in a scene:
</p>
<pre>Geometry geom = new Geometry&#40;&quot;A shape&quot;, mesh&#41;;
<pre>Geometry geom = new Geometry&#40;&quot;A shape&quot;, mesh&#41;; // wrap shape into geometry
Material mat = new Material&#40;assetManager,
&quot;Common/MatDefs/Misc/ShowNormals.j3md&quot;&#41;;
geom.setMaterial&#40;mat&#41;;
rootNode.attachChild&#40;geom&#41;;</pre>
&quot;Common/MatDefs/Misc/ShowNormals.j3md&quot;&#41;; // create material
geom.setMaterial&#40;mat&#41;; // assign material to geometry
// if you want, transform (move, rotate, scale) the geometry.
rootNode.attachChild&#40;geom&#41;; // attach geometry to a node</pre>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:shape?do=export_xhtmlbody">view online version</a></em></p>

@ -54,7 +54,7 @@ no mesh, no material.</td>
<!-- EDIT1 TABLE [944-2158] -->
<p>
<p><div>You never create a Spatial with <code>Spatial s = new Spatial();</code>! A Spatial is an abstract concept, like a mammal (there is no actual creature called &quot;mammal&quot; walking around here). You create a Node, or load a Geometry object. Some methods however require a Spatial argement: This is because they are able to accept both Nodes and Geometries as arguments. In this case, you must cast a Node or Geometry to Spatial.
<p><div>You never create a Spatial with <code>Spatial s = new Spatial();</code>! A Spatial is an abstract concept, like a mammal (there is no actual creature called &quot;mammal&quot; walking around here). You create a Node, or load a Geometry object. Some methods however require a Spatial argument: This is because they are able to accept both Nodes and Geometries as arguments. In this case, you must cast a Node or Geometry to Spatial.
</div></p>
</p>
@ -88,7 +88,7 @@ You can include custom Java objects in Nodes and Geometries. This is useful for
</p>
<p>
You do not need to create a custom class that extends Node or Geometry to be able to add custom fields to a spatial – use the setUserData() method instead. Neither do need to create a custom class that extends Node to be able to add custom accessor methods to this spatial – use a Control instead. Where ever the spatial is accessible, you can also access the object&#039;s game data and accessors.
You do not need to create a custom class that extends Node or Geometry to be able to add custom fields to a spatial – use the setUserData() method instead. Neither do you need to create a custom class that extends Node to be able to add custom accessor methods to this spatial – use a Control instead. Where ever the spatial is accessible, you can also access the object&#039;s game data and accessors.
</p>
<p>

@ -121,15 +121,20 @@ TerraMonkey is a quad tree. Each node is a TerrainQuad, and each leaf is a Terra
<p>
We recommend to <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/wiki/doku.php/sdk:terrain_editor"><param name="text" value="<html><u>create and edit Splat Textures for terrains visually in the jMonkeyEngine SDK</u></html>"><param name="textColor" value="blue"></object>. If you are curious or want to create materials manually, read on for the implementation details:
When you &quot;slap&quot; a texture on a mesh, the whole mesh looks the same. For big meshes (such as terrains) that is undesirable because it looks very boring (your whole landscape would be all rock, or all grass, or all sand). Texture Splatting is a technique that lets you &quot;paint&quot; several textures into one combined texure. Each of the splat textures has an opacity value so you can define where it is visible in the final overall texture.
</p>
<p>
When you &quot;slap&quot; a texture on a mesh, the whole mesh looks the same. For big meshes (such as terrains) that is undesirable because it looks very boring (your whole landscape would be all rock, or all grass, or all sand). Texture Splatting is a technique that lets you &quot;paint&quot; several textures into one combined texure. Each of the splat textures has an opacity value so you can define where it is visible in the final overall texture.
The default material for TerraMonkey is TerrainLighting.j3md. This material combines several texture maps to produce the final custom texture. Remember, Diffuse Maps are the main textures that define the look; optionally, each Diffuse Map can be enhanced with a Normal Map; Alpha Maps describe the opacity of each Diffuse Map used (one color –red, green, blue, or alpha– stands for one Diffuse Map&#039;s opacity); Glow and Specular Maps define optional effects.
</p>
<p>
<p><div>We recommend to <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/wiki/doku.php/sdk:terrain_editor"><param name="text" value="<html><u>create and edit Splat Textures for terrains visually in the jMonkeyEngine SDK</u></html>"><param name="textColor" value="blue"></object>, and not do it manually. If you are simply curious about how the <acronym title="Software Development Kit">SDK</acronym>&#039;s terrain texture plugin works, or if you indeed want to generate materials manually, then read on for the implementation details.
</div></p>
</p>
<p>
The default material for TerraMonkey is TerrainLighting.j3md. This material combines several texture maps to produce the final custom texture. Remember, Diffuse Maps are the main textures that define the look; optionally, each Diffuse Map can be enhanced with a Normal Map; Alpha Maps describe the opacity of each Diffuse Map used (one color –red, green, blue, or alpha– stands for one Diffuse Map&#039;s opacity); Glow and Specular Maps define optional effects. Here are the names of the material properties:
Here are the names of TerrainLighting.j3md&#039;s material properties:
</p>
<p>
@ -146,21 +151,21 @@ The default material for TerraMonkey is TerrainLighting.j3md. This material comb
</li>
</ul>
</li>
<li><div> 12 Diffuse and/or Normal Maps (either in pairs, or stand-alone Diffuse Maps)</div>
<li><div> 12 Diffuse and/or Normal Maps (either in 6 pairs, or 12 stand-alone Diffuse Maps)</div>
<ul>
<li><div> <code>DiffuseMap</code></div>
<li><div> <code>DiffuseMap</code>, <code>DiffuseMap_0_scale</code>, <code>NormalMap</code> </div>
</li>
<li><div> <code>NormalMap</code> </div>
<li><div> <code>DiffuseMap_1</code>, <code>DiffuseMap_1_scale</code>, <code>NormalMap_1</code></div>
</li>
<li><div> <code>DiffuseMap_1</code></div>
<li><div> <code>DiffuseMap_2</code>, <code>DiffuseMap_2_scale</code>, <code>NormalMap_2</code></div>
</li>
<li><div> <code>NormalMap_1</code> <img src="/wiki/lib/exe/fetch.php"></div>
<li><div> <code>DiffuseMap_3</code>, <code>DiffuseMap_3_scale</code>, <code>NormalMap_3</code> <img src="/wiki/lib/exe/fetch.php"></div>
</li>
<li><div> <code>DiffuseMap_2</code></div>
<li><div> <code>DiffuseMap_4</code>, <code>DiffuseMap_4_scale</code>, <code>NormalMap_4</code></div>
</li>
<li><div> <code>NormalMap_2</code></div>
<li><div> <code>DiffuseMap_5</code>, <code>DiffuseMap_5_scale</code>, <code>NormalMap_5</code></div>
</li>
<li><div> etc, up to <code>Map_11</code>.</div>
<li><div> <code>DiffuseMap_6</code>, <code>DiffuseMap_6_scale</code>, …, <code>DiffuseMap_11</code></div>
</li>
</ul>
</li>
@ -176,21 +181,29 @@ The default material for TerraMonkey is TerrainLighting.j3md. This material comb
<p>
Video cards support a maximum of 16 Splat textures total. This means you can only use a subset of material properties at the same time! Follow these constraints:
<strong>Note:</strong> <code>DiffuseMap_0_scale</code> is a float value (e.g. 1.0f); you must specify one scale per Diffuse Map.
</p>
<p>
Video cards support a maximum of 16 Splat textures total. This means you can only use a subset of material properties at the same time!
</p>
<p>
Adhere to the following constraints:
<img src="/wiki/lib/exe/fetch.php">
</p>
<ul>
<li><div> 1-12 Diffuse Maps</div>
<li><div> 1-12 Diffuse Maps (one Diffuse Map is the minimum)</div>
</li>
<li><div> 1-3 Alpha Maps (for each 4 Diffuse Maps, you need 1 more Alpha Map!)</div>
</li>
<li><div> 0-6 Normal Maps (number must be equal or less than number of Diffuse Maps, since they come in pairs!)</div>
<li><div> 0-6 Normal Maps (Diffuse Maps &amp; Normal Maps come in pairs!)</div>
</li>
<li><div> 0 or 1 Glow Map</div>
</li>
<li><div> 0 or 1 Specular Map.</div>
</li>
<li><div> The sum of all maps used must be 16 or less.</div>
<li><div> <strong>The sum of all textures used must be 16, or less.</strong></div>
</li>
</ul>

@ -8,27 +8,17 @@ In the <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html">Hell
</p>
<p>
Other games however require a third-person perspective of the character: In these cases you use a CharacterControl on a Spatial. This example also shows how to set up custom navigation constrols, so you can press WASD to make the third-person character walk, and drag the mouse to rotate.
Other games however require a third-person perspective of the character: In these cases you use a CharacterControl on a Spatial. This example also shows how to set up custom navigation controls, so you can press WASD to make the third-person character walk; and how to implement dragging the mouse to rotate.
</p>
</div>
<h3><a>Why use CharacterControl instead of RigidBodyControl?</a></h3>
<h2><a>Sample Code</a></h2>
<div>
<p>
When you load a character model with a RigidBodyControl, and use forces to push it around, you do not get the desired effect: RigidBodyControl&#039;ed objects can tip over when pushed, and that is not what you expect of a walking character. jMonkeyEngine offers a special CharacterControl with a special walking methods to implement characters that walk upright.
</p>
</div>
<h3><a>Sample Code</a></h3>
<div>
<p>
The several related code samples can be found here:
Several related code samples can be found here:
</p>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/bullet/TestWalkingChar.java"><param name="text" value="<html><u>TestPhysicsCharacter.java</u></html>"><param name="textColor" value="blue"></object> (third-person view)</div>
@ -56,6 +46,74 @@ The code in this tutorial is a combination of these samples.
</div>
<h2><a>CharacterControl</a></h2>
<div>
<p>
When you load a character model, give it a RigidBodyControl, and use forces to push it around, you do not get the desired behaviour: RigidBodyControl&#039;ed objects (such as cubes and spheres) roll or tip over when pushed by physical forces. This is not the behaviour that you expect of a walking character. JME3&#039;s BulletPhysics integration offers a special CharacterControl with a <code>setWalkDirection()</code> method. You use it to create simple characters that treat floors and walls as solid, and always stays locked upright while moving.
</p>
<p>
This code sample creates a simple upright Character:
</p>
<pre>// Load any model
Node myCharacter = &#40;Node&#41; assetManager.loadModel&#40;&quot;Models/myCharacterModel.mesh.xml&quot;&#41;;
rootNode.attachChild&#40;myCharacter&#41;;
// Create a appropriate physical shape for it
CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape&#40;1.5f, 6f, 1&#41;;
CharacterControl myCharacter_phys = new CharacterControl&#40;capsuleShape, 0.01f&#41;;
// Attach physical properties to model and PhysicsSpace
myCharacter.addControl&#40;myCharacter_phys&#41;;
bulletAppState.getPhysicsSpace&#40;&#41;.add&#40;myCharacter_phys&#41;;</pre>
<p>
<p><div>The BulletPhysics CharacterControl only collides with &quot;real&quot; PhysicsControls (RigidBody). It does not detect collisions with other CharacterControls! If you need additional collision checks, add GhostControls to your characters and create a custom <a href="/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html">collision listener</a> to respond. (The JME3 team may implement a better CharacterControl one day.)
</div></p>
</p>
<p>
A CharacterControl is a special kinematic object with restricted movement. CharacterControls have a fixed &quot;upward&quot; axis, this means they do not topple over when walking over an obstacle (as opposed to RigidBodyControls), which simulates a being&#039;s ability to balance upright. A CharacterControl can jump and fall along its upward axis, and it can scale steps of a certain height/steepness.
</p>
<div><table>
<tr>
<th> CharacterControl Method </th><th> Property </th>
</tr>
<tr>
<td> setUpAxis(1)</td><td> Fixed upward axis. Values: 0 = X axis , 1 = Y axis , 2 = Z axis. <br/>
Default: 1, because for characters and vehicles, up is typically along the Y axis.</td>
</tr>
<tr>
<td> setJumpSpeed(10f) </td><td> Jump speed (movement along upward-axis) </td>
</tr>
<tr>
<td> setFallSpeed(20f) </td><td> Fall speed (movement opposite to upward-axis) </td>
</tr>
<tr>
<td> setMaxSlope(1.5f) </td><td> How steep the slopes and steps are that the character can climb without considering them an obstacle. Higher obstacles need to be jumped. Vertical height in world units. </td>
</tr>
<tr>
<td> setGravity(1f) </td><td> The intensity of gravity for this CharacterControl&#039;ed entity. Tip: To change the direction of gravity for a character, modify the up axis.</td>
</tr>
<tr>
<td> setWalkDirection(new Vector3f(0f,0f,0.1f))</td><td> (CharacterControl only) Make a physical character walk continuously while checking for floors and walls as solid obstacles. This should probably be called &quot;setPositionIncrementPerSimulatorStep&quot;. This argument is neither a direction nor a velocity, but the amount to increment the position each physics tick: vector length = accuracy*speed in m/s. <br/>
Use <code>setWalkDirection(Vector3f.ZERO)</code> to stop a directional motion. </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [3702-4865] -->
<p>
For best practices on how to use <code>setWalkDirection()</code>, see the Navigation Inputs example below.
</p>
</div>
<h2><a>Walking Character Demo</a></h2>
<div>
</div>
<h3><a>Code Skeleton</a></h3>
<div>
<pre>public class WalkingCharacterDemo extends SimpleApplication
@ -80,12 +138,17 @@ The code in this tutorial is a combination of these samples.
<h3><a>Overview</a></h3>
<div>
<p>
To create a walking character:
</p>
<ol>
<li><div> Activate physics by adding a <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">BulletAppState</a>.</div>
<li><div> (Unless you already have it) Activate physics in the scene by adding a <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">BulletAppState</a>.</div>
</li>
<li><div> Init the scene by loading a game level model (terrain or floor/buildings) and giving it a MeshCollisionShape.</div>
<li><div> Init the scene by loading the game level model (terrain or floor/buildings), and giving the scene a MeshCollisionShape.</div>
</li>
<li><div> Create the animated character</div>
<li><div> Create the animated character:</div>
<ol>
<li><div> Load an animated character model.</div>
</li>
@ -97,13 +160,13 @@ The code in this tutorial is a combination of these samples.
</li>
<li><div> Add a ChaseCam or CameraNode.</div>
</li>
<li><div> Handle navigational inputs</div>
<li><div> Handle navigational inputs.</div>
</li>
</ol>
</div>
<h2><a>Activate Physics</a></h2>
<h3><a>Activate Physics</a></h3>
<div>
<pre>private BulletAppState bulletAppState;
...
@ -116,7 +179,7 @@ public void simpleInitApp&#40;&#41; &#123;
</div>
<h2><a>Initialize the Scene</a></h2>
<h3><a>Initialize the Scene</a></h3>
<div>
<p>
@ -159,7 +222,7 @@ Also, add a light source to be able to see the scene.
</div>
<h2><a>Create the Animated Character</a></h2>
<h3><a>Create the Animated Character</a></h3>
<div>
<p>
@ -229,7 +292,7 @@ The attackChannel only controls one arm, while the walking channels controls the
</div>
<h2><a>Add ChaseCam / CameraNode</a></h2>
<h3><a>Add ChaseCam / CameraNode</a></h3>
<div>
<pre>private ChaseCamera chaseCam;
&nbsp;
@ -243,18 +306,20 @@ public void simpleInitApp&#40;&#41; &#123;
</div>
<h2><a>Handle navigational inputs</a></h2>
<h3><a>Handle Navigation</a></h3>
<div>
<p>
Configure custom key bindings for WASD keys that you will use to make the character walk.
Configure custom key bindings for WASD keys that you will use to make the character walk. Then calculate the vector where the user wants the character to move. Note the use of the special <code>setWalkDirection()</code> method below.
</p>
<pre>private boolean left = false, right = false, up = false, down = false;
<pre>// track directional input, so we can walk left-forward etc
private boolean left = false, right = false, up = false, down = false;
...
&nbsp;
public void simpleInitApp&#40;&#41; &#123;
...
// configure mappings, e.g. the WASD keys
inputManager.addMapping&#40;&quot;CharLeft&quot;, new KeyTrigger&#40;KeyInput.KEY_A&#41;&#41;;
inputManager.addMapping&#40;&quot;CharRight&quot;, new KeyTrigger&#40;KeyInput.KEY_D&#41;&#41;;
inputManager.addMapping&#40;&quot;CharForward&quot;, new KeyTrigger&#40;KeyInput.KEY_W&#41;&#41;;
@ -268,7 +333,7 @@ public void simpleInitApp&#40;&#41; &#123;
&#125;</pre>
<p>
Respond to the key bindings by setting variables that track in which direction you will go. (No actual walking happens here yet)
Respond to the key bindings by setting variables that track in which direction you will go. This allows us to steer the character forwards and to the left at the same time. <strong>Note that no actual walking happens here yet!</strong> We just track the input.
</p>
<pre>@Override
public void onAction&#40;String binding, boolean value, float tpf&#41; &#123;
@ -291,7 +356,7 @@ public void onAction&#40;String binding, boolean value, float tpf&#41; &#123;
&#125;</pre>
<p>
The player can attack and walk at the same time. Attack() is a custom method that triggers an attack animation in the arms. Here you should also add custom code to play an effect and sound, and to determine whether the hit was successful.
The player can attack and walk at the same time. <code>Attack()</code> is a custom method that triggers an attack animation in the arms. Here you should also add custom code to play an effect and sound, and to determine whether the hit was successful.
</p>
<pre>private void attack&#40;&#41; &#123;
attackChannel.setAnim&#40;&quot;Dodge&quot;, 0.1f&#41;;
@ -299,9 +364,13 @@ The player can attack and walk at the same time. Attack() is a custom method tha
&#125;</pre>
<p>
The update loop looks at the directional variables and moves the character accordingly. Since it&#039;s a physical character, we use setWalkDirection(). The variable airTime tracks how long the character is off the ground (e.g. when jumping or falling) and adjusts the walk and stand animations acccordingly.
Finally, the update loop looks at the directional variables and moves the character accordingly. Since this is a special kinematic CharacterControl, we use the <code>setWalkDirection()</code> method.
</p>
<p>
The variable <code>airTime</code> tracks how long the character is off the ground (e.g. when jumping or falling) and adjusts the walk and stand animations acccordingly.
</p>
<pre>private Vector3f walkDirection = new Vector3f&#40;0,0,0&#41;;
<pre>private Vector3f walkDirection = new Vector3f&#40;0,0,0&#41;; // stop
&nbsp;
private float airTime = 0;
&nbsp;
@ -337,7 +406,7 @@ public void simpleUpdate&#40;float tpf&#41; &#123;
animationChannel.setAnim&#40;&quot;Walk&quot;, 0.7f&#41;;
&#125;
&#125;
character.setWalkDirection&#40;walkDirection&#41;;
character.setWalkDirection&#40;walkDirection&#41;; // THIS IS WHERE THE WALKING HAPPENS
&#125;</pre>
<p>

@ -186,6 +186,10 @@ Optionally, download <object classid="java:org.netbeans.modules.javahelp.Browser
During build, the libraries and main jar file from the main project are copied to the android project libs folder for access. During this operation the desktop-specific libraries are replaced with android specific JARs.
</p>
<p>
<strong>Be aware that logging has been identified as having a significant performance hit in Android applications. If getting poor performance please try turning logging either down or off and retesting.</strong>
</p>
</div>
<h4><a>Installing NBAndroid</a></h4>
@ -286,6 +290,13 @@ The <acronym title="Software Development Kit">SDK</acronym> will later provide t
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/android/forum/topic/how-to-run-your-jme3-application-on-android-androidharness"><param name="text" value="<html><u>Android Forum Thread (alpha)</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:android?do=showtag&amp;tag=tag%3Aandroid">android</a>,
<a href="/wiki/doku.php/tag:deployment?do=showtag&amp;tag=tag%3Adeployment">deployment</a>,
<a href="/wiki/doku.php/tag:tool?do=showtag&amp;tag=tag%3Atool">tool</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:android?do=export_xhtmlbody">view online version</a></em></p>

@ -1,8 +1,9 @@
<h1><a>JME 3 Tutorial (7) - Hello Animation</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (7) - Hello Animation</a></h1>
<div>
<p>
Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_material.html">Hello Material</a>,
Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_picking.html">Hello Picking</a>
</p>
@ -280,6 +281,12 @@ Open the <code>skeleton.xml</code> file in a text editor of your choice. You don
<p>
Add the following import statements for the SkeletonDebugger and Material classes:
</p>
<pre> import com.jme3.scene.debug.SkeletonDebugger;
import com.jme3.material.Material;</pre>
<p>
Add the following code snippet to <code>simpleInitApp()</code> to make the bones (that you just read about) visible!
</p>
<pre> SkeletonDebugger skeletonDebug =

@ -1,5 +1,5 @@
<h1><a>JME 3 Tutorial (3) - Hello Assets</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (3) - Hello Assets</a></h1>
<div>
<p>
@ -346,7 +346,7 @@ rootNode.attachChild&#40;scene&#41;;</pre>
</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [10828-11882] -->
<!-- EDIT1 TABLE [10838-11892] -->
</div>
<h2><a>Excercise - How to Load Assets</a></h2>
@ -472,6 +472,10 @@ Let&#039;s add some action to the scene and continue with the <a href="/com/jme3
<strong>See also:</strong>
</p>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/import-assets/forum/topic/blender-2-61-animation-issues/?topic_page=2&amp;num=15"><param name="text" value="<html><u>Forum: How to import animated models from Blender 2.6 correctly</u></html>"><param name="textColor" value="blue"></object> (<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://www.youtube.com/watch?v=QiLCs4AKh28"><param name="text" value="<html><u>Video</u></html>"><param name="textColor" value="blue"></object>)</div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.youtube.com/watch?v=NdjC9sCRV0s"><param name="text" value="<html><u>Video tutorial for animated models from Blender 2.6</u></html>"><param name="textColor" value="blue"></object></div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://docs.google.com/fileview?id=0B9hhZie2D-fENDBlZDU5MzgtNzlkYi00YmQzLTliNTQtNzZhYTJhYjEzNWNk&amp;hl=en"><param name="text" value="<html><u>Exporting OgreXML scenes from Blender to jME</u></html>"><param name="textColor" value="blue"></object> </div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/forum/index.php?topic=14418.0"><param name="text" value="<html><u>Screenshots of a great loaded model</u></html>"><param name="textColor" value="blue"></object></div>

@ -1,5 +1,5 @@
<h1><a>JME 3 Tutorial (11) - Hello Audio</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (11) - Hello Audio</a></h1>
<div>
<p>
@ -294,7 +294,7 @@ Typically, you stream long sounds, and buffer short sounds.
<td>The same sound cannot play twice at the same time.</td><td>The same sounds can play multiple times and overlap.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [9739-9983] -->
<!-- EDIT1 TABLE [9749-9993] -->
</div>
<h2><a>Your Ear in the Scene</a></h2>

@ -1,5 +1,5 @@
<h1><a>JME 3 Tutorial (9) - Hello Collision</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (9) - Hello Collision</a></h1>
<div>
<p>
@ -149,13 +149,13 @@ public class HelloCollision extends SimpleApplication
* We do not walk yet, we just keep track of the direction the user pressed. */</span>
public void onAction&#40;String binding, boolean value, float tpf&#41; &#123;
if &#40;binding.equals&#40;&quot;Left&quot;&#41;&#41; &#123;
if &#40;value&#41; &#123; left = true; &#125; else &#123; left = false; &#125;
left = value;
&#125; else if &#40;binding.equals&#40;&quot;Right&quot;&#41;&#41; &#123;
if &#40;value&#41; &#123; right = true; &#125; else &#123; right = false; &#125;
right = value;
&#125; else if &#40;binding.equals&#40;&quot;Up&quot;&#41;&#41; &#123;
if &#40;value&#41; &#123; up = true; &#125; else &#123; up = false; &#125;
up = value;
&#125; else if &#40;binding.equals&#40;&quot;Down&quot;&#41;&#41; &#123;
if &#40;value&#41; &#123; down = true; &#125; else &#123; down = false; &#125;
down = value;
&#125; else if &#40;binding.equals&#40;&quot;Jump&quot;&#41;&#41; &#123;
player.jump&#40;&#41;;
&#125;

@ -1,5 +1,5 @@
<h1><a>JME 3 Tutorial (12) - Hello Effects</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (12) - Hello Effects</a></h1>
<div>
<p>
@ -193,7 +193,7 @@ The following particle textures included in <code>test-data.jar</code>. You can
<td> Effects/Smoke/Smoke.png </td><td> 1*15 </td><td> <img src="/wiki/lib/exe/fetch.php"> </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [5319-6118] -->
<!-- EDIT1 TABLE [5329-6128] -->
<p>
Copy them into you <code>assets/Effects</code> directory to use them.
@ -318,7 +318,7 @@ Vector3f.NAN <br/>
<td> gravity </td><td> <code>setGravity()</code> </td><td> 0,1,0 </td><td> Whether particles fall down (positive) or fly up (negative). Set to 0f for a zero-g effect where particles keep flying. </td>
</tr>
</table></div>
<!-- EDIT2 TABLE [8150-9622] -->
<!-- EDIT2 TABLE [8160-9632] -->
<p>
You can find details about <a href="/com/jme3/gde/core/docs/jme3/advanced/particle_emitters#configure_parameters.html">effect parameters</a> here.

@ -1,5 +1,5 @@
<h1><a>JME 3 Tutorial (5) - Hello Input System</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (5) - Hello Input System</a></h1>
<div>
<p>
@ -9,7 +9,7 @@ Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_material.html">Hello
</p>
<p>
By default, SimpleApplication sets up an input system that allows you to steer the camera with the WASD keys, the arrow keys, and the mouse. You can use it as a flying first-person camera right away. But what if you need a third-person camera, or you want keys to trigger special game actions?
By default, SimpleApplication sets up a camera control that allows you to steer the camera with the WASD keys, the arrow keys, and the mouse. You can use it as a flying first-person camera right away. But what if you need a third-person camera, or you want keys to trigger special game actions?
</p>
<p>
@ -227,6 +227,41 @@ In this example, we trigger the following actions:
&#125;
&#125;;</pre>
<p>
You can also combine both listeners into one, the engine will send the appropriate events to each method (onAction or onAnalog). For example:
</p>
<pre> private MyCombinedListener combinedListener = new MyCombinedListener&#40;&#41;;
&nbsp;
private static class MyCombinedListener implements AnalogListener, ActionListener &#123;
public void onAction&#40;String name, boolean keyPressed, float tpf&#41; &#123;
if &#40;name.equals&#40;&quot;Pause&quot;&#41; &amp;&amp; !keyPressed&#41; &#123;
isRunning = !isRunning;
&#125;
&#125;
&nbsp;
public void onAnalog&#40;String name, float value, float tpf&#41; &#123;
if &#40;isRunning&#41; &#123;
if &#40;name.equals&#40;&quot;Rotate&quot;&#41;&#41; &#123;
player.rotate&#40;0, value*speed, 0&#41;;
&#125;
if &#40;name.equals&#40;&quot;Right&quot;&#41;&#41; &#123;
Vector3f v = player.getLocalTranslation&#40;&#41;;
player.setLocalTranslation&#40;v.x + value*speed, v.y, v.z&#41;;
&#125;
if &#40;name.equals&#40;&quot;Left&quot;&#41;&#41; &#123;
Vector3f v = player.getLocalTranslation&#40;&#41;;
player.setLocalTranslation&#40;v.x - value*speed, v.y, v.z&#41;;
&#125;
&#125; else &#123;
System.out.println&#40;&quot;Press P to unpause.&quot;&#41;;
&#125;
&#125;
&#125;
// ...
inputManager.addListener&#40;analogListener, new String&#91;&#93;&#123;&quot;Pause&quot;, &quot;Left&quot;, &quot;Right&quot;, &quot;Rotate&quot;&#125;&#41;;
&nbsp;</pre>
<p>
It&#039;s okay to use only one of the two Listeners, and not implement the other one, if you are not using this type of interaction. In the following, we have a closer look how to decide which of the two listeners is best suited for which situation.
</p>
@ -319,7 +354,7 @@ You can find the list of input constants in the files <code>src/core/com/jme3/in
KeyTrigger(KeyInput.KEY_LEFT), KeyTrigger(KeyInput.KEY_RIGHT) </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [9414-10010] -->
<!-- EDIT1 TABLE [10614-11210] -->
<p>
<strong>Tip:</strong> If you don&#039;t recall an input constant during development, you benefit from an IDE&#039;s code completion functionality: Place the caret after e.g. <code>KeyInput.|</code> and trigger code completion to select possible input identifiers.

@ -1,5 +1,5 @@
<h1><a>JME 3 Tutorial (4) - Hello Update Loop</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (4) - Hello Update Loop</a></h1>
<div>
<p>

@ -1,8 +1,9 @@
<h1><a>JME 3 Tutorial (6) - Hello Materials</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (6) - Hello Materials</a></h1>
<div>
<p>
Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html">Hello Input System</a>,
Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_animation.html">Hello Animation</a>
</p>
@ -81,6 +82,9 @@ public class HelloMaterial extends SimpleApplication &#123;
Material mat_lit = new Material&#40;assetManager, &quot;Common/MatDefs/Light/Lighting.j3md&quot;&#41;;
mat_lit.setTexture&#40;&quot;DiffuseMap&quot;, assetManager.loadTexture&#40;&quot;Textures/Terrain/Pond/Pond.jpg&quot;&#41;&#41;;
mat_lit.setTexture&#40;&quot;NormalMap&quot;, assetManager.loadTexture&#40;&quot;Textures/Terrain/Pond/Pond_normal.png&quot;&#41;&#41;;
mat_lit.setBoolean&#40;&quot;UseMaterialColors&quot;,true&#41;;
mat_lit.setColor&#40;&quot;Specular&quot;,ColorRGBA.White&#41;;
mat_lit.setColor&#40;&quot;Diffuse&quot;,ColorRGBA.White&#41;;
mat_lit.setFloat&#40;&quot;Shininess&quot;, 5f&#41;; // [1,128]
shiny_rock.setMaterial&#40;mat_lit&#41;;
shiny_rock.setLocalTranslation&#40;0,2,-2&#41;; // Move it a bit
@ -295,7 +299,7 @@ DiffuseMap, NormalMap, SpecularMap : Texture2D <br/>
Shininess : Float </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [11029-11499] -->
<!-- EDIT1 TABLE [11197-11667] -->
<p>
For a game, you create custom Materials based on these existing MaterialDefintions – as you have just seen in the example with the shiny rock&#039;s material.
@ -413,7 +417,7 @@ Now that you know how to load models and how to assign good-looking materials to
See also
</p>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a></div>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/intermediate/how_to_use_materials.html">How to Use Materials</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/sdk/material_editing.html">Material Editing</a></div>
</li>

@ -1,5 +1,5 @@
<h1><a>JME 3 Tutorial (2) - Hello Node</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (2) - Hello Node</a></h1>
<div>
<p>
@ -125,7 +125,7 @@ In this tutorial, you learn some new terms:
<td>Position/move, turn, or resize an object</td><td>Translate, rotate, scale an object. Transform an object.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [3079-3496] -->
<!-- EDIT1 TABLE [3089-3506] -->
<p>
Every JME3 application has a rootNode: Your game automatically inherits the <code>rootNode</code> object from SimpleApplication. Everything attached to the rootNode is part of the scene graph. The elements of the scene graph are Spatials.
@ -152,7 +152,7 @@ Every JME3 application has a rootNode: Your game automatically inherits the <cod
<th> Examples: </th><td> A box, a sphere, a player, a building, a piece of terrain, a vehicle, missiles, NPCs, etc… </td><td> The <code>rootNode</code>, a floor node grouping several terrains, a custom vehicle-with-passengers node, a player-with-weapon node, an audio node, etc… </td>
</tr>
</table></div>
<!-- EDIT2 TABLE [3912-4405] -->
<!-- EDIT2 TABLE [3922-4415] -->
</div>
<h2><a>Understanding the Code</a></h2>
@ -293,7 +293,7 @@ thing.setMaterial&#40;mat&#41;;</pre>
<td> Specify what should be loaded at the start </td><td> Everything you initialize and attach to the <code>rootNode</code> in the <code>simpleInitApp()</code> method is part of the scene at the start of the game. </td>
</tr>
</table></div>
<!-- EDIT3 TABLE [8042-9304] -->
<!-- EDIT3 TABLE [8052-9314] -->
</div>
<h2><a>How do I Transform Spatials?</a></h2>
@ -319,7 +319,7 @@ To move a Spatial <em>to</em> specific coordinates, such as (0,40.2f,-2), use: <
</td><td>+right -left</td><td>+up -down</td><td>+forward -backward</td>
</tr>
</table></div>
<!-- EDIT4 TABLE [9429-9945] --><div><table>
<!-- EDIT4 TABLE [9439-9955] --><div><table>
<tr>
<th> Scaling resizes Spatials </th><th> X-axis </th><th> Y-axis </th><th> Z-axis </th>
</tr>
@ -331,7 +331,7 @@ To scale a Spatial 10 times longer, one tenth the height, and keep the same widt
</td><td>length</td><td>height</td><td>width</td>
</tr>
</table></div>
<!-- EDIT5 TABLE [9947-10436] --><div><table>
<!-- EDIT5 TABLE [9957-10446] --><div><table>
<tr>
<th> Rotation turns Spatials </th><th> X-axis </th><th> Y-axis </th><th> Z-axis </th>
</tr>
@ -347,7 +347,7 @@ To roll an object 180° around the z axis: <pre>thing.rotate&#40; 0f , 0f , 180*
</td><td>pitch = nodding your head</td><td>yaw = shaking your head</td><td>roll = cocking your head</td>
</tr>
</table></div>
<!-- EDIT6 TABLE [10438-11219] -->
<!-- EDIT6 TABLE [10448-11229] -->
</div>
<h2><a>How do I Troubleshoot Spatials?</a></h2>
@ -378,7 +378,7 @@ Did you rotate around the right axis? </td>
<td> A Geometry has an unexpected Color or Material. </td><td> Did you reuse a Material from another Geometry and have inadvertently changed its properties? (If so, consider cloning it: mat2 = mat.clone(); ) </td>
</tr>
</table></div>
<!-- EDIT7 TABLE [11352-12325] -->
<!-- EDIT7 TABLE [11362-12335] -->
</div>
<h2><a>How do I Add Custom Data to Spatials?</a></h2>

@ -1,5 +1,5 @@
<h1><a>JME 3 Tutorial (13) - Hello Physics</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (13) - Hello Physics</a></h1>
<div>
<p>

@ -1,8 +1,9 @@
<h1><a>JME 3 Tutorial (8) - Hello Picking</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (8) - Hello Picking</a></h1>
<div>
<p>
Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_animation.html">Hello Animation</a>,
Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html">Hello Collision</a>
</p>
@ -395,7 +396,7 @@ Vector2f click2d = inputManager.getCursorPosition&#40;&#41;;
Vector3f click3d = cam.getWorldCoordinates&#40;
new Vector2f&#40;click2d.x, click2d.y&#41;, 0f&#41;.clone&#40;&#41;;
Vector3f dir = cam.getWorldCoordinates&#40;
new Vector2f&#40;click2d.x, click2d.y&#41;, 1f&#41;.subtractLocal&#40;click3d&#41;;
new Vector2f&#40;click2d.x, click2d.y&#41;, 1f&#41;.subtractLocal&#40;click3d&#41;.normalizeLocal&#40;&#41;;
Ray ray = new Ray&#40;click3d, dir&#41;;
shootables.collideWith&#40;ray, results&#41;;
...</pre>

@ -1,5 +1,5 @@
<h1><a>JME 3 Tutorial (1) - Hello SimpleApplication</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (1) - Hello SimpleApplication</a></h1>
<div>
<p>
@ -211,7 +211,7 @@ This code opens your application window. Let&#039;s learn how you put something
<td>You want the cube to appear in the center.</td><td>I create the Box at the origin = at <code>Vector3f.ZERO</code>.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [5076-5549] -->
<!-- EDIT1 TABLE [5086-5559] -->
<p>
If you are unfamiliar with the vocabulary, read more about <a href="/com/jme3/gde/core/docs/jme3/the_scene_graph.html">the Scene Graph</a> here.

@ -1,5 +1,5 @@
<h1><a>JME 3 Tutorial (10) - Hello Terrain</a></h1>
<h1><a>jMonkeyEngine 3 Tutorial (10) - Hello Terrain</a></h1>
<div>
<p>
@ -15,6 +15,10 @@ One way to create a 3D landscape is to sculpt a huge terrain model. This gives y
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-terrain.png">
</p>
<p>
Note: If you get an error when trying to create your ImageBasedHeightMap object, you may need to update the <acronym title="Software Development Kit">SDK</acronym>, click on &quot;Help&quot; / &quot;Check for updates&quot;
</p>
</div>
<h2><a>Sample Code</a></h2>
@ -32,7 +36,6 @@ import com.jme3.terrain.heightmap.HillHeightMap; // for exercise 2
import com.jme3.terrain.heightmap.ImageBasedHeightMap;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture.WrapMode;
import jme3tools.converters.ImageToAwt;
import java.util.ArrayList;
import java.util.List;
&nbsp;
@ -470,8 +473,7 @@ The following two lines generate the heightmap object based on your user-defined
</p>
<pre>Texture heightMapImage = assetManager.loadTexture&#40;
&quot;Textures/Terrain/splat/mountains512.png&quot;&#41;;
heightmap = new ImageBasedHeightMap&#40;
ImageToAwt.convert&#40;heightMapImage.getImage&#40;&#41;, false, true, 0&#41;, 1f&#41;;</pre>
heightmap = new ImageBasedHeightMap&#40;heightMapImage.getImage&#40;&#41;&#41;;</pre>
<p>
Instead, you can also let JME3 generate a random landscape for you:

@ -40,6 +40,12 @@ We recommend downloading the <object classid="java:org.netbeans.modules.javahelp
</ul>
</li>
</ol>
<p>
For a detailed description of the created jar files see <a href="/com/jme3/gde/core/docs/jme3/jme3_source_structure#structure_of_jmonkeyengine3_jars.html">this list</a>.
</p>
<hr />
<p>
@ -51,6 +57,10 @@ Learn more about:
<li><div> <a href="/com/jme3/gde/core/docs/jme3/build_jme3_sources_with_netbeans.html">Building JME3 from the sources with NetBeans</a> </div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:install?do=showtag&amp;tag=tag%3Ainstall">install</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:build_from_sources?do=export_xhtmlbody">view online version</a></em></p>

@ -1,5 +1,5 @@
<h1><a>Setting up JME3 in Netbeans 6.x</a></h1>
<h1><a>Setting up JME3 in Netbeans 6+</a></h1>
<div>
<p>
@ -59,37 +59,10 @@ j-ogg-vorbisd.jar asm-all-3.1.jar jbullet.jar
jheora-jst-debug-0.6.0.jar xmlpull.xpp3-1.1.4c.jar
nifty*.jar eventbus-1.4.jar</pre>
</div>
<h3><a>Optional: Setting up Android Support</a></h3>
<div>
<p>
Work in progress …
For a detailed description of the separate jar files see <a href="/com/jme3/gde/core/docs/jme3/jme3_source_structure#structure_of_jmonkeyengine3_jars.html">this list</a>.
</p>
<p>
A jme3 application can either be deployed to the desktop (as Java Swing application) and web browser (as JNLP/WebStart or Applet), or to an Android phone. While the former is the default, switching to Android deployment can be done in a few steps.
</p>
<ol>
<li><div> Open Project Properties, go to Sources category.</div>
</li>
<li><div> At Source Packages Folders, click &quot;Add Folder&quot;. </div>
<ul>
<li><div> Add <code>src/android/</code></div>
</li>
<li><div> Remove <code>src/desktop</code></div>
</li>
<li><div> Remove <code>src/desktop_fx</code></div>
</li>
</ul>
</li>
<li><div> build.xml…</div>
</li>
</ol>
</div>
<h2><a>Build and Run</a></h2>
@ -173,13 +146,17 @@ If you are working on a game project that depends on jme3:
<p>
This tip works for any third-party JAR library that you use. (You may have to download the javadoc/sources from their home page separately).
</p>
<hr />
<p>
Sources used: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/wiki/BuildJme3"><param name="text" value="<html><u>BuildJme3</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/forum/index.php?topic=13108.0"><param name="text" value="<html><u>netbeans tutorial from forum</u></html>"><param name="textColor" value="blue"></object>
Sources used: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/wiki/BuildJme3"><param name="text" value="<html><u>BuildJme3</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/forum/index.php?topic=13108.0"><param name="text" value="<html><u>NetBeans tutorial from forum</u></html>"><param name="textColor" value="blue"></object>
</p>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:install?do=showtag&amp;tag=tag%3Ainstall">install</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:build_jme3_sources_with_netbeans?do=export_xhtmlbody">view online version</a></em></p>

@ -31,9 +31,34 @@ Extend com.jme3.app.SimpleApplication.
<div>
<p>
Yes! For your own games, you should create a custom base class that extends <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/app/SimpleApplication.java"><param name="text" value="<html><u>com.jme3.app.SimpleApplication</u></html>"><param name="textColor" value="blue"></object> class, configure <a href="/com/jme3/gde/core/docs/jme3/intermediate/appsettings.html">application settings</a>, and customize away.
Yes! For your own games, you create a custom base class that extends <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/app/SimpleApplication.java"><param name="text" value="<html><u>com.jme3.app.SimpleApplication</u></html>"><param name="textColor" value="blue"></object> class, so it&#039;s no longer a &quot;simple&quot; application. Configure your <a href="/com/jme3/gde/core/docs/jme3/intermediate/appsettings.html">application settings</a>, and customize away.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html">SimpleApplication</a>, <a href="/com/jme3/gde/core/docs/jme3/intermediate/appsettings.html">AppSettings</a>.
</p>
</div>
<h3><a>How can I switch between screens or states?</a></h3>
<div>
<p>
You should break app your application logic into components by spreading it out over individual AppStates. AppStates can be attached to and detached from the game. AppStates have access to all objects (rootNode, PhysicsSpace, inputManager, etc) and methods in your main application. So each AppState can bring its own subset of input handlers, <acronym title="Graphical User Interface">GUI</acronym> nodes, spatial nodes, and even its own subset of game mechanics in the update() loop.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">Application States</a>.
</p>
</div>
<h3><a>How do I pause/unpause a game?</a></h3>
<div>
<p>
You split up your application into several AppStates and implement the setEnabled() methods for each state. Then you create, for example, a GameRunningAppState and a GamePausedAppState. GamePausedAppState&#039;s job is to attach all your AppStates that contain the logic and <acronym title="Graphical User Interface">GUI</acronym> of the pause screen, and to detach all the AppStates that contain logic and <acronym title="Graphical User Interface">GUI</acronym> of the running game. GameRunningAppState does the opposite. By attaching one or the other to the game, you switch between the paused and unpaused states.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">Application States</a>.
</p>
</div>
@ -57,6 +82,19 @@ For the release, switch the severity level of the default logger to print only S
<p>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/advanced/logging.html">Logging</a>.
</p>
</div>
<h3><a>Why does the executable crash with &quot;Cannot locate resource&quot;?</a></h3>
<div>
<p>
Make sure to only load() models converted to .j3o binary format, not the original Ogre or Wavefront formats. If you load assets from zip files, make sure to ammend the build script to copy them ito the build.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a>
</p>
</div>
@ -98,8 +136,8 @@ Optionally, you can control whether the engine culls an object always or never.
First check whether the file path of the asset is correct. By default it is relative to your project&#039;s assets directory:
</p>
<pre>// To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.mesh.xml
Spatial ninja = assetManager.loadModel&#40;&quot;Models/Ninja/Ninja.mesh.xml&quot;&#41;;</pre>
<pre>// To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.j3o
Spatial ninja = assetManager.loadModel&#40;&quot;Models/Ninja/Ninja.j3o&quot;&#41;;</pre>
<p>
@ -107,7 +145,7 @@ If you are not using the default <code>assets</code> directory, verify that you
</p>
<pre>this.assetManager.registerLocator&#40;&quot;assets/&quot;, FileLocator.class&#41;; // default
this.assetManager.registerLocator&#40;&quot;c:/jme3User/JMEisSoCool/myAwesomeFolder&quot;, FileLocator.class&#41;;
this.assetManager.registerLocator&#40;&quot;c:/jme3User/JMEisSoCool/myAwesomeFolder/&quot;, FileLocator.class&#41;;
this.assetManager.registerLocator&#40;&quot;town.zip&quot;, ZipLocator.class.getName&#40;&#41;&#41;;</pre>
<p>
@ -117,13 +155,17 @@ this.assetManager.registerLocator&#40;&quot;town.zip&quot;, ZipLocator.class.get
</div>
<h3><a>How do I Create 3-D models?</a></h3>
<h3><a>How do I Create 3-D models, textures, sounds?</a></h3>
<div>
<p>
Follow our best practices for the <a href="/com/jme3/gde/core/docs/jme3/intermediate/multi-media_asset_pipeline.html">multi-media asset pipeline</a>. <br/>
You create 3-D models in a 3-D mesh editor, for example Blender, and export it in Ogre Mesh <acronym title="Extensible Markup Language">XML</acronym> or Wavefront OBJ format.
You create textures in a graphic editor, for exmaple Gimp, and export them as <acronym title="Portable Network Graphics">PNG</acronym> or <acronym title="Joint Photographics Experts Group">JPG</acronym>.
You create sounds in an audio editor, for example, Audacity, and export them as WAVE or OGG.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/advanced/3d_models.html">3D Models</a>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://blender.org"><param name="text" value="<html><u>Download Blender</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro"><param name="text" value="<html><u>Blender tutorial</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.ogre3d.org/wiki/index.php/Blender_Exporter"><param name="text" value="<html><u>Blender-to-Ogre plugin</u></html>"><param name="textColor" value="blue"></object>.
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/advanced/3d_models.html">3D Models</a>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://blender.org"><param name="text" value="<html><u>Download Blender</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro"><param name="text" value="<html><u>Blender tutorial</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.ogre3d.org/wiki/index.php/Blender_Exporter"><param name="text" value="<html><u>Blender-to-Ogre plugin</u></html>"><param name="textColor" value="blue"></object>, <a href="/com/jme3/gde/core/docs/jme3/intermediate/multi-media_asset_pipeline.html">Multi-Media Asset Pipeline</a>.
</p>
</div>
@ -135,8 +177,8 @@ You create 3-D models in a 3-D mesh editor, for example Blender, and export it i
Use the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> to convert models from Ogre <acronym title="Extensible Markup Language">XML</acronym> or Wavefront OBJ formats to .j3o binary format. Load the .j3o file using the AssetManager.
</p>
<pre>// To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.mesh.xml
Spatial ninja = assetManager.loadModel&#40;&quot;Models/Ninja/Ninja.mesh.xml&quot;&#41;;</pre>
<pre>// To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.j3o
Spatial ninja = assetManager.loadModel&#40;&quot;Models/Ninja/Ninja.j3o&quot;&#41;;</pre>
<p>
@ -184,7 +226,7 @@ To move or turn or resize a spatial you use transformations. You can concatenate
<div>
<p>
Change the geometry&#039;s translation (position) live in the update loop using setLocalTranslation() for non-physical and setWalkDirection() for physical objects. You can also define and remote-control a spatial&#039;s motion using <a href="/com/jme3/gde/core/docs/jme3/advanced/cinematics.html">Cinematics</a>, e.g. to record cut scenes.
Change the geometry&#039;s translation (position) live in the update loop using setLocalTranslation() for non-physical and applyForce() or setWalkDirection() for physical objects. You can also define and remote-control a spatial&#039;s motion using <a href="/com/jme3/gde/core/docs/jme3/advanced/cinematics.html">Cinematics</a>, e.g. to record cutscenes, or to implement mobile platforms, elevators, airships, etc.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html">Hello Loop</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/update_loop.html">Update Loop</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Custom Controls</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/cinematics.html">Cinematics</a>
<br/>
@ -262,7 +304,7 @@ You can choose among various <code>com.jme3.texture.Texture.WrapMode</code>s for
<p>
Use the AssetManager to load Materials, and change material settings.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_material.html">Hello Material</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_material.html">Hello Material</a>, <a href="/com/jme3/gde/core/docs/jme3/intermediate/how_to_use_materials.html">How To Use Materials</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a>.
<br/>
<strong>Code sample:</strong> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/light/TestNormalMapping.java"><param name="text" value="<html><u>TestNormalMapping.java</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/model/TestSphere.java"><param name="text" value="<html><u>TestSphere.java</u></html>"><param name="textColor" value="blue"></object>.
</p>
@ -273,9 +315,9 @@ Use the AssetManager to load Materials, and change material settings.
<div>
<p>
Create Textures as image files. Use the AssetManager to load a Material and set the material&#039;s texture maps.
Create Textures as image files. Use the AssetManager to load a Material and use texture mapping for improved looks.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_material.html">Hello Material</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/asset/AssetManager.java"><param name="text" value="<html><u>come.jme3.assets.AssetManager</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://wiki.blender.org/index.php/Doc:Manual/Textures/Maps/Bump_and_Normal_Maps"><param name="text" value="<html><u>Blender: Creating Bump Maps and Normal maps</u></html>"><param name="textColor" value="blue"></object>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_material.html">Hello Material</a>, <a href="/com/jme3/gde/core/docs/jme3/intermediate/how_to_use_materials.html">How To Use Materials</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/asset/AssetManager.java"><param name="text" value="<html><u>come.jme3.assets.AssetManager</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://wiki.blender.org/index.php/Doc:Manual/Textures/Maps/Bump_and_Normal_Maps"><param name="text" value="<html><u>Blender: Creating Bump Maps and Normal Maps</u></html>"><param name="textColor" value="blue"></object>
<br/>
<strong>Code sample:</strong> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/material/TestSimpleBumps.java"><param name="text" value="<html><u>TestSimpleBumps.java</u></html>"><param name="textColor" value="blue"></object>
</p>
@ -286,7 +328,7 @@ Create Textures as image files. Use the AssetManager to load a Material and set
<div>
<p>
If you use a lit material (based on Lighting.j3md) then you must attach a light source to the rootNode, otherwise you see nothing. If you use lit material colors, make sure you have specified an Ambient color (can be the same as the Diffuse color) if you use an AmbientLight. If you see objects, but they are gray or too dark, set the light color to white, or make it brighter (you can multiply the color value with a scalar), or add a global light source (AmbientLight). Similarly, if everything is white, tune down the lights. If materials flicker under a directional light, change the light direction vector. Change the background color (which is independent of light sources) to get a better contrast while debugging a light problem.
If you use a lit material (based on Lighting.j3md) then you must attach a light source to the rootNode, otherwise you see nothing. If you use lit material colors, make sure you have specified an Ambient color (can be the same as the Diffuse color) if you use an AmbientLight. If you see objects, but they are gray or too dark, set the light color to white, or make it brighter (you can multiply the color value with a scalar), or add a global white light source (AmbientLight). Similarly, if everything is too white, tune down the lights. If materials flicker under a directional light, change the light direction vector. Change the background color (which is independent of light sources) to get a better contrast while debugging a light problem.
</p>
</div>
@ -315,7 +357,7 @@ Assign a texture with an alpha channel to a Material and set the Material&#039;s
<p>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_material.html">Hello Material</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_material.html">Hello Material</a>, <a href="/com/jme3/gde/core/docs/jme3/intermediate/how_to_use_materials.html">How To Use Materials</a>,
</p>
</div>
@ -389,7 +431,7 @@ chaseCam = new ChaseCamera&#40;cam, spatial, inputManager&#41;;</pre>
<div>
<p>
Use Controls to define the behaviour of types of Spatials. Use Application States to implement global behaviour. Use the <code>simpleUpdate()</code> loop for the remaining tests and interactions. Use Cinematics to remote-control objects in scenes.
Use Controls to define the behaviour of types of Spatials. Use Application States to implement global behaviour, to group subsets of input handlers or <acronym title="Graphical User Interface">GUI</acronym> screens, etc. Use the <code>simpleUpdate()</code> and <code>update()</code> loops for tests and interactions. Use Cinematics to remote-control objects in scenes.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html">Hello Loop</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/update_loop.html">Update Loop</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Custom Controls</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">Application States</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/cinematics.html">Cinematics</a>
</p>
@ -411,7 +453,7 @@ Use com.jme3.input.KeyInput and a Input Listener.
<div>
<p>
Players use the mouse to pick up objects, to open doors, to shoot a weapon, etc. Use an Input Listener to respond to mouse clicks, then cast a ray from the player; if it intersect with the bounding volume of a spatial, this is the selected target. The links below contain code samples for both &quot;fixed crosshair&quot; picking and &quot;free mouse pointer&quot; picking.
Players typically click the mouse to pick up objects, to open doors, to shoot a weapon, etc. Use an Input Listener to respond to mouse clicks, then cast a ray from the player; if it intersects with the bounding volume of a spatial, this is the selected target. The links below contain code samples for both &quot;fixed crosshair&quot; picking and &quot;free mouse pointer&quot; picking.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_picking.html">Hello Picking</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/mouse_picking.html">Mouse Picking</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/collision_and_intersection.html">Collision and Intersection</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/input_handling.html">Input Handling</a>, com.jme3.bounding.*, com.jme3.math.Ray, com.jme3.collision.CollisionResults.
<br/>
@ -437,7 +479,7 @@ Create an animated OgreMesh model with bones in a 3-D mesh editor (e.g. Blender)
<div>
<p>
Use collision detection. The most common solution is to use jme&#039;s physics integration.
Use collision detection. The most common solution is to use jme&#039;s physics integration, jBullet.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html">Hello Collision</a>, <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">Physics</a>, com.jme3.bullet.*, CapsuleCollisionShape versus CompoundCollisionShape, CharacterControl versus RigidBodyControl.
</p>
@ -471,7 +513,7 @@ Maybe your collision shapes overlap – or they are not where you think they are
<div>
<p>
Use a CharacterControl that locks the physical object upright, so it does not tip over when moving/walking (as tall physical objects are wont to do).
You can use jBullet&#039;s CharacterControl that locks a physical object upright, so it does not tip over when moving/walking (as tall physical objects are wont to do).
<br/>
<strong>Learn more:</strong> CharacterControl
<br/>
@ -497,7 +539,7 @@ Code samples: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplay
<div>
<p>
Use PhysicsControl&#039;s joints.
Use a PhysicsControl&#039;s hinges and joints.
<br/>
<strong>Learn more:</strong> <a href="/com/jme3/gde/core/docs/jme3/advanced/hinges_and_joints.html">Hinges and Joints</a>, com.jme3.bullet.joints.PhysicsHingeJoint,
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/bullet/TestPhysicsHingeJoint.java"><param name="text" value="<html><u>TestPhysicsHingeJoint.java</u></html>"><param name="textColor" value="blue"></object> (Press HK keys to turn, spacebar to swing.)
@ -767,6 +809,16 @@ Batching means that all Geometries with the same Material are combined into one
</div>
<h3><a>How do I prevent users from unzipping my JAR?</a></h3>
<div>
<p>
Add an <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://netbeans.dzone.com/tips/obfuscating-netbeans-java-appl"><param name="text" value="<html><u>obfuscator to the Ant script</u></html>"><param name="textColor" value="blue"></object>. The <acronym title="Software Development Kit">SDK</acronym> comes with a basic obfuscation script that you can enable in the project settings.
</p>
</div>
<h2><a>I want to do maths</a></h2>
<div>
@ -841,8 +893,11 @@ World coordinates of a Spatial are its absolute coordinates in the 3D scene (thi
<p>
Multiply degree value by FastMath.DEG_TO_RAD to convert it to radians.
</p>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:faq?do=showtag&amp;tag=tag%3Afaq">faq</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:faq?do=export_xhtmlbody">view online version</a></em></p>

@ -4,13 +4,26 @@
<p>
A collection of recommendations and expert tips. Feel free to add your own!
Every milestone of a game development project is made up of phases: Planning, development, testing, and release. Every milestone involves updates to multi-media assets and to code.
</p>
<p>
This &quot;best practices&quot; page is a collection of recommendations and expert tips. Feel free to add your own!
</p>
</div>
<h2><a>Requirements and Planning</a></h2>
<div>
<p>
If you are a beginner, you should first <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.hobbygamedev.com/digests/?page=free"><param name="text" value="<html><u>read some</u></html>"><param name="textColor" value="blue"></object> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://gamasutra.com/"><param name="text" value="<html><u>articles about</u></html>"><param name="textColor" value="blue"></object> game development. We cannot cover all general tips here.
</p>
</div>
<h2><a>Requirements Gathering</a></h2>
<h3><a>Requirements Gathering</a></h3>
<div>
<p>
@ -28,7 +41,7 @@ As a quick overview, answer yourself the following questions:
</li>
<li><div> Game type</div>
<ul>
<li><div> Point of view (camera)? What character(s) does the player control (if any)?</div>
<li><div> Point of view (camera)? What character(s) does the player control? (if applicable)</div>
</li>
<li><div> Time- or turn-based?</div>
</li>
@ -40,18 +53,19 @@ As a quick overview, answer yourself the following questions:
<ul>
<li><div> What is the start state, what is the end state?</div>
</li>
<li><div> What resources does the player manage? How are resources gained, transformed, spent? E.g. speed, gold, health, &quot;points&quot;.</div>
<li><div> What resources does the player manage? How are resources gained, transformed, spent? <br/>
E.g. speed, gold, health, &quot;points&quot;.</div>
</li>
<li><div> How does the player interact? I.e. rules, challenges, game mechanics.</div>
<li><div> How does the player interact? Define rules, challenges, game mechanics.</div>
</li>
<li><div> What state is considered winning, and what losing?</div>
<li><div> What state is considered winning, and what losing, or is it an open world?</div>
</li>
</ul>
</li>
<li><div> Multi-media assets</div>
<ul>
<li><div> Which media will you need? How will you get this content? <br/>
Models, terrains; materials, textures; noises, music, voices; video, cutscenes; spoken/written dialog; level maps, quests, story; AI scripts</div>
E.g. models, terrains; materials, textures; noises, music, voices; video, cutscenes; spoken/written dialog; level maps, quests, story; AI scripts.</div>
</li>
</ul>
</li>
@ -59,9 +73,9 @@ Models, terrains; materials, textures; noises, music, voices; video, cutscenes;
<ul>
<li><div> Can you achieve a high degree of input control? Even minor navigation and interaction glitches make the game unsolvable.</div>
</li>
<li><div> Clearly reflect current status, and changes in game states. E.g. health/damage.</div>
<li><div> Decide how to reflect current status, and changes in game states. E.g. health/damage.</div>
</li>
<li><div> Clearly reward good moves and discourage bad ones.</div>
<li><div> Decide how to reward good moves and discourage bad ones.</div>
</li>
</ul>
</li>
@ -69,7 +83,7 @@ Models, terrains; materials, textures; noises, music, voices; video, cutscenes;
</div>
<h2><a>Planning Development Milestones</a></h2>
<h3><a>Planning Development Milestones</a></h3>
<div>
<p>
@ -78,40 +92,40 @@ Use an <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><pa
</p>
<ol>
<li><div> Pre-Alpha</div>
<ol>
<ul>
<li><div> Artwork: Test asset loading and saving with mock-ups and stock art.</div>
</li>
<li><div> Lay out the overall application flow, i.e. switching between intro / options / game screen, etc.</div>
</li>
<li><div> Get one typical level working. E.g. if the game is a &quot;Jump&#039;n&#039;Run&quot;, jumping and running must work before you can announce Alpha.</div>
</li>
</ol>
</ul>
</li>
<li><div> Alpha Release</div>
<ol>
<ul>
<li><div> Artwork: Replace all mock-ups with first drafts of real media and level maps.</div>
</li>
<li><div> Run alpha tests, track bugs, debug, optimize.</div>
</li>
<li><div> Declare <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Feature_freeze"><param name="text" value="<html><u>Feature Freeze</u></html>"><param name="textColor" value="blue"></object> before you announce Beta. This prevents a bottomless pit of new bugs.</div>
</li>
</ol>
</ul>
</li>
<li><div> Beta Release</div>
<ol>
<ul>
<li><div> Artwork: Fill in the final media and level maps.</div>
</li>
<li><div> Have external people review and &quot;beta test&quot; it (track bugs).</div>
</li>
<li><div> Even out the kinks in code and gameplay – don&#039;t add any more new features.</div>
</li>
</ol>
</ul>
</li>
<li><div> Gamma, Delta = Release Candidates</div>
<ol>
<ul>
<li><div> Test the heck out of it. Last chance to find a horrible bug.</div>
</li>
</ol>
</ul>
</li>
<li><div> Omega = Final Release</div>
</li>
@ -119,8 +133,59 @@ Use an <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><pa
<p>
How you name or number these stages is fully up to you. Development teams use the word milestone, Greek letters, version numbers, or combinations thereof.
Every milestone is made up of a development phase and a test phase. Here are some best practices:
How you name or number these stages is fully up to your team. Development teams use numbered milestones (m1, m2, m3), Greek letters (e.g. alpha, beta, gamma, delta), <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Software_versioning"><param name="text" value="<html><u>&quot;major.minor.patch-build&quot; version</u></html>"><param name="textColor" value="blue"></object> numbering (e.g. &quot;2.7.23-1328&quot;), or combinations thereof.
</p>
</div>
<h3><a>Use File Version Control</a></h3>
<div>
<p>
Whether you work in a team or alone, keeping a version controlled repository of your code will help you roll-back buggy changes, or recover old code that someone deleted and that is now needed again.
</p>
<ul>
<li><div> Treat commit messages as messages to your future self. &quot;Made some changes&quot; is <em>not</em> a commit message.</div>
</li>
<li><div> The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> supports Subversion, Mercurial, and <acronym title="Concurrent Versions System">CVS</acronym>. <br/>
If you don&#039;t know which to choose, Subversion is a good choice for starters.</div>
</li>
<li><div> Set up your own local server, or get free remote hosting space from various open-source dev portals like <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://sourceforge.net/"><param name="text" value="<html><u>Sourceforge</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://github.com/"><param name="text" value="<html><u>Github</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://bitbucket.org/"><param name="text" value="<html><u>bitbucket</u></html>"><param name="textColor" value="blue"></object> (supports private projects), <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://home.java.net/create-project"><param name="text" value="<html><u>Java.net</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://code.google.com"><param name="text" value="<html><u>Google Code</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>Multi-Media Asset Pipeline</a></h2>
<div>
<div><table>
<tr>
<th>DO</th><th>DON&#039;T</th>
</tr>
<tr>
<td> Save original models+textures into <code>assets/Textures</code>. </td><td> Don&#039;t reference textures or models outside your JME project. </td>
</tr>
<tr>
<td> Save sounds into <code>assets/Sounds.</code></td><td> Don&#039;t reference audio files outside your JME project. </td>
</tr>
<tr>
<td> Create simple, low-polygon models. </td><td> Don&#039;t create high-polygon models, they render too slow to be useful in games. </td>
</tr>
<tr>
<td> Only use Diffuse Map, Normal Map, Glow Map, Specular Map. </td><td> Don&#039;t use unsupported material properties that are not listed in the <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a>.</td>
</tr>
<tr>
<td> Use UV texture / texture atlases / baking for each texture map. </td><td> Don&#039;t create models based on multiple separate textures, it will break the model into separate meshes.</td>
</tr>
<tr>
<td> Convert Models to j3o format. Move j3o files into <code>assets/Models</code>. </td><td>Don&#039;t reference Blender/Ogre/OBJ files in your load() code, because these unoptimized files are not packaged into the JAR.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [4358-5244] -->
<p>
Learn details about the <a href="/com/jme3/gde/core/docs/jme3/intermediate/multi-media_asset_pipeline.html">Multi-Media Asset Pipeline</a> here.
</p>
</div>
@ -128,30 +193,51 @@ Every milestone is made up of a development phase and a test phase. Here are som
<h2><a>Development Phase</a></h2>
<div>
<p>
<p><div>Many game developers dream of creating their very own &quot;MMORPG with full-physics, AI, post-rendering effects, multi-player networking, procedurally generated maps, and customizable characters&quot;. So why aren&#039;t there tons of MMORPGs out there? <br/>
Even for large experienced game producers, the creation of such a complex game is time-intensive and failure-prone. How familiar are you with multi-threading, persistance, optimization, client-server synchonization, …? Unless your answer is &quot;very!&quot;, then start with a single-player desktop game, and work your way up – just as the pros did when they started.
</div></p>
</p>
</div>
<h3><a>Where to Start?</a></h3>
<h3><a>Extend SimpleApplication</a></h3>
<div>
<p>
<p><div>Many game developers dream of creating their very own &quot;MMORPG with full-physics, AI, post-rendering effects, multi-player networking, procedurally generated maps, and customizable characters&quot;. So why aren&#039;t there tons of MMORPGs out there? Even for large experienced game producers, the creation of such a complex game is time-intensive and failure-prone. How familiar are you with multi-threading, persistance, optimization, client-server synchonization, …? Unless your answer is &quot;very!&quot;, then start with a single-player desktop game, and work your way up – just as the pros did when they started.
Every jME3 game is centered around one main class that (directly or indirectly) extends com.jme3.app.<a href="/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html">SimpleApplication</a>.
</p>
<p>
<p><div>Note that although the &quot;SimpleApplication&quot; name might be misleading, all jME3 applications, including very large projects, are based on this class. The name only implies that this class is a simple application already. You make it &quot;non-simple&quot; by extending it! ;)
</div></p>
</p>
<p>
For your future game releases, you will want to rely on your own base framework: Your framework extends SimpleApplication, and includes your custom methods for loading, saving, and arranging your scenes, your custom navigation, your inputs for pausing and switching your custom screens, your custom user interface (options screen, HUD, etc), your custom NPC factory, your custom physics properties, your custom networking synchronization, etc. Reusing (extending) your own base framework saves you time. When you update your generic base classes, all your games that extend them benefit from the improvements. Also it will give your games a common look and feel.
</p>
</div>
<h3><a>Where to Start?</a></h3>
<div>
<p>
You have a list of features that you want in game, but which one do you implement first? You will keep adding features to a project that grows more and more complex, how can you minimize the amount of rewriting required?
</p>
<ol>
<li><div> Make sure the game&#039;s high-level frame (screen switching, networking, loading/saving) is sound and solid. </div>
</li>
<li><div> Start with implementing the most complex game feature first – the one that imposes most constraints on the structure of your project (for instance, networking, physics.)</div>
<li><div> Start with implementing the most complex game feature first – the one that imposes most constraints on the structure of your project (for example: networking or physics.)</div>
</li>
<li><div> Add only one larger feature at a time. If there are complex interactions (such as &quot;networking + physics&quot;), start with a small test case (&quot;one cube&quot;) and work your way up, don&#039;t start with a whole scene.</div>
</li>
<li><div> Implement low-complexity details (audio and visual effects) last.</div>
<li><div> Implement low-complexity decorations (audio and visual effects) last.</div>
</li>
<li><div> Test for side-effects on existing code before you add the next feature.</div>
<li><div> Test for side-effects on existing code after you add a feature.</div>
</li>
</ol>
@ -163,126 +249,87 @@ You have a list of features that you want in game, but which one do you implemen
</div>
<h3><a>Extend SimpleApplication</a></h3>
<h3><a>The Smart Way to Add Custom Methods and Fields</a></h3>
<div>
<p>
Extend your custom base class off of jME3&#039;s com.jme3.app.SimpleApplication. For all your games, you will want a customized basic framework: Methods for loading and saving scenes, screen switching (logon/start screen, options, game screen, etc), physics, networking, etc. Then you reuse (extend) your own generic game class when you create any specific game (a racing game, or a space game, a shooter, etc).
Game entities (<code>Nodes</code> and <code>Geometry</code>s) often carry custom fields and custom methods with them. For example, players and NPCs have fields such as <code>health, gold coins, inventory, equipment,</code> etc. We call these fields <strong>user data</strong>. Game entities also have methods that modify user data. Examples include <code>attack(), addGold(), getHealth(), pickUpItem(), dropItem(), useItem(), walk(),</code> etc.
</p>
<p>
Follow these steps:
<strong>Avoid the Anti-Pattern:</strong> You might be tempted to create character classes using Java inheritance: For example, <code>MyMobileNode extends Node</code> and then <code>MyNPC extends MyMobileNode</code>. Then you might create subclasses such as <code>MyFighterNPC extends MyNPC</code> and <code>MyShopKeeperNPC extends MyNPC</code>. But what if you need a group of MyShopKeeperNPCs that fight back? Do you write a MyFightingShopKeeperNPC class, and copy and paste fighting methods from MyFighterNPC? The inheritance approach will soon turn out to be an unmaintainable mess – this is not what you want.
</p>
<p>
<strong>Follow the Best Practice:</strong> You can add user data, accessors, and methods directly to each Spatial.
</p>
<ol>
<li><div> Create a generic library for your own &quot;game development business&quot;:</div>
<ol>
<li><div> Create a jME3-based project MyBaseGame with all necessary JARs on the classpath.</div>
</li>
<li><div> Create a class in this package and name it something like <code>my.company.MyBaseGame.java</code>.</div>
<ol>
<li><div> Make MyBaseGame extend com.jme3.app.SimpleApplication.</div>
</li>
<li><div> Include generic assets (company logo, reusable <acronym title="Graphical User Interface">GUI</acronym> elements in your company style, etc) in the MyBaseGame&#039;s assets directory.</div>
</li>
<li><div> Implement <em>generic</em> game features in the MyBaseGame class: <acronym title="Graphical User Interface">GUI</acronym> (start screen, highscore screen), screen switching and pausing, the in-game HUD, level loading, saving and loading games, AppSettings, the main() method, etc. </div>
</li>
</ol>
</li>
<li><div> Build the project. You get a JAR file, your custom MyBaseGame.jar.</div>
</li>
</ol>
</li>
<li><div> Create your actual game, e.g. a zombie shooter:</div>
<ol>
<li><div> Create a second JME3-based project, MyZombieGame, with all necessary JME3 JARs on the classpath.</div>
</li>
<li><div> Create a package for the game, e.g. <code>my.company.zombieshooter.MyZombieGame.java</code>.</div>
</li>
<li><div> Add MyBaseGame.jar to the classpath of MyZombieGame. You can now re-use you custom generic game library.</div>
<ol>
<li><div> Make MyZombieGame.java extend your MyBaseGame class (which extends SimpleApplication).</div>
<ul>
<li><div> MyZombieGame.java has no main() method because it uses the inherited main() method. </div>
<li><div> Use <a href="/com/jme3/gde/core/docs/jme3/advanced/spatial.html">&#039;&#039;setUserData()&#039;&#039;</a> to add custom fields with user data to Spatials.</div>
</li>
<li><div> MyZombieGame.java makes super calls and overrides the SimpleApplication methods it inherited: <pre> public void simpleInitApp&#40;&#41; &#123; super.simpleInitApp&#40;&#41;; &#125;
public void simpleUpdate&#40;float tpf&#41; &#123; super.simpleUpdate&#40;tpf&#41;; &#125;
public void simpleRender&#40;RenderManager rm&#41; &#123; super.simpleRender&#40;rm&#41;; &#125;</pre>
</div>
<li><div> Use <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Controls</a> to add custom methods (including getters and setters) to Spatials.</div>
</li>
</ul>
</li>
<li><div> Place the specific assets (scenes, models) of this game go into MyZombieGame&#039;s own assets folder.</div>
</li>
<li><div> After the generic super calls, add the specific game code for this game. Now you can implement this specific game&#039;s mechanics and levels using controls and app states, without having to worry about logon&amp;settings screens and all the other generic features that you already dealt with in MyBaseGame.</div>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</div>
<h3><a>The Smart Way to Add Custom Methods and Fields to Nodes</a></h3>
<h3><a>The Smart Way to Access Game Features</a></h3>
<div>
<p>
Game elements (Spatials such as Nodes and Geometrys) often carry custom fields and custom methods with them. For example, players have health, gold coins, an inventory, equipment, etc. You may have methods that modify the player state, such as addGold(), addHealth(), pickUpItem(), dropItem(), wieldItem(), etc.
<a href="/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html">SimpleApplication</a> gives you access to game features such as a the rootNode, assetManager, guiNode, inputManager, audioManager, physicsSpace, viewPort, and the camera. But what if you need access to the assetManager or rootNode etc from another class? Don&#039;t pass around lots of object references in constructors. This is a sign that this class should be designed as an <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">AppState</a> (read details there).
</p>
<p>
<strong>Anti-Pattern:</strong> In Java it&#039;s possible that you extend the Node class to create a custom Node class. But be aware not to get trapped by the following anti-pattern: You might try to create different character nodes with <code>MyMobileNode extends Node</code> and then <code>MyNPC extends MyMobileNode</code>. Then you might continue creating subclasses such as <code>MyCityGuardNPC extends MyNPC</code> and <code>MyShopKeeperNPC extends MyNPC</code>. What do you do now if you need a MyShopKeeperNPC that also fights, do you write a whole new MyFightingShopKeeperNPC class? Inheritance does not help you here.
An AppState has access to all game features in the SimpleApplication via the <code>this.app</code> and <code>this.stateManager</code> objects.
</p>
<p>
Also, extending a Node just to add custom fields to it is unneccesary, because you can store any custom Java objects in Spatials! This user data is accessible where ever the Spatial is accessible. Read the <a href="/com/jme3/gde/core/docs/jme3/advanced/spatial.html">Spatial</a> documentation to learn more about how to use the <code>setUserData()</code> method on Nodes and Geometries.
</p>
Examples:
<p>
In short: Don&#039;t extend Node to implement game mechanics of your entities. Instead:
</p>
<ul>
<li><div> Add <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Custom Controls</a> to supply your Nodes with custom methods!</div>
</li>
<li><div> Use <a href="/com/jme3/gde/core/docs/jme3/advanced/spatial.html">&#039;&#039;setUserData()&#039;&#039;</a> to add custom data fields to Spatials!</div>
</li>
</ul>
<pre>Spatial sky = SkyFactory.createSky&#40;this.app.getAssetManager&#40;&#41;, &quot;sky.dds&quot;, false&#41;;
this.app.getRootNode&#40;&#41;.attachChild&#40; sky &#41;;</pre>
</div>
<h3><a>The Smart Way to Implement Game Logic: Controls and AppStates</a></h3>
<h3><a>The Smart Way to Implement Game Logic</a></h3>
<div>
<p>
As your SimpleApplication-based game grows more advanced, you may find yourself putting more and more tests in the <code>simpleUpdate()</code> loop, passing around lots of object references, and your simpleInitApp() methods grows longer and longer….
</p>
As your SimpleApplication-based game grows more advanced, you find yourself putting more and more interactions in the <code>simpleUpdate()</code> loop, and your <code>simpleInitApp()</code> methods grows longer and longer. It&#039;s a best practice to move blocks of game mechanics into reusable component classes of their own. In jME3, these resuable classes are called <code>Controls</code> and <code>AppStates</code>.
<p>
Move game behaviour into reusable classes of their own. In jME3 these resuable classes are Controls and AppStates.
</p>
<ul>
<li><div> Use <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Controls</a> to implement the <em>behaviour of types of game entities</em>. </div>
<li><div> Use <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">AppStates</a> to implement <em>global game mechanics</em>. </div>
<ul>
<li><div> Controls add a type of behaviour to individual Spatials. </div>
<li><div> Each AppState calls its own <code>initialize()</code> and <code>cleanup()</code> methods when it is attached to or detached from the game. </div>
</li>
<li><div> Each AppState runs its own <code>update()</code> loop that hooks into the main simpleUpdate() loop. </div>
</li>
<li><div> Each Spatial needs its own instance of the Control. One Spatial can be influenced by several Controls. </div>
<li><div> You can specify what happens if an AppState is paused/unpaused.</div>
</li>
<li><div> Use Controls to move code out of the <code>simpleUpdate()</code> loop.</div>
<li><div> You can use an AppState to switch between sets of AppStates.</div>
</li>
<li><div> Examples: An NPC Control that defines how types of enemy Spatials find their way around, a player Control an generic animation control that triggers animations in various types of 3D models, the RigidBodyControl (part of the physics integration), etc.</div>
<li><div> An AppState has access to everything in the SimpleApplication (rootNode, AssetManager, StateManager, InputListener, ViewPort, etc). </div>
</li>
</ul>
</li>
<li><div> Use <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">AppStates</a> to implement <em>global game mechanics</em>. </div>
</ul>
<ul>
<li><div> Use AppStates to move code out of the <code>simpleInitApp()</code> method. </div>
<li><div> Use <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Controls</a> to implement the <em>behaviour of game entities</em>. </div>
<ul>
<li><div> Controls add a type of behaviour (methods and fields) to an individual Spatial (a player, an NPC). </div>
</li>
<li><div> Each Control runs its own <code>controlUpdate()</code> loop that hooks into the main <code>simpleUpdate()</code> loop. </div>
</li>
<li><div> Each AppState brings its own set of game states: You write code so that enabling and disabling an AppState activates and deactivates one particular set of class fields, <acronym title="Graphical User Interface">GUI</acronym>, spatials, input handlers, etc. This way you use AppStates to switch between e.g. an InGameState and a MainMenuState.</div>
<li><div> One Spatial can be influenced by several Controls. (!)</div>
</li>
<li><div> Examples: The integrated jBullet physics simulation, an overall artificial intelligence AppState that coordinates cooperating enemies, an in-game AppState that loads the scene and the HUD and activates the in-game input mappings, a main menu AppState that switches input handling (clicks are interpreted differently than in game) and displays buttons and lets the user open highscore and settings screens, etc.</div>
<li><div> Each Spatial needs its own instance of the Control. </div>
</li>
<li><div> A Control only has control over and access to the spatial that it is attached to (and its sub-spatials).</div>
</li>
</ul>
</li>
@ -290,30 +337,15 @@ Move game behaviour into reusable classes of their own. In jME3 these resuable c
<p>
Controls and AppStates can work together:
Controls and AppStates often work together: An AppState can reach up to the application and <code>get</code> all Spatials from the rootNode that carry a specific Control, and perform a global action on them. Example: In BulletPhysics, all physical Spatials that carry RigidBodyControls are steered by the overall BulletAppState.
</p>
<ul>
<li><div> An AppState can reach up to the application and get all Spatials that carry a specific Control, and use this information to perform some global action on them. </div>
</li>
<li><div> Example: Individual physical spatials (carrying RigidBodyControls) that are steered by the overall physics simulation (BulletAppState).</div>
</li>
</ul>
<p>
Both Control and AppState automatically hook into the main update loop.
<p><div>AppStates and Controls are extensions to a SimpleApplication. They are your modular building blocks to build a more complex game. In the ideal case, you move all init/update code into Controls and AppStates, and your simpleInitApp() and simpleUpdate() could end up virtually empty. This powerful and modular approach cleans up your code considerably.
</div></p>
</p>
<ul>
<li><div> Instead of remote controlling all game entities via code in the simpleUpdate() method, you define the desired behaviour in the update() methods <em>inside</em> your custom Controls and AppStates. </div>
</li>
<li><div> Add Controls to Spatials, and AppStates to the application. jME3 automatically triggers their update() methods as part of the main update loop. </div>
</li>
<li><div> This cleans up your main class considerably. In the ideal case, you abstract all interactions into Controls and AppStates, and your simpleInitApp() and simpleUpdate() could even end up being empty. </div>
</li>
</ul>
<p>
Read all about <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Custom Controls</a> and <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">Application States</a> here.
</p>
@ -322,70 +354,13 @@ Read all about <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.ht
<h3><a>Optimize Application Performance</a></h3>
<div>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/intermediate/optimization.html">Optimization</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/multithreading.html">Multithreading</a></div>
</li>
</ul>
</div>
<h3><a>Use an Assets Folder</a></h3>
<div>
<p>
Put your assets into subfolders of your project&#039;s <code>assets</code> directory. This is the default path where the AssetManager looks for files.
</p>
<pre>jMonkeyProjects/MyGame/assets/ # Store assets in subfolders here!
jMonkeyProjects/MyGame/build/ # SDK generates built classes here *
jMonkeyProjects/MyGame/build.xml # Customize Ant build script here
jMonkeyProjects/MyGame/nbproject/ # SDK stores default build.xml and meta data *
jMonkeyProjects/MyGame/dist/ # SDK generates executables here *
jMonkeyProjects/MyGame/src/ # Store Java sources here
jMonkeyProjects/MyGame/test/ # Store test classes here (optional)
(*) managed by jMonkeyEngine SDK, don&#039;t edit</pre>
<ul>
<li><div> Agree on a file and directory naming scheme with the graphic designers.</div>
<ul>
<li><div> Are there assets (models, sound files, …) that will be used interchangeably? Then name or number them in a way so that the developer can swap the assets by swapping part of the path string.</div>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/intermediate/optimization.html">Optimization</a> – how to avoid wasting cycles</div>
</li>
<li><div> Decide on naming standards for naming interactive parts of models (e.g. arms/legs in an animation).</div>
</li>
</ul>
</li>
<li><div> Structure the subfolders of <code>assets</code> in any way that suits the project – but stick with one system.</div>
<ul>
<li><div> Either keep all Textures together with their Ogre meshes in the Model directory.</div>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/multithreading.html">Multithreading</a> – use concurrency, and don&#039;t change the scene graph from outside the update loop.</div>
</li>
<li><div> Or keep the Ogre meshes with their Textures in the Textures directory. (Recommended.)</div>
<li><div> You can add a <a href="/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html">Java Profiler</a> to the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> via Tools → Plugins → Available. The profiler presents statistics on the lifecycle of methods and objects. Performance problems may be caused by just a few methods that take long, or are called too often (try to cache values to avoid this). If object creation and garbage collection counts keep increasing, you are looking at a memory leak.</div>
</li>
</ul>
</li>
<li><div> Place reusable Textures and Materials (the ones that you set programmatically) into the Textures and Materials directory, respectively.</div>
</li>
<li><div> If different types of assets (materials, textures, models) belong together, create a parallel subdirectory structure for them: <code>Textures/vehicles/car/</code>, <code>Materials/vehicles/car/</code>, <code>Models/vehicles/car/</code></div>
</li>
</ul>
<p>
Here is an example of a commonly used directory structure for various file types:
</p>
<pre>jMonkeyProjects/MyGame/assets/Interface/ # .font, .jpg, .png, .xml
jMonkeyProjects/MyGame/assets/MatDefs/ # .j3md
jMonkeyProjects/MyGame/assets/Materials/ # .j3m
jMonkeyProjects/MyGame/assets/Models/ # .j3o
jMonkeyProjects/MyGame/assets/Scenes/ # .j3o
jMonkeyProjects/MyGame/assets/Shaders/ # .j3f, .vert, .frag
jMonkeyProjects/MyGame/assets/Sounds/ # .ogg, .wav
jMonkeyProjects/MyGame/assets/Textures/ # .mesh.xml+.material, .mtl+.obj, .jpg, .png</pre>
<p>
See also: <a href="/com/jme3/gde/core/docs/sdk/asset_packs.html">Asset Packs</a> and <a href="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a>.
</p>
</div>
@ -394,7 +369,7 @@ See also: <a href="/com/jme3/gde/core/docs/sdk/asset_packs.html">Asset Packs</a>
<p>
Here are some tips especially for users who already know jME2. Automatic handling of the Geometric State has improved in jME3, and it is now a best practice to <em>not</em> mess with it.
These tips are especially for users who already know jME2. Automatic handling of the Geometric State has improved in jME3, and it is now a best practice to <em>not</em> mess with it.
</p>
<ul>
<li><div> Do not call updateGeometricState() on anything but the root node!</div>
@ -412,22 +387,14 @@ Here are some tips especially for users who already know jME2. Automatic handlin
<p>
It&#039;s unlikely you will be willing to fully document <em>every</em> class you write. You should at minimum javadoc the most crucial methods/parameters in a meaningful way.
It&#039;s unlikely you will fully document <em>every</em> class you write, we hear you. However, you should at least write meaningful javadoc to provide context for your most crucial methods/parameters.
</p>
<ul>
<li><div> Answer three questions for every crucial method/parameter:</div>
<ul>
<li><div> What is this?</div>
</li>
<li><div> How does it solve its task? (e.g. algorithm used)</div>
</li>
<li><div> In which situation do I want to use this?</div>
</li>
</ul>
<li><div> What is this? How does it solve its task (input, algorithm used, output, side-effects)? </div>
</li>
<li><div> Write down limits (e.g. min/max values) and defaults while you still remember.</div>
</li>
<li><div> Is this optional or required? What are the alternatives? Is this part of a series of steps that are prerequistes? </div>
<li><div> In which situation do I want to use this, is this part of a larger process? Is this step required, or what are the alternatives? </div>
</li>
</ul>
@ -438,108 +405,39 @@ Treat javadoc as messages to your future self. &quot;genNextVal() generates the
</div>
<h3><a>Use File Version Control</a></h3>
<div>
<p>
Whether you work in a team or alone, keeping a version controlled repository of your code will help you roll-back buggy changes, or recover old code that someone deleted and that is now needed again.
</p>
<ul>
<li><div> Treat commit messages as messages to your future self. &quot;Made some changes&quot; is <em>not</em> a commit message.</div>
</li>
<li><div> The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> supports Subversion, Mercurial, and <acronym title="Concurrent Versions System">CVS</acronym>.</div>
<ul>
<li><div> If you don&#039;t know which to choose, Subversion is a good choice for starters.</div>
</li>
<li><div> You can get free project hosting space from various open-source dev portals like <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://sourceforge.net/"><param name="text" value="<html><u>Sourceforge</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://github.com/"><param name="text" value="<html><u>Github</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://bitbucket.org/"><param name="text" value="<html><u>bitbucket</u></html>"><param name="textColor" value="blue"></object>, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://home.java.net/create-project"><param name="text" value="<html><u>Java.net</u></html>"><param name="textColor" value="blue"></object>, or <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://code.google.com"><param name="text" value="<html><u>Google Code</u></html>"><param name="textColor" value="blue"></object>. <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="https://bitbucket.org/"><param name="text" value="<html><u>Bitbucket</u></html>"><param name="textColor" value="blue"></object> supports private projects.</div>
</li>
</ul>
</li>
</ul>
</div>
<h3><a>Convert Models to .j3o Format</a></h3>
<div>
<p>
From the beta on, convert all models and scenes (Ogre mesh and Wavefront and Blender) to jME3&#039;s binary .j3o format. Use the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> for the conversion, and save the .j3o files into the Models directory.
</p>
<ul>
<li><div> .j3o is an optimized format to store part of a jME3 scenegraph. <br/>
It can contain an individual model or a whole scene. Optionally (using the jMonkeyEngine SceneComposer) you can include the model&#039;s physical properties, materials, lights, particle emitters, and audio nodes, in the .j3o file.</div>
</li>
<li><div> If you kept the Ogre mesh together with the textures in the Textures directory during the conversion, the paths are recorded in a way so that you can move the .j3o to another directory, and it will still find its textures.</div>
</li>
<li><div> The default Ant build script copies .j3o / .j3m files and other assets into the distributable JAR automatically.</div>
</li>
<li><div> Important: Other model files however (.mesh.xml, .material, .obj, .mat) are not bundled automatically. You will get a runtime error that a resource was not found if you try to run the JAR with code referring to these files.</div>
</li>
</ul>
<p>
See also: <a href="/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html">Model Loader and Viewer</a>
</p>
</div>
<h2><a>Debugging and Test Phase</a></h2>
<div>
</div>
<h3><a>Test</a></h3>
<div>
<p>
Unit Tests (<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://download.oracle.com/javase/1.4.2/docs/guide/lang/assert.html"><param name="text" value="<html><u>Java Assertions</u></html>"><param name="textColor" value="blue"></object>) have a different status in 3D graphics development than in other types of software. You cannot write any assertions that automatically test whether the rendered image <em>looks</em> correct, or whether interactions are <em>intuitive</em>. Still you should <a href="/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html">create simple test cases</a> for individual game features such as loaders, content generators, effects. Run the test cases now and then to see whether they still work as intended – or whether they are affected by side effects. Keep the test classes in a test directory in the project, but don&#039;t include them in the distribution.
<strong>A <a href="/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html">Java Debugger</a></strong> is included in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>. It allows you to set a break point in your code near the point where an exception happens. Then you step through the execution line by line and watch object and variable states to detect where the bug starts.
</p>
<p>
Quality Assurance (QA) means maintaining a clear list of steps that must always work, and checking them. It will always happen that there are hard-to-find bugs in the gameplay somewhere – but basic tasks such as installing and de-installing, saving and loading, starting/pausing/quitting the game, <em>must work</em>, no excuse. After every milestone, you go through the QA list again, on every supported operating system, and systematically look for regressions or newly introduced bugs.
<strong>Use the <a href="/com/jme3/gde/core/docs/jme3/advanced/logging.html">Logger</a></strong> to print status messages during the development and debugging phase, instead of System.out.println(). The logger can be switched off with one line of code, whereas commenting out all your <code>println()</code>s takes a while.
</p>
<p>
Alpha and Beta Testing means that you ask someone to try to install and run your game. It should be a real user situation, where they are left to figure it out by themselves (you only can include the usual read-me and help docs). Provide the testers with an easy method to report back descriptions of their problems, or why they gave up. Evaluate whether these problems are exceptions or must be fixed for the game to be playable.
<strong>Unit Testing (<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://download.oracle.com/javase/1.4.2/docs/guide/lang/assert.html"><param name="text" value="<html><u>Java Assertions</u></html>"><param name="textColor" value="blue"></object>)</strong> has a different status in 3D graphics development than in other types of software. You cannot write assertions that automatically test whether the rendered image <em>looks</em> correct, or whether interactions are <em>intuitive</em>. Still you should <a href="/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html">create simple test cases</a> for individual game features such as loaders, content generators, effects. Run the test cases now and then to see whether they still work as intended – or whether they are suffering from side-effects. Keep the test classes in a test directory in the project, don&#039;t include them in the distribution.
</p>
</div>
<h3><a>Debug</a></h3>
<div>
<p>
A <a href="/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html">Java Debugger</a> is included in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>. It allows you to set a break point in your code near the point where an exception happens. Then you step through the execution line by line and watch object and variable states to detect where the bug starts.
<strong>Quality Assurance (QA)</strong> means repeatedly checking a certain set of features that must work, but that might be unexpectedly broken as a side-effect. Every game has some crazy bugs somewhere – but basic tasks <em>must work</em>, no excuse. This includes installing and de-installing; saving and loading; changing options; starting, pausing, quitting; basic actions such as walking, fighting, etc. After every milestone, you go through your QA list again and systematically look for regressions or newly introduced bugs. Check the application <em>on every supported operating system and hardware</em> (!) because not all graphic cards support the same features. If you don&#039;t find the obvious bugs, your users will, and carelessness will put them off.
</p>
<p>
Use the <a href="/com/jme3/gde/core/docs/jme3/advanced/logging.html">Logger</a> to print status messages during the development and debugging phase, instead of System.out.println(). The logger can be switched off with one line of code, whereas commenting out your println()s takes a while.
<strong>Alpha and Beta Testing</strong> means that you ask someone to try to install and run your game. It should be a real user situation, where they are left to figure the gameplay out by themselves (you only can include the usual read-me and help docs). Provide the testers with an easy method to report back problems, or why they gave up. Evaluate whether these problems are exceptions or must be fixed for the game to be playable.
</p>
</div>
<h3><a>Enhance Performance</a></h3>
<h2><a>Release Phase</a></h2>
<div>
<p>
You can add a <a href="/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html">Java Profiler</a> to the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> via Tools → Plugins → Available. The profiler presents statistics on the lifecycle of methods and objects. Performance problems may be caused by just a few methods that take long, or are called too often. If object creation and garbage collection counts keep increasing, you are looking at a memory leak.
</p>
</div>
<h2><a>Release Phase</a></h2>
<h3><a>Pre-Release To-Do List</a></h3>
<div>
<p>
<strong>Pre-Release To-Do List</strong>
</p>
<ul>
<li><div> Prepare a web page, advertise, etc</div>
</li>
@ -561,13 +459,18 @@ You can add a <a href="/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.h
</li>
</ul>
</div>
<h3><a>Distributing the Executables</a></h3>
<div>
<p>
<strong>Distributable Executable</strong>
The <a href="/com/jme3/gde/core/docs/sdk/application_deployment.html">jMonkeyEngine SDK helps you with deployment</a>: You specify your branding and deployment options in the Project Properties dialog, and then choose Clean and Build from the context menu. If you use another IDE, then consult the IDE&#039;s documentation.
</p>
<p>
The jMonkeyEngine <a href="/com/jme3/gde/core/docs/sdk.html">SDK</a> helps you with deployment (unless you used another IDE, then consult the IDE&#039;s documentation). Do you want to release your game as WebStart, Desktop JAR, or Applet? Each has its pros and cons.
Decide whether you want to release your game as WebStart, Desktop JAR, or Applet – Each has its pros and cons.
</p>
<div><table>
@ -592,13 +495,17 @@ The jMonkeyEngine <a href="/com/jme3/gde/core/docs/sdk.html">SDK</a> helps you w
</tr>
<tr>
<td>Android <br/>
(.APK)</td><td>Game runs on Android devices</td><td>Android devices do not support post-procesor effects.</td>
(.APK)</td><td>Game runs on Android devices.</td><td>Android devices do not support post-procesor effects.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [21658-22877] -->
<!-- EDIT2 TABLE [18475-19695] -->
<p>
Which ever method you choose, a Java-Application works on the main operating systems: Windows, Mac <acronym title="Operating System">OS</acronym>, Linux, Android.
</p>
<p>
The distribution appears in a newly generated <code>dist</code> directory inside your project directory. These are the files that you upload or burn to CD to distribute to your customers.
</p>

@ -12,71 +12,68 @@
<link rel="pingback" href="http://jmonkeyengine.org/xmlrpc.php" />
<!-- This site is optimized with the Yoast WordPress SEO plugin v1.1.4 - http://yoast.com/wordpress/seo/ -->
<!-- This site is optimized with the Yoast WordPress SEO plugin v1.1.5 - http://yoast.com/wordpress/seo/ -->
<!-- / Yoast WordPress SEO plugin. -->
<link rel="alternate" type="application/rss+xml" title="jMonkeyEngine.org &raquo; Feed" href="http://jmonkeyengine.org/feed/" />
<link rel="alternate" type="application/rss+xml" title="jMonkeyEngine.org &raquo; Comments Feed" href="http://jmonkeyengine.org/comments/feed/" />
<script type="text/javascript">//<![CDATA[
// Google Analytics for WordPress by Yoast v4.2.2 | http://yoast.com/wordpress/google-analytics/
// Google Analytics for WordPress by Yoast v4.2.3 | http://yoast.com/wordpress/google-analytics/
var _gaq = _gaq || [];
_gaq.push(['_setAccount','UA-17652261-1']);
_gaq.push(['_trackPageview'],['_trackPageLoadTime']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
//]]></script>
<link rel='stylesheet' id='gsc_style-css' href='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/css/smoothness/jquery-ui-1.7.3.custom.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='gsc_style_search_bar-css' href='http://www.google.com/cse/style/look/minimalist.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='gsc_style_search_bar_more-css' href='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/css/gsc.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='gsc_style_search_bar_even_more-css' href='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/css/gsc-no-search-button.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='toc_css-css' href='http://jmonkeyengine.org/wp-content/plugins/seo-friendly-table-of-contents/style.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='bpgc_screen-css' href='http://jmonkeyengine.org/wp-content/plugins/bp-group-control/css/screen.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='gsc_style-css' href='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/css/smoothness/jquery-ui-1.7.3.custom.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='gsc_style_search_bar-css' href='http://www.google.com/cse/style/look/minimalist.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='gsc_style_search_bar_more-css' href='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/css/gsc.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='gsc_style_search_bar_even_more-css' href='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/css/gsc-no-search-button.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='toc_css-css' href='http://jmonkeyengine.org/wp-content/plugins/seo-friendly-table-of-contents/style.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='bpgc_screen-css' href='http://jmonkeyengine.org/wp-content/plugins/bp-group-control/css/screen.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='bp-admin-bar-css' href='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-core/css/buddybar.css?ver=20110723' type='text/css' media='all' />
<link rel='stylesheet' id='bp-post-buttons-css-css' href='http://jmonkeyengine.org/wp-content/plugins/bp-post-buttons/include/style/bp_post_buttons.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='bubbleSheets-css' href='http://jmonkeyengine.org/wp-content/plugins/cd-bp-avatar-bubble/_inc/css/css3/bubble-green.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='wp_dlmp_styles-css' href='http://jmonkeyengine.org/wp-content/plugins/download-monitor/page-addon/styles.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='really_simple_share_style-css' href='http://jmonkeyengine.org/wp-content/plugins/really-simple-facebook-twitter-share-buttons/style.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='bp-default-main-css' href='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/default.css?ver=20110921' type='text/css' media='all' />
<link rel='stylesheet' id='bp-jme-1.5-css' href='http://jmonkeyengine.org/wp-content/themes/bp-jme-1.5/style.css?ver=20110921' type='text/css' media='all' />
<link rel='stylesheet' id='bp-default-responsive-css' href='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/responsive.css?ver=20110921' type='text/css' media='all' />
<link rel='stylesheet' id='activity-subscription-style-css' href='http://jmonkeyengine.org/wp-content/plugins/buddypress-group-email-subscription/css/bp-activity-subscription-css.css?ver=3.2.1' type='text/css' media='all' />
<link rel='stylesheet' id='rpx_style-css' href='http://jmonkeyengine.org/wp-content/plugins/rpx/files/stylesheet.css?ver=3.2.1' type='text/css' media='all' />
<script type='text/javascript' src='http://jmonkeyengine.org/wp-includes/js/l10n.js?ver=20101110'></script>
<link rel='stylesheet' id='bplabs-autosuggest-css' href='http://jmonkeyengine.org/wp-content/plugins/bp-labs/beakers/css/jquery.mentions.css?ver=1.0' type='text/css' media='all' />
<link rel='stylesheet' id='bp-default-main-css' href='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/default.css?ver=20120110' type='text/css' media='all' />
<link rel='stylesheet' id='bp-jme-1.5-css' href='http://jmonkeyengine.org/wp-content/themes/bp-jme-1.5/style.css?ver=20120110' type='text/css' media='all' />
<link rel='stylesheet' id='bp-default-responsive-css' href='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/responsive.css?ver=20120110' type='text/css' media='all' />
<link rel='stylesheet' id='bp-post-buttons-css-css' href='http://jmonkeyengine.org/wp-content/plugins/bp-post-buttons/include/style/bp_post_buttons.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='bubbleSheets-css' href='http://jmonkeyengine.org/wp-content/plugins/cd-bp-avatar-bubble/_inc/css/css3/bubble-green.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='wp_dlmp_styles-css' href='http://jmonkeyengine.org/wp-content/plugins/download-monitor/page-addon/styles.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='really_simple_share_style-css' href='http://jmonkeyengine.org/wp-content/plugins/really-simple-facebook-twitter-share-buttons/style.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='rpx_style-css' href='http://jmonkeyengine.org/wp-content/plugins/rpx/files/stylesheet.css?ver=3.3.2' type='text/css' media='all' />
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/emailprotect/EMAILProtect.js?ver=0.8'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
<script type='text/javascript'>try{jQuery.noConflict();}catch(e){};</script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/explanatory-dictionary/javascript/scripts.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/js/gsc.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://www.google.com/jsapi?ver=3.2.1'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-group-control/js/screen.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-post-buttons/include/js/insert_tags.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/buddypress-group-tags/group-tags.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://apis.google.com/js/plusone.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://platform.twitter.com/widgets.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/explanatory-dictionary/javascript/scripts.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/js/gsc.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://www.google.com/jsapi?ver=3.3.2'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-group-control/js/screen.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-post-buttons/include/js/insert_tags.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/buddypress-group-tags/group-tags.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://platform.twitter.com/widgets.js?ver=3.3.2'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var BP_DTheme = {
my_favs: "My Favorites",
accepted: "Accepted",
rejected: "Rejected",
show_all_comments: "Show all comments for this thread",
show_all: "Show all",
comments: "comments",
close: "Close",
view: "View"
};
var BPMentions = {"error1":"Sorry, an error occurred.","error2":"Please try again.","searching":"Searching..."};
/* ]]> */
</script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/global.js?ver=20110921'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/cd-bp-avatar-bubble/_inc/click.min.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/rpx/files/javascript.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-labs/beakers/js/jquery.mentions.js?ver=1.2'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-labs/beakers/js/autosuggest.js?ver=1.0'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var BP_DTheme = {"my_favs":"My Favorites","accepted":"Accepted","rejected":"Rejected","show_all_comments":"Show all comments for this thread","show_all":"Show all","comments":"comments","close":"Close","view":"View","mark_as_fav":"Favorite","remove_fav":"Remove Favorite"};
/* ]]> */
</script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/global.js?ver=20120110'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/cd-bp-avatar-bubble/_inc/click.min.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/rpx/files/javascript.js?ver=3.3.2'></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://jmonkeyengine.org/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://jmonkeyengine.org/wp-includes/wlwmanifest.xml" />
<meta name="generator" content="WordPress 3.2.1" />
<meta name="generator" content="WordPress 3.3.2" />
<link rel="stylesheet" type="text/css" href="http://jmonkeyengine.org/wp-content/plugins/buddypress-group-tags/group-tags.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://jmonkeyengine.org/wp-content/plugins/buddypress-rate-forum-posts/css/rating.css" media="screen" />
@ -97,7 +94,14 @@ var BP_DTheme = {
</style>
<link rel="stylesheet" href="http://jmonkeyengine.org/wp-content/plugins/explanatory-dictionary/css/explanatory-dictionary-style.css" type="text/css" />
<link rel="stylesheet" href="http://jmonkeyengine.org/wp-content/plugins/explanatory-dictionary/css/explanatory-dictionary-style.php" type="text/css" />
<meta name="generator" content="DokuWiki" />
<script type="text/javascript">
window.___gcfg = {lang: "en"};
(function() {
var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;
po.src = "https://apis.google.com/js/plusone.js";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);
})();
</script><meta name="generator" content="DokuWiki" />
<meta name="robots" content="noindex,follow" />
<meta name="date" content="1970-01-01T00:00:00+0000" />
<meta name="keywords" content="jme3,intermediate,headlessserver" />
@ -115,6 +119,8 @@ var BP_DTheme = {
var NS='jme3:intermediate';var JSINFO = {"id":"jme3:intermediate:headlessserver","namespace":"jme3:intermediate"};
//--><!]]></script>
<script type="text/javascript" charset="utf-8" src="/wiki/lib/exe/js.php?tseed=1317166503" ></script>
<link rel='stylesheet' id='achievements-widget-css' href='http://jmonkeyengine.org/wp-content/plugins/achievements/includes/css/widget.css?ver=2.0.6' type='text/css' media='all' />
<link href="http://jmonkeyengine.org/wp-content/plugins/buddypress-twitter/includes/style.css" media="screen" rel="stylesheet" type="text/css"/>
<style type="text/css">
#header { background-image: url(http://jmonkeyengine.org/wp-content/uploads/2011/09/cropped-header-new-4.jpg); }
@ -146,6 +152,9 @@ var NS='jme3:intermediate';var JSINFO = {"id":"jme3:intermediate:headlessserver"
<body>
<script type="text/javascript">//<![CDATA[
(function(){var c=document.body.className;c=c.replace(/no-js/,'js');document.body.className=c;})();
//]]></script>
<div>
<div>
@ -156,10 +165,10 @@ var NS='jme3:intermediate';var JSINFO = {"id":"jme3:intermediate:headlessserver"
<label for="search-terms">Search for:</label>
<input type="text" id="search-terms" name="search-terms" value="" />
<select><option value="wiki">Wiki</option><option value="forums">Forums</option><option value="posts">Blog</option><option value="groups">Groups</option><option value="links">Links</option></select>
<select><option value="wiki">Documentation</option><option value="forums">Topic Titles</option><option value="posts">Blog</option></select>
<input type="submit" name="search-submit" id="search-submit" value="Search" />
<input type="hidden" id="_wpnonce" name="_wpnonce" value="33a049a832" /><input type="hidden" name="_wp_http_referer" value="/com/jme3/gde/core/docs/jme3/intermediate/headlessserver.html" />
<input type="hidden" id="_wpnonce" name="_wpnonce" value="10f6262115" /><input type="hidden" name="_wp_http_referer" value="/com/jme3/gde/core/docs/jme3/intermediate/headlessserver.html" />
</form><!-- #search-form -->
@ -267,6 +276,7 @@ var NS='jme3:intermediate';var JSINFO = {"id":"jme3:intermediate:headlessserver"
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.com/nightly/"><param name="text" value="<html><u>Nightly Builds</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/contact/"><param name="text" value="<html><u>Contact</u></html>"><param name="textColor" value="blue"></object></li>
</ul> </div>
@ -315,7 +325,7 @@ You&#039;ve followed a link to a topic that doesn&#039;t exist yet. If permissio
<div>
<form><div><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="" /><input type="submit" value="Show pagesource" class="button" accesskey="v" title="Show pagesource [V]" /></div></form> <form><div><input type="hidden" name="do" value="revisions" /><input type="submit" value="Old revisions" class="button" accesskey="o" title="Old revisions [O]" /></div></form> </div>
<div>
<form><div><input type="hidden" name="do" value="login" /><input type="hidden" name="sectok" value="62060f0727c9ca5bd95b33fc3276c56a" /><input type="submit" value="Login" class="button" title="Login" /></div></form> <form><div><input type="hidden" name="do" value="index" /><input type="submit" value="Sitemap" class="button" accesskey="x" title="Sitemap [X]" /></div></form> <a><input type="button" class="button" value="Back to top" onclick="window.scrollTo(0, 0)" title="Back to top" /></a>&nbsp;
<form><div><input type="hidden" name="do" value="login" /><input type="hidden" name="sectok" value="3753ba035ed7c95a99863fc877c76d02" /><input type="submit" value="Login" class="button" title="Login" /></div></form> <form><div><input type="hidden" name="do" value="index" /><input type="submit" value="Sitemap" class="button" accesskey="x" title="Sitemap [X]" /></div></form> <a><input type="button" class="button" value="Back to top" onclick="window.scrollTo(0, 0)" title="Back to top" /></a>&nbsp;
</div>
<div></div>
</div-->
@ -357,9 +367,8 @@ You&#039;ve followed a link to a topic that doesn&#039;t exist yet. If permissio
</ul></div></div><!-- #wp-admin-bar -->
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js'></script>
<!-- Generated in 0.265 seconds. (59 q) -->
<!-- Generated in 0.260 seconds. (65 q) -->
<div>
<div></div>
@ -367,6 +376,7 @@ You&#039;ve followed a link to a topic that doesn&#039;t exist yet. If permissio
<span>
<span><img src="http://jmonkeyengine.org/wp-content/plugins/rpx/images/close.png" alt="close" /></span>
<iframe></iframe></span></td></tr></table></div>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-labs/beakers/js/akismet.js?ver=1.0'></script>
</body>

@ -0,0 +1,368 @@
<h1><a>How to Use Materials</a></h1>
<div>
<p>
A Geometry (mesh) is just the shape of the object. jMonkeyEngine cannot render a shape without knowing anything about its surface properties. You need to apply a color or texture to the surface of your Geometries to make them visible. In jMonkeyEngine, colors and textures are represented as Material objects. (An alternative would also be to load a model that includes materials generated by a mesh editor, such as Blender.)
</p>
<ul>
<li><div> All Geometries must have Materials that defines color or texture.</div>
</li>
<li><div> Each Material is based on a Material Definition file. <br/>
Examples of included Material Definitions: Lighting.j3md, Unshaded.j3md</div>
</li>
</ul>
<p>
You want to make the most of your 3D models by specifying good looking material parameters. The developers must be in contact with the graphic designers regarding which of the <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Material properties</a> they intend to use in their 3D models. You must have an understanding what <a href="/com/jme3/gde/core/docs/jme3/terminology#materialstextures.html">texture maps</a> are, to be able to use texture-mapped materials.
</p>
<p>
<p><div>Don&#039;t forget to add a <a href="/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html">Light Source</a> to the scene! All Materials (except &quot;Unshaded&quot; ones) are <strong>invisible</strong> without a light source.
</div></p>
</p>
<p>
If you want more advanced background info: You can learn more about <a href="/com/jme3/gde/core/docs/jme3/advanced/material_definitions.html">Material Definitions</a> in general here. You can find the full list of Material Parameters in the <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Material Definitions Properties</a> overview. The following sections introduce you to the most commonly used cases. You typically initialize Material objects in the <code>initSimpleApp()</code> method, and configure them using the setters described here. Then load the Materials using <code>myGeometry.setMaterial(mat)</code>.
</p>
</div>
<h2><a>Code Sample</a></h2>
<div>
<p>
The following samples assume that you loaded a Geometry called myGeometry, and want to assign a material to it.
</p>
<p>
This example creates a simple unshaded blue material: Use it for abstract objects that need no illumination/shading, e.g. sky, <acronym title="Graphical User Interface">GUI</acronym> and billboard nodes, tiles/cards, or toons.
</p>
<pre>Spatial myGeometry = assetManager.loadModel&#40;&quot;Models/Teapot/Teapot.j3o&quot;&#41;;
Material mat = new Material&#40;assetManager, // Create new material and...
&quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;; // ... specify .j3md file to use (unshaded).
mat.setColor&#40;&quot;Color&quot;, ColorRGBA.Blue&#41;; // Set some parameters, e.g. blue.
myGeometry.setMaterial&#40;mat&#41;; // Use new material on this Geometry.</pre>
<p>
This example creates a <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Phong_reflection_model"><param name="text" value="<html><u>Phong</u></html>"><param name="textColor" value="blue"></object>-illuminated blue material. Use it for illuminated, naturalistic objects, such as characters, buildings, terrains, vehicles. Needs a light source, otherwise it will be invisible.
</p>
<pre>Spatial myGeometry = assetManager.loadModel&#40;&quot;Models/Teapot/Teapot.j3o&quot;&#41;;
Material mat = new Material&#40;assetManager, // Create new material and...
&quot;Common/MatDefs/Light/Lighting.j3md&quot;&#41;; // ... specify .j3md file to use (illuminated).
mat.setBoolean&#40;&quot;UseMaterialColors&quot;,true&#41;; // Set some parameters, e.g. blue.
mat.setColor&#40;&quot;Ambient&quot;, ColorRGBA.Blue&#41;; // ... color of this object
mat.setColor&#40;&quot;Diffuse&quot;, ColorRGBA.Blue&#41;; // ... color of light being reflected
myGeometry.setMaterial&#40;mat&#41;; // Use new material on this Geometry.</pre>
<p>
<p><div>Do you reuse Materials? You can <a href="/com/jme3/gde/core/docs/sdk/material_editing.html">store Material properties in a .j3m file</a> and load all properties in one line using
</p>
<pre>myGeometry.setMaterial&#40; assetManager.loadMaterial&#40;&quot;Materials/myMaterial.j3m&quot;&#41;&#41;;</pre>
<p>
</div></p>
</p>
</div>
<h2><a>Colored or Textured</a></h2>
<div>
<p>
Every Material must have at least Material Colors or Textures. Some optional material features also require a combination of both.
</p>
</div>
<h3><a>Colored</a></h3>
<div>
<p>
To give an unshaded material a color:
</p>
<ol>
<li><div> Specify the color property <pre>mat.setColor&#40;&quot;Color&quot;, ColorRGBA.Blue&#41;; // with Unshaded.j3md</pre>
</div>
</li>
</ol>
<p>
To give an Phong-illuminated material a color:
</p>
<ol>
<li><div> Activate material colors: <pre>mat.setBoolean&#40;&quot;UseMaterialColors&quot;,true&#41;; // with Lighting.j3md</pre>
</div>
</li>
<li><div> Specify at least Diffuse and Ambient colors. Set both to the same color in the standard case. <pre>mat.setColor&#40;&quot;Diffuse&quot;, ColorRGBA.Blue &#41;; // with Lighting.j3md
mat.setColor&#40;&quot;Ambient&quot;, ColorRGBA.Blue &#41;; // with Lighting.j3md</pre>
</div>
</li>
</ol>
</div>
<h3><a>Textured</a></h3>
<div>
<p>
To give an unshaded material a texture:
</p>
<ul>
<li><div> Specify at least a ColorMap: <pre>mat.setTexture&#40;&quot;ColorMap&quot;, assetManager.loadTexture&#40;&quot;Textures/monkey.png&quot;&#41;&#41;; // with Unshaded.j3md</pre>
</div>
</li>
</ul>
<p>
To give a Phong-illuminated material a texture:
</p>
<ul>
<li><div> Specify at least the DiffuseMap texture: <pre>mat.setTexture&#40;&quot;DiffuseMap&quot;, assetManager.loadTexture&#40;&quot;Textures/wood_diffuse.png&quot;&#41;&#41;; // with Lighting.j3md</pre>
</div>
</li>
</ul>
<p>
<p><div>It can happen that you load textures at different scales, for example, your blades of grass may look as big as twigs, or your spaceship&#039;s heat tiles may look like small bathroom tiles. Then you need to adjust the texture scale, either bigger (&lt; 1.0f) or smaller (&lt; 1.0f).
</p>
<pre>geometry.scaleTextureCoordinates&#40;new Vector2f&#40;0.5f, 0.5f&#41;&#41;;</pre>
<p>
</div></p>
</p>
<p>
All other Texture Maps or Material settings are optional. If used skillfully, they make your model look really spiffy.
</p>
</div>
<h2><a>(Optional) Bumpy</a></h2>
<div>
<p>
A NormalMap (also called BumpMap) is an extra colored texture that describes the fine bumpy details of the Material surface. E.g. fine cracks, pores, creases, notches. Using a BumpMap is more efficient than trying to shape the mesh to be bumpy.
</p>
<p>
To add a BumpMap (this only makes sense for illuminated Materials):
</p>
<ol>
<li><div> Generate normal vectors information for the Mesh (not for the Geometry!) using <code>com.jme3.util.TangentBinormalGenerator</code>. <pre>TangentBinormalGenerator.generate&#40;mesh&#41;;</pre>
</div>
</li>
<li><div> Specify the <code>NormalMap</code> texture for the Material. <pre>mat.setTexture&#40;&quot;NormalMap&quot;, assetManager.loadTexture&#40;&quot;Textures/wood_normal.png&quot;&#41;&#41;; // with Lighting.j3md</pre>
</div>
</li>
</ol>
<p>
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Bump_mapping"><param name="text" value="<html><u>Learn more about creating and using NormalMaps and BumpMaps here.</u></html>"><param name="textColor" value="blue"></object>
</p>
</div>
<h2><a>(Optional) Shiny</a></h2>
<div>
<p>
To activate Shininess (this only makes sense for illuminated Materials):
</p>
<ol>
<li><div> Specify the <code>Shininess</code> intensity the Material. <br/>
Shininess is a float value between 1 (rough surface with blurry shininess) and 128 (very smooth surface with focused shininess)<pre>mat.setFloat&#40;&quot;Shininess&quot;, 5f&#41;;</pre>
</div>
</li>
<li><div> Activate material colors: <pre>mat.setBoolean&#40;&quot;UseMaterialColors&quot;,true&#41;;</pre>
</div>
</li>
<li><div> Specify the <code>Specular</code> and <code>Diffuse</code> colors of the shiny spot. <br/>
The ColorRGBA value of the light source, often RGBA.White.<pre>mat.setColor&#40;&quot;Specular&quot;,ColorRGBA.White&#41;;
mat.setColor&#40;&quot;Diffuse&quot;,ColorRGBA.White&#41;;</pre>
</div>
</li>
<li><div> (Optional) Specify a <code>SpecularMap</code> texture. <br/>
You optionally hand-draw this grayscale texture to outline in detail where the surface should be more shiny (whiter grays) and where less (blacker grays). If you don&#039;t supply a SpecularMap, the whole material is shiny everywhere. <pre>mat.setTexture&#40;&quot;SpecularMap&quot;, assetManager.loadTexture&#40;&quot;Textures/metal_spec.png&quot;&#41;&#41;; // with Lighting.j3md</pre>
</div>
</li>
</ol>
<p>
To deactivate shininess
</p>
<ul>
<li><div> Set the <code>Specular</code> color to <code>ColorRGBA.Black</code>. Do not just set <code>Shininess</code> to 0.<pre>mat.setFloat&#40;&quot;Shininess&quot;, 0f&#41;;</pre>
</div>
</li>
</ul>
</div>
<h2><a>(Optional) Glow</a></h2>
<div>
<p>
To activate glow:
</p>
<ol>
<li><div> Add one <a href="/com/jme3/gde/core/docs/jme3/advanced/bloom_and_glow.html">BloomFilter PostProcessor</a> in your simpleInitApp() method (only once, it is used by all glowing objects).<pre>FilterPostProcessor fpp=new FilterPostProcessor&#40;assetManager&#41;;
BloomFilter bloom = new BloomFilter&#40;BloomFilter.GlowMode.Objects&#41;;
fpp.addFilter&#40;bloom&#41;;
viewPort.addProcessor&#40;fpp&#41;;</pre>
</div>
</li>
<li><div> Specify a <code>Glow</code> color. <br/>
A ColorRGBA value of your choice, e.g. choose a warm or cold color for different effects, or white for a neutral glow.<pre>mat.setColor&#40;&quot;Glow&quot;,ColorRGBA.White&#41;;</pre>
</div>
</li>
<li><div> (Optional) Specify a <code>GlowMap</code> texture. <br/>
This texture outlines in detail where the DiffuseMap texture glows. If you don&#039;t supply a GlowMap, the whole material glows everwhere. <pre>mat.setTexture&#40;&quot;GlowMap&quot;, assetManager.loadTexture&#40;&quot;Textures/alien_glow.png&quot;&#41;&#41;;</pre>
</div>
</li>
</ol>
<p>
To deactivate glow:
</p>
<ul>
<li><div> Set the <code>Glow</code> color to <code>ColorRGBA.Black</code>.<pre>mat.setFloat&#40;&quot;Glow&quot;, ColorRGBA.Black&#41;;</pre>
</div>
</li>
</ul>
<p>
Learn more about <a href="/com/jme3/gde/core/docs/jme3/advanced/bloom_and_glow.html">Bloom and Glow</a>.
</p>
</div>
<h2><a>(Optional) Transparent</a></h2>
<div>
<p>
Most Material Definitions support an alpha channel to make a model opaque, translucent, or transparent.
</p>
<ul>
<li><div> Alpha=1.0f makes the color opaque (default), </div>
</li>
<li><div> Alpha=0.0f make the color fully transparent</div>
</li>
<li><div> Alpha between 0f and 1f makes the color more or less translucent.</div>
</li>
</ul>
<p>
To make a Geometry transparent or translucent:
</p>
<ol>
<li><div> Specify which areas you want to be transparent or translucent by specifying the alpha channel:</div>
<ul>
<li><div> (For colored Materials) In any RGBA color, the first three are Red-Green-Blue, and the last float is the Alpha channel. For example, to replace ColorRGBA.Red with a translucent red: <pre>mat.setColor&#40;&quot;Color&quot;, new ColorRGBA&#40;1,0,0,0.5f&#41;&#41;;</pre>
</div>
</li>
<li><div> (For textured Materials) Supply an AlphaMap that outlines which areas are transparent. <pre>setTexture&#40;&quot;AlphaMap&quot;, assetManager.loadTexture&#40;&quot;Textures/window_alpha.png&quot;&#41;&#41;;</pre>
</div>
</li>
<li><div> (For textured Materials) If the DiffuseMap has an alpha channel, use: <pre>mat.setBoolean&#40;&quot;UseAlpha&quot;,true&#41;;</pre>
</div>
</li>
</ul>
</li>
<li><div> Specify BlendMode Alpha for the Material. <pre>mat.getAdditionalRenderState&#40;&#41;.setBlendMode&#40;BlendMode.Alpha&#41;;</pre>
</div>
</li>
<li><div> Put the Geometry (not the Material!) in the appropriate render queue</div>
<ul>
<li><div> <pre>geo.setQueueBucket&#40;Bucket.Translucent&#41;;</pre>
</div>
</li>
<li><div> <pre>geo.setQueueBucket&#40;Bucket.Transparent&#41;;</pre>
</div>
</li>
</ul>
</li>
<li><div> (Optional) Specify other material settings.</div>
</li>
</ol>
<div><table>
<tr>
<th>Standard Material Transparency</th><th>Description</th><th>Example</th>
</tr>
<tr>
<td>getAdditionalRenderState().setBlendMode(BlendMode.Off);</td><td>This is the default, no transparency.</td><td>Use for all opaque objects like walls, floors, people…</td>
</tr>
<tr>
<td>getAdditionalRenderState().setBlendMode(BlendMode.Alpha);</td><td>Interpolates the background pixel with the current pixel by using the current pixel&#039;s alpha.</td><td>This is the most commonly used BlendMode for transparency and translucency: Frosted window panes, ice, glass, alpha-blended vegetation textures… </td>
</tr>
<tr>
<td>getAdditionalRenderState().setDepthWrite(false);</td><td>Disables writing of the pixel&#039;s depth value to the depth buffer.</td><td>Deactivate this on Materials if you expect two or more transparent/translucent objects to be obscuring one another, but you want to see through both.</td>
</tr>
<tr>
<td>getAdditionalRenderState().setAlphaTest(true) <br/>
getAdditionalRenderState().setAlphaFallOff(0.5f);</td><td>Enables Alpha Testing and uses an AlphaDiscardThreshold as alpha fall-off value. This means that gradients in the AlphaMap are no longer interpreted as soft translucency, but parts of the texture become either fully opaque or fully transparent. Only pixels above the alpha threshold (e.g. 0.5f) are rendered. </td><td>Activate Alpha Testing for (partially) <strong>transparent</strong> objects such as foliage, hair, etc. <br/>
Deactivate Alpha Testing for gradually <strong>translucent</strong> objects, such as colored glass, smoked glass, ghosts.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [9801-11189] -->
<p>
<p><div>It is possible to load a DiffuseMap texture that has an Alpha channel, and combine it with an underlying Material Color.
</p>
<pre>mat.setBoolean&#40;&quot;UseAlpha&quot;,true&#41;;</pre>
<p>
The Material Color bleeds through the transparent areas of the top-layer DiffuseMap texture. In this case you do not need BlendMode Alpha – because it&#039;s not the whole Material that is transparent, but only one of the texture layers. You use this bleed-through effect, for example, to generate differently colored uniforms, animals, or plants, where each Material uses the same &quot;template&quot; DiffuseMap texture but combines it with a different color.
</div></p>
</p>
</div>
<h2><a>(Optional) Wireframe</a></h2>
<div>
<p>
Additionally to the above settings, you can switch off and on a wireframe rendering of the mesh. Since a wireframe has no faces, this temporarily disables the other Texture Maps.
</p>
<div><table>
<tr>
<th>Material Property</th><th>Description</th><th>Example</th>
</tr>
<tr>
<td>getAdditionalRenderState().setWireframe(true);</td><td>Switch to showing the (textured) Material in wireframe mode. The wireframe optionally uses the Material&#039;s <code>Color</code> value.</td><td>Use wireframes to debug meshes, or for a &quot;matrix&quot; or &quot;holodeck&quot; effect.</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [12043-12328] --><div><span>
<a href="/wiki/doku.php/tag:material?do=showtag&amp;tag=tag%3Amaterial">material</a>,
<a href="/wiki/doku.php/tag:texture?do=showtag&amp;tag=tag%3Atexture">texture</a>,
<a href="/wiki/doku.php/tag:effect?do=showtag&amp;tag=tag%3Aeffect">effect</a>,
<a href="/wiki/doku.php/tag:wireframe?do=showtag&amp;tag=tag%3Awireframe">wireframe</a>,
<a href="/wiki/doku.php/tag:light?do=showtag&amp;tag=tag%3Alight">light</a>,
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:intermediate:how_to_use_materials?do=export_xhtmlbody">view online version</a></em></p>

@ -50,13 +50,14 @@ new direction vector v0</td><td>v0 = p1.substract(p2)</td>
p1, p2, h=0.5f</td><td>the point &quot;halfway&quot; (h=0.5f) between the two points <br/>
new interpolated point p0</td><td>p0 = FastMath.interpolateLinear(h,p1,p2)</td>
</tr>
<tr>
<td>a direction vector, an up vector <br/>
v, up</td><td>A rotation around this up axis towards this direction <br/>
new Quaternion q</td><td>Quaternion q = new Quaternion(); <br/>
q.lookAt(v,up)</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [420-1171] -->
<p>
<br/>
</p>
<div><table>
<!-- EDIT1 TABLE [420-1340] --><div><table>
<tr>
<th>I have…</th><th>I want…</th><th>Formula</th>
</tr>
@ -104,7 +105,7 @@ x and z coordinates</td><td>float x = FastMath.cos(phi)*r; <br/>
float z = FastMath.sin(phi)*r;</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [1175-2269] -->
<!-- EDIT2 TABLE [1342-2436] -->
</div>
<h2><a>Local vs Non-local methods?</a></h2>

@ -0,0 +1,384 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> | jMonkeyEngine.org</title>
<link rel="alternate" type="application/rss+xml" title="jMonkeyEngine.org | Site Wide Activity RSS Feed" href="http://jmonkeyengine.org/activity/feed/" />
<link rel="pingback" href="http://jmonkeyengine.org/xmlrpc.php" />
<!-- This site is optimized with the Yoast WordPress SEO plugin v1.1.5 - http://yoast.com/wordpress/seo/ -->
<!-- / Yoast WordPress SEO plugin. -->
<link rel="alternate" type="application/rss+xml" title="jMonkeyEngine.org &raquo; Feed" href="http://jmonkeyengine.org/feed/" />
<link rel="alternate" type="application/rss+xml" title="jMonkeyEngine.org &raquo; Comments Feed" href="http://jmonkeyengine.org/comments/feed/" />
<script type="text/javascript">//<![CDATA[
// Google Analytics for WordPress by Yoast v4.2.3 | http://yoast.com/wordpress/google-analytics/
var _gaq = _gaq || [];
_gaq.push(['_setAccount','UA-17652261-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
//]]></script>
<link rel='stylesheet' id='gsc_style-css' href='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/css/smoothness/jquery-ui-1.7.3.custom.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='gsc_style_search_bar-css' href='http://www.google.com/cse/style/look/minimalist.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='gsc_style_search_bar_more-css' href='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/css/gsc.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='gsc_style_search_bar_even_more-css' href='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/css/gsc-no-search-button.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='toc_css-css' href='http://jmonkeyengine.org/wp-content/plugins/seo-friendly-table-of-contents/style.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='bpgc_screen-css' href='http://jmonkeyengine.org/wp-content/plugins/bp-group-control/css/screen.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='bp-admin-bar-css' href='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-core/css/buddybar.css?ver=20110723' type='text/css' media='all' />
<link rel='stylesheet' id='bplabs-autosuggest-css' href='http://jmonkeyengine.org/wp-content/plugins/bp-labs/beakers/css/jquery.mentions.css?ver=1.0' type='text/css' media='all' />
<link rel='stylesheet' id='bp-default-main-css' href='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/default.css?ver=20120110' type='text/css' media='all' />
<link rel='stylesheet' id='bp-jme-1.5-css' href='http://jmonkeyengine.org/wp-content/themes/bp-jme-1.5/style.css?ver=20120110' type='text/css' media='all' />
<link rel='stylesheet' id='bp-default-responsive-css' href='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/css/responsive.css?ver=20120110' type='text/css' media='all' />
<link rel='stylesheet' id='bp-post-buttons-css-css' href='http://jmonkeyengine.org/wp-content/plugins/bp-post-buttons/include/style/bp_post_buttons.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='bubbleSheets-css' href='http://jmonkeyengine.org/wp-content/plugins/cd-bp-avatar-bubble/_inc/css/css3/bubble-green.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='wp_dlmp_styles-css' href='http://jmonkeyengine.org/wp-content/plugins/download-monitor/page-addon/styles.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='really_simple_share_style-css' href='http://jmonkeyengine.org/wp-content/plugins/really-simple-facebook-twitter-share-buttons/style.css?ver=3.3.2' type='text/css' media='all' />
<link rel='stylesheet' id='rpx_style-css' href='http://jmonkeyengine.org/wp-content/plugins/rpx/files/stylesheet.css?ver=3.3.2' type='text/css' media='all' />
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/emailprotect/EMAILProtect.js?ver=0.8'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
<script type='text/javascript'>try{jQuery.noConflict();}catch(e){};</script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/explanatory-dictionary/javascript/scripts.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/google-custom-search/js/gsc.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://www.google.com/jsapi?ver=3.3.2'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-group-control/js/screen.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-post-buttons/include/js/insert_tags.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/buddypress-group-tags/group-tags.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://platform.twitter.com/widgets.js?ver=3.3.2'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var BPMentions = {"error1":"Sorry, an error occurred.","error2":"Please try again.","searching":"Searching..."};
/* ]]> */
</script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-labs/beakers/js/jquery.mentions.js?ver=1.2'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-labs/beakers/js/autosuggest.js?ver=1.0'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var BP_DTheme = {"my_favs":"My Favorites","accepted":"Accepted","rejected":"Rejected","show_all_comments":"Show all comments for this thread","show_all":"Show all","comments":"comments","close":"Close","view":"View","mark_as_fav":"Favorite","remove_fav":"Remove Favorite"};
/* ]]> */
</script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/global.js?ver=20120110'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/cd-bp-avatar-bubble/_inc/click.min.js?ver=3.3.2'></script>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/rpx/files/javascript.js?ver=3.3.2'></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://jmonkeyengine.org/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://jmonkeyengine.org/wp-includes/wlwmanifest.xml" />
<meta name="generator" content="WordPress 3.3.2" />
<link rel="stylesheet" type="text/css" href="http://jmonkeyengine.org/wp-content/plugins/buddypress-group-tags/group-tags.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://jmonkeyengine.org/wp-content/plugins/buddypress-rate-forum-posts/css/rating.css" media="screen" />
<script type="text/javascript">var ajaxurl = "http://jmonkeyengine.org/wp-load.php";</script>
<script type="text/javascript">
var ajax_url = "http://jmonkeyengine.org/wp-admin/admin-ajax.php";
var ajax_image = "http://jmonkeyengine.org/wp-content/plugins/cd-bp-avatar-bubble/_inc/images";
var ajax_delay = "0";
</script>
<style type='text/css'>
.download-info .download-button {
background-image: url(http://jmonkeyengine.org/wp-content/plugins/download-monitor/page-addon/downloadbutton.gif);
}
.download-info .more-button {
background-image: url(http://jmonkeyengine.org/wp-content/plugins/download-monitor/page-addon/morebutton.gif);
}
</style>
<link rel="stylesheet" href="http://jmonkeyengine.org/wp-content/plugins/explanatory-dictionary/css/explanatory-dictionary-style.css" type="text/css" />
<link rel="stylesheet" href="http://jmonkeyengine.org/wp-content/plugins/explanatory-dictionary/css/explanatory-dictionary-style.php" type="text/css" />
<script type="text/javascript">
window.___gcfg = {lang: "en"};
(function() {
var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;
po.src = "https://apis.google.com/js/plusone.js";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);
})();
</script><meta name="generator" content="DokuWiki" />
<meta name="robots" content="noindex,follow" />
<meta name="date" content="1970-01-01T00:00:00+0000" />
<meta name="keywords" content="jme3,intermediate,multi-media_asset_pipelinejme3,intermediate,optimization" />
<link rel="search" type="application/opensearchdescription+xml" href="/wiki/lib/exe/opensearch.php" title="jMonkeyEngine.org" />
<link rel="start" href="/wiki/" />
<link rel="contents" href="/wiki/doku.php/jme3:intermediate:multi-media_asset_pipelinejme3:intermediate:optimization?do=index" title="Sitemap" />
<link rel="alternate" type="application/rss+xml" title="Recent Changes" href="/wiki/feed.php" />
<link rel="alternate" type="application/rss+xml" title="Current Namespace" href="/wiki/feed.php?mode=list&amp;ns=jme3:intermediate:multi-media_asset_pipelinejme3:intermediate" />
<link rel="alternate" type="text/html" title="Plain HTML" href="/wiki/doku.php/jme3:intermediate:multi-media_asset_pipelinejme3:intermediate:optimization?do=export_xhtml" />
<link rel="alternate" type="text/plain" title="Wiki Markup" href="/wiki/doku.php/jme3:intermediate:multi-media_asset_pipelinejme3:intermediate:optimization?do=export_raw" />
<link rel="stylesheet" media="screen" type="text/css" href="/wiki/lib/exe/css.php?t=wp-integration&amp;tseed=1317166503" />
<link rel="stylesheet" media="all" type="text/css" href="/wiki/lib/exe/css.php?s=all&amp;t=wp-integration&amp;tseed=1317166503" />
<link rel="stylesheet" media="print" type="text/css" href="/wiki/lib/exe/css.php?s=print&amp;t=wp-integration&amp;tseed=1317166503" />
<script type="text/javascript" ><!--//--><![CDATA[//><!--
var NS='jme3:intermediate:multi-media_asset_pipelinejme3:intermediate';var JSINFO = {"id":"jme3:intermediate:multi-media_asset_pipelinejme3:intermediate:optimization","namespace":"jme3:intermediate:multi-media_asset_pipelinejme3:intermediate"};
//--><!]]></script>
<script type="text/javascript" charset="utf-8" src="/wiki/lib/exe/js.php?tseed=1317166503" ></script>
<link rel='stylesheet' id='achievements-widget-css' href='http://jmonkeyengine.org/wp-content/plugins/achievements/includes/css/widget.css?ver=2.0.6' type='text/css' media='all' />
<link href="http://jmonkeyengine.org/wp-content/plugins/buddypress-twitter/includes/style.css" media="screen" rel="stylesheet" type="text/css"/>
<style type="text/css">
#header { background-image: url(http://jmonkeyengine.org/wp-content/uploads/2011/09/cropped-header-new-4.jpg); }
#header h1, #header #desc { display: none; }
</style>
<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
<style type="text/css">
/* Janrain Engage plugin dynamic CSS elements */
.rpx_counter {
background-image:url('http://jmonkeyengine.org/wp-content/plugins/rpx/images/bubble-32.png');
}
.rpx_ct_total {
background-image:url('http://jmonkeyengine.org/wp-content/plugins/rpx/images/bubble-short.png');
}
.rpx_size30 {
background-image:url('http://jmonkeyengine.org/wp-content/plugins/rpx/images/rpx-icons30.png');
}
.rpx_size16 {
background-image:url('http://jmonkeyengine.org/wp-content/plugins/rpx/images/rpx-icons16.png');
}
</style>
<meta id="syntaxhighlighteranchor" name="syntaxhighlighter-version" content="3.1.3" />
<script type="text/javascript"> jQuery(document).ready( function() { jQuery("a.confirm").click( function() { if ( confirm( 'Are you sure?' ) ) return true; else return false; }); });</script>
</head>
<body>
<script type="text/javascript">//<![CDATA[
(function(){var c=document.body.className;c=c.replace(/no-js/,'js');document.body.className=c;})();
//]]></script>
<div>
<div>
<div>
<h1><a href="http://jmonkeyengine.org" title="Home">jMonkeyEngine.org</a></h1>
<form action="http://jmonkeyengine.org/search" method="post">
<label for="search-terms">Search for:</label>
<input type="text" id="search-terms" name="search-terms" value="" />
<select><option value="wiki">Documentation</option><option value="forums">Topic Titles</option><option value="posts">Blog</option></select>
<input type="submit" name="search-submit" id="search-submit" value="Search" />
<input type="hidden" id="_wpnonce" name="_wpnonce" value="10f6262115" /><input type="hidden" name="_wp_http_referer" value="/com/jme3/gde/core/docs/jme3:intermediate/multi-media_asset_pipelinejme3/intermediate/optimization.html" />
</form><!-- #search-form -->
</div><!-- .padder -->
</div><!-- #search-bar -->
<div>
<ul><li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/"><param name="text" value="<html><u>Home</u></html>"><param name="textColor" value="blue"></object>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/"><param name="text" value="<html><u>News</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/news-archives/"><param name="text" value="<html><u>News Archives</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/activity/"><param name="text" value="<html><u>Activity</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/members/"><param name="text" value="<html><u>Members</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/legacy-links/"><param name="text" value="<html><u>Links</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/introduction/"><param name="text" value="<html><u>Introduction</u></html>"><param name="textColor" value="blue"></object>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/introduction/"><param name="text" value="<html><u>About</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/introduction/website-manual/"><param name="text" value="<html><u>Website Manual</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/introduction/team/"><param name="text" value="<html><u>Core Team</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/introduction/contributors-handbook/"><param name="text" value="<html><u>Contributing</u></html>"><param name="textColor" value="blue"></object>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/introduction/contributors-handbook/anyones-contribution-guidelines/"><param name="text" value="<html><u>Anyone</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/introduction/contributors-handbook/modelers-contribution-guidelines/"><param name="text" value="<html><u>Modeler</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/introduction/contributors-handbook/web-developers-contribution-guidelines/"><param name="text" value="<html><u>WebDev</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/introduction/contributors-handbook/technical-writers-contribution-guidelines/"><param name="text" value="<html><u>Writer</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/introduction/contributors-handbook/programmers-contribution-guidelines/"><param name="text" value="<html><u>Programmer</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.com"><param name="text" value="<html><u>Product Showcase</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/forums"><param name="text" value="<html><u>Forums</u></html>"><param name="textColor" value="blue"></object>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/forums"><param name="text" value="<html><u>Latest Topics</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/forums-index"><param name="text" value="<html><u>Forums Index</u></html>"><param name="textColor" value="blue"></object></li>
<li><a href="#">Troubleshooting ></a>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/general-2/forum/"><param name="text" value="<html><u>General</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/import-assets/forum/"><param name="text" value="<html><u>Import Assets</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/graphics/forum/"><param name="text" value="<html><u>Graphics</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/effects/forum/"><param name="text" value="<html><u>Effects</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/gui/forum/"><param name="text" value="<html><u>GUI</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/physics/forum/"><param name="text" value="<html><u>Physics</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/sound/forum/"><param name="text" value="<html><u>Sound</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/networking/forum/"><param name="text" value="<html><u>Networking</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/spidermonkey/forum/"><param name="text" value="<html><u>SpiderMonkey</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/terramonkey/forum/"><param name="text" value="<html><u>TerraMonkey</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/jmonkeyplatform/forum/"><param name="text" value="<html><u>jMonkeyPlatform</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
<li><a href="#">Project Relations ></a>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/beta-1-game-contest/forum/"><param name="text" value="<html><u>Beta 1 Game Contest</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/free-announcements/forum/"><param name="text" value="<html><u>Free Announcements</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/user-code-projects/forum/"><param name="text" value="<html><u>User Code &#038; Projects</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/site-project/forum/"><param name="text" value="<html><u>Site &#038; Project Feedback</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/features/forum/"><param name="text" value="<html><u>Feature Discussion</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/general/forum/"><param name="text" value="<html><u>Small Talk</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
<li><a href="#">Development ></a>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/development-discussion-jme3/forum/"><param name="text" value="<html><u>Developers</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/contribution-depot-jme3/forum/"><param name="text" value="<html><u>Contributions</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/documentation-jme3/"><param name="text" value="<html><u>Docs</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/jmonkeyplatform/forum/"><param name="text" value="<html><u>jMonkeyPlatform</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/android/forum/"><param name="text" value="<html><u>Android</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/monkeyzone/forum/"><param name="text" value="<html><u>MonkeyZone</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
<li><a href="#">Legacy jME2 ></a>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/development-discussion-jme2/forum/"><param name="text" value="<html><u>Discussion</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/contribution-depot-jme2/forum/"><param name="text" value="<html><u>Contributions</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/documentation/forum/"><param name="text" value="<html><u>Docs Discussion</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
</ul>
</li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/wiki/doku.php"><param name="text" value="<html><u>Documentation</u></html>"><param name="textColor" value="blue"></object>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/wiki/doku.php"><param name="text" value="<html><u>Installation &#038; Setup</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/wiki/doku.php/jme3#tutorials_for_beginners"><param name="text" value="<html><u>Tutorials &#038; Docs</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/wiki/doku.php/sdk"><param name="text" value="<html><u>SDK Documentation</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.org/wiki/doku.php/jme3:faq"><param name="text" value="<html><u>FAQ</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/javadoc/"><param name="text" value="<html><u>JavaDoc</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/documentation-jme3/forum/"><param name="text" value="<html><u>Docs Discussion</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/tag/projects"><param name="text" value="<html><u>Projects</u></html>"><param name="textColor" value="blue"></object>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/tag/projects"><param name="text" value="<html><u>All Projects</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/tag/game"><param name="text" value="<html><u>Games</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/tag/tool"><param name="text" value="<html><u>Tools</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/tag/oss"><param name="text" value="<html><u>Open Source</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/downloads/"><param name="text" value="<html><u>Downloads</u></html>"><param name="textColor" value="blue"></object>
<ul>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/downloads/"><param name="text" value="<html><u>Download jME3 SDK</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/source/checkout"><param name="text" value="<html><u>SVN Checkout</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/"><param name="text" value="<html><u>GoogleCode</u></html>"><param name="textColor" value="blue"></object></li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.com/nightly/"><param name="text" value="<html><u>Nightly Builds</u></html>"><param name="textColor" value="blue"></object></li>
</ul>
</li>
<li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/contact/"><param name="text" value="<html><u>Contact</u></html>"><param name="textColor" value="blue"></object></li>
</ul> </div>
</div><!-- #header -->
<div>
<div>
<div>
<div>
You are here: <a href="/wiki/doku.php/Documentation" title="Documentation">Documentation</a> &raquo; <a href="/wiki/doku.php/jme3" title="jme3">jme3</a> &raquo; <a href="/wiki/doku.php/jme3:intermediate:documentation" title="jme3:intermediate:documentation">intermediate</a> &raquo; <a href="/wiki/doku.php/jme3:intermediate:multi-media_asset_pipelinejme3:documentation" title="jme3:intermediate:multi-media_asset_pipelinejme3:documentation">multi-media_asset_pipelinejme3</a> &raquo; <a href="/wiki/doku.php/jme3:intermediate:multi-media_asset_pipelinejme3:intermediate:documentation" title="jme3:intermediate:multi-media_asset_pipelinejme3:intermediate:documentation">intermediate</a> &raquo; <a href="/wiki/doku.php/jme3:intermediate:multi-media_asset_pipelinejme3:intermediate:optimization" title="jme3:intermediate:multi-media_asset_pipelinejme3:intermediate:optimization">optimization</a> </div>
<!--div>
<div>
<form><div><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="" /><input type="submit" value="Show pagesource" class="button" accesskey="v" title="Show pagesource [V]" /></div></form> <form><div><input type="hidden" name="do" value="revisions" /><input type="submit" value="Old revisions" class="button" accesskey="o" title="Old revisions [O]" /></div></form> </div>
<div>
<form><div><input type="hidden" name="do" value="recent" /><input type="submit" value="Recent changes" class="button" accesskey="r" title="Recent changes [R]" /></div></form> <form action="/wiki/doku.php/" accept-charset="utf-8"><div><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" class="edit" title="[F]" /><input type="submit" value="Search" class="button" title="Search" /><div></div></div></form>&nbsp;
</div>
<div></div>
</div-->
</div>
<div>
<!-- wikipage start -->
<h1><a>This topic does not exist yet</a></h1>
<div>
<p>
You&#039;ve followed a link to a topic that doesn&#039;t exist yet. If permissions allow, you may create it by using the <code>Create this page</code> button.
</p>
</div>
<!-- wikipage stop -->
</div>
<div>&nbsp;</div>
<div>
<div>Except where otherwise noted, content on this wiki is licensed under the following license:<a href="http://creativecommons.org/licenses/by/3.0/" rel="license">CC Attribution 3.0 Unported</a></div>
<!--div>
<div>
<form><div><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="" /><input type="submit" value="Show pagesource" class="button" accesskey="v" title="Show pagesource [V]" /></div></form> <form><div><input type="hidden" name="do" value="revisions" /><input type="submit" value="Old revisions" class="button" accesskey="o" title="Old revisions [O]" /></div></form> </div>
<div>
<form><div><input type="hidden" name="do" value="login" /><input type="hidden" name="sectok" value="d6e6f4ad6eda45a9c0585b71e13ea8c0" /><input type="submit" value="Login" class="button" title="Login" /></div></form> <form><div><input type="hidden" name="do" value="index" /><input type="submit" value="Sitemap" class="button" accesskey="x" title="Sitemap [X]" /></div></form> <a><input type="button" class="button" value="Back to top" onclick="window.scrollTo(0, 0)" title="Back to top" /></a>&nbsp;
</div>
<div></div>
</div-->
<div>
Trace: </div>
</div>
</div>
<div></div>
</div> <!-- #container -->
<div>
<div>
<p>Proudly powered by <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://wordpress.org"><param name="text" value="<html><u>WordPress</u></html>"><param name="textColor" value="blue"></object> and <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://buddypress.org"><param name="text" value="<html><u>BuddyPress</u></html>"><param name="textColor" value="blue"></object>.</p>
</div>
</div><!-- #footer -->
<div><div><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org"><param name="text" value="<html><u>jMonkeyEngine.org</u></html>"><param name="textColor" value="blue"></object><ul><li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/wp-login.php?redirect_to=http%3A%2F%2Fjmonkeyengine.org"><param name="text" value="<html><u>Log In</u></html>"><param name="textColor" value="blue"></object></li><li><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/register/"><param name="text" value="<html><u>Sign Up</u></html>"><param name="textColor" value="blue"></object></li>
<li>
<a href="#">Visit</a>
<ul>
<li><a href="http://jmonkeyengine.org/members/?random-member" rel="nofollow">Random Member</a></li>
<li><a href="http://jmonkeyengine.org/groups/?random-group" rel="nofollow">Random Group</a></li>
</ul>
</li>
</ul></div></div><!-- #wp-admin-bar -->
<!-- Generated in 0.252 seconds. (65 q) -->
<div>
<div></div>
<table><tr><td>
<span>
<span><img src="http://jmonkeyengine.org/wp-content/plugins/rpx/images/close.png" alt="close" /></span>
<iframe></iframe></span></td></tr></table></div>
<script type='text/javascript' src='http://jmonkeyengine.org/wp-content/plugins/bp-labs/beakers/js/akismet.js?ver=1.0'></script>
</body>
</html>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:intermediate:multi-media_asset_pipelinejme3:intermediate:optimization?do=export_xhtmlbody">view online version</a></em></p>

@ -1,5 +1,5 @@
<h1><a>SimpleApplication and Application</a></h1>
<h1><a>SimpleApplication</a></h1>
<div>
<p>
@ -8,7 +8,12 @@ The base class of the jMonkeyEngine3 is <code>com.jme3.app.SimpleApplication</co
</p>
<p>
SimpleApplication offers standard game features such as a scene graph, input handling, and a fly-by camera. You call app.start() and app.stop() on your game instance to start or quit the application.
SimpleApplication gives you access to standard game features, such as a scene graph (rootNode), an asset manager, a user interface (guiNode), input manager, audio manager, a physics simulation, and a fly-by camera. You call app.start() and app.stop() on your game instance to start or quit the application.
</p>
<p>
<p><div>For each game, you (directly or indirectly) extend SimpleApplication exactly once as the central class. If you need access to any SimpleApplication features from another game class, make the other class extend <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">AbstractAppState</a> (don&#039;t extend SimpleApplication once more).
</div></p>
</p>
<p>
@ -90,7 +95,7 @@ getInputManager()</td><td>Use the <a href="/com/jme3/gde/core/docs/jme3/advanced
getStateManager()</td><td>You use the Application&#039;s state manager to activate <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">AppStates</a>, such as <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">Physics</a>.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [1601-3027] --><div><table>
<!-- EDIT1 TABLE [2024-3450] --><div><table>
<tr>
<th>Application methods</th><th>Purpose</th>
</tr>
@ -114,7 +119,7 @@ Type.Headless – jME application runs its event loop without calculating any vi
Type.OffscreenSurface – jME application view is not shown and no window opens, but everything calculated and cached as bitmap (back buffer) for use by other applications.</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [3029-4215] --><div><table>
<!-- EDIT2 TABLE [3452-4638] --><div><table>
<tr>
<th>Internal class field/method</th><th>Purpose</th>
</tr>
@ -146,7 +151,7 @@ getGuiViewPort()</td><td>The view object for the orthogonal <acronym title="Grap
<td>paused</td><td>Boolean is used only internally during runtime to pause/unpause a game. (You need to implement your own isRunning boolean or so.)</td>
</tr>
</table></div>
<!-- EDIT3 TABLE [4217-5413] -->
<!-- EDIT3 TABLE [4640-5836] -->
</div>
<h2><a>SimpleApplication Class</a></h2>
@ -187,7 +192,7 @@ getGuiNode()</td><td>Attach flat <acronym title="Graphical User Interface">GUI</
getFlyByCamera()</td><td>The default first-person fly-by camera control. This default camera control lets you navigate the 3D scene using the preconfigured WASD and arrow keys and the mouse.</td>
</tr>
</table></div>
<!-- EDIT4 TABLE [5982-6525] --><div><table>
<!-- EDIT4 TABLE [6405-6948] --><div><table>
<tr>
<th>SimpleApplication Method</th><th>Purpose</th>
</tr>
@ -204,7 +209,7 @@ getFlyByCamera()</td><td>The default first-person fly-by camera control. This de
<td>setDisplayStatView(false);</td><td>A default SimpleApplication displays mesh statistics on the screen using the com.jme3.app.StatsView class. The information is valuable during the development and debugging phase, but for the release, you should hide the statistics HUD.</td>
</tr>
</table></div>
<!-- EDIT5 TABLE [6527-7319] --><div><table>
<!-- EDIT5 TABLE [6950-7742] --><div><table>
<tr>
<th>SimpleApplication Interface</th><th>Purpose</th>
</tr>
@ -218,7 +223,7 @@ getFlyByCamera()</td><td>The default first-person fly-by camera control. This de
<td>public void simpleRender(RenderManager rm)</td><td><strong>Optional:</strong> Override this method to implement <em>advanced</em> modifications of the frameBuffer and scene graph.</td>
</tr>
</table></div>
<!-- EDIT6 TABLE [7321-8239] -->
<!-- EDIT6 TABLE [7744-8662] -->
<p>
<p><div>Use <code>app.setShowSettings(true);</code> to present the user with a splashscreen and the built-in display settings dialog when starting the game; or use <code>app.setShowSettings(false);</code> to hide the buil-in screen (in this case, you may want to provide a custom splashscreen and settings panel). Set this boolean before calling <code>app.start()</code> in the <code>main()</code> method of the SimpleApplication. See also <a href="/com/jme3/gde/core/docs/jme3/intermediate/appsettings.html">AppSettings</a>.
@ -243,16 +248,19 @@ The following default navigational input actions are mapped by the default <code
<td>KEY_ESCAPE</td><td>Quits the game by calling <code>app.stop()</code></td>
</tr>
<tr>
<td>KEY_C</td><td>Prints camera position, rotation, and direction to the out stream.</td>
<td>KEY_C</td><td>Debug key: Prints camera position, rotation, and direction to the out stream.</td>
</tr>
<tr>
<td>KEY_M</td><td>Debug key: Prints memory usage stats the out stream.</td>
</tr>
<tr>
<td>KEY_M</td><td>Prints memory usage stats the out stream.</td>
<td>F5</td><td>Hides or shows the statistics the bottom left.</td>
</tr>
</table></div>
<!-- EDIT7 TABLE [8942-9133] -->
<!-- EDIT7 TABLE [9365-9630] -->
<p>
As long as useInput() is true, the default Flyby Cam is active. Then the following so-called &quot;WASD&quot; inputs are additionally available:
As long as the <code>flyCam</code> is enabled, the following so-called &quot;WASD&quot; inputs, including MouseLook, are available:
</p>
<div><table>
@ -299,7 +307,34 @@ As long as useInput() is true, the default Flyby Cam is active. Then the followi
<td>Zoom Out</td><td>AXIS_WHEEL, or scroll mouse wheel forward</td>
</tr>
</table></div>
<!-- EDIT8 TABLE [9271-9882] --><div><span>
<!-- EDIT8 TABLE [9746-10357] -->
</div>
<h2><a>Defaults and Customization</a></h2>
<div>
<p>
By default, a SimpleApplication displays Statistics (<code>new StatsAppState()</code>), has debug output keys configured (<code>new DebugKeysAppState()</code>), and enables the flyCam (<code>new FlyCamAppState()</code>). You can customize which you want to reuse in your SimpleApplication.
</p>
<p>
The following example shows how you can remove one of the default AppStates, in this case, the FlyCamAppState:
</p>
<ul>
<li><div> Either In your application&#039;s contructor, you create the SimpleApplication with only the AppStates you want to keep: <pre>public MyAppliction&#40;&#41; &#123;
super&#40; new StatsAppState&#40;&#41;, new DebugKeysAppState&#40;&#41; &#41;;
&#125;</pre>
</div>
</li>
<li><div> Or in the <code>simpleInitApp()</code> method, you remove the ones you do not want to keep: <pre> public void simpleInitApp&#40;&#41; &#123;
stateManager.detach&#40; stateManager.getState&#40;FlyCamAppState.class&#41;&#41;;
...</pre>
</div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:display?do=showtag&amp;tag=tag%3Adisplay">display</a>,
<a href="/wiki/doku.php/tag:basegame?do=showtag&amp;tag=tag%3Abasegame">basegame</a>,
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,

@ -70,7 +70,7 @@ mkdir HelloJME3/src/hello</pre>
<p>
Next you copy the necessary JAR libraries from the download to your project. You only have to do this set of steps once every time you download a new JME3 build.
Next you copy the necessary JAR libraries from the download to your project. You only have to do this set of steps once every time you download a new JME3 build. For a detailed description of the separate jar files see <a href="/com/jme3/gde/core/docs/jme3/jme3_source_structure#structure_of_jmonkeyengine3_jars.html">this list</a>.
</p>
<pre>mkdir HelloJME3/build
mkdir HelloJME3/lib
@ -188,6 +188,10 @@ You will learn more about the asset manager and how to customize it later. For n
Now follow the <a href="/com/jme3/gde/core/docs/jme3.html">tutorials</a> and write your first jMonkeyEngine game.
</p>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:install?do=showtag&amp;tag=tag%3Ainstall">install</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:simpleapplication_from_the_commandline?do=export_xhtmlbody">view online version</a></em></p>

@ -13,10 +13,11 @@ Before you start, make certain you are familiar with the following concepts and
<div>
<p>
<strong>OpenGL</strong> is the Open Graphics Library, a platform-independent specification for rendering 2D/3D computer graphics. For Java, there are two implementations of OpenGL-based renderers:
</p>
<ol>
<li><div> Lightweight Java Game Library (LWJGL)</div>
<li><div> Lightweight Java Game Library (LWJGL) – jme3 uses lwjgl.</div>
</li>
<li><div> Java OpenGL (JOGL)</div>
</li>
@ -38,9 +39,9 @@ The <strong>jME Context</strong> makes settings, renderer, timer, input and even
<ul>
<li><div> The <strong>jME Display System</strong> is what draws the custom JME window (instead of Java Swing).</div>
</li>
<li><div> The <strong>input system</strong> is what lets you respond to user input via mouse, keyboard, and joystick.</div>
<li><div> The <strong>Input System</strong> is the component that lets you respond to user input: Mouse clicks and movements, keyboard presses, and joystick motions.</div>
</li>
<li><div> The <strong>renderer</strong> is what does all the work of calculating how to draw the 3D scenegraph to the 2D screen.</div>
<li><div> The <strong>Renderer</strong> is what does all the work of calculating how to draw the 3D scenegraph to the 2D screen.</div>
<ul>
<li><div> The <strong>Shader</strong> is a programmable part of the rendering pipeline. The jME3 game engine uses it to offer advanced customizable materials.</div>
</li>
@ -53,116 +54,6 @@ The <strong>jME Context</strong> makes settings, renderer, timer, input and even
<h1><a>Geometry</a></h1>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/intermediate/coordinate-system.png">
</p>
</div>
<h2><a>Coordinates</a></h2>
<div>
<p>
Coordinates represent a location in a coordinate system. Coordinates are relative to the origin at (0,0,0). In 3D space, you need to specify three coordinate values to locate a point: X (right), Y (up), Z (towards you).
In contrast to a vector (which looks similar), a coordinate is a location, not a direction.
</p>
</div>
<h3><a>The Origin</a></h3>
<div>
<p>
The origin is the central point in the 3D world, where the three axes meet. It&#039;s at the coordinates (0,0,0).
</p>
<p>
<strong>Example:</strong> <code>Vector3f origin = new Vector3f( Vector3f.ZERO );</code>
</p>
</div>
<h2><a>Vectors</a></h2>
<div>
<p>
A vector has a length and a direction, like an arrow in 3D space. A vector starts at the origin (0,0,0), and ends at the target coordinate (x,y,z). Backwards directions are expressed with negative values.
</p>
<p>
<strong>Example:</strong> <code>Vector3f v = new Vector3f( 17 , -4 , 0 );</code>
</p>
</div>
<h3><a>Unit Vectors</a></h3>
<div>
<p>
A <em>unit vector</em> is a basic vector with a length of 1 world unit. Since its length is fixed (and it thus can only point at one location anyway), the only interesting thing about this vector is its direction.
</p>
<ul>
<li><div> <code>Vector3f.UNIT_X</code> = ( 1, 0, 0) = right</div>
</li>
<li><div> <code>Vector3f.UNIT_Y</code> = ( 0, 1, 0) = up</div>
</li>
<li><div> <code>Vector3f.UNIT_Z</code> = ( 0, 0, 1) = forwards</div>
</li>
<li><div> <code>Vector3f.UNIT_XYZ</code> = 1 wu diagonal right-up-forewards</div>
</li>
</ul>
<p>
Negate the vegator to change its direction, e.g. (-1, 0, 0) = left.
</p>
</div>
<h3><a>Normalized Vectors</a></h3>
<div>
<p>
A <em>normalized vector</em> is a custom <em>unit vector</em>. A normalized vector is not the same as a <em>(surface) normal vector</em>.
When you normalize a vector, it still has the same direction, but you lose the information where the vector originally pointed.
</p>
<p>
<strong>Example:</strong> You normalize vectors before calculating angles.
</p>
</div>
<h3><a>Surface Normal Vectors</a></h3>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/300px-surface_normal.png">
A surface normal is a vector that is perpendicular (orthogonal) to a plane.
You calculate the Surface Normal by calculating the cross product.
</p>
</div>
<h3><a>Cross Product</a></h3>
<div>
<p>
The cross product is a calculation that you use to find a perpendicular vector (an orthogonal, a &quot;right angle&quot; at 90°).
In 3D space, speaking of an orthogonal only makes sense with respect to a plane. You need two vectors to uniquely define a plane. The cross product of the two vectors, <code>v1 × v2</code>, is a new vector that is perpendicular to this plane. A vector perpendicular to a plane is a called <em>Surface Normal</em>.
</p>
<p>
<strong>Example:</strong> The x unit vector and the y unit vector together define the x/y plane. The vector perpendicular to them is the z axis. JME can calculate that this equation is true: <br/>
<code>( Vector3f.UNIT_X.cross( Vector3f.UNIT_Y ) ).equals( Vector3f.UNIT_Z )</code> == true
</p>
</div>
<h2><a>Polygon, Mesh, Vertex</a></h2>
@ -185,10 +76,6 @@ Every shape is reduced to a number of connected polygons, usually triangles; eve
You create 3D meshes in tools called mesh editors, e.g in Blender. The jMonkeyEngine can load finished meshes (=models) and arrange them to scenes, but it cannot edit the mesh itself.
</p>
<p>
<a href="/com/jme3/gde/core/docs/jme3/math.html">Learn more about 3D maths here.</a>
</p>
</div>
<h1><a>Materials: Color, Lighting/Shading</a></h1>
@ -297,15 +184,17 @@ Textures are part of Materials. In the simplest case, an object could have just
</p>
<p>
The more information you (the game designer) provide additionally to the Color Map, the higher the degree of detail and realism. Whether you want photo-realistic rendering or &quot;toon&quot; rendering (Cel Shading), everything depends on the quality of your materials and texture maps. Modern 3D graphics use several layers of information to describe one material, each layer is a Texture Map.
<p><div>You have no textures? <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://opengameart.org"><param name="text" value="<html><u>Download free textures</u></html>"><param name="textColor" value="blue"></object> (including texture maps) from opengameart.org.
</div></p>
The more information you (the game designer) provide additionally to the Color Map, the higher the degree of detail and realism. Whether you want photo-realistic rendering or &quot;toon&quot; rendering (Cel Shading), everything depends on the quality of your materials and textures. Modern 3D graphics use several layers of information to describe one material, each mapped layer is a texture.
</p>
<p>
<p><div>Got no textures? <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://opengameart.org"><param name="text" value="<html><u>Download free textures from opengameart.org</u></html>"><param name="textColor" value="blue"></object>. Remember to keep the copyright notice together with the textures!
</div></p>
</p>
</div>
<h2><a>Texture Maps</a></h2>
<h2><a>Texture Mapping</a></h2>
<div>
</div>
@ -314,6 +203,7 @@ The more information you (the game designer) provide additionally to the Color M
<div>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
<ul>
@ -321,9 +211,9 @@ The more information you (the game designer) provide additionally to the Color M
</li>
<li><div> The image can have alpha channels for transparency.</div>
</li>
<li><div> <strong>A Color Map is the minimum texture.</strong> You can add texture maps as optional improvements. </div>
<li><div> <strong>A Color Map is the minimum texture.</strong> You can map more textures as optional improvements. </div>
</li>
<li><div> Color Maps are called Diffuse Map in a Phong-illuminated Material, because the map defines the basic colors of light that are diffused by this object.</div>
<li><div> Color Maps are unshaded. The same is called Diffuse Map in a Phong-illuminated material, because this texture defines the basic colors of light that are <em>diffused</em> by this object.</div>
</li>
</ul>
@ -333,6 +223,7 @@ The more information you (the game designer) provide additionally to the Color M
<div>
<p>
Bump maps are used to describe detailed shapes that would be too hard or simply too inefficient to sculpt in a mesh editor. There are two types:
</p>
<ul>
@ -344,7 +235,6 @@ Bump maps are used to describe detailed shapes that would be too hard or simply
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
</div>
@ -366,6 +256,7 @@ Bump maps are used to describe detailed shapes that would be too hard or simply
<div>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
<ul>
@ -373,7 +264,7 @@ Bump maps are used to describe detailed shapes that would be too hard or simply
</li>
<li><div> When you open a Normal Map in an image editor, it looks like a false-color version of the Color Map. Normal maps however are never used for coloring, instead, each the color values encode displacement data of bumps and cracks on the surface. Displacement data is represented by the Surface Normals of the slopes, hence the name.</div>
</li>
<li><div> You cannot draw normal maps by hand, professional designers use software to calculate them off high-quality 3D models. </div>
<li><div> You cannot draw or edit normal maps by hand, professional designers use software to calculate them off high-quality 3D models. You can either buy a professional texture set, or find free collections that include Normal Maps.</div>
</li>
</ul>
@ -383,6 +274,7 @@ Bump maps are used to describe detailed shapes that would be too hard or simply
<div>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
<ul>
@ -390,7 +282,7 @@ Bump maps are used to describe detailed shapes that would be too hard or simply
</li>
<li><div> Start out with a copy of the Diffuse Map in a medium gray that corresponds to the average shininess/dullness of this material. Then add ligher grays for smoother, shinier, more reflective areas; and darker grays for duller, rougher, worn-out areas. The resulting image file looks similar to a grayscale version of the Diffuse Map.</div>
</li>
<li><div> You can use colors in a specular map to create certain reflective effects (fake iridiscence, metallic effect).</div>
<li><div> You can use colors in a Specular map to create certain reflective effects (fake iridiscence, metallic effect).</div>
</li>
</ul>
@ -400,17 +292,22 @@ Bump maps are used to describe detailed shapes that would be too hard or simply
<div>
<p>
<img src="/wiki/lib/exe/fetch.php">
Tiles are a very simple, commonly used type of texture. When texturing a wide area (e.g. walls, floors), you don&#039;t create one huge texture – instead you tile a small texture repeatedly to fill the area.
</p>
<p>
A seamless texture is an image file that has been designed so that it can be used as tiles: The right edge matches the left edge, and the top edge matches the bottom edge. The onlooker cannot easily tell where one starts and the next one ends, thus creating an illusion of a huge texture. The downside is that the tiling becomes painfully obvious when the area is viewed from a distance. Also you cannot use it on more complex models such as characters.
A seamless texture is an image file that has been designed or modified so that it can be used as tiles: The right edge matches the left edge, and the top edge matches the bottom edge. The onlooker cannot easily tell where one starts and the next one ends, thus creating an illusion of a huge texture. The downside is that the tiling becomes painfully obvious when the area is viewed from a distance. Also you cannot use it on more complex models such as characters.
</p>
<p>
See also this tutorial on <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.photoshoptextures.com/texture-tutorials/seamless-textures.htm"><param name="text" value="<html><u>How to make seamless textures in Photoshop</u></html>"><param name="textColor" value="blue"></object>.
</p>
</div>
<h2><a>UV Maps</a></h2>
<h2><a>UV Maps / Texture Atlas</a></h2>
<div>
<p>
@ -419,16 +316,16 @@ A seamless texture is an image file that has been designed so that it can be use
</p>
<p>
Creating a texture for a cube is easy – but what about a character with a face and extremities? For more complex objects, you design the texture in the same ways as a flat sewing pattern: One image file contains the outline of the front, back, and side of the object, next to one another. Specific areas of the flat texture (UV coordinates) map onto certain areas of your 3D model (XYZ coordinates), hence the name UV map. Using UV Maps, one model can have different textures on each side.
Creating a texture for a cube is easy – but what about a character with a face and extremities? For more complex objects, you design the texture in the same ways as a flat sewing pattern: One image file contains the outline of the front, back, and side of the object, next to one another. Specific areas of the flat texture (UV coordinates) map onto certain areas of your 3D model (XYZ coordinates), hence the name UV map. Using UV Maps (also known as Texture Atlas), one model can have different textures on each side. You create one corresponding UV map for each texture.
</p>
<p>
Getting the seams and mappings right is crucial: You must use a graphic tool like Blender to create UV Maps and store the coordinates. It&#039;s worth the while to learn this, UV mapped models look a lot more professional.
Getting the seams and mappings right is crucial: You must use a graphic tool like Blender to create UV Maps (Texture Atlas) and store the coordinates correctly. It&#039;s worth the while to learn this, UV mapped models look a lot more professional.
</p>
</div>
<h2><a>Environment Maps</a></h2>
<h2><a>Environment Mapping</a></h2>
<div>
<p>
@ -437,11 +334,15 @@ Getting the seams and mappings right is crucial: You must use a graphic tool lik
</p>
<p>
Environment Maps are used to create the impression of reflections and refractions. You create a Cube Map to represent your environment, similar to a skybox. (Sphere Maps are possible, but often look distorted.) You give the Cube Map a set of images showing a &quot;360° view&quot; of the completed scene. The renderer uses this as base to texture the reflective surface.
Environment Mapping or Reflection Mapping is used to create the impression of reflections and refractions in real time. It&#039;s faster (but less accurate) than the raytracing methods used in offline rendering applications.
</p>
<p>
Of course the reflected environment is static and not &quot;real&quot;, e.g. the player will not see his avatar&#039;s face reflected, etc. But EnvMaps cause the desired &quot;glass/mirror/water&quot; effect, and are fast enough to render in real usecases.
You create a Cube Map to represent your environment; Sphere Maps are also possible, but often look distorted. Basically you give the environment map a set of images showing a &quot;360° view&quot; of the background scene – very similar to a skybox. The renderer maps the environment on the texture of the reflective surface, which results in an acceptable &quot;glass/mirror/water&quot; effect. Just like a skybox, the reflection map is static, so dynamic things (such as the player walking) are not part of the reflection. (!)
</p>
<p>
See also: <a href="/com/jme3/gde/core/docs/jme3/advanced/water.html">Water</a>.
</p>
</div>
@ -538,6 +439,22 @@ E.g. when the thigh bone moves, the leg is fully affected, the hips joints less
</li>
</ol>
<p>
<p><div>What is the difference between animation (rigging, skinning, keyframes) and transformation (rotation, scaling, moving, &quot;slerp&quot;)?
</p>
<ul>
<li><div> Transformation is simpler than animation. Sometimes, transforming a geometry already makes it look like it is animated: For example, a spinning windmill, a pulsating alien ball of energy, moving rods of a machine. Transformations can be easily done with JME3 methods. </div>
</li>
<li><div> Animations however are more complex and are encoded in a special format (keyframes). They distort the skin of the mesh, and complex series of motions be &quot;recorded&quot; (in external tools) and played (in JME3).</div>
</li>
</ul>
<p>
</div></p>
</p>
</div>
<h2><a>Kinematics</a></h2>
@ -611,6 +528,156 @@ There are lots of resources explaining interesting AI algorithms:
</div>
<h1><a>Math</a></h1>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/intermediate/coordinate-system.png">
</p>
</div>
<h2><a>Coordinates</a></h2>
<div>
<p>
Coordinates represent a location in a coordinate system. Coordinates are relative to the origin at (0,0,0). In 3D space, you need to specify three coordinate values to locate a point: X (right), Y (up), Z (towards you). Similarly, -X (left), -Y (down), -Z (away from you).
In contrast to a vector (which looks similar), a coordinate is a location, not a direction.
</p>
</div>
<h3><a>The Origin</a></h3>
<div>
<p>
The origin is the central point in the 3D world, where the three axes meet. It&#039;s always at the coordinates (0,0,0).
</p>
<p>
<strong>Example:</strong> <code>Vector3f origin = new Vector3f( Vector3f.ZERO );</code>
</p>
</div>
<h2><a>Vectors</a></h2>
<div>
<p>
A vector has a length and a direction, like an arrow in 3D space. A vector starts at a coordinate (x1,y1,z1) or at the origin, and ends at the target coordinate (x2,y2,z2). Backwards directions are expressed with negative values.
</p>
<p>
<strong>Example:</strong>
</p>
<pre>Vector3f v = new Vector3f&#40; 17f , -4f , 0f &#41;; // starts at (0/0/0)
Vector3f v = new Vector3f&#40; 8f , 0f , 33f &#41;.add&#40;new Vector3f&#40; 0f , -2f , -2f &#41;&#41;; // starts at (8/0/33)</pre>
</div>
<h3><a>Unit Vectors</a></h3>
<div>
<p>
A <em>unit vector</em> is a basic vector with a length of 1 world unit. Since its length is fixed (and it thus can only point at one location anyway), the only interesting thing about this vector is its direction.
</p>
<ul>
<li><div> <code>Vector3f.UNIT_X</code> = ( 1, 0, 0) = right</div>
</li>
<li><div> <code>Vector3f.UNIT_Y</code> = ( 0, 1, 0) = up</div>
</li>
<li><div> <code>Vector3f.UNIT_Z</code> = ( 0, 0, 1) = forwards</div>
</li>
<li><div> <code>Vector3f.UNIT_XYZ</code> = 1 wu diagonal right-up-forewards</div>
</li>
</ul>
<p>
Negate the vegator to change its direction, e.g. (-1, 0, 0) = left.
</p>
</div>
<h3><a>Normalized Vectors</a></h3>
<div>
<p>
A <em>normalized vector</em> is a custom <em>unit vector</em>. A normalized vector is not the same as a <em>(surface) normal vector</em>.
When you normalize a vector, it still has the same direction, but you lose the information where the vector originally pointed.
</p>
<p>
<strong>Example:</strong> You normalize vectors before calculating angles.
</p>
</div>
<h3><a>Surface Normal Vectors</a></h3>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/300px-surface_normal.png">
A surface normal is a vector that is perpendicular (orthogonal) to a plane.
You calculate the Surface Normal by calculating the cross product.
</p>
</div>
<h3><a>Cross Product</a></h3>
<div>
<p>
The cross product is a calculation that you use to find a perpendicular vector (an orthogonal, a &quot;right angle&quot; at 90°).
In 3D space, speaking of an orthogonal only makes sense with respect to a plane. You need two vectors to uniquely define a plane. The cross product of the two vectors, <code>v1 × v2</code>, is a new vector that is perpendicular to this plane. A vector perpendicular to a plane is a called <em>Surface Normal</em>.
</p>
<p>
<strong>Example:</strong> The x unit vector and the y unit vector together define the x/y plane. The vector perpendicular to them is the z axis. JME can calculate that this equation is true: <br/>
<code>( Vector3f.UNIT_X.cross( Vector3f.UNIT_Y ) ).equals( Vector3f.UNIT_Z )</code> == true
</p>
</div>
<h3><a>Transformation</a></h3>
<div>
<p>
Transformation means rotating (turning), scaling (resizing), or translating (moving) objects in 3D scenes. 3D engines offer simple methods so you can write code that transforms nodes.
</p>
<p>
Examples: Falling and rotating bricks in 3D Tetris.
</p>
</div>
<h3><a>Slerp</a></h3>
<div>
<p>
Slerp is how we pronounce spherical linear interpolation when we are in a hurry. A slerp is an interpolated transformation that is used as a simple &quot;animation&quot; in 3D engines. You define a start and end state, and the slerp interpolates a constant-speed transition from one state to the other. You can play the motion, pause it at various percentages (values between 0.0 and 1.0), and play it backwards and forwards. <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/javadoc/com/jme3/math/Quaternion.html#slerp(com.jme3.math.Quaternion,%20com.jme3.math.Quaternion,%20float)"><param name="text" value="<html><u>JavaDoc: slerp()</u></html>"><param name="textColor" value="blue"></object>
</p>
<p>
Example: A burning meteorite Geometry slerps from &quot;position p1, rotation r1, scale s1&quot; in the sky down to &quot;p2, r2, s2&quot; into a crater.
</p>
<p>
<a href="/com/jme3/gde/core/docs/jme3/math.html">Learn more about 3D maths here.</a>
</p>
</div>
<h1><a>Game Developer Jargon</a></h1>
<div>
<ul>
@ -618,5 +685,14 @@ There are lots of resources explaining interesting AI algorithms:
</li>
</ul>
</div>
<h1><a>3D graphics Terminology Wiki book</a></h1>
<div>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/User:Jreynaga/Books/3D_Graphics_Terms"><param name="text" value="<html><u>http://en.wikipedia.org/wiki/User:Jreynaga/Books/3D_Graphics_Terms</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:terminology?do=export_xhtmlbody">view online version</a></em></p>

@ -63,9 +63,14 @@ Make your game unique and recognizable:
</ol>
<p>
Your executables are now branded.
</p>
<p>
TODO: where does this info actually show up?
</p>
</div>
<h2><a>Creating the Distributable</a></h2>
@ -305,6 +310,15 @@ jme3-libraries-gui, jme3-libraries-physics, jme3-libraries-video, etc.</div>
<li><div> Clean, Build and Run the project and make sure you have not missed anything.</div>
</li>
</ol>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:deployment?do=showtag&amp;tag=tag%3Adeployment">deployment</a>,
<a href="/wiki/doku.php/tag:android?do=showtag&amp;tag=tag%3Aandroid">android</a>,
<a href="/wiki/doku.php/tag:applet?do=showtag&amp;tag=tag%3Aapplet">applet</a>,
<a href="/wiki/doku.php/tag:webstart?do=showtag&amp;tag=tag%3Awebstart">webstart</a>,
<a href="/wiki/doku.php/tag:desktop?do=showtag&amp;tag=tag%3Adesktop">desktop</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:application_deployment?do=export_xhtmlbody">view online version</a></em></p>

@ -1,5 +1,5 @@
<h1><a>jMonkeyEngine SDK AssetPacks</a></h1>
<h1><a>jMonkeyEngine SDK: AssetPacks</a></h1>
<div>
<p>
@ -146,14 +146,16 @@ You can change the single assets properties in the properties window after you h
</p>
<p>
Supported formats for models are:
Supported formats for models (main files) are:
</p>
<ol>
<li><div> OgreXML</div>
<li><div> OgreXML .mesh.xml / .scene</div>
</li>
<li><div> Wavefront OBJ</div>
<li><div> Wavefront .obj</div>
</li>
<li><div> jMonkeyEngine3 j3o</div>
<li><div> jMonkeyEngine3 .j3o</div>
</li>
<li><div> Blender .blend (unpack textures)</div>
</li>
</ol>
@ -183,6 +185,11 @@ To make sure you can upload, you have to be registered on jmonkeyengine.org and
<li><div> Select the checkbox for online and/or local publishing and press &quot;finish&quot;</div>
</li>
</ol>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:asset?do=showtag&amp;tag=tag%3Aasset">asset</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:asset_packs?do=export_xhtmlbody">view online version</a></em></p>

@ -8,6 +8,7 @@
<div>
<p>
Importing models to any game engine is as important as using them. The quality of the models depends on the abilities of the people who create it and on the tools they use.
Blender is one of the best free tools for creating 3D enviroments. Its high amount of features attract many model designers.
So far jMonkeyEngine used Ogre mesh files to import 3D data. These files were created by the python script that exported data from blender.
@ -259,29 +260,40 @@ If you define animations in your BlenderKey the animations will as well be impor
<p>
Here is the list of how blender features are mapped into jme.
</p>
<ul>
<li><div> Scene → Node</div>
</li>
<li><div> Object → Node</div>
</li>
<li><div> Mesh → List&lt;Geometry&gt; (one mesh can have several materials so that is why a list is needed here)</div>
</li>
<li><div> Lamp → Light</div>
</li>
<li><div> Camera → Camera</div>
</li>
<li><div> Material → Material</div>
</li>
<li><div> Texture → Texture</div>
</li>
<li><div> Curve → Node (with Curve as its mesh)</div>
</li>
<li><div> Surface → Node (surface is transformed to the proper mesh)</div>
</li>
</ul>
<div><table>
<tr>
<th>Blender</th><th>jMonkeyEngine3</th><th>Note</th>
</tr>
<tr>
<td>Scene </td><td>Node</td><td> </td>
</tr>
<tr>
<td>Object </td><td>Node</td><td> </td>
</tr>
<tr>
<td>Mesh </td><td>List&lt;Geometry&gt; </td><td>One mesh can have several materials so that is why a list is needed here.</td>
</tr>
<tr>
<td>Lamp </td><td>Light</td><td> </td>
</tr>
<tr>
<td>Camera </td><td>Camera</td><td> </td>
</tr>
<tr>
<td>Material </td><td>Material</td><td> </td>
</tr>
<tr>
<td>Texture </td><td>Texture</td><td> </td>
</tr>
<tr>
<td>Curve </td><td>Node </td><td>Node with Curve as its mesh</td>
</tr>
<tr>
<td>Surface </td><td>Node </td><td>The surface is transformed to the proper mesh</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [6619-6970] -->
<p>
Using BlenderLoader can allow you to use blend file as your local assets repository.
@ -320,6 +332,12 @@ See also:
<li><div> <a href="/com/jme3/gde/core/docs/sdk/3ds_to_blender_to_jmp.html">3DS to Blender to j3o</a></div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:tool?do=showtag&amp;tag=tag%3Atool">tool</a>,
<a href="/wiki/doku.php/tag:asset?do=showtag&amp;tag=tag%3Aasset">asset</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:blender?do=export_xhtmlbody">view online version</a></em></p>

@ -185,7 +185,7 @@ Choose Windows &gt; Palette to open the context-sensitive Palette. The jMonkeyEn
<p>
Tip: Choose Tools &gt; Add to Palette… from the menu to add your own code snippets to the Palette. (not available yet in alpha build)
Tip: Choose Tools &gt; Add to Palette… from the menu to add your own code snippets to the Palette. (not available yet in beta build)
</p>
</div>
@ -247,6 +247,11 @@ See also
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://netbeans.org/kb/docs/java/editor-codereference.html"><param name="text" value="<html><u>Code Assistance</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:editor?do=showtag&amp;tag=tag%3Aeditor">editor</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:code_editor?do=export_xhtmlbody">view online version</a></em></p>

@ -8,7 +8,8 @@ Debugging, testing and profiling are important parts of the development cycle. T
</p>
<p>
<strong>Note:</strong> Since the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> features by reading the corresponding NetBeans IDE tutorials (in the &quot;see also links&quot;).
<p><div>Since the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> is based on the NetBeans IDE and the NetBeans Platform, you can learn about certain jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> features by reading the corresponding NetBeans IDE tutorials (in the &quot;see also links&quot;).
</div></p>
</p>
</div>
@ -44,7 +45,7 @@ The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> suppor
<p>
<strong>Tip:</strong> Use the Navigate menu to jump from a test to its tested class, and back.
<strong>Tip:</strong> Use the Navigate menu to jump from a test to its tested class, and back!
</p>
</div>
@ -220,11 +221,16 @@ Profiling points are similar to debugger breakpoints: You place them directly in
See also:
</p>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://netbeans.org/kb/docs/java/profiler-profilingpoints.html"><param name="text" value="<html><u>Using Profiling Points</u></html>"><param name="textColor" value="blue"></object></div>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://netbeans.org/kb/docs/java/profiler-intro.html"><param name="text" value="<html><u>Introduction to Profiling Java Applications (netbeans.org)</u></html>"><param name="textColor" value="blue"></object></div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://netbeans.org/kb/docs/java/profiler-intro.html"><param name="text" value="<html><u>Introduction to Profiling Java Applications</u></html>"><param name="textColor" value="blue"></object></div>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://netbeans.org/kb/docs/java/profiler-profilingpoints.html"><param name="text" value="<html><u>Using Profiling Points (netbeans.org)</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:tool?do=showtag&amp;tag=tag%3Atool">tool</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:debugging_profiling_testing?do=export_xhtmlbody">view online version</a></em></p>

@ -94,8 +94,14 @@ Additionally, you can manually override the targets in the <code>*-impl.xml</cod
<p>
Don&#039;t edit the base <code>*-impl.xml</code> files directly, if you deactivate and reactivate a deployment setting, these files are reset, so you have to copy the whole target and its dependencies, else your build script will become invalid when you disable the deployment option.
</p>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:builds?do=showtag&amp;tag=tag%3Abuilds">builds</a>,
<a href="/wiki/doku.php/tag:project?do=showtag&amp;tag=tag%3Aproject">project</a>,
<a href="/wiki/doku.php/tag:deployment?do=showtag&amp;tag=tag%3Adeployment">deployment</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:default_build_script?do=export_xhtmlbody">view online version</a></em></p>

@ -109,6 +109,11 @@ Learn more about NetBeans Plugin Development at <object classid="java:org.netbea
<p>
Also check out this Essential NetBeans Platform Refcard: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://refcardz.dzone.com/refcardz/essential-netbeans-platform"><param name="text" value="<html><u>http://refcardz.dzone.com/refcardz/essential-netbeans-platform</u></html>"><param name="textColor" value="blue"></object>
</p>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:contribute?do=showtag&amp;tag=tag%3Acontribute">contribute</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:development?do=export_xhtmlbody">view online version</a></em></p>

@ -1,8 +1,14 @@
<h1><a>Creating a model importer</a></h1>
<h1><a>jMonkeyEngine SDK: Creating a model importer</a></h1>
<div>
<p>
You can create custom model importers for the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>. The <acronym title="Software Development Kit">SDK</acronym> supports NBM plugins.
</p>
<ol>
<li><div> Create plugin</div>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://platform.netbeans.org/tutorials/nbm-filetype.html"><param name="text" value="<html><u>Create an NBM plugin</u></html>"><param name="textColor" value="blue"></object></div>
</li>
<li><div> Add importer jar file (wrap jar file)</div>
</li>
@ -12,11 +18,12 @@
</li>
<li><div> Implement loadAsset method in DataObject (if necessary, most model formats should load normally via the loader)</div>
</li>
<li><div> Create AssetManagerConfigurator \</div>
<li><div> Create AssetManagerConfigurator </div>
</li>
</ol>
<p>
See also:
</p>
<ul>
@ -25,6 +32,11 @@ See also:
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://platform.netbeans.org/tutorials/nbm-filetype.html"><param name="text" value="<html><u>http://platform.netbeans.org/tutorials/nbm-filetype.html</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:tool?do=showtag&amp;tag=tag%3Atool">tool</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:development:model_loader?do=export_xhtmlbody">view online version</a></em></p>

@ -16,6 +16,12 @@ Note that the creation of a Module Suite is only necessary if you want to upload
</li>
<li><div> Create a new &quot;Module Suite&quot; project (can be any name, this will be your local &quot;collection&quot; of plugins that you create)</div>
</li>
<li><div> If no platform is listed, add one by selecting the <acronym title="Software Development Kit">SDK</acronym> application folder</div>
<ul>
<li><div> Mac users have to right-click the jmonkeyplatform application and select &quot;show contents&quot; and then select the jmonkeyplatform folder under Contents/Resources/</div>
</li>
</ul>
</li>
<li><div> Open the suite, right-click the &quot;Modules&quot; folder and select &quot;Add new..&quot;</div>
</li>
<li><div> For &quot;Project Name&quot; enter an all-lowercase name without spaces like <code>my-library</code></div>

@ -1,9 +1,10 @@
<h1><a>Filters</a></h1>
<h1><a>jMonkeyEngine SDK: Post-Processor Filters</a></h1>
<div>
<p>
The <acronym title="Software Development Kit">SDK</acronym> lets you create a file storing combinations of filters. You can preview the filter settings on a loaded scene in the <acronym title="Software Development Kit">SDK</acronym>. You can load them into your application (add them to the viewPort) to activate a preconfigured set of filters in one step.
Filters are used for scene-wide effects such as glow, fog, blur. The <acronym title="Software Development Kit">SDK</acronym> lets you create a file storing combinations of filters. You can preview the filter settings on a loaded scene in the <acronym title="Software Development Kit">SDK</acronym>. You can load them into your application (add them to the viewPort) to activate your preconfigured set of several filters in one step.
</p>
</div>
@ -85,6 +86,12 @@ To load a filter in a game (that is, to add it to your game&#039;s viewport), ad
</p>
<pre>FilterPostProcessor processor = &#40;FilterPostProcessor&#41; assetManager.loadAsset&#40;&quot;Filters/MyFilter.j3f&quot;&#41;;
viewPort.addProcessor&#40;processor&#41;;</pre>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:effect?do=showtag&amp;tag=tag%3Aeffect">effect</a>,
<a href="/wiki/doku.php/tag:file?do=showtag&amp;tag=tag%3Afile">file</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:filters?do=export_xhtmlbody">view online version</a></em></p>

@ -1,5 +1,5 @@
<h1><a>jMonkeyEngine SDK Log Files</a></h1>
<h1><a>jMonkeyEngine SDK: Log Files</a></h1>
<div>
<p>
@ -38,6 +38,11 @@ The message log contains all paths and <a href="/com/jme3/gde/core/docs/jme3/adv
User Directory = /Users/joemonkey/Library/Application Support/jmonkeyplatform/dev
Installation = /Applications/jmonkeyplatform.app/Contents/Resources/jmonkeyplatform/jmonkeyplatform
...</pre>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:file?do=showtag&amp;tag=tag%3Afile">file</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:log_files?do=export_xhtmlbody">view online version</a></em></p>

@ -1,5 +1,5 @@
<h1><a>The Material Editor</a></h1>
<h1><a>jMonkeyEngine SDK: Material Editor</a></h1>
<div>
<p>
@ -24,6 +24,7 @@ The jMonkeyEngine uses a special Material format, which comes in .j3m files. You
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/sdk/material-editor.png">
</p>
@ -44,17 +45,31 @@ To create new .j3m files in the jMonkeyEngine <acronym title="Software Developme
<p>
You can edit the source of the material, or use the user-friendly visual editor to set the properties of the material. Set the properties to the same values as you would otherwise specify with setters on a Material object in Java code:
</p>
<pre>Material mat_wall = new Material&#40;
assetManager, &quot;Common/MatDefs/Light/Lighting.j3md&quot;&#41;;
mat_wall.setTexture&#40;&quot;DiffuseMap&quot;,
assetManager.loadTexture&#40;&quot;Textures/wall.png&quot;&#41;&#41;;
assetManager.loadTexture&#40;&quot;Textures/wall_diffuse.png&quot;&#41;&#41;;
mat_wall.setTexture&#40;&quot;NormalMap&quot;,
assetManager.loadTexture&#40;&quot;Textures/wall-normals.png&quot;&#41;&#41;;
assetManager.loadTexture&#40;&quot;Textures/wall_normals.png&quot;&#41;&#41;;
mat_wall.setFloat&#40;&quot;Shininess&quot;, 5f&#41;;</pre>
<p>
The source code of the j3m file is always accessible and can be modified in the &quot;source&quot; tab of the editor.
This Java code corresponds to the following .j3m file:
</p>
<pre>Material my brick wall : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
DiffuseMap: Repeat Textures/wall_diffuse.png
NormalMap: Repeat Textures/wall_normals.png
Shininess: 5.0
}
}</pre>
<p>
You can modify the source code of the j3m file in the &quot;source&quot; tab of the Material Editor.
</p>
</div>
@ -63,6 +78,7 @@ The source code of the j3m file is always accessible and can be modified in the
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/sdk/applymaterial.jpg">
</p>
@ -114,6 +130,13 @@ See also
<li><div> <a href="/com/jme3/gde/core/docs/sdk/neotexture.html">Neotexture</a> (Procedural textures)</div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:material?do=showtag&amp;tag=tag%3Amaterial">material</a>,
<a href="/wiki/doku.php/tag:file?do=showtag&amp;tag=tag%3Afile">file</a>,
<a href="/wiki/doku.php/tag:texture?do=showtag&amp;tag=tag%3Atexture">texture</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:material_editing?do=export_xhtmlbody">view online version</a></em></p>

@ -108,6 +108,10 @@ The model is converted to j3o and all necessary files are copied to the project
Note: It is important that you copy the model file and its textures to the correct assets folder before creating the j3o file because the paths for textures (and possibly other things) will be stored as absolute (to the assets folder root) when you convert that model. This means the texture location should not change after the import.
</p>
<p>
Note: If the SceneViewer doesn&#039;t work refer to <a href="/com/jme3/gde/core/docs/sdk/troubleshooting.html">Troubleshooting jMonkeyEngine3 SDK</a>.
</p>
</div>
<h2><a>Working With a Model</a></h2>
@ -162,8 +166,14 @@ You might wonder why jMonkeyEngine <acronym title="Software Development Kit">SDK
<p>
To have a valid jME3 object, the paths to textures and other assets belonging to the model have to be read with the correct, final path that can then be stored in the j3o object. The j3o object will use those paths when it is loaded with the AssetManager and it requires the AssetManager to deliver the assets on those paths, this is why the folder structure while converting has to be the same as when loading.
</p>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:tool?do=showtag&amp;tag=tag%3Atool">tool</a>,
<a href="/wiki/doku.php/tag:asset?do=showtag&amp;tag=tag%3Aasset">asset</a>,
<a href="/wiki/doku.php/tag:scene?do=showtag&amp;tag=tag%3Ascene">scene</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:model_loader_and_viewer?do=export_xhtmlbody">view online version</a></em></p>

@ -250,6 +250,12 @@ Choose samples from the TestChooser and try out the included demos.</div>
<li><div> Feel free to modify the code samples and experiment! If you break something, you can always recreate the packaged samples from the <code>JME3 Tests</code> template.</div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:project?do=showtag&amp;tag=tag%3Aproject">project</a>,
<a href="/wiki/doku.php/tag:deployment?do=showtag&amp;tag=tag%3Adeployment">deployment</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:project_creation?do=export_xhtmlbody">view online version</a></em></p>

@ -1,5 +1,5 @@
<h1><a>jMonkeyEngine SDK -- Scene Composer</a></h1>
<h1><a>jMonkeyEngine SDK: Scene Composer</a></h1>
<div>
<p>
@ -193,6 +193,15 @@ Also note that although it its possible to directly link external model files (O
<li><div> When a scene has been changed, press the &quot;save&quot; button in the main toolbar or press [Ctrl-S] / [Apple-S] to save it.</div>
</li>
</ol>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:scene?do=showtag&amp;tag=tag%3Ascene">scene</a>,
<a href="/wiki/doku.php/tag:node?do=showtag&amp;tag=tag%3Anode">node</a>,
<a href="/wiki/doku.php/tag:asset?do=showtag&amp;tag=tag%3Aasset">asset</a>,
<a href="/wiki/doku.php/tag:light?do=showtag&amp;tag=tag%3Alight">light</a>,
<a href="/wiki/doku.php/tag:effect?do=showtag&amp;tag=tag%3Aeffect">effect</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:scene_composer?do=export_xhtmlbody">view online version</a></em></p>

@ -66,6 +66,13 @@ You open the SceneExplorer by viewing a model (j3o file or other) in the jMonkey
Right-click a Spatial or Node in the SceneExplorer to add other Spatials like ParticleEmitters or Lights, you can also add UserData to a Spatial that can be read during runtime.
</p>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:tool?do=showtag&amp;tag=tag%3Atool">tool</a>,
<a href="/wiki/doku.php/tag:scene?do=showtag&amp;tag=tag%3Ascene">scene</a>,
<a href="/wiki/doku.php/tag:node?do=showtag&amp;tag=tag%3Anode">node</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:scene_explorer?do=export_xhtmlbody">view online version</a></em></p>

@ -1,5 +1,5 @@
<h1><a>Overview</a></h1>
<h1><a>jMonkeyEngine SDK: Terrain Editor</a></h1>
<div>
<p>
@ -216,6 +216,14 @@ When you want to load a scene into your game that has terrain, you have to set t
<pre>TerrainLodControl lodControl = &#40;&#40;Node&#41;terrain&#41;.getControl&#40;TerrainLodControl.class&#41;;
if &#40;lodControl != null&#41;
lodControl.setCamera&#40;getCamera&#40;&#41;&#41;;</pre>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:tool?do=showtag&amp;tag=tag%3Atool">tool</a>,
<a href="/wiki/doku.php/tag:terrain?do=showtag&amp;tag=tag%3Aterrain">terrain</a>,
<a href="/wiki/doku.php/tag:asset?do=showtag&amp;tag=tag%3Aasset">asset</a>,
<a href="/wiki/doku.php/tag:texture?do=showtag&amp;tag=tag%3Atexture">texture</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:terrain_editor?do=export_xhtmlbody">view online version</a></em></p>

@ -8,12 +8,93 @@
<div>
<p>
If jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> cannot find a valid <acronym title="Java Development Kit">JDK</acronym> although you have it installed you have to specify the location manually.
You should install the <acronym title="Java Development Kit">JDK</acronym> (the one from Oracle, not OpenJDK) first, and then the jMonkey <acronym title="Software Development Kit">SDK</acronym>. If jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> cannot find a valid <acronym title="Java Development Kit">JDK</acronym> although you have it installed, then you have to specify the location manually.
</p>
<ol>
<li><div> Go to your jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> installation directory. <br/>
Mac users right-click jMonkeyApplication.app (which actually is a directory) in the Finder and select &quot;Show package contents&quot;. </div>
</li>
<li><div> Navigate to the <code>etc</code> directory. <br/>
Mac users navigate to <code>Contents/Resources/jmonkeyplatform/etc/</code>.</div>
</li>
<li><div> Open the file <code>jmonkeyplatform.conf</code> in a text editor.</div>
</li>
<li><div> Uncomment the following line and enter the path to the <acronym title="Java Development Kit">JDK</acronym>: <pre>jdkhome=&quot;/path/to/jdk&quot;</pre>
</div>
</li>
</ol>
</div>
<h3><a>Preferences and Settings</a></h3>
<div>
<p>
To completely remove and/or reinstall the <acronym title="Software Development Kit">SDK</acronym> it is vital that the settings folder is deleted too. The location can be seen through the &quot;about&quot; menu and is as following for the different <acronym title="Operating System">OS</acronym>&#039;s:
</p>
<ul>
<li><div> Windows: <code>C:\Users\&lt;username&gt;\AppData\Roaming\.jmonkeyplatform</code></div>
</li>
<li><div> Windows (alt): <code>C:\Users\&lt;username&gt;\.jmonkeyplatform\</code></div>
</li>
<li><div> MacOSX: <code>/Users/&lt;username&gt;/Library/Application Support/jmonkeyplatform</code></div>
</li>
<li><div> Ubuntu: <code>/home/&lt;username&gt;/.jmonkeyplatform</code></div>
</li>
</ul>
</div>
<h3><a>Stability / Graphics issues</a></h3>
<div>
<p>
On some Linux and Windows systems, the <acronym title="Software Development Kit">SDK</acronym> might perform unstable and quit with native VM crashes or &quot;x errors&quot;. There are a few things one can try to remedy those issues.
</p>
</div>
<h5><a>Graphics Driver</a></h5>
<div>
<p>
On Windows and Linux make sure you have the latest driver installed. Make sure its the one supplied by the card manufacturer and not just the <acronym title="Operating System">OS</acronym>-default one.
</p>
</div>
<h5><a>Heavyweight Canvas</a></h5>
<div>
<p>
First of all theres the new “OpenGL” settings page in the <acronym title="Software Development Kit">SDK</acronym> global settings where you can enable the &quot;heavyweight&quot; canvas, which solved some issues for some people. The settings panel can be found under Tools→Options on Windows and Linux and in the main menu (or by pressing Apple-Comma) for MacOSX.
</p>
<p>
If you cannot start the <acronym title="Software Development Kit">SDK</acronym>, edit the file <code>config/Preferences/com/jme3/gde/core.properties</code> in the <acronym title="Software Development Kit">SDK</acronym> settings folder (see above). If it doesn&#039;t exist, create the file including all folders. Add the line <code>use_lwjgl_canvas=true</code>. To try OpenGL1 compatibility mode (works for both canvas settings) add <code>use_opengl_1=true</code>.
</p>
</div>
<h5><a>Look and Feel</a></h5>
<div>
<p>
The <acronym title="Operating System">OS</acronym>-built-in look and feel might cause issues, you can change the LAF by using the appropriate command line switch (or add it to the [app folder]/etc/jmonkeyplatform.conf file, without the &quot;- -&quot; prefix).
</p>
<pre>--laf javax.swing.plaf.metal.MetalLookAndFeel</pre>
</div>
<h5><a>Compiz</a></h5>
<div>
<p>
To do that edit the file <code>jmonkeyplatform.conf</code> in the <code>etc</code> directory of your jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> installation location.
Mac users have to right-click the application and select &quot;Show package contents&quot; and then navigate to <code>Contents/Resources/jmonkeyplatform</code>.
Compiz on Linux might cause issues, if you set its rendering quality to &quot;medium&quot; these should go away.
* Appearance→Set Special effects to → “Medium”
</p>
</div>
@ -22,10 +103,16 @@ Mac users have to right-click the application and select &quot;Show package cont
<div>
<p>
For a list of known issues and possible workarounds see the following link:
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/issues/list?can=2&amp;q=label%3AProduct-Platform+Type%3DDefect+&amp;colspec=ID+Type+Status+Component+Priority+Product+Milestone+Owner+Summary&amp;cells=tiles"><param name="text" value="<html><u>List of known issues on googlecode</u></html>"><param name="textColor" value="blue"></object>
</p>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:tool?do=showtag&amp;tag=tag%3Atool">tool</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:faq?do=showtag&amp;tag=tag%3Afaq">faq</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:troubleshooting?do=export_xhtmlbody">view online version</a></em></p>

@ -33,6 +33,12 @@
<li><div> Press &quot;Add Library&quot; and select the &quot;jme3-modified&quot; library</div>
</li>
</ol>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:project?do=showtag&amp;tag=tag%3Aproject">project</a>,
<a href="/wiki/doku.php/tag:builds?do=showtag&amp;tag=tag%3Abuilds">builds</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:use_own_jme?do=export_xhtmlbody">view online version</a></em></p>

@ -1,15 +1,16 @@
<h2><a>Vehicle Creator</a></h2>
<h1><a>jMonkeyEngine SDK: Vehicle Creator</a></h1>
<div>
<p>
Best results when car is facing in z direction (towards you)
Best results when car is facing in z direction (towards you).
</p>
<p>
Usage:
</p>
</div>
<h2><a>Usage</a></h2>
<div>
<ol>
<li><div> Select a j3o that contains a vehicle model and press the vehicle button (or right-click → edit vehicle)</div>
</li>
@ -32,11 +33,22 @@ New wheels will get the current suspension settings, you can edit single wheels
Press the &quot;test vehicle&quot; button to drive the vehicle, use WASD to control, Enter to reset.
</p>
</div>
<h2><a>Known Issues</a></h2>
<div>
<p>
Known Issues: Dont save while testing the vehicle, you will save the location and acceleration info in the j3o.
Don&#039;t save while testing the vehicle, you will save the location and acceleration info in the j3o.
</p>
</div>
<h2><a>Code Sample</a></h2>
<div>
<p>
Code Example to load vehicle:
</p>
@ -49,6 +61,14 @@ physicsSpace.add&#40;control&#41;;
//then use the control to control the vehicle:
control.setPhysicsLocation&#40;new Vector3f&#40;10,2,10&#41;&#41;;
control.accelerate&#40;100&#41;;</pre>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:tool?do=showtag&amp;tag=tag%3Atool">tool</a>,
<a href="/wiki/doku.php/tag:asset?do=showtag&amp;tag=tag%3Aasset">asset</a>,
<a href="/wiki/doku.php/tag:editor?do=showtag&amp;tag=tag%3Aeditor">editor</a>,
<a href="/wiki/doku.php/tag:physics?do=showtag&amp;tag=tag%3Aphysics">physics</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:vehicle_creator?do=export_xhtmlbody">view online version</a></em></p>

@ -100,8 +100,6 @@ You and your team mates check out (download) the repository to their individual
<p>
<br/>
Of course you can also check out existing repositories and access code from other open-source projects (e.g. SourceForge, GoogleCode, dev.java.net).
</p>
@ -195,8 +193,6 @@ If you do not use any version control, you can still track changes in projects t
</ul>
<p>
<br/>
See also:
</p>
@ -204,6 +200,12 @@ See also:
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://netbeans.org/kb/docs/ide/subversion.html"><param name="text" value="<html><u>Source Code Management with Subversion</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:documentation?do=showtag&amp;tag=tag%3Adocumentation">documentation</a>,
<a href="/wiki/doku.php/tag:sdk?do=showtag&amp;tag=tag%3Asdk">sdk</a>,
<a href="/wiki/doku.php/tag:editor?do=showtag&amp;tag=tag%3Aeditor">editor</a>,
<a href="/wiki/doku.php/tag:tool?do=showtag&amp;tag=tag%3Atool">tool</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:version_control?do=export_xhtmlbody">view online version</a></em></p>

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save