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

Unified Diff: chrome/browser/android/vr_shell/gltf_asset.cc

Issue 2775283004: Rendering Daydream controller in a fixed position. (Closed)
Patch Set: Moving code to more appropriate locations. 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
« no previous file with comments | « chrome/browser/android/vr_shell/gltf_asset.h ('k') | chrome/browser/android/vr_shell/gltf_parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/gltf_asset.cc
diff --git a/chrome/browser/android/vr_shell/gltf_asset.cc b/chrome/browser/android/vr_shell/gltf_asset.cc
index f4ee1fc2668ad26b60fab343d0596b90ff5e03ca..752cd7cbc5f35185ee998afd879687fb31d31965 100644
--- a/chrome/browser/android/vr_shell/gltf_asset.cc
+++ b/chrome/browser/android/vr_shell/gltf_asset.cc
@@ -12,11 +12,26 @@ namespace vr_shell {
namespace gltf {
+namespace {
+
const std::unordered_map<std::string, Type> kTypeMap = {
{"SCALAR", SCALAR}, {"VEC2", VEC2}, {"VEC3", VEC3}, {"VEC4", VEC4},
{"MAT2", MAT2}, {"MAT3", MAT3}, {"MAT4", MAT4},
};
+const std::vector<int> kTypeComponents = {
+ 0,
+ 1, // SCALAR
+ 2, // VEC2
+ 3, // VEC3
+ 4, // VEC4
+ 4, // MAT2
+ 9, // MAT3
+ 16, // MAT4
+};
+
+} // namespace
+
Type GetType(const std::string& type) {
auto it = kTypeMap.find(type);
if (it == kTypeMap.end())
@@ -24,6 +39,10 @@ Type GetType(const std::string& type) {
return it->second;
}
+GLint GetTypeComponents(Type type) {
+ return kTypeComponents[type];
+}
+
Mesh::Primitive::Primitive() : indices(nullptr), mode(4) {}
Mesh::Primitive::~Primitive() = default;
@@ -44,12 +63,6 @@ Asset::Asset() : scene_(nullptr) {}
Asset::~Asset() = default;
-std::size_t Asset::AddBuffer(std::unique_ptr<Buffer> buffer) {
- auto index = buffers_.size();
- buffers_.push_back(std::move(buffer));
- return index;
-}
-
std::size_t Asset::AddBufferView(std::unique_ptr<BufferView> buffer_view) {
auto index = buffer_views_.size();
buffer_views_.push_back(std::move(buffer_view));
@@ -80,10 +93,6 @@ std::size_t Asset::AddScene(std::unique_ptr<Scene> scene) {
return index;
}
-const Buffer* Asset::GetBuffer(std::size_t id) const {
- return id < buffers_.size() ? buffers_[id].get() : nullptr;
-}
-
const BufferView* Asset::GetBufferView(std::size_t id) const {
return id < buffer_views_.size() ? buffer_views_[id].get() : nullptr;
}
« no previous file with comments | « chrome/browser/android/vr_shell/gltf_asset.h ('k') | chrome/browser/android/vr_shell/gltf_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698