[][src]Macro bvh_anim::bvh

macro_rules! bvh {
    () => { ... };
    (
        HIERARCHY
        MOTION
    ) => { ... };
    (
        HIERARCHY
        MOTION
        Frames: 0
    ) => { ... };
    (
        HIERARCHY
        MOTION
        Frames: 0
        Frame Time: $frame_time:literal
    ) => { ... };
    (
        HIERARCHY
        ROOT $root_name:ident
        {
            $( $joints:tt )*
        }
        MOTION
        Frames: 0
        Frame Time: $frame_time:literal
    ) => { ... };
    (
        HIERARCHY
        ROOT $root_name:ident
        {
            $( $joints:tt )*
        }
        MOTION
        Frames: $num_frames:literal
        Frame Time: $frame_time:literal
        $(
            $motion:literal
        )+
    ) => { ... };
}

Create a new Bvh object using a macro literal. Useful for testing.

Notes

If you have a very complex Bvh file with a large number of joints and frames, then this macro will scale badly to it, and compilation time will suffer.

Example

let simple_skeleton = bvh! {
    HIERARCHY
    ROOT Base
    {
        OFFSET 0.0 0.0 0.0
        CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
        JOINT Middle1
        {
            OFFSET 0.0 0.0 15.0
            CHANNELS 3 Zrotation Xrotation Yrotation
            JOINT Tip1
            {
                OFFSET 0.0 0.0 30.0
                CHANNELS 3 Zrotation Xrotation Yrotation
                End Site
                {
                    OFFSET 0.0 0.0 45.0
                }
            }
        }
        JOINT Middle2
        {
            OFFSET 0.0 15.0 0.0
            CHANNELS 3 Zrotation Xrotation Yrotation
            JOINT Tip2
            {
                OFFSET 0.0 30.0 0.0
                CHANNELS 3 Zrotation Xrotation Yrotation
                End Site
                {
                    OFFSET 0.0 45.0 0.0
                }
            }
        }
    }

    MOTION
    Frames: 3
    // Time in seconds.
    Frame Time: 0.033333333333
    0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
    1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0
    2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0
};

You can use the bvh macro to create empty Bvh instances:

let empty = bvh!{};

let empty = bvh! {
    HIERARCHY
    MOTION
};

let empty = bvh! {
    HIERARCHY
    MOTION
    Frames: 0
};