Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef PARTICLES_CONTAINER
Toshihiro Shimizu 890ddd
#define PARTICLES_CONTAINER
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tsmartpointer.h"
Toshihiro Shimizu 890ddd
#include "trenderresourcemanager.h"
Toshihiro Shimizu 890ddd
#include "trandom.h"
Toshihiro Shimizu 890ddd
#include "particles.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <qthreadstorage></qthreadstorage>
Toshihiro Shimizu 890ddd
#include <qmutex></qmutex>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//  Forward declarations
Toshihiro Shimizu 890ddd
class Particle;
Toshihiro Shimizu 890ddd
class TRandom;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class ParticlesManager final : public TRenderResourceManager {
Shinya Kitaoka 120a6e
  T_RENDER_RESOURCE_MANAGER
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  struct FxData;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  struct FrameData {
Shinya Kitaoka 120a6e
    FxData *m_fxData;
Shinya Kitaoka 120a6e
    double m_frame;
Shinya Kitaoka 120a6e
    TRandom m_random;
Shinya Kitaoka 120a6e
    std::list<particle> m_particles;</particle>
Shinya Kitaoka 120a6e
    bool m_calculated;
Shinya Kitaoka 120a6e
    int m_maxTrail;
Shinya Kitaoka 120a6e
    int m_totalParticles;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    FrameData(FxData *fxData);
Shinya Kitaoka 120a6e
    ~FrameData();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    void buildMaxTrail();
Shinya Kitaoka 120a6e
    void clear();
Shinya Kitaoka 120a6e
  };
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
  struct FxData final : public TSmartObject {
Shinya Kitaoka 120a6e
    DECLARE_CLASS_CODE
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    QThreadStorage<framedata *=""> m_frames;</framedata>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    FxData();
Shinya Kitaoka 120a6e
  };
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ParticlesManager();
Shinya Kitaoka 120a6e
  ~ParticlesManager();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  static ParticlesManager *instance();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  FrameData *data(unsigned long fxId);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  std::map<unsigned *="" fxdata="" long,=""> m_fxs;</unsigned>
Shinya Kitaoka 120a6e
  QMutex m_mutex;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_renderStatus;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void onRenderStatusStart(int renderStatus) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif