Graphics Reference
In-Depth Information
At label D, the combined _ matrix is loaded into the WORLD ( M W ) matrix proces-
sor. Recall that when drawing with D3D, all vertices ( V ) go through the transfor-
mation
M P ,M V ,M W . These
are the matrices of the corre-
sponding PROJECTION , VIEW ,
and WORLD matrix processors
in the D3D RC.
VM W M V M P .
In this case, because M P and M V remain unchanged in between updates, and
because we are loading M a into M W before each redraw, the transformation that
affects the rectangle is
V i M a =
V i S
(
s x ,
s y )
T
(
t x ,
t y ) .
Tutorial 9.2. Order of Matrix Concatenation
Tutorial 9.2.
Project Name:
D3D _ MatrixMultiplyOrder
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib8
Goals. Verify that the order of matrix concatenation is important and that
different concatenation ordering would result in different transformation
operators.
Approach. Continue with previous tutorial, and allow the user to control
the order to concatenate the translation and scaling operators.
Figure 9.11 is a screenshot of running Tutorial 9.2. This tutorial extends Tuto-
rial 9.1 by allowing the user to the control of the order of concatenation for the
translation and scaling operators. By clicking on the corresponding radio but-
ton in the lower-left corner, the user can select to apply either the M a operator
(Equation (9.6)) from Tutorial 9.1:
Figure 9.11.
Tutorial
9.2.
M a =
S
(
s x ,
s y )
T
(
t x ,
t y )
or
M b =
T
(
t x ,
t y )
S
(
s x ,
s y )
(9.7)
to the vertices ( V i ) of the rectangle. We have already experienced M a in the
previous tutorial. For M b , notice that the input vertices will be translated before
being scaled.
, the output of the translation operation
is a rectangle with non-zero vertex coordinates. From previous discussions, we
would expect the scaling operation to change the size of and move the translated
rectangle. We can verify these behaviors by manipulating the four slider bars. The
implementation of this tutorial is identical to that of Tutorial 9.1 except for the
CModel::DrawModel() function, shown in Listing 9.3. When comparing to the
DrawModel() function from Listing 9.2, we observe the same computation for the
translation and scaling operators (A), the same loading of the WORLD matrix with
For any non-zero
(
t x ,
t y )
 
Search WWH ::




Custom Search