Skip to main content

native_to_baked

Function native_to_baked 

Source
pub fn native_to_baked(
    mesh_coordinate_space: MeshCoordinateSpace,
    site_transform: Option<&[f64]>,
    origin_shift: [f64; 3],
) -> [f64; 16]
Expand description

The row-major 4x4 mapping a NATIVE-frame point (IFC Z-up, pre-RTC — the frame InstanceMeta.transform and every captured local_to_world describe) onto the BAKED point this pipeline actually writes into MeshData, for the given coordinate-space tier.

One function, next to the converter that creates the divergence, so a consumer of baked vertices never re-derives the tier taxonomy by hand. What it encodes:

  • the router subtracts the model RTC offset while baking, so every tier carries T(-origin_shift);
  • site_local ALSO runs convert_mesh_to_site_local, which applies the site placement’s inverse rotation Rᵀ to positions, normals and the f64 origin — and in that tier the RTC offset IS the site translation (the three-tier selection in processor::mod takes it straight off the site matrix), so a baked point is exactly Rᵀ · (P − t_site);
  • model_rtc and raw_ifc remove no rotation, so they are T(-origin_shift) alone. raw_ifc selects origin_shift = (0,0,0), which makes that the identity that tier is documented to be. The translation is still applied unconditionally, so a caller handing in a non-zero shift under some other tier string gets the frame its vertices are actually in rather than a silent identity.

Rᵀ is applied under exactly [rotation_is_identity]’s condition, because that is the condition [apply_inverse_rotation_in_place] itself no-ops under: the two must agree, or this basis describes a bake that did not happen.

Row-major, to match the glTF exporter’s matrix module, which composes its Z-up→Y-up swap on top of this.