Developer documentation
Version 3.0.3-105-gd3941f44
shaders.h
Go to the documentation of this file.
1
/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2
*
3
* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
*
7
* Covered Software is provided under this License on an "as is"
8
* basis, without warranty of any kind, either expressed, implied, or
9
* statutory, including, without limitation, warranties that the
10
* Covered Software is free of defects, merchantable, fit for a
11
* particular purpose or non-infringing.
12
* See the Mozilla Public License v. 2.0 for more details.
13
*
14
* For more details, see http://www.mrtrix.org/.
15
*/
16
17
#ifndef __gui_mrview_tool_connectome_shaders_h__
18
#define __gui_mrview_tool_connectome_shaders_h__
19
20
#include "
gui/opengl/shader.h
"
21
22
#include "
gui/mrview/tool/connectome/types.h
"
23
24
namespace
MR
25
{
26
namespace
GUI
27
{
28
namespace
MRView
29
{
30
namespace
Tool
31
{
32
33
34
class
Connectome;
35
36
37
class
ShaderBase
:
public
GL::Shader::Program
{ MEMALIGN(
ShaderBase
)
38
public
:
39
ShaderBase
() :
GL::Shader::Program
() { }
40
virtual
~ShaderBase
() { }
41
42
virtual
bool
need_update (
const
Connectome
&)
const
= 0;
43
virtual
void
update (
const
Connectome
&) = 0;
44
45
void
start
(
const
Connectome
& parent) {
46
GL::assert_context_is_current
();
47
if
(*
this
== 0 || need_update (parent)) {
48
recompile (parent);
49
}
50
GL::Shader::Program::start
();
51
GL::assert_context_is_current
();
52
}
53
54
protected
:
55
std::string
vertex_shader_source
,
geometry_shader_source
,
fragment_shader_source
;
56
bool
crop_to_slab
,
is_3D
,
use_lighting
;
57
float
slab_thickness
;
58
59
private
:
60
void
recompile (
const
Connectome
& parent);
61
};
62
63
64
65
class
NodeShader
:
public
ShaderBase
66
{ MEMALIGN(
NodeShader
)
67
public
:
68
NodeShader
() :
ShaderBase
() { }
69
~NodeShader
() { }
70
bool
need_update (
const
Connectome
&)
const override
;
71
void
update (
const
Connectome
&)
override
;
72
private
:
73
node_geometry_t
geometry;
74
node_colour_t
colour;
75
size_t
colourmap_index;
76
bool
use_alpha;
77
};
78
79
80
81
class
EdgeShader
:
public
ShaderBase
82
{ MEMALIGN(
EdgeShader
)
83
public
:
84
EdgeShader
() :
ShaderBase
() { }
85
~EdgeShader
() { }
86
bool
need_update (
const
Connectome
&)
const override
;
87
void
update (
const
Connectome
&)
override
;
88
private
:
89
edge_geometry_t
geometry;
90
edge_colour_t
colour;
91
size_t
colourmap_index;
92
bool
use_alpha;
93
};
94
95
96
97
}
98
}
99
}
100
}
101
102
#endif
103
104
105
106
MR::GUI::GL::Shader::Program
Definition:
shader.h:98
MR::GUI::GL::Shader::Program::start
void start() const
Definition:
shader.h:147
MR::GUI::MRView::Tool::Connectome
Definition:
connectome.h:70
MR::GUI::MRView::Tool::EdgeShader
Definition:
shaders.h:82
MR::GUI::MRView::Tool::NodeShader
Definition:
shaders.h:66
MR::GUI::MRView::Tool::ShaderBase
Definition:
shaders.h:37
MR::GUI::MRView::Tool::ShaderBase::is_3D
bool is_3D
Definition:
shaders.h:56
MR::GUI::MRView::Tool::ShaderBase::crop_to_slab
bool crop_to_slab
Definition:
shaders.h:56
MR::GUI::MRView::Tool::ShaderBase::slab_thickness
float slab_thickness
Definition:
shaders.h:57
MR::GUI::MRView::Tool::ShaderBase::fragment_shader_source
std::string fragment_shader_source
Definition:
shaders.h:55
MR::GUI::MRView::Tool::ShaderBase::vertex_shader_source
std::string vertex_shader_source
Definition:
shaders.h:55
MR::GUI::MRView::Tool::ShaderBase::geometry_shader_source
std::string geometry_shader_source
Definition:
shaders.h:55
MR::GUI::MRView::Tool::ShaderBase::use_lighting
bool use_lighting
Definition:
shaders.h:56
MR::GUI::GL::assert_context_is_current
void assert_context_is_current(QWidget *glarea=nullptr)
Definition:
gl.h:100
MR::GUI::MRView::Tool::edge_colour_t
edge_colour_t
Definition:
types.h:44
MR::GUI::MRView::Tool::edge_geometry_t
edge_geometry_t
Definition:
types.h:43
MR::GUI::MRView::Tool::node_geometry_t
node_geometry_t
Definition:
types.h:37
MR::GUI::MRView::Tool::node_colour_t
node_colour_t
Definition:
types.h:38
MR
Definition:
base.h:24
shader.h
types.h
src
gui
mrview
tool
connectome
shaders.h
Generated on Mon Jul 4 2022 08:00:07 for MRtrix by
1.9.3