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 TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

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 addSector(E3DSector sector)
          Add a sector to this world with a unique name sectorID
 E3DActor getActor(java.lang.String 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()
           
 E3DSector getSector(java.lang.String sectorID)
          Gets the sector in this world that was keyed off sectorID
 java.util.HashMap getSectorMap()
           
 int getTextureIDByName(java.lang.String textureName)
           
 java.util.HashMap getTextureMap()
           
 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)
           
 void loadWorld(java.lang.String mapFileName)
           
 void removeAllSectors()
          Remove all the sectors from the world
 void removePreloadedActor(java.lang.String actorsNameInMapfile)
          Remove a preloaded actor from the world.
 void removeSector(java.lang.String sectorID)
          Remove a sector from this world
 void renderAtPosition(E3DVector3F atPosition)
          Render this world at the position.
 void setSectorMap(java.util.HashMap sectorMap)
           
 
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

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
Throws:
E3DMissingEngineException
E3DInvalidFileFormatException
java.io.IOException

loadWorld

public void loadWorld(java.lang.String mapFileName)
               throws E3DMissingEngineException,
                      java.lang.Exception
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)

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

getTextureMap

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

getTextureIDByName

public int getTextureIDByName(java.lang.String textureName)

renderAtPosition

public void renderAtPosition(E3DVector3F atPosition)
Render this world at the position. This is handled by the engine's rendering loop normally.

Specified by:
renderAtPosition in class E3DRenderable

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 -

getWorldID

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