xref: /haiku/src/apps/glteapot/ObjectView.h (revision d9cebac2b77547b7064f22497514eecd2d047160)
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 
6 #ifndef OBJECT_VIEW_H
7 #define OBJECT_VIEW_H
8 
9 #include <GL/glu.h>
10 #include <GLView.h>
11 
12 #define bmsgFPS	        'fps '
13 #define bmsgAddModel	'addm'
14 #define bmsgGouraud		'gour'
15 #define bmsgZBuffer		'zbuf'
16 #define bmsgCulling 	'cull'
17 #define bmsgTextured	'txtr'
18 #define bmsgFog			'fog '
19 #define bmsgLighting	'lite'
20 #define bmsgLights		'lits'
21 #define bmsgFilled		'fill'
22 #define bmsgPerspective	'prsp'
23 
24 enum lights {
25 	lightNone = 0,
26 	lightWhite,
27 	lightYellow,
28 	lightRed,
29 	lightBlue,
30 	lightGreen
31 };
32 
33 #define HISTSIZE 10
34 
35 class ResScroll;
36 
37 class ObjectView : public BGLView {
38 	public:
39 						ObjectView(BRect r, char *name,
40 							ulong resizingMode, ulong options);
41 						~ObjectView();
42 
43 		virtual	void	MouseDown(BPoint p);
44 		virtual	void	MessageReceived(BMessage *msg);
45 		virtual	void	AttachedToWindow();
46 		virtual	void	DetachedFromWindow();
47 		virtual	void	FrameResized(float width, float height);
48 				bool	SpinIt();
49 				int		ObjectAtPoint(BPoint p);
50 		virtual	void	DrawFrame(bool noPause);
51 		virtual	void	Pulse();
52 				void	EnforceState();
53 				bool	RepositionView();
54 
55 		sem_id			drawEvent;
56 		sem_id			quittingSem;
57 		thread_id		drawThread;
58 		ResScroll *		resScroll;
59 
60 		BList			objects;
61 		BLocker         objListLock;
62 
63 		float           yxRatio,lastYXRatio;
64 		uint64          lastFrame;
65 		float           fpsHistory[HISTSIZE];
66 		int32           histEntries,oldestEntry;
67 		bool            fps;
68 		bool			gouraud, lastGouraud;
69 		bool			zbuf,lastZbuf;
70 		bool			culling,lastCulling;
71 		bool			lighting,lastLighting;
72 		bool			filled,lastFilled;
73 		bool			persp,lastPersp;
74 		bool			lastTextured,textured;
75 		bool			lastFog,fog;
76 		bool			forceRedraw;
77 		float			objectDistance,lastObjectDistance;
78 
79 };
80 
81 #endif // OBJECT_VIEW_H
82