Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
alta
alta
Commits
a2365479
Commit
a2365479
authored
Oct 22, 2013
by
Laurent Belcour
Browse files
Fixing retro-fresnel export function
parent
185878c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
sources/plugins/nonlinear_fresnel_retroschlick/function.cpp
View file @
a2365479
...
...
@@ -148,12 +148,21 @@ void retro_schlick::save_call(std::ostream& out, const arguments& args) const
if
(
is_alta
)
{
out
<<
"#FUNC nonlinear_fresnel_retro_schlick"
<<
std
::
endl
;
out
<<
"R "
<<
R
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
dimY
();
++
i
)
{
out
<<
"R "
<<
R
[
i
]
<<
std
::
endl
;
}
out
<<
std
::
endl
;
}
else
{
out
<<
" * retro_schlick_fresnel(L, V, N, X, Y, "
<<
R
<<
")"
;
out
<<
"retro_schlick_fresnel(L, V, N, X, Y, vec3("
;
for
(
int
i
=
0
;
i
<
dimY
();
++
i
)
{
out
<<
R
[
i
];
if
(
i
<
_nY
-
1
)
{
out
<<
", "
;
}
}
out
<<
"))"
;
}
}
...
...
@@ -164,11 +173,11 @@ void retro_schlick::save_body(std::ostream& out, const arguments& args) const
if
(
is_shader
)
{
out
<<
std
::
endl
;
out
<<
"vec3 retro_schlick_fresnel(vec3 L, vec3 V, vec3 N, vec3 X, vec3 Y,
float
R)"
<<
std
::
endl
;
out
<<
"vec3 retro_schlick_fresnel(vec3 L, vec3 V, vec3 N, vec3 X, vec3 Y,
vec3
R
0
)"
<<
std
::
endl
;
out
<<
"{"
<<
std
::
endl
;
out
<<
"
\t
vec3 R = 2.0f*dot(V,N)*N - V;"
<<
std
::
endl
;
out
<<
"
\t
vec3 K = normalize(L + R);"
<<
std
::
endl
;
out
<<
"
\t
return vec3(R + (1.0f - R) * pow(1.0f - clamp(dot(K,R), 0.0f, 1.0f), 5));"
<<
std
::
endl
;
out
<<
"
\t
return vec3(R
0
+
(vec3
(1.0f
)
- R
0
) * pow(1.0f - clamp(dot(K,R), 0.0f, 1.0f), 5
.0f
));"
<<
std
::
endl
;
out
<<
"}"
<<
std
::
endl
;
out
<<
std
::
endl
;
}
...
...
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