(t: TransformData)
| 308 | // The rotation order matches glTF / Blender / most game engines (XYZ Euler, |
| 309 | // applied right-to-left so X spin happens first in object space). |
| 310 | export function trsToMat4(t: TransformData): Mat4 { |
| 311 | const pos: Vec3 = { x: t.position[0], y: t.position[1], z: t.position[2] }; |
| 312 | const scl: Vec3 = { x: t.scale[0], y: t.scale[1], z: t.scale[2] }; |
| 313 | |
| 314 | let m = mat4Identity(); |
| 315 | m = mat4Translate(m, pos); |
| 316 | m = mat4RotateZ(m, t.rotation[2]); |
| 317 | m = mat4RotateY(m, t.rotation[1]); |
| 318 | m = mat4RotateX(m, t.rotation[0]); |
| 319 | m = mat4Scale(m, scl); |
| 320 | return m; |
| 321 | } |
| 322 | |
| 323 | // Apply an RGBA tint to a scene node. Pulled into a helper so it can be reused |
| 324 | // by prefab expansion (where children inherit the parent entity's tint unless |
no test coverage detected