- first of a series of translated C comments. No dutchies get advantage anymore soon... :-)

This commit is contained in:
2003-04-25 15:48:11 +00:00
parent c46a6de931
commit e1d6502259
5 changed files with 200 additions and 205 deletions

View File

@@ -83,8 +83,8 @@ void calc_curvepath(Object *ob)
int a, tot, cycl=0;
float *ft;
/* in een pad zitten allemaal punten met gelijke afstand: path->len = aantal pt */
/* NU MET BEVELCURVE!!! */
/* in a path vertices are with equal differences: path->len = number of verts */
/* NOW WITH BEVELCURVE!!! */
if(ob==0 || ob->type != OB_CURVE) return;
cu= ob->data;
@@ -105,7 +105,7 @@ void calc_curvepath(Object *ob)
cu->path=path= MEM_callocN(sizeof(Path), "path");
/* als POLY: laatste punt != eerste punt */
/* if POLY: last vertice != first vertice */
cycl= (bl->poly!= -1);
if(cycl) tot= bl->nr;
@@ -115,9 +115,9 @@ void calc_curvepath(Object *ob)
/* exception: vector handle paths and polygon paths should be subdivided at least a factor 6 (or more?) */
if(path->len<6*nu->pntsu) path->len= 6*nu->pntsu;
dist= (float *)MEM_mallocN((tot+1)*4, "berekenpaddist");
dist= (float *)MEM_mallocN((tot+1)*4, "calcpathdist");
/* alle lengtes in *dist */
/* all lengths in *dist */
bevp= bevpfirst= (BevPoint *)(bl+1);
fp= dist;
*fp= 0;
@@ -141,8 +141,8 @@ void calc_curvepath(Object *ob)
path->totdist= *fp;
/* de padpunten in path->data */
/* nu ook met TILT */
/* the path verts in path->data */
/* now also with TILT value */
ft= path->data = (float *)MEM_callocN(16*path->len, "pathdata");
bevp= bevpfirst;
@@ -157,7 +157,7 @@ void calc_curvepath(Object *ob)
d= ((float)a)*fac;
/* we zoeken plek 'd' in het array */
/* we're looking for location (distance) 'd' in the array */
while((d>= *fp) && fp<maxdist) {
fp++;
if(bevp<bevplast) bevp++;
@@ -201,7 +201,7 @@ int interval_test(int min, int max, int p1, int cycl)
return p1;
}
int where_on_path(Object *ob, float ctime, float *vec, float *dir) /* geeft OK terug */
int where_on_path(Object *ob, float ctime, float *vec, float *dir) /* returns OK */
{
Curve *cu;
Nurb *nu;
@@ -218,17 +218,17 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir) /* geeft OK t
path= cu->path;
fp= path->data;
/* cyclic testen */
/* test for cyclic */
bl= cu->bev.first;
if(bl && bl->poly> -1) cycl= 1;
/* ctime is van 0.0-1.0 */
/* ctime is between 0.0-1.0 */
ctime *= (path->len-1);
s1= (int)floor(ctime);
fac= (float)(s1+1)-ctime;
/* path->len is gecorrigeerd voor cyclic, zie boven, is beetje warrig! */
/* path->len is corected for cyclic */
s0= interval_test(0, path->len-1-cycl, s1-1, cycl);
s1= interval_test(0, path->len-1-cycl, s1, cycl);
s2= interval_test(0, path->len-1-cycl, s1+1, cycl);
@@ -247,7 +247,7 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir) /* geeft OK t
dir[1]= data[0]*p0[1] + data[1]*p1[1] + data[2]*p2[1] + data[3]*p3[1] ;
dir[2]= data[0]*p0[2] + data[1]*p1[2] + data[2]*p2[2] + data[3]*p3[2] ;
/* compatible maken met vectoquat */
/* make compatible with vectoquat */
dir[0]= -dir[0];
dir[1]= -dir[1];
dir[2]= -dir[2];
@@ -255,7 +255,7 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir) /* geeft OK t
nu= cu->nurb.first;
/* zeker van zijn dat de eerste en laatste frame door de punten gaat */
/* make sure that first and last frame are included in the vectors here */
if((nu->type & 7)==CU_POLY) set_four_ipo(1.0f-fac, data, KEY_LINEAR);
else if((nu->type & 7)==CU_BEZIER) set_four_ipo(1.0f-fac, data, KEY_LINEAR);
else if(s0==s1 || p2==p3) set_four_ipo(1.0f-fac, data, KEY_CARDINAL);
@@ -281,7 +281,7 @@ void frames_duplilist(Object *ob)
if(ob->transflag & OB_DUPLINOSPEED) enable_cu_speed= 0;
/* dit om zeker van te zijn dat er iets gezbufferd wordt: in drawobject.c: dt==wire en boundboxclip */
/* this to make sure that something is z-buffered in drawobject.c */
if(G.background==0 && ob->type==OB_MESH) {
Mesh *me= ob->data;
DispList *dl;
@@ -305,7 +305,7 @@ void frames_duplilist(Object *ob)
newob= MEM_mallocN(sizeof(Object), "newobobj dupli");
memcpy(newob, ob, sizeof(Object));
/* alleen de basis-ball behoeft een displist */
/*only the basis-ball gets a displist */
if(newob->type==OB_MBALL) newob->disp.first= newob->disp.last= 0;
BLI_addtail(&duplilist, newob);
@@ -313,7 +313,7 @@ void frames_duplilist(Object *ob)
where_is_object(newob);
newob->flag |= OB_FROMDUPLI;
newob->id.newid= (ID *)ob; /* duplicator bewaren */
newob->id.newid= (ID *)ob; /* store duplicator */
}
}
@@ -362,7 +362,7 @@ void vertex_duplilist(Scene *sce, Object *par)
for(a=0; a<totvert; a++, mvert++) {
/* bereken de extra offset (tov. nulpunt parent) die de kinderen krijgen */
/* calc the extra offset for children (wrt. centre parent) */
VECCOPY(vec, mvert->co);
Mat4MulVecfl(pmat, vec);
VecSubf(vec, vec, pmat[3]);
@@ -371,9 +371,9 @@ void vertex_duplilist(Scene *sce, Object *par)
newob= MEM_mallocN(sizeof(Object), "newobj dupli");
memcpy(newob, ob, sizeof(Object));
newob->flag |= OB_FROMDUPLI;
newob->id.newid= (ID *)par; /* duplicator bewaren */
newob->id.newid= (ID *)par; /* keep duplicator */
/* alleen de basis-ball behoeft een displist */
/* only basis-ball gets displist */
if(newob->type==OB_MBALL) newob->disp.first= newob->disp.last= 0;
VECCOPY(newob->obmat[3], vec);
@@ -448,9 +448,9 @@ void particle_duplilist(Scene *sce, Object *par, PartEff *paf)
newob= MEM_mallocN(sizeof(Object), "newobj dupli");
memcpy(newob, ob, sizeof(Object));
newob->flag |= OB_FROMDUPLI;
newob->id.newid= (ID *)par; /* duplicator bewaren */
newob->id.newid= (ID *)par; /* keep duplicator */
/* alleen de basis-ball behoeft een displist */
/* only basis-ball gets displist */
if(newob->type==OB_MBALL) newob->disp.first= newob->disp.last= 0;
where_is_particle(paf, pa, ctime, vec);

View File

@@ -1,7 +1,7 @@
/* blender.c jan 94 MIXED MODEL
*
* algemene hulp funkties en data
* common help functions and data
*
* $Id$
*
@@ -93,7 +93,7 @@ UserDef U;
char versionstr[48]= "";
/* ************************************************ */
/* pushpop faciliteit: om tijdelijk data te bewaren */
/* pushpop facility: to store data temporally, FIFO! */
ListBase ppmain={0, 0};
@@ -162,7 +162,7 @@ void pushpop_test()
/* ********** vrijgeven ********** */
/* ********** free ********** */
void free_blender(void)
{
@@ -172,7 +172,7 @@ void free_blender(void)
IMB_freeImBufdata(); /* imbuf lib */
}
void duplicatelist(ListBase *list1, ListBase *list2) /* kopie van 2 naar 1 */
void duplicatelist(ListBase *list1, ListBase *list2) /* copy from 2 to 1 */
{
struct Link *link1, *link2;
@@ -217,10 +217,10 @@ static void clear_global(void) {
freeAllRad();
free_main(G.main); /* free all lib data */
freefastshade(); /* anders oude lampgegevens */
freefastshade(); /* othwerwise old lamp settings stay active */
/* hangende vars voorkomen */
/* prevent hanging vars */
R.backbuf= 0;
/* force all queues to be left */
@@ -271,7 +271,7 @@ static void setup_app_data(BlendFileData *bfd, char *filename) {
G.scene= G.curscreen->scene;
/* weinig DispListen, wel text_to_curve */
/* few DispLists, but do text_to_curve */
// this should be removed!!! But first a better displist system (ton)
for (ob= G.main->object.first; ob; ob= ob->id.next) {
if(ob->type==OB_FONT) {
@@ -295,7 +295,7 @@ static void setup_app_data(BlendFileData *bfd, char *filename) {
}
strcpy(G.sce, filename);
strcpy(G.main->name, filename); /* is gegarandeerd current file */
strcpy(G.main->name, filename); /* is guaranteed current file */
MEM_freeN(bfd);
}

View File

@@ -1,7 +1,6 @@
/* curve.c MIXED MODEL
/* curve.c
*
* maart 95
*
* $Id$
*
@@ -203,7 +202,7 @@ Curve *copy_curve(Curve *cu)
cun->bev.first= cun->bev.last= 0;
cun->path= 0;
/* ook single user ipo */
/* single user ipo too */
if(cun->ipo) cun->ipo= copy_ipo(cun->ipo);
id_us_plus((ID *)cun->vfont);
@@ -217,9 +216,9 @@ void make_local_curve(Curve *cu)
Curve *cun;
int local=0, lib=0;
/* - zijn er alleen lib users: niet doen
* - zijn er alleen locale users: flag zetten
* - mixed: copy
/* - when there are only lib users: don't do
* - when there are only local users: set flag
* - mixed: do a copy
*/
if(cu->id.lib==0) return;
@@ -523,10 +522,10 @@ void minmaxNurb(Nurb *nu, float *min, float *max)
}
/* ~~~~~~~~~~~~~~~~~~~~Non Uniform Rational B Spline berekeningen ~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~Non Uniform Rational B Spline calculations ~~~~~~~~~~~ */
/* voor de goede orde: eigenlijk horen hier doubles gebruikt te worden */
/* actually, doubles should be used here as much as possible */
void extend_spline(float * pnts, int in, int out)
{
@@ -542,13 +541,13 @@ void extend_spline(float * pnts, int in, int out)
for (k = 3; k > 0; k--){
pnts = _pnts;
/* punten kopieren naar add */
/* copy points to 'add' */
for (i = 0; i < in; i++){
add[i] = *pnts;
pnts += 3;
}
/* inverse forward differencen */
/* inverse forward differencing */
for (i = 0; i < in2; i++){
for (j = in2; j > i; j--){
add[j] -= add[j - 1];
@@ -572,8 +571,8 @@ void extend_spline(float * pnts, int in, int out)
void calcknots(float *knots, short aantal, short order, short type)
/* knots: aantal pnts NIET gecorrigeerd voor cyclic */
/* aantal, order, type; 0: uniform, 1: endpoints, 2: bezier */
/* knots: number of pnts NOT corrected for cyclic */
/* type; 0: uniform, 1: endpoints, 2: bezier */
{
float k;
int a, t;
@@ -611,14 +610,14 @@ void calcknots(float *knots, short aantal, short order, short type)
}
void makecyclicknots(float *knots, short pnts, short order)
/* pnts, order: aantal pnts NIET gecorrigeerd voor cyclic */
/* pnts, order: number of pnts NOT corrected for cyclic */
{
int a, b, order2, c;
if(knots==0) return;
order2=order-1;
/* eerst lange rijen (order -1) dezelfde knots aan uiteinde verwijderen */
/* do first long rows (order -1), remove identical knots at endpoints */
if(order>2) {
b= pnts+order2;
for(a=1; a<order2; a++) {
@@ -672,7 +671,7 @@ void basisNurb(float t, short order, short pnts, float *knots, float *basis, int
if(t < knots[0]) t= knots[0];
else if(t > knots[opp2]) t= knots[opp2];
/* dit stuk is order '1' */
/* this part is order '1' */
o2 = order + 1;
for(i=0;i<opp2;i++) {
if(knots[i]!=knots[i+1] && t>= knots[i] && t<=knots[i+1]) {
@@ -691,9 +690,7 @@ void basisNurb(float t, short order, short pnts, float *knots, float *basis, int
}
basis[i]= 0.0;
/* printf("u %f\n", t); for(k=0;k<orderpluspnts;k++) printf(" %2.2f",basis[k]); printf("\n"); */
/* dit is order 2,3,... */
/* this is order 2,3,... */
for(j=2; j<=order; j++) {
if(i2+j>= orderpluspnts) i2= opp2-j;
@@ -726,7 +723,7 @@ void basisNurb(float t, short order, short pnts, float *knots, float *basis, int
void makeNurbfaces(Nurb *nu, float *data)
/* data moet 3*4*resolu*resolv lang zijn en op nul staan */
/* data has to be 3*4*resolu*resolv in size, and zero-ed */
{
BPoint *bp;
float *basisu, *basis, *basisv, *sum, *fp, *in;
@@ -739,7 +736,7 @@ void makeNurbfaces(Nurb *nu, float *data)
if(nu->orderv>nu->pntsv) return;
if(data==0) return;
/* alloceren en vars goedzetten */
/* allocate and initialize */
len= nu->pntsu*nu->pntsv;
if(len==0) return;
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbfaces1");
@@ -781,7 +778,7 @@ void makeNurbfaces(Nurb *nu, float *data)
jstart= (int *)MEM_mallocN(sizeof(float)*resolv, "makeNurbfaces4");
jend= (int *)MEM_mallocN(sizeof(float)*resolv, "makeNurbfaces5");
/* voorberekenen basisv en jstart,jend */
/* precalculation of basisv and jstart,jend */
if(nu->flagv & 1) cycl= nu->orderv-1;
else cycl= 0;
v= vstart;
@@ -807,7 +804,7 @@ void makeNurbfaces(Nurb *nu, float *data)
jsta= jstart[resolv];
jen= jend[resolv];
/* bereken sum */
/* calculate sum */
sumdiv= 0.0;
fp= sum;
@@ -842,7 +839,7 @@ void makeNurbfaces(Nurb *nu, float *data)
}
}
/* een! (1.0) echt punt nu */
/* one! (1.0) real point now */
fp= sum;
for(j= jsta; j<=jen; j++) {
@@ -872,7 +869,7 @@ void makeNurbfaces(Nurb *nu, float *data)
u+= ustep;
}
/* vrijgeven */
/* free */
MEM_freeN(sum);
MEM_freeN(basisu);
MEM_freeN(basisv);
@@ -882,7 +879,7 @@ void makeNurbfaces(Nurb *nu, float *data)
void makeNurbcurve_forw(Nurb *nu, float *data)
/* *data: moet 3*4*pntsu*resolu lang zijn en op nul staan */
/* *data: has to be 3*4*pntsu*resolu in size and zero-ed */
{
BPoint *bp;
float *basisu, *sum, *fp, *in;
@@ -893,7 +890,7 @@ void makeNurbcurve_forw(Nurb *nu, float *data)
if(nu->knotsu==0) return;
if(data==0) return;
/* alloceren en vars goedzetten */
/* allocate and init */
len= nu->pntsu;
if(len==0) return;
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
@@ -915,29 +912,29 @@ void makeNurbcurve_forw(Nurb *nu, float *data)
for (k = nu->orderu - 1; k < nu->pntsu; k++){
wanted = (int)((nu->knotsu[k+1] - nu->knotsu[k]) / ustep);
org = 4; /* gelijk aan order */
org = 4; /* equal to order */
if (org > wanted) org = wanted;
for (j = org; j > 0; j--){
basisNurb(u, nu->orderu, nu->pntsu, nu->knotsu, basisu, &istart, &iend);
/* bereken sum */
/* calc sum */
sumdiv= 0.0;
fp= sum;
for(i= istart; i<=iend; i++, fp++) {
/* hier nog rationele component doen */
/* do the rational component */
*fp= basisu[i];
sumdiv+= *fp;
}
if(sumdiv!=0.0) if(sumdiv<0.999 || sumdiv>1.001) {
/* is dit normaliseren ook nodig? */
/* is this normalizing needed? */
fp= sum;
for(i= istart; i<=iend; i++, fp++) {
*fp/= sumdiv;
}
}
/* een! (1.0) echt punt nu */
/* one! (1.0) real point */
fp= sum;
bp= nu->bp+ istart;
for(i= istart; i<=iend; i++, bp++, fp++) {
@@ -961,14 +958,14 @@ void makeNurbcurve_forw(Nurb *nu, float *data)
}
}
/* vrijgeven */
/* free */
MEM_freeN(sum);
MEM_freeN(basisu);
}
void makeNurbcurve(Nurb *nu, float *data, int dim)
/* data moet dim*4*pntsu*resolu lang zijn en op nul staan */
/* data has to be dim*4*pntsu*resolu in size and zero-ed */
{
BPoint *bp;
float u, ustart, uend, ustep, sumdiv;
@@ -979,7 +976,7 @@ void makeNurbcurve(Nurb *nu, float *data, int dim)
if(nu->orderu>nu->pntsu) return;
if(data==0) return;
/* alloceren en vars goedzetten */
/* allocate and initialize */
len= nu->pntsu;
if(len==0) return;
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
@@ -1005,7 +1002,7 @@ void makeNurbcurve(Nurb *nu, float *data, int dim)
while(resolu--) {
basisNurb(u, nu->orderu, (short)(nu->pntsu+cycl), nu->knotsu, basisu, &istart, &iend);
/* bereken sum */
/* calc sum */
sumdiv= 0.0;
fp= sum;
bp= nu->bp+ istart-1;
@@ -1018,14 +1015,14 @@ void makeNurbcurve(Nurb *nu, float *data, int dim)
sumdiv+= *fp;
}
if(sumdiv!=0.0) if(sumdiv<0.999 || sumdiv>1.001) {
/* is dit normaliseren ook nodig? */
/* is normalizing needed? */
fp= sum;
for(i= istart; i<=iend; i++, fp++) {
*fp/= sumdiv;
}
}
/* een! (1.0) echt punt nu */
/* one! (1.0) real point */
fp= sum;
bp= nu->bp+ istart-1;
for(i= istart; i<=iend; i++, fp++) {
@@ -1049,7 +1046,7 @@ void makeNurbcurve(Nurb *nu, float *data, int dim)
u+= ustep;
}
/* vrijgeven */
/* free */
MEM_freeN(sum);
MEM_freeN(basisu);
}
@@ -1091,7 +1088,7 @@ void make_orco_surf(Curve *cu)
float *data;
/* eerst voorspellen hoelang datablok moet worden */
/* first calculate the size of the datablock */
nu= cu->nurb.first;
while(nu) {
#ifdef STRUBI
@@ -1114,7 +1111,7 @@ See also blenderWorldManipulation.c: init_render_surf()
#endif
nu= nu->next;
}
/* makeNurbfaces wil nullen */
/* makeNurbfaces wants zeros */
data= cu->orco= MEM_callocN(3*sizeof(float)*tot, "make_orco");
nu= cu->nurb.first;
@@ -1259,7 +1256,7 @@ void makebevelcurve(Object *ob, ListBase *disp)
dl->parts= 1;
dl->nr= nr;
/* eerst cirkel maken */
/* first make circle */
fp= dl->verts;
hoek= -0.5*M_PI;
dhoek= (float)(M_PI/(nr-2));
@@ -1324,13 +1321,13 @@ int cu_isectLL(float *v1, float *v2, float *v3, float *v4, short cox, short coy,
short bevelinside(BevList *bl1,BevList *bl2)
{
/* is bl2 INSIDE bl1 ? met links-rechts methode en "labda's" */
/* geeft als correct gat 1 terug */
/* is bl2 INSIDE bl1 ? with left-right method and "labda's" */
/* returns '1' if correct hole */
BevPoint *bevp, *prevbevp;
float min,max,vec[3],hvec1[3],hvec2[3],lab,mu;
int nr, links=0,rechts=0,mode;
/* neem eerste vertex van het mogelijke gat */
/* take first vertex of possible hole */
bevp= (BevPoint *)(bl2+1);
hvec1[0]= bevp->x;
@@ -1339,8 +1336,8 @@ short bevelinside(BevList *bl1,BevList *bl2)
VECCOPY(hvec2,hvec1);
hvec2[0]+=1000;
/* test deze met alle edges van mogelijk omringende poly */
/* tel aantal overgangen links en rechts */
/* test it with all edges of potential surounding poly */
/* count number of transitions left-right */
bevp= (BevPoint *)(bl1+1);
nr= bl1->nr;
@@ -1355,10 +1352,10 @@ short bevelinside(BevList *bl1,BevList *bl2)
}
if(min!=max) {
if(min<=hvec1[1] && max>=hvec1[1]) {
/* er is een overgang, snijpunt berekenen */
/* there's a transition, calc intersection point */
mode= cu_isectLL(&(prevbevp->x),&(bevp->x),hvec1,hvec2,0,1,&lab,&mu,vec);
/* als lab==0.0 of lab==1.0 dan snijdt de edge exact de overgang
* alleen toestaan voor lab= 1.0 (of andersom, maakt niet uit)
/* if lab==0.0 or lab==1.0 then the edge intersects exactly a transition
only allow for one situation: we choose lab= 1.0
*/
if(mode>=0 && lab!=0.0) {
if(vec[0]<hvec1[0]) links++;
@@ -1390,7 +1387,7 @@ int vergxcobev(const void *a1, const void *a2)
return 0;
}
/* deze kan niet zomaar door atan2 vervangen worden, maar waarom? */
/* this function cannot be replaced with atan2, but why? */
void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *sina, float *cosa)
{
@@ -1416,7 +1413,6 @@ void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *sina, flo
x3= x1-x2;
y3= y1-y2;
if(x3==0 && y3==0) {
/* printf("x3 en y3 nul \n"); */
x3= y1;
y3= -x1;
} else {
@@ -1438,14 +1434,14 @@ void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *data_a)
last= nu->bezt+(nu->pntsu-1);
/* een punt terug */
/* returns a point */
if(prevbezt==nu->bezt) {
if(nu->flagu & 1) pprev= last;
else pprev= prevbezt;
}
else pprev= prevbezt-1;
/* een punt verder */
/* next point */
if(bezt==last) {
if(nu->flagu & 1) next= nu->bezt;
else next= bezt;
@@ -1465,10 +1461,12 @@ void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *data_a)
void makeBevelList(Object *ob)
{
/* - alle curves omzetten in poly's, met aangegeven resol en vlaggen voor dubbele punten
- eventueel intelligent punten verwijderen (geval Nurb)
- scheiden in verschillende blokken met Boundbox
- Autogat detectie */
/*
- convert all curves to polys, with indication of resol and flags for double-vertices
- possibly; do a smart vertice removal (in case Nurb)
- separate in individual blicks with BoundBox
- AutoHole detection
*/
Curve *cu;
Nurb *nu;
BezTriple *bezt, *prevbezt;
@@ -1479,10 +1477,10 @@ void makeBevelList(Object *ob)
struct bevelsort *sortdata, *sd, *sd1;
int a, b, len, nr, poly;
/* deze fie moet object hebben in verband met tflag en upflag */
/* this function needs an object, because of tflag and upflag */
cu= ob->data;
/* STAP 1: POLY'S MAKEN */
/* STEP 1: MAKE POLYS */
BLI_freelistN(&(cu->bev));
if(ob==G.obedit) nu= editNurb.first;
@@ -1516,7 +1514,7 @@ void makeBevelList(Object *ob)
}
else if((nu->type & 7)==CU_BEZIER) {
len= nu->resolu*(nu->pntsu+ (nu->flagu & 1) -1)+1; /* voor laatste punt niet cyclic */
len= nu->resolu*(nu->pntsu+ (nu->flagu & 1) -1)+1; /* in case last point is not cyclic */
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList");
BLI_addtail(&(cu->bev), bl);
@@ -1555,7 +1553,7 @@ void makeBevelList(Object *ob)
v1= prevbezt->vec[1];
v2= bezt->vec[0];
/* altijd alle drie doen: anders blijft data hangen */
/* always do all three, to prevent data hanging around */
maakbez(v1[0], v1[3], v2[0], v2[3], data, nu->resolu);
maakbez(v1[1], v1[4], v2[1], v2[4], data+1, nu->resolu);
maakbez(v1[2], v1[5], v2[2], v2[5], data+2, nu->resolu);
@@ -1567,7 +1565,7 @@ void makeBevelList(Object *ob)
}
/* met handlecodes dubbele punten aangeven */
/* indicate with handlecodes double points */
if(prevbezt->h1==prevbezt->h2) {
if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= 1;
}
@@ -1599,7 +1597,7 @@ void makeBevelList(Object *ob)
MEM_freeN(data);
MEM_freeN(data_a);
if((nu->flagu & 1)==0) { /* niet cyclic: endpoint */
if((nu->flagu & 1)==0) { /* not cyclic: endpoint */
bevp->x= prevbezt->vec[1][0];
bevp->y= prevbezt->vec[1][1];
bevp->z= prevbezt->vec[1][2];
@@ -1618,7 +1616,7 @@ void makeBevelList(Object *ob)
else bl->poly= -1;
bevp= (BevPoint *)(bl+1);
data= MEM_callocN(4*sizeof(float)*len, "makeBevelList4"); /* moet op nul staan */
data= MEM_callocN(4*sizeof(float)*len, "makeBevelList4"); /* has to be zero-ed */
makeNurbcurve(nu, data, 4);
v1= data;
@@ -1639,7 +1637,7 @@ void makeBevelList(Object *ob)
nu= nu->next;
}
/* STAP 2: DUBBELE PUNTEN EN AUTOMATISCHE RESOLUTIE, DATABLOKKEN VERKLEINEN */
/* STEP 2: DOUBLE POINTS AND AUTOMATIC RESOLUTION, REDUCE DATABLOCKS */
bl= cu->bev.first;
while(bl) {
nr= bl->nr;
@@ -1664,12 +1662,12 @@ void makeBevelList(Object *ob)
while(bl) {
blnext= bl->next;
if(bl->flag) {
nr= bl->nr- bl->flag+1; /* +1 want vectorbezier zet ook flag */
nr= bl->nr- bl->flag+1; /* +1 because vectorbezier sets flag too */
blnew= MEM_mallocN(sizeof(BevList)+nr*sizeof(BevPoint), "makeBevelList");
memcpy(blnew, bl, sizeof(BevList));
blnew->nr= 0;
BLI_remlink(&(cu->bev), bl);
BLI_insertlinkbefore(&(cu->bev),blnext,blnew); /* zodat bevlijst met nurblijst gelijk loopt */
BLI_insertlinkbefore(&(cu->bev),blnext,blnew); /* to make sure bevlijst is tuned with nurblist */
bevp0= (BevPoint *)(bl+1);
bevp1= (BevPoint *)(blnew+1);
nr= bl->nr;
@@ -1687,20 +1685,20 @@ void makeBevelList(Object *ob)
bl= blnext;
}
/* STAP 3: POLY'S TELLEN EN AUTOGAT */
/* STEP 3: COUNT POLYS TELLEN AND AUTOHOLE */
bl= cu->bev.first;
poly= 0;
while(bl) {
if(bl->poly>=0) {
poly++;
bl->poly= poly;
bl->gat= 0;
bl->gat= 0; /* 'gat' is dutch for hole */
}
bl= bl->next;
}
/* meest linkse punten vinden, tevens richting testen */
/* find extreme left points, also test (turning) direction */
if(poly>0) {
sd= sortdata= MEM_mallocN(sizeof(struct bevelsort)*poly, "makeBevelList5");
bl= cu->bev.first;
@@ -1742,9 +1740,9 @@ void makeBevelList(Object *ob)
sd= sortdata+1;
for(a=1; a<poly; a++, sd++) {
bl= sd->bl; /* is bl een gat? */
bl= sd->bl; /* is bl a hole? */
sd1= sortdata+ (a-1);
for(b=a-1; b>=0; b--, sd1--) { /* alle polys links ervan */
for(b=a-1; b>=0; b--, sd1--) { /* all polys to the left */
if(bevelinside(sd1->bl, bl)) {
bl->gat= 1- sd1->bl->gat;
break;
@@ -1752,7 +1750,7 @@ void makeBevelList(Object *ob)
}
}
/* draairichting */
/* turning direction */
if((cu->flag & CU_3D)==0) {
sd= sortdata;
for(a=0; a<poly; a++, sd++) {
@@ -1772,11 +1770,11 @@ void makeBevelList(Object *ob)
MEM_freeN(sortdata);
}
/* STAP 4: COSINUSSEN */
/* STEP 4: COSINES */
bl= cu->bev.first;
while(bl) {
if(bl->nr==2) { /* 2 pnt, apart afhandelen: KAN DAT NIET AFGESCHAFT? */
if(bl->nr==2) { /* 2 pnt, treat separate */
bevp2= (BevPoint *)(bl+1);
bevp1= bevp2+1;
@@ -1852,7 +1850,7 @@ void makeBevelList(Object *ob)
bevp1= bevp2;
bevp2++;
}
/* niet cyclic gevallen corrigeren */
/* correct non-cyclic cases */
if(bl->poly== -1) {
if(bl->nr>2) {
bevp= (BevPoint *)(bl+1);
@@ -1877,7 +1875,7 @@ void makeBevelList(Object *ob)
/*
* handlecodes:
* 1: niets, 1:auto, 2:vector, 3:aligned
* 1: nothing, 1:auto, 2:vector, 3:aligned
*/
@@ -1981,7 +1979,7 @@ void calchandleNurb(BezTriple *bezt,BezTriple *prev, BezTriple *next, int mode)
len1= VecLenf(p2, p2-3);
if(len1==0.0) len1=1.0;
if(len2==0.0) len2=1.0;
if(bezt->f1 & 1) { /* volgorde van berekenen */
if(bezt->f1 & 1) { /* order of calculation */
if(bezt->h2==HD_ALIGN) { /* aligned */
len= len2/len1;
p2[3]= p2[0]+len*(p2[0]-p2[-3]);
@@ -2011,7 +2009,7 @@ void calchandleNurb(BezTriple *bezt,BezTriple *prev, BezTriple *next, int mode)
}
}
void calchandlesNurb(Nurb *nu) /* wel eerst (zonodig) de handlevlaggen zetten */
void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
{
BezTriple *bezt, *prev, *next;
short a;
@@ -2041,13 +2039,13 @@ void calchandlesNurb(Nurb *nu) /* wel eerst (zonodig) de handlevlaggen zetten */
void testhandlesNurb(Nurb *nu)
{
/* Te gebruiken als er iets an de handles is veranderd.
* Loopt alle BezTriples af met de volgende regels:
* FASE 1: types veranderen?
* Autocalchandles: worden ligned als NOT(000 || 111)
* Vectorhandles worden 'niets' als (selected en andere niet)
* FASE 2: handles herbereken
*/
/* use when something has changed with handles.
it treats all BezTriples with the following rules:
PHASE 1: do types have to be altered?
Auto handles: become aligned when selection status is NOT(000 || 111)
Vector handles: become 'nothing' when (one half selected AND other not)
PHASE 2: recalculate handles
*/
BezTriple *bezt;
short flag, a;
@@ -2084,7 +2082,7 @@ void testhandlesNurb(Nurb *nu)
void autocalchandlesNurb(Nurb *nu, int flag)
{
/* Kijkt naar de coordinaten van de handles en berekent de soort */
/* checks handle coordinates and calculates type */
BezTriple *bezt2, *bezt1, *bezt0;
int i, align, leftsmall, rightsmall;
@@ -2100,10 +2098,10 @@ void autocalchandlesNurb(Nurb *nu, int flag)
align= leftsmall= rightsmall= 0;
/* linker handle: */
/* left handle: */
if(flag==0 || (bezt1->f1 & flag) ) {
bezt1->h1= 0;
/* afstand te klein: vectorhandle */
/* distance too short: vectorhandle */
if( VecLenf( bezt1->vec[1], bezt0->vec[1] ) < 0.0001) {
bezt1->h1= HD_VECT;
leftsmall= 1;
@@ -2114,16 +2112,16 @@ void autocalchandlesNurb(Nurb *nu, int flag)
align= 1;
bezt1->h1= HD_ALIGN;
}
/* of toch vector handle? */
/* or vector handle? */
if(DistVL2Dfl(bezt1->vec[0], bezt1->vec[1], bezt0->vec[1]) < 0.0001)
bezt1->h1= HD_VECT;
}
}
/* rechter handle: */
/* right handle: */
if(flag==0 || (bezt1->f3 & flag) ) {
bezt1->h2= 0;
/* afstand te klein: vectorhandle */
/* distance too short: vectorhandle */
if( VecLenf( bezt1->vec[1], bezt2->vec[1] ) < 0.0001) {
bezt1->h2= HD_VECT;
rightsmall= 1;
@@ -2132,7 +2130,7 @@ void autocalchandlesNurb(Nurb *nu, int flag)
/* aligned handle? */
if(align) bezt1->h2= HD_ALIGN;
/* of toch vector handle? */
/* or vector handle? */
if(DistVL2Dfl(bezt1->vec[2], bezt1->vec[1], bezt2->vec[1]) < 0.0001)
bezt1->h2= HD_VECT;
@@ -2141,7 +2139,7 @@ void autocalchandlesNurb(Nurb *nu, int flag)
if(leftsmall && bezt1->h2==HD_ALIGN) bezt1->h2= 0;
if(rightsmall && bezt1->h1==HD_ALIGN) bezt1->h1= 0;
/* onzalige combinatie: */
/* undesired combination: */
if(bezt1->h1==HD_ALIGN && bezt1->h2==HD_VECT) bezt1->h1= 0;
if(bezt1->h2==HD_ALIGN && bezt1->h1==HD_VECT) bezt1->h2= 0;
@@ -2168,7 +2166,7 @@ void sethandlesNurb(short code)
{
/* code==1: set autohandle */
/* code==2: set vectorhandle */
/* als code==3 (HD_ALIGN) toggelt het, vectorhandles worden HD_FREE */
/* if code==3 (HD_ALIGN) it toggle, vectorhandles become HD_FREE */
Nurb *nu;
BezTriple *bezt;
short a, ok=0;
@@ -2196,7 +2194,7 @@ void sethandlesNurb(short code)
}
}
else {
/* is er 1 handle NIET vrij: alles vrijmaken, else ALIGNED maken */
/* there is 1 handle not FREE: FREE it all, else make ALIGNED */
nu= editNurb.first;
while(nu) {
@@ -2269,7 +2267,7 @@ void switchdirectionNurb(Nurb *nu)
a= nu->pntsu;
bezt1= nu->bezt;
bezt2= bezt1+(a-1);
if(a & 1) a+= 1; /* bij oneven ook van middelste inhoud swappen */
if(a & 1) a+= 1; /* if odd, also swap middle content */
a/= 2;
while(a>0) {
if(bezt1!=bezt2) SWAP(BezTriple, *bezt1, *bezt2);
@@ -2305,7 +2303,7 @@ void switchdirectionNurb(Nurb *nu)
bp2--;
}
if((nu->type & 7)==CU_NURBS) {
/* de knots omkeren */
/* inverse knots */
a= KNOTSU(nu);
fp1= nu->knotsu;
fp2= fp1+(a-1);
@@ -2316,7 +2314,7 @@ void switchdirectionNurb(Nurb *nu)
fp1++;
fp2--;
}
/* en weer in stijgende lijn maken */
/* and make in increasing order again */
a= KNOTSU(nu);
fp1= nu->knotsu;
fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect");

View File

@@ -1,9 +1,7 @@
/* displist.c GRAPHICS
/* displist.c
*
*
* maart 95
*
* $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
@@ -235,7 +233,7 @@ static void initfastshade(void)
if(G.scene->camera==0) G.scene->camera= scene_find_camera(G.scene);
if(G.scene->camera==0) return;
/* uit roteerscene gejat */
/* copied from 'roteerscene' (does that function still exist? (ton) */
where_is_object(G.scene->camera);
Mat4CpyMat4(R.viewinv, G.scene->camera->obmat);
Mat4Ortho(R.viewinv);
@@ -436,7 +434,7 @@ static void fastshade(float *co, float *nor, float *orco, Material *ma, char *co
i= 1.0;
soft= 1.0;
if(t<fl->spotbl && fl->spotbl!=0.0) {
/* zachte gebied */
/* soft area */
i= t/fl->spotbl;
t= i*i;
soft= (3.0*t-2.0*t*i);
@@ -663,11 +661,11 @@ void shadeDispList(Object *ob)
Mat4Invert(tmat, mat);
Mat3CpyMat4(imat, tmat);
/* we halen de dl_verts eruit, deform info */
/* we extract dl_verts, deform info */
dldeform= find_displist(&ob->disp, DL_VERTS);
if(dldeform) BLI_remlink(&ob->disp, dldeform);
/* Metaballs hebben de standaard displist aan het Object zitten */
/* Metaballs have the standard displist in the Object */
if(ob->type!=OB_MBALL) freedisplist(&ob->disp);
if((R.flag & R_RENDERING)==0) {
@@ -783,7 +781,7 @@ void shadeDispList(Object *ob)
col2= dl->col2= MEM_mallocN(4*sizeof(int)*me->totface, "col2");
}
/* even geen puno's */
/* no vertexnormals now */
mvert= me->mvert;
a= me->totvert;
while(FALSE || a--) {
@@ -887,7 +885,7 @@ void shadeDispList(Object *ob)
}
else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
/* nu hebben we wel de normalen nodig */
/* now we need the normals */
cu= ob->data;
dl= cu->disp.first;
@@ -911,7 +909,7 @@ void shadeDispList(Object *ob)
if(dl->type==DL_INDEX3) {
if(dl->nors) {
/* er is maar 1 normaal */
/* there's just one normal */
n1[0]= imat[0][0]*dl->nors[0]+imat[0][1]*dl->nors[1]+imat[0][2]*dl->nors[2];
n1[1]= imat[1][0]*dl->nors[0]+imat[1][1]*dl->nors[1]+imat[1][2]*dl->nors[2];
n1[2]= imat[2][0]*dl->nors[0]+imat[2][1]*dl->nors[1]+imat[2][2]*dl->nors[2];
@@ -955,7 +953,7 @@ void shadeDispList(Object *ob)
}
}
else if(ob->type==OB_MBALL) {
/* normalen zijn er al */
/* there are normals already */
dl= ob->disp.first;
while(dl) {
@@ -1000,7 +998,7 @@ void shadeDispList(Object *ob)
}
}
/* deze was er tijdelijk uitgehaald */
/* this one was temporally removed */
if(dldeform) BLI_addtail(&ob->disp, dldeform);
}
@@ -1018,11 +1016,11 @@ void reshadeall_displist(void)
ob= base->object;
/* we halen de dl_verts eruit, deform info */
/* we extract dl_verts, deform info */
dldeform= find_displist(&ob->disp, DL_VERTS);
if(dldeform) BLI_remlink(&ob->disp, dldeform);
/* Metaballs hebben de standaard displist aan het Object zitten */
/* Metaballs have standard displist at the Object */
if(ob->type==OB_MBALL) shadeDispList(ob);
else freedisplist(&ob->disp);
@@ -1073,7 +1071,7 @@ static void curve_to_displist(ListBase *nubase, ListBase *dispbase)
if(nu->hide==0) {
if((nu->type & 7)==CU_BEZIER) {
/* tellen */
/* count */
len= 0;
a= nu->pntsu-1;
if(nu->flagu & 1) a++;
@@ -1093,7 +1091,7 @@ static void curve_to_displist(ListBase *nubase, ListBase *dispbase)
}
dl= MEM_callocN(sizeof(DispList), "makeDispListbez");
/* len+1 i.v.m. maakbez */
/* len+1 because of 'maakbez' function */
dl->verts= MEM_callocN( (len+1)*3*sizeof(float), "dlverts");
BLI_addtail(dispbase, dl);
dl->parts= 1;
@@ -1210,7 +1208,7 @@ static void filldisplist(ListBase *dispbase, ListBase *to)
colnr= dl->col;
/* editverts en edges maken */
/* make editverts and edges */
f1= dl->verts;
a= dl->nr;
eve= v1= 0;
@@ -1245,7 +1243,7 @@ static void filldisplist(ListBase *dispbase, ListBase *to)
if(totvert && BLI_edgefill(0)!=0) {
/* vlakken tellen */
/* count faces (vlak in dutch!) */
tot= 0;
evl= fillvlakbase.first;
while(evl) {
@@ -1263,7 +1261,7 @@ static void filldisplist(ListBase *dispbase, ListBase *to)
dlnew->index= MEM_mallocN(tot*3*sizeof(int), "dlindex");
dlnew->verts= MEM_mallocN(totvert*3*sizeof(float), "dlverts");
/* vertdata */
/* vert data */
f1= dlnew->verts;
totvert= 0;
eve= fillvertbase.first;
@@ -1271,14 +1269,14 @@ static void filldisplist(ListBase *dispbase, ListBase *to)
VECCOPY(f1, eve->co);
f1+= 3;
/* indexnummer */
/* index number */
eve->vn= (EditVert *)totvert;
totvert++;
eve= eve->next;
}
/* indexdata */
/* index data */
evl= fillvlakbase.first;
index= dlnew->index;
while(evl) {
@@ -1299,7 +1297,7 @@ static void filldisplist(ListBase *dispbase, ListBase *to)
colnr++;
}
/* poly's niet vrijgeven. nodig voor wireframe display */
/* do not free polys, needed for wireframe display */
/* same as above ... */
/* if(G.f & G_PLAYANIM == 0) waitcursor(0); */
@@ -1504,9 +1502,9 @@ void makeDispList(Object *ob)
if(nu->flagv & 1) dl->flag|= 2;
}
else {
dl->parts= nu->resolu; /* andersom want makeNurbfaces gaat zo */
dl->parts= nu->resolu; /* in reverse, because makeNurbfaces works that way */
dl->nr= nu->resolv;
if(nu->flagv & 1) dl->flag|= 1; /* ook andersom ! */
if(nu->flagv & 1) dl->flag|= 1; /* reverse too! */
if(nu->flagu & 1) dl->flag|= 2;
}
dl->col= nu->mat_nr;
@@ -1564,7 +1562,7 @@ void makeDispList(Object *ob)
if(ob->dt!=0) makebevelcurve(ob, &dlbev);
}
/* met bevellist werken */
/* work with bevellist */
widfac= cu->width-1.0;
bl= cu->bev.first;
nu= cu->nurb.first;
@@ -1591,7 +1589,7 @@ void makeDispList(Object *ob)
}
}
else {
/* voor iedere stuk van de bevel een aparte dispblok maken */
/* for each part of the bevel use a separate displblock */
dlb= dlbev.first;
while(dlb) {
dl= MEM_callocN(sizeof(DispList), "makeDispListbev1");
@@ -1611,9 +1609,9 @@ void makeDispList(Object *ob)
data= dl->verts;
bevp= (BevPoint *)(bl+1);
a= bl->nr;
while(a--) { /* voor ieder punt van poly een bevelstuk maken */
while(a--) { /* for each point of poly make a bevel piece */
/* roteer bevelstuk en schrijf in data */
/* rotate bevel piece and write in data */
fp1= dlb->verts;
b= dlb->nr;
@@ -1673,7 +1671,7 @@ typedef struct Sample{
} Sample;
typedef struct Segment{
/* coordinaten */
/* coordinates */
struct Segment * next, * prev;
float co[2];
} Segment;
@@ -1706,9 +1704,9 @@ static Sample * outline(struct ImBuf * ibuf,
int startx = 0, starty = 0;
Sample * samp, * oldsamp;
/* wat erin gaat:
* 1 - plaatje waarvan outline berekent moet worden,
* 2 - pointer naar functie die bepaalt welke pixel in of uit is
/* input:
* 1 - image
* 2 - pointer to function that defines which pixel 'in' or 'out' is
*/
if (ibuf == 0) return (0);
@@ -1717,11 +1715,11 @@ static Sample * outline(struct ImBuf * ibuf,
if (in_or_out == 0) in_or_out = dflt_in_out;
in = in_or_out(ibuf, 0, 0);
/* zoek naar eerste overgang en ga van daar uit 'zoeken' */
/* search for first transition, and continue from there */
for (y = 0; y < ibuf->y; y++) {
for (x = 0; x < ibuf->x; x++) {
if (in_or_out(ibuf, x, y) != in) {
/* eerste 'andere' punt gevonden !! */
/* found first 'other' point !! */
if (x != startx) dir = 0;
else dir = 6;
@@ -1750,7 +1748,7 @@ static Sample * outline(struct ImBuf * ibuf,
}
if (i >= 8) {
/* dit moet een losse punt geweest zijn */
/* this has to be a loose point */
break;
}
@@ -1760,7 +1758,7 @@ static Sample * outline(struct ImBuf * ibuf,
} while(x != startx || y != starty);
if (i >= 8) {
/* losse punten patch */
/* patch for loose points */
MEM_freeN(samp);
} else {
count = count - 1;
@@ -1771,7 +1769,7 @@ static Sample * outline(struct ImBuf * ibuf,
}
}
}
/* printf("geen overgang \n"); */
/* printf("no transition \n"); */
return(0);
}
@@ -1782,7 +1780,7 @@ static Sample * outline(struct ImBuf * ibuf,
/*******************************/
static float DistToLine2D(short *v1, short *v2, short *v3) /* met formule van Hesse :GEEN LIJNSTUK! */
static float DistToLine2D(short *v1, short *v2, short *v3) /* using Hesse formula :NO LINE PIECE! */
{
float a[2],deler;
@@ -1864,7 +1862,7 @@ static void ibuf2wire(ListBase * wireframe, struct ImBuf * ibuf)
int count;
Sample * samp;
/* eerst een lijst met samples maken */
/* first make a list of samples */
samp = outline(ibuf, 0);
if (samp == 0) return;
@@ -1908,7 +1906,7 @@ void imagestodisplist(void)
if(ma && ma->mtex[0] && ma->mtex[0]->tex) {
tex= ma->mtex[0]->tex;
/* dit zorgt voor correct laden van nieuwe imbufs */
/* this takes care of correct loading of new imbufs */
externtex(ma->mtex[0], vec);
if(tex->type==TEX_IMAGE && tex->ima && tex->ima->ibuf) {

View File

@@ -1,6 +1,5 @@
/* effect.c MIX MODEL
/* effect.c
*
* dec 95
*
* $Id$
*
@@ -166,7 +165,7 @@ Effect *copy_effect(Effect *eff)
void copy_act_effect(Object *ob)
{
/* return de aktieve eff gekopieerd */
/* return a copy of the active effect */
Effect *effn, *eff;
eff= ob->effect.first;
@@ -183,7 +182,7 @@ void copy_act_effect(Object *ob)
eff= eff->next;
}
/* als tie hier komt: new effect */
/* when it comes here: add new effect */
eff= add_effect(EFF_BUILD);
BLI_addtail(&ob->effect, eff);
@@ -244,7 +243,7 @@ Particle *new_particle(PartEff *paf)
static Particle *pa;
static int cur;
/* afspraak: als paf->keys==0: alloc */
/* we agree: when paf->keys==0: alloc */
if(paf->keys==0) {
pa= paf->keys= MEM_callocN( paf->totkey*paf->totpart*sizeof(Particle), "particlekeys" );
cur= 0;
@@ -279,7 +278,7 @@ void where_is_particle(PartEff *paf, Particle *pa, float ctime, float *vec)
return;
}
/* eerst op zoek naar de eerste particlekey */
/* first find the first particlekey */
a= (int)((paf->totkey-1)*(ctime-pa->time)/pa->lifetime);
if(a>=paf->totkey) a= paf->totkey-1;
@@ -351,14 +350,14 @@ void make_particle_keys(int depth, int nr, PartEff *paf, Particle *part, float *
damp= 1.0f-paf->damp;
pa= part;
/* startsnelheid: random */
/* start speed: random */
if(paf->randfac!=0.0) {
pa->no[0]+= (float)(paf->randfac*( BLI_drand() -0.5));
pa->no[1]+= (float)(paf->randfac*( BLI_drand() -0.5));
pa->no[2]+= (float)(paf->randfac*( BLI_drand() -0.5));
}
/* startsnelheid: texture */
/* start speed: texture */
if(mtex && paf->texfac!=0.0) {
particle_tex(mtex, paf, pa->co, pa->no);
}
@@ -371,20 +370,20 @@ void make_particle_keys(int depth, int nr, PartEff *paf, Particle *part, float *
b= paf->totkey-1;
while(b--) {
/* nieuwe tijd */
/* new time */
pa->time= opa->time+deltalife;
/* nieuwe plek */
/* new location */
pa->co[0]= opa->co[0] + deltalife*opa->no[0];
pa->co[1]= opa->co[1] + deltalife*opa->no[1];
pa->co[2]= opa->co[2] + deltalife*opa->no[2];
/* nieuwe snelheid */
/* new speed */
pa->no[0]= opa->no[0] + deltalife*force[0];
pa->no[1]= opa->no[1] + deltalife*force[1];
pa->no[2]= opa->no[2] + deltalife*force[2];
/* snelheid: texture */
/* speed: texture */
if(mtex && paf->texfac!=0.0) {
particle_tex(mtex, paf, pa->co, pa->no);
}
@@ -396,11 +395,11 @@ void make_particle_keys(int depth, int nr, PartEff *paf, Particle *part, float *
opa= pa;
pa++;
/* opa wordt onderin ook gebruikt */
/* opa is used later on too! */
}
if(deform) {
/* alle keys deformen */
/* deform all keys */
pa= part;
b= paf->totkey;
while(b--) {
@@ -583,7 +582,7 @@ void build_particle_system(Object *ob)
disable_speed_curve(1);
/* alle particles genereren */
/* generate all particles */
if(paf->keys) MEM_freeN(paf->keys);
paf->keys= 0;
new_particle(paf);
@@ -595,11 +594,11 @@ void build_particle_system(Object *ob)
sfraont= ob->sf;
ob->sf= 0.0;
/* mult generaties? */
/* mult generations? */
totpart= paf->totpart;
for(a=0; a<PAF_MAXMULT; a++) {
if(paf->mult[a]!=0.0) {
/* interessante formule! opdezewijze is na 'x' generaties het totale aantal paf->totpart */
/* interessant formula! this way after 'x' generations the total is paf->totpart */
totpart= (int)(totpart / (1.0+paf->mult[a]*paf->child[a]));
}
else break;
@@ -608,14 +607,14 @@ void build_particle_system(Object *ob)
ftime= paf->sta;
dtime= (paf->end - paf->sta)/totpart;
/* hele hiera onthouden */
/* remember full hierarchy */
par= ob;
while(par) {
pushdata(par, sizeof(Object));
par= par->parent;
}
/* alles op eerste frame zetten */
/* set it all at first frame */
G.scene->r.cfra= cfralast= (int)floor(ftime);
par= ob;
while(par) {
@@ -638,7 +637,7 @@ void build_particle_system(Object *ob)
BLI_srand(paf->seed);
/* gaat anders veuls te hard */
/* otherwise it goes way too fast */
force[0]= paf->force[0]*0.05f;
force[1]= paf->force[1]*0.05f;
force[2]= paf->force[2]*0.05f;
@@ -654,15 +653,15 @@ void build_particle_system(Object *ob)
pa= new_particle(paf);
pa->time= ftime;
/* ob op juiste tijd zetten */
/* set ob at correct time */
if((paf->flag & PAF_STATIC)==0) {
cur= (int)floor(ftime) + 1 ; /* + 1 heeft een reden: (obmat/prevobmat) anders beginnen b.v. komeetstaartjes te laat */
cur= (int)floor(ftime) + 1 ; /* + 1 has a reason: (obmat/prevobmat) otherwise comet-tails start too late */
if(cfralast != cur) {
G.scene->r.cfra= cfralast= cur;
/* later bijgevoegd: blur? */
/* added later: blur? */
bsystem_time(ob, ob->parent, (float)G.scene->r.cfra, 0.0);
par= ob;
@@ -679,7 +678,7 @@ void build_particle_system(Object *ob)
Mat3CpyMat4(imat, ob->imat);
}
}
/* coordinaat ophalen */
/* get coordinates */
if(paf->flag & PAF_FACE) give_mesh_mvert(me, a, co, no);
else {
mvert= me->mvert + (a % me->totvert);
@@ -696,18 +695,18 @@ void build_particle_system(Object *ob)
VECCOPY(vec, co);
Mat4MulVecfl(prevobmat, vec);
/* eerst even startsnelheid: object */
/* first start speed: object */
VecSubf(pa->no, pa->co, vec);
VecMulf(pa->no, paf->obfac);
/* nu juiste interframe co berekenen */
/* calculate the correct inter-frame */
fac= (ftime- (float)floor(ftime));
pa->co[0]= fac*pa->co[0] + (1.0f-fac)*vec[0];
pa->co[1]= fac*pa->co[1] + (1.0f-fac)*vec[1];
pa->co[2]= fac*pa->co[2] + (1.0f-fac)*vec[2];
}
/* startsnelheid: normaal */
/* start speed: normal */
if(paf->normfac!=0.0) {
/* sp= mvert->no; */
/* transpose ! */
@@ -736,16 +735,16 @@ void build_particle_system(Object *ob)
give_mesh_mvert(0, 0, 0, 0);
/* hele hiera terug */
/* put hierarchy back */
par= ob;
while(par) {
popfirst(par);
/* geen ob->ipo doen: insertkey behouden */
/* do not do ob->ipo: keep insertkey */
do_ob_key(par);
par= par->parent;
}
/* restore: NA popfirst */
/* restore: AFTER popfirst */
ob->sf= sfraont;
disable_speed_curve(0);
@@ -758,10 +757,10 @@ void build_particle_system(Object *ob)
void calc_wave_deform(WaveEff *wav, float ctime, float *co)
{
/* co is in lokale coords */
/* co is in local coords */
float lifefac, x, y, amplit;
/* mag eigenlijk niet voorkomen */
/* actually this should not happen */
if((wav->flag & (WAV_X+WAV_Y))==0) return;
lifefac= wav->height;
@@ -787,7 +786,7 @@ void calc_wave_deform(WaveEff *wav, float ctime, float *co)
}
else amplit= y;
/* zo maaktie mooie cirkels */
/* this way it makes nice circles */
amplit-= (ctime-wav->timeoffs)*wav->speed;
if(wav->flag & WAV_CYCL) {
@@ -814,7 +813,7 @@ void object_wave(Object *ob)
float *fp, ctime;
int a, first;
/* is er een mave */
/* is there a wave */
wav= ob->effect.first;
while(wav) {
if(wav->type==EFF_WAVE) break;
@@ -838,7 +837,7 @@ void object_wave(Object *ob)
while(wav) {
if(wav->type==EFF_WAVE) {
/* voorberekenen */
/* precalculate */
wav->minfac= (float)(1.0/exp(wav->width*wav->narrow*wav->width*wav->narrow));
if(wav->damp==0) wav->damp= 10.0f;