@aethervtt/shard-render 0.0.1 → 0.1.0
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/dist/assets.d.ts +3 -0
- package/dist/assets.js +43 -2
- package/dist/atmosphere-nodes.d.ts +9 -0
- package/dist/atmosphere-nodes.js +57 -18
- package/dist/atmosphere-plugin.js +8 -2
- package/dist/baseline/atmosphere.d.ts +16 -0
- package/dist/baseline/atmosphere.js +301 -0
- package/dist/baseline/data-texture.d.ts +36 -0
- package/dist/baseline/data-texture.js +181 -0
- package/dist/baseline/environment.d.ts +14 -0
- package/dist/baseline/environment.js +368 -0
- package/dist/baseline/exposure.d.ts +25 -0
- package/dist/baseline/exposure.js +120 -0
- package/dist/baseline/lights.d.ts +33 -0
- package/dist/baseline/lights.js +133 -0
- package/dist/baseline/textures.d.ts +97 -0
- package/dist/baseline/textures.js +203 -0
- package/dist/camera.d.ts +2 -0
- package/dist/camera.js +4 -0
- package/dist/culling-shaders.js +21 -2
- package/dist/culling.d.ts +11 -2
- package/dist/culling.js +44 -18
- package/dist/cutaway-plugin.d.ts +48 -0
- package/dist/cutaway-plugin.js +364 -0
- package/dist/cutaway.d.ts +27 -0
- package/dist/cutaway.js +49 -0
- package/dist/data-store.d.ts +69 -0
- package/dist/data-store.js +105 -0
- package/dist/debug-shaders.js +17 -3
- package/dist/debug-views.js +4 -2
- package/dist/deferred-shaders.js +2 -0
- package/dist/deferred.js +24 -3
- package/dist/deform.d.ts +5 -4
- package/dist/deform.js +4 -9
- package/dist/describe-plugin.d.ts +4 -2
- package/dist/describe-plugin.js +75 -3
- package/dist/display-nodes.js +15 -4
- package/dist/dynamic-resolution.d.ts +2 -0
- package/dist/dynamic-resolution.js +6 -1
- package/dist/environment-plugin.js +17 -2
- package/dist/environment-state.d.ts +7 -3
- package/dist/environment-state.js +20 -9
- package/dist/environment.js +7 -1
- package/dist/features.d.ts +49 -0
- package/dist/features.js +106 -0
- package/dist/forward.d.ts +38 -2
- package/dist/forward.js +582 -184
- package/dist/fxaa.js +12 -2
- package/dist/gizmos-plugin.js +7 -0
- package/dist/gizmos.d.ts +3 -3
- package/dist/gizmos.js +11 -13
- package/dist/gpu-assets.d.ts +58 -4
- package/dist/gpu-assets.js +191 -8
- package/dist/graph.d.ts +11 -0
- package/dist/graph.js +30 -5
- package/dist/health.d.ts +58 -0
- package/dist/health.js +112 -0
- package/dist/index.d.ts +30 -11
- package/dist/index.js +286 -9
- package/dist/instances.d.ts +119 -8
- package/dist/instances.js +387 -78
- package/dist/interior-plugin.d.ts +121 -0
- package/dist/interior-plugin.js +465 -0
- package/dist/interior.d.ts +24 -0
- package/dist/interior.js +13 -0
- package/dist/layers.d.ts +35 -0
- package/dist/layers.js +49 -0
- package/dist/lens-plugin.d.ts +43 -0
- package/dist/lens-plugin.js +304 -0
- package/dist/lens.d.ts +41 -0
- package/dist/lens.js +99 -0
- package/dist/lights.d.ts +50 -5
- package/dist/lights.js +101 -22
- package/dist/material-pipelines.d.ts +37 -4
- package/dist/material-pipelines.js +102 -5
- package/dist/materials.d.ts +23 -0
- package/dist/materials.js +44 -1
- package/dist/outline-plugin.d.ts +48 -0
- package/dist/outline-plugin.js +529 -0
- package/dist/outline.d.ts +15 -0
- package/dist/outline.js +42 -0
- package/dist/overlays.js +1 -0
- package/dist/picking.d.ts +17 -0
- package/dist/picking.js +40 -11
- package/dist/pixel-perfect-plugin.js +10 -2
- package/dist/plugin.d.ts +58 -6
- package/dist/plugin.js +191 -24
- package/dist/post-common.d.ts +2 -0
- package/dist/post-common.js +3 -0
- package/dist/post-nodes.d.ts +2 -1
- package/dist/post-nodes.js +111 -19
- package/dist/post-plugin.js +5 -3
- package/dist/post-shaders.js +51 -6
- package/dist/projection.d.ts +24 -0
- package/dist/projection.js +87 -0
- package/dist/readback.d.ts +1 -0
- package/dist/readback.js +1 -0
- package/dist/render-scale.js +1 -0
- package/dist/screen-effects.d.ts +97 -0
- package/dist/screen-effects.js +192 -0
- package/dist/shaders.d.ts +13 -0
- package/dist/shaders.js +131 -29
- package/dist/shadow-catcher.d.ts +9 -0
- package/dist/shadow-catcher.js +133 -0
- package/dist/shadows.d.ts +25 -1
- package/dist/shadows.js +97 -19
- package/dist/standard-fields.d.ts +1 -0
- package/dist/standard-fields.js +5 -0
- package/dist/standard.js +12 -0
- package/dist/stats.d.ts +45 -1
- package/dist/stats.js +91 -3
- package/dist/surface-model.d.ts +57 -0
- package/dist/surface-model.js +289 -0
- package/dist/surface-shaders.d.ts +3 -0
- package/dist/surface-shaders.js +160 -0
- package/dist/surface.d.ts +40 -0
- package/dist/surface.js +86 -0
- package/dist/target.d.ts +1 -13
- package/dist/target.js +1 -26
- package/dist/testing.d.ts +10 -0
- package/dist/testing.js +33 -1
- package/dist/tier.d.ts +13 -0
- package/dist/tier.js +14 -0
- package/dist/timer.d.ts +2 -0
- package/dist/timer.js +7 -1
- package/dist/variants.d.ts +37 -0
- package/dist/variants.js +104 -0
- package/dist/view-visibility-plugin.d.ts +61 -0
- package/dist/view-visibility-plugin.js +267 -0
- package/dist/view-visibility.d.ts +28 -0
- package/dist/view-visibility.js +46 -0
- package/dist/view.d.ts +29 -1
- package/dist/view.js +57 -34
- package/package.json +15 -11
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
defineResource,
|
|
4
|
+
onAdd,
|
|
5
|
+
t
|
|
6
|
+
} from "@aethervtt/shard-core";
|
|
7
|
+
import { Camera3d } from "./camera.js";
|
|
8
|
+
import { warnFeatureMissing } from "./features.js";
|
|
9
|
+
const VIEW_SHADOWS = ["keep", "hide"];
|
|
10
|
+
const ViewVisibility = defineComponent(
|
|
11
|
+
"render/ViewVisibility",
|
|
12
|
+
{
|
|
13
|
+
hide: t.list(t.entity, {
|
|
14
|
+
description: "Entities this camera doesn't draw, with their descendants."
|
|
15
|
+
}),
|
|
16
|
+
shadows: t.enum(VIEW_SHADOWS, {
|
|
17
|
+
description: "keep: they still cast into this camera's shadows (a body its own camera doesn't draw). hide: its cascades leave them out too. Spot and point shadow maps are shared by every camera and always keep them."
|
|
18
|
+
})
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
description: "Hides entities from one camera (0070): other cameras still draw them. For a first-person body, split-screen markers, or a game master previewing a player view.",
|
|
22
|
+
requires: [Camera3d]
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
const NO_HIDDEN = 4294967295;
|
|
26
|
+
const HiddenSetsResource = defineResource("render/HiddenSets", {
|
|
27
|
+
description: "Each camera's hidden slots (ViewVisibility, 0070), as the culls read them."
|
|
28
|
+
});
|
|
29
|
+
function observeViewVisibilityWithoutPlugin(world) {
|
|
30
|
+
world.observe(onAdd(ViewVisibility), ({ world: w }) => {
|
|
31
|
+
if (!w.hasResource(HiddenSetsResource))
|
|
32
|
+
warnFeatureMissing(
|
|
33
|
+
w,
|
|
34
|
+
"A camera has ViewVisibility",
|
|
35
|
+
"viewVisibilityPlugin",
|
|
36
|
+
"it hides nothing"
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
HiddenSetsResource,
|
|
42
|
+
NO_HIDDEN,
|
|
43
|
+
VIEW_SHADOWS,
|
|
44
|
+
ViewVisibility,
|
|
45
|
+
observeViewVisibilityWithoutPlugin
|
|
46
|
+
};
|
package/dist/view.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { RenderView } from './graph.js';
|
|
|
3
3
|
import { type DrawList } from './instances.js';
|
|
4
4
|
import { type PixelPerfectLayout } from './pixel-perfect.js';
|
|
5
5
|
import { type PostSettings } from './post.js';
|
|
6
|
+
import type { HiddenSet } from './view-visibility.js';
|
|
6
7
|
export declare const TONEMAP_CURVES: readonly ['aces', 'agx', 'pbr-neutral', 'reinhard', 'none'];
|
|
7
8
|
export type TonemapCurve = (typeof TONEMAP_CURVES)[number];
|
|
8
9
|
/** The curve for cameras without a Tonemapping component. */
|
|
@@ -56,9 +57,17 @@ export interface CameraData {
|
|
|
56
57
|
/** Scene luminance → pre-exposed HDR. */
|
|
57
58
|
exposure: number;
|
|
58
59
|
ev100: number;
|
|
59
|
-
/** Linear clear color, as displayed before the tonemap curve. */
|
|
60
|
+
/** Linear clear color, as displayed before the tonemap curve, premultiplied by its alpha. */
|
|
60
61
|
clear: GPUColor;
|
|
62
|
+
/**
|
|
63
|
+
* Clears to an alpha below 1 (0052): the passes carry alpha to the target, the sky and the
|
|
64
|
+
* environment background aren't drawn, and light raises alpha, so the view composites over
|
|
65
|
+
* whatever is under its surface.
|
|
66
|
+
*/
|
|
67
|
+
alphaOutput: boolean;
|
|
61
68
|
msaa: number;
|
|
69
|
+
/** MSAA was asked for, but the device can't multisample HDR targets (0064): `msaa` is 1. */
|
|
70
|
+
msaaCapped: boolean;
|
|
62
71
|
curve: number;
|
|
63
72
|
dither: boolean;
|
|
64
73
|
/** Culled draws of this camera, rebuilt each frame. */
|
|
@@ -67,6 +76,14 @@ export interface CameraData {
|
|
|
67
76
|
transparent: DrawList;
|
|
68
77
|
/** Deferred views: opaque draws the G-buffer can't take (custom lighting), drawn forward. */
|
|
69
78
|
forwardOnly: DrawList;
|
|
79
|
+
/** Ground draws (0057): coplanar bands in (band, order) order, after opaque geometry. */
|
|
80
|
+
ground: DrawList;
|
|
81
|
+
/** Ground draws from the overlay band up: after transparent objects and projected fog (0058). */
|
|
82
|
+
overlay: DrawList;
|
|
83
|
+
/** Render layers this camera draws (Camera3d.layers). */
|
|
84
|
+
layers: number;
|
|
85
|
+
/** Slots it doesn't draw (ViewVisibility, 0070), while it has the component. */
|
|
86
|
+
hidden: HiddenSet | undefined;
|
|
70
87
|
/** Renders through the G-buffer (RenderPath deferred). */
|
|
71
88
|
deferred: boolean;
|
|
72
89
|
/** G-buffer channel to show for a capture (-1: none), also forcing a G-buffer in forward views. */
|
|
@@ -85,7 +102,18 @@ export interface CameraData {
|
|
|
85
102
|
post: PostSettings;
|
|
86
103
|
/** Set for PixelPerfect cameras: the low-resolution target and how it scales up. */
|
|
87
104
|
pixelPerfect: PixelPerfectLayout | undefined;
|
|
105
|
+
/** The display size and pixel ratio the last CameraMoved was sent for. */
|
|
106
|
+
movedWidth: number;
|
|
107
|
+
movedHeight: number;
|
|
108
|
+
movedRatio: number;
|
|
88
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Sent after extraction, once per camera whose projection moved this frame (its unjittered view-
|
|
112
|
+
* projection, display size or pixel ratio changed), and on its first frame (0057).
|
|
113
|
+
*/
|
|
114
|
+
export declare const CameraMoved: import("@aethervtt/shard-core").EventDef<{
|
|
115
|
+
camera: Entity;
|
|
116
|
+
}>;
|
|
89
117
|
export declare const Cameras: import("@aethervtt/shard-core").ResourceDef<Map<number, CameraData>>;
|
|
90
118
|
/** Global render settings the camera extraction applies to every view. */
|
|
91
119
|
export interface ViewSettingsValue {
|
package/dist/view.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
affine,
|
|
3
3
|
defineComponent,
|
|
4
|
+
defineEvent,
|
|
4
5
|
defineResource,
|
|
5
6
|
defineSystem,
|
|
6
7
|
frustum,
|
|
@@ -12,13 +13,15 @@ import { LogResource, Time } from "@aethervtt/shard-runtime";
|
|
|
12
13
|
import { GlobalTransform } from "@aethervtt/shard-transform";
|
|
13
14
|
import { RenderTargets } from "./assets.js";
|
|
14
15
|
import { Camera3d, Exposure, exposureScale } from "./camera.js";
|
|
16
|
+
import { warnFeatureMissing } from "./features.js";
|
|
15
17
|
import { createDrawList } from "./instances.js";
|
|
18
|
+
import { Lens, LensPath } from "./lens.js";
|
|
16
19
|
import {
|
|
17
20
|
PixelPerfect,
|
|
18
21
|
PixelPerfectPath,
|
|
19
22
|
pixelPerfectLayout
|
|
20
23
|
} from "./pixel-perfect.js";
|
|
21
|
-
import { Views, Window } from "./plugin.js";
|
|
24
|
+
import { Gpu, Views, Window } from "./plugin.js";
|
|
22
25
|
import {
|
|
23
26
|
antialiasingOf,
|
|
24
27
|
CORE_EFFECTS,
|
|
@@ -58,13 +61,21 @@ const RenderPath = defineComponent(
|
|
|
58
61
|
const DeferredPath = defineResource("render/DeferredPath", {
|
|
59
62
|
description: "Present when the deferred path (deferredPlugin) is installed."
|
|
60
63
|
});
|
|
64
|
+
const CameraMoved = defineEvent("render/CameraMoved", {
|
|
65
|
+
description: "A camera moved or its view resized: DOM overlays following the scene reposition."
|
|
66
|
+
});
|
|
67
|
+
function sameMatrix(a, b) {
|
|
68
|
+
for (let i = 0; i < 16; i++) if (a[i] !== b[i]) return false;
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
61
71
|
const Cameras = defineResource("render/Cameras", {
|
|
62
72
|
description: "Per-camera render data by entity, extracted each frame.",
|
|
63
73
|
init: () => /* @__PURE__ */ new Map()
|
|
64
74
|
});
|
|
65
75
|
const ViewSettings = defineResource("render/ViewSettings", {
|
|
66
76
|
description: "Render settings shared by all views: the default MSAA sample count, and the display density past which it is skipped.",
|
|
67
|
-
init: () => ({ msaa: 4, msaaMaxPixelRatio: 1.5 })
|
|
77
|
+
init: () => ({ msaa: 4, msaaMaxPixelRatio: 1.5 }),
|
|
78
|
+
hostWritable: true
|
|
68
79
|
});
|
|
69
80
|
const scratchProj = mat4.create();
|
|
70
81
|
const scratchSnap = affine.create();
|
|
@@ -90,32 +101,6 @@ function viewAliases(cam) {
|
|
|
90
101
|
return cam.msaa > 1 ? MSAA_ALIASES : NO_MSAA_ALIASES;
|
|
91
102
|
}
|
|
92
103
|
const reportedEffects = /* @__PURE__ */ new WeakMap();
|
|
93
|
-
const reportedDeferred = /* @__PURE__ */ new WeakSet();
|
|
94
|
-
function warnMissingDeferred(world) {
|
|
95
|
-
if (reportedDeferred.has(world)) return;
|
|
96
|
-
reportedDeferred.add(world);
|
|
97
|
-
world.tryResource(LogResource)?.log(
|
|
98
|
-
"warn",
|
|
99
|
-
"A camera asks for RenderPath deferred, but deferredPlugin isn't installed; it renders forward",
|
|
100
|
-
{
|
|
101
|
-
code: "render/feature-missing",
|
|
102
|
-
hint: "Add deferredPlugin from '@aethervtt/shard-render' (forwardPlugin includes it)."
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
const reportedPixel = /* @__PURE__ */ new WeakSet();
|
|
107
|
-
function warnMissingPixelPerfect(world) {
|
|
108
|
-
if (reportedPixel.has(world)) return;
|
|
109
|
-
reportedPixel.add(world);
|
|
110
|
-
world.tryResource(LogResource)?.log(
|
|
111
|
-
"warn",
|
|
112
|
-
"A camera has PixelPerfect, but pixelPerfectPlugin isn't installed; it renders at full resolution",
|
|
113
|
-
{
|
|
114
|
-
code: "render/feature-missing",
|
|
115
|
-
hint: "Add pixelPerfectPlugin from '@aethervtt/shard-render' (forwardPlugin includes it)."
|
|
116
|
-
}
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
104
|
function warnMissingEffects(world, missing) {
|
|
120
105
|
const reported = reportedEffects.get(world) ?? 0;
|
|
121
106
|
const fresh = missing & ~reported;
|
|
@@ -148,6 +133,8 @@ const extractCameras = defineSystem({
|
|
|
148
133
|
const installed = world.tryResource(PostFeatures)?.effects ?? CORE_EFFECTS;
|
|
149
134
|
const deferredInstalled = world.hasResource(DeferredPath);
|
|
150
135
|
const pixelInstalled = world.hasResource(PixelPerfectPath);
|
|
136
|
+
const lensInstalled = world.hasResource(LensPath);
|
|
137
|
+
const maxSamples = world.resource(Gpu).capabilities.hdrSampleCount;
|
|
151
138
|
for (const table of q.tables) {
|
|
152
139
|
const projection = table.column(Camera3d, "projection");
|
|
153
140
|
const fovY = table.column(Camera3d, "fovY");
|
|
@@ -158,13 +145,22 @@ const extractCameras = defineSystem({
|
|
|
158
145
|
const clear = table.column(Camera3d, "clearColor");
|
|
159
146
|
const target = table.column(Camera3d, "target");
|
|
160
147
|
const active = table.column(Camera3d, "active");
|
|
148
|
+
const layers = table.column(Camera3d, "layers");
|
|
161
149
|
const g = table.column(GlobalTransform, "matrix");
|
|
162
150
|
const ev = table.column(Exposure, "ev100");
|
|
163
151
|
const path = table.has(RenderPath) ? table.column(RenderPath, "mode") : void 0;
|
|
164
152
|
const hasTonemap = table.has(Tonemapping);
|
|
165
153
|
const curve = hasTonemap ? table.column(Tonemapping, "curve") : void 0;
|
|
166
154
|
const dither = hasTonemap ? table.column(Tonemapping, "dither") : void 0;
|
|
167
|
-
if (table.has(PixelPerfect) && !pixelInstalled)
|
|
155
|
+
if (table.has(PixelPerfect) && !pixelInstalled)
|
|
156
|
+
warnFeatureMissing(
|
|
157
|
+
world,
|
|
158
|
+
"A camera has PixelPerfect",
|
|
159
|
+
"pixelPerfectPlugin",
|
|
160
|
+
"it renders at full resolution"
|
|
161
|
+
);
|
|
162
|
+
if (table.has(Lens) && !lensInstalled)
|
|
163
|
+
warnFeatureMissing(world, "A camera has Lens", "lensPlugin", "it renders unbent");
|
|
168
164
|
const pixel = pixelInstalled && table.has(PixelPerfect);
|
|
169
165
|
const ppu = pixel ? table.column(PixelPerfect, "pixelsPerUnit") : void 0;
|
|
170
166
|
const snap = pixel ? table.column(PixelPerfect, "snap") : void 0;
|
|
@@ -205,12 +201,18 @@ const extractCameras = defineSystem({
|
|
|
205
201
|
exposure: 1,
|
|
206
202
|
ev100: 0,
|
|
207
203
|
clear: { r: 0, g: 0, b: 0, a: 1 },
|
|
204
|
+
alphaOutput: false,
|
|
208
205
|
msaa: 1,
|
|
206
|
+
msaaCapped: false,
|
|
209
207
|
curve: 1,
|
|
210
208
|
dither: true,
|
|
211
209
|
draws: createDrawList(),
|
|
212
210
|
transparent: createDrawList(),
|
|
213
211
|
forwardOnly: createDrawList(),
|
|
212
|
+
ground: createDrawList(),
|
|
213
|
+
overlay: createDrawList(),
|
|
214
|
+
layers: 4294967295,
|
|
215
|
+
hidden: void 0,
|
|
214
216
|
deferred: false,
|
|
215
217
|
gbufferDebug: -1,
|
|
216
218
|
lodState: new Uint8Array(0),
|
|
@@ -220,11 +222,15 @@ const extractCameras = defineSystem({
|
|
|
220
222
|
frames: 0,
|
|
221
223
|
debug: 0,
|
|
222
224
|
post: createPostSettings(),
|
|
223
|
-
pixelPerfect: void 0
|
|
225
|
+
pixelPerfect: void 0,
|
|
226
|
+
movedWidth: 0,
|
|
227
|
+
movedHeight: 0,
|
|
228
|
+
movedRatio: 0
|
|
224
229
|
};
|
|
225
230
|
cameras.set(entity, cam);
|
|
226
231
|
}
|
|
227
232
|
cam.orthographic = projection[i] !== 0;
|
|
233
|
+
cam.layers = layers[i];
|
|
228
234
|
let height = orthoHeight[i];
|
|
229
235
|
cam.pixelPerfect = void 0;
|
|
230
236
|
if (ppu && cam.orthographic) {
|
|
@@ -258,7 +264,13 @@ const extractCameras = defineSystem({
|
|
|
258
264
|
}
|
|
259
265
|
const wantsDeferred = path ? path[i] === 1 : false;
|
|
260
266
|
cam.deferred = wantsDeferred && deferredInstalled;
|
|
261
|
-
if (wantsDeferred && !deferredInstalled)
|
|
267
|
+
if (wantsDeferred && !deferredInstalled)
|
|
268
|
+
warnFeatureMissing(
|
|
269
|
+
world,
|
|
270
|
+
"A camera asks for RenderPath deferred",
|
|
271
|
+
"deferredPlugin",
|
|
272
|
+
"it renders forward"
|
|
273
|
+
);
|
|
262
274
|
const missing = extractPost(table, i, cam, delta, true, installed);
|
|
263
275
|
if (missing !== 0) warnMissingEffects(world, missing);
|
|
264
276
|
const world_ = g.subarray(i * 12, i * 12 + 12);
|
|
@@ -275,6 +287,12 @@ const extractCameras = defineSystem({
|
|
|
275
287
|
if (cam.frames > 0) mat4.copy(cam.prevViewProj, cam.viewProjNoJitter);
|
|
276
288
|
mat4.multiply(cam.viewProjNoJitter, scratchProj, cam.view);
|
|
277
289
|
if (cam.frames === 0) mat4.copy(cam.prevViewProj, cam.viewProjNoJitter);
|
|
290
|
+
if (cam.frames === 0 || !sameMatrix(cam.viewProjNoJitter, cam.prevViewProj) || cam.displayWidth !== cam.movedWidth || cam.displayHeight !== cam.movedHeight || cam.pixelRatio !== cam.movedRatio) {
|
|
291
|
+
cam.movedWidth = cam.displayWidth;
|
|
292
|
+
cam.movedHeight = cam.displayHeight;
|
|
293
|
+
cam.movedRatio = cam.pixelRatio;
|
|
294
|
+
world.send(CameraMoved, { camera: entity });
|
|
295
|
+
}
|
|
278
296
|
const jitter = cam.post.jitter;
|
|
279
297
|
if (cam.post.effects & PostEffect.Taa) {
|
|
280
298
|
const k = cam.frames % 8 + 1;
|
|
@@ -309,10 +327,14 @@ const extractCameras = defineSystem({
|
|
|
309
327
|
cam.ev100 = ev[i];
|
|
310
328
|
cam.exposure = exposureScale(ev[i]);
|
|
311
329
|
const c = i * 4;
|
|
312
|
-
|
|
330
|
+
const ca = Math.min(1, Math.max(0, clear[c + 3]));
|
|
331
|
+
cam.clear = { r: clear[c] * ca, g: clear[c + 1] * ca, b: clear[c + 2] * ca, a: ca };
|
|
332
|
+
cam.alphaOutput = ca < 1;
|
|
313
333
|
const aa = antialiasingOf(table, i);
|
|
314
334
|
const dense = settings.msaaMaxPixelRatio > 0 && cam.pixelRatio >= settings.msaaMaxPixelRatio;
|
|
315
|
-
|
|
335
|
+
const msaa = cam.deferred ? 1 : aa < 0 ? dense ? 1 : settings.msaa : aa === 3 ? 4 : 1;
|
|
336
|
+
cam.msaa = Math.min(msaa, maxSamples);
|
|
337
|
+
cam.msaaCapped = cam.msaa < msaa;
|
|
316
338
|
cam.curve = curve ? curve[i] : TONEMAP_CURVES.indexOf(DEFAULT_CURVE);
|
|
317
339
|
cam.dither = dither ? dither[i] !== 0 : true;
|
|
318
340
|
cam.frames++;
|
|
@@ -333,7 +355,7 @@ const extractCameras = defineSystem({
|
|
|
333
355
|
name: `pixel-perfect:${entity}`,
|
|
334
356
|
target: shown,
|
|
335
357
|
order: order[i] + 0.5,
|
|
336
|
-
data: { upscale: cam.pixelPerfect }
|
|
358
|
+
data: { upscale: cam.pixelPerfect, alphaOutput: cam.alphaOutput }
|
|
337
359
|
});
|
|
338
360
|
}
|
|
339
361
|
}
|
|
@@ -374,6 +396,7 @@ function cameraOf(view) {
|
|
|
374
396
|
return view.data.camera;
|
|
375
397
|
}
|
|
376
398
|
export {
|
|
399
|
+
CameraMoved,
|
|
377
400
|
Cameras,
|
|
378
401
|
DEFAULT_CURVE,
|
|
379
402
|
DeferredPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aethervtt/shard-render",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"./noise": {
|
|
17
17
|
"types": "./dist/noise.d.ts",
|
|
18
18
|
"default": "./dist/noise.js"
|
|
19
|
+
},
|
|
20
|
+
"./surface": {
|
|
21
|
+
"types": "./dist/surface.d.ts",
|
|
22
|
+
"default": "./dist/surface.js"
|
|
19
23
|
}
|
|
20
24
|
},
|
|
21
25
|
"files": [
|
|
@@ -24,15 +28,15 @@
|
|
|
24
28
|
"README.md"
|
|
25
29
|
],
|
|
26
30
|
"dependencies": {
|
|
27
|
-
"@aethervtt/shard-assets": "0.0
|
|
28
|
-
"@aethervtt/shard-core": "0.0
|
|
29
|
-
"@aethervtt/shard-gpu": "0.0
|
|
30
|
-
"@aethervtt/shard-mesh": "0.0
|
|
31
|
-
"@aethervtt/shard-noise": "0.0
|
|
32
|
-
"@aethervtt/shard-runtime": "0.0
|
|
33
|
-
"@aethervtt/shard-shader": "0.0
|
|
34
|
-
"@aethervtt/shard-texture": "0.0
|
|
35
|
-
"@aethervtt/shard-transform": "0.0
|
|
31
|
+
"@aethervtt/shard-assets": "0.1.0",
|
|
32
|
+
"@aethervtt/shard-core": "0.1.0",
|
|
33
|
+
"@aethervtt/shard-gpu": "0.1.0",
|
|
34
|
+
"@aethervtt/shard-mesh": "0.1.0",
|
|
35
|
+
"@aethervtt/shard-noise": "0.1.0",
|
|
36
|
+
"@aethervtt/shard-runtime": "0.1.0",
|
|
37
|
+
"@aethervtt/shard-shader": "0.1.0",
|
|
38
|
+
"@aethervtt/shard-texture": "0.1.0",
|
|
39
|
+
"@aethervtt/shard-transform": "0.1.0"
|
|
36
40
|
},
|
|
37
41
|
"repository": {
|
|
38
42
|
"type": "git",
|
|
@@ -44,6 +48,6 @@
|
|
|
44
48
|
"provenance": true
|
|
45
49
|
},
|
|
46
50
|
"shard": {
|
|
47
|
-
"buildSha": "
|
|
51
|
+
"buildSha": "8e14c9896f82a3554b156f1ffdd68f2cc3e7d78a"
|
|
48
52
|
}
|
|
49
53
|
}
|