public static void loadModelHeader(byte modelData[], int modelId) {
		if (modelData == null) {
			ModelHeader modelHeader = modelHeaders[modelId] = new ModelHeader();
			modelHeader.vertexCount = 0;
			modelHeader.triangleCount = 0;
			modelHeader.texturedTriangleCount = 0;
			return;
		}
		Buffer stream = new Buffer(modelData);
		stream.position = modelData.length - 18;
		ModelHeader modelHeader = modelHeaders[modelId] = new ModelHeader();
		modelHeader.modelData = modelData;
		modelHeader.vertexCount = stream.getUnsignedLEShort();
		modelHeader.triangleCount = stream.getUnsignedLEShort();
		modelHeader.texturedTriangleCount = stream.getUnsignedByte();
		int useTextures = stream.getUnsignedByte();
		int useTrianglePriority = stream.getUnsignedByte();
		int useAlpha = stream.getUnsignedByte();
		int useTriangleSkins = stream.getUnsignedByte();
		int useVertexSkins = stream.getUnsignedByte();
		int dataLengthX = stream.getUnsignedLEShort();
		int dataLengthY = stream.getUnsignedLEShort();
		int dataLengthZ = stream.getUnsignedLEShort();
		int dataLengthTriangle = stream.getUnsignedLEShort();
		int offset = 0;
		modelHeader.vertexDirectionOffset = offset;
		offset += modelHeader.vertexCount;
		modelHeader.triangleTypeOffset = offset;
		offset += modelHeader.triangleCount;
		modelHeader.trianglePriorityOffset = offset;
		if (useTrianglePriority == 255)
			offset += modelHeader.triangleCount;
		else
			modelHeader.trianglePriorityOffset = -useTrianglePriority - 1;
		modelHeader.triangleSkinOffset = offset;
		if (useTriangleSkins == 1)
			offset += modelHeader.triangleCount;
		else
			modelHeader.triangleSkinOffset = -1;
		modelHeader.texturePointerOffset = offset;
		if (useTextures == 1)
			offset += modelHeader.triangleCount;
		else
			modelHeader.texturePointerOffset = -1;
		modelHeader.vertexSkinOffset = offset;
		if (useVertexSkins == 1)
			offset += modelHeader.vertexCount;
		else
			modelHeader.vertexSkinOffset = -1;
		modelHeader.triangleAlphaOffset = offset;
		if (useAlpha == 1)
			offset += modelHeader.triangleCount;
		else
			modelHeader.triangleAlphaOffset = -1;
		modelHeader.triangleDataOffset = offset;
		offset += dataLengthTriangle;
		modelHeader.colourDataOffset = offset;
		offset += modelHeader.triangleCount * 2;
		modelHeader.texturedTriangleOffset = offset;
		offset += modelHeader.texturedTriangleCount * 6;
		modelHeader.dataOffsetX = offset;
		offset += dataLengthX;
		modelHeader.dataOffsetY = offset;
		offset += dataLengthY;
		modelHeader.dataOffsetZ = offset;
		offset += dataLengthZ;
	}