Selaa lähdekoodia

Removed outdated pages.

mitm 6 vuotta sitten
vanhempi
commit
acc71390fb

+ 0 - 410
src/docs/asciidoc/jme3/advanced/appstatesdemo.adoc

@@ -1,410 +0,0 @@
-= Simple AppStates Demo
-:author: 
-:revnumber: 
-:revdate: 2016/03/17 20:48
-:relfileprefix: ../../
-:imagesdir: ../..
-ifdef::env-github,env-browser[:outfilesuffix: .adoc]
-
-
-
-[IMPORTANT]
-====
-
-THIS DEMO IS OUT OF DATE AND NEEDS CORRECTING
-
-====
-
-
-
-== THIS DEMO IS OUT OF DATE AND NEEDS CORRECTING FOR NOW PLEASE SEE
-
- <<jme3/advanced/application_states#,jme3:advanced:application_states>>
-
-Note: this tutorial needs to be fixed and is currently not correct.  One should almost never override stateDetached and stateAttached… and should certainly never do anything scene related in them.
-
-This demo is a simple example of how you use AppStates to toggle between a StartScreen and a SettingsScreen (press RETURN) while the game is paused, and start the game by switching to a GameRunning state (press BACKSPACE). 
-
-There are four files, Main.java, GameRunningState.java, StartScreenState.java, SettingsScreenState.java. 
-
-
-=== Main.java
-
-[source,java]
-----
-
-package chapter04.appstatedemo;
-
-import com.jme3.app.SimpleApplication;
-import com.jme3.input.KeyInput;
-import com.jme3.input.controls.ActionListener;
-import com.jme3.input.controls.KeyTrigger;
-import com.jme3.input.controls.Trigger;
-
-/**
- * This demo shows a simple "game" with three AppStates. Instead of game content, 
- * it just displays three cubes on different backgrounds.
- * <ul>
- * <li>StartScreenState: This state is enabled 
- *     when the user starts the application, or the the game is paused. 
- *     Press BACKSPACE to return to the game, press RETURN to go to Settings.</li>
- * <li>GameRunningState: This state shows the game content and is enabled while the game is running. 
- *     Press BACKSPACE to pause and return to the start screen.</li>
- * <li>SettingsScreenState: This Settings screen state can be reached from the start screen
- *     Press RETURN to toggle it on and off.</li>
- * </ul>
- */
-public class Main extends SimpleApplication {
-
-  private Trigger pause_trigger = new KeyTrigger(KeyInput.KEY_BACK);
-  private Trigger save_trigger = new KeyTrigger(KeyInput.KEY_RETURN);
-  private boolean isRunning = false; // starts at startscreen
-  private GameRunningState gameRunningState;
-  private StartScreenState startScreenState;
-  private SettingsScreenState settingsScreenState;
-
-  
-  /** Start the jMonkeyEngine application */
-  public static void main(String[] args) {
-    Main app = new Main();
-    app.start();
-  }
-
-  /**
-   * initialize the scene here
-   */
-  @Override
-  public void simpleInitApp() {
-    setDisplayFps(false);
-    setDisplayStatView(false);
-
-    gameRunningState    = new GameRunningState(this);
-    startScreenState    = new StartScreenState(this);
-    settingsScreenState = new SettingsScreenState(this);
-
-    stateManager.attach(startScreenState);
-
-    inputManager.addMapping("Game Pause Unpause", pause_trigger);
-    inputManager.addListener(actionListener, new String[]{"Game Pause Unpause"});
-    inputManager.addMapping("Toggle Settings", save_trigger);
-    inputManager.addListener(actionListener, new String[]{"Toggle Settings"});
-  }
-  
-  private ActionListener actionListener = new ActionListener() {
-    public void onAction(String name, boolean isPressed, float tpf) {
-      System.out.println("key" + name);
-      if (name.equals("Game Pause Unpause") && !isPressed) {
-        if (isRunning) {
-          stateManager.detach(gameRunningState);
-          stateManager.attach(startScreenState);
-          System.out.println("switching to startscreen...");
-
-        } else {
-          stateManager.detach(startScreenState);
-          stateManager.attach(gameRunningState);
-          System.out.println("switching to game...");
-        }
-        isRunning = !isRunning;
-      } else if (name.equals("Toggle Settings") && !isPressed && !isRunning) {
-        if (!isRunning && stateManager.hasState(startScreenState)) {
-          stateManager.detach(startScreenState);
-          stateManager.attach(settingsScreenState);
-          System.out.println("switching to settings...");
-        } else if (!isRunning && stateManager.hasState(settingsScreenState)) {
-          stateManager.detach(settingsScreenState);
-          stateManager.attach(startScreenState);
-          System.out.println("switching to startscreen...");
-        }
-      }
-    }
-  };
-
-  @Override
-  public void simpleUpdate(float tpf) {}
-
-}
- 
-
-----
-
-
-=== GameRunningState.java
-
-[source,java]
-----
-
-package chapter04.appstatedemo;
-
-import com.jme3.app.Application;
-import com.jme3.app.SimpleApplication;
-import com.jme3.app.state.AbstractAppState;
-import com.jme3.app.state.AppStateManager;
-import com.jme3.asset.AssetManager;
-import com.jme3.font.BitmapFont;
-import com.jme3.font.BitmapText;
-import com.jme3.material.Material;
-import com.jme3.math.ColorRGBA;
-import com.jme3.math.Vector3f;
-import com.jme3.renderer.ViewPort;
-import com.jme3.scene.Geometry;
-import com.jme3.scene.Node;
-import com.jme3.scene.shape.Box;
-
-/**
- * A template how to create an Application State. This example state simply
- * changes the background color depending on the camera position.
- */
-public class GameRunningState extends AbstractAppState {
-
-  private ViewPort viewPort;
-  private Node rootNode;
-  private Node guiNode;
-  private AssetManager assetManager;
-  private Node localRootNode = new Node("Game Screen RootNode");
-  private Node localGuiNode = new Node("Game Screen GuiNode");
-  private final ColorRGBA backgroundColor = ColorRGBA.Blue;
-
-  public GameRunningState(SimpleApplication app){
-    this.rootNode     = app.getRootNode();
-    this.viewPort      = app.getViewPort();
-    this.guiNode       = app.getGuiNode();
-    this.assetManager  = app.getAssetManager();  
-  }
-
-  @Override
-  public void initialize(AppStateManager stateManager, Application app) {
-    super.initialize(stateManager, app);
-
-    /** Load this scene */
-    viewPort.setBackgroundColor(backgroundColor);
-
-    Box mesh = new Box(Vector3f.ZERO, 1, 1, 1);
-    Geometry geom = new Geometry("Box", mesh);
-    Material mat = new Material(assetManager,
-            "Common/MatDefs/Misc/Unshaded.j3md");
-    mat.setColor("Color", ColorRGBA.Green);
-    geom.setMaterial(mat);
-    geom.setLocalTranslation(1, 0, 0);
-    localRootNode.attachChild(geom);
-
-    /** Load the HUD*/
-    BitmapFont guiFont = assetManager.loadFont(
-            "Interface/Fonts/Default.fnt");
-    BitmapText displaytext = new BitmapText(guiFont);
-    displaytext.setSize(guiFont.getCharSet().getRenderedSize());
-    displaytext.move(10, displaytext.getLineHeight() + 20, 0);
-    displaytext.setText("Game running. Press BACKSPACE to pause and return to the start screen.");
-    localGuiNode.attachChild(displaytext);
-  }
-
-  @Override
-  public void update(float tpf) {
-    /** the action happens here */
-    Vector3f v = viewPort.getCamera().getLocation();
-    viewPort.setBackgroundColor(new ColorRGBA(v.getX() / 10, v.getY() / 10, v.getZ() / 10, 1));
-    rootNode.getChild("Box").rotate(tpf, tpf, tpf);
-  }
-  
-  @Override
-  public void stateAttached(AppStateManager stateManager) {
-    rootNode.attachChild(localRootNode);
-    guiNode.attachChild(localGuiNode);
-    viewPort.setBackgroundColor(backgroundColor);
-  }
-
-  @Override
-  public void stateDetached(AppStateManager stateManager) {
-    rootNode.detachChild(localRootNode);
-    guiNode.detachChild(localGuiNode);
-
-  }
-
-}
-
-----
-
-
-=== SettingsScreenState.java
-
-[source,java]
-----
-
-package chapter04.appstatedemo;
-
-import com.jme3.app.Application;
-import com.jme3.app.SimpleApplication;
-import com.jme3.app.state.AbstractAppState;
-import com.jme3.app.state.AppStateManager;
-import com.jme3.asset.AssetManager;
-import com.jme3.font.BitmapFont;
-import com.jme3.font.BitmapText;
-import com.jme3.material.Material;
-import com.jme3.math.ColorRGBA;
-import com.jme3.math.Vector3f;
-import com.jme3.renderer.ViewPort;
-import com.jme3.scene.Geometry;
-import com.jme3.scene.Node;
-import com.jme3.scene.shape.Box;
-
-/**
- * A template how to create an Application State. This example state simply
- * changes the background color depending on the camera position.
- */
-public class SettingsScreenState extends AbstractAppState {
-
-  private ViewPort viewPort;
-  private Node rootNode;
-  private Node guiNode;
-  private AssetManager assetManager;
-  private Node localRootNode = new Node("Settings Screen RootNode");
-  private Node localGuiNode = new Node("Settings Screen GuiNode");
-  private final ColorRGBA backgroundColor = ColorRGBA.DarkGray;
-
-  public SettingsScreenState(SimpleApplication app) {
-    this.rootNode     = app.getRootNode();
-    this.viewPort      = app.getViewPort();
-    this.guiNode       = app.getGuiNode();
-    this.assetManager  = app.getAssetManager();
-  }
-
-  @Override
-  public void initialize(AppStateManager stateManager, Application app) {
-    super.initialize(stateManager, app);
-
-    /** Load this scene */
-    viewPort.setBackgroundColor(backgroundColor);
-
-    Box mesh = new Box(new Vector3f(-1, -1, 0), .5f, .5f, .5f);
-    Geometry geom = new Geometry("Box", mesh);
-    Material mat = new Material(assetManager,
-            "Common/MatDefs/Misc/Unshaded.j3md");
-    mat.setColor("Color", ColorRGBA.Red);
-    geom.setMaterial(mat);
-    geom.setLocalTranslation(1, 0, 0);
-    localRootNode.attachChild(geom);
-
-    /** Load the HUD */
-    BitmapFont guiFont = assetManager.loadFont(
-            "Interface/Fonts/Default.fnt");
-    BitmapText displaytext = new BitmapText(guiFont);
-    displaytext.setSize(guiFont.getCharSet().getRenderedSize());
-    displaytext.move(10, displaytext.getLineHeight() + 20, 0);
-    displaytext.setText("Settings screen. Press RETURN to save "
-            + "and return to start screen.");
-    localGuiNode.attachChild(displaytext);
-  }
-
-  @Override
-  public void update(float tpf) {
-     /** the action happens here */
-  }
-
-  @Override
-  public void stateAttached(AppStateManager stateManager) {
-    rootNode.attachChild(localRootNode);
-    guiNode.attachChild(localGuiNode);
-    viewPort.setBackgroundColor(backgroundColor);
-  }
-
-  @Override
-  public void stateDetached(AppStateManager stateManager) {
-    rootNode.detachChild(localRootNode);
-    guiNode.detachChild(localGuiNode);
-  }
-  
-}
-
-----
-
-
-=== StartScreenState.java
-
-[source,java]
-----
-
-package chapter04.appstatedemo;
-
-import com.jme3.app.Application;
-import com.jme3.app.SimpleApplication;
-import com.jme3.app.state.AbstractAppState;
-import com.jme3.app.state.AppStateManager;
-import com.jme3.asset.AssetManager;
-import com.jme3.font.BitmapFont;
-import com.jme3.font.BitmapText;
-import com.jme3.material.Material;
-import com.jme3.math.ColorRGBA;
-import com.jme3.math.Vector3f;
-import com.jme3.renderer.ViewPort;
-import com.jme3.scene.Geometry;
-import com.jme3.scene.Node;
-import com.jme3.scene.shape.Box;
-
-/**
- * A template how to create an Application State. This example state simply
- * changes the background color depending on the camera position.
- */
-public class StartScreenState extends AbstractAppState {
-
-  private ViewPort viewPort;
-  private Node rootNode;
-  private Node guiNode;
-  private AssetManager assetManager;
-  private Node localRootNode = new Node("Start Screen RootNode");
-  private Node localGuiNode = new Node("Start Screen GuiNode");
-  private final ColorRGBA backgroundColor = ColorRGBA.Gray;  
-
-public StartScreenState(SimpleApplication app){
-    this.rootNode     = app.getRootNode();
-    this.viewPort     = app.getViewPort();
-    this.guiNode      = app.getGuiNode();
-    this.assetManager = app.getAssetManager();  
-  }
-
-  @Override
-  public void initialize(AppStateManager stateManager, Application app) {
-    super.initialize(stateManager, app);
-    
-    /** Init this scene */
-    viewPort.setBackgroundColor(backgroundColor);
-
-    Box mesh = new Box(new Vector3f(-1,1,0), .5f,.5f,.5f);
-    Geometry geom = new Geometry("Box", mesh);
-    Material mat = new Material(assetManager,
-            "Common/MatDefs/Misc/Unshaded.j3md");
-    mat.setColor("Color", ColorRGBA.Yellow);
-    geom.setMaterial(mat);
-    geom.setLocalTranslation(1, 0, 0);
-    localRootNode.attachChild(geom);
-
-    /** Load a HUD */
-    BitmapFont guiFont = assetManager.loadFont(
-            "Interface/Fonts/Default.fnt");
-    BitmapText displaytext = new BitmapText(guiFont);
-    displaytext.setSize(guiFont.getCharSet().getRenderedSize());
-    displaytext.move( 10, displaytext.getLineHeight() + 20,  0);
-    displaytext.setText("Start screen. Press BACKSPACE to resume the game, "
-            + "press RETURN to edit Settings.");
-    localGuiNode.attachChild(displaytext);
-  }
-
-  @Override
-  public void update(float tpf) {
-    /** the action happens here */
-  }
-
-  @Override
-  public void stateAttached(AppStateManager stateManager) {
-    rootNode.attachChild(localRootNode);
-    guiNode.attachChild(localGuiNode);
-    viewPort.setBackgroundColor(backgroundColor);
-  }
-
-  @Override
-  public void stateDetached(AppStateManager stateManager) {
-    rootNode.detachChild(localRootNode);
-    guiNode.detachChild(localGuiNode);
-  }
-  
-}
-
-----

