tahoma2d/toonz/sources/stdfx/iwa_glarefx.h
artisteacher d8e36aaf45
Fix override warnings (#164)
There are 100+ warnings due to ______ overriding a member function without being marked override. This adds override in those cases to silence the warnings.
2020-09-15 15:49:57 -06:00

101 lines
2.9 KiB
C++

#pragma once
/*------------------------------------
Iwa_GlareFx
------------------------------------*/
#ifndef IWA_GLAREFX_H
#define IWA_GLAREFX_H
#include "stdfx.h"
#include "tfxparam.h"
#include "traster.h"
#include "tparamset.h"
#include <QList>
#include <QThread>
#include "tools/kiss_fftnd.h"
const int LAYER_NUM = 5;
struct double2 {
double x, y;
};
struct int2 {
int x, y;
};
struct double3 {
double x, y, z;
};
class Iwa_GlareFx : public TStandardRasterFx {
FX_PLUGIN_DECLARATION(Iwa_GlareFx)
protected:
TRasterFxPort m_source;
TRasterFxPort m_iris;
// rendering mode (filter preview / render)
TIntEnumParamP m_renderMode;
TDoubleParamP m_intensity;
TDoubleParamP m_size;
TDoubleParamP m_rotation;
TDoubleParamP m_noise_factor;
TDoubleParamP m_noise_size;
TIntEnumParamP m_noise_octave;
TDoubleParamP m_noise_evolution;
TPointParamP m_noise_offset;
enum { RendeMode_FilterPreview = 0, RendeMode_Render };
double getSizePixelAmount(const double val, const TAffine affine);
// Resize / flip the iris image according to the size ratio.
// Normalize the brightness of the iris image.
// Enlarge the iris to the output size.
void convertIris(kiss_fft_cpx *kissfft_comp_iris_before, const int &dimIris,
const TRectD &irisBBox, const TTile &irisTile);
void powerSpectrum2GlarePattern(const double frame, const TAffine affine,
kiss_fft_cpx *spectrum, double3 *glare,
int dimIris, double intensity,
double irisResizeFactor);
void distortGlarePattern(const double frame, const TAffine affine,
double *glare, const int dimIris);
// filter preview mode
template <typename RASTER, typename PIXEL>
void setFilterPreviewToResult(const RASTER ras, double3 *glare, int dimIris,
int2 margin);
// put the source tile's brightness to fft buffer
template <typename RASTER, typename PIXEL>
void setSourceTileToBuffer(const RASTER ras, kiss_fft_cpx *buf);
void setGlarePatternToBuffer(const double3 *glare, kiss_fft_cpx *buf,
const int channel, const int dimIris,
const TDimensionI &dimOut);
void multiplyFilter(kiss_fft_cpx *glare, const kiss_fft_cpx *source,
const int count);
template <typename RASTER, typename PIXEL>
void setChannelToResult(const RASTER ras, kiss_fft_cpx *buf, int channel,
const TDimensionI &dimOut);
public:
Iwa_GlareFx();
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;
};
#endif