public abstract class AbstractApplication
extends com.jme3.app.SimpleApplication
Constructor and Description |
---|
AbstractApplication()
The default constructor.
|
AbstractApplication(com.jme3.app.state.AppState... initialStates)
Initializes the application with the specified AppStates.
|
Modifier and Type | Method and Description |
---|---|
void |
addMaterial(java.lang.String key,
com.jme3.material.Material material)
Adds a Material to the PlantApplication for later reuse.
|
com.jme3.material.Material |
createBasicMaterial(com.jme3.math.ColorRGBA color)
Generates a new, basic Material for use in the jME3 app.
|
com.jme3.material.Material |
createLitMaterial(com.jme3.math.ColorRGBA color)
Generates a new, basic material for use in the jME3 app.
|
com.jme3.collision.CollisionResults |
getCollision(com.jme3.collision.Collidable collidable,
com.jme3.math.Ray ray)
Gets a
CollisionResults between a Collidable and a
Ray . |
com.jme3.math.Ray |
getCrosshairRay()
Gets a Ray from the crosshair's location to the grid.
|
com.jme3.math.Ray |
getCursorRay()
Gets a Ray from the camera to the cursor.
|
com.jme3.math.Ray |
getCursorRayFromClick()
Gets a Ray from the camera to the cursor.
|
boolean |
getDisplayAxes()
A flag to indicate whether or not to show lines representing the x, y,
and z axes at the origin (of jME3 space).
|
boolean |
getDisplayHUD()
This operation returns the value of the boolean flag for whether or not
the heads-up display should be displayed.
|
com.jme3.material.Material |
getMaterial(java.lang.String key)
Gets the Material stored in the PlantApplication for reuse.
|
boolean |
isInitialized()
Whether or not the AbstractApplication is initialized.
|
void |
printCollisionResults(com.jme3.collision.CollisionResults results)
Prints out a CollisionResults Collection for debugging/diagnosis.
|
com.jme3.material.Material |
removeMaterial(java.lang.String key)
Removes a Material from the PlantApplication.
|
void |
setAwtPanel(com.jme3.system.awt.AwtPanel panel)
Sets the AwtPanel used to render the scene in the AWT Frame embedded in
SWT through the SWT_AWT bridge.
|
void |
setDisplayAxes(boolean enabled)
Sets whether or not to show the axes representing the unit vectors for x,
y, and z.
|
void |
setDisplayHUD(boolean enabled)
This operation sets the boolean to display or hide the heads-up display.
|
void |
simpleInitApp()
Overrides the method from the jME3 SimpleApplication to initialize the
scene, camera, etc.
|
void |
simpleUpdate(float tpf)
Does nothing by default.
|
getFlyByCamera, getGuiNode, getRootNode, initialize, isShowSettings, setDisplayFps, setDisplayStatView, setShowSettings, simpleRender, start, update
createCanvas, destroy, enqueue, gainFocus, getAssetManager, getAudioRenderer, getCamera, getContext, getGuiViewPort, getInputManager, getListener, getRenderer, getRenderManager, getStateManager, getTimer, getViewPort, handleError, isPauseOnLostFocus, loseFocus, requestClose, reshape, restart, setAssetManager, setPauseOnLostFocus, setSettings, setTimer, start, startCanvas, startCanvas, stop, stop
public AbstractApplication()
public AbstractApplication(com.jme3.app.state.AppState... initialStates)
initialStates
- The initial AppStates. Custom AppStates should extend
AbstractAppState.public final boolean isInitialized()
public final void setAwtPanel(com.jme3.system.awt.AwtPanel panel)
panel
- The AwtPanel that is used in lieu of an AWT Canvas.public void simpleInitApp()
Overrides the method from the jME3 SimpleApplication to initialize the scene, camera, etc. This is called automatically at the start of the jME3 application. It is recommended that this method not be overridden.
simpleInitApp
in class com.jme3.app.SimpleApplication
public void simpleUpdate(float tpf)
simpleUpdate
in class com.jme3.app.SimpleApplication
public com.jme3.material.Material getMaterial(java.lang.String key)
key
- The key associated with the material.public void addMaterial(java.lang.String key, com.jme3.material.Material material)
key
- The key to use for the Material. If this is the same as a
previous key, the value will be overwritten.material
- The Material to store for later reuse.public com.jme3.material.Material removeMaterial(java.lang.String key)
key
- The key of the Material to remove.public boolean getDisplayHUD()
public void setDisplayHUD(boolean enabled)
enabled
- The boolean value to indicate whether or not the HUD should be
displayed.public boolean getDisplayAxes()
public void setDisplayAxes(boolean enabled)
public com.jme3.material.Material createBasicMaterial(com.jme3.math.ColorRGBA color)
color
- The color of the material.public com.jme3.material.Material createLitMaterial(com.jme3.math.ColorRGBA color)
color
- The color of the material.public com.jme3.collision.CollisionResults getCollision(com.jme3.collision.Collidable collidable, com.jme3.math.Ray ray)
CollisionResults
between a Collidable
and a
Ray
. Collidables like Spatials and Nodes can be tested for
collisions with Rays (usually from getCrosshairRay()
and
getCursorRay()
.collidable
- The object we are trying to hit.ray
- A ray that is being cast at the collidable.public com.jme3.math.Ray getCrosshairRay()
public com.jme3.math.Ray getCursorRay()
Use this method when getting the cursor's location after a mouse-move
event. For mouse-click events, use getCursorRayFromClick()
.
public com.jme3.math.Ray getCursorRayFromClick()
During click events, jME3 calculates the 2D cursor position as
Y-decreasing from top to bottom. Use this method when getting the
cursor's location after a mouse-click event. For mouse-move events, use
getCursorRay()
.
public void printCollisionResults(com.jme3.collision.CollisionResults results)
results
- A CollisionResults Collection to print out.