OLD | NEW |
---|---|
(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_VR_CONTROLLER_MODEL_H_ | |
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MODEL_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "chrome/browser/android/vr_shell/gltf_asset.h" | |
11 #include "third_party/skia/include/core/SkBitmap.h" | |
12 #include "ui/gl/gl_bindings.h" | |
13 | |
14 namespace vr_shell { | |
15 | |
16 class VrControllerModel { | |
17 public: | |
18 enum State { | |
19 IDLE = 0, | |
20 TOUCHPAD, | |
21 APP, | |
22 SYSTEM, | |
23 // New ControllerStates should be added here, before STATE_COUNT. | |
24 STATE_COUNT, | |
25 }; | |
26 | |
27 // TODO(acondor): Hardcoded paths before VrShell resources are | |
amp
2017/03/29 20:54:56
Describe TODO as what needs to be done.
acondor_
2017/03/29 22:46:44
Done.
| |
28 // delivered through component updater. | |
29 static constexpr char const kComponentName[] = "VrShell"; | |
30 static constexpr char const kDefaultVersion[] = "0"; | |
31 | |
32 static constexpr char const kModelsDirectory[] = "models"; | |
33 static constexpr char const kModelFilename[] = "controller.gltf"; | |
34 static constexpr char const kTexturesDirectory[] = "tex"; | |
35 static constexpr char const* kTextureFilenames[] = { | |
36 "ddcontroller_idle.png", "ddcontroller_touchpad.png", | |
37 "ddcontroller_app.png", "ddcontroller_system.png", | |
38 }; | |
39 | |
40 explicit VrControllerModel( | |
41 std::unique_ptr<gltf::Asset> gltf_asset, | |
42 std::vector<std::unique_ptr<gltf::Buffer>> buffers); | |
43 ~VrControllerModel(); | |
44 | |
45 const GLvoid* ElementsBuffer() const; | |
46 GLsizeiptr ElementsBufferSize() const; | |
47 const GLvoid* IndicesBuffer() const; | |
48 GLenum DrawMode() const; | |
49 GLsizeiptr IndicesBufferSize() const; | |
50 const gltf::Accessor* IndicesAccessor() const; | |
51 const gltf::Accessor* PositionAccessor() const; | |
52 const gltf::Accessor* TextureCoordinateAccessor() const; | |
53 void SetTexture(int state, std::unique_ptr<SkBitmap> bitmap); | |
54 const SkBitmap* GetTexture(int state) const; | |
55 | |
56 private: | |
57 std::unique_ptr<gltf::Asset> gltf_asset_; | |
58 std::vector<std::unique_ptr<SkBitmap>> texture_bitmaps_; | |
59 std::vector<std::unique_ptr<gltf::Buffer>> buffers_; | |
60 | |
61 const char* Buffer() const; | |
62 const gltf::Accessor* Accessor(const std::string& key) const; | |
63 }; | |
64 | |
65 } // namespace vr_shell | |
66 | |
67 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MODEL_H_ | |
OLD | NEW |