|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef PARTICLES_H
|
|
Toshihiro Shimizu |
890ddd |
#define PARTICLES_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tsmartpointer.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tspectrum.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trandom.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
9ae30f |
const int Ctrl_64_Offset = 1000;
|
|
shun-iwasawa |
9ae30f |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
struct particles_values {
|
|
Shinya Kitaoka |
120a6e |
int source_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
int bright_thres_val;
|
|
Shinya Kitaoka |
120a6e |
bool multi_source_val;
|
|
Shinya Kitaoka |
120a6e |
double x_pos_val;
|
|
Shinya Kitaoka |
120a6e |
double y_pos_val;
|
|
Shinya Kitaoka |
120a6e |
int unit_val;
|
|
Shinya Kitaoka |
120a6e |
double length_val;
|
|
Shinya Kitaoka |
120a6e |
double height_val;
|
|
Shinya Kitaoka |
120a6e |
double maxnum_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair lifetime_val;
|
|
Shinya Kitaoka |
120a6e |
int lifetime_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
int column_lifetime_val;
|
|
Shinya Kitaoka |
120a6e |
// double lifetimemin_val;
|
|
Shinya Kitaoka |
120a6e |
// double lifetimemax_val;
|
|
Shinya Kitaoka |
120a6e |
int startpos_val;
|
|
Shinya Kitaoka |
120a6e |
int randseed_val;
|
|
Shinya Kitaoka |
120a6e |
double gravity_val;
|
|
Shinya Kitaoka |
120a6e |
double g_angle_val;
|
|
Shinya Kitaoka |
120a6e |
int gravity_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
// int gravity_radius_val;
|
|
Shinya Kitaoka |
120a6e |
double friction_val;
|
|
Shinya Kitaoka |
120a6e |
int friction_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
double windint_val;
|
|
Shinya Kitaoka |
120a6e |
double windangle_val;
|
|
Shinya Kitaoka |
120a6e |
int swingmode_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair randomx_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair randomy_val;
|
|
Shinya Kitaoka |
120a6e |
int randomx_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
int randomy_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair swing_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair speed_val;
|
|
Shinya Kitaoka |
120a6e |
int speed_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair speeda_val;
|
|
Shinya Kitaoka |
120a6e |
int speeda_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
bool speeda_use_gradient_val;
|
|
Shinya Kitaoka |
120a6e |
bool speedscale_val;
|
|
Shinya Kitaoka |
120a6e |
char *levelname_val;
|
|
Shinya Kitaoka |
120a6e |
int toplayer_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair mass_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair scale_val;
|
|
Shinya Kitaoka |
120a6e |
int scale_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
bool scale_ctrl_all_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair rot_val;
|
|
Shinya Kitaoka |
120a6e |
int rot_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair trail_val;
|
|
Shinya Kitaoka |
120a6e |
double trailstep_val;
|
|
Shinya Kitaoka |
120a6e |
int rotswingmode_val;
|
|
Shinya Kitaoka |
120a6e |
double rotspeed_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair rotsca_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair rotswing_val;
|
|
Shinya Kitaoka |
120a6e |
bool pathaim_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair opacity_val;
|
|
Shinya Kitaoka |
120a6e |
int opacity_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair trailopacity_val;
|
|
Shinya Kitaoka |
120a6e |
double mblur_val;
|
|
Shinya Kitaoka |
120a6e |
DoublePair scalestep_val;
|
|
Shinya Kitaoka |
120a6e |
int scalestep_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
double fadein_val;
|
|
Shinya Kitaoka |
120a6e |
double fadeout_val;
|
|
Shinya Kitaoka |
120a6e |
int animation_val;
|
|
Shinya Kitaoka |
120a6e |
int step_val;
|
|
Shinya Kitaoka |
120a6e |
TSpectrum gencol_val;
|
|
Shinya Kitaoka |
120a6e |
int gencol_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
double gencol_spread_val;
|
|
Shinya Kitaoka |
120a6e |
double genfadecol_val;
|
|
Shinya Kitaoka |
120a6e |
TSpectrum fincol_val;
|
|
Shinya Kitaoka |
120a6e |
int fincol_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
double fincol_spread_val;
|
|
Shinya Kitaoka |
120a6e |
double finrangecol_val;
|
|
Shinya Kitaoka |
120a6e |
double finfadecol_val;
|
|
Shinya Kitaoka |
120a6e |
TSpectrum foutcol_val;
|
|
Shinya Kitaoka |
120a6e |
int foutcol_ctrl_val;
|
|
Shinya Kitaoka |
120a6e |
double foutcol_spread_val;
|
|
Shinya Kitaoka |
120a6e |
double foutrangecol_val;
|
|
Shinya Kitaoka |
120a6e |
double foutfadecol_val;
|
|
Shinya Kitaoka |
120a6e |
TRandom *random_val;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
bool source_gradation_val;
|
|
Shinya Kitaoka |
120a6e |
bool reset_random_for_every_frame_val;
|
|
Shinya Kitaoka |
120a6e |
bool pick_color_for_every_frame_val;
|
|
Shinya Kitaoka |
120a6e |
bool perspective_distribution_val;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
struct particles_ranges {
|
|
Shinya Kitaoka |
120a6e |
float swing_range;
|
|
Shinya Kitaoka |
120a6e |
float randomx_range;
|
|
Shinya Kitaoka |
120a6e |
float randomy_range;
|
|
Shinya Kitaoka |
120a6e |
float rot_range;
|
|
Shinya Kitaoka |
120a6e |
float rotswing_range;
|
|
Shinya Kitaoka |
120a6e |
float rotsca_range;
|
|
Shinya Kitaoka |
120a6e |
float lifetime_range;
|
|
Shinya Kitaoka |
120a6e |
float speed_range;
|
|
Shinya Kitaoka |
120a6e |
float speeda_range;
|
|
Shinya Kitaoka |
120a6e |
float mass_range;
|
|
Shinya Kitaoka |
120a6e |
float scale_range;
|
|
Shinya Kitaoka |
120a6e |
float scalestep_range;
|
|
Shinya Kitaoka |
120a6e |
int trail_range;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
struct pos_dummy {
|
|
Shinya Kitaoka |
120a6e |
float x, y, a;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
typedef struct {
|
|
Shinya Kitaoka |
120a6e |
TPixel32 col;
|
|
Shinya Kitaoka |
120a6e |
int rangecol;
|
|
Shinya Kitaoka |
120a6e |
double fadecol;
|
|
Toshihiro Shimizu |
890ddd |
} coldata;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class Particle {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
double x;
|
|
Shinya Kitaoka |
120a6e |
double y;
|
|
Shinya Kitaoka |
120a6e |
double oldx;
|
|
Shinya Kitaoka |
120a6e |
double oldy;
|
|
Shinya Kitaoka |
120a6e |
double vx; /*sono le velox iniziali*/
|
|
Shinya Kitaoka |
120a6e |
double vy; /*sono le velox iniziali*/
|
|
Shinya Kitaoka |
120a6e |
double mass;
|
|
Shinya Kitaoka |
120a6e |
double scale; /*potrebbe diventare la z*/
|
|
Shinya Kitaoka |
120a6e |
double angle;
|
|
Shinya Kitaoka |
120a6e |
double smswingx;
|
|
Shinya Kitaoka |
120a6e |
double smswingy;
|
|
Shinya Kitaoka |
120a6e |
double smswinga;
|
|
Shinya Kitaoka |
120a6e |
int smperiodx;
|
|
Shinya Kitaoka |
120a6e |
int smperiody;
|
|
Shinya Kitaoka |
120a6e |
int smperioda;
|
|
Shinya Kitaoka |
120a6e |
int lifetime;
|
|
Shinya Kitaoka |
120a6e |
int genlifetime;
|
|
Shinya Kitaoka |
120a6e |
int level;
|
|
Shinya Kitaoka |
120a6e |
int frame;
|
|
Shinya Kitaoka |
120a6e |
int signx;
|
|
Shinya Kitaoka |
120a6e |
int trail;
|
|
Shinya Kitaoka |
120a6e |
coldata gencol;
|
|
Shinya Kitaoka |
120a6e |
coldata fincol;
|
|
Shinya Kitaoka |
120a6e |
coldata foutcol;
|
|
Shinya Kitaoka |
120a6e |
int changesignx;
|
|
Shinya Kitaoka |
120a6e |
int signy;
|
|
Shinya Kitaoka |
120a6e |
int changesigny;
|
|
Shinya Kitaoka |
120a6e |
int signa;
|
|
Shinya Kitaoka |
120a6e |
int changesigna;
|
|
Shinya Kitaoka |
120a6e |
bool animswing;
|
|
Shinya Kitaoka |
120a6e |
TRandom random;
|
|
Shinya Kitaoka |
120a6e |
int seed;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
Particle(int lifetime, int seed, const std::map<int, *="" ttile=""> porttiles,</int,>
|
|
Shinya Kitaoka |
120a6e |
const particles_values &values, const particles_ranges &ranges,
|
|
Shinya Kitaoka |
120a6e |
std::vector<std::vector<tpointd>> &myregions, int howmany, int first,</std::vector<tpointd>
|
|
Shinya Kitaoka |
120a6e |
int level, int last, std::vector<std::vector<int>> &myHistogram,</std::vector<int>
|
|
Shinya Kitaoka |
120a6e |
std::vector<float> &myWeight);</float>
|
|
Shinya Kitaoka |
120a6e |
// Constructor
|
|
Shinya Kitaoka |
120a6e |
~Particle() {}
|
|
Shinya Kitaoka |
120a6e |
// Destructor
|
|
Shinya Kitaoka |
120a6e |
void create_Animation(const particles_values &values, int first, int last);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int check_Swing(const particles_values &values);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void create_Swing(const particles_values &values,
|
|
Shinya Kitaoka |
120a6e |
const particles_ranges &ranges, double randomxreference,
|
|
Shinya Kitaoka |
120a6e |
double randomyreference);
|
|
Shinya Kitaoka |
120a6e |
void create_Colors(const particles_values &values,
|
|
Shinya Kitaoka |
120a6e |
const particles_ranges &ranges,
|
|
Shinya Kitaoka |
120a6e |
std::map<int, *="" ttile=""> porttiles);</int,>
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void move(const std::map<int, *="" ttile=""> porttiles,</int,>
|
|
Shinya Kitaoka |
120a6e |
const particles_values &values, const particles_ranges &ranges,
|
|
Shinya Kitaoka |
120a6e |
float windx, float windy, float xgravity, float ygravity, float dpi,
|
|
Shinya Kitaoka |
120a6e |
int lastframe);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void spread_color(TPixel32 &color, double range);
|
|
Shinya Kitaoka |
120a6e |
void update_Animation(const particles_values &values, int first, int last,
|
|
Shinya Kitaoka |
120a6e |
int keep);
|
|
Shinya Kitaoka |
120a6e |
void update_Swing(const particles_values &values,
|
|
Shinya Kitaoka |
120a6e |
const particles_ranges &ranges, struct pos_dummy &dummy,
|
|
Shinya Kitaoka |
120a6e |
double randomxreference, double randomyreference);
|
|
Shinya Kitaoka |
120a6e |
void update_Scale(const particles_values &values,
|
|
Shinya Kitaoka |
120a6e |
const particles_ranges &ranges, double scalereference,
|
|
Shinya Kitaoka |
120a6e |
double scalestepreference);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
double set_Opacity(std::map<int, *="" ttile=""> porttiles,</int,>
|
|
Shinya Kitaoka |
120a6e |
const particles_values &values, float opacity_range,
|
|
Shinya Kitaoka |
120a6e |
double dist_frame);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void modify_colors(TPixel32 &color, double &intensity);
|
|
Shinya Kitaoka |
120a6e |
void modify_colors_and_opacity(const particles_values &values,
|
|
Shinya Kitaoka |
120a6e |
float curr_opacity, int dist_frame,
|
|
Shinya Kitaoka |
120a6e |
TRaster32P raster);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
bool canHandle(const TRenderSettings &info, double frame) { return false; }
|
|
Shinya Kitaoka |
120a6e |
void get_image_reference(TTile *ctrl1, const particles_values &values,
|
|
Shinya Kitaoka |
120a6e |
double &imagereference, int type);
|
|
Shinya Kitaoka |
120a6e |
void get_image_reference(TTile *ctrl1, const particles_values &values,
|
|
Shinya Kitaoka |
120a6e |
TPixel32 &color);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void get_image_gravity(TTile *ctrl1, const particles_values &values,
|
|
Shinya Kitaoka |
120a6e |
float &gx, float &gy);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class ComparebySize {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
bool operator()(const Particle &f1, const Particle &f2) {
|
|
Shinya Kitaoka |
120a6e |
if ((f1.scale - f2.scale) > 0) return 1;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
return 0;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class ComparebyLifetime {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
bool operator()(const Particle &f1, const Particle &f2) {
|
|
Shinya Kitaoka |
120a6e |
if ((f1.lifetime - f1.genlifetime - f2.lifetime + f2.genlifetime) > 0)
|
|
Shinya Kitaoka |
120a6e |
return 1;
|
|
Shinya Kitaoka |
120a6e |
return 0;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|