Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlayCanvas + Standalone Viewer #205

Merged
merged 28 commits into from
Dec 18, 2024
Merged

Conversation

MarcusLongmuir
Copy link
Collaborator

@MarcusLongmuir MarcusLongmuir commented Nov 5, 2024

Resolves #170, resolves #207, resolves #192

This PR is a significant overhaul of the frontend packages with the overall goals of:

  • Adding an implementation of MML on web using PlayCanvas
  • Adding a standalone viewer that will be accessible at https://viewer.mml.io/

The major change is that there is now an indirection between the implementation of the attribute handling of MML elements (e.g. m-cube) and the particular rendering/graphics engine (e.g. ThreeJS).

This results in new packages that separate the concerns.

  • @mml-io/mml-web contains the networking and attribute handling
  • @mml-io/mml-web-threejs contains the per-element implementations of graphics for ThreeJS
  • @mml-io/mml-web-threejs-standalone contains an implementation of a standalone ThreeJS app that renders MML.

What kind of changes does your PR introduce? (check at least one)

  • Feature
  • Refactor

Does your PR introduce a breaking change? (check one)

  • Yes

If yes, please describe its impact and migration path for existing applications:

Any users of the mml-web package should now depend on the @mml-io/mml-web package and @mml-io/mml-web-three-standalone.

The MMLScene now takes an element as a constructor argument and requires initialising with a graphics adapter:

-  import { MMLScene } from "mml-web";
+  import { MMLScene } from "@mml-io/mml-web";
+  import {
+    StandaloneThreeJSAdapter,
+    StandaloneThreeJSAdapterControlsType,
+  } from "@mml-io/mml-web-threejs-standalone";

-  const mmlScene = new MMLScene();
+  const sceneElement = document.createElement("div");
+  sceneElement.style.width = "100%";
+  sceneElement.style.height = "100%";
+  const mmlScene = new MMLScene(sceneElement);

+  StandaloneThreeJSAdapter.create(sceneElement, {
+    controlsType: StandaloneThreeJSAdapterControlsType.DragFly,
+  }).then((graphicsAdapter) => {
+    mmlScene.init(graphicsAdapter);
+  });

Does your PR fulfill the following requirements?

  • All tests are passing
  • The title references the corresponding issue # (if relevant)

@MarcusLongmuir MarcusLongmuir force-pushed the feature/playcanvas+viewer branch from abe75b0 to 948d4c4 Compare November 5, 2024 12:16
Copy link

github-actions bot commented Nov 5, 2024

🪓 PR closed, deleted preview at https://github.com/mml-io/mml/tree/gh-pages/pull/205/

@MarcusLongmuir MarcusLongmuir force-pushed the feature/playcanvas+viewer branch 3 times, most recently from 3597b79 to 03bc90a Compare November 5, 2024 16:16
@MarcusLongmuir MarcusLongmuir force-pushed the feature/playcanvas+viewer branch from 03bc90a to c0e3ef4 Compare November 5, 2024 16:31
}

if (value.indexOf("rgba(") === 0) {
const rgba = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)\)$/.exec(value);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with 'rgba(0,0,0,' and with many repetitions of '0'.
This
regular expression
that depends on library input may run slow on strings starting with 'rgba(0,0,0,' and with many repetitions of '0'.
@MarcusLongmuir MarcusLongmuir force-pushed the feature/playcanvas+viewer branch from aa028dd to 54aeab1 Compare November 28, 2024 16:37
@MarcusLongmuir MarcusLongmuir marked this pull request as ready for review December 11, 2024 11:34
@MarcusLongmuir MarcusLongmuir merged commit 17f1244 into main Dec 18, 2024
8 of 9 checks passed
@MarcusLongmuir MarcusLongmuir deleted the feature/playcanvas+viewer branch December 18, 2024 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support transparency/alpha in m-label colors Standalone MML Viewer PlayCanvas
1 participant