File: ParticleSourceWrapper.h

package info (click to toggle)
freespace2 24.0.2%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 43,188 kB
  • sloc: cpp: 583,107; ansic: 21,729; python: 1,174; sh: 464; makefile: 248; xml: 181
file content (73 lines) | stat: -rw-r--r-- 1,881 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
#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(object* obj, vec3d* localPos);

		void moveToBeam(object* obj);

		void moveTo(vec3d* pos);

		void setVelocity(vec3d* vel);

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

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

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

		void setOrientationNormal(vec3d* normal);

		void setWeaponState(WeaponState state);
	};
}


#endif //PARTICLE_PARTICLESOURCEWRAPPER_H