Graphics Reference
In-Depth Information
15.1
UWBGL Camera Implementation
UWBGL_D3D_Lib14
Change summary.
See p. 527
for a summary of changes to
the library.
This is our first library that supports 3D interaction. The major changes in the
library include two new classes:
•
UWB
_
Camera
.
To support camera and viewing frustum.
•
UWB
_
PrimitiveAxisFrame
.
To support drawing of an orthonormal basis.
and modifications to
•
UWB
_
WindowHandler
and
UWBD3D
_
WindowHandler
.
To support working
with the new
UWB
_
Camera
class.
•
UWB
_
XformInfo
.
To support rotation in 3D.
The details of the
UWB
_
Camera
and
WindowHandler
classes will be explained
over the next few tutorials in this chapter. Here is an overview of these two
classes. Listing 15.3 shows that the new
UWB
_
Camera
class has three major groups
class
UWB
_
Camera {
public
:
A:
Setting the camera and matrix processors: to be discussed in
Tutorial 15.1
void
SetCameraParameters(
const vec3
& pos,
const vec3
&at,
const vec3
&up);
void
SetViewFrustumInDegree(
float
fov,
float
n,
float
f);
B:
Drawing the camera: to be discussed in
Tutorial 15.3
Source
file.
Camera1.h
file
in
the
Common Files/
void
Draw( eLevelOfDetail lod, UWB
_
DrawHelper& draw
_
helper )
const
;
C:
Manipulating the camera with mouse: to be discussed in
Tutorial 15.3
void
BeginMouseRotate(
int
x,
int
y);
void
BeginMouseTrack(
int
x,
int
y);
void
BeginMouseZoom(
int
x);
.
protected
:
D:
Camera
subfolder
of
the
UWBGL
_
D3D
_
Lib14
project.
vec3
m
_
CameraPos, m
_
LookAt, m
_
UpVector;
// parameters for the camera
float
m
_
ViewFOV, m
_
ViewNearPlane, m
_
ViewFarPlane;
// parameters for the view frustum
.
};
Listing 15.3.
The
UWB
_
Camera
class of Lib14.
Search WWH ::
Custom Search