MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / trsToMat4

Function trsToMat4

src/world/prefab.ts:168–179  ·  view source on GitHub ↗
(t: TransformData)

Source from the content-addressed store, hash-verified

166// imported from `./loader.ts`) to keep the dependency graph flat — prefab is
167// used *by* the loader, not the other way around.
168function trsToMat4(t: TransformData): Mat4 {
169 const pos: Vec3 = { x: t.position[0], y: t.position[1], z: t.position[2] };
170 const scl: Vec3 = { x: t.scale[0], y: t.scale[1], z: t.scale[2] };
171
172 let m = mat4Identity();
173 m = mat4Translate(m, pos);
174 m = mat4RotateZ(m, t.rotation[2]);
175 m = mat4RotateY(m, t.rotation[1]);
176 m = mat4RotateX(m, t.rotation[0]);
177 m = mat4Scale(m, scl);
178 return m;
179}
180
181function mergeTags(parent: ReadonlyArray<string>, child: ReadonlyArray<string>): string[] {
182 if (parent.length === 0) return [...child];

Callers 1

expandPrefabFunction · 0.70

Calls 6

mat4IdentityFunction · 0.90
mat4TranslateFunction · 0.90
mat4RotateZFunction · 0.90
mat4RotateYFunction · 0.90
mat4RotateXFunction · 0.90
mat4ScaleFunction · 0.90

Tested by

no test coverage detected