2018-10-06 20:42:33 -07:00
|
|
|
#pragma once
|
2016-02-05 00:34:14 -08:00
|
|
|
|
2017-06-03 18:01:09 -07:00
|
|
|
#include <array>
|
2019-09-22 14:52:05 -07:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CColor.hpp>
|
|
|
|
#include <zeus/CMatrix4f.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
|
|
|
#include <zeus/CVector4f.hpp>
|
2016-02-05 23:31:53 -08:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
namespace metaforce {
|
2016-03-18 19:04:12 -07:00
|
|
|
class CElementGen;
|
2018-12-07 21:30:43 -08:00
|
|
|
class CParticleGlobals {
|
2020-04-11 17:23:38 -07:00
|
|
|
CParticleGlobals() = default;
|
2019-12-03 00:47:05 -08:00
|
|
|
static std::unique_ptr<CParticleGlobals> g_ParticleGlobals;
|
2020-04-11 17:23:38 -07:00
|
|
|
|
2016-02-05 00:34:14 -08:00
|
|
|
public:
|
2019-12-03 00:47:05 -08:00
|
|
|
int m_EmitterTime = 0;
|
|
|
|
float m_EmitterTimeReal = 0.f;
|
|
|
|
void SetEmitterTime(int frame) {
|
|
|
|
m_EmitterTime = frame;
|
2020-04-13 15:44:47 -07:00
|
|
|
m_EmitterTimeReal = float(frame);
|
2018-12-07 21:30:43 -08:00
|
|
|
}
|
2016-02-05 00:34:14 -08:00
|
|
|
|
2019-12-03 00:47:05 -08:00
|
|
|
int m_ParticleLifetime = 0;
|
|
|
|
float m_ParticleLifetimeReal = 0.f;
|
|
|
|
void SetParticleLifetime(int frame) {
|
|
|
|
m_ParticleLifetime = frame;
|
2020-04-13 15:44:47 -07:00
|
|
|
m_ParticleLifetimeReal = float(frame);
|
2018-12-07 21:30:43 -08:00
|
|
|
}
|
2016-02-05 00:34:14 -08:00
|
|
|
|
2021-06-07 12:29:18 -07:00
|
|
|
int m_ParticleLifetimePercentage = 0;
|
|
|
|
float m_ParticleLifetimePercentageReal = 0.f;
|
|
|
|
float m_ParticleLifetimePercentageRemainder = 0.f;
|
|
|
|
void UpdateParticleLifetimeTweenValues(int frame) {
|
2020-04-13 15:44:47 -07:00
|
|
|
const float lt = m_ParticleLifetime != 0 ? float(m_ParticleLifetime) : 1.0f;
|
|
|
|
m_ParticleLifetimePercentageReal = 100.0f * float(frame) / lt;
|
2019-12-03 00:47:05 -08:00
|
|
|
m_ParticleLifetimePercentage = int(m_ParticleLifetimePercentageReal);
|
2020-04-13 15:44:47 -07:00
|
|
|
m_ParticleLifetimePercentageRemainder = m_ParticleLifetimePercentageReal - float(m_ParticleLifetimePercentage);
|
2019-12-03 00:47:05 -08:00
|
|
|
m_ParticleLifetimePercentage = zeus::clamp(0, m_ParticleLifetimePercentage, 100);
|
2018-12-07 21:30:43 -08:00
|
|
|
}
|
2016-02-05 23:31:53 -08:00
|
|
|
|
2019-12-03 00:47:05 -08:00
|
|
|
const std::array<float, 8>* m_particleAccessParameters = nullptr;
|
2016-02-05 23:31:53 -08:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
struct SParticleSystem {
|
|
|
|
FourCC x0_type;
|
|
|
|
CElementGen* x4_system;
|
|
|
|
};
|
2016-02-13 23:38:01 -08:00
|
|
|
|
2020-04-11 17:23:38 -07:00
|
|
|
SParticleSystem* m_currentParticleSystem = nullptr;
|
2019-12-03 00:47:05 -08:00
|
|
|
|
|
|
|
static CParticleGlobals* instance() {
|
|
|
|
if (!g_ParticleGlobals)
|
|
|
|
g_ParticleGlobals.reset(new CParticleGlobals());
|
|
|
|
|
|
|
|
return g_ParticleGlobals.get();
|
|
|
|
}
|
2016-02-05 00:34:14 -08:00
|
|
|
};
|
|
|
|
|
2022-03-19 10:30:25 -07:00
|
|
|
//struct SParticleInstanceTex {
|
|
|
|
// std::array<zeus::CVector4f, 4> pos;
|
|
|
|
// zeus::CColor color;
|
|
|
|
// std::array<zeus::CVector2f, 4> uvs;
|
|
|
|
//};
|
|
|
|
//extern std::vector<SParticleInstanceTex> g_instTexData;
|
|
|
|
//
|
|
|
|
//struct SParticleInstanceIndTex {
|
|
|
|
// std::array<zeus::CVector4f, 4> pos;
|
|
|
|
// zeus::CColor color;
|
|
|
|
// std::array<zeus::CVector4f, 4> texrTindUVs;
|
|
|
|
// zeus::CVector4f sceneUVs;
|
|
|
|
//};
|
|
|
|
//extern std::vector<SParticleInstanceIndTex> g_instIndTexData;
|
|
|
|
//
|
|
|
|
//struct SParticleInstanceNoTex {
|
|
|
|
// std::array<zeus::CVector4f, 4> pos;
|
|
|
|
// zeus::CColor color;
|
|
|
|
//};
|
|
|
|
//extern std::vector<SParticleInstanceNoTex> g_instNoTexData;
|
|
|
|
//
|
|
|
|
//struct SParticleUniforms {
|
|
|
|
// zeus::CMatrix4f mvp;
|
|
|
|
// zeus::CColor moduColor;
|
|
|
|
//};
|
2018-03-16 20:41:01 -07:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
} // namespace metaforce
|