Add support for Skybox and rendering path of background according to Zones
Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 36 files). Show all
Unified · Split
| @@ -69,7 +69,7 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm · 68 unmodified lines | |||
| 69 | || (!registered && !_sphereVertices.contains(radiusKey))) { | 69 | || (!registered && !_sphereVertices.contains(radiusKey))) { |
| 70 | 70 | ||
| 71 | if (registered && _registeredSphereVertices.contains(id)) { | 71 | if (registered && _registeredSphereVertices.contains(id)) { |
| 72 | _registeredSphereVertices[id].clear(); | 72 | _registeredSphereVertices[id].reset(); |
| 73 | #ifdef WANT_DEBUG | 73 | #ifdef WANT_DEBUG |
| 74 | qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED VERTICES BUFFER"; | 74 | qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED VERTICES BUFFER"; |
| 75 | #endif | 75 | #endif |
| @@ -111,7 +111,7 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm · 35 unmodified lines | |||
| 111 | *(vertex++) = 0.0f; | 111 | *(vertex++) = 0.0f; |
| 112 | *(vertex++) = 1.0f * radius; | 112 | *(vertex++) = 1.0f * radius; |
| 113 | 113 | ||
| 114 | verticesBuffer->append(sizeof(GLfloat) * vertices * NUM_COORDS_PER_VERTEX, (gpu::Buffer::Byte*) vertexData); | 114 | verticesBuffer->append(sizeof(GLfloat) * vertices * NUM_COORDS_PER_VERTEX, (gpu::Byte*) vertexData); |
| 115 | delete[] vertexData; | 115 | delete[] vertexData; |
| 116 | 116 | ||
| 117 | #ifdef WANT_DEBUG | 117 | #ifdef WANT_DEBUG |
| @@ -133,7 +133,7 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm · 15 unmodified lines | |||
| 133 | || (!registered && !_sphereIndices.contains(slicesStacksKey))) { | 133 | || (!registered && !_sphereIndices.contains(slicesStacksKey))) { |
| 134 | 134 | ||
| 135 | if (registered && _registeredSphereIndices.contains(id)) { | 135 | if (registered && _registeredSphereIndices.contains(id)) { |
| 136 | _registeredSphereIndices[id].clear(); | 136 | _registeredSphereIndices[id].reset(); |
| 137 | #ifdef WANT_DEBUG | 137 | #ifdef WANT_DEBUG |
| 138 | qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED INDICES BUFFER"; | 138 | qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED INDICES BUFFER"; |
| 139 | #endif | 139 | #endif |
| @@ -196,7 +196,7 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm · 56 unmodified lines | |||
| 196 | indexCount += 3; | 196 | indexCount += 3; |
| 197 | 197 | ||
| 198 | } | 198 | } |
| 199 | indicesBuffer->append(sizeof(GLushort) * indices, (gpu::Buffer::Byte*) indexData); | 199 | indicesBuffer->append(sizeof(GLushort) * indices, (gpu::Byte*) indexData); |
| 200 | delete[] indexData; | 200 | delete[] indexData; |
| 201 | 201 | ||
| 202 | #ifdef WANT_DEBUG | 202 | #ifdef WANT_DEBUG |
| @@ -219,7 +219,7 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm · 16 unmodified lines | |||
| 219 | || (!registered && !_sphereColors.contains(colorKey))) { | 219 | || (!registered && !_sphereColors.contains(colorKey))) { |
| 220 | 220 | ||
| 221 | if (registered && _registeredSphereColors.contains(id)) { | 221 | if (registered && _registeredSphereColors.contains(id)) { |
| 222 | _registeredSphereColors[id].clear(); | 222 | _registeredSphereColors[id].reset(); |
| 223 | #ifdef WANT_DEBUG | 223 | #ifdef WANT_DEBUG |
| 224 | qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED COLORS BUFFER"; | 224 | qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED COLORS BUFFER"; |
| 225 | #endif | 225 | #endif |
| @@ -245,7 +245,7 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm · 19 unmodified lines | |||
| 245 | *(colorDataAt++) = compactColor; | 245 | *(colorDataAt++) = compactColor; |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | colorBuffer->append(sizeof(int) * vertices, (gpu::Buffer::Byte*) colorData); | 248 | colorBuffer->append(sizeof(int) * vertices, (gpu::Byte*) colorData); |
| 249 | delete[] colorData; | 249 | delete[] colorData; |
| 250 | 250 | ||
| 251 | #ifdef WANT_DEBUG | 251 | #ifdef WANT_DEBUG |
| @@ -432,7 +432,7 @@ void GeometryCache::renderGrid(int xDivisions, int yDivisions, const glm::vec4& · 180 unmodified lines | |||
| 432 | *(vertex++) = y; | 432 | *(vertex++) = y; |
| 433 | } | 433 | } |
| 434 | 434 | ||
| 435 | verticesBuffer->append(sizeof(GLfloat) * vertices * 2, (gpu::Buffer::Byte*) vertexData); | 435 | verticesBuffer->append(sizeof(GLfloat) * vertices * 2, (gpu::Byte*) vertexData); |
| 436 | delete[] vertexData; | 436 | delete[] vertexData; |
| 437 | 437 | ||
| 438 | _gridBuffers[key] = verticesBuffer; | 438 | _gridBuffers[key] = verticesBuffer; |
| @@ -454,7 +454,7 @@ void GeometryCache::renderGrid(int xDivisions, int yDivisions, const glm::vec4& · 15 unmodified lines | |||
| 454 | *(colorDataAt++) = compactColor; | 454 | *(colorDataAt++) = compactColor; |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | colorBuffer->append(sizeof(int) * vertices, (gpu::Buffer::Byte*) colorData); | 457 | colorBuffer->append(sizeof(int) * vertices, (gpu::Byte*) colorData); |
| 458 | delete[] colorData; | 458 | delete[] colorData; |
| 459 | } | 459 | } |
| 460 | gpu::BufferPointer verticesBuffer = _gridBuffers[key]; | 460 | gpu::BufferPointer verticesBuffer = _gridBuffers[key]; |
| @@ -537,7 +537,7 @@ void GeometryCache::renderGrid(int x, int y, int width, int height, int rows, in · 76 unmodified lines | |||
| 537 | tx += dx; | 537 | tx += dx; |
| 538 | } | 538 | } |
| 539 | 539 | ||
| 540 | verticesBuffer->append(sizeof(GLfloat) * vertices * 2, (gpu::Buffer::Byte*) vertexData); | 540 | verticesBuffer->append(sizeof(GLfloat) * vertices * 2, (gpu::Byte*) vertexData); |
| 541 | delete[] vertexData; | 541 | delete[] vertexData; |
| 542 | 542 | ||
| 543 | if (registered) { | 543 | if (registered) { |
| @@ -564,7 +564,7 @@ void GeometryCache::renderGrid(int x, int y, int width, int height, int rows, in · 20 unmodified lines | |||
| 564 | *(colorDataAt++) = compactColor; | 564 | *(colorDataAt++) = compactColor; |
| 565 | } | 565 | } |
| 566 | 566 | ||
| 567 | colorBuffer->append(sizeof(int) * vertices, (gpu::Buffer::Byte*) colorData); | 567 | colorBuffer->append(sizeof(int) * vertices, (gpu::Byte*) colorData); |
| 568 | delete[] colorData; | 568 | delete[] colorData; |
| 569 | } | 569 | } |
| 570 | gpu::BufferPointer verticesBuffer = registered ? _registeredAlternateGridBuffers[id] : _alternateGridBuffers[key]; | 570 | gpu::BufferPointer verticesBuffer = registered ? _registeredAlternateGridBuffers[id] : _alternateGridBuffers[key]; |
| @@ -648,8 +648,8 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec2>& points, con · 77 unmodified lines | |||
| 648 | *(colorDataAt++) = compactColor; | 648 | *(colorDataAt++) = compactColor; |
| 649 | } | 649 | } |
| 650 | 650 | ||
| 651 | details.verticesBuffer->append(sizeof(GLfloat) * FLOATS_PER_VERTEX * details.vertices, (gpu::Buffer::Byte*) vertexData); | 651 | details.verticesBuffer->append(sizeof(GLfloat) * FLOATS_PER_VERTEX * details.vertices, (gpu::Byte*) vertexData); |
| 652 | details.colorBuffer->append(sizeof(int) * details.vertices, (gpu::Buffer::Byte*) colorData); | 652 | details.colorBuffer->append(sizeof(int) * details.vertices, (gpu::Byte*) colorData); |
| 653 | delete[] vertexData; | 653 | delete[] vertexData; |
| 654 | delete[] colorData; | 654 | delete[] colorData; |
| 655 | 655 | ||
| @@ -711,8 +711,8 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec3>& points, con · 55 unmodified lines | |||
| 711 | *(colorDataAt++) = compactColor; | 711 | *(colorDataAt++) = compactColor; |
| 712 | } | 712 | } |
| 713 | 713 | ||
| 714 | details.verticesBuffer->append(sizeof(GLfloat) * FLOATS_PER_VERTEX * details.vertices, (gpu::Buffer::Byte*) vertexData); | 714 | details.verticesBuffer->append(sizeof(GLfloat) * FLOATS_PER_VERTEX * details.vertices, (gpu::Byte*) vertexData); |
| 715 | details.colorBuffer->append(sizeof(int) * details.vertices, (gpu::Buffer::Byte*) colorData); | 715 | details.colorBuffer->append(sizeof(int) * details.vertices, (gpu::Byte*) colorData); |
| 716 | delete[] vertexData; | 716 | delete[] vertexData; |
| 717 | delete[] colorData; | 717 | delete[] colorData; |
| 718 | 718 | ||
| @@ -793,7 +793,7 @@ void GeometryCache::renderSolidCube(float size, const glm::vec4& color) { · 74 unmodified lines | |||
| 793 | *(vertex++) = *cannonicalNormal++; | 793 | *(vertex++) = *cannonicalNormal++; |
| 794 | } | 794 | } |
| 795 | 795 | ||
| 796 | verticesBuffer->append(sizeof(GLfloat) * vertexPoints * 2, (gpu::Buffer::Byte*) vertexData); | 796 | verticesBuffer->append(sizeof(GLfloat) * vertexPoints * 2, (gpu::Byte*) vertexData); |
| 797 | } | 797 | } |
| 798 | 798 | ||
| 799 | if (!_solidCubeIndexBuffer) { | 799 | if (!_solidCubeIndexBuffer) { |
| @@ -808,7 +808,7 @@ void GeometryCache::renderSolidCube(float size, const glm::vec4& color) { · 8 unmodified lines | |||
| 808 | gpu::BufferPointer indexBuffer(new gpu::Buffer()); | 808 | gpu::BufferPointer indexBuffer(new gpu::Buffer()); |
| 809 | _solidCubeIndexBuffer = indexBuffer; | 809 | _solidCubeIndexBuffer = indexBuffer; |
| 810 | 810 | ||
| 811 | _solidCubeIndexBuffer->append(sizeof(cannonicalIndices), (gpu::Buffer::Byte*) cannonicalIndices); | 811 | _solidCubeIndexBuffer->append(sizeof(cannonicalIndices), (gpu::Byte*) cannonicalIndices); |
| 812 | } | 812 | } |
| 813 | 813 | ||
| 814 | if (!_solidCubeColors.contains(colorKey)) { | 814 | if (!_solidCubeColors.contains(colorKey)) { |
| @@ -827,7 +827,7 @@ void GeometryCache::renderSolidCube(float size, const glm::vec4& color) { · 12 unmodified lines | |||
| 827 | compactColor, compactColor, compactColor, compactColor, | 827 | compactColor, compactColor, compactColor, compactColor, |
| 828 | compactColor, compactColor, compactColor, compactColor }; | 828 | compactColor, compactColor, compactColor, compactColor }; |
| 829 | 829 | ||
| 830 | colorBuffer->append(sizeof(colors), (gpu::Buffer::Byte*) colors); | 830 | colorBuffer->append(sizeof(colors), (gpu::Byte*) colors); |
| 831 | } | 831 | } |
| 832 | gpu::BufferPointer verticesBuffer = _solidCubeVerticies[size]; | 832 | gpu::BufferPointer verticesBuffer = _solidCubeVerticies[size]; |
| 833 | gpu::BufferPointer colorBuffer = _solidCubeColors[colorKey]; | 833 | gpu::BufferPointer colorBuffer = _solidCubeColors[colorKey]; |
| @@ -891,7 +891,7 @@ void GeometryCache::renderWireCube(float size, const glm::vec4& color) { · 57 unmodified lines | |||
| 891 | vertex[i] = cannonicalVertices[i] * halfSize; | 891 | vertex[i] = cannonicalVertices[i] * halfSize; |
| 892 | } | 892 | } |
| 893 | 893 | ||
| 894 | verticesBuffer->append(sizeof(GLfloat) * vertexPoints, (gpu::Buffer::Byte*) vertexData); // I'm skeptical that this is right | 894 | verticesBuffer->append(sizeof(GLfloat) * vertexPoints, (gpu::Byte*) vertexData); // I'm skeptical that this is right |
| 895 | } | 895 | } |
| 896 | 896 | ||
| 897 | if (!_wireCubeIndexBuffer) { | 897 | if (!_wireCubeIndexBuffer) { |
| @@ -904,7 +904,7 @@ void GeometryCache::renderWireCube(float size, const glm::vec4& color) { · 6 unmodified lines | |||
| 904 | gpu::BufferPointer indexBuffer(new gpu::Buffer()); | 904 | gpu::BufferPointer indexBuffer(new gpu::Buffer()); |
| 905 | _wireCubeIndexBuffer = indexBuffer; | 905 | _wireCubeIndexBuffer = indexBuffer; |
| 906 | 906 | ||
| 907 | _wireCubeIndexBuffer->append(sizeof(cannonicalIndices), (gpu::Buffer::Byte*) cannonicalIndices); | 907 | _wireCubeIndexBuffer->append(sizeof(cannonicalIndices), (gpu::Byte*) cannonicalIndices); |
| 908 | } | 908 | } |
| 909 | 909 | ||
| 910 | if (!_cubeColors.contains(colorKey)) { | 910 | if (!_cubeColors.contains(colorKey)) { |
| @@ -919,7 +919,7 @@ void GeometryCache::renderWireCube(float size, const glm::vec4& color) { · 8 unmodified lines | |||
| 919 | int colors[NUM_COLOR_SCALARS_PER_CUBE] = { compactColor, compactColor, compactColor, compactColor, | 919 | int colors[NUM_COLOR_SCALARS_PER_CUBE] = { compactColor, compactColor, compactColor, compactColor, |
| 920 | compactColor, compactColor, compactColor, compactColor }; | 920 | compactColor, compactColor, compactColor, compactColor }; |
| 921 | 921 | ||
| 922 | colorBuffer->append(sizeof(colors), (gpu::Buffer::Byte*) colors); | 922 | colorBuffer->append(sizeof(colors), (gpu::Byte*) colors); |
| 923 | } | 923 | } |
| 924 | gpu::BufferPointer verticesBuffer = _cubeVerticies[size]; | 924 | gpu::BufferPointer verticesBuffer = _cubeVerticies[size]; |
| 925 | gpu::BufferPointer colorBuffer = _cubeColors[colorKey]; | 925 | gpu::BufferPointer colorBuffer = _cubeColors[colorKey]; |
| @@ -1037,8 +1037,8 @@ void GeometryCache::renderBevelCornersRect(int x, int y, int width, int height, · 111 unmodified lines | |||
| 1037 | compactColor, compactColor, compactColor, compactColor }; | 1037 | compactColor, compactColor, compactColor, compactColor }; |
| 1038 | 1038 | ||
| 1039 | 1039 | ||
| 1040 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Buffer::Byte*) vertexBuffer); | 1040 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Byte*) vertexBuffer); |
| 1041 | details.colorBuffer->append(sizeof(colors), (gpu::Buffer::Byte*) colors); | 1041 | details.colorBuffer->append(sizeof(colors), (gpu::Byte*) colors); |
| 1042 | 1042 | ||
| 1043 | delete[] vertexBuffer; | 1043 | delete[] vertexBuffer; |
| 1044 | } | 1044 | } |
| @@ -1119,8 +1119,8 @@ void GeometryCache::renderQuad(const glm::vec2& minCorner, const glm::vec2& maxC · 74 unmodified lines | |||
| 1119 | int colors[NUM_COLOR_SCALARS_PER_QUAD] = { compactColor, compactColor, compactColor, compactColor }; | 1119 | int colors[NUM_COLOR_SCALARS_PER_QUAD] = { compactColor, compactColor, compactColor, compactColor }; |
| 1120 | 1120 | ||
| 1121 | 1121 | ||
| 1122 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Buffer::Byte*) vertexBuffer); | 1122 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Byte*) vertexBuffer); |
| 1123 | details.colorBuffer->append(sizeof(colors), (gpu::Buffer::Byte*) colors); | 1123 | details.colorBuffer->append(sizeof(colors), (gpu::Byte*) colors); |
| 1124 | } | 1124 | } |
| 1125 | 1125 | ||
| 1126 | gpu::Batch batch; | 1126 | gpu::Batch batch; |
| @@ -1208,8 +1208,8 @@ void GeometryCache::renderQuad(const glm::vec2& minCorner, const glm::vec2& maxC · 81 unmodified lines | |||
| 1208 | int colors[NUM_COLOR_SCALARS_PER_QUAD] = { compactColor, compactColor, compactColor, compactColor }; | 1208 | int colors[NUM_COLOR_SCALARS_PER_QUAD] = { compactColor, compactColor, compactColor, compactColor }; |
| 1209 | 1209 | ||
| 1210 | 1210 | ||
| 1211 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Buffer::Byte*) vertexBuffer); | 1211 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Byte*) vertexBuffer); |
| 1212 | details.colorBuffer->append(sizeof(colors), (gpu::Buffer::Byte*) colors); | 1212 | details.colorBuffer->append(sizeof(colors), (gpu::Byte*) colors); |
| 1213 | } | 1213 | } |
| 1214 | 1214 | ||
| 1215 | gpu::Batch batch; | 1215 | gpu::Batch batch; |
| @@ -1294,8 +1294,8 @@ void GeometryCache::renderQuad(const glm::vec3& minCorner, const glm::vec3& maxC · 78 unmodified lines | |||
| 1294 | int colors[NUM_COLOR_SCALARS_PER_QUAD] = { compactColor, compactColor, compactColor, compactColor }; | 1294 | int colors[NUM_COLOR_SCALARS_PER_QUAD] = { compactColor, compactColor, compactColor, compactColor }; |
| 1295 | 1295 | ||
| 1296 | 1296 | ||
| 1297 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Buffer::Byte*) vertexBuffer); | 1297 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Byte*) vertexBuffer); |
| 1298 | details.colorBuffer->append(sizeof(colors), (gpu::Buffer::Byte*) colors); | 1298 | details.colorBuffer->append(sizeof(colors), (gpu::Byte*) colors); |
| 1299 | } | 1299 | } |
| 1300 | 1300 | ||
| 1301 | gpu::Batch batch; | 1301 | gpu::Batch batch; |
| @@ -1396,8 +1396,8 @@ void GeometryCache::renderQuad(const glm::vec3& topLeft, const glm::vec3& bottom · 94 unmodified lines | |||
| 1396 | ((int(color.w * 255.0f) & 0xFF) << 24); | 1396 | ((int(color.w * 255.0f) & 0xFF) << 24); |
| 1397 | int colors[NUM_COLOR_SCALARS_PER_QUAD] = { compactColor, compactColor, compactColor, compactColor }; | 1397 | int colors[NUM_COLOR_SCALARS_PER_QUAD] = { compactColor, compactColor, compactColor, compactColor }; |
| 1398 | 1398 | ||
| 1399 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Buffer::Byte*) vertexBuffer); | 1399 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Byte*) vertexBuffer); |
| 1400 | details.colorBuffer->append(sizeof(colors), (gpu::Buffer::Byte*) colors); | 1400 | details.colorBuffer->append(sizeof(colors), (gpu::Byte*) colors); |
| 1401 | } | 1401 | } |
| 1402 | 1402 | ||
| 1403 | gpu::Batch batch; | 1403 | gpu::Batch batch; |
| @@ -1510,8 +1510,8 @@ void GeometryCache::renderDashedLine(const glm::vec3& start, const glm::vec3& en · 106 unmodified lines | |||
| 1510 | *(vertex++) = end.z; | 1510 | *(vertex++) = end.z; |
| 1511 | *(colorDataAt++) = compactColor; | 1511 | *(colorDataAt++) = compactColor; |
| 1512 | 1512 | ||
| 1513 | details.verticesBuffer->append(sizeof(GLfloat) * FLOATS_PER_VERTEX * details.vertices, (gpu::Buffer::Byte*) vertexData); | 1513 | details.verticesBuffer->append(sizeof(GLfloat) * FLOATS_PER_VERTEX * details.vertices, (gpu::Byte*) vertexData); |
| 1514 | details.colorBuffer->append(sizeof(int) * details.vertices, (gpu::Buffer::Byte*) colorData); | 1514 | details.colorBuffer->append(sizeof(int) * details.vertices, (gpu::Byte*) colorData); |
| 1515 | delete[] vertexData; | 1515 | delete[] vertexData; |
| 1516 | delete[] colorData; | 1516 | delete[] colorData; |
| 1517 | 1517 | ||
| @@ -1581,10 +1581,10 @@ GeometryCache::BatchItemDetails::~BatchItemDetails() { · 63 unmodified lines | |||
| 1581 | 1581 | ||
| 1582 | void GeometryCache::BatchItemDetails::clear() { | 1582 | void GeometryCache::BatchItemDetails::clear() { |
| 1583 | isCreated = false; | 1583 | isCreated = false; |
| 1584 | verticesBuffer.clear(); | 1584 | verticesBuffer.reset(); |
| 1585 | colorBuffer.clear(); | 1585 | colorBuffer.reset(); |
| 1586 | streamFormat.clear(); | 1586 | streamFormat.reset(); |
| 1587 | stream.clear(); | 1587 | stream.reset(); |
| 1588 | } | 1588 | } |
| 1589 | 1589 | ||
| 1590 | void GeometryCache::renderLine(const glm::vec3& p1, const glm::vec3& p2, | 1590 | void GeometryCache::renderLine(const glm::vec3& p1, const glm::vec3& p2, |
| @@ -1653,8 +1653,8 @@ void GeometryCache::renderLine(const glm::vec3& p1, const glm::vec3& p2, · 62 unmodified lines | |||
| 1653 | const int NUM_COLOR_SCALARS = 2; | 1653 | const int NUM_COLOR_SCALARS = 2; |
| 1654 | int colors[NUM_COLOR_SCALARS] = { compactColor1, compactColor2 }; | 1654 | int colors[NUM_COLOR_SCALARS] = { compactColor1, compactColor2 }; |
| 1655 | 1655 | ||
| 1656 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Buffer::Byte*) vertexBuffer); | 1656 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Byte*) vertexBuffer); |
| 1657 | details.colorBuffer->append(sizeof(colors), (gpu::Buffer::Byte*) colors); | 1657 | details.colorBuffer->append(sizeof(colors), (gpu::Byte*) colors); |
| 1658 | 1658 | ||
| 1659 | #ifdef WANT_DEBUG | 1659 | #ifdef WANT_DEBUG |
| 1660 | if (id == UNKNOWN_ID) { | 1660 | if (id == UNKNOWN_ID) { |
| @@ -1745,8 +1745,8 @@ void GeometryCache::renderLine(const glm::vec2& p1, const glm::vec2& p2, · 84 unmodified lines | |||
| 1745 | const int NUM_COLOR_SCALARS = 2; | 1745 | const int NUM_COLOR_SCALARS = 2; |
| 1746 | int colors[NUM_COLOR_SCALARS] = { compactColor1, compactColor2 }; | 1746 | int colors[NUM_COLOR_SCALARS] = { compactColor1, compactColor2 }; |
| 1747 | 1747 | ||
| 1748 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Buffer::Byte*) vertexBuffer); | 1748 | details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Byte*) vertexBuffer); |
| 1749 | details.colorBuffer->append(sizeof(colors), (gpu::Buffer::Byte*) colors); | 1749 | details.colorBuffer->append(sizeof(colors), (gpu::Byte*) colors); |
| 1750 | 1750 | ||
| 1751 | #ifdef WANT_DEBUG | 1751 | #ifdef WANT_DEBUG |
| 1752 | if (id == UNKNOWN_ID) { | 1752 | if (id == UNKNOWN_ID) { |
| @@ -2234,10 +2234,10 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { · 481 unmodified lines | |||
| 2234 | int offset = 0; | 2234 | int offset = 0; |
| 2235 | foreach(const FBXMeshPart& part, mesh.parts) { | 2235 | foreach(const FBXMeshPart& part, mesh.parts) { |
| 2236 | networkMesh._indexBuffer->setSubData(offset, part.quadIndices.size() * sizeof(int), | 2236 | networkMesh._indexBuffer->setSubData(offset, part.quadIndices.size() * sizeof(int), |
| 2237 | (gpu::Resource::Byte*) part.quadIndices.constData()); | 2237 | (gpu::Byte*) part.quadIndices.constData()); |
| 2238 | offset += part.quadIndices.size() * sizeof(int); | 2238 | offset += part.quadIndices.size() * sizeof(int); |
| 2239 | networkMesh._indexBuffer->setSubData(offset, part.triangleIndices.size() * sizeof(int), | 2239 | networkMesh._indexBuffer->setSubData(offset, part.triangleIndices.size() * sizeof(int), |
| 2240 | (gpu::Resource::Byte*) part.triangleIndices.constData()); | 2240 | (gpu::Byte*) part.triangleIndices.constData()); |
| 2241 | offset += part.triangleIndices.size() * sizeof(int); | 2241 | offset += part.triangleIndices.size() * sizeof(int); |
| 2242 | } | 2242 | } |
| 2243 | } | 2243 | } |
| @@ -2256,19 +2256,19 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { · 12 unmodified lines | |||
| 2256 | 2256 | ||
| 2257 | networkMesh._vertexBuffer->resize(clusterWeightsOffset + mesh.clusterWeights.size() * sizeof(glm::vec4)); | 2257 | networkMesh._vertexBuffer->resize(clusterWeightsOffset + mesh.clusterWeights.size() * sizeof(glm::vec4)); |
| 2258 | 2258 | ||
| 2259 | networkMesh._vertexBuffer->setSubData(0, mesh.vertices.size() * sizeof(glm::vec3), (gpu::Resource::Byte*) mesh.vertices.constData()); | 2259 | networkMesh._vertexBuffer->setSubData(0, mesh.vertices.size() * sizeof(glm::vec3), (gpu::Byte*) mesh.vertices.constData()); |
| 2260 | networkMesh._vertexBuffer->setSubData(normalsOffset, mesh.normals.size() * sizeof(glm::vec3), (gpu::Resource::Byte*) mesh.normals.constData()); | 2260 | networkMesh._vertexBuffer->setSubData(normalsOffset, mesh.normals.size() * sizeof(glm::vec3), (gpu::Byte*) mesh.normals.constData()); |
| 2261 | networkMesh._vertexBuffer->setSubData(tangentsOffset, | 2261 | networkMesh._vertexBuffer->setSubData(tangentsOffset, |
| 2262 | mesh.tangents.size() * sizeof(glm::vec3), (gpu::Resource::Byte*) mesh.tangents.constData()); | 2262 | mesh.tangents.size() * sizeof(glm::vec3), (gpu::Byte*) mesh.tangents.constData()); |
| 2263 | networkMesh._vertexBuffer->setSubData(colorsOffset, mesh.colors.size() * sizeof(glm::vec3), (gpu::Resource::Byte*) mesh.colors.constData()); | 2263 | networkMesh._vertexBuffer->setSubData(colorsOffset, mesh.colors.size() * sizeof(glm::vec3), (gpu::Byte*) mesh.colors.constData()); |
| 2264 | networkMesh._vertexBuffer->setSubData(texCoordsOffset, | 2264 | networkMesh._vertexBuffer->setSubData(texCoordsOffset, |
| 2265 | mesh.texCoords.size() * sizeof(glm::vec2), (gpu::Resource::Byte*) mesh.texCoords.constData()); | 2265 | mesh.texCoords.size() * sizeof(glm::vec2), (gpu::Byte*) mesh.texCoords.constData()); |
| 2266 | networkMesh._vertexBuffer->setSubData(texCoords1Offset, | 2266 | networkMesh._vertexBuffer->setSubData(texCoords1Offset, |
| 2267 | mesh.texCoords1.size() * sizeof(glm::vec2), (gpu::Resource::Byte*) mesh.texCoords1.constData()); | 2267 | mesh.texCoords1.size() * sizeof(glm::vec2), (gpu::Byte*) mesh.texCoords1.constData()); |
| 2268 | networkMesh._vertexBuffer->setSubData(clusterIndicesOffset, | 2268 | networkMesh._vertexBuffer->setSubData(clusterIndicesOffset, |
| 2269 | mesh.clusterIndices.size() * sizeof(glm::vec4), (gpu::Resource::Byte*) mesh.clusterIndices.constData()); | 2269 | mesh.clusterIndices.size() * sizeof(glm::vec4), (gpu::Byte*) mesh.clusterIndices.constData()); |
| 2270 | networkMesh._vertexBuffer->setSubData(clusterWeightsOffset, | 2270 | networkMesh._vertexBuffer->setSubData(clusterWeightsOffset, |
| 2271 | mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Resource::Byte*) mesh.clusterWeights.constData()); | 2271 | mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Byte*) mesh.clusterWeights.constData()); |
| 2272 | 2272 | ||
| 2273 | // otherwise, at least the cluster indices/weights can be static | 2273 | // otherwise, at least the cluster indices/weights can be static |
| 2274 | networkMesh._vertexStream = gpu::BufferStreamPointer(new gpu::BufferStream()); | 2274 | networkMesh._vertexStream = gpu::BufferStreamPointer(new gpu::BufferStream()); |
| @@ -2304,14 +2304,14 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { · 29 unmodified lines | |||
| 2304 | int clusterWeightsOffset = clusterIndicesOffset + mesh.clusterIndices.size() * sizeof(glm::vec4); | 2304 | int clusterWeightsOffset = clusterIndicesOffset + mesh.clusterIndices.size() * sizeof(glm::vec4); |
| 2305 | 2305 | ||
| 2306 | networkMesh._vertexBuffer->resize(clusterWeightsOffset + mesh.clusterWeights.size() * sizeof(glm::vec4)); | 2306 | networkMesh._vertexBuffer->resize(clusterWeightsOffset + mesh.clusterWeights.size() * sizeof(glm::vec4)); |
| 2307 | networkMesh._vertexBuffer->setSubData(0, mesh.tangents.size() * sizeof(glm::vec3), (gpu::Resource::Byte*) mesh.tangents.constData()); | 2307 | networkMesh._vertexBuffer->setSubData(0, mesh.tangents.size() * sizeof(glm::vec3), (gpu::Byte*) mesh.tangents.constData()); |
| 2308 | networkMesh._vertexBuffer->setSubData(colorsOffset, mesh.colors.size() * sizeof(glm::vec3), (gpu::Resource::Byte*) mesh.colors.constData()); | 2308 | networkMesh._vertexBuffer->setSubData(colorsOffset, mesh.colors.size() * sizeof(glm::vec3), (gpu::Byte*) mesh.colors.constData()); |
| 2309 | networkMesh._vertexBuffer->setSubData(texCoordsOffset, | 2309 | networkMesh._vertexBuffer->setSubData(texCoordsOffset, |
| 2310 | mesh.texCoords.size() * sizeof(glm::vec2), (gpu::Resource::Byte*) mesh.texCoords.constData()); | 2310 | mesh.texCoords.size() * sizeof(glm::vec2), (gpu::Byte*) mesh.texCoords.constData()); |
| 2311 | networkMesh._vertexBuffer->setSubData(clusterIndicesOffset, | 2311 | networkMesh._vertexBuffer->setSubData(clusterIndicesOffset, |
| 2312 | mesh.clusterIndices.size() * sizeof(glm::vec4), (gpu::Resource::Byte*) mesh.clusterIndices.constData()); | 2312 | mesh.clusterIndices.size() * sizeof(glm::vec4), (gpu::Byte*) mesh.clusterIndices.constData()); |
| 2313 | networkMesh._vertexBuffer->setSubData(clusterWeightsOffset, | 2313 | networkMesh._vertexBuffer->setSubData(clusterWeightsOffset, |
| 2314 | mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Resource::Byte*) mesh.clusterWeights.constData()); | 2314 | mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Byte*) mesh.clusterWeights.constData()); |
| 2315 | 2315 | ||
| 2316 | networkMesh._vertexStream = gpu::BufferStreamPointer(new gpu::BufferStream()); | 2316 | networkMesh._vertexStream = gpu::BufferStreamPointer(new gpu::BufferStream()); |
| 2317 | if (mesh.tangents.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, 0, sizeof(glm::vec3)); | 2317 | if (mesh.tangents.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, 0, sizeof(glm::vec3)); |