Skip to content

Commit

Permalink
Add PBRSpecularGlossiness support
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Feb 21, 2019
1 parent 4b60c7b commit 9fdfca7
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 49 deletions.
94 changes: 47 additions & 47 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,93 +42,93 @@ func TestEncoder_Encode(t *testing.T) {
wantErr bool
}{
{"withInvalidBuffer", args{&Document{Buffers: []Buffer{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "binary", ByteLength: 3, URI: "a.bin", Data: []uint8{1, 2, 3}},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "binary2", ByteLength: 3, URI: "/../a.bin", Data: []uint8{1, 2, 3}},
{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}},
}}}, true},
{"empty", args{&Document{}}, false},
{"withExtensions", args{&Document{Extras: 8.0, Extensions: Extensions{"a": "b"}, ExtensionsUsed: []string{"c"}, ExtensionsRequired: []string{"d", "e"}}}, false},
{"withAsset", args{&Document{Asset: Asset{Extras: 8.0, Extensions: Extensions{"a": "b"}, Copyright: "@2019", Generator: "qmuntal/gltf", Version: "2.0", MinVersion: "1.0"}}}, 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, Extensions: Extensions{"a": "b"}, Name: "acc_1", BufferView: 0, ByteOffset: 50, ComponentType: Byte, Normalized: true, Count: 5, Type: Vec3, Max: []float64{1, 2}, Min: []float64{2.4}},
{BufferView: 0, Normalized: false, Count: 50, Type: Vec4, Sparse: &Sparse{Extras: 8.0, Extensions: Extensions{"a": "b"}, Count: 2,
Values: SparseValues{Extras: 8.0, Extensions: Extensions{"a": "b"}, BufferView: 1, ByteOffset: 2},
Indices: SparseIndices{Extras: 8.0, Extensions: Extensions{"a": "b"}, BufferView: 1, ByteOffset: 2, ComponentType: Float}},
{Extras: 8.0, Name: "acc_1", BufferView: 0, ByteOffset: 50, ComponentType: Byte, Normalized: true, Count: 5, Type: Vec3, Max: []float64{1, 2}, Min: []float64{2.4}},
{BufferView: 0, Normalized: false, Count: 50, Type: Vec4, 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}},
},
}}}, false},
{"withAnimations", args{&Document{Animations: []Animation{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "an_1", Channels: []Channel{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Sampler: 1, Target: ChannelTarget{Extras: 8.0, Extensions: Extensions{"a": "b"}, Node: 10, Path: Rotation}},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Sampler: 2, Target: ChannelTarget{Extras: 8.0, Extensions: Extensions{"a": "b"}, Node: 10, Path: Scale}},
{Extras: 8.0, Name: "an_1", Channels: []Channel{
{Extras: 8.0, Sampler: 1, Target: ChannelTarget{Extras: 8.0, Node: 10, Path: Rotation}},
{Extras: 8.0, Sampler: 2, Target: ChannelTarget{Extras: 8.0, Node: 10, Path: Scale}},
}},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "an_2", Channels: []Channel{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Sampler: 1, Target: ChannelTarget{Extras: 8.0, Extensions: Extensions{"a": "b"}, Node: 3, Path: Weights}},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Sampler: 2, Target: ChannelTarget{Extras: 8.0, Extensions: Extensions{"a": "b"}, Node: 5, Path: Translation}},
{Extras: 8.0, Name: "an_2", Channels: []Channel{
{Extras: 8.0, Sampler: 1, Target: ChannelTarget{Extras: 8.0, Node: 3, Path: Weights}},
{Extras: 8.0, Sampler: 2, Target: ChannelTarget{Extras: 8.0, Node: 5, Path: Translation}},
}},
}}}, false},
{"withBuffer", args{&Document{Buffers: []Buffer{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "binary", ByteLength: 3, URI: "a.bin", Data: []uint8{1, 2, 3}},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "embedded", ByteLength: 2, URI: "data:application/octet-stream;base64,YW55ICsgb2xkICYgZGF0YQ==", Data: []byte("any + old & data")},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "external", ByteLength: 4, URI: "b.bin", Data: []uint8{4, 5, 6, 7}},
{Extras: 8.0, Name: "binary", ByteLength: 3, URI: "a.bin", Data: []uint8{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}},
}}}, false},
{"withBufView", args{&Document{BufferViews: []BufferView{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Buffer: 0, ByteOffset: 1, ByteLength: 2, ByteStride: 5, Target: ArrayBuffer},
{Extras: 8.0, Buffer: 0, ByteOffset: 1, ByteLength: 2, ByteStride: 5, Target: ArrayBuffer},
{Buffer: 10, ByteOffset: 10, ByteLength: 20, ByteStride: 50, Target: ElementArrayBuffer},
}}}, false},
{"withCameras", args{&Document{Cameras: []Camera{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "cam_1", Type: OrthographicType, Orthographic: &Orthographic{Extras: 8.0, Extensions: Extensions{"a": "b"}, Xmag: 1, Ymag: 2, Zfar: 3, Znear: 4}},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "cam_2", Type: PerspectiveType, Perspective: &Perspective{Extras: 8.0, Extensions: Extensions{"a": "b"}, AspectRatio: 1, Yfov: 2, Zfar: 3, Znear: 4}},
{Extras: 8.0, Name: "cam_1", Type: OrthographicType, Orthographic: &Orthographic{Extras: 8.0, Xmag: 1, Ymag: 2, Zfar: 3, Znear: 4}},
{Extras: 8.0, Name: "cam_2", Type: PerspectiveType, Perspective: &Perspective{Extras: 8.0, AspectRatio: 1, Yfov: 2, Zfar: 3, Znear: 4}},
}}}, false},
{"withImages", args{&Document{Images: []Image{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "binary", BufferView: 1, MimeType: "data:image/png"},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "embedded", URI: "data:image/png;base64,dsjdsaGGUDXGA", MimeType: "data:image/png"},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "external", URI: "https://web.com/a", MimeType: "data:image/png"},
{Extras: 8.0, Name: "binary", BufferView: 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, Extensions: Extensions{"a": "b"}, Name: "base", EmissiveFactor: [3]float64{1.0, 1.0, 1.0}, DoubleSided: true, AlphaCutoff: 0.5, AlphaMode: Opaque},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "pbr", AlphaCutoff: 0.5, AlphaMode: Opaque,
{Extras: 8.0, Name: "base", EmissiveFactor: [3]float64{1.0, 1.0, 1.0}, DoubleSided: true, AlphaCutoff: 0.5, AlphaMode: Opaque},
{Extras: 8.0, Name: "pbr", AlphaCutoff: 0.5, AlphaMode: Opaque,
PBRMetallicRoughness: &PBRMetallicRoughness{
Extras: 8.0, Extensions: Extensions{"a": "b"}, MetallicFactor: 1, RoughnessFactor: 2, BaseColorFactor: [4]float64{1, 2, 3, 4},
BaseColorTexture: &TextureInfo{Extras: 8.0, Extensions: Extensions{"a": "b"}, Index: 1, TexCoord: 3},
MetallicRoughnessTexture: &TextureInfo{Extras: 8.0, Extensions: Extensions{"a": "b"}, Index: 6, TexCoord: 5},
Extras: 8.0, MetallicFactor: 1, RoughnessFactor: 2, BaseColorFactor: [4]float64{1, 2, 3, 4},
BaseColorTexture: &TextureInfo{Extras: 8.0, Index: 1, TexCoord: 3},
MetallicRoughnessTexture: &TextureInfo{Extras: 8.0, Index: 6, TexCoord: 5},
},
},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "normal", AlphaCutoff: 0.7, AlphaMode: Blend,
NormalTexture: &NormalTexture{Extras: 8.0, Extensions: Extensions{"a": "b"}, Index: 1, TexCoord: 2, Scale: 2.0},
{Extras: 8.0, Name: "normal", AlphaCutoff: 0.7, AlphaMode: Blend,
NormalTexture: &NormalTexture{Extras: 8.0, Index: 1, TexCoord: 2, Scale: 2.0},
},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "occlusion", AlphaCutoff: 0.5, AlphaMode: Mask,
OcclusionTexture: &OcclusionTexture{Extras: 8.0, Extensions: Extensions{"a": "b"}, Index: 1, TexCoord: 2, Strength: 2.0},
{Extras: 8.0, Name: "occlusion", AlphaCutoff: 0.5, AlphaMode: Mask,
OcclusionTexture: &OcclusionTexture{Extras: 8.0, Index: 1, TexCoord: 2, Strength: 2.0},
},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "emmisice", AlphaCutoff: 0.5, AlphaMode: Mask, EmissiveTexture: &TextureInfo{Extras: 8.0, Extensions: Extensions{"a": "b"}, Index: 4, TexCoord: 50}},
{Extras: 8.0, Name: "emmisice", AlphaCutoff: 0.5, AlphaMode: Mask, EmissiveTexture: &TextureInfo{Extras: 8.0, Index: 4, TexCoord: 50}},
}}}, false},
{"withMeshes", args{&Document{Meshes: []Mesh{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "mesh_1", Weights: []float64{1.2, 2}},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "mesh_2", Primitives: []Primitive{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Attributes: Attribute{"POSITION": 1}, Indices: 2, Material: 1, Mode: Lines},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Targets: []Attribute{{"POSITION": 1, "THEN": 4}, {"OTHER": 2}}, Indices: 2, Material: 1, Mode: Lines},
{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: 2, Material: 1, Mode: Lines},
{Extras: 8.0, Targets: []Attribute{{"POSITION": 1, "THEN": 4}, {"OTHER": 2}}, Indices: 2, Material: 1, Mode: Lines},
}},
}}}, false},
{"withNodes", args{&Document{Nodes: []Node{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "n-1", Camera: 1, Children: []uint32{1, 2}, Skin: 3,
{Extras: 8.0, Name: "n-1", Camera: 1, Children: []uint32{1, 2}, Skin: 3,
Matrix: [16]float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, Mesh: 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, Extensions: Extensions{"a": "b"}, Name: "n-2", Camera: 1, Children: []uint32{1, 2}, Skin: 3,
{Extras: 8.0, Name: "n-2", Camera: 1, Children: []uint32{1, 2}, Skin: 3,
Matrix: [16]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, Mesh: 15, Rotation: [4]float64{0, 0, 0, 1}, Scale: [3]float64{1, 1, 1}},
}}}, false},
{"withSampler", args{&Document{Samplers: []Sampler{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "s_1", MagFilter: MagLinear, MinFilter: MinLinearMipMapLinear, WrapS: ClampToEdge, WrapT: MirroredRepeat},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "s_2", MagFilter: MagNearest, MinFilter: MinLinearMipMapLinear, WrapS: MirroredRepeat, WrapT: Repeat},
{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},
}}}, false},
{"withScene", args{&Document{Scene: 1}}, false},
{"withScenes", args{&Document{Scenes: []Scene{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "s_1", Nodes: []uint32{1, 2}},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "s_2", Nodes: []uint32{2, 3}},
{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{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "skin_1", InverseBindMatrices: 2, Skeleton: 4, Joints: []uint32{5, 6}},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "skin_2", InverseBindMatrices: 3, Skeleton: 4, Joints: []uint32{7, 8}},
{Extras: 8.0, Name: "skin_1", InverseBindMatrices: 2, Skeleton: 4, Joints: []uint32{5, 6}},
{Extras: 8.0, Name: "skin_2", InverseBindMatrices: 3, Skeleton: 4, Joints: []uint32{7, 8}},
}}}, false},
{"withTextures", args{&Document{Textures: []Texture{
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "t_1", Sampler: 2, Source: 3},
{Extras: 8.0, Extensions: Extensions{"a": "b"}, Name: "t_2", Sampler: 3, Source: 4},
{Extras: 8.0, Name: "t_1", Sampler: 2, Source: 3},
{Extras: 8.0, Name: "t_2", Sampler: 3, Source: 4},
}}}, false},
}
for _, tt := range tests {
Expand Down
82 changes: 82 additions & 0 deletions extensions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package gltf

import "encoding/json"

const (
ExtPBRSpecularGlossiness = "KHR_materials_pbrSpecularGlossiness"
)

// Extension is map where the keys are the extension identifiers and the values are the extensions payloads.
// If a key matches with one of the supported extensions the value will be marshalled as a pointer to the extension struct.
// If a key does not match with any of the supported extensions the value will be a json.RawMessage so its decoding can be delayed.
type Extensions map[string]interface{}

type envelope map[string]json.RawMessage

// UnmarshalJSON unmarshal the extensions with the supported extensions initialized.
func (ext *Extensions) UnmarshalJSON(data []byte) error {
if len(*ext) == 0 {
*ext = make(Extensions)
}
var raw envelope
err := json.Unmarshal(data, &raw)
if err == nil {
for key, value := range raw {
switch key {
case ExtPBRSpecularGlossiness:
n := &PBRSpecularGlossiness{}
if err := json.Unmarshal(value, n); err != nil {
return err
}
(*ext)[ExtPBRSpecularGlossiness] = n
default:
(*ext)[key] = value
}
}
}

return err
}

type PBRSpecularGlossiness struct {
DiffuseFactor [4]float64 `json:"diffuseFactor" validate:"dive,gte=0,lte=1"`
DiffuseTexture *TextureInfo `json:"diffuseTexture,omitempty"`
SpecularFactor [3]float64 `json:"specularFactor" validate:"dive,gte=0,lte=1"`
GlossinessFactor float64 `json:"glossinessFactor" validate:"gte=0,lte=1"`
SpecularGlossinessTexture *TextureInfo `json:"specularGlossinessTexture,omitempty"`
}

// PBRSpecularGlossiness returns a default PBRSpecularGlossiness.
func NewPBRSpecularGlossiness() *PBRSpecularGlossiness {
return &PBRSpecularGlossiness{DiffuseFactor: [4]float64{1, 1, 1, 1}, SpecularFactor: [3]float64{1, 1, 1}, GlossinessFactor: 1}
}

// UnmarshalJSON unmarshal the pbr with the correct default values.
func (p *PBRSpecularGlossiness) UnmarshalJSON(data []byte) error {
type alias PBRSpecularGlossiness
tmp := alias(*NewPBRSpecularGlossiness())
err := json.Unmarshal(data, &tmp)
if err == nil {
*p = PBRSpecularGlossiness(tmp)
}
return err
}

// MarshalJSON marshal the pbr with the correct default values.
func (p *PBRSpecularGlossiness) MarshalJSON() ([]byte, error) {
type alias PBRSpecularGlossiness
out, err := json.Marshal(&struct{ *alias }{alias: (*alias)(p)})
if err == nil {
if p.GlossinessFactor == 1 {
out = removeProperty([]byte(`"glossinessFactor":1`), out)
}
if p.DiffuseFactor == [4]float64{1, 1, 1, 1} {
out = removeProperty([]byte(`"diffuseFactor":[1,1,1,1]`), out)
}
if p.SpecularFactor == [3]float64{1, 1, 1} {
out = removeProperty([]byte(`"specularFactor":[1,1,1]`), out)
}
out = sanitizeJSON(out)
}
return out, err
}
88 changes: 88 additions & 0 deletions extensions_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package gltf

import (
"reflect"
"testing"
)

func TestPBRSpecularGlossiness_UnmarshalJSON(t *testing.T) {
type args struct {
data []byte
}
tests := []struct {
name string
p *PBRSpecularGlossiness
args args
want *PBRSpecularGlossiness
wantErr bool
}{
{"default", new(PBRSpecularGlossiness), args{[]byte("{}")}, &PBRSpecularGlossiness{DiffuseFactor: [4]float64{1, 1, 1, 1}, SpecularFactor: [3]float64{1, 1, 1}, GlossinessFactor: 1}, false},
{"nodefault", new(PBRSpecularGlossiness), args{[]byte(`{"diffuseFactor": [0.1,0.2,0.3,0.4],"specularFactor":[0.5,0.6,0.7],"glossinessFactor":0.5}`)}, &PBRSpecularGlossiness{
DiffuseFactor: [4]float64{0.1, 0.2, 0.3, 0.4}, SpecularFactor: [3]float64{0.5, 0.6, 0.7}, GlossinessFactor: 0.5,
}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := tt.p.UnmarshalJSON(tt.args.data); (err != nil) != tt.wantErr {
t.Errorf("PBRSpecularGlossiness.UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(tt.p, tt.want) {
t.Errorf("PBRSpecularGlossiness.UnmarshalJSON() = %v, want %v", tt.p, tt.want)
}
})
}
}

func TestPBRSpecularGlossiness_MarshalJSON(t *testing.T) {
tests := []struct {
name string
p *PBRSpecularGlossiness
want []byte
wantErr bool
}{
{"default", &PBRSpecularGlossiness{GlossinessFactor: 1, DiffuseFactor: [4]float64{1, 1, 1, 1}, SpecularFactor: [3]float64{1, 1, 1}}, []byte(`{}`), false},
{"empty", &PBRSpecularGlossiness{GlossinessFactor: 0, DiffuseFactor: [4]float64{0, 0, 0, 0}, SpecularFactor: [3]float64{0, 0, 0}}, []byte(`{"diffuseFactor":[0,0,0,0],"specularFactor":[0,0,0],"glossinessFactor":0}`), false},
{"nodefault", &PBRSpecularGlossiness{GlossinessFactor: 0.5, DiffuseFactor: [4]float64{1, 0.5, 1, 1}, SpecularFactor: [3]float64{1, 1, 0.5}}, []byte(`{"diffuseFactor":[1,0.5,1,1],"specularFactor":[1,1,0.5],"glossinessFactor":0.5}`), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := tt.p.MarshalJSON()
if (err != nil) != tt.wantErr {
t.Errorf("PBRSpecularGlossiness.MarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("PBRSpecularGlossiness.MarshalJSON() = %v, want %v", string(got), string(tt.want))
}
})
}
}

func TestExtensions_UnmarshalJSON(t *testing.T) {
type args struct {
data []byte
}
tests := []struct {
name string
args args
want *Extensions
wantErr bool
}{
{"specularGlossiness", args{[]byte(`{"KHR_materials_pbrSpecularGlossiness": {"diffuseFactor":[1,0.5,1,1],"specularFactor":[1,1,0.5],"glossinessFactor":0.5}}`)}, &Extensions{
ExtPBRSpecularGlossiness: &PBRSpecularGlossiness{GlossinessFactor: 0.5, DiffuseFactor: [4]float64{1, 0.5, 1, 1}, SpecularFactor: [3]float64{1, 1, 0.5}},
}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ext := Extensions{}
if err := ext.UnmarshalJSON(tt.args.data); (err != nil) != tt.wantErr {
t.Errorf("Extensions.UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(&ext, tt.want) {
t.Errorf("PBRSpecularGlossiness.MarshalJSON() = %v, want %v", &ext, tt.want)
}
})
}
}
2 changes: 0 additions & 2 deletions struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"strings"
)

type Extensions map[string]interface{}

// An Asset is metadata about the glTF asset.
type Asset struct {
Extensions Extensions `json:"extensions,omitempty"`
Expand Down

0 comments on commit 9fdfca7

Please sign in to comment.