diff options
author | Ton Roosendaal <ton@blender.org> | 2003-07-12 00:02:52 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-07-12 00:02:52 +0400 |
commit | 60dddf84abe571ef39f0f40ae9ef51ef0681115a (patch) | |
tree | 92a63e357c38fb0d55c1ce995f96324d6ab79574 | |
parent | 94f8098660e74de2537ac59d812646e7bb815f47 (diff) |
* selecting objects has a different frontbuffer drawing handling now.
instead of drawing everything again, in all windows, it restricts to
the active and previous active object. when there are more objects to
be redrawn, it does a normal swapbuffers.
Result is it all redraws & selects a lot faster in complex scenes
* Little fix in "BallTable" routine when moving mouse vertical out of
the 3d window.
-rw-r--r-- | source/blender/src/drawobject.c | 10 | ||||
-rw-r--r-- | source/blender/src/editview.c | 27 | ||||
-rw-r--r-- | source/blender/src/view.c | 27 |
3 files changed, 33 insertions, 31 deletions
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index bc24100b954..76dad6c3f15 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -241,8 +241,9 @@ static void draw_icon_centered(float *pos, unsigned int *rect, int rectsize) /* use bitmap to shift rasterpos in pixels */ glBitmap(0, 0, 0.0, 0.0, -hsize, -hsize, &dummy); - glFinish(); /* for sun */ - +#ifdef __sun__ + glFinish(); +#endif glDrawPixels(rectsize, rectsize, GL_RGBA, GL_UNSIGNED_BYTE, rect); } @@ -2113,7 +2114,7 @@ static void drawDispList(Object *ob, int dt) MFace *curface; int i; unsigned char r,g,b; - float val1,val2,val3,val4; + float val1,val2,val3,val4=0; wtcol = curwt= MEM_callocN (sizeof (unsigned char) * me->totface*4*4, "weightmap"); @@ -3646,7 +3647,7 @@ void draw_object_ext(Base *base) ScrArea *tempsa, *sa; View3D *vd; - if(G.vd==0) return; + if(G.vd==NULL || base==NULL) return; if(G.vd->drawtype > OB_WIRE) { G.zbuf= 1; @@ -3679,7 +3680,6 @@ void draw_object_ext(Base *base) G.f &= ~G_DRAW_EXT; - glFinish(); glDrawBuffer(GL_BACK); if(G.zbuf) { diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c index 0d012b0b3cb..bbeddd2952c 100644 --- a/source/blender/src/editview.c +++ b/source/blender/src/editview.c @@ -379,22 +379,23 @@ void deselectall(void) /* is toggle */ } -static void deselectall_ex(Base *b) /* deselect all except b */ +static void deselectall_except(Base *b) /* deselect all except b */ { Base *base; + int redraw=0; base= FIRSTBASE; while(base) { if (base->flag & SELECT) { if(b!=base) { - base->flag &= ~SELECT; base->object->flag= base->flag; - draw_object_ext(base); /* this test for layer */ + redraw= 1; } } base= base->next; } + if(redraw) allqueue(REDRAWVIEW3D, 0); countall(); } @@ -484,7 +485,7 @@ void set_active_object(Object *ob) void mouse_select(void) { - Base *base, *startbase=0, *basact=0, *oldbasact; + Base *base, *startbase=NULL, *basact=NULL, *oldbasact=NULL; unsigned int buffer[MAXPICKBUF]; int temp, a, dist=100; short hits, mval[2]; @@ -547,7 +548,7 @@ void mouse_select(void) if(basact) { if(G.obedit) { /* only do select */ - deselectall_ex(BASACT); + deselectall_except(BASACT); basact->flag |= SELECT; draw_object_ext(basact); } @@ -556,28 +557,26 @@ void mouse_select(void) BASACT= basact; if((G.qual & LR_SHIFTKEY)==0) { - deselectall_ex(basact); + deselectall_except(basact); basact->flag |= SELECT; } else { - if(oldbasact) if(oldbasact != basact) draw_object_ext(oldbasact); - if(basact->flag & SELECT) { if(basact==oldbasact) basact->flag &= ~SELECT; } else basact->flag |= SELECT; } - - /* if((basact->flag & SELECT)==0) BASACT= 0; */ + + // copy basact->object->flag= basact->flag; + // for visual speed + if(oldbasact != basact) draw_object_ext(oldbasact); draw_object_ext(basact); if(oldbasact != basact) { - set_active_base(basact); - } if(basact->object->type!=OB_MESH) { @@ -599,7 +598,9 @@ void mouse_select(void) allqueue(REDRAWNLA, 0); allqueue(REDRAWHEADERS, 0); /* To force display update for the posebutton */ } - + + glFinish(); /* reveil frontbuffer drawing */ + } countall(); diff --git a/source/blender/src/view.c b/source/blender/src/view.c index 590626088e0..f878fb5b51b 100644 --- a/source/blender/src/view.c +++ b/source/blender/src/view.c @@ -453,6 +453,7 @@ void viewmove(int mode) si= sqrt(dvec[0]*dvec[0]+ dvec[1]*dvec[1]+ dvec[2]*dvec[2]); si/= (2.0*TRACKBALLSIZE); + /* is there an acceptable solution? (180 degrees limitor) */ if(si<1.0) { Crossf(q1+1, firstvec, newvec); @@ -467,20 +468,20 @@ void viewmove(int mode) q1[3]*= si; QuatMul(G.vd->viewquat, q1, oldquat); - } - - if( (U.flag & TRACKBALL)==0 ) { - - /* rotate around z-axis (mouse x moves) */ - - phi= 2*(mval[0]-mvalball[0]); - phi/= (float)curarea->winx; - si= sin(phi); - q1[0]= cos(phi); - q1[1]= q1[2]= 0.0; - q1[3]= si; + + if( (U.flag & TRACKBALL)==0 ) { - QuatMul(G.vd->viewquat, G.vd->viewquat, q1); + /* rotate around z-axis (mouse x moves) */ + + phi= 2*(mval[0]-mvalball[0]); + phi/= (float)curarea->winx; + si= sin(phi); + q1[0]= cos(phi); + q1[1]= q1[2]= 0.0; + q1[3]= si; + + QuatMul(G.vd->viewquat, G.vd->viewquat, q1); + } } } else if(mode==1) { /* translate */ |