@needle-tools/engine 2.62.2-pre → 2.63.0-pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/needle-engine.js +7450 -7272
  3. package/dist/needle-engine.umd.cjs +282 -199
  4. package/lib/engine/codegen/license.d.ts +1 -0
  5. package/lib/engine/codegen/license.js +2 -0
  6. package/lib/engine/codegen/license.js.map +1 -0
  7. package/lib/engine/engine_element.js +1 -1
  8. package/lib/engine/engine_element.js.map +1 -1
  9. package/lib/engine/engine_element_loading.js +28 -4
  10. package/lib/engine/engine_element_loading.js.map +1 -1
  11. package/lib/engine/engine_license.d.ts +1 -0
  12. package/lib/engine/engine_license.js +199 -0
  13. package/lib/engine/engine_license.js.map +1 -0
  14. package/lib/engine/engine_physics.d.ts +3 -0
  15. package/lib/engine/engine_physics.js +13 -2
  16. package/lib/engine/engine_physics.js.map +1 -1
  17. package/lib/engine-components/ScreenCapture.d.ts +2 -2
  18. package/lib/engine-components/ScreenCapture.js +3 -1
  19. package/lib/engine-components/ScreenCapture.js.map +1 -1
  20. package/lib/engine-components/VideoPlayer.d.ts +2 -1
  21. package/lib/engine-components/VideoPlayer.js +9 -6
  22. package/lib/engine-components/VideoPlayer.js.map +1 -1
  23. package/lib/needle-engine.d.ts +1 -0
  24. package/lib/needle-engine.js +1 -0
  25. package/lib/needle-engine.js.map +1 -1
  26. package/lib/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +2 -2
  28. package/src/engine/assets/logo.svg +1 -0
  29. package/src/engine/codegen/license.js +1 -0
  30. package/src/engine/engine_element.ts +1 -1
  31. package/src/engine/engine_element_loading.ts +33 -8
  32. package/src/engine/engine_license.ts +216 -0
  33. package/src/engine/engine_physics.ts +16 -2
  34. package/src/engine-components/ScreenCapture.ts +3 -2
  35. package/src/engine-components/VideoPlayer.ts +10 -6
  36. package/src/needle-engine.ts +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "2.62.2-pre",
3
+ "version": "2.63.0-pre",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development, and can be deployed anywhere. It is flexible, extensible, and collaboration and XR come naturally.",
5
5
  "main": "dist/needle-engine.umd.cjs",
6
6
  "module": "dist/needle-engine.js",
@@ -60,7 +60,7 @@
60
60
  "@needle-tools/needle-component-compiler": "1.9.3",
61
61
  "@needle-tools/helper": "^0.2.1-pre",
62
62
  "@types/three": "0.146.0",
63
- "copy-files-from-to": "^3.3.0",
63
+ "copy-files-from-to": "^3.7.0",
64
64
  "esbuild": "^0.15.10",
65
65
  "esbuild-node-externals": "^1.5.0",
