metaforce/Runtime/Particle/CParticleGlobals.hpp

89 lines
2.2 KiB
C++
Raw Normal View History

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