diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 167c44111e..2214bb54cf 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -1438,7 +1438,7 @@ void Audio::renderToolBox(int x, int y, bool boxed) { static const float PULSE_MAX = 1.0f; static const float PULSE_FREQUENCY = 1.0f; // in Hz qint64 now = usecTimestampNow(); - if (now - _iconPulseTimeReference > USECS_PER_SECOND) { + if (now - _iconPulseTimeReference > (qint64)USECS_PER_SECOND) { // Prevents t from getting too big, which would diminish glm::cos precision _iconPulseTimeReference = now - ((now - _iconPulseTimeReference) % USECS_PER_SECOND); } diff --git a/interface/src/ui/MetavoxelEditor.cpp b/interface/src/ui/MetavoxelEditor.cpp index 26b403e423..97c4c08b41 100644 --- a/interface/src/ui/MetavoxelEditor.cpp +++ b/interface/src/ui/MetavoxelEditor.cpp @@ -804,7 +804,8 @@ void ImportHeightfieldTool::updateSpanner() { } HeightfieldBrushTool::HeightfieldBrushTool(MetavoxelEditor* editor, const QString& name) : - MetavoxelTool(editor, name, false) { + MetavoxelTool(editor, name, false), + _positionValid(false) { QWidget* widget = new QWidget(); widget->setLayout(_form = new QFormLayout()); @@ -831,8 +832,10 @@ void HeightfieldBrushTool::render() { float distance; if (!Application::getInstance()->getMetavoxels()->findFirstRayHeightfieldIntersection(origin, direction, distance)) { + _positionValid = false; return; } + _positionValid = true; Application::getInstance()->getMetavoxels()->renderHeightfieldCursor( _position = origin + distance * direction, _radius->value()); } @@ -844,7 +847,7 @@ bool HeightfieldBrushTool::eventFilter(QObject* watched, QEvent* event) { _radius->setValue(_radius->value() * glm::pow(2.0f, angle * ANGLE_SCALE)); return true; - } else if (event->type() == QEvent::MouseButtonPress) { + } else if (event->type() == QEvent::MouseButtonPress && _positionValid) { MetavoxelEditMessage message = { createEdit(static_cast(event)->button() == Qt::RightButton) }; Application::getInstance()->getMetavoxels()->applyEdit(message, true); return true; @@ -1021,7 +1024,8 @@ void VoxelMaterialSpannerTool::applyEdit(const AttributePointer& attribute, cons } VoxelBrushTool::VoxelBrushTool(MetavoxelEditor* editor, const QString& name) : - MetavoxelTool(editor, name, false, true) { + MetavoxelTool(editor, name, false, true), + _positionValid(false) { QWidget* widget = new QWidget(); widget->setLayout(_form = new QFormLayout()); @@ -1050,8 +1054,10 @@ void VoxelBrushTool::render() { if (!(Application::getInstance()->getMetavoxels()->findFirstRayHeightfieldIntersection( origin, direction, heightfieldDistance) | Application::getInstance()->getMetavoxels()->findFirstRayVoxelIntersection(origin, direction, voxelDistance))) { + _positionValid = false; return; } + _positionValid = true; Application::getInstance()->getMetavoxels()->renderVoxelCursor( _position = origin + qMin(heightfieldDistance, voxelDistance) * direction, _radius->value()); } @@ -1063,7 +1069,7 @@ bool VoxelBrushTool::eventFilter(QObject* watched, QEvent* event) { _radius->setValue(_radius->value() * glm::pow(2.0f, angle * ANGLE_SCALE)); return true; - } else if (event->type() == QEvent::MouseButtonPress) { + } else if (event->type() == QEvent::MouseButtonPress && _positionValid) { MetavoxelEditMessage message = { createEdit(static_cast(event)->button() == Qt::RightButton) }; Application::getInstance()->getMetavoxels()->applyEdit(message, true); return true; diff --git a/interface/src/ui/MetavoxelEditor.h b/interface/src/ui/MetavoxelEditor.h index c0433fc3cd..c154d7bc59 100644 --- a/interface/src/ui/MetavoxelEditor.h +++ b/interface/src/ui/MetavoxelEditor.h @@ -323,6 +323,7 @@ protected: QDoubleSpinBox* _radius; glm::vec3 _position; + bool _positionValid; }; /// Allows raising or lowering parts of the heightfield. @@ -453,6 +454,7 @@ protected: QDoubleSpinBox* _radius; glm::vec3 _position; + bool _positionValid; }; /// Allows texturing parts of the voxel field. diff --git a/interface/src/ui/Stats.cpp b/interface/src/ui/Stats.cpp index f041fb8569..d0a25f4f4a 100644 --- a/interface/src/ui/Stats.cpp +++ b/interface/src/ui/Stats.cpp @@ -461,10 +461,10 @@ void Stats::display( if (_metavoxelSendTotal > 0 || _metavoxelReceiveTotal > 0) { stringstream reliableStats; if (_metavoxelSendTotal > 0) { - reliableStats << "Upload: " << (_metavoxelSendProgress * 100 / _metavoxelSendTotal) << "% "; + reliableStats << "Upload: " << (_metavoxelSendProgress * 100LL / _metavoxelSendTotal) << "% "; } if (_metavoxelReceiveTotal > 0) { - reliableStats << "Download: " << (_metavoxelReceiveProgress * 100 / _metavoxelReceiveTotal) << "%"; + reliableStats << "Download: " << (_metavoxelReceiveProgress * 100LL / _metavoxelReceiveTotal) << "%"; } verticalOffset += STATS_PELS_PER_LINE; drawText(horizontalOffset, verticalOffset, scale, rotation, font, reliableStats.str().c_str(), color); diff --git a/interface/src/ui/TextRenderer.cpp b/interface/src/ui/TextRenderer.cpp index edc14dabf5..fce4c76c0d 100644 --- a/interface/src/ui/TextRenderer.cpp +++ b/interface/src/ui/TextRenderer.cpp @@ -29,7 +29,7 @@ // the width/height of the cached glyph textures -const int IMAGE_SIZE = 256; +const int IMAGE_SIZE = 512; static uint qHash(const TextRenderer::Properties& key, uint seed = 0) { // can be switched to qHash(key.font, seed) when we require Qt 5.3+ diff --git a/libraries/networking/src/ResourceCache.h b/libraries/networking/src/ResourceCache.h index 496839fdcd..e1b6327652 100644 --- a/libraries/networking/src/ResourceCache.h +++ b/libraries/networking/src/ResourceCache.h @@ -109,11 +109,11 @@ public: /// For loading resources, returns the number of bytes received. qint64 getBytesReceived() const { return _bytesReceived; } - /// For loading resources, returns the number of total bytes (or zero if unknown). + /// For loading resources, returns the number of total bytes (<= zero if unknown). qint64 getBytesTotal() const { return _bytesTotal; } /// For loading resources, returns the load progress. - float getProgress() const { return (_bytesTotal == 0) ? 0.0f : (float)_bytesReceived / _bytesTotal; } + float getProgress() const { return (_bytesTotal <= 0) ? 0.0f : (float)_bytesReceived / _bytesTotal; } /// Refreshes the resource. void refresh();