Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 1 file). Show all
Unified · Split
| @@ -365,52 +365,6 @@ void drawCircle(GeometryCache::ShapeData& shapeData, gpu::BufferPointer& vertexB · 364 unmodified lines | ||
| 365 | 365 | shapeData.setupIndices(indexBuffer, solidIndices, wireIndices); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | −template <uint32_t sMajor, uint32_t sMinor> | |
| 369 | −void drawTorus(GeometryCache::ShapeData& shapeData, gpu::BufferPointer& vertexBuffer, gpu::BufferPointer& indexBuffer) { | |
| 370 | − using namespace geometry; | |
| 371 | − Index baseVertex = (Index)(vertexBuffer->getSize() / SHAPE_VERTEX_STRIDE); | |
| 372 | − VertexVector vertices; | |
| 373 | − IndexVector solidIndices, wireIndices; | |
| 374 | − | |
| 375 | − float MAJOR_RADIUS = 0.75f; | |
| 376 | − float MINOR_RADIUS = 0.25f; | |
| 377 | − | |
| 378 | − // Minor segments | |
| 379 | − for (uint32_t j = 0; j < sMinor; j++) { | |
| 380 | − // Major segments | |
| 381 | − for (uint32_t i = 0; i < sMajor; i++) { | |
| 382 | − float_t u = float_t(i) / float_t(sMajor) * M_PI * 2; | |
| 383 | − float_t v = float_t(j + u) / float_t(sMinor) * M_PI * 2; | |
| 384 | − | |
| 385 | − vec3 vertex((MAJOR_RADIUS + MINOR_RADIUS * glm::cos(v)) * glm::cos(u), | |
| 386 | − (MAJOR_RADIUS + MINOR_RADIUS * glm::cos(v)) * glm::sin(u), | |
| 387 | − MINOR_RADIUS * glm::sin(v)); | |
| 388 | − | |
| 389 | − vertices.push_back(vertex); | |
| 390 | − } | |
| 391 | − } | |
| 392 | − | |
| 393 | − for (uint32_t x = 1; x <= sMinor; x++) { | |
| 394 | − for (uint32_t y = 1; y <= sMajor; y++) { | |
| 395 | − uint32_t a = (sMajor) * x + y - 1; | |
| 396 | − uint32_t b = (sMajor) * (x - 1) + y - 1; | |
| 397 | − uint32_t c = (sMajor) * (x - 1) + y; | |
| 398 | − uint32_t d = (sMajor) * x + y; | |
| 399 | − | |
| 400 | − solidIndices.push_back(a); | |
| 401 | − solidIndices.push_back(b); | |
| 402 | − solidIndices.push_back(d); | |
| 403 | − solidIndices.push_back(b); | |
| 404 | − solidIndices.push_back(c); | |
| 405 | − solidIndices.push_back(d); | |
| 406 | − | |
| 407 | − } | |
| 408 | − } | |
| 409 | − | |
| 410 | − shapeData.setupVertices(vertexBuffer, vertices); | |
| 411 | − shapeData.setupIndices(indexBuffer, solidIndices, wireIndices); | |
| 412 | −} | |
| 413 | − | |
| 414 | 368 | // FIXME solids need per-face vertices, but smooth shaded |
| 415 | 369 | // components do not. Find a way to support using draw elements |
| 416 | 370 | // or draw arrays as appropriate |
| @@ -469,7 +423,7 @@ void GeometryCache::buildShapes() { · 52 unmodified lines | ||
| 469 | 423 | //Quad, |
| 470 | 424 | //Circle, |
| 471 | 425 | //Torus, |
| 472 | − drawTorus<6, 4>(_shapes[Torus], _shapeVertices, _shapeIndices); | |
| 426 | + | |
| 473 | 427 | } |
| 474 | 428 | |
| 475 | 429 | gpu::Stream::FormatPointer& getSolidStreamFormat() { |