| 201 | } |
| 202 | |
| 203 | void SimpleOpenGL2App::drawGrid(DrawGridData data) |
| 204 | { |
| 205 | glEnable(GL_COLOR_MATERIAL); |
| 206 | int gridSize = data.gridSize; |
| 207 | float upOffset = data.upOffset; |
| 208 | int upAxis = data.upAxis; |
| 209 | float gridColor[4]; |
| 210 | gridColor[0] = data.gridColor[0]; |
| 211 | gridColor[1] = data.gridColor[1]; |
| 212 | gridColor[2] = data.gridColor[2]; |
| 213 | gridColor[3] = data.gridColor[3]; |
| 214 | |
| 215 | int sideAxis = -1; |
| 216 | int forwardAxis = -1; |
| 217 | |
| 218 | switch (upAxis) |
| 219 | { |
| 220 | case 1: |
| 221 | forwardAxis = 2; |
| 222 | sideAxis = 0; |
| 223 | break; |
| 224 | case 2: |
| 225 | forwardAxis = 1; |
| 226 | sideAxis = 0; |
| 227 | break; |
| 228 | default: |
| 229 | b3Assert(0); |
| 230 | }; |
| 231 | //b3Vector3 gridColor = b3MakeVector3(0.5,0.5,0.5); |
| 232 | |
| 233 | b3AlignedObjectArray<unsigned int> indices; |
| 234 | b3AlignedObjectArray<b3Vector3> vertices; |
| 235 | int lineIndex = 0; |
| 236 | for (int i = -gridSize; i <= gridSize; i++) |
| 237 | { |
| 238 | { |
| 239 | b3Assert(glGetError() == GL_NO_ERROR); |
| 240 | b3Vector3 from = b3MakeVector3(0, 0, 0); |
| 241 | from[sideAxis] = float(i); |
| 242 | from[upAxis] = upOffset; |
| 243 | from[forwardAxis] = float(-gridSize); |
| 244 | b3Vector3 to = b3MakeVector3(0, 0, 0); |
| 245 | to[sideAxis] = float(i); |
| 246 | to[upAxis] = upOffset; |
| 247 | to[forwardAxis] = float(gridSize); |
| 248 | vertices.push_back(from); |
| 249 | indices.push_back(lineIndex++); |
| 250 | vertices.push_back(to); |
| 251 | indices.push_back(lineIndex++); |
| 252 | // m_renderer->drawLine(from,to,gridColor); |
| 253 | } |
| 254 | |
| 255 | b3Assert(glGetError() == GL_NO_ERROR); |
| 256 | { |
| 257 | b3Assert(glGetError() == GL_NO_ERROR); |
| 258 | b3Vector3 from = b3MakeVector3(0, 0, 0); |
| 259 | from[sideAxis] = float(-gridSize); |
| 260 | from[upAxis] = upOffset; |
nothing calls this directly
no test coverage detected