##### Ninja Library - Motion Function

# njCnkDrawShapeMotionLink

Links motion with shape

### FORMAT

`

  void njCnkDrawShapeMotionLink( *object, *motionlink, *shapelink, frame )
  NJS_CNK_OBJECT *object
  NJS_MOTION_LINK *motionlink
  NJS_MOTION_LINK *shapelink
  Float frame

`

### PARAMETER

  `*object` | Pointer to object structure
  `*motionlink` | Pointer to motion link structure
  `*shapelink` | Pointer to motion link structure (apex animation)
  `frame` | Frame number (between 0 and 1)

### RETURN

  None

### DESCRIPTION

  Links two motion structures.

  The motion link structure contains two motion frames, from the link source and link target. When the parameter frame is 0, the motion is of the source frame, and when it is 1, the motion is of the link target frame. Other frames (0 < ff < 1) are interpolated. The same applies for shape (apex animation).

  Apex types suitable for apex animation are listed below.

  Apex | NJD_CV, NJD_CV_D8, NJD_CV_UF, NJD_CV_NF, NJD_CV_S5, NJD_CV_S4, NJD_CV_IN
  Apex/normal vector | NJD_CV_VN, NJD_CV_VN_D8, NJD_CV_VN_UF, NJD_CV_VN_NF, NJD_CV_VN_S5, NJD_CV_VN_S4, NJD_CV_VN_IN

  Spline interpolation is applied only to the apex in motion; interpolation between motions is linear. In the basic model, however, spline interpolation is applied.

### EXAMPLE

      #include <Shinobi.h>
      #define	OBJECT	object_sample
      #define	MOTION1	motion_sample1 /* Entered in NAM file */
      #define	MOTION2	motion_sample2 /* Entered in NAM file */
      #define	SHAPE1	shape_sample1 /* Entered in NAS file */
      #define	SHAPE2	shape_sample2 /* Entered in NAS file */
      #define	STEPS	60
      	:
      #define	VERTEX_NUM	600	/* Maximum model's verteices */
      #define	TYPE_VN	6	/* vertex(3) + normal(3) */
      #define	HEADER_NUM	2
      #define	NUM	(VERTEX_NUM * TYPE_VN + HEADER_NUM)
      extern NJS_MOTION	MOTION1[];
      extern NJS_MOTION	MOTION2[];
      extern NJS_MOTION	SHAPE1[];
      extern NJS_MOTION	SHAPE2[];
      extern NJS_CNK_OBJECT	OBJECT[];
      NJS_MOTION_LINK	motionlink;
      NJS_MOTION_LINK	shapelink;
      Float	sbuf[NUM * 3];
      	:
      njInitShape(sbuf);
      	:
      motionlink.motion[0] = MOTION1;/* Link source */
      motionlink.motion[1] = MOTION2;/* Link target */
      shapelink.motion[0] = SHAPE1;/* Link source */
      shapelink.motion[1] = SHAPE2;/* Link target */
      /* Interpolate from last frame of MOTION1 to 1.5 frames of MOTION2 */
      motionlink.frame[0] =
      shapelink.frame[0] = MOTION1->nbFrame-1;
      motionlink.frame[1] =
      shapelink.frame[1] = 1.5;
      	:
      njCnkDrawShapeMotionLink( OBJECT, &motionlink, &shapelink, ff/STEPS );
      /* Frame specifies 0 - 1 */
      ff+=0.2f;
      if( ff >= STEPS - 1 ) ff=0.f;
      	:

### NOTE

  This is a motion link with shape for chunk object structure.

### REFERENCE

  `njInitShape()
  njCnkDrawObject()
  njCnkDrawMotion()
  njCnkDrawMotionLink()
  `

njCnkDrawShapeMotionLink

COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999