<!-- cas.dtd

    2009-10-06
    This is CAS 2.1.  It supersedes CAS 2.0, which has been the
    version in use since 2004.

    "CAS" == Character Animation Stream, for JASinging avatars.
-->


<!--  ENTITY definitions (used in ATTLIST specs. below).  -->

<!--  %locattribs;  %quaternionattribs;
The CDATA values should be parsable as floating point numbers.
-->
<!ENTITY % locattribs
   "x    CDATA     #REQUIRED
    y    CDATA     #REQUIRED
    z    CDATA     #REQUIRED"
>

<!ENTITY % quaternionattribs
   "%locattribs;
    w    CDATA     #REQUIRED"
>


<!--  ELEMENT and ATTLIST definitions (from the top down).  -->

<!--  CAS:
version is just a number, currently 2.1.
avatar is no longer an enumeration: any name valid in the context is
acceptable.
-->
<!ELEMENT CAS  ( frames )>
<!ATTLIST CAS
    version   CDATA   #REQUIRED
    avatar    CDATA   #REQUIRED
>

<!--  frames:
The frames element contains all the animation's frames, which may
optionally be segmented into a sequence of signs.  This segmentation
is achieved by means of enclosed signStart elements, each of which
marks the start of the next sign.  If the animation is not explicitly
segmented into frames, it is treated as a single sign with gloss
"unknown".

Note that the first frame in an animation is treated differently from
all its successors; see below under frame for details.

count is the total number of frames.

signCount is the number of signs, i.e. the number of enclosed
signStart elements; if it is omitted, the animation is assumed to
consist of a single sign and there should be either a single initial
enclosed signStart or none at all.
-->
<!ELEMENT frames  ( signStart?, frame* )* >
<!ATTLIST frames
    count     CDATA   #REQUIRED
    signCount CDATA   #IMPLIED
>

<!--  signStart:
As described above under frames, a signStart element marks the start
of a new sign.

index is a non-negative integer value giving the sign's sequence number
(starting from 0); it is intended primarily as an aid to the human
reader and may be omitted but if present it must be correct.

gloss is the sign's gloss name.
-->
<!ELEMENT signStart  EMPTY>
<!ATTLIST signStart
    index   CDATA   #IMPLIED
    gloss   CDATA   #REQUIRED
>

<!--  frame:
The frame element defines the morph and bone values for a frame,
either completely explicitly, or (except in the case of the initial
frame, which is required to be complete) by defining values only for
those morphs whose values differ from 0 and for those bones whose values
differ from their values in the preceding frame.

If this frame is the initial frame of the entire animation, its
isComplete attribute must be "true", that is, it must enclose explicit
entries for all of the given avatar's bones and morphs.
The initial frame's boneCount and morphCount attributes are taken to
define sizes of, respectively, this avatar's bone and morph sets, and
the relative ordering of the enclosed bone elements is taken to define
the index numbers to be used for the avatar's bone set throughout the
animation.
(Each bone and morph is identified ultimately by its FourCC tag.)

index is a non-negative integer value giving the frame's sequence number
(starting from 0) within the entire animation; it is intended solely as
an aid to the human reader and may be omitted.

isComplete indicates whether this frame contains definitions for all
the given avatar's bones and morphs; it must be true for the initial
frame of the animation; if it is false the frame may contain incomplete
sets of definitions: typically, a bone is included only if its value
differs from its value in the previous frame, and a morph is included
only if its value differs from 0.

time must be parsable as a floating point number, representing the
frame's timestamp in milliseconds, that is, its intended display time
relative to the start of the animation.  So in the initial frame its
value must be 0 and in every other frame its value must be the sum of
the previous frame's time and duration values.

duration must be parsable as a floating point number, representing the
time in milliseconds for which this frame is intended to be displayed,
that is, the difference between the timestamps of the following frame
(actual or notional) and this one.

morphCount is the number of enclosed morph elements provided for this
frame.  As described above, for the initial frame of the animation this
is also the size of the avatar's morph set.

boneCount is the number of enclosed bone elements provided for this
frame.  As described above, for the initial frame of the animation this
is also the size of the avatar's bone set.
-->
<!ELEMENT frame  ( morph | bone )* >
<!ATTLIST frame
    index       CDATA              #IMPLIED
    isComplete  ( true | false )   "false"
    time        CDATA              #REQUIRED
    duration    CDATA              #REQUIRED
    morphCount  CDATA              #REQUIRED
    boneCount   CDATA              #REQUIRED
>

<!-- morph:
Defines the amount of a morph required in the enclosing frame.
Except in the case of the initial frame of the animation a morph
entry may be omitted if its amount is 0.

name is the FourCC tag identifying this morph.

amount must be parsable as a floating point number, and represents
the amount of the morph in the enclosing frame.
-->
<!ELEMENT morph  EMPTY>
<!ATTLIST morph
    name        CDATA   #REQUIRED
    amount      CDATA   #REQUIRED
>

<!-- bone:
Defines the position and orientation of a bone w.r.t. the coordinate
frame of its parent in the avatar's bones hierarchy.
Except in the case of the initial frame of the animation a bone
entry may be omitted if the bone's position and rotation values are
unchanged w.r.t. the previous frame.

name is the FourCC tag identifying this bone.

index is the index value for this bone; if the bone belongs to a
completely specified frame, then it is optional; otherwise it is
required.  When present it must be correct, that is, the associated
FourCC name must match that assigned to this index in the
initial frame of the animation, and if the bone belongs to a completely
specified frame the index must correctly reflect the bone's position
in the bone sequence of the enclosing frame.
-->
<!ELEMENT bone  ( position, qRotation )>
<!ATTLIST bone
    name        CDATA   #REQUIRED
    index       CDATA   #IMPLIED
>

<!-- position:
A vector representing the position/translation of a bone, that is,
of the origin of its coordinate frame w.r.t. that of its parent.
-->
<!ELEMENT position  EMPTY>
<!ATTLIST position
    %locattribs;
>

<!-- qRotation:
A quaternion representing the rotation of a bone w.r.t. the coordinate
frame of it's parent.
-->
<!ELEMENT qRotation  EMPTY>
<!ATTLIST qRotation
    %quaternionattribs;
>


<!--  END cas.dtd  -->
