JSR-184 Public Review Draft - Apr. 30, 2003.

javax.microedition.m3d
Class World

java.lang.Object
  |
  +--javax.microedition.m3d.Object3D
        |
        +--javax.microedition.m3d.Node
              |
              +--javax.microedition.m3d.Group
                    |
                    +--javax.microedition.m3d.World

public class World
extends Group

A top-level container for scene graphs. The scene graph is constructed from a hierarchy of nodes. In a valid scene graph, all nodes are ultimately connected to each other via a common root, which is a World node. An example scene graph is shown in the figure below.

Despite that it is called a graph, the scene graph is actually a tree structure. This implies that a node can belong to at most one group at a time, and cycles are prohibited. Furthermore, a World node cannot belong to any group. However, component objects may be referenced by an arbitrary number of nodes and components. The rules for building valid scene graph structures are summarized below.

Even though World is a scene graph node, its special role as the singular root node has two noteworthy consequences. Firstly, a World cannot be inserted into any Group; this is enforced with an exception. Secondly, the node transformation is ignored for World objects. The transformation can be set, animated, and queried, but it has no effect on anything.

The method Graphics3D.render(World) renders a World as observed by its currently active camera. If there is no active camera, rendering of that World is disabled. Note, however, that the corresponding render methods for Groups and Meshes can still be used to render individual branches of that World.

See Also:
Binary format

Field Summary
 
Fields inherited from class javax.microedition.m3d.Node
NONE, ORIGIN, X_AXIS, Y_AXIS, Z_AXIS
 
Fields inherited from class javax.microedition.m3d.Object3D
userObject
 
Constructor Summary
World()
          Creates an empty World with default values.
 
Method Summary
 Camera getActiveCamera()
          Gets the currently active camera.
 int getAmbientLight()
          Retrieves the current ambient light color of this World.
 Background getBackground()
          Retrieves the background settings of this World.
 void setActiveCamera(Camera camera)
          Sets the Camera to use when rendering this World.
 void setAmbientLight(int RGB)
          Sets the ambient light intensity for this World.
 void setBackground(Background background)
          Sets the Background object for this World.
 
Methods inherited from class javax.microedition.m3d.Group
addChild, getChild, getChildCount, pick, removeChild
 
Methods inherited from class javax.microedition.m3d.Node
getAlphaFactor, getOrientation, getParent, getScale, getScopeID, getTransform, getTransformTo, getTranslation, isEnabled, setAlignment, setAlphaFactor, setEnable, setOrientation, setScale, setScopeID, setTransform, setTranslation
 
Methods inherited from class javax.microedition.m3d.Object3D
addAnimationTrack, animate, clone, find, getAnimationTrack, getAnimationTrackCount, getReferences, getUserID, removeAnimationTrack, setUserID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

World

public World()

Creates an empty World with default values. The default values are:

Method Detail

setBackground

public void setBackground(Background background)

Sets the Background object for this World. The background is used for clearing the color buffer prior to rendering the World when Graphics3D.render(World) is called. If there is no Background object, the depth buffer is cleared as usual, but the color buffer is not cleared at all.

Parameters:
background - attributes for clearing the color buffer; null to not clear the color buffer at all
See Also:
getBackground()

getBackground

public Background getBackground()

Retrieves the background settings of this World.

Returns:
the current attributes for clearing the color buffer
See Also:
setBackground(javax.microedition.m3d.Background)

setActiveCamera

public void setActiveCamera(Camera camera)

Sets the Camera to use when rendering this World. If the camera is not in this world, its position in this world is defined by its node transformation. The node transformations of its ancestors, if any, are ignored. Rendering of this World can be disabled by setting the active camera to null.

Parameters:
camera - the Camera object to set as the active camera
See Also:
getActiveCamera()

getActiveCamera

public Camera getActiveCamera()

Gets the currently active camera.

Returns:
the camera that is currently used to render this World, or null
See Also:
setActiveCamera(javax.microedition.m3d.Camera)

setAmbientLight

public void setAmbientLight(int RGB)

Sets the ambient light intensity for this World. The high order byte of the color value is ignored.

Parameters:
RGB - the new global ambient color in 0x00RRGGBB format
See Also:
getAmbientLight

getAmbientLight

public int getAmbientLight()

Retrieves the current ambient light color of this World.

Returns:
the ambient color in 0x00RRGGBB format
See Also:
setAmbientLight

JSR-184 Public Review Draft - Apr. 30, 2003.

Copyright © 2003 Nokia Corporation. See the Copyright Notice for details.