mirror of
https://github.com/openharmony/third_party_meshoptimizer.git
synced 2026-07-19 20:03:59 -04:00
gltfpack: Decompress meshopt buffers after cgltf_validate
cgltf_validate checks a host of preconditions that make meshopt decoding safe; the only thing we're missing is index validation after meshopt decoding but that does have an assertion, and could also be done separately in the future.
This commit is contained in:
+2
-2
@@ -571,8 +571,8 @@ cgltf_data* parseGltf(const char* path, std::vector<Mesh>& meshes, std::vector<A
|
||||
freeFile(data);
|
||||
|
||||
result = (result == cgltf_result_success) ? cgltf_load_buffers(&options, data, path) : result;
|
||||
result = (result == cgltf_result_success) ? decompressMeshopt(data) : result;
|
||||
result = (result == cgltf_result_success) ? cgltf_validate(data) : result;
|
||||
result = (result == cgltf_result_success) ? decompressMeshopt(data) : result;
|
||||
|
||||
return parseGltf(data, result, meshes, animations, error);
|
||||
}
|
||||
@@ -587,8 +587,8 @@ cgltf_data* parseGlb(const void* buffer, size_t size, std::vector<Mesh>& meshes,
|
||||
cgltf_result result = cgltf_parse(&options, buffer, size, &data);
|
||||
|
||||
result = (result == cgltf_result_success) ? cgltf_load_buffers(&options, data, NULL) : result;
|
||||
result = (result == cgltf_result_success) ? decompressMeshopt(data) : result;
|
||||
result = (result == cgltf_result_success) ? cgltf_validate(data) : result;
|
||||
result = (result == cgltf_result_success) ? decompressMeshopt(data) : result;
|
||||
|
||||
return parseGltf(data, result, meshes, animations, error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user