@onerjs/core 8.45.3 → 8.45.5

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.
@@ -22,6 +22,7 @@ export * from "./rawTexture2DArray.js";
22
22
  export * from "./rawTexture3D.js";
23
23
  export * from "./refractionTexture.js";
24
24
  export * from "./renderTargetTexture.js";
25
+ export * from "./reflectionProbeTexture.js";
25
26
  export * from "./textureMerger.js";
26
27
  export * from "./textureSampler.js";
27
28
  export * from "./texture.js";
@@ -24,6 +24,7 @@ export * from "./rawTexture2DArray.js";
24
24
  export * from "./rawTexture3D.js";
25
25
  export * from "./refractionTexture.js";
26
26
  export * from "./renderTargetTexture.js";
27
+ export * from "./reflectionProbeTexture.js";
27
28
  export * from "./textureMerger.js";
28
29
  export * from "./textureSampler.js";
29
30
  export * from "./texture.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,yCAAyC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AAEzC,kCAAkC;AAClC,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAEhD,gBAAgB;AAChB,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./baseTexture\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./baseTexture.polynomial\";\r\nexport * from \"./colorGradingTexture\";\r\nexport * from \"./cubeTexture\";\r\nexport * from \"./dynamicTexture\";\r\nexport * from \"./equiRectangularCubeTexture\";\r\nexport * from \"./externalTexture\";\r\nexport * from \"./Filtering/hdrFiltering\";\r\nexport * from \"./envCubeTexture\";\r\nexport * from \"./hdrCubeTexture\";\r\nexport * from \"./exrCubeTexture\";\r\nexport * from \"./htmlElementTexture\";\r\nexport * from \"./internalTexture\";\r\nexport * from \"./Loaders/index\";\r\nexport * from \"./mirrorTexture\";\r\nexport * from \"./multiRenderTarget\";\r\nexport * from \"./Packer/index\";\r\nexport * from \"./Procedurals/index\";\r\nexport * from \"./rawCubeTexture\";\r\nexport * from \"./rawTexture\";\r\nexport * from \"./rawTexture2DArray\";\r\nexport * from \"./rawTexture3D\";\r\nexport * from \"./refractionTexture\";\r\nexport * from \"./renderTargetTexture\";\r\nexport * from \"./textureMerger\";\r\nexport * from \"./textureSampler\";\r\nexport * from \"./texture\";\r\nexport * from \"./thinTexture\";\r\nexport * from \"./thinRenderTargetTexture\";\r\nexport * from \"./videoTexture\";\r\nexport * from \"./ktx2decoderTypes\";\r\nexport * from \"./textureCreationOptions\";\r\n\r\n// Shaders for procedural textures\r\nexport * from \"../../ShadersWGSL/procedural.vertex\";\r\nexport * from \"../../Shaders/procedural.vertex\";\r\n\r\n// HDR filtering\r\nexport * from \"../../Shaders/hdrFiltering.vertex\";\r\nexport * from \"../../Shaders/hdrFiltering.fragment\";\r\nexport * from \"../../ShadersWGSL/hdrFiltering.vertex\";\r\nexport * from \"../../ShadersWGSL/hdrFiltering.fragment\";\r\nexport * from \"../../Shaders/hdrIrradianceFiltering.vertex\";\r\nexport * from \"../../Shaders/hdrIrradianceFiltering.fragment\";\r\nexport * from \"../../ShadersWGSL/hdrIrradianceFiltering.vertex\";\r\nexport * from \"../../ShadersWGSL/hdrIrradianceFiltering.fragment\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,yCAAyC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AAEzC,kCAAkC;AAClC,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAEhD,gBAAgB;AAChB,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./baseTexture\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./baseTexture.polynomial\";\r\nexport * from \"./colorGradingTexture\";\r\nexport * from \"./cubeTexture\";\r\nexport * from \"./dynamicTexture\";\r\nexport * from \"./equiRectangularCubeTexture\";\r\nexport * from \"./externalTexture\";\r\nexport * from \"./Filtering/hdrFiltering\";\r\nexport * from \"./envCubeTexture\";\r\nexport * from \"./hdrCubeTexture\";\r\nexport * from \"./exrCubeTexture\";\r\nexport * from \"./htmlElementTexture\";\r\nexport * from \"./internalTexture\";\r\nexport * from \"./Loaders/index\";\r\nexport * from \"./mirrorTexture\";\r\nexport * from \"./multiRenderTarget\";\r\nexport * from \"./Packer/index\";\r\nexport * from \"./Procedurals/index\";\r\nexport * from \"./rawCubeTexture\";\r\nexport * from \"./rawTexture\";\r\nexport * from \"./rawTexture2DArray\";\r\nexport * from \"./rawTexture3D\";\r\nexport * from \"./refractionTexture\";\r\nexport * from \"./renderTargetTexture\";\r\nexport * from \"./reflectionProbeTexture\";\r\nexport * from \"./textureMerger\";\r\nexport * from \"./textureSampler\";\r\nexport * from \"./texture\";\r\nexport * from \"./thinTexture\";\r\nexport * from \"./thinRenderTargetTexture\";\r\nexport * from \"./videoTexture\";\r\nexport * from \"./ktx2decoderTypes\";\r\nexport * from \"./textureCreationOptions\";\r\n\r\n// Shaders for procedural textures\r\nexport * from \"../../ShadersWGSL/procedural.vertex\";\r\nexport * from \"../../Shaders/procedural.vertex\";\r\n\r\n// HDR filtering\r\nexport * from \"../../Shaders/hdrFiltering.vertex\";\r\nexport * from \"../../Shaders/hdrFiltering.fragment\";\r\nexport * from \"../../ShadersWGSL/hdrFiltering.vertex\";\r\nexport * from \"../../ShadersWGSL/hdrFiltering.fragment\";\r\nexport * from \"../../Shaders/hdrIrradianceFiltering.vertex\";\r\nexport * from \"../../Shaders/hdrIrradianceFiltering.fragment\";\r\nexport * from \"../../ShadersWGSL/hdrIrradianceFiltering.vertex\";\r\nexport * from \"../../ShadersWGSL/hdrIrradianceFiltering.fragment\";\r\n"]}
