Skylicht Engine
Loading...
Searching...
No Matches
CParticle.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 "Entity/IEntityData.h"
28
29namespace Skylicht
30{
31 namespace Particle
32 {
39 {
40 Scale = 0,
41 ScaleX,
42 ScaleY,
43 ScaleZ,
44 RotateX,
45 RotateY,
46 RotateZ,
47 ColorR,
48 ColorG,
49 ColorB,
50 ColorA,
51 Mass,
52 FrameIndex,
53 RotateSpeedX,
54 RotateSpeedY,
55 RotateSpeedZ,
56 NumParams
57 };
58
64 class COMPONENT_API CParticle
65 {
66 public:
68 u32 Index;
71
74
76 float Params[NumParams];
78 float StartValue[NumParams];
80 float EndValue[NumParams];
81
83 float Age;
85 float Life;
87 float LifeTime;
88
91
93 core::vector3df Position;
95 core::vector3df Rotation;
97 core::vector3df Velocity;
98
100 core::vector3df LastPosition;
101
103 core::vector3df SubEmitterDirection;
105 void* UserData;
106
107 public:
108 CParticle(u32 index);
109
110 virtual ~CParticle();
111
113 void swap(CParticle& p);
114 };
115 }
116}
core::vector3df LastPosition
Position in the previous frame.
Definition CParticle.h:100
float Life
Remaining time to live in seconds.
Definition CParticle.h:85
core::vector3df SubEmitterDirection
Initial direction for sub-emitters if velocity is zero.
Definition CParticle.h:103
float Params[NumParams]
Current values of animated parameters.
Definition CParticle.h:76
void swap(CParticle &p)
Swaps all data with another particle instance.
bool HaveRotate
Optimization flag: whether this particle has active rotation logic.
Definition CParticle.h:90
core::vector3df Position
Current world position.
Definition CParticle.h:93
float EndValue[NumParams]
Targeted end values of animated parameters.
Definition CParticle.h:80
void * UserData
Optional user-defined data.
Definition CParticle.h:105
s32 ParentIndex
Index of the parent particle in a parent group (for sub-emitters).
Definition CParticle.h:70
float Age
Time since birth in seconds.
Definition CParticle.h:83
float LifeTime
Total expected lifespan in seconds.
Definition CParticle.h:87
core::vector3df Velocity
Current movement velocity.
Definition CParticle.h:97
core::vector3df Rotation
Current world rotation (Euler).
Definition CParticle.h:95
float StartValue[NumParams]
Initial values of animated parameters.
Definition CParticle.h:78
u32 Index
Global index in the group's particle array.
Definition CParticle.h:68
bool Immortal
If true, this particle never dies from age.
Definition CParticle.h:73
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