History

Circle drawn with camera orientation as its normal for lookatIndicator.

Mark Peng committed 13 years ago

Commit 125bcc41 parent 0bbea074 files · +24 −15Browse files

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

Unified · Split

interface/src/Application.cpp+15−14
@@ -1676,6 +1676,8 @@ void Application::initMenu() { · 1675 unmodified lines
1676 _renderFrameTimerOn->setChecked(false);1676 _renderFrameTimerOn->setChecked(false);
1677 (_renderLookatOn = renderMenu->addAction("Lookat Vectors"))->setCheckable(true);1677 (_renderLookatOn = renderMenu->addAction("Lookat Vectors"))->setCheckable(true);
1678 _renderLookatOn->setChecked(false);1678 _renderLookatOn->setChecked(false);
1679 (_renderLookatIndicatorOn = renderMenu->addAction("Lookat Indicator"))->setCheckable(true);
1680 _renderLookatIndicatorOn->setChecked(true);
1679 (_manualFirstPerson = renderMenu->addAction(1681 (_manualFirstPerson = renderMenu->addAction(
1680 "First Person", this, SLOT(setRenderFirstPerson(bool)), Qt::Key_P))->setCheckable(true);1682 "First Person", this, SLOT(setRenderFirstPerson(bool)), Qt::Key_P))->setCheckable(true);
1681 (_manualThirdPerson = renderMenu->addAction(1683 (_manualThirdPerson = renderMenu->addAction(
@@ -1887,7 +1889,7 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 205 unmodified lines
1887 glm::vec3 headPosition = avatar->getHead().getPosition();1889 glm::vec3 headPosition = avatar->getHead().getPosition();
1888 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {1890 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {
1889 eyePosition = avatar->getHead().getEyeLevelPosition();1891 eyePosition = avatar->getHead().getEyeLevelPosition();
1890 renderLookatIndicator(headPosition);1892 _lookatOtherPosition = headPosition;
1891 return true;1893 return true;
1892 }1894 }
1893 }1895 }
@@ -1895,24 +1897,19 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 1 unmodified line
1895 return false;1897 return false;
1896}1898}
1897 1899
1898void Application::renderLookatIndicator(glm::vec3& pointOfInterest) {1900void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) {
1899 // Render a circle between me and the avatar in question.
1900 1901
1901 // I need a vector that is perpendicular to the vector from my camera position to the head position.1902 glm::vec3 direction = glm::normalize(pointOfInterest - whichCamera.getPosition());
1902 // Start by locating point on vector that will be the center of the circle.
1903 glm::vec3 direction = glm::normalize(pointOfInterest - _myCamera.getPosition());
1904 const float DISTANCE_FROM_HEAD_SPHERE = 0.1f;1903 const float DISTANCE_FROM_HEAD_SPHERE = 0.1f;
1905 glm::vec3 indicatorOrigin = pointOfInterest - DISTANCE_FROM_HEAD_SPHERE * direction;1904 glm::vec3 indicatorOrigin = pointOfInterest - DISTANCE_FROM_HEAD_SPHERE * direction;
1906 // Then find a perpendicular vector/point
1907 // const float ARB_X = 1.0f;
1908 // const float ARB_Y = 1.0f;
1909 1905
1910 // float z = - (direction.x * ARB_X + direction.y * ARB_Y) / direction.z;1906 // glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z);
1911 // glm::vec3 perpendicular(ARB_X, ARB_Y, z);
1912 // perpendicular = glm::normalize(perpendicular);
1913 // glm::vec3 startingVertex = indicatorOrigin + perpendicular;
1914 renderCircle(indicatorOrigin, 0.1, direction, 30);
1915 1907
1908 glColor3f(1.0f, 0.0f, 0.0f);
1909 // renderCircle(haloOrigin, 0.1f, glm::vec3(0.0f, 1.0f, 0.0f), 30);
1910 // glm::vec3 normal;
1911 // _viewFrustum.computeNormalToNearClipPlane(normal);
1912 renderCircle(indicatorOrigin, 0.1f, _viewFrustum.getDirection(), 30);
1916}1913}
1917 1914
1918void Application::update(float deltaTime) {1915void Application::update(float deltaTime) {
@@ -2605,6 +2602,10 @@ void Application::displaySide(Camera& whichCamera) { · 686 unmodified lines
2605 } 2602 }
2606 _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());2603 _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());
2607 _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked());2604 _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked());
2605
2606 if (_renderLookatIndicatorOn->isChecked() && _isLookingAtOtherAvatar) {
2607 renderLookatIndicator(_lookatOtherPosition, whichCamera);
2608 }
2608 }2609 }
2609 2610
2610 if (TESTING_PARTICLE_SYSTEM) {2611 if (TESTING_PARTICLE_SYSTEM) {

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