MCPcopy Create free account
hub / github.com/melonjs/melonJS / project

Function project

packages/melonjs/tests/sprite3d.spec.js:586–598  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

584 cam.lookAt(0, 0, 0);
585 const s = makeAnimated({ billboard: "cylindrical" });
586 const project = () => {
587 s._billboardCam = cam;
588 s._projectVerticesWorld(0, 0, 0);
589 const c0 = cam.worldToScreen(
590 new Vector3d(s.vertices[0], s.vertices[1], s.vertices[2]),
591 new Vector2d(),
592 );
593 const c1 = cam.worldToScreen(
594 new Vector3d(s.vertices[3], s.vertices[4], s.vertices[5]),
595 new Vector2d(),
596 );
597 return { c0, c1 };
598 };
599 const before = project();
600 expect(before.c0.x).toBeLessThan(before.c1.x); // BL left of BR
601 s.flipX();

Callers 1

sprite3d.spec.jsFile · 0.70

Calls 2

worldToScreenMethod · 0.80
_projectVerticesWorldMethod · 0.45

Tested by

no test coverage detected