[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15041] branches/blender-2.47/source/ blender: branches/blender-2.47
Diego Borghetti
bdiego at gmail.com
Thu May 29 04:25:57 CEST 2008
Revision: 15041
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15041
Author: bdiego
Date: 2008-05-29 04:25:55 +0200 (Thu, 29 May 2008)
Log Message:
-----------
branches/blender-2.47
Merge from trunk:
Revision: 15027
Revision: 15028
Revision: 15029
Revision: 15030
Revision: 15031
Revision: 15032
Revision: 15034
Modified Paths:
--------------
branches/blender-2.47/source/blender/blenkernel/intern/object.c
branches/blender-2.47/source/blender/render/intern/source/rayshade.c
branches/blender-2.47/source/blender/src/drawobject.c
branches/blender-2.47/source/blender/src/drawview.c
branches/blender-2.47/source/blender/src/meshtools.c
Modified: branches/blender-2.47/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/blender-2.47/source/blender/blenkernel/intern/object.c 2008-05-29 01:08:10 UTC (rev 15040)
+++ branches/blender-2.47/source/blender/blenkernel/intern/object.c 2008-05-29 02:25:55 UTC (rev 15041)
@@ -1614,7 +1614,7 @@
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 @@
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 @@
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++;
Modified: branches/blender-2.47/source/blender/render/intern/source/rayshade.c
===================================================================
--- branches/blender-2.47/source/blender/render/intern/source/rayshade.c 2008-05-29 01:08:10 UTC (rev 15040)
+++ branches/blender-2.47/source/blender/render/intern/source/rayshade.c 2008-05-29 02:25:55 UTC (rev 15041)
@@ -1473,14 +1473,15 @@
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 @@
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 @@
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 @@
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;
}
Modified: branches/blender-2.47/source/blender/src/drawobject.c
===================================================================
--- branches/blender-2.47/source/blender/src/drawobject.c 2008-05-29 01:08:10 UTC (rev 15040)
+++ branches/blender-2.47/source/blender/src/drawobject.c 2008-05-29 02:25:55 UTC (rev 15041)
@@ -2902,7 +2902,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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:
Modified: branches/blender-2.47/source/blender/src/drawview.c
===================================================================
--- branches/blender-2.47/source/blender/src/drawview.c 2008-05-29 01:08:10 UTC (rev 15040)
+++ branches/blender-2.47/source/blender/src/drawview.c 2008-05-29 02:25:55 UTC (rev 15041)
@@ -3732,18 +3732,22 @@
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);
}
Modified: branches/blender-2.47/source/blender/src/meshtools.c
===================================================================
--- branches/blender-2.47/source/blender/src/meshtools.c 2008-05-29 01:08:10 UTC (rev 15040)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list