#ifndef TETTESSDRAW_H
#define TETTESSDRAW_H

#include <cassert>
#include <vector>
using namespace std;

#include <d4tri.h>
#include <point.h>
#include <gobj.h>



#include <d4marchdisp.h>
#include <d4tess.h>

typedef unsigned int uint;
typedef unsigned int const uintc;
typedef point4<double> pt4;
typedef double real;
typedef double const realc;


//  Brief:  Options for drawing the mesh, mesh surface,
//          current state and the mesh winding.
//
class d4tessdraw
{
  d4tess & tess;
  
  gobjContainer gdynamic;

public:

  gobjSwitchContainer graphicsDeffered;

  gobjSwitchContainer graphicsImmediate;


  d4tessdraw( d4tess & _tess );

  // Draws and iterates over all the tetrahedrons.
  void draw();

  void meshupdate();

};

class writepointsobj : public gobj
{
  d4tess const & tess;
public:

  gobjglColor3ub col;

  writepointsobj(d4tess const & _tess)
    : tess(_tess), col(255,255,0) {}

  void draw() const;
};

class writesimplicesobj : public gobj
{
  d4tess const & tess;
public:

  writesimplicesobj(d4tess const & _tess)
    : tess(_tess) {}

  void draw() const;
};


class writecpobj : public gobj
{
  d4tess const  & tess;
public:

  writecpobj(d4tess const & _tess)
    : tess(_tess) {}

  void draw() const;
};

class writesurfaceobj : public gobj
{
  d4tess const  & tess;
public:

  // Configure the surface color.
  gobjglColor3ub surfacecolor;

  // Configure the c-value in surface.
  d4marchdisp surface;

  writesurfaceobj(d4tess const & _tess)
    : tess(_tess), surfacecolor(gobjglColor3ub(255,0,0)) {}

  void draw() const;
};

class writegridobj : public gobj
{
  d4tess const  & tess;
public:

  // Configure the grid or mesh color.
  gobjglColor3ub gridcolor;

  writegridobj(d4tess const & _tess)
    : tess(_tess), gridcolor(gobjglColor3ub(0,0,255)) {}

  void draw() const;
};

class writewindingobj : public gobj
{
  d4tess const  & tess;
public:

  writewindingobj(d4tess const & _tess)
    : tess(_tess) {}

  void draw() const;
};

class writebaseobj : public gobj
{
  d4tess const  & tess;
public:

  writebaseobj(d4tess const & _tess)
    : tess(_tess) {}

  void draw() const;
};


#endif



