Skip to content

Commit

Permalink
Merge pull request #12 from qmuntal/dev
Browse files Browse the repository at this point in the history
Image.BufferView is now a uint32 pointer
  • Loading branch information
qmuntal committed May 3, 2019
2 parents 1e6007f + e1324a9 commit 9df4069
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func TestEncoder_Encode(t *testing.T) {
{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{
{Extras: 8.0, Name: "binary", BufferView: 1, MimeType: "data:image/png"},
{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},
Expand Down
2 changes: 1 addition & 1 deletion struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ type Image struct {
Name string `json:"name,omitempty"`
URI string `json:"uri,omitempty" validate:"omitempty"`
MimeType string `json:"mimeType,omitempty" validate:"omitempty,oneof=image/jpeg image/png"` // Manadatory if BufferView is defined.
BufferView uint32 `json:"bufferView,omitempty"` // Use this instead of the image's uri property.
BufferView *uint32 `json:"bufferView,omitempty"` // Use this instead of the image's uri property.
}

// IsEmbeddedResource returns true if the buffer points to an embedded resource.
Expand Down
2 changes: 1 addition & 1 deletion validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestValidateDocument(t *testing.T) {
{"Document.Images[0].URI", &Document{Asset: Asset{Version: "1.0"},
Images: []Image{{URI: "a.png"}}}, false},
{"Document.Images[0].MimeType", &Document{Asset: Asset{Version: "1.0"},
Images: []Image{{BufferView: 1}}}, true},
Images: []Image{{BufferView: Index(1)}}}, true},
{"Document.Animations[0].Channels", &Document{Asset: Asset{Version: "1.0"},
Animations: []Animation{{Samplers: []AnimationSampler{{}}}}}, true},
{"Document.Animations[0].Channels[0].Target.Path", &Document{Asset: Asset{Version: "1.0"},
Expand Down

0 comments on commit 9df4069

Please sign in to comment.