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

Unified 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 side-by-side diff with in-line comments
Download patch
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
new file mode 100644
index 0000000000000000000000000000000000000000..da4e1d6e68be0fbdcb9bb0a7599fd8807be4fde9
--- /dev/null
+++ b/chrome/browser/android/vr_shell/gltf_parser.h
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_PARSER_H_
+#define CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_PARSER_H_
+
+#include <memory>
+#include <string>
+#include <unordered_map>
+
+#include "base/values.h"
+#include "chrome/browser/android/vr_shell/gltf_asset.h"
+
+namespace vr_shell {
+
+// 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.
+// https://github.com/KhronosGroup/glTF/tree/master/specification/1.0
+// TODO(acondor): Implement glTF 2.0 parser. gltf::Asset is mostly version
+// agnostic.
+class GltfParser {
+ public:
+ GltfParser();
+ ~GltfParser();
+ std::unique_ptr<gltf::Asset> Parse(const base::DictionaryValue& dict);
+
+ private:
+ bool SetBuffers(const base::DictionaryValue& dict);
+ bool SetBufferViews(const base::DictionaryValue& dict);
+ bool SetAccessors(const base::DictionaryValue& dict);
+ bool SetMeshes(const base::DictionaryValue& dict);
+ bool SetNodes(const base::DictionaryValue& dict);
+ bool SetScenes(const base::DictionaryValue& dict);
+ std::unique_ptr<gltf::Mesh::Primitive> ProcessPrimitive(
+ const base::DictionaryValue& dict);
+
+ 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_;
+
+ DISALLOW_COPY_AND_ASSIGN(GltfParser);
+};
+
+} // namespace vr_shell
+
+#endif // CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_PARSER_H_

Powered by Google App Engine
This is Rietveld 408576698