diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/3d_models.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/3d_models.html index d4c5c8df5..150ba0bc7 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/3d_models.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/3d_models.html @@ -83,7 +83,7 @@ To export your models as Ogre XML -You can now use the jMonkeyEngine SDK to load and view models. You can create scenes from them and write cde that loads them into your application. +You can now use the jMonkeyEngine SDK to load and view models. You can create scenes from them and write code that loads them into your application.

diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/application_states.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/application_states.html index 3f693ff1e..37c1b9cf9 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/application_states.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/application_states.html @@ -4,16 +4,16 @@

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

- +

Overview

- +

Use Case Examples

@@ -56,7 +56,7 @@ You can! This is what AppStates are there for. An AppState class is subset of (o
- +

Supported Features

@@ -86,7 +86,7 @@ Each AppState has its own update loop, which hooks into the main simpleUpdate()

- +

Usage

@@ -109,7 +109,7 @@ To implement game logic:
  • Enable and disable (unpause and pause) the AppStates that you need during the game.
  • -
  • Detach the AppState from the AppStateManager (stateManager.detach(myAppState);) and clean it up it.
    +
  • Detach the AppState from the AppStateManager (stateManager.detach(myAppState);) and clean it up.
  • @@ -119,7 +119,7 @@ When you add several AppStates to one Application and activate them, their initi

    - +

    Code Samples

    @@ -139,7 +139,7 @@ JME3 comes with a BulletAppState that implements Physical behaviour (using the j
    - +

    AppState

    @@ -184,9 +184,9 @@ stateDetached(asm)The AppState knows when it is attached to, or detache postRender()Called after all rendering commands are flushed, including your optional customizations. (Typically not used.)
    - + - +

    AbstractAppState

    @@ -249,7 +249,7 @@ Definition: }
    - +

    Pausing and Unpausing

    @@ -259,7 +259,7 @@ You define what an AppState does when Paused or Unpaused, in the setEnable

    - +

    AppStateManager

    @@ -279,7 +279,7 @@ The com.jme3.app.state.AppStateManager holds the list of AppStates for an applic getState(MyAppState.class)Returns the first attached state that is an instance of a subclass of MyAppState.class.
    - +

    The AppStateManager's render(), postRender(), cleanup() methods are internal, ignore them, users never call them directly. @@ -299,12 +299,12 @@ The AppStateManager's render(), postRender(), cleanup() method - +

    Best Practices

    - +

    Communication Among AppStates

    @@ -320,7 +320,7 @@ You can use custom accessors to get data from AppStates, to set data in AppState
    this.app.getStateManager().getState(MyAppState.class).doSomeCustomStuffInThisState();
    - +

    Initialize Familiar Class Fields

    @@ -351,5 +351,5 @@ public class MyAppState extends AbstractAppState { }
    - +

    view online version

    \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/audio.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/audio.html index cff5fee85..2cab347f4 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/audio.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/audio.html @@ -50,7 +50,7 @@ AudioNode boom = new AudioNode(assetManager, "Sound/boom.wav", fal AudioNode MethodUsage - getStatus()Returns either Status.Playing, Status.Stopped, or Status.Paused. + getStatus()Returns either AudioSource.Status.Playing, AudioSource.Status.Stopped, or AudioSource.Status.Paused. getVolume()Returns the volume. @@ -59,14 +59,13 @@ AudioNode boom = new AudioNode(assetManager, "Sound/boom.wav", fal getPitch()Returns the pitch. - +

    - Note: There are other obvious getters to poll the status of all corresponding setters listed here.

    - +

    Setting AudioNode Properties

    @@ -92,9 +91,9 @@ Note: There are other obvious getters to poll the status of all corresponding se
    setLooping(false)Configures the sound so that, if it is played, it plays once and stops. No looping is the default.
    - +
    - +

    Looping & Ambient Sounds

    @@ -110,9 +109,9 @@ setDirectional(false)
    All 3D effects switched off. This sound is global Looping does not work on streamed sounds.
    - +
    - +

    Positional 3D Sounds

    @@ -127,7 +126,7 @@ setLocalTranslation(???)
    Activates 3D audio: The sound appears to come f setReverbEnabled(true)Reverb is a 3D echo effect that only makes sense with positional AudioNodes. Use Audio Environments to make scenes sound as if they were "outdoors", or "indoors" in a large or small room, etc. The reverb effect is defined by the com.jme3.audio.Environment that the audioRenderer is in. See "Setting Audio Environment Properties" below.
    - +

    Positional 3D sounds require an AudioListener object in the scene (representing the player's ears). @@ -135,7 +134,7 @@ setLocalTranslation(???)Activates 3D audio: The sound appears to come f

    - +

    Directional 3D Sounds

    @@ -151,7 +150,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!
    - +

    Directional 3D sounds require an AudioListener object in the scene (representing the player's ears). @@ -159,7 +158,7 @@ setOuterAngle()Set the angle in degrees for the directional audio. The

    - +

    Play, Pause, Stop

    @@ -181,7 +180,7 @@ You can also start playing instances of an AudioNode. Use the playInstance
    myAudioNode.playInstance();
    - +

    The Audio Listener

    @@ -197,7 +196,7 @@ The default AudioListener object listener in SimpleApplicatio }
    - +

    Setting Audio Environment Properties

    @@ -226,7 +225,7 @@ Optionally, You can choose from the following environmental presets from c Closet 1.00f1.0f1.0f1.00f0.15f1.0f0.600f0.0025f0.500f0.0006f
    -
      +
      1. Activate a Environment preset
        • Either use a default, e.g. make you scene sounds like a dungeon environment:
          audioRenderer.setEnvironment(new Environment(Environment.Dungeon));
          @@ -266,5 +265,5 @@ Advanced users find more info about OpenAL and its features here: - +

          view online version

          \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/capture_audio_video_to_a_file.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/capture_audio_video_to_a_file.html index 321422f5b..3b6e7638c 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/capture_audio_video_to_a_file.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/capture_audio_video_to_a_file.html @@ -571,7 +571,7 @@ public class Advanced extends SimpleApplication {   public void simpleUpdate(float tpf) { motionTimer.update(); - if (music.getStatus() != AudioNode.Status.Playing){ + if (music.getStatus() != AudioSource.Status.Playing){ music.play(); } Vector3f loc = cam.getLocation(); @@ -600,7 +600,7 @@ The - +

          Using Advanced features to Record from more than one perspective at once

          @@ -621,7 +621,7 @@ The - +

          More Information

          @@ -653,5 +653,5 @@ listeners can be found here.

          - +

          view online version

          \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/cinematics.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/cinematics.html index 343f4c792..c709dd228 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/cinematics.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/cinematics.html @@ -4,7 +4,11 @@

          -JME3 cinematics (com.jme.cinematic) allow you to remote control nodes and cameras in a 3D game: You can script and and play cinematic scenes. You can use cinematics to create and movies/trailers for your game. Internally, Cinematics are implemented as AppStates. +JME3 cinematics (com.jme.cinematic) allow you to remote control nodes and cameras in a 3D game: You can script and and play cinematic scenes. You can use cinematics to create and movies/trailers for your game. Another good use case is efficient "destruction physics": Playing back prerecorded flying pieces of debris for demolitions is much faster than calculating them with live physics. +

          + +

          +Internally, Cinematics are implemented as AppStates.

          @@ -24,7 +28,7 @@ This Node can be the rootNode, or a Node that is attached to the rootNode. - +

          Sample Code

            @@ -33,7 +37,7 @@ This Node can be the rootNode, or a Node that is attached to the rootNode.
          - +

          How to Use a Cinematic

          @@ -85,9 +89,9 @@ stateManager.attach(cinematic); cinematic.pause()Pauses the cinematic.
          - + - +

          Events(CinematicEvents)

          @@ -117,7 +121,7 @@ Here is the list of available CinematicEvents that you use as events. Each track AnimationEventUse this to start playing a model animation at a given time (a character walking animation for example)
          - +

          Of course one can make is own event implementation, by extending the AbstractCinematicEvent. @@ -125,7 +129,7 @@ Of course one can make is own event implementation, by extending the AbstractCin

          - +

          MotionEvent

          @@ -189,14 +193,14 @@ To create a MotionEvent, do the following: event.setRotation(quaternion)Sets the rotation. Use together with MotionEvent.Direction.Rotation or MotionEvent.Direction.PathAndRotation.
          - +

          Tip: Most likely you remote-control more than one object in your scene. Give the events and paths useful names such as dragonEvent, dragonPath, heroEvent, heroPath, etc.

          - +

          SoundEvent

          @@ -223,7 +227,7 @@ Details of the constructor:
          - +

          GuiEvent

          @@ -254,7 +258,7 @@ Details of the constructor:
          - +

          AnimationEvent

          @@ -281,7 +285,7 @@ Details of the constructor:
          - +

          Camera Management

          @@ -314,7 +318,7 @@ Then i just have to schedule its activation in the cinematic. I want it to get a
           cinematic.activateCamera(3,???topView???);
          - +

          Customizations

          @@ -328,12 +332,12 @@ You can also create new CinematicEvent by extending +

          Interacting with Cinematics

          - +

          CinematicEventListener

          CinematicEventListener cel = new CinematicEventListener() {
          @@ -355,7 +359,7 @@ You can also create new CinematicEvent by extending 
          +
           

          Physics Interaction

          @@ -365,5 +369,5 @@ Upcoming.

          - +

          view online version

          \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/custom_controls.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/custom_controls.html index 4f959e01a..ee83db106 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/custom_controls.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/custom_controls.html @@ -3,7 +3,7 @@

          -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. +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 custom Controls together implement the behaviours of a type of Spatial.

          @@ -43,7 +43,7 @@ To implement game logic for a type of spatial, you will either extend AbstractCo

          - +

          Usage

          @@ -91,7 +91,7 @@ The possibilities are endless. +

          Example Code

          @@ -115,7 +115,7 @@ Existing examples in the code base include:
          - +

          AbstractControl Class

          @@ -155,12 +155,19 @@ Usage: Your custom subclass implements the three methods controlUpdate()/** This is your init method. Optionally, you can modify - * the spatial from here (transform it, initialize userdata, etc). */ + /** This method is called when the control is added to the spatial, + * and when the control is removed from the spatial (setting a null value). + * It can be used for both initialization and cleanup. */ @Override public void setSpatial(Spatial spatial) { super.setSpatial(spatial); - // spatial.setUserData("index", i); // example + /* Example: + if (spatial != null){ + // initialize + }else{ + // cleanup + } + */ }     @@ -214,13 +221,13 @@ See also:
          - +

          The Control Interface

          -

          In the less common case that you want to create a Control that also extends another class, create a custom interface that extends jME3's Control interface. Your class can become a Control by implement the Control interface, and at the same time extend another class. +

          In the less common case that you want to create a Control that also extends another class, create a custom interface that extends jME3's Control interface. Your class can become a Control by implementing the Control interface, and at the same time extending another class.

          @@ -321,7 +328,7 @@ Usage example: }
          - +

          Best Practices

          @@ -387,5 +394,5 @@ vehicleSpatial.addControl(new ManualVehicleControl()); c.steerX(steerX);
          - +

          view online version

          \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/debugging.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/debugging.html index 69f16ed68..b7857aa62 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/debugging.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/debugging.html @@ -132,8 +132,24 @@ You can display a wireframe of the (usually invisible) collision shape around al

          physicsSpace.enableDebug(assetManager);
          +

          +With debugging enabled, colors are used to indicate various types of physical objects: +

          +
            +
          • A magenta wire mesh indicates an active rigid body.
            +
          • +
          • A blue wire mesh indicates a rigid body which is either new or inactive.
            +
          • +
          • A yellow wire mesh indicates a ghost.
            +
          • +
          • Two green arrows indicate a joint.
            +
          • +
          • A pink wire mesh indicates a character.
            +
          • +
          +
          - +

          Wireframe for Animations

          @@ -150,7 +166,7 @@ Making the skeleton visible inside animated models can be handy for debugging an player.attachChild(skeletonDebug);
          - +

          Example: Toggle Wireframe on Model

          @@ -208,7 +224,7 @@ TIP :: To set the line width of wireframe display, use mesh.setLineWidth(lineWid

          - +

          Example: Toggle Wireframe on the scene

          @@ -262,7 +278,7 @@ Then attach the scene processor to the getViewPort().addProcessor(new WireProcessor());
          - +

          See also

            @@ -271,5 +287,5 @@ Then attach the scene processor to the
          - +

          view online version

          \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/effects_overview.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/effects_overview.html index 74789eb8c..e7f102619 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/effects_overview.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/effects_overview.html @@ -298,6 +298,57 @@ Thanks for your awesome contributions! Keep them coming!
          +
          + +

          Creating your own Filters

          +
          + +

          + +Here is an extract taken from @nehon in the forum thread () +

          + +

          +The methods are called in this order (pretty much the same flow as processors): +- initFilter() is called once when the FilterPostPorcessor is initialized or when the filter is added to the processor and this one as already been initialized. +

          + +

          +for each frame the methods are called in that sequence : +- preFrame() occurs before anything happens +- postQueue() occcurs once the queues have been populated (there is one queue per bucket and 2 additional queues for the shadows, casters and recievers). Note that geometries in the queues are the one in the view frustum. +- postFrame occurs once the main frame has been rendered (the back buffer) +

          + +

          +Those methods are optional in a filter, they are only there if you want to hook in the rendering process. +

          + +

          +The material variable is here for convenience. You have a getMaterial method that returns the material that???s gonna be used to render the full screen quad. It just happened that in every implementation I had a material attribute in all my sub-classes, so I just put it back in the abstract class. Most of the time getMaterial returns this attribute. +

          + +

          +Forced-technique can be any technique really, they are more related with the material system than to the filters but anyway. When you use a forced technique the renderer tries to select it on the material of each geometry, if the technique does not exists for the material the geometry is not rendered. +You assume well about the SSAO filer, the normal of the scene are rendered to a texture in a pre pass. +

          + +

          +Passes : these are filters in filters in a way. First they are a convenient way to initialize a FrameBuffer and the associated textures it needs, then you can use them for what ever you want. +For example, a Pass can be (as in the SSAO filter) an extra render of the scene with a forced technique, and you have to handle the render yourself in the postQueue method. +It can be a post pass to do after the main filter has been rendered to screen (for example an additional blur pass used in SSAO again). You have a list of passes called postRenderPass in the Filter abstract class. If you add a pass to this list, it???ll be automatically rendered by the FilterPostProcessor during the filter chain. +

          + +

          +The bloom Filter does an intensive use of passes. +

          + +

          +Filters in a nutshell. + +

          +
          +

          See also:

          @@ -317,5 +368,5 @@ See also:
          - +

          view online version

          \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/input_handling.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/input_handling.html index 3414c7f1b..88a25a394 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/input_handling.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/input_handling.html @@ -158,15 +158,15 @@ In your IDE, use code completion to quickly look up Trigger literals. In the jMo INPUT_MAPPING_CAMERA_POSKEY_CPrints debug output about the camera. - INPUT_MAPPING_MEMORYKEY_MPrints debug output for memtory usage. + INPUT_MAPPING_MEMORYKEY_MPrints debug output for memory usage. INPUT_MAPPING_EXITKEY_ESCAPECloses the application by calling stop();. Typically you do not remove this, unless you replace it by another way of quitting gracefully. - + - +

          3. Add Custom Trigger Mapping

          @@ -192,7 +192,7 @@ inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_D ...
          - +

          4. Create Listeners

          @@ -206,7 +206,7 @@ The jME3 input manager supports two types of event listeners for inputs: AnalogL

          - +

          ActionListener

          @@ -241,7 +241,7 @@ The jME3 input manager supports two types of event listeners for inputs: AnalogL };
          - +

          AnalogListener

          @@ -274,7 +274,7 @@ The jME3 input manager supports two types of event listeners for inputs: AnalogL };
          - +

          4. Register Mappings to Listeners

          @@ -303,7 +303,7 @@ As you see, you can add several listeners in one String array. You can call the

          - +

          5. Implement Actions in Listeners

          @@ -323,7 +323,7 @@ Make use of the distinction between if and else if in
          - +

          ActionListener

          @@ -344,7 +344,7 @@ In the most common case, you want an action to be triggered once, in the moment };
          - +

          AnalogListener

          @@ -365,7 +365,7 @@ The following example shows how you define actions with an AnalogListener. Thies };
          - +

          Let Users Remap Keys

          @@ -384,5 +384,5 @@ The abstraction of separating triggers and mappings has the advantage that you c
          - +

          view online version

          \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/light_and_shadow.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/light_and_shadow.html index 024d3220d..02d29c160 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/light_and_shadow.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/light_and_shadow.html @@ -75,7 +75,7 @@ You can get a list of all lights added to a Spatial by calling getWorldLig

          -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). +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 to cast shadows along with a PointLightShadowRenderer (see the Casting Shadows section)

          @@ -88,7 +88,7 @@ lamp_light.setPosition(new Vector3f(lamp_geo.getLocalTranslation( rootNode.addLight(lamp_light); - +

          DirectionalLight

          @@ -110,7 +110,7 @@ sun.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal( rootNode.addLight(sun);
          - +

          SpotLight

          @@ -140,7 +140,7 @@ If you want the spotlight to follow the flycam, repeat the setDirection(???) and

          - +

          AmbientLight

          @@ -163,7 +163,7 @@ Example: mylight.setColor(ColorRGBA.White.mult(1.3f));

          - +

          Light Follows Spatial

          @@ -181,117 +181,84 @@ Obviously, this does not apply to AmbientLights, which have no position.

          - -

          Simple Lighting

          + +

          BasicShadowRenderer (deprecated)

          -Full sample code: +Full code sample

            -
          • -
          • -
          • +
          -

          - -For Simple Lighting we use Geometries with Materials based on Lighting.j3md (learn more about Materials here). Lighting.j3md-based materials dynamically support Shininess, and Ambient, Diffuse, and Specular light if there is a light source present. Note that this lighting method alone does not make the Geometry cast a shadow onto other Geometries automatically (see below for how to add drop shadows etc). -

          - -

          - -

          -
          Geometry teapot = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
          -TangentBinormalGenerator.generate(teapot.getMesh(), true);
          -Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
          -mat.setBoolean("m_UseMaterialColors", true);
          -mat.setColor("m_Ambient",  ColorRGBA.Orange);
          -mat.setColor("m_Diffuse",  ColorRGBA.Orange);
          -mat.setColor("m_Specular", ColorRGBA.White);
          -mat.setFloat("m_Shininess", 12);
          -rootNode.attachChild(teapot);
          - -

          -The above example uses material colors and no textures. You can of course also use Lighting.j3md to create a lit Material that uses Texture Maps. The following example uses Shininess, Diffuse Map and Normal Map (a.k.a Bump Map). -

          - -

          - -

          -
          Sphere rock = new Sphere(32,32, 2f);
          -Geometry shiny_rock = new Geometry("Shiny rock", rock);
          -rock.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
          -TangentBinormalGenerator.generate(rock);           // for lighting effect
          -Material mat_lit = new Material(
          -    assetManager, "Common/MatDefs/Light/Lighting.j3md");
          -mat_lit.setTexture("m_DiffuseMap",                 // surface color
          -    assetManager.loadTexture("Textures/Terrain/Pond/Pond.png"));
          -mat_lit.setTexture("m_NormalMap",                  // surface bumps
          -    assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png"));
          -mat_lit.setFloat("m_Shininess", 5f);               // surface smoothness [1,128]
          -shiny_rock.setMaterial(mat_lit);
          -rootNode.attachChild(shiny_rock);
          - -

          -These light effects update live when the object or light source moves. If you shine a colored PointLight at this object, you will see a light reflection tinged in the color of the PointLight. -

          -
          - -

          BasicShadowRenderer

          + +

          Casting Shadows

          -Full code sample +For each type of non-ambient light source, JME3 implements two ways to simulate geometries casting shadows on other geometries:

            -
          • +
          • a shadow renderer (which you apply to a viewport) and
            +
          • +
          • a shadow filter (which you can add to a viewport's filter post-processor).
          - +
          + + + + + + + + + + + + + + + +
          light source class shadow renderer class shadow filter class
          DirectionalLight DirectionalLightShadowRenderer DirectionalLightShadowFilter
          PointLight PointLightShadowRenderer PointLightShadowFilter
          SpotLight SpotLightShadowRenderer SpotLightShadowFilter
          AmbientLight (not applicable) (not applicable)
          +

          -Use the Shadow Renderer to make Geometries with Lighting.j3md-based Materials cast and receive basic drop shadows. This fast and simple implementation of a shadow effect is good for scenes with flat floors, but looks less realistic on uneven terrains. To use it, you add a jME SceneProcessor named com.jme3.shadow.BasicShadowRenderer to the viewPort. +You only need one shadow simulation per light source: if you use shadow rendering, you won't need a shadow filter and vice versa. Which way is more efficient depends partly on the complexity of your scene. All six shadow simulation classes have similar interfaces, so once you know how to use one, you can easily figure out the rest.

          - +Shadow calculations (cast and receive) have a performance impact, so use them sparingly. With shadow renderers, you can turn off shadow casting and/or shadow receiving for individual geometries, for portions of the scene graph, or for the entire scene:

          -
          BasicShadowRenderer bsr;
          -...
          -public void simpleInitApp() {
          -    ...
          -    bsr = new BasicShadowRenderer(assetManager, 256);
          -    bsr.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal()); // light direction
          -    viewPort.addProcessor(bsr);
          -    ...
          +
          spatial.setShadowMode(ShadowMode.Inherit);     // This is the default setting for new spatials.
          +rootNode.setShadowMode(ShadowMode.Off);        // Disable shadows for the whole scene, except where overridden. 
          +wall.setShadowMode(ShadowMode.CastAndReceive); // The wall can cast shadows and also receive them.
          +floor.setShadowMode(ShadowMode.Receive);       // Any shadows cast by the floor would be hidden by it.
          +airplane.setShadowMode(ShadowMode.Cast);       // There's nothing above the airplane to cast shadows on it.
          +ghost.setShadowMode(ShadowMode.Off);           // The ghost is translucent: it neither casts nor receives shadows.

          -Shadow calculations (cast and receive) have a performance impact, therefor we recommend to use them smartly. Switch off the default shadow mode for the whole scene graph, and then specify the shadow behaviour individually for every scene node that needs shadows: You specifiy whether it casts shadows, receives shadows, both (slower), or neither (faster). +Both shadow renderers and shadow filters use shadow modes to determine which objects can cast shadows. However, only the shadow renderers pay attention to shadow modes when determining which objects receive shadows. With a shadow filter, shadow modes have no effect on which objects receive shadows.

          -
          rootNode.setShadowMode(ShadowMode.Off);        // reset all
          -wall.setShadowMode(ShadowMode.CastAndReceive); // normal behaviour (slow)
          -floor.setShadowMode(ShadowMode.Receive);       // can't see shadow cast below floor anyway...
          -airplane.setShadowMode(ShadowMode.Cast);       // nothing casts shadows onto airplane anyway...
          -ghost.setShadowMode(ShadowMode.Off);           // ghost is translucent anyway...
          - -
          - -

          DirectionalLightShadowRenderer

          -

          - -Full sample code +Here's a sample application which demonstrates both DirectionalLightShadowRenderer and DirectionalLightShadowFilter:

          + +

          + +Here is the key code fragment: + +

                  DirectionalLight sun = new DirectionalLight();
                   sun.setColor(ColorRGBA.White);
                   sun.setDirection(cam.getDirection());
          @@ -310,8 +277,24 @@ Full sample code
                   fpp.addFilter(dlsf);
                   viewPort.addProcessor(fpp);
          +

          +Constructor arguments: + * your AssetManager object + * size of the rendered shadow maps, in pixels per side (512, 1024, 2048, etc???) + * the number of shadow maps rendered (more shadow maps = better quality, but slower) +

          + +

          +Properties you can set: + * setDirection(Vector3f) ??? the direction of the light + * setLambda(0.65f) ??? to reduce the split size + * setShadowIntensity(0.7f) ??? shadow darkness (1=black, 0=invisible) + * setShadowZextend(float) ??? distance from camera to which shadows will be computed + +

          +
          - +

          Parallel-Split Shadow Map (deprecated)

          @@ -326,10 +309,6 @@ Full sample code

          -The more advanced PSSM shadow renderer can cast real-time shadows, even on curved surfaces such as terrains. It is a bit more resource hungry than the BasicShadowRenderer. To activate PSSM drop shadows, add a jME SceneProcessor named com.jme3.shadow.PssmShadowRenderer to the viewPort. PSSM stands for the Parallel-Split Shadow Map technique. -

          - -

          private PssmShadowRenderer pssmRenderer;
          @@ -340,42 +319,8 @@ public void simpleInitApp() {
               pssmRenderer.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal()); // light direction
               viewPort.addProcessor(pssmRenderer);
          -

          -The constructor expects the following values: -

          -
            -
          • Your assetManager object
            -
          • -
          • The size of the rendered shadowmaps (512, 1024, 2048, etc???)
            -
          • -
          • The number of shadow maps rendered (the more shadow maps, the more quality, the less FPS).
            -
          • -
          - -

          - -You can set the following properties on the pssmRenderer object: -

          -
            -
          • setDirection(Vector3f) ??? the direction of the light
            -
          • -
          • setLambda(0.65f) ??? Factor to use to reduce the split size
            -
          • -
          • setShadowIntensity(0.7f) ??? shadow darkness (1 black, 0 invisible)
            -
          • -
          • setShadowZextend() ??? distance how far away from camera shadows will still be computed
            -
          • -
          - -

          - -As said above, it's more efficient to specify individual shadow behaviour for each Geometry. -

          -
          teapot.setShadowMode(ShadowMode.CastAndReceive);
          -terrain.setShadowMode(ShadowMode.Receive); 
          -
          - +

          Screen Space Ambient Occlusion

          @@ -384,17 +329,21 @@ terrain.setShadowMode(ShadowMode.Receive); Full sample code

            -
          • , ??? Screen-Space Ambient Occlusion shadows
            +
          • ??? Screen-Space Ambient Occlusion shadows
          • ??? Screen-Space Ambient Occlusion shadows plus transparancy
          • -
          • +

          -Ambient Occlusion refers to the shadows that nearby objects cast on each other under an ambient lighting. It???s an approximation of how light radiates in a real life scene. To activate Ambient Occlusion shadows, add a jME SceneProcessor named com.jme3.post.SSAOFilter to the viewPort. SSAO stands for the Screen Space Ambient Occlusion technique. +Ambient Occlusion refers to the shadows which nearby objects cast on each other under an ambient lighting. Screen Space Ambient Occlusion (SSAO) approximates how light radiates in real life. +

          + +

          +In JME3, SSAO is implemented by adding an instance of com.jme3.post.SSAOFilter to a viewport which already simulates shadows using another method such as DirectionalLightShadowRenderer.

          FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
           SSAOFilter ssaoFilter = new SSAOFilter(12.94f, 43.92f, 0.33f, 0.61f);
          @@ -407,5 +356,5 @@ viewPort.addProcessor(fpp);

          - +

          view online version

          \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/mouse_picking.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/mouse_picking.html index 77760caf3..1f6274912 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/mouse_picking.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/mouse_picking.html @@ -22,7 +22,7 @@ See Input Handlin

          -The following pick target input mapping implements an action that determines what a user clicked. It assumes that the mouse pointer is invisible and there are crosshairs painted in the center of the screen. It assumes that the user aims the crosshairs at an object in the scene and clicks. You use Ray Casting to identify the geometry that was picked by the user. Use use this method together with a first-person flyCam. +The following pick target input mapping implements an action that determines what a user clicked. It assumes that the mouse pointer is invisible and there are crosshairs painted in the center of the screen. It assumes that the user aims the crosshairs at an object in the scene and clicks. You use Ray Casting to identify the geometry that was picked by the user. Use this method together with a first-person flyCam.

            @@ -72,7 +72,7 @@ The following example rotates Spatials named "Red Box" or "Blue B }; - +

            Pick a Target Using the Mouse Pointer

            @@ -146,5 +146,5 @@ The following example rotates Spatials named "Red Box" or "Blue B
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/multithreading.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/multithreading.html index efb29180f..b0a93d3a5 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/multithreading.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/multithreading.html @@ -4,7 +4,7 @@

            -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 happening automatically if using Controls and AppSates update metod 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. +jME3 is similar to Swing in that, for speed and efficiency, all changes to the scene graph must be made in a single update thread. If you make changes only in Control.update(), AppState.update(), or SimpleApplication.simpleUpdate(), this will happen automatically. However, if you pass work to another thread, you may need to pass results back to the main jME3 thread so that scene graph changes can take place there.

            public void rotateGeometry(final Geometry geo, final Quaternion rot) {
                 mainApp.enqueue(new Callable<Spatial>() {
            @@ -24,7 +24,7 @@ If the processing thread needs to wait or needs the return value then get(
             

            - +

            Multithreading Optimization

            @@ -46,7 +46,7 @@ Effectively, each for-loop in the main update loop might be a chance for multith

            - +

            Java Multithreading

            @@ -65,7 +65,7 @@ The java.util.concurrent package provides a good foundation for multithreading a
            - +

            Multithreading in jME3

            @@ -83,7 +83,7 @@ To avoid slowdown, we decide to keep the pathfinding operations in the NPC Contr

            - +

            Executor

            @@ -110,7 +110,7 @@ In your simple application you can override the destroy method and shutdown the }
            - +

            Control Class Fields

            @@ -130,7 +130,7 @@ Here we also created the Future variable to track the state of this task.

            - +

            Control Update() Method

            @@ -143,7 +143,7 @@ Next let's look at the update() call of the Control where the time-intensiv //If we have no waylist and not started a callable yet, do so! if(wayList == null && future == null){ //set the desired location vector, after that we should not modify it anymore - //because its being accessed on the other thread! + //because it's being accessed on the other thread! desiredLocation.set(getGoodNextLocation()); //start the callable on the executor future = executor.submit(findWay); // Thread starts! @@ -178,7 +178,7 @@ Remember not to mess with the class fields after starting the thread, because th

            - +

            The Callable

            @@ -230,7 +230,17 @@ private Callable<MyWayList> findWay = new Callable<MyWayList>(&# };
            - + +

            Useful Links

            +
            + +

            + +High level description which describes how to manage the game state and the rendering in different threads - +

            + +
            +

            Conclusion

            @@ -249,5 +259,5 @@ The cool thing about this approach is that every entity creates one self-contain
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/networking.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/networking.html index ea71f7074..78b2a1974 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/networking.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/networking.html @@ -53,15 +53,17 @@ You can register several types of listeners to be notified of changes.
          1. ConnectionListeners inform the Server about HostedConnection arrivals and removals, e.g. if a client joins or quits.
          2. +
          3. ErrorListeners inform the Client about network exceptions that have happened, e.g. if the server crashes, the client throws a ConnectorException, this can be picked up so that the application can do something about it.
            +
          4. - +

            Client and Server

            - +

            Creating a Server

            @@ -96,7 +98,7 @@ When you run this app on a host, the server is ready to accept clients. Let'

            - +

            Creating a Client

            @@ -135,7 +137,7 @@ When you run this client, it connects to the server.

            - +

            Getting Info About a Client

            @@ -158,7 +160,7 @@ The server refers to a connected client as com.jme3.network.HostedConnection obj myServer.getConnection(0)Server gets the first (0), second (1), etc, connected HostedConnection object (one client).
            - +

            Your game can define its own game data based on whatever criteria you want, typically these include player ID and state. If the server needs to look up player/client-specific information, you can store this information directly on the HostedConnection object. The following examples read and write a custom Java object MyState in the HostedConnection object conn: @@ -175,14 +177,14 @@ Your game can define its own game data based on whatever criteria you want, typi MyState state = conn.getAttribute("MyState") Server can read an attribute of the HostedConnection. - + - +

            Messaging

            - +

            Creating Message Types

            @@ -203,7 +205,7 @@ You must register each message type to the com.jme3.network.serializing.Serializ
            Serializer.registerClass(HelloMessage.class);
            - +

            Responding to Messages

            @@ -260,7 +262,7 @@ For each message type, register a server listener to the server:
            myServer.addMessageListener(new ServerListener(), HelloMessage.class);
            - +

            Creating and Sending Messages

            @@ -297,7 +299,7 @@ The last two broadcasting methods use com.jme3.network.Filters to select a subse

            - +

            Identification and Rejection

            @@ -308,21 +310,22 @@ The ID of the Client and HostedConnection are the same at both ends of a connect
            ... myClient.getId() ...

            -A server has a game version and game name property. Each client expects to communicate with a server with a certain game name and version. Test first whether the game name matches, and then whether game version matches, before sending any messages! If they do not match, you should refuse to connect, because unmatched clients and servers will likely miscommunicate. +A server has a game version and game name property. Each client expects to communicate with a server with a certain game name and version. Test first whether the game name matches, and then whether game version matches, before sending any messages! If they do not match, SpiderMoney will reject it for you, you have no choice in the mater. This is so the client and server can avoid miscommunication.

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

            +

            - +

            Closing Clients and Server Cleanly

            - +

            Closing a Client

            @@ -338,7 +341,7 @@ You must override the client's destroy() method to close the connection cle }
            - +

            Closing a Server

            @@ -354,7 +357,7 @@ You must override the server's destroy() method to close the connection whe }
            - +

            Kicking a Client

            @@ -365,7 +368,7 @@ The server can kick a HostedConnection to make it disconnect. You should provide
            conn.close("We kick cheaters.");
            - +

            Listening to Connection Notification

            @@ -375,13 +378,18 @@ The server and clients are notified about connection changes.

            - +

            ClientStateListener

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

            + +

            +

            The ClientStateListener when it receives a network exception applies the default close action. This just stops the client and you'll have to build around it so your application knows what to do. If you need more control when a network exception happens and the client closes, you may want to investigate in a ErrorListener. +

            @@ -395,7 +403,7 @@ The com.jme3.network.ClientStateListener notifies the Client when the Client has
            public void clientDisconnected(Client c, DisconnectInfo info){} Implement here what happens after the server kicks this client. For example, display the DisconnectInfo to the user.
            - +

            First implement the ClientStateListener interface in the Client class. Then register it to myClient in MyGameClient's simpleInitApp() method: @@ -403,7 +411,7 @@ First implement the ClientStateListener interface in the Client class. Then regi

            myClient.addClientStateListener(this);
            - +

            ConnectionListener

            @@ -423,7 +431,7 @@ The com.jme3.network.ConnectionListener notifies the Server whenever new HostedC public void connectionRemoved(Server s, HostedConnection c){} Implement here what happens after a HostedConnection has left. E.g. a player has quit the game and the server removes his character.
            - +

            First implement the ConnectionListener interface in the Server class. Then register it to myServer in MyGameServer's simpleInitApp() method. @@ -432,7 +440,55 @@ First implement the ConnectionListener interface in the Server class. Then regis

            myServer.addConnectionListener(this);
            - + +

            ErrorListener

            +
            + +

            + +The com.jme3.network.ErrorListener is a listener for when network exception happens. This listener is built so that you can override the default actions when a network exception happens. +

            + +

            +

            If you intend on using the default network mechanics, don't use this! +If you do override this, make sure you add a mechanic that can close the client otherwise your client will get stuck open and cause errors. +

            + +

            +
            + + + + + + +
            ErrorListener interface method Purpose
            public void handleError(Client c, Throwable t){} Implemenent here what happens after a exception affects the network .
            + +

            + +

            This interface was built for the client and server, but the code has never been put on the server to handle this listener. +

            +

            + +

            +First implement the ErrorListener interface in the client class. Then you need to register it to myClient in MyGameClients's simpleInitApp() method. +

            +
            myClient.addErrorListener(this);
            + +

            +In the class that implements the ErrorListener, a method would of been added call handleError(Client s, Throwable t). Inside this method to get you started, you going to want to listen for an error. To do this you're going to want a bit of code like this. +

            +
            if(t instanceof exception) {
            +     //Add your own code here
            +}
            + +

            +Replace exception part in the if statement for the type of exception that you would like it to handle. + +

            + +
            +

            UDP versus TCP

            @@ -450,7 +506,7 @@ message2.setReliable(false); // UDP
            - +

            Important: Use Multi-Threading

            @@ -474,7 +530,7 @@ For general advice, see the articles +

            Troubleshooting

            @@ -489,5 +545,5 @@ If you have set up a server in your home network, and the game clients cannot re
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui.html index 4a9fdd813..52a536314 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui.html @@ -154,10 +154,16 @@ Learn more from the NiftyGUI page:
          5. +
          6. +
          7. +
          8. +
          9. +
          10. +
          11. - +

            Next Steps

            @@ -170,10 +176,12 @@ Now that you understand the concepts and know where to find more information, le
          12. +
          13. +
          14. - +

            Nifty Logging (Nifty 1.3.1)

            @@ -191,5 +199,5 @@ Logger.getLogger("NiftyInputEventHandlingLog").setLevel(Level.SEVERE);
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_java_interaction.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_java_interaction.html index 65166b537..d2ad0dba8 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_java_interaction.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_java_interaction.html @@ -26,7 +26,7 @@ In the previous parts of the tutorial, you created a two-screen user interface.

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

            @@ -100,7 +100,7 @@ Now the Java class MyStartScreen and this +

            Make GUI and Java Interact

            @@ -114,7 +114,7 @@ Use any combination of the three following approaches to make Java classes inter

            - +

            GUI Calls a Void Java Method

            @@ -214,7 +214,7 @@ The quitGame() example shows that you have access to the application app
            - +

            GUI Gets Return Value from Java Method

            @@ -253,7 +253,7 @@ You can use this for Strings and numeric values (e.g. when you read settings fro

            - +

            Java Modifies Nifty Elements and Events

            @@ -293,7 +293,7 @@ For this to work, there already needs to be a (possibly inactive) <inte
            <interact onClick="doNothing()"/>
            - +

            Next Steps

            @@ -317,5 +317,5 @@ You're done with the basic Nifty
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_scenarios.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_scenarios.html index ca47d84bf..d6ec99bd6 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_scenarios.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_scenarios.html @@ -104,8 +104,22 @@ public StartScreenState(SimpleApplication app){   } +

            + +

            It is not sufficient to just inherit from AbstractAppState. You need to instantiate your controller class, register it with app's stateManager and then pass it to nifty. See code sample below. +

            +

            +
            public class TestNiftyGui extends SimpleApplication {
            +  public void simpleInitApp() {
            +     StartScreenState startScreenState = new StartScreenState(this);
            +     stateManager.attach(startScreenState);
            +     // [...] boilerplate init nifty omitted
            +     nifty.fromXml("Interface/myGui.xml", "start", startScreenState); //one of the XML screen elements needs to reference StartScreenState controller class
            +  }
            +}
            + - +

            Know Your Variables

            @@ -125,14 +139,14 @@ 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:

            - +

            Use ScreenControllers for Mutally Exclusive Functionality

            @@ -152,7 +166,7 @@ For example, create a MyHudScreen.java for the hud scr
            - +

            Create a "Loading..." Screen

            @@ -162,7 +176,7 @@ Get the full Load

            - +

            Create a Popup Menu

            @@ -172,7 +186,7 @@ Get the full +

            Add Visual Effects

            @@ -206,7 +220,7 @@ Learn more from the NiftyGUI page:
            - +

            Add Sound Effects

            @@ -223,7 +237,7 @@ Playing sounds using Nifty is also possible with a playSound effect </label>
            - +

            Pass ClickLoc From Nifty to Java

            @@ -253,7 +267,7 @@ You can name the method (here clicked) what ever you like, as long

            - +

            Load Several XML Files

            @@ -274,7 +288,7 @@ stateManager.attach(optionsControl); guiViewPort.addProcessor(niftyDisplay);
            - +

            Register additional explicit screen controllers

            @@ -293,7 +307,7 @@ nifty.registerScreenController(new OptionsScreenController(randomConstru nifty.addXml("Interface/Screens/OptionsScreen.xml");
            - +

            Design Your Own Styles

            @@ -345,5 +359,5 @@ Learn more from the NiftyGUI page:
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_xml_layout.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_xml_layout.html index 5450391f5..81fa57af9 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_xml_layout.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/nifty_gui_xml_layout.html @@ -100,7 +100,7 @@ The following minimal XML
            <?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">
            +  xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty-1.3.xsd">
               <screen id="start">
                 <!-- ... -->
               </screen>
            @@ -118,7 +118,7 @@ Every Nifty GUI must have a
             

            - +

            Make Layers

            @@ -150,7 +150,7 @@ In a layer, you can now add panels and arrange them. Panels are containers that

            - +

            Make Panels

            @@ -203,7 +203,7 @@ The result should look as follows:

            - +

            Adding Content to Panels

            @@ -213,7 +213,7 @@ See also <

            - +

            Add Images

            @@ -258,7 +258,7 @@ This image is scaled to use 50% of the height and 30% of the width of its contai

            - +

            Add Static Text

            @@ -285,7 +285,7 @@ The font used is jME3's default font "Interface/Fonts/Default.fnt"

            - +

            Add Controls

            @@ -351,7 +351,7 @@ Nifty additionally offers many customizable controls such as check boxes, text f

            - +

            Intermediate Result

            @@ -369,7 +369,7 @@ Compare this result with the layout draft above.

            - +

            Next Steps

            @@ -391,5 +391,5 @@ Integrate the GUI into the g
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/physics.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/physics.html index 4da7e2e78..d2af4ff00 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/physics.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/physics.html @@ -360,12 +360,12 @@ Click the links for details on the special PhysicsControls. This article is abou -

            PhysicsControls Code Samples

            +

            Physics Control Code Samples

            -The PhysicsControl constructors expect a Collision Shape and a mass (a float in kilogram). The most commonly used PhysicsControl is the RigidBodyControl: +The most commonly used physics control is RigidBodyControl. The RigidBodyControl constructor takes up to two parameters: a collision shape and a mass (a float in kilograms). The mass parameter also determines whether the object is dynamic (movable) or static (fixed). For a static object such as a floor or wall, specify zero mass.

            RigidBodyControl myThing_phys = 
                 new RigidBodyControl( myThing_shape , 123.0f ); // dynamic
            @@ -373,7 +373,7 @@ The PhysicsControl constructors expect a Collision Shape and a mass (a float in new RigidBodyControl( myDungeon_shape , 0.0f ); // static

            -

            When you create the PhysicsControl, the mass value makes an important distinction: Set the mass to a non-zero value to create a dynamic object that can fall or roll, etc. Set the mass value to zero to create a static object, such as floor, wall, etc. If you give your floor a mass, it will fall out of the scene! +

            If you give your floor a non-zero mass, it will fall out of the scene!

            @@ -395,10 +395,11 @@ gameLevel.addControl(new RigidBodyControl(0.0f)); // explicit ze

            Spheres and Boxes automatically fall back on the correct default CollisionShape if you do not specify a CollisionShape in the RigidBodyControl constructor. Complex static objects can fall back on MeshCollisionShapes, unless it is a Node, in which case it will become a CompoundCollisionShape containing a MeshCollisionShape

            +

            - +

            Add PhysicsControl to Spatial

            @@ -415,7 +416,7 @@ For each physical Spatial in the scene:
            - +

            Add PhysicsControl to PhysicsSpace

            @@ -442,7 +443,7 @@ myThing_geo.removeFromParent();

            - +

            Changing the Scale of a PhysicsControl

            @@ -481,7 +482,7 @@ With the corresponding output below:

            - +

            PhysicsSpace Code Samples

            @@ -511,9 +512,9 @@ setWorldMin(new Vector3f(-10000f, -10000f, -10000f));Specifies the size setCcdMotionThreshold()The amount of motion in 1 physics tick to trigger the continuous motion detection in moving objects that push one another. Rarely used, but necessary if your moving objects get stuck or roll through one another.
            - +
            - +

            Specify Physical Properties

            @@ -553,7 +554,7 @@ This setting has an impact on performance, so use it sparingly. Brick: Rubber ball: 1.0f
            - +

            On a RigidBodyControl, you can apply the following physical forces: @@ -574,9 +575,9 @@ On a RigidBodyControl, you can apply the following physical forces: (See detailed explanation below.) - + - +

            Kinematic vs Dynamic vs Static

            @@ -626,7 +627,7 @@ setKinematic(true);setMass(1f);
            setKinematic(false);
            - +

            When Do I Use Kinematic Objects?

            @@ -649,7 +650,7 @@ setKinematic(false);

            - +

            Forces: Moving Dynamic Objects

            @@ -687,7 +688,7 @@ Use the following methods to move dynamic physical objects. 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 object overlaps with another! Within the game, you typically use the setters shown here exclusively. @@ -727,7 +728,7 @@ removeCollideWithGroup(COLLISION_GROUP_01)Collision Groups are integer setCcdSweptSphereRadius(.5f)Bullet does not use the full collision shape for continuous collision detection, instead it uses a "swept sphere" shape to approximate a motion, which can be imprecise and cause strange behaviors such as objects passing through one another or getting stuck. Only relevant for fast moving dynamic bodies.
            - +

            You can setApplyPhysicsLocal(true) for an object to make it move relatively to its local physics space. You would do that if you need a physics space that moves with a node (e.g. a spaceship with artificial gravity surrounded by zero-g space). By default, it's set to false, and all movement is relative to the world. @@ -735,7 +736,7 @@ removeCollideWithGroup(COLLISION_GROUP_01)Collision Groups are integer

            - +

            Best Practices

              @@ -771,7 +772,7 @@ removeCollideWithGroup(COLLISION_GROUP_01)Collision Groups are integer
            -
            +
            1) Inertia is calculated for kinematic objects, and you need mass to do that.
            diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/post-processor_water.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/post-processor_water.html index b106f4fc1..f19599224 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/post-processor_water.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/post-processor_water.html @@ -188,11 +188,11 @@ manager.loadTexture("Textures/wavenormals.png") )This normal water.setWaterColor(ColorRGBA.Brown.mult(2.0f));Sets the main water color.greenish blue
            -Vector3f(0.0f,0.5f,0.5f,1.0f) +ColorRGBA(0.0f,0.5f,0.5f,1.0f) water.setDeepWaterColor(ColorRGBA.Brown);Sets the deep water color.dark blue
            -Vector3f(0.0f, 0.0f,0.2f,1.0f) +ColorRGBA(0.0f, 0.0f,0.2f,1.0f) water.setWaterTransparency(0.2f);Sets how fast colors fade out. use this to control how clear (e.g. 0.05f) or muddy (0.2f) water is. 0.1f @@ -201,7 +201,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)
            -
            +
            @@ -216,7 +216,7 @@ water.setRadius(260);
            Water method example Effects: ShoreDefault
            Limit the water filter to a semisphere with the gi water.setUseHQShoreline(false);Renders shoreline with better quality ?true
            -
            +
            @@ -234,7 +234,7 @@ water.setRadius(260);
            Water method example Effects: FoamDefault
            Limit the water filter to a semisphere with the gi manager.loadTexture("Textures/foam.png") )This foam texture will be used with WrapMode.Repeat"Common/MatDefs/Water/Textures/foam.jpg"
            -
            +
            @@ -260,9 +260,9 @@ manager.loadTexture("Textures/foam.png") )
            Water method example Effects: LightDefault
            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
            - + - +

            Sound Effects

            @@ -291,5 +291,5 @@ See also:
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/terrain.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/terrain.html index c092e2096..28a753092 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/terrain.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/terrain.html @@ -7,14 +7,14 @@ The goal of TerraMonkey is to provide a base implementation that will be usable for 80% of people's goals, while providing tools and a good foundation for the other 20% to build off of. Check out the videos in the following announcements:

              -
            • +
            • -
            • +
            - +

            Overview

            @@ -38,7 +38,7 @@ TerraMonkey is a GeoMipMapping quad tree of terrain tiles that supports real tim
            - +

            Current Features:

              @@ -55,7 +55,7 @@ TerraMonkey is a GeoMipMapping quad tree of terrain tiles that supports real tim
            - +

            Planned Features:

              @@ -66,7 +66,7 @@ TerraMonkey is a GeoMipMapping quad tree of terrain tiles that supports real tim
            - +

            Sample Code

              @@ -83,7 +83,7 @@ TerraMonkey is a GeoMipMapping quad tree of terrain tiles that supports real tim
            - +

            Geo Mip Mapping

            @@ -105,7 +105,7 @@ GeoMipMapping in TerraMonkey has been split into several parts: the terrain quad

            - +

            Terrain Quad Tree

            @@ -115,7 +115,7 @@ TerraMonkey is a quad tree. Each node is a TerrainQuad, and each leaf is a Terra

            - +

            Texture Splatting

            @@ -185,7 +185,7 @@ Here are the names of TerrainLighting.j3md's material properties:

            -Video cards support a maximum of 16 Splat textures total. This means you can only use a subset of material properties at the same time! +OpenGL supports a maximum of 16 samplers in any given shader. This means you can only use a subset of material properties at the same time if you use the terrain's default lighting shader (TerrainLighting.j3md)!

            @@ -237,7 +237,7 @@ You can hand-paint Alpha, Diffuse, Glow, and Specular maps in a drawing program,

            - +

            Code Sample: Terrain.j3md

            @@ -304,5 +304,5 @@ PS: As an alternative to an image-based height map, you can also generate a Hill
            heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/walking_character.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/walking_character.html index 80bebd27d..362551789 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/walking_character.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/advanced/walking_character.html @@ -419,6 +419,15 @@ This method resets the walk animation. }   public void onAnimChange(AnimControl control, AnimChannel channel, String animName) { } + + + +

            See also

            +
            +
              +
            • +
            • +
            documentation, physics, @@ -430,5 +439,5 @@ public void onAnimChange(AnimControl control, AnimChannel channel, String an
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/beginner-materials.png b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/beginner-materials.png index fb9a2ce59..b98e4f987 100644 Binary files a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/beginner-materials.png and b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/beginner-materials.png differ diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_asset.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_asset.html index 07f98cf87..db71a3421 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_asset.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_asset.html @@ -55,7 +55,7 @@ public class HelloAssets extends SimpleApplication { rootNode.attachChild(teapot);   // Create a wall with a simple texture from test_data - Box box = new Box(Vector3f.ZERO, 2.5f,2.5f,1.0f); + Box box = new Box(2.5f,2.5f,1.0f); Spatial wall = new Geometry("Box", box ); Material mat_brick = new Material( assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); @@ -93,7 +93,7 @@ Build and run the code sample. You should see a green Ninja with a colorful teap

            - +

            The Asset Manager

            @@ -115,16 +115,17 @@ The AssetManager can load files from: The following is the recommended directory structure for storing assets in your project directoy:

            -
            MyGame/assets/Interface/
            +
            MyGame/assets/               
            +MyGame/assets/Interface/
             MyGame/assets/MatDefs/
             MyGame/assets/Materials/
            -MyGame/assets/Models/
            +MyGame/assets/Models/       <-- your .j3o models go here
             MyGame/assets/Scenes/
             MyGame/assets/Shaders/
            -MyGame/assets/Sounds/
            -MyGame/assets/Textures/
            -MyGame/build.xml            <-- Ant build script
            -MyGame/src/...              <-- Java sources go here
            +MyGame/assets/Sounds/       <-- your audio files go here
            +MyGame/assets/Textures/     <-- your textures go here
            +MyGame/build.xml            <-- Default Ant build script
            +MyGame/src/...              <-- your Java sources go here
             MyGame/...

            @@ -132,7 +133,7 @@ This is just a suggested best practice, and it's what you get by default wh

            - +

            Loading Textures

            @@ -141,7 +142,7 @@ This is just a suggested best practice, and it's what you get by default wh Place your textures in a subdirectory of assets/Textures/. Load the texture into the material before you set the Material. The following code sample is from the simpleInitApp() method and loads a simple wall model:

            // Create a wall with a simple texture from test_data
            -Box box = new Box(Vector3f.ZERO, 2.5f,2.5f,1.0f);
            +Box box = new Box(2.5f,2.5f,1.0f);
             Spatial wall = new Geometry("Box", box );
             Material mat_brick = new Material( 
                 assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            @@ -156,7 +157,7 @@ In this case, you 
             
             
            - +

            Loading Text and Fonts

            @@ -179,7 +180,7 @@ guiNode.attachChild(helloText);

            - +

            Loading a Model

            @@ -203,7 +204,7 @@ Note that you do not need to create a Material if you exported the model with a

            - +

            Loading Assets From Custom Paths

            @@ -233,18 +234,19 @@ JME3 offers ClasspathLocator, ZipLocator, FileLocator, HttpZipLocator, and UrlLo

            - +

            Creating Models and Scenes

            -To create 3D models and scenes, you need a 3D Mesh Editor with an OgreXML Exporter plugin. For example, you can . -You use the SDK to load models, convert models and create scenes from them. +To create 3D models and scenes, you need a 3D Mesh Editor. If you don't have any tools, install Blender and the OgreXML Exporter plugin. +Then you and export them to your project. +Then you use the SDK to load models, convert models, and create 3D scenes from them.

            -If you use Blender, export your models as Ogre XML meshes with materials as follows: +Example: From Blender, you export your models as Ogre XML meshes with materials as follows:

            1. Open the menu File > Export > OgreXML Exporter to open the exporter dialog.
              @@ -272,17 +274,28 @@ If you use Blender, export your models as Ogre +

              Model File Formats

              -JME3 can load Ogre XML models + materials, Ogre DotScenes, as well as Wavefront OBJ+MTL models. The loadModel() code works with these files when you run the code directly from the jMonkeyEngine SDK. +JME3 can convert and load

              +
                +
              • Ogre XML models + materials,
                +
              • +
              • Ogre DotScenes,
                +
              • +
              • Wavefront OBJ + MTL models,
                +
              • +
              • .Blend files.
                +
              • +

              -If you build the executables using the default build script, then the original model files (XML, OBJ, etc) are not included. When you run the executable, you get an error message if you try to load any models directly: + +The loadModel() method loads these original file formats when you run your code directly from the SDK. If you however build the executables using the default build script, then the original model files (XML, OBJ, etc) are not included. This means, when you run the executable outside the SDK, and load any original models directly, you get the following error message:

              com.jme3.asset.DesktopAssetManager loadAsset
               WARNING: Cannot locate resource: Models/Ninja/Ninja.mesh.xml
              @@ -291,11 +304,11 @@ SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
               java.lang.NullPointerException

              -Loading the XML/OBJ files directly is only acceptable during the development phase. If your graphic designer pushes updated files to the asset directory, you can quickly review the latest version in your development environment. +You see that loading the XML/OBJ/Blend files directly is only acceptable during the development phase in the SDK. For example, every time your graphic designer pushes updated files to the asset directory, you can quickly review the latest version in your development environment.

              -For testing and for the final release build, you use .j3o files exclusively. J3o is an optimized binary format for jME3 applications, and .j3o files are automatically included in the distributable JAR file by the build script. When you do QA test builds or are ready to release, use the SDK to convert all .obj/.scene/.xml/.blend files to .j3o files, and only load the .j3o versions. +But for QA test builds and for the final release build, you use .j3o files exclusively. J3o is an optimized binary format for jME3 applications. When you do QA test builds, or are ready to release, use the SDK to convert all .obj/.scene/.xml/.blend files to .j3o files, and update all code to load the .j3o files. The default build script automatically packages .j3o files in the executables.

              @@ -306,18 +319,20 @@ Open your JME3 Project in the jMonkeyEngine +

              Loading Models and Scenes

              @@ -346,9 +361,9 @@ rootNode.attachChild(scene);
              - +
              - +

              Excercise - How to Load Assets

              @@ -435,7 +450,7 @@ Here is a third method you must know, loading a scene/model from a .j3o file:
            2. In the projects window, browse to the assets/Scenes/town directory.
            3. -
            4. Right-click the main.scene and convert the scene to binary: The jMoneyPlatform generates a main.j3o file.
              +
            5. Right-click the main.scene and convert the scene to binary: The jMonkeyPlatform generates a main.j3o file.
            6. Add the following code under simpleInitApp() {
                  Spatial gameLevel = assetManager.loadModel("Scenes/town/main.j3o");
                   gameLevel.setLocalTranslation(0, -5.2f, 0);
              @@ -453,7 +468,7 @@ Again, you should see the Ninja+wall+teapot standing in a town. 
            - +

            Conclusion

            @@ -497,5 +512,5 @@ Let's add some action to the scene and continue with the +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_audio.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_audio.html index e3dc9130b..64c73b799 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_audio.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_audio.html @@ -24,11 +24,11 @@ This tutorial explains how to add 3D sound to a game, and how to make sounds pla   import com.jme3.app.SimpleApplication; import com.jme3.audio.AudioNode; +import com.jme3.input.MouseInput; import com.jme3.input.controls.ActionListener; import com.jme3.input.controls.MouseButtonTrigger; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; -import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box;   @@ -49,10 +49,9 @@ public class HelloAudio extends SimpleApplication { flyCam.setMoveSpeed(40);   /** just a blue box floating in space */ - Box box1 = new Box(Vector3f.ZERO, 1, 1, 1); + Box box1 = new Box(1, 1, 1); player = new Geometry("Player", box1); - Material mat1 = new Material(assetManager, - "Common/MatDefs/Misc/Unshaded.j3md"); + Material mat1 = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md"); mat1.setColor("Color", ColorRGBA.Blue); player.setMaterial(mat1); rootNode.attachChild(player); @@ -66,23 +65,23 @@ public class HelloAudio extends SimpleApplication { private void initAudio() { /* gun shot sound is to be triggered by a mouse click. */ audio_gun = new AudioNode(assetManager, "Sound/Effects/Gun.wav", false); + audio_gun.setPositional(false); audio_gun.setLooping(false); audio_gun.setVolume(2); rootNode.attachChild(audio_gun);   /* nature sound - keeps playing in a loop. */ - audio_nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", false); + audio_nature = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", true); audio_nature.setLooping(true); // activate continuous playing - audio_nature.setPositional(true); - audio_nature.setLocalTranslation(Vector3f.ZERO.clone()); + audio_nature.setPositional(true); audio_nature.setVolume(3); rootNode.attachChild(audio_nature); audio_nature.play(); // play continuously! }   - /** Declaring "Shoot" action, mapping it to a trigger (mouse click). */ + /** Declaring "Shoot" action, mapping it to a trigger (mouse left click). */ private void initKeys() { - inputManager.addMapping("Shoot", new MouseButtonTrigger(0)); + inputManager.addMapping("Shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); inputManager.addListener(actionListener, "Shoot"); }   @@ -110,7 +109,7 @@ When you run the sample, you should see a blue cube. You should hear a nature-li

            - +

            Understanding the Code Sample

            @@ -124,7 +123,7 @@ Let's have a closer look at initAudio() to learn how to use
            - +

            AudioNodes

            @@ -153,10 +152,17 @@ These two lines create new sound nodes from the given audio files in the AssetMa

            You want the gunshot sound to play once (you don't want it to loop). You also specify its volume as gain factor (at 0, sound is muted, at 2, it is twice as loud, etc.).

            -
                audio_gun.setLooping(false);
            +
                audio_gun.setPositional(false);
            +    audio_gun.setLooping(false);
                 audio_gun.setVolume(2);
                 rootNode.attachChild(audio_gun);
            +

            + +

            Note that setPositional(false) is pretty important when you use stereo sounds. Positional sounds must always be mono audio files, otherwise the engine will remind it to you with a crash. +

            +

            +

            The nature sound is different: You want it to loop continuously as background sound. This is why you set looping to true, and immediately call the play() method on the node. You also choose to set its volume to 3.

            @@ -184,7 +190,7 @@ Here you make audio_nature a positional sound that comes from a certain place. F

            - +

            Triggering Sound

            @@ -192,9 +198,9 @@ Here you make audio_nature a positional sound that comes from a certain place. F Let's have a closer look at initKeys(): As you learned in previous tutorials, you use the inputManager to respond to user input. Here you add a mapping for a left mouse button click, and name this new action Shoot.

            -
              /** Declaring "Shoot" action, mapping it to a trigger (mouse click). */
            +
              /** Declaring "Shoot" action, mapping it to a trigger (mouse left click). */
               private void initKeys() {
            -    inputManager.addMapping("Shoot", new MouseButtonTrigger(0));
            +    inputManager.addMapping("Shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
                 inputManager.addListener(actionListener, "Shoot");
               }
            @@ -213,10 +219,11 @@ Setting up the ActionListener should also be familiar from previous tutorials. Y

            Since you want to be able to shoot fast repeatedly, so you do not want to wait for the previous gunshot sound to end before the next one can start. This is why you play this sound using the playInstance() method. This means that every click starts a new instance of the sound, so two instances can overlap. You set this sound not to loop, so each instance only plays once. As you would expect it of a gunshot. +

            - +

            Ambient or Situational?

            @@ -265,7 +272,7 @@ Apart from the looping boolean, another difference is where play().playIns
            - +

            Buffered or Streaming?

            @@ -274,7 +281,7 @@ Apart from the looping boolean, another difference is where play().playIns The Boolean in the AudioNode constructor defines whether the audio is buffered (false) or streamed (true). For example:

            -
            audio_nature = new AudioNode(assetManager, "Sound/Effects/Gun.wav", false); // buffered
            +
            audio_gunshot = new AudioNode(assetManager, "Sound/Effects/Gun.wav", false); // buffered
             ...
             audio_nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true); // streamed 
            @@ -288,7 +295,7 @@ Note that streamed sounds can not loop (i.e. setLooping will not work as you exp

            - +

            Play() or PlayInstance()?

            @@ -305,9 +312,9 @@ Note that streamed sounds can not loop (i.e. setLooping will not work as you exp
            The same sound cannot play twice at the same time.The same sounds can play multiple times and overlap.
            - +
            - +

            Your Ear in the Scene

            @@ -329,7 +336,7 @@ If you don't do that, the results of 3D audio will be quite random.

            - +

            Global, Directional, Positional?

            @@ -356,7 +363,7 @@ In short, you must choose in every situation whether it makes sense for a sound

            - +

            Conclusion

            @@ -391,5 +398,5 @@ See also:
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_collision.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_collision.html index e6082fed4..7b4661f34 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_collision.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_collision.html @@ -69,6 +69,11 @@ public class HelloCollision extends SimpleApplication private CharacterControl player; private Vector3f walkDirection = new Vector3f(); private boolean left = false, right = false, up = false, down = false; +  + //Temporary vectors used on each frame. + //They here to avoid instanciating new vectors on each frame + private Vector3f camDir = new Vector3f(); + private Vector3f camLeft = new Vector3f();   public static void main(String[] args) { HelloCollision app = new HelloCollision(); @@ -111,7 +116,7 @@ public class HelloCollision extends SimpleApplication player.setGravity(30); player.setPhysicsLocation(new Vector3f(0, 10, 0));   - // We attach the scene and the player to the rootNode and the physics space, + // We attach the scene and the player to the rootnode and the physics space, // to make them appear in the game world. rootNode.attachChild(sceneModel); bulletAppState.getPhysicsSpace().add(landscape); @@ -147,17 +152,17 @@ public class HelloCollision extends SimpleApplication   /** These are our custom actions triggered by key presses. * We do not walk yet, we just keep track of the direction the user pressed. */ - public void onAction(String binding, boolean value, float tpf) { + public void onAction(String binding, boolean isPressed, float tpf) { if (binding.equals("Left")) { - left = value; + left = isPressed; } else if (binding.equals("Right")) { - right = value; + right= isPressed; } else if (binding.equals("Up")) { - up = value; + up = isPressed; } else if (binding.equals("Down")) { - down = value; + down = isPressed; } else if (binding.equals("Jump")) { - player.jump(); + if (isPressed) { player.jump(); } } }   @@ -169,25 +174,34 @@ public class HelloCollision extends SimpleApplication * We also make sure here that the camera moves with player. */ @Override - public void simpleUpdate(float tpf) { - Vector3f camDir = cam.getDirection().clone().multLocal(0.6f); - Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f); - walkDirection.set(0, 0, 0); - if (left) { walkDirection.addLocal(camLeft); } - if (right) { walkDirection.addLocal(camLeft.negate()); } - if (up) { walkDirection.addLocal(camDir); } - if (down) { walkDirection.addLocal(camDir.negate()); } - player.setWalkDirection(walkDirection); - cam.setLocation(player.getPhysicsLocation()); - } + public void simpleUpdate(float tpf) { + camDir.set(cam.getDirection()).multLocal(0.6f); + camLeft.set(cam.getLeft()).multLocal(0.4f); + walkDirection.set(0, 0, 0); + if (left) { + walkDirection.addLocal(camLeft); + } + if (right) { + walkDirection.addLocal(camLeft.negate()); + } + if (up) { + walkDirection.addLocal(camDir); + } + if (down) { + walkDirection.addLocal(camDir.negate()); + } + player.setWalkDirection(walkDirection); + cam.setLocation(player.getPhysicsLocation()); + } }

            Run the sample. You should see a town square with houses and a monument. Use the WASD keys and the mouse to navigate around with a first-person perspective. Run forward and jump by pressing W and Space. Note how you step over the sidewalk, and up the steps to the monument. You can walk in the alleys between the houses, but the walls are solid. Don't walk over the edge of the world! :-) +

            - +

            Understanding the Code

            @@ -206,7 +220,12 @@ You already know that SimpleApplication is the base class for all jME3 games. Yo private RigidBodyControl landscape; private CharacterControl player; private Vector3f walkDirection = new Vector3f(); - private boolean left = false, right = false, up = false, down = false; + private boolean left = false, right = false, up = false, down = false; +  + //Temporary vectors used on each frame. + //They here to avoid instanciating new vectors on each frame + private Vector3f camDir = new Vector3f(); + private Vector3f camLeft = new Vector3f();

            You initialize a few private fields: @@ -222,15 +241,18 @@ You initialize a few private fields:

          15. The fields walkDirection and the four Booleans are used for physics-controlled navigation.
          16. +
          17. camDir and camLeft are temporary vectors used later when computing the walkingDirection from the cam position and rotation
            +
          18. Let's have a look at all the details: +

            - +

            Initializing the Game

            @@ -254,7 +276,7 @@ As usual, you initialize the game in the simpleInitApp() method.
            - +

            The Physics-Controlled Scene

            @@ -301,7 +323,7 @@ To use collision detection, you add a RigidBodyControl to the sceneModel
            - +

            The Physics-Controlled Player

            @@ -353,7 +375,7 @@ Finally we put the player in its starting position and update its state ??? reme

            - +

            PhysicsSpace

            @@ -369,7 +391,7 @@ The invisible body of the character just sits there on the physical floor. It ca

            - +

            Navigation

            @@ -387,7 +409,7 @@ In short, you must re-define the flyCam's navigational key mappings to use

            - +

            1. inputManager

            @@ -413,7 +435,7 @@ You can move this block of code into an auxiliary method setupKeys()
            - +

            2. onAction()

            @@ -444,7 +466,7 @@ For all other directions: Every time the user presses one of the WASD keys, you

            - +

            3. setWalkDirection()

            @@ -456,17 +478,25 @@ Previously in the onAction() method, you have collected the info in

            This last and most important code snippet goes into the simpleUpdate() method.

            -
              public void simpleUpdate(float tpf) {
            -    Vector3f camDir = cam.getDirection().clone().multLocal(0.6f);
            -    Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f);
            -    walkDirection.set(0, 0, 0);
            -    if (left)  { walkDirection.addLocal(camLeft); }
            -    if (right) { walkDirection.addLocal(camLeft.negate()); }
            -    if (up)    { walkDirection.addLocal(camDir); }
            -    if (down)  { walkDirection.addLocal(camDir.negate()); }
            -    player.setWalkDirection(walkDirection);
            -    cam.setLocation(player.getPhysicsLocation());
            -  }
            +
             public void simpleUpdate(float tpf) {
            +        camDir.set(cam.getDirection()).multLocal(0.6f);
            +        camLeft.set(cam.getLeft()).multLocal(0.4f);
            +        walkDirection.set(0, 0, 0);
            +        if (left) {
            +            walkDirection.addLocal(camLeft);
            +        }
            +        if (right) {
            +            walkDirection.addLocal(camLeft.negate());
            +        }
            +        if (up) {
            +            walkDirection.addLocal(camDir);
            +        }
            +        if (down) {
            +            walkDirection.addLocal(camDir.negate());
            +        }
            +        player.setWalkDirection(walkDirection);
            +        cam.setLocation(player.getPhysicsLocation());
            +    }

            This is how the walking is triggered: @@ -491,10 +521,11 @@ This is how the walking is triggered:

            Important: Again, do not use setLocalTranslation() to walk the player around. You will get it stuck by overlapping with another physical object. You can put the player in a start position with setPhysicalLocation() if you make sure to place it a bit above the floor and away from obstacles. +

            - +

            Conclusion

            @@ -535,5 +566,5 @@ Related info:
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_input_system.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_input_system.html index 8fcecd1da..4f7c5e1f5 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_input_system.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_input_system.html @@ -65,8 +65,8 @@ public class HelloInput extends SimpleApplication { inputManager.addMapping("Rotate", new KeyTrigger(KeyInput.KEY_SPACE), new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); // Add the names to the action listener. - inputManager.addListener(actionListener, new String[]{"Pause"}); - inputManager.addListener(analogListener, new String[]{"Left", "Right", "Rotate"}); + inputManager.addListener(actionListener,"Pause"); + inputManager.addListener(analogListener,"Left", "Right", "Rotate");   }   @@ -112,7 +112,7 @@ Build and run the example. - +

            Defining Mappings and Triggers

            @@ -164,15 +164,16 @@ Now you need to register your trigger mappings.
                // Add the names to the action listener.
            -    inputManager.addListener(actionListener, new String[]{"Pause"});
            -    inputManager.addListener(analogListener, new String[]{"Left", "Right", "Rotate"});
            + inputManager.addListener(actionListener,"Pause"); + inputManager.addListener(analogListener,"Left", "Right", "Rotate");

            This code goes into the simpleInitApp() method. But since we will likely add many keybindings, we extract these lines and wrap them in an auxiliary method, initKeys(). The initKeys() method is not part of the Input Controls interface ??? you can name it whatever you like. Just don't forget to call your method from the initSimpleApp() method. +

            - +

            Implementing the Actions

            @@ -268,7 +269,7 @@ It's okay to use only one of the two Listeners, and not implement the other

            - +

            Analog, Pressed, or Released?

            @@ -325,7 +326,7 @@ Mappings registered to the ActionListener are digital either-or }
            - +

            Table of Triggers

            @@ -361,14 +362,14 @@ 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.

            - +

            Exercises

              @@ -396,7 +397,7 @@ inputManager.addMapping("Pause", new KeyTrigger(usersPauseKey

            - +

            Conclusion

            @@ -418,5 +419,5 @@ Now you can already write a little interactive game! But wouldn't it be coo
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_main_event_loop.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_main_event_loop.html index 348012f9f..782b4d97e 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_main_event_loop.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_main_event_loop.html @@ -21,12 +21,12 @@ Now that you know how to load assets, such as 3D models, you want to implement s import com.jme3.app.SimpleApplication; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; -import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.shape.Box;   -/** Sample 4 - how to trigger repeating actions from the main update loop. - * In this example, we make the player character rotate. */ +/** Sample 4 - how to trigger repeating actions from the main event loop. + * In this example, you use the loop to make the player character + * rotate continuously. */ public class HelloLoop extends SimpleApplication {   public static void main(String[] args){ @@ -38,8 +38,8 @@ public class HelloLoop extends SimpleApplication {   @Override public void simpleInitApp() { -  - Box b = new Box(Vector3f.ZERO, 1, 1, 1); + /** this blue box is our player character */ + Box b = new Box(1, 1, 1); player = new Geometry("blue cube", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); @@ -48,20 +48,21 @@ public class HelloLoop extends SimpleApplication { rootNode.attachChild(player); }   - /* This is the update loop */ + /* Use the main event loop to trigger repeating actions. */ @Override public void simpleUpdate(float tpf) { - // make the player rotate + // make the player rotate: player.rotate(0, 2*tpf, 0); } }

            Build and run the file: You see a constantly rotating cube. +

            - +

            Understanding the Code

            @@ -83,7 +84,7 @@ Now have a closer look at the simpleUpdate() method ??? this is the
            - +

            Using the Update Loop

            @@ -108,38 +109,39 @@ A rotating object is just a simple example. In the update loop, you typically ha
            - +

            Init - Update - Render

            -Note the contrast: +Note the the three phases of every game:

              -
            • The simpleInitApp() method is executed only once, right at the beginning;
              +
            • Init: The simpleInitApp() method is executed only once, right at the beginning;
            • -
            • The simpleUpdate() method runs repeatedly, during the game.
              +
            • Update: The simpleUpdate() method runs repeatedly, during the game.
            • -
            • After every update, the jMonkeyEngine automatically redraws (renders) the screen for you!
              +
            • Render: After every update, the jMonkeyEngine automatically redraws (renders) the screen for you.

            -Since rendering is automatic, initialization and updating are the two most important concepts in a SimpleApplication for you right now. These methods are where you load and create game data (once), and (repeatedly) change their properties to update the game state: +Since rendering is automatic, initialization and updating are the two most important concepts in a SimpleApplication-based game for you:

              -
            • simpleInitApp() is the application's "first breath".
              +
            • The simpleInitApp() method is the application's "first breath".
              +Here you load and create game data (once).
            • -
            • simpleUpdate() is the application's heartbeat.
              -The update time unit is called ticks.
              +
            • The simpleUpdate() method is the application's "heartbeat" (the time unit is called ticks).
              +Here you change their properties to update the game state (repeatedly).

            -

            Everything in a game happens either during initialization or during the update loop. This means that these two methods grow very long over time. There are two strategies how experienced developers spread out their init and update code over several Java classes: +

            Everything in a game happens either during initialization, or during the update loop. This means that these two methods grow very long over time. Follwo these two strategies to spread out init and update code over several modular Java classes:

            • Move code blocks from the simpleInitApp() method to AppStates.
              @@ -155,7 +157,7 @@ Keep this in mind for later when your application grows.

            - +

            Exercises

            @@ -189,7 +191,7 @@ Look back at the Hell

            - +

            Conclusion

            @@ -221,5 +223,5 @@ See also:
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_material.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_material.html index 127db9b2c..628a9fb06 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_material.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_material.html @@ -14,13 +14,13 @@ The term Material includes everything that influences what the surface of a 3D m

            +

            To use the example assets in a new jMonkeyEngine SDK project, right-click your project, select "Properties", go to "Libraries", press "Add Library" and add the "jme3-test-data" library.

            -

            - +

            Sample Code

            package jme3test.helloworld;
            @@ -31,18 +31,17 @@ import com.jme3.material.Material;
             import com.jme3.material.RenderState.BlendMode;
             import com.jme3.math.ColorRGBA;
             import com.jme3.math.Vector3f;
            +import com.jme3.renderer.queue.RenderQueue.Bucket;
             import com.jme3.scene.Geometry;
             import com.jme3.scene.shape.Box;
             import com.jme3.scene.shape.Sphere;
             import com.jme3.texture.Texture;
             import com.jme3.util.TangentBinormalGenerator;
            -import com.jme3.renderer.queue.RenderQueue.Bucket;
              
             /** Sample 6 - how to give an object's surface a material and texture.
            - * How to make objects transparent, or let colors "leak" through partially
            - * transparent textures. How to make bumpy and shiny surfaces.  */
            - 
            + * How to make objects transparent. How to make bumpy and shiny surfaces.  */
             public class HelloMaterial extends SimpleApplication {
            + 
               public static void main(String[] args) {
                 HelloMaterial app = new HelloMaterial();
                 app.start();
            @@ -50,58 +49,57 @@ public class HelloMaterial extends SimpleApplication {
              
               @Override
               public void simpleInitApp() {
            + 
                 /** A simple textured cube -- in good MIP map quality. */
            -    Box boxshape1 = new Box(new Vector3f(-3f,1.1f,0f), 1f,1f,1f);
            -    Geometry cube = new Geometry("My Textured Box", boxshape1);
            -    Material mat_stl = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            -    Texture tex_ml = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
            -    mat_stl.setTexture("ColorMap", tex_ml);
            -    cube.setMaterial(mat_stl);
            -    rootNode.attachChild(cube);
            +    Box cube1Mesh = new Box( 1f,1f,1f);
            +    Geometry cube1Geo = new Geometry("My Textured Box", cube1Mesh);
            +    cube1Geo.setLocalTranslation(new Vector3f(-3f,1.1f,0f));
            +    Material cube1Mat = new Material(assetManager, 
            +        "Common/MatDefs/Misc/Unshaded.j3md");
            +    Texture cube1Tex = assetManager.loadTexture(
            +        "Interface/Logo/Monkey.jpg");
            +    cube1Mat.setTexture("ColorMap", cube1Tex);
            +    cube1Geo.setMaterial(cube1Mat);
            +    rootNode.attachChild(cube1Geo);
              
                 /** A translucent/transparent texture, similar to a window frame. */
            -    Box boxshape3 = new Box(new Vector3f(0f,0f,0f), 1f,1f,0.01f);
            -    Geometry window_frame = new Geometry("window frame", boxshape3);
            -    Material mat_tt = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            -    mat_tt.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
            -    mat_tt.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
            -    window_frame.setMaterial(mat_tt);
            - 
            -    /** Objects with transparency need to be in the render bucket for transparent objects: */
            -    window_frame.setQueueBucket(Bucket.Transparent);
            -    rootNode.attachChild(window_frame);
            - 
            -    /** A cube with base color "leaking" through a partially transparent texture */
            -    Box boxshape4 = new Box(new Vector3f(3f,-1f,0f), 1f,1f,1f);
            -    Geometry cube_leak = new Geometry("Leak-through color cube", boxshape4);
            -    Material mat_tl = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            -    mat_tl.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
            -    mat_tl.setColor("Color", new ColorRGBA(1f,0f,1f, 1f)); // purple
            -    cube_leak.setMaterial(mat_tl);
            -    rootNode.attachChild(cube_leak);
            +    Box cube2Mesh = new Box( 1f,1f,0.01f);
            +    Geometry cube2Geo = new Geometry("window frame", cube2Mesh);
            +    Material cube2Mat = new Material(assetManager, 
            +        "Common/MatDefs/Misc/Unshaded.j3md");
            +    cube2Mat.setTexture("ColorMap", 
            +        assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
            +    cube2Mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
            +    cube2Geo.setQueueBucket(Bucket.Transparent);
            +    cube2Geo.setMaterial(cube2Mat);
            +    rootNode.attachChild(cube2Geo);
              
            -    /** A bumpy rock with a shiny light effect */
            -    Sphere rock = new Sphere(32,32, 2f);
            -    Geometry shiny_rock = new Geometry("Shiny rock", rock);
            -    rock.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
            -    TangentBinormalGenerator.generate(rock);           // for lighting effect
            -    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.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
            -    rootNode.attachChild(shiny_rock);
            +    /** A bumpy rock with a shiny light effect.*/
            +    Sphere sphereMesh = new Sphere(32,32, 2f);
            +    Geometry sphereGeo = new Geometry("Shiny rock", sphereMesh);
            +    sphereMesh.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
            +    TangentBinormalGenerator.generate(sphereMesh);           // for lighting effect
            +    Material sphereMat = new Material(assetManager, 
            +        "Common/MatDefs/Light/Lighting.j3md");
            +    sphereMat.setTexture("DiffuseMap", 
            +        assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg"));
            +    sphereMat.setTexture("NormalMap", 
            +        assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png"));
            +    sphereMat.setBoolean("UseMaterialColors",true);    
            +    sphereMat.setColor("Diffuse",ColorRGBA.White);
            +    sphereMat.setColor("Specular",ColorRGBA.White);
            +    sphereMat.setFloat("Shininess", 64f);  // [0,128]
            +    sphereGeo.setMaterial(sphereMat);
            +    sphereGeo.setLocalTranslation(0,2,-2); // Move it a bit
            +    sphereGeo.rotate(1.6f, 0, 0);          // Rotate it a bit
            +    rootNode.attachChild(sphereGeo);
              
                 /** Must add a light to make the lit object visible! */
                 DirectionalLight sun = new DirectionalLight();
                 sun.setDirection(new Vector3f(1,0,-2).normalizeLocal());
                 sun.setColor(ColorRGBA.White);
                 rootNode.addLight(sun);
            + 
               }
             }
            @@ -111,9 +109,7 @@ You should see
            • Left ??? A cube with a brown monkey texture.
            • -
            • Middle ??? A translucent monkey picture in front of a shiny rock.
              -
            • -
            • Right ??? A cube with a purple monkey texture.
              +
            • Right ??? A translucent monkey picture in front of a shiny bumpy rock.
            @@ -122,7 +118,7 @@ Move around with the WASD keys to have a closer look at the translucency, and th

            - +

            Simple Unshaded Texture

            @@ -130,80 +126,89 @@ Move around with the WASD keys to have a closer look at the translucency, and th Typically you want to give objects in your scene textures: It can be rock, grass, brick, wood, water, metal, paper??? A texture is a normal image file in JPG or PNG format. In this example, you create a box with a simple unshaded Monkey texture as material.

            -
                /** A simple textured cube. */
            -    Box boxshape1 = new Box(new Vector3f(-3f,1.1f,0f), 1f,1f,1f);
            -    Geometry cube = new Geometry("My Textured Box", boxshape1);
            -    Material mat_stl = new Material(assetManager, 
            +
                /** A simple textured cube -- in good MIP map quality. */
            +    Box cube1Mesh = new Box( 1f,1f,1f);
            +    Geometry cube1Geo = new Geometry("My Textured Box", cube1Mesh);
            +    cube1Geo.setLocalTranslation(new Vector3f(-3f,1.1f,0f));
            +    Material cube1Mat = new Material(assetManager, 
                     "Common/MatDefs/Misc/Unshaded.j3md");
            -    Texture tex_ml = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
            -    mat_stl.setTexture("ColorMap", tex_ml);
            -    cube.setMaterial(mat_stl);
            -    rootNode.attachChild(cube);
            + Texture cube1Tex = assetManager.loadTexture( + "Interface/Logo/Monkey.jpg"); + cube1Mat.setTexture("ColorMap", cube1Tex); + cube1Geo.setMaterial(cube1Mat); + rootNode.attachChild(cube1Geo);

            -Here is what we did: +Here is what we did: to create a textured box:

              -
            1. Create a Geometry from a Box mesh. Let's call it cube.
              +
            2. Create a Geometry cube1Geo from a Box mesh cube1Mesh.
              +
            3. +
            4. Create a Material cube1Mat based on jME3's default Unshaded.j3md material definition.
            5. -
            6. Create a Material based on jME3's default Unshaded.j3md material definition.
              +
            7. Create a texture cube1Tex from the Monkey.jpg file in the assets/Interface/Logo/ directory of the project.
            8. -
            9. Create a texture from the Monkey.jpg file and load it into the material.
              -The ColorMap is the typical material layer where textures go.
              +
            10. Load the texture cube1Tex into the ColorMap layer of the material cube1Mat.
            11. Apply the material to the cube, and attach the cube to the rootnode.
            - +

            Transparent Unshaded Texture

            -Monkey.png is the same texture as Monkey.jpg, but with an added alpha channel. The alpha channel allows you to specify which areas of the texture you want to be opaque or transparent: Black areas remain opaque, gray areas become translucent, and white areas become transparent. +Monkey.png is the same texture as Monkey.jpg, but with an added alpha channel. The alpha channel allows you to specify which areas of the texture you want to be opaque or transparent: Black areas of the alpha channel remain opaque, gray areas become translucent, and white areas become transparent.

            For a partially translucent/transparent texture, you need:

              -
            • A texture with alpha channel
              +
            • A Texture with alpha channel
            • -
            • A Texture blend mode of BlendMode.Alpha
              +
            • A Texture with blend mode of BlendMode.Alpha
            • -
            • A geometry in the Bucket.Transparent render bucket. This bucket ensures that the translucent object is drawn on top of objects behind it, and they show up correctly under the translucent parts. (For non-translucent objects the drawing order is not so important, because the z-buffer keeps track of whether a pixel is behind something else or not, and the color of a pixel doesn't depend on the pixels under it, this is why opaque Geometries can be drawn in any order.)
              +
            • A Geometry in the Bucket.Transparent render bucket.
              +This bucket ensures that the transparent object is drawn on top of objects behind it, and they show up correctly under the transparent parts.
            -
                /** A translucent/transparent texture. */
            -    Box boxshape3 = new Box(new Vector3f(0f,0f,0f), 1f,1f,0.01f);
            -    Geometry seethrough = new Geometry("see-through box", boxshape3);
            -    Material mat_tt = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            -    mat_tt.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
            -    mat_tt.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); // activate transparency
            -    seethrough.setMaterial(mat_tt);
            -    seethrough.setQueueBucket(Bucket.Transparent);
            -    rootNode.attachChild(seethrough);
            +
                /** A translucent/transparent texture, similar to a window frame. */
            +    Box cube2Mesh = new Box( 1f,1f,0.01f);
            +    Geometry cube2Geo = new Geometry("window frame", cube2Mesh);
            +    Material cube2Mat = new Material(assetManager, 
            +    "Common/MatDefs/Misc/Unshaded.j3md");
            +    cube2Mat.setTexture("ColorMap", 
            +        assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
            +    cube2Mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);  // !
            +    cube2Geo.setQueueBucket(Bucket.Transparent);                        // !
            +    cube2Geo.setMaterial(cube2Mat);
            +    rootNode.attachChild(cube2Geo);
            + +

            +For non-transparent objects, the drawing order is not so important, because the z-buffer already keeps track of whether a pixel is behind something else or not, and the color of an opaque pixel doesn't depend on the pixels under it, this is why opaque Geometries can be drawn in any order. +

            -What you did is the same as before, with only one added step for the transparency. +What you did for the transparent texture is the same as before, with only one added step for the transparency.

              -
            1. Create a Geometry from a mesh. This Geometry is flat upright box.
              +
            2. Create a Geometry cube2Geo from a Box mesh cube2Mesh. This Box Geometry is flat upright box (because z=0.01f).
            3. -
            4. Create a Material based on jME3's default Unshaded.j3md material definition.
              +
            5. Create a Material cube2Mat based on jME3's default Unshaded.j3md material definition.
            6. -
            7. Create a texture from the Monkey.png file and load it into the material.
              -The ColorMap is the material layer where textures go. This PNG file must have an alpha layer.
              +
            8. Create a texture cube2Tex from the Monkey.png file in the assets/Textures/ColoredTex/ directory of the project. This PNG file must have an alpha layer.
            9. -
            10. Activate transparency in the material by setting the blend mode to Alpha!
              +
            11. Activate transparency in the material by setting the blend mode to Alpha.
            12. -
            13. Apply the material to the Geometry.
              +
            14. Set the QueueBucket of the Geometry to Bucket.Transparent.
            15. -
            16. Set the QueueBucket of the Geometry to Bucket.Transparent.
              +
            17. Load the texture cube2Tex into the ColorMap layer of the material cube2Mat.
            18. -
            19. Attach the cube to the rootnode.
              +
            20. Apply the material to the cube, and attach the cube to the rootnode.
            @@ -213,59 +218,62 @@ The ColorMap is the material layer where textures go. This +

            Shininess and Bumpiness

            -But textures are not all. Have a close look at the shiny sphere ??? you cannot get such a nice bumpy material with just a texture. JME3 also supports so-called Phong-illuminated materials: +But textures are not all. Have a close look at the shiny sphere ??? you cannot get such a nice bumpy material with just a plain texture. You see that JME3 also supports so-called Phong-illuminated materials:

            -In a lit material, the standard texture layer is refered to as Diffuse Map, any material can use this layer. A lit material can additionally have lighting effects such as Shininess used together with the Specular Map layer, and even a realistically bumpy or cracked surface with help of the Normal Map layer. +In a lit material, the standard texture layer is refered to as DiffuseMap, any material can use this layer. A lit material can additionally have lighting effects such as Shininess used together with the SpecularMap layer and Specular color. And you can even get a realistically bumpy or cracked surface with help of the NormalMap layer.

            Let's have a look at the part of the code example where you create the shiny bumpy rock.

              -
            1. Create a Geometry from a Sphere shape. Note that this shape is a normal smooth sphere mesh.
                  Sphere rock = new Sphere(32,32, 2f);
              -    Geometry shiny_rock = new Geometry("Shiny rock", rock);
              +
            2. Create a Geometry from a Sphere shape. Note that this shape is a normal smooth sphere mesh.
                  Sphere sphereMesh = new Sphere(32,32, 2f);
              +    Geometry sphereGeo = new Geometry("Shiny rock", sphereMesh);
                -
              1. (Only for Spheres) Change the sphere's TextureMode to make the square texture project better onto the sphere.
                    rock.setTextureMode(Sphere.TextureMode.Projected); 
                +
              2. (Only for Spheres) Change the sphere's TextureMode to make the square texture project better onto the sphere.
                    sphereMesh.setTextureMode(Sphere.TextureMode.Projected);
              3. -
              4. You generate TangentBinormals for the sphere mesh so you can use the NormalMap layer of the texture.
                    TangentBinormalGenerator.generate(rock);
                +
              5. You must generate TangentBinormals for the mesh so you can use the NormalMap layer of the texture.
                    TangentBinormalGenerator.generate(sphereMesh);
            3. -
            4. Create a material based on the Lighting.j3md default material.
                  Material mat_lit = new Material(assetManager, 
              -    "Common/MatDefs/Light/Lighting.j3md");
              +
            5. Create a material based on the Lighting.j3md default material.
                  Material sphereMat = new Material(assetManager, 
              +        "Common/MatDefs/Light/Lighting.j3md");
              1. Set a standard rocky texture in the DiffuseMap layer.
                -
                    mat_lit.setTexture("DiffuseMap", assetManager.loadTexture(
                -    "Textures/Terrain/Pond/Pond.jpg"));
                +
                    sphereMat.setTexture("DiffuseMap", 
                +        assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg"));
              2. -
              3. Set the NormalMap layer that contains the bumpiness. The NormalMap was generated for this particular DiffuseMap with a special tool (e.g. Blender).
                    mat_lit.setTexture("NormalMap", assetManager.loadTexture(
                -    "Textures/Terrain/Pond/Pond_normal.png"));
                +
              4. Set the NormalMap layer that contains the bumpiness. The NormalMap was generated for this particular DiffuseMap with a special tool (e.g. Blender).
                    sphereMat.setTexture("NormalMap", 
                +        assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png"));
              5. -
              6. Set the Material's Shininess to a value between 1 and 128. For a rock, a low fuzzy shininess is appropriate.
                    mat_lit.setFloat("Shininess", 5f); // [1,128]
                +
              7. Set the Material's Shininess to a value between 1 and 128. For a rock, a low fuzzy shininess is appropriate. Use material colors to define the shiny Specular color.
                    sphereMat.setBoolean("UseMaterialColors",true);    
                +    sphereMat.setColor("Diffuse",ColorRGBA.White);  // minimum material color
                +    sphereMat.setColor("Specular",ColorRGBA.White); // for shininess
                +    sphereMat.setFloat("Shininess", 64f); // [1,128] for shininess
            6. -
            7. Assign your newly created material to the Geometry.
                  shiny_rock.setMaterial(mat_lit);
              +
            8. Assign your newly created material to the Geometry.
                  sphereGeo.setMaterial(sphereMat);
            9. -
            10. Let's move and rotate the geometry a bit to position it better.
                  shiny_rock.setLocalTranslation(0,2,-2); // Move it a bit
              -    shiny_rock.rotate(1.6f, 0, 0);          // Rotate it a bit
              -    rootNode.attachChild(shiny_rock);
              +
            11. Let's move and rotate the geometry a bit to position it better.
                  sphereGeo.setLocalTranslation(0,2,-2); // Move it a bit
              +    sphereGeo.rotate(1.6f, 0, 0);          // Rotate it a bit
              +    rootNode.attachChild(sphereGeo);
            @@ -280,7 +288,7 @@ Remember that any Lighting.j3md-based material requires a light source, as shown

            - +

            Default Material Definitions

            @@ -305,59 +313,70 @@ 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.

            - +

            Exercises

            - +

            Exercise 1: Custom .j3m Material

            -Look at the purple leak-through sample above again. It takes four lines to create and set the Material. +Look at the shiny rocky sphere above again. It takes several lines to create and set the Material.

              -
            • Note how it loads the Unshaded.j3md Material definition.
              +
            • Note how it loads the Lighting.j3md Material definition.
            • -
            • Note how it sets the Color parameter to purple (new ColorRGBA(1f,0f,1f,1f)).
              +
            • Note how it sets the DiffuseMap and NormalMap to a texture path.
            • -
            • Note how it sets the ColorMap to a texture path.
              +
            • Note how it activates UseMaterialColors and sets Specular and Diffuse to 4 float values (RGBA color).
              +
            • +
            • Note how it sets Shininess to 64.

            + If you want to use one custom material for several models, you can store it in a .j3m file, and save a few lines of code every time. +

            + +

            You create a j3m file as follows:

              -
            1. Create a file assets/Materials/LeakThrough.j3m in your project directory, with the following content:
              Material Leak Through : Common/MatDefs/Misc/Unshaded.j3md {
              +
            2. Create a plain text file assets/Materials/MyCustomMaterial.j3m in your project directory, with the following content:
              Material My shiny custom material : Common/MatDefs/Light/Lighting.j3md {
                    MaterialParameters {
              -         Color : 1 0 1 1
              -         ColorMap : Flip Textures/ColoredTex/Monkey.png
              +        DiffuseMap : Textures/Terrain/Pond/Pond.jpg
              +        NormalMap : Textures/Terrain/Pond/Pond_normal.png
              +        UseMaterialColors : true
              +        Specular : 1.0 1.0 1.0 1.0
              +        Diffuse : 1.0 1.0 1.0 1.0
              +        Shininess : 64.0
                    }
               }
              • Note that Material is a fixed keyword.
              • -
              • Note that Leak Through is a String that you can choose to name the material.
                +
              • Note that My shiny custom material is a String that you can choose to describe the material.
              • -
              • Note how the code sets the same three properties, Color, ColorMap, and Unshaded.j3md.
                +
              • Note how the code sets all the same properties as before!
            3. -
            4. In the code sample, comment out the three lines with mat_tl in them.
              +
            5. In the code sample, comment out the eight lines that have sphereMat in them.
            6. -
            7. Below them, add the following line:
              cube_leak.setMaterial((Material) assetManager.loadMaterial( "Materials/LeakThrough.j3m"));
              +
            8. Below this line, add the following line:
              sphereGeo.setMaterial((Material) assetManager.loadMaterial( 
              +    "Materials/MyCustomMaterial.j3m"));
            9. Run the app. The result is the same.
              @@ -366,11 +385,11 @@ You create a j3m file as follows:

              -Using this new custom material LeakThrough.j3m only takes one line. You have replaced the three lines of an on-the-fly material definition with one line that loads a custom material from a file. This method is very handy if you use the same material often. +Using this new custom material MyCustomMaterial.j3m only takes one line. You have replaced the eight lines of an on-the-fly material definition with one line that loads a custom material from a file. Using .j3m files is very handy if you use the same material often.

            10. - +

              Exercise 2: Bumpiness and Shininess

              @@ -400,7 +419,7 @@ Go back to the bumpy rock sample above:
            - +

            Conclusion

            @@ -450,5 +469,5 @@ See also
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_node.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_node.html index 275a16653..1f8dd4dc3 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_node.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_node.html @@ -44,16 +44,15 @@ You will learn that the scene graph represents the 3D world, and why the rootNod   import com.jme3.app.SimpleApplication; import com.jme3.material.Material; +import com.jme3.math.ColorRGBA; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; -import com.jme3.scene.shape.Box; -import com.jme3.math.ColorRGBA; import com.jme3.scene.Node; +import com.jme3.scene.shape.Box;   /** Sample 2 - How to use nodes as handles to manipulate objects in the scene. * You can rotate, translate, and scale objects by manipulating their parent nodes. * The Root Node is special: Only what is attached to the Root Node appears in the scene. */ -  public class HelloNode extends SimpleApplication {   public static void main(String[] args){ @@ -65,28 +64,28 @@ public class HelloNode extends SimpleApplication { public void simpleInitApp() {   /** create a blue box at coordinates (1,-1,1) */ - Box box1 = new Box( Vector3f.ZERO, 1,1,1); + Box box1 = new Box(1,1,1); Geometry blue = new Geometry("Box", box1); + blue.setLocalTranslation(new Vector3f(1,-1,1)); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat1.setColor("Color", ColorRGBA.Blue); blue.setMaterial(mat1); - blue.move(1,-1,1);   /** create a red box straight above the blue one at (1,3,1) */ - Box box2 = new Box( Vector3f.ZERO, 1,1,1); + Box box2 = new Box(1,1,1); Geometry red = new Geometry("Box", box2); + red.setLocalTranslation(new Vector3f(1,3,1)); Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat2.setColor("Color", ColorRGBA.Red); red.setMaterial(mat2); - red.move(1,3,1);   /** Create a pivot node at (0,0,0) and attach it to the root node */ Node pivot = new Node("pivot"); rootNode.attachChild(pivot); // put this node in the scene   - /** Attach the two boxes to the *pivot* node. */ + /** Attach the two boxes to the *pivot* node. (And transitively to the root node.) */ pivot.attachChild(blue); pivot.attachChild(red); /** Rotate the pivot node: Note that both boxes have rotated! */ @@ -99,7 +98,7 @@ Build and run the code sample. You should see two colored boxes tilted at the sa

            - +

            Understanding the Terminology

            @@ -128,7 +127,7 @@ In this tutorial, you learn some new terms: Position/move, turn, or resize an objectTranslate, or rotate, or 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. @@ -155,9 +154,9 @@ 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??? - + - +

            Understanding the Code

            @@ -171,19 +170,18 @@ What happens in the code snippet? You use the simpleInitApp() metho
            • Create a Box shape with extents of (1,1,1), that makes the box 2x2x2 world units big.
            • -
            • Position the box at (1,-1,1) using the move() method. (Don't change the Vector3f.ZERO unless you want to change the center of rotation)
              +
            • Position the box at (1,-1,1) using the setLocalTranslation() method.
            • Wrap the Box shape into a Geometry.
            • Create a blue material.
            • -
            • Apply the blue material to the Box Geometry.
                  Box box1 = new Box( Vector3f.ZERO, 1,1,1);
              +
            • Apply the blue material to the Box Geometry.
                  Box box1 = new Box(1,1,1);
                   Geometry blue = new Geometry("Box", box1);
              -    Material mat1 = new Material(assetManager,
              -      "Common/MatDefs/Misc/Unshaded.j3md");
              +    blue.setLocalTranslation(new Vector3f(1,-1,1));
              +    Material mat1 = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md");
                   mat1.setColor("Color", ColorRGBA.Blue);
              -    blue.setMaterial(mat1);
              -    blue.move(1,-1,1);
              + blue.setMaterial(mat1);
            @@ -198,13 +196,13 @@ What happens in the code snippet? You use the simpleInitApp() metho
          19. Create a red material.
          20. -
          21. Apply the red material to the Box Geometry.
                Box box2 = new Box( Vector3f.ZERO, 1,1,1);
            +
          22. Apply the red material to the Box Geometry.
                Box box2 = new Box(1,1,1);
                 Geometry red = new Geometry("Box", box2);
            +    red.setLocalTranslation(new Vector3f(1,3,1));
                 Material mat2 = new Material(assetManager,
                   "Common/MatDefs/Misc/Unshaded.j3md");
                 mat2.setColor("Color", ColorRGBA.Red);
            -    red.setMaterial(mat2);
            -    red.move(1,3,1);
            + red.setMaterial(mat2);
          23. @@ -245,7 +243,7 @@ If you run the app with only the code up to here, you see two cubes: A red cube
            - +

            What is a Pivot Node?

            @@ -264,7 +262,7 @@ You can transform (e.g. rotate) Geometries around their own center, or around a
            - +

            How do I Populate the Scenegraph?

            @@ -298,9 +296,9 @@ 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.
            - +
            - +

            How do I Transform Spatials?

            @@ -324,7 +322,7 @@ To move a Spatial to specific coordinates, such as (0,40.2f,-2), use: < +right -left+up -down+forward -backward
            -
            +
            @@ -336,7 +334,7 @@ To scale a Spatial 10 times longer, one tenth the height, and keep the same widt
            Scaling resizes Spatials X-axis Y-axis Z-axis
            lengthheightwidth
            -
            +
            @@ -352,9 +350,9 @@ To roll an object 180?? around the z axis:
            thing.rotate( 0f , 0f , 180*
             
            Rotation turns Spatials X-axis Y-axis Z-axis
            pitch = nodding your headyaw = shaking your headroll = cocking your head
            - + - +

            How do I Troubleshoot Spatials?

            @@ -371,7 +369,7 @@ If you get unexpected results, check whether you made the following common mista A created Geometry does not appear in the scene. Have you attached it to (a node that is attached to) the rootNode?
            Does it have a Material?
            What is its translation (position)? Is it behind the camera or covered up by another Geometry?
            -Is it to tiny or too gigantic to see?
            +Is it too tiny or too gigantic to see?
            Is it too far from the camera? (Try (111111f); to see further) @@ -384,9 +382,9 @@ 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(); )
            - + - +

            How do I Add Custom Data to Spatials?

            @@ -419,7 +417,7 @@ By using different Strings keys (here the key is pivot id), you can

            - +

            Conclusion

            @@ -445,5 +443,5 @@ Since standard shapes like spheres and boxes get old fast, continue with the nex
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_physics.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_physics.html index 5c9efd988..d52e8af40 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_physics.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_physics.html @@ -109,10 +109,10 @@ public class HelloPhysics extends SimpleApplication { sphere = new Sphere(32, 32, 0.4f, true, false); sphere.setTextureMode(TextureMode.Projected); /** Initialize the brick geometry */ - box = new Box(Vector3f.ZERO, brickLength, brickHeight, brickWidth); + box = new Box(brickLength, brickHeight, brickWidth); box.scaleTextureCoordinates(new Vector2f(1f, .5f)); /** Initialize the floor geometry */ - floor = new Box(Vector3f.ZERO, 10f, 0.1f, 5f); + floor = new Box(10f, 0.1f, 5f); floor.scaleTextureCoordinates(new Vector2f(3, 6)); }   @@ -251,7 +251,7 @@ You should see a brick wall. Click to shoot cannon balls. Watch the bricks fall

            - +

            A Basic Physics Application

            @@ -279,12 +279,12 @@ The BulletAppState gives the game access to a PhysicsSpace. The PhysicsSpace let

            - +

            Creating Bricks and Cannon Balls

            - +

            Geometries

            @@ -305,15 +305,15 @@ In this "shoot at the wall" example, you use Geometries such as cannon sphere = new Sphere(32, 32, 0.4f, true, false); sphere.setTextureMode(TextureMode.Projected); /** Initialize the brick geometry */ - box = new Box(Vector3f.ZERO, brickLength, brickHeight, brickWidth); + box = new Box(brickLength, brickHeight, brickWidth); box.scaleTextureCoordinates(new Vector2f(1f, .5f)); /** Initialize the floor geometry */ - floor = new Box(Vector3f.ZERO, 10f, 0.1f, 5f); + floor = new Box(10f, 0.1f, 5f); floor.scaleTextureCoordinates(new Vector2f(3, 6)); }
            - +

            RigidBodyControl: Brick

            @@ -375,7 +375,7 @@ This code sample does the following:
            - +

            RigidBodyControl: Cannonball

            @@ -438,7 +438,7 @@ Since you are shooting cannon balls, the last line accelerates the ball in the d

            - +

            RigidBodyControl: Floor

            @@ -493,7 +493,7 @@ This code sample does the following:
            - +

            Creating the Scene

            @@ -518,7 +518,7 @@ These methods are each called once from the simpleInitApp() method

            - +

            The Cannon Ball Shooting Action

            @@ -548,7 +548,7 @@ In the moment the cannonball appears in the scene, it flies off with the velocit

            - +

            Moving a Physical Spatial

            @@ -575,12 +575,12 @@ Learn more about static versus kinematic versus dynamic in the +

            Excercises

            - +

            Exercise 1: Debug Shapes

            @@ -597,7 +597,7 @@ Now you see the collisionShapes of the bricks and spheres, and the floor highlig

            - +

            Exercise 2: No Mo' Static

            @@ -607,7 +607,7 @@ What happens if you give a static node, such as the floor, a mass of more than 0

            - +

            Exercise 3: Behind the Curtain

            @@ -625,7 +625,7 @@ Using physics everywhere in a game sounds like a cool idea, but it is easily ove

            - +

            Conclusion

            @@ -649,5 +649,5 @@ You have learned how to activate the jBullet PhysicsSpace in an application by a
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_picking.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_picking.html index b0090df45..b678e91c6 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_picking.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_picking.html @@ -39,12 +39,14 @@ import com.jme3.input.MouseInput; import com.jme3.input.controls.ActionListener; import com.jme3.input.controls.KeyTrigger; import com.jme3.input.controls.MouseButtonTrigger; +import com.jme3.light.DirectionalLight; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; import com.jme3.math.Ray; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.Node; +import com.jme3.scene.Spatial; import com.jme3.scene.shape.Box; import com.jme3.scene.shape.Sphere;   @@ -56,8 +58,8 @@ public class HelloPicking extends SimpleApplication { HelloPicking app = new HelloPicking(); app.start(); } - Node shootables; - Geometry mark; + private Node shootables; + private Geometry mark;   @Override public void simpleInitApp() { @@ -73,6 +75,7 @@ public class HelloPicking extends SimpleApplication { shootables.attachChild(makeCube("the Sheriff", 0f, 1f, -2f)); shootables.attachChild(makeCube("the Deputy", 1f, 0f, -4f)); shootables.attachChild(makeFloor()); + shootables.attachChild(makeCharacter()); }   /** Declaring the "Shoot" action and mapping to its triggers. */ @@ -120,8 +123,9 @@ public class HelloPicking extends SimpleApplication {   /** A cube object for target practice */ protected Geometry makeCube(String name, float x, float y, float z) { - Box box = new Box(new Vector3f(x, y, z), 1, 1, 1); + Box box = new Box(1, 1, 1); Geometry cube = new Geometry(name, box); + cube.setLocalTranslation(x, y, z); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat1.setColor("Color", ColorRGBA.randomColor()); cube.setMaterial(mat1); @@ -130,8 +134,9 @@ public class HelloPicking extends SimpleApplication {   /** A floor to show that the "shot" can go through several objects. */ protected Geometry makeFloor() { - Box box = new Box(new Vector3f(0, -4, -5), 15, .2f, 15); + Box box = new Box(15, .2f, 15); Geometry floor = new Geometry("the Floor", box); + floor.setLocalTranslation(0, -4, -5); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat1.setColor("Color", ColorRGBA.Gray); floor.setMaterial(mat1); @@ -149,16 +154,28 @@ public class HelloPicking extends SimpleApplication {   /** A centred plus sign to help the player aim. */ protected void initCrossHairs() { - guiNode.detachAllChildren(); + setDisplayStatView(false); guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt"); BitmapText ch = new BitmapText(guiFont, false); ch.setSize(guiFont.getCharSet().getRenderedSize() * 2); ch.setText("+"); // crosshairs ch.setLocalTranslation( // center - settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2, - settings.getHeight() / 2 + ch.getLineHeight() / 2, 0); + settings.getWidth() / 2 - ch.getLineWidth()/2, settings.getHeight() / 2 + ch.getLineHeight()/2, 0); guiNode.attachChild(ch); } +  + protected Spatial makeCharacter() { + // load a character from jme3test-test-data + Spatial golem = assetManager.loadModel("Models/Oto/Oto.mesh.xml"); + golem.scale(0.5f); + golem.setLocalTranslation(-1.0f, -1.5f, -0.6f); +  + // We must add a light to make the model visible + DirectionalLight sun = new DirectionalLight(); + sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f)); + golem.addLight(sun); + return golem; + } }

            @@ -167,10 +184,11 @@ You should see four colored cubes floating over a gray floor, and cross-hairs. A

            Keep an eye on the application's output stream, it will give you more details: The name of the mesh that was hit, the coordinates of the hit, and the distance. +

            - +

            Understanding the Helper Methods

            @@ -204,7 +222,7 @@ In this example, we attached all "shootable" objects to one custom nod

            - +

            Understanding Ray Casting for Hit Testing

            @@ -236,12 +254,12 @@ Here is our simple ray casting algorithm for picking objects:
            - +

            Implementing Hit Testing

            - +

            Loading the scene

            @@ -269,7 +287,7 @@ First initialize some shootable nodes and attach them to the scene. You will use }
            - +

            Setting Up the Input Listener

            @@ -282,12 +300,12 @@ Next you declare the shooting action. It can be triggered either by clicking, or private void initKeys() { inputManager.addMapping("Shoot", // Declare... new KeyTrigger(KeyInput.KEY_SPACE), // trigger 1: spacebar, or - new MouseButtonTrigger(0)); // trigger 2: left-button click + new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); // trigger 2: left-button click inputManager.addListener(actionListener, "Shoot"); // ... and add. }
            - +

            Picking Action Using Crosshairs

            @@ -353,7 +371,7 @@ Note how it prints a lot of output to show you which hits were registered.

            - +

            Picking Action Using Mouse Pointer

            @@ -394,7 +412,7 @@ Note that since you now use the mouse for picking, you can no longer use it to r

            - +

            Exercises

            @@ -405,7 +423,7 @@ Modify the code sample to solve these exercises:

            - +

            Exercise 1: Magic Spell

            @@ -432,7 +450,7 @@ Here are some tips:
            - +

            Exercise 2: Shoot a Character

            @@ -448,7 +466,7 @@ Shooting boxes isn't very exciting ??? can you add code that loads and posi
            - +

            Exercise 3: Pick up into Inventory

            @@ -482,7 +500,7 @@ Change the code as follows to simulate the player picking up objects into the in

            - +

            Conclusion

            @@ -533,5 +551,5 @@ See also:
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_simpleapplication.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_simpleapplication.html index 3e18d7e6c..0a0c3589f 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_simpleapplication.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/beginner/hello_simpleapplication.html @@ -56,7 +56,7 @@ If you have questions, read more about -

            Write a SimpleApplication

            +

            Extend SimpleApplication

            @@ -85,7 +85,7 @@ The SDK creates the file Hel

            - +

            Sample Code

            @@ -114,7 +114,7 @@ public class HelloJME3 extends SimpleApplication {   @Override public void simpleInitApp() { - Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin + Box b = new Box(1, 1, 1); // create cube shape Geometry geom = new Geometry("Box", b); // create cube geometry from the shape Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material @@ -143,7 +143,7 @@ Congratulations! Now let's find out how it works!

            - +

            Understanding the Code

            @@ -153,20 +153,20 @@ The code above has initialized the scene, and started the application.

            - +

            Start the SimpleApplication

            -Look at the first line. The HelloJME3.java class extends com.jme3.app.SimpleApplication. +Look at the first line. Your HelloJME3.java class extends com.jme3.app.SimpleApplication.

            public class HelloJME3 extends SimpleApplication {
               // your code...
             }

            -Every JME3 game is an instance of com.jme3.app.SimpleApplication. The SimpleApplication class manages your 3D scene graph and automatically draws it to the screen ??? that is, in short, what a game engine does for you! +Every JME3 game is an instance of the com.jme3.app.SimpleApplication class. The SimpleApplication class is the simplest example of an application: It manages a 3D scene graph, checks for user input, updates the game state, and automatically draws the scene to the screen. These are the core features of a game engine. You extend this simple application and customize it to create your game.

            @@ -184,11 +184,11 @@ You start every JME3 game from the main() method, as every standard Java applica }

            -This code opens your application window. Let's learn how you put something into the window next. +The app.start(); line opens the application window. Let's learn how you put something into this window (the scene) next.

            - +

            Understanding the Terminology

            @@ -211,14 +211,14 @@ 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.

            - +

            Initialize the Scene

            @@ -234,7 +234,7 @@ Look at rest of the code sample. The simpleInitApp() method is auto The initialization code of a blue cube looks as follows:

                public void simpleInitApp() {
            -        Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create a 1x1x1 box shape at the origin
            +        Box b = new Box(1, 1, 1); // create a 1x1x1 box shape
                     Geometry geom = new Geometry("Box", b);  // create a cube geometry from the box shape
                     Material mat = new Material(assetManager,
                       "Common/MatDefs/Misc/Unshaded.j3md");  // create a simple material
            @@ -288,7 +288,7 @@ A typical JME3 game has the following initialization process:
             
             
             
            - +

            Conclusion

            @@ -349,5 +349,5 @@ See also:
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/build_jme3_sources_with_netbeans.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/build_jme3_sources_with_netbeans.html index c5268f50c..37b9f2148 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/build_jme3_sources_with_netbeans.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/build_jme3_sources_with_netbeans.html @@ -4,7 +4,7 @@

            -You are welcome to try out the new jME3, and contribute patches and features! This document shows how to download, set up, build, and run the latest development version from the sources. (As of Spring 2010, we are in alpha.) These instructions work in NetBeans IDE 6 or better. +You are welcome to try out the new jME3, and contribute patches and features! This document shows how to download, set up, build, and run the latest development version from the sources. These instructions work in NetBeans IDE 6 or better.

            @@ -12,7 +12,7 @@ Note: In the following, always replace "~" with the path to your home

            - +

            Downloading the Sources

            @@ -51,59 +51,85 @@ The jme3 project opens in the Project window. It already includes a working ANT

            Look into the Libraries node and confirm that the project depends on the following libraries in the classpath: +

            -
            jME3-natives-joal.jar	lwjgl.jar       gluegen-rt.jar
            -jME3-lwjgl-natives.jar	jinput.jar	swing-layout-1.0.4.jar
            -j-ogg-oggd.jar	        vecmath.jar     stack-alloc.jar
            -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
            +
              +
            • j-ogg-oggd.jar
              +
            • +
            • j-ogg-vorbisd.jar
              +
            • +
            • jbullet.jar
              +
            • +
            • stack-alloc.jar
              +
            • +
            • vecmath.jar
              +
            • +
            • lwjgl.jar
              +
            • +
            • jME3-lwjgl-natives.jar
              +
            • +
            • jinput.jar
              +
            • +
            • eventbus.jar
              +
            • +
            • nifty-default-controls.jar
              +
            • +
            • nifty-examples.jar
              +
            • +
            • nifty-style-black.jar
              +
            • +
            • nifty.jar
              +
            • +
            • jglfont-core.jar
              +
            • +
            • xmlpull-xpp3.jar
              +
            • +
            • android.jar
              +
            • +
            • jME3-bullet-natives.jar
              +
            • +
            • gluegen-rt.jar
              +
            • +
            • joal.jar
              +
            • +
            • jogl-all.jar
              +
            • +
            • jME3-natives-joal.jar
              +
            • +
            • jME3-openal-soft-natives-android.jar
              +
            • +

            + For a detailed description of the separate jar files see this list.

            - -

            Build and Run

            + +

            Build the Project and Run a Sample App

            - -

            - -That's it! -

            1. Right-click the jme3 project node and "Clean and Build" the project.
            2. -
            3. In the Projects window, browse to the src/test/jme3test folder.
              +
            4. In the Projects window, open the Test folder which contains the sample apps.
              +
            5. +
            6. Every file with a Main class (for example jme3test.model/TestHoverTank.java or jme3test.game/CubeField.java) is an app.
            7. -
            8. Right-click e.g. the file src/test/jme3test/model/TestHoverTank.java and choose "Run" to run a sample.
              +
            9. Right-click a sample app and choose "Run File" (Shift-F6).
              +
            10. +
            11. Generally in sample apps:
                -
              1. In the sample application, use the mouse and the AWSD keys to move around the test object.
                +
              2. the mouse and the WASD keys control movement
              3. -
              4. Press escape to quit the sample application.
                +
              5. the Esc key exits the application
            -

            - -Sample code for cool features is in the src/test/jme3test folder. A sample game can be found in src/games/jme3game/cubefield/CubeField.java. -

            - -

            -Tips: -

            -
              -
            • To run runnable classes from the Projects window, right-click and choose Run.
              -
            • -
            • To run any runnable class that is open in the editor, press shift-F6.
              -
            • -
            -
            - +

            Optional: Javadoc Popups and Source Navigation in NetBeans

            @@ -159,5 +185,5 @@ Sources used: +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/external/blender.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/external/blender.html index 7a29a58bf..abb8c1b9d 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/external/blender.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/external/blender.html @@ -282,8 +282,54 @@ Models for live rendering should have a low polygon count. To increase the perce

            +

            +

            Be careful: The steps above lead to terrible normal maps - use this procedure instead: +

            +

            +
              +
            • uncheck "[ ] Bake from Multires"
              +
            • +
            • switch to object mode
              +
            • +
            • make a copy of your mesh (SHIFT+D)
              +
            • +
            • remove the Multires modifier from the copied model
              +
            • +
            • remove any materials from the copied model
              +
            • +
            • remove the armature modifier from the copied model
              +
            • +
            • select the original (highres) model
              +
            • +
            • go into pose mode, clear any pose transformations
              +
            • +
            • the highres and lowres models should be on top of each other now
              +
            • +
            • select the original (highres) model
              +
            • +
            • hold SHIFT and select the copied (lowres) model
              +
            • +
            • in the properties menu go to render
              +
            • +
            • use Bake > Normal
              +
            • +
            • check "[x] Selected to Active"
              +
            • +
            • use a reasonably high value for "Margin" (4+ pixels at least for 1024x1024 maps)
              +
            • +
            • don't forget to safe the normal map image
              +
            • +
            + +

            + +

            Be careful: in the Outliner the camera symbol (Restrict Render) must be on! +

            + +

            + - +

            Fixing the normal colors in Blender

            @@ -328,7 +374,7 @@ To do this, go to the Blender Node Window
            - +

            LightMap baking

            @@ -338,7 +384,7 @@ The goal of this tutorial is to explain briefly how to bake light map in blender

            - +

            Blender modeling + texturing

              @@ -387,7 +433,7 @@ The goal of this tutorial is to explain briefly how to bake light map in blender
            - +

            Importing the model in the SDK and creating the appropriate material

            @@ -424,7 +470,27 @@ The blend file, the ogre xml files and the textures can be found in the download

            - + +

            Modelling racing tracks and cars

            +
            + +

            +Follow the link below to a pdf tutorial by rhymez where I guide you to modelling a car and importing it to the jMonkeyengine correctly and edit it in the vehicle editor.Plus how to model a simple racing track. + +

            + +
            + +

            Optimizing Models for 3D games

            +
            + +

            +Follow the link below to a pdf tutorial by rhymez where I guide you on how you can optimize your models for faster rendering. + +

            + +
            +

            SkyBox baking

            @@ -548,10 +614,12 @@ If you want to do it from code, here is an example:

            - +

            Further reading

            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/faq.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/faq.html index df52ea0e5..f7f7c8768 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/faq.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/faq.html @@ -43,14 +43,14 @@ Yes! Actually, you MUST customize it! For your own games, you always create a cu

            -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. +You should break down 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.

            - +

            How do I pause/unpause a game?

            @@ -62,7 +62,7 @@ You split up your application into several AppStates and implement the setEnable

            - +

            How do I disable logger output to the console?

            @@ -86,19 +86,19 @@ For the release, switch the severity level of the default logger to print only S

            - +

            Why does the executable crash with "Cannot locate resource"?

            -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. +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 to the build directory.
            Learn more: Asset Manager

            - +

            What is java.lang.LinkageError: Version mismatch?

            @@ -110,12 +110,12 @@ To fix this, search for .dll (Windows), .jnilib (Mac), and .so (Linux) files for

            - +

            I want to load my scene

            - +

            How do I make objects appear / disappear in the 3D scene?

            @@ -132,7 +132,7 @@ To make a spatial appear in the scene, you attach it to the rootNode (or to a no

            - +

            Why do I get AssetNotFoundException when loading X ?

            @@ -159,7 +159,7 @@ Note that you should not register every single folder containing a texture as th

            - +

            How do I Create 3-D models, textures, sounds?

            @@ -175,7 +175,7 @@ You create sounds in an audio editor, for example, Audacity, and export them as

            - +

            How do I load a 3-D model into the scene?

            @@ -195,7 +195,7 @@ Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.j3o"

            - +

            How do initialize the scene?

            @@ -206,12 +206,12 @@ Use the simpleInitApp() method in SimpleApplication (or initApp() in Application

            - +

            I want to transform objects in the scene

            - +

            How do I move or turn or resize a spatial?

            @@ -227,7 +227,7 @@ To move or turn or resize a spatial you use transformations. You can concatenate

            - +

            How do I make a spatial move by itself?

            @@ -240,7 +240,7 @@ Change the geometry's translation (position) live in the update loop using

            - +

            How do I access a named sub-mesh in Model?

            Geometry result = spatial.getName().startsWith(name);
            @@ -251,7 +251,7 @@ Change the geometry's translation (position) live in the update loop using

            - +

            How do I make procedural or custom shapes?

            @@ -262,12 +262,12 @@ You can programmatically create com.jme3.scene.Mesh'es.

            - +

            I want to change the surface of objects in the scene

            - +

            Why is my UV wrapping / texture appearance all wrong?

            @@ -285,7 +285,7 @@ You can set the boolean value in the constructor of TextureKey to flipped or not
              material.setTexture("ColorMap", this.assetManager.loadTexture(new TextureKey("myTexture.jpg", false)));
            - +

            How do I scale, mirror, or wrap a texture?

            @@ -303,7 +303,7 @@ You can choose among various com.jme3.texture.Texture.WrapModes for
            material.getTextureParam("DiffuseMap").getTextureValue().setWrap(WrapMode.Repeat);
            - +

            How do I change color or shininess of an material?

            @@ -316,7 +316,7 @@ Use the AssetManager to load Materials, and change material settings.

            - +

            How do I make a surface wood, stone, metal, etc?

            @@ -329,7 +329,7 @@ Create Textures as image files. Use the AssetManager to load a Material and use

            - +

            Why are materials too bright, too dark, or flickering?

            @@ -338,7 +338,7 @@ If you use a lit material (based on Lighting.j3md) then you must attach a light

            - +

            How do I make geometries cast a shadow?

            @@ -351,7 +351,7 @@ Use com.jme3.shadow.BasicShadowRenderer together with com.jme3.light.Directional

            - +

            How do I make materials transparent?

            @@ -367,7 +367,7 @@ Assign a texture with an alpha channel to a Material and set the Material's

            - +

            How do I force or disable culling?

            @@ -391,7 +391,7 @@ You can also deactivate the com.jme3.scene.Spatial.CullHint of a wh

            - +

            Can I draw only an outline of the scene?

            @@ -407,12 +407,12 @@ Add a renders state to the material's and activate Wireframe.

            - +

            I want to control the camera

            - +

            How do I switch between third-person and first-person view ?

            @@ -434,18 +434,18 @@ chaseCam = new ChaseCamera(cam, spatial, inputManager);
            - +

            How do I increase camera speed?

            flyCam.setMoveSpeed(50f);
            - +

            Actions, Interactions, Physics

            - +

            How do I implement game logic / game mechanics?

            @@ -456,7 +456,7 @@ Use Controls to define the behaviour of types of Spatials. Use Application State

            - +

            How do I let players interact via keyboard?

            @@ -467,7 +467,7 @@ Use com.jme3.input.KeyInput and a Input Listener.

            - +

            How do I let players interact by clicking?

            @@ -480,7 +480,7 @@ Players typically click the mouse to pick up objects, to open doors, to shoot a

            - +

            How do I animate characters?

            @@ -493,7 +493,7 @@ Create an animated OgreMesh model with bones in a 3-D mesh editor (e.g. Blender)

            - +

            How do I keep players from falling through walls and floors?

            @@ -504,7 +504,7 @@ Use collision detection. The most common solution is to use jme's physics i

            - +

            How do I make balls/wheels/etc bounce and roll?

            @@ -517,7 +517,7 @@ Add physics controls to Spatials and give them spherical or cylindrical bounding

            - +

            How do I debug weird Physics behaviour?

            @@ -527,12 +527,12 @@ Maybe your collision shapes overlap ??? or they are not where you think they are
            bulletAppState.getPhysicsSpace().enableDebug(assetManager);
            - +

            How do I make a walking character?

            -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). +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 typically wanted to).
            Learn more: CharacterControl
            @@ -540,7 +540,7 @@ Code samples: +

            How do I steer vehicles?

            @@ -553,7 +553,7 @@ Code samples: +

            Can objects swing like a pendulums, chains, ropebridges?

            @@ -565,12 +565,12 @@ Use a PhysicsControl's hinges and joints.

            - +

            Default GUI Display

            - +

            What are these FPS/Objects/Vertices/Triangles statistics?

            @@ -582,7 +582,7 @@ At the bottom left of every default SimpleGame, you see the +

            How do I get rid of the FPS/Objects statistics?

            @@ -601,7 +601,7 @@ setDisplayStatView(false); // to hide the statistics

            - +

            How do I display score, health, mini-maps, status icons?

            @@ -614,7 +614,7 @@ Attach text and pictures to the orthogonal guiNode to create a head

            - +

            How do I display buttons and UI controls?

            @@ -627,7 +627,7 @@ Sample Code: +

            How do i display a loading screen?

            @@ -638,12 +638,12 @@ Instead of having a frozen frame while your games loads, you can have a loading

            - +

            Nifty GUI

            - +

            I get NoSuchElementException when adding controls (buttons etc)!

            @@ -654,7 +654,7 @@ Verify that you include a controls definition file link in your +

            Where can I find example code of Nifty GUI's XML and Java classes?

            @@ -663,7 +663,7 @@ Verify that you include a controls definition file link in your +

            Is there Java Doc for Nifty GUI?

            @@ -672,12 +672,12 @@ Verify that you include a controls definition file link in your +

            I want to create an environment with sounds, effects, and landscapes

            - +

            How do I play sounds and noises?

            @@ -690,7 +690,7 @@ Use AudioRenderer, Listener, and AudioNode from com.jme3.audio.*.

            - +

            How do I make fire, smoke, explosions, swarms, magic spells?

            @@ -703,7 +703,7 @@ For swarm like effects you use particle emitters.

            - +

            How do I make water, waves, reflections?

            @@ -716,7 +716,7 @@ Use a special post-processor renderer from com.jme3.water.*.

            - +

            How do I make fog, bloom, blur, light scattering?

            @@ -727,7 +727,7 @@ Use special post-processor renderers from com.jme3.post.*.

            - +

            How do I generate a terrain?

            @@ -740,7 +740,7 @@ Use com.jme3.terrain.*. The JMonkeyEngine also provides you with a Terrain Edito

            - +

            How do I make a sky?

            @@ -758,12 +758,12 @@ skyGeo.setQueueBucket(Bucket.Sky)

            - +

            I want to access to back-end properties

            - +

            How do I read out graphic card capabilities?

            @@ -775,12 +775,12 @@ If your game is heavily using features that older cards do not support, you can Logger.getLogger(HelloJME3.class.getName()).log(Level.INFO, "Capabilities: {0}", caps.toString());
            - +

            How do I Run jMonkeyEngine 3 with OpenGL1?

            -In you game, add +In your game, add

            settings.setRenderer(AppSettings.LWJGL_OPENGL1)
            @@ -792,7 +792,7 @@ For the jMonkeyEngine SDK it

            - +

            How do I optimize the heck out of the Scene Graph?

            @@ -809,7 +809,7 @@ Batching means that all Geometries with the same Material are combined into one

            - +

            How do I prevent users from unzipping my JAR?

            @@ -819,12 +819,12 @@ Add an - +

            I want to do maths

            - +

            What does addLocal() / multLocal() etc mean?

            @@ -877,7 +877,7 @@ Many maths functions (mult(), add(), subtract(), etc) come as local and a non-lo
            - +

            What is the difference between World and Local coordinates?

            @@ -887,7 +887,7 @@ World coordinates of a Spatial are its absolute coordinates in the 3D scene (thi

            - +

            How do I convert Degrees to Radians?

            @@ -901,5 +901,5 @@ 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-documentation/src/com/jme3/gde/docs/jme3/intermediate/appsettings.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/appsettings.html index b6df625f4..6ee0d853a 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/appsettings.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/appsettings.html @@ -8,7 +8,7 @@ Every class that extends jme3.app.SimpleApplication has properties that can be c

            -

            Configure application settings in main(), before you call app.start() on the application object. If you change display settings during runtime, for eyample in simpleInitApp(), you must call app.restart() to make them take effect. +

            Configure application settings in main(), before you call app.start() on the application object. If you change display settings during runtime, for example in simpleInitApp(), you must call app.restart() to make them take effect.

            @@ -47,14 +47,14 @@ This example toggles the settings to fullscreen while the game is already runnin int i=0; // note: there are usually several, let's pick the first settings.setResolution(modes[i].getWidth(),modes[i].getHeight()); settings.setFrequency(modes[i].getRefreshRate()); - settings.setDepthBits(modes[i].getBitDepth()); + settings.setBitsPerPixel(modes[i].getBitDepth()); settings.setFullscreen(device.isFullScreenSupported()); app.setSettings(settings); app.restart(); // restart the context to apply changes }
            - +

            Properties

            @@ -94,7 +94,7 @@ Set VSync to false to deactivate vertical syncing (faster, but possible page tea 60 fps
            -
            +
            @@ -111,7 +111,7 @@ Set VSync to false to deactivate vertical syncing (faster, but possible page tea
            Settings Property (Input)DescriptionDefault
            setEmulateMouseFlipAxis(true,true)Flips the X or Y (or both) axes for the emulated mouse. Set the first parameter to true to flip the x axis, and the second to flip the y axis.false,false
            -
            +
            @@ -122,7 +122,7 @@ Set VSync to false to deactivate vertical syncing (faster, but possible page tea
            Settings Property (Audio)DescriptionDefault
            setStereo3D(true)Enable 3D stereo. This feature requires hardware support from the GPU driver. See . Currently, your everday user's hardware does not support this, so you can ignore it for now.false
            -
            +
            @@ -137,7 +137,7 @@ ImageIO.read(new File("")), ???});
            Settings Property (Branding)DescriptionDefault
            This specifies the little a setSettingsDialogImage("Interface/mysplashscreen.png")A custom splashscreen image in the assets/Interface directory which is displayed when the settings dialog is shown."/com/jme3/app/Monkey.png"
            - +

            You can use app.setShowSettings(true); and setSettingsDialogImage("Interface/mysplashscreen.png") to present the user with jme3's default display settings dialog when starting the game. Use app.setShowSettings(false); to hide the default settings screen. Set this boolean before calling app.start() on the SimpleApplication. @@ -145,7 +145,7 @@ ImageIO.read(new File("")), ???});This specifies the little a

            - +

            Toggling and Activating Settings

            @@ -165,9 +165,9 @@ ImageIO.read(new File("")), ???});
            This specifies the little a app.restart()Restart()ing a running game restarts the game context and applies the updated settings object. (This does not restart or reinitialize the whole game.)
            - +
            - +

            Saving and Loading Settings

            @@ -207,5 +207,5 @@ Provide the unique name of your jME3 application as the String argument. For exa
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/best_practices.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/best_practices.html index b45f8f268..fe1b95cb3 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/best_practices.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/best_practices.html @@ -158,7 +158,7 @@ Whether you work in a team or alone, keeping a version controlled repository of
            • Treat commit messages as messages to your future self. "Made some changes" is not a commit message.
            • -
            • The jMonkeyEngine SDK supports Subversion, Mercurial, and CVS.
              +
            • The jMonkeyEngine SDK supports Subversion, Mercurial, and Git.
              If you don't know which to choose, Subversion is a good choice for starters.
            • Set up your own local server, or get free remote hosting space from various open-source dev portals like , , (supports private projects), , ???
              diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/how_to_use_materials.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/how_to_use_materials.html index 6f8f200d0..d13cdda5a 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/how_to_use_materials.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/how_to_use_materials.html @@ -294,7 +294,7 @@ To make a Geometry transparent or translucent:
          24. Put the Geometry (not the Material!) in the appropriate render queue bucket.
            -Objects in the translucent bucket (e.g. particles) are not affected by SceneProcessors (e.g. shadows). Obejcts in the transparent bucket (e.g. foliage) are affected by SceneProcessors (e.g. shadows).
            +Objects in the translucent bucket (e.g. particles) are not affected by SceneProcessors (e.g. shadows). Objects in the transparent bucket (e.g. foliage) are affected by SceneProcessors (e.g. shadows).
            • geo.setQueueBucket(Bucket.Translucent); 
              diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/math.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/math.html index a66f936a6..f788b083d 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/math.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/math.html @@ -109,7 +109,7 @@ float z = FastMath.sin(phi)*r; - +

              Local vs Non-local methods?

                @@ -122,5 +122,5 @@ float z = FastMath.sin(phi)*r;
              - +

              view online version

              \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/multi-media_asset_pipeline.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/multi-media_asset_pipeline.html index 144caf8de..38830a730 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/multi-media_asset_pipeline.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/multi-media_asset_pipeline.html @@ -20,7 +20,7 @@ Assets are files that are not code. Your multi-media assets includes, for exampl DODON'T - Save original models plus textures into assets/Textures. Don't leave textures or models in a folder outside your JME project: The game cannot load or reference them from there. + Import original models plus textures into assets/Textures. Don't leave textures or models in a folder outside your JME project: The game cannot load or reference them from there. Save sounds into assets/Sounds. Don't leave audio files in a folder outside your JME project: The game cannot load or reference them from there. @@ -41,14 +41,14 @@ Assets are files that are not code. Your multi-media assets includes, for exampl Agree on naming schemes and folder schemes with your artists early on to avoid confusion. E.g. keep naming schemes for bones and certain model parts. Try to keep your assets folder clean, its like your codes class structure.Don't mindlessly import downloaded models and other assets into your project without keeping a structure and knowing the files work. You can reimport, delete junk. - +

              Read on for details.

              - +

              Use The Assets Folder

              @@ -59,7 +59,7 @@ Store your assets in subfolders of your project's assets direc
              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/Models/    # .blend, .j3o
               jMonkeyProjects/MyGame/assets/Scenes/    # .j3o
               jMonkeyProjects/MyGame/assets/Shaders/   # .j3f, .vert, .frag
               jMonkeyProjects/MyGame/assets/Sounds/    # .ogg, .wav
              @@ -105,7 +105,7 @@ See also:
               
            - +

            Create Textures and Materials

            @@ -140,7 +140,7 @@ Storing the textures inside your project directory is necessary for the paths in

            - +

            Create 3D Models

            @@ -189,7 +189,7 @@ See also:

            - +

            Convert 3D Models to .j3o Format

            @@ -216,7 +216,7 @@ This process ensures that the texture paths are correct, and it also keeps your

            - +

            Must I convert to .j3o? Yes!

            @@ -245,7 +245,7 @@ Use Java commands, or use the +

            See Also

              @@ -264,5 +264,5 @@ Use Java commands, or use the +

              view online version

              \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/optimization.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/optimization.html index 1dbc1539b..54c573de9 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/optimization.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/intermediate/optimization.html @@ -45,15 +45,41 @@ You can optimize nodes using the SceneComposer in the +

              Avoid large objects in physics

              @@ -63,7 +89,7 @@ To offload much computation to the less CPU intense physics broadphase collision

              - +

              Check the Statistics

              @@ -94,5 +120,5 @@ Generally jME3 is well optimized and optimizes these things correctly. Read
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/ios.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/ios.html index 0e2ab365d..169d5e89b 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/ios.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/ios.html @@ -6,17 +6,23 @@ To use iOS deployment you need a computer running MacOSX and a version of Xcode 4.0+ installed. To deploy to a device or the Apple App Store, you need an Apple developer account.

            +

            +

            Note that at the moment iOS deployment is in alpha state. +

            +

            +

            iOS deployment works via cross-compilation to native iOS ARM code, there is no virtual machine running on the device. The Avian JVM supports this feature while maintaining general compatibility to OpenJDK and JNI for native access. The minimum compatible iOS deployment target is 4.3.

            -

            Note that at the moment this option is in pre-alpha state and the system runs on a null renderer. This means there is no visual or audio output. You can however use the current system to explore the options and test cross-compiling your applications. +

            To install the iOS deployment plugin, go to Tools???Plugins and under "Available plugins" select the "iOS Support" plugin.

            +

            - +

            Enabling iOS deployment

            @@ -39,7 +45,7 @@ After enabling deployment, a new ios directory is created in the pr

            - +

            Building the iOS binaries

            @@ -56,7 +62,7 @@ After the iOS classpath has been created the avian compiler is used to create a

            - +

            Running and deploying the application

            @@ -68,7 +74,7 @@ To run the application, open the Xcode project under ios/project in

            - +

            Creating native and java code for iOS

            @@ -97,5 +103,5 @@ Java code for iOS should be in the ios/src folder as well for clean
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/math.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/math.html index 305bd481f..414cd9af1 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/math.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/math.html @@ -44,6 +44,30 @@ The definition of a coordinate system is defined in jME by the properties sent t +

            Homogenous coordinates

            +
            + +

            + +Homogenous coordinates have an additional W value tacked on to the end. The XYZ values are to be divided by W to give the true coordinates. +

            + +

            +This has several advantages, one technical, some relevant to application programmers: +

            + +

            +Technically, it simplifies some formulae used inside the vector math. For example, some operations need to apply the same factor to the XYZ coordinates. Chain multiple operations of that kind (and vector math tends to do that), and you can save a lot of multiplications by simply keeping the scaling factor around and doing the multiplication to XYZ at the end of the pipeline, in the 3D card (which does accept homogenous coordinates). +It also simplifies some formulae, in particular anything that is related to rotations. +

            + +

            +For application programmers, this means you can express infinitely long vectors that still have a direction - these tend to be used in lighting. Just use a W value of 0.0. + +

            + +
            +

            Transformations

            @@ -53,7 +77,7 @@ Transformations define an operation that converts points from one coordinate sys

            - +

            Visibility Determination

            @@ -63,17 +87,17 @@ Visibility Determination concerns itself with minimizing the amount of data that

            - +

            Fundamental Types

            - +

            ColorRGBA

            - +

            Definition

            @@ -87,7 +111,7 @@ ColorRGBA defines a color value in the jME library. The color value is made of t

            - +

            jME Class

            @@ -109,7 +133,7 @@ ColorRGBA will also handle interpolation between two colors. Given a second colo

            - +

            Matrix

            @@ -121,7 +145,7 @@ and - +

            Definition

            @@ -148,7 +172,7 @@ There are a few special matrices: 000
            - +

            The Identity Matrix is the matrix with 1 on the diagonal entries and 0 for all other entries. @@ -164,7 +188,7 @@ The Identity Matrix is the matrix with 1 on the diagonal entries and 0 001 - +

            A Matrix is invertible if there is a matrix M-1 where MM-1 = M-1M = I. @@ -185,7 +209,7 @@ The transpose of a matrix M = [mij] is MT< 333 123 - +

            A Matrix is symmetric if M = MT. @@ -201,7 +225,7 @@ A Matrix is symmetric if M = MT. BCX - +

            Where X, A, B, and C equal numbers

            @@ -211,7 +235,7 @@ jME includes two types of Matrix classes: Matrix3f and Matrix4f. Matrix3f is a 3

            - +

            Transformations

            @@ -251,7 +275,7 @@ A rotation matrix requires that the transpose and inverse are the same u1-u00
            - +

            Translation

            @@ -270,14 +294,14 @@ Translation requires a 4x4 matrix, where the vector (x,y,z) is mapped to (x,y,z, ST1 - +

            where M is the 3x3 matrix (containing any rotation/scale information), T is the translation vector and ST is the transpose Vector of T. 1 is just a constant.

            - +

            jME Class

            @@ -291,7 +315,7 @@ Most methods are straight forward, and I will leave documentation to the Javadoc

            - +

            Vector

            @@ -303,7 +327,7 @@ and - +

            Definition

            @@ -321,7 +345,7 @@ We have two Vectors (2f and 3f) meaning we have tuples of 2 float values or 3 fl

            - +

            Operations

            @@ -411,7 +435,7 @@ Vector3f and Vector2f store their values (x, y, z) and (x, y) respectively as fl

            - +

            Quaternion

            @@ -421,7 +445,7 @@ See - +

            Definition

            @@ -485,7 +509,7 @@ These basic operations allow us to convert various rotation representations to Q

            - +

            Angle Axis

            @@ -505,7 +529,7 @@ float angle = 3.14f; s.getLocalRotation().fromAngleAxis(angle, axis);
            - +

            Three Angles

            @@ -523,7 +547,7 @@ float[] angles = {1, 3, 0}; s.getLocalRotation().fromAngles(angles);
            - +

            Three Axes

            @@ -545,7 +569,7 @@ axes[2] = new Vector3f(0, 0.5f, 0.5f); //dir s.getLocalRotation().fromAxes(axes);
            - +

            Rotation Matrix

            @@ -570,7 +594,7 @@ As you can see there are many ways to build a Quaternion. This allows you to wor

            - +

            Slerp

            @@ -590,7 +614,7 @@ Quaternion q2; Quaternion q3 = q1.slerp(q2, 0.5f);
            - +

            Multiplication

            @@ -608,7 +632,7 @@ Vector3f myVector = new Vector3f(0,0,-1); myRotation.multLocal(myVector);
            - +

            Utility Classes

            @@ -618,7 +642,7 @@ Along with the base Math classes, jME provides a number of Math classes to make

            - +

            Fast Math

            @@ -628,7 +652,7 @@ See - +

            Definition

            @@ -638,7 +662,7 @@ FastMath provides a number of convience methods, and where possible faster versi

            - +

            Usage

            @@ -729,7 +753,7 @@ There are five major categories of functions that FastMath provides.
            - +

            Line

            @@ -739,7 +763,7 @@ See - +

            Definition

            @@ -749,7 +773,7 @@ A line is a straight one-dimensional figure having no thickness and extending in

            - +

            Usage

            @@ -763,14 +787,14 @@ jME defines a Line class that is defined by an origin and direction. In reality,

            - +

            Example 1 - Find a Random Point on a Line

            Line l = new Line(new Vector3f(0,1,0), new Vector3f(3,2,1));
             Vector3f randomPoint = l.random();
            - +

            Plane

            @@ -780,7 +804,7 @@ See - +

            Definition

            @@ -814,7 +838,7 @@ This gives us the general equation: (ax + by + cz + d = 0)

            - +

            Usage in jME

            @@ -846,7 +870,7 @@ These values are returned on a call to whichSide.

            - +

            Example 1 - Determining if a Point is On the Positive Side of a Plane

            Vector3f normal = new Vector3f(0,1,0);
            @@ -860,7 +884,7 @@ if(side == Plane.NO_SIDE) {
             }
            - +

            Example 2 - For the Layperson

            @@ -932,7 +956,7 @@ public class TestPlanes }
            - +

            Ray

            @@ -942,7 +966,7 @@ See - +

            Definition

            @@ -956,13 +980,13 @@ This Ray is used extensively in jME for +

            Example 1 - Create a Ray That Represents Where the Camera is Looking

            Ray ray = new Ray(cam.getLocation(), cam.getDirection());
            - +

            Rectangle

            @@ -972,7 +996,7 @@ See - +

            Definition

            @@ -982,7 +1006,7 @@ Rectangle defines a finite plane within three dimensional space that is specifie

            - +

            jME Usage

            @@ -992,7 +1016,7 @@ Rectangle is a straight forward data class that simply maintains values that def

            - +

            Example 1 : Define a Rectangle and Get a Point From It

            Vector3f v1 = new Vector3f(1,0,0);
            @@ -1002,7 +1026,7 @@ Rectangle r = new Rectangle(v1, v2, v3);
             Vector3f point = r.random();
            - +

            Triangle

            @@ -1012,7 +1036,7 @@ See - +

            Definition

            @@ -1022,7 +1046,7 @@ A triangle is a 3-sided polygon. Every triangle has three sides and three angles

            - +

            Usage

            @@ -1032,7 +1056,7 @@ jME's Triangle class is a simple data class. It contains three +

            Example 1 - Creating a Triangle

            //the three points that make up the triangle
            @@ -1042,12 +1066,12 @@ Vector3f p3 = new Vector3f(0,1,1);
             Triangle t = new Triangle(p1, p2, p3);
            - +

            Tips and Tricks

            - +

            How do I get height/width of a spatial?

            @@ -1062,13 +1086,13 @@ float y = ( (BoundingBox)spatial.getWorldBound()).getYEx float z = ( (BoundingBox)spatial.getWorldBound()).getZExtent();
            - +

            How do I position the center of a Geomtry?

            geo.center().move(pos);
            - +

            See Also

              @@ -1079,5 +1103,5 @@ float z = ( (BoundingBox)spatial.getWorldBound()).getZEx
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/terminology.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/terminology.html index 05bc67ef1..20b48a131 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/terminology.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/jme3/terminology.html @@ -352,11 +352,11 @@ See also: Water.

            -MIP Map means that you provide one texture in two or three resolutions in one file (MIP = "multum in parvo" = "many in one"). Depending on how close (or far) the camera is, the engine automatically renders a more (or less) detailed texture for the object. Thus objects look smooth from close up, but don't waste resources with unspottable details when far away. Good for everything, but requires more time to create and more space to store textures. If you don't provide custom ones, the jMonkeyEngine creates basic MIP maps automatically as an optimization. +MIP Map means that you provide one texture in two or three resolutions in one file (MIP = "multum in parvo" = "many in one"). Depending on how close (or far) the camera is, the engine automatically renders a more (or less) detailed texture for the object. Thus objects look detailed at close up, but also look good when viewed from far away. Good for everything, but requires more time to create and more space to store textures. If you don't provide custom ones, the jMonkeyEngine creates basic MIP maps automatically as an optimization.

            - +

            Procedural Textures

            @@ -374,7 +374,7 @@ See also:

            - +

            Animation

            @@ -388,7 +388,7 @@ Unless you animate a 3D cartoon, realism of animated characters is generally a p

            - +

            Rigging and Skinning

            @@ -458,7 +458,7 @@ E.g. when the thigh bone moves, the leg is fully affected, the hips joints less

            - +

            Kinematics

              @@ -469,7 +469,7 @@ E.g. when the thigh bone moves, the leg is fully affected, the hips joints less
            - +

            Controller and Channel

            @@ -478,7 +478,7 @@ In the JME3 application, you register animated models to the Animation Controlle

            - +

            Artificial Intelligence (AI)

            @@ -529,7 +529,7 @@ There are lots of resources explaining interesting AI algorithms:
            - +

            Math

            @@ -538,7 +538,7 @@ There are lots of resources explaining interesting AI algorithms:

            - +

            Coordinates

            @@ -549,7 +549,7 @@ In contrast to a vector (which looks similar), a coordinate is a location, not a

            - +

            The Origin

            @@ -563,7 +563,7 @@ The origin is the central point in the 3D world, where the three axes meet. It&#

            - +

            Vectors

            @@ -579,7 +579,7 @@ A vector has a length and a direction, like an arrow in 3D space. A vector start Vector3f v = new Vector3f( 8f , 0f , 33f ).add(new Vector3f( 0f , -2f , -2f )); // starts at (8,-2,31)
            - +

            Unit Vectors

            @@ -603,7 +603,7 @@ Negate the vegator to change its direction, e.g. (-1, 0, 0) = left.

            - +

            Normalized Vectors

            @@ -618,7 +618,7 @@ When you normalize a vector, it still has the same direction, but you lose the i

            - +

            Surface Normal Vectors

            @@ -630,7 +630,7 @@ You calculate the Surface Normal by calculating the cross product.

            - +

            Cross Product

            @@ -647,7 +647,7 @@ In 3D space, speaking of an orthogonal only makes sense with respect to a plane.

            - +

            Transformation

            @@ -661,7 +661,7 @@ Examples: Falling and rotating bricks in 3D Tetris.

            - +

            Slerp

            @@ -679,7 +679,7 @@ Example: A burning meteorite Geometry slerps from "position p1, rotation r1

            - +

            Game Developer Jargon

              @@ -688,7 +688,7 @@ Example: A burning meteorite Geometry slerps from "position p1, rotation r1
            - +

            3D graphics Terminology Wiki book

              @@ -697,5 +697,5 @@ Example: A burning meteorite Geometry slerps from "position p1, rotation r1
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/application_deployment.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/application_deployment.html index 796bf7b5f..caa515174 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/application_deployment.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/application_deployment.html @@ -15,10 +15,12 @@ After you have written and tested your game, you want to brand it and distribute
          25. Android mobile device (.APK)
          26. +
          27. iOS mobile device (XCode project)
            +
          28. - +

            Requirements

            @@ -28,7 +30,7 @@ Since JAR files are platform independent, your customers can play your jMonkeyEn

            - +

            Branding

            @@ -72,7 +74,7 @@ TODO: where does this info actually show up?

            - +

            Creating the Distributable

            @@ -90,7 +92,7 @@ Here are your deployment options in detail:

            - +

            Desktop Application (JAR)

            @@ -118,7 +120,7 @@ Most operating systems execute a JAR when users double-click on it, but you can

            - +

            Desktop Executables (.EXE, .APP, .JAR)

            @@ -144,7 +146,7 @@ When you build your project, zip files for each selected platform will be create

            - +

            Web Start (.JNLP)

            @@ -181,7 +183,7 @@ Also, see this +

            Browser Applet

            @@ -246,7 +248,7 @@ The dist/Applet directory now contains all the files necessary for
            - +

            Android Mobile Device

            @@ -260,13 +262,13 @@ Learn more about Android Support<

            - +

            iOS Device

            -You can set the jMonkeyEngine SDK to build an executable for iOS platforms. Mac support is work in progress. +You can set the jMonkeyEngine SDK to build an executable for iOS platforms. A Mac with XCode installed is needed.

            @@ -274,7 +276,7 @@ Learn more about iOS Support here

            - +

            Tip: Switching Build Configurations

            @@ -299,7 +301,7 @@ Now you can use the Set Project Configuration popup menu to switch

            - +

            Tip: Reduce Distribution File Size

            @@ -342,5 +344,5 @@ jme3-libraries-gui, jme3-libraries-physics, jme3-libraries-video, etc.
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/blender.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/blender.html index e390c43bf..c8503d79e 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/blender.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/blender.html @@ -158,15 +158,23 @@ By default a BlenderModelLoader is registered with your assetManager to load ble +
          29. Importing sky
            +
              +
            • loading world's horizon color as a background color if no sky type is used
              +
            • +
            • loading sky without the texture
              +
            • +
            • loading textured sky (including both generated and normal textures)
              +
            • +
            +
          30. - +

            Planned features.

              -
            1. Loading sky.
              -
            2. Full support for scale and offset in texture input mapping.
            3. Full support for bone and object constraints.
              @@ -180,7 +188,7 @@ By default a BlenderModelLoader is registered with your assetManager to load ble
            - +

            Known bugs/problems.

              @@ -191,7 +199,7 @@ By default a BlenderModelLoader is registered with your assetManager to load ble
            - +

            Using BlenderLoader instead of BlenderModelLoader

            @@ -252,7 +260,7 @@ You can use ModelKey as well. This will give the same result as using default Bl

            - +

            How does it work?

            @@ -298,7 +306,7 @@ Here is the list of how blender features are mapped into jme. Surface Node The surface is transformed to the proper mesh
            - +

            Using BlenderLoader can allow you to use blend file as your local assets repository. @@ -308,7 +316,7 @@ Probably versions before 2.49 will work pretty well too, but I never checked tha

            - +

            Notes

            @@ -321,6 +329,15 @@ Hope I will meet your expectations. Be mindful of the result model vertices amount. The best results are achieved when the model is smooth and has no texture. Then the vertex amount is equal to the vertex amount in blender. If the model is not smooth or has a generated texture applied then the amount of vertices is 3 times larger than mesh's triangles amount. If a 2d texture is applied with UV mapping then the vertex count will vary depending on how much the UV map is fragmented.

            +

            +When using polygon meshes in blender 2.5 and newer, better add and apply the triangulation modifier (if available in your version) or save the file with convertion from polygons to triangles. +Even though the importer supports loading of polygons as the mesh faces, if your face isn't convex, the results might contain errors. +

            + +

            +Not all modifiers are supported. If your model has modifiers and looks not the way you want in the jme scene - try to apply them and load again. +

            +

            Cheers, Marcin Roguski (Kaelthas) @@ -349,5 +366,5 @@ See also:

            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/development.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/development.html index 5fd7aeb9a..ff5463bd0 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/development.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/development.html @@ -78,6 +78,26 @@ If you feel like you want to make an addition to jMonkeyEngine SDK. It can contain editors, simple ???Java SE Libraries??? that you can add to your projects as jar files and other things like project templates etc. + +
          31. A ???module??? is the project type that allows you to create plugins, strictly speaking all plugins are modules but there can be modules that are never shown in the plugin list and only exist as dependencies of other modules.
            +
          32. +
          33. A ???library??? is an entry for a jar file (and optionally sources and javadocs) which can be added to a SDK project to be used and distributed with it
            +
          34. +
          35. An ???extension??? is a generic name for stuff that extends the jME engine, like pathfinding algorithms or anything that can be used at the game runtime..
            +
          36. + + +

            + +So if you have some cool code that others can use in their games too, you would make your extension a library by creating a module that the users can download as a plugin :) +

            + + +

            Handy things in jMonkeyEngine SDK Core

              diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/material_editing.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/material_editing.html index 0f88f5927..be7f4b7ab 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/material_editing.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/material_editing.html @@ -112,7 +112,7 @@ Or in your Java code
            • Use a loader and a setter to assign the material to a Geometry
            -
            mywall.setMaterial(assetManager.loadAsset( "Materials/mat_wall.j3m"));
            +
            mywall.setMaterial(assetManager.loadMaterial( "Materials/mat_wall.j3m"));

            diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/scene_explorer.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/scene_explorer.html index a6c55aff1..0761cae9e 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/scene_explorer.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/scene_explorer.html @@ -30,11 +30,11 @@ The SceneExplorer displays Nodes in a tree that represents the tree of Spatials

            -You open the SceneExplorer by viewing a model (j3o file or other) in the jMonkeyEngine SDK. +SceneExplorer works in conjunction with SceneComposer, the default editor for J3O files in the jMonkeyEngine IDE. If SceneExplorer doesn't appear when you select "Edit in SceneComposer", choose Window ??? SceneExplorer from the menu bar to reveal the window.

            - +

            Editing Objects in the scene

              @@ -47,7 +47,7 @@ You open the SceneExplorer by viewing a model (j3o file or other) in the jMonkey
            - +

            Reorganizing Objects in the scene

              @@ -58,7 +58,7 @@ You open the SceneExplorer by viewing a model (j3o file or other) in the jMonkey
            - +

            Adding Objects to the scene

            @@ -75,5 +75,5 @@ Right-click a Spatial or Node in the SceneExplorer to add other Spatials like Pa
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/troubleshooting.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/troubleshooting.html index 981fbef5d..1dc4e395b 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/troubleshooting.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/troubleshooting.html @@ -4,30 +4,6 @@ -

            Specifying the JDK location

            -
            - -

            - -You should install the JDK (the one from Oracle, not OpenJDK) first, and then the jMonkey SDK. If jMonkeyEngine SDK cannot find a valid JDK although you have it installed, then you have to specify the location manually. - -

            -
              -
            1. Go to your jMonkeyEngine SDK installation directory.
              -Mac users right-click jMonkeyApplication.app (which actually is a directory) in the Finder and select "Show package contents".
              -
            2. -
            3. Navigate to the etc directory.
              -Mac users navigate to Contents/Resources/jmonkeyplatform/etc/.
              -
            4. -
            5. Open the file jmonkeyplatform.conf in a text editor.
              -
            6. -
            7. Uncomment the following line and enter the path to the JDK:
              jdkhome="/path/to/jdk"
              -
              -
            8. -
            - -
            -

            Graphics Card Driver

            @@ -37,7 +13,7 @@ Mac users navigate to Contents/Resources/jmonkeyplatform/etc/.
            - +

            Stability / Graphics issues

            @@ -80,7 +56,7 @@ Compiz on Linux might cause issues, if you set its rendering quality to "me

            - +

            Updating problems

            @@ -89,7 +65,7 @@ If you have problems updating the SDK<

            - +

            Preferences and Settings

            @@ -108,7 +84,7 @@ To completely remove and/or reinstall the +

            Log

            @@ -117,7 +93,7 @@ To see or post the error output of the
            - +

            Getting error messages and reporting issues

            @@ -126,7 +102,31 @@ When an exception happens in the SDK
            - + +

            Specifying the JDK location

            +
            + +

            + +You can install another JDK for use with the jMonkey SDK. You then have to specify the location manually. + +

            +
              +
            1. Go to your jMonkeyEngine SDK installation directory.
              +Mac users right-click jMonkeyApplication.app (which actually is a directory) in the Finder and select "Show package contents".
              +
            2. +
            3. Navigate to the etc directory.
              +Mac users navigate to Contents/Resources/jmonkeyplatform/etc/.
              +
            4. +
            5. Open the file jmonkeyplatform.conf in a text editor.
              +
            6. +
            7. Uncomment the following line and enter the path to the JDK:
              jdkhome="/path/to/jdk"
              +
              +
            8. +
            + +
            +

            Known Issues

            @@ -142,5 +142,5 @@ For a list of known issues and possible workarounds see the following link:
            - +

            view online version

            \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/version_control.html b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/version_control.html index b929ecc6d..8ac499545 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/version_control.html +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/sdk/version_control.html @@ -4,7 +4,7 @@

            -Whether you work in a development team or alone: File versioning is a handy method to keep your code consistent, compare files line-by-line, and even roll back unwanted changes. This documentation shows you how to make the most of the SDK's integrated version control features for Subversion, Mercurial, and CVS. +Whether you work in a development team or alone: File versioning is a handy method to keep your code consistent, compare files line-by-line, and even roll back unwanted changes. This documentation shows you how to make the most of the SDK's integrated version control features for Subversion, Mercurial, and Git.

            @@ -31,7 +31,7 @@ Note: Since the jMonkeyEngine SDK -The jMonkeyEngine SDK supports various Version Control Systems such as Subversion, Mercurial, and CVS. No matter which of them you use, they all share a common user interface. +The jMonkeyEngine SDK supports various Version Control Systems such as Subversion, Mercurial, and Git. No matter which of them you use, they all share a common user interface.

            @@ -50,7 +50,7 @@ Requirements:

            • You must have a project that you want to version.
            • -
            • You must have version control software installed (Subversion, Mercurial, or CVS) and have initialized a repository.
              +
            • You must have version control software installed (Subversion, Mercurial, or Git) and have initialized a repository.
              • Tip: For Subversion, for example, the init command looks like this example: svnadmin create /home/joe/jMonkeyProjects/MyGame
              • @@ -70,7 +70,7 @@ Now you create a repository to store your project's files.

                  -
                1. In the jMonkeyEngine SDK, right-click the project in the Projects window and choose Versioning > Import Into CVS/Subversion Repository (or initialize Mercurial Project, respectively).
                  +
                2. In the jMonkeyEngine SDK, right-click the project in the Projects window and choose Versioning > Import Into Subversion Repository (or initialize Mercurial Project, etc, respectively).
                  • Tip: If you haven't evaluated yet which system to choose, start with Subversion for now.
                  • @@ -81,7 +81,7 @@ Now you create a repository to store your project's files.
                - +

                Checking Out a Repository (Download)

                @@ -91,7 +91,7 @@ You and your team mates check out (download) the repository to their individual

                  -
                1. Go to the Team menu and choose Subversion > Checkout (or CVS/Mercurial>Checkout respectively)
                  +
                2. Go to the Team menu and choose Subversion > Checkout (or Git or Mercurial respectively)
                3. Fill in your repo data into the wizard and click Finish.
                    @@ -117,7 +117,7 @@ Of course you can also check out existing repositories and access code from othe

                - +

                Updating and Committing Changes (Send and Receive)

                @@ -156,7 +156,7 @@ Receiving the latest changes from the team's repository is referred to as <
                - +

                Comparing and Reverting Changes

                  @@ -187,7 +187,7 @@ Receiving the latest changes from the team's repository is referred to as <
                - +

                No Version Control? Local History!

                @@ -221,5 +221,5 @@ See also:
                - +

                view online version

                \ No newline at end of file diff --git a/sdk/jme3-documentation/src/com/jme3/gde/docs/wiki-map.xml b/sdk/jme3-documentation/src/com/jme3/gde/docs/wiki-map.xml index 501eeb9fc..f4fb29835 100644 --- a/sdk/jme3-documentation/src/com/jme3/gde/docs/wiki-map.xml +++ b/sdk/jme3-documentation/src/com/jme3/gde/docs/wiki-map.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file