Graphics Reference
In-Depth Information
class CPalm : public UWB _ SceneNode {
Source file. Palm.h/cpp files
in the Model folder of the
D3D _ SceneNodeArm project.
A:
Palm( vec3 at, const char * name = "Palm");
.
}
CPalm::CPalm( vec3 at, const char * name) : UWB _ SceneNode(name)
// Pivot of M p is 1 unit in X from the Palm location
m _ xform.SetPivot( vec3 (at.x-1,at.y,0.0f));
// memory for C p 0
B:
UWB _ PrimitiveCircle * pCircle = new UWB _ PrimitiveCircle();
// set C p 0 geomtry based on at position
.
// Memory for a PrimitiveList
C:
UWB _ PrimitiveList * pPalmPrim = new UWB _ PrimitiveList();
// insert C p 0 into the list
pPalmPrim->Append(pCircle);
// m _ pPrimitive is a PrimitiveList
D:
E:
SetPrimitive(pPalmPrim);
.
Listing 11.6. The CPalm class of Tutorial 11.4.
of the constructor at label B, the at position is used to define the pivot position of
the transform. Referring to Figure 11.3, the pivot position of the palm P p is 1 unit
to the left of the center of the circle C p 0 . At label C, the circle C p 0 is allocated and
initialized based on the values of at .
Recall from Section 7.6 that we have defined the PrimitiveList to be a
subclass of the Primitive class. For this reason, the m _ pPrimitive pointer
of SceneNode can also reference a PrimitiveList (list of primitives). In List-
ing 11.6 at label D, a PrimitiveList object is allocated to contain the C p 0 circle,
and at label E the list is set to be a primitive of the CPalm class. Listing 11.7 shows
the definition and implementation of the CArm class. As in the case of the CPalm
class, we only need to support the constructor of the CArm class (at label A). Once
again, the first parameter of the constructor allows the arm to be at any location.
The implementation of the constructor corresponds to that of the CPalm ,where
the transformation pivot (at label B) and the R a 0 geometry (at label C) are both
defined with respect to the at position. Once again, a list is created for R a 0 to rep-
resent the primitive of CArm (at labels D and E). Finally, at label F, a CPalm object
Search WWH ::




Custom Search