ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/pictool.h
Revision: 2.3
Committed: Thu Jul 14 17:32:12 2016 UTC (6 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R2, rad5R3, rad5R1, HEAD
Changes since 2.2: +4 -0 lines
Log Message:
Changes to evalglare by Jan Wienold

File Contents

# Content
1 /* RCSid $Id$ */
2 #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_Z1_GSN ,
78 PICT_Z2_GSN ,
79 PICT_NPIX,
80 PICT_AVPOSX,
81 PICT_AVPOSY,
82 PICT_AVLUM,
83 PICT_AVOMEGA,
84 PICT_DXMAX,
85 PICT_DYMAX,
86 PICT_LMIN,
87 PICT_LMAX,
88 PICT_EGLARE,
89 PICT_DGLARE,
90 PICT_GLSIZE
91 };
92
93 #define pict_get_num(p,i) (g3fl_get(p->glareinfo,i)[PICT_GSN])
94 #define pict_get_z1_gsn(p,i) (g3fl_get(p->glareinfo,i)[PICT_Z1_GSN])
95 #define pict_get_z2_gsn(p,i) (g3fl_get(p->glareinfo,i)[PICT_Z2_GSN])
96 #define pict_get_npix(p,i) (g3fl_get(p->glareinfo,i)[PICT_NPIX])
97 #define pict_get_av_posx(p,i) (g3fl_get(p->glareinfo,i)[PICT_AVPOSX])
98 #define pict_get_av_posy(p,i) (g3fl_get(p->glareinfo,i)[PICT_AVPOSY])
99 #define pict_get_av_lum(p,i) (g3fl_get(p->glareinfo,i)[PICT_AVLUM])
100 #define pict_get_av_omega(p,i) (g3fl_get(p->glareinfo,i)[PICT_AVOMEGA])
101 #define pict_get_dx_max(p,i) (g3fl_get(p->glareinfo,i)[PICT_DXMAX])
102 #define pict_get_dy_max(p,i) (g3fl_get(p->glareinfo,i)[PICT_DYMAX])
103 #define pict_get_lum_min(p,i) (g3fl_get(p->glareinfo,i)[PICT_LMIN])
104 #define pict_get_lum_max(p,i) (g3fl_get(p->glareinfo,i)[PICT_LMAX])
105 #define pict_get_Eglare(p,i) (g3fl_get(p->glareinfo,i)[PICT_EGLARE])
106 #define pict_get_Dglare(p,i) (g3fl_get(p->glareinfo,i)[PICT_DGLARE])
107
108 #define pict_get_gli_size(p) (p->glareinfo->size)
109
110 #ifdef PICT_GLARE
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_omega(p,x,y) > 0.0)
114 #else
115 #define pict_is_validpixel(p,x,y) (((p->view.type != VT_ANG) || \
116 (DOT(pict_get_cached_dir(p,x,y), p->view.vdir) >= 0.0))\
117 && pict_get_sangle(p,x,y) > 0)
118
119 #endif
120
121 void pict_new_gli(pict* p);
122
123 void pict_update_evalglare_caches(pict* p);
124
125 #endif
126
127 int pict_init(pict* p);
128 pict* pict_create();
129 void pict_free(pict* p);
130
131 pict* pict_get_copy(pict* p);
132
133 void pict_set_comment(pict* p,const char* c);
134
135 int pict_resize(pict* p,int x,int y);
136
137 int pict_zero(pict* p);
138
139 int pict_read(pict* p,char* fn);
140 int pict_read_fp(pict* p,FILE* fp);
141 int pict_read_tt_txt(pict* p,char* fn);
142 int pict_read_from_list(pict* p,FILE* fp);
143 int pict_write(pict* p,char* fn);
144 int pict_write_fp(pict* p,FILE* fp);
145 int pict_write_dir(pict* p,FILE* fp);
146
147 int pict_setup_lut(pict* p,char* theta_fn,char* phi_fn,char* omega_fn);
148 int pict_update_lut(pict* p);
149
150 int pict_update_view(pict* p);
151
152 int pict_get_dir(pict* p,int x,int y,FVECT dir);
153 int pict_get_dir_ic(pict* p,double x,double y,FVECT dir);
154 int pict_get_ray(pict* p,int x,int y,FVECT orig,FVECT dir);
155 int pict_get_ray_ic(pict* p,double x,double y,FVECT orig,FVECT dir);
156 int pict_locate(pict* p,FVECT pt,int* x,int* y);
157 double pict_get_sangle(pict* p,int x,int y);
158
159 int pict_get_vangle(pict* p,double x,double y,FVECT vdir,FVECT vup,double* a);
160 int pict_get_hangle(pict* p,double x,double y,FVECT vdir,FVECT vup,double* a);
161 int pict_get_tau(pict* p,double x,double y,FVECT vdir,FVECT vup,double* t);
162 int pict_get_sigma(pict* p,double x,double y,FVECT vdir,FVECT vup,double* s);
163
164 int pict_set_pj(pict* p,double pj);
165 int pict_setorigin(pict* p,FVECT orig);
166 int pict_setdir(pict* p,FVECT dir);
167 int pict_setvtype(pict* p,char vt);
168 int pict_setvup(pict* p,FVECT vup);
169 int pict_sethview(pict* p,double ha);
170 int pict_setvview(pict* p,double va);
171
172 int pict_trans_cam(pict* p,g3ATrans t);
173
174
175
176
177 #ifdef __cplusplus
178 }
179 #endif
180 #endif