Showing the changes to interface/src/VoxelSystem.cpp (1 of 2 files). Show all
Unified · Split
| @@ -477,37 +477,6 @@ void VoxelSystem::updatePartialVBOs() { · 476 unmodified lines | |||
| 477 | } | 477 | } |
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | void VoxelSystem::updateJustEnoughVBOs() { | ||
| 481 | bool somethingDirty = false; | ||
| 482 | glBufferIndex minDirty = GLBUFFER_INDEX_UNKNOWN; | ||
| 483 | glBufferIndex maxDirty = 0; | ||
| 484 | |||
| 485 | for (glBufferIndex i = 0; i < _voxelsInWriteArrays; i++) { | ||
| 486 | if (_voxelDirtyArray[i]) { | ||
| 487 | somethingDirty = true; | ||
| 488 | minDirty = std::min(minDirty,i); | ||
| 489 | maxDirty = std::max(maxDirty,i); | ||
| 490 | _voxelDirtyArray[i] = false; | ||
| 491 | } | ||
| 492 | } | ||
| 493 | |||
| 494 | if (somethingDirty) { | ||
| 495 | glBufferIndex segmentStart = minDirty; | ||
| 496 | glBufferIndex segmentEnd = maxDirty; | ||
| 497 | int segmentLength = (segmentEnd - segmentStart) + 1; | ||
| 498 | GLintptr segmentStartAt = segmentStart * VERTEX_POINTS_PER_VOXEL * sizeof(GLfloat); | ||
| 499 | GLsizeiptr segmentSizeBytes = segmentLength * VERTEX_POINTS_PER_VOXEL * sizeof(GLfloat); | ||
| 500 | GLfloat* readVerticesFrom = _readVerticesArray + (segmentStart * VERTEX_POINTS_PER_VOXEL); | ||
| 501 | glBindBuffer(GL_ARRAY_BUFFER, _vboVerticesID); | ||
| 502 | glBufferSubData(GL_ARRAY_BUFFER, segmentStartAt, segmentSizeBytes, readVerticesFrom); | ||
| 503 | segmentStartAt = segmentStart * VERTEX_POINTS_PER_VOXEL * sizeof(GLubyte); | ||
| 504 | segmentSizeBytes = segmentLength * VERTEX_POINTS_PER_VOXEL * sizeof(GLubyte); | ||
| 505 | GLubyte* readColorsFrom = _readColorsArray + (segmentStart * VERTEX_POINTS_PER_VOXEL); | ||
| 506 | glBindBuffer(GL_ARRAY_BUFFER, _vboColorsID); | ||
| 507 | glBufferSubData(GL_ARRAY_BUFFER, segmentStartAt, segmentSizeBytes, readColorsFrom); | ||
| 508 | } | ||
| 509 | } | ||
| 510 | |||
| 511 | void VoxelSystem::updateVBOs() { | 480 | void VoxelSystem::updateVBOs() { |
| 512 | static char buffer[40] = { 0 }; | 481 | static char buffer[40] = { 0 }; |
| 513 | if (_renderWarningsOn) { | 482 | if (_renderWarningsOn) { |
| @@ -519,8 +488,7 @@ void VoxelSystem::updateVBOs() { · 5 unmodified lines | |||
| 519 | if (_renderFullVBO) { | 488 | if (_renderFullVBO) { |
| 520 | updateFullVBOs(); | 489 | updateFullVBOs(); |
| 521 | } else { | 490 | } else { |
| 522 | updateJustEnoughVBOs(); | 491 | updatePartialVBOs(); // too many small segments? |
| 523 | //updatePartialVBOs(); // too many small segments? | ||
| 524 | } | 492 | } |
| 525 | _voxelsDirty = false; | 493 | _voxelsDirty = false; |
| 526 | } | 494 | } |