< Zurück | Inhalt | Weiter >

8.7 Morph

java.lang.Object

|

+−−javax.media.j3d.SceneGraphObject

|

+−−javax.media.j3d.Node

|

+−−javax.media.j3d.Leaf

|

+−−javax.media.j3d.Morph


The Morph Node is similar to a normal Shape3D Node except that is can have multiple

GeometryArray objects associated with it. You can therefore put four versions of the same geometry into a

Morph object and progressively morph between them by adjusting the weights associated with each

GeometryArray.


Table 8.2 shows the coordinates for the first point from four GeometryArrays, along with the weight for each. First, each coordinate is multiplied by the weight of its GeometryArray, and then the sum of all weighted coordinates is taken as the resulting coordinate.


Table 8.2 Example of morphing using four weighted points


GeometryArray

Weight

X

Y

Z

W x X

W x Y

W x Z

1

0.5

10

10

0

5

5

0

2

0.25

20

5

0

5

1.25

0

3

0.125

–5

–10

0

–0.625

–1.25

0

4

0.125

–10

–2

0

–1.25

–0.25

0

Resulting Point





8.125

4.75

0

Note that the sum of the GeometryArray weights should equal 1.


As you would expect, there has to be a one−to−one correspondence between the points in each GeometryArray. There is no feature information, so Java 3D merely uses the indices of each coordinate in the array to compute the resulting coordinates. In addition, all the GeometryArrays must have the same vertex format, the GeometryArrays must be of the same type, and must have comparable texture coordinate specifications.


Please refer to the Sun Java 3D Morphing example to see the Morph Node in action.