@@ -0,0 +1,96 @@
1
+ import type { Scene } from "../../scene.js";
2
+ import type { AbstractMesh } from "../../Meshes/abstractMesh.js";
3
+ import type { Nullable } from "../../types.js";
4
+ import { Vector3 } from "../../Maths/math.vector.js";
5
+ import type { IAssetContainer } from "../../IAssetContainer.js";
6
+ import { RenderTargetTexture } from "../../Materials/Textures/renderTargetTexture.js";
7
+ /**
8
+ * Options for creating a ReflectionProbeTexture
9
+ */
10
+ export interface IReflectionProbeTextureOptions {
11
+ /**
12
+ * The texture resolution (for each face)
13
+ */
14
+ size: number;
15
+ /**
16
+ * Defines if mip maps should be generated automatically (true by default)
17
+ */
18
+ generateMipMaps?: boolean;
19
+ /**
20
+ * Defines if HDR data (float data) should be used to store colors (false by default)
21
+ */
22
+ useFloat?: boolean;
23
+ /**
24
+ * Defines if the probe should be generated in linear space or not (false by default)
25
+ */
26
+ linearSpace?: boolean;
27
+ }
28
+ /**
29
+ * Class used to generate realtime reflection / refraction cube textures.
30
+ * This is a simplified version of ReflectionProbe that can be used directly as a RenderTargetTexture.
31
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/reflectionProbes
32
+ */
33
+ export declare class ReflectionProbeTexture extends RenderTargetTexture {
34
+ private _probeScene;
35
+ private _projectionMatrix;
36
+ private _viewMatrix;
37
+ private _target;
38
+ private _add;
39
+ private _sceneUBOs;
40
+ private _currentSceneUBO;
41
+ private _invertYAxis;
42
+ private _options;
43
+ private _attachedMesh;
44
+ /** Gets or sets probe position (center of the cube map) */
45
+ position: Vector3;
46
+ /**
47
+ * Gets or sets an object used to store user defined information for the reflection probe.
48
+ */
49
+ metadata: any;
50
+ /** @internal */
51
+ _parentContainer: Nullable<IAssetContainer>;
52
+ /**
53
+ * Creates a new reflection probe texture
54
+ * @param name defines the name of the probe
55
+ * @param options defines the options for creating the texture
56
+ * @param scene defines the hosting scene
57
+ */
58
+ constructor(
59
+ /** defines the name of the probe */
60
+ name: string, options: number | IReflectionProbeTextureOptions, scene: Scene);
61
+ /**
62
+ * Attach the probe to a specific mesh (Rendering will be done from attached mesh's position)
63
+ * @param mesh defines the mesh to attach to
64
+ */
65
+ attachToMesh(mesh: Nullable<AbstractMesh>): void;
66
+ /**
67
+ * Gets the mesh attached to this probe
68
+ * @returns the attached mesh or null
69
+ */
70
+ get attachedMesh(): Nullable<AbstractMesh>;
71
+ /**
72
+ * Gets the hosting scene
73
+ * @returns a Scene
74
+ */
75
+ getScene(): Scene;
76
+ /**
77
+ * Gets the class name of the reflection probe texture
78
+ * @returns "ReflectionProbeTexture"
79
+ */
80
+ getClassName(): string;
81
+ /**
82
+ * Converts the reflection probe texture information to a readable string for debug purpose
83
+ * @param fullDetails Supports for multiple levels of logging within scene loading
84
+ * @returns the human readable reflection probe texture info
85
+ */
86
+ toString(fullDetails?: boolean): string;
87
+ /**
88
+ * Used for serializing the probe texture
89
+ * @returns any
90
+ */
91
+ serialize(): any;
92
+ /**
93
+ * Clean all associated resources
94
+ */
95
+ dispose(): void;
96
+ }
@@ -0,0 +1,208 @@
1
+ import { Vector3 } from "../../Maths/math.vector.js";
2
+ import { Matrix } from "../../Maths/math.vector.js";
3
+ import { RenderTargetTexture } from "../../Materials/Textures/renderTargetTexture.js";
4
+
5
+ import { Texture } from "../../Materials/Textures/texture.js";
6
+ /**
7
+ * Class used to generate realtime reflection / refraction cube textures.
8
+ * This is a simplified version of ReflectionProbe that can be used directly as a RenderTargetTexture.
9
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/reflectionProbes
10
+ */
11
+ export class ReflectionProbeTexture extends RenderTargetTexture {
12
+ /**
13
+ * Creates a new reflection probe texture
14
+ * @param name defines the name of the probe
15
+ * @param options defines the options for creating the texture
16
+ * @param scene defines the hosting scene
17
+ */
18
+ constructor(
19
+ /** defines the name of the probe */
20
+ name, options, scene) {
21
+ const size = typeof options === "number" ? options : options.size;
22
+ const generateMipMaps = typeof options === "number" ? true : (options.generateMipMaps ?? true);
23
+ const useFloat = typeof options === "number" ? false : (options.useFloat ?? false);
24
+ const linearSpace = typeof options === "number" ? false : (options.linearSpace ?? false);
25
+ let textureType = 0;
26
+ if (useFloat) {
27
+ const caps = scene.getEngine().getCaps();
28
+ if (caps.textureHalfFloatRender) {
29
+ textureType = 2;
30
+ }
31
+ else if (caps.textureFloatRender) {
32
+ textureType = 1;
33
+ }
34
+ }
35
+ super(name, size, scene, generateMipMaps, true, textureType, true, undefined, undefined, undefined, undefined, undefined, linearSpace);
36
+ this._viewMatrix = Matrix.Identity();
37
+ this._target = Vector3.Zero();
38
+ this._add = Vector3.Zero();
39
+ this._invertYAxis = false;
40
+ /** Gets or sets probe position (center of the cube map) */
41
+ this.position = Vector3.Zero();
42
+ /**
43
+ * Gets or sets an object used to store user defined information for the reflection probe.
44
+ */
45
+ this.metadata = null;
46
+ /** @internal */
47
+ this._parentContainer = null;
48
+ this._probeScene = scene;
49
+ this._options = options;
50
+ if (scene.getEngine().supportsUniformBuffers) {
51
+ this._sceneUBOs = [];
52
+ for (let i = 0; i < 6; ++i) {
53
+ this._sceneUBOs.push(scene.createSceneUniformBuffer(`Scene for Reflection Probe (name "${name}") face #${i}`, { forceMono: true }));
54
+ }
55
+ }
56
+ this.gammaSpace = !linearSpace;
57
+ this.invertZ = scene.useRightHandedSystem;
58
+ const useReverseDepthBuffer = scene.getEngine().useReverseDepthBuffer;
59
+ this.onBeforeRenderObservable.add((faceIndex) => {
60
+ if (this._sceneUBOs) {
61
+ scene.setSceneUniformBuffer(this._sceneUBOs[faceIndex]);
62
+ scene.getSceneUniformBuffer().unbindEffect();
63
+ }
64
+ switch (faceIndex) {
65
+ case 0:
66
+ this._add.copyFromFloats(1, 0, 0);
67
+ break;
68
+ case 1:
69
+ this._add.copyFromFloats(-1, 0, 0);
70
+ break;
71
+ case 2:
72
+ this._add.copyFromFloats(0, this._invertYAxis ? 1 : -1, 0);
73
+ break;
74
+ case 3:
75
+ this._add.copyFromFloats(0, this._invertYAxis ? -1 : 1, 0);
76
+ break;
77
+ case 4:
78
+ this._add.copyFromFloats(0, 0, scene.useRightHandedSystem ? -1 : 1);
79
+ break;
80
+ case 5:
81
+ this._add.copyFromFloats(0, 0, scene.useRightHandedSystem ? 1 : -1);
82
+ break;
83
+ }
84
+ if (this._attachedMesh) {
85
+ this.position.copyFrom(this._attachedMesh.getAbsolutePosition());
86
+ }
87
+ this.position.addToRef(this._add, this._target);
88
+ const lookAtFunction = scene.useRightHandedSystem ? Matrix.LookAtRHToRef : Matrix.LookAtLHToRef;
89
+ const perspectiveFunction = scene.useRightHandedSystem ? Matrix.PerspectiveFovRH : Matrix.PerspectiveFovLH;
90
+ lookAtFunction(this.position, this._target, Vector3.Up(), this._viewMatrix);
91
+ if (scene.activeCamera) {
92
+ this._projectionMatrix = perspectiveFunction(Math.PI / 2, 1, useReverseDepthBuffer ? scene.activeCamera.maxZ : scene.activeCamera.minZ, useReverseDepthBuffer ? scene.activeCamera.minZ : scene.activeCamera.maxZ, this._probeScene.getEngine().isNDCHalfZRange);
93
+ scene.setTransformMatrix(this._viewMatrix, this._projectionMatrix);
94
+ if (scene.activeCamera.isRigCamera && !this.activeCamera) {
95
+ this.activeCamera = scene.activeCamera.rigParent || null;
96
+ }
97
+ }
98
+ if (this._sceneUBOs) {
99
+ scene.finalizeSceneUbo();
100
+ }
101
+ scene._forcedViewPosition = this.position;
102
+ });
103
+ let currentApplyByPostProcess;
104
+ this.onBeforeBindObservable.add(() => {
105
+ const engine = scene.getEngine();
106
+ this._currentSceneUBO = scene.getSceneUniformBuffer();
107
+ if (engine._enableGPUDebugMarkers) {
108
+ engine._debugPushGroup?.(`reflection probe generation for ${name}`);
109
+ }
110
+ currentApplyByPostProcess = this._probeScene.imageProcessingConfiguration.applyByPostProcess;
111
+ if (linearSpace) {
112
+ scene.imageProcessingConfiguration.applyByPostProcess = true;
113
+ }
114
+ });
115
+ this.onAfterUnbindObservable.add(() => {
116
+ const engine = scene.getEngine();
117
+ scene.imageProcessingConfiguration.applyByPostProcess = currentApplyByPostProcess;
118
+ scene._forcedViewPosition = null;
119
+ if (this._sceneUBOs) {
120
+ scene.setSceneUniformBuffer(this._currentSceneUBO);
121
+ }
122
+ scene.updateTransformMatrix(true);
123
+ if (engine._enableGPUDebugMarkers) {
124
+ engine._debugPopGroup?.();
125
+ }
126
+ });
127
+ }
128
+ /**
129
+ * Attach the probe to a specific mesh (Rendering will be done from attached mesh's position)
130
+ * @param mesh defines the mesh to attach to
131
+ */
132
+ attachToMesh(mesh) {
133
+ this._attachedMesh = mesh;
134
+ }
135
+ /**
136
+ * Gets the mesh attached to this probe
137
+ * @returns the attached mesh or null
138
+ */
139
+ get attachedMesh() {
140
+ return this._attachedMesh;
141
+ }
142
+ /**
143
+ * Gets the hosting scene
144
+ * @returns a Scene
145
+ */
146
+ getScene() {
147
+ return this._probeScene;
148
+ }
149
+ /**
150
+ * Gets the class name of the reflection probe texture
151
+ * @returns "ReflectionProbeTexture"
152
+ */
153
+ getClassName() {
154
+ return "ReflectionProbeTexture";
155
+ }
156
+ /**
157
+ * Converts the reflection probe texture information to a readable string for debug purpose
158
+ * @param fullDetails Supports for multiple levels of logging within scene loading
159
+ * @returns the human readable reflection probe texture info
160
+ */
161
+ toString(fullDetails) {
162
+ let ret = "Name: " + this.name;
163
+ if (fullDetails) {
164
+ ret += ", position: " + this.position.toString();
165
+ if (this._attachedMesh) {
166
+ ret += ", attached mesh: " + this._attachedMesh.name;
167
+ }
168
+ }
169
+ return ret;
170
+ }
171
+ /**
172
+ * Used for serializing the probe texture
173
+ * @returns any
174
+ */
175
+ serialize() {
176
+ const serializationObject = super.serialize();
177
+ if (serializationObject) {
178
+ serializationObject.isReflectionProbe = true;
179
+ if (this._attachedMesh) {
180
+ serializationObject.attachedMesh = this._attachedMesh.id;
181
+ }
182
+ serializationObject.position = this.position.asArray();
183
+ serializationObject.options = this._options;
184
+ }
185
+ return null;
186
+ }
187
+ /**
188
+ * Clean all associated resources
189
+ */
190
+ dispose() {
191
+ if (this._sceneUBOs) {
192
+ for (const ubo of this._sceneUBOs) {
193
+ ubo.dispose();
194
+ }
195
+ this._sceneUBOs = [];
196
+ }
197
+ super.dispose();
198
+ }
199
+ }
200
+ Texture._CreateReflectionProbeTexture = function (name, options, scene, position, attachedMesh) {
201
+ const texture = new ReflectionProbeTexture(name, options, scene);
202
+ texture.position.fromArray(position);
203
+ if (attachedMesh) {
204
+ texture.attachToMesh(scene.getMeshById(attachedMesh) ?? null);
205
+ }
206
+ return texture;
207
+ };
208
+ //# sourceMappingURL=reflectionProbeTexture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflectionProbeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/reflectionProbeTexture.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,y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AC;IAChB,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChC,GAAG,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC;YACD,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACzB,CAAC;QAED,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AAED,OAAO,CAAC,6BAA6B,GAAG,UAAU,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY;IAC1F,MAAM,OAAO,GAAG,IAAI,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACjE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,YAAY,EAAE,CAAC;QACf,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import type { Scene } from \"../../scene\";\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\nimport type { Nullable } from \"../../types\";\nimport { Vector3 } from \"../../Maths/math.vector\";\nimport { Matrix } from \"../../Maths/math.vector\";\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\nimport type { IAssetContainer } from \"core/IAssetContainer\";\nimport { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\nimport { Constants } from \"../../Engines/constants\";\nimport { Texture } from \"../../Materials/Textures/texture\";\n\n/**\n * Options for creating a ReflectionProbeTexture\n */\nexport interface IReflectionProbeTextureOptions {\n /**\n * The texture resolution (for each face)\n */\n size: number;\n /**\n * Defines if mip maps should be generated automatically (true by default)\n */\n generateMipMaps?: boolean;\n /**\n * Defines if HDR data (float data) should be used to store colors (false by default)\n */\n useFloat?: boolean;\n /**\n * Defines if the probe should be generated in linear space or not (false by default)\n */\n linearSpace?: boolean;\n}\n\n/**\n * Class used to generate realtime reflection / refraction cube textures.\n * This is a simplified version of ReflectionProbe that can be used directly as a RenderTargetTexture.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/reflectionProbes\n */\nexport class ReflectionProbeTexture extends RenderTargetTexture {\n private _probeScene: Scene;\n private _projectionMatrix: Matrix;\n private _viewMatrix = Matrix.Identity();\n private _target = Vector3.Zero();\n private _add = Vector3.Zero();\n private _sceneUBOs: UniformBuffer[];\n private _currentSceneUBO: UniformBuffer;\n private _invertYAxis = false;\n private _options: number | IReflectionProbeTextureOptions;\n private _attachedMesh: Nullable<AbstractMesh>;\n\n /** Gets or sets probe position (center of the cube map) */\n public position = Vector3.Zero();\n\n /**\n * Gets or sets an object used to store user defined information for the reflection probe.\n */\n public override metadata: any = null;\n\n /** @internal */\n public override _parentContainer: Nullable<IAssetContainer> = null;\n\n /**\n * Creates a new reflection probe texture\n * @param name defines the name of the probe\n * @param options defines the options for creating the texture\n * @param scene defines the hosting scene\n */\n constructor(\n /** defines the name of the probe */\n name: string,\n options: number | IReflectionProbeTextureOptions,\n scene: Scene\n ) {\n const size = typeof options === \"number\" ? options : options.size;\n const generateMipMaps = typeof options === \"number\" ? true : (options.generateMipMaps ?? true);\n const useFloat = typeof options === \"number\" ? false : (options.useFloat ?? false);\n const linearSpace = typeof options === \"number\" ? false : (options.linearSpace ?? false);\n\n let textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\n if (useFloat) {\n const caps = scene.getEngine().getCaps();\n if (caps.textureHalfFloatRender) {\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\n } else if (caps.textureFloatRender) {\n textureType = Constants.TEXTURETYPE_FLOAT;\n }\n }\n\n super(name, size, scene, generateMipMaps, true, textureType, true, undefined, undefined, undefined, undefined, undefined, linearSpace);\n this._probeScene = scene;\n this._options = options;\n\n if (scene.getEngine().supportsUniformBuffers) {\n this._sceneUBOs = [];\n for (let i = 0; i < 6; ++i) {\n this._sceneUBOs.push(scene.createSceneUniformBuffer(`Scene for Reflection Probe (name \"${name}\") face #${i}`, { forceMono: true }));\n }\n }\n\n this.gammaSpace = !linearSpace;\n this.invertZ = scene.useRightHandedSystem;\n\n const useReverseDepthBuffer = scene.getEngine().useReverseDepthBuffer;\n\n this.onBeforeRenderObservable.add((faceIndex: number) => {\n if (this._sceneUBOs) {\n scene.setSceneUniformBuffer(this._sceneUBOs[faceIndex]);\n scene.getSceneUniformBuffer().unbindEffect();\n }\n switch (faceIndex) {\n case 0:\n this._add.copyFromFloats(1, 0, 0);\n break;\n case 1:\n this._add.copyFromFloats(-1, 0, 0);\n break;\n case 2:\n this._add.copyFromFloats(0, this._invertYAxis ? 1 : -1, 0);\n break;\n case 3:\n this._add.copyFromFloats(0, this._invertYAxis ? -1 : 1, 0);\n break;\n case 4:\n this._add.copyFromFloats(0, 0, scene.useRightHandedSystem ? -1 : 1);\n break;\n case 5:\n this._add.copyFromFloats(0, 0, scene.useRightHandedSystem ? 1 : -1);\n break;\n }\n\n if (this._attachedMesh) {\n this.position.copyFrom(this._attachedMesh.getAbsolutePosition());\n }\n\n this.position.addToRef(this._add, this._target);\n\n const lookAtFunction = scene.useRightHandedSystem ? Matrix.LookAtRHToRef : Matrix.LookAtLHToRef;\n const perspectiveFunction = scene.useRightHandedSystem ? Matrix.PerspectiveFovRH : Matrix.PerspectiveFovLH;\n\n lookAtFunction(this.position, this._target, Vector3.Up(), this._viewMatrix);\n\n if (scene.activeCamera) {\n this._projectionMatrix = perspectiveFunction(\n Math.PI / 2,\n 1,\n useReverseDepthBuffer ? scene.activeCamera.maxZ : scene.activeCamera.minZ,\n useReverseDepthBuffer ? scene.activeCamera.minZ : scene.activeCamera.maxZ,\n this._probeScene.getEngine().isNDCHalfZRange\n );\n scene.setTransformMatrix(this._viewMatrix, this._projectionMatrix);\n if (scene.activeCamera.isRigCamera && !this.activeCamera) {\n this.activeCamera = scene.activeCamera.rigParent || null;\n }\n }\n if (this._sceneUBOs) {\n scene.finalizeSceneUbo();\n }\n scene._forcedViewPosition = this.position;\n });\n\n let currentApplyByPostProcess: boolean;\n\n this.onBeforeBindObservable.add(() => {\n const engine = scene.getEngine();\n this._currentSceneUBO = scene.getSceneUniformBuffer();\n if (engine._enableGPUDebugMarkers) {\n engine._debugPushGroup?.(`reflection probe generation for ${name}`);\n }\n currentApplyByPostProcess = this._probeScene.imageProcessingConfiguration.applyByPostProcess;\n if (linearSpace) {\n scene.imageProcessingConfiguration.applyByPostProcess = true;\n }\n });\n\n this.onAfterUnbindObservable.add(() => {\n const engine = scene.getEngine();\n scene.imageProcessingConfiguration.applyByPostProcess = currentApplyByPostProcess;\n scene._forcedViewPosition = null;\n if (this._sceneUBOs) {\n scene.setSceneUniformBuffer(this._currentSceneUBO);\n }\n scene.updateTransformMatrix(true);\n if (engine._enableGPUDebugMarkers) {\n engine._debugPopGroup?.();\n }\n });\n }\n\n /**\n * Attach the probe to a specific mesh (Rendering will be done from attached mesh's position)\n * @param mesh defines the mesh to attach to\n */\n public attachToMesh(mesh: Nullable<AbstractMesh>): void {\n this._attachedMesh = mesh;\n }\n\n /**\n * Gets the mesh attached to this probe\n * @returns the attached mesh or null\n */\n public get attachedMesh(): Nullable<AbstractMesh> {\n return this._attachedMesh;\n }\n\n /**\n * Gets the hosting scene\n * @returns a Scene\n */\n public override getScene(): Scene {\n return this._probeScene;\n }\n\n /**\n * Gets the class name of the reflection probe texture\n * @returns \"ReflectionProbeTexture\"\n */\n public override getClassName(): string {\n return \"ReflectionProbeTexture\";\n }\n\n /**\n * Converts the reflection probe texture information to a readable string for debug purpose\n * @param fullDetails Supports for multiple levels of logging within scene loading\n * @returns the human readable reflection probe texture info\n */\n public override toString(fullDetails?: boolean): string {\n let ret = \"Name: \" + this.name;\n\n if (fullDetails) {\n ret += \", position: \" + this.position.toString();\n\n if (this._attachedMesh) {\n ret += \", attached mesh: \" + this._attachedMesh.name;\n }\n }\n\n return ret;\n }\n\n /**\n * Used for serializing the probe texture\n * @returns any\n */\n public override serialize(): any {\n const serializationObject = super.serialize();\n if (serializationObject) {\n serializationObject.isReflectionProbe = true;\n if (this._attachedMesh) {\n serializationObject.attachedMesh = this._attachedMesh.id;\n }\n serializationObject.position = this.position.asArray();\n serializationObject.options = this._options;\n }\n return null;\n }\n\n /**\n * Clean all associated resources\n */\n public override dispose() {\n if (this._sceneUBOs) {\n for (const ubo of this._sceneUBOs) {\n ubo.dispose();\n }\n this._sceneUBOs = [];\n }\n\n super.dispose();\n }\n}\n\nTexture._CreateReflectionProbeTexture = function (name, options, scene, position, attachedMesh) {\n const texture = new ReflectionProbeTexture(name, options, scene);\n texture.position.fromArray(position);\n if (attachedMesh) {\n texture.attachToMesh(scene.getMeshById(attachedMesh) ?? null);\n }\n return texture;\n};\n"]}
@@ -10,6 +10,7 @@ import type { MirrorTexture } from "../../Materials/Textures/mirrorTexture.js";
10
10
  import type { RenderTargetTexture } from "../../Materials/Textures/renderTargetTexture.js";
