Graphics Reference
In-Depth Information
The XAML for the lower leg—with the joint transformation in effect to bend
the knee—now appears as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!- Construct the lower-leg composite (same XAML shown earlier) ->
<Model3DGroup x:Name= "LowerLeg" >
<Model3DGroup.Transform>
<!-- Joint transform for the knee -->
<RotateTransform3D CenterX= "0" CenterY= "50" CenterZ= "0" >
<RotateTransform3D.Rotation>
<AxisAngleRotation3D x:Name= "KneeJointAngle" Angle= "37" Axis= "1 0 0" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
</Model3DGroup.Transform>
<GeometryModel3D Geometry= "{StaticResource RSRCmeshFoot}" Material=... />
<GeometryModel3D Geometry= "{StaticResource RSRCmeshShin}" Material=... >
<GeometryModel3D.Transform>
<TranslateTransform3D OffsetY= "14" />
</GeometryModel3D.Transform>
</GeometryModel3D>
</Model3DGroup>
Manipulation of the joint's rotation amount can be performed by procedural
code, or by the declarative animation features introduced in Section 2.5.1.
6.6.4 Reuse of Components
With our leg designed, let's move up one more level and consider how we might
compose the entire camel. The leg is the first component that is going to be multi-
ply instantiated into its parent. Reusing components is fundamental to hierarchical
modeling; however, there are two types of reuse, each achieving different goals
and appropriate for different scenarios.
First, consider a scenario in which we must show the camel walking or gallop-
ing in a realistic way. To achieve this, we need to be able to individually control
the amount of rotation at each of the four hip joints and each of the four knee
joints. To achieve hip and knee rotation, we construct the camel as a tree of nodes,
with each node being used only once, as shown in Figure 6.49. Thus, there are
four hip joints and four knee joints, each independently manipulable.
Is any “reuse” going on in this model? Well, you could say that we are reusing
the design of the leg, since the model has four copies of the leg component hier-
archy we designed above. But there is no reuse of the actual components in the
constructed model. The front-left leg is a tree of components dedicated to repre-
senting only the front-left leg; there is a completely independent tree of compo-
nents for each of the four legs. The advantage of this approach is that each leg is
independent of the others, and the effect of manipulating one leg's joints is limited
in scope to just that leg.
It is useful to search a model for rigid subcomponents that do not have any
internal joints; they are candidates for being extracted and turned into reusable
components. In the model discussed above, the lower-leg component is indeed
rigid, because our design does not include an ankle joint that would allow the
foot to rotate relative to the shin. Thus, we can reuse the lower-leg component
hierarchy without any loss of animation flexibility, by constructing the camel using
the structure shown in Figure 6.50. Here, our model is no longer a tree—it is a
directed acyclic graph (DAG) now that component reuse is in effect; this topology
is the reason this kind of structure is known as a “scene graph.”
 
 
 
Search WWH ::




Custom Search