History

Minimum chat circle radius from Ryan, basic avatar/voxel orbit behavior.

Andrzej Kapolka committed 12 years ago

Commit aa9fc291 parent 100339310 files · +135 −12Browse files

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

Unified · Split

interface/src/Application.cpp+24−8
@@ -1105,9 +1105,24 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 1104 unmodified lines
1105 }1105 }
1106 1106
1107 if (activeWindow() == _window) {1107 if (activeWindow() == _window) {
1108 int deltaX = event->x() - _mouseX;
1109 int deltaY = event->y() - _mouseY;
1110
1108 _mouseX = event->x();1111 _mouseX = event->x();
1109 _mouseY = event->y();1112 _mouseY = event->y();
1110 1113
1114 // orbit behavior
1115 if (_mousePressed && !Menu::getInstance()->isVoxelModeActionChecked()) {
1116 if (_lookatTargetAvatar) {
1117 _myAvatar.orbit(_lookatTargetAvatar->getPosition(), deltaX, deltaY);
1118 return;
1119 }
1120 if (_isHoverVoxel) {
1121 _myAvatar.orbit(glm::vec3(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z) * (float)TREE_SCALE, deltaX, deltaY);
1122 return;
1123 }
1124 }
1125
1111 // detect drag1126 // detect drag
1112 glm::vec3 mouseVoxelPos(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z);1127 glm::vec3 mouseVoxelPos(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z);
1113 if (!_justEditedVoxel && mouseVoxelPos != _lastMouseVoxelPos) {1128 if (!_justEditedVoxel && mouseVoxelPos != _lastMouseVoxelPos) {
@@ -1151,7 +1166,8 @@ void Application::mousePressEvent(QMouseEvent* event) { · 37 unmodified lines
1151 }1166 }
1152 1167
1153 if (!_palette.isActive() && (!_isHoverVoxel || _lookatTargetAvatar)) {1168 if (!_palette.isActive() && (!_isHoverVoxel || _lookatTargetAvatar)) {
1154 _pieMenu.mousePressEvent(_mouseX, _mouseY);1169 // disable for now
1170 // _pieMenu.mousePressEvent(_mouseX, _mouseY);
1155 }1171 }
1156 1172
1157 if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode) && _pasteMode) {1173 if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode) && _pasteMode) {
@@ -1952,7 +1968,9 @@ void Application::updateLookatTargetAvatar(const glm::vec3& mouseRayOrigin, cons · 794 unmodified lines
1952 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);1968 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
1953 PerformanceWarning warn(showWarnings, "Application::updateLookatTargetAvatar()");1969 PerformanceWarning warn(showWarnings, "Application::updateLookatTargetAvatar()");
1954 1970
1955 _lookatTargetAvatar = findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, DEFAULT_NODE_ID_REF);1971 if (!_mousePressed) {
1972 _lookatTargetAvatar = findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, DEFAULT_NODE_ID_REF);
1973 }
1956}1974}
1957 1975
1958Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, const glm::vec3& mouseRayDirection,1976Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, const glm::vec3& mouseRayDirection,
@@ -1961,17 +1979,15 @@ Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, con · 2 unmodified lines
1961 NodeList* nodeList = NodeList::getInstance();1979 NodeList* nodeList = NodeList::getInstance();
1962 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {1980 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
1963 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {1981 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
1964 Avatar* avatar = (Avatar *) node->getLinkedData();1982 Avatar* avatar = (Avatar*)node->getLinkedData();
1965 glm::vec3 headPosition = avatar->getHead().getPosition();
1966 float distance;1983 float distance;
1967 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition,1984 if (avatar->findRayIntersection(mouseRayOrigin, mouseRayDirection, distance)) {
1968 HEAD_SPHERE_RADIUS * avatar->getHead().getScale(), distance)) {
1969 // rescale to compensate for head embiggening1985 // rescale to compensate for head embiggening
1970 eyePosition = (avatar->getHead().calculateAverageEyePosition() - avatar->getHead().getScalePivot()) *1986 eyePosition = (avatar->getHead().calculateAverageEyePosition() - avatar->getHead().getScalePivot()) *
1971 (avatar->getScale() / avatar->getHead().getScale()) + avatar->getHead().getScalePivot();1987 (avatar->getScale() / avatar->getHead().getScale()) + avatar->getHead().getScalePivot();
1972 1988
1973 _lookatIndicatorScale = avatar->getHead().getScale();1989 _lookatIndicatorScale = avatar->getHead().getScale();
1974 _lookatOtherPosition = headPosition;1990 _lookatOtherPosition = avatar->getHead().getPosition();
1975 nodeUUID = avatar->getOwningNode()->getUUID();1991 nodeUUID = avatar->getOwningNode()->getUUID();
1976 return avatar;1992 return avatar;
1977 }1993 }
@@ -2213,7 +2229,7 @@ void Application::updateHoverVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 235 unmodified lines
2213 glm::vec4 oldVoxel(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s);2229 glm::vec4 oldVoxel(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s);
2214 // only do this work if MAKE_SOUND_ON_VOXEL_HOVER or MAKE_SOUND_ON_VOXEL_CLICK is enabled, 2230 // only do this work if MAKE_SOUND_ON_VOXEL_HOVER or MAKE_SOUND_ON_VOXEL_CLICK is enabled,
2215 // and make sure the tree is not already busy... because otherwise you'll have to wait.2231 // and make sure the tree is not already busy... because otherwise you'll have to wait.
2216 if (!_voxels.treeIsBusy()) {2232 if (!(_voxels.treeIsBusy() || _mousePressed)) {
2217 {2233 {
2218 PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels() _voxels.findRayIntersection()");2234 PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels() _voxels.findRayIntersection()");
2219 _isHoverVoxel = _voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _hoverVoxel, distance, face);2235 _isHoverVoxel = _voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _hoverVoxel, distance, face);

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