| 105 | enum pending_action { ACTION_NONE, ACTION_PCS, ACTION_PVS, ACTION_PVS_BOX }; |
| 106 | |
| 107 | struct app_state { |
| 108 | // Model |
| 109 | sam3_params params; |
| 110 | std::shared_ptr<sam3_model> model; |
| 111 | sam3_state_ptr state; |
| 112 | |
| 113 | // Image |
| 114 | sam3_image image; |
| 115 | GLuint tex_image = 0; |
| 116 | GLuint tex_overlay = 0; |
| 117 | bool image_encoded = false; |
| 118 | |
| 119 | // Interaction mode |
| 120 | interaction_mode mode = MODE_POINTS; |
| 121 | |
| 122 | // PCS |
| 123 | char text_prompt[256] = {}; |
| 124 | float score_threshold = 0.5f; |
| 125 | float nms_threshold = 0.1f; |
| 126 | std::vector<sam3_box> pos_exemplars; |
| 127 | std::vector<sam3_box> neg_exemplars; |
| 128 | |
| 129 | // PVS |
| 130 | std::vector<sam3_point> pos_points; |
| 131 | std::vector<sam3_point> neg_points; |
| 132 | bool multimask = false; |
| 133 | sam3_box pvs_box = {0, 0, 0, 0}; |
| 134 | bool has_pvs_box = false; |
| 135 | |
| 136 | // Results |
| 137 | sam3_result result; |
| 138 | bool show_masks = true; |
| 139 | |
| 140 | // Box drawing state |
| 141 | bool dragging = false; |
| 142 | float drag_x0 = 0; |
| 143 | float drag_y0 = 0; |
| 144 | |
| 145 | // Display |
| 146 | float canvas_x = 0; |
| 147 | float canvas_y = 0; |
| 148 | float canvas_w = 0; |
| 149 | float canvas_h = 0; |
| 150 | |
| 151 | // Status / busy overlay |
| 152 | char status[256] = "Ready."; |
| 153 | bool busy = false; |
| 154 | pending_action pending = ACTION_NONE; |
| 155 | |
| 156 | // Model type |
| 157 | bool visual_only = false; // true for SAM2 / SAM3 visual-only |
| 158 | }; |
| 159 | |
| 160 | static GLuint upload_texture(const uint8_t* data, int w, int h, int ch, GLuint existing = 0) { |
| 161 | GLuint tex = existing; |
nothing calls this directly
no outgoing calls
no test coverage detected