Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 4 files). Show all
Unified · Split
| @@ -59,7 +59,8 @@ static gpu::Stream::FormatPointer INSTANCED_SOLID_STREAM_FORMAT; · 58 unmodified lines | ||
| 59 | 59 | |
| 60 | 60 | static const uint SHAPE_VERTEX_STRIDE = sizeof(glm::vec3) * 2; // vertices and normals |
| 61 | 61 | static const uint SHAPE_NORMALS_OFFSET = sizeof(glm::vec3); |
| 62 | − | |
| 62 | +static const gpu::Type SHAPE_INDEX_TYPE = gpu::UINT16; | |
| 63 | +static const uint SHAPE_INDEX_SIZE = sizeof(gpu::uint16); | |
| 63 | 64 | |
| 64 | 65 | void GeometryCache::ShapeData::setupVertices(gpu::BufferPointer& vertexBuffer, const VertexVector& vertices) { |
| 65 | 66 | vertexBuffer->append(vertices); |
| @@ -73,13 +74,13 @@ void GeometryCache::ShapeData::setupVertices(gpu::BufferPointer& vertexBuffer, c · 7 unmodified lines | ||
| 73 | 74 | void GeometryCache::ShapeData::setupIndices(gpu::BufferPointer& indexBuffer, const IndexVector& indices, const IndexVector& wireIndices) { |
| 74 | 75 | _indices = indexBuffer; |
| 75 | 76 | if (!indices.empty()) { |
| 76 | − _indexOffset = indexBuffer->getSize(); | |
| 77 | + _indexOffset = indexBuffer->getSize() / SHAPE_INDEX_SIZE; | |
| 77 | 78 | _indexCount = indices.size(); |
| 78 | 79 | indexBuffer->append(indices); |
| 79 | 80 | } |
| 80 | 81 | |
| 81 | 82 | if (!wireIndices.empty()) { |
| 82 | − _wireIndexOffset = indexBuffer->getSize(); | |
| 83 | + _wireIndexOffset = indexBuffer->getSize() / SHAPE_INDEX_SIZE; | |
| 83 | 84 | _wireIndexCount = wireIndices.size(); |
| 84 | 85 | indexBuffer->append(wireIndices); |
| 85 | 86 | } |
| @@ -88,7 +89,7 @@ void GeometryCache::ShapeData::setupIndices(gpu::BufferPointer& indexBuffer, con · 2 unmodified lines | ||
| 88 | 89 | void GeometryCache::ShapeData::setupBatch(gpu::Batch& batch) const { |
| 89 | 90 | batch.setInputBuffer(gpu::Stream::POSITION, _positionView); |
| 90 | 91 | batch.setInputBuffer(gpu::Stream::NORMAL, _normalView); |
| 91 | − batch.setIndexBuffer(gpu::UINT16, _indices, 0); | |
| 92 | + batch.setIndexBuffer(SHAPE_INDEX_TYPE, _indices, 0); | |
| 92 | 93 | } |
| 93 | 94 | |
| 94 | 95 | void GeometryCache::ShapeData::draw(gpu::Batch& batch) const { |