Skylicht Engine
Loading...
Searching...
No Matches
CModel.h
1/*
2!@
3MIT License
4
5Copyright (c) 2020 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include "Utils/CInterpolator.h"
28#include "ParticleSystem/Particles/CParticle.h"
29#include "ParticleSystem/Particles/CParticleSerializable.h"
30
31namespace Skylicht
32{
33 namespace Particle
34 {
35 class CGroup;
36
43 class COMPONENT_API CModel : public CParticleSerializable
44 {
45 protected:
48
51 float m_start1;
52 float m_start2;
53
58 float m_end1;
59 float m_end2;
60
63
66
67 std::string m_typeName;
68
69 public:
70 CModel(CGroup* group, EParticleParams type);
71
72 virtual ~CModel();
73
75
77
79 const wchar_t* getName();
80
83 {
84 return m_type;
85 }
86
88 inline CGroup* getGroup()
89 {
90 return m_group;
91 }
92
94 inline CModel* setStart(float f)
95 {
96 m_start1 = f;
97 m_start2 = f;
98 m_randomStart = true;
99 return this;
100 }
101
103 inline CModel* setStart(float f1, float f2)
104 {
105 m_start1 = f1;
106 m_start2 = f2;
107 m_randomStart = true;
108 return this;
109 }
110
112 inline CModel* setEnd(float f)
113 {
114 m_end1 = f;
115 m_end2 = f;
116 m_randomEnd = true;
117 return this;
118 }
119
121 inline CModel* setEnd(float f1, float f2)
122 {
123 m_end1 = f1;
124 m_end2 = f2;
125 m_randomEnd = true;
126 return this;
127 }
128
130 inline bool isEnableEndValue()
131 {
132 return m_enableEndValue;
133 }
134
136 inline void enableEndValue(bool b)
137 {
139 }
140
142 inline bool isRandomStart()
143 {
144 return m_randomStart;
145 }
146
148 inline bool isRandomEnd()
149 {
150 return m_randomEnd;
151 }
152
153 float getStartValue1()
154 {
155 return m_start1;
156 }
157
158 void setStartValue1(float f)
159 {
160 m_start1 = f;
161 }
162
163 float getStartValue2()
164 {
165 return m_start2;
166 }
167
168 void setStartValue2(float f)
169 {
170 m_start2 = f;
171 }
172
173 float getEndValue1()
174 {
175 return m_end1;
176 }
177
178 void setEndValue1(float f)
179 {
180 m_end1 = f;
181 }
182
183 float getEndValue2()
184 {
185 return m_end2;
186 }
187
188 void setEndValue2(float f)
189 {
190 m_end2 = f;
191 }
192
195
198
200 inline void setInterpolator(CInterpolator* interpolate)
201 {
202 m_interpolator = interpolate;
203 }
204
207 {
208 return m_interpolator;
209 }
210
211 virtual const char* getTypeName();
212 };
213 }
214}
Keyframe interpolator for scalar, vector, and color values.
Definition CInterpolator.h:146
Definition CObjectSerializable.h:36
Represents a group of particles with shared settings, emitters, and a renderer.
Definition CGroup.h:132
CModel * setEnd(float f)
Sets fixed end value.
Definition CModel.h:112
bool isEnableEndValue()
Checks if end value is enabled.
Definition CModel.h:130
bool isRandomEnd()
Checks if end is random.
Definition CModel.h:148
float getRandomEnd()
Generates a random end value from range.
float getRandomStart()
Generates a random start value from range.
void setInterpolator(CInterpolator *interpolate)
Sets a custom curve for parameter animation.
Definition CModel.h:200
CModel * setStart(float f)
Sets fixed start value.
Definition CModel.h:94
EParticleParams m_type
The parameter type being animated.
Definition CModel.h:47
const wchar_t * getName()
Gets the display name of the model.
virtual void loadSerializable(CObjectSerializable *object)
Loads properties from a serializable object.
CGroup * getGroup()
Gets parent group.
Definition CModel.h:88
bool m_randomStart
If true, picks a random start value between start1 and start2.
Definition CModel.h:50
CInterpolator * m_interpolator
Optional custom curve for interpolation.
Definition CModel.h:65
CModel * setEnd(float f1, float f2)
Sets random end range.
Definition CModel.h:121
virtual CObjectSerializable * createSerializable()
Creates a serializable object for property editing or saving.
bool isRandomStart()
Checks if start is random.
Definition CModel.h:142
CInterpolator * getInterpolator()
Gets current interpolator.
Definition CModel.h:206
CGroup * m_group
Parent group.
Definition CModel.h:62
CModel * setStart(float f1, float f2)
Sets random start range.
Definition CModel.h:103
bool m_enableEndValue
Whether to interpolate towards an end value.
Definition CModel.h:55
void enableEndValue(bool b)
Enables or disables interpolation to end value.
Definition CModel.h:136
bool m_randomEnd
If true, picks a random end value between end1 and end2.
Definition CModel.h:57
EParticleParams getType()
Gets the parameter type.
Definition CModel.h:82
EParticleParams
IDs for particle parameters that can be animated over time.
Definition CParticle.h:39
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29