Shinya Kitaoka 810553
#pragma once
Shinya Kitaoka 810553
Toshihiro Shimizu 890ddd
/*------------------------------------
Shinya Kitaoka 120a6e
 Iwa_PerspectiveDistortFx
Toshihiro Shimizu 890ddd
 奥行き方向に台形歪みを行うエフェクト
Toshihiro Shimizu 890ddd
 ディティールを保持するため、引き伸ばす量に応じて素材の解像度を上げる
Toshihiro Shimizu 890ddd
------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef IWA_PERSPECTIVE_DISTORT_H
Toshihiro Shimizu 890ddd
#define IWA_PERSPECTIVE_DISTORT_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 float4 {
Shinya Kitaoka 120a6e
  float x, y, z, w;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class Iwa_PerspectiveDistortFx final : public TStandardRasterFx {
Shinya Kitaoka 120a6e
  FX_PLUGIN_DECLARATION(Iwa_PerspectiveDistortFx)
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TRasterFxPort m_source; /*- 入力画像 -*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointParamP m_vanishingPoint; /*- 消失点 -*/
Shinya Kitaoka 120a6e
  TPointParamP m_anchorPoint;    /*- 基準点 -*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TDoubleParamP m_precision; /*- 細かさ。解像度の引き上げ度合い -*/
Toshihiro Shimizu 890ddd
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);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /*- タイルの画像を0〜1に正規化してホストメモリに読み込む -*/
Shinya Kitaoka 120a6e
  template <typename pixel="" raster,="" typename=""></typename>
Shinya Kitaoka 120a6e
  void setSourceRaster(const RASTER srcRas, float4 *dstMem, TDimensionI dim);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  Iwa_PerspectiveDistortFx();
Shinya Kitaoka 120a6e
Shinya Kitaoka 38fd86
  bool doGetBBox(double frame, TRectD &bBox,
Shinya Kitaoka 38fd86
                 const TRenderSettings &info) override;
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  bool canHandle(const TRenderSettings &info, double frame) override;
Shinya Kitaoka 120a6e
Shinya Kitaoka 38fd86
  void doCompute(TTile &tile, double frame,
Shinya Kitaoka 38fd86
                 const TRenderSettings &rend_sets) override;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void doCompute_CPU(TTile &tile, const double frame,
Shinya Kitaoka 120a6e
                     const TRenderSettings &settings, TPointD &vanishingPoint,
Shinya Kitaoka 120a6e
                     TPointD &anchorPoint, float4 *source_host,
Shinya Kitaoka 120a6e
                     float4 *result_host, TDimensionI &sourceDim,
Shinya Kitaoka 120a6e
                     TDimensionI &resultDim, const double precision,
Shinya Kitaoka 120a6e
                     const double offs);
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  void getParamUIs(TParamUIConcept *&concepts, int &length) override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif