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
11051105 }
11061106
11071107 if (activeWindow() == _window) {
1108+ int deltaX = event->x() - _mouseX;
1109+ int deltaY = event->y() - _mouseY;
1110+
11081111 _mouseX = event->x();
11091112 _mouseY = event->y();
11101113
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+
11111126 // detect drag
11121127 glm::vec3 mouseVoxelPos(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z);
11131128 if (!_justEditedVoxel && mouseVoxelPos != _lastMouseVoxelPos) {
@@ -1151,7 +1166,8 @@ void Application::mousePressEvent(QMouseEvent* event) { · 37 unmodified lines
11511166 }
11521167
11531168 if (!_palette.isActive() && (!_isHoverVoxel || _lookatTargetAvatar)) {
1154− _pieMenu.mousePressEvent(_mouseX, _mouseY);
1169+ // disable for now
1170+ // _pieMenu.mousePressEvent(_mouseX, _mouseY);
11551171 }
11561172
11571173 if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode) && _pasteMode) {
@@ -1952,7 +1968,9 @@ void Application::updateLookatTargetAvatar(const glm::vec3& mouseRayOrigin, cons · 794 unmodified lines
19521968 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
19531969 PerformanceWarning warn(showWarnings, "Application::updateLookatTargetAvatar()");
19541970
1955− _lookatTargetAvatar = findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, DEFAULT_NODE_ID_REF);
1971+ if (!_mousePressed) {
1972+ _lookatTargetAvatar = findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, DEFAULT_NODE_ID_REF);
1973+ }
19561974 }
19571975
19581976 Avatar* 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
19611979 NodeList* nodeList = NodeList::getInstance();
19621980 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
19631981 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
1964− Avatar* avatar = (Avatar *) node->getLinkedData();
1965− glm::vec3 headPosition = avatar->getHead().getPosition();
1982+ Avatar* avatar = (Avatar*)node->getLinkedData();
19661983 float distance;
1967− if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition,
1968− HEAD_SPHERE_RADIUS * avatar->getHead().getScale(), distance)) {
1984+ if (avatar->findRayIntersection(mouseRayOrigin, mouseRayDirection, distance)) {
19691985 // rescale to compensate for head embiggening
19701986 eyePosition = (avatar->getHead().calculateAverageEyePosition() - avatar->getHead().getScalePivot()) *
19711987 (avatar->getScale() / avatar->getHead().getScale()) + avatar->getHead().getScalePivot();
19721988
19731989 _lookatIndicatorScale = avatar->getHead().getScale();
1974− _lookatOtherPosition = headPosition;
1990+ _lookatOtherPosition = avatar->getHead().getPosition();
19751991 nodeUUID = avatar->getOwningNode()->getUUID();
19761992 return avatar;
19771993 }
@@ -2213,7 +2229,7 @@ void Application::updateHoverVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 235 unmodified lines
22132229 glm::vec4 oldVoxel(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s);
22142230 // only do this work if MAKE_SOUND_ON_VOXEL_HOVER or MAKE_SOUND_ON_VOXEL_CLICK is enabled,
22152231 // 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)) {
22172233 {
22182234 PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels() _voxels.findRayIntersection()");
22192235 _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