rayvo 0.0.1 → 0.0.3

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 ADDED
@@ -0,0 +1,76 @@
1
+ # Rayvo
2
+
3
+ Three 风格 API,WebGPU 级吞吐。为海量对象而生的纯 WebGPU 3D 渲染框架。
4
+
5
+ 官网:[https://www.rayvo.cn/](https://www.rayvo.cn/)
6
+
7
+ 邮箱:[2294954766@qq.com](mailto:2294954766@qq.com)
8
+
9
+ 从实例化合批、GPU 视锥剔除到资源池化,默认路径面向十万级以上可见负载。API 文档、示例和压测都在官网上。
10
+
11
+ - 文档:[https://www.rayvo.cn/docs/](https://www.rayvo.cn/docs/)
12
+ - 示例:[https://www.rayvo.cn/examples/](https://www.rayvo.cn/examples/)
13
+
14
+ ## 安装
15
+
16
+ ```bash
17
+ npm install rayvo
18
+ ```
19
+
20
+ 包入口同时提供 ESM、CommonJS 和 UMD。TypeScript 类型在 `dist/index.d.ts`。
21
+
22
+ ```ts
23
+ import { WebGPURenderer, Scene, PerspectiveCamera, Mesh, BoxGeometry, MeshBasicMaterial } from 'rayvo'
24
+ ```
25
+
26
+ ```js
27
+ const { WebGPURenderer, Scene } = require('rayvo')
28
+ ```
29
+
30
+ 浏览器脚本使用全局 `rayvo`:
31
+
32
+ ```html
33
+ <script src="https://unpkg.com/rayvo/dist/index.umd.js"></script>
34
+ ```
35
+
36
+ ## 用法
37
+
38
+ ```ts
39
+ import {
40
+ WebGPURenderer,
41
+ Scene,
42
+ PerspectiveCamera,
43
+ Mesh,
44
+ BoxGeometry,
45
+ MeshBasicMaterial,
46
+ } from 'rayvo'
47
+
48
+ const canvas = document.querySelector('canvas')!
49
+ const renderer = new WebGPURenderer({ canvas })
50
+ await renderer.init()
51
+ renderer.setSize(canvas.clientWidth, canvas.clientHeight)
52
+
53
+ const scene = new Scene(renderer)
54
+ const camera = new PerspectiveCamera(50, canvas.clientWidth / canvas.clientHeight, 0.1, 100)
55
+ camera.position.set(0, 1, 4)
56
+ camera.lookAt(0, 0, 0)
57
+
58
+ scene.add(new Mesh(new BoxGeometry(1, 1, 1), new MeshBasicMaterial()))
59
+
60
+ function frame() {
61
+ renderer.render(scene, camera)
62
+ requestAnimationFrame(frame)
63
+ }
64
+ frame()
65
+ ```
66
+
67
+ 需要支持 WebGPU 的浏览器。`Scene` 要传入已经创建的 `WebGPURenderer`。
68
+
69
+ ## 特性
70
+
71
+ - **实例化渲染**:相同几何自动合批,万级对象只需少数 DrawCall。
72
+ - **GPU 视锥剔除**:Compute 侧剔除,支撑十万级以上场景吞吐。
73
+ - **帧图与资源复用**:依赖驱动的通道编排,纹理与缓冲按需复用。
74
+ - **内存池化**:统一 Buffer 分配,降低运行时分配与 GC 抖动。
75
+ - **管线缓存**:异步编译与状态复用,压低首帧卡顿。
76
+ - **材质系统**:节点化着色与动态 WGSL,覆盖 unlit 到 PBR。