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
16761676 _renderFrameTimerOn->setChecked(false);
16771677 (_renderLookatOn = renderMenu->addAction("Lookat Vectors"))->setCheckable(true);
16781678 _renderLookatOn->setChecked(false);
1679+ (_renderLookatIndicatorOn = renderMenu->addAction("Lookat Indicator"))->setCheckable(true);
1680+ _renderLookatIndicatorOn->setChecked(true);
16791681 (_manualFirstPerson = renderMenu->addAction(
16801682 "First Person", this, SLOT(setRenderFirstPerson(bool)), Qt::Key_P))->setCheckable(true);
16811683 (_manualThirdPerson = renderMenu->addAction(
@@ -1887,7 +1889,7 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 205 unmodified lines
18871889 glm::vec3 headPosition = avatar->getHead().getPosition();
18881890 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {
18891891 eyePosition = avatar->getHead().getEyeLevelPosition();
1890− renderLookatIndicator(headPosition);
1892+ _lookatOtherPosition = headPosition;
18911893 return true;
18921894 }
18931895 }
@@ -1895,24 +1897,19 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 1 unmodified line
18951897 return false;
18961898 }
18971899
1898−void Application::renderLookatIndicator(glm::vec3& pointOfInterest) {
1899− // Render a circle between me and the avatar in question.
1900+void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) {
19001901
1901− // I need a vector that is perpendicular to the vector from my camera position to the head position.
1902− // Start by locating point on vector that will be the center of the circle.
1903− glm::vec3 direction = glm::normalize(pointOfInterest - _myCamera.getPosition());
1902+ glm::vec3 direction = glm::normalize(pointOfInterest - whichCamera.getPosition());
19041903 const float DISTANCE_FROM_HEAD_SPHERE = 0.1f;
19051904 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;
19091905
1910− // float z = - (direction.x * ARB_X + direction.y * ARB_Y) / direction.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);
1906+ // glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z);
19151907
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);
19161913 }
19171914
19181915 void Application::update(float deltaTime) {
@@ -2605,6 +2602,10 @@ void Application::displaySide(Camera& whichCamera) { · 686 unmodified lines
26052602 }
26062603 _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());
26072604 _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked());
2605+
2606+ if (_renderLookatIndicatorOn->isChecked() && _isLookingAtOtherAvatar) {
2607+ renderLookatIndicator(_lookatOtherPosition, whichCamera);
2608+ }
26082609 }
26092610
26102611 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