Graphics Reference
In-Depth Information
We remind ourselves that Equation (10.15), or the
M
w
2
d
operator, is the
net
trans-
formation that would be applied to vertices specified in WC space. From Equa-
tion (10.11), we observe that, as programmers, we are only responsible for
M
w
2
n
,
or half of the
M
w
2
d
operator. The other half of the operator,
M
n
2
d
, is computed
automatically by the graphics API. In this case, we analyze Equation (10.15) and
the
M
w
2
d
operator to understand the details of the images generated in the UI
drawing device. We will examine the effects of changing the WC window based
on tutorial implementations. Let us first extend our library to support working
with the WC window.
UWBGL_D3D_Lib10
Change summary.
See p. 522
for a summary of changes to
the library.
This library extends from
Lib9
by extending the
UWB
_
WindowHandler
class to
support the definition of the WC window and programming of the
M
w
2
n
operator.
Recall that the
WindowHandler
object is defined to abstract a view/controller
pair. For the
WindowHandler
object to properly display different regions of the
class
UWB
_
WindowHandler :
public
UWB
_
IWindowHandler {
.
Source file.
uwbgl
_
WindowHandler3.h
file in the
Common Files/
WindowHandler
// Set/Get methods for accessing the m
_
WCWindow object
A:
virtual void
SetWCWindow(
const
UWB
_
BoundingBox &window);
virtual const
UWB
_
BoundingBox
*
GetWCWindow();
// Set/Get methods for the drawing device (via m
_
hAttachedWindow)
B:
virtual void
SetDeviceSize(
int
width,
int
height);
virtual void
GetDeviceSize(
int
&width,
int
&height);
// wcPt -> dcPt (Equation
10.13
)
C:
virtual void
WorldToDevice(
float
wcX wcY,
int
&dcX &dcY);
// dcPt -> wcPt (Equation
10.19
)
virtual void
DeviceToWorld(
int
dcX dcY,
float
&wcX &wcY);
// Drawing the WCWindow
D:
virtual void
DrawWCWindow(UWB
_
DrawHelper&);
// Compute
M
w
2
n
and load to API matrix processor
E:
virtual void
LoadW2NDCXform() = 0;
protected
:
.
HWND m
_
hAttachedWindow;
// The UI drawing device (a MFC Window)
F:
UWB
_
BoundingBox m
_
WCWindow;
// Window for the World Coordinate
};
subfolder
UWBGL
_
D3D
_
Lib10
of
the
project.
Listing 10.7.
The
WindowHandler
class of
UWBGL
_
D3D
_
Lib10
.
Search WWH ::
Custom Search