metaforce/Runtime/Particle/CParticleGlobals.hpp

79 lines
2.0 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-02-05 08:34:14 +00:00
2017-06-04 01:01:09 +00:00
#include <array>
#include <vector>
#include "Runtime/RetroTypes.hpp"
#include <zeus/CColor.hpp>
#include <zeus/CMatrix4f.hpp>
#include <zeus/CVector3f.hpp>
#include <zeus/CVector4f.hpp>
2016-02-06 07:31:53 +00:00
2018-12-08 05:30:43 +00:00
namespace urde {
class CElementGen;
2018-12-08 05:30:43 +00:00
class CParticleGlobals {
2016-02-05 08:34:14 +00:00
public:
2018-12-08 05:30:43 +00:00
static int g_EmitterTime;
static float g_EmitterTimeReal;
static void SetEmitterTime(int frame) {
g_EmitterTime = frame;
g_EmitterTimeReal = frame;
}
2016-02-05 08:34:14 +00:00
2018-12-08 05:30:43 +00:00
static int g_ParticleLifetime;
static float g_ParticleLifetimeReal;
static void SetParticleLifetime(int frame) {
g_ParticleLifetime = frame;
g_ParticleLifetimeReal = frame;
}
2016-02-05 08:34:14 +00:00
2018-12-08 05:30:43 +00:00
static int g_ParticleLifetimePercentage;
static float g_ParticleLifetimePercentageReal;
static float g_ParticleLifetimePercentageRemainder;
static void UpdateParticleLifetimeTweenValues(int frame) {
float lt = g_ParticleLifetime != 0.0f ? g_ParticleLifetime : 1.0f;
g_ParticleLifetimePercentageReal = 100.0f * frame / lt;
g_ParticleLifetimePercentage = int(g_ParticleLifetimePercentageReal);
g_ParticleLifetimePercentageRemainder = g_ParticleLifetimePercentageReal - g_ParticleLifetimePercentage;
g_ParticleLifetimePercentage = zeus::clamp(0, g_ParticleLifetimePercentage, 100);
}
2016-02-06 07:31:53 +00:00
2018-12-08 05:30:43 +00:00
static const std::array<float, 8>* g_particleAccessParameters;
2016-02-06 07:31:53 +00:00
2018-12-08 05:30:43 +00:00
struct SParticleSystem {
FourCC x0_type;
CElementGen* x4_system;
};
2016-02-14 07:38:01 +00:00
2018-12-08 05:30:43 +00:00
static SParticleSystem* g_currentParticleSystem;
2016-02-05 08:34:14 +00:00
};
2018-12-08 05:30:43 +00:00
struct SParticleInstanceTex {
zeus::CVector4f pos[4];
zeus::CColor color;
zeus::CVector2f uvs[4];
2018-03-17 03:41:01 +00:00
};
extern std::vector<SParticleInstanceTex> g_instTexData;
2018-12-08 05:30:43 +00:00
struct SParticleInstanceIndTex {
zeus::CVector4f pos[4];
zeus::CColor color;
zeus::CVector4f texrTindUVs[4];
zeus::CVector4f sceneUVs;
2018-03-17 03:41:01 +00:00
};
extern std::vector<SParticleInstanceIndTex> g_instIndTexData;
2018-12-08 05:30:43 +00:00
struct SParticleInstanceNoTex {
zeus::CVector4f pos[4];
zeus::CColor color;
2018-03-17 03:41:01 +00:00
};
extern std::vector<SParticleInstanceNoTex> g_instNoTexData;
2018-12-08 05:30:43 +00:00
struct SParticleUniforms {
zeus::CMatrix4f mvp;
zeus::CColor moduColor;
2018-03-17 03:41:01 +00:00
};
2018-12-08 05:30:43 +00:00
} // namespace urde