FileDocCategorySizeDatePackage
GLShape.javaAPI DocAndroid 1.5 API2698Wed May 06 22:41:08 BST 2009com.example.android.apis.graphics.kube

GLShape

public class GLShape extends Object

Fields Summary
public M4
mTransform
public M4
mAnimateTransform
protected ArrayList
mFaceList
protected ArrayList
mVertexList
protected ArrayList
mIndexList
protected GLWorld
mWorld
Constructors Summary
public GLShape(GLWorld world)

		mWorld = world;
	
Methods Summary
public voidaddFace(GLFace face)

		mFaceList.add(face);
	
public GLVertexaddVertex(float x, float y, float z)

		
		// look for an existing GLVertex first
		Iterator<GLVertex> iter = mVertexList.iterator();
		while (iter.hasNext()) {
			GLVertex vertex = iter.next();
			if (vertex.x == x && vertex.y == y && vertex.z == z) {
				return vertex;
			}
		}
		
		// doesn't exist, so create new vertex
		GLVertex vertex = mWorld.addVertex(x, y, z);
		mVertexList.add(vertex);
		return vertex;
	
public voidanimateTransform(M4 transform)

		mAnimateTransform = transform;
		
		if (mTransform != null)
			transform = mTransform.multiply(transform);

		Iterator<GLVertex> iter = mVertexList.iterator();
		while (iter.hasNext()) {
			GLVertex vertex = iter.next();
			mWorld.transformVertex(vertex, transform);
		}
	
public voidendAnimation()

		if (mTransform == null) {
			mTransform = new M4(mAnimateTransform);
		} else {
			mTransform = mTransform.multiply(mAnimateTransform);
		}
	
public intgetIndexCount()

		int count = 0;
		Iterator<GLFace> iter = mFaceList.iterator();
		while (iter.hasNext()) {
			GLFace face = iter.next();
			count += face.getIndexCount();
		}		
		return count;
	
public voidputIndices(java.nio.ShortBuffer buffer)

		Iterator<GLFace> iter = mFaceList.iterator();
		while (iter.hasNext()) {
			GLFace face = iter.next();
			face.putIndices(buffer);
		}		
	
public voidsetFaceColor(int face, GLColor color)

		mFaceList.get(face).setColor(color);
	
public voidstartAnimation()