@footgun/cobalt 0.7.8 → 0.8.1

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.
@@ -1,44 +0,0 @@
1
- /// <reference types="@webgpu/types"/>
2
-
3
- type DisplacementParameters = {
4
- readonly offsetX: number;
5
- readonly offsetY: number;
6
- readonly scale: number;
7
- };
8
-
9
- type Parameters = {
10
- readonly device: GPUDevice;
11
- readonly initialParameters: DisplacementParameters;
12
- };
13
-
14
- class DisplacementParametersBuffer {
15
- private readonly device: GPUDevice;
16
-
17
- public readonly bufferGpu: GPUBuffer;
18
- private needsUpdate: boolean = true;
19
-
20
- public constructor(params: Parameters) {
21
- this.device = params.device;
22
-
23
- this.bufferGpu = this.device.createBuffer({
24
- label: "DisplacementParametersBuffer buffer",
25
- size: 16,
26
- usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
27
- });
28
-
29
- this.setParameters(params.initialParameters);
30
- }
31
-
32
- public setParameters(params: DisplacementParameters): void {
33
- this.device.queue.writeBuffer(this.bufferGpu, 0, new Float32Array([params.offsetX, params.offsetY, params.scale]));
34
- }
35
-
36
- public destroy(): void {
37
- this.bufferGpu.destroy();
38
- }
39
- }
40
-
41
- export {
42
- DisplacementParametersBuffer
43
- };
44
-
@@ -1,23 +0,0 @@
1
- type Point = [number, number];
2
-
3
- type Light = {
4
- readonly position: Point; // center of the light
5
- readonly radius: number; // radius of the light
6
- readonly color: [number, number, number]; // color (normalized)
7
- readonly intensity: number; // intensity at the center
8
- readonly attenuationLinear: number; // describes how the intensity declines with distance
9
- readonly attenuationExp: number; // describes how the intensity declines with distance
10
- };
11
- /* The light intensity is computed as follow:
12
- intensity
13
- ----------------------------------------------------- * cos(x * pi/2)
14
- 1 + attenuationLinear * x + attenuationExp * (x * x)
15
-
16
- where "x" is the normalized distance to the light position
17
- */
18
-
19
-
20
- export {
21
- type Light,
22
- type Point,
23
- };