Articulation and Mesh DeformationAn alternative to building a figure from articulated shapes is to create a single mesh (e.g., by using Java 3D's GeometryArray). Mesh deformation can be significantly optimized if carried out by reference, where the mesh data is stored in an array maintained by the program, rather than as part of the scene graph. The array can be modified without the overhead of scene graph accesses, and the on-screen representation is updated by calls to GeometryArray's updateData( ) method. The standard Java 3D demos contain an example, in the directory GeometryByReference/, showing how the shape and color of an object can be changed in this manner. I discuss geometry referencing in Chapter 21, in relation to particle systems. j3d.org has a small mesh deformation demo, written by Leyland Needham, which bends a cylinder like a human arm (http://www.j3d.org/utilities/bones.html). The code gradually updates the cylinder mesh to achieve its effect. Alessandro Borges is planning to add similar mesh deformation elements to his Ana system (http://planeta.terra.com.br/educacao/alessandroborges/ana/bone.html). |