Merge pull request #916 from likangning93/gltfErrors

Fixed some gltf errors
pull/932/head
Kim Kulling 2016-06-13 11:34:34 +02:00 committed by GitHub
commit e834d5a50a
1 changed files with 3 additions and 3 deletions

View File

@ -152,14 +152,14 @@ inline Ref<Accessor> ExportData(Asset& a, std::string& meshName, Ref<Buffer>& bu
// bufferView // bufferView
Ref<BufferView> bv = a.bufferViews.Create(a.FindUniqueID(meshName, "view")); Ref<BufferView> bv = a.bufferViews.Create(a.FindUniqueID(meshName, "view"));
bv->buffer = buffer; bv->buffer = buffer;
bv->byteOffset = 0; bv->byteOffset = unsigned(offset);
bv->byteLength = length; //! The target that the WebGL buffer should be bound to. bv->byteLength = length; //! The target that the WebGL buffer should be bound to.
bv->target = isIndices ? BufferViewTarget_ELEMENT_ARRAY_BUFFER : BufferViewTarget_ARRAY_BUFFER; bv->target = isIndices ? BufferViewTarget_ELEMENT_ARRAY_BUFFER : BufferViewTarget_ARRAY_BUFFER;
// accessor // accessor
Ref<Accessor> acc = a.accessors.Create(a.FindUniqueID(meshName, "accessor")); Ref<Accessor> acc = a.accessors.Create(a.FindUniqueID(meshName, "accessor"));
acc->bufferView = bv; acc->bufferView = bv;
acc->byteOffset = unsigned(offset); acc->byteOffset = 0;
acc->byteStride = 0; acc->byteStride = 0;
acc->componentType = compType; acc->componentType = compType;
acc->count = count; acc->count = count;
@ -292,7 +292,7 @@ void glTFExporter::ExportMeshes()
indices[i*nIndicesPerFace + j] = uint16_t(aim->mFaces[i].mIndices[j]); indices[i*nIndicesPerFace + j] = uint16_t(aim->mFaces[i].mIndices[j]);
} }
} }
p.indices = ExportData(*mAsset, meshId, b, unsigned(indices.size()), &indices[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_UNSIGNED_SHORT); p.indices = ExportData(*mAsset, meshId, b, unsigned(indices.size()), &indices[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_UNSIGNED_SHORT, true);
} }
switch (aim->mPrimitiveTypes) { switch (aim->mPrimitiveTypes) {