Skip to content

JSON Geometry format 4

dreammaker edited this page Sep 9, 2015 · 6 revisions

Work in progress.

Example of BufferGeometry

{
	"metadata": {
		"version": 4,
		"type": "BufferGeometry",
		"generator": "BufferGeometryExporter"
	},
	"data": {
		"attributes": {
			"position": {
				"itemSize": 3,
				"type": "Float32Array",
				"array": [50,50,50,...]
			},
			"normal": {
				"itemSize": 3,
				"type": "Float32Array",
				"array": [1,0,0,...]
			},
			"uv": {
				"itemSize": 2,
				"type": "Float32Array",
				"array": [0,1,...]
			}
		},
		"boundingSphere": {
			"center": [0,0,0],
			"radius": 86.60254037844386
		}
	}
}

Example of Geometry

{
	"metadata": {
		"version": 4,
		"type": "Geometry",
		"generator": "GeometryExporter"
	},
	"data": {
		"indices": [0,1,2,...],
		"vertices": [50,50,50,...],
		"normals": [1,0,0,...],
		"uvs": [0,1,...]
	}
}

Refer to JSON Model format 3 for parsing the faces array.

{
	"metadata": {
		"version": 4.0,
		"type": "BufferGeometry",
		"generator": "BufferGeometryExporter"
	},
	"data": {
		"vertices": [50,50,50,...],
		"normals": [1,0,0,...],
		"uvs": [[0,1,...]],
		"faces": [56,0,2,1,0,1,2,0,0,0,0,...]
	}
}