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:
authorDiego Borghetti <bdiego@gmail.com>2008-05-29 06:25:55 +0400
committerDiego Borghetti <bdiego@gmail.com>2008-05-29 06:25:55 +0400
commit02cfaaaaab25acfca5d1c33e1b15198ec2631048 (patch)
tree6aa55b04cb5717f1a9cba81384aa225a073f653e
parent5c9a79f7a66a822d56ef0dfa213928f0a3b0d964 (diff)
branches/blender-2.47
Merge from trunk: Revision: 15027 Revision: 15028 Revision: 15029 Revision: 15030 Revision: 15031 Revision: 15032 Revision: 15034
-rw-r--r--source/blender/blenkernel/intern/object.c9
-rw-r--r--source/blender/render/intern/source/rayshade.c22
-rw-r--r--source/blender/src/drawobject.c83
-rw-r--r--source/blender/src/drawview.c22
-rw-r--r--source/blender/src/meshtools.c6
5 files changed, 106 insertions, 36 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index ab1bc5a2265..4f901ba7216 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1614,7 +1614,7 @@ static void give_parvert(Object *par, int nr, float *vec)
for(eve= em->verts.first; eve; eve= eve->next) {
if(eve->keyindex==nr) {
- memcpy(vec, eve->co, 12);
+ memcpy(vec, eve->co, sizeof(float)*3);
break;
}
}
@@ -1652,18 +1652,20 @@ static void give_parvert(Object *par, int nr, float *vec)
Curve *cu;
BPoint *bp;
BezTriple *bezt;
+ int found= 0;
cu= par->data;
nu= cu->nurb.first;
if(par==G.obedit) nu= editNurb.first;
count= 0;
- while(nu) {
+ while(nu && !found) {
if((nu->type & 7)==CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
if(count==nr) {
+ found= 1;
VECCOPY(vec, bezt->vec[1]);
break;
}
@@ -1676,7 +1678,8 @@ static void give_parvert(Object *par, int nr, float *vec)
a= nu->pntsu*nu->pntsv;
while(a--) {
if(count==nr) {
- memcpy(vec, bp->vec, 12);
+ found= 1;
+ memcpy(vec, bp->vec, sizeof(float)*3);
break;
}
count++;
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 8fd07001bd1..1155d2ea817 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -1473,14 +1473,15 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys)
int tot;
float *vec;
- if(resol>16) resol= 16;
-
tot= 2*resol*resol;
if (type & WO_AORNDSMP) {
- static float sphere[2*3*256];
+ float *sphere;
int a;
+ // always returns table
+ sphere= threadsafe_table_sphere(0, thread, xs, ys, tot);
+
/* total random sampling. NOT THREADSAFE! (should be removed, is not useful) */
vec= sphere;
for (a=0; a<tot; a++, vec+=3) {
@@ -1495,7 +1496,8 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys)
float ang, *vec1;
int a;
- sphere= threadsafe_table_sphere(1, thread, xs, ys, tot); // returns table if xs and ys were equal to last call
+ // returns table if xs and ys were equal to last call
+ sphere= threadsafe_table_sphere(1, thread, xs, ys, tot);
if(sphere==NULL) {
sphere= threadsafe_table_sphere(0, thread, xs, ys, tot);
@@ -1663,7 +1665,7 @@ void ray_ao_spheresamp(ShadeInput *shi, float *shadfac)
float *vec, *nrm, div, bias, sh=0.0f;
float maxdist = R.wrld.aodist;
float dxyview[3];
- int j= -1, tot, actual=0, skyadded=0, aocolor;
+ int j= -1, tot, actual=0, skyadded=0, aocolor, resol= R.wrld.aosamp;
isec.faceorig= (RayFace*)shi->vlr;
isec.oborig= RAY_OBJECT_SET(&R, shi->obi);
@@ -1690,14 +1692,16 @@ void ray_ao_spheresamp(ShadeInput *shi, float *shadfac)
if(shi->mat->mode & MA_ONLYSHADOW)
aocolor= WO_AOPLAIN;
- vec= sphere_sampler(R.wrld.aomode, R.wrld.aosamp, shi->thread, shi->xs, shi->ys);
+ if(resol>32) resol= 32;
+
+ vec= sphere_sampler(R.wrld.aomode, resol, shi->thread, shi->xs, shi->ys);
// warning: since we use full sphere now, and dotproduct is below, we do twice as much
- tot= 2*R.wrld.aosamp*R.wrld.aosamp;
+ tot= 2*resol*resol;
if(aocolor == WO_AOSKYTEX) {
- dxyview[0]= 1.0f/(float)R.wrld.aosamp;
- dxyview[1]= 1.0f/(float)R.wrld.aosamp;
+ dxyview[0]= 1.0f/(float)resol;
+ dxyview[1]= 1.0f/(float)resol;
dxyview[2]= 0.0f;
}
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index 3ef14574bc8..96ba8c71755 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -2902,7 +2902,7 @@ static void draw_new_particle_system(Base *base, ParticleSystem *psys, int dt)
float *vdata=0, *vedata=0, *cdata=0, *ndata=0, *vd=0, *ved=0, *cd=0, *nd=0, xvec[3], yvec[3], zvec[3];
int a, k, k_max=0, totpart, totpoint=0, draw_as, path_nbr=0;
int path_possible=0, keys_possible=0, draw_keys=0, totchild=0;
- int select=ob->flag&SELECT;
+ int select=ob->flag&SELECT, create_cdata=0;
GLint polygonmode[2];
char val[32];
@@ -2956,8 +2956,10 @@ static void draw_new_particle_system(Base *base, ParticleSystem *psys, int dt)
if(select)
cpack(0xFFFFFF);
- else if((ma) && (part->draw&PART_DRAW_MAT_COL))
+ else if((ma) && (part->draw&PART_DRAW_MAT_COL)) {
glColor3f(ma->r,ma->g,ma->b);
+ create_cdata = 1;
+ }
else
cpack(0);
@@ -3065,19 +3067,25 @@ static void draw_new_particle_system(Base *base, ParticleSystem *psys, int dt)
if(draw_as!=PART_DRAW_CIRC){
switch(draw_as){
case PART_DRAW_AXIS:
- cdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*6*3*sizeof(float), "particle_cdata");
- /* no break! */
case PART_DRAW_CROSS:
+ if(draw_as!=PART_DRAW_CROSS || create_cdata)
+ cdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*6*3*sizeof(float), "particle_cdata");
vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*6*3*sizeof(float), "particle_vdata");
break;
case PART_DRAW_LINE:
+ if(create_cdata)
+ cdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*2*3*sizeof(float), "particle_cdata");
vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*2*3*sizeof(float), "particle_vdata");
break;
case PART_DRAW_BB:
+ if(create_cdata)
+ cdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*4*3*sizeof(float), "particle_cdata");
vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*4*3*sizeof(float), "particle_vdata");
ndata=MEM_callocN((totpart+totchild)*(path_nbr+1)*4*3*sizeof(float), "particle_vdata");
break;
default:
+ if(create_cdata)
+ cdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*3*sizeof(float), "particle_cdata");
vdata=MEM_callocN((totpart+totchild)*(path_nbr+1)*3*sizeof(float), "particle_vdata");
}
}
@@ -3102,9 +3110,17 @@ static void draw_new_particle_system(Base *base, ParticleSystem *psys, int dt)
pa_time=(cfra-pa->time)/pa->lifetime;
- if((part->flag&PART_ABS_TIME)==0 && part->ipo){
- calc_ipo(part->ipo, 100*pa_time);
- execute_ipo((ID *)part, part->ipo);
+ if((part->flag&PART_ABS_TIME)==0){
+ if(ma && ma->ipo){
+ /* correction for lifetime */
+ calc_ipo(ma->ipo, 100.0f*pa_time);
+ execute_ipo((ID *)ma, ma->ipo);
+ }
+ if(part->ipo) {
+ /* correction for lifetime */
+ calc_ipo(part->ipo, 100*pa_time);
+ execute_ipo((ID *)part, part->ipo);
+ }
}
pa_size=pa->size;
@@ -3121,9 +3137,17 @@ static void draw_new_particle_system(Base *base, ParticleSystem *psys, int dt)
pa_time=psys_get_child_time(psys,cpa,cfra);
- if((part->flag&PART_ABS_TIME)==0 && part->ipo){
- calc_ipo(part->ipo, 100*pa_time);
- execute_ipo((ID *)part, part->ipo);
+ if((part->flag&PART_ABS_TIME)==0) {
+ if(ma && ma->ipo){
+ /* correction for lifetime */
+ calc_ipo(ma->ipo, 100.0f*pa_time);
+ execute_ipo((ID *)ma, ma->ipo);
+ }
+ if(part->ipo) {
+ /* correction for lifetime */
+ calc_ipo(part->ipo, 100*pa_time);
+ execute_ipo((ID *)part, part->ipo);
+ }
}
pa_size=psys_get_child_size(psys,cpa,cfra,0);
@@ -3161,6 +3185,12 @@ static void draw_new_particle_system(Base *base, ParticleSystem *psys, int dt)
switch(draw_as){
case PART_DRAW_DOT:
+ if(cd) {
+ cd[0]=ma->r;
+ cd[1]=ma->g;
+ cd[2]=ma->b;
+ cd+=3;
+ }
if(vd){
VECCOPY(vd,state.co) vd+=3;
}
@@ -3181,7 +3211,15 @@ static void draw_new_particle_system(Base *base, ParticleSystem *psys, int dt)
VECCOPY(vec2,state.co);
}
- else VECSUB(vec2,state.co,vec);
+ else {
+ if(cd) {
+ cd[0]=cd[3]=cd[6]=cd[9]=cd[12]=cd[15]=ma->r;
+ cd[1]=cd[4]=cd[7]=cd[10]=cd[13]=cd[16]=ma->g;
+ cd[2]=cd[5]=cd[8]=cd[11]=cd[14]=cd[17]=ma->b;
+ cd+=18;
+ }
+ VECSUB(vec2,state.co,vec);
+ }
VECADD(vec,state.co,vec);
VECCOPY(vd,vec); vd+=3;
@@ -3219,11 +3257,25 @@ static void draw_new_particle_system(Base *base, ParticleSystem *psys, int dt)
VecMulf(vec,VecLength(state.vel));
VECADDFAC(vd,state.co,vec,-part->draw_line[0]); vd+=3;
VECADDFAC(vd,state.co,vec,part->draw_line[1]); vd+=3;
+ if(cd) {
+ cd[0]=cd[3]=ma->r;
+ cd[1]=cd[4]=ma->g;
+ cd[2]=cd[5]=ma->b;
+ cd+=3;
+ }
break;
case PART_DRAW_CIRC:
+ if(create_cdata)
+ glColor3f(ma->r,ma->g,ma->b);
drawcircball(GL_LINE_LOOP, state.co, pixsize, imat);
break;
case PART_DRAW_BB:
+ if(cd) {
+ cd[0]=cd[3]=cd[6]=cd[9]=ma->r;
+ cd[1]=cd[4]=cd[7]=cd[10]=ma->g;
+ cd[2]=cd[5]=cd[8]=cd[11]=ma->b;
+ cd+=12;
+ }
if(part->draw&PART_DRAW_BB_LOCK && part->bb_align==PART_BB_VIEW){
VECCOPY(xvec,bb_ob->obmat[0]);
Normalize(xvec);
@@ -3419,13 +3471,14 @@ static void draw_new_particle_system(Base *base, ParticleSystem *psys, int dt)
glDisable(GL_LIGHTING);
}
+ if(cdata){
+ glEnableClientState(GL_COLOR_ARRAY);
+ glColorPointer(3, GL_FLOAT, 0, cdata);
+ }
+
switch(draw_as){
case PART_DRAW_AXIS:
case PART_DRAW_CROSS:
- if(cdata){
- glEnableClientState(GL_COLOR_ARRAY);
- glColorPointer(3, GL_FLOAT, 0, cdata);
- }
glDrawArrays(GL_LINES, 0, 6*totpoint);
break;
case PART_DRAW_LINE:
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 52e0d3d6f05..e83ecb13960 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -3732,18 +3732,22 @@ int play_anim(int mode)
else viewmove(0);
}
} else if (event==WHEELDOWNMOUSE || (val && event==PADMINUS)) { /* copied from persptoetsen */
- /* this min and max is also in viewmove() */
- if(G.vd->persp==V3D_CAMOB) {
- G.vd->camzoom-= 10;
- if(G.vd->camzoom<-30) G.vd->camzoom= -30;
+ if (G.vd) { /* when using the sequencer this can be NULL */
+ /* this min and max is also in viewmove() */
+ if(G.vd->persp==V3D_CAMOB) {
+ G.vd->camzoom-= 10;
+ if(G.vd->camzoom<-30) G.vd->camzoom= -30;
+ }
+ else if(G.vd->dist<10.0*G.vd->far) G.vd->dist*=1.2f;
}
- else if(G.vd->dist<10.0*G.vd->far) G.vd->dist*=1.2f;
} else if (event==WHEELUPMOUSE || (val && event==PADPLUSKEY)) { /* copied from persptoetsen */
- if(G.vd->persp==V3D_CAMOB) {
- G.vd->camzoom+= 10;
- if(G.vd->camzoom>300) G.vd->camzoom= 300;
+ if (G.vd) {
+ if(G.vd->persp==V3D_CAMOB) {
+ G.vd->camzoom+= 10;
+ if(G.vd->camzoom>300) G.vd->camzoom= 300;
+ }
+ else if(G.vd->dist> 0.001*G.vd->grid) G.vd->dist*=.83333f;
}
- else if(G.vd->dist> 0.001*G.vd->grid) G.vd->dist*=.83333f;
} else if(event==MKEY) {
if(val) add_marker(CFRA-1);
}
diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c
index e27e772edee..ac165d6aeb2 100644
--- a/source/blender/src/meshtools.c
+++ b/source/blender/src/meshtools.c
@@ -957,6 +957,12 @@ int *mesh_get_x_mirror_faces(Object *ob)
mirrormf.v3= mirrorverts[mf->v1];
mirrormf.v4= (mf->v4)? mirrorverts[mf->v4]: 0;
+ /* make sure v4 is not 0 if a quad */
+ if(mf->v4 && mirrormf.v4==0) {
+ SWAP(int, mirrormf.v1, mirrormf.v3);
+ SWAP(int, mirrormf.v2, mirrormf.v4);
+ }
+
hashmf= BLI_ghash_lookup(fhash, &mirrormf);
if(hashmf) {
mirrorfaces[a*2]= hashmf - mface;