ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/pictool.h
Revision: 2.2
Committed: Tue Aug 18 15:02:53 2015 UTC (8 years, 7 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R0
Changes since 2.1: +1 -0 lines
Log Message:
Added RCCS id's to new source files (forgotten during initial check-in)

File Contents

# User Rev Content
1 greg 2.2 /* RCSid $Id$ */
2 greg 2.1 #ifndef __PICTOOL_H
3     #define __PICTOOL_H
4    
5     #ifdef __cplusplus
6     extern "C" {
7     #endif
8    
9     #include <stdio.h>
10     #include <stdlib.h>
11    
12     #include "g3vector.h"
13     #include "g3affine.h"
14     #include "g3flist.h"
15    
16     #include "view.h"
17     #include "color.h"
18    
19     #define PICT_GLARE
20    
21     #define PICT_VIEW 1
22     #define PICT_LUT 2
23    
24     #define PICT_CH1 1
25     #define PICT_CH2 2
26     #define PICT_CH3 4
27    
28     #define PICT_ALLCH 7
29    
30     #ifdef PICT_GLARE
31     typedef struct pixinfo {
32     int gsn;
33     int pgs;
34     double omega;
35     FVECT dir;
36     } pixinfo;
37     #endif
38    
39     typedef struct pict {
40     int use_lut;
41     char comment[4096];
42     int valid_view;
43     VIEW view;
44     COLOR* lut;
45     RESOLU resol;
46     COLOR* pic;
47     double pjitter;
48     #ifdef PICT_GLARE
49     pixinfo* pinfo;
50     g3FList* glareinfo;
51     #endif
52     } pict;
53    
54     #define pict_get_origin(p) (p->view.vp)
55     #define pict_get_viewdir(p) (p->view.vdir)
56     #define pict_get_viewup(p) (p->view.vup)
57    
58     #define pict_lut_used(p) (p->use_lut)
59    
60     #define pict_get_comp(p,x,y,i) ((p->pic + x*p->resol.yr)[y][i])
61     #define pict_colbuf(p,buf,x,y) ((buf + y*p->resol.xr)[x])
62     #define pict_get_color(p,x,y) pict_colbuf(p,p->pic,x,y)
63     #define pict_get_xsize(p) (p->resol.xr)
64     #define pict_get_ysize(p) (p->resol.yr)
65    
66    
67    
68     #ifdef PICT_GLARE
69    
70     #define pict_get_omega(p,x,y) ((p->pinfo[y + x*p->resol.yr])).omega
71     #define pict_get_cached_dir(p,x,y) (((p->pinfo[y + x*p->resol.yr])).dir)
72     #define pict_get_gsn(p,x,y) ((p->pinfo[y + x*p->resol.yr])).gsn
73     #define pict_get_pgs(p,x,y) ((p->pinfo[y + x*p->resol.yr])).pgs
74    
75     enum {
76     PICT_GSN = 0,
77     PICT_NPIX,
78     PICT_AVPOSX,
79     PICT_AVPOSY,
80     PICT_AVLUM,
81     PICT_AVOMEGA,
82     PICT_DXMAX,
83     PICT_DYMAX,
84     PICT_LMIN,
85     PICT_LMAX,
86     PICT_EGLARE,
87     PICT_DGLARE,
88     PICT_GLSIZE
89     };
90    
91     #define pict_get_num(p,i) (g3fl_get(p->glareinfo,i)[PICT_GSN])
92     #define pict_get_npix(p,i) (g3fl_get(p->glareinfo,i)[PICT_NPIX])
93     #define pict_get_av_posx(p,i) (g3fl_get(p->glareinfo,i)[PICT_AVPOSX])
94     #define pict_get_av_posy(p,i) (g3fl_get(p->glareinfo,i)[PICT_AVPOSY])
95     #define pict_get_av_lum(p,i) (g3fl_get(p->glareinfo,i)[PICT_AVLUM])
96     #define pict_get_av_omega(p,i) (g3fl_get(p->glareinfo,i)[PICT_AVOMEGA])
97     #define pict_get_dx_max(p,i) (g3fl_get(p->glareinfo,i)[PICT_DXMAX])
98     #define pict_get_dy_max(p,i) (g3fl_get(p->glareinfo,i)[PICT_DYMAX])
99     #define pict_get_lum_min(p,i) (g3fl_get(p->glareinfo,i)[PICT_LMIN])
100     #define pict_get_lum_max(p,i) (g3fl_get(p->glareinfo,i)[PICT_LMAX])
101     #define pict_get_Eglare(p,i) (g3fl_get(p->glareinfo,i)[PICT_EGLARE])
102     #define pict_get_Dglare(p,i) (g3fl_get(p->glareinfo,i)[PICT_DGLARE])
103    
104     #define pict_get_gli_size(p) (p->glareinfo->size)
105    
106     #ifdef PICT_GLARE
107     #define pict_is_validpixel(p,x,y) (((p->view.type != VT_ANG) || \
108     (DOT(pict_get_cached_dir(p,x,y), p->view.vdir) >= 0.0))\
109     && pict_get_omega(p,x,y) > 0.0)
110     #else
111     #define pict_is_validpixel(p,x,y) (((p->view.type != VT_ANG) || \
112     (DOT(pict_get_cached_dir(p,x,y), p->view.vdir) >= 0.0))\
113     && pict_get_sangle(p,x,y) > 0)
114    
115     #endif
116    
117     void pict_new_gli(pict* p);
118    
119     void pict_update_evalglare_caches(pict* p);
120    
121     #endif
122    
123     int pict_init(pict* p);
124     pict* pict_create();
125     void pict_free(pict* p);
126    
127     pict* pict_get_copy(pict* p);
128    
129     void pict_set_comment(pict* p,const char* c);
130    
131     int pict_resize(pict* p,int x,int y);
132    
133     int pict_zero(pict* p);
134    
135     int pict_read(pict* p,char* fn);
136     int pict_read_fp(pict* p,FILE* fp);
137     int pict_read_tt_txt(pict* p,char* fn);
138     int pict_read_from_list(pict* p,FILE* fp);
139     int pict_write(pict* p,char* fn);
140     int pict_write_fp(pict* p,FILE* fp);
141     int pict_write_dir(pict* p,FILE* fp);
142    
143     int pict_setup_lut(pict* p,char* theta_fn,char* phi_fn,char* omega_fn);
144     int pict_update_lut(pict* p);
145    
146     int pict_update_view(pict* p);
147    
148     int pict_get_dir(pict* p,int x,int y,FVECT dir);
149     int pict_get_dir_ic(pict* p,double x,double y,FVECT dir);
150     int pict_get_ray(pict* p,int x,int y,FVECT orig,FVECT dir);
151     int pict_get_ray_ic(pict* p,double x,double y,FVECT orig,FVECT dir);
152     int pict_locate(pict* p,FVECT pt,int* x,int* y);
153     double pict_get_sangle(pict* p,int x,int y);
154    
155     int pict_get_vangle(pict* p,double x,double y,FVECT vdir,FVECT vup,double* a);
156     int pict_get_hangle(pict* p,double x,double y,FVECT vdir,FVECT vup,double* a);
157     int pict_get_tau(pict* p,double x,double y,FVECT vdir,FVECT vup,double* t);
158     int pict_get_sigma(pict* p,double x,double y,FVECT vdir,FVECT vup,double* s);
159    
160     int pict_set_pj(pict* p,double pj);
161     int pict_setorigin(pict* p,FVECT orig);
162     int pict_setdir(pict* p,FVECT dir);
163     int pict_setvtype(pict* p,char vt);
164     int pict_setvup(pict* p,FVECT vup);
165     int pict_sethview(pict* p,double ha);
166     int pict_setvview(pict* p,double va);
167    
168     int pict_trans_cam(pict* p,g3ATrans t);
169    
170    
171    
172    
173     #ifdef __cplusplus
174     }
175     #endif
176     #endif