Page MenuHome

colorlamps.patch

colorlamps.patch

Index: source/blender/makesdna/DNA_lamp_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_lamp_types.h,v
retrieving revision 1.18
diff -u -r1.18 DNA_lamp_types.h
--- source/blender/makesdna/DNA_lamp_types.h 15 Oct 2006 11:50:45 -0000 1.18
+++ source/blender/makesdna/DNA_lamp_types.h 18 Dec 2006 01:28:17 -0000
@@ -111,6 +111,7 @@
/* yafray: lamp shadowbuffer flag, softlight */
/* Since it is used with LOCAL lamp, can't use LA_SHAD */
#define LA_YF_SOFT 16384
+#define LA_DRAW_COLOR 32768
/* buftype, no flag */
#define LA_SHADBUF_REGULAR 0
Index: source/blender/src/buttons_shading.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_shading.c,v
retrieving revision 1.221
diff -u -r1.221 buttons_shading.c
--- source/blender/src/buttons_shading.c 8 Dec 2006 21:20:36 -0000 1.221
+++ source/blender/src/buttons_shading.c 18 Dec 2006 01:33:40 -0000
@@ -2430,6 +2430,12 @@
/* yafray: extra type, photonlight */
if (G.scene->r.renderer==R_YAFRAY)
uiDefButS(block, ROW,B_LAMPREDRAW,"Photon", 200,50,80,25,&la->type,1.0,(float)LA_YF_PHOTON, 0, 0, "Creates a special caustics photon 'light', not a real lightsource, use with other lights");
+
+ uiBlockBeginAlign(block);
+ uiBlockSetCol(block, TH_BUT_SETTING1);
+ uiDefButBitS(block, TOG, LA_DRAW_COLOR, REDRAWVIEW3D,"Draw Color", 200,20,80,19,&la->mode, 0, 0, 0, 0, "Draws the color of the lamp in the 3D View");
+ uiBlockEndAlign(block);
+
}
Index: source/blender/src/drawobject.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawobject.c,v
retrieving revision 1.313
diff -u -r1.313 drawobject.c
--- source/blender/src/drawobject.c 16 Dec 2006 05:49:06 -0000 1.313
+++ source/blender/src/drawobject.c 18 Dec 2006 02:23:27 -0000
@@ -631,12 +631,23 @@
}
/* Inner Circle */
+
+ /* colorizes the circle with the current lamp color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor3f(la->r, la->g, la->b);
+ }
+
VECCOPY(vec, ob->obmat[3]);
glEnable(GL_BLEND);
drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
glDisable(GL_BLEND);
drawcircball(GL_POLYGON, vec, lampsize, imat);
-
+
+ /* back to the theme color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor4fv(curcol);
+ }
+
/* restore */
if(ob->id.us>1)
glColor4fv(curcol);
@@ -657,7 +668,13 @@
}
/* draw the pretty sun rays */
+
+ /* colorizes the sun rays with the current lamp color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor3f(la->r, la->g, la->b); }
+
if(la->type==LA_SUN) {
+
float v1[3], v2[3], mat[3][3];
short axis;
@@ -669,6 +686,7 @@
VecMulf(v1, circrad*1.2f);
VECCOPY(v2, imat[0]);
VecMulf(v2, circrad*2.5f);
+
/* center */
glTranslatef(vec[0], vec[1], vec[2]);
@@ -686,11 +704,26 @@
glTranslatef(-vec[0], -vec[1], -vec[2]);
- }
+
+ }
+
+ /* back to the theme color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor4fv(curcol); }
if (la->type==LA_LOCAL) {
if(la->mode & LA_SPHERE) {
+
+ /* colorizes the circle with the current lamp color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor3f(la->r, la->g, la->b); }
+
drawcircball(GL_LINE_LOOP, vec, la->dist, imat);
+
+ /* back to the theme color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor4fv(curcol); }
+
}
/* yafray: for photonlight also draw lightcone as for spot */
}
@@ -729,6 +762,11 @@
x *= y;
/* draw the circle/square at the end of the cone */
+
+ /* colorizes this with the current lamp color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor3f(la->r, la->g, la->b); }
+
glTranslatef(0.0, 0.0 , x);
if(la->mode & LA_SQUARE) {
vvec[0]= fabs(z);
@@ -756,6 +794,10 @@
circ(0.0, 0.0, spotblcirc);
}
+ /* back to the theme color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor4fv(curcol); }
+
}
else if ELEM(la->type, LA_HEMI, LA_SUN) {
@@ -767,6 +809,10 @@
glVertex3fv(vec);
glEnd();
+ /* colorizes the hemi curves with the current lamp color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor3f(la->r, la->g, la->b); }
+
if(la->type==LA_HEMI) {
/* draw the hemisphere curves */
short axis, steps, dir;
@@ -779,7 +825,7 @@
for (axis=0; axis<4; axis++) {
float v[3]= {0.0, 0.0, 0.0};
zdist = 0.02;
-
+
glBegin(GL_LINE_STRIP);
for (steps=0; steps<6; steps++) {
@@ -803,14 +849,30 @@
glEnd();
/* flip the direction */
dir = -dir;
+
}
+
+ /* back to the theme color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor4fv(curcol); }
+
+
}
} else if(la->type==LA_AREA) {
+
+ /* colorizes the area with the current lamp color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor3f(la->r, la->g, la->b); }
+
setlinestyle(3);
if(la->area_shape==LA_AREA_SQUARE)
fdrawbox(-la->area_size*0.5, -la->area_size*0.5, la->area_size*0.5, la->area_size*0.5);
else if(la->area_shape==LA_AREA_RECT)
fdrawbox(-la->area_size*0.5, -la->area_sizey*0.5, la->area_size*0.5, la->area_sizey*0.5);
+
+ /* and back to the theme color */
+ if (la->mode & LA_DRAW_COLOR) {
+ glColor4fv(curcol); }
glBegin(GL_LINE_STRIP);
glVertex3f(0.0,0.0,-circrad);

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
38/85/b080cea676d5541a05e2e3c58680

Event Timeline