| 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..0711505279ae75988c1cc13fb7d3a0e999d3d23c 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;
|
| @@ -104,6 +123,10 @@ const Scene* Asset::GetScene(std::size_t id) const {
|
| return id < scenes_.size() ? scenes_[id].get() : nullptr;
|
| }
|
|
|
| +void Asset::FreeBuffers() {
|
| + buffers_.clear();
|
| +}
|
| +
|
| } // namespace gltf
|
|
|
| } // namespace vr_shell
|
|
|