History

Orbit around voxel center, limit hover distance.

Andrzej Kapolka committed 12 years ago

Commit 9d831a21 parent 7abb7d93 files · +9 −8Browse files

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

Unified · Split

interface/src/Application.cpp+7−6
@@ -1121,7 +1121,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 1120 unmodified lines
1121 return;1121 return;
1122 }1122 }
1123 if (_isHoverVoxel) {1123 if (_isHoverVoxel) {
1124 _myAvatar.orbit(glm::vec3(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z) * (float)TREE_SCALE, deltaX, deltaY);1124 _myAvatar.orbit(getMouseVoxelWorldCoordinates(_hoverVoxel), deltaX, deltaY);
1125 return;1125 return;
1126 }1126 }
1127 }1127 }
@@ -1618,10 +1618,9 @@ void Application::makeVoxel(glm::vec3 position, · 490 unmodified lines
1618 isDestructive);1618 isDestructive);
1619 }1619 }
1620 1620
1621const glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail _mouseVoxel) {1621glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVoxel) {
1622 return glm::vec3((_mouseVoxel.x + _mouseVoxel.s / 2.f) * TREE_SCALE,1622 return glm::vec3((mouseVoxel.x + mouseVoxel.s / 2.f) * TREE_SCALE, (mouseVoxel.y + mouseVoxel.s / 2.f) * TREE_SCALE,
1623 (_mouseVoxel.y + _mouseVoxel.s / 2.f) * TREE_SCALE,1623 (mouseVoxel.z + mouseVoxel.s / 2.f) * TREE_SCALE);
1624 (_mouseVoxel.z + _mouseVoxel.s / 2.f) * TREE_SCALE);
1625}1624}
1626 1625
1627const float NUDGE_PRECISION_MIN = 1 / pow(2.0, 12.0);1626const float NUDGE_PRECISION_MIN = 1 / pow(2.0, 12.0);
@@ -2245,7 +2244,9 @@ void Application::updateHoverVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 617 unmodified lines
2245 if (!(_voxels.treeIsBusy() || _mousePressed)) {2244 if (!(_voxels.treeIsBusy() || _mousePressed)) {
2246 {2245 {
2247 PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels() _voxels.findRayIntersection()");2246 PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels() _voxels.findRayIntersection()");
2248 _isHoverVoxel = _voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _hoverVoxel, distance, face);2247 const float MAX_HOVER_DISTANCE = 100.0f;
2248 _isHoverVoxel = _voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _hoverVoxel, distance, face) &&
2249 glm::distance(getMouseVoxelWorldCoordinates(_hoverVoxel), mouseRayOrigin) < MAX_HOVER_DISTANCE;
2249 }2250 }
2250 if (MAKE_SOUND_ON_VOXEL_HOVER && _isHoverVoxel &&2251 if (MAKE_SOUND_ON_VOXEL_HOVER && _isHoverVoxel &&
2251 glm::vec4(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s) != oldVoxel) {2252 glm::vec4(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s) != oldVoxel) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t