The founders of J2ME released the Java Specification Request (JSR) 184 on November 19, 2003. This specification defines the ‘Mobile 3D Graphics API’. Its main purpose was to bring the power of 3D graphics and animation to the J2ME enabled devices. This specification defines one new package, namely javax.microedition.m3g. This package is an optional package and is compatible with MIDP 1.0, MIDP 2.0 as well as the CDC. The good thing about this API is that it has been defined keeping into consideration the processing and memory constraints on the mobile devices. Another thing that has been kept in mind while developing this API is that there is a provision for importing the 3D animations built using 3D modeling tools directly from this API. This features makes it very easy to incorporate 3D animations into the midlets. This API provides us with both scene-graph structure and an immediate mode interface. It also provides us with an efficient file format for storing 3D content. The file formar provided to us has an extension named .m3g. The aim is that 3D modeling softwares can store the data in this file format. This data can then be used in the application directly. This package contains many useful classes for developing application with 3D animations. Some of the uses of this API can be: · Development of 3D games · 3D realistic maps · 3D multimedia applications · 3D screen savers · 3D animations · 3D user interface How you use it depends upon your imagination and the budget constraints imposed on you. javax.microedition.m3g
public class AnimationController What is it? This class extends the class Object3D. It controls the position, speed and weight of an animation sequence.
· public AnimationController() This contructor can be used for creating a new AnimationController object. The default values for this new AnimationController object are: § active interval: (0, 0) (always active) § blending weight: 1.0 § reference point: (0, 0) § speed: 1.0
· public int getActiveIntervalEnd() This method returns the ending time of the active interval. · public int getActiveIntervalStart() This method returns the starting time of the active interval. · public float getPosition(int worldTime) This method returns animation sequence position in number of time units elapsed since the beginning of this animation, until worldTime. · public float getSpeed() This method returns the current playback speed of this AnimationController object. · public float getWeight() This method returns the current blending weight. · public void setActiveInterval(int start, int end) This method is used to set the world time interval during which this animation controller is active. · public void setPosition(float sequenceTime, int worldTime) This method is used to set a new playback position for this animation controller relative to world time. § public void setSpeed(float speed, int worldTime) This method is used to set a new playback speed for this animation. § public void setWeight(float weight) This method is used to set the blending weight for this animation controller. The value for blending weight must be positive or zero.
public class AnimationTrack What is it? This class associates a KeyframeSequence with an AnimationController and an animatable property.
What is an animatable property? Animatable property is a scalar or vector variable that the animation system can directly update. The orientation of a Node is a good example of animatable property.
o Constructors § public AnimationTrack(KeyframeSequence sequence, int property) This constructor creates an AnimationTrack object with the given keyframe sequence targeting the given property.
o Fields § public static final int ALPHA This field specifies the following as an animation target: · Alpha factor of a Node, or · The alpha component of the Background color · The Material diffuse color, or · VertexBuffer default color
§ public static final int AMBIENT_COLOR This field specifies the ambient color of a Material as an animation target. § public static final int COLOR This field specifies the following as an animation target: · Color of a Light · Background, or · Fog, or · Texture blend color in Texture2D, or · VertexBuffer default color § public static final int CROP This field specifies the cropping parameters of a Sprite3D or Background as an animation target. § public static final int DENSITY This field specifies the fog density in Fog as an animation target. § public static final int DIFFUSE_COLOR This field specifies the diffuse color of a Material as an animation target. § public static final int EMISSIVE_COLOR This field specifies the emissive color of a Material as an animation target. § public static final int FAR_DISTANCE This field specifies the far distance of a Camera or Fog as an animation target. § public static final int FIELD_OF_VIEW This field specifies the field of view of a Camera as an animation target. § public static final int INTENSITY This field specifies the intensity of a Light as an animation target. § public static final int MORPH_WEIGHTS This field specifies the morph target weights of a MorphingMesh as an animation target. § public static final int NEAR_DISTANCE This field specifies the near distance of a Camera or Fog as an animation target. § public static final int ORIENTATION This field specifies the orientation component of the transformation of a Transformable object as an animation target. § public static final int PICKABILITY This field specifies the picking enable flag of a Node as an animation target. § public static final int SCALE This field specifies the scaling component of the transformation of a Transformable object as an animation target. § public static final int SHININESS This field specifies the shininess of a Material as an animation target. § public static final int SPECULAR_COLOR This field specifies the specular color of a Material as an animation target. § public static final int SPOT_ANGLE This field specifies the spot angle of a Light as an animation target. § public static final int SPOT_EXPONENT This field specifies the spot exponent of a Light as an animation target. § public static final int TRANSLATION This field specifies the translation component of the transformation of a Transformable object as an animation target. § public static final int VISIBILITY This field specifies the rendering enable flag of a Node as an animation target.
§ public AnimationController getController() This method retrieves the animation controller used for controlling this animation track. § public KeyframeSequence getKeyframeSequence() This method returns the keyframe sequence object which defines the keyframe values for this animation track. § public int getTargetProperty() This method returns the property targeted by this AnimationTrack. The value returned is one of the symbolic constants listed above. § public void setController(AnimationController controller) This method specifies the animation controller to be used for controlling this animation track.
public class Appearance What is it? § This class defines a set of component objects that define the rendering attributes of a Mesh or Sprite3D. The attributes of Appearance are grouped into component objects. Each component object contains the data for a set of properties that are functionally and logically related to each other.
Which classes are the Appearance component classes?
The following classes are the Appearance compoenent classes: · Material · PolygonMode · CompositingMode · Fog · Texture2D
o Constructors
This constructor constructs an Appearance object with default values. The following are the default values of the object which is created:
o Methods § public CompositingMode getCompositingMode() This method returns the current CompositingMode for this Appearance. § public Fog getFog() This method returns the current fogging attributes for this Appearance. § public int getLayer() This method gives us the current rendering layer for this Appearance. § public Material getMaterial() This method returns the current Material for this Appearance. § public PolygonMode getPolygonMode() This method returns the current PolygonMode for this Appearance. § public Texture2D getTexture(int index) This method retrieves the current texture image and its attributes for the given texturing unit. § public void setCompositingMode(CompositingMode compositingMode) This method sets the CompositingMode to use for this Appearance. § public void setFog(Fog fog) This method sets the fogging attributes to use for this Appearance. § public void setLayer(int layer) This method sets the rendering layer for this Appearance. § public void setMaterial(Material material) This method sets the Material to use when lighting this Appearance. § public void setPolygonMode(PolygonMode polygonMode) This method sets the PolygonMode to use for this Appearance. § public void setTexture(int index, Texture2D texture) This method sets the texture image and its attributes for the given texturing unit.
public class Background What is it? The Background class defines whether the viewport has to be cleared and how should it be cleared. The Background object is used for clearing the portions of the frame buffer that correspond to the current viewport.
o Constructors
This constructor constructs a new Background with default values. The default values for Background object that is created are:
§ Color clear enable : true (clear the color buffer) § Depth clear enable : true (clear the depth buffer) § Background color : 0x00000000 (black, transparent) § Background image : null (use the background color only) § Background image mode : BORDER, BORDER § Crop rectangle : undefined (reset at setImage)
o Fields
This field specifies that the imaginary pixels outside of the source image boundaries in X or Y direction are considered to have the background color.
This field specifies that the imaginary pixels outside of the source image boundaries in X or Y direction are considered to have the same color as the pixel in the corresponding position in the source image.
o Methods
This method retrieves the current background color.
This method gets the current cropping rectangle height within the source image.
This method returns the width of the cropping rectangle within the source image.
This method returns the X offset of the cropping rectangle.
This method returns the Y offset of the cropping rectangle.
This method returns the current background image.
This method returns the X repeat mode.
This method returns the Y repeat mode.
This method returns true if color buffer clearing is enabled. Else if it is disabled then false is returned.
This method returns true if depth buffer clearing is enabled. If it is disabled then false is returned.
This method sets the background color.
This method enables or disables color buffer clearing.
This method sets a cropping rectangle within the background image.
This method enables or disables depth buffer clearing.
This method sets the background image or switches from background image mode to background color mode.
This method sets the background image repeat mode for the X and Y directions.
public class Camera What is it? Camera is a scene graph node that defines the position of the viewer in the scene. It also defined the projection from 3D to 2D. In its local coordinate system, it is always facing towards the negative Z axis, (0 0 -1).
o Constructors
This constructor creates a new Camera node with default values. The default values with which the Camera object is created are as follows: § Projection mode : PARALLEL § View volume : opposite corners at (-1 -1 -1) and (1 1 1)
o Fields
This field specifies a generic 4x4 projection matrix.
This field specifies a parallel projection matrix.
This field specifies a perspective projection matrix.
o Methods
This method returns the type of projection. The type of projection may be GENERIC, PERSPECTIVE or PARALLEL.
This method returns the type of projection. The type of projection may be GENERIC, PERSPECTIVE or PARALLEL.
This method sets the given 4x4 transformation as the current projection matrix.
This method constructs a parallel projection matrix and sets that as the current projection matrix.
This method constructs a perspective projection matrix and sets that as the current projection matrix. public class CompositingMode What is it? CompositingMode is an Appearance component that encapsulates the per-pixel compositing attributes.
o Constructors
This constructor constructs a CompositingMode object with the following default values: § blending mode : REPLACE § alpha threshold : 0.0 § depth offset : 0.0, 0.0 § depth test : Enabled § Depth write : Enabled § Color write : Enabled § Alpha write : Eabled
o Fields
This field selects the alpha blend mode.
This field selects the additive blend mode.
This field selects the basic modulating blending mode;
This field selects the brighter modulating blending mode.
This field selects the replace mode.
o Methods
This method returns the current alpha threshold.
This method returns the currently active blending mode.
This method returns the current depth offset factor.
This method returns the current depth offset in depth units.
This method returns true if alpha writing is enabled. It will return false in other cases.
This method returns true if color writing is enabled. It will return false in other cases.
This method returns true if depth testing is enabled. It will return false in other cases.
This method returns true if depth writing is enabled. It will return false in other cases.
This method sets the threshold value for alpha testing. In case the alpha component of a fragment is less than the alpha threshold, the fragment is not rendered.
This method enables or disables writing of fragment alpha values into the color buffer.
This method selects a method of combining the pixel to be rendered with the pixel already in the frame buffer. The very last step of the pixel processing pipeline is blending.
This method enables or disables writing of fragment color values into the color buffer.
This method defines a value that is added to the screen space Z coordinate of a pixel immediately before depth test and depth write.
This method enables or disables depth testing.
This method enables or disables writing of fragment depth values into the depth buffer. public class Fog What is it? Fog is an appearance component that encapsulates the attributes for fogging.
o Constructors
This constructor creates a new Fog object with the following default values: § mode : LINEAR § density : 1.0 (exponential fog only) § near distance : 0.0 (linear fog only) § far distance : 1.0 (linear fog only) § color: 0x00000000
o Fields
This field stands for a parameter to setMode. It specifies exponential fog.
This field stands for a parameter to setMode. It specifies linear fog.
o Methods
This method returns the current color of this Fog in 0x00RRGGBB format.
This method returns the current density of this Fog.
This method returns the current distance to the linear fog far plane.
This method returns the current fog mode which will one of the symbolic constants discussed earlier.
This method returns the current distance to the linear fog near plane.
This method sets the color of this Fog.
This method sets the fog density for exponential fog.
This method sets the near and far distances for linear fog.
This method sets the fog mode which may either be linear or exponential. public class Graphics3D What is it? Graphics3D is a singleton 3D graphics context that can be bound to a rendering target. All rendering is done through the render methods in this class, including the rendering of World objects. There is no other way to draw anything in this API.
There are four different render methods · The first method is for rendering an entire World. · The second method is for rendering scene graph nodes. · The third and fourth methods are for rendering an individual submesh.
Rendering targets Before rendering anything or even clearing the screen, the application must bind a rendering target to this Graphics3D, using the bindTarget method. When finished with rendering a frame, the application must release the rendering target by calling the releaseTarget method. o Fields
· public static final int ANTIALIAS This field specifies a parameter to the bindTarget method. It specifies that antialiasing should be turned on.
· public static final int DITHER This field specifies a parameter to the bindTarget method. It specifies that dithering should be turned on.
· public static final int TRUE_COLOR This field specifies a parameter to the bindTarget method. It specifies that true color rendering should be turned on.
o Methods
· public int addLight(Light light, Transform transform) This method binds a Light to use in subsequent immediate mode rendering.
· public void bindTarget(Object target) This method binds the given Graphics or mutable Image2D as the rendering target of this Graphics3D.
· public void bindTarget(Object target, boolean depthBuffer, int hints) This method binds the given Graphics or mutable Image2D as the rendering target of this Graphics3D. This method is similar to the above discussed variant of bindTarget, but it allows the depth buffering enable flag and the rendering quality hints to be specified.
· public void clear(Background background) This method clears the viewport as specified in the given Background object.
· public static Graphics3D getInstance() This method retrieves the single Graphics3D instance that is associated with this application. Thus the same instance will be returned every time this method is called.
· public static Hashtable getProperties() This method retrieves the implementation specific properties.
· public void releaseTarget() This method flushes the rendered 3D image to the currently bound target and then releases the target. This ensures that the 3D image is actually made visible on the target that was set in the bindTarget method.
· public void render(Node node, Transform transform) This method renders the given Sprite3D, Mesh or Group node with the given transformation from local coordinates to world coordinates.
· public void render(VertexBuffer vertices, IndexBuffer triangles, Appearance appearance, Transform transform) This method renders the given submesh with the given transformation from local coordinates to world coordinates.
· public void render(VertexBuffer vertices, IndexBuffer triangles, Appearance appearance, Transform transform, int scope) This method renders the given submesh with the given scope and the given transformation from local coordinates to world coordinates.
· public void render(World world) This method renders an image of world as viewed by the active camera of that World.
· public void resetLights() This method clears the array of current lights.
· public void setCamera(Camera camera, Transform transform) This method sets the Camera to use in subsequent immediate mode rendering.
· public void setDepthRange(float near, float far) This method specifies the mapping of depth values from normalized device coordinates to window coordinates.
· public void setLight(int index, Light light, Transform transform) This method unbinds or binds a Light for subsequent immediate mode rendering.
· public void setViewport(int x, int y, int width, int height) This method specifies a rectangular viewport on the currently bound rendering target. What is a viewport? The viewport is the area where the view of the current camera will appear. What is it? The class group defines a scene graph node that stores an unordered set of nodes as its children. o Constructors
This constructor constructs a new Group node and initializes it with an empty list of children. o Methods
This method adds the given node to this Group. It may potentially change the order and indices of the previously added children.
This method gets a child by index.
This method returns the number of children directly attached to this group.
This method returns true if the ray intersected a Mesh or a Sprite3D. It will return false in other cases.
This method returns true if the ray intersected a Mesh. It will return false in other cases.
This method removes the given node from this Group. This may potentially change the order and indices of the remaining children. public class Image2D What is it? Image2D is a class that represents two-dimensional image that can be used as a texture, background or sprite image.What are Mutable and Immutable images in context with Image2D? o Mutable: The contents of a mutable image can be updated at any time by rendering into it or by using the set method. The changes to this image will be immediately reflected. o Immutable: The contents of an immutable image are fixed at construction time and can not be changed later.
o Constructors
This constructor constructs an empty Image2D object with the specified dimensions.
This constructor constructs an immutable Image2D object by copying pixels from a byte array.
This constructor constructs an immutable Image2D object by copying palette indices from a byte array and the palette entries from another byte array.
This constructor constructs an immutable Image2D object by copying pixels from a MIDP or AWT image.
o Fields
This field is a constructor parameter which specifies that this Image2D has an alpha component only.
Note: This kind of an image can not be used as a rendering target or background.
This field is a constructor parameter which specifies that this Image2D has a luminance component only.
Note: This kind of an image can not be used as a rendering target or background.
This field is a constructor parameter which specifies that this Image2D has luminance and alpha components.
Note: This kind of an image can not be used as a rendering target or background.
This field is a constructor parameter which specifies that this Image2D has red, green and blue color components.
This field is a constructor parameter which specifies that this Image2D has red, green, blue and alpha components.
o Methods
This method returns the internal format of this Image2D.
This method returns the height of this image.
This method returns the width of this image.
This method returns true if this Image2D is mutable. It will return false if it is immutable.
This method updates a rectangular area of this Image2D by copying pixels from a byte array. This method can be used only for mutable images. public abstract class IndexBuffer What is it? IndexBuffer extends Object3D class. IndexBuffer class defines how to connect vertices to form a geometric object. Each of its object’s defines a submesh. It is an abstract class that provides no functionality. TriangleStripArray is currently the only derived class of IndexBuffer. TriangleStripArray defines a submesh consisting of triangle strips.
public class KeyframeSequence What is it? KeyframeSequence class encapsulates animation data as a sequence of time-stamped vector-valued keyframes. Every keyframe stands for the value of an animated quantity at a specific time instant. The number of vector components per keyframe is specified in the constructor. The number of vector components per keyframe is the same for all keyframes in the sequence.
o Constructors
This constructor creates a new KeyframeSequence object according to the specified parameters.
o Fields
This field tells that this sequence is to be played back just once and not repeated.
This field is a constructor parameter that specifies that there should be linear interpolation between keyframes.
This field is a parameter to setRepeatMode. It specifies that this sequence is to be repeated indefinitely.
This field is a constructor parameter that specifies spherical linear interpolation of quaternions.
This field is a constructor parameter that specifies spline interpolation between keyframes.
This field is a constructor parameter that specifies spline interpolation of quaternions.
This field is a constructor parameter that specifies stepping from one keyframe value to the next.
o Methods
This method returns the duration of this sequence in sequence time units.
This method returns the current repeat mode. Returned values may be CONSTANT or LOOP.
This method sets the duration of this sequence in sequence time units.
This method sets the time position and value of the specified keyframe.
This method sets the repeat mode of this KeyframeSequence. There are two values which can be set: LOOP and CONSTANT.
This method selects the range of keyframes that are included in the animation. public class Light What is it? The class Light is a scene graph node that represents different kinds of light sources. Light sources are used to determine the color of each object according to its Material attributes.
o Constructors
This constructor constructs a new Light with the following default values: •mode: DIRECTIONAL •color : 0x00FFFFFF (1.0, 1.0, 1.0) •intensity : 1.0 •attenuation : (1, 0, 0) •spot angle : 45 degrees •spot exponent : 0.0
o Fields
This field is a parameter to setMode. It specifies an ambient light source.
This field is a parameter to setMode. It specifies a directional light source.
This field is a parameter to setMode. It specifies an omnidirectional light source.
This field is a parameter to setMode. It specifies a spot light source. o Methods
This method returns the current color of this Light in 0x00RRGGBB format.
This method returns the current constant attenuation coefficient.
This method returns the current intensity of this Light.
This method returns the current linear attenuation coefficient.
This method returns the current mode of this Light.
This method returns the current quadratic attenuation coefficient.
This method returns the current spot angle of this Light object.
This method returns the current spot exponent of this Light object.
This method sets the attenuation coefficients for this Light object.
This method sets the color of this Light object.
This method sets the intensity of this Light object.
This method sets the type of this Light object.
This method sets the spot cone angle for this Light object.
This method sets the spot exponent for this Light object.
public class Loader What is it? The class Loader downloads and deserializes scene graph nodes, node components and entire scene graphs. The most convenient way for an application to create and populate a 3D scene is downloading the ready-made pieces of 3D content from an M3G file. You can also get Image2D object loaded if you give a PNG image file in the parameters of the load method.
What is an M3G file?
The JSR 184 defines a file format for efficiently saving the 3D data. This data can be generated with the help of a PC based 3D modeling tool. This file format, which is known as the M3G format is fully compatible with the JSR 184 and thus helps in accelerating the pace development of 3D content for mobile java applications.
o Methods
This method deserializes Object3D instances from the given byte array. This method will start at the given offset.
This method returns an array of newly created Object3D instances. public class Material What is it? Material class defines an Appearance component which encapsulates material attributes for lighting computations.
o Constructors
This constructor creates a Material object with the following default values: § vertex color tracking : false (disabled) § ambient color : 0x00333333 (0.2, 0.2, 0.2, 0.0) § diffuse color : 0xFFCCCCCC (0.8, 0.8, 0.8, 1.0) § emissive color : 0x00000000 (0.0, 0.0, 0.0, 0.0) § specular color : 0x00000000 (0.0, 0.0, 0.0, 0.0) § shininess : 0.0
o Fields
This field is a parameter to the setColor and getColor methods. It specifies that the ambient color component is to be set or retrieved.
This field is a parameter to the setColor and getColor methods. It specifies that the diffuse color component is to be set or retrieved.
This field is a parameter to the setColor and getColor methods. It specifies that the emissive color component is to be set or retrieved.
This field is a parameter to the setColor and getColor methods. It specifies that the specular color component is to be set or retrieved.
o Methods
This method returns the current color of the target property in 0xAARRGGBB format.
This method returns the current specular exponent value of this Material.
This method returns true if vertex color tracking is enabled. It will return false if it is disabled.
This method sets the given value to the specified color component(s) of this Material.
This method sets the shininess of this Material.
This method enables or disables vertex color tracking.
public class Mesh What is it? A Mesh is a scene graph node that represents a 3D object defined as a polygonal surface. Mesh class represents a conventional rigid body mesh. Its derived classes MorphingMesh and SkinnedMesh extend it with capabilities to transform vertices independently of each other.
o Constructors
This constructor constructs a new Mesh object with the given VertexBuffer and submeshes.
This constructor constructs a new Mesh consisting of only one submesh.
o Methods
This method returns current Appearance of the submesh at the specified index.
This method returns current IndexBuffer at the specified index.
This method returns the number of submeshes in this Mesh.
This method returns the VertexBuffer of this Mesh.
This methpd sets the Appearance for the specified submesh.
public class MorphingMesh What is it? MorphingMesh is a scene graph node that represents a vertex morphing polygon mesh. It is equivalent to an ordinary Mesh except that in the case of the MorphingMesh vertices that are rendered are computed as a weighted linear combination of the base VertexBuffer and a number of morph target VertexBuffers.
o Constructors
This constructor contructs a new MorphingMesh with the given base mesh and morph targets.
This constructor contructs a new MorphingMesh with the given base mesh and morph targets.
o Methods
This method returns the VertexBuffer object at index.
This method returns the number of morph targets.
This method gets the current morph target weights for this mesh.
This method sets the weights for all morph targets in this mesh.
public abstract class Node What is it? Node is the abstract base class for all scene graph nodes.
Subclasses of class Node
The following are the subclasses of class Node: Camera: This subclass defines the projection from 3D to 2D. It also defines the position of the viewer in the scene. Mesh : This subclass defines a 3D object consisting of triangles and also the associated material properties. Sprite3D: This subclass defines a screen-aligned 2D image with a position in 3D space. Light : This subclass defines the position, direction, color and other attributes of a light source. Group : This subclass serves as a root for scene graph branches.
o Fields
This field specifies for the setAlignment method that no alignment should be done for the specified axis.
This field specifies the origin of the reference node as an orientation reference for the setAlignment method.
This field specifies the X axis of the reference node as an orientation reference for the setAlignment method.
This field specifies the Y axis of the reference node as an orientation reference for the setAlignment method.
This field specifies the Z axis of the reference node as an orientation reference for the setAlignment method.
o Methods
This method applies alignments to this Node and its descendants.
This method retrieves the alpha factor of this Node.
This method returns reference to the parent node. It returns null if there is no parent.
This method returns the current scope of this Node.
This method gets the composite transformation from this node to the given node.
This method returns the picking enable flag of this Node.
This method returns the rendering enable flag of this Node.
This method sets this node to align with the given other node(s). It may also be used for disabling alignment.
This method sets the alpha factor for this Node. This method can be used to fade groups of meshes in and out.
This method sets the picking enable flag of this Node.
This method sets the rendering enable flag of this Node.
This method sets the scope of this node.
public abstract class Object3D What is it? Object3D is an abstract base class for all objects that can be part of a 3D world.
o Methods
This method adds the given AnimationTrack to this Object3D.
This method updates all animated properties in this Object3D and all Object3Ds that are reachable from this Object3D.
This method creates a duplicate of this Object3D without affecting the existing object.
This method returns the first object encountered that has the given user ID. It may return null if no matching objects were found.
This method returns the AnimationTrack at the given index.
This method returns the number of AnimationTracks bound to this Object3D.
This method returns the number of direct Object3D references in this object.
This method returns the current user ID.
This method returns the current user object associated with this Object3D.
This method removes the given AnimationTrack from this Object3D.
This method sets the user ID for this object.
This method associates an arbitary application specific Object
with this Object3D. The given user object replaces any previously set object. public class PolygonMode What is it? PolygonMode is an Appearance component encapsulating polygon-level attributes.
o Constructors
This constructor constructs a PolygonMode object with the following default values: § culling : CULL_BACK § winding : WINDING_CCW § shading : SHADE_SMOOTH § two-sided lighting: false (disabled) § local camera lighting : false (disabled) § perspective correction : false (disabled)
o Fields
This field is a parameter to setCulling. It specifies that the back-facing side of a polygon is not to be drawn.
This field is a parameter to setCulling. It specifies that the front-facing side of a polygon is not to be drawn.
This field is a parameter to setCulling. It specifies that both faces of a polygon are to be drawn.
This field is a parameter to setShading. It specifies that flat shading is to be used.
This field is a parameter to setShading. It specifies that smooth shading is to be used.
This field is a parameter to setWinding. It specifies that a polygon having its vertices in counter-clockwise order in screen space is to be considered front-facing.
This field is a parameter to setWinding. It specifies that a polygon having its vertices in clockwise order in screen space is to be considered front-facing.
o Methods
This method returns the current culling mode.
This method returns the current shading mode which may either be flat or smooth.
This method returns the current winding mode.
This method returns true if two-sided lighting is enabled. If it is not enabled it returns false.
This method sets the polygon culling mode. The culling mode defines which sides of a polygon should not be rendered.
This method enables or disables local camera lighting.
This method enables or disables perspective correction.
This method sets the polygon shading mode.
This method enables or disables two-sided lighting. In case two-sided lighting is enabled the lit colors for the front and back faces of a polygon are computed differently.
This method sets the polygon winding mode to clockwise or counter-clockwise. The winding mode decides which side of the polygon is to be considered front.
public class RayIntersection What is it? RayIntersection contains a reference to the intersected Mesh or Sprite3D and information about the intersection point. It is filled in by the pick methods in Group. It is strictly a run-time object. RayIntersection cannot be loaded from a file by Loader class.
o Constructors
This constructor constructs a new RayIntersection object with the following default values: § ray origin : (0 0 0) § ray direction : (0 0 1) § intersected node : null § intersected submesh index : 0 § distance to intersection point : 0.0 § all texture coordinates : 0.0 § normal vector: (0 0 1)
o Methods
This method returns normalized distance from the pick ray origin to the intersection point.
This method returns the picked Mesh or Sprite3D object.
This method returns the X component of the surface normal at the intersection point.
This method returns the Y component of the surface normal at the intersection point.
This method returns the Z component of the surface normal at the intersection point.
This method retrieves the origin (ox oy oz) and direction (dx dy dz) of the pick ray in that order.
This method returns index of the intersected submesh. This value is always 0 for sprites.
This method returns the S texcoord of the specified texturing unit at the intersection point.
This method returns the T texcoord of the specified texturing unit at the intersection point. public class SkinnedMesh What is it? SkinnedMesh is a scene graph node that represents a skeletally animated polygon mesh.
o Constructors
This constructor constructs a new SkinnedMesh object with the given vertices, submeshes and skeleton.
This constructor constructs a new SkinnedMesh object with the given vertices, submeshes and skeleton.
o Methods
This method associates a weighted transformation (bone) with a range of vertices in this SkinnedMesh.
This method returns the skeleton Group of this SkinnedMesh.
public class Sprite3D What is it? Sprite3D is a scene graph node that represents a 2-dimensional image with a 3D position.
o Constructors
This constructor constructs a new Sprite3D with the scaling mode, image and appearance defined in the parameters.
o Methods
This method returns the current Appearance of this sprite.
This method returns the height of the cropping rectangle.
This method returns the width of the cropping rectangle.
This method returns the X offset of the cropping rectangle.
This method returns the Y offset of the cropping rectangle.
This method returns the Image2D object used to draw this sprite.
This method returns true if this sprite is scaled. If the sprite is unscaled it will return false.
This method sets the Appearance of this Sprite3D.
This method sets a cropping rectangle within the source image.
This method sets the sprite image to display.
public class Texture2D What is it? Texture2D is an Appearance component whoch encapsulates a two-dimensional texture image and a set of attributes specifying how the image is to be applied on submeshes.
o Constructors
This constructor constructs a new texture object with the given image and setting the texture attributes to their default values as follows: § wrapping S : WRAP_REPEAT § wrapping T : WRAP_REPEAT § level filter : FILTER_BASE_LEVEL § image filter : FILTER_NEAREST § blending mode : FUNC_MODULATE § blend color : 0x00000000 (transparent black)
o Fields
This field refers to a level filtering parameter to setFiltering method that selects the base level image even if mipmap levels exist.
This field refers to a parameter to setFiltering method that selects linear filtering.
This field refers to a parameter to setFiltering method that selects nearest neighbor filtering.
This field refers to a parameter to setBlending method which specifies that the texel color is to be added to the fragment color.
This field refers to a parameter to setBlending method which specifies that the texture blend color is to be blended into the fragment color in proportion to the texel RGB values.
This field refers to a parameter to setBlending method. It specifies that the texel color is to be blended into the fragment color in proportion to the texel alpha.
This field refers to a parameter to setBlending method. It specifies that the texel color and/or alpha are to be multiplied with the fragment color and alpha.
This field refers to a parameter to setBlending method. It specifies that the texel color and/or alpha are to replace the fragment color and alpha.
This field refers to a parameter to setWrapping method. It specifies that the texture image is to be repeated only once.
This field refers to a parameter to setWrapping method. It specifies that the texture image is to be repeated indefinitely.
o Methods
This method returns the current texture blend color in 0x00RRGGBB format.
This method returns the current texture blending function.
This method returns the current base level texture image.
This method returns the current S coordinate wrapping mode.
This method returns the current T coordinate wrapping mode.
This method sets the texture blend color for this Texture2D.
This method chooses the texture blend mode or blend function for this Texture2D.
This method chooses the filtering mode for this Texture2D.
This method sets the given Image2D as the texture image of this Texture2D.
This method sets the wrapping mode for the S and T texture coordinates.
public class Transform What is it? Transform is a generic 4x4 floating point matrix, representing a transformation.
o Constructors
This constructor constructs a new Transform object and initializes it to the 4x4 identity matrix.
This constructor constructs a new Transform object and initializes it by copying the contents of the transform object given as the parameter.
o Methods
This method retrieves the contents of this transformation as a 16-element float array.
This method inverts this matrix incase it is possible. The existing contents are replaced with the result.
This method multiplies this transformation from the right by the given transformation.
This method multiplies this transformation from the right by the given rotation matrix which has been specified in axis-angle form.
This method multiplies this transformation from the right by the given rotation matrix which has been specified in quaternion form.
This method multiplies this transformation from the right by the given scale matrix. The existing contents are replaced with the result.
This method multiplies this transformation from the right by the given translation matrix. The existing contents are replaced with the result.
This method sets this transformation by copying from the given 16-element float array.
This method sets this transformation by copying the contents of the given Transform.
This method replaces this transformation with the 4x4 identity matrix.
This method multiplies the given array of 4D vectors with this matrix.
This method multiplies the elements of the given VertexArray with this matrix. It then stores the transformed values in a float array.
This method transposes this matrix. The existing contents are replaced with the result. public abstract class Transformable What is it? Transformable is an abstract base class for Node and Texture2D. It defines common methods for manipulating node and texture transformations.
o Methods
This method gets the composite transformation matrix of this Transformable.
This method gets the orientation component of this Transformable.
This method gets the scale component of this Transformable.
This method gets the matrix component of this Transformable.
This method gets the translation component of this Transformable.
This method multiplies the current orientation component from the right by the given orientation.
This method multiplies the current orientation component from the left by the given orientation.
This method multiplies the current scale component by the given scale factors.
This method sets the orientation component of this Transformable.
This method sets the scale component of this Transformable.
This method sets the matrix component of this Transformable by copying in the given Transform.
This method sets the translation component of this Transformable.
This method adds the given offset to the current translation component.
public class TriangleStripArray What is it? TriangleStripArray class defines an array of triangle strips. The first three vertex indices define the first triangle. Every subsequent index together with the two previous indices defines a new triangle in it.
o Constructors
This constructor constructs a triangle strip array with explicit indices. The parameters take an array of indices along with the lengths of the individual strips.
This constructor constructs a triangle strip array with implicit indices. The parameters define the first index of the first strip along with the lengths of the individual strips.
public class VertexArray What is it? VertexArray is an array of integer vectors representing the following: · Vertex positions · Normals · Colors · Texture coordinates.
o Constructors
This constructs constructs a VertexArray based on the value of the parameters.
o Methods
This method copies an array of 8-bit vertex attributes.
This method copies an array of 16-bit vertex attributes.
public class VertexBuffer What is it? This class holds references to VertexArrays that contain the following for a set of vertices:
o positions o colors o normals o texture coordinates
o Constructor
This constructor constructs an empty VertexBuffer in which all vertex attributes are set to null.
o Methods
This method returns the current VertexArray for vertex colors. It may also return null.
This method returns the default vertex color in 0xAARRGGBB format.
This method returns the current VertexArray for vertex normals. It may also return null.
This method returns the current VertexArray for vertex positions. It may also return null.
This method returns VertexArray with the texture coordinates for the given texturing unit. It may also return null.
This method returns the number of vertices currently in this VertexBuffer. This method may also return zero if no vertex arrays are set.
This method sets the per-vertex colors for this VertexBuffer.
This method sets the color to use in absence of per-vertex colors.
This method sets the normal vectors for this VertexBuffer.
This method sets the vertex positions for this VertexBuffer.
This method sets the texture coordinates for the specified texturing unit. They are specified with a 2- or 3- component VertexArray.
public class World What is it? Class World extends the class Group. It is a special Group node that is a top-level container for scene graphs.
o Constructor
This constructor creates an empty World. The World so constructed has the following default values: o Background : null (clear to black) o Active camera : null (the world is not renderable) o Methods
This method returns the camera that is currently used to render this World.
This method returns the current attributes for clearing the frame buffer.
This method sets the Camera to use when rendering this World. The camera must also be a descendant of this World at the time of rendering.
|
Mobile Technology > Java ME (J2ME) > Book - Mobile Phone Programming using Java ME (J2ME) > UNIT IV >