The SDK reference's tables had 1,476 empty cells. Each prop, field and class member the pages table now has a doc
comment in its source, or Bevy's own field doc where the SDK mirrors a Bevy type:
- doc comments on 773 declarations across 84 SDK files (song maps, goo and rigid bodies, matchmove, the clock and
timeline, state machines, materials and their extensions, the 2D shapes, bevy_ui and feathers wrappers, colours)
- inline prop types pulled out as named, documented interfaces (EchoesProps, DaylightProps, UiScaleProps, ...), so
each prop can carry its own doc
- types raea-bevy-sdk generates from raea's crates (/** raea_core_animate::spec::AnimKey */) take their field docs
from the Rust source, shown as raea's ("Rust: ..."), not Bevy's; core/animate's spec.rs gains the missing ///
- a props type (StandardMaterialProps) takes its component's @bevy fields; the colour classes gain their @bevy tags
- tools/manual-ref/sdk.ts check now fails on any prop, field or member without a description, as cli.ts does for
flags; tools/manual-ref.sh links an export's node_modules (RAEA_MODULES) so it can run in L1's lane export
5.7 KiB
title, summary, order, sources
| title | summary | order | sources | |
|---|---|---|---|---|
| raea/transform | Where things are: Bevy's Transform and Quat, and nesting. | 67 |
|
Transform and Quat are Bevy's, with Bevy's methods: Transform.fromXyz(...), .lookingAt(...),
.withRotation(...), Quat.fromEuler(...) and the rest. Every 3D component takes a transform, and children of an
entity are placed relative to it.
import { Quat, Transform } from "raea/transform";
const camera = Transform.fromXyz(0, 1.6, 5).lookingAt([0, 0.5, 0]);
const turned = Transform.IDENTITY.withRotation(Quat.fromEuler("XYZ", 0, Math.PI / 4, 0));
import { eulerOf, Quat, surfaceTurn, Transform } from "raea/transform"
raea/transform exports 2 functions, 2 values, 4 types. Bevy's counterpart: bevy_transform. Source: sdk/raea/src/transform.ts.
Functions
eulerOf
A part's Euler angles of a quaternion: a composition's rotation [x, y, z] is composed as three.js composes it,
Quat::from_euler(EulerRot::XYZ, x, y, z) (runtime/scene local; the YXZ rot_x/rot_y/rot_z of
raea-render's rows are read back from the world matrix), so this is that order's inverse.
function eulerOf(q: [number, number, number, number]): Vec3
Used in: 3d/3d_scene, shader_advanced/compute_mesh, shader_advanced/custom_render_phase.
surfaceTurn
The turn that takes +y to normal, with the picture's top (a decal's -z) toward world up on a wall, toward -z on a
floor, turned spin about the normal: a quaternion [x, y, z, w].
function surfaceTurn(normal: Vec3, spin?: number): [number, number, number, number]
Values
Quat
A rotation as glam's Quat: [x, y, z, w]. glam's Quat constructors, by their Rust names in camelCase.
Used in: ui/render_ui_to_texture, 3d/3d_shapes, 3d/texture, 3d/shadow_caster_receiver, 3d/split_screen, 3d/spotlight, 3d/mesh_ray_cast, 3d/3d_scene, and 23 more.
Transform
Bevy's Transform: the component's handle for a program (with(Transform, Transform.fromXyz(1, 0, 0))) and its
builders for a scene (<Mesh3d transform={Transform.fromXyz(0, 1, 0)}>).
Used in: ui/render_ui_to_texture, ui/widgets/viewport_node, 3d/fog_volumes, 3d/fog, 3d/vertex_colors, 3d/rotate_environment_map, 3d/transparency_3d, 3d/spherical_area_lights, and 71 more.
Types
EulerRot
glam's EulerRot, the intrinsic orders: "YXZ" turns about Y, then the turned X, then the turned Z.
type EulerRot = "XYZ" | "XZY" | "YXZ" | "YZX" | "ZXY" | "ZYX"
TransformBuilt
A Transform built with Bevy's builders: each returns a new one.
| Field | Type | What it is |
|---|---|---|
withTranslation (required) |
(v: Vec3) => TransformBuilt |
the same transform, moved to v |
withRotation (required) |
(q: Quat) => TransformBuilt |
the same transform, turned to q |
withScale (required) |
(s: number | Vec3) => TransformBuilt |
the same transform, scaled to s (one number for all three axes) |
lookingAt (required) |
(target: Vec3, up?: Vec3 | undefined) => TransformBuilt |
the same transform, turned so its -Z faces target with up (+Y) up, as Bevy's looking_at |
translation (required) |
Vec3 |
where it is, metres (x, y, z) |
rotation (required) |
Quat |
its rotation as a quaternion [x, y, z, w] |
scale (required) |
Vec3 |
its scale along x, y and z |
TransformValue
A Transform's value, as Bevy reflects it.
| Field | Type | What it is |
|---|---|---|
translation |
Vec3 |
where it is, metres (x, y, z) |
rotation |
Quat |
its rotation as a quaternion [x, y, z, w] |
scale |
Vec3 |
its scale along x, y and z |
Vec3
type Vec3 = [number, number, number]