Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 6 files). Show all
Unified · Split
| @@ -255,11 +255,12 @@ void PointBuffer::render() { · 254 unmodified lines | ||
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | HeightfieldBuffer::HeightfieldBuffer(const glm::vec3& translation, float scale, |
| 258 | − const QByteArray& height, const QByteArray& color) : | |
| 258 | + const QByteArray& height, const QByteArray& color, bool clearAfterLoading) : | |
| 259 | 259 | _translation(translation), |
| 260 | 260 | _scale(scale), |
| 261 | 261 | _height(height), |
| 262 | 262 | _color(color), |
| 263 | + _clearAfterLoading(clearAfterLoading), | |
| 263 | 264 | _heightTexture(QOpenGLTexture::Target2D), |
| 264 | 265 | _colorTexture(QOpenGLTexture::Target2D) { |
| 265 | 266 | } |
| @@ -281,8 +282,9 @@ void HeightfieldBuffer::render() { · 15 unmodified lines | ||
| 281 | 282 | _heightTexture.setFormat(QOpenGLTexture::LuminanceFormat); |
| 282 | 283 | _heightTexture.allocateStorage(); |
| 283 | 284 | _heightTexture.setData(QOpenGLTexture::Luminance, QOpenGLTexture::UInt8, _height.data()); |
| 284 | − _height.clear(); | |
| 285 | − | |
| 285 | + if (_clearAfterLoading) { | |
| 286 | + _height.clear(); | |
| 287 | + } | |
| 286 | 288 | if (!_color.isEmpty()) { |
| 287 | 289 | int colorSize = glm::sqrt(_color.size() / 3); |
| 288 | 290 | _colorTexture.setSize(colorSize, colorSize); |
| @@ -294,8 +296,9 @@ void HeightfieldBuffer::render() { · 5 unmodified lines | ||
| 294 | 296 | _colorTexture.allocateStorage(); |
| 295 | 297 | if (!_color.isEmpty()) { |
| 296 | 298 | _colorTexture.setData(QOpenGLTexture::RGB, QOpenGLTexture::UInt8, _color.data()); |
| 297 | − _color.clear(); | |
| 298 | − | |
| 299 | + if (_clearAfterLoading) { | |
| 300 | + _color.clear(); | |
| 301 | + } | |
| 299 | 302 | } else { |
| 300 | 303 | const quint8 WHITE_COLOR[] = { 255, 255, 255 }; |
| 301 | 304 | _colorTexture.setData(QOpenGLTexture::RGB, QOpenGLTexture::UInt8, const_cast<quint8*>(WHITE_COLOR)); |