- another series of translated c files.
-Ton-
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* exotic.c mei 95 MIXED MODEL
|
/* exotic.c
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -174,7 +174,7 @@ static void read_videoscape_mesh(char *str)
|
|||||||
vd+=3;
|
vd+=3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* de vlakken en kleuren tellen */
|
/* count faces and colors */
|
||||||
for(a=0; a<32; a++) color[a]= 0;
|
for(a=0; a<32; a++) color[a]= 0;
|
||||||
totcol= 0;
|
totcol= 0;
|
||||||
end= 1;
|
end= 1;
|
||||||
@@ -211,7 +211,7 @@ static void read_videoscape_mesh(char *str)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nieuw object */
|
/* new object */
|
||||||
ob= add_object(OB_MESH);
|
ob= add_object(OB_MESH);
|
||||||
me= ob->data;
|
me= ob->data;
|
||||||
me->totvert= verts;
|
me->totvert= verts;
|
||||||
@@ -220,7 +220,7 @@ static void read_videoscape_mesh(char *str)
|
|||||||
me->mvert= MEM_callocN(me->totvert*sizeof(MVert), "mverts");
|
me->mvert= MEM_callocN(me->totvert*sizeof(MVert), "mverts");
|
||||||
if(me->totface) me->mface= MEM_callocN(me->totface*sizeof(MFace), "mface");
|
if(me->totface) me->mface= MEM_callocN(me->totface*sizeof(MFace), "mface");
|
||||||
|
|
||||||
/* kleuren */
|
/* colors */
|
||||||
if(totcol) {
|
if(totcol) {
|
||||||
ob->mat= MEM_callocN(sizeof(void *)*totcol, "ob->mat");
|
ob->mat= MEM_callocN(sizeof(void *)*totcol, "ob->mat");
|
||||||
me->mat= MEM_callocN(sizeof(void *)*totcol, "me->mat");
|
me->mat= MEM_callocN(sizeof(void *)*totcol, "me->mat");
|
||||||
@@ -229,7 +229,7 @@ static void read_videoscape_mesh(char *str)
|
|||||||
ob->actcol= 1;
|
ob->actcol= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* materialen */
|
/* materials */
|
||||||
for(a=0; a<totcol; a++) {
|
for(a=0; a<totcol; a++) {
|
||||||
ma= G.main->mat.first;
|
ma= G.main->mat.first;
|
||||||
while(ma) {
|
while(ma) {
|
||||||
@@ -393,7 +393,7 @@ static void read_radiogour(char *str)
|
|||||||
colv++;
|
colv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* de vlakken tellen */
|
/* count faces */
|
||||||
end= 1;
|
end= 1;
|
||||||
while(end>0) {
|
while(end>0) {
|
||||||
end= fscanf(fp,"%d", &poly);
|
end= fscanf(fp,"%d", &poly);
|
||||||
@@ -420,7 +420,7 @@ static void read_radiogour(char *str)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nieuw object */
|
/* new object */
|
||||||
ob= add_object(OB_MESH);
|
ob= add_object(OB_MESH);
|
||||||
me= ob->data;
|
me= ob->data;
|
||||||
me->totvert= verts;
|
me->totvert= verts;
|
||||||
@@ -501,7 +501,7 @@ static void read_radiogour(char *str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mcol is per vlak 4 kleuren */
|
/* mcol is 4 colors per face */
|
||||||
me->mcol= MEM_mallocN(4*sizeof(int)*me->totface, "mcol");
|
me->mcol= MEM_mallocN(4*sizeof(int)*me->totface, "mcol");
|
||||||
colf= (unsigned int *)me->mcol;
|
colf= (unsigned int *)me->mcol;
|
||||||
|
|
||||||
@@ -736,7 +736,7 @@ static int iv_colornumber(struct IvNode *iv)
|
|||||||
int a;
|
int a;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
/* terugzoeken naar laatste materiaal */
|
/* search back to last material */
|
||||||
while(iv) {
|
while(iv) {
|
||||||
if( strcmp(iv->nodename, "Material")==0) {
|
if( strcmp(iv->nodename, "Material")==0) {
|
||||||
fp= iv->data[0];
|
fp= iv->data[0];
|
||||||
@@ -787,7 +787,7 @@ static int iv_colornumber(struct IvNode *iv)
|
|||||||
|
|
||||||
static int iv_finddata(struct IvNode *iv, char *field, int fieldnr)
|
static int iv_finddata(struct IvNode *iv, char *field, int fieldnr)
|
||||||
{
|
{
|
||||||
/* zoek naar "field", tel lengte data en maak datablok. return skipdata */
|
/* search for "field", count data size and make datablock. return skipdata */
|
||||||
float *fp;
|
float *fp;
|
||||||
int len, stackcount, skipdata=0;
|
int len, stackcount, skipdata=0;
|
||||||
char *cpa, terminator, str[64];
|
char *cpa, terminator, str[64];
|
||||||
@@ -802,7 +802,7 @@ static int iv_finddata(struct IvNode *iv, char *field, int fieldnr)
|
|||||||
if( strncmp(cpa, field, len)==0 ) {
|
if( strncmp(cpa, field, len)==0 ) {
|
||||||
iv->fieldname[fieldnr]= cpa;
|
iv->fieldname[fieldnr]= cpa;
|
||||||
|
|
||||||
/* lezen tot aan eerste karakter */
|
/* read until first character */
|
||||||
cpa+= len;
|
cpa+= len;
|
||||||
skipdata+= len;
|
skipdata+= len;
|
||||||
*cpa= 0;
|
*cpa= 0;
|
||||||
@@ -876,7 +876,7 @@ static int iv_finddata(struct IvNode *iv, char *field, int fieldnr)
|
|||||||
|
|
||||||
static void read_iv_index(float *data, float *baseadr, float *index, int nr, int coordtype)
|
static void read_iv_index(float *data, float *baseadr, float *index, int nr, int coordtype)
|
||||||
{
|
{
|
||||||
/* in data schrijven: baseadr met offset index (aantal nr)*/
|
/* write in data: baseadr with offset index (and number nr) */
|
||||||
float *fp;
|
float *fp;
|
||||||
int ofs;
|
int ofs;
|
||||||
|
|
||||||
@@ -917,7 +917,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
|
|
||||||
iv_data_stack= MEM_mallocN(sizeof(float)*IV_MAXSTACK, "ivstack");
|
iv_data_stack= MEM_mallocN(sizeof(float)*IV_MAXSTACK, "ivstack");
|
||||||
|
|
||||||
/* eerste preprocess: commentar eruit */
|
/* preprocess: remove comments */
|
||||||
md= maindata+20;
|
md= maindata+20;
|
||||||
count= 20;
|
count= 20;
|
||||||
while(count<filelen) {
|
while(count<filelen) {
|
||||||
@@ -934,14 +934,14 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* we gaan alles ordenen: welke zijn de nodes en de fields? */
|
/* now time to collect: which are the nodes and fields? */
|
||||||
md= maindata;
|
md= maindata;
|
||||||
count= 0;
|
count= 0;
|
||||||
while(count<filelen) {
|
while(count<filelen) {
|
||||||
if( *md=='{' ) { /* terug lezen */
|
if( *md=='{' ) { /* read back */
|
||||||
|
|
||||||
cpa= md-1;
|
cpa= md-1;
|
||||||
while( *cpa==32 || *cpa==13 || *cpa==10 || *cpa==9) { /* spaties/enters/tab weg */
|
while( *cpa==32 || *cpa==13 || *cpa==10 || *cpa==9) { /* remove spaces/enters/tab */
|
||||||
*cpa= 0;
|
*cpa= 0;
|
||||||
cpa--;
|
cpa--;
|
||||||
}
|
}
|
||||||
@@ -1014,7 +1014,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
ok= 1;
|
ok= 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* naar 't einde */
|
/* to the end */
|
||||||
while( *md != '}') {
|
while( *md != '}') {
|
||||||
md++;
|
md++;
|
||||||
count++;
|
count++;
|
||||||
@@ -1035,14 +1035,14 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nodes samenvoegen */
|
/* join nodes */
|
||||||
iv= ivbase.first;
|
iv= ivbase.first;
|
||||||
|
|
||||||
while(iv) {
|
while(iv) {
|
||||||
ivn= iv->next;
|
ivn= iv->next;
|
||||||
|
|
||||||
if( strncmp(iv->nodename, "Indexed", 7)==0) {
|
if( strncmp(iv->nodename, "Indexed", 7)==0) {
|
||||||
/* terugzoeken: zelfde naam? */
|
/* seek back: same name? */
|
||||||
|
|
||||||
ivp= iv->prev;
|
ivp= iv->prev;
|
||||||
while(ivp) {
|
while(ivp) {
|
||||||
@@ -1058,7 +1058,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ivp) {
|
if(ivp) {
|
||||||
/* iv bij ivp voegen */
|
/* add iv to ivp */
|
||||||
|
|
||||||
tot= iv->datalen[0] + ivp->datalen[0];
|
tot= iv->datalen[0] + ivp->datalen[0];
|
||||||
if(tot) {
|
if(tot) {
|
||||||
@@ -1081,7 +1081,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Nodes omzetten naar DispLists */
|
/* convert Nodes to DispLists */
|
||||||
iv= ivbase.first;
|
iv= ivbase.first;
|
||||||
while(iv) {
|
while(iv) {
|
||||||
|
|
||||||
@@ -1093,7 +1093,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
|
|
||||||
colnr= iv_colornumber(iv);
|
colnr= iv_colornumber(iv);
|
||||||
|
|
||||||
/* terugzoeken naar data */
|
/* seek back to data */
|
||||||
ivp= iv;
|
ivp= iv;
|
||||||
while(ivp->prev) {
|
while(ivp->prev) {
|
||||||
ivp= ivp->prev;
|
ivp= ivp->prev;
|
||||||
@@ -1108,7 +1108,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
}
|
}
|
||||||
if(ivp) {
|
if(ivp) {
|
||||||
|
|
||||||
/* tel het aantal lijnen */
|
/* count the nr of lines */
|
||||||
tot= 0;
|
tot= 0;
|
||||||
index= iv->data[0];
|
index= iv->data[0];
|
||||||
lll = iv->datalen[0]-1;
|
lll = iv->datalen[0]-1;
|
||||||
@@ -1117,7 +1117,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tot*= 2; /* aantal vertices */
|
tot*= 2; /* nr of vertices */
|
||||||
dl= MEM_callocN(sizeof(struct DispList)+tot*3*sizeof(float), "leesInventor1");
|
dl= MEM_callocN(sizeof(struct DispList)+tot*3*sizeof(float), "leesInventor1");
|
||||||
BLI_addtail(listb, dl);
|
BLI_addtail(listb, dl);
|
||||||
dl->type= DL_SEGM;
|
dl->type= DL_SEGM;
|
||||||
@@ -1140,7 +1140,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
|
|
||||||
colnr= iv_colornumber(iv);
|
colnr= iv_colornumber(iv);
|
||||||
|
|
||||||
/* terugzoeken naar data */
|
/* seek back to data */
|
||||||
ivp= iv;
|
ivp= iv;
|
||||||
while(ivp->prev) {
|
while(ivp->prev) {
|
||||||
ivp= ivp->prev;
|
ivp= ivp->prev;
|
||||||
@@ -1155,19 +1155,19 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ivp) {
|
if(ivp) {
|
||||||
/* tel het aantal driehoeken */
|
/* count triangles */
|
||||||
tot= 0;
|
tot= 0;
|
||||||
|
|
||||||
index= iv->data[0];
|
index= iv->data[0];
|
||||||
polytype= (int) index[0];
|
polytype= (int) index[0];
|
||||||
|
|
||||||
for(a=0; a<iv->datalen[0]; a++) {
|
for(a=0; a<iv->datalen[0]; a++) {
|
||||||
if(index[0]== polytype) tot++; /* een soort? */
|
if(index[0]== polytype) tot++; /* one kind? */
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tot*= polytype; /* aantal vertices */
|
tot*= polytype; /* nr of vertices */
|
||||||
dl= MEM_callocN(sizeof(struct DispList)+tot*3*sizeof(float), "leesInventor4");
|
dl= MEM_callocN(sizeof(struct DispList)+tot*3*sizeof(float), "leesInventor4");
|
||||||
BLI_addtail(listb, dl);
|
BLI_addtail(listb, dl);
|
||||||
dl->type= DL_POLY;
|
dl->type= DL_POLY;
|
||||||
@@ -1204,7 +1204,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
|
|
||||||
colnr= iv_colornumber(iv);
|
colnr= iv_colornumber(iv);
|
||||||
|
|
||||||
/* terugzoeken naar data */
|
/* seek back to data */
|
||||||
ivp= iv;
|
ivp= iv;
|
||||||
while(ivp->prev) {
|
while(ivp->prev) {
|
||||||
ivp= ivp->prev;
|
ivp= ivp->prev;
|
||||||
@@ -1219,11 +1219,11 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ivp) {
|
if(ivp) {
|
||||||
/* tel het aantal driehoeken */
|
/* count triangles */
|
||||||
tot= 0;
|
tot= 0;
|
||||||
face= 0;
|
face= 0;
|
||||||
|
|
||||||
index= iv->data[0]; /* afmeting strip */
|
index= iv->data[0]; /* strip size */
|
||||||
|
|
||||||
for(a=0; a<iv->datalen[0]; a++) {
|
for(a=0; a<iv->datalen[0]; a++) {
|
||||||
tot+= (int) index[0];
|
tot+= (int) index[0];
|
||||||
@@ -1242,7 +1242,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
BLI_addtail(listb, dl);
|
BLI_addtail(listb, dl);
|
||||||
dl->col= colnr;
|
dl->col= colnr;
|
||||||
|
|
||||||
index= iv->data[0]; /* afmeting strip */
|
index= iv->data[0]; /* strip size */
|
||||||
fp= ivp->data[0]; /* vertices */
|
fp= ivp->data[0]; /* vertices */
|
||||||
data= dl->verts;
|
data= dl->verts;
|
||||||
idata= dl->index;
|
idata= dl->index;
|
||||||
@@ -1276,7 +1276,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
|
|
||||||
colnr= iv_colornumber(iv);
|
colnr= iv_colornumber(iv);
|
||||||
|
|
||||||
/* terugzoeken naar data */
|
/* seek back to data */
|
||||||
ivp= iv;
|
ivp= iv;
|
||||||
while(ivp->prev) {
|
while(ivp->prev) {
|
||||||
ivp= ivp->prev;
|
ivp= ivp->prev;
|
||||||
@@ -1291,7 +1291,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
}
|
}
|
||||||
if(ivp) {
|
if(ivp) {
|
||||||
|
|
||||||
/* tel het aantal driehoeken */
|
/* count triangles */
|
||||||
face= 0;
|
face= 0;
|
||||||
index= iv->data[0];
|
index= iv->data[0];
|
||||||
lll = iv->datalen[0]-2;
|
lll = iv->datalen[0]-2;
|
||||||
@@ -1300,7 +1300,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* aantal vertices */
|
/*number of vertices */
|
||||||
tot= ivp->datalen[0]/coordtype;
|
tot= ivp->datalen[0]/coordtype;
|
||||||
|
|
||||||
if(tot) {
|
if(tot) {
|
||||||
@@ -1332,7 +1332,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
|
|
||||||
if(index[0]!= -1 && index[1]!= -1 && index[2]!= -1) {
|
if(index[0]!= -1 && index[1]!= -1 && index[2]!= -1) {
|
||||||
|
|
||||||
/* deze truuk is om poly's met meer dan 3 vertices correct te vullen */
|
/* this trick is to fill poly's with more than 3 vertices correctly */
|
||||||
if(first) {
|
if(first) {
|
||||||
nr= (int) index[0];
|
nr= (int) index[0];
|
||||||
first= 0;
|
first= 0;
|
||||||
@@ -1354,7 +1354,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
|
|
||||||
colnr= iv_colornumber(iv);
|
colnr= iv_colornumber(iv);
|
||||||
|
|
||||||
/* terugzoeken naar data */
|
/* seek back to data */
|
||||||
ivp= iv;
|
ivp= iv;
|
||||||
while(ivp->prev) {
|
while(ivp->prev) {
|
||||||
ivp= ivp->prev;
|
ivp= ivp->prev;
|
||||||
@@ -1369,7 +1369,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
}
|
}
|
||||||
if(ivp) {
|
if(ivp) {
|
||||||
|
|
||||||
/* tel het aantal driehoeken */
|
/* count triangles */
|
||||||
face= 0;
|
face= 0;
|
||||||
index= iv->data[0];
|
index= iv->data[0];
|
||||||
lll=iv->datalen[0]-2;
|
lll=iv->datalen[0]-2;
|
||||||
@@ -1378,7 +1378,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* aantal vertices */
|
/* nr of vertices */
|
||||||
tot= ivp->datalen[0]/coordtype;
|
tot= ivp->datalen[0]/coordtype;
|
||||||
|
|
||||||
dl= MEM_callocN(sizeof(struct DispList), "leesInventor6");
|
dl= MEM_callocN(sizeof(struct DispList), "leesInventor6");
|
||||||
@@ -1421,7 +1421,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
|
|
||||||
colnr= iv_colornumber(iv);
|
colnr= iv_colornumber(iv);
|
||||||
|
|
||||||
/* terugzoeken naar data */
|
/* seek back to data */
|
||||||
ivp= iv;
|
ivp= iv;
|
||||||
while(ivp->prev) {
|
while(ivp->prev) {
|
||||||
ivp= ivp->prev;
|
ivp= ivp->prev;
|
||||||
@@ -1458,7 +1458,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
|
|
||||||
colnr= iv_colornumber(iv);
|
colnr= iv_colornumber(iv);
|
||||||
|
|
||||||
/* terugzoeken naar data */
|
/* sek back to data */
|
||||||
ivp= iv;
|
ivp= iv;
|
||||||
while(ivp->prev) {
|
while(ivp->prev) {
|
||||||
ivp= ivp->prev;
|
ivp= ivp->prev;
|
||||||
@@ -1516,7 +1516,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
bp++;
|
bp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* iv->datalen[2] / [3] is aantal knots */
|
/* iv->datalen[2] / [3] is number of knots */
|
||||||
nu->orderu= iv->datalen[2] - nu->pntsu;
|
nu->orderu= iv->datalen[2] - nu->pntsu;
|
||||||
nu->orderv= iv->datalen[3] - nu->pntsv;
|
nu->orderv= iv->datalen[3] - nu->pntsv;
|
||||||
|
|
||||||
@@ -1550,7 +1550,7 @@ static void read_inventor(char *str, struct ListBase *listb)
|
|||||||
iv= iv->next;
|
iv= iv->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vrijgeven */
|
/* free */
|
||||||
iv= ivbase.first;
|
iv= ivbase.first;
|
||||||
while(iv) {
|
while(iv) {
|
||||||
for(a=0; a<IV_MAXFIELD; a++) {
|
for(a=0; a<IV_MAXFIELD; a++) {
|
||||||
@@ -1579,13 +1579,13 @@ static void displist_to_mesh(DispList *dlfirst)
|
|||||||
int a, b, startve, *idata, totedge=0, tottria=0, totquad=0, totvert=0, totvlak, totcol=0, colnr;
|
int a, b, startve, *idata, totedge=0, tottria=0, totquad=0, totvert=0, totvlak, totcol=0, colnr;
|
||||||
int p1, p2, p3, p4;
|
int p1, p2, p3, p4;
|
||||||
|
|
||||||
/* eerst tellen */
|
/* count first */
|
||||||
INIT_MINMAX(min, max);
|
INIT_MINMAX(min, max);
|
||||||
|
|
||||||
dl= dlfirst;
|
dl= dlfirst;
|
||||||
while(dl) {
|
while(dl) {
|
||||||
|
|
||||||
/* PATCH 1 (polyfill) kan hier niet, er wordt geen listbase meegegeven. eerder doen! */
|
/* PATCH 1 (polyfill) can't be done, there's no listbase here. do that first! */
|
||||||
/* PATCH 2 */
|
/* PATCH 2 */
|
||||||
if(dl->type==DL_SEGM && dl->nr>2) {
|
if(dl->type==DL_SEGM && dl->nr>2) {
|
||||||
data= (float *)(dl+1);
|
data= (float *)(dl+1);
|
||||||
@@ -1599,10 +1599,10 @@ static void displist_to_mesh(DispList *dlfirst)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* kleuren */
|
/* colors */
|
||||||
if(dl->col > totcol) totcol= dl->col;
|
if(dl->col > totcol) totcol= dl->col;
|
||||||
|
|
||||||
/* afmeting en tellen */
|
/* size and count */
|
||||||
if(dl->type==DL_SURF) {
|
if(dl->type==DL_SURF) {
|
||||||
a= dl->nr;
|
a= dl->nr;
|
||||||
b= dl->parts;
|
b= dl->parts;
|
||||||
@@ -1698,7 +1698,7 @@ static void displist_to_mesh(DispList *dlfirst)
|
|||||||
|
|
||||||
me= ob->data;
|
me= ob->data;
|
||||||
|
|
||||||
/* kleuren */
|
/* colors */
|
||||||
if(totcol) {
|
if(totcol) {
|
||||||
ob->mat= MEM_callocN(sizeof(void *)*totcol, "ob->mat");
|
ob->mat= MEM_callocN(sizeof(void *)*totcol, "ob->mat");
|
||||||
me->mat= MEM_callocN(sizeof(void *)*totcol, "me->mat");
|
me->mat= MEM_callocN(sizeof(void *)*totcol, "me->mat");
|
||||||
@@ -1707,7 +1707,7 @@ static void displist_to_mesh(DispList *dlfirst)
|
|||||||
ob->actcol= 1;
|
ob->actcol= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* materialen */
|
/* materials */
|
||||||
for(a=0; a<totcol; a++) {
|
for(a=0; a<totcol; a++) {
|
||||||
ma= G.main->mat.first;
|
ma= G.main->mat.first;
|
||||||
while(ma) {
|
while(ma) {
|
||||||
@@ -1923,7 +1923,7 @@ static void displist_to_objects(ListBase *lbase)
|
|||||||
ListBase tempbase;
|
ListBase tempbase;
|
||||||
int maxaantal, curcol, totvert=0, vert;
|
int maxaantal, curcol, totvert=0, vert;
|
||||||
|
|
||||||
/* eerst dit: is nu nog actief */
|
/* irst this: is still active */
|
||||||
if(ivsurf) {
|
if(ivsurf) {
|
||||||
where_is_object(ivsurf);
|
where_is_object(ivsurf);
|
||||||
docentre_new();
|
docentre_new();
|
||||||
@@ -1935,16 +1935,16 @@ static void displist_to_objects(ListBase *lbase)
|
|||||||
|
|
||||||
/* PATCH 1: polyfill */
|
/* PATCH 1: polyfill */
|
||||||
if(dl->type==DL_POLY && dl->nr>4) {
|
if(dl->type==DL_POLY && dl->nr>4) {
|
||||||
/* oplossing: bij elkaar in aparte listbase zetten */
|
/* solution: put them together in separate listbase */
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
/* PATCH 2: poly's van 2 punten */
|
/* PATCH 2: poly's of 2 points */
|
||||||
if(dl->type==DL_POLY && dl->nr==2) dl->type= DL_SEGM;
|
if(dl->type==DL_POLY && dl->nr==2) dl->type= DL_SEGM;
|
||||||
|
|
||||||
dl= next;
|
dl= next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vertices tellen */
|
/* count vertices */
|
||||||
|
|
||||||
dl= lbase->first;
|
dl= lbase->first;
|
||||||
while(dl) {
|
while(dl) {
|
||||||
@@ -1972,7 +1972,7 @@ static void displist_to_objects(ListBase *lbase)
|
|||||||
|
|
||||||
if(totvert>maxaantal) {
|
if(totvert>maxaantal) {
|
||||||
|
|
||||||
/* probeer kleuren bij elkaar te zetten */
|
/* try to put colors together */
|
||||||
curcol= 0;
|
curcol= 0;
|
||||||
tempbase.first= tempbase.last= 0;
|
tempbase.first= tempbase.last= 0;
|
||||||
|
|
||||||
@@ -1989,7 +1989,7 @@ static void displist_to_objects(ListBase *lbase)
|
|||||||
dl= next;
|
dl= next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* in tempbase zitten alle kleuren 'curcol' */
|
/* in tempbase are all 'curcol' */
|
||||||
totvert= 0;
|
totvert= 0;
|
||||||
dl= first= tempbase.first;
|
dl= first= tempbase.first;
|
||||||
while(dl) {
|
while(dl) {
|
||||||
@@ -2273,7 +2273,7 @@ void write_videoscape(char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* weggooien als nog hogere nummers bestaan */
|
/* remove when higher numbers exist */
|
||||||
while(remove(str)==0) {
|
while(remove(str)==0) {
|
||||||
|
|
||||||
val = BLI_stringdec(str, head, tail, &numlen);
|
val = BLI_stringdec(str, head, tail, &numlen);
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
|
|
||||||
/* font.c MIXED MODEL
|
/* font.c
|
||||||
*
|
|
||||||
* maart 95
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
@@ -75,11 +73,6 @@
|
|||||||
#include "BKE_curve.h"
|
#include "BKE_curve.h"
|
||||||
#include "BKE_displist.h"
|
#include "BKE_displist.h"
|
||||||
|
|
||||||
/* Nieuwe opzet voor vectorfont:
|
|
||||||
*
|
|
||||||
* geen PDrawfont meer, alles meteen naar Nurb en BezTriple
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct chartrans {
|
struct chartrans {
|
||||||
float xof, yof;
|
float xof, yof;
|
||||||
@@ -224,7 +217,7 @@ static void buildchar(Curve *cu, unsigned char ascii, float ofsx, float ofsy, fl
|
|||||||
vfd= vfont_get_data(cu->vfont);
|
vfd= vfont_get_data(cu->vfont);
|
||||||
if (!vfd) return;
|
if (!vfd) return;
|
||||||
|
|
||||||
/* maak een kopie op afstand ofsx, ofsy met shear*/
|
/* make a copy at distance ofsx,ofsy with shear*/
|
||||||
fsize= cu->fsize;
|
fsize= cu->fsize;
|
||||||
shear= cu->shear;
|
shear= cu->shear;
|
||||||
si= (float)sin(rot);
|
si= (float)sin(rot);
|
||||||
@@ -316,8 +309,8 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
short cnr=0, lnr=0;
|
short cnr=0, lnr=0;
|
||||||
char ascii, *mem;
|
char ascii, *mem;
|
||||||
|
|
||||||
/* opmerking: berekeningen altijd tot en met de '\0' van de string omdat
|
/* renark: do calculations including the trailing '\0' of a string
|
||||||
de cursor op die plek moet kunnen staan */
|
because the cursor can be at that location */
|
||||||
|
|
||||||
if(ob->type!=OB_FONT) return 0;
|
if(ob->type!=OB_FONT) return 0;
|
||||||
|
|
||||||
@@ -330,7 +323,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
vfd= vfont_get_data(vfont);
|
vfd= vfont_get_data(vfont);
|
||||||
if (!vfd) return 0;
|
if (!vfd) return 0;
|
||||||
|
|
||||||
/* aantal regels tellen */
|
/* count number of lines */
|
||||||
mem= cu->str;
|
mem= cu->str;
|
||||||
slen = strlen(mem);
|
slen = strlen(mem);
|
||||||
cu->lines= 1;
|
cu->lines= 1;
|
||||||
@@ -339,7 +332,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
if(ascii== '\n' || ascii== '\r') cu->lines++;
|
if(ascii== '\n' || ascii== '\r') cu->lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bereken ofset en rotatie van iedere letter */
|
/* calc offset and rotation of each char */
|
||||||
ct = chartransdata =
|
ct = chartransdata =
|
||||||
(struct chartrans*)MEM_callocN((slen+1)* sizeof(struct chartrans),"buildtext");
|
(struct chartrans*)MEM_callocN((slen+1)* sizeof(struct chartrans),"buildtext");
|
||||||
linedata= MEM_mallocN(sizeof(float)*cu->lines,"buildtext2");
|
linedata= MEM_mallocN(sizeof(float)*cu->lines,"buildtext2");
|
||||||
@@ -358,7 +351,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
ct->linenr= lnr;
|
ct->linenr= lnr;
|
||||||
ct->charnr= cnr;
|
ct->charnr= cnr;
|
||||||
|
|
||||||
/* alleen lege regels mogen kleiner dan 1 zijn */
|
/* only empty lines are allowed smaller than 1 */
|
||||||
if( linedist<1.0) {
|
if( linedist<1.0) {
|
||||||
if(i<slen && (cu->str[i+1]=='\r' || cu->str[i+1]=='\n')) yof-= linedist;
|
if(i<slen && (cu->str[i+1]=='\r' || cu->str[i+1]=='\n')) yof-= linedist;
|
||||||
else yof-= 1.0;
|
else yof-= 1.0;
|
||||||
@@ -393,7 +386,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
ct++;
|
ct++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* met alle fontsettings plekken letters berekenen */
|
/* with fontsettings calc locations of characters */
|
||||||
if(cu->spacemode!=CU_LEFT && lnr>1) {
|
if(cu->spacemode!=CU_LEFT && lnr>1) {
|
||||||
ct= chartransdata;
|
ct= chartransdata;
|
||||||
|
|
||||||
@@ -444,14 +437,14 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
if(maxy<ct->yof) maxy= ct->yof;
|
if(maxy<ct->yof) maxy= ct->yof;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we zetten de x-coordinaat exact op de curve, de y wordt geroteerd */
|
/* we put the x-coordinaat exact at the curve, the y is rotated */
|
||||||
|
|
||||||
/* de lengte correctie */
|
/* length correction */
|
||||||
distfac= sizefac*cucu->path->totdist/(maxx-minx);
|
distfac= sizefac*cucu->path->totdist/(maxx-minx);
|
||||||
timeofs= 0.0;
|
timeofs= 0.0;
|
||||||
|
|
||||||
if(distfac > 1.0) {
|
if(distfac > 1.0) {
|
||||||
/* pad langer dan tekst: spacemode doet mee */
|
/* path longer than text: spacemode involves */
|
||||||
distfac= 1.0f/distfac;
|
distfac= 1.0f/distfac;
|
||||||
|
|
||||||
if(cu->spacemode==CU_RIGHT) {
|
if(cu->spacemode==CU_RIGHT) {
|
||||||
@@ -467,20 +460,20 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
|
|
||||||
distfac/= (maxx-minx);
|
distfac/= (maxx-minx);
|
||||||
|
|
||||||
timeofs+= distfac*cu->xof; /* niet cyclic */
|
timeofs+= distfac*cu->xof; /* not cyclic */
|
||||||
|
|
||||||
ct= chartransdata;
|
ct= chartransdata;
|
||||||
for (i=0; i<=slen; i++, ct++) {
|
for (i=0; i<=slen; i++, ct++) {
|
||||||
|
|
||||||
/* roteren rond centrum letter */
|
/* rotate around centre character */
|
||||||
ascii = cu->str[i];
|
ascii = cu->str[i];
|
||||||
dtime= distfac*0.35f*vfd->width[ascii]; /* Waarom is 0.5 te groot? */
|
dtime= distfac*0.35f*vfd->width[ascii]; /* why not 0.5? */
|
||||||
dtime= distfac*0.0f*vfd->width[ascii]; /* Waarom is 0.5 te groot? */
|
dtime= distfac*0.0f*vfd->width[ascii]; /* why not 0.5? */
|
||||||
|
|
||||||
ctime= timeofs + distfac*( ct->xof - minx);
|
ctime= timeofs + distfac*( ct->xof - minx);
|
||||||
CLAMP(ctime, 0.0, 1.0);
|
CLAMP(ctime, 0.0, 1.0);
|
||||||
|
|
||||||
/* de goede plek EN de goede rotatie apart berekenen */
|
/* calc the right loc AND the right rot separately */
|
||||||
where_on_path(cu->textoncurve, ctime, vec, tvec);
|
where_on_path(cu->textoncurve, ctime, vec, tvec);
|
||||||
where_on_path(cu->textoncurve, ctime+dtime, tvec, rotvec);
|
where_on_path(cu->textoncurve, ctime+dtime, tvec, rotvec);
|
||||||
|
|
||||||
@@ -503,8 +496,8 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
|
|
||||||
|
|
||||||
if(mode==FO_CURSUP || mode==FO_CURSDOWN) {
|
if(mode==FO_CURSUP || mode==FO_CURSDOWN) {
|
||||||
/* 2: curs omhoog
|
/* 2: curs up
|
||||||
3: curs omlaag */
|
3: curs down */
|
||||||
ct= chartransdata+cu->pos;
|
ct= chartransdata+cu->pos;
|
||||||
|
|
||||||
if(mode==FO_CURSUP && ct->linenr==0);
|
if(mode==FO_CURSUP && ct->linenr==0);
|
||||||
@@ -513,7 +506,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
if(mode==FO_CURSUP) lnr= ct->linenr-1;
|
if(mode==FO_CURSUP) lnr= ct->linenr-1;
|
||||||
else lnr= ct->linenr+1;
|
else lnr= ct->linenr+1;
|
||||||
cnr= ct->charnr;
|
cnr= ct->charnr;
|
||||||
/* zoek karakter met lnr en cnr */
|
/* seek for char with lnr en cnr */
|
||||||
cu->pos= 0;
|
cu->pos= 0;
|
||||||
ct= chartransdata;
|
ct= chartransdata;
|
||||||
for (i= 0; i<slen; i++) {
|
for (i= 0; i<slen; i++) {
|
||||||
@@ -528,7 +521,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eerst cursor */
|
/* cursor first */
|
||||||
if(ob==G.obedit) {
|
if(ob==G.obedit) {
|
||||||
ct= chartransdata+cu->pos;
|
ct= chartransdata+cu->pos;
|
||||||
si= (float)sin(ct->rot);
|
si= (float)sin(ct->rot);
|
||||||
@@ -551,7 +544,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mode==0) {
|
if(mode==0) {
|
||||||
/* nurbdata maken */
|
/* make nurbdata */
|
||||||
|
|
||||||
freeNurblist(&cu->nurb);
|
freeNurblist(&cu->nurb);
|
||||||
|
|
||||||
@@ -611,7 +604,7 @@ void font_duplilist(Object *par)
|
|||||||
|
|
||||||
Mat4CpyMat4(pmat, par->obmat);
|
Mat4CpyMat4(pmat, par->obmat);
|
||||||
|
|
||||||
/* in par staat een familienaam, deze gebruiken om objecten te vinden */
|
/* in par the family name is stored, use this to find the other objects */
|
||||||
|
|
||||||
chartransdata= text_to_curve(par, FO_DUPLI);
|
chartransdata= text_to_curve(par, FO_DUPLI);
|
||||||
if(chartransdata==0) return;
|
if(chartransdata==0) return;
|
||||||
@@ -643,8 +636,8 @@ void font_duplilist(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 */
|
||||||
newob->totcol= par->totcol; /* voor give_current_material */
|
newob->totcol= par->totcol; /* for give_current_material */
|
||||||
|
|
||||||
Mat4CpyMat4(newob->obmat, par->obmat);
|
Mat4CpyMat4(newob->obmat, par->obmat);
|
||||||
VECCOPY(newob->obmat[3], vec);
|
VECCOPY(newob->obmat[3], vec);
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
|
|
||||||
/* ika.c MIXED MODEL
|
/* ika.c
|
||||||
*
|
|
||||||
* april 96
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
@@ -67,12 +65,11 @@
|
|||||||
|
|
||||||
void unlink_ika(Ika *ika)
|
void unlink_ika(Ika *ika)
|
||||||
{
|
{
|
||||||
/* loskoppelen: */
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* niet Ika zelf vrijgeven */
|
/* do not free Ika itself */
|
||||||
void free_ika(Ika *ika)
|
void free_ika(Ika *ika)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -117,8 +114,8 @@ void make_local_ika(Ika *ika)
|
|||||||
Ika *ikan;
|
Ika *ikan;
|
||||||
int local=0, lib=0;
|
int local=0, lib=0;
|
||||||
|
|
||||||
/* - zijn er alleen lib users: niet doen
|
/* - only lib users: dont do
|
||||||
* - zijn er alleen locale users: flag zetten
|
* - only local users: set flag
|
||||||
* - mixed: copy
|
* - mixed: copy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -183,13 +180,13 @@ int count_limbs(Object *ob)
|
|||||||
/* ************************************************** */
|
/* ************************************************** */
|
||||||
|
|
||||||
|
|
||||||
/* aan hand van eff[] de len en alpha */
|
/* using eff[ ] and len and alpha */
|
||||||
void calc_limb(Limb *li)
|
void calc_limb(Limb *li)
|
||||||
{
|
{
|
||||||
Limb *prev= li;
|
Limb *prev= li;
|
||||||
float vec[2], alpha= 0.0;
|
float vec[2], alpha= 0.0;
|
||||||
|
|
||||||
/* alpha van 'parents' */
|
/* alpha from 'parents' */
|
||||||
while( (prev=prev->prev) ) {
|
while( (prev=prev->prev) ) {
|
||||||
alpha+= prev->alpha;
|
alpha+= prev->alpha;
|
||||||
}
|
}
|
||||||
@@ -208,7 +205,7 @@ void calc_limb(Limb *li)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* aan hand van len en alpha worden de eindpunten berekend */
|
/* using len and alpha the endpoints are calculated */
|
||||||
void calc_ika(Ika *ika, Limb *li)
|
void calc_ika(Ika *ika, Limb *li)
|
||||||
{
|
{
|
||||||
float alpha=0.0, co, si;
|
float alpha=0.0, co, si;
|
||||||
@@ -256,7 +253,7 @@ void init_defstate_ika(Object *ob)
|
|||||||
ika->toty= 0.0;
|
ika->toty= 0.0;
|
||||||
li= ika->limbbase.first;
|
li= ika->limbbase.first;
|
||||||
|
|
||||||
calc_ika(ika, 0); /* correcte eindpunten */
|
calc_ika(ika, 0); /* correct endpoints */
|
||||||
|
|
||||||
while(li) {
|
while(li) {
|
||||||
li->alphao= li->alpha;
|
li->alphao= li->alpha;
|
||||||
@@ -300,7 +297,7 @@ void rotate_ika(Object *ob, Ika *ika)
|
|||||||
Limb *li;
|
Limb *li;
|
||||||
float len2, da, n1[2], n2[2];
|
float len2, da, n1[2], n2[2];
|
||||||
|
|
||||||
/* terug roteren */
|
/* rotate back */
|
||||||
euler_rot(ob->rot, -ika->toty, 'y');
|
euler_rot(ob->rot, -ika->toty, 'y');
|
||||||
ika->toty= 0.0;
|
ika->toty= 0.0;
|
||||||
|
|
||||||
@@ -322,7 +319,7 @@ void rotate_ika(Object *ob, Ika *ika)
|
|||||||
da= (n2[0])/(len2);
|
da= (n2[0])/(len2);
|
||||||
if(n1[0]<0.0) da= -da;
|
if(n1[0]<0.0) da= -da;
|
||||||
|
|
||||||
/* als de x comp bijna nul is kan dit gebeuren */
|
/* when the x component is almost zero, this can happen */
|
||||||
if(da<=-1.0+TOLER || da>=1.0) ;
|
if(da<=-1.0+TOLER || da>=1.0) ;
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@@ -340,7 +337,7 @@ void rotate_ika_xy(Object *ob, Ika *ika)
|
|||||||
Limb *li;
|
Limb *li;
|
||||||
float ang, da, n1[3], n2[3], axis[3], quat[4];
|
float ang, da, n1[3], n2[3], axis[3], quat[4];
|
||||||
|
|
||||||
/* terug roteren */
|
/* rotate back */
|
||||||
euler_rot(ob->rot, -ika->toty, 'y');
|
euler_rot(ob->rot, -ika->toty, 'y');
|
||||||
euler_rot(ob->rot, -ika->totx, 'x');
|
euler_rot(ob->rot, -ika->totx, 'x');
|
||||||
|
|
||||||
@@ -400,7 +397,7 @@ void itterate_ika(Object *ob)
|
|||||||
if((ika->flag & IK_GRABEFF)==0) return;
|
if((ika->flag & IK_GRABEFF)==0) return;
|
||||||
|
|
||||||
disable_where_script(1);
|
disable_where_script(1);
|
||||||
/* memory: grote tijdsprongen afvangen */
|
/* memory: handle large steps in time */
|
||||||
it= abs(ika->lastfra - G.scene->r.cfra);
|
it= abs(ika->lastfra - G.scene->r.cfra);
|
||||||
ika->lastfra= G.scene->r.cfra;
|
ika->lastfra= G.scene->r.cfra;
|
||||||
if(it>10) {
|
if(it>10) {
|
||||||
@@ -412,13 +409,12 @@ void itterate_ika(Object *ob)
|
|||||||
li= ika->limbbase.first;
|
li= ika->limbbase.first;
|
||||||
while(li) {
|
while(li) {
|
||||||
li->alpha= (1.0f-ika->mem)*li->alpha + ika->mem*li->alphao;
|
li->alpha= (1.0f-ika->mem)*li->alpha + ika->mem*li->alphao;
|
||||||
if(li->fac==1.0f) li->fac= 0.05f; /* oude files: kan weg in juni 96 */
|
|
||||||
li= li->next;
|
li= li->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
calc_ika(ika, 0);
|
calc_ika(ika, 0);
|
||||||
|
|
||||||
/* effector heeft parent? */
|
/* effector has parent? */
|
||||||
if(ika->parent) {
|
if(ika->parent) {
|
||||||
|
|
||||||
if(ika->partype==PAROBJECT) {
|
if(ika->partype==PAROBJECT) {
|
||||||
@@ -436,7 +432,7 @@ void itterate_ika(Object *ob)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* y-as goed draaien */
|
/* rotate y-as correctly */
|
||||||
if(ika->flag & IK_XYCONSTRAINT)
|
if(ika->flag & IK_XYCONSTRAINT)
|
||||||
rotate_ika_xy(ob, ika);
|
rotate_ika_xy(ob, ika);
|
||||||
else
|
else
|
||||||
@@ -448,7 +444,7 @@ void itterate_ika(Object *ob)
|
|||||||
where_is_object(ob);
|
where_is_object(ob);
|
||||||
Mat4Invert(ob->imat, ob->obmat);
|
Mat4Invert(ob->imat, ob->obmat);
|
||||||
VecMat4MulVecfl(ika->effn, ob->imat, ika->effg);
|
VecMat4MulVecfl(ika->effn, ob->imat, ika->effg);
|
||||||
/* forward: dan gaan ook de eerste limbs */
|
/* forward orfer: to do the first limbs as well */
|
||||||
li= ika->limbbase.first;
|
li= ika->limbbase.first;
|
||||||
while(li) {
|
while(li) {
|
||||||
|
|
||||||
@@ -470,7 +466,7 @@ void itterate_ika(Object *ob)
|
|||||||
|
|
||||||
itterate_limb(ika, li);
|
itterate_limb(ika, li);
|
||||||
|
|
||||||
/* zet je calc_ika() buiten deze lus: lange kettingen instabiel */
|
/* when you put calc_ika() outside this loop: long chains get instable */
|
||||||
calc_ika(ika, li);
|
calc_ika(ika, li);
|
||||||
|
|
||||||
li= li->prev;
|
li= li->prev;
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
/* image.c MIX MODEL
|
/* image.c
|
||||||
*
|
|
||||||
* maart 95
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -99,8 +97,8 @@ int imaprepeat, imapextend;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Talpha==TRUE betekent: lees alpha uit plaatje. Dit betekent niet dat Ta
|
* Talpha==TRUE means: read alpha from image. This does not mean that Ta
|
||||||
* niet gebruikt moet worden, hier kan info over rand van image in staan!
|
* should not be used, here info can be stored about outside edge of an image!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -152,7 +150,7 @@ Image *add_image(char *name)
|
|||||||
if(file== -1) return 0;
|
if(file== -1) return 0;
|
||||||
close(file);
|
close(file);
|
||||||
|
|
||||||
/* eerst zoeken naar eenzelfde ima */
|
/* first search an identical image */
|
||||||
ima= G.main->image.first;
|
ima= G.main->image.first;
|
||||||
while(ima) {
|
while(ima) {
|
||||||
strcpy(strtest, ima->name);
|
strcpy(strtest, ima->name);
|
||||||
@@ -197,7 +195,7 @@ void free_unused_animimages()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* *********** LEZEN EN SCHRIJVEN ************** */
|
/* *********** READ AND WRITE ************** */
|
||||||
|
|
||||||
void makepicstring(char *string, int frame)
|
void makepicstring(char *string, int frame)
|
||||||
{
|
{
|
||||||
@@ -213,7 +211,7 @@ void makepicstring(char *string, int frame)
|
|||||||
|
|
||||||
len= strlen(string);
|
len= strlen(string);
|
||||||
|
|
||||||
/* kan ook: sprintf(num, "%04d", frame); */
|
/* can also: sprintf(num, "%04d", frame); */
|
||||||
|
|
||||||
i=4-sprintf(num,"%d",frame);
|
i=4-sprintf(num,"%d",frame);
|
||||||
for(;i>0;i--){
|
for(;i>0;i--){
|
||||||
@@ -246,7 +244,7 @@ void makepicstring(char *string, int frame)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ******** IMAGWRAPPING INIT ************* */
|
/* ******** IMAGE WRAPPING INIT ************* */
|
||||||
|
|
||||||
void converttopremul(struct ImBuf *ibuf)
|
void converttopremul(struct ImBuf *ibuf)
|
||||||
{
|
{
|
||||||
@@ -254,7 +252,7 @@ void converttopremul(struct ImBuf *ibuf)
|
|||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
if(ibuf==0) return;
|
if(ibuf==0) return;
|
||||||
if(ibuf->depth==24) { /* alpha op 255 zetten */
|
if(ibuf->depth==24) { /* put alpha at 255 */
|
||||||
|
|
||||||
cp= (char *)(ibuf->rect);
|
cp= (char *)(ibuf->rect);
|
||||||
for(y=0; y<ibuf->y; y++) {
|
for(y=0; y<ibuf->y; y++) {
|
||||||
@@ -328,7 +326,7 @@ int calcimanr(int cfra, Tex *tex)
|
|||||||
{
|
{
|
||||||
int imanr, len, a, fra, dur;
|
int imanr, len, a, fra, dur;
|
||||||
|
|
||||||
/* hier (+fie_ima/2-1) zorgt ervoor dat correct wordt gedeeld */
|
/* here (+fie_ima/2-1) makes sure that division happens correctly */
|
||||||
|
|
||||||
if(tex->frames==0) return 1;
|
if(tex->frames==0) return 1;
|
||||||
|
|
||||||
@@ -347,18 +345,18 @@ int calcimanr(int cfra, Tex *tex)
|
|||||||
if(cfra<1) cfra= 1;
|
if(cfra<1) cfra= 1;
|
||||||
else if(cfra>len) cfra= len;
|
else if(cfra>len) cfra= len;
|
||||||
|
|
||||||
/* omzetten current frame naar current field */
|
/* convert current frame to current field */
|
||||||
cfra= 2*(cfra);
|
cfra= 2*(cfra);
|
||||||
if(R.flag & R_SEC_FIELD) cfra++;
|
if(R.flag & R_SEC_FIELD) cfra++;
|
||||||
|
|
||||||
|
|
||||||
/* transformeren naar images space */
|
/* transform to images space */
|
||||||
imanr= (cfra+tex->fie_ima-2)/tex->fie_ima;
|
imanr= (cfra+tex->fie_ima-2)/tex->fie_ima;
|
||||||
|
|
||||||
if(imanr>tex->frames) imanr= tex->frames;
|
if(imanr>tex->frames) imanr= tex->frames;
|
||||||
imanr+= tex->offset;
|
imanr+= tex->offset;
|
||||||
|
|
||||||
/* zijn er plaatjes die langer duren? */
|
/* are there images that last longer? */
|
||||||
for(a=0; a<4; a++) {
|
for(a=0; a<4; a++) {
|
||||||
if(tex->fradur[a][0]) {
|
if(tex->fradur[a][0]) {
|
||||||
|
|
||||||
@@ -409,7 +407,7 @@ void de_interlace_ng(struct ImBuf *ibuf) /* neogeo fields */
|
|||||||
ibuf->flags |= IB_fields;
|
ibuf->flags |= IB_fields;
|
||||||
|
|
||||||
if (ibuf->rect) {
|
if (ibuf->rect) {
|
||||||
/* kopieen aanmaken */
|
/* make copies */
|
||||||
tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0);
|
tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0);
|
||||||
tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0);
|
tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0);
|
||||||
|
|
||||||
@@ -437,7 +435,7 @@ void de_interlace_st(struct ImBuf *ibuf) /* standard fields */
|
|||||||
ibuf->flags |= IB_fields;
|
ibuf->flags |= IB_fields;
|
||||||
|
|
||||||
if (ibuf->rect) {
|
if (ibuf->rect) {
|
||||||
/* kopieen aanmaken */
|
/* make copies */
|
||||||
tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0);
|
tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0);
|
||||||
tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0);
|
tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0);
|
||||||
|
|
||||||
@@ -512,7 +510,7 @@ void ima_ibuf_is_nul(Tex *tex)
|
|||||||
if(fra<0) fra= 0;
|
if(fra<0) fra= 0;
|
||||||
ima->ibuf = IMB_anim_absolute(ima->anim, fra);
|
ima->ibuf = IMB_anim_absolute(ima->anim, fra);
|
||||||
|
|
||||||
/* patch ivm textbutton met naam ima (B_NAMEIMA) */
|
/* patch for textbutton with name ima (B_NAMEIMA) */
|
||||||
if(ima->ibuf) {
|
if(ima->ibuf) {
|
||||||
strcpy(ima->ibuf->name, ima->name);
|
strcpy(ima->ibuf->name, ima->name);
|
||||||
if (tex->imaflag & TEX_FIELDS) de_interlacefunc(ima->ibuf);
|
if (tex->imaflag & TEX_FIELDS) de_interlacefunc(ima->ibuf);
|
||||||
@@ -536,7 +534,7 @@ void ima_ibuf_is_nul(Tex *tex)
|
|||||||
|
|
||||||
if(ima->ibuf) {
|
if(ima->ibuf) {
|
||||||
|
|
||||||
/* stringcodes ook in ibuf. ibuf->name wordt als 'undo' gebruikt (buttons.c) */
|
/* stringcodes also in ibuf. ibuf->name is used as 'undo' (buttons.c) */
|
||||||
strcpy(ima->ibuf->name, ima->name);
|
strcpy(ima->ibuf->name, ima->name);
|
||||||
|
|
||||||
if(ima->ibuf->cmap) {
|
if(ima->ibuf->cmap) {
|
||||||
@@ -544,7 +542,7 @@ void ima_ibuf_is_nul(Tex *tex)
|
|||||||
if(tex->imaflag & TEX_ANIM5) {
|
if(tex->imaflag & TEX_ANIM5) {
|
||||||
|
|
||||||
if(tex->imaflag & TEX_MORKPATCH) {
|
if(tex->imaflag & TEX_MORKPATCH) {
|
||||||
/**** PATCH OM KLEUR 2 GOED TE KUNNEN ZETTEN MORKRAMIA */
|
/**** PATCH TO SET COLOR 2 RIGHT (neogeo..) */
|
||||||
if(ima->ibuf->maxcol > 4) {
|
if(ima->ibuf->maxcol > 4) {
|
||||||
cp= (char *)(ima->ibuf->cmap+2);
|
cp= (char *)(ima->ibuf->cmap+2);
|
||||||
cp[0]= 0x80;
|
cp[0]= 0x80;
|
||||||
@@ -672,7 +670,7 @@ int imagewrap(Tex *tex, float *texvec)
|
|||||||
Tb = ((float)rect[2])/255.0f;
|
Tb = ((float)rect[2])/255.0f;
|
||||||
|
|
||||||
if(tex->nor) {
|
if(tex->nor) {
|
||||||
/* bump: drie samples nemen */
|
/* bump: take three samples */
|
||||||
val1= Tr+Tg+Tb;
|
val1= Tr+Tg+Tb;
|
||||||
|
|
||||||
if(x<ibuf->x-1) {
|
if(x<ibuf->x-1) {
|
||||||
@@ -688,7 +686,7 @@ int imagewrap(Tex *tex, float *texvec)
|
|||||||
}
|
}
|
||||||
else val3= val1;
|
else val3= val1;
|
||||||
|
|
||||||
/* niet x en y verwisselen! */
|
/* do not mix up x and y here! */
|
||||||
tex->nor[0]= (val1-val2);
|
tex->nor[0]= (val1-val2);
|
||||||
tex->nor[1]= (val1-val3);
|
tex->nor[1]= (val1-val3);
|
||||||
}
|
}
|
||||||
@@ -889,13 +887,13 @@ float clipy_rctf(rctf *rf, float y1, float y2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void boxsampleclip(struct ImBuf *ibuf, rctf *rf, float *rcol,
|
void boxsampleclip(struct ImBuf *ibuf, rctf *rf, float *rcol,
|
||||||
float *gcol, float *bcol, float *acol) /* return kleur 0.0-1.0 */
|
float *gcol, float *bcol, float *acol) /* return color 0.0-1.0 */
|
||||||
/* struct ImBuf *ibuf; */
|
/* struct ImBuf *ibuf; */
|
||||||
/* rctf *rf; */
|
/* rctf *rf; */
|
||||||
/* float *rcol, *gcol, *bcol, *acol; */
|
/* float *rcol, *gcol, *bcol, *acol; */
|
||||||
{
|
{
|
||||||
/* sample box, is reeds geclipt en minx enz zijn op ibuf size gezet.
|
/* sample box, is clipped already, and minx etc. have been set at ibuf size.
|
||||||
* Vergroot uit met antialiased edges van de pixels */
|
Enlarge with antialiased edges of the pixels */
|
||||||
|
|
||||||
float muly,mulx,div;
|
float muly,mulx,div;
|
||||||
int ofs;
|
int ofs;
|
||||||
@@ -919,7 +917,7 @@ void boxsampleclip(struct ImBuf *ibuf, rctf *rf, float *rcol,
|
|||||||
*rcol= ((float)rect[0])/255.0f;
|
*rcol= ((float)rect[0])/255.0f;
|
||||||
*gcol= ((float)rect[1])/255.0f;
|
*gcol= ((float)rect[1])/255.0f;
|
||||||
*bcol= ((float)rect[2])/255.0f;
|
*bcol= ((float)rect[2])/255.0f;
|
||||||
/* alpha is globaal, reeds gezet in functie imagewraposa() */
|
/* alpha is global, has been set in function imagewraposa() */
|
||||||
if(Talpha) {
|
if(Talpha) {
|
||||||
*acol= ((float)rect[3])/255.0f;
|
*acol= ((float)rect[3])/255.0f;
|
||||||
}
|
}
|
||||||
@@ -986,15 +984,15 @@ void boxsampleclip(struct ImBuf *ibuf, rctf *rf, float *rcol,
|
|||||||
|
|
||||||
void boxsample(struct ImBuf *ibuf,
|
void boxsample(struct ImBuf *ibuf,
|
||||||
float minx, float miny, float maxx, float maxy,
|
float minx, float miny, float maxx, float maxy,
|
||||||
float *rcol, float *gcol, float *bcol, float *acol) /* return kleur 0.0-1.0 */
|
float *rcol, float *gcol, float *bcol, float *acol) /* return color 0.0-1.0 */
|
||||||
/* struct ImBuf *ibuf; */
|
/* struct ImBuf *ibuf; */
|
||||||
/* float minx, miny, maxx, maxy; */
|
/* float minx, miny, maxx, maxy; */
|
||||||
/* float *rcol, *gcol, *bcol, *acol; */
|
/* float *rcol, *gcol, *bcol, *acol; */
|
||||||
{
|
{
|
||||||
/* Sample box, doet clip. minx enz lopen van 0.0 - 1.0 .
|
/* Sample box, performs clip. minx etc are in range 0.0 - 1.0 .
|
||||||
* Vergroot uit met antialiased edges van de pixels.
|
* Enlarge with antialiased edges of pixels.
|
||||||
* Als global imaprepeat is gezet, worden
|
* If global variable 'imaprepeat' has been set, the
|
||||||
* de weggeclipte stukken ook gesampled.
|
* clipped-away parts are sampled as well.
|
||||||
*/
|
*/
|
||||||
rctf *rf, stack[8];
|
rctf *rf, stack[8];
|
||||||
float opp, tot, r, g, b, a, alphaclip= 1.0;
|
float opp, tot, r, g, b, a, alphaclip= 1.0;
|
||||||
@@ -1056,7 +1054,7 @@ void boxsample(struct ImBuf *ibuf,
|
|||||||
if(Talpha==0) *acol= 1.0;
|
if(Talpha==0) *acol= 1.0;
|
||||||
|
|
||||||
if(alphaclip!=1.0) {
|
if(alphaclip!=1.0) {
|
||||||
/* this is for laer investigation, premul or not? */
|
/* this is for laetr investigation, premul or not? */
|
||||||
/* *rcol*= alphaclip; */
|
/* *rcol*= alphaclip; */
|
||||||
/* *gcol*= alphaclip; */
|
/* *gcol*= alphaclip; */
|
||||||
/* *bcol*= alphaclip; */
|
/* *bcol*= alphaclip; */
|
||||||
@@ -1067,14 +1065,14 @@ void boxsample(struct ImBuf *ibuf,
|
|||||||
void filtersample(struct ImBuf *ibuf,
|
void filtersample(struct ImBuf *ibuf,
|
||||||
float fx, float fy,
|
float fx, float fy,
|
||||||
float *rcol, float *gcol, float *bcol, float *acol)
|
float *rcol, float *gcol, float *bcol, float *acol)
|
||||||
/* return kleur 0.0-1.0 */
|
/* return color 0.0-1.0 */
|
||||||
/* struct ImBuf *ibuf; */ /* fx en fy tussen 0.0 en 1.0 */
|
/* struct ImBuf *ibuf; */ /* fx en fy tussen 0.0 en 1.0 */
|
||||||
/* float fx, fy; */
|
/* float fx, fy; */
|
||||||
/* float *rcol, *gcol, *bcol, *acol; */
|
/* float *rcol, *gcol, *bcol, *acol; */
|
||||||
{
|
{
|
||||||
/* met weighted filter 3x3
|
/* with weighted filter 3x3
|
||||||
* de linker of rechter kolom is altijd 0
|
* left or right collumn is always 0
|
||||||
* en de bovenste of onderste rij is altijd 0
|
* upper or lower row is awlays 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int fac, fac1, fac2, fracx, fracy, filt[4];
|
int fac, fac1, fac2, fracx, fracy, filt[4];
|
||||||
@@ -1108,7 +1106,7 @@ void filtersample(struct ImBuf *ibuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(fracy<128) {
|
if(fracy<128) {
|
||||||
/* geval linksonder */
|
/* case left-under */
|
||||||
fac1= 128+fracy;
|
fac1= 128+fracy;
|
||||||
fac2= 128-fracy;
|
fac2= 128-fracy;
|
||||||
|
|
||||||
@@ -1123,7 +1121,7 @@ void filtersample(struct ImBuf *ibuf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* geval linksboven */
|
/* case left-upper */
|
||||||
fac2= 384-fracy;
|
fac2= 384-fracy;
|
||||||
fac1= fracy-128;
|
fac1= fracy-128;
|
||||||
|
|
||||||
@@ -1147,7 +1145,7 @@ void filtersample(struct ImBuf *ibuf,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(fracy<128) {
|
if(fracy<128) {
|
||||||
/* geval rechtsonder */
|
/* case right-under */
|
||||||
fac1= 128+fracy;
|
fac1= 128+fracy;
|
||||||
fac2= 128-fracy;
|
fac2= 128-fracy;
|
||||||
|
|
||||||
@@ -1162,7 +1160,7 @@ void filtersample(struct ImBuf *ibuf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* geval rechtsboven */
|
/* case right-upper */
|
||||||
fac2= 384-fracy;
|
fac2= 384-fracy;
|
||||||
fac1= fracy-128;
|
fac1= fracy-128;
|
||||||
|
|
||||||
@@ -1198,7 +1196,7 @@ void filtersample(struct ImBuf *ibuf,
|
|||||||
r+= filt[fac]*rowcol[0];
|
r+= filt[fac]*rowcol[0];
|
||||||
g+= filt[fac]*rowcol[1];
|
g+= filt[fac]*rowcol[1];
|
||||||
b+= filt[fac]*rowcol[2];
|
b+= filt[fac]*rowcol[2];
|
||||||
if(Talpha) a+= filt[fac]*rowcol[3]; /* alpha is globaal */
|
if(Talpha) a+= filt[fac]*rowcol[3]; /* alpha is global */
|
||||||
}
|
}
|
||||||
*rcol= ((float)r)/16777216.0f;
|
*rcol= ((float)r)/16777216.0f;
|
||||||
*gcol= ((float)g)/16777216.0f;
|
*gcol= ((float)g)/16777216.0f;
|
||||||
@@ -1267,25 +1265,25 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt)
|
|||||||
|
|
||||||
if(ibuf->flags & IB_fields) {
|
if(ibuf->flags & IB_fields) {
|
||||||
if(R.r.mode & R_FIELDS) { /* field render */
|
if(R.r.mode & R_FIELDS) { /* field render */
|
||||||
if(R.flag & R_SEC_FIELD) { /* correctie voor tweede field */
|
if(R.flag & R_SEC_FIELD) { /* correction for 2nd field */
|
||||||
/* fac1= 0.5/( (float)ibuf->y ); */
|
/* fac1= 0.5/( (float)ibuf->y ); */
|
||||||
/* fy-= fac1; */
|
/* fy-= fac1; */
|
||||||
}
|
}
|
||||||
else { /* eerste field */
|
else { /* first field */
|
||||||
fac1= 0.5f/( (float)ibuf->y );
|
fac1= 0.5f/( (float)ibuf->y );
|
||||||
fy+= fac1;
|
fy+= fac1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pixel coordinaten */
|
/* pixel coordinates */
|
||||||
|
|
||||||
minx= MIN3(dxt[0],dyt[0],dxt[0]+dyt[0] );
|
minx= MIN3(dxt[0],dyt[0],dxt[0]+dyt[0] );
|
||||||
maxx= MAX3(dxt[0],dyt[0],dxt[0]+dyt[0] );
|
maxx= MAX3(dxt[0],dyt[0],dxt[0]+dyt[0] );
|
||||||
miny= MIN3(dxt[1],dyt[1],dxt[1]+dyt[1] );
|
miny= MIN3(dxt[1],dyt[1],dxt[1]+dyt[1] );
|
||||||
maxy= MAX3(dxt[1],dyt[1],dxt[1]+dyt[1] );
|
maxy= MAX3(dxt[1],dyt[1],dxt[1]+dyt[1] );
|
||||||
|
|
||||||
/* tex_sharper afgeschaft */
|
/* tex_sharper has been removed */
|
||||||
|
|
||||||
minx= tex->filtersize*(maxx-minx)/2.0f;
|
minx= tex->filtersize*(maxx-minx)/2.0f;
|
||||||
miny= tex->filtersize*(maxy-miny)/2.0f;
|
miny= tex->filtersize*(maxy-miny)/2.0f;
|
||||||
@@ -1293,14 +1291,14 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt)
|
|||||||
if(tex->imaflag & TEX_IMAROT) SWAP(float, minx, miny);
|
if(tex->imaflag & TEX_IMAROT) SWAP(float, minx, miny);
|
||||||
|
|
||||||
if(minx>0.25) minx= 0.25;
|
if(minx>0.25) minx= 0.25;
|
||||||
else if(minx<0.00001f) minx= 0.00001f; /* zijvlakken van eenheidskubus */
|
else if(minx<0.00001f) minx= 0.00001f; /* side faces of unit-cube */
|
||||||
if(miny>0.25) miny= 0.25;
|
if(miny>0.25) miny= 0.25;
|
||||||
else if(miny<0.00001f) miny= 0.00001f;
|
else if(miny<0.00001f) miny= 0.00001f;
|
||||||
|
|
||||||
|
|
||||||
/* repeat en clip */
|
/* repeat and clip */
|
||||||
|
|
||||||
/* let op: imaprepeat is globale waarde (zie boxsample) */
|
/* watch it: imaprepeat is global value (see boxsample) */
|
||||||
imaprepeat= (tex->extend==TEX_REPEAT);
|
imaprepeat= (tex->extend==TEX_REPEAT);
|
||||||
imapextend= (tex->extend==TEX_EXTEND);
|
imapextend= (tex->extend==TEX_EXTEND);
|
||||||
|
|
||||||
@@ -1337,7 +1335,7 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* keuze: */
|
/* choice: */
|
||||||
if(tex->imaflag & TEX_MIPMAP) {
|
if(tex->imaflag & TEX_MIPMAP) {
|
||||||
|
|
||||||
dx= minx;
|
dx= minx;
|
||||||
@@ -1353,18 +1351,18 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt)
|
|||||||
if(maxd < pixsize) break;
|
if(maxd < pixsize) break;
|
||||||
previbuf= ibuf;
|
previbuf= ibuf;
|
||||||
ibuf= ima->mipmap[curmap];
|
ibuf= ima->mipmap[curmap];
|
||||||
pixsize= 1.0f / (float)MIN2(ibuf->x, ibuf->y); /* hier stond 1.0 */
|
pixsize= 1.0f / (float)MIN2(ibuf->x, ibuf->y); /* this used to be 1.0 */
|
||||||
curmap++;
|
curmap++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(previbuf!=ibuf || (tex->imaflag & TEX_INTERPOL)) {
|
if(previbuf!=ibuf || (tex->imaflag & TEX_INTERPOL)) {
|
||||||
/* minmaal 1 pixel sampelen */
|
/* sample at least 1 pixel */
|
||||||
if (minx < 0.5f / ima->ibuf->x) minx = 0.5f / ima->ibuf->x;
|
if (minx < 0.5f / ima->ibuf->x) minx = 0.5f / ima->ibuf->x;
|
||||||
if (miny < 0.5f / ima->ibuf->y) miny = 0.5f / ima->ibuf->y;
|
if (miny < 0.5f / ima->ibuf->y) miny = 0.5f / ima->ibuf->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tex->nor) {
|
if(tex->nor) {
|
||||||
/* beetje extra filter */
|
/* a bit extra filter */
|
||||||
minx*= 1.35f;
|
minx*= 1.35f;
|
||||||
miny*= 1.35f;
|
miny*= 1.35f;
|
||||||
|
|
||||||
@@ -1375,11 +1373,11 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt)
|
|||||||
boxsample(ibuf, fx-2.0f*minx, fy-miny, fx+minx, fy+2.0f*miny, &fac1, &fac2, &fac3, &fac4);
|
boxsample(ibuf, fx-2.0f*minx, fy-miny, fx+minx, fy+2.0f*miny, &fac1, &fac2, &fac3, &fac4);
|
||||||
val3= fac1+fac2+fac3;
|
val3= fac1+fac2+fac3;
|
||||||
|
|
||||||
if(previbuf!=ibuf) { /* interpoleren */
|
if(previbuf!=ibuf) { /* interpolate */
|
||||||
|
|
||||||
boxsample(previbuf, fx-2.0f*minx, fy-2.0f*miny, fx+minx, fy+miny, &fac1, &fac2, &fac3, &fac4);
|
boxsample(previbuf, fx-2.0f*minx, fy-2.0f*miny, fx+minx, fy+miny, &fac1, &fac2, &fac3, &fac4);
|
||||||
|
|
||||||
/* rgb berekenen */
|
/* calc rgb */
|
||||||
dx= 2.0f*(pixsize-maxd)/pixsize;
|
dx= 2.0f*(pixsize-maxd)/pixsize;
|
||||||
if(dx>=1.0f) {
|
if(dx>=1.0f) {
|
||||||
Ta= fac4; Tb= fac3;
|
Ta= fac4; Tb= fac3;
|
||||||
@@ -1400,7 +1398,7 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt)
|
|||||||
val3= dy*val3+ dx*(fac1+fac2+fac3);
|
val3= dy*val3+ dx*(fac1+fac2+fac3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* niet x en y verwisselen! */
|
/* don't switch x or y! */
|
||||||
tex->nor[0]= (val1-val2);
|
tex->nor[0]= (val1-val2);
|
||||||
tex->nor[1]= (val1-val3);
|
tex->nor[1]= (val1-val3);
|
||||||
|
|
||||||
@@ -1413,7 +1411,7 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt)
|
|||||||
|
|
||||||
boxsample(ibuf, minx, miny, maxx, maxy, &Tr, &Tg, &Tb, &Ta);
|
boxsample(ibuf, minx, miny, maxx, maxy, &Tr, &Tg, &Tb, &Ta);
|
||||||
|
|
||||||
if(previbuf!=ibuf) { /* interpoleren */
|
if(previbuf!=ibuf) { /* interpolate */
|
||||||
boxsample(previbuf, minx, miny, maxx, maxy, &fac1, &fac2, &fac3, &fac4);
|
boxsample(previbuf, minx, miny, maxx, maxy, &fac1, &fac2, &fac3, &fac4);
|
||||||
|
|
||||||
fx= 2.0f*(pixsize-maxd)/pixsize;
|
fx= 2.0f*(pixsize-maxd)/pixsize;
|
||||||
@@ -1433,14 +1431,14 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if((tex->imaflag & TEX_INTERPOL)) {
|
if((tex->imaflag & TEX_INTERPOL)) {
|
||||||
/* minmaal 1 pixel sampelen */
|
/* sample 1 pixel minimum */
|
||||||
if (minx < 0.5f / ima->ibuf->x) minx = 0.5f / ima->ibuf->x;
|
if (minx < 0.5f / ima->ibuf->x) minx = 0.5f / ima->ibuf->x;
|
||||||
if (miny < 0.5f / ima->ibuf->y) miny = 0.5f / ima->ibuf->y;
|
if (miny < 0.5f / ima->ibuf->y) miny = 0.5f / ima->ibuf->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tex->nor) {
|
if(tex->nor) {
|
||||||
|
|
||||||
/* beetje extra filter */
|
/* a bit extra filter */
|
||||||
minx*= 1.35f;
|
minx*= 1.35f;
|
||||||
miny*= 1.35f;
|
miny*= 1.35f;
|
||||||
|
|
||||||
@@ -1453,7 +1451,7 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt)
|
|||||||
boxsample(ibuf, fx-2.0f*minx, fy-miny, fx+miny, fy+2.0f*miny, &fac1, &fac2, &fac3, &fac4);
|
boxsample(ibuf, fx-2.0f*minx, fy-miny, fx+miny, fy+2.0f*miny, &fac1, &fac2, &fac3, &fac4);
|
||||||
val3= fac1+fac2+fac3;
|
val3= fac1+fac2+fac3;
|
||||||
|
|
||||||
/* niet x en y verwisselen! */
|
/* don't switch x or y! */
|
||||||
tex->nor[0]= (val1-val2);
|
tex->nor[0]= (val1-val2);
|
||||||
tex->nor[1]= (val1-val3);
|
tex->nor[1]= (val1-val3);
|
||||||
|
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
/* ipo.c MIXED MODEL
|
/* ipo.c
|
||||||
*
|
|
||||||
* jan 95
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -77,9 +75,10 @@
|
|||||||
|
|
||||||
#define SMALL -1.0e-10
|
#define SMALL -1.0e-10
|
||||||
|
|
||||||
/* Dit array is ervoor zodat defines zoals OB_LOC_X niet persee 0 hoeft te zijn.
|
/* This array concept was meant to make sure that defines such as OB_LOC_X
|
||||||
Ook voor toekomstige backward compatibility.
|
don't have to be enumerated, also for backward compatibility, future changes,
|
||||||
Zo kan met een for-next lus alles worden afgelopen */
|
and to enable it all can be accessed with a for-next loop.
|
||||||
|
*/
|
||||||
|
|
||||||
int co_ar[CO_TOTIPO]= {
|
int co_ar[CO_TOTIPO]= {
|
||||||
CO_ENFORCE
|
CO_ENFORCE
|
||||||
@@ -158,7 +157,7 @@ int snd_ar[SND_TOTIPO]= {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
float frame_to_float(int cfra) /* zie ook bsystem_time in object.c */
|
float frame_to_float(int cfra) /* see also bsystem_time in object.c */
|
||||||
{
|
{
|
||||||
extern float bluroffs; /* object.c */
|
extern float bluroffs; /* object.c */
|
||||||
float ctime;
|
float ctime;
|
||||||
@@ -173,7 +172,7 @@ float frame_to_float(int cfra) /* zie ook bsystem_time in object.c */
|
|||||||
return ctime;
|
return ctime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* niet ipo zelf vrijgeven */
|
/* do not free ipo itself */
|
||||||
void free_ipo(Ipo *ipo)
|
void free_ipo(Ipo *ipo)
|
||||||
{
|
{
|
||||||
IpoCurve *icu;
|
IpoCurve *icu;
|
||||||
@@ -222,9 +221,9 @@ void make_local_obipo(Ipo *ipo)
|
|||||||
Ipo *ipon;
|
Ipo *ipon;
|
||||||
int local=0, lib=0;
|
int local=0, lib=0;
|
||||||
|
|
||||||
/* - zijn er alleen lib users: niet doen
|
/* - only lib users: do nothing
|
||||||
* - zijn er alleen locale users: flag zetten
|
* - only local users: set flag
|
||||||
* - mixed: copy
|
* - mixed: make copy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ob= G.main->object.first;
|
ob= G.main->object.first;
|
||||||
@@ -266,9 +265,9 @@ void make_local_matipo(Ipo *ipo)
|
|||||||
Ipo *ipon;
|
Ipo *ipon;
|
||||||
int local=0, lib=0;
|
int local=0, lib=0;
|
||||||
|
|
||||||
/* - zijn er alleen lib users: niet doen
|
/* - only lib users: do nothing
|
||||||
* - zijn er alleen locale users: flag zetten
|
* - only local users: set flag
|
||||||
* - mixed: copy
|
* - mixed: make copy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ma= G.main->mat.first;
|
ma= G.main->mat.first;
|
||||||
@@ -310,9 +309,9 @@ void make_local_keyipo(Ipo *ipo)
|
|||||||
Ipo *ipon;
|
Ipo *ipon;
|
||||||
int local=0, lib=0;
|
int local=0, lib=0;
|
||||||
|
|
||||||
/* - zijn er alleen lib users: niet doen
|
/* - only lib users: do nothing
|
||||||
* - zijn er alleen locale users: flag zetten
|
* - only local users: set flag
|
||||||
* - mixed: copy
|
* - mixed: make copy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
key= G.main->key.first;
|
key= G.main->key.first;
|
||||||
@@ -384,7 +383,7 @@ void calchandles_ipocurve(IpoCurve *icu)
|
|||||||
if(bezt->vec[0][0]>bezt->vec[1][0]) bezt->vec[0][0]= bezt->vec[1][0];
|
if(bezt->vec[0][0]>bezt->vec[1][0]) bezt->vec[0][0]= bezt->vec[1][0];
|
||||||
if(bezt->vec[2][0]<bezt->vec[1][0]) bezt->vec[2][0]= bezt->vec[1][0];
|
if(bezt->vec[2][0]<bezt->vec[1][0]) bezt->vec[2][0]= bezt->vec[1][0];
|
||||||
|
|
||||||
calchandleNurb(bezt, prev, next, 1); /* 1==speciale autohandle */
|
calchandleNurb(bezt, prev, next, 1); /* 1==special autohandle */
|
||||||
|
|
||||||
prev= bezt;
|
prev= bezt;
|
||||||
if(a==1) {
|
if(a==1) {
|
||||||
@@ -392,7 +391,7 @@ void calchandles_ipocurve(IpoCurve *icu)
|
|||||||
}
|
}
|
||||||
else next++;
|
else next++;
|
||||||
|
|
||||||
/* voor automatische ease in en out */
|
/* for automatic ease in and out */
|
||||||
if(bezt->h1==HD_AUTO && bezt->h2==HD_AUTO) {
|
if(bezt->h1==HD_AUTO && bezt->h2==HD_AUTO) {
|
||||||
if(a==0 || a==icu->totvert-1) {
|
if(a==0 || a==icu->totvert-1) {
|
||||||
if(icu->extrap==IPO_HORIZ) {
|
if(icu->extrap==IPO_HORIZ) {
|
||||||
@@ -407,12 +406,12 @@ void calchandles_ipocurve(IpoCurve *icu)
|
|||||||
|
|
||||||
void testhandles_ipocurve(IpoCurve *icu)
|
void testhandles_ipocurve(IpoCurve *icu)
|
||||||
{
|
{
|
||||||
/* Te gebruiken als er iets aan 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 herberekenen
|
PHASE 2: recalculate handles
|
||||||
*/
|
*/
|
||||||
BezTriple *bezt;
|
BezTriple *bezt;
|
||||||
int flag, a;
|
int flag, a;
|
||||||
@@ -508,8 +507,9 @@ int test_time_ipocurve(IpoCurve *icu)
|
|||||||
|
|
||||||
void correct_bezpart(float *v1, float *v2, float *v3, float *v4)
|
void correct_bezpart(float *v1, float *v2, float *v3, float *v4)
|
||||||
{
|
{
|
||||||
/* de totale lengte van de handles mag niet langer zijn
|
/* the total length of the handles is not allowed to be more
|
||||||
* dan de horizontale afstand tussen de punten (v1-v4)
|
* than the horizontal distance between (v1-v4)
|
||||||
|
* this to prevent curve loops
|
||||||
*/
|
*/
|
||||||
float h1[2], h2[2], len1, len2, len, fac;
|
float h1[2], h2[2], len1, len2, len, fac;
|
||||||
|
|
||||||
@@ -680,7 +680,7 @@ float eval_icu(IpoCurve *icu, float ipotime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* uiteinden? */
|
/* endpoints? */
|
||||||
|
|
||||||
if(prevbezt->vec[1][0]>=ipotime) {
|
if(prevbezt->vec[1][0]>=ipotime) {
|
||||||
if( (icu->extrap & IPO_DIR) && icu->ipo!=IPO_CONST) {
|
if( (icu->extrap & IPO_DIR) && icu->ipo!=IPO_CONST) {
|
||||||
@@ -1531,13 +1531,13 @@ void do_ob_ipo(Object *ob)
|
|||||||
|
|
||||||
if(ob->ipo==0) return;
|
if(ob->ipo==0) return;
|
||||||
|
|
||||||
/* hier NIET ob->ctime zetten: bijv bij parent in onzichtb. layer */
|
/* do not set ob->ctime here: for example when parent in invisible layer */
|
||||||
|
|
||||||
ctime= bsystem_time(ob, 0, (float) G.scene->r.cfra, 0.0);
|
ctime= bsystem_time(ob, 0, (float) G.scene->r.cfra, 0.0);
|
||||||
|
|
||||||
calc_ipo(ob->ipo, ctime);
|
calc_ipo(ob->ipo, ctime);
|
||||||
|
|
||||||
/* Patch: de localview onthouden */
|
/* Patch: remember localview */
|
||||||
lay= ob->lay & 0xFF000000;
|
lay= ob->lay & 0xFF000000;
|
||||||
|
|
||||||
execute_ipo((ID *)ob, ob->ipo);
|
execute_ipo((ID *)ob, ob->ipo);
|
||||||
@@ -1547,7 +1547,7 @@ void do_ob_ipo(Object *ob)
|
|||||||
if(strcmp(G.scene->id.name+2, ob->id.name+6)==0) {
|
if(strcmp(G.scene->id.name+2, ob->id.name+6)==0) {
|
||||||
G.scene->lay= ob->lay;
|
G.scene->lay= ob->lay;
|
||||||
copy_view3d_lock(0);
|
copy_view3d_lock(0);
|
||||||
/* hier geen REDRAW: gaat rondzingen! */
|
/* no redraw here! creates too many calls */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1556,19 +1556,19 @@ void do_seq_ipo(Sequence *seq)
|
|||||||
{
|
{
|
||||||
float ctime, div;
|
float ctime, div;
|
||||||
|
|
||||||
/* seq_ipo gaat iets anders: beide fields direkt berekenen */
|
/* seq_ipo has an exception: calc both fields immediately */
|
||||||
|
|
||||||
if(seq->ipo) {
|
if(seq->ipo) {
|
||||||
ctime= frame_to_float(G.scene->r.cfra - seq->startdisp);
|
ctime= frame_to_float(G.scene->r.cfra - seq->startdisp);
|
||||||
div= (seq->enddisp - seq->startdisp)/100.0f;
|
div= (seq->enddisp - seq->startdisp)/100.0f;
|
||||||
if(div==0) return;
|
if(div==0) return;
|
||||||
|
|
||||||
/* tweede field */
|
/* 2nd field */
|
||||||
calc_ipo(seq->ipo, (ctime+0.5f)/div);
|
calc_ipo(seq->ipo, (ctime+0.5f)/div);
|
||||||
execute_ipo((ID *)seq, seq->ipo);
|
execute_ipo((ID *)seq, seq->ipo);
|
||||||
seq->facf1= seq->facf0;
|
seq->facf1= seq->facf0;
|
||||||
|
|
||||||
/* eerste field */
|
/* 1st field */
|
||||||
calc_ipo(seq->ipo, ctime/div);
|
calc_ipo(seq->ipo, ctime/div);
|
||||||
execute_ipo((ID *)seq, seq->ipo);
|
execute_ipo((ID *)seq, seq->ipo);
|
||||||
|
|
||||||
@@ -1623,7 +1623,7 @@ void do_all_ipos()
|
|||||||
do_constraint_channels(&base->object->constraints, &base->object->constraintChannels, ctime);
|
do_constraint_channels(&base->object->constraints, &base->object->constraintChannels, ctime);
|
||||||
|
|
||||||
if(base->object->ipo) {
|
if(base->object->ipo) {
|
||||||
/* per object ipo ook de calc_ipo doen: ivm mogelijke timeoffs */
|
/* do per object ipo the calc_ipo: because of possible timeoffs */
|
||||||
do_ob_ipo(base->object);
|
do_ob_ipo(base->object);
|
||||||
if(base->object->type==OB_MBALL) where_is_object(base->object);
|
if(base->object->type==OB_MBALL) where_is_object(base->object);
|
||||||
}
|
}
|
||||||
@@ -1665,11 +1665,11 @@ void do_all_ipos()
|
|||||||
snd= snd->id.next;
|
snd= snd->id.next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* voor het geval dat... LET OP: 2x */
|
/*just in case of... WATCH IT: 2x */
|
||||||
base= G.scene->base.first;
|
base= G.scene->base.first;
|
||||||
while(base) {
|
while(base) {
|
||||||
|
|
||||||
/* alleen layer updaten als ipo */
|
/* only update layer when an ipo */
|
||||||
if( has_ipo_code(base->object->ipo, OB_LAY) ) {
|
if( has_ipo_code(base->object->ipo, OB_LAY) ) {
|
||||||
base->lay= base->object->lay;
|
base->lay= base->object->lay;
|
||||||
}
|
}
|
||||||
@@ -1677,12 +1677,12 @@ void do_all_ipos()
|
|||||||
base= base->next;
|
base= base->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* voor het geval dat...*/
|
/* just in case...*/
|
||||||
if(G.scene->set) {
|
if(G.scene->set) {
|
||||||
base= G.scene->set->base.first;
|
base= G.scene->set->base.first;
|
||||||
while(base) {
|
while(base) {
|
||||||
|
|
||||||
/* alleen layer updaten als ipo */
|
/* only update layer when an ipo */
|
||||||
if( has_ipo_code(base->object->ipo, OB_LAY) ) {
|
if( has_ipo_code(base->object->ipo, OB_LAY) ) {
|
||||||
base->lay= base->object->lay;
|
base->lay= base->object->lay;
|
||||||
}
|
}
|
||||||
@@ -1744,7 +1744,7 @@ void add_to_cfra_elem(ListBase *lb, BezTriple *bezt)
|
|||||||
while(ce) {
|
while(ce) {
|
||||||
|
|
||||||
if( ce->cfra==bezt->vec[1][0] ) {
|
if( ce->cfra==bezt->vec[1][0] ) {
|
||||||
/* doen ivm dubbele keys */
|
/* do because of double keys */
|
||||||
if(bezt->f2 & 1) ce->sel= bezt->f2;
|
if(bezt->f2 & 1) ce->sel= bezt->f2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1809,7 +1809,7 @@ void make_cfra_list(Ipo *ipo, ListBase *elems)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ipo->showkey==0) {
|
if(ipo->showkey==0) {
|
||||||
/* alle keys deselecteren */
|
/* deselect all keys */
|
||||||
ce= elems->first;
|
ce= elems->first;
|
||||||
while(ce) {
|
while(ce) {
|
||||||
ce->sel= 0;
|
ce->sel= 0;
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
|
|
||||||
/* key.c MIXED MODEL
|
/* key.c
|
||||||
*
|
|
||||||
* mei 95
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
@@ -101,7 +99,7 @@ void free_key(Key *key)
|
|||||||
/* from misc_util: flip the bytes from x */
|
/* from misc_util: flip the bytes from x */
|
||||||
/* #define GS(x) (((unsigned char *)(x))[0] << 8 | ((unsigned char *)(x))[1]) */
|
/* #define GS(x) (((unsigned char *)(x))[0] << 8 | ((unsigned char *)(x))[1]) */
|
||||||
|
|
||||||
Key *add_key(ID *id) /* algemeen */
|
Key *add_key(ID *id) /* common function */
|
||||||
{
|
{
|
||||||
Key *key;
|
Key *key;
|
||||||
char *el;
|
char *el;
|
||||||
@@ -172,9 +170,9 @@ Key *copy_key(Key *key)
|
|||||||
void make_local_key(Key *key)
|
void make_local_key(Key *key)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* - zijn er alleen lib users: niet doen
|
/* - only lib users: do nothing
|
||||||
* - zijn er alleen locale users: flag zetten
|
* - only local users: set flag
|
||||||
* - mixed: copy
|
* - mixed: make copy
|
||||||
*/
|
*/
|
||||||
if(key==0) return;
|
if(key==0) return;
|
||||||
|
|
||||||
@@ -278,7 +276,7 @@ void set_afgeleide_four_ipo(float d, float *data, int type)
|
|||||||
|
|
||||||
int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
|
int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
|
||||||
{
|
{
|
||||||
/* return 1 betekent k[2] is de positie, 0 is interpoleren */
|
/* return 1 means k[2] is the position, return 0 means interpolate */
|
||||||
KeyBlock *k1, *firstkey;
|
KeyBlock *k1, *firstkey;
|
||||||
float d, dpos, ofs=0, lastpos, temp, fval[4];
|
float d, dpos, ofs=0, lastpos, temp, fval[4];
|
||||||
short bsplinetype;
|
short bsplinetype;
|
||||||
@@ -298,7 +296,7 @@ int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
|
|||||||
|
|
||||||
if(k1->next==0) return 1;
|
if(k1->next==0) return 1;
|
||||||
|
|
||||||
if(cycl) { /* voorsorteren */
|
if(cycl) { /* pre-sort */
|
||||||
k[2]= k1->next;
|
k[2]= k1->next;
|
||||||
k[3]= k[2]->next;
|
k[3]= k[2]->next;
|
||||||
if(k[3]==0) k[3]=k1;
|
if(k[3]==0) k[3]=k1;
|
||||||
@@ -320,8 +318,7 @@ int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
|
|||||||
if(fac<t[1]) fac+= dpos;
|
if(fac<t[1]) fac+= dpos;
|
||||||
k1= k[3];
|
k1= k[3];
|
||||||
}
|
}
|
||||||
else { /* voorsorteren */
|
else { /* pre-sort */
|
||||||
/* waarom dit voorsorteren niet eerder gedaan? voor juist interpoleren in begin noodz. */
|
|
||||||
k[2]= k1->next;
|
k[2]= k1->next;
|
||||||
t[2]= k[2]->pos;
|
t[2]= k[2]->pos;
|
||||||
k[3]= k[2]->next;
|
k[3]= k[2]->next;
|
||||||
@@ -330,7 +327,7 @@ int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
|
|||||||
k1= k[3];
|
k1= k[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
while( t[2]<fac ) { /* goede plek vinden */
|
while( t[2]<fac ) { /* find correct location */
|
||||||
if(k1->next==0) {
|
if(k1->next==0) {
|
||||||
if(cycl) {
|
if(cycl) {
|
||||||
k1= firstkey;
|
k1= firstkey;
|
||||||
@@ -357,17 +354,17 @@ int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
|
|||||||
|
|
||||||
|
|
||||||
if(cycl==0) {
|
if(cycl==0) {
|
||||||
if(bsplinetype==0) { /* B spline gaat niet door de punten */
|
if(bsplinetype==0) { /* B spline doesn't go through the control points */
|
||||||
if(fac<=t[1]) { /* fac voor 1e key */
|
if(fac<=t[1]) { /* fac for 1st key */
|
||||||
t[2]= t[1];
|
t[2]= t[1];
|
||||||
k[2]= k[1];
|
k[2]= k[1];
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(fac>=t[2] ) { /* fac na 2e key */
|
if(fac>=t[2] ) { /* fac after 2nd key */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(fac>t[2]) { /* laatste key */
|
else if(fac>t[2]) { /* last key */
|
||||||
fac= t[2];
|
fac= t[2];
|
||||||
k[3]= k[2];
|
k[3]= k[2];
|
||||||
t[3]= t[2];
|
t[3]= t[2];
|
||||||
@@ -377,12 +374,12 @@ int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
|
|||||||
d= t[2]-t[1];
|
d= t[2]-t[1];
|
||||||
if(d==0.0) {
|
if(d==0.0) {
|
||||||
if(bsplinetype==0) {
|
if(bsplinetype==0) {
|
||||||
return 1; /* beide keys gelijk */
|
return 1; /* both keys equal */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else d= (fac-t[1])/d;
|
else d= (fac-t[1])/d;
|
||||||
|
|
||||||
/* interpolatie */
|
/* interpolation */
|
||||||
|
|
||||||
set_four_ipo(d, t, k[1]->type);
|
set_four_ipo(d, t, k[1]->type);
|
||||||
|
|
||||||
@@ -450,7 +447,7 @@ void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *k, int
|
|||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* deze uitzondering is om slurphing mogelijk te maken */
|
/* this exception is needed for slurphing */
|
||||||
if(start!=0) {
|
if(start!=0) {
|
||||||
|
|
||||||
poin+= poinsize*start;
|
poin+= poinsize*start;
|
||||||
@@ -473,7 +470,7 @@ void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *k, int
|
|||||||
elemstr[2]= 0;
|
elemstr[2]= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* alleen in dit stuk, hierboven niet! */
|
/* just do it here, not above! */
|
||||||
elemsize= key->elemsize;
|
elemsize= key->elemsize;
|
||||||
if(mode==KEY_BEZTRIPLE) elemsize*= 3;
|
if(mode==KEY_BEZTRIPLE) elemsize*= 3;
|
||||||
|
|
||||||
@@ -509,7 +506,7 @@ void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *k, int
|
|||||||
cp+= 2; ofsp++;
|
cp+= 2; ofsp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* gaan we moeilijk doen */
|
/* are we going to be nasty? */
|
||||||
if(flagflo) {
|
if(flagflo) {
|
||||||
ktot+= kd;
|
ktot+= kd;
|
||||||
while(ktot>=1.0) {
|
while(ktot>=1.0) {
|
||||||
@@ -537,7 +534,7 @@ void cp_cu_key(Curve *cu, KeyBlock *kb, int start, int end)
|
|||||||
|
|
||||||
step= nu->pntsu*nu->pntsv;
|
step= nu->pntsu*nu->pntsv;
|
||||||
|
|
||||||
/* uitzondering omdat keys graag met volledige blokken werken */
|
/* exception because keys prefer to work with complete blocks */
|
||||||
poin= (char *)nu->bp->vec;
|
poin= (char *)nu->bp->vec;
|
||||||
poin -= a*sizeof(BPoint);
|
poin -= a*sizeof(BPoint);
|
||||||
|
|
||||||
@@ -604,12 +601,12 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, float ct
|
|||||||
|
|
||||||
if(end>tot) end= tot;
|
if(end>tot) end= tot;
|
||||||
|
|
||||||
/* in geval beztriple */
|
/* in case of beztriple */
|
||||||
elemstr[0]= 1; /* aantal ipofloats */
|
elemstr[0]= 1; /* nr of ipofloats */
|
||||||
elemstr[1]= IPO_BEZTRIPLE;
|
elemstr[1]= IPO_BEZTRIPLE;
|
||||||
elemstr[2]= 0;
|
elemstr[2]= 0;
|
||||||
|
|
||||||
/* alleen in dit stuk, hierboven niet! */
|
/* just here, not above! */
|
||||||
elemsize= key->elemsize;
|
elemsize= key->elemsize;
|
||||||
if(mode==KEY_BEZTRIPLE) elemsize*= 3;
|
if(mode==KEY_BEZTRIPLE) elemsize*= 3;
|
||||||
|
|
||||||
@@ -653,7 +650,7 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, float ct
|
|||||||
|
|
||||||
ofsp= ofs;
|
ofsp= ofs;
|
||||||
|
|
||||||
while( cp[0] ) { /* cp[0]==aantal */
|
while( cp[0] ) { /* cp[0]==amount */
|
||||||
|
|
||||||
switch(cp[1]) {
|
switch(cp[1]) {
|
||||||
case IPO_FLOAT:
|
case IPO_FLOAT:
|
||||||
@@ -724,7 +721,7 @@ void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock **k, flo
|
|||||||
k3= k[2]->data;
|
k3= k[2]->data;
|
||||||
k4= k[3]->data;
|
k4= k[3]->data;
|
||||||
|
|
||||||
/* testen op meer of minder punten (per key!) */
|
/* test for more or less points (per key!) */
|
||||||
if(tot != k[0]->totelem) {
|
if(tot != k[0]->totelem) {
|
||||||
k1tot= 0.0;
|
k1tot= 0.0;
|
||||||
flagflo |= 1;
|
flagflo |= 1;
|
||||||
@@ -758,7 +755,7 @@ void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock **k, flo
|
|||||||
else flagdo -= 8;
|
else flagdo -= 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* deze uitzondering is om slurphing mogelijk te maken */
|
/* this exception needed for slurphing */
|
||||||
if(start!=0) {
|
if(start!=0) {
|
||||||
|
|
||||||
poin+= poinsize*start;
|
poin+= poinsize*start;
|
||||||
@@ -810,12 +807,12 @@ void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock **k, flo
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* in geval beztriple */
|
/* in case of beztriple */
|
||||||
elemstr[0]= 1; /* aantal ipofloats */
|
elemstr[0]= 1; /* nr of ipofloats */
|
||||||
elemstr[1]= IPO_BEZTRIPLE;
|
elemstr[1]= IPO_BEZTRIPLE;
|
||||||
elemstr[2]= 0;
|
elemstr[2]= 0;
|
||||||
|
|
||||||
/* alleen in dit stuk, hierboven niet! */
|
/* only here, not above! */
|
||||||
elemsize= key->elemsize;
|
elemsize= key->elemsize;
|
||||||
if(mode==KEY_BEZTRIPLE) elemsize*= 3;
|
if(mode==KEY_BEZTRIPLE) elemsize*= 3;
|
||||||
|
|
||||||
@@ -826,7 +823,7 @@ void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock **k, flo
|
|||||||
|
|
||||||
ofsp= ofs;
|
ofsp= ofs;
|
||||||
|
|
||||||
while( cp[0] ) { /* cp[0]==aantal */
|
while( cp[0] ) { /* cp[0]==amount */
|
||||||
|
|
||||||
switch(cp[1]) {
|
switch(cp[1]) {
|
||||||
case IPO_FLOAT:
|
case IPO_FLOAT:
|
||||||
@@ -852,7 +849,7 @@ void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock **k, flo
|
|||||||
cp+= 2;
|
cp+= 2;
|
||||||
ofsp++;
|
ofsp++;
|
||||||
}
|
}
|
||||||
/* gaan we moeilijk doen: als keys van lengte verschillen */
|
/* lets do it the difficult way: when keys have a different size */
|
||||||
if(flagdo & 1) {
|
if(flagdo & 1) {
|
||||||
if(flagflo & 1) {
|
if(flagflo & 1) {
|
||||||
k1tot+= k1d;
|
k1tot+= k1d;
|
||||||
@@ -918,7 +915,7 @@ void do_mesh_key(Mesh *me)
|
|||||||
if(me->totvert>100 && slurph_opt) {
|
if(me->totvert>100 && slurph_opt) {
|
||||||
step= me->totvert/50;
|
step= me->totvert/50;
|
||||||
delta*= step;
|
delta*= step;
|
||||||
/* in do_key en cp_key wordt a>tot afgevangen */
|
/* in do_key and cp_key the case a>tot is handled */
|
||||||
}
|
}
|
||||||
|
|
||||||
cfra= G.scene->r.cfra;
|
cfra= G.scene->r.cfra;
|
||||||
@@ -987,7 +984,7 @@ void do_cu_key(Curve *cu, KeyBlock **k, float *t)
|
|||||||
|
|
||||||
step= nu->pntsu*nu->pntsv;
|
step= nu->pntsu*nu->pntsv;
|
||||||
|
|
||||||
/* uitzondering omdat keys graag met volledige blokken werken */
|
/* exception because keys prefer to work with complete blocks */
|
||||||
poin= (char *)nu->bp->vec;
|
poin= (char *)nu->bp->vec;
|
||||||
poin -= a*sizeof(BPoint);
|
poin -= a*sizeof(BPoint);
|
||||||
|
|
||||||
@@ -1022,7 +1019,7 @@ void do_rel_cu_key(Curve *cu, float ctime)
|
|||||||
|
|
||||||
step= nu->pntsu*nu->pntsv;
|
step= nu->pntsu*nu->pntsv;
|
||||||
|
|
||||||
/* uitzondering omdat keys graag met volledige blokken werken */
|
/* exception because keys prefer to work with complete blocks */
|
||||||
poin= (char *)nu->bp->vec;
|
poin= (char *)nu->bp->vec;
|
||||||
poin -= a*sizeof(BPoint);
|
poin -= a*sizeof(BPoint);
|
||||||
|
|
||||||
@@ -1063,7 +1060,7 @@ void do_curve_key(Curve *cu)
|
|||||||
if(tot>100 && slurph_opt) {
|
if(tot>100 && slurph_opt) {
|
||||||
step= tot/50;
|
step= tot/50;
|
||||||
delta*= step;
|
delta*= step;
|
||||||
/* in do_key en cp_key wordt a>tot afgevangen */
|
/* in do_key and cp_key the case a>tot has been handled */
|
||||||
}
|
}
|
||||||
|
|
||||||
cfra= G.scene->r.cfra;
|
cfra= G.scene->r.cfra;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* lattice.c MIXED MODEL
|
* lattice.c
|
||||||
* june 2001 ton
|
*
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
@@ -120,10 +121,10 @@ Lattice *add_lattice()
|
|||||||
|
|
||||||
lt->typeu= lt->typev= lt->typew= KEY_BSPLINE;
|
lt->typeu= lt->typev= lt->typew= KEY_BSPLINE;
|
||||||
|
|
||||||
/* tijdelijk */
|
/* temporally */
|
||||||
lt->def= MEM_callocN(sizeof(BPoint), "lattvert");
|
lt->def= MEM_callocN(sizeof(BPoint), "lattvert");
|
||||||
|
|
||||||
resizelattice(lt); /* maakt een regelmatige lattice */
|
resizelattice(lt); /* creates a uniform lattice */
|
||||||
|
|
||||||
return lt;
|
return lt;
|
||||||
}
|
}
|
||||||
@@ -155,9 +156,9 @@ void make_local_lattice(Lattice *lt)
|
|||||||
Lattice *ltn;
|
Lattice *ltn;
|
||||||
int local=0, lib=0;
|
int local=0, lib=0;
|
||||||
|
|
||||||
/* - zijn er alleen lib users: niet doen
|
/* - only lib users: do nothing
|
||||||
* - zijn er alleen locale users: flag zetten
|
* - only local users: set flag
|
||||||
* - mixed: copy
|
* - mixed: make copy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(lt->id.lib==0) return;
|
if(lt->id.lib==0) return;
|
||||||
@@ -223,7 +224,7 @@ void calc_lat_fudu(int flag, int res, float *fu, float *du)
|
|||||||
|
|
||||||
void init_latt_deform(Object *oblatt, Object *ob)
|
void init_latt_deform(Object *oblatt, Object *ob)
|
||||||
{
|
{
|
||||||
/* we maken een array met alle verschillen */
|
/* we make an array with all differences */
|
||||||
BPoint *bp;
|
BPoint *bp;
|
||||||
float *fp, imat[4][4];
|
float *fp, imat[4][4];
|
||||||
float vec[3], fu, fv, fw, du=0.0, dv=0.0, dw=0.0;
|
float vec[3], fu, fv, fw, du=0.0, dv=0.0, dw=0.0;
|
||||||
@@ -238,27 +239,27 @@ void init_latt_deform(Object *oblatt, Object *ob)
|
|||||||
|
|
||||||
if(ob) where_is_object(ob);
|
if(ob) where_is_object(ob);
|
||||||
|
|
||||||
/* bijv bij particle systeem: ob==0 */
|
/* for example with a particle system: ob==0 */
|
||||||
if(ob==0) {
|
if(ob==0) {
|
||||||
/* in deformspace, matrix berekenen */
|
/* in deformspace, calc matrix */
|
||||||
Mat4Invert(latmat, oblatt->obmat);
|
Mat4Invert(latmat, oblatt->obmat);
|
||||||
|
|
||||||
/* terug: in deform array verwerken */
|
/* back: put in deform array */
|
||||||
Mat4Invert(imat, latmat);
|
Mat4Invert(imat, latmat);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* in deformspace, matrix berekenen */
|
/* in deformspace, calc matrix */
|
||||||
Mat4Invert(imat, oblatt->obmat);
|
Mat4Invert(imat, oblatt->obmat);
|
||||||
Mat4MulMat4(latmat, ob->obmat, imat);
|
Mat4MulMat4(latmat, ob->obmat, imat);
|
||||||
|
|
||||||
/* terug: in deform array verwerken */
|
/* back: put in deform array */
|
||||||
Mat4Invert(imat, latmat);
|
Mat4Invert(imat, latmat);
|
||||||
}
|
}
|
||||||
calc_lat_fudu(deformLatt->flag, deformLatt->pntsu, &fu, &du);
|
calc_lat_fudu(deformLatt->flag, deformLatt->pntsu, &fu, &du);
|
||||||
calc_lat_fudu(deformLatt->flag, deformLatt->pntsv, &fv, &dv);
|
calc_lat_fudu(deformLatt->flag, deformLatt->pntsv, &fv, &dv);
|
||||||
calc_lat_fudu(deformLatt->flag, deformLatt->pntsw, &fw, &dw);
|
calc_lat_fudu(deformLatt->flag, deformLatt->pntsw, &fw, &dw);
|
||||||
|
|
||||||
/* we berekenen hier steeds de u v w lattice coordinaten, weinig reden ze te onthouden */
|
/* we keep calculating the u v w lattice coordinates, not enough reason to store that */
|
||||||
|
|
||||||
vec[2]= fw;
|
vec[2]= fw;
|
||||||
for(w=0; w<deformLatt->pntsw; w++) {
|
for(w=0; w<deformLatt->pntsw; w++) {
|
||||||
@@ -288,9 +289,9 @@ void calc_latt_deform(float *co)
|
|||||||
|
|
||||||
if(latticedata==0) return;
|
if(latticedata==0) return;
|
||||||
|
|
||||||
lt= deformLatt; /* kortere notatie! */
|
lt= deformLatt; /* just for shorter notation! */
|
||||||
|
|
||||||
/* co is in lokale coords, met latmat behandelen */
|
/* co is in local coords, treat with latmat */
|
||||||
|
|
||||||
VECCOPY(vec, co);
|
VECCOPY(vec, co);
|
||||||
Mat4MulVecfl(latmat, vec);
|
Mat4MulVecfl(latmat, vec);
|
||||||
@@ -393,7 +394,7 @@ int object_deform(Object *ob)
|
|||||||
|
|
||||||
if(ob->parent==0) return 0;
|
if(ob->parent==0) return 0;
|
||||||
|
|
||||||
/* altijd proberen in deze fie de hele deform te doen: apply! */
|
/* always try to do the entire deform in this function: apply! */
|
||||||
|
|
||||||
if(ob->parent->type==OB_LATTICE) {
|
if(ob->parent->type==OB_LATTICE) {
|
||||||
|
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
|
|
||||||
/* library.c aug 94 MIXED MODEL
|
/* library.c
|
||||||
*
|
*
|
||||||
* jan 95
|
* Contains management of ID's and libraries
|
||||||
*
|
* allocate and free of all library data
|
||||||
* afhandeling ID's en libraries
|
|
||||||
* allocceren en vrijgeven alle library data
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -109,7 +107,7 @@
|
|||||||
#define MAX_IDPUP 30 /* was 24 */
|
#define MAX_IDPUP 30 /* was 24 */
|
||||||
#define MAX_LIBARRAY 100 /* was 30 */
|
#define MAX_LIBARRAY 100 /* was 30 */
|
||||||
|
|
||||||
/* ************* ALGEMEEN ************************ */
|
/* ************* general ************************ */
|
||||||
|
|
||||||
void id_lib_extern(ID *id)
|
void id_lib_extern(ID *id)
|
||||||
{
|
{
|
||||||
@@ -192,7 +190,7 @@ ListBase *wich_libbase(Main *mainlib, short type)
|
|||||||
|
|
||||||
int set_listbasepointers(Main *main, ListBase **lb)
|
int set_listbasepointers(Main *main, ListBase **lb)
|
||||||
{
|
{
|
||||||
/* BACKWARDS! let op volgorde van vrijgeven! (mesh<->mat) */
|
/* BACKWARDS! also watch order of free-ing! (mesh<->mat) */
|
||||||
|
|
||||||
lb[0]= &(main->ipo);
|
lb[0]= &(main->ipo);
|
||||||
lb[1]= &(main->key);
|
lb[1]= &(main->key);
|
||||||
@@ -232,13 +230,13 @@ int set_listbasepointers(Main *main, ListBase **lb)
|
|||||||
return 25;
|
return 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *********** ALLOC EN FREE *****************
|
/* *********** ALLOC AND FREE *****************
|
||||||
|
|
||||||
free_libblock(ListBase *lb, ID *id )
|
free_libblock(ListBase *lb, ID *id )
|
||||||
lijstbasis en datablok geven, alleen ID wordt uitgelezen
|
provide a list-basis and datablock, but only ID is read
|
||||||
|
|
||||||
void *alloc_libblock(ListBase *lb, type, name)
|
void *alloc_libblock(ListBase *lb, type, name)
|
||||||
hangt in lijst en geeft nieuw ID
|
inserts in list and returns a new ID
|
||||||
|
|
||||||
***************************** */
|
***************************** */
|
||||||
|
|
||||||
@@ -337,7 +335,7 @@ void *alloc_libblock(ListBase *lb, short type, char *name)
|
|||||||
id->us= 1;
|
id->us= 1;
|
||||||
*( (short *)id->name )= type;
|
*( (short *)id->name )= type;
|
||||||
new_id(lb, id, name);
|
new_id(lb, id, name);
|
||||||
/* alfabetisch opnieuw invoegen: zit in new_id */
|
/* alphabetic insterion: is in new_id */
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -391,7 +389,7 @@ void free_libblock(ListBase *lb, void *idv)
|
|||||||
{
|
{
|
||||||
ID *id= idv;
|
ID *id= idv;
|
||||||
|
|
||||||
switch( GS(id->name) ) { /* GetShort uit util.h */
|
switch( GS(id->name) ) { /* GetShort from util.h */
|
||||||
case ID_SCE:
|
case ID_SCE:
|
||||||
free_scene((Scene *)id);
|
free_scene((Scene *)id);
|
||||||
break;
|
break;
|
||||||
@@ -432,8 +430,6 @@ void free_libblock(ListBase *lb, void *idv)
|
|||||||
free_lamp((Lamp *)id);
|
free_lamp((Lamp *)id);
|
||||||
break;
|
break;
|
||||||
case ID_CA:
|
case ID_CA:
|
||||||
/* free_camera(id); */
|
|
||||||
/* cast wasn't here before... spooky... */
|
|
||||||
free_camera((Camera*) id);
|
free_camera((Camera*) id);
|
||||||
break;
|
break;
|
||||||
case ID_IP:
|
case ID_IP:
|
||||||
@@ -498,7 +494,7 @@ void free_libblock_us(ListBase *lb, void *idv) /* test users */
|
|||||||
|
|
||||||
void free_main(Main *mainvar)
|
void free_main(Main *mainvar)
|
||||||
{
|
{
|
||||||
/* ook aanroepen bij file inlezen, erase all, etc */
|
/* also call when reading a file, erase all, etc */
|
||||||
ListBase *lbarray[MAX_LIBARRAY];
|
ListBase *lbarray[MAX_LIBARRAY];
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
@@ -518,7 +514,7 @@ void free_main(Main *mainvar)
|
|||||||
/* ***************** ID ************************ */
|
/* ***************** ID ************************ */
|
||||||
|
|
||||||
// only used in exotic.c
|
// only used in exotic.c
|
||||||
ID *find_id(char *type, char *name) /* type: "OB" of "MA" etc */
|
ID *find_id(char *type, char *name) /* type: "OB" or "MA" etc */
|
||||||
{
|
{
|
||||||
ID *id;
|
ID *id;
|
||||||
ListBase *lb;
|
ListBase *lb;
|
||||||
@@ -693,7 +689,7 @@ static void sort_alpha_id(ListBase *lb, ID *id)
|
|||||||
{
|
{
|
||||||
ID *idtest;
|
ID *idtest;
|
||||||
|
|
||||||
/* alfabetisch opnieuw invoegen */
|
/* insert alphabetically */
|
||||||
if(lb->first!=lb->last) {
|
if(lb->first!=lb->last) {
|
||||||
BLI_remlink(lb, id);
|
BLI_remlink(lb, id);
|
||||||
|
|
||||||
@@ -705,7 +701,7 @@ static void sort_alpha_id(ListBase *lb, ID *id)
|
|||||||
}
|
}
|
||||||
idtest= idtest->next;
|
idtest= idtest->next;
|
||||||
}
|
}
|
||||||
/* als laatste */
|
/* as last */
|
||||||
if(idtest==0) {
|
if(idtest==0) {
|
||||||
BLI_addtail(lb, id);
|
BLI_addtail(lb, id);
|
||||||
}
|
}
|
||||||
@@ -714,15 +710,15 @@ static void sort_alpha_id(ListBase *lb, ID *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int new_id(ListBase *lb, ID *id, char *tname)
|
int new_id(ListBase *lb, ID *id, char *tname)
|
||||||
/* alleen locale blokken: externe en indirekte hebben al een unieke ID */
|
/* only for local blocks: external en indirect blocks already have a unique ID */
|
||||||
/* return 1: nieuwe naam gemaakt */
|
/* return 1: created a new name */
|
||||||
{
|
{
|
||||||
ID *idtest;
|
ID *idtest;
|
||||||
int nr= 0, nrtest, maxtest=32, a;
|
int nr= 0, nrtest, maxtest=32, a;
|
||||||
char aname[32], *name, left[24], leftest[24], in_use[32];
|
char aname[32], *name, left[24], leftest[24], in_use[32];
|
||||||
|
|
||||||
/* - naam splitsen
|
/* - split name
|
||||||
* - zoeken
|
* - search
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(id->lib) return 0;
|
if(id->lib) return 0;
|
||||||
@@ -738,14 +734,14 @@ int new_id(ListBase *lb, ID *id, char *tname)
|
|||||||
|
|
||||||
if(lb==0) lb= wich_libbase(G.main, GS(id->name));
|
if(lb==0) lb= wich_libbase(G.main, GS(id->name));
|
||||||
|
|
||||||
/* eerste fase: bestaat de id al? */
|
/* phase 1: id already exists? */
|
||||||
idtest= lb->first;
|
idtest= lb->first;
|
||||||
while(idtest) {
|
while(idtest) {
|
||||||
|
|
||||||
if(id!=idtest && idtest->lib==0) {
|
if(id!=idtest && idtest->lib==0) {
|
||||||
|
|
||||||
/* niet alphabetic testen! */
|
/* do not test alphabetic! */
|
||||||
/* optim */
|
/* optimized */
|
||||||
if( idtest->name[2] == name[0] ) {
|
if( idtest->name[2] == name[0] ) {
|
||||||
if(strcmp(name, idtest->name+2)==0) break;
|
if(strcmp(name, idtest->name+2)==0) break;
|
||||||
}
|
}
|
||||||
@@ -798,7 +794,7 @@ int new_id(ListBase *lb, ID *id, char *tname)
|
|||||||
left[16]= 0;
|
left[16]= 0;
|
||||||
return (new_id(lb, id, left));
|
return (new_id(lb, id, left));
|
||||||
}
|
}
|
||||||
/* this format specifier is fucked... */
|
/* this format specifier is from hell... */
|
||||||
sprintf(id->name+2, "%s.%0.3d", left, nr);
|
sprintf(id->name+2, "%s.%0.3d", left, nr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,14 +835,15 @@ void all_local(void)
|
|||||||
id->newid= 0;
|
id->newid= 0;
|
||||||
id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW);
|
id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW);
|
||||||
|
|
||||||
idn= id->next; /* id wordt mogelijk opnieuw ingevoegd */
|
idn= id->next; /* id is possibly being inserted again */
|
||||||
if(id->lib) {
|
if(id->lib) {
|
||||||
id->lib= 0;
|
id->lib= 0;
|
||||||
new_id(lbarray[a], id, 0); /* new_id doet dit alleen bij dubbele namen */
|
new_id(lbarray[a], id, 0); /* new_id only does it with double names */
|
||||||
sort_alpha_id(lbarray[a], id);
|
sort_alpha_id(lbarray[a], id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* patch: testen of de zaak wel alphabetisch is */
|
/* patch: check for alphabetic ordering */
|
||||||
|
/* has been removed... why!? (ton) */
|
||||||
/*
|
/*
|
||||||
if(idn) {
|
if(idn) {
|
||||||
if(strcasecmp(id->name, idn->name)>0) {
|
if(strcasecmp(id->name, idn->name)>0) {
|
||||||
@@ -867,7 +864,7 @@ void all_local(void)
|
|||||||
id= idn;
|
id= idn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* patch2: zorgen dat de zaak wel alphabetisch is */
|
/* patch2: make it aphabetically */
|
||||||
while( (id=tempbase.first) ) {
|
while( (id=tempbase.first) ) {
|
||||||
BLI_remlink(&tempbase, id);
|
BLI_remlink(&tempbase, id);
|
||||||
BLI_addtail(lbarray[a], id);
|
BLI_addtail(lbarray[a], id);
|
||||||
@@ -879,7 +876,7 @@ void all_local(void)
|
|||||||
|
|
||||||
void test_idbutton(char *name)
|
void test_idbutton(char *name)
|
||||||
{
|
{
|
||||||
/* vanuit buttons: als naam al bestaat: new_id aanroepen */
|
/* called from buttons: when name already exists: call new_id */
|
||||||
ListBase *lb;
|
ListBase *lb;
|
||||||
ID *idtest;
|
ID *idtest;
|
||||||
|
|
||||||
@@ -887,7 +884,7 @@ void test_idbutton(char *name)
|
|||||||
lb= wich_libbase(G.main, GS(name-2) );
|
lb= wich_libbase(G.main, GS(name-2) );
|
||||||
if(lb==0) return;
|
if(lb==0) return;
|
||||||
|
|
||||||
/* zoek welke id */
|
/* search for id */
|
||||||
idtest= lb->first;
|
idtest= lb->first;
|
||||||
while(idtest) {
|
while(idtest) {
|
||||||
if( strcmp(idtest->name+2, name)==0) break;
|
if( strcmp(idtest->name+2, name)==0) break;
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
/* material.c MIX MODEL
|
/* material.c
|
||||||
*
|
*
|
||||||
* maart 95
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -141,9 +140,9 @@ void make_local_material(Material *ma)
|
|||||||
Material *man;
|
Material *man;
|
||||||
int a, local=0, lib=0;
|
int a, local=0, lib=0;
|
||||||
|
|
||||||
/* - zijn er alleen lib users: niet doen
|
/* - only lib users: do nothing
|
||||||
* - zijn er alleen locale users: flag zetten
|
* - only local users: set flag
|
||||||
* - mixed: copy
|
* - mixed: make copy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(ma->id.lib==0) return;
|
if(ma->id.lib==0) return;
|
||||||
@@ -344,10 +343,10 @@ Material *give_current_material(Object *ob, int act)
|
|||||||
if(act>ob->totcol) act= ob->totcol;
|
if(act>ob->totcol) act= ob->totcol;
|
||||||
else if(act==0) act= 1;
|
else if(act==0) act= 1;
|
||||||
|
|
||||||
if( BTST(ob->colbits, act-1) ) { /* aan object */
|
if( BTST(ob->colbits, act-1) ) { /* in object */
|
||||||
ma= ob->mat[act-1];
|
ma= ob->mat[act-1];
|
||||||
}
|
}
|
||||||
else { /* aan data */
|
else { /* in data */
|
||||||
matarar= give_matarar(ob);
|
matarar= give_matarar(ob);
|
||||||
|
|
||||||
if(matarar && *matarar) ma= (*matarar)[act-1];
|
if(matarar && *matarar) ma= (*matarar)[act-1];
|
||||||
@@ -385,7 +384,7 @@ ID *material_from(Object *ob, int act)
|
|||||||
|
|
||||||
void test_object_materials(ID *id)
|
void test_object_materials(ID *id)
|
||||||
{
|
{
|
||||||
/* ob mat-array evenlang maken als obdata mat-array */
|
/* make the ob mat-array same size as 'ob->data' mat-array */
|
||||||
Object *ob;
|
Object *ob;
|
||||||
Mesh *me;
|
Mesh *me;
|
||||||
Curve *cu;
|
Curve *cu;
|
||||||
@@ -472,14 +471,14 @@ void assign_material(Object *ob, Material *ma, int act)
|
|||||||
ob->totcol= act;
|
ob->totcol= act;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* doe 't */
|
/* do it */
|
||||||
|
|
||||||
if( BTST(ob->colbits, act-1) ) { /* aan object */
|
if( BTST(ob->colbits, act-1) ) { /* in object */
|
||||||
mao= ob->mat[act-1];
|
mao= ob->mat[act-1];
|
||||||
if(mao) mao->id.us--;
|
if(mao) mao->id.us--;
|
||||||
ob->mat[act-1]= ma;
|
ob->mat[act-1]= ma;
|
||||||
}
|
}
|
||||||
else { /* aan data */
|
else { /* in data */
|
||||||
mao= (*matarar)[act-1];
|
mao= (*matarar)[act-1];
|
||||||
if(mao) mao->id.us--;
|
if(mao) mao->id.us--;
|
||||||
(*matarar)[act-1]= ma;
|
(*matarar)[act-1]= ma;
|
||||||
@@ -524,7 +523,7 @@ void init_render_material(Material *ma)
|
|||||||
ma->ren= MEM_mallocN(sizeof(Material), "initrendermaterial");
|
ma->ren= MEM_mallocN(sizeof(Material), "initrendermaterial");
|
||||||
memcpy(ma->ren, ma, sizeof(Material));
|
memcpy(ma->ren, ma, sizeof(Material));
|
||||||
|
|
||||||
/* alle texcoflags van mtex adden */
|
/* add all texcoflags from mtex */
|
||||||
ma= ma->ren;
|
ma= ma->ren;
|
||||||
ma->texco= 0;
|
ma->texco= 0;
|
||||||
ma->mapto= 0;
|
ma->mapto= 0;
|
||||||
@@ -540,7 +539,7 @@ void init_render_material(Material *ma)
|
|||||||
/* mtex->projz= PROJ_Z; */
|
/* mtex->projz= PROJ_Z; */
|
||||||
/* mtex->mapping= MTEX_FLAT; */
|
/* mtex->mapping= MTEX_FLAT; */
|
||||||
}
|
}
|
||||||
/* hier niet testen op mtex->object en mtex->texco op TEXCO_ORCO zetten: mtex is linked! */
|
/* do not test for mtex->object and set mtex->texco at TEXCO_ORCO: mtex is linked! */
|
||||||
|
|
||||||
ma->texco |= mtex->texco;
|
ma->texco |= mtex->texco;
|
||||||
ma->mapto |= mtex->mapto;
|
ma->mapto |= mtex->mapto;
|
||||||
@@ -677,16 +676,16 @@ void delete_material_index()
|
|||||||
ob= ((G.scene->basact)? (G.scene->basact->object) : 0) ;
|
ob= ((G.scene->basact)? (G.scene->basact->object) : 0) ;
|
||||||
if(ob==0 || ob->totcol==0) return;
|
if(ob==0 || ob->totcol==0) return;
|
||||||
|
|
||||||
/* neem als uitgangspunt de mesh/curve/mball, verwijder 1 index, EN bij alle ob's
|
/* take a mesh/curve/mball as starting point, remove 1 index,
|
||||||
* die ook zelfde ob->data hebben
|
* AND with all objects that share the ob->data
|
||||||
*
|
*
|
||||||
* Daarna ook indexen in mesh/curve/mball wijzigen!!!
|
* after that check indices in mesh/curve/mball!!!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
totcolp= give_totcolp(ob);
|
totcolp= give_totcolp(ob);
|
||||||
matarar= give_matarar(ob);
|
matarar= give_matarar(ob);
|
||||||
|
|
||||||
/* we deleten de actcol */
|
/* we delete the actcol */
|
||||||
if(ob->totcol) {
|
if(ob->totcol) {
|
||||||
mao= (*matarar)[ob->actcol-1];
|
mao= (*matarar)[ob->actcol-1];
|
||||||
if(mao) mao->id.us--;
|
if(mao) mao->id.us--;
|
||||||
@@ -708,7 +707,7 @@ void delete_material_index()
|
|||||||
|
|
||||||
if(obt->data==ob->data) {
|
if(obt->data==ob->data) {
|
||||||
|
|
||||||
/* LET OP: actcol hier niet van ob of van obt pakken (kan nul worden) */
|
/* WATCH IT: do not use actcol from ob or from obt (can become zero) */
|
||||||
mao= obt->mat[actcol-1];
|
mao= obt->mat[actcol-1];
|
||||||
if(mao) mao->id.us--;
|
if(mao) mao->id.us--;
|
||||||
|
|
||||||
@@ -726,7 +725,7 @@ void delete_material_index()
|
|||||||
allqueue(REDRAWBUTSMAT, 0);
|
allqueue(REDRAWBUTSMAT, 0);
|
||||||
|
|
||||||
|
|
||||||
/* indexen van mesh goedzetten */
|
/* check indices from mesh */
|
||||||
|
|
||||||
if(ob->type==OB_MESH) {
|
if(ob->type==OB_MESH) {
|
||||||
me= get_mesh(ob);
|
me= get_mesh(ob);
|
||||||
|
Reference in New Issue
Block a user