Plasma Engine  2.0
Loading...
Searching...
No Matches
PropertyAnimResource.h
1#pragma once
2
3#include <Core/ResourceManager/Resource.h>
4#include <Foundation/Tracks/ColorGradient.h>
5#include <Foundation/Tracks/Curve1D.h>
6#include <Foundation/Tracks/EventTrack.h>
7#include <Foundation/Types/SharedPtr.h>
8#include <GameEngine/GameEngineDLL.h>
9
11struct PL_GAMEENGINE_DLL plPropertyAnimTarget
12{
13 using StorageType = plUInt8;
14
29};
30
31PL_DECLARE_REFLECTABLE_TYPE(PL_GAMEENGINE_DLL, plPropertyAnimTarget);
32
34
36struct PL_GAMEENGINE_DLL plPropertyAnimMode
37{
38 using StorageType = plUInt8;
39
40 enum Enum
41 {
45
46 Default = Loop,
47 };
48};
49
50PL_DECLARE_REFLECTABLE_TYPE(PL_GAMEENGINE_DLL, plPropertyAnimMode);
51
53
54struct PL_GAMEENGINE_DLL plPropertyAnimEntry
55{
58 plString m_sPropertyPath;
60 const plRTTI* m_pComponentRtti = nullptr;
61};
62
63struct PL_GAMEENGINE_DLL plFloatPropertyAnimEntry : public plPropertyAnimEntry
64{
65 plCurve1D m_Curve;
66};
67
68struct PL_GAMEENGINE_DLL plColorPropertyAnimEntry : public plPropertyAnimEntry
69{
70 plColorGradient m_Gradient;
71};
72
74
75// this class is actually ref counted and used with plSharedPtr to allow to work on the same data, even when the resource was reloaded
76struct PL_GAMEENGINE_DLL plPropertyAnimResourceDescriptor : public plRefCounted
77{
78 plTime m_AnimationDuration;
81 plEventTrack m_EventTrack;
82
83 void Save(plStreamWriter& inout_stream) const;
84 void Load(plStreamReader& inout_stream);
85};
86
88
90
91class PL_GAMEENGINE_DLL plPropertyAnimResource : public plResource
92{
93 PL_ADD_DYNAMIC_REFLECTION(plPropertyAnimResource, plResource);
94
95 PL_RESOURCE_DECLARE_COMMON_CODE(plPropertyAnimResource);
96 PL_RESOURCE_DECLARE_CREATEABLE(plPropertyAnimResource, plPropertyAnimResourceDescriptor);
97
98public:
100
101 plSharedPtr<plPropertyAnimResourceDescriptor> GetDescriptor() const { return m_pDescriptor; }
102
103private:
104 virtual plResourceLoadDesc UnloadData(Unload WhatToUnload) override;
105 virtual plResourceLoadDesc UpdateContent(plStreamReader* Stream) override;
106 virtual void UpdateMemoryUsage(MemoryUsage& out_NewMemoryUsage) override;
107
109};
A color curve for animating colors.
Definition ColorGradient.h:15
A 1D curve for animating a single value over time.
Definition Curve1D.h:29
Definition DynamicArray.h:81
An event track is a time line that contains named events.
Definition EventTrack.h:15
Definition PropertyAnimResource.h:92
This class holds information about reflected types. Each instance represents one type that is known t...
Definition RTTI.h:30
Base class for reference counted objects.
Definition RefCounted.h:52
The base class for all resources.
Definition Resource.h:10
A Shared ptr manages a shared object and destroys that object when no one references it anymore....
Definition SharedPtr.h:10
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
Definition PropertyAnimResource.h:69
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Definition PropertyAnimResource.h:64
Definition PropertyAnimResource.h:55
plString m_sObjectSearchSequence
Sequence of named objects to search for the target.
Definition PropertyAnimResource.h:56
plString m_sComponentType
Empty to reference the game object properties (position etc.)
Definition PropertyAnimResource.h:57
Describes how an animation should be played back.
Definition PropertyAnimResource.h:37
Enum
Definition PropertyAnimResource.h:41
@ Once
Play the animation once from start to end and then stop.
Definition PropertyAnimResource.h:42
@ Loop
Play the animation from start to end, then loop back to the start and repeat indefinitely.
Definition PropertyAnimResource.h:43
@ BackAndForth
Play the animation from start to end, then reverse direction and play from end to start,...
Definition PropertyAnimResource.h:44
Definition PropertyAnimResource.h:77
What data type an animation modifies.
Definition PropertyAnimResource.h:12
Enum
Definition PropertyAnimResource.h:16
@ VectorY
The y coordinate of a vector.
Definition PropertyAnimResource.h:19
@ Color
A color.
Definition PropertyAnimResource.h:25
@ RotationY
The y coordinate of a rotation.
Definition PropertyAnimResource.h:23
@ RotationX
The x coordinate of a rotation.
Definition PropertyAnimResource.h:22
@ RotationZ
The z coordinate of a rotation.
Definition PropertyAnimResource.h:24
@ VectorZ
The z coordinate of a vector.
Definition PropertyAnimResource.h:20
@ Number
A single value.
Definition PropertyAnimResource.h:17
@ VectorX
The x coordinate of a vector.
Definition PropertyAnimResource.h:18
@ VectorW
The w coordinate of a vector.
Definition PropertyAnimResource.h:21
Definition Resource.h:34
Describes in which loading state a resource currently is, and how many different quality levels there...
Definition Declarations.h:102
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12