float width = parseWidth(node.getTags(), 1);
float depth = width / 2f;
/* determine material */
Material material = null;
//TODO parse color
if (material == null) {
material = Materials.getSurfaceMaterial(
node.getTags().getValue("material"));
}
if (material == null) {
material = Materials.getSurfaceMaterial(
node.getTags().getValue("surface"), Materials.GRITBIN_DEFAULT);
}
double directionAngle = parseDirection(node.getTags(), PI);
VectorXZ faceVector = VectorXZ.fromAngle(directionAngle);
VectorXZ boardVector = faceVector.rightNormal();
/* draw box */
target.drawBox(material, getBase(),
faceVector, height, width, depth);
/* draw lid */
List<VectorXYZ> vs = new ArrayList<VectorXYZ>();
vs.add(getBase().addY(height + 0.2));
vs.add(getBase().add(boardVector.mult(width/2)).add(faceVector.mult(depth/2)).addY(height));
vs.add(getBase().add(boardVector.mult(-width/2)).add(faceVector.mult(depth/2)).addY(height));
vs.add(getBase().add(boardVector.mult(-width/2)).add(faceVector.mult(-depth/2)).addY(height));
vs.add(getBase().add(boardVector.mult(width/2)).add(faceVector.mult(-depth/2)).addY(height));
vs.add(getBase().add(boardVector.mult(width/2)).add(faceVector.mult(depth/2)).addY(height));
target.drawTriangleFan(material.brighter(), vs, null);
}