Initial commit
This commit is contained in:
commit
8ab8cdedbd
10 changed files with 704 additions and 0 deletions
270
examples/listener.rs
Normal file
270
examples/listener.rs
Normal file
|
@ -0,0 +1,270 @@
|
|||
use live_link_face::{LiveLinkFace, FaceBlendShape};
|
||||
use std::io::{prelude::*, stdout};
|
||||
use std::net::UdpSocket;
|
||||
|
||||
fn main() -> std::io::Result<()> {
|
||||
let socket = UdpSocket::bind("[::]:3000")?; // for UDP4/6
|
||||
let mut buf = [0; 1024];
|
||||
|
||||
loop {
|
||||
// Receives a single datagram message on the socket.
|
||||
// If `buf` is too small to hold
|
||||
// the message, it will be cut off.
|
||||
let (amt, _src) = socket.recv_from(&mut buf)?;
|
||||
|
||||
// Redeclare `buf` as slice of the received data
|
||||
// and send data back to origin.
|
||||
let buf = &mut buf[..amt];
|
||||
let face = LiveLinkFace::decode(buf);
|
||||
shitty_print(face.1);
|
||||
}
|
||||
}
|
||||
|
||||
fn shitty_print(face_data: LiveLinkFace) {
|
||||
print!("{}[2J", 27 as char);
|
||||
stdout().flush().unwrap();
|
||||
println!(
|
||||
"EyeBlinkLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeBlinkLeft)
|
||||
);
|
||||
println!(
|
||||
"EyeLookDownLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeLookDownLeft)
|
||||
);
|
||||
println!(
|
||||
"EyeLookInLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeLookInLeft)
|
||||
);
|
||||
println!(
|
||||
"EyeLookOutLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeLookOutLeft)
|
||||
);
|
||||
println!(
|
||||
"EyeLookUpLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeLookUpLeft)
|
||||
);
|
||||
println!(
|
||||
"EyeSquintLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeSquintLeft)
|
||||
);
|
||||
println!(
|
||||
"EyeWideLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeWideLeft)
|
||||
);
|
||||
println!(
|
||||
"EyeBlinkRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeBlinkRight)
|
||||
);
|
||||
println!(
|
||||
"EyeLookDownRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeLookDownRight)
|
||||
);
|
||||
println!(
|
||||
"EyeLookInRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeLookInRight)
|
||||
);
|
||||
println!(
|
||||
"EyeLookOutRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeLookOutRight)
|
||||
);
|
||||
println!(
|
||||
"EyeLookUpRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeLookUpRight)
|
||||
);
|
||||
println!(
|
||||
"EyeSquintRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeSquintRight)
|
||||
);
|
||||
println!(
|
||||
"EyeWideRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::EyeWideRight)
|
||||
);
|
||||
println!(
|
||||
"JawForward: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::JawForward)
|
||||
);
|
||||
println!(
|
||||
"JawLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::JawLeft)
|
||||
);
|
||||
println!(
|
||||
"JawRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::JawRight)
|
||||
);
|
||||
println!(
|
||||
"JawOpen: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::JawOpen)
|
||||
);
|
||||
println!(
|
||||
"MouthClose: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthClose)
|
||||
);
|
||||
println!(
|
||||
"MouthFunnel: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthFunnel)
|
||||
);
|
||||
println!(
|
||||
"MouthPucker: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthPucker)
|
||||
);
|
||||
println!(
|
||||
"MouthLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthLeft)
|
||||
);
|
||||
println!(
|
||||
"MouthRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthRight)
|
||||
);
|
||||
println!(
|
||||
"MouthSmileLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthSmileLeft)
|
||||
);
|
||||
println!(
|
||||
"MouthSmileRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthSmileRight)
|
||||
);
|
||||
println!(
|
||||
"MouthFrownLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthFrownLeft)
|
||||
);
|
||||
println!(
|
||||
"MouthFrownRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthFrownRight)
|
||||
);
|
||||
println!(
|
||||
"MouthDimpleLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthDimpleLeft)
|
||||
);
|
||||
println!(
|
||||
"MouthDimpleRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthDimpleRight)
|
||||
);
|
||||
println!(
|
||||
"MouthStretchLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthStretchLeft)
|
||||
);
|
||||
println!(
|
||||
"MouthStretchRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthStretchRight)
|
||||
);
|
||||
println!(
|
||||
"MouthRollLower: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthRollLower)
|
||||
);
|
||||
println!(
|
||||
"MouthRollUpper: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthRollUpper)
|
||||
);
|
||||
println!(
|
||||
"MouthShrugLower: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthShrugLower)
|
||||
);
|
||||
println!(
|
||||
"MouthShrugUpper: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthShrugUpper)
|
||||
);
|
||||
println!(
|
||||
"MouthPressLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthPressLeft)
|
||||
);
|
||||
println!(
|
||||
"MouthPressRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthPressRight)
|
||||
);
|
||||
println!(
|
||||
"MouthLowerDownLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthLowerDownLeft)
|
||||
);
|
||||
println!(
|
||||
"MouthLowerDownRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthLowerDownRight)
|
||||
);
|
||||
println!(
|
||||
"MouthUpperUpLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthUpperUpLeft)
|
||||
);
|
||||
println!(
|
||||
"MouthUpperUpRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::MouthUpperUpRight)
|
||||
);
|
||||
println!(
|
||||
"BrowDownLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::BrowDownLeft)
|
||||
);
|
||||
println!(
|
||||
"BrowDownRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::BrowDownRight)
|
||||
);
|
||||
println!(
|
||||
"BrowInnerUp: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::BrowInnerUp)
|
||||
);
|
||||
println!(
|
||||
"BrowOuterUpLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::BrowOuterUpLeft)
|
||||
);
|
||||
println!(
|
||||
"BrowOuterUpRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::BrowOuterUpRight)
|
||||
);
|
||||
println!(
|
||||
"CheekPuff: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::CheekPuff)
|
||||
);
|
||||
println!(
|
||||
"CheekSquintLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::CheekSquintLeft)
|
||||
);
|
||||
println!(
|
||||
"CheekSquintRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::CheekSquintRight)
|
||||
);
|
||||
println!(
|
||||
"NoseSneerLeft: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::NoseSneerLeft)
|
||||
);
|
||||
println!(
|
||||
"NoseSneerRight: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::NoseSneerRight)
|
||||
);
|
||||
println!(
|
||||
"TongueOut: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::TongueOut)
|
||||
);
|
||||
println!(
|
||||
"HeadYaw: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::HeadYaw)
|
||||
);
|
||||
println!(
|
||||
"HeadPitch: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::HeadPitch)
|
||||
);
|
||||
println!(
|
||||
"HeadRoll: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::HeadRoll)
|
||||
);
|
||||
println!(
|
||||
"LeftEyeYaw: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::LeftEyeYaw)
|
||||
);
|
||||
println!(
|
||||
"LeftEyePitch: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::LeftEyePitch)
|
||||
);
|
||||
println!(
|
||||
"LeftEyeRoll: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::LeftEyeRoll)
|
||||
);
|
||||
println!(
|
||||
"RightEyeYaw: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::RightEyeYaw)
|
||||
);
|
||||
println!(
|
||||
"RightEyePitch: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::RightEyePitch)
|
||||
);
|
||||
println!(
|
||||
"RightEyeRoll: {}",
|
||||
face_data.get_blendshape(FaceBlendShape::RightEyeRoll)
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue