metaforce/Runtime/Particle/CParticleDataFactory.hpp

106 lines
3.6 KiB
C++
Raw Normal View History

2016-04-13 06:07:23 +00:00
#ifndef __URDE_CPARTICLEDATAFACTORY_HPP__
#define __URDE_CPARTICLEDATAFACTORY_HPP__
#include "RetroTypes.hpp"
2016-03-31 00:38:03 +00:00
#include "CFactoryMgr.hpp"
#include "IObj.hpp"
#include "CToken.hpp"
#include "IOStreams.hpp"
2016-03-04 23:04:53 +00:00
namespace urde
{
class CGenDescription;
class CSwooshDescription;
class CElectricDescription;
class CSimplePool;
class CVParamTransfer;
class CModel;
class CUVElement;
class CColorElement;
class CModVectorElement;
class CEmitterElement;
class CVectorElement;
class CRealElement;
class CIntElement;
struct SParticleModel
{
TLockedToken<CModel> m_token;
bool m_found = false;
CModel* m_model = nullptr;
2016-02-17 03:42:27 +00:00
SParticleModel() = default;
SParticleModel(CToken&& tok, bool found)
: m_token(std::move(tok)), m_found(found) {}
};
struct SChildGeneratorDesc
{
TLockedToken<CGenDescription> m_token;
bool m_found = false;
CGenDescription* m_gen = nullptr;
2016-02-17 03:42:27 +00:00
SChildGeneratorDesc() = default;
SChildGeneratorDesc(CToken&& tok, bool found)
: m_token(std::move(tok)), m_found(found) {}
};
struct SSwooshGeneratorDesc
{
TLockedToken<CSwooshDescription> m_token;
bool m_found = false;
CSwooshDescription* m_swoosh = nullptr;
2016-02-17 03:42:27 +00:00
SSwooshGeneratorDesc() = default;
SSwooshGeneratorDesc(CToken&& tok, bool found)
: m_token(std::move(tok)), m_found(found) {}
};
struct SElectricGeneratorDesc
{
TLockedToken<CElectricDescription> m_token;
bool m_found = false;
CElectricDescription* m_electric = nullptr;
2016-02-17 03:42:27 +00:00
SElectricGeneratorDesc() = default;
SElectricGeneratorDesc(CToken&& tok, bool found)
: m_token(std::move(tok)), m_found(found) {}
};
class CParticleDataFactory
{
2016-02-10 22:54:47 +00:00
friend class CDecalDataFactory;
2016-02-16 07:01:55 +00:00
friend class CCollisionResponseData;
2016-02-10 22:54:47 +00:00
friend class CParticleElectricDataFactory;
friend class CParticleSwooshDataFactory;
friend class CProjectileWeaponDataFactory;
2016-02-10 22:54:47 +00:00
static SParticleModel GetModel(CInputStream& in, CSimplePool* resPool);
2016-04-14 21:42:47 +00:00
static SChildGeneratorDesc GetChildGeneratorDesc(ResId res, CSimplePool* resPool, const std::vector<ResId>& tracker);
static SChildGeneratorDesc GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, const std::vector<ResId>& tracker);
static SSwooshGeneratorDesc GetSwooshGeneratorDesc(CInputStream& in, CSimplePool* resPool);
static SElectricGeneratorDesc GetElectricGeneratorDesc(CInputStream& in, CSimplePool* resPool);
static CUVElement* GetTextureElement(CInputStream& in, CSimplePool* resPool);
static CColorElement* GetColorElement(CInputStream& in);
static CModVectorElement* GetModVectorElement(CInputStream& in);
static CEmitterElement* GetEmitterElement(CInputStream& in);
static CVectorElement* GetVectorElement(CInputStream& in);
static CRealElement* GetRealElement(CInputStream& in);
static CIntElement* GetIntElement(CInputStream& in);
static float GetReal(CInputStream& in);
static int32_t GetInt(CInputStream& in);
static bool GetBool(CInputStream& in);
static FourCC GetClassID(CInputStream& in);
2016-04-14 21:42:47 +00:00
static CGenDescription* CreateGeneratorDescription(CInputStream& in, std::vector<ResId>& tracker,
ResId resId, CSimplePool* resPool);
static bool CreateGPSM(CGenDescription* fillDesc, CInputStream& in,
2016-04-14 21:42:47 +00:00
std::vector<ResId>& tracker, CSimplePool* resPool);
static void LoadGPSMTokens(CGenDescription* desc);
public:
static CGenDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* resPool);
};
CFactoryFnReturn FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
CObjectReference* selfRef);
}
2016-04-13 06:07:23 +00:00
#endif // __URDE_CPARTICLEDATAFACTORY_HPP__