tahoma2d/toonz/sources/stdfx/iwa_particlesmanager.h

82 lines
1.6 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
//------------------------------------------------------------------
// Iwa_ParticlesManager for Marnie
// based on ParticlesManager by Digital Video
//------------------------------------------------------------------
#ifndef IWA_PARTICLES_CONTAINER
#define IWA_PARTICLES_CONTAINER
#include "tsmartpointer.h"
#include "trenderresourcemanager.h"
#include "trandom.h"
#include "iwa_particles.h"
#include <QThreadStorage>
#include <QMutex>
//-----------------------------------------------------------------------
// Forward declarations
class Iwa_Particle;
class TRandom;
#include "iwa_particlesengine.h"
//-----------------------------------------------------------------------
class Iwa_ParticlesManager final : public TRenderResourceManager {
2016-06-15 18:43:10 +12:00
T_RENDER_RESOURCE_MANAGER
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
struct FxData;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
struct FrameData {
FxData *m_fxData;
double m_frame;
TRandom m_random;
std::list<Iwa_Particle> m_particles;
bool m_calculated;
int m_maxTrail;
int m_totalParticles;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
/*- しきつめ情報 -*/
QList<ParticleOrigin> m_particleOrigins;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
FrameData(FxData *fxData);
~FrameData();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void buildMaxTrail();
void clear();
};
2016-03-19 06:57:51 +13:00
struct FxData final : public TSmartObject {
2016-06-15 18:43:10 +12:00
DECLARE_CLASS_CODE
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
QThreadStorage<FrameData *> m_frames;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
FxData();
};
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
Iwa_ParticlesManager();
~Iwa_ParticlesManager();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
static Iwa_ParticlesManager *instance();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
FrameData *data(unsigned long fxId);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
bool isCached(unsigned long fxId);
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
std::map<unsigned long, FxData *> m_fxs;
QMutex m_mutex;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
int m_renderStatus;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void onRenderStatusStart(int renderStatus) override;
2016-03-19 06:57:51 +13:00
};
#endif