MCPcopy
hub / github.com/antimatter15/splat / getViewMatrix

Function getViewMatrix

main.js:171–186  ·  view source on GitHub ↗
(camera)

Source from the content-addressed store, hash-verified

169}
170
171function getViewMatrix(camera) {
172 const R = camera.rotation.flat();
173 const t = camera.position;
174 const camToWorld = [
175 [R[0], R[1], R[2], 0],
176 [R[3], R[4], R[5], 0],
177 [R[6], R[7], R[8], 0],
178 [
179 -t[0] * R[0] - t[1] * R[3] - t[2] * R[6],
180 -t[0] * R[1] - t[1] * R[4] - t[2] * R[7],
181 -t[0] * R[2] - t[1] * R[5] - t[2] * R[8],
182 1,
183 ],
184 ].flat();
185 return camToWorld;
186}
187// function translate4(a, x, y, z) {
188// return [
189// ...a.slice(0, 12),

Callers 3

mainFunction · 0.85
frameFunction · 0.85
selectFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected