History

Working on heightfield encoding.

Andrzej Kapolka committed 12 years ago

Commit 1ea9b0c1 parent 496f4a16 files · +112 −8Browse files

Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 6 files). Show all

Unified · Split

interface/src/MetavoxelSystem.cpp+8−5
@@ -255,11 +255,12 @@ void PointBuffer::render() { · 254 unmodified lines
255255 }
256256
257257 HeightfieldBuffer::HeightfieldBuffer(const glm::vec3& translation, float scale,
258− const QByteArray& height, const QByteArray& color) :
258+ const QByteArray& height, const QByteArray& color, bool clearAfterLoading) :
259259 _translation(translation),
260260 _scale(scale),
261261 _height(height),
262262 _color(color),
263+ _clearAfterLoading(clearAfterLoading),
263264 _heightTexture(QOpenGLTexture::Target2D),
264265 _colorTexture(QOpenGLTexture::Target2D) {
265266 }
@@ -281,8 +282,9 @@ void HeightfieldBuffer::render() { · 15 unmodified lines
281282 _heightTexture.setFormat(QOpenGLTexture::LuminanceFormat);
282283 _heightTexture.allocateStorage();
283284 _heightTexture.setData(QOpenGLTexture::Luminance, QOpenGLTexture::UInt8, _height.data());
284− _height.clear();
285−
285+ if (_clearAfterLoading) {
286+ _height.clear();
287+ }
286288 if (!_color.isEmpty()) {
287289 int colorSize = glm::sqrt(_color.size() / 3);
288290 _colorTexture.setSize(colorSize, colorSize);
@@ -294,8 +296,9 @@ void HeightfieldBuffer::render() { · 5 unmodified lines
294296 _colorTexture.allocateStorage();
295297 if (!_color.isEmpty()) {
296298 _colorTexture.setData(QOpenGLTexture::RGB, QOpenGLTexture::UInt8, _color.data());
297− _color.clear();
298−
299+ if (_clearAfterLoading) {
300+ _color.clear();
301+ }
299302 } else {
300303 const quint8 WHITE_COLOR[] = { 255, 255, 255 };
301304 _colorTexture.setData(QOpenGLTexture::RGB, QOpenGLTexture::UInt8, const_cast<quint8*>(WHITE_COLOR));