mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-10 04:31:34 -10:00
This adds a mechanism for running generic operations at specific points of the frame execution. This can be used by any part of the code an not just Lua since it simply executes std::functions. It also adds an "execution context" concept that specifies in which situation an operation should be executed. This is then used by the Lua Coroutines code for resuming coroutines at specific points instead of always when the awaited promise resolves.
71 lines
1.7 KiB
C++
71 lines
1.7 KiB
C++
#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&) SCP_DELETED_FUNCTION;
|
|
|
|
ParticleSourceWrapper& operator=(const ParticleSourceWrapper&) SCP_DELETED_FUNCTION;
|
|
|
|
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 moveTo(vec3d* pos);
|
|
|
|
void setOrientationFromNormalizedVec(vec3d* normalizedDir);
|
|
|
|
void setOrientationFromVec(vec3d* dir);
|
|
|
|
void setOrientationMatrix(matrix* mtx);
|
|
|
|
void setOrientationNormal(vec3d* normal);
|
|
|
|
void setWeaponState(WeaponState state);
|
|
};
|
|
}
|
|
|
|
|
|
#endif //PARTICLE_PARTICLESOURCEWRAPPER_H
|