From 90ad508aa05a576b9f9acec7d22381571e38751a Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Mon, 2 Jan 2012 20:58:48 +0000 Subject: [PATCH] SDK: - update manual from wiki git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8975 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../core/docs/jme3/advanced/3d_models.html | 85 +-- .../core/docs/jme3/advanced/animation.html | 354 +------------ .../docs/jme3/advanced/asset_manager.html | 2 +- .../gde/core/docs/jme3/advanced/audio.html | 84 +-- .../advanced/audio_environment_presets.html | 147 +----- .../docs/jme3/advanced/bloom_and_glow.html | 250 +-------- .../jme3/advanced/bullet_multithreading.html | 47 +- .../core/docs/jme3/advanced/cinematics.html | 384 +------------- .../core/docs/jme3/advanced/combo_moves.html | 40 +- .../docs/jme3/advanced/effects_overview.html | 202 +------- .../docs/jme3/advanced/hinges_and_joints.html | 100 +--- .../jme3/advanced/j3m_material_files.html | 36 +- .../docs/jme3/advanced/loading_screen.html | 77 +-- .../core/docs/jme3/advanced/localization.html | 134 +---- .../gde/core/docs/jme3/advanced/logging.html | 65 +-- .../making_the_camera_follow_a_character.html | 77 +-- .../jme3/advanced/materials_overview.html | 353 +------------ .../core/docs/jme3/advanced/motionpath.html | 113 +--- .../docs/jme3/advanced/mouse_picking.html | 43 +- .../jme3/advanced/multiple_camera_views.html | 175 +------ .../docs/jme3/advanced/multithreading.html | 146 +----- .../core/docs/jme3/advanced/networking.html | 224 ++++---- .../core/docs/jme3/advanced/nifty_gui.html | 19 +- .../advanced/nifty_gui_java_interaction.html | 72 +-- .../docs/jme3/advanced/nifty_gui_overlay.html | 48 +- .../jme3/advanced/nifty_gui_projection.html | 84 +-- .../jme3/advanced/nifty_gui_xml_layout.html | 279 +--------- .../docs/jme3/advanced/open_game_finder.html | 195 +------ .../docs/jme3/advanced/particle_emitters.html | 84 +-- .../gde/core/docs/jme3/advanced/physics.html | 167 +----- .../docs/jme3/advanced/physics_listeners.html | 73 +-- .../remote-controlling_the_camera.html | 46 +- .../docs/jme3/advanced/save_and_load.html | 45 +- .../jme3/gde/core/docs/jme3/advanced/sky.html | 94 +--- .../gde/core/docs/jme3/advanced/spatial.html | 37 +- .../gde/core/docs/jme3/advanced/terrain.html | 115 +--- .../docs/jme3/advanced/terrain_collision.html | 15 +- .../gde/core/docs/jme3/advanced/vehicles.html | 111 +--- .../docs/jme3/advanced/walking_character.html | 241 +-------- .../gde/core/docs/jme3/advanced/water.html | 35 +- .../docs/jme3/beginner/hello_animation.html | 161 +----- .../core/docs/jme3/beginner/hello_asset.html | 77 +-- .../core/docs/jme3/beginner/hello_audio.html | 18 +- .../docs/jme3/beginner/hello_collision.html | 99 +--- .../docs/jme3/beginner/hello_effects.html | 155 +----- .../jme3/beginner/hello_input_system.html | 89 +--- .../jme3/beginner/hello_main_event_loop.html | 20 +- .../docs/jme3/beginner/hello_material.html | 22 +- .../core/docs/jme3/beginner/hello_node.html | 90 +--- .../docs/jme3/beginner/hello_terrain.html | 24 +- .../core/docs/jme3/build_from_sources.html | 56 +- .../com/jme3/gde/core/docs/jme3/faq.html | 489 ++---------------- .../docs/jme3/intermediate/appsettings.html | 100 +--- .../jme3/intermediate/best_practices.html | 46 +- .../docs/jme3/intermediate/file_types.html | 78 +-- .../jme3/intermediate/headlessserver.html | 367 +------------ .../docs/jme3/intermediate/optimization.html | 45 +- .../jme3/intermediate/simpleapplication.html | 42 +- .../com/jme3/gde/core/docs/jme3/math.html | 147 +----- ...impleapplication_from_the_commandline.html | 89 +--- .../jme3/gde/core/docs/jme3/terminology.html | 116 +---- .../gde/core/docs/jme3/the_scene_graph.html | 98 +--- .../com/jme3/gde/core/docs/jme3/webstart.html | 99 +--- .../core/docs/sdk/application_deployment.html | 46 +- .../jme3/gde/core/docs/sdk/asset_packs.html | 25 +- .../com/jme3/gde/core/docs/sdk/blender.html | 42 +- .../jme3/gde/core/docs/sdk/code_editor.html | 92 +--- .../docs/sdk/debugging_profiling_testing.html | 38 +- .../jme3/gde/core/docs/sdk/development.html | 60 +-- .../docs/sdk/development/model_loader.html | 30 +- .../docs/sdk/development/projects_assets.html | 43 +- .../gde/core/docs/sdk/development/scene.html | 96 +--- .../docs/sdk/development/sceneexplorer.html | 85 +-- .../gde/core/docs/sdk/material_editing.html | 35 +- .../gde/core/docs/sdk/project_creation.html | 47 +- .../gde/core/docs/sdk/terrain_editor.html | 34 +- .../gde/core/docs/sdk/troubleshooting.html | 31 +- .../gde/core/docs/sdk/version_control.html | 126 +---- 78 files changed, 366 insertions(+), 7889 deletions(-) diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/3d_models.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/3d_models.html index 7057315e0..141a96512 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/3d_models.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/3d_models.html @@ -1,84 +1,3 @@ - -

Models and Scenes

-
- -

- -Like Shapes, 3D models are also made up of Meshes, but models are more complex than Shapes. While Shapes are built into jME3, you typically create models in external 3D Mesh Editors. -

- -
- -

Using Models and Scenes with jME3

-
- -

- -To use 3D models in a jME3 application: -

-
    -
  1. Export the 3D model in Ogre XML or Wavefront OBJ format. Export Scenes as Ogre DotScene format.
    -
  2. -
  3. Save the files into a subdirectory of your jME3 project's assets directory.
    -
  4. -
  5. In your code, you use the Asset Manager to load models as Spatials into a jME application.
    Spatial model = assetManager.loadModel(
    -    "Models/MonkeyHead/MonkeyHead.mesh.xml" );
    -
    -
  6. -
  7. (For the release build:) Use the jMonkeyEngine SDK to convert models to .j3o format. You don't need this step as long you still develop and test the aplication within the jMonkeyEngine SDK.
    -
  8. -
- -
- -

Creating Models and Scenes

-
- -

- -To create 3D models and scenes, you need a 3D Mesh Editor such as , with an OgreXML Exporter plugin. -

- -

-Tip: Consider creating for more complex models, it looks more professional. -

- -

-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: -

- -

-To export your models as Ogre XML meshes with materials: -

-
    -
  1. Open the menu File > Export > OgreXML Exporter to open the exporter dialog.
    -
  2. -
  3. In the Export Materials field: Give the material the same name as the model. For example, the model something.mesh.xml goes with something.material, plus (optionally) something.skeleton.xml, and some JPG files.
    -
  4. -
  5. In the Export Meshes field: Select a target subdirectory of your assets/Models/ directory. E.g. assets/Models/something/.
    -
  6. -
  7. Activate the following exporter settings:
    -
      -
    • Copy Textures: YES
      -
    • -
    • Rendering Materials: YES
      -
    • -
    • Flip Axis: YES
      -
    • -
    • Require Materials: YES
      -
    • -
    • Skeleton name follows mesh: YES
      -
    • -
    -
  8. -
  9. Click export.
    -
  10. -
- -

- -You can now use the jMonkeyEngine SDK to load and view models. You can create scenes from them and write cde that loads them into your application. -

- -
+

Models and Scenes

Like Shapes, 3D models are also made up of Meshes, but models are more complex than Shapes. While Shapes are built into jME3, you typically create models in external 3D Mesh Editors.

Using Models and Scenes with jME3

To use 3D models in a jME3 application:

  1. Export the 3D model in Ogre XML or Wavefront OBJ format. Export Scenes as Ogre DotScene format.
  2. Save the files into a subdirectory of your jME3 project's assets directory.
  3. In your code, you use the Asset Manager to load models as Spatials into a jME application.
    Spatial model = assetManager.loadModel(
    +    "Models/MonkeyHead/MonkeyHead.mesh.xml" );
  4. (For the release build:) Use the jMonkeyEngine SDK to convert models to .j3o format. You don't need this step as long you still develop and test the aplication within the jMonkeyEngine SDK.

Creating Models and Scenes

To create 3D models and scenes, you need a 3D Mesh Editor such as , with an OgreXML Exporter plugin.

Tip: Consider creating for more complex models, it looks more professional.

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:

To export your models as Ogre XML meshes with materials:

  1. Open the menu File > Export > OgreXML Exporter to open the exporter dialog.
  2. In the Export Materials field: Give the material the same name as the model. For example, the model something.mesh.xml goes with something.material, plus (optionally) something.skeleton.xml, and some JPG files.
  3. In the Export Meshes field: Select a target subdirectory of your assets/Models/ directory. E.g. assets/Models/something/.
  4. Activate the following exporter settings:
    • Copy Textures: YES
    • Rendering Materials: YES
    • Flip Axis: YES
    • Require Materials: YES
    • Skeleton name follows mesh: YES
  5. Click export.

You can now use the jMonkeyEngine SDK to load and view models. You can create scenes from them and write cde that loads them into your application.

view online version

\ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/animation.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/animation.html index 1928b05cb..53498fc03 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/animation.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/animation.html @@ -1,286 +1,9 @@ - -

Animation in jME3

-
- -

- -In 3D games, you do not only load static 3D models, you also want to be able to trigger animations in the model from the Java code. Animated models must be created in an external mesh editor (for example, Blender). -

- -

-What is required for the model? -

-
    -
  1. For each model, you have to define a skeleton (bones rigging).
    -
  2. -
  3. For each motion, you have to specify how it distorts the model (skinning).
    -
  4. -
  5. For each animation, you have to specify a series of snapshots of how the bones are positioned (keyframes).
    -
  6. -
  7. One model can contain several animations. You give every animation a name when you save it in the mesh editor.
    -
  8. -
- -

- -More information: Animation -

- -

-What is required in your java class? -

- - -
- -

Code Samples

-
- - -
- -

Controlling Animations

-
- -
- -

The Controller

-
- -

- -Create one com.jme3.animation.AnimControl object in your JME3 application for each animated model that you want to control. You have to register each animated model to one of these Animation Controllers. The control object gives you access to the available animation sequences in the model. -

-
  AnimControl playerControl; // you need one controller per model
+

Animation in jME3

In 3D games, you do not only load static 3D models, you also want to be able to trigger animations in the model from the Java code. Animated models must be created in an external mesh editor (for example, Blender).

What is required for the model?

  1. For each model, you have to define a skeleton (bones rigging).
  2. For each motion, you have to specify how it distorts the model (skinning).
  3. For each animation, you have to specify a series of snapshots of how the bones are positioned (keyframes).
  4. One model can contain several animations. You give every animation a name when you save it in the mesh editor.

More information: Animation

What is required in your java class?

  • One animation controller per animated Model
  • As many channels per controller as you need to play several animations in parallel. In simple cases one channel is enough, sometimes you need two or more per model.

Code Samples

Controlling Animations

The Controller

Create one com.jme3.animation.AnimControl object in your JME3 application for each animated model that you want to control. You have to register each animated model to one of these Animation Controllers. The control object gives you access to the available animation sequences in the model.

  AnimControl playerControl; // you need one controller per model
   Node player = (Node) assetManager.loadModel("Models/Oto/Oto.mesh.xml"); // load a model
   playerControl = player.getControl(AnimControl.class); // get control over this model
-  playerControl.addListener(this); // add listener
- -
- -

Channels

-
- -

- -A controller has several animation channels (com.jme3.animation.AnimChannel). Each channel can play one animation sequence at a time. -

- -

-There often are situations where you want to run several animation sequences at the same time, e.g. "shooting while walking" or "boxing while jumping". In this case, you create several channels, assign an animation to each, and play them in parallel. -

-
  AnimChannel channel_walk = playerControl.createChannel();
+  playerControl.addListener(this); // add listener

Channels

A controller has several animation channels (com.jme3.animation.AnimChannel). Each channel can play one animation sequence at a time.

There often are situations where you want to run several animation sequences at the same time, e.g. "shooting while walking" or "boxing while jumping". In this case, you create several channels, assign an animation to each, and play them in parallel.

  AnimChannel channel_walk = playerControl.createChannel();
   AnimChannel channel_jump = playerControl.createChannel();
-  ...
- -

-To reset a controller, call control.clearChannels(); -

- -
- -

Animation Control Properties

-
- -

- -The following information is available for an AnimControl. - -

-
- - - - - - - - - - - - - - - - - - -
AnimControl PropertyUsage
createChannel()Returns a new channel, controlling all bones by default.
getNumChannels()The number of channels registered to this Control.
getChannel(0)Gets individual channels by index number. At most getNumChannels().
clearChannels()Clear all channels in this control.
addListener(animEventListener)
-removeListener(animEventListener)
-clearListeners()
Adds or removes listeners to receive animation related events.
-
- - - - - - - - - - - - - - - - - - -
AnimControl PropertyUsage
setAnimations(aniHashMap)Sets the animations that this AnimControl is capable of playing. The animations must be compatible with the skeleton given in the constructor.
addAnim(boneAnim)
-removeAnim(boneAnim)
Adds or removes an animation from this Control.
getAnimationNames()A String Collection of names of all animations that this Control can play for this model.
getAnim("anim")Retrieve an animation from the list of animations.
getAnimationLength("anim")Returns the length of the given named animation in seconds
-
- - - - - - - - - - - - -
AnimControl PropertyUsage
getSkeleton()The Skeleton object controlled by this Control.
getTargets()The Skin objects controlled by this Control, as Mesh array.
getAttachmentsNode("bone")Returns the attachment node of a bone. Attach models and effects to this node to make them follow this bone's motions.
- -
- -

Animation Channel Properties

-
- -

- -The following properties are set per AnimChannel. - -

-
- - - - - - - - - - - - - - - - - - -
AnimChannel PropertyUsage
setLoopMode(LoopMode.Loop); From now on, the animation on this channel will repeat from the beginning when it ends.
setLoopMode(LoopMode.DontLoop); From now on, the animation on this channel will play once, and the freeze at the last keyframe.
setLoopMode(LoopMode.Cycle); From now on, the animation on this channel will play forward, then backward, then again forward, and so on.
setSpeed(1f); From now on, play this animation slower (<1f) or faster (>1f), or with default speed (1f).
setTime(1.3f); Fast-forward or rewind to a certain moment in time of this animation.
- -

- -The following information is available for a channel. - -

-
- - - - - - - - - - - - - - - - - - -
AnimChannel PropertyUsage
getAnimationName()The name of the animation playing on this channel. Returns null when no animation is playing.
getLoopMode()The current loop mode on this channel. The returned com.jme3.animation enum can be LoopMode.Loop, LoopMode.DontLoop, or LoopMode.Cycle.
getAnimMaxTime()The total length of the animation on this channel. Or 0f if nothing is playing.
getTime()How long the animation on this channel has been playing. It returns 0f if the channel has not started playing yet, or a value up to getAnimMaxTime().
getControl()The AnimControl that belongs to this AnimChannel.
- -

- -Use the following methods to add or remove individual bones to an AnimChannel. This is useful when you play two animations in parallel on two channels, and each controls a subset of the bones (e.g. one the arms, and the other the legs). - -

-
- - - - - - - - - - - - - - - -
AnimChannel MethodsUsage
addAllBones()Add all the bones of the model's skeleton to be influenced by this animation channel. (default)
addBone("bone1")
-addBone(bone1)
Add a single bone to be influenced by this animation channel.
addToRootBone("bone1")
-addToRootBone(bone1)
Add a series of bones to be influenced by this animation channel: Add all bones, starting from the given bone, to the root bone.
addFromRootBone("bone1")
-addFromRootBone(bone1)
Add a series of bones to be influenced by this animation channel: Add all bones, starting from the given root bone, going towards the children bones.
- -
- -

Playing Animations

-
- -

- -Animations are played by channel. Note: Whether the animation channel plays continuously or only once, depends on the Loop properties you have set. - -

-
- - - - - - -
Channel MethodUsage
channel_walk.setAnim("Walk",0.50f); Start the animation named "Walk" on channel channel_walk.
-The float value specifies the time how long the animation should overlap with the previous one on this channel. If set to 0f, then no blending will occur and the new animation will be applied instantly.
- -

- -Tip: Use the AnimEventLister below to react at the end or start of an animation cycle. -

- -
- -

Usage Example

-
- -

- -In this short example, we define the space key to trigger playing the "Walk" animation on channel2. -

-
  public void simpleInitApp() {
+  ...

To reset a controller, call control.clearChannels();

Animation Control Properties

The following information is available for an AnimControl.

AnimControl PropertyUsage
createChannel()Returns a new channel, controlling all bones by default.
getNumChannels()The number of channels registered to this Control.
getChannel(0)Gets individual channels by index number. At most getNumChannels().
clearChannels()Clear all channels in this control.
addListener(animEventListener)
removeListener(animEventListener)
clearListeners()
Adds or removes listeners to receive animation related events.
AnimControl PropertyUsage
setAnimations(aniHashMap)Sets the animations that this AnimControl is capable of playing. The animations must be compatible with the skeleton given in the constructor.
addAnim(boneAnim)
removeAnim(boneAnim)
Adds or removes an animation from this Control.
getAnimationNames()A String Collection of names of all animations that this Control can play for this model.
getAnim("anim")Retrieve an animation from the list of animations.
getAnimationLength("anim")Returns the length of the given named animation in seconds
AnimControl PropertyUsage
getSkeleton()The Skeleton object controlled by this Control.
getTargets()The Skin objects controlled by this Control, as Mesh array.
getAttachmentsNode("bone")Returns the attachment node of a bone. Attach models and effects to this node to make them follow this bone's motions.

Animation Channel Properties

The following properties are set per AnimChannel.

AnimChannel PropertyUsage
setLoopMode(LoopMode.Loop);From now on, the animation on this channel will repeat from the beginning when it ends.
setLoopMode(LoopMode.DontLoop);From now on, the animation on this channel will play once, and the freeze at the last keyframe.
setLoopMode(LoopMode.Cycle);From now on, the animation on this channel will play forward, then backward, then again forward, and so on.
setSpeed(1f);From now on, play this animation slower (<1f) or faster (>1f), or with default speed (1f).
setTime(1.3f);Fast-forward or rewind to a certain moment in time of this animation.

The following information is available for a channel.

AnimChannel PropertyUsage
getAnimationName()The name of the animation playing on this channel. Returns null when no animation is playing.
getLoopMode()The current loop mode on this channel. The returned com.jme3.animation enum can be LoopMode.Loop, LoopMode.DontLoop, or LoopMode.Cycle.
getAnimMaxTime()The total length of the animation on this channel. Or 0f if nothing is playing.
getTime()How long the animation on this channel has been playing. It returns 0f if the channel has not started playing yet, or a value up to getAnimMaxTime().
getControl()The AnimControl that belongs to this AnimChannel.

Use the following methods to add or remove individual bones to an AnimChannel. This is useful when you play two animations in parallel on two channels, and each controls a subset of the bones (e.g. one the arms, and the other the legs).

AnimChannel MethodsUsage
addAllBones()Add all the bones of the model's skeleton to be influenced by this animation channel. (default)
addBone("bone1")
addBone(bone1)
Add a single bone to be influenced by this animation channel.
addToRootBone("bone1")
addToRootBone(bone1)
Add a series of bones to be influenced by this animation channel: Add all bones, starting from the given bone, to the root bone.
addFromRootBone("bone1")
addFromRootBone(bone1)
Add a series of bones to be influenced by this animation channel: Add all bones, starting from the given root bone, going towards the children bones.

Playing Animations

Animations are played by channel. Note: Whether the animation channel plays continuously or only once, depends on the Loop properties you have set.

Channel MethodUsage
channel_walk.setAnim("Walk",0.50f);Start the animation named "Walk" on channel channel_walk.
The float value specifies the time how long the animation should overlap with the previous one on this channel. If set to 0f, then no blending will occur and the new animation will be applied instantly.

Tip: Use the AnimEventLister below to react at the end or start of an animation cycle.

Usage Example

In this short example, we define the space key to trigger playing the "Walk" animation on channel2.

  public void simpleInitApp() {
     ...
     inputManager.addMapping("Walk", new KeyTrigger(KeyInput.KEY_SPACE));
     inputManager.addListener(actionListener, "Walk");
@@ -296,81 +19,18 @@ In this short example, we define the space key to trigger playing the "Walk
         }
       }
     }
-  };
- -
- -

Animation Event Listener

-
- -

- -A jME3 application that contains animations can implement the com.jme3.animation.AnimEventListener interface. -

-
public class HelloAnimation extends SimpleApplication
-                     implements AnimEventListener { ... }
- -

-This optional Listener enables you to respond to animation start and end events, onAnimChange() and onAnimCycleDone(). -

- -
- -

Responding to Animation End

-
- -

- -The onAnimCycleDone() event is invoked when an animation cycle has ended. For non-looping animations, this event is invoked when the animation is finished playing. For looping animations, this event is invoked each time the animation loop is restarted. -

- -

-You have access to the following objects: -

-
    -
  • The controller to which the listener is assigned.
    -
  • -
  • The animation channel being played.
    -
  • -
  • The name of the animation that has just finished playing.
    -
  • -
-
  public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
+  };

Animation Event Listener

A jME3 application that contains animations can implement the com.jme3.animation.AnimEventListener interface.

public class HelloAnimation extends SimpleApplication
+                     implements AnimEventListener { ... }

This optional Listener enables you to respond to animation start and end events, onAnimChange() and onAnimCycleDone().

Responding to Animation End

The onAnimCycleDone() event is invoked when an animation cycle has ended. For non-looping animations, this event is invoked when the animation is finished playing. For looping animations, this event is invoked each time the animation loop is restarted.

You have access to the following objects:

  • The controller to which the listener is assigned.
  • The animation channel being played.
  • The name of the animation that has just finished playing.
  public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
     // test for a condition you are interested in, e.g. ...
     if (animName.equals("Walk")) {
       // respond to the event here, e.g. ...
       channel.setAnim("Stand", 0.50f);
     }
-  }
- -
- -

Responding to Animation Start

-
- -

- -The onAnimChange() event is invoked every time before an animation is set by the user to be played on a given channel (channel.setAnim()). -

- -

-You have access to the following objects -

-
    -
  • The controller to which the listener is assigned.
    -
  • -
  • The animation channel being played.
    -
  • -
  • The name of the animation that will start playing.
    -
  • -
-
  public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
+  }

Responding to Animation Start

The onAnimChange() event is invoked every time before an animation is set by the user to be played on a given channel (channel.setAnim()).

You have access to the following objects

  • The controller to which the listener is assigned.
  • The animation channel being played.
  • The name of the animation that will start playing.
  public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
     // test for a condition you are interested in, e.g. ...
     if (animName.equals("Walk")) {
       // respond to the event here, e.g. ...
       channel.setAnim("Reset", 0.50f);
     }
-  }
- -
+ }

view online version

\ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html index b61327a42..b5d5cadad 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html @@ -174,7 +174,7 @@ If you use the default build script created by the jMonkeyEngine SDK's context menu action to convert OgreXML models to .j3o format.

    -
  1. Open the kME3 Project in the jMonkeyEngine SDK.
    +
  2. Open the jME3 Project in the jMonkeyEngine SDK.
  3. Browse the assets directory in the Projects window.
  4. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio.html index d66889707..92ce88f82 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio.html @@ -1,86 +1,4 @@ - -

    Audio in jME3

    -
    - -

    - -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. -

    - -

    -Place audio files in the assets/Sound/ directory of your project. jME3 supports Ogg Vorbis (.ogg) and Wave (.wav) formats. -

    - -
    - -

    Creating Audio Nodes: Streamed or Buffered

    -
    - -

    - -The main class to look at is com.jme3.audio.AudioNode. - -

    -
      -
    • Buffered: 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:
      AudioNode boom = new AudioNode(assetManager, "Sound/boom.wav");
      -
      -
    • -
    • Streamed: 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:
      AudioNode music = new AudioNode(assetManager, "Sound/music.wav", true);
      -
      -
    • -
    - -
    - -

    Getting AudioNode Properties

    -
    -
    - - - - - - - - - - - - -
    AudioNode MethodUsage
    getStatus()Returns either Status.Playing, Status.Stopped, or Status.Paused.
    getVolume()Returns the volume.
    getPitch()Returns the pitch.
    - -

    - -There are other obvious getters to poll the status of corresponding setters below. -

    - -
    - -

    Setting AudioNode Properties

    -
    -
    - - - - - - - - - -
    AudioNode MethodUsage
    setVolume(1)Sets the volume gain. 1 is the default volume, 2 is twice as loud, etc. 0 is silent/mute.
    setPitch(1)Makes the sound play in a higher or lower pitch. Default is 1. 2 is twice as high, .5f is half as low.
    -
    - - - - - - - - - - +

    Audio in jME3

    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.

    Place audio files in the assets/Sound/ directory of your project. jME3 supports Ogg Vorbis (.ogg) and Wave (.wav) formats.

    Creating Audio Nodes: Streamed or Buffered

    The main class to look at is com.jme3.audio.AudioNode.

    • Buffered: 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:
      AudioNode boom = new AudioNode(assetManager, "Sound/boom.wav");
    • Streamed: 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:
      AudioNode music = new AudioNode(assetManager, "Sound/music.wav", true);

    Getting AudioNode Properties

    AudioNode MethodUsage
    setLooping(false)Configures the sound so that, if it is played, it plays once and stops. This is the default.
    setLooping(true)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.
    -Does not work for streamed sounds!
    AudioNode MethodUsage
    getStatus()Returns either Status.Playing, Status.Stopped, or Status.Paused.
    getVolume()Returns the volume.
    getPitch()Returns the pitch.

    There are other obvious getters to poll the status of corresponding setters below.

    Setting AudioNode Properties

    AudioNode MethodUsage
    setVolume(1)Sets the volume gain. 1 is the default volume, 2 is twice as loud, etc. 0 is silent/mute.
    setPitch(1)Makes the sound play in a higher or lower pitch. Default is 1. 2 is twice as high, .5f is half as low.
    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio_environment_presets.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio_environment_presets.html index 9dece2711..5a1f208e7 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio_environment_presets.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/audio_environment_presets.html @@ -1,27 +1,8 @@ - -

    Audio Environment Presets

    -
    - -

    - -Use these presets together with Audio Nodes to create different "moods" for sounds. Environment effects make your audio sound as if the listener were in various places that have different types of echoes. -

    - -

    -Usage: - -

    -
    Environment(
    +

    Audio Environment Presets

    Use these presets together with Audio Nodes to create different "moods" for sounds. Environment effects make your audio sound as if the listener were in various places that have different types of echoes.

    Usage:

    Environment(
         new float[]{ 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} ) );
    -audioRenderer.setEnvironment(myEnvironment);
    - -
    - -

    Castle

    -
    -
    CastleSmallRoom    = new Environment ( new float[]{ 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} ) );
    +audioRenderer.setEnvironment(myEnvironment);

    Castle

    CastleSmallRoom    = new Environment ( new float[]{ 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} ) );
     CastleShortPassage = new Environment ( new float[]{ 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} ) );
     CastleMediumroom   = new Environment ( new float[]{ 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} ) );
     CastleLongpassage  = new Environment ( new float[]{ 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} ) );
    @@ -29,13 +10,7 @@ CastleLargeroom    = new Environment ( new float[]{ 26, 8.3f, 0
     CastleHall         = new Environment ( new float[]{ 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} ) );
     CastleCupboard     = new Environment ( new float[]{ 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} ) );
     CastleCourtyard    = new Environment ( new float[]{ 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} ) );
    -CastleAlcove       = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Warehouse, Factory

    -
    -
    FactoryAlcove       = new Environment ( new float[]{ 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} ) );
    +CastleAlcove       = new Environment ( new float[]{ 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} ) );
     FactoryShortpassage = new Environment ( new float[]{ 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} ) );
     FactoryMediumroom   = new Environment ( new float[]{ 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} ) );
     FactoryLongpassage  = new Environment ( new float[]{ 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} ) );
    @@ -43,13 +18,7 @@ FactoryLargeroom    = new Environment ( new float[]{ 26, 1.9f,
     FactoryHall         = new Environment ( new float[]{ 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} ) );
     FactoryCupboard     = new Environment ( new float[]{ 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} ) );
     FactoryCourtyard    = new Environment ( new float[]{ 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} ) );
    -FactorySmallroom    = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Ice Palace

    -
    -
    IcepalaceAlcove       = new Environment ( new float[]{ 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} ) );
    +FactorySmallroom    = new Environment ( new float[]{ 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} ) );
     IcepalaceShortpassage = new Environment ( new float[]{ 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} ) );
     IcepalaceMediumroom   = new Environment ( new float[]{ 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} ) );
     IcepalaceLongpassage  = new Environment ( new float[]{ 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} ) );
    @@ -57,26 +26,14 @@ IcepalaceLargeroom    = new Environment ( new float[]{ 26, 2.9f
     IcepalaceHall         = new Environment ( new float[]{ 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} ) );
     IcepalaceCupboard     = new Environment ( new float[]{ 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} ) );
     IcepalaceCourtyard    = new Environment ( new float[]{ 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} ) );
    -IcepalaceSmallroom    = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Space Station

    -
    -
    SpacestationAlcove       = new Environment ( new float[]{ 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} ) );
    +IcepalaceSmallroom    = new Environment ( new float[]{ 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} ) );
     SpacestationMediumroom   = new Environment ( new float[]{ 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} ) );
     SpacestationShortpassage = new Environment ( new float[]{ 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} ) );
     SpacestationLongpassage  = new Environment ( new float[]{ 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} ) );
     SpacestationLargeroom    = new Environment ( new float[]{ 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} ) );
     SpacestationHall         = new Environment ( new float[]{ 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} ) );
     SpacestationCupboard     = new Environment ( new float[]{ 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} ) );
    -SpacestationSmallroom    = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Wooden Hut or Ship

    -
    -
    WoodenAlcove           = new Environment ( new float[]{ 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} ) );
    +SpacestationSmallroom    = new Environment ( new float[]{ 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} ) );
     WoodenShortpassage     = new Environment ( new float[]{ 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} ) );
     WoodenMediumroom       = new Environment ( new float[]{ 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} ) );
     WoodenLongpassage      = new Environment ( new float[]{ 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} ) );
    @@ -84,113 +41,53 @@ WoodenLargeroom        = new Environment ( new float[]{ 26, 7.5
     WoodenHall             = new Environment ( new float[]{ 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} ) );
     WoodenCupboard         = new Environment ( new float[]{ 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} ) );
     WoodenSmallroom        = new Environment ( new float[]{ 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} ) );
    -WoodenCourtyard        = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Sport

    -
    -
    SportEmptystadium      = new Environment ( new float[]{ 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} ) );
    +WoodenCourtyard        = new Environment ( new float[]{ 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} ) );
     SportSquashcourt       = new Environment ( new float[]{ 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} ) );
     SportSmallswimmingpool = new Environment ( new float[]{ 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} ) );
     SportLargeswimmingpool = new Environment ( new float[]{ 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} ) );
     SportGymnasium         = new Environment ( new float[]{ 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} ) );
    -SportFullstadium       = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Pipes

    -
    -
    Sewerpipe    = new Environment ( new float[]{ 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} ) );
    +SportFullstadium       = new Environment ( new float[]{ 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} ) );
     PipeSmall    = new Environment ( new float[]{ 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} ) );
     PipeLongthin = new Environment ( new float[]{ 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} ) );
     PipeLarge    = new Environment ( new float[]{ 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} ) );
    -PipeResonant = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Moods

    -
    -
    Heaven    = new Environment ( new float[]{ 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} ) );
    +PipeResonant = new Environment ( new float[]{ 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} ) );
     Hell      = new Environment ( new float[]{ 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} ) );
     Memory    = new Environment ( new float[]{ 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} ) );
     Drugged   = new Environment ( new float[]{ 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} ) );
     Dizzy     = new Environment ( new float[]{ 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} ) );
    -Psychotic = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Car Racing

    -
    -
    DrivingCommentator    = new Environment ( new float[]{ 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} ) );
    +Psychotic = new Environment ( new float[]{ 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} ) );
     DrivingPitgarage       = new Environment ( new float[]{ 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} ) );
     DrivingIncarRacer      = new Environment ( new float[]{ 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} ) );
     DrivingIncarSports     = new Environment ( new float[]{ 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} ) );
     DrivingIncarLuxury     = new Environment ( new float[]{ 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} ) );
     DrivingFullgrandstand  = new Environment ( new float[]{ 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} ) );
     DrivingEmptygrandstand = new Environment ( new float[]{ 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} ) );
    -DrivingTunnel          = new Environment ( new float[]{ 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} ) );
    - -
    - -

    City

    -
    -
    CityIndoors   = new Environment ( new float[]{ 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} ) );
    +DrivingTunnel          = new Environment ( new float[]{ 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} ) );
     CityStreets   = new Environment ( new float[]{ 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} ) );
     CitySubway    = new Environment ( new float[]{ 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} ) );
     CityMuseum    = new Environment ( new float[]{ 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} ) );
     CityLibrary   = new Environment ( new float[]{ 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} ) );
     CityUnderpass = new Environment ( new float[]{ 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} ) );
    -CityAbandoned = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Small Indoor Rooms

    -
    -
    Room         = new Environment ( new float[]{ 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} ) );
    +CityAbandoned = new Environment ( new float[]{ 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} ) );
     Bathroom     = new Environment ( new float[]{ 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} ) );
     Livingroom   = new Environment ( new float[]{ 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} ) );
     Paddedcell   = new Environment ( new float[]{ 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} ) );
    -Stoneroom    = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Medium-Sized Indoor Rooms

    -
    -
    Workshop     = new Environment ( new float[]{ 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} ) );
    +Stoneroom    = new Environment ( new float[]{ 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} ) );
     Schoolroom   = new Environment ( new float[]{ 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} ) );
     Practiseroom = new Environment ( new float[]{ 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} ) );
     Outhouse     = new Environment ( new float[]{ 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} ) );
     Caravan      = new Environment ( new float[]{ 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} ) );
     Dustyroom    = new Environment ( new float[]{ 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} ) );
    -Chapel       = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Large Indoor Rooms

    -
    -
    Auditorium     = new Environment ( new float[]{ 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} ) );
    +Chapel       = new Environment ( new float[]{ 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} ) );
     Concerthall    = new Environment ( new float[]{ 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} ) );
     Cave           = new Environment ( new float[]{ 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} ) );
     Arena          = new Environment ( new float[]{ 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} ) );
     Hangar         = new Environment ( new float[]{ 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} ) );
     DomeTomb       = new Environment ( new float[]{ 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} ) );
    -DomeSaintPauls = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Hallways, Alleys

    -
    -
    Carpettedhallway = new Environment ( new float[]{ 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} ) );
    +DomeSaintPauls = new Environment ( new float[]{ 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} ) );
     Hallway          = new Environment ( new float[]{ 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} ) );
     Stonecorridor    = new Environment ( new float[]{ 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} ) );
    -Alley            = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Outdoors

    -
    -
    Backyard      = new Environment ( new float[]{ 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} ) );
    +Alley            = new Environment ( new float[]{ 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} ) );
     Plain         = new Environment ( new float[]{ 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} ) );
     Rollingplains = new Environment ( new float[]{ 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} ) );
     Deepcanyon    = new Environment ( new float[]{ 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} ) );
    @@ -199,14 +96,6 @@ Valley        = new Environment ( new float[]{ 26, 80.3f, 0.280
     Forest        = new Environment ( new float[]{ 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} ) );
     Mountains     = new Environment ( new float[]{ 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} ) );
     Quarry        = new Environment ( new float[]{ 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} ) );
    -Parkinglot    = new Environment ( new float[]{ 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} ) );
    - -
    - -

    Water

    -
    -
    Underwater     = new Environment ( new float[]{ 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} ) );
    -Smallwaterroom = new Environment ( new float[]{ 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} ) );
    - -
    +Parkinglot = new Environment ( new float[]{ 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} ) ); +Smallwaterroom = new Environment ( new float[]{ 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} ) );

    view online version

    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bloom_and_glow.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bloom_and_glow.html index 927b1897b..d9fea212a 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bloom_and_glow.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bloom_and_glow.html @@ -1,96 +1,7 @@ - -

    Bloom and Glow

    -
    - -

    - -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. -

    - -

    -Those images gives an idea of what bloom does. The left image has no bloom effect, the right image does.
    - - -

    - -
    - -

    Bloom Usage

    -
    -
      -
    1. Create a FilterPostProcessor
      -
    2. -
    3. Create a BloomFilter
      -
    4. -
    5. Add the filter to the processor
      -
    6. -
    7. Add the processor to the viewPort
      -
    8. -
    -
     FilterPostProcessor fpp=new FilterPostProcessor(assetManager);
    +

    Bloom and Glow

    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.

    Those images gives an idea of what bloom does. The left image has no bloom effect, the right image does.

    Bloom Usage

    1. Create a FilterPostProcessor
    2. Create a BloomFilter
    3. Add the filter to the processor
    4. Add the processor to the viewPort
     FilterPostProcessor fpp=new FilterPostProcessor(assetManager);
      BloomFilter bloom=new BloomFilter();
      fpp.addFilter(bloom);
    - viewPort.addProcessor(fpp);
    - -

    -Here are the parameters that you can tweak : -

    -
    AudioNode MethodUsage
    setLooping(false)Configures the sound so that, if it is played, it plays once and stops. This is the default.
    setLooping(true)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.
    Does not work for streamed sounds!
    setPositional(false)
    setDirectional(false)
    All 3D effects switched off. This sound is global and comes from everywhere. Good for environmental ambient sounds and background music.
    - - - - - - - - - - - - - - - -
    Parameter Method Default Description
    blur scale setBlurScale(float) 1.5f the scale of the bloom effect, but be careful, high values does artifacts
    exposure Power setExposurePower(float) 5.0f the glowing channel color is raised to the value power
    exposure cut-off setExposureCutOff(float) 0.0f the threshold of color to bloom during extraction
    bloom intensity setBloomIntensity(float) 2.0f the resulting bloom value is multiplied by this intensity
    - -

    - -You'll probably need to adjust those parameters depending on your scene. -

    - -
    - -

    Bloom with a glow map

    -
    - -

    - -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. -

    - -
    - -
    Creating a glow-map
    -
    - -

    - -Let's take the hover tank example bundled with JME3 test data.
    - -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:
    - - - -

    - -

    -Glow maps works with Lighting.j3md, Particles.j3md and SolidColor.j3md material definitions. -The tank material looks like that : - -

    -
    Material My Material : Common/MatDefs/Light/Lighting.j3md {
    + viewPort.addProcessor(fpp);

    Here are the parameters that you can tweak :

    ParameterMethodDefaultDescription
    blur scalesetBlurScale(float)1.5fthe scale of the bloom effect, but be careful, high values does artifacts
    exposure PowersetExposurePower(float)5.0fthe glowing channel color is raised to the value power
    exposure cut-offsetExposureCutOff(float)0.0fthe threshold of color to bloom during extraction
    bloom intensitysetBloomIntensity(float)2.0fthe resulting bloom value is multiplied by this intensity

    You'll probably need to adjust those parameters depending on your scene.

    Bloom with a glow map

    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.

    Creating a glow-map

    Let's take the hover tank example bundled with JME3 test data.
    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:

    Glow maps works with Lighting.j3md, Particles.j3md and SolidColor.j3md material definitions. The tank material looks like that :

    Material My Material : Common/MatDefs/Light/Lighting.j3md {
          MaterialParameters {
             SpecularMap : Models/HoverTank/tank_specular.png
             Shininess : 8
    @@ -102,132 +13,17 @@ The tank material looks like that :
             Diffuse  : 1.0 1.0 1.0 1.0
             Specular : 1.0 1.0 1.0 1.0
          }
    -}
    - -

    - -The glow map is defined here : GlowMap : Models/HoverTank/tank_glow_map_highres.png -

    - -
    - -
    Usage
    -
    -
      -
    1. Create a FilterPostProcessor
      -
    2. -
    3. Create a BloomFilter with the GlowMode.Objects parameter
      -
    4. -
    5. Add the filter to the processor
      -
    6. -
    7. Add the processor to the viewPort
      -
    8. -
    -
      FilterPostProcessor fpp=new FilterPostProcessor(assetManager);
    +}

    The glow map is defined here : GlowMap : Models/HoverTank/tank_glow_map_highres.png

    Usage
    1. Create a FilterPostProcessor
    2. Create a BloomFilter with the GlowMode.Objects parameter
    3. Add the filter to the processor
    4. Add the processor to the viewPort
      FilterPostProcessor fpp=new FilterPostProcessor(assetManager);
       BloomFilter bf=new BloomFilter(BloomFilter.GlowMode.Objects);
       fpp.addFilter(bf);
    -  viewPort.addProcessor(fpp);
    - -

    -Here is the result :
    - - -

    - -
    - -

    Bloom with a glow color

    -
    - -

    - -Sometimes you need an entire object to glow, not just parts of it. -In this case you'll need to use the glow color parameter. -

    - -
    - -
    Usage
    -
    -
      -
    1. Create a material for your object and set the GlowColor parameter
      -
    2. -
    3. Create a FilterPostProcessor
      -
    4. -
    5. Create a BloomFilter with the GlowMode.Objects parameter
      -
    6. -
    7. Add the filter to the processor
      -
    8. -
    9. Add the processor to the viewPort
      -
    10. -
    -
        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/SolidColor.j3md");
    +  viewPort.addProcessor(fpp);

    Here is the result :

    Bloom with a glow color

    Sometimes you need an entire object to glow, not just parts of it. In this case you'll need to use the glow color parameter.

    Usage
    1. Create a material for your object and set the GlowColor parameter
    2. Create a FilterPostProcessor
    3. Create a BloomFilter with the GlowMode.Objects parameter
    4. Add the filter to the processor
    5. Add the processor to the viewPort
        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/SolidColor.j3md");
         mat.setColor("Color", ColorRGBA.Green);
         mat.setColor("GlowColor", ColorRGBA.Green);
         fpp=new FilterPostProcessor(assetManager);
         bloom= new BloomFilter(BloomFilter.GlowMode.Objects);        
         fpp.addFilter(bloom);
    -    viewPort.addProcessor(fpp);
    - -

    -Here is the result on Oto's plasma ball (before and after) :
    - - - -

    - -
    - -

    Hints and tricks

    -
    - -
    - -
    Increasing the blur range and reducing fps cost
    -
    - -

    - -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 :
    - - -

    -
     BloomFilter bloom=new BloomFilter();
    - bloom.setDownSamplingFactor(2.0f); 
    - -

    - -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. -

    - -
    - -
    Using classic bloom combined with a glow map
    -
    - -

    -let'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 -

    -
    BloomFilter bloom=new BloomFilter(BloomFilter.GlowMode.SceneAndObjects);
    - -

    -However, note that both effects will share the same values of attribute, and sometimes, it won't be what you need. -

    - -
    - -
    Making your home brewed material definition support Glow
    -
    - -

    - -Let'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 : -

    -
     MaterialParameters {
    +    viewPort.addProcessor(fpp);

    Here is the result on Oto's plasma ball (before and after) :

    Hints and tricks

    Increasing the blur range and reducing fps cost

    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 :

     BloomFilter bloom=new BloomFilter();
    + bloom.setDownSamplingFactor(2.0f); 

    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.

    Using classic bloom combined with a glow map

    let'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

    BloomFilter bloom=new BloomFilter(BloomFilter.GlowMode.SceneAndObjects);

    However, note that both effects will share the same values of attribute, and sometimes, it won't be what you need.

    Making your home brewed material definition support Glow

    Let'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 :

     MaterialParameters {
             
             ....
     
    @@ -235,13 +31,7 @@ In your material definition you need to add those lines in the MaterialParameter
             Texture2D GlowMap
             // The glow color of the object
             Color GlowColor
    -    }
    - -

    -Then add the following technique : - -

    -
        Technique Glow {
    +    }

    Then add the following technique :

        Technique Glow {
     
             LightMode SinglePass
     
    @@ -256,29 +46,5 @@ Then add the following technique :
                 HAS_GLOWMAP : GlowMap
                 HAS_GLOWCOLOR : GlowColor
             }
    -    }
    - -

    -Then you can use this material with the BloomFilter -

    - -
    - -
    Make a glowing object stop to glow
    -
    - -

    - -If you are using a glow map, remove the texture from the material. - -

    -
    material.clearTextureParam("GlowMap");
    - -

    -If you are using a glow color, set it to black - -

    -
    material.setColor("GlowColor",ColorRGBA.Black);
    - -
    + }

    Then you can use this material with the BloomFilter

    Make a glowing object stop to glow

    If you are using a glow map, remove the texture from the material.

    material.clearTextureParam("GlowMap");

    If you are using a glow color, set it to black

    material.setColor("GlowColor",ColorRGBA.Black);

    view online version

    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bullet_multithreading.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bullet_multithreading.html index 816718000..dd6f4c52f 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bullet_multithreading.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/bullet_multithreading.html @@ -1,47 +1,4 @@ - -

    Multithreading Bullet Physics in jme3

    -
    - -
    - -

    Introduction

    -
    - -

    -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. - -

    - -
    - -

    How is it handled in jme3 and bullet?

    -
    - -

    -A SimpleApplication with a BulletAppState allows setting the threading type via -

    -
    setThreadingType(ThreadingType type);
    - -

    - where ThreadingType can be either SEQUENTIAL or PARALLEL. -

    - -

    -In the simpleInitApp() method: - -

    -
    bulletAppState = new BulletAppState();
    +

    Multithreading Bullet Physics in jme3

    Introduction

    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.

    How is it handled in jme3 and bullet?

    A SimpleApplication with a BulletAppState allows setting the threading type via

    setThreadingType(ThreadingType type);

    where ThreadingType can be either SEQUENTIAL or PARALLEL.

    In the simpleInitApp() method:

    bulletAppState = new BulletAppState();
     bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
    -stateManager.attach(bulletAppState);
    - -

    -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. -

    - - -
    +stateManager.attach(bulletAppState);

    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.

    documentation, physics, threading

    view online version

    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/cinematics.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/cinematics.html index 02252cbff..dc5d35081 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/cinematics.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/cinematics.html @@ -1,386 +1,12 @@ - -

    JME3 Cinematics

    -
    - -

    - -JME3 cinematics (com.jme.cinematic) allow you to remote control nodes and cameras in a 3D game: You can script and and play cinematic scenes. Combined with screen recording software, you use cinematics to create and movies/trailers of your game. Internally, Cinematics are implemented as AppStates. -

    - -

    -Short overview of the cinematic process: -

    -
      -
    1. Plan the script of your movie.
      -Write down a timeline (e.g. on paper) of which character should be at which spot at which time.
      -
    2. -
    3. Attach the scene objects that you want to remote-control to one Node.
      -This Node can be the rootNode, or a Node that is attached to the rootNode.
      -
    4. -
    5. Create a Cinematic object for this movie scene. The Cinematic will contain and manage the movie script.
      -
    6. -
    7. For each line in your script (for each frame in your timeline), add a CinematicEvent to the Cinematic.
      -
    8. -
    - -
    - -

    Sample Code

    -
    -
      -
    • -
    • -
    - -
    - -

    How to Use a Cinematic

    -
    - -

    - -A Cinematic is like a movie script for a node. -

    -
    Cinematic cinematic = new Cinematic(sceneNode, duration);
    +

    JME3 Cinematics

    JME3 cinematics (com.jme.cinematic) allow you to remote control nodes and cameras in a 3D game: You can script and and play cinematic scenes. Combined with screen recording software, you use cinematics to create and movies/trailers of your game. Internally, Cinematics are implemented as AppStates.

    Short overview of the cinematic process:

    1. Plan the script of your movie.
      Write down a timeline (e.g. on paper) of which character should be at which spot at which time.
    2. Attach the scene objects that you want to remote-control to one Node.
      This Node can be the rootNode, or a Node that is attached to the rootNode.
    3. Create a Cinematic object for this movie scene. The Cinematic will contain and manage the movie script.
    4. For each line in your script (for each frame in your timeline), add a CinematicEvent to the Cinematic.

    Sample Code

    How to Use a Cinematic

    A Cinematic is like a movie script for a node.

    Cinematic cinematic = new Cinematic(sceneNode, duration);
     cinematic.addCinematicEvent(starttime1, track1);
     cinematic.addCinematicEvent(starttime2, track2);
     cinematic.addCinematicEvent(starttime2, track3);
     ...
    -stateManager.attach(cinematic);
    -
      -
    1. Create one Cinematic per scripted scene.
      -
        -
      • sceneNode is the node containing the scene (can be the rootNode).
        -
      • -
      • duration is the duration of the whole scene in seconds.
        -
      • -
      • Each Cinematic is a set of CinematicEvents, that are triggered at a given moment on the timeline.
        -
      • -
      -
    2. -
    3. Create one CinematicEvent for each line of your movie script.
      -
        -
      • track is one motion of a moving object. You can add several tracks. More details below.
        -
      • -
      • starttime is the time when this particular cinematic event starts on the timeline. Specify the start time in seconds since the beginning of the cinematic.
        -
      • -
      -
    4. -
    5. Attach the Cinematic to the SimpleApplication's stateManager.
      -
    6. -
    7. Play, stop and pause the Cinematic from your code.
      -
    8. -
    -
    - - - - - - - - - - - - -
    MethodUsage
    cinematic.play()Starts playing the cinematic from the start, or from where it was paused.
    cinematic.stop()Stops playing the cinematic and rewinds it.
    cinematic.pause()Pauses the cinematic.
    - -
    - -

    Tracks (CinematicEvents)

    -
    - -

    - -Just like a movie script consists of lines with instructions to the actors, each Cinematic consists of a series of tracks. -

    - -

    -Here is the list of available CinematicEvents that you use as tracks. Each track remote-controls scene objects in a different way: - -

    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    Tracks (CinematicEvents)Description
    MotionTrackUse a MotionTrack to move a Spatial non-linearly over time. A MotionTrack is based on a list of waypoints in a MotionPath. The curve goes through each waypoint, and you can adjust the tension of the curve to modify the roundedness of the path. This is the motion interpolation you are going to use in most cases.
    PositionTrackUse a PositionTrack to move a Spatial linearly over time. This linear interpolation results in straight motion segments between the way points. Use this to make the remote-controlled objects zig-zag from one way point to the other in a straight line.
    RotationTrackUse a RotationTrack to change the rotation of a Spatial over time. It spins the Spatial to the given angle in the given amount of time by linearly interpolating the rotation.
    ScaleTrackUse a ScaleTrack to change the size of a Spatial over time. It resizes the Spatial in the given amount of time by linearly interpolating the scale.
    SoundTrackUse a SoundTrack to play a sound at a given time for the given duration.
    GuiTrackDisplays a Nifty GUI at a given time for the given duration. Use it to display subtitles or HUD elements. Bind the Nifty GUI XML to the cinematic using cinematic.bindUi("path/to/nifty/file.xml");
    AnimationTrackUse this to start playing a model animation at a given time (a character walking animation for example)
    - -

    - -The jMonkey team can add more types of tracks, just ask in the forum. -

    - -
    - -

    MotionTrack

    -
    - -

    - -A MotionTrack moves a Spatial along a complex path. - -

    -
    MotionTrack track = new MotionTrack(thingNode, path);
    - -

    -Details of the constructor: -

    -
      -
    • thingNode is the Spatial to be moved.
      -
    • -
    • path is a complex MotionPath.
      -
    • -
    - -

    - -To create a MotionTrack, do the following: -

    -
      -
    1. -
    2. -
    3. Create a MotionTrack based on the MotionPath.
      -
    4. -
    5. Configure your MotionTrack (see below).
      -
    6. -
    7. Add the MotionTrack to a Cinematic.
      -
    8. -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    MotionTrack configuration methodUsage
    track.setLoopMode(LoopMode.Loop)Sets whether the animation along this path should loop (LoopMode.Loop) or play only once (LoopMode.DontLoop).
    track.setDirectionType(MotionTrack.Direction.None)Sets the direction behavior type of the controled node. Direction.None deactivates this feature. You can choose from the following options: LookAt, Path, PathAndRotation, Rotation.
    track.setDirectionType(MotionTrack.Direction.LookAt)The spatial turns (rotates) to keep facing a certain point while moving. Specify the point with the setLookAt() method.
    track.setDirectionType(MotionTrack.Direction.Path)The spatial always faces in the direction of the path while moving.
    track.setDirectionType(MotionTrack.Direction.PathAndRotation)The spatial faces the direction of the path, plus an added rotation. Use together with the setRotation() method.
    track.setDirectionType(MotionTrack.Direction.Rotation)The spatial spins (rotates) while moving. You describe the spin by a custom quaternion. Use together with the setRotation() method.
    track.setLookAt(teapot.getWorldTranslation(), Vector3f.UNIT_Y)The spatial always faces towards this location. Use together with MotionTrack.Direction.LookAt.
    track.setRotation(quaternion)Sets the rotation. Use together with MotionTrack.Direction.Rotation or MotionTrack.Direction.PathAndRotation.
    - -

    - -Tip: Most likely you remote-control more than one object in your scene. Give the tracks and paths useful names such as dragon_track, dragon_path, hero_track, hero_path, etc. -

    - -
    - -

    PositionTrack

    -
    - -

    - -A PositionTrack moves a Spatial in a straight line from its current position to the end position. - -

    -
    PositionTrack track = new PositionTrack(
    -    thingNode, endPosition, duration, loopMode);
    - -

    -Details of the constructor: -

    -
      -
    • thingNode is the Spatial to be moved.
      -
    • -
    • endPosition is the target location as Vector3f.
      -
    • -
    • duration is the time that it should take from start to end point.
      -
    • -
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.
      -
    • -
    - -

    - -The start location is always the current location of the Spatial. -

    - -
    - -

    RotationTrack

    -
    - -

    - -A RotationTrack remote-controls the rotation of a spatial. - -

    -
    RotationTrack thingRotationControl = new RotationTrack(
    -    thingNode, endRotation,  duration, loopMode);
    - -

    -Details of the constructor: -

    -
      -
    • thingNode is the Spatial to be rotated.
      -
    • -
    • endRotation is the target rotation in Quaternion format.
      -
    • -
    • duration is the time that it should take from start to target rotation.
      -
    • -
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.
      -
    • -
    - -
    - -

    ScaleTrack

    -
    - -

    - -A ScaleTrack remote-controls whether a spatial grows or shrinks. -

    -
    ScaleTrack thingScaleControl = new ScaleTrack(
    -    thingNode, endScale,  duration, loopMode);
    - -

    -Details of the constructor: -

    -
      -
    • thingNode is the Spatial to be resized.
      -
    • -
    • endScale is the target Scale in Vector3f format.
      -
    • -
    • duration is the time that it should take from start to target scale.
      -
    • -
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.
      -
    • -
    - -
    - -

    SoundTrack

    -
    - -

    - -A SoundTrack plays a sound as part of the cinematic. - -

    -
    SoundTrack( audioPath, isStream, duration, loopMode )
    - -

    - -Details of the constructor: -

    -
      -
    • audioPath is the path to an audio file as String, e.g. "Sounds/mySound.wav".
      -
    • -
    • isStream toggles between streaming and buffering. Set to true to stream long audio file, set to false to play short buffered sounds.
      -
    • -
    • duration is the time that it should take to play.
      -
    • -
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.
      -
    • -
    - -
    - -

    GuiTrack

    -
    - -

    - -A GuiTrack shows or hide a NiftyGUI as part of a cinematic. - -

    -
    GuiTrack( screen, duration, loopMode )
    - -

    - -You must use this together with bindUI() to specify the Nifty GUI XML file that you want to load: - -

    -
    cinematic.bindUi("Interface/subtitle.xml");
    - -

    -Details of the constructor: -

    -
      -
    • screen is the name of the Nifty GUI screen to load, as String.
      -
    • -
    • duration is the time that it should take to play.
      -
    • -
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.
      -
    • -
    - -
    - -

    AnimationTrack

    -
    - -

    - -An AnimationTrack triggers an animation as part of a cinematic. - -

    -
    AnimationTrack( thingNode, animationName, duration, loopMode )
    - -

    - -Details of the constructor: -

    -
      -
    • thingNode is the Spatial whose animation you want to play.
      -
    • -
    • animationName the name of the animation stored in the animated model that you want to trigger, as a String.
      -
    • -
    • duration is the time that it should take to play.
      -
    • -
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.
      -
    • -
    - -
    - -

    Customizations

    -
    - -

    - -You can extend individual CinematicEvents. The shows how to extend a GuiTrack to script subtitles. See how the subtitles are used in the . +stateManager.attach(cinematic);

    1. Create one Cinematic per scripted scene.
      • sceneNode is the node containing the scene (can be the rootNode).
      • duration is the duration of the whole scene in seconds.
      • Each Cinematic is a set of CinematicEvents, that are triggered at a given moment on the timeline.
    2. Create one CinematicEvent for each line of your movie script.
      • track is one motion of a moving object. You can add several tracks. More details below.
      • starttime is the time when this particular cinematic event starts on the timeline. Specify the start time in seconds since the beginning of the cinematic.
    3. Attach the Cinematic to the SimpleApplication's stateManager.
    4. Play, stop and pause the Cinematic from your code.
    MethodUsage
    cinematic.play()Starts playing the cinematic from the start, or from where it was paused.
    cinematic.stop()Stops playing the cinematic and rewinds it.
    cinematic.pause()Pauses the cinematic.

    Tracks (CinematicEvents)

    Just like a movie script consists of lines with instructions to the actors, each Cinematic consists of a series of tracks.

    Here is the list of available CinematicEvents that you use as tracks. Each track remote-controls scene objects in a different way:

    Tracks (CinematicEvents)Description
    MotionTrackUse a MotionTrack to move a Spatial non-linearly over time. A MotionTrack is based on a list of waypoints in a MotionPath. The curve goes through each waypoint, and you can adjust the tension of the curve to modify the roundedness of the path. This is the motion interpolation you are going to use in most cases.
    PositionTrackUse a PositionTrack to move a Spatial linearly over time. This linear interpolation results in straight motion segments between the way points. Use this to make the remote-controlled objects zig-zag from one way point to the other in a straight line.
    RotationTrackUse a RotationTrack to change the rotation of a Spatial over time. It spins the Spatial to the given angle in the given amount of time by linearly interpolating the rotation.
    ScaleTrackUse a ScaleTrack to change the size of a Spatial over time. It resizes the Spatial in the given amount of time by linearly interpolating the scale.
    SoundTrackUse a SoundTrack to play a sound at a given time for the given duration.
    GuiTrackDisplays a Nifty GUI at a given time for the given duration. Use it to display subtitles or HUD elements. Bind the Nifty GUI XML to the cinematic using cinematic.bindUi("path/to/nifty/file.xml");
    AnimationTrackUse this to start playing a model animation at a given time (a character walking animation for example)

    The jMonkey team can add more types of tracks, just ask in the forum.

    MotionTrack

    A MotionTrack moves a Spatial along a complex path.

    MotionTrack track = new MotionTrack(thingNode, path);

    Details of the constructor:

    • thingNode is the Spatial to be moved.
    • path is a complex MotionPath.

    To create a MotionTrack, do the following:

    1. Create a MotionTrack based on the MotionPath.
    2. Configure your MotionTrack (see below).
    3. Add the MotionTrack to a Cinematic.
    MotionTrack configuration methodUsage
    track.setLoopMode(LoopMode.Loop)Sets whether the animation along this path should loop (LoopMode.Loop) or play only once (LoopMode.DontLoop).
    track.setDirectionType(MotionTrack.Direction.None)Sets the direction behavior type of the controled node. Direction.None deactivates this feature. You can choose from the following options: LookAt, Path, PathAndRotation, Rotation.
    track.setDirectionType(MotionTrack.Direction.LookAt)The spatial turns (rotates) to keep facing a certain point while moving. Specify the point with the setLookAt() method.
    track.setDirectionType(MotionTrack.Direction.Path)The spatial always faces in the direction of the path while moving.
    track.setDirectionType(MotionTrack.Direction.PathAndRotation)The spatial faces the direction of the path, plus an added rotation. Use together with the setRotation() method.
    track.setDirectionType(MotionTrack.Direction.Rotation)The spatial spins (rotates) while moving. You describe the spin by a custom quaternion. Use together with the setRotation() method.
    track.setLookAt(teapot.getWorldTranslation(), Vector3f.UNIT_Y)The spatial always faces towards this location. Use together with MotionTrack.Direction.LookAt.
    track.setRotation(quaternion)Sets the rotation. Use together with MotionTrack.Direction.Rotation or MotionTrack.Direction.PathAndRotation.

    Tip: Most likely you remote-control more than one object in your scene. Give the tracks and paths useful names such as dragon_track, dragon_path, hero_track, hero_path, etc.

    PositionTrack

    A PositionTrack moves a Spatial in a straight line from its current position to the end position.

    PositionTrack track = new PositionTrack(
    +    thingNode, endPosition, duration, loopMode);

    Details of the constructor:

    • thingNode is the Spatial to be moved.
    • endPosition is the target location as Vector3f.
    • duration is the time that it should take from start to end point.
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.

    The start location is always the current location of the Spatial.

    RotationTrack

    A RotationTrack remote-controls the rotation of a spatial.

    RotationTrack thingRotationControl = new RotationTrack(
    +    thingNode, endRotation,  duration, loopMode);

    Details of the constructor:

    • thingNode is the Spatial to be rotated.
    • endRotation is the target rotation in Quaternion format.
    • duration is the time that it should take from start to target rotation.
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.

    ScaleTrack

    A ScaleTrack remote-controls whether a spatial grows or shrinks.

    ScaleTrack thingScaleControl = new ScaleTrack(
    +    thingNode, endScale,  duration, loopMode);

    Details of the constructor:

    • thingNode is the Spatial to be resized.
    • endScale is the target Scale in Vector3f format.
    • duration is the time that it should take from start to target scale.
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.

    SoundTrack

    A SoundTrack plays a sound as part of the cinematic.

    SoundTrack( audioPath, isStream, duration, loopMode )

    Details of the constructor:

    • audioPath is the path to an audio file as String, e.g. "Sounds/mySound.wav".
    • isStream toggles between streaming and buffering. Set to true to stream long audio file, set to false to play short buffered sounds.
    • duration is the time that it should take to play.
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.

    GuiTrack

    A GuiTrack shows or hide a NiftyGUI as part of a cinematic.

    GuiTrack( screen, duration, loopMode )

    You must use this together with bindUI() to specify the Nifty GUI XML file that you want to load:

    cinematic.bindUi("Interface/subtitle.xml");

    Details of the constructor:

    • screen is the name of the Nifty GUI screen to load, as String.
    • duration is the time that it should take to play.
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.

    AnimationTrack

    An AnimationTrack triggers an animation as part of a cinematic.

    AnimationTrack( thingNode, animationName, duration, loopMode )

    Details of the constructor:

    • thingNode is the Spatial whose animation you want to play.
    • animationName the name of the animation stored in the animated model that you want to trigger, as a String.
    • duration is the time that it should take to play.
    • loopMode can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.

    Customizations

    You can extend individual CinematicEvents. The shows how to extend a GuiTrack to script subtitles. See how the subtitles are used in the .

    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/combo_moves.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/combo_moves.html index 068a581d1..a094be6f6 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/combo_moves.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/combo_moves.html @@ -1,42 +1,4 @@ - -

    Combo Moves

    -
    - -

    -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. -

    - -

    -Combos are usually a series of inputs, in a fixed order: For example a keyboard combo can look like: "press Down, then Down+Right together, then Right". -

    - -

    -Usage: -

    -
      -
    1. Create input triggers
      -
    2. -
    3. Define combos
      -
    4. -
    5. Detect combos in ActionListener
      -
    6. -
    7. Execute combos in update loop
      -
    8. -
    - -

    - -Copy the two classes ComboMoveExecution.java and ComboMove.java into your application and adjust them to your package paths. -

    - -
    - -

    Example Code

    -
    -
      -
    • -
    • -
    • ← required
      +

      Combo Moves

      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.

      Combos are usually a series of inputs, in a fixed order: For example a keyboard combo can look like: "press Down, then Down+Right together, then Right".

      Usage:

      1. Create input triggers
      2. Define combos
      3. Detect combos in ActionListener
      4. Execute combos in update loop

      Copy the two classes ComboMoveExecution.java and ComboMove.java into your application and adjust them to your package paths.

      Example Code

      • ← required
      • ← required
      • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html index 3e55f5ade..d2562df69 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/effects_overview.html @@ -1,16 +1,4 @@ - -

        jME3 Effects -- Overview

        -
        - -

        - -jME3 supports two types of effects, post-rendering filters and particle emitters. This list contains screenshots and links to sample code that demonstrates how to add the effect to a scene. -

        - -

        -For example, post-processor filter effects are typically activated after the following pattern: -

        -
        public class MyGame extends SimpleApplication {
        +

        jME3 Effects -- Overview

        jME3 supports two types of effects, post-rendering filters and particle emitters. This list contains screenshots and links to sample code that demonstrates how to add the effect to a scene.

        For example, post-processor filter effects are typically activated after the following pattern:

        public class MyGame extends SimpleApplication {
             private FilterPostProcessor fpp;
             private SomeFilter sf;
          
        @@ -21,193 +9,7 @@ For example, post-processor filter effects are typically activated after the fol
                 fpp.addFilter(sf);
                 viewPort.addProcessor(fpp);
                 ...
        -    }
        - -
        - -

        Water

        -
        - -

        - - -The jMonkeyEngine features "SeaMonkey" water effect including cool underwater caustics. -

        - -

        -See also the announcement with video. -

        -
          -
        • -
        • -
        • -
        • -
        - -

        - -

        -
          -
        • -
        • -
        • -
        • -
        - -
        - -

        Environment Effects

        -
        - -
        - -

        Depth of Field Blur

        -
        - -

        - - -

        -
          -
        • -
        • -
        - -
        - -

        Fog

        -
        -
          -
        • -
        • -
        - -
        - -

        Light Scattering

        -
        -
          -
        • -
        • -
        - -
        - -

        Vegetation

        -
        - - -
        - -

        Light and Shadows

        -
        - -

        - -

        - -
        - -

        Bloom and Glow

        -
        - - -
        - -

        Light

        -
        -
          -
        • -
        • -
        • -
        • -
        • -
        • -
        - -

        - - -

        - -
        - -

        Shadow

        -
        -
          -
        • -
        • -
        • = Parallel-Split Shadow Mapping (PSSM)
          -
        • -
        • ,
          -
        • -
        • -
        • -
        - -

        - -See also: (article) -

        - -
        - -

        Special: Glass, Metal, Dissolve, Toon

        -
        - -

        - - - -

        - -
        - -

        Toon Effect

        -
        -
          -
        • -
        • -
        • -
        • -
        - -
        - -

        Fade in / Fade out

        -
        - - -
        - -

        User Contributed

        -
        - -

        - - -

        - -

        - -

        -
          -
        • LightBlow Shader
          -
        • -
        • FakeParticleBlow Shader
          + }

        Water

        The jMonkeyEngine features "SeaMonkey" water effect including cool underwater caustics.

        See also the announcement with video.

        Environment Effects

        Depth of Field Blur

        Fog

        Light Scattering

        Vegetation

        Light and Shadows

        Bloom and Glow

        Light

        Shadow

        • = Parallel-Split Shadow Mapping (PSSM)
        • ,

        See also: (article)

        Special: Glass, Metal, Dissolve, Toon

        Toon Effect

        Fade in / Fade out

        User Contributed

        • LightBlow Shader
        • FakeParticleBlow Shader
        • ToonBlow Shader
        • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/hinges_and_joints.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/hinges_and_joints.html index 9019ac5c2..932a73f82 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/hinges_and_joints.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/hinges_and_joints.html @@ -1,103 +1,13 @@ - -

          Physical Hinges and Joints

          -
          - -

          - -The jMonkeyEngine3 has built-in support for via the com.jme3.bullet package. -

          - -

          -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. -

          - -

          -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). -

          - -
          - -

          Sample Code

          -
          -
            -
          • -
          • -
          - -
          - -

          Overview of this Physics Application

          -
          -
            -
          1. Create a SimpleApplication with a BulletAppState
            -
              -
            • This gives us a PhysicsSpace for PhysicsControls
              -
            • -
            -
          2. -
          3. For the pendulum, we use a Spatial with a PhysicsControl, and we apply physical forces to them.
            -
              -
            • The parts of the "pendulum" are Physics Control'ed Spatials with Collision Shapes.
              -
            • -
            • We create a fixed hookNode and a dynamic pendulumNode.
              -
            • -
            -
          4. -
          5. We can "crank the handle" and rotate the joint like a hinge, or we can let loose and expose the joints freely to gravity.
            -
              -
            • For physical forces we will use the method joint.enableMotor();
              -
            • -
            -
          6. -
          - -
          - -

          Creating a Fixed Node

          -
          - -

          - -The hookNode is the fixed point from which the pendulum hangs. It has no mass. -

          -
          Node hookNode=PhysicsTestHelper.createPhysicsTestNode(
          +

          Physical Hinges and Joints

          The jMonkeyEngine3 has built-in support for via the com.jme3.bullet package.

          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.

          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).

          Sample Code

          Overview of this Physics Application

          1. Create a SimpleApplication with a BulletAppState
            • This gives us a PhysicsSpace for PhysicsControls
          2. For the pendulum, we use a Spatial with a PhysicsControl, and we apply physical forces to them.
            • The parts of the "pendulum" are Physics Control'ed Spatials with Collision Shapes.
            • We create a fixed hookNode and a dynamic pendulumNode.
          3. We can "crank the handle" and rotate the joint like a hinge, or we can let loose and expose the joints freely to gravity.
            • For physical forces we will use the method joint.enableMotor();

          Creating a Fixed Node

          The hookNode is the fixed point from which the pendulum hangs. It has no mass.

          Node hookNode=PhysicsTestHelper.createPhysicsTestNode(
               assetManager, new BoxCollisionShape(new Vector3f( .1f, .1f, .1f)),0);
           hookNode.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f,0,0f));
            
           rootNode.attachChild(hookNode);
          -getPhysicsSpace().add(hookNode);
          - -

          -For a rope bridge, there would be two fixed nodes where the bridge is attached to the mountainside. -

          - -
          - -

          Creating a Dynamic Node

          -
          - -

          - -The pendulumNode is the dynamic part of the construction. It has a mass. -

          -
          Node pendulumNode=PhysicsTestHelper.createPhysicsTestNode(
          +getPhysicsSpace().add(hookNode);

          For a rope bridge, there would be two fixed nodes where the bridge is attached to the mountainside.

          Creating a Dynamic Node

          The pendulumNode is the dynamic part of the construction. It has a mass.

          Node pendulumNode=PhysicsTestHelper.createPhysicsTestNode(
               assetManager, new BoxCollisionShape(new Vector3f( .3f, .3f, .3f)),1);
           pendulumNode.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f,-1,0f));
           rootNode.attachChild(pendulumNode);
          -getPhysicsSpace().add(pendulumNode);
          - -

          -For a rope bridge, each set of planks would be one dynamic node. -

          - -
          - -

          Understanding DOF, Joints, and Hinges

          -
          - -

          - -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 mechanical degree of freedom (DOF) of another object. +getPhysicsSpace().add(pendulumNode);

          For a rope bridge, each set of planks would be one dynamic node.

          Understanding DOF, Joints, and Hinges

          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 mechanical degree of freedom (DOF) of another object.

          @@ -125,7 +35,7 @@ Now consider some examples of objects with joints:

          -You'll understand that, when creating any type of joint, it is important to correctly specify the DOFs that the joint restricts, and the DOFs that the joint allows. For the typical DOF of a ragDoll character's limbs, jME even offers a special joint, PhysicsConeJoint. +You'll understand that, when creating any type of joint, it is important to correctly specify the DOFs that the joint restricts, and the DOFs that the joint allows. For the typical DOF of a ragDoll character's limbs, jME even offers a special joint, ConeJoint.

          @@ -135,7 +45,7 @@ You'll understand that, when creating any type of joint, it is important to

          -You create the PhysicsHingeJoint after you have created the nodes that are to be chained together. In the code snippet you see that the PhysicsHingeJoint constructor requires the two node objects. You also have to specify axes and pivots – they are the degrees of freedom that you just heard about. +You create the HingeJoint after you have created the nodes that are to be chained together. In the code snippet you see that the HingeJoint constructor requires the two node objects. You also have to specify axes and pivots – they are the degrees of freedom that you just heard about.

          private HingeJoint joint;
           ...
          diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html
          index 9ec9bb6ce..0c455f9a6 100644
          --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html
          +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/j3m_material_files.html
          @@ -1,22 +1,4 @@
          -
          -

          Saving and Loading Materials with .j3m Files

          -
          - -

          - -In the Material Definitions article you learned how to configure Materials 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. -

          - -
          - -

          Writing the .j3m File

          -
          -
            -
          1. For every Material, create a file and give it a name that describes it: e.g. SimpleBump.j3m
            -
          2. -
          3. Place the file in your project's assets/Materials/ directory, e.g. MyGame/src/assets/Materials/SimpleBump.j3m
            -
          4. -
          5. Edit the file and add content using the following Syntax, e.g.:
            Material shiny bumpy rock : Common/MatDefs/Light/Lighting.j3md {
            +

            Saving and Loading Materials with .j3m Files

            In the Material Definitions article you learned how to configure Materials 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.

            Writing the .j3m File

            1. For every Material, create a file and give it a name that describes it: e.g. SimpleBump.j3m
            2. Place the file in your project's assets/Materials/ directory, e.g. MyGame/src/assets/Materials/SimpleBump.j3m
            3. Edit the file and add content using the following Syntax, e.g.:
              Material shiny bumpy rock : Common/MatDefs/Light/Lighting.j3md {
                    MaterialParameters {
                        Shininess: 8.0
                        NormalMap: Textures/bump_rock_normal.png
              @@ -25,21 +7,7 @@ In the 
              -
              -
            4. -
            - -

            - -How to this file is structured: -

            -
              -
            1. Header
              -
                -
              1. Material is a fixed keyword, keep it.
                -
              2. -
              3. shiny bumpy rock is a descriptive string that you can make up. Choose a name to help you remember for what you intend to use this material.
                +}

          How to this file is structured:

            1. After the colon, specify on which Material definition you base this Material.
            2. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/loading_screen.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/loading_screen.html index 1a519b4b3..5ab0fa9f0 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/loading_screen.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/loading_screen.html @@ -1,36 +1,4 @@ - -

              Nifty Loading Screen (Progress Bar)

              -
              - -

              - -There is a good tutorial about creating a nifty progress bar here: - -

              - -

              -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) -

              - -

              - - -

              - -

              -This is the progress bar at 90%: -

              - -

              - -

              - -

              -nifty_loading.xml - -

              -
              <?xml version="1.0" encoding="UTF-8"?>
              +

              Nifty Loading Screen (Progress Bar)

              There is a good tutorial about creating a nifty progress bar here:

              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)

              This is the progress bar at 90%:

              nifty_loading.xml

              <?xml version="1.0" encoding="UTF-8"?>
               <nifty>
                   <useStyles filename="nifty-default-styles.xml" />
                   <useControls filename="nifty-default-controls.xml" />
              @@ -67,32 +35,13 @@ nifty_loading.xml
                   <screen id="end" controller = "jme3test.TestLoadingScreen">
                   </screen>
                
              -</nifty>
              - -
              - -

              Understanding Nifty XML

              -
              - -

              - -The progress bar and text is done statically using nifty XML. -A custom control is created, which represents the progress bar. - -

              -
                  <controlDefinition name = "loadingbar" controller = "jme3test.TestLoadingScreen">
              +</nifty>

              Understanding Nifty XML

              The progress bar and text is done statically using nifty XML. A custom control is created, which represents the progress bar.

                  <controlDefinition name = "loadingbar" controller = "jme3test.TestLoadingScreen">
                       <image filename="Interface/border.png" childLayout="absolute" 
                              imageMode="resize:15,2,15,15,15,2,15,2,15,2,15,15">
                           <image id="progressbar" x="0" y="0" filename="Interface/inner.png" width="32px" height="100%"
                                  imageMode="resize:15,2,15,15,15,2,15,2,15,2,15,15"/>
                       </image>
              -    </controlDefinition>
              - -

              -This screen simply displays a button in the middle of the screen, which could be seen as a simple main menu UI. - -

              -
                  <screen id="start" controller = "jme3test.TestLoadingScreen">
              +    </controlDefinition>

              This screen simply displays a button in the middle of the screen, which could be seen as a simple main menu UI.

                  <screen id="start" controller = "jme3test.TestLoadingScreen">
                       <layer id="layer" childLayout="center">
                           <panel id = "panel2" height="30%" width="50%" align="center" valign="center" childLayout="vertical"
                                  visibleToMouse="true">
              @@ -101,13 +50,7 @@ This screen simply displays a button in the middle of the screen, which could be
                               </control>
                           </panel>
                       </layer>
              -    </screen>
              - -

              -This screen displays our custom progress bar control with a text control - -

              -
                  <screen id="loadlevel" controller = "jme3test.TestLoadingScreen">
              +    </screen>

              This screen displays our custom progress bar control with a text control

                  <screen id="loadlevel" controller = "jme3test.TestLoadingScreen">
                       <layer id="loadinglayer" childLayout="center" backgroundColor="#000000">
                           <panel id = "loadingpanel" childLayout="vertical" align="center" valign="center" height="32px" width="400px">
                               <control name="loadingbar" align="center" valign="center" width="400px" height="32px" />
              @@ -115,15 +58,7 @@ This screen displays our custom progress bar control with a text control
                                         text="                                                  "/>
                           </panel>
                       </layer>
              -    </screen>
              - -
              - -

              Creating the bindings to use the Nifty XML

              -
              - -

              -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. + </screen>

              Creating the bindings to use the Nifty XML

              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.

              @@ -223,7 +158,7 @@ public class TestLoadingScreen extends SimpleApplication implements ScreenContro @Override public void simpleUpdate(float tpf) {   - if (load == true) { //loading is done over many frames + if (load) { //loading is done over many frames if (frameCount == 1) { Element element = nifty.getScreen("loadlevel").findElementByName("loadingtext"); textRenderer = element.getRenderer(TextRenderer.class); diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/localization.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/localization.html index f1ef4c946..fa9baa621 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/localization.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/localization.html @@ -1,132 +1,8 @@ - -

              Localizing jME 3 Games

              -
              - -
              - -

              Scope

              -
              - -

              - -Localizing an application can mean several things: - -

              -
                -
              • At minimum you translate all messages and dialogs in the user interface to your target languages.
                -
              • -
              • You should also translate the "read me", help, and other documentation.
                -
              • -
              • Also translating web content related to the application makes sure international users find out about your localized game.
                -
              • -
              • If you go the whole way of internationalization, you also "translate" metaphors in icons or symbols used.
                -E.g. For localizations to right-to-left languages, you must also adjust the whole flow of the UI (order of menus and buttons).
                -
              • -
              - -

              - -There are tools that assist you with localizing Java Swing GUIs. jME3 applications do not typically have a Swing GUI, so those tools are not of much help. Just stick to the normal Java rules about using Bundle Properties: -

              - -
              - -

              Preparing the Localization

              -
              - -

              - -Tip: The jMonkeyEngine SDK supports opening and editing Bundle.properties files. Also note the Tools > Localization menu. -

              - -

              -To prepare the application for localization, you have to first identify all hard-coded messages. - -

              -
                -
              1. Find every line in your jME3 game where you hard-coded message strings, e.g.
                -
                System.out.print("Hello World!");
                -UiText.setText("Score: "+score);
                -
                -
              2. -
              3. Create one file named Bundle.properties in each directory where there are Java file that contain messages.
                -
              4. -
              5. For every hard-coded message, you add one line to the Bundle.properties file: First specify a unique key that identifies this string; then an equal sign; and the literal string itself.
                -
                greeting=Hello World!
                -score.display=Score: 
                -
                -
              6. -
              7. In the source code, replace every occurence of a hard-coded message with the appropriate Resource Bundle call to its unique key:
                ResourceBundle.getBundle("Bundle").getString("greeting"));
                -UiText.setText(ResourceBundle.getBundle("Bundle").getString("score.display")+score);
                -
                -
              8. -
              - -

              - -The language used in the Bundle.properties files will be the default language for your game. - -

              - -
              - -

              Translating the Messages

              -
              - -

              - -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. -

              - -

              -To translate the messages to another language, for example, German: - -

              -
                -
              1. Make a copy of the Bundle.properties files.
                -
              2. -
              3. Name the copy Bundle_de.properties for German. Note the added suffix _de.
                -
              4. -
              5. Translate all strings (text on the right side of the equal sign) in the Bundle_de.properties to German.
                greeting=Hallo Welt!
                -score.display=Spielstand: 
                - -

                - Important: Do not modify any of the keys (text to the left of the equal sign)! -

                -
                -
              6. -
              7. To test the German localization, start the application from the command line with -Duser.language=de. Note the parameter de.
                -
              8. -
              - -

              - -Tip: In the jMonkeyEngine SDK, 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. -

              - -

              -To get the full list of language suffixes use - -

              -
              Locale.getISOLanguages()));
              - -
              - -

              Which Strings Not to Translate

              -
              - -

              - -Important: In the Bundle.properties file, do not include any strings that are asset paths, node or geometry names, input mappings, or material layers. -

              -
                -
              • Keep material layers:
                mat.setTexture("ColorMap", tex);
                -
                -
              • -
              • Keep paths:
                teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
                -
                -
              • -
              • Keep geometry and node names:
                Geometry thing=new Geometry("A thing", mesh);
                +

                Localizing jME 3 Games

                Scope

                Localizing an application can mean several things:

                • At minimum you translate all messages and dialogs in the user interface to your target languages.
                • You should also translate the "read me", help, and other documentation.
                • Also translating web content related to the application makes sure international users find out about your localized game.
                • If you go the whole way of internationalization, you also "translate" metaphors in icons or symbols used.
                  E.g. For localizations to right-to-left languages, you must also adjust the whole flow of the UI (order of menus and buttons).

                There are tools that assist you with localizing Java Swing GUIs. jME3 applications do not typically have a Swing GUI, so those tools are not of much help. Just stick to the normal Java rules about using Bundle Properties:

                Preparing the Localization

                Tip: The jMonkeyEngine SDK supports opening and editing Bundle.properties files. Also note the Tools > Localization menu.

                To prepare the application for localization, you have to first identify all hard-coded messages.

                1. Find every line in your jME3 game where you hard-coded message strings, e.g.
                  System.out.print("Hello World!");
                  +UiText.setText("Score: "+score);
                2. Create one file named Bundle.properties in each directory where there are Java file that contain messages.
                3. For every hard-coded message, you add one line to the Bundle.properties file: First specify a unique key that identifies this string; then an equal sign; and the literal string itself.
                  greeting=Hello World!
                  +score.display=Score: 
                4. In the source code, replace every occurence of a hard-coded message with the appropriate Resource Bundle call to its unique key:
                  ResourceBundle.getBundle("Bundle").getString("greeting"));
                  +UiText.setText(Translating the Messages

                  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.

                  To translate the messages to another language, for example, German:

                  1. Make a copy of the Bundle.properties files.
                  2. Name the copy Bundle_de.properties for German. Note the added suffix _de.
                  3. Translate all strings (text on the right side of the equal sign) in the Bundle_de.properties to German.
                    greeting=Hallo Welt!
                    +score.display=Spielstand: 

                    Important: Do not modify any of the keys (text to the left of the equal sign)!

                  4. To test the German localization, start the application from the command line with -Duser.language=de. Note the parameter de.

                  Tip: In the jMonkeyEngine SDK, 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.

                  To get the full list of language suffixes use

                  Which Strings Not to Translate

                  Important: In the Bundle.properties file, do not include any strings that are asset paths, node or geometry names, input mappings, or material layers.

                  • Keep material layers:
                    mat.setTexture("ColorMap", tex);
                  • Keep paths:
                    teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
                  • Keep geometry and node names:
                    Geometry thing=new Geometry("A thing", mesh);
                     Node vehicle = new Node("Vehicle");
                  • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/logging.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/logging.html index 05f906200..4e58ccce2 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/logging.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/logging.html @@ -1,65 +1,6 @@ - -

                    Logging and Monitoring

                    -
                    - -
                    - -

                    Logging Like a Newb

                    -
                    - -

                    - -Many developers just use System.out.println() to print diagnostic strings to the terminal. The problem with that is that before the release, you'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. -

                    - -
                    - -

                    Logging Like a Pro

                    -
                    - -

                    - -Instead of println(), you use the standard Java logger from java.util.logging. It has many advantages for professional game development: -

                    -
                      -
                    • You "tag" each message with a log level: Severe error, informative warning, etc.
                      -
                    • -
                    • You can switch off printing of all messages up to certain log level with just one line of code.
                      -
                        -
                      • During development, you would set the log level to fine, because you want all warnings printed.
                        -
                      • -
                      • For the release, you set the log level to only report severe errors, and no informative diagnostics.
                        -
                      • -
                      -
                    • -
                    • The logger string is localizable, since it contains variables. You may want to localize all errors.
                      -
                    • -
                    - -

                    - -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. Vector3f a = cam.getLocation(). They are numbered {0},{1},{2},etc for use in the string, in the order you put them in the Object array. -

                    -
                    private static final Logger logger = Logger.getLogger(HelloWorld.class.getName());
                    - -

                    - -Replace HelloWorld by the name of the class where you are using this line. - -

                    -
                    logger.log(Level.WARNING, "ok seriously wtf somebody check why {0} is {1} again?!", 
                    -                      new Object[]{a , b});
                    - -

                    - -or - -

                    -
                    logger.log(Level.SEVERE, "Game error: {0} must not be {1} after {2}! Please check your flux generator.", 
                    -                      new Object[]{a , b , c});
                    - -

                    -As you see in the example, you should phrase potentially "customer facing" 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. +

                    Logging and Monitoring

                    Logging Like a Newb

                    Many developers just use System.out.println() to print diagnostic strings to the terminal. The problem with that is that before the release, you'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.

                    Logging Like a Pro

                    Instead of println(), you use the standard Java logger from java.util.logging. It has many advantages for professional game development:

                    • You "tag" each message with a log level: Severe error, informative warning, etc.
                    • You can switch off printing of all messages up to certain log level with just one line of code.
                      • During development, you would set the log level to fine, because you want all warnings printed.
                      • For the release, you set the log level to only report severe errors, and no informative diagnostics.
                    • The logger string is localizable, since it contains variables. You may want to localize all errors.

                    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. Vector3f a = cam.getLocation(). They are numbered {0},{1},{2},etc for use in the string, in the order you put them in the Object array.

                    private static final Logger logger = Logger.getLogger(HelloWorld.class.getName());

                    Replace HelloWorld by the name of the class where you are using this line.

                    logger.log(Level.WARNING, "ok seriously wtf somebody check why {0} is {1} again?!", 
                    +                      new Object[]{a , b});

                    or

                    logger.log(Level.SEVERE, "Game error: {0} must not be {1} after {2}! Please check your flux generator.", 
                    +                      new Object[]{a , b , c});

                    As you see in the example, you should phrase potentially "customer facing" 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.

                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/making_the_camera_follow_a_character.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/making_the_camera_follow_a_character.html index 59d56fce0..34f5ca6ae 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/making_the_camera_follow_a_character.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/making_the_camera_follow_a_character.html @@ -1,51 +1,4 @@ - -

                    Making the Camera Follow a 3rd-Person Character

                    -
                    - -

                    - -When players steer a game character with 1st-person view, they directly steer the camera (flyCam.setEnabled(true);), 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. -

                    - -

                    -There are two ways how the camera can do that: -

                    -
                      -
                    • Registering a chase camera to the player and the input manager.
                      -
                    • -
                    • Attaching the camera to the character using a camera node.
                      -
                    • -
                    - -

                    - -Important: Using third-person view requires you to deactivate the default flyCam (first-person view). This means that you have to configure your own navigation (key inputs and analogListener) that make your player character walk. For moving a physical player character, use player.setWalkDirection(), for a non-pysical character you can use player.move(). -

                    - -
                    - -

                    Code Samples

                    -
                    - -

                    -Press the WASD or arrow keys to move. Drag with the left mouse button to rotate. -

                    -
                      -
                    • -
                    • -
                    • -
                    • -
                    - -
                    - -

                    Camera Node

                    -
                    - -

                    -To make the camera follow a target node, add this camera node code to your init method (e.g. simpleInitApp()). The target spatial is typically the player node. -

                    -
                    // Disable the default flyby cam
                    +

                    Making the Camera Follow a 3rd-Person Character

                    When players steer a game character with 1st-person view, they directly steer the camera (flyCam.setEnabled(true);), 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.

                    There are two ways how the camera can do that:

                    • Registering a chase camera to the player and the input manager.
                    • Attaching the camera to the character using a camera node.

                    Important: Using third-person view requires you to deactivate the default flyCam (first-person view). This means that you have to configure your own navigation (key inputs and analogListener) that make your player character walk. For moving a physical player character, use player.setWalkDirection(), for a non-pysical character you can use player.move().

                    Code Samples

                    Press the WASD or arrow keys to move. Drag with the left mouse button to rotate.

                    Camera Node

                    To make the camera follow a target node, add this camera node code to your init method (e.g. simpleInitApp()). The target spatial is typically the player node.

                    // Disable the default flyby cam
                     flyCam.setEnabled(false);
                     //create the camera Node
                     camNode = new CameraNode("Camera Node", cam);
                    @@ -56,33 +9,7 @@ camNode.setLocalTranslation(new Vector3f(0, 5, -5));
                     //Rotate the camNode to look at the target:
                     camNode.lookAt(target.getLocalTranslation(), Vector3f.UNIT_Y);
                     //Attach the camNode to the target:
                    -target.attachChild(camNode);
                    - -

                    -Important: Where the example says camNode.setLocalTranslation(new Vector3f(0, 5, -5));, 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. - -

                    -
                    - - - - - - - - - -
                    MethodsDescription
                    setControlDir(ControlDirection.SpatialToCamera)User input steers the target spatial, and the camera follows the spatial.
                    -The spatial's transformation is copied over the camera's transformation.
                    -Example: Use with CharacterControlled spatial.
                    setControlDir(ControlDirection.CameraToSpatial)User input steers the camera, and the target spatial follows the camera.
                    -The camera's transformation is copied over the spatial's transformation.
                    - -

                    - -Code sample: -

                    -
                      -
                    • – Press the WASD or arrow keys to move. Drag with the left mouse button to rotate.
                      +target.attachChild(camNode);

                    Important: Where the example says camNode.setLocalTranslation(new Vector3f(0, 5, -5));, 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.

                    MethodsDescription
                    setControlDir(ControlDirection.SpatialToCamera)User input steers the target spatial, and the camera follows the spatial.
                    The spatial's transformation is copied over the camera's transformation.
                    Example: Use with CharacterControlled spatial.
                    setControlDir(ControlDirection.CameraToSpatial)User input steers the camera, and the target spatial follows the camera.
                    The camera's transformation is copied over the spatial's transformation.

                    Code sample:

                    • – Press the WASD or arrow keys to move. Drag with the left mouse button to rotate.
                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html index 952b446ea..5beb853e0 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html @@ -1,356 +1,7 @@ - -

                    Materials Overview

                    -
                    - -

                    - -A Geometry (mesh) is just the shape of the object. jMonkeyEngine cannot render a shape without knowing anything about its surface properties. You need to apply a color or texture to the surface of your Geometries to make them visible. In jMonkeyEngine, colors and textures are represented as Material objects. -

                    - -

                    -All Geometries have Materials: You either use the setters described here to specifiy the Material's properties in your Java code, or you load a custom .j3m file that lists the properties. To improve performance, reuse Materials for similar models, don't create a new Material object for every Geometry. (E.g. use one bark Material for many tree models.) -

                    - -

                    -You can write .j3m files in a text editor, or use the jMonkeyEngine SDK to create .j3m files for you. (Advanced users can also create custom Material Definitions.) -

                    - -

                    -Each Material is based on one of the default material definitions (.j3md files) that are included in the engine. The Materials table shows you the material definitions that jMonkeyEngine supports by default. You want to make the most of your models by setting good looking material parameters: The developers should be in contact with the graphic designer regarding which of the available jMonkeyEngine features (listed here) are intended to be used in individual Models' Materials. You must have an understanding what texture maps are to be able to use textured materials. -

                    - -
                    - -

                    Code Sample

                    -
                    - -

                    - -The following samples assume that you loaded a Geometry, e.g. Spatial myGeometry = assetManager.loadModel("Models/Teapot/Teapot.j3o"); -

                    -
                    Material mat = new Material(assetManager,  // Create new material and
                    +

                    Materials Overview

                    A Geometry (mesh) is just the shape of the object. jMonkeyEngine cannot render a shape without knowing anything about its surface properties. You need to apply a color or texture to the surface of your Geometries to make them visible. In jMonkeyEngine, colors and textures are represented as Material objects.

                    All Geometries have Materials: You either use the setters described here to specifiy the Material's properties in your Java code, or you load a custom .j3m file that lists the properties. To improve performance, reuse Materials for similar models, don't create a new Material object for every Geometry. (E.g. use one bark Material for many tree models.)

                    You can write .j3m files in a text editor, or use the jMonkeyEngine SDK to create .j3m files for you. (Advanced users can also create custom Material Definitions.)

                    Each Material is based on one of the default material definitions (.j3md files) that are included in the engine. The Materials table shows you the material definitions that jMonkeyEngine supports by default. You want to make the most of your models by setting good looking material parameters: The developers should be in contact with the graphic designer regarding which of the available jMonkeyEngine features (listed here) are intended to be used in individual Models' Materials. You must have an understanding what texture maps are to be able to use textured materials.

                    Code Sample

                    The following samples assume that you loaded a Geometry, e.g. Spatial myGeometry = assetManager.loadModel("Models/Teapot/Teapot.j3o");

                    Material mat = new Material(assetManager,  // Create new material and
                         "Common/MatDefs/Misc/Unshaded.j3md");  //   specify .j3md file path.
                     mat.setColor("Color", ColorRGBA.Blue);     // Set one or more parameters.
                    -myGeometry.setMaterial(mat);               // Use material on Geometry.
                    - -

                    -or -

                    -
                    myGeometry.setMaterial( (Material)assetManager.loadAsset( "myMaterial.j3m") );
                    - -

                    -Most Material parameters are not mandatory. For example, it is normal to specify solely the DiffuseMap and NormalMap when using Lighting.j3md, and leave the rest empty. You are only using a subset of the advanced features, but that's acceptable if it results in the material looking the way you want. You can always add more texture maps later. -

                    - -

                    -

                    1) Looks confusing? Start with Unshaded.j3md, then look into Lighting.j3md.
                    -2) The jMonkeyEngine SDK offers a visual editor where you can set properties and preview the outcome. The SDK Palette contains code snippets to load materials.
                    -3) If you don't know what an obscure parameter means, you're likely not using it. -

                    -

                    - -

                    -jMonkeyEngine supports illuminated and unshaded Material Definitions. -

                    -
                      -
                    • Phong Illuminated materials look more naturalistic.
                      -
                    • -
                    • Unshaded materials look more abstract.
                      -
                    • -
                    - -
                    - -

                    Unshaded Coloring and Textures

                    -
                    - -

                    - -"Unshaded" materials look somewhat abstract because they ignore lighting and shading. Unshaded Materials work even if the scene does not include a light source. These Materials can be single-colored or textured. For example, they are used for cards and tiles, for the sky, billboards and UI elements, for toon-style games, or for testing. - -

                    -
                    - - - - - - -
                    Basic Material Definition Usage Parameter
                    Common/MatDefs/Misc/Unshaded.j3md Standard, non-illuminated Materials.
                    -Use this for simple coloring and texturing, glow, and transparency.
                    -See also: Hello Material
                    Texture Maps
                    -setTexture("ColorMap", assetManager.loadTexture(""));
                    - setBoolean("SeparateTexCoord",true);
                    -setTexture("LightMap", assetManager.loadTexture(""));
                    -Colors
                    -setColor("Color", ColorRGBA.White);
                    -setBoolean("VertexColor",true);
                    -Glow
                    -setTexture("GlowMap", assetManager.loadTexture(""));
                    -setColor("GlowColor", ColorRGBA.White);
                    - -

                    - -Other useful, but less commonly used material definitions: - -

                    -
                    - - - - - - - - - - - - - - - -
                    Special Material Definitions Usage Setter, Parameter, Type
                    Common/MatDefs/Misc/Sky.j3md A solid skyblue, or use with a custom SkyDome texture.
                    -See also: Sky
                    setTexture("TextureCubeMap", assetManager.loadTexture(""));
                    - setBoolean("SphereMap",true);
                    -setVector3("NormalScale", new Vector3f(0,0,0));
                    Common/MatDefs/Terrain/Terrain.j3md Splat textures for e.g. terrains.
                    -See also: Hello Terrain
                    setTexture("Texture1", assetManager.loadTexture("")); (red)
                    - setFloat("Texture1Scale",1f);
                    - setTexture("Texture2", assetManager.loadTexture("")); (green)
                    - setFloat("Texture2Scale",1f);
                    -setTexture("Texture3", assetManager.loadTexture("")); (blue)
                    - setFloat("Texture3Scale",1f);
                    -setTexture("Alpha", assetManager.loadTexture(""));
                    Common/MatDefs/Terrain/HeightBasedTerrain.j3mdA multi-layered texture for terrains.
                    -Specify four textures and a Vector3f describing the region in which each texture should appear:
                    -X = start height,
                    -Y = end height,
                    -Z = texture scale.
                    -Texture regions can overlap.
                    -For example: Specify a seafloor texture for the lowest areas,
                    -a sandy texture for the beaches,
                    -a grassy texure for inland areas,
                    -and a rocky texture for mountain tops.
                    setFloat("terrainSize",512f);
                    -setTexture("region1ColorMap", assetManager.loadTexture(""));
                    -setTexture("region2ColorMap", assetManager.loadTexture(""));
                    -setTexture("region3ColorMap", assetManager.loadTexture(""));
                    -setTexture("region4ColorMap", assetManager.loadTexture(""));
                    -setVector3("region1", new Vector3f(0,0,0));
                    - setVector3("region2", new Vector3f(0,0,0));
                    - setVector3("region3", new Vector3f(0,0,0));
                    - setVector3("region4", new Vector3f(0,0,0));
                    -Settings for steep areas:
                    -setTexture("slopeColorMap", assetManager.loadTexture(""));
                    - setFloat("slopeTileFactor",1f);
                    Common/MatDefs/Misc/Particle.j3md Used with texture masks for particle effects, or for point sprites.
                    -The Quadratic value scales the particle for perspective view ().
                    -Does support an optional colored glow effect.
                    -See also: Hello Effects
                    setTexture("Texture", assetManager.loadTexture(""));
                    -setTexture("GlowMap", assetManager.loadTexture(""));
                    -setColor("GlowColor", ColorRGBA.White);
                    - setFloat("Quadratic",1f);
                    - setBoolean("PointSprite",true);
                    - -
                    - -

                    Phong Illuminated

                    -
                    - -

                    - -Illuminated materials require a light source added to at least one of their parent nodes! (e.g. rootNode.) Illuminated materials are darker on the sides facing away from light sources. They use Phong illumination model (default), or the Ward isotropic gaussian specular shader (WardIso) which looks more like plastic. They do not cast drop shadows unless you use a FilterPostProcessor. - -

                    -
                    - - - - - - -
                    Illuminated Material Definition Usage Setter, Parameter, Type
                    Common/MatDefs/Light/Lighting.j3md Commonly used Material with Phong illumination.
                    -Use this material together with DiffuseMap, SpecularMap, BumpMap (NormalMaps, ParalaxMap) textures.
                    -Supports shininess, transparency, and plain material colors (Diffuse, Ambient, Specular colors).
                    -See also: Hello Material
                    Texture Maps
                    -setTexture("DiffuseMap", assetManager.loadTexture(""));
                    -setBoolean("UseAlpha",true);1)
                    -setTexture("NormalMap", assetManager.loadTexture(""));
                    -setBoolean("LATC",true); 2)
                    -setTexture("SpecularMap", assetManager.loadTexture(""));
                    - setFloat("Shininess",64f);
                    -setTexture("ParallaxMap", assetManager.loadTexture(""));
                    -setTexture("AlphaMap", assetManager.loadTexture(""));
                    - setFloat("AlphaDiscardThreshold",1f);
                    -setTexture("ColorRamp", assetManager.loadTexture(""));
                    -Glow
                    -setTexture("GlowMap", assetManager.loadTexture(""));
                    -setColor("GlowColor", ColorRGBA.White);
                    -Performance and quality
                    -setBoolean("VertexLighting",true);
                    - setBoolean("UseVertexColor",true);
                    - setBoolean("LowQuality",true);
                    - setBoolean("HighQuality",true);
                    -Material Colors
                    - setBoolean("UseMaterialColors",true);
                    -setColor("Diffuse", ColorRGBA.White);
                    - setColor("Ambient", ColorRGBA.White);
                    -setColor("Specular", ColorRGBA.White);
                    -Tangent shading:
                    - setBoolean("VTangent",true);
                    - setBoolean("Minnaert",true);3)
                    -setBoolean("WardIso",true);4)
                    -
                    - - - - - - - - - -
                    Special Illuminated Material Definitions Usage Setter, Parameter, Type
                    Common/MatDefs/Terrain/TerrainLighting.j3mdSame kind of multi-layered splat texture as Terrain.j3md, but with illumination and shading.
                    -Typically used for terrains, but works on any mesh.
                    -For every 3 splat textures, you need one alpha map.
                    -You can use a total of 11 texture maps in the terrain's splat texture:
                    -Note that diffuse and normal maps all count against that.
                    -For example, you can use a maximum of 9 diffuse textures, two of which can have normal maps;
                    -or, five textures with both diffuse and normal maps.
                    Texture Splat Maps
                    - setTexture("DiffuseMap", assetManager.loadTexture(""));
                    - setFloat("DiffuseMap_0_scale",1f);
                    -setTexture("NormalMap", assetManager.loadTexture(""));
                    -setTexture("DiffuseMap_1", assetManager.loadTexture(""));
                    - setFloat("DiffuseMap_1_scale",1f);
                    -setTexture("NormalMap_1", assetManager.loadTexture(""));
                    -setTexture("DiffuseMap_2", assetManager.loadTexture(""));
                    - setFloat("DiffuseMap_2_scale",1f);
                    -setTexture("NormalMap_2", assetManager.loadTexture(""));
                    -setTexture("DiffuseMap_3", assetManager.loadTexture(""));
                    - setFloat("DiffuseMap_3_scale",1f);
                    -setTexture("NormalMap_3", assetManager.loadTexture(""));
                    -etc, up to 11.
                    -Alpha Maps
                    -setTexture("AlphaMap", assetManager.loadTexture(""));
                    -setTexture("AlphaMap_1", assetManager.loadTexture(""));
                    -setTexture("AlphaMap_2", assetManager.loadTexture(""));
                    -Glowing
                    -setTexture("GlowMap", assetManager.loadTexture(""));
                    -setColor("GlowColor", ColorRGBA.White);
                    -Miscellaneous
                    -setColor("Diffuse", ColorRGBA.White);
                    -setColor("Ambient", ColorRGBA.White);
                    -setFloat("Shininess",64f);
                    -setColor("Specular", ColorRGBA.White);
                    -setTexture("SpecularMap", assetManager.loadTexture(""));
                    -setBoolean("WardIso",true);
                    - setBoolean("useTriPlanarMapping",true);
                    - setBoolean("isTerrainGrid",true);
                    Common/MatDefs/Light/Reflection.j3md Reflective glass material with environment map (CubeMap/SphereMap). See also: setTexture("Texture", assetManager.loadTexture(""));
                    - setBoolean("SphereMap",true);
                    - -
                    - -

                    Testing and Debugging

                    -
                    -
                    - - - - - - -
                    Material Definition Usage
                    Common/MatDefs/Misc/ShowNormals.j3md A color gradient calculated from the model's surface normals. You can use this built-in material to debug the generation of normals in meshes, to preview models that have no material, or as fall-back default material. This built-in material has no parameters.
                    - -
                    - -

                    Activate Special Features

                    -
                    - -
                    - -

                    NormalMap (Bumpiness)

                    -
                    - -

                    - -A NormalMap (alos called BumpMap) describes the fine bumpy details of the Material surface that are not part of the mesh itself. E.g. cracks, pores, creases, notches. -

                    -
                      -
                    1. Generate normals for the Mesh (not for the Geometry!)
                      TangentBinormalGenerator.generate(mesh);
                      -
                      -
                    2. -
                    3. Specify the NormalMap texture. ()
                      -
                    4. -
                    - -
                    - -

                    Specular (Shininess)

                    -
                    - -

                    - -To activate Shininess: -

                    -
                      -
                    1. Specify the Shininess intensity.
                      -A float value between 1 (rough surface with blurry shininess) and 128 (very smooth surface with focused shininess)
                      -
                    2. -
                    3. Specify a Color as Specular value.
                      -The ColorRGBA value of the light source, e.g. often RGBA.White.
                      -
                    4. -
                    5. (Optionally for some Materials) Specify a SpecularMap texture.
                      -This grayscale texture outlines in detail where the DiffuseMap texture should be shiny (white) and were not (black), instead of rendering the whole material evenly shiny.
                      -
                    6. -
                    - -

                    - -To deactivate shininess -

                    -
                      -
                    • Set the Specular color to ColorRGBA.Black. Do not just set Shininess to 0.
                      -
                    • -
                    - -
                    - -

                    Glow

                    -
                    - -

                    - -To activate glow: -

                    -
                      -
                    1. Add a FilterPostProcessor in your simpleInit() method.
                      -
                    2. -
                    3. Specify a Color as Glow value.
                      -A ColorRGBA value of your choice, e.g. choose a warm or cold color for different effects.
                      -
                    4. -
                    5. (Optionally for some Materials) Specify a GlowMap texture.
                      -This texture outlines in detail where the DiffuseMap texture glows, instead of making the whole material glow everwhere evenly.
                      -
                    6. -
                    - -

                    - -To deactivate glow -

                    -
                      -
                    • Set the Glow color to ColorRGBA.Black.
                      -
                    • -
                    - -
                    - -

                    Transparency

                    -
                    - -

                    - -Most Material Definitions support an alpha channel for opaqueness and transparency in textures. In an RGBA color, the last float is the alpha channel: 0.0f is transparent and 1.0f is opaque. For example, mat.setColor("Color", new ColorRGBA(1,0,0,0.5f)); is a half-opaque red. -

                    - -

                    -Additionally, you must specify a blendmode: +myGeometry.setMaterial(mat); // Use material on Geometry.

                    or

                    myGeometry.setMaterial( (Material)assetManager.loadAsset( "myMaterial.j3m") );

                    Most Material parameters are not mandatory. For example, it is normal to specify solely the DiffuseMap and NormalMap when using Lighting.j3md, and leave the rest empty. You are only using a subset of the advanced features, but that's acceptable if it results in the material looking the way you want. You can always add more texture maps later.

                    1) Looks confusing? Start with Unshaded.j3md, then look into Lighting.j3md.
                    2) The jMonkeyEngine SDK offers a visual editor where you can set properties and preview the outcome. The SDK Palette contains code snippets to load materials.
                    3) If you don't know what an obscure parameter means, you're likely not using it.

                    jMonkeyEngine supports illuminated and unshaded Material Definitions.

                    • Phong Illuminated materials look more naturalistic.
                    • Unshaded materials look more abstract.

                    Unshaded Coloring and Textures

                    "Unshaded" materials look somewhat abstract because they ignore lighting and shading. Unshaded Materials work even if the scene does not include a light source. These Materials can be single-colored or textured. For example, they are used for cards and tiles, for the sky, billboards and UI elements, for toon-style games, or for testing.

                    Basic Material DefinitionUsageParameter
                    Common/MatDefs/Misc/Unshaded.j3mdStandard, non-illuminated Materials.
                    Use this for simple coloring and texturing, glow, and transparency.
                    See also: Hello Material
                    Texture Maps
                    setTexture("ColorMap", assetManager.loadTexture(""));
                    setBoolean("SeparateTexCoord",true);
                    setTexture("LightMap", assetManager.loadTexture(""));
                    Colors
                    setColor("Color", ColorRGBA.White);
                    setBoolean("VertexColor",true);
                    Glow
                    setTexture("GlowMap", assetManager.loadTexture(""));
                    setColor("GlowColor", ColorRGBA.White);

                    Other useful, but less commonly used material definitions:

                    Special Material DefinitionsUsageSetter, Parameter, Type
                    Common/MatDefs/Misc/Sky.j3mdA solid skyblue, or use with a custom SkyDome texture.
                    See also: Sky
                    setTexture("TextureCubeMap", assetManager.loadTexture(""));
                    setBoolean("SphereMap",true);
                    setVector3("NormalScale", new Vector3f(0,0,0));
                    Common/MatDefs/Terrain/Terrain.j3mdSplat textures for e.g. terrains.
                    See also: Hello Terrain
                    setTexture("Texture1", assetManager.loadTexture("")); (red)
                    setFloat("Texture1Scale",1f);
                    setTexture("Texture2", assetManager.loadTexture("")); (green)
                    setFloat("Texture2Scale",1f);
                    setTexture("Texture3", assetManager.loadTexture("")); (blue)
                    setFloat("Texture3Scale",1f);
                    setTexture("Alpha", assetManager.loadTexture(""));
                    Common/MatDefs/Terrain/HeightBasedTerrain.j3mdA multi-layered texture for terrains.
                    Specify four textures and a Vector3f describing the region in which each texture should appear:
                    X = start height,
                    Y = end height,
                    Z = texture scale.
                    Texture regions can overlap.
                    For example: Specify a seafloor texture for the lowest areas,
                    a sandy texture for the beaches,
                    a grassy texure for inland areas,
                    and a rocky texture for mountain tops.
                    setFloat("terrainSize",512f);
                    setTexture("region1ColorMap", assetManager.loadTexture(""));
                    setTexture("region2ColorMap", assetManager.loadTexture(""));
                    setTexture("region3ColorMap", assetManager.loadTexture(""));
                    setTexture("region4ColorMap", assetManager.loadTexture(""));
                    setVector3("region1", new Vector3f(0,0,0));
                    setVector3("region2", new Vector3f(0,0,0));
                    setVector3("region3", new Vector3f(0,0,0));
                    setVector3("region4", new Vector3f(0,0,0));
                    Settings for steep areas:
                    setTexture("slopeColorMap", assetManager.loadTexture(""));
                    setFloat("slopeTileFactor",1f);
                    Common/MatDefs/Misc/Particle.j3mdUsed with texture masks for particle effects, or for point sprites.
                    The Quadratic value scales the particle for perspective view ().
                    Does support an optional colored glow effect.
                    See also: Hello Effects
                    setTexture("Texture", assetManager.loadTexture(""));
                    setTexture("GlowMap", assetManager.loadTexture(""));
                    setColor("GlowColor", ColorRGBA.White);
                    setFloat("Quadratic",1f);
                    setBoolean("PointSprite",true);

                    Phong Illuminated

                    Illuminated materials require a light source added to at least one of their parent nodes! (e.g. rootNode.) Illuminated materials are darker on the sides facing away from light sources. They use Phong illumination model (default), or the Ward isotropic gaussian specular shader (WardIso) which looks more like plastic. They do not cast drop shadows unless you use a FilterPostProcessor.

                    Illuminated Material DefinitionUsageSetter, Parameter, Type
                    Common/MatDefs/Light/Lighting.j3mdCommonly used Material with Phong illumination.
                    Use this material together with DiffuseMap, SpecularMap, BumpMap (NormalMaps, ParalaxMap) textures.
                    Supports shininess, transparency, and plain material colors (Diffuse, Ambient, Specular colors).
                    See also: Hello Material
                    Texture Maps
                    setTexture("DiffuseMap", assetManager.loadTexture(""));
                    setBoolean("UseAlpha",true);1)
                    setTexture("NormalMap", assetManager.loadTexture(""));
                    setBoolean("LATC",true); 2)
                    setTexture("SpecularMap", assetManager.loadTexture(""));
                    setFloat("Shininess",64f);
                    setTexture("ParallaxMap", assetManager.loadTexture(""));
                    setTexture("AlphaMap", assetManager.loadTexture(""));
                    setFloat("AlphaDiscardThreshold",1f);
                    setTexture("ColorRamp", assetManager.loadTexture(""));
                    Glow
                    setTexture("GlowMap", assetManager.loadTexture(""));
                    setColor("GlowColor", ColorRGBA.White);
                    Performance and quality
                    setBoolean("VertexLighting",true);
                    setBoolean("UseVertexColor",true);
                    setBoolean("LowQuality",true);
                    setBoolean("HighQuality",true);
                    Material Colors
                    setBoolean("UseMaterialColors",true);
                    setColor("Diffuse", ColorRGBA.White);
                    setColor("Ambient", ColorRGBA.White);
                    setColor("Specular", ColorRGBA.White);
                    Tangent shading:
                    setBoolean("VTangent",true);
                    setBoolean("Minnaert",true);3)
                    setBoolean("WardIso",true);4)
                    Special Illuminated Material DefinitionsUsageSetter, Parameter, Type
                    Common/MatDefs/Terrain/TerrainLighting.j3mdSame kind of multi-layered splat texture as Terrain.j3md, but with illumination and shading.
                    Typically used for terrains, but works on any mesh.
                    For every 3 splat textures, you need one alpha map.
                    You can use a total of 11 texture maps in the terrain's splat texture:
                    Note that diffuse and normal maps all count against that.
                    For example, you can use a maximum of 9 diffuse textures, two of which can have normal maps;
                    or, five textures with both diffuse and normal maps.
                    Texture Splat Maps
                    setTexture("DiffuseMap", assetManager.loadTexture(""));
                    setFloat("DiffuseMap_0_scale",1f);
                    setTexture("NormalMap", assetManager.loadTexture(""));
                    setTexture("DiffuseMap_1", assetManager.loadTexture(""));
                    setFloat("DiffuseMap_1_scale",1f);
                    setTexture("NormalMap_1", assetManager.loadTexture(""));
                    setTexture("DiffuseMap_2", assetManager.loadTexture(""));
                    setFloat("DiffuseMap_2_scale",1f);
                    setTexture("NormalMap_2", assetManager.loadTexture(""));
                    setTexture("DiffuseMap_3", assetManager.loadTexture(""));
                    setFloat("DiffuseMap_3_scale",1f);
                    setTexture("NormalMap_3", assetManager.loadTexture(""));
                    etc, up to 11.
                    Alpha Maps
                    setTexture("AlphaMap", assetManager.loadTexture(""));
                    setTexture("AlphaMap_1", assetManager.loadTexture(""));
                    setTexture("AlphaMap_2", assetManager.loadTexture(""));
                    Glowing
                    setTexture("GlowMap", assetManager.loadTexture(""));
                    setColor("GlowColor", ColorRGBA.White);
                    Miscellaneous
                    setColor("Diffuse", ColorRGBA.White);
                    setColor("Ambient", ColorRGBA.White);
                    setFloat("Shininess",64f);
                    setColor("Specular", ColorRGBA.White);
                    setTexture("SpecularMap", assetManager.loadTexture(""));
                    setBoolean("WardIso",true);
                    setBoolean("useTriPlanarMapping",true);
                    setBoolean("isTerrainGrid",true);
                    Common/MatDefs/Light/Reflection.j3mdReflective glass material with environment map (CubeMap/SphereMap). See also: setTexture("Texture", assetManager.loadTexture(""));
                    setBoolean("SphereMap",true);

                    Testing and Debugging

                    Material DefinitionUsage
                    Common/MatDefs/Misc/ShowNormals.j3mdA color gradient calculated from the model's surface normals. You can use this built-in material to debug the generation of normals in meshes, to preview models that have no material, or as fall-back default material. This built-in material has no parameters.

                    Activate Special Features

                    NormalMap (Bumpiness)

                    A NormalMap (alos called BumpMap) describes the fine bumpy details of the Material surface that are not part of the mesh itself. E.g. cracks, pores, creases, notches.

                    1. Generate normals for the Mesh (not for the Geometry!)
                      TangentBinormalGenerator.generate(mesh);
                    2. Specify the NormalMap texture. ()

                    Specular (Shininess)

                    To activate Shininess:

                    1. Specify the Shininess intensity.
                      A float value between 1 (rough surface with blurry shininess) and 128 (very smooth surface with focused shininess)
                    2. Specify a Color as Specular value.
                      The ColorRGBA value of the light source, e.g. often RGBA.White.
                    3. (Optionally for some Materials) Specify a SpecularMap texture.
                      This grayscale texture outlines in detail where the DiffuseMap texture should be shiny (white) and were not (black), instead of rendering the whole material evenly shiny.

                    To deactivate shininess

                    • Set the Specular color to ColorRGBA.Black. Do not just set Shininess to 0.

                    Glow

                    To activate glow:

                    1. Add a FilterPostProcessor in your simpleInit() method.
                    2. Specify a Color as Glow value.
                      A ColorRGBA value of your choice, e.g. choose a warm or cold color for different effects.
                    3. (Optionally for some Materials) Specify a GlowMap texture.
                      This texture outlines in detail where the DiffuseMap texture glows, instead of making the whole material glow everwhere evenly.

                    To deactivate glow

                    • Set the Glow color to ColorRGBA.Black.

                    Transparency

                    Most Material Definitions support an alpha channel for opaqueness and transparency in textures. In an RGBA color, the last float is the alpha channel: 0.0f is transparent and 1.0f is opaque. For example, mat.setColor("Color", new ColorRGBA(1,0,0,0.5f)); is a half-opaque red.

                    Additionally, you must specify a blendmode:

                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/motionpath.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/motionpath.html index cf014d80e..19d91501f 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/motionpath.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/motionpath.html @@ -1,112 +1,7 @@ - -

                    MotionPath

                    -
                    - -

                    - -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. -

                    - -

                    -Tip: If you want to remote-control a whole cutscene with several spatials moving at various times, then we recommened you use MotionPaths together with Cinematics. -

                    - -
                    - -

                    Sample Code

                    -
                    -
                      -
                    • -
                    • -
                    • -
                    • -
                    - -
                    - -

                    What Are Way Points?

                    -
                    - -

                    - -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. -

                    - -

                    -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. -

                    -
                      -
                    • A way point is one positions on a path.
                      -
                    • -
                    • A MotionPath contains a list of all way points of one path.
                      -
                    • -
                    - -

                    -The final shape of the path is computed using a linear interpolation or a spline interpolation on the way points. -

                    - -
                    - -

                    Create a MotionPath

                    -
                    - -

                    - -Create a Motionpath object and add way points to it. - -

                    -
                    MotionPath path = new MotionPath();
                    +

                    MotionPath

                    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.

                    Tip: If you want to remote-control a whole cutscene with several spatials moving at various times, then we recommened you use MotionPaths together with Cinematics.

                    Sample Code

                    What Are Way Points?

                    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.

                    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.

                    • A way point is one positions on a path.
                    • A MotionPath contains a list of all way points of one path.

                    The final shape of the path is computed using a linear interpolation or a spline interpolation on the way points.

                    Create a MotionPath

                    Create a Motionpath object and add way points to it.

                    MotionPath path = new MotionPath();
                     path.addWayPoint(new Vector3f(10, 3, 0));
                     path.addWayPoint(new Vector3f(8, -2, 1));
                    -...
                    - -

                    -You can configure the path as follows. - -

                    -
                    - - - - - - - - - - - - - - - - - - - - - - - - -
                    MotionPath Method Usage
                    path.setCycle(true)Sets whether the motion along this path should be closed (true) or open-ended (false).
                    path.addWayPoint(vector)Adds individual waypoints to this path. The order is relevant.
                    path.removeWayPoint(vector)
                    -removeWayPoint(index)
                    Removes a way point from this path. You can specify the point that you want to remove as vector or as integer index.
                    path.setCurveTension(0.83f)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.
                    path.getNbWayPoints()Returns the number of waypoints in this path.
                    path.enableDebugShape(assetManager,rootNode)Shows a line that visualizes the path. Use this during development and for debugging so you see what you are doing.
                    path.disableDebugShape()Hides the line that visualizes the path. Use this for the release build.
                    - -
                    - -

                    MotionPathListener

                    -
                    - -

                    - -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 control, and an integer value representing the current wayPointIndex. -

                    - -

                    -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). -

                    -
                    path.addListener( new MotionPathListener() {
                    +...

                    You can configure the path as follows.

                    MotionPath MethodUsage
                    path.setCycle(true)Sets whether the motion along this path should be closed (true) or open-ended (false).
                    path.addWayPoint(vector)Adds individual waypoints to this path. The order is relevant.
                    path.removeWayPoint(vector)
                    removeWayPoint(index)
                    Removes a way point from this path. You can specify the point that you want to remove as vector or as integer index.
                    path.setCurveTension(0.83f)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.
                    path.getNbWayPoints()Returns the number of waypoints in this path.
                    path.enableDebugShape(assetManager,rootNode)Shows a line that visualizes the path. Use this during development and for debugging so you see what you are doing.
                    path.disableDebugShape()Hides the line that visualizes the path. Use this for the release build.

                    MotionPathListener

                    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 control, and an integer value representing the current wayPointIndex.

                    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).

                    path.addListener( new MotionPathListener() {
                       public void onWayPointReach(MotionTrack control, int wayPointIndex) {
                         if (path.getNbWayPoints() == wayPointIndex + 1) {
                           println(control.getSpatial().getName() + " has finished moving. ");
                    @@ -114,7 +9,5 @@ In this example, you just print the status at every way point. In a game you cou
                           println(control.getSpatial().getName() + " has reached way point " + wayPointIndex);
                         }
                       }
                    -});
                    - -
                    +});

                  view online version

                  \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/mouse_picking.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/mouse_picking.html index 819786851..8bbea0499 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/mouse_picking.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/mouse_picking.html @@ -1,45 +1,4 @@ - -

                  Mouse Picking

                  -
                  - -

                  - -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. -

                  - -

                  - -

                  - -

                  -See Input Handling for details on how to define the necessary input triggers, input mappings, and input listeners. -

                  - -
                  - -

                  Pick a Target Using Fixed Crosshairs

                  -
                  - -

                  - -The following pick target 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. - -

                  -
                    -
                  1. Activate the first-person camera: flyCam.setEnabled(true);
                    -
                  2. -
                  3. Keep mouse pointer invisible using inputManager.setCursorVisible(false).
                    -
                  4. -
                  5. Map the pick target action to a MouseButtonTrigger.
                    -
                  6. -
                  7. Implement the action in the Listener.
                    -
                  8. -
                  - -

                  -The following example rotates Spatials named "Red Box" or "Blue Box" 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). -

                  -
                    private AnalogListener analogListener = new AnalogListener() {
                  +

                  Mouse Picking

                  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.

                  See Input Handling for details on how to define the necessary input triggers, input mappings, and input listeners.

                  Pick a Target Using Fixed Crosshairs

                  The following pick target 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.

                  1. Activate the first-person camera: flyCam.setEnabled(true);
                  2. Keep mouse pointer invisible using inputManager.setCursorVisible(false).
                  3. Map the pick target action to a MouseButtonTrigger.
                  4. Implement the action in the Listener.

                  The following example rotates Spatials named "Red Box" or "Blue Box" 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).

                    private AnalogListener analogListener = new AnalogListener() {
                       public void onAnalog(String name, float intensity, float tpf) {
                           if (name.equals("pick target")) {
                            // Reset results list.
                  diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multiple_camera_views.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multiple_camera_views.html
                  index 4017eb499..2645a6373 100644
                  --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multiple_camera_views.html
                  +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multiple_camera_views.html
                  @@ -1,60 +1,5 @@
                  -
                  -

                  Multiple Camera Views

                  -
                  - -

                  - -You can split the screen and look into the 3D scene from different camera angles at the same time. -

                  - -

                  -The packages used in this example are com.jme3.renderer.Camera and com.jme3.renderer.ViewPort. You can get the full sample code here: -

                  - -
                  - -

                  How to resize and Position ViewPorts

                  -
                  - -

                  - -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? -

                  - -

                  -Imagine the window as a 1.0f x 1.0f rectangle. The default cam's viewPort is set to - -

                  -
                  cam.setViewPort(0f, 1f, 0f, 1f);
                  - -

                  - -This setting makes the ViewPort take up the whole rectangle. -

                  - -

                  -The four values are read in the following order: -

                  -
                  cam.setViewPort(x1,x2 , y1,y2);
                  -
                    -
                  • X-axis from left to right
                    -
                  • -
                  • Y-axis upwards from bottom to top
                    -
                  • -
                  - -

                  - -Here are a few examples: - -

                  -
                  cam1.setViewPort( 0.0f , 1.0f   ,   0.0f , 1.0f );
                  -cam2.setViewPort( 0.5f , 1.0f   ,   0.0f , 0.5f );
                  - -

                  -These viewport parameters are, (in this order) the left-right extend, and the bottom-top extend of a views's rectangle on the screen. -

                  -
                  0.0 , 1.0       1.0 , 1.0
                  +

                  Multiple Camera Views

                  You can split the screen and look into the 3D scene from different camera angles at the same time.

                  The packages used in this example are com.jme3.renderer.Camera and com.jme3.renderer.ViewPort. You can get the full sample code here:

                  How to resize and Position ViewPorts

                  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?

                  Imagine the window as a 1.0f x 1.0f rectangle. The default cam's viewPort is set to

                  cam.setViewPort(0f, 1f, 0f, 1f);

                  This setting makes the ViewPort take up the whole rectangle.

                  The four values are read in the following order:

                  cam.setViewPort(x1,x2 , y1,y2);
                  • X-axis from left to right
                  • Y-axis upwards from bottom to top

                  Here are a few examples:

                  cam1.setViewPort( 0.0f , 1.0f   ,   0.0f , 1.0f );
                  +cam2.setViewPort( 0.5f , 1.0f   ,   0.0f , 0.5f );

                  These viewport parameters are, (in this order) the left-right extend, and the bottom-top extend of a views's rectangle on the screen.

                  0.0 , 1.0       1.0 , 1.0
                          +-----+-----+
                          |cam1       |
                          |           |
                  @@ -62,79 +7,8 @@ These viewport parameters are, (in this order) the left-right extend, and the bo
                          |     |     |
                          |     |cam2 |
                          +-----+-----+
                  -0.0 , 0.0       1.0 , 0.0
                  - -

                  -Example: Cam2'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) -

                  - -

                  -

                  If you scale the views in a way so that the aspect ratio of a ViewPort is different than the window's aspect ratio, then the ViewPort appears distorted. In these cases, you must recreate (not clone) the ViewPort's cam object with the right aspect ratio. For example: Camera cam5 = new Camera(100,100); -

                  -

                  - -
                  - -

                  Four-Time Split Screen

                  -
                  - -

                  - -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. -

                  - -
                  - -

                  Set up the First View

                  -
                  - -

                  - -You use the preconfigured Camera cam and viewPort from SimpleApplication for the first view. It's in the bottom right. - -

                  -
                  cam.setViewPort(.5f, 1f, 0f, 0.5f); // Resize the viewPort to half its size, bottom right.
                  - -

                  - -Optionally, place the main camera in the scene and rotate it in its start position. - -

                  -
                  cam.setLocation(new Vector3f(3.32f, 4.48f, 4.28f));
                  -cam.setRotation(new Quaternion (-0.07f, 0.92f, -0.25f, -0.27f));
                  - -
                  - -

                  Set Up Three More Views

                  -
                  - -

                  - -Here is the outline for how you create the three other cams and viewPorts (.) In the code snippet, cam_n stand for cam_2 - cam_4, respectively, same for view_n. - -

                  -
                    -
                  1. Clone the first cam to reuse its settings
                    -
                  2. -
                  3. Resize and position the cam's viewPort with setViewPort().
                    -
                  4. -
                  5. (Optionally) Move the cameras in the scene and rotate them so they face what you want to see.
                    -
                  6. -
                  7. Create a ViewPort for each camera
                    -
                  8. -
                  9. Reset the camera's enabled statuses
                    -
                  10. -
                  11. Attach the Node to be displayed to this ViewPort.
                    -The camera doesn't have to look at the rootNode, but that is the most common use case.
                    -
                  12. -
                  - -

                  - -Here is the abstract code sample for camera n: - -

                  -
                  Camera cam_n    = cam.clone();
                  +0.0 , 0.0       1.0 , 0.0

                  Example: Cam2'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)

                  If you scale the views in a way so that the aspect ratio of a ViewPort is different than the window's aspect ratio, then the ViewPort appears distorted. In these cases, you must recreate (not clone) the ViewPort's cam object with the right aspect ratio. For example: Camera cam5 = new Camera(100,100);

                  Four-Time Split Screen

                  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.

                  Set up the First View

                  You use the preconfigured Camera cam and viewPort from SimpleApplication for the first view. It's in the bottom right.

                  cam.setViewPort(.5f, 1f, 0f, 0.5f); // Resize the viewPort to half its size, bottom right.

                  Optionally, place the main camera in the scene and rotate it in its start position.

                  cam.setLocation(new Vector3f(3.32f, 4.48f, 4.28f));
                  +cam.setRotation(new Quaternion (-0.07f, 0.92f, -0.25f, -0.27f));

                  Set Up Three More Views

                  Here is the outline for how you create the three other cams and viewPorts (.) In the code snippet, cam_n stand for cam_2 - cam_4, respectively, same for view_n.

                  1. Clone the first cam to reuse its settings
                  2. Resize and position the cam's viewPort with setViewPort().
                  3. (Optionally) Move the cameras in the scene and rotate them so they face what you want to see.
                  4. Create a ViewPort for each camera
                  5. Reset the camera's enabled statuses
                  6. Attach the Node to be displayed to this ViewPort.
                    The camera doesn't have to look at the rootNode, but that is the most common use case.

                  Here is the abstract code sample for camera n:

                  Camera cam_n    = cam.clone();
                   cam_n.setViewPort(...); // resize the viewPort
                   cam_n.setLocation(new Vector3f(...));
                   cam_n.setRotation(new Quaternion(...));
                  @@ -142,12 +16,7 @@ cam_n.setRotation(new Quaternion(...));
                   ViewPort view_n = renderManager.createMainView("View of camera #n", cam_n);
                   view_n.setClearEnabled(true);
                   view_n.attachScene(rootNode);
                  -view_n.setBackgroundColor(ColorRGBA.Black);
                  - -

                  -To visualize what you do, use the following drawing of the viewport positions: -

                  -
                  0.0 , 1.0       1.0 , 1.0
                  +view_n.setBackgroundColor(ColorRGBA.Black);

                  To visualize what you do, use the following drawing of the viewport positions:

                  0.0 , 1.0       1.0 , 1.0
                          +-----+-----+
                          |     |     |
                          |cam3 |cam4 |
                  @@ -155,36 +24,19 @@ To visualize what you do, use the following drawing of the viewport positions:
                          |     |     |
                          |cam2 |cam1 |
                          +-----+-----+
                  -0.0 , 0.0       1.0 , 0.0
                  - -

                  -This are the lines of code that set the four cameras to create a four-times split screen. -

                  -
                  cam1.setViewPort( 0.5f , 1.0f  ,  0.0f , 0.5f);
                  +0.0 , 0.0       1.0 , 0.0

                  This are the lines of code that set the four cameras to create a four-times split screen.

                  cam1.setViewPort( 0.5f , 1.0f  ,  0.0f , 0.5f);
                   ...
                   cam2.setViewPort( 0.0f , 0.5f  ,  0.0f , 0.5f);
                   ...
                   cam3.setViewPort( 0.0f , 0.5f  ,  0.5f , 1.0f);
                   ...
                  -cam4.setViewPort( 0.5f , 1.0f  ,  0.5f , 1.0f);
                  - -
                  - -

                  Picture in Picture

                  -
                  - -

                  - -The following code snippet sets up two views, one covers the whole screen, and the second is a small view in the top center. -

                  -
                         +-----+-----+
                  +cam4.setViewPort( 0.5f , 1.0f  ,  0.5f , 1.0f);

                  Picture in Picture

                  The following code snippet sets up two views, one covers the whole screen, and the second is a small view in the top center.

                         +-----+-----+
                          |   |cam|   |
                          |   | 2 |   |
                          +   +---+   +
                          |           |
                          |    cam    |
                  -       +-----+-----+
                  -
                  // Setup first full-window view
                  +       +-----+-----+
                  // Setup first full-window view
                   cam.setViewPort(0f, 1f, 0f, 1f);
                   cam.setLocation(new Vector3f(3.32f, 4.48f, 4.28f));
                   cam.setRotation(new Quaternion(-0.07f, 0.92f, -0.25f, -0.27f));
                  @@ -196,16 +48,7 @@ cam2.setLocation(new Vector3f(-0.10f, 1.57f, 4.81f));
                   cam2.setRotation(new Quaternion(0.00f, 0.99f, -0.04f, 0.02f));
                   ViewPort viewPort2 = renderManager.createMainView("PiP", cam2);
                   viewPort2.setClearFlags(true, true, true);
                  -viewPort2.attachScene(rootNode);
                  - -
                  - -

                  Settings

                  -
                  - -

                  - -You can customize the camera and the viewPort of each view individually. For example, each view can have a different background color: +viewPort2.attachScene(rootNode);

                  Settings

                  You can customize the camera and the viewPort of each view individually. For example, each view can have a different background color:

                  viewPort.setBackgroundColor(ColorRGBA.Blue);
                  diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multithreading.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multithreading.html index a319eca48..da91b90d5 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multithreading.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/multithreading.html @@ -1,107 +1,10 @@ - -

                  Multithreading Optimization

                  -
                  - -

                  - -First, make sure you know what Application States and Custom Controls are. -

                  - -

                  -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. -

                  - -

                  -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. -

                  - -

                  -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. -

                  - -
                  - -

                  Java Multithreading

                  -
                  - -

                  - -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, Callable Objects (the tasks), and Future Objects. You can , I will give just a short introduction. - -

                  -
                    -
                  • A Callable is a class with a method call() that gets executed on a thread in the Executor. It represents one task (e.g, path finding).
                    -
                  • -
                  • The Executor is one central object that manages the threads that are running to execute the Callables. Every time a Callable is added to the Executor, the Executor returns a Future object for it.
                    -
                  • -
                  • A Future is an object that you use to check the status of an individual Callable's execution. It also gives you the return value in case one is created.
                    -
                  • -
                  - -
                  - -

                  Multithreading in jME3

                  -
                  - -

                  - -So how do we implement multithreading in jME3? -

                  - -

                  -Let'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. -

                  - -

                  -To avoid slowdown, we decide to keep the pathfinding operations in the NPC Control, but execute it on another thread. -

                  - -
                  - -

                  Executor

                  -
                  - -

                  - -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. -

                  -
                  /* This constructor creates a new executor with a core pool size of 4. */
                  -ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(4);
                  - -

                  -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. -

                  - -
                  - -

                  Control Class Fields

                  -
                  - -

                  - -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: -

                  -
                  //The vector to store the desired location in:
                  +

                  Multithreading Optimization

                  First, make sure you know what Application States and Custom Controls are.

                  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.

                  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.

                  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.

                  Java Multithreading

                  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 , I will give just a short introduction.

                  • 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's path finding task). Each Callable is started from the updateloop by calling a method named call().
                  • 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.
                  • 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.

                  Multithreading in jME3

                  So how do we implement multithreading in jME3?

                  Let'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.

                  To avoid slowdown, we decide to keep the pathfinding operations in the NPC Control, but execute it on another thread.

                  Executor

                  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.

                  /* This constructor creates a new executor with a core pool size of 4. */
                  +ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(4);

                  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.

                  Control Class Fields

                  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:

                  //The vector to store the desired location in:
                   Vector3f desiredLocation = new Vector3f();
                   //The MyWayList object that contains the result waylist:
                   MyWayList wayList = null;
                   //The future that is used to check the execution status:
                  -Future future = null;
                  - -

                  -Here we also created the Future variable to track the state of this task. -

                  - -
                  - -

                  Control Update() Method

                  -
                  - -

                  - -Next let's look at the update() call of the Control where the time-intensive task starts. In our example, the task is the findWay Callable (which contains the pathfinding process). So instead of spelling out the pathfinding process in the Control's update() loop, we start the process via future = executor.submit(findWay);. -

                  -
                  public void update(float tpf) {
                  +Future future = null;

                  Here we also created the Future variable to track the state of this task.

                  Control Update() Method

                  Next let's look at the update() call of the Control where the time-intensive task starts. In our example, the task is the findWay Callable (which contains the pathfinding process). So instead of spelling out the pathfinding process in the Control's update() loop, we start the process via future = executor.submit(findWay);.

                  public void update(float tpf) {
                       try{
                           //If we have no waylist and not started a callable yet, do so!
                           if(wayList == null && future == null){
                  @@ -130,48 +33,7 @@ Next let's look at the update() call of the Control where the time-intensiv
                       if(wayList != null){
                           //.... Success! Let's process the wayList and move the NPC...
                       }
                  -}
                  - -

                  -Note how this logic makes its decision based on the Future object. -

                  - -

                  -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 "desired location" of the NPC while the path finder is calculating a different path. You have to cancel the current Future first. -

                  - -
                  - -

                  The Callable

                  -
                  - -

                  - -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 call(). -

                  - -

                  -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. -

                  - -

                  -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: - -

                  -
                    -
                  • Use the execution queue application.enqueue() to create a sub-thread that clones the info. Only disadvantage is, it may be slower.
                    -The example below gets the Vector3f location from the scene object mySpatial using this way.
                    -
                  • -
                  • 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 application.enqueue().
                    -The following example gets the object Data data = myWorld.getData(); using this way.
                    -
                  • -
                  - -

                  - -These two ways are thread-safe, they don't mess up the game logic, and keep the Callable code readable. -

                  -
                  // A self-contained time-intensive task:
                  +}

                  Note how this logic makes its decision based on the Future object.

                  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 "desired location" of the NPC while the path finder is calculating a different path. You have to cancel the current Future first.

                  The Callable

                  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 call().

                  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.

                  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:

                  • Use the execution queue application.enqueue() to create a sub-thread that clones the info. Only disadvantage is, it may be slower.
                    The example below gets the Vector3f location from the scene object mySpatial using this way.
                  • 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 application.enqueue().
                    The following example gets the object Data data = myWorld.getData(); using this way.

                  These two ways are thread-safe, they don't mess up the game logic, and keep the Callable code readable.

                  // A self-contained time-intensive task:
                   private Callable<MyWayList> findWay = new Callable<MyWayList>(){
                       public MyWayList call() throws Exception {
                    
                  diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/networking.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/networking.html
                  index cae36cdb6..e71691c27 100644
                  --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/networking.html
                  +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/networking.html
                  @@ -1,106 +1,38 @@
                  -
                  -

                  SpiderMonkey: Multi-Player Networking

                  -
                  - -

                  - -This document introduces you to the SpiderMonkey networking API. A multi-player game is made up of clients and a server. -

                  -
                    -
                  • One central server (a headless SimpleApplication) coordinates the game in the background.
                    -
                  • -
                  • Each player runs a game client (a standard SimpleApplications) and connects to the central server.
                    -
                  • -
                  - -

                  - -Each Client informs the Server about its player's moves and actions. The Server centrally collects the game state and broadcasts the state info back to all connected clients. This way all clients share the same game world and can display it to their players from their perspective. -

                  - -
                  - -

                  SpiderMonkey API Overview

                  -
                  - -

                  - -The SpiderMonkey API is a set of interfaces and helper classes in the 'com.jme3.network' package. For most users, this package and the 'message' package is all they need to worry about. (The 'base' and 'kernel' packages only come into play when implementing custom network transports or alternate client/server protocols, which is now possible). -

                  - -

                  -The SpiderMonkey API 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. - -

                  -
                  - - - - - - -
                  Seen from the Client Seen from the Server
                  com.jme3.network.Client == com.jme3.network.HostedConnection
                  - -

                  - -You can register several types of listeners to be notified of changes. -

                  -
                    -
                  • 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.
                    -
                  • -
                  • ClientStateListeners inform the Client of changes in its connection state, e.g. when the client gets kicked from the server.
                    -
                  • -
                  • ConnectionListeners inform the Server about HostedConnection arrivals and removals, e.g. if a client joins or quits.
                    -
                  • -
                  - -
                  - -

                  Client and Server

                  -
                  - -
                  - -

                  Creating a Server

                  -
                  - -

                  - -A com.jme3.network.Server is a headless com.jme3.app.SimpleApplication. Headless means that the update loop runs, but the application does not open a window and does not listen to direct user input. +

                  SpiderMonkey: Multi-Player Networking

                  This document introduces you to the SpiderMonkey networking API. You use this API 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:

                  • The central server (one headless SimpleApplication) coordinates the game in the background.
                  • Each player runs a game client (a standard SimpleApplications) and connects to the central server.

                  Each Client keeps the the Server informed about its player'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's perspective.

                  SpiderMonkey API Overview

                  The SpiderMonkey API is a set of interfaces and helper classes in the 'com.jme3.network' package. For most users, this package and the 'message' package is all they need to worry about. (The 'base' and 'kernel' packages only come into play when implementing custom network transports or alternate client/server protocols, which is now possible).

                  The SpiderMonkey API 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.

                  Seen from the ClientSeen from the Server
                  com.jme3.network.Client==com.jme3.network.HostedConnection

                  You can register several types of listeners to be notified of changes.

                  • 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.
                  • ClientStateListeners inform the Client of changes in its connection state, e.g. when the client gets kicked from the server.
                  • ConnectionListeners inform the Server about HostedConnection arrivals and removals, e.g. if a client joins or quits.

                  Client and Server

                  Creating a Server

                  The game server is a "headless" com.jme3.app.SimpleApplication:

                  public class MyGameServer extends SimpleApplication {
                  +  public static void main(String[] args) {
                  +    ServerMain app = new ServerMain();
                  +    app.start(JmeContext.Type.Headless); // headless type for servers!
                  +  }
                  +}

                  A Headless 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.

                  Create a com.jme3.network.Server in the simpleInitApp() method and specify a communication port, for example 6143.

                    public void simpleInitApp() {
                  +    ...
                  +    Server myServer = Network.createServer(6143);
                  +    myServer.start();
                  +    ...
                  +  }

                  When you run this app on a host, the server is ready to accept clients. Let's create a client next.

                  Creating a Client

                  A game client is a standard com.jme3.app.SimpleApplication.

                  public class MyGameClient extends SimpleApplication {
                  +  public static void main(String[] args) {
                  +    ClientMain app = new ClientMain();
                  +    app.start(JmeContext.Type.Display); // standard display type
                  +  }
                  +}

                  A standard SimpleApplication in Display 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. +

                  -
                  ServerMain app = new ServerMain();
                  -app.start(JmeContext.Type.Headless);

                  -Create a Server in the simpleInitApp() method and specify a communication port, for example 6143. -

                  -
                  Server myServer = Network.createServer(6143);
                  -myServer.start();
                  -

                  -The server is ready to accept clients. Let's create one. +Create a com.jme3.network.Client in the simpleInitApp() method and specify the servers IP address, and the same communication port as for the server, here 6143.

                  - -
                  - -

                  Creating a Client

                  -
                  +
                  public void simpleInitApp() {
                  +   ...
                  +   Client myClient = Network.connectToServer("localhost", 6143);
                  +   myClient.start();
                  +   ...

                  - -A com.jme3.network.Client is a standard com.jme3.app.SimpleApplication. +The server address can be in the format "localhost" or "127.0.0.1" (for local testing), or an IP address of a remote host in the format “123.456.78.9”. In this example, we assume the server is running on the localhost.

                  -
                  ClientMain app = new ClientMain();
                  -app.start(JmeContext.Type.Display); // standard type

                  -Create a Client in the simpleInitApp() method and specify the servers IP address, and the same communication port as for the server, here 6143. -

                  -
                  Client myClient = Network.connectToServer("localhost", 6143);
                  -myClient.start();
                  - -

                  -The server address can be in the format "localhost", "127.0.0.1" (for local testing) or “123.456.78.9” (the IP address of a real server). +When you run this client, it connects to the server.

                  @@ -110,7 +42,7 @@ The server address can be in the format "localhost", "127.0.0.1&q

                  -The server refers to a connected client as com.jme3.network.HostedConnection. The server can get info about clients as follows: +The server refers to a connected client as com.jme3.network.HostedConnection objects. The server can get info about clients as follows:

                  @@ -118,19 +50,19 @@ The server refers to a connected client as com.jme3.network.HostedConnection. Th - + - + - +
                  AccessorPurpose
                  myServer.getConnection(0)Server gets the first etc connected HostedConnection object.myServer.getConnections()Server gets a collection of all connected HostedConnection objects (all connected clients).
                  myServer.getConnections()Server gets a collection of all connected HostedConnection objects.myServer.getConnections().size()Server gets the number of all connected HostedConnection objects (number of clients).
                  myServer.getConnections().size()Server gets the number of all connected HostedConnection objects.myServer.getConnection(0)Server gets the first (0), second (1), etc, connected HostedConnection object (one client).
                  - +

                  -Your game can define its own player ID based on whatever user criteria you want. If the server needs to look up player/client-specific information, it can store this information directly on the HostedConnection object: +Your game can define its own game data based on whatever criteria you want, typically these include player ID and state. If the server needs to look up player/client-specific information, you can store this information directly on the HostedConnection object. The following examples read and write a custom Java object MyState in the HostedConnection object conn:

                  @@ -144,7 +76,7 @@ Your game can define its own player ID based on whatever user criteria you want.
                  MyState state = conn.getAttribute("MyState") Server can read an attribute of the HostedConnection.
                  - +

                  Messaging

                  @@ -157,28 +89,28 @@ Your game can define its own player ID based on whatever user criteria you want.

                  -Each message represents data you want to transmit, for instance transformation updates or game actions. For each message type, create a message class that extends com.jme3.network.AbstractMessage. Use the @Serializable annotation from com.jme3.network.serializing.Serializable and create an empty default constructor. Custom constructors, fields, and methods are up to you and depend on the message data that you want to transmit. +Each message represents data that you want to transmit between client and server. Common message examples include transformation updates or game actions. For each message type, create a message class that extends com.jme3.network.AbstractMessage. Use the @Serializable annotation from com.jme3.network.serializing.Serializable and create an empty default constructor. Custom constructors, fields, and methods are up to you and depend on the message data that you want to transmit.

                  @Serializable
                   public class HelloMessage extends AbstractMessage {
                  -  private String hello;       // message data
                  +  private String hello;       // custom message data
                     public HelloMessage() {}    // empty constructor
                     public HelloMessage(String s) { hello = s; } // custom constructor
                   }

                  -Register each message type to the com.jme3.network.serializing.Serializer, in both server and client. +You must register each message type to the com.jme3.network.serializing.Serializer, in both server and client!

                  Serializer.registerClass(HelloMessage.class);
                  -

                  Reacting to Messages

                  +

                  Responding to Messages

                  -After a message was received, a listener responds to it. The listener can access fields of the message, and send messages back. Implement responses in the two Listeners’ messageReceived() methods for each message type. +After a Message was received, a Listener responds to it. The listener can access fields of the message, and send messages back, start new threads, etc. There are two listeners, one on the server, one on the client. For each message type, you implement the responses in either Listeners’ messageReceived() method.

                  @@ -235,22 +167,35 @@ For each message type, register a server listener to the server:

                  -A client can send a message to the server: +Let's create a new message of type HelloMessage: +

                  +
                  Message message = new HelloMessage("Hello World!");
                  + +

                  +Now the client can send this message to the server:

                  -
                  Message message = new HelloMessage("Hello World!");
                  -myClient.send(message);
                  +
                  myClient.send(message);

                  -The server can broadcast a message to all HostedConnection (clients): +Or the server can broadcast this message to all HostedConnection (clients):

                  Message message = new HelloMessage("Welcome!");
                   myServer.broadcast(message);

                  -Using com.jme3.network.Filters, the server can send a message to specific HostedConnection (conn1, conn2, conn3), or to all but a few HostedConnections (not to conn4). +Or the server can send the message to a specific subset of clients (e.g. to HostedConnection conn1, conn2, and conn3): +

                  +
                  myServer.broadcast( Filters.in( conn1, conn2, conn3 ), message );
                  + +

                  +Or the server can send the message to all but a few selected clients (e.g. to all HostedConnections but conn4): + +

                  +
                  myServer.broadcast( Filters.notEqualTo( conn4 ), message );
                  + +

                  +The last two broadcasting methods use com.jme3.network.Filters to select a subset of recipients. If you know the exact list of recipients, always send the messages directly to them using the Filters; avoid floodig the network with unnessary broadcasts to all.

                  -
                  myServer.broadcast( Filters.in( conn1, conn2, conn3 ), message );
                  -myServer.broadcast( Filters.notEqualTo( conn4 ), message );
                  @@ -264,7 +209,7 @@ The ID of the Client and HostedConnection are the same at both ends of a connect
                  ... myClient.getId() ...

                  -A server has a game version and game name. Each client expects to communicate with a server with a certain game name and version. Test first whether the game name matches, and then whether game version matches, before sending any messages! If they do not match, you should refuse to connect, because the client and server will not be able to communicate. +A server has a game version and game name property. Each client expects to communicate with a server with a certain game name and version. Test first whether the game name matches, and then whether game version matches, before sending any messages! If they do not match, you should refuse to connect, because unmatched clients and servers will likely miscommunicate.

                  @@ -272,22 +217,23 @@ A server has a game version and game name. Each client expects to communicate wi - + - + - + - +
                  AccessorPurpose
                  myServer.setName() Specify the game name (free-form String) myServer.setName() Specify the game name of the Server (a free-form String)
                  myServer.setVersion() Specify the game version (int) myServer.setVersion() Specify the game version of the Server (an integer number)
                  myClient.getGameName() Client gets the name of the server it is connected to. myClient.getGameName() Client queries the name of the server it is connected to.
                  myClient.getVersion() Client gets the version of the server it is connected to. myClient.getVersion() Client queries the version of the server it is connected to.
                  - +

                  -Tip: Your game defines its own attributs, such as player ID, based on whatever criteria you want. If you want to look up player/client-specific information, you can set this information directly on the Client/HostedConnection (see Getting Info About a Client). +

                  Typically, your networked game defines its own attributes (such as player ID) based on whatever criteria you want. If you want to look up player/client-specific information beyond the game version, you can set this information directly on the Client/HostedConnection object (see Getting Info About a Client). +

                  @@ -306,6 +252,7 @@ You must override the client's destroy() method to close the connection cle

                    @Override
                     public void destroy() {
                  +      ... // custom code
                         myClient.close();
                         super.destroy();
                     }
                  @@ -321,6 +268,7 @@ You must override the server's destroy() method to close the connection whe

                    @Override
                     public void destroy() {
                  +      ... // custom code
                         myServer.close();
                         super.destroy();
                     }
                  @@ -332,7 +280,7 @@ You must override the server's destroy() method to close the connection whe

                  -The server can kick a HostedConnection to make it disconnect. You should provide a String with further info (an explanation to the user what happened) for the server to send along. This info message can be used (displayed to the user) by a ClientStateListener. (See below) +The server can kick a HostedConnection to make it disconnect. You should provide a String with further info (an explanation to the user what happened, e.g. "Shutting down for maintenance") for the server to send along. This info message can be used (displayed to the user) by a ClientStateListener. (See below)

                  conn.close("We kick cheaters.");
                  @@ -352,24 +300,25 @@ The server and clients are notified about connection changes.

                  + The com.jme3.network.ClientStateListener notifies the Client when the Client has fully connected to the server (including any internal handshaking), and when the Client is kicked (disconnected) from the server.

                  - + - + - +
                  ClientStateListener interface Purpose ClientStateListener interface method Purpose
                  clientConnected(Client c) Implement here what happens as soon as this clients has fully connected to the server. public void clientConnected(Client c){} Implement here what happens as soon as this clients has fully connected to the server.
                  clientDisconnected(Client c, DisconnectInfo info) Implement here what happens after the server kicks this client. For example, display the DisconnectInfo to the user. public void clientDisconnected(Client c, DisconnectInfo info){} Implement here what happens after the server kicks this client. For example, display the DisconnectInfo to the user.
                  - +

                  -Implement the ClientStateListener interface in the Client, and then register it: +First implement the ClientStateListener interface in the Client class. Then register it to myClient in MyGameClient's simeplInitApp() method:

                  myClient.addClientStateListener(this);
                  @@ -385,19 +334,20 @@ The com.jme3.network.ConnectionListener notifies the Server whenever new HostedC

                  - + - + - +
                  ConnectionListener interface Purpose ConnectionListener interface method Purpose
                  connectionAdded(Server s, HostedConnection c) Implemenent here what happens after a new HostedConnection has joined the Server. public void connectionAdded(Server s, HostedConnection c){} Implemenent here what happens after a new HostedConnection has joined the Server.
                  connectionRemoved(Server s, HostedConnection c) Implement here what happens after a HostedConnection has left. E.g. a player has quit the game and the server removes his character. public void connectionRemoved(Server s, HostedConnection c){} Implement here what happens after a HostedConnection has left. E.g. a player has quit the game and the server removes his character.
                  - +

                  -Implement the ConnectionListener in the Server, and register it. +First implement the ConnectionListener interface in the Server class. Then register it to myServer in MyGameServer's simpleInitApp() method. +

                  myServer.addConnectionListener(this);
                  @@ -426,13 +376,21 @@ message2.setReliable(false); // UDP

                  -You cannot modify the scenegraph in the NetworkThread. You have to create a Callable, enqueue the Callable in the OpenGLThread, and the callable makes the modification in the correct moment. A Callable is a Java class representing a (possibly time-intensive), self-contained task. +

                  You cannot modify the scenegraph directly from the network thread. A common example for such a modification is when you synchronize the player's position in the scene. You have to use Java Multithreading. +

                  +

                  + +

                  +Multithreading means that you create a Callable. A Callable is a Java class representing any (possibly time-intensive) self-contained task that has an impact on the scene graph (such as positioning the player). You enqueue the Callable in the Executor of the client's OpenGL thread. The Callable ensures to executes the modification in sync with the update loop.

                  app.enqueue(callable);

                  +Learn more about using multithreading in jME3 here. +

                  -Learn more about multithreading here. +

                  +For general advice, see the articles and by the Valve Developer Community.

                  @@ -442,7 +400,7 @@ Learn more about . +If you have set up a server in your home network, and the game clients cannot reach the server from the outside, it's time to learn about .

                  documentation, diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html index f5d939b75..29b50d287 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui.html @@ -1,21 +1,4 @@ - -

                  Creating User Interfaces with Nifty GUI

                  -
                  - -

                  - -

                  - -

                  -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 jME3 canvas in a Swing GUI, a 3D game typically runs full-screen, or in a window of its own. -

                  - -

                  -This document introduces you to , a Java library for building interactive graphical user interfaces (GUIs) for games or similar applications. Nifty GUI (the de.lessvoid.nifty package) is well integrated with jME3 through the com.jme3.niftygui package. You define the base GUI layout in XML, 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.) - -

                  -
                    -
                  • +

                    Creating User Interfaces with Nifty GUI

                    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 jME3 canvas in a Swing GUI, a 3D game typically runs full-screen, or in a window of its own.

                    This document introduces you to , a Java library for building interactive graphical user interfaces (GUIs) for games or similar applications. Nifty GUI (the de.lessvoid.nifty package) is well integrated with jME3 through the com.jme3.niftygui package. You define the base GUI layout in XML, 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.)

                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html index 1ca7b44b8..3495668cf 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_interaction.html @@ -1,36 +1,4 @@ - -

                    Interacting with the GUI from Java

                    -
                    -
                      -
                    1. -
                    2. -
                    3. -
                    4. -
                    5. -
                    6. -
                    7. Nifty GUI Java Interaction
                      -
                    8. -
                    - -

                    - -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 GUI 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). -

                    - -
                    - -

                    Connect GUI to Java Controller

                    -
                    - -

                    - -To let a Nifty screen communicate with the Java application, you register a ScreenController to every NiftyGUI screen. You create a ScreenController by creating a Java class that implements the de.lessvoid.nifty.screen.ScreenController interface and its abtract methods. -

                    - -

                    -Pro Tip: Since you are writing a jME3 application, you can additionally make the ScreenController class extend the AbstractAppState class! This gives the ScreenController access to the application object and to the update loop! -

                    -
                    package tutorial;
                    +

                    Interacting with the GUI from Java

                    1. Nifty GUI Java Interaction

                    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 GUI 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).

                    Connect GUI to Java Controller

                    To let a Nifty screen communicate with the Java application, you register a ScreenController to every NiftyGUI screen. You create a ScreenController by creating a Java class that implements the de.lessvoid.nifty.screen.ScreenController interface and its abtract methods.

                    Pro Tip: Since you are writing a jME3 application, you can additionally make the ScreenController class extend the AbstractAppState class! This gives the ScreenController access to the application object and to the update loop!

                    package tutorial;
                      
                     import com.jme3.app.Application;
                     import com.jme3.app.SimpleApplication;
                    @@ -76,44 +44,12 @@ public class MyStartScreen extends AbstractAppState implements ScreenController
                         /** jME update loop! */ 
                       }
                      
                    -}
                    - -

                    -The name and package of your custom ScreenController class (here tutorial.MyStartScreen) goes into the controller parameter of the respective XML screen it belongs to. For example: -

                    -
                    <nifty>
                    +}

                    The name and package of your custom ScreenController class (here tutorial.MyStartScreen) goes into the controller parameter of the respective XML screen it belongs to. For example:

                    <nifty>
                       <screen id="start" controller="tutorial.MyStartScreen">
                           <!-- layer and panel code ... -->
                       </screen>
                    -</nifty>
                    - -

                    -Or the same in a Java syntax, respectively: -

                    -
                        nifty.addScreen("start", new ScreenBuilder("start") {{
                    -        controller(new tutorial.MyStartScreen());
                    - -

                    -Now the Java class MyStartScreen and this GUI screen (start) are connected. For this example you can also connect the hud screen to MyStartScreen. -

                    - -
                    - -

                    Make GUI and Java Interact

                    -
                    - -

                    - -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 (public MyStartScreen(GameData data) {}). -

                    - -

                    -Use any combination of the three following approaches to make Java classes interact with the GUI. -

                    - -
                    - -

                    GUI Calls a Void Java Method

                    +</nifty>

                    Or the same in a Java syntax, respectively:

                        nifty.addScreen("start", new ScreenBuilder("start") {{
                    +        controller(new tutorial.MyStartScreen());

                    Now the Java class MyStartScreen and this GUI screen (start) are connected. For this example you can also connect the hud screen to MyStartScreen.

                    Make GUI and Java Interact

                    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 (public MyStartScreen(GameData data) {}).

                    Use any combination of the three following approaches to make Java classes interact with the GUI.

                    GUI Calls a Void Java Method

                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html index d21488271..f8316490b 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_overlay.html @@ -1,50 +1,4 @@ - -

                    Integrating Nifty GUI: Overlay

                    -
                    -
                      -
                    1. -
                    2. -
                    3. -
                    4. -
                    5. Nifty GUI Overlay or Nifty GUI Projection
                      -
                    6. -
                    7. -
                    8. -
                    - -

                    - - -

                    - -

                    -Typically, you define a key (for example escape) that switches the GUI on and off. The GUI can be a StartScreen, OptionsScreen, CharacterCreationScreen, etc. While the GUI is up, you pause the running game, and then overlay the GUI. 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 GUI. -

                    - -

                    -You can also project the GUI 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. -

                    - -
                    - -

                    Sample Code

                    -
                    -
                      -
                    • -
                    • -
                    - -
                    - -

                    Overlaying the User Interface Over the Screen

                    -
                    - -

                    - -This code shows you how to overlay anything on the screen with the GUI. This is the most common usecase. -

                    -
                    NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(
                    +

                    Integrating Nifty GUI: Overlay

                    1. Nifty GUI Overlay or Nifty GUI Projection

                    Typically, you define a key (for example escape) that switches the GUI on and off. The GUI can be a StartScreen, OptionsScreen, CharacterCreationScreen, etc. While the GUI is up, you pause the running game, and then overlay the GUI. 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 GUI.

                    You can also project the GUI 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.

                    Sample Code

                    Overlaying the User Interface Over the Screen

                    This code shows you how to overlay anything on the screen with the GUI. This is the most common usecase.

                    NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(
                         assetManager, inputManager, audioRenderer, guiViewPort);
                     /** Create a new NiftyGUI object */
                     Nifty nifty = niftyDisplay.getNifty();
                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html
                    index dc06e98c6..0d5396877 100644
                    --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html
                    +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_projection.html
                    @@ -1,53 +1,4 @@
                    -
                    -

                    Integrating Nifty GUI: Projection

                    -
                    -
                      -
                    1. -
                    2. -
                    3. -
                    4. -
                    5. Nifty GUI Overlay or Nifty GUI Projection
                      -
                    6. -
                    7. -
                    8. -
                    - -

                    - - -

                    - -

                    -Typically you define a key (for example escape) to switch the GUI on and off. Then you overlay the running game with the GUI (you will most likely pause the game then). -

                    - -

                    -Alternatively, you can also project the GUI as a texture onto a mesh textures inside the game. Allthough this looks cool and "immersive", this approach is rarely used since it is difficult to record clicks this way. You can only interact with this projected GUI by keyboard, or programmatically. You can select input fields using the arrow keys, and trigger actions using the return key. -

                    - -

                    -This GUI projection variant is less commonly used than the GUI overlay variant. Usecases for GUI projection are, for example, a player avatar using an in-game computer screen. -

                    - -
                    - -

                    Sample Code

                    -
                    -
                      -
                    • -
                    • -
                    - -
                    - -

                    Projecting the User Interface Onto a Texture

                    -
                    - -

                    - -You can project the Nifty GUI onto a texture, load the texture into a material, and assign it to a Geometry (Quads or Boxes are best). -

                    -
                    /** Create a special viewport for the Nifty GUI */
                    +

                    Integrating Nifty GUI: Projection

                    1. Nifty GUI Overlay or Nifty GUI Projection

                    Typically you define a key (for example escape) to switch the GUI on and off. Then you overlay the running game with the GUI (you will most likely pause the game then).

                    Alternatively, you can also project the GUI as a texture onto a mesh textures inside the game. Allthough this looks cool and "immersive", this approach is rarely used since it is difficult to record clicks this way. You can only interact with this projected GUI by keyboard, or programmatically. You can select input fields using the arrow keys, and trigger actions using the return key.

                    This GUI projection variant is less commonly used than the GUI overlay variant. Usecases for GUI projection are, for example, a player avatar using an in-game computer screen.

                    Sample Code

                    Projecting the User Interface Onto a Texture

                    You can project the Nifty GUI onto a texture, load the texture into a material, and assign it to a Geometry (Quads or Boxes are best).

                    /** Create a special viewport for the Nifty GUI */
                     ViewPort niftyView = renderManager.createPreView("NiftyView", new Camera(1024, 768));
                     niftyView.setClearEnabled(true);
                     /** Create a new NiftyJmeDisplay for the integration */
                    @@ -73,36 +24,5 @@ Geometry geom = new Geometry("Box", b);
                     Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
                     mat.setTexture("m_ColorMap", niftytex); /** Here comes the texture! */
                     geom.setMaterial(mat);
                    -rootNode.attachChild(geom);
                    - -

                    -The MySettingsScreen class is a custom de.lessvoid.nifty.screen.ScreenController in which you implement your GUI behaviour. The variable data contains an object that you use to exchange state info with the game. See Nifty GUI Java Interaction for details on how to create this class. -

                    - -

                    -Run the code sample. You select buttons on this GUI with the arrow keys and then press return. Note that clicking on the texture will not work! -

                    - -
                    - -

                    Next Steps

                    -
                    - -

                    - -Now that you have layed out and integrated the GUI in your app, you want to respond to user input and display the current game. -

                    - -
                    - gui, - documentation, - nifty, - hud, - texture -
                    - -
                    +rootNode.attachChild(geom);

                    The MySettingsScreen class is a custom de.lessvoid.nifty.screen.ScreenController in which you implement your GUI behaviour. The variable data contains an object that you use to exchange state info with the game. See Nifty GUI Java Interaction for details on how to create this class.

                    Run the code sample. You select buttons on this GUI with the arrow keys and then press return. Note that clicking on the texture will not work!

                    Next Steps

                    Now that you have layed out and integrated the GUI in your app, you want to respond to user input and display the current game.

                    view online version

                    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html index 43a5c5780..7d180fc91 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_xml_layout.html @@ -1,101 +1,4 @@ - -

                    Laying out the GUI in XML

                    -
                    -
                      -
                    1. -
                    2. -
                    3. Nifty GUI XML Layout or Nifty GUI Java Layout
                      -
                    4. -
                    5. -
                    6. -
                    7. -
                    8. -
                    - -

                    - -You can "draw" the GUI to the screen by writing XML code (alternatively you can also use Java). -

                    - -
                    - -

                    Plan Your GUI Layout

                    -
                    - -

                    - - -

                    - -

                    -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 that displays info during the game. Before writing code, you plan the GUI layout, either on paper or in a graphic application. -

                    - -

                    -The StartScreen contains: -

                    -
                      -
                    • The background layer has a centered layout and contains an image.
                      -
                    • -
                    • The top layer has a vertical layout, containing 3 panels:
                      -
                        -
                      • The top panel contains a label with the game title,
                        -
                      • -
                      • The middle panel contains a text field with the game description.
                        -
                      • -
                      • The bottom panel has a horizontal layout and contains two more panels:
                        -
                          -
                        • The left panel contains a Start button.
                          -
                        • -
                        • The right panel contains a Quit button.
                          -
                        • -
                        -
                      • -
                      -
                    • -
                    - -

                    - -The HUD contains: -

                    -
                      -
                    • The background layer has a centered layout, and contains a the partially transparent HUD image.
                      -
                    • -
                    • The top layer has a horizontal layout, containing 2 panels:
                      -
                        -
                      • The left panel as transparent spacer.
                        -
                      • -
                      • The right panel has a vertical layout containing 2 panels, a label and an image.
                        -
                      • -
                      -
                    • -
                    - -
                    - -

                    Implement Your GUI Layout

                    -
                    - -

                    - - -

                    - -

                    -Create an empty screen.xml file in the assets/Interfaces/ directory of your project. One XML 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). -

                    - -
                    - -

                    Make Screens

                    -
                    - -

                    - -The following minimal XML file contains a start screen and a HUD screen. (Neither has been defined yet.) -

                    -
                    <?xml version="1.0" encoding="UTF-8"?>
                    +

                    Laying out the GUI in XML

                    1. Nifty GUI XML Layout or Nifty GUI Java Layout

                    You can "draw" the GUI to the screen by writing XML code (alternatively you can also use Java).

                    Plan Your GUI Layout

                    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 that displays info during the game. Before writing code, you plan the GUI layout, either on paper or in a graphic application.

                    The StartScreen contains:

                    • The background layer has a centered layout and contains an image.
                    • The top layer has a vertical layout, containing 3 panels:
                      • The top panel contains a label with the game title,
                      • The middle panel contains a text field with the game description.
                      • The bottom panel has a horizontal layout and contains two more panels:
                        • The left panel contains a Start button.
                        • The right panel contains a Quit button.

                    The HUD contains:

                    • The background layer has a centered layout, and contains a the partially transparent HUD image.
                    • The top layer has a horizontal layout, containing 2 panels:
                      • The left panel as transparent spacer.
                      • The right panel has a vertical layout containing 2 panels, a label and an image.

                    Implement Your GUI Layout

                    Create an empty screen.xml file in the assets/Interfaces/ directory of your project. One XML 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).

                    Make Screens

                    The following minimal XML file contains a start screen and a HUD screen. (Neither has been defined yet.)

                    <?xml version="1.0" encoding="UTF-8"?>
                     <nifty xmlns="http://nifty-gui.sourceforge.net/nifty.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                            xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty.xsd http://nifty-gui.sourceforge.net/nifty.xsd">
                       <screen id="start">
                    @@ -104,26 +7,7 @@ The following minimal XML
                       <screen id="hud">
                         <!-- ... -->
                       </screen>
                    -</nifty>
                    - -

                    -Every Nifty GUI must have a start screen. The others (in this example, the HUD screen) are optional. -

                    - -

                    -Note: In the following examples, the XML schema header is abbreviated to just <nifty>. -

                    - -
                    - -

                    Make Layers

                    -
                    - -

                    - -The following minimal XML file shows how we added layers to the start screen and HUD screen: -

                    -
                    <nifty>
                    +</nifty>

                    Every Nifty GUI must have a start screen. The others (in this example, the HUD screen) are optional.

                    Note: In the following examples, the XML schema header is abbreviated to just <nifty>.

                    Make Layers

                    The following minimal XML file shows how we added layers to the start screen and HUD screen:

                    <nifty>
                       <screen id="start">
                         <layer id="background" backgroundColor="#000f">
                           <!-- ... -->
                    @@ -140,22 +24,7 @@ The following minimal XML
                           <!-- ... -->
                         </layer>
                       </screen>
                    -</nifty>
                    - -

                    -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. -

                    - -
                    - -

                    Make Panels

                    -
                    - -

                    - -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 start screen's foreground layer: -

                    -
                          <panel id="panel_top" height="25%" width="75%" align="center" childLayout="center"
                    +</nifty>

                    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.

                    Make Panels

                    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 start screen's foreground layer:

                          <panel id="panel_top" height="25%" width="75%" align="center" childLayout="center"
                                  backgroundColor="#f008">  
                           </panel>
                           <panel id="panel_mid" height="50%" width="75%" align="center" childLayout="center"
                    @@ -169,12 +38,7 @@ A panel is the inner-most container (that will contain the actual content: text,
                             <panel id="panel_bottom_right" height="50%" width="50%" valign="center" childLayout="center"
                                  backgroundColor="#88f8">  
                             </panel>
                    -      </panel>
                    - -

                    -The following panels go into in the hud screen's foreground layer: -

                    -
                          <panel id="panel_left" width="80%" height="100%" childLayout="vertical" 
                    +      </panel>

                    The following panels go into in the hud screen's foreground layer:

                          <panel id="panel_left" width="80%" height="100%" childLayout="vertical" 
                           backgroundColor="#0f08">  
                             <!-- spacer -->
                           </panel>
                    @@ -189,148 +53,33 @@ The following panels go into in the hud screen's foregro
                             <panel id="panel_bot_right" width="100%" height="70%" valign="center"
                                  backgroundColor="#88f8">  
                             </panel>
                    -      </panel>
                    - -

                    -The result should look as follows: -

                    - -

                    - -

                    - -
                    - -

                    Adding Content to Panels

                    -
                    - -

                    - -See also on the Nifty GUI site. -

                    - -
                    - -

                    Add Images

                    -
                    - -

                    - -The start-background.png image is a fullscreen background picture. In the start screen, add the following image element: - -

                    -
                        <layer id="background" childLayout="center">
                    +      </panel>

                    The result should look as follows:

                    Adding Content to Panels

                    See also on the Nifty GUI site.

                    Add Images

                    The start-background.png image is a fullscreen background picture. In the start screen, add the following image element:

                        <layer id="background" childLayout="center">
                             <image filename="Interface/tutorial/step2/start-background.png"></image>
                    -    </layer>
                    - -

                    -The hud-frame.png image is a transparent frame that we use as HUD decoration. In the hud screen, add the following image element: - -

                    -
                        <layer id="background" childLayout="center">
                    +    </layer>

                    The hud-frame.png image is a transparent frame that we use as HUD decoration. In the hud screen, add the following image element:

                        <layer id="background" childLayout="center">
                             <image filename="Interface/tutorial/step2/hud-frame.png"></image>
                    -    </layer>
                    - -

                    -In order to make the hud-frame.png independent of the screen resolution you are using, you could use the imageMode attribute on the image element -

                    -
                        <layer id="background" childLayout="center">
                    +    </layer>

                    In order to make the hud-frame.png independent of the screen resolution you are using, you could use the imageMode attribute on the image element

                        <layer id="background" childLayout="center">
                             <image filename="Interface/tutorial/step2/hud-frame.png" imageMode="resize:40,490,110,170,40,560,40,270,40,560,40,40" width="100%" height="100%"/>
                    -    </layer>
                    - -

                    -The face1.png image is an image that you want to use as a status icon. -In the hud screen's foreground layer, add the following image element: - -

                    -
                            <panel id="panel_bottom_left" height="75%" width="20%" valign="center" childLayout="center">  
                    +    </layer>

                    The face1.png image is an image that you want to use as a status icon. In the hud screen's foreground layer, add the following image element:

                            <panel id="panel_bottom_left" height="75%" width="20%" valign="center" childLayout="center">  
                                 <image filename="Interface/tutorial/step2/face1.png" 
                                     valign="center" align="center" height="50%" width="30%" >
                                 </image>
                    -        </panel>
                    - -

                    - -This image is scaled to use 50% of the height and 30% of the width of its container. -

                    - -
                    - -

                    Add Static Text

                    -
                    - -

                    - -The game title is a typical exmaple of static text. In the start screen, add the following text element: - -

                    -
                          <panel id="panel_top" height="25%" width="75%" align="center" childLayout="center">  
                    +        </panel>

                    This image is scaled to use 50% of the height and 30% of the width of its container.

                    Add Static Text

                    The game title is a typical exmaple of static text. In the start screen, add the following text element:

                          <panel id="panel_top" height="25%" width="75%" align="center" childLayout="center">  
                               <text text="My Cool Game" font="Interface/Fonts/Default.fnt" width="100%" height="100%" />
                    -      </panel>
                    - -

                    -For longer pieces of static text, such as an introduction, you can use wrap="true". Add the following text element to the Start screen: -

                    -
                          <panel id="panel_mid" height="50%" width="75%" align="center" childLayout="center">       
                    +      </panel>

                    For longer pieces of static text, such as an introduction, you can use wrap="true". Add the following text element to the Start screen:

                          <panel id="panel_mid" height="50%" width="75%" align="center" childLayout="center">       
                             <text text="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. ..." 
                             font="Interface/Fonts/Default.fnt" width="100%" height="100%" wrap="true" />
                    -      </panel>
                    - -

                    -The font used is jME3's default font "Interface/Fonts/Default.fnt" which is included in the jMonkeyEngine.JAR. You can add your own fonts to your own assets/Interface directory. -

                    - -
                    - -

                    Add Controls

                    -
                    - -

                    - -Before you can use any control, you must load a Control Definition first. Add the following two lines before your screen definitions: -

                    -
                      <useControls filename="nifty-default-controls.xml" />
                    -  <useStyles filename="nifty-default-styles.xml" />
                    - -
                    - -

                    Label Control

                    -
                    - -

                    - -Use label controls for text that you want to edit dynamically from Java. One example for this is the score display. -In the hud screen's foreground layer, add the following text element: -

                    -
                            <panel id="panel_top_right" height="100%" width="15%" childLayout="center">  
                    +      </panel>

                    The font used is jME3's default font "Interface/Fonts/Default.fnt" which is included in the jMonkeyEngine.JAR. You can add your own fonts to your own assets/Interface directory.

                    Add Controls

                    Before you can use any control, you must load a Control Definition first. Add the following two lines before your screen definitions:

                      <useControls filename="nifty-default-controls.xml" />
                    +  <useStyles filename="nifty-default-styles.xml" />

                    Label Control

                    Use label controls for text that you want to edit dynamically from Java. One example for this is the score display. In the hud screen's foreground layer, add the following text element:

                            <panel id="panel_top_right" height="100%" width="15%" childLayout="center">  
                                 <control name="label" color="#000" text="123" width="100%" height="100%" />
                    -        </panel>
                    - -

                    -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't scale well). -

                    - -
                    - -

                    Button Control

                    -
                    - -

                    - -Our GUI plan asks for two buttons on the start screen. You add the Start and Quit buttons to the bottom panel of the start screen using the <control> element: -

                    -
                            <panel id="panel_bottom_left" height="50%" width="50%" valign="center" childLayout="center">  
                    +        </panel>

                    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't scale well).

                    Button Control

                    Our GUI plan asks for two buttons on the start screen. You add the Start and Quit buttons to the bottom panel of the start screen using the <control> element:

                            <panel id="panel_bottom_left" height="50%" width="50%" valign="center" childLayout="center">  
                               <control name="button" label="Start" id="StartButton" align="center" valign="center"> 
                               </control>
                             </panel>
                             <panel id="panel_bottom_right" height="50%" width="50%" valign="center" childLayout="center">  
                               <control name="button" label="Quit" id="QuitButton" align="center" valign="center"> 
                               </control>
                    -        </panel>
                    - -

                    -Note that these controls don't do anything yet – we'll get to that soon. + </panel>

                    Note that these controls don't do anything yet – we'll get to that soon.

                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/open_game_finder.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/open_game_finder.html index a965d4c99..078a9e7b5 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/open_game_finder.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/open_game_finder.html @@ -1,195 +1,2 @@ - -

                    Open Game Finder

                    -
                    - -

                    -The Open Game Finder (OGF) by Mark Schrijver can be plugged into any Java game. OGF enables you to find other people playing the same multiplayer game, and join them. -

                    -
                      -
                    • Homepage:
                      -
                    • -
                    • Documentation:
                      -
                    • -
                    - -

                    -Both on the client and the server side of OGF is written purely in Java. OGF has a pluggable architecture and comes with a full set of plugins to get the job done. You can add your own plugins, or replace existing plugins to make them more in line with your game. OGF uses NiftyGUI as the main GUI plugin. - -

                    - -
                    - -

                    Installation

                    -
                    -
                      -
                    1. Go to
                      -
                    2. -
                    3. Download Client-1.0-bin.zip and Server-1.0-bin.zip
                      -
                    4. -
                    5. Unzip the two files to, for example, your jMonkeyProjects directory.
                      -
                    6. -
                    - -
                    - -

                    Setting up the Database

                    -
                    - -

                    -The OGF server uses an embedded Apache Derby database. You have to install the database, this means creating the data files and adding the tables. You can do this straight from the command line by running a script file. -

                    -
                      -
                    • On Windows, use installServer.bat to create a new database from scratch. On Mac OS or Linux, run java -jar lib/Server-0.1.jar install in the Terminal.
                      -
                    • -
                    • On Windows, use updateServer.bat to update the difference between the current state of the database and the way it should be. On Mac OS and Linux, run java -jar lib/Server-0.1.jar update in the Terminal.
                      -This new feature is currently untested.
                      -
                    • -
                    - -
                    - -

                    Running the server

                    -
                    - -

                    -Change into the OGF-Server directory and run the server: -

                    -
                      -
                    • On Windows: Run startServer.bat
                      -
                    • -
                    • On Linux and MacOS X: Run java -jar lib/Server-1.0.jar in the Terminal.
                      -
                    • -
                    - -

                    -The server is now running and ready to accept connections.
                    - -Note: In the alpha release, the server runs on localhost. In the final release, you will be able to configure the host! - -

                    - -
                    - -

                    Running the client

                    -
                    -
                      -
                    1. Change into the OGF-Client directory and run the client:
                      -
                        -
                      • On Windows: Run startClient.bat
                        -
                      • -
                      • On Linux and MacOS X: Run java -jar lib/Client-1.0.jar in the Terminal.
                        -
                      • -
                      -
                    2. -
                    3. If a Display Settings window appears, you can keep the defaults and click OK.
                      -
                    4. -
                    - -

                    -A client is now running, connects to the server, and displays a registration/login window. - -Note: You can run several clients on localhost for testing. - -

                    - -
                    - -

                    Client: 1. Registration

                    -
                    - -

                    -If clients use OGF for the first time, they need to register. -On the main screen of the client: -

                    -
                      -
                    1. Click Register
                      -
                    2. -
                    3. Choose a user name and password (repeat the password).
                      -
                    4. -
                    5. Select an Avatar image.
                      -
                    6. -
                    7. Click register to complete the registration.
                      -
                    8. -
                    - -

                    -The client registers the account and opens the chat window directly. - -

                    - -
                    - -

                    Client: 2. Login

                    -
                    - -

                    -If returning clients are already registered to an OGF server, they can log in. -On the main screen of the client: -

                    -
                      -
                    1. Enter a user name and password that you previously registered.
                      -
                    2. -
                    3. Click Login
                      -
                    4. -
                    - -

                    -The client logs you in and opens the chat window. - -

                    - -
                    - -

                    Client: 3. Chat

                    -
                    - -

                    -The chat window shows a list of all users logged in to the server. Logged-in users can send public messages, and can receive public messages from others. - -

                    - -
                    - -

                    Connecting to a Game

                    -
                    - -

                    -Q: I want to gather players using the OGF client to connect to the game server. How do I start my multiplayer game?
                    - -A: The following sample code demos the typical use case: -
                    - -In a JME3 Application's init method: -

                    -
                      -
                    1. Create a com.ractoc.opengamefinder.client.GUIContainer object.
                      -
                    2. -
                    3. Create a game instance using the GUIContainer (via a ClientFactory).
                      -
                    4. -
                    5. Check the com.ractoc.pffj.api.BasePluginMessageResult for success or failure.
                      -
                    6. -
                    - -

                    -After this, continue writing your JME3 init method. - -

                    - -
                    - -

                    Configuration

                    -
                    -
                      -
                    • Q: How can I offer more avatars to choose from?
                      -A: Save the image files in the path jMonkeyProjects/OGF-Client-1.0-bin/OGF/resources/avatars/
                      -
                    • -
                    • Q: How do I configure servers addresses?
                      -A: TBD
                      -
                    • -
                    -
                    - network -
                    - -
                    +

                    Open Game Finder

                    The Open Game Finder (OGF) by Mark Schrijver can be plugged into any Java game. OGF enables you to find other people playing the same multiplayer game, and join them.

                    • Homepage:
                    • Documentation:

                    Both on the client and the server side of OGF is written purely in Java. OGF has a pluggable architecture and comes with a full set of plugins to get the job done. You can add your own plugins, or replace existing plugins to make them more in line with your game. OGF uses NiftyGUI as the main GUI plugin.

                    Installation

                    1. Go to
                    2. Download Client-1.0-bin.zip and Server-1.0-bin.zip
                    3. Unzip the two files to, for example, your jMonkeyProjects directory.

                    Setting up the Database

                    The OGF server uses an embedded Apache Derby database. You have to install the database, this means creating the data files and adding the tables. You can do this straight from the command line by running a script file.

                    • On Windows, use installServer.bat to create a new database from scratch. On Mac OS or Linux, run java -jar lib/Server-0.1.jar install in the Terminal.
                    • On Windows, use updateServer.bat to update the difference between the current state of the database and the way it should be. On Mac OS and Linux, run java -jar lib/Server-0.1.jar update in the Terminal.
                      This new feature is currently untested.

                    Running the server

                    Change into the OGF-Server directory and run the server:

                    • On Windows: Run startServer.bat
                    • On Linux and MacOS X: Run java -jar lib/Server-1.0.jar in the Terminal.

                    The server is now running and ready to accept connections.
                    Note: In the alpha release, the server runs on localhost. In the final release, you will be able to configure the host!

                    Running the client

                    1. Change into the OGF-Client directory and run the client:
                      • On Windows: Run startClient.bat
                      • On Linux and MacOS X: Run java -jar lib/Client-1.0.jar in the Terminal.
                    2. If a Display Settings window appears, you can keep the defaults and click OK.

                    A client is now running, connects to the server, and displays a registration/login window. Note: You can run several clients on localhost for testing.

                    Client: 1. Registration

                    If clients use OGF for the first time, they need to register. On the main screen of the client:

                    1. Click Register
                    2. Choose a user name and password (repeat the password).
                    3. Select an Avatar image.
                    4. Click register to complete the registration.

                    The client registers the account and opens the chat window directly.

                    Client: 2. Login

                    If returning clients are already registered to an OGF server, they can log in. On the main screen of the client:

                    1. Enter a user name and password that you previously registered.
                    2. Click Login

                    The client logs you in and opens the chat window.

                    Client: 3. Chat

                    The chat window shows a list of all users logged in to the server. Logged-in users can send public messages, and can receive public messages from others.

                    Connecting to a Game

                    Q: I want to gather players using the OGF client to connect to the game server. How do I start my multiplayer game?
                    A: The following sample code demos the typical use case:
                    In a JME3 Application's init method:

                    1. Create a com.ractoc.opengamefinder.client.GUIContainer object.
                    2. Create a game instance using the GUIContainer (via a ClientFactory).
                    3. Check the com.ractoc.pffj.api.BasePluginMessageResult for success or failure.

                    After this, continue writing your JME3 init method.

                    Configuration

                    • Q: How can I offer more avatars to choose from?
                      A: Save the image files in the path jMonkeyProjects/OGF-Client-1.0-bin/OGF/resources/avatars/
                    • Q: How do I configure servers addresses?
                      A: TBD

                    view online version

                    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/particle_emitters.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/particle_emitters.html index 6d57fab56..dce934499 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/particle_emitters.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/particle_emitters.html @@ -1,82 +1,6 @@ - -

                    Particle Emmitter Settings

                    -
                    - -

                    - -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 just right, and it's worth exploring the expressiveness of the options described below. -

                    - -

                    -

                    Use the Scene Explorer in the SDK to design and preview effects. -

                    -

                    - -

                    - -

                    - -
                    - -

                    Create an Emitter

                    -
                    -
                      -
                    1. Create one emitter for each effect:
                      ParticleEmitter explosion = new ParticleEmitter(
                      -"My explosion effect", ParticleMesh.Type.Triangle, 30);
                      -
                      -
                    2. -
                    3. Attach the emitter to the rootNode and position it in the scene:
                      rootNode.attachChild(explosion);
                      -explosion.setLocalTranslation(bomb.getLocalTranslation());
                      -
                      -
                    4. -
                    5. Trigger the effect by calling
                      explosion.emitAllParticles()
                      -
                      -
                    6. -
                    7. End the effect by calling
                      explosion.killAllParticles()
                      -
                      -
                    8. -
                    - -

                    -Choose one of the following mesh shapes -

                    -
                      -
                    • ParticleMesh.Type.Triangle
                      -
                    • -
                    • ParticleMesh.Type.Point
                      -
                    • -
                    - -
                    - -

                    Configure Parameters

                    -
                    - -

                    -Not all of these parameters are required for all kinds of effects. If you don't specify one of them, a default value will be used. -

                    -
                    - - - - - - - - - - - - - - - +

                    Particle Emmitter Settings

                    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 just right, and it's worth exploring the expressiveness of the options described below.

                    Use the Scene Explorer in the SDK to design and preview effects.

                    Create an Emitter

                    1. Create one emitter for each effect:
                      ParticleEmitter explosion = new ParticleEmitter(
                      +"My explosion effect", ParticleMesh.Type.Triangle, 30);
                    2. Attach the emitter to the rootNode and position it in the scene:
                      rootNode.attachChild(explosion);
                      +explosion.setLocalTranslation(bomb.getLocalTranslation());
                    3. Trigger the effect by calling
                      explosion.emitAllParticles()
                    4. End the effect by calling
                      explosion.killAllParticles()

                    Choose one of the following mesh shapes

                    • ParticleMesh.Type.Triangle
                    • ParticleMesh.Type.Point

                    Configure Parameters

                    Not all of these parameters are required for all kinds of effects. If you don't specify one of them, a default value will be used.

                    Parameter Method Default Description
                    number setNumParticles() The maximum number of particles visible at the same time. Specified by user in constructor.
                    emission rate setParticlesPerSec() 20 Density of the effect, how many new particles are emitted per second.
                    -Set to zero to control the start/end of the effect.
                    -Set to a number for a constantly running effect.
                    size setStartSize(), setEndSize() 0.2f, 2f The radius of the scaled sprite image. Set both to same value for constant size effect.
                    -Set to different values for shrink/grow effect.
                    color setStartColor(), setEndColor() gray Controls how the opaque (non-black) parts of the texture are colorized.
                    -Set both to the same color for single-colored effects (e.g. fog, debris).
                    -Set both to different colors for a gradient effect (e.g. fire).
                    @@ -195,7 +119,7 @@ The following effect textures are available by default from test-data.jar<
                    ParameterMethodDefaultDescription
                    numbersetNumParticles()The maximum number of particles visible at the same time. Specified by user in constructor.
                    emission ratesetParticlesPerSec()20Density of the effect, how many new particles are emitted per second.
                    Set to zero to control the start/end of the effect.
                    Set to a number for a constantly running effect.
                    sizesetStartSize(), setEndSize()0.2f, 2fThe radius of the scaled sprite image. Set both to same value for constant size effect.
                    Set to different values for shrink/grow effect.
                    colorsetStartColor(), setEndColor()grayControls how the opaque (non-black) parts of the texture are colorized.
                    Set both to the same color for single-colored effects (e.g. fog, debris).
                    Set both to different colors for a gradient effect (e.g. fire).
                    direction/velocity getParticleInfluencer(). setInitialVelocity(initialVelocity) Vector3f(0,0,0) A vector specifying the initial direction and speed of particles. The longer the vector, the faster.
                    Effects/Smoke/Smoke.png 1*15
                    - +

                    Tip: Use the setStartColor()/setEndColor() settings described above to colorize the white and gray parts of textures. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics.html index bf25ee040..9753eaf51 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics.html @@ -1,166 +1,7 @@ - -

                    Physics: Gravity, Collisions, Forces

                    -
                    - -

                    - -The jMonkeyEngine3 has built-in support for via the com.jme3.bullet package. -

                    - -

                    -Game Physics are used in applications that simulate mass/gravity, collisions, and friction. Think of pool billiard or car racing simulations. -

                    - -

                    -If you are looking for info on how to respond to physics events, read about Physics Listeners. -

                    - -
                    - -

                    Technical Overview

                    -
                    - -

                    - -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. -

                    - -

                    -A bullet physics space can be created with a BulletAppState. The updating and syncing of the actual physics entities happens in the following way: -

                    - -

                    -A "normal" update loop with physics looks like this: -

                    -
                      -
                    1. collision callbacks (BulletAppState.update())
                      -
                    2. -
                    3. user update (simpleUpdate / update)
                      -
                    4. -
                    5. physics to scenegraph syncing/applying (updateLogicalState())
                      -
                    6. -
                    7. stepping physics (before / in parallel to Application.render())
                      -
                    8. -
                    - -

                    -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. -

                    - -
                    - -

                    Sample Code

                    -
                    - -

                    - -Full code samples are here: -

                    -
                      -
                    • -
                    • -
                    • -
                    • -
                    • -
                    • -
                    • -
                    • -
                    - -
                    - -

                    Physics Application

                    -
                    - -

                    - -A short overview of how to write a jME application with Physics capabilities: -

                    - -

                    -Do the following once per application to gain access to the physicsSpace object: -

                    -
                      -
                    1. Make you application extend com.jme3.app.SimpleApplication.
                      -
                    2. -
                    3. Create a BulletAppState field:
                      private BulletAppState bulletAppState;
                      -
                      -
                    4. -
                    5. Initialize your bulletAppState and attach it to the state manager:
                      public void simpleInitApp() {
                      +

                      Physics: Gravity, Collisions, Forces

                      The jMonkeyEngine3 has built-in support for via the com.jme3.bullet package.

                      Game Physics are used in applications that simulate mass/gravity, collisions, and friction. Think of pool billiard or car racing simulations.

                      If you are looking for info on how to respond to physics events, read about Physics Listeners.

                      Technical Overview

                      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.

                      A bullet physics space can be created with a BulletAppState. The updating and syncing of the actual physics entities happens in the following way:

                      A "normal" update loop with physics looks like this:

                      1. collision callbacks (BulletAppState.update())
                      2. user update (simpleUpdate / update)
                      3. physics to scenegraph syncing/applying (updateLogicalState())
                      4. stepping physics (before / in parallel to Application.render())

                      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.

                      Sample Code

                      Full code samples are here:

                      Physics Application

                      A short overview of how to write a jME application with Physics capabilities:

                      Do the following once per application to gain access to the physicsSpace object:

                      1. Make you application extend com.jme3.app.SimpleApplication.
                      2. Create a BulletAppState field:
                        private BulletAppState bulletAppState;
                      3. Initialize your bulletAppState and attach it to the state manager:
                        public void simpleInitApp() {
                             bulletAppState = new BulletAppState();
                             stateManager.attach(bulletAppState);
                        -    ...
                        -
                        -
                      4. -
                      - -

                      - -You can also access the BulletAppState via the state manager: -

                      -
                      stateManager.getState(BulletAppState.class)
                      - -

                      -For each Spatial that you want to be physical: -

                      -
                        -
                      1. Create a CollisionShape.
                        -
                      2. -
                      3. Create a PhysicsControl by supplying the CollisionShape and mass.
                        -
                          -
                        • E.g. com.jme3.bullet.control.RigidBodyControl
                          -
                        • -
                        -
                      4. -
                      5. Add the PhysicsControl to the Spatial.
                        -
                      6. -
                      7. Add the PhysicsControl to the physicsSpace object.
                        -
                      8. -
                      9. Attach the Spatial to the rootNode, as usual.
                        -
                      10. -
                      11. (Optional) Implement the PhysicsCollisionListener interface to respond to PhysicsCollisionEvents if desired.
                        -
                      12. -
                      - -
                      - -

                      Collision Shapes

                      -
                      - -

                      - -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. -

                      - -

                      -Before you can create a Physics Control, you must create a Collision Shape from the com.jme3.bullet.collision.shapes package. (Read the tip under "PhysicsControls Code Samples" to learn how to use default CollisionShapes for Boxes and Spheres.) - -

                      -
                      - - - - - - - - - - - - - - - - - - - - - - -
                      Shape Usage Examples
                      BoxCollisionShape Box shaped entities Does not roll. Bricks, crates, simple oblong entities.
                      SphereCollisionShape Spherical entities. Can roll. Balls, simple compact entities.
                      CylinderCollisionShape Tube-shaped and disc-shaped entities. Can roll on one side. Pillars, wheels.
                      CapsuleCollisionShape A compound of a cylinder plus two spheres at the top and bottom. Is locked to stay upright, does not roll. 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.
                      CompoundCollisionShape A CompoundCollisionShape allows custom combinations of box/sphere/cylinder shapes to form another more complex shape. Complex shapes.
                      MeshCollisionShape A free-form mesh-accurate shape that wraps itself around a static entity.
                      -Limitations: Only non-mesh collision shapes (sphere, box, cylinder, compound) can collide with mesh-accurate collision shapes. Only works for static obstacles.
                      A whole static game level model.
                      GImpactCollisionShape This free-form Mesh Collision Shape that wraps itself around dynamically moving entities. Uses .
                      + ...

                      You can also access the BulletAppState via the state manager:

                      stateManager.getState(BulletAppState.class)

                      For each Spatial that you want to be physical:

                      1. Create a CollisionShape.
                      2. Create a PhysicsControl by supplying the CollisionShape and mass.
                        • E.g. com.jme3.bullet.control.RigidBodyControl
                      3. Add the PhysicsControl to the Spatial.
                      4. Add the PhysicsControl to the physicsSpace object.
                      5. Attach the Spatial to the rootNode, as usual.
                      6. (Optional) Implement the PhysicsCollisionListener interface to respond to PhysicsCollisionEvents if desired.

                      Collision Shapes

                      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.

                      Before you can create a Physics Control, you must create a Collision Shape from the com.jme3.bullet.collision.shapes package. (Read the tip under "PhysicsControls Code Samples" to learn how to use default CollisionShapes for Boxes and Spheres.)

                      @@ -430,8 +271,8 @@ setLocalRotation(); +setKinematic(true);
                      ShapeUsageExamples
                      BoxCollisionShapeBox shaped entities Does not roll.Bricks, crates, simple oblong entities.
                      SphereCollisionShapeSpherical entities. Can roll.Balls, simple compact entities.
                      CylinderCollisionShapeTube-shaped and disc-shaped entities. Can roll on one side.Pillars, wheels.
                      CapsuleCollisionShapeA compound of a cylinder plus two spheres at the top and bottom. Is locked to stay upright, does not roll.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.
                      CompoundCollisionShapeA CompoundCollisionShape allows custom combinations of box/sphere/cylinder shapes to form another more complex shape.Complex shapes.
                      MeshCollisionShapeA free-form mesh-accurate shape that wraps itself around a static entity.
                      Limitations: Only non-mesh collision shapes (sphere, box, cylinder, compound) can collide with mesh-accurate collision shapes. Only works for static obstacles.
                      A whole static game level model.
                      GImpactCollisionShapeThis free-form Mesh Collision Shape that wraps itself around dynamically moving entities. Uses .
                      Limitations: CPU intensive, use sparingly! We recommend using HullCollisionShapes or CompoundShapes made of simple shapes if you need improved performance.
                      Physics simulation of a complex object.
                      setPhysicsLocation();
                      How to activate? setMass(0f);
                      setKinematic(false);
                      setMass(1f);
                      -setKinematic(false);
                      setMass(1f);
                      -setKinematic(true);
                      setMass(1f);
                      +setKinematic(false);
                      diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html index 663ae088f..61122c75b 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/physics_listeners.html @@ -1,79 +1,12 @@ - -

                      Physics Listeners

                      -
                      - -

                      -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. - -

                      - -
                      - -

                      Physics Tick Listener

                      -
                      - -

                      -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. - -

                      - -
                      - -

                      When (Not) to Use Tick Listener?

                      -
                      - -

                      -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 physicsSpace.add(ghost); ghost.getOverLappingObjects() 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't need a PhysicsTickListener. - -

                      - -
                      - -

                      How to Listen to Physics Ticks

                      -
                      - -

                      -Here's is the declaration of an examplary Physics Control that listens to ticks. - -

                      -
                      public class MyCustomControl
                      -    extends RigidBodyControl implements PhysicsTickListener { ... }
                      - -

                      - -When you implement the interface, you have to implement preTick() and postTick() methods. -

                      -
                        -
                      • prePhysicsTick() is called before the step, here you apply forces (change the state).
                        -
                      • -
                      • physicsTick() is called after the step, here you poll the results (get the current state).
                        -
                      • -
                      -
                      @override
                      +

                      Physics Listeners

                      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.

                      Physics Tick Listener

                      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.

                      When (Not) to Use Tick Listener?

                      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 physicsSpace.add(ghost); ghost.getOverLappingObjects() 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't need a PhysicsTickListener.

                      How to Listen to Physics Ticks

                      Here's is the declaration of an examplary Physics Control that listens to ticks.

                      public class MyCustomControl
                      +    extends RigidBodyControl implements PhysicsTickListener { ... }

                      When you implement the interface, you have to implement preTick() and postTick() methods.

                      • prePhysicsTick() is called before the step, here you apply forces (change the state).
                      • physicsTick() is called after the step, here you poll the results (get the current state).
                      @override
                       public void prePhysicsTick(PhysicsSpace space, float f){
                         // apply state changes ...
                       }
                       @override
                       public void physicsTick(PhysicsSpace space, float f){
                         // poll game state ...
                      -}
                      - -
                      - -

                      Physics Collision Listener

                      -
                      - -
                      - -

                      When (Not) to Use Collision Listener

                      -
                      - -

                      -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 "Balls rolling, bricks falling" 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: +}

                      Physics Collision Listener

                      When (Not) to Use Collision Listener

                      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 "Balls rolling, bricks falling" 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:

                      • Increasing a counter (e.g. score points)
                        diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/remote-controlling_the_camera.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/remote-controlling_the_camera.html index cdd2b3351..31c1e1544 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/remote-controlling_the_camera.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/remote-controlling_the_camera.html @@ -1,34 +1,4 @@ - -

                        Remote-Controlling the Camera

                        -
                        - -
                        - -

                        Positioning the Camera

                        -
                        - -

                        - -You can steer the camera using Cinematics: -

                        -
                          -
                        1. Create a Cinematic.
                          -
                        2. -
                        3. Create a CameraNode and bind the camera object to the Cinematic. Note that we also give the camera node a name in this step.
                          CameraNode camNode = cinematic.bindCamera("topView", cam);
                          -
                          -
                        4. -
                        5. Position the camera node in its start location.
                          -
                        6. -
                        7. Use activateCamera() to give the control of the camera to this node. You now see the scene from this camera's point of view. For example to see through the camera node named "topView", 6 seconds after the start of the cinematic, you'd write
                          cinematic.activateCamera(6, "topView");
                          -
                          -
                        8. -
                        - -
                        - -

                        Code Sample

                        -
                        -
                        flyCam.setEnabled(false);
                        +

                        Remote-Controlling the Camera

                        Positioning the Camera

                        You can steer the camera using Cinematics:

                        1. Create a Cinematic.
                        2. Create a CameraNode and bind the camera object to the Cinematic. Note that we also give the camera node a name in this step.
                          CameraNode camNode = cinematic.bindCamera("topView", cam);
                        3. Position the camera node in its start location.
                        4. Use activateCamera() to give the control of the camera to this node. You now see the scene from this camera's point of view. For example to see through the camera node named "topView", 6 seconds after the start of the cinematic, you'd write
                          cinematic.activateCamera(6, "topView");

                        Code Sample

                        flyCam.setEnabled(false);
                         Cinematic cinematic = new Cinematic(rootNode, 20);
                          
                         CameraNode camNodeTop = cinematic.bindCamera("topView", cam);
                        @@ -37,17 +7,5 @@ camNodeTop.getControl(0).setEnabled(false);
                          
                         CameraNode camNodeSide = cinematic.bindCamera("sideView", cam);
                         camNodeSide.setControlDir(ControlDirection.CameraToSpatial);
                        -camNodeSide.getControl(0).setEnabled(false);
                        - -
                        - -

                        Moving the Camera

                        -
                        - -

                        - -If desired, attach the camNode to a MotionTrack to let it travel along waypoints. This is demonstrated in the . -

                        - -
                        +camNodeSide.getControl(0).setEnabled(false);

                        Moving the Camera

                        If desired, attach the camNode to a MotionTrack to let it travel along waypoints. This is demonstrated in the .

                        view online version

                        \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/save_and_load.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/save_and_load.html index 064f4a3a7..602684fa9 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/save_and_load.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/save_and_load.html @@ -1,26 +1,4 @@ - -

                        Saving and Loading Games

                        -
                        - -

                        - -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 SDK. -

                        - -
                        - -

                        Sample Code

                        -
                        -
                          -
                        • -
                        • -
                        - -
                        - -

                        Saving a Node

                        -
                        -
                          @Override
                        +

                        Saving and Loading Games

                        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 SDK.

                        Sample Code

                        Saving a Node

                          @Override
                           public void destroy() {
                             System.getProperty("user.home");
                             BinaryExporter exporter = BinaryExporter.getInstance();
                        @@ -31,13 +9,7 @@ You can save and load scenes and individual Nodes using com.jme3.export.binary.B
                               Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Failed to save node!", ex);
                             }
                             super.destroy();
                        -  }
                        - -
                        - -

                        Loading a Node

                        -
                        -
                          @Override
                        +  }

                        Loading a Node

                          @Override
                           public void simpleInitApp() {
                             System.getProperty("user.home");
                             BinaryImporter importer = BinaryImporter.getInstance();
                        @@ -51,18 +23,7 @@ You can save and load scenes and individual Nodes using com.jme3.export.binary.B
                               Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "No saved node loaded.", ex);
                             }
                             ...
                        - 
                        - -
                        - -

                        Custom Savable

                        -
                        - -

                        - -If you have a custom class that you want to save or assign using setUserData(), the class must implement the com.jme3.export.Savable interface. -

                        -
                        import com.jme3.export.InputCapsule;
                        + 

                        Custom Savable

                        If you have a custom class that you want to save or assign using setUserData(), the class must implement the com.jme3.export.Savable interface.

                        import com.jme3.export.InputCapsule;
                         import com.jme3.export.JmeExporter;
                         import com.jme3.export.JmeImporter;
                         import com.jme3.export.OutputCapsule;
                        diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/sky.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/sky.html
                        index 6080e249a..902d15ca8 100644
                        --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/sky.html
                        +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/sky.html
                        @@ -1,95 +1,5 @@
                        -
                        -

                        How to add a Sky to your Scene

                        -
                        - -

                        - -
                        - -

                        - -

                        -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 "sky" background. -

                        - -
                        - -

                        Adding the Sky

                        -
                        - -

                        - -Adding a sky is extremely easy using the com.jme3.util.SkyFactory. -

                        -
                        rootNode.attachChild(SkyFactory.createSky(
                        -            assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
                        - -

                        -To add a sky you need to supply: -

                        -
                          -
                        1. The assetManager object to use
                          -
                        2. -
                        3. A cube or sphere map texture of the sky
                          -
                        4. -
                        5. Set the boolean to true if you are using a sphere map texture. For a cube map, use false.
                          -Tip: Cube map is the default. You would know if you had created a sphere map.
                          -
                        6. -
                        - -

                        - -Internally, the SkyFactory calls the following methods: -

                        -
                          -
                        1. sky.setQueueBucket(Bucket.Sky); makes certain the sky is rendered in the right order, behind everything else.
                          -
                        2. -
                        3. sky.setCullHint(Spatial.CullHint.Never); makes certain that the sky is never culled.
                          -
                        4. -
                        5. The SkyFactory uses the internal jME3 material definition Sky.j3md. This Material definition works with sphere and cube maps.
                          -
                        6. -
                        - -
                        - -

                        Creating the Textures

                        -
                        - -

                        - -As the sky texture we use the sample BrightSky.dds file from jme3test-test-data. -

                        - -

                        -How to create a sky textures? - -

                        -
                          -
                        • There are many tools out there that generate cube and sphere maps.
                          -Examples for landscape texture generators are Terragen or Bryce.
                          -
                        • -
                        • 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.
                          -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.
                          -
                        • -
                        • 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.
                          -
                        • -
                        • JME3 supports cube maps in PNG, JPG, or (compressed) DDS format.
                          -
                        • -
                        - -

                        - -Box or Sphere? -

                        -
                          -
                        • If you have access to cube map textures, then use a SkyBox
                          -
                            -
                          • -
                          • -
                          -
                        • -
                        • If you have access to sphere map textures – specially projected sky images that fit inside a sphere – then you use a SkySphere or SkyDome.
                          +

                          How to add a Sky to your Scene


                          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 "sky" background.

                          Adding the Sky

                          Adding a sky is extremely easy using the com.jme3.util.SkyFactory.

                          rootNode.attachChild(SkyFactory.createSky(
                          +            assetManager, "Textures/Sky/Bright/BrightSky.dds", false));

                          To add a sky you need to supply:

                          1. The assetManager object to use
                          2. A cube or sphere map texture of the sky
                          3. Set the boolean to true if you are using a sphere map texture. For a cube map, use false.
                            Tip: Cube map is the default. You would know if you had created a sphere map.

                          Internally, the SkyFactory calls the following methods:

                          1. sky.setQueueBucket(Bucket.Sky); makes certain the sky is rendered in the right order, behind everything else.
                          2. sky.setCullHint(Spatial.CullHint.Never); makes certain that the sky is never culled.
                          3. The SkyFactory uses the internal jME3 material definition Sky.j3md. This Material definition works with sphere and cube maps.

                          Creating the Textures

                          As the sky texture we use the sample BrightSky.dds file from jme3test-test-data.

                          How to create a sky textures?

                          • There are many tools out there that generate cube and sphere maps.
                            Examples for landscape texture generators are Terragen or Bryce.
                          • 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.
                            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.
                          • 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.
                          • JME3 supports cube maps in PNG, JPG, or (compressed) DDS format.

                          Box or Sphere?

                          • If you have access to cube map textures, then use a SkyBox
                          • If you have access to sphere map textures – specially projected sky images that fit inside a sphere – then you use a SkySphere or SkyDome.
                            • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/spatial.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/spatial.html index 2b30f2a8e..52ccecd7b 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/spatial.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/spatial.html @@ -1,39 +1,4 @@ - -

                              Spatial

                              -
                              - -

                              - -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. -

                              - -

                              -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 attached to the rootNode in a parent-child relationship. If you think you need to understand the scene graph concept better, please read Scenegraph for dummies first. -

                              - -
                              - -

                              Node versus Geometry

                              -
                              - -

                              - -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: -

                              - -

                              - - -

                              -
                              - - - - - - - - +

                              Spatial

                              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.

                              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 attached to the rootNode in a parent-child relationship. If you think you need to understand the scene graph concept better, please read Scenegraph for dummies first.

                              Node versus Geometry

                              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:

                              com.jme3.scene.Spatial
                              Purpose: 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.
                              com.jme3.scene.Geometry com.jme3.scene.Node
                              diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain.html index 3193f85be..39290b30a 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain.html @@ -1,114 +1,4 @@ - -

                              TerraMonkey - The jMonkeyEngine Terrain System

                              -
                              - -

                              - -The goal of TerraMonkey is to provide a base implementation that will be usable for 80% of people's goals, while providing tools and a good foundation for the other 20% to build off of. Check out the videos in the following announcements: -

                              -
                                -
                              • -
                              • -
                              • -
                              • -
                              - -
                              - -

                              Overview

                              -
                              - -

                              - -TerraMonkey is a GeoMipMapping quad tree of terrain tiles that supports real time editing and texture splatting. That's a mouth full! Lets look at each part: -

                              -
                                -
                              • GeoMipMapping: a method of changing the level of detail (LOD) of geometry tiles based on how far away they are from the camera. Between the edges of two tiles, it will seam those edges together so you don't get gaps or holes. For an in-depth read on how it works, here is a pdf .
                                -
                              • -
                              • Quad Tree: The entire terrain structure is made up of TerrainPatches (these hold the actual meshes) as leaves in a quad tree (TerrainQuad). TerrainQuads are subdivided by 4 until they reach minimum size, then a TerrainPatch is created, and that is where the actual geometry mesh lives. This allows for fast culling of the terrain that you can't see.
                                -
                              • -
                              • Splatting: The ability to paint multiple textures onto your terrain. What differs here from JME2 is that this is all done in a shader, no more render passes. So it performs much faster.
                                -
                              • -
                              • Real-time editing: TerraMonkey terrains are editable in jMonkeyEngine SDK, and you are able to modify them in real time: raising and lowering terrain.
                                -
                              • -
                              - -
                              - -

                              Current Features:

                              -
                              -
                                -
                              • Support for 16 splat textures. You use a custom combination of Diffuse, Normal, Specular, and Glow Maps.
                                -
                              • -
                              • GeoMipMapping: LodControl optimizes the level of detail
                                -
                              • -
                              • Terrain can be randomized or generated from a heightmap
                                -
                              • -
                              • jMonkeyEngine SDK terrain editor
                                -
                              • -
                              • Streaming terrain grid (ie. "infinite" terrain)
                                -
                              • -
                              - -
                              - -

                              Planned Features:

                              -
                              -
                                -
                              • Hydraulic erosion and procedural texture generation
                                -
                              • -
                              • Holes: caves, cliffs
                                -
                              • -
                              - -
                              - -

                              Sample Code

                              -
                              -
                                -
                              • -
                              • -
                              • -
                              • -
                              • -
                              • -
                              • -
                              • -
                              • -
                              • -
                              - -
                              - -

                              Geo Mip Mapping

                              -
                              - -

                              - -You have seen GeoMipMapping implemented in games before. This is where the farther away terrain has fewer polygons, and as you move closer, more polygons fill in. The whole terrain is divided into a grid of patches, and each one has its own level of detail (LOD). The GeoMipMapping algorithm looks at each patch, and its neighbours, to determine how to render the geometry. It will seam the edges between two patches with different LOD. -

                              - -

                              -GeoMipMapping often leads to "popping" where you see the terrain switch from one LOD to another. TerraMonkey has been designed so you can swap out different LOD calculation algorithms based on what will look best for your game. You can do this with the LodCalculator interface. -

                              - -

                              -GeoMipMapping in TerraMonkey has been split into several parts: the terrain quad tree, and the LODGeomap. The geomap deals with the actual LOD and seaming algorithm. So if you want a different data structure for your terrain system, you can re-use this piece of code. The quad tree (TerrainQuad and TerrainPatch) provide a means to organize the LODGeomaps, notify them of their neighbour's LOD change, and to update the geometry when the LOD does change. To change the LOD it does this by changing the index buffer of the triangle strip, so the whole geometry doesn't have to be re-loaded onto the video card. If you are eager, you can read up more detail how GeoMipMapping works here: -

                              - -
                              - -

                              Terrain Quad Tree

                              -
                              - -

                              - -TerraMonkey is a quad tree. Each node is a TerrainQuad, and each leaf is a TerrainPatch. A TerrainQuad has either 4 child TerrainQuads, or 4 child TerrainPatches. The TerrainPatch holds the actual mesh geometry. This structure is almost exactly the same as JME2's TerrainPage system. Except now each leaf has a reference to its neighbours, so it doesn't ever have to traverse the tree to get them. -

                              - -
                              - -

                              Texture Splatting

                              +

                              TerraMonkey - The jMonkeyEngine Terrain System

                              The goal of TerraMonkey is to provide a base implementation that will be usable for 80% of people's goals, while providing tools and a good foundation for the other 20% to build off of. Check out the videos in the following announcements:

                              Overview

                              TerraMonkey is a GeoMipMapping quad tree of terrain tiles that supports real time editing and texture splatting. That's a mouth full! Lets look at each part:

                              • GeoMipMapping: a method of changing the level of detail (LOD) of geometry tiles based on how far away they are from the camera. Between the edges of two tiles, it will seam those edges together so you don't get gaps or holes. For an in-depth read on how it works, here is a pdf .
                              • Quad Tree: The entire terrain structure is made up of TerrainPatches (these hold the actual meshes) as leaves in a quad tree (TerrainQuad). TerrainQuads are subdivided by 4 until they reach minimum size, then a TerrainPatch is created, and that is where the actual geometry mesh lives. This allows for fast culling of the terrain that you can't see.
                              • Splatting: The ability to paint multiple textures onto your terrain. What differs here from JME2 is that this is all done in a shader, no more render passes. So it performs much faster.
                              • Real-time editing: TerraMonkey terrains are editable in jMonkeyEngine SDK, and you are able to modify them in real time: raising and lowering terrain.

                              Current Features:

                              • Support for 16 splat textures. You use a custom combination of Diffuse, Normal, Specular, and Glow Maps.
                              • GeoMipMapping: LodControl optimizes the level of detail
                              • Terrain can be randomized or generated from a heightmap
                              • jMonkeyEngine SDK terrain editor
                              • Streaming terrain grid (ie. "infinite" terrain)

                              Planned Features:

                              • Hydraulic erosion and procedural texture generation
                              • Holes: caves, cliffs

                              Sample Code

                              Geo Mip Mapping

                              You have seen GeoMipMapping implemented in games before. This is where the farther away terrain has fewer polygons, and as you move closer, more polygons fill in. The whole terrain is divided into a grid of patches, and each one has its own level of detail (LOD). The GeoMipMapping algorithm looks at each patch, and its neighbours, to determine how to render the geometry. It will seam the edges between two patches with different LOD.

                              GeoMipMapping often leads to "popping" where you see the terrain switch from one LOD to another. TerraMonkey has been designed so you can swap out different LOD calculation algorithms based on what will look best for your game. You can do this with the LodCalculator interface.

                              GeoMipMapping in TerraMonkey has been split into several parts: the terrain quad tree, and the LODGeomap. The geomap deals with the actual LOD and seaming algorithm. So if you want a different data structure for your terrain system, you can re-use this piece of code. The quad tree (TerrainQuad and TerrainPatch) provide a means to organize the LODGeomaps, notify them of their neighbour's LOD change, and to update the geometry when the LOD does change. To change the LOD it does this by changing the index buffer of the triangle strip, so the whole geometry doesn't have to be re-loaded onto the video card. If you are eager, you can read up more detail how GeoMipMapping works here:

                              Terrain Quad Tree

                              TerraMonkey is a quad tree. Each node is a TerrainQuad, and each leaf is a TerrainPatch. A TerrainQuad has either 4 child TerrainQuads, or 4 child TerrainPatches. The TerrainPatch holds the actual mesh geometry. This structure is almost exactly the same as JME2's TerrainPage system. Except now each leaf has a reference to its neighbours, so it doesn't ever have to traverse the tree to get them.

                              Texture Splatting

                              @@ -255,8 +145,7 @@ matRock.setFloat("m_Tex3Scale", 128f); We create the heightmap from the heightMapImage.

                              AbstractHeightMap heightmap = null;
                              -heightmap = new ImageBasedHeightMap(
                              -    ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 1f);
                              +heightmap = new ImageBasedHeightMap(heightMapImage.getImage(), 1f);
                               heightmap.load();

                              diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain_collision.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain_collision.html index 574510237..c7e45e5e9 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain_collision.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/terrain_collision.html @@ -1,17 +1,4 @@ - -

                              Terrain Collision

                              -
                              - -

                              - -This tutorial expands the HelloTerrain tutorial and makes the terrain solid. You combine what you learned in Hello Terrain and Hello Collision and add a CollisionShape to the terrain. The terrain'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. -

                              - -
                              - -

                              Sample Code

                              -
                              -
                              package jme3test.helloworld;
                              +

                              Terrain Collision

                              This tutorial expands the HelloTerrain tutorial and makes the terrain solid. You combine what you learned in Hello Terrain and Hello Collision and add a CollisionShape to the terrain. The terrain'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.

                              Sample Code

                              package jme3test.helloworld;
                                
                               import com.jme3.app.SimpleApplication;
                               import com.jme3.bullet.BulletAppState;
                              diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/vehicles.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/vehicles.html
                              index c70b3b078..0444f1bd1 100644
                              --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/vehicles.html
                              +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/vehicles.html
                              @@ -1,112 +1,5 @@
                              -
                              -

                              Controlling a Physical Vehicle

                              -
                              - -

                              - -For physical vehicles, jME's uses the jBullet ray-cast vehicle. In this vehicle implementation, the physical chassis 'floats' along on four non-physical vertical rays. -

                              - -

                              -Internally, each wheel casts a ray down, and using the ray'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. 1) -

                              - -

                              -This article shows how you use this vehicle implementation in a jME3 application. -

                              - -

                              - -

                              - -
                              - -

                              Sample Code

                              -
                              - -

                              - -Full code samples are here: - -

                              -
                                -
                              • -
                              • -
                              • -
                              • -
                              - -
                              - -

                              Overview of this Physics Application

                              -
                              - -

                              - -The goal is to create a physical vehicle with wheels that can be steered and that interacts (collides with) with the floor and obstacles. - -

                              -
                                -
                              1. Create a SimpleApplication with a BulletAppState
                                -
                                  -
                                • This gives us a PhysicsSpace for PhysicsNodes
                                  -
                                • -
                                -
                              2. -
                              3. Create a VehicleControl + CompoundCollisionShape for the physical vehicle behaviour
                                -
                                  -
                                1. Set physical properties of the vehicle, such as suspension.
                                  -
                                2. -
                                -
                              4. -
                              5. Create a VehicleNode for the car model
                                -
                                  -
                                1. Create a box plus 4 cylinders as wheels (using vehicle.addWheel()).
                                  -
                                2. -
                                3. Add the VehicleControl behaviour to the VehicleNode geometry.
                                  -
                                4. -
                                -
                              6. -
                              7. Create a RigidBodyControl and CollisionShape for the floor
                                -
                              8. -
                              9. Map key triggers and add input listeners
                                -
                                  -
                                • Navigational commands Left, Right, Foward, Brake.
                                  -
                                • -
                                -
                              10. -
                              11. Define the steering actions to be triggered by the key events.
                                -
                                  -
                                • vehicle.steer()
                                  -
                                • -
                                • vehicle.accelerate()
                                  -
                                • -
                                • vehicle.brake()
                                  -
                                • -
                                -
                              12. -
                              - -
                              - -

                              Creating the Vehicle Chassis

                              -
                              - -

                              - -The vehicle that we create here in the example is just a "box on wheels", a basic vehicle shape that you can replace with a fancy car model, as demonstrated in . -

                              - -

                              -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. -

                              -
                              CompoundCollisionShape compoundShape = new CompoundCollisionShape();
                              -BoxCollisionShape box = new BoxCollisionShape(new Vector3f(1.2f, 0.5f, 2.4f));
                              - -

                              -Best Practice: 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! -

                              -
                              compoundShape.addChildShape(box, new Vector3f(0, 1, 0));
                              +

                              Controlling a Physical Vehicle

                              For physical vehicles, jME's uses the jBullet ray-cast vehicle. In this vehicle implementation, the physical chassis 'floats' along on four non-physical vertical rays.

                              Internally, each wheel casts a ray down, and using the ray'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. 1)

                              This article shows how you use this vehicle implementation in a jME3 application.

                              Sample Code

                              Full code samples are here:

                              Overview of this Physics Application

                              The goal is to create a physical vehicle with wheels that can be steered and that interacts (collides with) with the floor and obstacles.

                              1. Create a SimpleApplication with a BulletAppState
                                • This gives us a PhysicsSpace for PhysicsNodes
                              2. Create a VehicleControl + CompoundCollisionShape for the physical vehicle behaviour
                                1. Set physical properties of the vehicle, such as suspension.
                              3. Create a VehicleNode for the car model
                                1. Create a box plus 4 cylinders as wheels (using vehicle.addWheel()).
                                2. Add the VehicleControl behaviour to the VehicleNode geometry.
                              4. Create a RigidBodyControl and CollisionShape for the floor
                              5. Map key triggers and add input listeners
                                • Navigational commands Left, Right, Foward, Brake.
                              6. Define the steering actions to be triggered by the key events.
                                • vehicle.steer()
                                • vehicle.accelerate()
                                • vehicle.brake()

                              Creating the Vehicle Chassis

                              The vehicle that we create here in the example is just a "box on wheels", a basic vehicle shape that you can replace with a fancy car model, as demonstrated in .

                              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.

                              CompoundCollisionShape compoundShape = new CompoundCollisionShape();
                              +BoxCollisionShape box = new BoxCollisionShape(new Vector3f(1.2f, 0.5f, 2.4f));

                              Best Practice: 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!

                              compoundShape.addChildShape(box, new Vector3f(0, 1, 0));

                              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. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/walking_character.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/walking_character.html index d3aa4b54b..b581d59aa 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/walking_character.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/walking_character.html @@ -1,56 +1,4 @@ - -

                              Walking Character

                              -
                              - -

                              -In the Hello Collision tutorial and the 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. -

                              - -

                              -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. - -

                              - -
                              - -

                              Why use CharacterControl instead of RigidBodyControl?

                              -
                              - -

                              -When you load a character model with a RigidBodyControl, and use forces to push it around, you do not get the desired effect: RigidBodyControl'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. - -

                              - -
                              - -

                              Sample Code

                              -
                              - -

                              -The several related code samples can be found here: -

                              -
                                -
                              • (third-person view)
                                -
                              • -
                              • (third-person view)
                                -
                              • -
                              • (first-person view)
                                -
                              • -
                              • (first-person view)
                                -
                              • -
                              - -

                              - -The code in this tutorial is a combination of these samples. - -

                              - -
                              - -

                              Code Skeleton

                              -
                              -
                              public class WalkingCharacterDemo extends SimpleApplication
                              +

                              Walking Character

                              In the Hello Collision tutorial and the 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.

                              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.

                              Why use CharacterControl instead of RigidBodyControl?

                              When you load a character model with a RigidBodyControl, and use forces to push it around, you do not get the desired effect: RigidBodyControl'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.

                              Sample Code

                              The several related code samples can be found here:

                              • (third-person view)
                              • (third-person view)
                              • (first-person view)
                              • (first-person view)

                              The code in this tutorial is a combination of these samples.

                              Code Skeleton

                              public class WalkingCharacterDemo extends SimpleApplication
                                       implements ActionListener, AnimEventListener {
                                 public static void main(String[] args) {
                                   WalkingCharacterDemo app = new WalkingCharacterDemo();
                              @@ -60,67 +8,18 @@ The code in this tutorial is a combination of these samples.
                                 public void simpleUpdate(float tpf) { }
                                 public void onAction(String name, boolean isPressed, float tpf) { }
                                 public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) { }
                              -  public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { }
                              - -
                              - -

                              Overview

                              -
                              -
                                -
                              1. Activate physics by adding a BulletAppState.
                                -
                              2. -
                              3. Init the scene by loading a game level model (terrain or floor/buildings) and giving it a MeshCollisionShape.
                                -
                              4. -
                              5. Create the animated character
                                -
                                  -
                                1. Load an animated character model.
                                  -
                                2. -
                                3. Add a CharacterControl to the model.
                                  -
                                4. -
                                -
                              6. -
                              7. Set up animation channel and controllers.
                                -
                              8. -
                              9. Add a ChaseCam or CameraNode.
                                -
                              10. -
                              11. Handle navigational inputs
                                -
                              12. -
                              - -
                              - -

                              Activate Physics

                              -
                              -
                              private BulletAppState bulletAppState;
                              +  public void onAnimChange(AnimControl control, AnimChannel channel, Activate Physics
                              private BulletAppState bulletAppState;
                               ...
                               public void simpleInitApp() {
                                   bulletAppState = new BulletAppState();
                                   //bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
                                   stateManager.attach(bulletAppState);
                                   ...
                              -}
                              - -
                              - -

                              Initialize the Scene

                              -
                              - -

                              -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: - -

                              -
                              public void simpleInitApp() {
                              +}

                              Initialize the Scene

                              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:

                              public void simpleInitApp() {
                                 ...
                                 PhysicsTestHelper.createPhysicsTestWorld(rootNode,
                                     assetManager, bulletAppState.getPhysicsSpace());
                              -  ...
                              - -

                              - -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: - -

                              -
                              private Node gameLevel;
                              +  ...

                              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:

                              private Node gameLevel;
                               ..
                               public void simpleInitApp() {
                                 ...
                              @@ -136,40 +35,9 @@ public void simpleInitApp() {
                                 gameLevel.addControl(new RigidBodyControl(0));
                                 rootNode.attachChild(gameLevel);
                                 bulletAppState.getPhysicsSpace().addAll(gameLevel);
                              -  ...
                              - -

                              - -Also, add a light source to be able to see the scene. - -

                              -
                                AmbientLight light = new AmbientLight();
                              +  ...

                              Also, add a light source to be able to see the scene.

                                AmbientLight light = new AmbientLight();
                                 light.setColor(ColorRGBA.White.mult(2));
                              -  rootNode.addLight(light);
                              - -
                              - -

                              Create the Animated Character

                              -
                              - -

                              -You create an animated model, such as Oto.mesh.xml. -

                              -
                                -
                              1. Place the "Oto" model into the assets/Models/Oto/ directory of your project.
                                -
                              2. -
                              3. Create the CollisionShape and adjust the capsule radius and height to fit your character model.
                                -
                              4. -
                              5. Create the CharacterControl and adjust the stepheight (here 0.05f) to the height that the character can climb up without jumping.
                                -
                              6. -
                              7. Load the visible model. Make sure its start position does not overlap with scene objects.
                                -
                              8. -
                              9. Add the CharacterControl to the model and register it to the physicsSpace.
                                -
                              10. -
                              11. Attach the visible model to the rootNode.
                                -
                              12. -
                              -
                              private CharacterControl character;
                              +  rootNode.addLight(light);

                              Create the Animated Character

                              You create an animated model, such as Oto.mesh.xml.

                              1. Place the "Oto" model into the assets/Models/Oto/ directory of your project.
                              2. Create the CollisionShape and adjust the capsule radius and height to fit your character model.
                              3. Create the CharacterControl and adjust the stepheight (here 0.05f) to the height that the character can climb up without jumping.
                              4. Load the visible model. Make sure its start position does not overlap with scene objects.
                              5. Add the CharacterControl to the model and register it to the physicsSpace.
                              6. Attach the visible model to the rootNode.
                              private CharacterControl character;
                               private Node model;
                               ...
                               public void simpleInitApp() {
                              @@ -181,26 +49,7 @@ public void simpleInitApp() {
                                 model.addControl(character);
                                 bulletAppState.getPhysicsSpace().add(character);
                                 rootNode.attachChild(model);
                              -  ...
                              - -

                              - -
                              - -Did you know? 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. - -

                              - -
                              - -

                              Set Up AnimControl and AnimChannels

                              -
                              - -

                              -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.) - -

                              -
                              private AnimChannel animationChannel;
                              +  ...


                              Did you know? 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.

                              Set Up AnimControl and AnimChannels

                              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.)

                              private AnimChannel animationChannel;
                               private AnimChannel attackChannel;
                               private AnimControl animationControl;
                               ...
                              @@ -213,36 +62,13 @@ public void simpleInitApp() {
                                 attackChannel.addBone(animationControl.getSkeleton().getBone("uparm.right"));
                                 attackChannel.addBone(animationControl.getSkeleton().getBone("arm.right"));
                                 attackChannel.addBone(animationControl.getSkeleton().getBone("hand.right"));
                              -  ...
                              - -

                              - -The attackChannel only controls one arm, while the walking channels controls the whole character. - -

                              - -
                              - -

                              Add ChaseCam / CameraNode

                              -
                              -
                              private ChaseCamera chaseCam;
                              +  ...

                              The attackChannel only controls one arm, while the walking channels controls the whole character.

                              Add ChaseCam / CameraNode

                              private ChaseCamera chaseCam;
                               ...
                               public void simpleInitApp() {
                                 ...
                                 flyCam.setEnabled(false);
                                 chaseCam = new ChaseCamera(cam, model, inputManager);
                              -  ...
                              - -
                              - -

                              Handle navigational inputs

                              -
                              - -

                              -Configure custom key bindings for WASD keys that you will use to make the character walk. - -

                              -
                              private boolean left = false, right = false, up = false, down = false;
                              +  ...

                              Handle navigational inputs

                              Configure custom key bindings for WASD keys that you will use to make the character walk.

                              private boolean left = false, right = false, up = false, down = false;
                               ...
                               public void simpleInitApp() {
                                 ...
                              @@ -256,14 +82,7 @@ public void simpleInitApp() {
                                 inputManager.addListener(this, "CharForward", "CharBackward");
                                 inputManager.addListener(this, "CharJump", "CharAttack");
                                 ...
                              -}
                              - -

                              - -Respond to the key bindings by setting variables that track in which direction you will go. (No actual walking happens here yet) - -

                              -
                              @Override
                              +}

                              Respond to the key bindings by setting variables that track in which direction you will go. (No actual walking happens here yet)

                              @Override
                               public void onAction(String binding, boolean value, float tpf) {
                                 if (binding.equals("CharLeft")) {
                                     if (value) left = true;
                              @@ -281,24 +100,10 @@ public void onAction(String binding, boolean value, float tpf) {
                                     character.jump();
                                 if (binding.equals("CharAttack"))
                                   attack();
                              -}
                              - -

                              - -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. - -

                              -
                              private void attack() {
                              +}

                              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.

                              private void attack() {
                                   attackChannel.setAnim("Dodge", 0.1f);
                                   attackChannel.setLoopMode(LoopMode.DontLoop);
                              -}
                              - -

                              - -The update loop looks at the directional variables and moves the character accordingly. Since it'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. - -

                              -
                              private Vector3f walkDirection = new Vector3f(0,0,0);
                              +}

                              The update loop looks at the directional variables and moves the character accordingly. Since it'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.

                              private Vector3f walkDirection = new Vector3f(0,0,0);
                               private float airTime = 0;
                               public void simpleUpdate(float tpf) {
                                 Vector3f camDir = cam.getDirection().clone().multLocal(0.25f);
                              @@ -330,26 +135,8 @@ public void simpleUpdate(float tpf) {
                                     }
                                   }
                                 character.setWalkDirection(walkDirection);
                              -}
                              - -

                              - -This method resets the walk animation. - -

                              -
                              public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
                              +}

                              This method resets the walk animation.

                              public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
                                       if (channel == attackChannel) channel.setAnim("stand");
                               }
                              -public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { }
                              - - -
                              +public void onAnimChange(AnimControl control, AnimChannel channel, collision

                              view online version

                              \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/water.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/water.html index 884076eda..dd2891973 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/water.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/water.html @@ -1,37 +1,4 @@ - -

                              Simple Water

                              -
                              - -

                              - -Here is some background info for JME3's basic water implementation: -

                              -
                                -
                              • -
                              • -
                              • -
                              • -
                              • -
                              • -
                              - -

                              - - -

                              - -
                              - -

                              SimpleWaterProcessor

                              -
                              - -

                              - -A JME3 scene with water can use a com.jme3.water.SimpleWaterProcessor (which implements the SceneProcessor interface). -

                              - -

                              -To achieve a water effect, JME3 uses shaders and a special material, Common/MatDefs/Water/SimpleWater.j3md. The water surface is a quad, and we use normal map and dU/dV map texturing to simulate the waves. +

                              Simple Water

                              Here is some background info for JME3's basic water implementation:

                              SimpleWaterProcessor

                              A JME3 scene with water can use a com.jme3.water.SimpleWaterProcessor (which implements the SceneProcessor interface).

                              To achieve a water effect, JME3 uses shaders and a special material, Common/MatDefs/Water/SimpleWater.j3md. The water surface is a quad, and we use normal map and dU/dV map texturing to simulate the waves.

                                diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_animation.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_animation.html index 14e9d9c3a..af6c2c205 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_animation.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_animation.html @@ -1,25 +1,4 @@ - -

                                JME 3 Tutorial (7) - Hello Animation

                                -
                                - -

                                -Previous: Hello Material, -Next: Hello Picking -

                                - -

                                -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. -

                                - -

                                - -

                                - -
                                - -

                                Sample Code

                                -
                                -
                                package jme3test.helloworld;
                                +

                                JME 3 Tutorial (7) - Hello Animation

                                Previous: Hello Material, Next: Hello Picking

                                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.

                                Sample Code

                                package jme3test.helloworld;
                                  
                                 import com.jme3.animation.AnimChannel;
                                 import com.jme3.animation.AnimControl;
                                @@ -89,22 +68,7 @@ public class HelloAnimation extends SimpleApplication
                                       }
                                     }
                                   };
                                -}
                                - -
                                - -

                                Creating and Loading Animated Models

                                -
                                - -

                                - -You create animated models with a tool such as Blender. Take some time and learn how to create your own models in these . For now, download and use a free model, such as the one included here as an example (, and ). -

                                - -

                                -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 Oto.mesh.xml, and the animation details are in Oto.skeleton.xml, plus the usual files for materials and textures. Check that all files of the model are together in the same Model subdirectory. -

                                -
                                  public void simpleInitApp() {
                                +}

                                Creating and Loading Animated Models

                                You create animated models with a tool such as Blender. Take some time and learn how to create your own models in these . For now, download and use a free model, such as the one included here as an example (, and ).

                                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 Oto.mesh.xml, and the animation details are in Oto.skeleton.xml, plus the usual files for materials and textures. Check that all files of the model are together in the same Model subdirectory.

                                  public void simpleInitApp() {
                                     /* Displaying the model requires a light source */
                                     DirectionalLight dl = new DirectionalLight();
                                     dl.setDirection(new Vector3f(-0.1f, -1f, -1).normalizeLocal());
                                @@ -114,30 +78,7 @@ Loading an animated model is pretty straight-forward, just as you have learned i
                                     player.setLocalScale(0.5f); // resize
                                     rootNode.attachChild(player);
                                     ...
                                -    }
                                - -

                                -Don't forget to add a light source to make the material visible. -

                                - -
                                - -

                                Animation Controler and Channel

                                -
                                - -

                                - -After you load the animated model, you register it to the Animation Controller. -

                                -
                                  -
                                • The controller object gives you access to the available animation sequences.
                                  -
                                • -
                                • The controller can have several channels, each channel can run one animation sequence at a time.
                                  -
                                • -
                                • To run several sequences, you create several channels, and set them each to their animation.
                                  -
                                • -
                                -
                                  private AnimChannel channel;
                                +    }

                                Don't forget to add a light source to make the material visible.

                                Animation Controler and Channel

                                After you load the animated model, you register it to the Animation Controller.

                                • The controller object gives you access to the available animation sequences.
                                • The controller can have several channels, each channel can run one animation sequence at a time.
                                • To run several sequences, you create several channels, and set them each to their animation.
                                  private AnimChannel channel;
                                   private AnimControl control;
                                  
                                   public void simpleInitApp() {
                                @@ -148,18 +89,7 @@ After you load the animated model, you register it to the Animation Controller.
                                     control.addListener(this);
                                     channel = control.createChannel();
                                     channel.setAnim("stand");
                                -    ...
                                - -
                                - -

                                Responding to Animation Events

                                -
                                - -

                                - -Add implements AnimEventListener 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 Walk cycle is done. -

                                -
                                public class HelloAnimation extends SimpleApplication
                                +    ...

                                Responding to Animation Events

                                Add implements AnimEventListener 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 Walk cycle is done.

                                public class HelloAnimation extends SimpleApplication
                                                          implements AnimEventListener {
                                   ...
                                  
                                @@ -173,54 +103,10 @@ Add implements AnimEventListener to the class declaration. This int
                                   }
                                   public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
                                     // unused
                                -  }
                                - -
                                - -

                                Trigger Animations After User Input

                                -
                                - -

                                - -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. -

                                -
                                  -
                                1. Initialize a new input controller (in simpleInitApp()).
                                  -
                                    -
                                  • Write the initKey() convenience method and call it from simpleInitApp().
                                    -
                                  • -
                                  -
                                2. -
                                3. Add a key mapping with the name as the action you want to trigger.
                                  -
                                    -
                                  • Here for example, you map Walk to the Spacebar key.
                                    -
                                  • -
                                  -
                                4. -
                                5. Add an input listener for the Walk action.
                                  -
                                6. -
                                -
                                  private void initKeys() {
                                +  }

                                Trigger Animations After User Input

                                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.

                                1. Initialize a new input controller (in simpleInitApp()).
                                  • Write the initKey() convenience method and call it from simpleInitApp().
                                2. Add a key mapping with the name as the action you want to trigger.
                                  • Here for example, you map Walk to the Spacebar key.
                                3. Add an input listener for the Walk action.
                                  private void initKeys() {
                                     inputManager.addMapping("Walk", new KeyTrigger(KeyInput.KEY_SPACE));
                                     inputManager.addListener(actionListener, "Walk");
                                -  }
                                - -

                                -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. - -

                                -
                                  -
                                • The second parameter of setAnim() is the blendTime (how long the current animation should overlap with the last one).
                                  -
                                • -
                                • LoopMode can be Loop (repeat), Cycle (forward then backward), and DontLoop (only once).
                                  -
                                • -
                                • If needed, use channel.setSpeed() to set the speed of this animation.
                                  -
                                • -
                                • Optionally, use channel.setTime() to Fast-forward or rewind to a certain moment in time of this animation.
                                  -
                                • -
                                -
                                  private ActionListener() {
                                +  }

                                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.

                                • The second parameter of setAnim() is the blendTime (how long the current animation should overlap with the last one).
                                • LoopMode can be Loop (repeat), Cycle (forward then backward), and DontLoop (only once).
                                • If needed, use channel.setSpeed() to set the speed of this animation.
                                • Optionally, use channel.setTime() to Fast-forward or rewind to a certain moment in time of this animation.
                                  private ActionListener() {
                                     public void onAction(String name, boolean keyPressed, float tpf) {
                                         if (name.equals("Walk") && !keyPressed) {
                                             if (!channel.getAnimationName().equals("Walk")){
                                @@ -229,40 +115,7 @@ Test for each action by name, and set the channel to the corresponding animation
                                             }
                                         }
                                     }
                                -  };
                                - -
                                - -

                                Exercises

                                -
                                - -
                                - -

                                Exercise 1: Two Animations

                                -
                                - -

                                - -Make a mouse click trigger another animation sequence! -

                                -
                                  -
                                1. Create a second channel in the controller
                                  -
                                2. -
                                3. Create a new key trigger mapping and action (see: Hello Input)
                                  -
                                4. -
                                5. Tip: Do you want to find out what animation sequences are available in the model? Use:
                                  for (System.out.println(anim); }
                                  -
                                  -
                                6. -
                                - -
                                - -

                                Exercise 2: Revealing the Skeleton (1)

                                -
                                - -

                                - -Open the skeleton.xml file in a text editor of your choice. You don'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. "There's no magic to it!" + };

                                Exercises

                                Exercise 1: Two Animations

                                Make a mouse click trigger another animation sequence!

                                1. Create a second channel in the controller
                                2. Create a new key trigger mapping and action (see: Hello Input)
                                3. Tip: Do you want to find out what animation sequences are available in the model? Use:
                                  for (Exercise 2: Revealing the Skeleton (1)

                                  Open the skeleton.xml file in a text editor of your choice. You don'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. "There's no magic to it!"

                                  • Note how the bones are numbered and named. All names of animated models follow a naming scheme.
                                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html index 4b742a21c..5fad16013 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_asset.html @@ -1,31 +1,4 @@ - -

                                    JME 3 Tutorial (3) - Hello Assets

                                    -
                                    - -

                                    - -Previous: Hello Node, -Next: Hello Update Loop -

                                    - -

                                    -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. -

                                    - -

                                    - -

                                    - -

                                    -

                                    To use the example assets in a new jMonkeyEngine SDK project, right-click your project, select "Properties", go to "Libraries", press "Add Library" and add the "jme3-test-data" library. -

                                    -

                                    - -
                                    - -

                                    Code Sample

                                    -
                                    -
                                    package jme3test.helloworld;
                                    +

                                    JME 3 Tutorial (3) - Hello Assets

                                    Previous: Hello Node, Next: Hello Update Loop

                                    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.

                                    To use the example assets in a new jMonkeyEngine SDK project, right-click your project, select "Properties", go to "Libraries", press "Add Library" and add the "jme3-test-data" library.

                                    Code Sample

                                    package jme3test.helloworld;
                                      
                                     import com.jme3.app.SimpleApplication;
                                     import com.jme3.font.BitmapText;
                                    @@ -86,36 +59,7 @@ public class HelloAssets extends SimpleApplication {
                                             rootNode.addLight(sun);
                                      
                                         }
                                    -}
                                    - -

                                    -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 "Hello World". -

                                    - -
                                    - -

                                    The Asset Manager

                                    -
                                    - -

                                    - -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: -

                                    -
                                      -
                                    • the current classpath (the top level of your project directory),
                                      -
                                    • -
                                    • the assets directory of your project, and
                                      -
                                    • -
                                    • optionally, custom paths.
                                      -
                                    • -
                                    - -

                                    - -This is our recommended directory structure for storing assets: -

                                    -
                                    MyGame/assets/Interface/
                                    +}

                                    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 "Hello World".

                                    The Asset Manager

                                    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:

                                    • the current classpath (the top level of your project directory),
                                    • the assets directory of your project, and
                                    • optionally, custom paths.

                                    This is our recommended directory structure for storing assets:

                                    MyGame/assets/Interface/
                                     MyGame/assets/MatDefs/
                                     MyGame/assets/Materials/
                                     MyGame/assets/Models/
                                    @@ -125,22 +69,7 @@ MyGame/assets/Sounds/
                                     MyGame/assets/Textures/
                                     MyGame/build.xml
                                     MyGame/src/...
                                    -MyGame/...
                                    - -

                                    -This is just a suggested best practice, you can name the directories in the assets directory what ever you like. -

                                    - -
                                    - -

                                    Loading Textures

                                    -
                                    - -

                                    - -Place your textures in a subdirectory of assets/Textures/. Load the texture into the material before you set the Material. The following code sample is from the simpleInitApp() method and loads a simple wall model: -

                                    -
                                    // Create a wall with a simple texture from test_data
                                    +MyGame/...

                                    This is just a suggested best practice, you can name the directories in the assets directory what ever you like.

                                    Loading Textures

                                    Place your textures in a subdirectory of assets/Textures/. Load the texture into the material before you set the Material. The following code sample is from the simpleInitApp() method and loads a simple wall model:

                                    // Create a wall with a simple texture from test_data
                                     Box(Vector3f.ZERO, 2.5f,2.5f,1.0f);
                                     Spatial wall = new Geometry("Box", box );
                                     Material mat_brick = new Material( 
                                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_audio.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_audio.html
                                    index 567727aeb..4972c5a84 100644
                                    --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_audio.html
                                    +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_audio.html
                                    @@ -1,20 +1,4 @@
                                    -
                                    -

                                    JME 3 Tutorial (11) - Hello Audio

                                    -
                                    - -

                                    -Previous: Hello Terrain, Next: Hello Effects -

                                    - -

                                    -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 Hello Input tutorial to make a mouse click trigger a gun shot sound. -

                                    - -
                                    - -

                                    Sample Code

                                    -
                                    -
                                    package jme3test.helloworld;
                                    +

                                    JME 3 Tutorial (11) - Hello Audio

                                    Previous: Hello Terrain, Next: Hello Effects

                                    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 Hello Input tutorial to make a mouse click trigger a gun shot sound.

                                    Sample Code

                                    package jme3test.helloworld;
                                      
                                     import com.jme3.app.SimpleApplication;
                                     import com.jme3.audio.AudioNode;
                                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html
                                    index 6bc269592..4f316ae57 100644
                                    --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html
                                    +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_collision.html
                                    @@ -1,41 +1,8 @@
                                    -
                                    -

                                    JME 3 Tutorial (9) - Hello Collision

                                    -
                                    - -

                                    -Previous: Hello Picking, -Next: Hello Terrain -

                                    - -

                                    -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 RigidBodyControl for the static collidable scene, and a CharacterControl 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. -

                                    - -

                                    - -

                                    - -
                                    - -

                                    Sample Code

                                    -
                                    - -

                                    - -If you don't have it yet, sample scene. -

                                    -
                                    jMonkeyProjects$ ls -1 BasicGame
                                    +

                                    JME 3 Tutorial (9) - Hello Collision

                                    Previous: Hello Picking, Next: Hello Terrain

                                    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 RigidBodyControl for the static collidable scene, and a CharacterControl 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.

                                    Sample Code

                                    If you don't have it yet, sample scene.

                                    jMonkeyProjects$ ls -1 BasicGame
                                     assets/
                                     build.xml
                                     town.zip
                                    -src/
                                    - -

                                    -Place town.zip in the root directory of your JME3 project. Here is the code: -

                                    -
                                    package jme3test.helloworld;
                                    +src/

                                    Place town.zip in the root directory of your JME3 project. Here is the code:

                                    package jme3test.helloworld;
                                      
                                     import com.jme3.app.SimpleApplication;
                                     import com.jme3.asset.plugins.ZipLocator;
                                    @@ -180,70 +147,16 @@ public class HelloCollision extends SimpleApplication
                                         player.setWalkDirection(walkDirection);
                                         cam.setLocation(player.getPhysicsLocation());
                                       }
                                    -}
                                    - -

                                    -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't walk over the edge of the world! :-) -

                                    - -
                                    - -

                                    Understanding the Code

                                    -
                                    - -

                                    - -Let's start with the class declaration: -

                                    -
                                    public class HelloCollision extends SimpleApplication
                                    -        implements ActionListener { ... }
                                    - -

                                    -You already know that SimpleApplication is the base class for all jME3 games. You make this class implement the ActionListener interface because you want to customize the navigational inputs later. -

                                    -
                                      private Spatial sceneModel;
                                    +}

                                    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't walk over the edge of the world! :-)

                                    Understanding the Code

                                    Let's start with the class declaration:

                                    public class HelloCollision extends SimpleApplication
                                    +        implements ActionListener { ... }

                                    You already know that SimpleApplication is the base class for all jME3 games. You make this class implement the ActionListener interface because you want to customize the navigational inputs later.

                                      private Spatial sceneModel;
                                       private BulletAppState bulletAppState;
                                       private RigidBodyControl landscape;
                                       private CharacterControl player;
                                       private Vector3f walkDirection = new Vector3f();
                                    -  private boolean left = false, right = false, up = false, down = false;
                                    - -

                                    -You initialize a few private fields: -

                                    -
                                      -
                                    • The BulletAppState gives this SimpleApplication access to physics features (such as collision detection) supplied by jME3's jBullet integration
                                      -
                                    • -
                                    • The Spatial sceneModel is for loading an OgreXML model of a town.
                                      -
                                    • -
                                    • You need a RigidBodyControl to make the town model solid.
                                      -
                                    • -
                                    • The (invisible) first-person player is represented by a CharacterControl object.
                                      -
                                    • -
                                    • The fields walkDirection and the four Booleans are used for physics-controlled navigation.
                                      -
                                    • -
                                    - -

                                    - -Let's have a look at all the details: -

                                    - -
                                    - -

                                    Initializing the Game

                                    -
                                    - -

                                    - -As usual, you initialize the game in the simpleInitApp() method. -

                                    -
                                        viewPort.setBackgroundColor(new ColorRGBA(0.7f,0.8f,1f,1f));
                                    +  private boolean left = false, right = false, up = false, down = false;

                                    You initialize a few private fields:

                                    • The BulletAppState gives this SimpleApplication access to physics features (such as collision detection) supplied by jME3's jBullet integration
                                    • The Spatial sceneModel is for loading an OgreXML model of a town.
                                    • You need a RigidBodyControl to make the town model solid.
                                    • The (invisible) first-person player is represented by a CharacterControl object.
                                    • The fields walkDirection and the four Booleans are used for physics-controlled navigation.

                                    Let's have a look at all the details:

                                    Initializing the Game

                                    As usual, you initialize the game in the simpleInitApp() method.

                                        viewPort.setBackgroundColor(new ColorRGBA(0.7f,0.8f,1f,1f));
                                         flyCam.setMoveSpeed(100);
                                         setUpKeys();
                                    -    setUpLight();
                                    -
                                      -
                                    1. You set the background color to light blue, since this is a scene with a sky.
                                      + setUpLight();
                                    1. You set the background color to light blue, since this is a scene with a sky.
                                    2. You repurpose the default camera control "flyCam" as first-person camera and set its speed.
                                    3. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_effects.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_effects.html index 48c011fa3..5c97e4060 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_effects.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_effects.html @@ -1,56 +1,4 @@ - -

                                      JME 3 Tutorial (12) - Hello Effects

                                      -
                                      - -

                                      - -Previous: Hello Audio, -Next: Hello Physics -

                                      - -

                                      - -

                                      - -

                                      -When you see one of the following in a game, then a particle system is likely behind it: -

                                      -
                                        -
                                      • Fire, flames, sparks;
                                        -
                                      • -
                                      • Rain, snow, waterfalls, leaves;
                                        -
                                      • -
                                      • Explosions, debris, shockwaves;
                                        -
                                      • -
                                      • Dust, fog, clouds, smoke;
                                        -
                                      • -
                                      • Insects swarms, meteor showers;
                                        -
                                      • -
                                      • Magic spells.
                                        -
                                      • -
                                      - -

                                      - -These scene elements cannot be modeled by meshes. In very simple terms: -

                                      -
                                        -
                                      • The difference between an explosion and a dust cloud is the speed of the particle effect.
                                        -
                                      • -
                                      • The difference between flames and a waterfall is the direction and the color of the particle effect.
                                        -
                                      • -
                                      - -

                                      - -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). -

                                      - -
                                      - -

                                      Sample Code

                                      -
                                      -
                                      package jme3test.helloworld;
                                      +

                                      JME 3 Tutorial (12) - Hello Effects

                                      Previous: Hello Audio, Next: Hello Physics

                                      When you see one of the following in a game, then a particle system is likely behind it:

                                      • Fire, flames, sparks;
                                      • Rain, snow, waterfalls, leaves;
                                      • Explosions, debris, shockwaves;
                                      • Dust, fog, clouds, smoke;
                                      • Insects swarms, meteor showers;
                                      • Magic spells.

                                      These scene elements cannot be modeled by meshes. In very simple terms:

                                      • The difference between an explosion and a dust cloud is the speed of the particle effect.
                                      • The difference between flames and a waterfall is the direction and the color of the particle effect.

                                      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).

                                      Sample Code

                                      package jme3test.helloworld;
                                        
                                       import com.jme3.app.SimpleApplication;
                                       import com.jme3.effect.ParticleEmitter;
                                      @@ -108,31 +56,7 @@ public class HelloEffects extends SimpleApplication {
                                           rootNode.attachChild(debris);
                                           debris.emitAllParticles();
                                         }
                                      -}
                                      - -

                                      -You should see an explosion that sends debris flying, and a fire. - -

                                      - -
                                      - -

                                      Texture Animation and Variation

                                      -
                                      - -

                                      - - -

                                      - -

                                      -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). -

                                      - -

                                      -Setting emitter textures works just as you have already learned in previous chapters. This time you base the material on the Particle.j3md material definition. Let's have a closer look at the material for the Debris effect. -

                                      -
                                          ParticleEmitter debris = 
                                      +}

                                      You should see an explosion that sends debris flying, and a fire.

                                      Texture Animation and Variation

                                      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).

                                      Setting emitter textures works just as you have already learned in previous chapters. This time you base the material on the Particle.j3md material definition. Let's have a closer look at the material for the Debris effect.

                                          ParticleEmitter debris = 
                                                   new ParticleEmitter("Debris", ParticleMesh.Type.Triangle, 10);
                                           Material debris_mat = new Material(assetManager, 
                                                   "Common/MatDefs/Misc/Particle.j3md");
                                      @@ -142,73 +66,7 @@ Setting emitter textures works just as you have already learned in previous chap
                                           debris.setImagesX(3); 
                                           debris.setImagesY(3); // 3x3 texture animation
                                           debris.setSelectRandomImage(true);
                                      -        ...
                                      -
                                        -
                                      1. Create a material and load the texture.
                                        -
                                      2. -
                                      3. Tell the Emitter into how many animation steps (x*y) the texture is divided.
                                        -The debris texture has 3x3 frames.
                                        -
                                      4. -
                                      5. Optionally, tell the Emitter whether the animation steps are to be at random, or in order.
                                        -For the debris, the frames play at random.
                                        -
                                      6. -
                                      - -

                                      - -As you see in the debris example, texture animations improve effects because each "flame" or "piece of debris" 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. -

                                      - -

                                      -The fire material is created the same way, just using "Effects/Explosion/flame.png" texture, which has with 2x2 ordered animation steps. -

                                      - -
                                      - -

                                      Default Particle Textures

                                      -
                                      - -

                                      - -The following particle textures included in test-data.jar. You can copy and use them in your own effects. - -

                                      -
                              com.jme3.scene.Spatial
                              Purpose: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.
                              com.jme3.scene.Geometrycom.jme3.scene.Node
                              Visibility: A Geometry represents a visible 3-D object in the scene graph. A Node is an invisible "handle" for a group of objects in the scene graph.
                              - - - - - - - - - - - - - - - - - - -
                              Texture Path Dimension Preview
                              Effects/Explosion/Debris.png 3*3
                              Effects/Explosion/flame.png 2*2
                              Effects/Explosion/shockwave.png 1*1
                              Effects/Explosion/smoketrail.png 1*3
                              Effects/Smoke/Smoke.png 1*15
                              - -

                              - -Copy them into you assets/Effects directory to use them. -

                              - -
                              - -

                              Creating Custom Textures

                              -
                              - -

                              - -For your game, you will likely create custom particle textures. Look at the fire example again. -

                              -
                                  ParticleEmitter fire = 
                              +        ...
                              1. Create a material and load the texture.
                              2. Tell the Emitter into how many animation steps (x*y) the texture is divided.
                                The debris texture has 3x3 frames.
                              3. Optionally, tell the Emitter whether the animation steps are to be at random, or in order.
                                For the debris, the frames play at random.

                              As you see in the debris example, texture animations improve effects because each "flame" or "piece of debris" 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.

                              The fire material is created the same way, just using "Effects/Explosion/flame.png" texture, which has with 2x2 ordered animation steps.

                              Default Particle Textures

                              The following particle textures included in test-data.jar. You can copy and use them in your own effects.

                              Texture PathDimensionPreview
                              Effects/Explosion/Debris.png3*3
                              Effects/Explosion/flame.png2*2
                              Effects/Explosion/shockwave.png1*1
                              Effects/Explosion/smoketrail.png1*3
                              Effects/Smoke/Smoke.png1*15

                              Copy them into you assets/Effects directory to use them.

                              Creating Custom Textures

                              For your game, you will likely create custom particle textures. Look at the fire example again.

                                  ParticleEmitter fire = 
                                           new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30);
                                   Material mat_red = new Material(assetManager, 
                                           "Common/MatDefs/Misc/Particle.j3md");
                              @@ -219,10 +77,7 @@ For your game, you will likely create custom particle textures. Look at the fire
                                   fire.setImagesY(2); // 2x2 texture animation
                                   fire.setEndColor(  new ColorRGBA(1f, 0f, 0f, 1f));   // red
                                   fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
                              - 
                              - -

                              -

                        @@ -318,7 +173,7 @@ Vector3f.NAN

                      gravity setGravity() 0,1,0 Whether particles fall down (positive) or fly up (negative). Set to 0f for a zero-g effect where particles keep flying.
                      - +

                      You can find details about effect parameters here. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html index 94e30e87c..a423b18ff 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_input_system.html @@ -1,26 +1,4 @@ - -

                      JME 3 Tutorial (5) - Hello Input System

                      -
                      - -

                      - -Previous: Hello Update Loop, -Next: Hello Material -

                      - -

                      -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? -

                      - -

                      -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. -

                      - -
                      - -

                      Sample Code

                      -
                      -
                      package jme3test.helloworld;
                      +

                      JME 3 Tutorial (5) - Hello Input System

                      Previous: Hello Update Loop, Next: Hello Material

                      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?

                      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.

                      Sample Code

                      package jme3test.helloworld;
                        
                       import com.jme3.app.SimpleApplication;
                       import com.jme3.material.Material;
                      @@ -97,73 +75,12 @@ public class HelloInput extends SimpleApplication {
                             }
                           }
                         };
                      -}
                      - -

                      -Build and run the example. -

                      -
                        -
                      • Press the Spacebar or click to rotate the cube.
                        -
                      • -
                      • Press the J and K keys to move the cube.
                        -
                      • -
                      • Press P to pause and unpause the game. While paused, the game should not respond to any input, other than P.
                        -
                      • -
                      - -
                      - -

                      Defining Mappings and Triggers

                      -
                      - -

                      - -First you register each mapping name with its trigger(s). Remember the following: -

                      -
                        -
                      • An input trigger can be a key press or mouse action.
                        -For example a mouse movement, a mouse click, or pressing the letter "P".
                        -
                      • -
                      • The mapping name is a string that you can choose.
                        -The name should describe the action (e.g. "Rotate"), and not the trigger. Because the trigger can change.
                        -
                      • -
                      • One named mapping can have several triggers.
                        -For example, the "Rotate" action can be triggered by a click and by pressing the spacebar.
                        -
                      • -
                      - -

                      - -Have a look at the code: -

                      -
                        -
                      1. You register the mapping named "Rotate" to the Spacebar key trigger.
                        -new KeyTrigger(KeyInput.KEY_SPACE)).
                        -
                      2. -
                      3. In the same line, you also register "Rotate" to an alternative mouse click trigger.
                        -new MouseButtonTrigger(MouseInput.BUTTON_LEFT)
                        -
                      4. -
                      5. You map the Pause, Left, Right mappings to the P, J, K keys, respectively.
                        -
                      6. -
                      -
                          // You can map one or several inputs to one named action
                      +}

                      Build and run the example.

                      • Press the Spacebar or click to rotate the cube.
                      • Press the J and K keys to move the cube.
                      • Press P to pause and unpause the game. While paused, the game should not respond to any input, other than P.

                      Defining Mappings and Triggers

                      First you register each mapping name with its trigger(s). Remember the following:

                      • An input trigger can be a key press or mouse action.
                        For example a mouse movement, a mouse click, or pressing the letter "P".
                      • The mapping name is a string that you can choose.
                        The name should describe the action (e.g. "Rotate"), and not the trigger. Because the trigger can change.
                      • One named mapping can have several triggers.
                        For example, the "Rotate" action can be triggered by a click and by pressing the spacebar.

                      Have a look at the code:

                      1. You register the mapping named "Rotate" to the Spacebar key trigger.
                        new KeyTrigger(KeyInput.KEY_SPACE)).
                      2. In the same line, you also register "Rotate" to an alternative mouse click trigger.
                        new MouseButtonTrigger(MouseInput.BUTTON_LEFT)
                      3. You map the Pause, Left, Right mappings to the P, J, K keys, respectively.
                          // You can map one or several inputs to one named action
                           inputManager.addMapping("Pause",  new KeyTrigger(KeyInput.KEY_P));
                           inputManager.addMapping("Left",   new KeyTrigger(KeyInput.KEY_J));
                           inputManager.addMapping("Right",  new KeyTrigger(KeyInput.KEY_K));
                           inputManager.addMapping("Rotate", new KeyTrigger(KeyInput.KEY_SPACE),
                      -                                      new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
                      - -

                      - -Now you need to register your trigger mappings. -

                      -
                        -
                      1. You register the pause action to the ActionListener, because it is an "on/off" action.
                        -
                      2. -
                      3. You register the movement actions to the AnalogListener, because they are gradual actions.
                        -
                      4. -
                      -
                          // Add the names to the action listener.
                      +                                      new MouseButtonTrigger(MouseInput.BUTTON_LEFT));

                      Now you need to register your trigger mappings.

                      1. You register the pause action to the ActionListener, because it is an "on/off" action.
                      2. You register the movement actions to the AnalogListener, because they are gradual actions.
                          // Add the names to the action listener.
                           inputManager.addListener(actionListener, new String[]{"Pause"});
                           inputManager.addListener(analogListener, new String[]{"Left", "Right", "Rotate"});
                      diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html index 13cf92c6f..f7c5df4b1 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_main_event_loop.html @@ -1,22 +1,4 @@ - -

                      JME 3 Tutorial (4) - Hello Update Loop

                      -
                      - -

                      - -Previous: Hello Assets, -Next: Hello Input System -

                      - -

                      -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. -

                      - -
                      - -

                      Code Sample

                      -
                      -
                      package jme3test.helloworld;
                      +

                      JME 3 Tutorial (4) - Hello Update Loop

                      Previous: Hello Assets, Next: Hello Input System

                      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.

                      Code Sample

                      package jme3test.helloworld;
                        
                       import com.jme3.app.SimpleApplication;
                       import com.jme3.material.Material;
                      diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_material.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_material.html
                      index 2d992c8e7..dc8a35c85 100644
                      --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_material.html
                      +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_material.html
                      @@ -1,22 +1,4 @@
                      -
                      -

                      JME 3 Tutorial (6) - Hello Materials

                      -
                      - -

                      -Previous: Hello Input System, -Next: Hello Animation -

                      - -

                      -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 Hello Node. Loading models that come with materials is covered in Hello Asset. In this tutorial you learn to create and use custom JME3 Material Definitions. - -

                      - -
                      - -

                      Sample Code

                      -
                      -
                      package jme3test.helloworld;
                      +

                      JME 3 Tutorial (6) - Hello Materials

                      Previous: Hello Input System, Next: Hello Animation

                      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 Hello Node. Loading models that come with materials is covered in Hello Asset. In this tutorial you learn to create and use custom JME3 Material Definitions.

                      Sample Code

                      package jme3test.helloworld;
                        
                       import com.jme3.app.SimpleApplication;
                       import com.jme3.light.DirectionalLight;
                      @@ -295,7 +277,7 @@ DiffuseMap, NormalMap, SpecularMap : Texture2D 
                      Shininess : Float
                      - +

                      For a game, you create custom Materials based on these existing MaterialDefintions – as you have just seen in the example with the shiny rock's material. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_node.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_node.html index 25c2abb49..76b59675f 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_node.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_node.html @@ -1,46 +1,4 @@ - -

                      JME 3 Tutorial (2) - Hello Node

                      -
                      - -

                      - -Previous: Hello SimpleApplication, -Next: Hello Assets. -

                      - -

                      -In this tutorial we will have a look at the creation of a 3D scene. -

                      - - -

                      - -When creating a 3D game -

                      -
                        -
                      1. You create some scene objects like players, buildings, etc.
                        -
                      2. -
                      3. You add the objects to the scene.
                        -
                      4. -
                      5. You move, resize, rotate, color, and animate them.
                        -
                      6. -
                      - -

                      - -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 "transform" them by moving, scaling, and rotating. You will understand the difference between the two types of "Spatials" in the scene graph: Nodes and Geometries. -

                      - -
                      - -

                      Code Sample

                      -
                      -
                      package jme3test.helloworld;
                      +

                      JME 3 Tutorial (2) - Hello Node

                      Previous: Hello SimpleApplication, Next: Hello Assets.

                      In this tutorial we will have a look at the creation of a 3D scene.

                      When creating a 3D game

                      1. You create some scene objects like players, buildings, etc.
                      2. You add the objects to the scene.
                      3. You move, resize, rotate, color, and animate them.

                      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 "transform" them by moving, scaling, and rotating. You will understand the difference between the two types of "Spatials" in the scene graph: Nodes and Geometries.

                      Code Sample

                      package jme3test.helloworld;
                        
                       import com.jme3.app.SimpleApplication;
                       import com.jme3.material.Material;
                      @@ -89,51 +47,7 @@ public class HelloNode extends SimpleApplication {
                               /** Rotate the pivot node: Note that both boxes have rotated! */
                               pivot.rotate(.4f,.4f,0f);
                           }
                      -}
                      - -

                      -Build and run the code sample. You should see two colored boxes tilted at the same angle. -

                      - -
                      - -

                      Understanding the Terminology

                      -
                      - -

                      - -In this tutorial, you learn some new terms: - -

                      -
                      - - - - - - - - - - - - - - - - - - -
                      What you want to doHow you say it in JME3 terminology
                      Lay out the 3D scenePopulate the scene graph
                      Create scene objectsCreate Spatials (e.g. create Geometries)
                      Make an object appear in the sceneAttach a Spatial to the rootNode
                      Make an object disappear from the sceneDetach the Spatial from the rootNode
                      Position/move, turn, or resize an objectTranslate, rotate, scale an object. Transform an object.
                      - -

                      - -Every JME3 application has a rootNode: Your game automatically inherits the rootNode object from SimpleApplication. Everything attached to the rootNode is part of the scene graph. The elements of the scene graph are Spatials. -

                      -
                        -
                      • A Spatial contains the location, rotation, and scale of an object.
                        -
                      • -
                      • A Spatial can be loaded, transformed, and saved.
                        +}

                      Build and run the code sample. You should see two colored boxes tilted at the same angle.

                      Understanding the Terminology

                      In this tutorial, you learn some new terms:

                      What you want to doHow you say it in JME3 terminology
                      Lay out the 3D scenePopulate the scene graph
                      Create scene objectsCreate Spatials (e.g. create Geometries)
                      Make an object appear in the sceneAttach a Spatial to the rootNode
                      Make an object disappear from the sceneDetach the Spatial from the rootNode
                      Position/move, turn, or resize an objectTranslate, rotate, scale an object. Transform an object.

                      Every JME3 application has a rootNode: Your game automatically inherits the rootNode object from SimpleApplication. Everything attached to the rootNode is part of the scene graph. The elements of the scene graph are Spatials.

                      • A Spatial contains the location, rotation, and scale of an object.
                      • A Spatial can be loaded, transformed, and saved.
                      • There are two types of Spatials: Nodes and Geometries.
                      • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html index e153f41de..825eade41 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_terrain.html @@ -83,8 +83,7 @@ public class HelloTerrain extends SimpleApplication { AbstractHeightMap heightmap = null; Texture heightMapImage = assetManager.loadTexture( "Textures/Terrain/splat/mountains512.png"); - heightmap = new ImageBasedHeightMap( - ImageToAwt.convert(heightMapImage.getImage(), false, true, 0)); + heightmap = new ImageBasedHeightMap(heightMapImage.getImage()); heightmap.load();   /** 3. We have prepared material and heightmap. @@ -105,9 +104,7 @@ public class HelloTerrain extends SimpleApplication { rootNode.attachChild(terrain);   /** 5. The LOD (level of detail) depends on were the camera is: */ - List<Camera> cameras = new ArrayList<Camera>(); - cameras.add(getCamera()); - TerrainLodControl control = new TerrainLodControl(terrain, cameras); + TerrainLodControl control = new TerrainLodControl(terrain, getCamera()); terrain.addControl(control); } }
                      @@ -214,15 +211,7 @@ Here is how you create the heightmap object in your jME code:
                    6. Load your prepared heightmap image into the texture object.
                    7. Create an AbstractHeightmap object from an ImageBasedHeightMap.
                      -ImageBasedHeightMap expects the following parameters:
                      -
                        -
                      1. An ImageToAwt.convert()ed image file.
                        -
                      2. -
                      3. A boolean whether you are using 16-bit – here: false, this image is 8-bit.
                        -
                      4. -
                      5. A boolean whether you are using an alphamap – here: true, you will use one.
                        -
                      6. -
                      +It requires an image from a JME Texture.
                    8. Load the heightmap.
                    9. @@ -230,8 +219,7 @@ ImageBasedHeightMap expects the following parameters:
                    AbstractHeightMap heightmap = null;
                         Texture heightMapImage = assetManager.loadTexture(
                                 "Textures/Terrain/splat/mountains512.png");
                    -    heightmap = new ImageBasedHeightMap(
                    -      ImageToAwt.convert(heightMapImage.getImage(), false, true, 0));
                    +    heightmap = new ImageBasedHeightMap(heightMapImage.getImage());
                         heightmap.load();
                    @@ -440,9 +428,7 @@ You have created the terrain object. JME3 includes an optimization that adjusts the level of detail (LOD) of the rendered terrain depending on how close or far the camera is.

                    -
                        List<Camera> cameras = new ArrayList<Camera>();
                    -    cameras.add(getCamera());
                    -    TerrainLodControl control = new TerrainLodControl(terrain, cameras);
                    +
                        TerrainLodControl control = new TerrainLodControl(terrain, getCamera());
                         terrain.addControl(control);

                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_from_sources.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_from_sources.html index 4eed5239b..b834158a0 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_from_sources.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_from_sources.html @@ -1,56 +1,2 @@ - -

                    Building jMonkeyEngine 3 from the Sources

                    -
                    - -

                    - -We recommend downloading the - but of course you can also build the jMonkeyEngine yourself from the sources. In this case, you need the file version system installed (svn). - -

                    -
                      -
                    1. Checkout: Checkout the Subversion repository.
                      svn checkout http://jmonkeyengine.googlecode.com/svn/trunk/engine jme3
                      -
                      -
                        -
                      • You can leave login and password empty
                        -
                      • -
                      -
                    2. -
                    3. Build: Execute ant jar
                      -
                        -
                      • This compiles the JAR files in dist/libs/*
                        -
                      • -
                      -
                    4. -
                    5. Javadoc: Execute ant javadoc
                      -
                        -
                      • This generates javadocs in the dist/javadoc directory.
                        -
                      • -
                      -
                    6. -
                    7. Run: Execute ant run
                      -
                        -
                      • This runs the TestChooser where you can browse examples.
                        -
                      • -
                      -
                    8. -
                    9. Use: Create a Java SE project and place all JARs from the dist/lib directory on the classpath.
                      -
                        -
                      • You can now extend your first game from com.jme3.app.SimpleApplication.
                        -
                      • -
                      -
                    10. -
                    -
                    - -

                    -Learn more about: -

                    - - -
                    +

                    Building jMonkeyEngine 3 from the Sources

                    We recommend downloading the - but of course you can also build the jMonkeyEngine yourself from the sources. In this case, you need the file version system installed (svn).

                    1. Checkout: Checkout the Subversion repository.
                      svn checkout http://jmonkeyengine.googlecode.com/svn/trunk/engine jme3
                      • You can leave login and password empty
                    2. Build: Execute ant jar
                      • This compiles the JAR files in dist/libs/*
                    3. Javadoc: Execute ant javadoc
                      • This generates javadocs in the dist/javadoc directory.
                    4. Run: Execute ant run
                      • This runs the TestChooser where you can browse examples.
                    5. Use: Create a Java SE project and place all JARs from the dist/lib directory on the classpath.
                      • You can now extend your first game from com.jme3.app.SimpleApplication.

                    Learn more about:

                    view online version

                    \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/faq.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/faq.html index ba440061d..95222bd42 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/faq.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/faq.html @@ -1,456 +1,9 @@ - -

                    Frequently Asked Questions

                    -
                    - -
                    - -

                    I want to create and configure a jME3 Application

                    -
                    - -
                    - -

                    How do I start with a preconfigured game?

                    -
                    - -

                    -Extend com.jme3.app.SimpleApplication. -
                    -Learn more: Hello SimpleApplication, . - -

                    - -
                    - -

                    How do I change the background color?

                    -
                    -
                    viewPort.setBackgroundColor(ColorRGBA.Blue);
                    - -
                    - -

                    Can I customize the SimpleApplication class?

                    -
                    - -

                    -Yes! For your own games, you should create a custom base class that extends class, configure application settings, and customize away. -
                    -Learn more: SimpleApplication, AppSettings. -

                    - -
                    - -

                    How do I disable logger output to the console?

                    -
                    - -

                    -During development, you can switch the severity level of the default logger to no longer print FINE warnings, but only WARNINGs. - -

                    -
                    java.util.logging.Logger.getLogger("").setLevel(Level.WARNING);
                    - -

                    - -For the release, switch the severity level of the default logger to print only SEVERE errors. - -

                    -
                    java.util.logging.Logger.getLogger("").setLevel(Level.SEVERE);
                    - -

                    - -Learn more: Logging. -

                    - -
                    - -

                    I want to load my scene

                    -
                    - -
                    - -

                    How do I make objects appear / disappear in the 3D scene?

                    -
                    - -

                    -To make a spatial appear in the scene, you attach it to the rootNode, To remove a spatial, you detach it. - -

                    -
                    rootNode.attachChild(spatial); // appear
                    -
                    rootNode.detachChild(spatial); // remove
                    - -

                    - -Optionally, you can control whether the engine culls an object always or never. - -

                    -
                    spatial.setCullHint(CullHint.Never); // always drawn
                    -
                    spatial.setCullHint(CullHint.Always); // never drawn
                    - -

                    - -Learn more: The Scene Graph, Hello Node, Hello Asset, Spatial, and . -

                    - -
                    - -

                    Why do I get AssetNotFoundException when loading X ?

                    -
                    - -

                    -First check whether the file path of the asset is correct. By default it is relative to your project's assets directory: - -

                    -
                    // To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.mesh.xml
                    -Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");
                    - -

                    - -If you are not using the default assets directory, verify that you have registered a locator to the AssetManager. are available. - -

                    -
                    this.assetManager.registerLocator("assets/", FileLocator.class); // default
                    +

                    Frequently Asked Questions

                    I want to create and configure a jME3 Application

                    How do I start with a preconfigured game?

                    Extend com.jme3.app.SimpleApplication.
                    Learn more: Hello SimpleApplication, .

                    How do I change the background color?

                    viewPort.setBackgroundColor(ColorRGBA.Blue);

                    Can I customize the SimpleApplication class?

                    Yes! For your own games, you should create a custom base class that extends class, configure application settings, and customize away.
                    Learn more: SimpleApplication, AppSettings.

                    How do I disable logger output to the console?

                    During development, you can switch the severity level of the default logger to no longer print FINE warnings, but only WARNINGs.

                    java.util.logging.Logger.getLogger("").setLevel(Level.WARNING);

                    For the release, switch the severity level of the default logger to print only SEVERE errors.

                    java.util.logging.Logger.getLogger("").setLevel(Level.SEVERE);

                    Learn more: Logging.

                    I want to load my scene

                    How do I make objects appear / disappear in the 3D scene?

                    To make a spatial appear in the scene, you attach it to the rootNode, To remove a spatial, you detach it.

                    rootNode.attachChild(spatial); // appear
                    rootNode.detachChild(spatial); // remove

                    Optionally, you can control whether the engine culls an object always or never.

                    spatial.setCullHint(CullHint.Never); // always drawn
                    spatial.setCullHint(CullHint.Always); // never drawn

                    Learn more: The Scene Graph, Hello Node, Hello Asset, Spatial, and .

                    Why do I get AssetNotFoundException when loading X ?

                    First check whether the file path of the asset is correct. By default it is relative to your project's assets directory:

                    // To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.mesh.xml
                    +Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");

                    If you are not using the default assets directory, verify that you have registered a locator to the AssetManager. are available.

                    this.assetManager.registerLocator("assets/", FileLocator.class); // default
                     this.assetManager.registerLocator("c:/jme3User/JMEisSoCool/myAwesomeFolder", FileLocator.class);
                    -this.assetManager.registerLocator("town.zip", ZipLocator.class.getName());
                    - -

                    - -Learn more: Asset Manager -

                    - -
                    - -

                    How do I Create 3-D models?

                    -
                    - -

                    -You create 3-D models in a 3-D mesh editor, for example Blender, and export it in Ogre Mesh XML or Wavefront OBJ format. -
                    -Learn more: 3D Models, , , . -

                    - -
                    - -

                    How do I load a 3-D model into the scene?

                    -
                    - -

                    -Use the jMonkeyEngine SDK to convert models from Ogre XML or Wavefront OBJ formats to .j3o binary format. Load the .j3o file using the AssetManager. - -

                    -
                    // To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.mesh.xml
                    -Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");
                    - -

                    - -Learn more: Hello Asset, Asset Manager, , , jMonkeyEngine SDK j3o converter, -
                    -Code sample: , . - -

                    - -
                    - -

                    How do initialize the scene?

                    -
                    - -

                    -Use the simpleInitApp() method in SimpleApplication (or initApp() in Application). -
                    -Learn more: Hello SimpleApplication, . -

                    - -
                    - -

                    I want to transform objects in the scene

                    -
                    - -
                    - -

                    How do I move or turn or resize a spatial?

                    -
                    - -

                    -To move or turn or resize a spatial you use transformations. You can concatenate transformations (e.g. perform rotations around several axes in one step using a Quaternion with slerp() or a com.jme3.math.Transform with interpolateTransforms(). - -

                    -
                    spatial.setLocalTranslation(1,-3,2.5f); spatial.rotate(0,3.14f,0); spatial.scale(2,2,2);
                    - -

                    - -Learn more: Hello Node, Spatial, rotate, rotate_about_a_point, quaternion, math_for_dummies. -

                    - -
                    - -

                    How do I make a spatial move by itself?

                    -
                    - -

                    -Change the geometry's translation (position) live in the update loop using setLocalTranslation() for non-physical and setWalkDirection() for physical objects. You can also define and remote-control a spatial's motion using Cinematics, e.g. to record cut scenes. -
                    -Learn more: Hello Loop, Update Loop, Custom Controls, Cinematics -
                    -Code sample: , -

                    - -
                    - -

                    How do I access a named sub-mesh in Model?

                    -
                    -
                    Geometry result = spatial.getName().startsWith(name);
                    - -

                    - -Learn more: Spatial -

                    - -
                    - -

                    How do I make procedural or custom shapes?

                    -
                    - -

                    -You can programmatically create com.jme3.scene.Mesh'es. -
                    -Learn more: Custom Meshes -

                    - -
                    - -

                    I want to change the surface of objects in the scene

                    -
                    - -
                    - -

                    Why is my UV wrapping / texture appearance all wrong?

                    -
                    - -

                    -The most likely reason is the flipping of textures. You may be using the following default method: - -

                    -
                      material.setTexture("ColorMap", assetManager.loadTexture("myTexture.jpg"));
                    - -

                    - -You can set the boolean value in the constructor of TextureKey to flipped or not flipped. Toggle the boolean to see if it fixes your UV wrapping/texture problem: - -

                    -
                      material.setTexture("ColorMap", this.assetManager.loadTexture(new TextureKey("myTexture.jpg", false)));
                    - -
                    - -

                    How do I scale, mirror, or wrap a texture?

                    -
                    - -

                    -You cannot scale a texture, but you scale the texture coordinates of the mesh the texture is applied to: - -

                    -
                    mesh.scaleTextureCoordinates(new Vector2f(2,2));
                    - -

                    - -You can choose among various com.jme3.texture.Texture.WrapModes for individual texture maps of a material: BorderClamp, EdgeClamp, Clamp; MirrorBorderClamp, MirrorEdgeClamp, MirrorClamp; Repeat, MirroredRepeat. - -

                    -
                    material.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat);
                    - -
                    - -

                    How do I change color or shininess of an material?

                    -
                    - -

                    -Use the AssetManager to load Materials, and change material settings. -
                    -Learn more: Hello Material, Materials Overview, Asset Manager -
                    -Code sample: , . -

                    - -
                    - -

                    How do I make a surface wood, stone, metal, etc?

                    -
                    - -

                    -Create Textures as image files. Use the AssetManager to load a Material and set the material's texture maps. -
                    -Learn more: Hello Material, Materials Overview, Asset Manager, , -
                    -Code sample: -

                    - -
                    - -

                    Why are materials too bright, too dark, or flickering?

                    -
                    - -

                    -If you use a lit material (based on Lighting.j3md) then you must attach a light source to the rootNode, otherwise you see nothing. If you use lit material colors, make sure you have specified an Ambient color (can be the same as the Diffuse color) if you use an AmbientLight. If you see objects, but they are gray or too dark, set the light color to white, or make it brighter (you can multiply the color value with a scalar), or add a global light source (AmbientLight). Similarly, if everything is white, tune down the lights. If materials flicker under a directional light, change the light direction vector. Change the background color (which is independent of light sources) to get a better contrast while debugging a light problem. -

                    - -
                    - -

                    How do I make geometries cast a shadow?

                    -
                    - -

                    -Use com.jme3.shadow.BasicShadowRenderer together with com.jme3.light.DirectionalLight, and setShadowMode(). -
                    -Learn more: Light and Shadow -
                    -Code sample: , -

                    - -
                    - -

                    How do I make materials transparent?

                    -
                    - -

                    -Assign a texture with an alpha channel to a Material and set the Material's blend mode to alpha. Use this to create transparent or translucent materials such as glass, window panes, water, tree leaves, etc. - -

                    -
                    material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
                    - -

                    - -Learn more: Hello Material, Materials Overview -

                    - -
                    - -

                    How do I force or disable backface culling?

                    -
                    - -

                    -You can switch the com.jme3.material.RenderState.FaceCullMode to Back, Front, FrontAndBack, or Off. This influences whether the front or backside of an object is being drawn. By default, backsides are culled (not drawn) because they are usually not visible anyway. - -

                    -
                    material.getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack);
                    - -
                    - -

                    Can I draw only an outline of the scene?

                    -
                    - -

                    -Create a material and switch its renders state to wireframe. - -

                    -
                    material.getAdditionalRenderState().setWireframe(true);
                    - -

                    - -Learn more: Debugging. -

                    - -
                    - -

                    I want to control the camera

                    -
                    - -
                    - -

                    How do I switch between third-person and first-person view ?

                    -
                    - -

                    -The default camera is the cam object. Learn more: -

                    -
                      -
                    • You can activate the FlyBy Cam as a first-person camera.
                      -Learn more: Hello Collision.
                      -Code sample:
                      flyCam.setEnabled(true);
                      -
                      -
                    • -
                    • You can also create a third-person chase cam.
                      -Learn more:
                      -Code sample: .
                      flyCam.setEnabled(false);
                      -chaseCam = new ChaseCamera(cam, spatial, inputManager);
                      -
                      -
                    • -
                    - -
                    - -

                    How do I increase camera speed?

                    -
                    -
                    flyCam.setMoveSpeed(50f);
                    - -
                    - -

                    Actions, Interactions, Physics

                    -
                    - -
                    - -

                    How do I implement game logic / game mechanics?

                    -
                    - -

                    -Use Controls to define the behaviour of types of Spatials. Use Application States to implement global behaviour. Use the simpleUpdate() loop for the remaining tests and interactions. Use Cinematics to remote-control objects in scenes. -
                    -Learn more: Hello Loop, Update Loop, Custom Controls, Application States, Cinematics -

                    - -
                    - -

                    How do I let players interact via keyboard?

                    -
                    - -

                    -Use com.jme3.input.KeyInput and a Input Listener. -
                    -Learn more: Hello Input, Input Handling -

                    - -
                    - -

                    How do I let players interact by clicking?

                    -
                    - -

                    -Players use the mouse to pick up objects, to open doors, to shoot a weapon, etc. Use an Input Listener to respond to mouse clicks, then cast a ray from the player; if it intersect with the bounding volume of a spatial, this is the selected target. The links below contain code samples for both "fixed crosshair" picking and "free mouse pointer" picking. -
                    -Learn more: Hello Picking, Mouse Picking, Collision and Intersection, Input Handling, com.jme3.bounding.*, com.jme3.math.Ray, com.jme3.collision.CollisionResults. -
                    -Code sample: -

                    - -
                    - -

                    How do I animate characters?

                    -
                    - -

                    -Create an animated OgreMesh model with bones in a 3-D mesh editor (e.g. Blender). -
                    -Learn more: com.jme3.animation.*, Hello Animation, Animation, -
                    -Code sample: -

                    - -
                    - -

                    How do I keep players from falling through walls and floors?

                    -
                    - -

                    -Use collision detection. The most common solution is to use jme's physics integration. -
                    -Learn more: Hello Collision, Physics, com.jme3.bullet.*, CapsuleCollisionShape versus CompoundCollisionShape, CharacterControl versus RigidBodyControl. -

                    - -
                    - -

                    How do I make balls/wheels/etc bounce and roll?

                    -
                    - -

                    -Add physics controls to Spatials and give them spherical or cylindrical bounding volumes. -
                    -Learn more: Hello Physics, Physics, com.jme3.bounding.*, com.jme3.bullet.collisions, com.jme3.bullet.controls.RigidBodyControl, +this.assetManager.registerLocator("town.zip", ZipLocator.class.getName());

                    Learn more: Asset Manager

                    How do I Create 3-D models?

                    You create 3-D models in a 3-D mesh editor, for example Blender, and export it in Ogre Mesh XML or Wavefront OBJ format.
                    Learn more: 3D Models, , , .

                    How do I load a 3-D model into the scene?

                    Use the jMonkeyEngine SDK to convert models from Ogre XML or Wavefront OBJ formats to .j3o binary format. Load the .j3o file using the AssetManager.

                    // To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.mesh.xml
                    +Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");

                    Learn more: Hello Asset, Asset Manager, , , jMonkeyEngine SDK j3o converter,
                    Code sample: , .

                    How do initialize the scene?

                    Use the simpleInitApp() method in SimpleApplication (or initApp() in Application).
                    Learn more: Hello SimpleApplication, .

                    I want to transform objects in the scene

                    How do I move or turn or resize a spatial?

                    To move or turn or resize a spatial you use transformations. You can concatenate transformations (e.g. perform rotations around several axes in one step using a Quaternion with slerp() or a com.jme3.math.Transform with interpolateTransforms().

                    spatial.setLocalTranslation(1,-3,2.5f); spatial.rotate(0,3.14f,0); spatial.scale(2,2,2);

                    Learn more: Hello Node, Spatial, rotate, rotate_about_a_point, quaternion, math_for_dummies.

                    How do I make a spatial move by itself?

                    Change the geometry's translation (position) live in the update loop using setLocalTranslation() for non-physical and setWalkDirection() for physical objects. You can also define and remote-control a spatial's motion using Cinematics, e.g. to record cut scenes.
                    Learn more: Hello Loop, Update Loop, Custom Controls, Cinematics
                    Code sample: ,

                    How do I access a named sub-mesh in Model?

                    Geometry result = spatial.getName().startsWith(name);

                    Learn more: Spatial

                    How do I make procedural or custom shapes?

                    You can programmatically create com.jme3.scene.Mesh'es.
                    Learn more: Custom Meshes

                    I want to change the surface of objects in the scene

                    Why is my UV wrapping / texture appearance all wrong?

                    The most likely reason is the flipping of textures. You may be using the following default method:

                      material.setTexture("ColorMap", assetManager.loadTexture("myTexture.jpg"));

                    You can set the boolean value in the constructor of TextureKey to flipped or not flipped. Toggle the boolean to see if it fixes your UV wrapping/texture problem:

                      material.setTexture("ColorMap", this.assetManager.loadTexture(new TextureKey("myTexture.jpg", false)));

                    How do I scale, mirror, or wrap a texture?

                    You cannot scale a texture, but you scale the texture coordinates of the mesh the texture is applied to:

                    mesh.scaleTextureCoordinates(new Vector2f(2,2));

                    You can choose among various com.jme3.texture.Texture.WrapModes for individual texture maps of a material: BorderClamp, EdgeClamp, Clamp; MirrorBorderClamp, MirrorEdgeClamp, MirrorClamp; Repeat, MirroredRepeat.

                    material.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat);

                    How do I change color or shininess of an material?

                    Use the AssetManager to load Materials, and change material settings.
                    Learn more: Hello Material, Materials Overview, Asset Manager
                    Code sample: , .

                    How do I make a surface wood, stone, metal, etc?

                    Create Textures as image files. Use the AssetManager to load a Material and set the material's texture maps.
                    Learn more: Hello Material, Materials Overview, Asset Manager, ,
                    Code sample:

                    Why are materials too bright, too dark, or flickering?

                    If you use a lit material (based on Lighting.j3md) then you must attach a light source to the rootNode, otherwise you see nothing. If you use lit material colors, make sure you have specified an Ambient color (can be the same as the Diffuse color) if you use an AmbientLight. If you see objects, but they are gray or too dark, set the light color to white, or make it brighter (you can multiply the color value with a scalar), or add a global light source (AmbientLight). Similarly, if everything is white, tune down the lights. If materials flicker under a directional light, change the light direction vector. Change the background color (which is independent of light sources) to get a better contrast while debugging a light problem.

                    How do I make geometries cast a shadow?

                    Use com.jme3.shadow.BasicShadowRenderer together with com.jme3.light.DirectionalLight, and setShadowMode().
                    Learn more: Light and Shadow
                    Code sample: ,

                    How do I make materials transparent?

                    Assign a texture with an alpha channel to a Material and set the Material's blend mode to alpha. Use this to create transparent or translucent materials such as glass, window panes, water, tree leaves, etc.

                    material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

                    Learn more: Hello Material, Materials Overview

                    How do I force or disable backface culling?

                    You can switch the com.jme3.material.RenderState.FaceCullMode to Back, Front, FrontAndBack, or Off. This influences whether the front or backside of an object is being drawn. By default, backsides are culled (not drawn) because they are usually not visible anyway.

                    material.getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack);

                    Can I draw only an outline of the scene?

                    Create a material and switch its renders state to wireframe.

                    material.getAdditionalRenderState().setWireframe(true);

                    Learn more: Debugging.

                    I want to control the camera

                    How do I switch between third-person and first-person view ?

                    The default camera is the cam object. Learn more:

                    • You can activate the FlyBy Cam as a first-person camera.
                      Learn more: Hello Collision.
                      Code sample:
                      flyCam.setEnabled(true);
                    • You can also create a third-person chase cam.
                      Learn more:
                      Code sample: .
                      flyCam.setEnabled(false);
                      +chaseCam = new ChaseCamera(cam, spatial, inputManager);

                    How do I increase camera speed?

                    flyCam.setMoveSpeed(50f);

                    Actions, Interactions, Physics

                    How do I implement game logic / game mechanics?

                    Use Controls to define the behaviour of types of Spatials. Use Application States to implement global behaviour. Use the simpleUpdate() loop for the remaining tests and interactions. Use Cinematics to remote-control objects in scenes.
                    Learn more: Hello Loop, Update Loop, Custom Controls, Application States, Cinematics

                    How do I let players interact via keyboard?

                    Use com.jme3.input.KeyInput and a Input Listener.
                    Learn more: Hello Input, Input Handling

                    How do I let players interact by clicking?

                    Players use the mouse to pick up objects, to open doors, to shoot a weapon, etc. Use an Input Listener to respond to mouse clicks, then cast a ray from the player; if it intersect with the bounding volume of a spatial, this is the selected target. The links below contain code samples for both "fixed crosshair" picking and "free mouse pointer" picking.
                    Learn more: Hello Picking, Mouse Picking, Collision and Intersection, Input Handling, com.jme3.bounding.*, com.jme3.math.Ray, com.jme3.collision.CollisionResults.
                    Code sample:

                    How do I animate characters?

                    Create an animated OgreMesh model with bones in a 3-D mesh editor (e.g. Blender).
                    Learn more: com.jme3.animation.*, Hello Animation, Animation,
                    Code sample:

                    How do I keep players from falling through walls and floors?

                    Use collision detection. The most common solution is to use jme's physics integration.
                    Learn more: Hello Collision, Physics, com.jme3.bullet.*, CapsuleCollisionShape versus CompoundCollisionShape, CharacterControl versus RigidBodyControl.

                    How do I make balls/wheels/etc bounce and roll?

                    Add physics controls to Spatials and give them spherical or cylindrical bounding volumes.
                    Learn more: Hello Physics, Physics, com.jme3.bounding.*, com.jme3.bullet.collisions, com.jme3.bullet.controls.RigidBodyControl,
                    Code sample: ,

                    @@ -706,9 +259,13 @@ Logger.getLogger(HelloJME3.class.getName()).log(Level.INFO,

                    The following shortened example shows the capabilities of an older graphic card. In this case you decide whether to branch to a low-quality rendering of the unsupported features (if you still want to support this card), or print an error message explaining the user what capabilities the card is missing to play the game. +

                    + +

                    +Here is an example of the capabilities of an older graphic card:

                    -
                    INFO: Running on jMonkey Engine 3 Alpha 0.6
                    +
                    INFO: Running on jMonkey Engine 3 
                     INFO: Using LWJGL 2.7.1
                     INFO: Selected display mode: 1024 x 768 x 0 @0Hz
                     INFO: Adapter: null
                    @@ -719,8 +276,30 @@ INFO: Renderer: ATI Radeon X1600 OpenGL Engine
                     INFO: GLSL Ver: 1.20
                     INFO: Timer resolution: 1.000 ticks per second
                     INFO: Capabilities: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample,
                    -OpenGL20, ARBprogram, GLSL100, GLSL110, GLSL120, VertexTextureFetch,
                    -FloatTexture, TextureCompressionLATC, NonPowerOfTwoTextures]
                    +OpenGL20, ARBprogram, GLSL100, GLSL110, GLSL120, +VertexTextureFetch, FloatTexture, +TextureCompressionLATC, NonPowerOfTwoTextures]
                    + +

                    + +A newer graphic card has better capabilities, for example: + +

                    +
                    INFO: Running on jMonkeyEngine 3.0.0 
                    +INFO: Using LWJGL 2.8.2
                    +INFO: Selected display mode: 1280 x 720 x 0 @0Hz
                    +INFO: Adapter: null
                    +INFO: Driver Version: null
                    +INFO: Vendor: ATI Technologies Inc.
                    +INFO: OpenGL Version: 2.1 ATI-7.14.5
                    +INFO: Renderer: AMD Radeon HD 6770M OpenGL Engine
                    +INFO: GLSL Ver: 1.20
                    +INFO: Timer resolution: 1.000 ticks per second
                    +INFO: Capabilities: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample, 
                    +OpenGL20, OpenGL21, ARBprogram, GLSL100, GLSL110, GLSL120, 
                    +VertexTextureFetch, TextureArray, FloatTexture, 
                    +FloatColorBuffer, FloatDepthBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer, 
                    +TextureCompressionLATC, NonPowerOfTwoTextures, MeshInstancing]
                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/appsettings.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/appsettings.html index 72a4450d5..e052373a4 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/appsettings.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/appsettings.html @@ -1,21 +1,4 @@ - -

                    jME3 Application Display Settings

                    -
                    - -

                    - -Every class that extends jme3.app.SimpleApplication has properties that can be configured by customizing a com.jme3.system.AppSettings object. Configure the settings before you call app.start() on the application object. If you change display settings during runtime, call app.restart() to make them take effect. -

                    - -

                    -Note: Other runtime settings are covered in SimpleApplication. -

                    - -
                    - -

                    Code Sample

                    -
                    -
                    public static void main(String[] args) {
                    +

                    jME3 Application Display Settings

                    Every class that extends jme3.app.SimpleApplication has properties that can be configured by customizing a com.jme3.system.AppSettings object. Configure the settings before you call app.start() on the application object. If you change display settings during runtime, call app.restart() to make them take effect.

                    Note: Other runtime settings are covered in SimpleApplication.

                    Code Sample

                    public static void main(String[] args) {
                       AppSettings settings = new AppSettings(true);
                       settings.setResolution(640,480);
                       ... // other properties see below
                    @@ -23,86 +6,7 @@ Every class that extends jme3.app.SimpleApplication has properties that can be c
                       MyGame app = new MyGame(); // or Main or whatever you called your SimpleApplication
                       app.setSettings(settings);
                       app.start();
                    -}
                    - -

                    -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. -

                    - -

                    -

                    Use app.setShowSettings(true); to present the user with a splashscreen and display settings dialog when starting the game, or app.setShowSettings(false); to hide the custom splashscreen. Set this boolean before calling app.start() on the SimpleApplication. -

                    -

                    - -
                    - -

                    Properties

                    -
                    -
                    - - - - - - - - - - - - - - - - - - - - - - - - -
                    Settings Property (Video)DescriptionDefault
                    setRenderer(AppSettings.LWJGL_OPENGL1)
                    -setRenderer(AppSettings.LWJGL_OPENGL2)
                    -setRenderer(AppSettings.LWJGL_OPENGL3)
                    Switch Video Renderer to OpenGL 1.1, OpenGL 2, or OpenGL 3.3. If your graphic card does not support all OpenGL2 features (UnsupportedOperationException: GLSL and OpenGL2 is required for the LWJGL renderer), then you can force your SimpleApplication to use OpenGL1 compatibility. (Then you still can't use special OpenGL2 features, but at least the error goes away and you can continue with the rest.) OpenGL 2
                    setBitsPerPixel(32)Set the color depth.
                    -1 bpp = black and white, 2 bpp = gray,
                    -4 bpp = 16 colors, 8 bpp = 256 colors, 24 or 32 bpp = "truecolor".
                    24
                    setFramerate(60)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.-1 (unlimited)
                    setFullscreen(true)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).
                    -Set this to false to play the game in a normal window of its own.
                    False (windowed)
                    setHeight(480), setWidth(640)
                    -setResolution(640,480)
                    Two equivalent ways of setting the display resolution.640x480 pixels
                    setSamples(4)Set multisampling to 0 to switch antialiasing off (harder edges, faster.)
                    -Set multisampling to 2 or 4 to activate antialising (softer edges, may be slower.)
                    -Depending on your graphic card, you may be able to set multisampling to higher values such as 8, 16, or 32 samples.
                    0
                    setVSync(true)
                    -setFrequency(60)
                    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.
                    -Set VSync to false to deactivate vertical syncing (faster, but possible page tearing artifacts); can remain deactivated during development or for slower PCs.
                    false
                    -60 fps
                    -
                    - - - - - - - - - -
                    Settings Property (Input)DescriptionDefault
                    setUseInput(false)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.true
                    setUseJoysticks(true)Activate optional joystick supportfalse
                    -
                    - - - - - - - - - -
                    Settings Property (Audio)DescriptionDefault
                    setAudioRenderer(AppSettings.LWJGL_OPENAL)Switch Audio Renderer. Currently there is only one option. OpenAL
                    setStereo3D(true)Enable 3D stereo. This feature requires hardware support from the GPU driver. See . Currently, your everday user's hardware does not support this, so you can ignore it for now.false
                    -
                    - - - - - +}

                    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.

                    Use app.setShowSettings(true); to present the user with a splashscreen and display settings dialog when starting the game, or app.setShowSettings(false); to hide the custom splashscreen. Set this boolean before calling app.start() on the SimpleApplication.

                    Properties

                    Settings Property (Branding)DescriptionDefault
                    setTitle("My Game")This string will be visible in the titlebar, unless the window is fullscreen."jMonkey Engine 3.0"
                    Settings Property (Video)DescriptionDefault
                    setRenderer(AppSettings.LWJGL_OPENGL1)
                    setRenderer(AppSettings.LWJGL_OPENGL2)
                    setRenderer(AppSettings.LWJGL_OPENGL3)
                    Switch Video Renderer to OpenGL 1.1, OpenGL 2, or OpenGL 3.3. If your graphic card does not support all OpenGL2 features (UnsupportedOperationException: GLSL and OpenGL2 is required for the LWJGL renderer), then you can force your SimpleApplication to use OpenGL1 compatibility. (Then you still can't use special OpenGL2 features, but at least the error goes away and you can continue with the rest.)OpenGL 2
                    setBitsPerPixel(32)Set the color depth.
                    1 bpp = black and white, 2 bpp = gray,
                    4 bpp = 16 colors, 8 bpp = 256 colors, 24 or 32 bpp = "truecolor".
                    24
                    setFramerate(60)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.-1 (unlimited)
                    setFullscreen(true)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).
                    Set this to false to play the game in a normal window of its own.
                    False (windowed)
                    setHeight(480), setWidth(640)
                    setResolution(640,480)
                    Two equivalent ways of setting the display resolution.640x480 pixels
                    setSamples(4)Set multisampling to 0 to switch antialiasing off (harder edges, faster.)
                    Set multisampling to 2 or 4 to activate antialising (softer edges, may be slower.)
                    Depending on your graphic card, you may be able to set multisampling to higher values such as 8, 16, or 32 samples.
                    0
                    setVSync(true)
                    setFrequency(60)
                    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.
                    Set VSync to false to deactivate vertical syncing (faster, but possible page tearing artifacts); can remain deactivated during development or for slower PCs.
                    false
                    60 fps
                    Settings Property (Input)DescriptionDefault
                    setUseInput(false)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.true
                    setUseJoysticks(true)Activate optional joystick supportfalse
                    Settings Property (Audio)DescriptionDefault
                    setAudioRenderer(AppSettings.LWJGL_OPENAL)Switch Audio Renderer. Currently there is only one option.OpenAL
                    setStereo3D(true)Enable 3D stereo. This feature requires hardware support from the GPU driver. See . Currently, your everday user's hardware does not support this, so you can ignore it for now.false
                    Settings Property (Branding)DescriptionDefault
                    setTitle("My Game")This string will be visible in the titlebar, unless the window is fullscreen."jMonkey Engine 3.0"
                    setIcons(new BufferedImage[]{
                    diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/best_practices.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/best_practices.html index 9341f7f6a..33f2c57de 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/best_practices.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/best_practices.html @@ -1,48 +1,4 @@ - -

                    Best Practices For jME3 Developers

                    -
                    - -

                    - -A collection of recommendations and expert tips. Feel free to add your own! -If you are a beginner, you should first game development. We cannot cover all general tips here. -

                    - -
                    - -

                    Requirements Gathering

                    -
                    - -

                    - -As a quick overview, answer yourself the following questions: -

                    -
                      -
                    • Motivation
                      -
                        -
                      • Sum up your game idea in one sentence. If you can't, it's too complicated.
                        -
                      • -
                      • Who's the target group? Why would they choose your game over the million others that exist?
                        -
                      • -
                      -
                    • -
                    • Game type
                      -
                        -
                      • Point of view (camera)? What character(s) does the player control (if any)?
                        -
                      • -
                      • Time- or turn-based?
                        -
                      • -
                      • Genre, setting, background story? (If applicable)
                        -
                      • -
                      -
                    • -
                    • Gameplay
                      -
                        -
                      • What is the start state, what is the end state?
                        -
                      • -
                      • What resources does the player manage? How are resources gained, transformed, spent? E.g. speed, gold, health, "points".
                        -
                      • -
                      • How does the player interact? I.e. rules, challenges, game mechanics.
                        +

                        Best Practices For jME3 Developers

                        A collection of recommendations and expert tips. Feel free to add your own! If you are a beginner, you should first Requirements Gathering

                        As a quick overview, answer yourself the following questions:

                        • Motivation
                          • Sum up your game idea in one sentence. If you can't, it's too complicated.
                          • Who's the target group? Why would they choose your game over the million others that exist?
                        • Game type
                          • Point of view (camera)? What character(s) does the player control (if any)?
                          • Time- or turn-based?
                          • Genre, setting, background story? (If applicable)
                        • Gameplay
                          • What is the start state, what is the end state?
                          • What resources does the player manage? How are resources gained, transformed, spent? E.g. speed, gold, health, "points".
                          • How does the player interact? I.e. rules, challenges, game mechanics.
                          • What state is considered winning, and what losing?
                          • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/file_types.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/file_types.html index 508a5b990..fe8770814 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/file_types.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/file_types.html @@ -1,78 +1,2 @@ - -

                            jMonkeyEngine3 Supported File Types

                            -
                            - -
                            - -

                            jMonkeyEngine3 File Formats

                            -
                            -
                            - - - - - - - - - - - - - - - -
                            SuffixUsageLearn more
                            .j3oBinary 3D model or scene. At the latest from the Beta release of your game on, you should convert all models to .j3o format.
                            -During alpha and earlier development phases (when models still change a lot) you can alternatively load OgreXML/OBJ models directly.
                            Model Loader and Viewer
                            .j3mA custom Material. You can create a .j3m file to store a Material configuration for a Geometry (e.g. 3D model).Materials Overview
                            -Material Editing
                            .j3mdA Material definition. These are pre-defined templates for shader-based Materials.
                            -Each custom .j3m Material is based on a material definition. Advanced users can create their own material definitions.
                            Materials Overview
                            .j3fA custom post-processor filter configuration. You can create a .j3f file to store a FilterPostProcessor with a set of preconfigured filters. Filters
                            -Effects Overview
                            - -
                            - -

                            Supported External File Types

                            -
                            -
                            - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                            File SuffixTypeDescription
                            .mesh.xml, .meshxml3D modelOgre Mesh XML
                            .scene3D sceneOgre DotScene
                            .OBJ, .MTL3D modelWavefront
                            .blend3D modelBlender version 2.49 or 2.5x
                            .JPG, .PNG, .GIFimageTextures, icons
                            .DDSimageDirect Draw Surface texture
                            .HDRimageHigh Dynamic Range texture
                            .TGAimageTarga Image File texture
                            .PFMimagePortable Float Map texture
                            .fntbitmap fontAngelCode font for GUI and HUD
                            .WAVaudioWave music and sounds
                            .OGGaudioOGG Vorbis music and sounds
                            - -
                            +

                            jMonkeyEngine3 Supported File Types

                            jMonkeyEngine3 File Formats

                            SuffixUsageLearn more
                            .j3oBinary 3D model or scene. At the latest from the Beta release of your game on, you should convert all models to .j3o format.
                            During alpha and earlier development phases (when models still change a lot) you can alternatively load OgreXML/OBJ models directly.
                            Model Loader and Viewer
                            .j3mA custom Material. You can create a .j3m file to store a Material configuration for a Geometry (e.g. 3D model).Materials Overview
                            Material Editing
                            .j3mdA Material definition. These are pre-defined templates for shader-based Materials.
                            Each custom .j3m Material is based on a material definition. Advanced users can create their own material definitions.
                            Materials Overview
                            .j3fA custom post-processor filter configuration. You can create a .j3f file to store a FilterPostProcessor with a set of preconfigured filters.Filters
                            Effects Overview

                            Supported External File Types

                            File SuffixTypeDescription
                            .mesh.xml, .meshxml3D modelOgre Mesh XML
                            .scene3D sceneOgre DotScene
                            .OBJ, .MTL3D modelWavefront
                            .blend3D modelBlender version 2.49 or 2.5x
                            .JPG, .PNG, .GIFimageTextures, icons
                            .DDSimageDirect Draw Surface texture
                            .HDRimageHigh Dynamic Range texture
                            .TGAimageTarga Image File texture
                            .PFMimagePortable Float Map texture
                            .fntbitmap fontAngelCode font for GUI and HUD
                            .WAVaudioWave music and sounds
                            .OGGaudioOGG Vorbis music and sounds

                            view online version

                            \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/headlessserver.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/headlessserver.html index 8092ab56e..0b569250a 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/headlessserver.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/headlessserver.html @@ -1,284 +1,7 @@ - - - - - - | jMonkeyEngine.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                            -
                            -
                            -

                            jMonkeyEngine.org

                            - -
                            - - - - - - - -
                            - - -
                            -
                            - -
                            -
                            - - -
                            - - -
                            -
                            -
                            -
                            - You are here: Documentation » jme3 » intermediate » headlessserver
                            -
                            -
                            - -
                            - - -

                            This topic does not exist yet

                            -
                            - -

                            - -You've followed a link to a topic that doesn't exist yet. If permissions allow, you may create it by using the Create this page button. -

                            - -
                            - - -
                            - -
                             
                            - - -
                            -
                            Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution 3.0 Unported
                            -

                            This topic does not exist yet

                            You've followed a link to a topic that doesn't exist yet. If permissions allow, you may create it by using the Create this page button.

                             
                            Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution 3.0 Unported
                            - -
                            - Trace:
                            -
                            - - -
                            - -
                            -
                            - - -
                            - -
                            -

                            Proudly powered by and .

                            -
                            - -
                            - - -
                            - - - - - -
                            -
                            -
                            - -close -
                            - - - - +
                            Trace:

                            Proudly powered by and .

                            close

                            view online version

                            \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/optimization.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/optimization.html index 2e92e09eb..975ceea48 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/optimization.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/optimization.html @@ -1,47 +1,4 @@ - -

                            Optimization reference

                            -
                            - -

                            -This page is intended as a reference collection of optimization tricks that can be used to speed up JME3 applications. - -

                            - -
                            - -

                            Maintain low Geometry count

                            -
                            - -

                            -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. -

                            - -

                            -Possible optimization techniques -

                            -
                              -
                            • 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 SDK as well, just right-click a node and select "Optimize Geometry"
                              -
                            • -
                            - -

                            -Side-effects -

                            -
                              -
                            • 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.
                              -
                            • -
                            • Using Texture atlases might be a way to provide a limited individual texturing.
                              -
                            • -
                            - -
                            - -

                            Avoid creating new objects

                            -
                            - -

                            -When you use math operations like vectorA.mult(vectorB); new objects are created that have to be garbage collected when you don'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. +

                            Optimization reference

                            This page is intended as a reference collection of optimization tricks that can be used to speed up JME3 applications.

                            Maintain low Geometry count

                            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.

                            Possible optimization techniques

                            • 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 SDK as well, just right-click a node and select "Optimize Geometry"

                            Side-effects

                            • 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.
                            • Using Texture atlases might be a way to provide a limited individual texturing.

                            Avoid creating new objects

                            When you use math operations like vectorA.mult(vectorB); new objects are created that have to be garbage collected when you don'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.

                            diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html index 49bf21f16..e2ec36e66 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/simpleapplication.html @@ -1,20 +1,4 @@ - -

                            SimpleApplication and Application

                            -
                            - -

                            - -The base class of the jMonkeyEngine3 is com.jme3.app.SimpleApplication. Your first game'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. -

                            - -

                            -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. -

                            - -

                            -The following code sample shows the typical base structure of a jME3 game: -

                            -
                            import com.jme3.app.SimpleApplication;
                            +

                            SimpleApplication and Application

                            The base class of the jMonkeyEngine3 is com.jme3.app.SimpleApplication. Your first game'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.

                            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.

                            The following code sample shows the typical base structure of a jME3 game:

                            import com.jme3.app.SimpleApplication;
                              
                             public class MyBaseGame extends SimpleApplication {
                              
                            @@ -37,29 +21,7 @@ public class MyBaseGame extends SimpleApplication {
                                 public void simpleRender(RenderManager rm) {
                                    /* (optional) Make advanced modifications to frameBuffer and scene graph. */
                                 }
                            -}
                            - -

                            -Let's have a look at the API of the base class. -

                            - -
                            - -

                            Application Class

                            -
                            - -

                            - -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. - -

                            -
                            - - - - - +}

                            Let's have a look at the API of the base class.

                            Application Class

                            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.

                            Application class fieldsPurpose
                            viewPort
                            -getViewPort()
                            The view object for the default camera. You can register advanced post-processor filters here.
                            Application class fieldsPurpose
                            viewPort
                            getViewPort()
                            The view object for the default camera. You can register advanced post-processor filters here.
                            settings
                            diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/math.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/math.html index 67c86ee3c..935f6e358 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/math.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/math.html @@ -1,148 +1,5 @@ - -

                            Introduction to Mathematical Functionality

                            -
                            - -

                            - -It'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. -

                            - -

                            -I'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. -

                            - -

                            -To get a visual introduction to math in jME3 for the absolute beginner, check out our Math for Dummies introduction class. -

                            - -
                            - -

                            Coordinate System

                            -
                            - -
                            - -

                            Definition

                            -
                            - -

                            - -A coordinate system 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. -

                            - -

                            -jME uses a Right-Handed coordinate system (as OpenGL does). -

                            - -

                            -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). -

                            - -

                            - -

                            - -
                            - -

                            Transformations

                            -
                            - -

                            - -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. -

                            - -
                            - -

                            Visibility Determination

                            -
                            - -

                            - -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'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'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. -

                            - -
                            - -

                            Fundamental Types

                            -
                            - -
                            - -

                            ColorRGBA

                            -
                            - -
                            - -

                            Definition

                            -
                            - -

                            - -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. -

                            - -

                            -Note: If you would like to "convert" an ordinary RGB value (0-255) to the format used here (0-1), simply multiply it with: 1/255. -

                            - -
                            - -

                            jME Class

                            -
                            - -

                            - -ColorRGBA defines a few static color values for ease of use. That is, rather than: -

                            -
                            ColorRGBA red = new ColorRGBA(1,0,0,1);
                            -object.setSomeColor(red);
                            - -

                            -you can simply say: - -

                            -
                            object.setSomeColor(ColorRGBA.red)
                            - -

                            -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. -

                            - -
                            - -

                            Matrix

                            -
                            - -

                            - -See
                            - -and -

                            - -
                            - -

                            Definition

                            -
                            - -

                            - -A Matrix is typically used as a linear transformation 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). -

                            - -

                            -There are a few special matrices: -

                            - -

                            -zero matrix is the Matrix with all zero entries. -

                            -
                            - - - - - +

                            Introduction to Mathematical Functionality

                            It'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.

                            I'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.

                            To get a visual introduction to math in jME3 for the absolute beginner, check out our Math for Dummies introduction class.

                            Coordinate System

                            Definition

                            A coordinate system 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.

                            jME uses a Right-Handed coordinate system (as OpenGL does).

                            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).

                            Transformations

                            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.

                            Visibility Determination

                            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'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'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.

                            Fundamental Types

                            ColorRGBA

                            Definition

                            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.

                            Note: If you would like to "convert" an ordinary RGB value (0-255) to the format used here (0-1), simply multiply it with: 1/255.

                            jME Class

                            ColorRGBA defines a few static color values for ease of use. That is, rather than:

                            ColorRGBA red = new ColorRGBA(1,0,0,1);
                            +object.setSomeColor(red);

                            you can simply say:

                            object.setSomeColor(ColorRGBA.red)

                            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.

                            Matrix

                            See
                            and

                            Definition

                            A Matrix is typically used as a linear transformation 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).

                            There are a few special matrices:

                            zero matrix is the Matrix with all zero entries.

                            000
                            000
                            diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/simpleapplication_from_the_commandline.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/simpleapplication_from_the_commandline.html index 515df107f..5b15d801c 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/simpleapplication_from_the_commandline.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/simpleapplication_from_the_commandline.html @@ -1,21 +1,4 @@ - -

                            Starting a JME3 application from the Commandline

                            -
                            - -

                            - -Although we recommend the jMonkeyEngine SDK for developing JME3 games, you can use any IDE (integrated development environment) such as NetBeans or Eclipse, and even work freely from the commandline. Here is a generic IDE-independent "getting started" tutorial. -

                            - -

                            -This example shows how to set up and run a simple application (HelloJME3) that depends on the jMonkeyEngine3 libraries. -

                            - -

                            -The directory structure will look as follows: - -

                            -
                            jme3/
                            +

                            Starting a JME3 application from the Commandline

                            Although we recommend the jMonkeyEngine SDK for developing JME3 games, you can use any IDE (integrated development environment) such as NetBeans or Eclipse, and even work freely from the commandline. Here is a generic IDE-independent "getting started" tutorial.

                            This example shows how to set up and run a simple application (HelloJME3) that depends on the jMonkeyEngine3 libraries.

                            The directory structure will look as follows:

                            jme3/
                             jme3/lib
                             jme3/src
                             ...
                            @@ -23,76 +6,18 @@ HelloJME3/
                             HelloJME3/lib
                             HelloJME3/assets
                             HelloJME3/src
                            -...
                            - -
                            - -

                            Installing the JME3 Framework

                            -
                            - -

                            - -To install the development version of jme3, , unzip the folder into a directory named jme3. The filenames here are just an example, but they will always be something like jME3_xx-xx-2011. -

                            -
                            mkdir jme3
                            +...

                            Installing the JME3 Framework

                            To install the development version of jme3, , unzip the folder into a directory named jme3. The filenames here are just an example, but they will always be something like jME3_xx-xx-2011.

                            mkdir jme3
                             cd jme3
                            -unzip jME3_01-18-2011.zip
                            - -

                            -Alternatively, you can build JME3 from the sources. (Recommended for JME3 developers.) -

                            -
                            svn checkout https://jmonkeyengine.googlecode.com/svn/trunk/engine jme3
                            +unzip jME3_01-18-2011.zip

                            Alternatively, you can build JME3 from the sources. (Recommended for JME3 developers.)

                            svn checkout https://jmonkeyengine.googlecode.com/svn/trunk/engine jme3
                             cd jme3
                             ant run
                            -cd ..
                            - -

                            -If you see a Test Chooser open now, the build was successful. Tip: Use ant to build the libraries without running the demos. -

                            - -
                            - -

                            Sample Project Directory Structure

                            -
                            - -

                            - -First we set up the directory and source package structure for your game project. Note that the game project directory HelloJME3 is on the same level as your jme3 checkout. In this example, we create a Java package that we call hello in the source directory. -

                            -
                            mkdir HelloJME3
                            +cd ..

                            If you see a Test Chooser open now, the build was successful. Tip: Use ant to build the libraries without running the demos.

                            Sample Project Directory Structure

                            First we set up the directory and source package structure for your game project. Note that the game project directory HelloJME3 is on the same level as your jme3 checkout. In this example, we create a Java package that we call hello in the source directory.

                            mkdir HelloJME3
                             mkdir HelloJME3/src
                            -mkdir HelloJME3/src/hello
                            - -
                            - -

                            Libraries

                            -
                            - -

                            - -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. -

                            -
                            mkdir HelloJME3/build 
                            +mkdir HelloJME3/src/hello

                            Libraries

                            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.

                            mkdir HelloJME3/build 
                             mkdir HelloJME3/lib
                            -cp jme3/lib/*.* HelloJME3/lib
                            - -

                            -If you have built JME3 from the sources, then the copy paths are different: -

                            -
                            mkdir HelloJME3/build 
                            +cp jme3/lib/*.* HelloJME3/lib

                            If you have built JME3 from the sources, then the copy paths are different:

                            mkdir HelloJME3/build 
                             mkdir HelloJME3/lib
                            -cp jme3/dist/*.* HelloJME3/lib
                            - -
                            - -

                            Sample Code

                            -
                            - -

                            - -To test your setup, create the file HelloJME3/src/hello/HelloJME3.java with any text editor, paste the following sample code, and save. -

                            -
                            package hello;
                            +cp jme3/dist/*.* HelloJME3/lib

                            Sample Code

                            To test your setup, create the file HelloJME3/src/hello/HelloJME3.java with any text editor, paste the following sample code, and save.

                            package hello;
                              
                             import com.jme3.app.SimpleApplication;
                             import com.jme3.material.Material;
                            diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/terminology.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/terminology.html
                            index 45855ebcc..758603196 100644
                            --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/terminology.html
                            +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/terminology.html
                            @@ -1,118 +1,4 @@
                            -
                            -

                            3D Game Development Terminology

                            -
                            - -

                            - -Before you start, make certain you are familiar with the following concepts and terminology. -

                            - -
                            - -

                            3D Graphics and Audio

                            -
                            - -

                            -OpenGL 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: -

                            -
                              -
                            1. Lightweight Java Game Library (LWJGL)
                              -
                            2. -
                            3. Java OpenGL (JOGL)
                              -
                            4. -
                            - -

                            -OpenAL is the Open Audio Library, a platform-independent 3D audio API. -

                            - -
                            - -

                            Context, Display, Renderer

                            -
                            - -

                            - -The jME Context makes settings, renderer, timer, input and event listeners, display system, accessible to a JME game. -

                            -
                              -
                            • The jME Display System is what draws the custom JME window (instead of Java Swing).
                              -
                            • -
                            • The input system is what lets you respond to user input via mouse, keyboard, and joystick.
                              -
                            • -
                            • The renderer is what does all the work of calculating how to draw the 3D scenegraph to the 2D screen.
                              -
                                -
                              • The Shader is a programmable part of the rendering pipeline. The jME3 game engine uses it to offer advanced customizable materials.
                                -
                              • -
                              -
                            • -
                            - -
                            - -

                            Geometry

                            -
                            - -

                            - -

                            - -
                            - -

                            Coordinates

                            -
                            - -

                            - -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. -

                            - -
                            - -

                            The Origin

                            -
                            - -

                            - -The origin is the central point in the 3D world, where the three axes meet. It's at the coordinates (0,0,0). -

                            - -

                            -Example: Vector3f origin = new Vector3f( Vector3f.ZERO ); -

                            - -
                            - -

                            Vectors

                            -
                            - -

                            - -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. -

                            - -

                            -Example: Vector3f v = new Vector3f( 17 , -4 , 0 ); -

                            - -
                            - -

                            Unit Vectors

                            -
                            - -

                            - -A unit vector 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. -

                            -
                              -
                            • Vector3f.UNIT_X = ( 1, 0, 0) = right
                              -
                            • -
                            • Vector3f.UNIT_Y = ( 0, 1, 0) = up
                              -
                            • -
                            • Vector3f.UNIT_Z = ( 0, 0, 1) = forwards
                              -
                            • -
                            • Vector3f.UNIT_XYZ = 1 wu diagonal right-up-forewards
                              +

                              3D Game Development Terminology

                              Before you start, make certain you are familiar with the following concepts and terminology.

                              3D Graphics and Audio

                              OpenGL 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:

                              1. Lightweight Java Game Library (LWJGL)
                              2. Java OpenGL (JOGL)

                              OpenAL is the Open Audio Library, a platform-independent 3D audio API.

                              Context, Display, Renderer

                              The jME Context makes settings, renderer, timer, input and event listeners, display system, accessible to a JME game.

                              • The jME Display System is what draws the custom JME window (instead of Java Swing).
                              • The input system is what lets you respond to user input via mouse, keyboard, and joystick.
                              • The renderer is what does all the work of calculating how to draw the 3D scenegraph to the 2D screen.
                                • The Shader is a programmable part of the rendering pipeline. The jME3 game engine uses it to offer advanced customizable materials.

                              Geometry

                              Coordinates

                              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.

                              The Origin

                              The origin is the central point in the 3D world, where the three axes meet. It's at the coordinates (0,0,0).

                              Example: Vector3f origin = new Vector3f( Vector3f.ZERO );

                              Vectors

                              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.

                              Example: Vector3f v = new Vector3f( 17 , -4 , 0 );

                              Unit Vectors

                              A unit vector 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.

                              • Vector3f.UNIT_X = ( 1, 0, 0) = right
                              • Vector3f.UNIT_Y = ( 0, 1, 0) = up
                              • Vector3f.UNIT_Z = ( 0, 0, 1) = forwards
                              • Vector3f.UNIT_XYZ = 1 wu diagonal right-up-forewards
                              diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/the_scene_graph.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/the_scene_graph.html index fa3460da2..cbef14a17 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/the_scene_graph.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/the_scene_graph.html @@ -1,100 +1,4 @@ - -

                              The Scene Graph and Other jME3 Terminology

                              -
                              - -

                              - -Before you start making games, make sure you understand general 3D Gaming terminology. -

                              - -

                              -Second, if you are a beginner, we recommend our Scene Graph for Dummies presentation for a visual introduction to the concept of a scene graph. -

                              - -

                              -Then continue learning about jME3 concepts here. -

                              - -
                              - -

                              Coordinate System

                              -
                              - -

                              - - -

                              - -

                              -The jMonkeyEngine uses a right-handed coordinate system, just as OpenGL does. -

                              - -

                              -The coordinate system consists of: - -

                              -
                                -
                              • The origin, a single point in space.
                                -
                                  -
                                • This point is always at coordinate (0,0,0)
                                  -
                                • -
                                -
                              • -
                              • Three coordinate axes that are mutually perpendicular, and meet in the origin.
                                -
                                  -
                                • The X axis is "right/left"
                                  -
                                • -
                                • The Y axis is "up/down"
                                  -
                                • -
                                • The Z axis is "towards you/away from you"
                                  -
                                • -
                                -
                              • -
                              - -

                              - -Every point in 3D space is defined by its (x,y,z) coordinates. The data type for vectors is com.jme3.math.Vector3f. -

                              - -

                              -For your orientation, the default camera'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. -

                              - -

                              -The unit of meassurement is world unit (wu). Typically, 1 wu is considered to be one meter. All scales, vectors and points are relative to this coordinate system. -

                              - -
                              - -

                              Scene Graph and RootNode

                              -
                              - -

                              - -The scene graph represents your 3D world. Objects in the jME3 scene graph are called Spatials. Everything attached to the rootNode is part of the scene graph. Attaching a Spatial to the rootNode (or other nodes) adds the Spatial to the scene; detaching removes it. -

                              - -

                              - -

                              - -
                              - -

                              Spatials: Node vs Geometry

                              -
                              - -

                              - -A Spatial can be transformed, loaded and saved. There are two types of Spatials, Nodes and Geometries. - -

                              -
                            000
                            000
                            000
                            - - - - - +

                            The Scene Graph and Other jME3 Terminology

                            Before you start making games, make sure you understand general 3D Gaming terminology.

                            Second, if you are a beginner, we recommend our Scene Graph for Dummies presentation for a visual introduction to the concept of a scene graph.

                            Then continue learning about jME3 concepts here.

                            Coordinate System

                            The jMonkeyEngine uses a right-handed coordinate system, just as OpenGL does.

                            The coordinate system consists of:

                            • The origin, a single point in space.
                              • This point is always at coordinate (0,0,0)
                            • Three coordinate axes that are mutually perpendicular, and meet in the origin.
                              • The X axis is "right/left"
                              • The Y axis is "up/down"
                              • The Z axis is "towards you/away from you"

                            Every point in 3D space is defined by its (x,y,z) coordinates. The data type for vectors is com.jme3.math.Vector3f.

                            For your orientation, the default camera'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.

                            The unit of meassurement is world unit (wu). Typically, 1 wu is considered to be one meter. All scales, vectors and points are relative to this coordinate system.

                            Scene Graph and RootNode

                            The scene graph represents your 3D world. Objects in the jME3 scene graph are called Spatials. Everything attached to the rootNode is part of the scene graph. Attaching a Spatial to the rootNode (or other nodes) adds the Spatial to the scene; detaching removes it.

                            Spatials: Node vs Geometry

                            A Spatial can be transformed, loaded and saved. There are two types of Spatials, Nodes and Geometries.

                            Spatial
                            Purpose: A Spatial is an abstract data structure that stores transformations (translation, rotation, scale).
                            diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/webstart.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/webstart.html index 831f67c88..141b13935 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/webstart.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/webstart.html @@ -1,60 +1,4 @@ - -

                            WebStart (JNLP) Deployment

                            -
                            - -

                            - -When you use the jMonkeyEngine SDK to deploy your application, 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: -

                            - -
                            - -

                            Problem Statement

                            -
                            - -

                            - -Problem: -

                            - -

                            -When running under WebStart, jMonkeyEngine may not have permission to extract the native libraries to the current directory. -

                            - -

                            -Solution: -

                            - -

                            -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. -

                            - -
                            - -

                            Simple way

                            -
                            - -

                            - -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: -

                            -
                            <extension name="lwjgl" href="http://lwjgl.org/webstart/2.7.1/extension.jnlp" />
                            - -
                            - -

                            Reliable way

                            -
                            - -
                            - -

                            Native jars

                            -
                            - -

                            - -You can download the LWJGL native jars from their site, or to ensure you're using the exact same version as bundled with your jME3 release, make your own: -

                            -
                            mkdir tmp
                            +

                            WebStart (JNLP) Deployment

                            When you use the jMonkeyEngine SDK to deploy your application, 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:

                            Problem Statement

                            Problem:

                            When running under WebStart, jMonkeyEngine may not have permission to extract the native libraries to the current directory.

                            Solution:

                            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.

                            Simple way

                            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:

                            <extension name="lwjgl" href="http://lwjgl.org/webstart/2.7.1/extension.jnlp" />

                            Reliable way

                            Native jars

                            You can download the LWJGL native jars from their site, or to ensure you're using the exact same version as bundled with your jME3 release, make your own:

                            mkdir tmp
                             cd tmp
                             jar xfv ../jME3-lwjgl-natives.jar
                             cd native
                            @@ -62,12 +6,7 @@ for i in *; do
                               cd $i
                               jar cfv ../../native_$i.jar .
                               cd ..
                            -done
                            - -

                            -For Windows: -

                            -
                            @echo off
                            +done

                            For Windows:

                            @echo off
                             md tmp
                             cd tmp
                             "%JDK_HOME%\bin\jar" -xfv ..\jME3-lwjgl-natives.jar
                            @@ -77,22 +16,7 @@ for /D %%i in ("*") do (
                               "%JDK_HOME%\bin\jar" -cfv ..\..\native_%%i%.jar .
                               cd ..
                             )
                            -cd ..
                            - -

                            -Remember to sign all the jar files and move them into the right place from the tmp directory. -

                            - -
                            - -

                            JNLP file

                            -
                            - -

                            - -Add the following to your JNLP file: -

                            -
                              <resources os="Windows">
                            +cd ..

                            Remember to sign all the jar files and move them into the right place from the tmp directory.

                            JNLP file

                            Add the following to your JNLP file:

                              <resources os="Windows">
                                 <j2se version="1.4+"/>
                                 <nativelib href="native_windows.jar"/>
                               </resources>
                            @@ -107,22 +31,9 @@ Add the following to your JNLP file:
                               <resources os="SunOS" arch="x86">
                                 <j2se version="1.4+"/>
                                 <nativelib href="native_solaris.jar"/>
                            -  </resources>
                            - -
                            - -

                            Set low-permissions mode

                            -
                            - -

                            - -In your main() method, if running under WebStart, tell jME3 it is running in a low-permission environment so that it doesn't try to load the natives itself: -

                            -
                              public static void main(String[] args)
                            +  </resources>

                            Set low-permissions mode

                            In your main() method, if running under WebStart, tell jME3 it is running in a low-permission environment so that it doesn't try to load the natives itself:

                              public static void main(String[] args)
                               {
                                   if (System.getProperty("javawebstart.version") != null) {
                                     JmeSystem.setLowPermissions(true);
                            -      }
                            - -
                            + }

                            view online version

                            \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/application_deployment.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/application_deployment.html index ae81d60fa..309545820 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/application_deployment.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/application_deployment.html @@ -1,48 +1,4 @@ - -

                            jMonkeyEngine SDK: Application Deployment

                            -
                            - -

                            - -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 SDK's BaseGame, you have the following deployment options: -

                            -
                              -
                            • Desktop application (.JAR)
                              -
                            • -
                            • WebStart from URL (.JNLP + .JAR)
                              -
                            • -
                            • Applet in web browser (.JNLP + .JAR)
                              -
                            • -
                            • Android mobile device (.APK)
                              -
                            • -
                            - -
                            - -

                            Requirements

                            -
                            - -

                            - -Since JAR files are platform independent, your customers can play your jMonkeyEngine application on Windows, Mac OS, 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 . -

                            - -
                            - -

                            Branding

                            -
                            - -

                            - - -Make your game unique and recognizable: -

                            -
                              -
                            1. Open your game project in the SDK's Projects window.
                              -
                            2. -
                            3. Right-click the project and open the Properties
                              -
                            4. -
                            5. Open the Properties → Application section. Here you configure your branding:
                              +

                              jMonkeyEngine SDK: Application Deployment

                              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 SDK's BaseGame, you have the following deployment options:

                              • Desktop application (.JAR)
                              • WebStart from URL (.JNLP + .JAR)
                              • Applet in web browser (.JNLP + .JAR)
                              • Android mobile device (.APK)

                              Requirements

                              Since JAR files are platform independent, your customers can play your jMonkeyEngine application on Windows, Mac OS, 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 .

                              Branding

                              Make your game unique and recognizable:

                              1. Open your game project in the SDK's Projects window.
                              2. Right-click the project and open the Properties
                              3. Open the Properties → Application section. Here you configure your branding:
                                1. Title: Enter the game's name
                                2. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/asset_packs.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/asset_packs.html index 807adbc5d..869860d9c 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/asset_packs.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/asset_packs.html @@ -1,27 +1,4 @@ - -

                                  jMonkeyEngine SDK AssetPacks

                                  -
                                  - -

                                  -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 assetpack.xml file that describes the content and an assets folder that contains the content. The integrated browser in the jMonkeyEngine SDK allows you to add the assets of installed AssetPacks to any project you are doing. -

                                  - -
                                  - -

                                  The AssetPack Browser

                                  -
                                  - -

                                  - - -

                                  - -

                                  -The AssetPack browser in jMonkeyEngine SDK 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. -

                                  - -

                                  -You can also browse a selection of online assetpacks that are available on jMonkeyEngine.org for download and install them to your jMonkeyEngine SDK's AssetPack browser. +

                                  jMonkeyEngine SDK AssetPacks

                                  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 assetpack.xml file that describes the content and an assets folder that contains the content. The integrated browser in the jMonkeyEngine SDK allows you to add the assets of installed AssetPacks to any project you are doing.

                                  The AssetPack Browser

                                  The AssetPack browser in jMonkeyEngine SDK 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.

                                  You can also browse a selection of online assetpacks that are available on jMonkeyEngine.org for download and install them to your jMonkeyEngine SDK's AssetPack browser.

                                  diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/blender.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/blender.html index ee88167fe..050593bbc 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/blender.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/blender.html @@ -1,44 +1,4 @@ - -

                                  Blender importer for jMonkeyEngine 3

                                  -
                                  - -
                                  - -

                                  Introduction

                                  -
                                  - -

                                  -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. -

                                  - -
                                  - -

                                  Usage

                                  -
                                  - -

                                  -To use it in your game or the SDK 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. -

                                  - -
                                  - -

                                  Currently supported features

                                  -
                                  -
                                    -
                                  1. Loading scene (only the current scene is loaded and imported as a node)
                                    -
                                  2. -
                                  3. Loading mesh objects.
                                    -
                                      -
                                    • Meshes are split into several geometries when they have several materials applied.
                                      -
                                    • -
                                    • All faces are stored as triangles (even if blender uses quads).
                                      -
                                    • -
                                    • The mesh is 'Smooth' aware.
                                      +

                                      Blender importer for jMonkeyEngine 3

                                      Introduction

                                      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.

                                      Usage

                                      To use it in your game or the SDK 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.

                                      Currently supported features

                                      1. Loading scene (only the current scene is loaded and imported as a node)
                                      2. Loading mesh objects.
                                        • Meshes are split into several geometries when they have several materials applied.
                                        • All faces are stored as triangles (even if blender uses quads).
                                        • The mesh is 'Smooth' aware.
                                        • User defined UV coordinates are read.
                                        • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/code_editor.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/code_editor.html index 30521367c..9f0424829 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/code_editor.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/code_editor.html @@ -1,94 +1,4 @@ - -

                                          jMonkeyEngine SDK: Code Editor and Palette

                                          -
                                          - -

                                          - -The Source Code Editor is the central part of the jMonkeyEngine SDK. This documentation shows you how to make the most of the jMonkeyEngine SDK's assistive features. -

                                          - -

                                          -Note: Since the jMonkeyEngine SDK is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine SDK features by reading the corresponding NetBeans IDE tutorials (in the "see also links"). -

                                          - -
                                          - -

                                          Code Completion and Code Generation

                                          -
                                          - -

                                          - -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. -

                                          - -

                                          - -

                                          - -

                                          -Code Completion -

                                          -
                                            -
                                          • Complete keyword / method / variable: Ctrl-Space (Alternatively use Ctrl-\)
                                            -
                                              -
                                            • Customize Code Completion options: Tools > Options > Editor > Code Completion
                                              -
                                            • -
                                            -
                                          • -
                                          • Show expected parameters of this method in a tooltip: Ctrl-P
                                            -
                                          • -
                                          • Complete any string (even non-Java) that has been used before: (Shift-)Ctrl-K
                                            -
                                          • -
                                          - -

                                          - -Code Generation -

                                          -
                                            -
                                          • Auto-fix import statements: Ctrl-Shift-I
                                            -
                                          • -
                                          • Auto-generate getters/setters, try/catch, equals/hashCode: Alt-Insert
                                            -
                                              -
                                            • Customize code completion: Choose Tools > Options > Editor > Code Completion
                                              -
                                            • -
                                            -
                                          • -
                                          • Auto-generate common code snippets such as loops, declarations, println, by typing the template name + TabKey
                                            -
                                              -
                                            • Customize code templates: Choose Tools > Options > Editor > Code Templates
                                              -
                                            • -
                                            -
                                          • -
                                          • Rename, move, or introduce methods, fields, and variables, without breaking the project: Refactoring menu
                                            -
                                          • -
                                          - -
                                          - -

                                          Semantic and Syntactic Coloring

                                          -
                                          - -

                                          - - -

                                          - -

                                          -The text color in the editor gives you important hints how the compiler will interpret what you typed, even before you compiled it. -

                                          - -

                                          -Examples: -

                                          -
                                            -
                                          • Java keywords are blue, variables and fields are green, parameters are orange.
                                            -
                                          • -
                                          • Strikethrough means deprecated method or field.
                                            -
                                          • -
                                          • Gray underline means unused variable or method.
                                            -
                                          • -
                                          • Place the caret in a method or variable and all its ocurrences are marked tan.
                                            +

                                            jMonkeyEngine SDK: Code Editor and Palette

                                            The Source Code Editor is the central part of the jMonkeyEngine SDK. This documentation shows you how to make the most of the jMonkeyEngine SDK's assistive features.

                                            Note: Since the jMonkeyEngine SDK is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine SDK features by reading the corresponding NetBeans IDE tutorials (in the "see also links").

                                            Code Completion and Code Generation

                                            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.

                                            Code Completion

                                            • Complete keyword / method / variable: Ctrl-Space (Alternatively use Ctrl-\)
                                              • Customize Code Completion options: Tools > Options > Editor > Code Completion
                                            • Show expected parameters of this method in a tooltip: Ctrl-P
                                            • Complete any string (even non-Java) that has been used before: (Shift-)Ctrl-K

                                            Code Generation

                                            • Auto-fix import statements: Ctrl-Shift-I
                                            • Auto-generate getters/setters, try/catch, equals/hashCode: Alt-Insert
                                              • Customize code completion: Choose Tools > Options > Editor > Code Completion
                                            • Auto-generate common code snippets such as loops, declarations, println, by typing the template name + TabKey
                                              • Customize code templates: Choose Tools > Options > Editor > Code Templates
                                            • Rename, move, or introduce methods, fields, and variables, without breaking the project: Refactoring menu

                                            Semantic and Syntactic Coloring

                                            The text color in the editor gives you important hints how the compiler will interpret what you typed, even before you compiled it.

                                            Examples:

                                            • Java keywords are blue, variables and fields are green, parameters are orange.
                                            • Strikethrough means deprecated method or field.
                                            • Gray underline means unused variable or method.
                                            • Place the caret in a method or variable and all its ocurrences are marked tan.
                                            • Place the caret in a method's return type to highlight all exit points
                                            • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html index 238d113f1..99d3f579e 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/debugging_profiling_testing.html @@ -1,40 +1,4 @@ - -

                                              jMonkeyEngine SDK: Debugging, Profiling, Testing

                                              -
                                              - -

                                              - -Debugging, testing and profiling are important parts of the development cycle. This documentation shows you how to make the most of the jMonkeyEngine SDK's assistive features. -

                                              - -

                                              -Note: Since the jMonkeyEngine SDK is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine SDK features by reading the corresponding NetBeans IDE tutorials (in the "see also links"). -

                                              - -
                                              - -

                                              Testing

                                              -
                                              - -

                                              - -The jMonkeyEngine SDK supports the JUnit testing framework. It is a good practice to write tests (assertions) for each of your classes. Each test makes certain this "unit" (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. -

                                              - -
                                              - -

                                              Creating Tests

                                              -
                                              -
                                                -
                                              1. Right-click a Java file in the Projects window and choose Tools > Create JUnit Tests.
                                                -
                                              2. -
                                              3. Click OK. The jMonkeyEngine SDK creates a JUnit test skeleton in the Test Package directory.
                                                -
                                              4. -
                                              5. The body of each generated test method is provided solely as a guide. In their place, you need to write your actual test cases!
                                                -
                                              6. -
                                              7. You can use tests such as assertTrue(), assertFalse(), assertEquals(), or assert().
                                                -
                                                  -
                                                • The following example assertions test an addition method: assert( add(1, 1) == 2); assertTrue( add(7,-5) == add(-5,7) )…
                                                  +

                                                  jMonkeyEngine SDK: Debugging, Profiling, Testing

                                                  Debugging, testing and profiling are important parts of the development cycle. This documentation shows you how to make the most of the jMonkeyEngine SDK's assistive features.

                                                  Note: Since the jMonkeyEngine SDK is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine SDK features by reading the corresponding NetBeans IDE tutorials (in the "see also links").

                                                  Testing

                                                  The jMonkeyEngine SDK supports the JUnit testing framework. It is a good practice to write tests (assertions) for each of your classes. Each test makes certain this "unit" (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.

                                                  Creating Tests

                                                  1. Right-click a Java file in the Projects window and choose Tools > Create JUnit Tests.
                                                  2. Click OK. The jMonkeyEngine SDK creates a JUnit test skeleton in the Test Package directory.
                                                  3. The body of each generated test method is provided solely as a guide. In their place, you need to write your actual test cases!
                                                  4. You can use tests such as assertTrue(), assertFalse(), assertEquals(), or assert().
                                                    • The following example assertions test an addition method: assert( add(1, 1) == 2); assertTrue( add(7,-5) == add(-5,7) )…
                                                  5. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development.html index c2aa7a5a6..b4e3b879a 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development.html @@ -1,62 +1,4 @@ - -

                                                    Developing for jMonkeyEngine SDK

                                                    -
                                                    - -

                                                    -Note that all info is subject to change while jMonkeyEngine SDK is still in beta! -

                                                    - -

                                                    -In general, developing plugins for jMonkeyEngine SDK 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 SDK to develop plugins, be it for personal use or to contribute to the community. -

                                                    - -

                                                    -If you feel like you want to make an addition to jMonkeyEngine SDK, don'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.). -

                                                    - -
                                                    - -

                                                    Creating plugins and components

                                                    - - -

                                                    Extending jMonkeyEngine SDK

                                                    - - -

                                                    Recipes

                                                    - - -

                                                    General Notes

                                                    -
                                                    -
                                                      -
                                                    • 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.
                                                      -
                                                    • -
                                                    • 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.
                                                      +

                                                      Developing for jMonkeyEngine SDK

                                                      Note that all info is subject to change while jMonkeyEngine SDK is still in beta!

                                                      In general, developing plugins for jMonkeyEngine SDK 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 SDK to develop plugins, be it for personal use or to contribute to the community.

                                                      If you feel like you want to make an addition to jMonkeyEngine SDK, don'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.).

                                                      Creating plugins and components

                                                      Extending jMonkeyEngine SDK

                                                      Recipes

                                                      General Notes

                                                      • 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.
                                                      • 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.
                                                      • It became a standard in jMonkeyEngine SDK to start the name of methods that execute directly on the OpenGL thread with "do" e.g "doMoveSpatial", this makes identifying threading issues easier.
                                                      • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/model_loader.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/model_loader.html index f54084024..743839f8e 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/model_loader.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/model_loader.html @@ -1,30 +1,2 @@ - -

                                                        Creating a model importer

                                                        -
                                                        -
                                                          -
                                                        1. Create plugin
                                                          -
                                                        2. -
                                                        3. Add importer jar file (wrap jar file)
                                                          -
                                                        4. -
                                                        5. Add filetype (Template)
                                                          -
                                                        6. -
                                                        7. Change DataObject to extend SpatialAssetDataObject
                                                          -
                                                        8. -
                                                        9. Implement loadAsset method in DataObject (if necessary, most model formats should load normally via the loader)
                                                          -
                                                        10. -
                                                        11. Create AssetManagerConfigurator \
                                                          -
                                                        12. -
                                                        - -

                                                        -See also: -

                                                        - - -
                                                        +

                                                        Creating a model importer

                                                        1. Create plugin
                                                        2. Add importer jar file (wrap jar file)
                                                        3. Add filetype (Template)
                                                        4. Change DataObject to extend SpatialAssetDataObject
                                                        5. Implement loadAsset method in DataObject (if necessary, most model formats should load normally via the loader)
                                                        6. Create AssetManagerConfigurator \

                                                        See also:

                                                        view online version

                                                        \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/projects_assets.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/projects_assets.html index db1b4421c..be07a1017 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/projects_assets.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/projects_assets.html @@ -1,45 +1,4 @@ - -

                                                        Projects and Assets

                                                        -
                                                        - -

                                                        -The SDK heavily uses the systems provided by the base platform for the handling of assets and projects and extends the system with jME3 specific features. - -

                                                        - -
                                                        - -

                                                        ProjectAssetManager

                                                        -
                                                        - -

                                                        -All AssetDataObjects and SceneExplorerNodes allow access to the ProjectAssetManager of the project they were loaded from. - -

                                                        -
                                                        ProjectAssetManager pm = node.getLookup().lookup(ProjectAssetManager.class)
                                                        - -

                                                        - -The ProjectAssetManager is basically a normal DesktopAssetManager for each project with some added functionality: -

                                                        -
                                                          -
                                                        • Access to the FileObject of the assets folder of the project to load and save data
                                                          -
                                                        • -
                                                        • Convert absolute file paths to relative asset paths and vice versa
                                                          -
                                                        • -
                                                        • Get lists of all textures, materials etc. in the project
                                                          -
                                                        • -
                                                        • more convenient stuff.. :)
                                                          -
                                                        • -
                                                        - -
                                                        - -

                                                        AssetDataObject

                                                        -
                                                        - -

                                                        -Most "files" that you encounter in the SDK 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: +

                                                        Projects and Assets

                                                        The SDK heavily uses the systems provided by the base platform for the handling of assets and projects and extends the system with jME3 specific features.

                                                        ProjectAssetManager

                                                        All AssetDataObjects and SceneExplorerNodes allow access to the ProjectAssetManager of the project they were loaded from.

                                                        ProjectAssetManager pm = node.getLookup().lookup(ProjectAssetManager.class)

                                                        The ProjectAssetManager is basically a normal DesktopAssetManager for each project with some added functionality:

                                                        • Access to the FileObject of the assets folder of the project to load and save data
                                                        • Convert absolute file paths to relative asset paths and vice versa
                                                        • Get lists of all textures, materials etc. in the project
                                                        • more convenient stuff.. :)

                                                        AssetDataObject

                                                        Most "files" that you encounter in the SDK 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:

                                                        assetDataObject.getLookup().lookup(AssetData.class)
                                                        diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/scene.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/scene.html index 750848c29..949bddaa5 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/scene.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/scene.html @@ -1,42 +1,4 @@ - -

                                                        jMonkeyEngine SDK -- The Scene

                                                        -
                                                        - -

                                                        - -To reduce system overhead the jMonkeyEngine SDK Core supplies one scene/jme3 application that is shared between plugins. Furthermore there's the "SceneExplorer" that shows a visual representation of the scenegraph and its objects properties across plugins. -

                                                        - -
                                                        - -

                                                        How to access the Scene

                                                        -
                                                        - -

                                                        - -There are several ways for your plugin to interact with the Scene: -

                                                        -
                                                          -
                                                        • It listens for selected spatials / objects and offers options for those
                                                          -
                                                        • -
                                                        • It requests the whole scene for itself and loads/arranges the content in it (e.g. a terrain editor or model animation plugin).
                                                          -
                                                        • -
                                                        - -
                                                        - -

                                                        Listening for Node selection

                                                        -
                                                        - -

                                                        - -In the jMonkeyEngine SDK, all objects are wrapped into NetBeans "Nodes" (different thing than jme Nodes!). Such nodes can have properties and icons and can be displayed and selected in the jMonkeyEngine SDK 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 "Spatial" is wrapped by a "JmeSpatial" node, for example. One advantage of these Nodes is that one can manipulate properties of Spatials directly from the AWT thread. -

                                                        - -

                                                        -To listen to the current selection, implement org.openide.util.LookupListener and register like this: -

                                                        -
                                                        private final Result<JmeSpatial> result;
                                                        +

                                                        jMonkeyEngine SDK -- The Scene

                                                        To reduce system overhead the jMonkeyEngine SDK Core supplies one scene/jme3 application that is shared between plugins. Furthermore there's the "SceneExplorer" that shows a visual representation of the scenegraph and its objects properties across plugins.

                                                        How to access the Scene

                                                        There are several ways for your plugin to interact with the Scene:

                                                        • It listens for selected spatials / objects and offers options for those
                                                        • It requests the whole scene for itself and loads/arranges the content in it (e.g. a terrain editor or model animation plugin).

                                                        Listening for Node selection

                                                        In the jMonkeyEngine SDK, all objects are wrapped into NetBeans "Nodes" (different thing than jme Nodes!). Such nodes can have properties and icons and can be displayed and selected in the jMonkeyEngine SDK 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 "Spatial" is wrapped by a "JmeSpatial" node, for example. One advantage of these Nodes is that one can manipulate properties of Spatials directly from the AWT thread.

                                                        To listen to the current selection, implement org.openide.util.LookupListener and register like this:

                                                        private final Result<JmeSpatial> result;
                                                          
                                                         //method to register the listener;
                                                         private void registerListener(){
                                                        @@ -52,12 +14,7 @@ public void resultChanged(LookupEvent ev) {
                                                                 spatial.getPropertySets()[0].setValue("Local Translation", Vector3f.ZERO);
                                                                 return;
                                                             }
                                                        -}
                                                        - -

                                                        -You can also access the "real" spatial but since its part of the scenegraph you will have to modify it on that thread: -

                                                        -
                                                        //retrieve the "real" spatial class from the JmeNode
                                                        +}

                                                        You can also access the "real" spatial but since its part of the scenegraph you will have to modify it on that thread:

                                                        //retrieve the "real" spatial class from the JmeNode
                                                         for (JmeSpatial jmeSpatial : items) {
                                                             //the spatial is stored inside the JmeSpatials "Lookup", a general container for Objects
                                                             final Spatial realSpatial = jmeSpatial.getLookup().lookup(Spatial.class);
                                                        @@ -69,24 +26,7 @@ for (JmeSpatial jmeSpatial : items) {
                                                                 }
                                                             });
                                                             return;
                                                        -}
                                                        - -
                                                        - -

                                                        Requesting the Scene

                                                        -
                                                        - -

                                                        - -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. -

                                                        - -

                                                        -
                                                        - -The SceneRequest object has to contain several things. A thing that you must supply is a jme "Node" wrapped into a "JmeNode" 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. -

                                                        -
                                                        com.jme3.scene.Node rootNode = new com.jme3.scene.Node("MyRootNode");
                                                        +}

                                                        Requesting the Scene

                                                        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.


                                                        The SceneRequest object has to contain several things. A thing that you must supply is a jme "Node" wrapped into a "JmeNode" 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.

                                                        com.jme3.scene.Node rootNode = new com.jme3.scene.Node("MyRootNode");
                                                          
                                                         private void registerSceneListener(){
                                                             SceneApplication.getApplication().addSceneListener(this);
                                                        @@ -113,27 +53,10 @@ public void sceneClosed(SceneRequest request) {
                                                             if (request.getRequester() == this) {
                                                                 //we have to close the scene,  any operations on the scene have to be done via Callables
                                                             }
                                                        -}
                                                        - -
                                                        - -

                                                        Undo/Redo support

                                                        -
                                                        - -

                                                        -The jMonkeyEngine SDK has a global undo/redo queue that activates the undo/redo buttons. To use it in your TopComponent, add the following method: - -

                                                        -
                                                        @Override 
                                                        +}

                                                        Undo/Redo support

                                                        The jMonkeyEngine SDK has a global undo/redo queue that activates the undo/redo buttons. To use it in your TopComponent, add the following method:

                                                        @Override 
                                                         public UndoRedo getUndoRedo() { 
                                                         return Lookup.getDefault().lookup(SceneUndoRedoManager.class); 
                                                        -} 
                                                        - -

                                                        -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: - -

                                                        -
                                                        Lookup.getDefault().lookup(SceneUndoRedoManager.class).addEdit(this, new AbstractUndoableSceneEdit() { 
                                                        +} 

                                                        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:

                                                        Lookup.getDefault().lookup(SceneUndoRedoManager.class).addEdit(this, new AbstractUndoableSceneEdit() { 
                                                          
                                                         @Override 
                                                         public void sceneUndo() { 
                                                        @@ -154,12 +77,5 @@ public void awtUndo() {
                                                         public void awtRedo() { 
                                                             //redo stuff on awt thread here
                                                         } 
                                                        -});
                                                        - -

                                                        -Note: Its important that you use the method addEdit(Object source, UndoableEdit edit); - -

                                                        - -
                                                        +});

                                                        Note: Its important that you use the method addEdit(Object source, UndoableEdit edit);

                                                        view online version

                                                        \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html index bc87cebaf..88ecefd95 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/development/sceneexplorer.html @@ -1,44 +1,4 @@ - -

                                                        The SceneExplorer

                                                        -
                                                        - -
                                                        - -

                                                        Adding Node types to SceneExplorer

                                                        -
                                                        - -

                                                        - -If your plugin brings in its own SceneGraph objects you can still have them work like any other SceneExplorer item, including its special properties. -

                                                        - -

                                                        -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 -

                                                        -
                                                        @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)
                                                        - -

                                                        - 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 "wrapped libraries", otherwise the IDE cannot access those classes. -

                                                        - -

                                                        -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. -

                                                        - -

                                                        -The SceneExplorerNode can be used for Spatial and Control type objects. - -

                                                        -
                                                          -
                                                        • Add the "Nodes API" and "Lookup API" libraries to your project when you want to use this
                                                          -
                                                        • -
                                                        - -
                                                        - -

                                                        Spatial Example

                                                        -
                                                        -
                                                        @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)
                                                        +

                                                        The SceneExplorer

                                                        Adding Node types to SceneExplorer

                                                        If your plugin brings in its own SceneGraph objects you can still have them work like any other SceneExplorer item, including its special properties.

                                                        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

                                                        @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)

                                                        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 "wrapped libraries", otherwise the IDE cannot access those classes.

                                                        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.

                                                        The SceneExplorerNode can be used for Spatial and Control type objects.

                                                        • Add the "Nodes API" and "Lookup API" libraries to your project when you want to use this

                                                        Spatial Example

                                                        @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)
                                                         public class JmeGeometry extends JmeSpatial {
                                                          
                                                             private static Image smallImage =
                                                        @@ -98,13 +58,7 @@ public class JmeGeometry extends JmeSpatial {
                                                                 children.setReadOnly(readOnly);
                                                                 return new org.openide.nodes.Node[]{new JmeGeometry((Geometry) key, children).setReadOnly(readOnly)};
                                                             }
                                                        -}
                                                        - -
                                                        - -

                                                        Control Example

                                                        -
                                                        -
                                                        @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)
                                                        +}

                                                        Control Example

                                                        @org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)
                                                         public class JmeGhostControl extends AbstractSceneExplorerNode {
                                                          
                                                             private static Image smallImage =
                                                        @@ -200,26 +154,7 @@ public class JmeGhostControl extends AbstractSceneExplorerNode {
                                                             public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
                                                                 return new org.openide.nodes.Node[]{new JmeGhostControl((GhostControl) key, key2).setReadOnly(cookie)};
                                                             }
                                                        -}
                                                        - -
                                                        - -

                                                        Adding items to the add and tools menus

                                                        -
                                                        - -

                                                        -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. AbstractNewSpatialWizardAction 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! -

                                                        - -

                                                        -

                                                        Note that the classes you create are singletons which are used across multiple nodes and you should not store any data in local variables! -

                                                        -

                                                        - -

                                                        -To add a new Tool, create a new AbstractToolAction: -

                                                        -
                                                        @org.openide.util.lookup.ServiceProvider(service = ToolAction.class)
                                                        +}

                                                        Adding items to the add and tools menus

                                                        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. AbstractNewSpatialWizardAction 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!

                                                        Note that the classes you create are singletons which are used across multiple nodes and you should not store any data in local variables!

                                                        To add a new Tool, create a new AbstractToolAction:

                                                        @org.openide.util.lookup.ServiceProvider(service = ToolAction.class)
                                                         public class GenerateTangentsTool extends AbstractToolAction {
                                                          
                                                             public GenerateTangentsTool() {
                                                        @@ -249,12 +184,7 @@ public class GenerateTangentsTool extends AbstractToolAction {
                                                                 return JmeGeometry.class;
                                                             }
                                                          
                                                        -}
                                                        - -

                                                        -For a new Spatial or Control, use AbstractNewSpatialAction -

                                                        -
                                                        @org.openide.util.lookup.ServiceProvider(service = NewSpatialAction.class)
                                                        +}

                                                        For a new Spatial or Control, use AbstractNewSpatialAction

                                                        @org.openide.util.lookup.ServiceProvider(service = NewSpatialAction.class)
                                                         public class NewSpecialSpatialAction extends AbstractNewSpatialAction {
                                                          
                                                             public NewSpecialSpatialAction() {
                                                        @@ -266,12 +196,7 @@ public class NewSpecialSpatialAction extends AbstractNewSpatialAction {
                                                                 Spatial spatial=new Node();
                                                                 return spatial;
                                                             }
                                                        -}
                                                        - -

                                                        -or AbstractNewControlAction: -

                                                        -
                                                        @org.openide.util.lookup.ServiceProvider(service = NewControlAction.class)
                                                        +}

                                                        or AbstractNewControlAction:

                                                        @org.openide.util.lookup.ServiceProvider(service = NewControlAction.class)
                                                         public class NewRigidBodyAction extends AbstractNewControlAction {
                                                          
                                                             public NewRigidBodyAction() {
                                                        diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/material_editing.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/material_editing.html
                                                        index a309aede0..516fa9bb6 100644
                                                        --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/material_editing.html
                                                        +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/material_editing.html
                                                        @@ -1,37 +1,4 @@
                                                        -
                                                        -

                                                        The Material Editor

                                                        -
                                                        - -

                                                        - -If you are looking for background information, read about Material Definitions and j3M Material Files. -You can write .j3m files in a text editor, or use the jMonkeyEngine SDK to generate them for you as described in this article. -

                                                        - -
                                                        - -

                                                        Materials

                                                        -
                                                        - -

                                                        - -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. -

                                                        - -
                                                        - -

                                                        Creating .j3m Materials

                                                        -
                                                        - -

                                                        - -

                                                        - -

                                                        -To create new .j3m files in the jMonkeyEngine SDK, -

                                                        -
                                                          -
                                                        1. Right-click the assets/Materials directory and choose New… > Other.
                                                          +

                                                          The Material Editor

                                                          If you are looking for background information, read about Material Definitions and j3M Material Files. You can write .j3m files in a text editor, or use the jMonkeyEngine SDK to generate them for you as described in this article.

                                                          Materials

                                                          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.

                                                          Creating .j3m Materials

                                                          To create new .j3m files in the jMonkeyEngine SDK,

                                                          1. Right-click the assets/Materials directory and choose New… > Other.
                                                          2. In the New File Wizard, choose Material > Empty Material File, and click Next.
                                                          3. diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/project_creation.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/project_creation.html index 0cb829358..f10e2fd19 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/project_creation.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/project_creation.html @@ -1,49 +1,4 @@ - -

                                                            jMonkeyEngine SDK: Creating Projects

                                                            -
                                                            - -

                                                            - -The jMonkeyEngine SDK makes it easy to get started with developing 3-D games based on the jMonkeyEngine. -

                                                            - -
                                                            - -

                                                            Creating a New jMonkeyEngine Project

                                                            -
                                                            -
                                                              -
                                                            1. Choose File > New Project from the main menu.
                                                              -
                                                            2. -
                                                            3. In the New Project Wizard, select the template JME3 > Basic Game
                                                              -
                                                            4. -
                                                            5. Click next to specify a project name, and the path where to store your new project.
                                                              -
                                                            6. -
                                                            7. Click Finish. A skeleton application is created and opens in the Project Explorer.
                                                              -
                                                                -
                                                              • This basic jme3 application is based on the SimpleApplication class to allow an easy start with jme3.
                                                                -
                                                              • -
                                                              • You can click the run button to run it: You will see a jMonkey cube.
                                                                -
                                                              • -
                                                              -
                                                            8. -
                                                            - -
                                                            - -

                                                            Project Structure

                                                            -
                                                            - -

                                                            - - -

                                                            - -

                                                            -Let's have a look at the abstract project structure in the Project Explorer (ctrl-1). - -

                                                            -
                                                              -
                                                            • Project Assets node: 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.
                                                              +

                                                              jMonkeyEngine SDK: Creating Projects

                                                              The jMonkeyEngine SDK makes it easy to get started with developing 3-D games based on the jMonkeyEngine.

                                                              Creating a New jMonkeyEngine Project

                                                              1. Choose File > New Project from the main menu.
                                                              2. In the New Project Wizard, select the template JME3 > Basic Game
                                                              3. Click next to specify a project name, and the path where to store your new project.
                                                              4. Click Finish. A skeleton application is created and opens in the Project Explorer.
                                                                • This basic jme3 application is based on the SimpleApplication class to allow an easy start with jme3.
                                                                • You can click the run button to run it: You will see a jMonkey cube.

                                                              Project Structure

                                                              Let's have a look at the abstract project structure in the Project Explorer (ctrl-1).

                                                              • Project Assets node: 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.
                                                              • Source Packages node: This is where you manage your packages and classes. For a newly created project, it contains one package and one class, Main.java. Double click Main.java to open it in the editor.
                                                              • diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/terrain_editor.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/terrain_editor.html index 279f93859..69ea89928 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/terrain_editor.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/terrain_editor.html @@ -1,36 +1,4 @@ - -

                                                                Overview

                                                                -
                                                                - -

                                                                -The terrain editor lets you create, modify, and paint terrain. - -

                                                                - -
                                                                - -

                                                                Controls

                                                                -
                                                                - -

                                                                -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. -

                                                                - -
                                                                - -

                                                                Creating Terrain

                                                                -
                                                                - -

                                                                -To create terrain, first select a node (probably your root node) in your scene.
                                                                - -
                                                                - -Then click the add terrain button.
                                                                - -
                                                                - -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! +

                                                                Overview

                                                                The terrain editor lets you create, modify, and paint terrain.

                                                                Controls

                                                                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.

                                                                Creating Terrain

                                                                To create terrain, first select a node (probably your root node) in your scene.

                                                                Then click the add terrain button.

                                                                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!

                                                                diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/troubleshooting.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/troubleshooting.html index 5a9a58236..d5be6a591 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/troubleshooting.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/troubleshooting.html @@ -1,31 +1,2 @@ - -

                                                                Troubleshooting jMonkeyEngine3 SDK

                                                                -
                                                                - -
                                                                - -

                                                                Specifying the JDK location

                                                                -
                                                                - -

                                                                -If jMonkeyEngine SDK cannot find a valid JDK although you have it installed you have to specify the location manually. -

                                                                - -

                                                                -To do that edit the file jmonkeyplatform.conf in the etc directory of your jMonkeyEngine SDK installation location. -Mac users have to right-click the application and select "Show package contents" and then navigate to Contents/Resources/jmonkeyplatform. -

                                                                - -
                                                                - -

                                                                Known Issues

                                                                -
                                                                - -

                                                                -For a list of known issues and possible workarounds see the following link: - - -

                                                                - -
                                                                +

                                                                Troubleshooting jMonkeyEngine3 SDK

                                                                Specifying the JDK location

                                                                If jMonkeyEngine SDK cannot find a valid JDK although you have it installed you have to specify the location manually.

                                                                To do that edit the file jmonkeyplatform.conf in the etc directory of your jMonkeyEngine SDK installation location. Mac users have to right-click the application and select "Show package contents" and then navigate to Contents/Resources/jmonkeyplatform.

                                                                Known Issues

                                                                For a list of known issues and possible workarounds see the following link:

                                                                view online version

                                                                \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/version_control.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/version_control.html index 1b5d56d75..7d4611bbb 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/version_control.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/sdk/version_control.html @@ -1,128 +1,4 @@ - -

                                                                jMonkeyEngine SDK: Version Control

                                                                -
                                                                - -

                                                                - -Whether you work in a development team or alone: File versioning is a handy method to keep your code consistent, compare files line-by-line, and even roll back unwanted changes. This documentation shows you how to make the most of the SDK's integrated version control features for Subversion, Mercurial, and CVS. -

                                                                - -

                                                                -Note: Since the jMonkeyEngine SDK is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine SDK features by reading the corresponding NetBeans IDE tutorials (in the "see also links"). -

                                                                - -
                                                                - -

                                                                Version Control Systems

                                                                -
                                                                - -

                                                                - -The jMonkeyEngine SDK supports various Version Control Systems such as Subversion, Mercurial, and CVS. No matter which of them you use, they all share a common user interface. -

                                                                - -

                                                                -You can use file versioning alone or in a team. The advantages are that you can keep track of changes (who did it, when, and why), you can compare versions line-by-line, you can revert changes to files and lines, merge multiple changes to one file, and you can even undelete files. -

                                                                - -
                                                                - -

                                                                Creating a Repository (Upload)

                                                                -
                                                                - -

                                                                - -Requirements: -

                                                                -
                                                                  -
                                                                • You must have a project that you want to version.
                                                                  -
                                                                • -
                                                                • You must have version control software installed (Subversion, Mercurial, or CVS) and have initialized a repository.
                                                                  -
                                                                    -
                                                                  • Tip: For Subversion, the init command looks like this example: svnadmin create /home/joe/mysvnrepo
                                                                    -
                                                                  • -
                                                                  -
                                                                • -
                                                                • The computer where the repository is to be hosted must be available in your network, or you will only be able to use your repo locally.
                                                                  -
                                                                    -
                                                                  • Tip: Hosts such as SourceForge, GoogleCode, dev.java.net offer free version control services for open-source projects.
                                                                    -
                                                                  • -
                                                                  -
                                                                • -
                                                                - -

                                                                - -Now you create a repository to store your project's files. - -

                                                                -
                                                                  -
                                                                1. In the jMonkeyEngine SDK, right-click the project in the Projects window and choose Versioning > Import Into CVS/Subversion Repository (or initialize Mercurial Project, respectively).
                                                                  -
                                                                    -
                                                                  • Tip: If you haven't evaluated yet which system to choose, start with Subversion for now.
                                                                    -
                                                                  • -
                                                                  -
                                                                2. -
                                                                3. Go through the wizard and fill in the fields to set up the repository.
                                                                  -
                                                                4. -
                                                                - -
                                                                - -

                                                                Checking Out a Repository (Download)

                                                                -
                                                                - -

                                                                - -You and your team mates check out (download) the repository to their individual workstations. - -

                                                                -
                                                                  -
                                                                1. Go to the Team menu and choose Subversion > Checkout (or CVS/Mercurial>Checkout respectively)
                                                                  -
                                                                2. -
                                                                3. Fill in your repo data into the wizard and click Finish.
                                                                  -
                                                                    -
                                                                  • A typical repository URL looks like this example:
                                                                    -
                                                                  • -
                                                                  • If you want to be able to submit changes, you must have a username and password to this repository. Otherwise leave these fields blank.
                                                                    -
                                                                  • -
                                                                  -
                                                                4. -
                                                                5. The repository is downloaded and stored in the location you chose.
                                                                  -
                                                                6. -
                                                                7. Use the File > Open Project menu to open the checkout as project and start working.
                                                                  -
                                                                    -
                                                                  • If the checkout is not recognized you need to choose File > New Project from Existing Sources
                                                                    -
                                                                  • -
                                                                  -
                                                                8. -
                                                                - -

                                                                - -
                                                                - -Of course you can also check out existing repositories and access code from other open-source projects (e.g. SourceForge, GoogleCode, dev.java.net). -

                                                                - -
                                                                - -

                                                                Updating and Committing Changes (Send and Receive)

                                                                -
                                                                - -

                                                                - -Receiving the latest changes from the team's repository is referred to as updating. Sending your changes to the team's repository is refered to as commiting. - -

                                                                -
                                                                  -
                                                                1. Before making changes, right-click the project and select Subversion > Update to make sure you have the latest revision.
                                                                  -
                                                                    -
                                                                  • Get in the habit of updating regularly, always before you edit a version controlled file. It will spare you much grief.
                                                                    -
                                                                  • -
                                                                  -
                                                                2. -
                                                                3. After making changes to the project, make certain your change did not break anything.
                                                                  +

                                                                  jMonkeyEngine SDK: Version Control

                                                                  Whether you work in a development team or alone: File versioning is a handy method to keep your code consistent, compare files line-by-line, and even roll back unwanted changes. This documentation shows you how to make the most of the SDK's integrated version control features for Subversion, Mercurial, and CVS.

                                                                  Note: Since the jMonkeyEngine SDK is based on the NetBeans Platform framework, you can learn about certain jMonkeyEngine SDK features by reading the corresponding NetBeans IDE tutorials (in the "see also links").

                                                                  Version Control Systems

                                                                  The jMonkeyEngine SDK supports various Version Control Systems such as Subversion, Mercurial, and CVS. No matter which of them you use, they all share a common user interface.

                                                                  You can use file versioning alone or in a team. The advantages are that you can keep track of changes (who did it, when, and why), you can compare versions line-by-line, you can revert changes to files and lines, merge multiple changes to one file, and you can even undelete files.

                                                                  Creating a Repository (Upload)

                                                                  Requirements:

                                                                  • You must have a project that you want to version.
                                                                  • You must have version control software installed (Subversion, Mercurial, or CVS) and have initialized a repository.
                                                                    • Tip: For Subversion, the init command looks like this example: svnadmin create /home/joe/mysvnrepo
                                                                  • The computer where the repository is to be hosted must be available in your network, or you will only be able to use your repo locally.
                                                                    • Tip: Hosts such as SourceForge, GoogleCode, dev.java.net offer free version control services for open-source projects.

                                                                  Now you create a repository to store your project's files.

                                                                  1. In the jMonkeyEngine SDK, right-click the project in the Projects window and choose Versioning > Import Into CVS/Subversion Repository (or initialize Mercurial Project, respectively).
                                                                    • Tip: If you haven't evaluated yet which system to choose, start with Subversion for now.
                                                                  2. Go through the wizard and fill in the fields to set up the repository.

                                                                  Checking Out a Repository (Download)

                                                                  You and your team mates check out (download) the repository to their individual workstations.

                                                                  1. Go to the Team menu and choose Subversion > Checkout (or CVS/Mercurial>Checkout respectively)
                                                                  2. Fill in your repo data into the wizard and click Finish.
                                                                    • A typical repository URL looks like this example:
                                                                    • If you want to be able to submit changes, you must have a username and password to this repository. Otherwise leave these fields blank.
                                                                  3. The repository is downloaded and stored in the location you chose.
                                                                  4. Use the File > Open Project menu to open the checkout as project and start working.
                                                                    • If the checkout is not recognized you need to choose File > New Project from Existing Sources


                                                                  Of course you can also check out existing repositories and access code from other open-source projects (e.g. SourceForge, GoogleCode, dev.java.net).

                                                                  Updating and Committing Changes (Send and Receive)

                                                                  Receiving the latest changes from the team's repository is referred to as updating. Sending your changes to the team's repository is refered to as commiting.

                                                                  1. Before making changes, right-click the project and select Subversion > Update to make sure you have the latest revision.
                                                                    • Get in the habit of updating regularly, always before you edit a version controlled file. It will spare you much grief.
                                                                  2. After making changes to the project, make certain your change did not break anything.
                                                                    1. Update, build, run, test.
                            Spatial
                            Purpose:A Spatial is an abstract data structure that stores transformations (translation, rotation, scale).
                            Geometry Node