Skip to main content

MeshDataJs

Struct MeshDataJs 

Source
pub struct MeshDataJs { /* private fields */ }
Expand description

Individual mesh data with express ID and color (matches MeshData interface)

Implementations§

Source§

impl MeshDataJs

Source

pub fn express_id(&self) -> u32

Get express ID

Source

pub fn ifc_type(&self) -> String

Get IFC type name (e.g., “IfcWall”, “IfcSpace”)

Source

pub fn positions(&self) -> Float32Array

Get positions as Float32Array (copy to JS)

Source

pub fn normals(&self) -> Float32Array

Get normals as Float32Array (copy to JS)

Source

pub fn indices(&self) -> Uint32Array

Get indices as Uint32Array (copy to JS)

Source

pub fn color(&self) -> Vec<f32>

Get color as [r, g, b, a] array

Source

pub fn shading_color(&self) -> Option<Vec<f32>>

Optional SurfaceColour for the “Shading” GLB-export choice — only present when the file authored a distinct DiffuseColour. JS sees undefined when absent (most files).

Source

pub fn vertex_count(&self) -> usize

Get vertex count

Source

pub fn triangle_count(&self) -> usize

Get triangle count

Source

pub fn has_texture(&self) -> bool

True when this mesh carries a surface texture (#961).

Source

pub fn uvs(&self) -> Float32Array

Per-vertex texture coordinates as Float32Array (u, v pairs). Empty when the mesh is untextured.

Source

pub fn texture_rgba(&self) -> Uint8Array

Decoded RGBA8 texture bytes (width*height*4). Empty when untextured.

Source

pub fn texture_width(&self) -> u32

Source

pub fn texture_height(&self) -> u32

Source

pub fn texture_repeat_s(&self) -> bool

Sampler wrap for the S axis (IfcSurfaceTexture.RepeatS): true = repeat.

Source

pub fn texture_repeat_t(&self) -> bool

Sampler wrap for the T axis (IfcSurfaceTexture.RepeatT): true = repeat.

Source

pub fn texture_id(&self) -> u32

Stable texture dedup key (IfcSurfaceTexture express id, #1781). 0 when the mesh is untextured.

Source

pub fn texture_url(&self) -> Option<String>

External image reference (IfcImageTexture.URLReference, #1781) for the host to resolve — e.g. a sibling image inside the .ifcZIP. undefined for untextured meshes and Rust-decoded blob/pixel textures.

Source

pub fn geometry_class(&self) -> u8

Geometry provenance for the viewer’s Model/Types switch (#957 follow-up): 0 = occurrence, 1 = orphan type geometry (no occurrence), 2 = instanced type geometry (hidden in Model mode, shown in Types mode).

Source

pub fn origin(&self) -> Float64Array

Per-element local-frame origin (Float64Array[3], WebGL Y-up, metres): world position of vertex i = origin + positions[3i..3i+3]. Returns [0,0,0] when positions are absolute (legacy / local frame off).

Source

pub fn local_bounds(&self) -> Option<Vec<f32>>

Local (pre-placement, object-space) AABB (issue #1474), WebGL Y-up, [minX,minY,minZ,maxX,maxY,maxZ]. undefined when not captured (wasm-bindgen maps Option::None to undefined, not null).

Source

pub fn local_to_world(&self) -> Option<Vec<f64>>

The resolved IfcLocalPlacement chain for this mesh (issue #1474), row-major 4×4, WebGL Y-up. undefined when not captured (see local_bounds above).

Source§

impl MeshDataJs

Source

pub fn new( express_id: u32, ifc_type: String, mesh: Mesh, color: [f32; 4], ) -> Self

Create new mesh data with IFC Z-up to WebGL Y-up conversion.

Performs coordinate conversion and winding order reversal in Rust to avoid expensive per-vertex JS iteration (63.5M vertices for large files). IFC Z-up → WebGL Y-up: swap Y/Z, negate new Z for right-handedness. Winding order reversed to compensate for the handedness flip.

Source

pub fn set_geometry_class(&mut self, class: u8)

Tag this mesh’s geometry provenance for the Model/Types view switch (0 = occurrence, 1 = orphan type, 2 = instanced type). Call after new.

Source

pub fn set_shading_color(&mut self, shading: Option<[f32; 4]>)

Attach an optional SurfaceColour for the GLB exporter’s “Shading” colour source. Callers that have a geometry_shading_styles entry for the mesh’s source geometry id should invoke this after new.

Source

pub fn set_texture( &mut self, uvs: Vec<f32>, rgba: Vec<u8>, width: u32, height: u32, repeat_s: bool, repeat_t: bool, texture_id: u32, )

Attach per-vertex UVs + a decoded RGBA8 texture (#961). UVs are 1:1 with positions and need no coordinate flip (they are 2D); the winding reversal in new swaps indices, not vertices, so per-vertex UVs stay aligned. Call after new.

Source

pub fn set_texture_ref( &mut self, uvs: Vec<f32>, url: String, repeat_s: bool, repeat_t: bool, texture_id: u32, )

Attach per-vertex UVs + an EXTERNAL image reference (#1781): the host resolves url (e.g. against the .ifcZIP siblings), decodes it once per texture_id, and shares the GPU texture. Call after new.

Source

pub fn from_mesh_data(m: MeshData) -> Self

Build from the canonical per-element producer’s [MeshData] (ifc_lite_processing::element): wraps MeshDataJs::new (IFC Z-up → WebGL Y-up + winding reversal), copies the geometry_class tag and the optional texture/UVs. Element metadata the browser doesn’t carry (global_id / name / presentation layer / material name / properties) is dropped — the viewer gets it from the parser worker instead.

Trait Implementations§

Source§

impl From<MeshDataJs> for JsValue

Source§

fn from(value: MeshDataJs) -> Self

Converts to this type from the input type.
Source§

impl FromWasmAbi for MeshDataJs

Source§

type Abi = WasmPtr<WasmRefCell<MeshDataJs>>

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl IntoWasmAbi for MeshDataJs

Source§

type Abi = WasmPtr<WasmRefCell<MeshDataJs>>

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> Self::Abi

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl LongRefFromWasmAbi for MeshDataJs

Source§

type Abi = WasmPtr<WasmRefCell<MeshDataJs>>

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRef<MeshDataJs>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl OptionFromWasmAbi for MeshDataJs

Source§

fn is_none(abi: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl OptionIntoWasmAbi for MeshDataJs

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl RefFromWasmAbi for MeshDataJs

Source§

type Abi = WasmPtr<WasmRefCell<MeshDataJs>>

The Wasm ABI type references to Self are recovered from.
Source§

type Anchor = RcRef<MeshDataJs>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous.
Source§

unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Source§

impl RefMutFromWasmAbi for MeshDataJs

Source§

type Abi = WasmPtr<WasmRefCell<MeshDataJs>>

Same as RefFromWasmAbi::Abi
Source§

type Anchor = RcRefMut<MeshDataJs>

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl SupportsConstructor for MeshDataJs

Source§

impl SupportsInstanceProperty for MeshDataJs

Source§

impl SupportsStaticProperty for MeshDataJs

Source§

impl TryFromJsValue for MeshDataJs

Source§

fn try_from_js_value(value: JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

fn try_from_js_value_ref(value: &JsValue) -> Option<Self>

Performs the conversion.
Source§

impl VectorFromWasmAbi for MeshDataJs

Source§

type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi

Source§

unsafe fn vector_from_abi(js: Self::Abi) -> Box<[MeshDataJs]>

Source§

impl VectorIntoWasmAbi for MeshDataJs

Source§

impl WasmDescribe for MeshDataJs

Source§

impl WasmDescribeVector for MeshDataJs

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more