+ 0 - 75
src/docs/asciidoc/jme3/blendswaparcade.adoc

@@ -1,75 +0,0 @@
-= blendswaparcade
-:author:
-:revnumber:
-:revdate: 2016/03/17 20:48
-:relfileprefix: ../
-:imagesdir: ..
-ifdef::env-github,env-browser[:outfilesuffix: .adoc]
-
-
-
-== Blendswap Arcade Game Contest
-
-The Blendswap Arcade contest is a game making contest where all entries must use the same scene from Blendswap. All participants have a week to create their game. It is currently planned to be a monthly contest.
-
-
-== Rules
-
-The rules are:
-
-....
-  You may use or even make other assets, but;
-      You may NOT extend the confines of the game level.
-  You may use any existing open source code, including your own.
-  The scene does not in any way dictate the gameplay.
-  The game must be completely open source and made freely available through a code repository like GitHub upon completion.
-  Game submission must be an executable, preferably fully functional on all PC platforms.
-....
-
-Game entries are judged on:
-
-....
-  Utilization – Appropriate & innovative use of the scene.
-  Completion – Completeness of the game: Keep it simple!
-....
-
-
-== Blendswap Arcade Contest 19.05-27.05
-
-This was the first Blendswap arcade contest. It used this model:
-
-link:http://www.blendswap.com[image:http://www.blendswap.com/files/images/2013/11/image71013/medium_3e019da3883e2c06c67553532695f0ac.jpg[medium_3e019da3883e2c06c67553532695f0ac.jpg,width="",height=""]]
-
-link:http://www.blendswap.com/blends/view/71013[http://www.blendswap.com/blends/view/71013]
-
-
-=== Entries
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-exterminator/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-exterminator/]
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-the-climb/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-the-climb/]
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-marbleway/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-marbleway/]
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-shadow-unit/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-shadow-unit/]
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-fire-department/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-fire-department/]
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-hostage/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-hostage/]
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-ponyrescue/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-ponyrescue/]
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-airrace/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-airrace/]
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-meta-aware/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-meta-aware/]
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-corporate-window-washer-strike-force/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-corporate-window-washer-strike-force/]
-
-link:http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-catch-the-chickens/[http://hub.jmonkeyengine.org/forum/topic/blendswap-arcade-submission-catch-the-chickens/]
-
-The entries in this list may not include all entries. It was not required to make a forum page.
-
-
-=== Winners
-
-link:http://hub.jmonkeyengine.org/2014/09/blendswap-arcade-at-long-last-we-have-a-final-verdict/[http://hub.jmonkeyengine.org/2014/09/blendswap-arcade-at-long-last-we-have-a-final-verdict/]

+ 1 - 1
src/docs/asciidoc/jme3/contributions.adoc

@@ -18,7 +18,6 @@ To install a jMonkeyEngine SDK plugin, go to `menu:Tools[Plugins>Available Plugi
 ====
 
 
-
 == Github Repo
 
 This is the main repository for jmonkey contributions:
@@ -49,6 +48,7 @@ There are other repositories for code sources. A list of weblinks follows:
 
 These are premade classes/functionalities that you can use.
 
+CAUTION: These contributions are developed by jMonkeyEngine users and aren't officially supported by jMonkeyEngine. As such, these projects and the supporting documentation may become stale over time as the contributors lose interest.
 
 === ImagePainter
 

+ 0 - 134
src/docs/asciidoc/jme3/hardware_compatibility_list.adoc

@@ -1,134 +0,0 @@
-= hardware_compatibility_list
-:author: 
-:revnumber: 
-:revdate: 2016/03/17 20:48
-:relfileprefix: ../
-:imagesdir: ..
-ifdef::env-github,env-browser[:outfilesuffix: .adoc]
-
-
-+
-
-emoji: *Please expand this list!*
-I've copied this page from the original jME2 hardware compatibility list and will work on getting this up to date for jME3 -Skye
-
-+
-This page lists the compatibility of various different graphic cards and the latest version of jME3
-
-To fill in a new entry add the name of your graphics card in the first column (Card Name), which driver version the card is running on in the second column (Driver Version).  Then put a 'Y' for yes and a 'N' for no in the next three columns as to whether your card supports the given feature.
-
-*  Basic Features should be considered things like rendering primitive shapes and models fully textured and lit. 
-*  Advanced Features should be considered things like Render to Texture and Cloth effects.
-*  Shader Features should be anything that uses shaders such as Bloom and Motion Blur.
-
-
-== General System Requirements for Applications Built with jMonkeyEngine
-
-Please see <<jme3/requirements#,requirements>>
-+
-For a detailed list of Graphic Card/Driver combinations and which OpenGL features they support see +++<strike>link:http://www.delphi3d.net/hardware/index.php[http://www.delphi3d.net/hardware/index.php]</strike>+++ link:http://www.opengl.org/wiki/Hardware_specifics[http://www.opengl.org/wiki/Hardware_specifics]
-
-
-=== ATI/AMD
-[cols="6", options="header"]
-|===
-
-a| Card Name 
-a| Driver Version 
-a| Basic Features? 
-a| Advanced Features (No Shader)? 
-a| Shader Features? 
-a| Notes 
-
-a| Radeon HD 4850 512MB 
-a| 11.8 running on Linux Mint 12 x64+11.12 running on Windows 7 Professional x64
-a|Y
-a|Y
-a|Y
-a|All tests works fine.
-
-a| Radeon HD 5850 1GB 
-a| 11.12 running on Windows 7 Professional x64 
-a|Y
-a|Y
-a|Y
-a|All tests works fine.
-
-a| Radeon HD 6900 2GB 
-a| 11.5 running on Windows 7 x64 
-a|Y
-a|Y
-a|Y
-a|All tests works fine.
-
-|===
-
-
-=== Intel
-[cols="6", options="header"]
-|===
-
-a| Card Name 
-a| Driver Version 
-a| Basic Features? 
-a| Advanced Features (No Shader)? 
-a| Shader Features? 
-a| Notes 
-
-a|Intel GMA 950 
-a| Mac +++<abbr title="Operating System">OS</abbr>+++ X 10.5 
-a|Y
-a|Y
-a|N
-a|Works in OpenGL1 compatibility mode.
-
-|===
-
-
-=== NVidia
-[cols="6", options="header"]
-|===
-
-a| Card Name 
-a| Driver Version 
-a| Basic Features? 
-a| Advanced Features (No Shader)? 
-a| Shader Features? 
-a| Notes 
-
-a|NVidia GeForce GT330M 512M 
-a| Mac +++<abbr title="Operating System">OS</abbr>+++ X 10.7.2 
-a|Y
-a|Y
-a|Y
-a|All tests works fine.
-
-a|NVidia GeForce GT540M 1024M 
-a| Windows 7 280.26 
-a|Y
-a|Y
-a|Y
-a|All tests works fine.
-
-a|NVidia GeForce GTX480 1536M 
-a| Windows 7 285.62 
-a|Y
-a|Y
-a|Y
-a|All tests works fine.
-
-|===
-
-
-=== SiS
-[cols="6", options="header"]
-|===
-
-a| Card Name 
-a| Driver Version 
-a| Basic Features? 
-a| Advanced Features (No Shader)? 
-a| Shader Features? 
-a| Notes 
-
-|===

+ 0 - 28
src/docs/asciidoc/jme3/intermediate/rolling_madness.adoc

@@ -1,28 +0,0 @@
-= PGI's Rolling Tracks
-:author:
-:revnumber:
-:revdate: 2016/03/17 20:48
-:keywords: game, intermediate
-:relfileprefix: ../../
-:imagesdir: ../..
-ifdef::env-github,env-browser[:outfilesuffix: .adoc]
-
-
-
-[IMPORTANT]
-====
-This article uses outdated jME3 +++<abbr title="Application Programming Interface">API</abbr>+++, check the main <<jme3#,jME3 tutorials page>> for up to date examples!
-====
-
-
-image::jme3/rolling-madness.png[Rolling Madness,width="324",height="254",align="right"]
-
-
-In this intermediate article, PGI explains the workflow of how he created a game with jME3. He covers model creation and loading, physics (collision detection), game logic, game stages, input management, audio, effects, and a custom UI solution. The article contains annotated code samples and many screenshots.
-
-.  link:http://www.tukano.it/rollingtracks/rolling_tracks_0.2.zip[Download the sample game] and try it
-.  How was it done? Download and read the tutorial: +link:http://www.tukano.it/documents/rollmadness.pdf[rollmadness.pdf] or +link:http://www.tukano.it/documents/rollmadness.odt[rollmadness.odt]
-
-In the game, you are a pilot speeding down a crazy winding rollercoaster track! Your goal is to stay on the track and shoot as many targets as you can.
-
-Back to <<jme3#,jME3 Tutorials>>

+ 0 - 59
src/docs/asciidoc/jme3/materials.adoc

@@ -1,59 +0,0 @@
-= JME3 Documentation: Materials
-:author: 
-:revnumber: 
-:revdate: 2016/03/17 20:48
-:relfileprefix: ../
-:imagesdir: ..
-ifdef::env-github,env-browser[:outfilesuffix: .adoc]
-
-
-Work in progress. :)
-[cols="2", options="header"]
-|===
-
-<a| Default Definition                       
-a| Usage 
-
-a| `Common/MatDefs/Misc/SimpleTextured.j3md` 
-a| Textured: Use with mat.setTexture() and TextureKey 
-
-<a| `Common/MatDefs/Misc/SolidColor.j3md`     
-a| Colored: Use with mat.setColor() and RGBAColor 
-
-<a| `Common/MatDefs/Misc/Sky.j3md`            
-a| A solid skyblue. Or use with custom texture. 
-
-<a| `Common/MatDefs/Misc/WireColor.j3md`      
-a| Transparent, show only outline 
-
-<a| `Common/MatDefs/Misc/Particle.j3md`       
-<a|  
-
-<a| `Common/MatDefs/Misc/ShowNormals.j3md`    
-a| Shows a color gradient calculated from surface normals. 
-
-<a| `Common/MatDefs/Misc/VertexColor.j3md`    
-a| 
-
-<a| `Common/MatDefs/Gui/Gui.j3md`             
-a| 
-
-<a| `Common/MatDefs/Hdr/LogLum.j3md`          
-a| 
-
-<a| `Common/MatDefs/Hdr/ToneMap.j3md`         
-a| 
-
-<a| `Common/MatDefs/Light/Lighting.j3md`      
-a| For texture lighting effects like Bump- and NormalMaps
-
-<a| `Common/MatDefs/Light/Reflection.j3md`    
-a| 
-
-<a| `Common/MatDefs/Shadow/PostShadow.j3md`   
-a| 
-
-<a| `Common/MatDefs/Shadow/PreShadow.j3md`    
-a| 
-
-|===

+ 0 - 486
src/docs/asciidoc/jme3/user_examples/thirdpersoncamera.adoc

@@ -1,486 +0,0 @@
-= User Example: Third Person Camera
-:author:
-:revnumber:
-:revdate: 2016/03/17 20:48
-:relfileprefix: ../../
-:imagesdir: ../..
-ifdef::env-github,env-browser[:outfilesuffix: .adoc]
-
-
-image:jme3/user_examples/thirdpersoncamera/3p.png[3p.png,width="",height=""]
-
-(by Berzee) (see a video demonstration here: link:https://www.youtube.com/watch?v=phu52hmIoYU[https://www.youtube.com/watch?v=phu52hmIoYU])
-
-Here is a small example of a self-contained Third Person Character (with camera). It uses the familiar Green Ninja model to demonstrate the following controls and animations:
-
-*  “WASD movement
-*  “SPACE to jump
-*  Horizontal mouse movement to turn left and right
-*  Vertical mouselook (camera pivots around character)
-*  Left Mouse Button to attack
-
-To try this example for yourself, you can copy the classes from this page. Then you will be able to create a Third-Person Character in your apps like so:
-
-[source,java]
-----
-
-player = new ThirdPersonPlayerNode(playerModel, inputManager, cam);
-rootNode.attachChild(player);
-bulletAppState.getPhysicsSpace().add(player);
-
-//make sure to call "player.update()" in the app's update method, too
-
-----
-
-
-== How the mouselook works
-
-Most of the code in the example files should be relatively self-explanatory, but mouselook deserves a lovely pictograph of its own. It's easy to make <<jme3/advanced/making_the_camera_follow_a_character#,a camera that follows an object and always looks at the back of it>>, and thus it's easy to account for horizontal mouse movement by simple rotating the entire Player character left or right.
-
-But what if we want to be able to move the camera angle up or down, while the Player stays firmly upright? We can accomplish this with minimal Horrible Maths by adding an invisible “pivot node to the Player, and instructing the camera to follow that “pivot instead. Then we can independently rotate the *pivot* instead of the Player, and do things like this:
-
-image:jme3/user_examples/thirdpersoncamera/pivot2.png[pivot2.png,width="",height=""]
-
-Now you know the mystical secrets, and are ready to see the code itself.
-
-
-== Source Code
-
-
-=== ThirdPersonPlayerNode.java
-
-ThirdPersonPlayerNode.java contains the bulk of the logic for keyboard, mouse, physics, and animation. Most of this is lifted straight from the Tutorials for Beginners and can safely be ignored. However, pay particular attention to the “onAnalog() method – that's where all of the mouse movement is processed to turn the player left and right, and the camera up and down.
-
-[source,java]
-----
-
-package mygame;
-
-import com.jme3.animation.AnimChannel;
-import com.jme3.animation.AnimControl;
-import com.jme3.animation.AnimEventListener;
-import com.jme3.animation.LoopMode;
-import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
-import com.jme3.bullet.control.CharacterControl;
-import com.jme3.input.InputManager;
-import com.jme3.input.KeyInput;
-import com.jme3.input.MouseInput;
-import com.jme3.input.controls.ActionListener;
-import com.jme3.input.controls.AnalogListener;
-import com.jme3.input.controls.KeyTrigger;
-import com.jme3.input.controls.MouseAxisTrigger;
-import com.jme3.input.controls.MouseButtonTrigger;
-import com.jme3.math.FastMath;
-import com.jme3.math.Quaternion;
-import com.jme3.math.Vector3f;
-import com.jme3.renderer.Camera;
-import com.jme3.scene.Node;
-import com.jme3.scene.Spatial;
-
-/**
- *
- * @author Berzee
- */
-public class ThirdPersonPlayerNode extends Node implements ActionListener, AnalogListener, AnimEventListener
-{
-    //ThirdPersonCameraNode automatically sets itself up to follow a target
-    //object. Check the "onAnalog" function here to see how we do mouselook.
-    private ThirdPersonCamera camera;
-    private Camera cam;
-
-    private Spatial model;
-    private CharacterControl characterControl;
-    private AnimChannel animChannel;
-    private AnimControl animControl;
-    private InputManager inputManager;
-    private Vector3f walkDirection = new Vector3f();
-
-    private boolean left = false;
-    private boolean right = false;
-    private boolean up = false;
-    private boolean down = false;
-    private boolean attack;
-    private boolean attacking;
-
-    //These can all be changed according to your whims.
-    private float walkSpeed = .15f;
-    private float mouselookSpeed = FastMath.PI;
-    private float jumpSpeed = 15;
-    private float fallSpeed = 20;
-    private float gravity = 25;
-    private float stepSize = .05f;
-
-    //Animation names. These are currently set up for the Ninja.mesh.xml from
-    //jme3-test-data.jar (to add that jar to your project, right-click on
-    //Libraries in the SDK project explorer, click "Add Library" and choose
-    //jme3-test-data.jar from the menu).
-    //
-    //Alternatively, use any model you like and change these animation names
-    //as needed.
-    private String idleAnim = "Idle1";
-    private String walkAnim = "Walk";
-    private String attackAnim = "Attack3";
-    private String jumpAnim = "Climb"; //hilarious
-
-    public ThirdPersonPlayerNode(Spatial model, InputManager inputManager, Camera cam)
-    {
-	super();
-	this.cam = cam;
-	camera = new ThirdPersonCamera("CamNode", cam, this);
-
-        this.model = model;
-	this.model.scale(.01f); //Ninja.mesh.xml-specific scale stuff
-	this.model.setLocalTranslation(0f, -1f, 0f); //Ninja-specific
-	this.attachChild(this.model);
-
-	CapsuleCollisionShape playerShape = new CapsuleCollisionShape(.5f,1f); //Ninja-specific
-	characterControl = new CharacterControl(playerShape, stepSize);
-	characterControl.setJumpSpeed(jumpSpeed);
-	characterControl.setFallSpeed(fallSpeed);
-	characterControl.setGravity(gravity);
-	this.addControl(characterControl);
-
-	animControl = model.getControl(AnimControl.class);
-	animControl.addListener(this);
-	animChannel = animControl.createChannel();
-	animChannel.setAnim(idleAnim);
-
-	this.inputManager = inputManager;
-	setUpKeys();
-    }
-
-    //Make sure to call this from the main simpleUpdate() loop
-    public void update()
-    {
-	Vector3f camDir = cam.getDirection().clone();
-	camDir.y = 0;
-	Vector3f camLeft = cam.getLeft().clone();
-	camLeft.y = 0;
-	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()); }
-
-	characterControl.setWalkDirection(walkDirection.normalize().multLocal(walkSpeed));
-
-	handleAnimations();
-    }
-
-    private void handleAnimations()
-    {
-	if(attacking)
-	{
-	    //waiting for attack animation to finish
-	}
-	else if(attack)
-	{
-
-	    animChannel.setAnim(attackAnim,.3f);
-	    animChannel.setLoopMode(LoopMode.DontLoop);
-	    attack = false;
-	    attacking = true;
-	}
-	else if(characterControl.onGround())
-	{
-	    if(left || right || up || down)
-	    {
-		if(!animChannel.getAnimationName().equals(walkAnim))
-		{
-		    animChannel.setAnim(walkAnim,.3f);
-		    animChannel.setLoopMode(LoopMode.Loop);
-		}
-	    }
-	    else
-	    {
-		if(!animChannel.getAnimationName().equals(idleAnim))
-		{
-		    animChannel.setAnim(idleAnim,.3f);
-		    animChannel.setLoopMode(LoopMode.Cycle);
-		}
-	    }
-	}
-    }
-
-    private void setUpKeys()
-    {
-	inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_A));
-	inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_D));
-	inputManager.addMapping("Up", new KeyTrigger(KeyInput.KEY_W));
-	inputManager.addMapping("Down", new KeyTrigger(KeyInput.KEY_S));
-	inputManager.addMapping("Jump", new KeyTrigger(KeyInput.KEY_SPACE));
-	inputManager.addMapping("Attack", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
-	inputManager.addMapping("TurnLeft", new MouseAxisTrigger(MouseInput.AXIS_X,true));
-	inputManager.addMapping("TurnRight", new MouseAxisTrigger(MouseInput.AXIS_X,false));
-	inputManager.addMapping("MouselookDown", new MouseAxisTrigger(MouseInput.AXIS_Y,true));
-	inputManager.addMapping("MouselookUp", new MouseAxisTrigger(MouseInput.AXIS_Y,false));
-	inputManager.addListener(this, "Left");
-	inputManager.addListener(this, "Right");
-	inputManager.addListener(this, "Up");
-	inputManager.addListener(this, "Down");
-	inputManager.addListener(this, "Jump");
-	inputManager.addListener(this, "Attack");
-	inputManager.addListener(this, "TurnLeft");
-	inputManager.addListener(this, "TurnRight");
-	inputManager.addListener(this, "MouselookDown");
-	inputManager.addListener(this, "MouselookUp");
-    }
-
-    public void onAction(String binding, boolean value, float tpf) {
-	if (binding.equals("Left"))
-	{
-	    left = value;
-	}
-	else if (binding.equals("Right"))
-	{
-	    right = value;
-	}
-	else if (binding.equals("Up"))
-	{
-	    up = value;
-	}
-	else if (binding.equals("Down"))
-	{
-	    down = value;
-	}
-	else if (binding.equals("Jump"))
-	{
-	    if(characterControl.onGround())
-	    {
-		characterControl.jump();
-		if(!attacking)
-		{
-		    animChannel.setAnim(jumpAnim,.3f);
-		    animChannel.setLoopMode(LoopMode.Loop);
-		}
-	    }
-	}
-	else if (binding.equals("Attack"))
-	{
-	    attack = value;
-	}
-    }
-
-    //Analog handler for mouse movement events.
-    //It is assumed that we want horizontal movements to turn the character,
-    //while vertical movements only make the camera rotate up or down.
-    public void onAnalog(String binding, float value, float tpf)
-    {
-	if (binding.equals("TurnLeft"))
-	{
-	    Quaternion turn = new Quaternion();
-	    turn.fromAngleAxis(mouselookSpeed*value, Vector3f.UNIT_Y);
-	    characterControl.setViewDirection(turn.mult(characterControl.getViewDirection()));
-	}
-	else if (binding.equals("TurnRight"))
-	{
-	    Quaternion turn = new Quaternion();
-	    turn.fromAngleAxis(-mouselookSpeed*value, Vector3f.UNIT_Y);
-	    characterControl.setViewDirection(turn.mult(characterControl.getViewDirection()));
-	}
-	else if (binding.equals("MouselookDown"))
-	{
-	    camera.verticalRotate(mouselookSpeed*value);
-	}
-	else if (binding.equals("MouselookUp"))
-	{
-	    camera.verticalRotate(-mouselookSpeed*value);
-	}
-    }
-
-    public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName)
-    {
-	if(channel == animChannel && attacking && animName.equals(attackAnim))
-	{
-	    attacking = false;
-	}
-    }
-
-    public void onAnimChange(AnimControl control, AnimChannel channel, String animName)
-    {
-    }
-
-    public CharacterControl getCharacterControl()
-    {
-	return characterControl;
-    }
-
-    public ThirdPersonCamera getCameraNode()
-    {
-	return camera;
-    }
-}
-
-----
-
-
-=== ThirdPersonCamera.java
-
-ThirdPersonCamera.java sets up a CameraNode to follow behind the player. It uses the same “ControlDirection.SpatialToCamera approach as <<jme3/advanced/making_the_camera_follow_a_character#,the advanced tutorial about 3rd-person cameras>>, but also adds a pivot node for easy mouselook. (See the scientific diagram above, and the comments in the class, for more explanation).
-
-[source,java]
-----
-
-package mygame;
-
-import com.jme3.math.FastMath;
-import com.jme3.math.Vector3f;
-import com.jme3.renderer.Camera;
-import com.jme3.scene.CameraNode;
-import com.jme3.scene.Node;
-import com.jme3.scene.control.CameraControl;
-
-/**
- *
- * @author Berzee
- */
-public class ThirdPersonCamera
-{
-    //The "pivot" Node allows for easy third-person mouselook! It's actually
-    //just an empty Node that gets attached to the center of the Player.
-    //
-    //The CameraNode is set up to always position itself behind the *pivot*
-    //instead of behind the Player. So when we want to mouselook around the
-    //Player, we simply need to spin the pivot! The camera will orbit behind it
-    //while the Player object remains still.
-    //
-    //NOTE: Currently only vertical mouselook (around the X axis) is working.
-    //The other two axes could be added fairly easily, once you have an idea
-    //for how they should actually behave (min and max angles, et cetera).
-    private Node pivot;
-    private CameraNode cameraNode;
-
-    //Change these as you desire. Lower verticalAngle values will put the camera
-    //closer to the ground.
-    public float followDistance = 7;
-    public float verticalAngle = 30 * FastMath.DEG_TO_RAD;
-
-    //These bounds keep the camera from spinning too far and clipping through
-    //the floor or turning upside-down. You can change them as needed but it is
-    //recommended to keep the values in the (-90,90) range.
-    public float maxVerticalAngle = 85 * FastMath.DEG_TO_RAD;
-    public float minVerticalAngle = 5 * FastMath.DEG_TO_RAD;
-
-    public ThirdPersonCamera(String name, Camera cam, Node player)
-    {
-	pivot = new Node("CamTrack");
-	player.attachChild(pivot);
-
-	cameraNode = new CameraNode(name, cam);
-        cameraNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
-	pivot.attachChild(cameraNode);
-	cameraNode.setLocalTranslation(new Vector3f(0, 0, followDistance));
-	cameraNode.lookAt(pivot.getLocalTranslation(), Vector3f.UNIT_Y);
-
-	pivot.getLocalRotation().fromAngleAxis(-verticalAngle, Vector3f.UNIT_X);
-    }
-
-    public void verticalRotate(float angle)
-    {
-	verticalAngle += angle;
-
-	if(verticalAngle > maxVerticalAngle)
-	{
-	    verticalAngle = maxVerticalAngle;
-	}
-	else if(verticalAngle < minVerticalAngle)
-	{
-	    verticalAngle = minVerticalAngle;
-	}
-
-	pivot.getLocalRotation().fromAngleAxis(-verticalAngle, Vector3f.UNIT_X);
-    }
-
-    public CameraNode getCameraNode()
-    {
-	return cameraNode;
-    }
-
-    public Node getCameraTrack()
-    {
-	return pivot;
-    }
-}
-
-----
-
-
-=== Main.java
-
-Here is an example Main.java project that you can use to see the ThirdPersonPlayerNode in action. Just make sure to add the jme3-test-data.jar library to your project so it can access the Ninja model and ManyLights scene (In the SDK: Project Explorer → Right Click on “Libraries → Add Library → jme3-test-data.jar).
-
-[source,java]
-----
-
-package mygame;
-
-import com.jme3.app.SimpleApplication;
-import com.jme3.bullet.BulletAppState;
-import com.jme3.bullet.collision.shapes.CollisionShape;
-import com.jme3.bullet.control.RigidBodyControl;
-import com.jme3.bullet.util.CollisionShapeFactory;
-import com.jme3.light.DirectionalLight;
-import com.jme3.renderer.RenderManager;
-import com.jme3.scene.Spatial;
-import com.jme3.math.Vector3f;
-import com.jme3.scene.Node;
-
-/**
- * @author Berzee
- */
-public class Main extends SimpleApplication
-{
-    private Spatial sceneModel;
-    private RigidBodyControl scene;
-    private BulletAppState bulletAppState;
-    private ThirdPersonPlayerNode player;
-
-    public static void main(String[] args) {
-        Main app = new Main();
-        app.start();
-    }
-
-    @Override
-    public void simpleInitApp() {
-        mouseInput.setCursorVisible(false);
-	flyCam.setEnabled(false);
-
-	bulletAppState = new BulletAppState();
-	stateManager.attach(bulletAppState);
-	//bulletAppState.getPhysicsSpace().enableDebug(assetManager);
-
-        sceneModel = assetManager.loadModel("Scenes/ManyLights/Main.scene");
-	sceneModel.scale(1f,.5f,1f); //Make scenery short enough to jump on. =P
-	CollisionShape sceneShape = CollisionShapeFactory.createMeshShape((Node) sceneModel);
-	scene = new RigidBodyControl(sceneShape, 0);
-	sceneModel.addControl(scene);
-        rootNode.attachChild(sceneModel);
-	bulletAppState.getPhysicsSpace().add(scene);
-
-	Spatial playerModel = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");
-	player = new ThirdPersonPlayerNode(playerModel, inputManager, cam);
-	player.getCharacterControl().setPhysicsLocation(new Vector3f(-5f,2f,5f));
-	rootNode.attachChild(player);
-	bulletAppState.getPhysicsSpace().add(player);
-
-        // You must add a light to make the model visible
-        DirectionalLight sun = new DirectionalLight();
-        sun.setDirection(new Vector3f(-.1f, -.7f, -1f));
-        rootNode.addLight(sun);
-    }
-
-    @Override
-    public void simpleUpdate(float tpf)
-    {
-	player.update();
-    }
-
-    @Override
-    public void simpleRender(RenderManager rm)
-    {
-        //TODO: add render code
-    }
-}
-
-----

BIN
src/docs/images/jme3/rolling-madness.png