This commit is contained in:
Atlante45 2014-12-04 19:38:39 -08:00
parent d2b0cdbac3
commit 90d4e7bae9
2 changed files with 8 additions and 1 deletions

View file

@ -39,7 +39,7 @@ static const float MOUSE_PITCH_RANGE = 1.0f * PI;
static const float MOUSE_YAW_RANGE = 0.5f * TWO_PI;
// Return a point's coordinates on a sphere from pitch and yaw
// Return a point's cartesian coordinates on a sphere from pitch and yaw
glm::vec3 getPoint(float yaw, float pitch) {
return glm::vec3(glm::cos(-pitch) * (-glm::sin(yaw)),
glm::sin(-pitch),

View file

@ -34,6 +34,13 @@ public:
QPoint getPalmClickLocation(const PalmData *palm) const;
bool calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction, glm::vec3& result) const;
// Converter from one frame of reference to another.
// Frame of reference:
// Screen: Position on the screen (x,y)
// Spherical: Pitch and yaw that gives the position on the sphere we project on (yaw,pitch)
// Overlay: Position on the overlay (x,y)
// (x,y) in Overlay are similar than (x,y) in Screen except they can be outside of the bound of te screen.
// This allows for picking outside of the screen projection in 3D.
glm::vec2 screenToSpherical(glm::vec2 screenPos) const;
glm::vec2 sphericalToScreen(glm::vec2 sphericalPos) const;
glm::vec2 sphericalToOverlay(glm::vec2 sphericalPos) const;