@s0rt/3dvf 0.1.3 → 0.1.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.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# __PROJECT_NAME__
|
|
2
|
+
|
|
3
|
+
A Three.js WebGPU project scaffolded with [3dvf](https://github.com/s0rt/3dvf).
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
__DEV_CMD__
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Adding functions
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx 3dvf add <function-name>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
List available functions:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx 3dvf list
|
|
21
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>__PROJECT_NAME__</title>
|
|
7
|
+
<style>
|
|
8
|
+
* {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
body {
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
background: #000;
|
|
16
|
+
}
|
|
17
|
+
#app {
|
|
18
|
+
width: 100vw;
|
|
19
|
+
height: 100vh;
|
|
20
|
+
}
|
|
21
|
+
</style>
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<div id="app"></div>
|
|
25
|
+
<script type="module" src="/src/main.ts"></script>
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Scene,
|
|
3
|
+
Color,
|
|
4
|
+
PerspectiveCamera,
|
|
5
|
+
BoxGeometry,
|
|
6
|
+
MeshPhongMaterial,
|
|
7
|
+
Mesh,
|
|
8
|
+
AmbientLight,
|
|
9
|
+
DirectionalLight,
|
|
10
|
+
} from "three";
|
|
11
|
+
import { getWebGPUViewer } from "./lib/3dvf/get-webgpu-viewer";
|
|
12
|
+
|
|
13
|
+
const container = document.getElementById("app") as HTMLElement;
|
|
14
|
+
|
|
15
|
+
const scene = new Scene();
|
|
16
|
+
scene.background = new Color(0x1a1a2e);
|
|
17
|
+
|
|
18
|
+
const camera = new PerspectiveCamera(
|
|
19
|
+
75,
|
|
20
|
+
container.clientWidth / container.clientHeight,
|
|
21
|
+
0.1,
|
|
22
|
+
1000
|
|
23
|
+
);
|
|
24
|
+
camera.position.z = 3;
|
|
25
|
+
|
|
26
|
+
const { dispose, renderer } = getWebGPUViewer(container);
|
|
27
|
+
|
|
28
|
+
const geometry = new BoxGeometry(1.2, 1.2, 1.2);
|
|
29
|
+
const material = new MeshPhongMaterial({ color: 0x4fc3f7 });
|
|
30
|
+
const cube = new Mesh(geometry, material);
|
|
31
|
+
scene.add(cube);
|
|
32
|
+
|
|
33
|
+
const ambientLight = new AmbientLight(0xffffff, 0.4);
|
|
34
|
+
scene.add(ambientLight);
|
|
35
|
+
|
|
36
|
+
const directionalLight = new DirectionalLight(0xffffff, 1);
|
|
37
|
+
directionalLight.position.set(5, 5, 5);
|
|
38
|
+
scene.add(directionalLight);
|
|
39
|
+
|
|
40
|
+
function animate() {
|
|
41
|
+
cube.rotation.x += 0.005;
|
|
42
|
+
cube.rotation.y += 0.01;
|
|
43
|
+
renderer.render(scene, camera);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
renderer.setAnimationLoop(animate);
|
|
47
|
+
|
|
48
|
+
window.addEventListener("resize", () => {
|
|
49
|
+
camera.aspect = container.clientWidth / container.clientHeight;
|
|
50
|
+
camera.updateProjectionMatrix();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// HMR cleanup
|
|
54
|
+
if (import.meta.hot) {
|
|
55
|
+
import.meta.hot.dispose(dispose);
|
|
56
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s0rt/3dvf",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "shadcn-style Three.js function library CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,13 +13,15 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "bun build
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"dev": "bun
|
|
16
|
+
"build": "bun scripts/build-cli.ts",
|
|
17
|
+
"dev": "REGISTRY_URL=http://localhost:3001/registry bun scripts/build-cli.ts --watch",
|
|
18
|
+
"build:registry": "bun scripts/build-registry.ts",
|
|
19
|
+
"dev:registry": "bun scripts/dev-registry.ts",
|
|
20
|
+
"release": "bun scripts/release.ts",
|
|
20
21
|
"test": "bun test"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
24
|
+
"@types/three": "^0.183.1",
|
|
23
25
|
"commander": "^12.1.0",
|
|
24
26
|
"ora": "^8.1.1",
|
|
25
27
|
"picocolors": "^1.1.1",
|