Graphics Reference
In-Depth Information
class
UWB
_
Primitive {
public
:
A:
void
Draw( eLevelOfDetail lod, UWB
_
DrawHelper& draw
_
helper )
const
;
B:
virtual void
Update(
float
elapsed
_
seconds);
C:
virtual void
MouseDownVertex(
int
vertexID,
float
x,
float
y);
virtual void
MoveTo(
float
x,
float
y);
D:
void
SetVelocity(
vec3
velocity);
// Set/Get velocity attribute
vec3
GetVelocity()
const
;
bool
IsStationary()
const
;
.
protected
:
E:
vec3
m
_
velocity;
// instance variables for storing the attributes
UWB
_
Color m
_
FlatColor;
// color for flat shading
float
m
_
PointSize;
// If primitive is a point this is the size,
// otherwise, not used
virtual void
SetupDrawAttributes(UWB
_
DrawHelper& draw
_
helper)
const
;
virtual void
DrawPrimitive( ... UWB
_
DrawHelper& draw
_
helper )
const
=0;
.
F:
Source file.
uwbgl
_
Primitive1.h/cpp
files in the
Common Files/
Primitives
};
Listing 7.9.
The
UWB
_
Primitive
class (Tutorial 7.2).
subfolder
of
the
UWBGL
_
D3D
_
Lib5
project.
•
B: The
Update()
function.
The
elapsed
_
seconds
parameter is the wall-
clock time since the previous invocation of this function. A subclass with
a time-varying internal state should override this function and update its
internal states accordingly.
•
C: The mouse edit support functions.
These functions are defined to
support abstract mouse interactions. For example,
vertexID
can be used
to represent the number of editing mouse clicks performed on behalf of a
primitive. We will examine how to use these functions to support general
editing of point, line, and circle primitives.
•
D and E: The attributes and the corresponding set/get functions.
All
primitive attributes are represented by instance variables in the
Primitive
base class. As shown at label D1, attribute setting and getting functions
simply set/get the corresponding internal instance variables.
Search WWH ::
Custom Search