11
11
  import type { Scene } from "../../scene.js";
12
12
  import type { VideoTexture, VideoTextureSettings } from "./videoTexture.js";
13
+ import type { ReflectionProbeTexture } from "../../Materials/Textures/reflectionProbeTexture.js";
13
14
  /**
14
15
  * Defines the available options when creating a texture
15
16
  */
@@ -79,6 +80,10 @@ export declare class Texture extends BaseTexture {
79
80
  * @internal
80
81
  */
81
82
  static _CreateRenderTargetTexture: (name: string, renderTargetSize: number, scene: Scene, generateMipMaps: boolean, creationFlags?: number) => RenderTargetTexture;
83
+ /**
84
+ * @internal
85
+ */
86
+ static _CreateReflectionProbeTexture: (name: string, options: any, scene: Scene, position: number[], attachedMesh?: string) => ReflectionProbeTexture;
82
87
  /**
83
88
  * @internal
84
89
  */
@@ -619,6 +619,9 @@ export class Texture extends BaseTexture {
619
619
  * @returns The parsed texture if successful
620
620
  */
621
621
  static Parse(parsedTexture, scene, rootUrl) {
622
+ if (parsedTexture.isReflectionProbe) {
623
+ return Texture._CreateReflectionProbeTexture(parsedTexture.name, parsedTexture.options, scene, parsedTexture.position, parsedTexture.attachedMesh);
624
+ }
622
625
  if (parsedTexture.customType) {
623
626
  const customTexture = InstantiationTools.Instantiate(parsedTexture.customType);
624
627
  // Update Sampling Mode
@@ -854,6 +857,13 @@ Texture._CreateMirror = (name, renderTargetSize, scene, generateMipMaps) => {
854
857
  Texture._CreateRenderTargetTexture = (name, renderTargetSize, scene, generateMipMaps, creationFlags) => {
855
858
  throw _WarnImport("RenderTargetTexture");
856
859
  };
860
+ /**
861
+ * @internal
862
+ */
863
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
864
+ Texture._CreateReflectionProbeTexture = (name, options, scene, position, attachedMesh) => {
865
+ throw _WarnImport("ReflectionProbeTexture");
866
+ };
857
867
  /** nearest is mag = nearest and min = nearest and no mip */
858
868
  Texture.NEAREST_SAMPLINGMODE = 1;
859
869
  /** nearest is mag = nearest and min = nearest and mip = linear */