66
66
  "jsdoc-babel": "^0.5.0",
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><svg id="Ebene_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 160 187.74"><defs><style>.cls-1{fill:url(#Unbenannter_Verlauf_122);}.cls-2{fill:#f3e600;}.cls-3{fill:url(#Unbenannter_Verlauf_113);}.cls-4{fill:url(#gradient-6);}.cls-5{fill:url(#Unbenannter_Verlauf_110);}.cls-6{fill:url(#Unbenannter_Verlauf_101);}.cls-7{fill:#9c3;}.cls-8{fill:#ffe113;}.cls-9{fill:url(#gradient-5);}</style><linearGradient id="Unbenannter_Verlauf_113" x1="89.64" y1="184.81" x2="90.48" y2="21.85" gradientTransform="matrix(1, 0, 0, 1, 0, 0)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#62d399"/><stop offset=".51" stop-color="#acd842"/><stop offset=".9" stop-color="#d7db0a"/></linearGradient><linearGradient id="Unbenannter_Verlauf_110" x1="69.68" y1="178.9" x2="68.08" y2="16.77" gradientTransform="matrix(1, 0, 0, 1, 0, 0)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0ba398"/><stop offset=".5" stop-color="#4ca352"/><stop offset="1" stop-color="#76a30a"/></linearGradient><linearGradient id="Unbenannter_Verlauf_101" x1="36.6" y1="152.17" x2="34.7" y2="84.19" gradientTransform="matrix(1, 0, 0, 1, 0, 0)" gradientUnits="userSpaceOnUse"><stop offset=".19" stop-color="#36a382"/><stop offset=".54" stop-color="#49a459"/><stop offset="1" stop-color="#76a30b"/></linearGradient><linearGradient id="Unbenannter_Verlauf_122" x1="15.82" y1="153.24" x2="18" y2="90.86" gradientTransform="matrix(1, 0, 0, 1, 0, 0)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#267880"/><stop offset=".51" stop-color="#457a5c"/><stop offset="1" stop-color="#717516"/></linearGradient><linearGradient id="gradient-6" x1="135.08" y1="135.43" x2="148.93" y2="63.47" gradientTransform="matrix(1, 0, 0, 1, 0, 0)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b0d939"/><stop offset="1" stop-color="#eadb04"/></linearGradient><linearGradient id="gradient-5" x1="-4163.25" y1="2285.12" x2="-4160.81" y2="2215.34" gradientTransform="translate(4801.15 -595.25) rotate(20)" gradientUnits="userSpaceOnUse"><stop offset=".17" stop-color="#74af52"/><stop offset=".48" stop-color="#99be32"/><stop offset="1" stop-color="#c0c40a"/></linearGradient><symbol id="needle-icon" viewBox="0 0 160 187.74"><g><polygon class="cls-3" points="79.32 36.98 79.32 187.74 95 174.54 101.59 18.23 79.32 36.98"/><polygon class="cls-5" points="79.32 36.98 57.05 18.23 63.64 174.54 79.32 187.74 79.32 36.98"/><polygon class="cls-6" points="25.19 104.83 33.82 153.87 46.32 138.92 43.86 82.5 25.19 104.83"/><polygon class="cls-1" points="25.19 104.83 0 90.24 16.97 144.1 33.82 153.87 25.19 104.83"/><polygon class="cls-7" points="43.86 82.5 18.69 67.98 0 90.24 25.18 104.83 43.86 82.5"/><polygon class="cls-4" points="134.82 78.69 124.85 135.19 140.43 126.15 160 64.1 134.82 78.69"/><polygon class="cls-9" points="134.82 78.69 116.14 56.36 113.28 121.36 124.85 135.19 134.82 78.69"/><polygon class="cls-8" points="160 64.1 141.31 41.84 116.14 56.36 134.81 78.69 160 64.1"/><polygon class="cls-2" points="101.59 18.23 79.32 0 57.05 18.23 79.32 36.98 101.59 18.23"/></g></symbol></defs><use width="160" height="187.74" xlink:href="#needle-icon"/></svg>
@@ -0,0 +1 @@
1
+ export const hasLicense = false;
@@ -214,7 +214,7 @@ export class EngineElement extends HTMLElement implements INeedleEngineComponent
214
214
  }
215
215
  this._loadingProgress01 = 1;
216
216
  if (useDefaultLoading)
217
- this._loadingView?.onLoadingFinished("create scene");
217
+ this._loadingView?.onLoadingFinished("creating scene");
218
218
  this.classList.remove("loading");
219
219
  this.classList.add("loading-finished");
220
220
  if (debug)
@@ -64,13 +64,13 @@ export class EngineLoadingView implements ILoadingViewHandler {
64
64
  }
65
65
 
66
66
  onLoadingBegin(message?: string) {
67
- if(debug) console.log("Begin Loading")
67
+ if (debug) console.log("Begin Loading")
68
68
  if (!this._loadingElement) {
69
69
  for (let i = 0; i < this.container.children.length; i++) {
70
70
  const el = this.container.children[i] as HTMLElement;
71
71
  if (el.classList.contains(EngineLoadingView.LoadingContainerClassName)) {
72
72
  if (!this._allowCustomLoadingElement) {
73
- if(debug) console.warn("Remove custom loading container")
73
+ if (debug) console.warn("Remove custom loading container")
74
74
  this.container.removeChild(el);
75
75
  continue;
76
76
  }
@@ -102,7 +102,7 @@ export class EngineLoadingView implements ILoadingViewHandler {
102
102
  if ("index" in progress)
103
103
  total01 = calculateProgress01(progress);
104
104
  if (!message && "name" in progress)
105
- this.setMessage(progress.name);
105
+ this.setMessage("loading " + progress.name);
106
106
  }
107
107
  this.loadingProgress = total01;
108
108
  if (message) this.setMessage(message);
@@ -125,11 +125,14 @@ export class EngineLoadingView implements ILoadingViewHandler {
125
125
  if (this._progressLoop) return;
126
126
  let dt = 1 / 12;
127
127
  const max = 1 - .05;
128
- if(debugRendering) dt = 1 / 500;
128
+ if (debugRendering) {
129
+ dt = 1 / 500;
130
+ if (typeof debugRendering === "number") dt *= debugRendering;
131
+ }
129
132
  this._progressLoop = setInterval(() => {
130
133
  if (this.loadingProgress >= 1 && this._progress >= max) {
131
134
  if (this._loadingElement) {
132
- if(debug) console.log("Hiding loading element");
135
+ if (debug) console.log("Hiding loading element");
133
136
  this._loadingElement.style.display = "none";
134
137
  this._loadingElement.remove();
135
138
  }
@@ -154,7 +157,7 @@ export class EngineLoadingView implements ILoadingViewHandler {
154
157
  }
155
158
 
156
159
  private createLoadingElement(existing?: HTMLElement): HTMLElement {
157
- if(debug && !existing) console.log("Creating loading element");
160
+ if (debug && !existing) console.log("Creating loading element");
158
161
  this._loadingElement = existing || document.createElement("div");
159
162
  if (!existing) {
160
163
  this._loadingElement.style.position = "fixed";
@@ -186,9 +189,29 @@ export class EngineLoadingView implements ILoadingViewHandler {
186
189
  loadingBarContainer.style.display = "flex";
187
190
  loadingBarContainer.style.width = maxWidth + "%";
188
191
  loadingBarContainer.style.height = "2px";
189
- loadingBarContainer.style.background = "rgba(255,255,255,.1)"
192
+ loadingBarContainer.style.background = "rgba(255,255,255,.2)"
193
+ // loadingBarContainer.style.alignItems = "center";
190
194
  this._loadingElement.appendChild(loadingBarContainer);
191
195
 
196
+ const needleLogo = document.createElement("img");
197
+ loadingBarContainer.appendChild(needleLogo);
198
+ const logoSize = 64;
199
+ needleLogo.style.width = `${logoSize}px`;
200
+ needleLogo.style.height = `${logoSize}px`;
201
+ needleLogo.style.position = "absolute";
202
+ needleLogo.style.left = "50%";
203
+ needleLogo.style.transform = `translate(-${logoSize * .5}px, -${logoSize + 32}px)`;
204
+ needleLogo.addEventListener("click", () => window.open("https://needle.tools", "_blank"));
205
+ needleLogo.style.cursor = "pointer";
206
+ needleLogo.style.pointerEvents = "all";
207
+ try {
208
+ //@ts-ignore
209
+ import("./assets/logo.svg").then(res => {
210
+ needleLogo.src = res.default;
211
+ })
212
+ }
213
+ catch { }
214
+
192
215
  this._loadingBar = document.createElement("div");
193
216
  loadingBarContainer.appendChild(this._loadingBar);
194
217
  const getGradientPos = function (t: number): string {
@@ -203,7 +226,7 @@ export class EngineLoadingView implements ILoadingViewHandler {
203
226
  this._loadingTextContainer = document.createElement("div");
204
227
  this._loadingTextContainer.style.display = "flex";
205
228
  this._loadingTextContainer.style.justifyContent = "center";
206
- this._loadingTextContainer.style.marginTop = ".9em";
229
+ this._loadingTextContainer.style.marginTop = "1.2em";
207
230
  this._loadingElement.appendChild(this._loadingTextContainer);
208
231
 
209
232
  const messageContainer = document.createElement("div");
@@ -212,6 +235,8 @@ export class EngineLoadingView implements ILoadingViewHandler {
212
235
  messageContainer.style.fontSize = ".8em";
213
236
  messageContainer.style.paddingTop = ".5em";
214
237
  messageContainer.style.color = "rgba(255,255,255,.5)";
238
+ messageContainer.style.fontWeight = "200";
239
+ messageContainer.style.fontFamily = "Roboto, sans-serif";
215
240
  // messageContainer.style.border = "1px solid rgba(255,255,255,.1)";
216
241
  messageContainer.style.justifyContent = "center";
217
242
  this._loadingElement.appendChild(messageContainer);
@@ -0,0 +1,216 @@
1
+ import { getParam } from "./engine_utils";
2
+ import { ContextEvent, ContextRegistry } from "./engine_context_registry";
3
+ import { IContext } from "./engine_types";
4
+
5
+ const debug = getParam("debuglicense");
6
+
7
+ ContextRegistry.registerCallback(ContextEvent.ContextCreated, evt => {
8
+ showLicenseInfo(evt.context);
9
+ });
10
+
11
+ async function showLicenseInfo(ctx: IContext) {
12
+ try {
13
+ const res = await import(/* @vite-ignore */ "./codegen/license");
14
+ //@ts-ignore
15
+ if (!res || res.hasLicense !== true || debug) return onNonCommercialVersionDetected(ctx);
16
+ }
17
+ catch (err) {
18
+ if (debug) console.log("License check failed", err)
19
+ return onNonCommercialVersionDetected(ctx)
20
+ }
21
+ if (debug) onNonCommercialVersionDetected(ctx)
22
+ }
23
+
24
+
25
+ const _licenseText = "🌵 <span class=\"text\">Made with <a href=\"https://needle.tools\" target=\"_blank\">Needle</a></span>";
26
+ const licenseElementClass = "needle-license-element";
27
+ const licenseDuration = 30000;
28
+ const licenseDelay = 600;
29
+
30
+ function onNonCommercialVersionDetected(ctx: IContext) {
31
+ insertNonCommercialUseHint(ctx);
32
+ sendNonCommercialUsageMessageToAnalyticsBackend();
33
+ }
34
+
35
+ function insertNonCommercialUseHint(ctx: IContext) {
36
+
37
+ let licenseText = _licenseText;
38
+ const licenseElement = createLicenseElement();
39
+ licenseElement.innerHTML = licenseText;
40
+
41
+ const style = createLicenseStyle();
42
+
43
+ const interval = setInterval(() => {
44
+ if (!licenseElement) return;
45
+ if (licenseElement.parentElement !== ctx.domElement) {
46
+ ctx.domElement.appendChild(licenseElement);
47
+ if (style) ctx.domElement.appendChild(style);
48
+ }
49
+ }, 100);
50
+
51
+ logNonCommercialUse();
52
+
53
+ //@ts-ignore
54
+ import("./assets/logo.svg").then(res => {
55
+ const svgContent = res.default;
56
+ let svg = `<img class="logo" src="${svgContent}" style="width: 40px; height: 40px; margin-right: 2px; vertical-align: middle; margin-bottom: 2px;"/>`;
57
+ svg = "<a href=\"https://needle.tools\" target=\"_blank\">" + svg + "</a>";
58
+ licenseText = svg; //licenseText.replace("🌵", svg);
59
+ licenseElement.innerHTML = licenseText;
60
+ }).catch(err => {
61
+ if (debug) console.log("Failed to load logo", err);
62
+ });
63
+
64
+ const removeDelay = licenseDuration + licenseDelay;
65
+ setTimeout(() => {
66
+ clearInterval(interval);
67
+ licenseElement?.remove();
68
+ }, removeDelay);
69
+
70
+ }
71
+
72
+ async function logNonCommercialUse(_logo?: string) {
73
+ const logo = "data:image/webp;base64,UklGRrABAABXRUJQVlA4WAoAAAAQAAAAHwAAHwAAQUxQSKEAAAARN6CmbSM4WR7vdARON11EBDq3fLiNbVtVzpMCPlKAEzsx0Y/x+Ovuv4dn0EFE/ydAvz6YggXzgh5sVgXM/zOC/4sii7qgGvB5N7hmuQYwkvazWAu1JPW41FXSHq6pnaQWvqYH18Fc0j1hO/BFTtIeSBlJi5w6qIIO7IOrwhFsB2Yxukif0FTRLpXswHR8MxbslKe9VZsn/Ub5C7YFOpqSTABWUDgg6AAAAFAGAJ0BKiAAIAA+7VyoTqmkpCI3+qgBMB2JbACdMt69DwMIQBLhkTO6XwY00UEDK6cNIDnuNibPf0EgAP7Y1myuiQHLDsF/0h5unrGh6WAbv7aegg2ZMd3uRKfT/3SJztcaujYfTvMXspfCTmYcoO6a+vhC3ss4M8uM58t4siiu59I4aOl59e9Sr6xoxYlHf2v+NnBNpJYeJf8jABQAId/PXuBkLEFkiCucgSGEcfhvajql/j3reCGl0M5/9gQWy7ayNPs+wlvIxFnNfSlfuND4CZOCyxOHhRqOmHN4ULHo3tCSrUNvgAA=";
74
+ const style = `
75
+ font-size:18px;
76
+ background-size: contain;
77
+ background-position: left center;
78
+ background-repeat:no-repeat;
79
+ background-image:url('${logo}')
80
+ `;
81
+ let licenseText = "Needle Engine — non commercial version";
82
+ console.log("%c " + licenseText, style)
83
+ }
84
+
85
+ function createLicenseElement() {
86
+ const licenseElement = document.createElement("div");
87
+ licenseElement.classList.add(licenseElementClass);
88
+ licenseElement.setAttribute("data-needle_engine_license_element", "");
89
+ licenseElement.style.position = "fixed";
90
+ licenseElement.style.bottom = "12px";
91
+ licenseElement.style.right = "15px";
92
+
93
+ // licenseElement.style.textShadow = "0 0 2px rgba(200,200,200, 1)";
94
+ const maxPossibleZIndex = 2147483647;
95
+ licenseElement.style.zIndex = `${maxPossibleZIndex}`;
96
+ return licenseElement;
97
+ }
98
+
99
+ function createLicenseStyle() {
100
+ const licenseStyle = document.createElement("style");
101
+ const selector = "." + licenseElementClass;
102
+ licenseStyle.innerHTML = `
103
+ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;500&display=swap');
104
+
105
+ ${selector} {
106
+ font-family: 'Roboto', sans-serif !important;
107
+ font-weight: 300;
108
+ }
109
+
110
+ ${selector} a {
111
+ color: black;
112
+ text-decoration: none;
113
+ font-weight: 500;
114
+ }
115
+
116
+ @keyframes append-animate {
117
+ 0% {
118
+ transform: translate(0px, 10px);
119
+ opacity: 0;
120
+ pointer-events: none;
121
+ }
122
+ 1% {
123
+ transform: translate(0, -5px);
124
+ opacity: .9;
125
+ }
126
+ 2% {
127
+ transform: translate(0, 3px);
128
+ }
129
+ 6% {
130
+ transform: translate(0, 0px);
131
+ pointer-events: all;
132
+ opacity: 1;
133
+ }
134
+ 50% {
135
+ transform: scale(1)
136
+ }
137
+ 51% {
138
+ transform: scale(1.2)
139
+ }
140
+ 53% {
141
+ transform: scale(1)
142
+ }
143
+ 90% {
144
+ opacity: 1;
145
+ pointer-events: all;
146
+ transform: scale(1)
147
+ }
148
+ 100% {
149
+ opacity: 0;
150
+ pointer-events: none;
151
+ }
152
+ }
153
+ ${selector} {
154
+ opacity: 0;
155
+ pointer-events: none;
156
+ animation: append-animate;
157
+ animation-iteration-count: 1;
158
+ animation-duration: ${(licenseDuration / 1000)}s;
159
+ animation-delay: ${licenseDelay / 1000}s;
160
+ animation-easing: ease-in-out;
161
+ }
162
+
163
+ ${selector} .text, ${selector} a {
164
+ color: rgb(255, 0, 0);
165
+ mix-blend-mode: difference;
166
+ }
167
+
168
+ ${selector} .logo {
169
+ border-radius: 50%;
170
+ background-color: transparent;
171
+ padding: 5px;
172
+ transition: all 0.1s ease-in-out;
173
+ }
174
+
175
+ ${selector} .logo:hover {
176
+ transform: scale(1.3);
177
+ cursor: pointer;
178
+ }
179
+ `
180
+ return licenseStyle;
181
+ }
182
+
183
+
184
+ async function sendNonCommercialUsageMessageToAnalyticsBackend() {
185
+ try {
186
+ const analyticsBackendUrlForward = "https://urls.needle.tools/analytics-endpoint";
187
+ const res = await fetch(analyticsBackendUrlForward);
188
+ let analyticsUrl = await res.text();
189
+ if (analyticsUrl) {
190
+ if (debug) console.log("Analytics backend url", analyticsUrl);
191
+
192
+ // analyticsUrl = "http://localhost:3000/";
193
+
194
+ const currentUrl = window.location.href;
195
+
196
+ let endpoint = "api/v1/register/web-request";
197
+ if (!analyticsUrl.endsWith("/")) endpoint = "/" + endpoint;
198
+ const finalUrl = `${analyticsUrl}${endpoint}?type=non-commercial&url=${encodeURIComponent(currentUrl)}&hostname=${encodeURIComponent(window.location.hostname)}&pathname=${encodeURIComponent(window.location.pathname)}&search=${encodeURIComponent(window.location.search)}&hash=${encodeURIComponent(window.location.hash)}`;
199
+ if (debug) console.log("Sending non-commercial usage message to analytics backend", finalUrl);
200
+
201
+
202
+ fetch(finalUrl,
203
+ {
204
+ mode: "no-cors"
205
+ })
206
+ .catch(err => {
207
+ if (debug)
208
+ console.log("Failed to send non-commercial usage message to analytics backend", err);
209
+ });
210
+ }
211
+ }
212
+ catch (err) {
213
+ if (debug)
214
+ console.log("Failed to send non-commercial usage message to analytics backend", err);
215
+ }
216
+ }
@@ -324,8 +324,22 @@ export class Physics {
324
324
  await RAPIER.init().then(() => RAPIER)
325
325
  Physics._didLoadPhysicsEngine = true;
326
326
  }
327
- const gravity = { x: 0.0, y: -9.81, z: 0.0 };
328
- this.world = new World(gravity);
327
+ this.world = new World(this._gravity);
328
+ }
329
+
330
+ private _gravity = { x: 0.0, y: -9.81, z: 0.0 };
331
+
332
+ get gravity() {
333
+ return this.world?.gravity ?? this._gravity;
334
+ }
335
+
336
+ set gravity(value: Vec3) {
337
+ if (this.world) {
338
+ this.world.gravity = value;
339
+ }
340
+ else {
341
+ this._gravity = value;
342
+ }
329
343
  }
330
344
 
331
345
  clearCaches() {
@@ -5,7 +5,7 @@ import { Context } from "../engine/engine_setup";
5
5
  import { RoomEvents } from "../engine/engine_networking";
6
6
  import { UserJoinedOrLeftRoomModel } from "../engine/engine_networking";
7
7
  import { serializable } from "../engine/engine_serialization";
8
- import { IPointerClickHandler } from "./ui/PointerEvents";
8
+ import { IPointerClickHandler, PointerEventData } from "./ui/PointerEvents";
9
9
  import { EventDispatcher } from "three";
10
10
  import { AudioSource } from "./AudioSource";
11
11
  import { getParam } from "../engine/engine_utils";
@@ -39,7 +39,8 @@ declare type ScreenCaptureOptions = {
39
39
 
40
40
  export class ScreenCapture extends Behaviour implements IPointerClickHandler {
41
41
 
42
- onPointerClick() {
42
+ onPointerClick(evt : PointerEventData) {
43
+ if(evt && evt.pointerId !== 0) return;
43
44
  if(this.context.connection.isInRoom === false) return;
44
45
  if (this.isReceiving) {
45
46
  if (this.videoPlayer)
@@ -122,6 +122,10 @@ export class VideoPlayer extends Behaviour {
122
122
  }
123
123
  }
124
124
 
125
+ get videoMaterial() {
126
+ return this._videoMaterial;
127
+ }
128
+
125
129
  get videoTexture() {
126
130
  return this._videoTexture;
127
131
  }
@@ -140,7 +144,7 @@ export class VideoPlayer extends Behaviour {
140
144
 
141
145
  private _videoElement: HTMLVideoElement | null = null;
142
146
  private _videoTexture: THREE.VideoTexture | null = null;
143
- private videoMaterial: Material | null = null;
147
+ private _videoMaterial: Material | null = null;
144
148
 
145
149
  private _isPlaying: boolean = false;
146
150
  private wasPlaying: boolean = false;
@@ -355,18 +359,18 @@ export class VideoPlayer extends Behaviour {
355
359
  if (mat) {
356
360
  this._targetObjects.push(target);
357
361
 
358
- if (mat !== this.videoMaterial) {
359
- this.videoMaterial = mat.clone();
360
- target["material"] = this.videoMaterial;
362
+ if (mat !== this._videoMaterial) {
363
+ this._videoMaterial = mat.clone();
364
+ target["material"] = this._videoMaterial;
361
365
  }
362
366
 
363
367
  if (!this.targetMaterialProperty) {
364
- (this.videoMaterial as any).map = this._videoTexture;
368
+ (this._videoMaterial as any).map = this._videoTexture;
365
369
  }
366
370
  else {
367
371
  switch (this.targetMaterialProperty) {
368
372
  default:
369
- (this.videoMaterial as any).map = this._videoTexture;
373
+ (this._videoMaterial as any).map = this._videoTexture;
370
374
  break;
371
375
  // doesnt render:
372
376
  // case "emissiveTexture":
@@ -50,3 +50,7 @@ if(!globalThis["THREE"]) {
50
50
  globalThis["THREE"] = THREE;
51
51
  }
52
52
  else console.warn("Threejs is already imported");
53
+
54
+
55
+
56
+ import "./engine/engine_license";