jme.geometry.primitive
Class Primitive

java.lang.Object
  extended byjme.geometry.primitive.Primitive
All Implemented Interfaces:
Geometry
Direct Known Subclasses:
Box, Pyramid, Quad, Quadric, Triangle

public abstract class Primitive
extends java.lang.Object
implements Geometry

Primitive defines a basic geometry shape. This typically denotes objects such as: Spheres, Cubes, Disks, Cylinders and the like.

Version:
1
Author:
Mark Powell

Field Summary
protected  float alpha
          the transparency of the object.
protected  float blue
          the blue component of the object's color.
protected  float green
          the green component of the object's color.
protected  float red
          the red component of the object's color.
 
Constructor Summary
Primitive()
           
 
Method Summary
 void clean()
          clean should be called after any render call.
 int getTextureId()
          getTextureId returns the texture id associated with this object.
abstract  void render()
          render is an abstract method that should handle the displaying of the geometry data.
 void setColor(float red, float green, float blue, float alpha)
          setColor sets the RGBA values for this object.
 void setTexture(java.lang.String filename)
          setTexture takes an image file, and adds it to the texture system.
 java.lang.String toString()
          toString returns the string representation of this geometry object in the format:

Geometry: jme.geometry.primitive.Sphere@10e3293
Color: {RGBA VALUE}
TextureID: {VALUE}
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jme.geometry.Geometry
getPoints, initialize
 

Field Detail

red

protected float red
the red component of the object's color.


green

protected float green
the green component of the object's color.


blue

protected float blue
the blue component of the object's color.


alpha

protected float alpha
the transparency of the object.

Constructor Detail

Primitive

public Primitive()
Method Detail

setTexture

public void setTexture(java.lang.String filename)
setTexture takes an image file, and adds it to the texture system. The TextureManager handles the creation of the texture.

Specified by:
setTexture in interface Geometry
Parameters:
filename - the image file to use as a texture.

getTextureId

public int getTextureId()
getTextureId returns the texture id associated with this object.

Returns:
the texture id of this object.

setColor

public void setColor(float red,
                     float green,
                     float blue,
                     float alpha)
setColor sets the RGBA values for this object.

Specified by:
setColor in interface Geometry
Parameters:
red - the red component of the color.
green - the green component of the color.
blue - the blue component of the color.
alpha - the transparency component of the color.

render

public abstract void render()
render is an abstract method that should handle the displaying of the geometry data.

Specified by:
render in interface Geometry

clean

public void clean()
clean should be called after any render call. This disables the texture 2d state if appropriate.


toString

public java.lang.String toString()
toString returns the string representation of this geometry object in the format:

Geometry: jme.geometry.primitive.Sphere@10e3293
Color: {RGBA VALUE}
TextureID: {VALUE}

Returns:
the string representation of this object.