Graphics Reference
In-Depth Information
vec3 UWB _ XformInfo::GetTranslation() const { return m _ translation; }
void UWB _ XformInfo::SetTranslation( vec3 translation){ m _ translation = translation; }
A1:
void UWB _ XformInfo::SetUpModelStack(UWB _ DrawHelper& draw _ helper) const
draw _ helper.AccumulateModelTransform(m _ translation,m _ scale,m _ rotation _ radians,m _ pivot);
B1:
void UWB _ XformInfo::DrawPivot(UWB _ DrawHelper &draw _ helper, float size)
.
draw _ helper.DrawCircle( m _ pivot, size);
C1:
Listing 9.10. (cont.)
At labels B and B1, we see that these transformation parameters are sent to the
DrawHelper class for setting the corresponding graphics API-dependent matrix
processors (e.g. the WORLD matrix of D3D). At labels C and C1, for debugging
purposes, we support the drawing of a circle at the pivot position.
In the next tutorial, we examine how to use these new facilities to coordinate
the transformation of primitives.
Tutorial 9.6. Using the XformInfo Abstraction
Tutorial 9.6.
Project Name:
D3D _ XformInfo
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib9
Goals. Understand how to use the UWB _ XformInfo abstraction for support-
ing transformations.
Approach. Examine the implementation of Tutorial 9.5 based on the Xform
Info class.
Figure 9.17 is a screenshot of running Tutorial 9.6. By manipulating the slider
bars, we can verify that this tutorial has exactly the same behavior as that of
Tutorial 9.5. The only difference is that our implementation is based on the
XformInfo class. Listing 9.11 details the CModel class of Tutorial 9.6. At la-
bel A, RectWithXform is introduced to clearly illustrate the association between
XformInfo and Primitive . At label B, we see the declaration of the two rect-
angles. In this case, the set transformation functions selectively update the rect-
angles' XformInfo . We see that at label C the translation information is updated
into both; at label D, the scaling information is updated into only R 1 ; whereas at
label E, the rotation information is only updated in R 2 's XformInfo . At label F,
we call the transformation functions of the DrawHelper class to initialize and set
up the D3D WORLD matrix processor before issuing the draw command.
This tutorial demonstrates how to use the new XformInfo class to record
transformation information and work with the transformation functions in the
DrawHelper class to accomplish the desired transformed effects.
Figure 9.17.
Tutorial
9.6.
 
Search WWH ::




Custom Search