#include "gcl/Camera.h"
#include "gcl/VecUtil.h"
#include "gcl/Quaternion.h"
Include dependency graph for Camera.cc:
Go to the source code of this file.
Functions | |||
![]() | ![]() | Void | FindWorldRay ( const Coord &c, const Transform &inverseW2S, Point &from, Vector &dir ) |
![]() | ![]() | FindWorldRay maps from display coords ([-1, 1], [-1, 1]) to a ray through the world. More... | |
Variables | |||
![]() | ![]() | const GCLReal | kProjEpsilon = 0.01 |
Void FindWorldRay (const Coord & c, const Transform & inverseW2S, Point & from, Vector & dir) |
FindWorldRay maps from display coords ([-1, 1], [-1, 1]) to a ray through the world.
We assume our world-to-screen matrix maps from some form of view pyramid to the box from -1 to 1 in x and y and 0 to 1 in z.
Note that this works regardless of whether a perspective or orthogonal projection is used; the only thing you need is the inverse WS matrix:
inverseW2S = inv(camera.ProjMatrix() * camera.ModelMatrix);
const GCLReal kProjEpsilon = 0.01 |