| 1 |
/* |
| 2 |
* Copyright (C) 2020 The Android Open Source Project |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef GLTFIO_FFILAMENTINSTANCE_H |
| 18 |
#define GLTFIO_FFILAMENTINSTANCE_H |
| 19 |
|
| 20 |
#include <gltfio/FilamentInstance.h> |
| 21 |
|
| 22 |
#include <utils/Entity.h> |
| 23 |
|
| 24 |
#include <math/mat4.h> |
| 25 |
|
| 26 |
#include <tsl/robin_map.h> |
| 27 |
|
| 28 |
#include <string> |
| 29 |
#include <vector> |
| 30 |
|
| 31 |
#include "upcast.h" |
| 32 |
|
| 33 |
struct cgltf_node; |
| 34 |
|
| 35 |
namespace gltfio { |
| 36 |
|
| 37 |
struct FFilamentAsset; |
| 38 |
class Animator; |
| 39 |
|
| 40 |
struct Skin { |
| 41 |
std::string name; |
| 42 |
std::vector<filament::math::mat4f> inverseBindMatrices; |
| 43 |
std::vector<utils::Entity> joints; |
| 44 |
std::vector<utils::Entity> targets; |
| 45 |
}; |
| 46 |
|
| 47 |
using SkinVector = std::vector<Skin>; |
| 48 |
using NodeMap = tsl::robin_map<const cgltf_node*, utils::Entity>; |
| 49 |
|
| 50 |
struct FFilamentInstance : public FilamentInstance { |
| 51 |
std::vector<utils::Entity> entities; |
| 52 |
utils::Entity root; |
| 53 |
Animator* animator; |
| 54 |
FFilamentAsset* owner; |
| 55 |
SkinVector skins; |
| 56 |
NodeMap nodeMap; |
| 57 |
Animator* getAnimator() noexcept; |
| 58 |
}; |
| 59 |
|
| 60 |
FILAMENT_UPCAST(FilamentInstance) |
| 61 |
|
| 62 |
} // namespace gltfio |
| 63 |
|
| 64 |
#endif // GLTFIO_FFILAMENTINSTANCE_H |