annotate OrthancStone/Sources/Scene2D/Internals/OpenGLLinesProgram.h @ 1556:8898f8f755c8

typo
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 18 Aug 2020 11:58:47 +0200
parents 244ad1e4e76a
children 85e117739eca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
592
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 804
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
592
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "../../OpenGL/IOpenGLContext.h"
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "../../OpenGL/OpenGLProgram.h"
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "../../Toolbox/AffineTransform2D.h"
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "../PolylineSceneLayer.h"
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1301
diff changeset
29 #include <Compatibility.h>
1301
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1298
diff changeset
30
592
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 namespace OrthancStone
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 namespace Internals
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 class OpenGLLinesProgram : public boost::noncopyable
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 {
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 public:
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 class Data : public boost::noncopyable
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 {
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 private:
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 class Segment;
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 OpenGL::IOpenGLContext& context_;
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 592
diff changeset
44 GLuint buffers_[3];
592
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 size_t verticesCount_;
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 float thickness_;
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 public:
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 Data(OpenGL::IOpenGLContext& context,
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 const PolylineSceneLayer& layer);
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 ~Data();
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 bool IsEmpty() const
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 {
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 return verticesCount_ == 0;
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 }
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 const size_t GetVerticesCount() const
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 {
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 return verticesCount_;
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 GLuint GetVerticesBuffer() const;
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 GLuint GetMiterDirectionsBuffer() const;
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 592
diff changeset
68 GLuint GetColorsBuffer() const;
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 592
diff changeset
69
592
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 float GetThickness() const
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 {
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 return thickness_;
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 };
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 private:
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 OpenGL::IOpenGLContext& context_;
1298
8a0a62189f46 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
78 std::unique_ptr<OpenGL::OpenGLProgram> program_;
592
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 public:
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 OpenGLLinesProgram(OpenGL::IOpenGLContext& context);
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 void Apply(const Data& data,
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 const AffineTransform2D& transform,
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 bool antialiasing,
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 bool scaleIndependantThickness);
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 };
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 }
bbe29efd3d1c OpenGLLinesProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 }