Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef PARTICLESENGINE_H
Toshihiro Shimizu 890ddd
#define PARTICLESENGINE_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tlevel.h"
Toshihiro Shimizu 890ddd
#include "particles.h"
Toshihiro Shimizu 890ddd
#include "particlesfx.h"
Toshihiro Shimizu 890ddd
shun-iwasawa 589b0d
struct float4 {
shun-iwasawa 589b0d
  float x, y, z, w;
shun-iwasawa 589b0d
};
Toshihiro Shimizu 890ddd
class Particle;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class Particles_Engine {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ParticlesFx *m_parent;
Shinya Kitaoka 120a6e
  double m_frame;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  Particles_Engine(ParticlesFx *parent, double frame);
Shinya Kitaoka 120a6e
  ~Particles_Engine(){};
Shinya Kitaoka 120a6e
  // Destructor
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void scramble_particles(void);
Shinya Kitaoka 120a6e
  void fill_range_struct(struct particles_values &values,
Shinya Kitaoka 120a6e
                         struct particles_ranges &ranges);
Shinya Kitaoka 120a6e
  void fill_value_struct(struct particles_values &value, double frame);
Shinya Kitaoka 120a6e
  void roll_particles(TTile *tile, std::map<int, *="" ttile=""> porttiles,</int,>
Shinya Kitaoka 120a6e
                      const TRenderSettings &ri,
Shinya Kitaoka 120a6e
                      std::list<particle> &myParticles,</particle>
Shinya Kitaoka 120a6e
                      struct particles_values &values, float cx, float cy,
Shinya Kitaoka 120a6e
                      int frame, int curr_frame, int level_n,
Shinya Kitaoka 120a6e
                      bool *random_level, float dpi, std::vector<int> lastframe,</int>
Shinya Kitaoka 120a6e
                      int &totalparticles);
Shinya Kitaoka 120a6e
  void normalize_values(struct particles_values &values,
Shinya Kitaoka 120a6e
                        const TRenderSettings &ri);
Shinya Kitaoka 120a6e
Jeremy Bullock 852210
  void render_particles(TTile *tile, std::vector<trasterfxport *=""> part_ports,</trasterfxport>
Jeremy Bullock 852210
                        const TRenderSettings &ri, TDimension &p_size,
Jeremy Bullock 852210
                        TPointD &p_offset,
Jeremy Bullock 852210
                        std::map<int, *="" trasterfxport=""> ctrl_ports,</int,>
Jeremy Bullock 852210
                        std::vector<tlevelp> partLevel, float dpi,</tlevelp>
Jeremy Bullock 852210
                        int curr_frame, int shrink, double startx,
Jeremy Bullock 852210
                        double starty, double endx, double endy,
Jeremy Bullock 852210
                        std::vector<int> lastframe, unsigned long fxId);</int>
Shinya Kitaoka 120a6e
Jeremy Bullock 175c6b
  void do_render(Particle *part, TTile *tile,
Shinya Kitaoka 120a6e
                 std::vector<trasterfxport *=""> part_ports,</trasterfxport>
Shinya Kitaoka 120a6e
                 std::map<int, *="" ttile=""> porttiles, const TRenderSettings &ri,</int,>
Shinya Kitaoka 120a6e
                 TDimension &p_size, TPointD &p_offset, int lastframe,
Shinya Kitaoka 120a6e
                 std::vector<tlevelp> partLevel,</tlevelp>
Shinya Kitaoka 120a6e
                 struct particles_values &values, double opacity_range,
Shinya Kitaoka 120a6e
                 int curr_frame,
Shinya Kitaoka 120a6e
                 std::map<std::pair<int, int="">, double> &partScales);</std::pair<int,>
Shinya Kitaoka 120a6e
shun-iwasawa 589b0d
  bool do_render_motion_blur(Particle *part, TTile *tile, TRasterP tileRas,
shun-iwasawa 589b0d
                             TRaster32P rfinalpart, TAffine &M,
shun-iwasawa 589b0d
                             const TRectD &bbox, const DoublePair &trailOpacity,
shun-iwasawa 589b0d
                             const double gamma, const TRenderSettings &ri);
shun-iwasawa 589b0d
Shinya Kitaoka 120a6e
  bool port_is_used(int i, struct particles_values &values);
shun-iwasawa 9ae30f
  bool port_is_used_for_value(int i, struct particles_values &values);
shun-iwasawa 9ae30f
  bool port_is_used_for_gradient(int i, struct particles_values &values);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*-
Shinya Kitaoka 120a6e
     do_source_gradationがONのとき、入力画像のアルファ値に比例して発生濃度を変える。
Shinya Kitaoka 120a6e
          入力画像のHistogramを格納しながら領域を登録する -*/
Shinya Kitaoka 120a6e
  void fill_regions(int frame, std::vector<std::vector<tpointd>> &myregions,</std::vector<tpointd>
Shinya Kitaoka 120a6e
                    TTile *ctrl1, bool multi, int thres,
Shinya Kitaoka 120a6e
                    bool do_source_gradation,
Shinya Kitaoka 120a6e
                    std::vector<std::vector<int>> &myHistogram);</std::vector<int>
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void fill_single_region(std::vector<std::vector<tpointd>> &myregions,</std::vector<tpointd>
Shinya Kitaoka 120a6e
                          TTile *ctrl1, int thres, bool do_source_gradation,
Shinya Kitaoka 120a6e
                          std::vector<std::vector<int>> &myHistogram);</std::vector<int>
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*-- Perspective
Shinya Kitaoka 120a6e
     DistributionがONのとき、Sizeに刺さったControlImageが粒子の発生分布を決める。
Shinya Kitaoka 120a6e
          そのとき、SourceのControlが刺さっている場合は、マスクとして用いられる
Shinya Kitaoka 120a6e
     --*/
Shinya Kitaoka 120a6e
  void fill_regions_with_size_map(std::vector<std::vector<tpointd>> &myregions,</std::vector<tpointd>
Shinya Kitaoka 120a6e
                                  std::vector<std::vector<int>> &myHistogram,</std::vector<int>
Shinya Kitaoka 120a6e
                                  TTile *sizeTile, TTile *sourceTile,
Shinya Kitaoka 120a6e
                                  int thres);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void fill_subregions(int cont_index,
Shinya Kitaoka 120a6e
                       std::vector<std::vector<tpointd>> &myregions,</std::vector<tpointd>
Shinya Kitaoka 120a6e
                       TTile *ctrl1, int thres);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void normalize_array(std::vector<std::vector<tpointd>> &myregions,</std::vector<tpointd>
Shinya Kitaoka 120a6e
                       TPointD pos, int lx, int ly, int regioncounter,
Shinya Kitaoka 120a6e
                       std::vector<int> &myarray, std::vector<int> &lista,</int></int>
shun-iwasawa 9ae30f
                       std::vector<int> &listb, std::vector<int> &final);</int></int>
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void fill_array(TTile *ctrl1, int ®ioncount, std::vector<int> &myarray,</int>
Shinya Kitaoka 120a6e
                  std::vector<int> &lista, std::vector<int> &listb, int thres);</int></int>
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif