|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimbad.sim.World
public class World
Represents a 3d world - this class use intensively JAVA3D. It creates the scenegraph and the view platform. The building process uses a EnvironmentDescription object containing colors , objects and attributes given by the user. This class is thighly coupled with Simulator Class. Remember to call System.setProperty("j3d.implicitAntialiasing", "true") at the very beginning of your program in order to enable antialiasing.
Field Summary | |
---|---|
private javax.media.j3d.AmbientLight |
ambientLight
|
(package private) javax.vecmath.Color3f |
black
|
private javax.media.j3d.Canvas3D |
canvas3d
The main canvas for viewing the world. |
private javax.media.j3d.Light |
light1
|
private javax.media.j3d.Light |
light2
|
(package private) MouseOrbiter |
mouseOrbiter
For managing the mouse mouvement in the Canvas3D |
private javax.media.j3d.BranchGroup |
pickableSceneBranch
All the pickable/collidable objects should be attached under this sub-branch |
private javax.media.j3d.BranchGroup |
sceneBranch
The content branch. |
private javax.media.j3d.TransformGroup |
sceneRot
The base rotation of the sceneBranch. |
private javax.media.j3d.TransformGroup |
sceneTrans
The base translation of the sceneBranch. |
private boolean |
show3d
|
(package private) javax.media.j3d.VirtualUniverse |
universe
J3D universe |
private javax.media.j3d.View |
view
|
static int |
VIEW_ABOVE_AGENT
|
static int |
VIEW_ABOVE_AGENT_NEAR
|
static int |
VIEW_AGENT_SIDE
|
static int |
VIEW_BEHIND_AGENT
|
static int |
VIEW_FROM_EAST
|
static int |
VIEW_FROM_TOP
|
private javax.media.j3d.BranchGroup |
viewBranch
The view branch |
private javax.media.j3d.ViewPlatform |
viewPlatform
|
private javax.media.j3d.TransformGroup |
viewTransformGroup
|
(package private) javax.vecmath.Color3f |
white
Prepared colors. |
protected float |
worldSize
The size of the square containing the world |
Constructor Summary | |
---|---|
World(EnvironmentDescription ed)
Construct a World from a given EnvironmentDescription. |
|
World(EnvironmentDescription ed,
boolean display3d)
Construct a World from a given EnvironmentDescription. |
Method Summary | |
---|---|
(package private) javax.media.j3d.Light |
addLight(javax.vecmath.Vector3d pos,
javax.vecmath.Color3f color)
Add a light to the 3d world. |
void |
addObjectToPickableSceneBranch(BaseObject obj3d)
Adds a 3D object to the world. |
void |
attach(BaseObject obj3d)
attach a 3d object to the scenegraph. |
void |
changeViewPoint(int type,
SimpleAgent agent)
Change the user view Point . |
(package private) boolean |
checkCollisionAgainstBlockWorldObjects(javax.media.j3d.BoundingSphere bs)
|
private void |
create(EnvironmentDescription ed)
Creates the world from the given environement Description. |
private void |
createAxis()
Creates a representation of the 3 axis of the 3d world. |
private void |
createCanvas3D()
Creates the Canvas3D to visualize the 3D World. |
private void |
createFloor(EnvironmentDescription wd)
Creates the floor of the 3d world. |
private void |
createSceneBranch(EnvironmentDescription wd)
Creates the branch for the visible content of the scenegraph. |
private void |
createUniverse(EnvironmentDescription ed)
Creates the universe to attach the scenegraph. |
void |
detach(BaseObject obj3d)
Detach a previously attached object from the scenegraph. |
void |
dispose()
Destroy the java3d graph |
javax.media.j3d.Canvas3D |
getCanvas3D()
|
(package private) javax.media.j3d.BranchGroup |
getPickableSceneBranch()
|
void |
renderOnce()
Do one rendering on main canvas 3D . |
void |
startRendering()
Restart rendering on main canvas 3D . |
void |
stopRendering()
Stop rendering on main canvas 3D . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
javax.media.j3d.VirtualUniverse universe
private javax.media.j3d.BranchGroup sceneBranch
private javax.media.j3d.TransformGroup sceneTrans
private javax.media.j3d.TransformGroup sceneRot
private javax.media.j3d.BranchGroup pickableSceneBranch
private javax.media.j3d.BranchGroup viewBranch
private javax.media.j3d.TransformGroup viewTransformGroup
private javax.media.j3d.ViewPlatform viewPlatform
private javax.media.j3d.View view
private javax.media.j3d.Canvas3D canvas3d
private boolean show3d
MouseOrbiter mouseOrbiter
private javax.media.j3d.AmbientLight ambientLight
private javax.media.j3d.Light light1
private javax.media.j3d.Light light2
public static final int VIEW_FROM_TOP
public static final int VIEW_FROM_EAST
public static final int VIEW_BEHIND_AGENT
public static final int VIEW_ABOVE_AGENT
public static final int VIEW_ABOVE_AGENT_NEAR
public static final int VIEW_AGENT_SIDE
protected float worldSize
javax.vecmath.Color3f white
javax.vecmath.Color3f black
Constructor Detail |
---|
public World(EnvironmentDescription ed)
public World(EnvironmentDescription ed, boolean display3d)
Method Detail |
---|
private void create(EnvironmentDescription ed)
ed
- the environment description.private void createUniverse(EnvironmentDescription ed)
ed
- the environment description.private void createCanvas3D()
public void addObjectToPickableSceneBranch(BaseObject obj3d)
public void detach(BaseObject obj3d)
public void attach(BaseObject obj3d)
javax.media.j3d.Light addLight(javax.vecmath.Vector3d pos, javax.vecmath.Color3f color)
private void createSceneBranch(EnvironmentDescription wd)
private void createFloor(EnvironmentDescription wd)
ed
- the environment description.private void createAxis()
public void changeViewPoint(int type, SimpleAgent agent)
type
- can be VIEW_FROM_TOP,VIEW_FROM_EAST,VIEW_BEHIND_AGENTagent
- : specify the agent if VIEW_BEHIND_AGENT
The VIEW_BEHIND_AGENT case has to be called regularly because of the agent
displacement.boolean checkCollisionAgainstBlockWorldObjects(javax.media.j3d.BoundingSphere bs)
public void stopRendering()
public void startRendering()
public void renderOnce()
public void dispose()
public javax.media.j3d.Canvas3D getCanvas3D()
javax.media.j3d.BranchGroup getPickableSceneBranch()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |