vizual2.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <sys/types.h>
  4. #define GRID_ID "grid003.02"
  5. #define DSPF_ID "dspf003.02"
  6. #define LINTERP(A,B,C) ((C-A)/(B-A))*255
  7. #define VOID_TYPE char
  8. #define FLINTERP(A,B,C,D,E) (((C-A)*(E-D))/(B-A)) + D
  9. /*#define LENGTH(A,B,C) sqrt(A*A + B*B + C*C) */
  10. /* used in the lambert shading model */
  11. #define NV(A,B,C) ((A*A) + (B*B) + (C*C))
  12. #define MAXLITS 3
  13. #define MAXTHRESH 127
  14. #define MAXPOLY 10
  15. typedef struct
  16. {
  17. int nthres; /* number of thresholds */
  18. float tvalue[MAXTHRESH]; /* array of threshold values */
  19. int litmodel; /* 1 = flat, 2 = gradient(6), 3 = gradient(26) */
  20. } cmndln_info;
  21. typedef struct
  22. {
  23. int token; /*type of file */
  24. void *g3mapin, *g3mapout; /* RASTER3D_Map */
  25. FILE *datainfp, *dataoutfp;
  26. FILE *dspfinfp, *dspfoutfp;
  27. int xdim, ydim, zdim;
  28. float north, south, east, west;
  29. float top, bottom;
  30. float ns_res, ew_res, tb_res;
  31. int zone;
  32. int proj;
  33. int type; /*1 = short int, 2 = integer, 3 = float */
  34. float min, max; /* max and min values present in the data */
  35. long Dataoff; /* offset of beginning of data in file */
  36. long Lookoff; /* offset of beginning of lookup table in file */
  37. cmndln_info linefax; /* more global info */
  38. int headsize; /* size of datainf file header, necessary for random
  39. access to grid3 data */
  40. } file_info;
  41. typedef struct
  42. {
  43. float v1[3]; /*polygon vertices */
  44. float v2[3];
  45. float v3[3];
  46. float n1[3], n2[3], n3[3]; /*normals for vertices */
  47. } poly_info;
  48. typedef struct
  49. {
  50. int npoly; /* number of polygons in cube at given threshold */
  51. int t_ndx; /* index of given threshold */
  52. poly_info poly[MAXPOLY]; /*vertices and normals */
  53. } cube_info;
  54. typedef struct
  55. {
  56. int n_thresh;
  57. cube_info data[MAXTHRESH];
  58. } Cube_data;
  59. typedef struct
  60. {
  61. int nverts;
  62. int verts[8];
  63. int nedges;
  64. int edges[12];
  65. int npolys;
  66. int polys[30];
  67. } CELL_ENTRY; /* for writing out in condensed format */
  68. extern CELL_ENTRY cell_table[256];