Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "tango-gl/grid.h"
00018
00019 namespace tango_gl {
00020
00021
00022
00023
00024 Grid::Grid(float density, int qx, int qy) : Line(1.0f, GL_LINES) {
00025 SetShader();
00026
00027
00028
00029 float width = density * qx / 2;
00030 float height = density * qy / 2;
00031
00032
00033 for (int i = 0; i < (qy + 1); i++) {
00034 vec_vertices_.push_back(glm::vec3(-width, 0.0f, -height + i * density));
00035 vec_vertices_.push_back(glm::vec3(width, 0.0f, -height + i * density));
00036 }
00037
00038 for (int i = 0; i < (qx + 1); i++) {
00039 vec_vertices_.push_back(glm::vec3(-width + i * density, 0.0f, -height));
00040 vec_vertices_.push_back(glm::vec3(-width + i * density, 0.0f, height));
00041 }
00042 }
00043 }