Advertisement
waelwindows92

Untitled

Nov 21st, 2020
1,323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 1.18 KB | None | 0 0
  1. pub struct A3da {
  2.     pub camera_root: Vec<CameraRoot>,
  3. }
  4.  
  5. #[derive(Debug, Default)]
  6. pub struct CameraRoot {
  7.     pub interest: ModelTransform,
  8.     pub model_transform: ModelTransform,
  9.     pub view_point: ViewPoint,
  10. }
  11.  
  12. #[derive(Debug, Default)]
  13. pub struct ViewPoint {
  14.     is_horizontal_fov: bool,
  15.     aspect: Option<f32>,
  16.     camera_aperture_h: Option<f32>,
  17.     camera_aperture_v: Option<f32>,
  18.     fov: Key,
  19.     roll: Key,
  20.     focal_length: Key,
  21.     pub model_transform: ModelTransform,
  22. }
  23.  
  24. #[derive(Debug, Default)]
  25. pub struct ModelTransform {
  26.     pub scale: Vec3<Key>,
  27.     pub rotation: Vec3<Key>,
  28.     pub translation: Vec3<Key>,
  29.     pub visiblity: Key,
  30. }
  31.  
  32. ///Generic keyframe
  33. #[derive(Debug)]
  34. pub enum Key {
  35.     None,
  36.     Pose(f32),
  37.     Mode34(Vec<SmoothKeyframe>),
  38. }
  39.  
  40. ///Keyframe with hermite interpolation
  41. #[derive(Debug, Default)]
  42. pub struct SmoothKeyframe {
  43.     pub frame: f32,
  44.     pub value: f32,
  45.     pub tangent_1: f32,
  46.     pub tangent_0: f32,
  47. }
  48.  
  49. impl Default for Key {
  50.     fn default() -> Self {
  51.         Self::None
  52.     }
  53. }
  54.  
  55. ///A 3D vector of T
  56. #[derive(Debug, Default)]
  57. pub struct Vec3<T>{
  58.     pub x: T,
  59.     pub y: T,
  60.     pub z: T,
  61. }
  62.  
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement