xref: /haiku/src/apps/glteapot/GLObject.h (revision 56eb8e78cc702792e3b032e3f5f45da9e5dbea9e)
1 /*
2 	Copyright 1999, Be Incorporated.   All Rights Reserved.
3 	This file may be used under the terms of the Be Sample Code License.
4 */
5 #ifndef GL_OBJECT_H
6 #define GL_OBJECT_H
7 
8 #include "ObjectView.h"
9 #include "util.h"
10 
11 struct point {
12 	float x,y,z;
13 	float nx,ny,nz;
14 	float tu,tv;
15 };
16 
17 struct tri {
18 	int p1,p2,p3;
19 };
20 
21 struct quadStrip {
22 	int numpts;
23 	int *pts;
24 };
25 
26 
27 class GLObject {
28 	public:
29 						GLObject(ObjectView* ov);
30 		virtual			~GLObject();
31 		virtual void	Draw(bool forID, float IDcolor[]);
32 		virtual bool	SpinIt();
33 		virtual void	MenuInvoked(BPoint point);
34 		virtual void	DoDrawing(bool forID) {};
35 
36 		float			rotX, rotY, spinX, spinY;
37 		float			x, y, z;
38 		int				solidity;
39 
40 	protected:
41 		float			lastRotX, lastRotY;
42 		int				color;
43 		bool			changed;
44 
45 	private:
46 		ObjectView*		fObjView;
47 };
48 
49 class TriangleObject : public GLObject {
50 	public:
51 							TriangleObject(ObjectView* ov, char* filename);
52 		virtual				~TriangleObject();
53 		virtual void		DoDrawing(bool forID);
54 
55 	private:
56 		BufferArray<point>		fPoints;
57 		BufferArray<tri>		fTriangles;
58 		BufferArray<quadStrip>	fQs;
59 };
60 
61 #endif // GL_OBJECT_H
62