- Static particles now draw shaded too!

http://www.blender.org/bf/rt3.jpg
  It uses Material color and specular, like for the solid faces.
- Depgraph Fix for changing object layers, should re-evaluate dependencies
- Fix for setting curves to 3D by default (on adding a Guide field)
This commit is contained in:
Ton Roosendaal 2005-11-10 19:00:10 +00:00
parent 4c76b74b00
commit bfddf7f4af
5 changed files with 59 additions and 30 deletions

@ -644,8 +644,10 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
/* optimal redraw */
if( (ob->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) );
else if( (ob->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 );
else allqueue(REDRAWVIEW3D, 0);
else {
allqueue(REDRAWVIEW3D, 0);
DAG_scene_sort(G.scene);
}
ob->lay= BASACT->lay;
}
}

@ -1629,7 +1629,10 @@ void do_effects_panels(unsigned short event)
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
if(ob->type==OB_CURVE && ob->pd->forcefield==PFIELD_GUIDE) {
Curve *cu= ob->data;
cu->flag |= (CU_PATH|CU_3D);
do_curvebuts(B_CU3D); /* all curves too */
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
}
allqueue(REDRAWVIEW3D, 0);

@ -1457,7 +1457,12 @@ void sound_panels()
{
bSound *sound;
/* paranoia check */
sound = G.buts->lockpoin;
if( GS(sound->id.name)!=ID_SO) {
sound= NULL;
G.buts->lockpoin= NULL;
}
sound_panel_sound(sound);
sound_panel_listener();

@ -2384,11 +2384,11 @@ static void draw_particle_system(Object *ob, PartEff *paf)
mymultmatrix(ob->obmat); // bring back local matrix for dtx
}
static void draw_static_particle_system(Object *ob, PartEff *paf)
static void draw_static_particle_system(Object *ob, PartEff *paf, int dt)
{
Particle *pa;
float ctime, mtime, vec[3], vec1[3];
int a;
float ctime, mtime, vec[3], veco[3];
int a, use_norm=0;
pa= paf->keys;
if(pa==NULL) {
@ -2397,39 +2397,56 @@ static void draw_static_particle_system(Object *ob, PartEff *paf)
if(pa==NULL) return;
}
if(paf->stype==PAF_VECT) {
if(dt>OB_WIRE) {
glEnable(GL_LIGHTING);
set_gl_material(paf->omat);
use_norm= 1;
}
}
else {
glPointSize(1.0);
if(paf->stype!=PAF_VECT) glBegin(GL_POINTS);
glBegin(GL_POINTS);
}
for(a=0; a<paf->totpart; a++, pa+=paf->totkey) {
where_is_particle(paf, pa, pa->time, vec1);
mtime= pa->time+pa->lifetime+paf->staticstep-1;
for(ctime= pa->time; ctime<mtime; ctime+=paf->staticstep) {
/* make sure hair grows until the end.. */
if(ctime>pa->time+pa->lifetime) ctime= pa->time+pa->lifetime;
if(paf->stype==PAF_VECT) {
where_is_particle(paf, pa, ctime+1, vec);
glBegin(GL_LINE_STRIP);
glVertex3fv(vec);
glVertex3fv(vec1);
glEnd();
where_is_particle(paf, pa, pa->time, veco);
mtime= pa->time+pa->lifetime+paf->staticstep;
for(ctime= pa->time+paf->staticstep; ctime<mtime; ctime+=paf->staticstep) {
VECCOPY(vec1, vec);
}
else {
where_is_particle(paf, pa, ctime, vec);
glVertex3fv(vec);
if(use_norm) {
float no[3];
VECSUB(no, vec, veco);
glNormal3fv(no);
}
glVertex3fv(veco);
VECCOPY(veco, vec);
}
glVertex3fv(veco);
glEnd();
}
else {
mtime= pa->time+pa->lifetime+paf->staticstep-1;
for(ctime= pa->time; ctime<mtime; ctime+=paf->staticstep) {
where_is_particle(paf, pa, ctime, vec);
glVertex3fv(vec);
}
}
}
if(paf->stype!=PAF_VECT) glEnd();
if(paf->stype==PAF_VECT) {
glDisable(GL_LIGHTING);
}
else {
glEnd();
}
}
@ -3515,7 +3532,7 @@ void draw_object(Base *base)
if(paf) {
if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */
if(paf->flag & PAF_STATIC) draw_static_particle_system(ob, paf);
if(paf->flag & PAF_STATIC) draw_static_particle_system(ob, paf, dt);
else if((G.f & G_PICKSEL) == 0) draw_particle_system(ob, paf); // selection errors happen to easy
if(col) cpack(col);
}

@ -1865,6 +1865,8 @@ void movetolayer(void)
if(islamp && G.vd->drawtype == OB_SHADED) reshadeall_displist();
countall();
DAG_scene_sort(G.scene);
allqueue(REDRAWBUTSEDIT, 0);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWOOPS, 0);