Skylicht Engine
Loading...
Searching...
No Matches
CFactory.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 "Renderers/IRenderer.h"
28#include "Zones/CZone.h"
29#include "Emitters/CEmitter.h"
30
31#include "Renderers/CQuadRenderer.h"
32#include "Renderers/CCPURenderer.h"
33#include "Renderers/CMeshParticleRenderer.h"
34
35#include "Zones/CPoint.h"
36#include "Zones/CSphere.h"
37#include "Zones/CAABox.h"
38#include "Zones/CCylinder.h"
39#include "Zones/CLine.h"
40#include "Zones/CPolyLine.h"
41#include "Zones/CRing.h"
42
43#include "Emitters/CRandomEmitter.h"
44#include "Emitters/CStraightEmitter.h"
45#include "Emitters/CSphericEmitter.h"
46#include "Emitters/CNormalEmitter.h"
47
48#include "Systems/CVortexSystem.h"
49
50namespace Skylicht
51{
52 namespace Particle
53 {
60 class COMPONENT_API CFactory
61 {
62 protected:
63 std::vector<IRenderer*> m_renderers;
64 std::vector<CZone*> m_zones;
65 std::vector<CEmitter*> m_emitters;
66
67 public:
68 CFactory();
69
70 virtual ~CFactory();
71
74
77
79 CSphericEmitter* createSphericEmitter(const core::vector3df& direction, float angleA, float angleB);
80
83
86
89
92
95
98
101
104
107
109 CSphere* createSphereZone(const core::vector3df& pos, float radius);
110
113
115 CCylinder* createCylinderZone(const core::vector3df& pos, const core::vector3df& direction, float radius, float length);
116
119
122
124 CRing* createRingZone(const core::vector3df& pos, const core::vector3df& normal, float minRadius, float maxRadius);
125
128
130 CEmitter* createEmitter(const std::wstring& attributeName);
131
133 CZone* createZone(const std::wstring& attributeName);
134
136 IRenderer* createRenderer(const std::wstring& attributeName);
137 };
138 }
139}
A zone that spawns particles within or on the surface of an Axis-Aligned Bounding Box.
Definition CAABox.h:39
A non-instanced renderer that builds the particle vertex buffer on the CPU every frame.
Definition CCPURenderer.h:41
A zone that spawns particles within or on the surface of a cylinder.
Definition CCylinder.h:39
Base class for particle emitters.
Definition CEmitter.h:88
void deleteRenderer(IRenderer *r)
Deletes and removes a renderer.
CPoint * createPointZone(const core::vector3df &pos)
Creates a Point zone at specific position.
CEmitter * createEmitter(const std::wstring &attributeName)
Creates an emitter by its class name (for XML loading).
void deleteEmitter(CEmitter *e)
Deletes and removes an emitter.
CRandomEmitter * createRandomEmitter()
Creates a new Random emitter.
IRenderer * createRenderer(const std::wstring &attributeName)
Creates a renderer by its class name (for XML loading).
CSphere * createSphereZone(const core::vector3df &pos, float radius)
Creates a Sphere zone.
CQuadRenderer * createQuadRenderer()
Creates a GPU instanced quad renderer.
CSphericEmitter * createSphericEmitter(const core::vector3df &direction, float angleA, float angleB)
Creates a new Spheric (cone) emitter.
CMeshParticleRenderer * createMeshParticleRenderer()
Creates a GPU mesh instancing renderer.
CLine * createLineZone(const core::vector3df &p1, const core::vector3df &p2)
Creates a Line segment zone.
CCPURenderer * createCPURenderer()
Creates a CPU-based quad renderer.
CPolyLine * createPolyLineZone(const core::array< core::vector3df > &points)
Creates a multi-segment PolyLine zone.
CStraightEmitter * createStraightEmitter(const core::vector3df &direction)
Creates a new Straight emitter with a fixed direction.
CAABox * createAABoxZone(const core::vector3df &pos, const core::vector3df &dimension)
Creates an Axis-Aligned Box zone.
CCylinder * createCylinderZone(const core::vector3df &pos, const core::vector3df &direction, float radius, float length)
Creates a Cylinder zone.
CRing * createRingZone(const core::vector3df &pos, const core::vector3df &normal, float minRadius, float maxRadius)
Creates a 2D Ring zone in 3D space.
CZone * createZone(EZone type)
Creates a zone based on type enum.
CZone * createZone(const std::wstring &attributeName)
Creates a zone by its class name (for XML loading).
void deleteZone(CZone *z)
Deletes and removes a zone.
CPoint * createPointZone()
Creates a Point zone at origin.
CNormalEmitter * createNormalEmitter(bool inverted)
Creates a new Normal emitter shooting along zone surfaces.
A zone that spawns particles along a line segment.
Definition CLine.h:39
Renderer that uses hardware instancing to draw 3D meshes as particles.
Definition CMeshParticleRenderer.h:48
Emitter that shoots particles along the surface normals of its zone.
Definition CNormalEmitter.h:40
A zone that spawns particles at a single point.
Definition CPoint.h:39
A zone that spawns particles along a sequence of connected line segments.
Definition CPolyLine.h:39
Optimized GPU instancing renderer for billboard particles.
Definition CQuadRenderer.h:72
Emitter that shoots particles in random directions.
Definition CRandomEmitter.h:40
A zone that spawns particles within a 2D ring (annulus) in 3D space.
Definition CRing.h:39
A zone that spawns particles within or on the surface of a sphere.
Definition CSphere.h:39
Emitter that shoots particles in a cone shape defined by two angles.
Definition CSphericEmitter.h:45
Emitter that shoots particles in a fixed direction.
Definition CStraightEmitter.h:40
Base class for zones where particles can be spawned.
Definition CZone.h:66
Base interface for particle renderers.
Definition IRenderer.h:54
Self reallocating template array (like stl vector) with additional features.
Definition irrArray.h:23
EZone
Available particle spawn zones.
Definition CZone.h:48
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