namespace X3DTK {
namespace MESH {

template<class MData, class VData, class EData, class FData, bool RW>
TemplateNormalsDrawer<MData, VData, EData, FData, RW>::TemplateNormalsDrawer()
: X3DOnePassProcessor()
{
  setGraphTraversal(new DFSGraphTraversal());
  setComponentVisitor(new TemplateNormalsDrawerCoreVisitor<MData, VData, EData, FData, RW>());
}

template<class MData, class VData, class EData, class FData, bool RW>
TemplateNormalsDrawer<MData, VData, EData, FData, RW>::~TemplateNormalsDrawer()
{
  Singleton<TemplateNormalsDrawerStateVariables<MData, VData, EData, FData, RW> >::removeInstance();
}

template<class MData, class VData, class EData, class FData, bool RW>
void TemplateNormalsDrawer<MData, VData, EData, FData, RW>::draw(X3DNode *N, float amplitude)
{
  #ifdef TEMPLATE_SPECIALIZATION_SUPPORTED
  if (VData::template find<MESH::VertexPointData>()
   && VData::template find<MESH::VertexNormalData>()
   && FData::template find<MESH::FaceNormalData>())
  #endif 
  { 
    Singleton<TemplateNormalsDrawerStateVariables<MData, VData, EData, FData, RW> >::getInstance()->setAmplitude(amplitude);
    Singleton<TemplateNormalsDrawerStateVariables<MData, VData, EData, FData, RW> >::getInstance()->init();
    traverse(N);
    Singleton<TemplateNormalsDrawerStateVariables<MData, VData, EData, FData, RW> >::getInstance()->finish();
  }  
}
  
}
}  
