Plasma Engine  2.0
Loading...
Searching...
No Matches
SkeletonResource.h
1#pragma once
2
3#include <Core/ResourceManager/Resource.h>
4#include <Core/ResourceManager/ResourceHandle.h>
5#include <RendererCore/AnimationSystem/Declarations.h>
6#include <RendererCore/AnimationSystem/Skeleton.h>
7#include <RendererCore/RendererCoreDLL.h>
8
10
12{
13 // scale is used to resize a unit sphere / box / capsule
14 plTransform m_Transform;
15 plUInt16 m_uiAttachedToJoint = 0;
17
18 // for convex geometry
19 plDynamicArray<plVec3> m_VertexPositions;
20 plDynamicArray<plUInt8> m_TriangleIndices;
21};
22
23struct PL_RENDERERCORE_DLL plSkeletonResourceDescriptor
24{
29 void operator=(plSkeletonResourceDescriptor&& rhs);
30 void operator=(const plSkeletonResourceDescriptor& rhs) = delete;
31
32 plResult Serialize(plStreamWriter& inout_stream) const;
33 plResult Deserialize(plStreamReader& inout_stream);
34
35 plUInt64 GetHeapMemoryUsage() const;
36
37 plTransform m_RootTransform = plTransform::MakeIdentity();
38 plSkeleton m_Skeleton;
39 float m_fMaxImpulse = plMath::HighValue<float>();
40
42};
43
45
46class PL_RENDERERCORE_DLL plSkeletonResource : public plResource
47{
48 PL_ADD_DYNAMIC_REFLECTION(plSkeletonResource, plResource);
49 PL_RESOURCE_DECLARE_COMMON_CODE(plSkeletonResource);
50 PL_RESOURCE_DECLARE_CREATEABLE(plSkeletonResource, plSkeletonResourceDescriptor);
51
52public:
55
56 const plSkeletonResourceDescriptor& GetDescriptor() const { return *m_pDescriptor; }
57
58private:
59 virtual plResourceLoadDesc UnloadData(Unload WhatToUnload) override;
60 virtual plResourceLoadDesc UpdateContent(plStreamReader* Stream) override;
61 virtual void UpdateMemoryUsage(MemoryUsage& out_NewMemoryUsage) override;
62
64};
Definition DynamicArray.h:81
The base class for all resources.
Definition Resource.h:10
The skeleton class encapsulates the information about the joint structure for a model.
Definition Skeleton.h:75
Definition SkeletonResource.h:47
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
static plTransformTemplate< float > MakeIdentity()
Definition Transform_inl.h:25
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
constexpr TYPE HighValue()
A very large value, that is slightly smaller than sqrt(MaxValue()).
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Definition Resource.h:34
Describes in which loading state a resource currently is, and how many different quality levels there...
Definition Declarations.h:102
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Definition SkeletonResource.h:24
Definition SkeletonResource.h:12