History

fix for calls to glm sqrt with ints

Stephen Birarda committed 12 years ago

Commit 7bae88e1 parent 1007f521 file · +11 −10Browse files

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

Unified · Split

interface/src/MetavoxelSystem.cpp+11−10
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <QOpenGLFramebufferObject>
1717 #include <QReadLocker>
1818 #include <QWriteLocker>
19+#include <QThreadPool>
1920 #include <QtDebug>
2021
2122 #include <glm/gtx/transform.hpp>
@@ -636,9 +637,9 @@ HeightfieldBuffer::HeightfieldBuffer(const glm::vec3& translation, float scale, · 614 unmodified lines
636637 _heightTextureID(0),
637638 _colorTextureID(0),
638639 _materialTextureID(0),
639− _heightSize(glm::sqrt(height.size())),
640+ _heightSize(glm::sqrt(float(height.size()))),
640641 _heightIncrement(scale / (_heightSize - HEIGHT_EXTENSION)),
641− _colorSize(glm::sqrt(color.size() / DataBlock::COLOR_BYTES)),
642+ _colorSize(glm::sqrt(float(color.size() / DataBlock::COLOR_BYTES))),
642643 _colorIncrement(scale / (_colorSize - SHARED_EDGE)) {
643644
644645 _heightBounds.minimum.x -= _heightIncrement * HEIGHT_BORDER;
@@ -663,7 +664,7 @@ HeightfieldBuffer::~HeightfieldBuffer() { · 18 unmodified lines
663664 }
664665
665666 QByteArray HeightfieldBuffer::getUnextendedHeight() const {
666− int srcSize = glm::sqrt(_height.size());
667+ int srcSize = glm::sqrt(float(_height.size()));
667668 int destSize = srcSize - 3;
668669 QByteArray unextended(destSize * destSize, 0);
669670 const char* src = _height.constData() + srcSize + 1;
@@ -675,7 +676,7 @@ QByteArray HeightfieldBuffer::getUnextendedHeight() const { · 5 unmodified lines
675676 }
676677
677678 QByteArray HeightfieldBuffer::getUnextendedColor() const {
678− int srcSize = glm::sqrt(_color.size() / DataBlock::COLOR_BYTES);
679+ int srcSize = glm::sqrt(float(_color.size() / DataBlock::COLOR_BYTES));
679680 int destSize = srcSize - 1;
680681 QByteArray unextended(destSize * destSize * DataBlock::COLOR_BYTES, 0);
681682 const char* src = _color.constData();
@@ -720,7 +721,7 @@ void HeightfieldBuffer::render(bool cursor) { · 38 unmodified lines
720721 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, WHITE_COLOR);
721722
722723 } else {
723− int colorSize = glm::sqrt(_color.size() / DataBlock::COLOR_BYTES);
724+ int colorSize = glm::sqrt(float(_color.size() / DataBlock::COLOR_BYTES));
724725 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, colorSize, colorSize, 0, GL_RGB, GL_UNSIGNED_BYTE, _color.constData());
725726 }
726727
@@ -731,7 +732,7 @@ void HeightfieldBuffer::render(bool cursor) { · 4 unmodified lines
731732 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
732733 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
733734 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
734− int materialSize = glm::sqrt(_material.size());
735+ int materialSize = glm::sqrt(float(_material.size()));
735736 glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, materialSize, materialSize, 0,
736737 GL_LUMINANCE, GL_UNSIGNED_BYTE, _material.constData());
737738
@@ -1270,7 +1271,7 @@ int HeightfieldFetchVisitor::visit(MetavoxelInfo& info) { · 532 unmodified lines
12701271 char* dest = _buffer->getHeight().data() + destY * heightSize + destX;
12711272
12721273 const QByteArray& srcHeight = height->getContents();
1273− int srcSize = glm::sqrt(srcHeight.size());
1274+ int srcSize = glm::sqrt(float(srcHeight.size()));
12741275 float srcIncrement = info.size / srcSize;
12751276
12761277 if (info.size == _buffer->getScale() && srcSize == (heightSize - HeightfieldBuffer::HEIGHT_EXTENSION)) {
@@ -1323,7 +1324,7 @@ int HeightfieldFetchVisitor::visit(MetavoxelInfo& info) { · 46 unmodified lines
13231324 int destBytes = destWidth * DataBlock::COLOR_BYTES;
13241325
13251326 const QByteArray& srcColor = color->getContents();
1326− srcSize = glm::sqrt(srcColor.size() / DataBlock::COLOR_BYTES);
1327+ srcSize = glm::sqrt(float(srcColor.size() / DataBlock::COLOR_BYTES));
13271328 int srcStride = srcSize * DataBlock::COLOR_BYTES;
13281329 srcIncrement = info.size / srcSize;
13291330
@@ -1393,7 +1394,7 @@ int HeightfieldRegionVisitor::visit(MetavoxelInfo& info) { · 63 unmodified lines
13931394 HeightfieldHeightDataPointer height = info.inputValues.at(0).getInlineValue<HeightfieldHeightDataPointer>();
13941395 if (height) {
13951396 const QByteArray& heightContents = height->getContents();
1396− int size = glm::sqrt(heightContents.size());
1397+ int size = glm::sqrt(float(heightContents.size()));
13971398 int extendedSize = size + HeightfieldBuffer::HEIGHT_EXTENSION;
13981399 int heightContentsSize = extendedSize * extendedSize;
13991400
@@ -1401,7 +1402,7 @@ int HeightfieldRegionVisitor::visit(MetavoxelInfo& info) { · 1 unmodified line
14011402 int colorContentsSize = 0;
14021403 if (color) {
14031404 const QByteArray& colorContents = color->getContents();
1404− int colorSize = glm::sqrt(colorContents.size() / DataBlock::COLOR_BYTES);
1405+ int colorSize = glm::sqrt(float(colorContents.size() / DataBlock::COLOR_BYTES));
14051406 int extendedColorSize = colorSize + HeightfieldBuffer::SHARED_EDGE;
14061407 colorContentsSize = extendedColorSize * extendedColorSize * DataBlock::COLOR_BYTES;
14071408 }