mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-15 01:05:57 +08:00
Merge pull request #347 from syoyo/jmousseau-sparse-accessor-optionality
Jmousseau sparse accessor optionality
This commit is contained in:
commit
a1952053ee
28
tiny_gltf.h
28
tiny_gltf.h
@ -4217,7 +4217,9 @@ static bool ParseSparseAccessor(Accessor *accessor, std::string *err,
|
|||||||
accessor->sparse.isSparse = true;
|
accessor->sparse.isSparse = true;
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
ParseIntegerProperty(&count, err, o, "count", true);
|
if (!ParseIntegerProperty(&count, err, o, "count", true, "SparseAccessor")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
json_const_iterator indices_iterator;
|
json_const_iterator indices_iterator;
|
||||||
json_const_iterator values_iterator;
|
json_const_iterator values_iterator;
|
||||||
@ -4235,18 +4237,24 @@ static bool ParseSparseAccessor(Accessor *accessor, std::string *err,
|
|||||||
const json &values_obj = GetValue(values_iterator);
|
const json &values_obj = GetValue(values_iterator);
|
||||||
|
|
||||||
int indices_buffer_view = 0, indices_byte_offset = 0, component_type = 0;
|
int indices_buffer_view = 0, indices_byte_offset = 0, component_type = 0;
|
||||||
ParseIntegerProperty(&indices_buffer_view, err, indices_obj, "bufferView",
|
if (!ParseIntegerProperty(&indices_buffer_view, err, indices_obj, "bufferView",
|
||||||
true);
|
true, "SparseAccessor")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ParseIntegerProperty(&indices_byte_offset, err, indices_obj, "byteOffset",
|
ParseIntegerProperty(&indices_byte_offset, err, indices_obj, "byteOffset",
|
||||||
true);
|
false);
|
||||||
ParseIntegerProperty(&component_type, err, indices_obj, "componentType",
|
if (!ParseIntegerProperty(&component_type, err, indices_obj, "componentType",
|
||||||
true);
|
true, "SparseAccessor")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int values_buffer_view = 0, values_byte_offset = 0;
|
int values_buffer_view = 0, values_byte_offset = 0;
|
||||||
ParseIntegerProperty(&values_buffer_view, err, values_obj, "bufferView",
|
if (!ParseIntegerProperty(&values_buffer_view, err, values_obj, "bufferView",
|
||||||
true);
|
true, "SparseAccessor")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ParseIntegerProperty(&values_byte_offset, err, values_obj, "byteOffset",
|
ParseIntegerProperty(&values_byte_offset, err, values_obj, "byteOffset",
|
||||||
true);
|
false);
|
||||||
|
|
||||||
accessor->sparse.count = count;
|
accessor->sparse.count = count;
|
||||||
accessor->sparse.indices.bufferView = indices_buffer_view;
|
accessor->sparse.indices.bufferView = indices_buffer_view;
|
||||||
@ -4255,8 +4263,6 @@ static bool ParseSparseAccessor(Accessor *accessor, std::string *err,
|
|||||||
accessor->sparse.values.bufferView = values_buffer_view;
|
accessor->sparse.values.bufferView = values_buffer_view;
|
||||||
accessor->sparse.values.byteOffset = values_byte_offset;
|
accessor->sparse.values.byteOffset = values_byte_offset;
|
||||||
|
|
||||||
// todo check theses values
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user