@SuppressWarnings("unchecked")
	public void write(JSONObject obj)
	{
		if (this.cullFacing != null)
		{
			obj.put("cullFacing", this.cullFacing.id);
		}
		if (this.shade != null)
		{
			obj.put("shade", this.shade);
		}
		if (this.tint != null)
		{
			obj.put("tint", this.tint);
		}
		if (this.textureFacing != null)
		{
			obj.put("textureFacing", this.textureFacing.id);
		}
		if (this.overlay != null)
		{
			obj.put("overlay", this.overlay);
		}

		if (this.vertices != null)
		{
			JSONArray list = new JSONArray();

			boolean flag = true;

			for (Vertex v : this.vertices)
			{
				JSONObject vo = new JSONObject();
				if (v != null)
				{
					v.write(vo);
					list.add(vo);
				}
				else
				{
					flag = false;
				}
			}

			if (flag)
			{
				obj.put("vertices", list);
			}
		}
	}