Graphics Reference
In-Depth Information
class
CModel {
Source
file.
Model.h
file
in
the
Model
folder
of
the
.
private
:
.
// a
struct
: For simplicity and clarity of illustration
D3D
_
XformInfo
project.
A:
struct
RectWithXform {
UWB
_
PrimitiveRectangle m
_
rect;
// A rectangle
UWB
_
XformInfo m
_
xform; };
// The associated transformation information
//
R
1
and
R
2
rectangles with transformation information
RectWithXform m
_
Rect1, m
_
Rect2;
B:
};
C:
void
CModel::SetTranslation(
float
x,
float
y) {
m
_
Rect1.m
_
xform.SetTranslation(
vec3
(x,y,0));
// set the same translation to both
m
_
Rect2.m
_
xform.SetTranslation(
vec3
(x,y,0)); }
//
R
1
and
R
2
//
R
1
only
void
CModel::SetScale(
float
x,
float
y){m
_
Rect1.m
_
xform.SetScale(
vec3
(x,y,0)); }
//
R
2
only
D:
void
CModel::SetRotation(
float
theta) { m
_
Rect2.m
_
xform.SetRotationRadians(theta); }
E:
F:
void
CModel::DrawModel()
.
m
_
DrawHelper.InitializeModelTransform();
m
_
DrawHelper.PushModelTransform();
m
_
Rect1.m
_
xform.SetUpModelStack( m
_
DrawHelper );
m
_
Rect1.m
_
rect.Draw( lod, m
_
DrawHelper );
m
_
DrawHelper.PopModelTransform();
// ... similar operations for m
_
Rect2
Listing 9.11.
The
CModel
class of Tutorial 9.6.
Tutorial 9.7. Supporting User Interaction with
XformInfo
Tutorial 9.7.
Project Name:
D3D
_
XformInfoControls
Library Support:
UWB
_
MFC
_
Lib1
UWB
_
D3D
_
Lib9
•
Goals.
Examine the effects of changing the parameters in the
XformInfo
class.
•
Approach.
Implement a GUI class that allows the user to interactively
change every parameter in the
XformInfo
class.
Search WWH ::
Custom Search