From eca1fae8bcb7c4f82be97e87b8e51c784eb14dbe Mon Sep 17 00:00:00 2001
From: "nor..67"
Date: Fri, 18 May 2012 11:38:30 +0000
Subject: [PATCH] SDK - update manual from wiki
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9388 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
---
.../com/jme3/gde/core/docs/core-toc.xml | 3 +-
.../core/docs/jme3/advanced/animation.html | 77 ++-
.../jme3/advanced/application_states.html | 246 ++++++---
.../docs/jme3/advanced/asset_manager.html | 137 +++--
.../gde/core/docs/jme3/advanced/audio.html | 12 +-
.../docs/jme3/advanced/bloom_and_glow.html | 9 +-
.../gde/core/docs/jme3/advanced/camera.html | 8 +-
.../capture_audio_video_to_a_file.html | 16 +-
.../docs/jme3/advanced/custom_controls.html | 287 ++++++----
.../docs/jme3/advanced/custom_meshes.html | 7 +-
.../docs/jme3/advanced/effects_overview.html | 8 +-
.../docs/jme3/advanced/input_handling.html | 27 +-
.../jme3/advanced/j3m_material_files.html | 19 +-
.../docs/jme3/advanced/light_and_shadow.html | 32 +-
.../making_the_camera_follow_a_character.html | 14 +-
.../jme3/advanced/material_definitions.html | 109 +++-
.../jme3/advanced/materials_overview.html | 240 ++++-----
.../core/docs/jme3/advanced/monkey_zone.html | 9 +
.../docs/jme3/advanced/mouse_picking.html | 2 +-
.../docs/jme3/advanced/multithreading.html | 29 +-
.../core/docs/jme3/advanced/nifty_gui.html | 124 ++---
.../advanced/nifty_gui_java_interaction.html | 4 +-
.../jme3/advanced/nifty_gui_java_layout.html | 4 +-
.../docs/jme3/advanced/nifty_gui_overlay.html | 2 +
.../jme3/advanced/nifty_gui_popup_menu.html | 6 +-
.../jme3/advanced/nifty_gui_projection.html | 2 +
.../jme3/advanced/nifty_gui_scenarios.html | 36 +-
.../jme3/advanced/nifty_gui_xml_layout.html | 2 +
.../docs/jme3/advanced/particle_emitters.html | 5 +-
.../gde/core/docs/jme3/advanced/physics.html | 497 +++++++++++-------
.../docs/jme3/advanced/physics_listeners.html | 125 ++++-
.../jme3/advanced/post-processor_water.html | 16 +-
.../remote-controlling_the_camera.html | 5 +
.../docs/jme3/advanced/save_and_load.html | 111 +++-
.../gde/core/docs/jme3/advanced/shape.html | 24 +-
.../gde/core/docs/jme3/advanced/spatial.html | 4 +-
.../gde/core/docs/jme3/advanced/terrain.html | 47 +-
.../docs/jme3/advanced/walking_character.html | 127 ++++-
.../com/jme3/gde/core/docs/jme3/android.html | 11 +
.../docs/jme3/beginner/hello_animation.html | 9 +-
.../core/docs/jme3/beginner/hello_asset.html | 8 +-
.../core/docs/jme3/beginner/hello_audio.html | 4 +-
.../docs/jme3/beginner/hello_collision.html | 10 +-
.../docs/jme3/beginner/hello_effects.html | 6 +-
.../jme3/beginner/hello_input_system.html | 41 +-
.../jme3/beginner/hello_main_event_loop.html | 2 +-
.../docs/jme3/beginner/hello_material.html | 12 +-
.../core/docs/jme3/beginner/hello_node.html | 16 +-
.../docs/jme3/beginner/hello_physics.html | 2 +-
.../docs/jme3/beginner/hello_picking.html | 5 +-
.../beginner/hello_simpleapplication.html | 4 +-
.../docs/jme3/beginner/hello_terrain.html | 10 +-
.../core/docs/jme3/build_from_sources.html | 10 +
.../build_jme3_sources_with_netbeans.html | 39 +-
.../com/jme3/gde/core/docs/jme3/faq.html | 97 +++-
.../jme3/intermediate/best_practices.html | 485 +++++++----------
.../jme3/intermediate/headlessserver.html | 108 ++--
.../intermediate/how_to_use_materials.html | 368 +++++++++++++
.../gde/core/docs/jme3/intermediate/math.html | 15 +-
.../intermediate/optimization.html | 384 ++++++++++++++
.../jme3/intermediate/simpleapplication.html | 61 ++-
...impleapplication_from_the_commandline.html | 6 +-
.../jme3/gde/core/docs/jme3/terminology.html | 342 +++++++-----
.../core/docs/sdk/application_deployment.html | 14 +
.../jme3/gde/core/docs/sdk/asset_packs.html | 17 +-
.../com/jme3/gde/core/docs/sdk/blender.html | 62 ++-
.../jme3/gde/core/docs/sdk/code_editor.html | 7 +-
.../docs/sdk/debugging_profiling_testing.html | 14 +-
.../core/docs/sdk/default_build_script.html | 8 +-
.../jme3/gde/core/docs/sdk/development.html | 5 +
.../docs/sdk/development/model_loader.html | 18 +-
.../gde/core/docs/sdk/development/setup.html | 6 +
.../com/jme3/gde/core/docs/sdk/filters.html | 11 +-
.../com/jme3/gde/core/docs/sdk/log_files.html | 7 +-
.../gde/core/docs/sdk/material_editing.html | 31 +-
.../docs/sdk/model_loader_and_viewer.html | 12 +-
.../gde/core/docs/sdk/project_creation.html | 6 +
.../gde/core/docs/sdk/scene_composer.html | 11 +-
.../gde/core/docs/sdk/scene_explorer.html | 7 +
.../gde/core/docs/sdk/terrain_editor.html | 10 +-
.../gde/core/docs/sdk/troubleshooting.html | 95 +++-
.../jme3/gde/core/docs/sdk/use_own_jme.html | 6 +
.../gde/core/docs/sdk/vehicle_creator.html | 36 +-
.../gde/core/docs/sdk/version_control.html | 10 +-
.../com/jme3/gde/core/docs/wiki-map.xml | 2 +-
85 files changed, 3355 insertions(+), 1527 deletions(-)
create mode 100644 sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/how_to_use_materials.html
create mode 100644 sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/intermediate/multi-media_asset_pipelinejme3/intermediate/optimization.html
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/core-toc.xml b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/core-toc.xml
index 299b17f1e..5c73699c5 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/core-toc.xml
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/core-toc.xml
@@ -76,7 +76,8 @@
-
+
+
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..a6481360c 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
@@ -4,16 +4,26 @@
-In 3D games, you do not only load static 3D models, you also want to be able to trigger animations in the model from the Java code. Animated models must be created in an external mesh editor (for example, Blender).
+In 3D games, you do not only load static 3D models, you also want to be able to trigger animations in the model from the Java code.
+
+
+
+
+
+
+
+
+
+JME3 only loads and plays animated models, it does not create them.
-What is required for the model?
+What is required for an animated model? (See also: Animation terminology )
- For each model, you have to define a skeleton (bones rigging).
+ For each model, you have to segment the model into a skeleton (bone rigging).
- For each motion, you have to specify how it distorts the model (skinning).
+ For each motion, you have to specify how the animation distorts parts of the model (skinning).
For each animation, you have to specify a series of snapshots of how the bones are positioned (keyframes).
@@ -23,16 +33,31 @@ What is required for the model?
-More information: Animation
-
-
-
-What is required in your java class?
+Unless you download free models, or buy them from a 3D artist, you must create your animated models in an external mesh editor (for example, Blender) yourself.
- 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.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+What is required in your JME3-based Java class?
+
+
+ One Animation Control per animated model
+
+ As many Animation Channels per Control as you need to play your animations. In simple cases one channel is enough, sometimes you need two or more Channels per model to play gestures and motions in parallel.
@@ -62,26 +87,26 @@ What is required in your java class?
-
+
-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.
+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 Controls. The control object gives you access to the available animation sequences in the model.
-
AnimControl playerControl; // you need one controller per model
+ AnimControl playerControl; // you need one Control 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
-
+
-A controller has several animation channels (com.jme3.animation.AnimChannel). Each channel can play one animation sequence at a time.
+An Animation Control has several Animation Channels (com.jme3.animation.AnimChannel). Each channel can play one animation sequence at a time.
@@ -92,7 +117,7 @@ There often are situations where you want to run several animation sequences at
...
-To reset a controller, call control.clearChannels();
+To reset a Control, call control.clearChannels();
@@ -127,7 +152,7 @@ removeListener(animEventListener)
clearListeners() Adds or removes listeners to receive animation related events.
-
+
AnimControl Property Usage
@@ -148,7 +173,7 @@ removeAnim(boneAnim)Adds or removes an animation from this Control. getAnimationLength("anim")Returns the length of the given named animation in seconds
-
+
AnimControl Property Usage
@@ -162,7 +187,7 @@ removeAnim(boneAnim)Adds or removes an animation from this Control. getAttachmentsNode("bone")Returns the attachment node of a bone. Attach models and effects to this node to make them follow this bone's motions.
-
+
@@ -193,7 +218,7 @@ The following properties are set per AnimChannel.
setTime(1.3f); Fast-forward or rewind to a certain moment in time of this animation.
-
+
The following information is available for a channel.
@@ -219,7 +244,7 @@ The following information is available for a channel.
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).
@@ -245,7 +270,7 @@ addToRootBone(bone1)
Add a series of bones to be influenced by this ani
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.
-
+
@@ -265,7 +290,7 @@ Animations are played by channel. Note: Whether the animation c
The float value specifies the time how long the animation should overlap with the previous one on this channel. If set to 0f, then no blending will occur and the new animation will be applied instantly.
-
+
Tip: Use the AnimEventLister below to react at the end or start of an animation cycle.
@@ -328,7 +353,7 @@ The onAnimCycleDone() event is invoked when an animation cycle has ended. For no
You have access to the following objects:
- The controller to which the listener is assigned.
+ The Control to which the listener is assigned.
The animation channel being played.
@@ -357,7 +382,7 @@ The onAnimChange() event is invoked every time before an animation is set by the
You have access to the following objects
- The controller to which the listener is assigned.
+ The Control to which the listener is assigned.
The animation channel being played.
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/application_states.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/application_states.html
index 5b6d37559..49666076d 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/application_states.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/application_states.html
@@ -3,56 +3,91 @@
-com.jme3.app.state.AppState is a customizable jME3 interface that allows you to control the global game logic (game mechanics). To control the behaviour of a type of Spatial, see Custom Controls instead – both can be used together.
+
+The com.jme3.app.state.AppState class is a customizable jME3 interface that allows you to control the global game logic – the overall game mechanics. (To control the behaviour of a Spatial, see Custom Controls instead. Controls and AppStates can be used together.)
-
+
+
+
+
+
+
-There will be situations during your game development where you think:
+There are situations during your game development where you think:
- Can I group a set of input handler settings, and activate and deactivate them all in one step? (e.g. mouse and key inputs are handled different in-game versus in the main menu.)
+ Mouse and key inputs are handled differently in-game versus in the main menu. Can I group a set of input handler settings, and activate and deactivate them all in one step?
- Can I group a bunch of nodes and swap them in and out in one step? (e.g. the in-game scene, versus a character editor, versus a Captain's Quarters screen)
+ I have the in-game scene, and a character editor, and a Captain's Quarters screen. Can I group a set of nodes and behaviours, and swap them in and out in one step?
- Can I define what happens while the game is paused/unpaused, and toggle that in one step?
+ When I pause the game, I want the character's "idle" animation to continue, but all other loops and game events should stop. How do I define what happens when the game is paused/unpaused?
- Can I wrap up one set of game mechanics and switch it on and off in one step? (e.g. a conditional block that takes up a lot of space in my update loop)
+ I have a conditional block that takes up a lot of space in my simpleUpdate() loop. Can I wrap up this block of code, and switch it on and off in one step?
- Can I package all of the above that belongs in-game , and also everthing that belongs to the main menu, and switch between these two "big" states in one step?
+ Can I package everything that belongs in-game, and everything that belongs to the menu screen, and switch between these two "big states" in one step?
-Yes you can! This is what AppStates are there for. A game state can be a subset of class fields (game data), GUI elements and their interactions, a subset of input handlers, a subset of nodes in the simpleInitApp() method, a subset of actions that you branch to in the simpleUpdate() loop, a set of AppStates and Controls – or combinations thereof.
-
-
-
-Each AppState is such a grouped subset of such game states. Each AppState has hooks that let you define what happens to this set in the following situations:
+You can! This is what AppStates are there for. An AppState class is subset of (or an extension to) your application. Every AppState class has access to all fields in your main application (AssetManager, ViewPort, StateManager, InputManager, RootNode, GuiNode, etc) and hooks into the main update loop. An AppState can contain:
- the AppState is initialized: You load and initialize game data, InputHandlers, AppStates and Controls and attach nodes.
+ a subset of class fields, functions, methods (game state data and accessors),
- the AppState is cleaned up: You save the game state, unregister Controls, AppStates and InputHandlers, and detach nodes.
+ a subset of
GUI elements and their listeners,
- the AppState is temporarly disabled/enabled (paused/unpaused): You toggle a boolean to skip certain actions of the update loop, you display a paused screen
GUI , and change the input handlers.
+ a subset of input handlers and mappings,
+
+ a subset of nodes that you load and attach to the rootNode,
+
+ a subset of conditional actions that you branch to in the simpleUpdate() loop,
+
+ a subset of other AppStates and Controls
+
+ … or combinations thereof.
+
+
+
+
+
+
+
+
+
+
+Each AppState lets you define what happens in the following situations:
+
+
+ The AppState is initialized: You load and initialize game data, InputHandlers, AppStates and Controls and attach nodes.
+The AppState has its own simpleInitApp() method, so to speak.
+
+ The AppState has been enabled (unpaused): This toggles a boolean isEnabled() to true. Here you attach nodes and listeners that should become active while it's running.
+
+ While the AppState is running/paused: You can poll isEnabled() to define paused and unpaused game behaviour in the update() loop that. Polls and modify the game state, modify the scene graph, and triggers events. If !isEnabled(), write code that skips the running sections of this AppState's update() loop.
+Each AppState has its own update loop, which hooks into the main simpleUpdate() loop (callback).
+
+ The AppState has been disabled (paused): This toggles a boolean isEnabled() to false. Switch to your specific "paused" state.
+
+ The AppState is cleaned up: Here you decide whether to save this AppState's game state, unregister Controls and InputHandlers, detach related AppStates, and detach nodes from the rootNode.
-Tip: You can create AppStates that enable and disable sets of other AppStates, e.g. InGameState versus MainScreenState.
+
Tip: AppStates are extremely handy to swap out, or pause/unpause whole sets of other AppStates. For example, an InGameState (loads in-game
GUI , activates click-to-shoot input mappings, inits game content, starts game loop) versus MainScreenState (stops game loop, saves and detaches game content, switches to menu screen
GUI , switches to click-to-select input mappings).
+
-
+
@@ -60,7 +95,9 @@ Each AppState is such a grouped subset of such game states. Each AppState has ho
To implement game logic:
- You define a custom AppState and implement its behaviour in the AppState's update() method.
+ Create one AbstractAppState instance for each set of game mechanics.
+
+ Implement game behaviour in the AppState's update() method.
- Attach all AppStates to your application's AppStateManager (stateManager.attach(myAppState);), and activate and deactivate the ones you need.
+ Attach the AppState to the AppStateManager (stateManager.attach(myAppState);).
- Create one AppState for each set of game mechanics.
+ Activate and deactivate (unpause and pause) the AppStates that you need.
-When you add several AppStates to one Application and activate them, their init methods and update loops are executed in the order in which the AppStates were added.
+When you add several AppStates to one Application and activate them, their initialize() methods and update() loops are executed in the order in which the AppStates were added to the AppStateManager.
-
+
@@ -89,7 +126,7 @@ When you add several AppStates to one Application and activate them, their init
JME3 comes with a BulletAppState that implements Physical behaviour (using the jBullet library). You, for example, could write an Artificial Intelligence AppState to control all your enemy units. Existing examples in the code base include:
- controls physical behaviour in PhysicsControl'ed Spatials.
+ controls physical behaviour in PhysicsControl'ed Spatials.
an example of a custom AppState
@@ -106,7 +143,7 @@ JME3 comes with a BulletAppState that implements Physical behaviour (using the j
-The AppState interface allows you to initialize sets of objects, and hook a sets of continously executing code into the main loop.
+The AppState interface lets you initialize sets of objects, and hook a set of continously executing code into the main loop.
@@ -114,36 +151,38 @@ The AppState interface allows you to initialize sets of objects, and hook a sets
AppState Method Usage
- stateAttached(asm)
-stateDetached(asm) The AppState knows when it is attached to, or detached from, the AppStateManager, and triggers these two methods. Here you implement what happens then.
+ initialize(asm,app) When this AppState is added to the game, the RenderThread initializes the AppState and then calls this method. You can modify the scene graph from here (e.g. attach nodes). To get access to the main app, call: super.initialize(stateManager, app);
+this.app = (SimpleApplication) app;
+
- initialize(asm,app) The RenderThread initialized the AppState and then calls this method. Here you implement initSimpleApp()-style initialization code.
+ cleanup() This methid is executed after you remove the AppState from the game. Here you implement clean-up code for when this state is detached. You can modify the scene graph from here (e.g. detach nodes).
- isInitialized() Your implementations of this interface should return the correct respective boolean value.
+ update(float tpf) Here you implement the behaviour that you want to hook into the simpleUpdate() loop while this state is attached to the game. You can modify the scene graph from here.
+
+
+ isInitialized() Your implementations of this interface should return the correct respective boolean value. (See AbstractAppState)
setActive(true)
-setActive(false) Temporarily enables or disables an AppState.
+setActive(false)Temporarily enables or disables an AppState. (See AbstractAppState)
- isActive() Test whether AppState is enabled or disabled. Your implementation should consider the boolean.
+ isActive() Test whether AppState is enabled or disabled. Your implementation should consider the boolean. (See AbstractAppState)
- update(float tpf) Here you implement the behaviour that you want to hook into the simpleUpdate() loop.
+ stateAttached(asm)
+stateDetached(asm) The AppState knows when it is attached to, or detached from, the AppStateManager, and triggers these two methods. Don't modify the scene graph from here! (Typically not used.)
- cleanup() Called when when the AppState is de-initialized. Here you implement what clean-up code for this state.
+ render(RenderManager rm) Renders the state, plus your optional customizations. (Typically not used.)
- render(RenderManager rm) Renders the state, plus your optional customizations.
-
-
- postRender() Called after all rendering commands are flushed, including your optional customizations.
+ postRender() Called after all rendering commands are flushed, including your optional customizations. (Typically not used.)
-
+
@@ -151,55 +190,101 @@ setActive(false)Temporarily enables or disables an AppState.
-The AbstractAppState class already implements some common methods and makes creation of custom AppStates a bit easier: isInitialized(), setActive(), isActive(), cleanUp(). Just extend it and override the remaining AppState methods.
+The AbstractAppState class already implements some common methods (isInitialized(), setActive(), isActive()) and makes creation of custom AppStates a bit easier. We recommend you extend AbstractAppState and override the remaining AppState methods: initialize(), setEnabled(), cleanUp().
+
+
+
Definition:
public class MyAppState extends AbstractAppState {
- private Node x = new Node("x"); // some class field
+
private SimpleApplication app;
- public Node getX(){
- return x; // implement custom methods for this field
- }
-
- @Override
- public void update(float tpf) {
- x.doSomething(); // call some methods here
- }
+ private Node x = new Node("x"); // some custom class fields...
+ public Node getX(){ return x; } // some custom methods...
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
- this.app=(SimpleApplication)app;
- app.doSomething(); // call some methods elsewhere
+ this.app = (SimpleApplication)app; // cast to a more specific class
+
+ // init stuff that is independent of whether state is PAUSED or RUNNING
+ this.app.getRootNode().attachChild(getX()); // modify scene graph...
+ this.app.doSomething(); // call custom methods...
+ }
+
+ @Override
+ public void cleanup() {
+ super.cleanup();
+ // unregister all my listeners, detach all my nodes, etc...
+ this.app.getRootNode().detachChild(getX()); // modify scene graph...
+ this.app.doSomethingElse(); // call custom methods...
}
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ // Pause and unpause
+ super.setEnabled(enabled);
+ if(enabled){
+ // init stuff that is in use while this state is RUNNING
+ this.app.getRootNode().attachChild(getX()); // modify scene graph...
+ this.app.doSomethingElse(); // call custom methods...
+ } else {
+ // take away everything not needed while this state is PAUSED
+ ...
+ }
+ }
+
+ @Override
+ public void update(float tpf) {
+ if(isEnabled()){
+ // do the following while game is RUNNING
+ this.app.getRootNode().getChild("blah").scale(tpf); // modify scene graph...
+ x.setUserData(...); // call some methods...
+ } else {
+ // do the following while game is PAUSED, e.g. play an idle animation.
+ ...
+ }
+ }
+
}
+
+
+
+
+
+You define what an AppState does when Paused or Unpaused, in the setEnabled() and update() methods. Call myState.setEnabled(false) on all states that you want to pause. Call myState.setEnabled(true) on all states that you want to unpause.
+
+
+
+
-The com.jme3.app.state.AppStateManager holds the list of AppStates for an application. AppStateManager ensures that active AppStates are updated and rendered. When an AppState is attached, AppStateManager calls its stateAttached() method. When an AppState is detached, AppStateManager calls its stateDetached() method.
-There is one AppStateManager per application. You can attach several AppStates to one AppStateManager, but the same state can only be attached once.
+
+The com.jme3.app.state.AppStateManager holds the list of AppStates for an application. AppStateManager ensures that activate AppStates can modify the scene graph, and that the update() loops of active AppStates is executed. There is one AppStateManager per application. You typically attach several AppStates to one AppStateManager, but the same state can only be attached once.
+
AppStateManager Method Usage
- hasState(s) Is AppState s attached?
+ hasState(myState) Is AppState object 'myState' attached?
- getState(Class<T> stateClass) Returns the first state that is an instance of a subclass of the specified class.
+ getState(MyAppState.class) Returns the first attached state that is an instance of a subclass of MyAppState.class.
-
+
-The AppStateManager's update(), render(), postRender(), and cleanUp() methods are internal, users never call them directly.
+The AppStateManager's render(), postRender(), cleanUp() methods are internal, ignore them, users never call them directly.
@@ -207,32 +292,49 @@ The AppStateManager's update(), render(), postRender(), and cleanUp() metho
-
-You can only change AppStates, or read and write to them, from certain places: In a Control's update() method, in an AppState's update() method, and in the SimpleApplication's simpleUpdate() loop (or the Application's update() loop).
-To get data from the AppState MyAppState:
+
-
-app.getState(MyAppState.class).getInfoAboutSomething();
+
+
-To pass new data into the AppState MyAppState:
+You can only access other AppStates (read from and write to them) from certain places: From a Control's update() method, from an AppState's update() method, and from the SimpleApplication's simpleUpdate() loop. Don't mess with the AppState from other places, because from other methods you have no control over the order of modifications; the game can go out of sync because you can't know when (during which half-finished step of another state change) your modification will be performed.
+
+
+
+You can use custom accessors to get data from AppStates, to set data in AppStates, or to trigger methods in AppStates.
-
app.getState(MyAppState.class).setSomething(blah);
+
this.app.getStateManager().getState(MyAppState.class).doSomeCustomStuffInThisState();
+
+
+
+
+
-To trigger a one-off method in the AppState MyAppState:
-
-
-
app.getState(MyAppState.class).doSomeMoreStuff();
-
-
-
-Don't mess with the AppState from other places, because from other methods you have no control over the order of updates. You don't know when (during which half-finished step of an update), your call was received.
-
+To access class fields of the application the way you are used to, initialize them to local variables:
+
private SimpleApplication app;
+private Node rootNode;
+private AssetManager assetManager;
+private AppStateManager stateManager;
+private InputManager inputManager;
+private ViewPort viewPort;
+private BulletAppState bullet;
+
+public void initialize(AppStateManager stateManager, Application app) {
+ super.initialize(stateManager, app);
+ this.app = (SimpleApplication) app; // can cast Application to something more specific
+ this.rootNode = this.app.getRootNode();
+ this.assetManager = this.app.getAssetManager();
+ this.stateManager = this.app.getStateManager();
+ this.inputManager = this.app.getInputManager();
+ this.viewPort = this.app.getViewPort();
+ this.bullet = this.stateManager.getState(BulletAppState.class);
+}
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 b5d5cadad..e582301d3 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
@@ -7,31 +7,54 @@
JME3 has an integrated an asset manager that helps you keep your project assets organized. By assets we mean media files, such as 3D models, materials, textures, scenes, shaders, sounds, and fonts. Think of the asset manager as the filesystem of your game, independent of the actual deployment platform. It also manages the appropriate managing of OpenGL objects like textures so that they are e.g. not uploaded to the graphics card multiple times when multiple models use them.
+
+
+
+
+
jMonkeyProjects/MyGame/assets/ # You store assets in subfolders here! <------
+jMonkeyProjects/MyGame/build/ # SDK generates built classes here (*)
+jMonkeyProjects/MyGame/build.xml # You customize Ant build script here
+jMonkeyProjects/MyGame/nbproject/ # SDK stores default build.xml and meta data (*)
+jMonkeyProjects/MyGame/dist/ # SDK generates executable distribution here (*)
+jMonkeyProjects/MyGame/src/ # You store Java sources here
+jMonkeyProjects/MyGame/test/ # You store test classes here (optional)
+(*) Managed by jMonkeyEngine SDK -- don't edit!
+
+See also Best Practices .
+
+
+
+
+
+
+
+
+
The assetManager object is an com.jme3.asset.AssetManager instance that every com.jme3.app.Application can access. It maintains a root that also includes your project's classpath by default, so you can load any asset that's on the classpath, that is, the top level of your project directory.
-You can use the inherited assetManager object directly, or use the accessor getAssetManager().
+You can use the inherited assetManager object directly, or use the accessor app.getAssetManager().
-Here is an example how you load assets using the AssetManager. This lines loads a default Material from the Common directory:
+Here is an example how you load assets using the AssetManager. This lines loads a default Material from the built-in Common/ directory:
Material mat = (Material) assetManager.loadAsset(
new AssetKey("Common/Materials/RedColor.j3m"));
-The Material is "somewhere" in the jME3 JAR, but the default Asset Manager is configured to handle a Common/… path correctly, so you don't have to specify the whole path.
+This Material is "somewhere" in the jME3 JAR; the default Asset Manager is configured to handle a Common/… path correctly, so you don't have to specify the whole path when referring to built-in assets (such as default Materials).
-Additionally, You can configure the Asset Manager and add any path to its root. This means, you can load assets from any project directory you specify.
+Additionally, you can configure the Asset Manager and add any path to its root. This means, you can load assets from any project directory you specify. The next example shows how you load assets from your project's assets directory.
-
+
@@ -42,24 +65,34 @@ By default, jME3 searches for models in a directory named assets. <
This is our recommended directory structure for storing assets:
-
MyGame/assets/Interface/
-MyGame/assets/MatDefs/
-MyGame/assets/Materials/
-MyGame/assets/Models/
-MyGame/assets/Scenes/
-MyGame/assets/Shaders/
-MyGame/assets/Sounds/
-MyGame/assets/Textures/
-MyGame/build.xml # build script
-MyGame/src/... # source code
+
jMonkeyProjects/MyGame/src/... # Packages, .java source code.
+jMonkeyProjects/MyGame/assets/... # The assets directory:
+jMonkeyProjects/MyGame/assets/Interface/ # .font, .jpg, .png, .xml
+jMonkeyProjects/MyGame/assets/MatDefs/ # .j3md
+jMonkeyProjects/MyGame/assets/Materials/ # .j3m
+jMonkeyProjects/MyGame/assets/Models/ # .j3o
+jMonkeyProjects/MyGame/assets/Scenes/ # .j3o
+jMonkeyProjects/MyGame/assets/Shaders/ # .j3f, .vert, .frag
+jMonkeyProjects/MyGame/assets/Sounds/ # .ogg, .wav
+jMonkeyProjects/MyGame/assets/Textures/ # .jpg, .png; also .mesh.xml+.material, .mtl+.obj, .blend (!)
-These are just the most common examples. You can name the directories inside the assets directory what ever you like.
+These are just the most common examples. You can rename/delete/add directories and subdirectories inside the assets directory in any way you like. Note however that there is no automatic refactoring for asset paths in the SDK , so if you modify them late in the development process, you have to refactor all paths manually.
+
+
+
+Examples: You can rename assets/Sounds to assets/Audio, you can delete assets/MatDefs if you don't use it, you can create assets/AIscripts, etc. You can rename/move the assets/Textures directory or its subdirectories, but then you have to re-export all models, and re-convert them all to .j3o, so plan ahead!
+
+
+
+
Store textures in assets/Textures/ before you work with them in a mesh editor! Export and save 3D model files (.mesh.xml+.material, .mtl+.obj, .blend) into the assets/Textures/ (!) before you convert the model to binary format (.j3o)! This ensures that texture paths correctly point to the assets/Textures directory.
+After the conversion, you move the .j3o file into the assets/Models/ or assets/Scenes/ directories. This way, you can reuse textures, your binaries consistently link the correct textures, and the assets/Models and assets/Scenes directories don't become cluttered.
+
-
+
@@ -71,7 +104,6 @@ Creating a material instance with the definition "Unshaded.j3md":
assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
-
Applying a texture to the material:
@@ -111,7 +143,8 @@ jME3 also offers a ClasspathLocator, ZipLocator, FileLocator, HttpZipLocator, an
-Note: The custom build script does not automatically include ZIP files in the executable build.
+
The custom build script does not automatically include all ZIP files in the executable build. See "Cannot Locate Resource" solution below.
+
@@ -142,7 +175,7 @@ rootNode.attachChild(scene);
-
+
@@ -150,7 +183,11 @@ rootNode.attachChild(scene);
-Even if the game runs fine when started from the jMoneykPlatform, an error message similar to the following can occur in the console when you run the stand-alone executables (.JAR, .JNLP, etc).
+Problem:
+
+
+
+My game runs fine when I run it right from the jMonkeyEngine SDK . But when I run the stand-alone executables (.jar, .jnlp .exe, .app), a DesktopAssetManager error message occurs in the console, and it quits?
com.jme3.asset.DesktopAssetManager loadAsset
WARNING: Cannot locate resource: Scenes/town/main.scene
@@ -163,7 +200,7 @@ java.lang.NullPointerException
-If you use the default build script created by the jMonkeyEngine SDK then the original OgreXML files are not included in the executable. A stand-alone executable works with .j3o files only . The default build script makes sure to include .j3o files in the executable.
+If you use the default build script, original models and scenes, and ZIP files, are excluded from the distribution automatically. A stand-alone executable includes converted .j3o models and scenes only . The default build script makes sure to include existing .j3o files in the distribution, but you need to convert the models manually.
@@ -171,41 +208,73 @@ If you use the default build script created by the jMonkeyEngine
-Before building the executable, you must use the jMonkeyEngine SDK 's context menu action to convert OgreXML models to .j3o format .
+Before building the executable, you must use the jMonkeyEngine SDK 's context menu action to convert 3D models to .j3o binary format .
Open the jME3 Project in the jMonkeyEngine
SDK .
- Browse the assets directory in the Projects window.
+ Browse to the assets directory in the Projects window.
- Right-click a .mesh.xml or .obj or .scene file, and choose "convert to JME3 binary".
+ Right-click a .mesh.xml/.scene/.obj file, and choose "convert to JME3 binary".
- The converted file appears in the same directory as the .mesh.xml file. It has the same name and a .j3o suffix.
+ The converted file appears in the same directory as the .mesh.xml file. It has the same name and a .j3o suffix.
- Make sure to change the loading code to load the file with a .j3o suffix now.
+ Move the .j3o file into the assets/Models/ or assets/Scenes/ directories.
+
+ Update the file name in the load() code to access the .j3o file.
-If you load the scene from a non.j3o ZIP file, expand the default_build_script to copy the ZIP files.
+
If you load the scene from a non-.j3o ZIP file, ammend the
default_build_script manully to copy the ZIP files into the distribution.
+
-
+
-If you are using another IDE than jMonkeyEngine SDK for coding, you should create a so-called codeless project in the jMonkeyEngine SDK to maintain assets. This method will not meddle with your sources or custom build scripts. It simply makes it easier for you to browse game assets, and preview, arrange, and especially convert models to binary.
+Problem:
-
- You use your favorite IDE to code and use the jMonkeyEngine
SDK only for jME3 assets maintenance.
+
+
+I use another IDE than jMonkeyEngine SDK for coding (Eclipse, IntelliJ, text editor). Where is my asset folder and .j3o converter?
+
+
+
+Solution:
+
+
+
+You can code in any IDE, but you must create a so-called codeless project in the jMonkeyEngine SDK to maintain assets. A code-less jMonkeyEngine project does not meddle with your sources or custom build scripts. You merely use it to convert models to .j3o binaries.
+
+
+
+ Create your (Eclipse or whatever) project as you like.
- You can also ask the graphic designers in your team to install the jMonkeyEngine
SDK and give them access to such a codeless project.
+ Create a directory in your project folder and name it, for example, assets.
+Store your assets there as described above.
-
+
Download and install the jMonkeyEngine
SDK .
+
+
In the
SDK , go to File → Import Projects → External Project Assets.
+
+
Select your (Eclipse or whatever) project and your assets folder in the Import Wizard.
+
+
You can now open this (Eclipse or whatever) project in the jMonkeyEngine
SDK .
+Convert assets as described above.
+
+
+
+
+
+
Use file version control and let team members check out the project. Your developers open the project in Eclipse (etc) as they are used to. Additionally to their graphic tools, ask your graphic designers to install the jMonkeyEngine
SDK , and to check out the codeless project that you just prepared. This makes it easy for non-coding team member to browse and preview game assets, to arrange scenes, and to convert files. At the same time, non-coders don't accidentally mess with code, and developers don't accidentally mess with assets. :)
+
+
view online version
\ No newline at end of file
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..7f9dd104d 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
@@ -66,10 +66,10 @@ There are other obvious getters to poll the status of corresponding setters belo
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.
+ setPitch(1) Makes the sound play in a higher or lower pitch. Default is 1. 2 is twice as high, .5f is half as high.
-
+
AudioNode Method Usage
@@ -91,7 +91,7 @@ setDirectional(false)All 3D effects switched off. This sound is global
setMaxDistance(100f) Maximum distance the sound can be heard, in world units. Default is 20.
-
+
AudioNode Method Usage
@@ -103,7 +103,7 @@ setLocalTranslation(…)Activates 3D audio: The sound appears to come f
setReverbEnabled(true) A 3D echo effect that only makes sense to use with positional AudioNodes. The reverb effect is influenced by the environment that the audio renderer is in. See "Setting Environment Properties" below.
-
+
AudioNode Method Usage
@@ -116,7 +116,7 @@ setDirection(…) Activates 3D audio: This sound can only be heard from
setOuterAngle() Set the angle in degrees for the directional audio. The angle is relative to the direction. Note: By default, both angles are 360° and the sound can be heard from all directions!
-
+
@@ -185,7 +185,7 @@ Optionally, You can choose from the following environmental presets from c
Closet 1.00f 1.0f 1.0f 1.00f 0.15f 1.0f 0.600f 0.0025f 0.500f 0.0006f
-
+
Activate the preset with setEnvironment(). E.g. in a dungeon environment:
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..b29a3c2be 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
@@ -86,8 +86,8 @@ Here you can see the diffuse map of the tank, and the associated glow map that o
-Glow maps works with Lighting.j3md, Particles.j3md and SolidColor.j3md material definitions.
-The tank material looks like that :
+Glow maps work with Lighting.j3md, Particles.j3md and SolidColor.j3md material definitions.
+The tank material looks like this :
Material My Material : Common/MatDefs/Light/Lighting.j3md {
@@ -279,6 +279,11 @@ 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/camera.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/camera.html
index 86b01456c..0f158d7d1 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/camera.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/camera.html
@@ -94,7 +94,7 @@ The camera object is created with the following defaults:
-The flyby camera is an extension of the default camera in com.jme3.app.SimpleApplication. It is preconfigured to respond to the WASD keys for walking forwards and backwards, and for strafing to the sides. Move the mouse to rotate the camera, scroll the mouse wheel for zooming in or out. The QZ keys raise or lower the camera.
+The flyby camera is an AppState that extends the default camera in com.jme3.app.SimpleApplication. It is preconfigured to respond to the WASD keys for walking forwards and backwards, and strafing to the sides; move the mouse to rotate the camera ("Mouse Look"), scroll the mouse wheel for zooming in or out. The QZ keys raise or lower the camera vertically.
@@ -111,10 +111,10 @@ The flyby camera is an extension of the default camera in com.jme3.app.SimpleApp
flyCam.setRotationSpeed(10); Control the rotation speed
- flyCam.setDragToRotate(true) Must keep mouse button pressed to rotate camera. Used e.g. for Applets. if false, all mouse movement will be captured and interpreted as rotations.
+ flyCam.setDragToRotate(true) Forces the player to keep mouse button pressed to rotate camera, typically used for Applets. If false (default), all mouse movement will be captured and interpreted as rotations.
-
+
@@ -164,7 +164,7 @@ ChaseCamera chaseCam = new ChaseCamera(cam, target, inputManager);
chaseCam.setDefaultHorizontalRotation(-FastMath.PI/2); The default horizontal rotation angle of the camera around the target at the start of the application.
-
+
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/capture_audio_video_to_a_file.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/capture_audio_video_to_a_file.html
index 27f169c51..1f088780d 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/capture_audio_video_to_a_file.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/capture_audio_video_to_a_file.html
@@ -4,14 +4,6 @@
-
A/V recording is still in development.
-It works for all of jMonkeyEngine's test cases.
-If you experience any problems or
-if something isn't clear, please
. – bortreb
-
-
-
-
So you've made your cool new JMonkeyEngine3 game and you want to
create a demo video to show off your hard work. Or maybe you want to
make a cutscene for your game using the physics and characters in the
@@ -64,6 +56,14 @@ That's all!
+
This way of A/V recording is still in development.
+It works for all of jMonkeyEngine's test cases.
+If you experience any problems or
+if something isn't clear, please
. – bortreb
+
+
+
+
If you want to record audio as well, record at different framerates,
or record from multiple viewpoints at once, then there's a full
solution for doing this already made for you here:
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html
index 7c61809a5..b5cca9015 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/custom_controls.html
@@ -3,7 +3,11 @@
-A com.jme3.scene.control.Control is a customizable jME3 interface that allows you to cleanly steer the behaviour of game entities: Traps, alarms, doors, animal NPCs, self-steering vehicles, artificially intelligent behaviour in NPCs, anything that moves. Several instances of Controls together implement the behaviours of a type of Spatial. To control global game behaviour see Application States – you can also use both together.
+A com.jme3.scene.control.Control is a customizable jME3 interface that allows you to cleanly steer the behaviour of game entities (Spatials), such as artificially intelligent behaviour in NPCs, traps, automatic alarms and doors, animals and pets, self-steering vehicles or platforms – anything that moves and interacts. Several instances of customs Controls together implement the behaviours of a type of Spatial.
+
+
+
+To control global game behaviour see Application States – you often use AppStates and Control together.
@@ -175,7 +180,7 @@ All data types (except Color) are specified in com.jme3.shader.VarType.
TextureArray (Currently not supported in J3M)
-
+
@@ -239,7 +244,7 @@ See the
(Boolean) Enable point sprite rendering for point meshes
-
+
@@ -334,6 +339,14 @@ The file assets/Models/Tree/Leaves.j3m contains:
The PNG file is in the same directory, assets/Models/Tree/…
+
view online version
\ No newline at end of file
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html
index d7176e9ba..c169d39b8 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html
@@ -60,6 +60,10 @@ You control the color and intensity of each light source. Typically you set the
You can choose to use lights in other colors than white, or darker colors. This influences the scene's atmosphere and will make the scene appear colder (e.g. ColorRGBA.Cyan) or warmer (ColorRGBA.Yellow), brighter (higher values) or darker (lower values).
+
+You can get a list of all lights added to a Spatial by calling getWorldLightList() (includes inherited lights) or getLocalLightList() (only directly added lights), and iterating over the result.
+
+
@@ -71,7 +75,7 @@ You can choose to use lights in other colors than white, or darker colors. This
-A PointLight has a location and shines from there in all directions as far as its radius reaches. The light intensity decreases with increased distance from the light source. A PointLight can be used together with shadows.
+A PointLight has a location and shines from there in all directions as far as its radius reaches. The light intensity decreases with increased distance from the light source. A PointLight can at the moment not be used for casting shadows (using the PssmShadowRenderer - read more about this below).
@@ -102,7 +106,7 @@ A DirectionalLight has no position, only a direction. It sends out parallel beam
DirectionalLight sun = new DirectionalLight();
sun.setColor(ColorRGBA.White);
-sun.setDirection(new Vector3f(-1,13, -1,13, 1,13).normalizeLocal());
+sun.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal());
rootNode.addLight(sun);
@@ -122,14 +126,18 @@ A SpotLight sends out a distinct beam or cone of light. A SpotLight has a direct
Typical Example: Flashlight
-SpotLight sl = new SpotLight();
-sl.setDirection(new Vector3f(1,0,1)); // direction
-sl.setPosition(new Vector3f(0,0,0));
-sl.setSpotInnerAngle(15f); // inner light cone (maximum)
-sl.setSpotOuterAngle(35f); // outer light cone (edge of the light)
-sl.setSpotRange(10f); // distance
-sl.setColor(ColorRGBA.White.mult(1.3f));
-rootNode.addLight(sl);
+SpotLight spot = new SpotLight();
+spot.setSpotRange(100f); // distance
+spot.setSpotInnerAngle(15f * FastMath.DEG_TO_RAD); // inner light cone (central beam)
+spot.setSpotOuterAngle(35f * FastMath.DEG_TO_RAD); // outer light cone (edge of the light)
+spot.setColor(ColorRGBA.White.mult(1.3f)); // light color
+spot.setPosition(cam.getLocation()); // shine from camera loc
+spot.setDirection(cam.getDirection()); // shine forward from camera loc
+rootNode.addLight(spot);
+
+
+If you want the spotlight to follow the flycam, repeat the setDirection(…) and setPosition(…) calls in the update loop, and kee syncing them with the camera position and direction.
+
@@ -258,7 +266,7 @@ Use the Shadow Renderer to make Geometries with Lighting.j3md-based Materials ca
public void simpleInitApp() {
...
bsr = new BasicShadowRenderer(assetManager, 256);
- bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal()); // light direction
+ bsr.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal()); // light direction
viewPort.addProcessor(bsr);
...
@@ -298,7 +306,7 @@ The more advanced PSSM shadow renderer can cast real-time shadows, even on curve
public void simpleInitApp() {
....
pssmRenderer = new PssmShadowRenderer(assetManager, 1024, 3);
- pssmRenderer.setDirection(new Vector3f(-1, -1, -1).normalizeLocal()); // light direction
+ pssmRenderer.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal()); // light direction
viewPort.addProcessor(pssmRenderer);
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..03bddde14 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
@@ -51,12 +51,12 @@ flyCam.setEnabled(false);
camNode = new CameraNode("Camera Node", cam);
//This mode means that camera copies the movements of the target:
camNode.setControlDir(ControlDirection.SpatialToCamera);
+//Attach the camNode to the target:
+target.attachChild(camNode);
//Move camNode, e.g. behind and above the target:
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);
+camNode.lookAt(target.getLocalTranslation(), Vector3f.UNIT_Y);
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.
@@ -73,10 +73,10 @@ Example: Use with C
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.
+The camera's transformation is copied over the spatial's transformation. Use with first-person flyCam.
-
+
Code sample:
@@ -137,7 +137,7 @@ new KeyTrigger(KeyInput.KEY_SPACE))
Activate mutiple triggers for the ro
setRotationSensitivity(5f) How fast the camera rotates. Use values around <1.0f (all bigger values are ignored).
-
+
Code sample:
@@ -171,6 +171,6 @@ What is the difference of the two code samples above?
Drag-to-Rotate rotates the target and the camera. You always see the target from behind. Drag-to-Rotate rotates only the camera. You can see the target from various sides.
-
+
view online version
\ No newline at end of file
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/material_definitions.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/material_definitions.html
index b892c9dcb..c27b41d71 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/material_definitions.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/material_definitions.html
@@ -4,27 +4,38 @@
-Typically, you create a set of custom materials, and use them throughout the game. For example, you can initialize and configure your materials objects in the initSimpleApp() method, and then load 3D models (Geometries) and use setMaterial() on them.
+All Geometries need a Materual. Every Material is based on a Material Definition. The most common Material Definitions are included in the engine, advanced users can create custom ones.
+Spatial myGeometry = assetManager.loadModel("Models/Teapot/Teapot.j3o");
+Material mat = new Material(assetManager, // Create new material and...
+ "Common/MatDefs/Misc/Unshaded.j3md"); // ... specify a Material Definition file, here "Unshaded.j3md"!
+mat.setColor("Color", ColorRGBA.Blue); // Set one or more material parameters.
+myGeometry.setMaterial(mat); // Use material on this Geometry.
-Tip: If you use one custom material very often, additionally read about storing material configurations in user-friendly j3m Material Files .
+
+
+
+
+In the Materials Overview list,
+
- Choose a Material Definition from the
Materials Overview list that has the features that you need.
+ Choose a Material Definition that has the features that you need.
- Look at the applicable parameters of the Material Definition and determine which ones you need to achieve the desired effect. Most parameters are optional.
-
- Create and save the necessary Texture files to the assets directory.
+ Look at the applicable parameters of the Material Definition and determine which parameters you need to achieve the desired effect (e.g. "glow" or "color"). Most parameters are optional.
+
+ Create and save the necessary Texture files to your assets directory.
-
-
+
+
+
+In your Java code,
+
- In you Java code, create a Material object based on the .j3md file: e.g.
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+
Create a Material object based on the chosen Material Definition (.j3md file):
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
-
Configure your Material by setting the appropriate values listed in the
Materials Overview table. Here are examples of the methods that set the different data types:
+ Configure your Material by setting the appropriate values listed in the
Materials Overview table.
mat.setColor("Color", ColorRGBA.Yellow ); // and more
+
+
+
Apply your prepared Material to a Geometry:
myGeometry.setMaterial(mat);
+
+
+
(Optional) Adjust the texture scale:
geometry.scaleTextureCoordinates(new Vector2f(1f, .5f));
+
+
+
+
+
+
+For details see also: How to Use Materials
+
+
+
+
+
+
+
+
+
+Here are examples of the methods that set the different data types:
+
- mat.setColor( "Color", ColorRGBA.White );
+ mat.setColor( "Color", ColorRGBA.White );
mat.setTexture( "ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.png" ));
@@ -61,19 +99,6 @@ Typically, you create a set of custom materials, and use them throughout the gam
mat.setVector3( "NormalScale", new Vector3f(1f,1f,1f));
-
-
Use your prepared material on a Geometry:
myGeometry.setMaterial(mat);
-
-
-
(Optional) Adjust the texture scale:
geometry.scaleTextureCoordinates(new Vector2f(1f, .5f));
-
-
-
-
-
-
-
-
@@ -105,9 +130,41 @@ geom.setMaterial(mat);
rootNode.attachChild(geom);
-Tip: You can find these and other common code snippets in the jMonkeyEngine SDK Code Palette. Drag and drop them into your source code.
-
+
You can find these and other common code snippets in the jMonkeyEngine
SDK Code Palette. Drag and drop them into your source code.
+
+
+
+
+
+
+
+
+Check out the engine source code and have a look at how Material Definitions are implemented. You can create your own Material Definitions and place them in your projects MatDefs directory.
+
+
+
+ Find the existing MatDefs are in engine/src/core-data/Common/MatDefs/.
+
+ Open a Something.j3md file in a text editor. You see that this jme3 file defines Material Parameters and Techniques.
+
+ Material Parameters are the ones that you set in Materials, as shown in the examples above.
+
+ The Techniques rely on VertexShaders and FragmentShaders: You find those in the files Something.vert and Something.frag in the same directory.
+
+
+
+ Learn about GLSL (OpenGL Shading Language) to understand the .vert and .frag syntax, and write your own.
+
+
+
+
view online version
\ No newline at end of file
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..666cea8d2 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,69 +1,64 @@
-
+
-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.
+In jMonkeyEngine 3, colors and textures are represented as Material objects.
+
+
+ All Geometries must have Materials. 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 several tree models.)
+
+ Each Material is based on one of jme3's default Material Definitions (.j3md files) that are included in the engine. Advanced users can create additional custom Material Definitions (see how it's done in the
jme3 sources ).
+
+
-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.
+
-
+
-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.
+The following Materials table shows you the Material Definitions that jMonkeyEngine 3 supports.
-
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.
+
Looks confusing?
+1) Start learning about
Unshaded.j3md and
Lighting.j3md, they cover 90% of the cases.
+2) Use
the SDK's visual material editor to try out and save material settings easily.
+3) The
SDK's Palette contains drag&drop code snippets for loading materials.
+Most Material parameters are optional. For example, it is okay to specify solely the DiffuseMap and NormalMap when using Lighting.j3md, and leave the other texture maps empty. In this case, you are only using a subset of the possible features, but that's fine if it already makes in the material look the way that you want. You can always add more texture maps later.
+
+
+
+
+
+
+
+
+
jMonkeyEngine supports illuminated and unshaded Material Definitions.
Phong Illuminated materials look more naturalistic.
- Unshaded materials look more abstract.
+ Unshaded materials look more abstract.
-
-
-
-
-
"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.
@@ -71,7 +66,7 @@ jMonkeyEngine supports illuminated and unshaded Material Definitions.
- Basic Material Definition Usage Parameter
+ Standard Unshaded Material Definition Usage Material Parameters
Common/MatDefs/Misc/Unshaded.j3md Standard, non-illuminated Materials.
@@ -88,7 +83,7 @@ setTexture("GlowMap", assetManager.loadTexture(""));
setColor("GlowColor", ColorRGBA.White);
-
+
Other useful, but less commonly used material definitions:
@@ -96,7 +91,7 @@ Other useful, but less commonly used material definitions:
- Special Material Definitions Usage Setter, Parameter, Type
+ Special Unshaded Material Definitions Usage Material Parameters
Common/MatDefs/Misc/Sky.j3md A solid skyblue, or use with a custom SkyDome texture.
@@ -148,20 +143,31 @@ setColor("GlowColor", ColorRGBA.White);
setBoolean("PointSprite",true);
-
+
-
+
+jMonkeyEngine supports illuminated and unshaded Material Definitions.
+
+
+
+
+
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
+ Standard Illuminated Material Definition Usage Material Parameters
Common/MatDefs/Light/Lighting.j3md Commonly used Material with Phong illumination.
@@ -197,9 +203,9 @@ setColor("Specular", ColorRGBA.White);
setBoolean("WardIso",true);4)
-
+
- Special Illuminated Material Definitions Usage Setter, Parameter, Type
+ Special Illuminated Material Definitions Usage Material Parameters
Common/MatDefs/Terrain/TerrainLighting.j3md Same kind of multi-layered splat texture as Terrain.j3md, but with illumination and shading.
@@ -244,121 +250,35 @@ setBoolean("WardIso",true);
setBoolean("SphereMap",true);
-
+
-
+
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.
+ 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 and no lights, or as fall-back default material. This built-in material has no parameters.
-
+
-
+
-
-
-
-
-
-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.
-
-
- Generate normals for the Mesh (not for the Geometry!)
TangentBinormalGenerator.generate(mesh);
-
-
- Specify the
NormalMap texture. (
)
-
-
-
-
-
-
-
-
-
-
-To activate Shininess:
-
-
- Specify the Shininess intensity.
-A float value between 1 (rough surface with blurry shininess) and 128 (very smooth surface with focused shininess)
-
- Specify a Color as Specular value.
-The ColorRGBA value of the light source, e.g. often RGBA.White.
-
- (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
-
-
-
-
-
-
-
-
-
-
-To activate glow:
-
-
-
-
- Specify a Color as Glow value.
-A ColorRGBA value of your choice, e.g. choose a warm or cold color for different effects.
-
- (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
-
-
-
-
-
-
-
-
-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:
-
-
- Material option Usage Example
+ Material Option Description Example
- getAdditionalRenderState().setBlendMode(BlendMode.Off); Opaque
+ getAdditionalRenderState().setBlendMode(BlendMode.Off); This is the default, no transparency. Use for all opaque objects like walls, floors, people…
getAdditionalRenderState().setBlendMode(BlendMode.Alpha); Interpolates the background pixel with the current pixel by using the current pixel's alpha. Use this for normal every-day translucency: Frosted window panes, ice, glass, alpha-blended vegetation textures…
@@ -368,14 +288,15 @@ Additionally, you must specify a blendmode:
getAdditionalRenderState().setAlphaFallOff(0.5f);
-getAdditionalRenderState().setAlphaTest(true) Enables alpha test. Works the same way as "AlphaDiscardThreshold". Used for textures that have fully opaque pixels next to fully transparent pixels, e.g. foliage, hair, vegetation.
+getAdditionalRenderState().setAlphaTest(true)Enables Alpha Testing with a "AlphaDiscardThreshold" in the AlphaMap. Activate Alpha Testing for (partially) transparent objects such as foliage, hair, etc.
+Deactivate Alpha Testing for gradually translucent objects, such as colored glass, smoked glass, ghosts.
getAdditionalRenderState().setBlendMode(BlendMode.Additive); Additive alpha blending adds colors in a commutative way, i.e. the result does not depend on the order of transparent layers, since it adds the scene's background pixel color to the current pixel color. This is useful if you have lots of transparent textures overlapping and don't care about the order.
-Viewed in front of a white background, Additive textures become fully transparent! Used for particle effect textures that have a black color background.
+Note: Viewed in front of a white background, Additive textures become fully transparent! This is the default for Particle.j3md-based textures that have a black color background.
- getAdditionalRenderState().setBlendMode(BlendMode.AlphaAdditive); Same as "Additive", except first it multiplies the current pixel color by the pixel alpha. Used for particle effects that have alpha as background.
+ getAdditionalRenderState().setBlendMode(BlendMode.AlphaAdditive); Same as "Additive", except first it multiplies the current pixel color by the pixel alpha. This can be used for particle effects that have alpha as background.
getAdditionalRenderState().setBlendMode(BlendMode.Color); Blends by color. Generally useless.
@@ -390,25 +311,34 @@ Viewed in front of a white background, Additive textures become fully transparen
getAdditionalRenderState().setBlendMode(BlendMode.PremultAlpha); Pre-multiplied alpha blending. E.g. if the color of the object has already been multiplied by its alpha, this is used instead of "Alpha" blend mode. For use with Premult Alpha textures.
-
+
-
For partially transparent Materials based on Lighting.j3md, consider setting the AlphaDiscardThreshold value. The renderer only renders pixels above your alpha threshold, and does not render pixels below the threshold. This means, that gradients in the AlphaMap are no longer interpreted as soft translucency, but parts of the texture become either fully opaque or fully transparent. You typically activate Alpha Testing for partially transparent objects such as foliage, hair, etc.
+If the DiffuseMap has an alpha channel, use:
-
+
mat.setBoolean("UseAlpha",true);
+
+
+Later, put the Geometry (not the Material!) in the appropriate render queue
+
+
+ geo.setQueueBucket(Bucket.Translucent);
+
+
+ geo.setQueueBucket(Bucket.Transparent);
+
+
+
-
+
Material Option Usage Example
-
- getAdditionalRenderState().setWireframe(true); Switch to showing the (textured) Material in wireframe mode. For debugging or "matrix/holodeck" effect.
-
getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back); Activate back-face culling. Mesh faces that are not facing the camera are not rendered, which saves time. Backface culling is activated by default as a major optimization. The backside of mesh polygons (and the inside of models) is invisible.
@@ -416,11 +346,18 @@ Viewed in front of a white background, Additive textures become fully transparen
getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off); Nothing is culled. Both mesh faces are rendered, even if they face away from the camera. Slow. Sometimes used to debug custom meshes if you messed up some of the polygon sides, or for special shadow effects.
- getAdditionalRenderState().setFaceCullMode(FaceCullMode.Front); Activate front-face culling. Mesh faces facing the camera are not rendered. Typically not used.
+ getAdditionalRenderState().setFaceCullMode(FaceCullMode.Front); Activate front-face culling. Mesh faces facing the camera are not rendered. Typically not used because you wouldn't see anything.
getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack) Cull both backfaces and frontfaces. Use this as an efficient way to make an object temporarily invisible, while keeping all its other in-game properties (node attachment, collision shapes, interactions, etc) active.
+
+
+
+
+
+
+
getAdditionalRenderState().setColorWrite(false); Disable writing the color of pixels. Use this together with setDepthWrite(true) to write pixels only to the depth buffer, for example.
@@ -431,7 +368,16 @@ Viewed in front of a white background, Additive textures become fully transparen
getAdditionalRenderState().setPolyOffset(); Enable polygon offset. Use this when you have meshes that have triangles really close to each over (e.g. ), it will shift the depth values to prevent .
-
+
+
1)
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/monkey_zone.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/monkey_zone.html
index 1ae5ddb95..20b765985 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/monkey_zone.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/monkey_zone.html
@@ -319,6 +319,15 @@ MonkeyZone is hosted at GoogleCode, where you can check out the jMonkeyEngine
Run the server first (com.jme3.monkeyzone.ServerMain), and then a client (com.jme3.monkeyzone.ClientMain).
+
+
+
+
+
+
+ After download error coud appear that in jme3tools.navmesh.util\NavMeshGenerator.java import com.jme3.terrain.Terrain is not known, you should correct this by setting Project Properties > Libraries > Add Library > jme3-libraries-terrain
+
+
network ,
basegame ,
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..3f480e5b0 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
@@ -108,7 +108,7 @@ The following example rotates Spatials named "Red Box" or "Blue B
// Convert screen click to 3d position
Vector2f click2d = inputManager.getCursorPosition();
Vector3f click3d = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 0f).clone();
- Vector3f dir = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d);
+ Vector3f dir = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d).normalizeLocal();
// Aim the ray from the clicked spot forwards.
Ray ray = new Ray(click3d, dir);
// Collect intersections between ray and all nodes in results list.
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 a3198769c..c6ccef839 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
@@ -194,12 +194,39 @@ private Callable<MyWayList> findWay = new Callable<MyWayList>(
+
+
+
+
+
+jME3 is similar to Swing in that for speed and efficiency all changes to the world must be made in a single update thread. This is handled automatically for you if using Controllers or simpleUpdate however whenever you pass work to another thread you need to hand the results back to the main jME3 thread before making any changes to the scene graph.
+
+
public void rotateGeography(final Geography goe, final Quaternian rot) {
+ mainApp.enqueue(new Callable<Spatial>() {
+
+ public Spatial call() throws Exception {
+ return geo.rotate(rot);
+ }
+
+ });
+ }
+
+
+Note that this example does not fetch the returned value by calling get() on the Future object returned from enqueue(). This means that the example method rotateGeography() will return immediately and will not wait for the rotation to be processed before continuing.
+
+
+
+If the processing thread needs to wait or needs the return value then get() or the other methods in the returned Future object such as isDone() can be used.
+
+
+
+
-The cool thing about this appraoch is that every entity creates one self-contained Callable for the Executor, and they are all executed in parallel. In theory, you can have one thread per entity without changing anything else but the settings of the executor.
+The cool thing about this approach is that every entity creates one self-contained Callable for the Executor, and they are all executed in parallel. In theory, you can have one thread per entity without changing anything else but the settings of the executor.
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 cba8dafc2..d7e284790 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,5 +1,5 @@
-
+
@@ -21,19 +21,21 @@ This document introduces you to GUI to your jME3 game:
+Learn to add a Nifty GUI to your jME3 game by going through this multi-part tutorial:
+
+
Lay out your graphical user interface:
-
+
@@ -53,7 +55,7 @@ To add a Nifty GUI to your j
-
+
@@ -66,27 +68,27 @@ Nifty GUIs are made up of the following elements :
-
+
-General usage tips about elements:
-
+
+
- You give an element an ID String if you want to interact with it.
-You can also use transparent, ID-less panels as spacers.
-
- For layers and panels, you specify width and height in percent, or use * to fill the remaining space automatically.
-
- Screen, layers, and panels…
-
-
- The jMonkeyEngine
SDK 's Nifty editor lets you switch between the
XML editor and a
GUI preview, so you see the effects of your code changes.
+
-
-
-
-
-
-
-
-
-
-
-The XML and Java syntax are equivalent, so is it an either-or choice? Not quite.
-We recommend to use XML to lay out the static parts of the GUI . Then use Java syntax to control the dynamic parts of the GUI at runtime.
-
-
-
-
-
-
-
-
-
-During development (and during this tutorial), the following debug code makes all panels visible. This helps you arrange them and find errors.
-
-
-
nifty.setDebugOptionPanelColors(true);
-
-
-
-Before the release, and for testing, set it to false again.
-
-
-
-
-
-
-
-
-
-The SDK includes an XML editor and previewer for Nifty GUI files. Open an XML file, and switch between XML and Preview mode.
-
-
-
-
-
-
-
-
-
-Include the following XML schema in the first line of your NiftyGUI XML files and your IDE gives you hints and code completion.
-
-
-
<?xml version="1.0" encoding="UTF-8"?>
-<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd">
- <!-- Your IDE now tells you that one <screen></screen> element is expected here, etc. -->
-</nifty>
-
-
-
-
+
@@ -208,12 +138,12 @@ Include the following XML
-
+
-Learn more from the NiftyGUI page!
+Learn more from the NiftyGUI page:
@@ -233,7 +163,7 @@ Learn more from the NiftyGUI page!
-Next, learn how to lay out your graphical user interface. Typically, you start with XML .
+Now that you understand the concepts and know where to find more information, learn how to lay out a simple graphical user interface. Typically, you start doing this in XML .
@@ -241,6 +171,18 @@ Next, learn how to lay out your graphical user interface. Typically, you start w
+
+
+
+
+
+
+
+If you want to disable the nifty log lines, add this code after you created nifty:
+
+
+
Logger.getLogger("de.lessvoid.nifty").setLevel(Level.SEVERE);
+Logger.getLogger("NiftyInputEventHandlingLog").setLevel(Level.SEVERE);
gui ,
documentation ,
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 835b33da1..71697ed31 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
@@ -4,6 +4,8 @@
+
+
@@ -49,7 +51,7 @@ public class MyStartScreen extends AbstractAppState implements ScreenController
/** custom methods */
public MyStartScreen(String data) {
- /** You custom constructor, can accept arguments */
+ /** Your custom constructor, can accept arguments */
}
/** Nifty GUI ScreenControl methods */
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html
index c160029db..5b4a9d17b 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_java_layout.html
@@ -4,6 +4,8 @@
+
+
@@ -606,7 +608,7 @@ Before initializing the nifty screens, you set up properties and register media.
setDebugOptionPanelColors(true); Highlight all panels, makes it easier to arrange them.
-
+
Example:
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..a901f1835 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
@@ -4,6 +4,8 @@
+
+
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_popup_menu.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_popup_menu.html
index e6277875f..a2be31321 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_popup_menu.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_popup_menu.html
@@ -5,7 +5,7 @@
Even though you create and populate the popup menu in Java, you still need a "placeholder" in your XML file.
-The popup menu niftyPopupMenu is a default Control from nifty-default-controls.xml.
+The popup element needs to be placed outside of any screen!
<useControls filename="nifty-default-controls.xml"/>
...
@@ -24,7 +24,7 @@ A brief explanation of some the attributes above:
The Controller tells Nifty which Java class handles MenuItemActivatedEvent.
- The on(Secondary/Tertiary)Click tells Nifty to close the popup if the user clicks anywhere except on the menu items (in this example)
+ The on(Secondary/Tertiary)Click tells Nifty to close the popup if the user clicks anywhere except on the menu items (in this example; you have to define the closePopup()-method yourself, in the screen controller)
The control id is used by the Java class to define a control type (i.e. Menu)
@@ -70,6 +70,8 @@ private class menuItem {
The showMenu() method is called by something to trigger the menu (i.e. could be a Key or some other method).
+ Note: if you want to be able to access the popup via your id, use createPopupWithId(id, id) instead.
+
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..08c70673d 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
@@ -4,6 +4,8 @@
+
+
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_scenarios.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_scenarios.html
index d576baf0f..40fa6256f 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_scenarios.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/nifty_gui_scenarios.html
@@ -1,31 +1,14 @@
-
+
-This document contains best practices for typical NiftyGUI usercase scenarios. These tips assume that you have read the Introduction to jME3's Nifty GUI integration first, and have laid out a basic GUI that interacts with your Java application. Here you learn how you integrate the GUI better, and add effects and advanced controls.
+This document contains typical NiftyGUI usecase scenarios, such as adding effects, game states, and creating typical game screens.
-
-
-
-
-
-
-You can build Nifty GUIs using XML or Java syntax. Which one should you choose?
-
-
-
-
-
-This approach has the advantage that you can, for example, switch between a phone and a desktop UI by simply swapping one base XML file. You design the swappable UI with different layouts, but use the same element IDs, so your dynamic Java code works the same no matetr which base XML layout you use it on.
+Requirements: These tips assume that you have read and understood the Creating JME3 User Interfaces with Nifty GUI tutorial, and have already laid out a basic GUI that interacts with your JME3 application. Here you learn how you integrate the GUI better, and add effects and advanced controls.
@@ -142,7 +125,7 @@ public StartScreenState(SimpleApplication app){
${PROP.key} looks up key in the Nifty properties. Use Nifty.setGlobalproperties(properties) and Nifty.getGlobalproperties("key"). Or SystemGetProperties(key);
-
+
See also:
@@ -170,12 +153,12 @@ For example, create a MyHudScreen.java for the hud scr
-
+
@@ -184,7 +167,8 @@ For example, create a MyHudScreen.java for the hud scr
@@ -270,13 +254,13 @@ You can name the method (here clicked) what ever you like, as long
-
+
The basic Nifty GUI example showed how to use the nifty.fromXML() method to load one XML file containing all Nifty GUI screens.
-The following code sample shows how you can load several XML files into one nifty object. Loading several files with nifty.addXml() allows you to use one XML file per one screen layout.
+The following code sample shows how you can load several XML files into one nifty object. Loading several files with nifty.addXml() allows you to split up each screen into one XML file, insetad of all into one hard-to-read XML file.
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, viewPort);
Nifty nifty = niftyDisplay.getNifty();
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..5235549d8 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
@@ -4,6 +4,8 @@
+
+
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 4a6d503a0..9a6c6ccf0 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
@@ -230,8 +230,11 @@ Browse the full source code of all Effects Overview
-
+
view online version
\ No newline at end of file
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 6cb9bcbeb..5176682d1 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
@@ -4,15 +4,15 @@
-The jMonkeyEngine3 has built-in support for via the com.jme3.bullet package.
+A physics simulation is used in games and applications where objects are exposed to physical forces: Think of games like pool billiard and car racing simulators. Massive objects are pulled by gravity, forces cause objects to gain momentum, friction slows them down, solid objects collide and bounce off one another, etc. Action and Adventure games also make use of physics to implement solid obstacles, falling, and jumping.
-Game Physics are used in applications that simulate mass/gravity, collisions, and friction. Think of pool billiard or car racing simulations.
+The jMonkeyEngine3 has built-in support for (based on ) via the com.jme3.bullet package. This article focuses mostly on the RigidBodyControl, but also introduces you to others.
-If you are looking for info on how to respond to physics events, read about Physics Listeners .
+If you are looking for info on how to respond to physics events such as collisions, read about Physics Listeners .
@@ -22,30 +22,35 @@ If you are looking for info on how to respond to physics events, read about
-Bullet physics runs internally at 60fps by default. This rate is not dependent on the actual framerate and it does not lock the framerate at 60fps. Instead, when the actual fps is higher than the physics framerate the system will display interpolated positions for the physics entities. When the framerate is lower than the physics framerate the physics space will be stepped multiple times per frame to make up for the missing calculations.
+Bullet physics runs internally at 60fps by default. This rate is not dependent on the actual framerate and it does not lock the framerate at 60fps. Instead, when the actual fps is higher than the physics framerate the system will display interpolated positions for the physics objects. When the framerate is lower than the physics framerate, the physics space will be stepped multiple times per frame to make up for the missing calculations. You create a Bullet PhysicsSpace in jME3 with a com.jme3.bullet.BulletAppState.
-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:
+Internally, the updating and syncing of the actual physics objects happens in the following way:
- collision callbacks (BulletAppState.update())
+ collision callbacks (BulletAppState.update())
- user update (simpleUpdate / update)
+ user update (simpleUpdate in main loop, update() in Controls and AppStates)
- physics to scenegraph syncing/applying (updateLogicalState())
+ physics to scenegraph syncing and applying (updateLogicalState())
- stepping physics (before / in parallel to Application.render())
+ stepping physics (before or 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.
+
+When you use this physics simulation, values correspond to the following units:
+
+ 1 length unit (1.0f) equals 1 meter,
+
+ 1 weight unit (1.0f) equals 1 kilogram,
+
+ most torque and rotation values are expressed in radians.
+
+
@@ -88,17 +93,21 @@ Do the following once per application to gain access to the physicsSpace
Initialize your bulletAppState and attach it to the state manager:
public void simpleInitApp() {
bulletAppState = new BulletAppState();
- stateManager.attach(bulletAppState);
- ...
+ stateManager.attach(bulletAppState);
-You can also access the BulletAppState via the state manager:
+
In your application, you can always access the
BulletAppState via the ApplicationStateManager:
+
+
BulletAppState bas = app.getStateManager().getState(BulletAppState.class);
+
+
+
+
-stateManager.getState(BulletAppState.class)
For each Spatial that you want to be physical:
@@ -106,145 +115,181 @@ For each Spatial that you want to be physical:
Create a CollisionShape.
- Create a PhysicsControl by supplying the CollisionShape and mass.
-
+ Add the PhysicsControl to its Spatial.
- Add the PhysicsControl to the Spatial.
+ Add the PhysicsControl to the PhysicsSpace.
- Add the PhysicsControl to the physicsSpace object.
+ Attach the Spatial to the rootNode (as usual).
- Attach the Spatial to the rootNode, as usual.
-
- (Optional) Implement the PhysicsCollisionListener interface to respond to PhysicsCollisionEvents if desired.
+ (Optional) Implement the PhysicsCollisionListener interface to respond to PhysicsCollisionEvents.
+
+
+Let's look at the details:
+
+
-
+
-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.
+A CollisionShape 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.)
+Before you can create a Physics Control, you must create a CollisionShape from the com.jme3.bullet.collision.shapes package. (Read the tip under "PhysicsControls Code Samples" how to use default CollisionShapes for Boxes and Spheres.)
- Shape Usage Examples
+ Non-Mesh CollisionShape Usage Examples
- BoxCollisionShape Box shaped entities Does not roll. Bricks, crates, simple oblong entities.
+ BoxCollisionShape() Box-shaped behaviour, does not roll. Oblong or cubic objects like bricks, crates, furniture.
- SphereCollisionShape Spherical entities. Can roll. Balls, simple compact entities.
+ SphereCollisionShape() Spherical behaviour, can roll. Compact objects like apples, soccer balls, cannon balls, compact spaceships.
- CylinderCollisionShape Tube-shaped and disc-shaped entities. Can roll on one side. Pillars, wheels.
+ CylinderCollisionShape() Tube-shaped and disc-shaped behaviour, can roll on one side. Oblong objects like pillars.
+Disc-shaped objects like wheels, plates.
- 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 shapes. Use the addChildShape() method on the compound object to add other shapes to it and position them relative to one another. A car with wheels (1 box + 4 cylinders), etc.
- CompoundCollisionShape A CompoundCollisionShape allows custom combinations of box/sphere/cylinder shapes to form another more complex shape. Complex shapes.
+ CapsuleCollisionShape() A built-in compound shape of a vertical cylinder with one sphere at the top and one sphere at the bottom. Typically used with 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. Persons, animals.
- 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.
+ SimplexCollisionShape() A physical point, line, triangle, or rectangle Shape, defined by one to four points. Guardrails
- GImpactCollisionShape This 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.
-
-
- HeightFieldCollisionShape Optimized Mesh Collision Shape for static terrains. This shape is much faster than a other Free-Form Mesh Shapes. Requires heightmap data. Optimized for terrains.
-
-
- HullCollisionShape A collision shape that is based on a mesh but is a simplified convex version. …
-
-
- SimplexCollisionShape A physical point, line, triangle, or quad Collision Shape, defined by one to four points. Guardrails
-
-
- PlaneCollisionShape A 2D plane Flat solid floor or wall.
+ PlaneCollisionShape() A 2D plane. Very fast. Flat solid floor or wall.
-
+
-
Pick the right shape for the mesh for what you want to do: If you give a box a sphere collision shape, it will roll; if you give a ball a box collision shape, it will sit on a slope. Make collision shapes visible by adding the following line after the bulletAppState initialization:
-bulletAppState.getPhysicsSpace().enableDebug(assetManager);
-
+All non-mesh CollisionShapes can be used for dynamic, kinematic, as well as static Spatials. (Code samples see below)
+
+
+
+
+ Mesh CollisionShapes Usage Examples
+
+
+ MeshCollisionShape A mesh-accurate shape for static or kinematic Spatials. Can have complex shapes with openings and appendages.
+Limitations: Collisions between two mesh-accurate shapes cannot be detected, only non-mesh shapes can collide with this shape. This Shape does not work with dynamic Spatials. A whole static game level model.
+
+
+ HullCollisionShape A less accurate shape for dynamic Spatials that cannot easily be represented by a CompoundShape.
+Limitations: The shape is convex (behaves as if you gift-wrapped the object), i.e. openings, appendages, etc, are not individually represented. A dynamic 3D model.
+
+
+ GImpactCollisionShape A mesh-accurate shape for dynamic Spatials. It uses .
+Limitations: CPU intensive, use sparingly! We recommend using HullCollisionShape (or CompoundShape) instead to improve performance. Collisions between two mesh-accurate shapes cannot be detected, only non-mesh shapes can collide with this shape. Complex dynamic objects (like spiders) in Virtual Reality or scientific simulations.
+
+
+ HeightFieldCollisionShape A mesh-accurate shape optimized for static terrains. This shape is much faster than other mesh-accurate shapes.
+Limitations: Requires heightmap data. Collisions between two mesh-accurate shapes cannot be detected, only non-mesh shapes can collide with this shape. Static terrains.
+
+
+
+
+
+The mesh-accurate shapes can use a CollisionShapeFactory as constructor (code samples see below).
-Let's look at examples of how to use the CollisionShape constructor:
+
Pick the simplest and most applicable shape for the mesh for what you want to do: If you give a box a sphere collision shape, it will roll; if you give a ball a box collision shape, it will sit on a slope. If the shape is too big, the object will seem to float; if the shape is too small it will seem to sink into the ground. During development and debugging, you can make collision shapes visible by adding the following line after the bulletAppState initialization:
+
+
bulletAppState.getPhysicsSpace().enableDebug(assetManager);
+
+
+
+
-
-
-
-MeshCompoundShape and MeshCollisionShape are both mesh-accurate and are intended for immobile scene entities, such as terrains, buildings, or whole shooter levels. Limitation: Only collisions of non-mesh-accurate shapes (sphere, box, etc) shapes can be detected against mesh-accurate shapes.
-
-
-
CompoundCollisionShape myComplexShape =
+
+ One way of using a constructor and a Geometry's mesh for static Spatials:
MeshCollisionShape level_shape =
+ new MeshCollisionShape(level_geo.getMesh());
+
+
+ One way of using a constructor and a Geometry's mesh for dynamic Spatials:
HullCollisionShape shape =
+ new HullCollisionShape(katamari_geo.getMesh());
+
+
+ Creating a dynamic compound shape for a whole Node and subnodes:
CompoundCollisionShape myComplexShape =
CollisionShapeFactory.createMeshShape((Node) myComplexGeometry );
-
-
-An angular, non-mesh-accurate compound shape:
-
-
CompoundCollisionShape boxShape =
- CollisionShapeFactory.createBoxCompoundShape((Node) someBox);
-
-
-SphereCollisionShape, BoxCollisionShape, CapsuleCollisionShape are also not mesh-accurate, but have better performance. The can be added to anything, and collisions between them and any other shape can be detected.
-
-
SphereCollisionShape sphereShape =
+
+
+ Creating a dynamic HullCollisionShape shape (or CompoundCollisionShape with HullCollisionShapes as children) for a Geometry:
CollisionShape shape =
+ CollisionShapeFactory.createDynamicMeshShape(spaceCraft);
+
+
+ An angular, non-mesh-accurate compound shape:
CompoundCollisionShape boxShape =
+ CollisionShapeFactory.createBoxCompoundShape((Node) crate_geo);
+
+
+ A round, non-mesh-accurate compound shape:
SphereCollisionShape sphereShape =
new SphereCollisionShape(1.0f);
+
+
+
-
+
-BulletPhysics are available in jME3 through Bullet Physics Controls from the com.jme3.bullet.control package. PhysicsControls are the recommended way to use physics in a jME3 application. PhysicsControls are flexible and can be added to any Spatial to make it act according to physical properties. jME's PhysicsControl classes directly extend Bullet Physics objects.
+BulletPhysics are available in jME3 through PhysicsControls classes from the com.jme3.bullet.control package. jME3's PhysicsControl classes directly extend BulletPhysics objects and are the recommended way to use physics in a jME3 application. PhysicsControls are flexible and can be added to any Spatial to make it act according to physical properties.
- Physics Control Purpose
+ Standard PhysicsControls Usage Examples
- RigidBodyControl Use for dynamic physical entities in the scene – things that are freely affected by physical forces such as collisions, forces, or changing gravity. For example: Impacting projectiles, moving obstacles like crates, rolling and bouncing balls, space ships…
+ RigidBodyControl The most commonly used PhysicsControl. You can use it for dynamic objects (solid objects that freely affected by collisions, forces, or gravity), for static objects (solid but not affected by any forces), or kinematic objects (remote-controlled solid objects). Impacting projectiles, moving obstacles like crates, rolling and bouncing balls, elevators, flying aircaft or space ships.
+Solid immobile floors, walls, static obstacles.
- CharacterControl Use for upright characters (persons, animals) that moves and stands orthogonally to the X/Z plane. It is not affected by directional forces or gravity and it does not fall over (as a RigidBodyControl'ed spatial would), a CharacterControl's spatial is permanently locked locked upright (as a walking character would).
+ GhostControl Use for collision and intersection detection between physical objects. A GhostControl itself is non-solid and invisible. GhostControl moves with the Spatial it is attached to. Use GhostControls to implement custom game interactions by adding it to a visible Geometry. A monster's "aggro radius", CharacterControl collisions, motion detectors, photo-electric alarm sensors, poisonous or radioactive perimeters, life-draining ghosts, etc.
+
+
- GhostControl Use for collision and intersection detection between physical entities. A GhostControl is non-solid and invisible, and it moves with the Spatial it is attached to. Use this for interactive game elements that do not have a visible solid Geometry: A monster's "aggro radius", motion detectors, photoelectric alarm sensors, poisonous or radioactive perimeters, life-draining ghosts, etc.
+ Special PhysicsControls Usage Examples
VehicleControl
-PhysicsVehicleWheel Use for vehicles such as cars, tanks, hover crafts, ships, motorcycles.
+PhysicsVehicleWheel Special Control used for "terrestrial" vehicles with suspension and wheels . Cars, tanks, hover crafts, ships, motorcycles…
- RagDollControl Use for collapsing, flailing, or loosely falling characters or with a Ragdoll (or puppet-on-strings) behaviour.
+ CharacterControl Special Control used for Walking Character s. Upright walking persons, animals, robots…
+
+
+ RagDollControl Special Control used for collapsing, flailing, or falling characters Falling persons, animals, robots, "Rag dolls"
-
+
+
+
+Click the links for details on the special PhysicsControls. This article is about RigidBodyControl.
+
+
@@ -252,137 +297,168 @@ PhysicsVehicleWheel Use for joints and hinges to it ("air hook"). The position of a kinematic RigidBodyControl is updated depending on its spatial's translation.
-By default, PhysicsControls are not kinematic.
+ setPhysicsRotation() Rotates the object. Do not use setLocalRotate() for physical objects.
setCcdMotionThreshold(0.1f) The amount of motion in 1 physics tick to trigger the continuous motion detection. Rarely used, but necessary if you need to fiddle with details.
-
-
- CharacterControl Method Property
-
-
- setUpAxis(1) CharacterControls have a fixed upward axis! This means they cannot fall over.
-Values: 0 = X axis , 1 = Y axis , 2 = Z axis.
-Default: 1, because for characters and vehicle, up is typically along the Y axis.
-
-
- setJumpSpeed(1f) Jump speed (movement along up axis)
-
-
- setFallSpeed(1f) Fall speed (movement along negative up axis)
-
-
- setMaxSlope(1.5f) How steep the slopes and steps are that the character can climb without considering them an obstacle. Higher obstacles need to be jumped. In world units.
-
-
- setGravity(1f) The intensity of gravity for this CharacterControl'ed entity. To change the direction of gravity for a character, modify the up axis.
+ setKinematic(true) By default, RigidBodyControls are dynamic (kinematic=false) and are affected by forces. If you set kinematic=true, the object is no longer affected by forces, but it still affects others. A kinematic is solid, and must have a mass.
+(See detailed explanation below.)
-
+
@@ -390,14 +466,14 @@ Default: 1, because for characters and vehicle, up is typically along the Y axis
-All physical entities…
+All physical objects…
- must not overlap.
+ must not overlap.
can detect collisions and report several values about the impact.
- can respond dynamically, or statically, or kinematically to collisions.
+ can respond to collisions dynamically, or statically, or kinematically.
@@ -405,7 +481,7 @@ All physical entities…
Property Static Kinematic Dynamic
- Examples Immobile obstacles: Floors, walls, buildings, … Remote-controlled entities: Airships, meteorites, doors; networked or remote-controlled NPCs; invisible "airhooks" for hinges and joints. Interactive entities: Rolling balls, movable crates, falling pillar, space ship…
+ Examples Immobile obstacles: Floors, walls, buildings, … Remote-controlled solid objects: Airships, meteorites, elevators, doors; networked or remote-controlled NPCs; invisible "airhooks" for hinges and joints. Interactive objects: Rolling balls, movable crates, falling pillars, zero-g space ship…
Does it have a mass? no, 0.0f yes1) , >0.0f yes, >0.0f
@@ -428,45 +504,62 @@ setLocalRotation();setPhysicsLocation();
(Falls when it mid-air? Can be pushed by others?) no no yes
- How to activate? setMass(0f);
+ How to activate this behaviour? setMass(0f);
setKinematic(false); setMass(1f);
setKinematic(true); setMass(1f);
setKinematic(false);
-
+
+
+
+
+
+
+ Kinematics are solid and characters can "stand" on them.
+
+ When they collide, Kinematics push dynamic objects, but a dynamic object never pushes a Kinematic.
+
+ You can hang kinematics up "in mid-air" and attach other PhysicsControls to them using
hinges and joints . Picture them as "air hooks" for flying aircraft carriers, floating islands in the clouds, suspension bridges, swings, chains…
+
+ You can use Kinematics to create mobile remote-controlled physical objects, such as moving elevator platforms, flying blimps/airships. You have full control how Kinematics move, they never "fall" or "topple over".
+
+
+
-
You move Spatials with a kinematic RigidBodyControl programmatically, that is by using setLocalTranslation() or move() in the update() loop, or using a
MotionPath . You can also "hang them up in mid-air" and attach other PhysicsControls to them using
hinges and joints .
+
+
The position of a kinematic RigidBodyControl is updated automatically depending on its spatial's translation. You move Spatials with a kinematic RigidBodyControl programmatically, that means you write translation and rotation code in the update loop. You describe the motion of kinematic objects either by using methods such as
setLocalTranslation() or
move(), or by using a
MotionPath .
-
+
-Use the following methods to move physics entities.
+Use the following methods to move dynamic physical objects.
+
PhysicsControl Method Motion
- setLinearVelocity(new Vector3f(0f,0f,1f)) Set the linear speed of this entity.
+ setLinearVelocity(new Vector3f(0f,0f,1f)) Set the linear speed of this object.
- setAngularVelocity(new Vector3f(0f,0f,1f)) Set the rotational speed of the entity; the x, y and z component are the speed of rotation around that axis.
+ setAngularVelocity(new Vector3f(0f,0f,1f)) Set the rotational speed of the object; the x, y and z component are the speed of rotation around that axis.
- applyCentralForce(…) Move (push) the entity once with a certain moment, expressed as a Vector3f.
+ applyCentralForce(…) Move (push) the object once with a certain moment, expressed as a Vector3f.
- applyForce(…) Move (push) the entity once with a certain moment, expressed as a Vector3f. Optionally, you can specify where on the entity the pushing force hits.
+ applyForce(…) Move (push) the object once with a certain moment, expressed as a Vector3f. Optionally, you can specify where on the object the pushing force hits.
- applyTorque(…) Rotate (twist) the entity once around its axes, expressed as a Vector3f.
+ applyTorque(…) Rotate (twist) the object once around its axes, expressed as a Vector3f.
applyImpulse(…) An idealised change of momentum. This is the kind of push that you would use on a pool billiard ball.
@@ -475,71 +568,73 @@ Use the following methods to move physics entities.
applyTorqueImpulse(…) An idealised change of momentum. This is the kind of push that you would use on a pool billiard ball.
- setWalkDirection(new Vector3f(0f,0f,0.1f)) (CharacterControl only) Make a physical character walk. CharacterControls are locked upright to prevent falling over. Use setWalkDirection(Vector3f.ZERO) to stop a directional motion.
-
-
- clearForces() Cancels out all forces (force, torque) etc and stops the motion.
+ clearForces() Cancels out all forces (force, torque) etc and stops the motion.
-
+
-
It is technically possible to position PhysicsControls using setLocalTranslation(), e.g. to place them in their start position in the scene. However you must be very careful not to cause an "impossible state" where one physical entity overlaps with another! Within the game, you typically use the setters shown here exclusively.
+
It is technically possible to position PhysicsControls using setLocalTranslation(), e.g. to place them in their start position in the scene. However you must be very careful not to cause an "impossible state" where one physical object overlaps with another! Within the game, you typically use the setters shown here exclusively.
-PhysicsControls also supports the following features:
+PhysicsControls also support the following advanced features:
+
PhysicsControl Method Property
- setCollisionShape(collisionShape) Changes the collision shape.
+ setCollisionShape(collisionShape) Changes the collision shape after creation.
setCollideWithGroups()
setCollisionGroup()
addCollideWithGroup(COLLISION_GROUP_01)
-removeCollideWithGroup(COLLISION_GROUP_01) Collision Groups are integer bit masks – enums are available in CollisionObject. All physics entities are by default in COLLISION_GROUP_01. Two entities collide when the collideWithGroups set of one contains, the Collision Group of the other.
+removeCollideWithGroup(COLLISION_GROUP_01)Collision Groups are integer bit masks – enums are available in the CollisionObject. All physics objects are by default in COLLISION_GROUP_01. Two objects collide when the collideWithGroups set of one contains the Collision Group of the other. Use this to improve performance by grouping objects that will never collide in different groups (the the engine saves times because it does not need to check on them).
- setDamping(float, float) The first value is the linear threshold and the second the angular.
+ setDamping(float, float) The first value is the linear threshold and the second the angular. This simulates dampening of forces, for example for underwater scenes.
- setAngularFactor(1f) Set the amount of rotation that will be applied. A value of zero will cancel all rotational force outcome.
+ setAngularFactor(1f) Set the amount of rotation that will be applied. A value of zero will cancel all rotational force outcome. (?)
- setCcdSweptSphereRadius() ?
+ setSleepingThreshold(float,float) Sets the sleeping thresholds which define when the object gets deactivated to save resources. The first value is the linear threshold and the second the angular. Low values keep the object active when it barely moves (slow precise performance), high values put the object to sleep immediately (imprecise fast performance). (?)
- setSleepingThreshold(float,float) Sets the sleeping thresholds which define when the entity gets deactivated to save resources. Low values keep the entity active when it barely moves. The first value is the linear threshold and the second the angular.
+ setCcdMotionThreshold(0f) Sets the amount of motion that has to happen in one physics tick to trigger the continuous motion detection. This avoids the problem of fast objects moving through other objects. Set to zero to disable (default).
+
+
+ setCcdSweptSphereRadius(.5f) Bullet does not use the full collision shape for continuous collision detection, insteadit uses a "swept sphere" shape to approximate a motion. Only relevant for fast moving dynamic bodies. (?)
-
+
- You can control the game by triggering forces; or may want to respond to collisions, e.g. by substracting health points, or by playing a sound. To specify how the game responds to physics events, you use
Physics Listeners .
+ Multiple Objects Too Slow? Do not overuse PhysicsControls. Although PhysicsControls are put to “sleep” when they are not moving, creating a world solely out of dynamic physics objects will quickly bring you to the limits of your computer's capabilities.
+Solution: Improve performance by replacing some physical Spatials with non-physical Spatials. Use the non-physical ones for non-solid things for which you do not need to detect collisions – foliage, plants, effects, ghosts, all remote or unreachable objects.
- You can use normal non-physical Spatials in the same scene next to physical ones. Use the non-physical ones for non-solid things for which you do not want to detect collisions (ghost, foliage, plants, effects, …). This improves performance.
+ Buggy? If you get weird behaviour, such as physical nodes jittering wildy and being ejected "for no apparent reason", it means you have created an impossible state – solid objects overlapping. This can happen when you position solid spatials too close to other solid spatials, e.g. when moving them with setLocalTranslation().
+
Solution: Use the debug mode to make CollisionShapes visible and verify that CollisionShapes do not overlap.
bulletAppState.getPhysicsSpace().enableDebug(assetManager);
+
- If you get weird behaviour, such as physical nodes jittering wildy and being ejected "for no apparent reason", it usually means you have created an impossible state. Verify that none of the collision shapes overlap. This can happen when you create physical nodes in positions that are too close to other nodes; or if you position a physical node using setLocalTranslation() and it touches another node's collision shape.
-
-
-
- For large static meshes like shooter levels or terrain it is best to divide the scene model into multiple physics entities, with each its own CollisionShape. A huge city level should not be one huge mesh (model) of pavement and streets and buildings. Instead, you make individual models for buildings, for pieces of pavement, for pieces of streets, etc. Position them next to one another to form the whole city, and give each piece its own optimal CollisionShape. E.g. streets can use a fast PlaneCollisionShape if you keep them separate for buildings. Breaking the level into manageable pieces helps the engine improve performance: The less CPU-intensive
can now filter out parts of the scene that are behind you or out of reach, and it only calculates the details of collisions for parts that are actually close to the action.
+ Need more interactivity? You can actively
control a physical game by triggering forces. You may also want to be able
respond to collisions, e.g. by substracting health, awarding points, or by playing a sound.
+
Solution: To specify how the game responds to collisions, you use
Physics Listeners .
@@ -551,6 +646,6 @@ removeCollideWithGroup(COLLISION_GROUP_01) Collision Groups are integer
1)
-Inertia is calculated for kinematic entities, and you need mass to do that.
+Inertia is calculated for kinematic objects, and you need mass to do that.
view online version
\ No newline at end of file
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..4d68a4b0e 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
@@ -3,19 +3,72 @@
-You can control physical objects by triggering forces. Or maybe you want to respond to collisions, e.g. by substracting health points, or by playing a sound. To specify how the game responds to such physics events, you use Physics Listeners.
-
+You can control physical objects (push them around) by applying physical forces to them. Typically, you also want to respond to the resulting collisions, e.g. by substracting health points or by playing a sound. To specify how the game responds to such physics events, you use Physics Listeners.
+
+
+
+
+
+
+
+
+Attach a com.jme3.bullet.control.GhostControl to any Spatial to turn it into a PhysicsGhostObject. Ghost objects automatically follow their spatial and detect collisions. The attached ghost itself is invisible and non-solid (!) and doesn't interfere with your game otherwise, it only passively reports collisions.
+
+
+
+You can leave the GhostControl non-solid and invisible and attach it to an (invisible) Node in the scene to create something like a motion detector. But a GhostControl also works fine when added to spatials that are solid (with RigidBodyControl) and visible (with Geometry). One use case for GhostControls is to check for collisions among CharacterControls when the characters are walking.
+
+
+
+The shape of the ghost depends on the CollisionShape that you gave the GhostControl. This means that the GhostControl's shape can be different from the RigidBodyControl's shape. For example, the non-solid ghost shape can be bigger than the solid shape of the Spatial (so you can "feel" ahead).
+
+
GhostControl ghost = new GhostControl(
+ new BoxCollisionShape(new Vector3f(1,1,1))); // a box-shaped ghost
+Node node = new Node("a ghost-controlled thing");
+node.addControl(ghost); // the ghost follows this node
+// Optional: Add a Geometry, or other controls, to the node if you need to
+...
+// attach everything to activate it
+rootNode.attachChild(node);
+getPhysicsSpace().add(ghost);
+
+
+ Ghost methods Usage
+
+
+ getOverlappingObjects() Returns the List of objects that are currently colliding (overlapping) with the ghost.
+
+
+ getOverlappingCount() Returns the number of currently colliding objects.
+
+
+ getOverlapping(i) Get PhysicsCollisionObject number i.
+
+
+
+
+
+
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.
-
@@ -24,10 +77,16 @@ Applying forces or checking for overlaps only has an effect right at a physics u
-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.
+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 two physical objects using a GhostControl, you cannot just go ghost.getOverLappingObjects() somewhere outside the update loop. You have to make certain 1 physics tick has passed before the overlapping objects list is filled with data. Again, the PhysicsTickListener does the timing for you.
+
+
+
+When your game mechanics however just poll the current state (e.g. getPhysicsLocation()) of physical objects, or if you only use the GhostControl like a sphere trigger inside an update loop, then you don't need an extra PhysicsTickListener.
@@ -36,28 +95,31 @@ When your game mechanics however just poll the current state (e.g. location) of
-Here's is the declaration of an examplary Physics Control that listens to ticks.
+Here's is the declaration of an examplary Physics Control that listens to ticks. (The example shows a RigidBodyControl, but it can also be GhostControl.)
public class MyCustomControl
extends RigidBodyControl implements PhysicsTickListener { ... }
-
-When you implement the interface, you have to implement preTick() and postTick() methods.
+When you implement the interface, you have to implement physicsTick() and preTick() methods.
- prePhysicsTick() is called before the step, here you apply forces (change the state).
+ prePhysicsTick(PhysicsSpace space, float tpf) is called before each step, here you apply forces (change the state).
- physicsTick() is called after the step, here you poll the results (get the current state).
+ physicsTick(PhysicsSpace space, float tpf) is called after each step, here you poll the results (get the current state).
+
+
+The tpf value is time per frame in seconds. You can use it as a factor to time actions so they run equally on slow and fast machines.
+
@override
-public void prePhysicsTick(PhysicsSpace space, float f){
+public void prePhysicsTick(PhysicsSpace space, float tpf){
// apply state changes ...
}
@override
-public void physicsTick(PhysicsSpace space, float f){
+public void physicsTick(PhysicsSpace space, float tpf){
// poll game state ...
}
@@ -72,7 +134,11 @@ public void physicsTick(PhysicsSpace space, float f){
-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 you do not implement the Collision Listener interface (com.jme3.bullet.collision.PhysicsCollisionListener), a collisions will just mean that physical forces between solid objects are applied automatically. If you just want "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:
@@ -94,11 +160,10 @@ If however you want to respond to a collision event (com.jme3.bullet.collision.P
-You need to add the PhysicsCollisionListener to the physics space before collisions will be listened for. Again, here's the example declaration of a Physics Control that uses a collision listener.
+You need to add the PhysicsCollisionListener to the physics space before collisions will be listened for. Here's an example of a Physics Control that uses a collision listener. (The example shows a RigidBodyControl, but it can also be GhostControl.)
-
public class MyCustomControl
- extends RigidBodyControl
+public class MyCustomControl extends RigidBodyControl
implements PhysicsCollisionListener {
public MyCustomControl() {
bulletAppState.getPhysicsSpace().addCollisionListener(this);
@@ -106,10 +171,11 @@ You need to add the PhysicsCollisionListener to the physics space before collisi
}
+To respond to the PhysicsCollisionEvent you now have to override the collision() method in MyCustomControl. This gives you access to the event object. Mostly you will be interested in the identity of any two nodes that collided: event.getNodeA() and event.getNodeB().
+
-To respond to the PhysicsCollisionEvent you have to override the collision() method. This gives you access to the event object. Mostly you will be interested in the identity of any two nodes that collided: event.getNodeA() and event.getNodeB().
+
After you identify the colliding nodes, specify the action to trigger when this pair collides. Note that you cannot know which one will be Node A or Node B, you have to deal with either variant.
-
public void collision(PhysicsCollisionEvent event) {
if ( event.getNodeA().getName().equals("player") ) {
@@ -125,7 +191,6 @@ After you identify the colliding nodes, specify the action to trigger when this
Note that after the collision() method ends, the PhysicsCollisionEvent is cleared. You must get all objects and values you need within the collision() method.
-
@@ -134,6 +199,7 @@ After you identify the colliding nodes, specify the action to trigger when this
+
The PhysicsCollisionEvent event gives you access to detailed information about the collision. You already know the event objects can identify which nodes collided, but it even knows how hard they collided:
@@ -160,11 +226,26 @@ getObjectB() The two participants in the collision. You cannot kno
getCombinedRestitution() A float value representing the collision restitution (bounciness)
-
+
Note that after the collision method has been called the object is not valid anymore so you should copy any data you want to keep into local variables.
-
+
+
+
+
+
+
+
+
+You can improve performance by resricting the number of tests that collision detection has to perform. If you have a case where you are only interested in collisions between certain objects but not others, you can assign sets of physical obejcts to different collision groups.
+
+
+
+For example, for a click-to-select, you only care if the selection ray collides with a few selectable objects such as dropped weapons or powerups (one group), but not with non-selectables such as floors or walls (different group).
+
+
myNode.getControl(RigidBodyControl.class).setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_02);
+myNode.getControl(RigidBodyControl.class).setCollideWithGroups(PhysicsCollisionObject.COLLISION_GROUP_02);
documentation ,
physics ,
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/post-processor_water.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/post-processor_water.html
index fb5294186..6a45e4620 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/post-processor_water.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/post-processor_water.html
@@ -11,6 +11,10 @@ The awesome SeaMonkey water Filter is highly configurable. It can render any typ
+
+Need simpler water ?
+
+
@@ -171,7 +175,7 @@ manager.loadTexture("Textures/wavenormals.png") )
This normal
water.setNormalScale(0.5f) Sets the normal scaling factors to apply to the normal map. The higher the value, the more small ripples will be visible on the waves. 1.0f
-
+
Water method example Effects: Color Default
@@ -196,7 +200,7 @@ Vector3f(0.0f, 0.0f,0.2f,1.0f)
water.setColorExtinction(new Vector3f(10f,20f,30f)); Sets At what depth the refraction color extincts. The three values are RGB (red, green, blue) in this order. Play with these parameters to "muddy" the water. Vector3f(5f,20f,30f)
-
+
Water method example Effects: Shore Default
@@ -207,7 +211,7 @@ Vector3f(0.0f, 0.0f,0.2f,1.0f)
water.setUseHQShoreline(false); Renders shoreline with better quality ? true
-
+
Water method example Effects: Foam Default
@@ -225,7 +229,7 @@ Vector3f(0.0f, 0.0f,0.2f,1.0f)
manager.loadTexture("Textures/foam.png") )This foam texture will be used with WrapMode.Repeat "Common/MatDefs/Water/Textures/foam.jpg"
-
+
Water method example Effects: Light Default
@@ -251,7 +255,7 @@ manager.loadTexture("Textures/foam.png") )This foam texture w
water.setReflectionMapSize(256) Sets the size of the reflection map. The higher, the better the quality, but the slower the effect. 512
-
+
@@ -272,6 +276,8 @@ See also:
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..fd2034c45 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
@@ -48,6 +48,11 @@ camNodeSide.getControl(0).setEnabled(false);
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..1738e0e57 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
@@ -4,7 +4,12 @@
-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 .
+Spatials can contain Nodes, Geometries, and user data (player score, health, inventory, etc). You can save and load individual Nodes or Geometries, as well as whole scenes using com.jme3.export.binary.BinaryExporter and com.jme3.export.binary.BinaryImporter. The jMonkeyEngine's serialization system is the com.jme3.export.Savable interface; the jMonkeyEngine's binary file format is called .j3o. You can open, view, and edit .j3o files in the jMonkeyEngine SDK .
+
+
+
+
JME's BinaryExporter/BinaryImporter can read and write standard Java objects, JME objects, and primitive data types that are included in a
spatial's user data . See below how to make additional custom classes "Savable".
+
@@ -20,47 +25,99 @@ You can save and load scenes and individual Nodes using com.jme3.export.binary.B
-
@Override
+
+
+
+The following example overrides destroy() to save the rootNode to a file when the user quits the application. The saved rootNode is a normal .j3o binary file that you open in the SDK .
+
+
+
+
Note that when you save a model that has textures the textures are references to those textures are stored as absolute paths, so when loading the j3o file they have to be accessible at the exact location (relative to the assetmanager root) they were loaded from. This is why the
SDK manages the conversion on the project level.
+
+
+ /* This is called when the user quits the app. */
+ @Override
public void destroy() {
System.getProperty("user.home");
BinaryExporter exporter = BinaryExporter.getInstance();
- File(userHome+"/somefile.j3o");
+ File(userHome+"/MySuperGame/"+"LastSavedGame.j3o");
try {
exporter.save(rootNode, file);
} catch (IOException ex) {
- Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Failed to save node!", ex);
+ Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Error: Failed to save game!", ex);
}
- super.destroy();
+ super.destroy(); // continue quitting the game
}
+
+
You can add a timestamp to your saved files:
+
+
long timestamp = System.currentTimeMillis()/1000;
+File(userHome+"/MySuperGame/"+"/SavedGame-"+timestamp+".j3o");
+
+
+
+
+
+
+
+
+
+The following example uses simpleInitApp() to load the last saved game when the game is initialized.
+
@Override
public void simpleInitApp() {
System.getProperty("user.home");
BinaryImporter importer = BinaryImporter.getInstance();
importer.setAssetManager(assetManager);
- File(userHome+"/somefile.j3o");
- try {
- Node loadedNode = (Node)importer.load(file);
- loadedNode.setName("loaded node");
- rootNode.attachChild(loadedNode);
- } catch (IOException ex) {
- Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "No saved node loaded.", ex);
+ File(userHome+"/MySuperGame/"+"LastSavedGame.j3o");
+ if(file.exists()){
+ try {
+ Node loadedNode = (Node)importer.load(file);
+ loadedNode.setName("loaded node");
+ rootNode.attachChild(loadedNode);
+ } catch (IOException ex) {
+ Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Could not load saved game.", ex);
+ }
+ else {
+ // No previous game. Create new game, or let user browse to file, etc...
}
- ...
+
+
Here you see why we save user data inside spatials – so it can be saved and loaded together with the .j3o file. If you have game data outside Spatials, you have to remember to save() and load(), and get() and set() it yourself.
+
+
+
-
+
-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.
+JME's BinaryExporter/BinaryImporter can read and write standard Java objects (String, ArrayList, buffers, etc), JME objects (Savables, such as Material), and primitive data types (int, float, etc). If you are using any custom class together with a Spatial, then the custom class must implement the com.jme3.export.Savable interface. There are two common cases where this is relevant:
+
+
+
+
+
+If your custom classes (the user data or the Controls) do not implement Savable, then the BinaryImporter/BinaryExporter cannot save the Spatial!
+
+
+
+So every time you create a custom Control or custom user data class, remember to implement Savable:
import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
@@ -71,9 +128,9 @@ import com.jme3.material.Material;
import java.io.IOException;
public class MyCustomClass implements Savable {
- private int someIntValue;
- private float someFloatValue;
- private Material someJmeObject;
+ private int someIntValue; // some custom user data
+ private float someFloatValue; // some custom user data
+ private Material someJmeObject; // some custom user data
...
// your other code...
@@ -95,12 +152,16 @@ public class MyCustomClass implements Savable {
}
-For each class field that you want to save and load,
+To make a custom class savable:
+
+ Implement Savable and add the write() and read() methods as shown in the example above.
+
+ Do the following for each non-temporary class field:
+
+
+
+
+
+
As with all serialization, remember that if you ever change data types in custom classes, the updated read() methods will no longer be able to read your old files.
+
+
view online version
\ No newline at end of file
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/shape.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/shape.html
index c103d3fb0..ea35260a1 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/shape.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/shape.html
@@ -58,7 +58,7 @@ The simplest type of Meshes are the built-in JME Shapes. You can create Shapes w
- com.jme3.scene.shape.Quad – A flat 2D rectangle (has two sides)
+ com.jme3.scene.shape.Quad – A flat 2D rectangle (single-sided, center is in bottom-left corner)
com.jme3.scene.shape.Line – A straight 1D line defined by a start and end point.
@@ -68,12 +68,12 @@ The simplest type of Meshes are the built-in JME Shapes. You can create Shapes w
-
+
-Do not mix up these visible Shapes with similarly named classes from the maths package. Choose the right package when letting your IDE fill in the import statements!
+Do not mix up these visible com.jme3.shapes with similarly named classes from the com.jme3.math package. Choose the right package when letting your IDE fill in the import statements!
-
+
@@ -472,6 +472,10 @@ Let's add some action to the scene and continue with the ( )
+
+
+
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..cadc76217 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,5 +1,5 @@
-
+
@@ -294,7 +294,7 @@ Typically, you stream long sounds, and buffer short sounds.
The same sound cannot play twice at the same time. The same sounds can play multiple times and overlap.
-
+
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..cd8acdc6b 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,5 +1,5 @@
-
+
@@ -149,13 +149,13 @@ public class HelloCollision extends SimpleApplication
* We do not walk yet, we just keep track of the direction the user pressed. */
public void onAction(String binding, boolean value, float tpf) {
if (binding.equals("Left")) {
- if (value) { left = true; } else { left = false; }
+ left = value;
} else if (binding.equals("Right")) {
- if (value) { right = true; } else { right = false; }
+ right = value;
} else if (binding.equals("Up")) {
- if (value) { up = true; } else { up = false; }
+ up = value;
} else if (binding.equals("Down")) {
- if (value) { down = true; } else { down = false; }
+ down = value;
} else if (binding.equals("Jump")) {
player.jump();
}
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 e025e1670..74704d139 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,5 +1,5 @@
-
+
@@ -193,7 +193,7 @@ The following particle textures included in test-data.jar. You can
Effects/Smoke/Smoke.png 1*15
-
+
Copy them into you assets/Effects directory to use them.
@@ -318,7 +318,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..4218dda97 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,5 +1,5 @@
-
+
@@ -9,7 +9,7 @@ Next: Hello
-By default, SimpleApplication sets up an input system that allows you to steer the camera with the WASD keys, the arrow keys, and the mouse. You can use it as a flying first-person camera right away. But what if you need a third-person camera, or you want keys to trigger special game actions?
+By default, SimpleApplication sets up a camera control that allows you to steer the camera with the WASD keys, the arrow keys, and the mouse. You can use it as a flying first-person camera right away. But what if you need a third-person camera, or you want keys to trigger special game actions?
@@ -227,6 +227,41 @@ In this example, we trigger the following actions:
}
};
+
+You can also combine both listeners into one, the engine will send the appropriate events to each method (onAction or onAnalog). For example:
+
+
+
private MyCombinedListener combinedListener = new MyCombinedListener();
+
+ private static class MyCombinedListener implements AnalogListener, ActionListener {
+ public void onAction(String name, boolean keyPressed, float tpf) {
+ if (name.equals("Pause") && !keyPressed) {
+ isRunning = !isRunning;
+ }
+ }
+
+ public void onAnalog(String name, float value, float tpf) {
+ if (isRunning) {
+ if (name.equals("Rotate")) {
+ player.rotate(0, value*speed, 0);
+ }
+ if (name.equals("Right")) {
+ Vector3f v = player.getLocalTranslation();
+ player.setLocalTranslation(v.x + value*speed, v.y, v.z);
+ }
+ if (name.equals("Left")) {
+ Vector3f v = player.getLocalTranslation();
+ player.setLocalTranslation(v.x - value*speed, v.y, v.z);
+ }
+ } else {
+ System.out.println("Press P to unpause.");
+ }
+ }
+ }
+// ...
+inputManager.addListener(analogListener, new String[]{"Pause", "Left", "Right", "Rotate"});
+
+
It's okay to use only one of the two Listeners, and not implement the other one, if you are not using this type of interaction. In the following, we have a closer look how to decide which of the two listeners is best suited for which situation.
@@ -319,7 +354,7 @@ You can find the list of input constants in the files
src/core/com/jme3/in
KeyTrigger(KeyInput.KEY_LEFT), KeyTrigger(KeyInput.KEY_RIGHT)
-
+
Tip: If you don't recall an input constant during development, you benefit from an IDE's code completion functionality: Place the caret after e.g. KeyInput.| and trigger code completion to select possible input identifiers.
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..c3b6bdf24 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,5 +1,5 @@
-
+
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 49a4a9a2f..81bb44267 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,8 +1,9 @@
-
+
+
Previous: Hello Input System ,
Next: Hello Animation
@@ -81,7 +82,10 @@ public class HelloMaterial extends SimpleApplication {
Material mat_lit = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat_lit.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg"));
mat_lit.setTexture("NormalMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png"));
- mat_lit.setFloat("Shininess", 5f); // [1,128]
+ mat_lit.setBoolean("UseMaterialColors",true);
+ mat_lit.setColor("Specular",ColorRGBA.White);
+ mat_lit.setColor("Diffuse",ColorRGBA.White);
+ mat_lit.setFloat("Shininess", 5f); // [1,128]
shiny_rock.setMaterial(mat_lit);
shiny_rock.setLocalTranslation(0,2,-2); // Move it a bit
shiny_rock.rotate(1.6f, 0, 0); // Rotate it a bit
@@ -295,7 +299,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.
@@ -413,7 +417,7 @@ Now that you know how to load models and how to assign good-looking materials to
See also
-
+
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..e5ff85595 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,5 +1,5 @@
-
+
@@ -125,7 +125,7 @@ In this tutorial, you learn some new terms:
Position/move, turn, or resize an object Translate, 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.
@@ -152,7 +152,7 @@ Every JME3 application has a rootNode: Your game automatically inherits the Examples: A box, a sphere, a player, a building, a piece of terrain, a vehicle, missiles, NPCs, etc… The rootNode, a floor node grouping several terrains, a custom vehicle-with-passengers node, a player-with-weapon node, an audio node, etc…
-
+
@@ -293,7 +293,7 @@ thing.setMaterial(mat);
Specify what should be loaded at the start Everything you initialize and attach to the rootNode in the simpleInitApp() method is part of the scene at the start of the game.
-
+
@@ -319,7 +319,7 @@ To move a Spatial to specific coordinates, such as (0,40.2f,-2), use: <
+right -left +up -down +forward -backward
-
+
Scaling resizes Spatials X-axis Y-axis Z-axis
@@ -331,7 +331,7 @@ To scale a Spatial 10 times longer, one tenth the height, and keep the same widt
length height width
-
+
Rotation turns Spatials X-axis Y-axis Z-axis
@@ -347,7 +347,7 @@ To roll an object 180° around the z axis: thing.rotate( 0f , 0f , 180*
pitch = nodding your head yaw = shaking your head roll = cocking your head
-
+
@@ -378,7 +378,7 @@ Did you rotate around the right axis?
A Geometry has an unexpected Color or Material. Did you reuse a Material from another Geometry and have inadvertently changed its properties? (If so, consider cloning it: mat2 = mat.clone(); )
-
+
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_physics.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_physics.html
index 45e05c41f..048459f9a 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_physics.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_physics.html
@@ -1,5 +1,5 @@
-
+
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_picking.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_picking.html
index 38bd0b403..6b76ad26f 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_picking.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_picking.html
@@ -1,8 +1,9 @@
-
+
+
Previous: Hello Animation ,
Next: Hello Collision
@@ -395,7 +396,7 @@ Vector2f click2d = inputManager.getCursorPosition();
Vector3f click3d = cam.getWorldCoordinates(
new Vector2f(click2d.x, click2d.y), 0f).clone();
Vector3f dir = cam.getWorldCoordinates(
- new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d);
+ new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d).normalizeLocal();
Ray ray = new Ray(click3d, dir);
shootables.collideWith(ray, results);
...
diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_simpleapplication.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_simpleapplication.html
index f1b976770..d58667a43 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_simpleapplication.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/beginner/hello_simpleapplication.html
@@ -1,5 +1,5 @@
-
+
@@ -211,7 +211,7 @@ This code opens your application window. Let's learn how you put something
You want the cube to appear in the center. I create the Box at the origin = at Vector3f.ZERO.
-
+
If you are unfamiliar with the vocabulary, read more about the Scene Graph here.
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 825eade41..3b2ce8e84 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
@@ -1,5 +1,5 @@
-
+
@@ -15,6 +15,10 @@ One way to create a 3D landscape is to sculpt a huge terrain model. This gives y
+
+Note: If you get an error when trying to create your ImageBasedHeightMap object, you may need to update the SDK , click on "Help" / "Check for updates"
+
+
@@ -32,7 +36,6 @@ import com.jme3.terrain.heightmap.HillHeightMap; // for exercise 2
import com.jme3.terrain.heightmap.ImageBasedHeightMap;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture.WrapMode;
-import jme3tools.converters.ImageToAwt;
import java.util.ArrayList;
import java.util.List;
@@ -470,8 +473,7 @@ The following two lines generate the heightmap object based on your user-defined
Texture heightMapImage = assetManager.loadTexture(
"Textures/Terrain/splat/mountains512.png");
- heightmap = new ImageBasedHeightMap(
- ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 1f);
+ heightmap = new ImageBasedHeightMap(heightMapImage.getImage());
Instead, you can also let JME3 generate a random landscape for you:
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..903636369 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
@@ -40,6 +40,12 @@ We recommend downloading the this list
.
+
+
@@ -51,6 +57,10 @@ 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/build_jme3_sources_with_netbeans.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_jme3_sources_with_netbeans.html
index 1c7667ec3..5e538a7ad 100644
--- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_jme3_sources_with_netbeans.html
+++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/build_jme3_sources_with_netbeans.html
@@ -1,5 +1,5 @@
-
+
@@ -59,37 +59,10 @@ j-ogg-vorbisd.jar asm-all-3.1.jar jbullet.jar
jheora-jst-debug-0.6.0.jar xmlpull.xpp3-1.1.4c.jar
nifty*.jar eventbus-1.4.jar
-
-
-
-
-
-
-Work in progress …
+For a detailed description of the separate jar files see this list .
-
-A jme3 application can either be deployed to the desktop (as Java Swing application) and web browser (as JNLP/WebStart or Applet), or to an Android phone. While the former is the default, switching to Android deployment can be done in a few steps.
-
-
-
- Open Project Properties, go to Sources category.
-
- At Source Packages Folders, click "Add Folder".
-
- Add src/android/
-
- Remove src/desktop
-
- Remove src/desktop_fx
-
-
-
- build.xml…
-
-
-
@@ -173,13 +146,17 @@ If you are working on a game project that depends on jme3:
This tip works for any third-party JAR library that you use. (You may have to download the javadoc/sources from their home page separately).
+
-
-Sources used: ,
+Sources used: ,
+
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 27e15547f..343c9bbff 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
@@ -31,9 +31,34 @@ Extend com.jme3.app.SimpleApplication.
-Yes! For your own games, you should create a custom base class that extends class, configure application settings , and customize away.
+Yes! For your own games, you create a custom base class that extends class, so it's no longer a "simple" application. Configure your application settings , and customize away.
Learn more: SimpleApplication , AppSettings .
+
+
+
+
+
+
+
+
+
+You should break app your application logic into components by spreading it out over individual AppStates. AppStates can be attached to and detached from the game. AppStates have access to all objects (rootNode, PhysicsSpace, inputManager, etc) and methods in your main application. So each AppState can bring its own subset of input handlers, GUI nodes, spatial nodes, and even its own subset of game mechanics in the update() loop.
+
+Learn more: Application States .
+
+
+
+
+
+
+
+
+
+You split up your application into several AppStates and implement the setEnabled() methods for each state. Then you create, for example, a GameRunningAppState and a GamePausedAppState. GamePausedAppState's job is to attach all your AppStates that contain the logic and GUI of the pause screen, and to detach all the AppStates that contain logic and GUI of the running game. GameRunningAppState does the opposite. By attaching one or the other to the game, you switch between the paused and unpaused states.
+
+Learn more: Application States .
+
@@ -57,6 +82,19 @@ For the release, switch the severity level of the default logger to print only S
Learn more: Logging .
+
+
+
+
+
+
+
+
+
+Make sure to only load() models converted to .j3o binary format, not the original Ogre or Wavefront formats. If you load assets from zip files, make sure to ammend the build script to copy them ito the build.
+
+Learn more: Asset Manager
+
@@ -98,8 +136,8 @@ Optionally, you can control whether the engine culls an object always or never.
First check whether the file path of the asset is correct. By default it is relative to your project's assets directory:
-// To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.mesh.xml
-Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");
+// To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.j3o
+Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.j3o");
@@ -107,7 +145,7 @@ If you are not using the default assets directory, verify that you
this.assetManager.registerLocator("assets/", FileLocator.class); // default
-this.assetManager.registerLocator("c:/jme3User/JMEisSoCool/myAwesomeFolder", FileLocator.class);
+this.assetManager.registerLocator("c:/jme3User/JMEisSoCool/myAwesomeFolder/", FileLocator.class);
this.assetManager.registerLocator("town.zip", ZipLocator.class.getName());
@@ -117,13 +155,17 @@ this.assetManager.registerLocator("town.zip", ZipLocator.class.get
-
+
-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.
+Follow our best practices for the multi-media asset pipeline .
+
+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.
+You create textures in a graphic editor, for exmaple Gimp, and export them as PNG or JPG .
+You create sounds in an audio editor, for example, Audacity, and export them as WAVE or OGG.
-Learn more: 3D Models , , , .
+Learn more: 3D Models , , , , Multi-Media Asset Pipeline .
@@ -135,8 +177,8 @@ You create 3-D models in a 3-D mesh editor, for example Blender, and export it i
Use the jMonkeyEngine 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");
+// To load .../jMonkeyProjects/MyGame/assets/Models/Ninja/Ninja.j3o
+Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.j3o");
@@ -184,7 +226,7 @@ To move or turn or resize a spatial you use transformations. You can concatenate
-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.
+Change the geometry's translation (position) live in the update loop using setLocalTranslation() for non-physical and applyForce() or setWalkDirection() for physical objects. You can also define and remote-control a spatial's motion using Cinematics , e.g. to record cutscenes, or to implement mobile platforms, elevators, airships, etc.
Learn more: Hello Loop , Update Loop , Custom Controls , Cinematics
@@ -262,7 +304,7 @@ You can choose among various com.jme3.texture.Texture.WrapModes for
Use the AssetManager to load Materials, and change material settings.
-Learn more: Hello Material , Materials Overview , Asset Manager
+Learn more: Hello Material , How To Use Materials , Materials Overview , Asset Manager .
Code sample: , .
@@ -273,9 +315,9 @@ Use the AssetManager to load Materials, and change material settings.
-Create Textures as image files. Use the AssetManager to load a Material and set the material's texture maps.
+Create Textures as image files. Use the AssetManager to load a Material and use texture mapping for improved looks.
-Learn more: Hello Material , Materials Overview , Asset Manager , ,
+Learn more: Hello Material , How To Use Materials , Materials Overview , Asset Manager , ,
Code sample:
@@ -286,7 +328,7 @@ Create Textures as image files. Use the AssetManager to load a Material and set
-If you use a lit material (based on Lighting.j3md) then you must attach a light source to the rootNode, otherwise you see nothing. If you use lit material colors, make sure you have specified an Ambient color (can be the same as the Diffuse color) if you use an AmbientLight. If you see objects, but they are gray or too dark, set the light color to white, or make it brighter (you can multiply the color value with a scalar), or add a global light source (AmbientLight). Similarly, if everything is white, tune down the lights. If materials flicker under a directional light, change the light direction vector. Change the background color (which is independent of light sources) to get a better contrast while debugging a light problem.
+If you use a lit material (based on Lighting.j3md) then you must attach a light source to the rootNode, otherwise you see nothing. If you use lit material colors, make sure you have specified an Ambient color (can be the same as the Diffuse color) if you use an AmbientLight. If you see objects, but they are gray or too dark, set the light color to white, or make it brighter (you can multiply the color value with a scalar), or add a global white light source (AmbientLight). Similarly, if everything is too white, tune down the lights. If materials flicker under a directional light, change the light direction vector. Change the background color (which is independent of light sources) to get a better contrast while debugging a light problem.
@@ -315,7 +357,7 @@ Assign a texture with an alpha channel to a Material and set the Material's
-Learn more: Hello Material , Materials Overview
+Learn more: Hello Material , How To Use Materials ,
@@ -389,7 +431,7 @@ chaseCam = new ChaseCamera(cam, spatial, inputManager);
-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.
+Use Controls to define the behaviour of types of Spatials. Use Application States to implement global behaviour, to group subsets of input handlers or GUI screens, etc. Use the simpleUpdate() and update() loops for tests and interactions. Use Cinematics to remote-control objects in scenes.
Learn more: Hello Loop , Update Loop , Custom Controls , Application States , Cinematics
@@ -411,7 +453,7 @@ Use com.jme3.input.KeyInput and a Input Listener.
-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.
+Players typically click the mouse to pick up objects, to open doors, to shoot a weapon, etc. Use an Input Listener to respond to mouse clicks, then cast a ray from the player; if it intersects with the bounding volume of a spatial, this is the selected target. The links below contain code samples for both "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.
@@ -437,7 +479,7 @@ Create an animated OgreMesh model with bones in a 3-D mesh editor (e.g. Blender)
-Use collision detection. The most common solution is to use jme's physics integration.
+Use collision detection. The most common solution is to use jme's physics integration, jBullet.
Learn more: Hello Collision , Physics , com.jme3.bullet.*, CapsuleCollisionShape versus CompoundCollisionShape, CharacterControl versus RigidBodyControl.
@@ -471,7 +513,7 @@ Maybe your collision shapes overlap – or they are not where you think they are
-Use a CharacterControl that locks the physical object upright, so it does not tip over when moving/walking (as tall physical objects are wont to do).
+You can use jBullet's CharacterControl that locks a physical object upright, so it does not tip over when moving/walking (as tall physical objects are wont to do).
Learn more: CharacterControl
@@ -497,7 +539,7 @@ Code samples: Hinges and Joints, com.jme3.bullet.joints.PhysicsHingeJoint,
(Press HK keys to turn, spacebar to swing.)
@@ -767,6 +809,16 @@ Batching means that all Geometries with the same Material are combined into one
+
+
+
+
+Add an . The SDK comes with a basic obfuscation script that you can enable in the project settings.
+
+
+
+
+
@@ -841,8 +893,11 @@ World coordinates of a Spatial are its absolute coordinates in the 3D scene (thi
Multiply degree value by FastMath.DEG_TO_RAD to convert it to radians.
-
+
view online version
\ No newline at end of file
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..4befbbbf4 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
@@ -4,13 +4,26 @@
-A collection of recommendations and expert tips. Feel free to add your own!
+Every milestone of a game development project is made up of phases: Planning, development, testing, and release. Every milestone involves updates to multi-media assets and to code.
+
+
+
+This "best practices" page is 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.
-
+
@@ -28,7 +41,7 @@ As a quick overview, answer yourself the following questions:
Game type
Multi-media assets
Which media will you need? How will you get this content?
-Models, terrains; materials, textures; noises, music, voices; video, cutscenes; spoken/written dialog; level maps, quests, story; AI scripts…
+E.g. models, terrains; materials, textures; noises, music, voices; video, cutscenes; spoken/written dialog; level maps, quests, story; AI scripts.
@@ -59,9 +73,9 @@ Models, terrains; materials, textures; noises, music, voices; video, cutscenes;
Can you achieve a high degree of input control? Even minor navigation and interaction glitches make the game unsolvable.
- Clearly reflect current status, and changes in game states. E.g. health/damage.
+ Decide how to reflect current status, and changes in game states. E.g. health/damage.
- Clearly reward good moves and discourage bad ones.
+ Decide how to reward good moves and discourage bad ones.
@@ -69,7 +83,7 @@ Models, terrains; materials, textures; noises, music, voices; video, cutscenes;
-
+
@@ -78,40 +92,40 @@ Use an
Pre-Alpha
-
+
Artwork: Test asset loading and saving with mock-ups and stock art.
Lay out the overall application flow, i.e. switching between intro / options / game screen, etc.
Get one typical level working. E.g. if the game is a "Jump'n'Run", jumping and running must work before you can announce Alpha.
-
+
Alpha Release
-
+
Artwork: Replace all mock-ups with first drafts of real media and level maps.
Run alpha tests, track bugs, debug, optimize.
Declare
before you announce Beta. This prevents a bottomless pit of new bugs.
-
+
Beta Release
-
+
Artwork: Fill in the final media and level maps.
Have external people review and "beta test" it (track bugs).
Even out the kinks in code and gameplay – don't add any more new features.
-
+
Gamma, Delta = Release Candidates
-
+
+
Omega = Final Release
@@ -119,8 +133,59 @@ Use an
-How you name or number these stages is fully up to you. Development teams use the word milestone, Greek letters, version numbers, or combinations thereof.
-Every milestone is made up of a development phase and a test phase. Here are some best practices:
+How you name or number these stages is fully up to your team. Development teams use numbered milestones (m1, m2, m3), Greek letters (e.g. alpha, beta, gamma, delta), numbering (e.g. "2.7.23-1328"), or combinations thereof.
+
+
+
+
+
+
+
+
+
+Whether you work in a team or alone, keeping a version controlled repository of your code will help you roll-back buggy changes, or recover old code that someone deleted and that is now needed again.
+
+
+
+
+
+
+
+
+
+ DO DON'T
+
+
+ Save original models+textures into assets/Textures. Don't reference textures or models outside your JME project.
+
+
+ Save sounds into assets/Sounds. Don't reference audio files outside your JME project.
+
+
+ Create simple, low-polygon models. Don't create high-polygon models, they render too slow to be useful in games.
+
+
+ Only use Diffuse Map, Normal Map, Glow Map, Specular Map. Don't use unsupported material properties that are not listed in the Materials Overview .
+
+
+ Use UV texture / texture atlases / baking for each texture map. Don't create models based on multiple separate textures, it will break the model into separate meshes.
+
+
+ Convert Models to j3o format. Move j3o files into assets/Models. Don't reference Blender/Ogre/OBJ files in your load() code, because these unoptimized files are not packaged into the JAR.
+
+
+
+
+
+Learn details about the Multi-Media Asset Pipeline here.
@@ -128,6 +193,32 @@ Every milestone is made up of a development phase and a test phase. Here are som
+
+
+
Many game developers dream of creating their very own "MMORPG with full-physics, AI, post-rendering effects, multi-player networking, procedurally generated maps, and customizable characters". So why aren't there tons of MMORPGs out there?
+Even for large experienced game producers, the creation of such a complex game is time-intensive and failure-prone. How familiar are you with multi-threading, persistance, optimization, client-server synchonization, …? Unless your answer is "very!", then start with a single-player desktop game, and work your way up – just as the pros did when they started.
+
+
+
+
+
+
+
+
+
+
+Every jME3 game is centered around one main class that (directly or indirectly) extends com.jme3.app.SimpleApplication .
+
+
+
+
Note that although the "SimpleApplication" name might be misleading, all jME3 applications, including very large projects, are based on this class. The name only implies that this class is a simple application already. You make it "non-simple" by extending it! ;)
+
+
+
+
+For your future game releases, you will want to rely on your own base framework: Your framework extends SimpleApplication, and includes your custom methods for loading, saving, and arranging your scenes, your custom navigation, your inputs for pausing and switching your custom screens, your custom user interface (options screen, HUD, etc), your custom NPC factory, your custom physics properties, your custom networking synchronization, etc. Reusing (extending) your own base framework saves you time. When you update your generic base classes, all your games that extend them benefit from the improvements. Also it will give your games a common look and feel.
+
+
@@ -135,23 +226,18 @@ Every milestone is made up of a development phase and a test phase. Here are som
-
Many game developers dream of creating their very own "MMORPG with full-physics, AI, post-rendering effects, multi-player networking, procedurally generated maps, and customizable characters". So why aren't there tons of MMORPGs out there? Even for large experienced game producers, the creation of such a complex game is time-intensive and failure-prone. How familiar are you with multi-threading, persistance, optimization, client-server synchonization, …? Unless your answer is "very!", then start with a single-player desktop game, and work your way up – just as the pros did when they started.
-
-
-
-
You have a list of features that you want in game, but which one do you implement first? You will keep adding features to a project that grows more and more complex, how can you minimize the amount of rewriting required?
Make sure the game's high-level frame (screen switching, networking, loading/saving) is sound and solid.
- Start with implementing the most complex game feature first – the one that imposes most constraints on the structure of your project (for instance, networking, physics.)
+ Start with implementing the most complex game feature first – the one that imposes most constraints on the structure of your project (for example: networking or physics.)
Add only one larger feature at a time. If there are complex interactions (such as "networking + physics"), start with a small test case ("one cube") and work your way up, don't start with a whole scene.
- Implement low-complexity details (audio and visual effects) last.
+ Implement low-complexity decorations (audio and visual effects) last.
- Test for side-effects on existing code before you add the next feature.
+ Test for side-effects on existing code after you add a feature.
@@ -163,157 +249,103 @@ You have a list of features that you want in game, but which one do you implemen
-
+
-Extend your custom base class off of jME3's com.jme3.app.SimpleApplication. For all your games, you will want a customized basic framework: Methods for loading and saving scenes, screen switching (logon/start screen, options, game screen, etc), physics, networking, etc. Then you reuse (extend) your own generic game class when you create any specific game (a racing game, or a space game, a shooter, etc).
+Game entities (Nodes and Geometrys) often carry custom fields and custom methods with them. For example, players and NPCs have fields such as health, gold coins, inventory, equipment, etc. We call these fields user data . Game entities also have methods that modify user data. Examples include attack(), addGold(), getHealth(), pickUpItem(), dropItem(), useItem(), walk(), etc.
-Follow these steps:
-
-
- Create a generic library for your own "game development business":
-
- Create a jME3-based project MyBaseGame with all necessary JARs on the classpath.
-
- Create a class in this package and name it something like my.company.MyBaseGame.java.
-
- Make MyBaseGame extend com.jme3.app.SimpleApplication.
-
- Include generic assets (company logo, reusable
GUI elements in your company style, etc) in the MyBaseGame's assets directory.
-
- Implement
generic game features in the MyBaseGame class:
GUI (start screen, highscore screen), screen switching and pausing, the in-game HUD, level loading, saving and loading games, AppSettings, the main() method, etc.
-
-
-
- Build the project. You get a JAR file, your custom MyBaseGame.jar.
-
-
-
- Create your actual game, e.g. a zombie shooter:
-
- Create a second JME3-based project, MyZombieGame, with all necessary JME3 JARs on the classpath.
-
- Create a package for the game, e.g. my.company.zombieshooter.MyZombieGame.java.
-
- Add MyBaseGame.jar to the classpath of MyZombieGame. You can now re-use you custom generic game library.
-
- Make MyZombieGame.java extend your MyBaseGame class (which extends SimpleApplication).
-
-
- Place the specific assets (scenes, models) of this game go into MyZombieGame's own assets folder.
-
- After the generic super calls, add the specific game code for this game. Now you can implement this specific game's mechanics and levels using controls and app states, without having to worry about logon&settings screens and all the other generic features that you already dealt with in MyBaseGame.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Game elements (Spatials such as Nodes and Geometrys) often carry custom fields and custom methods with them. For example, players have health, gold coins, an inventory, equipment, etc. You may have methods that modify the player state, such as addGold(), addHealth(), pickUpItem(), dropItem(), wieldItem(), etc.
+Avoid the Anti-Pattern: You might be tempted to create character classes using Java inheritance: For example, MyMobileNode extends Node and then MyNPC extends MyMobileNode. Then you might create subclasses such as MyFighterNPC extends MyNPC and MyShopKeeperNPC extends MyNPC. But what if you need a group of MyShopKeeperNPCs that fight back? Do you write a MyFightingShopKeeperNPC class, and copy and paste fighting methods from MyFighterNPC? The inheritance approach will soon turn out to be an unmaintainable mess – this is not what you want.
-Anti-Pattern: In Java it's possible that you extend the Node class to create a custom Node class. But be aware not to get trapped by the following anti-pattern: You might try to create different character nodes with MyMobileNode extends Node and then MyNPC extends MyMobileNode. Then you might continue creating subclasses such as MyCityGuardNPC extends MyNPC and MyShopKeeperNPC extends MyNPC. What do you do now if you need a MyShopKeeperNPC that also fights, do you write a whole new MyFightingShopKeeperNPC class? Inheritance does not help you here.
-
-
-
-Also, extending a Node just to add custom fields to it is unneccesary, because you can store any custom Java objects in Spatials! This user data is accessible where ever the Spatial is accessible. Read the Spatial documentation to learn more about how to use the setUserData() method on Nodes and Geometries.
-
-
-
-In short: Don't extend Node to implement game mechanics of your entities. Instead:
+Follow the Best Practice: You can add user data, accessors, and methods directly to each Spatial.
-
+
-
+ Use
Controls to add custom methods (including getters and setters) to Spatials.
-
+
-As your SimpleApplication-based game grows more advanced, you may find yourself putting more and more tests in the simpleUpdate() loop, passing around lots of object references, and your simpleInitApp() methods grows longer and longer….
+SimpleApplication gives you access to game features such as a the rootNode, assetManager, guiNode, inputManager, audioManager, physicsSpace, viewPort, and the camera. But what if you need access to the assetManager or rootNode etc from another class? Don't pass around lots of object references in constructors. This is a sign that this class should be designed as an AppState (read details there).
-Move game behaviour into reusable classes of their own. In jME3 these resuable classes are Controls and AppStates.
+An AppState has access to all game features in the SimpleApplication via the this.app and this.stateManager objects.
+
+
+
+Examples:
+
+
+
Spatial sky = SkyFactory.createSky(this.app.getAssetManager(), "sky.dds", false);
+this.app.getRootNode().attachChild( sky );
+
+
+
+
+
+
+
+
+As your SimpleApplication-based game grows more advanced, you find yourself putting more and more interactions in the simpleUpdate() loop, and your simpleInitApp() methods grows longer and longer. It's a best practice to move blocks of game mechanics into reusable component classes of their own. In jME3, these resuable classes are called Controls and AppStates.
+
- Use
Controls to implement the
behaviour of types of game entities .
-
- Controls add a type of behaviour to individual Spatials.
-
- Each Spatial needs its own instance of the Control. One Spatial can be influenced by several Controls.
-
- Use Controls to move code out of the simpleUpdate() loop.
-
- Examples: An NPC Control that defines how types of enemy Spatials find their way around, a player Control an generic animation control that triggers animations in various types of 3D models, the RigidBodyControl (part of the physics integration), etc.
-
-
-
Use
AppStates to implement
global game mechanics .
- Use AppStates to move code out of the simpleInitApp() method.
+ Each AppState calls its own initialize() and cleanup() methods when it is attached to or detached from the game.
- Each AppState brings its own set of game states: You write code so that enabling and disabling an AppState activates and deactivates one particular set of class fields,
GUI , spatials, input handlers, etc. This way you use AppStates to switch between e.g. an InGameState and a MainMenuState.
+ Each AppState runs its own update() loop that hooks into the main simpleUpdate() loop.
- Examples: The integrated jBullet physics simulation, an overall artificial intelligence AppState that coordinates cooperating enemies, an in-game AppState that loads the scene and the HUD and activates the in-game input mappings, a main menu AppState that switches input handling (clicks are interpreted differently than in game) and displays buttons and lets the user open highscore and settings screens, etc.
+ You can specify what happens if an AppState is paused/unpaused.
+
+ You can use an AppState to switch between sets of AppStates.
+
+ An AppState has access to everything in the SimpleApplication (rootNode, AssetManager, StateManager, InputListener, ViewPort, etc).
-
-
-
-Controls and AppStates can work together:
-
- An AppState can reach up to the application and get all Spatials that carry a specific Control, and use this information to perform some global action on them.
-
- Example: Individual physical spatials (carrying RigidBodyControls) that are steered by the overall physics simulation (BulletAppState).
-
-
-
-
-
-Both Control and AppState automatically hook into the main update loop.
-
+
Use
Controls to implement the
behaviour of game entities .
- Instead of remote controlling all game entities via code in the simpleUpdate() method, you define the desired behaviour in the update() methods inside your custom Controls and AppStates.
+ Controls add a type of behaviour (methods and fields) to an individual Spatial (a player, an NPC).
- Add Controls to Spatials, and AppStates to the application. jME3 automatically triggers their update() methods as part of the main update loop.
+ Each Control runs its own controlUpdate() loop that hooks into the main simpleUpdate() loop.
- This cleans up your main class considerably. In the ideal case, you abstract all interactions into Controls and AppStates, and your simpleInitApp() and simpleUpdate() could even end up being empty.
+ One Spatial can be influenced by several Controls. (!)
+
+ Each Spatial needs its own instance of the Control.
+
+ A Control only has control over and access to the spatial that it is attached to (and its sub-spatials).
+
+
+Controls and AppStates often work together: An AppState can reach up to the application and get all Spatials from the rootNode that carry a specific Control, and perform a global action on them. Example: In BulletPhysics, all physical Spatials that carry RigidBodyControls are steered by the overall BulletAppState.
+
+
+
+
AppStates and Controls are extensions to a SimpleApplication. They are your modular building blocks to build a more complex game. In the ideal case, you move all init/update code into Controls and AppStates, and your simpleInitApp() and simpleUpdate() could end up virtually empty. This powerful and modular approach cleans up your code considerably.
+
+
+
+
Read all about Custom Controls and Application States here.
@@ -322,79 +354,22 @@ Read all about
Optimization
+
-
+ Multithreading – use concurrency, and don't change the scene graph from outside the update loop.
+
+
You can add a
Java Profiler to the jMonkeyEngine
SDK via Tools → Plugins → Available. The profiler presents statistics on the lifecycle of methods and objects. Performance problems may be caused by just a few methods that take long, or are called too often (try to cache values to avoid this). If object creation and garbage collection counts keep increasing, you are looking at a memory leak.
-
-
-
-
-
-Put your assets into subfolders of your project's assets directory. This is the default path where the AssetManager looks for files.
-
-
jMonkeyProjects/MyGame/assets/ # Store assets in subfolders here!
-jMonkeyProjects/MyGame/build/ # SDK generates built classes here *
-jMonkeyProjects/MyGame/build.xml # Customize Ant build script here
-jMonkeyProjects/MyGame/nbproject/ # SDK stores default build.xml and meta data *
-jMonkeyProjects/MyGame/dist/ # SDK generates executables here *
-jMonkeyProjects/MyGame/src/ # Store Java sources here
-jMonkeyProjects/MyGame/test/ # Store test classes here (optional)
-(*) managed by jMonkeyEngine SDK, don't edit
-
- Agree on a file and directory naming scheme with the graphic designers.
-
- Are there assets (models, sound files, …) that will be used interchangeably? Then name or number them in a way so that the developer can swap the assets by swapping part of the path string.
-
- Decide on naming standards for naming interactive parts of models (e.g. arms/legs in an animation).
-
-
-
- Structure the subfolders of assets in any way that suits the project – but stick with one system.
-
-
- Place reusable Textures and Materials (the ones that you set programmatically) into the Textures and Materials directory, respectively.
-
- If different types of assets (materials, textures, models) belong together, create a parallel subdirectory structure for them: Textures/vehicles/car/, Materials/vehicles/car/, Models/vehicles/car/
-
-
-
-
-
-Here is an example of a commonly used directory structure for various file types:
-
-
-
jMonkeyProjects/MyGame/assets/Interface/ # .font, .jpg, .png, .xml
-jMonkeyProjects/MyGame/assets/MatDefs/ # .j3md
-jMonkeyProjects/MyGame/assets/Materials/ # .j3m
-jMonkeyProjects/MyGame/assets/Models/ # .j3o
-jMonkeyProjects/MyGame/assets/Scenes/ # .j3o
-jMonkeyProjects/MyGame/assets/Shaders/ # .j3f, .vert, .frag
-jMonkeyProjects/MyGame/assets/Sounds/ # .ogg, .wav
-jMonkeyProjects/MyGame/assets/Textures/ # .mesh.xml+.material, .mtl+.obj, .jpg, .png
-
-
-
-See also: Asset Packs and Asset Manager .
-
-
-
-
-Here are some tips especially for users who already know jME2. Automatic handling of the Geometric State has improved in jME3, and it is now a best practice to not mess with it.
+These tips are especially for users who already know jME2. Automatic handling of the Geometric State has improved in jME3, and it is now a best practice to not mess with it.
Do not call updateGeometricState() on anything but the root node!
@@ -412,22 +387,14 @@ Here are some tips especially for users who already know jME2. Automatic handlin
-It's unlikely you will be willing to fully document every class you write. You should at minimum javadoc the most crucial methods/parameters in a meaningful way.
+It's unlikely you will fully document every class you write, we hear you. However, you should at least write meaningful javadoc to provide context for your most crucial methods/parameters.
- Answer three questions for every crucial method/parameter:
-
+ What is this? How does it solve its task (input, algorithm used, output, side-effects)?
Write down limits (e.g. min/max values) and defaults while you still remember.
- Is this optional or required? What are the alternatives? Is this part of a series of steps that are prerequistes?
+ In which situation do I want to use this, is this part of a larger process? Is this step required, or what are the alternatives?
@@ -438,97 +405,28 @@ Treat javadoc as messages to your future self. "genNextVal() generates the
-
-
-
-
-
-Whether you work in a team or alone, keeping a version controlled repository of your code will help you roll-back buggy changes, or recover old code that someone deleted and that is now needed again.
-
-
-
-
-
-
-
-
-
-
-From the beta on, convert all models and scenes (Ogre mesh and Wavefront and Blender) to jME3's binary .j3o format. Use the jMonkeyEngine SDK for the conversion, and save the .j3o files into the Models directory.
-
-
- .j3o is an optimized format to store part of a jME3 scenegraph.
-It can contain an individual model or a whole scene. Optionally (using the jMonkeyEngine SceneComposer) you can include the model's physical properties, materials, lights, particle emitters, and audio nodes, in the .j3o file.
-
- If you kept the Ogre mesh together with the textures in the Textures directory during the conversion, the paths are recorded in a way so that you can move the .j3o to another directory, and it will still find its textures.
-
- The default Ant build script copies .j3o / .j3m files and other assets into the distributable JAR automatically.
-
- Important: Other model files however (.mesh.xml, .material, .obj, .mat) are not bundled automatically. You will get a runtime error that a resource was not found if you try to run the JAR with code referring to these files.
-
-
-
-
-
-See also: Model Loader and Viewer
-
-
-
-
-
-
-
-
-
-Unit Tests ( ) have a different status in 3D graphics development than in other types of software. You cannot write any assertions that automatically test whether the rendered image looks correct, or whether interactions are intuitive . Still you should create simple test cases for individual game features such as loaders, content generators, effects. Run the test cases now and then to see whether they still work as intended – or whether they are affected by side effects. Keep the test classes in a test directory in the project, but don't include them in the distribution.
+A Java Debugger is included in the jMonkeyEngine SDK . It allows you to set a break point in your code near the point where an exception happens. Then you step through the execution line by line and watch object and variable states to detect where the bug starts.
-Quality Assurance (QA) means maintaining a clear list of steps that must always work, and checking them. It will always happen that there are hard-to-find bugs in the gameplay somewhere – but basic tasks such as installing and de-installing, saving and loading, starting/pausing/quitting the game, must work , no excuse. After every milestone, you go through the QA list again, on every supported operating system, and systematically look for regressions or newly introduced bugs.
+Use the Logger to print status messages during the development and debugging phase, instead of System.out.println(). The logger can be switched off with one line of code, whereas commenting out all your println()s takes a while.
-Alpha and Beta Testing means that you ask someone to try to install and run your game. It should be a real user situation, where they are left to figure it out by themselves (you only can include the usual read-me and help docs). Provide the testers with an easy method to report back descriptions of their problems, or why they gave up. Evaluate whether these problems are exceptions or must be fixed for the game to be playable.
-
-
-
-
-
-
-
-
-
-A Java Debugger is included in the jMonkeyEngine SDK . It allows you to set a break point in your code near the point where an exception happens. Then you step through the execution line by line and watch object and variable states to detect where the bug starts.
+Unit Testing ( ) has a different status in 3D graphics development than in other types of software. You cannot write assertions that automatically test whether the rendered image looks correct, or whether interactions are intuitive . Still you should create simple test cases for individual game features such as loaders, content generators, effects. Run the test cases now and then to see whether they still work as intended – or whether they are suffering from side-effects. Keep the test classes in a test directory in the project, don't include them in the distribution.
-Use the Logger to print status messages during the development and debugging phase, instead of System.out.println(). The logger can be switched off with one line of code, whereas commenting out your println()s takes a while.
+Quality Assurance (QA) means repeatedly checking a certain set of features that must work, but that might be unexpectedly broken as a side-effect. Every game has some crazy bugs somewhere – but basic tasks must work , no excuse. This includes installing and de-installing; saving and loading; changing options; starting, pausing, quitting; basic actions such as walking, fighting, etc. After every milestone, you go through your QA list again and systematically look for regressions or newly introduced bugs. Check the application on every supported operating system and hardware (!) because not all graphic cards support the same features. If you don't find the obvious bugs, your users will, and carelessness will put them off.
-
-
-
-
-
-
-You can add a Java Profiler to the jMonkeyEngine SDK via Tools → Plugins → Available. The profiler presents statistics on the lifecycle of methods and objects. Performance problems may be caused by just a few methods that take long, or are called too often. If object creation and garbage collection counts keep increasing, you are looking at a memory leak.
+Alpha and Beta Testing means that you ask someone to try to install and run your game. It should be a real user situation, where they are left to figure the gameplay out by themselves (you only can include the usual read-me and help docs). Provide the testers with an easy method to report back problems, or why they gave up. Evaluate whether these problems are exceptions or must be fixed for the game to be playable.
@@ -536,10 +434,10 @@ You can add a
+
+
+
+
+
-Distributable Executable
+The jMonkeyEngine SDK helps you with deployment : You specify your branding and deployment options in the Project Properties dialog, and then choose Clean and Build from the context menu. If you use another IDE, then consult the IDE's documentation.
-The jMonkeyEngine SDK helps you with deployment (unless you used another IDE, then consult the IDE's documentation). Do you want to release your game as WebStart, Desktop JAR, or Applet? Each has its pros and cons.
+Decide whether you want to release your game as WebStart, Desktop JAR, or Applet – Each has its pros and cons.
@@ -592,13 +495,17 @@ The jMonkeyEngine SDK helps you w
Android
-(.APK) Game runs on Android devices Android devices do not support post-procesor effects.
+(.APK)Game runs on Android devices. Android devices do not support post-procesor effects.
-
+
Which ever method you choose, a Java-Application works on the main operating systems: Windows, Mac OS , Linux, Android.
+
+
+
+The distribution appears in a newly generated dist directory inside your project directory. These are the files that you upload or burn to CD to distribute to your customers.
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 49e8c0d02..9411ee126 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
@@ -12,71 +12,68 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
-
+
@@ -97,7 +94,14 @@ var BP_DTheme = {
-
+
@@ -115,6 +119,8 @@ var BP_DTheme = {
var NS='jme3:intermediate';var JSINFO = {"id":"jme3:intermediate:headlessserver","namespace":"jme3:intermediate"};
//-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Proudly powered by and .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+