Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -124,6 +124,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 123 unmodified lines | ||
| 124 | 124 | _isHoverVoxel(false), |
| 125 | 125 | _isHoverVoxelSounding(false), |
| 126 | 126 | _mouseVoxelScale(1.0f / 1024.0f), |
| 127 | + _mouseVoxelScaleInitialized(false), | |
| 127 | 128 | _justEditedVoxel(false), |
| 128 | 129 | _nudgeStarted(false), |
| 129 | 130 | _lookingAlongX(false), |
| @@ -1782,7 +1783,7 @@ void Application::shrinkMirrorView() { · 1652 unmodified lines | ||
| 1782 | 1783 | } |
| 1783 | 1784 | |
| 1784 | 1785 | const float MAX_AVATAR_EDIT_VELOCITY = 1.0f; |
| 1785 | −const float MAX_VOXEL_EDIT_DISTANCE = 20.0f; | |
| 1786 | +const float MAX_VOXEL_EDIT_DISTANCE = 50.0f; | |
| 1786 | 1787 | const float HEAD_SPHERE_RADIUS = 0.07; |
| 1787 | 1788 | |
| 1788 | 1789 | static QUuid DEFAULT_NODE_ID_REF; |
| @@ -2051,6 +2052,8 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 262 unmodified lines | ||
| 2051 | 2052 | PerformanceWarning warn(showWarnings, "Application::updateMouseVoxels()"); |
| 2052 | 2053 | |
| 2053 | 2054 | _mouseVoxel.s = 0.0f; |
| 2055 | + bool wasInitialized = _mouseVoxelScaleInitialized; | |
| 2056 | + _mouseVoxelScaleInitialized = false; | |
| 2054 | 2057 | if (Menu::getInstance()->isVoxelModeActionChecked() && |
| 2055 | 2058 | (fabs(_myAvatar.getVelocity().x) + |
| 2056 | 2059 | fabs(_myAvatar.getVelocity().y) + |
| @@ -2058,6 +2061,12 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 1 unmodified line | ||
| 2058 | 2061 | |
| 2059 | 2062 | if (_voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _mouseVoxel, distance, face)) { |
| 2060 | 2063 | if (distance < MAX_VOXEL_EDIT_DISTANCE) { |
| 2064 | + // set the voxel scale to that of the first moused-over voxel | |
| 2065 | + if (!wasInitialized) { | |
| 2066 | + _mouseVoxelScale = _mouseVoxel.s; | |
| 2067 | + } | |
| 2068 | + _mouseVoxelScaleInitialized = true; | |
| 2069 | + | |
| 2061 | 2070 | // find the nearest voxel with the desired scale |
| 2062 | 2071 | if (_mouseVoxelScale > _mouseVoxel.s) { |
| 2063 | 2072 | // choose the larger voxel that encompasses the one selected |
| @@ -2990,6 +2999,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 926 unmodified lines | ||
| 2990 | 2999 | glDisable(GL_LIGHTING); |
| 2991 | 3000 | glPushMatrix(); |
| 2992 | 3001 | glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE); |
| 3002 | + const float CUBE_EXPANSION = 1.01f; | |
| 2993 | 3003 | if (_nudgeStarted) { |
| 2994 | 3004 | renderNudgeGuide(_nudgeGuidePosition.x, _nudgeGuidePosition.y, _nudgeGuidePosition.z, _nudgeVoxel.s); |
| 2995 | 3005 | renderNudgeGrid(_nudgeVoxel.x, _nudgeVoxel.y, _nudgeVoxel.z, _nudgeVoxel.s, _mouseVoxel.s); |
| @@ -2999,7 +3009,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 3 unmodified lines | ||
| 2999 | 3009 | _nudgeVoxel.z + _nudgeVoxel.s * 0.5f); |
| 3000 | 3010 | glColor3ub(255, 255, 255); |
| 3001 | 3011 | glLineWidth(4.0f); |
| 3002 | − glutWireCube(_nudgeVoxel.s); | |
| 3012 | + glutWireCube(_nudgeVoxel.s * CUBE_EXPANSION); | |
| 3003 | 3013 | glPopMatrix(); |
| 3004 | 3014 | } else { |
| 3005 | 3015 | renderMouseVoxelGrid(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s); |
| @@ -3018,13 +3028,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 12 unmodified lines | ||
| 3018 | 3028 | _nudgeGuidePosition.y + _nudgeVoxel.s*0.5f, |
| 3019 | 3029 | _nudgeGuidePosition.z + _nudgeVoxel.s*0.5f); |
| 3020 | 3030 | glLineWidth(4.0f); |
| 3021 | − glutWireCube(_nudgeVoxel.s); | |
| 3031 | + glutWireCube(_nudgeVoxel.s * CUBE_EXPANSION); | |
| 3022 | 3032 | } else { |
| 3023 | 3033 | glTranslatef(_mouseVoxel.x + _mouseVoxel.s*0.5f, |
| 3024 | 3034 | _mouseVoxel.y + _mouseVoxel.s*0.5f, |
| 3025 | 3035 | _mouseVoxel.z + _mouseVoxel.s*0.5f); |
| 3026 | 3036 | glLineWidth(4.0f); |
| 3027 | − glutWireCube(_mouseVoxel.s); | |
| 3037 | + glutWireCube(_mouseVoxel.s * CUBE_EXPANSION); | |
| 3028 | 3038 | } |
| 3029 | 3039 | glLineWidth(1.0f); |
| 3030 | 3040 | glPopMatrix(); |