Skip to content

Commit

Permalink
Merge a502f1a into ccf0944
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Feb 2, 2020
2 parents ccf0944 + a502f1a commit 01a2cfe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion modeler/modeler.go
Expand Up @@ -202,7 +202,7 @@ func (m *Modeler) AddImage(bufferIndex uint32, name, mimeType string, r io.Reade
buffer.Data = append(buffer.Data, data...)
}
index := m.addBufferView(bufferIndex, uint32(len(buffer.Data))-offset, offset, 0, false)
buffer.ByteLength += uint32(len(buffer.Data))
buffer.ByteLength = uint32(len(buffer.Data))
m.BufferViews[index].Target = gltf.TargetNone
m.Images = append(m.Images, &gltf.Image{
Name: name,
Expand Down
12 changes: 6 additions & 6 deletions modeler/modeler_test.go
Expand Up @@ -557,32 +557,32 @@ func TestModeler_AddImage(t *testing.T) {
}{
{"base", &Modeler{Document: &gltf.Document{
Images: []*gltf.Image{{}},
Buffers: []*gltf.Buffer{{ByteLength: 10}},
Buffers: []*gltf.Buffer{{ByteLength: 10, Data: make([]byte, 10)}},
}}, args{0, "fake", "fake/type", bytes.NewReader([]byte{1, 2})}, 1, &gltf.Document{
Images: []*gltf.Image{
{},
{BufferView: gltf.Index(0), Name: "fake", MimeType: "fake/type"},
},
BufferViews: []*gltf.BufferView{
{ByteLength: 2, Target: gltf.TargetNone},
{ByteOffset: 10, ByteLength: 2, Target: gltf.TargetNone},
},
Buffers: []*gltf.Buffer{
{ByteLength: 12, Data: []byte{1, 2}},
{ByteLength: 12, Data: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2}},
},
}, false},
{"buffer", &Modeler{Document: &gltf.Document{
Images: []*gltf.Image{{}},
Buffers: []*gltf.Buffer{{ByteLength: 10}},
Buffers: []*gltf.Buffer{{ByteLength: 10, Data: make([]byte, 10)}},
}}, args{0, "fake", "fake/type", bytes.NewBuffer([]byte{1, 2})}, 1, &gltf.Document{
Images: []*gltf.Image{
{},
{BufferView: gltf.Index(0), Name: "fake", MimeType: "fake/type"},
},
BufferViews: []*gltf.BufferView{
{ByteLength: 2, Target: gltf.TargetNone},
{ByteOffset: 10, ByteLength: 2, Target: gltf.TargetNone},
},
Buffers: []*gltf.Buffer{
{ByteLength: 12, Data: []byte{1, 2}},
{ByteLength: 12, Data: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2}},
},
}, false},
{"err", &Modeler{Document: &gltf.Document{
Expand Down

0 comments on commit 01a2cfe

Please sign in to comment.