vfs: check userland buffers before reading them.
[haiku.git] / src / apps / glteapot / GLObject.h
blobb1afe982c1532fcdae0394ca89c260b029514a3c
1 /*
2 * Copyright 2008 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Alexandre Deckner
8 */
11 * Original Be Sample source modified to use a quaternion for the object's orientation
15 Copyright 1999, Be Incorporated. All Rights Reserved.
16 This file may be used under the terms of the Be Sample Code License.
19 #ifndef GL_OBJECT_H
20 #define GL_OBJECT_H
22 #include "ObjectView.h"
23 #include "util.h"
24 #include "Quaternion.h"
26 struct point {
27 float x,y,z;
28 float nx,ny,nz;
29 float tu,tv;
32 struct tri {
33 int p1,p2,p3;
36 struct quadStrip {
37 int numpts;
38 int *pts;
42 class GLObject {
43 public:
44 GLObject(ObjectView* ov);
45 virtual ~GLObject();
46 virtual void Draw(bool forID, float IDcolor[]);
48 virtual bool SpinIt();
49 void Spin(float rx, float ry);
50 void RotateWorldSpace(float rx, float ry);
51 virtual void MenuInvoked(BPoint point);
52 virtual void DoDrawing(bool forID) {};
53 int Solidity() const;
55 float x, y, z;
56 Quaternion fRotation;
58 protected:
60 float spinX, spinY;
61 int solidity;
62 int color;
63 bool changed;
65 private:
66 ObjectView* fObjView;
69 class TriangleObject : public GLObject {
70 public:
71 TriangleObject(ObjectView* ov);
72 virtual ~TriangleObject();
73 status_t InitCheck() const;
74 virtual void DoDrawing(bool forID);
76 private:
77 status_t fStatus;
78 BufferArray<point> fPoints;
79 BufferArray<tri> fTriangles;
80 BufferArray<quadStrip> fQs;
83 #endif // GL_OBJECT_H