Mercurial > hg > orthanc-stone
comparison Framework/Viewport/WebAssemblyViewport.h @ 907:722ee73e6ba2
cleanup + started to implement WebAssemblyCairoViewport (wip)
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Thu, 18 Jul 2019 09:19:39 +0200 |
parents | 88bf49aebc13 |
children | a6c12fe88bcb |
comparison
equal
deleted
inserted
replaced
905:88bf49aebc13 | 907:722ee73e6ba2 |
---|---|
21 | 21 |
22 #pragma once | 22 #pragma once |
23 | 23 |
24 #include "../OpenGL/WebAssemblyOpenGLContext.h" | 24 #include "../OpenGL/WebAssemblyOpenGLContext.h" |
25 #include "../Scene2D/OpenGLCompositor.h" | 25 #include "../Scene2D/OpenGLCompositor.h" |
26 #include "../Scene2D/CairoCompositor.h" | |
26 #include "ViewportBase.h" | 27 #include "ViewportBase.h" |
27 | 28 |
28 namespace OrthancStone | 29 namespace OrthancStone |
29 { | 30 { |
30 class WebAssemblyViewport : public ViewportBase | 31 class WebAssemblyViewport : public ViewportBase |
31 { | 32 { |
33 public: | |
34 WebAssemblyViewport(const std::string& identifier) | |
35 : ViewportBase(identifier) | |
36 { | |
37 } | |
38 | |
39 WebAssemblyViewport(const std::string& identifier, | |
40 boost::shared_ptr<Scene2D>& scene) | |
41 : ViewportBase(identifier, scene) | |
42 { | |
43 } | |
44 }; | |
45 | |
46 class WebAssemblyOpenGLViewport : public WebAssemblyViewport | |
47 { | |
32 private: | 48 private: |
33 OpenGL::WebAssemblyOpenGLContext context_; | 49 OpenGL::WebAssemblyOpenGLContext context_; |
34 OpenGLCompositor compositor_; | 50 OpenGLCompositor compositor_; |
35 | 51 |
36 public: | 52 public: |
37 WebAssemblyViewport(const std::string& canvas); | 53 WebAssemblyOpenGLViewport(const std::string& canvas); |
38 | 54 |
39 WebAssemblyViewport(const std::string& canvas, | 55 WebAssemblyOpenGLViewport(const std::string& canvas, |
40 boost::shared_ptr<Scene2D>& scene); | 56 boost::shared_ptr<Scene2D>& scene); |
41 | 57 |
42 // This function must be called each time the browser window is resized | 58 // This function must be called each time the browser window is resized |
43 void UpdateSize(); | 59 void UpdateSize(); |
44 | 60 |
45 ICompositor& GetCompositor() | 61 virtual ICompositor& GetCompositor() |
46 { | 62 { |
47 return compositor_; | 63 return compositor_; |
48 } | 64 } |
49 }; | 65 }; |
66 | |
67 class WebAssemblyCairoViewport : public WebAssemblyViewport | |
68 { | |
69 private: | |
70 CairoCompositor compositor_; | |
71 | |
72 public: | |
73 WebAssemblyCairoViewport(const std::string& canvas, | |
74 unsigned int width, | |
75 unsigned int height); | |
76 | |
77 WebAssemblyCairoViewport(const std::string& canvas, | |
78 boost::shared_ptr<Scene2D>& scene, | |
79 unsigned int width, | |
80 unsigned int height); | |
81 | |
82 // This function must be called each time the browser window is resized | |
83 void UpdateSize(); // TODO: implement | |
84 | |
85 // TODO: implement Refresh | |
86 virtual ICompositor& GetCompositor() | |
87 { | |
88 return compositor_; | |
89 } | |
90 }; | |
91 | |
50 } | 92 } |