@srsergio/taptapp-ar 1.0.6 → 1.0.7
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.
|
@@ -7,45 +7,14 @@
|
|
|
7
7
|
*
|
|
8
8
|
* All methods have pure JS fallbacks that work universally.
|
|
9
9
|
*/
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
process.versions.node != null;
|
|
14
|
-
// Lazy load GPU.js only in browser environments
|
|
15
|
-
let GPU = null;
|
|
16
|
-
let gpuInstance = null;
|
|
17
|
-
let gpuLoadAttempted = false;
|
|
10
|
+
// This module now uses pure JavaScript for all operations to ensure
|
|
11
|
+
// zero-dependency builds and universal compatibility (Node.js & Browser).
|
|
12
|
+
// The pure JS implementations are highly optimized for performance.
|
|
18
13
|
/**
|
|
19
|
-
*
|
|
14
|
+
* No-op initialization for compatibility
|
|
20
15
|
*/
|
|
21
16
|
const tryInitGPU = () => {
|
|
22
|
-
|
|
23
|
-
return gpuInstance;
|
|
24
|
-
gpuLoadAttempted = true;
|
|
25
|
-
// Skip GPU.js in Node.js to avoid headless-gl issues
|
|
26
|
-
if (isNode) {
|
|
27
|
-
console.log("⚡ Running in Node.js - using optimized JS");
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
// Dynamically import GPU.js in browser
|
|
31
|
-
try {
|
|
32
|
-
// Use dynamic import pattern that works in browsers
|
|
33
|
-
const GPUModule = globalThis.GPU || (typeof require !== 'undefined' ? require('gpu.js').GPU : null);
|
|
34
|
-
if (GPUModule) {
|
|
35
|
-
GPU = GPUModule;
|
|
36
|
-
gpuInstance = new GPU({ mode: "gpu" });
|
|
37
|
-
// Test if GPU works
|
|
38
|
-
const testKernel = gpuInstance.createKernel(function () { return 1; }).setOutput([1]);
|
|
39
|
-
testKernel();
|
|
40
|
-
testKernel.destroy();
|
|
41
|
-
console.log("🚀 GPU.js: Using GPU acceleration");
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
console.log("⚡ GPU.js unavailable, using optimized JS:", e.message);
|
|
46
|
-
gpuInstance = null;
|
|
47
|
-
}
|
|
48
|
-
return gpuInstance;
|
|
17
|
+
return null;
|
|
49
18
|
};
|
|
50
19
|
// ============================================================================
|
|
51
20
|
// PURE JAVASCRIPT IMPLEMENTATIONS (Always work)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srsergio/taptapp-ar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "AR Visualizer and Compiler for Astro and React",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
44
|
-
"gpu.js": "^2.16.0",
|
|
45
44
|
"ml-matrix": "^6.10.4",
|
|
46
45
|
"tinyqueue": "^2.0.3"
|
|
47
46
|
},
|
|
@@ -8,50 +8,15 @@
|
|
|
8
8
|
* All methods have pure JS fallbacks that work universally.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
process.versions.node != null;
|
|
15
|
-
|
|
16
|
-
// Lazy load GPU.js only in browser environments
|
|
17
|
-
let GPU = null;
|
|
18
|
-
let gpuInstance = null;
|
|
19
|
-
let gpuLoadAttempted = false;
|
|
11
|
+
// This module now uses pure JavaScript for all operations to ensure
|
|
12
|
+
// zero-dependency builds and universal compatibility (Node.js & Browser).
|
|
13
|
+
// The pure JS implementations are highly optimized for performance.
|
|
20
14
|
|
|
21
15
|
/**
|
|
22
|
-
*
|
|
16
|
+
* No-op initialization for compatibility
|
|
23
17
|
*/
|
|
24
18
|
const tryInitGPU = () => {
|
|
25
|
-
|
|
26
|
-
gpuLoadAttempted = true;
|
|
27
|
-
|
|
28
|
-
// Skip GPU.js in Node.js to avoid headless-gl issues
|
|
29
|
-
if (isNode) {
|
|
30
|
-
console.log("⚡ Running in Node.js - using optimized JS");
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Dynamically import GPU.js in browser
|
|
35
|
-
try {
|
|
36
|
-
// Use dynamic import pattern that works in browsers
|
|
37
|
-
const GPUModule = globalThis.GPU || (typeof require !== 'undefined' ? require('gpu.js').GPU : null);
|
|
38
|
-
if (GPUModule) {
|
|
39
|
-
GPU = GPUModule;
|
|
40
|
-
gpuInstance = new GPU({ mode: "gpu" });
|
|
41
|
-
|
|
42
|
-
// Test if GPU works
|
|
43
|
-
const testKernel = gpuInstance.createKernel(function () { return 1; }).setOutput([1]);
|
|
44
|
-
testKernel();
|
|
45
|
-
testKernel.destroy();
|
|
46
|
-
|
|
47
|
-
console.log("🚀 GPU.js: Using GPU acceleration");
|
|
48
|
-
}
|
|
49
|
-
} catch (e) {
|
|
50
|
-
console.log("⚡ GPU.js unavailable, using optimized JS:", e.message);
|
|
51
|
-
gpuInstance = null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return gpuInstance;
|
|
19
|
+
return null;
|
|
55
20
|
};
|
|
56
21
|
|
|
57
22
|
// ============================================================================
|