|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.motorola.iden.micro3d.Texture
|
+--com.motorola.iden.micro3d.MultiTexture
MultiTexture class contains and manages multiple textures.
Texture objects. The MultiTexture is used for
figures that were created with support for multiple textures. When such
figure is rendered, its texture is created from the separate
Texture objects contained in this MultiTexture.
If this MultiTexture contains more Texture object
than were originally created for that particular figure, the additional
textures will be ignored and will not affect the rendering. If the
MultiTexture does not contain all the textures that form the
multi-texture for that particular figure, then some (or all) parts of the
figure will not render correctly or will not render at all.
MultiTexture also maintains an index that points to one of
the Texture objects contained in this MultiTexture.
This index can be accessed and modified with the
getCurrentIndex() and setCurrentIndex() methods
respectivelly. Specifying the index enables the use of the
MultiTexture for figures and primitives that were not created
to support multiple textures. For those figure and primitives, the
texture that will be used will be the Texture that is found
at the location pointed to by the current index.
| Field Summary | |
static int |
MAX_TEXTURES
Defines the maximum amount of textures a MultiTexture can hold.
|
| Constructor Summary | |
MultiTexture()
Constructs an empty MultiTexture. |
|
MultiTexture(int capacity)
Constructs a MultiTexture capable of holding the specified
amount of Texture objects. |
|
| Method Summary | |
boolean |
addTexture(Texture texture)
Adds the specified Texture to the end of the list.
|
int |
capacity()
Returns the current capacity of this MultiTexture.
|
boolean |
contains(Texture texture)
Tests if the specified Texture is contained in this
MultiTexture.
|
int |
getCurrentIndex()
Returns the current index for this MultiTexture.
|
Texture |
getCurrentTexture()
Returns the Texture reference by the current index.
|
int |
indexOf(Texture texture)
Searches for the first occurence of the given Texture,
testing for equality using the equals method.
|
int |
indexOf(Texture texture,
int index)
Searches for the first occurence of the given Texture,
beginning the search at index, and testing for equality using the
equals method.
|
boolean |
insertTextureAt(Texture texture,
int index)
Inserts the specified texture as a component in this MultiTexture
at the specified index. |
boolean |
isEmpty()
Tests if this MultiTexture has no textures.
|
int |
lastIndexOf(Texture texture)
Returns the index of the last occurrence of the specified texture in this MultiTexture.
|
int |
lastIndexOf(Texture texture,
int index)
Searches backwards for the specified texture, starting from the specified index, and returns an index to it. |
void |
removeAllTextures()
Removes all components from this MultiTexture and sets its
size to zero. |
boolean |
removeTexture(Texture texture)
Removes the first occurrence of the specified texture from this MultiTexture. |
void |
removeTextureAt(int index)
Deletes the Texture at the specified index. |
void |
setCurrentIndex(int index)
Sets the Texture at the index specified as the current
Texture for this MultiTexture.
|
void |
setTextureAt(Texture texture,
int index)
Sets the texture at the specified index of this MultiTexture
to be the specified Texture. |
int |
size()
Returns the number of textures in this MultiTexture.
|
Texture |
textureAt(int index)
Returns the Texture at the specified index.
|
java.util.Enumeration |
textures()
Returns an enumeration of the textures of this MultiTexture.
|
| Methods inherited from class com.motorola.iden.micro3d.Texture |
createTexture, createTexture, isSphereTexture |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int MAX_TEXTURES
MultiTexture can hold.
This value is defined as 16.| Constructor Detail |
public MultiTexture()
MultiTexture. The capacity of this
MultiTexture is set to MAX_TEXTURES.MAX_TEXTURESpublic MultiTexture(int capacity)
MultiTexture capable of holding the specified
amount of Texture objects. If specified capacity is greater
than the maximum amount of textures for a MultiTexture
the value will be adjusted to the maximum value.
capacity - the initial capacity of the MultiTexture.java.lang.IllegalArgumentException - if the specified initial capacity
is negative.MAX_TEXTURES| Method Detail |
public boolean addTexture(Texture texture)
Texture to the end of the list.
The capacity of this MultiTexture is increased
if its size becomes greater than its capacity unless MAX_TEXTURES
has been reached.
texture - the Texture to be added.true if the MultiTexture had space to
accommodate the new Texture; false otherwise.java.lang.NullPointerException - if texture is null.java.lang.IllegalArgumentException - if the specified parameter is a sphere
texture or a MultiTexture.public int capacity()
MultiTexture.
MultiTexture.public boolean contains(Texture texture)
Texture is contained in this
MultiTexture.
texture - texture to test for.true if the specified Texture is a
component in this MultiTexture; false otherwise.public Texture textureAt(int index)
Texture at the specified index.
index - an index into this MultiTexture.Texture at the specified index.java.lang.ArrayIndexOutOfBoundsException - if an invalid index was given.public java.util.Enumeration textures()
MultiTexture.
MultiTexture.public int indexOf(Texture texture)
Texture,
testing for equality using the equals method.
texture - the Texture to search for.Texture in this
MultiTexture; returns -1 if the Texture is not found.
public int indexOf(Texture texture,
int index)
Texture,
beginning the search at index, and testing for equality using the
equals method.
texture - the Texture to search for.index - the index to start searching from.Texture in this
MultiTexture at position index or later in the vector; returns
-1 if the Texture is not found.public int lastIndexOf(Texture texture)
MultiTexture.
texture - the Texture to search for.MultiTexture; returns -1 if the specified texture is not found.
public int lastIndexOf(Texture texture,
int index)
texture - the Texture to search for.index - the index to start searching from.MultiTexture at position less than index in the
MultiTexture; returns -1 if the texture is not found.
public boolean insertTextureAt(Texture texture,
int index)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException
MultiTexture
at the specified index. Each texture in this MultiTexture with
an index greater or equal to the specified index is shifted upward to have
an index one greater than the value it had previously.
The index must be a value greater than or equal to 0 and less than or equal
to the current size of the MultiTexture. texture - the Texture to insert.index - where to insert the new texture.true if the MultiTexture had space to
accommodate the new Texture; false otherwise.java.lang.ArrayIndexOutOfBoundsException - if the specified index was invalid.java.lang.NullPointerException - if Texture is nulljava.lang.IllegalArgumentException - if the specified parameter is a sphere
texture or a MultiTexturepublic boolean isEmpty()
MultiTexture has no textures.
true if this MultiTexture has no textures;
false otherwise.public boolean removeTexture(Texture texture)
MultiTexture. If the texture is found in this
MultiTexture, each component in the MultiTexture
with an index greater or equal to the texture's index is shifted downward to
have an index one smaller than the value it had previously.
texture - the Texture to be removed.true if the Texture was a component of
this MultiTexture; false otherwise.java.lang.NullPointerException - if Texture is null.public void removeTextureAt(int index)
Texture at the specified index. Each
Texture in this MultiTexture with
an index greater or equal to the specified index is shifted downward to
have an index one smaller than the value it had previously.
index - the index of the Texture to remove.java.lang.ArrayIndexOutOfBoundsException - if the index was invalid.public void removeAllTextures()
MultiTexture and sets its
size to zero.
public void setTextureAt(Texture texture,
int index)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.ArrayIndexOutOfBoundsException
MultiTexture
to be the specified Texture. The previous Texture
at that position is discarded.
texture - what the Texture is to be set to.index - the index of the Texture to remove.java.lang.ArrayIndexOutOfBoundsException - if the index was invalid.java.lang.NullPointerException - if Texture is null.java.lang.IllegalArgumentException - if Texture is a sphere texture or a
MultiTexture.public int size()
MultiTexture.
MultiTexture.public int getCurrentIndex()
MultiTexture.
MultiTexture.public void setCurrentIndex(int index)
Texture at the index specified as the current
Texture for this MultiTexture.
index - the index of the Texture to be specified as the
current Texture.java.lang.ArrayIndexOutOfBoundsException - if the specified index is invalid.public Texture getCurrentTexture()
Texture reference by the current index.
Texture serving as the current Texture
or null if the current Texture is not set.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||