/// ****************************************************************************
/// @file   
/// @author Dr.Neeton
/// @date   200X/X/X - 2014/01/24
/// 
/// @brief  DirectX  シェーダー共通フラグメント（グローバルパラメーター）
/// 
/// ****************************************************************************

#pragma once

#include "CPL_DX_Shader_CSF_Base.h"

namespace CPL {
namespace DX {
namespace Shader {
namespace CSF {

  
  // _____________________________________________________________________________
  /// @brief マテリアル
  ///
  // *****************************************************************************
  class Global_Material
    : virtual public CodeFragment
    , public KW_G_Material
    , public KW_Diffuse
    , public KW_Specular
    , public KW_Emissive
  {
  protected:
    void On_SetupGlobalParameter( rout<CIV_Global> out_global_param ) override;

    CPL_DEF_GET_THIS_FRAGMENT_COLLECTION

  public:
    Global_Material(){}
  };

  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_ID_TEMPLATE( Global_MaterialN, Global_Material );

  // _____________________________________________________________________________
  /// @brief テクスチャー
  ///
  // *****************************************************************************
  class Global_Texture
    : virtual public CodeFragment
    , public KW_G_Texture
  {
  protected:
    CPType m_type;
    int    m_tex_num;

    void On_SetupGlobalParameter( rout<CIV_Global> out_global_param ) override;
  public:
    Global_Texture( _in<CPType> in_type, _in<int> in_tex_num )
      : m_type( in_type )
      , m_tex_num( in_tex_num )
    {}
  };

  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_SETUP_CPTYPE_and_ARG_NUM( Global_Texture1D, Global_Texture, CPType(Texture1D) );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_SETUP_CPTYPE_and_ARG_NUM( Global_Texture2D, Global_Texture, CPType(Texture2D) );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_SETUP_CPTYPE_and_ARG_NUM( Global_Texture3D, Global_Texture, CPType(Texture3D) );

  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_ID_TEMPLATE_and_ARG_NUM( Global_Texture1DN, Global_Texture1D );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_ID_TEMPLATE_and_ARG_NUM( Global_Texture2DN, Global_Texture2D );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_ID_TEMPLATE_and_ARG_NUM( Global_Texture3DN, Global_Texture3D );


  // _____________________________________________________________________________
  /// @brief サンプラー
  ///
  // *****************************************************************************
  class Global_Sampler
    : virtual public CodeFragment
    , public KW_G_Sampler
  {
  protected:
    CPType m_type;
    int    m_samp_num;

    void On_SetupGlobalParameter( rout<CIV_Global> out_global_param ) override;
  public:
    Global_Sampler( CPType const& in_type, int in_samp_num )
      : m_type( in_type )
      , m_samp_num( in_samp_num )
    {}
  };

  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_SETUP_CPTYPE_and_ARG_NUM( Global_SamplerState, Global_Sampler, CPType(SamplerState) );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_SETUP_CPTYPE_and_ARG_NUM( Global_Sampler1D,    Global_Sampler, CPType(Sampler1D) );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_SETUP_CPTYPE_and_ARG_NUM( Global_Sampler2D,    Global_Sampler, CPType(Sampler2D) );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_SETUP_CPTYPE_and_ARG_NUM( Global_Sampler3D,    Global_Sampler, CPType(Sampler3D) );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_SETUP_CPTYPE_and_ARG_NUM( Global_SamplerCUBE,  Global_Sampler, CPType(SamplerCUBE) );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_SETUP_CPTYPE_and_ARG_NUM( Global_SamplerComparisonState, Global_Sampler, CPType(SamplerComparisonState) );

  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_ID_TEMPLATE_and_ARG_NUM( Global_SamplerStateN, Global_SamplerState );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_ID_TEMPLATE_and_ARG_NUM( Global_Sampler1D_N, Global_Sampler1D );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_ID_TEMPLATE_and_ARG_NUM( Global_Sampler2D_N, Global_Sampler2D );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_ID_TEMPLATE_and_ARG_NUM( Global_Sampler3D_N, Global_Sampler3D );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_ID_TEMPLATE_and_ARG_NUM( Global_SamplerCUBE_N, Global_SamplerCUBE );
  CPL_DX_CSF_DEFINED_DERIVED_CLASS_for_ID_TEMPLATE_and_ARG_NUM( Global_SamplerSamplerComparisonStateN, Global_SamplerComparisonState );


  // _____________________________________________________________________________
  /// @brief ピクセルカラー
  ///
  // *****************************************************************************
  class Global_PixelColor
    : virtual public CodeFragment
    , public KW_G_PixelColor
  {
  protected:
    void On_SetupGlobalParameter( rout<CIV_Global> out_global_param ) override;
  public:
    Global_PixelColor(){}
  };


  // _____________________________________________________________________________
  /// @brief ライト
  ///
  // *****************************************************************************
  class Global_AmbientLight
    : virtual public CodeFragment
    , public KW_G_AmbientLight
  {
  };



} // namespace CSF
} // namespace Shader
} // namespace DX
} // namespace CPL
