Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
3bf37922
Commit
3bf37922
authored
Apr 29, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GL3 Lines shaders
parent
116f2b83
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
806 additions
and
123 deletions
+806
-123
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.frag
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.frag
+17
-0
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.geom
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.geom
+39
-0
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.h
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.h
+88
-0
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.vert
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.vert
+15
-0
CGoGN/include/Utils/Shaders/shaderBold3DLines.frag
CGoGN/include/Utils/Shaders/shaderBold3DLines.frag
+14
-0
CGoGN/include/Utils/Shaders/shaderBold3DLines.geom
CGoGN/include/Utils/Shaders/shaderBold3DLines.geom
+32
-0
CGoGN/include/Utils/Shaders/shaderBold3DLines.h
CGoGN/include/Utils/Shaders/shaderBold3DLines.h
+85
-0
CGoGN/include/Utils/Shaders/shaderBold3DLines.vert
CGoGN/include/Utils/Shaders/shaderBold3DLines.vert
+12
-0
CGoGN/include/Utils/Shaders/shaderBoldColorLines.geom
CGoGN/include/Utils/Shaders/shaderBoldColorLines.geom
+47
-27
CGoGN/include/Utils/Shaders/shaderBoldColorLines.h
CGoGN/include/Utils/Shaders/shaderBoldColorLines.h
+0
-3
CGoGN/include/Utils/Shaders/shaderBoldColorLines.vert
CGoGN/include/Utils/Shaders/shaderBoldColorLines.vert
+2
-2
CGoGN/include/Utils/Shaders/shaderBoldLines.geom
CGoGN/include/Utils/Shaders/shaderBoldLines.geom
+41
-21
CGoGN/include/Utils/Shaders/shaderBoldLines.h
CGoGN/include/Utils/Shaders/shaderBoldLines.h
+0
-3
CGoGN/include/Utils/Shaders/shaderBoldLines.vert
CGoGN/include/Utils/Shaders/shaderBoldLines.vert
+2
-2
CGoGN/include/Utils/drawer.h
CGoGN/include/Utils/drawer.h
+8
-2
CGoGN/src/Utils/Shaders/shaderBold3DColorLines.cpp
CGoGN/src/Utils/Shaders/shaderBold3DColorLines.cpp
+155
-0
CGoGN/src/Utils/Shaders/shaderBold3DLines.cpp
CGoGN/src/Utils/Shaders/shaderBold3DLines.cpp
+141
-0
CGoGN/src/Utils/Shaders/shaderBoldColorLines.cpp
CGoGN/src/Utils/Shaders/shaderBoldColorLines.cpp
+5
-16
CGoGN/src/Utils/Shaders/shaderBoldLines.cpp
CGoGN/src/Utils/Shaders/shaderBoldLines.cpp
+6
-18
CGoGN/src/Utils/drawer.cpp
CGoGN/src/Utils/drawer.cpp
+96
-27
SCHNApps/include/mapHandler.hpp
SCHNApps/include/mapHandler.hpp
+0
-1
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+1
-1
No files found.
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.frag
0 → 100644
View file @
3bf37922
// ShaderBold3DColorLines::fragmentShaderText
PRECISION
;
VARYING_FRAG
vec3
fragColor
;
uniform
float
alpha
;
uniform
vec4
planeClip
;
VARYING_FRAG
vec3
fragClip
;
FRAG_OUT_DEF
;
void
main
()
{
if
(
dot
(
planeClip
,
vec4
(
fragClip
,
1
.
0
))
>
0
.
0
)
discard
;
FRAG_OUT
=
vec4
(
fragColor
,
alpha
);
}
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.geom
0 → 100644
View file @
3bf37922
// ShaderBold3DColorLines::geometryShaderText
uniform
float
lineWidth
;
uniform
mat4
ProjectionMatrix
;
VARYING_IN
vec3
vcolor
[];
VARYING_OUT
vec3
fragColor
;
VARYING_IN
vec3
posClip
[];
VARYING_OUT
vec3
fragClip
;
void
main
()
{
vec4
Ap
=
(
ProjectionMatrix
*
POSITION_IN
(
0
));
vec4
Bp
=
(
ProjectionMatrix
*
POSITION_IN
(
1
));
vec3
U3
=
normalize
((
Bp
.
xyz
/
Bp
.
w
-
Ap
.
xyz
/
Ap
.
w
));
vec3
U
=
vec3
(
lineWidth
*
U3
);
vec3
V
=
vec3
(
lineWidth
*
normalize
(
vec2
(
U
[
1
],
-
U
[
0
])),
0
.
0
);
fragClip
=
posClip
[
0
];
fragColor
=
vcolor
[
0
];
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
0
).
xyz
-
U
,
1
.
0
);
EmitVertex
();
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
0
).
xyz
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
0
).
xyz
-
V
,
1
.
0
);
EmitVertex
();
fragClip
=
posClip
[
1
];
fragColor
=
vcolor
[
1
];
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
1
).
xyz
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
1
).
xyz
-
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
1
).
xyz
+
U
,
1
.
0
);
EmitVertex
();
EndPrimitive
();
}
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.h
0 → 100644
View file @
3bf37922
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __CGOGN_SHADER_BOLD3DCOLORLINES__
#define __CGOGN_SHADER_BOLD3DCOLORLINES__
#include "Utils/GLSLShader.h"
#include "Utils/clippingShader.h"
#include "Geometry/vector_gen.h"
#include "Utils/dll.h"
namespace
CGoGN
{
namespace
Utils
{
class
CGoGN_UTILS_API
ShaderBold3DColorLines
:
public
ClippingShader
{
protected:
// shader sources
static
std
::
string
vertexShaderText
;
static
std
::
string
geometryShaderText
;
static
std
::
string
fragmentShaderText
;
CGoGNGLuint
m_uniform_lineWidth
;
CGoGNGLuint
m_unif_alpha
;
float
m_lineWidth
;
VBO
*
m_vboPos
;
VBO
*
m_vboCol
;
float
m_opacity
;
/// clipping
CGoGNGLuint
m_unif_planeClip
;
Geom
::
Vec4f
m_planeClip
;
void
getLocations
();
void
sendParams
();
void
restoreUniformsAttribs
();
public:
ShaderBold3DColorLines
();
void
setLineWidth
(
float
pix
);
void
setOpacity
(
float
op
);
unsigned
int
setAttributeColor
(
VBO
*
vbo
);
unsigned
int
setAttributePosition
(
VBO
*
vbo
);
void
setClippingPlane
(
const
Geom
::
Vec4f
&
plane
);
inline
void
setNoClippingPlane
()
{
setClippingPlane
(
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
));
}
};
}
// namespace Utils
}
// namespace CGoGN
#endif
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.vert
0 → 100644
View file @
3bf37922
// ShaderBold3DColorLines::vertexShaderText
ATTRIBUTE
vec3
VertexPosition
;
ATTRIBUTE
vec3
VertexColor
;
uniform
mat4
ModelViewMatrix
;
VARYING_VERT
vec3
vcolor
;
VARYING_VERT
vec3
posClip
;
INVARIANT_POS
;
void
main
()
{
posClip
=
VertexPosition
;
vcolor
=
VertexColor
;
gl_Position
=
ModelViewMatrix
*
vec4
(
VertexPosition
,
1
.
0
);
}
CGoGN/include/Utils/Shaders/shaderBold3DLines.frag
0 → 100644
View file @
3bf37922
// ShaderBold3DLines::fragmentShaderText
PRECISION
;
uniform
vec4
lineColor
;
uniform
vec4
planeClip
;
VARYING_FRAG
vec3
fragClip
;
FRAG_OUT_DEF
;
void
main
()
{
if
(
dot
(
planeClip
,
vec4
(
fragClip
,
1
.
0
))
>
0
.
0
)
discard
;
FRAG_OUT
=
lineColor
;
}
CGoGN/include/Utils/Shaders/shaderBold3DLines.geom
0 → 100644
View file @
3bf37922
// ShaderBold3DLines::geometryShaderText
uniform
mat4
ProjectionMatrix
;
uniform
float
lineWidth
;
VARYING_IN
vec3
posClip
[];
VARYING_OUT
vec3
fragClip
;
void
main
()
{
vec4
Ap
=
(
ProjectionMatrix
*
POSITION_IN
(
0
));
vec4
Bp
=
(
ProjectionMatrix
*
POSITION_IN
(
1
));
vec3
U3
=
normalize
((
Bp
.
xyz
/
Bp
.
w
-
Ap
.
xyz
/
Ap
.
w
));
vec3
U
=
vec3
(
lineWidth
*
U3
);
vec3
V
=
vec3
(
lineWidth
*
normalize
(
vec2
(
U
[
1
],
-
U
[
0
])),
0
.
0
);
fragClip
=
posClip
[
0
];
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
0
).
xyz
-
U
,
1
.
0
);
EmitVertex
();
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
0
).
xyz
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
0
).
xyz
-
V
,
1
.
0
);
EmitVertex
();
fragClip
=
posClip
[
1
];
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
1
).
xyz
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
1
).
xyz
-
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
ProjectionMatrix
*
vec4
(
POSITION_IN
(
1
).
xyz
+
U
,
1
.
0
);
EmitVertex
();
EndPrimitive
();
}
CGoGN/include/Utils/Shaders/shaderBold3DLines.h
0 → 100644
View file @
3bf37922
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __CGOGN_SHADER_BOLD3DLINES__
#define __CGOGN_SHADER_BOLD3DLINES__
#include "Utils/GLSLShader.h"
#include "Utils/clippingShader.h"
#include "Geometry/vector_gen.h"
#include "Utils/dll.h"
namespace
CGoGN
{
namespace
Utils
{
class
CGoGN_UTILS_API
ShaderBold3DLines
:
public
ClippingShader
{
protected:
// shader sources
static
std
::
string
vertexShaderText
;
static
std
::
string
geometryShaderText
;
static
std
::
string
fragmentShaderText
;
CGoGNGLuint
m_uniform_lineWidth
;
CGoGNGLuint
m_uniform_color
;
float
m_lineWidth
;
Geom
::
Vec4f
m_color
;
VBO
*
m_vboPos
;
/// clipping
CGoGNGLuint
m_unif_planeClip
;
Geom
::
Vec4f
m_planeClip
;
void
getLocations
();
void
sendParams
();
void
restoreUniformsAttribs
();
public:
ShaderBold3DLines
();
void
setLineWidth
(
float
pix
);
void
setColor
(
const
Geom
::
Vec4f
&
color
);
unsigned
int
setAttributePosition
(
VBO
*
vbo
);
void
setClippingPlane
(
const
Geom
::
Vec4f
&
plane
);
inline
void
setNoClippingPlane
()
{
setClippingPlane
(
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
));
}
};
}
// namespace Utils
}
// namespace CGoGN
#endif
CGoGN/include/Utils/Shaders/shaderBold3DLines.vert
0 → 100644
View file @
3bf37922
// ShaderBold3DLines::vertexShaderText
ATTRIBUTE
vec3
VertexPosition
;
uniform
mat4
ModelViewMatrix
;
VARYING_VERT
vec3
posClip
;
INVARIANT_POS
;
void
main
()
{
posClip
=
VertexPosition
;
gl_Position
=
ModelViewMatrix
*
vec4
(
VertexPosition
,
1
.
0
);
}
CGoGN/include/Utils/Shaders/shaderBoldColorLines.geom
View file @
3bf37922
// ShaderBoldColorLines::geometryShaderText
uniform
vec2
lineWidth
;
uniform
vec2
lineWidths
;
uniform
mat4
ProjectionMatrix
;
VARYING_IN
vec3
vcolor
[];
VARYING_OUT
vec3
fragColor
;
...
...
@@ -10,30 +11,49 @@ VARYING_OUT vec3 fragClip;
void
main
()
{
vec3
A
=
POSITION_IN
(
0
).
xyz
/
abs
(
POSITION_IN
(
0
).
w
);
vec3
B
=
POSITION_IN
(
1
).
xyz
/
abs
(
POSITION_IN
(
1
).
w
);
vec3
U
=
normalize
(
B
-
A
);
vec3
V
=
cross
(
U
,
vec3
(
0
.
0
,
0
.
0
,
1
.
0
));
vec3
LW
=
vec3
(
lineWidth
,
1
.
0
);
fragClip
=
posClip
[
0
];
fragColor
=
vcolor
[
0
];
gl_Position
=
vec4
(
A
-
U
*
LW
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
+
V
*
LW
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
-
V
*
LW
,
1
.
0
);
EmitVertex
();
fragColor
=
vcolor
[
1
];
fragClip
=
posClip
[
1
];
gl_Position
=
vec4
(
B
+
V
*
LW
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
B
-
V
*
LW
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
B
+
U
*
LW
,
1
.
0
);
EmitVertex
();
EndPrimitive
();
vec4
A
=
POSITION_IN
(
0
);
vec4
B
=
POSITION_IN
(
1
);
// float nearZ = - ProjectionMatrix[3][2] / (ProjectionMatrix[2][2] - 1.0);
float
nearZ
=
1
.
0
;
if
(
ProjectionMatrix
[
2
][
2
]
!=
1
.
0
)
nearZ
=
-
ProjectionMatrix
[
3
][
2
]
/
(
ProjectionMatrix
[
2
][
2
]
-
1
.
0
);
if
((
A
.
z
<
nearZ
)
||
(
B
.
z
<
nearZ
))
{
if
(
A
.
z
>=
nearZ
)
A
=
B
+
(
A
-
B
)
*
(
nearZ
-
B
.
z
)
/
(
A
.
z
-
B
.
z
);
if
(
B
.
z
>=
nearZ
)
B
=
A
+
(
B
-
A
)
*
(
nearZ
-
A
.
z
)
/
(
B
.
z
-
A
.
z
);
A
=
ProjectionMatrix
*
A
;
B
=
ProjectionMatrix
*
B
;
A
=
A
/
A
.
w
;
B
=
B
/
B
.
w
;
vec2
U2
=
normalize
((
B
.
xyz
-
A
.
xyz
).
xy
);
vec3
U
=
vec3
(
lineWidths
*
U2
,
0
.
0
);
vec3
V
=
vec3
(
lineWidths
*
vec2
(
U2
[
1
],
-
U2
[
0
]),
0
.
0
);
U2
*=
(
lineWidths
[
0
]
+
lineWidths
[
1
])
/
4
.
0
;
fragClip
=
posClip
[
0
];
fragColor
=
vcolor
[
0
];
A
-=
vec4
(
U2
,
0
.
0
,
0
.
0
);
gl_Position
=
vec4
(
A
.
xyz
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
.
xyz
-
V
,
1
.
0
);
EmitVertex
();
fragClip
=
posClip
[
1
];
fragColor
=
vcolor
[
1
];
B
+=
vec4
(
U2
,
0
.
0
,
0
.
0
);
gl_Position
=
vec4
(
B
.
xyz
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
B
.
xyz
-
V
,
1
.
0
);
EmitVertex
();
EndPrimitive
();
}
}
CGoGN/include/Utils/Shaders/shaderBoldColorLines.h
View file @
3bf37922
...
...
@@ -49,7 +49,6 @@ protected:
CGoGNGLuint
m_unif_alpha
;
Geom
::
Vec2f
m_lineWidth
;
float
m_pixWidth
;
VBO
*
m_vboPos
;
VBO
*
m_vboCol
;
...
...
@@ -71,8 +70,6 @@ public:
void
setLineWidth
(
float
pix
);
void
updatePixelWidth
();
void
setOpacity
(
float
op
);
unsigned
int
setAttributeColor
(
VBO
*
vbo
);
...
...
CGoGN/include/Utils/Shaders/shaderBoldColorLines.vert
View file @
3bf37922
...
...
@@ -2,7 +2,7 @@
ATTRIBUTE
vec3
VertexPosition
;
ATTRIBUTE
vec3
VertexColor
;
uniform
mat4
ModelView
Projection
Matrix
;
uniform
mat4
ModelViewMatrix
;
VARYING_VERT
vec3
vcolor
;
VARYING_VERT
vec3
posClip
;
...
...
@@ -11,5 +11,5 @@ void main ()
{
posClip
=
VertexPosition
;
vcolor
=
VertexColor
;
gl_Position
=
ModelView
Projection
Matrix
*
vec4
(
VertexPosition
,
1
.
0
);
gl_Position
=
ModelViewMatrix
*
vec4
(
VertexPosition
,
1
.
0
);
}
CGoGN/include/Utils/Shaders/shaderBoldLines.geom
View file @
3bf37922
// ShaderBoldLines::geometryShaderText
uniform
vec2
lineWidth
;
uniform
mat4
ProjectionMatrix
;
uniform
vec2
lineWidths
;
VARYING_IN
vec3
posClip
[];
VARYING_OUT
vec3
fragClip
;
void
main
()
{
vec3
A
=
POSITION_IN
(
0
).
xyz
/
abs
(
POSITION_IN
(
0
).
w
);
vec3
B
=
POSITION_IN
(
1
).
xyz
/
abs
(
POSITION_IN
(
1
).
w
);
vec4
A
=
POSITION_IN
(
0
);
vec4
B
=
POSITION_IN
(
1
);
float
nearZ
=
1
.
0
;
if
(
ProjectionMatrix
[
2
][
2
]
!=
1
.
0
)
nearZ
=
-
ProjectionMatrix
[
3
][
2
]
/
(
ProjectionMatrix
[
2
][
2
]
-
1
.
0
);
vec3
U
=
normalize
(
B
-
A
);
vec3
V
=
cross
(
U
,
vec3
(
0
.
0
,
0
.
0
,
1
.
0
));
if
((
A
.
z
<
nearZ
)
||
(
B
.
z
<
nearZ
))
{
if
(
A
.
z
>=
nearZ
)
A
=
B
+
(
A
-
B
)
*
(
nearZ
-
B
.
z
)
/
(
A
.
z
-
B
.
z
);
if
(
B
.
z
>=
nearZ
)
B
=
A
+
(
B
-
A
)
*
(
nearZ
-
A
.
z
)
/
(
B
.
z
-
A
.
z
);
vec3
LW
=
vec3
(
lineWidth
,
1
.
0
);
fragClip
=
posClip
[
0
];
gl_Position
=
vec4
(
A
-
U
*
LW
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
+
V
*
LW
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
-
V
*
LW
,
1
.
0
);
EmitVertex
();
fragClip
=
posClip
[
1
];
gl_Position
=
vec4
(
B
+
V
*
LW
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
B
-
V
*
LW
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
B
+
U
*
LW
,
1
.
0
);
EmitVertex
();
EndPrimitive
();
A
=
ProjectionMatrix
*
A
;
B
=
ProjectionMatrix
*
B
;
A
=
A
/
A
.
w
;
B
=
B
/
B
.
w
;
vec2
U2
=
normalize
((
B
.
xyz
-
A
.
xyz
).
xy
);
vec3
U
=
vec3
(
lineWidths
*
U2
,
0
.
0
);
vec3
V
=
vec3
(
lineWidths
*
vec2
(
U2
[
1
],
-
U2
[
0
]),
0
.
0
);
U2
*=
(
lineWidths
[
0
]
+
lineWidths
[
1
])
/
4
.
0
;
fragClip
=
posClip
[
0
];
A
-=
vec4
(
U2
,
0
.
0
,
0
.
0
);
gl_Position
=
vec4
(
A
.
xyz
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
.
xyz
-
V
,
1
.
0
);
EmitVertex
();
fragClip
=
posClip
[
1
];
B
+=
vec4
(
U2
,
0
.
0
,
0
.
0
);
gl_Position
=
vec4
(
B
.
xyz
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
B
.
xyz
-
V
,
1
.
0
);
EmitVertex
();
EndPrimitive
();
}
}
CGoGN/include/Utils/Shaders/shaderBoldLines.h
View file @
3bf37922
...
...
@@ -49,7 +49,6 @@ protected:
CGoGNGLuint
m_uniform_color
;
Geom
::
Vec2f
m_lineWidth
;
float
m_pixWidth
;
Geom
::
Vec4f
m_color
;
...
...
@@ -70,8 +69,6 @@ public:
void
setLineWidth
(
float
pix
);
void
updatePixelWidth
();
void
setColor
(
const
Geom
::
Vec4f
&
color
);
unsigned
int
setAttributePosition
(
VBO
*
vbo
);
...
...
CGoGN/include/Utils/Shaders/shaderBoldLines.vert
View file @
3bf37922
// ShaderBoldLines::vertexShaderText
ATTRIBUTE
vec3
VertexPosition
;
uniform
mat4
ModelView
Projection
Matrix
;
uniform
mat4
ModelViewMatrix
;
VARYING_VERT
vec3
posClip
;
INVARIANT_POS
;
void
main
()
{
posClip
=
VertexPosition
;
gl_Position
=
ModelView
Projection
Matrix
*
vec4
(
VertexPosition
,
1
.
0
);
gl_Position
=
ModelViewMatrix
*
vec4
(
VertexPosition
,
1
.
0
);
}
CGoGN/include/Utils/drawer.h
View file @
3bf37922
...
...
@@ -30,6 +30,7 @@
#include "Geometry/vector_gen.h"
#include "Utils/Shaders/shaderColorPerVertex.h"
#include "Utils/Shaders/shaderBoldColorLines.h"
#include "Utils/Shaders/shaderBold3DColorLines.h"
namespace
CGoGN
{
namespace
Utils
{
class
VBO
;
}
}
namespace
CGoGN
{
namespace
Utils
{
namespace
SVG
{
class
SVGOut
;
}
}
}
...
...
@@ -71,21 +72,26 @@ protected:
float
m_currentSize
;
GLenum
m_compile
;
Utils
::
ShaderColorPerVertex
*
m_shader
;
Utils
::
ShaderBoldColorLines
*
m_shader2
;
Utils
::
ShaderBoldColorLines
*
m_shaderCL
;
Utils
::
ShaderBold3DColorLines
*
m_shader3DCL
;
int
m_lineMode
;
public:
/**
* constructor, init all buffers (data and OpenGL) and shader
* @param lineMode 0:simple thin Line / 1:line with possible width /2:3D Lines
* @Warning need OpenGL context
*/
Drawer
();
Drawer
(
int
lineMode
=
0
);
/**
* release buffers and shader
*/
~
Drawer
();
// Utils::ShaderColorPerVertex* getShader();
std
::
vector
<
Utils
::
GLSLShader
*>
getShaders
();
...
...
CGoGN/src/Utils/Shaders/shaderBold3DColorLines.cpp
0 → 100644
View file @
3bf37922
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#define CGoGN_UTILS_DLL_EXPORT 1
#include "Utils/Shaders/shaderBold3DColorLines.h"
#include <algorithm>
namespace
CGoGN
{
namespace
Utils
{
#include "ShaderBold3DColorLines.vert"
#include "ShaderBold3DColorLines.geom"
#include "ShaderBold3DColorLines.frag"
ShaderBold3DColorLines
::
ShaderBold3DColorLines
()
:
m_lineWidth
(
0.01
f
),
m_opacity
(
1.0
f
),
m_planeClip
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
)