[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21992] branches/soc-2009-yukishiro/source /blender/sh/intern/compute.c: clamp output values for hdr images

Jingyuan Huang jingyuan.huang at gmail.com
Tue Jul 28 21:32:38 CEST 2009


Revision: 21992
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21992
Author:   yukishiro
Date:     2009-07-28 21:32:38 +0200 (Tue, 28 Jul 2009)

Log Message:
-----------
clamp output values for hdr images

Modified Paths:
--------------
    branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c

Modified: branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c
===================================================================
--- branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c	2009-07-28 19:14:25 UTC (rev 21991)
+++ branches/soc-2009-yukishiro/source/blender/sh/intern/compute.c	2009-07-28 19:32:38 UTC (rev 21992)
@@ -62,6 +62,7 @@
 #define L 4
 #define NUM_SAMPLES 100
 #define SQRT_SAMPLES 10
+#define CLAMP(val) ((val)<0.0f) ? 0 : (((val)>1.0f) ? 1.0f : (val))
 
 typedef float Vec3[3];
 typedef float** ShCoeffs;
@@ -1057,6 +1058,9 @@
                                 lval[1] += y_val[m] * env->shcoeffs[m][1];
                                 lval[2] += y_val[m] * env->shcoeffs[m][2];
                         }
+			lval[0] = CLAMP(lval[0]);
+			lval[1] = CLAMP(lval[1]);
+			lval[2] = CLAMP(lval[2]);
                         lval[3] = 1.0;
                 }
         }





More information about the Bf-blender-cvs mailing list