@margoengine/voxel-edit 0.1.0 → 1.0.0
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/LICENSE +201 -201
- package/NOTICE +4 -4
- package/README.md +446 -446
- package/dist/gpu.js +1 -1
- package/dist/mesh.d.ts +5 -4
- package/dist/{shaders-CcSeamtF.js → shaders-BaY4gcm9.js} +2 -2
- package/dist/shaders.js +1 -1
- package/package.json +132 -132
package/dist/gpu.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as e, l as t, o as n, s as r, u as i } from "./grid-B2V0TGLV.js";
|
|
2
|
-
import { a, c as o, i as s, n as c, r as l, s as u } from "./shaders-
|
|
2
|
+
import { a, c as o, i as s, n as c, r as l, s as u } from "./shaders-BaY4gcm9.js";
|
|
3
3
|
import { MargoError as d } from "@margoengine/math/errors";
|
|
4
4
|
//#region src/gpu.ts
|
|
5
5
|
var f = "\nfn brush(p: vec3<i32>, value: u32) -> u32 {\n if (param(7) == 0.0) {\n let lo = vec3<i32>(i32(param(0)), i32(param(1)), i32(param(2)));\n let hi = vec3<i32>(i32(param(3)), i32(param(4)), i32(param(5)));\n if (all(p >= lo) && all(p < hi)) { return u32(param(6)); }\n return value;\n }\n let d = p - info.tool_offset.xyz;\n if (any(abs(d) > vec3<i32>(128))) { return value; }\n if (f32(dot(d, d)) <= param(3)) { return u32(param(6)); }\n return value;\n}", p = "\nfn brush(p: vec3<i32>, value: u32) -> u32 {\n let t = tool(p);\n let op = u32(param(0));\n if (op == 2u) {\n if (t == 0u) { return 0u; }\n return value;\n }\n if (t == 0u) { return value; }\n if (op == 3u) { return 0u; }\n if (op == 0u && value != 0u) { return value; }\n return lookup(t);\n}", m = "\nfn brush(p: vec3<i32>, value: u32) -> u32 { return lookup(value); }", h = 16777216, g = /* @__PURE__ */ new WeakMap(), _ = (e, t, n) => {
|
package/dist/mesh.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ export declare function chamferGrid(source: VoxelGrid | SparseGrid, options: Cha
|
|
|
101
101
|
};
|
|
102
102
|
/** Options of {@link partitionMesh}. */
|
|
103
103
|
export interface PartitionOptions {
|
|
104
|
-
/** Most quads per part, 1 to 250,000 (
|
|
104
|
+
/** Most quads per part, 1 to 250,000 (four vertices a quad, a materials mesh's 1,000,000). Default 250,000. */
|
|
105
105
|
maxQuads?: number;
|
|
106
106
|
}
|
|
107
107
|
/** One upload-sized part of a {@link GridMesh}: quads of one palette index, in mesh order, 4 vertices each. */
|
|
@@ -120,8 +120,9 @@ export interface MeshPart {
|
|
|
120
120
|
quads: Uint32Array;
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
|
-
* Splits a mesh from {@link meshGrid} into parts
|
|
124
|
-
*
|
|
125
|
-
* holds `maxQuads`. Parts come in the order of their first quad; every
|
|
123
|
+
* Splits a mesh from {@link meshGrid} into parts one material mesh each can take (`createMesh` of
|
|
124
|
+
* `@margoengine/materials`, at most 1,000,000 vertices): quads are visited in mesh order and each goes to its palette
|
|
125
|
+
* index's open part, which closes once it holds `maxQuads`. Parts come in the order of their first quad; every
|
|
126
|
+
* attribute is copied, never recomputed.
|
|
126
127
|
*/
|
|
127
128
|
export declare function partitionMesh(mesh: GridMesh, options?: PartitionOptions): MeshPart[];
|
|
@@ -15,8 +15,8 @@ async function f(e, t, n) {
|
|
|
15
15
|
}), i = await r.getCompilationInfo(), o = await e.popErrorScope(), s = i.messages.filter((e) => e.type === "error");
|
|
16
16
|
if (o && !s.length) throw new a("failed", `Shader brush module is invalid: ${o.message}; fix the WGSL`);
|
|
17
17
|
if (s.length) {
|
|
18
|
-
let e = s[0], t = e.lineNum - c;
|
|
19
|
-
throw new a("failed", `Shader brush code does not compile: ${
|
|
18
|
+
let e = s[0], t = e.lineNum - c, n = e.message.trim().split("\n")[0].trim();
|
|
19
|
+
throw new a("failed", `Shader brush code does not compile: ${n} (${t > 0 ? `line ${t} of the brush code` : "in the prelude"}); fix the WGSL`);
|
|
20
20
|
}
|
|
21
21
|
let l = (e, t) => ({
|
|
22
22
|
binding: e,
|
package/dist/shaders.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ShaderBrush, o as brushSource, n as brushes } from "./shaders-
|
|
1
|
+
export { t as ShaderBrush, o as brushSource, n as brushes } from "./shaders-BaY4gcm9.js";
|
package/package.json
CHANGED
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@margoengine/voxel-edit",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Editing voxel models for editors and tools: dense and sparse grids, modeling operations, brushes and selections, picking, export meshing, .vox scene editing and frame animation.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"margoengine",
|
|
7
|
-
"webgpu",
|
|
8
|
-
"3d",
|
|
9
|
-
"voxel",
|
|
10
|
-
"edit"
|
|
11
|
-
],
|
|
12
|
-
"homepage": "https://margoengine.com",
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/scottcampbelldata/margoengine/issues"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/scottcampbelldata/margoengine.git",
|
|
19
|
-
"directory": "packages/voxel-edit"
|
|
20
|
-
},
|
|
21
|
-
"license": "Apache-2.0",
|
|
22
|
-
"author": "Scott Campbell",
|
|
23
|
-
"type": "module",
|
|
24
|
-
"sideEffects": false,
|
|
25
|
-
"exports": {
|
|
26
|
-
".": {
|
|
27
|
-
"types": "./dist/index.d.ts",
|
|
28
|
-
"import": "./dist/index.js"
|
|
29
|
-
},
|
|
30
|
-
"./edit": {
|
|
31
|
-
"types": "./dist/edit.d.ts",
|
|
32
|
-
"import": "./dist/edit.js"
|
|
33
|
-
},
|
|
34
|
-
"./pick": {
|
|
35
|
-
"types": "./dist/pick.d.ts",
|
|
36
|
-
"import": "./dist/pick.js"
|
|
37
|
-
},
|
|
38
|
-
"./sparse": {
|
|
39
|
-
"types": "./dist/sparse.d.ts",
|
|
40
|
-
"import": "./dist/sparse.js"
|
|
41
|
-
},
|
|
42
|
-
"./mesh": {
|
|
43
|
-
"types": "./dist/mesh.d.ts",
|
|
44
|
-
"import": "./dist/mesh.js"
|
|
45
|
-
},
|
|
46
|
-
"./vox": {
|
|
47
|
-
"types": "./dist/vox.d.ts",
|
|
48
|
-
"import": "./dist/vox.js"
|
|
49
|
-
},
|
|
50
|
-
"./animation": {
|
|
51
|
-
"types": "./dist/animation.d.ts",
|
|
52
|
-
"import": "./dist/animation.js"
|
|
53
|
-
},
|
|
54
|
-
"./history": {
|
|
55
|
-
"types": "./dist/history.d.ts",
|
|
56
|
-
"import": "./dist/history.js"
|
|
57
|
-
},
|
|
58
|
-
"./export": {
|
|
59
|
-
"types": "./dist/export.d.ts",
|
|
60
|
-
"import": "./dist/export.js"
|
|
61
|
-
},
|
|
62
|
-
"./formats": {
|
|
63
|
-
"types": "./dist/formats.d.ts",
|
|
64
|
-
"import": "./dist/formats.js"
|
|
65
|
-
},
|
|
66
|
-
"./assist": {
|
|
67
|
-
"types": "./dist/assist.d.ts",
|
|
68
|
-
"import": "./dist/assist.js"
|
|
69
|
-
},
|
|
70
|
-
"./library": {
|
|
71
|
-
"types": "./dist/library.d.ts",
|
|
72
|
-
"import": "./dist/library.js"
|
|
73
|
-
},
|
|
74
|
-
"./smooth": {
|
|
75
|
-
"types": "./dist/smooth.d.ts",
|
|
76
|
-
"import": "./dist/smooth.js"
|
|
77
|
-
},
|
|
78
|
-
"./voxelize": {
|
|
79
|
-
"types": "./dist/voxelize.d.ts",
|
|
80
|
-
"import": "./dist/voxelize.js"
|
|
81
|
-
},
|
|
82
|
-
"./shaders": {
|
|
83
|
-
"types": "./dist/shaders.d.ts",
|
|
84
|
-
"import": "./dist/shaders.js"
|
|
85
|
-
},
|
|
86
|
-
"./rig": {
|
|
87
|
-
"types": "./dist/rig.d.ts",
|
|
88
|
-
"import": "./dist/rig.js"
|
|
89
|
-
},
|
|
90
|
-
"./gpu": {
|
|
91
|
-
"types": "./dist/gpu.d.ts",
|
|
92
|
-
"import": "./dist/gpu.js"
|
|
93
|
-
},
|
|
94
|
-
"./collab": {
|
|
95
|
-
"types": "./dist/collab.d.ts",
|
|
96
|
-
"import": "./dist/collab.js"
|
|
97
|
-
},
|
|
98
|
-
"./generate": {
|
|
99
|
-
"types": "./dist/generate.d.ts",
|
|
100
|
-
"import": "./dist/generate.js"
|
|
101
|
-
},
|
|
102
|
-
"./select": {
|
|
103
|
-
"types": "./dist/select.d.ts",
|
|
104
|
-
"import": "./dist/select.js"
|
|
105
|
-
},
|
|
106
|
-
"./formats-extra": {
|
|
107
|
-
"types": "./dist/formats-extra.d.ts",
|
|
108
|
-
"import": "./dist/formats-extra.js"
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"files": [
|
|
112
|
-
"dist",
|
|
113
|
-
"LICENSE",
|
|
114
|
-
"NOTICE"
|
|
115
|
-
],
|
|
116
|
-
"publishConfig": {
|
|
117
|
-
"access": "public"
|
|
118
|
-
},
|
|
119
|
-
"dependencies": {
|
|
120
|
-
"@margoengine/decoders": "^
|
|
121
|
-
"@margoengine/math": "^
|
|
122
|
-
"@margoengine/voxel": "^
|
|
123
|
-
"@margoengine/loaders": "^
|
|
124
|
-
},
|
|
125
|
-
"scripts": {
|
|
126
|
-
"build": "node ../../scripts/build-optional.js voxel-edit",
|
|
127
|
-
"test": "npm run build && node --test tests/*.test.js",
|
|
128
|
-
"test:gpu": "cd ../.. && node packages/voxel-edit/tests/shaders-browser-check.mjs && node packages/voxel-edit/tests/gpu-browser-check.mjs",
|
|
129
|
-
"prepack": "npm run build",
|
|
130
|
-
"test:browser:generate": "cd ../.. && node packages/voxel-edit/tests/generate-browser-check.mjs"
|
|
131
|
-
}
|
|
132
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@margoengine/voxel-edit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Editing voxel models for editors and tools: dense and sparse grids, modeling operations, brushes and selections, picking, export meshing, .vox scene editing and frame animation.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"margoengine",
|
|
7
|
+
"webgpu",
|
|
8
|
+
"3d",
|
|
9
|
+
"voxel",
|
|
10
|
+
"edit"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://margoengine.com",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/scottcampbelldata/margoengine/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/scottcampbelldata/margoengine.git",
|
|
19
|
+
"directory": "packages/voxel-edit"
|
|
20
|
+
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"author": "Scott Campbell",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./edit": {
|
|
31
|
+
"types": "./dist/edit.d.ts",
|
|
32
|
+
"import": "./dist/edit.js"
|
|
33
|
+
},
|
|
34
|
+
"./pick": {
|
|
35
|
+
"types": "./dist/pick.d.ts",
|
|
36
|
+
"import": "./dist/pick.js"
|
|
37
|
+
},
|
|
38
|
+
"./sparse": {
|
|
39
|
+
"types": "./dist/sparse.d.ts",
|
|
40
|
+
"import": "./dist/sparse.js"
|
|
41
|
+
},
|
|
42
|
+
"./mesh": {
|
|
43
|
+
"types": "./dist/mesh.d.ts",
|
|
44
|
+
"import": "./dist/mesh.js"
|
|
45
|
+
},
|
|
46
|
+
"./vox": {
|
|
47
|
+
"types": "./dist/vox.d.ts",
|
|
48
|
+
"import": "./dist/vox.js"
|
|
49
|
+
},
|
|
50
|
+
"./animation": {
|
|
51
|
+
"types": "./dist/animation.d.ts",
|
|
52
|
+
"import": "./dist/animation.js"
|
|
53
|
+
},
|
|
54
|
+
"./history": {
|
|
55
|
+
"types": "./dist/history.d.ts",
|
|
56
|
+
"import": "./dist/history.js"
|
|
57
|
+
},
|
|
58
|
+
"./export": {
|
|
59
|
+
"types": "./dist/export.d.ts",
|
|
60
|
+
"import": "./dist/export.js"
|
|
61
|
+
},
|
|
62
|
+
"./formats": {
|
|
63
|
+
"types": "./dist/formats.d.ts",
|
|
64
|
+
"import": "./dist/formats.js"
|
|
65
|
+
},
|
|
66
|
+
"./assist": {
|
|
67
|
+
"types": "./dist/assist.d.ts",
|
|
68
|
+
"import": "./dist/assist.js"
|
|
69
|
+
},
|
|
70
|
+
"./library": {
|
|
71
|
+
"types": "./dist/library.d.ts",
|
|
72
|
+
"import": "./dist/library.js"
|
|
73
|
+
},
|
|
74
|
+
"./smooth": {
|
|
75
|
+
"types": "./dist/smooth.d.ts",
|
|
76
|
+
"import": "./dist/smooth.js"
|
|
77
|
+
},
|
|
78
|
+
"./voxelize": {
|
|
79
|
+
"types": "./dist/voxelize.d.ts",
|
|
80
|
+
"import": "./dist/voxelize.js"
|
|
81
|
+
},
|
|
82
|
+
"./shaders": {
|
|
83
|
+
"types": "./dist/shaders.d.ts",
|
|
84
|
+
"import": "./dist/shaders.js"
|
|
85
|
+
},
|
|
86
|
+
"./rig": {
|
|
87
|
+
"types": "./dist/rig.d.ts",
|
|
88
|
+
"import": "./dist/rig.js"
|
|
89
|
+
},
|
|
90
|
+
"./gpu": {
|
|
91
|
+
"types": "./dist/gpu.d.ts",
|
|
92
|
+
"import": "./dist/gpu.js"
|
|
93
|
+
},
|
|
94
|
+
"./collab": {
|
|
95
|
+
"types": "./dist/collab.d.ts",
|
|
96
|
+
"import": "./dist/collab.js"
|
|
97
|
+
},
|
|
98
|
+
"./generate": {
|
|
99
|
+
"types": "./dist/generate.d.ts",
|
|
100
|
+
"import": "./dist/generate.js"
|
|
101
|
+
},
|
|
102
|
+
"./select": {
|
|
103
|
+
"types": "./dist/select.d.ts",
|
|
104
|
+
"import": "./dist/select.js"
|
|
105
|
+
},
|
|
106
|
+
"./formats-extra": {
|
|
107
|
+
"types": "./dist/formats-extra.d.ts",
|
|
108
|
+
"import": "./dist/formats-extra.js"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"files": [
|
|
112
|
+
"dist",
|
|
113
|
+
"LICENSE",
|
|
114
|
+
"NOTICE"
|
|
115
|
+
],
|
|
116
|
+
"publishConfig": {
|
|
117
|
+
"access": "public"
|
|
118
|
+
},
|
|
119
|
+
"dependencies": {
|
|
120
|
+
"@margoengine/decoders": "^1.0.0",
|
|
121
|
+
"@margoengine/math": "^1.0.0",
|
|
122
|
+
"@margoengine/voxel": "^1.0.0",
|
|
123
|
+
"@margoengine/loaders": "^1.0.0"
|
|
124
|
+
},
|
|
125
|
+
"scripts": {
|
|
126
|
+
"build": "node ../../scripts/build-optional.js voxel-edit",
|
|
127
|
+
"test": "npm run build && node --test tests/*.test.js",
|
|
128
|
+
"test:gpu": "cd ../.. && node packages/voxel-edit/tests/shaders-browser-check.mjs && node packages/voxel-edit/tests/gpu-browser-check.mjs",
|
|
129
|
+
"prepack": "npm run build",
|
|
130
|
+
"test:browser:generate": "cd ../.. && node packages/voxel-edit/tests/generate-browser-check.mjs"
|
|
131
|
+
}
|
|
132
|
+
}
|