|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Shinya Kitaoka |
810553 |
|
|
Toshihiro Shimizu |
890ddd |
/*------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
Iwa_PNPerspectiveFx
|
|
Toshihiro Shimizu |
890ddd |
PerlinNoise/SimplexNoiseパターンを生成、透視投影する
|
|
Toshihiro Shimizu |
890ddd |
------------------------------------------------------------*/
|
|
Toshihiro Shimizu |
890ddd |
#ifndef IWA_PN_PERSPECTIVE_H
|
|
Toshihiro Shimizu |
890ddd |
#define IWA_PN_PERSPECTIVE_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tfxparam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "stdfx.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tparamset.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
struct float2 {
|
|
Shinya Kitaoka |
120a6e |
float x, y;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
struct float3 {
|
|
Shinya Kitaoka |
120a6e |
float x, y, z;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
struct float4 {
|
|
Shinya Kitaoka |
120a6e |
float x, y, z, w;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*計算に用いるパラメータ群*/
|
|
Toshihiro Shimizu |
890ddd |
struct PN_Params {
|
|
Shinya Kitaoka |
120a6e |
int renderMode;
|
|
Shinya Kitaoka |
120a6e |
int noiseType; /* 0:Perlin, 1: Simplex */
|
|
Shinya Kitaoka |
120a6e |
float size; /* 第1世代のノイズサイズ */
|
|
Shinya Kitaoka |
120a6e |
int octaves; /* 世代数 */
|
|
Shinya Kitaoka |
120a6e |
float2 offset; /* 第1世代のオフセット */
|
|
Shinya Kitaoka |
120a6e |
float p_intensity; /* 世代間の強度比 */
|
|
Shinya Kitaoka |
120a6e |
float p_size; /* 世代間のサイズ比 */
|
|
Shinya Kitaoka |
120a6e |
float p_offset; /* 世代間のオフセット比 */
|
|
Shinya Kitaoka |
120a6e |
float2 eyeLevel; /* 視点位置 */
|
|
Shinya Kitaoka |
120a6e |
int drawLevel; /* 描画範囲の下からの距離 描画を開始するスキャンライン位置 */
|
|
Shinya Kitaoka |
120a6e |
bool alp_rend_sw;
|
|
Shinya Kitaoka |
120a6e |
float waveHeight; /* warpHV / フレネル反射のときのみ使う */
|
|
Shinya Kitaoka |
120a6e |
float fy_2;
|
|
Shinya Kitaoka |
120a6e |
float A;
|
|
Shinya Kitaoka |
120a6e |
float3 cam_pos;
|
|
Shinya Kitaoka |
120a6e |
float base_fresnel_ref; /* フレネル反射のときのみ使う */
|
|
Shinya Kitaoka |
120a6e |
float int_sum;
|
|
Shinya Kitaoka |
120a6e |
float a11, a12, a13;
|
|
Shinya Kitaoka |
120a6e |
float a21, a22, a23;
|
|
Shinya Kitaoka |
120a6e |
float time;
|
|
Shinya Kitaoka |
120a6e |
float p_evolution;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class Iwa_PNPerspectiveFx final : public TStandardZeraryFx {
|
|
Shinya Kitaoka |
120a6e |
FX_PLUGIN_DECLARATION(Iwa_PNPerspectiveFx)
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TIntEnumParamP
|
|
Shinya Kitaoka |
120a6e |
m_renderMode; /* 描画モード
|
|
Shinya Kitaoka |
120a6e |
-
|
|
Shinya Kitaoka |
120a6e |
強度
|
|
Shinya Kitaoka |
120a6e |
-
|
|
Shinya Kitaoka |
120a6e |
強度(リサンプルなし)
|
|
Shinya Kitaoka |
120a6e |
-
|
|
Shinya Kitaoka |
120a6e |
WarpHV用オフセット
|
|
Shinya Kitaoka |
120a6e |
-
|
|
Shinya Kitaoka |
120a6e |
フレネル反射 */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TIntEnumParamP
|
|
Shinya Kitaoka |
120a6e |
m_noiseType; /* ノイズのタイプ
|
|
Shinya Kitaoka |
120a6e |
-
|
|
Shinya Kitaoka |
120a6e |
Perlin Noise
|
|
Shinya Kitaoka |
120a6e |
-
|
|
Shinya Kitaoka |
120a6e |
Simplex Noise */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_size; /* ベースとなる大きさ */
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_evolution; /* 展開 */
|
|
Shinya Kitaoka |
120a6e |
TIntEnumParamP m_octaves; /* 世代数 */
|
|
Shinya Kitaoka |
120a6e |
TPointParamP m_offset; /* ノイズのオフセット */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_persistance_intensity; /* 次の世代での振幅の倍率 */
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_persistance_size; /* 次の世代での波長の倍率 */
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_persistance_evolution; /* 次の世代での展開周期の倍率 */
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_persistance_offset; /* 次の世代でのオフセット距離の倍率 */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_fov; /* カメラ画角 */
|
|
Shinya Kitaoka |
120a6e |
TPointParamP m_eyeLevel; /* 消失点の位置 */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TBoolParamP
|
|
Shinya Kitaoka |
120a6e |
m_alpha_rendering; /* アルファチャンネルもノイズを与えるかどうか */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_waveHeight; /* 波の高さ */
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/* 出力結果をChannel値に変換して格納 */
|
|
Shinya Kitaoka |
120a6e |
template <typename pixel="" raster,="" typename=""></typename>
|
|
Shinya Kitaoka |
120a6e |
void setOutputRaster(float4 *srcMem, const RASTER dstRas, TDimensionI dim,
|
|
Shinya Kitaoka |
120a6e |
int drawLevel, const bool alp_rend_sw);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/* PerlinNoiseのパラメータを取得 */
|
|
Shinya Kitaoka |
120a6e |
void getPNParameters(TTile &tile, double frame,
|
|
Shinya Kitaoka |
120a6e |
const TRenderSettings &settings, PN_Params ¶ms,
|
|
Shinya Kitaoka |
120a6e |
TDimensionI &dimOut);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/* 通常のノイズのCPU計算 */
|
|
Shinya Kitaoka |
120a6e |
void calcPerinNoise_CPU(float4 *out_host, TDimensionI &dimOut, PN_Params &p,
|
|
Shinya Kitaoka |
120a6e |
bool doResample);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/* WarpHVモード、Fresnel反射モード */
|
|
Shinya Kitaoka |
120a6e |
void calcPNNormal_CPU(float4 *out_host, TDimensionI &dimOut, PN_Params &p,
|
|
Shinya Kitaoka |
120a6e |
bool isSubWave = false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
Iwa_PNPerspectiveFx();
|
|
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 |
|
|
Shinya Kitaoka |
38fd86 |
void doCompute(TTile &tile, double frame,
|
|
Shinya Kitaoka |
38fd86 |
const TRenderSettings &rend_sets) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void doCompute_CPU(TTile &tile, double frame, const TRenderSettings &settings,
|
|
Shinya Kitaoka |
120a6e |
float4 *out_host, TDimensionI &dimOut,
|
|
Shinya Kitaoka |
120a6e |
PN_Params &pnParams);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void getParamUIs(TParamUIConcept *&concepts, int &length) override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|