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

Comparing src/util/rmatrix.c (file contents):
Revision 2.101 by greg, Mon Aug 11 22:31:33 2025 UTC vs.
Revision 2.103 by greg, Thu Oct 30 17:26:45 2025 UTC

# Line 255 | Line 255 | rmx_load_double(rmx_dtype *drp, const RMATRIX *rm, FIL
255          return(1);
256   }
257  
258 + #if DTrmx_native==DTfloat
259 + #define rmx_load_spec(dp,rm,fp) (freadsscan(dp,(rm)->ncomp,(rm)->ncols,fp) >= 0)
260 + #else
261   static int
259 rmx_load_rgbe(rmx_dtype *drp, const RMATRIX *rm, FILE *fp)
260 {
261        COLR    *scan;
262        COLOR   col;
263        int     j;
264
265        if (rm->ncomp != 3)
266                return(0);
267        scan = (COLR *)tempbuffer(sizeof(COLR)*rm->ncols);
268        if (!scan)
269                return(0);
270        if (freadcolrs(scan, rm->ncols, fp) < 0)
271                return(0);
272        for (j = 0; j < rm->ncols; j++) {
273                colr_color(col, scan[j]);
274                *drp++ = colval(col,RED);
275                *drp++ = colval(col,GRN);
276                *drp++ = colval(col,BLU);
277        }
278        return(1);
279 }
280
281 static int
262   rmx_load_spec(rmx_dtype *drp, const RMATRIX *rm, FILE *fp)
263   {
264          COLRV   *scan;
# Line 299 | Line 279 | rmx_load_spec(rmx_dtype *drp, const RMATRIX *rm, FILE
279          }
280          return(1);
281   }
282 + #endif
283  
284   /* Read matrix header from input stream (cannot be XML) */
285   int
# Line 345 | Line 326 | rmx_load_row(rmx_dtype *drp, const RMATRIX *rm, FILE *
326                  return(rmx_load_double(drp, rm, fp));
327          case DTrgbe:
328          case DTxyze:
348                return(rmx_load_rgbe(drp, rm, fp));
329          case DTspec:
330                  return(rmx_load_spec(drp, rm, fp));
331          default:
# Line 518 | Line 498 | rmx_write_rgbe(const rmx_dtype *dp, int ncomp, int len
498          return(fwritecolrs(scan, len, fp) >= 0);
499   }
500  
501 + #if DTrmx_native==DTfloat
502 + #define rmx_write_spec(dp,nc,ln,fp)     (fwritesscan(dp,nc,ln,fp) >= 0)
503 + #else
504   static int
505   rmx_write_spec(const rmx_dtype *dp, int ncomp, int len, FILE *fp)
506   {
# Line 535 | Line 518 | rmx_write_spec(const rmx_dtype *dp, int ncomp, int len
518          }
519          return(fwritescolrs(scan, ncomp, len, fp) >= 0);
520   }
521 + #endif
522  
523   /* Check if CIE XYZ primaries were specified */
524   static int

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)