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 {
Toshihiro Shimizu 890ddd
	float x, y, z;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
struct float4 {
Toshihiro Shimizu 890ddd
	float x, y, z, w;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class Iwa_SpectrumFx : public TStandardRasterFx
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	FX_PLUGIN_DECLARATION(Iwa_SpectrumFx)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	TRasterFxPort m_input; /*- 位相差マップの入力 -*/
Toshihiro Shimizu 890ddd
	TRasterFxPort m_light; /*- 光源用マップの入力 -*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TDoubleParamP m_intensity;
Toshihiro Shimizu 890ddd
	TDoubleParamP m_refractiveIndex;
Toshihiro Shimizu 890ddd
	TDoubleParamP m_thickMax;
Toshihiro Shimizu 890ddd
	TDoubleParamP m_thickMin;
Toshihiro Shimizu 890ddd
	TDoubleParamP m_RGamma;
Toshihiro Shimizu 890ddd
	TDoubleParamP m_GGamma;
Toshihiro Shimizu 890ddd
	TDoubleParamP m_BGamma;
Toshihiro Shimizu 890ddd
	TDoubleParamP m_lensFactor;
Toshihiro Shimizu 890ddd
	TDoubleParamP m_lightThres;
Toshihiro Shimizu 890ddd
	TDoubleParamP m_lightIntensity;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*- シャボン色マップの生成 -*/
Toshihiro Shimizu 890ddd
	void calcBubbleMap(float3 *bubbleColor, double frame);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	template <typename pixel="" raster,="" typename=""></typename>
Toshihiro Shimizu 890ddd
	void convertRaster(const RASTER ras,
Toshihiro Shimizu 890ddd
					   TDimensionI dim,
Toshihiro Shimizu 890ddd
					   float3 *bubbleColor);
Toshihiro Shimizu 890ddd
	template <typename pixel="" raster,="" typename=""></typename>
Toshihiro Shimizu 890ddd
	void convertRasterWithLight(const RASTER ras,
Toshihiro Shimizu 890ddd
								TDimensionI dim,
Toshihiro Shimizu 890ddd
								float3 *bubbleColor,
Toshihiro Shimizu 890ddd
								const RASTER lightRas,
Toshihiro Shimizu 890ddd
								float lightThres,
Toshihiro Shimizu 890ddd
								float lightIntensity);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*- 素材タイルを0〜1に正規化して格納 -*/
Toshihiro Shimizu 890ddd
	template <typename pixel="" raster,="" typename=""></typename>
Toshihiro Shimizu 890ddd
	void setSourceRasters(const RASTER ras,
Toshihiro Shimizu 890ddd
						  float4 *in_out_tile_host,
Toshihiro Shimizu 890ddd
						  const RASTER light_ras,
Toshihiro Shimizu 890ddd
						  float4 *light_host,
Toshihiro Shimizu 890ddd
						  TDimensionI dim,
Toshihiro Shimizu 890ddd
						  bool useLight);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*- 出力結果をChannel値に変換してタイルに格納 -*/
Toshihiro Shimizu 890ddd
	template <typename pixel="" raster,="" typename=""></typename>
Toshihiro Shimizu 890ddd
	void outputRasters(const RASTER outRas,
Toshihiro Shimizu 890ddd
					   float4 *in_out_tile_host,
Toshihiro Shimizu 890ddd
					   TDimensionI dim);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	Iwa_SpectrumFx();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void doCompute(TTile &tile,
Toshihiro Shimizu 890ddd
				   double frame,
Toshihiro Shimizu 890ddd
				   const TRenderSettings &settings);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void doCompute_CUDA(TTile &tile,
Toshihiro Shimizu 890ddd
						double frame,
Toshihiro Shimizu 890ddd
						const TRenderSettings &settings);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool doGetBBox(double frame,
Toshihiro Shimizu 890ddd
				   TRectD &bBox,
Toshihiro Shimizu 890ddd
				   const TRenderSettings &info);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool canHandle(const TRenderSettings &info,
Toshihiro Shimizu 890ddd
				   double frame);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif