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

Unified Diff: chrome/browser/android/vr_shell/vr_controller_model.h

Issue 2775283004: Rendering Daydream controller in a fixed position. (Closed)
Patch Set: Using textures for corresponding button states. 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/vr_controller_model.h
diff --git a/chrome/browser/android/vr_shell/vr_controller_model.h b/chrome/browser/android/vr_shell/vr_controller_model.h
new file mode 100644
index 0000000000000000000000000000000000000000..62a4c50a0bd7cf8d11e9369497fc66528be69502
--- /dev/null
+++ b/chrome/browser/android/vr_shell/vr_controller_model.h
@@ -0,0 +1,67 @@
+// 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_VR_CONTROLLER_MODEL_H_
+#define CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MODEL_H_
+
+#include <memory>
+
+#include "chrome/browser/android/vr_shell/gltf_asset.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gl/gl_bindings.h"
+
+namespace vr_shell {
+
+class VrControllerModel {
+ public:
+ enum State {
+ IDLE = 0,
+ TOUCHPAD,
+ APP,
+ SYSTEM,
+ // New ControllerStates should be added here, before STATE_COUNT.
+ STATE_COUNT,
+ };
+
+ // TODO(acondor): Hardcoded paths before VrShell resources are
+ // delivered through component updater.
+ static constexpr char const kComponentName[] = "VrShell";
+ static constexpr char const kDefaultVersion[] = "0";
+
+ static constexpr char const kModelsDirectory[] = "models";
+ static constexpr char const kModelFilename[] = "controller.gltf";
+ static constexpr char const kTexturesDirectory[] = "tex";
+ static constexpr char const* kTextureFilenames[] = {
+ "ddcontroller_idle.png", "ddcontroller_touchpad.png",
+ "ddcontroller_app.png", "ddcontroller_system.png",
+ };
+
+ explicit VrControllerModel(std::unique_ptr<gltf::Asset> gltf_asset);
+ ~VrControllerModel();
+
+ const GLvoid* ElementsBuffer() const;
+ GLsizeiptr ElementsBufferSize() const;
+ const GLvoid* IndicesBuffer() const;
+ GLenum DrawMode() const;
+ GLsizeiptr IndicesBufferSize() const;
+ const gltf::Accessor* IndicesAccessor() const;
+ const gltf::Accessor* PositionAccessor() const;
+ const gltf::Accessor* TextureCoordinateAccessor() const;
+ void SetTexture(int state, std::unique_ptr<SkBitmap> bitmap);
+ const SkBitmap* GetTexture(int state) const;
+
+ // Free resources but maintain metadata.
+ void Free();
+
+ private:
+ std::unique_ptr<gltf::Asset> gltf_asset_;
+ std::vector<std::unique_ptr<SkBitmap>> texture_bitmaps_;
+
+ const char* Buffer() const;
+ const gltf::Accessor* Accessor(const std::string& key) const;
+};
+
+} // namespace vr_shell
+
+#endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MODEL_H_

Powered by Google App Engine
This is Rietveld 408576698