Shinya Kitaoka 810553
#pragma once
Shinya Kitaoka 810553
Toshihiro Shimizu 890ddd
/*------------------------------------
Toshihiro Shimizu 890ddd
 Iwa_SpectrumFx
Toshihiro Shimizu 890ddd
 参照画像を位相差として、干渉色を出力する
Toshihiro Shimizu 890ddd
------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef IWA_SPECTRUM_H
Toshihiro Shimizu 890ddd
#define IWA_SPECTRUM_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tfxparam.h"
Toshihiro Shimizu 890ddd
#include "stdfx.h"
Toshihiro Shimizu 890ddd
#include "tfxparam.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct float3 {
Shinya Kitaoka 120a6e
  float x, y, z;
shun_iwasawa 4d2acf
  float3 operator*(const float &a) { return {x * a, y * a, z * a}; }
shun_iwasawa 4d2acf
  float3 operator+(const float3 &a) { return {x + a.x, y + a.y, z + a.z}; }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
struct float4 {
Shinya Kitaoka 120a6e
  float x, y, z, w;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
shun_iwasawa 4d2acf
class Iwa_SpectrumFx : public TStandardRasterFx {
Shinya Kitaoka 120a6e
  FX_PLUGIN_DECLARATION(Iwa_SpectrumFx)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TRasterFxPort m_input; /*- 位相差マップの入力 -*/
Shinya Kitaoka 120a6e
  TRasterFxPort m_light; /*- 光源用マップの入力 -*/
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TDoubleParamP m_intensity;
Shinya Kitaoka 120a6e
  TDoubleParamP m_refractiveIndex;
Shinya Kitaoka 120a6e
  TDoubleParamP m_thickMax;
Shinya Kitaoka 120a6e
  TDoubleParamP m_thickMin;
Shinya Kitaoka 120a6e
  TDoubleParamP m_RGamma;
Shinya Kitaoka 120a6e
  TDoubleParamP m_GGamma;
Shinya Kitaoka 120a6e
  TDoubleParamP m_BGamma;
shun-iwasawa 9d0856
shun-iwasawa 9d0856
  TDoubleParamP m_loopSpectrumFadeWidth;
shun-iwasawa 9d0856
  TDoubleParamP m_spectrumShift;
shun-iwasawa 9d0856
Shinya Kitaoka 120a6e
  TDoubleParamP m_lensFactor;
Shinya Kitaoka 120a6e
  TDoubleParamP m_lightThres;
Shinya Kitaoka 120a6e
  TDoubleParamP m_lightIntensity;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*- シャボン色マップの生成 -*/
shun_iwasawa 4d2acf
  void calcBubbleMap(float3 *bubbleColor, double frame,
shun_iwasawa 4d2acf
                     bool computeAngularAxis = false);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  template <typename pixel="" raster,="" typename=""></typename>
Shinya Kitaoka 120a6e
  void convertRaster(const RASTER ras, TDimensionI dim, float3 *bubbleColor);
Shinya Kitaoka 120a6e
  template <typename pixel="" raster,="" typename=""></typename>
Shinya Kitaoka 120a6e
  void convertRasterWithLight(const RASTER ras, TDimensionI dim,
Shinya Kitaoka 120a6e
                              float3 *bubbleColor, const RASTER lightRas,
Shinya Kitaoka 120a6e
                              float lightThres, float lightIntensity);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*- 素材タイルを0〜1に正規化して格納 -*/
Shinya Kitaoka 120a6e
  template <typename pixel="" raster,="" typename=""></typename>
Shinya Kitaoka 120a6e
  void setSourceRasters(const RASTER ras, float4 *in_out_tile_host,
Shinya Kitaoka 120a6e
                        const RASTER light_ras, float4 *light_host,
Shinya Kitaoka 120a6e
                        TDimensionI dim, bool useLight);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*- 出力結果をChannel値に変換してタイルに格納 -*/
Shinya Kitaoka 120a6e
  template <typename pixel="" raster,="" typename=""></typename>
Shinya Kitaoka 120a6e
  void outputRasters(const RASTER outRas, float4 *in_out_tile_host,
Shinya Kitaoka 120a6e
                     TDimensionI dim);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  Iwa_SpectrumFx();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 38fd86
  void doCompute(TTile &tile, double frame,
Shinya Kitaoka 38fd86
                 const TRenderSettings &settings) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void doCompute_CUDA(TTile &tile, double frame,
Shinya Kitaoka 120a6e
                      const TRenderSettings &settings);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 38fd86
  bool doGetBBox(double frame, TRectD &bBox,
Shinya Kitaoka 38fd86
                 const TRenderSettings &info) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  bool canHandle(const TRenderSettings &info, double frame) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif