Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Viewport/WebGLViewport.h @ 1553:bf02a90ca9ca
not diagnostic text
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 17 Aug 2020 13:25:54 +0200 |
parents | c54bc5bffd01 |
children | 92fca2b3ba3d |
rev | line source |
---|---|
1232
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1271
0ca50d275b9a
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
1232
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 #pragma once |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "WebAssemblyViewport.h" |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "../OpenGL/WebAssemblyOpenGLContext.h" |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 namespace OrthancStone |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 { |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 class WebGLViewport : public WebAssemblyViewport |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 { |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 private: |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 OpenGL::WebAssemblyOpenGLContext context_; |
1346
df8bf351c23f
The flag that allows the WebAssemblyViewport to
Benjamin Golinvaux <bgo@osimis.io>
parents:
1331
diff
changeset
|
33 |
1551
c54bc5bffd01
software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
34 WebGLViewport(const std::string& canvasId, |
c54bc5bffd01
software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
35 bool enableEmscriptenMouseEvents); |
1331
ab81ee8fce1f
- Viewport is not passed and stored as a shared_ptr instead
Benjamin Golinvaux <bgo@osimis.io>
parents:
1318
diff
changeset
|
36 |
1232
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 protected: |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 virtual void Paint(ICompositor& compositor, |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 ViewportController& controller) ORTHANC_OVERRIDE; |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
1483
6abd819aa534
moving edge case from WebGLViewport::UpdateSize() to WebAssemblyOpenGLContext::RefreshCanvasSize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1346
diff
changeset
|
41 virtual void UpdateSize(ICompositor& compositor) ORTHANC_OVERRIDE |
6abd819aa534
moving edge case from WebGLViewport::UpdateSize() to WebAssemblyOpenGLContext::RefreshCanvasSize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1346
diff
changeset
|
42 { |
6abd819aa534
moving edge case from WebGLViewport::UpdateSize() to WebAssemblyOpenGLContext::RefreshCanvasSize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1346
diff
changeset
|
43 context_.RefreshCanvasSize(); |
6abd819aa534
moving edge case from WebGLViewport::UpdateSize() to WebAssemblyOpenGLContext::RefreshCanvasSize()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1346
diff
changeset
|
44 } |
1232
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 public: |
1551
c54bc5bffd01
software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
47 static boost::shared_ptr<WebGLViewport> Create(const std::string& canvasId, |
c54bc5bffd01
software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
48 bool enableEmscriptenMouseEvents = true); |
1232
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 virtual ~WebGLViewport(); |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 bool IsContextLost() |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 { |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 return context_.IsContextLost(); |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 } |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 }; |
a28861abf888
viewports for WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 } |