scenic
Class ScenePrimitives

java.lang.Object
  extended by scenic.SceneNode
      extended by scenic.SceneLeaf
          extended by scenic.ScenePrimitives

public class ScenePrimitives
extends SceneLeaf

This scene node type is used to draw primitives. The primitives are triangles which can be colored and textured in the same way as in OpenGL and DirectX. The primitives are defined by attributes. Each attribute is an array of numbers that defines a certain property such as position, color or texture coordinate of the primitives to be drawn. Textures can also be defined. The triangles as defined by an index array (indices).


Nested Class Summary
static class ScenePrimitives.Attribute
          This class contains attribute information.
 
Field Summary
static int COLOR_ATTRIBUTE
          The color attribute defines the diffuse colors of the vertices.
static int POSITION_ATTRIBUTE
          The position attribute defines the positions of the vertices.
static int TEX_COORD1_ATTRIBUTE
          The texture coordinate attribute defines the texture coordinates of the vertices.
 
Constructor Summary
ScenePrimitives()
           
 
Method Summary
 ScenePrimitives.Attribute getAttribute(int index)
          Gets the given attribute.
 int[] getIndices()
          Gets the indices.
 ScenicImage getTexture(int index)
          Gets the texture at the given index.
 void setAttribute(int index, int size, byte[] data)
          Sets the given attribute.
 void setAttribute(int index, int size, float[] data)
          Sets the given attribute.
 void setIndices(int[] indices)
          Sets the indices.
 void setTexture(int index, ScenicImage texture)
          Sets the texture at the given index.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POSITION_ATTRIBUTE

public static final int POSITION_ATTRIBUTE
The position attribute defines the positions of the vertices.

See Also:
Constant Field Values

COLOR_ATTRIBUTE

public static final int COLOR_ATTRIBUTE
The color attribute defines the diffuse colors of the vertices.

See Also:
Constant Field Values

TEX_COORD1_ATTRIBUTE

public static final int TEX_COORD1_ATTRIBUTE
The texture coordinate attribute defines the texture coordinates of the vertices.

See Also:
Constant Field Values
Constructor Detail

ScenePrimitives

public ScenePrimitives()
Method Detail

getAttribute

public ScenePrimitives.Attribute getAttribute(int index)
Gets the given attribute.

Parameters:
index - the index of the attribute.
Returns:
the attribute.

setAttribute

public void setAttribute(int index,
                         int size,
                         float[] data)
Sets the given attribute. The size defines the number of numbers used for a single vertice.

Parameters:
index - the index of the attribute.
size - the size of the attribute
data - the data.

setAttribute

public void setAttribute(int index,
                         int size,
                         byte[] data)
Sets the given attribute. The size defines the number of numbers used for a single vertice.

Parameters:
index - the index of the attribute.
size - the size of the attribute
data - the data.

getTexture

public ScenicImage getTexture(int index)
Gets the texture at the given index.

Parameters:
index - the index of the texture.
Returns:
the texture at the given index.

setTexture

public void setTexture(int index,
                       ScenicImage texture)
Sets the texture at the given index. Currently only one texture is allowed so the index must be 0.

Parameters:
index - the index of the texture.
texture - the texture.

getIndices

public int[] getIndices()
Gets the indices.

Returns:
the indices.

setIndices

public void setIndices(int[] indices)
Sets the indices.

Parameters:
indices - the indices.