@multiplekex/shallot 0.1.9 → 0.1.10
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/package.json +1 -1
- package/src/core/state.ts +2 -0
- package/src/extras/arrows/index.ts +13 -8
- package/src/extras/gradient/index.ts +1050 -0
- package/src/extras/index.ts +1 -0
- package/src/extras/lines/index.ts +13 -8
- package/src/extras/text/index.ts +11 -7
- package/src/standard/compute/graph.ts +10 -12
- package/src/standard/compute/index.ts +1 -0
- package/src/standard/compute/inspect.ts +34 -52
- package/src/standard/compute/pass.ts +23 -0
- package/src/standard/render/camera.ts +7 -2
- package/src/standard/render/forward.ts +99 -89
- package/src/standard/render/index.ts +68 -44
- package/src/standard/render/mesh/index.ts +190 -19
- package/src/standard/render/pass.ts +63 -0
- package/src/standard/render/postprocess.ts +241 -57
- package/src/standard/render/scene.ts +87 -2
- package/src/standard/render/surface/compile.ts +74 -0
- package/src/standard/render/surface/index.ts +116 -0
- package/src/standard/render/surface/structs.ts +50 -0
- package/src/standard/render/transparent.ts +62 -65
- package/src/standard/render/material/index.ts +0 -92
- package/src/standard/render/opaque.ts +0 -44
package/package.json
CHANGED
package/src/core/state.ts
CHANGED
|
@@ -37,6 +37,7 @@ export class State {
|
|
|
37
37
|
readonly world: World;
|
|
38
38
|
readonly scheduler = new Scheduler();
|
|
39
39
|
readonly canvas: HTMLCanvasElement | null;
|
|
40
|
+
maxEid = 0;
|
|
40
41
|
|
|
41
42
|
private _resources = new Map<symbol, unknown>();
|
|
42
43
|
private _disposed = false;
|
|
@@ -140,6 +141,7 @@ export class State {
|
|
|
140
141
|
if (eid >= MAX_ENTITIES) {
|
|
141
142
|
throw new Error(`Entity limit exceeded: ${eid} >= ${MAX_ENTITIES}`);
|
|
142
143
|
}
|
|
144
|
+
if (eid > this.maxEid) this.maxEid = eid;
|
|
143
145
|
return eid;
|
|
144
146
|
}
|
|
145
147
|
|
|
@@ -5,9 +5,10 @@ import {
|
|
|
5
5
|
Render,
|
|
6
6
|
RenderPlugin,
|
|
7
7
|
DEPTH_FORMAT,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type
|
|
8
|
+
Pass,
|
|
9
|
+
registerDraw,
|
|
10
|
+
type Draw,
|
|
11
|
+
type SharedPassContext,
|
|
11
12
|
} from "../../standard/render";
|
|
12
13
|
import { Transform } from "../../standard/transforms";
|
|
13
14
|
import { Line, Lines, LinesPlugin } from "../lines";
|
|
@@ -245,15 +246,18 @@ export function createArrowsPipeline(
|
|
|
245
246
|
});
|
|
246
247
|
}
|
|
247
248
|
|
|
248
|
-
function
|
|
249
|
+
function createArrowsDraw(config: ArrowsConfig): Draw {
|
|
249
250
|
let pipeline: GPURenderPipeline | null = null;
|
|
250
251
|
let bindGroup: GPUBindGroup | null = null;
|
|
251
252
|
|
|
252
253
|
return {
|
|
253
254
|
id: "arrows",
|
|
255
|
+
pass: Pass.Transparent,
|
|
254
256
|
order: 1,
|
|
255
257
|
|
|
256
|
-
|
|
258
|
+
execute() {},
|
|
259
|
+
|
|
260
|
+
draw(pass: GPURenderPassEncoder, ctx: SharedPassContext) {
|
|
257
261
|
const count = config.getCount();
|
|
258
262
|
if (count === 0) return;
|
|
259
263
|
|
|
@@ -314,7 +318,8 @@ const ArrowsSystem: System = {
|
|
|
314
318
|
}
|
|
315
319
|
}
|
|
316
320
|
|
|
317
|
-
|
|
321
|
+
const uploadCount = state.maxEid + 1;
|
|
322
|
+
device.queue.writeBuffer(arrows.buffer, 0, ArrowData.data, 0, uploadCount * 4);
|
|
318
323
|
device.queue.writeBuffer(arrows.entityIds, 0, arrowEntityIdArray, 0, count);
|
|
319
324
|
arrows.count = count;
|
|
320
325
|
},
|
|
@@ -345,9 +350,9 @@ export const ArrowsPlugin: Plugin = {
|
|
|
345
350
|
|
|
346
351
|
state.setResource(Arrows, arrowsState);
|
|
347
352
|
|
|
348
|
-
|
|
353
|
+
registerDraw(
|
|
349
354
|
state,
|
|
350
|
-
|
|
355
|
+
createArrowsDraw({
|
|
351
356
|
scene: render.scene,
|
|
352
357
|
arrows: arrowsState.buffer,
|
|
353
358
|
lines: lines.buffer,
|