Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 12 files). Show all
Unified · Split
| @@ -54,12 +54,6 @@ const int NUM_TRIANGLES_PER_QUAD = 2; · 53 unmodified lines | ||
| 54 | 54 | const int NUM_VERTICES_PER_TRIANGULATED_QUAD = NUM_VERTICES_PER_TRIANGLE * NUM_TRIANGLES_PER_QUAD; |
| 55 | 55 | const int NUM_COORDS_PER_VERTEX = 3; |
| 56 | 56 | |
| 57 | −void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm::vec4& color, bool solid, int id) { | |
| 58 | − gpu::Batch batch; | |
| 59 | − renderSphere(batch, radius, slices, stacks, color, solid, id); | |
| 60 | − gpu::GLBackend::renderBatch(batch); | |
| 61 | −} | |
| 62 | − | |
| 63 | 57 | void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, int stacks, const glm::vec4& color, bool solid, int id) { |
| 64 | 58 | bool registered = (id != UNKNOWN_ID); |
| 65 | 59 | |
| @@ -304,12 +298,6 @@ void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, in · 238 unmodified lines | ||
| 304 | 298 | } |
| 305 | 299 | } |
| 306 | 300 | |
| 307 | −void GeometryCache::renderGrid(int xDivisions, int yDivisions, const glm::vec4& color) { | |
| 308 | − gpu::Batch batch; | |
| 309 | − renderGrid(batch, xDivisions, yDivisions, color); | |
| 310 | − gpu::GLBackend::renderBatch(batch); | |
| 311 | −} | |
| 312 | − | |
| 313 | 301 | void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions, const glm::vec4& color) { |
| 314 | 302 | IntPair key(xDivisions, yDivisions); |
| 315 | 303 | Vec3Pair colorKey(glm::vec3(color.x, color.y, yDivisions), glm::vec3(color.z, color.y, xDivisions)); |
| @@ -384,12 +372,6 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions · 68 unmodified lines | ||
| 384 | 372 | batch.draw(gpu::LINES, vertices, 0); |
| 385 | 373 | } |
| 386 | 374 | |
| 387 | −void GeometryCache::renderGrid(int x, int y, int width, int height, int rows, int cols, const glm::vec4& color, int id) { | |
| 388 | − gpu::Batch batch; | |
| 389 | − renderGrid(batch, x, y, width, height, rows, cols, color, id); | |
| 390 | − gpu::GLBackend::renderBatch(batch); | |
| 391 | −} | |
| 392 | − | |
| 393 | 375 | // TODO: why do we seem to create extra BatchItemDetails when we resize the window?? what's that?? |
| 394 | 376 | void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int height, int rows, int cols, const glm::vec4& color, int id) { |
| 395 | 377 | #ifdef WANT_DEBUG |
| @@ -691,12 +673,6 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec3>& points, con · 295 unmodified lines | ||
| 691 | 673 | #endif |
| 692 | 674 | } |
| 693 | 675 | |
| 694 | −void GeometryCache::renderVertices(gpu::Primitive primitiveType, int id) { | |
| 695 | − gpu::Batch batch; | |
| 696 | − renderVertices(batch, primitiveType, id); | |
| 697 | − gpu::GLBackend::renderBatch(batch); | |
| 698 | −} | |
| 699 | − | |
| 700 | 676 | void GeometryCache::renderVertices(gpu::Batch& batch, gpu::Primitive primitiveType, int id) { |
| 701 | 677 | BatchItemDetails& details = _registeredVertices[id]; |
| 702 | 678 | if (details.isCreated) { |
| @@ -706,12 +682,6 @@ void GeometryCache::renderVertices(gpu::Batch& batch, gpu::Primitive primitiveTy · 3 unmodified lines | ||
| 706 | 682 | } |
| 707 | 683 | } |
| 708 | 684 | |
| 709 | −void GeometryCache::renderSolidCube(float size, const glm::vec4& color) { | |
| 710 | − gpu::Batch batch; | |
| 711 | − renderSolidCube(batch, size, color); | |
| 712 | − gpu::GLBackend::renderBatch(batch); | |
| 713 | −} | |
| 714 | − | |
| 715 | 685 | void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::vec4& color) { |
| 716 | 686 | Vec2Pair colorKey(glm::vec2(color.x, color.y), glm::vec2(color.z, color.y)); |
| 717 | 687 | const int FLOATS_PER_VERTEX = 3; |
| @@ -833,12 +803,6 @@ void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::ve · 115 unmodified lines | ||
| 833 | 803 | batch.drawIndexed(gpu::TRIANGLES, indices); |
| 834 | 804 | } |
| 835 | 805 | |
| 836 | −void GeometryCache::renderWireCube(float size, const glm::vec4& color) { | |
| 837 | − gpu::Batch batch; | |
| 838 | − renderWireCube(batch, size, color); | |
| 839 | − gpu::GLBackend::renderBatch(batch); | |
| 840 | −} | |
| 841 | − | |
| 842 | 806 | void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec4& color) { |
| 843 | 807 | Vec2Pair colorKey(glm::vec2(color.x, color.y),glm::vec2(color.z, color.y)); |
| 844 | 808 | const int FLOATS_PER_VERTEX = 3; |
| @@ -922,12 +886,6 @@ void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec · 77 unmodified lines | ||
| 922 | 886 | batch.drawIndexed(gpu::LINES, indices); |
| 923 | 887 | } |
| 924 | 888 | |
| 925 | −void GeometryCache::renderBevelCornersRect(int x, int y, int width, int height, int bevelDistance, const glm::vec4& color, int id) { | |
| 926 | − gpu::Batch batch; | |
| 927 | − renderBevelCornersRect(batch, x, y, width, height, bevelDistance, color, id); | |
| 928 | − gpu::GLBackend::renderBatch(batch); | |
| 929 | −} | |
| 930 | − | |
| 931 | 889 | void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int width, int height, int bevelDistance, const glm::vec4& color, int id) { |
| 932 | 890 | bool registered = (id != UNKNOWN_ID); |
| 933 | 891 | Vec3Pair key(glm::vec3(x, y, 0.0f), glm::vec3(width, height, bevelDistance)); |
| @@ -1029,12 +987,6 @@ void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int · 95 unmodified lines | ||
| 1029 | 987 | batch.draw(gpu::TRIANGLE_STRIP, details.vertices, 0); |
| 1030 | 988 | } |
| 1031 | 989 | |
| 1032 | −void GeometryCache::renderQuad(const glm::vec2& minCorner, const glm::vec2& maxCorner, const glm::vec4& color, int id) { | |
| 1033 | − gpu::Batch batch; | |
| 1034 | − renderQuad(batch, minCorner, maxCorner, color, id); | |
| 1035 | − gpu::GLBackend::renderBatch(batch); | |
| 1036 | −} | |
| 1037 | − | |
| 1038 | 990 | void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner, const glm::vec4& color, int id) { |
| 1039 | 991 | bool registered = (id != UNKNOWN_ID); |
| 1040 | 992 | Vec4Pair key(glm::vec4(minCorner.x, minCorner.y, maxCorner.x, maxCorner.y), color); |
| @@ -1111,12 +1063,6 @@ void GeometryCache::renderUnitCube(gpu::Batch& batch) { · 70 unmodified lines | ||
| 1111 | 1063 | renderSolidCube(batch, 1, color); |
| 1112 | 1064 | } |
| 1113 | 1065 | |
| 1114 | −void GeometryCache::renderUnitQuad(const glm::vec4& color, int id) { | |
| 1115 | − gpu::Batch batch; | |
| 1116 | − renderUnitQuad(batch, color, id); | |
| 1117 | − gpu::GLBackend::renderBatch(batch); | |
| 1118 | −} | |
| 1119 | − | |
| 1120 | 1066 | void GeometryCache::renderUnitQuad(gpu::Batch& batch, const glm::vec4& color, int id) { |
| 1121 | 1067 | static const glm::vec2 topLeft(-1, 1); |
| 1122 | 1068 | static const glm::vec2 bottomRight(1, -1); |
| @@ -1126,14 +1072,6 @@ void GeometryCache::renderUnitQuad(gpu::Batch& batch, const glm::vec4& color, in · 3 unmodified lines | ||
| 1126 | 1072 | } |
| 1127 | 1073 | |
| 1128 | 1074 | |
| 1129 | −void GeometryCache::renderQuad(const glm::vec2& minCorner, const glm::vec2& maxCorner, | |
| 1130 | − const glm::vec2& texCoordMinCorner, const glm::vec2& texCoordMaxCorner, | |
| 1131 | − const glm::vec4& color, int id) { | |
| 1132 | − gpu::Batch batch; | |
| 1133 | − renderQuad(batch, minCorner, maxCorner, texCoordMinCorner, texCoordMaxCorner, color, id); | |
| 1134 | − gpu::GLBackend::renderBatch(batch); | |
| 1135 | −} | |
| 1136 | − | |
| 1137 | 1075 | void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner, |
| 1138 | 1076 | const glm::vec2& texCoordMinCorner, const glm::vec2& texCoordMaxCorner, |
| 1139 | 1077 | const glm::vec4& color, int id) { |
| @@ -1214,12 +1152,6 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, co · 74 unmodified lines | ||
| 1214 | 1152 | batch.draw(gpu::QUADS, 4, 0); |
| 1215 | 1153 | } |
| 1216 | 1154 | |
| 1217 | −void GeometryCache::renderQuad(const glm::vec3& minCorner, const glm::vec3& maxCorner, const glm::vec4& color, int id) { | |
| 1218 | − gpu::Batch batch; | |
| 1219 | − renderQuad(batch, minCorner, maxCorner, color, id); | |
| 1220 | − gpu::GLBackend::renderBatch(batch); | |
| 1221 | −} | |
| 1222 | − | |
| 1223 | 1155 | void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& minCorner, const glm::vec3& maxCorner, const glm::vec4& color, int id) { |
| 1224 | 1156 | bool registered = (id != UNKNOWN_ID); |
| 1225 | 1157 | Vec3PairVec4 key(Vec3Pair(minCorner, maxCorner), color); |
| @@ -1291,17 +1223,6 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& minCorner, co · 65 unmodified lines | ||
| 1291 | 1223 | batch.draw(gpu::QUADS, 4, 0); |
| 1292 | 1224 | } |
| 1293 | 1225 | |
| 1294 | −void GeometryCache::renderQuad(const glm::vec3& topLeft, const glm::vec3& bottomLeft, | |
| 1295 | − const glm::vec3& bottomRight, const glm::vec3& topRight, | |
| 1296 | − const glm::vec2& texCoordTopLeft, const glm::vec2& texCoordBottomLeft, | |
| 1297 | − const glm::vec2& texCoordBottomRight, const glm::vec2& texCoordTopRight, | |
| 1298 | − const glm::vec4& color, int id) { | |
| 1299 | − gpu::Batch batch; | |
| 1300 | − renderQuad(batch, topLeft, bottomLeft, bottomRight, topRight, texCoordTopLeft, texCoordBottomLeft, | |
| 1301 | − texCoordBottomRight, texCoordTopRight, color, id); | |
| 1302 | − gpu::GLBackend::renderBatch(batch); | |
| 1303 | −} | |
| 1304 | − | |
| 1305 | 1226 | void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& topLeft, const glm::vec3& bottomLeft, |
| 1306 | 1227 | const glm::vec3& bottomRight, const glm::vec3& topRight, |
| 1307 | 1228 | const glm::vec2& texCoordTopLeft, const glm::vec2& texCoordBottomLeft, |
| @@ -1395,12 +1316,6 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& topLeft, cons · 87 unmodified lines | ||
| 1395 | 1316 | batch.draw(gpu::QUADS, 4, 0); |
| 1396 | 1317 | } |
| 1397 | 1318 | |
| 1398 | −void GeometryCache::renderDashedLine(const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, int id) { | |
| 1399 | − gpu::Batch batch; | |
| 1400 | − renderDashedLine(batch, start, end, color, id); | |
| 1401 | − gpu::GLBackend::renderBatch(batch); | |
| 1402 | −} | |
| 1403 | − | |
| 1404 | 1319 | void GeometryCache::renderDashedLine(gpu::Batch& batch, const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, int id) { |
| 1405 | 1320 | bool registered = (id != UNKNOWN_ID); |
| 1406 | 1321 | Vec3PairVec2Pair key(Vec3Pair(start, end), Vec2Pair(glm::vec2(color.x, color.y), glm::vec2(color.z, color.w))); |
| @@ -1555,13 +1470,6 @@ void GeometryCache::BatchItemDetails::clear() { · 148 unmodified lines | ||
| 1555 | 1470 | stream.reset(); |
| 1556 | 1471 | } |
| 1557 | 1472 | |
| 1558 | −void GeometryCache::renderLine(const glm::vec3& p1, const glm::vec3& p2, | |
| 1559 | − const glm::vec4& color1, const glm::vec4& color2, int id) { | |
| 1560 | − gpu::Batch batch; | |
| 1561 | − renderLine(batch, p1, p2, color1, color2, id); | |
| 1562 | − gpu::GLBackend::renderBatch(batch); | |
| 1563 | −} | |
| 1564 | − | |
| 1565 | 1473 | void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm::vec3& p2, |
| 1566 | 1474 | const glm::vec4& color1, const glm::vec4& color2, int id) { |
| 1567 | 1475 | |
| @@ -1646,12 +1554,6 @@ void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm · 78 unmodified lines | ||
| 1646 | 1554 | batch.draw(gpu::LINES, 2, 0); |
| 1647 | 1555 | } |
| 1648 | 1556 | |
| 1649 | −void GeometryCache::renderLine(const glm::vec2& p1, const glm::vec2& p2, const glm::vec4& color1, const glm::vec4& color2, int id) { | |
| 1650 | − gpu::Batch batch; | |
| 1651 | − renderLine(batch, p1, p2, color1, color2, id); | |
| 1652 | − gpu::GLBackend::renderBatch(batch); | |
| 1653 | −} | |
| 1654 | − | |
| 1655 | 1557 | void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec2& p1, const glm::vec2& p2, |
| 1656 | 1558 | const glm::vec4& color1, const glm::vec4& color2, int id) { |
| 1657 | 1559 | |