|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme3.app.Application
env3d.EnvBasic
public class EnvBasic
Env stands for environment and is the entry point to interface with the opengl engine class. This class is written to provide students with a way to access a virtual environment. Students can put any arbitrary objects into this world. This class make exclusive use of reflection so that any object can be added without the object having to extend another class or implement an interface. This makes teaching introduction courses much easier as students do not have to be exposed to the idea of inheritance right away. This class also provide a way to access to the camera as well as access the keyboard.
Field Summary | |
---|---|
protected java.util.HashMap<java.lang.String,com.jme3.audio.AudioNode> |
audioMap
|
protected EnvCamera |
flyCam
|
protected com.jme3.font.BitmapFont |
guiFont
|
protected com.jme3.scene.Node |
guiNode
|
protected boolean |
init
|
protected java.util.HashMap<java.lang.String,java.lang.Object> |
internalObjects
|
protected java.util.HashMap<java.lang.Object,GameObjectAdapter> |
objectsMap
|
protected RoomAdapter |
roomObject
|
protected com.jme3.scene.Node |
rootNode
|
protected com.jme3.scene.Node |
statusNode
|
protected com.jme3.font.BitmapText |
statusText
|
protected float |
tpf
|
Fields inherited from class com.jme3.app.Application |
---|
assetManager, audioRenderer, cam, context, guiViewPort, inputEnabled, inputManager, joyInput, keyInput, listener, mouseInput, paused, pauseOnFocus, renderer, renderManager, settings, speed, stateManager, timer, touchInput, viewPort |
Constructor Summary | |
---|---|
EnvBasic()
Create an environment. |
|
EnvBasic(boolean defaultControl)
Creates a 3d environment. |
Method Summary | ||
---|---|---|
void |
addObject(java.lang.Object obj)
Add an object to the environment |
|
void |
destroy()
|
|
void |
disableLighting()
Disable light effect |
|
void |
enableLighting()
Enable the lighting effect. |
|
void |
exit()
Exit the program cleanly. |
|
double |
getCameraPitch()
Get the pitch (up and down) angle of the camera, in degrees. |
|
double |
getCameraX()
|
|
double |
getCameraY()
|
|
double |
getCameraYaw()
Get the yaw (up and down) angle of the camera, in degrees. |
|
double |
getCameraZ()
|
|
de.lessvoid.nifty.Nifty |
getNiftyGUI()
Returns the nifty gui object for GUI programming |
|
|
getObject(java.lang.Class<T> c)
Returns the first object that matches class c |
|
java.util.Collection |
getObjects()
Get all the objects that has been added to the environment |
|
|
getObjects(java.lang.Class<T> c)
Returns all objects of class c |
|
java.lang.Object |
getPick(int x,
int y)
Get the closest object that is under the current mouse position. |
|
java.util.List<EnvPickResult> |
getPickList(int x,
int y)
|
|
EnvRay |
getPickRay(int x,
int y)
|
|
com.jme3.scene.Node |
getRootNode()
Returns the root node of the underlying scene graph. |
|
double |
getVolume()
Get the current sound level |
|
void |
initialize()
|
|
boolean |
isDefaultControl()
|
|
boolean |
isLightingEnabled()
Check if lighting is enabled or not |
|
void |
removeObject(java.lang.Object obj)
Removes an object from the environment |
|
void |
setCameraPitch(double angle)
Sets the camera pitch (up and down) in degrees in relation to the default camera orientation (0, 0, -1) |
|
void |
setCameraXYZ(double x,
double y,
double z)
Put the camera at a particular location in 3D space. |
|
void |
setCameraYaw(double angle)
Sets the camera yaw (left and right) in degrees in relation to the default camera orientation (0, 0, -1) |
|
void |
setDefaultControl(boolean firstPersonControl)
Activate the first person control scheme. |
|
void |
setDisplayStr(java.lang.String displayStr)
Display a string in the middle of the screen |
|
void |
setDisplayStr(java.lang.String displayStr,
int x,
int y)
Puts a string at a particular location on screen |
|
void |
setDisplayStr(java.lang.String displayStr,
int x,
int y,
double size,
double r,
double g,
double b,
double a)
Put a string in a particular location on screen. |
|
void |
setRoom(java.lang.Object o)
Sets the current room. |
|
void |
setShowStatus(boolean show)
Show the current fps (frames per second) on screen |
|
void |
setVolume(double level)
Sets the current sound level |
|
void |
soundLoad(java.lang.String soundFile)
Load sound into memory |
|
void |
soundLoop(java.lang.String soundFile)
Loop a sound file. |
|
void |
soundPlay(java.lang.String soundFile)
Play a sound file without position. |
|
void |
soundPlay(java.lang.String soundFile,
double x,
double y,
double z,
double cutoff_distance)
Play a sound file at a particular location |
|
void |
soundStop(java.lang.String soundFile)
Stop a sound file. |
|
void |
start(com.jme3.system.JmeContext.Type contextType)
|
|
void |
update()
|
Methods inherited from class com.jme3.app.Application |
---|
createCanvas, destroyInput, enqueue, gainFocus, getAssetManager, getAudioRenderer, getCamera, getContext, getGuiViewPort, getInputManager, getListener, getRenderer, getRenderManager, getStateManager, getTimer, getViewPort, handleError, isPauseOnLostFocus, loseFocus, requestClose, reshape, restart, runQueuedTasks, setAssetManager, setPauseOnLostFocus, setSettings, setTimer, start, startCanvas, startCanvas, stop, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean init
protected com.jme3.scene.Node rootNode
protected com.jme3.scene.Node guiNode
protected com.jme3.scene.Node statusNode
protected com.jme3.font.BitmapFont guiFont
protected float tpf
protected java.util.HashMap<java.lang.Object,GameObjectAdapter> objectsMap
protected java.util.HashMap<java.lang.String,java.lang.Object> internalObjects
protected java.util.HashMap<java.lang.String,com.jme3.audio.AudioNode> audioMap
protected RoomAdapter roomObject
protected EnvCamera flyCam
protected com.jme3.font.BitmapText statusText
Constructor Detail |
---|
public EnvBasic()
public EnvBasic(boolean defaultControl)
defaultControl
- true to grab the mouse, false to release the mouseMethod Detail |
---|
public void addObject(java.lang.Object obj)
obj
- public void removeObject(java.lang.Object obj)
obj
- public java.util.Collection getObjects()
public <T> java.util.Collection<T> getObjects(java.lang.Class<T> c)
T
- c
-
public <T> T getObject(java.lang.Class<T> c)
T
- c
-
public void setRoom(java.lang.Object o)
o
- the room objectpublic void setCameraXYZ(double x, double y, double z)
x
- x coordinate of the cameray
- y coordinate of the cameraz
- z coordinate of the camerapublic double getCameraX()
public double getCameraY()
public double getCameraZ()
public double getCameraPitch()
public double getCameraYaw()
public void setCameraPitch(double angle)
angle
- the angle to set the pitch to, in degreespublic void setCameraYaw(double angle)
angle
- the angle to set the pitch to, in degreespublic void setDisplayStr(java.lang.String displayStr, int x, int y, double size, double r, double g, double b, double a)
displayStr
- x
- x location of the screen (2D)y
- y location of the screen (2D)size
- the size of the fontr
- red component. Value from 0 - 1.g
- green component. Value from 0 - 1.b
- blue component. Value from 0 - 1.a
- alpha component. Value from 0 - 1. 0 is invisible. 1 is opaque.public void setDisplayStr(java.lang.String displayStr, int x, int y)
displayStr
- x
- y
- setDisplayStr(java.lang.String, int, int, double, double, double, double, double)
public void setDisplayStr(java.lang.String displayStr)
displayStr
- setDisplayStr(java.lang.String, int, int, double, double, double, double, double)
public void setShowStatus(boolean show)
show
- true to show fps, false to hide it.public void setDefaultControl(boolean firstPersonControl)
firstPersonControl
- true to enable first person control, false to
disable it.public boolean isDefaultControl()
public double getVolume()
public void setVolume(double level)
level
- a number between 0 and 1.public void soundPlay(java.lang.String soundFile, double x, double y, double z, double cutoff_distance)
soundFile
- the file to playx
- x location of the soundy
- y location of the soundz
- z location of the soundcutoff_distance
- the distance in which sound will be cut offpublic void soundPlay(java.lang.String soundFile)
soundFile
- public void soundLoop(java.lang.String soundFile)
soundFile
- public void soundStop(java.lang.String soundFile)
soundFile
- public void soundLoad(java.lang.String soundFile)
soundFile
- the file to loadpublic java.lang.Object getPick(int x, int y)
public java.util.List<EnvPickResult> getPickList(int x, int y)
public EnvRay getPickRay(int x, int y)
public void enableLighting()
public void disableLighting()
public boolean isLightingEnabled()
public com.jme3.scene.Node getRootNode()
public de.lessvoid.nifty.Nifty getNiftyGUI()
public void exit()
public void start(com.jme3.system.JmeContext.Type contextType)
start
in class com.jme3.app.Application
public void initialize()
initialize
in interface com.jme3.system.SystemListener
initialize
in class com.jme3.app.Application
public void update()
update
in interface com.jme3.system.SystemListener
update
in class com.jme3.app.Application
public void destroy()
destroy
in interface com.jme3.system.SystemListener
destroy
in class com.jme3.app.Application
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |