aboutsummaryrefslogtreecommitdiff
path: root/externals/gridflow/bundled/Base/GemShape.h
blob: 101c975d00b9a91317b3bba219c2e781d8eb1636 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*-----------------------------------------------------------------
LOG
    GEM - Graphics Environment for Multimedia

    Base class for shapes

    Copyright (c) 1997-1999 Mark Danks. mark@danks.org
    Copyright (c) Günther Geiger. geiger@epy.co.at
    Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at
    For information on usage and redistribution, and for a DISCLAIMER OF ALL
    WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.

-----------------------------------------------------------------*/

#ifndef INCLUDE_GEMSHAPE_H_
#define INCLUDE_GEMSHAPE_H_

#include "Base/GemBase.h"

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    GemShape
    
    Base class for shapes

DESCRIPTION
    
    Inlet for a float - "ft1"

    "ft1" - the size of the shape
    "draw" - the drawing style
    "width" - the line width when drawing with lines
    
-----------------------------------------------------------------*/
class GEM_EXTERN GemShape : public GemBase
{
    public:

        //////////
        // Constructor
        // [in] size - A size of 0. means to just use the default (ie, 1.)
    	GemShape(t_floatarg size);
	GemShape();
    	
    protected:
    	
    	//////////
    	// Destructor
    	virtual ~GemShape();

	    //-----------------------------------
	    // GROUP:	Access functions
	    //-----------------------------------
    
    	//////////
    	// The width of the lines in line draw mode
    	void	    	linewidthMess(float linewidth);
    	
    	//////////
    	// The size of the object
    	void	    	sizeMess(float size);

    	//////////
    	// How the object should be drawn
    	virtual void	typeMess(t_symbol *type);
    	
	    //-----------------------------------
	    // GROUP:	Utility functions
	    //-----------------------------------
	
		void SetVertex(GemState* state,float x, float y, float z, float tx, float ty,int curCoord);

	    //-----------------------------------
	    // GROUP:	Member variables
	    //-----------------------------------
    
    	//////////
    	// The line width for GL_LINE mode
        GLfloat	    	m_linewidth;

    	//////////
    	// The size of the object
        GLfloat	    	m_size;
	
        //////////
        // The drawing style (GL_LINE, GL_POLYGON, etc)
        GLenum	    	m_drawType;

        //////////
        // The size inlet
        t_inlet         *m_inlet;

	//-----------------------------------
	// GROUP:	Setup functions
	//-----------------------------------
    
    	//////////
    	// creation callback
    	static void 	real_obj_setupCallback(t_class *classPtr)
	  { GemBase::real_obj_setupCallback(classPtr); GemShape::obj_setupCallback(classPtr); }
    	
    private:
    
     	static inline GemShape *GetMyClass(void *data) {return((GemShape *)((Obj_header *)data)->data);}

       	//////////
    	// static member functions
    	static void 	obj_setupCallback(t_class *classPtr);
    	static void 	linewidthMessCallback(void *data, t_floatarg linewidth);
    	static void 	typeMessCallback(void *data, t_symbol *type);
    	static void 	sizeMessCallback(void *data, t_floatarg size);
};

#endif	// for header file