OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_PARSER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_PARSER_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 #include <unordered_map> |
| 11 |
| 12 #include "base/values.h" |
| 13 #include "chrome/browser/android/vr_shell/gltf_asset.h" |
| 14 |
| 15 namespace vr_shell { |
| 16 |
| 17 // Parser for glTF 1.0 specification |
| 18 // https://github.com/KhronosGroup/glTF/tree/master/specification/1.0 |
| 19 // TODO(acondor): Implement glTF 2.0 parser. gltf::Asset is mostly version |
| 20 // agnostic. |
| 21 class GltfParser { |
| 22 public: |
| 23 GltfParser(); |
| 24 ~GltfParser(); |
| 25 std::unique_ptr<gltf::Asset> Parse(const base::DictionaryValue& dict); |
| 26 |
| 27 private: |
| 28 void SetBuffers(const base::DictionaryValue& dict); |
| 29 void SetBufferViews(const base::DictionaryValue& dict); |
| 30 void SetAccessors(const base::DictionaryValue& dict); |
| 31 void SetMeshes(const base::DictionaryValue& dict); |
| 32 void SetNodes(const base::DictionaryValue& dict); |
| 33 void SetScenes(const base::DictionaryValue& dict); |
| 34 |
| 35 std::unique_ptr<gltf::Asset> asset_; |
| 36 std::unordered_map<std::string, std::size_t> buffer_ids_; |
| 37 std::unordered_map<std::string, std::size_t> buffer_view_ids_; |
| 38 std::unordered_map<std::string, std::size_t> accessor_ids_; |
| 39 std::unordered_map<std::string, std::size_t> node_ids_; |
| 40 std::unordered_map<std::string, std::size_t> mesh_ids_; |
| 41 std::unordered_map<std::string, std::size_t> scene_ids_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(GltfParser); |
| 44 }; |
| 45 |
| 46 } // namespace vr_shell |
| 47 |
| 48 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_PARSER_H_ |
OLD | NEW |