pub struct GltfTranscoder { /* private fields */ }Expand description
Passthrough glTF transcoder.
Compresses geometry with Draco while preserving all other data unchanged.
Implementations§
Source§impl GltfTranscoder
impl GltfTranscoder
Sourcepub fn new(config: TranscoderConfig) -> Self
pub fn new(config: TranscoderConfig) -> Self
Create a new transcoder with the given configuration.
Sourcepub fn transcode_to_glb(
&self,
input: &[u8],
) -> Result<(Vec<u8>, Vec<String>), Error>
pub fn transcode_to_glb( &self, input: &[u8], ) -> Result<(Vec<u8>, Vec<String>), Error>
Transcode GLB input to GLB output.
Sourcepub fn transcode_to_file(
&self,
input: &[u8],
output_path: &Path,
) -> Result<Vec<String>, Error>
pub fn transcode_to_file( &self, input: &[u8], output_path: &Path, ) -> Result<Vec<String>, Error>
Transcode GLB input and write to a file.
Output format is determined by file extension (.glb or .gltf).
Examples found in repository?
examples/gltf.rs (line 19)
4fn main() {
5 // input file
6 let input_path = "input.glb";
7
8 // output file
9 let output_path = "output.glb";
10
11 // Read input file
12 let input = std::fs::read(input_path).expect("Failed to read input file");
13
14 // Create transcoder with default options
15 let transcoder = GltfTranscoder::default();
16
17 // Transcode and write to file
18 let warnings = transcoder
19 .transcode_to_file(&input, Path::new(output_path))
20 .expect("Transcoding failed");
21
22 // Print any warnings
23 for warning in warnings {
24 println!("Warning: {}", warning);
25 }
26
27 println!("Transcoding complete: {} -> {}", input_path, output_path);
28}Sourcepub fn transcode(
&self,
input: &[u8],
format: &OutputFormat,
) -> Result<TranscodeResult, Error>
pub fn transcode( &self, input: &[u8], format: &OutputFormat, ) -> Result<TranscodeResult, Error>
Transcode GLB input to separate JSON and buffer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GltfTranscoder
impl RefUnwindSafe for GltfTranscoder
impl Send for GltfTranscoder
impl Sync for GltfTranscoder
impl Unpin for GltfTranscoder
impl UnsafeUnpin for GltfTranscoder
impl UnwindSafe for GltfTranscoder
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Casts the value.
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.