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.11 by greg, Thu Jul 10 03:47:00 2003 UTC vs.
Revision 2.15 by schorsch, Fri Nov 14 17:22:06 2003 UTC

# Line 7 | Line 7 | static const char RCSid[] = "$Id$";
7  
8   #include <string.h>
9  
10 < #include "standard.h"
10 > #include "rtio.h"
11 > #include "rtmath.h"
12 > #include "rterror.h"
13 >
14   #include "octree.h"
15   #include "object.h"
16   #include "otypes.h"
# Line 18 | Line 21 | typedef struct {
21          int             fl;
22          uint32          xyz[3];
23          int32           norm;
24 <        uint32          uv[2];
24 >        uint16          uv[2];
25   } MCVERT;
26  
27   #define  MPATCHBLKSIZ   128             /* patch allocation block size */
# Line 235 | Line 238 | int            what;
238                  for (i = 0; i < 2; i++)
239                          vp->uv[i] = mp->uvlim[0][i] +
240                                  (mp->uvlim[1][i] - mp->uvlim[0][i])*
241 <                                (pp->uv[vid][i] + .5)*(1./4294967296.);
241 >                                (pp->uv[vid][i] + .5)*(1./65536.);
242                  vp->fl |= MT_UV;
243          }
244          return(vp->fl);
# Line 314 | Line 317 | MESHVERT       *vp;
317                                  return(-1);
318                          if (vp->uv[i] >= mp->uvlim[1][i])
319                                  return(-1);
320 <                        cv.uv[i] = (uint32)(4294967296. *
320 >                        cv.uv[i] = (uint32)(65536. *
321                                          (vp->uv[i] - mp->uvlim[0][i]) /
322                                          (mp->uvlim[1][i] - mp->uvlim[0][i]));
323                  }
# Line 372 | Line 375 | MESHVERT       *vp;
375                  }
376                  if (cv.fl & MT_UV) {
377                          if (pp->uv == NULL) {
378 <                                pp->uv = (uint32 (*)[2])calloc(256,
379 <                                                2*sizeof(uint32));
378 >                                pp->uv = (uint16 (*)[2])calloc(256,
379 >                                                2*sizeof(uint16));
380                                  if (pp->uv == NULL)
381                                          goto nomem;
382                          }
# Line 410 | Line 413 | OBJECT         mo;
413                  pn[i] = vid[i] >> 8;
414          }
415                                  /* normalize material index */
416 <        if (mo != OVOID)
416 >        if (mo != OVOID) {
417                  if ((mo -= mp->mat0) >= mp->nmats)
418                          mp->nmats = mo+1;
419                  else if (mo < 0)
420                          error(INTERNAL, "modifier range error in addmeshtri");
421 +        }
422                                  /* assign triangle */
423          if (pn[0] == pn[1] && pn[1] == pn[2]) { /* local case */
424                  pp = &mp->patch[pn[0]];
# Line 611 | Line 615 | FILE   *fp;
615                  t2cnt += pp->nj2tris;
616          }
617          fprintf(fp, "Mesh statistics:\n");
618 <        fprintf(fp, "\t%d materials\n", ms->nmats);
618 >        fprintf(fp, "\t%ld materials\n", ms->nmats);
619          fprintf(fp, "\t%d patches (%.2f MBytes)\n", ms->npatches,
620                          (ms->npatches*sizeof(MESHPATCH) +
621                          vcnt*3*sizeof(uint32) +
622                          nscnt*sizeof(int32) +
623 <                        uvscnt*2*sizeof(uint32) +
623 >                        uvscnt*2*sizeof(uint16) +
624                          tcnt*sizeof(struct PTri) +
625                          t1cnt*sizeof(struct PJoin1) +
626                          t2cnt*sizeof(struct PJoin2))/(1024.*1024.));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines