Repository: qmuntal/gltf
Pull request #21 (2019-11-28 18:10:41)

Improve public API
* Use slice of pointers instead of slice of structs
* Improve enum naming
* buffer.Data is not a []byte instead of []uint8


Patch:
diff --git a/README.md b/README.md
index c1ad72b..f6f20f1 100644
--- a/README.md
+++ b/README.md
@@ -98,9 +98,9 @@ func main() {
   positionAccessor := m.AddPosition(0, [][3]float32{{43, 43, 0}, {83, 43, 0}, {63, 63, 40}, {43, 83, 0}, {83, 83, 0}})
   indicesAccessor := m.AddIndices(0, []uint8{0, 1, 2, 3, 1, 0, 0, 2, 3, 1, 4, 2, 4, 3, 2, 4, 1, 3})
   colorIndices := m.AddColor(0, [][3]uint8{{50, 155, 255}, {0, 100, 200}, {255, 155, 50}, {155, 155, 155}, {25, 25, 25}})
-  m.Document.Meshes = []gltf.Mesh{{
+  m.Document.Meshes = []*gltf.Mesh{{
     Name: "Pyramid",
-    Primitives: []gltf.Primitive{
+    Primitives: []*gltf.Primitive{
       {
         Indices: gltf.Index(indicesAccessor),
         Attributes: map[string]uint32{
@@ -110,7 +110,7 @@ func main() {
       },
     },
   }}
-  m.Nodes = []gltf.Node{{Name: "Root", Mesh: gltf.Index(0)}}
+  m.Nodes = []*gltf.Node{{Name: "Root", Mesh: gltf.Index(0)}}
   m.Scenes[0].Nodes = append(m.Scenes[0].Nodes, 0)
   if err := gltf.SaveBinary(m.Document, "./example.glb"); err != nil {
     panic(err)
@@ -134,36 +134,36 @@ import (
 
 func main() {
     doc := &gltf.Document{
-        Accessors: []gltf.Accessor{
-            {BufferView: gltf.Index(0), ComponentType: gltf.UnsignedShort, Count: 36, Type: gltf.Scalar},
-            {BufferView: gltf.Index(1), ComponentType: gltf.Float, Count: 24, Max: []float64{0.5, 0.5, 0.5}, Min: []float64{-0.5, -0.            -0.5}, Type: gltf.Vec3},
-            {BufferView: gltf.Index(2), ComponentType: gltf.Float, Count: 24, Type: gltf.Vec3},
-            {BufferView: gltf.Index(3), ComponentType: gltf.Float, Count: 24, Type: gltf.Vec4},
-            {BufferView: gltf.Index(4), ComponentType: gltf.Float, Count: 24, Type: gltf.Vec2},
+        Accessors: []*gltf.Accessor{
+            {BufferView: gltf.Index(0), ComponentType: gltf.ComponentUShort, Count: 36, Type: gltf.AccessorScalar},
+            {BufferView: gltf.Index(1), ComponentType: gltf.Float, Count: 24, Max: []float64{0.5, 0.5, 0.5}, Min: []float64{-0.5, -0.            -0.5}, Type: gltf.AccessorVec3},
+            {BufferView: gltf.Index(2), ComponentType: gltf.ComponentFloat, Count: 24, Type: gltf.AccessorVec3},
+            {BufferView: gltf.Index(3), ComponentType: gltf.ComponentFloat, Count: 24, Type: gltf.AccessorVec4},
+            {BufferView: gltf.Index(4), ComponentType: gltf.ComponentFloat, Count: 24, Type: gltf.AccessorVec2},
         },
         Asset: gltf.Asset{Version: "2.0", Generator: "FBX2glTF"},
-        BufferViews: []gltf.BufferView{
-            {Buffer: 0, ByteLength: 72, ByteOffset: 0, Target: gltf.ElementArrayBuffer},
-            {Buffer: 0, ByteLength: 288, ByteOffset: 72, Target: gltf.ArrayBuffer},
-            {Buffer: 0, ByteLength: 288, ByteOffset: 360, Target: gltf.ArrayBuffer},
-            {Buffer: 0, ByteLength: 384, ByteOffset: 648, Target: gltf.ArrayBuffer},
-            {Buffer: 0, ByteLength: 192, ByteOffset: 1032, Target: gltf.ArrayBuffer},
+        BufferViews: []*gltf.BufferView{
+            {Buffer: 0, ByteLength: 72, ByteOffset: 0, Target: gltf.TargetElementArrayBuffer},
+            {Buffer: 0, ByteLength: 288, ByteOffset: 72, Target: gltf.TargetArrayBuffer},
+            {Buffer: 0, ByteLength: 288, ByteOffset: 360, Target: gltf.TargetArrayBuffer},
+            {Buffer: 0, ByteLength: 384, ByteOffset: 648, Target: gltf.TargetArrayBuffer},
+            {Buffer: 0, ByteLength: 192, ByteOffset: 1032, Target: gltf.TargetArrayBuffer},
         },
-        Buffers: []gltf.Buffer{{ByteLength: 1224, URI: bufferData}},
-        Materials: []gltf.Material{{
-            Name: "Default", AlphaMode: gltf.Opaque, AlphaCutoff: gltf.Float64(0.5),
+        Buffers: []*gltf.Buffer{{ByteLength: 1224, URI: bufferData}},
+        Materials: []*gltf.Material{{
+            Name: "Default", AlphaMode: gltf.AlphaOpaque, AlphaCutoff: gltf.Float64(0.5),
             PBRMetallicRoughness: &gltf.PBRMetallicRoughness{BaseColorFactor: &gltf.RGBA{R: 0.8, G: 0.8, B: 0.8, A: 1}, MetallicFactor: gltf.Float64(0.1), RoughnessFactor: gltf.Float64(0.99)},
         }},
-        Meshes: []gltf.Mesh{{Name: "Cube", Primitives: []gltf.Primitive{{Indices: gltf.Index(0), Material: gltf.Index(0), Mode: gltf.Triangles, Attributes: map[string]uint32{"POSITION": 1, "COLOR_0": 3, "NORMAL": 2, "TEXCOORD_0": 4}}}}},
-        Nodes: []gltf.Node{
+        Meshes: []*gltf.Mesh{{Name: "Cube", Primitives: []*gltf.Primitive{{Indices: gltf.Index(0), Material: gltf.Index(0), Mode: gltf.PrimitiveTriangles, Attributes: map[string]uint32{"POSITION": 1, "COLOR_0": 3, "NORMAL": 2, "TEXCOORD_0": 4}}}}},
+        Nodes: []*gltf.Node{
             {Name: "RootNode", Children: []uint32{1, 2, 3}},
             {Name: "Mesh"},
             {Name: "Cube", Mesh: gltf.Index(0)},
             {Name: "Texture Group"},
         },
-        Samplers: []gltf.Sampler{{WrapS: gltf.Repeat, WrapT: gltf.Repeat}},
+        Samplers: []*gltf.Sampler{{WrapS: gltf.WrapRepeat, WrapT: gltf.WrapRepeat}},
         Scene:    gltf.Index(0),
-        Scenes:   []gltf.Scene{{Name: "Root Scene", Nodes: []uint32{0}}},
+        Scenes:   []*gltf.Scene{{Name: "Root Scene", Nodes: []uint32{0}}},
     }
     if err := gltf.Save(doc, "./cube.gltf"); err != nil {
         panic(err)
diff --git a/binary/binary.go b/binary/binary.go
index 8be232a..7833f26 100644
--- a/binary/binary.go
+++ b/binary/binary.go
@@ -36,17 +36,17 @@ import "encoding/binary"
 // Byte is the byte implementation of Component.
 var Byte byteComponent
 
-// UnsignedByte is the usnigned byte implementation of Component.
-var UnsignedByte ubyteComponent
+// Ubyte is the usnigned byte implementation of Component.
+var Ubyte ubyteComponent
 
 // Short is the byte short of Component.
 var Short shortComponent
 
-// UnsignedShort is the usnigned short implementation of Component.
-var UnsignedShort ushortComponent
+// Ushort is the usnigned short implementation of Component.
+var Ushort ushortComponent
 
-// UnsignedInt is the unsigned int implementation of Component.
-var UnsignedInt uintComponent
+// UInt is the unsigned int implementation of Component.
+var UInt uintComponent
 
 // Float is the float implementation of Component.
 var Float floatComponent
diff --git a/binary/encode.go b/binary/encode.go
index 5330683..a5b883c 100644
--- a/binary/encode.go
+++ b/binary/encode.go
@@ -26,12 +26,12 @@ func Read(b []byte, data interface{}) error {
 	switch data := data.(type) {
 	case []color.RGBA:
 		for i := range data {
-			c := UnsignedByte.Vec4(b[e*i:])
+			c := Ubyte.Vec4(b[e*i:])
 			data[i] = color.RGBA{R: c[0], G: c[1], B: c[2], A: c[3]}
 		}
 	case []color.RGBA64:
 		for i := range data {
-			c := UnsignedShort.Vec4(b[e*i:])
+			c := Ushort.Vec4(b[e*i:])
 			data[i] = color.RGBA64{R: c[0], G: c[1], B: c[2], A: c[3]}
 		}
 	case []gltf.RGBA:
@@ -76,27 +76,27 @@ func Read(b []byte, data interface{}) error {
 		copy(data, b)
 	case [][2]uint8:
 		for i := range data {
-			data[i] = UnsignedByte.Vec2(b[e*i:])
+			data[i] = Ubyte.Vec2(b[e*i:])
 		}
 	case [][3]uint8:
 		for i := range data {
-			data[i] = UnsignedByte.Vec3(b[e*i:])
+			data[i] = Ubyte.Vec3(b[e*i:])
 		}
 	case [][4]uint8:
 		for i := range data {
-			data[i] = UnsignedByte.Vec4(b[e*i:])
+			data[i] = Ubyte.Vec4(b[e*i:])
 		}
 	case [][2][2]uint8:
 		for i := range data {
-			data[i] = UnsignedByte.Mat2(b[e*i:])
+			data[i] = Ubyte.Mat2(b[e*i:])
 		}
 	case [][3][3]uint8:
 		for i := range data {
-			data[i] = UnsignedByte.Mat3(b[e*i:])
+			data[i] = Ubyte.Mat3(b[e*i:])
 		}
 	case [][4][4]uint8:
 		for i := range data {
-			data[i] = UnsignedByte.Mat4(b[e*i:])
+			data[i] = Ubyte.Mat4(b[e*i:])
 		}
 	case []int16:
 		for i := range data {
@@ -128,31 +128,31 @@ func Read(b []byte, data interface{}) error {
 		}
 	case []uint16:
 		for i := range data {
-			data[i] = UnsignedShort.Scalar(b[e*i:])
+			data[i] = Ushort.Scalar(b[e*i:])
 		}
 	case [][2]uint16:
 		for i := range data {
-			data[i] = UnsignedShort.Vec2(b[e*i:])
+			data[i] = Ushort.Vec2(b[e*i:])
 		}
 	case [][3]uint16:
 		for i := range data {
-			data[i] = UnsignedShort.Vec3(b[e*i:])
+			data[i] = Ushort.Vec3(b[e*i:])
 		}
 	case [][4]uint16:
 		for i := range data {
-			data[i] = UnsignedShort.Vec4(b[e*i:])
+			data[i] = Ushort.Vec4(b[e*i:])
 		}
 	case [][2][2]uint16:
 		for i := range data {
-			data[i] = UnsignedShort.Mat2(b[e*i:])
+			data[i] = Ushort.Mat2(b[e*i:])
 		}
 	case [][3][3]uint16:
 		for i := range data {
-			data[i] = UnsignedShort.Mat3(b[e*i:])
+			data[i] = Ushort.Mat3(b[e*i:])
 		}
 	case [][4][4]uint16:
 		for i := range data {
-			data[i] = UnsignedShort.Mat4(b[e*i:])
+			data[i] = Ushort.Mat4(b[e*i:])
 		}
 	case []float32:
 		for i := range data {
@@ -184,31 +184,31 @@ func Read(b []byte, data interface{}) error {
 		}
 	case []uint32:
 		for i := range data {
-			data[i] = UnsignedInt.Scalar(b[e*i:])
+			data[i] = UInt.Scalar(b[e*i:])
 		}
 	case [][2]uint32:
 		for i := range data {
-			data[i] = UnsignedInt.Vec2(b[e*i:])
+			data[i] = UInt.Vec2(b[e*i:])
 		}
 	case [][3]uint32:
 		for i := range data {
-			data[i] = UnsignedInt.Vec3(b[e*i:])
+			data[i] = UInt.Vec3(b[e*i:])
 		}
 	case [][4]uint32:
 		for i := range data {
-			data[i] = UnsignedInt.Vec4(b[e*i:])
+			data[i] = UInt.Vec4(b[e*i:])
 		}
 	case [][2][2]uint32:
 		for i := range data {
-			data[i] = UnsignedInt.Mat2(b[e*i:])
+			data[i] = UInt.Mat2(b[e*i:])
 		}
 	case [][3][3]uint32:
 		for i := range data {
-			data[i] = UnsignedInt.Mat3(b[e*i:])
+			data[i] = UInt.Mat3(b[e*i:])
 		}
 	case [][4][4]uint32:
 		for i := range data {
-			data[i] = UnsignedInt.Mat4(b[e*i:])
+			data[i] = UInt.Mat4(b[e*i:])
 		}
 	}
 	return nil
@@ -229,11 +229,11 @@ func Write(b []byte, data interface{}) error {
 	switch data := data.(type) {
 	case []color.RGBA:
 		for i, x := range data {
-			UnsignedByte.PutVec4(b[e*i:], [4]uint8{x.R, x.G, x.B, x.A})
+			Ubyte.PutVec4(b[e*i:], [4]uint8{x.R, x.G, x.B, x.A})
 		}
 	case []color.RGBA64:
 		for i, x := range data {
-			UnsignedShort.PutVec4(b[e*i:], [4]uint16{x.R, x.G, x.B, x.A})
+			Ushort.PutVec4(b[e*i:], [4]uint16{x.R, x.G, x.B, x.A})
 		}
 	case []gltf.RGBA:
 		for i, x := range data {
@@ -275,27 +275,27 @@ func Write(b []byte, data interface{}) error {
 		copy(b, data)
 	case [][2]uint8:
 		for i := range data {
-			UnsignedByte.PutVec2(b[e*i:], data[i])
+			Ubyte.PutVec2(b[e*i:], data[i])
 		}
 	case [][3]uint8:
 		for i := range data {
-			UnsignedByte.PutVec3(b[e*i:], data[i])
+			Ubyte.PutVec3(b[e*i:], data[i])
 		}
 	case [][4]uint8:
 		for i := range data {
-			UnsignedByte.PutVec4(b[e*i:], data[i])
+			Ubyte.PutVec4(b[e*i:], data[i])
 		}
 	case [][2][2]uint8:
 		for i := range data {
-			UnsignedByte.PutMat2(b[e*i:], data[i])
+			Ubyte.PutMat2(b[e*i:], data[i])
 		}
 	case [][3][3]uint8:
 		for i := range data {
-			UnsignedByte.PutMat3(b[e*i:], data[i])
+			Ubyte.PutMat3(b[e*i:], data[i])
 		}
 	case [][4][4]uint8:
 		for i := range data {
-			UnsignedByte.PutMat4(b[e*i:], data[i])
+			Ubyte.PutMat4(b[e*i:], data[i])
 		}
 	case []int16:
 		for i := range data {
@@ -327,31 +327,31 @@ func Write(b []byte, data interface{}) error {
 		}
 	case []uint16:
 		for i := range data {
-			UnsignedShort.PutScalar(b[e*i:], data[i])
+			Ushort.PutScalar(b[e*i:], data[i])
 		}
 	case [][2]uint16:
 		for i := range data {
-			UnsignedShort.PutVec2(b[e*i:], data[i])
+			Ushort.PutVec2(b[e*i:], data[i])
 		}
 	case [][3]uint16:
 		for i := range data {
-			UnsignedShort.PutVec3(b[e*i:], data[i])
+			Ushort.PutVec3(b[e*i:], data[i])
 		}
 	case [][4]uint16:
 		for i := range data {
-			UnsignedShort.PutVec4(b[e*i:], data[i])
+			Ushort.PutVec4(b[e*i:], data[i])
 		}
 	case [][2][2]uint16:
 		for i := range data {
-			UnsignedShort.PutMat2(b[e*i:], data[i])
+			Ushort.PutMat2(b[e*i:], data[i])
 		}
 	case [][3][3]uint16:
 		for i := range data {
-			UnsignedShort.PutMat3(b[e*i:], data[i])
+			Ushort.PutMat3(b[e*i:], data[i])
 		}
 	case [][4][4]uint16:
 		for i := range data {
-			UnsignedShort.PutMat4(b[e*i:], data[i])
+			Ushort.PutMat4(b[e*i:], data[i])
 		}
 	case []float32:
 		for i := range data {
@@ -383,31 +383,31 @@ func Write(b []byte, data interface{}) error {
 		}
 	case []uint32:
 		for i := range data {
-			UnsignedInt.PutScalar(b[e*i:], data[i])
+			UInt.PutScalar(b[e*i:], data[i])
 		}
 	case [][2]uint32:
 		for i := range data {
-			UnsignedInt.PutVec2(b[e*i:], data[i])
+			UInt.PutVec2(b[e*i:], data[i])
 		}
 	case [][3]uint32:
 		for i := range data {
-			UnsignedInt.PutVec3(b[e*i:], data[i])
+			UInt.PutVec3(b[e*i:], data[i])
 		}
 	case [][4]uint32:
 		for i := range data {
-			UnsignedInt.PutVec4(b[e*i:], data[i])
+			UInt.PutVec4(b[e*i:], data[i])
 		}
 	case [][2][2]uint32:
 		for i := range data {
-			UnsignedInt.PutMat2(b[e*i:], data[i])
+			UInt.PutMat2(b[e*i:], data[i])
 		}
 	case [][3][3]uint32:
 		for i := range data {
-			UnsignedInt.PutMat3(b[e*i:], data[i])
+			UInt.PutMat3(b[e*i:], data[i])
 		}
 	case [][4][4]uint32:
 		for i := range data {
-			UnsignedInt.PutMat4(b[e*i:], data[i])
+			UInt.PutMat4(b[e*i:], data[i])
 		}
 	}
 	return nil
diff --git a/binary/size.go b/binary/size.go
index 72d3364..62066a1 100644
--- a/binary/size.go
+++ b/binary/size.go
@@ -10,25 +10,25 @@ import (
 // SizeOf returns the size, in bytes, of a component type.
 func SizeOf(c gltf.ComponentType) int {
 	return map[gltf.ComponentType]int{
-		gltf.Byte:          1,
-		gltf.UnsignedByte:  1,
-		gltf.Short:         2,
-		gltf.UnsignedShort: 2,
-		gltf.UnsignedInt:   4,
-		gltf.Float:         4,
+		gltf.ComponentByte:   1,
+		gltf.ComponentUbyte:  1,
+		gltf.ComponentShort:  2,
+		gltf.ComponentUshort: 2,
+		gltf.ComponentUint:   4,
+		gltf.ComponentFloat:  4,
 	}[c]
 }
 
 // ComponentsOf returns the number of components of an accessor type.
 func ComponentsOf(t gltf.AccessorType) int {
 	return map[gltf.AccessorType]int{
-		gltf.Scalar: 1,
-		gltf.Vec2:   2,
-		gltf.Vec3:   3,
-		gltf.Vec4:   4,
-		gltf.Mat2:   4,
-		gltf.Mat3:   9,
-		gltf.Mat4:   16,
+		gltf.AccessorScalar: 1,
+		gltf.AccessorVec2:   2,
+		gltf.AccessorVec3:   3,
+		gltf.AccessorVec4:   4,
+		gltf.AccessorMat2:   4,
+		gltf.AccessorMat3:   9,
+		gltf.AccessorMat4:   16,
 	}[t]
 }
 
@@ -39,15 +39,15 @@ func ComponentsOf(t gltf.AccessorType) int {
 func SizeOfElement(c gltf.ComponentType, t gltf.AccessorType) int {
 	// special cases
 	switch {
-	case (t == gltf.Vec3 || t == gltf.Vec2) && (c == gltf.Byte || c == gltf.UnsignedByte):
+	case (t == gltf.AccessorVec3 || t == gltf.AccessorVec2) && (c == gltf.ComponentByte || c == gltf.ComponentUbyte):
 		return 4
-	case t == gltf.Vec3 && (c == gltf.Short || c == gltf.UnsignedShort):
+	case t == gltf.AccessorVec3 && (c == gltf.ComponentShort || c == gltf.ComponentUshort):
 		return 8
-	case t == gltf.Mat2 && (c == gltf.Byte || c == gltf.UnsignedByte):
+	case t == gltf.AccessorMat2 && (c == gltf.ComponentByte || c == gltf.ComponentUbyte):
 		return 8
-	case t == gltf.Mat3 && (c == gltf.Byte || c == gltf.UnsignedByte):
+	case t == gltf.AccessorMat3 && (c == gltf.ComponentByte || c == gltf.ComponentUbyte):
 		return 12
-	case t == gltf.Mat3 && (c == gltf.Short || c == gltf.UnsignedShort):
+	case t == gltf.AccessorMat3 && (c == gltf.ComponentShort || c == gltf.ComponentUshort):
 		return 24
 	}
 	return SizeOf(c) * ComponentsOf(t)
@@ -64,89 +64,89 @@ func Type(data interface{}) (c gltf.ComponentType, t gltf.AccessorType, length i
 	}
 	switch data.(type) {
 	case []int8, int8:
-		c, t = gltf.Byte, gltf.Scalar
+		c, t = gltf.ComponentByte, gltf.AccessorScalar
 	case [][2]int8, [2]int8:
-		c, t = gltf.Byte, gltf.Vec2
+		c, t = gltf.ComponentByte, gltf.AccessorVec2
 	case [][3]int8, [3]int8:
-		c, t = gltf.Byte, gltf.Vec3
+		c, t = gltf.ComponentByte, gltf.AccessorVec3
 	case [][4]int8, [4]int8:
-		c, t = gltf.Byte, gltf.Vec4
+		c, t = gltf.ComponentByte, gltf.AccessorVec4
 	case [][2][2]int8, [2][2]int8:
-		c, t = gltf.Byte, gltf.Mat2
+		c, t = gltf.ComponentByte, gltf.AccessorMat2
 	case [][3][3]int8, [3][3]int8:
-		c, t = gltf.Byte, gltf.Mat3
+		c, t = gltf.ComponentByte, gltf.AccessorMat3
 	case [][4][4]int8, [4][4]int8:
-		c, t = gltf.Byte, gltf.Mat4
+		c, t = gltf.ComponentByte, gltf.AccessorMat4
 	case []uint8, uint8:
-		c, t = gltf.UnsignedByte, gltf.Scalar
+		c, t = gltf.ComponentUbyte, gltf.AccessorScalar
 	case [][2]uint8, [2]uint8:
-		c, t = gltf.UnsignedByte, gltf.Vec2
+		c, t = gltf.ComponentUbyte, gltf.AccessorVec2
 	case [][3]uint8, [3]uint8:
-		c, t = gltf.UnsignedByte, gltf.Vec3
+		c, t = gltf.ComponentUbyte, gltf.AccessorVec3
 	case []color.RGBA, color.RGBA, [][4]uint8, [4]uint8:
-		c, t = gltf.UnsignedByte, gltf.Vec4
+		c, t = gltf.ComponentUbyte, gltf.AccessorVec4
 	case [][2][2]uint8, [2][2]uint8:
-		c, t = gltf.UnsignedByte, gltf.Mat2
+		c, t = gltf.ComponentUbyte, gltf.AccessorMat2
 	case [][3][3]uint8, [3][3]uint8:
-		c, t = gltf.UnsignedByte, gltf.Mat3
+		c, t = gltf.ComponentUbyte, gltf.AccessorMat3
 	case [][4][4]uint8, [4][4]uint8:
-		c, t = gltf.UnsignedByte, gltf.Mat4
+		c, t = gltf.ComponentUbyte, gltf.AccessorMat4
 	case []int16, int16:
-		c, t = gltf.Short, gltf.Scalar
+		c, t = gltf.ComponentShort, gltf.AccessorScalar
 	case [][2]int16, [2]int16:
-		c, t = gltf.Short, gltf.Vec2
+		c, t = gltf.ComponentShort, gltf.AccessorVec2
 	case [][3]int16, [3]int16:
-		c, t = gltf.Short, gltf.Vec3
+		c, t = gltf.ComponentShort, gltf.AccessorVec3
 	case [][4]int16, [4]int16:
-		c, t = gltf.Short, gltf.Vec4
+		c, t = gltf.ComponentShort, gltf.AccessorVec4
 	case [][2][2]int16, [2][2]int16:
-		c, t = gltf.Short, gltf.Mat2
+		c, t = gltf.ComponentShort, gltf.AccessorMat2
 	case [][3][3]int16, [3][3]int16:
-		c, t = gltf.Short, gltf.Mat3
+		c, t = gltf.ComponentShort, gltf.AccessorMat3
 	case [][4][4]int16, [4][4]int16:
-		c, t = gltf.Short, gltf.Mat4
+		c, t = gltf.ComponentShort, gltf.AccessorMat4
 	case []uint16, uint16:
-		c, t = gltf.UnsignedShort, gltf.Scalar
+		c, t = gltf.ComponentUshort, gltf.AccessorScalar
 	case [][2]uint16, [2]uint16:
-		c, t = gltf.UnsignedShort, gltf.Vec2
+		c, t = gltf.ComponentUshort, gltf.AccessorVec2
 	case [][3]uint16, [3]uint16:
-		c, t = gltf.UnsignedShort, gltf.Vec3
+		c, t = gltf.ComponentUshort, gltf.AccessorVec3
 	case []color.RGBA64, color.RGBA64, [][4]uint16, [4]uint16:
-		c, t = gltf.UnsignedShort, gltf.Vec4
+		c, t = gltf.ComponentUshort, gltf.AccessorVec4
 	case [][2][2]uint16, [2][2]uint16:
-		c, t = gltf.UnsignedShort, gltf.Mat2
+		c, t = gltf.ComponentUshort, gltf.AccessorMat2
 	case [][3][3]uint16, [3][3]uint16:
-		c, t = gltf.UnsignedShort, gltf.Mat3
+		c, t = gltf.ComponentUshort, gltf.AccessorMat3
 	case [][4][4]uint16, [4][4]uint16:
-		c, t = gltf.UnsignedShort, gltf.Mat4
+		c, t = gltf.ComponentUshort, gltf.AccessorMat4
 	case []uint32, uint32:
-		c, t = gltf.UnsignedInt, gltf.Scalar
+		c, t = gltf.ComponentUint, gltf.AccessorScalar
 	case [][2]uint32, [2]uint32:
-		c, t = gltf.UnsignedInt, gltf.Vec2
+		c, t = gltf.ComponentUint, gltf.AccessorVec2
 	case [][3]uint32, [3]uint32:
-		c, t = gltf.UnsignedInt, gltf.Vec3
+		c, t = gltf.ComponentUint, gltf.AccessorVec3
 	case [][4]uint32, [4]uint32:
-		c, t = gltf.UnsignedInt, gltf.Vec4
+		c, t = gltf.ComponentUint, gltf.AccessorVec4
 	case [][2][2]uint32, [2][2]uint32:
-		c, t = gltf.UnsignedInt, gltf.Mat2
+		c, t = gltf.ComponentUint, gltf.AccessorMat2
 	case [][3][3]uint32, [3][3]uint32:
-		c, t = gltf.UnsignedInt, gltf.Mat3
+		c, t = gltf.ComponentUint, gltf.AccessorMat3
 	case [][4][4]uint32, [4][4]uint32:
-		c, t = gltf.UnsignedInt, gltf.Mat4
+		c, t = gltf.ComponentUint, gltf.AccessorMat4
 	case []float32, float32:
-		c, t = gltf.Float, gltf.Scalar
+		c, t = gltf.ComponentFloat, gltf.AccessorScalar
 	case [][2]float32, [2]float32:
-		c, t = gltf.Float, gltf.Vec2
+		c, t = gltf.ComponentFloat, gltf.AccessorVec2
 	case []gltf.RGB, gltf.RGB, [][3]float32, [3]float32:
-		c, t = gltf.Float, gltf.Vec3
+		c, t = gltf.ComponentFloat, gltf.AccessorVec3
 	case []gltf.RGBA, gltf.RGBA, [][4]float32, [4]float32:
-		c, t = gltf.Float, gltf.Vec4
+		c, t = gltf.ComponentFloat, gltf.AccessorVec4
 	case [][2][2]float32, [2][2]float32:
-		c, t = gltf.Float, gltf.Mat2
+		c, t = gltf.ComponentFloat, gltf.AccessorMat2
 	case [][3][3]float32, [3][3]float32:
-		c, t = gltf.Float, gltf.Mat3
+		c, t = gltf.ComponentFloat, gltf.AccessorMat3
 	case [][4][4]float32, [4][4]float32:
-		c, t = gltf.Float, gltf.Mat4
+		c, t = gltf.ComponentFloat, gltf.AccessorMat4
 	default:
 		length = -1
 	}
diff --git a/binary/unsafe.go b/binary/unsafe.go
index 9b6d6be..910d86c 100644
--- a/binary/unsafe.go
+++ b/binary/unsafe.go
@@ -9,190 +9,190 @@ type shortComponent struct{}
 type floatComponent struct{}
 
 func (byteComponent) Scalar(b []byte) int8 {
-	v := UnsignedByte.Scalar(b)
+	v := Ubyte.Scalar(b)
 	return *(*int8)(unsafe.Pointer(&v))
 }
 
 func (byteComponent) PutScalar(b []byte, v int8) {
-	UnsignedByte.PutScalar(b, *(*uint8)(unsafe.Pointer(&v)))
+	Ubyte.PutScalar(b, *(*uint8)(unsafe.Pointer(&v)))
 }
 
 func (byteComponent) Vec2(b []byte) [2]int8 {
-	v := UnsignedByte.Vec2(b)
+	v := Ubyte.Vec2(b)
 	return *(*[2]int8)(unsafe.Pointer(&v))
 }
 
 func (byteComponent) PutVec2(b []byte, v [2]int8) {
-	UnsignedByte.PutVec2(b, *(*[2]uint8)(unsafe.Pointer(&v)))
+	Ubyte.PutVec2(b, *(*[2]uint8)(unsafe.Pointer(&v)))
 }
 
 func (byteComponent) Vec3(b []byte) [3]int8 {
-	v := UnsignedByte.Vec3(b)
+	v := Ubyte.Vec3(b)
 	return *(*[3]int8)(unsafe.Pointer(&v))
 }
 
 func (byteComponent) PutVec3(b []byte, v [3]int8) {
-	UnsignedByte.PutVec3(b, *(*[3]uint8)(unsafe.Pointer(&v)))
+	Ubyte.PutVec3(b, *(*[3]uint8)(unsafe.Pointer(&v)))
 }
 
 func (byteComponent) Vec4(b []byte) [4]int8 {
-	v := UnsignedByte.Vec4(b)
+	v := Ubyte.Vec4(b)
 	return *(*[4]int8)(unsafe.Pointer(&v))
 }
 
 func (byteComponent) PutVec4(b []byte, v [4]int8) {
-	UnsignedByte.PutVec4(b, *(*[4]uint8)(unsafe.Pointer(&v)))
+	Ubyte.PutVec4(b, *(*[4]uint8)(unsafe.Pointer(&v)))
 }
 
 func (byteComponent) Mat2(b []byte) [2][2]int8 {
-	v := UnsignedByte.Mat2(b)
+	v := Ubyte.Mat2(b)
 	return *(*[2][2]int8)(unsafe.Pointer(&v))
 }
 
 func (byteComponent) PutMat2(b []byte, v [2][2]int8) {
-	UnsignedByte.PutMat2(b, *(*[2][2]uint8)(unsafe.Pointer(&v)))
+	Ubyte.PutMat2(b, *(*[2][2]uint8)(unsafe.Pointer(&v)))
 }
 
 func (byteComponent) Mat3(b []byte) [3][3]int8 {
-	v := UnsignedByte.Mat3(b)
+	v := Ubyte.Mat3(b)
 	return *(*[3][3]int8)(unsafe.Pointer(&v))
 }
 
 func (byteComponent) PutMat3(b []byte, v [3][3]int8) {
-	UnsignedByte.PutMat3(b, *(*[3][3]uint8)(unsafe.Pointer(&v)))
+	Ubyte.PutMat3(b, *(*[3][3]uint8)(unsafe.Pointer(&v)))
 }
 
 func (byteComponent) Mat4(b []byte) [4][4]int8 {
-	v := UnsignedByte.Mat4(b)
+	v := Ubyte.Mat4(b)
 	return *(*[4][4]int8)(unsafe.Pointer(&v))
 }
 
 func (byteComponent) PutMat4(b []byte, v [4][4]int8) {
-	UnsignedByte.PutMat4(b, *(*[4][4]uint8)(unsafe.Pointer(&v)))
+	Ubyte.PutMat4(b, *(*[4][4]uint8)(unsafe.Pointer(&v)))
 }
 
 func (shortComponent) Scalar(b []byte) int16 {
-	v := UnsignedShort.Scalar(b)
+	v := Ushort.Scalar(b)
 	return *(*int16)(unsafe.Pointer(&v))
 }
 
 func (shortComponent) PutScalar(b []byte, v int16) {
-	UnsignedShort.PutScalar(b, *(*uint16)(unsafe.Pointer(&v)))
+	Ushort.PutScalar(b, *(*uint16)(unsafe.Pointer(&v)))
 }
 
 func (shortComponent) Vec2(b []byte) [2]int16 {
-	v := UnsignedShort.Vec2(b)
+	v := Ushort.Vec2(b)
 	return *(*[2]int16)(unsafe.Pointer(&v))
 }
 
 func (shortComponent) PutVec2(b []byte, v [2]int16) {
-	UnsignedShort.PutVec2(b, *(*[2]uint16)(unsafe.Pointer(&v)))
+	Ushort.PutVec2(b, *(*[2]uint16)(unsafe.Pointer(&v)))
 }
 
 func (shortComponent) Vec3(b []byte) [3]int16 {
-	v := UnsignedShort.Vec3(b)
+	v := Ushort.Vec3(b)
 	return *(*[3]int16)(unsafe.Pointer(&v))
 }
 
 func (shortComponent) PutVec3(b []byte, v [3]int16) {
-	UnsignedShort.PutVec3(b, *(*[3]uint16)(unsafe.Pointer(&v)))
+	Ushort.PutVec3(b, *(*[3]uint16)(unsafe.Pointer(&v)))
 }
 
 func (shortComponent) Vec4(b []byte) [4]int16 {
-	v := UnsignedShort.Vec4(b)
+	v := Ushort.Vec4(b)
 	return *(*[4]int16)(unsafe.Pointer(&v))
 }
 
 func (shortComponent) PutVec4(b []byte, v [4]int16) {
-	UnsignedShort.PutVec4(b, *(*[4]uint16)(unsafe.Pointer(&v)))
+	Ushort.PutVec4(b, *(*[4]uint16)(unsafe.Pointer(&v)))
 }
 
 func (shortComponent) Mat2(b []byte) [2][2]int16 {
-	v := UnsignedShort.Mat2(b)
+	v := Ushort.Mat2(b)
 	return *(*[2][2]int16)(unsafe.Pointer(&v))
 }
 
 func (shortComponent) PutMat2(b []byte, v [2][2]int16) {
-	UnsignedShort.PutMat2(b, *(*[2][2]uint16)(unsafe.Pointer(&v)))
+	Ushort.PutMat2(b, *(*[2][2]uint16)(unsafe.Pointer(&v)))
 }
 
 func (shortComponent) Mat3(b []byte) [3][3]int16 {
-	v := UnsignedShort.Mat3(b)
+	v := Ushort.Mat3(b)
 	return *(*[3][3]int16)(unsafe.Pointer(&v))
 }
 
 func (shortComponent) PutMat3(b []byte, v [3][3]int16) {
-	UnsignedShort.PutMat3(b, *(*[3][3]uint16)(unsafe.Pointer(&v)))
+	Ushort.PutMat3(b, *(*[3][3]uint16)(unsafe.Pointer(&v)))
 }
 
 func (shortComponent) Mat4(b []byte) [4][4]int16 {
-	v := UnsignedShort.Mat4(b)
+	v := Ushort.Mat4(b)
 	return *(*[4][4]int16)(unsafe.Pointer(&v))
 }
 
 func (shortComponent) PutMat4(b []byte, v [4][4]int16) {
-	UnsignedShort.PutMat4(b, *(*[4][4]uint16)(unsafe.Pointer(&v)))
+	Ushort.PutMat4(b, *(*[4][4]uint16)(unsafe.Pointer(&v)))
 }
 
 func (floatComponent) Scalar(b []byte) float32 {
-	v := UnsignedInt.Scalar(b)
+	v := UInt.Scalar(b)
 	return *(*float32)(unsafe.Pointer(&v))
 }
 
 func (floatComponent) PutScalar(b []byte, v float32) {
-	UnsignedInt.PutScalar(b, *(*uint32)(unsafe.Pointer(&v)))
+	UInt.PutScalar(b, *(*uint32)(unsafe.Pointer(&v)))
 }
 
 func (floatComponent) Vec2(b []byte) [2]float32 {
-	v := UnsignedInt.Vec2(b)
+	v := UInt.Vec2(b)
 	return *(*[2]float32)(unsafe.Pointer(&v))
 }
 
 func (floatComponent) PutVec2(b []byte, v [2]float32) {
-	UnsignedInt.PutVec2(b, *(*[2]uint32)(unsafe.Pointer(&v)))
+	UInt.PutVec2(b, *(*[2]uint32)(unsafe.Pointer(&v)))
 }
 
 func (floatComponent) Vec3(b []byte) [3]float32 {
-	v := UnsignedInt.Vec3(b)
+	v := UInt.Vec3(b)
 	return *(*[3]float32)(unsafe.Pointer(&v))
 }
 
 func (floatComponent) PutVec3(b []byte, v [3]float32) {
-	UnsignedInt.PutVec3(b, *(*[3]uint32)(unsafe.Pointer(&v)))
+	UInt.PutVec3(b, *(*[3]uint32)(unsafe.Pointer(&v)))
 }
 
 func (floatComponent) Vec4(b []byte) [4]float32 {
-	v := UnsignedInt.Vec4(b)
+	v := UInt.Vec4(b)
 	return *(*[4]float32)(unsafe.Pointer(&v))
 }
 
 func (floatComponent) PutVec4(b []byte, v [4]float32) {
-	UnsignedInt.PutVec4(b, *(*[4]uint32)(unsafe.Pointer(&v)))
+	UInt.PutVec4(b, *(*[4]uint32)(unsafe.Pointer(&v)))
 }
 
 func (floatComponent) Mat2(b []byte) [2][2]float32 {
-	v := UnsignedInt.Mat2(b)
+	v := UInt.Mat2(b)
 	return *(*[2][2]float32)(unsafe.Pointer(&v))
 }
 
 func (floatComponent) PutMat2(b []byte, v [2][2]float32) {
-	UnsignedInt.PutMat2(b, *(*[2][2]uint32)(unsafe.Pointer(&v)))
+	UInt.PutMat2(b, *(*[2][2]uint32)(unsafe.Pointer(&v)))
 }
 
 func (floatComponent) Mat3(b []byte) [3][3]float32 {
-	v := UnsignedInt.Mat3(b)
+	v := UInt.Mat3(b)
 	return *(*[3][3]float32)(unsafe.Pointer(&v))
 }
 
 func (floatComponent) PutMat3(b []byte, v [3][3]float32) {
-	UnsignedInt.PutMat3(b, *(*[3][3]uint32)(unsafe.Pointer(&v)))
+	UInt.PutMat3(b, *(*[3][3]uint32)(unsafe.Pointer(&v)))
 }
 
 func (floatComponent) Mat4(b []byte) [4][4]float32 {
-	v := UnsignedInt.Mat4(b)
+	v := UInt.Mat4(b)
 	return *(*[4][4]float32)(unsafe.Pointer(&v))
 }
 
 func (floatComponent) PutMat4(b []byte, v [4][4]float32) {
-	UnsignedInt.PutMat4(b, *(*[4][4]uint32)(unsafe.Pointer(&v)))
+	UInt.PutMat4(b, *(*[4][4]uint32)(unsafe.Pointer(&v)))
 }
diff --git a/const.go b/const.go
index be3d6af..7c408ce 100644
--- a/const.go
+++ b/const.go
@@ -24,18 +24,18 @@ var (
 type ComponentType uint16
 
 const (
-	// Float corresponds to a Float32Array.
-	Float ComponentType = iota
-	// Byte corresponds to a Int8Array.
-	Byte
-	// UnsignedByte corresponds to a Uint8Array.
-	UnsignedByte
-	// Short corresponds to a Int16Array.
-	Short
-	// UnsignedShort corresponds to a Uint16Array.
-	UnsignedShort
-	// UnsignedInt corresponds to a Uint32Array.
-	UnsignedInt
+	// ComponentFloat corresponds to a Float32Array.
+	ComponentFloat ComponentType = iota
+	// ComponentByte corresponds to a Int8Array.
+	ComponentByte
+	// ComponentUbyte corresponds to a Uint8Array.
+	ComponentUbyte
+	// ComponentShort corresponds to a Int16Array.
+	ComponentShort
+	// ComponentUshort corresponds to a Uint16Array.
+	ComponentUshort
+	// ComponentUint corresponds to a Uint32Array.
+	ComponentUint
 )
 
 // UnmarshalJSON unmarshal the component type with the correct default values.
@@ -44,12 +44,12 @@ func (c *ComponentType) UnmarshalJSON(data []byte) error {
 	err := json.Unmarshal(data, &tmp)
 	if err == nil {
 		*c = map[uint16]ComponentType{
-			5120: Byte,
-			5121: UnsignedByte,
-			5122: Short,
-			5123: UnsignedShort,
-			5125: UnsignedInt,
-			5126: Float,
+			5120: ComponentByte,
+			5121: ComponentUbyte,
+			5122: ComponentShort,
+			5123: ComponentUshort,
+			5125: ComponentUint,
+			5126: ComponentFloat,
 		}[tmp]
 	}
 	return err
@@ -58,12 +58,12 @@ func (c *ComponentType) UnmarshalJSON(data []byte) error {
 // MarshalJSON marshal the component type with the correct default values.
 func (c *ComponentType) MarshalJSON() ([]byte, error) {
 	return json.Marshal(map[ComponentType]uint16{
-		Byte:          5120,
-		UnsignedByte:  5121,
-		Short:         5122,
-		UnsignedShort: 5123,
-		UnsignedInt:   5125,
-		Float:         5126,
+		ComponentByte:   5120,
+		ComponentUbyte:  5121,
+		ComponentShort:  5122,
+		ComponentUshort: 5123,
+		ComponentUint:   5125,
+		ComponentFloat:  5126,
 	}[*c])
 }
 
@@ -71,20 +71,20 @@ func (c *ComponentType) MarshalJSON() ([]byte, error) {
 type AccessorType uint8
 
 const (
-	// Scalar corresponds to a single dimension value.
-	Scalar AccessorType = iota
-	// Vec2 corresponds to a two dimensions array.
-	Vec2
-	// Vec3 corresponds to a three dimensions array.
-	Vec3
-	// Vec4 corresponds to a four dimensions array.
-	Vec4
-	// Mat2 corresponds to a 2x2 matrix.
-	Mat2
-	// Mat3 corresponds to a 3x3 matrix.
-	Mat3
-	// Mat4 corresponds to a 4x4 matrix.
-	Mat4
+	// AccessorScalar corresponds to a single dimension value.
+	AccessorScalar AccessorType = iota
+	// AccessorVec2 corresponds to a two dimensions array.
+	AccessorVec2
+	// AccessorVec3 corresponds to a three dimensions array.
+	AccessorVec3
+	// AccessorVec4 corresponds to a four dimensions array.
+	AccessorVec4
+	// AccessorMat2 corresponds to a 2x2 matrix.
+	AccessorMat2
+	// AccessorMat3 corresponds to a 3x3 matrix.
+	AccessorMat3
+	// AccessorMat4 corresponds to a 4x4 matrix.
+	AccessorMat4
 )
 
 // UnmarshalJSON unmarshal the accessor type with the correct default values.
@@ -93,13 +93,13 @@ func (a *AccessorType) UnmarshalJSON(data []byte) error {
 	err := json.Unmarshal(data, &tmp)
 	if err == nil {
 		*a = map[string]AccessorType{
-			"SCALAR": Scalar,
-			"VEC2":   Vec2,
-			"VEC3":   Vec3,
-			"VEC4":   Vec4,
-			"MAT2":   Mat2,
-			"MAT3":   Mat3,
-			"MAT4":   Mat4,
+			"SCALAR": AccessorScalar,
+			"VEC2":   AccessorVec2,
+			"VEC3":   AccessorVec3,
+			"VEC4":   AccessorVec4,
+			"MAT2":   AccessorMat2,
+			"MAT3":   AccessorMat3,
+			"MAT4":   AccessorMat4,
 		}[tmp]
 	}
 	return err
@@ -108,13 +108,13 @@ func (a *AccessorType) UnmarshalJSON(data []byte) error {
 // MarshalJSON marshal the accessor type with the correct default values.
 func (a *AccessorType) MarshalJSON() ([]byte, error) {
 	return json.Marshal(map[AccessorType]string{
-		Scalar: "SCALAR",
-		Vec2:   "VEC2",
-		Vec3:   "VEC3",
-		Vec4:   "VEC4",
-		Mat2:   "MAT2",
-		Mat3:   "MAT3",
-		Mat4:   "MAT4",
+		AccessorScalar: "SCALAR",
+		AccessorVec2:   "VEC2",
+		AccessorVec3:   "VEC3",
+		AccessorVec4:   "VEC4",
+		AccessorMat2:   "MAT2",
+		AccessorMat3:   "MAT3",
+		AccessorMat4:   "MAT4",
 	}[*a])
 }
 
@@ -122,12 +122,12 @@ func (a *AccessorType) MarshalJSON() ([]byte, error) {
 type Target uint16
 
 const (
-	// None is used when the buffer should not bound to a target, for example when referenced by an sparce indices.
-	None = 0
-	// ArrayBuffer corresponds to an array buffer.
-	ArrayBuffer Target = 34962
-	// ElementArrayBuffer corresponds to an element array buffer.
-	ElementArrayBuffer = 34963
+	// TargetNone is used when the buffer should not bound to a target, for example when referenced by an sparce indices.
+	TargetNone = 0
+	// TargetArrayBuffer corresponds to an array buffer.
+	TargetArrayBuffer Target = 34962
+	// TargetElementArrayBuffer corresponds to an element array buffer.
+	TargetElementArrayBuffer = 34963
 )
 
 // Attribute is a map that each key corresponds to mesh attribute semantic and each value is the index of the accessor containing attribute's data.
@@ -137,20 +137,20 @@ type Attribute = map[string]uint32
 type PrimitiveMode uint8
 
 const (
-	// Triangles corresponds to a Triangle primitive.
-	Triangles PrimitiveMode = iota
-	// Points corresponds to a Point primitive.
-	Points
-	// Lines corresponds to a Line primitive.
-	Lines
-	// LineLoop corresponds to a Line Loop primitive.
-	LineLoop
-	// LineStrip corresponds to a Line Strip primitive.
-	LineStrip
-	// TriangleStrip corresponds to a Triangle Strip primitive.
-	TriangleStrip
-	// TriangleFan corresponds to a Triangle Fan primitive.
-	TriangleFan
+	// PrimitiveTriangles corresponds to a Triangle primitive.
+	PrimitiveTriangles PrimitiveMode = iota
+	// PrimitivePoints corresponds to a Point primitive.
+	PrimitivePoints
+	// PrimitiveLines corresponds to a Line primitive.
+	PrimitiveLines
+	// PrimitiveLineLoop corresponds to a Line Loop primitive.
+	PrimitiveLineLoop
+	// PrimitiveLineStrip corresponds to a Line Strip primitive.
+	PrimitiveLineStrip
+	// PrimitiveTriangleStrip corresponds to a Triangle Strip primitive.
+	PrimitiveTriangleStrip
+	// PrimitiveTriangleFan corresponds to a Triangle Fan primitive.
+	PrimitiveTriangleFan
 )
 
 // UnmarshalJSON unmarshal the primitive mode with the correct default values.
@@ -159,13 +159,13 @@ func (p *PrimitiveMode) UnmarshalJSON(data []byte) error {
 	err := json.Unmarshal(data, &tmp)
 	if err == nil {
 		*p = map[uint8]PrimitiveMode{
-			0: Points,
-			1: Lines,
-			2: LineLoop,
-			3: LineStrip,
-			4: Triangles,
-			5: TriangleStrip,
-			6: TriangleFan,
+			0: PrimitivePoints,
+			1: PrimitiveLines,
+			2: PrimitiveLineLoop,
+			3: PrimitiveLineStrip,
+			4: PrimitiveTriangles,
+			5: PrimitiveTriangleStrip,
+			6: PrimitiveTriangleFan,
 		}[tmp]
 	}
 	return err
@@ -174,13 +174,13 @@ func (p *PrimitiveMode) UnmarshalJSON(data []byte) error {
 // MarshalJSON marshal the primitive mode with the correct default values.
 func (p *PrimitiveMode) MarshalJSON() ([]byte, error) {
 	return json.Marshal(map[PrimitiveMode]uint8{
-		Points:        0,
-		Lines:         1,
-		LineLoop:      2,
-		LineStrip:     3,
-		Triangles:     4,
-		TriangleStrip: 5,
-		TriangleFan:   6,
+		PrimitivePoints:        0,
+		PrimitiveLines:         1,
+		PrimitiveLineLoop:      2,
+		PrimitiveLineStrip:     3,
+		PrimitiveTriangles:     4,
+		PrimitiveTriangleStrip: 5,
+		PrimitiveTriangleFan:   6,
 	}[*p])
 }
 
@@ -188,12 +188,12 @@ func (p *PrimitiveMode) MarshalJSON() ([]byte, error) {
 type AlphaMode uint8
 
 const (
-	// Opaque corresponds to an Opaque material.
-	Opaque AlphaMode = iota
-	// Mask corresponds to a masked material.
-	Mask
-	// Blend corresponds to a Blend material.
-	Blend
+	// AlphaOpaque corresponds to an AlphaOpaque material.
+	AlphaOpaque AlphaMode = iota
+	// AlphaMask corresponds to a masked material.
+	AlphaMask
+	// AlphaBlend corresponds to a AlphaBlend material.
+	AlphaBlend
 )
 
 // UnmarshalJSON unmarshal the alpha mode with the correct default values.
@@ -202,9 +202,9 @@ func (a *AlphaMode) UnmarshalJSON(data []byte) error {
 	err := json.Unmarshal(data, &tmp)
 	if err == nil {
 		*a = map[string]AlphaMode{
-			"OPAQUE": Opaque,
-			"MASK":   Mask,
-			"BLEND":  Blend,
+			"OPAQUE": AlphaOpaque,
+			"MASK":   AlphaMask,
+			"BLEND":  AlphaBlend,
 		}[tmp]
 	}
 	return err
@@ -213,9 +213,9 @@ func (a *AlphaMode) UnmarshalJSON(data []byte) error {
 // MarshalJSON marshal the alpha mode with the correct default values.
 func (a *AlphaMode) MarshalJSON() ([]byte, error) {
 	return json.Marshal(map[AlphaMode]string{
-		Opaque: "OPAQUE",
-		Mask:   "MASK",
-		Blend:  "BLEND",
+		AlphaOpaque: "OPAQUE",
+		AlphaMask:   "MASK",
+		AlphaBlend:  "BLEND",
 	}[*a])
 }
 
@@ -301,12 +301,12 @@ func (m *MinFilter) MarshalJSON() ([]byte, error) {
 type WrappingMode uint16
 
 const (
-	// Repeat corresponds to a repeat wrapping.
-	Repeat WrappingMode = iota
-	// ClampToEdge corresponds to a clamp to edge wrapping.
-	ClampToEdge
-	// MirroredRepeat corresponds to a mirrored repeat wrapping.
-	MirroredRepeat
+	// WrapRepeat corresponds to a repeat wrapping.
+	WrapRepeat WrappingMode = iota
+	// WrapClampToEdge corresponds to a clamp to edge wrapping.
+	WrapClampToEdge
+	// WrapMirroredRepeat corresponds to a mirrored repeat wrapping.
+	WrapMirroredRepeat
 )
 
 // UnmarshalJSON unmarshal the wrapping mode with the correct default values.
@@ -315,9 +315,9 @@ func (w *WrappingMode) UnmarshalJSON(data []byte) error {
 	err := json.Unmarshal(data, &tmp)
 	if err == nil {
 		*w = map[uint16]WrappingMode{
-			33071: ClampToEdge,
-			33648: MirroredRepeat,
-			10497: Repeat,
+			33071: WrapClampToEdge,
+			33648: WrapMirroredRepeat,
+			10497: WrapRepeat,
 		}[tmp]
 	}
 	return err
@@ -326,9 +326,9 @@ func (w *WrappingMode) UnmarshalJSON(data []byte) error {
 // MarshalJSON marshal the wrapping mode with the correct default values.
 func (w *WrappingMode) MarshalJSON() ([]byte, error) {
 	return json.Marshal(map[WrappingMode]uint16{
-		ClampToEdge:    33071,
-		MirroredRepeat: 33648,
-		Repeat:         10497,
+		WrapClampToEdge:    33071,
+		WrapMirroredRepeat: 33648,
+		WrapRepeat:         10497,
 	}[*w])
 }
 
@@ -336,12 +336,12 @@ func (w *WrappingMode) MarshalJSON() ([]byte, error) {
 type Interpolation uint8
 
 const (
-	// Linear corresponds to a linear interpolation.
-	Linear Interpolation = iota
-	// Step corresponds to a step interpolation.
-	Step
-	// CubicSpline corresponds to a cubic spline interpolation.
-	CubicSpline
+	// InterpolationLinear corresponds to a linear interpolation.
+	InterpolationLinear Interpolation = iota
+	// InterpolationStep corresponds to a step interpolation.
+	InterpolationStep
+	// InterpolationCubicSpline corresponds to a cubic spline interpolation.
+	InterpolationCubicSpline
 )
 
 // UnmarshalJSON unmarshal the interpolation with the correct default values.
@@ -350,9 +350,9 @@ func (i *Interpolation) UnmarshalJSON(data []byte) error {
 	err := json.Unmarshal(data, &tmp)
 	if err == nil {
 		*i = map[string]Interpolation{
-			"LINEAR":      Linear,
-			"STEP":        Step,
-			"CUBICSPLINE": CubicSpline,
+			"LINEAR":      InterpolationLinear,
+			"STEP":        InterpolationStep,
+			"CUBICSPLINE": InterpolationCubicSpline,
 		}[tmp]
 	}
 	return err
@@ -361,9 +361,9 @@ func (i *Interpolation) UnmarshalJSON(data []byte) error {
 // MarshalJSON marshal the interpolation with the correct default values.
 func (i *Interpolation) MarshalJSON() ([]byte, error) {
 	return json.Marshal(map[Interpolation]string{
-		Linear:      "LINEAR",
-		Step:        "STEP",
-		CubicSpline: "CUBICSPLINE",
+		InterpolationLinear:      "LINEAR",
+		InterpolationStep:        "STEP",
+		InterpolationCubicSpline: "CUBICSPLINE",
 	}[*i])
 }
 
@@ -372,14 +372,14 @@ func (i *Interpolation) MarshalJSON() ([]byte, error) {
 type TRSProperty uint8
 
 const (
-	// Translation corresponds to a translation transform.
-	Translation TRSProperty = iota
-	// Rotation corresponds to a rotation transform.
-	Rotation
-	// Scale corresponds to a scale transform.
-	Scale
-	// Weights corresponds to a weights transform.
-	Weights
+	// TRSTranslation corresponds to a translation transform.
+	TRSTranslation TRSProperty = iota
+	// TRSRotation corresponds to a rotation transform.
+	TRSRotation
+	// TRSScale corresponds to a scale transform.
+	TRSScale
+	// TRSWeights corresponds to a weights transform.
+	TRSWeights
 )
 
 // UnmarshalJSON unmarshal the TRSProperty with the correct default values.
@@ -388,10 +388,10 @@ func (t *TRSProperty) UnmarshalJSON(data []byte) error {
 	err := json.Unmarshal(data, &tmp)
 	if err == nil {
 		*t = map[string]TRSProperty{
-			"translation": Translation,
-			"rotation":    Rotation,
-			"scale":       Scale,
-			"weights":     Weights,
+			"translation": TRSTranslation,
+			"rotation":    TRSRotation,
+			"scale":       TRSScale,
+			"weights":     TRSWeights,
 		}[tmp]
 	}
 	return err
@@ -400,10 +400,10 @@ func (t *TRSProperty) UnmarshalJSON(data []byte) error {
 // MarshalJSON marshal the TRSProperty with the correct default values.
 func (t *TRSProperty) MarshalJSON() ([]byte, error) {
 	return json.Marshal(map[TRSProperty]string{
-		Translation: "translation",
-		Rotation:    "rotation",
-		Scale:       "scale",
-		Weights:     "weights",
+		TRSTranslation: "translation",
+		TRSRotation:    "rotation",
+		TRSScale:       "scale",
+		TRSWeights:     "weights",
 	}[*t])
 }
 
diff --git a/decoder.go b/decoder.go
index 6b15374..8866294 100644
--- a/decoder.go
+++ b/decoder.go
@@ -79,12 +79,12 @@ func (d *Decoder) Decode(doc *Document) error {
 	var externalBufferIndex = 0
 	if isBinary && len(doc.Buffers) > 0 {
 		externalBufferIndex = 1
-		if err := d.decodeBinaryBuffer(&doc.Buffers[0]); err != nil {
+		if err := d.decodeBinaryBuffer(doc.Buffers[0]); err != nil {
 			return err
 		}
 	}
 	for i := externalBufferIndex; i < len(doc.Buffers); i++ {
-		if err := d.decodeBuffer(&doc.Buffers[i]); err != nil {
+		if err := d.decodeBuffer(doc.Buffers[i]); err != nil {
 			return err
 		}
 	}
@@ -177,7 +177,7 @@ func (d *Decoder) decodeBuffer(buffer *Buffer) error {
 	if buffer.IsEmbeddedResource() {
 		buffer.Data, err = buffer.marshalData()
 	} else if err = validateBufferURI(buffer.URI); err == nil {
-		buffer.Data = make([]uint8, buffer.ByteLength)
+		buffer.Data = make([]byte, buffer.ByteLength)
 		err = d.ReadHandler.ReadFullResource(buffer.URI, buffer.Data)
 	}
 	if err != nil {
@@ -197,7 +197,7 @@ func (d *Decoder) decodeBinaryBuffer(buffer *Buffer) error {
 	if header.Type != glbChunkBIN || header.Length < buffer.ByteLength {
 		return errors.New("gltf: Invalid GLB BIN header")
 	}
-	buffer.Data = make([]uint8, buffer.ByteLength)
+	buffer.Data = make([]byte, buffer.ByteLength)
 	_, err = io.ReadFull(d.r, buffer.Data)
 	return err
 }
diff --git a/encode.go b/encode.go
index b479aad..26d9ee4 100644
--- a/encode.go
+++ b/encode.go
@@ -81,7 +81,7 @@ func (e *Encoder) Encode(doc *Document) error {
 	}
 
 	for i := externalBufferIndex; i < len(doc.Buffers); i++ {
-		buffer := &doc.Buffers[i]
+		buffer := doc.Buffers[i]
 		if len(buffer.Data) == 0 || buffer.IsEmbeddedResource() {
 			continue
 		}
@@ -111,7 +111,7 @@ func (e *Encoder) encodeBinary(doc *Document) error {
 	var binBufferLength uint32
 	var binBuffer *Buffer
 	if len(doc.Buffers) > 0 {
-		binBuffer = &doc.Buffers[0]
+		binBuffer = doc.Buffers[0]
 		binBufferLength = binBuffer.ByteLength
 	}
 	binPaddedLength := ((binBufferLength + 3) / 4) * 4
diff --git a/modeler/modeler.go b/modeler/modeler.go
index 00d15e6..9de9c4e 100644
--- a/modeler/modeler.go
+++ b/modeler/modeler.go
@@ -35,7 +35,7 @@ func NewModeler() *Modeler {
 	return &Modeler{
 		Document: &gltf.Document{
 			Scene:  gltf.Index(0),
-			Scenes: []gltf.Scene{{Name: "Root Scene"}},
+			Scenes: []*gltf.Scene{{Name: "Root Scene"}},
 		},
 		Compression: CompressionLossless,
 	}
@@ -203,8 +203,8 @@ func (m *Modeler) AddImage(bufferIndex uint32, name, mimeType string, r io.Reade
 	}
 	index := m.addBufferView(bufferIndex, uint32(len(buffer.Data))-offset, offset, 0, false)
 	buffer.ByteLength += uint32(len(buffer.Data))
-	m.BufferViews[index].Target = gltf.None
-	m.Images = append(m.Images, gltf.Image{
+	m.BufferViews[index].Target = gltf.TargetNone
+	m.Images = append(m.Images, &gltf.Image{
 		Name:       name,
 		MimeType:   mimeType,
 		BufferView: gltf.Index(index),
@@ -223,7 +223,7 @@ func (m *Modeler) addAccessor(bufferIndex uint32, count int, data interface{}, c
 	// Cannot return error as the buffer has enough size and the data type is controlled.
 	_ = binary.Write(buffer.Data[offset+padding:], data)
 	index := m.addBufferView(bufferIndex, size, offset+padding, uint32(elementSize), isIndex)
-	m.Accessors = append(m.Accessors, gltf.Accessor{
+	m.Accessors = append(m.Accessors, &gltf.Accessor{
 		BufferView:    gltf.Index(index),
 		ByteOffset:    0,
 		ComponentType: componentType,
@@ -234,15 +234,15 @@ func (m *Modeler) addAccessor(bufferIndex uint32, count int, data interface{}, c
 }
 
 func (m *Modeler) addBufferView(buffer, size, offset, stride uint32, isIndices bool) uint32 {
-	bufferView := gltf.BufferView{
+	bufferView := &gltf.BufferView{
 		Buffer:     buffer,
 		ByteLength: size,
 		ByteOffset: offset,
 	}
 	if isIndices {
-		bufferView.Target = gltf.ElementArrayBuffer
+		bufferView.Target = gltf.TargetElementArrayBuffer
 	} else {
-		bufferView.Target = gltf.ArrayBuffer
+		bufferView.Target = gltf.TargetArrayBuffer
 		bufferView.ByteStride = stride
 	}
 	m.BufferViews = append(m.BufferViews, bufferView)
@@ -251,7 +251,11 @@ func (m *Modeler) addBufferView(buffer, size, offset, stride uint32, isIndices b
 
 func (m *Modeler) buffer(bufferIndex uint32) *gltf.Buffer {
 	if int(bufferIndex) >= len(m.Buffers) {
-		m.Buffers = append(m.Buffers, make([]gltf.Buffer, int(bufferIndex)-len(m.Buffers)+1)...)
+		l := len(m.Buffers)
+		m.Buffers = append(m.Buffers, make([]*gltf.Buffer, int(bufferIndex)-l+1)...)
+		for i := l; i < len(m.Buffers); i++ {
+			m.Buffers[i] = new(gltf.Buffer)
+		}
 	}
-	return &m.Buffers[bufferIndex]
+	return m.Buffers[bufferIndex]
 }
diff --git a/struct.go b/struct.go
index 4c742c0..36a214d 100644
--- a/struct.go
+++ b/struct.go
@@ -30,25 +30,25 @@ type Asset struct {
 
 // Document defines the root object for a glTF asset.
 type Document struct {
-	Extensions         Extensions   `json:"extensions,omitempty"`
-	Extras             interface{}  `json:"extras,omitempty"`
-	ExtensionsUsed     []string     `json:"extensionsUsed,omitempty"`
-	ExtensionsRequired []string     `json:"extensionsRequired,omitempty"`
-	Accessors          []Accessor   `json:"accessors,omitempty" validate:"dive"`
-	Animations         []Animation  `json:"animations,omitempty" validate:"dive"`
-	Asset              Asset        `json:"asset"`
-	Buffers            []Buffer     `json:"buffers,omitempty" validate:"dive"`
-	BufferViews        []BufferView `json:"bufferViews,omitempty" validate:"dive"`
-	Cameras            []Camera     `json:"cameras,omitempty" validate:"dive"`
-	Images             []Image      `json:"images,omitempty" validate:"dive"`
-	Materials          []Material   `json:"materials,omitempty" validate:"dive"`
-	Meshes             []Mesh       `json:"meshes,omitempty" validate:"dive"`
-	Nodes              []Node       `json:"nodes,omitempty" validate:"dive"`
-	Samplers           []Sampler    `json:"samplers,omitempty" validate:"dive"`
-	Scene              *uint32      `json:"scene,omitempty"`
-	Scenes             []Scene      `json:"scenes,omitempty" validate:"dive"`
-	Skins              []Skin       `json:"skins,omitempty" validate:"dive"`
-	Textures           []Texture    `json:"textures,omitempty" validate:"dive"`
+	Extensions         Extensions    `json:"extensions,omitempty"`
+	Extras             interface{}   `json:"extras,omitempty"`
+	ExtensionsUsed     []string      `json:"extensionsUsed,omitempty"`
+	ExtensionsRequired []string      `json:"extensionsRequired,omitempty"`
+	Accessors          []*Accessor   `json:"accessors,omitempty" validate:"dive"`
+	Animations         []*Animation  `json:"animations,omitempty" validate:"dive"`
+	Asset              Asset         `json:"asset"`
+	Buffers            []*Buffer     `json:"buffers,omitempty" validate:"dive"`
+	BufferViews        []*BufferView `json:"bufferViews,omitempty" validate:"dive"`
+	Cameras            []*Camera     `json:"cameras,omitempty" validate:"dive"`
+	Images             []*Image      `json:"images,omitempty" validate:"dive"`
+	Materials          []*Material   `json:"materials,omitempty" validate:"dive"`
+	Meshes             []*Mesh       `json:"meshes,omitempty" validate:"dive"`
+	Nodes              []*Node       `json:"nodes,omitempty" validate:"dive"`
+	Samplers           []*Sampler    `json:"samplers,omitempty" validate:"dive"`
+	Scene              *uint32       `json:"scene,omitempty"`
+	Scenes             []*Scene      `json:"scenes,omitempty" validate:"dive"`
+	Skins              []*Skin       `json:"skins,omitempty" validate:"dive"`
+	Textures           []*Texture    `json:"textures,omitempty" validate:"dive"`
 }
 
 // An Accessor is a typed view into a bufferView.
@@ -104,7 +104,7 @@ type Buffer struct {
 	Name       string      `json:"name,omitempty"`
 	URI        string      `json:"uri,omitempty" validate:"omitempty"`
 	ByteLength uint32      `json:"byteLength" validate:"required"`
-	Data       []uint8     `json:"-"`
+	Data       []byte      `json:"-"`
 }
 
 // IsEmbeddedResource returns true if the buffer points to an embedded resource.
@@ -118,7 +118,7 @@ func (b *Buffer) EmbeddedResource() {
 }
 
 // marshalData decode the buffer from the URI. If the buffer is not en embedded resource the returned array will be empty.
-func (b *Buffer) marshalData() ([]uint8, error) {
+func (b *Buffer) marshalData() ([]byte, error) {
 	if !b.IsEmbeddedResource() {
 		return nil, nil
 	}
@@ -236,11 +236,11 @@ type Perspective struct {
 
 // A Mesh is a set of primitives to be rendered. A node can contain one mesh. A node's transform places the mesh in the scene.
 type Mesh struct {
-	Extensions Extensions  `json:"extensions,omitempty"`
-	Extras     interface{} `json:"extras,omitempty"`
-	Name       string      `json:"name,omitempty"`
-	Primitives []Primitive `json:"primitives" validate:"required,gt=0,dive"`
-	Weights    []float64   `json:"weights,omitempty"`
+	Extensions Extensions   `json:"extensions,omitempty"`
+	Extras     interface{}  `json:"extras,omitempty"`
+	Name       string       `json:"name,omitempty"`
+	Primitives []*Primitive `json:"primitives" validate:"required,gt=0,dive"`
+	Weights    []float64    `json:"weights,omitempty"`
 }
 
 // Primitive defines the geometry to be rendered with the given material.
@@ -433,9 +433,9 @@ func (im *Image) IsEmbeddedResource() bool {
 }
 
 // MarshalData decode the image from the URI. If the image is not en embedded resource the returned array will be empty.
-func (im *Image) MarshalData() ([]uint8, error) {
+func (im *Image) MarshalData() ([]byte, error) {
 	if !im.IsEmbeddedResource() {
-		return []uint8{}, nil
+		return []byte{}, nil
 	}
 	mimetype := mimetypeImagePNG
 	if strings.HasPrefix(im.URI, mimetypeImageJPG) {
@@ -447,11 +447,11 @@ func (im *Image) MarshalData() ([]uint8, error) {
 
 // An Animation keyframe.
 type Animation struct {
-	Extensions Extensions         `json:"extensions,omitempty"`
-	Extras     interface{}        `json:"extras,omitempty"`
-	Name       string             `json:"name,omitempty"`
-	Channels   []Channel          `json:"channels" validate:"required,gt=0,dive"`
-	Samplers   []AnimationSampler `json:"samplers" validate:"required,gt=0,dive"`
+	Extensions Extensions          `json:"extensions,omitempty"`
+	Extras     interface{}         `json:"extras,omitempty"`
+	Name       string              `json:"name,omitempty"`
+	Channels   []*Channel          `json:"channels" validate:"required,gt=0,dive"`
+	Samplers   []*AnimationSampler `json:"samplers" validate:"required,gt=0,dive"`
 }
 
 // AnimationSampler combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).


Test patch:
diff --git a/binary/bench_test.go b/binary/bench_test.go
index 9be62de..1a308c4 100644
--- a/binary/bench_test.go
+++ b/binary/bench_test.go
@@ -10,7 +10,7 @@ import (
 
 func BenchmarkNative(b *testing.B) {
 	s := 1000
-	bs := make([]byte, s*SizeOfElement(gltf.Float, gltf.Vec3))
+	bs := make([]byte, s*SizeOfElement(gltf.ComponentFloat, gltf.AccessorVec3))
 	data := make([][3]float32, s)
 	b.ResetTimer()
 	for n := 0; n < b.N; n++ {
@@ -22,7 +22,7 @@ func BenchmarkNative(b *testing.B) {
 
 func BenchmarkWrite(b *testing.B) {
 	s := 1000
-	bs := make([]byte, s*SizeOfElement(gltf.Float, gltf.Vec3))
+	bs := make([]byte, s*SizeOfElement(gltf.ComponentFloat, gltf.AccessorVec3))
 	data := make([][3]float32, s)
 	b.ResetTimer()
 	for n := 0; n < b.N; n++ {
@@ -32,7 +32,7 @@ func BenchmarkWrite(b *testing.B) {
 
 func BenchmarkWrite_builtint(b *testing.B) {
 	s := 1000
-	bs := bytes.NewBuffer(make([]byte, s*SizeOfElement(gltf.Float, gltf.Vec3)))
+	bs := bytes.NewBuffer(make([]byte, s*SizeOfElement(gltf.ComponentFloat, gltf.AccessorVec3)))
 	data := make([][3]float32, s)
 	b.ResetTimer()
 	for n := 0; n < b.N; n++ {
diff --git a/binary/encode_test.go b/binary/encode_test.go
index 3b3b230..b1aee06 100644
--- a/binary/encode_test.go
+++ b/binary/encode_test.go
@@ -325,8 +325,8 @@ func Test_ubyteComponent_Scalar(t *testing.T) {
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
 			b := make([]byte, 1)
-			UnsignedByte.PutScalar(b, tt.want)
-			if got := UnsignedByte.Scalar(b); got != tt.want {
+			Ubyte.PutScalar(b, tt.want)
+			if got := Ubyte.Scalar(b); got != tt.want {
 				t.Errorf("ubyteComponent.Scalar() = %v, want %v", got, tt.want)
 			}
 		})
diff --git a/binary/example_test.go b/binary/example_test.go
index e89335d..3e9bc73 100644
--- a/binary/example_test.go
+++ b/binary/example_test.go
@@ -12,8 +12,8 @@ func ExampleWrite() {
 	vertices := [][3]float32{{43, 43, 0}, {83, 43, 0}, {63, 63, 40}, {43, 83, 0}, {83, 83, 0}}
 
 	// Allocate buffer
-	sizeIndices := len(indices) * binary.SizeOfElement(gltf.UnsignedByte, gltf.Scalar)
-	sizeVertices := len(vertices) * binary.SizeOfElement(gltf.Float, gltf.Vec3)
+	sizeIndices := len(indices) * binary.SizeOfElement(gltf.ComponentUbyte, gltf.AccessorScalar)
+	sizeVertices := len(vertices) * binary.SizeOfElement(gltf.ComponentFloat, gltf.AccessorVec3)
 	b := make([]byte, sizeIndices+sizeVertices)
 
 	// Write
@@ -32,7 +32,7 @@ func ExampleRead() {
 
 	// Define buffer
 	b := []byte{0, 1, 2, 3, 1, 0, 0, 2, 3, 1, 4, 2, 4, 3, 2, 4, 1, 3, 0, 0, 44, 66, 0, 0, 44, 66, 0, 0, 0, 0, 0, 0, 166, 66, 0, 0, 44, 66, 0, 0, 0, 0, 0, 0, 124, 66, 0, 0, 124, 66, 0, 0, 32, 66, 0, 0, 44, 66, 0, 0, 166, 66, 0, 0, 0, 0, 0, 0, 166, 66, 0, 0, 166, 66, 0, 0, 0, 0}
-	sizeIndices := len(indices) * binary.SizeOfElement(gltf.UnsignedByte, gltf.Scalar)
+	sizeIndices := len(indices) * binary.SizeOfElement(gltf.ComponentUbyte, gltf.AccessorScalar)
 
 	// Write
 	binary.Read(b, indices)
diff --git a/decoder_test.go b/decoder_test.go
index c386ac2..63302cb 100644
--- a/decoder_test.go
+++ b/decoder_test.go
@@ -10,7 +10,7 @@ import (
 	"github.com/go-test/deep"
 )
 
-func readFile(path string) []uint8 {
+func readFile(path string) []byte {
 	r, _ := ioutil.ReadFile(path)
 	return r
 }
@@ -28,84 +28,84 @@ func TestOpen(t *testing.T) {
 	}{
 		{args{"openError", ""}, nil, true},
 		{args{"testdata/Cube/glTF/Cube.gltf", ""}, &Document{
-			Accessors: []Accessor{
-				{BufferView: Index(0), ByteOffset: 0, ComponentType: UnsignedShort, Count: 36, Max: []float64{35}, Min: []float64{0}, Type: Scalar},
-				{BufferView: Index(1), ByteOffset: 0, ComponentType: Float, Count: 36, Max: []float64{1, 1, 1}, Min: []float64{-1, -1, -1}, Type: Vec3},
-				{BufferView: Index(2), ByteOffset: 0, ComponentType: Float, Count: 36, Max: []float64{1, 1, 1}, Min: []float64{-1, -1, -1}, Type: Vec3},
-				{BufferView: Index(3), ByteOffset: 0, ComponentType: Float, Count: 36, Max: []float64{1, 0, 0, 1}, Min: []float64{0, 0, -1, -1}, Type: Vec4},
-				{BufferView: Index(4), ByteOffset: 0, ComponentType: Float, Count: 36, Max: []float64{1, 1}, Min: []float64{-1, -1}, Type: Vec2}},
+			Accessors: []*Accessor{
+				{BufferView: Index(0), ByteOffset: 0, ComponentType: ComponentUshort, Count: 36, Max: []float64{35}, Min: []float64{0}, Type: AccessorScalar},
+				{BufferView: Index(1), ByteOffset: 0, ComponentType: ComponentFloat, Count: 36, Max: []float64{1, 1, 1}, Min: []float64{-1, -1, -1}, Type: AccessorVec3},
+				{BufferView: Index(2), ByteOffset: 0, ComponentType: ComponentFloat, Count: 36, Max: []float64{1, 1, 1}, Min: []float64{-1, -1, -1}, Type: AccessorVec3},
+				{BufferView: Index(3), ByteOffset: 0, ComponentType: ComponentFloat, Count: 36, Max: []float64{1, 0, 0, 1}, Min: []float64{0, 0, -1, -1}, Type: AccessorVec4},
+				{BufferView: Index(4), ByteOffset: 0, ComponentType: ComponentFloat, Count: 36, Max: []float64{1, 1}, Min: []float64{-1, -1}, Type: AccessorVec2}},
 			Asset: Asset{Generator: "VKTS glTF 2.0 exporter", Version: "2.0"},
-			BufferViews: []BufferView{
-				{Buffer: 0, ByteLength: 72, ByteOffset: 0, Target: ElementArrayBuffer},
-				{Buffer: 0, ByteLength: 432, ByteOffset: 72, Target: ArrayBuffer},
-				{Buffer: 0, ByteLength: 432, ByteOffset: 504, Target: ArrayBuffer},
-				{Buffer: 0, ByteLength: 576, ByteOffset: 936, Target: ArrayBuffer},
-				{Buffer: 0, ByteLength: 288, ByteOffset: 1512, Target: ArrayBuffer},
+			BufferViews: []*BufferView{
+				{Buffer: 0, ByteLength: 72, ByteOffset: 0, Target: TargetElementArrayBuffer},
+				{Buffer: 0, ByteLength: 432, ByteOffset: 72, Target: TargetArrayBuffer},
+				{Buffer: 0, ByteLength: 432, ByteOffset: 504, Target: TargetArrayBuffer},
+				{Buffer: 0, ByteLength: 576, ByteOffset: 936, Target: TargetArrayBuffer},
+				{Buffer: 0, ByteLength: 288, ByteOffset: 1512, Target: TargetArrayBuffer},
 			},
-			Buffers:   []Buffer{{ByteLength: 1800, URI: "Cube.bin", Data: readFile("testdata/Cube/glTF/Cube.bin")}},
-			Images:    []Image{{URI: "Cube_BaseColor.png"}, {URI: "Cube_MetallicRoughness.png"}},
-			Materials: []Material{{Name: "Cube", AlphaMode: Opaque, AlphaCutoff: Float64(0.5), PBRMetallicRoughness: &PBRMetallicRoughness{BaseColorFactor: NewRGBA(), MetallicFactor: Float64(1), RoughnessFactor: Float64(1), BaseColorTexture: &TextureInfo{Index: 0}, MetallicRoughnessTexture: &TextureInfo{Index: 1}}}},
-			Meshes:    []Mesh{{Name: "Cube", Primitives: []Primitive{{Indices: Index(0), Material: Index(0), Mode: Triangles, Attributes: map[string]uint32{"NORMAL": 2, "POSITION": 1, "TANGENT": 3, "TEXCOORD_0": 4}}}}},
-			Nodes:     []Node{{Mesh: Index(0), Name: "Cube", Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Rotation: [4]float64{0, 0, 0, 1}, Scale: [3]float64{1, 1, 1}}},
-			Samplers:  []Sampler{{WrapS: Repeat, WrapT: Repeat}},
+			Buffers:   []*Buffer{{ByteLength: 1800, URI: "Cube.bin", Data: readFile("testdata/Cube/glTF/Cube.bin")}},
+			Images:    []*Image{{URI: "Cube_BaseColor.png"}, {URI: "Cube_MetallicRoughness.png"}},
+			Materials: []*Material{{Name: "Cube", AlphaMode: AlphaOpaque, AlphaCutoff: Float64(0.5), PBRMetallicRoughness: &PBRMetallicRoughness{BaseColorFactor: NewRGBA(), MetallicFactor: Float64(1), RoughnessFactor: Float64(1), BaseColorTexture: &TextureInfo{Index: 0}, MetallicRoughnessTexture: &TextureInfo{Index: 1}}}},
+			Meshes:    []*Mesh{{Name: "Cube", Primitives: []*Primitive{{Indices: Index(0), Material: Index(0), Mode: PrimitiveTriangles, Attributes: map[string]uint32{"NORMAL": 2, "POSITION": 1, "TANGENT": 3, "TEXCOORD_0": 4}}}}},
+			Nodes:     []*Node{{Mesh: Index(0), Name: "Cube", Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Rotation: [4]float64{0, 0, 0, 1}, Scale: [3]float64{1, 1, 1}}},
+			Samplers:  []*Sampler{{WrapS: WrapRepeat, WrapT: WrapRepeat}},
 			Scene:     Index(0),
-			Scenes:    []Scene{{Nodes: []uint32{0}}},
-			Textures: []Texture{
+			Scenes:    []*Scene{{Nodes: []uint32{0}}},
+			Textures: []*Texture{
 				{Sampler: Index(0), Source: Index(0)}, {Sampler: Index(0), Source: Index(1)},
 			},
 		}, false},
 		{args{"testdata/Cameras/glTF/Cameras.gltf", "testdata/Cameras/glTF-Embedded/Cameras.gltf"}, &Document{
-			Accessors: []Accessor{
-				{BufferView: Index(0), ByteOffset: 0, ComponentType: UnsignedShort, Count: 6, Max: []float64{3}, Min: []float64{0}, Type: Scalar},
-				{BufferView: Index(1), ByteOffset: 0, ComponentType: Float, Count: 4, Max: []float64{1, 1, 0}, Min: []float64{0, 0, 0}, Type: Vec3},
+			Accessors: []*Accessor{
+				{BufferView: Index(0), ByteOffset: 0, ComponentType: ComponentUshort, Count: 6, Max: []float64{3}, Min: []float64{0}, Type: AccessorScalar},
+				{BufferView: Index(1), ByteOffset: 0, ComponentType: ComponentFloat, Count: 4, Max: []float64{1, 1, 0}, Min: []float64{0, 0, 0}, Type: AccessorVec3},
 			},
 			Asset: Asset{Version: "2.0"},
-			BufferViews: []BufferView{
-				{Buffer: 0, ByteLength: 12, ByteOffset: 0, Target: ElementArrayBuffer},
-				{Buffer: 0, ByteLength: 48, ByteOffset: 12, Target: ArrayBuffer},
+			BufferViews: []*BufferView{
+				{Buffer: 0, ByteLength: 12, ByteOffset: 0, Target: TargetElementArrayBuffer},
+				{Buffer: 0, ByteLength: 48, ByteOffset: 12, Target: TargetArrayBuffer},
 			},
-			Buffers: []Buffer{{ByteLength: 60, URI: "simpleSquare.bin", Data: readFile("testdata/Cameras/glTF/simpleSquare.bin")}},
-			Cameras: []Camera{
+			Buffers: []*Buffer{{ByteLength: 60, URI: "simpleSquare.bin", Data: readFile("testdata/Cameras/glTF/simpleSquare.bin")}},
+			Cameras: []*Camera{
 				{Perspective: &Perspective{AspectRatio: Float64(1.0), Yfov: 0.7, Zfar: Float64(100), Znear: 0.01}},
 				{Orthographic: &Orthographic{Xmag: 1.0, Ymag: 1.0, Zfar: 100, Znear: 0.01}},
 			},
-			Meshes: []Mesh{{Primitives: []Primitive{{Indices: Index(0), Mode: Triangles, Attributes: map[string]uint32{"POSITION": 1}}}}},
-			Nodes: []Node{
+			Meshes: []*Mesh{{Primitives: []*Primitive{{Indices: Index(0), Mode: PrimitiveTriangles, Attributes: map[string]uint32{"POSITION": 1}}}}},
+			Nodes: []*Node{
 				{Mesh: Index(0), Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Rotation: [4]float64{-0.3, 0, 0, 0.9}, Scale: [3]float64{1, 1, 1}},
 				{Camera: Index(0), Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Rotation: [4]float64{0, 0, 0, 1}, Scale: [3]float64{1, 1, 1}, Translation: [3]float64{0.5, 0.5, 3.0}},
 				{Camera: Index(1), Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Rotation: [4]float64{0, 0, 0, 1}, Scale: [3]float64{1, 1, 1}, Translation: [3]float64{0.5, 0.5, 3.0}},
 			},
 			Scene:  nil,
-			Scenes: []Scene{{Nodes: []uint32{0, 1, 2}}},
+			Scenes: []*Scene{{Nodes: []uint32{0, 1, 2}}},
 		}, false},
 		{args{"testdata/BoxVertexColors/glTF-Binary/BoxVertexColors.glb", ""}, &Document{
-			Accessors: []Accessor{
-				{BufferView: Index(0), ByteOffset: 0, ComponentType: UnsignedShort, Count: 36, Type: Scalar},
-				{BufferView: Index(1), ByteOffset: 0, ComponentType: Float, Count: 24, Max: []float64{0.5, 0.5, 0.5}, Min: []float64{-0.5, -0.5, -0.5}, Type: Vec3},
-				{BufferView: Index(2), ByteOffset: 0, ComponentType: Float, Count: 24, Type: Vec3},
-				{BufferView: Index(3), ByteOffset: 0, ComponentType: Float, Count: 24, Type: Vec4},
-				{BufferView: Index(4), ByteOffset: 0, ComponentType: Float, Count: 24, Type: Vec2},
+			Accessors: []*Accessor{
+				{BufferView: Index(0), ByteOffset: 0, ComponentType: ComponentUshort, Count: 36, Type: AccessorScalar},
+				{BufferView: Index(1), ByteOffset: 0, ComponentType: ComponentFloat, Count: 24, Max: []float64{0.5, 0.5, 0.5}, Min: []float64{-0.5, -0.5, -0.5}, Type: AccessorVec3},
+				{BufferView: Index(2), ByteOffset: 0, ComponentType: ComponentFloat, Count: 24, Type: AccessorVec3},
+				{BufferView: Index(3), ByteOffset: 0, ComponentType: ComponentFloat, Count: 24, Type: AccessorVec4},
+				{BufferView: Index(4), ByteOffset: 0, ComponentType: ComponentFloat, Count: 24, Type: AccessorVec2},
 			},
 			Asset: Asset{Version: "2.0", Generator: "FBX2glTF"},
-			BufferViews: []BufferView{
-				{Buffer: 0, ByteLength: 72, ByteOffset: 0, Target: ElementArrayBuffer},
-				{Buffer: 0, ByteLength: 288, ByteOffset: 72, Target: ArrayBuffer},
-				{Buffer: 0, ByteLength: 288, ByteOffset: 360, Target: ArrayBuffer},
-				{Buffer: 0, ByteLength: 384, ByteOffset: 648, Target: ArrayBuffer},
-				{Buffer: 0, ByteLength: 192, ByteOffset: 1032, Target: ArrayBuffer},
+			BufferViews: []*BufferView{
+				{Buffer: 0, ByteLength: 72, ByteOffset: 0, Target: TargetElementArrayBuffer},
+				{Buffer: 0, ByteLength: 288, ByteOffset: 72, Target: TargetArrayBuffer},
+				{Buffer: 0, ByteLength: 288, ByteOffset: 360, Target: TargetArrayBuffer},
+				{Buffer: 0, ByteLength: 384, ByteOffset: 648, Target: TargetArrayBuffer},
+				{Buffer: 0, ByteLength: 192, ByteOffset: 1032, Target: TargetArrayBuffer},
 			},
-			Buffers:   []Buffer{{ByteLength: 1224, Data: readFile("testdata/BoxVertexColors/glTF-Binary/BoxVertexColors.glb")[1628+20+8:]}},
-			Materials: []Material{{Name: "Default", AlphaMode: Opaque, AlphaCutoff: Float64(0.5), PBRMetallicRoughness: &PBRMetallicRoughness{BaseColorFactor: &RGBA{R: 0.8, G: 0.8, B: 0.8, A: 1}, MetallicFactor: Float64(0.1), RoughnessFactor: Float64(0.99)}}},
-			Meshes:    []Mesh{{Name: "Cube", Primitives: []Primitive{{Indices: Index(0), Material: Index(0), Mode: Triangles, Attributes: map[string]uint32{"POSITION": 1, "COLOR_0": 3, "NORMAL": 2, "TEXCOORD_0": 4}}}}},
-			Nodes: []Node{
+			Buffers:   []*Buffer{{ByteLength: 1224, Data: readFile("testdata/BoxVertexColors/glTF-Binary/BoxVertexColors.glb")[1628+20+8:]}},
+			Materials: []*Material{{Name: "Default", AlphaMode: AlphaOpaque, AlphaCutoff: Float64(0.5), PBRMetallicRoughness: &PBRMetallicRoughness{BaseColorFactor: &RGBA{R: 0.8, G: 0.8, B: 0.8, A: 1}, MetallicFactor: Float64(0.1), RoughnessFactor: Float64(0.99)}}},
+			Meshes:    []*Mesh{{Name: "Cube", Primitives: []*Primitive{{Indices: Index(0), Material: Index(0), Mode: PrimitiveTriangles, Attributes: map[string]uint32{"POSITION": 1, "COLOR_0": 3, "NORMAL": 2, "TEXCOORD_0": 4}}}}},
+			Nodes: []*Node{
 				{Name: "RootNode", Children: []uint32{1, 2, 3}, Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Rotation: [4]float64{0, 0, 0, 1}, Scale: [3]float64{1, 1, 1}},
 				{Name: "Mesh", Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Rotation: [4]float64{0, 0, 0, 1}, Scale: [3]float64{1, 1, 1}},
 				{Name: "Cube", Mesh: Index(0), Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Rotation: [4]float64{0, 0, 0, 1}, Scale: [3]float64{1, 1, 1}},
 				{Name: "Texture Group", Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Rotation: [4]float64{0, 0, 0, 1}, Scale: [3]float64{1, 1, 1}},
 			},
-			Samplers: []Sampler{{WrapS: Repeat, WrapT: Repeat}},
+			Samplers: []*Sampler{{WrapS: WrapRepeat, WrapT: WrapRepeat}},
 			Scene:    Index(0),
-			Scenes:   []Scene{{Name: "Root Scene", Nodes: []uint32{0}}},
+			Scenes:   []*Scene{{Name: "Root Scene", Nodes: []uint32{0}}},
 		}, false},
 	}
 	for _, tt := range tests {
@@ -265,16 +265,16 @@ func TestDecoder_validateDocumentQuotas(t *testing.T) {
 	}{
 		{
 			"exceedBuffers", &Decoder{MaxMemoryAllocation: 100000, MaxExternalBufferCount: 1},
-			args{&Document{Buffers: make([]Buffer, 2)}, false}, true,
+			args{&Document{Buffers: []*Buffer{{}, {}}}, false}, true,
 		}, {
 			"noExceedBuffers", &Decoder{MaxMemoryAllocation: 100000, MaxExternalBufferCount: 1},
-			args{&Document{Buffers: make([]Buffer, 2)}, true}, false,
+			args{&Document{Buffers: []*Buffer{{}, {}}}, true}, false,
 		}, {
 			"exceedAllocs", &Decoder{MaxMemoryAllocation: 10, MaxExternalBufferCount: 100},
-			args{&Document{Buffers: []Buffer{{ByteLength: 11}}}, false}, true,
+			args{&Document{Buffers: []*Buffer{{ByteLength: 11}}}, false}, true,
 		}, {
 			"noExceedAllocs", &Decoder{MaxMemoryAllocation: 11, MaxExternalBufferCount: 100},
-			args{&Document{Buffers: []Buffer{{ByteLength: 11}}}, true}, false,
+			args{&Document{Buffers: []*Buffer{{ByteLength: 11}}}, true}, false,
 		},
 	}
 	for _, tt := range tests {
diff --git a/encode_test.go b/encode_test.go
index 9ceb21f..c3531bb 100644
--- a/encode_test.go
+++ b/encode_test.go
@@ -43,96 +43,96 @@ func TestEncoder_Encode(t *testing.T) {
 		args    args
 		wantErr bool
 	}{
-		{"withInvalidBuffer", args{&Document{Buffers: []Buffer{
-			{Extras: 8.0, Name: "binary", ByteLength: 3, URI: "a.bin", Data: []uint8{1, 2, 3}},
-			{Extras: 8.0, Name: "binary2", ByteLength: 3, URI: "/../a.bin", Data: []uint8{1, 2, 3}},
+		{"withInvalidBuffer", args{&Document{Buffers: []*Buffer{
+			{Extras: 8.0, Name: "binary", ByteLength: 3, URI: "a.bin", Data: []byte{1, 2, 3}},
+			{Extras: 8.0, Name: "binary2", ByteLength: 3, URI: "/../a.bin", Data: []byte{1, 2, 3}},
 		}}}, true},
 		{"empty", args{&Document{}}, false},
 		{"withExtensions", args{&Document{Extras: 8.0, ExtensionsUsed: []string{"c"}, ExtensionsRequired: []string{"d", "e"}}}, false},
 		{"withAsset", args{&Document{Asset: Asset{Extras: 8.0, Copyright: "@2019", Generator: "qmuntal/gltf", Version: "2.0", MinVersion: "1.0"}}}, false},
-		{"withAccessors", args{&Document{Accessors: []Accessor{
-			{Extras: 8.0, Name: "acc_1", BufferView: Index(0), ByteOffset: 50, ComponentType: Byte, Normalized: true, Count: 5, Type: Vec3, Max: []float64{1, 2}, Min: []float64{2.4}},
-			{BufferView: Index(0), Normalized: false, Count: 50, Type: Vec4, Sparse: &Sparse{Extras: 8.0, Count: 2,
+		{"withAccessors", args{&Document{Accessors: []*Accessor{
+			{Extras: 8.0, Name: "acc_1", BufferView: Index(0), ByteOffset: 50, ComponentType: ComponentByte, Normalized: true, Count: 5, Type: AccessorVec3, Max: []float64{1, 2}, Min: []float64{2.4}},
+			{BufferView: Index(0), Normalized: false, Count: 50, Type: AccessorVec4, Sparse: &Sparse{Extras: 8.0, Count: 2,
 				Values:  SparseValues{Extras: 8.0, BufferView: 1, ByteOffset: 2},
-				Indices: SparseIndices{Extras: 8.0, BufferView: 1, ByteOffset: 2, ComponentType: Float}},
+				Indices: SparseIndices{Extras: 8.0, BufferView: 1, ByteOffset: 2, ComponentType: ComponentFloat}},
 			},
 		}}}, false},
-		{"withAnimations", args{&Document{Animations: []Animation{
-			{Extras: 8.0, Name: "an_1", Channels: []Channel{
-				{Extras: 8.0, Sampler: Index(1), Target: ChannelTarget{Extras: 8.0, Node: Index(10), Path: Rotation}},
-				{Extras: 8.0, Sampler: Index(2), Target: ChannelTarget{Extras: 8.0, Node: Index(10), Path: Scale}},
+		{"withAnimations", args{&Document{Animations: []*Animation{
+			{Extras: 8.0, Name: "an_1", Channels: []*Channel{
+				{Extras: 8.0, Sampler: Index(1), Target: ChannelTarget{Extras: 8.0, Node: Index(10), Path: TRSRotation}},
+				{Extras: 8.0, Sampler: Index(2), Target: ChannelTarget{Extras: 8.0, Node: Index(10), Path: TRSScale}},
 			}},
-			{Extras: 8.0, Name: "an_2", Channels: []Channel{
-				{Extras: 8.0, Sampler: Index(1), Target: ChannelTarget{Extras: 8.0, Node: Index(3), Path: Weights}},
-				{Extras: 8.0, Sampler: Index(2), Target: ChannelTarget{Extras: 8.0, Node: Index(5), Path: Translation}},
+			{Extras: 8.0, Name: "an_2", Channels: []*Channel{
+				{Extras: 8.0, Sampler: Index(1), Target: ChannelTarget{Extras: 8.0, Node: Index(3), Path: TRSWeights}},
+				{Extras: 8.0, Sampler: Index(2), Target: ChannelTarget{Extras: 8.0, Node: Index(5), Path: TRSTranslation}},
 			}},
-			{Extras: 8.0, Name: "an_3", Samplers: []AnimationSampler{
-				{Extras: 8.0, Input: Index(1), Output: Index(1), Interpolation: CubicSpline},
+			{Extras: 8.0, Name: "an_3", Samplers: []*AnimationSampler{
+				{Extras: 8.0, Input: Index(1), Output: Index(1), Interpolation: InterpolationCubicSpline},
 			}},
 		}}}, false},
-		{"withBuffer", args{&Document{Buffers: []Buffer{
-			{Extras: 8.0, Name: "binary", ByteLength: 3, URI: "a.bin", Data: []uint8{1, 2, 3}},
+		{"withBuffer", args{&Document{Buffers: []*Buffer{
+			{Extras: 8.0, Name: "binary", ByteLength: 3, URI: "a.bin", Data: []byte{1, 2, 3}},
 			{Extras: 8.0, Name: "embedded", ByteLength: 2, URI: "data:application/octet-stream;base64,YW55ICsgb2xkICYgZGF0YQ==", Data: []byte("any + old & data")},
-			{Extras: 8.0, Name: "external", ByteLength: 4, URI: "b.bin", Data: []uint8{4, 5, 6, 7}},
-			{Extras: 8.0, Name: "external", ByteLength: 4, URI: "a.drc", Data: []uint8{0, 0, 0, 0}},
+			{Extras: 8.0, Name: "external", ByteLength: 4, URI: "b.bin", Data: []byte{4, 5, 6, 7}},
+			{Extras: 8.0, Name: "external", ByteLength: 4, URI: "a.drc", Data: []byte{0, 0, 0, 0}},
 		}}}, false},
-		{"withBufView", args{&Document{BufferViews: []BufferView{
-			{Extras: 8.0, Buffer: 0, ByteOffset: 1, ByteLength: 2, ByteStride: 5, Target: ArrayBuffer},
-			{Buffer: 10, ByteOffset: 10, ByteLength: 20, ByteStride: 50, Target: ElementArrayBuffer},
+		{"withBufView", args{&Document{BufferViews: []*BufferView{
+			{Extras: 8.0, Buffer: 0, ByteOffset: 1, ByteLength: 2, ByteStride: 5, Target: TargetArrayBuffer},
+			{Buffer: 10, ByteOffset: 10, ByteLength: 20, ByteStride: 50, Target: TargetElementArrayBuffer},
 		}}}, false},
-		{"withCameras", args{&Document{Cameras: []Camera{
+		{"withCameras", args{&Document{Cameras: []*Camera{
 			{Extras: 8.0, Name: "cam_1", Orthographic: &Orthographic{Extras: 8.0, Xmag: 1, Ymag: 2, Zfar: 3, Znear: 4}},
 			{Extras: 8.0, Name: "cam_2", Perspective: &Perspective{Extras: 8.0, AspectRatio: Float64(1), Yfov: 2, Zfar: Float64(3), Znear: 4}},
 		}}}, false},
-		{"withImages", args{&Document{Images: []Image{
+		{"withImages", args{&Document{Images: []*Image{
 			{Extras: 8.0, Name: "binary", BufferView: Index(1), MimeType: "data:image/png"},
 			{Extras: 8.0, Name: "embedded", URI: "data:image/png;base64,dsjdsaGGUDXGA", MimeType: "data:image/png"},
 			{Extras: 8.0, Name: "external", URI: "https://web.com/a", MimeType: "data:image/png"},
 		}}}, false},
-		{"withMaterials", args{&Document{Materials: []Material{
-			{Extras: 8.0, Name: "base", EmissiveFactor: [3]float64{1.0, 1.0, 1.0}, DoubleSided: true, AlphaCutoff: Float64(0.5), AlphaMode: Opaque},
-			{Extras: 8.0, Name: "pbr", AlphaCutoff: Float64(0.5), AlphaMode: Opaque,
+		{"withMaterials", args{&Document{Materials: []*Material{
+			{Extras: 8.0, Name: "base", EmissiveFactor: [3]float64{1.0, 1.0, 1.0}, DoubleSided: true, AlphaCutoff: Float64(0.5), AlphaMode: AlphaOpaque},
+			{Extras: 8.0, Name: "pbr", AlphaCutoff: Float64(0.5), AlphaMode: AlphaOpaque,
 				PBRMetallicRoughness: &PBRMetallicRoughness{
 					Extras: 8.0, MetallicFactor: Float64(1), RoughnessFactor: Float64(2), BaseColorFactor: &RGBA{R: 0.8, G: 0.8, B: 0.8, A: 1},
 					BaseColorTexture:         &TextureInfo{Extras: 8.0, Index: 1, TexCoord: 3},
 					MetallicRoughnessTexture: &TextureInfo{Extras: 8.0, Index: 6, TexCoord: 5},
 				},
 			},
-			{Extras: 8.0, Name: "normal", AlphaCutoff: Float64(0.7), AlphaMode: Blend,
+			{Extras: 8.0, Name: "normal", AlphaCutoff: Float64(0.7), AlphaMode: AlphaBlend,
 				NormalTexture: &NormalTexture{Extras: 8.0, Index: Index(1), TexCoord: 2, Scale: Float64(2.0)},
 			},
-			{Extras: 8.0, Name: "occlusion", AlphaCutoff: Float64(0.5), AlphaMode: Mask,
+			{Extras: 8.0, Name: "occlusion", AlphaCutoff: Float64(0.5), AlphaMode: AlphaMask,
 				OcclusionTexture: &OcclusionTexture{Extras: 8.0, Index: Index(1), TexCoord: 2, Strength: Float64(2.0)},
 			},
-			{Extras: 8.0, Name: "emmisice", AlphaCutoff: Float64(0.5), AlphaMode: Mask, EmissiveTexture: &TextureInfo{Extras: 8.0, Index: 4, TexCoord: 50}},
+			{Extras: 8.0, Name: "emmisice", AlphaCutoff: Float64(0.5), AlphaMode: AlphaMask, EmissiveTexture: &TextureInfo{Extras: 8.0, Index: 4, TexCoord: 50}},
 		}}}, false},
-		{"withMeshes", args{&Document{Meshes: []Mesh{
+		{"withMeshes", args{&Document{Meshes: []*Mesh{
 			{Extras: 8.0, Name: "mesh_1", Weights: []float64{1.2, 2}},
-			{Extras: 8.0, Name: "mesh_2", Primitives: []Primitive{
-				{Extras: 8.0, Attributes: Attribute{"POSITION": 1}, Indices: Index(2), Material: Index(1), Mode: Lines},
-				{Extras: 8.0, Targets: []Attribute{{"POSITION": 1, "THEN": 4}, {"OTHER": 2}}, Indices: Index(2), Material: Index(1), Mode: Lines},
+			{Extras: 8.0, Name: "mesh_2", Primitives: []*Primitive{
+				{Extras: 8.0, Attributes: Attribute{"POSITION": 1}, Indices: Index(2), Material: Index(1), Mode: PrimitiveLines},
+				{Extras: 8.0, Targets: []Attribute{{"POSITION": 1, "THEN": 4}, {"OTHER": 2}}, Indices: Index(2), Material: Index(1), Mode: PrimitiveLines},
 			}},
 		}}}, false},
-		{"withNodes", args{&Document{Nodes: []Node{
+		{"withNodes", args{&Document{Nodes: []*Node{
 			{Extras: 8.0, Name: "n-1", Camera: Index(1), Children: []uint32{1, 2}, Skin: Index(3),
 				Matrix: [16]float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, Mesh: Index(15), Rotation: [4]float64{1.5, 1.3, 12, 0}, Scale: [3]float64{1, 3, 4}, Translation: [3]float64{0, 7.8, 9}, Weights: []float64{1, 3}},
 			{Extras: 8.0, Name: "n-2", Camera: Index(1), Children: []uint32{1, 2}, Skin: Index(3),
 				Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Mesh: Index(15), Rotation: [4]float64{0, 0, 0, 1}, Scale: [3]float64{1, 1, 1}},
 		}}}, false},
-		{"withSampler", args{&Document{Samplers: []Sampler{
-			{Extras: 8.0, Name: "s_1", MagFilter: MagLinear, MinFilter: MinLinearMipMapLinear, WrapS: ClampToEdge, WrapT: MirroredRepeat},
-			{Extras: 8.0, Name: "s_2", MagFilter: MagNearest, MinFilter: MinLinearMipMapLinear, WrapS: MirroredRepeat, WrapT: Repeat},
+		{"withSampler", args{&Document{Samplers: []*Sampler{
+			{Extras: 8.0, Name: "s_1", MagFilter: MagLinear, MinFilter: MinLinearMipMapLinear, WrapS: WrapClampToEdge, WrapT: WrapMirroredRepeat},
+			{Extras: 8.0, Name: "s_2", MagFilter: MagNearest, MinFilter: MinLinearMipMapLinear, WrapS: WrapMirroredRepeat, WrapT: WrapRepeat},
 		}}}, false},
 		{"withScene", args{&Document{Scene: Index(1)}}, false},
-		{"withScenes", args{&Document{Scenes: []Scene{
+		{"withScenes", args{&Document{Scenes: []*Scene{
 			{Extras: 8.0, Name: "s_1", Nodes: []uint32{1, 2}},
 			{Extras: 8.0, Name: "s_2", Nodes: []uint32{2, 3}},
 		}}}, false},
-		{"withSkins", args{&Document{Skins: []Skin{
+		{"withSkins", args{&Document{Skins: []*Skin{
 			{Extras: 8.0, Name: "skin_1", InverseBindMatrices: Index(2), Skeleton: Index(4), Joints: []uint32{5, 6}},
 			{Extras: 8.0, Name: "skin_2", InverseBindMatrices: Index(3), Skeleton: Index(4), Joints: []uint32{7, 8}},
 		}}}, false},
-		{"withTextures", args{&Document{Textures: []Texture{
+		{"withTextures", args{&Document{Textures: []*Texture{
 			{Extras: 8.0, Name: "t_1", Sampler: Index(2), Source: Index(3)},
 			{Extras: 8.0, Name: "t_2", Sampler: Index(3), Source: Index(4)},
 		}}}, false},
diff --git a/example_test.go b/example_test.go
index f8b2f78..4591ca5 100644
--- a/example_test.go
+++ b/example_test.go
@@ -16,36 +16,36 @@ func ExampleOpen() {
 
 func ExampleSave() {
 	doc := &gltf.Document{
-		Accessors: []gltf.Accessor{
-			{BufferView: gltf.Index(0), ComponentType: gltf.UnsignedShort, Count: 36, Type: gltf.Scalar},
-			{BufferView: gltf.Index(1), ComponentType: gltf.Float, Count: 24, Max: []float64{0.5, 0.5, 0.5}, Min: []float64{-0.5, -0.5, -0.5}, Type: gltf.Vec3},
-			{BufferView: gltf.Index(2), ComponentType: gltf.Float, Count: 24, Type: gltf.Vec3},
-			{BufferView: gltf.Index(3), ComponentType: gltf.Float, Count: 24, Type: gltf.Vec4},
-			{BufferView: gltf.Index(4), ComponentType: gltf.Float, Count: 24, Type: gltf.Vec2},
+		Accessors: []*gltf.Accessor{
+			{BufferView: gltf.Index(0), ComponentType: gltf.ComponentUshort, Count: 36, Type: gltf.AccessorScalar},
+			{BufferView: gltf.Index(1), ComponentType: gltf.ComponentFloat, Count: 24, Max: []float64{0.5, 0.5, 0.5}, Min: []float64{-0.5, -0.5, -0.5}, Type: gltf.AccessorVec3},
+			{BufferView: gltf.Index(2), ComponentType: gltf.ComponentFloat, Count: 24, Type: gltf.AccessorVec3},
+			{BufferView: gltf.Index(3), ComponentType: gltf.ComponentFloat, Count: 24, Type: gltf.AccessorVec4},
+			{BufferView: gltf.Index(4), ComponentType: gltf.ComponentFloat, Count: 24, Type: gltf.AccessorVec2},
 		},
 		Asset: gltf.Asset{Version: "2.0", Generator: "FBX2glTF"},
-		BufferViews: []gltf.BufferView{
-			{Buffer: 0, ByteLength: 72, ByteOffset: 0, Target: gltf.ElementArrayBuffer},
-			{Buffer: 0, ByteLength: 288, ByteOffset: 72, Target: gltf.ArrayBuffer},
-			{Buffer: 0, ByteLength: 288, ByteOffset: 360, Target: gltf.ArrayBuffer},
-			{Buffer: 0, ByteLength: 384, ByteOffset: 648, Target: gltf.ArrayBuffer},
-			{Buffer: 0, ByteLength: 192, ByteOffset: 1032, Target: gltf.ArrayBuffer},
+		BufferViews: []*gltf.BufferView{
+			{Buffer: 0, ByteLength: 72, ByteOffset: 0, Target: gltf.TargetElementArrayBuffer},
+			{Buffer: 0, ByteLength: 288, ByteOffset: 72, Target: gltf.TargetArrayBuffer},
+			{Buffer: 0, ByteLength: 288, ByteOffset: 360, Target: gltf.TargetArrayBuffer},
+			{Buffer: 0, ByteLength: 384, ByteOffset: 648, Target: gltf.TargetArrayBuffer},
+			{Buffer: 0, ByteLength: 192, ByteOffset: 1032, Target: gltf.TargetArrayBuffer},
 		},
-		Buffers: []gltf.Buffer{{ByteLength: 1224, Data: []uint8{97, 110, 121, 32, 99, 97, 114, 110, 97, 108, 32, 112, 108, 101, 97, 115}}},
-		Materials: []gltf.Material{{
-			Name: "Default", AlphaMode: gltf.Opaque, AlphaCutoff: gltf.Float64(0.5),
+		Buffers: []*gltf.Buffer{{ByteLength: 1224, Data: []byte{97, 110, 121, 32, 99, 97, 114, 110, 97, 108, 32, 112, 108, 101, 97, 115}}},
+		Materials: []*gltf.Material{{
+			Name: "Default", AlphaMode: gltf.AlphaOpaque, AlphaCutoff: gltf.Float64(0.5),
 			PBRMetallicRoughness: &gltf.PBRMetallicRoughness{BaseColorFactor: &gltf.RGBA{R: 0.8, G: 0.8, B: 0.8, A: 1}, MetallicFactor: gltf.Float64(0.1), RoughnessFactor: gltf.Float64(0.99)},
 		}},
-		Meshes: []gltf.Mesh{{Name: "Cube", Primitives: []gltf.Primitive{{Indices: gltf.Index(0), Material: gltf.Index(0), Mode: gltf.Triangles, Attributes: map[string]uint32{"POSITION": 1, "COLOR_0": 3, "NORMAL": 2, "TEXCOORD_0": 4}}}}},
-		Nodes: []gltf.Node{
+		Meshes: []*gltf.Mesh{{Name: "Cube", Primitives: []*gltf.Primitive{{Indices: gltf.Index(0), Material: gltf.Index(0), Mode: gltf.PrimitiveTriangles, Attributes: map[string]uint32{"POSITION": 1, "COLOR_0": 3, "NORMAL": 2, "TEXCOORD_0": 4}}}}},
+		Nodes: []*gltf.Node{
 			{Name: "RootNode", Children: []uint32{1, 2, 3}},
 			{Name: "Mesh"},
 			{Name: "Cube", Mesh: gltf.Index(0)},
 			{Name: "Texture Group"},
 		},
-		Samplers: []gltf.Sampler{{WrapS: gltf.Repeat, WrapT: gltf.Repeat}},
+		Samplers: []*gltf.Sampler{{WrapS: gltf.WrapRepeat, WrapT: gltf.WrapRepeat}},
 		Scene:    gltf.Index(0),
-		Scenes:   []gltf.Scene{{Name: "Root Scene", Nodes: []uint32{0}}},
+		Scenes:   []*gltf.Scene{{Name: "Root Scene", Nodes: []uint32{0}}},
 	}
 	if err := gltf.SaveBinary(doc, "./example.glb"); err != nil {
 		panic(err)
diff --git a/marshal_test.go b/marshal_test.go
index c0d7120..e0b7fb2 100644
--- a/marshal_test.go
+++ b/marshal_test.go
@@ -10,15 +10,15 @@ func TestImage_MarshalData(t *testing.T) {
 	tests := []struct {
 		name    string
 		im      *Image
-		want    []uint8
+		want    []byte
 		wantErr bool
 	}{
-		{"error", &Image{URI: "data:image/png;base64,_"}, []uint8{}, true},
-		{"external", &Image{URI: "http://web.com"}, []uint8{}, false},
-		{"empty", &Image{URI: "data:image/png;base64,"}, []uint8{}, false},
-		{"empty", &Image{URI: "data:image/jpeg;base64,"}, []uint8{}, false},
-		{"test", &Image{URI: "data:image/png;base64,TEST"}, []uint8{76, 68, 147}, false},
-		{"complex", &Image{URI: "data:image/png;base64,YW55IGNhcm5hbCBwbGVhcw=="}, []uint8{97, 110, 121, 32, 99, 97, 114, 110, 97, 108, 32, 112, 108, 101, 97, 115}, false},
+		{"error", &Image{URI: "data:image/png;base64,_"}, []byte{}, true},
+		{"external", &Image{URI: "http://web.com"}, []byte{}, false},
+		{"empty", &Image{URI: "data:image/png;base64,"}, []byte{}, false},
+		{"empty", &Image{URI: "data:image/jpeg;base64,"}, []byte{}, false},
+		{"test", &Image{URI: "data:image/png;base64,TEST"}, []byte{76, 68, 147}, false},
+		{"complex", &Image{URI: "data:image/png;base64,YW55IGNhcm5hbCBwbGVhcw=="}, []byte{97, 110, 121, 32, 99, 97, 114, 110, 97, 108, 32, 112, 108, 101, 97, 115}, false},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -91,8 +91,8 @@ func TestMaterial_UnmarshalJSON(t *testing.T) {
 		want    *Material
 		wantErr bool
 	}{
-		{"default", new(Material), args{[]byte("{}")}, &Material{AlphaCutoff: Float64(0.5), AlphaMode: Opaque}, false},
-		{"nodefault", new(Material), args{[]byte(`{"alphaCutoff": 0.2, "alphaMode": "MASK"}`)}, &Material{AlphaCutoff: Float64(0.2), AlphaMode: Mask}, false},
+		{"default", new(Material), args{[]byte("{}")}, &Material{AlphaCutoff: Float64(0.5), AlphaMode: AlphaOpaque}, false},
+		{"nodefault", new(Material), args{[]byte(`{"alphaCutoff": 0.2, "alphaMode": "MASK"}`)}, &Material{AlphaCutoff: Float64(0.2), AlphaMode: AlphaMask}, false},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -248,9 +248,9 @@ func TestMaterial_MarshalJSON(t *testing.T) {
 		want    []byte
 		wantErr bool
 	}{
-		{"default", &Material{AlphaCutoff: Float64(0.5), AlphaMode: Opaque}, []byte(`{}`), false},
-		{"empty", &Material{AlphaMode: Blend}, []byte(`{"alphaMode":"BLEND"}`), false},
-		{"nodefault", &Material{AlphaCutoff: Float64(1), AlphaMode: Blend}, []byte(`{"alphaMode":"BLEND","alphaCutoff":1}`), false},
+		{"default", &Material{AlphaCutoff: Float64(0.5), AlphaMode: AlphaOpaque}, []byte(`{}`), false},
+		{"empty", &Material{AlphaMode: AlphaBlend}, []byte(`{"alphaMode":"BLEND"}`), false},
+		{"nodefault", &Material{AlphaCutoff: Float64(1), AlphaMode: AlphaBlend}, []byte(`{"alphaMode":"BLEND","alphaCutoff":1}`), false},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
diff --git a/modeler/example_test.go b/modeler/example_test.go
index 178e5e4..4e2e99f 100644
--- a/modeler/example_test.go
+++ b/modeler/example_test.go
@@ -10,9 +10,9 @@ func Example() {
 	positionAccessor := m.AddPosition(0, [][3]float32{{43, 43, 0}, {83, 43, 0}, {63, 63, 40}, {43, 83, 0}, {83, 83, 0}})
 	indicesAccessor := m.AddIndices(0, []uint8{0, 1, 2, 3, 1, 0, 0, 2, 3, 1, 4, 2, 4, 3, 2, 4, 1, 3})
 	colorIndices := m.AddColor(0, [][3]uint8{{50, 155, 255}, {0, 100, 200}, {255, 155, 50}, {155, 155, 155}, {25, 25, 25}})
-	m.Document.Meshes = []gltf.Mesh{{
+	m.Document.Meshes = []*gltf.Mesh{{
 		Name: "Pyramid",
-		Primitives: []gltf.Primitive{
+		Primitives: []*gltf.Primitive{
 			{
 				Indices: gltf.Index(indicesAccessor),
 				Attributes: map[string]uint32{
@@ -22,7 +22,7 @@ func Example() {
 			},
 		},
 	}}
-	m.Nodes = []gltf.Node{{Name: "Root", Mesh: gltf.Index(0)}}
+	m.Nodes = []*gltf.Node{{Name: "Root", Mesh: gltf.Index(0)}}
 	m.Scenes[0].Nodes = append(m.Scenes[0].Nodes, 0)
 	if err := gltf.SaveBinary(m.Document, "./example.glb"); err != nil {
 		panic(err)
diff --git a/modeler/modeler_test.go b/modeler/modeler_test.go
index 3fa898f..2bd6a12 100644
--- a/modeler/modeler_test.go
+++ b/modeler/modeler_test.go
@@ -18,7 +18,7 @@ func TestNewModeler(t *testing.T) {
 	}{
 		{"base", &Modeler{Document: &gltf.Document{
 			Scene:  gltf.Index(0),
-			Scenes: []gltf.Scene{{Name: "Root Scene"}},
+			Scenes: []*gltf.Scene{{Name: "Root Scene"}},
 		}, Compression: CompressionLossless}},
 	}
 	for _, tt := range tests {
@@ -43,17 +43,17 @@ func TestModeler_AddNormal(t *testing.T) {
 		wantDoc *gltf.Document
 	}{
 		{"base", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][3]float32{{1, 2, 3}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 1, Type: gltf.Vec3, ComponentType: gltf.Float},
+				{BufferView: gltf.Index(0), Count: 1, Type: gltf.AccessorVec3, ComponentType: gltf.ComponentFloat},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 12, Target: gltf.ArrayBuffer, ByteStride: 12},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 12, Target: gltf.TargetArrayBuffer, ByteStride: 12},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 22, Data: []byte{0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64}},
 			},
 		}},
@@ -86,17 +86,17 @@ func TestModeler_AddTangent(t *testing.T) {
 		wantDoc *gltf.Document
 	}{
 		{"base", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][4]float32{{1, 2, 3, 4}, {}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 2, Type: gltf.Vec4, ComponentType: gltf.Float},
+				{BufferView: gltf.Index(0), Count: 2, Type: gltf.AccessorVec4, ComponentType: gltf.ComponentFloat},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 32, Target: gltf.ArrayBuffer, ByteStride: 16},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 32, Target: gltf.TargetArrayBuffer, ByteStride: 16},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 42, Data: []byte{0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
 			},
 		}},
@@ -129,17 +129,17 @@ func TestModeler_AddPosition(t *testing.T) {
 		wantDoc *gltf.Document
 	}{
 		{"base", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][3]float32{{1, 2, 3}, {0, 0, -1}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 2, Type: gltf.Vec3, ComponentType: gltf.Float, Max: []float64{1, 2, 3}, Min: []float64{0, 0, -1}},
+				{BufferView: gltf.Index(0), Count: 2, Type: gltf.AccessorVec3, ComponentType: gltf.ComponentFloat, Max: []float64{1, 2, 3}, Min: []float64{0, 0, -1}},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 24, Target: gltf.ArrayBuffer, ByteStride: 12},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 24, Target: gltf.TargetArrayBuffer, ByteStride: 12},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 34, Data: []byte{0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191}},
 			},
 		}},
@@ -172,32 +172,32 @@ func TestModeler_AddJoints(t *testing.T) {
 		wantDoc *gltf.Document
 	}{
 		{"uint8", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][4]uint8{{1, 2, 3, 4}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 1, Type: gltf.Vec4, ComponentType: gltf.UnsignedByte},
+				{BufferView: gltf.Index(0), Count: 1, Type: gltf.AccessorVec4, ComponentType: gltf.ComponentUbyte},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 4, Target: gltf.ArrayBuffer, ByteStride: 4},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 4, Target: gltf.TargetArrayBuffer, ByteStride: 4},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 14, Data: []byte{1, 2, 3, 4}},
 			},
 		}},
 		{"uint16", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][4]uint16{{1, 2, 3, 4}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 1, Type: gltf.Vec4, ComponentType: gltf.UnsignedShort},
+				{BufferView: gltf.Index(0), Count: 1, Type: gltf.AccessorVec4, ComponentType: gltf.ComponentUshort},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 8, Target: gltf.ArrayBuffer, ByteStride: 8},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 8, Target: gltf.TargetArrayBuffer, ByteStride: 8},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 18, Data: []byte{1, 0, 2, 0, 3, 0, 4, 0}},
 			},
 		}},
@@ -230,47 +230,47 @@ func TestModeler_AddWeights(t *testing.T) {
 		wantDoc *gltf.Document
 	}{
 		{"uint8", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][4]uint8{{1, 2, 3, 4}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 1, Type: gltf.Vec4, ComponentType: gltf.UnsignedByte, Normalized: true},
+				{BufferView: gltf.Index(0), Count: 1, Type: gltf.AccessorVec4, ComponentType: gltf.ComponentUbyte, Normalized: true},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 4, Target: gltf.ArrayBuffer, ByteStride: 4},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 4, Target: gltf.TargetArrayBuffer, ByteStride: 4},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 14, Data: []byte{1, 2, 3, 4}},
 			},
 		}},
 		{"uint16", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][4]uint16{{1, 2, 3, 4}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 1, Type: gltf.Vec4, ComponentType: gltf.UnsignedShort, Normalized: true},
+				{BufferView: gltf.Index(0), Count: 1, Type: gltf.AccessorVec4, ComponentType: gltf.ComponentUshort, Normalized: true},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 8, Target: gltf.ArrayBuffer, ByteStride: 8},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 8, Target: gltf.TargetArrayBuffer, ByteStride: 8},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 18, Data: []byte{1, 0, 2, 0, 3, 0, 4, 0}},
 			},
 		}},
 		{"float", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][4]float32{{1, 2, 3, 4}, {}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 2, Type: gltf.Vec4, ComponentType: gltf.Float},
+				{BufferView: gltf.Index(0), Count: 2, Type: gltf.AccessorVec4, ComponentType: gltf.ComponentFloat},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 32, Target: gltf.ArrayBuffer, ByteStride: 16},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 32, Target: gltf.TargetArrayBuffer, ByteStride: 16},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 42, Data: []byte{0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
 			},
 		}},
@@ -303,47 +303,47 @@ func TestModeler_AddTextureCoord(t *testing.T) {
 		wantDoc *gltf.Document
 	}{
 		{"uint8", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][2]uint8{{1, 2}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 1, Type: gltf.Vec2, ComponentType: gltf.UnsignedByte, Normalized: true},
+				{BufferView: gltf.Index(0), Count: 1, Type: gltf.AccessorVec2, ComponentType: gltf.ComponentUbyte, Normalized: true},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 4, Target: gltf.ArrayBuffer, ByteStride: 4},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 4, Target: gltf.TargetArrayBuffer, ByteStride: 4},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 14, Data: []byte{1, 2, 0, 0}},
 			},
 		}},
 		{"uint16", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][2]uint16{{1, 2}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 1, Type: gltf.Vec2, ComponentType: gltf.UnsignedShort, Normalized: true},
+				{BufferView: gltf.Index(0), Count: 1, Type: gltf.AccessorVec2, ComponentType: gltf.ComponentUshort, Normalized: true},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 4, Target: gltf.ArrayBuffer, ByteStride: 4},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 4, Target: gltf.TargetArrayBuffer, ByteStride: 4},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 14, Data: []byte{1, 0, 2, 0}},
 			},
 		}},
 		{"float", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{2, [][2]float32{{1, 2}, {}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 2, Type: gltf.Vec2, ComponentType: gltf.Float},
+				{BufferView: gltf.Index(0), Count: 2, Type: gltf.AccessorVec2, ComponentType: gltf.ComponentFloat},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 16, Target: gltf.ArrayBuffer, Buffer: 2, ByteStride: 8},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 16, Target: gltf.TargetArrayBuffer, Buffer: 2, ByteStride: 8},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 10},
 				{},
 				{ByteLength: 16, Data: []byte{0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0}},
@@ -378,77 +378,77 @@ func TestModeler_AddIndices(t *testing.T) {
 		wantDoc *gltf.Document
 	}{
 		{"uint8", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, []uint8{1, 2}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 2, Type: gltf.Scalar, ComponentType: gltf.UnsignedByte},
+				{BufferView: gltf.Index(0), Count: 2, Type: gltf.AccessorScalar, ComponentType: gltf.ComponentUbyte},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 2, Target: gltf.ElementArrayBuffer},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 2, Target: gltf.TargetElementArrayBuffer},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 12, Data: []byte{1, 2}},
 			},
 		}},
 		{"uint16", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, []uint16{1, 2}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 2, Type: gltf.Scalar, ComponentType: gltf.UnsignedShort},
+				{BufferView: gltf.Index(0), Count: 2, Type: gltf.AccessorScalar, ComponentType: gltf.ComponentUshort},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 4, Target: gltf.ElementArrayBuffer},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 4, Target: gltf.TargetElementArrayBuffer},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 14, Data: []byte{1, 0, 2, 0}},
 			},
 		}},
 		{"uint16-compress", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}, Compression: CompressionLossless}, args{0, []uint16{1, 2}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 2, Type: gltf.Scalar, ComponentType: gltf.UnsignedByte},
+				{BufferView: gltf.Index(0), Count: 2, Type: gltf.AccessorScalar, ComponentType: gltf.ComponentUbyte},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 2, Target: gltf.ElementArrayBuffer},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 2, Target: gltf.TargetElementArrayBuffer},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 12, Data: []byte{1, 2}},
 			},
 		}},
 		{"uint32", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, []uint32{1, 2}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 2, Type: gltf.Scalar, ComponentType: gltf.UnsignedInt},
+				{BufferView: gltf.Index(0), Count: 2, Type: gltf.AccessorScalar, ComponentType: gltf.ComponentUint},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 8, Target: gltf.ElementArrayBuffer},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 8, Target: gltf.TargetElementArrayBuffer},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 18, Data: []byte{1, 0, 0, 0, 2, 0, 0, 0}},
 			},
 		}},
 		{"uint32-compress", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}, Compression: CompressionLossless}, args{0, []uint32{1, 2}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 2, Type: gltf.Scalar, ComponentType: gltf.UnsignedByte},
+				{BufferView: gltf.Index(0), Count: 2, Type: gltf.AccessorScalar, ComponentType: gltf.ComponentUbyte},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 2, Target: gltf.ElementArrayBuffer},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 2, Target: gltf.TargetElementArrayBuffer},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 12, Data: []byte{1, 2}},
 			},
 		}},
@@ -481,46 +481,46 @@ func TestModeler_AddColor(t *testing.T) {
 		wantDoc *gltf.Document
 	}{
 		{"uint8", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][4]uint8{{1, 2, 3, 4}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 1, Type: gltf.Vec4, ComponentType: gltf.UnsignedByte, Normalized: true},
+				{BufferView: gltf.Index(0), Count: 1, Type: gltf.AccessorVec4, ComponentType: gltf.ComponentUbyte, Normalized: true},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 4, Target: gltf.ArrayBuffer, ByteStride: 4},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 4, Target: gltf.TargetArrayBuffer, ByteStride: 4},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 14, Data: []byte{1, 2, 3, 4}},
 			},
 		}},
 		{"uint16", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
-			Buffers:   []gltf.Buffer{{ByteLength: 10}},
+			Accessors: []*gltf.Accessor{{}},
+			Buffers:   []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, [][4]uint16{{1, 2, 3, 4}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 1, Type: gltf.Vec4, ComponentType: gltf.UnsignedShort, Normalized: true},
+				{BufferView: gltf.Index(0), Count: 1, Type: gltf.AccessorVec4, ComponentType: gltf.ComponentUshort, Normalized: true},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 8, Target: gltf.ArrayBuffer, ByteStride: 8},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 8, Target: gltf.TargetArrayBuffer, ByteStride: 8},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 18, Data: []byte{1, 0, 2, 0, 3, 0, 4, 0}},
 			},
 		}},
 		{"float", &Modeler{Document: &gltf.Document{
-			Accessors: []gltf.Accessor{{}},
+			Accessors: []*gltf.Accessor{{}},
 		}}, args{0, [][4]float32{{1, 2, 3, 4}, {}}}, 1, &gltf.Document{
-			Accessors: []gltf.Accessor{
+			Accessors: []*gltf.Accessor{
 				{},
-				{BufferView: gltf.Index(0), Count: 2, Type: gltf.Vec4, ComponentType: gltf.Float},
+				{BufferView: gltf.Index(0), Count: 2, Type: gltf.AccessorVec4, ComponentType: gltf.ComponentFloat},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 32, Target: gltf.ArrayBuffer, ByteStride: 16},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 32, Target: gltf.TargetArrayBuffer, ByteStride: 16},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 32, Data: []byte{0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
 			},
 		}},
@@ -556,43 +556,43 @@ func TestModeler_AddImage(t *testing.T) {
 		wantErr bool
 	}{
 		{"base", &Modeler{Document: &gltf.Document{
-			Images:  []gltf.Image{{}},
-			Buffers: []gltf.Buffer{{ByteLength: 10}},
+			Images:  []*gltf.Image{{}},
+			Buffers: []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, "fake", "fake/type", bytes.NewReader([]byte{1, 2})}, 1, &gltf.Document{
-			Images: []gltf.Image{
+			Images: []*gltf.Image{
 				{},
 				{BufferView: gltf.Index(0), Name: "fake", MimeType: "fake/type"},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 2, Target: gltf.None},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 2, Target: gltf.TargetNone},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 12, Data: []byte{1, 2}},
 			},
 		}, false},
 		{"buffer", &Modeler{Document: &gltf.Document{
-			Images:  []gltf.Image{{}},
-			Buffers: []gltf.Buffer{{ByteLength: 10}},
+			Images:  []*gltf.Image{{}},
+			Buffers: []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, "fake", "fake/type", bytes.NewBuffer([]byte{1, 2})}, 1, &gltf.Document{
-			Images: []gltf.Image{
+			Images: []*gltf.Image{
 				{},
 				{BufferView: gltf.Index(0), Name: "fake", MimeType: "fake/type"},
 			},
-			BufferViews: []gltf.BufferView{
-				{ByteLength: 2, Target: gltf.None},
+			BufferViews: []*gltf.BufferView{
+				{ByteLength: 2, Target: gltf.TargetNone},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 12, Data: []byte{1, 2}},
 			},
 		}, false},
 		{"err", &Modeler{Document: &gltf.Document{
-			Images:  []gltf.Image{{}},
-			Buffers: []gltf.Buffer{{ByteLength: 10}},
+			Images:  []*gltf.Image{{}},
+			Buffers: []*gltf.Buffer{{ByteLength: 10}},
 		}}, args{0, "fake", "fake/type", &errReader{}}, 0, &gltf.Document{
-			Images: []gltf.Image{
+			Images: []*gltf.Image{
 				{},
 			},
-			Buffers: []gltf.Buffer{
+			Buffers: []*gltf.Buffer{
 				{ByteLength: 10},
 			},
 		}, true},
diff --git a/struct_test.go b/struct_test.go
index 568fe2b..95299df 100644
--- a/struct_test.go
+++ b/struct_test.go
@@ -67,14 +67,14 @@ func TestBuffer_marshalData(t *testing.T) {
 	tests := []struct {
 		name    string
 		b       *Buffer
-		want    []uint8
+		want    []byte
 		wantErr bool
 	}{
 		{"error", &Buffer{URI: "data:application/octet-stream;base64,_"}, nil, true},
 		{"external", &Buffer{URI: "http://web.com"}, nil, false},
 		{"empty", &Buffer{URI: "data:application/octet-stream;base64,"}, nil, false},
-		{"test", &Buffer{URI: "data:application/octet-stream;base64,TEST"}, []uint8{76, 68, 147}, false},
-		{"complex", &Buffer{URI: "data:application/octet-stream;base64,YW55IGNhcm5hbCBwbGVhcw=="}, []uint8{97, 110, 121, 32, 99, 97, 114, 110, 97, 108, 32, 112, 108, 101, 97, 115}, false},
+		{"test", &Buffer{URI: "data:application/octet-stream;base64,TEST"}, []byte{76, 68, 147}, false},
+		{"complex", &Buffer{URI: "data:application/octet-stream;base64,YW55IGNhcm5hbCBwbGVhcw=="}, []byte{97, 110, 121, 32, 99, 97, 114, 110, 97, 108, 32, 112, 108, 101, 97, 115}, false},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {