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
0c420188
Commit
0c420188
authored
May 04, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
topoRender GL3 compatible
parent
3bf37922
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1013 additions
and
249 deletions
+1013
-249
CGoGN/include/Algo/Render/GL2/topoRender.h
CGoGN/include/Algo/Render/GL2/topoRender.h
+19
-6
CGoGN/include/Algo/Render/GL2/topoRender.hpp
CGoGN/include/Algo/Render/GL2/topoRender.hpp
+13
-42
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.h
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.h
+2
-2
CGoGN/include/Utils/Shaders/shaderBold3DLines.h
CGoGN/include/Utils/Shaders/shaderBold3DLines.h
+2
-2
CGoGN/include/Utils/Shaders/shaderBoldColorLines.geom
CGoGN/include/Utils/Shaders/shaderBoldColorLines.geom
+7
-4
CGoGN/include/Utils/Shaders/shaderBoldColorLines.h
CGoGN/include/Utils/Shaders/shaderBoldColorLines.h
+2
-2
CGoGN/include/Utils/Shaders/shaderBoldLines.geom
CGoGN/include/Utils/Shaders/shaderBoldLines.geom
+4
-5
CGoGN/include/Utils/Shaders/shaderBoldLines.h
CGoGN/include/Utils/Shaders/shaderBoldLines.h
+2
-2
CGoGN/include/Utils/Shaders/shaderColorDarts.frag
CGoGN/include/Utils/Shaders/shaderColorDarts.frag
+17
-0
CGoGN/include/Utils/Shaders/shaderColorDarts.geom
CGoGN/include/Utils/Shaders/shaderColorDarts.geom
+136
-0
CGoGN/include/Utils/Shaders/shaderColorDarts.h
CGoGN/include/Utils/Shaders/shaderColorDarts.h
+88
-0
CGoGN/include/Utils/Shaders/shaderColorDarts.vert
CGoGN/include/Utils/Shaders/shaderColorDarts.vert
+15
-0
CGoGN/include/Utils/Shaders/shaderColorPerVertex.h
CGoGN/include/Utils/Shaders/shaderColorPerVertex.h
+6
-2
CGoGN/include/Utils/Shaders/shaderDarts.frag
CGoGN/include/Utils/Shaders/shaderDarts.frag
+15
-0
CGoGN/include/Utils/Shaders/shaderDarts.geom
CGoGN/include/Utils/Shaders/shaderDarts.geom
+131
-0
CGoGN/include/Utils/Shaders/shaderDarts.h
CGoGN/include/Utils/Shaders/shaderDarts.h
+87
-0
CGoGN/include/Utils/Shaders/shaderDarts.vert
CGoGN/include/Utils/Shaders/shaderDarts.vert
+12
-0
CGoGN/include/Utils/Shaders/shaderPointsLines.h
CGoGN/include/Utils/Shaders/shaderPointsLines.h
+57
-0
CGoGN/include/Utils/Shaders/shaderSimpleColor.h
CGoGN/include/Utils/Shaders/shaderSimpleColor.h
+5
-2
CGoGN/include/Utils/drawer.h
CGoGN/include/Utils/drawer.h
+3
-2
CGoGN/src/Algo/Render/topoGenRender.cpp
CGoGN/src/Algo/Render/topoGenRender.cpp
+38
-37
CGoGN/src/Utils/Shaders/shaderBoldColorLines.cpp
CGoGN/src/Utils/Shaders/shaderBoldColorLines.cpp
+2
-2
CGoGN/src/Utils/Shaders/shaderBoldLines.cpp
CGoGN/src/Utils/Shaders/shaderBoldLines.cpp
+2
-2
CGoGN/src/Utils/Shaders/shaderColorDarts.cpp
CGoGN/src/Utils/Shaders/shaderColorDarts.cpp
+153
-0
CGoGN/src/Utils/Shaders/shaderDarts.cpp
CGoGN/src/Utils/Shaders/shaderDarts.cpp
+147
-0
CGoGN/src/Utils/drawer.cpp
CGoGN/src/Utils/drawer.cpp
+48
-137
No files found.
CGoGN/include/Algo/Render/GL2/topoRender.h
View file @
0c420188
...
...
@@ -36,7 +36,10 @@
#include "Utils/vbo_base.h"
#include "Utils/svg.h"
#include "Utils/Shaders/shaderSimpleColor.h"
//#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderBoldLines.h"
#include "Utils/Shaders/shaderDarts.h"
#ifdef WIN32
...
...
@@ -79,7 +82,8 @@ protected:
Utils
::
VBO
*
m_vbo2
;
unsigned
int
m_vaId
;
unsigned
int
m_vaId1
;
unsigned
int
m_vaId2
;
/**
*number of darts to draw
...
...
@@ -121,7 +125,11 @@ protected:
Geom
::
Vec3f
*
m_bufferDartPosition
;
Utils
::
ShaderSimpleColor
*
m_shader1
;
//Utils::ShaderSimpleColor* m_shader1;
//Utils::ShaderPointsLines* m_shader2;
Utils
::
ShaderDarts
*
m_shader1
;
Utils
::
ShaderBoldLines
*
m_shader2
;
bool
m_sharedShaders
;
...
...
@@ -164,13 +172,16 @@ protected:
public:
static
void
createShaders
(
std
::
vector
<
Utils
::
GLSLShader
*>&
shaders
);
/**
* Constructor
* @param bs shift for boundary drawing
*/
TopoGenRender
(
float
bs
=
0.01
f
);
TopoGenRender
(
Utils
::
ShaderSimpleColor
*
ssc
,
float
bs
=
0.01
f
);
TopoGenRender
(
const
std
::
vector
<
Utils
::
GLSLShader
*>&
shaders
,
float
bs
=
0.01
f
);
/**
* Destructor
...
...
@@ -221,7 +232,9 @@ public:
/**
* get shader objects
*/
Utils
::
GLSLShader
*
shader1
()
{
return
static_cast
<
Utils
::
GLSLShader
*>
(
m_shader1
);
}
//Utils::GLSLShader* shader1() { return static_cast<Utils::GLSLShader*>(m_shader1); }
std
::
vector
<
Utils
::
GLSLShader
*>
shaders
();
/**
...
...
@@ -308,7 +321,7 @@ public:
*/
TopoRender
(
float
bs
=
0.01
f
)
:
TopoGenRender
(
bs
)
{}
TopoRender
(
Utils
::
ShaderSimpleColor
*
ssc
,
float
bs
=
0.01
f
)
:
TopoGenRender
(
ssc
,
bs
)
{}
TopoRender
(
const
std
::
vector
<
Utils
::
GLSLShader
*>&
shaders
,
float
bs
=
0.01
f
)
:
TopoGenRender
(
shaders
,
bs
)
{}
/**
* Destructor
...
...
CGoGN/include/Algo/Render/GL2/topoRender.hpp
View file @
0c420188
...
...
@@ -36,7 +36,7 @@
#include "Algo/Geometry/normal.h"
#include "Container/containerBrowser.h"
#include "Utils/Shaders/shaderColor
PerVertex
.h"
#include "Utils/Shaders/shaderColor
Darts
.h"
namespace
CGoGN
{
...
...
@@ -60,19 +60,12 @@ void TopoRender::overdrawDart(MAP& map, Dart d, float width, float r, float g, f
if
(
!
attIndex
.
isValid
())
attIndex
=
map
.
template
addAttribute
<
unsigned
int
,
DART
,
MAP
>(
m_nameIndex
);
unsigned
int
indexDart
=
attIndex
[
d
];
m_shader1
->
changeVA_VBO
(
m_vaId
,
m_vbo0
);
m_shader1
->
setColor
(
Geom
::
Vec4f
(
r
,
g
,
b
,
0.0
f
));
m_shader1
->
setLineWidth
(
width
);
m_shader1
->
enableVertexAttribs
();
glLineWidth
(
width
);
glDrawArrays
(
GL_LINES
,
indexDart
,
2
);
glPointSize
(
2.0
f
*
width
);
glDrawArrays
(
GL_POINTS
,
indexDart
,
1
);
m_shader1
->
disableVertexAttribs
();
}
...
...
@@ -84,25 +77,16 @@ void TopoRender::drawColoredDarts(MAP& map)
if
(
!
attIndex
.
isValid
())
return
;
glLineWidth
(
m_topo_dart_width
);
float
ps
=
2.0
f
*
m_topo_dart_width
;
m_shader1
->
changeVA_VBO
(
m_vaId
,
m_vbo0
);
m_shader1
->
enableVertexAttribs
();
for
(
auto
it
=
m_coloredDarts
.
begin
();
it
!=
m_coloredDarts
.
end
();
++
it
)
{
unsigned
int
indexDart
=
attIndex
[
it
->
d
];
m_shader1
->
se
tColor
(
Geom
::
Vec4f
(
it
->
r
,
it
->
g
,
it
->
b
,
0.0
f
));
m_shader1
->
enableVertexAttribs
();
m_shader1
->
direc
tColor
(
Geom
::
Vec4f
(
it
->
r
,
it
->
g
,
it
->
b
,
0.0
f
));
// m_shader1->bind(); // because of unbind, do a set color without bind/unbind
glDrawArrays
(
GL_LINES
,
indexDart
,
2
);
glPointSize
(
ps
);
glDrawArrays
(
GL_POINTS
,
indexDart
,
1
);
}
m_shader1
->
disableVertexAttribs
();
}
...
...
@@ -528,53 +512,40 @@ Dart TopoRender::picking(MAP& map,int x, int y, bool withBoundary)
}
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
Utils
::
ShaderColorPerVertex
shaderCol
;
Utils
::
ShaderColorDarts
shaderCol
;
shaderCol
.
setAttributePosition
(
m_vbo0
);
shaderCol
.
setAttributeColor
(
&
vboCol
);
shaderCol
.
updateMatrices
(
m_shader1
);
float
dw
=
m_topo_dart_width
;
m_topo_dart_width
+=
2
;
// save clear color and set to zero
float
cc
[
4
];
glGetFloatv
(
GL_COLOR_CLEAR_VALUE
,
cc
);
bool
multi
=
glIsEnabled
(
GL_MULTISAMPLE
);
if
(
multi
)
glDisable
(
GL_MULTISAMPLE
);
glClearColor
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glDisable
(
GL_LIGHTING
);
// draw in back buffer (not shown on screen)
shaderCol
.
setLineWidth
(
m_topo_dart_width
+
2
);
shaderCol
.
enableVertexAttribs
();
glLineWidth
(
m_topo_dart_width
);
glDrawArrays
(
GL_LINES
,
0
,
m_nbDarts
*
2
);
// change the stride to take 1/2 vertices
shaderCol
.
enableVertexAttribs
(
6
*
sizeof
(
GL_FLOAT
));
glPointSize
(
2.0
f
*
m_topo_dart_width
);
glDrawArrays
(
GL_POINTS
,
0
,
m_nbDarts
);
shaderCol
.
disableVertexAttribs
();
// restore dart width
m_topo_dart_width
=
dw
;
// read the pixel under the mouse in back buffer
glReadBuffer
(
GL_BACK
);
float
color
[
3
];
glReadPixels
(
x
,
y
,
1
,
1
,
GL_RGB
,
GL_FLOAT
,
color
);
if
(
multi
)
glEnable
(
GL_MULTISAMPLE
);
glClearColor
(
cc
[
0
],
cc
[
1
],
cc
[
2
],
cc
[
3
]);
Dart
d
=
colToDart
(
color
);
return
d
;
}
...
...
CGoGN/include/Utils/Shaders/shaderBold3DColorLines.h
View file @
0c420188
...
...
@@ -26,7 +26,7 @@
#define __CGOGN_SHADER_BOLD3DCOLORLINES__
#include "Utils/GLSLShader.h"
#include "Utils/
clippingShader
.h"
#include "Utils/
Shaders/shaderPointsLines
.h"
#include "Geometry/vector_gen.h"
#include "Utils/dll.h"
...
...
@@ -37,7 +37,7 @@ namespace CGoGN
namespace
Utils
{
class
CGoGN_UTILS_API
ShaderBold3DColorLines
:
public
ClippingShader
class
CGoGN_UTILS_API
ShaderBold3DColorLines
:
public
ShaderPointsLines
{
protected:
// shader sources
...
...
CGoGN/include/Utils/Shaders/shaderBold3DLines.h
View file @
0c420188
...
...
@@ -26,7 +26,7 @@
#define __CGOGN_SHADER_BOLD3DLINES__
#include "Utils/GLSLShader.h"
#include "Utils/
clippingShader
.h"
#include "Utils/
Shaders/shaderPointsLines
.h"
#include "Geometry/vector_gen.h"
#include "Utils/dll.h"
...
...
@@ -37,7 +37,7 @@ namespace CGoGN
namespace
Utils
{
class
CGoGN_UTILS_API
ShaderBold3DLines
:
public
ClippingShader
class
CGoGN_UTILS_API
ShaderBold3DLines
:
public
ShaderPointsLines
{
protected:
// shader sources
...
...
CGoGN/include/Utils/Shaders/shaderBoldColorLines.geom
View file @
0c420188
...
...
@@ -14,7 +14,6 @@ void main()
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
);
...
...
@@ -36,11 +35,13 @@ void main()
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
;
// U2 *= (lineWidths[0]+lineWidths[1])/2
.0;
fragClip
=
posClip
[
0
];
fragColor
=
vcolor
[
0
];
A
-=
vec4
(
U2
,
0
.
0
,
0
.
0
);
// A -= vec4(U2,0.0,0.0);
gl_Position
=
vec4
(
A
.
xyz
-
U
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
.
xyz
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
.
xyz
-
V
,
1
.
0
);
...
...
@@ -48,11 +49,13 @@ void main()
fragClip
=
posClip
[
1
];
fragColor
=
vcolor
[
1
];
B
+=
vec4
(
U2
,
0
.
0
,
0
.
0
);
//
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
();
gl_Position
=
vec4
(
B
.
xyz
+
U
,
1
.
0
);
EmitVertex
();
EndPrimitive
();
}
...
...
CGoGN/include/Utils/Shaders/shaderBoldColorLines.h
View file @
0c420188
...
...
@@ -26,7 +26,7 @@
#define __CGOGN_SHADER_BOLDCOLORLINES__
#include "Utils/GLSLShader.h"
#include "Utils/
clippingShader
.h"
#include "Utils/
Shaders/shaderPointsLines
.h"
#include "Geometry/vector_gen.h"
#include "Utils/dll.h"
...
...
@@ -37,7 +37,7 @@ namespace CGoGN
namespace
Utils
{
class
CGoGN_UTILS_API
ShaderBoldColorLines
:
public
ClippingShader
class
CGoGN_UTILS_API
ShaderBoldColorLines
:
public
ShaderPointsLines
{
protected:
// shader sources
...
...
CGoGN/include/Utils/Shaders/shaderBoldLines.geom
View file @
0c420188
...
...
@@ -30,22 +30,21 @@ void main()
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
-
U
,
1
.
0
);
EmitVertex
();
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
();
gl_Position
=
vec4
(
B
.
xyz
+
U
,
1
.
0
);
EmitVertex
();
EndPrimitive
();
}
}
CGoGN/include/Utils/Shaders/shaderBoldLines.h
View file @
0c420188
...
...
@@ -26,7 +26,7 @@
#define __CGOGN_SHADER_BOLDLINES__
#include "Utils/GLSLShader.h"
#include "Utils/
clippingShader
.h"
#include "Utils/
Shaders/shaderPointsLines
.h"
#include "Geometry/vector_gen.h"
#include "Utils/dll.h"
...
...
@@ -37,7 +37,7 @@ namespace CGoGN
namespace
Utils
{
class
CGoGN_UTILS_API
ShaderBoldLines
:
public
ClippingShader
class
CGoGN_UTILS_API
ShaderBoldLines
:
public
ShaderPointsLines
{
protected:
// shader sources
...
...
CGoGN/include/Utils/Shaders/shaderColorDarts.frag
0 → 100644
View file @
0c420188
// ShaderColorDarts::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/shaderColorDarts.geom
0 → 100644
View file @
0c420188
// ShaderColorDarts::geometryShaderText
uniform
mat4
ProjectionMatrix
;
uniform
vec2
lineWidths
;
VARYING_IN
vec3
vcolor
[];
VARYING_OUT
vec3
fragColor
;
VARYING_IN
vec3
posClip
[];
VARYING_OUT
vec3
fragClip
;
void
main
()
{
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
);
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
V
=
vec3
(
lineWidths
*
vec2
(
U2
[
1
],
-
U2
[
0
]),
0
.
0
)
*
3
.
0
;
U2
*=
(
lineWidths
[
0
]
+
lineWidths
[
1
])
/
2
.
0
;
vec3
U
=
vec3
(
U2
,
0
.
0
)
*
3
.
0
;
// vec3 U3 = normalize(B.xyz - A.xyz);
// U3 *= (lineWidths[0]+lineWidths[1])/2.0;
fragClip
=
posClip
[
0
];
fragColor
=
vcolor
[
0
];
gl_Position
=
vec4
(
A
.
xyz
-
U
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
.
xyz
-
U
-
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
.
xyz
+
U
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
A
.
xyz
+
U
-
V
,
1
.
0
);
EmitVertex
();
V
/=
3
.
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
];
gl_Position
=
vec4
(
B
.
xyz
+
V
,
1
.
0
);
EmitVertex
();
gl_Position
=
vec4
(
B
.
xyz
-
V
,
1
.
0
);
EmitVertex
();
EndPrimitive
();
}
}
/*
void main()
{
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);
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 V = vec3(lineWidths*vec2(U2[1], -U2[0]), 0.0);
vec3 U3 = normalize(B.xyz - A.xyz);
U3 *= (lineWidths[0]+lineWidths[1])/2.0;
fragClip = posClip[0];
A -= vec4(3.0*U3,0.0);
gl_Position = vec4(A.xyz+V, 1.0);
EmitVertex();
gl_Position = vec4(A.xyz-V, 1.0);
EmitVertex();
A += vec4(2.0*U3,0.0);
gl_Position = vec4(A.xyz+3.0*V, 1.0);
EmitVertex();
gl_Position = vec4(A.xyz-3.0*V, 1.0);
EmitVertex();
A += vec4(2.0*U3,0.0);
gl_Position = vec4(A.xyz+3.0*V, 1.0);
EmitVertex();
gl_Position = vec4(A.xyz-3.0*V, 1.0);
EmitVertex();
A += vec4(2.0*U3,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(U3,0.0);
gl_Position = vec4(B.xyz+V, 1.0);
EmitVertex();
gl_Position = vec4(B.xyz-V, 1.0);
EmitVertex();
EndPrimitive();
}
}
*/
\ No newline at end of file
CGoGN/include/Utils/Shaders/shaderColorDarts.h
0 → 100644
View file @
0c420188
/*******************************************************************************
* 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_COLOR_DARTS__
#define __CGOGN_SHADER_COLOR_DARTS__
#include "Utils/GLSLShader.h"
#include "Utils/Shaders/shaderPointsLines.h"
#include "Geometry/vector_gen.h"
#include "Utils/dll.h"
namespace
CGoGN
{
namespace
Utils
{
class
CGoGN_UTILS_API
ShaderColorDarts
:
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
;
Geom
::
Vec2f
m_lineWidth
;
float
m_opacity
;
VBO
*
m_vboPos
;
VBO
*
m_vboCol
;
/// clipping
CGoGNGLuint
m_unif_planeClip
;
Geom
::
Vec4f
m_planeClip
;
void
getLocations
();
void
sendParams
();
void
restoreUniformsAttribs
();
public:
ShaderColorDarts
();
void
setLineWidth
(
float
pix
);
void
setOpacity
(
float
op
);
unsigned
int
setAttributePosition
(
VBO
*
vbo
);
unsigned
int
setAttributeColor
(
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/shaderColorDarts.vert
0 → 100644
View file @
0c420188
// ShaderColorDarts::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/shaderColorPerVertex.h
View file @
0c420188
...
...
@@ -26,7 +26,7 @@
#define __CGOGN_SHADER_CPV__
#include "Utils/GLSLShader.h"
#include "Utils/
clippingShader
.h"
#include "Utils/
Shaders/shaderPointsLines
.h"
#include "Geometry/vector_gen.h"
#include "Utils/dll.h"
...
...
@@ -37,7 +37,7 @@ namespace CGoGN
namespace
Utils
{
class
CGoGN_UTILS_API
ShaderColorPerVertex
:
public
ClippingShader
class
CGoGN_UTILS_API
ShaderColorPerVertex
:
public
ShaderPointsLines
{
protected:
// shader sources
...
...
@@ -72,6 +72,9 @@ public:
*/
unsigned
int
setAttributeColor
(
VBO
*
vbo
);
/// just for uniform interface with gl3 BoldLines shaders
inline
void
setLineWidth
(
float
pix
)
{
glLineWidth
(
pix
);
}
/**
* set opacity (0=transparent / 1=opaque)
*/
...
...
@@ -80,6 +83,7 @@ public:
float
getOpacity
()
const
{
return
m_opacity
;}
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
...
...
CGoGN/include/Utils/Shaders/shaderDarts.frag
0 → 100644
View file @
0c420188
// ShaderDarts::fragmentShaderText