History

Merge pull request #720 from LionTurtle/master

Fix eyePosition so that lookatVectors point directly to eyes,

ZappoMan committed 13 years ago

Commit 31a1e3e2 parents adf3f29 7177b713 files · +10 −5Browse files

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

Unified · Split

interface/src/Application.cpp+8−4
@@ -203,6 +203,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 202 unmodified lines
203203 _mouseVoxelScale(1.0f / 1024.0f),
204204 _justEditedVoxel(false),
205205 _isLookingAtOtherAvatar(false),
206+ _lookatIndicatorScale(1.0f),
206207 _paintOn(false),
207208 _dominantColor(0),
208209 _perfStatsOn(false),
@@ -1993,6 +1994,7 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 1784 unmodified lines
19931994 glm::vec3 headPosition = avatar->getHead().getPosition();
19941995 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {
19951996 eyePosition = avatar->getHead().getEyeLevelPosition();
1997+ _lookatIndicatorScale = avatar->getScale();
19961998 _lookatOtherPosition = headPosition;
19971999 nodeID = avatar->getOwningNode()->getNodeID();
19982000 return true;
@@ -2004,11 +2006,13 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 5 unmodified lines
20042006
20052007 void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) {
20062008
2007− const float DISTANCE_FROM_HEAD_SPHERE = 0.1f;
2009+ const float DISTANCE_FROM_HEAD_SPHERE = 0.1f * _lookatIndicatorScale;
2010+ const float INDICATOR_RADIUS = 0.1f * _lookatIndicatorScale;
20082011 const float YELLOW[] = { 1.0f, 1.0f, 0.0f };
2012+ const int NUM_SEGMENTS = 30;
20092013 glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z);
20102014 glColor3f(YELLOW[0], YELLOW[1], YELLOW[2]);
2011− renderCircle(haloOrigin, 0.1f, glm::vec3(0.0f, 1.0f, 0.0f), 30);
2015+ renderCircle(haloOrigin, INDICATOR_RADIUS, IDENTITY_UP, NUM_SEGMENTS);
20122016 }
20132017
20142018 void Application::update(float deltaTime) {
@@ -2057,7 +2061,7 @@ void Application::update(float deltaTime) { · 42 unmodified lines
20572061 glm::vec3 front = orientation * IDENTITY_FRONT;
20582062 glm::vec3 up = orientation * IDENTITY_UP;
20592063 glm::vec3 towardVoxel = getMouseVoxelWorldCoordinates(_mouseVoxelDragging)
2060− - _myAvatar.getCameraPosition(); // is this an error? getCameraPosition dne
2064+ - _myAvatar.getCameraPosition();
20612065 towardVoxel = front * glm::length(towardVoxel);
20622066 glm::vec3 lateralToVoxel = glm::cross(up, glm::normalize(towardVoxel)) * glm::length(towardVoxel);
20632067 _voxelThrust = glm::vec3(0, 0, 0);
@@ -2335,7 +2339,7 @@ void Application::updateAvatar(float deltaTime) { · 271 unmodified lines
23352339 // actually need to calculate the view frustum planes to send these details
23362340 // to the server.
23372341 loadViewFrustum(_myCamera, _viewFrustum);
2338− _myAvatar.setCameraPosition(_viewFrustum.getPosition()); // setCameraPosition() dne
2342+ _myAvatar.setCameraPosition(_viewFrustum.getPosition());
23392343 _myAvatar.setCameraOrientation(_viewFrustum.getOrientation());
23402344 _myAvatar.setCameraFov(_viewFrustum.getFieldOfView());
23412345 _myAvatar.setCameraAspectRatio(_viewFrustum.getAspectRatio());

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