Graphics Reference
In-Depth Information
class
UWBD3D
_
PrimitiveMeshArrow :
public
UWB
_
Primitive {
public
:
.
protected
:
// draws with no internal representation
A:
void
DrawPrimitive( ... );
.
void
UWBD3D
_
PrimitiveMeshArrow::DrawPrimitive( ... ) {
.
// refernce to a cylinder mesh
B:
pCylinderMesh = graphics.GetMeshResource( L"cylinder.x" );
// reference to a cone mesh
pConeMesh
= graphics.GetMeshResource( L"cone.x" );
.
// init matrix stack for xform
draw
_
helper.PushModelTransform();
.
cylinder
_
xform.SetScale( ... );
// set up xform for the cylinder
.
// to represent the arrow body
cylinder
_
xform.SetUpModelStack( ... );
// load the xform into WORLD matrix
pCylinderMesh->DrawMesh(... );
C:
// Draw the cylinder
draw
_
helper.PopModelTransform();
.
// init matrix stack for xform
draw
_
helper.PushModelTransform();
.
cone
_
xform.SetScale( ... );
D:
// set up xform for the cone
.
// to represent the arrow head
cone
_
xform.SetUpModelStack( ... );
// load the xform into WORLD matrix
pConeMesh->DrawMesh( ... );
// Draw the cone
draw
_
helper.PopModelTransform();
.
Listing 16.5.
3D arrow primitive.
Search WWH ::
Custom Search