PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
skeleton_asset.h
1#pragma once
2
3#include "pixelbullet/filesystem/virtual_path.h"
4
5#include "ozz/animation/runtime/skeleton.h"
6
7#include <memory>
8
9namespace pixelbullet
10{
11class Filesystem;
12
13class SkeletonAsset
14{
15public:
16 SkeletonAsset() = default;
17 SkeletonAsset(SkeletonAsset&&) noexcept = default;
18 SkeletonAsset& operator=(SkeletonAsset&&) noexcept = default;
19
20 SkeletonAsset(const SkeletonAsset&) = delete;
21 SkeletonAsset& operator=(const SkeletonAsset&) = delete;
22
23 SkeletonAsset(const Filesystem& filesystem, const VirtualPath& asset_path)
24 {
25 Load(filesystem, asset_path);
26 }
27
28 bool Load(const Filesystem& filesystem, const VirtualPath& asset_path);
29
30 explicit operator bool() const noexcept
31 {
32 return skeleton_ != nullptr;
33 }
34
35 [[nodiscard]] const VirtualPath& GetFilename() const noexcept
36 {
37 return filename_;
38 }
39
40 [[nodiscard]] const ozz::animation::Skeleton* GetRuntimeSkeleton() const noexcept
41 {
42 return skeleton_.get();
43 }
44
45 [[nodiscard]] int GetJointCount() const noexcept
46 {
47 return skeleton_ != nullptr ? skeleton_->num_joints() : 0;
48 }
49
50private:
51 void Clear() noexcept;
52
53 VirtualPath filename_;
54 std::unique_ptr<ozz::animation::Skeleton> skeleton_;
55};
56} // namespace pixelbullet
Definition filesystem.h:19
Definition virtual_path.h:10