OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_ASSET_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_ASSET_H_ |
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_ASSET_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_ASSET_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 11 matching lines...) Expand all Loading... | |
22 VEC2, | 22 VEC2, |
23 VEC3, | 23 VEC3, |
24 VEC4, | 24 VEC4, |
25 MAT2, | 25 MAT2, |
26 MAT3, | 26 MAT3, |
27 MAT4, | 27 MAT4, |
28 }; | 28 }; |
29 | 29 |
30 Type GetType(const std::string& type); | 30 Type GetType(const std::string& type); |
31 | 31 |
32 GLint GetTypeComponents(Type type); | |
33 | |
32 // A Buffer is data stored as binary blob in little-endian format. | 34 // A Buffer is data stored as binary blob in little-endian format. |
33 using Buffer = std::string; | 35 using Buffer = std::string; |
34 | 36 |
35 // The following structures match the objects defined in glTF 1.0 standard. | 37 // The following structures match the objects defined in glTF 1.0 standard. |
36 // https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#properties -reference | 38 // https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#properties -reference |
37 | 39 |
38 // A BufferView is subset of data in a buffer. | 40 // A BufferView is subset of data in a buffer. |
39 struct BufferView { | 41 struct BufferView { |
40 const Buffer* buffer; | 42 const Buffer* buffer; |
41 int byte_length = 0; | 43 int byte_length = 0; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 const BufferView* GetBufferView(std::size_t id) const; | 103 const BufferView* GetBufferView(std::size_t id) const; |
102 const Accessor* GetAccessor(std::size_t id) const; | 104 const Accessor* GetAccessor(std::size_t id) const; |
103 const Mesh* GetMesh(std::size_t id) const; | 105 const Mesh* GetMesh(std::size_t id) const; |
104 const Node* GetNode(std::size_t id) const; | 106 const Node* GetNode(std::size_t id) const; |
105 const Scene* GetScene(std::size_t id) const; | 107 const Scene* GetScene(std::size_t id) const; |
106 | 108 |
107 const Scene* GetMainScene() const { return scene_; } | 109 const Scene* GetMainScene() const { return scene_; } |
108 | 110 |
109 void SetMainScene(const Scene* scene) { scene_ = scene; } | 111 void SetMainScene(const Scene* scene) { scene_ = scene; } |
110 | 112 |
113 void FreeBuffers(); | |
mthiesse
2017/03/28 20:26:23
I don't really like that we're clearing the buffer
acondor_
2017/03/29 20:13:26
Done.
| |
114 | |
111 private: | 115 private: |
112 std::vector<std::unique_ptr<Buffer>> buffers_; | 116 std::vector<std::unique_ptr<Buffer>> buffers_; |
113 std::vector<std::unique_ptr<BufferView>> buffer_views_; | 117 std::vector<std::unique_ptr<BufferView>> buffer_views_; |
114 std::vector<std::unique_ptr<Accessor>> accessors_; | 118 std::vector<std::unique_ptr<Accessor>> accessors_; |
115 std::vector<std::unique_ptr<Mesh>> meshes_; | 119 std::vector<std::unique_ptr<Mesh>> meshes_; |
116 std::vector<std::unique_ptr<Node>> nodes_; | 120 std::vector<std::unique_ptr<Node>> nodes_; |
117 std::vector<std::unique_ptr<Scene>> scenes_; | 121 std::vector<std::unique_ptr<Scene>> scenes_; |
118 const Scene* scene_; | 122 const Scene* scene_; |
119 }; | 123 }; |
120 | 124 |
121 } // namespace gltf | 125 } // namespace gltf |
122 | 126 |
123 } // namespace vr_shell | 127 } // namespace vr_shell |
124 | 128 |
125 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_ASSET_H_ | 129 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_GLTF_ASSET_H_ |
OLD | NEW |