three-low-poly 0.9.25 → 0.9.26
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 +38 -5
- package/dist/index.cjs +14 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +946 -361
- package/dist/index.iife.js +14 -14
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +2533 -2116
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,16 +62,49 @@ A few patterns hold consistently across the library, and are worth following whe
|
|
|
62
62
|
npm i three-low-poly
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
import { MossyRocks } from "three-low-poly";
|
|
65
|
+
Everything follows the same shape you already know from Three.js: construct with an options object, add it to the scene, and — if it animates — call `update(dt)` from your render loop.
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
### Geometry
|
|
68
|
+
|
|
69
|
+
The primary intent of the library: parametric `BufferGeometry` subclasses you pair with your own material and mesh, exactly like Three.js's built-in primitives.
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { Mesh, MeshStandardMaterial } from "three";
|
|
73
|
+
import { StarGeometry } from "three-low-poly";
|
|
74
|
+
|
|
75
|
+
const geometry = new StarGeometry({ points: 5, innerRadius: 0.5, outerRadius: 1 });
|
|
76
|
+
const material = new MeshStandardMaterial({ color: "#ffcc33", flatShading: true });
|
|
77
|
+
const star = new Mesh(geometry, material);
|
|
78
|
+
scene.add(star);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Prefab
|
|
82
|
+
|
|
83
|
+
The same shape as a ready-made model — geometry and materials already wired. Drop it straight into the scene.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { Star } from "three-low-poly";
|
|
87
|
+
|
|
88
|
+
const star = new Star({ points: 5, color: "#ffcc33" });
|
|
89
|
+
scene.add(star);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Factory
|
|
93
|
+
|
|
94
|
+
Assemble or scatter many parts from a single call.
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
import { scatterMossyRocks } from "three-low-poly";
|
|
98
|
+
|
|
99
|
+
const rocks = scatterMossyRocks({ count: 12, width: 8, depth: 8, seed: 1337 });
|
|
69
100
|
scene.add(rocks);
|
|
70
101
|
```
|
|
71
102
|
|
|
72
|
-
|
|
103
|
+
### Effect
|
|
104
|
+
|
|
105
|
+
Atmospheric layers animate off elapsed seconds — add them to the scene and call `update(dt)` each frame.
|
|
73
106
|
|
|
74
|
-
```
|
|
107
|
+
```ts
|
|
75
108
|
import { RainEffect } from "three-low-poly";
|
|
76
109
|
|
|
77
110
|
const rain = new RainEffect({ area: 12, height: 16, intensity: 0.45 });
|