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
203 _mouseVoxelScale(1.0f / 1024.0f),203 _mouseVoxelScale(1.0f / 1024.0f),
204 _justEditedVoxel(false),204 _justEditedVoxel(false),
205 _isLookingAtOtherAvatar(false),205 _isLookingAtOtherAvatar(false),
206 _lookatIndicatorScale(1.0f),
206 _paintOn(false),207 _paintOn(false),
207 _dominantColor(0),208 _dominantColor(0),
208 _perfStatsOn(false),209 _perfStatsOn(false),
@@ -1993,6 +1994,7 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 1784 unmodified lines
1993 glm::vec3 headPosition = avatar->getHead().getPosition();1994 glm::vec3 headPosition = avatar->getHead().getPosition();
1994 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {1995 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {
1995 eyePosition = avatar->getHead().getEyeLevelPosition();1996 eyePosition = avatar->getHead().getEyeLevelPosition();
1997 _lookatIndicatorScale = avatar->getScale();
1996 _lookatOtherPosition = headPosition;1998 _lookatOtherPosition = headPosition;
1997 nodeID = avatar->getOwningNode()->getNodeID();1999 nodeID = avatar->getOwningNode()->getNodeID();
1998 return true;2000 return true;
@@ -2004,11 +2006,13 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 5 unmodified lines
2004 2006
2005void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) {2007void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) {
2006 2008
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;
2008 const float YELLOW[] = { 1.0f, 1.0f, 0.0f };2011 const float YELLOW[] = { 1.0f, 1.0f, 0.0f };
2012 const int NUM_SEGMENTS = 30;
2009 glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z);2013 glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z);
2010 glColor3f(YELLOW[0], YELLOW[1], YELLOW[2]);2014 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);
2012}2016}
2013 2017
2014void Application::update(float deltaTime) {2018void Application::update(float deltaTime) {
@@ -2057,7 +2061,7 @@ void Application::update(float deltaTime) { · 42 unmodified lines
2057 glm::vec3 front = orientation * IDENTITY_FRONT;2061 glm::vec3 front = orientation * IDENTITY_FRONT;
2058 glm::vec3 up = orientation * IDENTITY_UP;2062 glm::vec3 up = orientation * IDENTITY_UP;
2059 glm::vec3 towardVoxel = getMouseVoxelWorldCoordinates(_mouseVoxelDragging)2063 glm::vec3 towardVoxel = getMouseVoxelWorldCoordinates(_mouseVoxelDragging)
2060 - _myAvatar.getCameraPosition(); // is this an error? getCameraPosition dne2064 - _myAvatar.getCameraPosition();
2061 towardVoxel = front * glm::length(towardVoxel);2065 towardVoxel = front * glm::length(towardVoxel);
2062 glm::vec3 lateralToVoxel = glm::cross(up, glm::normalize(towardVoxel)) * glm::length(towardVoxel);2066 glm::vec3 lateralToVoxel = glm::cross(up, glm::normalize(towardVoxel)) * glm::length(towardVoxel);
2063 _voxelThrust = glm::vec3(0, 0, 0);2067 _voxelThrust = glm::vec3(0, 0, 0);
@@ -2335,7 +2339,7 @@ void Application::updateAvatar(float deltaTime) { · 271 unmodified lines
2335 // actually need to calculate the view frustum planes to send these details 2339 // actually need to calculate the view frustum planes to send these details
2336 // to the server.2340 // to the server.
2337 loadViewFrustum(_myCamera, _viewFrustum);2341 loadViewFrustum(_myCamera, _viewFrustum);
2338 _myAvatar.setCameraPosition(_viewFrustum.getPosition()); // setCameraPosition() dne2342 _myAvatar.setCameraPosition(_viewFrustum.getPosition());
2339 _myAvatar.setCameraOrientation(_viewFrustum.getOrientation());2343 _myAvatar.setCameraOrientation(_viewFrustum.getOrientation());
2340 _myAvatar.setCameraFov(_viewFrustum.getFieldOfView());2344 _myAvatar.setCameraFov(_viewFrustum.getFieldOfView());
2341 _myAvatar.setCameraAspectRatio(_viewFrustum.getAspectRatio());2345 _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