fileformat handler(W.I.P.)

This commit is contained in:
Syoyo Fujita
2023-09-20 23:17:56 +09:00
parent a9559f0e09
commit 199d6f4166
5 changed files with 78 additions and 94 deletions

View File

@@ -62,9 +62,6 @@ int main(int argc, char **argv) {
my_handler.writer = MyWrite;
my_handler.userdata = nullptr;
tinyusdz::USDLoadOptions options;
options.fileformats["my"] = my_handler;
tinyusdz::Stage stage; // empty scene
std::string input_usd_filepath = "../data/fileformat_my.usda";
@@ -75,7 +72,7 @@ int main(int argc, char **argv) {
std::string warn, err;
tinyusdz::Layer layer;
bool ret = tinyusdz::LoadLayerFromFile(input_usd_filepath, &layer, &warn, &err, options);
bool ret = tinyusdz::LoadLayerFromFile(input_usd_filepath, &layer, &warn, &err);
if (warn.size()) {
std::cout << "WARN: " << warn << "\n";
@@ -89,6 +86,9 @@ int main(int argc, char **argv) {
// dummy Asset resolver.
tinyusdz::AssetResolutionResolver resolver;
tinyusdz::ReferencesCompositionOptions options;
options.fileformats["my"] = my_handler;
// Do `references` composition to materialize `references = @***.my@`
tinyusdz::Layer composited_layer;
if (!tinyusdz::CompositeReferences(resolver, layer, &composited_layer, &warn, &err)) {