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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
0d256b2c
Commit
0d256b2c
authored
Aug 19, 2011
by
CGoGN GIT Supervisor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolution conflit Lionel (shaderPhong)
parent
cd9abeae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
61 deletions
+9
-61
src/Utils/Shaders/shaderPhong.cpp
src/Utils/Shaders/shaderPhong.cpp
+9
-61
No files found.
src/Utils/Shaders/shaderPhong.cpp
View file @
0d256b2c
...
...
@@ -32,67 +32,9 @@ namespace Utils
{
#include "shaderPhong.vert"
#include "shaderPhong.frag"
//std::string ShaderPhong::vertexShaderText =
//"ATTRIBUTE vec3 VertexPosition, VertexNormal;\n"
//"#ifdef WITH_COLOR\n"
//"ATTRIBUTE vec3 VertexColor;\n"
//"#endif\n"
//"uniform mat4 ModelViewProjectionMatrix;\n"
//"uniform mat4 ModelViewMatrix;\n"
//"uniform mat4 NormalMatrix;\n"
//"uniform vec3 lightPosition;\n"
//"VARYING_VERT vec3 EyeVector, Normal, LightDir;\n"
//"#ifdef WITH_COLOR\n"
//"VARYING_VERT vec3 Color;\n"
//"#endif\n"
//"INVARIANT_POS;\n"
//"void main ()\n"
//"{\n"
//" Normal = vec3 (NormalMatrix * vec4 (VertexNormal, 0.0));\n"
//" vec3 Position = vec3 (ModelViewMatrix * vec4 (VertexPosition, 1.0));\n"
//" LightDir = lightPosition - Position;\n"
//" EyeVector = -Position;\n"
//" #ifdef WITH_COLOR\n"
//" Color = VertexColor;\n"
//" #endif\n"
//" gl_Position = ModelViewProjectionMatrix * vec4 (VertexPosition, 1.0);\n"
//"}";
//std::string ShaderPhong::fragmentShaderText =
//"PRECISON;\n"
//"VARYING_FRAG vec3 EyeVector, Normal, LightDir;\n"
//"#ifdef WITH_COLOR\n"
//"VARYING_FRAG vec3 Color;\n"
//"#endif\n"
//"uniform vec4 materialDiffuse;\n"
//"uniform vec4 materialSpecular;\n"
//"uniform vec4 materialAmbient;\n"
//"uniform float shininess;\n"
//"FRAG_OUT_DEF;\n"
//"void main()\n"
//"{\n"
//" vec3 N = normalize (Normal);\n"
//" vec3 L = normalize (LightDir);\n"
//" float lambertTerm = dot(N,L);\n"
//
//" vec4 finalColor = materialAmbient;\n"
//" if(lambertTerm > 0.0)\n"
//" {\n"
//" #ifndef WITH_COLOR\n"
//" finalColor += materialDiffuse * lambertTerm;\n"
//" #else\n"
//" finalColor += vec4((Color*lambertTerm),0.0) ;\n"
//" #endif\n"
//" vec3 E = normalize(EyeVector);\n"
//" vec3 R = reflect(-L, N);\n"
//" float specular = pow( max(dot(R, E), 0.0), shininess );\n"
//" finalColor += materialSpecular * specular;\n"
//" }\n"
//" gl_FragColor=finalColor;\n"
//"}";
ShaderPhong
::
ShaderPhong
()
:
ShaderPhong
::
ShaderPhong
(
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
)),
...
...
@@ -103,11 +45,19 @@ ShaderPhong::ShaderPhong():
m_vboNormal
(
NULL
),
m_vboColor
(
NULL
)
{
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
);
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
);
loadShadersFromMemory
(
glxvert
.
c_str
(),
glxfrag
.
c_str
());
...
...
@@ -232,14 +182,12 @@ void ShaderPhong::restoreUniformsAttribs()
getLocations
();
bind
();
sendParams
();
bindVA_VBO
(
"VertexPosition"
,
m_vboPos
);
bindVA_VBO
(
"VertexNormal"
,
m_vboNormal
);
if
(
m_vboColor
)
bindVA_VBO
(
"VertexColor"
,
m_vboColor
);
unbind
();
}
...
...
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