2020-11-14 05:34:26 +13:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/*------------
|
|
|
|
Iwa_BloomFx
|
|
|
|
Based on the LightBloom plugin fx by Dwango, with modifications as follows:
|
|
|
|
- parameters are reduced & simplified to gamma, gain and size
|
|
|
|
- reduced the block noise appeared especially when the gamma is with higher
|
|
|
|
value
|
|
|
|
- enabled to render alpha gradation
|
|
|
|
- enabled to adjust size with the viewer gadget
|
|
|
|
--------------*/
|
|
|
|
|
|
|
|
#ifndef IWA_BLOOMFX_H
|
|
|
|
#define IWA_BLOOMFX_H
|
|
|
|
|
|
|
|
#include "stdfx.h"
|
|
|
|
#include "tfxparam.h"
|
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
|
|
|
|
class Iwa_BloomFx : public TStandardRasterFx {
|
|
|
|
FX_PLUGIN_DECLARATION(Iwa_BloomFx)
|
2021-04-06 15:19:44 +12:00
|
|
|
|
|
|
|
enum AlphaMode { NoAlpha = 0, Light, LightAndSource };
|
|
|
|
|
2020-11-14 05:34:26 +13:00
|
|
|
protected:
|
|
|
|
TRasterFxPort m_source;
|
|
|
|
TDoubleParamP m_gamma;
|
2021-04-06 15:19:44 +12:00
|
|
|
TBoolParamP m_auto_gain;
|
|
|
|
TDoubleParamP m_gain_adjust;
|
2020-11-14 05:34:26 +13:00
|
|
|
TDoubleParamP m_gain;
|
2021-04-06 15:19:44 +12:00
|
|
|
TDoubleParamP m_decay;
|
2020-11-14 05:34:26 +13:00
|
|
|
TDoubleParamP m_size;
|
2021-04-06 15:19:44 +12:00
|
|
|
|
|
|
|
TIntEnumParamP m_alpha_mode; // no alpha / light / light and source
|
|
|
|
TBoolParamP m_alpha_rendering; // obsolete
|
2020-11-14 05:34:26 +13:00
|
|
|
|
|
|
|
double getSizePixelAmount(const double val, const TAffine affine);
|
|
|
|
template <typename RASTER, typename PIXEL>
|
2021-04-06 15:19:44 +12:00
|
|
|
void setSourceTileToMat(const RASTER ras, cv::Mat &imgMat,
|
2020-11-14 05:34:26 +13:00
|
|
|
const double gamma);
|
|
|
|
|
|
|
|
template <typename RASTER, typename PIXEL>
|
2021-04-06 15:19:44 +12:00
|
|
|
void setMatToOutput(const RASTER ras, const RASTER srcRas, cv::Mat &imgMat,
|
2020-11-14 05:34:26 +13:00
|
|
|
const double gamma, const double gain,
|
2021-04-06 15:19:44 +12:00
|
|
|
const AlphaMode alphaMode, const int margin);
|
|
|
|
|
|
|
|
double computeAutoGain(cv::Mat &imgMat);
|
2020-11-14 05:34:26 +13:00
|
|
|
|
|
|
|
public:
|
|
|
|
Iwa_BloomFx();
|
|
|
|
void doCompute(TTile &tile, double frame,
|
|
|
|
const TRenderSettings &settings) override;
|
|
|
|
bool doGetBBox(double frame, TRectD &bBox,
|
|
|
|
const TRenderSettings &info) override;
|
|
|
|
bool canHandle(const TRenderSettings &info, double frame) override;
|
|
|
|
void getParamUIs(TParamUIConcept *&concepts, int &length) override;
|
2021-04-06 15:19:44 +12:00
|
|
|
void onObsoleteParamLoaded(const std::string ¶mName) override;
|
2020-11-14 05:34:26 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|