- first of a series of translated C comments. No dutchies get advantage anymore soon... :-)
This commit is contained in:
@@ -83,8 +83,8 @@ void calc_curvepath(Object *ob)
|
|||||||
int a, tot, cycl=0;
|
int a, tot, cycl=0;
|
||||||
float *ft;
|
float *ft;
|
||||||
|
|
||||||
/* in een pad zitten allemaal punten met gelijke afstand: path->len = aantal pt */
|
/* in a path vertices are with equal differences: path->len = number of verts */
|
||||||
/* NU MET BEVELCURVE!!! */
|
/* NOW WITH BEVELCURVE!!! */
|
||||||
|
|
||||||
if(ob==0 || ob->type != OB_CURVE) return;
|
if(ob==0 || ob->type != OB_CURVE) return;
|
||||||
cu= ob->data;
|
cu= ob->data;
|
||||||
@@ -105,7 +105,7 @@ void calc_curvepath(Object *ob)
|
|||||||
|
|
||||||
cu->path=path= MEM_callocN(sizeof(Path), "path");
|
cu->path=path= MEM_callocN(sizeof(Path), "path");
|
||||||
|
|
||||||
/* als POLY: laatste punt != eerste punt */
|
/* if POLY: last vertice != first vertice */
|
||||||
cycl= (bl->poly!= -1);
|
cycl= (bl->poly!= -1);
|
||||||
|
|
||||||
if(cycl) tot= bl->nr;
|
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?) */
|
/* 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;
|
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);
|
bevp= bevpfirst= (BevPoint *)(bl+1);
|
||||||
fp= dist;
|
fp= dist;
|
||||||
*fp= 0;
|
*fp= 0;
|
||||||
@@ -141,8 +141,8 @@ void calc_curvepath(Object *ob)
|
|||||||
|
|
||||||
path->totdist= *fp;
|
path->totdist= *fp;
|
||||||
|
|
||||||
/* de padpunten in path->data */
|
/* the path verts in path->data */
|
||||||
/* nu ook met TILT */
|
/* now also with TILT value */
|
||||||
ft= path->data = (float *)MEM_callocN(16*path->len, "pathdata");
|
ft= path->data = (float *)MEM_callocN(16*path->len, "pathdata");
|
||||||
|
|
||||||
bevp= bevpfirst;
|
bevp= bevpfirst;
|
||||||
@@ -157,7 +157,7 @@ void calc_curvepath(Object *ob)
|
|||||||
|
|
||||||
d= ((float)a)*fac;
|
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) {
|
while((d>= *fp) && fp<maxdist) {
|
||||||
fp++;
|
fp++;
|
||||||
if(bevp<bevplast) bevp++;
|
if(bevp<bevplast) bevp++;
|
||||||
@@ -201,7 +201,7 @@ int interval_test(int min, int max, int p1, int cycl)
|
|||||||
return p1;
|
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;
|
Curve *cu;
|
||||||
Nurb *nu;
|
Nurb *nu;
|
||||||
@@ -218,17 +218,17 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir) /* geeft OK t
|
|||||||
path= cu->path;
|
path= cu->path;
|
||||||
fp= path->data;
|
fp= path->data;
|
||||||
|
|
||||||
/* cyclic testen */
|
/* test for cyclic */
|
||||||
bl= cu->bev.first;
|
bl= cu->bev.first;
|
||||||
if(bl && bl->poly> -1) cycl= 1;
|
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);
|
ctime *= (path->len-1);
|
||||||
|
|
||||||
s1= (int)floor(ctime);
|
s1= (int)floor(ctime);
|
||||||
fac= (float)(s1+1)-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);
|
s0= interval_test(0, path->len-1-cycl, s1-1, cycl);
|
||||||
s1= interval_test(0, path->len-1-cycl, s1, cycl);
|
s1= interval_test(0, path->len-1-cycl, s1, cycl);
|
||||||
s2= interval_test(0, path->len-1-cycl, s1+1, 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[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] ;
|
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[0]= -dir[0];
|
||||||
dir[1]= -dir[1];
|
dir[1]= -dir[1];
|
||||||
dir[2]= -dir[2];
|
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;
|
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);
|
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((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);
|
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;
|
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) {
|
if(G.background==0 && ob->type==OB_MESH) {
|
||||||
Mesh *me= ob->data;
|
Mesh *me= ob->data;
|
||||||
DispList *dl;
|
DispList *dl;
|
||||||
@@ -305,7 +305,7 @@ void frames_duplilist(Object *ob)
|
|||||||
newob= MEM_mallocN(sizeof(Object), "newobobj dupli");
|
newob= MEM_mallocN(sizeof(Object), "newobobj dupli");
|
||||||
memcpy(newob, ob, sizeof(Object));
|
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;
|
if(newob->type==OB_MBALL) newob->disp.first= newob->disp.last= 0;
|
||||||
|
|
||||||
BLI_addtail(&duplilist, newob);
|
BLI_addtail(&duplilist, newob);
|
||||||
@@ -313,7 +313,7 @@ void frames_duplilist(Object *ob)
|
|||||||
where_is_object(newob);
|
where_is_object(newob);
|
||||||
|
|
||||||
newob->flag |= OB_FROMDUPLI;
|
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++) {
|
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);
|
VECCOPY(vec, mvert->co);
|
||||||
Mat4MulVecfl(pmat, vec);
|
Mat4MulVecfl(pmat, vec);
|
||||||
VecSubf(vec, vec, pmat[3]);
|
VecSubf(vec, vec, pmat[3]);
|
||||||
@@ -371,9 +371,9 @@ void vertex_duplilist(Scene *sce, Object *par)
|
|||||||
newob= MEM_mallocN(sizeof(Object), "newobj dupli");
|
newob= MEM_mallocN(sizeof(Object), "newobj dupli");
|
||||||
memcpy(newob, ob, sizeof(Object));
|
memcpy(newob, ob, sizeof(Object));
|
||||||
newob->flag |= OB_FROMDUPLI;
|
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;
|
if(newob->type==OB_MBALL) newob->disp.first= newob->disp.last= 0;
|
||||||
|
|
||||||
VECCOPY(newob->obmat[3], vec);
|
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");
|
newob= MEM_mallocN(sizeof(Object), "newobj dupli");
|
||||||
memcpy(newob, ob, sizeof(Object));
|
memcpy(newob, ob, sizeof(Object));
|
||||||
newob->flag |= OB_FROMDUPLI;
|
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;
|
if(newob->type==OB_MBALL) newob->disp.first= newob->disp.last= 0;
|
||||||
|
|
||||||
where_is_particle(paf, pa, ctime, vec);
|
where_is_particle(paf, pa, ctime, vec);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* blender.c jan 94 MIXED MODEL
|
/* blender.c jan 94 MIXED MODEL
|
||||||
*
|
*
|
||||||
* algemene hulp funkties en data
|
* common help functions and data
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -93,7 +93,7 @@ UserDef U;
|
|||||||
char versionstr[48]= "";
|
char versionstr[48]= "";
|
||||||
|
|
||||||
/* ************************************************ */
|
/* ************************************************ */
|
||||||
/* pushpop faciliteit: om tijdelijk data te bewaren */
|
/* pushpop facility: to store data temporally, FIFO! */
|
||||||
|
|
||||||
ListBase ppmain={0, 0};
|
ListBase ppmain={0, 0};
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ void pushpop_test()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ********** vrijgeven ********** */
|
/* ********** free ********** */
|
||||||
|
|
||||||
void free_blender(void)
|
void free_blender(void)
|
||||||
{
|
{
|
||||||
@@ -172,7 +172,7 @@ void free_blender(void)
|
|||||||
IMB_freeImBufdata(); /* imbuf lib */
|
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;
|
struct Link *link1, *link2;
|
||||||
|
|
||||||
@@ -217,10 +217,10 @@ static void clear_global(void) {
|
|||||||
|
|
||||||
freeAllRad();
|
freeAllRad();
|
||||||
free_main(G.main); /* free all lib data */
|
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;
|
R.backbuf= 0;
|
||||||
|
|
||||||
/* force all queues to be left */
|
/* force all queues to be left */
|
||||||
@@ -271,7 +271,7 @@ static void setup_app_data(BlendFileData *bfd, char *filename) {
|
|||||||
|
|
||||||
G.scene= G.curscreen->scene;
|
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)
|
// this should be removed!!! But first a better displist system (ton)
|
||||||
for (ob= G.main->object.first; ob; ob= ob->id.next) {
|
for (ob= G.main->object.first; ob; ob= ob->id.next) {
|
||||||
if(ob->type==OB_FONT) {
|
if(ob->type==OB_FONT) {
|
||||||
@@ -295,7 +295,7 @@ static void setup_app_data(BlendFileData *bfd, char *filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
strcpy(G.sce, 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);
|
MEM_freeN(bfd);
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
/* curve.c MIXED MODEL
|
/* curve.c
|
||||||
*
|
*
|
||||||
* maart 95
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -203,7 +202,7 @@ Curve *copy_curve(Curve *cu)
|
|||||||
cun->bev.first= cun->bev.last= 0;
|
cun->bev.first= cun->bev.last= 0;
|
||||||
cun->path= 0;
|
cun->path= 0;
|
||||||
|
|
||||||
/* ook single user ipo */
|
/* single user ipo too */
|
||||||
if(cun->ipo) cun->ipo= copy_ipo(cun->ipo);
|
if(cun->ipo) cun->ipo= copy_ipo(cun->ipo);
|
||||||
|
|
||||||
id_us_plus((ID *)cun->vfont);
|
id_us_plus((ID *)cun->vfont);
|
||||||
@@ -217,9 +216,9 @@ void make_local_curve(Curve *cu)
|
|||||||
Curve *cun;
|
Curve *cun;
|
||||||
int local=0, lib=0;
|
int local=0, lib=0;
|
||||||
|
|
||||||
/* - zijn er alleen lib users: niet doen
|
/* - when there are only lib users: don't do
|
||||||
* - zijn er alleen locale users: flag zetten
|
* - when there are only local users: set flag
|
||||||
* - mixed: copy
|
* - mixed: do a copy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(cu->id.lib==0) return;
|
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)
|
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--){
|
for (k = 3; k > 0; k--){
|
||||||
pnts = _pnts;
|
pnts = _pnts;
|
||||||
|
|
||||||
/* punten kopieren naar add */
|
/* copy points to 'add' */
|
||||||
for (i = 0; i < in; i++){
|
for (i = 0; i < in; i++){
|
||||||
add[i] = *pnts;
|
add[i] = *pnts;
|
||||||
pnts += 3;
|
pnts += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inverse forward differencen */
|
/* inverse forward differencing */
|
||||||
for (i = 0; i < in2; i++){
|
for (i = 0; i < in2; i++){
|
||||||
for (j = in2; j > i; j--){
|
for (j = in2; j > i; j--){
|
||||||
add[j] -= add[j - 1];
|
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)
|
void calcknots(float *knots, short aantal, short order, short type)
|
||||||
/* knots: aantal pnts NIET gecorrigeerd voor cyclic */
|
/* knots: number of pnts NOT corrected for cyclic */
|
||||||
/* aantal, order, type; 0: uniform, 1: endpoints, 2: bezier */
|
/* type; 0: uniform, 1: endpoints, 2: bezier */
|
||||||
{
|
{
|
||||||
float k;
|
float k;
|
||||||
int a, t;
|
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)
|
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;
|
int a, b, order2, c;
|
||||||
|
|
||||||
if(knots==0) return;
|
if(knots==0) return;
|
||||||
order2=order-1;
|
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) {
|
if(order>2) {
|
||||||
b= pnts+order2;
|
b= pnts+order2;
|
||||||
for(a=1; a<order2; a++) {
|
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];
|
if(t < knots[0]) t= knots[0];
|
||||||
else if(t > knots[opp2]) t= knots[opp2];
|
else if(t > knots[opp2]) t= knots[opp2];
|
||||||
|
|
||||||
/* dit stuk is order '1' */
|
/* this part is order '1' */
|
||||||
o2 = order + 1;
|
o2 = order + 1;
|
||||||
for(i=0;i<opp2;i++) {
|
for(i=0;i<opp2;i++) {
|
||||||
if(knots[i]!=knots[i+1] && t>= knots[i] && t<=knots[i+1]) {
|
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;
|
basis[i]= 0.0;
|
||||||
|
|
||||||
/* printf("u %f\n", t); for(k=0;k<orderpluspnts;k++) printf(" %2.2f",basis[k]); printf("\n"); */
|
/* this is order 2,3,... */
|
||||||
|
|
||||||
/* dit is order 2,3,... */
|
|
||||||
for(j=2; j<=order; j++) {
|
for(j=2; j<=order; j++) {
|
||||||
|
|
||||||
if(i2+j>= orderpluspnts) i2= opp2-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)
|
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;
|
BPoint *bp;
|
||||||
float *basisu, *basis, *basisv, *sum, *fp, *in;
|
float *basisu, *basis, *basisv, *sum, *fp, *in;
|
||||||
@@ -739,7 +736,7 @@ void makeNurbfaces(Nurb *nu, float *data)
|
|||||||
if(nu->orderv>nu->pntsv) return;
|
if(nu->orderv>nu->pntsv) return;
|
||||||
if(data==0) return;
|
if(data==0) return;
|
||||||
|
|
||||||
/* alloceren en vars goedzetten */
|
/* allocate and initialize */
|
||||||
len= nu->pntsu*nu->pntsv;
|
len= nu->pntsu*nu->pntsv;
|
||||||
if(len==0) return;
|
if(len==0) return;
|
||||||
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbfaces1");
|
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");
|
jstart= (int *)MEM_mallocN(sizeof(float)*resolv, "makeNurbfaces4");
|
||||||
jend= (int *)MEM_mallocN(sizeof(float)*resolv, "makeNurbfaces5");
|
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;
|
if(nu->flagv & 1) cycl= nu->orderv-1;
|
||||||
else cycl= 0;
|
else cycl= 0;
|
||||||
v= vstart;
|
v= vstart;
|
||||||
@@ -807,7 +804,7 @@ void makeNurbfaces(Nurb *nu, float *data)
|
|||||||
jsta= jstart[resolv];
|
jsta= jstart[resolv];
|
||||||
jen= jend[resolv];
|
jen= jend[resolv];
|
||||||
|
|
||||||
/* bereken sum */
|
/* calculate sum */
|
||||||
sumdiv= 0.0;
|
sumdiv= 0.0;
|
||||||
fp= sum;
|
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;
|
fp= sum;
|
||||||
for(j= jsta; j<=jen; j++) {
|
for(j= jsta; j<=jen; j++) {
|
||||||
|
|
||||||
@@ -872,7 +869,7 @@ void makeNurbfaces(Nurb *nu, float *data)
|
|||||||
u+= ustep;
|
u+= ustep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vrijgeven */
|
/* free */
|
||||||
MEM_freeN(sum);
|
MEM_freeN(sum);
|
||||||
MEM_freeN(basisu);
|
MEM_freeN(basisu);
|
||||||
MEM_freeN(basisv);
|
MEM_freeN(basisv);
|
||||||
@@ -882,7 +879,7 @@ void makeNurbfaces(Nurb *nu, float *data)
|
|||||||
|
|
||||||
|
|
||||||
void makeNurbcurve_forw(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;
|
BPoint *bp;
|
||||||
float *basisu, *sum, *fp, *in;
|
float *basisu, *sum, *fp, *in;
|
||||||
@@ -893,7 +890,7 @@ void makeNurbcurve_forw(Nurb *nu, float *data)
|
|||||||
if(nu->knotsu==0) return;
|
if(nu->knotsu==0) return;
|
||||||
if(data==0) return;
|
if(data==0) return;
|
||||||
|
|
||||||
/* alloceren en vars goedzetten */
|
/* allocate and init */
|
||||||
len= nu->pntsu;
|
len= nu->pntsu;
|
||||||
if(len==0) return;
|
if(len==0) return;
|
||||||
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
|
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++){
|
for (k = nu->orderu - 1; k < nu->pntsu; k++){
|
||||||
|
|
||||||
wanted = (int)((nu->knotsu[k+1] - nu->knotsu[k]) / ustep);
|
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;
|
if (org > wanted) org = wanted;
|
||||||
|
|
||||||
for (j = org; j > 0; j--){
|
for (j = org; j > 0; j--){
|
||||||
|
|
||||||
basisNurb(u, nu->orderu, nu->pntsu, nu->knotsu, basisu, &istart, &iend);
|
basisNurb(u, nu->orderu, nu->pntsu, nu->knotsu, basisu, &istart, &iend);
|
||||||
/* bereken sum */
|
/* calc sum */
|
||||||
sumdiv= 0.0;
|
sumdiv= 0.0;
|
||||||
fp= sum;
|
fp= sum;
|
||||||
for(i= istart; i<=iend; i++, fp++) {
|
for(i= istart; i<=iend; i++, fp++) {
|
||||||
/* hier nog rationele component doen */
|
/* do the rational component */
|
||||||
*fp= basisu[i];
|
*fp= basisu[i];
|
||||||
sumdiv+= *fp;
|
sumdiv+= *fp;
|
||||||
}
|
}
|
||||||
if(sumdiv!=0.0) if(sumdiv<0.999 || sumdiv>1.001) {
|
if(sumdiv!=0.0) if(sumdiv<0.999 || sumdiv>1.001) {
|
||||||
/* is dit normaliseren ook nodig? */
|
/* is this normalizing needed? */
|
||||||
fp= sum;
|
fp= sum;
|
||||||
for(i= istart; i<=iend; i++, fp++) {
|
for(i= istart; i<=iend; i++, fp++) {
|
||||||
*fp/= sumdiv;
|
*fp/= sumdiv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* een! (1.0) echt punt nu */
|
/* one! (1.0) real point */
|
||||||
fp= sum;
|
fp= sum;
|
||||||
bp= nu->bp+ istart;
|
bp= nu->bp+ istart;
|
||||||
for(i= istart; i<=iend; i++, bp++, fp++) {
|
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(sum);
|
||||||
MEM_freeN(basisu);
|
MEM_freeN(basisu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void makeNurbcurve(Nurb *nu, float *data, int dim)
|
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;
|
BPoint *bp;
|
||||||
float u, ustart, uend, ustep, sumdiv;
|
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(nu->orderu>nu->pntsu) return;
|
||||||
if(data==0) return;
|
if(data==0) return;
|
||||||
|
|
||||||
/* alloceren en vars goedzetten */
|
/* allocate and initialize */
|
||||||
len= nu->pntsu;
|
len= nu->pntsu;
|
||||||
if(len==0) return;
|
if(len==0) return;
|
||||||
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
|
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
|
||||||
@@ -1005,7 +1002,7 @@ void makeNurbcurve(Nurb *nu, float *data, int dim)
|
|||||||
while(resolu--) {
|
while(resolu--) {
|
||||||
|
|
||||||
basisNurb(u, nu->orderu, (short)(nu->pntsu+cycl), nu->knotsu, basisu, &istart, &iend);
|
basisNurb(u, nu->orderu, (short)(nu->pntsu+cycl), nu->knotsu, basisu, &istart, &iend);
|
||||||
/* bereken sum */
|
/* calc sum */
|
||||||
sumdiv= 0.0;
|
sumdiv= 0.0;
|
||||||
fp= sum;
|
fp= sum;
|
||||||
bp= nu->bp+ istart-1;
|
bp= nu->bp+ istart-1;
|
||||||
@@ -1018,14 +1015,14 @@ void makeNurbcurve(Nurb *nu, float *data, int dim)
|
|||||||
sumdiv+= *fp;
|
sumdiv+= *fp;
|
||||||
}
|
}
|
||||||
if(sumdiv!=0.0) if(sumdiv<0.999 || sumdiv>1.001) {
|
if(sumdiv!=0.0) if(sumdiv<0.999 || sumdiv>1.001) {
|
||||||
/* is dit normaliseren ook nodig? */
|
/* is normalizing needed? */
|
||||||
fp= sum;
|
fp= sum;
|
||||||
for(i= istart; i<=iend; i++, fp++) {
|
for(i= istart; i<=iend; i++, fp++) {
|
||||||
*fp/= sumdiv;
|
*fp/= sumdiv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* een! (1.0) echt punt nu */
|
/* one! (1.0) real point */
|
||||||
fp= sum;
|
fp= sum;
|
||||||
bp= nu->bp+ istart-1;
|
bp= nu->bp+ istart-1;
|
||||||
for(i= istart; i<=iend; i++, fp++) {
|
for(i= istart; i<=iend; i++, fp++) {
|
||||||
@@ -1049,7 +1046,7 @@ void makeNurbcurve(Nurb *nu, float *data, int dim)
|
|||||||
u+= ustep;
|
u+= ustep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vrijgeven */
|
/* free */
|
||||||
MEM_freeN(sum);
|
MEM_freeN(sum);
|
||||||
MEM_freeN(basisu);
|
MEM_freeN(basisu);
|
||||||
}
|
}
|
||||||
@@ -1091,7 +1088,7 @@ void make_orco_surf(Curve *cu)
|
|||||||
float *data;
|
float *data;
|
||||||
|
|
||||||
|
|
||||||
/* eerst voorspellen hoelang datablok moet worden */
|
/* first calculate the size of the datablock */
|
||||||
nu= cu->nurb.first;
|
nu= cu->nurb.first;
|
||||||
while(nu) {
|
while(nu) {
|
||||||
#ifdef STRUBI
|
#ifdef STRUBI
|
||||||
@@ -1114,7 +1111,7 @@ See also blenderWorldManipulation.c: init_render_surf()
|
|||||||
#endif
|
#endif
|
||||||
nu= nu->next;
|
nu= nu->next;
|
||||||
}
|
}
|
||||||
/* makeNurbfaces wil nullen */
|
/* makeNurbfaces wants zeros */
|
||||||
data= cu->orco= MEM_callocN(3*sizeof(float)*tot, "make_orco");
|
data= cu->orco= MEM_callocN(3*sizeof(float)*tot, "make_orco");
|
||||||
|
|
||||||
nu= cu->nurb.first;
|
nu= cu->nurb.first;
|
||||||
@@ -1259,7 +1256,7 @@ void makebevelcurve(Object *ob, ListBase *disp)
|
|||||||
dl->parts= 1;
|
dl->parts= 1;
|
||||||
dl->nr= nr;
|
dl->nr= nr;
|
||||||
|
|
||||||
/* eerst cirkel maken */
|
/* first make circle */
|
||||||
fp= dl->verts;
|
fp= dl->verts;
|
||||||
hoek= -0.5*M_PI;
|
hoek= -0.5*M_PI;
|
||||||
dhoek= (float)(M_PI/(nr-2));
|
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)
|
short bevelinside(BevList *bl1,BevList *bl2)
|
||||||
{
|
{
|
||||||
/* is bl2 INSIDE bl1 ? met links-rechts methode en "labda's" */
|
/* is bl2 INSIDE bl1 ? with left-right method and "labda's" */
|
||||||
/* geeft als correct gat 1 terug */
|
/* returns '1' if correct hole */
|
||||||
BevPoint *bevp, *prevbevp;
|
BevPoint *bevp, *prevbevp;
|
||||||
float min,max,vec[3],hvec1[3],hvec2[3],lab,mu;
|
float min,max,vec[3],hvec1[3],hvec2[3],lab,mu;
|
||||||
int nr, links=0,rechts=0,mode;
|
int nr, links=0,rechts=0,mode;
|
||||||
|
|
||||||
/* neem eerste vertex van het mogelijke gat */
|
/* take first vertex of possible hole */
|
||||||
|
|
||||||
bevp= (BevPoint *)(bl2+1);
|
bevp= (BevPoint *)(bl2+1);
|
||||||
hvec1[0]= bevp->x;
|
hvec1[0]= bevp->x;
|
||||||
@@ -1339,8 +1336,8 @@ short bevelinside(BevList *bl1,BevList *bl2)
|
|||||||
VECCOPY(hvec2,hvec1);
|
VECCOPY(hvec2,hvec1);
|
||||||
hvec2[0]+=1000;
|
hvec2[0]+=1000;
|
||||||
|
|
||||||
/* test deze met alle edges van mogelijk omringende poly */
|
/* test it with all edges of potential surounding poly */
|
||||||
/* tel aantal overgangen links en rechts */
|
/* count number of transitions left-right */
|
||||||
|
|
||||||
bevp= (BevPoint *)(bl1+1);
|
bevp= (BevPoint *)(bl1+1);
|
||||||
nr= bl1->nr;
|
nr= bl1->nr;
|
||||||
@@ -1355,10 +1352,10 @@ short bevelinside(BevList *bl1,BevList *bl2)
|
|||||||
}
|
}
|
||||||
if(min!=max) {
|
if(min!=max) {
|
||||||
if(min<=hvec1[1] && max>=hvec1[1]) {
|
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);
|
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
|
/* if lab==0.0 or lab==1.0 then the edge intersects exactly a transition
|
||||||
* alleen toestaan voor lab= 1.0 (of andersom, maakt niet uit)
|
only allow for one situation: we choose lab= 1.0
|
||||||
*/
|
*/
|
||||||
if(mode>=0 && lab!=0.0) {
|
if(mode>=0 && lab!=0.0) {
|
||||||
if(vec[0]<hvec1[0]) links++;
|
if(vec[0]<hvec1[0]) links++;
|
||||||
@@ -1390,7 +1387,7 @@ int vergxcobev(const void *a1, const void *a2)
|
|||||||
return 0;
|
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)
|
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;
|
x3= x1-x2;
|
||||||
y3= y1-y2;
|
y3= y1-y2;
|
||||||
if(x3==0 && y3==0) {
|
if(x3==0 && y3==0) {
|
||||||
/* printf("x3 en y3 nul \n"); */
|
|
||||||
x3= y1;
|
x3= y1;
|
||||||
y3= -x1;
|
y3= -x1;
|
||||||
} else {
|
} else {
|
||||||
@@ -1438,14 +1434,14 @@ void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *data_a)
|
|||||||
|
|
||||||
last= nu->bezt+(nu->pntsu-1);
|
last= nu->bezt+(nu->pntsu-1);
|
||||||
|
|
||||||
/* een punt terug */
|
/* returns a point */
|
||||||
if(prevbezt==nu->bezt) {
|
if(prevbezt==nu->bezt) {
|
||||||
if(nu->flagu & 1) pprev= last;
|
if(nu->flagu & 1) pprev= last;
|
||||||
else pprev= prevbezt;
|
else pprev= prevbezt;
|
||||||
}
|
}
|
||||||
else pprev= prevbezt-1;
|
else pprev= prevbezt-1;
|
||||||
|
|
||||||
/* een punt verder */
|
/* next point */
|
||||||
if(bezt==last) {
|
if(bezt==last) {
|
||||||
if(nu->flagu & 1) next= nu->bezt;
|
if(nu->flagu & 1) next= nu->bezt;
|
||||||
else next= bezt;
|
else next= bezt;
|
||||||
@@ -1465,10 +1461,12 @@ void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *data_a)
|
|||||||
|
|
||||||
void makeBevelList(Object *ob)
|
void makeBevelList(Object *ob)
|
||||||
{
|
{
|
||||||
/* - alle curves omzetten in poly's, met aangegeven resol en vlaggen voor dubbele punten
|
/*
|
||||||
- eventueel intelligent punten verwijderen (geval Nurb)
|
- convert all curves to polys, with indication of resol and flags for double-vertices
|
||||||
- scheiden in verschillende blokken met Boundbox
|
- possibly; do a smart vertice removal (in case Nurb)
|
||||||
- Autogat detectie */
|
- separate in individual blicks with BoundBox
|
||||||
|
- AutoHole detection
|
||||||
|
*/
|
||||||
Curve *cu;
|
Curve *cu;
|
||||||
Nurb *nu;
|
Nurb *nu;
|
||||||
BezTriple *bezt, *prevbezt;
|
BezTriple *bezt, *prevbezt;
|
||||||
@@ -1479,10 +1477,10 @@ void makeBevelList(Object *ob)
|
|||||||
struct bevelsort *sortdata, *sd, *sd1;
|
struct bevelsort *sortdata, *sd, *sd1;
|
||||||
int a, b, len, nr, poly;
|
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;
|
cu= ob->data;
|
||||||
|
|
||||||
/* STAP 1: POLY'S MAKEN */
|
/* STEP 1: MAKE POLYS */
|
||||||
|
|
||||||
BLI_freelistN(&(cu->bev));
|
BLI_freelistN(&(cu->bev));
|
||||||
if(ob==G.obedit) nu= editNurb.first;
|
if(ob==G.obedit) nu= editNurb.first;
|
||||||
@@ -1516,7 +1514,7 @@ void makeBevelList(Object *ob)
|
|||||||
}
|
}
|
||||||
else if((nu->type & 7)==CU_BEZIER) {
|
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");
|
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList");
|
||||||
BLI_addtail(&(cu->bev), bl);
|
BLI_addtail(&(cu->bev), bl);
|
||||||
|
|
||||||
@@ -1555,7 +1553,7 @@ void makeBevelList(Object *ob)
|
|||||||
v1= prevbezt->vec[1];
|
v1= prevbezt->vec[1];
|
||||||
v2= bezt->vec[0];
|
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[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[1], v1[4], v2[1], v2[4], data+1, nu->resolu);
|
||||||
maakbez(v1[2], v1[5], v2[2], v2[5], data+2, 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==prevbezt->h2) {
|
||||||
if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= 1;
|
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);
|
||||||
MEM_freeN(data_a);
|
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->x= prevbezt->vec[1][0];
|
||||||
bevp->y= prevbezt->vec[1][1];
|
bevp->y= prevbezt->vec[1][1];
|
||||||
bevp->z= prevbezt->vec[1][2];
|
bevp->z= prevbezt->vec[1][2];
|
||||||
@@ -1618,7 +1616,7 @@ void makeBevelList(Object *ob)
|
|||||||
else bl->poly= -1;
|
else bl->poly= -1;
|
||||||
bevp= (BevPoint *)(bl+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);
|
makeNurbcurve(nu, data, 4);
|
||||||
|
|
||||||
v1= data;
|
v1= data;
|
||||||
@@ -1639,7 +1637,7 @@ void makeBevelList(Object *ob)
|
|||||||
nu= nu->next;
|
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;
|
bl= cu->bev.first;
|
||||||
while(bl) {
|
while(bl) {
|
||||||
nr= bl->nr;
|
nr= bl->nr;
|
||||||
@@ -1664,12 +1662,12 @@ void makeBevelList(Object *ob)
|
|||||||
while(bl) {
|
while(bl) {
|
||||||
blnext= bl->next;
|
blnext= bl->next;
|
||||||
if(bl->flag) {
|
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");
|
blnew= MEM_mallocN(sizeof(BevList)+nr*sizeof(BevPoint), "makeBevelList");
|
||||||
memcpy(blnew, bl, sizeof(BevList));
|
memcpy(blnew, bl, sizeof(BevList));
|
||||||
blnew->nr= 0;
|
blnew->nr= 0;
|
||||||
BLI_remlink(&(cu->bev), bl);
|
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);
|
bevp0= (BevPoint *)(bl+1);
|
||||||
bevp1= (BevPoint *)(blnew+1);
|
bevp1= (BevPoint *)(blnew+1);
|
||||||
nr= bl->nr;
|
nr= bl->nr;
|
||||||
@@ -1687,20 +1685,20 @@ void makeBevelList(Object *ob)
|
|||||||
bl= blnext;
|
bl= blnext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STAP 3: POLY'S TELLEN EN AUTOGAT */
|
/* STEP 3: COUNT POLYS TELLEN AND AUTOHOLE */
|
||||||
bl= cu->bev.first;
|
bl= cu->bev.first;
|
||||||
poly= 0;
|
poly= 0;
|
||||||
while(bl) {
|
while(bl) {
|
||||||
if(bl->poly>=0) {
|
if(bl->poly>=0) {
|
||||||
poly++;
|
poly++;
|
||||||
bl->poly= poly;
|
bl->poly= poly;
|
||||||
bl->gat= 0;
|
bl->gat= 0; /* 'gat' is dutch for hole */
|
||||||
}
|
}
|
||||||
bl= bl->next;
|
bl= bl->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* meest linkse punten vinden, tevens richting testen */
|
/* find extreme left points, also test (turning) direction */
|
||||||
if(poly>0) {
|
if(poly>0) {
|
||||||
sd= sortdata= MEM_mallocN(sizeof(struct bevelsort)*poly, "makeBevelList5");
|
sd= sortdata= MEM_mallocN(sizeof(struct bevelsort)*poly, "makeBevelList5");
|
||||||
bl= cu->bev.first;
|
bl= cu->bev.first;
|
||||||
@@ -1742,9 +1740,9 @@ void makeBevelList(Object *ob)
|
|||||||
|
|
||||||
sd= sortdata+1;
|
sd= sortdata+1;
|
||||||
for(a=1; a<poly; a++, sd++) {
|
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);
|
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)) {
|
if(bevelinside(sd1->bl, bl)) {
|
||||||
bl->gat= 1- sd1->bl->gat;
|
bl->gat= 1- sd1->bl->gat;
|
||||||
break;
|
break;
|
||||||
@@ -1752,7 +1750,7 @@ void makeBevelList(Object *ob)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draairichting */
|
/* turning direction */
|
||||||
if((cu->flag & CU_3D)==0) {
|
if((cu->flag & CU_3D)==0) {
|
||||||
sd= sortdata;
|
sd= sortdata;
|
||||||
for(a=0; a<poly; a++, sd++) {
|
for(a=0; a<poly; a++, sd++) {
|
||||||
@@ -1772,11 +1770,11 @@ void makeBevelList(Object *ob)
|
|||||||
MEM_freeN(sortdata);
|
MEM_freeN(sortdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STAP 4: COSINUSSEN */
|
/* STEP 4: COSINES */
|
||||||
bl= cu->bev.first;
|
bl= cu->bev.first;
|
||||||
while(bl) {
|
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);
|
bevp2= (BevPoint *)(bl+1);
|
||||||
bevp1= bevp2+1;
|
bevp1= bevp2+1;
|
||||||
|
|
||||||
@@ -1852,7 +1850,7 @@ void makeBevelList(Object *ob)
|
|||||||
bevp1= bevp2;
|
bevp1= bevp2;
|
||||||
bevp2++;
|
bevp2++;
|
||||||
}
|
}
|
||||||
/* niet cyclic gevallen corrigeren */
|
/* correct non-cyclic cases */
|
||||||
if(bl->poly== -1) {
|
if(bl->poly== -1) {
|
||||||
if(bl->nr>2) {
|
if(bl->nr>2) {
|
||||||
bevp= (BevPoint *)(bl+1);
|
bevp= (BevPoint *)(bl+1);
|
||||||
@@ -1877,7 +1875,7 @@ void makeBevelList(Object *ob)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* handlecodes:
|
* 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);
|
len1= VecLenf(p2, p2-3);
|
||||||
if(len1==0.0) len1=1.0;
|
if(len1==0.0) len1=1.0;
|
||||||
if(len2==0.0) len2=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 */
|
if(bezt->h2==HD_ALIGN) { /* aligned */
|
||||||
len= len2/len1;
|
len= len2/len1;
|
||||||
p2[3]= p2[0]+len*(p2[0]-p2[-3]);
|
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;
|
BezTriple *bezt, *prev, *next;
|
||||||
short a;
|
short a;
|
||||||
@@ -2041,13 +2039,13 @@ void calchandlesNurb(Nurb *nu) /* wel eerst (zonodig) de handlevlaggen zetten */
|
|||||||
|
|
||||||
void testhandlesNurb(Nurb *nu)
|
void testhandlesNurb(Nurb *nu)
|
||||||
{
|
{
|
||||||
/* Te gebruiken als er iets an de handles is veranderd.
|
/* use when something has changed with handles.
|
||||||
* Loopt alle BezTriples af met de volgende regels:
|
it treats all BezTriples with the following rules:
|
||||||
* FASE 1: types veranderen?
|
PHASE 1: do types have to be altered?
|
||||||
* Autocalchandles: worden ligned als NOT(000 || 111)
|
Auto handles: become aligned when selection status is NOT(000 || 111)
|
||||||
* Vectorhandles worden 'niets' als (selected en andere niet)
|
Vector handles: become 'nothing' when (one half selected AND other not)
|
||||||
* FASE 2: handles herbereken
|
PHASE 2: recalculate handles
|
||||||
*/
|
*/
|
||||||
BezTriple *bezt;
|
BezTriple *bezt;
|
||||||
short flag, a;
|
short flag, a;
|
||||||
|
|
||||||
@@ -2084,7 +2082,7 @@ void testhandlesNurb(Nurb *nu)
|
|||||||
|
|
||||||
void autocalchandlesNurb(Nurb *nu, int flag)
|
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;
|
BezTriple *bezt2, *bezt1, *bezt0;
|
||||||
int i, align, leftsmall, rightsmall;
|
int i, align, leftsmall, rightsmall;
|
||||||
@@ -2100,10 +2098,10 @@ void autocalchandlesNurb(Nurb *nu, int flag)
|
|||||||
|
|
||||||
align= leftsmall= rightsmall= 0;
|
align= leftsmall= rightsmall= 0;
|
||||||
|
|
||||||
/* linker handle: */
|
/* left handle: */
|
||||||
if(flag==0 || (bezt1->f1 & flag) ) {
|
if(flag==0 || (bezt1->f1 & flag) ) {
|
||||||
bezt1->h1= 0;
|
bezt1->h1= 0;
|
||||||
/* afstand te klein: vectorhandle */
|
/* distance too short: vectorhandle */
|
||||||
if( VecLenf( bezt1->vec[1], bezt0->vec[1] ) < 0.0001) {
|
if( VecLenf( bezt1->vec[1], bezt0->vec[1] ) < 0.0001) {
|
||||||
bezt1->h1= HD_VECT;
|
bezt1->h1= HD_VECT;
|
||||||
leftsmall= 1;
|
leftsmall= 1;
|
||||||
@@ -2114,16 +2112,16 @@ void autocalchandlesNurb(Nurb *nu, int flag)
|
|||||||
align= 1;
|
align= 1;
|
||||||
bezt1->h1= HD_ALIGN;
|
bezt1->h1= HD_ALIGN;
|
||||||
}
|
}
|
||||||
/* of toch vector handle? */
|
/* or vector handle? */
|
||||||
if(DistVL2Dfl(bezt1->vec[0], bezt1->vec[1], bezt0->vec[1]) < 0.0001)
|
if(DistVL2Dfl(bezt1->vec[0], bezt1->vec[1], bezt0->vec[1]) < 0.0001)
|
||||||
bezt1->h1= HD_VECT;
|
bezt1->h1= HD_VECT;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* rechter handle: */
|
/* right handle: */
|
||||||
if(flag==0 || (bezt1->f3 & flag) ) {
|
if(flag==0 || (bezt1->f3 & flag) ) {
|
||||||
bezt1->h2= 0;
|
bezt1->h2= 0;
|
||||||
/* afstand te klein: vectorhandle */
|
/* distance too short: vectorhandle */
|
||||||
if( VecLenf( bezt1->vec[1], bezt2->vec[1] ) < 0.0001) {
|
if( VecLenf( bezt1->vec[1], bezt2->vec[1] ) < 0.0001) {
|
||||||
bezt1->h2= HD_VECT;
|
bezt1->h2= HD_VECT;
|
||||||
rightsmall= 1;
|
rightsmall= 1;
|
||||||
@@ -2132,7 +2130,7 @@ void autocalchandlesNurb(Nurb *nu, int flag)
|
|||||||
/* aligned handle? */
|
/* aligned handle? */
|
||||||
if(align) bezt1->h2= HD_ALIGN;
|
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)
|
if(DistVL2Dfl(bezt1->vec[2], bezt1->vec[1], bezt2->vec[1]) < 0.0001)
|
||||||
bezt1->h2= HD_VECT;
|
bezt1->h2= HD_VECT;
|
||||||
|
|
||||||
@@ -2141,7 +2139,7 @@ void autocalchandlesNurb(Nurb *nu, int flag)
|
|||||||
if(leftsmall && bezt1->h2==HD_ALIGN) bezt1->h2= 0;
|
if(leftsmall && bezt1->h2==HD_ALIGN) bezt1->h2= 0;
|
||||||
if(rightsmall && bezt1->h1==HD_ALIGN) bezt1->h1= 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->h1==HD_ALIGN && bezt1->h2==HD_VECT) bezt1->h1= 0;
|
||||||
if(bezt1->h2==HD_ALIGN && bezt1->h1==HD_VECT) bezt1->h2= 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==1: set autohandle */
|
||||||
/* code==2: set vectorhandle */
|
/* 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;
|
Nurb *nu;
|
||||||
BezTriple *bezt;
|
BezTriple *bezt;
|
||||||
short a, ok=0;
|
short a, ok=0;
|
||||||
@@ -2196,7 +2194,7 @@ void sethandlesNurb(short code)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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;
|
nu= editNurb.first;
|
||||||
while(nu) {
|
while(nu) {
|
||||||
@@ -2269,7 +2267,7 @@ void switchdirectionNurb(Nurb *nu)
|
|||||||
a= nu->pntsu;
|
a= nu->pntsu;
|
||||||
bezt1= nu->bezt;
|
bezt1= nu->bezt;
|
||||||
bezt2= bezt1+(a-1);
|
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;
|
a/= 2;
|
||||||
while(a>0) {
|
while(a>0) {
|
||||||
if(bezt1!=bezt2) SWAP(BezTriple, *bezt1, *bezt2);
|
if(bezt1!=bezt2) SWAP(BezTriple, *bezt1, *bezt2);
|
||||||
@@ -2305,7 +2303,7 @@ void switchdirectionNurb(Nurb *nu)
|
|||||||
bp2--;
|
bp2--;
|
||||||
}
|
}
|
||||||
if((nu->type & 7)==CU_NURBS) {
|
if((nu->type & 7)==CU_NURBS) {
|
||||||
/* de knots omkeren */
|
/* inverse knots */
|
||||||
a= KNOTSU(nu);
|
a= KNOTSU(nu);
|
||||||
fp1= nu->knotsu;
|
fp1= nu->knotsu;
|
||||||
fp2= fp1+(a-1);
|
fp2= fp1+(a-1);
|
||||||
@@ -2316,7 +2314,7 @@ void switchdirectionNurb(Nurb *nu)
|
|||||||
fp1++;
|
fp1++;
|
||||||
fp2--;
|
fp2--;
|
||||||
}
|
}
|
||||||
/* en weer in stijgende lijn maken */
|
/* and make in increasing order again */
|
||||||
a= KNOTSU(nu);
|
a= KNOTSU(nu);
|
||||||
fp1= nu->knotsu;
|
fp1= nu->knotsu;
|
||||||
fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect");
|
fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect");
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
/* displist.c GRAPHICS
|
/* displist.c
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* maart 95
|
|
||||||
*
|
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
* ***** 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) G.scene->camera= scene_find_camera(G.scene);
|
||||||
if(G.scene->camera==0) return;
|
if(G.scene->camera==0) return;
|
||||||
|
|
||||||
/* uit roteerscene gejat */
|
/* copied from 'roteerscene' (does that function still exist? (ton) */
|
||||||
where_is_object(G.scene->camera);
|
where_is_object(G.scene->camera);
|
||||||
Mat4CpyMat4(R.viewinv, G.scene->camera->obmat);
|
Mat4CpyMat4(R.viewinv, G.scene->camera->obmat);
|
||||||
Mat4Ortho(R.viewinv);
|
Mat4Ortho(R.viewinv);
|
||||||
@@ -436,7 +434,7 @@ static void fastshade(float *co, float *nor, float *orco, Material *ma, char *co
|
|||||||
i= 1.0;
|
i= 1.0;
|
||||||
soft= 1.0;
|
soft= 1.0;
|
||||||
if(t<fl->spotbl && fl->spotbl!=0.0) {
|
if(t<fl->spotbl && fl->spotbl!=0.0) {
|
||||||
/* zachte gebied */
|
/* soft area */
|
||||||
i= t/fl->spotbl;
|
i= t/fl->spotbl;
|
||||||
t= i*i;
|
t= i*i;
|
||||||
soft= (3.0*t-2.0*t*i);
|
soft= (3.0*t-2.0*t*i);
|
||||||
@@ -663,11 +661,11 @@ void shadeDispList(Object *ob)
|
|||||||
Mat4Invert(tmat, mat);
|
Mat4Invert(tmat, mat);
|
||||||
Mat3CpyMat4(imat, tmat);
|
Mat3CpyMat4(imat, tmat);
|
||||||
|
|
||||||
/* we halen de dl_verts eruit, deform info */
|
/* we extract dl_verts, deform info */
|
||||||
dldeform= find_displist(&ob->disp, DL_VERTS);
|
dldeform= find_displist(&ob->disp, DL_VERTS);
|
||||||
if(dldeform) BLI_remlink(&ob->disp, dldeform);
|
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(ob->type!=OB_MBALL) freedisplist(&ob->disp);
|
||||||
|
|
||||||
if((R.flag & R_RENDERING)==0) {
|
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");
|
col2= dl->col2= MEM_mallocN(4*sizeof(int)*me->totface, "col2");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* even geen puno's */
|
/* no vertexnormals now */
|
||||||
mvert= me->mvert;
|
mvert= me->mvert;
|
||||||
a= me->totvert;
|
a= me->totvert;
|
||||||
while(FALSE || a--) {
|
while(FALSE || a--) {
|
||||||
@@ -887,7 +885,7 @@ void shadeDispList(Object *ob)
|
|||||||
}
|
}
|
||||||
else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
|
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;
|
cu= ob->data;
|
||||||
dl= cu->disp.first;
|
dl= cu->disp.first;
|
||||||
|
|
||||||
@@ -911,7 +909,7 @@ void shadeDispList(Object *ob)
|
|||||||
|
|
||||||
if(dl->type==DL_INDEX3) {
|
if(dl->type==DL_INDEX3) {
|
||||||
if(dl->nors) {
|
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[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[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];
|
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) {
|
else if(ob->type==OB_MBALL) {
|
||||||
/* normalen zijn er al */
|
/* there are normals already */
|
||||||
dl= ob->disp.first;
|
dl= ob->disp.first;
|
||||||
|
|
||||||
while(dl) {
|
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);
|
if(dldeform) BLI_addtail(&ob->disp, dldeform);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1018,11 +1016,11 @@ void reshadeall_displist(void)
|
|||||||
|
|
||||||
ob= base->object;
|
ob= base->object;
|
||||||
|
|
||||||
/* we halen de dl_verts eruit, deform info */
|
/* we extract dl_verts, deform info */
|
||||||
dldeform= find_displist(&ob->disp, DL_VERTS);
|
dldeform= find_displist(&ob->disp, DL_VERTS);
|
||||||
if(dldeform) BLI_remlink(&ob->disp, dldeform);
|
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);
|
if(ob->type==OB_MBALL) shadeDispList(ob);
|
||||||
else freedisplist(&ob->disp);
|
else freedisplist(&ob->disp);
|
||||||
|
|
||||||
@@ -1073,7 +1071,7 @@ static void curve_to_displist(ListBase *nubase, ListBase *dispbase)
|
|||||||
if(nu->hide==0) {
|
if(nu->hide==0) {
|
||||||
if((nu->type & 7)==CU_BEZIER) {
|
if((nu->type & 7)==CU_BEZIER) {
|
||||||
|
|
||||||
/* tellen */
|
/* count */
|
||||||
len= 0;
|
len= 0;
|
||||||
a= nu->pntsu-1;
|
a= nu->pntsu-1;
|
||||||
if(nu->flagu & 1) a++;
|
if(nu->flagu & 1) a++;
|
||||||
@@ -1093,7 +1091,7 @@ static void curve_to_displist(ListBase *nubase, ListBase *dispbase)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dl= MEM_callocN(sizeof(DispList), "makeDispListbez");
|
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");
|
dl->verts= MEM_callocN( (len+1)*3*sizeof(float), "dlverts");
|
||||||
BLI_addtail(dispbase, dl);
|
BLI_addtail(dispbase, dl);
|
||||||
dl->parts= 1;
|
dl->parts= 1;
|
||||||
@@ -1210,7 +1208,7 @@ static void filldisplist(ListBase *dispbase, ListBase *to)
|
|||||||
|
|
||||||
colnr= dl->col;
|
colnr= dl->col;
|
||||||
|
|
||||||
/* editverts en edges maken */
|
/* make editverts and edges */
|
||||||
f1= dl->verts;
|
f1= dl->verts;
|
||||||
a= dl->nr;
|
a= dl->nr;
|
||||||
eve= v1= 0;
|
eve= v1= 0;
|
||||||
@@ -1245,7 +1243,7 @@ static void filldisplist(ListBase *dispbase, ListBase *to)
|
|||||||
|
|
||||||
if(totvert && BLI_edgefill(0)!=0) {
|
if(totvert && BLI_edgefill(0)!=0) {
|
||||||
|
|
||||||
/* vlakken tellen */
|
/* count faces (vlak in dutch!) */
|
||||||
tot= 0;
|
tot= 0;
|
||||||
evl= fillvlakbase.first;
|
evl= fillvlakbase.first;
|
||||||
while(evl) {
|
while(evl) {
|
||||||
@@ -1263,7 +1261,7 @@ static void filldisplist(ListBase *dispbase, ListBase *to)
|
|||||||
dlnew->index= MEM_mallocN(tot*3*sizeof(int), "dlindex");
|
dlnew->index= MEM_mallocN(tot*3*sizeof(int), "dlindex");
|
||||||
dlnew->verts= MEM_mallocN(totvert*3*sizeof(float), "dlverts");
|
dlnew->verts= MEM_mallocN(totvert*3*sizeof(float), "dlverts");
|
||||||
|
|
||||||
/* vertdata */
|
/* vert data */
|
||||||
f1= dlnew->verts;
|
f1= dlnew->verts;
|
||||||
totvert= 0;
|
totvert= 0;
|
||||||
eve= fillvertbase.first;
|
eve= fillvertbase.first;
|
||||||
@@ -1271,14 +1269,14 @@ static void filldisplist(ListBase *dispbase, ListBase *to)
|
|||||||
VECCOPY(f1, eve->co);
|
VECCOPY(f1, eve->co);
|
||||||
f1+= 3;
|
f1+= 3;
|
||||||
|
|
||||||
/* indexnummer */
|
/* index number */
|
||||||
eve->vn= (EditVert *)totvert;
|
eve->vn= (EditVert *)totvert;
|
||||||
totvert++;
|
totvert++;
|
||||||
|
|
||||||
eve= eve->next;
|
eve= eve->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* indexdata */
|
/* index data */
|
||||||
evl= fillvlakbase.first;
|
evl= fillvlakbase.first;
|
||||||
index= dlnew->index;
|
index= dlnew->index;
|
||||||
while(evl) {
|
while(evl) {
|
||||||
@@ -1299,7 +1297,7 @@ static void filldisplist(ListBase *dispbase, ListBase *to)
|
|||||||
colnr++;
|
colnr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* poly's niet vrijgeven. nodig voor wireframe display */
|
/* do not free polys, needed for wireframe display */
|
||||||
|
|
||||||
/* same as above ... */
|
/* same as above ... */
|
||||||
/* if(G.f & G_PLAYANIM == 0) waitcursor(0); */
|
/* if(G.f & G_PLAYANIM == 0) waitcursor(0); */
|
||||||
@@ -1504,9 +1502,9 @@ void makeDispList(Object *ob)
|
|||||||
if(nu->flagv & 1) dl->flag|= 2;
|
if(nu->flagv & 1) dl->flag|= 2;
|
||||||
}
|
}
|
||||||
else {
|
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;
|
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;
|
if(nu->flagu & 1) dl->flag|= 2;
|
||||||
}
|
}
|
||||||
dl->col= nu->mat_nr;
|
dl->col= nu->mat_nr;
|
||||||
@@ -1564,7 +1562,7 @@ void makeDispList(Object *ob)
|
|||||||
if(ob->dt!=0) makebevelcurve(ob, &dlbev);
|
if(ob->dt!=0) makebevelcurve(ob, &dlbev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* met bevellist werken */
|
/* work with bevellist */
|
||||||
widfac= cu->width-1.0;
|
widfac= cu->width-1.0;
|
||||||
bl= cu->bev.first;
|
bl= cu->bev.first;
|
||||||
nu= cu->nurb.first;
|
nu= cu->nurb.first;
|
||||||
@@ -1591,7 +1589,7 @@ void makeDispList(Object *ob)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* voor iedere stuk van de bevel een aparte dispblok maken */
|
/* for each part of the bevel use a separate displblock */
|
||||||
dlb= dlbev.first;
|
dlb= dlbev.first;
|
||||||
while(dlb) {
|
while(dlb) {
|
||||||
dl= MEM_callocN(sizeof(DispList), "makeDispListbev1");
|
dl= MEM_callocN(sizeof(DispList), "makeDispListbev1");
|
||||||
@@ -1611,9 +1609,9 @@ void makeDispList(Object *ob)
|
|||||||
data= dl->verts;
|
data= dl->verts;
|
||||||
bevp= (BevPoint *)(bl+1);
|
bevp= (BevPoint *)(bl+1);
|
||||||
a= bl->nr;
|
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;
|
fp1= dlb->verts;
|
||||||
b= dlb->nr;
|
b= dlb->nr;
|
||||||
|
|
||||||
@@ -1673,7 +1671,7 @@ typedef struct Sample{
|
|||||||
} Sample;
|
} Sample;
|
||||||
|
|
||||||
typedef struct Segment{
|
typedef struct Segment{
|
||||||
/* coordinaten */
|
/* coordinates */
|
||||||
struct Segment * next, * prev;
|
struct Segment * next, * prev;
|
||||||
float co[2];
|
float co[2];
|
||||||
} Segment;
|
} Segment;
|
||||||
@@ -1706,9 +1704,9 @@ static Sample * outline(struct ImBuf * ibuf,
|
|||||||
int startx = 0, starty = 0;
|
int startx = 0, starty = 0;
|
||||||
Sample * samp, * oldsamp;
|
Sample * samp, * oldsamp;
|
||||||
|
|
||||||
/* wat erin gaat:
|
/* input:
|
||||||
* 1 - plaatje waarvan outline berekent moet worden,
|
* 1 - image
|
||||||
* 2 - pointer naar functie die bepaalt welke pixel in of uit is
|
* 2 - pointer to function that defines which pixel 'in' or 'out' is
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ibuf == 0) return (0);
|
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;
|
if (in_or_out == 0) in_or_out = dflt_in_out;
|
||||||
in = in_or_out(ibuf, 0, 0);
|
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 (y = 0; y < ibuf->y; y++) {
|
||||||
for (x = 0; x < ibuf->x; x++) {
|
for (x = 0; x < ibuf->x; x++) {
|
||||||
if (in_or_out(ibuf, x, y) != in) {
|
if (in_or_out(ibuf, x, y) != in) {
|
||||||
/* eerste 'andere' punt gevonden !! */
|
/* found first 'other' point !! */
|
||||||
|
|
||||||
if (x != startx) dir = 0;
|
if (x != startx) dir = 0;
|
||||||
else dir = 6;
|
else dir = 6;
|
||||||
@@ -1750,7 +1748,7 @@ static Sample * outline(struct ImBuf * ibuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i >= 8) {
|
if (i >= 8) {
|
||||||
/* dit moet een losse punt geweest zijn */
|
/* this has to be a loose point */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1760,7 +1758,7 @@ static Sample * outline(struct ImBuf * ibuf,
|
|||||||
} while(x != startx || y != starty);
|
} while(x != startx || y != starty);
|
||||||
|
|
||||||
if (i >= 8) {
|
if (i >= 8) {
|
||||||
/* losse punten patch */
|
/* patch for loose points */
|
||||||
MEM_freeN(samp);
|
MEM_freeN(samp);
|
||||||
} else {
|
} else {
|
||||||
count = count - 1;
|
count = count - 1;
|
||||||
@@ -1771,7 +1769,7 @@ static Sample * outline(struct ImBuf * ibuf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* printf("geen overgang \n"); */
|
/* printf("no transition \n"); */
|
||||||
return(0);
|
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;
|
float a[2],deler;
|
||||||
|
|
||||||
@@ -1864,7 +1862,7 @@ static void ibuf2wire(ListBase * wireframe, struct ImBuf * ibuf)
|
|||||||
int count;
|
int count;
|
||||||
Sample * samp;
|
Sample * samp;
|
||||||
|
|
||||||
/* eerst een lijst met samples maken */
|
/* first make a list of samples */
|
||||||
|
|
||||||
samp = outline(ibuf, 0);
|
samp = outline(ibuf, 0);
|
||||||
if (samp == 0) return;
|
if (samp == 0) return;
|
||||||
@@ -1908,7 +1906,7 @@ void imagestodisplist(void)
|
|||||||
if(ma && ma->mtex[0] && ma->mtex[0]->tex) {
|
if(ma && ma->mtex[0] && ma->mtex[0]->tex) {
|
||||||
tex= 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);
|
externtex(ma->mtex[0], vec);
|
||||||
|
|
||||||
if(tex->type==TEX_IMAGE && tex->ima && tex->ima->ibuf) {
|
if(tex->type==TEX_IMAGE && tex->ima && tex->ima->ibuf) {
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
/* effect.c MIX MODEL
|
/* effect.c
|
||||||
*
|
*
|
||||||
* dec 95
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -166,7 +165,7 @@ Effect *copy_effect(Effect *eff)
|
|||||||
|
|
||||||
void copy_act_effect(Object *ob)
|
void copy_act_effect(Object *ob)
|
||||||
{
|
{
|
||||||
/* return de aktieve eff gekopieerd */
|
/* return a copy of the active effect */
|
||||||
Effect *effn, *eff;
|
Effect *effn, *eff;
|
||||||
|
|
||||||
eff= ob->effect.first;
|
eff= ob->effect.first;
|
||||||
@@ -183,7 +182,7 @@ void copy_act_effect(Object *ob)
|
|||||||
eff= eff->next;
|
eff= eff->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* als tie hier komt: new effect */
|
/* when it comes here: add new effect */
|
||||||
eff= add_effect(EFF_BUILD);
|
eff= add_effect(EFF_BUILD);
|
||||||
BLI_addtail(&ob->effect, eff);
|
BLI_addtail(&ob->effect, eff);
|
||||||
|
|
||||||
@@ -244,7 +243,7 @@ Particle *new_particle(PartEff *paf)
|
|||||||
static Particle *pa;
|
static Particle *pa;
|
||||||
static int cur;
|
static int cur;
|
||||||
|
|
||||||
/* afspraak: als paf->keys==0: alloc */
|
/* we agree: when paf->keys==0: alloc */
|
||||||
if(paf->keys==0) {
|
if(paf->keys==0) {
|
||||||
pa= paf->keys= MEM_callocN( paf->totkey*paf->totpart*sizeof(Particle), "particlekeys" );
|
pa= paf->keys= MEM_callocN( paf->totkey*paf->totpart*sizeof(Particle), "particlekeys" );
|
||||||
cur= 0;
|
cur= 0;
|
||||||
@@ -279,7 +278,7 @@ void where_is_particle(PartEff *paf, Particle *pa, float ctime, float *vec)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eerst op zoek naar de eerste particlekey */
|
/* first find the first particlekey */
|
||||||
a= (int)((paf->totkey-1)*(ctime-pa->time)/pa->lifetime);
|
a= (int)((paf->totkey-1)*(ctime-pa->time)/pa->lifetime);
|
||||||
if(a>=paf->totkey) a= paf->totkey-1;
|
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;
|
damp= 1.0f-paf->damp;
|
||||||
pa= part;
|
pa= part;
|
||||||
|
|
||||||
/* startsnelheid: random */
|
/* start speed: random */
|
||||||
if(paf->randfac!=0.0) {
|
if(paf->randfac!=0.0) {
|
||||||
pa->no[0]+= (float)(paf->randfac*( BLI_drand() -0.5));
|
pa->no[0]+= (float)(paf->randfac*( BLI_drand() -0.5));
|
||||||
pa->no[1]+= (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));
|
pa->no[2]+= (float)(paf->randfac*( BLI_drand() -0.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* startsnelheid: texture */
|
/* start speed: texture */
|
||||||
if(mtex && paf->texfac!=0.0) {
|
if(mtex && paf->texfac!=0.0) {
|
||||||
particle_tex(mtex, paf, pa->co, pa->no);
|
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;
|
b= paf->totkey-1;
|
||||||
while(b--) {
|
while(b--) {
|
||||||
/* nieuwe tijd */
|
/* new time */
|
||||||
pa->time= opa->time+deltalife;
|
pa->time= opa->time+deltalife;
|
||||||
|
|
||||||
/* nieuwe plek */
|
/* new location */
|
||||||
pa->co[0]= opa->co[0] + deltalife*opa->no[0];
|
pa->co[0]= opa->co[0] + deltalife*opa->no[0];
|
||||||
pa->co[1]= opa->co[1] + deltalife*opa->no[1];
|
pa->co[1]= opa->co[1] + deltalife*opa->no[1];
|
||||||
pa->co[2]= opa->co[2] + deltalife*opa->no[2];
|
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[0]= opa->no[0] + deltalife*force[0];
|
||||||
pa->no[1]= opa->no[1] + deltalife*force[1];
|
pa->no[1]= opa->no[1] + deltalife*force[1];
|
||||||
pa->no[2]= opa->no[2] + deltalife*force[2];
|
pa->no[2]= opa->no[2] + deltalife*force[2];
|
||||||
|
|
||||||
/* snelheid: texture */
|
/* speed: texture */
|
||||||
if(mtex && paf->texfac!=0.0) {
|
if(mtex && paf->texfac!=0.0) {
|
||||||
particle_tex(mtex, paf, pa->co, pa->no);
|
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;
|
opa= pa;
|
||||||
pa++;
|
pa++;
|
||||||
/* opa wordt onderin ook gebruikt */
|
/* opa is used later on too! */
|
||||||
}
|
}
|
||||||
|
|
||||||
if(deform) {
|
if(deform) {
|
||||||
/* alle keys deformen */
|
/* deform all keys */
|
||||||
pa= part;
|
pa= part;
|
||||||
b= paf->totkey;
|
b= paf->totkey;
|
||||||
while(b--) {
|
while(b--) {
|
||||||
@@ -583,7 +582,7 @@ void build_particle_system(Object *ob)
|
|||||||
|
|
||||||
disable_speed_curve(1);
|
disable_speed_curve(1);
|
||||||
|
|
||||||
/* alle particles genereren */
|
/* generate all particles */
|
||||||
if(paf->keys) MEM_freeN(paf->keys);
|
if(paf->keys) MEM_freeN(paf->keys);
|
||||||
paf->keys= 0;
|
paf->keys= 0;
|
||||||
new_particle(paf);
|
new_particle(paf);
|
||||||
@@ -595,11 +594,11 @@ void build_particle_system(Object *ob)
|
|||||||
sfraont= ob->sf;
|
sfraont= ob->sf;
|
||||||
ob->sf= 0.0;
|
ob->sf= 0.0;
|
||||||
|
|
||||||
/* mult generaties? */
|
/* mult generations? */
|
||||||
totpart= paf->totpart;
|
totpart= paf->totpart;
|
||||||
for(a=0; a<PAF_MAXMULT; a++) {
|
for(a=0; a<PAF_MAXMULT; a++) {
|
||||||
if(paf->mult[a]!=0.0) {
|
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]));
|
totpart= (int)(totpart / (1.0+paf->mult[a]*paf->child[a]));
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -608,14 +607,14 @@ void build_particle_system(Object *ob)
|
|||||||
ftime= paf->sta;
|
ftime= paf->sta;
|
||||||
dtime= (paf->end - paf->sta)/totpart;
|
dtime= (paf->end - paf->sta)/totpart;
|
||||||
|
|
||||||
/* hele hiera onthouden */
|
/* remember full hierarchy */
|
||||||
par= ob;
|
par= ob;
|
||||||
while(par) {
|
while(par) {
|
||||||
pushdata(par, sizeof(Object));
|
pushdata(par, sizeof(Object));
|
||||||
par= par->parent;
|
par= par->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* alles op eerste frame zetten */
|
/* set it all at first frame */
|
||||||
G.scene->r.cfra= cfralast= (int)floor(ftime);
|
G.scene->r.cfra= cfralast= (int)floor(ftime);
|
||||||
par= ob;
|
par= ob;
|
||||||
while(par) {
|
while(par) {
|
||||||
@@ -638,7 +637,7 @@ void build_particle_system(Object *ob)
|
|||||||
|
|
||||||
BLI_srand(paf->seed);
|
BLI_srand(paf->seed);
|
||||||
|
|
||||||
/* gaat anders veuls te hard */
|
/* otherwise it goes way too fast */
|
||||||
force[0]= paf->force[0]*0.05f;
|
force[0]= paf->force[0]*0.05f;
|
||||||
force[1]= paf->force[1]*0.05f;
|
force[1]= paf->force[1]*0.05f;
|
||||||
force[2]= paf->force[2]*0.05f;
|
force[2]= paf->force[2]*0.05f;
|
||||||
@@ -654,15 +653,15 @@ void build_particle_system(Object *ob)
|
|||||||
pa= new_particle(paf);
|
pa= new_particle(paf);
|
||||||
pa->time= ftime;
|
pa->time= ftime;
|
||||||
|
|
||||||
/* ob op juiste tijd zetten */
|
/* set ob at correct time */
|
||||||
|
|
||||||
if((paf->flag & PAF_STATIC)==0) {
|
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) {
|
if(cfralast != cur) {
|
||||||
G.scene->r.cfra= 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);
|
bsystem_time(ob, ob->parent, (float)G.scene->r.cfra, 0.0);
|
||||||
|
|
||||||
par= ob;
|
par= ob;
|
||||||
@@ -679,7 +678,7 @@ void build_particle_system(Object *ob)
|
|||||||
Mat3CpyMat4(imat, ob->imat);
|
Mat3CpyMat4(imat, ob->imat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* coordinaat ophalen */
|
/* get coordinates */
|
||||||
if(paf->flag & PAF_FACE) give_mesh_mvert(me, a, co, no);
|
if(paf->flag & PAF_FACE) give_mesh_mvert(me, a, co, no);
|
||||||
else {
|
else {
|
||||||
mvert= me->mvert + (a % me->totvert);
|
mvert= me->mvert + (a % me->totvert);
|
||||||
@@ -696,18 +695,18 @@ void build_particle_system(Object *ob)
|
|||||||
VECCOPY(vec, co);
|
VECCOPY(vec, co);
|
||||||
Mat4MulVecfl(prevobmat, vec);
|
Mat4MulVecfl(prevobmat, vec);
|
||||||
|
|
||||||
/* eerst even startsnelheid: object */
|
/* first start speed: object */
|
||||||
VecSubf(pa->no, pa->co, vec);
|
VecSubf(pa->no, pa->co, vec);
|
||||||
VecMulf(pa->no, paf->obfac);
|
VecMulf(pa->no, paf->obfac);
|
||||||
|
|
||||||
/* nu juiste interframe co berekenen */
|
/* calculate the correct inter-frame */
|
||||||
fac= (ftime- (float)floor(ftime));
|
fac= (ftime- (float)floor(ftime));
|
||||||
pa->co[0]= fac*pa->co[0] + (1.0f-fac)*vec[0];
|
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[1]= fac*pa->co[1] + (1.0f-fac)*vec[1];
|
||||||
pa->co[2]= fac*pa->co[2] + (1.0f-fac)*vec[2];
|
pa->co[2]= fac*pa->co[2] + (1.0f-fac)*vec[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* startsnelheid: normaal */
|
/* start speed: normal */
|
||||||
if(paf->normfac!=0.0) {
|
if(paf->normfac!=0.0) {
|
||||||
/* sp= mvert->no; */
|
/* sp= mvert->no; */
|
||||||
/* transpose ! */
|
/* transpose ! */
|
||||||
@@ -736,16 +735,16 @@ void build_particle_system(Object *ob)
|
|||||||
give_mesh_mvert(0, 0, 0, 0);
|
give_mesh_mvert(0, 0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
/* hele hiera terug */
|
/* put hierarchy back */
|
||||||
par= ob;
|
par= ob;
|
||||||
while(par) {
|
while(par) {
|
||||||
popfirst(par);
|
popfirst(par);
|
||||||
/* geen ob->ipo doen: insertkey behouden */
|
/* do not do ob->ipo: keep insertkey */
|
||||||
do_ob_key(par);
|
do_ob_key(par);
|
||||||
par= par->parent;
|
par= par->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* restore: NA popfirst */
|
/* restore: AFTER popfirst */
|
||||||
ob->sf= sfraont;
|
ob->sf= sfraont;
|
||||||
|
|
||||||
disable_speed_curve(0);
|
disable_speed_curve(0);
|
||||||
@@ -758,10 +757,10 @@ void build_particle_system(Object *ob)
|
|||||||
|
|
||||||
void calc_wave_deform(WaveEff *wav, float ctime, float *co)
|
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;
|
float lifefac, x, y, amplit;
|
||||||
|
|
||||||
/* mag eigenlijk niet voorkomen */
|
/* actually this should not happen */
|
||||||
if((wav->flag & (WAV_X+WAV_Y))==0) return;
|
if((wav->flag & (WAV_X+WAV_Y))==0) return;
|
||||||
|
|
||||||
lifefac= wav->height;
|
lifefac= wav->height;
|
||||||
@@ -787,7 +786,7 @@ void calc_wave_deform(WaveEff *wav, float ctime, float *co)
|
|||||||
}
|
}
|
||||||
else amplit= y;
|
else amplit= y;
|
||||||
|
|
||||||
/* zo maaktie mooie cirkels */
|
/* this way it makes nice circles */
|
||||||
amplit-= (ctime-wav->timeoffs)*wav->speed;
|
amplit-= (ctime-wav->timeoffs)*wav->speed;
|
||||||
|
|
||||||
if(wav->flag & WAV_CYCL) {
|
if(wav->flag & WAV_CYCL) {
|
||||||
@@ -814,7 +813,7 @@ void object_wave(Object *ob)
|
|||||||
float *fp, ctime;
|
float *fp, ctime;
|
||||||
int a, first;
|
int a, first;
|
||||||
|
|
||||||
/* is er een mave */
|
/* is there a wave */
|
||||||
wav= ob->effect.first;
|
wav= ob->effect.first;
|
||||||
while(wav) {
|
while(wav) {
|
||||||
if(wav->type==EFF_WAVE) break;
|
if(wav->type==EFF_WAVE) break;
|
||||||
@@ -838,7 +837,7 @@ void object_wave(Object *ob)
|
|||||||
while(wav) {
|
while(wav) {
|
||||||
if(wav->type==EFF_WAVE) {
|
if(wav->type==EFF_WAVE) {
|
||||||
|
|
||||||
/* voorberekenen */
|
/* precalculate */
|
||||||
wav->minfac= (float)(1.0/exp(wav->width*wav->narrow*wav->width*wav->narrow));
|
wav->minfac= (float)(1.0/exp(wav->width*wav->narrow*wav->width*wav->narrow));
|
||||||
if(wav->damp==0) wav->damp= 10.0f;
|
if(wav->damp==0) wav->damp= 10.0f;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user