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

Comparing ray/src/util/cmatrix.h (file contents):
Revision 2.4 by greg, Sat Feb 8 01:28:06 2014 UTC vs.
Revision 2.13 by greg, Tue Jan 19 23:32:00 2021 UTC

# Line 8 | Line 8
8   #ifndef _RAD_CMATRIX_H_
9   #define _RAD_CMATRIX_H_
10  
11 + #include  <sys/types.h>
12   #include "color.h"
13  
14   #ifdef __cplusplus
# Line 15 | Line 16 | extern "C" {
16   #endif
17  
18   /* Data types for file loading */
19 < enum {DTfromHeader, DTascii, DTfloat, DTdouble, DTrgbe, DTxyze, DTend};
19 > enum {DTfromHeader=0, DTrgbe, DTxyze, DTfloat, DTascii, DTdouble, DTend};
20  
21 + extern const char       stdin_name[];
22   extern const char       *cm_fmt_id[];
23   extern const int        cm_elem_size[];
24  
# Line 28 | Line 30 | typedef struct {
30  
31   #define COLSPEC (sizeof(COLORV)==sizeof(float) ? "%f %f %f" : "%lf %lf %lf")
32  
33 < #define cm_lval(cm,r,c) ((cm)->cmem + 3*((r)*(cm)->ncols + (c)))
33 > #define cm_lval(cm,r,c) ((cm)->cmem + 3*((size_t)(r)*(cm)->ncols + (c)))
34  
35   #define cv_lval(cm,i)   ((cm)->cmem + 3*(i))
36  
37   /* Allocate a color coefficient matrix */
38 < extern CMATRIX *cm_alloc(int nrows, int ncols);
38 > extern CMATRIX  *cm_alloc(int nrows, int ncols);
39  
40   /* Resize color coefficient matrix */
41 < extern CMATRIX *cm_resize(CMATRIX *cm, int nrows);
41 > extern CMATRIX  *cm_resize(CMATRIX *cm, int nrows);
42  
43   #define cm_free(cm)     free(cm)
44  
45 < /* Load header to obtain data type */
46 < extern int getDTfromHeader(FILE *fp);
45 > /* Load header to obtain/check data type and matrix dimensions */
46 > extern char     *cm_getheader(int *dt, int *nr, int *nc,
47 >                                int *swp, COLOR scale, FILE *fp);
48  
49 < /* Allocate and load a matrix from the given file (or stdin if NULL) */
50 < extern CMATRIX *cm_load(const char *fname, int nrows, int ncols, int dtype);
49 > /* Allocate and load a matrix from the given input (or stdin if NULL) */
50 > extern CMATRIX  *cm_load(const char *inspec, int nrows, int ncols, int dtype);
51  
52   /* Extract a column vector from a matrix */
53 < extern CMATRIX *cm_column(const CMATRIX *cm, int c);
53 > extern CMATRIX  *cm_column(const CMATRIX *cm, int c);
54  
52 /* Scale a matrix by a single value */
53 extern CMATRIX *cm_scale(const CMATRIX *cm1, const COLOR sca);
54
55   /* Multiply two matrices (or a matrix and a vector) and allocate the result */
56 < extern CMATRIX *cm_multiply(const CMATRIX *cm1, const CMATRIX *cm2);
56 > extern CMATRIX  *cm_multiply(const CMATRIX *cm1, const CMATRIX *cm2);
57  
58   /* write out matrix to file (precede by resolution string if picture) */
59 < extern int cm_write(const CMATRIX *cm, int dtype, FILE *fp);
59 > extern int      cm_write(const CMATRIX *cm, int dtype, FILE *fp);
60  
61   /* Load and convert a matrix BTDF from the given XML file */
62 < extern CMATRIX *cm_loadBTDF(char *fname);
62 > extern CMATRIX  *cm_loadBTDF(const char *fname);
63 >
64 > /* Load and convert a matrix BRDF from the given XML file */
65 > extern CMATRIX  *cm_loadBRDF(const char *fname, int backside);
66  
67   #ifdef __cplusplus
68   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines