Skip to content

Version 0.1 (libgdx 0.9.9)

MobiDevelop edited this page Nov 6, 2013 · 8 revisions

The G3DB and G3DJ file format, version 0.1

<root>:
{
	"version": [<majorversion>, <minorversion>]
	(, "meshes": [(<mesh> (, <mesh>)*)?])?
	(, "materials": [(<material> (, <material>)*)?])?
	(, "nodes": [(<node> (, <node>)*)?])?
	(, "animations": [(<animation> (, <animation>)*)?])?
}

<majorversion>: integer // always 0

<minorversion>: integer // always 1

<mesh>:
{
	"attributes": [<atribute> (, <attribute>)*],
	"vertices": [(<vertex> (, <vertex>)*)?],	// amount = <vertexcount>
	"parts": [(<meshpart> (, <meshpart>)*)?]
}

<attribute>: "POSITION"	| "NORMAL" | "COLOR" | "COLORPACKED" | "TANGENT" | "BINORMAL" | "TEXCOORD" | "BLENDWEIGHT"

<vertex>: (<float> (, <float>)*) // amount = <vertexsize>

<meshpart>:
{
	"id":	<meshpartid>,
	"type":	<primitivetype>,
	"indices": [(<index> (, <index>)*)?]
}

<meshpartid>: string // unique for all meshparts within the file

<primitivetype>: "TRIANGLES" | "LINES" | "POINTS" | "TRIANGLE_STRIP" | "LINE_STRIP"

<index>: integer // 0 <= <index> < <vertexcount>

<material>:
{
	"id": <materialid>
	(, "diffuse": <rgb>)?
	(, "ambient": <rgb>)?
	(, "emissive": <rgb>)?
	(, "specular": <rgb>)?
	(, "reflection": <rgb>)?
	(, "shininess": <float>)?
	(, "opacity": <float>)?
	(, "textures": [(<texture> (, <texture>)*)?])?
}

<materialid>: string // unique for all materials within the file

<rgb>: [<float>, <float>, <float>]

<texture>:
{
	"id": <textureid>,
	"filename": <string>,
	"type": <texturetype>
	(, "uvTranslation": [<float>, <float>])?
	(, "uvScaling": [<float>, <float>])?
}

<textureid>: string // unique for each texture-file

<texturetype>: "AMBIENT" | "BUMP" | "DIFFUSE" | "EMISSIVE" | "NONE" | "NORMAL" | "REFLECTION" | "SHININESS" | "SPECULAR" | "TRANSPARENCY"

<node>:
{
	"id": <nodeid>
	(, "translation": <xyz>)?
	(, "rotation": <quaternion>)?
	(, "scale": <xyz>)?
	(, "mesh": <string>)? // DEPRECATED
	(, "parts": [(<nodepart> (, <nodepart>)*)?])?
	(, "children": [(<node> (, <node>)*)?])?
}

<nodeid>: string // unique for each node

<xyz>: [<float>, <float>, <float>]

<quaternion>: [<float>, <float>, <float>]

<nodepart>:
{
	"meshpartid": <meshpartid>,
	"materialid": <materialid>
	(, "bones": [(<nodeid> (, <nodeid>)*)?])?
	(, "uvMapping": [(<uvmapping> (, <uvmapping>)*)?])?
}

<uvmapping>: [(<integer> (, <integer>)*)?])?

<animation>:
{
	"id": <animationid>
	(, "bones": [(<nodeanimation> (, <nodeanimation>)*)?])?
}

<nodeanimation>:
{
	"boneId": <nodeid>,
	"keyframes": [(<keyframe> (, <keyframe>)*)?]
}

<keyframe>:
{
	"keytime": <float>
	(, "translation": <xyz>)
	(, "rotation": <quaternion>)
	(, "scale": <xyz>)
}
Clone this wiki locally