ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/mesh.c
(Generate patch)

Comparing ray/src/common/mesh.c (file contents):
Revision 2.7 by greg, Tue May 13 17:58:32 2003 UTC vs.
Revision 2.8 by greg, Fri Jun 20 00:25:49 2003 UTC

# Line 14 | Line 14 | static const char RCSid[] = "$Id$";
14   /* An encoded mesh vertex */
15   typedef struct {
16          int             fl;
17 <        uint4           xyz[3];
18 <        int4            norm;
19 <        uint4           uv[2];
17 >        uint32          xyz[3];
18 >        int32           norm;
19 >        uint32          uv[2];
20   } MCVERT;
21  
22   #define  MPATCHBLKSIZ   128             /* patch allocation block size */
# Line 136 | Line 136 | int    flags;
136  
137   int
138   getmeshtrivid(tvid, mo, mp, ti)         /* get triangle vertex ID's */
139 < int4    tvid[3];
139 > int32   tvid[3];
140   OBJECT  *mo;
141   MESH    *mp;
142   OBJECT  ti;
# Line 199 | Line 199 | int
199   getmeshvert(vp, mp, vid, what)  /* get triangle vertex from ID */
200   MESHVERT        *vp;
201   MESH            *mp;
202 < int4            vid;
202 > int32           vid;
203   int             what;
204   {
205          int             pn = vid >> 8;
# Line 269 | Line 269 | MESH           *mp;
269   OBJECT          ti;
270   int             wha;
271   {
272 <        int4    tvid[3];
272 >        int32   tvid[3];
273  
274          if (!getmeshtrivid(tvid, mo, mp, ti))
275                  return(0);
# Line 282 | Line 282 | int            wha;
282   }
283  
284  
285 < int4
285 > int32
286   addmeshvert(mp, vp)             /* find/add a mesh vertex */
287   register MESH   *mp;
288   MESHVERT        *vp;
# Line 299 | Line 299 | MESHVERT       *vp;
299                          return(-1);
300                  if (vp->v[i] >= mp->mcube.cuorg[i] + mp->mcube.cusize)
301                          return(-1);
302 <                cv.xyz[i] = (uint4)(4294967296. *
302 >                cv.xyz[i] = (uint32)(4294967296. *
303                                  (vp->v[i] - mp->mcube.cuorg[i]) /
304                                  mp->mcube.cusize);
305          }
# Line 311 | Line 311 | MESHVERT       *vp;
311                                  return(-1);
312                          if (vp->uv[i] >= mp->uvlim[1][i])
313                                  return(-1);
314 <                        cv.uv[i] = (uint4)(4294967296. *
314 >                        cv.uv[i] = (uint32)(4294967296. *
315                                          (vp->uv[i] - mp->uvlim[0][i]) /
316                                          (mp->uvlim[1][i] - mp->uvlim[0][i]));
317                  }
# Line 328 | Line 328 | MESHVERT       *vp;
328          if (lvp == NULL)
329                  goto nomem;
330          if (lvp->key == NULL) {
331 <                lvp->key = (char *)malloc(sizeof(MCVERT)+sizeof(int4));
331 >                lvp->key = (char *)malloc(sizeof(MCVERT)+sizeof(int32));
332                  bcopy((void *)&cv, (void *)lvp->key, sizeof(MCVERT));
333          }
334          if (lvp->data == NULL) {        /* new vertex */
# Line 353 | Line 353 | MESHVERT       *vp;
353                  }
354                  pp = &mp->patch[mp->npatches-1];
355                  if (pp->xyz == NULL) {
356 <                        pp->xyz = (uint4 (*)[3])calloc(256, 3*sizeof(int4));
356 >                        pp->xyz = (uint32 (*)[3])calloc(256, 3*sizeof(int32));
357                          if (pp->xyz == NULL)
358                                  goto nomem;
359                  }
# Line 361 | Line 361 | MESHVERT       *vp;
361                          pp->xyz[pp->nverts][i] = cv.xyz[i];
362                  if (cv.fl & MT_N) {
363                          if (pp->norm == NULL) {
364 <                                pp->norm = (int4 *)calloc(256, sizeof(int4));
364 >                                pp->norm = (int32 *)calloc(256, sizeof(int32));
365                                  if (pp->norm == NULL)
366                                          goto nomem;
367                          }
# Line 369 | Line 369 | MESHVERT       *vp;
369                  }
370                  if (cv.fl & MT_UV) {
371                          if (pp->uv == NULL) {
372 <                                pp->uv = (uint4 (*)[2])calloc(256,
373 <                                                2*sizeof(uint4));
372 >                                pp->uv = (uint32 (*)[2])calloc(256,
373 >                                                2*sizeof(uint32));
374                                  if (pp->uv == NULL)
375                                          goto nomem;
376                          }
# Line 379 | Line 379 | MESHVERT       *vp;
379                  }
380                  pp->nverts++;
381                  lvp->data = lvp->key + sizeof(MCVERT);
382 <                *(int4 *)lvp->data = (mp->npatches-1) << 8 | (pp->nverts-1);
382 >                *(int32 *)lvp->data = (mp->npatches-1) << 8 | (pp->nverts-1);
383          }
384 <        return(*(int4 *)lvp->data);
384 >        return(*(int32 *)lvp->data);
385   nomem:
386          error(SYSTEM, "out of memory in addmeshvert");
387          return(-1);
# Line 394 | Line 394 | MESH           *mp;
394   MESHVERT        tv[3];
395   OBJECT          mo;
396   {
397 <        int4                    vid[3], t;
397 >        int32                   vid[3], t;
398          int                     pn[3], i;
399          register MESHPATCH      *pp;
400  
# Line 428 | Line 428 | OBJECT         mo;
428                          if (pp->ntris == 0)
429                                  pp->solemat = mo;
430                          else if (pp->trimat == NULL && mo != pp->solemat) {
431 <                                pp->trimat = (int2 *)malloc(
432 <                                                512*sizeof(int2));
431 >                                pp->trimat = (int16 *)malloc(
432 >                                                512*sizeof(int16));
433                                  if (pp->trimat == NULL)
434                                          goto nomem;
435                                  for (i = pp->ntris; i--; )
# Line 611 | Line 611 | FILE   *fp;
611          fprintf(fp, "\t%d materials\n", ms->nmats);
612          fprintf(fp, "\t%d patches (%.2f MBytes)\n", ms->npatches,
613                          (ms->npatches*sizeof(MESHPATCH) +
614 <                        vcnt*3*sizeof(uint4) +
615 <                        nscnt*sizeof(int4) +
616 <                        uvscnt*2*sizeof(uint4) +
614 >                        vcnt*3*sizeof(uint32) +
615 >                        nscnt*sizeof(int32) +
616 >                        uvscnt*2*sizeof(uint32) +
617                          tcnt*sizeof(struct PTri) +
618                          t1cnt*sizeof(struct PJoin1) +
619                          t2cnt*sizeof(struct PJoin2))/(1024.*1024.));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines