GLVertexpublic 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 boolean | equals(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 void | put(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 int | toFixed(float x)
return (int)(x*65536.0f);
| public void | update(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));
}
|
|