espresso3d.engine
Class E3DEngine

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.E3DEngine

public final class E3DEngine
extends E3DRenderable

Author:
espresso3d This is the main class for espresso3d. The engine does all of the work.

Constructor Summary
E3DEngine()
           
 
Method Summary
 void addExternalRenderable(E3DRenderable renderableItem, int timeoutFrames)
          This adds an E3DRenderable item to the ExternalRenderable list.
 void addViewport(E3DViewport viewport)
          Add a new viewport to the list of viewports
 void addWorld(E3DWorld world)
          Add a world to the engines world list
 void changeScreenResolution(int width, int height, int bitsPerPixel, boolean fullscreen, java.lang.String windowTitle)
          change the screen resolution
 void checkInput()
           
 E3DCollisionDetect getCollisionDetect()
           
 E3DFPSTimer getFpsTimer()
          Returns the timer the engine uses to get its FPS.
 E3DInputHandler getInputHandler()
           
 java.util.HashMap getTextureMap()
          Builds a textureMap out of all the texture sets in all the worlds If two worlds have the same entry name, the textureID used for the last checked world is used.
 E3DViewport getViewport(java.lang.String viewportID)
           
 int getWindowHeight()
           
 java.lang.String getWindowTitle()
           
 int getWindowWidth()
           
 java.lang.String getWorkingDirectory()
          grabs the current working directory WITHOUT trailing slashes
 E3DWorld getWorld(java.lang.String worldID)
          Get a world from the map of worlds by its ID
 java.util.HashMap getWorldMap()
           
 void initEngine(int width, int height, int bitsPerPixel, boolean fullscreen, java.lang.String windowTitle)
          Create window and initialize OpenGL
 boolean isRenderNormals()
           
 boolean isRunning()
           
 void removeAllViewports()
          Remove all viewports from the engine
 void removeAllWorlds()
          Remove all the worlds in the engine.
 void removeViewport(java.lang.String viewportID)
          Remove a viewport with viewportID from the engine
 void removeWorld(java.lang.String worldID)
          Remove a world from the engine's world list
 void renderAtPosition(E3DVector3F atPosition)
           
 void setDisplayingFPS(boolean displayingFPS)
          Set whether the engine should display the FPS time or not.
 void setInputHandler(E3DInputHandler inputHandler)
           
 void setRenderNormals(boolean renderNormals)
           
 void setRunning(boolean running)
           
 void setWindowTitle(java.lang.String windowTitle)
           
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
render
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

E3DEngine

public E3DEngine()
Method Detail

getTextureMap

public java.util.HashMap getTextureMap()
Builds a textureMap out of all the texture sets in all the worlds If two worlds have the same entry name, the textureID used for the last checked world is used.

Returns:

getWorkingDirectory

public java.lang.String getWorkingDirectory()
grabs the current working directory WITHOUT trailing slashes

Returns:

initEngine

public void initEngine(int width,
                       int height,
                       int bitsPerPixel,
                       boolean fullscreen,
                       java.lang.String windowTitle)
                throws E3DInvalidDisplayModeException,
                       org.lwjgl.LWJGLException
Create window and initialize OpenGL

Throws:
E3DInvalidDisplayModeException
org.lwjgl.LWJGLException

changeScreenResolution

public void changeScreenResolution(int width,
                                   int height,
                                   int bitsPerPixel,
                                   boolean fullscreen,
                                   java.lang.String windowTitle)
change the screen resolution


addWorld

public void addWorld(E3DWorld world)
Add a world to the engines world list


removeWorld

public void removeWorld(java.lang.String worldID)
Remove a world from the engine's world list

Returns:

removeAllWorlds

public void removeAllWorlds()
Remove all the worlds in the engine.


getWorld

public E3DWorld getWorld(java.lang.String worldID)
Get a world from the map of worlds by its ID

Parameters:
worldID -
Returns:

getWorldMap

public java.util.HashMap getWorldMap()
Returns:
Returns the worldMap.

renderAtPosition

public void renderAtPosition(E3DVector3F atPosition)
Specified by:
renderAtPosition in class E3DRenderable

checkInput

public void checkInput()
                throws E3DMissingInputHandlerException
Throws:
E3DMissingInputHandlerException

setInputHandler

public void setInputHandler(E3DInputHandler inputHandler)
Parameters:
inputHandler - The inputHandler to set.

getInputHandler

public E3DInputHandler getInputHandler()
Returns:
Returns the inputHandler.

isRunning

public boolean isRunning()
Returns:
Returns whether the engine is running

setRunning

public void setRunning(boolean running)
Parameters:
running - Set the engines running state

getCollisionDetect

public E3DCollisionDetect getCollisionDetect()
Returns:
Returns the engine's CollisionDetect used for determining collisions

isRenderNormals

public boolean isRenderNormals()
Returns:
This is a debug flag that when set to true, the normals of the world and objects will be rendered.

setRenderNormals

public void setRenderNormals(boolean renderNormals)

addExternalRenderable

public void addExternalRenderable(E3DRenderable renderableItem,
                                  int timeoutFrames)
This adds an E3DRenderable item to the ExternalRenderable list. All E3DRenderables in this list will be rendered after the main rendering hierarchy is rendered (world, actors, etc). Each item on the list will be rendered for the # of frames passed in This is very useful for debugging (adding CMLines to the rendering loop to see direction vectors and things) It could even potentially be used to plug in your rendering algorithm. as timeoutFrames

Parameters:
renderableItem - An E3DRenderable item that you want to render outside of the optimized rendering loop.
timeoutFrames - How many frames to render this renderable for

setDisplayingFPS

public void setDisplayingFPS(boolean displayingFPS)
Set whether the engine should display the FPS time or not. Currently it shows the FPS in the window's title.

Parameters:
displayingFPS -

getWindowTitle

public java.lang.String getWindowTitle()
Returns:
Returns the windowTitle.

setWindowTitle

public void setWindowTitle(java.lang.String windowTitle)
Parameters:
windowTitle - The windowTitle to set.

getViewport

public E3DViewport getViewport(java.lang.String viewportID)

addViewport

public void addViewport(E3DViewport viewport)
Add a new viewport to the list of viewports

Parameters:
viewport -

removeViewport

public void removeViewport(java.lang.String viewportID)
Remove a viewport with viewportID from the engine

Parameters:
viewportID -

removeAllViewports

public void removeAllViewports()
Remove all viewports from the engine


getWindowWidth

public int getWindowWidth()
Returns:

getWindowHeight

public int getWindowHeight()
Returns:
Returns the height.

getFpsTimer

public E3DFPSTimer getFpsTimer()
Returns the timer the engine uses to get its FPS.

Returns: