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
77aaa844
Commit
77aaa844
authored
Mar 16, 2015
by
Sylvain Thery
Browse files
phong and simpleFlat clipped
parent
6a6268ee
Changes
11
Hide whitespace changes
Inline
Side-by-side
CGoGN/include/Utils/Shaders/shaderPhong.frag
View file @
77aaa844
...
...
@@ -9,6 +9,8 @@ uniform vec4 materialDiffuse;
uniform
vec4
materialSpecular
;
uniform
vec4
materialAmbient
;
uniform
float
shininess
;
uniform
vec4
backColor
;
FRAG_OUT_DEF
;
void
main
()
{
...
...
@@ -51,6 +53,10 @@ void main()
float
specular
=
pow
(
max
(
dot
(
R
,
E
),
0
.
0
),
shininess
);
finalColor
+=
materialSpecular
*
specular
;
}
else
{
finalColor
=
backColor
;
}
#endif
FRAG_OUT
=
finalColor
;
}
CGoGN/include/Utils/Shaders/shaderPhong.h
View file @
77aaa844
...
...
@@ -48,8 +48,10 @@ protected:
bool
m_with_eyepos
;
// shader sources OGL3
static
std
::
string
vertexShaderText
;
static
std
::
string
fragmentShaderText
;
static
std
::
string
vertexShaderText
;
static
std
::
string
fragmentShaderText
;
static
std
::
string
vertexShaderClipText
;
static
std
::
string
fragmentShaderClipText
;
// uniform locations
CGoGNGLuint
m_unif_ambiant
;
...
...
@@ -58,6 +60,7 @@ protected:
CGoGNGLuint
m_unif_shininess
;
CGoGNGLuint
m_unif_lightPos
;
CGoGNGLuint
m_unif_eyePos
;
CGoGNGLuint
m_unif_backColor
;
//values
Geom
::
Vec4f
m_ambiant
;
...
...
@@ -66,11 +69,16 @@ protected:
float
m_shininess
;
Geom
::
Vec3f
m_lightPos
;
Geom
::
Vec3f
m_eyePos
;
Geom
::
Vec4f
m_backColor
;
VBO
*
m_vboPos
;
VBO
*
m_vboNormal
;
VBO
*
m_vboColor
;
/// clipping
CGoGNGLuint
m_unif_planeClip
;
Geom
::
Vec4f
m_planeClip
;
void
getLocations
();
void
sendParams
();
...
...
@@ -78,7 +86,7 @@ protected:
void
restoreUniformsAttribs
();
public:
ShaderPhong
(
bool
doubleSided
=
false
,
bool
withEyePosition
=
false
);
ShaderPhong
(
bool
withClipping
=
false
,
bool
doubleSided
=
false
,
bool
withEyePosition
=
false
);
// inviduals parameter setting functions
void
setAmbiant
(
const
Geom
::
Vec4f
&
ambiant
);
...
...
@@ -90,6 +98,8 @@ public:
void
setShininess
(
float
shininess
);
void
setLightPosition
(
const
Geom
::
Vec3f
&
lp
);
void
setBackColor
(
const
Geom
::
Vec4f
&
back
);
/// set eye position for VR environement
void
setEyePosition
(
const
Geom
::
Vec3f
&
ep
);
...
...
@@ -117,6 +127,10 @@ public:
// optional attributes
unsigned
int
setAttributeColor
(
VBO
*
vbo
);
void
unsetAttributeColor
();
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/shaderPhongClip.frag
0 → 100644
View file @
77aaa844
//ShaderPhong::fragmentShaderClipText
PRECISION
;
VARYING_FRAG
vec3
EyeVector
,
Normal
,
LightDir
;
#ifdef WITH_COLOR
VARYING_FRAG
vec3
Color
;
#endif
uniform
vec4
materialDiffuse
;
uniform
vec4
materialSpecular
;
uniform
vec4
materialAmbient
;
uniform
float
shininess
;
uniform
vec4
backColor
;
uniform
vec4
planeClip
;
VARYING_FRAG
vec3
posClip
;
FRAG_OUT_DEF
;
void
main
()
{
if
(
dot
(
planeClip
,
vec4
(
posClip
,
1
.
0
))
>
0
.
0
)
discard
;
vec3
N
=
normalize
(
Normal
);
vec3
L
=
normalize
(
LightDir
);
//float lambertTerm = clamp(dot(N,L),0.0,1.0);
vec4
finalColor
=
materialAmbient
;
#ifdef DOUBLE_SIDED
float
lambertTerm
;
vec4
diffuseColor
=
materialDiffuse
;
if
(
!
gl_FrontFacing
)
{
N
*=
-
1
.
0
;
lambertTerm
=
clamp
(
dot
(
N
,
L
),
0
.
0
,
1
.
0
);
}
else
lambertTerm
=
clamp
(
dot
(
N
,
L
),
0
.
0
,
1
.
0
);
#ifndef WITH_COLOR
finalColor
+=
materialDiffuse
*
lambertTerm
;
#else
finalColor
+=
vec4
((
Color
*
lambertTerm
),
0
.
0
)
;
#endif
vec3
E
=
normalize
(
EyeVector
);
vec3
R
=
reflect
(
-
L
,
N
);
float
specular
=
pow
(
max
(
dot
(
R
,
E
),
0
.
0
),
shininess
);
finalColor
+=
materialSpecular
*
specular
;
#else
float
lambertTerm
=
clamp
(
dot
(
N
,
L
),
0
.
0
,
1
.
0
);
if
(
gl_FrontFacing
)
{
#ifndef WITH_COLOR
finalColor
+=
materialDiffuse
*
lambertTerm
;
#else
finalColor
+=
vec4
((
Color
*
lambertTerm
),
0
.
0
)
;
#endif
vec3
E
=
normalize
(
EyeVector
);
vec3
R
=
reflect
(
-
L
,
N
);
float
specular
=
pow
(
max
(
dot
(
R
,
E
),
0
.
0
),
shininess
);
finalColor
+=
materialSpecular
*
specular
;
}
else
{
finalColor
=
backColor
;
}
#endif
FRAG_OUT
=
finalColor
;
}
CGoGN/include/Utils/Shaders/shaderPhongClip.vert
0 → 100644
View file @
77aaa844
//ShaderPhong::vertexShaderClipText
ATTRIBUTE
vec3
VertexPosition
,
VertexNormal
;
#ifdef WITH_COLOR
ATTRIBUTE
vec3
VertexColor
;
#endif
uniform
mat4
ModelViewProjectionMatrix
;
uniform
mat4
ModelViewMatrix
;
uniform
mat4
NormalMatrix
;
uniform
vec3
lightPosition
;
VARYING_VERT
vec3
EyeVector
,
Normal
,
LightDir
;
#ifdef WITH_COLOR
VARYING_VERT
vec3
Color
;
#endif
#ifdef WITH_EYEPOSITION
uniform
vec3
eyePosition
;
#endif
VARYING_VERT
vec3
posClip
;
INVARIANT_POS
;
void
main
()
{
Normal
=
vec3
(
NormalMatrix
*
vec4
(
VertexNormal
,
0
.
0
));
vec3
Position
=
vec3
(
ModelViewMatrix
*
vec4
(
VertexPosition
,
1
.
0
));
LightDir
=
lightPosition
-
Position
;
#ifdef WITH_EYEPOSITION
EyeVector
=
eyePosition
-
Position
;
#else
EyeVector
=
-
Position
;
#endif
#ifdef WITH_COLOR
Color
=
VertexColor
;
#endif
posClip
=
VertexPosition
;
gl_Position
=
ModelViewProjectionMatrix
*
vec4
(
VertexPosition
,
1
.
0
);
}
CGoGN/include/Utils/Shaders/shaderSimpleFlat.frag
View file @
77aaa844
...
...
@@ -10,6 +10,8 @@ uniform vec4 materialDiffuse;
uniform
vec4
materialSpecular
;
uniform
vec4
materialAmbient
;
uniform
float
shininess
;
uniform
vec4
backColor
;
FRAG_OUT_DEF
;
void
main
()
...
...
@@ -47,6 +49,10 @@ void main()
finalColor
+=
vec4
((
Color
*
lambertTerm
),
0
.
0
)
;
#endif
}
else
{
finalColor
=
backColor
;
}
#endif
FRAG_OUT
=
finalColor
;
}
CGoGN/include/Utils/Shaders/shaderSimpleFlat.h
View file @
77aaa844
...
...
@@ -48,22 +48,31 @@ protected:
bool
m_with_eyepos
;
// shader sources OGL3
static
std
::
string
vertexShaderText
;
static
std
::
string
fragmentShaderText
;
static
std
::
string
vertexShaderText
;
static
std
::
string
fragmentShaderText
;
static
std
::
string
vertexShaderClipText
;
static
std
::
string
fragmentShaderClipText
;
// uniform locations
CGoGNGLuint
m_unif_ambiant
;
CGoGNGLuint
m_unif_diffuse
;
CGoGNGLuint
m_unif_lightPos
;
CGoGNGLuint
m_unif_backColor
;
//values
Geom
::
Vec4f
m_ambiant
;
Geom
::
Vec4f
m_diffuse
;
Geom
::
Vec3f
m_lightPos
;
Geom
::
Vec4f
m_backColor
;
VBO
*
m_vboPos
;
VBO
*
m_vboColor
;
/// clipping
CGoGNGLuint
m_unif_planeClip
;
Geom
::
Vec4f
m_planeClip
;
void
getLocations
();
void
sendParams
();
...
...
@@ -71,16 +80,17 @@ protected:
void
restoreUniformsAttribs
();
public:
ShaderSimpleFlat
(
bool
doubleSided
=
false
);
ShaderSimpleFlat
(
bool
withClipping
=
false
,
bool
doubleSided
=
false
);
// inviduals parameter setting functions
void
setAmbiant
(
const
Geom
::
Vec4f
&
ambiant
);
void
setDiffuse
(
const
Geom
::
Vec4f
&
diffuse
);
void
setLightPosition
(
const
Geom
::
Vec3f
&
lp
);
void
setBackColor
(
const
Geom
::
Vec4f
&
back
);
const
Geom
::
Vec4f
&
getAmbiant
()
const
{
return
m_ambiant
;
}
const
Geom
::
Vec4f
&
getDiffuse
()
const
{
return
m_diffuse
;
}
...
...
@@ -98,6 +108,11 @@ public:
// optional attributes
unsigned
int
setAttributeColor
(
VBO
*
vbo
);
void
unsetAttributeColor
();
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/shaderSimpleFlatClip.frag
0 → 100644
View file @
77aaa844
//ShaderSimpleFlat::fragmentShaderClipText
PRECISION
;
VARYING_FRAG
vec3
LightDir
;
VARYING_FRAG
vec3
Position
;
#ifdef WITH_COLOR
VARYING_FRAG
vec3
Color
;
#endif
uniform
vec4
materialDiffuse
;
uniform
vec4
materialSpecular
;
uniform
vec4
materialAmbient
;
uniform
float
shininess
;
uniform
vec4
backColor
;
FRAG_OUT_DEF
;
uniform
vec4
planeClip
;
VARYING_FRAG
vec3
posClip
;
void
main
()
{
if
(
dot
(
planeClip
,
vec4
(
posClip
,
1
.
0
))
>
0
.
0
)
discard
;
vec3
DX
=
dFdx
(
Position
);
vec3
DY
=
dFdy
(
Position
);
vec3
N
=
normalize
(
cross
(
DX
,
DY
));
vec3
L
=
normalize
(
LightDir
);
vec4
finalColor
=
materialAmbient
;
#ifdef DOUBLE_SIDED
float
lambertTerm
;
vec4
diffuseColor
=
materialDiffuse
;
if
(
!
gl_FrontFacing
)
{
N
*=
-
1
.
0
;
lambertTerm
=
clamp
(
dot
(
N
,
L
),
0
.
0
,
1
.
0
);
}
else
lambertTerm
=
clamp
(
dot
(
N
,
L
),
0
.
0
,
1
.
0
);
#ifndef WITH_COLOR
finalColor
+=
materialDiffuse
*
lambertTerm
;
#else
finalColor
+=
vec4
((
Color
*
lambertTerm
),
0
.
0
)
;
#endif
#else
float
lambertTerm
=
clamp
(
dot
(
N
,
L
),
0
.
0
,
1
.
0
);
if
(
gl_FrontFacing
)
{
#ifndef WITH_COLOR
finalColor
+=
materialDiffuse
*
lambertTerm
;
#else
finalColor
+=
vec4
((
Color
*
lambertTerm
),
0
.
0
)
;
#endif
}
else
{
finalColor
=
backColor
;
}
#endif
FRAG_OUT
=
finalColor
;
}
CGoGN/include/Utils/Shaders/shaderSimpleFlatClip.vert
0 → 100644
View file @
77aaa844
//ShaderSimpleFlat::vertexShaderClipText
ATTRIBUTE
vec3
VertexPosition
,
VertexNormal
;
#ifdef WITH_COLOR
ATTRIBUTE
vec3
VertexColor
;
#endif
uniform
mat4
ModelViewProjectionMatrix
;
uniform
mat4
ModelViewMatrix
;
uniform
vec3
lightPosition
;
VARYING_VERT
vec3
LightDir
;
VARYING_VERT
vec3
Position
;
VARYING_VERT
vec3
posClip
;
#ifdef WITH_COLOR
VARYING_VERT
vec3
Color
;
#endif
INVARIANT_POS
;
void
main
()
{
Position
=
vec3
(
ModelViewMatrix
*
vec4
(
VertexPosition
,
1
.
0
));
LightDir
=
lightPosition
-
Position
;
#ifdef WITH_COLOR
Color
=
VertexColor
;
#endif
posClip
=
VertexPosition
;
gl_Position
=
ModelViewProjectionMatrix
*
vec4
(
VertexPosition
,
1
.
0
);
}
CGoGN/src/Utils/Shaders/shaderPhong.cpp
View file @
77aaa844
...
...
@@ -33,9 +33,11 @@ namespace Utils
#include
"shaderPhong.vert"
#include
"shaderPhong.frag"
#include
"shaderPhongClip.vert"
#include
"shaderPhongClip.frag"
ShaderPhong
::
ShaderPhong
(
bool
doubleSided
,
bool
withEyePosition
)
:
ShaderPhong
::
ShaderPhong
(
bool
withClipping
,
bool
doubleSided
,
bool
withEyePosition
)
:
m_with_color
(
false
),
m_with_eyepos
(
withEyePosition
),
m_ambiant
(
Geom
::
Vec4f
(
0.05
f
,
0.05
f
,
0.1
f
,
0.0
f
)),
...
...
@@ -43,25 +45,39 @@ ShaderPhong::ShaderPhong(bool doubleSided, bool withEyePosition):
m_specular
(
Geom
::
Vec4f
(
1.0
f
,
1.0
f
,
1.0
f
,
0.0
f
)),
m_shininess
(
100.0
f
),
m_lightPos
(
Geom
::
Vec3f
(
10.0
f
,
10.0
f
,
1000.0
f
)),
m_backColor
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
),
m_vboPos
(
NULL
),
m_vboNormal
(
NULL
),
m_vboColor
(
NULL
)
m_vboColor
(
NULL
),
m_planeClip
(
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
))
{
m_nameVS
=
"ShaderPhong_vs"
;
m_nameFS
=
"ShaderPhong_fs"
;
// m_nameGS = "ShaderPhong_gs";
// get choose GL defines (2 or 3)
// ans compile shaders
std
::
string
glxvert
(
*
GLSLShader
::
DEFINES_GL
);
if
(
m_with_eyepos
)
glxvert
.
append
(
"#define WITH_EYEPOSITION"
);
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
// Use double sided lighting if set
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
if
(
withClipping
)
{
m_nameVS
=
"ShaderPhongClip_vs"
;
m_nameFS
=
"ShaderPhongClip_fs"
;
if
(
m_with_eyepos
)
glxvert
.
append
(
"#define WITH_EYEPOSITION"
);
glxvert
.
append
(
vertexShaderClipText
);
// Use double sided lighting if set
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderClipText
);
}
else
{
m_nameVS
=
"ShaderPhong_vs"
;
m_nameFS
=
"ShaderPhong_fs"
;
if
(
m_with_eyepos
)
glxvert
.
append
(
"#define WITH_EYEPOSITION"
);
glxvert
.
append
(
vertexShaderText
);
// Use double sided lighting if set
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
}
loadShadersFromMemory
(
glxvert
.
c_str
(),
glxfrag
.
c_str
());
...
...
@@ -80,6 +96,9 @@ void ShaderPhong::getLocations()
*
m_unif_lightPos
=
glGetUniformLocation
(
this
->
program_handler
(),
"lightPosition"
);
if
(
m_with_eyepos
)
*
m_unif_eyePos
=
glGetUniformLocation
(
this
->
program_handler
(),
"eyePosition"
);
*
m_unif_backColor
=
glGetUniformLocation
(
this
->
program_handler
(),
"backColor"
);
*
m_unif_planeClip
=
glGetUniformLocation
(
this
->
program_handler
(),
"planeClip"
);
unbind
();
}
...
...
@@ -93,6 +112,9 @@ void ShaderPhong::sendParams()
glUniform3fv
(
*
m_unif_lightPos
,
1
,
m_lightPos
.
data
());
if
(
m_with_eyepos
)
glUniform3fv
(
*
m_unif_eyePos
,
1
,
m_eyePos
.
data
());
glUniform4fv
(
*
m_unif_backColor
,
1
,
m_backColor
.
data
());
if
(
*
m_unif_planeClip
>
0
)
glUniform4fv
(
*
m_unif_planeClip
,
1
,
m_planeClip
.
data
());
unbind
();
}
...
...
@@ -128,6 +150,15 @@ void ShaderPhong::setShininess(float shininess)
unbind
();
}
void
ShaderPhong
::
setBackColor
(
const
Geom
::
Vec4f
&
back
)
{
bind
();
glUniform4fv
(
*
m_unif_backColor
,
1
,
back
.
data
());
m_backColor
=
back
;
unbind
();
}
void
ShaderPhong
::
setLightPosition
(
const
Geom
::
Vec3f
&
lightPos
)
{
bind
();
...
...
@@ -205,6 +236,17 @@ void ShaderPhong::unsetAttributeColor()
}
}
void
ShaderPhong
::
setClippingPlane
(
const
Geom
::
Vec4f
&
plane
)
{
if
(
*
m_unif_planeClip
>
0
)
{
m_planeClip
=
plane
;
bind
();
glUniform4fv
(
*
m_unif_planeClip
,
1
,
plane
.
data
());
unbind
();
}
}
void
ShaderPhong
::
restoreUniformsAttribs
()
{
getLocations
();
...
...
CGoGN/src/Utils/Shaders/shaderSimpleFlat.cpp
View file @
77aaa844
...
...
@@ -33,31 +33,46 @@ namespace Utils
#include
"shaderSimpleFlat.vert"
#include
"shaderSimpleFlat.frag"
#include
"shaderSimpleFlatClip.vert"
#include
"shaderSimpleFlatClip.frag"
ShaderSimpleFlat
::
ShaderSimpleFlat
(
bool
doubleSided
)
:
ShaderSimpleFlat
::
ShaderSimpleFlat
(
bool
withClipping
,
bool
doubleSided
)
:
m_with_color
(
false
),
m_ambiant
(
Geom
::
Vec4f
(
0.05
f
,
0.05
f
,
0.1
f
,
0.0
f
)),
m_diffuse
(
Geom
::
Vec4f
(
0.1
f
,
1.0
f
,
0.1
f
,
0.0
f
)),
m_lightPos
(
Geom
::
Vec3f
(
10.0
f
,
10.0
f
,
1000.0
f
)),
m_backColor
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
),
m_vboPos
(
NULL
),
m_vboColor
(
NULL
)
m_vboColor
(
NULL
),
m_planeClip
(
Geom
::
Vec4f
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
))
{
m_nameVS
=
"ShaderSimpleFlat_vs"
;
m_nameFS
=
"ShaderSimpleFlat_fs"
;
// m_nameGS = "ShaderSimpleFlat_gs";
// get choose GL defines (2 or 3)
// ans compile shaders
std
::
string
glxvert
(
*
GLSLShader
::
DEFINES_GL
);
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
*
GLSLShader
::
DEFINES_GL
);
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
loadShadersFromMemory
(
glxvert
.
c_str
(),
glxfrag
.
c_str
());
if
(
withClipping
)
{
m_nameVS
=
"ShaderSimpleFlatClip_vs"
;
m_nameFS
=
"ShaderSimpleFlatClip_fs"
;
glxvert
.
append
(
vertexShaderClipText
);
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderClipText
);
}
else
{
m_nameVS
=
"ShaderSimpleFlat_vs"
;
m_nameFS
=
"ShaderSimpleFlat_fs"
;
// get choose GL defines (2 or 3)
// ans compile shaders
glxvert
.
append
(
vertexShaderText
);
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
}
loadShadersFromMemory
(
glxvert
.
c_str
(),
glxfrag
.
c_str
());
// and get and fill uniforms
getLocations
();
sendParams
();
...
...
@@ -69,6 +84,8 @@ void ShaderSimpleFlat::getLocations()
*
m_unif_ambiant
=
glGetUniformLocation
(
this
->
program_handler
(),
"materialAmbient"
);
*
m_unif_diffuse
=
glGetUniformLocation
(
this
->
program_handler
(),
"materialDiffuse"
);
*
m_unif_lightPos
=
glGetUniformLocation
(
this
->
program_handler
(),
"lightPosition"
);
*
m_unif_backColor
=
glGetUniformLocation
(
this
->
program_handler
(),
"backColor"
);
*
m_unif_planeClip
=
glGetUniformLocation
(
this
->
program_handler
(),
"planeClip"
);
unbind
();
}
...
...
@@ -78,6 +95,9 @@ void ShaderSimpleFlat::sendParams()
glUniform4fv
(
*
m_unif_ambiant
,
1
,
m_ambiant
.
data
());
glUniform4fv
(
*
m_unif_diffuse
,
1
,
m_diffuse
.
data
());
glUniform3fv
(
*
m_unif_lightPos
,
1
,
m_lightPos
.
data
());
glUniform4fv
(
*
m_unif_backColor
,
1
,
m_backColor
.
data
());
if
(
*
m_unif_planeClip
>
0
)
glUniform4fv
(
*
m_unif_planeClip
,
1
,
m_planeClip
.
data
());
unbind
();
}
...
...
@@ -107,6 +127,15 @@ void ShaderSimpleFlat::setLightPosition(const Geom::Vec3f& lightPos)
}
void
ShaderSimpleFlat
::
setBackColor
(
const
Geom
::
Vec4f
&
back
)
{
bind
();
glUniform4fv
(
*
m_unif_backColor
,
1
,
back
.
data
());
m_backColor
=
back
;
unbind
();
}
void
ShaderSimpleFlat
::
setParams
(
const
Geom
::
Vec4f
&
ambiant
,
const
Geom
::
Vec4f
&
diffuse
,
const
Geom
::
Vec3f
&
lightPos
)
{
m_ambiant
=
ambiant
;
...
...
@@ -185,6 +214,18 @@ unsigned int ShaderSimpleFlat::setAttributePosition(VBO* vbo)
return
id
;
}
void
ShaderSimpleFlat
::
setClippingPlane
(
const
Geom
::
Vec4f
&
plane
)
{
if
(
*
m_unif_planeClip
>
0
)
{
m_planeClip
=
plane
;
bind
();
glUniform4fv
(
*
m_unif_planeClip
,
1
,
plane
.
data
());
unbind
();
}
}
}
// namespace Utils