threejs-debug-compose 0.1.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 +21 -0
- package/README.md +162 -0
- package/assets/readme-compose-banner.png +0 -0
- package/assets/viewport-compose-quad.png +0 -0
- package/dist/custom-debug-view.js +13 -0
- package/dist/debug-render-graph-plan.js +38 -0
- package/dist/debug-render-plan.js +86 -0
- package/dist/debug-view-definitions.js +91 -0
- package/dist/debug-view-layout.js +65 -0
- package/dist/debug-view-selection.js +33 -0
- package/dist/debug-viewport-labels.js +28 -0
- package/dist/debug-viewport-plan.js +51 -0
- package/dist/debug-viewport-presenter.js +33 -0
- package/dist/debug-views-post.js +329 -0
- package/dist/debug-views-tsl/ao-fallbacks.js +103 -0
- package/dist/debug-views-tsl/compositor.js +51 -0
- package/dist/debug-views-tsl/default-debug-nodes.js +61 -0
- package/dist/debug-views-tsl/uniforms.js +19 -0
- package/dist/debug-views-tsl/visualize.js +21 -0
- package/dist/index.js +11 -0
- package/dist/react.js +3 -0
- package/dist/shader-cost/cost-override.js +67 -0
- package/dist/shader-cost/material-cost.js +302 -0
- package/dist/types/custom-debug-view.d.ts +17 -0
- package/dist/types/debug-render-graph-plan.d.ts +17 -0
- package/dist/types/debug-render-plan.d.ts +26 -0
- package/dist/types/debug-view-definitions.d.ts +60 -0
- package/dist/types/debug-view-layout.d.ts +21 -0
- package/dist/types/debug-view-selection.d.ts +5 -0
- package/dist/types/debug-viewport-labels.d.ts +8 -0
- package/dist/types/debug-viewport-plan.d.ts +29 -0
- package/dist/types/debug-viewport-presenter.d.ts +28 -0
- package/dist/types/debug-views-post.d.ts +19 -0
- package/dist/types/debug-views-tsl/ao-fallbacks.d.ts +6 -0
- package/dist/types/debug-views-tsl/compositor.d.ts +20 -0
- package/dist/types/debug-views-tsl/default-debug-nodes.d.ts +35 -0
- package/dist/types/debug-views-tsl/node-types.d.ts +6 -0
- package/dist/types/debug-views-tsl/uniforms.d.ts +12 -0
- package/dist/types/debug-views-tsl/visualize.d.ts +5 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/react.d.ts +2 -0
- package/dist/types/shader-cost/cost-override.d.ts +20 -0
- package/dist/types/shader-cost/material-cost.d.ts +15 -0
- package/dist/types/use-debug-views-controls.d.ts +16 -0
- package/dist/use-debug-views-controls.js +77 -0
- package/package.json +101 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Material } from "three";
|
|
2
|
+
export interface MaterialCostEntry {
|
|
3
|
+
cost: number;
|
|
4
|
+
signature: string;
|
|
5
|
+
signals: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export interface MaterialCostCache {
|
|
8
|
+
get(material: Material): MaterialCostEntry;
|
|
9
|
+
clear(): void;
|
|
10
|
+
readonly size: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function scoreMaterialCost(material: Material): number;
|
|
13
|
+
export declare function createMaterialCostCache(): MaterialCostCache;
|
|
14
|
+
export declare function getMaterialCostSignature(material: Material): string;
|
|
15
|
+
export declare function getMaterialCostSignals(material: Material): string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface UseDebugViewsControlsOptions {
|
|
2
|
+
viewLabels?: string[];
|
|
3
|
+
maxLayoutSlots?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function useDebugViewsControls(options?: UseDebugViewsControlsOptions): {
|
|
6
|
+
mode: string;
|
|
7
|
+
layout: string;
|
|
8
|
+
activeView: number;
|
|
9
|
+
overlayOpacity: number;
|
|
10
|
+
columns: number;
|
|
11
|
+
rows: number;
|
|
12
|
+
slots: number;
|
|
13
|
+
showLabels: boolean;
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useControls as e } from "leva";
|
|
2
|
+
//#region components/debug-views/use-debug-views-controls.ts
|
|
3
|
+
function t(t = {}) {
|
|
4
|
+
let { viewLabels: n = [
|
|
5
|
+
"Beauty",
|
|
6
|
+
"Normal",
|
|
7
|
+
"Depth"
|
|
8
|
+
], maxLayoutSlots: r } = t, i = Math.max(1, r ?? n.length), a = Math.min(4, i), o = {};
|
|
9
|
+
for (let e = 0; e < n.length; e++) o[n[e]] = e;
|
|
10
|
+
return e("Debug", {
|
|
11
|
+
enabled: {
|
|
12
|
+
label: "Enabled",
|
|
13
|
+
value: !0
|
|
14
|
+
},
|
|
15
|
+
showLabels: {
|
|
16
|
+
label: "Viewport labels",
|
|
17
|
+
value: !0
|
|
18
|
+
},
|
|
19
|
+
mode: {
|
|
20
|
+
label: "Mode",
|
|
21
|
+
value: "compose",
|
|
22
|
+
options: {
|
|
23
|
+
Compose: "compose",
|
|
24
|
+
Viewport: "viewport"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
activeView: {
|
|
28
|
+
label: "View",
|
|
29
|
+
value: 0,
|
|
30
|
+
options: o
|
|
31
|
+
},
|
|
32
|
+
layout: {
|
|
33
|
+
label: "Layout",
|
|
34
|
+
value: "single",
|
|
35
|
+
options: {
|
|
36
|
+
Single: "single",
|
|
37
|
+
Overlay: "overlay",
|
|
38
|
+
"Split H": "split-h",
|
|
39
|
+
"Split V": "split-v",
|
|
40
|
+
Quad: "quad",
|
|
41
|
+
Row: "row",
|
|
42
|
+
Column: "column",
|
|
43
|
+
Grid: "grid"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
slots: {
|
|
47
|
+
label: "Slots",
|
|
48
|
+
value: a,
|
|
49
|
+
min: 1,
|
|
50
|
+
max: i,
|
|
51
|
+
step: 1
|
|
52
|
+
},
|
|
53
|
+
columns: {
|
|
54
|
+
label: "Columns",
|
|
55
|
+
value: 2,
|
|
56
|
+
min: 1,
|
|
57
|
+
max: i,
|
|
58
|
+
step: 1
|
|
59
|
+
},
|
|
60
|
+
rows: {
|
|
61
|
+
label: "Rows",
|
|
62
|
+
value: 2,
|
|
63
|
+
min: 1,
|
|
64
|
+
max: i,
|
|
65
|
+
step: 1
|
|
66
|
+
},
|
|
67
|
+
overlayOpacity: {
|
|
68
|
+
label: "Blend opacity",
|
|
69
|
+
value: .35,
|
|
70
|
+
min: 0,
|
|
71
|
+
max: 1,
|
|
72
|
+
step: .01
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { t as useDebugViewsControls };
|
package/package.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "threejs-debug-compose",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Composable TSL debug views for Three.js WebGPU render pipelines.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/types/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./react": {
|
|
17
|
+
"types": "./dist/types/react.d.ts",
|
|
18
|
+
"import": "./dist/react.js"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"assets/readme-compose-banner.png",
|
|
25
|
+
"assets/viewport-compose-quad.png",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"dev": "C:\\Progra~1\\nodejs\\node.exe ./node_modules/vite/bin/vite.js --host 0.0.0.0 --port 3000",
|
|
31
|
+
"preview": "C:\\Progra~1\\nodejs\\node.exe ./node_modules/vite/bin/vite.js preview --host 0.0.0.0 --port 3000",
|
|
32
|
+
"build": "pnpm build:lib && pnpm build:types",
|
|
33
|
+
"build:lib": "C:\\Progra~1\\nodejs\\node.exe ./node_modules/vite/bin/vite.js build",
|
|
34
|
+
"build:types": "C:\\Progra~1\\nodejs\\node.exe ./node_modules/typescript/bin/tsc -p tsconfig.build.json",
|
|
35
|
+
"typecheck": "C:\\Progra~1\\nodejs\\node.exe ./node_modules/typescript/bin/tsc --noEmit",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"prepublishOnly": "pnpm typecheck && pnpm test && pnpm build",
|
|
38
|
+
"docs:dev": "pnpm --filter @threejs-debug-compose/docs dev",
|
|
39
|
+
"docs:build": "pnpm --filter @threejs-debug-compose/docs build",
|
|
40
|
+
"docs:preview": "pnpm --filter @threejs-debug-compose/docs preview"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@react-three/drei": ">=10",
|
|
44
|
+
"@react-three/fiber": ">=9",
|
|
45
|
+
"leva": ">=0.10",
|
|
46
|
+
"react": ">=19",
|
|
47
|
+
"react-dom": ">=19",
|
|
48
|
+
"three": ">=0.184"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"@react-three/drei": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
54
|
+
"@react-three/fiber": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"leva": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"react": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"react-dom": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@react-three/drei": "10.7.7",
|
|
69
|
+
"@react-three/fiber": "9.6.1",
|
|
70
|
+
"@types/node": "25.9.1",
|
|
71
|
+
"@types/react": "19.2.15",
|
|
72
|
+
"@types/react-dom": "19.2.3",
|
|
73
|
+
"@types/three": "0.184.1",
|
|
74
|
+
"@vitejs/plugin-react": "6.0.2",
|
|
75
|
+
"leva": "0.10.1",
|
|
76
|
+
"react": "19.2.6",
|
|
77
|
+
"react-dom": "19.2.6",
|
|
78
|
+
"three": "0.184.0",
|
|
79
|
+
"typescript": "6.0.3",
|
|
80
|
+
"vite": "8.0.14",
|
|
81
|
+
"vitest": "^4.1.7"
|
|
82
|
+
},
|
|
83
|
+
"repository": {
|
|
84
|
+
"type": "git",
|
|
85
|
+
"url": "git+https://github.com/tonyblu331/threejs-debug-compose.git"
|
|
86
|
+
},
|
|
87
|
+
"bugs": {
|
|
88
|
+
"url": "https://github.com/tonyblu331/threejs-debug-compose/issues"
|
|
89
|
+
},
|
|
90
|
+
"homepage": "https://github.com/tonyblu331/threejs-debug-compose#readme",
|
|
91
|
+
"keywords": [
|
|
92
|
+
"threejs",
|
|
93
|
+
"webgpu",
|
|
94
|
+
"tsl",
|
|
95
|
+
"debug",
|
|
96
|
+
"rendering"
|
|
97
|
+
],
|
|
98
|
+
"publishConfig": {
|
|
99
|
+
"access": "public"
|
|
100
|
+
}
|
|
101
|
+
}
|