xref: /haiku/src/apps/haiku3d/RenderView.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1 /*
2  * Copyright 2009, Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  * 		Alexandre Deckner <alex@zappotek.com>
7  */
8 #ifndef _RENDERVIEW_H
9 #define _RENDERVIEW_H
10 
11 #include <GLView.h>
12 
13 #include <vector>
14 
15 
16 class Camera;
17 class MeshInstance;
18 
19 
20 class RenderView : public BGLView {
21 public:
22 					RenderView(BRect frame);
23 					~RenderView();
24 
25 	virtual void	AttachedToWindow();
26 	virtual void	DetachedFromWindow();
27 	virtual void	FrameResized(float width, float height);
28 	virtual	void	ErrorCallback(unsigned long error);
29 
30 protected:
31 	void			_InitGL();
32 	void			_CreateScene();
33 	void			_DeleteScene();
34 	void			_UpdateViewport();
35 	void			_UpdateCamera();
36 	bool			_Render();
37 	uint32			_CreateRenderThread();
38 	void			_StopRenderThread();
39 	static int32	_RenderThreadEntry(void* pointer);
40 	int32			_RenderLoop();
41 
42 	Camera*			fMainCamera;
43 
44 	typedef std::vector<MeshInstance*> MeshInstanceList;
45 	MeshInstanceList	fMeshInstances;
46 
47 	thread_id		fRenderThread;
48 	bool			fStopRendering;
49 
50 	BPoint			fRes, fNextRes;
51 	bigtime_t		fLastFrameTime;
52 };
53 
54 #endif /* _RENDERVIEW_H */
55