Graphics Reference
In-Depth Information
upwards movement
of camera
results in downwards shift
in image
Current
Camera Position
downwards movement
of camera
results in upwards shift
in image
Figure 15.9.
Vertical tracking displacement directions.
void UWB _ Camera::MouseTrack( int x, int y)
// compute dx/dy using mouse x/y movements
A: float dx=... dy=...
// comptue eye axis frame: V v
B: view _ direction = m _ LookAt - m _ CameraPos;
cross _ direction = cross(up _ direction,view _ direction); // V w
normalize(cross _ direction); // V w
up _ direction = cross(view _ direction,cross _ direction); // V u
normalize(up _ direction);
V u
//
// V δ =( dx × V w )+( dy × V u )
C: delta = (-dx * cross _ direction) + (dy * up _ direction);
m _ CameraPos = m _ CameraPos - delta; // p e = p e V δ
m _ LookAt = m _ LookAt - delta;
// p a = p a V δ
.
Source file.
uwbgl _ Camera _ Xform1.cpp
file
in
the Common Files/
Listing 15.14. The UWB _ Camera support for tracking.
Camera
subfolder
of
the
UWBGL _ D3D _ Lib14 project.
15.3.3
Dolly: Zooming the Camera
From real-world experience, we know that the view distance v d determines the
size of the object on the eventual photograph. When we want to take a closer
examination of an object, or zoom in on an object, we move the camera closer
Search WWH ::




Custom Search