summaryrefslogtreecommitdiffstats
path: root/src/controller/exp004processhits.c (plain)
blob: c51e1702d204e0603e89bccd56a5628e2613ab23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#define GL_GLEXT_PROTOTYPES
#include "../view/exp004state0.h"
#include "../model/geometry/map_geometry.h"
#include "exp004processhits.h"
#include "selsave.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
exp004processhits (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++;
    }

  selsave ();

  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;
}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.