pub struct M2Camera {
pub camera_type: u32,
pub fov: f32,
pub far_clip: f32,
pub near_clip: f32,
pub position_animation: M2AnimationBlock<C3Vector>,
pub position_base: C3Vector,
pub target_position_animation: M2AnimationBlock<C3Vector>,
pub target_position_base: C3Vector,
pub roll_animation: M2AnimationBlock<f32>,
pub id: u32,
pub flags: M2CameraFlags,
}Expand description
Represents a camera in an M2 model
Camera structure layout:
- Pre-WotLK (version < 264): 124 bytes
- type(4) + fov/far/near(12) + pos_track(28) + pos_base(12)
-
- target_track(28) + target_base(12) + roll_track(28)
- WotLK+ (version >= 264): 108 bytes
- type(4) + fov/far/near(12) + pos_track(20) + pos_base(12)
-
- target_track(20) + target_base(12) + roll_track(20) + id(4) + flags(2) + pad(2)
Fields§
§camera_type: u32Camera type (0=portrait, 1=character info, -1=default)
fov: f32Field of view (in radians)
far_clip: f32Far clip distance
near_clip: f32Near clip distance
position_animation: M2AnimationBlock<C3Vector>Camera position animation
position_base: C3VectorCamera position base (default position when not animated)
target_position_animation: M2AnimationBlock<C3Vector>Target position animation
target_position_base: C3VectorTarget position base (default target when not animated)
roll_animation: M2AnimationBlock<f32>Roll animation (rotation around the view axis)
id: u32Camera ID (WotLK+ only)
flags: M2CameraFlagsCamera flags (WotLK+ only)
Implementations§
Source§impl M2Camera
impl M2Camera
Sourcepub fn parse<R: Read + Seek>(reader: &mut R, version: u32) -> Result<Self>
pub fn parse<R: Read + Seek>(reader: &mut R, version: u32) -> Result<Self>
Parse a camera from a reader based on the M2 version
Camera structure varies by version:
- Pre-WotLK (< 264): 124 bytes - header + tracks + base values (no id/flags)
- WotLK+ (>= 264): 108 bytes - smaller tracks + id/flags
Sourcepub fn write<W: Write>(&self, writer: &mut W, version: u32) -> Result<()>
pub fn write<W: Write>(&self, writer: &mut W, version: u32) -> Result<()>
Write a camera to a writer based on the M2 version
Trait Implementations§
Auto Trait Implementations§
impl Freeze for M2Camera
impl RefUnwindSafe for M2Camera
impl Send for M2Camera
impl Sync for M2Camera
impl Unpin for M2Camera
impl UnwindSafe for M2Camera
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more