1 #pragma once 2 3 //****************************************************************** 4 // Iwa FractalNoise Fx 5 // An Fx emulating Fractal Noise effect in Adobe AfterEffect 6 //****************************************************************** 7 8 #ifndef IWA_FRACTALNOISEFX_H 9 #define IWA_FRACTALNOISEFX_H 10 11 #include "tfxparam.h" 12 #include "tparamset.h" 13 #include "stdfx.h" 14 15 class Iwa_FractalNoiseFx final : public TStandardZeraryFx { 16 FX_PLUGIN_DECLARATION(Iwa_FractalNoiseFx) 17 18 enum FractalType { 19 Basic = 0, 20 TurbulentSmooth, 21 TurbulentBasic, 22 TurbulentSharp, 23 Dynamic, 24 DynamicTwist, 25 Max, 26 Rocky, 27 FractalTypeCount 28 }; 29 30 enum NoiseType { Block = 0, Smooth, NoiseTypeCount }; 31 32 struct FNParam { 33 FractalType fractalType; 34 NoiseType noiseType; 35 bool invert; 36 double rotation; 37 TDimensionD scale; 38 TPointD offsetTurbulence; 39 bool perspectiveOffset; 40 double complexity; 41 double subInfluence; 42 double subScaling; 43 double subRotation; 44 TPointD subOffset; 45 double evolution; 46 bool cycleEvolution; 47 double cycleEvolutionRange; 48 double dynamicIntensity; 49 bool alphaRendering; 50 }; 51 52 protected: 53 // Fractal Type �t���N�^���̎�� 54 TIntEnumParamP m_fractalType; 55 // Noise Type �m�C�Y�̎�� 56 TIntEnumParamP m_noiseType; 57 // Invert ���] 58 TBoolParamP m_invert; 59 /// Contrast �R���g���X�g 60 /// Brightness ���邳 61 /// Overflow �I�[�o�[�t���[ 62 63 //- - - Transform �g�����X�t�H�[�� - - - 64 // Rotation ��] 65 TDoubleParamP m_rotation; 66 // Uniform Scaling�@�c������Œ� 67 TBoolParamP m_uniformScaling; 68 // Scale �X�P�[�� 69 TDoubleParamP m_scale; 70 // Scale Width �X�P�[���̕� 71 TDoubleParamP m_scaleW; 72 // Scale Height �X�P�[���̍��� 73 TDoubleParamP m_scaleH; 74 // Offset Turbulence ���C���̃I�t�Z�b�g 75 TPointParamP m_offsetTurbulence; 76 // Perspective Offset ���߃I�t�Z�b�g 77 TBoolParamP m_perspectiveOffset; 78 79 // Complexity ���G�x 80 TDoubleParamP m_complexity; 81 82 //- - - Sub Settings �T�u�ݒ� - - - 83 // Sub Influence �T�u�e���i���j 84 TDoubleParamP m_subInfluence; 85 // Sub Scaling�@�T�u�X�P�[�� 86 TDoubleParamP m_subScaling; 87 // Sub Rotation �T�u��] 88 TDoubleParamP m_subRotation; 89 // Sub Offset �T�u�̃I�t�Z�b�g 90 TPointParamP m_subOffset; 91 // Center Subscale �T�u�X�P�[���S 92 /// TBoolParamP m_centerSubscale; 93 94 // Evolution �W�J 95 TDoubleParamP m_evolution; 96 97 //- - - Evolution Options �W�J�̃I�v�V���� - - - 98 // Cycle Evolution �T�C�N���W�J 99 TBoolParamP m_cycleEvolution; 100 // Cycle (in Evolution) �T�C�N���i�����j 101 TDoubleParamP m_cycleEvolutionRange; 102 /// Random Seed �����_���V�[�h 103 /// Opacity �s�����x 104 /// Blending Mode �`�惂�[�h 105 106 // �_�C�i�~�b�N�̓x���� 107 TDoubleParamP m_dynamicIntensity; 108 109 // - - - additional parameters - - - 110 TBoolParamP m_alphaRendering; 111 112 public: 113 Iwa_FractalNoiseFx(); canHandle(const TRenderSettings & info,double frame)114 bool canHandle(const TRenderSettings &info, double frame) override { 115 return true; 116 } 117 bool doGetBBox(double frame, TRectD &bBox, 118 const TRenderSettings &ri) override; 119 void doCompute(TTile &tile, double frame, const TRenderSettings &ri) override; 120 121 void obtainParams(FNParam ¶m, const double frame, const TAffine &aff); 122 123 template <typename RASTER, typename PIXEL> 124 void outputRaster(const RASTER outRas, double *out_buf, const FNParam ¶m); 125 126 void getParamUIs(TParamUIConcept *&concepts, int &length) override; 127 128 // For Dynamic and Dynamic Twist patterns, the position offsets using gradient 129 // / rotation of the parent pattern 130 TPointD getSamplePos(int x, int y, const TDimension outDim, 131 const double *out_buf, const int gen, const double scale, 132 const FNParam ¶m); 133 // convert the noise 134 void convert(double *buf, const FNParam ¶m); 135 // composite the base noise pattern 136 void composite(double *out, double *buf, const double influence, 137 const FNParam ¶m); 138 // finalize pattern (coverting the color space) 139 void finalize(double *out, const FNParam ¶m); 140 }; 141 142 #endif