Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: chrome/browser/android/vr_shell/gltf_parser.h

Issue 2757213003: Implementing glTF 1.0 parser (Closed)
Patch Set: Removing CHECKs when parsing fails. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
mthiesse 2017/03/21 20:24:37 Add a strongly worded comment here saying that thi
acondor_ 2017/03/22 16:25:28 Done.
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 bool SetBuffers(const base::DictionaryValue& dict);
29 bool SetBufferViews(const base::DictionaryValue& dict);
30 bool SetAccessors(const base::DictionaryValue& dict);
31 bool SetMeshes(const base::DictionaryValue& dict);
32 bool SetNodes(const base::DictionaryValue& dict);
33 bool SetScenes(const base::DictionaryValue& dict);
34 std::unique_ptr<gltf::Mesh::Primitive> ProcessPrimitive(
35 const base::DictionaryValue& dict);
36
37 std::unique_ptr<gltf::Asset> asset_;
38 std::unordered_map<std::string, std::size_t> buffer_ids_;
39 std::unordered_map<std::string, std::size_t> buffer_view_ids_;
40 std::unordered_map<std::string, std::size_t> accessor_ids_;
41 std::unordered_map<std::string, std::size_t> node_ids_;
42 std::unordered_map<std::string, std::size_t> mesh_ids_;
43 std::unordered_map<std::string, std::size_t> scene_ids_;
44
45 DISALLOW_COPY_AND_ASSIGN(GltfParser);
46 };
47
48 } // namespace vr_shell
49
50 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698