Skip to content

Instantly share code, notes, and snippets.

@eiennohito
Created April 18, 2012 17:58
Show Gist options
  • Save eiennohito/2415452 to your computer and use it in GitHub Desktop.
Save eiennohito/2415452 to your computer and use it in GitHub Desktop.
package org.eiennohito.model;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import org.eiennohito.drawing.Color;
import org.eiennohito.drawing.GLFillable;
import org.eiennohito.math.Vector;
import javax.media.opengl.GL;
/**
* @author eiennohito
* @date 13.02.2008
*/
@XStreamAlias(value = "vertex")
public class Vertex implements GLFillable {
private Vector position;
private Color color = Color.WHITE;
public Vertex(float x, float y, float z, float h) {
position = new Vector(x,y,z,h);
}
public Vector getPosition() {
return position;
}
public void setPosition(Vector position) {
this.position = position;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public void fillGL(GL gl) {
color.fillGL(gl);
position.fillGL(gl);
}
@Override
public String toString() {
return String.format("{%.2f;%.2f;%.2f;%.2f}", position.getValue(0), position.getValue(1),
position.getValue(2), position.getValue(3));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment