pub struct MeshDataJs { /* private fields */ }Expand description
Individual mesh data with express ID and color (matches MeshData interface)
Implementations§
Source§impl MeshDataJs
impl MeshDataJs
Sourcepub fn express_id(&self) -> u32
pub fn express_id(&self) -> u32
Get express ID
Sourcepub fn positions(&self) -> Float32Array
pub fn positions(&self) -> Float32Array
Get positions as Float32Array (copy to JS)
Sourcepub fn normals(&self) -> Float32Array
pub fn normals(&self) -> Float32Array
Get normals as Float32Array (copy to JS)
Sourcepub fn indices(&self) -> Uint32Array
pub fn indices(&self) -> Uint32Array
Get indices as Uint32Array (copy to JS)
Sourcepub fn shading_color(&self) -> Option<Vec<f32>>
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).
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
Get vertex count
Sourcepub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Get triangle count
Sourcepub fn has_texture(&self) -> bool
pub fn has_texture(&self) -> bool
True when this mesh carries a surface texture (#961).
Sourcepub fn uvs(&self) -> Float32Array
pub fn uvs(&self) -> Float32Array
Per-vertex texture coordinates as Float32Array (u, v pairs). Empty when the mesh is untextured.
Sourcepub fn texture_rgba(&self) -> Uint8Array
pub fn texture_rgba(&self) -> Uint8Array
Decoded RGBA8 texture bytes (width*height*4). Empty when untextured.
pub fn texture_width(&self) -> u32
pub fn texture_height(&self) -> u32
Sourcepub fn texture_repeat_s(&self) -> bool
pub fn texture_repeat_s(&self) -> bool
Sampler wrap for the S axis (IfcSurfaceTexture.RepeatS): true = repeat.
Sourcepub fn texture_repeat_t(&self) -> bool
pub fn texture_repeat_t(&self) -> bool
Sampler wrap for the T axis (IfcSurfaceTexture.RepeatT): true = repeat.
Sourcepub fn texture_id(&self) -> u32
pub fn texture_id(&self) -> u32
Stable texture dedup key (IfcSurfaceTexture express id, #1781).
0 when the mesh is untextured.
Sourcepub fn texture_url(&self) -> Option<String>
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.
Sourcepub fn geometry_class(&self) -> u8
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).
Sourcepub fn origin(&self) -> Float64Array
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).
Sourcepub fn local_bounds(&self) -> Option<Vec<f32>>
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).
Sourcepub fn local_to_world(&self) -> Option<Vec<f64>>
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
impl MeshDataJs
Sourcepub fn new(
express_id: u32,
ifc_type: String,
mesh: Mesh,
color: [f32; 4],
) -> Self
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.
Sourcepub fn set_geometry_class(&mut self, class: u8)
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.
Sourcepub fn set_shading_color(&mut self, shading: Option<[f32; 4]>)
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.
Sourcepub fn set_texture(
&mut self,
uvs: Vec<f32>,
rgba: Vec<u8>,
width: u32,
height: u32,
repeat_s: bool,
repeat_t: bool,
texture_id: u32,
)
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.
Sourcepub fn set_texture_ref(
&mut self,
uvs: Vec<f32>,
url: String,
repeat_s: bool,
repeat_t: bool,
texture_id: u32,
)
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.
Sourcepub fn from_mesh_data(m: MeshData) -> Self
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
impl From<MeshDataJs> for JsValue
Source§fn from(value: MeshDataJs) -> Self
fn from(value: MeshDataJs) -> Self
Source§impl FromWasmAbi for MeshDataJs
impl FromWasmAbi for MeshDataJs
Source§impl IntoWasmAbi for MeshDataJs
impl IntoWasmAbi for MeshDataJs
Source§impl LongRefFromWasmAbi for MeshDataJs
impl LongRefFromWasmAbi for MeshDataJs
Source§type Abi = WasmPtr<WasmRefCell<MeshDataJs>>
type Abi = WasmPtr<WasmRefCell<MeshDataJs>>
RefFromWasmAbi::AbiSource§type Anchor = RcRef<MeshDataJs>
type Anchor = RcRef<MeshDataJs>
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for MeshDataJs
impl OptionFromWasmAbi for MeshDataJs
Source§impl OptionIntoWasmAbi for MeshDataJs
impl OptionIntoWasmAbi for MeshDataJs
Source§impl RefFromWasmAbi for MeshDataJs
impl RefFromWasmAbi for MeshDataJs
Source§type Abi = WasmPtr<WasmRefCell<MeshDataJs>>
type Abi = WasmPtr<WasmRefCell<MeshDataJs>>
Self are recovered from.Source§type Anchor = RcRef<MeshDataJs>
type Anchor = RcRef<MeshDataJs>
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§impl RefMutFromWasmAbi for MeshDataJs
impl RefMutFromWasmAbi for MeshDataJs
Source§type Abi = WasmPtr<WasmRefCell<MeshDataJs>>
type Abi = WasmPtr<WasmRefCell<MeshDataJs>>
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<MeshDataJs>
type Anchor = RcRefMut<MeshDataJs>
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for MeshDataJs
impl SupportsInstanceProperty for MeshDataJs
impl SupportsStaticProperty for MeshDataJs
Source§impl TryFromJsValue for MeshDataJs
impl TryFromJsValue for MeshDataJs
Source§impl VectorFromWasmAbi for MeshDataJs
impl VectorFromWasmAbi for MeshDataJs
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[MeshDataJs]>
Source§impl VectorIntoWasmAbi for MeshDataJs
impl VectorIntoWasmAbi for MeshDataJs
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[MeshDataJs]>) -> Self::Abi
Source§impl WasmDescribeVector for MeshDataJs
impl WasmDescribeVector for MeshDataJs
Auto Trait Implementations§
impl Freeze for MeshDataJs
impl RefUnwindSafe for MeshDataJs
impl Send for MeshDataJs
impl Sync for MeshDataJs
impl Unpin for MeshDataJs
impl UnsafeUnpin for MeshDataJs
impl UnwindSafe for MeshDataJs
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.