#ifndef _dmsQuadricObject_h_
#define _dmsQuadricObject_h_

#include <GL/glu.h>
#include <dms/Util.h>
#include <dms/Object.h>

#define DMS_GLU_SPHERE          1
#define DMS_GLU_CYLINDER        2
#define DMS_GLU_DISK            3
#define DMS_GLU_PARTIAL_DISK    4


namespace dms
{

class QuadricObject : public Object
    {
    public:
        QuadricObject(void);
        virtual ~QuadricObject(void);
        virtual void draw(void);

        void makeSphere(GLdouble radius=1.0,GLint slices=8,GLint stacks=8);
        void makeCylinder(GLdouble baseRadius=1.0, GLdouble topRadius=1.0,
                          GLdouble height=1.0, GLint slices=8, GLint stacks=1,
                          int axis=DMS_Z);
        void makeCone(GLdouble baseRadius=1.0, GLdouble height=1.0,
                          GLint slices=8, GLint stacks=1, int axis=DMS_Z);
        void makeDisk(GLdouble innerRadius=0.0, GLdouble outerRadius=1.0,
                          GLint slices=8, GLint rings=1, int axis=DMS_Z);
        void makePartialDisk(GLdouble innerRadius=0.0, GLdouble outerRadius=1.0,
                          GLint slices=8, GLint rings=1,
                          GLdouble startAngle=0.0, GLdouble sweep=180.0,
                          int axis=DMS_Z);
        
        void setUseNormals(GLboolean state);
        void setUseTexture(GLboolean state);
        void setDrawStyle(GLenum style);
        
        GLUquadric * quadric(void) const { return quadric_; }
        int quadricType(void) const { return quadricType_; }
        GLboolean useNormals(void) const { return useNormals_; }
        GLboolean useTexture(void) const { return useTexture_; }
        GLenum drawStyle(void) const { return drawStyle_; }

    private:
        GLUquadric * quadric_;
        int quadricType_;
        GLdouble radius_, topRadius_, innerRadius_, height_;
        GLdouble startAngle_, sweep_;
        GLint slices_, stacks_, rings_;
        GLboolean useNormals_, useTexture_;
        GLenum drawStyle_;
        int axis_;
    };

}

#endif
