2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
|
|
|
|
//#include "trop.h"
|
|
|
|
#include "tfxparam.h"
|
|
|
|
#include "perlinnoise.h"
|
|
|
|
#include "stdfx.h"
|
|
|
|
#include "tspectrumparam.h"
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class CloudsFx final : public TStandardZeraryFx {
|
2016-06-15 18:43:10 +12:00
|
|
|
FX_PLUGIN_DECLARATION(CloudsFx)
|
|
|
|
TIntEnumParamP m_type;
|
|
|
|
TDoubleParamP m_size;
|
|
|
|
TDoubleParamP m_min;
|
|
|
|
TDoubleParamP m_max;
|
|
|
|
TDoubleParamP m_evol;
|
|
|
|
TSpectrumParamP m_colors;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
CloudsFx()
|
|
|
|
: m_type(new TIntEnumParam(PNOISE_CLOUDS, "Clouds"))
|
|
|
|
, m_size(100.0)
|
|
|
|
, m_min(0.0)
|
|
|
|
, m_max(1.0)
|
|
|
|
, m_evol(0.0) {
|
|
|
|
bindParam(this, "type", m_type);
|
|
|
|
m_type->addItem(PNOISE_WOODS, "Marble/Wood");
|
|
|
|
bindParam(this, "size", m_size);
|
|
|
|
bindParam(this, "min", m_min);
|
|
|
|
bindParam(this, "max", m_max);
|
|
|
|
bindParam(this, "evolution", m_evol);
|
2018-09-06 05:07:46 +12:00
|
|
|
std::vector<TSpectrum::ColorKey> colors = {
|
2016-06-15 18:43:10 +12:00
|
|
|
TSpectrum::ColorKey(0, TPixel32::White),
|
|
|
|
TSpectrum::ColorKey(1, TPixel32::Transparent)};
|
2018-09-06 05:07:46 +12:00
|
|
|
m_colors = TSpectrumParamP(colors);
|
2016-06-15 18:43:10 +12:00
|
|
|
bindParam(this, "colors", m_colors);
|
|
|
|
m_size->setValueRange(0, 200);
|
|
|
|
m_min->setValueRange(0, 1.0);
|
|
|
|
m_max->setValueRange(0, 1.0);
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
~CloudsFx(){};
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool doGetBBox(double, TRectD &bbox, const TRenderSettings &info) override {
|
2016-06-15 18:43:10 +12:00
|
|
|
bbox = TConsts::infiniteRectD;
|
|
|
|
return true;
|
|
|
|
};
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void doCompute(TTile &tile, double frame, const TRenderSettings &ri) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
bool canHandle(const TRenderSettings &info, double frame) override {
|
|
|
|
return false;
|
|
|
|
}
|
2016-06-15 18:43:10 +12:00
|
|
|
// TAffine handledAffine(const TRenderSettings& info, double frame) {return
|
|
|
|
// TAffine();}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//==================================================================
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void CloudsFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri) {
|
2019-08-02 18:48:26 +12:00
|
|
|
double scale = sqrt(fabs(ri.m_affine.det()));
|
|
|
|
int type = m_type->getValue();
|
|
|
|
double min = m_min->getValue(frame);
|
|
|
|
double max = m_max->getValue(frame);
|
|
|
|
double evolution = m_evol->getValue(frame);
|
|
|
|
double size = m_size->getValue(frame) / ri.m_shrinkX;
|
|
|
|
size = fabs(size);
|
2016-06-15 18:43:10 +12:00
|
|
|
if (size < 0.01) size = 0.01;
|
2019-08-02 18:48:26 +12:00
|
|
|
TPointD pos = tile.m_pos;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
doClouds(tile.getRaster(), m_colors, pos, evolution, size, min, max, type,
|
|
|
|
scale, frame);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
FX_PLUGIN_IDENTIFIER(CloudsFx, "cloudsFx");
|