- update help sets
- add missing help pages to wiki_help.properties

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9075 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 1cede40383
commit 752ef87720
  1. 85
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/3d_models.html
  2. 354
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/animation.html
  3. 381
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/appstatesdemo.html
  4. 84
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio.html
  5. 147
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio_environment_presets.html
  6. 250
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bloom_and_glow.html
  7. 47
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bullet_multithreading.html
  8. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bump-mapped-sphere.png
  9. 12
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/camera.html
  10. 652
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/capture_audio_video_to_a_file.html
  11. 384
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/cinematics.html
  12. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/collision_and_intersection.html
  13. 40
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/combo_moves.html
  14. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/drop-shadows.png
  15. 201
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html
  16. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/elephant-pointlights.png
  17. 49
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/fade.html
  18. 96
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/hinges_and_joints.html
  19. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/house-directionallight.png
  20. 36
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html
  21. 22
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/jme3_shaders.html
  22. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/light-sources.png
  23. 255
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html
  24. 75
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/loading_screen.html
  25. 134
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/localization.html
  26. 65
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/logging.html
  27. 77
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/making_the_camera_follow_a_character.html
  28. 353
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html
  29. 113
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/motionpath.html
  30. 43
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/mouse_picking.html
  31. 175
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multiple_camera_views.html
  32. 146
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multithreading.html
  33. 107
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/networking.html
  34. 33
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html
  35. 74
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html
  36. 48
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html
  37. 92
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_popup_menu.html
  38. 84
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html
  39. 345
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_scenarios.html
  40. 279
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html
  41. 195
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/open_game_finder.html
  42. 82
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/particle_emitters.html
  43. 163
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics.html
  44. 73
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html
  45. 46
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/remote-controlling_the_camera.html
  46. 45
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/save_and_load.html
  47. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/shading-ani.gif
  48. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/shading-textured-ani.gif
  49. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/shadow.png
  50. 94
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/sky.html
  51. 37
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/spatial.html
  52. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/spotlight.png
  53. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/teapot-phong-illuminated.png
  54. BIN
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain-lod-high-medium-low.png
  55. 137
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain.html
  56. 15
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain_collision.html
  57. 111
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/vehicles.html
  58. 248
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/walking_character.html
  59. 35
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/water.html
  60. 161
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_animation.html
  61. 77
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html
  62. 18
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_audio.html
  63. 99
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html
  64. 153
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_effects.html
  65. 89
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html
  66. 20
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html
  67. 20
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_material.html
  68. 90
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_node.html
  69. 56
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_from_sources.html
  70. 457
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/faq.html
  71. 100
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/appsettings.html
  72. 46
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/best_practices.html
  73. 78
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/file_types.html
  74. 367
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/headlessserver.html
  75. 45
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/optimization.html
  76. 42
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html
  77. 147
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/math.html
  78. 89
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/simpleapplication_from_the_commandline.html
  79. 116
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/terminology.html
  80. 98
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/the_scene_graph.html
  81. 99
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/webstart.html
  82. 69
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/3ds_to_blender_to_jmp.html
  83. 46
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/application_deployment.html
  84. 25
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/asset_packs.html
  85. 42
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/blender.html
  86. 92
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/code_editor.html
  87. 38
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html
  88. 60
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development.html
  89. 30
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/model_loader.html
  90. 43
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/projects_assets.html
  91. 96
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/scene.html
  92. 85
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html
  93. 43
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/log_files.html
  94. 35
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/material_editing.html
  95. 47
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/project_creation.html
  96. 34
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/terrain_editor.html
  97. 31
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/troubleshooting.html
  98. 126
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/version_control.html
  99. 2
      sdk/jme3-core/javahelp/com/jme3/gde/core/docs/wiki-map.xml
  100. 7
      sdk/jme3-core/javahelp/wiki_help.properties

@ -1,3 +1,84 @@
<h1><a>Models and Scenes</a></h1><div><p>Like <a href="/com/jme3/gde/core/docs/jme3/advanced/shape.html">Shape</a>s, 3D models are also made up of <a href="/com/jme3/gde/core/docs/jme3/advanced/mesh.html">Mesh</a>es, but models are more complex than Shapes. While Shapes are built into jME3, you typically create models in external 3D Mesh Editors.</p></div><h2><a>Using Models and Scenes with jME3</a></h2><div><p>To use 3D models in a jME3 application:</p><ol><li><div>Export the 3D model in Ogre <acronym title="Extensible Markup Language">XML</acronym> or Wavefront OBJ format. Export Scenes as Ogre DotScene format.</div></li><li><div>Save the files into a subdirectory of your jME3 project&#039;s <code>assets</code> directory.</div></li><li><div>In your code, you use the <a href="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a> to load models as <a href="/com/jme3/gde/core/docs/jme3/advanced/spatial.html">Spatial</a>s into a jME application.<pre>Spatial model = assetManager.loadModel&#40;
&quot;Models/MonkeyHead/MonkeyHead.mesh.xml&quot; &#41;;</pre></div></li><li><div>(For the release build:) Use the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> to convert models to .j3o format. You don&#039;t need this step as long you still develop and test the aplication within the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>.</div></li></ol></div><h2><a>Creating Models and Scenes</a></h2><div><p>To create 3D models and scenes, you need a 3D Mesh Editor such as <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.blender.org/"><param name="text" value="<html><u>Blender</u></html>"><param name="textColor" value="blue"></object>, with an OgreXML Exporter plugin.</p><p><strong>Tip:</strong> Consider creating <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics"><param name="text" value="<html><u>UV textures</u></html>"><param name="textColor" value="blue"></object> for more complex models, it looks more professional.</p><p>3D mesh editors are third-party products, so please consult their documentation for instructions how to use them. Here is an example workflow for Blender users:</p><p>To export your models as Ogre <acronym title="Extensible Markup Language">XML</acronym> meshes with materials:</p><ol><li><div>Open the menu File &gt; Export &gt; OgreXML Exporter to open the exporter dialog.</div></li><li><div>In the Export Materials field: Give the material the same name as the model. For example, the model <code>something.mesh.xml</code> goes with <code>something.material</code>, plus (optionally) <code>something.skeleton.xml</code>, and some <acronym title="Joint Photographics Experts Group">JPG</acronym> files.</div></li><li><div>In the Export Meshes field: Select a target subdirectory of your <code>assets/Models/</code> directory. E.g. <code>assets/Models/something/</code>.</div></li><li><div>Activate the following exporter settings:</div><ul><li><div>Copy Textures: YES</div></li><li><div>Rendering Materials: YES</div></li><li><div>Flip Axis: YES</div></li><li><div>Require Materials: YES</div></li><li><div>Skeleton name follows mesh: YES</div></li></ul></li><li><div>Click export.</div></li></ol><p>You can now use the <a href="/com/jme3/gde/core/docs/sdk.html">jMonkeyEngine SDK</a> to <a href="/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html">load and view models</a>. You can <a href="/com/jme3/gde/core/docs/sdk/scene_composer.html">create scenes</a> from them and write cde that loads them into your application.</p></div>
<h1><a>Models and Scenes</a></h1>
<div>
<p>
Like <a href="/com/jme3/gde/core/docs/jme3/advanced/shape.html">Shape</a>s, 3D models are also made up of <a href="/com/jme3/gde/core/docs/jme3/advanced/mesh.html">Mesh</a>es, but models are more complex than Shapes. While Shapes are built into jME3, you typically create models in external 3D Mesh Editors.
</p>
</div>
<h2><a>Using Models and Scenes with jME3</a></h2>
<div>
<p>
To use 3D models in a jME3 application:
</p>
<ol>
<li><div> Export the 3D model in Ogre <acronym title="Extensible Markup Language">XML</acronym> or Wavefront OBJ format. Export Scenes as Ogre DotScene format.</div>
</li>
<li><div> Save the files into a subdirectory of your jME3 project&#039;s <code>assets</code> directory.</div>
</li>
<li><div> In your code, you use the <a href="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a> to load models as <a href="/com/jme3/gde/core/docs/jme3/advanced/spatial.html">Spatial</a>s into a jME application. <pre>Spatial model = assetManager.loadModel&#40;
&quot;Models/MonkeyHead/MonkeyHead.mesh.xml&quot; &#41;;</pre>
</div>
</li>
<li><div> (For the release build:) Use the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> to convert models to .j3o format. You don&#039;t need this step as long you still develop and test the aplication within the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>.</div>
</li>
</ol>
</div>
<h2><a>Creating Models and Scenes</a></h2>
<div>
<p>
To create 3D models and scenes, you need a 3D Mesh Editor such as <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.blender.org/"><param name="text" value="<html><u>Blender</u></html>"><param name="textColor" value="blue"></object>, with an OgreXML Exporter plugin.
</p>
<p>
<strong>Tip:</strong> Consider creating <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics"><param name="text" value="<html><u>UV textures</u></html>"><param name="textColor" value="blue"></object> for more complex models, it looks more professional.
</p>
<p>
3D mesh editors are third-party products, so please consult their documentation for instructions how to use them. Here is an example workflow for Blender users:
</p>
<p>
To export your models as Ogre <acronym title="Extensible Markup Language">XML</acronym> meshes with materials:
</p>
<ol>
<li><div> Open the menu File &gt; Export &gt; OgreXML Exporter to open the exporter dialog.</div>
</li>
<li><div> In the Export Materials field: Give the material the same name as the model. For example, the model <code>something.mesh.xml</code> goes with <code>something.material</code>, plus (optionally) <code>something.skeleton.xml</code>, and some <acronym title="Joint Photographics Experts Group">JPG</acronym> files.</div>
</li>
<li><div> In the Export Meshes field: Select a target subdirectory of your <code>assets/Models/</code> directory. E.g. <code>assets/Models/something/</code>.</div>
</li>
<li><div> Activate the following exporter settings: </div>
<ul>
<li><div> Copy Textures: YES</div>
</li>
<li><div> Rendering Materials: YES</div>
</li>
<li><div> Flip Axis: YES</div>
</li>
<li><div> Require Materials: YES</div>
</li>
<li><div> Skeleton name follows mesh: YES</div>
</li>
</ul>
</li>
<li><div> Click export.</div>
</li>
</ol>
<p>
You can now use the <a href="/com/jme3/gde/core/docs/sdk.html">jMonkeyEngine SDK</a> to <a href="/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html">load and view models</a>. You can <a href="/com/jme3/gde/core/docs/sdk/scene_composer.html">create scenes</a> from them and write cde that loads them into your application.
</p>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:3d_models?do=export_xhtmlbody">view online version</a></em></p>

File diff suppressed because one or more lines are too long

@ -0,0 +1,381 @@
<h1><a>Simple AppStates Demo</a></h1>
<div>
<p>
This demo is a simple example of how you use AppStates to toggle between a StartScreen and a SettingsScreen (press RETURN) while the game is paused, and start the game by switching to a GameRunning state (press BACKSPACE).
</p>
<p>
There are four files, Main.java, GameRunningState.java, StartScreenState.java, SettingsScreenState.java.
</p>
</div>
<h2><a>Main.java</a></h2>
<div>
<pre>package chapter04.appstatedemo;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.input.controls.Trigger;
&nbsp;
<span>/**
* This demo shows a simple &quot;game&quot; with three AppStates. Instead of game content,
* it just displays three cubes on different backgrounds.
* &lt;ul&gt;
* &lt;li&gt;StartScreenState: This state is enabled
* when the user starts the application, or the the game is paused.
* Press BACKSPACE to return to the game, press RETURN to go to Settings.&lt;/li&gt;
* &lt;li&gt;GameRunningState: This state shows the game content and is enabled while the game is running.
* Press BACKSPACE to pause and return to the start screen.&lt;/li&gt;
* &lt;li&gt;SettingsScreenState: This Settings screen state can be reached from the start screen
* Press RETURN to toggle it on and off.&lt;/li&gt;
* &lt;/ul&gt;
*/</span>
public class Main extends SimpleApplication &#123;
&nbsp;
private Trigger pause_trigger = new KeyTrigger&#40;KeyInput.KEY_BACK&#41;;
private Trigger save_trigger = new KeyTrigger&#40;KeyInput.KEY_RETURN&#41;;
private boolean isRunning = false; // starts at startscreen
private GameRunningState gameRunningState;
private StartScreenState startScreenState;
private SettingsScreenState settingsScreenState;
&nbsp;
&nbsp;
/** Start the jMonkeyEngine application */
public static void main&#40;String&#91;&#93; args&#41; &#123;
Main app = new Main&#40;&#41;;
app.start&#40;&#41;;
&#125;
&nbsp;
<span>/**
* initialize the scene here
*/</span>
@Override
public void simpleInitApp&#40;&#41; &#123;
setDisplayFps&#40;false&#41;;
setDisplayStatView&#40;false&#41;;
&nbsp;
gameRunningState = new GameRunningState&#40;this&#41;;
startScreenState = new StartScreenState&#40;this&#41;;
settingsScreenState = new SettingsScreenState&#40;this&#41;;
&nbsp;
stateManager.attach&#40;startScreenState&#41;;
&nbsp;
inputManager.addMapping&#40;&quot;Game Pause Unpause&quot;, pause_trigger&#41;;
inputManager.addListener&#40;actionListener, new String&#91;&#93;&#123;&quot;Game Pause Unpause&quot;&#125;&#41;;
inputManager.addMapping&#40;&quot;Toggle Settings&quot;, save_trigger&#41;;
inputManager.addListener&#40;actionListener, new String&#91;&#93;&#123;&quot;Toggle Settings&quot;&#125;&#41;;
&#125;
&nbsp;
private ActionListener&#40;&#41; &#123;
public void onAction&#40;String name, boolean isPressed, float tpf&#41; &#123;
System.out.println&#40;&quot;key&quot; + name&#41;;
if &#40;name.equals&#40;&quot;Game Pause Unpause&quot;&#41; &amp;&amp; !isPressed&#41; &#123;
if &#40;isRunning&#41; &#123;
stateManager.detach&#40;gameRunningState&#41;;
stateManager.attach&#40;startScreenState&#41;;
System.out.println&#40;&quot;switching to startscreen...&quot;&#41;;
&nbsp;
&#125; else &#123;
stateManager.detach&#40;startScreenState&#41;;
stateManager.attach&#40;gameRunningState&#41;;
System.out.println&#40;&quot;switching to game...&quot;&#41;;
&#125;
isRunning = !isRunning;
&#125; else if &#40;name.equals&#40;&quot;Toggle Settings&quot;&#41; &amp;&amp; !isPressed &amp;&amp; !isRunning&#41; &#123;
if &#40;!isRunning &amp;&amp; stateManager.hasState&#40;startScreenState&#41;&#41; &#123;
stateManager.detach&#40;startScreenState&#41;;
stateManager.attach&#40;settingsScreenState&#41;;
System.out.println&#40;&quot;switching to settings...&quot;&#41;;
&#125; else if &#40;!isRunning &amp;&amp; stateManager.hasState&#40;settingsScreenState&#41;&#41; &#123;
stateManager.detach&#40;settingsScreenState&#41;;
stateManager.attach&#40;startScreenState&#41;;
System.out.println&#40;&quot;switching to startscreen...&quot;&#41;;
&#125;
&#125;
&#125;
&#125;;
&nbsp;
@Override
public void simpleUpdate&#40;float tpf&#41; &#123;&#125;
&nbsp;
&#125;
&nbsp;</pre>
</div>
<h2><a>GameRunningState.java</a></h2>
<div>
<pre>package chapter04.appstatedemo;
&nbsp;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
&nbsp;
<span>/**
* A template how to create an Application State. This example state simply
* changes the background color depending on the camera position.
*/</span>
public class GameRunningState extends AbstractAppState &#123;
&nbsp;
private ViewPort viewPort;
private Node rootNode;
private Node guiNode;
private AssetManager assetManager;
private Node localRootNode = new Node&#40;&quot;Game Screen RootNode&quot;&#41;;
private Node localGuiNode = new Node&#40;&quot;Game Screen GuiNode&quot;&#41;;
private final ColorRGBA backgroundColor = ColorRGBA.Blue;
&nbsp;
public GameRunningState&#40;SimpleApplication app&#41;&#123;
this.rootNode = app.getRootNode&#40;&#41;;
this.viewPort = app.getViewPort&#40;&#41;;
this.guiNode = app.getGuiNode&#40;&#41;;
this.assetManager = app.getAssetManager&#40;&#41;;
&#125;
&nbsp;
@Override
public void initialize&#40;AppStateManager stateManager, Application app&#41; &#123;
super.initialize&#40;stateManager, app&#41;;
&nbsp;
/** Load this scene */
viewPort.setBackgroundColor&#40;backgroundColor&#41;;
&nbsp;
Box&#40;Vector3f.ZERO, 1, 1, 1&#41;;
Geometry geom = new Geometry&#40;&quot;Box&quot;, mesh&#41;;
Material mat = new Material&#40;assetManager,
&quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;
mat.setColor&#40;&quot;Color&quot;, ColorRGBA.Green&#41;;
geom.setMaterial&#40;mat&#41;;
geom.setLocalTranslation&#40;1, 0, 0&#41;;
localRootNode.attachChild&#40;geom&#41;;
&nbsp;
/** Load the HUD*/
BitmapFont guiFont = assetManager.loadFont&#40;
&quot;Interface/Fonts/Default.fnt&quot;&#41;;
BitmapText displaytext = new BitmapText&#40;guiFont&#41;;
displaytext.setSize&#40;guiFont.getCharSet&#40;&#41;.getRenderedSize&#40;&#41;&#41;;
displaytext.move&#40;10, displaytext.getLineHeight&#40;&#41; + 20, 0&#41;;
displaytext.setText&#40;&quot;Game running. Press BACKSPACE to pause and return to the start screen.&quot;&#41;;
localGuiNode.attachChild&#40;displaytext&#41;;
&#125;
&nbsp;
@Override
public void update&#40;float tpf&#41; &#123;
/** the action happens here */
Vector3f v = viewPort.getCamera&#40;&#41;.getLocation&#40;&#41;;
viewPort.setBackgroundColor&#40;new ColorRGBA&#40;v.getX&#40;&#41; / 10, v.getY&#40;&#41; / 10, v.getZ&#40;&#41; / 10, 1&#41;&#41;;
rootNode.getChild&#40;&quot;Box&quot;&#41;.rotate&#40;tpf, tpf, tpf&#41;;
&#125;
&nbsp;
@Override
public void stateAttached&#40;AppStateManager stateManager&#41; &#123;
rootNode.attachChild&#40;localRootNode&#41;;
guiNode.attachChild&#40;localGuiNode&#41;;
viewPort.setBackgroundColor&#40;backgroundColor&#41;;
&#125;
&nbsp;
@Override
public void stateDetached&#40;AppStateManager stateManager&#41; &#123;
rootNode.detachChild&#40;localRootNode&#41;;
guiNode.detachChild&#40;localGuiNode&#41;;
&nbsp;
&#125;
&nbsp;
&#125;</pre>
</div>
<h2><a>SettingsScreenState.java</a></h2>
<div>
<pre>package chapter04.appstatedemo;
&nbsp;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
&nbsp;
<span>/**
* A template how to create an Application State. This example state simply
* changes the background color depending on the camera position.
*/</span>
public class SettingsScreenState extends AbstractAppState &#123;
&nbsp;
private ViewPort viewPort;
private Node rootNode;
private Node guiNode;
private AssetManager assetManager;
private Node localRootNode = new Node&#40;&quot;Settings Screen RootNode&quot;&#41;;
private Node localGuiNode = new Node&#40;&quot;Settings Screen GuiNode&quot;&#41;;
private final ColorRGBA backgroundColor = ColorRGBA.DarkGray;
&nbsp;
public SettingsScreenState&#40;SimpleApplication app&#41; &#123;
this.rootNode = app.getRootNode&#40;&#41;;
this.viewPort = app.getViewPort&#40;&#41;;
this.guiNode = app.getGuiNode&#40;&#41;;
this.assetManager = app.getAssetManager&#40;&#41;;
&#125;
&nbsp;
@Override
public void initialize&#40;AppStateManager stateManager, Application app&#41; &#123;
super.initialize&#40;stateManager, app&#41;;
&nbsp;
/** Load this scene */
viewPort.setBackgroundColor&#40;backgroundColor&#41;;
&nbsp;
Box&#40;new Vector3f&#40;-1, -1, 0&#41;, .5f, .5f, .5f&#41;;
Geometry geom = new Geometry&#40;&quot;Box&quot;, mesh&#41;;
Material mat = new Material&#40;assetManager,
&quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;
mat.setColor&#40;&quot;Color&quot;, ColorRGBA.Red&#41;;
geom.setMaterial&#40;mat&#41;;
geom.setLocalTranslation&#40;1, 0, 0&#41;;
localRootNode.attachChild&#40;geom&#41;;
&nbsp;
/** Load the HUD */
BitmapFont guiFont = assetManager.loadFont&#40;
&quot;Interface/Fonts/Default.fnt&quot;&#41;;
BitmapText displaytext = new BitmapText&#40;guiFont&#41;;
displaytext.setSize&#40;guiFont.getCharSet&#40;&#41;.getRenderedSize&#40;&#41;&#41;;
displaytext.move&#40;10, displaytext.getLineHeight&#40;&#41; + 20, 0&#41;;
displaytext.setText&#40;&quot;Settings screen. Press RETURN to save &quot;
+ &quot;and return to start screen.&quot;&#41;;
localGuiNode.attachChild&#40;displaytext&#41;;
&#125;
&nbsp;
@Override
public void update&#40;float tpf&#41; &#123;
/** the action happens here */
&#125;
&nbsp;
@Override
public void stateAttached&#40;AppStateManager stateManager&#41; &#123;
rootNode.attachChild&#40;localRootNode&#41;;
guiNode.attachChild&#40;localGuiNode&#41;;
viewPort.setBackgroundColor&#40;backgroundColor&#41;;
&#125;
&nbsp;
@Override
public void stateDetached&#40;AppStateManager stateManager&#41; &#123;
rootNode.detachChild&#40;localRootNode&#41;;
guiNode.detachChild&#40;localGuiNode&#41;;
&#125;
&nbsp;
&#125;</pre>
</div>
<h2><a>StartScreenState.java</a></h2>
<div>
<pre>package chapter04.appstatedemo;
&nbsp;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
&nbsp;
<span>/**
* A template how to create an Application State. This example state simply
* changes the background color depending on the camera position.
*/</span>
public class StartScreenState extends AbstractAppState &#123;
&nbsp;
private ViewPort viewPort;
private Node rootNode;
private Node guiNode;
private AssetManager assetManager;
private Node localRootNode = new Node&#40;&quot;Start Screen RootNode&quot;&#41;;
private Node localGuiNode = new Node&#40;&quot;Start Screen GuiNode&quot;&#41;;
private final ColorRGBA backgroundColor = ColorRGBA.Gray;
&nbsp;
public StartScreenState&#40;SimpleApplication app&#41;&#123;
this.rootNode = app.getRootNode&#40;&#41;;
this.viewPort = app.getViewPort&#40;&#41;;
this.guiNode = app.getGuiNode&#40;&#41;;
this.assetManager = app.getAssetManager&#40;&#41;;
&#125;
&nbsp;
@Override
public void initialize&#40;AppStateManager stateManager, Application app&#41; &#123;
super.initialize&#40;stateManager, app&#41;;
&nbsp;
/** Init this scene */
viewPort.setBackgroundColor&#40;backgroundColor&#41;;
&nbsp;
Box&#40;new Vector3f&#40;-1,1,0&#41;, .5f,.5f,.5f&#41;;
Geometry geom = new Geometry&#40;&quot;Box&quot;, mesh&#41;;
Material mat = new Material&#40;assetManager,
&quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;
mat.setColor&#40;&quot;Color&quot;, ColorRGBA.Yellow&#41;;
geom.setMaterial&#40;mat&#41;;
geom.setLocalTranslation&#40;1, 0, 0&#41;;
localRootNode.attachChild&#40;geom&#41;;
&nbsp;
/** Load a HUD */
BitmapFont guiFont = assetManager.loadFont&#40;
&quot;Interface/Fonts/Default.fnt&quot;&#41;;
BitmapText displaytext = new BitmapText&#40;guiFont&#41;;
displaytext.setSize&#40;guiFont.getCharSet&#40;&#41;.getRenderedSize&#40;&#41;&#41;;
displaytext.move&#40; 10, displaytext.getLineHeight&#40;&#41; + 20, 0&#41;;
displaytext.setText&#40;&quot;Start screen. Press BACKSPACE to resume the game, &quot;
+ &quot;press RETURN to edit Settings.&quot;&#41;;
localGuiNode.attachChild&#40;displaytext&#41;;
&#125;
&nbsp;
@Override
public void update&#40;float tpf&#41; &#123;
/** the action happens here */
&#125;
&nbsp;
@Override
public void stateAttached&#40;AppStateManager stateManager&#41; &#123;
rootNode.attachChild&#40;localRootNode&#41;;
guiNode.attachChild&#40;localGuiNode&#41;;
viewPort.setBackgroundColor&#40;backgroundColor&#41;;
&#125;
&nbsp;
@Override
public void stateDetached&#40;AppStateManager stateManager&#41; &#123;
rootNode.detachChild&#40;localRootNode&#41;;
guiNode.detachChild&#40;localGuiNode&#41;;
&#125;
&nbsp;
&#125;</pre>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:appstatesdemo?do=export_xhtmlbody">view online version</a></em></p>

@ -1,4 +1,86 @@
<h1><a>Audio in jME3</a></h1><div><p>There are two ways to handle audio data: Short audio files are to be stored entirely in memory, while long audio files (music) is streamed from the hard drive as it is played.</p><p>Place audio files in the <code>assets/Sound/</code> directory of your project. jME3 supports Ogg Vorbis (.ogg) and Wave (.wav) formats.</p></div><h2><a>Creating Audio Nodes: Streamed or Buffered</a></h2><div><p>The main class to look at is <code>com.jme3.audio.AudioNode</code>.</p><ul><li><div><strong>Buffered:</strong> By default, a new audio node is buffered. This means jME3 loads the whole file into memory before playing. You create a buffered sound by setting the boolean to false, or using no boolean at all:<pre>AudioNode boom = new AudioNode&#40;assetManager, &quot;Sound/boom.wav&quot;&#41;;</pre></div></li><li><div><strong>Streamed:</strong> If it is a long file, you stream the audio, that means, you load and play in parallel until the sound is done. You create a streamed sound by setting the boolean to true:<pre>AudioNode music = new AudioNode&#40;assetManager, &quot;Sound/music.wav&quot;, true&#41;;</pre></div></li></ul></div><h2><a>Getting AudioNode Properties</a></h2><div><div><table><tr><th>AudioNode Method</th><th>Usage</th></tr><tr><td>getStatus()</td><td>Returns either Status.Playing, Status.Stopped, or Status.Paused.</td></tr><tr><td>getVolume()</td><td>Returns the volume.</td></tr><tr><td>getPitch()</td><td>Returns the pitch.</td></tr></table></div><p>There are other obvious getters to poll the status of corresponding setters below.</p></div><h2><a>Setting AudioNode Properties</a></h2><div><div><table><tr><th>AudioNode Method</th><th>Usage</th></tr><tr><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></tr></table></div><div><table><tr><th>AudioNode Method</th><th>Usage</th></tr><tr><td>setLooping(false)</td><td>Configures the sound so that, if it is played, it plays once and stops. This is the default.</td></tr><tr><td>setLooping(true)</td><td>Configures the sound so that, if it is played, it plays repeats from the beginning, until stop() or pause() are called. Good for ambient background noises. <br/> Does not work for streamed sounds!</td></tr><tr>
<h1><a>Audio in jME3</a></h1>
<div>
<p>
There are two ways to handle audio data: Short audio files are to be stored entirely in memory, while long audio files (music) is streamed from the hard drive as it is played.
</p>
<p>
Place audio files in the <code>assets/Sound/</code> directory of your project. jME3 supports Ogg Vorbis (.ogg) and Wave (.wav) formats.
</p>
</div>
<h2><a>Creating Audio Nodes: Streamed or Buffered</a></h2>
<div>
<p>
The main class to look at is <code>com.jme3.audio.AudioNode</code>.
</p>
<ul>
<li><div> <strong>Buffered:</strong> By default, a new audio node is buffered. This means jME3 loads the whole file into memory before playing. You create a buffered sound by setting the boolean to false, or using no boolean at all: <pre>AudioNode boom = new AudioNode&#40;assetManager, &quot;Sound/boom.wav&quot;&#41;;</pre>
</div>
</li>
<li><div> <strong>Streamed:</strong> If it is a long file, you stream the audio, that means, you load and play in parallel until the sound is done. You create a streamed sound by setting the boolean to true:<pre>AudioNode music = new AudioNode&#40;assetManager, &quot;Sound/music.wav&quot;, true&#41;;</pre>
</div>
</li>
</ul>
</div>
<h2><a>Getting AudioNode Properties</a></h2>
<div>
<div><table>
<tr>
<th>AudioNode Method</th><th>Usage</th>
</tr>
<tr>
<td>getStatus()</td><td>Returns either Status.Playing, Status.Stopped, or Status.Paused. </td>
</tr>
<tr>
<td>getVolume()</td><td>Returns the volume. </td>
</tr>
<tr>
<td>getPitch()</td><td>Returns the pitch. </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [1068-1240] -->
<p>
There are other obvious getters to poll the status of corresponding setters below.
</p>
</div>
<h2><a>Setting AudioNode Properties</a></h2>
<div>
<div><table>
<tr>
<th>AudioNode Method</th><th>Usage</th>
</tr>
<tr>
<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>
</tr>
</table></div>
<!-- EDIT2 TABLE [1368-1616] --><div><table>
<tr>
<th>AudioNode Method</th><th>Usage</th>
</tr>
<tr>
<td>setLooping(false)</td><td>Configures the sound so that, if it is played, it plays once and stops. This is the default.</td>
</tr>
<tr>
<td>setLooping(true)</td><td>Configures the sound so that, if it is played, it plays repeats from the beginning, until stop() or pause() are called. Good for ambient background noises. <br/>
Does not work for streamed sounds! </td>
</tr>
<tr>
<td>setPositional(false) <br/>
setDirectional(false)</td><td>All 3D effects switched off. This sound is global and comes from everywhere. Good for environmental ambient sounds and background music.</td>
</tr>

@ -1,8 +1,27 @@
<h1><a>Audio Environment Presets</a></h1><div><p>Use these presets together with <a href="/com/jme3/gde/core/docs/jme3/advanced/audio.html">Audio</a> Nodes to create different &quot;moods&quot; for sounds. Environment effects make your audio sound as if the listener were in various places that have different types of echoes.</p><p>Usage:</p><pre>Environment&#40;
<h1><a>Audio Environment Presets</a></h1>
<div>
<p>
Use these presets together with <a href="/com/jme3/gde/core/docs/jme3/advanced/audio.html">Audio</a> Nodes to create different &quot;moods&quot; for sounds. Environment effects make your audio sound as if the listener were in various places that have different types of echoes.
</p>
<p>
Usage:
</p>
<pre>Environment&#40;
new float&#91;&#93;&#123; 0, 7.5f, 1f, -1000, -100, 0, 1.49f, 0.83f, 1f, -2602,
0.007f, 0f, 0f, 0f, 200, 0.011f, 0f, 0f, 0f, 0.250f,
0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
audioRenderer.setEnvironment&#40;myEnvironment&#41;;</pre></div><h2><a>Castle</a></h2><div><pre>CastleSmallRoom = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 0.890f, -1000, -800, -2000, 1.22f, 0.83f, 0.31f, -100, 0.022f, 0f, 0f, 0f, 600, 0.011f, 0f, 0f, 0f, 0.138f, 0.080f, 0.250f, 0f, -5f, 5168.6f, 139.5f, 0f, 0x20&#125; &#41; &#41;;
audioRenderer.setEnvironment&#40;myEnvironment&#41;;</pre>
</div>
<h2><a>Castle</a></h2>
<div>
<pre>CastleSmallRoom = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 0.890f, -1000, -800, -2000, 1.22f, 0.83f, 0.31f, -100, 0.022f, 0f, 0f, 0f, 600, 0.011f, 0f, 0f, 0f, 0.138f, 0.080f, 0.250f, 0f, -5f, 5168.6f, 139.5f, 0f, 0x20&#125; &#41; &#41;;
CastleShortPassage = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 0.890f, -1000, -1000, -2000, 2.32f, 0.83f, 0.31f, -100, 0.007f, 0f, 0f, 0f, 200, 0.023f, 0f, 0f, 0f, 0.138f, 0.080f, 0.250f, 0f, -5f, 5168.6f, 139.5f, 0f, 0x20&#125; &#41; &#41;;
CastleMediumroom = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 0.930f, -1000, -1100, -2000, 2.04f, 0.83f, 0.46f, -400, 0.022f, 0f, 0f, 0f, 400, 0.011f, 0f, 0f, 0f, 0.155f, 0.030f, 0.250f, 0f, -5f, 5168.6f, 139.5f, 0f, 0x20&#125; &#41; &#41;;
CastleLongpassage = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 0.890f, -1000, -800, -2000, 3.42f, 0.83f, 0.31f, -100, 0.007f, 0f, 0f, 0f, 300, 0.023f, 0f, 0f, 0f, 0.138f, 0.080f, 0.250f, 0f, -5f, 5168.6f, 139.5f, 0f, 0x20&#125; &#41; &#41;;
@ -10,7 +29,13 @@ CastleLargeroom = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 0
CastleHall = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 0.810f, -1000, -1100, -1500, 3.14f, 0.79f, 0.62f, -1500, 0.056f, 0f, 0f, 0f, 100, 0.024f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5168.6f, 139.5f, 0f, 0x20&#125; &#41; &#41;;
CastleCupboard = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 0.890f, -1000, -1100, -2000, 0.67f, 0.87f, 0.31f, 300, 0.010f, 0f, 0f, 0f, 1100, 0.007f, 0f, 0f, 0f, 0.138f, 0.080f, 0.250f, 0f, -5f, 5168.6f, 139.5f, 0f, 0x20&#125; &#41; &#41;;
CastleCourtyard = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 0.420f, -1000, -700, -1400, 2.13f, 0.61f, 0.23f, -1300, 0.160f, 0f, 0f, 0f, -300, 0.036f, 0f, 0f, 0f, 0.250f, 0.370f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x1f&#125; &#41; &#41;;
CastleAlcove = new Environment &#40; new float&#91;&#93;&#123; 26, 1.8f, 0.590f, -1200, -200, -600, 3.14f, 0.65f, 1.31f, 300, 0.010f, 0f, 0f, 0f, 000, 0.038f, 0f, 0f, 0f, 0.114f, 0.100f, 0.250f, 0f, -5f, 3762.6f, 362.5f, 0f, 0x20&#125; &#41; &#41;;
CastleAlcove = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 0.890f, -1000, -600, -2000, 1.64f, 0.87f, 0.31f, 00, 0.007f, 0f, 0f, 0f, 300, 0.034f, 0f, 0f, 0f, 0.138f, 0.080f, 0.250f, 0f, -5f, 5168.6f, 139.5f, 0f, 0x20&#125; &#41; &#41;;</pre>
</div>
<h2><a>Warehouse, Factory</a></h2>
<div>
<pre>FactoryAlcove = new Environment &#40; new float&#91;&#93;&#123; 26, 1.8f, 0.590f, -1200, -200, -600, 3.14f, 0.65f, 1.31f, 300, 0.010f, 0f, 0f, 0f, 000, 0.038f, 0f, 0f, 0f, 0.114f, 0.100f, 0.250f, 0f, -5f, 3762.6f, 362.5f, 0f, 0x20&#125; &#41; &#41;;
FactoryShortpassage = new Environment &#40; new float&#91;&#93;&#123; 26, 1.8f, 0.640f, -1200, -200, -600, 2.53f, 0.65f, 1.31f, 0, 0.010f, 0f, 0f, 0f, 200, 0.038f, 0f, 0f, 0f, 0.135f, 0.230f, 0.250f, 0f, -5f, 3762.6f, 362.5f, 0f, 0x20&#125; &#41; &#41;;
FactoryMediumroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.9f, 0.820f, -1200, -200, -600, 2.76f, 0.65f, 1.31f, -1100, 0.022f, 0f, 0f, 0f, 300, 0.023f, 0f, 0f, 0f, 0.174f, 0.070f, 0.250f, 0f, -5f, 3762.6f, 362.5f, 0f, 0x20&#125; &#41; &#41;;
FactoryLongpassage = new Environment &#40; new float&#91;&#93;&#123; 26, 1.8f, 0.640f, -1200, -200, -600, 4.06f, 0.65f, 1.31f, 0, 0.020f, 0f, 0f, 0f, 200, 0.037f, 0f, 0f, 0f, 0.135f, 0.230f, 0.250f, 0f, -5f, 3762.6f, 362.5f, 0f, 0x20&#125; &#41; &#41;;
@ -18,7 +43,13 @@ FactoryLargeroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.9f,
FactoryHall = new Environment &#40; new float&#91;&#93;&#123; 26, 1.9f, 0.750f, -1000, -300, -400, 7.43f, 0.51f, 1.31f, -2400, 0.073f, 0f, 0f, 0f, -100, 0.027f, 0f, 0f, 0f, 0.250f, 0.070f, 0.250f, 0f, -5f, 3762.6f, 362.5f, 0f, 0x20&#125; &#41; &#41;;
FactoryCupboard = new Environment &#40; new float&#91;&#93;&#123; 26, 1.7f, 0.630f, -1200, -200, -600, 0.49f, 0.65f, 1.31f, 200, 0.010f, 0f, 0f, 0f, 600, 0.032f, 0f, 0f, 0f, 0.107f, 0.070f, 0.250f, 0f, -5f, 3762.6f, 362.5f, 0f, 0x20&#125; &#41; &#41;;
FactoryCourtyard = new Environment &#40; new float&#91;&#93;&#123; 26, 1.7f, 0.570f, -1000, -1000, -400, 2.32f, 0.29f, 0.56f, -1300, 0.140f, 0f, 0f, 0f, -800, 0.039f, 0f, 0f, 0f, 0.250f, 0.290f, 0.250f, 0f, -5f, 3762.6f, 362.5f, 0f, 0x20&#125; &#41; &#41;;
FactorySmallroom = new Environment &#40; new float&#91;&#93;&#123; 26, 2.7f, 0.840f, -1000, -500, -1100, 2.76f, 1.46f, 0.28f, 100, 0.010f, 0f, 0f, 0f, -100, 0.030f, 0f, 0f, 0f, 0.161f, 0.090f, 0.250f, 0f, -5f, 12428.5f, 99.6f, 0f, 0x20&#125; &#41; &#41;;
FactorySmallroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.8f, 0.820f, -1000, -200, -600, 1.72f, 0.65f, 1.31f, -300, 0.010f, 0f, 0f, 0f, 500, 0.024f, 0f, 0f, 0f, 0.119f, 0.070f, 0.250f, 0f, -5f, 3762.6f, 362.5f, 0f, 0x20&#125; &#41; &#41;;</pre>
</div>
<h2><a>Ice Palace</a></h2>
<div>
<pre>IcepalaceAlcove = new Environment &#40; new float&#91;&#93;&#123; 26, 2.7f, 0.840f, -1000, -500, -1100, 2.76f, 1.46f, 0.28f, 100, 0.010f, 0f, 0f, 0f, -100, 0.030f, 0f, 0f, 0f, 0.161f, 0.090f, 0.250f, 0f, -5f, 12428.5f, 99.6f, 0f, 0x20&#125; &#41; &#41;;
IcepalaceShortpassage = new Environment &#40; new float&#91;&#93;&#123; 26, 2.7f, 0.750f, -1000, -500, -1100, 1.79f, 1.46f, 0.28f, -600, 0.010f, 0f, 0f, 0f, 100, 0.019f, 0f, 0f, 0f, 0.177f, 0.090f, 0.250f, 0f, -5f, 12428.5f, 99.6f, 0f, 0x20&#125; &#41; &#41;;
IcepalaceMediumroom = new Environment &#40; new float&#91;&#93;&#123; 26, 2.7f, 0.870f, -1000, -500, -700, 2.22f, 1.53f, 0.32f, -800, 0.039f, 0f, 0f, 0f, 100, 0.027f, 0f, 0f, 0f, 0.186f, 0.120f, 0.250f, 0f, -5f, 12428.5f, 99.6f, 0f, 0x20&#125; &#41; &#41;;
IcepalaceLongpassage = new Environment &#40; new float&#91;&#93;&#123; 26, 2.7f, 0.770f, -1000, -500, -800, 3.01f, 1.46f, 0.28f, -200, 0.012f, 0f, 0f, 0f, 200, 0.025f, 0f, 0f, 0f, 0.186f, 0.040f, 0.250f, 0f, -5f, 12428.5f, 99.6f, 0f, 0x20&#125; &#41; &#41;;
@ -26,14 +57,26 @@ IcepalaceLargeroom = new Environment &#40; new float&#91;&#93;&#123; 26, 2.9f
IcepalaceHall = new Environment &#40; new float&#91;&#93;&#123; 26, 2.9f, 0.760f, -1000, -700, -500, 5.49f, 1.53f, 0.38f, -1900, 0.054f, 0f, 0f, 0f, -400, 0.052f, 0f, 0f, 0f, 0.226f, 0.110f, 0.250f, 0f, -5f, 12428.5f, 99.6f, 0f, 0x20&#125; &#41; &#41;;
IcepalaceCupboard = new Environment &#40; new float&#91;&#93;&#123; 26, 2.7f, 0.830f, -1000, -600, -1300, 0.76f, 1.53f, 0.26f, 100, 0.012f, 0f, 0f, 0f, 600, 0.016f, 0f, 0f, 0f, 0.143f, 0.080f, 0.250f, 0f, -5f, 12428.5f, 99.6f, 0f, 0x20&#125; &#41; &#41;;
IcepalaceCourtyard = new Environment &#40; new float&#91;&#93;&#123; 26, 2.9f, 0.590f, -1000, -1100, -1000, 2.04f, 1.20f, 0.38f, -1000, 0.173f, 0f, 0f, 0f, -1000, 0.043f, 0f, 0f, 0f, 0.235f, 0.480f, 0.250f, 0f, -5f, 12428.5f, 99.6f, 0f, 0x20&#125; &#41; &#41;;
IcepalaceSmallroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.5f, 0.780f, -1000, -300, -100, 1.16f, 0.81f, 0.55f, 300, 0.007f, 0f, 0f, 0f, 000, 0.018f, 0f, 0f, 0f, 0.192f, 0.210f, 0.250f, 0f, -5f, 3316.1f, 458.2f, 0f, 0x20&#125; &#41; &#41;;
IcepalaceSmallroom = new Environment &#40; new float&#91;&#93;&#123; 26, 2.7f, 0.840f, -1000, -500, -1100, 1.51f, 1.53f, 0.27f, -100, 0.010f, 0f, 0f, 0f, 300, 0.011f, 0f, 0f, 0f, 0.164f, 0.140f, 0.250f, 0f, -5f, 12428.5f, 99.6f, 0f, 0x20&#125; &#41; &#41;;</pre>
</div>
<h2><a>Space Station</a></h2>
<div>
<pre>SpacestationAlcove = new Environment &#40; new float&#91;&#93;&#123; 26, 1.5f, 0.780f, -1000, -300, -100, 1.16f, 0.81f, 0.55f, 300, 0.007f, 0f, 0f, 0f, 000, 0.018f, 0f, 0f, 0f, 0.192f, 0.210f, 0.250f, 0f, -5f, 3316.1f, 458.2f, 0f, 0x20&#125; &#41; &#41;;
SpacestationMediumroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.5f, 0.750f, -1000, -400, -100, 3.01f, 0.50f, 0.55f, -800, 0.034f, 0f, 0f, 0f, 100, 0.035f, 0f, 0f, 0f, 0.209f, 0.310f, 0.250f, 0f, -5f, 3316.1f, 458.2f, 0f, 0x20&#125; &#41; &#41;;
SpacestationShortpassage = new Environment &#40; new float&#91;&#93;&#123; 26, 1.5f, 0.870f, -1000, -400, -100, 3.57f, 0.50f, 0.55f, 0, 0.012f, 0f, 0f, 0f, 100, 0.016f, 0f, 0f, 0f, 0.172f, 0.200f, 0.250f, 0f, -5f, 3316.1f, 458.2f, 0f, 0x20&#125; &#41; &#41;;
SpacestationLongpassage = new Environment &#40; new float&#91;&#93;&#123; 26, 1.9f, 0.820f, -1000, -400, -100, 4.62f, 0.62f, 0.55f, 0, 0.012f, 0f, 0f, 0f, 200, 0.031f, 0f, 0f, 0f, 0.250f, 0.230f, 0.250f, 0f, -5f, 3316.1f, 458.2f, 0f, 0x20&#125; &#41; &#41;;
SpacestationLargeroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.8f, 0.810f, -1000, -400, -100, 3.89f, 0.38f, 0.61f, -1000, 0.056f, 0f, 0f, 0f, -100, 0.035f, 0f, 0f, 0f, 0.233f, 0.280f, 0.250f, 0f, -5f, 3316.1f, 458.2f, 0f, 0x20&#125; &#41; &#41;;
SpacestationHall = new Environment &#40; new float&#91;&#93;&#123; 26, 1.9f, 0.870f, -1000, -400, -100, 7.11f, 0.38f, 0.61f, -1500, 0.100f, 0f, 0f, 0f, -400, 0.047f, 0f, 0f, 0f, 0.250f, 0.250f, 0.250f, 0f, -5f, 3316.1f, 458.2f, 0f, 0x20&#125; &#41; &#41;;
SpacestationCupboard = new Environment &#40; new float&#91;&#93;&#123; 26, 1.4f, 0.560f, -1000, -300, -100, 0.79f, 0.81f, 0.55f, 300, 0.007f, 0f, 0f, 0f, 500, 0.018f, 0f, 0f, 0f, 0.181f, 0.310f, 0.250f, 0f, -5f, 3316.1f, 458.2f, 0f, 0x20&#125; &#41; &#41;;
SpacestationSmallroom = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 1f, -1000, -1800, -1000, 1.22f, 0.62f, 0.91f, 100, 0.012f, 0f, 0f, 0f, -300, 0.024f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 4705f, 99.6f, 0f, 0x3f&#125; &#41; &#41;;
SpacestationSmallroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.5f, 0.700f, -1000, -300, -100, 1.72f, 0.82f, 0.55f, -200, 0.007f, 0f, 0f, 0f, 300, 0.013f, 0f, 0f, 0f, 0.188f, 0.260f, 0.250f, 0f, -5f, 3316.1f, 458.2f, 0f, 0x20&#125; &#41; &#41;;</pre>
</div>
<h2><a>Wooden Hut or Ship</a></h2>
<div>
<pre>WoodenAlcove = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 1f, -1000, -1800, -1000, 1.22f, 0.62f, 0.91f, 100, 0.012f, 0f, 0f, 0f, -300, 0.024f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 4705f, 99.6f, 0f, 0x3f&#125; &#41; &#41;;
WoodenShortpassage = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 1f, -1000, -1800, -1000, 1.75f, 0.50f, 0.87f, -100, 0.012f, 0f, 0f, 0f, -400, 0.024f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 4705f, 99.6f, 0f, 0x3f&#125; &#41; &#41;;
WoodenMediumroom = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 1f, -1000, -2000, -1100, 1.47f, 0.42f, 0.82f, -100, 0.049f, 0f, 0f, 0f, -100, 0.029f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 4705f, 99.6f, 0f, 0x3f&#125; &#41; &#41;;
WoodenLongpassage = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 1f, -1000, -2000, -1000, 1.99f, 0.40f, 0.79f, 000, 0.020f, 0f, 0f, 0f, -700, 0.036f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 4705f, 99.6f, 0f, 0x3f&#125; &#41; &#41;;
@ -41,53 +84,113 @@ WoodenLargeroom = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5
WoodenHall = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 1f, -1000, -2200, -1100, 3.45f, 0.30f, 0.82f, -100, 0.088f, 0f, 0f, 0f, -200, 0.063f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 4705f, 99.6f, 0f, 0x3f&#125; &#41; &#41;;
WoodenCupboard = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 1f, -1000, -1700, -1000, 0.56f, 0.46f, 0.91f, 100, 0.012f, 0f, 0f, 0f, 100, 0.028f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 4705f, 99.6f, 0f, 0x3f&#125; &#41; &#41;;
WoodenSmallroom = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 1f, -1000, -1900, -1000, 0.79f, 0.32f, 0.87f, 00, 0.032f, 0f, 0f, 0f, -100, 0.029f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 4705f, 99.6f, 0f, 0x3f&#125; &#41; &#41;;
WoodenCourtyard = new Environment &#40; new float&#91;&#93;&#123; 26, 7.2f, 1f, -1000, -700, -200, 6.26f, 0.51f, 1.10f, -2400, 0.183f, 0f, 0f, 0f, -800, 0.038f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x20&#125; &#41; &#41;;
WoodenCourtyard = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 0.650f, -1000, -2200, -1000, 1.79f, 0.35f, 0.79f, -500, 0.123f, 0f, 0f, 0f, -2000, 0.032f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 4705f, 99.6f, 0f, 0x3f&#125; &#41; &#41;;</pre>
</div>
<h2><a>Sport</a></h2>
<div>
<pre>SportEmptystadium = new Environment &#40; new float&#91;&#93;&#123; 26, 7.2f, 1f, -1000, -700, -200, 6.26f, 0.51f, 1.10f, -2400, 0.183f, 0f, 0f, 0f, -800, 0.038f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x20&#125; &#41; &#41;;
SportSquashcourt = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 0.750f, -1000, -1000, -200, 2.22f, 0.91f, 1.16f, -700, 0.007f, 0f, 0f, 0f, -200, 0.011f, 0f, 0f, 0f, 0.126f, 0.190f, 0.250f, 0f, -5f, 7176.9f, 211.2f, 0f, 0x20&#125; &#41; &#41;;
SportSmallswimmingpool = new Environment &#40; new float&#91;&#93;&#123; 26, 36.2f, 0.700f, -1000, -200, -100, 2.76f, 1.25f, 1.14f, -400, 0.020f, 0f, 0f, 0f, -200, 0.030f, 0f, 0f, 0f, 0.179f, 0.150f, 0.895f, 0.190f, -5f, 5000f, 250f, 0f, 0x0&#125; &#41; &#41;;
SportLargeswimmingpool = new Environment &#40; new float&#91;&#93;&#123; 26, 36.2f, 0.820f, -1000, -200, 0, 5.49f, 1.31f, 1.14f, -700, 0.039f, 0f, 0f, 0f, -600, 0.049f, 0f, 0f, 0f, 0.222f, 0.550f, 1.159f, 0.210f, -5f, 5000f, 250f, 0f, 0x0&#125; &#41; &#41;;
SportGymnasium = new Environment &#40; new float&#91;&#93;&#123; 26, 7.5f, 0.810f, -1000, -700, -100, 3.14f, 1.06f, 1.35f, -800, 0.029f, 0f, 0f, 0f, -500, 0.045f, 0f, 0f, 0f, 0.146f, 0.140f, 0.250f, 0f, -5f, 7176.9f, 211.2f, 0f, 0x20&#125; &#41; &#41;;
SportFullstadium = new Environment &#40; new float&#91;&#93;&#123; 21, 1.7f, 0.800f, -1000, -1000, 0, 2.81f, 0.14f, 1f, 429, 0.014f, 0f, 0f, 0f, 1023, 0.021f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
SportFullstadium = new Environment &#40; new float&#91;&#93;&#123; 26, 7.2f, 1f, -1000, -2300, -200, 5.25f, 0.17f, 0.80f, -2000, 0.188f, 0f, 0f, 0f, -1100, 0.038f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x20&#125; &#41; &#41;;</pre>
</div>
<h2><a>Pipes</a></h2>
<div>
<pre>Sewerpipe = new Environment &#40; new float&#91;&#93;&#123; 21, 1.7f, 0.800f, -1000, -1000, 0, 2.81f, 0.14f, 1f, 429, 0.014f, 0f, 0f, 0f, 1023, 0.021f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
PipeSmall = new Environment &#40; new float&#91;&#93;&#123; 26, 50.3f, 1f, -1000, -900, -1300, 5.04f, 0.10f, 0.10f, -600, 0.032f, 0f, 0f, 0f, 800, 0.015f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 2854.4f, 20f, 0f, 0x3f&#125; &#41; &#41;;
PipeLongthin = new Environment &#40; new float&#91;&#93;&#123; 26, 1.6f, 0.910f, -1000, -700, -1100, 9.21f, 0.18f, 0.10f, -300, 0.010f, 0f, 0f, 0f, -300, 0.022f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 2854.4f, 20f, 0f, 0x0&#125; &#41; &#41;;
PipeLarge = new Environment &#40; new float&#91;&#93;&#123; 26, 50.3f, 1f, -1000, -900, -1300, 8.45f, 0.10f, 0.10f, -800, 0.046f, 0f, 0f, 0f, 400, 0.032f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 2854.4f, 20f, 0f, 0x3f&#125; &#41; &#41;;
PipeResonant = new Environment &#40; new float&#91;&#93;&#123; 26, 19.6f, 0.940f, -1000, -200, -700, 5.04f, 1.12f, 0.56f, -1230, 0.020f, 0f, 0f, 0f, 200, 0.029f, 0f, 0f, 0f, 0.250f, 0.080f, 2.742f, 0.050f, -2f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
PipeResonant = new Environment &#40; new float&#91;&#93;&#123; 26, 1.3f, 0.910f, -1000, -700, -1100, 6.81f, 0.18f, 0.10f, -300, 0.010f, 0f, 0f, 0f, 00, 0.022f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 2854.4f, 20f, 0f, 0x0&#125; &#41; &#41;;</pre>
</div>
<h2><a>Moods</a></h2>
<div>
<pre>Heaven = new Environment &#40; new float&#91;&#93;&#123; 26, 19.6f, 0.940f, -1000, -200, -700, 5.04f, 1.12f, 0.56f, -1230, 0.020f, 0f, 0f, 0f, 200, 0.029f, 0f, 0f, 0f, 0.250f, 0.080f, 2.742f, 0.050f, -2f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Hell = new Environment &#40; new float&#91;&#93;&#123; 26, 100f, 0.570f, -1000, -900, -700, 3.57f, 0.49f, 2f, -10000, 0.020f, 0f, 0f, 0f, 300, 0.030f, 0f, 0f, 0f, 0.110f, 0.040f, 2.109f, 0.520f, -5f, 5000f, 139.5f, 0f, 0x40&#125; &#41; &#41;;
Memory = new Environment &#40; new float&#91;&#93;&#123; 26, 8f, 0.850f, -1000, -400, -900, 4.06f, 0.82f, 0.56f, -2800, 0f, 0f, 0f, 0f, 100, 0f, 0f, 0f, 0f, 0.250f, 0f, 0.474f, 0.450f, -10f, 5000f, 250f, 0f, 0x0&#125; &#41; &#41;;
Drugged = new Environment &#40; new float&#91;&#93;&#123; 23, 1.9f, 0.500f, -1000, 0, 0, 8.39f, 1.39f, 1f, -115, 0.002f, 0f, 0f, 0f, 985, 0.030f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 1f, -5f, 5000f, 250f, 0f, 0x1f&#125; &#41; &#41;;
Dizzy = new Environment &#40; new float&#91;&#93;&#123; 24, 1.8f, 0.600f, -1000, -400, 0, 17.23f, 0.56f, 1f, -1713, 0.020f, 0f, 0f, 0f, -613, 0.030f, 0f, 0f, 0f, 0.250f, 1f, 0.810f, 0.310f, -5f, 5000f, 250f, 0f, 0x1f&#125; &#41; &#41;;
Psychotic = new Environment &#40; new float&#91;&#93;&#123; 26, 3f, 0f, 1000, -500, -600, 2.42f, 0.88f, 0.68f, -1400, 0.093f, 0f, 0f, 0f, -1200, 0.017f, 0f, 0f, 0f, 0.250f, 1f, 0.250f, 0f, -10f, 5000f, 250f, 0f, 0x20&#125; &#41; &#41;;
Psychotic = new Environment &#40; new float&#91;&#93;&#123; 25, 1f, 0.500f, -1000, -151, 0, 7.56f, 0.91f, 1f, -626, 0.020f, 0f, 0f, 0f, 774, 0.030f, 0f, 0f, 0f, 0.250f, 0f, 4f, 1f, -5f, 5000f, 250f, 0f, 0x1f&#125; &#41; &#41;;</pre>
</div>
<h2><a>Car Racing</a></h2>
<div>
<pre>DrivingCommentator = new Environment &#40; new float&#91;&#93;&#123; 26, 3f, 0f, 1000, -500, -600, 2.42f, 0.88f, 0.68f, -1400, 0.093f, 0f, 0f, 0f, -1200, 0.017f, 0f, 0f, 0f, 0.250f, 1f, 0.250f, 0f, -10f, 5000f, 250f, 0f, 0x20&#125; &#41; &#41;;
DrivingPitgarage = new Environment &#40; new float&#91;&#93;&#123; 26, 1.9f, 0.590f, -1000, -300, -500, 1.72f, 0.93f, 0.87f, -500, 0f, 0f, 0f, 0f, 200, 0.016f, 0f, 0f, 0f, 0.250f, 0.110f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x0&#125; &#41; &#41;;
DrivingIncarRacer = new Environment &#40; new float&#91;&#93;&#123; 26, 1.1f, 0.800f, -1000, 0, -200, 0.17f, 2f, 0.41f, 500, 0.007f, 0f, 0f, 0f, -300, 0.015f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 10268.2f, 251f, 0f, 0x20&#125; &#41; &#41;;
DrivingIncarSports = new Environment &#40; new float&#91;&#93;&#123; 26, 1.1f, 0.800f, -1000, -400, 0, 0.17f, 0.75f, 0.41f, 0, 0.010f, 0f, 0f, 0f, -500, 0f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 10268.2f, 251f, 0f, 0x20&#125; &#41; &#41;;
DrivingIncarLuxury = new Environment &#40; new float&#91;&#93;&#123; 26, 1.6f, 1f, -1000, -2000, -600, 0.13f, 0.41f, 0.46f, -200, 0.010f, 0f, 0f, 0f, 400, 0.010f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 10268.2f, 251f, 0f, 0x20&#125; &#41; &#41;;
DrivingFullgrandstand = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 1f, -1000, -1100, -400, 3.01f, 1.37f, 1.28f, -900, 0.090f, 0f, 0f, 0f, -1500, 0.049f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 10420.2f, 250f, 0f, 0x1f&#125; &#41; &#41;;
DrivingEmptygrandstand = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 1f, -1000, 0, -200, 4.62f, 1.75f, 1.40f, -1363, 0.090f, 0f, 0f, 0f, -1200, 0.049f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 10420.2f, 250f, 0f, 0x1f&#125; &#41; &#41;;
DrivingTunnel = new Environment &#40; new float&#91;&#93;&#123; 16, 7.5f, 0.500f, -1000, -800, 0, 1.49f, 0.67f, 1f, -2273, 0.007f, 0f, 0f, 0f, -1691, 0.011f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
DrivingTunnel = new Environment &#40; new float&#91;&#93;&#123; 26, 3.1f, 0.810f, -1000, -800, -100, 3.42f, 0.94f, 1.31f, -300, 0.051f, 0f, 0f, 0f, -300, 0.047f, 0f, 0f, 0f, 0.214f, 0.050f, 0.250f, 0f, -5f, 5000f, 155.3f, 0f, 0x20&#125; &#41; &#41;;</pre>
</div>
<h2><a>City</a></h2>
<div>
<pre>CityIndoors = new Environment &#40; new float&#91;&#93;&#123; 16, 7.5f, 0.500f, -1000, -800, 0, 1.49f, 0.67f, 1f, -2273, 0.007f, 0f, 0f, 0f, -1691, 0.011f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
CityStreets = new Environment &#40; new float&#91;&#93;&#123; 26, 3f, 0.780f, -1000, -300, -100, 1.79f, 1.12f, 0.91f, -1100, 0.046f, 0f, 0f, 0f, -1400, 0.028f, 0f, 0f, 0f, 0.250f, 0.200f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x20&#125; &#41; &#41;;
CitySubway = new Environment &#40; new float&#91;&#93;&#123; 26, 3f, 0.740f, -1000, -300, -100, 3.01f, 1.23f, 0.91f, -300, 0.046f, 0f, 0f, 0f, 200, 0.028f, 0f, 0f, 0f, 0.125f, 0.210f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x20&#125; &#41; &#41;;
CityMuseum = new Environment &#40; new float&#91;&#93;&#123; 26, 80.3f, 0.820f, -1000, -1500, -1500, 3.28f, 1.40f, 0.57f, -1200, 0.039f, 0f, 0f, -0f, -100, 0.034f, 0f, 0f, 0f, 0.130f, 0.170f, 0.250f, 0f, -5f, 2854.4f, 107.5f, 0f, 0x0&#125; &#41; &#41;;
CityLibrary = new Environment &#40; new float&#91;&#93;&#123; 26, 80.3f, 0.820f, -1000, -1100, -2100, 2.76f, 0.89f, 0.41f, -900, 0.029f, 0f, 0f, -0f, -100, 0.020f, 0f, 0f, 0f, 0.130f, 0.170f, 0.250f, 0f, -5f, 2854.4f, 107.5f, 0f, 0x0&#125; &#41; &#41;;
CityUnderpass = new Environment &#40; new float&#91;&#93;&#123; 26, 3f, 0.820f, -1000, -700, -100, 3.57f, 1.12f, 0.91f, -800, 0.059f, 0f, 0f, 0f, -100, 0.037f, 0f, 0f, 0f, 0.250f, 0.140f, 0.250f, 0f, -7f, 5000f, 250f, 0f, 0x20&#125; &#41; &#41;;
CityAbandoned = new Environment &#40; new float&#91;&#93;&#123; 2, 1.9f, 1f, -1000, -454, 0, 0.40f, 0.83f, 1f, -1646, 0.002f, 0f, 0f, 0f, 53, 0.003f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
CityAbandoned = new Environment &#40; new float&#91;&#93;&#123; 26, 3f, 0.690f, -1000, -200, -100, 3.28f, 1.17f, 0.91f, -700, 0.044f, 0f, 0f, 0f, -1100, 0.024f, 0f, 0f, 0f, 0.250f, 0.200f, 0.250f, 0f, -3f, 5000f, 250f, 0f, 0x20&#125; &#41; &#41;;</pre>
</div>
<h2><a>Small Indoor Rooms</a></h2>
<div>
<pre>Room = new Environment &#40; new float&#91;&#93;&#123; 2, 1.9f, 1f, -1000, -454, 0, 0.40f, 0.83f, 1f, -1646, 0.002f, 0f, 0f, 0f, 53, 0.003f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Bathroom = new Environment &#40; new float&#91;&#93;&#123; 3, 1.4f, 1f, -1000, -1200, 0, 1.49f, 0.54f, 1f, -370, 0.007f, 0f, 0f, 0f, 1030, 0.011f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Livingroom = new Environment &#40; new float&#91;&#93;&#123; 4, 2.5f, 1f, -1000, -6000, 0, 0.50f, 0.10f, 1f, -1376, 0.003f, 0f, 0f, 0f, -1104, 0.004f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Paddedcell = new Environment &#40; new float&#91;&#93;&#123; 1, 1.4f, 1f, -1000, -6000, 0, 0.17f, 0.10f, 1f, -1204, 0.001f, 0f, 0f, 0f, 207, 0.002f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Stoneroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.9f, 1f, -1000, -1700, -800, 0.76f, 1f, 1f, 0, 0.012f, 0f, 0f, 0f, 100, 0.012f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x0&#125; &#41; &#41;;
Stoneroom = new Environment &#40; new float&#91;&#93;&#123; 5, 11.6f, 1f, -1000, -300, 0, 2.31f, 0.64f, 1f, -711, 0.012f, 0f, 0f, 0f, 83, 0.017f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;</pre>
</div>
<h2><a>Medium-Sized Indoor Rooms</a></h2>
<div>
<pre>Workshop = new Environment &#40; new float&#91;&#93;&#123; 26, 1.9f, 1f, -1000, -1700, -800, 0.76f, 1f, 1f, 0, 0.012f, 0f, 0f, 0f, 100, 0.012f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x0&#125; &#41; &#41;;
Schoolroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.86f, 0.690f, -1000, -400, -600, 0.98f, 0.45f, 0.18f, 300, 0.017f, 0f, 0f, 0f, 300, 0.015f, 0f, 0f, 0f, 0.095f, 0.140f, 0.250f, 0f, -5f, 7176.9f, 211.2f, 0f, 0x20&#125; &#41; &#41;;
Practiseroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.86f, 0.870f, -1000, -800, -600, 1.12f, 0.56f, 0.18f, 200, 0.010f, 0f, 0f, 0f, 300, 0.011f, 0f, 0f, 0f, 0.095f, 0.140f, 0.250f, 0f, -5f, 7176.9f, 211.2f, 0f, 0x20&#125; &#41; &#41;;
Outhouse = new Environment &#40; new float&#91;&#93;&#123; 26, 80.3f, 0.820f, -1000, -1900, -1600, 1.38f, 0.38f, 0.35f, -100, 0.024f, 0f, 0f, -0f, -400, 0.044f, 0f, 0f, 0f, 0.121f, 0.170f, 0.250f, 0f, -5f, 2854.4f, 107.5f, 0f, 0x0&#125; &#41; &#41;;
Caravan = new Environment &#40; new float&#91;&#93;&#123; 26, 8.3f, 1f, -1000, -2100, -1800, 0.43f, 1.50f, 1f, 0, 0.012f, 0f, 0f, 0f, 600, 0.012f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x1f&#125; &#41; &#41;;
Dustyroom = new Environment &#40; new float&#91;&#93;&#123; 26, 1.8f, 0.560f, -1000, -200, -300, 1.79f, 0.38f, 0.21f, -600, 0.002f, 0f, 0f, 0f, 200, 0.006f, 0f, 0f, 0f, 0.202f, 0.050f, 0.250f, 0f, -10f, 13046f, 163.3f, 0f, 0x20&#125; &#41; &#41;;
Chapel = new Environment &#40; new float&#91;&#93;&#123; 6, 21.6f, 1f, -1000, -476, 0, 4.32f, 0.59f, 1f, -789, 0.020f, 0f, 0f, 0f, -289, 0.030f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Chapel = new Environment &#40; new float&#91;&#93;&#123; 26, 19.6f, 0.840f, -1000, -500, 0, 4.62f, 0.64f, 1.23f, -700, 0.032f, 0f, 0f, 0f, -200, 0.049f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0.110f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;</pre>
</div>
<h2><a>Large Indoor Rooms</a></h2>
<div>
<pre>Auditorium = new Environment &#40; new float&#91;&#93;&#123; 6, 21.6f, 1f, -1000, -476, 0, 4.32f, 0.59f, 1f, -789, 0.020f, 0f, 0f, 0f, -289, 0.030f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Concerthall = new Environment &#40; new float&#91;&#93;&#123; 7, 19.6f, 1f, -1000, -500, 0, 3.92f, 0.70f, 1f, -1230, 0.020f, 0f, 0f, 0f, -02, 0.029f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Cave = new Environment &#40; new float&#91;&#93;&#123; 8, 14.6f, 1f, -1000, 0, 0, 2.91f, 1.30f, 1f, -602, 0.015f, 0f, 0f, 0f, -302, 0.022f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x1f&#125; &#41; &#41;;
Arena = new Environment &#40; new float&#91;&#93;&#123; 9, 36.2f, 1f, -1000, -698, 0, 7.24f, 0.33f, 1f, -1166, 0.020f, 0f, 0f, 0f, 16, 0.030f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Hangar = new Environment &#40; new float&#91;&#93;&#123; 10, 50.3f, 1f, -1000, -1000, 0, 10.05f, 0.23f, 1f, -602, 0.020f, 0f, 0f, 0f, 198, 0.030f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
DomeTomb = new Environment &#40; new float&#91;&#93;&#123; 26, 51.8f, 0.790f, -1000, -900, -1300, 4.18f, 0.21f, 0.10f, -825, 0.030f, 0f, 0f, 0f, 450, 0.022f, 0f, 0f, 0f, 0.177f, 0.190f, 0.250f, 0f, -5f, 2854.4f, 20f, 0f, 0x0&#125; &#41; &#41;;
DomeSaintPauls = new Environment &#40; new float&#91;&#93;&#123; 11, 1.9f, 1f, -1000, -4000, 0, 0.30f, 0.10f, 1f, -1831, 0.002f, 0f, 0f, 0f, -1630, 0.030f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
DomeSaintPauls = new Environment &#40; new float&#91;&#93;&#123; 26, 50.3f, 0.870f, -1000, -900, -1300, 10.48f, 0.19f, 0.10f, -1500, 0.090f, 0f, 0f, 0f, 200, 0.042f, 0f, 0f, 0f, 0.250f, 0.120f, 0.250f, 0f, -5f, 2854.4f, 20f, 0f, 0x3f&#125; &#41; &#41;;</pre>
</div>
<h2><a>Hallways, Alleys</a></h2>
<div>
<pre>Carpettedhallway = new Environment &#40; new float&#91;&#93;&#123; 11, 1.9f, 1f, -1000, -4000, 0, 0.30f, 0.10f, 1f, -1831, 0.002f, 0f, 0f, 0f, -1630, 0.030f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Hallway = new Environment &#40; new float&#91;&#93;&#123; 12, 1.8f, 1f, -1000, -300, 0, 1.49f, 0.59f, 1f, -1219, 0.007f, 0f, 0f, 0f, 441, 0.011f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Stonecorridor = new Environment &#40; new float&#91;&#93;&#123; 13, 13.5f, 1f, -1000, -237, 0, 2.70f, 0.79f, 1f, -1214, 0.013f, 0f, 0f, 0f, 395, 0.020f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Alley = new Environment &#40; new float&#91;&#93;&#123; 26, 80.3f, 0.450f, -1000, -1200, -600, 1.12f, 0.34f, 0.46f, -700, 0.069f, 0f, 0f, -0f, -300, 0.023f, 0f, 0f, 0f, 0.218f, 0.340f, 0.250f, 0f, -5f, 4399.1f, 242.9f, 0f, 0x0&#125; &#41; &#41;;
Alley = new Environment &#40; new float&#91;&#93;&#123; 14, 7.5f, 0.300f, -1000, -270, 0, 1.49f, 0.86f, 1f, -1204, 0.007f, 0f, 0f, 0f, -4, 0.011f, 0f, 0f, 0f, 0.125f, 0.950f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;</pre>
</div>
<h2><a>Outdoors</a></h2>
<div>
<pre>Backyard = new Environment &#40; new float&#91;&#93;&#123; 26, 80.3f, 0.450f, -1000, -1200, -600, 1.12f, 0.34f, 0.46f, -700, 0.069f, 0f, 0f, -0f, -300, 0.023f, 0f, 0f, 0f, 0.218f, 0.340f, 0.250f, 0f, -5f, 4399.1f, 242.9f, 0f, 0x0&#125; &#41; &#41;;
Plain = new Environment &#40; new float&#91;&#93;&#123; 19, 42.5f, 0.210f, -1000, -2000, 0, 1.49f, 0.50f, 1f, -2466, 0.179f, 0f, 0f, 0f, -1926, 0.100f, 0f, 0f, 0f, 0.250f, 1f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Rollingplains = new Environment &#40; new float&#91;&#93;&#123; 26, 80.3f, 0f, -1000, -3900, -400, 2.13f, 0.21f, 0.46f, -1500, 0.300f, 0f, 0f, -0f, -700, 0.019f, 0f, 0f, 0f, 0.250f, 1f, 0.250f, 0f, -5f, 4399.1f, 242.9f, 0f, 0x0&#125; &#41; &#41;;
Deepcanyon = new Environment &#40; new float&#91;&#93;&#123; 26, 80.3f, 0.740f, -1000, -1500, -400, 3.89f, 0.21f, 0.46f, -1000, 0.223f, 0f, 0f, -0f, -900, 0.019f, 0f, 0f, 0f, 0.250f, 1f, 0.250f, 0f, -5f, 4399.1f, 242.9f, 0f, 0x0&#125; &#41; &#41;;
@ -96,6 +199,14 @@ Valley = new Environment &#40; new float&#91;&#93;&#123; 26, 80.3f, 0.280
Forest = new Environment &#40; new float&#91;&#93;&#123; 15, 38f, 0.300f, -1000, -3300, 0, 1.49f, 0.54f, 1f, -2560, 0.162f, 0f, 0f, 0f, -229, 0.088f, 0f, 0f, 0f, 0.125f, 1f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Mountains = new Environment &#40; new float&#91;&#93;&#123; 17, 100f, 0.270f, -1000, -2500, 0, 1.49f, 0.21f, 1f, -2780, 0.300f, 0f, 0f, 0f, -1434, 0.100f, 0f, 0f, 0f, 0.250f, 1f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x1f&#125; &#41; &#41;;
Quarry = new Environment &#40; new float&#91;&#93;&#123; 18, 17.5f, 1f, -1000, -1000, 0, 1.49f, 0.83f, 1f, -10000, 0.061f, 0f, 0f, 0f, 500, 0.025f, 0f, 0f, 0f, 0.125f, 0.700f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Parkinglot = new Environment &#40; new float&#91;&#93;&#123; 22, 1.8f, 1f, -1000, -4000, 0, 1.49f, 0.10f, 1f, -449, 0.007f, 0f, 0f, 0f, 1700, 0.011f, 0f, 0f, 0f, 0.250f, 0f, 1.180f, 0.348f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Smallwaterroom = new Environment &#40; new float&#91;&#93;&#123; 26, 36.2f, 0.700f, -1000, -698, 0, 1.51f, 1.25f, 1.14f, -100, 0.020f, 0f, 0f, 0f, 300, 0.030f, 0f, 0f, 0f, 0.179f, 0.150f, 0.895f, 0.190f, -7f, 5000f, 250f, 0f, 0x0&#125; &#41; &#41;;</pre></div>
Parkinglot = new Environment &#40; new float&#91;&#93;&#123; 20, 8.3f, 1f, -1000, 0, 0, 1.65f, 1.50f, 1f, -1363, 0.008f, 0f, 0f, 0f, -1153, 0.012f, 0f, 0f, 0f, 0.250f, 0f, 0.250f, 0f, -5f, 5000f, 250f, 0f, 0x1f&#125; &#41; &#41;;</pre>
</div>
<h2><a>Water</a></h2>
<div>
<pre>Underwater = new Environment &#40; new float&#91;&#93;&#123; 22, 1.8f, 1f, -1000, -4000, 0, 1.49f, 0.10f, 1f, -449, 0.007f, 0f, 0f, 0f, 1700, 0.011f, 0f, 0f, 0f, 0.250f, 0f, 1.180f, 0.348f, -5f, 5000f, 250f, 0f, 0x3f&#125; &#41; &#41;;
Smallwaterroom = new Environment &#40; new float&#91;&#93;&#123; 26, 36.2f, 0.700f, -1000, -698, 0, 1.51f, 1.25f, 1.14f, -100, 0.020f, 0f, 0f, 0f, 300, 0.030f, 0f, 0f, 0f, 0.179f, 0.150f, 0.895f, 0.190f, -7f, 5000f, 250f, 0f, 0x0&#125; &#41; &#41;;</pre>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:audio_environment_presets?do=export_xhtmlbody">view online version</a></em></p>

@ -1,7 +1,96 @@
<h1><a>Bloom and Glow</a></h1><div><p>Bloom is a popular shader effect in 3D games industry. It usually consist in displaying a glowing halo around light sources or bright areas of a scene. In practice, the bright areas are extracted from the rendered scene, blurred and finally added up to the render.</p><p>Those images gives an idea of what bloom does. The left image has no bloom effect, the right image does. <br/> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nobloomsky.png"><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/blomsky.png"></p></div><h1><a>Bloom Usage</a></h1><div><ol><li><div>Create a FilterPostProcessor</div></li><li><div>Create a BloomFilter</div></li><li><div>Add the filter to the processor</div></li><li><div>Add the processor to the viewPort</div></li></ol><pre> FilterPostProcessor fpp=new FilterPostProcessor&#40;assetManager&#41;;
<h1><a>Bloom and Glow</a></h1>
<div>
<p>
Bloom is a popular shader effect in 3D games industry. It usually consist in displaying a glowing halo around light sources or bright areas of a scene.
In practice, the bright areas are extracted from the rendered scene, blurred and finally added up to the render.
</p>
<p>
Those images gives an idea of what bloom does. The left image has no bloom effect, the right image does. <br/>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nobloomsky.png"><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/blomsky.png">
</p>
</div>
<h1><a>Bloom Usage</a></h1>
<div>
<ol>
<li><div> Create a FilterPostProcessor</div>
</li>
<li><div> Create a BloomFilter</div>
</li>
<li><div> Add the filter to the processor</div>
</li>
<li><div> Add the processor to the viewPort</div>
</li>
</ol>
<pre> FilterPostProcessor fpp=new FilterPostProcessor&#40;assetManager&#41;;
BloomFilter bloom=new BloomFilter&#40;&#41;;
fpp.addFilter&#40;bloom&#41;;
viewPort.addProcessor&#40;fpp&#41;;</pre><p>Here are the parameters that you can tweak :</p><div><table><tr><th>Parameter</th><th>Method</th><th>Default</th><th>Description</th></tr><tr><td>blur scale</td><td><code>setBlurScale(float)</code></td><td>1.5f</td><td>the scale of the bloom effect, but be careful, high values does artifacts</td></tr><tr><td>exposure Power</td><td><code>setExposurePower(float)</code></td><td>5.0f</td><td>the glowing channel color is raised to the value power</td></tr><tr><td>exposure cut-off</td><td><code>setExposureCutOff(float)</code></td><td>0.0f</td><td>the threshold of color to bloom during extraction</td></tr><tr><td>bloom intensity</td><td><code>setBloomIntensity(float)</code></td><td>2.0f</td><td>the resulting bloom value is multiplied by this intensity</td></tr></table></div><p>You&#039;ll probably need to adjust those parameters depending on your scene.</p></div><h1><a>Bloom with a glow map</a></h1><div><p>Sometimes, you want to have more control over what glows and does not glow. The bloom filter supports a glow map or a glow color.</p></div><h5><a>Creating a glow-map</a></h5><div><p>Let&#039;s take the hover tank example bundled with JME3 test data.<br/> Here you can see the diffuse map of the tank, and the associated glow map that only contains the parts of the texture that will glow and their glowing color: <br/> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/tank_diffuse_ss.png"> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/tank_glow_map_ss.png"></p><p>Glow maps works with Lighting.j3md, Particles.j3md and SolidColor.j3md material definitions. The tank material looks like that :</p><pre>Material My Material : Common/MatDefs/Light/Lighting.j3md {
viewPort.addProcessor&#40;fpp&#41;;</pre>
<p>
Here are the parameters that you can tweak :
</p>
<div><table>
<tr>
<th> Parameter </th><th> Method </th><th> Default </th><th> Description </th>
</tr>
<tr>
<td> blur scale </td><td> <code>setBlurScale(float)</code> </td><td>1.5f </td><td> the scale of the bloom effect, but be careful, high values does artifacts </td>
</tr>
<tr>
<td> exposure Power </td><td> <code>setExposurePower(float)</code> </td><td>5.0f </td><td> the glowing channel color is raised to the value power </td>
</tr>
<tr>
<td> exposure cut-off </td><td> <code>setExposureCutOff(float)</code> </td><td>0.0f </td><td> the threshold of color to bloom during extraction </td>
</tr>
<tr>
<td> bloom intensity </td><td> <code>setBloomIntensity(float)</code> </td><td>2.0f </td><td> the resulting bloom value is multiplied by this intensity </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [865-1454] -->
<p>
You&#039;ll probably need to adjust those parameters depending on your scene.
</p>
</div>
<h1><a>Bloom with a glow map</a></h1>
<div>
<p>
Sometimes, you want to have more control over what glows and does not glow.
The bloom filter supports a glow map or a glow color.
</p>
</div>
<h5><a>Creating a glow-map</a></h5>
<div>
<p>
Let&#039;s take the hover tank example bundled with JME3 test data.<br/>
Here you can see the diffuse map of the tank, and the associated glow map that only contains the parts of the texture that will glow and their glowing color: <br/>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/tank_diffuse_ss.png">
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/tank_glow_map_ss.png">
</p>
<p>
Glow maps works with Lighting.j3md, Particles.j3md and SolidColor.j3md material definitions.
The tank material looks like that :
</p>
<pre>Material My Material : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
SpecularMap : Models/HoverTank/tank_specular.png
Shininess : 8
@ -13,17 +102,132 @@
Diffuse : 1.0 1.0 1.0 1.0
Specular : 1.0 1.0 1.0 1.0
}
}</pre><p>The glow map is defined here : <strong>GlowMap : Models/HoverTank/tank_glow_map_highres.png</strong></p></div><h5><a>Usage</a></h5><div><ol><li><div>Create a FilterPostProcessor</div></li><li><div>Create a BloomFilter with the GlowMode.Objects parameter</div></li><li><div>Add the filter to the processor</div></li><li><div>Add the processor to the viewPort</div></li></ol><pre> FilterPostProcessor fpp=new FilterPostProcessor(assetManager);
}</pre>
<p>
The glow map is defined here : <strong>GlowMap : Models/HoverTank/tank_glow_map_highres.png</strong>
</p>
</div>
<h5><a>Usage</a></h5>
<div>
<ol>
<li><div> Create a FilterPostProcessor</div>
</li>
<li><div> Create a BloomFilter with the GlowMode.Objects parameter</div>
</li>
<li><div> Add the filter to the processor</div>
</li>
<li><div> Add the processor to the viewPort</div>
</li>
</ol>
<pre> FilterPostProcessor fpp=new FilterPostProcessor(assetManager);
BloomFilter bf=new BloomFilter(BloomFilter.GlowMode.Objects);
fpp.addFilter(bf);
viewPort.addProcessor(fpp);</pre><p>Here is the result : <br/> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/tanlglow1.png"></p></div><h1><a>Bloom with a glow color</a></h1><div><p>Sometimes you need an entire object to glow, not just parts of it. In this case you&#039;ll need to use the glow color parameter.</p></div><h5><a>Usage</a></h5><div><ol><li><div>Create a material for your object and set the GlowColor parameter</div></li><li><div>Create a FilterPostProcessor</div></li><li><div>Create a BloomFilter with the GlowMode.Objects parameter</div></li><li><div>Add the filter to the processor</div></li><li><div>Add the processor to the viewPort</div></li></ol><pre> Material mat = new Material(getAssetManager(), &quot;Common/MatDefs/Misc/SolidColor.j3md&quot;);
viewPort.addProcessor(fpp);</pre>
<p>
Here is the result : <br/>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/tanlglow1.png">
</p>
</div>
<h1><a>Bloom with a glow color</a></h1>
<div>
<p>
Sometimes you need an entire object to glow, not just parts of it.
In this case you&#039;ll need to use the glow color parameter.
</p>
</div>
<h5><a>Usage</a></h5>
<div>
<ol>
<li><div> Create a material for your object and set the GlowColor parameter</div>
</li>
<li><div> Create a FilterPostProcessor</div>
</li>
<li><div> Create a BloomFilter with the GlowMode.Objects parameter</div>
</li>
<li><div> Add the filter to the processor</div>
</li>
<li><div> Add the processor to the viewPort</div>
</li>
</ol>
<pre> Material mat = new Material(getAssetManager(), &quot;Common/MatDefs/Misc/SolidColor.j3md&quot;);
mat.setColor(&quot;Color&quot;, ColorRGBA.Green);
mat.setColor(&quot;GlowColor&quot;, ColorRGBA.Green);
fpp=new FilterPostProcessor(assetManager);
bloom= new BloomFilter(BloomFilter.GlowMode.Objects);
fpp.addFilter(bloom);
viewPort.addProcessor(fpp);</pre><p>Here is the result on Oto&#039;s plasma ball (before and after) : <br/> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/otonobloom.png"> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/otoglow.png"></p></div><h1><a>Hints and tricks</a></h1><div></div><h5><a>Increasing the blur range and reducing fps cost</a></h5><div><p>The glow render is sampled on a texture that has the same dimensions as the viewport. You can reduce the size of the bloom sampling just by using the setDownSamplingFactor method like this : <br/></p><pre> BloomFilter bloom=new BloomFilter&#40;&#41;;
bloom.setDownSamplingFactor&#40;2.0f&#41;; </pre><p>In this example the sampling size is divided by 4 (width/2,height/2), resulting in less work to blur the scene. The resulting texture is then up sampled to the screen size using hardware bilinear filtering. this results in a wider blur range.</p></div><h5><a>Using classic bloom combined with a glow map</a></h5><div><p>let&#039;s say you want a global bloom on your scene, but you have also a glowing object on it. You can use only one bloom filter for both effects like that</p><pre>BloomFilter bloom=new BloomFilter&#40;BloomFilter.GlowMode.SceneAndObjects&#41;;</pre><p>However, note that both effects will share the same values of attribute, and sometimes, it won&#039;t be what you need.</p></div><h5><a>Making your home brewed material definition support Glow</a></h5><div><p>Let&#039;s say you have made a custom material on your own, and that you want it to support glow maps and glow color. In your material definition you need to add those lines in the MaterialParameters section :</p><pre> MaterialParameters {
viewPort.addProcessor(fpp);</pre>
<p>
Here is the result on Oto&#039;s plasma ball (before and after) : <br/>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/otonobloom.png">
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/otoglow.png">
</p>
</div>
<h1><a>Hints and tricks</a></h1>
<div>
</div>
<h5><a>Increasing the blur range and reducing fps cost</a></h5>
<div>
<p>
The glow render is sampled on a texture that has the same dimensions as the viewport.
You can reduce the size of the bloom sampling just by using the setDownSamplingFactor method like this : <br/>
</p>
<pre> BloomFilter bloom=new BloomFilter&#40;&#41;;
bloom.setDownSamplingFactor&#40;2.0f&#41;; </pre>
<p>
In this example the sampling size is divided by 4 (width/2,height/2), resulting in less work to blur the scene.
The resulting texture is then up sampled to the screen size using hardware bilinear filtering. this results in a wider blur range.
</p>
</div>
<h5><a>Using classic bloom combined with a glow map</a></h5>
<div>
<p>
let&#039;s say you want a global bloom on your scene, but you have also a glowing object on it.
You can use only one bloom filter for both effects like that
</p>
<pre>BloomFilter bloom=new BloomFilter&#40;BloomFilter.GlowMode.SceneAndObjects&#41;;</pre>
<p>
However, note that both effects will share the same values of attribute, and sometimes, it won&#039;t be what you need.
</p>
</div>
<h5><a>Making your home brewed material definition support Glow</a></h5>
<div>
<p>
Let&#039;s say you have made a custom material on your own, and that you want it to support glow maps and glow color.
In your material definition you need to add those lines in the MaterialParameters section :
</p>
<pre> MaterialParameters {
....
@ -31,7 +235,13 @@
Texture2D GlowMap
// The glow color of the object
Color GlowColor
}</pre><p>Then add the following technique :</p><pre> Technique Glow {
}</pre>
<p>
Then add the following technique :
</p>
<pre> Technique Glow {
LightMode SinglePass
@ -46,5 +256,29 @@
HAS_GLOWMAP : GlowMap
HAS_GLOWCOLOR : GlowColor
}
}</pre><p>Then you can use this material with the BloomFilter</p></div><h5><a>Make a glowing object stop to glow</a></h5><div><p>If you are using a glow map, remove the texture from the material.</p><pre>material.clearTextureParam(&quot;GlowMap&quot;);</pre><p>If you are using a glow color, set it to black</p><pre>material.setColor(&quot;GlowColor&quot;,ColorRGBA.Black);</pre></div>
}</pre>
<p>
Then you can use this material with the BloomFilter
</p>
</div>
<h5><a>Make a glowing object stop to glow</a></h5>
<div>
<p>
If you are using a glow map, remove the texture from the material.
</p>
<pre>material.clearTextureParam(&quot;GlowMap&quot;);</pre>
<p>
If you are using a glow color, set it to black
</p>
<pre>material.setColor(&quot;GlowColor&quot;,ColorRGBA.Black);</pre>
</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>

@ -1,4 +1,47 @@
<h1><a>Multithreading Bullet Physics in jme3</a></h1><div></div><h2><a>Introduction</a></h2><div><p>Since bullet is not (yet) multithreaded or GPU accelerated the jME3 implementation allows to run each physics space on a separate thread that is executed in parallel to rendering.</p></div><h2><a>How is it handled in jme3 and bullet?</a></h2><div><p>A SimpleApplication with a BulletAppState allows setting the threading type via</p><pre>setThreadingType(ThreadingType type);</pre><p>where ThreadingType can be either SEQUENTIAL or PARALLEL.</p><p>In the simpleInitApp() method:</p><pre>bulletAppState = new BulletAppState&#40;&#41;;
<h1><a>Multithreading Bullet Physics in jme3</a></h1>
<div>
</div>
<h2><a>Introduction</a></h2>
<div>
<p>
Since bullet is not (yet) multithreaded or GPU accelerated the jME3 implementation allows to run each physics space on a separate thread that is executed in parallel to rendering.
</p>
</div>
<h2><a>How is it handled in jme3 and bullet?</a></h2>
<div>
<p>
A SimpleApplication with a BulletAppState allows setting the threading type via
</p>
<pre>setThreadingType(ThreadingType type);</pre>
<p>
where ThreadingType can be either SEQUENTIAL or PARALLEL.
</p>
<p>
In the simpleInitApp() method:
</p>
<pre>bulletAppState = new BulletAppState&#40;&#41;;
bulletAppState.setThreadingType&#40;BulletAppState.ThreadingType.PARALLEL&#41;;
stateManager.attach&#40;bulletAppState&#41;;</pre><p>The physics update happens in parallel to rendering, after the users changes have been made in the update() call. This way the loop logic is still maintained: the user can set and change values in physics and scenegraph objects before render() and physicsUpdate() are called in parallel. More physics spaces can simply be added by using multiple bulletAppStates.</p><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>, <a href="/wiki/doku.php/tag:threading?do=showtag&amp;tag=tag%3Athreading">threading</a> </span></div></div>
stateManager.attach&#40;bulletAppState&#41;;</pre>
<p>
The physics update happens in parallel to rendering, after the users changes have been made in the update() call. This way the loop logic is still maintained: the user can set and change values in physics and scenegraph objects before render() and physicsUpdate() are called in parallel. More physics spaces can simply be added by using multiple bulletAppStates.
</p>
<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>,
<a href="/wiki/doku.php/tag:threading?do=showtag&amp;tag=tag%3Athreading">threading</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:bullet_multithreading?do=export_xhtmlbody">view online version</a></em></p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

@ -64,10 +64,10 @@ The camera object is created with the following defaults:
<td>cam.resize(width, height, fixAspect)</td><td>Resize an existing camera object while keeping all other settings. Set fixAspect to true to adjust the aspect ratio (?)</td>
</tr>
<tr>
<td>cam.setFrustum( near, far, left, right, top, bottom )</td><td>The frustrum is defined by the near/far plane, left/rught plane, top/bottom plane (all distances as float values)</td>
<td>cam.setFrustum( near, far, left, right, top, bottom )</td><td>The frustum is defined by the near/far plane, left/rught plane, top/bottom plane (all distances as float values)</td>
</tr>
<tr>
<td>cam.setFrustumPerspective( fovY, aspect ratio, near, far)</td><td>The frustrum is defined by view angle along the Y axis (in degrees), aspect ratio, and the near/far plane.</td>
<td>cam.setFrustumPerspective( fovY, aspect ratio, near, far)</td><td>The frustum is defined by view angle along the Y axis (in degrees), aspect ratio, and the near/far plane.</td>
</tr>
<tr>
<td>cam.lookAt(target,up)</td><td>Turn the camera to look at Coordinate target, and rotate it around the up axis.</td>
@ -82,9 +82,9 @@ The camera object is created with the following defaults:
<td>cam.getScreenCoordinates()</td><td>?</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [583-1860] -->
<!-- EDIT1 TABLE [583-1858] -->
<p>
<strong>Tip:</strong> After you change view port, frustrum, or frame, call <code>cam.update();</code>
<strong>Tip:</strong> After you change view port, frustum, or frame, call <code>cam.update();</code>
</p>
</div>
@ -114,7 +114,7 @@ The flyby camera is an extension of the default camera in com.jme3.app.SimpleApp
<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>
</tr>
</table></div>
<!-- EDIT2 TABLE [2298-2649] -->
<!-- EDIT2 TABLE [2295-2646] -->
</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 [2958-4430] --><div><span>
<!-- EDIT3 TABLE [2955-4427] --><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>

@ -0,0 +1,652 @@
<h1><a>Capture Audio/Video to a File</a></h1>
<div>
<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
game itself. Screen capturing is the most straightforward way to do
this, but it can slow down your game and produce low-quality video and
audio as a result. A better way is to record video and audio directly
from the game while it is running.
</p>
<p>
<p><div>Combine this method with jMonkeyEngine&#039;s
<a href="/com/jme3/gde/core/docs/jme3/advanced/cinematics.html">Cinematics</a>
feature to record high-quality game trailers!
</div></p>
</p>
</div>
<h2><a>Simple Way</a></h2>
<div>
<p>
First off, if all you need is to record video at 30fps with no sound, then look
no further then jMonkeyEngine3&#039;s built in <code>VideoRecorderAppState</code>
class.
</p>
<p>
Add the following code to your <code>simpleInitApp()</code> method.
</p>
<pre>stateManager.attach&#40;new VideoRecorderAppState&#40;&#41;&#41;; //start recording</pre>
<p>
The game will run slow, but the recording will be in high-quality and
normal speed. The video files will be stored in your user home
directory, if you want to save to another file, specify it in the
VideoRecorderAppState constructor. Recording starts when the state is
attached and ends when the application quits or the state is detached.
</p>
<p>
That&#039;s all!
</p>
</div>
<h2><a>Advanced Way</a></h2>
<div>
<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:
</p>
<p>
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.aurellem.com/releases/jmeCapture-latest.zip"><param name="text" value="<html><u>http://www.aurellem.com/releases/jmeCapture-latest.zip</u></html>"><param name="textColor" value="blue"></object>
</p>
<p>
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.aurellem.com/releases/jmeCapture-latest.tar.bz2"><param name="text" value="<html><u>http://www.aurellem.com/releases/jmeCapture-latest.tar.bz2</u></html>"><param name="textColor" value="blue"></object>
</p>
<p>
Download the archive in your preferred format, extract,
add the jars to your project, and you are ready to go.
</p>
<p>
The javadoc is here:
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.aurellem.com/jmeCapture/docs/"><param name="text" value="<html><u>http://www.aurellem.com/jmeCapture/docs/</u></html>"><param name="textColor" value="blue"></object>
</p>
<p>
To capture video and audio you use the
<code>com.aurellem.capture.Capture</code> class, which has two methods,
<code>captureAudio()</code> and <code>captureVideo()</code>, and the
<code>com.aurellem.capture.IsoTimer</code> class, which sets the audio and
video framerate.
</p>
<p>
The steps are:
</p>
<pre>yourApp.setTimer&#40;new IsoTimer&#40;desiredFramesPerSecond&#41;&#41;;</pre>
<p>
This causes jMonkeyEngine to take as much time as it needs to fully
calculate every frame of the video and audio. You will see your game
speed up and slow down depending on how computationally demanding your
game is, but the final recorded audio and video will be perfectly
sychronized and will run at exactly the fps which you specified.
</p>
<pre>captureVideo&#40;yourApp, targetVideoFile&#41;;
captureAudio&#40;yourApp, targetAudioFile&#41;;</pre>
<p>
These will cause the app to record audio and video when it is run.
Audio and video will stop being recorded when the app stops. Your
audio will be recorded as a 44,100 Hz linear PCM wav file, while the
video will be recorded according to the following rules:
</p>
<p>
1.) (Preferred) If you supply an empty directory as the file, then
the video will be saved as a sequence of .png files, one file per
frame. The files start at 0000000.png and increment from there.
You can then combine the frames into your preferred
container/codec. If the directory is not empty, then writing
video frames to it will fail, and nothing will be written.
</p>
<p>
2.) If the filename ends in &quot;.avi&quot; then the frames will be encoded as
a RAW stream inside an AVI 1.0 container. The resulting file
will be quite large and you will probably want to re-encode it to
your preferred container/codec format. Be advised that some
video payers cannot process AVI with a RAW stream, and that AVI
1.0 files generated by this method that exceed 2.0GB are invalid
according to the AVI 1.0 <acronym title="specification">spec</acronym> (but many programs can still deal
with them.) Thanks to
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.randelshofer.ch/blog/2008/08/writing-avi-videos-in-pure-java/"><param name="text" value="<html><u>Werner Randelshofer</u></html>"><param name="textColor" value="blue"></object>
for his excellent work which made the AVI file writer option possible.
</p>
<p>
3.) Any non-directory file ending in anything other than &quot;.avi&quot; will
be processed through Xuggle. Xuggle provides the option to use
many codecs/containers, but you will have to install it on your
system yourself in order to use this option. Please visit
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.xuggle.com/"><param name="text" value="<html><u>http://www.xuggle.com/</u></html>"><param name="textColor" value="blue"></object> to learn how to do this.
</p>
<p>
Note that you will not hear any sound if you choose to record sound to
a file.
</p>
</div>
<h3><a>Basic Example</a></h3>
<div>
<p>
Here is a complete example showing how to capture both audio and video
from one of jMonkeyEngine3&#039;s advanced demo applications.
</p>
<pre>import java.io.File;
import java.io.IOException;
&nbsp;
import jme3test.water.TestPostWater;
&nbsp;
import com.aurellem.capture.Capture;
import com.aurellem.capture.IsoTimer;
import com.jme3.app.SimpleApplication;
&nbsp;
&nbsp;
<span>/**
* Demonstrates how to use basic Audio/Video capture with a
* jMonkeyEngine application. You can use these techniques to make
* high quality cutscenes or demo videos, even on very slow laptops.
*
* @author Robert McIntyre
*/</span>
&nbsp;
public class Basic &#123;
&nbsp;
public static void main&#40;IOException&#123;
File.createTempFile&#40;&quot;JME-water-video&quot;, &quot;.avi&quot;&#41;;
File.createTempFile&#40;&quot;JME-water-audio&quot;, &quot;.wav&quot;&#41;;
&nbsp;
SimpleApplication app = new TestPostWater&#40;&#41;;
app.setTimer&#40;new IsoTimer&#40;60&#41;&#41;;
app.setShowSettings&#40;false&#41;;
&nbsp;
Capture.captureVideo&#40;app, video&#41;;
Capture.captureAudio&#40;app, audio&#41;;
&nbsp;
app.start&#40;&#41;;
&nbsp;
System.out.println&#40;video.getCanonicalPath&#40;&#41;&#41;;
System.out.println&#40;audio.getCanonicalPath&#40;&#41;&#41;;
&#125;
&#125;</pre>
</div>
<h3><a>How it works</a></h3>
<div>
<p>
A standard JME3 application that extends <code>SimpleApplication</code> or
<code>Application</code> tries as hard as it can to keep in sync with
<em>user-time</em>. If a ball is rolling at 1 game-mile per game-hour in the
game, and you wait for one user-hour as measured by the clock on your
wall, then the ball should have traveled exactly one game-mile. In
order to keep sync with the real world, the game throttles its physics
engine and graphics display. If the computations involved in running
the game are too intense, then the game will first skip frames, then
sacrifice physics accuracy. If there are particuraly demanding
computations, then you may only get 1 fps, and the ball may tunnel
through the floor or obstacles due to inaccurate physics simulation,
but after the end of one user-hour, that ball will have traveled one
game-mile.
</p>
<p>
When we&#039;re recording video, we don&#039;t care if the game-time syncs with
user-time, but instead whether the time in the recorded video
(video-time) syncs with user-time. To continue the analogy, if we
recorded the ball rolling at 1 game-mile per game-hour and watched the
video later, we would want to see 30 fps video of the ball rolling at
1 video-mile per <em>user-hour</em>. It doesn&#039;t matter how much user-time it
took to simulate that hour of game-time to make the high-quality
recording.
</p>
<p>
The IsoTimer ignores real-time and always reports that the same amount
of time has passed every time it is called. That way, one can put code
to write each video/audio frame to a file without worrying about that
code itself slowing down the game to the point where the recording
would be useless.
</p>
</div>
<h3><a>Advanced Example</a></h3>
<div>
<p>
The package from aurellem.com was made for AI research and can do more
than just record a single stream of audio and video. You can use it
to:
</p>
<p>
1.) Create multiple independent listeners that each hear the world
from their own perspective.
</p>
<p>
2.) Process the sound data in any way you wish.
</p>
<p>
3.) Do the same for visual data.
</p>
<p>
Here is a more advanced example, which can also be found along with
other examples in the jmeCapture.jar file included in the
distribution.
</p>
<pre>package com.aurellem.capture.examples;
&nbsp;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
&nbsp;
import javax.sound.sampled.AudioFormat;
&nbsp;
import org.tritonus.share.sampled.FloatSampleTools;
&nbsp;
import com.aurellem.capture.AurellemSystemDelegate;
import com.aurellem.capture.Capture;
import com.aurellem.capture.IsoTimer;
import com.aurellem.capture.audio.CompositeSoundProcessor;
import com.aurellem.capture.audio.MultiListener;
import com.aurellem.capture.audio.SoundProcessor;
import com.aurellem.capture.audio.WaveFileWriter;
import com.jme3.app.SimpleApplication;
import com.jme3.audio.AudioNode;
import com.jme3.audio.Listener;
import com.jme3.cinematic.MotionPath;
import com.jme3.cinematic.events.AbstractCinematicEvent;
import com.jme3.cinematic.events.MotionTrack;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
import com.jme3.scene.shape.Sphere;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeSystem;
&nbsp;
<span>/**
*
* Demonstrates advanced use of the audio capture and recording
* features. Multiple perspectives of the same scene are
* simultaneously rendered to different sound files.
*
* A key limitation of the way multiple listeners are implemented is
* that only 3D positioning effects are realized for listeners other
* than the main LWJGL listener. This means that audio effects such
* as environment settings will *not* be heard on any auxiliary
* listeners, though sound attenuation will work correctly.
*
* Multiple listeners as realized here might be used to make AI
* entities that can each hear the world from their own perspective.
*
* @author Robert McIntyre
*/</span>
&nbsp;
public class Advanced extends SimpleApplication &#123;
&nbsp;
<span>/**
* You will see three grey cubes, a blue sphere, and a path which
* circles each cube. The blue sphere is generating a constant
* monotone sound as it moves along the track. Each cube is
* listening for sound; when a cube hears sound whose intensity is
* greater than a certain threshold, it changes its color from
* grey to green.
*
* Each cube is also saving whatever it hears to a file. The
* scene from the perspective of the viewer is also saved to a
* video file. When you listen to each of the sound files
* alongside the video, the sound will get louder when the sphere
* approaches the cube that generated that sound file. This
* shows that each listener is hearing the world from its own
* perspective.
*
*/</span>
public static void main&#40;String&#91;&#93; args&#41; &#123;
Advanced app = new Advanced&#40;&#41;;
AppSettings settings = new AppSettings&#40;true&#41;;
settings.setAudioRenderer&#40;AurellemSystemDelegate.SEND&#41;;
JmeSystem.setSystemDelegate&#40;new AurellemSystemDelegate&#40;&#41;&#41;;
app.setSettings&#40;settings&#41;;
app.setShowSettings&#40;false&#41;;
app.setPauseOnLostFocus&#40;false&#41;;
&nbsp;
&nbsp;
try &#123;
Capture.captureVideo&#40;app, File.createTempFile&#40;&quot;advanced&quot;,&quot;.avi&quot;&#41;&#41;;
Capture.captureAudio&#40;app, File.createTempFile&#40;&quot;advanced&quot;, &quot;.wav&quot;&#41;&#41;;
&#125;
catch &#40;IOException e&#41; &#123;e.printStackTrace&#40;&#41;;&#125;
&nbsp;
app.start&#40;&#41;;
&#125;
&nbsp;
&nbsp;
private Geometry bell;
private Geometry ear1;
private Geometry ear2;
private Geometry ear3;
private AudioNode music;
private MotionTrack motionControl;
private IsoTimer motionTimer = new IsoTimer&#40;60&#41;;
&nbsp;
private Geometry makeEar&#40;Node root, Vector3f position&#41;&#123;
Material mat = new Material&#40;assetManager, &quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;
Geometry ear = new Geometry&#40;&quot;ear&quot;, new Box&#40;1.0f, 1.0f, 1.0f&#41;&#41;;
ear.setLocalTranslation&#40;position&#41;;
mat.setColor&#40;&quot;Color&quot;, ColorRGBA.Green&#41;;
ear.setMaterial&#40;mat&#41;;
root.attachChild&#40;ear&#41;;
return ear;
&#125;
&nbsp;
private Vector3f&#91;&#93; path = new Vector3f&#91;&#93;&#123;
// loop 1
new Vector3f&#40;0, 0, 0&#41;,
new Vector3f&#40;0, 0, -10&#41;,
new Vector3f&#40;-2, 0, -14&#41;,
new Vector3f&#40;-6, 0, -20&#41;,
new Vector3f&#40;0, 0, -26&#41;,
new Vector3f&#40;6, 0, -20&#41;,
new Vector3f&#40;0, 0, -14&#41;,
new Vector3f&#40;-6, 0, -20&#41;,
new Vector3f&#40;0, 0, -26&#41;,
new Vector3f&#40;6, 0, -20&#41;,
// loop 2
new Vector3f&#40;5, 0, -5&#41;,
new Vector3f&#40;7, 0, 1.5f&#41;,
new Vector3f&#40;14, 0, 2&#41;,
new Vector3f&#40;20, 0, 6&#41;,
new Vector3f&#40;26, 0, 0&#41;,
new Vector3f&#40;20, 0, -6&#41;,
new Vector3f&#40;14, 0, 0&#41;,
new Vector3f&#40;20, 0, 6&#41;,
new Vector3f&#40;26, 0, 0&#41;,
new Vector3f&#40;20, 0, -6&#41;,
new Vector3f&#40;14, 0, 0&#41;,
// loop 3
new Vector3f&#40;8, 0, 7.5f&#41;,
new Vector3f&#40;7, 0, 10.5f&#41;,
new Vector3f&#40;6, 0, 20&#41;,
new Vector3f&#40;0, 0, 26&#41;,
new Vector3f&#40;-6, 0, 20&#41;,
new Vector3f&#40;0, 0, 14&#41;,
new Vector3f&#40;6, 0, 20&#41;,
new Vector3f&#40;0, 0, 26&#41;,
new Vector3f&#40;-6, 0, 20&#41;,
new Vector3f&#40;0, 0, 14&#41;,
// begin ellipse
new Vector3f&#40;16, 5, 20&#41;,
new Vector3f&#40;0, 0, 26&#41;,
new Vector3f&#40;-16, -10, 20&#41;,
new Vector3f&#40;0, 0, 14&#41;,
new Vector3f&#40;16, 20, 20&#41;,
new Vector3f&#40;0, 0, 26&#41;,
new Vector3f&#40;-10, -25, 10&#41;,
new Vector3f&#40;-10, 0, 0&#41;,
// come at me!
new Vector3f&#40;-28.00242f, 48.005623f, -34.648228f&#41;,
new Vector3f&#40;0, 0 , -20&#41;,
&#125;;
&nbsp;
private void createScene&#40;&#41; &#123;
Material mat = new Material&#40;assetManager, &quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;
bell = new Geometry&#40; &quot;sound-emitter&quot; , new Sphere&#40;15,15,1&#41;&#41;;
mat.setColor&#40;&quot;Color&quot;, ColorRGBA.Blue&#41;;
bell.setMaterial&#40;mat&#41;;
rootNode.attachChild&#40;bell&#41;;
&nbsp;
ear1 = makeEar&#40;rootNode, new Vector3f&#40;0, 0 ,-20&#41;&#41;;
ear2 = makeEar&#40;rootNode, new Vector3f&#40;0, 0 ,20&#41;&#41;;
ear3 = makeEar&#40;rootNode, new Vector3f&#40;20, 0 ,0&#41;&#41;;
&nbsp;
MotionPath track = new MotionPath&#40;&#41;;
&nbsp;
for &#40;Vector3f v : path&#41;&#123;
track.addWayPoint&#40;v&#41;;
&#125;
track.setCurveTension&#40;0.80f&#41;;
&nbsp;
motionControl = new MotionTrack&#40;bell,track&#41;;
// for now, use reflection to change the timer...
// motionControl.setTimer(new IsoTimer(60));
&nbsp;
try &#123;
Field timerField;
timerField = AbstractCinematicEvent.class.getDeclaredField&#40;&quot;timer&quot;&#41;;
timerField.setAccessible&#40;true&#41;;
try &#123;timerField.set&#40;motionControl, motionTimer&#41;;&#125;
catch &#40;IllegalArgumentException e&#41; &#123;e.printStackTrace&#40;&#41;;&#125;
catch &#40;IllegalAccessException e&#41; &#123;e.printStackTrace&#40;&#41;;&#125;
&#125;
catch &#40;SecurityException e&#41; &#123;e.printStackTrace&#40;&#41;;&#125;
catch &#40;NoSuchFieldException e&#41; &#123;e.printStackTrace&#40;&#41;;&#125;
&nbsp;
&nbsp;
motionControl.setDirectionType&#40;MotionTrack.Direction.PathAndRotation&#41;;
motionControl.setRotation&#40;new Quaternion&#40;&#41;.fromAngleNormalAxis&#40;-FastMath.HALF_PI, Vector3f.UNIT_Y&#41;&#41;;
motionControl.setInitialDuration&#40;20f&#41;;
motionControl.setSpeed&#40;1f&#41;;
&nbsp;
track.enableDebugShape&#40;assetManager, rootNode&#41;;
positionCamera&#40;&#41;;
&#125;
&nbsp;
&nbsp;
private void positionCamera&#40;&#41;&#123;
this.cam.setLocation&#40;new Vector3f&#40;-28.00242f, 48.005623f, -34.648228f&#41;&#41;;
this.cam.setRotation&#40;new Quaternion&#40;0.3359635f, 0.34280345f, -0.13281013f, 0.8671653f&#41;&#41;;
&#125;
&nbsp;
private void initAudio&#40;&#41; &#123;
org.lwjgl.input.Mouse.setGrabbed&#40;false&#41;;
music = new AudioNode&#40;assetManager, &quot;Sound/Effects/Beep.ogg&quot;, false&#41;;
&nbsp;
rootNode.attachChild&#40;music&#41;;
audioRenderer.playSource&#40;music&#41;;
music.setPositional&#40;true&#41;;
music.setVolume&#40;1f&#41;;
music.setReverbEnabled&#40;false&#41;;
music.setDirectional&#40;false&#41;;
music.setMaxDistance&#40;200.0f&#41;;
music.setRefDistance&#40;1f&#41;;
//music.setRolloffFactor(1f);
music.setLooping&#40;false&#41;;
audioRenderer.pauseSource&#40;music&#41;;
&#125;
&nbsp;
public class Dancer implements SoundProcessor &#123;
Geometry entity;
float scale = 2;
public Dancer&#40;Geometry entity&#41;&#123;
this.entity = entity;
&#125;
&nbsp;
<span>/**
* this method is irrelevant since there is no state to cleanup.
*/</span>
public void cleanup&#40;&#41; &#123;&#125;
&nbsp;
&nbsp;
<span>/**
* Respond to sound! This is the brain of an AI entity that
* hears its surroundings and reacts to them.
*/</span>
public void process&#40;ByteBuffer audioSamples, int numSamples, AudioFormat format&#41; &#123;
audioSamples.clear&#40;&#41;;
byte&#91;&#93; data = new byte&#91;numSamples&#93;;
float&#91;&#93; out = new float&#91;numSamples&#93;;
audioSamples.get&#40;data&#41;;
FloatSampleTools.byte2floatInterleaved&#40;data, 0, out, 0,
numSamples/format.getFrameSize&#40;&#41;, format&#41;;
&nbsp;
float max = Float.NEGATIVE_INFINITY;
for &#40;float f : out&#41;&#123;if &#40;f &gt; max&#41; max = f;&#125;
audioSamples.clear&#40;&#41;;
&nbsp;
if &#40;max &gt; 0.1&#41;&#123;entity.getMaterial&#40;&#41;.setColor&#40;&quot;Color&quot;, ColorRGBA.Green&#41;;&#125;
else &#123;entity.getMaterial&#40;&#41;.setColor&#40;&quot;Color&quot;, ColorRGBA.Gray&#41;;&#125;
&#125;
&#125;
&nbsp;
private void prepareEar&#40;Geometry ear, int n&#41;&#123;
if &#40;this.audioRenderer instanceof MultiListener&#41;&#123;
MultiListener rf = &#40;MultiListener&#41;this.audioRenderer;
&nbsp;
Listener auxListener = new Listener&#40;&#41;;
auxListener.setLocation&#40;ear.getLocalTranslation&#40;&#41;&#41;;
&nbsp;
rf.addListener&#40;auxListener&#41;;
WaveFileWriter aux = null;
&nbsp;
try &#123;aux = new WaveFileWriter&#40;File.createTempFile&#40;&quot;advanced-audio-&quot; + n, &quot;.wav&quot;&#41;&#41;;&#125;
catch &#40;IOException e&#41; &#123;e.printStackTrace&#40;&#41;;&#125;
&nbsp;
rf.registerSoundProcessor&#40;auxListener,
new CompositeSoundProcessor&#40;new Dancer&#40;ear&#41;, aux&#41;&#41;;
&nbsp;
&#125;
&#125;
&nbsp;
&nbsp;
public void simpleInitApp&#40;&#41; &#123;
this.setTimer&#40;new IsoTimer&#40;60&#41;&#41;;
initAudio&#40;&#41;;
&nbsp;
createScene&#40;&#41;;
&nbsp;
prepareEar&#40;ear1, 1&#41;;
prepareEar&#40;ear2, 1&#41;;
prepareEar&#40;ear3, 1&#41;;
&nbsp;
motionControl.play&#40;&#41;;
&nbsp;
&#125;
&nbsp;
public void simpleUpdate&#40;float tpf&#41; &#123;
motionTimer.update&#40;&#41;;
if &#40;music.getStatus&#40;&#41; != AudioNode.Status.Playing&#41;&#123;
music.play&#40;&#41;;
&#125;
Vector3f loc = cam.getLocation&#40;&#41;;
Quaternion rot = cam.getRotation&#40;&#41;;
listener.setLocation&#40;loc&#41;;
listener.setRotation&#40;rot&#41;;
music.setLocalTranslation&#40;bell.getLocalTranslation&#40;&#41;&#41;;
&#125;
&nbsp;
&#125;</pre>
<p>
<!--[if !IE]> -->
<object class="media" width="400" height="350" type="application/x-shockwave-flash" data="/wiki/lib/exe/fetch.php?hash=568504&amp;media=http%3A%2F%2Fwww.youtube.com%2Fv%2FoCEfK0yhDrY%3F.swf" >
<!-- <![endif]-->
<!--[if IE]>
<object class="media" width="400" height="350" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" >
<param name="movie" value="/wiki/lib/exe/fetch.php?hash=568504&amp;media=http%3A%2F%2Fwww.youtube.com%2Fv%2FoCEfK0yhDrY%3F.swf" />
<!--><!-- -->
<param name="quality" value="high" />
The <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.adobe.com/products/flashplayer/"><param name="text" value="<html><u>Adobe Flash Plugin</u></html>"><param name="textColor" value="blue"></object> is needed to display this content.
</object>
<!-- <![endif]-->
</p>
</div>
<h3><a>Using Advanced features to Record from more than one perspective at once</a></h3>
<div>
<p>
<!--[if !IE]> -->
<object class="media" width="400" height="350" type="application/x-shockwave-flash" data="/wiki/lib/exe/fetch.php?hash=6921c2&amp;media=http%3A%2F%2Fwww.youtube.com%2Fv%2FWIJt9aRGusc%3F.swf" >
<!-- <![endif]-->
<!--[if IE]>
<object class="media" width="400" height="350" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" >
<param name="movie" value="/wiki/lib/exe/fetch.php?hash=6921c2&amp;media=http%3A%2F%2Fwww.youtube.com%2Fv%2FWIJt9aRGusc%3F.swf" />
<!--><!-- -->
<param name="quality" value="high" />
The <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.adobe.com/products/flashplayer/"><param name="text" value="<html><u>Adobe Flash Plugin</u></html>"><param name="textColor" value="blue"></object> is needed to display this content.
</object>
<!-- <![endif]-->
</p>
</div>
<h2><a>More Information</a></h2>
<div>
<p>
This is the old page showing the first version of this idea
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://aurellem.org/cortex/html/capture-video.html"><param name="text" value="<html><u>http://aurellem.org/cortex/html/capture-video.html</u></html>"><param name="textColor" value="blue"></object>
</p>
<p>
All source code can be found here:
</p>
<p>
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://hg.bortreb.com/audio-send"><param name="text" value="<html><u>http://hg.bortreb.com/audio-send</u></html>"><param name="textColor" value="blue"></object>
</p>
<p>
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://hg.bortreb.com/jmeCapture"><param name="text" value="<html><u>http://hg.bortreb.com/jmeCapture</u></html>"><param name="textColor" value="blue"></object>
</p>
<p>
More information on the modifications to OpenAL to support multiple
listeners can be found here.
</p>
<p>
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://aurellem.org/audio-send/html/ear.html"><param name="text" value="<html><u>http://aurellem.org/audio-send/html/ear.html</u></html>"><param name="textColor" value="blue"></object>
</p>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:capture_audio_video_to_a_file?do=export_xhtmlbody">view online version</a></em></p>

File diff suppressed because one or more lines are too long

@ -177,7 +177,7 @@ For example you can use Bounding Volumes on custom meshes, or complex non-physic
</p>
<pre>mesh.setBound&#40;new BoundingSphere&#40;&#41;&#41;;
q.updateBound&#40;&#41;;</pre>
mesh.updateBound&#40;&#41;;</pre>
</div>

@ -1,4 +1,42 @@
<h1><a>Combo Moves</a></h1><div><p>The ComboMoves class allows you to define combinations of inputs that trigger special actions. Entering an input combo correctly can bring the player incremental rewards, such as an increased chance to hit, an increased effectiveness, or decreased change of being blocked, whatever the game designer chooses. <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Combo_%28video_gaming%29"><param name="text" value="<html><u>More background info</u></html>"><param name="textColor" value="blue"></object></p><p>Combos are usually a series of inputs, in a fixed order: For example a keyboard combo can look like: &quot;press Down, then Down+Right together, then Right&quot;.</p><p>Usage:</p><ol><li><div>Create input triggers</div></li><li><div>Define combos</div></li><li><div>Detect combos in ActionListener</div></li><li><div>Execute combos in update loop</div></li></ol><p>Copy the two classes ComboMoveExecution.java and ComboMove.java into your application and adjust them to your package paths.</p></div><h2><a>Example 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/input/combomoves/TestComboMoves.java"><param name="text" value="<html><u>TestComboMoves.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/input/combomoves/ComboMoveExecution.java"><param name="text" value="<html><u>ComboMoveExecution.java</u></html>"><param name="textColor" value="blue"></object> ← required</div>
<h1><a>Combo Moves</a></h1>
<div>
<p>
The ComboMoves class allows you to define combinations of inputs that trigger special actions. Entering an input combo correctly can bring the player incremental rewards, such as an increased chance to hit, an increased effectiveness, or decreased change of being blocked, whatever the game designer chooses. <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Combo_%28video_gaming%29"><param name="text" value="<html><u>More background info</u></html>"><param name="textColor" value="blue"></object>
</p>
<p>
Combos are usually a series of inputs, in a fixed order: For example a keyboard combo can look like: &quot;press Down, then Down+Right together, then Right&quot;.
</p>
<p>
Usage:
</p>
<ol>
<li><div> Create input triggers </div>
</li>
<li><div> Define combos</div>
</li>
<li><div> Detect combos in ActionListener </div>
</li>
<li><div> Execute combos in update loop </div>
</li>
</ol>
<p>
Copy the two classes ComboMoveExecution.java and ComboMove.java into your application and adjust them to your package paths.
</p>
</div>
<h2><a>Example 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/input/combomoves/TestComboMoves.java"><param name="text" value="<html><u>TestComboMoves.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/input/combomoves/ComboMoveExecution.java"><param name="text" value="<html><u>ComboMoveExecution.java</u></html>"><param name="textColor" value="blue"></object> ← required</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/input/combomoves/ComboMove.java"><param name="text" value="<html><u>ComboMove.java</u></html>"><param name="textColor" value="blue"></object> ← required</div>
</li>

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

@ -0,0 +1,49 @@
<h1><a>Fade-in / Fade-out Effect</a></h1>
<div>
<p>
You can use a fade in/fade out effect to make smooth transitions, for example between game levels. The effect fades in from black to the initialized scene, or fades out from the scene to black.
The effect uses com.jme3.post.FilterPostProcessor and com.jme3.post.filters.FadeFilter.
</p>
</div>
<h2><a>Setting up</a></h2>
<div>
<ol>
<li><div> Create one FilterPostProcessor object per application.</div>
</li>
<li><div> Create a FadeFilter object.</div>
</li>
<li><div> Give the FadeFilter constructor the fade duration in seconds as parameter. If you use the parameter-less constructor, the duration is 1 sec by default.</div>
</li>
<li><div> Add the FadeFilter to the FilterPostProcessor.</div>
</li>
<li><div> Add the FilterPostProcessor to the default viewPort.</div>
</li>
</ol>
<pre>private FilterPostProcessor fpp;
private FadeFilter fade;
public void simpleInitApp&#40;&#41; &#123;
...
fpp = new FilterPostProcessor&#40;assetManager&#41;;
fade = new FadeFilter&#40;2&#41;; // e.g. 2 seconds
fpp.addFilter&#40;fade&#41;;
viewPort.addProcessor&#40;fpp&#41;;
...
&#125;</pre>
</div>
<h2><a>Fading in and out</a></h2>
<div>
<p>
Now call the <code>fade.fadeIn()</code> and <code>fade.fadeOut()</code> methods to trigger the effect.
You can also change the fade duration using <code>fade.setDuration()</code>.
</p>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:fade?do=export_xhtmlbody">view online version</a></em></p>

@ -1,13 +1,103 @@
<h1><a>Physical Hinges and Joints</a></h1><div><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.</p><p>Game Physics are not only employed to calculate collisions, but they can also simulate hinges and joints. Think of pulley chains, shaky rope bridges, swinging pendulums, or (trap)door and chest hinges. Physics are a great addition to e.g. an action or puzzle game.</p><p>In this example, we will create a pendulum. The joint is the (invisible) connection between the pendulum body and the hook. You will see that you can use what you learn from the simple pendulum and apply it to other joint/hinge objects (rope bridges, etc).</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/TestPhysicsHingeJoint.java"><param name="text" value="<html><u>TestPhysicsHingeJoint.java</u></html>"><param name="textColor" value="blue"></object></div></li></ul></div><h2><a>Overview of this Physics Application</a></h2><div><ol><li><div>Create a SimpleApplication with a <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">BulletAppState</a></div><ul><li><div>This gives us a PhysicsSpace for PhysicsControls</div></li></ul></li><li><div>For the pendulum, we use a Spatial with a PhysicsControl, and we apply physical forces to them.</div><ul><li><div>The parts of the &quot;pendulum&quot; are Physics Control&#039;ed Spatials with Collision Shapes.</div></li><li><div>We create a fixed <code>hookNode</code> and a dynamic <code>pendulumNode</code>.</div></li></ul></li><li><div>We can &quot;crank the handle&quot; and rotate the joint like a hinge, or we can let loose and expose the joints freely to gravity.</div><ul><li><div>For physical forces we will use the method <code>joint.enableMotor();</code></div></li></ul></li></ol></div><h2><a>Creating a Fixed Node</a></h2><div><p>The hookNode is the fixed point from which the pendulum hangs. It has no mass.</p><pre>Node hookNode=PhysicsTestHelper.createPhysicsTestNode&#40;
<h1><a>Physical Hinges and Joints</a></h1>
<div>
<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.
</p>
<p>
Game Physics are not only employed to calculate collisions, but they can also simulate hinges and joints. Think of pulley chains, shaky rope bridges, swinging pendulums, or (trap)door and chest hinges. Physics are a great addition to e.g. an action or puzzle game.
</p>
<p>
In this example, we will create a pendulum. The joint is the (invisible) connection between the pendulum body and the hook. You will see that you can use what you learn from the simple pendulum and apply it to other joint/hinge objects (rope bridges, etc).
</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/TestPhysicsHingeJoint.java"><param name="text" value="<html><u>TestPhysicsHingeJoint.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>Overview of this Physics Application</a></h2>
<div>
<ol>
<li><div> Create a SimpleApplication with a <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">BulletAppState</a> </div>
<ul>
<li><div> This gives us a PhysicsSpace for PhysicsControls</div>
</li>
</ul>
</li>
<li><div> For the pendulum, we use a Spatial with a PhysicsControl, and we apply physical forces to them.</div>
<ul>
<li><div> The parts of the &quot;pendulum&quot; are Physics Control&#039;ed Spatials with Collision Shapes. </div>
</li>
<li><div> We create a fixed <code>hookNode</code> and a dynamic <code>pendulumNode</code>. </div>
</li>
</ul>
</li>
<li><div> We can &quot;crank the handle&quot; and rotate the joint like a hinge, or we can let loose and expose the joints freely to gravity. </div>
<ul>
<li><div> For physical forces we will use the method <code>joint.enableMotor();</code></div>
</li>
</ul>
</li>
</ol>
</div>
<h2><a>Creating a Fixed Node</a></h2>
<div>
<p>
The hookNode is the fixed point from which the pendulum hangs. It has no mass.
</p>
<pre>Node hookNode=PhysicsTestHelper.createPhysicsTestNode&#40;
assetManager, new BoxCollisionShape&#40;new Vector3f&#40; .1f, .1f, .1f&#41;&#41;,0&#41;;
hookNode.getControl&#40;RigidBodyControl.class&#41;.setPhysicsLocation&#40;new Vector3f&#40;0f,0,0f&#41;&#41;;
&nbsp;
rootNode.attachChild&#40;hookNode&#41;;
getPhysicsSpace&#40;&#41;.add&#40;hookNode&#41;;</pre><p>For a rope bridge, there would be two fixed nodes where the bridge is attached to the mountainside.</p></div><h2><a>Creating a Dynamic Node</a></h2><div><p>The pendulumNode is the dynamic part of the construction. It has a mass.</p><pre>Node pendulumNode=PhysicsTestHelper.createPhysicsTestNode&#40;
getPhysicsSpace&#40;&#41;.add&#40;hookNode&#41;;</pre>
<p>
For a rope bridge, there would be two fixed nodes where the bridge is attached to the mountainside.
</p>
</div>
<h2><a>Creating a Dynamic Node</a></h2>
<div>
<p>
The pendulumNode is the dynamic part of the construction. It has a mass.
</p>
<pre>Node pendulumNode=PhysicsTestHelper.createPhysicsTestNode&#40;
assetManager, new BoxCollisionShape&#40;new Vector3f&#40; .3f, .3f, .3f&#41;&#41;,1&#41;;
pendulumNode.getControl&#40;RigidBodyControl.class&#41;.setPhysicsLocation&#40;new Vector3f&#40;0f,-1,0f&#41;&#41;;
rootNode.attachChild&#40;pendulumNode&#41;;
getPhysicsSpace&#40;&#41;.add&#40;pendulumNode&#41;;</pre><p>For a rope bridge, each set of planks would be one dynamic node.</p></div><h2><a>Understanding DOF, Joints, and Hinges</a></h2><div><p>A PhysicsHingeJoint is an invisible connection between two nodes – here between the pendulum body and the hook. Why are hinges and joints represented by the same class? Hinges and joints have something in common: They constrain the <em>mechanical degree of freedom</em> (DOF) of another object.
getPhysicsSpace&#40;&#41;.add&#40;pendulumNode&#41;;</pre>
<p>
For a rope bridge, each set of planks would be one dynamic node.
</p>
</div>
<h2><a>Understanding DOF, Joints, and Hinges</a></h2>
<div>
<p>
A PhysicsHingeJoint is an invisible connection between two nodes – here between the pendulum body and the hook. Why are hinges and joints represented by the same class? Hinges and joints have something in common: They constrain the <em>mechanical degree of freedom</em> (DOF) of another object.
</p>
<p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

@ -1,4 +1,22 @@
<h1><a>Saving and Loading Materials with .j3m Files</a></h1><div><p>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></div><h2><a>Writing the .j3m File</a></h2><div><ol><li><div>For every Material, create a file and give it a name that describes it: e.g. <code>SimpleBump.j3m</code></div></li><li><div>Place the file in your project&#039;s <code>assets/Materials/</code> directory, e.g. <code>MyGame/src/assets/Materials/SimpleBump.j3m</code></div></li><li><div>Edit the file and add content using the following Syntax, e.g.:<pre>Material shiny bumpy rock : Common/MatDefs/Light/Lighting.j3md {
<h1><a>Saving and Loading Materials with .j3m Files</a></h1>
<div>
<p>
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>
</div>
<h2><a>Writing the .j3m File</a></h2>
<div>
<ol>
<li><div> For every Material, create a file and give it a name that describes it: e.g. <code>SimpleBump.j3m</code></div>
</li>
<li><div> Place the file in your project&#039;s <code>assets/Materials/</code> directory, e.g. <code>MyGame/src/assets/Materials/SimpleBump.j3m</code></div>
</li>
<li><div> Edit the file and add content using the following Syntax, e.g.:<pre>Material shiny bumpy rock : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
Shininess: 8.0
NormalMap: Textures/bump_rock_normal.png
@ -7,7 +25,21 @@
Diffuse : 1.0 1.0 1.0 1.0
Specular : 0.0 0.0 0.0 1.0
}
}</pre></div></li></ol><p>How to this file is structured:</p><ol><li><div>Header</div><ol><li><div><code>Material</code> is a fixed keyword, keep it.</div></li><li><div><code>shiny bumpy rock</code> is a descriptive string that you can make up. Choose a name to help you remember for what you intend to use this material.</div>
}</pre>
</div>
</li>
</ol>
<p>
How to this file is structured:
</p>
<ol>
<li><div> Header</div>
<ol>
<li><div> <code>Material</code> is a fixed keyword, keep it.</div>
</li>
<li><div> <code>shiny bumpy rock</code> is a descriptive string that you can make up. Choose a name to help you remember for what you intend to use this material.</div>
</li>
<li><div> After the colon, specify on which <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Material</a> definition you base this Material.</div>
</li>

@ -286,19 +286,27 @@ You simply add it in the Defines section of your Technique in the definition fil
&#125;</pre>
<p>
For integer and floating point parameters, the define will contain the value that was set.<br/>
Those material parameters will be sent from the engine to the shader as follow
Note that there is a setXXXX method for any type of uniform you want to pass.<br/>
For all other types of parameters, the value 1 is defined.<br/>
If no value is set for that parameter, the define is not declared in the shader.<br/>
</p>
<p>
Those material parameters will be sent from the engine to the shader as follows,
there are setXXXX methods for any type of uniform you want to pass.<br/>
</p>
<pre> material.setColor&#40;&quot;Color&quot;, new ColorRGBA&#40;1.0f, 0.0f, 0.0f, 1.0f&#41;; // red color
material.setTexture&#40;&quot;ColorMap&quot;, myTexture&#41;; </pre>
material.setTexture&#40;&quot;ColorMap&quot;, myTexture&#41;; // bind myTexture for that sampler uniform</pre>
<p>
To use this uniform in the shader, you need to declare it in the .frag or in the .vert files (depending on where you need it).
To use this uniform in the shader, you need to declare it in the .frag or .vert files (depending on where you need it).
You can make use of the defines here and later in the code:
<strong>Note the &quot;m_&quot; prefix that specifies that the uniform is a material parameter.</strong><br/>
<strong>Note that the &quot;m_&quot; prefix specifies that the uniform is a material parameter.</strong><br/>
</p>
@ -327,7 +335,7 @@ color to add in its alpha channel. <br/>
Here I will use this color map: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://wstaw.org/m/2011/10/24/plasma-desktopxB2787.jpg"><param name="text" value="<html><u>http://wstaw.org/m/2011/10/24/plasma-desktopxB2787.jpg</u></html>"><param name="textColor" value="blue"></object> <br/>
to bend color on this texture: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://wstaw.org/m/2011/10/24/plasma-desktopbq2787.jpg"><param name="text" value="<html><u>http://wstaw.org/m/2011/10/24/plasma-desktopbq2787.jpg</u></html>"><param name="textColor" value="blue"></object> <br/>
to blend color on this texture: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://wstaw.org/m/2011/10/24/plasma-desktopbq2787.jpg"><param name="text" value="<html><u>http://wstaw.org/m/2011/10/24/plasma-desktopbq2787.jpg</u></html>"><param name="textColor" value="blue"></object> <br/>
<br/>
@ -444,7 +452,7 @@ Those attributes are deprecated since GLSL 1.3 (opengl 3), hence JME3 global uni
<td>gl_NormalMatrix </td><td>g_NormalMatrix</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [11121-11432] -->
<!-- EDIT1 TABLE [11389-11700] -->
</div>
<h3><a>Useful links</a></h3>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 31 KiB

@ -3,21 +3,79 @@
<div>
<p>
Lighting means that an object is brighter on the side facing the light direction, and darker on the backside. A light source with a direction or location is required for lit Materials to be visible. Lighting does not automatically mean that objects cast a shadow on the floor or other objects: Activating shadow processing is an extra step described below.
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/light-sources.png"> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/pssm.png">
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/shading-ani.gif">
</p>
<p>
Light and Shadow are two separate things in 3D engines, although we percieve them together in real life:
</p>
<ul>
<li><div> Lighting means that an object is brighter on the side facing the light direction, and darker on the backside. Computationally, this is relatively easy. </div>
</li>
<li><div> Lighting does not mean that objects cast a shadow on the floor or other objects: Activating shadow processing is an additional step described here. Since casting shadows has an impact on performance, drop shadows and ambient occlusion shading are not activated by default.</div>
</li>
</ul>
<p>
<p><div>A light source with a direction or location is required for all Geometries with Lighting.j3md-based Materials. An ambient light is not sufficient. In a scene with no appropriate light sources, Geometries with Lighting.j3md-based Materials do not render. Only Geometries with Unshaded.j3md-based Materials are visible independent of any light sources.
</div></p>
</p>
</div>
<h2><a>Light Sources</a></h2>
<h2><a>Light Sources and Colors</a></h2>
<div>
<p>
You can add several light sources to a scene using <code>rootNode.addLight()</code>. All Lighting.j3md- based Materials require a light source to be visible.
The available light sources in <code>com.jme3.light</code> are SpotLight (<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/groups/graphics/forum/topic/will-pay-for-cone-light-implementation/"><param name="text" value="<html><u>WIP</u></html>"><param name="textColor" value="blue"></object>), PointLight, AmbientLight, and DirectionalLight. You can set the color (intensity) of the light – normally, it is white (ColorRGBA(1,1,1,1)). You can choose to set other colors to influence the scene&#039;s atmosphere.
A PointLight has a location and shines from there in all directions as far as its radius reaches, like a lamp. The light intensity decreases with increased distance from the light source.
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/light-sources.png">
</p>
<p>
You can add several types of light sources to a scene using <code>rootNode.addLight(mylight)</code>.
</p>
<p>
The available light sources in <code>com.jme3.light</code> are:
</p>
<ul>
<li><div> SpotLight </div>
</li>
<li><div> PointLight</div>
</li>
<li><div> AmbientLight</div>
</li>
<li><div> DirectionalLight</div>
</li>
</ul>
<p>
You control the color and intensity of each light source. Typically you set the color to white (<code>new ColorRGBA(1.0f,1.0f,1.0f,1.0f)</code> or <code>ColorRGBA.White</code>), which makes all scene elements appear in their natural color.
</p>
<p>
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>
</div>
<h3><a>PointLight</a></h3>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/elephant-pointlights.png">
</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.
</p>
<p>
<strong>Typical example:</strong> Lamp, lightbulb, torch, candle.
</p>
<pre>PointLight lamp_light = new PointLight&#40;&#41;;
lamp_light.setColor&#40;ColorRGBA.Yellow&#41;;
@ -25,29 +83,44 @@ lamp_light.setRadius&#40;4f&#41;;
lamp_light.setPosition&#40;new Vector3f&#40;lamp_geo.getLocalTranslation&#40;&#41;&#41;&#41;;
rootNode.addLight&#40;lamp_light&#41;;</pre>
</div>
<h3><a>DirectionalLight</a></h3>
<div>
<p>
A DirectionalLight has no position, only a direction. It is considered &quot;infinitely&quot; far away and sends out parallel beams of light. It can cast shadows. You typically use it to simulate sun light:
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/house-directionallight.png">
</p>
<p>
A DirectionalLight has no position, only a direction. It sends out parallel beams of light and is considered &quot;infinitely&quot; far away. You typically have one directional light per scene. A DirectionalLight can be used together with shadows.
</p>
<p>
<strong>Typically example:</strong> Sun light.
</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;;
rootNode.addLight&#40;sun&#41;;</pre>
<p>
</div>
An AmbientLight influences the brightness of the scene globally. It has no direction and no location, and does not cast any shadows.
<h3><a>SpotLight</a></h3>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/spotlight.png">
</p>
<pre>AmbientLight al = new AmbientLight&#40;&#41;;
al.setColor&#40;ColorRGBA.White.mult&#40;1.3f&#41;&#41;;
rootNode.addLight&#40;al&#41;;</pre>
<p>
A SpotLight sends out a distinct beam or cone of light. A SpotLight has a direction, a position, distance (range) and two angles. The inner angle is the central maximum of the light cone, the outer angle the edge of the light cone. Everything outside the light cone&#039;s angles is not affected by the light.
</p>
A SpotLight is like a flashlight that sends a distinct beam, or cone of light. A SpotLight has a direction, a position, distance (range) and an angle. The inner angle is the central maximum of the light cone, the outer angle the edge of the light cone. Everything outside the light cone&#039;s angles is not affacted by the light.
<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
@ -60,22 +133,54 @@ rootNode.addLight&#40;sl&#41;;</pre>
</div>
<h2><a>LightControl</a></h2>
<h3><a>AmbientLight</a></h3>
<div>
<p>
You can use a com.jme3.scene.control.LightControl to make a SpotLight or PointLight follow a Spatial.
An AmbientLight simply influences the brightness and color of the scene globally. It has no direction and no location and shines equally everywhere. An AmbientLight does not cast any shadows, and it lights all sides of Geometries evenly, which makes 3D objects look unnaturally flat; this is why you typically do not use an AmbientLight alone without one of the other lights.
</p>
<p>
<strong>Typical example:</strong> Regulate overall brightness, tinge the whole scene in a warm or cold color.
</p>
<pre>AmbientLight al = new AmbientLight&#40;&#41;;
al.setColor&#40;ColorRGBA.White.mult&#40;1.3f&#41;&#41;;
rootNode.addLight&#40;al&#41;;</pre>
<p>
<p><div>You can increase the brightness of a light source gradually by multiplying the light color to values greater than 1.0f. <br/>
Example: <code>mylight.setColor(ColorRGBA.White.mult(1.3f));</code>
</div></p>
</p>
</div>
<h2><a>Light Follows Spatial</a></h2>
<div>
<p>
You can use a <code>com.jme3.scene.control.LightControl</code> to make a SpotLight or PointLight follow a Spatial. This can be used for a flashlight being carried by a character, or for car headlights, or an aircraft&#039;s spotlight, etc.
</p>
<pre>PointLight myLight = new PointLight&#40;&#41;;
rootNode.addLight&#40;myLight&#41;;
LightControl lightControl = new LightControl&#40;myLight&#41;;
spatial.addControl&#40;lightControl&#41;;</pre>
spatial.addControl&#40;lightControl&#41;; // this spatial controls the position of this light.</pre>
<p>
Obviously, this does apply to AmbientLights which have no position.
</p>
</div>
<h2><a>Simple Lighting</a></h2>
<div>
<p>
Full sample code:
</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/light/TestSimpleLighting.java"><param name="text" value="<html><u>TestSimpleLighting.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
@ -84,23 +189,29 @@ You can use a com.jme3.scene.control.LightControl to make a SpotLight or PointLi
</ul>
<p>
Here we use a material based on Lighting.j3md (<a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">More info about Materials</a>). Lighting.j3md-based materials dynamically support Shininess, and Ambient, Diffuse, and Specular Colors.
For Simple Lighting we use Geometries with Materials based on Lighting.j3md (learn <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">more about Materials</a> here). Lighting.j3md-based materials dynamically support Shininess, and Ambient, Diffuse, and Specular light if there is a light source present. Note that this lighting method alone does not make the Geometry cast a shadow onto other Geometries automatically (see below for how to add drop shadows etc).
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/teapot-phong-illuminated.png">
</p>
<pre>Geometry teapot = &#40;Geometry&#41; assetManager.loadModel&#40;&quot;Models/Teapot/Teapot.obj&quot;&#41;;
TangentBinormalGenerator.generate&#40;teapot.getMesh&#40;&#41;, true&#41;;
Material mat = new Material&#40;assetManager, &quot;Common/MatDefs/Light/Lighting.j3md&quot;&#41;;
mat.setBoolean&#40;&quot;m_UseMaterialColors&quot;, true&#41;;
mat.setColor&#40;&quot;m_Ambient&quot;, ColorRGBA.Black&#41;;
mat.setColor&#40;&quot;m_Diffuse&quot;, ColorRGBA.Blue&#41;;
mat.setColor&#40;&quot;m_Ambient&quot;, ColorRGBA.Orange&#41;;
mat.setColor&#40;&quot;m_Diffuse&quot;, ColorRGBA.Orange&#41;;
mat.setColor&#40;&quot;m_Specular&quot;, ColorRGBA.White&#41;;
mat.setFloat&#40;&quot;m_Shininess&quot;, 12&#41;;
rootNode.attachChild&#40;teapot&#41;;</pre>
<p>
The above example uses material colors and no textures. You can of course also use Lighting.j3md to create a lit Material that uses Texture Maps. The following example uses Shininess, Diffuse Map and Normal Map (a.k.a Bump Map).
</p>
In this example, we use material colors instead of textures. But you can equally well use Lighting.j3md to create a Material that uses texture maps, such as the Diffuse and Normal map used here, but also Specular and Paralax Maps:
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/bump-mapped-sphere.png">
</p>
<pre>Sphere rock = new Sphere&#40;32,32, 2f&#41;;
Geometry shiny_rock = new Geometry&#40;&quot;Shiny rock&quot;, rock&#41;;
@ -108,83 +219,89 @@ In this example, we use material colors instead of textures. But you can equally
TangentBinormalGenerator.generate&#40;rock&#41;; // for lighting effect
Material mat_lit = new Material&#40;
assetManager, &quot;Common/MatDefs/Light/Lighting.j3md&quot;&#41;;
mat_lit.setTexture&#40;&quot;m_DiffuseMap&quot;,
mat_lit.setTexture&#40;&quot;m_DiffuseMap&quot;, // surface color
assetManager.loadTexture&#40;&quot;Textures/Terrain/Pond/Pond.png&quot;&#41;&#41;;
mat_lit.setTexture&#40;&quot;m_NormalMap&quot;,
mat_lit.setTexture&#40;&quot;m_NormalMap&quot;, // surface bumps
assetManager.loadTexture&#40;&quot;Textures/Terrain/Pond/Pond_normal.png&quot;&#41;&#41;;
mat_lit.setFloat&#40;&quot;m_Shininess&quot;, 5f&#41;; // [0,128]
mat_lit.setFloat&#40;&quot;m_Shininess&quot;, 5f&#41;; // surface smoothness [1,128]
shiny_rock.setMaterial&#40;mat_lit&#41;;
rootNode.attachChild&#40;shiny_rock&#41;;</pre>
<p>
This lighting updates live when the object or light source moves. If you shine a colored PointLight at this object, you will see a light reflection in the color of the PointLight.
This lighting method doesn&#039;t make the node cast a shadow onto other nodes.
These light effects update live when the object or light source moves. If you shine a colored PointLight at this object, you will see a light reflection tinged in the color of the PointLight.
</p>
</div>
<h2><a>BasicShadowRenderer</a></h2>
<div>
<p>
Full code sample
</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/light/TestShadow.java"><param name="text" value="<html><u>TestShadow.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<p>
Use the Shadow Renderer to make textured scene nodes cast and receive shadows.
Switch off the default shadow mode, and add a jME SceneProcessor named com.jme3.shadow.BasicShadowRenderer to the viewPort.
Use the Shadow Renderer to make Geometries with Lighting.j3md-based Materials cast and receive basic drop shadows. This fast and simple implementation of a shadow effect is good for scenes with flat floors, but looks less realistic on uneven terrains. To use it, you add a jME SceneProcessor named com.jme3.shadow.BasicShadowRenderer to the viewPort.
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/drop-shadows.png">
</p>
<pre>BasicShadowRenderer bsr;
...
public void simpleInitApp&#40;&#41; &#123;
...
rootNode.setShadowMode&#40;ShadowMode.Off&#41;;
bsr = new BasicShadowRenderer&#40;assetManager, 256&#41;;
bsr.setDirection&#40;new Vector3f&#40;-1, -1, -1&#41;.normalizeLocal&#40;&#41;&#41;;
bsr.setDirection&#40;new Vector3f&#40;-1, -1, -1&#41;.normalizeLocal&#40;&#41;&#41;; // light direction
viewPort.addProcessor&#40;bsr&#41;;
...</pre>
<p>
For every scene node that needs shadows, individually specify the shadow behaviour: Whether it cast shadows, receive shadows, both, or neither.
Shadow calculations (cast and receive) have a performance impact, therefor we recommend to use them smartly. Switch off the default shadow mode for the whole scene graph, and then specify the shadow behaviour individually for every scene node that needs shadows: You specifiy whether it casts shadows, receives shadows, both (slower), or neither (faster).
</p>
<pre>wall.setShadowMode&#40;ShadowMode.CastAndReceive&#41;;
...
floor.setShadowMode&#40;ShadowMode.Receive&#41;;
...
airplane.setShadowMode&#40;ShadowMode.Cast&#41;;
...
ghost.setShadowMode&#40;ShadowMode.Off&#41;;
...</pre>
<pre>rootNode.setShadowMode&#40;ShadowMode.Off&#41;; // reset all
wall.setShadowMode&#40;ShadowMode.CastAndReceive&#41;; // normal behaviour (slow)
floor.setShadowMode&#40;ShadowMode.Receive&#41;; // can't see shadow cast below floor anyway...
airplane.setShadowMode&#40;ShadowMode.Cast&#41;; // nothing casts shadows onto airplane anyway...
ghost.setShadowMode&#40;ShadowMode.Off&#41;; // ghost is translucent anyway...</pre>
</div>
<h2><a>Parallel-Split Shadow Map</a></h2>
<div>
<p>
Full sample code
</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/light/TestPssmShadow.java"><param name="text" value="<html><u>TestPssmShadow.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<p>
The PSSM shadow renderer can cast real-time shadows on curved surfaces.
To activate it, add a jME SceneProcessor named <code>com.jme3.shadow.PssmShadowRenderer</code> to the viewPort.
The more advanced PSSM shadow renderer can cast real-time shadows, even on curved surfaces such as terrains. It is a bit more resource hungry than the BasicShadowRenderer. To activate PSSM drop shadows, add a jME SceneProcessor named <code>com.jme3.shadow.PssmShadowRenderer</code> to the viewPort. PSSM stands for the Parallel-Split Shadow Map technique.
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/shadow.png">
</p>
<pre>private PssmShadowRenderer pssmRenderer;
...
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;;
pssmRenderer.setDirection&#40;new Vector3f&#40;-1, -1, -1&#41;.normalizeLocal&#40;&#41;&#41;; // light direction
viewPort.addProcessor&#40;pssmRenderer&#41;;</pre>
<p>
The constructor expects the following values:
</p>
<ul>
@ -197,6 +314,7 @@ The constructor expects the following values:
</ul>
<p>
You can set the following properties on the <code>pssmRenderer</code> object:
</p>
<ul>
@ -211,14 +329,43 @@ You can set the following properties on the <code>pssmRenderer</code> object:
</ul>
<p>
As usual, specify the shadow behaviour for every scene node.
As said above, it&#039;s more efficient to specify individual shadow behaviour for each Geometry.
</p>
<pre>teapot.setShadowMode&#40;ShadowMode.CastAndReceive&#41;;
terrain.setShadowMode&#40;ShadowMode.Receive&#41;; </pre>
</div>
<h2><a>Screen Space Ambient Occlusion</a></h2>
<div>
<p>
Full sample code
</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/post/TestSSAO.java"><param name="text" value="<html><u>jme3/src/test/jme3test/post/TestSSAO.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/post/TestSSAO2.java"><param name="text" value="<html><u>jme3/src/test/jme3test/post/TestSSAO2.java</u></html>"><param name="textColor" value="blue"></object> – Screen-Space Ambient Occlusion shadows</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/post/TestTransparentSSAO.java"><param name="text" value="<html><u>jme3/src/test/jme3test/post/TestTransparentSSAO.java</u></html>"><param name="textColor" value="blue"></object> – Screen-Space Ambient Occlusion shadows plus transparancy</div>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.org/2010/08/16/screen-space-ambient-occlusion-for-jmonkeyengine-3-0/#more-321"><param name="text" value="<html><u>Screen Space Ambient Occlusion for jMonkeyEngine (article)</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<p>
Ambient Occlusion refers to the shadows that nearby objects cast on each other under an ambient lighting. It‘s an approximation of how light radiates in a real life scene. To activate Ambient Occlusion shadows, add a jME SceneProcessor named <code>com.jme3.post.SSAOFilter</code> to the viewPort. SSAO stands for the Screen Space Ambient Occlusion technique.
</p>
<pre>FilterPostProcessor fpp = new FilterPostProcessor&#40;assetManager&#41;;
SSAOFilter ssaoFilter = new SSAOFilter&#40;12.94f, 43.92f, 0.33f, 0.61&#41;;
fpp.addFilter&#40;ssaoFilter&#41;;
viewPort.addProcessor&#40;fpp&#41;;</pre>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/shading-textured-ani.gif">
</p>
<pre>...
teapot.setShadowMode&#40;ShadowMode.CastAndReceive&#41;;
...
soil.setShadowMode&#40;ShadowMode.Receive&#41;;
...</pre>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:light_and_shadow?do=export_xhtmlbody">view online version</a></em></p>

@ -1,4 +1,36 @@
<h3><a>Nifty Loading Screen (Progress Bar)</a></h3><div><p>There is a good tutorial about creating a nifty progress bar here: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Create_your_own_Control_%28A_Nifty_Progressbar%29"><param name="text" value="<html><u>http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Create_your_own_Control_%28A_Nifty_Progressbar%29</u></html>"><param name="textColor" value="blue"></object></p><p>This example will use the existing hello terrain as an example. It will require these 2 images inside Assets/Interface/ (save them as border.png and inner.png respectively)</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/inner1.png"> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/border1.png"></p><p>This is the progress bar at 90%:</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/loadingscreen.png"></p><p>nifty_loading.xml</p><pre><span>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<h3><a>Nifty Loading Screen (Progress Bar)</a></h3>
<div>
<p>
There is a good tutorial about creating a nifty progress bar here:
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Create_your_own_Control_%28A_Nifty_Progressbar%29"><param name="text" value="<html><u>http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Create_your_own_Control_%28A_Nifty_Progressbar%29</u></html>"><param name="textColor" value="blue"></object>
</p>
<p>
This example will use the existing hello terrain as an example.
It will require these 2 images inside Assets/Interface/ (save them as border.png and inner.png respectively)
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/inner1.png">
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/border1.png">
</p>
<p>
This is the progress bar at 90%:
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/loadingscreen.png">
</p>
<p>
nifty_loading.xml
</p>
<pre><span>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<span><span>&lt;nifty&gt;</span></span>
<span>&lt;useStyles filename=&quot;nifty-default-styles.xml&quot; /&gt;</span>
<span>&lt;useControls filename=&quot;nifty-default-controls.xml&quot; /&gt;</span>
@ -35,13 +67,32 @@
<span>&lt;screen id=&quot;end&quot; controller = &quot;jme3test.TestLoadingScreen&quot;&gt;</span>
<span><span>&lt;/screen&gt;</span></span>
&nbsp;
<span><span>&lt;/nifty&gt;</span></span></pre></div><h4><a>Understanding Nifty XML</a></h4><div><p>The progress bar and text is done statically using nifty <acronym title="Extensible Markup Language">XML</acronym>. A custom control is created, which represents the progress bar.</p><pre> <span>&lt;controlDefinition name = &quot;loadingbar&quot; controller = &quot;jme3test.TestLoadingScreen&quot;&gt;</span>
<span><span>&lt;/nifty&gt;</span></span></pre>
</div>
<h4><a>Understanding Nifty XML</a></h4>
<div>
<p>
The progress bar and text is done statically using nifty <acronym title="Extensible Markup Language">XML</acronym>.
A custom control is created, which represents the progress bar.
</p>
<pre> <span>&lt;controlDefinition name = &quot;loadingbar&quot; controller = &quot;jme3test.TestLoadingScreen&quot;&gt;</span>
<span>&lt;image filename=&quot;Interface/border.png&quot; childLayout=&quot;absolute&quot; </span>
<span> imageMode=&quot;resize:15,2,15,15,15,2,15,2,15,2,15,15&quot;&gt;</span>
<span>&lt;image id=&quot;progressbar&quot; x=&quot;0&quot; y=&quot;0&quot; filename=&quot;Interface/inner.png&quot; width=&quot;32px&quot; height=&quot;100%&quot;</span>
<span> imageMode=&quot;resize:15,2,15,15,15,2,15,2,15,2,15,15&quot;/&gt;</span>
<span><span>&lt;/image&gt;</span></span>
<span><span>&lt;/controlDefinition&gt;</span></span></pre><p>This screen simply displays a button in the middle of the screen, which could be seen as a simple main menu UI.</p><pre> <span>&lt;screen id=&quot;start&quot; controller = &quot;jme3test.TestLoadingScreen&quot;&gt;</span>
<span><span>&lt;/controlDefinition&gt;</span></span></pre>
<p>
This screen simply displays a button in the middle of the screen, which could be seen as a simple main menu UI.
</p>
<pre> <span>&lt;screen id=&quot;start&quot; controller = &quot;jme3test.TestLoadingScreen&quot;&gt;</span>
<span>&lt;layer id=&quot;layer&quot; childLayout=&quot;center&quot;&gt;</span>
<span>&lt;panel id = &quot;panel2&quot; height=&quot;30%&quot; width=&quot;50%&quot; align=&quot;center&quot; valign=&quot;center&quot; childLayout=&quot;vertical&quot;</span>
<span> visibleToMouse=&quot;true&quot;&gt;</span>
@ -50,7 +101,13 @@
<span><span>&lt;/control&gt;</span></span>
<span><span>&lt;/panel&gt;</span></span>
<span><span>&lt;/layer&gt;</span></span>
<span><span>&lt;/screen&gt;</span></span></pre><p>This screen displays our custom progress bar control with a text control</p><pre> <span>&lt;screen id=&quot;loadlevel&quot; controller = &quot;jme3test.TestLoadingScreen&quot;&gt;</span>
<span><span>&lt;/screen&gt;</span></span></pre>
<p>
This screen displays our custom progress bar control with a text control
</p>
<pre> <span>&lt;screen id=&quot;loadlevel&quot; controller = &quot;jme3test.TestLoadingScreen&quot;&gt;</span>
<span>&lt;layer id=&quot;loadinglayer&quot; childLayout=&quot;center&quot; backgroundColor=&quot;#000000&quot;&gt;</span>
<span>&lt;panel id = &quot;loadingpanel&quot; childLayout=&quot;vertical&quot; align=&quot;center&quot; valign=&quot;center&quot; height=&quot;32px&quot; width=&quot;400px&quot;&gt;</span>
<span>&lt;control name=&quot;loadingbar&quot; align=&quot;center&quot; valign=&quot;center&quot; width=&quot;400px&quot; height=&quot;32px&quot; /&gt;</span>
@ -58,7 +115,15 @@
<span> text=&quot; &quot;/&gt;</span>
<span><span>&lt;/panel&gt;</span></span>
<span><span>&lt;/layer&gt;</span></span>
<span><span>&lt;/screen&gt;</span></span></pre></div><h3><a>Creating the bindings to use the Nifty XML</a></h3><div><p>There are 3 main ways to update a progress bar. To understand why these methods are necessary, an understanding of the graphics pipeline is needed.
<span><span>&lt;/screen&gt;</span></span></pre>
</div>
<h3><a>Creating the bindings to use the Nifty XML</a></h3>
<div>
<p>
There are 3 main ways to update a progress bar. To understand why these methods are necessary, an understanding of the graphics pipeline is needed.
</p>
<p>

@ -1,8 +1,132 @@
<h1><a>Localizing jME 3 Games</a></h1><div></div><h2><a>Scope</a></h2><div><p>Localizing an application can mean several things:</p><ul><li><div>At minimum you translate all messages and dialogs in the user interface to your target languages.</div></li><li><div>You should also translate the &quot;read me&quot;, help, and other documentation.</div></li><li><div>Also translating web content related to the application makes sure international users find out about your localized game.</div></li><li><div>If you go the whole way of internationalization, you also &quot;translate&quot; metaphors in icons or symbols used. <br/> E.g. For localizations to right-to-left languages, you must also adjust the whole flow of the UI (order of menus and buttons).</div></li></ul><p>There are tools that assist you with localizing Java Swing GUIs. jME3 applications do not typically have a Swing <acronym title="Graphical User Interface">GUI</acronym>, so those tools are not of much help. Just stick to the normal Java rules about using Bundle Properties:</p></div><h2><a>Preparing the Localization</a></h2><div><p><strong>Tip:</strong> The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> supports opening and editing Bundle.properties files. Also note the Tools &gt; Localization menu.</p><p>To prepare the application for localization, you have to first identify all hard-coded messages.</p><ol><li><div>Find every line in your jME3 game where you hard-coded message strings, e.g. <br/><pre>System.out.print&#40;&quot;Hello World!&quot;&#41;;
UiText.setText&#40;&quot;Score: &quot;+score&#41;;</pre></div></li><li><div>Create one file named <code>Bundle.properties</code> in each directory where there are Java file that contain messages.</div></li><li><div>For every hard-coded message, you add one line to the <code>Bundle.properties</code> file: First specify a unique key that identifies this string; then an equal sign; and the literal string itself. <br/><pre>greeting=Hello World!
score.display=Score: </pre></div></li><li><div>In the source code, replace every occurence of a hard-coded message with the appropriate Resource Bundle call to its unique key:<pre>ResourceBundle.getBundle&#40;&quot;Bundle&quot;&#41;.getString&#40;&quot;greeting&quot;&#41;&#41;;
UiText.setText&#40;Translating the Messages</h2><div><p>Each additional language comes in a set of files that is marked with a (usually) two-letter suffix. Common locales are de for German, en for English, fr for French, ja for Japanese, pt for Portuguese, etc.</p><p>To translate the messages to another language, for example, German:</p><ol><li><div>Make a copy of the <code>Bundle.properties</code> files.</div></li><li><div>Name the copy <code>Bundle_de.properties</code> for German. Note the added suffix _de.</div></li><li><div>Translate all strings (text on the right side of the equal sign) in the <code>Bundle_de.properties</code> to German.<pre>greeting=Hallo Welt!
score.display=Spielstand: </pre><p><strong>Important:</strong> Do not modify any of the keys (text to the left of the equal sign)!</p></div></li><li><div>To test the German localization, start the application from the command line with <code>-Duser.language=de</code>. Note the parameter <code>de</code>.</div></li></ol><p><strong>Tip:</strong> In the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>, you set this VM Option in the Project properties under Run. Here you can also save individual run configuraions for each language you want to test.</p><p>To get the full list of language suffixes use</p><pre>Which Strings Not to Translate</h2><div><p><strong>Important:</strong> In the Bundle.properties file, do not include any strings that are asset paths, node or geometry names, input mappings, or material layers.</p><ul><li><div>Keep material layers:<pre>mat.setTexture&#40;&quot;ColorMap&quot;, tex&#41;;</pre></div></li><li><div>Keep paths:<pre>teapot = assetManager.loadModel&#40;&quot;Models/Teapot/Teapot.obj&quot;&#41;;</pre></div></li><li><div>Keep geometry and node names:<pre>Geometry thing=new Geometry&#40;&quot;A thing&quot;, mesh&#41;;
<h1><a>Localizing jME 3 Games</a></h1>
<div>
</div>
<h2><a>Scope</a></h2>
<div>
<p>
Localizing an application can mean several things:
</p>
<ul>
<li><div> At minimum you translate all messages and dialogs in the user interface to your target languages.</div>
</li>
<li><div> You should also translate the &quot;read me&quot;, help, and other documentation.</div>
</li>
<li><div> Also translating web content related to the application makes sure international users find out about your localized game.</div>
</li>
<li><div> If you go the whole way of internationalization, you also &quot;translate&quot; metaphors in icons or symbols used. <br/>
E.g. For localizations to right-to-left languages, you must also adjust the whole flow of the UI (order of menus and buttons).</div>
</li>
</ul>
<p>
There are tools that assist you with localizing Java Swing GUIs. jME3 applications do not typically have a Swing <acronym title="Graphical User Interface">GUI</acronym>, so those tools are not of much help. Just stick to the normal Java rules about using Bundle Properties:
</p>
</div>
<h2><a>Preparing the Localization</a></h2>
<div>
<p>
<strong>Tip:</strong> The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> supports opening and editing Bundle.properties files. Also note the Tools &gt; Localization menu.
</p>
<p>
To prepare the application for localization, you have to first identify all hard-coded messages.
</p>
<ol>
<li><div> Find every line in your jME3 game where you hard-coded message strings, e.g. <br/>
<pre>System.out.print&#40;&quot;Hello World!&quot;&#41;;
UiText.setText&#40;&quot;Score: &quot;+score&#41;;</pre>
</div>
</li>
<li><div> Create one file named <code>Bundle.properties</code> in each directory where there are Java file that contain messages.</div>
</li>
<li><div> For every hard-coded message, you add one line to the <code>Bundle.properties</code> file: First specify a unique key that identifies this string; then an equal sign; and the literal string itself. <br/>
<pre>greeting=Hello World!
score.display=Score: </pre>
</div>
</li>
<li><div> In the source code, replace every occurence of a hard-coded message with the appropriate Resource Bundle call to its unique key: <pre>ResourceBundle.getBundle&#40;&quot;Bundle&quot;&#41;.getString&#40;&quot;greeting&quot;&#41;&#41;;
UiText.setText&#40;ResourceBundle.getBundle&#40;&quot;Bundle&quot;&#41;.getString&#40;&quot;score.display&quot;&#41;+score&#41;;</pre>
</div>
</li>
</ol>
<p>
The language used in the Bundle.properties files will be the default language for your game.
</p>
</div>
<h2><a>Translating the Messages</a></h2>
<div>
<p>
Each additional language comes in a set of files that is marked with a (usually) two-letter suffix. Common locales are de for German, en for English, fr for French, ja for Japanese, pt for Portuguese, etc.
</p>
<p>
To translate the messages to another language, for example, German:
</p>
<ol>
<li><div> Make a copy of the <code>Bundle.properties</code> files.</div>
</li>
<li><div> Name the copy <code>Bundle_de.properties</code> for German. Note the added suffix _de.</div>
</li>
<li><div> Translate all strings (text on the right side of the equal sign) in the <code>Bundle_de.properties</code> to German. <pre>greeting=Hallo Welt!
score.display=Spielstand: </pre>
<p>
<strong>Important:</strong> Do not modify any of the keys (text to the left of the equal sign)!
</p>
</div>
</li>
<li><div> To test the German localization, start the application from the command line with <code>-Duser.language=de</code>. Note the parameter <code>de</code>.</div>
</li>
</ol>
<p>
<strong>Tip:</strong> In the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>, you set this VM Option in the Project properties under Run. Here you can also save individual run configuraions for each language you want to test.
</p>
<p>
To get the full list of language suffixes use
</p>
<pre>Locale.getISOLanguages&#40;&#41;&#41;&#41;;</pre>
</div>
<h2><a>Which Strings Not to Translate</a></h2>
<div>
<p>
<strong>Important:</strong> In the Bundle.properties file, do not include any strings that are asset paths, node or geometry names, input mappings, or material layers.
</p>
<ul>
<li><div> Keep material layers: <pre>mat.setTexture&#40;&quot;ColorMap&quot;, tex&#41;;</pre>
</div>
</li>
<li><div> Keep paths: <pre>teapot = assetManager.loadModel&#40;&quot;Models/Teapot/Teapot.obj&quot;&#41;;</pre>
</div>
</li>
<li><div> Keep geometry and node names: <pre>Geometry thing=new Geometry&#40;&quot;A thing&quot;, mesh&#41;;
Node vehicle = new Node&#40;&quot;Vehicle&quot;&#41;;</pre>
</div>
</li>

@ -1,6 +1,65 @@
<h1><a>Logging and Monitoring</a></h1><div></div><h2><a>Logging Like a Newb</a></h2><div><p>Many developers just use System.out.println() to print diagnostic strings to the terminal. The problem with that is that before the release, you&#039;d have to go through all your code and make certain you removed all these println() calls. You do not want your users to see them and worry about ominous strings babbling about old development diagnostics.</p></div><h2><a>Logging Like a Pro</a></h2><div><p>Instead of println(), you use the standard Java logger from <code>java.util.logging</code>. It has many advantages for professional game development:</p><ul><li><div>You &quot;tag&quot; each message with a log level: Severe error, informative warning, etc.</div></li><li><div>You can switch off printing of all messages up to certain log level with just one line of code.</div><ul><li><div>During development, you would set the log level to fine, because you want all warnings printed.</div></li><li><div>For the release, you set the log level to only report severe errors, and no informative diagnostics.</div></li></ul></li><li><div>The logger string is localizable, since it contains variables. You may want to localize all errors.</div></li></ul><p>So to print comments like a pro, you use the following logger syntax. The variables a, b, c, can be any printable Java object, e.g. <code>Vector3f a = cam.getLocation()</code>. They are numbered {0},{1},{2},etc for use in the string, in the order you put them in the Object array.</p><pre>private static final Logger logger = Logger.getLogger&#40;HelloWorld.class.getName&#40;&#41;&#41;;</pre><p>Replace HelloWorld by the name of the class where you are using this line.</p><pre>logger.log&#40;Level.WARNING, &quot;ok seriously wtf somebody check why {0} is {1} again?!&quot;,
new Object&#91;&#93;&#123;a , b&#125;&#41;;</pre><p>or</p><pre>logger.log&#40;Level.SEVERE, &quot;Game error: {0} must not be {1} after {2}! Please check your flux generator.&quot;,
new Object&#91;&#93;&#123;a , b , c&#125;&#41;;</pre><p>As you see in the example, you should phrase potentially &quot;customer facing&quot; errors in a neutral way and offer a reason and a solution. If you use WARNINGs as replacement for casual printlns, make sure you deactivate them for the release.
<h1><a>Logging and Monitoring</a></h1>
<div>
</div>
<h2><a>Logging Like a Newb</a></h2>
<div>
<p>
Many developers just use System.out.println() to print diagnostic strings to the terminal. The problem with that is that before the release, you&#039;d have to go through all your code and make certain you removed all these println() calls. You do not want your users to see them and worry about ominous strings babbling about old development diagnostics.
</p>
</div>
<h2><a>Logging Like a Pro</a></h2>
<div>
<p>
Instead of println(), you use the standard Java logger from <code>java.util.logging</code>. It has many advantages for professional game development:
</p>
<ul>
<li><div> You &quot;tag&quot; each message with a log level: Severe error, informative warning, etc.</div>
</li>
<li><div> You can switch off printing of all messages up to certain log level with just one line of code.</div>
<ul>
<li><div> During development, you would set the log level to fine, because you want all warnings printed.</div>
</li>
<li><div> For the release, you set the log level to only report severe errors, and no informative diagnostics.</div>
</li>
</ul>
</li>
<li><div> The logger string is localizable, since it contains variables. You may want to localize all errors.</div>
</li>
</ul>
<p>
So to print comments like a pro, you use the following logger syntax. The variables a, b, c, can be any printable Java object, e.g. <code>Vector3f a = cam.getLocation()</code>. They are numbered {0},{1},{2},etc for use in the string, in the order you put them in the Object array.
</p>
<pre>private static final Logger logger = Logger.getLogger&#40;HelloWorld.class.getName&#40;&#41;&#41;;</pre>
<p>
Replace HelloWorld by the name of the class where you are using this line.
</p>
<pre>logger.log&#40;Level.WARNING, &quot;ok seriously wtf somebody check why {0} is {1} again?!&quot;,
new Object&#91;&#93;&#123;a , b&#125;&#41;;</pre>
<p>
or
</p>
<pre>logger.log&#40;Level.SEVERE, &quot;Game error: {0} must not be {1} after {2}! Please check your flux generator.&quot;,
new Object&#91;&#93;&#123;a , b , c&#125;&#41;;</pre>
<p>
As you see in the example, you should phrase potentially &quot;customer facing&quot; errors in a neutral way and offer a reason and a solution. If you use WARNINGs as replacement for casual printlns, make sure you deactivate them for the release.
</p>
<p>

@ -1,4 +1,51 @@
<h1><a>Making the Camera Follow a 3rd-Person Character</a></h1><div><p>When players steer a game character with 1st-person view, they directly steer the camera (<code>flyCam.setEnabled(true);</code>), and they never see the walking character itself. In a game with 3rd-person view, however, the players see the character walk, and you (the game developer) want to make the camera follow the character around when it walks.</p><p>There are two ways how the camera can do that:</p><ul><li><div>Registering a chase camera to the player and the input manager.</div></li><li><div>Attaching the camera to the character using a camera node.</div></li></ul><p><strong>Important:</strong> Using third-person view requires you to deactivate the default flyCam (first-person view). This means that you have to configure your own navigation (<a href="/com/jme3/gde/core/docs/jme3/advanced/input_handling.html">key inputs and analogListener</a>) that make your player character walk. For moving a physical player character, use <code>player.setWalkDirection()</code>, for a non-pysical character you can use <code>player.move()</code>.</p></div><h2><a>Code Samples</a></h2><div><p>Press the WASD or arrow keys to move. Drag with the left mouse button to rotate.</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/input/TestChaseCamera.java"><param name="text" value="<html><u>TestChaseCamera.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/input/TestCameraNode.java"><param name="text" value="<html><u>TestCameraNode.java</u></html>"><param name="textColor" value="blue"></object></div></li></ul></div><h2><a>Camera Node</a></h2><div><p>To make the camera follow a target node, add this camera node code to your init method (e.g. <code>simpleInitApp()</code>). The <code>target</code> spatial is typically the player node.</p><pre>// Disable the default flyby cam
<h1><a>Making the Camera Follow a 3rd-Person Character</a></h1>
<div>
<p>
When players steer a game character with 1st-person view, they directly steer the camera (<code>flyCam.setEnabled(true);</code>), and they never see the walking character itself. In a game with 3rd-person view, however, the players see the character walk, and you (the game developer) want to make the camera follow the character around when it walks.
</p>
<p>
There are two ways how the camera can do that:
</p>
<ul>
<li><div> Registering a chase camera to the player and the input manager.</div>
</li>
<li><div> Attaching the camera to the character using a camera node.</div>
</li>
</ul>
<p>
<strong>Important:</strong> Using third-person view requires you to deactivate the default flyCam (first-person view). This means that you have to configure your own navigation (<a href="/com/jme3/gde/core/docs/jme3/advanced/input_handling.html">key inputs and analogListener</a>) that make your player character walk. For moving a physical player character, use <code>player.setWalkDirection()</code>, for a non-pysical character you can use <code>player.move()</code>.
</p>
</div>
<h2><a>Code Samples</a></h2>
<div>
<p>
Press the WASD or arrow keys to move. Drag with the left mouse button to rotate.
</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/input/TestChaseCamera.java"><param name="text" value="<html><u>TestChaseCamera.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/input/TestCameraNode.java"><param name="text" value="<html><u>TestCameraNode.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>Camera Node</a></h2>
<div>
<p>
To make the camera follow a target node, add this camera node code to your init method (e.g. <code>simpleInitApp()</code>). The <code>target</code> spatial is typically the player node.
</p>
<pre>// Disable the default flyby cam
flyCam.setEnabled&#40;false&#41;;
//create the camera Node
camNode = new CameraNode&#40;&quot;Camera Node&quot;, cam&#41;;
@ -9,7 +56,33 @@ 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><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.</p><div><table><tr><th>Methods</th><th>Description</th></tr><tr><td>setControlDir(ControlDirection.SpatialToCamera)</td><td>User input steers the target spatial, and the camera follows the spatial.<br/> The spatial&#039;s transformation is copied over the camera&#039;s transformation. <br/> Example: Use with <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">CharacterControl</a>led spatial.</td></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></tr></table></div><p><strong>Code sample:</strong></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/input/TestCameraNode.java"><param name="text" value="<html><u>TestCameraNode.java</u></html>"><param name="textColor" value="blue"></object> – Press the WASD or arrow keys to move. Drag with the left mouse button to rotate.</div>
target.attachChild&#40;camNode&#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.
</p>
<div><table>
<tr>
<th>Methods</th><th>Description</th>
</tr>
<tr>
<td>setControlDir(ControlDirection.SpatialToCamera)</td><td>User input steers the target spatial, and the camera follows the spatial.<br/>
The spatial&#039;s transformation is copied over the camera&#039;s transformation. <br/>
Example: Use with <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">CharacterControl</a>led spatial.</td>
</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>
</tr>
</table></div>
<!-- EDIT1 TABLE [2445-2926] -->
<p>
<strong>Code sample:</strong>
</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/input/TestCameraNode.java"><param name="text" value="<html><u>TestCameraNode.java</u></html>"><param name="textColor" value="blue"></object> – Press the WASD or arrow keys to move. Drag with the left mouse button to rotate.</div>
</li>
</ul>

File diff suppressed because one or more lines are too long

@ -1,7 +1,112 @@
<h1><a>MotionPath</a></h1><div><p>A MotionPath describes the motion of a spatial between waypoints. The path can be linear or rounded. You use MotionPaths to remote-control a spatial, or the camera.</p><p><strong>Tip:</strong> If you want to remote-control a whole cutscene with several spatials moving at various times, then we recommened you use MotionPaths together with <a href="/com/jme3/gde/core/docs/jme3/advanced/cinematics.html">Cinematics</a>.</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/animation/TestMotionPath.java"><param name="text" value="<html><u>TestMotionPath.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/animation/TestCameraMotionPath.java"><param name="text" value="<html><u>TestCameraMotionPath.java</u></html>"><param name="textColor" value="blue"></object></div></li></ul></div><h2><a>What Are Way Points?</a></h2><div><p>When shooting a movie scene, the director tells actors where to walk, for example, by drawing a series of small crosses on the floor. Cameramen often mount the camera on rails (so called dolly track) so they can follow along complex scenes more easily.</p><p>In JME3, you use MotionPaths to specify a series of positions for a character or the camera. The MotionPath automatically updates the transformation of the spatial in each frame to make it move from one point to the next.</p><ul><li><div><strong>A way point</strong> is one positions on a path.</div></li><li><div><strong>A MotionPath</strong> contains a list of all way points of one path.</div></li></ul><p>The final shape of the path is computed using a linear interpolation or a <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.mvps.org/directx/articles/catmull/"><param name="text" value="<html><u>Catmull-Rom</u></html>"><param name="textColor" value="blue"></object> spline interpolation on the way points.</p></div><h2><a>Create a MotionPath</a></h2><div><p>Create a Motionpath object and add way points to it.</p><pre>MotionPath path = new MotionPath&#40;&#41;;
<h1><a>MotionPath</a></h1>
<div>
<p>
A MotionPath describes the motion of a spatial between waypoints. The path can be linear or rounded. You use MotionPaths to remote-control a spatial, or the camera.
</p>
<p>
<strong>Tip:</strong> If you want to remote-control a whole cutscene with several spatials moving at various times, then we recommened you use MotionPaths together with <a href="/com/jme3/gde/core/docs/jme3/advanced/cinematics.html">Cinematics</a>.
</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/animation/TestMotionPath.java"><param name="text" value="<html><u>TestMotionPath.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/animation/TestCameraMotionPath.java"><param name="text" value="<html><u>TestCameraMotionPath.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>What Are Way Points?</a></h2>
<div>
<p>
When shooting a movie scene, the director tells actors where to walk, for example, by drawing a series of small crosses on the floor. Cameramen often mount the camera on rails (so called dolly track) so they can follow along complex scenes more easily.
</p>
<p>
In JME3, you use MotionPaths to specify a series of positions for a character or the camera. The MotionPath automatically updates the transformation of the spatial in each frame to make it move from one point to the next.
</p>
<ul>
<li><div> <strong>A way point</strong> is one positions on a path. </div>
</li>
<li><div> <strong>A MotionPath</strong> contains a list of all way points of one path. </div>
</li>
</ul>
<p>
The final shape of the path is computed using a linear interpolation or a <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.mvps.org/directx/articles/catmull/"><param name="text" value="<html><u>Catmull-Rom</u></html>"><param name="textColor" value="blue"></object> spline interpolation on the way points.
</p>
</div>
<h2><a>Create a MotionPath</a></h2>
<div>
<p>
Create a Motionpath object and add way points to it.
</p>
<pre>MotionPath path = new MotionPath&#40;&#41;;
path.addWayPoint&#40;new Vector3f&#40;10, 3, 0&#41;&#41;;
path.addWayPoint&#40;new Vector3f&#40;8, -2, 1&#41;&#41;;
...</pre><p>You can configure the path as follows.</p><div><table><tr><th>MotionPath Method</th><th>Usage</th></tr><tr><td>path.setCycle(true)</td><td>Sets whether the motion along this path should be closed (true) or open-ended (false).</td></tr><tr><td>path.addWayPoint(vector)</td><td>Adds individual waypoints to this path. The order is relevant.</td></tr><tr><td>path.removeWayPoint(vector) <br/> removeWayPoint(index)</td><td>Removes a way point from this path. You can specify the point that you want to remove as vector or as integer index.</td></tr><tr><td>path.setCurveTension(0.83f)</td><td>Sets the tension of the curve (Catmull-Rom Spline). A value of 0.0f results in a straight linear line, 1.0 a very round curve.</td></tr><tr><td>path.getNbWayPoints()</td><td>Returns the number of waypoints in this path.</td></tr><tr><td>path.enableDebugShape(assetManager,rootNode)</td><td>Shows a line that visualizes the path. Use this during development and for debugging so you see what you are doing.</td></tr><tr><td>path.disableDebugShape()</td><td>Hides the line that visualizes the path. Use this for the release build.</td></tr></table></div></div><h2><a>MotionPathListener</a></h2><div><p>You can hook interactions into a playing MotionPath. Register a MotionPathListener to the MotionPath to track whether way points have been reached, and then trigger a custom action. The onWayPointReach() method of the interface gives you access to the MotionTrack object <code>control</code>, and an integer value representing the current wayPointIndex.</p><p>In this example, you just print the status at every way point. In a game you could trigger actions here: Transformations, animations, sounds, game actions (attack, open door, etc).</p><pre>path.addListener&#40; new MotionPathListener&#40;&#41; &#123;
...</pre>
<p>
You can configure the path as follows.
</p>
<div><table>
<tr>
<th> MotionPath Method </th><th> Usage </th>
</tr>
<tr>
<td>path.setCycle(true)</td><td>Sets whether the motion along this path should be closed (true) or open-ended (false). </td>
</tr>
<tr>
<td>path.addWayPoint(vector)</td><td>Adds individual waypoints to this path. The order is relevant.</td>
</tr>
<tr>
<td>path.removeWayPoint(vector) <br/>
removeWayPoint(index)</td><td>Removes a way point from this path. You can specify the point that you want to remove as vector or as integer index.</td>
</tr>
<tr>
<td>path.setCurveTension(0.83f)</td><td>Sets the tension of the curve (Catmull-Rom Spline). A value of 0.0f results in a straight linear line, 1.0 a very round curve.</td>
</tr>
<tr>
<td>path.getNbWayPoints()</td><td>Returns the number of waypoints in this path.</td>
</tr>
<tr>
<td>path.enableDebugShape(assetManager,rootNode)</td><td>Shows a line that visualizes the path. Use this during development and for debugging so you see what you are doing.</td>
</tr>
<tr>
<td>path.disableDebugShape()</td><td>Hides the line that visualizes the path. Use this for the release build.</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [1769-2660] -->
</div>
<h2><a>MotionPathListener</a></h2>
<div>
<p>
You can hook interactions into a playing MotionPath. Register a MotionPathListener to the MotionPath to track whether way points have been reached, and then trigger a custom action. The onWayPointReach() method of the interface gives you access to the MotionTrack object <code>control</code>, and an integer value representing the current wayPointIndex.
</p>
<p>
In this example, you just print the status at every way point. In a game you could trigger actions here: Transformations, animations, sounds, game actions (attack, open door, etc).
</p>
<pre>path.addListener&#40; new MotionPathListener&#40;&#41; &#123;
public void onWayPointReach&#40;MotionTrack control, int wayPointIndex&#41; &#123;
if &#40;path.getNbWayPoints&#40;&#41; == wayPointIndex + 1&#41; &#123;
println&#40;control.getSpatial&#40;&#41;.getName&#40;&#41; + &quot; has finished moving. &quot;&#41;;
@ -9,5 +114,7 @@ path.addWayPoint&#40;new Vector3f&#40;8, -2, 1&#41;&#41;;
println&#40;control.getSpatial&#40;&#41;.getName&#40;&#41; + &quot; has reached way point &quot; + wayPointIndex&#41;;
&#125;
&#125;
&#125;&#41;;</pre></div>
&#125;&#41;;</pre>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:motionpath?do=export_xhtmlbody">view online version</a></em></p>

@ -1,4 +1,45 @@
<h1><a>Mouse Picking</a></h1><div><p>Mouse picking means that the user clicks an object in the scene to select it, or to interact with it otherwise. Games use picking to implement aiming and shooting, casting spells, picking up objects, selecting targets, dragging and moving objects, etc. Mouse picking can be done using fixed crosshairs, or using the mouse pointer.</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/mouse-picking.png"></p><p>See <a href="/com/jme3/gde/core/docs/jme3/advanced/input_handling.html">Input Handling</a> for details on how to define the necessary input triggers, input mappings, and input listeners.</p></div><h2><a>Pick a Target Using Fixed Crosshairs</a></h2><div><p>The following <code>pick target</code> input mapping implements an action that determines what a user clicked. It assumes that the mouse pointer is invisible and there are crosshairs painted in the center of the screen. It assumes that the user aims the crosshairs at an object in the scene and clicks. You use Ray Casting to identify the geometry that was picked by the user. Use use this method together with a first-person flyCam.</p><ol><li><div>Activate the first-person camera: <code>flyCam.setEnabled(true);</code></div></li><li><div>Keep mouse pointer invisible using <code>inputManager.setCursorVisible(false)</code>.</div></li><li><div>Map the <code>pick target</code> action to a MouseButtonTrigger.</div></li><li><div>Implement the action in the Listener.</div></li></ol><p>The following example rotates Spatials named &quot;Red Box&quot; or &quot;Blue Box&quot; when they are clicked. Modify this code to do whatever your game needs to do with the identified target (shoot it, take it, move it, etc).</p><pre> private AnalogListener analogListener = new AnalogListener&#40;&#41; &#123;
<h1><a>Mouse Picking</a></h1>
<div>
<p>
Mouse picking means that the user clicks an object in the scene to select it, or to interact with it otherwise. Games use picking to implement aiming and shooting, casting spells, picking up objects, selecting targets, dragging and moving objects, etc. Mouse picking can be done using fixed crosshairs, or using the mouse pointer.
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/mouse-picking.png">
</p>
<p>
See <a href="/com/jme3/gde/core/docs/jme3/advanced/input_handling.html">Input Handling</a> for details on how to define the necessary input triggers, input mappings, and input listeners.
</p>
</div>
<h2><a>Pick a Target Using Fixed Crosshairs</a></h2>
<div>
<p>
The following <code>pick target</code> input mapping implements an action that determines what a user clicked. It assumes that the mouse pointer is invisible and there are crosshairs painted in the center of the screen. It assumes that the user aims the crosshairs at an object in the scene and clicks. You use Ray Casting to identify the geometry that was picked by the user. Use use this method together with a first-person flyCam.
</p>
<ol>
<li><div> Activate the first-person camera: <code>flyCam.setEnabled(true);</code></div>
</li>
<li><div> Keep mouse pointer invisible using <code>inputManager.setCursorVisible(false)</code>.</div>
</li>
<li><div> Map the <code>pick target</code> action to a MouseButtonTrigger. </div>
</li>
<li><div> Implement the action in the Listener.</div>
</li>
</ol>
<p>
The following example rotates Spatials named &quot;Red Box&quot; or &quot;Blue Box&quot; when they are clicked. Modify this code to do whatever your game needs to do with the identified target (shoot it, take it, move it, etc).
</p>
<pre> private AnalogListener analogListener = new AnalogListener&#40;&#41; &#123;
public void onAnalog&#40;String name, float intensity, float tpf&#41; &#123;
if &#40;name.equals&#40;&quot;pick target&quot;&#41;&#41; &#123;
// Reset results list.

@ -1,5 +1,60 @@
<h1><a>Multiple Camera Views</a></h1><div><p>You can split the screen and look into the 3D scene from different camera angles at the same time.</p><p>The packages used in this example are <code>com.jme3.renderer.Camera</code> and <code>com.jme3.renderer.ViewPort</code>. You can get the full sample code here: <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/renderer/TestMultiViews.java"><param name="text" value="<html><u>TestMultiViews.java</u></html>"><param name="textColor" value="blue"></object></p></div><h2><a>How to resize and Position ViewPorts</a></h2><div><p>The default viewPort is as big as the window. If you have several, the must be of different sizes, either overlapping or adjacent to one another. How do you tell jME which of the ViewPorts should appear where on the screen, and how big it should be?</p><p>Imagine the window as a 1.0f x 1.0f rectangle. The default cam&#039;s viewPort is set to</p><pre>cam.setViewPort&#40;0f, 1f, 0f, 1f&#41;;</pre><p>This setting makes the ViewPort take up the whole rectangle.</p><p>The four values are read in the following order:</p><pre>cam.setViewPort&#40;x1,x2 , y1,y2&#41;;</pre><ul><li><div><strong>X-axis</strong> from left to right</div></li><li><div><strong>Y-axis</strong> upwards from bottom to top</div></li></ul><p>Here are a few examples:</p><pre>cam1.setViewPort&#40; 0.0f , 1.0f , 0.0f , 1.0f &#41;;
cam2.setViewPort&#40; 0.5f , 1.0f , 0.0f , 0.5f &#41;;</pre><p>These viewport parameters are, (in this order) the left-right extend, and the bottom-top extend of a views&#039;s rectangle on the screen.</p><pre>0.0 , 1.0 1.0 , 1.0
<h1><a>Multiple Camera Views</a></h1>
<div>
<p>
You can split the screen and look into the 3D scene from different camera angles at the same time.
</p>
<p>
The packages used in this example are <code>com.jme3.renderer.Camera</code> and <code>com.jme3.renderer.ViewPort</code>. You can get the full sample code here: <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/renderer/TestMultiViews.java"><param name="text" value="<html><u>TestMultiViews.java</u></html>"><param name="textColor" value="blue"></object>
</p>
</div>
<h2><a>How to resize and Position ViewPorts</a></h2>
<div>
<p>
The default viewPort is as big as the window. If you have several, the must be of different sizes, either overlapping or adjacent to one another. How do you tell jME which of the ViewPorts should appear where on the screen, and how big it should be?
</p>
<p>
Imagine the window as a 1.0f x 1.0f rectangle. The default cam&#039;s viewPort is set to
</p>
<pre>cam.setViewPort&#40;0f, 1f, 0f, 1f&#41;;</pre>
<p>
This setting makes the ViewPort take up the whole rectangle.
</p>
<p>
The four values are read in the following order:
</p>
<pre>cam.setViewPort&#40;x1,x2 , y1,y2&#41;;</pre>
<ul>
<li><div> <strong>X-axis</strong> from left to right</div>
</li>
<li><div> <strong>Y-axis</strong> upwards from bottom to top</div>
</li>
</ul>
<p>
Here are a few examples:
</p>
<pre>cam1.setViewPort&#40; 0.0f , 1.0f , 0.0f , 1.0f &#41;;
cam2.setViewPort&#40; 0.5f , 1.0f , 0.0f , 0.5f &#41;;</pre>
<p>
These viewport parameters are, (in this order) the left-right extend, and the bottom-top extend of a views&#039;s rectangle on the screen.
</p>
<pre>0.0 , 1.0 1.0 , 1.0
+-----+-----+
|cam1 |
| |
@ -7,8 +62,79 @@ cam2.setViewPort&#40; 0.5f , 1.0f , 0.0f , 0.5f &#41;;</pre><p>These viewpor
| | |
| |cam2 |
+-----+-----+
0.0 , 0.0 1.0 , 0.0</pre><p>Example: Cam2&#039;s rectangle is int he bottom right: It extends from mid (x1=0.5f) bottom (y1=0.0f), to right (x2=1.0f) mid (y2=0.5f)</p><p><p><div>If you scale the views in a way so that the aspect ratio of a ViewPort is different than the window&#039;s aspect ratio, then the ViewPort appears distorted. In these cases, you must recreate (not clone) the ViewPort&#039;s cam object with the right aspect ratio. For example: <code>Camera cam5 = new Camera(100,100);</code></div></p></p></div><h2><a>Four-Time Split Screen</a></h2><div><p>In this example, you create four views (2x2) with the same aspect ratio as the window, but each is only half the width and height.</p></div><h3><a>Set up the First View</a></h3><div><p>You use the preconfigured Camera <code>cam</code> and <code>viewPort</code> from <code>SimpleApplication</code> for the first view. It&#039;s in the bottom right.</p><pre>cam.setViewPort&#40;.5f, 1f, 0f, 0.5f&#41;; // Resize the viewPort to half its size, bottom right.</pre><p>Optionally, place the main camera in the scene and rotate it in its start position. </p><pre>cam.setLocation&#40;new Vector3f&#40;3.32f, 4.48f, 4.28f&#41;&#41;;
cam.setRotation&#40;new Quaternion &#40;-0.07f, 0.92f, -0.25f, -0.27f&#41;&#41;;</pre></div><h3><a>Set Up Three More Views</a></h3><div><p>Here is the outline for how you create the three other cams and viewPorts (<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/renderer/TestMultiViews.java"><param name="text" value="<html><u>Full code sample is here</u></html>"><param name="textColor" value="blue"></object>.) In the code snippet, <code>cam_n</code> stand for <code>cam_2</code> - <code>cam_4</code>, respectively, same for <code>view_n</code>.</p><ol><li><div>Clone the first cam to reuse its settings</div></li><li><div>Resize and position the cam&#039;s viewPort with setViewPort().</div></li><li><div>(Optionally) Move the cameras in the scene and rotate them so they face what you want to see.</div></li><li><div>Create a ViewPort for each camera</div></li><li><div>Reset the camera&#039;s enabled statuses</div></li><li><div>Attach the Node to be displayed to this ViewPort. <br/> The camera doesn&#039;t have to look at the rootNode, but that is the most common use case.</div></li></ol><p>Here is the abstract code sample for camera <code>n</code>:</p><pre>Camera cam_n = cam.clone&#40;&#41;;
0.0 , 0.0 1.0 , 0.0</pre>
<p>
Example: Cam2&#039;s rectangle is int he bottom right: It extends from mid (x1=0.5f) bottom (y1=0.0f), to right (x2=1.0f) mid (y2=0.5f)
</p>
<p>
<p><div>If you scale the views in a way so that the aspect ratio of a ViewPort is different than the window&#039;s aspect ratio, then the ViewPort appears distorted. In these cases, you must recreate (not clone) the ViewPort&#039;s cam object with the right aspect ratio. For example: <code>Camera cam5 = new Camera(100,100);</code>
</div></p>
</p>
</div>
<h2><a>Four-Time Split Screen</a></h2>
<div>
<p>
In this example, you create four views (2x2) with the same aspect ratio as the window, but each is only half the width and height.
</p>
</div>
<h3><a>Set up the First View</a></h3>
<div>
<p>
You use the preconfigured Camera <code>cam</code> and <code>viewPort</code> from <code>SimpleApplication</code> for the first view. It&#039;s in the bottom right.
</p>
<pre>cam.setViewPort&#40;.5f, 1f, 0f, 0.5f&#41;; // Resize the viewPort to half its size, bottom right.</pre>
<p>
Optionally, place the main camera in the scene and rotate it in its start position.
</p>
<pre>cam.setLocation&#40;new Vector3f&#40;3.32f, 4.48f, 4.28f&#41;&#41;;
cam.setRotation&#40;new Quaternion &#40;-0.07f, 0.92f, -0.25f, -0.27f&#41;&#41;;</pre>
</div>
<h3><a>Set Up Three More Views</a></h3>
<div>
<p>
Here is the outline for how you create the three other cams and viewPorts (<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/renderer/TestMultiViews.java"><param name="text" value="<html><u>Full code sample is here</u></html>"><param name="textColor" value="blue"></object>.) In the code snippet, <code>cam_n</code> stand for <code>cam_2</code> - <code>cam_4</code>, respectively, same for <code>view_n</code>.
</p>
<ol>
<li><div> Clone the first cam to reuse its settings</div>
</li>
<li><div> Resize and position the cam&#039;s viewPort with setViewPort().</div>
</li>
<li><div> (Optionally) Move the cameras in the scene and rotate them so they face what you want to see.</div>
</li>
<li><div> Create a ViewPort for each camera</div>
</li>
<li><div> Reset the camera&#039;s enabled statuses</div>
</li>
<li><div> Attach the Node to be displayed to this ViewPort. <br/>
The camera doesn&#039;t have to look at the rootNode, but that is the most common use case.</div>
</li>
</ol>
<p>
Here is the abstract code sample for camera <code>n</code>:
</p>
<pre>Camera cam_n = cam.clone&#40;&#41;;
cam_n.setViewPort&#40;...&#41;; // resize the viewPort
cam_n.setLocation&#40;new Vector3f&#40;...&#41;&#41;;
cam_n.setRotation&#40;new Quaternion&#40;...&#41;&#41;;
@ -16,7 +142,12 @@ cam_n.setRotation&#40;new Quaternion&#40;...&#41;&#41;;
ViewPort view_n = renderManager.createMainView&#40;&quot;View of camera #n&quot;, cam_n&#41;;
view_n.setClearEnabled&#40;true&#41;;
view_n.attachScene&#40;rootNode&#41;;
view_n.setBackgroundColor&#40;ColorRGBA.Black&#41;;</pre><p>To visualize what you do, use the following drawing of the viewport positions:</p><pre>0.0 , 1.0 1.0 , 1.0
view_n.setBackgroundColor&#40;ColorRGBA.Black&#41;;</pre>
<p>
To visualize what you do, use the following drawing of the viewport positions:
</p>
<pre>0.0 , 1.0 1.0 , 1.0
+-----+-----+
| | |
|cam3 |cam4 |
@ -24,19 +155,36 @@ view_n.setBackgroundColor&#40;ColorRGBA.Black&#41;;</pre><p>To visualize what yo
| | |
|cam2 |cam1 |
+-----+-----+
0.0 , 0.0 1.0 , 0.0</pre><p>This are the lines of code that set the four cameras to create a four-times split screen.</p><pre>cam1.setViewPort&#40; 0.5f , 1.0f , 0.0f , 0.5f&#41;;
0.0 , 0.0 1.0 , 0.0</pre>
<p>
This are the lines of code that set the four cameras to create a four-times split screen.
</p>
<pre>cam1.setViewPort&#40; 0.5f , 1.0f , 0.0f , 0.5f&#41;;
...
cam2.setViewPort&#40; 0.0f , 0.5f , 0.0f , 0.5f&#41;;
...
cam3.setViewPort&#40; 0.0f , 0.5f , 0.5f , 1.0f&#41;;
...
cam4.setViewPort&#40; 0.5f , 1.0f , 0.5f , 1.0f&#41;;</pre></div><h2><a>Picture in Picture</a></h2><div><p>The following code snippet sets up two views, one covers the whole screen, and the second is a small view in the top center.</p><pre> +-----+-----+
cam4.setViewPort&#40; 0.5f , 1.0f , 0.5f , 1.0f&#41;;</pre>
</div>
<h2><a>Picture in Picture</a></h2>
<div>
<p>
The following code snippet sets up two views, one covers the whole screen, and the second is a small view in the top center.
</p>
<pre> +-----+-----+
| |cam| |
| | 2 | |
+ +---+ +
| |
| cam |
+-----+-----+</pre><pre>// Setup first full-window view
+-----+-----+</pre>
<pre>// Setup first full-window view
cam.setViewPort&#40;0f, 1f, 0f, 1f&#41;;
cam.setLocation&#40;new Vector3f&#40;3.32f, 4.48f, 4.28f&#41;&#41;;
cam.setRotation&#40;new Quaternion&#40;-0.07f, 0.92f, -0.25f, -0.27f&#41;&#41;;
@ -48,7 +196,16 @@ cam2.setLocation&#40;new Vector3f&#40;-0.10f, 1.57f, 4.81f&#41;&#41;;
cam2.setRotation&#40;new Quaternion&#40;0.00f, 0.99f, -0.04f, 0.02f&#41;&#41;;
ViewPort viewPort2 = renderManager.createMainView&#40;&quot;PiP&quot;, cam2&#41;;
viewPort2.setClearFlags&#40;true, true, true&#41;;
viewPort2.attachScene&#40;rootNode&#41;;</pre></div><h2><a>Settings</a></h2><div><p>You can customize the camera and the viewPort of each view individually. For example, each view can have a different background color:
viewPort2.attachScene&#40;rootNode&#41;;</pre>
</div>
<h2><a>Settings</a></h2>
<div>
<p>
You can customize the camera and the viewPort of each view individually. For example, each view can have a different background color:
</p>
<pre>viewPort.setBackgroundColor&#40;ColorRGBA.Blue&#41;;</pre>

@ -1,10 +1,107 @@
<h1><a>Multithreading Optimization</a></h1><div><p>First, make sure you know what <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">Application States</a> and <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Custom Controls</a> are.</p><p>More complex games may feature complex mathematical operations or artificially intelligent calculations (such as path finding for several NPCs). If you make many time-intensive calls on the same thread (in the update loop), they will block one another, and thus slow down the game to a degree that makes it unplayable. If your game requires long running tasks, you should run them concurrently on separate threads, which speeds up the application considerably.</p><p>Often multithreading means having separate detached logical loops going on in parallel, which communicate about their state. (For example, one thread for AI, one Sound, one Graphics). However we recommend to use a global update loop for game logic, and do multithreading within that loop when it is appropriate. This approach scales way better to multiple cores and does not break up your code logic.</p><p>Effectively, each for-loop in the main update loop might be a chance for multithreading, if you can break it up into self-contained tasks.</p></div><h2><a>Java Multithreading</a></h2><div><p>The java.util.concurrent package provides a good foundation for multithreading and dividing work into tasks that can be executed concurrently (hence the name). The three basic components are the Executor (supervises threads), Callable Objects (the tasks), and Future Objects (the result). You can <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://download.oracle.com/javase/tutorial/essential/concurrency/"><param name="text" value="<html><u>read about the concurrent package more here</u></html>"><param name="textColor" value="blue"></object>, I will give just a short introduction.</p><ul><li><div>A Callable is one of the classes that gets executed on a thread in the Executor. The object represents one of several concurrent tasks (e.g, one NPC&#039;s path finding task). Each Callable is started from the updateloop by calling a method named <code>call()</code>.</div></li><li><div>The Executor is one central object that manages all your Callables. Every time you schedule a Callable in the Executor, the Executor returns a Future object for it.</div></li><li><div>A Future is an object that you use to check the status of an individual Callable task. The Future also gives you the return value in case one is returned.</div></li></ul></div><h2><a>Multithreading in jME3</a></h2><div><p>So how do we implement multithreading in jME3?</p><p>Let&#039;s take the example of a Control that controls an NPC Spatial. The NPC Control has to compute a lengthy pathfinding operation for each NPC. If we would execute the operations directly in the simpleUpdate() loop, it would block the game each time a NPC wants to move from A to B. Even if we move this behaviour into the update() method of a dedicated NPC Control, we would still get annoying freeze frames, because it still runs on the same update loop thread.</p><p>To avoid slowdown, we decide to keep the pathfinding operations in the NPC Control, <em>but execute it on another thread</em>.</p></div><h3><a>Executor</a></h3><div><p>You create the executor object in a global AppState (or the initSimpleApp() method), in any case in a high-level place where multiple controls can access it.</p><pre>/* This constructor creates a new executor with a core pool size of 4. */
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor&#40;4&#41;;</pre><p>Pool size means the executor will keep four threads alive at any time. Having more threads in the pool means that more tasks can run concurrently. But a bigger pool only results in a speed gain if the PC can handle it! Allocating a pool that is uselessly large just wastes memory, so you need to find a good compromise: About the same to double the size of the number of cores in the computer makes sense.</p></div><h3><a>Control Class Fields</a></h3><div><p>In the NPC Control, we create the individual objects that the thread manipulates. In our example case (the pathfinding control), the task is about locations and path arrays, so we need the following variables:</p><pre>//The vector to store the desired location in:
<h1><a>Multithreading Optimization</a></h1>
<div>
<p>
First, make sure you know what <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">Application States</a> and <a href="/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html">Custom Controls</a> are.
</p>
<p>
More complex games may feature complex mathematical operations or artificially intelligent calculations (such as path finding for several NPCs). If you make many time-intensive calls on the same thread (in the update loop), they will block one another, and thus slow down the game to a degree that makes it unplayable. If your game requires long running tasks, you should run them concurrently on separate threads, which speeds up the application considerably.
</p>
<p>
Often multithreading means having separate detached logical loops going on in parallel, which communicate about their state. (For example, one thread for AI, one Sound, one Graphics). However we recommend to use a global update loop for game logic, and do multithreading within that loop when it is appropriate. This approach scales way better to multiple cores and does not break up your code logic.
</p>
<p>
Effectively, each for-loop in the main update loop might be a chance for multithreading, if you can break it up into self-contained tasks.
</p>
</div>
<h2><a>Java Multithreading</a></h2>
<div>
<p>
The java.util.concurrent package provides a good foundation for multithreading and dividing work into tasks that can be executed concurrently (hence the name). The three basic components are the Executor (supervises threads), Callable Objects (the tasks), and Future Objects (the result). You can <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://download.oracle.com/javase/tutorial/essential/concurrency/"><param name="text" value="<html><u>read about the concurrent package more here</u></html>"><param name="textColor" value="blue"></object>, I will give just a short introduction.
</p>
<ul>
<li><div> A Callable is one of the classes that gets executed on a thread in the Executor. The object represents one of several concurrent tasks (e.g, one NPC&#039;s path finding task). Each Callable is started from the updateloop by calling a method named <code>call()</code>.</div>
</li>
<li><div> The Executor is one central object that manages all your Callables. Every time you schedule a Callable in the Executor, the Executor returns a Future object for it. </div>
</li>
<li><div> A Future is an object that you use to check the status of an individual Callable task. The Future also gives you the return value in case one is returned.</div>
</li>
</ul>
</div>
<h2><a>Multithreading in jME3</a></h2>
<div>
<p>
So how do we implement multithreading in jME3?
</p>
<p>
Let&#039;s take the example of a Control that controls an NPC Spatial. The NPC Control has to compute a lengthy pathfinding operation for each NPC. If we would execute the operations directly in the simpleUpdate() loop, it would block the game each time a NPC wants to move from A to B. Even if we move this behaviour into the update() method of a dedicated NPC Control, we would still get annoying freeze frames, because it still runs on the same update loop thread.
</p>
<p>
To avoid slowdown, we decide to keep the pathfinding operations in the NPC Control, <em>but execute it on another thread</em>.
</p>
</div>
<h3><a>Executor</a></h3>
<div>
<p>
You create the executor object in a global AppState (or the initSimpleApp() method), in any case in a high-level place where multiple controls can access it.
</p>
<pre>/* This constructor creates a new executor with a core pool size of 4. */
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor&#40;4&#41;;</pre>
<p>
Pool size means the executor will keep four threads alive at any time. Having more threads in the pool means that more tasks can run concurrently. But a bigger pool only results in a speed gain if the PC can handle it! Allocating a pool that is uselessly large just wastes memory, so you need to find a good compromise: About the same to double the size of the number of cores in the computer makes sense.
</p>
</div>
<h3><a>Control Class Fields</a></h3>
<div>
<p>
In the NPC Control, we create the individual objects that the thread manipulates. In our example case (the pathfinding control), the task is about locations and path arrays, so we need the following variables:
</p>
<pre>//The vector to store the desired location in:
Vector3f desiredLocation = new Vector3f&#40;&#41;;
//The MyWayList object that contains the result waylist:
MyWayList wayList = null;
//The future that is used to check the execution status:
Future future = null;</pre><p>Here we also created the Future variable to track the state of this task.</p></div><h3><a>Control Update() Method</a></h3><div><p>Next let&#039;s look at the update() call of the Control where the time-intensive task starts. In our example, the task is the <code>findWay</code> Callable (which contains the pathfinding process). So instead of spelling out the pathfinding process in the Control&#039;s update() loop, we start the process via <code>future = executor.submit(findWay);</code>.</p><pre>public void update&#40;float tpf&#41; &#123;
Future future = null;</pre>
<p>
Here we also created the Future variable to track the state of this task.
</p>
</div>
<h3><a>Control Update() Method</a></h3>
<div>
<p>
Next let&#039;s look at the update() call of the Control where the time-intensive task starts. In our example, the task is the <code>findWay</code> Callable (which contains the pathfinding process). So instead of spelling out the pathfinding process in the Control&#039;s update() loop, we start the process via <code>future = executor.submit(findWay);</code>.
</p>
<pre>public void update&#40;float tpf&#41; &#123;
try&#123;
//If we have no waylist and not started a callable yet, do so!
if&#40;wayList == null &amp;&amp; future == null&#41;&#123;
@ -33,7 +130,48 @@ Future future = null;</pre><p>Here we also created the Future variable to track
if&#40;wayList != null&#41;&#123;
//.... Success! Let's process the wayList and move the NPC...
&#125;
&#125;</pre><p>Note how this logic makes its decision based on the Future object.</p><p>Remember not to mess with the class fields after starting the thread, because they are being accessed and modified on the new thread. In more obvious terms: You cannot change the &quot;desired location&quot; of the NPC while the path finder is calculating a different path. You have to cancel the current Future first.</p></div><h3><a>The Callable</a></h3><div><p>The next code sample shows the Callable that is dedicated to performing the long-running task (here, wayfinding). This is the task that used to block the rest of the application, and is now executed on a thread of its own. You implement the task in the Callable always in an inner method named <code>call()</code>.</p><p>The task code in the Callable should be self-contained! It should not write or read any data of objects that are managed by the scene graph or OpenGL thread directly. Even reading locations of Spatials can be problematic! So ideally all data that is needed for the wayfinding process should be available to the new thread when it starts already, possibly in a cloned version so no concurrent access to the data happens.</p><p>In reality, you might need access to the game state. If you must read or write a current state from the scene graph, you must have a clone of the data in your thread. There are only two ways:</p><ul><li><div>Use the execution queue <code>application.enqueue()</code> to create a sub-thread that clones the info. Only disadvantage is, it may be slower. <br/> The example below gets the <code>Vector3f location</code> from the scene object <code>mySpatial</code> using this way.</div></li><li><div>Create a separate World class that allows safe access to its data via synchronized methods to access the scene graph. Alternatively it can also internally use <code>application.enqueue()</code>. <br/> The following example gets the object <code>Data data = myWorld.getData();</code> using this way.</div></li></ul><p>These two ways are thread-safe, they don&#039;t mess up the game logic, and keep the Callable code readable.</p><pre>// A self-contained time-intensive task:
&#125;</pre>
<p>
Note how this logic makes its decision based on the Future object.
</p>
<p>
Remember not to mess with the class fields after starting the thread, because they are being accessed and modified on the new thread. In more obvious terms: You cannot change the &quot;desired location&quot; of the NPC while the path finder is calculating a different path. You have to cancel the current Future first.
</p>
</div>
<h3><a>The Callable</a></h3>
<div>
<p>
The next code sample shows the Callable that is dedicated to performing the long-running task (here, wayfinding). This is the task that used to block the rest of the application, and is now executed on a thread of its own. You implement the task in the Callable always in an inner method named <code>call()</code>.
</p>
<p>
The task code in the Callable should be self-contained! It should not write or read any data of objects that are managed by the scene graph or OpenGL thread directly. Even reading locations of Spatials can be problematic! So ideally all data that is needed for the wayfinding process should be available to the new thread when it starts already, possibly in a cloned version so no concurrent access to the data happens.
</p>
<p>
In reality, you might need access to the game state. If you must read or write a current state from the scene graph, you must have a clone of the data in your thread. There are only two ways:
</p>
<ul>
<li><div> Use the execution queue <code>application.enqueue()</code> to create a sub-thread that clones the info. Only disadvantage is, it may be slower. <br/>
The example below gets the <code>Vector3f location</code> from the scene object <code>mySpatial</code> using this way.</div>
</li>
<li><div> Create a separate World class that allows safe access to its data via synchronized methods to access the scene graph. Alternatively it can also internally use <code>application.enqueue()</code>. <br/>
The following example gets the object <code>Data data = myWorld.getData();</code> using this way.</div>
</li>
</ul>
<p>
These two ways are thread-safe, they don&#039;t mess up the game logic, and keep the Callable code readable.
</p>
<pre>// A self-contained time-intensive task:
private Callable&lt;MyWayList&gt; findWay = new Callable&lt;MyWayList&gt;&#40;&#41;&#123;
public MyWayList call&#40;&#41; throws Exception &#123;
&nbsp;

@ -1,19 +1,118 @@
<h1><a>SpiderMonkey: Multi-Player Networking</a></h1><div><p>This document introduces you to the SpiderMonkey networking <acronym title="Application Programming Interface">API</acronym>. You use this <acronym title="Application Programming Interface">API</acronym> when you develop games where several players compete with one another in real time. A multi-player game is made up of several clients connecting to a server:</p><ul><li><div>The central server (one headless SimpleApplication) coordinates the game in the background.</div></li><li><div>Each player runs a game client (a standard SimpleApplications) and connects to the central server.</div></li></ul><p>Each Client keeps the the Server informed about its player&#039;s moves and actions. The Server centrally maintains the game state and broadcasts the state info back to all connected clients. This network synchronization allows all clients share the same game world. Each client then displays the game state to one player from this player&#039;s perspective.</p></div><h2><a>SpiderMonkey API Overview</a></h2><div><p>The SpiderMonkey <acronym title="Application Programming Interface">API</acronym> is a set of interfaces and helper classes in the &#039;com.jme3.network&#039; package. For most users, this package and the &#039;message&#039; package is all they need to worry about. (The &#039;base&#039; and &#039;kernel&#039; packages only come into play when implementing custom network transports or alternate client/server protocols, which is now possible).</p><p>The SpiderMonkey <acronym title="Application Programming Interface">API</acronym> assists you in creating a Server, Clients, and Messages. Once a Server instance is created and started, the Server accepts remote connections from Clients, and you can send and receive Messages. Client objects represent the client-side of the client-server connection. Within the Server, these Client objects are referred to as HostedConnections. HostedConnections can hold application-defined client-specific session attributes that the server-side listeners and services can use to track player information, etc.</p><div><table><tr><th>Seen from the Client</th><th></th><th>Seen from the Server</th></tr><tr><td>com.jme3.network.Client</td><td>==</td><td>com.jme3.network.HostedConnection</td></tr></table></div><p>You can register several types of listeners to be notified of changes.</p><ul><li><div>MessageListeners on both the Client and the Server are notified when new messages arrive. You can use MessageListeners to be notified about only specific types of messages.</div></li><li><div>ClientStateListeners inform the Client of changes in its connection state, e.g. when the client gets kicked from the server.</div></li><li><div>ConnectionListeners inform the Server about HostedConnection arrivals and removals, e.g. if a client joins or quits.</div></li></ul></div><h2><a>Client and Server</a></h2><div></div><h3><a>Creating a Server</a></h3><div><p>The game server is a &quot;headless&quot; com.jme3.app.SimpleApplication:</p><pre>public class MyGameServer extends SimpleApplication &#123;
<h1><a>SpiderMonkey: Multi-Player Networking</a></h1>
<div>
<p>
This document introduces you to the SpiderMonkey networking <acronym title="Application Programming Interface">API</acronym>. You use this <acronym title="Application Programming Interface">API</acronym> when you develop games where several players compete with one another in real time. A multi-player game is made up of several clients connecting to a server:
</p>
<ul>
<li><div> The central server (one headless SimpleApplication) coordinates the game in the background.</div>
</li>
<li><div> Each player runs a game client (a standard SimpleApplications) and connects to the central server.</div>
</li>
</ul>
<p>
Each Client keeps the the Server informed about its player&#039;s moves and actions. The Server centrally maintains the game state and broadcasts the state info back to all connected clients. This network synchronization allows all clients share the same game world. Each client then displays the game state to one player from this player&#039;s perspective.
</p>
</div>
<h2><a>SpiderMonkey API Overview</a></h2>
<div>
<p>
The SpiderMonkey <acronym title="Application Programming Interface">API</acronym> is a set of interfaces and helper classes in the &#039;com.jme3.network&#039; package. For most users, this package and the &#039;message&#039; package is all they need to worry about. (The &#039;base&#039; and &#039;kernel&#039; packages only come into play when implementing custom network transports or alternate client/server protocols, which is now possible).
</p>
<p>
The SpiderMonkey <acronym title="Application Programming Interface">API</acronym> assists you in creating a Server, Clients, and Messages. Once a Server instance is created and started, the Server accepts remote connections from Clients, and you can send and receive Messages. Client objects represent the client-side of the client-server connection. Within the Server, these Client objects are referred to as HostedConnections. HostedConnections can hold application-defined client-specific session attributes that the server-side listeners and services can use to track player information, etc.
</p>
<div><table>
<tr>
<th> Seen from the Client </th><th> </th><th> Seen from the Server </th>
</tr>
<tr>
<td> com.jme3.network.Client </td><td> == </td><td> com.jme3.network.HostedConnection </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [1769-1887] -->
<p>
You can register several types of listeners to be notified of changes.
</p>
<ul>
<li><div> MessageListeners on both the Client and the Server are notified when new messages arrive. You can use MessageListeners to be notified about only specific types of messages.</div>
</li>
<li><div> ClientStateListeners inform the Client of changes in its connection state, e.g. when the client gets kicked from the server.</div>
</li>
<li><div> ConnectionListeners inform the Server about HostedConnection arrivals and removals, e.g. if a client joins or quits.</div>
</li>
</ul>
</div>
<h2><a>Client and Server</a></h2>
<div>
</div>
<h3><a>Creating a Server</a></h3>
<div>
<p>
The game server is a &quot;headless&quot; com.jme3.app.SimpleApplication:
</p>
<pre>public class MyGameServer extends SimpleApplication &#123;
public static void main&#40;String&#91;&#93; args&#41; &#123;
ServerMain app = new ServerMain&#40;&#41;;
app.start&#40;JmeContext.Type.Headless&#41;; // headless type for servers!
&#125;
&#125;</pre><p><p><div>A <code>Headless</code> SimpleApplication executes the simpleInitApp() method and runs the update loop normally. But the application does not open a window, and it does not listen to user input. This is the typical behavior for a server application.</div></p></p><p>Create a com.jme3.network.Server in the <code>simpleInitApp()</code> method and specify a communication port, for example 6143.</p><pre> public void simpleInitApp&#40;&#41; &#123;
&#125;</pre>
<p>
<p><div>A <code>Headless</code> SimpleApplication executes the simpleInitApp() method and runs the update loop normally. But the application does not open a window, and it does not listen to user input. This is the typical behavior for a server application.
</div></p>
</p>
<p>
Create a com.jme3.network.Server in the <code>simpleInitApp()</code> method and specify a communication port, for example 6143.
</p>
<pre> public void simpleInitApp&#40;&#41; &#123;
...
Server myServer = Network.createServer&#40;6143&#41;;
myServer.start&#40;&#41;;
...
&#125;</pre><p>When you run this app on a host, the server is ready to accept clients. Let&#039;s create a client next.</p></div><h3><a>Creating a Client</a></h3><div><p>A game client is a standard com.jme3.app.SimpleApplication.</p><pre>public class MyGameClient extends SimpleApplication &#123;
&#125;</pre>
<p>
When you run this app on a host, the server is ready to accept clients. Let&#039;s create a client next.
</p>
</div>
<h3><a>Creating a Client</a></h3>
<div>
<p>
A game client is a standard com.jme3.app.SimpleApplication.
</p>
<pre>public class MyGameClient extends SimpleApplication &#123;
public static void main&#40;String&#91;&#93; args&#41; &#123;
ClientMain app = new ClientMain&#40;&#41;;
app.start&#40;JmeContext.Type.Display&#41;; // standard display type
&#125;
&#125;</pre><p><p><div>A standard SimpleApplication in <code>Display</code> mode executes the simpleInitApp() method, runs the update loop, opens a window for the rendered video output, and listens to user input. This is the typical behavior for a client application.
&#125;</pre>
<p>
<p><div>A standard SimpleApplication in <code>Display</code> mode executes the simpleInitApp() method, runs the update loop, opens a window for the rendered video output, and listens to user input. This is the typical behavior for a client application.
</div></p>
</p>

@ -1,4 +1,21 @@
<h1><a>Creating User Interfaces with Nifty GUI</a></h1><div><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nifty-gui-13.png"></p><p>You may want your players to press a button to save a game, you want a scrolling text field for highscores, a text label to display the score, drop-downs to select keymap preferences, or checkboxes to specify multi-media options. Usually you solve these tasks by using Swing controls. Although it is possible to embed a <a href="/com/jme3/gde/core/docs/jme3/advanced/swing_canvas.html">jME3 canvas</a> in a Swing <acronym title="Graphical User Interface">GUI</acronym>, a 3D game typically runs full-screen, or in a window of its own.</p><p>This document introduces you to <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://nifty-gui.lessvoid.com/"><param name="text" value="<html><u>Nifty GUI</u></html>"><param name="textColor" value="blue"></object>, a Java library for building interactive graphical user interfaces (GUIs) for games or similar applications. Nifty <acronym title="Graphical User Interface">GUI</acronym> (the <code>de.lessvoid.nifty</code> package) is well integrated with jME3 through the <code>com.jme3.niftygui</code> package. You define the base <acronym title="Graphical User Interface">GUI</acronym> layout in <acronym title="Extensible Markup Language">XML</acronym>, and control it dynamically from your Java code. The necessary JAR libraries are included in your jME3 download, you do not need to install anything extra. (Just make sure they are on the classpath.)</p><ul><li><div><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://vimeo.com/25637085"><param name="text" value="<html><u>Video demo of Nifty GUI 1.3</u></html>"><param name="textColor" value="blue"></object> </div>
<h1><a>Creating User Interfaces with Nifty GUI</a></h1>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nifty-gui-13.png">
</p>
<p>
You may want your players to press a button to save a game, you want a scrolling text field for highscores, a text label to display the score, drop-downs to select keymap preferences, or checkboxes to specify multi-media options. Usually you solve these tasks by using Swing controls. Although it is possible to embed a <a href="/com/jme3/gde/core/docs/jme3/advanced/swing_canvas.html">jME3 canvas</a> in a Swing <acronym title="Graphical User Interface">GUI</acronym>, a 3D game typically runs full-screen, or in a window of its own.
</p>
<p>
This document introduces you to <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://nifty-gui.lessvoid.com/"><param name="text" value="<html><u>Nifty GUI</u></html>"><param name="textColor" value="blue"></object>, a Java library for building interactive graphical user interfaces (GUIs) for games or similar applications. Nifty <acronym title="Graphical User Interface">GUI</acronym> (the <code>de.lessvoid.nifty</code> package) is well integrated with jME3 through the <code>com.jme3.niftygui</code> package. You define the base <acronym title="Graphical User Interface">GUI</acronym> layout in <acronym title="Extensible Markup Language">XML</acronym>, and control it dynamically from your Java code. The necessary JAR libraries are included in your jME3 download, you do not need to install anything extra. (Just make sure they are on the classpath.)
</p>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://vimeo.com/25637085"><param name="text" value="<html><u>Video demo of Nifty GUI 1.3</u></html>"><param name="textColor" value="blue"></object> </div>
</li>
</ul>
@ -199,24 +216,12 @@ Include the following <acronym title="Extensible Markup Language">XML</acronym>
Learn more from the NiftyGUI page!
</p>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://nifty-gui.sourceforge.net/webstart/nifty-tutorial-1.2.jnlp"><param name="text" value="<html><u>Interactive &quot;video&quot; tutorial (Webstart)</u></html>"><param name="textColor" value="blue"></object></div>
<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>
</li>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://nifty-gui.sourceforge.net/projects/1.3-SNAPSHOT/nifty/apidocs/index.html"><param name="text" value="<html><u>Nifty 1.3 JavaDoc</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://nifty-gui.sourceforge.net/projects/1.3-SNAPSHOT/nifty-default-controls/apidocs/"><param name="text" value="<html><u>Nifty 1.3 Controls JavaDoc</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://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Nifty_Standard_Controls_%28Nifty_1.3%29"><param name="text" value="<html><u>Examples of Standard Controls in Nifty 1.3:</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://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=MarkUp"><param name="text" value="<html><u>Nifty Syntax</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://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Tutorials"><param name="text" value="<html><u>The Nifty Tutorials</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://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Reference"><param name="text" value="<html><u>Bookmark the Reference Guide</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://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Hello_World_Example"><param name="text" value="<html><u>http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Hello_World_Example</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://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Layout_Introduction"><param name="text" value="<html><u>http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Layout_Introduction</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://jmonkeyengine.org/groups/gui/forum/topic/anyone-succeeded-in-changing-text-in-nifty-programatically/#post-109510"><param name="text" value="<html><u>Forum post: Changing Text in Nifty GUIs programmatically</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>

@ -1,4 +1,36 @@
<h1><a>Interacting with the GUI from Java</a></h1><div><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_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></li><li><div><strong>Nifty <acronym title="Graphical User Interface">GUI</acronym> Java Interaction</strong></div></li></ol><p>In the previous parts of the tutorial, you created a two-screen user interface. But it is still static, and when you click the buttons, nothing happens yet. The purpose of the <acronym title="Graphical User Interface">GUI</acronym> is to communicate with your Java classes: Your game needs to know what the users clicked, which settings they chose, which values they entered into a field, etc. Similarly, the user needs to know what the currently game state is (score, health, etc).</p></div><h2><a>Connect GUI to Java Controller</a></h2><div><p>To let a Nifty screen communicate with the Java application, you register a <code>ScreenController</code> to every NiftyGUI screen. You create a ScreenController by creating a Java class that implements the <code>de.lessvoid.nifty.screen.ScreenController</code> interface and its abtract methods.</p><p><strong>Pro Tip:</strong> Since you are writing a jME3 application, you can additionally make the ScreenController class extend the <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">AbstractAppState</a> class! This gives the ScreenController access to the application object and to the update loop!</p><pre>package tutorial;
<h1><a>Interacting with the GUI from Java</a></h1>
<div>
<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_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>
</li>
<li><div> <strong>Nifty <acronym title="Graphical User Interface">GUI</acronym> Java Interaction</strong></div>
</li>
</ol>
<p>
In the previous parts of the tutorial, you created a two-screen user interface. But it is still static, and when you click the buttons, nothing happens yet. The purpose of the <acronym title="Graphical User Interface">GUI</acronym> is to communicate with your Java classes: Your game needs to know what the users clicked, which settings they chose, which values they entered into a field, etc. Similarly, the user needs to know what the currently game state is (score, health, etc).
</p>
</div>
<h2><a>Connect GUI to Java Controller</a></h2>
<div>
<p>
To let a Nifty screen communicate with the Java application, you register a <code>ScreenController</code> to every NiftyGUI screen. You create a ScreenController by creating a Java class that implements the <code>de.lessvoid.nifty.screen.ScreenController</code> interface and its abtract methods.
</p>
<p>
<strong>Pro Tip:</strong> Since you are writing a jME3 application, you can additionally make the ScreenController class extend the <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">AbstractAppState</a> class! This gives the ScreenController access to the application object and to the update loop!
</p>
<pre>package tutorial;
&nbsp;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
@ -44,12 +76,44 @@ public class MyStartScreen extends AbstractAppState implements ScreenController
/** jME update loop! */
&#125;
&nbsp;
&#125;</pre><p>The name and package of your custom ScreenController class (here <code>tutorial.MyStartScreen</code>) goes into the controller parameter of the respective <acronym title="Extensible Markup Language">XML</acronym> screen it belongs to. For example:</p><pre><span><span>&lt;nifty&gt;</span></span>
&#125;</pre>
<p>
The name and package of your custom ScreenController class (here <code>tutorial.MyStartScreen</code>) goes into the controller parameter of the respective <acronym title="Extensible Markup Language">XML</acronym> screen it belongs to. For example:
</p>
<pre><span><span>&lt;nifty&gt;</span></span>
<span>&lt;screen id=&quot;start&quot; controller=&quot;tutorial.MyStartScreen&quot;&gt;</span>
&lt;!-- layer and panel code ... --&gt;
<span><span>&lt;/screen&gt;</span></span>
<span><span>&lt;/nifty&gt;</span></span></pre><p>Or the same in a Java syntax, respectively:</p><pre> nifty.addScreen&#40;&quot;start&quot;, new ScreenBuilder&#40;&quot;start&quot;&#41; &#123;&#123;
controller&#40;new tutorial.MyStartScreen&#40;&#41;&#41;;</pre><p>Now the Java class <code>MyStartScreen</code> and this <acronym title="Graphical User Interface">GUI</acronym> screen (<code>start</code>) are connected. For this example you can also connect the <code>hud</code> screen to MyStartScreen.</p></div><h2><a>Make GUI and Java Interact</a></h2><div><p>In most cases, you will want to pass game data in and out of the ScreenController. Note that you can pass any custom arguments from your Java class into your ScreenController constructor (<code>public MyStartScreen(GameData data) {}</code>).</p><p>Use any combination of the three following approaches to make Java classes interact with the <acronym title="Graphical User Interface">GUI</acronym>.</p></div><h3><a>GUI Calls a Void Java Method</a></h3>
<span><span>&lt;/nifty&gt;</span></span></pre>
<p>
Or the same in a Java syntax, respectively:
</p>
<pre> nifty.addScreen&#40;&quot;start&quot;, new ScreenBuilder&#40;&quot;start&quot;&#41; &#123;&#123;
controller&#40;new tutorial.MyStartScreen&#40;&#41;&#41;;</pre>
<p>
Now the Java class <code>MyStartScreen</code> and this <acronym title="Graphical User Interface">GUI</acronym> screen (<code>start</code>) are connected. For this example you can also connect the <code>hud</code> screen to MyStartScreen.
</p>
</div>
<h2><a>Make GUI and Java Interact</a></h2>
<div>
<p>
In most cases, you will want to pass game data in and out of the ScreenController. Note that you can pass any custom arguments from your Java class into your ScreenController constructor (<code>public MyStartScreen(GameData data) {}</code>).
</p>
<p>
Use any combination of the three following approaches to make Java classes interact with the <acronym title="Graphical User Interface">GUI</acronym>.
</p>
</div>
<h3><a>GUI Calls a Void Java Method</a></h3>
<div>
<p>
@ -238,6 +302,8 @@ You&#039;re done with the basic Nifty <acronym title="Graphical User Interface">
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_scenarios.html"> Nifty GUI Scenarios</a></div>
</li>
<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>
</li>
</ul>
<div><span>
<a href="/wiki/doku.php/tag:gui?do=showtag&amp;tag=tag%3Agui">gui</a>,

@ -1,4 +1,50 @@
<h1><a>Integrating Nifty GUI: Overlay</a></h1><div><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_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></li><li><div><a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">Interact with the GUI from Java</a></div></li></ol><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nifty-gui-example.png"></p><p>Typically, you define a key (for example escape) that switches the <acronym title="Graphical User Interface">GUI</acronym> on and off. The <acronym title="Graphical User Interface">GUI</acronym> can be a StartScreen, OptionsScreen, CharacterCreationScreen, etc. While the <acronym title="Graphical User Interface">GUI</acronym> is up, you pause the running game, and then overlay the <acronym title="Graphical User Interface">GUI</acronym>. You also must switch to a different set of user inputs while the game is paused, so the player can use the mouse pointer and keyboard to interact with the <acronym title="Graphical User Interface">GUI</acronym>.</p><p>You can also <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html">project</a> the <acronym title="Graphical User Interface">GUI</acronym> as a texture onto a mesh texture (but then you cannot click to select). On this page, we look at the overlay variant, which is more commonly used in games.</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/niftygui/TestNiftyGui.java"><param name="text" value="<html><u>TestNiftyGui.java</u></html>"><param name="textColor" value="blue"></object></div></li></ul></div><h2><a>Overlaying the User Interface Over the Screen</a></h2><div><p>This code shows you how to overlay anything on the screen with the <acronym title="Graphical User Interface">GUI</acronym>. This is the most common usecase.</p><pre>NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay&#40;
<h1><a>Integrating Nifty GUI: Overlay</a></h1>
<div>
<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_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>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">Interact with the GUI from Java</a></div>
</li>
</ol>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nifty-gui-example.png">
</p>
<p>
Typically, you define a key (for example escape) that switches the <acronym title="Graphical User Interface">GUI</acronym> on and off. The <acronym title="Graphical User Interface">GUI</acronym> can be a StartScreen, OptionsScreen, CharacterCreationScreen, etc. While the <acronym title="Graphical User Interface">GUI</acronym> is up, you pause the running game, and then overlay the <acronym title="Graphical User Interface">GUI</acronym>. You also must switch to a different set of user inputs while the game is paused, so the player can use the mouse pointer and keyboard to interact with the <acronym title="Graphical User Interface">GUI</acronym>.
</p>
<p>
You can also <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html">project</a> the <acronym title="Graphical User Interface">GUI</acronym> as a texture onto a mesh texture (but then you cannot click to select).
On this page, we look at the overlay variant, which is more commonly used in games.
</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/niftygui/TestNiftyGui.java"><param name="text" value="<html><u>TestNiftyGui.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>Overlaying the User Interface Over the Screen</a></h2>
<div>
<p>
This code shows you how to overlay anything on the screen with the <acronym title="Graphical User Interface">GUI</acronym>. This is the most common usecase.
</p>
<pre>NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay&#40;
assetManager, inputManager, audioRenderer, guiViewPort&#41;;
/** Create a new NiftyGUI object */
Nifty nifty = niftyDisplay.getNifty&#40;&#41;;

@ -0,0 +1,92 @@
<h1><a>Nifty GUI: Create a PopUp Menu</a></h1>
<div>
<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>.
</p>
<pre><span>&lt;useControls filename=&quot;nifty-default-controls.xml&quot;/&gt;</span>
...
<span>&lt;popup id=&quot;niftyPopupMenu&quot; childLayout=&quot;absolute-inside&quot;</span>
<span> controller=&quot;ControllerOfYourChoice&quot; width=&quot;10%&quot;&gt;</span>
<span>&lt;interact onClick=&quot;closePopup()&quot; onSecondaryClick=&quot;closePopup()&quot; onTertiaryClick=&quot;closePopup()&quot; /&gt;</span>
<span>&lt;control id=&quot;#menu&quot; name=&quot;niftyMenu&quot; /&gt;</span>
<span><span>&lt;/popup&gt;</span></span>
...</pre>
<p>
A brief explanation of some the attributes above:
</p>
<ul>
<li><div> The popup id is used within your Java code so that nifty knows which popup placeholder to create.</div>
</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>
<li><div> The control id is used by the Java class to define a control type (i.e. Menu)</div>
</li>
</ul>
<p>
The Java code within your defined ScreenController implementation:
</p>
<pre>private Element popup;
...
public void createMyPopupMenu&#40;&#41;&#123;
popup = nifty.createPopup&#40;&quot;niftyPopupMenu&quot;&#41;;
Menu.class&#41;;
myMenu.setWidth&#40;new SizeValue&#40;&quot;100px&quot;&#41;&#41;; // must be set
myMenu.addMenuItem&#40;&quot;Click me!&quot;, &quot;menuItemIcon.png&quot;,
new menuItem&#40;&quot;menuItemid&quot;, &quot;blah blah&quot;&#41;&#41;; // menuItem is a custom class
nifty.subscribe&#40;
nifty.getCurrentScreen&#40;&#41;,
myMenu.getId&#40;&#41;,
MenuItemActivatedEvent.class,
new MenuItemActivatedEventSubscriber&#40;&#41;&#41;;
&#125;
&nbsp;
public void showMenu&#40;&#41; &#123; // the method to trigger the menu
// If this is a menu that is going to be used many times, then
// call this in your constructor rather than here
createMyPopupMenu&#40;&#41;
// call the popup to screen of your choice:
nifty.showPopup&#40;nifty.getCurrentScreen&#40;&#41;, popup.getId&#40;&#41;, null&#41;;
&#125;
&nbsp;
private class menuItem &#123;
public String id;
public String name;
public menuItem&#40;String name&#41;&#123;
this.id= id;
this.name = name;
&#125;
&#125;</pre>
<ul>
<li><div> The createMyPopupMenu() method creates the menu with set width so that you can populate it.</div>
</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>
</ul>
<p>
To handle menu item events (i.e. calling a method when you click on a menu item), you register (subscribe) a EventTopicSubscriber&lt;MenuItemActivatedEvent&gt; class implementation to a nifty screen and element.
</p>
<pre> private class MenuItemActivatedEventSubscriber
implements EventTopicSubscriber&lt;MenuItemActivatedEvent&gt; &#123;
&nbsp;
@Override
public void onEvent&#40;final String id, final MenuItemActivatedEvent event&#41; &#123;
menuItem item = &#40;menuItem&#41; event.getItem&#40;&#41;;
if &#40;&quot;menuItemid&quot;.equals&#40;item.id&#41;&#41; &#123;
//do something !!!
&#125;
&#125;
&#125;;</pre>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:nifty_gui_popup_menu?do=export_xhtmlbody">view online version</a></em></p>

@ -1,4 +1,53 @@
<h1><a>Integrating Nifty GUI: Projection</a></h1><div><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_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></li><li><div><a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">Interact with the GUI from Java</a></div></li></ol><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nifty-gui.png"></p><p>Typically you define a key (for example escape) to switch the <acronym title="Graphical User Interface">GUI</acronym> on and off. Then you <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html">overlay</a> the running game with the <acronym title="Graphical User Interface">GUI</acronym> (you will most likely pause the game then).</p><p>Alternatively, you can also project the <acronym title="Graphical User Interface">GUI</acronym> as a texture onto a mesh textures inside the game. Allthough this looks cool and &quot;immersive&quot;, this approach is rarely used since it is difficult to record clicks this way. You can only interact with this projected <acronym title="Graphical User Interface">GUI</acronym> by keyboard, or programmatically. You can select input fields using the arrow keys, and trigger actions using the return key.</p><p>This <acronym title="Graphical User Interface">GUI</acronym> projection variant is less commonly used than the <acronym title="Graphical User Interface">GUI</acronym> overlay variant. Usecases for <acronym title="Graphical User Interface">GUI</acronym> projection are, for example, a player avatar using an in-game computer screen.</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/niftygui/TestNiftyToMesh.java"><param name="text" value="<html><u>TestNiftyToMesh.java</u></html>"><param name="textColor" value="blue"></object></div></li></ul></div><h2><a>Projecting the User Interface Onto a Texture</a></h2><div><p>You can project the Nifty <acronym title="Graphical User Interface">GUI</acronym> onto a texture, load the texture into a material, and assign it to a Geometry (Quads or Boxes are best).</p><pre>/** Create a special viewport for the Nifty GUI */
<h1><a>Integrating Nifty GUI: Projection</a></h1>
<div>
<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_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>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">Interact with the GUI from Java</a></div>
</li>
</ol>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nifty-gui.png">
</p>
<p>
Typically you define a key (for example escape) to switch the <acronym title="Graphical User Interface">GUI</acronym> on and off. Then you <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html">overlay</a> the running game with the <acronym title="Graphical User Interface">GUI</acronym> (you will most likely pause the game then).
</p>
<p>
Alternatively, you can also project the <acronym title="Graphical User Interface">GUI</acronym> as a texture onto a mesh textures inside the game. Allthough this looks cool and &quot;immersive&quot;, this approach is rarely used since it is difficult to record clicks this way. You can only interact with this projected <acronym title="Graphical User Interface">GUI</acronym> by keyboard, or programmatically. You can select input fields using the arrow keys, and trigger actions using the return key.
</p>
<p>
This <acronym title="Graphical User Interface">GUI</acronym> projection variant is less commonly used than the <acronym title="Graphical User Interface">GUI</acronym> overlay variant. Usecases for <acronym title="Graphical User Interface">GUI</acronym> projection are, for example, a player avatar using an in-game computer screen.
</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/niftygui/TestNiftyToMesh.java"><param name="text" value="<html><u>TestNiftyToMesh.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>Projecting the User Interface Onto a Texture</a></h2>
<div>
<p>
You can project the Nifty <acronym title="Graphical User Interface">GUI</acronym> onto a texture, load the texture into a material, and assign it to a Geometry (Quads or Boxes are best).
</p>
<pre>/** Create a special viewport for the Nifty GUI */
ViewPort niftyView = renderManager.createPreView&#40;&quot;NiftyView&quot;, new Camera&#40;1024, 768&#41;&#41;;
niftyView.setClearEnabled&#40;true&#41;;
/** Create a new NiftyJmeDisplay for the integration */
@ -24,5 +73,36 @@ Geometry geom = new Geometry&#40;&quot;Box&quot;, b&#41;;
Material mat = new Material&#40;assetManager, &quot;Common/MatDefs/Misc/Unshaded.j3md&quot;&#41;;
mat.setTexture&#40;&quot;m_ColorMap&quot;, niftytex&#41;; /** Here comes the texture! */
geom.setMaterial&#40;mat&#41;;
rootNode.attachChild&#40;geom&#41;;</pre><p>The MySettingsScreen class is a custom de.lessvoid.nifty.screen.ScreenController in which you implement your <acronym title="Graphical User Interface">GUI</acronym> behaviour. The variable <code>data</code> contains an object that you use to exchange state info with the game. See <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">Nifty GUI Java Interaction</a> for details on how to create this class.</p><p>Run the code sample. You select buttons on this <acronym title="Graphical User Interface">GUI</acronym> with the arrow keys and then press return. Note that clicking on the texture will not work!</p></div><h2><a>Next Steps</a></h2><div><p>Now that you have layed out and integrated the <acronym title="Graphical User Interface">GUI</acronym> in your app, you want to respond to user input and display the current game.</p><ul><li><div><a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">Interact with the GUI from Java</a></div></li></ul><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>, <a href="/wiki/doku.php/tag:nifty?do=showtag&amp;tag=tag%3Anifty">nifty</a>, <a href="/wiki/doku.php/tag:hud?do=showtag&amp;tag=tag%3Ahud">hud</a>, <a href="/wiki/doku.php/tag:texture?do=showtag&amp;tag=tag%3Atexture">texture</a> </span></div></div>
rootNode.attachChild&#40;geom&#41;;</pre>
<p>
The MySettingsScreen class is a custom de.lessvoid.nifty.screen.ScreenController in which you implement your <acronym title="Graphical User Interface">GUI</acronym> behaviour. The variable <code>data</code> contains an object that you use to exchange state info with the game. See <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">Nifty GUI Java Interaction</a> for details on how to create this class.
</p>
<p>
Run the code sample. You select buttons on this <acronym title="Graphical User Interface">GUI</acronym> with the arrow keys and then press return. Note that clicking on the texture will not work!
</p>
</div>
<h2><a>Next Steps</a></h2>
<div>
<p>
Now that you have layed out and integrated the <acronym title="Graphical User Interface">GUI</acronym> in your app, you want to respond to user input and display the current game.
</p>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">Interact with the GUI from Java</a></div>
</li>
</ul>
<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>,
<a href="/wiki/doku.php/tag:nifty?do=showtag&amp;tag=tag%3Anifty">nifty</a>,
<a href="/wiki/doku.php/tag:hud?do=showtag&amp;tag=tag%3Ahud">hud</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/jme3:advanced:nifty_gui_projection?do=export_xhtmlbody">view online version</a></em></p>

@ -0,0 +1,345 @@
<h1><a>Nifty GUI 1.3 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.
</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.
</p>
</div>
<h2><a>Switch Game States</a></h2>
<div>
<p>
In a JME game, you typically have three game states:
</p>
<ol>
<li><div> Stopped: The game is stopped, a StartScreen is displayed. </div>
</li>
<li><div> Running: The game is running, the in-game HudScreen is displayed. </div>
</li>
<li><div> Paused: The game is paused, a PausedScreen is displayed.</div>
</li>
</ol>
<p>
(Aside: Additionally, the Stopped state often contains a LoadScreen, LogonScreen, OptionsScreen, CharacterCreationScreen, HighScoreScreen, CreditsScreen, etc. Some games let you access the OptionsScreen in the Paused state as well. The Running state can also contain an InventoryScreen, ItemShopScreen, StatsScreen, SkillScreen, etc.)
</p>
<p>
In JME, game states are implemented as custom <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">AppState</a> objects. Write each AppState so it brings its own input mappings, rootNode content, update loop behaviour, etc with it.
</p>
<ol>
<li><div> Stopped: StartScreen AppState + GuiInputs AppState</div>
</li>
<li><div> Paused: PausedScreen AppState + GuiInputs AppState</div>
</li>
<li><div> Running: HudScreen AppState + InGameInputs AppState + BulletAppState (jme physics), …</div>
</li>
</ol>
<p>
When the player switches between game states, you detach one set of AppStates, and attach another. For example, when the player pauses the running game, you use a boolean switch to pause the game loop and deactivate the game inputs (shooting, navigation). The screen is overlayed with a PausedScreen, which contains a visible mouse pointer and a Continue button. When the player clicks Continue, the mouse pointer is deactivated, the in-game input and navigational mappings are activated, and the game loop continues.
</p>
</div>
<h2><a>Get Access to Application and Update Loop</a></h2>
<div>
<p>
Since you are writing a jME3 application, you can additionally make any ScreenController class extend the <a href="/com/jme3/gde/core/docs/jme3/advanced/application_states.html">AbstractAppState</a> class.
This gives the ScreenController access to the application object and to the update loop!
</p>
<pre>public class StartScreenState extends AbstractAppState &#123;
&nbsp;
private ViewPort viewPort;
private Node rootNode;
private Node guiNode;
private AssetManager assetManager;
private Node localRootNode = new Node&#40;&quot;Start Screen RootNode&quot;&#41;;
private Node localGuiNode = new Node&#40;&quot;Start Screen GuiNode&quot;&#41;;
private final ColorRGBA backgroundColor = ColorRGBA.Gray;
&nbsp;
public StartScreenState&#40;SimpleApplication app&#41;&#123;
this.rootNode = app.getRootNode&#40;&#41;;
this.viewPort = app.getViewPort&#40;&#41;;
this.guiNode = app.getGuiNode&#40;&#41;;
this.assetManager = app.getAssetManager&#40;&#41;;
&#125;
&nbsp;
@Override
public void initialize&#40;AppStateManager stateManager, Application app&#41; &#123;
super.initialize&#40;stateManager, app&#41;;
/** init the screen */
&#125;
&nbsp;
@Override
public void update&#40;float tpf&#41; &#123;
/** any main loop action happens here */
&#125;
&nbsp;
@Override
public void stateAttached&#40;AppStateManager stateManager&#41; &#123;
rootNode.attachChild&#40;localRootNode&#41;;
guiNode.attachChild&#40;localGuiNode&#41;;
viewPort.setBackgroundColor&#40;backgroundColor&#41;;
&#125;
&nbsp;
@Override
public void stateDetached&#40;AppStateManager stateManager&#41; &#123;
rootNode.detachChild&#40;localRootNode&#41;;
guiNode.detachChild&#40;localGuiNode&#41;;
&#125;
&nbsp;
&#125;</pre>
</div>
<h2><a>Know Your Variables</a></h2>
<div>
<div><table>
<tr>
<th>Variable</th><th>Description</th>
</tr>
<tr>
<td>${CALL.myMethod()} </td><td> Calls a method in the current ScreenController and gets the method&#039;s return String. The method can also be void and have a side effect, e.g. play a sound etc.</td>
</tr>
<tr>
<td>${ENV.HOME}</td><td> Returns the path to user&#039;s home directory.</td>
</tr>
<tr>
<td>${ENV.key} </td><td> Looks up <code>key</code> in the environment variables. Use it like Java&#039;s System.getEnv(&quot;key&quot;).</td>
</tr>
<tr>
<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] -->
<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>
</p>
</div>
<h2><a>Use ScreenControllers for Mutally Exclusive Functionality</a></h2>
<div>
<p>
Technically you are free to create one ScreenController class for each screen, or reuse the same ScreenController for all or some of them. In the end it may be best to create individual ScreenControllers for functionality that is mutually exclusive.
</p>
<p>
For example, create a <code>MyHudScreen.java</code> for the <code>hud</code> screen, and a <code>MyStartScreen.java</code> for the <code>start</code> screen.
</p>
<ul>
<li><div> Include all user interface methods that are needed during the game (while the HUD is up) in <code>MyHudScreen.java</code>. Then make this class control all screens that can be up during the game (the HUD screen, a MiniMap screen, an Inventory screen, an Abilities or Skills screen, etc). All these screens possibly share data (game data, player data), so it makes sense to control them all with methods of the same <code>MyHudScreen.java</code> class.</div>
</li>
<li><div> The start screen, however, is mostly independent of the running game. Include all user interface methods that are needed outside the game (while you are on the start screen) in <code>MyStartScreen.java</code>. Then make this class control all screens that can be up outside the game (the Start screen, a Settings/Options screen, a HighScore screen, etc). All these classes need to read and write saved game data, so it makes sense to control them all with methods of the same <code>MyStartScreen.java</code> class.</div>
</li>
</ul>
</div>
<h2><a>Create a Load Screen</a></h2>
<div>
<p>
<a href="/com/jme3/gde/core/docs/jme3/advanced/loading_screen.html">loading_screen</a>
</p>
</div>
<h2><a>Create a Popup Menu</a></h2>
<div>
<p>
<a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_popup_menu.html">nifty GUI PopUp Menu</a>
</p>
</div>
<h2><a>Add Visual Effects</a></h2>
<div>
<p>
You can register effects to screen elements.
</p>
<ul>
<li><div> Respond to element events such as onStartScreen, onEndScreen, onHover, onFocus, onActive,</div>
</li>
<li><div> Trigger effects that change movement, blending, size, color, fading, and much more.</div>
</li>
</ul>
<p>
Here is an example that moves a panel when the startScreen opens. You place an &lt; effect &gt; tag inside the element that you want to be affected.
</p>
<pre><span>&lt;panel height=&quot;25%&quot; width=&quot;35%&quot; ...&gt;</span>
<span><span>&lt;effect&gt;</span></span>
<span>&lt;onStartScreen name=&quot;move&quot; mode=&quot;in&quot; direction=&quot;top&quot; length=&quot;300&quot; startDelay=&quot;0&quot; inherit=&quot;true&quot;/&gt;</span>
<span><span>&lt;/effect&gt;</span></span>
<span><span>&lt;/panel&gt;</span></span></pre>
<p>
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/apps/mediawiki/nifty-gui/index.php?title=Effects"><param name="text" value="<html><u>http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Effects</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>Add Sound Effects</a></h2>
<div>
<p>
Playing sounds using Nifty is also possible with a <code>playSound</code> effect as trigger. Remember to first register the sound that you want to play:
</p>
<pre><span>&lt;registerSound id=&quot;myclick&quot; filename=&quot;Interface/sounds/ButtonClick.ogg&quot; /&gt;</span>
...
<span><span>&lt;label&gt;</span></span>
<span><span>&lt;effect&gt;</span></span>
<span>&lt;onClick name=&quot;playSound&quot; sound=&quot;myclick&quot;/&gt;</span>
<span><span>&lt;/effect&gt;</span></span>
<span><span>&lt;/label&gt;</span></span></pre>
</div>
<h2><a>Pass ClickLoc From Nifty to Java</a></h2>
<div>
<p>
After a mouse click, you may want to record the 2D clickLoc and send this info to your Java application. Typical ScreenController methods however only have a String argument. You&#039;d have to convert the String to ints.
</p>
<p>
To pass the clickLoc as two ints, you can use the special <code>(int x, int y)</code> syntax in the ScreenController:
</p>
<pre> public void clicked&#40;int x, int y&#41; &#123;
// here you can use the x and y of the clickLoc
&#125;</pre>
<p>
In the Nifty <acronym title="Graphical User Interface">GUI</acronym> screen code (e.g. <acronym title="Extensible Markup Language">XML</acronym> file) you must call the <code>(int x, int y)</code> method <em>without</em> any parameters!
</p>
<pre><span>&lt;interact onClick=&quot;clicked()&quot;/&gt;</span> </pre>
<p>
You can name the method (here <code>clicked</code>) what ever you like, as long as you keep the argument syntax.
</p>
</div>
<h2><a>Loading 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.
</p>
<pre>NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay&#40;assetManager, inputManager, audioRenderer, viewPort&#41;;
Nifty nifty = niftyDisplay.getNifty&#40;&#41;;
nifty.addXml&#40;&quot;Interface/Screens/OptionsScreen.xml&quot;&#41;;
nifty.addXml&#40;&quot;Interface/Screens/StartScreen.xml&quot;&#41;;
nifty.gotoScreen&#40;&quot;startScreen&quot;&#41;;
StartScreenControl screenControl = &#40;StartScreenControl&#41; nifty.getScreen&#40;&quot;startScreen&quot;&#41;.getScreenController&#40;&#41;;
OptionsScreenControl optionsControl = &#40;OptionsScreenControl&#41; nifty.getScreen&#40;&quot;optionsScreen&quot;&#41;.getScreenController&#40;&#41;;
stateManager.attach&#40;screenControl&#41;;
stateManager.attach&#40;optionsControl&#41;;
guiViewPort.addProcessor&#40;niftyDisplay&#41;;</pre>
</div>
<h2><a>Design Your Own Styles</a></h2>
<div>
<p>
By default, your Nifty <acronym title="Extensible Markup Language">XML</acronym> screens use the built.in styles:
</p>
<pre> <span>&lt;useStyles filename=&quot;nifty-default-styles.xml&quot; /&gt;</span> </pre>
<p>
But you can switch to a set of custom styles in your game project&#039;s asset directory like this:
</p>
<pre> <span>&lt;useStyles filename=&quot;Interface/Styles/myCustomStyles.xml&quot; /&gt;</span> </pre>
<p>
Inside myCustomStyles.xml you define styles like this:
</p>
<pre><span>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<span><span>&lt;nifty-styles&gt;</span></span>
<span>&lt;useStyles filename=&quot;Interface/Styles/Font/myCustomFontStyle.xml&quot; /&gt;</span>
<span>&lt;useStyles filename=&quot;Interface/Styles/Button/myCustomButtonStyle.xml&quot; /&gt;</span>
<span>&lt;useStyles filename=&quot;Interface/Styles/Label/myCustomLabelStyle.xml&quot; /&gt;</span>
...
<span><span>&lt;/nifty-styles&gt;</span></span></pre>
<p>
Learn more about how to create styles by looking at the <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Build_from_Source"><param name="text" value="<html><u>Nifty GUI source code</u></html>"><param name="textColor" value="blue"></object> for “nifty-style-black”. Copy it as a template and change it to create your own style.
</p>
<hr />
<p>
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/apps/mediawiki/nifty-gui/index.php?title=Effects"><param name="text" value="<html><u>http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Effects</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<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>,
<a href="/wiki/doku.php/tag:nifty?do=showtag&amp;tag=tag%3Anifty">nifty</a>,
<a href="/wiki/doku.php/tag:hud?do=showtag&amp;tag=tag%3Ahud">hud</a>,
<a href="/wiki/doku.php/tag:click?do=showtag&amp;tag=tag%3Aclick">click</a>,
<a href="/wiki/doku.php/tag:state?do=showtag&amp;tag=tag%3Astate">state</a>,
<a href="/wiki/doku.php/tag:states?do=showtag&amp;tag=tag%3Astates">states</a>,
<a href="/wiki/doku.php/tag:sound?do=showtag&amp;tag=tag%3Asound">sound</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:nifty_gui_scenarios?do=export_xhtmlbody">view online version</a></em></p>

@ -1,4 +1,101 @@
<h1><a>Laying out the GUI in XML</a></h1><div><ol><li><div><a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html">Nifty GUI Concepts</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></li><li><div><a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">Interact with the GUI from Java</a></div></li></ol><p>You can &quot;draw&quot; the <acronym title="Graphical User Interface">GUI</acronym> to the screen by writing <acronym title="Extensible Markup Language">XML</acronym> code (alternatively you can also use Java).</p></div><h2><a>Plan Your GUI Layout</a></h2><div><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/gui-layout-draft.png"></p><p>In this tutorial, you want to create two game screens: An out-of-game StartScreen that the players see before the game starts; and an in-game <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/HUD_%28video_gaming%29"><param name="text" value="<html><u>HUD</u></html>"><param name="textColor" value="blue"></object> that displays info during the game. Before writing code, you plan the <acronym title="Graphical User Interface">GUI</acronym> layout, either on paper or in a graphic application.</p><p>The StartScreen contains:</p><ul><li><div>The background layer has a centered layout and contains an image.</div></li><li><div>The top layer has a vertical layout, containing 3 panels:</div><ul><li><div>The top panel contains a label with the game title,</div></li><li><div>The middle panel contains a text field with the game description.</div></li><li><div>The bottom panel has a horizontal layout and contains two more panels:</div><ul><li><div>The left panel contains a Start button.</div></li><li><div>The right panel contains a Quit button.</div></li></ul></li></ul></li></ul><p>The HUD contains:</p><ul><li><div>The background layer has a centered layout, and contains a the partially transparent HUD image.</div></li><li><div>The top layer has a horizontal layout, containing 2 panels:</div><ul><li><div>The left panel as transparent spacer.</div></li><li><div>The right panel has a vertical layout containing 2 panels, a label and an image.</div></li></ul></li></ul></div><h2><a>Implement Your GUI Layout</a></h2><div><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nifty-screen-layer-panel.png"></p><p>Create an empty screen.xml file in the <code>assets/Interfaces/</code> directory of your project. One <acronym title="Extensible Markup Language">XML</acronym> file can contain several, or even all screens. As a reminder: Nifty displays one screen at a time; a screen contains several layers on top of one another; each layer contains panels that are embedded into another; the panels contain the actual content (text, images, or controls).</p></div><h3><a>Make Screens</a></h3><div><p>The following minimal <acronym title="Extensible Markup Language">XML</acronym> file contains a start screen and a HUD screen. (Neither has been defined yet.)</p><pre><span>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<h1><a>Laying out the GUI in XML</a></h1>
<div>
<ol>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html">Nifty GUI Concepts</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>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html">Interact with the GUI from Java</a></div>
</li>
</ol>
<p>
You can &quot;draw&quot; the <acronym title="Graphical User Interface">GUI</acronym> to the screen by writing <acronym title="Extensible Markup Language">XML</acronym> code (alternatively you can also use Java).
</p>
</div>
<h2><a>Plan Your GUI Layout</a></h2>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/gui-layout-draft.png">
</p>
<p>
In this tutorial, you want to create two game screens: An out-of-game StartScreen that the players see before the game starts; and an in-game <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/HUD_%28video_gaming%29"><param name="text" value="<html><u>HUD</u></html>"><param name="textColor" value="blue"></object> that displays info during the game. Before writing code, you plan the <acronym title="Graphical User Interface">GUI</acronym> layout, either on paper or in a graphic application.
</p>
<p>
The StartScreen contains:
</p>
<ul>
<li><div> The background layer has a centered layout and contains an image.</div>
</li>
<li><div> The top layer has a vertical layout, containing 3 panels: </div>
<ul>
<li><div> The top panel contains a label with the game title, </div>
</li>
<li><div> The middle panel contains a text field with the game description. </div>
</li>
<li><div> The bottom panel has a horizontal layout and contains two more panels:</div>
<ul>
<li><div> The left panel contains a Start button.</div>
</li>
<li><div> The right panel contains a Quit button.</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>
The HUD contains:
</p>
<ul>
<li><div> The background layer has a centered layout, and contains a the partially transparent HUD image.</div>
</li>
<li><div> The top layer has a horizontal layout, containing 2 panels: </div>
<ul>
<li><div> The left panel as transparent spacer.</div>
</li>
<li><div> The right panel has a vertical layout containing 2 panels, a label and an image.</div>
</li>
</ul>
</li>
</ul>
</div>
<h2><a>Implement Your GUI Layout</a></h2>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nifty-screen-layer-panel.png">
</p>
<p>
Create an empty screen.xml file in the <code>assets/Interfaces/</code> directory of your project. One <acronym title="Extensible Markup Language">XML</acronym> file can contain several, or even all screens. As a reminder: Nifty displays one screen at a time; a screen contains several layers on top of one another; each layer contains panels that are embedded into another; the panels contain the actual content (text, images, or controls).
</p>
</div>
<h3><a>Make Screens</a></h3>
<div>
<p>
The following minimal <acronym title="Extensible Markup Language">XML</acronym> file contains a start screen and a HUD screen. (Neither has been defined yet.)
</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.xsd&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; </span>
<span> xsi:schemaLocation=&quot;http://nifty-gui.sourceforge.net/nifty.xsd http://nifty-gui.sourceforge.net/nifty.xsd&quot;&gt;</span>
<span>&lt;screen id=&quot;start&quot;&gt;</span>
@ -7,7 +104,26 @@
<span>&lt;screen id=&quot;hud&quot;&gt;</span>
&lt;!-- ... --&gt;
<span><span>&lt;/screen&gt;</span></span>
<span><span>&lt;/nifty&gt;</span></span></pre><p>Every Nifty <acronym title="Graphical User Interface">GUI</acronym> must have a start screen. The others (in this example, the HUD screen) are optional.</p><p><strong>Note:</strong> In the following examples, the <acronym title="Extensible Markup Language">XML</acronym> schema header is abbreviated to just <code>&lt;nifty&gt;</code>.</p></div><h3><a>Make Layers</a></h3><div><p>The following minimal <acronym title="Extensible Markup Language">XML</acronym> file shows how we added layers to the start screen and HUD screen:</p><pre><span><span>&lt;nifty&gt;</span></span>
<span><span>&lt;/nifty&gt;</span></span></pre>
<p>
Every Nifty <acronym title="Graphical User Interface">GUI</acronym> must have a start screen. The others (in this example, the HUD screen) are optional.
</p>
<p>
<strong>Note:</strong> In the following examples, the <acronym title="Extensible Markup Language">XML</acronym> schema header is abbreviated to just <code>&lt;nifty&gt;</code>.
</p>
</div>
<h3><a>Make Layers</a></h3>
<div>
<p>
The following minimal <acronym title="Extensible Markup Language">XML</acronym> file shows how we added layers to the start screen and HUD screen:
</p>
<pre><span><span>&lt;nifty&gt;</span></span>
<span>&lt;screen id=&quot;start&quot;&gt;</span>
<span>&lt;layer id=&quot;background&quot; backgroundColor=&quot;#000f&quot;&gt;</span>
&lt;!-- ... --&gt;
@ -24,7 +140,22 @@
&lt;!-- ... --&gt;
<span><span>&lt;/layer&gt;</span></span>
<span><span>&lt;/screen&gt;</span></span>
<span><span>&lt;/nifty&gt;</span></span></pre><p>In a layer, you can now add panels and arrange them. Panels are containers that mark the areas where you want to display text, images, or controls (buttons etc) later.</p></div><h3><a>Make Panels</a></h3><div><p>A panel is the inner-most container (that will contain the actual content: text, images, or controls). You place panels inside layers. The following panels go into in the <code>start</code> screen&#039;s <code>foreground</code> layer:</p><pre> <span>&lt;panel id=&quot;panel_top&quot; height=&quot;25%&quot; width=&quot;75%&quot; align=&quot;center&quot; childLayout=&quot;center&quot;</span>
<span><span>&lt;/nifty&gt;</span></span></pre>
<p>
In a layer, you can now add panels and arrange them. Panels are containers that mark the areas where you want to display text, images, or controls (buttons etc) later.
</p>
</div>
<h3><a>Make Panels</a></h3>
<div>
<p>
A panel is the inner-most container (that will contain the actual content: text, images, or controls). You place panels inside layers. The following panels go into in the <code>start</code> screen&#039;s <code>foreground</code> layer:
</p>
<pre> <span>&lt;panel id=&quot;panel_top&quot; height=&quot;25%&quot; width=&quot;75%&quot; align=&quot;center&quot; childLayout=&quot;center&quot;</span>
<span> backgroundColor=&quot;#f008&quot;&gt;</span>
<span><span>&lt;/panel&gt;</span></span>
<span>&lt;panel id=&quot;panel_mid&quot; height=&quot;50%&quot; width=&quot;75%&quot; align=&quot;center&quot; childLayout=&quot;center&quot;</span>
@ -38,7 +169,12 @@
<span>&lt;panel id=&quot;panel_bottom_right&quot; height=&quot;50%&quot; width=&quot;50%&quot; valign=&quot;center&quot; childLayout=&quot;center&quot;</span>
<span> backgroundColor=&quot;#88f8&quot;&gt;</span>
<span><span>&lt;/panel&gt;</span></span>
<span><span>&lt;/panel&gt;</span></span></pre><p>The following panels go into in the <code>hud</code> screen&#039;s <code>foreground</code> layer:</p><pre> <span>&lt;panel id=&quot;panel_left&quot; width=&quot;80%&quot; height=&quot;100%&quot; childLayout=&quot;vertical&quot; </span>
<span><span>&lt;/panel&gt;</span></span></pre>
<p>
The following panels go into in the <code>hud</code> screen&#039;s <code>foreground</code> layer:
</p>
<pre> <span>&lt;panel id=&quot;panel_left&quot; width=&quot;80%&quot; height=&quot;100%&quot; childLayout=&quot;vertical&quot; </span>
<span> backgroundColor=&quot;#0f08&quot;&gt;</span>
&lt;!-- spacer --&gt;
<span><span>&lt;/panel&gt;</span></span>
@ -53,33 +189,148 @@
<span>&lt;panel id=&quot;panel_bot_right&quot; width=&quot;100%&quot; height=&quot;70%&quot; valign=&quot;center&quot;</span>
<span> backgroundColor=&quot;#88f8&quot;&gt;</span>
<span><span>&lt;/panel&gt;</span></span>
<span><span>&lt;/panel&gt;</span></span></pre><p>The result should look as follows:</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nifty-gui-panels.png"></p></div><h2><a>Adding Content to Panels</a></h2><div><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=Layout_Introduction"><param name="text" value="<html><u>Layout Introduction</u></html>"><param name="textColor" value="blue"></object> on the Nifty <acronym title="Graphical User Interface">GUI</acronym> site.</p></div><h3><a>Add Images</a></h3><div><p>The start-background.png image is a fullscreen background picture. In the <code>start</code> screen, add the following image element:</p><pre> <span>&lt;layer id=&quot;background&quot; childLayout=&quot;center&quot;&gt;</span>
<span><span>&lt;/panel&gt;</span></span></pre>
<p>
The result should look as follows:
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/nifty-gui-panels.png">
</p>
</div>
<h2><a>Adding Content to Panels</a></h2>
<div>
<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=Layout_Introduction"><param name="text" value="<html><u>Layout Introduction</u></html>"><param name="textColor" value="blue"></object> on the Nifty <acronym title="Graphical User Interface">GUI</acronym> site.
</p>
</div>
<h3><a>Add Images</a></h3>
<div>
<p>
The start-background.png image is a fullscreen background picture. In the <code>start</code> screen, add the following image element:
</p>
<pre> <span>&lt;layer id=&quot;background&quot; childLayout=&quot;center&quot;&gt;</span>
<span>&lt;image filename=&quot;Interface/tutorial/step2/start-background.png&quot;&gt;<span>&lt;/image&gt;</span></span>
<span><span>&lt;/layer&gt;</span></span></pre><p>The hud-frame.png image is a transparent frame that we use as HUD decoration. In the <code>hud</code> screen, add the following image element:</p><pre> <span>&lt;layer id=&quot;background&quot; childLayout=&quot;center&quot;&gt;</span>
<span><span>&lt;/layer&gt;</span></span></pre>
<p>
The hud-frame.png image is a transparent frame that we use as HUD decoration. In the <code>hud</code> screen, add the following image element:
</p>
<pre> <span>&lt;layer id=&quot;background&quot; childLayout=&quot;center&quot;&gt;</span>
<span>&lt;image filename=&quot;Interface/tutorial/step2/hud-frame.png&quot;&gt;<span>&lt;/image&gt;</span></span>
<span><span>&lt;/layer&gt;</span></span></pre><p>In order to make the hud-frame.png independent of the screen resolution you are using, you could use the <code>imageMode</code> attribute on the image element <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Resizable_Images_(ImageMode%3Dresize)_explained"><param name="text" value="<html><u>Resizable Images (ImageMode=resize) explained</u></html>"><param name="textColor" value="blue"></object></p><pre> <span>&lt;layer id=&quot;background&quot; childLayout=&quot;center&quot;&gt;</span>
<span><span>&lt;/layer&gt;</span></span></pre>
<p>
In order to make the hud-frame.png independent of the screen resolution you are using, you could use the <code>imageMode</code> attribute on the image element <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Resizable_Images_(ImageMode%3Dresize)_explained"><param name="text" value="<html><u> Resizable Images (ImageMode=resize) explained</u></html>"><param name="textColor" value="blue"></object>
</p>
<pre> <span>&lt;layer id=&quot;background&quot; childLayout=&quot;center&quot;&gt;</span>
<span>&lt;image filename=&quot;Interface/tutorial/step2/hud-frame.png&quot; imageMode=&quot;resize:40,490,110,170,40,560,40,270,40,560,40,40&quot; width=&quot;100%&quot; height=&quot;100%&quot;/&gt;</span>
<span><span>&lt;/layer&gt;</span></span></pre><p>The face1.png image is an image that you want to use as a status icon. In the <code>hud</code> screen&#039;s <code>foreground</code> layer, add the following image element:</p><pre> <span>&lt;panel id=&quot;panel_bottom_left&quot; height=&quot;75%&quot; width=&quot;20%&quot; valign=&quot;center&quot; childLayout=&quot;center&quot;&gt;</span>
<span><span>&lt;/layer&gt;</span></span></pre>
<p>
The face1.png image is an image that you want to use as a status icon.
In the <code>hud</code> screen&#039;s <code>foreground</code> layer, add the following image element:
</p>
<pre> <span>&lt;panel id=&quot;panel_bottom_left&quot; height=&quot;75%&quot; width=&quot;20%&quot; valign=&quot;center&quot; childLayout=&quot;center&quot;&gt;</span>
<span>&lt;image filename=&quot;Interface/tutorial/step2/face1.png&quot; </span>
<span> valign=&quot;center&quot; align=&quot;center&quot; height=&quot;50%&quot; width=&quot;30%&quot; &gt;</span>
<span><span>&lt;/image&gt;</span></span>
<span><span>&lt;/panel&gt;</span></span></pre><p>This image is scaled to use 50% of the height and 30% of the width of its container.</p></div><h3><a>Add Static Text</a></h3><div><p>The game title is a typical exmaple of static text. In the <code>start</code> screen, add the following text element:</p><pre> <span>&lt;panel id=&quot;panel_top&quot; height=&quot;25%&quot; width=&quot;75%&quot; align=&quot;center&quot; childLayout=&quot;center&quot;&gt;</span>
<span><span>&lt;/panel&gt;</span></span></pre>
<p>
This image is scaled to use 50% of the height and 30% of the width of its container.
</p>
</div>
<h3><a>Add Static Text</a></h3>
<div>
<p>
The game title is a typical exmaple of static text. In the <code>start</code> screen, add the following text element:
</p>
<pre> <span>&lt;panel id=&quot;panel_top&quot; height=&quot;25%&quot; width=&quot;75%&quot; align=&quot;center&quot; childLayout=&quot;center&quot;&gt;</span>
<span>&lt;text text=&quot;My Cool Game&quot; font=&quot;Interface/Fonts/Default.fnt&quot; width=&quot;100%&quot; height=&quot;100%&quot; /&gt;</span>
<span><span>&lt;/panel&gt;</span></span></pre><p>For longer pieces of static text, such as an introduction, you can use wrap=&quot;true&quot;. Add the following text element to the <code>Start screen</code>:</p><pre> <span>&lt;panel id=&quot;panel_mid&quot; height=&quot;50%&quot; width=&quot;75%&quot; align=&quot;center&quot; childLayout=&quot;center&quot;&gt;</span>
<span><span>&lt;/panel&gt;</span></span></pre>
<p>
For longer pieces of static text, such as an introduction, you can use wrap=&quot;true&quot;. Add the following text element to the <code>Start screen</code>:
</p>
<pre> <span>&lt;panel id=&quot;panel_mid&quot; height=&quot;50%&quot; width=&quot;75%&quot; align=&quot;center&quot; childLayout=&quot;center&quot;&gt;</span>
<span>&lt;text text=&quot;Here goes some text describing the game and the rules and stuff. Incidentally,
the text is quite long and needs to wrap at the end of lines. ...&quot; </span>
<span> font=&quot;Interface/Fonts/Default.fnt&quot; width=&quot;100%&quot; height=&quot;100%&quot; wrap=&quot;true&quot; /&gt;</span>
<span><span>&lt;/panel&gt;</span></span></pre><p>The font used is jME3&#039;s default font &quot;Interface/Fonts/Default.fnt&quot; which is included in the jMonkeyEngine.JAR. You can add your own fonts to your own <code>assets/Interface</code> directory.</p></div><h3><a>Add Controls</a></h3><div><p>Before you can use any control, you must load a Control Definition first. Add the following two lines <em>before</em> your screen definitions:</p><pre> <span>&lt;useControls filename=&quot;nifty-default-controls.xml&quot; /&gt;</span>
<span>&lt;useStyles filename=&quot;nifty-default-styles.xml&quot; /&gt;</span></pre></div><h4><a>Label Control</a></h4><div><p>Use label controls for text that you want to edit dynamically from Java. One example for this is the score display. In the <code>hud</code> screen&#039;s <code>foreground</code> layer, add the following text element:</p><pre> <span>&lt;panel id=&quot;panel_top_right&quot; height=&quot;100%&quot; width=&quot;15%&quot; childLayout=&quot;center&quot;&gt;</span>
<span><span>&lt;/panel&gt;</span></span></pre>
<p>
The font used is jME3&#039;s default font &quot;Interface/Fonts/Default.fnt&quot; which is included in the jMonkeyEngine.JAR. You can add your own fonts to your own <code>assets/Interface</code> directory.
</p>
</div>
<h3><a>Add Controls</a></h3>
<div>
<p>
Before you can use any control, you must load a Control Definition first. Add the following two lines <em>before</em> your screen definitions:
</p>
<pre> <span>&lt;useControls filename=&quot;nifty-default-controls.xml&quot; /&gt;</span>
<span>&lt;useStyles filename=&quot;nifty-default-styles.xml&quot; /&gt;</span></pre>
</div>
<h4><a>Label Control</a></h4>
<div>
<p>
Use label controls for text that you want to edit dynamically from Java. One example for this is the score display.
In the <code>hud</code> screen&#039;s <code>foreground</code> layer, add the following text element:
</p>
<pre> <span>&lt;panel id=&quot;panel_top_right&quot; height=&quot;100%&quot; width=&quot;15%&quot; childLayout=&quot;center&quot;&gt;</span>
<span>&lt;control name=&quot;label&quot; color=&quot;#000&quot; text=&quot;123&quot; width=&quot;100%&quot; height=&quot;100%&quot; /&gt;</span>
<span><span>&lt;/panel&gt;</span></span></pre><p>Note that the width and height do not scale the bitmap font, but the make indirectly certain it is centered. If you want a different size for the font, you need to provide an extra bitmap font (they come with fixes sizes and don&#039;t scale well).</p></div><h4><a>Button Control</a></h4><div><p>Our <acronym title="Graphical User Interface">GUI</acronym> plan asks for two buttons on the start screen. You add the Start and Quit buttons to the bottom panel of the <code>start</code> screen using the <code>&lt;control&gt;</code> element:</p><pre> <span>&lt;panel id=&quot;panel_bottom_left&quot; height=&quot;50%&quot; width=&quot;50%&quot; valign=&quot;center&quot; childLayout=&quot;center&quot;&gt;</span>
<span><span>&lt;/panel&gt;</span></span></pre>
<p>
Note that the width and height do not scale the bitmap font, but the make indirectly certain it is centered. If you want a different size for the font, you need to provide an extra bitmap font (they come with fixes sizes and don&#039;t scale well).
</p>
</div>
<h4><a>Button Control</a></h4>
<div>
<p>
Our <acronym title="Graphical User Interface">GUI</acronym> plan asks for two buttons on the start screen. You add the Start and Quit buttons to the bottom panel of the <code>start</code> screen using the <code>&lt;control&gt;</code> element:
</p>
<pre> <span>&lt;panel id=&quot;panel_bottom_left&quot; height=&quot;50%&quot; width=&quot;50%&quot; valign=&quot;center&quot; childLayout=&quot;center&quot;&gt;</span>
<span>&lt;control name=&quot;button&quot; label=&quot;Start&quot; id=&quot;StartButton&quot; align=&quot;center&quot; valign=&quot;center&quot;&gt;</span>
<span><span>&lt;/control&gt;</span></span>
<span><span>&lt;/panel&gt;</span></span>
<span>&lt;panel id=&quot;panel_bottom_right&quot; height=&quot;50%&quot; width=&quot;50%&quot; valign=&quot;center&quot; childLayout=&quot;center&quot;&gt;</span>
<span>&lt;control name=&quot;button&quot; label=&quot;Quit&quot; id=&quot;QuitButton&quot; align=&quot;center&quot; valign=&quot;center&quot;&gt;</span>
<span><span>&lt;/control&gt;</span></span>
<span><span>&lt;/panel&gt;</span></span></pre><p>Note that these controls don&#039;t do anything yet – we&#039;ll get to that soon.
<span><span>&lt;/panel&gt;</span></span></pre>
<p>
Note that these controls don&#039;t do anything yet – we&#039;ll get to that soon.
</p>
</div>

File diff suppressed because one or more lines are too long

@ -1,6 +1,82 @@
<h1><a>Particle Emmitter Settings</a></h1><div><p>You cannot create a 3D model for delicate things like fire, smoke, or explosions. Particle Emitters are quite an efficient solution to create these kinds of effects: The emitter renders a series of flat orthogonal images and manipulates them in a way that creates the illusion of a anything from a delicate smoke cloud to individual flames, etc. Creating an effect involves some trial and error to get the settings <em>just right</em>, and it&#039;s worth exploring the expressiveness of the options described below.</p><p><p><div>Use the <a href="/com/jme3/gde/core/docs/sdk/scene_explorer.html">Scene Explorer</a> in the <a href="/com/jme3/gde/core/docs/sdk.html">SDK</a> to design and preview effects.</div></p></p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/explosion-5.png"> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/particle.png"> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-effect-fire.png"> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/butterfly-particle-emitter.png"></p></div><h2><a>Create an Emitter</a></h2><div><ol><li><div>Create one emitter for each effect:<pre>ParticleEmitter explosion = new ParticleEmitter&#40;
&quot;My explosion effect&quot;, ParticleMesh.Type.Triangle, 30&#41;;</pre></div></li><li><div>Attach the emitter to the rootNode and position it in the scene:<pre>rootNode.attachChild&#40;explosion&#41;;
explosion.setLocalTranslation&#40;bomb.getLocalTranslation&#40;&#41;&#41;;</pre></div></li><li><div>Trigger the effect by calling<pre>explosion.emitAllParticles&#40;&#41;</pre></div></li><li><div>End the effect by calling<pre>explosion.killAllParticles&#40;&#41;</pre></div></li></ol><p>Choose one of the following mesh shapes</p><ul><li><div>ParticleMesh.Type.Triangle</div></li><li><div>ParticleMesh.Type.Point</div></li></ul></div><h2><a>Configure Parameters</a></h2><div><p>Not all of these parameters are required for all kinds of effects. If you don&#039;t specify one of them, a default value will be used.</p><div><table><tr><th>Parameter</th><th>Method</th><th>Default</th><th>Description</th></tr><tr><td>number</td><td><code>setNumParticles()</code></td><td></td><td>The maximum number of particles visible at the same time. Specified by user in constructor.</td></tr><tr><td>emission rate</td><td><code>setParticlesPerSec()</code></td><td>20</td><td>Density of the effect, how many new particles are emitted per second. <br/> Set to zero to control the start/end of the effect. <br/> Set to a number for a constantly running effect.</td></tr><tr><td>size</td><td><code>setStartSize()</code>, <code>setEndSize()</code></td><td>0.2f, 2f</td><td>The radius of the scaled sprite image. Set both to same value for constant size effect. <br/> Set to different values for shrink/grow effect.</td></tr><tr><td>color</td><td><code>setStartColor()</code>, <code>setEndColor()</code></td><td>gray</td><td>Controls how the opaque (non-black) parts of the texture are colorized. <br/> Set both to the same color for single-colored effects (e.g. fog, debris). <br/> Set both to different colors for a gradient effect (e.g. fire).</td></tr>
<h1><a>Particle Emmitter Settings</a></h1>
<div>
<p>
You cannot create a 3D model for delicate things like fire, smoke, or explosions. Particle Emitters are quite an efficient solution to create these kinds of effects: The emitter renders a series of flat orthogonal images and manipulates them in a way that creates the illusion of a anything from a delicate smoke cloud to individual flames, etc.
Creating an effect involves some trial and error to get the settings <em>just right</em>, and it&#039;s worth exploring the expressiveness of the options described below.
</p>
<p>
<p><div>Use the <a href="/com/jme3/gde/core/docs/sdk/scene_explorer.html">Scene Explorer</a> in the <a href="/com/jme3/gde/core/docs/sdk.html">SDK</a> to design and preview effects.
</div></p>
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/explosion-5.png"> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/particle.png"> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-effect-fire.png"> <img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/butterfly-particle-emitter.png">
</p>
</div>
<h2><a>Create an Emitter</a></h2>
<div>
<ol>
<li><div> Create one emitter for each effect: <pre>ParticleEmitter explosion = new ParticleEmitter&#40;
&quot;My explosion effect&quot;, ParticleMesh.Type.Triangle, 30&#41;;</pre>
</div>
</li>
<li><div> Attach the emitter to the rootNode and position it in the scene: <pre>rootNode.attachChild&#40;explosion&#41;;
explosion.setLocalTranslation&#40;bomb.getLocalTranslation&#40;&#41;&#41;;</pre>
</div>
</li>
<li><div> Trigger the effect by calling <pre>explosion.emitAllParticles&#40;&#41;</pre>
</div>
</li>
<li><div> End the effect by calling <pre>explosion.killAllParticles&#40;&#41;</pre>
</div>
</li>
</ol>
<p>
Choose one of the following mesh shapes
</p>
<ul>
<li><div> ParticleMesh.Type.Triangle</div>
</li>
<li><div> ParticleMesh.Type.Point</div>
</li>
</ul>
</div>
<h2><a>Configure Parameters</a></h2>
<div>
<p>
Not all of these parameters are required for all kinds of effects. If you don&#039;t specify one of them, a default value will be used.
</p>
<div><table>
<tr>
<th> Parameter </th><th> Method </th><th> Default </th><th> Description </th>
</tr>
<tr>
<td> number </td><td> <code>setNumParticles()</code> </td><td> </td><td> The maximum number of particles visible at the same time. Specified by user in constructor. </td>
</tr>
<tr>
<td> emission rate </td><td> <code>setParticlesPerSec()</code> </td><td> 20 </td><td> Density of the effect, how many new particles are emitted per second. <br/>
Set to zero to control the start/end of the effect. <br/>
Set to a number for a constantly running effect. </td>
</tr>
<tr>
<td> size </td><td> <code>setStartSize()</code>, <code>setEndSize()</code> </td><td> 0.2f, 2f </td><td> The radius of the scaled sprite image. Set both to same value for constant size effect. <br/>
Set to different values for shrink/grow effect. </td>
</tr>
<tr>
<td> color </td><td> <code>setStartColor()</code>, <code>setEndColor()</code> </td><td> gray </td><td> Controls how the opaque (non-black) parts of the texture are colorized. <br/>
Set both to the same color for single-colored effects (e.g. fog, debris). <br/>
Set both to different colors for a gradient effect (e.g. fire). </td>
</tr>
<tr>
<td> direction/velocity </td><td> <code>getParticleInfluencer(). setInitialVelocity(initialVelocity)</code> </td><td> Vector3f(0,0,0) </td><td> A vector specifying the initial direction and speed of particles. The longer the vector, the faster. </td>
</tr>

@ -1,7 +1,166 @@
<h1><a>Physics: Gravity, Collisions, Forces</a></h1><div><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.</p><p>Game Physics are used in applications that simulate mass/gravity, collisions, and friction. Think of pool billiard or car racing simulations.</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>.</p></div><h2><a>Technical Overview</a></h2><div><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.</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:</p><ol><li><div>collision callbacks (BulletAppState.update())</div></li><li><div>user update (simpleUpdate / update)</div></li><li><div>physics to scenegraph syncing/applying (updateLogicalState())</div></li><li><div>stepping physics (before / in parallel to Application.render())</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.</p></div><h2><a>Sample Code</a></h2><div><p>Full code samples are 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/TestBrickWall.java"><param name="text" value="<html><u>TestBrickWall.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/TestQ3.java"><param name="text" value="<html><u>TestQ3.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/TestSimplePhysics.java"><param name="text" value="<html><u>TestSimplePhysics.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/TestWalkingChar.java"><param name="text" value="<html><u>TestWalkingChar.java</u></html>"><param name="textColor" value="blue"></object></div></li></ul></div><h2><a>Physics Application</a></h2><div><p>A short overview of how to write a jME application with Physics capabilities:</p><p>Do the following once per application to gain access to the <code>physicsSpace</code> object:</p><ol><li><div>Make you application extend <code>com.jme3.app.SimpleApplication</code>.</div></li><li><div>Create a BulletAppState field:<pre>private BulletAppState bulletAppState;</pre></div></li><li><div>Initialize your bulletAppState and attach it to the state manager:<pre>public void simpleInitApp&#40;&#41; &#123;
<h1><a>Physics: Gravity, Collisions, Forces</a></h1>
<div>
<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.
</p>
<p>
Game Physics are used in applications that simulate mass/gravity, collisions, and friction. Think of pool billiard or car racing simulations.
</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>.
</p>
</div>
<h2><a>Technical Overview</a></h2>
<div>
<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.
</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:
</p>
<ol>
<li><div> collision callbacks (BulletAppState.update())</div>
</li>
<li><div> user update (simpleUpdate / update)</div>
</li>
<li><div> physics to scenegraph syncing/applying (updateLogicalState())</div>
</li>
<li><div> stepping physics (before / in parallel to Application.render())</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.
</p>
</div>
<h2><a>Sample Code</a></h2>
<div>
<p>
Full code samples are 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/TestBrickWall.java"><param name="text" value="<html><u>TestBrickWall.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/TestQ3.java"><param name="text" value="<html><u>TestQ3.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/TestSimplePhysics.java"><param name="text" value="<html><u>TestSimplePhysics.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/TestWalkingChar.java"><param name="text" value="<html><u>TestWalkingChar.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>Physics Application</a></h2>
<div>
<p>
A short overview of how to write a jME application with Physics capabilities:
</p>
<p>
Do the following once per application to gain access to the <code>physicsSpace</code> object:
</p>
<ol>
<li><div> Make you application extend <code>com.jme3.app.SimpleApplication</code>.</div>
</li>
<li><div> Create a BulletAppState field: <pre>private BulletAppState bulletAppState;</pre>
</div>
</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></div></li></ol><p>You can also access the BulletAppState via the state manager:</p><pre>stateManager.getState&#40;BulletAppState.class&#41;</pre><p>For each Spatial that you want to be physical:</p><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></ul></li><li><div>Add the PhysicsControl to the Spatial.</div></li><li><div>Add the PhysicsControl to the physicsSpace object.</div></li><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></ol></div><h3><a>Collision Shapes</a></h3><div><p>A Collision Shape is a simplified shape for which physics are easier to calculate than for the true shape of the model. This simplication approach speeds up the simulation greatly.</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.)</p><div><table><tr><th>Shape</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></tr><tr><td>SphereCollisionShape</td><td>Spherical entities. Can roll.</td><td>Balls, simple compact entities.</td></tr><tr><td>CylinderCollisionShape</td><td>Tube-shaped and disc-shaped entities. Can roll on one side.</td><td>Pillars, wheels.</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></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></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></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/>
...</pre>
</div>
</li>
</ol>
<p>
You can also access the BulletAppState via the state manager:
</p>
<pre>stateManager.getState&#40;BulletAppState.class&#41;</pre>
<p>
For each Spatial that you want to be physical:
</p>
<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>
</ul>
</li>
<li><div> Add the PhysicsControl to the Spatial.</div>
</li>
<li><div> Add the PhysicsControl to the physicsSpace object.</div>
</li>
<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>
</ol>
</div>
<h3><a>Collision Shapes</a></h3>
<div>
<p>
A Collision Shape is a simplified shape for which physics are easier to calculate than for the true shape of the model. This simplication approach speeds up the simulation greatly.
</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.)
</p>
<div><table>
<tr>
<th> Shape </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>
</tr>
<tr>
<td> SphereCollisionShape </td><td> Spherical entities. Can roll. </td><td> Balls, simple compact entities. </td>
</tr>
<tr>
<td> CylinderCollisionShape </td><td> Tube-shaped and disc-shaped entities. Can roll on one side. </td><td> Pillars, wheels. </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>
</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>
</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>
</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>
</tr>
<tr>

@ -1,12 +1,79 @@
<h1><a>Physics Listeners</a></h1><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.</p></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><h3><a>When (Not) to Use Tick Listener?</a></h3><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></div><h3><a>How to Listen to Physics Ticks</a></h3><div><p>Here&#039;s is the declaration of an examplary Physics Control that listens to ticks.</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.</p><ul><li><div><code>prePhysicsTick()</code> is called before the 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></ul><pre>@override
<h1><a>Physics Listeners</a></h1>
<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.
</p>
</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>
<h3><a>When (Not) to Use Tick Listener?</a></h3>
<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>
</div>
<h3><a>How to Listen to Physics Ticks</a></h3>
<div>
<p>
Here&#039;s is the declaration of an examplary Physics Control that listens to ticks.
</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.
</p>
<ul>
<li><div> <code>prePhysicsTick()</code> is called before the 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>
</ul>
<pre>@override
public void prePhysicsTick&#40;PhysicsSpace space, float f&#41;&#123;
// apply state changes ...
&#125;
@override
public void physicsTick&#40;PhysicsSpace space, float f&#41;&#123;
// poll game state ...
&#125;</pre></div><h2><a>Physics Collision Listener</a></h2><div></div><h3><a>When (Not) to Use Collision Listener</a></h3><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 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:
&#125;</pre>
</div>
<h2><a>Physics Collision Listener</a></h2>
<div>
</div>
<h3><a>When (Not) to Use Collision Listener</a></h3>
<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 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>
<li><div> Increasing a counter (e.g. score points)</div>

@ -1,4 +1,34 @@
<h1><a>Remote-Controlling the Camera</a></h1><div></div><h2><a>Positioning the Camera</a></h2><div><p>You can steer the camera using <a href="/com/jme3/gde/core/docs/jme3/advanced/cinematics.html">Cinematics</a>:</p><ol><li><div>Create a Cinematic.</div></li><li><div>Create a CameraNode and bind the camera object to the Cinematic. Note that we also give the camera node a name in this step.<pre>CameraNode camNode = cinematic.bindCamera&#40;&quot;topView&quot;, cam&#41;;</pre></div></li><li><div>Position the camera node in its start location.</div></li><li><div>Use activateCamera() to give the control of the camera to this node. You now see the scene from this camera&#039;s point of view. For example to see through the camera node named &quot;topView&quot;, 6 seconds after the start of the cinematic, you&#039;d write<pre>cinematic.activateCamera&#40;6, &quot;topView&quot;&#41;;</pre></div></li></ol></div><h3><a>Code Sample</a></h3><div><pre>flyCam.setEnabled&#40;false&#41;;
<h1><a>Remote-Controlling the Camera</a></h1>
<div>
</div>
<h2><a>Positioning the Camera</a></h2>
<div>
<p>
You can steer the camera using <a href="/com/jme3/gde/core/docs/jme3/advanced/cinematics.html">Cinematics</a>:
</p>
<ol>
<li><div> Create a Cinematic.</div>
</li>
<li><div> Create a CameraNode and bind the camera object to the Cinematic. Note that we also give the camera node a name in this step. <pre>CameraNode camNode = cinematic.bindCamera&#40;&quot;topView&quot;, cam&#41;;</pre>
</div>
</li>
<li><div> Position the camera node in its start location.</div>
</li>
<li><div> Use activateCamera() to give the control of the camera to this node. You now see the scene from this camera&#039;s point of view. For example to see through the camera node named &quot;topView&quot;, 6 seconds after the start of the cinematic, you&#039;d write <pre>cinematic.activateCamera&#40;6, &quot;topView&quot;&#41;;</pre>
</div>
</li>
</ol>
</div>
<h3><a>Code Sample</a></h3>
<div>
<pre>flyCam.setEnabled&#40;false&#41;;
Cinematic cinematic = new Cinematic&#40;rootNode, 20&#41;;
&nbsp;
CameraNode camNodeTop = cinematic.bindCamera&#40;&quot;topView&quot;, cam&#41;;
@ -7,5 +37,17 @@ camNodeTop.getControl&#40;0&#41;.setEnabled&#40;false&#41;;
&nbsp;
CameraNode camNodeSide = cinematic.bindCamera&#40;&quot;sideView&quot;, cam&#41;;
camNodeSide.setControlDir&#40;ControlDirection.CameraToSpatial&#41;;
camNodeSide.getControl&#40;0&#41;.setEnabled&#40;false&#41;;</pre></div><h2><a>Moving the Camera</a></h2><div><p>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>
camNodeSide.getControl&#40;0&#41;.setEnabled&#40;false&#41;;</pre>
</div>
<h2><a>Moving the Camera</a></h2>
<div>
<p>
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>
<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>

@ -1,4 +1,26 @@
<h1><a>Saving and Loading Games</a></h1><div><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>.</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/tools/TestSaveGame.java"><param name="text" value="<html><u>TestSaveGame.java</u></html>"><param name="textColor" value="blue"></object></div></li></ul></div><h2><a>Saving a Node</a></h2><div><pre> @Override
<h1><a>Saving and Loading Games</a></h1>
<div>
<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>.
</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/tools/TestSaveGame.java"><param name="text" value="<html><u>TestSaveGame.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>Saving a Node</a></h2>
<div>
<pre> @Override
public void destroy&#40;&#41; &#123;
System.getProperty&#40;&quot;user.home&quot;&#41;;
BinaryExporter exporter = BinaryExporter.getInstance&#40;&#41;;
@ -9,7 +31,13 @@
Logger.getLogger&#40;Main.class.getName&#40;&#41;&#41;.log&#40;Level.SEVERE, &quot;Failed to save node!&quot;, ex&#41;;
&#125;
super.destroy&#40;&#41;;
&#125;</pre></div><h2><a>Loading a Node</a></h2><div><pre> @Override
&#125;</pre>
</div>
<h2><a>Loading a Node</a></h2>
<div>
<pre> @Override
public void simpleInitApp&#40;&#41; &#123;
System.getProperty&#40;&quot;user.home&quot;&#41;;
BinaryImporter importer = BinaryImporter.getInstance&#40;&#41;;
@ -23,7 +51,18 @@
Logger.getLogger&#40;Main.class.getName&#40;&#41;&#41;.log&#40;Level.SEVERE, &quot;No saved node loaded.&quot;, ex&#41;;
&#125;
...
&nbsp;</pre></div><h2><a>Custom Savable</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.</p><pre>import com.jme3.export.InputCapsule;
&nbsp;</pre>
</div>
<h2><a>Custom Savable</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.
</p>
<pre>import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
import com.jme3.export.JmeImporter;
import com.jme3.export.OutputCapsule;

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 101 KiB

@ -1,5 +1,95 @@
<h1><a>How to add a Sky to your Scene</a></h1><div><p><br/></p><p>Here is an example for how you add a static horizon (a background landscape and a sky) to a scene. Having a discernable horizon with a suitable landscape (or space, or ocean, or whatever) in the background makes scenes look more realistic than just a single-colored &quot;sky&quot; background.</p></div><h2><a>Adding the Sky</a></h2><div><p>Adding a sky is extremely easy using the <code>com.jme3.util.SkyFactory</code>.</p><pre>rootNode.attachChild&#40;SkyFactory.createSky&#40;
assetManager, &quot;Textures/Sky/Bright/BrightSky.dds&quot;, false&#41;&#41;;</pre><p>To add a sky you need to supply:</p><ol><li><div>The assetManager object to use</div></li><li><div>A cube or sphere map texture of the sky</div></li><li><div>Set the boolean to true if you are using a sphere map texture. For a cube map, use false. <br/> Tip: Cube map is the default. You would know if you had created a sphere map.</div></li></ol><p>Internally, the SkyFactory calls the following methods:</p><ol><li><div><code>sky.setQueueBucket(Bucket.Sky);</code> makes certain the sky is rendered in the right order, behind everything else.</div></li><li><div><code>sky.setCullHint(Spatial.CullHint.Never);</code> makes certain that the sky is never culled.</div></li><li><div>The SkyFactory uses the internal jME3 material definition <code>Sky.j3md</code>. This Material definition works with sphere and cube maps.</div></li></ol></div><h2><a>Creating the Textures</a></h2><div><p>As the sky texture we use the sample BrightSky.dds file from jme3test-test-data.</p><p>How to create a sky textures?</p><ul><li><div>There are many tools out there that generate cube and sphere maps. <br/> Examples for landscape texture generators are Terragen or Bryce.</div></li><li><div>The actual texture size does not matter, as long as you add the Sky Geometry to the Sky bucket: Everything in the sky bucket will always be infinitely far away behind everything else, and never intersect with your scene. <br/> Of course the higher the resolution, the better it will look. On the other hand, if the graphic is too big, it will slow the game down.</div></li><li><div>A box or sphere map is the simplest solution. But you can use any Node as sky, even complex sets of geometries and quads with animated clouds, blinking stars, city skylines, etc.</div></li><li><div>JME3 supports cube maps in <acronym title="Portable Network Graphics">PNG</acronym>, <acronym title="Joint Photographics Experts Group">JPG</acronym>, or (compressed) DDS format.</div></li></ul><p>Box or Sphere?</p><ul><li><div>If you have access to cube map textures, then use a SkyBox</div><ul><li><div><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://1.bp.blogspot.com/_uVsWqMqIGQU/SN0IZEE117I/AAAAAAAAAPs/4lfHx1Erdqg/s1600/skybox"><param name="text" value="<html><u>SkyBox examples</u></html>"><param name="textColor" value="blue"></object></div></li></ul></li><li><div>If you have access to sphere map textures – specially projected sky images that fit inside a sphere – then you use a SkySphere or SkyDome. </div>
<h1><a>How to add a Sky to your Scene</a></h1>
<div>
<p>
<br/>
</p>
<p>
Here is an example for how you add a static horizon (a background landscape and a sky) to a scene.
Having a discernable horizon with a suitable landscape (or space, or ocean, or whatever) in the background makes scenes look more realistic than just a single-colored &quot;sky&quot; background.
</p>
</div>
<h2><a>Adding the Sky</a></h2>
<div>
<p>
Adding a sky is extremely easy using the <code>com.jme3.util.SkyFactory</code>.
</p>
<pre>rootNode.attachChild&#40;SkyFactory.createSky&#40;
assetManager, &quot;Textures/Sky/Bright/BrightSky.dds&quot;, false&#41;&#41;;</pre>
<p>
To add a sky you need to supply:
</p>
<ol>
<li><div> The assetManager object to use</div>
</li>
<li><div> A cube or sphere map texture of the sky</div>
</li>
<li><div> Set the boolean to true if you are using a sphere map texture. For a cube map, use false. <br/>
Tip: Cube map is the default. You would know if you had created a sphere map.</div>
</li>
</ol>
<p>
Internally, the SkyFactory calls the following methods:
</p>
<ol>
<li><div> <code>sky.setQueueBucket(Bucket.Sky);</code> makes certain the sky is rendered in the right order, behind everything else.</div>
</li>
<li><div> <code>sky.setCullHint(Spatial.CullHint.Never);</code> makes certain that the sky is never culled.</div>
</li>
<li><div> The SkyFactory uses the internal jME3 material definition <code>Sky.j3md</code>. This Material definition works with sphere and cube maps. </div>
</li>
</ol>
</div>
<h2><a>Creating the Textures</a></h2>
<div>
<p>
As the sky texture we use the sample BrightSky.dds file from jme3test-test-data.
</p>
<p>
How to create a sky textures?
</p>
<ul>
<li><div> There are many tools out there that generate cube and sphere maps. <br/>
Examples for landscape texture generators are Terragen or Bryce.</div>
</li>
<li><div> The actual texture size does not matter, as long as you add the Sky Geometry to the Sky bucket: Everything in the sky bucket will always be infinitely far away behind everything else, and never intersect with your scene. <br/>
Of course the higher the resolution, the better it will look. On the other hand, if the graphic is too big, it will slow the game down. </div>
</li>
<li><div> A box or sphere map is the simplest solution. But you can use any Node as sky, even complex sets of geometries and quads with animated clouds, blinking stars, city skylines, etc.</div>
</li>
<li><div> JME3 supports cube maps in <acronym title="Portable Network Graphics">PNG</acronym>, <acronym title="Joint Photographics Experts Group">JPG</acronym>, or (compressed) DDS format.</div>
</li>
</ul>
<p>
Box or Sphere?
</p>
<ul>
<li><div> If you have access to cube map textures, then use a SkyBox</div>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://1.bp.blogspot.com/_uVsWqMqIGQU/SN0IZEE117I/AAAAAAAAAPs/4lfHx1Erdqg/s1600/skybox"><param name="text" value="<html><u>SkyBox examples</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</li>
<li><div> If you have access to sphere map textures – specially projected sky images that fit inside a sphere – then you use a SkySphere or SkyDome. </div>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://wiki.delphigl.com/index.php/Datei:Skysphere.jpg"><param name="text" value="<html><u>SkySphere example</u></html>"><param name="textColor" value="blue"></object></div>
</li>

@ -1,4 +1,39 @@
<h1><a>Spatial</a></h1><div><p>This is an introduction to the concept of Spatials, the elements of the 3D scene graph. The scene graph is a data structure that manages all objects in your 3D world. For example, the scene graph keeps track of the 3D models that you load and position. When you extend a Java class from com.jme3.app.SimpleApplication, you automatically inherit the scene graph and its rootNode.</p><p>The rootNode is the central element of the scene graph. Even if the scenegraph is empty, it always has at least its rootNode. All other Spatials are <em>attached</em> to the rootNode in a parent-child relationship. If you think you need to understand the scene graph concept better, please read <a href="/com/jme3/gde/core/docs/jme3/scenegraph_for_dummies.html">Scenegraph for dummies</a> first.</p></div><h2><a>Node versus Geometry</a></h2><div><p>In your Java code, a Spatial is either a com.jme3.scene.Node or a com.jme3.scene.Geometry. You use the two for different purposes:</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/intermediate/scene-graph.png"></p><div><table><tr><td></td><th>com.jme3.scene.Spatial</th></tr><tr><th>Purpose:</th><td>A Spatial is an abstract data structure that stores transformations (translation, rotation, scale) of elements of the scene graph. Spatials can be saved and loaded using the AssetManager.</td></tr><tr><td></td><th>com.jme3.scene.Geometry</th><th>com.jme3.scene.Node </th>
<h1><a>Spatial</a></h1>
<div>
<p>
This is an introduction to the concept of Spatials, the elements of the 3D scene graph. The scene graph is a data structure that manages all objects in your 3D world. For example, the scene graph keeps track of the 3D models that you load and position. When you extend a Java class from com.jme3.app.SimpleApplication, you automatically inherit the scene graph and its rootNode.
</p>
<p>
The rootNode is the central element of the scene graph. Even if the scenegraph is empty, it always has at least its rootNode. All other Spatials are <em>attached</em> to the rootNode in a parent-child relationship. If you think you need to understand the scene graph concept better, please read <a href="/com/jme3/gde/core/docs/jme3/scenegraph_for_dummies.html">Scenegraph for dummies</a> first.
</p>
</div>
<h2><a>Node versus Geometry</a></h2>
<div>
<p>
In your Java code, a Spatial is either a com.jme3.scene.Node or a com.jme3.scene.Geometry. You use the two for different purposes:
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/intermediate/scene-graph.png">
</p>
<div><table>
<tr>
<td> </td><th>com.jme3.scene.Spatial </th>
</tr>
<tr>
<th> Purpose: </th><td> A Spatial is an abstract data structure that stores transformations (translation, rotation, scale) of elements of the scene graph. Spatials can be saved and loaded using the AssetManager. </td>
</tr>
<tr>
<td> </td><th> com.jme3.scene.Geometry </th><th> com.jme3.scene.Node </th>
</tr>
<tr>
<th> Visibility: </th><td> A Geometry represents a visible 3-D object in the scene graph. </td><td> A Node is an invisible &quot;handle&quot; for a group of objects in the scene graph. </td>

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

File diff suppressed because one or more lines are too long

@ -1,4 +1,17 @@
<h2><a>Terrain Collision</a></h2><div><p>This tutorial expands the HelloTerrain tutorial and makes the terrain solid. You combine what you learned in <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html">Hello Terrain</a> and <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html">Hello Collision</a> and add a CollisionShape to the terrain. The terrain&#039;s CollisionShape lets the first-person player (who is also a CollisionShape) collide with the terrain, i.e. walk on it and stand on it.</p></div><h2><a>Sample Code</a></h2><div><pre>package jme3test.helloworld;
<h2><a>Terrain Collision</a></h2>
<div>
<p>
This tutorial expands the HelloTerrain tutorial and makes the terrain solid. You combine what you learned in <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html">Hello Terrain</a> and <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html">Hello Collision</a> and add a CollisionShape to the terrain. The terrain&#039;s CollisionShape lets the first-person player (who is also a CollisionShape) collide with the terrain, i.e. walk on it and stand on it.
</p>
</div>
<h2><a>Sample Code</a></h2>
<div>
<pre>package jme3test.helloworld;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.bullet.BulletAppState;

@ -1,5 +1,112 @@
<h1><a>Controlling a Physical Vehicle</a></h1><div><p>For physical vehicles, jME&#039;s uses the jBullet ray-cast vehicle. In this vehicle implementation, the physical chassis &#039;floats&#039; along on four non-physical vertical rays.</p><p>Internally, each wheel casts a ray down, and using the ray&#039;s intersection point, jBullet calculates the suspension length, and the suspension force. The suspension force is applied to the chassis, keeping it from hitting the ground. The friction force is calculated for each wheel where the ray intersects with the ground. Friction is applied as a sideways and forwards force. <sup><a href="#fn__1">1)</a></sup></p><p>This article shows how you use this vehicle implementation in a jME3 application.</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/physics-vehicle.png"></p></div><h2><a>Sample Code</a></h2><div><p>Full code samples are 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/TestPhysicsCar.java"><param name="text" value="<html><u>TestPhysicsCar.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/TestFancyCar.java"><param name="text" value="<html><u>TestFancyCar.java</u></html>"><param name="textColor" value="blue"></object></div></li></ul></div><h2><a>Overview of this Physics Application</a></h2><div><p>The goal is to create a physical vehicle with wheels that can be steered and that interacts (collides with) with the floor and obstacles.</p><ol><li><div>Create a SimpleApplication with a <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">BulletAppState</a></div><ul><li><div>This gives us a PhysicsSpace for PhysicsNodes</div></li></ul></li><li><div>Create a VehicleControl + CompoundCollisionShape for the physical vehicle behaviour</div><ol><li><div>Set physical properties of the vehicle, such as suspension.</div></li></ol></li><li><div>Create a VehicleNode for the car model</div><ol><li><div>Create a box plus 4 cylinders as wheels (using <code>vehicle.addWheel()</code>).</div></li><li><div>Add the VehicleControl behaviour to the VehicleNode geometry.</div></li></ol></li><li><div>Create a RigidBodyControl and CollisionShape for the floor</div></li><li><div>Map key triggers and add input listeners</div><ul><li><div>Navigational commands Left, Right, Foward, Brake.</div></li></ul></li><li><div>Define the steering actions to be triggered by the key events.</div><ul><li><div><code>vehicle.steer()</code></div></li><li><div><code>vehicle.accelerate()</code></div></li><li><div><code>vehicle.brake()</code></div></li></ul></li></ol></div><h2><a>Creating the Vehicle Chassis</a></h2><div><p>The vehicle that we create here 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/bullet/TestPhysicsCar.java"><param name="text" value="<html><u>TestPhysicsCar.java</u></html>"><param name="textColor" value="blue"></object> example is just a &quot;box on wheels&quot;, a basic vehicle shape that you can replace with a fancy car model, as demonstrated in <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/TestFancyCar.java"><param name="text" value="<html><u>TestFancyCar.java</u></html>"><param name="textColor" value="blue"></object>.</p><p>Every physical object must have a collision shape, that we prepare first. For the vehicle, we choose a compound collision shape that is made up of a box-shaped body of the right size for the vehicle. We will add the wheels later.</p><pre>CompoundCollisionShape compoundShape = new CompoundCollisionShape&#40;&#41;;
BoxCollisionShape box = new BoxCollisionShape&#40;new Vector3f&#40;1.2f, 0.5f, 2.4f&#41;&#41;;</pre><p><strong>Best Practice:</strong> We attach the BoxCollisionShape (the vehicle body) to the CompoundCollisionShape at a Vector of (0,1,0): This shifts the effective center of mass of the BoxCollisionShape downwards to 0,-1,0 and makes a moving vehicle more stable!</p><pre>compoundShape.addChildShape&#40;box, new Vector3f&#40;0, 1, 0&#41;&#41;;</pre>
<h1><a>Controlling a Physical Vehicle</a></h1>
<div>
<p>
For physical vehicles, jME&#039;s uses the jBullet ray-cast vehicle. In this vehicle implementation, the physical chassis &#039;floats&#039; along on four non-physical vertical rays.
</p>
<p>
Internally, each wheel casts a ray down, and using the ray&#039;s intersection point, jBullet calculates the suspension length, and the suspension force. The suspension force is applied to the chassis, keeping it from hitting the ground. The friction force is calculated for each wheel where the ray intersects with the ground. Friction is applied as a sideways and forwards force. <sup><a href="#fn__1">1)</a></sup>
</p>
<p>
This article shows how you use this vehicle implementation in a jME3 application.
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/advanced/physics-vehicle.png">
</p>
</div>
<h2><a>Sample Code</a></h2>
<div>
<p>
Full code samples are 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/TestPhysicsCar.java"><param name="text" value="<html><u>TestPhysicsCar.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/TestFancyCar.java"><param name="text" value="<html><u>TestFancyCar.java</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
</div>
<h2><a>Overview of this Physics Application</a></h2>
<div>
<p>
The goal is to create a physical vehicle with wheels that can be steered and that interacts (collides with) with the floor and obstacles.
</p>
<ol>
<li><div> Create a SimpleApplication with a <a href="/com/jme3/gde/core/docs/jme3/advanced/physics.html">BulletAppState</a> </div>
<ul>
<li><div> This gives us a PhysicsSpace for PhysicsNodes</div>
</li>
</ul>
</li>
<li><div> Create a VehicleControl + CompoundCollisionShape for the physical vehicle behaviour</div>
<ol>
<li><div> Set physical properties of the vehicle, such as suspension.</div>
</li>
</ol>
</li>
<li><div> Create a VehicleNode for the car model</div>
<ol>
<li><div> Create a box plus 4 cylinders as wheels (using <code>vehicle.addWheel()</code>).</div>
</li>
<li><div> Add the VehicleControl behaviour to the VehicleNode geometry.</div>
</li>
</ol>
</li>
<li><div> Create a RigidBodyControl and CollisionShape for the floor</div>
</li>
<li><div> Map key triggers and add input listeners</div>
<ul>
<li><div> Navigational commands Left, Right, Foward, Brake.</div>
</li>
</ul>
</li>
<li><div> Define the steering actions to be triggered by the key events.</div>
<ul>
<li><div> <code>vehicle.steer()</code></div>
</li>
<li><div> <code>vehicle.accelerate()</code></div>
</li>
<li><div> <code>vehicle.brake()</code></div>
</li>
</ul>
</li>
</ol>
</div>
<h2><a>Creating the Vehicle Chassis</a></h2>
<div>
<p>
The vehicle that we create here 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/bullet/TestPhysicsCar.java"><param name="text" value="<html><u>TestPhysicsCar.java</u></html>"><param name="textColor" value="blue"></object> example is just a &quot;box on wheels&quot;, a basic vehicle shape that you can replace with a fancy car model, as demonstrated in <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/TestFancyCar.java"><param name="text" value="<html><u>TestFancyCar.java</u></html>"><param name="textColor" value="blue"></object>.
</p>
<p>
Every physical object must have a collision shape, that we prepare first. For the vehicle, we choose a compound collision shape that is made up of a box-shaped body of the right size for the vehicle. We will add the wheels later.
</p>
<pre>CompoundCollisionShape compoundShape = new CompoundCollisionShape&#40;&#41;;
BoxCollisionShape box = new BoxCollisionShape&#40;new Vector3f&#40;1.2f, 0.5f, 2.4f&#41;&#41;;</pre>
<p>
<strong>Best Practice:</strong> We attach the BoxCollisionShape (the vehicle body) to the CompoundCollisionShape at a Vector of (0,1,0): This shifts the effective center of mass of the BoxCollisionShape downwards to 0,-1,0 and makes a moving vehicle more stable!
</p>
<pre>compoundShape.addChildShape&#40;box, new Vector3f&#40;0, 1, 0&#41;&#41;;</pre>
<p>
Any kind of geometry can make up the visible part of the vehicle, here we use a wireframe box. We create a node that we use to group the geometry.

@ -1,25 +1,138 @@
<h1><a>Walking Character</a></h1><div><p>In the <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html">Hello Collision</a> tutorial and 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/bullet/TestQ3.java"><param name="text" value="<html><u>TestQ3.java</u></html>"><param name="textColor" value="blue"></object> code sample you have seen how to create collidable landscapes and walk around in a first-person perspective. The first-person camera is enclosed by a collision shape and is steered by a CharacterControl.</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.</p></div><h3><a>Why use CharacterControl instead of RigidBodyControl?</a></h3><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:</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></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/TestWalkingChar.java"><param name="text" value="<html><u>TestWalkingChar.java</u></html>"><param name="textColor" value="blue"></object> (third-person view)</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/TestQ3.java"><param name="text" value="<html><u>TestQ3.java</u></html>"><param name="textColor" value="blue"></object> (first-person view)</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/helloworld/HelloCollision.java"><param name="text" value="<html><u>HelloCollision.java</u></html>"><param name="textColor" value="blue"></object> (first-person view)</div></li></ul><p>The code in this tutorial is a combination of these samples.</p></div><h3><a>Code Skeleton</a></h3><div><pre>public class WalkingCharacterDemo extends SimpleApplication
<h1><a>Walking Character</a></h1>
<div>
<p>
In the <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html">Hello Collision</a> tutorial and 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/bullet/TestQ3.java"><param name="text" value="<html><u>TestQ3.java</u></html>"><param name="textColor" value="blue"></object> code sample you have seen how to create collidable landscapes and walk around in a first-person perspective. The first-person camera is enclosed by a collision shape and is steered by a CharacterControl.
</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.
</p>
</div>
<h3><a>Why use CharacterControl instead of RigidBodyControl?</a></h3>
<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:
</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>
<ul>
<li><div> Uses also <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/BombControl.java"><param name="text" value="<html><u>BombControl.java</u></html>"><param name="textColor" value="blue"></object> </div>
</li>
</ul>
</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/TestWalkingChar.java"><param name="text" value="<html><u>TestWalkingChar.java</u></html>"><param name="textColor" value="blue"></object> (third-person view)</div>
<ul>
<li><div> Uses also <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/BombControl.java"><param name="text" value="<html><u>BombControl.java</u></html>"><param name="textColor" value="blue"></object> </div>
</li>
</ul>
</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/TestQ3.java"><param name="text" value="<html><u>TestQ3.java</u></html>"><param name="textColor" value="blue"></object> (first-person view)</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/helloworld/HelloCollision.java"><param name="text" value="<html><u>HelloCollision.java</u></html>"><param name="textColor" value="blue"></object> (first-person view)</div>
</li>
</ul>
<p>
The code in this tutorial is a combination of these samples.
</p>
</div>
<h3><a>Code Skeleton</a></h3>
<div>
<pre>public class WalkingCharacterDemo extends SimpleApplication
implements ActionListener, AnimEventListener &#123;
&nbsp;
public static void main&#40;String&#91;&#93; args&#41; &#123;
WalkingCharacterDemo app = new WalkingCharacterDemo&#40;&#41;;
app.start&#40;&#41;;
&#125;
&nbsp;
public void simpleInitApp&#40;&#41; &#123; &#125;
&nbsp;
public void simpleUpdate&#40;float tpf&#41; &#123; &#125;
&nbsp;
public void onAction&#40;String name, boolean isPressed, float tpf&#41; &#123; &#125;
&nbsp;
public void onAnimCycleDone&#40;AnimControl control, AnimChannel channel, String animName&#41; &#123; &#125;
public void onAnimChange&#40;AnimControl control, AnimChannel channel, Activate Physics</h2><div><pre>private BulletAppState bulletAppState;
&nbsp;
public void onAnimChange&#40;AnimControl control, AnimChannel channel, String animName&#41; &#123; &#125;</pre>
</div>
<h3><a>Overview</a></h3>
<div>
<ol>
<li><div> Activate physics 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>
<li><div> Create the animated character</div>
<ol>
<li><div> Load an animated character model.</div>
</li>
<li><div> Add a CharacterControl to the model.</div>
</li>
</ol>
</li>
<li><div> Set up animation channel and controllers.</div>
</li>
<li><div> Add a ChaseCam or CameraNode.</div>
</li>
<li><div> Handle navigational inputs</div>
</li>
</ol>
</div>
<h2><a>Activate Physics</a></h2>
<div>
<pre>private BulletAppState bulletAppState;
...
public void simpleInitApp&#40;&#41; &#123;
bulletAppState = new BulletAppState&#40;&#41;;
//bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
stateManager.attach&#40;bulletAppState&#41;;
...
&#125;</pre></div><h2><a>Initialize the Scene</a></h2><div><p>In the simpleInitApp() method you initialize the scene and give it a MeshCollisionShape. The sample in the jme3 sources uses a custom helper class that simply creates a flat floor and drops some cubes and spheres on it:</p><pre>public void simpleInitApp&#40;&#41; &#123;
&#125;</pre>
</div>
<h2><a>Initialize the Scene</a></h2>
<div>
<p>
In the simpleInitApp() method you initialize the scene and give it a MeshCollisionShape. The sample in the jme3 sources uses a custom helper class that simply creates a flat floor and drops some cubes and spheres on it:
</p>
<pre>public void simpleInitApp&#40;&#41; &#123;
...
PhysicsTestHelper.createPhysicsTestWorld&#40;rootNode,
assetManager, bulletAppState.getPhysicsSpace&#40;&#41;&#41;;
...</pre><p>In a real game, you would load a scene model here instead of a test world. You can load a model from a local or remote zip file, and scale and position it:</p><pre>private Node gameLevel;
...</pre>
<p>
In a real game, you would load a scene model here instead of a test world. You can load a model from a local or remote zip file, and scale and position it:
</p>
<pre>private Node gameLevel;
..
public void simpleInitApp&#40;&#41; &#123;
...
@ -35,9 +148,39 @@ public void simpleInitApp&#40;&#41; &#123;
gameLevel.addControl&#40;new RigidBodyControl&#40;0&#41;&#41;;
rootNode.attachChild&#40;gameLevel&#41;;
bulletAppState.getPhysicsSpace&#40;&#41;.addAll&#40;gameLevel&#41;;
...</pre><p>Also, add a light source to be able to see the scene.</p><pre> AmbientLight light = new AmbientLight&#40;&#41;;
...</pre>
<p>
Also, add a light source to be able to see the scene.
</p>
<pre> AmbientLight light = new AmbientLight&#40;&#41;;
light.setColor&#40;ColorRGBA.White.mult&#40;2&#41;&#41;;
rootNode.addLight&#40;light&#41;;</pre></div><h2><a>Create the Animated Character</a></h2><div><p>You create an animated model, such as Oto.mesh.xml.</p><ol><li><div>Place the &quot;Oto&quot; model into the <code>assets/Models/Oto/</code> directory of your project.</div></li><li><div>Create the CollisionShape and adjust the capsule radius and height to fit your character model.</div></li><li><div>Create the CharacterControl and adjust the stepheight (here 0.05f) to the height that the character can climb up without jumping.</div></li><li><div>Load the visible model. Make sure its start position does not overlap with scene objects.</div></li><li><div>Add the CharacterControl to the model and register it to the physicsSpace.</div></li><li><div>Attach the visible model to the rootNode.</div></li></ol><pre>private CharacterControl character;
rootNode.addLight&#40;light&#41;;</pre>
</div>
<h2><a>Create the Animated Character</a></h2>
<div>
<p>
You create an animated model, such as Oto.mesh.xml.
</p>
<ol>
<li><div> Place the &quot;Oto&quot; model into the <code>assets/Models/Oto/</code> directory of your project.</div>
</li>
<li><div> Create the CollisionShape and adjust the capsule radius and height to fit your character model.</div>
</li>
<li><div> Create the CharacterControl and adjust the stepheight (here 0.05f) to the height that the character can climb up without jumping.</div>
</li>
<li><div> Load the visible model. Make sure its start position does not overlap with scene objects.</div>
</li>
<li><div> Add the CharacterControl to the model and register it to the physicsSpace.</div>
</li>
<li><div> Attach the visible model to the rootNode.</div>
</li>
</ol>
<pre>private CharacterControl character;
private Node model;
...
public void simpleInitApp&#40;&#41; &#123;
@ -49,7 +192,23 @@ public void simpleInitApp&#40;&#41; &#123;
model.addControl&#40;character&#41;;
bulletAppState.getPhysicsSpace&#40;&#41;.add&#40;character&#41;;
rootNode.attachChild&#40;model&#41;;
...</pre><p><br/> <strong>Did you know?</strong> A CapsuleCollisionShape is a cylinder with rounded top and bottom. A capsule rotated upright is a good collision shape for a humanoid character since its roundedness reduces the risk of getting stuck on obstacles.</p></div><h3><a>Set Up AnimControl and AnimChannels</a></h3><div><p>Create several AnimChannels, one for each animation that can happen simultaneously. In this example, you create one channel for walking and one for attacking. (Because the character can attack with its arms and walk with the rest of the body at the same time.)</p><pre>private AnimChannel animationChannel;
...</pre>
<p>
<p><div><strong>Did you know?</strong> A CapsuleCollisionShape is a cylinder with rounded top and bottom. A capsule rotated upright is a good collision shape for a humanoid character since its roundedness reduces the risk of getting stuck on obstacles.
</div></p>
</p>
</div>
<h3><a>Set Up AnimControl and AnimChannels</a></h3>
<div>
<p>
Create several AnimChannels, one for each animation that can happen simultaneously. In this example, you create one channel for walking and one for attacking. (Because the character can attack with its arms and walk with the rest of the body at the same time.)
</p>
<pre>private AnimChannel animationChannel;
private AnimChannel attackChannel;
private AnimControl animationControl;
...
@ -62,14 +221,38 @@ public void simpleInitApp&#40;&#41; &#123;
attackChannel.addBone&#40;animationControl.getSkeleton&#40;&#41;.getBone&#40;&quot;uparm.right&quot;&#41;&#41;;
attackChannel.addBone&#40;animationControl.getSkeleton&#40;&#41;.getBone&#40;&quot;arm.right&quot;&#41;&#41;;
attackChannel.addBone&#40;animationControl.getSkeleton&#40;&#41;.getBone&#40;&quot;hand.right&quot;&#41;&#41;;
...</pre><p>The attackChannel only controls one arm, while the walking channels controls the whole character.</p></div><h2><a>Add ChaseCam / CameraNode</a></h2><div><pre>private ChaseCamera chaseCam;
...</pre>
<p>
The attackChannel only controls one arm, while the walking channels controls the whole character.
</p>
</div>
<h2><a>Add ChaseCam / CameraNode</a></h2>
<div>
<pre>private ChaseCamera chaseCam;
&nbsp;
...
&nbsp;
public void simpleInitApp&#40;&#41; &#123;
...
flyCam.setEnabled&#40;false&#41;;
chaseCam = new ChaseCamera&#40;cam, model, inputManager&#41;;
...</pre></div><h2><a>Handle navigational inputs</a></h2><div><p>Configure custom key bindings for WASD keys that you will use to make the character walk.</p><pre>private boolean left = false, right = false, up = false, down = false;
...</pre>
</div>
<h2><a>Handle navigational inputs</a></h2>
<div>
<p>
Configure custom key bindings for WASD keys that you will use to make the character walk.
</p>
<pre>private boolean left = false, right = false, up = false, down = false;
...
&nbsp;
public void simpleInitApp&#40;&#41; &#123;
...
inputManager.addMapping&#40;&quot;CharLeft&quot;, new KeyTrigger&#40;KeyInput.KEY_A&#41;&#41;;
@ -82,7 +265,12 @@ public void simpleInitApp&#40;&#41; &#123;
inputManager.addListener&#40;this, &quot;CharForward&quot;, &quot;CharBackward&quot;&#41;;
inputManager.addListener&#40;this, &quot;CharJump&quot;, &quot;CharAttack&quot;&#41;;
...
&#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)</p><pre>@Override
&#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)
</p>
<pre>@Override
public void onAction&#40;String binding, boolean value, float tpf&#41; &#123;
if &#40;binding.equals&#40;&quot;CharLeft&quot;&#41;&#41; &#123;
if &#40;value&#41; left = true;
@ -100,26 +288,41 @@ public void onAction&#40;String binding, boolean value, float tpf&#41; &#123;
character.jump&#40;&#41;;
if &#40;binding.equals&#40;&quot;CharAttack&quot;&#41;&#41;
attack&#40;&#41;;
&#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.</p><pre>private void attack&#40;&#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.
</p>
<pre>private void attack&#40;&#41; &#123;
attackChannel.setAnim&#40;&quot;Dodge&quot;, 0.1f&#41;;
attackChannel.setLoopMode&#40;LoopMode.DontLoop&#41;;
&#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.</p><pre>private Vector3f walkDirection = new Vector3f&#40;0,0,0&#41;;
&#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.
</p>
<pre>private Vector3f walkDirection = new Vector3f&#40;0,0,0&#41;;
&nbsp;
private float airTime = 0;
&nbsp;
public void simpleUpdate&#40;float tpf&#41; &#123;
Vector3f camDir = cam.getDirection&#40;&#41;.clone&#40;&#41;.multLocal&#40;0.25f&#41;;
Vector3f camLeft = cam.getLeft&#40;&#41;.clone&#40;&#41;.multLocal&#40;0.25f&#41;;
camDir.y = 0;
camLeft.y = 0;
walkDirection.set&#40;0, 0, 0&#41;;
&nbsp;
if &#40;left&#41; walkDirection.addLocal&#40;camLeft&#41;;
if &#40;right&#41; walkDirection.addLocal&#40;camLeft.negate&#40;&#41;&#41;;
if &#40;up&#41; walkDirection.addLocal&#40;camDir&#41;;
if &#40;down&#41; walkDirection.addLocal&#40;camDir.negate&#40;&#41;&#41;;
&nbsp;
if &#40;!character.onGround&#40;&#41;&#41; &#123;
airTime = airTime + tpf;
&#125; else &#123;
airTime = 0;
&#125;
&nbsp;
if &#40;walkDirection.length&#40;&#41; == 0&#41; &#123;
if &#40;!&quot;stand&quot;.equals&#40;animationChannel.getAnimationName&#40;&#41;&#41;&#41; &#123;
animationChannel.setAnim&#40;&quot;stand&quot;, 1f&#41;;
@ -135,8 +338,25 @@ public void simpleUpdate&#40;float tpf&#41; &#123;
&#125;
&#125;
character.setWalkDirection&#40;walkDirection&#41;;
&#125;</pre><p>This method resets the walk animation.</p><pre>public void onAnimCycleDone&#40;AnimControl control, AnimChannel channel, String animName&#41; &#123;
&#125;</pre>
<p>
This method resets the walk animation.
</p>
<pre>public void onAnimCycleDone&#40;AnimControl control, AnimChannel channel, String animName&#41; &#123;
if &#40;channel == attackChannel&#41; channel.setAnim&#40;&quot;stand&quot;&#41;;
&#125;
public void onAnimChange&#40;AnimControl control, AnimChannel channel, collision </span></div></div>
&nbsp;
public void onAnimChange&#40;AnimControl control, AnimChannel channel, String animName&#41; &#123; &#125;</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>,
<a href="/wiki/doku.php/tag:input?do=showtag&amp;tag=tag%3Ainput">input</a>,
<a href="/wiki/doku.php/tag:animation?do=showtag&amp;tag=tag%3Aanimation">animation</a>,
<a href="/wiki/doku.php/tag:character?do=showtag&amp;tag=tag%3Acharacter">character</a>,
<a href="/wiki/doku.php/tag:npc?do=showtag&amp;tag=tag%3Anpc">NPC</a>,
<a href="/wiki/doku.php/tag:collision?do=showtag&amp;tag=tag%3Acollision">collision</a>
</span></div>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:advanced:walking_character?do=export_xhtmlbody">view online version</a></em></p>

@ -1,4 +1,37 @@
<h1><a>Simple Water</a></h1><div><p>Here is some background info for JME3&#039;s basic water implementation:</p><ul><li><div><object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/forum/index.php?topic=14740.0"><param name="text" value="<html><u>http://www.jmonkeyengine.com/forum/index.php?topic=14740.0</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.bonzaisoftware.com/water_tut.html"><param name="text" value="<html><u>http://www.bonzaisoftware.com/water_tut.html</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.gametutorials.com/Articles/RealisticWater.pdf"><param name="text" value="<html><u>http://www.gametutorials.com/Articles/RealisticWater.pdf</u></html>"><param name="textColor" value="blue"></object></div></li></ul><p><img src="/wiki/lib/exe/fetch.php"></p></div><h2><a>SimpleWaterProcessor</a></h2><div><p>A JME3 scene with water can use a <code>com.jme3.water.SimpleWaterProcessor</code> (which implements the SceneProcessor interface).</p><p>To achieve a water effect, JME3 uses shaders and a special material, <code>Common/MatDefs/Water/SimpleWater.j3md</code>. The water surface is a quad, and we use normal map and dU/dV map texturing to simulate the waves.
<h1><a>Simple Water</a></h1>
<div>
<p>
Here is some background info for JME3&#039;s basic water implementation:
</p>
<ul>
<li><div> <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/forum/index.php?topic=14740.0"><param name="text" value="<html><u>http://www.jmonkeyengine.com/forum/index.php?topic=14740.0</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.bonzaisoftware.com/water_tut.html"><param name="text" value="<html><u>http://www.bonzaisoftware.com/water_tut.html</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.gametutorials.com/Articles/RealisticWater.pdf"><param name="text" value="<html><u>http://www.gametutorials.com/Articles/RealisticWater.pdf</u></html>"><param name="textColor" value="blue"></object></div>
</li>
</ul>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
</div>
<h2><a>SimpleWaterProcessor</a></h2>
<div>
<p>
A JME3 scene with water can use a <code>com.jme3.water.SimpleWaterProcessor</code> (which implements the SceneProcessor interface).
</p>
<p>
To achieve a water effect, JME3 uses shaders and a special material, <code>Common/MatDefs/Water/SimpleWater.j3md</code>. The water surface is a quad, and we use normal map and dU/dV map texturing to simulate the waves.
</p>
<ol>

@ -1,4 +1,25 @@
<h1><a>JME 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><p>This tutorial shows how to add an animation controller and channels, and how to respond to user input by triggering an animation in a loaded model.</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-animation.png"></p></div><h2><a>Sample Code</a></h2><div><pre>package jme3test.helloworld;
<h1><a>JME 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>
<p>
This tutorial shows how to add an animation controller and channels, and how to respond to user input by triggering an animation in a loaded model.
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-animation.png">
</p>
</div>
<h2><a>Sample Code</a></h2>
<div>
<pre>package jme3test.helloworld;
&nbsp;
import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
@ -68,7 +89,22 @@ public class HelloAnimation extends SimpleApplication
&#125;
&#125;
&#125;;
&#125;</pre></div><h2><a>Creating and Loading Animated Models</a></h2><div><p>You create animated models with a tool such as Blender. Take some time and learn how to create your own models in these <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.blender.org/education-help/tutorials/animation/"><param name="text" value="<html><u>Blender Animation Tutorials</u></html>"><param name="textColor" value="blue"></object>. For now, download and use a free model, such as the one included here as an example (<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Models/Oto/"><param name="text" value="<html><u>Oto Golem</u></html>"><param name="textColor" value="blue"></object>, and <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Models/Ninja/"><param name="text" value="<html><u>Ninja</u></html>"><param name="textColor" value="blue"></object>).</p><p>Loading an animated model is pretty straight-forward, just as you have learned in the previous chapters. Animated Ogre models come as a set of files: The model is in <code>Oto.mesh.xml</code>, and the animation details are in <code>Oto.skeleton.xml</code>, plus the usual files for materials and textures. Check that all files of the model are together in the same <code>Model</code> subdirectory.</p><pre> public void simpleInitApp&#40;&#41; &#123;
&#125;</pre>
</div>
<h2><a>Creating and Loading Animated Models</a></h2>
<div>
<p>
You create animated models with a tool such as Blender. Take some time and learn how to create your own models in these <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.blender.org/education-help/tutorials/animation/"><param name="text" value="<html><u>Blender Animation Tutorials</u></html>"><param name="textColor" value="blue"></object>. For now, download and use a free model, such as the one included here as an example (<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Models/Oto/"><param name="text" value="<html><u>Oto Golem</u></html>"><param name="textColor" value="blue"></object>, and <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.googlecode.com/svn/trunk/engine/test-data/Models/Ninja/"><param name="text" value="<html><u>Ninja</u></html>"><param name="textColor" value="blue"></object>).
</p>
<p>
Loading an animated model is pretty straight-forward, just as you have learned in the previous chapters. Animated Ogre models come as a set of files: The model is in <code>Oto.mesh.xml</code>, and the animation details are in <code>Oto.skeleton.xml</code>, plus the usual files for materials and textures. Check that all files of the model are together in the same <code>Model</code> subdirectory.
</p>
<pre> public void simpleInitApp&#40;&#41; &#123;
/* Displaying the model requires a light source */
DirectionalLight dl = new DirectionalLight&#40;&#41;;
dl.setDirection&#40;new Vector3f&#40;-0.1f, -1f, -1&#41;.normalizeLocal&#40;&#41;&#41;;
@ -78,7 +114,30 @@ public class HelloAnimation extends SimpleApplication
player.setLocalScale&#40;0.5f&#41;; // resize
rootNode.attachChild&#40;player&#41;;
...
&#125;</pre><p>Don&#039;t forget to add a light source to make the material visible.</p></div><h2><a>Animation Controler and Channel</a></h2><div><p>After you load the animated model, you register it to the Animation Controller.</p><ul><li><div>The controller object gives you access to the available animation sequences.</div></li><li><div>The controller can have several channels, each channel can run one animation sequence at a time.</div></li><li><div>To run several sequences, you create several channels, and set them each to their animation.</div></li></ul><pre> private AnimChannel channel;
&#125;</pre>
<p>
Don&#039;t forget to add a light source to make the material visible.
</p>
</div>
<h2><a>Animation Controler and Channel</a></h2>
<div>
<p>
After you load the animated model, you register it to the Animation Controller.
</p>
<ul>
<li><div> The controller object gives you access to the available animation sequences.</div>
</li>
<li><div> The controller can have several channels, each channel can run one animation sequence at a time.</div>
</li>
<li><div> To run several sequences, you create several channels, and set them each to their animation.</div>
</li>
</ul>
<pre> private AnimChannel channel;
private AnimControl control;
&nbsp;
public void simpleInitApp&#40;&#41; &#123;
@ -89,7 +148,18 @@ public class HelloAnimation extends SimpleApplication
control.addListener&#40;this&#41;;
channel = control.createChannel&#40;&#41;;
channel.setAnim&#40;&quot;stand&quot;&#41;;
...</pre></div><h2><a>Responding to Animation Events</a></h2><div><p>Add <code>implements AnimEventListener</code> to the class declaration. This interface gives you access to events that notify you when a sequence is done, or when you change from one sequence to another, so you can respond to it. In this example, you reset the character to a standing position after a <code>Walk</code> cycle is done.</p><pre>public class HelloAnimation extends SimpleApplication
...</pre>
</div>
<h2><a>Responding to Animation Events</a></h2>
<div>
<p>
Add <code>implements AnimEventListener</code> to the class declaration. This interface gives you access to events that notify you when a sequence is done, or when you change from one sequence to another, so you can respond to it. In this example, you reset the character to a standing position after a <code>Walk</code> cycle is done.
</p>
<pre>public class HelloAnimation extends SimpleApplication
implements AnimEventListener &#123;
...
&nbsp;
@ -103,10 +173,54 @@ public class HelloAnimation extends SimpleApplication
&#125;
public void onAnimChange&#40;AnimControl control, AnimChannel channel, String animName&#41; &#123;
// unused
&#125;</pre></div><h2><a>Trigger Animations After User Input</a></h2><div><p>There are ambient animations like animals or trees that you may want to trigger in the main event loop. In other cases, animations are triggered by user interaction, such as key input. You want to play the Walk animation when the player presses a certain key (here the spacebar), at the same time as the avatar performs the walk action and changes its location.</p><ol><li><div>Initialize a new input controller (in <code>simpleInitApp()</code>).</div><ul><li><div>Write the <code>initKey()</code> convenience method and call it from <code>simpleInitApp()</code>.</div></li></ul></li><li><div>Add a key mapping with the name as the action you want to trigger.</div><ul><li><div>Here for example, you map <code>Walk</code> to the Spacebar key.</div></li></ul></li><li><div>Add an input listener for the <code>Walk</code> action.</div></li></ol><pre> private void initKeys&#40;&#41; &#123;
&#125;</pre>
</div>
<h2><a>Trigger Animations After User Input</a></h2>
<div>
<p>
There are ambient animations like animals or trees that you may want to trigger in the main event loop. In other cases, animations are triggered by user interaction, such as key input. You want to play the Walk animation when the player presses a certain key (here the spacebar), at the same time as the avatar performs the walk action and changes its location.
</p>
<ol>
<li><div> Initialize a new input controller (in <code>simpleInitApp()</code>).</div>
<ul>
<li><div> Write the <code>initKey()</code> convenience method and call it from <code>simpleInitApp()</code>.</div>
</li>
</ul>
</li>
<li><div> Add a key mapping with the name as the action you want to trigger.</div>
<ul>
<li><div> Here for example, you map <code>Walk</code> to the Spacebar key.</div>
</li>
</ul>
</li>
<li><div> Add an input listener for the <code>Walk</code> action.</div>
</li>
</ol>
<pre> private void initKeys&#40;&#41; &#123;
inputManager.addMapping&#40;&quot;Walk&quot;, new KeyTrigger&#40;KeyInput.KEY_SPACE&#41;&#41;;
inputManager.addListener&#40;actionListener, &quot;Walk&quot;&#41;;
&#125;</pre><p>To use the input controller, you need to implement the actionLister: Test for each action by name, and set the channel to the corresponding animation to run.</p><ul><li><div>The second parameter of setAnim() is the blendTime (how long the current animation should overlap with the last one).</div></li><li><div>LoopMode can be Loop (repeat), Cycle (forward then backward), and DontLoop (only once).</div></li><li><div>If needed, use channel.setSpeed() to set the speed of this animation.</div></li><li><div>Optionally, use channel.setTime() to Fast-forward or rewind to a certain moment in time of this animation.</div></li></ul><pre> private ActionListener&#40;&#41; &#123;
&#125;</pre>
<p>
To use the input controller, you need to implement the actionLister:
Test for each action by name, and set the channel to the corresponding animation to run.
</p>
<ul>
<li><div> The second parameter of setAnim() is the blendTime (how long the current animation should overlap with the last one).</div>
</li>
<li><div> LoopMode can be Loop (repeat), Cycle (forward then backward), and DontLoop (only once).</div>
</li>
<li><div> If needed, use channel.setSpeed() to set the speed of this animation.</div>
</li>
<li><div> Optionally, use channel.setTime() to Fast-forward or rewind to a certain moment in time of this animation.</div>
</li>
</ul>
<pre> private ActionListener&#40;&#41; &#123;
public void onAction&#40;String name, boolean keyPressed, float tpf&#41; &#123;
if &#40;name.equals&#40;&quot;Walk&quot;&#41; &amp;&amp; !keyPressed&#41; &#123;
if &#40;!channel.getAnimationName&#40;&#41;.equals&#40;&quot;Walk&quot;&#41;&#41;&#123;
@ -115,7 +229,40 @@ public class HelloAnimation extends SimpleApplication
&#125;
&#125;
&#125;
&#125;;</pre></div><h2><a>Exercises</a></h2><div></div><h4><a>Exercise 1: Two Animations</a></h4><div><p>Make a mouse click trigger another animation sequence!</p><ol><li><div>Create a second channel in the controller</div></li><li><div>Create a new key trigger mapping and action (see: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html">Hello Input</a>)</div></li><li><div>Tip: Do you want to find out what animation sequences are available in the model? Use:<pre>for &#40;Exercise 2: Revealing the Skeleton (1)</h4><div><p>Open the <code>skeleton.xml</code> file in a text editor of your choice. You don&#039;t have to be able to read or write these xml files (Blender does that for you) – but it is good to know how skeletons work. &quot;There&#039;s no magic to it!&quot;
&#125;;</pre>
</div>
<h2><a>Exercises</a></h2>
<div>
</div>
<h4><a>Exercise 1: Two Animations</a></h4>
<div>
<p>
Make a mouse click trigger another animation sequence!
</p>
<ol>
<li><div> Create a second channel in the controller</div>
</li>
<li><div> Create a new key trigger mapping and action (see: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html">Hello Input</a>)</div>
</li>
<li><div> Tip: Do you want to find out what animation sequences are available in the model? Use: <pre>for &#40;System.out.println&#40;anim&#41;; &#125;</pre>
</div>
</li>
</ol>
</div>
<h4><a>Exercise 2: Revealing the Skeleton (1)</a></h4>
<div>
<p>
Open the <code>skeleton.xml</code> file in a text editor of your choice. You don&#039;t have to be able to read or write these xml files (Blender does that for you) – but it is good to know how skeletons work. &quot;There&#039;s no magic to it!&quot;
</p>
<ul>
<li><div> Note how the bones are numbered and named. All names of animated models follow a naming scheme.</div>

@ -1,4 +1,31 @@
<h1><a>JME 3 Tutorial (3) - Hello Assets</a></h1><div><p>Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_node.html">Hello Node</a>, Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html">Hello Update Loop</a></p><p>In this tutorial we will learn to load 3-D models and text into the scene graph, using the jME asset manager. You also learn how to arrive at the correct paths, and which file formats to use.</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-assets-models.png"></p><p><p><div>To use the example assets in a new jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> project, right-click your project, select &quot;Properties&quot;, go to &quot;Libraries&quot;, press &quot;Add Library&quot; and add the &quot;jme3-test-data&quot; library.</div></p></p></div><h2><a>Code Sample</a></h2><div><pre>package jme3test.helloworld;
<h1><a>JME 3 Tutorial (3) - Hello Assets</a></h1>
<div>
<p>
Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_node.html">Hello Node</a>,
Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html">Hello Update Loop</a>
</p>
<p>
In this tutorial we will learn to load 3-D models and text into the scene graph, using the jME asset manager. You also learn how to arrive at the correct paths, and which file formats to use.
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-assets-models.png">
</p>
<p>
<p><div>To use the example assets in a new jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> project, right-click your project, select &quot;Properties&quot;, go to &quot;Libraries&quot;, press &quot;Add Library&quot; and add the &quot;jme3-test-data&quot; library.
</div></p>
</p>
</div>
<h2><a>Code Sample</a></h2>
<div>
<pre>package jme3test.helloworld;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.font.BitmapText;
@ -59,7 +86,36 @@ public class HelloAssets extends SimpleApplication &#123;
rootNode.addLight&#40;sun&#41;;
&nbsp;
&#125;
&#125;</pre><p>Build and run the code sample. You should see a green Ninja with a colorful teapot standing behind a wall. The text on the screen should say &quot;Hello World&quot;.</p></div><h2><a>The Asset Manager</a></h2><div><p>JME3 comes with a handy asset manager that helps you keep your assets organized. Project assets are media files such as models, materials, textures, scenes, shaders, sounds, and fonts. The Asset manager can load files from:</p><ul><li><div>the current classpath (the top level of your project directory),</div></li><li><div>the <code>assets</code> directory of your project, and</div></li><li><div>optionally, custom paths.</div></li></ul><p>This is our recommended directory structure for storing assets:</p><pre>MyGame/assets/Interface/
&#125;</pre>
<p>
Build and run the code sample. You should see a green Ninja with a colorful teapot standing behind a wall. The text on the screen should say &quot;Hello World&quot;.
</p>
</div>
<h2><a>The Asset Manager</a></h2>
<div>
<p>
JME3 comes with a handy asset manager that helps you keep your assets organized. Project assets are media files such as models, materials, textures, scenes, shaders, sounds, and fonts.
The Asset manager can load files from:
</p>
<ul>
<li><div> the current classpath (the top level of your project directory), </div>
</li>
<li><div> the <code>assets</code> directory of your project, and</div>
</li>
<li><div> optionally, custom paths.</div>
</li>
</ul>
<p>
This is our recommended directory structure for storing assets:
</p>
<pre>MyGame/assets/Interface/
MyGame/assets/MatDefs/
MyGame/assets/Materials/
MyGame/assets/Models/
@ -69,7 +125,22 @@ MyGame/assets/Sounds/
MyGame/assets/Textures/
MyGame/build.xml
MyGame/src/...
MyGame/...</pre><p>This is just a suggested best practice, you can name the directories in the assets directory what ever you like.</p></div><h3><a>Loading Textures</a></h3><div><p>Place your textures in a subdirectory of <code>assets/Textures/</code>. Load the texture into the material before you set the Material. The following code sample is from the <code>simpleInitApp()</code> method and loads a simple wall model:</p><pre>// Create a wall with a simple texture from test_data
MyGame/...</pre>
<p>
This is just a suggested best practice, you can name the directories in the assets directory what ever you like.
</p>
</div>
<h3><a>Loading Textures</a></h3>
<div>
<p>
Place your textures in a subdirectory of <code>assets/Textures/</code>. Load the texture into the material before you set the Material. The following code sample is from the <code>simpleInitApp()</code> method and loads a simple wall model:
</p>
<pre>// Create a wall with a simple texture from test_data
Box&#40;Vector3f.ZERO, 2.5f,2.5f,1.0f&#41;;
Spatial wall = new Geometry&#40;&quot;Box&quot;, box &#41;;
Material mat_brick = new Material&#40;

@ -1,4 +1,20 @@
<h1><a>JME 3 Tutorial (11) - Hello Audio</a></h1><div><p>Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html">Hello Terrain</a>, Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_effects.html">Hello Effects</a></p><p>This tutorial explains how to add 3D sound to a game, and how make sounds play together with events, such as clicking. You learn how to use an Audio Listener and Audio Nodes. You also make use of an Action Listener and a MouseButtonTrigger from the previous <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html">Hello Input</a> tutorial to make a mouse click trigger a gun shot sound.</p></div><h2><a>Sample Code</a></h2><div><pre>package jme3test.helloworld;
<h1><a>JME 3 Tutorial (11) - Hello Audio</a></h1>
<div>
<p>
Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html">Hello Terrain</a>, Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_effects.html">Hello Effects</a>
</p>
<p>
This tutorial explains how to add 3D sound to a game, and how make sounds play together with events, such as clicking. You learn how to use an Audio Listener and Audio Nodes. You also make use of an Action Listener and a MouseButtonTrigger from the previous <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html">Hello Input</a> tutorial to make a mouse click trigger a gun shot sound.
</p>
</div>
<h2><a>Sample Code</a></h2>
<div>
<pre>package jme3test.helloworld;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.audio.AudioNode;

@ -1,8 +1,41 @@
<h1><a>JME 3 Tutorial (9) - Hello Collision</a></h1><div><p>Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_picking.html">Hello Picking</a>, Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html">Hello Terrain</a></p><p>This tutorial demonstrates how you load a scene model and give it solid walls and floors for a character to walk around. You use a <code>RigidBodyControl</code> for the static collidable scene, and a <code>CharacterControl</code> for the mobile first-person character. You also learn how to set up the default first-person camera to work with physics-controlled navigation. You can use the solution shown here for first-person shooters, mazes, and similar games.</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-scene.png"></p></div><h2><a>Sample Code</a></h2><div><p>If you don&#039;t have it yet, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.googlecode.com/svn/trunk/engine/town.zip"><param name="text" value="<html><u>download the town.zip</u></html>"><param name="textColor" value="blue"></object> sample scene.</p><pre>jMonkeyProjects$ ls -1 BasicGame
<h1><a>JME 3 Tutorial (9) - Hello Collision</a></h1>
<div>
<p>
Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_picking.html">Hello Picking</a>,
Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html">Hello Terrain</a>
</p>
<p>
This tutorial demonstrates how you load a scene model and give it solid walls and floors for a character to walk around.
You use a <code>RigidBodyControl</code> for the static collidable scene, and a <code>CharacterControl</code> for the mobile first-person character. You also learn how to set up the default first-person camera to work with physics-controlled navigation.
You can use the solution shown here for first-person shooters, mazes, and similar games.
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-scene.png">
</p>
</div>
<h2><a>Sample Code</a></h2>
<div>
<p>
If you don&#039;t have it yet, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.googlecode.com/svn/trunk/engine/town.zip"><param name="text" value="<html><u>download the town.zip</u></html>"><param name="textColor" value="blue"></object> sample scene.
</p>
<pre>jMonkeyProjects$ ls -1 BasicGame
assets/
build.xml
town.zip
src/</pre><p>Place town.zip in the root directory of your JME3 project. Here is the code:</p><pre>package jme3test.helloworld;
src/</pre>
<p>
Place town.zip in the root directory of your JME3 project. Here is the code:
</p>
<pre>package jme3test.helloworld;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.asset.plugins.ZipLocator;
@ -147,16 +180,70 @@ public class HelloCollision extends SimpleApplication
player.setWalkDirection&#40;walkDirection&#41;;
cam.setLocation&#40;player.getPhysicsLocation&#40;&#41;&#41;;
&#125;
&#125;</pre><p>Run the sample. You should see a town square with houses and a monument. Use the WASD keys and the mouse to navigate around with a first-person perspective. Run forward and jump by pressing W and Space. Note how you step over the sidewalk, and up the steps to the monument. You can walk in the alleys between the houses, but the walls are solid. Don&#039;t walk over the edge of the world! <img src="/wiki/lib/images/smileys/icon_smile.gif" class="middle" alt=":-)" /></p></div><h2><a>Understanding the Code</a></h2><div><p>Let&#039;s start with the class declaration:</p><pre>public class HelloCollision extends SimpleApplication
implements ActionListener &#123; ... &#125;</pre><p>You already know that SimpleApplication is the base class for all jME3 games. You make this class implement the <code>ActionListener</code> interface because you want to customize the navigational inputs later.</p><pre> private Spatial sceneModel;
&#125;</pre>
<p>
Run the sample. You should see a town square with houses and a monument. Use the WASD keys and the mouse to navigate around with a first-person perspective. Run forward and jump by pressing W and Space. Note how you step over the sidewalk, and up the steps to the monument. You can walk in the alleys between the houses, but the walls are solid. Don&#039;t walk over the edge of the world! <img src="/wiki/lib/images/smileys/icon_smile.gif" class="middle" alt=":-)" />
</p>
</div>
<h2><a>Understanding the Code</a></h2>
<div>
<p>
Let&#039;s start with the class declaration:
</p>
<pre>public class HelloCollision extends SimpleApplication
implements ActionListener &#123; ... &#125;</pre>
<p>
You already know that SimpleApplication is the base class for all jME3 games. You make this class implement the <code>ActionListener</code> interface because you want to customize the navigational inputs later.
</p>
<pre> private Spatial sceneModel;
private BulletAppState bulletAppState;
private RigidBodyControl landscape;
private CharacterControl player;
private Vector3f walkDirection = new Vector3f&#40;&#41;;
private boolean left = false, right = false, up = false, down = false;</pre><p>You initialize a few private fields:</p><ul><li><div>The BulletAppState gives this SimpleApplication access to physics features (such as collision detection) supplied by jME3&#039;s jBullet integration</div></li><li><div>The Spatial sceneModel is for loading an OgreXML model of a town.</div></li><li><div>You need a RigidBodyControl to make the town model solid.</div></li><li><div>The (invisible) first-person player is represented by a CharacterControl object.</div></li><li><div>The fields <code>walkDirection</code> and the four Booleans are used for physics-controlled navigation.</div></li></ul><p>Let&#039;s have a look at all the details:</p></div><h2><a>Initializing the Game</a></h2><div><p>As usual, you initialize the game in the <code>simpleInitApp()</code> method.</p><pre> viewPort.setBackgroundColor&#40;new ColorRGBA&#40;0.7f,0.8f,1f,1f&#41;&#41;;
private boolean left = false, right = false, up = false, down = false;</pre>
<p>
You initialize a few private fields:
</p>
<ul>
<li><div> The BulletAppState gives this SimpleApplication access to physics features (such as collision detection) supplied by jME3&#039;s jBullet integration</div>
</li>
<li><div> The Spatial sceneModel is for loading an OgreXML model of a town.</div>
</li>
<li><div> You need a RigidBodyControl to make the town model solid.</div>
</li>
<li><div> The (invisible) first-person player is represented by a CharacterControl object.</div>
</li>
<li><div> The fields <code>walkDirection</code> and the four Booleans are used for physics-controlled navigation.</div>
</li>
</ul>
<p>
Let&#039;s have a look at all the details:
</p>
</div>
<h2><a>Initializing the Game</a></h2>
<div>
<p>
As usual, you initialize the game in the <code>simpleInitApp()</code> method.
</p>
<pre> viewPort.setBackgroundColor&#40;new ColorRGBA&#40;0.7f,0.8f,1f,1f&#41;&#41;;
flyCam.setMoveSpeed&#40;100&#41;;
setUpKeys&#40;&#41;;
setUpLight&#40;&#41;;</pre><ol><li><div> You set the background color to light blue, since this is a scene with a sky.</div>
setUpLight&#40;&#41;;</pre>
<ol>
<li><div> You set the background color to light blue, since this is a scene with a sky.</div>
</li>
<li><div> You repurpose the default camera control &quot;flyCam&quot; as first-person camera and set its speed.</div>
</li>

@ -1,4 +1,56 @@
<h1><a>JME 3 Tutorial (12) - Hello Effects</a></h1><div><p>Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_audio.html">Hello Audio</a>, Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_physics.html">Hello Physics</a></p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-effect-fire.png"></p><p>When you see one of the following in a game, then a particle system is likely behind it:</p><ul><li><div>Fire, flames, sparks;</div></li><li><div>Rain, snow, waterfalls, leaves;</div></li><li><div>Explosions, debris, shockwaves;</div></li><li><div>Dust, fog, clouds, smoke;</div></li><li><div>Insects swarms, meteor showers;</div></li><li><div>Magic spells.</div></li></ul><p>These scene elements cannot be modeled by meshes. In very simple terms:</p><ul><li><div>The difference between an explosion and a dust cloud is the speed of the particle effect.</div></li><li><div>The difference between flames and a waterfall is the direction and the color of the particle effect.</div></li></ul><p>Particle effects can be animated (e.g. sparks, drops) and static (strands of grass, hair). Non-particle effects include bloom/glow, and motion blur/afterimage. In this tutorial you learn how to make animated particles (com.jme3.effect).</p></div><h2><a>Sample Code</a></h2><div><pre>package jme3test.helloworld;
<h1><a>JME 3 Tutorial (12) - Hello Effects</a></h1>
<div>
<p>
Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_audio.html">Hello Audio</a>,
Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_physics.html">Hello Physics</a>
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-effect-fire.png">
</p>
<p>
When you see one of the following in a game, then a particle system is likely behind it:
</p>
<ul>
<li><div> Fire, flames, sparks;</div>
</li>
<li><div> Rain, snow, waterfalls, leaves;</div>
</li>
<li><div> Explosions, debris, shockwaves;</div>
</li>
<li><div> Dust, fog, clouds, smoke;</div>
</li>
<li><div> Insects swarms, meteor showers;</div>
</li>
<li><div> Magic spells.</div>
</li>
</ul>
<p>
These scene elements cannot be modeled by meshes. In very simple terms:
</p>
<ul>
<li><div> The difference between an explosion and a dust cloud is the speed of the particle effect. </div>
</li>
<li><div> The difference between flames and a waterfall is the direction and the color of the particle effect. </div>
</li>
</ul>
<p>
Particle effects can be animated (e.g. sparks, drops) and static (strands of grass, hair). Non-particle effects include bloom/glow, and motion blur/afterimage. In this tutorial you learn how to make animated particles (com.jme3.effect).
</p>
</div>
<h2><a>Sample Code</a></h2>
<div>
<pre>package jme3test.helloworld;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.effect.ParticleEmitter;
@ -56,7 +108,31 @@ public class HelloEffects extends SimpleApplication &#123;
rootNode.attachChild&#40;debris&#41;;
debris.emitAllParticles&#40;&#41;;
&#125;
&#125;</pre><p>You should see an explosion that sends debris flying, and a fire. <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.googlecode.com/svn/trunk/engine/src/test/jme3test/effect/"><param name="text" value="<html><u>More example code is here.</u></html>"><param name="textColor" value="blue"></object></p></div><h3><a>Texture Animation and Variation</a></h3><div><p><img src="/wiki/lib/exe/fetch.php"></p><p>Start by choosing a material texture for your effect. If you provide the emitter with a set of textures (see image), it can use them either for variation (random order), or as animation steps (fixed order).</p><p>Setting emitter textures works just as you have already learned in previous chapters. This time you base the material on the <code>Particle.j3md</code> material definition. Let&#039;s have a closer look at the material for the Debris effect.</p><pre> ParticleEmitter debris =
&#125;</pre>
<p>
You should see an explosion that sends debris flying, and a fire.
<object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://jmonkeyengine.googlecode.com/svn/trunk/engine/src/test/jme3test/effect/"><param name="text" value="<html><u>More example code is here.</u></html>"><param name="textColor" value="blue"></object>
</p>
</div>
<h3><a>Texture Animation and Variation</a></h3>
<div>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
<p>
Start by choosing a material texture for your effect. If you provide the emitter with a set of textures (see image), it can use them either for variation (random order), or as animation steps (fixed order).
</p>
<p>
Setting emitter textures works just as you have already learned in previous chapters. This time you base the material on the <code>Particle.j3md</code> material definition. Let&#039;s have a closer look at the material for the Debris effect.
</p>
<pre> ParticleEmitter debris =
new ParticleEmitter&#40;&quot;Debris&quot;, ParticleMesh.Type.Triangle, 10&#41;;
Material debris_mat = new Material&#40;assetManager,
&quot;Common/MatDefs/Misc/Particle.j3md&quot;&#41;;
@ -66,7 +142,73 @@ public class HelloEffects extends SimpleApplication &#123;
debris.setImagesX&#40;3&#41;;
debris.setImagesY&#40;3&#41;; // 3x3 texture animation
debris.setSelectRandomImage&#40;true&#41;;
...</pre><ol><li><div>Create a material and load the texture.</div></li><li><div>Tell the Emitter into how many animation steps (x*y) the texture is divided. <br/> The debris texture has 3x3 frames.</div></li><li><div>Optionally, tell the Emitter whether the animation steps are to be at random, or in order. <br/> For the debris, the frames play at random.</div></li></ol><p>As you see in the debris example, texture animations improve effects because each &quot;flame&quot; or &quot;piece of debris&quot; now looks different. Also think of electric or magic effects, where you can create very interesting animations by using an ordered morphing series of lightning bolts; or flying leaves or snow flakes, for instance.</p><p>The fire material is created the same way, just using &quot;Effects/Explosion/flame.png&quot; texture, which has with 2x2 ordered animation steps.</p></div><h3><a>Default Particle Textures</a></h3><div><p>The following particle textures included in <code>test-data.jar</code>. You can copy and use them in your own effects.</p><div><table><tr><th>Texture Path</th><th>Dimension</th><th>Preview</th></tr><tr><td>Effects/Explosion/Debris.png</td><td>3*3</td><td><img src="/wiki/lib/exe/fetch.php"></td></tr><tr><td>Effects/Explosion/flame.png</td><td>2*2</td><td><img src="/wiki/lib/exe/fetch.php"></td></tr><tr><td>Effects/Explosion/shockwave.png</td><td>1*1</td><td><img src="/wiki/lib/exe/fetch.php"></td></tr><tr><td>Effects/Explosion/smoketrail.png</td><td>1*3</td><td><img src="/wiki/lib/exe/fetch.php"></td></tr><tr><td>Effects/Smoke/Smoke.png</td><td>1*15</td><td><img src="/wiki/lib/exe/fetch.php"></td></tr></table></div><p>Copy them into you <code>assets/Effects</code> directory to use them.</p></div><h2><a>Creating Custom Textures</a></h2><div><p>For your game, you will likely create custom particle textures. Look at the fire example again.</p><pre> ParticleEmitter fire =
...</pre>
<ol>
<li><div> Create a material and load the texture.</div>
</li>
<li><div> Tell the Emitter into how many animation steps (x*y) the texture is divided. <br/>
The debris texture has 3x3 frames.</div>
</li>
<li><div> Optionally, tell the Emitter whether the animation steps are to be at random, or in order. <br/>
For the debris, the frames play at random.</div>
</li>
</ol>
<p>
As you see in the debris example, texture animations improve effects because each &quot;flame&quot; or &quot;piece of debris&quot; now looks different. Also think of electric or magic effects, where you can create very interesting animations by using an ordered morphing series of lightning bolts; or flying leaves or snow flakes, for instance.
</p>
<p>
The fire material is created the same way, just using &quot;Effects/Explosion/flame.png&quot; texture, which has with 2x2 ordered animation steps.
</p>
</div>
<h3><a>Default Particle Textures</a></h3>
<div>
<p>
The following particle textures included in <code>test-data.jar</code>. You can copy and use them in your own effects.
</p>
<div><table>
<tr>
<th> Texture Path </th><th> Dimension </th><th> Preview </th>
</tr>
<tr>
<td> Effects/Explosion/Debris.png </td><td> 3*3 </td><td> <img src="/wiki/lib/exe/fetch.php"> </td>
</tr>
<tr>
<td> Effects/Explosion/flame.png </td><td> 2*2 </td><td> <img src="/wiki/lib/exe/fetch.php"> </td>
</tr>
<tr>
<td> Effects/Explosion/shockwave.png </td><td> 1*1 </td><td> <img src="/wiki/lib/exe/fetch.php"> </td>
</tr>
<tr>
<td> Effects/Explosion/smoketrail.png </td><td> 1*3 </td><td> <img src="/wiki/lib/exe/fetch.php"> </td>
</tr>
<tr>
<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] -->
<p>
Copy them into you <code>assets/Effects</code> directory to use them.
</p>
</div>
<h2><a>Creating Custom Textures</a></h2>
<div>
<p>
For your game, you will likely create custom particle textures. Look at the fire example again.
</p>
<pre> ParticleEmitter fire =
new ParticleEmitter&#40;&quot;Emitter&quot;, ParticleMesh.Type.Triangle, 30&#41;;
Material mat_red = new Material&#40;assetManager,
&quot;Common/MatDefs/Misc/Particle.j3md&quot;&#41;;
@ -77,7 +219,10 @@ public class HelloEffects extends SimpleApplication &#123;
fire.setImagesY&#40;2&#41;; // 2x2 texture animation
fire.setEndColor&#40; new ColorRGBA&#40;1f, 0f, 0f, 1f&#41;&#41;; // red
fire.setStartColor&#40;new ColorRGBA&#40;1f, 1f, 0f, 0.5f&#41;&#41;; // yellow
&nbsp;</pre><p><img src="/wiki/lib/exe/fetch.php">
&nbsp;</pre>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
<p>

@ -1,4 +1,26 @@
<h1><a>JME 3 Tutorial (5) - Hello Input System</a></h1><div><p>Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html">Hello Update Loop</a>, Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_material.html">Hello Material</a></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?</p><p>Every game has its custom keybindings, and this tutorial explains how you define them. We first define the key presses and mouse events, and then we define the actions they should trigger.</p></div><h2><a>Sample Code</a></h2><div><pre>package jme3test.helloworld;
<h1><a>JME 3 Tutorial (5) - Hello Input System</a></h1>
<div>
<p>
Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html">Hello Update Loop</a>,
Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_material.html">Hello Material</a>
</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?
</p>
<p>
Every game has its custom keybindings, and this tutorial explains how you define them. We first define the key presses and mouse events, and then we define the actions they should trigger.
</p>
</div>
<h2><a>Sample Code</a></h2>
<div>
<pre>package jme3test.helloworld;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
@ -75,12 +97,73 @@ public class HelloInput extends SimpleApplication &#123;
&#125;
&#125;
&#125;;
&#125;</pre><p>Build and run the example.</p><ul><li><div>Press the Spacebar or click to rotate the cube.</div></li><li><div>Press the J and K keys to move the cube.</div></li><li><div>Press P to pause and unpause the game. While paused, the game should not respond to any input, other than <code>P</code>.</div></li></ul></div><h2><a>Defining Mappings and Triggers</a></h2><div><p>First you register each mapping name with its trigger(s). Remember the following:</p><ul><li><div>An input trigger can be a key press or mouse action. <br/> For example a mouse movement, a mouse click, or pressing the letter &quot;P&quot;.</div></li><li><div>The mapping name is a string that you can choose. <br/> The name should describe the action (e.g. &quot;Rotate&quot;), and not the trigger. Because the trigger can change.</div></li><li><div>One named mapping can have several triggers. <br/> For example, the &quot;Rotate&quot; action can be triggered by a click and by pressing the spacebar.</div></li></ul><p>Have a look at the code:</p><ol><li><div>You register the mapping named &quot;Rotate&quot; to the Spacebar key trigger. <br/> <code>new KeyTrigger(KeyInput.KEY_SPACE)</code>).</div></li><li><div>In the same line, you also register &quot;Rotate&quot; to an alternative mouse click trigger. <br/> <code>new MouseButtonTrigger(MouseInput.BUTTON_LEFT)</code></div></li><li><div>You map the <code>Pause</code>, <code>Left</code>, <code>Right</code> mappings to the P, J, K keys, respectively.</div></li></ol><pre> // You can map one or several inputs to one named action
&#125;</pre>
<p>
Build and run the example.
</p>
<ul>
<li><div> Press the Spacebar or click to rotate the cube. </div>
</li>
<li><div> Press the J and K keys to move the cube.</div>
</li>
<li><div> Press P to pause and unpause the game. While paused, the game should not respond to any input, other than <code>P</code>.</div>
</li>
</ul>
</div>
<h2><a>Defining Mappings and Triggers</a></h2>
<div>
<p>
First you register each mapping name with its trigger(s). Remember the following:
</p>
<ul>
<li><div> An input trigger can be a key press or mouse action. <br/>
For example a mouse movement, a mouse click, or pressing the letter &quot;P&quot;.</div>
</li>
<li><div> The mapping name is a string that you can choose. <br/>
The name should describe the action (e.g. &quot;Rotate&quot;), and not the trigger. Because the trigger can change.</div>
</li>
<li><div> One named mapping can have several triggers. <br/>
For example, the &quot;Rotate&quot; action can be triggered by a click and by pressing the spacebar.</div>
</li>
</ul>
<p>
Have a look at the code:
</p>
<ol>
<li><div> You register the mapping named &quot;Rotate&quot; to the Spacebar key trigger. <br/>
<code>new KeyTrigger(KeyInput.KEY_SPACE)</code>). </div>
</li>
<li><div> In the same line, you also register &quot;Rotate&quot; to an alternative mouse click trigger. <br/>
<code>new MouseButtonTrigger(MouseInput.BUTTON_LEFT)</code></div>
</li>
<li><div> You map the <code>Pause</code>, <code>Left</code>, <code>Right</code> mappings to the P, J, K keys, respectively. </div>
</li>
</ol>
<pre> // You can map one or several inputs to one named action
inputManager.addMapping&#40;&quot;Pause&quot;, new KeyTrigger&#40;KeyInput.KEY_P&#41;&#41;;
inputManager.addMapping&#40;&quot;Left&quot;, new KeyTrigger&#40;KeyInput.KEY_J&#41;&#41;;
inputManager.addMapping&#40;&quot;Right&quot;, new KeyTrigger&#40;KeyInput.KEY_K&#41;&#41;;
inputManager.addMapping&#40;&quot;Rotate&quot;, new KeyTrigger&#40;KeyInput.KEY_SPACE&#41;,
new MouseButtonTrigger&#40;MouseInput.BUTTON_LEFT&#41;&#41;;</pre><p>Now you need to register your trigger mappings.</p><ol><li><div>You register the pause action to the ActionListener, because it is an &quot;on/off&quot; action.</div></li><li><div>You register the movement actions to the AnalogListener, because they are gradual actions.</div></li></ol><pre> // Add the names to the action listener.
new MouseButtonTrigger&#40;MouseInput.BUTTON_LEFT&#41;&#41;;</pre>
<p>
Now you need to register your trigger mappings.
</p>
<ol>
<li><div> You register the pause action to the ActionListener, because it is an &quot;on/off&quot; action.</div>
</li>
<li><div> You register the movement actions to the AnalogListener, because they are gradual actions.</div>
</li>
</ol>
<pre> // Add the names to the action listener.
inputManager.addListener&#40;actionListener, new String&#91;&#93;&#123;&quot;Pause&quot;&#125;&#41;;
inputManager.addListener&#40;analogListener, new String&#91;&#93;&#123;&quot;Left&quot;, &quot;Right&quot;, &quot;Rotate&quot;&#125;&#41;;</pre>

@ -1,4 +1,22 @@
<h1><a>JME 3 Tutorial (4) - Hello Update Loop</a></h1><div><p>Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html">Hello Assets</a>, Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html">Hello Input System</a></p><p>Now that you know how to load assets, such as 3D models, you want to implement some gameplay that uses these assets. In this tutorial we look at the update loop. The update loop of your game is where the action happens.</p></div><h2><a>Code Sample</a></h2><div><pre>package jme3test.helloworld;
<h1><a>JME 3 Tutorial (4) - Hello Update Loop</a></h1>
<div>
<p>
Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html">Hello Assets</a>,
Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html">Hello Input System</a>
</p>
<p>
Now that you know how to load assets, such as 3D models, you want to implement some gameplay that uses these assets. In this tutorial we look at the update loop. The update loop of your game is where the action happens.
</p>
</div>
<h2><a>Code Sample</a></h2>
<div>
<pre>package jme3test.helloworld;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;

@ -1,4 +1,22 @@
<h1><a>JME 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><p>The term Material includes everything that influences what the surface of a 3D model looks like: The color, texture, shininess, and opacity/transparency. Plain coloring is covered in <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_node.html">Hello Node</a>. Loading models that come with materials is covered in <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html">Hello Asset</a>. In this tutorial you learn to create and use custom JME3 Material Definitions. <img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-materials.png"></p></div><h2><a>Sample Code</a></h2><div><pre>package jme3test.helloworld;
<h1><a>JME 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>
<p>
The term Material includes everything that influences what the surface of a 3D model looks like: The color, texture, shininess, and opacity/transparency. Plain coloring is covered in <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_node.html">Hello Node</a>. Loading models that come with materials is covered in <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html">Hello Asset</a>. In this tutorial you learn to create and use custom JME3 Material Definitions.
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/beginner/beginner-materials.png">
</p>
</div>
<h2><a>Sample Code</a></h2>
<div>
<pre>package jme3test.helloworld;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.light.DirectionalLight;

@ -1,4 +1,46 @@
<h1><a>JME 3 Tutorial (2) - Hello Node</a></h1><div><p>Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_simpleapplication.html">Hello SimpleApplication</a>, Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html">Hello Assets</a>.</p><p>In this tutorial we will have a look at the creation of a 3D scene.</p><ul><li><div>This tutorial assumes that you know what <a href="/com/jme3/gde/core/docs/jme3/the_scene_graph.html">the Scene Graph</a> is.</div></li><li><div>For a visual introduction, check out <a href="/com/jme3/gde/core/docs/jme3/scenegraph_for_dummies.html">Scene Graph for Dummies</a>.</div></li></ul><p>When creating a 3D game</p><ol><li><div>You create some scene objects like players, buildings, etc.</div></li><li><div>You add the objects to the scene.</div></li><li><div>You move, resize, rotate, color, and animate them.</div></li></ol><p>You will learn that the scene graph represents the 3D world, and why the rootNode is important. You will learn how to create simple objects, how to let them carry custom data (such as health points), and how to &quot;transform&quot; them by moving, scaling, and rotating. You will understand the difference between the two types of &quot;Spatials&quot; in the scene graph: Nodes and Geometries.</p></div><h2><a>Code Sample</a></h2><div><pre>package jme3test.helloworld;
<h1><a>JME 3 Tutorial (2) - Hello Node</a></h1>
<div>
<p>
Previous: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_simpleapplication.html">Hello SimpleApplication</a>,
Next: <a href="/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html">Hello Assets</a>.
</p>
<p>
In this tutorial we will have a look at the creation of a 3D scene.
</p>
<ul>
<li><div> This tutorial assumes that you know what <a href="/com/jme3/gde/core/docs/jme3/the_scene_graph.html">the Scene Graph</a> is.</div>
</li>
<li><div> For a visual introduction, check out <a href="/com/jme3/gde/core/docs/jme3/scenegraph_for_dummies.html">Scene Graph for Dummies</a>.</div>
</li>
</ul>
<p>
When creating a 3D game
</p>
<ol>
<li><div> You create some scene objects like players, buildings, etc. </div>
</li>
<li><div> You add the objects to the scene.</div>
</li>
<li><div> You move, resize, rotate, color, and animate them. </div>
</li>
</ol>
<p>
You will learn that the scene graph represents the 3D world, and why the rootNode is important. You will learn how to create simple objects, how to let them carry custom data (such as health points), and how to &quot;transform&quot; them by moving, scaling, and rotating. You will understand the difference between the two types of &quot;Spatials&quot; in the scene graph: Nodes and Geometries.
</p>
</div>
<h2><a>Code Sample</a></h2>
<div>
<pre>package jme3test.helloworld;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
@ -47,7 +89,51 @@ public class HelloNode extends SimpleApplication &#123;
/** Rotate the pivot node: Note that both boxes have rotated! */
pivot.rotate&#40;.4f,.4f,0f&#41;;
&#125;
&#125;</pre><p>Build and run the code sample. You should see two colored boxes tilted at the same angle.</p></div><h2><a>Understanding the Terminology</a></h2><div><p>In this tutorial, you learn some new terms:</p><div><table><tr><th>What you want to do</th><th>How you say it in JME3 terminology</th></tr><tr><td>Lay out the 3D scene</td><td>Populate the scene graph</td></tr><tr><td>Create scene objects</td><td>Create Spatials (e.g. create Geometries)</td></tr><tr><td>Make an object appear in the scene</td><td>Attach a Spatial to the rootNode</td></tr><tr><td>Make an object disappear from the scene</td><td>Detach the Spatial from the rootNode</td></tr><tr><td>Position/move, turn, or resize an object</td><td>Translate, rotate, scale an object. Transform an object.</td></tr></table></div><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.</p><ul><li><div>A Spatial contains the location, rotation, and scale of an object.</div></li><li><div> A Spatial can be loaded, transformed, and saved.</div>
&#125;</pre>
<p>
Build and run the code sample. You should see two colored boxes tilted at the same angle.
</p>
</div>
<h2><a>Understanding the Terminology</a></h2>
<div>
<p>
In this tutorial, you learn some new terms:
</p>
<div><table>
<tr>
<th>What you want to do</th><th>How you say it in JME3 terminology</th>
</tr>
<tr>
<td>Lay out the 3D scene</td><td>Populate the scene graph</td>
</tr>
<tr>
<td>Create scene objects</td><td>Create Spatials (e.g. create Geometries)</td>
</tr>
<tr>
<td>Make an object appear in the scene</td><td>Attach a Spatial to the rootNode</td>
</tr>
<tr>
<td>Make an object disappear from the scene</td><td>Detach the Spatial from the rootNode</td>
</tr>
<tr>
<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] -->
<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.
</p>
<ul>
<li><div> A Spatial contains the location, rotation, and scale of an object.</div>
</li>
<li><div> A Spatial can be loaded, transformed, and saved.</div>
</li>
<li><div> There are two types of Spatials: Nodes and Geometries.</div>
</li>

@ -1,2 +1,56 @@
<h1><a>Building jMonkeyEngine 3 from the Sources</a></h1><div><p>We recommend downloading the <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/downloads/list"><param name="text" value="<html><u>jMonkeyEngine SDK</u></html>"><param name="textColor" value="blue"></object> - but of course you can also build the jMonkeyEngine yourself from the sources. In this case, you need the <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://subversion.tigris.org"><param name="text" value="<html><u>Subversion</u></html>"><param name="textColor" value="blue"></object> file version system installed (svn).</p><ol><li><div><strong>Checkout:</strong> Checkout the Subversion repository.<pre>svn checkout http://jmonkeyengine.googlecode.com/svn/trunk/engine jme3</pre></div><ul><li><div>You can leave login and password empty</div></li></ul></li><li><div><strong>Build:</strong> Execute <code>ant jar</code></div><ul><li><div>This compiles the JAR files in <code>dist/libs/*</code></div></li></ul></li><li><div><strong>Javadoc:</strong> Execute <code>ant javadoc</code></div><ul><li><div>This generates javadocs in the <code>dist/javadoc</code> directory.</div></li></ul></li><li><div><strong>Run:</strong> Execute <code>ant run</code></div><ul><li><div>This runs the TestChooser where you can browse examples.</div></li></ul></li><li><div><strong>Use:</strong> Create a Java SE project and place all JARs from the <code>dist/lib</code> directory on the classpath.</div><ul><li><div>You can now extend your first game from <code>com.jme3.app.SimpleApplication</code>.</div></li></ul></li></ol><hr /><p>Learn more about:</p><ul><li><div><a href="/com/jme3/gde/core/docs/jme3/simpleapplication_from_the_commandline.html">Setting up JME3 on the commandline (generic)</a>.</div></li><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>
<h1><a>Building jMonkeyEngine 3 from the Sources</a></h1>
<div>
<p>
We recommend downloading the <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://code.google.com/p/jmonkeyengine/downloads/list"><param name="text" value="<html><u>jMonkeyEngine SDK</u></html>"><param name="textColor" value="blue"></object> - but of course you can also build the jMonkeyEngine yourself from the sources. In this case, you need the <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://subversion.tigris.org"><param name="text" value="<html><u>Subversion</u></html>"><param name="textColor" value="blue"></object> file version system installed (svn).
</p>
<ol>
<li><div> <strong>Checkout:</strong> Checkout the Subversion repository. <pre>svn checkout http://jmonkeyengine.googlecode.com/svn/trunk/engine jme3</pre>
</div>
<ul>
<li><div> You can leave login and password empty</div>
</li>
</ul>
</li>
<li><div> <strong>Build:</strong> Execute <code>ant jar</code></div>
<ul>
<li><div> This compiles the JAR files in <code>dist/libs/*</code></div>
</li>
</ul>
</li>
<li><div> <strong>Javadoc:</strong> Execute <code>ant javadoc</code> </div>
<ul>
<li><div> This generates javadocs in the <code>dist/javadoc</code> directory.</div>
</li>
</ul>
</li>
<li><div> <strong>Run:</strong> Execute <code>ant run</code></div>
<ul>
<li><div> This runs the TestChooser where you can browse examples.</div>
</li>
</ul>
</li>
<li><div> <strong>Use:</strong> Create a Java SE project and place all JARs from the <code>dist/lib</code> directory on the classpath.</div>
<ul>
<li><div> You can now extend your first game from <code>com.jme3.app.SimpleApplication</code>. </div>
</li>
</ul>
</li>
</ol>
<hr />
<p>
Learn more about:
</p>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/jme3/simpleapplication_from_the_commandline.html">Setting up JME3 on the commandline (generic)</a>.</div>
</li>
<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>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:build_from_sources?do=export_xhtmlbody">view online version</a></em></p>

File diff suppressed because one or more lines are too long

@ -1,4 +1,21 @@
<h1><a>jME3 Application Display Settings</a></h1><div><p>Every class that extends jme3.app.SimpleApplication has properties that can be configured by customizing a <code>com.jme3.system.AppSettings</code> object. Configure the settings before you call <code>app.start()</code> on the application object. If you change display settings during runtime, call <code>app.restart()</code> to make them take effect.</p><p><strong>Note:</strong> Other runtime settings are covered in <a href="/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html">SimpleApplication</a>.</p></div><h2><a>Code Sample</a></h2><div><pre>public static void main&#40;String&#91;&#93; args&#41; &#123;
<h1><a>jME3 Application Display Settings</a></h1>
<div>
<p>
Every class that extends jme3.app.SimpleApplication has properties that can be configured by customizing a <code>com.jme3.system.AppSettings</code> object. Configure the settings before you call <code>app.start()</code> on the application object. If you change display settings during runtime, call <code>app.restart()</code> to make them take effect.
</p>
<p>
<strong>Note:</strong> Other runtime settings are covered in <a href="/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html">SimpleApplication</a>.
</p>
</div>
<h2><a>Code Sample</a></h2>
<div>
<pre>public static void main&#40;String&#91;&#93; args&#41; &#123;
AppSettings settings = new AppSettings&#40;true&#41;;
settings.setResolution&#40;640,480&#41;;
... // other properties see below
@ -6,7 +23,86 @@
MyGame app = new MyGame&#40;&#41;; // or Main or whatever you called your SimpleApplication
app.setSettings&#40;settings&#41;;
app.start&#40;&#41;;
&#125;</pre><p>Set the boolean in the AppSettings contructor to true if you want to keep the default settings for everything that you do not specify. Set this parameter to false if you want to change some of the settings, but otherwise want the application to load user settings from previous launches.</p><p><p><div>Use <code>app.setShowSettings(true);</code> to present the user with a splashscreen and display settings dialog when starting the game, or <code>app.setShowSettings(false);</code> to hide the custom splashscreen. Set this boolean before calling <code>app.start()</code> on the SimpleApplication.</div></p></p></div><h2><a>Properties</a></h2><div><div><table><tr><th>Settings Property (Video)</th><th>Description</th><th>Default</th></tr><tr><td>setRenderer(AppSettings.LWJGL_OPENGL1) <br/> setRenderer(AppSettings.LWJGL_OPENGL2) <br/> setRenderer(AppSettings.LWJGL_OPENGL3)</td><td>Switch Video Renderer to OpenGL 1.1, OpenGL 2, or OpenGL 3.3. If your graphic card does not support all OpenGL2 features (<code>UnsupportedOperationException: GLSL and OpenGL2 is required for the LWJGL renderer</code>), then you can force your SimpleApplication to use OpenGL1 compatibility. (Then you still can&#039;t use special OpenGL2 features, but at least the error goes away and you can continue with the rest.)</td><td>OpenGL 2</td></tr><tr><td>setBitsPerPixel(32)</td><td>Set the color depth. <br/> 1 bpp = black and white, 2 bpp = gray, <br/> 4 bpp = 16 colors, 8 bpp = 256 colors, 24 or 32 bpp = &quot;truecolor&quot;.</td><td>24</td></tr><tr><td>setFramerate(60)</td><td>How often per second the engine should try to refresh the frame. For the release, usually 60 fps. Can be lower (30) if you need to free up the CPU for other applications. No use setting it to a higher value than the screen frequency! If the framerate goes below 30 fps, viewers start to notice choppiness or flickering.</td><td>-1 (unlimited)</td></tr><tr><td>setFullscreen(true)</td><td>Set this to true to make the game window fill the whole screen; you need to provide a key that calls app.stop() to exit the fullscreen view gracefully (default: escape). <br/> Set this to false to play the game in a normal window of its own.</td><td>False (windowed)</td></tr><tr><td>setHeight(480), setWidth(640) <br/> setResolution(640,480)</td><td>Two equivalent ways of setting the display resolution.</td><td>640x480 pixels</td></tr><tr><td>setSamples(4)</td><td>Set multisampling to 0 to switch antialiasing off (harder edges, faster.) <br/> Set multisampling to 2 or 4 to activate antialising (softer edges, may be slower.) <br/> Depending on your graphic card, you may be able to set multisampling to higher values such as 8, 16, or 32 samples.</td><td>0</td></tr><tr><td>setVSync(true) <br/> setFrequency(60)</td><td>Set vertical syncing to true to time the frame buffer to coincide with the refresh frequency of the screen. VSync prevents ugly page tearing artefacts, but is a bit slower; recommened for release build. <br/> Set VSync to false to deactivate vertical syncing (faster, but possible page tearing artifacts); can remain deactivated during development or for slower PCs.</td><td>false <br/> 60 fps</td></tr></table></div><div><table><tr><th>Settings Property (Input)</th><th>Description</th><th>Default</th></tr><tr><td>setUseInput(false)</td><td>Respond to user input by mouse and keyboard. Can be deactivated for use cases where you only display a 3D scene on the canvas without any interaction.</td><td>true</td></tr><tr><td>setUseJoysticks(true)</td><td>Activate optional joystick support</td><td>false</td></tr></table></div><div><table><tr><th>Settings Property (Audio)</th><th>Description</th><th>Default</th></tr><tr><td>setAudioRenderer(AppSettings.LWJGL_OPENAL)</td><td>Switch Audio Renderer. Currently there is only one option.</td><td>OpenAL</td></tr><tr><td>setStereo3D(true)</td><td>Enable 3D stereo. This feature requires hardware support from the GPU driver. See <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Quad_buffering"><param name="text" value="<html><u>Quad Buffering</u></html>"><param name="textColor" value="blue"></object>. Currently, your everday user&#039;s hardware does not support this, so you can ignore it for now.</td><td>false</td></tr></table></div><div><table><tr><th>Settings Property (Branding)</th><th>Description</th><th>Default</th></tr><tr><td>setTitle(&quot;My Game&quot;)</td><td>This string will be visible in the titlebar, unless the window is fullscreen.</td><td>&quot;jMonkey Engine 3.0&quot;</td>
&#125;</pre>
<p>
Set the boolean in the AppSettings contructor to true if you want to keep the default settings for everything that you do not specify. Set this parameter to false if you want to change some of the settings, but otherwise want the application to load user settings from previous launches.
</p>
<p>
<p><div>Use <code>app.setShowSettings(true);</code> to present the user with a splashscreen and display settings dialog when starting the game, or <code>app.setShowSettings(false);</code> to hide the custom splashscreen. Set this boolean before calling <code>app.start()</code> on the SimpleApplication.
</div></p>
</p>
</div>
<h2><a>Properties</a></h2>
<div>
<div><table>
<tr>
<th>Settings Property (Video)</th><th>Description</th><th>Default</th>
</tr>
<tr>
<td>setRenderer(AppSettings.LWJGL_OPENGL1) <br/>
setRenderer(AppSettings.LWJGL_OPENGL2) <br/>
setRenderer(AppSettings.LWJGL_OPENGL3)</td><td>Switch Video Renderer to OpenGL 1.1, OpenGL 2, or OpenGL 3.3. If your graphic card does not support all OpenGL2 features (<code>UnsupportedOperationException: GLSL and OpenGL2 is required for the LWJGL renderer</code>), then you can force your SimpleApplication to use OpenGL1 compatibility. (Then you still can&#039;t use special OpenGL2 features, but at least the error goes away and you can continue with the rest.) </td><td> OpenGL 2 </td>
</tr>
<tr>
<td>setBitsPerPixel(32)</td><td>Set the color depth. <br/>
1 bpp = black and white, 2 bpp = gray, <br/>
4 bpp = 16 colors, 8 bpp = 256 colors, 24 or 32 bpp = &quot;truecolor&quot;.</td><td>24</td>
</tr>
<tr>
<td>setFramerate(60)</td><td>How often per second the engine should try to refresh the frame. For the release, usually 60 fps. Can be lower (30) if you need to free up the CPU for other applications. No use setting it to a higher value than the screen frequency! If the framerate goes below 30 fps, viewers start to notice choppiness or flickering.</td><td>-1 (unlimited)</td>
</tr>
<tr>
<td>setFullscreen(true)</td><td>Set this to true to make the game window fill the whole screen; you need to provide a key that calls app.stop() to exit the fullscreen view gracefully (default: escape). <br/>
Set this to false to play the game in a normal window of its own.</td><td>False (windowed)</td>
</tr>
<tr>
<td>setHeight(480), setWidth(640) <br/>
setResolution(640,480)</td><td>Two equivalent ways of setting the display resolution.</td><td>640x480 pixels</td>
</tr>
<tr>
<td>setSamples(4)</td><td>Set multisampling to 0 to switch antialiasing off (harder edges, faster.) <br/>
Set multisampling to 2 or 4 to activate antialising (softer edges, may be slower.) <br/>
Depending on your graphic card, you may be able to set multisampling to higher values such as 8, 16, or 32 samples.</td><td>0</td>
</tr>
<tr>
<td>setVSync(true) <br/>
setFrequency(60)</td><td>Set vertical syncing to true to time the frame buffer to coincide with the refresh frequency of the screen. VSync prevents ugly page tearing artefacts, but is a bit slower; recommened for release build. <br/>
Set VSync to false to deactivate vertical syncing (faster, but possible page tearing artifacts); can remain deactivated during development or for slower PCs.</td><td>false <br/>
60 fps</td>
</tr>
</table></div>
<!-- EDIT1 TABLE [1406-3627] --><div><table>
<tr>
<th>Settings Property (Input)</th><th>Description</th><th>Default</th>
</tr>
<tr>
<td>setUseInput(false)</td><td>Respond to user input by mouse and keyboard. Can be deactivated for use cases where you only display a 3D scene on the canvas without any interaction.</td><td>true</td>
</tr>
<tr>
<td>setUseJoysticks(true)</td><td>Activate optional joystick support</td><td>false</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [3629-3918] --><div><table>
<tr>
<th>Settings Property (Audio)</th><th>Description</th><th>Default</th>
</tr>
<tr>
<td>setAudioRenderer(AppSettings.LWJGL_OPENAL)</td><td>Switch Audio Renderer. Currently there is only one option. </td><td>OpenAL</td>
</tr>
<tr>
<td>setStereo3D(true)</td><td>Enable 3D stereo. This feature requires hardware support from the GPU driver. See <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Quad_buffering"><param name="text" value="<html><u>Quad Buffering</u></html>"><param name="textColor" value="blue"></object>. Currently, your everday user&#039;s hardware does not support this, so you can ignore it for now.</td><td>false</td>
</tr>
</table></div>
<!-- EDIT3 TABLE [3920-4344] --><div><table>
<tr>
<th>Settings Property (Branding)</th><th>Description</th><th>Default</th>
</tr>
<tr>
<td>setTitle(&quot;My Game&quot;)</td><td>This string will be visible in the titlebar, unless the window is fullscreen.</td><td>&quot;jMonkey Engine 3.0&quot;</td>
</tr>
<tr>
<td>setIcons(new BufferedImage[]{ <br/>

@ -1,4 +1,48 @@
<h1><a>Best Practices For jME3 Developers</a></h1><div><p>A collection of recommendations and expert tips. Feel free to add your own! 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> Requirements Gathering</h2><div><p>As a quick overview, answer yourself the following questions:</p><ul><li><div>Motivation</div><ul><li><div>Sum up your game idea in one sentence. If you can&#039;t, it&#039;s too complicated.</div></li><li><div>Who&#039;s the target group? Why would they choose your game over the million others that exist?</div></li></ul></li><li><div>Game type</div><ul><li><div>Point of view (camera)? What character(s) does the player control (if any)?</div></li><li><div>Time- or turn-based?</div></li><li><div>Genre, setting, background story? (If applicable)</div></li></ul></li><li><div>Gameplay</div><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><li><div> How does the player interact? I.e. rules, challenges, game mechanics.</div>
<h1><a>Best Practices For jME3 Developers</a></h1>
<div>
<p>
A collection of recommendations and expert tips. Feel free to add your own!
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>
<div>
<p>
As a quick overview, answer yourself the following questions:
</p>
<ul>
<li><div> Motivation</div>
<ul>
<li><div> Sum up your game idea in one sentence. If you can&#039;t, it&#039;s too complicated.</div>
</li>
<li><div> Who&#039;s the target group? Why would they choose your game over the million others that exist?</div>
</li>
</ul>
</li>
<li><div> Game type</div>
<ul>
<li><div> Point of view (camera)? What character(s) does the player control (if any)?</div>
</li>
<li><div> Time- or turn-based?</div>
</li>
<li><div> Genre, setting, background story? (If applicable)</div>
</li>
</ul>
</li>
<li><div> Gameplay</div>
<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>
<li><div> How does the player interact? I.e. rules, challenges, game mechanics.</div>
</li>
<li><div> What state is considered winning, and what losing?</div>
</li>

@ -1,2 +1,78 @@
<h1><a>jMonkeyEngine3 Supported File Types</a></h1><div></div><h2><a>jMonkeyEngine3 File Formats</a></h2><div><div><table><tr><th>Suffix</th><th>Usage</th><th>Learn more</th></tr><tr><td>.j3o</td><td>Binary 3D model or scene. At the latest from the Beta release of your game on, you should convert all models to .j3o format. <br/> During alpha and earlier development phases (when models still change a lot) you can alternatively load OgreXML/OBJ models directly.</td><td><a href="/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html">Model Loader and Viewer</a></td></tr><tr><td>.j3m</td><td>A custom Material. You can create a .j3m file to store a Material configuration for a Geometry (e.g. 3D model).</td><td><a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a> <br/> <a href="/com/jme3/gde/core/docs/sdk/material_editing.html">Material Editing</a></td></tr><tr><td>.j3md</td><td>A Material definition. These are pre-defined templates for shader-based Materials. <br/> Each custom .j3m Material is based on a material definition. Advanced users can create their own material definitions.</td><td><a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a></td></tr><tr><td>.j3f</td><td>A custom post-processor filter configuration. You can create a .j3f file to store a FilterPostProcessor with a set of preconfigured filters.</td><td><a href="/com/jme3/gde/core/docs/sdk/filters.html">Filters</a> <br/> <a href="/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html">Effects Overview</a></td></tr></table></div></div><h2><a>Supported External File Types</a></h2><div><div><table><tr><th>File Suffix</th><th>Type</th><th>Description</th></tr><tr><td>.mesh.xml, .meshxml</td><td>3D model</td><td>Ogre Mesh <acronym title="Extensible Markup Language">XML</acronym></td></tr><tr><td>.scene</td><td>3D scene</td><td>Ogre DotScene</td></tr><tr><td>.OBJ, .MTL</td><td>3D model</td><td>Wavefront</td></tr><tr><td>.blend</td><td>3D model</td><td>Blender version 2.49 or 2.5x</td></tr><tr><td>.<acronym title="Joint Photographics Experts Group">JPG</acronym>, .<acronym title="Portable Network Graphics">PNG</acronym>, .<acronym title="Graphics Interchange Format">GIF</acronym></td><td>image</td><td>Textures, icons</td></tr><tr><td>.DDS</td><td>image</td><td>Direct Draw Surface texture</td></tr><tr><td>.HDR</td><td>image</td><td>High Dynamic Range texture</td></tr><tr><td>.TGA</td><td>image</td><td>Targa Image File texture</td></tr><tr><td>.PFM</td><td>image</td><td>Portable Float Map texture</td></tr><tr><td>.fnt</td><td>bitmap font</td><td>AngelCode font for <acronym title="Graphical User Interface">GUI</acronym> and HUD</td></tr><tr><td>.WAV</td><td>audio</td><td>Wave music and sounds</td></tr><tr><td>.OGG</td><td>audio</td><td>OGG Vorbis music and sounds</td></tr></table></div></div>
<h1><a>jMonkeyEngine3 Supported File Types</a></h1>
<div>
</div>
<h2><a>jMonkeyEngine3 File Formats</a></h2>
<div>
<div><table>
<tr>
<th>Suffix</th><th>Usage</th><th>Learn more</th>
</tr>
<tr>
<td>.j3o</td><td>Binary 3D model or scene. At the latest from the Beta release of your game on, you should convert all models to .j3o format. <br/>
During alpha and earlier development phases (when models still change a lot) you can alternatively load OgreXML/OBJ models directly.</td><td><a href="/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html">Model Loader and Viewer</a> </td>
</tr>
<tr>
<td>.j3m</td><td>A custom Material. You can create a .j3m file to store a Material configuration for a Geometry (e.g. 3D model).</td><td><a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a> <br/>
<a href="/com/jme3/gde/core/docs/sdk/material_editing.html">Material Editing</a> </td>
</tr>
<tr>
<td>.j3md</td><td>A Material definition. These are pre-defined templates for shader-based Materials. <br/>
Each custom .j3m Material is based on a material definition. Advanced users can create their own material definitions. </td><td> <a href="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a> </td>
</tr>
<tr>
<td>.j3f</td><td>A custom post-processor filter configuration. You can create a .j3f file to store a FilterPostProcessor with a set of preconfigured filters. </td><td> <a href="/com/jme3/gde/core/docs/sdk/filters.html">Filters</a> <br/>
<a href="/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html">Effects Overview</a> </td>
</tr>
</table></div>
<!-- EDIT1 TABLE [93-1068] -->
</div>
<h2><a>Supported External File Types</a></h2>
<div>
<div><table>
<tr>
<th>File Suffix</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>.mesh.xml, .meshxml</td><td>3D model</td><td>Ogre Mesh <acronym title="Extensible Markup Language">XML</acronym> </td>
</tr>
<tr>
<td>.scene</td><td>3D scene</td><td>Ogre DotScene </td>
</tr>
<tr>
<td>.OBJ, .MTL</td><td>3D model</td><td>Wavefront</td>
</tr>
<tr>
<td>.blend</td><td>3D model</td><td>Blender version 2.49 or 2.5x</td>
</tr>
<tr>
<td>.<acronym title="Joint Photographics Experts Group">JPG</acronym>, .<acronym title="Portable Network Graphics">PNG</acronym>, .<acronym title="Graphics Interchange Format">GIF</acronym></td><td>image</td><td>Textures, icons</td>
</tr>
<tr>
<td>.DDS</td><td>image</td><td>Direct Draw Surface texture</td>
</tr>
<tr>
<td>.HDR</td><td>image</td><td>High Dynamic Range texture</td>
</tr>
<tr>
<td>.TGA</td><td>image</td><td>Targa Image File texture</td>
</tr>
<tr>
<td>.PFM</td><td>image</td><td>Portable Float Map texture</td>
</tr>
<tr>
<td>.fnt</td><td>bitmap font</td><td>AngelCode font for <acronym title="Graphical User Interface">GUI</acronym> and HUD</td>
</tr>
<tr>
<td>.WAV</td><td>audio</td><td>Wave music and sounds</td>
</tr>
<tr>
<td>.OGG</td><td>audio</td><td>OGG Vorbis music and sounds</td>
</tr>
</table></div>
<!-- EDIT2 TABLE [1113-1628] -->
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:intermediate:file_types?do=export_xhtmlbody">view online version</a></em></p>

File diff suppressed because one or more lines are too long

@ -1,4 +1,47 @@
<h1><a>Optimization reference</a></h1><div><p>This page is intended as a reference collection of optimization tricks that can be used to speed up JME3 applications.</p></div><h2><a>Maintain low Geometry count</a></h2><div><p>The more Geometry objects are added to the scene, the harder it gets to handle them in a speedy fashion. The reason for this is, that for every object a render command must be done, here is a bottleneck between the CPU and the graphics card.</p><p><strong>Possible optimization techniques</strong></p><ul><li><div>Use GeometryBatchFactory.optimize(node) to merge the meshes of the geometries contained in the given node into fewer batches (based on common Material used). You can do this using the SceneComposer in the <acronym title="Software Development Kit">SDK</acronym> as well, just right-click a node and select &quot;Optimize Geometry&quot;</div></li></ul><p><strong>Side-effects</strong></p><ul><li><div>Using GeometryBatchFactory merges individual Geometries into a single mesh. Thereby it becomes hard to apply specific Materials or to remove a single Geometry. Therefore it should be used for static Geometry only that does not require frequent changes or individual materials/texturing.</div></li><li><div>Using Texture atlases might be a way to provide a limited individual texturing.</div></li></ul></div><h2><a>Avoid creating new objects</a></h2><div><p>When you use math operations like vectorA.mult(vectorB); new objects are created that have to be garbage collected when you don&#039;t use them anymore. Check your math operations for opportunities to use the local version of the math operations, e.g. vectorA.multLocal(vectorB). This way the result is stored in vectorA and no new object needs to be created.
<h1><a>Optimization reference</a></h1>
<div>
<p>
This page is intended as a reference collection of optimization tricks that can be used to speed up JME3 applications.
</p>
</div>
<h2><a>Maintain low Geometry count</a></h2>
<div>
<p>
The more Geometry objects are added to the scene, the harder it gets to handle them in a speedy fashion.
The reason for this is, that for every object a render command must be done, here is a bottleneck between the CPU and the graphics card.
</p>
<p>
<strong>Possible optimization techniques</strong>
</p>
<ul>
<li><div> Use GeometryBatchFactory.optimize(node) to merge the meshes of the geometries contained in the given node into fewer batches (based on common Material used). You can do this using the SceneComposer in the <acronym title="Software Development Kit">SDK</acronym> as well, just right-click a node and select &quot;Optimize Geometry&quot;</div>
</li>
</ul>
<p>
<strong>Side-effects</strong>
</p>
<ul>
<li><div> Using GeometryBatchFactory merges individual Geometries into a single mesh. Thereby it becomes hard to apply specific Materials or to remove a single Geometry. Therefore it should be used for static Geometry only that does not require frequent changes or individual materials/texturing.</div>
</li>
<li><div>Using Texture atlases might be a way to provide a limited individual texturing.</div>
</li>
</ul>
</div>
<h2><a>Avoid creating new objects</a></h2>
<div>
<p>
When you use math operations like vectorA.mult(vectorB); new objects are created that have to be garbage collected when you don&#039;t use them anymore. Check your math operations for opportunities to use the local version of the math operations, e.g. vectorA.multLocal(vectorB). This way the result is stored in vectorA and no new object needs to be created.
</p>

@ -1,4 +1,20 @@
<h1><a>SimpleApplication and Application</a></h1><div><p>The base class of the jMonkeyEngine3 is <code>com.jme3.app.SimpleApplication</code>. Your first game&#039;s Main class extends SimpleApplication directly. When you feel confident you understand the features, you will typically extend SimpleApplication to create a custom base class for the type of games that you want to develop.</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.</p><p>The following code sample shows the typical base structure of a jME3 game:</p><pre>import com.jme3.app.SimpleApplication;
<h1><a>SimpleApplication and Application</a></h1>
<div>
<p>
The base class of the jMonkeyEngine3 is <code>com.jme3.app.SimpleApplication</code>. Your first game&#039;s Main class extends SimpleApplication directly. When you feel confident you understand the features, you will typically extend SimpleApplication to create a custom base class for the type of games that you want to develop.
</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.
</p>
<p>
The following code sample shows the typical base structure of a jME3 game:
</p>
<pre>import com.jme3.app.SimpleApplication;
&nbsp;
public class MyBaseGame extends SimpleApplication &#123;
&nbsp;
@ -21,7 +37,29 @@ public class MyBaseGame extends SimpleApplication &#123;
public void simpleRender&#40;RenderManager rm&#41; &#123;
/* (optional) Make advanced modifications to frameBuffer and scene graph. */
&#125;
&#125;</pre><p>Let&#039;s have a look at the <acronym title="Application Programming Interface">API</acronym> of the base class.</p></div><h2><a>Application Class</a></h2><div><p>Internally, com.jme3.app.SimpleApplication extends com.jme3.app.Application. The Application class represents a generic real-time 3D rendering jME3 application (i.e., not necessarily a game). Typically, you do not extend com.jme3.app.Application directly to create a game.</p><div><table><tr><th>Application class fields</th><th>Purpose</th></tr><tr><td>viewPort <br/> getViewPort()</td><td>The view object for the default camera. You can register advanced <a href="/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html">post-processor filters</a> here.</td>
&#125;</pre>
<p>
Let&#039;s have a look at the <acronym title="Application Programming Interface">API</acronym> of the base class.
</p>
</div>
<h2><a>Application Class</a></h2>
<div>
<p>
Internally, com.jme3.app.SimpleApplication extends com.jme3.app.Application. The Application class represents a generic real-time 3D rendering jME3 application (i.e., not necessarily a game). Typically, you do not extend com.jme3.app.Application directly to create a game.
</p>
<div><table>
<tr>
<th>Application class fields</th><th>Purpose</th>
</tr>
<tr>
<td>viewPort <br/>
getViewPort()</td><td>The view object for the default camera. You can register advanced <a href="/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html">post-processor filters</a> here.</td>
</tr>
<tr>
<td>settings <br/>

@ -1,5 +1,148 @@
<h1><a>Introduction to Mathematical Functionality</a></h1><div><p>It&#039;s a fact of life, math is hard. Unfortunately, 3D graphics require a fair bit of knowledge about the subject. Fortunately, jME is able to hide the majority of the details away from the user. Vectors are the fundamental type in the 3D environment, and it is used extensively. Matrices are also a basic necessity of 3D for representing linear systems. Quaternions are perhaps the most complicated of the basic types and are used for rotation in jME.</p><p>I&#039;ll discuss how these are used in the system for the core functionality. Including Transforming, Visibility Determination, Collision Detection, and the Coordinate System. Note, that these are low level details. Further chapters will discuss how to use these various systems from a high level perspective.</p><p>To get a visual introduction to math in jME3 for the absolute beginner, check out our <a href="/com/jme3/gde/core/docs/jme3/math_for_dummies.html">Math for Dummies</a> introduction class.</p></div><h2><a>Coordinate System</a></h2><div></div><h3><a>Definition</a></h3><div><p>A <em>coordinate system</em> consists of an origin (single point in space) and three coordinate axes that are each unit length and mutually perpendicular. The axes can be written as the column of a Matrix, R = [U1|U2|U3]. In fact, this is exactly how CameraNode works. The coordinate system defined by Camera is stored in a Matrix.</p><p>jME uses a Right-Handed coordinate system (as OpenGL does).</p><p>The definition of a coordinate system is defined in jME by the properties sent to Camera. There are no error checks to insure that: 1) the coordinate system is right-handed and 2) The axes are mutually perpendicular. Therefore, if the user sets the axes incorrectly, they are going to experience very odd rendering artifacts (random culling, etc).</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/intermediate/coordinate-system.png"></p></div><h2><a>Transformations</a></h2><div><p>Transformations define an operation that converts points from one coordinate system to another. This includes translation, rotation and scaling. In jME, local transforms are used to represent the positioning of objects relative to a parent coordinate system. While, world transforms are used to represent the positioning of objects in a global coordinate system.</p></div><h2><a>Visibility Determination</a></h2><div><p>Visibility Determination concerns itself with minimizing the amount of data that is sent to the graphics card for rendering. Specifically, we do not want to send data that will not be seen. Data not sent to the graphics card is said to be culled. The primary focus of this section is Frustum Culling based on the Camera&#039;s view frustum. In essence, this frustum creates six standard view planes. The BoundingVolume of an object is tested against the frustum planes to determine if it is contained in the frustum. If at any point the object&#039;s bounding is outside of the plane, it is tossed out and no longer processed for rendering. This also includes any children that it managed, allowing fast culling of large sections of the scene.</p></div><h1><a>Fundamental Types</a></h1><div></div><h2><a>ColorRGBA</a></h2><div></div><h3><a>Definition</a></h3><div><p>ColorRGBA defines a color value in the jME library. The color value is made of three components, red, green and blue. A fourth component defines the alpha value (transparent) of the color. Every value is set between [0, 1]. Anything less than 0 will be clamped to 0 and anything greater than 1 will be clamped to 1.</p><p><strong>Note:</strong> If you would like to &quot;convert&quot; an ordinary RGB value (0-255) to the format used here (0-1), simply multiply it with: 1/255.</p></div><h3><a>jME Class</a></h3><div><p>ColorRGBA defines a few static color values for ease of use. That is, rather than:</p><pre>ColorRGBA red = new ColorRGBA&#40;1,0,0,1&#41;;
object.setSomeColor&#40;red&#41;;</pre><p>you can simply say:</p><pre>object.setSomeColor&#40;ColorRGBA.red&#41;</pre><p>ColorRGBA will also handle interpolation between two colors. Given a second color and a value between 0 and 1, a the owning ColorRGBA object will have its color values altered to this new interpolated color.</p></div><h2><a>Matrix</a></h2><div><p>See <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/doc/com/jme/math/Matrix3f.html"><param name="text" value="<html><u>Javadoc of Matrix3f</u></html>"><param name="textColor" value="blue"></object><br/> and <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/doc/com/jme/math/Matrix4f.html"><param name="text" value="<html><u>Javadoc of Matrix4f</u></html>"><param name="textColor" value="blue"></object></p></div><h3><a>Definition</a></h3><div><p>A Matrix is typically used as a <em>linear transformation</em> to map vectors to vectors. That is: Y = MX where X is a Vector and M is a Matrix applying any or all transformations (scale, rotate, translate).</p><p>There are a few special matrices:</p><p><em>zero matrix</em> is the Matrix with all zero entries.</p><div><table><tr><td>0</td><td>0</td><td>0</td></tr><tr><td>0</td><td>0</td><td>0</td>
<h1><a>Introduction to Mathematical Functionality</a></h1>
<div>
<p>
It&#039;s a fact of life, math is hard. Unfortunately, 3D graphics require a fair bit of knowledge about the subject. Fortunately, jME is able to hide the majority of the details away from the user. Vectors are the fundamental type in the 3D environment, and it is used extensively. Matrices are also a basic necessity of 3D for representing linear systems. Quaternions are perhaps the most complicated of the basic types and are used for rotation in jME.
</p>
<p>
I&#039;ll discuss how these are used in the system for the core functionality. Including Transforming, Visibility Determination, Collision Detection, and the Coordinate System. Note, that these are low level details. Further chapters will discuss how to use these various systems from a high level perspective.
</p>
<p>
To get a visual introduction to math in jME3 for the absolute beginner, check out our <a href="/com/jme3/gde/core/docs/jme3/math_for_dummies.html">Math for Dummies</a> introduction class.
</p>
</div>
<h2><a>Coordinate System</a></h2>
<div>
</div>
<h3><a>Definition</a></h3>
<div>
<p>
A <em>coordinate system</em> consists of an origin (single point in space) and three coordinate axes that are each unit length and mutually perpendicular. The axes can be written as the column of a Matrix, R = [U1|U2|U3]. In fact, this is exactly how CameraNode works. The coordinate system defined by Camera is stored in a Matrix.
</p>
<p>
jME uses a Right-Handed coordinate system (as OpenGL does).
</p>
<p>
The definition of a coordinate system is defined in jME by the properties sent to Camera. There are no error checks to insure that: 1) the coordinate system is right-handed and 2) The axes are mutually perpendicular. Therefore, if the user sets the axes incorrectly, they are going to experience very odd rendering artifacts (random culling, etc).
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/intermediate/coordinate-system.png">
</p>
</div>
<h2><a>Transformations</a></h2>
<div>
<p>
Transformations define an operation that converts points from one coordinate system to another. This includes translation, rotation and scaling. In jME, local transforms are used to represent the positioning of objects relative to a parent coordinate system. While, world transforms are used to represent the positioning of objects in a global coordinate system.
</p>
</div>
<h2><a>Visibility Determination</a></h2>
<div>
<p>
Visibility Determination concerns itself with minimizing the amount of data that is sent to the graphics card for rendering. Specifically, we do not want to send data that will not be seen. Data not sent to the graphics card is said to be culled. The primary focus of this section is Frustum Culling based on the Camera&#039;s view frustum. In essence, this frustum creates six standard view planes. The BoundingVolume of an object is tested against the frustum planes to determine if it is contained in the frustum. If at any point the object&#039;s bounding is outside of the plane, it is tossed out and no longer processed for rendering. This also includes any children that it managed, allowing fast culling of large sections of the scene.
</p>
</div>
<h1><a>Fundamental Types</a></h1>
<div>
</div>
<h2><a>ColorRGBA</a></h2>
<div>
</div>
<h3><a>Definition</a></h3>
<div>
<p>
ColorRGBA defines a color value in the jME library. The color value is made of three components, red, green and blue. A fourth component defines the alpha value (transparent) of the color. Every value is set between [0, 1]. Anything less than 0 will be clamped to 0 and anything greater than 1 will be clamped to 1.
</p>
<p>
<strong>Note:</strong> If you would like to &quot;convert&quot; an ordinary RGB value (0-255) to the format used here (0-1), simply multiply it with: 1/255.
</p>
</div>
<h3><a>jME Class</a></h3>
<div>
<p>
ColorRGBA defines a few static color values for ease of use. That is, rather than:
</p>
<pre>ColorRGBA red = new ColorRGBA&#40;1,0,0,1&#41;;
object.setSomeColor&#40;red&#41;;</pre>
<p>
you can simply say:
</p>
<pre>object.setSomeColor&#40;ColorRGBA.red&#41;</pre>
<p>
ColorRGBA will also handle interpolation between two colors. Given a second color and a value between 0 and 1, a the owning ColorRGBA object will have its color values altered to this new interpolated color.
</p>
</div>
<h2><a>Matrix</a></h2>
<div>
<p>
See <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/doc/com/jme/math/Matrix3f.html"><param name="text" value="<html><u>Javadoc of Matrix3f</u></html>"><param name="textColor" value="blue"></object><br/>
and <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/doc/com/jme/math/Matrix4f.html"><param name="text" value="<html><u>Javadoc of Matrix4f</u></html>"><param name="textColor" value="blue"></object>
</p>
</div>
<h3><a>Definition</a></h3>
<div>
<p>
A Matrix is typically used as a <em>linear transformation</em> to map vectors to vectors. That is: Y = MX where X is a Vector and M is a Matrix applying any or all transformations (scale, rotate, translate).
</p>
<p>
There are a few special matrices:
</p>
<p>
<em>zero matrix</em> is the Matrix with all zero entries.
</p>
<div><table>
<tr>
<td>0</td><td>0</td><td>0</td>
</tr>
<tr>
<td>0</td><td>0</td><td>0</td>
</tr>
<tr>
<td>0</td><td>0</td><td>0</td>

@ -1,4 +1,21 @@
<h1><a>Starting a JME3 application from the Commandline</a></h1><div><p>Although we recommend the jMonkeyEngine <a href="/com/jme3/gde/core/docs/sdk.html">SDK</a> for developing JME3 games, you can use any IDE (integrated development environment) such as <a href="/com/jme3/gde/core/docs/jme3/setting_up_netbeans_and_jme3.html">NetBeans</a> or <a href="/com/jme3/gde/core/docs/jme3/setting_up_jme3_in_eclipse.html">Eclipse</a>, and even work freely from the commandline. Here is a generic IDE-independent &quot;getting started&quot; tutorial.</p><p>This example shows how to set up and run a simple application (HelloJME3) that depends on the jMonkeyEngine3 libraries.</p><p>The directory structure will look as follows:</p><pre>jme3/
<h1><a>Starting a JME3 application from the Commandline</a></h1>
<div>
<p>
Although we recommend the jMonkeyEngine <a href="/com/jme3/gde/core/docs/sdk.html">SDK</a> for developing JME3 games, you can use any IDE (integrated development environment) such as <a href="/com/jme3/gde/core/docs/jme3/setting_up_netbeans_and_jme3.html">NetBeans</a> or <a href="/com/jme3/gde/core/docs/jme3/setting_up_jme3_in_eclipse.html">Eclipse</a>, and even work freely from the commandline. Here is a generic IDE-independent &quot;getting started&quot; tutorial.
</p>
<p>
This example shows how to set up and run a simple application (HelloJME3) that depends on the jMonkeyEngine3 libraries.
</p>
<p>
The directory structure will look as follows:
</p>
<pre>jme3/
jme3/lib
jme3/src
...
@ -6,18 +23,76 @@ HelloJME3/
HelloJME3/lib
HelloJME3/assets
HelloJME3/src
...</pre></div><h2><a>Installing the JME3 Framework</a></h2><div><p>To install the development version of jme3, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/nightly/"><param name="text" value="<html><u>download the nightly build</u></html>"><param name="textColor" value="blue"></object>, unzip the folder into a directory named <code>jme3</code>. The filenames here are just an example, but they will always be something like <code>jME3_xx-xx-2011</code>.</p><pre>mkdir jme3
...</pre>
</div>
<h2><a>Installing the JME3 Framework</a></h2>
<div>
<p>
To install the development version of jme3, <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://www.jmonkeyengine.com/nightly/"><param name="text" value="<html><u>download the nightly build</u></html>"><param name="textColor" value="blue"></object>, unzip the folder into a directory named <code>jme3</code>. The filenames here are just an example, but they will always be something like <code>jME3_xx-xx-2011</code>.
</p>
<pre>mkdir jme3
cd jme3
unzip jME3_01-18-2011.zip</pre><p>Alternatively, you can build JME3 from the sources. (Recommended for JME3 developers.)</p><pre>svn checkout https://jmonkeyengine.googlecode.com/svn/trunk/engine jme3
unzip jME3_01-18-2011.zip</pre>
<p>
Alternatively, you can build JME3 from the sources. (Recommended for JME3 developers.)
</p>
<pre>svn checkout https://jmonkeyengine.googlecode.com/svn/trunk/engine jme3
cd jme3
ant run
cd ..</pre><p>If you see a Test Chooser open now, the build was successful. <strong>Tip:</strong> Use <code>ant</code> to build the libraries without running the demos.</p></div><h2><a>Sample Project Directory Structure</a></h2><div><p>First we set up the directory and source package structure for your game project. Note that the game project directory <code>HelloJME3</code> is on the same level as your <code>jme3</code> checkout. In this example, we create a Java package that we call <code>hello</code> in the source directory.</p><pre>mkdir HelloJME3
cd ..</pre>
<p>
If you see a Test Chooser open now, the build was successful. <strong>Tip:</strong> Use <code>ant</code> to build the libraries without running the demos.
</p>
</div>
<h2><a>Sample Project Directory Structure</a></h2>
<div>
<p>
First we set up the directory and source package structure for your game project. Note that the game project directory <code>HelloJME3</code> is on the same level as your <code>jme3</code> checkout. In this example, we create a Java package that we call <code>hello</code> in the source directory.
</p>
<pre>mkdir HelloJME3
mkdir HelloJME3/src
mkdir HelloJME3/src/hello</pre></div><h2><a>Libraries</a></h2><div><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.</p><pre>mkdir HelloJME3/build
mkdir HelloJME3/src/hello</pre>
</div>
<h2><a>Libraries</a></h2>
<div>
<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.
</p>
<pre>mkdir HelloJME3/build
mkdir HelloJME3/lib
cp jme3/lib/*.* HelloJME3/lib</pre><p>If you have built JME3 from the sources, then the copy paths are different:</p><pre>mkdir HelloJME3/build
cp jme3/lib/*.* HelloJME3/lib</pre>
<p>
If you have built JME3 from the sources, then the copy paths are different:
</p>
<pre>mkdir HelloJME3/build
mkdir HelloJME3/lib
cp jme3/dist/*.* HelloJME3/lib</pre></div><h3><a>Sample Code</a></h3><div><p>To test your setup, create the file <code>HelloJME3/src/hello/HelloJME3.java</code> with any text editor, paste the following sample code, and save.</p><pre>package hello;
cp jme3/dist/*.* HelloJME3/lib</pre>
</div>
<h3><a>Sample Code</a></h3>
<div>
<p>
To test your setup, create the file <code>HelloJME3/src/hello/HelloJME3.java</code> with any text editor, paste the following sample code, and save.
</p>
<pre>package hello;
&nbsp;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;

@ -1,4 +1,118 @@
<h1><a>3D Game Development Terminology</a></h1><div><p>Before you start, make certain you are familiar with the following concepts and terminology.</p></div><h1><a>3D Graphics and Audio</a></h1><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><li><div>Java OpenGL (JOGL)</div></li></ol><p><strong>OpenAL</strong> is the Open Audio Library, a platform-independent 3D audio <acronym title="Application Programming Interface">API</acronym>.</p></div><h1><a>Context, Display, Renderer</a></h1><div><p>The <strong>jME Context</strong> makes settings, renderer, timer, input and event listeners, display system, accessible to a JME game.</p><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><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></ul></li></ul></div><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>
<h1><a>3D Game Development Terminology</a></h1>
<div>
<p>
Before you start, make certain you are familiar with the following concepts and terminology.
</p>
</div>
<h1><a>3D Graphics and Audio</a></h1>
<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>
<li><div> Java OpenGL (JOGL)</div>
</li>
</ol>
<p>
<strong>OpenAL</strong> is the Open Audio Library, a platform-independent 3D audio <acronym title="Application Programming Interface">API</acronym>.
</p>
</div>
<h1><a>Context, Display, Renderer</a></h1>
<div>
<p>
The <strong>jME Context</strong> makes settings, renderer, timer, input and event listeners, display system, accessible to a JME game.
</p>
<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>
<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>
</ul>
</li>
</ul>
</div>
<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>

@ -1,4 +1,100 @@
<h1><a>The Scene Graph and Other jME3 Terminology</a></h1><div><p>Before you start making games, make sure you understand general <a href="/com/jme3/gde/core/docs/jme3/terminology.html">3D Gaming terminology</a>.</p><p>Second, if you are a beginner, we recommend our <a href="/com/jme3/gde/core/docs/jme3/scenegraph_for_dummies.html">Scene Graph for Dummies</a> presentation for a visual introduction to the concept of a scene graph.</p><p>Then continue learning about jME3 concepts here.</p></div><h2><a>Coordinate System</a></h2><div><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/intermediate/coordinate-system.png"></p><p>The jMonkeyEngine uses a right-handed coordinate system, just as OpenGL does.</p><p>The coordinate system consists of:</p><ul><li><div>The origin, a single point in space.</div><ul><li><div>This point is always at coordinate (0,0,0)</div></li></ul></li><li><div>Three coordinate axes that are mutually perpendicular, and meet in the origin.</div><ul><li><div>The X axis is &quot;right/left&quot;</div></li><li><div>The Y axis is &quot;up/down&quot;</div></li><li><div>The Z axis is &quot;towards you/away from you&quot;</div></li></ul></li></ul><p>Every point in 3D space is defined by its (x,y,z) coordinates. The data type for vectors is com.jme3.math.Vector3f.</p><p>For your orientation, the default camera&#039;s location is (0.0f,0.0f,10.0f), and it is looking in the direction described by the unit vector (0.0f, 0.0f, -1.0f). This means your point of view is on the positive side of the Z axis, looking towards the origin, down the Z axis.</p><p>The unit of meassurement is <code>world unit</code> (wu). Typically, 1 wu is considered to be one meter. All scales, vectors and points are relative to this coordinate system.</p></div><h2><a>Scene Graph and RootNode</a></h2><div><p>The scene graph represents your 3D world. Objects in the jME3 scene graph are called <a href="/com/jme3/gde/core/docs/jme3/advanced/spatial.html">Spatial</a>s. Everything attached to the <em>rootNode</em> is part of the scene graph. <em>Attaching</em> a Spatial to the rootNode (or other nodes) adds the Spatial to the scene; <em>detaching</em> removes it.</p><p><img src="nbdocs:/com/jme3/gde/core/docs/jme3/intermediate/scene-graph.png"></p></div><h2><a>Spatials: Node vs Geometry</a></h2><div><p>A Spatial can be transformed, loaded and saved. There are two types of Spatials, <em>Nodes</em> and <em>Geometries</em>.</p><div><table><tr><td></td><th>Spatial</th></tr><tr><th>Purpose:</th><td>A Spatial is an abstract data structure that stores transformations (translation, rotation, scale). </td>
<h1><a>The Scene Graph and Other jME3 Terminology</a></h1>
<div>
<p>
Before you start making games, make sure you understand general <a href="/com/jme3/gde/core/docs/jme3/terminology.html">3D Gaming terminology</a>.
</p>
<p>
Second, if you are a beginner, we recommend our <a href="/com/jme3/gde/core/docs/jme3/scenegraph_for_dummies.html">Scene Graph for Dummies</a> presentation for a visual introduction to the concept of a scene graph.
</p>
<p>
Then continue learning about jME3 concepts here.
</p>
</div>
<h2><a>Coordinate System</a></h2>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/intermediate/coordinate-system.png">
</p>
<p>
The jMonkeyEngine uses a right-handed coordinate system, just as OpenGL does.
</p>
<p>
The coordinate system consists of:
</p>
<ul>
<li><div> The origin, a single point in space.</div>
<ul>
<li><div> This point is always at coordinate (0,0,0)</div>
</li>
</ul>
</li>
<li><div> Three coordinate axes that are mutually perpendicular, and meet in the origin. </div>
<ul>
<li><div> The X axis is &quot;right/left&quot;</div>
</li>
<li><div> The Y axis is &quot;up/down&quot;</div>
</li>
<li><div> The Z axis is &quot;towards you/away from you&quot;</div>
</li>
</ul>
</li>
</ul>
<p>
Every point in 3D space is defined by its (x,y,z) coordinates. The data type for vectors is com.jme3.math.Vector3f.
</p>
<p>
For your orientation, the default camera&#039;s location is (0.0f,0.0f,10.0f), and it is looking in the direction described by the unit vector (0.0f, 0.0f, -1.0f). This means your point of view is on the positive side of the Z axis, looking towards the origin, down the Z axis.
</p>
<p>
The unit of meassurement is <code>world unit</code> (wu). Typically, 1 wu is considered to be one meter. All scales, vectors and points are relative to this coordinate system.
</p>
</div>
<h2><a>Scene Graph and RootNode</a></h2>
<div>
<p>
The scene graph represents your 3D world. Objects in the jME3 scene graph are called <a href="/com/jme3/gde/core/docs/jme3/advanced/spatial.html">Spatial</a>s. Everything attached to the <em>rootNode</em> is part of the scene graph. <em>Attaching</em> a Spatial to the rootNode (or other nodes) adds the Spatial to the scene; <em>detaching</em> removes it.
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/jme3/intermediate/scene-graph.png">
</p>
</div>
<h2><a>Spatials: Node vs Geometry</a></h2>
<div>
<p>
A Spatial can be transformed, loaded and saved. There are two types of Spatials, <em>Nodes</em> and <em>Geometries</em>.
</p>
<div><table>
<tr>
<td> </td><th> Spatial </th>
</tr>
<tr>
<th> Purpose: </th><td> A Spatial is an abstract data structure that stores transformations (translation, rotation, scale). </td>
</tr>
<tr>
<td> </td><th> Geometry </th><th> Node </th>

@ -1,4 +1,60 @@
<h1><a>WebStart (JNLP) Deployment</a></h1><div><p>When you <a href="/com/jme3/gde/core/docs/sdk/application_deployment.html">use the jMonkeyEngine SDK to deploy your application</a>, you can configure the project to build files required for WebStart automatically. If you use another IDE, or work on the command line, use the following tips to set up WebStart correctly:</p></div><h2><a>Problem Statement</a></h2><div><p><strong>Problem:</strong></p><p>When running under WebStart, jMonkeyEngine may not have permission to extract the native libraries to the current directory.</p><p><strong>Solution: </strong></p><p>You can instruct WebStart to load the native libraries itself using the JNLP file, and then instruct jME3 not to try to do so itself.</p></div><h2><a>Simple way</a></h2><div><p>You can import the LWJGL JNLP extension directly into your extension, however be aware that your application will break whenever they update their jars. Simply add this line to your JNLP:</p><pre><span>&lt;extension name=&quot;lwjgl&quot; href=&quot;http://lwjgl.org/webstart/2.7.1/extension.jnlp&quot; /&gt;</span></pre></div><h2><a>Reliable way</a></h2><div></div><h3><a>Native jars</a></h3><div><p>You can download the LWJGL native jars from their site, or to ensure you&#039;re using the exact same version as bundled with your jME3 release, make your own:</p><pre>mkdir tmp
<h1><a>WebStart (JNLP) Deployment</a></h1>
<div>
<p>
When you <a href="/com/jme3/gde/core/docs/sdk/application_deployment.html">use the jMonkeyEngine SDK to deploy your application</a>, you can configure the project to build files required for WebStart automatically. If you use another IDE, or work on the command line, use the following tips to set up WebStart correctly:
</p>
</div>
<h2><a>Problem Statement</a></h2>
<div>
<p>
<strong>Problem:</strong>
</p>
<p>
When running under WebStart, jMonkeyEngine may not have permission to extract the native libraries to the current directory.
</p>
<p>
<strong>Solution: </strong>
</p>
<p>
You can instruct WebStart to load the native libraries itself using the JNLP file, and then instruct jME3 not to try to do so itself.
</p>
</div>
<h2><a>Simple way</a></h2>
<div>
<p>
You can import the LWJGL JNLP extension directly into your extension, however be aware that your application will break whenever they update their jars. Simply add this line to your JNLP:
</p>
<pre><span>&lt;extension name=&quot;lwjgl&quot; href=&quot;http://lwjgl.org/webstart/2.7.1/extension.jnlp&quot; /&gt;</span></pre>
</div>
<h2><a>Reliable way</a></h2>
<div>
</div>
<h3><a>Native jars</a></h3>
<div>
<p>
You can download the LWJGL native jars from their site, or to ensure you&#039;re using the exact same version as bundled with your jME3 release, make your own:
</p>
<pre>mkdir tmp
cd tmp
jar xfv ../jME3-lwjgl-natives.jar
cd native
@ -6,7 +62,12 @@ for i in *; do
cd $i
jar cfv ../../native_$i.jar .
cd ..
done</pre><p>For Windows:</p><pre>@echo off
done</pre>
<p>
For Windows:
</p>
<pre>@echo off
md tmp
cd tmp
&quot;%JDK_HOME%\bin\jar&quot; -xfv ..\jME3-lwjgl-natives.jar
@ -16,7 +77,22 @@ for /D %%i in (&quot;*&quot;) do (
&quot;%JDK_HOME%\bin\jar&quot; -cfv ..\..\native_%%i%.jar .
cd ..
)
cd ..</pre><p>Remember to sign all the jar files and move them into the right place from the tmp directory.</p></div><h3><a>JNLP file</a></h3><div><p>Add the following to your JNLP file:</p><pre> <span>&lt;resources os=&quot;Windows&quot;&gt;</span>
cd ..</pre>
<p>
Remember to sign all the jar files and move them into the right place from the tmp directory.
</p>
</div>
<h3><a>JNLP file</a></h3>
<div>
<p>
Add the following to your JNLP file:
</p>
<pre> <span>&lt;resources os=&quot;Windows&quot;&gt;</span>
<span>&lt;j2se version=&quot;1.4+&quot;/&gt;</span>
<span>&lt;nativelib href=&quot;native_windows.jar&quot;/&gt;</span>
<span><span>&lt;/resources&gt;</span></span>
@ -31,9 +107,22 @@ cd ..</pre><p>Remember to sign all the jar files and move them into the right pl
<span>&lt;resources os=&quot;SunOS&quot; arch=&quot;x86&quot;&gt;</span>
<span>&lt;j2se version=&quot;1.4+&quot;/&gt;</span>
<span>&lt;nativelib href=&quot;native_solaris.jar&quot;/&gt;</span>
<span><span>&lt;/resources&gt;</span></span></pre></div><h3><a>Set low-permissions mode</a></h3><div><p>In your main() method, if running under WebStart, tell jME3 it is running in a low-permission environment so that it doesn&#039;t try to load the natives itself:</p><pre> public static void main&#40;String&#91;&#93; args&#41;
<span><span>&lt;/resources&gt;</span></span></pre>
</div>
<h3><a>Set low-permissions mode</a></h3>
<div>
<p>
In your main() method, if running under WebStart, tell jME3 it is running in a low-permission environment so that it doesn&#039;t try to load the natives itself:
</p>
<pre> public static void main&#40;String&#91;&#93; args&#41;
&#123;
if &#40;System.getProperty&#40;&quot;javawebstart.version&quot;&#41; != null&#41; &#123;
JmeSystem.setLowPermissions&#40;true&#41;;
&#125;</pre></div>
&#125;</pre>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:webstart?do=export_xhtmlbody">view online version</a></em></p>

@ -0,0 +1,69 @@
<h1><a>Using Blender as a Intermediator Between 3dMax and the jMonkeyEngine SDK</a></h1>
<div>
<p>
The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> supports .blend files and can convert them to jMonkeyEngine&#039;s .j3o format. This means you can use Blender to convert, for example, a 3dMax file to .j3o format.
</p>
</div>
<h2><a>Importing the .3ds file to Blender</a></h2>
<div>
<p>
I&#039;m using the blender 2.59 at this tutorial, but if you blender 2.49b, no problem ;).
After you saved your .3ds file in 3dmax, open the blender, delete the default cube,
and import your .3ds file via File—→Import—–&gt;3D Studio.
</p>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
</div>
<h2><a>Saving the .blend file</a></h2>
<div>
<p>
Now save your .blend file so you can load it into the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>.
</p>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
</div>
<h2><a>Importing the .blend file to the SDK by using the ModelImporter and BlenderSupport plugins</a></h2>
<div>
<p>
Click on Import Model button and then click on Open Model button to open the .blend file. Click next, select the checkbox to import a copy from .blend file, and click finish.
</p>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
</div>
<h2><a>Edit your model in SceneComposer and &quot;VOILA&quot;</a></h2>
<div>
<p>
As you can see, the .blend model was automatically converted to .j3o binary format. Now, you are able to edit it in SceneComposer ;D.
</p>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:3ds_to_blender_to_jmp?do=export_xhtmlbody">view online version</a></em></p>

@ -1,4 +1,48 @@
<h1><a>jMonkeyEngine SDK: Application Deployment</a></h1><div><p>After you have written and tested your game, you want to brand it and distribute it to your users. If you use the build script provided by the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s BaseGame, you have the following deployment options:</p><ul><li><div>Desktop application (.JAR)</div></li><li><div>WebStart from <acronym title="Uniform Resource Locator">URL</acronym> (.JNLP + .JAR)</div></li><li><div>Applet in web browser (.JNLP + .JAR)</div></li><li><div>Android mobile device (.APK)</div></li></ul></div><h2><a>Requirements</a></h2><div><p>Since JAR files are platform independent, your customers can play your jMonkeyEngine application on Windows, Mac <acronym title="Operating System">OS</acronym>, or Linux. The only requirement is that the user has the free Java 5 or 6 Runtime (or browser plugin) installed. For more information see <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://java.com"><param name="text" value="<html><u>http://java.com</u></html>"><param name="textColor" value="blue"></object>.</p></div><h2><a>Branding</a></h2><div><p><img src="nbdocs:/com/jme3/gde/core/docs/sdk/jmonkey-branding.png"> Make your game unique and recognizable:</p><ol><li><div>Open your game project in the <acronym title="Software Development Kit">SDK</acronym>&#039;s Projects window.</div></li><li><div>Right-click the project and open the Properties</div></li><li><div> Open the Properties → Application section. Here you configure your branding:</div>
<h1><a>jMonkeyEngine SDK: Application Deployment</a></h1>
<div>
<p>
After you have written and tested your game, you want to brand it and distribute it to your users. If you use the build script provided by the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s BaseGame, you have the following deployment options:
</p>
<ul>
<li><div> Desktop application (.JAR)</div>
</li>
<li><div> WebStart from <acronym title="Uniform Resource Locator">URL</acronym> (.JNLP + .JAR)</div>
</li>
<li><div> Applet in web browser (.JNLP + .JAR)</div>
</li>
<li><div> Android mobile device (.APK)</div>
</li>
</ul>
</div>
<h2><a>Requirements</a></h2>
<div>
<p>
Since JAR files are platform independent, your customers can play your jMonkeyEngine application on Windows, Mac <acronym title="Operating System">OS</acronym>, or Linux. The only requirement is that the user has the free Java 5 or 6 Runtime (or browser plugin) installed. For more information see <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://java.com"><param name="text" value="<html><u>http://java.com</u></html>"><param name="textColor" value="blue"></object>.
</p>
</div>
<h2><a>Branding</a></h2>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/sdk/jmonkey-branding.png">
Make your game unique and recognizable:
</p>
<ol>
<li><div> Open your game project in the <acronym title="Software Development Kit">SDK</acronym>&#039;s Projects window.</div>
</li>
<li><div> Right-click the project and open the Properties</div>
</li>
<li><div> Open the Properties → Application section. Here you configure your branding:</div>
<ol>
<li><div> Title: Enter the game&#039;s name</div>
</li>

@ -1,4 +1,27 @@
<h1><a>jMonkeyEngine SDK AssetPacks</a></h1><div><p>AssetPacks are a way to package jME3 compatible assets like models, textures, sounds and whole scenes into a package that contains publisher info, license info, descriptions etc. for all of the assets. An AssetPack basically consists of an <code>assetpack.xml</code> file that describes the content and an <code>assets</code> folder that contains the content. The integrated browser in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> allows you to add the assets of installed AssetPacks to any project you are doing.</p></div><h2><a>The AssetPack Browser</a></h2><div><p><img src="/wiki/lib/exe/fetch.php"></p><p>The AssetPack browser in jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> makes browsing the installed AssetPacks easy. Browse categories, search for tags and find the right asset for your project. When you have found it, you can add it with one click to your current scene. The AssetPack manager will automagically copy all needed textures, sounds etc. to your projects assets folder.</p><p>You can also browse a selection of online assetpacks that are available on jMonkeyEngine.org for download and install them to your jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s AssetPack browser.
<h1><a>jMonkeyEngine SDK AssetPacks</a></h1>
<div>
<p>
AssetPacks are a way to package jME3 compatible assets like models, textures, sounds and whole scenes into a package that contains publisher info, license info, descriptions etc. for all of the assets. An AssetPack basically consists of an <code>assetpack.xml</code> file that describes the content and an <code>assets</code> folder that contains the content. The integrated browser in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> allows you to add the assets of installed AssetPacks to any project you are doing.
</p>
</div>
<h2><a>The AssetPack Browser</a></h2>
<div>
<p>
<img src="/wiki/lib/exe/fetch.php">
</p>
<p>
The AssetPack browser in jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> makes browsing the installed AssetPacks easy. Browse categories, search for tags and find the right asset for your project. When you have found it, you can add it with one click to your current scene. The AssetPack manager will automagically copy all needed textures, sounds etc. to your projects assets folder.
</p>
<p>
You can also browse a selection of online assetpacks that are available on jMonkeyEngine.org for download and install them to your jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s AssetPack browser.
</p>
<p>

@ -1,4 +1,44 @@
<h1><a>Blender importer for jMonkeyEngine 3</a></h1><div></div><h2><a>Introduction</a></h2><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. It was important to have always the lates version of the script that is compatible with the version of blender and to use it before importing data to jme. Now we have an opportunity to simplify the import process by loading data directly from blender binary files: *.blend.</p></div><h2><a>Usage</a></h2><div><p>To use it in your game or the <acronym title="Software Development Kit">SDK</acronym> you should follow the standard asset loading instructions. By default a BlenderModelLoader is registered with your assetManager to load blend files. This means you can load and convert .blend model files to .j3o format, just like any other supported model format.</p></div><h2><a>Currently supported features</a></h2><div><ol><li><div>Loading scene (only the current scene is loaded and imported as a node)</div></li><li><div>Loading mesh objects.</div><ul><li><div>Meshes are split into several geometries when they have several materials applied.</div></li><li><div>All faces are stored as triangles (even if blender uses quads).</div></li><li><div>The mesh is &#039;Smooth&#039; aware.</div>
<h1><a>Blender importer for jMonkeyEngine 3</a></h1>
<div>
</div>
<h2><a>Introduction</a></h2>
<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.
It was important to have always the lates version of the script that is compatible with the version of blender and to use it before importing data to jme.
Now we have an opportunity to simplify the import process by loading data directly from blender binary files: *.blend.
</p>
</div>
<h2><a>Usage</a></h2>
<div>
<p>
To use it in your game or the <acronym title="Software Development Kit">SDK</acronym> you should follow the standard asset loading instructions.
By default a BlenderModelLoader is registered with your assetManager to load blend files. This means you can load and convert .blend model files to .j3o format, just like any other supported model format.
</p>
</div>
<h2><a>Currently supported features</a></h2>
<div>
<ol>
<li><div> Loading scene (only the current scene is loaded and imported as a node)</div>
</li>
<li><div> Loading mesh objects.</div>
<ul>
<li><div> Meshes are split into several geometries when they have several materials applied.</div>
</li>
<li><div> All faces are stored as triangles (even if blender uses quads).</div>
</li>
<li><div> The mesh is &#039;Smooth&#039; aware.</div>
</li>
<li><div> User defined UV coordinates are read.</div>
</li>

@ -1,4 +1,94 @@
<h1><a>jMonkeyEngine SDK: Code Editor and Palette</a></h1><div><p>The Source Code Editor is the central part of the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>. This documentation shows you how to make the most of the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s assistive features.</p><p>Note: 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><h2><a>Code Completion and Code Generation</a></h2><div><p>While typing Java code in the source code editor, you will see popups that help you to write more quickly by completing keywords, and generating code snippets. Additionally, they will let you see the javadoc for the classes you are working with.</p><p><img src="nbdocs:/com/jme3/gde/core/docs/sdk/netbeans_code_completion.png"></p><p>Code Completion</p><ul><li><div>Complete keyword / method / variable: <strong>Ctrl-Space</strong> (Alternatively use <strong>Ctrl-\</strong>)</div><ul><li><div>Customize Code Completion options: Tools &gt; Options &gt; Editor &gt; Code Completion</div></li></ul></li><li><div>Show expected parameters of this method in a tooltip: <strong>Ctrl-P</strong></div></li><li><div>Complete any string (even non-Java) that has been used before: <strong>(Shift-)Ctrl-K</strong></div></li></ul><p>Code Generation</p><ul><li><div>Auto-fix import statements: <strong>Ctrl-Shift-I</strong></div></li><li><div>Auto-generate getters/setters, try/catch, equals/hashCode: <strong>Alt-Insert</strong></div><ul><li><div>Customize code completion: Choose Tools &gt; Options &gt; Editor &gt; Code Completion</div></li></ul></li><li><div>Auto-generate common code snippets such as loops, declarations, println, by typing the <strong>template name + TabKey</strong></div><ul><li><div>Customize code templates: Choose Tools &gt; Options &gt; Editor &gt; Code Templates</div></li></ul></li><li><div>Rename, move, or introduce methods, fields, and variables, without breaking the project: <strong>Refactoring menu</strong></div></li></ul></div><h2><a>Semantic and Syntactic Coloring</a></h2><div><p><img src="nbdocs:/com/jme3/gde/core/docs/sdk/jmonkeyplatform-docu-5.png"></p><p>The text color in the editor gives you important hints how the compiler will interpret what you typed, even before you compiled it.</p><p>Examples:</p><ul><li><div>Java keywords are <strong>blue</strong>, variables and fields are <strong>green</strong>, parameters are <strong>orange</strong>.</div></li><li><div><del>Strikethrough</del> means deprecated method or field.</div></li><li><div><em>Gray underline</em> means unused variable or method.</div></li><li><div>Place the caret in a method or variable and all its ocurrences are marked <strong>tan</strong>.</div>
<h1><a>jMonkeyEngine SDK: Code Editor and Palette</a></h1>
<div>
<p>
The Source Code Editor is the central part of the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>. This documentation shows you how to make the most of the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s assistive features.
</p>
<p>
Note: 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>
<h2><a>Code Completion and Code Generation</a></h2>
<div>
<p>
While typing Java code in the source code editor, you will see popups that help you to write more quickly by completing keywords, and generating code snippets. Additionally, they will let you see the javadoc for the classes you are working with.
</p>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/sdk/netbeans_code_completion.png">
</p>
<p>
Code Completion
</p>
<ul>
<li><div> Complete keyword / method / variable: <strong>Ctrl-Space</strong> (Alternatively use <strong>Ctrl-\</strong>)</div>
<ul>
<li><div> Customize Code Completion options: Tools &gt; Options &gt; Editor &gt; Code Completion </div>
</li>
</ul>
</li>
<li><div> Show expected parameters of this method in a tooltip: <strong>Ctrl-P</strong> </div>
</li>
<li><div> Complete any string (even non-Java) that has been used before: <strong>(Shift-)Ctrl-K</strong></div>
</li>
</ul>
<p>
Code Generation
</p>
<ul>
<li><div> Auto-fix import statements: <strong>Ctrl-Shift-I</strong></div>
</li>
<li><div> Auto-generate getters/setters, try/catch, equals/hashCode: <strong>Alt-Insert</strong></div>
<ul>
<li><div> Customize code completion: Choose Tools &gt; Options &gt; Editor &gt; Code Completion</div>
</li>
</ul>
</li>
<li><div> Auto-generate common code snippets such as loops, declarations, println, by typing the <strong>template name + TabKey</strong> </div>
<ul>
<li><div> Customize code templates: Choose Tools &gt; Options &gt; Editor &gt; Code Templates</div>
</li>
</ul>
</li>
<li><div> Rename, move, or introduce methods, fields, and variables, without breaking the project: <strong>Refactoring menu</strong></div>
</li>
</ul>
</div>
<h2><a>Semantic and Syntactic Coloring</a></h2>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/sdk/jmonkeyplatform-docu-5.png">
</p>
<p>
The text color in the editor gives you important hints how the compiler will interpret what you typed, even before you compiled it.
</p>
<p>
Examples:
</p>
<ul>
<li><div> Java keywords are <strong>blue</strong>, variables and fields are <strong>green</strong>, parameters are <strong>orange</strong>. </div>
</li>
<li><div> <del>Strikethrough</del> means deprecated method or field. </div>
</li>
<li><div> <em>Gray underline</em> means unused variable or method.</div>
</li>
<li><div> Place the caret in a method or variable and all its ocurrences are marked <strong>tan</strong>.</div>
</li>
<li><div> Place the caret in a method&#039;s return type to highlight all exit points</div>
</li>

@ -1,4 +1,40 @@
<h1><a>jMonkeyEngine SDK: Debugging, Profiling, Testing</a></h1><div><p>Debugging, testing and profiling are important parts of the development cycle. This documentation shows you how to make the most of the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s assistive features.</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><h2><a>Testing</a></h2><div><p>The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> supports the JUnit testing framework. It is a good practice to write tests (assertions) for each of your classes. Each test makes certain this &quot;unit&quot; (e.g. method) meets its design and behaves as intended. Run your tests after each major change and you immediately see if you broke something.</p></div><h4><a>Creating Tests</a></h4><div><ol><li><div>Right-click a Java file in the Projects window and choose Tools &gt; Create JUnit Tests.</div></li><li><div>Click OK. The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> creates a JUnit test skeleton in the Test Package directory.</div></li><li><div>The body of each generated test method is provided solely as a guide. In their place, you need to write your actual test cases!</div></li><li><div>You can use tests such as <code>assertTrue(), assertFalse(), assertEquals()</code>, or <code>assert()</code>.</div><ul><li><div> The following example assertions test an addition method: <code>assert( add(1, 1) == 2); assertTrue( add(7,-5) == add(-5,7) )…</code></div>
<h1><a>jMonkeyEngine SDK: Debugging, Profiling, Testing</a></h1>
<div>
<p>
Debugging, testing and profiling are important parts of the development cycle. This documentation shows you how to make the most of the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>&#039;s assistive features.
</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>
<h2><a>Testing</a></h2>
<div>
<p>
The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> supports the JUnit testing framework. It is a good practice to write tests (assertions) for each of your classes. Each test makes certain this &quot;unit&quot; (e.g. method) meets its design and behaves as intended. Run your tests after each major change and you immediately see if you broke something.
</p>
</div>
<h4><a>Creating Tests</a></h4>
<div>
<ol>
<li><div> Right-click a Java file in the Projects window and choose Tools &gt; Create JUnit Tests.</div>
</li>
<li><div> Click OK. The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> creates a JUnit test skeleton in the Test Package directory.</div>
</li>
<li><div> The body of each generated test method is provided solely as a guide. In their place, you need to write your actual test cases!</div>
</li>
<li><div> You can use tests such as <code>assertTrue(), assertFalse(), assertEquals()</code>, or <code>assert()</code>.</div>
<ul>
<li><div> The following example assertions test an addition method: <code>assert( add(1, 1) == 2); assertTrue( add(7,-5) == add(-5,7) )…</code></div>
</li>
</ul>
</li>

@ -1,4 +1,62 @@
<h2><a>Developing for jMonkeyEngine SDK</a></h2><div><p><em>Note that all info is subject to change while jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> is still in beta!</em></p><p>In general, developing plugins for jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> is not much different than creating plugins for the NetBeans Platform which in turn is not much different than creating Swing applications. You can use jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> to develop plugins, be it for personal use or to contribute to the community.</p><p>If you feel like you want to make an addition to jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>, don&#039;t hesitate to contact the jme team regardless of your knowledge in NetBeans platform development. For new plugins, the basic project creation and layout of the plugin can always be handled by a core developer and you can go on from there fleshing out the plugin. By using the Platform functions, your plugin feels more like a Platform application (global save button, file type support etc.).</p></div><h4><a>Creating plugins and components</a></h4><div><ul><li><div><a href="/com/jme3/gde/core/docs/sdk/development/setup.html">Creating a plugin</a></div></li><li><div><a href="/com/jme3/gde/core/docs/sdk/development/general.html">Creating components</a></div></li></ul></div><h4><a>Extending jMonkeyEngine SDK</a></h4><div><ul><li><div><a href="/com/jme3/gde/core/docs/sdk/development/scene.html">The Main Scene</a></div></li><li><div><a href="/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html">The Scene Explorer</a></div></li><li><div><a href="/com/jme3/gde/core/docs/sdk/development/projects_assets.html">Projects and Assets</a></div></li></ul></div><h4><a>Recipes</a></h4><div><ul><li><div><a href="/com/jme3/gde/core/docs/sdk/development/extension_library.html">Create a library plugin from a jar file</a></div></li><li><div><a href="/com/jme3/gde/core/docs/sdk/development/model_loader.html">Create a new or custom model filetype and loader</a></div></li></ul></div><h4><a>General Notes</a></h4><div><ul><li><div><strong>Remember the scene runs on the render thread and most everything you do in the plugin (button events etc.) runs on the AWT thread, always encapsulate calls to either side correctly via Callables/Runnables or register as an AppState to the SceneApplication to have an update() call by the render thread.</strong></div></li><li><div>Although the scene can be accessed at any time via SceneApplication.getApplication() it is not recommended to modify the scene like that. Other plugins might be accessing the scene and updates will not be properly recognized. Use the sceneRequest object and the lookup of selected nodes and files to access things like the assetManager etc.</div>
<h2><a>Developing for jMonkeyEngine SDK</a></h2>
<div>
<p>
<em>Note that all info is subject to change while jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> is still in beta!</em>
</p>
<p>
In general, developing plugins for jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> is not much different than creating plugins for the NetBeans Platform which in turn is not much different than creating Swing applications. You can use jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> to develop plugins, be it for personal use or to contribute to the community.
</p>
<p>
If you feel like you want to make an addition to jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>, don&#039;t hesitate to contact the jme team regardless of your knowledge in NetBeans platform development. For new plugins, the basic project creation and layout of the plugin can always be handled by a core developer and you can go on from there fleshing out the plugin. By using the Platform functions, your plugin feels more like a Platform application (global save button, file type support etc.).
</p>
</div>
<h4><a>Creating plugins and components</a></h4>
<div>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/sdk/development/setup.html">Creating a plugin</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/sdk/development/general.html">Creating components</a></div>
</li>
</ul>
</div>
<h4><a>Extending jMonkeyEngine SDK</a></h4>
<div>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/sdk/development/scene.html">The Main Scene</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html">The Scene Explorer</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/sdk/development/projects_assets.html">Projects and Assets</a></div>
</li>
</ul>
</div>
<h4><a>Recipes</a></h4>
<div>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/sdk/development/extension_library.html">Create a library plugin from a jar file</a></div>
</li>
<li><div> <a href="/com/jme3/gde/core/docs/sdk/development/model_loader.html">Create a new or custom model filetype and loader</a></div>
</li>
</ul>
</div>
<h4><a>General Notes</a></h4>
<div>
<ul>
<li><div> <strong>Remember the scene runs on the render thread and most everything you do in the plugin (button events etc.) runs on the AWT thread, always encapsulate calls to either side correctly via Callables/Runnables or register as an AppState to the SceneApplication to have an update() call by the render thread.</strong></div>
</li>
<li><div> Although the scene can be accessed at any time via SceneApplication.getApplication() it is not recommended to modify the scene like that. Other plugins might be accessing the scene and updates will not be properly recognized. Use the sceneRequest object and the lookup of selected nodes and files to access things like the assetManager etc.</div>
</li>
<li><div> It became a standard in jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> to start the name of methods that execute directly on the OpenGL thread with &quot;do&quot; e.g &quot;doMoveSpatial&quot;, this makes identifying threading issues easier.</div>
</li>

@ -1,2 +1,30 @@
<h1><a>Creating a model importer</a></h1><div><ol><li><div>Create plugin</div></li><li><div>Add importer jar file (wrap jar file)</div></li><li><div>Add filetype (Template)</div></li><li><div>Change DataObject to extend SpatialAssetDataObject</div></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></ol><p>See also:</p><ul><li><div><a href="/com/jme3/gde/core/docs/sdk/development/projects_assets.html">Projects and Assets</a></div></li><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>
<h1><a>Creating a model importer</a></h1>
<div>
<ol>
<li><div> Create plugin</div>
</li>
<li><div> Add importer jar file (wrap jar file)</div>
</li>
<li><div> Add filetype (Template)</div>
</li>
<li><div> Change DataObject to extend SpatialAssetDataObject</div>
</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>
</ol>
<p>
See also:
</p>
<ul>
<li><div> <a href="/com/jme3/gde/core/docs/sdk/development/projects_assets.html">Projects and Assets</a></div>
</li>
<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>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:development:model_loader?do=export_xhtmlbody">view online version</a></em></p>

@ -1,4 +1,45 @@
<h1><a>Projects and Assets</a></h1><div><p>The <acronym title="Software Development Kit">SDK</acronym> heavily uses the systems provided by the base platform for the handling of assets and projects and extends the system with jME3 specific features.</p></div><h2><a>ProjectAssetManager</a></h2><div><p>All AssetDataObjects and SceneExplorerNodes allow access to the ProjectAssetManager of the project they were loaded from.</p><pre>ProjectAssetManager pm = node.getLookup&#40;&#41;.lookup&#40;ProjectAssetManager.class&#41;</pre><p>The ProjectAssetManager is basically a normal DesktopAssetManager for each project with some added functionality:</p><ul><li><div>Access to the FileObject of the assets folder of the project to load and save data</div></li><li><div>Convert absolute file paths to relative asset paths and vice versa</div></li><li><div>Get lists of all textures, materials etc. in the project</div></li><li><div>more convenient stuff.. :)</div></li></ul></div><h2><a>AssetDataObject</a></h2><div><p>Most &quot;files&quot; that you encounter in the <acronym title="Software Development Kit">SDK</acronym> come in the form of AssetDataObjects. All Nodes that you encounter contain the AssetDataObject they were loaded from. It provides not just access to the FileObject of the specific file but also an AssetData object that allows access to jME specific properties and data. The AssetData object also allows loading the object via the jME3 assetManager. It is accessible via the lookup of the Node or AssetDataObject:
<h1><a>Projects and Assets</a></h1>
<div>
<p>
The <acronym title="Software Development Kit">SDK</acronym> heavily uses the systems provided by the base platform for the handling of assets and projects and extends the system with jME3 specific features.
</p>
</div>
<h2><a>ProjectAssetManager</a></h2>
<div>
<p>
All AssetDataObjects and SceneExplorerNodes allow access to the ProjectAssetManager of the project they were loaded from.
</p>
<pre>ProjectAssetManager pm = node.getLookup&#40;&#41;.lookup&#40;ProjectAssetManager.class&#41;</pre>
<p>
The ProjectAssetManager is basically a normal DesktopAssetManager for each project with some added functionality:
</p>
<ul>
<li><div> Access to the FileObject of the assets folder of the project to load and save data</div>
</li>
<li><div> Convert absolute file paths to relative asset paths and vice versa</div>
</li>
<li><div> Get lists of all textures, materials etc. in the project</div>
</li>
<li><div> more convenient stuff.. :)</div>
</li>
</ul>
</div>
<h2><a>AssetDataObject</a></h2>
<div>
<p>
Most &quot;files&quot; that you encounter in the <acronym title="Software Development Kit">SDK</acronym> come in the form of AssetDataObjects. All Nodes that you encounter contain the AssetDataObject they were loaded from. It provides not just access to the FileObject of the specific file but also an AssetData object that allows access to jME specific properties and data. The AssetData object also allows loading the object via the jME3 assetManager. It is accessible via the lookup of the Node or AssetDataObject:
</p>
<pre>assetDataObject.getLookup&#40;&#41;.lookup&#40;AssetData.class&#41;</pre>

@ -1,4 +1,42 @@
<h1><a>jMonkeyEngine SDK -- The Scene</a></h1><div><p>To reduce system overhead the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> Core supplies one scene/jme3 application that is shared between plugins. Furthermore there&#039;s the &quot;SceneExplorer&quot; that shows a visual representation of the scenegraph and its objects properties across plugins.</p></div><h2><a>How to access the Scene</a></h2><div><p>There are several ways for your plugin to interact with the Scene:</p><ul><li><div>It listens for selected spatials / objects and offers options for those</div></li><li><div>It requests the whole scene for itself and loads/arranges the content in it (e.g. a terrain editor or model animation plugin).</div></li></ul></div><h2><a>Listening for Node selection</a></h2><div><p>In the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>, all objects are wrapped into NetBeans &quot;Nodes&quot; (different thing than jme Nodes!). Such nodes can have properties and icons and can be displayed and selected in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> UI. The SceneExplorer shows a tree of Nodes that wrap the Spatials of the current scene and allows manipulating their properties on selection. A jME &quot;Spatial&quot; is wrapped by a &quot;JmeSpatial&quot; node, for example. One advantage of these Nodes is that one can manipulate properties of Spatials directly from the AWT thread.</p><p>To listen to the current selection, implement org.openide.util.LookupListener and register like this:</p><pre>private final Result&lt;JmeSpatial&gt; result;
<h1><a>jMonkeyEngine SDK -- The Scene</a></h1>
<div>
<p>
To reduce system overhead the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> Core supplies one scene/jme3 application that is shared between plugins. Furthermore there&#039;s the &quot;SceneExplorer&quot; that shows a visual representation of the scenegraph and its objects properties across plugins.
</p>
</div>
<h2><a>How to access the Scene</a></h2>
<div>
<p>
There are several ways for your plugin to interact with the Scene:
</p>
<ul>
<li><div> It listens for selected spatials / objects and offers options for those</div>
</li>
<li><div> It requests the whole scene for itself and loads/arranges the content in it (e.g. a terrain editor or model animation plugin).</div>
</li>
</ul>
</div>
<h2><a>Listening for Node selection</a></h2>
<div>
<p>
In the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>, all objects are wrapped into NetBeans &quot;Nodes&quot; (different thing than jme Nodes!). Such nodes can have properties and icons and can be displayed and selected in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> UI. The SceneExplorer shows a tree of Nodes that wrap the Spatials of the current scene and allows manipulating their properties on selection. A jME &quot;Spatial&quot; is wrapped by a &quot;JmeSpatial&quot; node, for example. One advantage of these Nodes is that one can manipulate properties of Spatials directly from the AWT thread.
</p>
<p>
To listen to the current selection, implement org.openide.util.LookupListener and register like this:
</p>
<pre>private final Result&lt;JmeSpatial&gt; result;
&nbsp;
//method to register the listener;
private void registerListener&#40;&#41;&#123;
@ -14,7 +52,12 @@ public void resultChanged&#40;LookupEvent ev&#41; &#123;
spatial.getPropertySets&#40;&#41;&#91;0&#93;.setValue&#40;&quot;Local Translation&quot;, Vector3f.ZERO&#41;;
return;
&#125;
&#125;</pre><p>You can also access the &quot;real&quot; spatial but since its part of the scenegraph you will have to modify it on that thread:</p><pre>//retrieve the &quot;real&quot; spatial class from the JmeNode
&#125;</pre>
<p>
You can also access the &quot;real&quot; spatial but since its part of the scenegraph you will have to modify it on that thread:
</p>
<pre>//retrieve the &quot;real&quot; spatial class from the JmeNode
for &#40;JmeSpatial jmeSpatial : items&#41; &#123;
//the spatial is stored inside the JmeSpatials &quot;Lookup&quot;, a general container for Objects
final Spatial realSpatial = jmeSpatial.getLookup&#40;&#41;.lookup&#40;Spatial.class&#41;;
@ -26,7 +69,24 @@ for &#40;JmeSpatial jmeSpatial : items&#41; &#123;
&#125;
&#125;&#41;;
return;
&#125;</pre></div><h2><a>Requesting the Scene</a></h2><div><p>If your plugin wants to use the scene by itself, it first has to implement SceneListener and register at the scene and then send a SceneRequest to the SceneApplication. When the SceneRequest has been approved and the current Scene has been closed, the SceneListener (your class) is called with its own SceneRequest as a parameter. When another plugin sends a SceneRequest it is also reported to you and its a hint that your RootNode has been removed from the Scene and you are no longer in control of it. You could also hook into the SceneRequests of other plugins to see if/when they are activated to display add-on plugins for that plugin.</p><p><br/> The SceneRequest object has to contain several things. A thing that you must supply is a jme &quot;Node&quot; wrapped into a &quot;JmeNode&quot; object. This is your rootNode that you use to display and build your scene. As soon as you control the scene, you will have to control the camera etc. yourself.</p><pre>com.jme3.scene.Node rootNode = new com.jme3.scene.Node&#40;&quot;MyRootNode&quot;&#41;;
&#125;</pre>
</div>
<h2><a>Requesting the Scene</a></h2>
<div>
<p>
If your plugin wants to use the scene by itself, it first has to implement SceneListener and register at the scene and then send a SceneRequest to the SceneApplication. When the SceneRequest has been approved and the current Scene has been closed, the SceneListener (your class) is called with its own SceneRequest as a parameter. When another plugin sends a SceneRequest it is also reported to you and its a hint that your RootNode has been removed from the Scene and you are no longer in control of it. You could also hook into the SceneRequests of other plugins to see if/when they are activated to display add-on plugins for that plugin.
</p>
<p>
<br/>
The SceneRequest object has to contain several things. A thing that you must supply is a jme &quot;Node&quot; wrapped into a &quot;JmeNode&quot; object. This is your rootNode that you use to display and build your scene. As soon as you control the scene, you will have to control the camera etc. yourself.
</p>
<pre>com.jme3.scene.Node rootNode = new com.jme3.scene.Node&#40;&quot;MyRootNode&quot;&#41;;
&nbsp;
private void registerSceneListener&#40;&#41;&#123;
SceneApplication.getApplication&#40;&#41;.addSceneListener&#40;this&#41;;
@ -53,10 +113,27 @@ public void sceneClosed&#40;SceneRequest request&#41; &#123;
if &#40;request.getRequester&#40;&#41; == this&#41; &#123;
//we have to close the scene, any operations on the scene have to be done via Callables
&#125;
&#125;</pre></div><h2><a>Undo/Redo support</a></h2><div><p>The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> has a global undo/redo queue that activates the undo/redo buttons. To use it in your TopComponent, add the following method:</p><pre>@Override
&#125;</pre>
</div>
<h2><a>Undo/Redo support</a></h2>
<div>
<p>
The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> has a global undo/redo queue that activates the undo/redo buttons. To use it in your TopComponent, add the following method:
</p>
<pre>@Override
public UndoRedo getUndoRedo&#40;&#41; &#123;
return Lookup.getDefault&#40;&#41;.lookup&#40;SceneUndoRedoManager.class&#41;;
&#125; </pre><p>To add a undo/redo event that modifies objects on the Scenegraph, theres a special version of AbstractUndoableEdit which executes the undo/redo calls on the scene thread. Simply implement that class and add it to the queue like this:</p><pre>Lookup.getDefault&#40;&#41;.lookup&#40;SceneUndoRedoManager.class&#41;.addEdit&#40;this, new AbstractUndoableSceneEdit&#40;&#41; &#123;
&#125; </pre>
<p>
To add a undo/redo event that modifies objects on the Scenegraph, theres a special version of AbstractUndoableEdit which executes the undo/redo calls on the scene thread. Simply implement that class and add it to the queue like this:
</p>
<pre>Lookup.getDefault&#40;&#41;.lookup&#40;SceneUndoRedoManager.class&#41;.addEdit&#40;this, new AbstractUndoableSceneEdit&#40;&#41; &#123;
&nbsp;
@Override
public void sceneUndo&#40;&#41; &#123;
@ -77,5 +154,12 @@ public void awtUndo&#40;&#41; &#123;
public void awtRedo&#40;&#41; &#123;
//redo stuff on awt thread here
&#125;
&#125;&#41;;</pre><p>Note: Its important that you use the method addEdit(Object source, UndoableEdit edit);</p></div>
&#125;&#41;;</pre>
<p>
Note: Its important that you use the method addEdit(Object source, UndoableEdit edit);
</p>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:development:scene?do=export_xhtmlbody">view online version</a></em></p>

@ -1,4 +1,44 @@
<h1><a>The SceneExplorer</a></h1><div></div><h2><a>Adding Node types to SceneExplorer</a></h2><div><p>If your plugin brings in its own SceneGraph objects you can still have them work like any other SceneExplorer item, including its special properties.</p><p>You will have to create your own class that extends org.openide.nodes.Node and implement the interface com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode. Then you register that class by adding</p><pre>@org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)</pre><p>above the body of your class. Thats all, your Spatial type will automatically be used and displayed in the SceneExplorer. Make sure you register a jar with the used classes in the plugin preferences under &quot;wrapped libraries&quot;, otherwise the IDE cannot access those classes.</p><p>Theres also AbstractSceneExplorerNode which brings some other useful features you might want to include like automatic creation of properly threaded properties etc. JmeSpatial for example bases on it. A simple SceneExplorerNode example for an object extending Spatial would be JmeGeometry (see below). Editors for special variable types can be added using the SceneExplorerPropertyEditor interface, which can be registered as a ServiceProvider as well.</p><p>The SceneExplorerNode can be used for Spatial and Control type objects.</p><ul><li><div><em>Add the &quot;Nodes <acronym title="Application Programming Interface">API</acronym>&quot; and &quot;Lookup <acronym title="Application Programming Interface">API</acronym>&quot; libraries to your project when you want to use this</em></div></li></ul></div><h3><a>Spatial Example</a></h3><div><pre>@org.openide.util.lookup.ServiceProvider&#40;service=SceneExplorerNode.class&#41;
<h1><a>The SceneExplorer</a></h1>
<div>
</div>
<h2><a>Adding Node types to SceneExplorer</a></h2>
<div>
<p>
If your plugin brings in its own SceneGraph objects you can still have them work like any other SceneExplorer item, including its special properties.
</p>
<p>
You will have to create your own class that extends org.openide.nodes.Node and implement the interface com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode. Then you register that class by adding
</p>
<pre>@org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)</pre>
<p>
above the body of your class. Thats all, your Spatial type will automatically be used and displayed in the SceneExplorer. Make sure you register a jar with the used classes in the plugin preferences under &quot;wrapped libraries&quot;, otherwise the IDE cannot access those classes.
</p>
<p>
Theres also AbstractSceneExplorerNode which brings some other useful features you might want to include like automatic creation of properly threaded properties etc. JmeSpatial for example bases on it. A simple SceneExplorerNode example for an object extending Spatial would be JmeGeometry (see below). Editors for special variable types can be added using the SceneExplorerPropertyEditor interface, which can be registered as a ServiceProvider as well.
</p>
<p>
The SceneExplorerNode can be used for Spatial and Control type objects.
</p>
<ul>
<li><div><em>Add the &quot;Nodes <acronym title="Application Programming Interface">API</acronym>&quot; and &quot;Lookup <acronym title="Application Programming Interface">API</acronym>&quot; libraries to your project when you want to use this</em></div>
</li>
</ul>
</div>
<h3><a>Spatial Example</a></h3>
<div>
<pre>@org.openide.util.lookup.ServiceProvider&#40;service=SceneExplorerNode.class&#41;
public class JmeGeometry extends JmeSpatial &#123;
&nbsp;
private static Image smallImage =
@ -58,7 +98,13 @@ public class JmeGeometry extends JmeSpatial &#123;
children.setReadOnly&#40;readOnly&#41;;
return new org.openide.nodes.Node&#91;&#93;&#123;new JmeGeometry&#40;&#40;Geometry&#41; key, children&#41;.setReadOnly&#40;readOnly&#41;&#125;;
&#125;
&#125;</pre></div><h3><a>Control Example</a></h3><div><pre>@org.openide.util.lookup.ServiceProvider&#40;service=SceneExplorerNode.class&#41;
&#125;</pre>
</div>
<h3><a>Control Example</a></h3>
<div>
<pre>@org.openide.util.lookup.ServiceProvider&#40;service=SceneExplorerNode.class&#41;
public class JmeGhostControl extends AbstractSceneExplorerNode &#123;
&nbsp;
private static Image smallImage =
@ -154,7 +200,26 @@ public class JmeGhostControl extends AbstractSceneExplorerNode &#123;
public org.openide.nodes.Node&#91;&#93; createNodes&#40;Object key, DataObject key2, boolean cookie&#41; &#123;
return new org.openide.nodes.Node&#91;&#93;&#123;new JmeGhostControl&#40;&#40;GhostControl&#41; key, key2&#41;.setReadOnly&#40;cookie&#41;&#125;;
&#125;
&#125;</pre></div><h2><a>Adding items to the add and tools menus</a></h2><div><p>For adding Spatials, Contols and for general tools theres premade abstract classes that you can use to extend the options. Undo/Redo is handled by the abstract class. AbstractNewSpatial<strong>Wizard</strong>Action allows you to show an AWT wizard before creating the Spatial. You can also just implement the base ServiceProvider class and return any kind of action (such as a wizard), in this case you have to handle the threading yourself!</p><p><p><div>Note that the classes you create are singletons which are used across multiple nodes and you should not store any data in local variables! </div></p></p><p>To add a new Tool, create a new AbstractToolAction:</p><pre>@org.openide.util.lookup.ServiceProvider&#40;service = ToolAction.class&#41;
&#125;</pre>
</div>
<h2><a>Adding items to the add and tools menus</a></h2>
<div>
<p>
For adding Spatials, Contols and for general tools theres premade abstract classes that you can use to extend the options. Undo/Redo is handled by the abstract class. AbstractNewSpatial<strong>Wizard</strong>Action allows you to show an AWT wizard before creating the Spatial. You can also just implement the base ServiceProvider class and return any kind of action (such as a wizard), in this case you have to handle the threading yourself!
</p>
<p>
<p><div>Note that the classes you create are singletons which are used across multiple nodes and you should not store any data in local variables!
</div></p>
</p>
<p>
To add a new Tool, create a new AbstractToolAction:
</p>
<pre>@org.openide.util.lookup.ServiceProvider&#40;service = ToolAction.class&#41;
public class GenerateTangentsTool extends AbstractToolAction &#123;
&nbsp;
public GenerateTangentsTool&#40;&#41; &#123;
@ -184,7 +249,12 @@ public class GenerateTangentsTool extends AbstractToolAction &#123;
return JmeGeometry.class;
&#125;
&nbsp;
&#125;</pre><p>For a new Spatial or Control, use AbstractNewSpatialAction</p><pre>@org.openide.util.lookup.ServiceProvider&#40;service = NewSpatialAction.class&#41;
&#125;</pre>
<p>
For a new Spatial or Control, use AbstractNewSpatialAction
</p>
<pre>@org.openide.util.lookup.ServiceProvider&#40;service = NewSpatialAction.class&#41;
public class NewSpecialSpatialAction extends AbstractNewSpatialAction &#123;
&nbsp;
public NewSpecialSpatialAction&#40;&#41; &#123;
@ -196,7 +266,12 @@ public class NewSpecialSpatialAction extends AbstractNewSpatialAction &#123;
Spatial spatial=new Node&#40;&#41;;
return spatial;
&#125;
&#125;</pre><p>or AbstractNewControlAction:</p><pre>@org.openide.util.lookup.ServiceProvider&#40;service = NewControlAction.class&#41;
&#125;</pre>
<p>
or AbstractNewControlAction:
</p>
<pre>@org.openide.util.lookup.ServiceProvider&#40;service = NewControlAction.class&#41;
public class NewRigidBodyAction extends AbstractNewControlAction &#123;
&nbsp;
public NewRigidBodyAction&#40;&#41; &#123;

@ -0,0 +1,43 @@
<h1><a>jMonkeyEngine SDK Log Files</a></h1>
<div>
<p>
You find the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> log file in <code>/dev/var/log/messages.log</code> in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> preferences folder. You can learn the location of the preferences folder in the “About” screen of the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> under the label <strong>Userdir</strong>.
</p>
<ul>
<li><div> Windows: <code>C:\Documents and Settings\YOUR_NAME\.jmonkeyplatform\</code></div>
</li>
<li><div> Linux: <code>/home/YOUR_NAME/.jmonkeyplatform/</code></div>
</li>
<li><div> Mac <acronym title="Operating System">OS</acronym>: <code>/Users/YOUR_NAME/Library/Application Support/jmonkeyplatform/</code></div>
</li>
</ul>
<p>
The message log contains all paths and <a href="/com/jme3/gde/core/docs/jme3/advanced/read_graphic_card_capabilites.html">capabilities</a> used in your development system, and also warnings, e.g. if a plugin crashed.
</p>
</div>
<h2><a>Example Log</a></h2>
<div>
<pre>&gt;Log Session: Saturday, September 24, 2011 10:45:30 AM CEST
&gt;System Info:
Product Version = jMonkeyPlatform Alpha-4
Operating System = Mac OS X version 10.6.8 running on i386
Java; VM; Vendor = 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02-384; Apple Inc.
Runtime = Java(TM) SE Runtime Environment 1.6.0_26-b03-384-10M3425
Java Home = /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
System Locale; Encoding = de_DE (jmonkeyplatform); MacRoman
Home Directory = /Users/joemonkey
Current Directory = /
User Directory = /Users/joemonkey/Library/Application Support/jmonkeyplatform/dev
Installation = /Applications/jmonkeyplatform.app/Contents/Resources/jmonkeyplatform/jmonkeyplatform
...</pre>
</div>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:log_files?do=export_xhtmlbody">view online version</a></em></p>

@ -1,4 +1,37 @@
<h1><a>The Material Editor</a></h1><div><p>If you are looking for background information, read about <a href="/com/jme3/gde/core/docs/jme3/advanced/material_definitions.html">Material Definitions</a> and <a href="/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html">j3M Material Files</a>. You can <a href="/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html">write .j3m files in a text editor</a>, or <span><a href="/com/jme3/gde/core/docs/sdk/material_editing.html">use the jMonkeyEngine SDK to generate</a></span> them for you as described in this article.</p></div><h2><a>Materials</a></h2><div><p>The jMonkeyEngine uses a special Material format, which comes in .j3m files. You use .j3m files to store sets of material properties that you use repeatedly. This enables you write one short line of code that simply loads the presets from a custom .j3m file. Without a .j3m file you need to write several lines of material property setters every time when you want to use a non-default material.</p></div><h2><a>Creating .j3m Materials</a></h2><div><p><img src="nbdocs:/com/jme3/gde/core/docs/sdk/material-editor.png"></p><p>To create new .j3m files in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>,</p><ol><li><div>Right-click the <code>assets/Materials</code> directory and choose New… &gt; Other.</div>
<h1><a>The Material Editor</a></h1>
<div>
<p>
If you are looking for background information, read about <a href="/com/jme3/gde/core/docs/jme3/advanced/material_definitions.html">Material Definitions</a> and <a href="/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html">j3M Material Files</a>.
You can <a href="/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html">write .j3m files in a text editor</a>, or <span><a href="/com/jme3/gde/core/docs/sdk/material_editing.html">use the jMonkeyEngine SDK to generate</a></span> them for you as described in this article.
</p>
</div>
<h2><a>Materials</a></h2>
<div>
<p>
The jMonkeyEngine uses a special Material format, which comes in .j3m files. You use .j3m files to store sets of material properties that you use repeatedly. This enables you write one short line of code that simply loads the presets from a custom .j3m file. Without a .j3m file you need to write several lines of material property setters every time when you want to use a non-default material.
</p>
</div>
<h2><a>Creating .j3m Materials</a></h2>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/sdk/material-editor.png">
</p>
<p>
To create new .j3m files in the jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym>,
</p>
<ol>
<li><div> Right-click the <code>assets/Materials</code> directory and choose New… &gt; Other.</div>
</li>
<li><div> In the New File Wizard, choose Material &gt; Empty Material File, and click Next.</div>
</li>

@ -1,4 +1,49 @@
<h1><a>jMonkeyEngine SDK: Creating Projects</a></h1><div><p>The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> makes it easy to get started with developing 3-D games based on the jMonkeyEngine.</p></div><h2><a>Creating a New jMonkeyEngine Project</a></h2><div><ol><li><div>Choose File &gt; New Project from the main menu.</div></li><li><div>In the New Project Wizard, select the template JME3 &gt; Basic Game</div></li><li><div>Click next to specify a project name, and the path where to store your new project.</div></li><li><div>Click Finish. A skeleton application is created and opens in the Project Explorer.</div><ul><li><div>This basic jme3 application is based on the SimpleApplication class to allow an easy start with jme3.</div></li><li><div>You can click the run button to run it: You will see a jMonkey cube.</div></li></ul></li></ol></div><h4><a>Project Structure</a></h4><div><p><img src="nbdocs:/com/jme3/gde/core/docs/sdk/jmonkeyplatform-docu-4.png"></p><p>Let&#039;s have a look at the abstract project structure in the Project Explorer (ctrl-1).</p><ul><li><div><strong>Project Assets node:</strong> These directories have been created for you to store your games assets, such as fonts, materials, models, shaders, sounds, and textures. For a newly created project, these directories are empty.</div>
<h1><a>jMonkeyEngine SDK: Creating Projects</a></h1>
<div>
<p>
The jMonkeyEngine <acronym title="Software Development Kit">SDK</acronym> makes it easy to get started with developing 3-D games based on the jMonkeyEngine.
</p>
</div>
<h2><a>Creating a New jMonkeyEngine Project</a></h2>
<div>
<ol>
<li><div> Choose File &gt; New Project from the main menu.</div>
</li>
<li><div> In the New Project Wizard, select the template JME3 &gt; Basic Game</div>
</li>
<li><div> Click next to specify a project name, and the path where to store your new project.</div>
</li>
<li><div> Click Finish. A skeleton application is created and opens in the Project Explorer.</div>
<ul>
<li><div> This basic jme3 application is based on the SimpleApplication class to allow an easy start with jme3.</div>
</li>
<li><div> You can click the run button to run it: You will see a jMonkey cube.</div>
</li>
</ul>
</li>
</ol>
</div>
<h4><a>Project Structure</a></h4>
<div>
<p>
<img src="nbdocs:/com/jme3/gde/core/docs/sdk/jmonkeyplatform-docu-4.png">
</p>
<p>
Let&#039;s have a look at the abstract project structure in the Project Explorer (ctrl-1).
</p>
<ul>
<li><div> <strong>Project Assets node:</strong> These directories have been created for you to store your games assets, such as fonts, materials, models, shaders, sounds, and textures. For a newly created project, these directories are empty.</div>
</li>
<li><div> <strong>Source Packages node:</strong> This is where you manage your packages and classes. For a newly created project, it contains one package and one class, <code>Main.java</code>. Double click <code>Main.java</code> to open it in the editor.</div>
</li>

@ -1,4 +1,36 @@
<h1><a>Overview</a></h1><div><p>The terrain editor lets you create, modify, and paint terrain. <img src="/wiki/lib/exe/fetch.php"></p></div><h2><a>Controls</a></h2><div><p>Terrain controls are the same as the Scene Composer, you rotate the camera with the left mouse button and pan the camera with the right mouse button. Until you select one of the terrain tools in the toolbar, then the controls change for that tool. Then left mouse button will use that tool: painting, raising/lowering terrain, etc. The right mouse button might do something, depending on the tool.</p></div><h2><a>Creating Terrain</a></h2><div><p>To create terrain, first select a node (probably your root node) in your scene.<br/> <img src="nbdocs:/com/jme3/gde/core/docs/sdk/sdk-terrain-tut-selectnode.png"><br/> Then click the add terrain button.<br/> <img src="nbdocs:/com/jme3/gde/core/docs/sdk/sdk-terrain-tut-addterrain.png"><br/> This will pop up the Create Terrain wizard that will walk you through the steps for creating terrain. Make sure you decide now how large you want your terrain to be and how detailed you want the textures to be as you cannot change it later on!
<h1><a>Overview</a></h1>
<div>
<p>
The terrain editor lets you create, modify, and paint terrain.
<img src="/wiki/lib/exe/fetch.php">
</p>
</div>
<h2><a>Controls</a></h2>
<div>
<p>
Terrain controls are the same as the Scene Composer, you rotate the camera with the left mouse button and pan the camera with the right mouse button. Until you select one of the terrain tools in the toolbar, then the controls change for that tool. Then left mouse button will use that tool: painting, raising/lowering terrain, etc. The right mouse button might do something, depending on the tool.
</p>
</div>
<h2><a>Creating Terrain</a></h2>
<div>
<p>
To create terrain, first select a node (probably your root node) in your scene.<br/>
<img src="nbdocs:/com/jme3/gde/core/docs/sdk/sdk-terrain-tut-selectnode.png"><br/>
Then click the add terrain button.<br/>
<img src="nbdocs:/com/jme3/gde/core/docs/sdk/sdk-terrain-tut-addterrain.png"><br/>
This will pop up the Create Terrain wizard that will walk you through the steps for creating terrain. Make sure you decide now how large you want your terrain to be and how detailed you want the textures to be as you cannot change it later on!
</p>
<p>

@ -1,2 +1,31 @@
<h2><a>Troubleshooting jMonkeyEngine3 SDK</a></h2><div></div><h3><a>Specifying the JDK location</a></h3><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.</p><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>.</p></div><h3><a>Known Issues</a></h3><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>
<h2><a>Troubleshooting jMonkeyEngine3 SDK</a></h2>
<div>
</div>
<h3><a>Specifying the JDK location</a></h3>
<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.
</p>
<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>.
</p>
</div>
<h3><a>Known Issues</a></h3>
<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>
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/sdk:troubleshooting?do=export_xhtmlbody">view online version</a></em></p>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,6 +1,7 @@
javahelp_path = com/jme3/gde/core/docs/
wiki_url = http://jmonkeyengine.org/wiki/doku.php/
wiki_pages = sdk:project_creation,\
sdk:3ds_to_blender_to_jmp,\
sdk:application_deployment,\
sdk:asset_packs,\
sdk:blender,\
@ -8,6 +9,7 @@ sdk:code_editor,\
sdk:debugging_profiling_testing,\
sdk:default_build_script,\
sdk:filters,\
sdk:log_files,\
sdk:material_editing,\
sdk:model_loader_and_viewer,\
sdk:project_creation,\
@ -45,12 +47,14 @@ jme3:intermediate:simpleapplication,\
jme3:advanced:3d_models,\
jme3:advanced:animation,\
jme3:advanced:application_states,\
jme3:advanced:appstatesdemo,\
jme3:advanced:asset_manager,\
jme3:advanced:audio,\
jme3:advanced:audio_environment_presets,\
jme3:advanced:bloom_and_glow,\
jme3:advanced:bullet_multithreading,\
jme3:advanced:camera,\
jme3:advanced:capture_audio_video_to_a_file,\
jme3:advanced:cinematics,\
jme3:advanced:collision_and_intersection,\
jme3:advanced:combo_moves,\
@ -59,6 +63,7 @@ jme3:advanced:custom_meshes,\
jme3:advanced:debugging,\
jme3:advanced:effects_overview,\
jme3:advanced:endless_terraingrid,\
jme3:advanced:fade,\
jme3:advanced:headless_server,\
jme3:advanced:hinges_and_joints,\
jme3:advanced:hud,\
@ -83,7 +88,9 @@ jme3:advanced:nifty_gui,\
jme3:advanced:nifty_gui_java_interaction,\
jme3:advanced:nifty_gui_java_layout,\
jme3:advanced:nifty_gui_overlay,\
jme3:advanced:nifty_gui_popup_menu,\
jme3:advanced:nifty_gui_projection,\
jme3:advanced:nifty_gui_scenarios,\
jme3:advanced:nifty_gui_xml_layout,\
jme3:advanced:open_game_finder,\
jme3:advanced:particle_emitters,\

Loading…
Cancel
Save