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 FrameResized(float width, float height); 27 virtual void ErrorCallback(unsigned long error); 28 29 protected: 30 void _InitGL(); 31 void _CreateScene(); 32 void _DeleteScene(); 33 void _UpdateViewport(); 34 void _UpdateCamera(); 35 bool _Render(); 36 uint32 _CreateRenderThread(); 37 void _StopRenderThread(); 38 static int32 _RenderThreadEntry(void* pointer); 39 int32 _RenderLoop(); 40 41 Camera* fMainCamera; 42 43 typedef std::vector<MeshInstance*> MeshInstanceList; 44 MeshInstanceList fMeshInstances; 45 46 thread_id fRenderThread; 47 bool fStopRendering; 48 49 BPoint fRes, fNextRes; 50 bigtime_t fLastFrameTime; 51 }; 52 53 #endif /* _RENDERVIEW_H */ 54