-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
glTF: Added support for EXT_meshopt_compression.
- Loading branch information
1 parent
6f4ef13
commit 551bdab
Showing
12 changed files
with
294 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,41 @@ | ||
diff --git a/src/fastgltf.cpp b/src/fastgltf.cpp | ||
index 775c9bd..510f82d 100644 | ||
index a5d1206..eca5ad0 100644 | ||
--- a/src/fastgltf.cpp | ||
+++ b/src/fastgltf.cpp | ||
@@ -1733,7 +1733,8 @@ fg::Error fg::Parser::parseBuffers(simdjson::dom::array& buffers, Asset& asset) | ||
@@ -1864,7 +1864,8 @@ fg::Error fg::Parser::parseBuffers(simdjson::dom::array& buffers, Asset& asset) | ||
// file. Otherwise, data must be specified in the "uri" field. | ||
std::string_view uriString; | ||
if (bufferObject["uri"].get_string().get(uriString) == SUCCESS) FASTGLTF_LIKELY { | ||
- URIView uriView(uriString); | ||
+ fg::URI uri(uriString); | ||
+ fg::URIView uriView(uri.string()); | ||
+ URIView uriView(uri); | ||
|
||
if (!uriView.valid()) { | ||
return Error::InvalidURI; | ||
@@ -2073,7 +2074,8 @@ fg::Error fg::Parser::parseImages(simdjson::dom::array& images, Asset& asset) { | ||
@@ -2255,7 +2256,8 @@ fg::Error fg::Parser::parseImages(simdjson::dom::array& images, Asset& asset) { | ||
return Error::InvalidGltf; | ||
} | ||
|
||
- URIView uriView(uriString); | ||
+ fg::URI uri(uriString); | ||
+ fg::URIView uriView(uri.string()); | ||
+ URIView uriView(uri); | ||
if (!uriView.valid()) { | ||
return Error::InvalidURI; | ||
} | ||
@@ -3196,21 +3198,21 @@ fg::Error fg::Parser::parseNodes(simdjson::dom::array& nodes, Asset& asset) { | ||
@@ -3451,14 +3453,14 @@ fg::Error fg::Parser::parseNodes(simdjson::dom::array& nodes, Asset& asset) { | ||
if (nodeObject["extensions"].get_object().get(extensionsObject) == SUCCESS) FASTGLTF_LIKELY { | ||
if (hasBit(config.extensions, Extensions::KHR_lights_punctual)) { | ||
dom::object lightsObject; | ||
- if (extensionsObject[extensions::KHR_lights_punctual].get_object().get(lightsObject) == SUCCESS) FASTGLTF_LIKELY { | ||
+ if (auto lightsError = extensionsObject[extensions::KHR_lights_punctual].get_object().get(lightsObject); lightsError == SUCCESS) FASTGLTF_LIKELY { | ||
+ if (auto lightsError = extensionsObject[extensions::KHR_lights_punctual].get_object().get(lightsObject) == SUCCESS) FASTGLTF_LIKELY { | ||
std::uint64_t light; | ||
- if (auto lightError = lightsObject["light"].get_uint64().get(light); error == SUCCESS) FASTGLTF_LIKELY { | ||
+ if (auto lightError = lightsObject["light"].get_uint64().get(light); lightError == SUCCESS) FASTGLTF_LIKELY { | ||
if (auto lightError = lightsObject["light"].get_uint64().get(light); lightError == SUCCESS) FASTGLTF_LIKELY { | ||
node.lightIndex = static_cast<std::size_t>(light); | ||
} else { | ||
- return error == NO_SUCH_FIELD || error == INCORRECT_TYPE ? Error::InvalidGltf : Error::InvalidJson; | ||
+ return lightError == NO_SUCH_FIELD || lightError == INCORRECT_TYPE ? Error::InvalidGltf : Error::InvalidJson; | ||
return lightError == NO_SUCH_FIELD || lightError == INCORRECT_TYPE ? Error::InvalidGltf : Error::InvalidJson; | ||
} | ||
- } else if (error != NO_SUCH_FIELD) { | ||
+ } else if (lightsError != NO_SUCH_FIELD) { | ||
return Error::InvalidGltf; | ||
} | ||
} | ||
|
||
if (hasBit(config.extensions, Extensions::EXT_mesh_gpu_instancing)) { | ||
dom::object gpuInstancingObject; | ||
- if (extensionsObject[extensions::EXT_mesh_gpu_instancing].get_object().get(gpuInstancingObject) == SUCCESS) FASTGLTF_LIKELY { | ||
+ if (auto instancingError = extensionsObject[extensions::EXT_mesh_gpu_instancing].get_object().get(gpuInstancingObject); instancingError == SUCCESS) FASTGLTF_LIKELY { | ||
dom::object attributesObject; | ||
if (gpuInstancingObject["attributes"].get_object().get(attributesObject) == SUCCESS) FASTGLTF_LIKELY { | ||
auto parseAttributes = [this](dom::object& object, decltype(node.instancingAttributes)& attributes) -> auto { | ||
@@ -3234,7 +3236,7 @@ fg::Error fg::Parser::parseNodes(simdjson::dom::array& nodes, Asset& asset) { | ||
} else { | ||
return Error::InvalidGltf; | ||
} | ||
- } else if (error != NO_SUCH_FIELD) { | ||
+ } else if (instancingError != NO_SUCH_FIELD) { | ||
return Error::InvalidGltf; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.