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

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

Issue 2757213003: Implementing glTF 1.0 parser (Closed)
Patch Set: Moving glTF test data to a file. 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
18 // https://github.com/KhronosGroup/glTF/tree/master/specification/1.0
19 // Supported objects are limited to: buffers, bufferViews, accessors,
20 // meshes (limited), nodes (limited), scenes (limited).
21 // Non-supported objects include: materials, techniques, skins, shaders,
22 // programs, animations, cameras, images, textures, extensions.
23 // This parser is not intended to be used on user or third-party data,
24 // but only on thoroughly tested Chromium-defined files.
mthiesse 2017/03/22 18:53:43 nit: s/Chromium-defined/Chromium resource/
acondor_ 2017/03/22 19:34:24 Done.
25 // TODO(acondor): Implement glTF 2.0 parser. gltf::Asset is mostly version
26 // agnostic.
27 class GltfParser {
28 public:
29 GltfParser();
30 ~GltfParser();
31 std::unique_ptr<gltf::Asset> Parse(const base::DictionaryValue& dict);
32
33 private:
34 bool ParseInternal(const base::DictionaryValue& dict);
35 bool SetBuffers(const base::DictionaryValue& dict);
36 bool SetBufferViews(const base::DictionaryValue& dict);
37 bool SetAccessors(const base::DictionaryValue& dict);
38 bool SetMeshes(const base::DictionaryValue& dict);
39 bool SetNodes(const base::DictionaryValue& dict);
40 bool SetScenes(const base::DictionaryValue& dict);
41 std::unique_ptr<gltf::Mesh::Primitive> ProcessPrimitive(
42 const base::DictionaryValue& dict);
43
44 std::unique_ptr<gltf::Asset> asset_;
45 std::unordered_map<std::string, std::size_t> buffer_ids_;
46 std::unordered_map<std::string, std::size_t> buffer_view_ids_;
47 std::unordered_map<std::string, std::size_t> accessor_ids_;
48 std::unordered_map<std::string, std::size_t> node_ids_;
49 std::unordered_map<std::string, std::size_t> mesh_ids_;
50 std::unordered_map<std::string, std::size_t> scene_ids_;
51
52 DISALLOW_COPY_AND_ASSIGN(GltfParser);
53 };
54
55 } // namespace vr_shell
56
57 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698