export min max for sparse accessor

pull/3667/head
ywang 2021-02-03 15:05:58 -08:00
parent 793bd44cee
commit 9bab475302
1 changed files with 8 additions and 9 deletions

View File

@ -110,6 +110,10 @@ namespace glTF2 {
if (a.bufferView) { if (a.bufferView) {
obj.AddMember("bufferView", a.bufferView->index, w.mAl); obj.AddMember("bufferView", a.bufferView->index, w.mAl);
obj.AddMember("byteOffset", (unsigned int)a.byteOffset, w.mAl); obj.AddMember("byteOffset", (unsigned int)a.byteOffset, w.mAl);
}
obj.AddMember("componentType", int(a.componentType), w.mAl);
obj.AddMember("count", (unsigned int)a.count, w.mAl);
obj.AddMember("type", StringRef(AttribType::ToString(a.type)), w.mAl);
Value vTmpMax, vTmpMin; Value vTmpMax, vTmpMin;
if (a.componentType == ComponentType_FLOAT) { if (a.componentType == ComponentType_FLOAT) {
obj.AddMember("max", MakeValue(vTmpMax, a.max, w.mAl), w.mAl); obj.AddMember("max", MakeValue(vTmpMax, a.max, w.mAl), w.mAl);
@ -118,11 +122,6 @@ namespace glTF2 {
obj.AddMember("max", MakeValueCast<int64_t>(vTmpMax, a.max, w.mAl), w.mAl); obj.AddMember("max", MakeValueCast<int64_t>(vTmpMax, a.max, w.mAl), w.mAl);
obj.AddMember("min", MakeValueCast<int64_t>(vTmpMin, a.min, w.mAl), w.mAl); obj.AddMember("min", MakeValueCast<int64_t>(vTmpMin, a.min, w.mAl), w.mAl);
} }
}
obj.AddMember("componentType", int(a.componentType), w.mAl);
obj.AddMember("count", (unsigned int)a.count, w.mAl);
obj.AddMember("type", StringRef(AttribType::ToString(a.type)), w.mAl);
if (a.sparse) { if (a.sparse) {
Value sparseValue; Value sparseValue;