Graphics Reference
In-Depth Information
Tutorial 10.10. Moving the WC Window Center (
(
cx wc ,
cy wc )
)
Tutorial 10.10.
Project Name:
D3D _ Panning
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib10
Goal. Verify that the effect of changing the center position of a WC window
does indeed correspond to continuous displaying of different regions in the
WC system.
Approach. Allow the user to interactively change the center position of a
WC window and examine the results.
Figure 10.18 is a screenshot of running Tutorial 10.10. In this tutorial, the large
(main) view displays a larger region of the WC system (the entire geometric per-
son), while the small view only displays part of the WC system visible in the
main view. The red wire-framed rectangle in the main view represents the WC
window of the small view. The two slider bars on the lower-right of the applica-
tion window control the center position (
Figure 10.18.
Running
(
,
)
) of the WC window for the
small view. By changing these two slider bars, we can observe the red rectangle
in the main view and the image showing in the small view pan across the main
view. This tutorial verifies that changing the WC window position creates the
panning effect. Figure 10.19 illustrates that the implementation of Tutorial 10.10
involves two different types of CWindowHandler objects. The top-center rectan-
gle represents the CDrawOnlyHandler of the small view, whereas the bottom-
center rectangle is the CMainHandler of the main view. As we can see, the
CMainHandler maintains a reference to the small view. This reference provides
the small view WC window information for the main view to draw the wire-
framed red rectangle. With the UWBGL _ D3D _ Lib10 support, both of the Handler
objects have an instance of UWB _ BoundingBox representing their corresponding
WC window.
cx wc
cy wc
Tutorial 10.10.
As in the case of Listing 10.10, during DrawGraphics() , each
DrawOnlyHandler
(small view)
WC Window
EndDrawAndShow()
Center=(sx,sy)
W=10, H=10
BeginDraw()
40
0
40
Computes
and Loads
M w2n
UI Drawing Areas
On TutorialDlg
Vertices in
WC Space
M W
M V
M P
20
0
20
Computes
and Loads
RC
GHC
M w2n
reference to
SmallView
BeginDraw()
20
40
22
4
Model in the
World Coordinate Space
EndDrawAndShow()
WC Window
MainHandler
(main view)
Center=(18,18)
W=36, H=36
Figure 10.19.
Implementation of Tutorial 10.10.
Search WWH ::




Custom Search