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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
CGoGN
Commits
6980a3f7
Commit
6980a3f7
authored
Apr 05, 2011
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pb compil shaderPhong
parent
3fa38d1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
include/Utils/shaderPhong.h
include/Utils/shaderPhong.h
+4
-4
src/Utils/shaderPhong.cpp
src/Utils/shaderPhong.cpp
+13
-13
No files found.
include/Utils/shaderPhong.h
View file @
6980a3f7
...
...
@@ -22,8 +22,8 @@
* *
*******************************************************************************/
#ifndef __CGOGN_SHADER_PHONG
3
_
#define __CGOGN_SHADER_PHONG
3
_
#ifndef __CGOGN_SHADER_PHONG_
#define __CGOGN_SHADER_PHONG_
#include "Utils/GLSLShader3.h"
#include "Geometry/vector_gen.h"
...
...
@@ -35,7 +35,7 @@ namespace CGoGN
namespace
Utils
{
class
ShaderPhong
3
:
public
GLSLShader3
class
ShaderPhong
:
public
GLSLShader
{
protected:
// flag color per vertex or not
...
...
@@ -67,7 +67,7 @@ protected:
void
sendParams
();
public:
ShaderPhong
3
();
ShaderPhong
();
// inviduals parameter setting functions
void
setAmbiant
(
const
Geom
::
Vec4f
&
ambiant
);
...
...
src/Utils/shaderPhong.cpp
View file @
6980a3f7
...
...
@@ -33,7 +33,7 @@ namespace CGoGN
namespace
Utils
{
std
::
string
ShaderPhong
3
::
vertexShaderText
=
std
::
string
ShaderPhong
::
vertexShaderText
=
"ATTRIBUTE vec3 VertexPosition, VertexNormal;
\n
"
"#ifdef WITH_COLOR
\n
"
"ATTRIBUTE vec3 VertexColor;
\n
"
...
...
@@ -60,7 +60,7 @@ std::string ShaderPhong3::vertexShaderText =
"}"
;
std
::
string
ShaderPhong
3
::
fragmentShaderText
=
std
::
string
ShaderPhong
::
fragmentShaderText
=
"PRECISON;
\n
"
"VARYING_FRAG vec3 EyeVector, Normal, LightDir;
\n
"
"#ifdef WITH_COLOR
\n
"
...
...
@@ -95,7 +95,7 @@ std::string ShaderPhong3::fragmentShaderText =
ShaderPhong
3
::
ShaderPhong3
()
:
ShaderPhong
::
ShaderPhong
()
:
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
)),
...
...
@@ -118,7 +118,7 @@ ShaderPhong3::ShaderPhong3():
sendParams
();
}
void
ShaderPhong
3
::
getLocations
()
void
ShaderPhong
::
getLocations
()
{
m_unif_ambiant
=
glGetUniformLocation
(
this
->
program_handler
(),
"materialAmbient"
);
m_unif_diffuse
=
glGetUniformLocation
(
this
->
program_handler
(),
"materialDiffuse"
);
...
...
@@ -127,7 +127,7 @@ void ShaderPhong3::getLocations()
m_unif_lightPos
=
glGetUniformLocation
(
this
->
program_handler
(),
"lightPosition"
);
}
void
ShaderPhong
3
::
sendParams
()
void
ShaderPhong
::
sendParams
()
{
glUniform4fv
(
m_unif_ambiant
,
1
,
m_ambiant
.
data
());
glUniform4fv
(
m_unif_diffuse
,
1
,
m_diffuse
.
data
());
...
...
@@ -136,35 +136,35 @@ void ShaderPhong3::sendParams()
glUniform3fv
(
m_unif_lightPos
,
1
,
m_lightPos
.
data
());
}
void
ShaderPhong
3
::
setAmbiant
(
const
Geom
::
Vec4f
&
ambiant
)
void
ShaderPhong
::
setAmbiant
(
const
Geom
::
Vec4f
&
ambiant
)
{
this
->
bind
();
glUniform4fv
(
m_unif_ambiant
,
1
,
ambiant
.
data
());
m_ambiant
=
ambiant
;
}
void
ShaderPhong
3
::
setDiffuse
(
const
Geom
::
Vec4f
&
diffuse
)
void
ShaderPhong
::
setDiffuse
(
const
Geom
::
Vec4f
&
diffuse
)
{
this
->
bind
();
glUniform4fv
(
m_unif_diffuse
,
1
,
diffuse
.
data
());
m_diffuse
=
diffuse
;
}
void
ShaderPhong
3
::
setSpecular
(
const
Geom
::
Vec4f
&
specular
)
void
ShaderPhong
::
setSpecular
(
const
Geom
::
Vec4f
&
specular
)
{
this
->
bind
();
glUniform4fv
(
m_unif_specular
,
1
,
specular
.
data
());
m_specular
=
specular
;
}
void
ShaderPhong
3
::
setShininess
(
float
shininess
)
void
ShaderPhong
::
setShininess
(
float
shininess
)
{
this
->
bind
();
glUniform1f
(
m_unif_shininess
,
shininess
);
m_shininess
=
shininess
;
}
void
ShaderPhong
3
::
setLightPosition
(
Geom
::
Vec3f
lightPos
)
void
ShaderPhong
::
setLightPosition
(
Geom
::
Vec3f
lightPos
)
{
this
->
bind
();
glUniform3fv
(
m_unif_lightPos
,
1
,
lightPos
.
data
());
...
...
@@ -172,7 +172,7 @@ void ShaderPhong3::setLightPosition( Geom::Vec3f lightPos)
}
void
ShaderPhong
3
::
setParams
(
const
Geom
::
Vec4f
&
ambiant
,
const
Geom
::
Vec4f
&
diffuse
,
const
Geom
::
Vec4f
&
specular
,
float
shininess
,
const
Geom
::
Vec3f
&
lightPos
)
void
ShaderPhong
::
setParams
(
const
Geom
::
Vec4f
&
ambiant
,
const
Geom
::
Vec4f
&
diffuse
,
const
Geom
::
Vec4f
&
specular
,
float
shininess
,
const
Geom
::
Vec3f
&
lightPos
)
{
m_ambiant
=
ambiant
;
m_diffuse
=
diffuse
;
...
...
@@ -185,7 +185,7 @@ void ShaderPhong3::setParams(const Geom::Vec4f& ambiant, const Geom::Vec4f& diff
}
void
ShaderPhong
3
::
setAttributeColor
(
VBO
&
vbo
)
void
ShaderPhong
::
setAttributeColor
(
VBO
&
vbo
)
{
if
(
!
m_with_color
)
{
...
...
@@ -209,7 +209,7 @@ void ShaderPhong3::setAttributeColor(VBO& vbo)
}
void
ShaderPhong
3
::
unsetAttributeColor
()
void
ShaderPhong
::
unsetAttributeColor
()
{
if
(
m_with_color
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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