repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / apps / glteapot / ObjectView.h
blobfc7b59a6438dd9a19cde20bd9369ba0fa5bc0a14
1 /*
2 * Copyright 2008 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 */
7 /*
8 Copyright 1999, Be Incorporated. All Rights Reserved.
9 This file may be used under the terms of the Be Sample Code License.
12 #ifndef OBJECT_VIEW_H
13 #define OBJECT_VIEW_H
15 #include <GL/glu.h>
16 #include <GLView.h>
18 #define kMsgFPS 'fps '
19 #define kMsgAddModel 'addm'
20 #define kMsgGouraud 'gour'
21 #define kMsgZBuffer 'zbuf'
22 #define kMsgCulling 'cull'
23 #define kMsgTextured 'txtr'
24 #define kMsgFog 'fog '
25 #define kMsgLighting 'lite'
26 #define kMsgLights 'lits'
27 #define kMsgFilled 'fill'
28 #define kMsgPerspective 'prsp'
30 enum lights {
31 lightNone = 0,
32 lightWhite,
33 lightYellow,
34 lightRed,
35 lightBlue,
36 lightGreen
39 #define HISTSIZE 10
41 class ResScroll;
42 class GLObject;
44 struct TrackingInfo {
45 float lastX;
46 float lastY;
47 float lastDx;
48 float lastDy;
49 bool isTracking;
50 GLObject *pickedObject;
51 uint32 buttons;
54 class ObjectView : public BGLView {
55 public:
56 ObjectView(BRect rect, const char* name,
57 ulong resizingMode, ulong options);
58 ~ObjectView();
60 virtual void MouseDown(BPoint point);
61 virtual void MouseUp(BPoint point);
62 virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *msg);
64 virtual void MessageReceived(BMessage* msg);
65 virtual void AttachedToWindow();
66 virtual void DetachedFromWindow();
67 virtual void FrameResized(float width, float height);
68 bool SpinIt();
69 int ObjectAtPoint(const BPoint &point);
70 virtual void DrawFrame(bool noPause);
71 virtual void Pulse();
72 void EnforceState();
73 bool RepositionView();
75 sem_id drawEvent;
76 sem_id quittingSem;
78 private:
79 thread_id fDrawThread;
80 ResScroll* fResScroll;
81 BList fObjects;
82 BLocker fObjListLock;
83 uint64 fLastFrame;
84 int32 fHistEntries,fOldestEntry;
85 bool fFps, fLastGouraud, fGouraud;
86 bool fLastZbuf, fZbuf, fLastCulling, fCulling;
87 bool fLastLighting, fLighting, fLastFilled, fFilled;
88 bool fLastPersp, fPersp, fLastTextured, fTextured;
89 bool fLastFog, fFog, fForceRedraw;
90 float fLastYXRatio, fYxRatio, fFpsHistory[HISTSIZE];
91 float fObjectDistance, fLastObjectDistance;
92 TrackingInfo fTrackingInfo;
95 #endif // OBJECT_VIEW_H