/// ****************************************************************************
/// @file   
/// @author Dr.Neeton
/// @date   200X/X/X - 2015/11/11
/// 
/// @brief  DirectX 頂点要素関連
/// 
/// ****************************************************************************

#pragma once

#include "CPL_DX_Layout_Element.h"
#include "CPL_DX_VertexTypes.h"


namespace CPL {
namespace DX {
// namespace Graph {
namespace Layout {



// ダミーを定義するCPL独自のDECLタイプ定義
const int CPL_DECLTYPE_DUMMY = 31;



// _____________________________________________________________________________
/// @brief 頂点要素テンプレート
///
// *****************************************************************************
template< class T_Vertex, int SEMANTIC_INDEX=0>
class VertexElementT
  : public Element
{
public:
  VertexElementT()
    : Element
      ( T_Vertex::SEMANTIC(), SEMANTIC_INDEX
      , T_Vertex::kFORMAT, 0, D3D11_APPEND_ALIGNED_ELEMENT
      , D3D11_INPUT_PER_VERTEX_DATA, 0
      )
  {}
  VertexElementT
  ( UINT in_input_slot
  , UINT in_instance_data_step_rate = 0
  ) : Element
      ( T_Vertex::SEMANTIC(), SEMANTIC_INDEX
      , T_Vertex::kFORMAT, in_input_slot, D3D11_APPEND_ALIGNED_ELEMENT
      , D3D11_INPUT_PER_VERTEX_DATA, in_instance_data_step_rate 
      )
  {}

  //// _____________________________________________________________________________
  //// 比較　※ ストリームとオフセットは比較しない
  //bool operator = ( Element const& ve )
  //{
  //  return type        == ve.type  &&
  //         usage       == ve.usage  &&
  //         usage_index == ve.usage_index  &&
  //         method      == ve.method;
  //}
};



// 主なもの？だけ定義してみる *********************************************

typedef VertexElementT<Vtx::XYZ>       VtxElmXYZ;
typedef VertexElementT<Vtx::XYZRHW>    VtxElmXYZW;
typedef VertexElementT<Vtx::Blend1>    VtxElmBWeight1;
typedef VertexElementT<Vtx::Blend2>    VtxElmBWeight2;
typedef VertexElementT<Vtx::Blend3>    VtxElmBWeight3;
typedef VertexElementT<Vtx::BIndex>    VtxElmBIndex;
typedef VertexElementT<Vtx::Normal>    VtxElmNormal;
typedef VertexElementT<Vtx::PSize>     VtxElmPSize;
typedef VertexElementT<Vtx::UV0,0>     VtxElmTex0;
typedef VertexElementT<Vtx::UV1,1>     VtxElmTex1;
typedef VertexElementT<Vtx::UV2,2>     VtxElmTex2;
typedef VertexElementT<Vtx::UV3,3>     VtxElmTex3;
//typedef VertexElementT<D3DDECLTYPE_FLOAT2,   D3DDECLUSAGE_TEXCOORD,4>   VtxElmTex4;
//typedef VertexElementT<D3DDECLTYPE_FLOAT2,   D3DDECLUSAGE_TEXCOORD,5>   VtxElmTex5;
//typedef VertexElementT<D3DDECLTYPE_FLOAT2,   D3DDECLUSAGE_TEXCOORD,6>   VtxElmTex6;
//typedef VertexElementT<D3DDECLTYPE_FLOAT2,   D3DDECLUSAGE_TEXCOORD,7>   VtxElmTex7;
typedef VertexElementT<Vtx::Tangent>   VtxElmTangent;
typedef VertexElementT<Vtx::BINormal>  VtxElmBINormal;
//typedef VertexElementT<D3DDECLTYPE_FLOAT1,   D3DDECLUSAGE_TESSFACTOR>   VtxElmTessFactor;
typedef VertexElementT<Vtx::Diffuse>   VtxElmDiffuse;
typedef VertexElementT<Vtx::Specular>  VtxElmSpecular;
typedef VertexElementT<Vtx::Color<1> > VtxElmColor;
typedef VertexElementT<Vtx::Color<1> > VtxElmColor0;
typedef VertexElementT<Vtx::Color<2> > VtxElmColor1;
typedef VertexElementT<Vtx::Color<3> > VtxElmColor2;
typedef VertexElementT<Vtx::Color<4> > VtxElmColor3;
typedef VertexElementT<Vtx::Color<5> > VtxElmColor4;
typedef VertexElementT<Vtx::Color<6> > VtxElmColor5;
typedef VertexElementT<Vtx::Color<7> > VtxElmColor6;
typedef VertexElementT<Vtx::Color<8> > VtxElmColor7;
//typedef VertexElementT<D3DDECLTYPE_FLOAT1,   D3DDECLUSAGE_FOG>          VtxElmFog;
//typedef VertexElementT<D3DDECLTYPE_FLOAT1,   D3DDECLUSAGE_DEPTH>        VtxElmDepth;


} // namespace Layout
// } namespace Graph
} // namespace DX
} // namespace CPL
