[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11870] branches/soc-2007-maike/release/ glsl: Changes related to the creation of just a texture for all colorbands
Miguel Torres Lima
torreslima at gmail.com
Tue Aug 28 17:01:53 CEST 2007
Revision: 11870
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11870
Author: maike
Date: 2007-08-28 17:01:53 +0200 (Tue, 28 Aug 2007)
Log Message:
-----------
Changes related to the creation of just a texture for all colorbands
Modified Paths:
--------------
branches/soc-2007-maike/release/glsl/light_calc.gsl
branches/soc-2007-maike/release/glsl/material_return.gsl
branches/soc-2007-maike/release/glsl/material_return_cb_diff.gsl
branches/soc-2007-maike/release/glsl/material_return_cb_spec.gsl
branches/soc-2007-maike/release/glsl/uniforms.gsl
Modified: branches/soc-2007-maike/release/glsl/light_calc.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/light_calc.gsl 2007-08-28 14:55:23 UTC (rev 11869)
+++ branches/soc-2007-maike/release/glsl/light_calc.gsl 2007-08-28 15:01:53 UTC (rev 11870)
@@ -21,7 +21,7 @@
diff_fac = dot(normalize((eye - pos)), normalize(normal));
#endif
#endif
- diff_cb = texture1D(DIFF_CB_TEX, clamp(diff_fac, 0.000, 0.999));
+ diff_cb = texture2D(colorband_tex, vec2(clamp(diff_fac, 0.000, 0.999), DIFF_CB_INDEX));
diff_rslt += DIFF_CB_BLEND_FUNC(diff_cb.rgb, diff_color, DIFF_CB_FAC * diff_cb.a) * rslt1 * diff1 * vec3(lights[LIGHT_ID].color) * vis * lights[LIGHT_ID].energy;
#else
#ifdef HEMI
@@ -55,7 +55,7 @@
spec_fac = dot(normalize(eye - pos), normalize(normal));
#endif
#endif
- spec_cb = texture1D(SPEC_CB_TEX, clamp(spec_fac, 0.0, 0.999));
+ spec_cb = texture2D(colorband_tex, vec2(clamp(spec_fac, 0.0, 0.999), SPEC_CB_INDEX));
spec_rslt += SPEC_CB_BLEND_FUNC(spec_cb.rgb, spec_color, SPEC_CB_FAC * spec_cb.a) * rslt2 * spec1 * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
#else
spec_rslt+= rslt2 * spec1 * spec_color * vec3(lights[LIGHT_ID].color) * lights[LIGHT_ID].energy * vis;
Modified: branches/soc-2007-maike/release/glsl/material_return.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/material_return.gsl 2007-08-28 14:55:23 UTC (rev 11869)
+++ branches/soc-2007-maike/release/glsl/material_return.gsl 2007-08-28 15:01:53 UTC (rev 11870)
@@ -6,8 +6,8 @@
#undef SPEC_CB_TYPE
#undef DIFF_CB_BLEND_FUNC
#undef SPEC_CB_BLEND_FUNC
-#undef DIFF_CB_TEX
-#undef SPEC_CB_TEX
+#undef DIFF_CB_INDEX
+#undef SPEC_CB_INDEX
#undef DIFF_CB_FAC
#undef SPEC_CB_FAC
}
Modified: branches/soc-2007-maike/release/glsl/material_return_cb_diff.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/material_return_cb_diff.gsl 2007-08-28 14:55:23 UTC (rev 11869)
+++ branches/soc-2007-maike/release/glsl/material_return_cb_diff.gsl 2007-08-28 15:01:53 UTC (rev 11870)
@@ -3,14 +3,14 @@
diff_rslt = amb_exp * (1.0 - exp((diff_rslt + (diff_color * vec3(emit + vert_color.r, emit + vert_color.g, emit + vert_color.b))) * amb_range)) + amb_rslt;
if(diff_rslt.r >= 0.005 || diff_rslt.g >= 0.005 || diff_rslt.b >= 0.005){
float diff_cb_rslt_fac = (0.3 * diff_rslt.r + 0.58 * diff_rslt.g + 0.12 * diff_rslt.b);
- vec4 diff_cb_rslt_tex = texture1D(DIFF_CB_TEX, clamp(diff_cb_rslt_fac, 0.0, 0.999));
+ vec4 diff_cb_rslt_tex = texture2D(colorband_tex, vec2(clamp(diff_cb_rslt_fac, 0.0, 0.999), DIFF_CB_INDEX));
diff_rslt = (DIFF_CB_BLEND_FUNC(diff_cb_rslt_tex.rgb, diff_rslt.rgb, DIFF_CB_FAC * diff_cb_rslt_tex.a));
}
#ifdef SPEC_CB_RESULT
if(spec_cb_res > 0.0){
spec_rslt = amb_exp * (1.0 - exp(spec_rslt * amb_range));
float spec_cb_rslt_fac = (0.3 * spec_rslt.r + 0.58 * spec_rslt.g + 0.12 * spec_rslt.b);
- vec4 spec_cb_rslt_tex = texture1D(SPEC_CB_TEX, clamp(spec_cb_rslt_fac, 0.0, 0.999));
+ vec4 spec_cb_rslt_tex = texture2D(colorband_tex, vec2(clamp(spec_cb_rslt_fac, 0.0, 0.999), SPEC_CB_INDEX));
spec_rslt = (SPEC_CB_BLEND_FUNC(spec_cb_rslt_tex.rgb, spec_rslt.rgb, SPEC_CB_FAC * spec_cb_rslt_tex.a));
}
#else
@@ -24,8 +24,8 @@
#undef DIFF_CB_BLEND_FUNC
#undef SPEC_CB_BLEND_FUNC
-#undef DIFF_CB_TEX
-#undef SPEC_CB_TEX
+#undef DIFF_CB_INDEX
+#undef SPEC_CB_INDEX
#undef DIFF_CB_FAC
#undef SPEC_CB_FAC
#undef DIFF_CB_RESULT
Modified: branches/soc-2007-maike/release/glsl/material_return_cb_spec.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/material_return_cb_spec.gsl 2007-08-28 14:55:23 UTC (rev 11869)
+++ branches/soc-2007-maike/release/glsl/material_return_cb_spec.gsl 2007-08-28 15:01:53 UTC (rev 11870)
@@ -2,7 +2,7 @@
if(spec_cb_res > 0.0){
spec_rslt = amb_exp * (1.0 - exp(spec_rslt * amb_range));
float spec_cb_rslt_fac = (0.3 * spec_rslt.r + 0.58 * spec_rslt.g + 0.12 * spec_rslt.b);
- vec4 spec_cb_rslt_tex = texture1D(SPEC_CB_TEX, clamp(spec_cb_rslt_fac, 0.0, 0.999));
+ vec4 spec_cb_rslt_tex = texture2D(colorband_tex, vec2(clamp(spec_cb_rslt_fac, 0.0, 0.999), SPEC_CB_INDEX));
spec_rslt = (SPEC_CB_BLEND_FUNC(spec_cb_rslt_tex.rgb, spec_rslt.rgb, SPEC_CB_FAC * spec_cb_rslt_tex.a));
diff_rslt = amb_exp * (1.0 - exp((diff_rslt + (diff_color * vec3(emit + vert_color.r, emit + vert_color.g, emit + vert_color.b))) * amb_range));
return(diff_rslt + spec_rslt + amb_rslt);
@@ -12,8 +12,8 @@
#undef DIFF_CB_BLEND_FUNC
#undef SPEC_CB_BLEND_FUNC
-#undef DIFF_CB_TEX
-#undef SPEC_CB_TEX
+#undef DIFF_CB_INDEX
+#undef SPEC_CB_INDEX
#undef DIFF_CB_FAC
#undef SPEC_CB_FAC
#undef DIFF_CB_RESULT
Modified: branches/soc-2007-maike/release/glsl/uniforms.gsl
===================================================================
--- branches/soc-2007-maike/release/glsl/uniforms.gsl 2007-08-28 14:55:23 UTC (rev 11869)
+++ branches/soc-2007-maike/release/glsl/uniforms.gsl 2007-08-28 15:01:53 UTC (rev 11870)
@@ -1,4 +1,5 @@
uniform vec3 eye;
uniform vec3 amb_color;
-uniform float amb_exp, amb_range;
\ No newline at end of file
+uniform float amb_exp, amb_range;
+uniform sampler2D colorband_tex;
More information about the Bf-blender-cvs
mailing list