[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11240] branches/soc-2007-maike/source/ blender/src/glsl_specular.c: File discarded
Miguel Torres Lima
torreslima at gmail.com
Thu Jul 12 13:19:16 CEST 2007
Revision: 11240
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11240
Author: maike
Date: 2007-07-12 13:19:15 +0200 (Thu, 12 Jul 2007)
Log Message:
-----------
File discarded
Removed Paths:
-------------
branches/soc-2007-maike/source/blender/src/glsl_specular.c
Deleted: branches/soc-2007-maike/source/blender/src/glsl_specular.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_specular.c 2007-07-12 11:18:55 UTC (rev 11239)
+++ branches/soc-2007-maike/source/blender/src/glsl_specular.c 2007-07-12 11:19:15 UTC (rev 11240)
@@ -1,263 +0,0 @@
-#include "DNA_lamp_types.h"
-
-
-char *glsl_cooktorr(short lamp)
-{
- if(lamp == LA_HEMI){
- char *cooktorr = {
- "vec4 cooktorr_hemi(light l){"
- " vec3 view = normalize(eye - pos);"
- " vec3 h = normalize((eye - pos) + l.vec);"
- " float nh = 0.5 * (max(dot(norm, h), 0.0)) + 0.5;"
- " return(spec * nh * pow(nh, hard) * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return cooktorr;
- }
- else if(lamp == LA_SUN){
- char *cooktorr = {
- "vec4 cooktorr_sun(light l){"
- " vec3 view = normalize(eye - pos);"
- " vec3 h = normalize((eye - pos) + l.vec);"
- " float nh = max(dot(norm, h), 0.0);"
- " float nv = max(dot(norm, view), 0.0);"
- " return(spec * pow(nh, hard) * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0) / (0.1 + nv));"
- "}"
- };
-
- return cooktorr;
- }
- else{
- char *cooktorr = {
- "vec4 cooktorr(light_l){"
- " vec3 view = normalize(eye - pos);"
- " vec3 h = normalize((eye - pos) + (l.loc - pos));"
- " float nh = max(dot(norm, h), 0.0);"
- " float nv = max(dot(norm, view), 0.0);"
- " return(spec * pow(nh, hard) * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0) / (0.1 + nv));"
- "}"
- };
-
- return cooktorr;
- }
-}
-
-
-char *glsl_phong(short lamp)
-{
- if(lamp == LA_HEMI){
- char *phong = {
- "vec4 phong_hemi(light l){"
- " vec3 hV = normalize((eye - pos) + l.vec);"
- " float HdotN = max(dot(hV, norm), 0.0);"
- " float nh = 0.5 * HdotN + 0.5;"
- " return(spec * nh * pow(nh, hard) * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return phong;
- }
- else if(lamp == LA_SUN){
- char *phong = {
- "vec4 phong_sun(light l){"
- " vec3 hV = normalize((eye - pos) + l.vec);"
- " float HdotN = max(dot(hV, norm), 0.0);"
- " return(spec * pow(HdotN, hard) * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return phong;
- }
- else{
- char *phong = {
- "vec4 phong(light l){"
- " vec3 hV = normalize((eye - pos) + (l.loc - pos));"
- " float HdotN = max(dot(hV, norm), 0.0);"
- " return(spec * pow(HdotN, hard) * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return phong;
- }
-}
-
-
-char *glsl_blinn(short lamp)
-{
- if(lamp == LA_HEMI){
- char *blinn = {
- "vec4 blinn_hemi(light l){"
- " vec3 view = normalize(eye - pos);"
-
- " float har;"
- " if(refrac < 1.0 || hard == 0.0) return(0.0, 0.0, 0.0, 0.0);"
- " if(hard < 100.0) har = sqrt(1.0 / hard);"
- " else har = 10.0 / hard;"
-
- " vec3 h = normalize((eye - pos) + l.vec);"
- " float nh = 0.5 * dot(norm, h) + 0.5;"
- " return(spec * nh * pow(nh, hard) * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return blinn;
- }
- else if(lamp == LA_SUN){
- char *blinn = {
- "vec4 blinn_sun(light l){"
- " vec3 view = normalize(eye - pos);"
-
- " float har;"
- " if(refrac < 1.0 || hard == 0.0) return(0.0, 0.0, 0.0, 0.0);"
- " if(hard < 100.0) har = sqrt(1.0 / hard);"
- " else har = 10.0 / hard;"
-
- " vec3 h = normalize((eye - pos) + l.vec);"
- " float nh = dot(norm, h);"
- " float nv = max(dot(norm, view), 0.01);"
- " float nl = dot(norm, normalize(l.loc - pos));"
- " float vh = max(dot(view, h), 0.01);"
- " float a = 1.0;"
- " float b = (2.0 * nh * nv) / vh;"
- " float c = (2.0 * nh * nl) / vh;"
- " float ang = acos(clamp(nh, -1.0, 1.0);"
- " float g = min(a, min(b, c));"
- " float p = sqrt((refrac * refrac) + (vh * vh) - 1.0);"
- " float f = (((p - vh) * (p - vh)) / ((p + vh) * (p + vh))) * (1.0 + ((((vh * (p + vh)) - 1.0) * ((vh * (p + vh)) - 1.0)) / (((vh * (p - vh)) + 1.0) * ((vh * (p - vh)) + 1.0))));"
- " float rslt = max(f * g * exp((-1 * (ang * ang)) / (2.0 * har * har)), 0.0);"
- " return(spec * rslt * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return blinn;
- }
- else{
- char *blinn = {
- "vec4 blinn(light l){"
- " vec3 view = normalize(eye - pos);"
-
- " float har;"
- " if(refrac < 1.0 || hard == 0.0) return(0.0, 0.0, 0.0, 0.0);"
- " if(hard < 100.0) har = sqrt(1.0 / hard);"
- " else har = 10.0 / hard;"
-
- " vec3 h = normalize((eye - pos) + (l.loc - pos));"
- " float nh = dot(norm, h);"
- " float nv = max(dot(norm, view), 0.01);"
- " float nl = dot(norm, normalize(l.loc - pos));"
- " float vh = max(dot(view, h), 0.01);"
- " float a = 1.0;"
- " float b = (2.0 * nh * nv) / vh;"
- " float c = (2.0 * nh * nl) / vh;"
- " float ang = acos(clamp(nh, -1.0, 1.0);"
- " float g = min(a, min(b, c));"
- " float p = sqrt((refrac * refrac) + (vh * vh) - 1.0);"
- " float f = (((p - vh) * (p - vh)) / ((p + vh) * (p + vh))) * (1.0 + ((((vh * (p + vh)) - 1.0) * ((vh * (p + vh)) - 1.0)) / (((vh * (p - vh)) + 1.0) * ((vh * (p - vh)) + 1.0))));"
- " float rslt = max(f * g * exp((-1 * (ang * ang)) / (2.0 * har * har)), 0.0);"
- " return(spec * rslt * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return blinn;
- }
-}
-
-
-char *glsl_spectoon(short lamp)
-{
- if(lamp == LA_HEMI){
- char *toon = {
- "vec4 spectoon_hemi(light l){"
- " vec3 view = normalize(eye - pos);"
- " vec3 h = normalize((eye - pos) + l.vec);"
- " float rslt = dot(h, norm);"
- " float nh = 0.5 * rslt + 0.5;"
- " return(spec * nh * pow(nh, s_size) * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return toon;
- }
- else if(lamp == LA_SUN){
- char *toon = {
- "vec4 spectoon_sun(light l){"
- " vec3 view = normalize(eye - pos);"
- " vec3 h = normalize((eye - pos) + l.vec);"
- " float rslt = dot(h, norm);"
- " float ang = acos(clamp(rslt, -1.0, 1.0));"
- " rslt = clamp(ceil(s_size + s_smooth - ang - 0.00001) * (1.0 - (ang - s_size)) / s_smooth, 0.0, 1.0);"
- " return(rslt * spec * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return toon;
- }
- else{
- char *toon = {
- "vec4 spectoon(light l){"
- " vec3 view = normalize(eye - pos);"
- " vec3 h = normalize((eye - pos) + (l.loc - pos));"
- " float rslt = dot(h, norm);"
- " float ang = acos(clamp(rslt, -1.0, 1.0));"
- " rslt = clamp(ceil(s_size + s_smooth - ang - 0.00001) * (1.0 - (ang - s_size)) / s_smooth, 0.0, 1.0);"
- " return(rslt * spec * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return toon;
- }
-}
-
-
-char *glsl_wardiso(short lamp)
-{
- if(lamp == LA_HEMI){
- char *wardiso = {
- "vec4 wardiso_hemi(light l){"
- " vec3 view = normalize(eye - pos);"
- " vec h = normalize((eye - pos) + l.vec);"
- " float nh = 0.5 * dot(norm, h) + 0.5;"
- " return(spec * nh * pow(nh, rms) * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return wardiso;
- }
- else if(lamp == LA_SUN){
- char *wardiso = {
- "vec4 wardiso_sun(light l){"
- " vec3 view = normalize(eye - pos);"
- " vec h = normalize((eye - pos) + l.vec);"
- " float nh = max(dot(norm, h), 0.001);"
- " float nv = max(dot(norm, view), 0.001);"
- " float nl = max(dot(norm, normalize(l.loc - pos)), 0.001);"
- " float alpha = max(rms, 0.001);"
- " float ang = acos(clamp(nh, -1.0, 1.0));"
- " float angle = tan(ang);"
- " float rslt = nl * (1.0 / (4.0 * 3.14159265358979323846 * alpha * alpha)) * (exp ((-1 * angle * angle) / (alpha * alpha)) / (sqrt(nv * nl)));"
- " return(spec * rslt * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return wardiso;
- }
- else{
- char *wardiso = {
- "vec4 wardiso(light l){"
- " vec3 view = normalize(eye - pos);"
- " vec h = normalize((eye - pos) + (l.loc - pos));"
- " float nh = max(dot(norm, h), 0.001);"
- " float nv = max(dot(norm, view), 0.001);"
- " float nl = max(dot(norm, normalize(l.loc - pos)), 0.001);"
- " float alpha = max(rms, 0.001);"
- " float ang = acos(clamp(nh, -1.0, 1.0));"
- " float angle = tan(ang);"
- " float rslt = nl * (1.0 / (4.0 * 3.14159265358979323846 * alpha * alpha)) * (exp ((-1 * angle * angle) / (alpha * alpha)) / (sqrt(nv * nl)));"
- " return(spec * rslt * l.no_spec * l.layer * vec4(l.color + vert_color, 1.0) * l.energy * vec4(spec_color, 1.0));"
- "}"
- };
-
- return wardiso;
- }
-}
More information about the Bf-blender-cvs
mailing list