Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2003-12-29 19:52:51 +0300
committerTon Roosendaal <ton@blender.org>2003-12-29 19:52:51 +0300
commit3ce1dc90656241420303ff08865ea79a98248c18 (patch)
tree9ff9074309e97c1f861ac939dc5ee04437fc03b2 /source/blender/src
parent65aeef11e161e99f8972f305d3f1535e81a76271 (diff)
Area lights and more...
- New lamp type added "Area". This uses the radiosity formula (Stoke) to calculate the amount of energy which is received from a plane. Result is very nice local light, which nicely spreads out. - Area lamps have a 'gamma' option to control the light spread - Area lamp builtin sizes: square, rect, cube & box. Only first 2 are implemented. Set a type, and define area size - Button area size won't affect the amount of energy. But scaling the lamp in 3d window will do. This is to cover the case when you scale an entire scene, the light then will remain identical If you just want to change area lamp size, use buttons when you dont want to make the scene too bright or too dark - Since area lights realistically are sensitive for distance (quadratic), the effect it has is quickly too much, or too less. For this the "Dist" value in Lamp can be used. Set it at Dist=10 to have reasonable light on distance 10 Blender units (assumed you didnt scale lamp object). - I tried square sized specularity, but this looked totally weird. Not committed - Plan is to extend area light with 3d dimensions, boxes and cubes. - Note that area light is one-sided, towards negative Z. I need to design a nice drawing method for it. Area Shadow - Since there are a lot of variables associated with soft shadow, they now only are available for Area lights. Allowing spot & normal lamp to have soft shadow is possible though, but will require a reorganisation of the Lamp buttons. Is a point of research & feedback still. - Apart from area size, you now can individually set amount of samples in X and Y direction (for area lamp type 'Rect'). For box type area lamp, this will become 3 dimensions - Area shadows have four options: "Clip circle" : only uses a circular shape of samples, gives smoother results "Dither" : use a 2x2 dither mask "Jitter" : applys a pseudo-random offset to samples "Umbra" : extra emphasis on area that's fully in shadow. Raytrace speedup - improved filling in faces in Octree. Large faces occupied too many nodes - added a coherence check; rays fired sequentially that begin and end in same octree nodes, and that don't intersect, are quickly rejected - rendering shadow scenes benefits from this 20-40%. My statue test monkey file now renders in 19 seconds (was 30). Plus: - adjusted specular max to 511, and made sure Blinn spec has again this incredible small spec size - for UI rounded theme: the color "button" displayed RGB color too dark - fixed countall() function, to also include Subsurf totals - removed setting the 'near' clipping for pressing dot-key numpad - when you press the buttons-window icon for 'Shading Context' the context automaticilly switches as with F5 hotkey Please be warned that this is not a release... settings in files might not work as it did, nor guaranteed to work when we do a release. :)
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/butspace.c54
-rw-r--r--source/blender/src/buttons_scene.c4
-rw-r--r--source/blender/src/buttons_shading.c121
-rw-r--r--source/blender/src/drawobject.c10
-rw-r--r--source/blender/src/edit.c9
-rw-r--r--source/blender/src/header_buttonswin.c14
-rw-r--r--source/blender/src/interface_draw.c1
-rw-r--r--source/blender/src/previewrender.c8
-rw-r--r--source/blender/src/view.c2
9 files changed, 143 insertions, 80 deletions
diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c
index 8313d19a3a8..174eb2be0d6 100644
--- a/source/blender/src/butspace.c
+++ b/source/blender/src/butspace.c
@@ -319,6 +319,35 @@ void do_butspace(unsigned short event)
else if(event>REDRAWVIEW3D) allqueue(event, 0);
}
+void butspace_context_switch(SpaceButs *buts, Base *new)
+{
+ // change type automatically
+ if(new) {
+ int tab= buts->tab[CONTEXT_SHADING];
+
+ if(tab == TAB_SHADING_WORLD) {
+ if(new->object->type==OB_LAMP) {
+ buts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
+ }
+ else buts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
+
+ }
+ else if(tab == TAB_SHADING_TEX) {
+ }
+ else if(tab == TAB_SHADING_RAD) {
+ }
+ else if(new->object->type==OB_CAMERA) {
+ buts->tab[CONTEXT_SHADING]= TAB_SHADING_WORLD;
+ }
+ else if(new->object->type==OB_LAMP) {
+ buts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
+ }
+ else {
+ buts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
+ }
+ }
+}
+
/* new active object */
void redraw_test_buttons(Base *new)
{
@@ -337,31 +366,8 @@ void redraw_test_buttons(Base *new)
if(buts->mainb==CONTEXT_SHADING) {
buts->re_align= 1;
-
- // change type automatically
if(new) {
- int tab= buts->tab[CONTEXT_SHADING];
-
- if(tab == TAB_SHADING_WORLD) {
- if(new->object->type==OB_LAMP) {
- buts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
- }
- else buts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
-
- }
- else if(tab == TAB_SHADING_TEX) {
- }
- else if(tab == TAB_SHADING_RAD) {
- }
- else if(new->object->type==OB_CAMERA) {
- buts->tab[CONTEXT_SHADING]= TAB_SHADING_WORLD;
- }
- else if(new->object->type==OB_LAMP) {
- buts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
- }
- else {
- buts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
- }
+ butspace_context_switch(buts, new);
BIF_preview_changed(buts);
}
}
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index fb9a072b34c..94c445afbcc 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -1031,7 +1031,7 @@ static void render_panel_render(void)
uiBlockBeginAlign(block);
uiDefButI(block, TOG|BIT|14, 0, "MBLUR", 495,114,66,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Motion Blur calculation");
- uiDefButF(block, NUM,B_DIFF,"Bf:", 495,90,65,20,&G.scene->r.blurfac, 0.01, 5.0, 10, 0, "Sets motion blur factor");
+ uiDefButF(block, NUM,B_DIFF,"Bf:", 495,90,65,20,&G.scene->r.blurfac, 0.01, 5.0, 10, 2, "Sets motion blur factor");
uiBlockBeginAlign(block);
uiDefButS(block, NUM,B_DIFF,"Xparts:", 369,42,99,31,&G.scene->r.xparts,1.0, 64.0, 0, 0, "Sets the number of horizontal parts to render image in (For panorama sets number of camera slices)");
@@ -1061,7 +1061,7 @@ static void render_panel_render(void)
uiDefButI(block, TOG|BIT|7,0,"x", 665,50,20,23,&G.scene->r.mode, 0, 0, 0, 0, "Disables time difference in field calculations");
uiDefButI(block, TOG|BIT|17,0,"Gauss", 564,30,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Gauss sampling filter for antialiasing");
- uiDefButF(block, NUM,B_DIFF,"", 624,30,60,20,&G.scene->r.gauss,0.5, 2.0, 0, 0, "Sets the Gauss filter size)");
+ uiDefButF(block, NUM,B_DIFF,"", 624,30,60,20,&G.scene->r.gauss,0.5, 1.5, 100, 2, "Sets the Gauss filter size)");
uiDefButI(block, TOG|BIT|9,REDRAWVIEWCAM, "Border", 564,10,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Render a small cut-out of the image");
uiDefButI(block, TOG|BIT|2,0, "Gamma", 624,10,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Enable gamma correction");
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index e7bb4ccb3bc..65d5dcadf2a 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -1646,6 +1646,7 @@ void do_lampbuts(unsigned short event)
case B_LAMPREDRAW:
BIF_preview_changed(G.buts);
allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSSHADING, 0);
break;
case B_TEXCLEARLAMP:
la= G.buts->lockpoin;
@@ -1821,42 +1822,62 @@ static void lamp_panel_spot(Object *ob, Lamp *la)
uiBlockSetCol(block, TH_BUT_SETTING1);
uiBlockBeginAlign(block);
- uiDefButS(block, TOG|BIT|13, B_SHADRAY,"Ray Shadow", 10,180,80,19,&la->mode, 0, 0, 0, 0, "Use ray tracing for shadow");
- uiDefButS(block, TOG|BIT|0, B_SHADBUF, "Buf.Shadow",10,160,80,19,&la->mode, 0, 0, 0, 0, "Lets spotlight produce shadows using shadow buffer");
+ uiDefButS(block, TOG|BIT|13, B_SHADRAY,"Ray Shadow",10,180,80,19,&la->mode, 0, 0, 0, 0, "Use ray tracing for shadow");
+ if(la->type==LA_SPOT)
+ uiDefButS(block, TOG|BIT|0, B_SHADBUF, "Buf.Shadow",10,160,80,19,&la->mode, 0, 0, 0, 0, "Lets spotlight produce shadows using shadow buffer");
uiBlockEndAlign(block);
- uiDefButS(block, TOG|BIT|5, 0,"OnlyShadow", 10,120,80,19,&la->mode, 0, 0, 0, 0, "Causes spotlight to cast shadows only without illuminating objects");
- uiDefButS(block, TOG|BIT|7, B_LAMPREDRAW,"Square", 10,90,80,19,&la->mode, 0, 0, 0, 0, "Sets square spotbundles");
- uiDefButS(block, TOG|BIT|1, 0,"Halo", 10,50,80,19,&la->mode, 0, 0, 0, 0, "Renders spotlight with a volumetric halo");
+ uiDefButS(block, TOG|BIT|5, 0,"OnlyShadow", 10,110,80,19,&la->mode, 0, 0, 0, 0, "Causes light to cast shadows only without illuminating objects");
- uiBlockSetCol(block, TH_AUTO);
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI,B_LAMPREDRAW,"SpotSi ", 100,180,200,19,&la->spotsize, 1.0, 180.0, 0, 0, "Sets the angle of the spotlight beam in degrees");
- uiDefButF(block, NUMSLI,B_MATPRV,"SpotBl ", 100,160,200,19,&la->spotblend, 0.0, 1.0, 0, 0, "Sets the softness of the spotlight edge");
- uiBlockEndAlign(block);
+ if(la->type==LA_SPOT) {
+ uiDefButS(block, TOG|BIT|7, B_LAMPREDRAW,"Square", 10,70,80,19,&la->mode, 0, 0, 0, 0, "Sets square spotbundles");
+ uiDefButS(block, TOG|BIT|1, 0,"Halo", 10,50,80,19,&la->mode, 0, 0, 0, 0, "Renders spotlight with a volumetric halo");
- uiDefButF(block, NUMSLI,0,"HaloInt ", 100,135,200,19,&la->haint, 0.0, 5.0, 0, 0, "Sets the intensity of the spotlight halo");
-
- if(la->mode & LA_SHAD) {
- uiDefButS(block, NUM,B_SBUFF,"ShadowBufferSize:", 100,110,200,19, &la->bufsize,512,5120, 0, 0, "Sets the size of the shadow buffer to nearest multiple of 16");
-
+ uiBlockSetCol(block, TH_AUTO);
uiBlockBeginAlign(block);
- uiDefButF(block, NUM,REDRAWVIEW3D,"ClipSta:", 100,70,100,19, &la->clipsta, 0.1*grid,1000.0*grid, 10, 0, "Sets the shadow map clip start: objects closer will not generate shadows");
- uiDefButF(block, NUM,REDRAWVIEW3D,"ClipEnd:", 200,70,100,19,&la->clipend, 1.0, 5000.0*grid, 100, 0, "Sets the shadow map clip end beyond which objects will not generate shadows");
+ uiDefButF(block, NUMSLI,B_LAMPREDRAW,"SpotSi ", 100,180,200,19,&la->spotsize, 1.0, 180.0, 0, 0, "Sets the angle of the spotlight beam in degrees");
+ uiDefButF(block, NUMSLI,B_MATPRV,"SpotBl ", 100,160,200,19,&la->spotblend, 0.0, 1.0, 0, 0, "Sets the softness of the spotlight edge");
uiBlockEndAlign(block);
+
+ uiDefButF(block, NUMSLI,0,"HaloInt ", 100,135,200,19,&la->haint, 0.0, 5.0, 0, 0, "Sets the intensity of the spotlight halo");
- uiDefButS(block, NUM,0,"Samples:", 100,30,100,19, &la->samp,1.0,16.0, 0, 0, "Sets the number of shadow map samples");
- uiDefButS(block, NUM,0,"Halo step:", 200,30,100,19, &la->shadhalostep, 0.0, 12.0, 0, 0, "Sets the volumetric halo sampling frequency");
- uiDefButF(block, NUM,0,"Bias:", 100,10,100,19, &la->bias, 0.01, 5.0, 1, 0, "Sets the shadow map sampling bias");
- uiDefButF(block, NUM,0,"Soft:", 200,10,100,19, &la->soft,1.0,100.0, 100, 0, "Sets the size of the shadow sample area");
+ if(la->mode & LA_SHAD) {
+ uiDefButS(block, NUM,B_SBUFF,"ShadowBufferSize:", 100,110,200,19, &la->bufsize,512,5120, 0, 0, "Sets the size of the shadow buffer to nearest multiple of 16");
+
+ uiBlockBeginAlign(block);
+ uiDefButF(block, NUM,REDRAWVIEW3D,"ClipSta:", 100,70,100,19, &la->clipsta, 0.1*grid,1000.0*grid, 10, 0, "Sets the shadow map clip start: objects closer will not generate shadows");
+ uiDefButF(block, NUM,REDRAWVIEW3D,"ClipEnd:", 200,70,100,19,&la->clipend, 1.0, 5000.0*grid, 100, 0, "Sets the shadow map clip end beyond which objects will not generate shadows");
+ uiBlockEndAlign(block);
+
+ uiDefButS(block, NUM,0,"Samples:", 100,30,100,19, &la->samp,1.0,16.0, 0, 0, "Sets the number of shadow map samples");
+ uiDefButS(block, NUM,0,"Halo step:", 200,30,100,19, &la->shadhalostep, 0.0, 12.0, 0, 0, "Sets the volumetric halo sampling frequency");
+ uiDefButF(block, NUM,0,"Bias:", 100,10,100,19, &la->bias, 0.01, 5.0, 1, 0, "Sets the shadow map sampling bias");
+ uiDefButF(block, NUM,0,"Soft:", 200,10,100,19, &la->soft,1.0,100.0, 100, 0, "Sets the size of the shadow sample area");
+ }
}
- else if(la->mode & LA_SHAD_RAY) {
+ else if(la->type==LA_AREA && (la->mode & LA_SHAD_RAY)) {
uiBlockBeginAlign(block);
- uiDefButS(block, NUM,0,"Samples:", 100,70,100,19, &la->ray_samp, 1,8, 100, 0, "Sets the amount of samples taken extra (samp x samp)");
- uiDefButF(block, NUM,0,"Soft:", 200,70,100,19, &la->ray_soft, 0.01, 10.0, 100, 0, "Sets the size of the sampling area");
- uiBlockEndAlign(block);
+ uiBlockSetCol(block, TH_AUTO);
+ if(la->area_shape==LA_AREA_SQUARE)
+ uiDefButS(block, NUM,0,"Samples:", 100,180,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp)");
+ if(la->area_shape==LA_AREA_CUBE)
+ uiDefButS(block, NUM,0,"Samples:", 100,160,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of samples taken extra (samp x samp x samp)");
+
+ if ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_BOX) {
+ uiDefButS(block, NUM,0,"SamplesX:", 100,180,200,19, &la->ray_samp, 1.0, 16.0, 100, 0, "Sets the amount of X samples taken extra");
+ uiDefButS(block, NUM,0,"SamplesY:", 100,160,200,19, &la->ray_sampy, 1.0, 16.0, 100, 0, "Sets the amount of Y samples taken extra");
+ if(la->area_shape==LA_AREA_BOX)
+ uiDefButS(block, NUM,0,"SamplesZ:", 100,140,200,19, &la->ray_sampz, 1.0, 8.0, 100, 0, "Sets the amount of Z samples taken extra");
+ }
+
+ uiBlockBeginAlign(block);
+ uiDefButS(block, TOG|BIT|1, 0,"Umbra", 100,110,100,19,&la->ray_samp_type, 0, 0, 0, 0, "Emphasis parts that are fully shadowed");
+ uiDefButS(block, TOG|BIT|0, 0,"Clip circle", 200,110,100,19,&la->ray_samp_type, 0, 0, 0, 0, "Use circular sampling mask");
+ uiDefButS(block, TOG|BIT|2, 0,"Dither", 100,90,100,19,&la->ray_samp_type, 0, 0, 0, 0, "Use 2x2 dithering for sampling");
+ uiDefButS(block, TOG|BIT|3, 0,"Jitter", 200,90,100,19,&la->ray_samp_type, 0, 0, 0, 0, "Use jittering for sampling");
}
-
+ else uiDefBut(block, LABEL,0," ", 100,180,200,19,NULL, 0, 0, 0, 0, "");
+
}
@@ -1882,15 +1903,32 @@ static void lamp_panel_lamp(Object *ob, Lamp *la)
xco= std_libbuttons(block, 8, 180, 0, NULL, B_LAMPBROWSE, id, (ID *)ob, &(G.buts->menunr), B_LAMPALONE, B_LAMPLOCAL, 0, 0, 0);
uiBlockSetCol(block, TH_AUTO);
- uiDefButF(block, NUM,B_LAMPREDRAW,"Dist:", xco,180,300-xco,20,&la->dist, 0.01, 5000.0, 100, 0, "Sets the distance value at which light intensity is halved");
+ uiDefButF(block, NUM,B_LAMPREDRAW,"Dist:", xco,180,300-xco,20,&la->dist, 0.01, 100.0*grid, 100, 0, "Sets the distance value at which light intensity is half");
+
+ uiBlockBeginAlign(block);
+ if(la->type==LA_AREA) {
+ //uiDefButS(block, MENU, B_LAMPREDRAW, "Shape %t|Square %x0|Rect %x1|Cube %x2|Box %x3",
+ uiDefButS(block, MENU, B_LAMPREDRAW, "Shape %t|Square %x0|Rect %x1",
+ 10, 150, 100, 19, &la->area_shape, 0,0,0,0, "Sets area light shape");
+ uiDefButF(block, NUM,B_LAMPREDRAW,"Size ", 10,130,100,19, &la->area_size, 0.001, 100.0, 10, 0, "Area light size, doesn't affect energy amount");
+ if ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_BOX)
+ uiDefButF(block, NUM,B_LAMPREDRAW,"SizeY ", 10,110,100,19, &la->area_sizey, 0.001, 100.0, 10, 0, "Area light size Y, doesn't affect energy amount");
+ if(la->area_shape==LA_AREA_BOX)
+ uiDefButF(block, NUM,B_LAMPREDRAW,"SizeZ ", 10,90,100,19, &la->area_sizez, 0.001, 100.0, 10, 0, "Area light size Z, doesn't affect energy amount");
+ }
+ else if ELEM(la->type, LA_LOCAL, LA_SPOT) {
+ uiBlockSetCol(block, TH_BUT_SETTING1);
+ uiDefButS(block, TOG|BIT|3, B_MATPRV,"Quad", 10,150,100,19,&la->mode, 0, 0, 0, 0, "Uses inverse quadratic proportion for light attenuation");
+ uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D,"Sphere", 10,130,100,19,&la->mode, 0, 0, 0, 0, "Sets light intensity to zero for objects beyond the distance value");
+ }
+ uiBlockBeginAlign(block);
uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButS(block, TOG|BIT|3, B_MATPRV,"Quad", 10,150,100,19,&la->mode, 0, 0, 0, 0, "Uses inverse quadratic proportion for light attenuation");
- uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D,"Sphere", 10,130,100,19,&la->mode, 0, 0, 0, 0, "Sets light intensity to zero for objects beyond the distance value");
- uiDefButS(block, TOG|BIT|2, 0,"Layer", 10,90,100,19,&la->mode, 0, 0, 0, 0, "Illuminates objects in the same layer as the lamp only");
- uiDefButS(block, TOG|BIT|4, B_MATPRV,"Negative", 10,70,100,19,&la->mode, 0, 0, 0, 0, "Sets lamp to cast negative light");
+ uiDefButS(block, TOG|BIT|2, 0,"Layer", 10,70,100,19,&la->mode, 0, 0, 0, 0, "Illuminates objects in the same layer as the lamp only");
+ uiDefButS(block, TOG|BIT|4, B_MATPRV,"Negative", 10,50,100,19,&la->mode, 0, 0, 0, 0, "Sets lamp to cast negative light");
uiDefButS(block, TOG|BIT|11, 0,"No Diffuse", 10,30,100,19,&la->mode, 0, 0, 0, 0, "Disables diffuse shading of material illuminated by this lamp");
uiDefButS(block, TOG|BIT|12, 0,"No Specular", 10,10,100,19,&la->mode, 0, 0, 0, 0, "Disables specular shading of material illuminated by this lamp");
+ uiBlockEndAlign(block);
uiBlockSetCol(block, TH_AUTO);
uiDefButF(block, NUMSLI,B_MATPRV,"Energy ", 120,150,180,20, &(la->energy), 0.0, 10.0, 0, 0, "Sets the intensity of the light");
@@ -1904,9 +1942,14 @@ static void lamp_panel_lamp(Object *ob, Lamp *la)
uiDefButF(block, COL, B_COLLAMP, "", 120,52,180,24, &la->r, 0, 0, 0, 0, "");
uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI,B_MATPRV,"Quad1 ", 120,30,180,19,&la->att1, 0.0, 1.0, 0, 0, "Set the light intensity value 1 for a quad lamp");
- uiDefButF(block, NUMSLI,B_MATPRV,"Quad2 ", 120,10,180,19,&la->att2, 0.0, 1.0, 0, 0, "Set the light intensity value 2 for a quad lamp");
- uiBlockEndAlign(block);
+ if ELEM(la->type, LA_LOCAL, LA_SPOT) {
+ uiDefButF(block, NUMSLI,B_MATPRV,"Quad1 ", 120,30,180,19,&la->att1, 0.0, 1.0, 0, 0, "Set the linear distance attenuatation for a quad lamp");
+ uiDefButF(block, NUMSLI,B_MATPRV,"Quad2 ", 120,10,180,19,&la->att2, 0.0, 1.0, 0, 0, "Set the qudratic distance attenuatation for a quad lamp");
+ }
+ else if(la->type==LA_AREA) {
+ if(la->k==0.0) la->k= 1.0;
+ uiDefButF(block, NUMSLI,0,"Gamma ", 120,10,180,19,&la->k, 0.001, 2.0, 100, 0, "Set the light gamma correction value");
+ }
}
@@ -1926,10 +1969,10 @@ static void lamp_panel_preview(Object *ob, Lamp *la)
uiDefBut(block, LABEL, 0, " ", 20,20,10,10, 0, 0, 0, 0, 0, "");
uiBlockBeginAlign(block);
uiDefButS(block, ROW,B_LAMPREDRAW,"Lamp", 200,175,80,25,&la->type,1.0,(float)LA_LOCAL, 0, 0, "Creates an omnidirectional point light source");
- uiDefButS(block, ROW,B_LAMPREDRAW,"Spot", 200,150,80,25,&la->type,1.0,(float)LA_SPOT, 0, 0, "Creates a directional cone light source");
- uiDefButS(block, ROW,B_LAMPREDRAW,"Sun", 200,125,80,25,&la->type,1.0,(float)LA_SUN, 0, 0, "Creates a constant direction parallel ray light source");
- uiDefButS(block, ROW,B_LAMPREDRAW,"Hemi", 200,100,80,25,&la->type,1.0,(float)LA_HEMI, 0, 0, "Creates a 180 degree point light source");
- uiBlockEndAlign(block);
+ uiDefButS(block, ROW,B_LAMPREDRAW,"Area", 200,150,80,25,&la->type,1.0,(float)LA_AREA, 0, 0, "Creates a directional area light source");
+ uiDefButS(block, ROW,B_LAMPREDRAW,"Spot", 200,125,80,25,&la->type,1.0,(float)LA_SPOT, 0, 0, "Creates a directional cone light source");
+ uiDefButS(block, ROW,B_LAMPREDRAW,"Sun", 200,100,80,25,&la->type,1.0,(float)LA_SUN, 0, 0, "Creates a constant direction parallel ray light source");
+ uiDefButS(block, ROW,B_LAMPREDRAW,"Hemi", 200,75,80,25,&la->type,1.0,(float)LA_HEMI, 0, 0, "Creates a 180 degree constant light source");
}
@@ -2344,7 +2387,7 @@ static void material_panel_shading(Material *ma)
uiBlockBeginAlign(block);
uiDefButF(block, NUMSLI, B_MATPRV, "Spec ", 90,120,150,19, &(ma->spec), 0.0, 2.0, 0, 0, "Sets the degree of specularity");
if ELEM3(ma->spec_shader, MA_SPEC_COOKTORR, MA_SPEC_PHONG, MA_SPEC_BLINN) {
- uiDefButS(block, NUMSLI, B_MATPRV, "Hard:", 90, 100, 150,19, &(ma->har), 1.0, 255, 0, 0, "Sets the hardness of the specularity");
+ uiDefButS(block, NUMSLI, B_MATPRV, "Hard:", 90, 100, 150,19, &(ma->har), 1.0, 511, 0, 0, "Sets the hardness of the specularity");
}
if(ma->spec_shader==MA_SPEC_BLINN)
uiDefButF(block, NUMSLI, B_MATPRV, "Refr:", 90, 80,150,19, &(ma->refrac), 1.0, 10.0, 0, 0, "Sets the material's Index of Refraction");
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index 6bf0fa1650c..a305fda18b0 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -580,7 +580,14 @@ static void drawlamp(Object *ob)
glEnd();
}
else {
- if(la->mode & LA_SPHERE) {
+ if(la->type==LA_AREA) {
+ setlinestyle(0);
+ 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);
+ }
+ else if(la->mode & LA_SPHERE) {
float tmat[4][4], imat[4][4];
@@ -596,6 +603,7 @@ static void drawlamp(Object *ob)
VECCOPY(vec, ob->obmat[3]);
+ setlinestyle(3);
glBegin(GL_LINE_STRIP);
glVertex3fv(vec);
vec[2]= 0;
diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c
index 1dcfb08c25b..998f92f947c 100644
--- a/source/blender/src/edit.c
+++ b/source/blender/src/edit.c
@@ -450,11 +450,12 @@ void count_object(Object *ob, int sel)
G.totmesh++;
me= get_mesh(ob);
if(me) {
- G.totvert+= me->totvert;
- G.totface+= me->totface;
+ int mult= (me->flag & ME_SUBSURF)?(1<<me->subdiv)*(1<<me->subdiv):1;
+ G.totvert+= me->totvert*mult;
+ G.totface+= me->totface*mult;
if(sel) {
- G.totvertsel+= me->totvert;
- G.totfacesel+= me->totface;
+ G.totvertsel+= me->totvert*mult;
+ G.totfacesel+= me->totface*mult;
}
}
break;
diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c
index cc64a40fc04..0ae8a8d71a8 100644
--- a/source/blender/src/header_buttonswin.c
+++ b/source/blender/src/header_buttonswin.c
@@ -136,9 +136,9 @@ void do_buts_buttons(short event)
scrarea_queue_winredraw(curarea);
break;
case B_BUTSPREVIEW:
- BIF_preview_changed(G.buts);
- scrarea_queue_headredraw(curarea);
- scrarea_queue_winredraw(curarea);
+ BIF_preview_changed(G.buts);
+ scrarea_queue_headredraw(curarea);
+ scrarea_queue_winredraw(curarea);
break;
case B_MATCOPY:
if(G.buts->lockpoin) {
@@ -184,6 +184,10 @@ void do_buts_buttons(short event)
allqueue(REDRAWBUTSEDIT, 0);
allqueue(REDRAWVIEW3D, 0);
break;
+ case B_CONTEXT_SWITCH:
+ butspace_context_switch(G.buts, BASACT);
+ scrarea_queue_winredraw(curarea);
+ break;
}
}
@@ -364,7 +368,7 @@ static uiBlock *sbuts_context_menu(void *arg_unused)
uiDefIconTextButS(block, BUTM, B_REDR, ICON_SCENE_DEHLT, "Scene|F10", 0, yco-=22, 100, 20, &G.buts->mainb, 0.0, 0.0, 0, 0, "");
uiDefIconTextButS(block, BUTM, B_REDR, ICON_EDIT, "Editing|F9", 0, yco-=22, 100, 20, &G.buts->mainb, 4.0, 0.0, 0, 0, "");
uiDefIconTextButS(block, BUTM, B_REDR, ICON_OBJECT, "Object|F6", 0, yco-=22, 100, 20, &G.buts->mainb, 1.0, 0.0, 0, 0, "");
- uiDefIconTextButS(block, BUTM, B_REDR, ICON_MATERIAL_DEHLT, "Shading|F5", 0, yco-=22, 100, 20, &G.buts->mainb, 3.0, 0.0, 0, 0, "");
+ uiDefIconTextButS(block, BUTM, B_CONTEXT_SWITCH, ICON_MATERIAL_DEHLT, "Shading|F5", 0, yco-=22, 100, 20, &G.buts->mainb, 3.0, 0.0, 0, 0, "");
uiDefIconTextButS(block, BUTM, B_REDR, ICON_GAME, "Logic|F4", 0, yco-=22, 100, 20, &G.buts->mainb, 6.0, 0.0, 0, 0, "");
uiDefIconTextButS(block, BUTM, B_REDR, ICON_SCRIPT, "Script", 0, yco-=22, 100, 20, &G.buts->mainb, 5.0, 0.0, 0, 0, "");
@@ -421,7 +425,7 @@ void buts_buttons(void)
uiBlockBeginAlign(block);
uiDefIconButS(block, ROW, B_REDR, ICON_GAME, xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_LOGIC, 0, 0, "Logic (F4) ");
uiDefIconButS(block, ROW, B_REDR, ICON_SCRIPT, xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_SCRIPT, 0, 0, "Script ");
- uiDefIconButS(block, ROW, B_REDR, ICON_MATERIAL_DEHLT,xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_SHADING, 0, 0, "Shading (F5) ");
+ uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_MATERIAL_DEHLT,xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_SHADING, 0, 0, "Shading (F5) ");
uiDefIconButS(block, ROW, B_REDR, ICON_OBJECT, xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_OBJECT, 0, 0, "Object (F7) ");
uiDefIconButS(block, ROW, B_REDR, ICON_EDIT, xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_EDITING, 0, 0, "Editing (F9) ");
uiDefIconButS(block, ROW, B_REDR, ICON_SCENE_DEHLT, xco+=XIC, 0, XIC, YIC, &(G.buts->mainb), 0.0, (float)CONTEXT_SCENE, 0, 0, "Scene (F10) ");
diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c
index 2396e4207b5..b17d5010297 100644
--- a/source/blender/src/interface_draw.c
+++ b/source/blender/src/interface_draw.c
@@ -1468,6 +1468,7 @@ static void ui_draw_but_COL(uiBut *but)
if(but->embossfunc == ui_draw_round) {
char *cp= BIF_ThemeGetColorPtr(U.themes.first, 0, TH_CUSTOM);
cp[0]= colr; cp[1]= colg; cp[2]= colb;
+ but->flag &= ~UI_SELECT;
but->embossfunc(but->type, TH_CUSTOM, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag);
}
else {
diff --git a/source/blender/src/previewrender.c b/source/blender/src/previewrender.c
index ef43ca66ad0..3e259a5a943 100644
--- a/source/blender/src/previewrender.c
+++ b/source/blender/src/previewrender.c
@@ -447,7 +447,7 @@ static void lamp_preview_pixel(ShadeInput *shi, LampRen *la, int x, int y, char
}
dist*=inpr;
}
- else if(la->type==LA_LOCAL) dist*= shi->view[2];
+ else if ELEM(la->type, LA_LOCAL, LA_AREA) dist*= shi->view[2];
col= 255.0*dist*la->r;
if(col<=0) rect[0]= 0; else if(col>=255) rect[0]= 255; else rect[0]= col;
@@ -1213,9 +1213,6 @@ void BIF_previewrender(SpaceButs *sbuts)
else if(tex) {
end_render_texture(tex);
}
- else if(wrld) {
- end_render_textures();
- }
else if(la) {
if(R.totlamp) {
if(R.la[0]->org) MEM_freeN(R.la[0]->org);
@@ -1224,5 +1221,8 @@ void BIF_previewrender(SpaceButs *sbuts)
R.totlamp= 0;
end_render_textures();
}
+ else if(wrld) {
+ end_render_textures();
+ }
}
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index 0501a159ffc..0e760e3cbd9 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -976,7 +976,7 @@ void centreview() /* like a localview without local! */
G.vd->persp= 1;
}
- G.vd->near= 0.1;
+
G.vd->cursor[0]= -G.vd->ofs[0];
G.vd->cursor[1]= -G.vd->ofs[1];
G.vd->cursor[2]= -G.vd->ofs[2];