File: ParticleSourceWrapper.h

package info (click to toggle)
freespace2 24.2.0%2Brepack-3
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 43,740 kB
  • sloc: cpp: 595,005; ansic: 21,741; python: 1,174; sh: 457; makefile: 243; xml: 181
file content (77 lines) | stat: -rw-r--r-- 2,137 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef PARTICLE_PARTICLESOURCEWRAPPER_H
#define PARTICLE_PARTICLESOURCEWRAPPER_H
#pragma once

#include "globalincs/pstypes.h"
#include "ParticleSource.h"

enum class WeaponState : uint32_t;

namespace particle
{
	class ParticleSource;

	/**
	 * @brief A wrapper around multiple particle sources
	 *
	 * This class contains multiple sources which are grouped together. This is needed because effects may create
	 * multiple sources and this class provides transparent handling of that case.
	 *
	 * Once initialization of the sources is done you must call #finish() in order to mark the sources as properly
	 * initialized.
	 *
	 * @ingroup particleSystems
	 */
	class ParticleSourceWrapper
	{
	private:
		SCP_vector<ParticleSource*> m_sources;

		bool m_finished = false;

	public:
		ParticleSourceWrapper(const ParticleSourceWrapper&) = delete;
		ParticleSourceWrapper& operator=(const ParticleSourceWrapper&) = delete;

		ParticleSourceWrapper() = default;
		explicit ParticleSourceWrapper(SCP_vector<ParticleSource*>&& sources);
		explicit ParticleSourceWrapper(ParticleSource* source);

		~ParticleSourceWrapper();

		ParticleSourceWrapper(ParticleSourceWrapper&& other) noexcept;

		ParticleSourceWrapper& operator=(ParticleSourceWrapper&& other) noexcept;

		void finish();

		void setCreationTimestamp(int timestamp);

		void moveToParticle(const WeakParticlePtr& ptr);

		void moveToObject(const object* obj, const vec3d* localPos);

		void moveToSubobject(const object* obj, int subobject, const vec3d* localPos);

		void moveToTurret(const object* obj, int subobject, int fire_pos);

		void moveToBeam(const object* obj);

		void moveTo(const vec3d* pos, const matrix* orientation = &vmd_identity_matrix);

		void setVelocity(const vec3d* vel);

		void setOrientationFromNormalizedVec(const vec3d* normalizedDir, bool relative = false);

		void setOrientationFromVec(const vec3d* dir, bool relative = false);

		void setOrientationMatrix(const matrix* mtx, bool relative = false);

		void setOrientationNormal(const vec3d* normal);

		void setWeaponState(WeaponState state);
	};
}


#endif //PARTICLE_PARTICLESOURCEWRAPPER_H