[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27672] branches/render25/source/blender/ editors/space_view3d/drawobject.c: Render Branch: lamp distance drawn in 3d view now takes into account

Brecht Van Lommel brecht at blender.org
Tue Mar 23 12:38:47 CET 2010


Revision: 27672
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27672
Author:   blendix
Date:     2010-03-23 12:38:47 +0100 (Tue, 23 Mar 2010)

Log Message:
-----------
Render Branch: lamp distance drawn in 3d view now takes into account
color management so that the cutoff is really at 0.01 of the intensity.

Modified Paths:
--------------
    branches/render25/source/blender/editors/space_view3d/drawobject.c

Modified: branches/render25/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/render25/source/blender/editors/space_view3d/drawobject.c	2010-03-23 10:44:20 UTC (rev 27671)
+++ branches/render25/source/blender/editors/space_view3d/drawobject.c	2010-03-23 11:38:47 UTC (rev 27672)
@@ -852,8 +852,13 @@
 	glCullFace(GL_BACK);
 }
 
-static float lamp_half_energy_distance(Lamp *la)
+static float lamp_half_energy_distance(Scene *scene, Lamp *la)
 {
+	float cutoff= 0.01f; /* cutoff intensity */
+
+	if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+		cutoff= srgb_to_linearrgb(cutoff);
+
 	switch(la->type) {
 		case LA_SUN:
 		case LA_HEMI:
@@ -861,7 +866,7 @@
 
 		case LA_AREA:
 			if(!la->mode & LA_MULTI_SHADE)
-				return sqrtf(100.0f);
+				return sqrtf(1.0f/cutoff);
 			
 			/* fall through */
 		case LA_SPOT:
@@ -870,9 +875,9 @@
 			if(la->falloff_type == LA_FALLOFF_CONSTANT)
 				return 1.0f;
 			else if(la->falloff_type == LA_FALLOFF_INVLINEAR)
-				return maxf(100.0f - la->falloff_smooth*la->power, 0.1f);
+				return maxf(1.0f/cutoff - la->falloff_smooth*la->power, 0.1f);
 			else if(la->falloff_type == LA_FALLOFF_INVSQUARE)
-				return sqrtf(maxf(100.0f - la->falloff_smooth*la->power, 0.1f));
+				return sqrtf(maxf(1.0f/cutoff - la->falloff_smooth*la->power, 0.1f));
 			else if(la->falloff_type == LA_FALLOFF_CURVE)
 				return la->dist;
 	}
@@ -897,7 +902,7 @@
 	}
 
 	/* compute lamp distance */
-	lampdist= lamp_half_energy_distance(la);
+	lampdist= lamp_half_energy_distance(scene, la);
 	
 	/* we first draw only the screen aligned & fixed scale stuff */
 	glPushMatrix();





More information about the Bf-blender-cvs mailing list