@gridspace/raster-path 1.0.3 → 1.0.5
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/README.md +3 -5
- package/build/app.js +363 -39
- package/build/index.html +40 -2
- package/build/raster-path.js +16 -24
- package/build/raster-worker.js +2450 -0
- package/build/style.css +65 -0
- package/package.json +12 -4
- package/scripts/build-shaders.js +32 -8
- package/src/core/path-planar.js +788 -0
- package/src/core/path-radial.js +651 -0
- package/src/core/raster-config.js +185 -0
- package/src/{index.js → core/raster-path.js} +16 -24
- package/src/core/raster-planar.js +754 -0
- package/src/core/raster-tool.js +104 -0
- package/src/core/raster-worker.js +152 -0
- package/src/core/workload-calibrate.js +416 -0
- package/src/shaders/{radial-raster-v2.wgsl → radial-raster.wgsl} +8 -2
- package/src/shaders/workload-calibrate.wgsl +106 -0
- package/src/test/batch-divisor-benchmark.cjs +286 -0
- package/src/test/calibrate-test.cjs +136 -0
- package/src/test/extreme-work-test.cjs +167 -0
- package/src/test/lathe-cylinder-2-debug.cjs +334 -0
- package/src/test/lathe-cylinder-2-test.cjs +157 -0
- package/src/test/lathe-cylinder-test.cjs +198 -0
- package/src/test/radial-thread-limit-test.cjs +152 -0
- package/src/test/work-estimation-profile.cjs +406 -0
- package/src/test/workload-calculator-demo.cjs +113 -0
- package/src/test/workload-calibration.cjs +310 -0
- package/src/web/app.js +363 -39
- package/src/web/index.html +40 -2
- package/src/web/style.css +65 -0
- package/src/workload-calculator.js +318 -0
- package/build/webgpu-worker.js +0 -3011
- package/src/web/webgpu-worker.js +0 -2520
package/build/style.css
CHANGED
|
@@ -23,10 +23,26 @@ body {
|
|
|
23
23
|
height: 100%;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
.model-controls {
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 20px;
|
|
29
|
+
left: 20px;
|
|
30
|
+
background: rgba(0, 0, 0, 0.85);
|
|
31
|
+
backdrop-filter: blur(10px);
|
|
32
|
+
border: 1px solid #333;
|
|
33
|
+
border-radius: 8px;
|
|
34
|
+
padding: 20px;
|
|
35
|
+
min-width: 200px;
|
|
36
|
+
max-width: 240px;
|
|
37
|
+
z-index: 100;
|
|
38
|
+
}
|
|
39
|
+
|
|
26
40
|
.controls {
|
|
27
41
|
position: absolute;
|
|
28
42
|
top: 20px;
|
|
29
43
|
right: 20px;
|
|
44
|
+
bottom: 20px;
|
|
45
|
+
overflow-y: auto;
|
|
30
46
|
background: rgba(0, 0, 0, 0.85);
|
|
31
47
|
backdrop-filter: blur(10px);
|
|
32
48
|
border: 1px solid #333;
|
|
@@ -156,3 +172,52 @@ input[type="checkbox"] {
|
|
|
156
172
|
.hide {
|
|
157
173
|
display: none;
|
|
158
174
|
}
|
|
175
|
+
|
|
176
|
+
/* Rotation controls */
|
|
177
|
+
.rotation-controls {
|
|
178
|
+
display: flex;
|
|
179
|
+
flex-direction: column;
|
|
180
|
+
gap: 8px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.rotation-row {
|
|
184
|
+
display: flex;
|
|
185
|
+
align-items: center;
|
|
186
|
+
gap: 6px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.rotation-label {
|
|
190
|
+
font-size: 13px;
|
|
191
|
+
font-weight: 600;
|
|
192
|
+
min-width: 18px;
|
|
193
|
+
color: #00ffff;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.rotate-btn {
|
|
197
|
+
flex: 1;
|
|
198
|
+
padding: 6px 10px;
|
|
199
|
+
font-size: 11px;
|
|
200
|
+
font-weight: 600;
|
|
201
|
+
background: rgba(0, 255, 255, 0.08);
|
|
202
|
+
border: 1px solid #00ffff;
|
|
203
|
+
border-radius: 4px;
|
|
204
|
+
color: #00ffff;
|
|
205
|
+
cursor: pointer;
|
|
206
|
+
transition: all 0.2s ease;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.rotate-btn:hover {
|
|
210
|
+
background: rgba(0, 255, 255, 0.15);
|
|
211
|
+
box-shadow: 0 0 6px rgba(0, 255, 255, 0.2);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.rotate-btn:active {
|
|
215
|
+
background: rgba(0, 255, 255, 0.25);
|
|
216
|
+
transform: scale(0.98);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.btn-small {
|
|
220
|
+
padding: 6px 10px;
|
|
221
|
+
font-size: 11px;
|
|
222
|
+
margin-top: 4px;
|
|
223
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridspace/raster-path",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Terrain and Tool Raster Path Finder using WebGPU",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/raster-path.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./build/raster-path.js",
|
|
10
|
-
"./worker": "./build/
|
|
10
|
+
"./worker": "./build/raster-worker.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"build/**/*",
|
|
@@ -29,14 +29,22 @@
|
|
|
29
29
|
"postinstall": "npm run build",
|
|
30
30
|
"build": "npm run clean && npm run build:web && npm run build:shaders",
|
|
31
31
|
"build:shaders": "node scripts/build-shaders.js",
|
|
32
|
-
"build:web": "mkdir -p build && cp src/web/*.html src/web/*.css src/web/*.js build/ && cp src/
|
|
32
|
+
"build:web": "mkdir -p build && cp src/web/*.html src/web/*.css src/web/*.js build/ && cp src/core/raster-path.js build/raster-path.js && cp src/etc/serve.json build/",
|
|
33
33
|
"clean": "rm -rf build/",
|
|
34
34
|
"dev": "npm run build && npm run serve",
|
|
35
35
|
"serve": "npx serve build --config serve.json --listen 9090",
|
|
36
|
+
"publish": "npm publish --access public",
|
|
36
37
|
"test": "npm run test:planar && npm run test:radial",
|
|
37
38
|
"test:planar": "npm run build && npx electron src/test/planar-test.cjs",
|
|
38
39
|
"test:planar-tiling": "npm run build && npx electron src/test/planar-tiling-test.cjs",
|
|
39
|
-
"test:radial": "npm run build && npx electron src/test/radial-test.cjs"
|
|
40
|
+
"test:radial": "npm run build && npx electron src/test/radial-test.cjs",
|
|
41
|
+
"test:calibrate": "npm run build && npx electron src/test/calibrate-test.cjs",
|
|
42
|
+
"test:batch-divisor": "npm run build && npx electron src/test/batch-divisor-benchmark.cjs",
|
|
43
|
+
"test:work-estimation": "npm run build && npx electron src/test/work-estimation-profile.cjs",
|
|
44
|
+
"test:workload-calibration": "npm run build && npx electron src/test/workload-calibration.cjs",
|
|
45
|
+
"test:lathe-cylinder-2-debug": "npm run build && npx electron src/test/lathe-cylinder-2-debug.cjs",
|
|
46
|
+
"test:extreme-work": "npm run build && npx electron src/test/extreme-work-test.cjs",
|
|
47
|
+
"test:radial-thread-limit": "npm run build && npx electron src/test/radial-thread-limit-test.cjs"
|
|
40
48
|
},
|
|
41
49
|
"keywords": [
|
|
42
50
|
"cnc",
|
package/scripts/build-shaders.js
CHANGED
|
@@ -1,27 +1,47 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Build script:
|
|
3
|
+
* Build script: Bundle worker modules with esbuild, then inject shader code
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* 1. Bundle all worker modules (raster-worker.js + imports) into single file
|
|
6
|
+
* 2. Replace shader placeholders like 'SHADER:radial-raster' with shader file contents
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
import fs from 'fs';
|
|
9
10
|
import path from 'path';
|
|
10
11
|
import { fileURLToPath } from 'url';
|
|
12
|
+
import * as esbuild from 'esbuild';
|
|
11
13
|
|
|
12
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
15
|
const __dirname = path.dirname(__filename);
|
|
14
16
|
|
|
15
17
|
const SHADER_DIR = path.join(__dirname, '../src/shaders');
|
|
16
|
-
const WORKER_SRC = path.join(__dirname, '../src/
|
|
18
|
+
const WORKER_SRC = path.join(__dirname, '../src/core/raster-worker.js');
|
|
17
19
|
const BUILD_DIR = path.join(__dirname, '../build');
|
|
18
|
-
const
|
|
20
|
+
const WORKER_BUNDLED = path.join(BUILD_DIR, 'raster-worker.bundled.js');
|
|
21
|
+
const WORKER_DEST = path.join(BUILD_DIR, 'raster-worker.js');
|
|
19
22
|
|
|
20
|
-
//
|
|
21
|
-
|
|
23
|
+
// Ensure build directory exists
|
|
24
|
+
if (!fs.existsSync(BUILD_DIR)) {
|
|
25
|
+
fs.mkdirSync(BUILD_DIR, { recursive: true });
|
|
26
|
+
}
|
|
22
27
|
|
|
23
|
-
//
|
|
24
|
-
|
|
28
|
+
// Step 1: Bundle worker modules with esbuild
|
|
29
|
+
console.log('📦 Bundling worker modules with esbuild...');
|
|
30
|
+
await esbuild.build({
|
|
31
|
+
entryPoints: [WORKER_SRC],
|
|
32
|
+
bundle: true,
|
|
33
|
+
format: 'esm',
|
|
34
|
+
outfile: WORKER_BUNDLED,
|
|
35
|
+
platform: 'browser',
|
|
36
|
+
target: 'es2020',
|
|
37
|
+
});
|
|
38
|
+
console.log(`✅ Bundled: ${WORKER_BUNDLED}`);
|
|
39
|
+
|
|
40
|
+
// Step 2: Read bundled code and inject shaders
|
|
41
|
+
let workerCode = fs.readFileSync(WORKER_BUNDLED, 'utf8');
|
|
42
|
+
|
|
43
|
+
// Find all shader placeholders (handle both single and double quotes)
|
|
44
|
+
const shaderRegex = /['"]SHADER:([a-z0-9-]+)['"]/g;
|
|
25
45
|
let match;
|
|
26
46
|
const replacements = [];
|
|
27
47
|
|
|
@@ -63,3 +83,7 @@ console.log(`🔨 Build ID: ${buildId}`);
|
|
|
63
83
|
// Write output
|
|
64
84
|
fs.writeFileSync(WORKER_DEST, workerCode, 'utf8');
|
|
65
85
|
console.log(`✅ Built: ${WORKER_DEST}`);
|
|
86
|
+
|
|
87
|
+
// Clean up intermediate bundled file
|
|
88
|
+
fs.unlinkSync(WORKER_BUNDLED);
|
|
89
|
+
console.log('🧹 Cleaned up intermediate bundle');
|