[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11239] branches/soc-2007-maike/source/ blender/src/glsl_diffuse.c: Discarded file
Miguel Torres Lima
torreslima at gmail.com
Thu Jul 12 13:18:56 CEST 2007
Revision: 11239
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11239
Author: maike
Date: 2007-07-12 13:18:55 +0200 (Thu, 12 Jul 2007)
Log Message:
-----------
Discarded file
Removed Paths:
-------------
branches/soc-2007-maike/source/blender/src/glsl_diffuse.c
Deleted: branches/soc-2007-maike/source/blender/src/glsl_diffuse.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_diffuse.c 2007-07-12 11:17:37 UTC (rev 11238)
+++ branches/soc-2007-maike/source/blender/src/glsl_diffuse.c 2007-07-12 11:18:55 UTC (rev 11239)
@@ -1,235 +0,0 @@
-#include "DNA_lamp_types.h"
-
-#include "BIF_glsl_diffuse.h"
-
-
-char *glsl_lambert(short lamp)
-{
- if(lamp == LA_HEMI){
- char *lambert = {
- "\nvec4 lambert_hemi(light l){"
- " vec3 lightVec = normalize(l.vec);"
- " return((0.5 * dot(lightVec, norm) + 0.5) * ref * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return lambert;
- }
- else if(lamp == LA_SUN){
- char *lambert = {
- "\nvec4 lambert_sun(light l){"
- " vec3 lightVec = normalize(l.vec);"
- " return(max(dot(lightVec, norm) * ref * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy, 0.0));"
- "}\n"
- };
-
- return lambert;
- }
- else{
- char *lambert = {
- "\nvec4 lambert(light l){"
- " vec3 lightVec = normalize(l.loc - pos);"
- " return(max(dot(lightVec, norm) * ref * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy, 0.0));"
- "}\n"
- };
-
- return lambert;
- }
-}
-
-
-char *glsl_orennayar(short lamp)
-{
- if(lamp == LA_HEMI){
- char *orennayar = {
- "\nvec4 orennayar_hemi(light l){"
- " vec3 lightVec = normalize(l.vec);"
- " return((0.5 * dot(lightVec, norm) + 0.5) * ref * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return orennayar;
- }
- else if(lamp == LA_SUN){
- char *orennayar = {
- "\nvec4 orennayar_sun(light l){"
- " vec3 lightVec = normalize(l.vec);"
- " vec3 view = normalize(eye - pos);"
- " vec3 h = normalize(view + lightVec);"
- " float nh = max(dot(norm, h), 0.0);"
- " float nv = max(dot(norm, view), 0.0);"
- " float nl = max(dot(norm, lightVec), 0.0);"
- " float vh = max(dot(view, h), 0.0);"
- " float lit_A = acos(clamp(nl, -1.0, 1.0));"
- " float view_A = acos(clamp(nv, -1.0, 1.0));"
- " vec3 lit_B = normalize(lightVec - (nl * norm));"
- " vec3 view_B = normalize(view - (nv * norm));"
- " float t = max(dot(lit_B, view_B), 0.0);"
- " float A = 1.0 - (0.5 * ((roughness * roughness) / ((roughness * roughness) + 0.33)));"
- " float B = 0.45 * ((roughness * roughness) / ((roughness * roughness) + 0.09));"
- " b = b * 0.95;"
- " float res = nl * (A + (B * t * sin(max(lit_A, view_A)) * tan(min(lit_A, view_A))));"
- " return(ref * res * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);\n"
- "}\n"
- };
-
- return orennayar;
- }
- else{
- char *orennayar = {
- "\nvec4 orennayar(light l){"
- " vec3 lightVec = normalize(l.loc - pos);"
- " vec3 view = normalize(eye - pos);"
- " vec3 h = normalize(view + lightVec);"
- " float nh = max(dot(norm, h), 0.0);"
- " float nv = max(dot(norm, view), 0.0);"
- " float nl = max(dot(norm, lightVec), 0.0);"
- " float vh = max(dot(view, h), 0.0);"
- " float lit_A = acos(clamp(nl, -1.0, 1.0));"
- " float view_A = acos(clamp(nv, -1.0, 1.0));"
- " vec3 lit_B = normalize(lightVec - (nl * norm));"
- " vec3 view_B = normalize(view - (nv * norm));"
- " float t = max(dot(lit_B, view_B), 0.0);"
- " float A = 1.0 - (0.5 * ((roughness * roughness) / ((roughness * roughness) + 0.33)));"
- " float B = 0.45 * ((roughness * roughness) / ((roughness * roughness) + 0.09));"
- " b = b * 0.95;"
- " float res = nl * (A + (B * t * sin(max(lit_A, view_A)) * tan(min(lit_A, view_A))));"
- " return(ref * res * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);\n"
- "}\n"
- };
-
- return orennayar;
- }
-}
-
-
-char *glsl_difftoon(short lamp)
-{
- if(lamp == LA_HEMI){
- char *toon = {
- "\nvec4 difftoon_hemi(light l){"
- " vec3 lightVec = normalize(l.vec);"
- " return((0.5 * dot(lightVec, norm) + 0.5) * ref * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return toon;
- }
- else if(lamp == LA_SUN){
- char *toon = {
- "\nvec4 difftoon_sun(light l){"
- " vec3 lightVec = normalize(l.vec);"
- " float rslt = dot(norm, lightVec);"
- " float ang;"
- " ang = acos(clamp(rslt, -1.0, 1.0));"
- " rslt = clamp(ceil(size + smooth - ang - 0.00001) * (1.0 - (ang - size)) / smooth, 0.0, 1.0);"
- " return(rslt * ref * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return toon;
- }
- else{
- char *toon = {
- "\nvec4 difftoon(light l){"
- " vec3 lightVec = normalize(l.loc - pos);"
- " float rslt = dot(norm, lightVec);"
- " float ang;"
- " ang = acos(clamp(rslt, -1.0, 1.0));"
- " rslt = clamp(ceil(size + smooth - ang - 0.00001) * (1.0 - (ang - size)) / smooth, 0.0, 1.0);"
- " return(rslt * ref * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return toon;
- }
-}
-
-
-char *glsl_minnaert(short lamp)
-{
- if(lamp == LA_HEMI){
- char *minnaert = {
- "\nvec4 minnaert_hemi(light l){"
- " vec3 lightVec = normalize(l.vec);"
- " return((0.5 * dot(lightVec, norm) + 0.5) * ref * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return minnaert;
- }
- else if(lamp == LA_SUN){
- char *minnaert = {
- "\nvec4 minnaert_sun(light l){"
- " vec3 lightVec = normalize(l.vec);"
- " vec3 view = normalize(eye - pos);"
- " float nl = clamp(dot(norm, lightVec), 0.0, 1.0);"
- " float nv = max(dot(norm, view), 0.0);"
- " float res;"
- " if(darkness <= 1.0) res = nl * pow(max(nv * nl, 0.1), darkness - 1.0);"
- " else res = nl * pow(1.001 - nv, darkness - 1.0);"
- " return(ref * res * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return minnaert;
- }
- else{
- char *minnaert = {
- "\nvec4 minnaert(light l){"
- " vec3 lightVec = normalize(l.loc - pos);"
- " vec3 view = normalize(eye - pos);"
- " float nl = clamp(dot(norm, lightVec), 0.0, 1.0);"
- " float nv = max(dot(norm, view), 0.0);"
- " float res;"
- " if(darkness <= 1.0) res = nl * pow(max(nv * nl, 0.1), darkness - 1.0);"
- " else res = nl * pow(1.001 - nv, darkness - 1.0);"
- " return(ref * res * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return minnaert;
- }
-}
-
-
-char *glsl_fresnel(short lamp)
-{
- if(lamp == LA_HEMI){
- char *fresnel = {
- "\nvec4 fresnel_hemi(light l){"
- " vec3 view = normalize(l.vec);"
- " return((0.5 * dot(view, norm) + 0.5) * ref * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return fresnel;
- }
- else if(lamp == LA_SUN){
- char *fresnel = {
- "\nvec4 fresnel_sun(light l){"
- " vec3 view = normalize(l.vec);"
- " float t1 = dot(view, norm);"
- " float t2 = 1.0 + abs(t1);"
- " t2 = grad + (1.0 - grad) * pow(t2, fac);"
- " return(ref * clamp(t2, 0.0, 1.0) * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return fresnel;
- }
- else{
- char *fresnel = {
- "\nvec4 fresnel(light l){"
- " vec3 view = normalize(eye - pos);"
- " float t1 = dot(view, norm);"
- " float t2 = 1.0 + abs(t1);"
- " t2 = grad + (1.0 - grad) * pow(t2, fac);"
- " return(ref * clamp(t2, 0.0, 1.0) * l.no_diff * l.layer * vec4(l.color + vert_color, 1.0) * l.energy);"
- "}\n"
- };
-
- return fresnel;
- }
-}
-
More information about the Bf-blender-cvs
mailing list