@needle-tools/engine 2.38.0-pre → 2.38.0-pre.2
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.
- package/dist/needle-engine.d.ts +38 -6
- package/dist/needle-engine.js +351 -351
- package/dist/needle-engine.js.map +4 -4
- package/dist/needle-engine.min.js +19 -19
- package/dist/needle-engine.min.js.map +4 -4
- package/lib/engine/engine_physics.d.ts +9 -0
- package/lib/engine/engine_physics.js +34 -14
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_setup.d.ts +5 -5
- package/lib/engine/engine_setup.js +20 -20
- package/lib/engine/engine_setup.js.map +1 -1
- package/lib/engine/engine_types.d.ts +2 -0
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +1 -0
- package/lib/engine-components/Camera.js +7 -1
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CharacterController.d.ts +3 -0
- package/lib/engine-components/CharacterController.js +13 -1
- package/lib/engine-components/CharacterController.js.map +1 -1
- package/lib/engine-components/Collider.d.ts +0 -1
- package/lib/engine-components/Collider.js +0 -3
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/Joints.d.ts +15 -0
- package/lib/engine-components/Joints.js +42 -0
- package/lib/engine-components/Joints.js.map +1 -0
- package/lib/engine-components/OrbitControls.js +1 -1
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +1 -0
- package/lib/engine-components/codegen/components.js +1 -0
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/package.json +2 -2
- package/src/engine/codegen/register_types.js +4 -0
- package/src/engine/engine_physics.ts +44 -17
- package/src/engine/engine_setup.ts +27 -28
- package/src/engine/engine_types.ts +2 -0
- package/src/engine-components/Camera.ts +6 -1
- package/src/engine-components/CharacterController.ts +15 -1
- package/src/engine-components/Collider.ts +0 -4
- package/src/engine-components/Joints.ts +40 -0
- package/src/engine-components/OrbitControls.ts +1 -1
- package/src/engine-components/codegen/components.ts +1 -0
- package/src/include/console/ConsoleReroute.js +79 -0
- package/src/include/draco/draco_decoder.js +48 -0
- package/src/include/draco/draco_decoder.wasm +0 -0
- package/src/include/ktx2/basis_transcoder.js +21 -0
- package/src/include/ktx2/basis_transcoder.wasm +0 -0
- package/src/include/three/ARButton.js +208 -0
- package/src/include/three/DragControls.js +232 -0
- package/src/include/three/EXT_mesh_gpu_instancing_exporter.js +67 -0
- package/src/include/three/VRButton.js +196 -0
- package/src/include/three-mesh-ui-assets/backspace.png +0 -0
- package/src/include/three-mesh-ui-assets/enter.png +0 -0
- package/src/include/three-mesh-ui-assets/shift.png +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
const url = window.location.search;
|
|
3
|
+
const urlParams = new URLSearchParams(url);
|
|
4
|
+
if (!urlParams.has('debugconsole')) return;
|
|
5
|
+
|
|
6
|
+
const logNode = document.createElement("pre");
|
|
7
|
+
logNode.id = "log";
|
|
8
|
+
const logContainer = document.createElement("div");
|
|
9
|
+
logContainer.id = "log-container";
|
|
10
|
+
logContainer.appendChild(logNode);
|
|
11
|
+
|
|
12
|
+
window.addEventListener('DOMContentLoaded', (_) => {
|
|
13
|
+
const arOverlay = document.querySelector('.ar.overlay');
|
|
14
|
+
if(arOverlay)
|
|
15
|
+
arOverlay.appendChild(logContainer);
|
|
16
|
+
else
|
|
17
|
+
document.body.appendChild(logContainer);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
rewireLoggingToElement(
|
|
21
|
+
() => logNode,
|
|
22
|
+
() => logContainer, true);
|
|
23
|
+
|
|
24
|
+
window.onError = function(message, source, lineno, colno, error) {
|
|
25
|
+
console.error(message, source, lineno, colno, error);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.info("rewired console output");
|
|
29
|
+
console.info("User Agent: " + navigator.userAgent);
|
|
30
|
+
|
|
31
|
+
function rewireLoggingToElement(eleLocator, eleOverflowLocator, autoScroll) {
|
|
32
|
+
fixLoggingFunc('log');
|
|
33
|
+
fixLoggingFunc('debug');
|
|
34
|
+
fixLoggingFunc('warn');
|
|
35
|
+
fixLoggingFunc('error');
|
|
36
|
+
fixLoggingFunc('info');
|
|
37
|
+
|
|
38
|
+
function fixLoggingFunc(name) {
|
|
39
|
+
console['old' + name] = console[name];
|
|
40
|
+
console[name] = function(...args) {
|
|
41
|
+
const output = produceOutput(name, args);
|
|
42
|
+
const eleLog = eleLocator();
|
|
43
|
+
|
|
44
|
+
if (autoScroll) {
|
|
45
|
+
const eleContainerLog = eleOverflowLocator();
|
|
46
|
+
const isScrolledToBottom = eleContainerLog.scrollHeight - eleContainerLog.clientHeight <= eleContainerLog.scrollTop + 1;
|
|
47
|
+
eleLog.innerHTML += output + "<br>";
|
|
48
|
+
if (isScrolledToBottom) {
|
|
49
|
+
eleContainerLog.scrollTop = eleContainerLog.scrollHeight - eleContainerLog.clientHeight;
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
eleLog.innerHTML += output + "<br>";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console['old' + name].apply(undefined, args);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function produceOutput(name, args) {
|
|
60
|
+
return args.reduce((output, arg) => {
|
|
61
|
+
try {
|
|
62
|
+
return output +
|
|
63
|
+
"<span class=\"log-" + (typeof arg) + " log-" + name + "\">" +
|
|
64
|
+
(typeof arg === "object" && (JSON || {}).stringify ? JSON.stringify(arg) : arg) +
|
|
65
|
+
"</span> ";
|
|
66
|
+
}
|
|
67
|
+
catch(ex) {
|
|
68
|
+
console.error("exception when logging: " + ex);
|
|
69
|
+
}
|
|
70
|
+
}, '');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/*
|
|
74
|
+
setInterval(() => {
|
|
75
|
+
const method = (['log', 'debug', 'warn', 'error', 'info'][Math.floor(Math.random() * 5)]);
|
|
76
|
+
console[method](method, 'logging something...');
|
|
77
|
+
}, 200);
|
|
78
|
+
*/
|
|
79
|
+
})();
|