Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
CGoGN
CGoGN
Commits
86c98a1b
Commit
86c98a1b
authored
Oct 25, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update shader envmap
parent
987589be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
include/Utils/Shaders/shaderEnvMap.frag
include/Utils/Shaders/shaderEnvMap.frag
+2
-2
include/Utils/Shaders/shaderEnvMap.h
include/Utils/Shaders/shaderEnvMap.h
+22
-5
No files found.
include/Utils/Shaders/shaderEnvMap.frag
View file @
86c98a1b
//ShaderEnvMap::fragmentShaderText
PRECISON
;
VARYING_FRAG
vec3
EyeVector
,
Normal
,
LightDir
,
refl
;
VARYING_FRAG
vec3
EyeVector
,
Normal
,
LightDir
;
#ifdef WITH_COLOR
VARYING_FRAG
vec3
Color
;
#endif
...
...
@@ -35,7 +35,7 @@ void main()
#endif
vec3
R
=
reflect
(
-
EyeVector
,
N
);
finalColor
+=
mix
(
col
,
texture
(
EnvMap
,
R
),
blendCoef
)
*
lambertTerm
;
finalColor
+=
mix
(
col
,
texture
Cube
(
EnvMap
,
R
),
blendCoef
)
*
lambertTerm
;
}
gl_FragColor
=
finalColor
;
}
include/Utils/Shaders/shaderEnvMap.h
View file @
86c98a1b
...
...
@@ -40,7 +40,11 @@ namespace CGoGN
namespace
Utils
{
/**
* Class for shader environment mapping (cube mapping)
*
* @warning shader code is GL2.0 compatible for GL3.0 replace textureCube by texture in fragment shader !
*/
class
ShaderEnvMap
:
public
ClippingShader
{
protected:
...
...
@@ -115,10 +119,22 @@ public:
unsigned
int
setAttributeNormal
(
VBO
*
vbo
);
// optional attributes
unsigned
int
setAttributeColor
(
VBO
*
vbo
);
void
unsetAttributeColor
();
/**
* need to be called just before draw
*/
void
predraw
();
/**
* need to be called just after draw
*/
void
postdraw
();
void
setCubeMap
(
unsigned
int
sz
,
unsigned
char
*
Xpos
,
unsigned
char
*
Ypos
,
unsigned
char
*
Zpos
,
unsigned
char
*
Xneg
,
unsigned
char
*
Yneg
,
unsigned
char
*
Zneg
);
/**
...
...
@@ -135,16 +151,17 @@ public:
/**
* set colored plane for testing
*/
bool
setCubeMap
Pipo
();
bool
setCubeMap
Colored
();
/**
* set colored plane for testing
*/
bool
setCubeMapCheckered
();
#ifdef WITH_QT
bool
setCubeMap
(
const
std
::
string
&
filename
);
#endif
void
predraw
();
void
postdraw
();
};
}
// namespace Utils
...
...
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