You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libs/soba/misc/README.md
+114Lines changed: 114 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,9 @@ This secondary entry point includes miscellaneous utilities and components for a
9
9
-[NgtsFBO](#ngtsfbo)
10
10
-[NgtsBakeShadows](#ngtsbakeshadows)
11
11
-[injectDepthBuffer](#injectdepthbuffer)
12
+
-[NgtsSampler](#ngtssampler)
13
+
-[NgtsComputedAttribute](#ngtscomputedattribute)
14
+
-[NgtsDecal](#ngtsdecal)
12
15
13
16
## `injectAnimations`
14
17
@@ -102,3 +105,114 @@ export class MyCmp {
102
105
}));
103
106
}
104
107
```
108
+
109
+
## NgtsSampler
110
+
111
+
A component that samples points from a mesh and transforms an `InstancedMesh`'s matrix to distribute instances on the points. It takes a `Mesh` and an `InstancedMesh` as children.
|`weight`| The name of the attribute to use as the sampling weight. |`undefined`|
118
+
|`transform`| A function that transforms each instance given a sample. It receives a dummy `Object3D` with all the sampled data and should mutate `transformPayload.dummy`. |`undefined`|
119
+
|`count`| The number of samples to take. |`16`|
120
+
121
+
#### Passing `InstancedMesh` and `Mesh` as content children
A component that allows you to compute and attach an attribute to a geometry declaratively.
158
+
159
+
It accepts the following inputs:
160
+
161
+
-`compute`: A function that computes the attribute. It receives the geometry as an argument and should return a `BufferAttribute`.
162
+
-`name`: The name of the attribute to attach to the geometry.
163
+
-`options`: pass-through options for `BufferAttribute`
164
+
165
+
```html
166
+
<ngt-sphere-geometry>
167
+
<ngts-computed-attribute
168
+
name="my-attribute-name"
169
+
[compute]="computeAttributeFn"
170
+
[options]="{ usage: StaticReadUsage }"
171
+
/>
172
+
</ngt-sphere-geometry>
173
+
```
174
+
175
+
## NgtsDecal
176
+
177
+
Abstraction around Three's `DecalGeometry`. It will use the its parent `mesh` as the decal surface by default.
178
+
179
+
The decal box has to intersect the surface, otherwise it will not be visible. if you do not specify a rotation it will look at the parents center point. You can also pass a single number as the rotation which allows you to spin it.
0 commit comments