| Index: chrome/browser/android/vr_shell/gltf_parser.h
|
| diff --git a/chrome/browser/android/vr_shell/gltf_parser.h b/chrome/browser/android/vr_shell/gltf_parser.h
|
| index b795444360826dbf3412e19eb84578c4b539c42c..64f8916f0b158da0f0087933d573a130ae622d39 100644
|
| --- a/chrome/browser/android/vr_shell/gltf_parser.h
|
| +++ b/chrome/browser/android/vr_shell/gltf_parser.h
|
| @@ -9,6 +9,7 @@
|
| #include <string>
|
| #include <unordered_map>
|
|
|
| +#include "base/files/file_path.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/android/vr_shell/gltf_asset.h"
|
|
|
| @@ -28,10 +29,28 @@ class GltfParser {
|
| public:
|
| GltfParser();
|
| ~GltfParser();
|
| - std::unique_ptr<gltf::Asset> Parse(const base::DictionaryValue& dict);
|
| + // Note: If your glTF references external files, this function will perform
|
| + // IO, and a base path must be specified.
|
| + std::unique_ptr<gltf::Asset> Parse(
|
| + const base::DictionaryValue& dict,
|
| + const base::FilePath& path = base::FilePath());
|
| + // Note: This function will perform IO.
|
| + std::unique_ptr<gltf::Asset> Parse(const base::FilePath& gltf_path);
|
|
|
| private:
|
| - bool ParseInternal(const base::DictionaryValue& dict);
|
| + struct Helper {
|
| + std::unique_ptr<gltf::Asset> asset;
|
| + base::FilePath path;
|
| + std::unordered_map<std::string, std::size_t> buffer_ids;
|
| + std::unordered_map<std::string, std::size_t> buffer_view_ids;
|
| + std::unordered_map<std::string, std::size_t> accessor_ids;
|
| + std::unordered_map<std::string, std::size_t> node_ids;
|
| + std::unordered_map<std::string, std::size_t> mesh_ids;
|
| + std::unordered_map<std::string, std::size_t> scene_ids;
|
| + explicit Helper(const base::FilePath& path);
|
| + ~Helper();
|
| + };
|
| +
|
| bool SetBuffers(const base::DictionaryValue& dict);
|
| bool SetBufferViews(const base::DictionaryValue& dict);
|
| bool SetAccessors(const base::DictionaryValue& dict);
|
| @@ -40,14 +59,9 @@ class GltfParser {
|
| bool SetScenes(const base::DictionaryValue& dict);
|
| std::unique_ptr<gltf::Mesh::Primitive> ProcessPrimitive(
|
| const base::DictionaryValue& dict);
|
| + std::unique_ptr<gltf::Buffer> ProcessUri(const std::string& uri_str);
|
|
|
| - std::unique_ptr<gltf::Asset> asset_;
|
| - std::unordered_map<std::string, std::size_t> buffer_ids_;
|
| - std::unordered_map<std::string, std::size_t> buffer_view_ids_;
|
| - std::unordered_map<std::string, std::size_t> accessor_ids_;
|
| - std::unordered_map<std::string, std::size_t> node_ids_;
|
| - std::unordered_map<std::string, std::size_t> mesh_ids_;
|
| - std::unordered_map<std::string, std::size_t> scene_ids_;
|
| + Helper* helper_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(GltfParser);
|
| };
|
|
|