[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29380] trunk/blender/source/blender: lamp drawing clip start request by venomgfx, with wide lamps its hard to tell where clip start is at the edge of a lamp .

Campbell Barton ideasman42 at gmail.com
Thu Jun 10 09:57:27 CEST 2010


Revision: 29380
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29380
Author:   campbellbarton
Date:     2010-06-10 09:57:25 +0200 (Thu, 10 Jun 2010)

Log Message:
-----------
lamp drawing clip start request by venomgfx, with wide lamps its hard to tell where clip start is at the edge of a lamp.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/windowmanager/intern/wm_jobs.c

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c	2010-06-10 02:29:41 UTC (rev 29379)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c	2010-06-10 07:57:25 UTC (rev 29380)
@@ -773,9 +773,7 @@
 {
 	float sta[3], end[3], lavec[3];
 
-	lavec[0]= -mat[2][0];
-	lavec[1]= -mat[2][1];
-	lavec[2]= -mat[2][2];
+	negate_v3_v3(lavec, mat[2]);
 	normalize_v3(lavec);
 
 	sta[0]= mat[3][0]+ la->clipsta*lavec[0];
@@ -1077,17 +1075,20 @@
 		/* draw the circle/square at the end of the cone */
 		glTranslatef(0.0, 0.0 ,  x);
 		if(la->mode & LA_SQUARE) {
-			vvec[0]= fabs(z);
-			vvec[1]= fabs(z);
-			vvec[2]= 0.0;
+			float tvec[3];
+			float z_abs= fabs(z);
+
+			tvec[0]= tvec[1]= z_abs;
+			tvec[2]= 0.0;
+
 			glBegin(GL_LINE_LOOP);
-				glVertex3fv(vvec);
-				vvec[1]= -fabs(z);
-				glVertex3fv(vvec);
-				vvec[0]= -fabs(z);
-				glVertex3fv(vvec);
-				vvec[1]= fabs(z);
-				glVertex3fv(vvec);
+				glVertex3fv(tvec);
+				tvec[1]= -z_abs; /* neg */
+				glVertex3fv(tvec);
+				tvec[0]= -z_abs; /* neg */
+				glVertex3fv(tvec);
+				tvec[1]= z_abs; /* pos */
+				glVertex3fv(tvec);
 			glEnd();
 		}
 		else circ(0.0, 0.0, fabs(z));
@@ -1104,6 +1105,22 @@
 
 		if(drawcone)
 			draw_transp_spot_volume(la, x, z);
+
+		/* draw clip start, useful for wide cones where its not obvious where the start is */
+		glTranslatef(0.0, 0.0 , -x); /* reverse translation above */
+		if(la->type==LA_SPOT && (la->mode & LA_SHAD_BUF) ) {
+			float lvec_clip[3];
+			float vvec_clip[3];
+			float clipsta_fac= la->clipsta / -x;
+
+			interp_v3_v3v3(lvec_clip, vec, lvec, clipsta_fac);
+			interp_v3_v3v3(vvec_clip, vec, vvec, clipsta_fac);
+
+			glBegin(GL_LINE_STRIP);
+				glVertex3fv(lvec_clip);
+				glVertex3fv(vvec_clip);
+			glEnd();
+		}
 	}
 	else if ELEM(la->type, LA_HEMI, LA_SUN) {
 		

Modified: trunk/blender/source/blender/windowmanager/intern/wm_jobs.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_jobs.c	2010-06-10 02:29:41 UTC (rev 29379)
+++ trunk/blender/source/blender/windowmanager/intern/wm_jobs.c	2010-06-10 07:57:25 UTC (rev 29380)
@@ -450,7 +450,7 @@
 	}
 	
 	/* on file load 'winactive' can be NULL, possibly it should not happen but for now do a NULL check - campbell */
-	if(wm->winactive) {
+//	if(wm->winactive) {
 		/* if there are running jobs, set the global progress indicator */
 		if (jobs_progress > 0) {
 			float progress = total_progress / (float)jobs_progress;
@@ -458,6 +458,6 @@
 		} else {
 			WM_progress_clear(wm->winactive);
 		}
-	}
+//	}
 }
 





More information about the Bf-blender-cvs mailing list