samples_u samples_v samples_s samples_t uv_corner1_x uv_corner1_y uv_corner1_z uv_corner1_w uv_corner1_p uv_corner1_q uv_corner2_x uv_corner2_y uv_corner2_z uv_corner2_w uv_corner2_p uv_corner2_q uv_corner3_x uv_corner3_y uv_corner3_z uv_corner3_w uv_corner3_p uv_corner3_q uv_corner4_x uv_corner4_y uv_corner4_z uv_corner4_w uv_corner4_p uv_corner4_q st_corner1_x st_corner1_y st_corner1_z st_corner1_w st_corner1_p st_corner1_q st_corner2_x st_corner2_y st_corner2_z st_corner2_w st_corner2_p st_corner2_q st_corner3_x st_corner3_y st_corner3_z st_corner3_w st_corner3_p st_corner3_q st_corner4_x st_corner4_y st_corner4_z st_corner4_w st_corner4_p st_corner4_qFor example, the following parameters
16 16 256 256 -2 -2 2 1 0 0 2 -2 2 1 1 0 2 2 2 1 1 1 -2 2 2 1 0 1 -1 -1 0 1 0 0 1 -1 0 1 1 0 1 1 0 1 1 1 -1 1 0 1 0 1specify a light field with 16x16 samples in uv and 256x256 samples in st. The lower-left (0,0) corner on the uv plane is at (-2,-2,2,1), the lower-right (1,0) corner is at (2,-2,2,1), etc.
FILE *lfdatafile = fopen("data", "rb");
for (i = 0; i < uwidth*uheight*vwidth*vheight; i++) {
unsigned char buf[3];
fread(buf, 3, 1, lfdatafile);
unsigned char red = buf[0];
unsigned char green = buf[1];
unsigned char blue = buf[2];
/* Do something with the data... */
}
The order of the samples varies fastest in "t", next fastest in "s",
then "v" and "u". That is, looking at (u,v,s,t) indices, the first
sample is (0,0,0,0), the next one is (0,0,0,1), and so on.