Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CGoGN
CGoGN
Commits
442c231a
Commit
442c231a
authored
Feb 06, 2012
by
Sylvain Thery
Browse files
add transparency possibility (using black color( 0.0,0.0,0.0) in simpleColor and perVertexColor
usage: constructor with true parameter
parent
4a94810e
Changes
7
Show whitespace changes
Inline
Side-by-side
include/Utils/Shaders/shaderColorPerVertex.frag
View file @
442c231a
...
...
@@ -5,5 +5,9 @@ VARYING_FRAG vec3 color;
FRAG_OUT_DEF
;
void
main
()
{
#ifdef BLACK_TRANSPARENCY
if
(
dot
(
color
,
color
)
==
0
.
0
)
discard
;
#endif
gl_FragColor
=
vec4
(
color
,
0
.
0
);
}
include/Utils/Shaders/shaderColorPerVertex.h
View file @
442c231a
...
...
@@ -48,7 +48,7 @@ protected:
void
restoreUniformsAttribs
();
public:
ShaderColorPerVertex
();
ShaderColorPerVertex
(
bool
black_is_transparent
=
false
);
unsigned
int
setAttributePosition
(
VBO
*
vbo
);
...
...
include/Utils/Shaders/shaderFlatColorPerFace.geom
View file @
442c231a
...
...
@@ -7,7 +7,6 @@ uniform vec3 lightPosition;
uniform
vec4
ambient
;
VARYING_IN
vec3
colorVertex
[];
VARYING_OUT
vec4
ColorFS
;
void
main
(
void
)
...
...
include/Utils/Shaders/shaderSimpleColor.frag
View file @
442c231a
...
...
@@ -5,5 +5,9 @@ uniform vec4 color;
FRAG_OUT_DEF
;
void
main
()
{
#ifdef BLACK_TRANSPARENCY
if
(
dot
(
color
,
color
)
==
0
.
0
)
discard
;
#endif
gl_FragColor
=
color
;
}
include/Utils/Shaders/shaderSimpleColor.h
View file @
442c231a
...
...
@@ -52,7 +52,7 @@ protected:
void
restoreUniformsAttribs
();
public:
ShaderSimpleColor
();
ShaderSimpleColor
(
bool
back_is_transparent
=
false
);
void
setColor
(
const
Geom
::
Vec4f
&
color
);
...
...
src/Utils/Shaders/shaderColorPerVertex.cpp
View file @
442c231a
...
...
@@ -58,7 +58,7 @@ namespace Utils
// "}";
ShaderColorPerVertex
::
ShaderColorPerVertex
()
ShaderColorPerVertex
::
ShaderColorPerVertex
(
bool
black_is_transparent
)
{
m_nameVS
=
"ShaderColorPerVertex_vs"
;
m_nameFS
=
"ShaderColorPerVertex_fs"
;
...
...
@@ -68,6 +68,8 @@ ShaderColorPerVertex::ShaderColorPerVertex()
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
if
(
black_is_transparent
)
glxfrag
.
append
(
"#define BLACK_TRANSPARENCY 1
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
loadShadersFromMemory
(
glxvert
.
c_str
(),
glxfrag
.
c_str
());
...
...
src/Utils/Shaders/shaderSimpleColor.cpp
View file @
442c231a
...
...
@@ -54,7 +54,7 @@ namespace Utils
// "}";
ShaderSimpleColor
::
ShaderSimpleColor
()
ShaderSimpleColor
::
ShaderSimpleColor
(
bool
black_is_transparent
)
{
m_nameVS
=
"ShaderSimpleColor_vs"
;
m_nameFS
=
"ShaderSimpleColor_fs"
;
...
...
@@ -66,6 +66,8 @@ ShaderSimpleColor::ShaderSimpleColor()
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
if
(
black_is_transparent
)
glxfrag
.
append
(
"#define BLACK_TRANSPARENCY 1
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
loadShadersFromMemory
(
glxvert
.
c_str
(),
glxfrag
.
c_str
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment