babylonjs-editor-tools 5.5.1 → 5.5.2
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/build/index.node.js +407 -121
- package/build/src/decorators/apply.js +2 -2
- package/build/src/decorators/apply.js.map +1 -1
- package/build/src/decorators/scene.js +16 -16
- package/build/src/decorators/scene.js.map +1 -1
- package/build/src/decorators/sound.js +2 -2
- package/build/src/decorators/sound.js.map +1 -1
- package/build/src/index.js +1 -0
- package/build/src/index.js.map +1 -1
- package/build/src/loading/loader.js +21 -7
- package/build/src/loading/loader.js.map +1 -1
- package/build/src/rendering/order.js +110 -0
- package/build/src/rendering/order.js.map +1 -0
- package/build/src/rendering/ssao.js +1 -1
- package/build/src/rendering/ssao.js.map +1 -1
- package/build/src/rendering/tools.js +3 -0
- package/build/src/rendering/tools.js.map +1 -1
- package/build/src/rendering/volumetric/pipeline.js +403 -26
- package/build/src/rendering/volumetric/pipeline.js.map +1 -1
- package/build/src/rendering/volumetric/selector.js +2 -1
- package/build/src/rendering/volumetric/selector.js.map +1 -1
- package/build/src/rendering/volumetric/shaders-wgsl.js +197 -60
- package/build/src/rendering/volumetric/shaders-wgsl.js.map +1 -1
- package/build/src/rendering/volumetric/shaders.js +179 -5
- package/build/src/rendering/volumetric/shaders.js.map +1 -1
- package/build/src/rendering/volumetric/types.js +27 -1
- package/build/src/rendering/volumetric/types.js.map +1 -1
- package/build/src/rendering/volumetric-lighting.js.map +1 -1
- package/build/src/tools/scene.js +18 -5
- package/build/src/tools/scene.js.map +1 -1
- package/declaration/src/decorators/apply.d.ts +8 -4
- package/declaration/src/decorators/scene.d.ts +18 -9
- package/declaration/src/decorators/sound.d.ts +10 -1
- package/declaration/src/index.d.ts +1 -0
- package/declaration/src/loading/loader.d.ts +1 -1
- package/declaration/src/rendering/order.d.ts +31 -0
- package/declaration/src/rendering/volumetric/pipeline.d.ts +83 -1
- package/declaration/src/rendering/volumetric/selector.d.ts +6 -2
- package/declaration/src/rendering/volumetric/shaders-wgsl.d.ts +5 -1
- package/declaration/src/rendering/volumetric/shaders.d.ts +16 -2
- package/declaration/src/rendering/volumetric/types.d.ts +46 -1
- package/declaration/src/rendering/volumetric-lighting.d.ts +1 -1
- package/declaration/src/tools/scene.d.ts +2 -1
- package/package.json +1 -1
|
@@ -10,6 +10,10 @@ export const volumetricLightingLinearDepthShaderName = "volumetricLightingLinear
|
|
|
10
10
|
* Defines the name of the raymarching shader in the shader store of Babylon.js.
|
|
11
11
|
*/
|
|
12
12
|
export const volumetricLightingScatteringShaderName = "volumetricLightingScattering";
|
|
13
|
+
/**
|
|
14
|
+
* Defines the name of the temporal accumulation shader in the shader store of Babylon.js.
|
|
15
|
+
*/
|
|
16
|
+
export const volumetricLightingTemporalShaderName = "volumetricLightingTemporal";
|
|
13
17
|
/**
|
|
14
18
|
* Defines the name of the bilateral blur shader in the shader store of Babylon.js.
|
|
15
19
|
*/
|
|
@@ -19,9 +23,14 @@ export const volumetricLightingBlurShaderName = "volumetricLightingBlur";
|
|
|
19
23
|
*/
|
|
20
24
|
export const volumetricLightingComposeShaderName = "volumetricLightingCompose";
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
26
|
+
* Defines how the linear depth is stored: scaled down in a float texture, or packed in the four channels of an
|
|
27
|
+
* 8 bits RGBA texture, the same way Babylon.js does.
|
|
23
28
|
*/
|
|
24
29
|
const packingHelpers = /* glsl */ `
|
|
30
|
+
// Stored scaled down by a power of two, which is exact: a 16 bits float then holds the far plane of the largest
|
|
31
|
+
// scenes, with a relative precision of 0.05%.
|
|
32
|
+
const float volLinearDepthScale = 1.0 / 1024.0;
|
|
33
|
+
|
|
25
34
|
float volUnpack(vec4 color) {
|
|
26
35
|
const vec4 bitShift = vec4(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);
|
|
27
36
|
return dot(color, bitShift);
|
|
@@ -70,7 +79,7 @@ const linearDepthHelpers = /* glsl */ `
|
|
|
70
79
|
#ifdef VOL_LINEAR_DEPTH_PACKED
|
|
71
80
|
return volUnpack(texelFetch(s, coordinates, 0)) * volCameraMinMaxZ.y;
|
|
72
81
|
#else
|
|
73
|
-
return texelFetch(s, coordinates, 0).r;
|
|
82
|
+
return texelFetch(s, coordinates, 0).r * (1.0 / volLinearDepthScale);
|
|
74
83
|
#endif
|
|
75
84
|
}
|
|
76
85
|
|
|
@@ -86,8 +95,8 @@ const linearDepthHelpers = /* glsl */ `
|
|
|
86
95
|
* The linear depth pass. It is the first pass of the pipeline, so its input is the untouched color of the
|
|
87
96
|
* scene that the composition reads back, and it writes the distance along the view axis of each pixel.
|
|
88
97
|
*
|
|
89
|
-
* Every later pass reads this texture instead of the depth map of the depth source: a single
|
|
90
|
-
* channel is
|
|
98
|
+
* Every later pass reads this texture instead of the depth map of the depth source: a single 16 bits
|
|
99
|
+
* channel is a fraction of the memory traffic of the RGBA depth map, which matters for the thousands of reads
|
|
91
100
|
* of the depth-buffer occlusion, and it needs neither unpacking nor linearization. It is kept at the full
|
|
92
101
|
* resolution so the occlusion sees the geometry exactly as the surfaces of the scene draw it.
|
|
93
102
|
*/
|
|
@@ -103,6 +112,9 @@ uniform highp sampler2D depthSampler;
|
|
|
103
112
|
uniform vec2 volCameraMinMaxZ;
|
|
104
113
|
uniform vec2 volDepthUnpack;
|
|
105
114
|
|
|
115
|
+
// (1 when the pipeline has nothing to draw this frame, unused, unused, unused)
|
|
116
|
+
uniform vec4 volPassParams;
|
|
117
|
+
|
|
106
118
|
${packingHelpers}
|
|
107
119
|
${depthMapHelpers}
|
|
108
120
|
|
|
@@ -117,12 +129,19 @@ vec4 volPack(float depth) {
|
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
void main(void) {
|
|
132
|
+
// Nothing reads the linear depth while the pipeline has nothing to draw.
|
|
133
|
+
if (volPassParams.x > 0.5) {
|
|
134
|
+
gl_FragColor = vec4(0.0);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
120
138
|
float viewZ = volLinearDepth(volSampleDepth(vUV));
|
|
121
139
|
|
|
122
140
|
#ifdef VOL_LINEAR_DEPTH_PACKED
|
|
123
141
|
gl_FragColor = volPack(clamp(viewZ / volCameraMinMaxZ.y, 0.0, 0.9999999));
|
|
124
142
|
#else
|
|
125
|
-
|
|
143
|
+
// Bounded by the largest 16 bits float.
|
|
144
|
+
gl_FragColor = vec4(min(viewZ * volLinearDepthScale, 65504.0), 0.0, 0.0, 1.0);
|
|
126
145
|
#endif
|
|
127
146
|
}
|
|
128
147
|
`;
|
|
@@ -363,6 +382,9 @@ uniform vec3 volCameraForward;
|
|
|
363
382
|
uniform vec2 volCameraMinMaxZ;
|
|
364
383
|
uniform float volFrameIndex;
|
|
365
384
|
|
|
385
|
+
// Offset of the current frame along the golden ratio sequence the samples walk with the temporal accumulation.
|
|
386
|
+
uniform float volTemporalOffset;
|
|
387
|
+
|
|
366
388
|
uniform vec4 volFogInfos;
|
|
367
389
|
uniform vec3 volFogColor;
|
|
368
390
|
uniform float volLinearFogEps;
|
|
@@ -377,6 +399,9 @@ uniform vec3 volAmbient;
|
|
|
377
399
|
// (maximum distance, dithering strength, light extinction clamp, number of point and spot lights in the arrays)
|
|
378
400
|
uniform vec4 volParams;
|
|
379
401
|
|
|
402
|
+
// (1 when the pipeline has nothing to draw this frame, unused, unused, unused)
|
|
403
|
+
uniform vec4 volPassParams;
|
|
404
|
+
|
|
380
405
|
#if VOL_MAX_ARRAY_LIGHTS > 0
|
|
381
406
|
uniform vec4 volLightData[VOL_MAX_ARRAY_LIGHTS];
|
|
382
407
|
uniform vec4 volLightDiffuse[VOL_MAX_ARRAY_LIGHTS];
|
|
@@ -1008,6 +1033,12 @@ ${globalSlotContributions.join("")}
|
|
|
1008
1033
|
#endif
|
|
1009
1034
|
|
|
1010
1035
|
void main(void) {
|
|
1036
|
+
// Nothing to draw this frame: no light reaches the view and the medium neither glows nor attenuates anything.
|
|
1037
|
+
if (volPassParams.x > 0.5) {
|
|
1038
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1011
1042
|
// Reconstruct the world space direction of the view ray from the UV of the pixel.
|
|
1012
1043
|
vec4 farPoint = volInverseViewProjection * vec4(vUV * 2.0 - 1.0, 1.0, 1.0);
|
|
1013
1044
|
volRayDir = normalize(farPoint.xyz / farPoint.w - volCameraPosition);
|
|
@@ -1037,6 +1068,14 @@ void main(void) {
|
|
|
1037
1068
|
#endif
|
|
1038
1069
|
volNoise = volInterleavedGradientNoise(ditherPosition);
|
|
1039
1070
|
#endif
|
|
1071
|
+
|
|
1072
|
+
#ifdef VOL_TEMPORAL_ACCUMULATION
|
|
1073
|
+
// Each pixel walks the golden ratio sequence from the offset of its dithering pattern, one step per frame:
|
|
1074
|
+
// the samples of consecutive frames spread evenly over their segments, and the accumulation averages them.
|
|
1075
|
+
// The pattern of the pixels around stays the same, which is what lets the accumulation tell its noise from
|
|
1076
|
+
// the changes of the scene.
|
|
1077
|
+
volNoise = fract(volNoise + volTemporalOffset);
|
|
1078
|
+
#endif
|
|
1040
1079
|
volJitter = volNoise * volParams.y;
|
|
1041
1080
|
|
|
1042
1081
|
#ifdef VOL_SCREEN_SHADOWS
|
|
@@ -1100,6 +1139,120 @@ ${localSlotContributions.join("")}
|
|
|
1100
1139
|
}
|
|
1101
1140
|
`;
|
|
1102
1141
|
}
|
|
1142
|
+
/**
|
|
1143
|
+
* The temporal accumulation pass. Blends the scattering of the current frame, whose samples are offset from one
|
|
1144
|
+
* frame to the next, with the scattering accumulated over the previous frames: the result converges to the
|
|
1145
|
+
* integral the samples of all these frames estimate together, which is what lets each frame compute fewer of them.
|
|
1146
|
+
*
|
|
1147
|
+
* The history is reprojected on the current view, and clipped to the range of values the current frame shows
|
|
1148
|
+
* around the pixel so that a moving light, a moving occluder or a surface revealed by the motion of the camera
|
|
1149
|
+
* never leaves a trail. The blend follows the "factor" of the TAA rendering pipeline: the weight of the current frame.
|
|
1150
|
+
*/
|
|
1151
|
+
export function buildVolumetricLightingTemporalShader() {
|
|
1152
|
+
return /* glsl */ `precision highp float;
|
|
1153
|
+
precision highp int;
|
|
1154
|
+
|
|
1155
|
+
varying vec2 vUV;
|
|
1156
|
+
|
|
1157
|
+
// Scattering computed this frame, and scattering accumulated over the previous frames, both at the resolution of
|
|
1158
|
+
// the scattering buffer.
|
|
1159
|
+
uniform sampler2D textureSampler;
|
|
1160
|
+
uniform sampler2D volHistorySampler;
|
|
1161
|
+
|
|
1162
|
+
// Full resolution linear depth of the scene, written by the linear depth pass.
|
|
1163
|
+
uniform highp sampler2D volLinearDepthSampler;
|
|
1164
|
+
|
|
1165
|
+
uniform vec2 volCameraMinMaxZ;
|
|
1166
|
+
uniform vec2 volDepthRatio;
|
|
1167
|
+
uniform mat4 volInverseViewProjection;
|
|
1168
|
+
uniform vec3 volCameraPosition;
|
|
1169
|
+
uniform vec3 volCameraForward;
|
|
1170
|
+
|
|
1171
|
+
// View projection matrix of the previous frame, applied to positions relative to the current camera.
|
|
1172
|
+
uniform mat4 volPreviousViewProjection;
|
|
1173
|
+
|
|
1174
|
+
// (weight of the current frame, width of the clipping of the history in standard deviations, maximum distance of
|
|
1175
|
+
// the march, 1 when the history holds the previous frame, 2 when the previous frame had nothing to draw)
|
|
1176
|
+
uniform vec4 volTemporalParams;
|
|
1177
|
+
|
|
1178
|
+
// (distance the camera moved since the previous frame, part of the medium along the view ray whose change the
|
|
1179
|
+
// delay of the history may lag behind)
|
|
1180
|
+
uniform vec2 volTemporalMotion;
|
|
1181
|
+
|
|
1182
|
+
${packingHelpers}
|
|
1183
|
+
${linearDepthHelpers}
|
|
1184
|
+
|
|
1185
|
+
void main(void) {
|
|
1186
|
+
ivec2 texel = ivec2(gl_FragCoord.xy);
|
|
1187
|
+
ivec2 size = textureSize(textureSampler, 0);
|
|
1188
|
+
|
|
1189
|
+
// Bounded so a light next to the camera, which a half float can't hold, never turns the history infinite.
|
|
1190
|
+
vec4 current = min(texelFetch(textureSampler, texel, 0), vec4(65000.0));
|
|
1191
|
+
|
|
1192
|
+
if (volTemporalParams.w < 0.5) {
|
|
1193
|
+
gl_FragColor = current;
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
// The end of the marched part of the view ray is reprojected in the previous frame: the medium in front of it
|
|
1198
|
+
// is spread along the ray, but its scattering varies slowly enough for the surface behind it, or the maximum
|
|
1199
|
+
// distance of the march, to be a faithful anchor.
|
|
1200
|
+
ivec2 depthSize = textureSize(volLinearDepthSampler, 0);
|
|
1201
|
+
float viewZ = volReadLinearDepth(volLinearDepthSampler, volScatterToDepthTexel(texel, depthSize));
|
|
1202
|
+
|
|
1203
|
+
vec4 farPoint = volInverseViewProjection * vec4(vUV * 2.0 - 1.0, 1.0, 1.0);
|
|
1204
|
+
vec3 rayDir = normalize(farPoint.xyz / farPoint.w - volCameraPosition);
|
|
1205
|
+
float t = min(viewZ / max(dot(rayDir, volCameraForward), 1e-4), volTemporalParams.z);
|
|
1206
|
+
|
|
1207
|
+
vec4 previousClip = volPreviousViewProjection * vec4(rayDir * t, 1.0);
|
|
1208
|
+
vec2 previousUV = (previousClip.xy / previousClip.w) * 0.5 + 0.5;
|
|
1209
|
+
|
|
1210
|
+
if (previousClip.w <= 0.0 || previousUV.x < 0.0 || previousUV.x > 1.0 || previousUV.y < 0.0 || previousUV.y > 1.0) {
|
|
1211
|
+
gl_FragColor = current;
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
// The pipeline had nothing to draw the previous frame: no light at all, seen through the same medium.
|
|
1216
|
+
vec4 history = volTemporalParams.w > 1.5 ? vec4(0.0, 0.0, 0.0, current.a) : texture2D(volHistorySampler, previousUV);
|
|
1217
|
+
|
|
1218
|
+
// A history holding an infinity or a NaN would never recover from it.
|
|
1219
|
+
if (!all(lessThan(abs(history), vec4(1e20)))) {
|
|
1220
|
+
gl_FragColor = current;
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
// Variance clipping: the history is kept within what the current frame shows around the pixel.
|
|
1225
|
+
vec4 m1 = vec4(0.0);
|
|
1226
|
+
vec4 m2 = vec4(0.0);
|
|
1227
|
+
|
|
1228
|
+
for (int y = -1; y <= 1; ++y) {
|
|
1229
|
+
for (int x = -1; x <= 1; ++x) {
|
|
1230
|
+
vec4 c = min(texelFetch(textureSampler, clamp(texel + ivec2(x, y), ivec2(0), size - 1), 0), vec4(65000.0));
|
|
1231
|
+
m1 += c;
|
|
1232
|
+
m2 += c * c;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
vec4 mean = m1 * (1.0 / 9.0);
|
|
1237
|
+
vec4 sigma = sqrt(max(m2 * (1.0 / 9.0) - mean * mean, vec4(0.0)));
|
|
1238
|
+
vec4 clipped = clamp(history, mean - volTemporalParams.y * sigma, mean + volTemporalParams.y * sigma);
|
|
1239
|
+
|
|
1240
|
+
// The history holds the medium as seen from where the camera was. A rotation of the camera changes nothing to
|
|
1241
|
+
// what a view ray crosses, but moving it changes the medium along the view ray by about the distance it moved
|
|
1242
|
+
// relative to the length of the ray: the weight of the current frame grows with that change, so the delay of
|
|
1243
|
+
// the history never lags behind more than the given part of it.
|
|
1244
|
+
float motion = volTemporalMotion.x / max(t, 1e-3);
|
|
1245
|
+
float factor = max(volTemporalParams.x, motion / (motion + volTemporalMotion.y));
|
|
1246
|
+
|
|
1247
|
+
// The transmittance only depends on the length of medium in front of the surface: when it changed, the history
|
|
1248
|
+
// shows another surface and is dropped. Compared before the clipping, which would hide the change.
|
|
1249
|
+
float transmittanceChange = abs(history.a - current.a) / max(max(history.a, current.a), 1e-3);
|
|
1250
|
+
float historyWeight = (1.0 - factor) * (1.0 - smoothstep(0.02, 0.15, transmittanceChange));
|
|
1251
|
+
|
|
1252
|
+
gl_FragColor = mix(current, clipped, historyWeight);
|
|
1253
|
+
}
|
|
1254
|
+
`;
|
|
1255
|
+
}
|
|
1103
1256
|
/**
|
|
1104
1257
|
* The separable bilateral blur pass. Denoises the low resolution scattering buffer without letting the
|
|
1105
1258
|
* light shafts bleed across the silhouettes of the geometry.
|
|
@@ -1118,10 +1271,19 @@ uniform vec2 volDepthRatio;
|
|
|
1118
1271
|
uniform vec2 volBlurDirection;
|
|
1119
1272
|
uniform vec2 volBlurParams;
|
|
1120
1273
|
|
|
1274
|
+
// (1 when the pipeline has nothing to draw this frame, unused, unused, unused)
|
|
1275
|
+
uniform vec4 volPassParams;
|
|
1276
|
+
|
|
1121
1277
|
${packingHelpers}
|
|
1122
1278
|
${linearDepthHelpers}
|
|
1123
1279
|
|
|
1124
1280
|
void main(void) {
|
|
1281
|
+
// Nothing to draw this frame: the composition doesn't read the scattering buffer.
|
|
1282
|
+
if (volPassParams.x > 0.5) {
|
|
1283
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1125
1287
|
// The blur runs at the resolution of the scattering buffer and every tap is an exact texel, compared using
|
|
1126
1288
|
// the depth the raymarching used for it: no filtering is needed, no depth has to be unpacked nor linearized.
|
|
1127
1289
|
ivec2 size = textureSize(textureSampler, 0);
|
|
@@ -1178,6 +1340,9 @@ uniform vec2 volCameraMinMaxZ;
|
|
|
1178
1340
|
uniform vec2 volDepthRatio;
|
|
1179
1341
|
uniform vec4 volComposeParams;
|
|
1180
1342
|
|
|
1343
|
+
// (1 when the pipeline has nothing to draw this frame, unused, unused, unused)
|
|
1344
|
+
uniform vec4 volPassParams;
|
|
1345
|
+
|
|
1181
1346
|
${packingHelpers}
|
|
1182
1347
|
${linearDepthHelpers}
|
|
1183
1348
|
|
|
@@ -1237,6 +1402,13 @@ vec4 volUpsample(float centerDepth, ivec2 depthSize) {
|
|
|
1237
1402
|
}
|
|
1238
1403
|
|
|
1239
1404
|
void main(void) {
|
|
1405
|
+
// Nothing to draw this frame: the color of the scene passes through, exactly as it would under light shafts of
|
|
1406
|
+
// zero intensity.
|
|
1407
|
+
if (volPassParams.x > 0.5) {
|
|
1408
|
+
gl_FragColor = vec4(texture2D(volSceneSampler, vUV).rgb + (volBayer8(gl_FragCoord.xy) - 0.5) * volComposeParams.w, 1.0);
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1240
1412
|
// The linear depth has the full resolution of the canvas: same texel the depth map would give with a nearest filter.
|
|
1241
1413
|
ivec2 depthSize = textureSize(volLinearDepthSampler, 0);
|
|
1242
1414
|
float centerDepth = volReadLinearDepth(volLinearDepthSampler, min(ivec2(vUV * vec2(depthSize)), depthSize - 1));
|
|
@@ -1288,12 +1460,14 @@ export function registerVolumetricLightingShaders(shaderLanguage) {
|
|
|
1288
1460
|
const shaders = getVolumetricLightingShadersWGSL();
|
|
1289
1461
|
ShaderStore.ShadersStoreWGSL[`${volumetricLightingLinearDepthShaderName}PixelShader`] = shaders.linearDepth;
|
|
1290
1462
|
ShaderStore.ShadersStoreWGSL[`${volumetricLightingScatteringShaderName}PixelShader`] = shaders.scattering;
|
|
1463
|
+
ShaderStore.ShadersStoreWGSL[`${volumetricLightingTemporalShaderName}PixelShader`] = shaders.temporal;
|
|
1291
1464
|
ShaderStore.ShadersStoreWGSL[`${volumetricLightingBlurShaderName}PixelShader`] = shaders.blur;
|
|
1292
1465
|
ShaderStore.ShadersStoreWGSL[`${volumetricLightingComposeShaderName}PixelShader`] = shaders.compose;
|
|
1293
1466
|
return;
|
|
1294
1467
|
}
|
|
1295
1468
|
ShaderStore.ShadersStore[`${volumetricLightingLinearDepthShaderName}PixelShader`] = buildVolumetricLightingLinearDepthShader();
|
|
1296
1469
|
ShaderStore.ShadersStore[`${volumetricLightingScatteringShaderName}PixelShader`] = buildVolumetricLightingScatteringShader(maxVolumetricShadowSlots);
|
|
1470
|
+
ShaderStore.ShadersStore[`${volumetricLightingTemporalShaderName}PixelShader`] = buildVolumetricLightingTemporalShader();
|
|
1297
1471
|
ShaderStore.ShadersStore[`${volumetricLightingBlurShaderName}PixelShader`] = buildVolumetricLightingBlurShader();
|
|
1298
1472
|
ShaderStore.ShadersStore[`${volumetricLightingComposeShaderName}PixelShader`] = buildVolumetricLightingComposeShader();
|
|
1299
1473
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shaders.js","sourceRoot":"","sources":["../../../../src/rendering/volumetric/shaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1E,OAAO,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,+BAA+B,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,8BAA8B,CAAC;AAErF;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,wBAAwB,CAAC;AAEzE;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,2BAA2B,CAAC;AAE/E
|
|
1
|
+
{"version":3,"file":"shaders.js","sourceRoot":"","sources":["../../../../src/rendering/volumetric/shaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1E,OAAO,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,+BAA+B,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,8BAA8B,CAAC;AAErF;;GAEG;AACH,MAAM,CAAC,MAAM,oCAA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,IAAI,CAAC;IAElC,IAAI,cAAc,KAAK,cAAc,CAAC,IAAI,EAAE,CAAC;QAC5C,MAAM,OAAO,GAAG,gCAAgC,EAAE,CAAC;QAEnD,WAAW,CAAC,gBAAgB,CAAC,GAAG,uCAAuC,aAAa,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;QAC5G,WAAW,CAAC,gBAAgB,CAAC,GAAG,sCAAsC,aAAa,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;QAC1G,WAAW,CAAC,gBAAgB,CAAC,GAAG,oCAAoC,aAAa,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC;QACtG,WAAW,CAAC,gBAAgB,CAAC,GAAG,gCAAgC,aAAa,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;QAC9F,WAAW,CAAC,gBAAgB,CAAC,GAAG,mCAAmC,aAAa,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;QAEpG,OAAO;IACR,CAAC;IAED,WAAW,CAAC,YAAY,CAAC,GAAG,uCAAuC,aAAa,CAAC,GAAG,wCAAwC,EAAE,CAAC;IAC/H,WAAW,CAAC,YAAY,CAAC,GAAG,sCAAsC,aAAa,CAAC,GAAG,uCAAuC,CAAC,wBAAwB,CAAC,CAAC;IACrJ,WAAW,CAAC,YAAY,CAAC,GAAG,oCAAoC,aAAa,CAAC,GAAG,qCAAqC,EAAE,CAAC;IACzH,WAAW,CAAC,YAAY,CAAC,GAAG,gCAAgC,aAAa,CAAC,GAAG,iCAAiC,EAAE,CAAC;IACjH,WAAW,CAAC,YAAY,CAAC,GAAG,mCAAmC,aAAa,CAAC,GAAG,oCAAoC,EAAE,CAAC;AACxH,CAAC"}
|
|
@@ -20,6 +20,12 @@ export const maxVolumetricArrayLights = 256;
|
|
|
20
20
|
* point and spot lights, a directional light lights the whole view ray, so each one costs a full march.
|
|
21
21
|
*/
|
|
22
22
|
export const maxVolumetricDirectionalLights = 4;
|
|
23
|
+
/**
|
|
24
|
+
* Defines by how much the temporal accumulation divides the number of samples the raymarching computes each
|
|
25
|
+
* frame. The samples of consecutive frames are offset from each other, so the accumulated result still
|
|
26
|
+
* averages at least as many positions along each view ray as the configured steps.
|
|
27
|
+
*/
|
|
28
|
+
export const volumetricTemporalSamplesDivider = 3;
|
|
23
29
|
/**
|
|
24
30
|
* Defines the available step distributions used while raymarching the participating medium.
|
|
25
31
|
*/
|
|
@@ -105,7 +111,7 @@ export function getDefaultVolumetricLightConfiguration() {
|
|
|
105
111
|
anisotropy: 0.35,
|
|
106
112
|
useCustomColor: false,
|
|
107
113
|
color: [1, 1, 1],
|
|
108
|
-
castVolumetricShadows:
|
|
114
|
+
castVolumetricShadows: false,
|
|
109
115
|
shadowDarkness: 1,
|
|
110
116
|
rangeMultiplier: 1,
|
|
111
117
|
priority: 0,
|
|
@@ -123,6 +129,8 @@ export function getDefaultVolumetricLightingConfiguration() {
|
|
|
123
129
|
ditherMode: VolumetricDitherMode.InterleavedGradientNoise,
|
|
124
130
|
ditherStrength: 1,
|
|
125
131
|
temporalJitter: false,
|
|
132
|
+
temporalAccumulation: false,
|
|
133
|
+
temporalAccumulationFactor: 0.1,
|
|
126
134
|
fogMode: VolumetricFogMode.Exponential,
|
|
127
135
|
fogDensity: 0.0005,
|
|
128
136
|
fogStart: 0,
|
|
@@ -166,6 +174,22 @@ export function getVolumetricLightSteps(configuration) {
|
|
|
166
174
|
}
|
|
167
175
|
return Math.max(4, Math.min(64, Math.round(configuration.steps * 0.3)));
|
|
168
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Returns the number of samples the raymarching computes each frame. With the temporal accumulation the
|
|
179
|
+
* configured values are divided, the history of the previous frames providing the samples each frame skips.
|
|
180
|
+
* @param configuration defines the configuration of the pipeline.
|
|
181
|
+
* @param temporalSamplesDivider defines by how much the temporal accumulation divides the number of samples.
|
|
182
|
+
*/
|
|
183
|
+
export function getVolumetricSamplingSteps(configuration, temporalSamplesDivider = volumetricTemporalSamplesDivider) {
|
|
184
|
+
const lightSteps = getVolumetricLightSteps(configuration);
|
|
185
|
+
if (!configuration.temporalAccumulation || temporalSamplesDivider <= 1) {
|
|
186
|
+
return { steps: configuration.steps, lightSteps };
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
steps: Math.max(4, Math.ceil(configuration.steps / temporalSamplesDivider)),
|
|
190
|
+
lightSteps: Math.max(2, Math.ceil(lightSteps / temporalSamplesDivider)),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
169
193
|
function normalizeNumber(value, defaultValue, min, max) {
|
|
170
194
|
const result = typeof value === "number" && isFinite(value) ? value : defaultValue;
|
|
171
195
|
return Math.min(max, Math.max(min, result));
|
|
@@ -215,6 +239,8 @@ export function normalizeVolumetricLightingConfiguration(data) {
|
|
|
215
239
|
ditherMode: Math.round(normalizeNumber(data.ditherMode, defaults.ditherMode, 0, 2)),
|
|
216
240
|
ditherStrength: normalizeNumber(data.ditherStrength, defaults.ditherStrength, 0, 1),
|
|
217
241
|
temporalJitter: data.temporalJitter ?? defaults.temporalJitter,
|
|
242
|
+
temporalAccumulation: data.temporalAccumulation ?? defaults.temporalAccumulation,
|
|
243
|
+
temporalAccumulationFactor: normalizeNumber(data.temporalAccumulationFactor, defaults.temporalAccumulationFactor, 0.005, 1),
|
|
218
244
|
fogMode: Math.round(normalizeNumber(data.fogMode, defaults.fogMode, 0, 2)),
|
|
219
245
|
fogDensity: normalizeNumber(data.fogDensity, defaults.fogDensity, 0, 100),
|
|
220
246
|
fogStart: normalizeNumber(data.fogStart, defaults.fogStart, 0, 1_000_000),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/rendering/volumetric/types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAN,IAAY,0BAUX;AAVD,WAAY,0BAA0B;IACrC;;OAEG;IACH,+EAAU,CAAA;IACV;;;OAGG;IACH,yFAAe,CAAA;AAChB,CAAC,EAVW,0BAA0B,KAA1B,0BAA0B,QAUrC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAaX;AAbD,WAAY,oBAAoB;IAC/B;;OAEG;IACH,+DAAQ,CAAA;IACR;;OAEG;IACH,iEAAS,CAAA;IACT;;OAEG;IACH,uGAA4B,CAAA;AAC7B,CAAC,EAbW,oBAAoB,KAApB,oBAAoB,QAa/B;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,iBAaX;AAbD,WAAY,iBAAiB;IAC5B;;OAEG;IACH,uEAAe,CAAA;IACf;;OAEG;IACH,qFAAsB,CAAA;IACtB;;OAEG;IACH,6DAAU,CAAA;AACX,CAAC,EAbW,iBAAiB,KAAjB,iBAAiB,QAa5B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,mBAiBX;AAjBD,WAAY,mBAAmB;IAC9B;;OAEG;IACH,6DAAQ,CAAA;IACR;;OAEG;IACH,yEAAc,CAAA;IACd;;OAEG;IACH,+EAAiB,CAAA;IACjB;;OAEG;IACH,yEAAc,CAAA;AACf,CAAC,EAjBW,mBAAmB,KAAnB,mBAAmB,QAiB9B;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/rendering/volumetric/types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C;;;GAGG;AACH,MAAM,CA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;GAGG;AACH,MAAM,UAAU,+BAA+B,CAAC,KAAY;IAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,0BAA0B,CAAC,CAAC;IAC1D,OAAO,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,kCAAkC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAY;IACpD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,0BAA0B,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AACvE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumetric-lighting.js","sourceRoot":"","sources":["../../../src/rendering/volumetric-lighting.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"volumetric-lighting.js","sourceRoot":"","sources":["../../../src/rendering/volumetric-lighting.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAoC,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAEhH,IAAI,mCAAmC,GAA+C,IAAI,CAAC;AAE3F;;GAEG;AACH,IAAI,aAAa,GAAQ,IAAI,CAAC;AAE9B,MAAM,UAAU,mDAAmD;IAClE,OAAO,aAAa,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,mDAAmD,CAAC,MAAW;IAC9E,aAAa,GAAG,MAAM,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,sCAAsC;IACrD,oGAAoG;IACpG,qGAAqG;IACrG,IAAI,mCAAmC,EAAE,UAAU,EAAE,CAAC;QACrD,mCAAmC,GAAG,IAAI,CAAC;IAC5C,CAAC;IAED,OAAO,mCAAmC,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yCAAyC,CAAC,QAAoD;IAC7G,mCAAmC,GAAG,QAAQ,CAA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,oBAAoB,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtH,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACxC,aAAa,CAAC,MAAM,GAAG,mCAAmC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9G,CAAC;IACD,IAAI,aAAa,CAAC,4BAA4B,KAAK,SAAS,EAAE,CAAC;QAC9D,aAAa,CAAC,4BAA4B,GAAG,mCAAmC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpI,CAAC;IAED,QAAQ,CAAC,kBAAkB,CAAC,wCAAwC,CAAC,aAAa,CAAqC,CAAC,CAAC;IAEzH,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB;IACxC,mCAAmC,EAAE,eAAe,EAAE,CAAC;AACxD,CAAC"}
|
package/build/src/tools/scene.js
CHANGED
|
@@ -6,14 +6,27 @@ import { isClusteredLightContainer } from "./guards";
|
|
|
6
6
|
* @param scene defines the reference to the scene to search the node in.
|
|
7
7
|
* @returns the node if found, otherwise null.
|
|
8
8
|
*/
|
|
9
|
-
export function getNodeByName(name, scene) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export function getNodeByName(name, scene, container = null) {
|
|
10
|
+
if (container) {
|
|
11
|
+
const node = container.getNodes().find((node) => node.name === name);
|
|
12
|
+
if (node) {
|
|
13
|
+
return node;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const node = scene.getNodeByName(name);
|
|
18
|
+
if (node) {
|
|
19
|
+
return node;
|
|
20
|
+
}
|
|
13
21
|
}
|
|
14
22
|
const clusteredLightContainers = scene.lights.filter((light) => isClusteredLightContainer(light));
|
|
15
23
|
for (const clusteredLightContainer of clusteredLightContainers) {
|
|
16
|
-
const lightNode = clusteredLightContainer.lights.find((light) =>
|
|
24
|
+
const lightNode = clusteredLightContainer.lights.find((light) => {
|
|
25
|
+
if (container) {
|
|
26
|
+
return light.name === name && light._parentContainer === container;
|
|
27
|
+
}
|
|
28
|
+
return light.name === name;
|
|
29
|
+
});
|
|
17
30
|
if (lightNode) {
|
|
18
31
|
return lightNode;
|
|
19
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.js","sourceRoot":"","sources":["../../../src/tools/scene.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scene.js","sourceRoot":"","sources":["../../../src/tools/scene.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,KAAY,EAAE,SAAS,GAA0B,IAAI;IAChG,IAAI,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACrE,IAAI,IAAI,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;SAAM,CAAC;QACP,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,IAAI,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;IAED,MAAM,wBAAwB,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC;IAClG,KAAK,MAAM,uBAAuB,IAAI,wBAAwB,EAAE,CAAC;QAChE,MAAM,SAAS,GAAG,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YAC/D,IAAI,SAAS,EAAE,CAAC;gBACf,OAAO,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,gBAAgB,KAAK,SAAS,CAAC;YACpE,CAAC;YAED,OAAO,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;QAC5B,CAAC,CAAC,CAAC;QACH,IAAI,SAAS,EAAE,CAAC;YACf,OAAO,SAAS,CAAC;QAClB,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU,EAAE,KAAY;IACnD,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACnC,IAAI,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,wBAAwB,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC;IAClG,KAAK,MAAM,uBAAuB,IAAI,wBAAwB,EAAE,CAAC;QAChE,MAAM,SAAS,GAAG,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAClF,IAAI,SAAS,EAAE,CAAC;YACf,OAAO,SAAS,CAAC;QAClB,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -3,16 +3,15 @@ import { Observer } from "@babylonjs/core/Misc/observable";
|
|
|
3
3
|
import { PointerInfo } from "@babylonjs/core/Events/pointerEvents";
|
|
4
4
|
import { KeyboardInfo } from "@babylonjs/core/Events/keyboardEvents";
|
|
5
5
|
import { AdvancedDynamicTexture } from "@babylonjs/gui/2D/advancedDynamicTexture";
|
|
6
|
+
import { NodeFromSceneOptions } from "./scene";
|
|
7
|
+
import { SoundFromSceneOptions } from "./sound";
|
|
6
8
|
import { IPointerEventDecoratorOptions } from "./events";
|
|
7
9
|
import { VisibleInInspectorDecoratorConfiguration } from "./inspector";
|
|
8
10
|
export interface ISceneDecoratorData {
|
|
9
11
|
_NodesFromScene?: {
|
|
10
12
|
nodeName: string;
|
|
11
13
|
propertyKey: string | Symbol;
|
|
12
|
-
|
|
13
|
-
_ComponentsFromScene?: {
|
|
14
|
-
componentConstructor: new (...args: any) => any;
|
|
15
|
-
propertyKey: string | Symbol;
|
|
14
|
+
options?: NodeFromSceneOptions;
|
|
16
15
|
}[];
|
|
17
16
|
_NodesFromDescendants?: {
|
|
18
17
|
nodeName: string;
|
|
@@ -26,6 +25,11 @@ export interface ISceneDecoratorData {
|
|
|
26
25
|
_SoundsFromScene?: {
|
|
27
26
|
soundName: string;
|
|
28
27
|
propertyKey: string | Symbol;
|
|
28
|
+
options?: SoundFromSceneOptions;
|
|
29
|
+
}[];
|
|
30
|
+
_ComponentsFromScene?: {
|
|
31
|
+
componentConstructor: new (...args: any) => any;
|
|
32
|
+
propertyKey: string | Symbol;
|
|
29
33
|
}[];
|
|
30
34
|
_GuiFromAsset?: {
|
|
31
35
|
pathInAssets: string;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export type NodeFromSceneOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Defines whether or not the node should be searched for globally in the scene instead of being scoped to the container the node comes from.
|
|
4
|
+
* Each scene loaded using `@sceneAsset` or `@visibleAsEntity("scene", ...)` is loaded into its own asset container before it's added to the main scene.
|
|
5
|
+
* Setting `global: false` will restrict the search to the asset container the node comes from.
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
global?: boolean;
|
|
9
|
+
};
|
|
1
10
|
/**
|
|
2
11
|
* Makes the decorated property linked to the node that has the given name.
|
|
3
12
|
* Once the script is instantiated, the reference to the node is retrieved from the scene
|
|
@@ -5,15 +14,7 @@
|
|
|
5
14
|
* This can be used only by scripts using Classes.
|
|
6
15
|
* @param nodeName defines the name of the node to retrieve in scene.
|
|
7
16
|
*/
|
|
8
|
-
export declare function nodeFromScene(nodeName: string): (target: any, propertyKey: string | Symbol) => void;
|
|
9
|
-
/**
|
|
10
|
-
* Makes the decorated property linked to the instantiated component of the given constructor type.
|
|
11
|
-
* Once the script is instantiated, the reference to the component is retrieved from the scene
|
|
12
|
-
* and assigned to the property. Components link cant' be used in constructor.
|
|
13
|
-
* This can be used only by scripts using Classes.
|
|
14
|
-
* @param componentConstructor defines the class of the type to retrieve.
|
|
15
|
-
*/
|
|
16
|
-
export declare function componentFromScene<T extends new (...args: any) => any>(componentConstructor: T): (target: any, propertyKey: string | Symbol) => void;
|
|
17
|
+
export declare function nodeFromScene(nodeName: string, options?: NodeFromSceneOptions): (target: any, propertyKey: string | Symbol) => void;
|
|
17
18
|
/**
|
|
18
19
|
* Makes the decorated property linked to the node that has the given name.
|
|
19
20
|
* Once the script is instantiated, the reference to the node is retrieved from the descendants
|
|
@@ -40,3 +41,11 @@ export declare function animationGroupFromScene(animationGroupName: string): (ta
|
|
|
40
41
|
* @example \@sceneAsset("blaster.babylon") public myBlasterScene: AdvancedAssetContainer;
|
|
41
42
|
*/
|
|
42
43
|
export declare function sceneAsset(sceneName: string): (target: any, propertyKey: string | Symbol) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Makes the decorated property linked to the instantiated component of the given constructor type.
|
|
46
|
+
* Once the script is instantiated, the reference to the component is retrieved from the scene
|
|
47
|
+
* and assigned to the property. Components link cant' be used in constructor.
|
|
48
|
+
* This can be used only by scripts using Classes.
|
|
49
|
+
* @param componentConstructor defines the class of the type to retrieve.
|
|
50
|
+
*/
|
|
51
|
+
export declare function componentFromScene<T extends new (...args: any) => any>(componentConstructor: T): (target: any, propertyKey: string | Symbol) => void;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export type SoundFromSceneOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Defines whether or not the node should be searched for globally in the scene instead of being scoped to the container the node comes from.
|
|
4
|
+
* Each scene loaded using `@sceneAsset` or `@visibleAsEntity("scene", ...)` is loaded into its own asset container before it's added to the main scene.
|
|
5
|
+
* Setting `global: false` will restrict the search to the asset container the node comes from.
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
global?: boolean;
|
|
9
|
+
};
|
|
1
10
|
/**
|
|
2
11
|
* Makes the decorated property linked to the sound that has the given name.
|
|
3
12
|
* Once the script is instantiated, the reference to the sound is retrieved from the scene
|
|
@@ -5,4 +14,4 @@
|
|
|
5
14
|
* This can be used only by scripts using Classes.
|
|
6
15
|
* @param soundName defines the name of the sound to retrieve in scene.
|
|
7
16
|
*/
|
|
8
|
-
export declare function soundFromScene(soundName: string): (target: any, propertyKey: string | Symbol) => void;
|
|
17
|
+
export declare function soundFromScene(soundName: string, options?: SoundFromSceneOptions): (target: any, propertyKey: string | Symbol) => void;
|
|
@@ -24,6 +24,7 @@ export * from "./rendering/motion-blur";
|
|
|
24
24
|
export * from "./rendering/default-pipeline";
|
|
25
25
|
export * from "./rendering/volumetric-lighting";
|
|
26
26
|
export * from "./rendering/tools";
|
|
27
|
+
export * from "./rendering/order";
|
|
27
28
|
export * from "./rendering/volumetric/types";
|
|
28
29
|
export * from "./rendering/volumetric/selector";
|
|
29
30
|
export * from "./rendering/volumetric/depth";
|
|
@@ -66,4 +66,4 @@ declare module "@babylonjs/core/scene" {
|
|
|
66
66
|
loadingLodsQuality: SceneLoaderQualitySelector;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
export declare function loadScene(rootUrl:
|
|
69
|
+
export declare function loadScene(rootUrl: string, sceneFilename: string, scene: Scene, scriptsMap: ScriptMap, options?: SceneLoaderOptions): Promise<void>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Scene } from "@babylonjs/core/scene";
|
|
2
|
+
import { Camera } from "@babylonjs/core/Cameras/camera";
|
|
3
|
+
/**
|
|
4
|
+
* Defines the order in which the rendering pipelines and post-processes handled by the editor run on a camera,
|
|
5
|
+
* identified by their class name. It is the order "applyRenderingConfigurationForCamera" creates them in: the
|
|
6
|
+
* effects working on the linear color of the scene first, then the image processing of the default rendering
|
|
7
|
+
* pipeline and finally the temporal anti-aliasing.
|
|
8
|
+
*/
|
|
9
|
+
export declare const renderingPipelinesOrder: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Sorts the post-processes of the given camera so the rendering pipelines and post-processes handled by the editor
|
|
12
|
+
* always run in the order defined by "renderingPipelinesOrder".
|
|
13
|
+
*
|
|
14
|
+
* Babylon.js always appends the post-processes it attaches at the end of the chain of the camera, so enabling a
|
|
15
|
+
* pipeline again, or a pipeline rebuilding itself (the default rendering pipeline does it each time one of its
|
|
16
|
+
* effects is toggled), would make it run after the ones that must follow it: typically the volumetric lighting
|
|
17
|
+
* after the tone mapping of the default rendering pipeline, adding linear light to a gamma corrected color.
|
|
18
|
+
*
|
|
19
|
+
* Only the post-processes of the known pipelines move, among the slots they already occupy: the other ones, and the
|
|
20
|
+
* empty slots left by the detached post-processes, keep their place.
|
|
21
|
+
* @param camera defines the reference to the camera to sort its post-processes.
|
|
22
|
+
* @returns true when the post-processes were out of order and have been sorted.
|
|
23
|
+
*/
|
|
24
|
+
export declare function sortCameraPostProcesses(camera: Camera): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Keeps the rendering pipelines and post-processes of every camera of the given scene in the order defined by
|
|
27
|
+
* "renderingPipelinesOrder", checked each time a camera is about to render. Calling this function multiple times
|
|
28
|
+
* for the same scene has no effect.
|
|
29
|
+
* @param scene defines the reference to the scene to keep its rendering pipelines ordered.
|
|
30
|
+
*/
|
|
31
|
+
export declare function keepRenderingPipelinesOrdered(scene: Scene): void;
|