@onerjs/core 8.26.3 → 8.26.4
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/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +0 -6
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/frameGraphContext.d.ts +1 -2
- package/FrameGraph/frameGraphContext.js +1 -4
- package/FrameGraph/frameGraphContext.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.d.ts +1 -1
- package/Lights/Clustered/clusteredLightContainer.js +5 -4
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
- package/Lights/pointLight.js +4 -4
- package/Lights/pointLight.js.map +1 -1
- package/Lights/rectAreaLight.js +4 -4
- package/Lights/rectAreaLight.js.map +1 -1
- package/Lights/spotLight.js +2 -2
- package/Lights/spotLight.js.map +1 -1
- package/Materials/Background/backgroundMaterial.d.ts +91 -19
- package/Materials/Background/backgroundMaterial.js +245 -17
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +4 -15
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +5 -28
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +69 -57
- package/Materials/Node/nodeMaterial.js +86 -9
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +1 -3
- package/Materials/Node/nodeMaterialBuildState.js +15 -35
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/PBR/index.d.ts +0 -5
- package/Materials/PBR/index.js +0 -5
- package/Materials/PBR/index.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +43 -57
- package/Materials/PBR/pbrBaseMaterial.js +304 -21
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +78 -0
- package/Materials/PBR/pbrMaterial.js +110 -0
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/imageProcessingConfiguration.defines.d.ts +0 -25
- package/Materials/imageProcessingConfiguration.defines.js +0 -27
- package/Materials/imageProcessingConfiguration.defines.js.map +1 -1
- package/Materials/index.d.ts +0 -2
- package/Materials/index.js +0 -2
- package/Materials/index.js.map +1 -1
- package/Materials/material.d.ts +0 -14
- package/Materials/material.js +0 -14
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.functions.d.ts +0 -53
- package/Materials/materialHelper.functions.js +0 -297
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/standardMaterial.d.ts +121 -57
- package/Materials/standardMaterial.js +250 -21
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +0 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Misc/decorators.d.ts +0 -7
- package/Misc/decorators.js +0 -34
- package/Misc/decorators.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js +1 -10
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
- package/Particles/Node/Blocks/index.d.ts +0 -2
- package/Particles/Node/Blocks/index.js +0 -2
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleInputBlock.js +1 -4
- package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +1 -2
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +0 -45
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +1 -2
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +4 -6
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/iblCdfGenerator.js +20 -28
- package/Rendering/iblCdfGenerator.js.map +1 -1
- package/Rendering/reflectiveShadowMap.d.ts +3 -3
- package/Shaders/ShadersInclude/backgroundUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/backgroundUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/clusteredLightingFunctions.js +1 -3
- package/Shaders/ShadersInclude/clusteredLightingFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/defaultUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/defaultUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +0 -34
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js +1 -1
- package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/importanceSampling.js +0 -4
- package/Shaders/ShadersInclude/importanceSampling.js.map +1 -1
- package/Shaders/ShadersInclude/lightsFragmentFunctions.js +0 -1
- package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +0 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +1 -3
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrHelperFunctions.js +0 -2
- package/Shaders/ShadersInclude/pbrHelperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +0 -28
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/importanceSampling.js +0 -4
- package/ShadersWGSL/ShadersInclude/importanceSampling.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -3
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js +0 -2
- package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +0 -21
- package/scene.js +3 -29
- package/scene.js.map +1 -1
- package/Materials/PBR/openPbrMaterial.d.ts +0 -998
- package/Materials/PBR/openPbrMaterial.js +0 -2069
- package/Materials/PBR/openPbrMaterial.js.map +0 -1
- package/Materials/floatingOriginMatrixOverrides.d.ts +0 -3
- package/Materials/floatingOriginMatrixOverrides.js +0 -91
- package/Materials/floatingOriginMatrixOverrides.js.map +0 -1
- package/Materials/imageProcessing.d.ts +0 -65
- package/Materials/imageProcessing.js +0 -162
- package/Materials/imageProcessing.js.map +0 -1
- package/Materials/uv.defines.d.ts +0 -22
- package/Materials/uv.defines.js +0 -24
- package/Materials/uv.defines.js.map +0 -1
- package/Particles/Node/Blocks/particleLocalVariableBlock.d.ts +0 -38
- package/Particles/Node/Blocks/particleLocalVariableBlock.js +0 -108
- package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +0 -1
- package/Particles/Node/Blocks/particleVectorLengthBlock.d.ts +0 -26
- package/Particles/Node/Blocks/particleVectorLengthBlock.js +0 -50
- package/Particles/Node/Blocks/particleVectorLengthBlock.js.map +0 -1
|
@@ -11,7 +11,6 @@ import type { AbstractEngine } from "../Engines/abstractEngine.js";
|
|
|
11
11
|
import type { Material } from "./material.js";
|
|
12
12
|
import type { Nullable } from "../types.js";
|
|
13
13
|
import type { MorphTargetManager } from "../Morph/morphTargetManager.js";
|
|
14
|
-
import { Color3 } from "../Maths/math.color.js";
|
|
15
14
|
/**
|
|
16
15
|
* Binds the logarithmic depth information from the scene to the effect for the given defines.
|
|
17
16
|
* @param defines The generated defines used in the effect
|
|
@@ -75,30 +74,6 @@ export declare function BindMorphTargetParameters(abstractMesh: AbstractMesh, ef
|
|
|
75
74
|
* @param sceneUbo defines the uniform buffer storing scene data
|
|
76
75
|
*/
|
|
77
76
|
export declare function BindSceneUniformBuffer(effect: Effect, sceneUbo: UniformBuffer): void;
|
|
78
|
-
/**
|
|
79
|
-
* Update parameters for IBL
|
|
80
|
-
* @param scene The scene
|
|
81
|
-
* @param defines The list of shader defines for the material
|
|
82
|
-
* @param ubo The uniform buffer to update
|
|
83
|
-
* @param reflectionTexture The IBL texture
|
|
84
|
-
* @param realTimeFiltering Whether realtime filtering of IBL texture is being used
|
|
85
|
-
* @param supportTextureInfo Whether the texture info is supported
|
|
86
|
-
* @param supportLocalProjection Whether local projection is supported
|
|
87
|
-
* @param usePBR Whether PBR is being used
|
|
88
|
-
* @param supportSH Whether spherical harmonics are supported
|
|
89
|
-
* @param useColor Whether to use the reflection color
|
|
90
|
-
* @param reflectionColor The color to use for the reflection
|
|
91
|
-
*/
|
|
92
|
-
export declare function BindIBLParameters(scene: Scene, defines: any, ubo: UniformBuffer, reflectionTexture?: Nullable<BaseTexture>, realTimeFiltering?: boolean, supportTextureInfo?: boolean, supportLocalProjection?: boolean, usePBR?: boolean, supportSH?: boolean, useColor?: boolean, reflectionColor?: Color3): void;
|
|
93
|
-
/**
|
|
94
|
-
* Update parameters for IBL
|
|
95
|
-
* @param scene The scene
|
|
96
|
-
* @param defines The list of shader defines for the material
|
|
97
|
-
* @param ubo The uniform buffer to update
|
|
98
|
-
* @param reflectionTexture The IBL texture
|
|
99
|
-
* @param realTimeFiltering Whether realtime filtering of IBL texture is being used
|
|
100
|
-
*/
|
|
101
|
-
export declare function BindIBLSamplers(scene: Scene, defines: any, ubo: UniformBuffer, reflectionTexture?: Nullable<BaseTexture>, realTimeFiltering?: boolean): void;
|
|
102
77
|
/**
|
|
103
78
|
* Helps preparing the defines values about the UVs in used in the effect.
|
|
104
79
|
* UVs are shared as much as we can across channels in the shaders.
|
|
@@ -210,17 +185,6 @@ export declare function PrepareDefinesForMisc(mesh: AbstractMesh, scene: Scene,
|
|
|
210
185
|
* @returns true if normals will be required for the rest of the effect
|
|
211
186
|
*/
|
|
212
187
|
export declare function PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: any, specularSupported: boolean, maxSimultaneousLights?: number, disableLighting?: boolean): boolean;
|
|
213
|
-
/**
|
|
214
|
-
* Prepare defines relating to IBL logic.
|
|
215
|
-
* @param scene The scene
|
|
216
|
-
* @param reflectionTexture The texture to use for IBL
|
|
217
|
-
* @param defines The defines to update
|
|
218
|
-
* @param realTimeFiltering Whether realtime filting of IBL texture is being used
|
|
219
|
-
* @param realTimeFilteringQuality The quality of realtime filtering
|
|
220
|
-
* @param forceSHInVertex Whether the SH are handled in the vertex shader
|
|
221
|
-
* @returns true if the defines were updated
|
|
222
|
-
*/
|
|
223
|
-
export declare function PrepareDefinesForIBL(scene: Scene, reflectionTexture: Nullable<BaseTexture>, defines: any, realTimeFiltering?: boolean, realTimeFilteringQuality?: number, forceSHInVertex?: boolean): boolean;
|
|
224
188
|
/**
|
|
225
189
|
* Prepares the defines related to the light information passed in parameter
|
|
226
190
|
* @param scene The scene we are intending to draw
|
|
@@ -323,13 +287,6 @@ export declare function PrepareDefinesForCamera(scene: Scene, defines: any): boo
|
|
|
323
287
|
* @param clusteredLightTextures defines if the clustered light textures must be used
|
|
324
288
|
*/
|
|
325
289
|
export declare function PrepareUniformsAndSamplersForLight(lightIndex: number, uniformsList: string[], samplersList: string[], projectedLightTexture?: any, uniformBuffersList?: Nullable<string[]>, updateOnlyBuffersList?: boolean, iesLightTexture?: boolean, clusteredLightTextures?: boolean): void;
|
|
326
|
-
/**
|
|
327
|
-
* Append uniforms and samplers related to IBL to the provided lists
|
|
328
|
-
* @param uniformsList The list of uniforms to append to
|
|
329
|
-
* @param samplersList The list of samplers to append to
|
|
330
|
-
* @param useSH Whether to include spherical harmonics uniforms
|
|
331
|
-
*/
|
|
332
|
-
export declare function PrepareUniformsAndSamplersForIBL(uniformsList: string[], samplersList: string[], useSH: boolean): void;
|
|
333
290
|
/**
|
|
334
291
|
* Prepares the uniforms and samplers list to be used in the effect
|
|
335
292
|
* @param uniformsListOrOptions The uniform names to prepare or an EffectCreationOptions containing the list and extra information
|
|
@@ -338,13 +295,3 @@ export declare function PrepareUniformsAndSamplersForIBL(uniformsList: string[],
|
|
|
338
295
|
* @param maxSimultaneousLights The maximum number of simultaneous light allowed in the effect
|
|
339
296
|
*/
|
|
340
297
|
export declare function PrepareUniformsAndSamplersList(uniformsListOrOptions: string[] | IEffectCreationOptions, samplersList?: string[], defines?: any, maxSimultaneousLights?: number): void;
|
|
341
|
-
/**
|
|
342
|
-
*
|
|
343
|
-
* @param ubo Add uniforms to UBO
|
|
344
|
-
* @param supportTextureInfo Add uniforms for texture info if true
|
|
345
|
-
* @param supportLocalProjection Add uniforms for local projection if true
|
|
346
|
-
* @param usePBR Add uniforms for IBL if true
|
|
347
|
-
* @param supportSH Add uniforms for spherical harmonics if true
|
|
348
|
-
* @param useColor Add uniforms for reflection color if true
|
|
349
|
-
*/
|
|
350
|
-
export declare function PrepareUniformLayoutForIBL(ubo: UniformBuffer, supportTextureInfo?: boolean, supportLocalProjection?: boolean, usePBR?: boolean, supportSH?: boolean, useColor?: boolean): void;
|
|
@@ -3,9 +3,6 @@ import { Logger } from "../Misc/logger.js";
|
|
|
3
3
|
import { EngineStore } from "../Engines/engineStore.js";
|
|
4
4
|
import { LightConstants } from "../Lights/lightConstants.js";
|
|
5
5
|
import { PrepareDefinesForClipPlanes } from "./clipPlaneMaterialHelper.js";
|
|
6
|
-
import { MaterialFlags } from "./materialFlags.js";
|
|
7
|
-
import { Texture } from "./Textures/texture.js";
|
|
8
|
-
import { Color3 } from "../Maths/math.color.js";
|
|
9
6
|
// Temps
|
|
10
7
|
const TempFogColor = { r: 0, g: 0, b: 0 };
|
|
11
8
|
const TmpMorphInfluencers = {
|
|
@@ -218,105 +215,6 @@ export function BindMorphTargetParameters(abstractMesh, effect) {
|
|
|
218
215
|
export function BindSceneUniformBuffer(effect, sceneUbo) {
|
|
219
216
|
sceneUbo.bindToEffect(effect, "Scene");
|
|
220
217
|
}
|
|
221
|
-
/**
|
|
222
|
-
* Update parameters for IBL
|
|
223
|
-
* @param scene The scene
|
|
224
|
-
* @param defines The list of shader defines for the material
|
|
225
|
-
* @param ubo The uniform buffer to update
|
|
226
|
-
* @param reflectionTexture The IBL texture
|
|
227
|
-
* @param realTimeFiltering Whether realtime filtering of IBL texture is being used
|
|
228
|
-
* @param supportTextureInfo Whether the texture info is supported
|
|
229
|
-
* @param supportLocalProjection Whether local projection is supported
|
|
230
|
-
* @param usePBR Whether PBR is being used
|
|
231
|
-
* @param supportSH Whether spherical harmonics are supported
|
|
232
|
-
* @param useColor Whether to use the reflection color
|
|
233
|
-
* @param reflectionColor The color to use for the reflection
|
|
234
|
-
*/
|
|
235
|
-
export function BindIBLParameters(scene, defines, ubo, reflectionTexture = null, realTimeFiltering = false, supportTextureInfo = false, supportLocalProjection = false, usePBR = false, supportSH = false, useColor = false, reflectionColor = Color3.White()) {
|
|
236
|
-
if (scene.texturesEnabled) {
|
|
237
|
-
if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {
|
|
238
|
-
ubo.updateMatrix("reflectionMatrix", reflectionTexture.getReflectionTextureMatrix());
|
|
239
|
-
ubo.updateFloat2("vReflectionInfos", reflectionTexture.level * scene.iblIntensity, 0);
|
|
240
|
-
if (supportLocalProjection && reflectionTexture.boundingBoxSize) {
|
|
241
|
-
const cubeTexture = reflectionTexture;
|
|
242
|
-
ubo.updateVector3("vReflectionPosition", cubeTexture.boundingBoxPosition);
|
|
243
|
-
ubo.updateVector3("vReflectionSize", cubeTexture.boundingBoxSize);
|
|
244
|
-
}
|
|
245
|
-
if (realTimeFiltering) {
|
|
246
|
-
const width = reflectionTexture.getSize().width;
|
|
247
|
-
ubo.updateFloat2("vReflectionFilteringInfo", width, Math.log2(width));
|
|
248
|
-
}
|
|
249
|
-
if (supportSH && !defines.USEIRRADIANCEMAP) {
|
|
250
|
-
const polynomials = reflectionTexture.sphericalPolynomial;
|
|
251
|
-
if (defines.USESPHERICALFROMREFLECTIONMAP && polynomials) {
|
|
252
|
-
if (defines.SPHERICAL_HARMONICS) {
|
|
253
|
-
const preScaledHarmonics = polynomials.preScaledHarmonics;
|
|
254
|
-
ubo.updateVector3("vSphericalL00", preScaledHarmonics.l00);
|
|
255
|
-
ubo.updateVector3("vSphericalL1_1", preScaledHarmonics.l1_1);
|
|
256
|
-
ubo.updateVector3("vSphericalL10", preScaledHarmonics.l10);
|
|
257
|
-
ubo.updateVector3("vSphericalL11", preScaledHarmonics.l11);
|
|
258
|
-
ubo.updateVector3("vSphericalL2_2", preScaledHarmonics.l2_2);
|
|
259
|
-
ubo.updateVector3("vSphericalL2_1", preScaledHarmonics.l2_1);
|
|
260
|
-
ubo.updateVector3("vSphericalL20", preScaledHarmonics.l20);
|
|
261
|
-
ubo.updateVector3("vSphericalL21", preScaledHarmonics.l21);
|
|
262
|
-
ubo.updateVector3("vSphericalL22", preScaledHarmonics.l22);
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
ubo.updateFloat3("vSphericalX", polynomials.x.x, polynomials.x.y, polynomials.x.z);
|
|
266
|
-
ubo.updateFloat3("vSphericalY", polynomials.y.x, polynomials.y.y, polynomials.y.z);
|
|
267
|
-
ubo.updateFloat3("vSphericalZ", polynomials.z.x, polynomials.z.y, polynomials.z.z);
|
|
268
|
-
ubo.updateFloat3("vSphericalXX_ZZ", polynomials.xx.x - polynomials.zz.x, polynomials.xx.y - polynomials.zz.y, polynomials.xx.z - polynomials.zz.z);
|
|
269
|
-
ubo.updateFloat3("vSphericalYY_ZZ", polynomials.yy.x - polynomials.zz.x, polynomials.yy.y - polynomials.zz.y, polynomials.yy.z - polynomials.zz.z);
|
|
270
|
-
ubo.updateFloat3("vSphericalZZ", polynomials.zz.x, polynomials.zz.y, polynomials.zz.z);
|
|
271
|
-
ubo.updateFloat3("vSphericalXY", polynomials.xy.x, polynomials.xy.y, polynomials.xy.z);
|
|
272
|
-
ubo.updateFloat3("vSphericalYZ", polynomials.yz.x, polynomials.yz.y, polynomials.yz.z);
|
|
273
|
-
ubo.updateFloat3("vSphericalZX", polynomials.zx.x, polynomials.zx.y, polynomials.zx.z);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
else if (usePBR) {
|
|
278
|
-
// If we're using an irradiance map with a dominant direction assigned, set it.
|
|
279
|
-
if (defines.USEIRRADIANCEMAP && defines.USE_IRRADIANCE_DOMINANT_DIRECTION) {
|
|
280
|
-
ubo.updateVector3("vReflectionDominantDirection", reflectionTexture.irradianceTexture._dominantDirection);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
if (supportTextureInfo) {
|
|
284
|
-
ubo.updateFloat3("vReflectionMicrosurfaceInfos", reflectionTexture.getSize().width, reflectionTexture.lodGenerationScale, reflectionTexture.lodGenerationOffset);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
if (useColor) {
|
|
289
|
-
ubo.updateColor3("vReflectionColor", reflectionColor);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Update parameters for IBL
|
|
294
|
-
* @param scene The scene
|
|
295
|
-
* @param defines The list of shader defines for the material
|
|
296
|
-
* @param ubo The uniform buffer to update
|
|
297
|
-
* @param reflectionTexture The IBL texture
|
|
298
|
-
* @param realTimeFiltering Whether realtime filtering of IBL texture is being used
|
|
299
|
-
*/
|
|
300
|
-
export function BindIBLSamplers(scene, defines, ubo, reflectionTexture = null, realTimeFiltering = false) {
|
|
301
|
-
if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {
|
|
302
|
-
if (defines.LODBASEDMICROSFURACE) {
|
|
303
|
-
ubo.setTexture("reflectionSampler", reflectionTexture);
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
ubo.setTexture("reflectionSampler", reflectionTexture._lodTextureMid || reflectionTexture);
|
|
307
|
-
ubo.setTexture("reflectionSamplerLow", reflectionTexture._lodTextureLow || reflectionTexture);
|
|
308
|
-
ubo.setTexture("reflectionSamplerHigh", reflectionTexture._lodTextureHigh || reflectionTexture);
|
|
309
|
-
}
|
|
310
|
-
if (defines.USEIRRADIANCEMAP) {
|
|
311
|
-
ubo.setTexture("irradianceSampler", reflectionTexture.irradianceTexture);
|
|
312
|
-
}
|
|
313
|
-
//if realtime filtering and using CDF maps, set them.
|
|
314
|
-
const cdfGenerator = scene.iblCdfGenerator;
|
|
315
|
-
if (realTimeFiltering && cdfGenerator) {
|
|
316
|
-
ubo.setTexture("icdfSampler", cdfGenerator.getIcdfTexture());
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
218
|
/**
|
|
321
219
|
* Helps preparing the defines values about the UVs in used in the effect.
|
|
322
220
|
* UVs are shared as much as we can across channels in the shaders.
|
|
@@ -617,130 +515,6 @@ export function PrepareDefinesForLights(scene, mesh, defines, specularSupported,
|
|
|
617
515
|
}
|
|
618
516
|
return state.needNormals;
|
|
619
517
|
}
|
|
620
|
-
/**
|
|
621
|
-
* Prepare defines relating to IBL logic.
|
|
622
|
-
* @param scene The scene
|
|
623
|
-
* @param reflectionTexture The texture to use for IBL
|
|
624
|
-
* @param defines The defines to update
|
|
625
|
-
* @param realTimeFiltering Whether realtime filting of IBL texture is being used
|
|
626
|
-
* @param realTimeFilteringQuality The quality of realtime filtering
|
|
627
|
-
* @param forceSHInVertex Whether the SH are handled in the vertex shader
|
|
628
|
-
* @returns true if the defines were updated
|
|
629
|
-
*/
|
|
630
|
-
export function PrepareDefinesForIBL(scene, reflectionTexture, defines, realTimeFiltering = false, realTimeFilteringQuality = 8, forceSHInVertex = false) {
|
|
631
|
-
if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {
|
|
632
|
-
if (!reflectionTexture.isReadyOrNotBlocking()) {
|
|
633
|
-
return false;
|
|
634
|
-
}
|
|
635
|
-
defines._needNormals = true;
|
|
636
|
-
defines.REFLECTION = true;
|
|
637
|
-
defines.GAMMAREFLECTION = reflectionTexture.gammaSpace;
|
|
638
|
-
defines.RGBDREFLECTION = reflectionTexture.isRGBD;
|
|
639
|
-
defines.LODINREFLECTIONALPHA = reflectionTexture.lodLevelInAlpha;
|
|
640
|
-
defines.LINEARSPECULARREFLECTION = reflectionTexture.linearSpecularLOD;
|
|
641
|
-
defines.USEIRRADIANCEMAP = false;
|
|
642
|
-
const engine = scene.getEngine();
|
|
643
|
-
if (realTimeFiltering && realTimeFilteringQuality > 0) {
|
|
644
|
-
defines.NUM_SAMPLES = "" + realTimeFilteringQuality;
|
|
645
|
-
if (engine._features.needTypeSuffixInShaderConstants) {
|
|
646
|
-
defines.NUM_SAMPLES = defines.NUM_SAMPLES + "u";
|
|
647
|
-
}
|
|
648
|
-
defines.REALTIME_FILTERING = true;
|
|
649
|
-
if (scene.iblCdfGenerator) {
|
|
650
|
-
defines.IBL_CDF_FILTERING = true;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
defines.REALTIME_FILTERING = false;
|
|
655
|
-
}
|
|
656
|
-
defines.INVERTCUBICMAP = reflectionTexture.coordinatesMode === Texture.INVCUBIC_MODE;
|
|
657
|
-
defines.REFLECTIONMAP_3D = reflectionTexture.isCube;
|
|
658
|
-
defines.REFLECTIONMAP_OPPOSITEZ = defines.REFLECTIONMAP_3D && scene.useRightHandedSystem ? !reflectionTexture.invertZ : reflectionTexture.invertZ;
|
|
659
|
-
defines.REFLECTIONMAP_CUBIC = false;
|
|
660
|
-
defines.REFLECTIONMAP_EXPLICIT = false;
|
|
661
|
-
defines.REFLECTIONMAP_PLANAR = false;
|
|
662
|
-
defines.REFLECTIONMAP_PROJECTION = false;
|
|
663
|
-
defines.REFLECTIONMAP_SKYBOX = false;
|
|
664
|
-
defines.REFLECTIONMAP_SPHERICAL = false;
|
|
665
|
-
defines.REFLECTIONMAP_EQUIRECTANGULAR = false;
|
|
666
|
-
defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;
|
|
667
|
-
defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;
|
|
668
|
-
switch (reflectionTexture.coordinatesMode) {
|
|
669
|
-
case Texture.EXPLICIT_MODE:
|
|
670
|
-
defines.REFLECTIONMAP_EXPLICIT = true;
|
|
671
|
-
break;
|
|
672
|
-
case Texture.PLANAR_MODE:
|
|
673
|
-
defines.REFLECTIONMAP_PLANAR = true;
|
|
674
|
-
break;
|
|
675
|
-
case Texture.PROJECTION_MODE:
|
|
676
|
-
defines.REFLECTIONMAP_PROJECTION = true;
|
|
677
|
-
break;
|
|
678
|
-
case Texture.SKYBOX_MODE:
|
|
679
|
-
defines.REFLECTIONMAP_SKYBOX = true;
|
|
680
|
-
break;
|
|
681
|
-
case Texture.SPHERICAL_MODE:
|
|
682
|
-
defines.REFLECTIONMAP_SPHERICAL = true;
|
|
683
|
-
break;
|
|
684
|
-
case Texture.EQUIRECTANGULAR_MODE:
|
|
685
|
-
defines.REFLECTIONMAP_EQUIRECTANGULAR = true;
|
|
686
|
-
break;
|
|
687
|
-
case Texture.FIXED_EQUIRECTANGULAR_MODE:
|
|
688
|
-
defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;
|
|
689
|
-
break;
|
|
690
|
-
case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:
|
|
691
|
-
defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;
|
|
692
|
-
break;
|
|
693
|
-
case Texture.CUBIC_MODE:
|
|
694
|
-
case Texture.INVCUBIC_MODE:
|
|
695
|
-
default:
|
|
696
|
-
defines.REFLECTIONMAP_CUBIC = true;
|
|
697
|
-
defines.USE_LOCAL_REFLECTIONMAP_CUBIC = reflectionTexture.boundingBoxSize ? true : false;
|
|
698
|
-
break;
|
|
699
|
-
}
|
|
700
|
-
if (reflectionTexture.coordinatesMode !== Texture.SKYBOX_MODE) {
|
|
701
|
-
if (reflectionTexture.irradianceTexture) {
|
|
702
|
-
defines.USEIRRADIANCEMAP = true;
|
|
703
|
-
defines.USESPHERICALFROMREFLECTIONMAP = false;
|
|
704
|
-
defines.USESPHERICALINVERTEX = false;
|
|
705
|
-
if (reflectionTexture.irradianceTexture._dominantDirection) {
|
|
706
|
-
defines.USE_IRRADIANCE_DOMINANT_DIRECTION = true;
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
// Assume using spherical polynomial if the reflection texture is a cube map
|
|
710
|
-
else if (reflectionTexture.isCube) {
|
|
711
|
-
defines.USESPHERICALFROMREFLECTIONMAP = true;
|
|
712
|
-
defines.USEIRRADIANCEMAP = false;
|
|
713
|
-
defines.USE_IRRADIANCE_DOMINANT_DIRECTION = false;
|
|
714
|
-
defines.USESPHERICALINVERTEX = forceSHInVertex;
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
else {
|
|
719
|
-
defines.REFLECTION = false;
|
|
720
|
-
defines.REFLECTIONMAP_3D = false;
|
|
721
|
-
defines.REFLECTIONMAP_SPHERICAL = false;
|
|
722
|
-
defines.REFLECTIONMAP_PLANAR = false;
|
|
723
|
-
defines.REFLECTIONMAP_CUBIC = false;
|
|
724
|
-
defines.USE_LOCAL_REFLECTIONMAP_CUBIC = false;
|
|
725
|
-
defines.REFLECTIONMAP_PROJECTION = false;
|
|
726
|
-
defines.REFLECTIONMAP_SKYBOX = false;
|
|
727
|
-
defines.REFLECTIONMAP_EXPLICIT = false;
|
|
728
|
-
defines.REFLECTIONMAP_EQUIRECTANGULAR = false;
|
|
729
|
-
defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;
|
|
730
|
-
defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;
|
|
731
|
-
defines.INVERTCUBICMAP = false;
|
|
732
|
-
defines.USESPHERICALFROMREFLECTIONMAP = false;
|
|
733
|
-
defines.USEIRRADIANCEMAP = false;
|
|
734
|
-
defines.USE_IRRADIANCE_DOMINANT_DIRECTION = false;
|
|
735
|
-
defines.USESPHERICALINVERTEX = false;
|
|
736
|
-
defines.REFLECTIONMAP_OPPOSITEZ = false;
|
|
737
|
-
defines.LODINREFLECTIONALPHA = false;
|
|
738
|
-
defines.GAMMAREFLECTION = false;
|
|
739
|
-
defines.RGBDREFLECTION = false;
|
|
740
|
-
defines.LINEARSPECULARREFLECTION = false;
|
|
741
|
-
}
|
|
742
|
-
return true;
|
|
743
|
-
}
|
|
744
518
|
/**
|
|
745
519
|
* Prepares the defines related to the light information passed in parameter
|
|
746
520
|
* @param scene The scene we are intending to draw
|
|
@@ -1160,30 +934,6 @@ export function PrepareUniformsAndSamplersForLight(lightIndex, uniformsList, sam
|
|
|
1160
934
|
samplersList.push("tileMaskTexture" + lightIndex);
|
|
1161
935
|
}
|
|
1162
936
|
}
|
|
1163
|
-
/**
|
|
1164
|
-
* Append uniforms and samplers related to IBL to the provided lists
|
|
1165
|
-
* @param uniformsList The list of uniforms to append to
|
|
1166
|
-
* @param samplersList The list of samplers to append to
|
|
1167
|
-
* @param useSH Whether to include spherical harmonics uniforms
|
|
1168
|
-
*/
|
|
1169
|
-
export function PrepareUniformsAndSamplersForIBL(uniformsList, samplersList, useSH) {
|
|
1170
|
-
const iblUniforms = [
|
|
1171
|
-
"vReflectionMicrosurfaceInfos",
|
|
1172
|
-
"vReflectionDominantDirection",
|
|
1173
|
-
"reflectionMatrix",
|
|
1174
|
-
"vReflectionInfos",
|
|
1175
|
-
"vReflectionPosition",
|
|
1176
|
-
"vReflectionSize",
|
|
1177
|
-
"vReflectionColor",
|
|
1178
|
-
"vReflectionFilteringInfo",
|
|
1179
|
-
];
|
|
1180
|
-
if (useSH) {
|
|
1181
|
-
iblUniforms.push("vSphericalX", "vSphericalY", "vSphericalZ", "vSphericalXX_ZZ", "vSphericalYY_ZZ", "vSphericalZZ", "vSphericalXY", "vSphericalYZ", "vSphericalZX", "vSphericalL00", "vSphericalL1_1", "vSphericalL10", "vSphericalL11", "vSphericalL2_2", "vSphericalL2_1", "vSphericalL20", "vSphericalL21", "vSphericalL22");
|
|
1182
|
-
}
|
|
1183
|
-
uniformsList.push(...iblUniforms);
|
|
1184
|
-
const iblSamplers = ["reflectionSampler", "reflectionSamplerLow", "reflectionSamplerHigh", "irradianceSampler", "icdfSampler"];
|
|
1185
|
-
samplersList.push(...iblSamplers);
|
|
1186
|
-
}
|
|
1187
937
|
/**
|
|
1188
938
|
* Prepares the uniforms and samplers list to be used in the effect
|
|
1189
939
|
* @param uniformsListOrOptions The uniform names to prepare or an EffectCreationOptions containing the list and extra information
|
|
@@ -1225,51 +975,4 @@ export function PrepareUniformsAndSamplersList(uniformsListOrOptions, samplersLi
|
|
|
1225
975
|
samplersList.push("bakedVertexAnimationTexture");
|
|
1226
976
|
}
|
|
1227
977
|
}
|
|
1228
|
-
/**
|
|
1229
|
-
*
|
|
1230
|
-
* @param ubo Add uniforms to UBO
|
|
1231
|
-
* @param supportTextureInfo Add uniforms for texture info if true
|
|
1232
|
-
* @param supportLocalProjection Add uniforms for local projection if true
|
|
1233
|
-
* @param usePBR Add uniforms for IBL if true
|
|
1234
|
-
* @param supportSH Add uniforms for spherical harmonics if true
|
|
1235
|
-
* @param useColor Add uniforms for reflection color if true
|
|
1236
|
-
*/
|
|
1237
|
-
export function PrepareUniformLayoutForIBL(ubo, supportTextureInfo = false, supportLocalProjection = false, usePBR = false, supportSH = false, useColor = false) {
|
|
1238
|
-
ubo.addUniform("vReflectionInfos", 2);
|
|
1239
|
-
ubo.addUniform("reflectionMatrix", 16);
|
|
1240
|
-
if (supportTextureInfo) {
|
|
1241
|
-
ubo.addUniform("vReflectionMicrosurfaceInfos", 3);
|
|
1242
|
-
}
|
|
1243
|
-
if (supportLocalProjection) {
|
|
1244
|
-
ubo.addUniform("vReflectionPosition", 3);
|
|
1245
|
-
ubo.addUniform("vReflectionSize", 3);
|
|
1246
|
-
}
|
|
1247
|
-
if (usePBR) {
|
|
1248
|
-
ubo.addUniform("vReflectionFilteringInfo", 2);
|
|
1249
|
-
ubo.addUniform("vReflectionDominantDirection", 3);
|
|
1250
|
-
}
|
|
1251
|
-
if (useColor) {
|
|
1252
|
-
ubo.addUniform("vReflectionColor", 3);
|
|
1253
|
-
}
|
|
1254
|
-
if (supportSH) {
|
|
1255
|
-
ubo.addUniform("vSphericalL00", 3);
|
|
1256
|
-
ubo.addUniform("vSphericalL1_1", 3);
|
|
1257
|
-
ubo.addUniform("vSphericalL10", 3);
|
|
1258
|
-
ubo.addUniform("vSphericalL11", 3);
|
|
1259
|
-
ubo.addUniform("vSphericalL2_2", 3);
|
|
1260
|
-
ubo.addUniform("vSphericalL2_1", 3);
|
|
1261
|
-
ubo.addUniform("vSphericalL20", 3);
|
|
1262
|
-
ubo.addUniform("vSphericalL21", 3);
|
|
1263
|
-
ubo.addUniform("vSphericalL22", 3);
|
|
1264
|
-
ubo.addUniform("vSphericalX", 3);
|
|
1265
|
-
ubo.addUniform("vSphericalY", 3);
|
|
1266
|
-
ubo.addUniform("vSphericalZ", 3);
|
|
1267
|
-
ubo.addUniform("vSphericalXX_ZZ", 3);
|
|
1268
|
-
ubo.addUniform("vSphericalYY_ZZ", 3);
|
|
1269
|
-
ubo.addUniform("vSphericalZZ", 3);
|
|
1270
|
-
ubo.addUniform("vSphericalXY", 3);
|
|
1271
|
-
ubo.addUniform("vSphericalYZ", 3);
|
|
1272
|
-
ubo.addUniform("vSphericalZX", 3);
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
978
|
//# sourceMappingURL=materialHelper.functions.js.map
|