History

remove non-batch versions of GeometryCache renderXYZ() methods

ZappoMan committed 11 years ago

Commit c2113ea1 parent 36f63e412 files · +13 −203Browse files

Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 12 files). Show all

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+0−98
@@ -54,12 +54,6 @@ const int NUM_TRIANGLES_PER_QUAD = 2; · 53 unmodified lines
54const int NUM_VERTICES_PER_TRIANGULATED_QUAD = NUM_VERTICES_PER_TRIANGLE * NUM_TRIANGLES_PER_QUAD;54const int NUM_VERTICES_PER_TRIANGULATED_QUAD = NUM_VERTICES_PER_TRIANGLE * NUM_TRIANGLES_PER_QUAD;
55const int NUM_COORDS_PER_VERTEX = 3;55const int NUM_COORDS_PER_VERTEX = 3;
56 56
57void 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
63void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, int stacks, const glm::vec4& color, bool solid, int id) {57void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, int stacks, const glm::vec4& color, bool solid, int id) {
64 bool registered = (id != UNKNOWN_ID);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
307void 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
313void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions, const glm::vec4& color) {301void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions, const glm::vec4& color) {
314 IntPair key(xDivisions, yDivisions);302 IntPair key(xDivisions, yDivisions);
315 Vec3Pair colorKey(glm::vec3(color.x, color.y, yDivisions), glm::vec3(color.z, color.y, xDivisions));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 batch.draw(gpu::LINES, vertices, 0);372 batch.draw(gpu::LINES, vertices, 0);
385}373}
386 374
387void 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// TODO: why do we seem to create extra BatchItemDetails when we resize the window?? what's that??375// TODO: why do we seem to create extra BatchItemDetails when we resize the window?? what's that??
394void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int height, int rows, int cols, const glm::vec4& color, int id) {376void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int height, int rows, int cols, const glm::vec4& color, int id) {
395 #ifdef WANT_DEBUG377 #ifdef WANT_DEBUG
@@ -691,12 +673,6 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec3>& points, con · 295 unmodified lines
691 #endif673 #endif
692}674}
693 675
694void GeometryCache::renderVertices(gpu::Primitive primitiveType, int id) {
695 gpu::Batch batch;
696 renderVertices(batch, primitiveType, id);
697 gpu::GLBackend::renderBatch(batch);
698}
699
700void GeometryCache::renderVertices(gpu::Batch& batch, gpu::Primitive primitiveType, int id) {676void GeometryCache::renderVertices(gpu::Batch& batch, gpu::Primitive primitiveType, int id) {
701 BatchItemDetails& details = _registeredVertices[id];677 BatchItemDetails& details = _registeredVertices[id];
702 if (details.isCreated) {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
709void GeometryCache::renderSolidCube(float size, const glm::vec4& color) {
710 gpu::Batch batch;
711 renderSolidCube(batch, size, color);
712 gpu::GLBackend::renderBatch(batch);
713}
714
715void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::vec4& color) {685void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::vec4& color) {
716 Vec2Pair colorKey(glm::vec2(color.x, color.y), glm::vec2(color.z, color.y));686 Vec2Pair colorKey(glm::vec2(color.x, color.y), glm::vec2(color.z, color.y));
717 const int FLOATS_PER_VERTEX = 3;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 batch.drawIndexed(gpu::TRIANGLES, indices);803 batch.drawIndexed(gpu::TRIANGLES, indices);
834}804}
835 805
836void GeometryCache::renderWireCube(float size, const glm::vec4& color) {
837 gpu::Batch batch;
838 renderWireCube(batch, size, color);
839 gpu::GLBackend::renderBatch(batch);
840}
841
842void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec4& color) {806void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec4& color) {
843 Vec2Pair colorKey(glm::vec2(color.x, color.y),glm::vec2(color.z, color.y));807 Vec2Pair colorKey(glm::vec2(color.x, color.y),glm::vec2(color.z, color.y));
844 const int FLOATS_PER_VERTEX = 3;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 batch.drawIndexed(gpu::LINES, indices);886 batch.drawIndexed(gpu::LINES, indices);
923}887}
924 888
925void 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
931void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int width, int height, int bevelDistance, const glm::vec4& color, int id) {889void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int width, int height, int bevelDistance, const glm::vec4& color, int id) {
932 bool registered = (id != UNKNOWN_ID);890 bool registered = (id != UNKNOWN_ID);
933 Vec3Pair key(glm::vec3(x, y, 0.0f), glm::vec3(width, height, bevelDistance));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 batch.draw(gpu::TRIANGLE_STRIP, details.vertices, 0);987 batch.draw(gpu::TRIANGLE_STRIP, details.vertices, 0);
1030}988}
1031 989
1032void 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
1038void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner, const glm::vec4& color, int id) {990void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner, const glm::vec4& color, int id) {
1039 bool registered = (id != UNKNOWN_ID);991 bool registered = (id != UNKNOWN_ID);
1040 Vec4Pair key(glm::vec4(minCorner.x, minCorner.y, maxCorner.x, maxCorner.y), color);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 renderSolidCube(batch, 1, color);1063 renderSolidCube(batch, 1, color);
1112}1064}
1113 1065
1114void GeometryCache::renderUnitQuad(const glm::vec4& color, int id) {
1115 gpu::Batch batch;
1116 renderUnitQuad(batch, color, id);
1117 gpu::GLBackend::renderBatch(batch);
1118}
1119
1120void GeometryCache::renderUnitQuad(gpu::Batch& batch, const glm::vec4& color, int id) {1066void GeometryCache::renderUnitQuad(gpu::Batch& batch, const glm::vec4& color, int id) {
1121 static const glm::vec2 topLeft(-1, 1);1067 static const glm::vec2 topLeft(-1, 1);
1122 static const glm::vec2 bottomRight(1, -1);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
1129void 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
1137void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner,1075void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner,
1138 const glm::vec2& texCoordMinCorner, const glm::vec2& texCoordMaxCorner, 1076 const glm::vec2& texCoordMinCorner, const glm::vec2& texCoordMaxCorner,
1139 const glm::vec4& color, int id) {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 batch.draw(gpu::QUADS, 4, 0);1152 batch.draw(gpu::QUADS, 4, 0);
1215}1153}
1216 1154
1217void 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
1223void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& minCorner, const glm::vec3& maxCorner, const glm::vec4& color, int id) {1155void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& minCorner, const glm::vec3& maxCorner, const glm::vec4& color, int id) {
1224 bool registered = (id != UNKNOWN_ID);1156 bool registered = (id != UNKNOWN_ID);
1225 Vec3PairVec4 key(Vec3Pair(minCorner, maxCorner), color);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 batch.draw(gpu::QUADS, 4, 0);1223 batch.draw(gpu::QUADS, 4, 0);
1292}1224}
1293 1225
1294void 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
1305void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& topLeft, const glm::vec3& bottomLeft, 1226void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& topLeft, const glm::vec3& bottomLeft,
1306 const glm::vec3& bottomRight, const glm::vec3& topRight,1227 const glm::vec3& bottomRight, const glm::vec3& topRight,
1307 const glm::vec2& texCoordTopLeft, const glm::vec2& texCoordBottomLeft,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 batch.draw(gpu::QUADS, 4, 0);1316 batch.draw(gpu::QUADS, 4, 0);
1396}1317}
1397 1318
1398void 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
1404void GeometryCache::renderDashedLine(gpu::Batch& batch, const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, int id) {1319void GeometryCache::renderDashedLine(gpu::Batch& batch, const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, int id) {
1405 bool registered = (id != UNKNOWN_ID);1320 bool registered = (id != UNKNOWN_ID);
1406 Vec3PairVec2Pair key(Vec3Pair(start, end), Vec2Pair(glm::vec2(color.x, color.y), glm::vec2(color.z, color.w)));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 stream.reset();1470 stream.reset();
1556}1471}
1557 1472
1558void 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
1565void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm::vec3& p2, 1473void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm::vec3& p2,
1566 const glm::vec4& color1, const glm::vec4& color2, int id) {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 batch.draw(gpu::LINES, 2, 0);1554 batch.draw(gpu::LINES, 2, 0);
1647}1555}
1648 1556
1649void 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
1655void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec2& p1, const glm::vec2& p2, 1557void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec2& p1, const glm::vec2& p2,
1656 const glm::vec4& color1, const glm::vec4& color2, int id) {1558 const glm::vec4& color1, const glm::vec4& color2, int id) {
1657 1559