Skip to content

JSON Geometry format 4

Venryx edited this page Jan 7, 2015 · 6 revisions

Work in progress.

Example of BufferGeometry

{
	"metadata": {
		"version": 4,
		"type": "BufferGeometry",
		"generator": "BufferGeometryExporter"
	},
	"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"
	},
	"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": 3.1,
		"type": "geometry",
		"generator": "GeometryExporter"
	},
	"vertices": [50,50,50,...],
	"normals": [1,0,0,...],
	"uvs": [[0,1,...]],
	"faces": [56,0,2,1,0,1,2,0,0,0,0,...]
}