shun-iwasawa a23340
#pragma once
shun-iwasawa a23340
shun-iwasawa a23340
//******************************************************************
shun-iwasawa a23340
// Iwa FractalNoise Fx
shun-iwasawa a23340
// An Fx emulating Fractal Noise effect in Adobe AfterEffect
shun-iwasawa a23340
//******************************************************************
shun-iwasawa a23340
shun-iwasawa a23340
#ifndef IWA_FRACTALNOISEFX_H
shun-iwasawa a23340
#define IWA_FRACTALNOISEFX_H
shun-iwasawa a23340
shun-iwasawa a23340
#include "tfxparam.h"
shun-iwasawa a23340
#include "tparamset.h"
shun-iwasawa a23340
#include "stdfx.h"
shun-iwasawa a23340
shun-iwasawa a23340
class Iwa_FractalNoiseFx final : public TStandardZeraryFx {
shun-iwasawa a23340
  FX_PLUGIN_DECLARATION(Iwa_FractalNoiseFx)
shun-iwasawa a23340
shun-iwasawa a23340
  enum FractalType {
shun-iwasawa a23340
    Basic = 0,
shun-iwasawa a23340
    TurbulentSmooth,
shun-iwasawa a23340
    TurbulentBasic,
shun-iwasawa a23340
    TurbulentSharp,
shun-iwasawa a23340
    Dynamic,
shun-iwasawa a23340
    DynamicTwist,
shun-iwasawa a23340
    Max,
shun-iwasawa a23340
    Rocky,
shun-iwasawa a23340
    FractalTypeCount
shun-iwasawa a23340
  };
shun-iwasawa a23340
shun-iwasawa a23340
  enum NoiseType { Block = 0, Smooth, NoiseTypeCount };
shun-iwasawa a23340
shun-iwasawa a23340
  struct FNParam {
shun-iwasawa a23340
    FractalType fractalType;
shun-iwasawa a23340
    NoiseType noiseType;
shun-iwasawa a23340
    bool invert;
shun-iwasawa a23340
    double rotation;
shun-iwasawa a23340
    TDimensionD scale;
shun-iwasawa a23340
    TPointD offsetTurbulence;
shun-iwasawa a23340
    bool perspectiveOffset;
shun-iwasawa a23340
    double complexity;
shun-iwasawa a23340
    double subInfluence;
shun-iwasawa a23340
    double subScaling;
shun-iwasawa a23340
    double subRotation;
shun-iwasawa a23340
    TPointD subOffset;
shun-iwasawa a23340
    double evolution;
shun-iwasawa a23340
    bool cycleEvolution;
shun-iwasawa a23340
    double cycleEvolutionRange;
shun-iwasawa a23340
    double dynamicIntensity;
shun-iwasawa a23340
    bool alphaRendering;
shun-iwasawa a23340
  };
shun-iwasawa a23340
shun-iwasawa a23340
protected:
luz paz 67b4e9
  // Fractal Type �t���N�^���̎��
shun-iwasawa a23340
  TIntEnumParamP m_fractalType;
luz paz 67b4e9
  // Noise Type �m�C�Y�̎��
shun-iwasawa a23340
  TIntEnumParamP m_noiseType;
luz paz 67b4e9
  // Invert ���]
shun-iwasawa a23340
  TBoolParamP m_invert;
luz paz 67b4e9
  /// Contrast �R���g���X�g
luz paz 67b4e9
  /// Brightness ���邳
luz paz 67b4e9
  /// Overflow �I�[�o�[�t���[
shun-iwasawa a23340
luz paz 67b4e9
  //- - - Transform �g�����X�t�H�[�� - - -
luz paz 67b4e9
  // Rotation ��]
shun-iwasawa a23340
  TDoubleParamP m_rotation;
luz paz 67b4e9
  // Uniform Scaling�@�c������Œ�
shun-iwasawa a23340
  TBoolParamP m_uniformScaling;
luz paz 67b4e9
  // Scale �X�P�[��
shun-iwasawa a23340
  TDoubleParamP m_scale;
luz paz 67b4e9
  // Scale Width �X�P�[���̕�
shun-iwasawa a23340
  TDoubleParamP m_scaleW;
luz paz 67b4e9
  // Scale Height �X�P�[���̍���
shun-iwasawa a23340
  TDoubleParamP m_scaleH;
luz paz 67b4e9
  // Offset Turbulence ���C���̃I�t�Z�b�g
shun-iwasawa a23340
  TPointParamP m_offsetTurbulence;
luz paz 67b4e9
  // Perspective Offset ���߃I�t�Z�b�g
shun-iwasawa a23340
  TBoolParamP m_perspectiveOffset;
shun-iwasawa a23340
luz paz 67b4e9
  // Complexity ���G�x
shun-iwasawa a23340
  TDoubleParamP m_complexity;
shun-iwasawa a23340
luz paz 67b4e9
  //- - - Sub Settings �T�u�ݒ� - - -
luz paz 67b4e9
  // Sub Influence �T�u�e���i���j
shun-iwasawa a23340
  TDoubleParamP m_subInfluence;
luz paz 67b4e9
  // Sub Scaling�@�T�u�X�P�[��
shun-iwasawa a23340
  TDoubleParamP m_subScaling;
luz paz 67b4e9
  // Sub Rotation �T�u��]
shun-iwasawa a23340
  TDoubleParamP m_subRotation;
luz paz 67b4e9
  // Sub Offset �T�u�̃I�t�Z�b�g
shun-iwasawa a23340
  TPointParamP m_subOffset;
luz paz 67b4e9
  // Center Subscale �T�u�X�P�[���𒆐S
shun-iwasawa a23340
  /// TBoolParamP m_centerSubscale;
shun-iwasawa a23340
luz paz 67b4e9
  // Evolution �W�J
shun-iwasawa a23340
  TDoubleParamP m_evolution;
shun-iwasawa a23340
luz paz 67b4e9
  //- - - Evolution Options �W�J�̃I�v�V���� - - -
luz paz 67b4e9
  // Cycle Evolution �T�C�N���W�J
shun-iwasawa a23340
  TBoolParamP m_cycleEvolution;
luz paz 67b4e9
  // Cycle (in Evolution) �T�C�N���i�����j
shun-iwasawa a23340
  TDoubleParamP m_cycleEvolutionRange;
luz paz 67b4e9
  /// Random Seed �����_���V�[�h
luz paz 67b4e9
  /// Opacity  �s�����x
luz paz 67b4e9
  /// Blending Mode �`�惂�[�h
shun-iwasawa a23340
luz paz 67b4e9
  // �_�C�i�~�b�N�̓x����
shun-iwasawa a23340
  TDoubleParamP m_dynamicIntensity;
shun-iwasawa a23340
shun-iwasawa a23340
  // - - - additional parameters - - -
shun-iwasawa a23340
  TBoolParamP m_alphaRendering;
shun-iwasawa a23340
shun-iwasawa a23340
public:
shun-iwasawa a23340
  Iwa_FractalNoiseFx();
shun-iwasawa a23340
  bool canHandle(const TRenderSettings &info, double frame) override {
shun-iwasawa a23340
    return true;
shun-iwasawa a23340
  }
shun-iwasawa a23340
  bool doGetBBox(double frame, TRectD &bBox,
shun-iwasawa a23340
                 const TRenderSettings &ri) override;
shun-iwasawa a23340
  void doCompute(TTile &tile, double frame, const TRenderSettings &ri) override;
shun-iwasawa a23340
shun-iwasawa a23340
  void obtainParams(FNParam ¶m, const double frame, const TAffine &aff);
shun-iwasawa a23340
shun-iwasawa a23340
  template <typename pixel="" raster,="" typename=""></typename>
shun-iwasawa a23340
  void outputRaster(const RASTER outRas, double *out_buf, const FNParam ¶m);
shun-iwasawa a23340
shun-iwasawa a23340
  void getParamUIs(TParamUIConcept *&concepts, int &length) override;
shun-iwasawa a23340
shun-iwasawa a23340
  // For Dynamic and Dynamic Twist patterns, the position offsets using gradient
shun-iwasawa a23340
  // / rotation of the parent pattern
shun-iwasawa a23340
  TPointD getSamplePos(int x, int y, const TDimension outDim,
shun-iwasawa a23340
                       const double *out_buf, const int gen, const double scale,
shun-iwasawa a23340
                       const FNParam ¶m);
shun-iwasawa a23340
  // convert the noise
shun-iwasawa a23340
  void convert(double *buf, const FNParam ¶m);
shun-iwasawa a23340
  // composite the base noise pattern
shun-iwasawa a23340
  void composite(double *out, double *buf, const double influence,
shun-iwasawa a23340
                 const FNParam ¶m);
luz paz 67b4e9
  // finalize pattern (converting the color space)
shun-iwasawa a23340
  void finalize(double *out, const FNParam ¶m);
shun-iwasawa a23340
};
shun-iwasawa a23340
shun-iwasawa a23340
#endif