2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
|
|
|
|
2016-03-19 06:57:51 +13:00
|
|
|
/*------------------------------------
|
|
|
|
Iwa_SpectrumFx
|
|
|
|
参照画像を位相差として、干渉色を出力する
|
|
|
|
------------------------------------*/
|
|
|
|
|
|
|
|
#ifndef IWA_SPECTRUM_H
|
|
|
|
#define IWA_SPECTRUM_H
|
|
|
|
|
|
|
|
#include "stdfx.h"
|
|
|
|
#include "tfxparam.h"
|
|
|
|
|
|
|
|
struct float3 {
|
2016-06-15 18:43:10 +12:00
|
|
|
float x, y, z;
|
2016-11-30 22:11:33 +13:00
|
|
|
float3 operator*(const float &a) { return {x * a, y * a, z * a}; }
|
|
|
|
float3 operator+(const float3 &a) { return {x + a.x, y + a.y, z + a.z}; }
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
struct float4 {
|
2016-06-15 18:43:10 +12:00
|
|
|
float x, y, z, w;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
2016-11-30 22:11:33 +13:00
|
|
|
class Iwa_SpectrumFx : public TStandardRasterFx {
|
2016-06-15 18:43:10 +12:00
|
|
|
FX_PLUGIN_DECLARATION(Iwa_SpectrumFx)
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-15 18:43:10 +12:00
|
|
|
TRasterFxPort m_input; /*- 位相差マップの入力 -*/
|
|
|
|
TRasterFxPort m_light; /*- 光源用マップの入力 -*/
|
|
|
|
|
|
|
|
TDoubleParamP m_intensity;
|
|
|
|
TDoubleParamP m_refractiveIndex;
|
|
|
|
TDoubleParamP m_thickMax;
|
|
|
|
TDoubleParamP m_thickMin;
|
|
|
|
TDoubleParamP m_RGamma;
|
|
|
|
TDoubleParamP m_GGamma;
|
|
|
|
TDoubleParamP m_BGamma;
|
2017-04-28 14:52:23 +12:00
|
|
|
|
|
|
|
TDoubleParamP m_loopSpectrumFadeWidth;
|
|
|
|
TDoubleParamP m_spectrumShift;
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TDoubleParamP m_lensFactor;
|
|
|
|
TDoubleParamP m_lightThres;
|
|
|
|
TDoubleParamP m_lightIntensity;
|
|
|
|
|
|
|
|
/*- シャボン色マップの生成 -*/
|
2016-11-30 22:11:33 +13:00
|
|
|
void calcBubbleMap(float3 *bubbleColor, double frame,
|
|
|
|
bool computeAngularAxis = false);
|
2016-06-15 18:43:10 +12:00
|
|
|
|
|
|
|
template <typename RASTER, typename PIXEL>
|
|
|
|
void convertRaster(const RASTER ras, TDimensionI dim, float3 *bubbleColor);
|
|
|
|
template <typename RASTER, typename PIXEL>
|
|
|
|
void convertRasterWithLight(const RASTER ras, TDimensionI dim,
|
|
|
|
float3 *bubbleColor, const RASTER lightRas,
|
|
|
|
float lightThres, float lightIntensity);
|
|
|
|
|
|
|
|
/*- 素材タイルを0〜1に正規化して格納 -*/
|
|
|
|
template <typename RASTER, typename PIXEL>
|
|
|
|
void setSourceRasters(const RASTER ras, float4 *in_out_tile_host,
|
|
|
|
const RASTER light_ras, float4 *light_host,
|
|
|
|
TDimensionI dim, bool useLight);
|
|
|
|
|
|
|
|
/*- 出力結果をChannel値に変換してタイルに格納 -*/
|
|
|
|
template <typename RASTER, typename PIXEL>
|
|
|
|
void outputRasters(const RASTER outRas, float4 *in_out_tile_host,
|
|
|
|
TDimensionI dim);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
Iwa_SpectrumFx();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
void doCompute(TTile &tile, double frame,
|
|
|
|
const TRenderSettings &settings) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void doCompute_CUDA(TTile &tile, double frame,
|
|
|
|
const TRenderSettings &settings);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-20 14:23:05 +12:00
|
|
|
bool doGetBBox(double frame, TRectD &bBox,
|
|
|
|
const TRenderSettings &info) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
bool canHandle(const TRenderSettings &info, double frame) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|