27 files changed, 179 insertions, 549 deletions
diff --git a/src/model/state/state.h b/src/model/state/state.h new file mode 100644 index 0000000..ac1e035 --- a/dev/null +++ b/src/model/state/state.h | |||
@@ -0,0 +1,122 @@ | |||
1 | #ifndef STATE_H | ||
2 | #define STATE_H | ||
3 | |||
4 | #include "selection_info.h" | ||
5 | #include "zoom_info.h" | ||
6 | #include "pan_info.h" | ||
7 | |||
8 | /* | ||
9 | * Buffer object identifiers. | ||
10 | */ | ||
11 | #define BASE_VERTICES 0 | ||
12 | #define BASE_COLORS 1 | ||
13 | |||
14 | #define CLEAR_COLOR 1.0, 1.0, 1.0, 1.0 | ||
15 | #define DRAW_COLOR 0.0, 0.0, 0.0 | ||
16 | |||
17 | #define DEFAULT_COLOR_R 0.00 | ||
18 | #define DEFAULT_COLOR_G 0.00 | ||
19 | #define DEFAULT_COLOR_B 0.01 | ||
20 | #define DEFAULT_COLOR_A (1.0 / 7.0) | ||
21 | |||
22 | #define SELECT_COLOR_R 0.00 | ||
23 | #define SELECT_COLOR_G 0.00 | ||
24 | #define SELECT_COLOR_B 0.00 | ||
25 | #define SELECT_COLOR_A 0.75 | ||
26 | |||
27 | typedef enum | ||
28 | { PROTEIN_GEOMETRY, PROTEIN_SELECTED_GEOMETRY, DENSITY_LEGEND_GEOMETRY, | ||
29 | MAP_GEOMETRY | ||
30 | } LISTS; | ||
31 | #define NUM_LISTS 2 | ||
32 | |||
33 | /* | ||
34 | * Maintain state of the model. | ||
35 | */ | ||
36 | typedef struct | ||
37 | { | ||
38 | /* | ||
39 | * Number of nodes having coordinates assigned. | ||
40 | */ | ||
41 | unsigned int rows; | ||
42 | |||
43 | /* | ||
44 | * Display lists. | ||
45 | */ | ||
46 | unsigned int list_offset; | ||
47 | |||
48 | /* | ||
49 | * Track the bounding box of the points. | ||
50 | */ | ||
51 | struct | ||
52 | { | ||
53 | float min_x; | ||
54 | float max_x; | ||
55 | float min_y; | ||
56 | float max_y; | ||
57 | } bb; | ||
58 | |||
59 | /* | ||
60 | * Minimum coordinate for the orthographic projection. | ||
61 | */ | ||
62 | float ortho_min; | ||
63 | |||
64 | /* | ||
65 | * Maximum coordinate for the orthographic projection. | ||
66 | */ | ||
67 | float ortho_max; | ||
68 | |||
69 | /* | ||
70 | * Orthographic coordinates after aspect preserving scaling. | ||
71 | */ | ||
72 | struct | ||
73 | { | ||
74 | double min_x; | ||
75 | double max_x; | ||
76 | double min_y; | ||
77 | double max_y; | ||
78 | } ortho; | ||
79 | |||
80 | /* | ||
81 | * Viewport size. | ||
82 | */ | ||
83 | struct | ||
84 | { | ||
85 | int w; | ||
86 | int h; | ||
87 | } viewport; | ||
88 | |||
89 | /* | ||
90 | * Buffer objects. | ||
91 | */ | ||
92 | unsigned int buffers[1]; | ||
93 | |||
94 | /* | ||
95 | * GI Identifiers indexed by row. Storage is [rows][20]. | ||
96 | */ | ||
97 | char *gi_data; | ||
98 | |||
99 | /* | ||
100 | * 2D coordinates for each protein. Storage is [rows][2]. | ||
101 | */ | ||
102 | float *base_vertices_data; | ||
103 | |||
104 | /* | ||
105 | * RGB color for each protein. Storage is [rows][4]. | ||
106 | */ | ||
107 | float *base_colors_data; | ||
108 | |||
109 | SELECTION_INFO selection; | ||
110 | |||
111 | ZOOM_INFO zoom; | ||
112 | |||
113 | PAN_INFO pan; | ||
114 | |||
115 | /* | ||
116 | * Display a legend on the map. | ||
117 | */ | ||
118 | bool legend; | ||
119 | |||
120 | } STATE; | ||
121 | |||
122 | #endif // STATE_H | ||