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