36 files changed, 332 insertions, 176 deletions
diff --git a/src/controller/actions/process_hits.c b/src/controller/actions/process_hits.c new file mode 100644 index 0000000..4a76d1c --- a/dev/null +++ b/src/controller/actions/process_hits.c @@ -0,0 +1,45 @@ +#define GL_GLEXT_PROTOTYPES +#include "../../view/exp004state0.h" +#include "../../model/geometry/map_geometry.h" +#include "process_hits.h" +#include "sel_save.h" + +/* + * A simple alias to make the code more readable. + */ +#define S exp004state0 + +/* + * The implementation of this function is based on + * [Angel,2008,pp80-81]. + */ +void +process_hits (const GLint hits, const GLuint * hitlist) +{ + for (unsigned int i = 0; i < hits; i++) + { + hitlist += 3; + + /* + * Add the hits to the selection. + */ + S.selection.set[*hitlist] = true; + + hitlist++; + } + + sel_save (); + + glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]); + glColorPointer (4, GL_FLOAT, 0, 0); + glBufferData (GL_ARRAY_BUFFER, + sizeof (S.base_colors_data), S.base_colors_data, + GL_STATIC_DRAW); + + /* + * Rebuild the display list for the map. + */ + map_geometry (); + + return; +} |