File: ParticleProperties.h

package info (click to toggle)
freespace2 24.2.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 43,716 kB
  • sloc: cpp: 595,001; ansic: 21,741; python: 1,174; sh: 457; makefile: 248; xml: 181
file content (66 lines) | stat: -rw-r--r-- 1,572 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
#pragma once

#include "particle/particle.h"
#include "utils/RandomRange.h"

namespace particle {
namespace util {

enum class RotationType { DEFAULT, RANDOM, SCREEN_ALIGNED };

/**
 * @brief The creation properties of a particle
 *
 * This can be used by effects to store range values for particle creation
 *
 * @ingroup particleUtils
 */
class ParticleProperties {
private:
	/**
	 * @brief Choose particle from bitmap list
	 */
	int chooseBitmap();

 public:

	SCP_vector<int> m_bitmap_list;
	::util::UniformRange<size_t> m_bitmap_range;
	::util::ParsedRandomFloatRange m_radius;
	bool m_parentLifetime = false;
	bool m_parentScale = false;
	bool m_hasLifetime = false;
	::util::ParsedRandomFloatRange m_lifetime;
	::util::ParsedRandomFloatRange m_length;
	int m_size_lifetime_curve;
	int m_vel_lifetime_curve;
	RotationType m_rotation_type;
	vec3d m_manual_offset;
	bool m_parent_local = false;

	ParticleProperties();

	/**
	 * @brief Parses the particle values
	 * @param nocreate @c true if +nocreate was found
	 */
	void parse(bool nocreate);

	/**
	 * @brief Creates a particle with the stored values
	 * @param info The base values of the particle. Some values will be overwritten by this function
	 * @return The created particle
	 */
	void createParticle(particle_info& info);

	/**
	 * @brief Creates a particle with the stored values
	 * @param info The base values of the particle. Some values will be overwritten by this function
	 * @return The created particle
	 */
	WeakParticlePtr createPersistentParticle(particle_info& info);

	void pageIn();
};
}
}