Graphics Reference
In-Depth Information
void
CMainHandler::DrawGraphics()
Source file.
DrawAndMouseHandler.cpp
file
.
BeginDraw();
.
in
the
WindowHandler
the
D3D
_
Panning
folder
of
project.
A:
LoadW2NDCXform();
// compute
M
w
2
n
and load to
M
V
.
m
_
pD3DDevice->Clear(
.
.);
// clears the UI drawing area (device)
theApp.GetModel().DrawModel();
// model sends all geometries
.
// draws the red wire-frame rectangle
m
_
pLinkedHandler->DrawWCWindow(helper);
EndDrawAndShow();
B:
Listing 10.13.
The
CMainHandler::DrawGraphics()
function of Tutorial 10.10.
As we have learned, the
M
w
2
n
operator ensures that only the region defined by
the corresponding WC window is transformed into the
1 NDC space where
the rest of the geometries will be clipped away by the graphics API. The right
side of Figure 10.19 reminds us that that each
Handler
object is responsible for
initializing the
swapchain
links with
BeginDraw()
and flushing the hardware
buffer to the UI draw area with the
EndDrawAndShow()
function calls. List-
ing 10.11 shows the definition of the
CDrawOnlyHandler
and
CMainHandler
classes of Tutorial 10.10. We see that indeed both of the classes subclass from the
UWBD3D
_
WindowHandler
class and that the
CMainHandler
has a reference to the
small view (m_pLinkedHandler). Referring to Listing 10.12, at label A we see
that the main application window (
CTutorialDlg
) has an instance of each of the
Handler
objects representing the main and the small views. At label B, the WC
window for each of the views is initialized. At label C, the main view gets a ref-
erence to the small view. Listing 10.13 shows the
DrawGraphics()
function of
MainHandler
calling
LoadW2NDCXForm()
to compute and load the correspond-
ing
M
w
2
n
operator at label A (before drawing the model). At label B, the WC
window of the
m
_
pLinkedHandler
(small view) is drawn (as the red wire-frame
rectangle) in the main view.
With this structure, the two slider bars are connected to the small view's WC
window center position. When the user adjusts the slider bars, the changes are
immediately updated to the
m
_
small
_
view
's
m
_
WCWindow
. In the subsequent
redraw, the updated WC window computes an appropriate
M
w
2
n
operator that
corresponds to the user input.
±
Search WWH ::
Custom Search