[−][src]Struct bvh_anim::Bvh
A complete bvh
file.
See the module documentation for more information.
Methods
impl Bvh
[src]
pub unsafe fn from_ffi(bvh: bvh_BvhFile) -> Result<Self, ()>
[src]
Construct a Bvh
from a ffi::bvh_BvhFile
.
Notes
This method is only present if the ffi
feature is enabled.
Safety
This operation is unsafe because bvh
may point to memory not
allocated by the rust allocator, which may cause memory errors.
In addition, this method will take ownership of memory which was
owned by bvh
, which may cause corruption if there are still
references to bvh
's data.
pub fn into_ffi(self) -> bvh_BvhFile
[src]
Converts the Bvh
into a ffi::bvh_BvhFile
, using the default
bvh_AllocCallback
s.
Notes
This method is only present if the ffi
feature is enabled.
pub fn into_ffi_with_allocator(
self,
bvh_allocator: bvh_AllocCallbacks,
joints_allocator: bvh_AllocCallbacks
) -> Result<bvh_BvhFile, ()>
[src]
self,
bvh_allocator: bvh_AllocCallbacks,
joints_allocator: bvh_AllocCallbacks
) -> Result<bvh_BvhFile, ()>
Converts the Bvh
into a ffi::bvh_BvhFile
, using the given allocator callbacks
to allocate memory.
Notes
This method is only present if the ffi
feature is enabled.
If both allocators are the default allocators, this method will use the rust allocator, and will move the pointers over without copying them.
impl Bvh
[src]
pub fn new() -> Self
[src]
Create an empty Bvh
.
pub fn from_bytes<B: AsRef<[u8]>>(bytes: B) -> Result<Self, LoadError>
[src]
Parse a sequence of bytes as if it were an in-memory Bvh
file.
Examples
let bvh_string = br#" HIERARCHY ROOT Hips { OFFSET 0.0 0.0 0.0 CHANNELS 3 Xposition Yposition Zposition End Site { OFFSET 0.0 0.0 0.0 } } MOTION Frames: 1 Frame Time: 0.033333333 0.0 0.0 0.0 "#; let bvh = Bvh::from_bytes(&bvh_string[..])?;
pub fn from_reader<R: BufReadExt>(reader: R) -> Result<Self, LoadError>
[src]
Loads the Bvh
from the reader
.
pub fn write_to<W: Write>(&self, writer: &mut W) -> Result<()>
[src]
Writes the Bvh
using the bvh
file format to the writer
, with
the default formatting options.
Notes
To customise the formatting, see the WriteOptions
type.
Examples
let bvh = bvh! { // fields unspecified }; let mut out_file = File::create("./out_file.bvh")?; bvh.write_to(&mut out_file)?;
pub fn to_bstring(&self) -> BString
[src]
Writes the Bvh
using the bvh
file format into a BString
with
the default formatting options.
Notes
To customise the formatting, see the WriteOptions
type.
pub fn root_joint(&self) -> Option<Joint>
[src]
Returns the root joint if it exists, or None
if the skeleton is empty.
Examples
let bvh = Bvh::new(); assert!(bvh.root_joint().is_none()); let bvh = bvh! { HIERARCHY ROOT Hips { // Joints... } MOTION // Frames... }; assert!(bvh.root_joint().is_some());
ⓘImportant traits for Joints<'a>pub fn joints(&self) -> Joints
[src]
Returns an iterator over all the Joint
s in the Bvh
.
ⓘImportant traits for JointsMut<'a>pub fn joints_mut(&mut self) -> JointsMut
[src]
Returns a mutable iterator over all the joints in the Bvh
.
ⓘImportant traits for Frames<'a>pub fn frames(&self) -> Frames
[src]
Returns a Frames
iterator over the frames of the bvh.
ⓘImportant traits for FramesMut<'a>pub fn frames_mut(&mut self) -> FramesMut
[src]
Returns a mutable iterator over the frames of the bvh.
pub fn get_motion(&self, frame: usize, channel: &Channel) -> f32
[src]
Gets the motion value at frame
and Channel
.
Panics
This method will panic if frame
is greater than self.num_frames()
.
pub fn try_get_motion(&self, frame: usize, channel: &Channel) -> Option<f32>
[src]
Returns the motion value at frame
and channel
if they are in bounds,
None
otherwise.
pub fn set_motion(&mut self, frame: usize, channel: &Channel, new_motion: f32)
[src]
Updates the motion
value at frame
and channel
to new_motion
.
Panics
This method will panic if frame
is greater than self.num_frames()
.
pub fn try_set_motion<'a>(
&mut self,
frame: usize,
channel: &'a Channel,
new_motion: f32
) -> Result<(), SetMotionError<'a>>
[src]
&mut self,
frame: usize,
channel: &'a Channel,
new_motion: f32
) -> Result<(), SetMotionError<'a>>
Updates the motion
value at frame
and channel
to new_motion
.
Notes
Returns Ok(())
if the motion
value was successfully set, and Err(_)
if
the operation was out of bounds.
pub const fn num_frames(&self) -> usize
[src]
Get the number of frames in the Bvh
.
pub const fn num_channels(&self) -> usize
[src]
Get the number of channels in the Bvh
.
pub const fn frame_time(&self) -> &Duration
[src]
Get the duration each frame should play for in the Bvh
.
pub fn set_frame_time(&mut self, new_frame_time: Duration)
[src]
Set the duration each frame should play for in the Bvh
to new_frame_time
.
Trait Implementations
impl PartialEq<Bvh> for Bvh
[src]
impl Default for Bvh
[src]
impl Clone for Bvh
[src]
fn clone(&self) -> Bvh
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<Bvh> for bvh_BvhFile
[src]
impl Display for Bvh
[src]
impl Debug for Bvh
[src]
impl<'_> TryFrom<&'_ str> for Bvh
[src]
type Error = LoadError
The type returned in the event of a conversion error.
fn try_from(string: &str) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ BStr> for Bvh
[src]
type Error = LoadError
The type returned in the event of a conversion error.
fn try_from(string: &BStr) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ [u8]> for Bvh
[src]
type Error = LoadError
The type returned in the event of a conversion error.
fn try_from(bytes: &[u8]) -> Result<Self, Self::Error>
[src]
impl FromStr for Bvh
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,