Skylicht Engine
Loading...
Searching...
No Matches
CGUIParticle.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 "Graphics2D/CCanvas.h"
28#include "ParticleSystem/CParticleComponent.h"
29
30namespace Skylicht
31{
32 namespace Particle
33 {
51 class CGUIParticle : public CGUIElement
52 {
53 protected:
57 std::string m_source;
58
63
68
72 float m_depthZ;
73
78
83
88
89 public:
93 static void registerPlugin();
94
100 CGUIParticle(CCanvas* canvas, CGUIElement* parent);
101
108 CGUIParticle(CCanvas* canvas, CGUIElement* parent, const core::rectf& rect);
109
110 virtual ~CGUIParticle();
111
116 virtual void update(CCamera* camera);
117
122 virtual void render(CCamera* camera);
123
129
135
141 void setParticle(const char* source, bool autoPlay);
142
147
152
156 void reload();
157
163 {
164 return m_ps;
165 }
166
167 DECLARE_GETTYPENAME(CGUIParticle)
168
169 protected:
170
176
177 };
178 }
179}
This is an object class used to set up the camera, including its position, viewing angle,...
Definition CCamera.h:70
Definition CObjectSerializable.h:36
2D GUI element that displays a 3D particle system.
Definition CGUIParticle.h:52
bool m_autoPlay
Whether the particle system plays automatically upon loading.
Definition CGUIParticle.h:62
float m_particleScale
Scaling factor for the 3D particle system in 2D UI space.
Definition CGUIParticle.h:67
static void registerPlugin()
Registers the CGUIParticle class to the CGUIFactory.
void reload()
Reloads the particle system from the current source path.
void setParticle(const char *source, bool autoPlay)
Sets the particle system source file.
void stopParticle()
Stops playback and clears existing particles.
virtual CObjectSerializable * createSerializable()
Creates a serializable object for property editing.
void renderParticleBuffer(Particle::CGroup *g)
Renders a specific particle group.
virtual void render(CCamera *camera)
Renders the particle system into the 2D canvas.
CGUIParticle(CCanvas *canvas, CGUIElement *parent, const core::rectf &rect)
Constructor with a predefined rectangle.
float m_depthZ
Depth value (Z) for rendering the particle system relative to the UI.
Definition CGUIParticle.h:72
Particle::CParticleComponent * m_ps
The underlying particle component instance.
Definition CGUIParticle.h:77
virtual void update(CCamera *camera)
Updates the particle system animations.
core::vector3df m_billboardUp
Cached up vector for billboarding.
Definition CGUIParticle.h:82
virtual void loadSerializable(CObjectSerializable *object)
Loads properties from a serializable object.
void playParticle()
Starts playback of the particle system.
Particle::CParticleComponent * getParticle()
Returns the underlying particle component.
Definition CGUIParticle.h:162
CGUIParticle(CCanvas *canvas, CGUIElement *parent)
Constructor.
core::vector3df m_billboardLook
Cached look vector for billboarding.
Definition CGUIParticle.h:87
std::string m_source
The source path to the .particle file.
Definition CGUIParticle.h:57
Represents a group of particles with shared settings, emitters, and a renderer.
Definition CGroup.h:132
Main component for creating and managing a particle system in Skylicht.
Definition CParticleComponent.h:66
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
Definition vector3d.h:445
rect< f32 > rectf
Rectangle with float values.
Definition rect.h:271