#[non_exhaustive]pub struct GltfOptions {
pub include_metadata: bool,
pub isolated: Option<Vec<u32>>,
pub hidden: Vec<u32>,
pub hidden_types: Vec<String>,
pub lit: bool,
pub emissive: bool,
pub model_id: Option<String>,
pub quantize: bool,
pub tessellation_quality: TessellationQuality,
}Expand description
Options for glTF/GLB export.
let opts = GltfOptions::default().with_tessellation_quality(TessellationQuality::Low);#[non_exhaustive] plus builders, for the reason ModelOptions gives:
this will grow, and non_exhaustive forbids EVERY struct expression from
outside this crate, ..Default::default() included. Builders are the shape
that keeps an external caller compiling when a field is added. The fields
stay public, so reading one or assigning to one still works.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.include_metadata: boolAttach asset.extras (counts) and per-node extras.expressId.
isolated: Option<Vec<u32>>Restrict to these express ids (isolation allowlist). None ⇒ no filter,
every mesh is a candidate; Some(empty) ⇒ the filter is ACTIVE and
matched nothing, so every mesh is excluded. Do not collapse the two —
an active isolation that matches zero elements must export nothing, not
silently fall back to the whole model (matches the null-vs-empty
convention already used by packages/export/src/reference-collector.ts
and packages/renderer/src/entity-visibility.ts on the TS side).
Exclude these express ids (hidden in the viewer).
Exclude meshes whose IFC type is in this set (class-level visibility toggle).
lit: boolEmit standard (lit) PBR materials so external viewers shade the model from
its normals. When false, materials are tagged KHR_materials_unlit and
render flat with just the apparent base colour (the historical behaviour,
kept for colour-accurate exports). Default true. (#1321)
emissive: boolMake every material self-illuminating by setting emissiveFactor to its
base colour. Targets renderers with no ambient/IBL and a single hard sun —
notably Google Earth, which ignores KHR_materials_unlit and lit the
model so dark that shadow-side faces went black (#1427). emissiveFactor
is core glTF 2.0 (not an extension), so every compliant renderer honours
it; the base colour is kept too, so a viewer that ignores emissive is no
worse than today (never blacker than the lit result). Default false.
model_id: Option<String>Per-model id stamped into every node’s extras.modelId (federation: lets a
host distinguish elements from different models that share express-id space).
None ⇒ single model, no modelId emitted. Requires include_metadata.
quantize: boolQuantize geometry with KHR_mesh_quantization: 16-bit SHORT positions +
normals per-mesh over each mesh’s own bbox, with the dequant on a node transform.
~2x smaller, precision-safe (sub-2 mm per-mesh on the measured corpus). Default
false — the unquantized f32 output is byte-identical to before. three.js
GLTFLoader decodes it natively, but a loader without the extension cannot open
the file (it is extensionsRequired), so only enable when the consumer supports it.
tessellation_quality: TessellationQualityTessellation density. Medium is the golden-output identity; coarser
levels trade curve fidelity for vertex count on tube-heavy models.
Implementations§
Source§impl GltfOptions
impl GltfOptions
Sourcepub fn with_include_metadata(self, yes: bool) -> Self
pub fn with_include_metadata(self, yes: bool) -> Self
Sourcepub fn with_isolated(self, ids: Option<Vec<u32>>) -> Self
pub fn with_isolated(self, ids: Option<Vec<u32>>) -> Self
See GltfOptions::isolated. None ⇒ no filter; Some(ids) (empty or
not) ⇒ an active allowlist — pass Some(vec![]) deliberately to export
nothing, never as a stand-in for “no filter”.
See GltfOptions::hidden.
Sourcepub fn with_lit(self, yes: bool) -> Self
pub fn with_lit(self, yes: bool) -> Self
See GltfOptions::lit.
Sourcepub fn with_emissive(self, yes: bool) -> Self
pub fn with_emissive(self, yes: bool) -> Self
Sourcepub fn with_model_id(self, id: Option<String>) -> Self
pub fn with_model_id(self, id: Option<String>) -> Self
Sourcepub fn with_quantize(self, yes: bool) -> Self
pub fn with_quantize(self, yes: bool) -> Self
Sourcepub fn with_tessellation_quality(self, quality: TessellationQuality) -> Self
pub fn with_tessellation_quality(self, quality: TessellationQuality) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GltfOptions
impl RefUnwindSafe for GltfOptions
impl Send for GltfOptions
impl Sync for GltfOptions
impl Unpin for GltfOptions
impl UnwindSafe for GltfOptions
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
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 moreSource§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.