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

GLVertex

public class GLVertex extends Object

Fields Summary
public float
x
public float
y
public float
z
final short
index
GLColor
color
Constructors Summary
GLVertex()

		this.x = 0;
		this.y = 0;
		this.z = 0;
		this.index = -1;
	
GLVertex(float x, float y, float z, int index)

		this.x = x;
		this.y = y;
		this.z = z;
		this.index = (short)index;
	
Methods Summary
public booleanequals(java.lang.Object other)

		if (other instanceof GLVertex) {
			GLVertex v = (GLVertex)other;
			return (x == v.x && y == v.y && z == v.z);
		}
		return false;
	
public voidput(java.nio.IntBuffer vertexBuffer, java.nio.IntBuffer colorBuffer)

		vertexBuffer.put(toFixed(x));
		vertexBuffer.put(toFixed(y));
		vertexBuffer.put(toFixed(z));
		if (color == null) {
			colorBuffer.put(0);
			colorBuffer.put(0);
			colorBuffer.put(0);
			colorBuffer.put(0);
		} else {
			colorBuffer.put(color.red);
			colorBuffer.put(color.green);
			colorBuffer.put(color.blue);
			colorBuffer.put(color.alpha);
		}
	
public static inttoFixed(float x)

    	return (int)(x*65536.0f);
    
public voidupdate(java.nio.IntBuffer vertexBuffer, M4 transform)

		// skip to location of vertex in mVertex buffer
		vertexBuffer.position(index * 3);
	
		if (transform == null) {
			vertexBuffer.put(toFixed(x));
			vertexBuffer.put(toFixed(y));
			vertexBuffer.put(toFixed(z));			
		} else {
			GLVertex temp = new GLVertex();
			transform.multiply(this, temp);
			vertexBuffer.put(toFixed(temp.x));
			vertexBuffer.put(toFixed(temp.y));
			vertexBuffer.put(toFixed(temp.z));
		}