mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 08:56:25 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi
This commit is contained in:
commit
816fd41624
2 changed files with 18 additions and 9 deletions
|
@ -392,7 +392,6 @@ void GeometryCache::renderGrid(int x, int y, int width, int height, int rows, in
|
||||||
gpu::GLBackend::renderBatch(batch);
|
gpu::GLBackend::renderBatch(batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: properly handle the x,y,w,h changing for an ID
|
|
||||||
// TODO: why do we seem to create extra BatchItemDetails when we resize the window?? what's that??
|
// TODO: why do we seem to create extra BatchItemDetails when we resize the window?? what's that??
|
||||||
void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int height, int rows, int cols, const glm::vec4& color, int id) {
|
void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int height, int rows, int cols, const glm::vec4& color, int id) {
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
|
@ -410,8 +409,23 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int h
|
||||||
Vec3Pair colorKey(glm::vec3(color.x, color.y, rows), glm::vec3(color.z, color.y, cols));
|
Vec3Pair colorKey(glm::vec3(color.x, color.y, rows), glm::vec3(color.z, color.y, cols));
|
||||||
|
|
||||||
int vertices = (cols + 1 + rows + 1) * 2;
|
int vertices = (cols + 1 + rows + 1) * 2;
|
||||||
if ((registered && !_registeredAlternateGridBuffers.contains(id)) || (!registered && !_alternateGridBuffers.contains(key))) {
|
if ((registered && (!_registeredAlternateGridBuffers.contains(id) || _lastRegisteredAlternateGridBuffers[id] != key))
|
||||||
|
|| (!registered && !_alternateGridBuffers.contains(key))) {
|
||||||
|
|
||||||
|
if (registered && _registeredAlternateGridBuffers.contains(id)) {
|
||||||
|
_registeredAlternateGridBuffers[id].reset();
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
|
qCDebug(renderutils) << "renderGrid()... RELEASING REGISTERED VERTICES BUFFER";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||||
|
if (registered) {
|
||||||
|
_registeredAlternateGridBuffers[id] = verticesBuffer;
|
||||||
|
_lastRegisteredAlternateGridBuffers[id] = key;
|
||||||
|
} else {
|
||||||
|
_alternateGridBuffers[key] = verticesBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
GLfloat* vertexData = new GLfloat[vertices * 2];
|
GLfloat* vertexData = new GLfloat[vertices * 2];
|
||||||
GLfloat* vertex = vertexData;
|
GLfloat* vertex = vertexData;
|
||||||
|
@ -443,12 +457,6 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int h
|
||||||
|
|
||||||
verticesBuffer->append(sizeof(GLfloat) * vertices * 2, (gpu::Byte*) vertexData);
|
verticesBuffer->append(sizeof(GLfloat) * vertices * 2, (gpu::Byte*) vertexData);
|
||||||
delete[] vertexData;
|
delete[] vertexData;
|
||||||
|
|
||||||
if (registered) {
|
|
||||||
_registeredAlternateGridBuffers[id] = verticesBuffer;
|
|
||||||
} else {
|
|
||||||
_alternateGridBuffers[key] = verticesBuffer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_gridColors.contains(colorKey)) {
|
if (!_gridColors.contains(colorKey)) {
|
||||||
|
|
|
@ -337,8 +337,9 @@ private:
|
||||||
QHash<int, BatchItemDetails> _registeredDashedLines;
|
QHash<int, BatchItemDetails> _registeredDashedLines;
|
||||||
|
|
||||||
QHash<IntPair, gpu::BufferPointer> _gridBuffers;
|
QHash<IntPair, gpu::BufferPointer> _gridBuffers;
|
||||||
QHash<int, gpu::BufferPointer> _registeredAlternateGridBuffers;
|
|
||||||
QHash<Vec3Pair, gpu::BufferPointer> _alternateGridBuffers;
|
QHash<Vec3Pair, gpu::BufferPointer> _alternateGridBuffers;
|
||||||
|
QHash<int, gpu::BufferPointer> _registeredAlternateGridBuffers;
|
||||||
|
QHash<int, Vec3Pair> _lastRegisteredAlternateGridBuffers;
|
||||||
QHash<Vec3Pair, gpu::BufferPointer> _gridColors;
|
QHash<Vec3Pair, gpu::BufferPointer> _gridColors;
|
||||||
|
|
||||||
QHash<Vec2Pair, gpu::BufferPointer> _sphereVertices;
|
QHash<Vec2Pair, gpu::BufferPointer> _sphereVertices;
|
||||||
|
|
Loading…
Reference in a new issue