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-07-20 19:55:02 +0400
committerTon Roosendaal <ton@blender.org>2003-07-20 19:55:02 +0400
commitd5c829e413e3755750a46e2dee26905b16b1ff57 (patch)
tree692a83ce474ac3984bc5a233795c9d334c99a8ea
parent502b6722190c5431c237cf4a8e0e6ea79119f35a (diff)
- added the 'no diffuse' and 'no specularity' options for Lamps, as were
in Tuhopuu - added the Tuhopuu feature which displays material-buttons and lamp- buttons integrated. saves button presses that way!
-rw-r--r--source/blender/makesdna/DNA_lamp_types.h6
-rw-r--r--source/blender/render/intern/source/pixelshading.c11
-rw-r--r--source/blender/render/intern/source/rendercore.c10
-rw-r--r--source/blender/src/buttons.c41
-rw-r--r--source/blender/src/editmesh.c4
-rw-r--r--source/blender/src/editobject.c12
-rw-r--r--source/blender/src/headerbuttons.c9
7 files changed, 56 insertions, 37 deletions
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index f9840e97ace..90529474d67 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -86,8 +86,12 @@ typedef struct Lamp {
#define LA_OSATEX 512
/* use bit 11 for shadow tests... temp only -nzc- */
#define LA_DEEP_SHADOW 1024
+#define LA_NO_DIFF 2048
+#define LA_NO_SPEC 4096
/* mapto */
#define LAMAP_COL 1
-#endif
+
+
+#endif /* DNA_LAMP_TYPES_H */
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 1c2ac2509c7..337f6ffcd0a 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -1169,7 +1169,11 @@ void shadeLampLusFloat()
/* dot product and reflectivity*/
inp=i= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
- if(lar->type==LA_HEMI) {
+
+ if(lar->mode & LA_NO_DIFF) {
+ i= 0.0; // skip shaders
+ }
+ else if(lar->type==LA_HEMI) {
i= 0.5*i+0.5;
}
else {
@@ -1198,7 +1202,7 @@ void shadeLampLusFloat()
}
/* specularity */
- if(ma->spec!=0.0) {
+ if(ma->spec!=0.0 && !(lar->mode & LA_NO_SPEC)) {
if(lar->type==LA_SUN || lar->type==LA_HEMI) {
if(lar->type==LA_SUN) {
@@ -1246,7 +1250,8 @@ void shadeLampLusFloat()
}
}
}
- if(i>0.0) {
+
+ if(i>0.0 && !(lar->mode & LA_NO_DIFF)) {
ir+= i*lar->r;
ig+= i*lar->g;
ib+= i*lar->b;
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index b34f5bd1a29..34a1436c514 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -1796,7 +1796,10 @@ void shade_lamp_loop()
/* dot product and reflectivity*/
inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
- if(lar->type==LA_HEMI) {
+ if(lar->mode & LA_NO_DIFF) {
+ i= 0.0; // skip shaders
+ }
+ else if(lar->type==LA_HEMI) {
i= 0.5*inp + 0.5;
}
else {
@@ -1822,7 +1825,7 @@ void shade_lamp_loop()
}
/* specularity */
- if(ma->spec!=0.0) {
+ if(ma->spec!=0.0 && !(lar->mode & LA_NO_SPEC)) {
if(lar->type==LA_SUN || lar->type==LA_HEMI) {
if(lar->type==LA_SUN) {
@@ -1868,7 +1871,8 @@ void shade_lamp_loop()
}
}
}
- if(i>0.0) {
+ /* in case 'no diffuse' we still do most calculus, spec can be in shadow */
+ if(i>0.0 && !(lar->mode & LA_NO_DIFF)) {
ir+= i*lar->r;
ig+= i*lar->g;
ib+= i*lar->b;
diff --git a/source/blender/src/buttons.c b/source/blender/src/buttons.c
index 1ac063646f3..b8076c5af1d 100644
--- a/source/blender/src/buttons.c
+++ b/source/blender/src/buttons.c
@@ -1079,7 +1079,6 @@ void common_editbuts(void)
uiDefBut(block, BUT,B_DOCENTRE, "Centre", 961, 115, 100, 19, 0, 0, 0, 0, 0, "Shift object data to be centered about object's origin");
uiDefBut(block, BUT,B_DOCENTRENEW, "Centre New", 961, 95, 100, 19, 0, 0, 0, 0, 0, "Shift object's origin to center of object data");
uiDefBut(block, BUT,B_DOCENTRECURSOR, "Centre Cursor", 961, 75, 100, 19, 0, 0, 0, 0, 0, "Shift object's origin to cursor location");
- uiDefBut(block, BUT,B_DOCENTRECURSOR, "Test", 961, 55, 100, 19, 0, 0, 0, 0, 0, "plouplou");
}
@@ -4238,7 +4237,7 @@ void matbuts(void)
/* shader buttons */
uiBlockSetCol(block, BUTGREY);
uiDefButS(block, MENU, B_MATPRV_DRAW, str1, 200,90,95,18, &(ma->diff_shader), 0.0, 0.0, 0, 0, "Set a diffuse shader");
- uiDefButS(block, MENU, B_MATPRV_DRAW, str2, 295,90,90,18, &(ma->spec_shader), 0.0, 0.0, 0, 0, "Set a diffuse shader");
+ uiDefButS(block, MENU, B_MATPRV_DRAW, str2, 295,90,90,18, &(ma->spec_shader), 0.0, 0.0, 0, 0, "Set a specular shader");
if(ma->diff_shader==MA_DIFF_ORENNAYAR)
uiDefButF(block, NUM, B_MATPRV, "Rough:", 200, 70, 95,18, &(ma->roughness), 0.0, 3.14, 0, 0, "Oren Nayar Roughness");
@@ -4989,21 +4988,25 @@ void lampbuts(void)
uiDefButF(block, NUM,B_LAMPREDRAW,"Dist:",611,190,104,25,&la->dist, 0.01, 5000.0, 100, 0, "Set the distance value");
uiBlockSetCol(block, BUTBLUE);
- uiDefButS(block, TOG|BIT|3, B_MATPRV,"Quad", 203,196,100,19,&la->mode, 0, 0, 0, 0, "Use inverse quadratic proportion");
- uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D,"Sphere",203,176,100,19,&la->mode, 0, 0, 0, 0, "Lamp only shines inside a sphere");
- uiDefButS(block, TOG|BIT|0, REDRAWVIEW3D, "Shadows", 203,156,100,19,&la->mode, 0, 0, 0, 0, "Let lamp produce shadows");
- uiDefButS(block, TOG|BIT|1, 0,"Halo", 203,136,100,19,&la->mode, 0, 0, 0, 0, "Render spotlights with a volumetric halo");
- uiDefButS(block, TOG|BIT|2, 0,"Layer", 203,116,100,19,&la->mode, 0, 0, 0, 0, "Illuminate objects in the same layer only");
- uiDefButS(block, TOG|BIT|4, B_MATPRV,"Negative", 203,96,100,19,&la->mode, 0, 0, 0, 0, "Cast negative light");
- uiDefButS(block, TOG|BIT|5, 0,"OnlyShadow", 203,76,100,19,&la->mode, 0, 0, 0, 0, "Render shadow only");
- uiDefButS(block, TOG|BIT|7, B_LAMPREDRAW,"Square", 203,56,100,19,&la->mode, 0, 0, 0, 0, "Use square spotbundles");
+ uiDefButS(block, TOG|BIT|3, B_MATPRV,"Quad", 203,196,100,17,&la->mode, 0, 0, 0, 0, "Use inverse quadratic proportion");
+ uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D,"Sphere", 203,178,100,17,&la->mode, 0, 0, 0, 0, "Lamp only shines inside a sphere");
+ uiDefButS(block, TOG|BIT|0, REDRAWVIEW3D, "Shadows", 203,160,100,17,&la->mode, 0, 0, 0, 0, "Let lamp produce shadows");
+ uiDefButS(block, TOG|BIT|1, 0,"Halo", 203,142,100,17,&la->mode, 0, 0, 0, 0, "Render spotlights with a volumetric halo");
+ uiDefButS(block, TOG|BIT|2, 0,"Layer", 203,124,100,17,&la->mode, 0, 0, 0, 0, "Illuminate objects in the same layer only");
+ uiDefButS(block, TOG|BIT|4, B_MATPRV,"Negative", 203,106,100,17,&la->mode, 0, 0, 0, 0, "Cast negative light");
+ uiDefButS(block, TOG|BIT|5, 0,"OnlyShadow", 203,88,100,17,&la->mode, 0, 0, 0, 0, "Render shadow only");
+ uiDefButS(block, TOG|BIT|7, B_LAMPREDRAW,"Square", 203,70,100,17,&la->mode, 0, 0, 0, 0, "Use square spotbundles");
+ uiDefButS(block, TOG|BIT|11, 0,"No Diffuse", 203,52,100,17,&la->mode, 0, 0, 0, 0, "No diffuse shading of material");
+ uiDefButS(block, TOG|BIT|12, 0,"No Specular", 203,34,100,17,&la->mode, 0, 0, 0, 0, "No specular shading of material");
+
+
#ifdef __SHADOW_EXP
/* move this elsewhere */
uiDefButS(block, TOG|BIT|10, 0,"DeepShadow", 203,216,100,19,&la->mode, 0, 0, 0, 0, "");
#endif
uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, NUM,B_SBUFF,"ShadowBuffSize:", 203,30,140,19, &la->bufsize,512,5120, 0, 0, "Set the size of the shadow buffer");
+ uiDefButS(block, NUM,B_SBUFF,"ShadowBuffSize:", 203,10,140,19, &la->bufsize,512,5120, 0, 0, "Set the size of the shadow buffer");
uiDefButF(block, NUM,REDRAWVIEW3D,"ClipSta:", 346,30,146,19, &la->clipsta, 0.1*grid,1000.0*grid, 10, 0, "Set the shadow map clip start");
uiDefButF(block, NUM,REDRAWVIEW3D,"ClipEnd:", 346,9,146,19,&la->clipend, 1.0, 5000.0*grid, 100, 0, "Set the shadow map clip end");
@@ -7209,7 +7212,7 @@ static void do_constraintbuts(unsigned short event)
// ListBase *chanbase;
// bConstraintChannel *chan;
- Object *ob = OBACT;
+ // Object *ob = OBACT;
list = get_constraint_client(NULL, &type, NULL);
// chanbase= get_constraint_client_channels(0);
if (list){
@@ -7460,11 +7463,21 @@ void redraw_test_buttons(Base *new)
buts= sa->spacedata.first;
if(buts->mainb==BUTS_LAMP) {
- allqueue(REDRAWBUTSLAMP, 0);
+ // change type automatically
+ if(new->object->type!=OB_LAMP) {
+ buts->mainb= BUTS_MAT;
+ allqueue(REDRAWBUTSMAT, 0);
+ }
+ else allqueue(REDRAWBUTSLAMP, 0);
BIF_preview_changed(buts);
}
else if(buts->mainb==BUTS_MAT) {
- allqueue(REDRAWBUTSMAT, 0);
+ // change type automatically
+ if(new->object->type==OB_LAMP) {
+ buts->mainb= BUTS_LAMP;
+ allqueue(REDRAWBUTSLAMP, 0);
+ }
+ else allqueue(REDRAWBUTSMAT, 0);
BIF_preview_changed(buts);
}
else if(buts->mainb==BUTS_TEX) {
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c
index 7fd2ad5cf74..b86c8baec37 100644
--- a/source/blender/src/editmesh.c
+++ b/source/blender/src/editmesh.c
@@ -4194,8 +4194,8 @@ void add_primitiveMesh(int type)
But it also stores the added object struct in
G.scene->basact->object (BASACT->object) */
- add_object(OB_MESH);
- base_init_from_view3d(BASACT, G.vd);
+ add_object_draw(OB_MESH);
+
G.obedit= BASACT->object;
where_is_object(G.obedit);
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 2fed60d6a66..00748187cf3 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -193,17 +193,7 @@ void add_object_draw(int type) /* for toolbox */
if (G.obedit) exit_editmode(1);
ob= add_object(type);
base_init_from_view3d(BASACT, G.vd);
-
- if(type==OB_IKA) {
- where_is_object(ob);
- while(TRUE) {
- if( extrude_ika(ob, 1) ) break;
- }
-
- calc_ika(ob->data, 0);
- init_defstate_ika(ob);
- }
-
+
allqueue(REDRAWVIEW3D, 0);
}
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
index d374d5a1bde..eaa66bd5b22 100644
--- a/source/blender/src/headerbuttons.c
+++ b/source/blender/src/headerbuttons.c
@@ -4732,11 +4732,15 @@ void buts_buttons(void)
/* HOME */
uiDefIconBut(block, BUT, B_BUTSHOME, ICON_HOME, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms window to home view showing all items (HOMEKEY)");
+ ob= OBACT;
+
/* choice menu */
xco+= 2*XIC;
uiDefIconButS(block, ROW, B_REDR, ICON_EYE, xco+=XIC, 0, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_VIEW, 0, 0, "View buttons");
- uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_LAMP, xco+=30, 0, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_LAMP, 0, 0, "Lamp buttons (F4)");
- uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_MATERIAL, xco+=30, 0, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_MAT, 0, 0, "Material buttons (F5)");
+ if(ob && ob->type==OB_LAMP)
+ uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_LAMP, xco+=30, 0, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_LAMP, 0, 0, "Lamp buttons (F4)");
+ else
+ uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_MATERIAL, xco+=30, 0, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_MAT, 0, 0, "Material buttons (F5)");
uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_TEXTURE, xco+=30, 0, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_TEX, 0, 0, "Texture buttons (F6)");
uiDefIconButS(block, ROW, B_REDR, ICON_ANIM, xco+=30, 0, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_ANIM, 0, 0, "Animation buttons (F7)");
uiDefIconButS(block, ROW, B_REDR, ICON_GAME, xco+=30, 0, 30, YIC, &(G.buts->mainb), 1.0, (float)BUTS_GAME, 0, 0, "Realtime buttons (F8)");
@@ -4750,7 +4754,6 @@ void buts_buttons(void)
uiDefIconButS(block, ROW, B_REDR, ICON_SCENE, xco+=30, 0, 50, YIC, &(G.buts->mainb), 1.0, (float)BUTS_RENDER, 0, 0, "Display buttons (F10)");
xco+= 80;
- ob= OBACT;
buttons_active_id(&id, &idfrom);