Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 53 files). Show all
Unified · Split
| @@ -83,8 +83,8 @@ void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, in · 82 unmodified lines | |||
| 83 | qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED VERTICES BUFFER"; | 83 | qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED VERTICES BUFFER"; |
| 84 | #endif | 84 | #endif |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 87 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 88 | if (registered) { | 88 | if (registered) { |
| 89 | _registeredSphereVertices[id] = verticesBuffer; | 89 | _registeredSphereVertices[id] = verticesBuffer; |
| 90 | _lastRegisteredSphereVertices[id] = radiusKey; | 90 | _lastRegisteredSphereVertices[id] = radiusKey; |
| @@ -148,7 +148,7 @@ void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, in · 57 unmodified lines | |||
| 148 | #endif | 148 | #endif |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | gpu::BufferPointer indicesBuffer(new gpu::Buffer()); | 151 | auto indicesBuffer = std::make_shared<gpu::Buffer>(); |
| 152 | if (registered) { | 152 | if (registered) { |
| 153 | _registeredSphereIndices[id] = indicesBuffer; | 153 | _registeredSphereIndices[id] = indicesBuffer; |
| 154 | _lastRegisteredSphereIndices[id] = slicesStacksKey; | 154 | _lastRegisteredSphereIndices[id] = slicesStacksKey; |
| @@ -233,8 +233,8 @@ void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, in · 78 unmodified lines | |||
| 233 | qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED COLORS BUFFER"; | 233 | qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED COLORS BUFFER"; |
| 234 | #endif | 234 | #endif |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 237 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 238 | if (registered) { | 238 | if (registered) { |
| 239 | _registeredSphereColors[id] = colorBuffer; | 239 | _registeredSphereColors[id] = colorBuffer; |
| 240 | _lastRegisteredSphereColors[id] = colorKey; | 240 | _lastRegisteredSphereColors[id] = colorKey; |
| @@ -279,7 +279,7 @@ void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, in · 38 unmodified lines | |||
| 279 | const int VERTICES_SLOT = 0; | 279 | const int VERTICES_SLOT = 0; |
| 280 | const int NORMALS_SLOT = 1; | 280 | const int NORMALS_SLOT = 1; |
| 281 | const int COLOR_SLOT = 2; | 281 | const int COLOR_SLOT = 2; |
| 282 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); // 1 for everyone | 282 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone |
| 283 | streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0); | 283 | streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0); |
| 284 | streamFormat->setAttribute(gpu::Stream::NORMAL, NORMALS_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); | 284 | streamFormat->setAttribute(gpu::Stream::NORMAL, NORMALS_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); |
| 285 | streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA)); | 285 | streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA)); |
| @@ -414,7 +414,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions · 128 unmodified lines | |||
| 414 | 414 | ||
| 415 | int vertices = (xDivisions + 1 + yDivisions + 1) * 2; | 415 | int vertices = (xDivisions + 1 + yDivisions + 1) * 2; |
| 416 | if (!_gridBuffers.contains(key)) { | 416 | if (!_gridBuffers.contains(key)) { |
| 417 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 417 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 418 | 418 | ||
| 419 | GLfloat* vertexData = new GLfloat[vertices * 2]; | 419 | GLfloat* vertexData = new GLfloat[vertices * 2]; |
| 420 | GLfloat* vertex = vertexData; | 420 | GLfloat* vertex = vertexData; |
| @@ -445,7 +445,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions · 24 unmodified lines | |||
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | if (!_gridColors.contains(colorKey)) { | 447 | if (!_gridColors.contains(colorKey)) { |
| 448 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 448 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 449 | _gridColors[colorKey] = colorBuffer; | 449 | _gridColors[colorKey] = colorBuffer; |
| 450 | 450 | ||
| 451 | int compactColor = ((int(color.x * 255.0f) & 0xFF)) | | 451 | int compactColor = ((int(color.x * 255.0f) & 0xFF)) | |
| @@ -468,7 +468,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions · 16 unmodified lines | |||
| 468 | 468 | ||
| 469 | const int VERTICES_SLOT = 0; | 469 | const int VERTICES_SLOT = 0; |
| 470 | const int COLOR_SLOT = 1; | 470 | const int COLOR_SLOT = 1; |
| 471 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); // 1 for everyone | 471 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone |
| 472 | 472 | ||
| 473 | streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::XYZ), 0); | 473 | streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::XYZ), 0); |
| 474 | streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA)); | 474 | streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA)); |
| @@ -507,7 +507,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int h · 32 unmodified lines | |||
| 507 | 507 | ||
| 508 | int vertices = (cols + 1 + rows + 1) * 2; | 508 | int vertices = (cols + 1 + rows + 1) * 2; |
| 509 | if ((registered && !_registeredAlternateGridBuffers.contains(id)) || (!registered && !_alternateGridBuffers.contains(key))) { | 509 | if ((registered && !_registeredAlternateGridBuffers.contains(id)) || (!registered && !_alternateGridBuffers.contains(key))) { |
| 510 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 510 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 511 | 511 | ||
| 512 | GLfloat* vertexData = new GLfloat[vertices * 2]; | 512 | GLfloat* vertexData = new GLfloat[vertices * 2]; |
| 513 | GLfloat* vertex = vertexData; | 513 | GLfloat* vertex = vertexData; |
| @@ -550,7 +550,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int h · 36 unmodified lines | |||
| 550 | } | 550 | } |
| 551 | 551 | ||
| 552 | if (!_gridColors.contains(colorKey)) { | 552 | if (!_gridColors.contains(colorKey)) { |
| 553 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 553 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 554 | _gridColors[colorKey] = colorBuffer; | 554 | _gridColors[colorKey] = colorBuffer; |
| 555 | 555 | ||
| 556 | int compactColor = ((int(color.x * 255.0f) & 0xFF)) | | 556 | int compactColor = ((int(color.x * 255.0f) & 0xFF)) | |
| @@ -575,7 +575,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int h · 18 unmodified lines | |||
| 575 | 575 | ||
| 576 | const int VERTICES_SLOT = 0; | 576 | const int VERTICES_SLOT = 0; |
| 577 | const int COLOR_SLOT = 1; | 577 | const int COLOR_SLOT = 1; |
| 578 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); // 1 for everyone | 578 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone |
| 579 | 579 | ||
| 580 | streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::XYZ), 0); | 580 | streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::XYZ), 0); |
| 581 | streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA)); | 581 | streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA)); |
| @@ -603,11 +603,11 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec2>& points, con · 21 unmodified lines | |||
| 603 | details.isCreated = true; | 603 | details.isCreated = true; |
| 604 | details.vertices = points.size(); | 604 | details.vertices = points.size(); |
| 605 | details.vertexSize = FLOATS_PER_VERTEX; | 605 | details.vertexSize = FLOATS_PER_VERTEX; |
| 606 | 606 | ||
| 607 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 607 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 608 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 608 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 609 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 609 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 610 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 610 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 611 | 611 | ||
| 612 | details.verticesBuffer = verticesBuffer; | 612 | details.verticesBuffer = verticesBuffer; |
| 613 | details.colorBuffer = colorBuffer; | 613 | details.colorBuffer = colorBuffer; |
| @@ -664,11 +664,11 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec3>& points, con · 50 unmodified lines | |||
| 664 | details.isCreated = true; | 664 | details.isCreated = true; |
| 665 | details.vertices = points.size(); | 665 | details.vertices = points.size(); |
| 666 | details.vertexSize = FLOATS_PER_VERTEX; | 666 | details.vertexSize = FLOATS_PER_VERTEX; |
| 667 | 667 | ||
| 668 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 668 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 669 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 669 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 670 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 670 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 671 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 671 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 672 | 672 | ||
| 673 | details.verticesBuffer = verticesBuffer; | 673 | details.verticesBuffer = verticesBuffer; |
| 674 | details.colorBuffer = colorBuffer; | 674 | details.colorBuffer = colorBuffer; |
| @@ -727,11 +727,11 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec3>& points, con · 52 unmodified lines | |||
| 727 | details.isCreated = true; | 727 | details.isCreated = true; |
| 728 | details.vertices = points.size(); | 728 | details.vertices = points.size(); |
| 729 | details.vertexSize = FLOATS_PER_VERTEX; | 729 | details.vertexSize = FLOATS_PER_VERTEX; |
| 730 | 730 | ||
| 731 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 731 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 732 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 732 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 733 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 733 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 734 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 734 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 735 | 735 | ||
| 736 | details.verticesBuffer = verticesBuffer; | 736 | details.verticesBuffer = verticesBuffer; |
| 737 | details.colorBuffer = colorBuffer; | 737 | details.colorBuffer = colorBuffer; |
| @@ -818,7 +818,7 @@ void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::ve · 80 unmodified lines | |||
| 818 | const int NORMALS_OFFSET = sizeof(GLfloat) * FLOATS_PER_VERTEX; | 818 | const int NORMALS_OFFSET = sizeof(GLfloat) * FLOATS_PER_VERTEX; |
| 819 | 819 | ||
| 820 | if (!_solidCubeVertices.contains(size)) { | 820 | if (!_solidCubeVertices.contains(size)) { |
| 821 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 821 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 822 | _solidCubeVertices[size] = verticesBuffer; | 822 | _solidCubeVertices[size] = verticesBuffer; |
| 823 | 823 | ||
| 824 | GLfloat* vertexData = new GLfloat[vertexPoints * 2]; // vertices and normals | 824 | GLfloat* vertexData = new GLfloat[vertexPoints * 2]; // vertices and normals |
| @@ -869,15 +869,15 @@ void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::ve · 44 unmodified lines | |||
| 869 | 12,13,14, 14,15,12, // left | 869 | 12,13,14, 14,15,12, // left |
| 870 | 16,17,18, 18,19,16, // bottom | 870 | 16,17,18, 18,19,16, // bottom |
| 871 | 20,21,22, 22,23,20 }; // back | 871 | 20,21,22, 22,23,20 }; // back |
| 872 | 872 | ||
| 873 | gpu::BufferPointer indexBuffer(new gpu::Buffer()); | 873 | auto indexBuffer = std::make_shared<gpu::Buffer>(); |
| 874 | _solidCubeIndexBuffer = indexBuffer; | 874 | _solidCubeIndexBuffer = indexBuffer; |
| 875 | 875 | ||
| 876 | _solidCubeIndexBuffer->append(sizeof(cannonicalIndices), (gpu::Byte*) cannonicalIndices); | 876 | _solidCubeIndexBuffer->append(sizeof(cannonicalIndices), (gpu::Byte*) cannonicalIndices); |
| 877 | } | 877 | } |
| 878 | 878 | ||
| 879 | if (!_solidCubeColors.contains(colorKey)) { | 879 | if (!_solidCubeColors.contains(colorKey)) { |
| 880 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 880 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 881 | _solidCubeColors[colorKey] = colorBuffer; | 881 | _solidCubeColors[colorKey] = colorBuffer; |
| 882 | 882 | ||
| 883 | const int NUM_COLOR_SCALARS_PER_CUBE = 24; | 883 | const int NUM_COLOR_SCALARS_PER_CUBE = 24; |
| @@ -900,7 +900,7 @@ void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::ve · 16 unmodified lines | |||
| 900 | const int VERTICES_SLOT = 0; | 900 | const int VERTICES_SLOT = 0; |
| 901 | const int NORMALS_SLOT = 1; | 901 | const int NORMALS_SLOT = 1; |
| 902 | const int COLOR_SLOT = 2; | 902 | const int COLOR_SLOT = 2; |
| 903 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); // 1 for everyone | 903 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone |
| 904 | 904 | ||
| 905 | streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0); | 905 | streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0); |
| 906 | streamFormat->setAttribute(gpu::Stream::NORMAL, NORMALS_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); | 906 | streamFormat->setAttribute(gpu::Stream::NORMAL, NORMALS_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); |
| @@ -935,7 +935,7 @@ void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec · 28 unmodified lines | |||
| 935 | const int indices = (TOP_EDGES + BOTTOM_EDGES + SIDE_EDGES) * VERTICES_PER_EDGE; | 935 | const int indices = (TOP_EDGES + BOTTOM_EDGES + SIDE_EDGES) * VERTICES_PER_EDGE; |
| 936 | 936 | ||
| 937 | if (!_cubeVerticies.contains(size)) { | 937 | if (!_cubeVerticies.contains(size)) { |
| 938 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 938 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 939 | _cubeVerticies[size] = verticesBuffer; | 939 | _cubeVerticies[size] = verticesBuffer; |
| 940 | 940 | ||
| 941 | int vertexPoints = vertices * FLOATS_PER_VERTEX; | 941 | int vertexPoints = vertices * FLOATS_PER_VERTEX; |
| @@ -961,15 +961,15 @@ void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec · 19 unmodified lines | |||
| 961 | 4, 5, 5, 6, 6, 7, 7, 4, // (bottom) | 961 | 4, 5, 5, 6, 6, 7, 7, 4, // (bottom) |
| 962 | 0, 4, 1, 5, 2, 6, 3, 7, // (side edges) | 962 | 0, 4, 1, 5, 2, 6, 3, 7, // (side edges) |
| 963 | }; | 963 | }; |
| 964 | 964 | ||
| 965 | gpu::BufferPointer indexBuffer(new gpu::Buffer()); | 965 | auto indexBuffer = std::make_shared<gpu::Buffer>(); |
| 966 | _wireCubeIndexBuffer = indexBuffer; | 966 | _wireCubeIndexBuffer = indexBuffer; |
| 967 | 967 | ||
| 968 | _wireCubeIndexBuffer->append(sizeof(cannonicalIndices), (gpu::Byte*) cannonicalIndices); | 968 | _wireCubeIndexBuffer->append(sizeof(cannonicalIndices), (gpu::Byte*) cannonicalIndices); |
| 969 | } | 969 | } |
| 970 | 970 | ||
| 971 | if (!_cubeColors.contains(colorKey)) { | 971 | if (!_cubeColors.contains(colorKey)) { |
| 972 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 972 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 973 | _cubeColors[colorKey] = colorBuffer; | 973 | _cubeColors[colorKey] = colorBuffer; |
| 974 | 974 | ||
| 975 | const int NUM_COLOR_SCALARS_PER_CUBE = 8; | 975 | const int NUM_COLOR_SCALARS_PER_CUBE = 8; |
| @@ -987,7 +987,7 @@ void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec · 11 unmodified lines | |||
| 987 | 987 | ||
| 988 | const int VERTICES_SLOT = 0; | 988 | const int VERTICES_SLOT = 0; |
| 989 | const int COLOR_SLOT = 1; | 989 | const int COLOR_SLOT = 1; |
| 990 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); // 1 for everyone | 990 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone |
| 991 | streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0); | 991 | streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0); |
| 992 | streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA)); | 992 | streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA)); |
| 993 | 993 | ||
| @@ -1036,11 +1036,11 @@ void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int · 42 unmodified lines | |||
| 1036 | details.isCreated = true; | 1036 | details.isCreated = true; |
| 1037 | details.vertices = NUM_VERTICES; | 1037 | details.vertices = NUM_VERTICES; |
| 1038 | details.vertexSize = FLOATS_PER_VERTEX; | 1038 | details.vertexSize = FLOATS_PER_VERTEX; |
| 1039 | 1039 | ||
| 1040 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 1040 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 1041 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 1041 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 1042 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 1042 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 1043 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 1043 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 1044 | 1044 | ||
| 1045 | details.verticesBuffer = verticesBuffer; | 1045 | details.verticesBuffer = verticesBuffer; |
| 1046 | details.colorBuffer = colorBuffer; | 1046 | details.colorBuffer = colorBuffer; |
| @@ -1144,11 +1144,11 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, co · 97 unmodified lines | |||
| 1144 | details.isCreated = true; | 1144 | details.isCreated = true; |
| 1145 | details.vertices = vertices; | 1145 | details.vertices = vertices; |
| 1146 | details.vertexSize = FLOATS_PER_VERTEX; | 1146 | details.vertexSize = FLOATS_PER_VERTEX; |
| 1147 | 1147 | ||
| 1148 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 1148 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 1149 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 1149 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 1150 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 1150 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 1151 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 1151 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 1152 | 1152 | ||
| 1153 | details.verticesBuffer = verticesBuffer; | 1153 | details.verticesBuffer = verticesBuffer; |
| 1154 | details.colorBuffer = colorBuffer; | 1154 | details.colorBuffer = colorBuffer; |
| @@ -1250,11 +1250,11 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, co · 95 unmodified lines | |||
| 1250 | details.isCreated = true; | 1250 | details.isCreated = true; |
| 1251 | details.vertices = vertices; | 1251 | details.vertices = vertices; |
| 1252 | details.vertexSize = FLOATS_PER_VERTEX; | 1252 | details.vertexSize = FLOATS_PER_VERTEX; |
| 1253 | 1253 | ||
| 1254 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 1254 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 1255 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 1255 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 1256 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 1256 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 1257 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 1257 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 1258 | 1258 | ||
| 1259 | details.verticesBuffer = verticesBuffer; | 1259 | details.verticesBuffer = verticesBuffer; |
| 1260 | details.colorBuffer = colorBuffer; | 1260 | details.colorBuffer = colorBuffer; |
| @@ -1329,11 +1329,11 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& minCorner, co · 68 unmodified lines | |||
| 1329 | details.isCreated = true; | 1329 | details.isCreated = true; |
| 1330 | details.vertices = vertices; | 1330 | details.vertices = vertices; |
| 1331 | details.vertexSize = FLOATS_PER_VERTEX; | 1331 | details.vertexSize = FLOATS_PER_VERTEX; |
| 1332 | 1332 | ||
| 1333 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 1333 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 1334 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 1334 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 1335 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 1335 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 1336 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 1336 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 1337 | 1337 | ||
| 1338 | details.verticesBuffer = verticesBuffer; | 1338 | details.verticesBuffer = verticesBuffer; |
| 1339 | details.colorBuffer = colorBuffer; | 1339 | details.colorBuffer = colorBuffer; |
| @@ -1432,11 +1432,11 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& topLeft, cons · 92 unmodified lines | |||
| 1432 | details.isCreated = true; | 1432 | details.isCreated = true; |
| 1433 | details.vertices = vertices; | 1433 | details.vertices = vertices; |
| 1434 | details.vertexSize = FLOATS_PER_VERTEX; // NOTE: this isn't used for BatchItemDetails maybe we can get rid of it | 1434 | details.vertexSize = FLOATS_PER_VERTEX; // NOTE: this isn't used for BatchItemDetails maybe we can get rid of it |
| 1435 | 1435 | ||
| 1436 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 1436 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 1437 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 1437 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 1438 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 1438 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 1439 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 1439 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 1440 | 1440 | ||
| 1441 | details.verticesBuffer = verticesBuffer; | 1441 | details.verticesBuffer = verticesBuffer; |
| 1442 | details.colorBuffer = colorBuffer; | 1442 | details.colorBuffer = colorBuffer; |
| @@ -1519,11 +1519,11 @@ void GeometryCache::renderDashedLine(gpu::Batch& batch, const glm::vec3& start, · 76 unmodified lines | |||
| 1519 | details.vertices = (segmentCountFloor + 1) * 2; | 1519 | details.vertices = (segmentCountFloor + 1) * 2; |
| 1520 | details.vertexSize = FLOATS_PER_VERTEX; | 1520 | details.vertexSize = FLOATS_PER_VERTEX; |
| 1521 | details.isCreated = true; | 1521 | details.isCreated = true; |
| 1522 | 1522 | ||
| 1523 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 1523 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 1524 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 1524 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 1525 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 1525 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 1526 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 1526 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 1527 | 1527 | ||
| 1528 | details.verticesBuffer = verticesBuffer; | 1528 | details.verticesBuffer = verticesBuffer; |
| 1529 | details.colorBuffer = colorBuffer; | 1529 | details.colorBuffer = colorBuffer; |
| @@ -1684,11 +1684,11 @@ void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm · 154 unmodified lines | |||
| 1684 | details.isCreated = true; | 1684 | details.isCreated = true; |
| 1685 | details.vertices = vertices; | 1685 | details.vertices = vertices; |
| 1686 | details.vertexSize = FLOATS_PER_VERTEX; | 1686 | details.vertexSize = FLOATS_PER_VERTEX; |
| 1687 | 1687 | ||
| 1688 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 1688 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 1689 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 1689 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 1690 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 1690 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 1691 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 1691 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 1692 | 1692 | ||
| 1693 | details.verticesBuffer = verticesBuffer; | 1693 | details.verticesBuffer = verticesBuffer; |
| 1694 | details.colorBuffer = colorBuffer; | 1694 | details.colorBuffer = colorBuffer; |
| @@ -1774,11 +1774,11 @@ void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec2& p1, const glm · 79 unmodified lines | |||
| 1774 | details.isCreated = true; | 1774 | details.isCreated = true; |
| 1775 | details.vertices = vertices; | 1775 | details.vertices = vertices; |
| 1776 | details.vertexSize = FLOATS_PER_VERTEX; | 1776 | details.vertexSize = FLOATS_PER_VERTEX; |
| 1777 | 1777 | ||
| 1778 | gpu::BufferPointer verticesBuffer(new gpu::Buffer()); | 1778 | auto verticesBuffer = std::make_shared<gpu::Buffer>(); |
| 1779 | gpu::BufferPointer colorBuffer(new gpu::Buffer()); | 1779 | auto colorBuffer = std::make_shared<gpu::Buffer>(); |
| 1780 | gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); | 1780 | auto streamFormat = std::make_shared<gpu::Stream::Format>(); |
| 1781 | gpu::BufferStreamPointer stream(new gpu::BufferStream()); | 1781 | auto stream = std::make_shared<gpu::BufferStream>(); |
| 1782 | 1782 | ||
| 1783 | details.verticesBuffer = verticesBuffer; | 1783 | details.verticesBuffer = verticesBuffer; |
| 1784 | details.colorBuffer = colorBuffer; | 1784 | details.colorBuffer = colorBuffer; |
| @@ -1835,7 +1835,7 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch) { · 50 unmodified lines | |||
| 1835 | auto program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps)); | 1835 | auto program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps)); |
| 1836 | gpu::Shader::makeProgram((*program)); | 1836 | gpu::Shader::makeProgram((*program)); |
| 1837 | 1837 | ||
| 1838 | auto state = gpu::StatePointer(new gpu::State()); | 1838 | auto state = std::make_shared<gpu::State>(); |
| 1839 | 1839 | ||
| 1840 | // enable decal blend | 1840 | // enable decal blend |
| 1841 | state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); | 1841 | state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); |
| @@ -2213,8 +2213,8 @@ void NetworkGeometry::downloadFinished(QNetworkReply* reply) { · 371 unmodified lines | |||
| 2213 | } | 2213 | } |
| 2214 | QVariantHash lods = _mapping.value("lod").toHash(); | 2214 | QVariantHash lods = _mapping.value("lod").toHash(); |
| 2215 | for (QVariantHash::const_iterator it = lods.begin(); it != lods.end(); it++) { | 2215 | for (QVariantHash::const_iterator it = lods.begin(); it != lods.end(); it++) { |
| 2216 | QSharedPointer<NetworkGeometry> geometry(new NetworkGeometry(url.resolved(it.key()), | 2216 | auto geometry = QSharedPointer<NetworkGeometry>::create(url.resolved(it.key()), |
| 2217 | QSharedPointer<NetworkGeometry>(), true, _mapping, _textureBase)); | 2217 | QSharedPointer<NetworkGeometry>(), true, _mapping, _textureBase); |
| 2218 | geometry->setSelf(geometry.staticCast<Resource>()); | 2218 | geometry->setSelf(geometry.staticCast<Resource>()); |
| 2219 | geometry->setLODParent(_lodParent); | 2219 | geometry->setLODParent(_lodParent); |
| 2220 | _lods.insert(it.value().toFloat(), geometry); | 2220 | _lods.insert(it.value().toFloat(), geometry); |
| @@ -2290,7 +2290,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { · 69 unmodified lines | |||
| 2290 | } | 2290 | } |
| 2291 | 2291 | ||
| 2292 | { | 2292 | { |
| 2293 | networkMesh._indexBuffer = gpu::BufferPointer(new gpu::Buffer()); | 2293 | networkMesh._indexBuffer = std::make_shared<gpu::Buffer>(); |
| 2294 | networkMesh._indexBuffer->resize(totalIndices * sizeof(int)); | 2294 | networkMesh._indexBuffer->resize(totalIndices * sizeof(int)); |
| 2295 | int offset = 0; | 2295 | int offset = 0; |
| 2296 | foreach(const FBXMeshPart& part, mesh.parts) { | 2296 | foreach(const FBXMeshPart& part, mesh.parts) { |
| @@ -2304,7 +2304,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { · 7 unmodified lines | |||
| 2304 | } | 2304 | } |
| 2305 | 2305 | ||
| 2306 | { | 2306 | { |
| 2307 | networkMesh._vertexBuffer = gpu::BufferPointer(new gpu::Buffer()); | 2307 | networkMesh._vertexBuffer = std::make_shared<gpu::Buffer>(); |
| 2308 | // if we don't need to do any blending, the positions/normals can be static | 2308 | // if we don't need to do any blending, the positions/normals can be static |
| 2309 | if (mesh.blendshapes.isEmpty()) { | 2309 | if (mesh.blendshapes.isEmpty()) { |
| 2310 | int normalsOffset = mesh.vertices.size() * sizeof(glm::vec3); | 2310 | int normalsOffset = mesh.vertices.size() * sizeof(glm::vec3); |
| @@ -2332,7 +2332,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { · 21 unmodified lines | |||
| 2332 | mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Byte*) mesh.clusterWeights.constData()); | 2332 | mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Byte*) mesh.clusterWeights.constData()); |
| 2333 | 2333 | ||
| 2334 | // otherwise, at least the cluster indices/weights can be static | 2334 | // otherwise, at least the cluster indices/weights can be static |
| 2335 | networkMesh._vertexStream = gpu::BufferStreamPointer(new gpu::BufferStream()); | 2335 | networkMesh._vertexStream = std::make_shared<gpu::BufferStream>(); |
| 2336 | networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, 0, sizeof(glm::vec3)); | 2336 | networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, 0, sizeof(glm::vec3)); |
| 2337 | if (mesh.normals.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, normalsOffset, sizeof(glm::vec3)); | 2337 | if (mesh.normals.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, normalsOffset, sizeof(glm::vec3)); |
| 2338 | if (mesh.tangents.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, tangentsOffset, sizeof(glm::vec3)); | 2338 | if (mesh.tangents.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, tangentsOffset, sizeof(glm::vec3)); |
| @@ -2343,7 +2343,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { · 4 unmodified lines | |||
| 2343 | if (mesh.clusterWeights.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, clusterWeightsOffset, sizeof(glm::vec4)); | 2343 | if (mesh.clusterWeights.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, clusterWeightsOffset, sizeof(glm::vec4)); |
| 2344 | 2344 | ||
| 2345 | int channelNum = 0; | 2345 | int channelNum = 0; |
| 2346 | networkMesh._vertexFormat = gpu::Stream::FormatPointer(new gpu::Stream::Format()); | 2346 | networkMesh._vertexFormat = std::make_shared<gpu::Stream::Format>(); |
| 2347 | networkMesh._vertexFormat->setAttribute(gpu::Stream::POSITION, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0); | 2347 | networkMesh._vertexFormat->setAttribute(gpu::Stream::POSITION, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0); |
| 2348 | if (mesh.normals.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::NORMAL, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); | 2348 | if (mesh.normals.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::NORMAL, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); |
| 2349 | if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TANGENT, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); | 2349 | if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TANGENT, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); |
| @@ -2374,7 +2374,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { · 24 unmodified lines | |||
| 2374 | networkMesh._vertexBuffer->setSubData(clusterWeightsOffset, | 2374 | networkMesh._vertexBuffer->setSubData(clusterWeightsOffset, |
| 2375 | mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Byte*) mesh.clusterWeights.constData()); | 2375 | mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Byte*) mesh.clusterWeights.constData()); |
| 2376 | 2376 | ||
| 2377 | networkMesh._vertexStream = gpu::BufferStreamPointer(new gpu::BufferStream()); | 2377 | networkMesh._vertexStream = std::make_shared<gpu::BufferStream>(); |
| 2378 | if (mesh.tangents.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, 0, sizeof(glm::vec3)); | 2378 | if (mesh.tangents.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, 0, sizeof(glm::vec3)); |
| 2379 | if (mesh.colors.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, colorsOffset, sizeof(glm::vec3)); | 2379 | if (mesh.colors.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, colorsOffset, sizeof(glm::vec3)); |
| 2380 | if (mesh.texCoords.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, texCoordsOffset, sizeof(glm::vec2)); | 2380 | if (mesh.texCoords.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, texCoordsOffset, sizeof(glm::vec2)); |
| @@ -2382,7 +2382,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { · 1 unmodified line | |||
| 2382 | if (mesh.clusterWeights.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, clusterWeightsOffset, sizeof(glm::vec4)); | 2382 | if (mesh.clusterWeights.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, clusterWeightsOffset, sizeof(glm::vec4)); |
| 2383 | 2383 | ||
| 2384 | int channelNum = 0; | 2384 | int channelNum = 0; |
| 2385 | networkMesh._vertexFormat = gpu::Stream::FormatPointer(new gpu::Stream::Format()); | 2385 | networkMesh._vertexFormat = std::make_shared<gpu::Stream::Format>(); |
| 2386 | networkMesh._vertexFormat->setAttribute(gpu::Stream::POSITION, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); | 2386 | networkMesh._vertexFormat->setAttribute(gpu::Stream::POSITION, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); |
| 2387 | if (mesh.normals.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::NORMAL, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); | 2387 | if (mesh.normals.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::NORMAL, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); |
| 2388 | if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TANGENT, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); | 2388 | if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TANGENT, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ)); |