30 std::vector<float>& normals,
31 std::vector<float>& colors) {
37 vertices.reserve(dataSize);
38 normals.reserve(dataSize);
39 colors.reserve(dataSize);
41 const float xStep =
_size[0] / (float)_squares[0];
42 const float yStep =
_size[1] / (float)_squares[1];
44 for (
size_t i = 0; i < _squares[0]; i++) {
45 for (
size_t j = 0; j < _squares[1]; j++) {
48 for (
size_t k = 0; k < 6; k++) {
49 for (
size_t m = 0; m < 3; m++) {
50 colors.push_back(squareColor[m]);
51 normals.push_back(m == 2 ? 1 : 0);
55 const float xStart = xStep * i;
56 const float yStart = yStep * j;
59 vertices.push_back(xStart);
60 vertices.push_back(yStart);
61 vertices.push_back(0);
63 vertices.push_back(xStart);
64 vertices.push_back(yStart + yStep);
65 vertices.push_back(0);
67 vertices.push_back(xStart + xStep);
68 vertices.push_back(yStart);
69 vertices.push_back(0);
72 vertices.push_back(xStart);
73 vertices.push_back(yStart + yStep);
74 vertices.push_back(0);
76 vertices.push_back(xStart + xStep);
77 vertices.push_back(yStart + yStep);
78 vertices.push_back(0);
80 vertices.push_back(xStart + xStep);
81 vertices.push_back(yStart);
82 vertices.push_back(0);
Checkerboard(float xSize, float ySize, size_t xSquares, size_t ySquares)
void computeVertices(std::vector< float > &vertices, std::vector< float > &normals, std::vector< float > &colors)
const float * _lightColor