The last of the blenkernel files with translated comments
This commit is contained in:
@@ -1,13 +1,11 @@
|
|||||||
/* mball.c MIXED MODEL
|
/* mball.c
|
||||||
*
|
|
||||||
* mei 95
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* MetaBalls are created from a single Object (with a name without number in it),
|
||||||
|
* here the DispList and BoundBox also is located.
|
||||||
|
* All objects with the same name (but with a number in it) are added to this.
|
||||||
*
|
*
|
||||||
* METABALLS ontstaan vanuit een Object (naam zonder nr), hier zit de DispList en boundbox,
|
* texture coordinates are patched within the displist
|
||||||
* alle objecten met zelfde naam (en een nr) worden hieraan toegevoegd.
|
|
||||||
*
|
|
||||||
* De texture coordinaten zitten als loos element in de displist.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -90,7 +88,7 @@ void unlink_mball(MetaBall *mb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* niet mball zelf vrijgeven */
|
/* do not free mball itself */
|
||||||
void free_mball(MetaBall *mb)
|
void free_mball(MetaBall *mb)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -141,10 +139,10 @@ void make_local_mball(MetaBall *mb)
|
|||||||
Object *ob;
|
Object *ob;
|
||||||
MetaBall *mbn;
|
MetaBall *mbn;
|
||||||
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(mb->id.lib==0) return;
|
if(mb->id.lib==0) return;
|
||||||
@@ -248,7 +246,7 @@ void make_orco_mball(Object *ob)
|
|||||||
float loc[3], size[3];
|
float loc[3], size[3];
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
/* size en loc restoren */
|
/* restore size and loc */
|
||||||
bb= ob->bb;
|
bb= ob->bb;
|
||||||
loc[0]= (bb->vec[0][0]+bb->vec[4][0])/2.0f;
|
loc[0]= (bb->vec[0][0]+bb->vec[4][0])/2.0f;
|
||||||
size[0]= bb->vec[4][0]-loc[0];
|
size[0]= bb->vec[4][0]-loc[0];
|
||||||
@@ -300,7 +298,7 @@ Object *find_basis_mball(Object *basis)
|
|||||||
|
|
||||||
/* ******************** ARITH ************************* */
|
/* ******************** ARITH ************************* */
|
||||||
|
|
||||||
/* DANKBAAR GEBRUIK GEMAAKT VAN (EN COMPLEET VERANDERD) :
|
/* BASED AT CODE (but mostly rewritten) :
|
||||||
* C code from the article
|
* C code from the article
|
||||||
* "An Implicit Surface Polygonizer"
|
* "An Implicit Surface Polygonizer"
|
||||||
* by Jules Bloomenthal, jbloom@beauty.gmu.edu
|
* by Jules Bloomenthal, jbloom@beauty.gmu.edu
|
||||||
@@ -551,7 +549,7 @@ void accum_mballfaces(int i1, int i2, int i3, int i4)
|
|||||||
|
|
||||||
cur= indices+4*curindex;
|
cur= indices+4*curindex;
|
||||||
|
|
||||||
/* voorkomen dat nulcodes voorkomen */
|
/* prevent zero codes for faces indices */
|
||||||
if(i3==0) {
|
if(i3==0) {
|
||||||
if(i4) {
|
if(i4) {
|
||||||
i3= i4;
|
i3= i4;
|
||||||
@@ -585,18 +583,17 @@ struct pgn_elements {
|
|||||||
|
|
||||||
void *new_pgn_element(int size)
|
void *new_pgn_element(int size)
|
||||||
{
|
{
|
||||||
/* gedurende het polygonizeren worden duizenden elementen aangemaakt en
|
/* during polygonize 1000s of elements are allocated
|
||||||
* nooit (tussendoor) vrijgegeven. Alleen op eind is vrijgeven nodig.
|
* and never freed inbetween. Freeing only done at the end.
|
||||||
*/
|
*/
|
||||||
int blocksize= 16384;
|
int blocksize= 16384;
|
||||||
static int offs= 0; /* het huidige vrije adres */
|
static int offs= 0; /* the current free address */
|
||||||
static struct pgn_elements *cur= 0;
|
static struct pgn_elements *cur= 0;
|
||||||
static ListBase lb= {0, 0};
|
static ListBase lb= {0, 0};
|
||||||
void *adr;
|
void *adr;
|
||||||
|
|
||||||
if(size>10000 || size==0) {
|
if(size>10000 || size==0) {
|
||||||
printf("incorrect use of new_pgn_element\n");
|
printf("incorrect use of new_pgn_element\n");
|
||||||
/* exit(0); */
|
|
||||||
}
|
}
|
||||||
else if(size== -1) {
|
else if(size== -1) {
|
||||||
cur= lb.first;
|
cur= lb.first;
|
||||||
@@ -740,9 +737,6 @@ void docube(CUBE *cube, PROCESS *p)
|
|||||||
* and add new cube to cube stack */
|
* and add new cube to cube stack */
|
||||||
|
|
||||||
void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, int c4, PROCESS *p)
|
void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, int c4, PROCESS *p)
|
||||||
/* CUBE *old; */
|
|
||||||
/* PROCESS *p; */
|
|
||||||
/* int i, j, k, bit, c1, c2, c3, c4; */
|
|
||||||
{
|
{
|
||||||
CUBE newc;
|
CUBE newc;
|
||||||
CUBES *oldcubes = p->cubes;
|
CUBES *oldcubes = p->cubes;
|
||||||
@@ -794,14 +788,12 @@ void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, i
|
|||||||
set (and cache) its function value */
|
set (and cache) its function value */
|
||||||
|
|
||||||
CORNER *setcorner (PROCESS* p, int i, int j, int k)
|
CORNER *setcorner (PROCESS* p, int i, int j, int k)
|
||||||
/* int i, j, k; */
|
|
||||||
/* PROCESS *p; */
|
|
||||||
{
|
{
|
||||||
/* for speed, do corner value caching here */
|
/* for speed, do corner value caching here */
|
||||||
CORNER *c;
|
CORNER *c;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
/* bestaat corner al? */
|
/* does corner exist? */
|
||||||
index = HASH(i, j, k);
|
index = HASH(i, j, k);
|
||||||
c = p->corners[index];
|
c = p->corners[index];
|
||||||
|
|
||||||
@@ -865,7 +857,6 @@ int nextcwedge (int edge, int face)
|
|||||||
/* otherface: return face adjoining edge that is not the given face */
|
/* otherface: return face adjoining edge that is not the given face */
|
||||||
|
|
||||||
int otherface (int edge, int face)
|
int otherface (int edge, int face)
|
||||||
/* int edge, face; */
|
|
||||||
{
|
{
|
||||||
int other = leftface[edge];
|
int other = leftface[edge];
|
||||||
return face == other? rightface[edge] : other;
|
return face == other? rightface[edge] : other;
|
||||||
@@ -946,8 +937,6 @@ void BKE_freecubetable(void)
|
|||||||
* return 1 if already set; otherwise, set and return 0 */
|
* return 1 if already set; otherwise, set and return 0 */
|
||||||
|
|
||||||
int setcenter(CENTERLIST *table[], int i, int j, int k)
|
int setcenter(CENTERLIST *table[], int i, int j, int k)
|
||||||
/* CENTERLIST *table[]; */
|
|
||||||
/* int i, j, k; */
|
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
CENTERLIST *newc, *l, *q;
|
CENTERLIST *newc, *l, *q;
|
||||||
@@ -977,8 +966,6 @@ void setedge (EDGELIST *table[],
|
|||||||
int k1, int i2,
|
int k1, int i2,
|
||||||
int j2, int k2,
|
int j2, int k2,
|
||||||
int vid)
|
int vid)
|
||||||
/* EDGELIST *table[]; */
|
|
||||||
/* int i1, j1, k1, i2, j2, k2, vid; */
|
|
||||||
{
|
{
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
EDGELIST *newe;
|
EDGELIST *newe;
|
||||||
@@ -1013,8 +1000,6 @@ void setedge (EDGELIST *table[],
|
|||||||
int getedge (EDGELIST *table[],
|
int getedge (EDGELIST *table[],
|
||||||
int i1, int j1, int k1,
|
int i1, int j1, int k1,
|
||||||
int i2, int j2, int k2)
|
int i2, int j2, int k2)
|
||||||
/* EDGELIST *table[]; */
|
|
||||||
/* int i1, j1, k1, i2, j2, k2; */
|
|
||||||
{
|
{
|
||||||
EDGELIST *q;
|
EDGELIST *q;
|
||||||
|
|
||||||
@@ -1051,8 +1036,6 @@ int getedge (EDGELIST *table[],
|
|||||||
/* addtovertices: add v to sequence of vertices */
|
/* addtovertices: add v to sequence of vertices */
|
||||||
|
|
||||||
void addtovertices (VERTICES *vertices, VERTEX v)
|
void addtovertices (VERTICES *vertices, VERTEX v)
|
||||||
/* VERTICES *vertices; */
|
|
||||||
/* VERTEX v; */
|
|
||||||
{
|
{
|
||||||
if (vertices->count == vertices->max) {
|
if (vertices->count == vertices->max) {
|
||||||
int i;
|
int i;
|
||||||
@@ -1071,8 +1054,6 @@ void addtovertices (VERTICES *vertices, VERTEX v)
|
|||||||
/* vnormal: compute unit length surface normal at point */
|
/* vnormal: compute unit length surface normal at point */
|
||||||
|
|
||||||
void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v)
|
void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v)
|
||||||
/* MB_POINT *point, *v; */
|
|
||||||
/* PROCESS *p; */
|
|
||||||
{
|
{
|
||||||
float delta= 0.2f*p->delta;
|
float delta= 0.2f*p->delta;
|
||||||
float f = p->function(point->x, point->y, point->z);
|
float f = p->function(point->x, point->y, point->z);
|
||||||
@@ -1124,8 +1105,6 @@ void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v)
|
|||||||
|
|
||||||
|
|
||||||
int vertid (CORNER *c1, CORNER *c2, PROCESS *p)
|
int vertid (CORNER *c1, CORNER *c2, PROCESS *p)
|
||||||
/* CORNER *c1, *c2; */
|
|
||||||
/* PROCESS *p; */
|
|
||||||
{
|
{
|
||||||
VERTEX v;
|
VERTEX v;
|
||||||
MB_POINT a, b;
|
MB_POINT a, b;
|
||||||
@@ -1226,14 +1205,14 @@ void polygonize(PROCESS *mbproc)
|
|||||||
|
|
||||||
converge(&in, &out, -1.0, mbproc->function, &mbproc->start);
|
converge(&in, &out, -1.0, mbproc->function, &mbproc->start);
|
||||||
|
|
||||||
/* NEW1: zorg voor correcte uitgangspositie */
|
/* NEW1: make sure correct starting position */
|
||||||
i= (int)floor(mbproc->start.x/mbproc->size );
|
i= (int)floor(mbproc->start.x/mbproc->size );
|
||||||
j= (int)floor(mbproc->start.y/mbproc->size );
|
j= (int)floor(mbproc->start.y/mbproc->size );
|
||||||
k= (int)floor(mbproc->start.z/mbproc->size );
|
k= (int)floor(mbproc->start.z/mbproc->size );
|
||||||
|
|
||||||
mbproc->start.x= mbproc->start.y= mbproc->start.z= 0.0;
|
mbproc->start.x= mbproc->start.y= mbproc->start.z= 0.0;
|
||||||
|
|
||||||
/* dit gaat niet altijd goed: soms wordt een bal niet gevonden. waarom? */
|
/* but it doesn't always work, sometimes it doesn't see a ball, but why? (ton) */
|
||||||
|
|
||||||
/* test if cube has been found before */
|
/* test if cube has been found before */
|
||||||
if( setcenter(mbproc->centers, i, j, k)==0 ) {
|
if( setcenter(mbproc->centers, i, j, k)==0 ) {
|
||||||
@@ -1368,7 +1347,7 @@ float init_meta(Object *ob) /* return totsize */
|
|||||||
|
|
||||||
splitIDname(ob->id.name+2, obname, &obnr);
|
splitIDname(ob->id.name+2, obname, &obnr);
|
||||||
|
|
||||||
/* hoofdarray maken */
|
/* make main array */
|
||||||
|
|
||||||
next_object(0, 0, 0);
|
next_object(0, 0, 0);
|
||||||
while(next_object(1, &base, &bob)) {
|
while(next_object(1, &base, &bob)) {
|
||||||
@@ -1395,7 +1374,7 @@ float init_meta(Object *ob) /* return totsize */
|
|||||||
ml= editelems.first;
|
ml= editelems.first;
|
||||||
else ml= mb->elems.first;
|
else ml= mb->elems.first;
|
||||||
|
|
||||||
/* mat is de matrix om van deze mball in de basis-mbal te komen */
|
/* mat is the matrix to transform from mball into the basis-mbal */
|
||||||
mat= new_pgn_element(4*4*sizeof(float));
|
mat= new_pgn_element(4*4*sizeof(float));
|
||||||
Mat4MulMat4(mat, bob->obmat, obinv);
|
Mat4MulMat4(mat, bob->obmat, obinv);
|
||||||
|
|
||||||
@@ -1407,7 +1386,7 @@ float init_meta(Object *ob) /* return totsize */
|
|||||||
while(ml && totelem<MB_MAXELEM) {
|
while(ml && totelem<MB_MAXELEM) {
|
||||||
a= totelem;
|
a= totelem;
|
||||||
|
|
||||||
/* kopie maken i.v.m. duplicates */
|
/* make a copy because of duplicates */
|
||||||
mainb[a]= new_pgn_element(sizeof(MetaElem));
|
mainb[a]= new_pgn_element(sizeof(MetaElem));
|
||||||
*(mainb[a])= *ml;
|
*(mainb[a])= *ml;
|
||||||
|
|
||||||
@@ -1424,7 +1403,7 @@ float init_meta(Object *ob) /* return totsize */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* totsize (= 'manhattan' straal) berekenen */
|
/* totsize (= 'manhattan' radius) */
|
||||||
totsize= 0.0;
|
totsize= 0.0;
|
||||||
for(a=0; a<totelem; a++) {
|
for(a=0; a<totelem; a++) {
|
||||||
|
|
||||||
@@ -1491,13 +1470,13 @@ void metaball_polygonize(Object *ob)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* width is afmeting per polygoniseerkubus */
|
/* width is size per polygonize cube */
|
||||||
if(R.flag & R_RENDERING) width= mb->rendersize;
|
if(R.flag & R_RENDERING) width= mb->rendersize;
|
||||||
else {
|
else {
|
||||||
width= mb->wiresize;
|
width= mb->wiresize;
|
||||||
if(G.moving && mb->flag==MB_UPDATE_HALFRES) width*= 2;
|
if(G.moving && mb->flag==MB_UPDATE_HALFRES) width*= 2;
|
||||||
}
|
}
|
||||||
/* nr_cubes is voor de veiligheid, minmaal de totsize */
|
/* nr_cubes is just for safety, minimum is totsize */
|
||||||
nr_cubes= (int)(0.5+totsize/width);
|
nr_cubes= (int)(0.5+totsize/width);
|
||||||
|
|
||||||
/* init process */
|
/* init process */
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
/* mesh.c MIXED MODEL
|
/* mesh.c
|
||||||
*
|
*
|
||||||
* jan/maart 95
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
@@ -100,7 +99,7 @@ int update_realtime_texture(TFace *tface, double time)
|
|||||||
if(ima->tpageflag & IMA_TWINANIM) {
|
if(ima->tpageflag & IMA_TWINANIM) {
|
||||||
if(ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1;
|
if(ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1;
|
||||||
|
|
||||||
/* check: zit de bindcode niet het array? Vrijgeven. (nog doen) */
|
/* check: is the bindcode not in the array? Then free. (still to do) */
|
||||||
|
|
||||||
diff = (float)(time-ima->lastupdate);
|
diff = (float)(time-ima->lastupdate);
|
||||||
|
|
||||||
@@ -156,7 +155,7 @@ void unlink_mesh(Mesh *me)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* niet mesh zelf vrijgeven */
|
/* do not free mesh itself */
|
||||||
void free_mesh(Mesh *me)
|
void free_mesh(Mesh *me)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -276,7 +275,7 @@ void make_local_tface(Mesh *me)
|
|||||||
tface= me->tface;
|
tface= me->tface;
|
||||||
while(a--) {
|
while(a--) {
|
||||||
|
|
||||||
/* speciaal geval: ima altijd meteen lokaal */
|
/* special case: ima always local immediately */
|
||||||
if(tface->tpage) {
|
if(tface->tpage) {
|
||||||
ima= tface->tpage;
|
ima= tface->tpage;
|
||||||
if(ima->id.lib) {
|
if(ima->id.lib) {
|
||||||
@@ -295,11 +294,11 @@ void make_local_mesh(Mesh *me)
|
|||||||
Object *ob;
|
Object *ob;
|
||||||
Mesh *men;
|
Mesh *men;
|
||||||
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(me->id.lib==0) return;
|
if(me->id.lib==0) return;
|
||||||
if(me->id.us==1) {
|
if(me->id.us==1) {
|
||||||
@@ -501,7 +500,7 @@ void make_orco_mesh(Mesh *me)
|
|||||||
orco[1]= (fp[1]-me->loc[1])/me->size[1];
|
orco[1]= (fp[1]-me->loc[1])/me->size[1];
|
||||||
orco[2]= (fp[2]-me->loc[2])/me->size[2];
|
orco[2]= (fp[2]-me->loc[2])/me->size[2];
|
||||||
|
|
||||||
/* mvert alleen ophogen als totvert <= kb->totelem */
|
/* only increase mvert when totvert <= kb->totelem */
|
||||||
if(a<kb->totelem) fp+=3;
|
if(a<kb->totelem) fp+=3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -517,7 +516,7 @@ void make_orco_mesh(Mesh *me)
|
|||||||
orco[1]= (mvert->co[1]-me->loc[1])/me->size[1];
|
orco[1]= (mvert->co[1]-me->loc[1])/me->size[1];
|
||||||
orco[2]= (mvert->co[2]-me->loc[2])/me->size[2];
|
orco[2]= (mvert->co[2]-me->loc[2])/me->size[2];
|
||||||
|
|
||||||
/* mvert alleen ophogen als totvert <= me->totvert */
|
/* only increase mvert when totvert <= me->totvert */
|
||||||
if(a<me->totvert) mvert++;
|
if(a<me->totvert) mvert++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -560,7 +559,7 @@ void test_index_mface(MFace *mface, int nr)
|
|||||||
nr--;
|
nr--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* voorkom dat een nul op de verkeerde plek staat */
|
/* prevent a zero at wrong index location */
|
||||||
if(nr==2) {
|
if(nr==2) {
|
||||||
if(mface->v2==0) SWAP(int, mface->v1, mface->v2);
|
if(mface->v2==0) SWAP(int, mface->v1, mface->v2);
|
||||||
}
|
}
|
||||||
@@ -608,7 +607,7 @@ void test_index_mface(MFace *mface, int nr)
|
|||||||
|
|
||||||
void test_index_mface()
|
void test_index_mface()
|
||||||
|
|
||||||
but it fixes texture coordinates as well.
|
but it fixes texture coordinates as well.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UVCOPY(t, s) memcpy(t, s, 2 * sizeof(float));
|
#define UVCOPY(t, s) memcpy(t, s, 2 * sizeof(float));
|
||||||
@@ -637,7 +636,7 @@ void test_index_face(MFace *mface, TFace *tface, int nr)
|
|||||||
nr--;
|
nr--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* voorkom dat een nul op de verkeerde plek staat */
|
/* prevent a zero at wrong index location */
|
||||||
if(nr==2) {
|
if(nr==2) {
|
||||||
if(mface->v2==0) SWAP(int, mface->v1, mface->v2);
|
if(mface->v2==0) SWAP(int, mface->v1, mface->v2);
|
||||||
}
|
}
|
||||||
@@ -854,14 +853,14 @@ void nurbs_to_mesh(Object *ob)
|
|||||||
cu= ob->data;
|
cu= ob->data;
|
||||||
|
|
||||||
if(ob->type==OB_CURVE) {
|
if(ob->type==OB_CURVE) {
|
||||||
/* regel: dl->type INDEX3 altijd vooraan in lijst */
|
/* rule: dl->type INDEX3 always as first in list */
|
||||||
dl= cu->disp.first;
|
dl= cu->disp.first;
|
||||||
if(dl->type!=DL_INDEX3) {
|
if(dl->type!=DL_INDEX3) {
|
||||||
curve_to_filledpoly(ob->data, &cu->disp);
|
curve_to_filledpoly(ob->data, &cu->disp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tellen */
|
/* count */
|
||||||
dl= cu->disp.first;
|
dl= cu->disp.first;
|
||||||
while(dl) {
|
while(dl) {
|
||||||
if(dl->type==DL_SEGM) {
|
if(dl->type==DL_SEGM) {
|
||||||
@@ -890,7 +889,7 @@ void nurbs_to_mesh(Object *ob)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mesh maken */
|
/* make mesh */
|
||||||
me= add_mesh();
|
me= add_mesh();
|
||||||
me->totvert= totvert;
|
me->totvert= totvert;
|
||||||
me->totface= totvlak;
|
me->totface= totvlak;
|
||||||
@@ -903,7 +902,7 @@ void nurbs_to_mesh(Object *ob)
|
|||||||
mvert=me->mvert= MEM_callocN(me->totvert*sizeof(MVert), "cumesh1");
|
mvert=me->mvert= MEM_callocN(me->totvert*sizeof(MVert), "cumesh1");
|
||||||
mface=me->mface= MEM_callocN(me->totface*sizeof(MFace), "cumesh2");
|
mface=me->mface= MEM_callocN(me->totface*sizeof(MFace), "cumesh2");
|
||||||
|
|
||||||
/* verts en vlakken */
|
/* verts and faces */
|
||||||
vertcount= 0;
|
vertcount= 0;
|
||||||
|
|
||||||
dl= cu->disp.first;
|
dl= cu->disp.first;
|
||||||
@@ -1000,9 +999,9 @@ void nurbs_to_mesh(Object *ob)
|
|||||||
|
|
||||||
if( (dl->flag & 2)==0 && a==dl->parts-1) break;
|
if( (dl->flag & 2)==0 && a==dl->parts-1) break;
|
||||||
|
|
||||||
if(dl->flag & 1) { /* p2 -> p1 -> */
|
if(dl->flag & 1) { /* p2 -> p1 -> */
|
||||||
p1= startvert+ dl->nr*a; /* p4 -> p3 -> */
|
p1= startvert+ dl->nr*a; /* p4 -> p3 -> */
|
||||||
p2= p1+ dl->nr-1; /* -----> volgende rij */
|
p2= p1+ dl->nr-1; /* -----> next row */
|
||||||
p3= p1+ dl->nr;
|
p3= p1+ dl->nr;
|
||||||
p4= p2+ dl->nr;
|
p4= p2+ dl->nr;
|
||||||
b= 0;
|
b= 0;
|
||||||
@@ -1049,7 +1048,7 @@ void nurbs_to_mesh(Object *ob)
|
|||||||
|
|
||||||
tex_space_mesh(me);
|
tex_space_mesh(me);
|
||||||
|
|
||||||
/* andere users */
|
/* other users */
|
||||||
ob1= G.main->object.first;
|
ob1= G.main->object.first;
|
||||||
while(ob1) {
|
while(ob1) {
|
||||||
if(ob1->data==cu) {
|
if(ob1->data==cu) {
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
/* object.c MIXED MODEL
|
/* object.c
|
||||||
*
|
*
|
||||||
* jan 95
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -105,7 +104,7 @@
|
|||||||
/* Local function protos */
|
/* Local function protos */
|
||||||
static void solve_parenting (Object *ob, Object *par, float slowmat[][4], int simul);
|
static void solve_parenting (Object *ob, Object *par, float slowmat[][4], int simul);
|
||||||
|
|
||||||
float originmat[3][3]; /* na where_is_object(), kan her en der gebruikt worden */
|
float originmat[3][3]; /* after where_is_object(), can be used in other functions (bad!) */
|
||||||
Object workob;
|
Object workob;
|
||||||
|
|
||||||
void clear_workob(void)
|
void clear_workob(void)
|
||||||
@@ -146,12 +145,12 @@ void update_base_layer(Object *ob)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* niet object zelf vrijgeven */
|
/* do not free object itself */
|
||||||
void free_object(Object *ob)
|
void free_object(Object *ob)
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
/* specifieke data loskoppelen */
|
/* disconnect specific data */
|
||||||
if(ob->data) {
|
if(ob->data) {
|
||||||
ID *id= ob->data;
|
ID *id= ob->data;
|
||||||
id->us--;
|
id->us--;
|
||||||
@@ -212,7 +211,7 @@ void unlink_object(Object *ob)
|
|||||||
unlink_controllers(&ob->controllers);
|
unlink_controllers(&ob->controllers);
|
||||||
unlink_actuators(&ob->actuators);
|
unlink_actuators(&ob->actuators);
|
||||||
|
|
||||||
/* alle objecten aflopen: parents en bevels */
|
/* check all objects: parents en bevels */
|
||||||
obt= G.main->object.first;
|
obt= G.main->object.first;
|
||||||
while(obt) {
|
while(obt) {
|
||||||
if(obt->id.lib==0) {
|
if(obt->id.lib==0) {
|
||||||
@@ -247,13 +246,13 @@ void unlink_object(Object *ob)
|
|||||||
obt= obt->id.next;
|
obt= obt->id.next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* materialen */
|
/* materials */
|
||||||
mat= G.main->mat.first;
|
mat= G.main->mat.first;
|
||||||
while(mat) {
|
while(mat) {
|
||||||
|
|
||||||
for(a=0; a<8; a++) {
|
for(a=0; a<8; a++) {
|
||||||
if(mat->mtex[a] && ob==mat->mtex[a]->object) {
|
if(mat->mtex[a] && ob==mat->mtex[a]->object) {
|
||||||
/* eigenlijk testen op lib */
|
/* actually, test for lib here... to do */
|
||||||
mat->mtex[a]->object= 0;
|
mat->mtex[a]->object= 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,7 +288,7 @@ void unlink_object(Object *ob)
|
|||||||
wrld= wrld->id.next;
|
wrld= wrld->id.next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scene's */
|
/* scenes */
|
||||||
sce= G.main->scene.first;
|
sce= G.main->scene.first;
|
||||||
while(sce) {
|
while(sce) {
|
||||||
if(sce->id.lib==0) {
|
if(sce->id.lib==0) {
|
||||||
@@ -382,11 +381,11 @@ void make_local_camera(Camera *cam)
|
|||||||
Object *ob;
|
Object *ob;
|
||||||
Camera *camn;
|
Camera *camn;
|
||||||
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(cam->id.lib==0) return;
|
if(cam->id.lib==0) return;
|
||||||
if(cam->id.us==1) {
|
if(cam->id.us==1) {
|
||||||
@@ -482,11 +481,11 @@ void make_local_lamp(Lamp *la)
|
|||||||
Object *ob;
|
Object *ob;
|
||||||
Lamp *lan;
|
Lamp *lan;
|
||||||
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(la->id.lib==0) return;
|
if(la->id.lib==0) return;
|
||||||
if(la->id.us==1) {
|
if(la->id.us==1) {
|
||||||
@@ -601,8 +600,8 @@ static char *get_obdata_defname(int type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* algemene add: in G.scene, met layer uit area en default naam */
|
/* general add: to G.scene, with layer from area and default name */
|
||||||
/* maakt alle minimaal nodige datablokken aan, zonder vertices etc. */
|
/* creates minimum required data, but without vertices etc. */
|
||||||
Object *add_object(int type)
|
Object *add_object(int type)
|
||||||
{
|
{
|
||||||
Object *ob;
|
Object *ob;
|
||||||
@@ -649,7 +648,7 @@ Object *add_object(int type)
|
|||||||
ob->dupon= 1; ob->dupoff= 0;
|
ob->dupon= 1; ob->dupoff= 0;
|
||||||
ob->dupsta= 1; ob->dupend= 100;
|
ob->dupsta= 1; ob->dupend= 100;
|
||||||
|
|
||||||
/* Gameengine defaults*/
|
/* Game engine defaults*/
|
||||||
ob->mass= ob->inertia= 1.0f;
|
ob->mass= ob->inertia= 1.0f;
|
||||||
ob->formfactor= 0.4f;
|
ob->formfactor= 0.4f;
|
||||||
ob->damping= 0.04f;
|
ob->damping= 0.04f;
|
||||||
@@ -727,7 +726,7 @@ Object *copy_object(Object *ob)
|
|||||||
if (actcon)
|
if (actcon)
|
||||||
obn->activecon = actcon;
|
obn->activecon = actcon;
|
||||||
|
|
||||||
/* usernummers ophogen */
|
/* increase user numbers */
|
||||||
id_us_plus((ID *)obn->data);
|
id_us_plus((ID *)obn->data);
|
||||||
id_us_plus((ID *)obn->ipo);
|
id_us_plus((ID *)obn->ipo);
|
||||||
id_us_plus((ID *)obn->action);
|
id_us_plus((ID *)obn->action);
|
||||||
@@ -757,11 +756,11 @@ void make_local_object(Object *ob)
|
|||||||
Scene *sce;
|
Scene *sce;
|
||||||
Base *base;
|
Base *base;
|
||||||
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(ob->id.lib==0) return;
|
if(ob->id.lib==0) return;
|
||||||
if(ob->id.us==1) {
|
if(ob->id.us==1) {
|
||||||
@@ -817,7 +816,7 @@ void make_local_object(Object *ob)
|
|||||||
|
|
||||||
/* *************** CALC ****************** */
|
/* *************** CALC ****************** */
|
||||||
|
|
||||||
/* er zit ook een tijdberekening in de drawobject() */
|
/* there is also a timing calculation in drawobject() */
|
||||||
|
|
||||||
float bluroffs= 0.0;
|
float bluroffs= 0.0;
|
||||||
int no_speed_curve= 0;
|
int no_speed_curve= 0;
|
||||||
@@ -835,11 +834,11 @@ void disable_speed_curve(int val)
|
|||||||
|
|
||||||
float bsystem_time(Object *ob, Object *par, float cfra, float ofs)
|
float bsystem_time(Object *ob, Object *par, float cfra, float ofs)
|
||||||
{
|
{
|
||||||
/* geeft float terug ( zie ook frame_to_float in ipo.c) */
|
/* returns float ( see frame_to_float in ipo.c) */
|
||||||
|
|
||||||
if(no_speed_curve==0) if(ob && ob->ipo) cfra= calc_ipo_time(ob->ipo, cfra);
|
if(no_speed_curve==0) if(ob && ob->ipo) cfra= calc_ipo_time(ob->ipo, cfra);
|
||||||
|
|
||||||
/* tweede field */
|
/* 2nd field */
|
||||||
if(R.flag & R_SEC_FIELD) {
|
if(R.flag & R_SEC_FIELD) {
|
||||||
if(R.r.mode & R_FIELDSTILL); else cfra+= .5;
|
if(R.r.mode & R_FIELDSTILL); else cfra+= .5;
|
||||||
}
|
}
|
||||||
@@ -930,7 +929,7 @@ void ob_parcurve(Object *ob, Object *par, float mat[][4])
|
|||||||
if(cu->path==0 || cu->path->data==0) calc_curvepath(par);
|
if(cu->path==0 || cu->path->data==0) calc_curvepath(par);
|
||||||
if(cu->path==0) return;
|
if(cu->path==0) return;
|
||||||
|
|
||||||
/* uitzondering afvangen: curve paden die als duplicator worden gebruikt */
|
/* catch exceptions: curve paths used as a duplicator */
|
||||||
if(enable_cu_speed) {
|
if(enable_cu_speed) {
|
||||||
ctime= bsystem_time(ob, par, (float)G.scene->r.cfra, 0.0);
|
ctime= bsystem_time(ob, par, (float)G.scene->r.cfra, 0.0);
|
||||||
|
|
||||||
@@ -999,7 +998,7 @@ void ob_parlimb(Object *ob, Object *par, float mat[][4])
|
|||||||
float ang=0.0;
|
float ang=0.0;
|
||||||
int cur=0;
|
int cur=0;
|
||||||
|
|
||||||
/* in lokale ob space */
|
/* in local ob space */
|
||||||
Mat4One(mat);
|
Mat4One(mat);
|
||||||
|
|
||||||
ika= par->data;
|
ika= par->data;
|
||||||
@@ -1058,7 +1057,7 @@ void give_parvert(Object *par, int nr, float *vec)
|
|||||||
if(me->totvert) {
|
if(me->totvert) {
|
||||||
if(nr >= me->totvert) nr= 0;
|
if(nr >= me->totvert) nr= 0;
|
||||||
|
|
||||||
/* is er deform */
|
/* is there a deform */
|
||||||
dl= find_displist(&par->disp, DL_VERTS);
|
dl= find_displist(&par->disp, DL_VERTS);
|
||||||
if(dl) {
|
if(dl) {
|
||||||
fp= dl->verts+3*nr;
|
fp= dl->verts+3*nr;
|
||||||
@@ -1128,7 +1127,7 @@ void ob_parvert3(Object *ob, Object *par, float mat[][4])
|
|||||||
{
|
{
|
||||||
float cmat[3][3], v1[3], v2[3], v3[3], q[4];
|
float cmat[3][3], v1[3], v2[3], v3[3], q[4];
|
||||||
|
|
||||||
/* in lokale ob space */
|
/* in local ob space */
|
||||||
Mat4One(mat);
|
Mat4One(mat);
|
||||||
|
|
||||||
if ELEM3(par->type, OB_MESH, OB_SURF, OB_CURVE) {
|
if ELEM3(par->type, OB_MESH, OB_SURF, OB_CURVE) {
|
||||||
@@ -1182,8 +1181,8 @@ void where_is_object_time(Object *ob, float ctime)
|
|||||||
int a;
|
int a;
|
||||||
int pop;
|
int pop;
|
||||||
|
|
||||||
/* nieuwe versie: correcte parent+vertexparent en track+parent */
|
/* new version: correct parent+vertexparent and track+parent */
|
||||||
/* deze berekent alleen de directe relatie met de parent en track */
|
/* this one only calculates direct attached parent and track */
|
||||||
/* hij is sneller, maar moet wel de timeoffs in de gaten houden */
|
/* hij is sneller, maar moet wel de timeoffs in de gaten houden */
|
||||||
|
|
||||||
if(ob==0) return;
|
if(ob==0) return;
|
||||||
@@ -1364,7 +1363,7 @@ void solve_tracking (Object *ob, float targetmat[][4])
|
|||||||
QuatToMat3(quat, totmat);
|
QuatToMat3(quat, totmat);
|
||||||
|
|
||||||
if(ob->parent && (ob->transflag & OB_POWERTRACK)) {
|
if(ob->parent && (ob->transflag & OB_POWERTRACK)) {
|
||||||
/* 'tijdelijk' : parent info wissen */
|
/* 'temporal' : clear parent info */
|
||||||
object_to_mat4(ob, tmat);
|
object_to_mat4(ob, tmat);
|
||||||
tmat[0][3]= ob->obmat[0][3];
|
tmat[0][3]= ob->obmat[0][3];
|
||||||
tmat[1][3]= ob->obmat[1][3];
|
tmat[1][3]= ob->obmat[1][3];
|
||||||
@@ -1383,7 +1382,7 @@ void solve_tracking (Object *ob, float targetmat[][4])
|
|||||||
void where_is_object(Object *ob)
|
void where_is_object(Object *ob)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* deze zijn gememcopied */
|
/* these have been mem copied */
|
||||||
if(ob->flag & OB_FROMDUPLI) return;
|
if(ob->flag & OB_FROMDUPLI) return;
|
||||||
|
|
||||||
where_is_object_time(ob, (float)G.scene->r.cfra);
|
where_is_object_time(ob, (float)G.scene->r.cfra);
|
||||||
@@ -1391,6 +1390,7 @@ void where_is_object(Object *ob)
|
|||||||
|
|
||||||
|
|
||||||
void where_is_object_simul(Object *ob)
|
void where_is_object_simul(Object *ob)
|
||||||
|
/* was written for the old game engine (until 2.04) */
|
||||||
/* It seems that this function is only called
|
/* It seems that this function is only called
|
||||||
for a lamp that is the child of another object */
|
for a lamp that is the child of another object */
|
||||||
{
|
{
|
||||||
@@ -1401,11 +1401,9 @@ for a lamp that is the child of another object */
|
|||||||
float fac1, fac2;
|
float fac1, fac2;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
/* nieuwe versie: correcte parent+vertexparent en track+parent */
|
/* NO TIMEOFFS */
|
||||||
/* deze berekent alleen de directe relatie met de parent en track */
|
|
||||||
/* GEEN TIMEOFFS */
|
|
||||||
|
|
||||||
/* geen ipo! (ivm dloc en realtime-ipos) */
|
/* no ipo! (because of dloc and realtime-ipos) */
|
||||||
ipo= ob->ipo;
|
ipo= ob->ipo;
|
||||||
ob->ipo= NULL;
|
ob->ipo= NULL;
|
||||||
|
|
||||||
@@ -1435,7 +1433,7 @@ for a lamp that is the child of another object */
|
|||||||
|
|
||||||
solve_constraints(ob, TARGET_OBJECT, NULL, G.scene->r.cfra);
|
solve_constraints(ob, TARGET_OBJECT, NULL, G.scene->r.cfra);
|
||||||
|
|
||||||
/* LET OP!!! */
|
/* WATCH IT!!! */
|
||||||
ob->ipo= ipo;
|
ob->ipo= ipo;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1569,7 +1567,7 @@ void what_does_parent1(Object *par, int partype, int par1, int par2, int par3)
|
|||||||
Mat4One(workob.parentinv);
|
Mat4One(workob.parentinv);
|
||||||
workob.parent= par;
|
workob.parent= par;
|
||||||
if(par)
|
if(par)
|
||||||
workob.track= par->track; /* LET OP: NIET ECHT NETJES */
|
workob.track= par->track; /* WATCH IT: THATS NOT NICE CODE */
|
||||||
workob.partype= partype;
|
workob.partype= partype;
|
||||||
workob.par1= par1;
|
workob.par1= par1;
|
||||||
workob.par2= par2;
|
workob.par2= par2;
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
|
|
||||||
/* scene.c MIXED MODEL
|
/* scene.c
|
||||||
*
|
|
||||||
* jan 95
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
@@ -103,7 +101,7 @@ void free_avicodecdata(AviCodecData *acd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* niet scene zelf vrijgeven */
|
/* do not free scene itself */
|
||||||
void free_scene(Scene *sce)
|
void free_scene(Scene *sce)
|
||||||
{
|
{
|
||||||
Base *base;
|
Base *base;
|
||||||
@@ -113,7 +111,7 @@ void free_scene(Scene *sce)
|
|||||||
base->object->id.us--;
|
base->object->id.us--;
|
||||||
base= base->next;
|
base= base->next;
|
||||||
}
|
}
|
||||||
/* pas op: niet objects vrijgeven! */
|
/* do not free objects! */
|
||||||
|
|
||||||
BLI_freelistN(&sce->base);
|
BLI_freelistN(&sce->base);
|
||||||
free_editing(sce->ed);
|
free_editing(sce->ed);
|
||||||
@@ -185,15 +183,14 @@ int object_in_scene(Object *ob, Scene *sce)
|
|||||||
|
|
||||||
void sort_baselist(Scene *sce)
|
void sort_baselist(Scene *sce)
|
||||||
{
|
{
|
||||||
/* alles in volgorde van parent en track */
|
/* in order of parent and track */
|
||||||
ListBase tempbase, noparentbase, notyetbase;
|
ListBase tempbase, noparentbase, notyetbase;
|
||||||
Base *base, *test=NULL;
|
Base *base, *test=NULL;
|
||||||
Object *par;
|
Object *par;
|
||||||
int doit, domore= 0, lastdomore=1;
|
int doit, domore= 0, lastdomore=1;
|
||||||
|
|
||||||
|
|
||||||
/* volgorde gelijk houden als er niets veranderd is! */
|
/* keep same order when nothing has changed! */
|
||||||
/* hier waren problemen met campos array's: volgorde camera's is van belang */
|
|
||||||
|
|
||||||
while(domore!=lastdomore) {
|
while(domore!=lastdomore) {
|
||||||
|
|
||||||
@@ -347,7 +344,7 @@ void set_scene_bg(Scene *sce)
|
|||||||
|
|
||||||
G.scene= sce;
|
G.scene= sce;
|
||||||
|
|
||||||
/* objecten deselecteren (voor dataselect) */
|
/* deselect objects (for dataselect) */
|
||||||
ob= G.main->object.first;
|
ob= G.main->object.first;
|
||||||
while(ob) {
|
while(ob) {
|
||||||
ob->flag &= ~(SELECT|OB_FROMGROUP);
|
ob->flag &= ~(SELECT|OB_FROMGROUP);
|
||||||
@@ -365,10 +362,10 @@ void set_scene_bg(Scene *sce)
|
|||||||
group= group->id.next;
|
group= group->id.next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* baselijst sorteren */
|
/* sort baselist */
|
||||||
sort_baselist(sce);
|
sort_baselist(sce);
|
||||||
|
|
||||||
/* layers en flags uit bases naar objecten kopieeren */
|
/* copy layers and flags from bases to objects */
|
||||||
base= G.scene->base.first;
|
base= G.scene->base.first;
|
||||||
while(base) {
|
while(base) {
|
||||||
|
|
||||||
@@ -378,7 +375,7 @@ void set_scene_bg(Scene *sce)
|
|||||||
flag= base->object->flag & OB_FROMGROUP;
|
flag= base->object->flag & OB_FROMGROUP;
|
||||||
base->flag |= flag;
|
base->flag |= flag;
|
||||||
|
|
||||||
base->object->ctime= -1234567.0; /* forceer ipo */
|
base->object->ctime= -1234567.0; /* force ipo to be calculated later */
|
||||||
base= base->next;
|
base= base->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,7 +428,7 @@ int next_object(int val, Base **base, Object **ob)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* de eerste base */
|
/* the first base */
|
||||||
if(fase==F_START) {
|
if(fase==F_START) {
|
||||||
*base= G.scene->base.first;
|
*base= G.scene->base.first;
|
||||||
if(*base) {
|
if(*base) {
|
||||||
@@ -439,7 +436,7 @@ int next_object(int val, Base **base, Object **ob)
|
|||||||
fase= F_SCENE;
|
fase= F_SCENE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* uitzondering: een lege scene */
|
/* exception: empty scene */
|
||||||
if(G.scene->set && G.scene->set->base.first) {
|
if(G.scene->set && G.scene->set->base.first) {
|
||||||
*base= G.scene->set->base.first;
|
*base= G.scene->set->base.first;
|
||||||
*ob= (*base)->object;
|
*ob= (*base)->object;
|
||||||
@@ -453,7 +450,7 @@ int next_object(int val, Base **base, Object **ob)
|
|||||||
if(*base) *ob= (*base)->object;
|
if(*base) *ob= (*base)->object;
|
||||||
else {
|
else {
|
||||||
if(fase==F_SCENE) {
|
if(fase==F_SCENE) {
|
||||||
/* de scene is klaar, we gaan door met de set */
|
/* scene is finished, now do the set */
|
||||||
if(G.scene->set && G.scene->set->base.first) {
|
if(G.scene->set && G.scene->set->base.first) {
|
||||||
*base= G.scene->set->base.first;
|
*base= G.scene->set->base.first;
|
||||||
*ob= (*base)->object;
|
*ob= (*base)->object;
|
||||||
@@ -474,7 +471,7 @@ int next_object(int val, Base **base, Object **ob)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* dupli's afhandelen */
|
/* handle dupli's */
|
||||||
if(dupob) {
|
if(dupob) {
|
||||||
|
|
||||||
*ob= dupob;
|
*ob= dupob;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
/* screen.c dec/jan 93/94 GRAPHICS
|
/* screen.c
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
/* subsurf.c MIXED MODEL
|
/* subsurf.c
|
||||||
*
|
*
|
||||||
* jun 2001
|
* jun 2001
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
/**
|
/* text.c
|
||||||
|
*
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
/**
|
/* texture.c
|
||||||
|
*
|
||||||
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
@@ -87,7 +89,7 @@ extern int Talpha;
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* Alle support voor plugin textures: */
|
/* All support for plugin textures: */
|
||||||
int test_dlerr(const char *name, const char *symbol)
|
int test_dlerr(const char *name, const char *symbol)
|
||||||
{
|
{
|
||||||
char *err;
|
char *err;
|
||||||
@@ -200,7 +202,7 @@ void free_plugin_tex(PluginTex *pit)
|
|||||||
{
|
{
|
||||||
if(pit==0) return;
|
if(pit==0) return;
|
||||||
|
|
||||||
/* geen PIL_dynlib_close: dezelfde plugin kan meerdere keren geopend zijn: 1 handle */
|
/* no PIL_dynlib_close: same plugin can be opened multiple times, 1 handle */
|
||||||
MEM_freeN(pit);
|
MEM_freeN(pit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,18 +253,18 @@ int do_colorband(ColorBand *coba)
|
|||||||
|
|
||||||
cbd1= coba->data;
|
cbd1= coba->data;
|
||||||
|
|
||||||
if(Tin <= cbd1->pos) { /* helemaal links */
|
if(Tin <= cbd1->pos) { /* ultimate left */
|
||||||
Tr= cbd1->r;
|
Tr= cbd1->r;
|
||||||
Tg= cbd1->g;
|
Tg= cbd1->g;
|
||||||
Tb= cbd1->b;
|
Tb= cbd1->b;
|
||||||
Ta= cbd1->a;
|
Ta= cbd1->a;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* we zoeken de eerste pos > Tin */
|
/* we're looking for first pos > Tin */
|
||||||
|
|
||||||
for(a=0; a<coba->tot; a++, cbd1++) if(cbd1->pos >= Tin) break;
|
for(a=0; a<coba->tot; a++, cbd1++) if(cbd1->pos >= Tin) break;
|
||||||
|
|
||||||
if(a==coba->tot) { /* helemaal rechts */
|
if(a==coba->tot) { /* ultimate right */
|
||||||
cbd1--;
|
cbd1--;
|
||||||
Tr= cbd1->r;
|
Tr= cbd1->r;
|
||||||
Tg= cbd1->g;
|
Tg= cbd1->g;
|
||||||
@@ -274,7 +276,7 @@ int do_colorband(ColorBand *coba)
|
|||||||
fac= (Tin-cbd1->pos)/(cbd2->pos-cbd1->pos);
|
fac= (Tin-cbd1->pos)/(cbd2->pos-cbd1->pos);
|
||||||
|
|
||||||
if(coba->ipotype==2) {
|
if(coba->ipotype==2) {
|
||||||
/* ipo van r naar l: 3 2 1 0 */
|
/* ipo from right to left: 3 2 1 0 */
|
||||||
|
|
||||||
if(a>=coba->tot-1) cbd0= cbd1;
|
if(a>=coba->tot-1) cbd0= cbd1;
|
||||||
else cbd0= cbd1+1;
|
else cbd0= cbd1+1;
|
||||||
@@ -432,15 +434,15 @@ void make_local_texture(Tex *tex)
|
|||||||
World *wrld;
|
World *wrld;
|
||||||
Lamp *la;
|
Lamp *la;
|
||||||
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(tex->id.lib==0) return;
|
if(tex->id.lib==0) return;
|
||||||
|
|
||||||
/* speciaal geval: ima altijd meteen lokaal */
|
/* special case: ima always local immediately */
|
||||||
if(tex->ima) {
|
if(tex->ima) {
|
||||||
tex->ima->id.lib= 0;
|
tex->ima->id.lib= 0;
|
||||||
tex->ima->id.flag= LIB_LOCAL;
|
tex->ima->id.flag= LIB_LOCAL;
|
||||||
@@ -575,7 +577,7 @@ void init_render_texture(Tex *tex)
|
|||||||
/* is also used as signal */
|
/* is also used as signal */
|
||||||
tex->nor= 0;
|
tex->nor= 0;
|
||||||
|
|
||||||
/* imap testen */
|
/* imap test */
|
||||||
if(tex->frames && tex->ima && tex->ima->name) { /* frames */
|
if(tex->frames && tex->ima && tex->ima->name) { /* frames */
|
||||||
strcpy(name, tex->ima->name);
|
strcpy(name, tex->ima->name);
|
||||||
|
|
||||||
@@ -589,7 +591,7 @@ void init_render_texture(Tex *tex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* voor patch field-ima rendering */
|
/* for patch field-ima rendering */
|
||||||
tex->ima->lastframe= imanr;
|
tex->ima->lastframe= imanr;
|
||||||
|
|
||||||
BLI_stringdec(name, head, tail, &numlen);
|
BLI_stringdec(name, head, tail, &numlen);
|
||||||
@@ -989,7 +991,7 @@ int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt)
|
|||||||
return rgbnor;
|
return rgbnor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *************** PROJEKTIES ******************* */
|
/* *************** PROJECTIONS ******************* */
|
||||||
|
|
||||||
void tubemap(float x, float y, float z, float *adr1, float *adr2)
|
void tubemap(float x, float y, float z, float *adr1, float *adr2)
|
||||||
{
|
{
|
||||||
@@ -1012,7 +1014,7 @@ void spheremap(float x, float y, float z, float *adr1, float *adr2)
|
|||||||
len= sqrt(x*x+y*y+z*z);
|
len= sqrt(x*x+y*y+z*z);
|
||||||
if(len>0.0) {
|
if(len>0.0) {
|
||||||
|
|
||||||
if(x==0.0 && y==0.0) *adr1= 0.0; /* anders domain error */
|
if(x==0.0 && y==0.0) *adr1= 0.0; /* othwise domain error */
|
||||||
else *adr1 = (1.0 - atan2(x,y)/M_PI )/2.0;
|
else *adr1 = (1.0 - atan2(x,y)/M_PI )/2.0;
|
||||||
|
|
||||||
z/=len;
|
z/=len;
|
||||||
@@ -1184,7 +1186,7 @@ void do_2d_mapping(MTex *mtex, float *t, float *dxt, float *dyt)
|
|||||||
dyt[1]/= 2.0;
|
dyt[1]/= 2.0;
|
||||||
}
|
}
|
||||||
else if ELEM(wrap, MTEX_TUBE, MTEX_SPHERE) {
|
else if ELEM(wrap, MTEX_TUBE, MTEX_SPHERE) {
|
||||||
/* uitzondering: de naad achter (y<0.0) */
|
/* exception: the seam behind (y<0.0) */
|
||||||
ok= 1;
|
ok= 1;
|
||||||
if(t[1]<=0.0) {
|
if(t[1]<=0.0) {
|
||||||
fx= t[0]+dxt[0];
|
fx= t[0]+dxt[0];
|
||||||
@@ -1237,7 +1239,7 @@ void do_2d_mapping(MTex *mtex, float *t, float *dxt, float *dyt)
|
|||||||
dyt[1]/= 2.0;
|
dyt[1]/= 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* als area dan dxt[] en dyt[] opnieuw berekenen */
|
/* if area, then reacalculate dxt[] and dyt[] */
|
||||||
if(areaflag) {
|
if(areaflag) {
|
||||||
fx= area[0];
|
fx= area[0];
|
||||||
fy= area[1];
|
fy= area[1];
|
||||||
@@ -1337,8 +1339,8 @@ void do_material_tex()
|
|||||||
facm, factt, facmm, facmul = 0.0, stencilTin=1.0;
|
facm, factt, facmm, facmul = 0.0, stencilTin=1.0;
|
||||||
float texvec[3], dxt[3], dyt[3], tempvec[3], norvec[3];
|
float texvec[3], dxt[3], dyt[3], tempvec[3], norvec[3];
|
||||||
int tex_nr, rgbnor= 0;
|
int tex_nr, rgbnor= 0;
|
||||||
|
|
||||||
/* hier flag testen of er wel tex is */
|
/* here: test flag if there's a tex (todo) */
|
||||||
|
|
||||||
mat_col=mat_colspec=mat_colmir=mat_ref=mat_spec=mat_har=mat_emit=mat_alpha= R.mat;
|
mat_col=mat_colspec=mat_colmir=mat_ref=mat_spec=mat_har=mat_emit=mat_alpha= R.mat;
|
||||||
|
|
||||||
@@ -1352,7 +1354,7 @@ void do_material_tex()
|
|||||||
tex= mtex->tex;
|
tex= mtex->tex;
|
||||||
if(tex==0) continue;
|
if(tex==0) continue;
|
||||||
|
|
||||||
/* welke coords */
|
/* which coords */
|
||||||
if(mtex->texco==TEXCO_ORCO) {
|
if(mtex->texco==TEXCO_ORCO) {
|
||||||
co= R.lo; dx= O.dxlo; dy= O.dylo;
|
co= R.lo; dx= O.dxlo; dy= O.dylo;
|
||||||
}
|
}
|
||||||
@@ -1375,7 +1377,7 @@ void do_material_tex()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* als object niet bestaat geen orco's gebruiken (zijn niet geinitialiseerd */
|
/* if object doesn't exist, do not use orcos (not initialized) */
|
||||||
co= R.co;
|
co= R.co;
|
||||||
dx= O.dxco; dy= O.dyco;
|
dx= O.dxco; dy= O.dyco;
|
||||||
}
|
}
|
||||||
@@ -1405,7 +1407,7 @@ void do_material_tex()
|
|||||||
|
|
||||||
if(tex->type==TEX_IMAGE) {
|
if(tex->type==TEX_IMAGE) {
|
||||||
|
|
||||||
/* nieuw: eerst coords verwisselen, dan map, dan trans/scale */
|
/* new: first swap coords, then map, then trans/scale */
|
||||||
|
|
||||||
/* placement */
|
/* placement */
|
||||||
if(mtex->projx) texvec[0]= co[mtex->projx-1];
|
if(mtex->projx) texvec[0]= co[mtex->projx-1];
|
||||||
@@ -1436,7 +1438,7 @@ void do_material_tex()
|
|||||||
|
|
||||||
do_2d_mapping(mtex, texvec, dxt, dyt);
|
do_2d_mapping(mtex, texvec, dxt, dyt);
|
||||||
|
|
||||||
/* translate en scale */
|
/* translate and scale */
|
||||||
texvec[0]= mtex->size[0]*(texvec[0]-0.5) +mtex->ofs[0]+0.5;
|
texvec[0]= mtex->size[0]*(texvec[0]-0.5) +mtex->ofs[0]+0.5;
|
||||||
texvec[1]= mtex->size[1]*(texvec[1]-0.5) +mtex->ofs[1]+0.5;
|
texvec[1]= mtex->size[1]*(texvec[1]-0.5) +mtex->ofs[1]+0.5;
|
||||||
if(R.osatex) {
|
if(R.osatex) {
|
||||||
@@ -1622,7 +1624,7 @@ void do_material_tex()
|
|||||||
|
|
||||||
Normalise(R.vn);
|
Normalise(R.vn);
|
||||||
|
|
||||||
/* hierdoor wordt de bump aan de volgende texture doorgegeven */
|
/* this makes sure the bump is passed on to the next texture */
|
||||||
R.orn[0]= R.vn[0];
|
R.orn[0]= R.vn[0];
|
||||||
R.orn[1]= -R.vn[1];
|
R.orn[1]= -R.vn[1];
|
||||||
R.orn[2]= R.vn[2];
|
R.orn[2]= R.vn[2];
|
||||||
@@ -1777,7 +1779,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
|
|||||||
|
|
||||||
rgb= multitex(mtex->tex, texvec, dxt, dyt);
|
rgb= multitex(mtex->tex, texvec, dxt, dyt);
|
||||||
|
|
||||||
/* texture uitgang */
|
/* texture output */
|
||||||
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||||
Tin= (0.35*Tr+0.45*Tg+0.2*Tb);
|
Tin= (0.35*Tr+0.45*Tg+0.2*Tb);
|
||||||
rgb= 0;
|
rgb= 0;
|
||||||
@@ -1857,12 +1859,12 @@ void do_sky_tex()
|
|||||||
float tempvec[3], texvec[3], dxt[3], dyt[3];
|
float tempvec[3], texvec[3], dxt[3], dyt[3];
|
||||||
int tex_nr, rgb= 0, ok;
|
int tex_nr, rgb= 0, ok;
|
||||||
|
|
||||||
|
|
||||||
/* hier flag testen of er wel tex is */
|
/* todo: add flag to test if there's a tex */
|
||||||
|
|
||||||
wrld_hor= wrld_zen= G.scene->world;
|
wrld_hor= wrld_zen= G.scene->world;
|
||||||
|
|
||||||
/* The 6 here is rather arbitrary, it seems. */
|
/* The 6 here is the max amount of channels for a world */
|
||||||
for(tex_nr=0; tex_nr<6; tex_nr++) {
|
for(tex_nr=0; tex_nr<6; tex_nr++) {
|
||||||
if(R.wrld.mtex[tex_nr]) {
|
if(R.wrld.mtex[tex_nr]) {
|
||||||
mtex= R.wrld.mtex[tex_nr];
|
mtex= R.wrld.mtex[tex_nr];
|
||||||
@@ -1870,7 +1872,7 @@ void do_sky_tex()
|
|||||||
if(mtex->tex==0) continue;
|
if(mtex->tex==0) continue;
|
||||||
/* if(mtex->mapto==0) continue; */
|
/* if(mtex->mapto==0) continue; */
|
||||||
|
|
||||||
/* welke coords */
|
/* which coords */
|
||||||
co= R.lo;
|
co= R.lo;
|
||||||
|
|
||||||
/* Grab the mapping settings for this texture */
|
/* Grab the mapping settings for this texture */
|
||||||
@@ -1898,7 +1900,7 @@ void do_sky_tex()
|
|||||||
|
|
||||||
rgb= multitex(mtex->tex, texvec, dxt, dyt);
|
rgb= multitex(mtex->tex, texvec, dxt, dyt);
|
||||||
|
|
||||||
/* texture uitgang */
|
/* texture output */
|
||||||
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||||
Tin= (0.35*Tr+0.45*Tg+0.2*Tb);
|
Tin= (0.35*Tr+0.45*Tg+0.2*Tb);
|
||||||
rgb= 0;
|
rgb= 0;
|
||||||
@@ -1989,7 +1991,7 @@ void do_sky_tex()
|
|||||||
wrld_zen= &R.wrld;
|
wrld_zen= &R.wrld;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* anders blijft zenRGB hangen */
|
/* otherwise zenRGB undefined */
|
||||||
R.wrld.zenr= wrld_zen->zenr;
|
R.wrld.zenr= wrld_zen->zenr;
|
||||||
R.wrld.zeng= wrld_zen->zeng;
|
R.wrld.zeng= wrld_zen->zeng;
|
||||||
R.wrld.zenb= wrld_zen->zenb;
|
R.wrld.zenb= wrld_zen->zenb;
|
||||||
@@ -2031,8 +2033,6 @@ void do_lamp_tex(LampRen *la, float *lavec)
|
|||||||
float texvec[3], dxt[3], dyt[3], tempvec[3];
|
float texvec[3], dxt[3], dyt[3], tempvec[3];
|
||||||
int tex_nr, rgb= 0;
|
int tex_nr, rgb= 0;
|
||||||
|
|
||||||
/* hier flag testen of er wel tex is */
|
|
||||||
|
|
||||||
la_col= la->org;
|
la_col= la->org;
|
||||||
|
|
||||||
tex_nr= 0;
|
tex_nr= 0;
|
||||||
@@ -2045,7 +2045,7 @@ void do_lamp_tex(LampRen *la, float *lavec)
|
|||||||
tex= mtex->tex;
|
tex= mtex->tex;
|
||||||
if(tex==0) continue;
|
if(tex==0) continue;
|
||||||
|
|
||||||
/* welke coords */
|
/* which coords */
|
||||||
if(mtex->texco==TEXCO_OBJECT) {
|
if(mtex->texco==TEXCO_OBJECT) {
|
||||||
ob= mtex->object;
|
ob= mtex->object;
|
||||||
if(ob) {
|
if(ob) {
|
||||||
@@ -2127,7 +2127,7 @@ void do_lamp_tex(LampRen *la, float *lavec)
|
|||||||
do_2d_mapping(mtex, texvec, dxt, dyt);
|
do_2d_mapping(mtex, texvec, dxt, dyt);
|
||||||
|
|
||||||
if(mtex->mapto & MAP_NORM) {
|
if(mtex->mapto & MAP_NORM) {
|
||||||
/* de pointer bepaalt of er gebumpt wordt */
|
/* the pointer defines if bump happens */
|
||||||
tex->nor= R.vn;
|
tex->nor= R.vn;
|
||||||
if(mtex->maptoneg & MAP_NORM) tex->norfac= -mtex->norfac;
|
if(mtex->maptoneg & MAP_NORM) tex->norfac= -mtex->norfac;
|
||||||
else tex->norfac= mtex->norfac;
|
else tex->norfac= mtex->norfac;
|
||||||
@@ -2139,7 +2139,7 @@ void do_lamp_tex(LampRen *la, float *lavec)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* texture uitgang */
|
/* texture output */
|
||||||
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||||
Tin= (0.35*Tr+0.45*Tg+0.2*Tb);
|
Tin= (0.35*Tr+0.45*Tg+0.2*Tb);
|
||||||
rgb= 0;
|
rgb= 0;
|
||||||
@@ -2243,7 +2243,7 @@ void externtex(MTex *mtex, float *vec)
|
|||||||
do_2d_mapping(mtex, texvec, dxt, dyt);
|
do_2d_mapping(mtex, texvec, dxt, dyt);
|
||||||
|
|
||||||
if(mtex->mapto & MAP_NORM) {
|
if(mtex->mapto & MAP_NORM) {
|
||||||
/* de pointer bepaalt of er gebumpt wordt */
|
/* the pointer defines if there's bump */
|
||||||
tex->nor= R.vn;
|
tex->nor= R.vn;
|
||||||
if(mtex->maptoneg & MAP_NORM) tex->norfac= -mtex->norfac;
|
if(mtex->maptoneg & MAP_NORM) tex->norfac= -mtex->norfac;
|
||||||
else tex->norfac= mtex->norfac;
|
else tex->norfac= mtex->norfac;
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
/* world.c MIX MODEL
|
/* world.c
|
||||||
*
|
*
|
||||||
* april 95
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -121,11 +120,11 @@ void make_local_world(World *wrld)
|
|||||||
Scene *sce;
|
Scene *sce;
|
||||||
World *wrldn;
|
World *wrldn;
|
||||||
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(wrld->id.lib==0) return;
|
if(wrld->id.lib==0) return;
|
||||||
if(wrld->id.us==1) {
|
if(wrld->id.us==1) {
|
||||||
@@ -192,7 +191,7 @@ void init_render_world()
|
|||||||
if(G.scene->camera && G.scene->camera->type==OB_CAMERA) {
|
if(G.scene->camera && G.scene->camera->type==OB_CAMERA) {
|
||||||
Camera *cam= G.scene->camera->data;
|
Camera *cam= G.scene->camera->data;
|
||||||
if(cam->type==CAM_ORTHO) {
|
if(cam->type==CAM_ORTHO) {
|
||||||
/* dit is maar ongeveer */
|
/* this is an estimation */
|
||||||
R.wrld.miststa+= (float)fabs(R.viewmat[3][2]);
|
R.wrld.miststa+= (float)fabs(R.viewmat[3][2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user