Change hexagon color gradient with number of cells
This commit is contained in:
parent
59b08dd01a
commit
c1b6a2add3
1 changed files with 1 additions and 4 deletions
5
main.cpp
5
main.cpp
|
|
@ -311,9 +311,6 @@ void create_grid(grid_t *grid, int rows, int columns)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < grid->rows; ++i)
|
||||
for (int j = 0; j < grid->columns; ++j)
|
||||
{
|
||||
|
|
@ -324,7 +321,7 @@ void create_grid(grid_t *grid, int rows, int columns)
|
|||
0);
|
||||
the_hexagon->radius = radius;
|
||||
the_hexagon->id = i * grid->columns + j;
|
||||
the_hexagon->color = glm::vec4(1.0 - i * 0.1, 1.0 - j * 0.1, 1.0, 1.0);
|
||||
the_hexagon->color = glm::vec4(1.0 - i * 1.0/rows, 1.0 - j * 1.0/columns, 1.0, 1.0);
|
||||
the_hexagon->vertices[0] = the_hexagon->position;
|
||||
the_hexagon->vertices[1] = the_hexagon->position + glm::vec3(-radius, 0, 0);
|
||||
the_hexagon->vertices[2] = the_hexagon->position + glm::vec3(-radius * glm::cos(glm::radians(60.0)), radius * glm::sin(glm::radians(60.0)), 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue