1/*
2 * Copyright 2008 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Alexandre Deckner
7 *
8 */
9
10/*
11 * Original Be Sample source modified to use a quaternion for the object's orientation
12 */
13
14/*
15	Copyright 1999, Be Incorporated.   All Rights Reserved.
16	This file may be used under the terms of the Be Sample Code License.
17*/
18
19#ifndef GL_OBJECT_H
20#define GL_OBJECT_H
21
22#include "ObjectView.h"
23#include "util.h"
24#include "Quaternion.h"
25
26struct point {
27	float x,y,z;
28	float nx,ny,nz;
29	float tu,tv;
30};
31
32struct tri {
33	int p1,p2,p3;
34};
35
36struct quadStrip {
37	int numpts;
38	int *pts;
39};
40
41
42class GLObject {
43	public:
44						GLObject(ObjectView* ov);
45		virtual			~GLObject();
46		virtual void	Draw(bool forID, float IDcolor[]);
47
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;
54
55		float			x, y, z;
56		Quaternion		fRotation;
57
58	protected:
59
60		float			spinX, spinY;
61		int				solidity;
62		int				color;
63		bool			changed;
64
65	private:
66		ObjectView*		fObjView;
67};
68
69class TriangleObject : public GLObject {
70	public:
71							TriangleObject(ObjectView* ov);
72		virtual				~TriangleObject();
73		status_t			InitCheck() const;
74		virtual void		DoDrawing(bool forID);
75
76	private:
77		status_t				fStatus;
78		BufferArray<point>		fPoints;
79		BufferArray<tri>		fTriangles;
80		BufferArray<quadStrip>	fQs;
81};
82
83#endif // GL_OBJECT_H
84