Graphics Reference
In-Depth Information
-
WindowHandler
subfolder.
Contains
IWindowHandler
,and
Window
Handler.h/.cpp
, the abstract and API-independent definition of the
WindowHandler
class. These file are identical to the files from the
previous library (
UWBGL
_
D3D
_
Lib3
).
•
Header Files
folder.
Contains the header files that support D3D API-
specific functionality.
•
D3D Files
folder.
Contains files that define D3D-specific classes. For ex-
ample, we have already seen
D3DWindowHandler.h/.cpp
implementing
D3D-specific
WindowHandler
functionality.
-
D3D_DrawHelper
subfolder.
Contains
D3DDrawHelper1.h/.cpp
.
These two files implement D3D-specific drawing functionality for the
DrawHelper
abstraction.
This new subfolder replaces the previous
D3D_Geoms
subfolder.
-
D3D_GraphicsSystem
subfolder.
Contains
D3DGraphicsSystem.h/
.cpp
. These files implement the abstract graphics API. These files are
identical to the ones from the previous library.
-
D3D_WindowHandler
subfolder.
Contains
D3DWindowHandler.h/
.cpp
. These files implement the view/controller pair for the D3D
API. These files are identical to the ones from the previous library.
DrawHelper
class.
The
DrawHelper
class defines drawing attributes and pure
virtual drawing functions. As we can see from Listing 7.1, under label A are
the drawing functions that do not do anything. Under label B are the functions
and the instance variables that are capable of recording the desired attributes for
drawing. Label C shows examples of the attribute-setting functions. To support
graphics API-specific drawing commands, each graphics API should subclass
from
DrawHelper
and override the drawing functions. Label D shows that the
DrawHelper
class has support for modeling transformations.
We will discuss
working with the transformation functions in Chapter 9.
OGLDrawHelper
.
Similar to
the
D3DDrawHelper
class, the
OGLDrawHelper
class imple-
ments OpenGL-specific prim-
itive drawings.
D3DDrawHelper
class.
The
D3DDrawHelper
class subclasses from the
Draw
Helper
class to implement D3D-specific attribute setting and primitive drawing.
Listing 7.2 shows the
D3DDrawHelper
class override the drawing and attribute-
setting functions.
The implementation of the attribute-setting functions (e.g.,
RC.
Rendering context. Re-
call that this context contains
the entire rendering state.
SetFillMode()
) shows that we do indeed invoke the D3D
GraphicsSystem
to
set the render state of the D3D RC. Listing 7.3 shows the draw functions for line
Search WWH ::
Custom Search