espresso3d.engine.world
Class E3DWorld

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.world.E3DWorld

public class E3DWorld
extends E3DRenderable

Author:
espresso3d A world is the largest grouping for a portal engine. The engine can have several worlds, but only 1 world will be rendered at a time.

Field Summary
 
Fields inherited from class espresso3d.engine.renderer.base.E3DRenderable
RENDERMODE_SOLID, RENDERMODE_TEXTURED, RENDERMODE_WIREFRAME
 
Constructor Summary
E3DWorld(E3DEngine engine, java.lang.String worldID)
           
 
Method Summary
 void addPreloadedActor(java.lang.String actorsNameInMapfile, E3DActor actor)
          This preloads actors into the world, so when the world's map is loaded, it will be able to also add the actors defined in the mapfile
 void addPreloadedParticleSystem(java.lang.String particleSystemsNameInMapfile, E3DParticleSystem particleSystem)
          This preloads particlesystems into the world, so when the world's map is loaded, it will be able to also add the actors defined in the mapfile
 void addSector(E3DSector sector)
          Add a sector to this world with a unique name sectorID
 E3DActor getActor(java.lang.String actorID)
          Get an actor that is in the world by its actorID.
 java.util.HashMap getActorMap()
          Traverses all sectors in the world and generates a map of all the actors.
 java.util.HashMap getLightMap()
          Returns all the lights in all the sectors of the world Rendering should use a lower level approach at this (like just getting lights out of the sector) If lights have the same ID, the last one read will be used (the others overwritten in this map0
 java.util.HashMap getPreloadedActorMap()
           
 java.util.HashMap getPreloadedParticleSystemMap()
          Return a hashmap of particle systems that have been preloaded into the world.
 E3DSector getSector(java.lang.String sectorID)
          Gets the sector in this world that was keyed off sectorID
 java.util.HashMap getSectorMap()
           
 E3DSkyObject getSkyObject()
           
 E3DTexture getTexture(java.lang.String textureName)
          Return the E3DTexture that is loaded in a textureSet and named textureName
 int getTextureIDByName(java.lang.String textureName)
          Get an already loaded texture's GL textureID by its aliased name.
 java.util.HashMap getTextureSet()
           
 java.util.ArrayList getTriangleList()
          Get all the triangles taht are in the world.
 java.lang.String getWorldID()
           
 void loadTextureSet(java.lang.String textureSetFileName, boolean fromJar)
          Load a texture set into the world to be used by actors, worlds, particles, etc.
 void loadWorld(java.lang.String mapFileName, boolean fromJar)
          Load a map's geometry into the world
 void removeAllPreloadedActors()
          Remove all the preloaded actors from the world
 void removeAllPreloadParticleSystems()
          Remove all the preloaded particle systems from the world
 void removeAllSectors()
          Remove all the sectors from the world
 void removePreloadedActor(java.lang.String actorsNameInMapfile)
          Remove a preloaded actor from the world.
 void removePreloadedParticleSystem(java.lang.String partcleSystemsNameInMapfile)
          Remove a preloaded particleSystem from the world.
 void removeSector(java.lang.String sectorID)
          Remove a sector from this world
 void renderAtPosition(E3DVector3F position)
           
 void renderAtPosition(E3DVector3F atPosition, E3DViewport currentViewport)
          Render this world at the position into the currentViewport
 void setSectorMap(java.util.HashMap sectorMap)
           
 void setSkyObject(E3DSkyObject skyObject)
           
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
getRenderableOptionsKey, getRenderMode, initCorrectGeometryRenderer, render, setRenderMode
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

E3DWorld

public E3DWorld(E3DEngine engine,
                java.lang.String worldID)
Method Detail

loadTextureSet

public void loadTextureSet(java.lang.String textureSetFileName,
                           boolean fromJar)
                    throws E3DMissingEngineException,
                           E3DInvalidFileFormatException,
                           java.io.IOException
Load a texture set into the world to be used by actors, worlds, particles, etc. This is usually only necessary if preloading of actors/particle systems is necessary. Otherwise, normal loading of actors and maps will load a texture set automatically.

Parameters:
textureSetFileName -
fromJar - Set to true if textureset is packaged in a JAR file
Throws:
E3DMissingEngineException
E3DInvalidFileFormatException
java.io.IOException

loadWorld

public void loadWorld(java.lang.String mapFileName,
                      boolean fromJar)
               throws E3DMissingEngineException,
                      java.lang.Exception
Load a map's geometry into the world

Parameters:
mapFileName -
fromJar - Set to true if the mapfile is packaged within a JAR file
Throws:
E3DMissingEngineException
java.lang.Exception

addSector

public void addSector(E3DSector sector)
Add a sector to this world with a unique name sectorID

Parameters:
sector -

removeSector

public void removeSector(java.lang.String sectorID)
Remove a sector from this world

Parameters:
sectorID -
Returns:

removeAllSectors

public void removeAllSectors()
Remove all the sectors from the world


getActor

public E3DActor getActor(java.lang.String actorID)
Get an actor that is in the world by its actorID. This will look in all sectors of the world for the actor.

Parameters:
actorID -
Returns:

getActorMap

public java.util.HashMap getActorMap()
Traverses all sectors in the world and generates a map of all the actors. If there are actors in two different sectors that have the same actorID, the last encountered will be used with all previous actors with that id being overwritten in this map. World's do not have a list already built of actors, so it has to be built on the fly and is therefore not the fastest way at getting to an actor. This probably shouldn't be used if at all possible, and actors should be accessed from their parent sector that they are native to.

Returns:
Returns the actorMap of all E3DActor objects in all sectors of this world keyed off the String actorID

getSectorMap

public java.util.HashMap getSectorMap()
Returns:
Returns the sectorMap.

setSectorMap

public void setSectorMap(java.util.HashMap sectorMap)
Parameters:
sectorMap - The sectorMap to set.

getSector

public E3DSector getSector(java.lang.String sectorID)
Gets the sector in this world that was keyed off sectorID

Parameters:
sectorID -
Returns:
Returns the sector or null if it was not found

getTextureSet

public java.util.HashMap getTextureSet()
Returns:
Returns the world's textureMap.

getTextureIDByName

public int getTextureIDByName(java.lang.String textureName)
Get an already loaded texture's GL textureID by its aliased name.

Parameters:
textureName -
Returns:

getTexture

public E3DTexture getTexture(java.lang.String textureName)
Return the E3DTexture that is loaded in a textureSet and named textureName

Parameters:
textureName - The name of the texture in the textureMap
Returns:
the E3DTexture if loaded, otherwise null

renderAtPosition

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

renderAtPosition

public void renderAtPosition(E3DVector3F atPosition,
                             E3DViewport currentViewport)
Render this world at the position into the currentViewport


getTriangleList

public java.util.ArrayList getTriangleList()
Get all the triangles taht are in the world. This means it gets all the triangles out of all the sectors and all the actors in all the sectors world. Rendering should use a lower level approach at this (like just getting triangles out of the sector)

Returns:
ArrayList of E3DTriangle objects or null if none exist.

getLightMap

public java.util.HashMap getLightMap()
Returns all the lights in all the sectors of the world Rendering should use a lower level approach at this (like just getting lights out of the sector) If lights have the same ID, the last one read will be used (the others overwritten in this map0

Returns:
ArrayList of E3DLight objects or null if none exist

getPreloadedActorMap

public java.util.HashMap getPreloadedActorMap()
Returns:
Returns the preloadedActorMap.

addPreloadedActor

public void addPreloadedActor(java.lang.String actorsNameInMapfile,
                              E3DActor actor)
This preloads actors into the world, so when the world's map is loaded, it will be able to also add the actors defined in the mapfile

Parameters:
actorsNameInMapfile - This is what the actor is called in the mapfile
actor - This is the actual actors object.

removePreloadedActor

public void removePreloadedActor(java.lang.String actorsNameInMapfile)
Remove a preloaded actor from the world. It will no longer be accessible during map loading.

Parameters:
actorsNameInMapfile -

removeAllPreloadedActors

public void removeAllPreloadedActors()
Remove all the preloaded actors from the world


addPreloadedParticleSystem

public void addPreloadedParticleSystem(java.lang.String particleSystemsNameInMapfile,
                                       E3DParticleSystem particleSystem)
This preloads particlesystems into the world, so when the world's map is loaded, it will be able to also add the actors defined in the mapfile

Parameters:
particleSystemsNameInMapfile - This is what the particleSystem is called in the mapfile
particleSystem - This is the actual particleSystem's object.

removePreloadedParticleSystem

public void removePreloadedParticleSystem(java.lang.String partcleSystemsNameInMapfile)
Remove a preloaded particleSystem from the world. It will no longer be accessible during map loading.


removeAllPreloadParticleSystems

public void removeAllPreloadParticleSystems()
Remove all the preloaded particle systems from the world


getWorldID

public java.lang.String getWorldID()
Returns:
Returns the worldID.

getPreloadedParticleSystemMap

public java.util.HashMap getPreloadedParticleSystemMap()
Return a hashmap of particle systems that have been preloaded into the world.

Returns:

getSkyObject

public E3DSkyObject getSkyObject()

setSkyObject

public void setSkyObject(E3DSkyObject skyObject)