Skip to main content

PointCloudDecoder

Struct PointCloudDecoder 

Source
pub struct PointCloudDecoder { /* private fields */ }
Available on crate feature decoder only.
Expand description

Decoder for Draco point cloud bitstreams.

PointCloudDecoder reads a point-cloud .drc bitstream and reconstructs a PointCloud with its attributes and metadata. Both KD-tree and sequential attribute encodings are supported (the actual decode requires the point_cloud_decode feature).

A round trip is shown on the PointCloudEncoder type docs.

Implementations§

Source§

impl PointCloudDecoder

Source

pub fn new() -> Self

Creates a point cloud decoder with default state.

Source

pub fn set_threads(&mut self, threads: i32)

Available on crate feature point_cloud_decode only.

Caps the threads a decode may use: 1, the default, keeps everything on the calling thread, 0 is as many as the machine has, and no count is taken past sixteen. One by default because a library cannot see what its caller already runs: a server decoding on a pool of its own would have every decode multiply its threads by up to sixteen, and a hostile stream would have the machine’s cores by default. A thread the system refuses to start is one fewer rather than an error. MeshDecoder::set_threads passes the same cap to the point-cloud streams a mesh decoder reads.

A sequential point cloud with many attributes decodes them side by side once the stream is large enough to repay it, and the decoded cloud is the one a single thread produces, value for value. A large cloud of many attributes, a Gaussian splat for one, decodes several times faster on many threads. A cloud of two attributes, a scan’s position and colour, gains next to nothing: its decode is the position’s one chain. On one thread the attributes are decoded in order. On WebAssembly there are no threads and the value is ignored.

Source

pub fn decode( &mut self, in_buffer: &mut DecoderBuffer<'_>, out_pc: &mut PointCloud, ) -> Status

Available on crate feature point_cloud_decode only.

Decodes a Draco point cloud from in_buffer into out_pc.

out_pc need not be empty: whatever it held is replaced, the same way MeshDecoder::decode replaces its mesh. decode_after_header does not clear, because its caller has already done so and has decoded metadata since.

§Errors

Returns an error if the header is invalid, the bitstream version is unsupported, or the encoded attributes are malformed.

Source

pub fn decode_after_header( &mut self, version_major: u8, version_minor: u8, method: u8, buffer: &mut DecoderBuffer<'_>, out_pc: &mut PointCloud, ) -> Status

Available on crate feature point_cloud_decode only.

Decode point cloud data when header + metadata have already been parsed. Used by MeshDecoder to delegate point cloud streams.

Source

pub fn get_geometry_type(&self) -> EncodedGeometryType

Returns the encoded geometry type handled by this decoder.

Trait Implementations§

Source§

impl Default for PointCloudDecoder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.