@babylonjs/core 9.13.0 → 9.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/runtimeAnimation.js +11 -0
- package/Animations/runtimeAnimation.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +2 -1
- package/AudioV2/abstractAudio/abstractSound.js +3 -2
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +6 -0
- package/AudioV2/abstractAudio/staticSound.js +9 -1
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +6 -0
- package/AudioV2/abstractAudio/streamingSound.js +9 -1
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +6 -3
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.d.ts +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js +7 -4
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Cameras/arcRotateCamera.pure.js +9 -3
- package/Cameras/arcRotateCamera.pure.js.map +1 -1
- package/Cameras/targetCamera.pure.js +18 -18
- package/Cameras/targetCamera.pure.js.map +1 -1
- package/Collisions/gpuPicker.js +23 -13
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +3 -2
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +3 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +24 -1
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js +16 -3
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js.map +1 -1
- package/Engines/abstractEngine.pure.d.ts +8 -1
- package/Engines/abstractEngine.pure.js +4 -3
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/engine.d.ts +113 -0
- package/Engines/thinNativeEngine.pure.d.ts +2 -0
- package/Engines/thinNativeEngine.pure.js +115 -9
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/FlowGraph/flowGraph.js +9 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.pure.d.ts +14 -0
- package/FlowGraph/flowGraphDataConnection.pure.js +38 -1
- package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
- package/FlowGraph/serialization.d.ts +11 -0
- package/FlowGraph/serialization.js +11 -1
- package/FlowGraph/serialization.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +43 -51
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.d.ts +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +63 -35
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.d.ts +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.js +2 -2
- package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
- package/Lights/areaLight.pure.js +5 -0
- package/Lights/areaLight.pure.js.map +1 -1
- package/Lights/light.d.ts +4 -2
- package/Lights/light.js +10 -4
- package/Lights/light.js.map +1 -1
- package/Lights/rectAreaLight.pure.d.ts +17 -0
- package/Lights/rectAreaLight.pure.js +67 -0
- package/Lights/rectAreaLight.pure.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.pure.js +1 -1
- package/Loading/Plugins/babylonFileLoader.pure.js.map +1 -1
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +43 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +64 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -0
- package/Materials/Textures/HTML/htmlInteractionManager.d.ts +69 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js +130 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.d.ts +84 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js +246 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlTexture.d.ts +148 -0
- package/Materials/Textures/HTML/htmlTexture.js +455 -0
- package/Materials/Textures/HTML/htmlTexture.js.map +1 -0
- package/Materials/Textures/HTML/index.d.ts +4 -0
- package/Materials/Textures/HTML/index.js +5 -0
- package/Materials/Textures/HTML/index.js.map +1 -0
- package/Materials/Textures/HTML/pure.d.ts +5 -0
- package/Materials/Textures/HTML/pure.js +6 -0
- package/Materials/Textures/HTML/pure.js.map +1 -0
- package/Materials/Textures/index.d.ts +1 -0
- package/Materials/Textures/index.js +1 -1
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/Textures/pure.d.ts +1 -0
- package/Materials/Textures/pure.js +1 -0
- package/Materials/Textures/pure.js.map +1 -1
- package/Materials/Textures/videoTexture.pure.d.ts +3 -0
- package/Materials/Textures/videoTexture.pure.js +30 -0
- package/Materials/Textures/videoTexture.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +9 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +12 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +20 -6
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +1 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +34 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +4 -3
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
/** This module has no top-level side effects: the engine extension it depends on is registered lazily from the constructor */
|
|
2
|
+
import { BaseTexture } from "../baseTexture.pure.js";
|
|
3
|
+
|
|
4
|
+
import { Matrix } from "../../../Maths/math.vector.pure.js";
|
|
5
|
+
import { Observable } from "../../../Misc/observable.pure.js";
|
|
6
|
+
import { Logger } from "../../../Misc/logger.js";
|
|
7
|
+
import { IsWindowObjectExist } from "../../../Misc/domManagement.js";
|
|
8
|
+
import { RegisterEnginesExtensionsEngineDynamicTexture } from "../../../Engines/Extensions/engine.dynamicTexture.pure.js";
|
|
9
|
+
let _HasWarnedAboutMissingApi = false;
|
|
10
|
+
function _WarnMissingApi(apiName) {
|
|
11
|
+
if (_HasWarnedAboutMissingApi) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
_HasWarnedAboutMissingApi = true;
|
|
15
|
+
Logger.Warn(`HTML-in-Canvas: ${apiName} is not available. Enable chrome://flags/#canvas-draw-element, the built-in SVG fallback, or the three-html-render polyfill to use HtmlTexture.`);
|
|
16
|
+
}
|
|
17
|
+
let _HasWarnedAboutSvgFallback = false;
|
|
18
|
+
function _WarnSvgFallback() {
|
|
19
|
+
if (_HasWarnedAboutSvgFallback) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
_HasWarnedAboutSvgFallback = true;
|
|
23
|
+
Logger.Warn("HTML-in-Canvas: the SVG fallback could not rasterize the element. This usually means it references cross-origin or external resources, which taint the snapshot.");
|
|
24
|
+
}
|
|
25
|
+
let _HasWarnedAboutUploadFailure = false;
|
|
26
|
+
function _WarnUploadFailure(error) {
|
|
27
|
+
if (_HasWarnedAboutUploadFailure) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
_HasWarnedAboutUploadFailure = true;
|
|
31
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
32
|
+
Logger.Warn(`HTML-in-Canvas: the native upload failed (${message}). The element must be a direct child of the engine's rendering canvas, which must carry the \`layoutsubtree\` attribute, and the upload must run during a paint event.`);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Detects whether the engine can upload an HTML element through the native (or polyfilled) WICG
|
|
36
|
+
* HTML-in-Canvas API, without emitting any warning. Used to decide whether the SVG fallback is needed.
|
|
37
|
+
* @param engine defines the engine to test
|
|
38
|
+
* @returns true when the WICG upload API is available for this engine
|
|
39
|
+
*/
|
|
40
|
+
export function IsHtmlInCanvasUploadSupported(engine) {
|
|
41
|
+
if (engine.isWebGPU) {
|
|
42
|
+
const queue = engine._device?.queue;
|
|
43
|
+
return !!queue && typeof queue.copyElementImageToTexture === "function";
|
|
44
|
+
}
|
|
45
|
+
const gl = engine._gl;
|
|
46
|
+
return !!gl && typeof gl.texElementImage2D === "function";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Uploads a live HTML element (or a captured ElementImage) into an existing 2D texture using the WICG
|
|
50
|
+
* HTML-in-Canvas API (https://github.com/WICG/html-in-canvas).
|
|
51
|
+
*
|
|
52
|
+
* This is a side-effect-free helper - it is only reachable when {@link HtmlTexture} (or a direct caller)
|
|
53
|
+
* is imported, so it adds nothing to bundles that do not use it. It relies on
|
|
54
|
+
* `WebGLRenderingContext.texElementImage2D` (WebGL) or `GPUQueue.copyElementImageToTexture` (WebGPU),
|
|
55
|
+
* available either natively (behind chrome://flags/#canvas-draw-element) or through the
|
|
56
|
+
* three-html-render polyfill.
|
|
57
|
+
* @param engine defines the engine that owns the texture
|
|
58
|
+
* @param texture defines the internal texture to update
|
|
59
|
+
* @param element defines the source HTML element (or captured ElementImage) to upload
|
|
60
|
+
* @param invertY defines if data must be stored with Y axis inverted (true by default)
|
|
61
|
+
* @param config defines an optional source rectangle and sizing configuration
|
|
62
|
+
* @returns true if the upload succeeded, false otherwise (e.g. the API is unavailable)
|
|
63
|
+
*/
|
|
64
|
+
export function UploadHtmlElementToTexture(engine, texture, element, invertY = true, config) {
|
|
65
|
+
if (!texture || texture._isDisabled) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if (engine.isWebGPU) {
|
|
69
|
+
return _UploadHtmlElementToWebGPUTexture(engine, texture, element, invertY, config);
|
|
70
|
+
}
|
|
71
|
+
return _UploadHtmlElementToWebGLTexture(engine, texture, element, invertY, config);
|
|
72
|
+
}
|
|
73
|
+
// The texElementImage2D signature was changed mid-flight in the WICG proposal (see
|
|
74
|
+
// https://github.com/WICG/html-in-canvas#idl-changes): the current spec form is
|
|
75
|
+
// texElementImage2D(target, internalformat, element, config?), but older Chrome Canary builds (and the
|
|
76
|
+
// three-html-render polyfill) still ship the legacy texImage2D-shaped overload
|
|
77
|
+
// texElementImage2D(target, level, internalformat, format, type, element). We prefer the new form and
|
|
78
|
+
// fall back to the legacy one when the implementation rejects it for the wrong number of arguments. The
|
|
79
|
+
// detected shape is cached so we only pay the failed call once.
|
|
80
|
+
let _UseLegacyTexElementImage2D = false;
|
|
81
|
+
function _CallTexElementImage2D(gl, internalFormat, element, config) {
|
|
82
|
+
if (!_UseLegacyTexElementImage2D) {
|
|
83
|
+
try {
|
|
84
|
+
gl.texElementImage2D(gl.TEXTURE_2D, internalFormat, element, config);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
// Only a wrong-arity TypeError means we are talking to the legacy signature; anything else
|
|
89
|
+
// (e.g. the element is not a canvas child) is a genuine upload failure and must propagate.
|
|
90
|
+
// Native rejects the new form with "N arguments required, but only M present"; the
|
|
91
|
+
// three-html-render polyfill rejects it with "unexpected argument count N".
|
|
92
|
+
if (!(error instanceof TypeError) || !/arguments required|argument count/.test(error.message)) {
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
_UseLegacyTexElementImage2D = true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Legacy overload: texElementImage2D(target, level, internalformat, format, type, element).
|
|
99
|
+
gl.texElementImage2D(gl.TEXTURE_2D, 0, internalFormat, gl.RGBA, gl.UNSIGNED_BYTE, element);
|
|
100
|
+
}
|
|
101
|
+
function _UploadHtmlElementToWebGLTexture(engine, texture, element, invertY, config) {
|
|
102
|
+
// texElementImage2D is provided either natively (behind a flag) or by the three-html-render polyfill.
|
|
103
|
+
// Engines without a WebGL context (e.g. NullEngine) have no _gl and are handled by this guard.
|
|
104
|
+
const gl = engine._gl;
|
|
105
|
+
if (!gl || typeof gl.texElementImage2D !== "function") {
|
|
106
|
+
_WarnMissingApi("texElementImage2D");
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
// texElementImage2D requires a *sized* internal format (RGBA8, SRGB8_ALPHA8, RGBA16F or RGBA32F);
|
|
110
|
+
// the unsized gl.RGBA returned by _getInternalFormat is rejected.
|
|
111
|
+
const internalFormat = engine._getRGBABufferInternalSizedFormat(texture.type, texture.format, texture._useSRGBBuffer);
|
|
112
|
+
const wasPreviouslyBound = engine._bindTextureDirectly(gl.TEXTURE_2D, texture, true);
|
|
113
|
+
engine._unpackFlipY(invertY);
|
|
114
|
+
try {
|
|
115
|
+
_CallTexElementImage2D(gl, internalFormat, element, config);
|
|
116
|
+
if (texture.generateMipMaps) {
|
|
117
|
+
gl.generateMipmap(gl.TEXTURE_2D);
|
|
118
|
+
}
|
|
119
|
+
if (!wasPreviouslyBound) {
|
|
120
|
+
engine._bindTextureDirectly(gl.TEXTURE_2D, null);
|
|
121
|
+
}
|
|
122
|
+
texture.invertY = invertY;
|
|
123
|
+
texture.isReady = true;
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
// Reaching here means the snapshot upload failed - usually a real misconfiguration (the element is
|
|
128
|
+
// not a child of the rendering canvas, or `layoutsubtree` is missing), though a stray call before
|
|
129
|
+
// the first paint snapshot can also throw. Either way we must NOT disable the texture, so a later
|
|
130
|
+
// paint-driven update can still succeed; we surface a one-time diagnostic to help debugging.
|
|
131
|
+
_WarnUploadFailure(error);
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function _UploadHtmlElementToWebGPUTexture(engine, texture, element, invertY, config) {
|
|
136
|
+
// copyElementImageToTexture is provided either natively (behind a flag) or by the three-html-render polyfill.
|
|
137
|
+
const device = engine._device;
|
|
138
|
+
const queue = device && device.queue;
|
|
139
|
+
if (!device || !queue || typeof queue.copyElementImageToTexture !== "function") {
|
|
140
|
+
_WarnMissingApi("GPUQueue.copyElementImageToTexture");
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
const gpuTexture = texture._hardwareTexture?.underlyingResource;
|
|
144
|
+
if (!gpuTexture) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
const source = { source: element };
|
|
149
|
+
if (config) {
|
|
150
|
+
source.sx = config.sx;
|
|
151
|
+
source.sy = config.sy;
|
|
152
|
+
source.swidth = config.swidth;
|
|
153
|
+
source.sheight = config.sheight;
|
|
154
|
+
}
|
|
155
|
+
queue.copyElementImageToTexture(source, {
|
|
156
|
+
destination: { texture: gpuTexture },
|
|
157
|
+
width: config?.width ?? texture.width,
|
|
158
|
+
height: config?.height ?? texture.height,
|
|
159
|
+
});
|
|
160
|
+
if (texture.generateMipMaps) {
|
|
161
|
+
engine._generateMipmaps(texture);
|
|
162
|
+
}
|
|
163
|
+
// The WICG copyElementImageToTexture API has no flipY option; the destination orientation is
|
|
164
|
+
// determined by the source. We record the requested value for downstream sampling conventions.
|
|
165
|
+
texture.invertY = invertY;
|
|
166
|
+
texture.isReady = true;
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
// Reaching here means the snapshot upload failed - usually a real misconfiguration (the element is
|
|
171
|
+
// not a child of the rendering canvas, or `layoutsubtree` is missing), though a stray call before
|
|
172
|
+
// the first paint snapshot can also throw. Either way we must NOT disable the texture, so a later
|
|
173
|
+
// paint-driven update can still succeed; we surface a one-time diagnostic to help debugging.
|
|
174
|
+
_WarnUploadFailure(error);
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* A texture whose content is rendered from a live HTML element using the WICG HTML-in-Canvas API
|
|
180
|
+
* (https://github.com/WICG/html-in-canvas).
|
|
181
|
+
*
|
|
182
|
+
* The element is hosted as a child of the engine's rendering canvas (which is marked `layoutsubtree`) so
|
|
183
|
+
* the browser can lay it out and snapshot it; the WICG API requires the source element to be a direct
|
|
184
|
+
* child of the canvas whose context performs the upload. Content is uploaded through
|
|
185
|
+
* `WebGLRenderingContext.texElementImage2D` (WebGL) or `GPUQueue.copyElementImageToTexture` (WebGPU),
|
|
186
|
+
* available either natively (behind chrome://flags/#canvas-draw-element) or via the three-html-render
|
|
187
|
+
* polyfill (https://github.com/repalash/three-html-render). When neither is present, a built-in SVG
|
|
188
|
+
* `<foreignObject>` fallback is used instead (see `useSvgFallback`).
|
|
189
|
+
*
|
|
190
|
+
* As with {@link HtmlElementTexture}, updates are not automatic unless `autoUpdate` is enabled; in
|
|
191
|
+
* that case the texture refreshes whenever the host canvas reports a paint change.
|
|
192
|
+
*/
|
|
193
|
+
export class HtmlTexture extends BaseTexture {
|
|
194
|
+
/**
|
|
195
|
+
* Instantiates an HtmlTexture from an HTML element.
|
|
196
|
+
* @param name Defines the name of the texture
|
|
197
|
+
* @param element Defines the HTML element to render into the texture
|
|
198
|
+
* @param options Defines the texture creation options
|
|
199
|
+
*/
|
|
200
|
+
constructor(name, element, options) {
|
|
201
|
+
super(options.scene || options.engine);
|
|
202
|
+
/**
|
|
203
|
+
* Observable triggered once the texture has been rendered for the first time.
|
|
204
|
+
*/
|
|
205
|
+
this.onLoadObservable = new Observable();
|
|
206
|
+
this._paintHandler = null;
|
|
207
|
+
this._ownsHost = false;
|
|
208
|
+
this._originalParent = null;
|
|
209
|
+
this._originalNextSibling = null;
|
|
210
|
+
this._addedInert = false;
|
|
211
|
+
this.element = element;
|
|
212
|
+
this._textureMatrix = Matrix.Identity();
|
|
213
|
+
if (!element || (!options.engine && !options.scene)) {
|
|
214
|
+
this.host = null;
|
|
215
|
+
this._width = 0;
|
|
216
|
+
this._height = 0;
|
|
217
|
+
this._format = HtmlTexture._DefaultOptions.format;
|
|
218
|
+
this._generateMipMaps = HtmlTexture._DefaultOptions.generateMipMaps;
|
|
219
|
+
this._samplingMode = HtmlTexture._DefaultOptions.samplingMode;
|
|
220
|
+
this._useSvgFallback = HtmlTexture._DefaultOptions.useSvgFallback;
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
this._generateMipMaps = options.generateMipMaps ?? HtmlTexture._DefaultOptions.generateMipMaps;
|
|
224
|
+
this._samplingMode = options.samplingMode ?? HtmlTexture._DefaultOptions.samplingMode;
|
|
225
|
+
this._format = options.format ?? HtmlTexture._DefaultOptions.format;
|
|
226
|
+
this._useSvgFallback = options.useSvgFallback ?? HtmlTexture._DefaultOptions.useSvgFallback;
|
|
227
|
+
const autoUpdate = options.autoUpdate ?? HtmlTexture._DefaultOptions.autoUpdate;
|
|
228
|
+
this._width = options.width || element.offsetWidth || 256;
|
|
229
|
+
this._height = options.height || element.offsetHeight || 256;
|
|
230
|
+
this.name = name;
|
|
231
|
+
this.wrapU = 0;
|
|
232
|
+
this.wrapV = 0;
|
|
233
|
+
this.anisotropicFilteringLevel = 1;
|
|
234
|
+
this.host = this._createHost();
|
|
235
|
+
// The native WICG API has no content until the first paint snapshot is recorded, so the initial
|
|
236
|
+
// upload must happen from a paint event. The rendering canvas emits `paint`; listen for at least the
|
|
237
|
+
// first one and, when auto-update is disabled, detach after that first refresh. A non-canvas helper
|
|
238
|
+
// host never emits `paint`, so this listener is simply never invoked there.
|
|
239
|
+
if (this.host) {
|
|
240
|
+
this._paintHandler = (event) => {
|
|
241
|
+
// A single `paint` event covers every changed child of the shared rendering canvas. When the
|
|
242
|
+
// browser reports which elements changed, skip the upload unless ours is among them, so that
|
|
243
|
+
// multiple HTML textures hosted on the same canvas don't all re-upload on every unrelated change.
|
|
244
|
+
if (event.changedElements && !event.changedElements.some((changed) => this.element === changed || this.element.contains(changed))) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
this.update();
|
|
248
|
+
if (!autoUpdate && this._paintHandler && this.host) {
|
|
249
|
+
this.host.removeEventListener("paint", this._paintHandler);
|
|
250
|
+
this._paintHandler = null;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
this.host.addEventListener("paint", this._paintHandler);
|
|
254
|
+
}
|
|
255
|
+
this._createInternalTexture();
|
|
256
|
+
}
|
|
257
|
+
_createHost() {
|
|
258
|
+
if (!IsWindowObjectExist() || typeof document === "undefined") {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
// Remember where the caller had the element so dispose() can put it back: we are about to re-parent it
|
|
262
|
+
// into the host (the element must be a direct child of the host to be captured and laid out).
|
|
263
|
+
this._originalParent = this.element.parentNode;
|
|
264
|
+
this._originalNextSibling = this.element.nextSibling;
|
|
265
|
+
// Per the WICG spec, the source element must be a *direct child* of the same canvas whose WebGL/WebGPU
|
|
266
|
+
// context performs the upload, and that canvas must opt its subtree into layout via `layoutsubtree`.
|
|
267
|
+
// The engine already owns our texture through its rendering canvas, so the element has to live inside
|
|
268
|
+
// that canvas: it is the only one whose context can snapshot the element via texElementImage2D /
|
|
269
|
+
// copyElementImageToTexture. A separate canvas would lay the element out but could never be captured
|
|
270
|
+
// into the engine's texture (this is why nothing rendered on the native path before).
|
|
271
|
+
const renderingCanvas = this._getEngine()?.getRenderingCanvas() ?? null;
|
|
272
|
+
if (renderingCanvas) {
|
|
273
|
+
renderingCanvas.layoutSubtree = true;
|
|
274
|
+
// `layoutsubtree` opts children into hit testing; mark ours inert so it never steals pointer events
|
|
275
|
+
// from the canvas (e.g. camera controls). Synthetic event dispatch still reaches inert elements, so
|
|
276
|
+
// HtmlRaycastInteractionManager keeps working; HtmlInteractionManager clears it to enable native input.
|
|
277
|
+
this._addedInert = !this.element.hasAttribute("inert");
|
|
278
|
+
this.element.setAttribute("inert", "");
|
|
279
|
+
renderingCanvas.appendChild(this.element);
|
|
280
|
+
this._ownsHost = false;
|
|
281
|
+
return renderingCanvas;
|
|
282
|
+
}
|
|
283
|
+
// No rendering canvas (e.g. NullEngine / offscreen): the native upload paths cannot run, because they
|
|
284
|
+
// capture from the engine's canvas and there is none. Only the SVG fallback renders here, and it builds
|
|
285
|
+
// from the element's serialized markup rather than from a canvas - so a host *canvas* would buy nothing.
|
|
286
|
+
// Host the element in a hidden, off-screen <div> purely so it is laid out in the document (giving
|
|
287
|
+
// correct measured sizes); there is no canvas to capture into on this path.
|
|
288
|
+
const host = document.createElement("div");
|
|
289
|
+
host.style.position = "absolute";
|
|
290
|
+
host.style.left = "-99999px";
|
|
291
|
+
host.style.top = "0px";
|
|
292
|
+
host.style.pointerEvents = "none";
|
|
293
|
+
host.setAttribute("aria-hidden", "true");
|
|
294
|
+
host.appendChild(this.element);
|
|
295
|
+
document.body.appendChild(host);
|
|
296
|
+
this._ownsHost = true;
|
|
297
|
+
return host;
|
|
298
|
+
}
|
|
299
|
+
_createInternalTexture() {
|
|
300
|
+
const engine = this._getEngine();
|
|
301
|
+
if (engine) {
|
|
302
|
+
// createDynamicTexture is an engine extension; register it lazily (idempotent) so this module stays free of top-level side effects.
|
|
303
|
+
RegisterEnginesExtensionsEngineDynamicTexture();
|
|
304
|
+
this._texture = engine.createDynamicTexture(this._width, this._height, this._generateMipMaps, this._samplingMode);
|
|
305
|
+
this._texture.format = this._format;
|
|
306
|
+
}
|
|
307
|
+
// Trigger the initial render. On the native path this requests a paint so the first upload happens
|
|
308
|
+
// once a snapshot exists (calling the WICG API before the first snapshot throws); otherwise the
|
|
309
|
+
// SVG fallback (or a direct update) renders immediately.
|
|
310
|
+
this.requestUpdate();
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* @returns the texture matrix used in most of the material.
|
|
314
|
+
*/
|
|
315
|
+
getTextureMatrix() {
|
|
316
|
+
return this._textureMatrix;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Requests the host canvas to emit a paint event on the next rendering update. When auto-update is
|
|
320
|
+
* enabled, this triggers a texture refresh in sync with the DOM. Falls back to an immediate update
|
|
321
|
+
* when the WICG API is not available.
|
|
322
|
+
*/
|
|
323
|
+
requestUpdate() {
|
|
324
|
+
// `requestPaint` only exists on a WICG-capable rendering canvas; the helper <div> host has no such
|
|
325
|
+
// method, so fall back to an immediate update there.
|
|
326
|
+
const canvasHost = this.host;
|
|
327
|
+
if (canvasHost && typeof canvasHost.requestPaint === "function") {
|
|
328
|
+
canvasHost.requestPaint();
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
this.update();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Updates the content of the texture from the current state of the HTML element.
|
|
336
|
+
* @param invertY Defines whether the texture should be inverted on Y (true by default)
|
|
337
|
+
*/
|
|
338
|
+
update(invertY = true) {
|
|
339
|
+
const engine = this._getEngine();
|
|
340
|
+
if (this._texture == null || engine == null) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
// When the native WICG upload API is unavailable, render through the SVG <foreignObject> fallback
|
|
344
|
+
// (unless it was explicitly disabled, in which case the upload helper emits a one-time warning).
|
|
345
|
+
if (this._useSvgFallback && !IsHtmlInCanvasUploadSupported(engine)) {
|
|
346
|
+
this._updateFromSvgFallback(engine, invertY);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
const wasReady = this.isReady();
|
|
350
|
+
UploadHtmlElementToTexture(engine, this._texture, this.element, invertY);
|
|
351
|
+
if (!wasReady && this.isReady()) {
|
|
352
|
+
this.onLoadObservable.notifyObservers(this);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Renders the element through an SVG `<foreignObject>` snapshot and uploads it to the texture. This
|
|
357
|
+
* fallback works in any browser but only captures same-origin, inline-styled content as a static image.
|
|
358
|
+
* @param engine defines the engine that owns the texture
|
|
359
|
+
* @param invertY defines whether the texture should be inverted on Y
|
|
360
|
+
*/
|
|
361
|
+
_updateFromSvgFallback(engine, invertY) {
|
|
362
|
+
if (typeof document === "undefined" || typeof Image === "undefined" || typeof XMLSerializer === "undefined") {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const svgUrl = this._buildSvgDataUrl();
|
|
366
|
+
if (!svgUrl) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const image = new Image();
|
|
370
|
+
image.onload = () => {
|
|
371
|
+
if (this._texture == null) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
const wasReady = this.isReady();
|
|
375
|
+
try {
|
|
376
|
+
engine.updateDynamicTexture(this._texture, image, invertY, false, this._format);
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
_WarnSvgFallback();
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (!wasReady && this.isReady()) {
|
|
383
|
+
this.onLoadObservable.notifyObservers(this);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
image.onerror = () => {
|
|
387
|
+
_WarnSvgFallback();
|
|
388
|
+
};
|
|
389
|
+
image.src = svgUrl;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Serializes the element into an SVG `<foreignObject>` data URL sized to the texture.
|
|
393
|
+
* @returns a data URL, or null if serialization failed
|
|
394
|
+
*/
|
|
395
|
+
_buildSvgDataUrl() {
|
|
396
|
+
try {
|
|
397
|
+
const clone = this.element.cloneNode(true);
|
|
398
|
+
clone.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
|
|
399
|
+
const serialized = new XMLSerializer().serializeToString(clone);
|
|
400
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${this._width}" height="${this._height}">` +
|
|
401
|
+
`<foreignObject x="0" y="0" width="100%" height="100%">${serialized}</foreignObject>` +
|
|
402
|
+
`</svg>`;
|
|
403
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
404
|
+
}
|
|
405
|
+
catch {
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Gets the current class name of the texture useful for serialization or dynamic coding.
|
|
411
|
+
* @returns "HtmlTexture"
|
|
412
|
+
*/
|
|
413
|
+
getClassName() {
|
|
414
|
+
return "HtmlTexture";
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Dispose the texture and release its associated resources.
|
|
418
|
+
*/
|
|
419
|
+
dispose() {
|
|
420
|
+
if (this.host) {
|
|
421
|
+
if (this._paintHandler) {
|
|
422
|
+
this.host.removeEventListener("paint", this._paintHandler);
|
|
423
|
+
this._paintHandler = null;
|
|
424
|
+
}
|
|
425
|
+
// Remove the `inert` attribute we added so the caller gets the element back as they passed it.
|
|
426
|
+
if (this._addedInert) {
|
|
427
|
+
this.element.removeAttribute("inert");
|
|
428
|
+
this._addedInert = false;
|
|
429
|
+
}
|
|
430
|
+
// Restore the element to where the caller had it before we re-parented it into the host, rather
|
|
431
|
+
// than silently deleting their node from the document.
|
|
432
|
+
if (this._originalParent) {
|
|
433
|
+
const reference = this._originalNextSibling && this._originalNextSibling.parentNode === this._originalParent ? this._originalNextSibling : null;
|
|
434
|
+
this._originalParent.insertBefore(this.element, reference);
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
this.element.remove();
|
|
438
|
+
}
|
|
439
|
+
// Remove the helper host we created (never the engine's borrowed rendering canvas).
|
|
440
|
+
if (this._ownsHost) {
|
|
441
|
+
this.host.remove();
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
this.onLoadObservable.clear();
|
|
445
|
+
super.dispose();
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
HtmlTexture._DefaultOptions = {
|
|
449
|
+
generateMipMaps: false,
|
|
450
|
+
samplingMode: 2,
|
|
451
|
+
format: 5,
|
|
452
|
+
autoUpdate: true,
|
|
453
|
+
useSvgFallback: true,
|
|
454
|
+
};
|
|
455
|
+
//# sourceMappingURL=htmlTexture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"htmlTexture.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/HTML/htmlTexture.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAG9H,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,6CAA6C,EAAE,MAAM,wDAAwD,CAAC;AASvH,IAAI,yBAAyB,GAAG,KAAK,CAAC;AAEtC,SAAS,eAAe,CAAC,OAAe;IACpC,IAAI,yBAAyB,EAAE,CAAC;QAC5B,OAAO;IACX,CAAC;IACD,yBAAyB,GAAG,IAAI,CAAC;IACjC,MAAM,CAAC,IAAI,CACP,mBAAmB,OAAO,iJAAiJ,CAC9K,CAAC;AACN,CAAC;AAED,IAAI,0BAA0B,GAAG,KAAK,CAAC;AAEvC,SAAS,gBAAgB;I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C,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AAnSuB,2BAAe,GAAyH;IAC5J,eAAe,EAAE,KAAK;IACtB,YAAY,EAAE,SAAS,CAAC,6BAA6B;IACrD,MAAM,EAAE,SAAS,CAAC,kBAAkB;IACpC,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;CACvB,AANsC,CAMrC","sourcesContent":["/** This module has no top-level side effects: the engine extension it depends on is registered lazily from the constructor */\n\nimport { type Nullable } from \"../../../types\";\nimport { BaseTexture } from \"../baseTexture.pure\";\nimport { Constants } from \"../../../Engines/constants\";\nimport { Matrix } from \"../../../Maths/math.vector.pure\";\nimport { Observable } from \"../../../Misc/observable.pure\";\nimport { Logger } from \"../../../Misc/logger\";\nimport { IsWindowObjectExist } from \"../../../Misc/domManagement\";\nimport { RegisterEnginesExtensionsEngineDynamicTexture } from \"../../../Engines/Extensions/engine.dynamicTexture.pure\";\n\nimport { type AbstractEngine } from \"../../../Engines/abstractEngine.pure\";\nimport { type ThinEngine } from \"../../../Engines/thinEngine.pure\";\nimport { type WebGPUEngine } from \"../../../Engines/webgpuEngine.pure\";\nimport { type WebGPUHardwareTexture } from \"../../../Engines/WebGPU/webgpuHardwareTexture\";\nimport { type InternalTexture } from \"../internalTexture\";\nimport { type Scene } from \"../../../scene.pure\";\n\nlet _HasWarnedAboutMissingApi = false;\n\nfunction _WarnMissingApi(apiName: string): void {\n if (_HasWarnedAboutMissingApi) {\n return;\n }\n _HasWarnedAboutMissingApi = true;\n Logger.Warn(\n `HTML-in-Canvas: ${apiName} is not available. Enable chrome://flags/#canvas-draw-element, the built-in SVG fallback, or the three-html-render polyfill to use HtmlTexture.`\n );\n}\n\nlet _HasWarnedAboutSvgFallback = false;\n\nfunction _WarnSvgFallback(): void {\n if (_HasWarnedAboutSvgFallback) {\n return;\n }\n _HasWarnedAboutSvgFallback = true;\n Logger.Warn(\"HTML-in-Canvas: the SVG fallback could not rasterize the element. This usually means it references cross-origin or external resources, which taint the snapshot.\");\n}\n\nlet _HasWarnedAboutUploadFailure = false;\n\nfunction _WarnUploadFailure(error: unknown): void {\n if (_HasWarnedAboutUploadFailure) {\n return;\n }\n _HasWarnedAboutUploadFailure = true;\n const message = error instanceof Error ? error.message : String(error);\n Logger.Warn(\n `HTML-in-Canvas: the native upload failed (${message}). The element must be a direct child of the engine's rendering canvas, which must carry the \\`layoutsubtree\\` attribute, and the upload must run during a paint event.`\n );\n}\n\n/**\n * Detects whether the engine can upload an HTML element through the native (or polyfilled) WICG\n * HTML-in-Canvas API, without emitting any warning. Used to decide whether the SVG fallback is needed.\n * @param engine defines the engine to test\n * @returns true when the WICG upload API is available for this engine\n */\nexport function IsHtmlInCanvasUploadSupported(engine: AbstractEngine): boolean {\n if (engine.isWebGPU) {\n const queue = (engine as WebGPUEngine)._device?.queue;\n return !!queue && typeof queue.copyElementImageToTexture === \"function\";\n }\n\n const gl = (engine as ThinEngine)._gl as Nullable<WebGL2RenderingContext>;\n return !!gl && typeof gl.texElementImage2D === \"function\";\n}\n\n/**\n * Uploads a live HTML element (or a captured ElementImage) into an existing 2D texture using the WICG\n * HTML-in-Canvas API (https://github.com/WICG/html-in-canvas).\n *\n * This is a side-effect-free helper - it is only reachable when {@link HtmlTexture} (or a direct caller)\n * is imported, so it adds nothing to bundles that do not use it. It relies on\n * `WebGLRenderingContext.texElementImage2D` (WebGL) or `GPUQueue.copyElementImageToTexture` (WebGPU),\n * available either natively (behind chrome://flags/#canvas-draw-element) or through the\n * three-html-render polyfill.\n * @param engine defines the engine that owns the texture\n * @param texture defines the internal texture to update\n * @param element defines the source HTML element (or captured ElementImage) to upload\n * @param invertY defines if data must be stored with Y axis inverted (true by default)\n * @param config defines an optional source rectangle and sizing configuration\n * @returns true if the upload succeeded, false otherwise (e.g. the API is unavailable)\n */\nexport function UploadHtmlElementToTexture(\n engine: AbstractEngine,\n texture: Nullable<InternalTexture>,\n element: Element | ElementImage,\n invertY: boolean = true,\n config?: WebGLCopyElementImageConfig\n): boolean {\n if (!texture || texture._isDisabled) {\n return false;\n }\n\n if (engine.isWebGPU) {\n return _UploadHtmlElementToWebGPUTexture(engine as WebGPUEngine, texture, element, invertY, config);\n }\n\n return _UploadHtmlElementToWebGLTexture(engine as ThinEngine, texture, element, invertY, config);\n}\n\n// The texElementImage2D signature was changed mid-flight in the WICG proposal (see\n// https://github.com/WICG/html-in-canvas#idl-changes): the current spec form is\n// texElementImage2D(target, internalformat, element, config?), but older Chrome Canary builds (and the\n// three-html-render polyfill) still ship the legacy texImage2D-shaped overload\n// texElementImage2D(target, level, internalformat, format, type, element). We prefer the new form and\n// fall back to the legacy one when the implementation rejects it for the wrong number of arguments. The\n// detected shape is cached so we only pay the failed call once.\nlet _UseLegacyTexElementImage2D = false;\n\nfunction _CallTexElementImage2D(gl: WebGL2RenderingContext, internalFormat: number, element: Element | ElementImage, config?: WebGLCopyElementImageConfig): void {\n if (!_UseLegacyTexElementImage2D) {\n try {\n gl.texElementImage2D(gl.TEXTURE_2D, internalFormat, element, config);\n return;\n } catch (error) {\n // Only a wrong-arity TypeError means we are talking to the legacy signature; anything else\n // (e.g. the element is not a canvas child) is a genuine upload failure and must propagate.\n // Native rejects the new form with \"N arguments required, but only M present\"; the\n // three-html-render polyfill rejects it with \"unexpected argument count N\".\n if (!(error instanceof TypeError) || !/arguments required|argument count/.test((error as Error).message)) {\n throw error;\n }\n _UseLegacyTexElementImage2D = true;\n }\n }\n\n // Legacy overload: texElementImage2D(target, level, internalformat, format, type, element).\n gl.texElementImage2D(gl.TEXTURE_2D, 0, internalFormat, gl.RGBA, gl.UNSIGNED_BYTE, element);\n}\n\nfunction _UploadHtmlElementToWebGLTexture(\n engine: ThinEngine,\n texture: InternalTexture,\n element: Element | ElementImage,\n invertY: boolean,\n config?: WebGLCopyElementImageConfig\n): boolean {\n // texElementImage2D is provided either natively (behind a flag) or by the three-html-render polyfill.\n // Engines without a WebGL context (e.g. NullEngine) have no _gl and are handled by this guard.\n const gl = engine._gl as Nullable<WebGL2RenderingContext>;\n if (!gl || typeof gl.texElementImage2D !== \"function\") {\n _WarnMissingApi(\"texElementImage2D\");\n return false;\n }\n\n // texElementImage2D requires a *sized* internal format (RGBA8, SRGB8_ALPHA8, RGBA16F or RGBA32F);\n // the unsized gl.RGBA returned by _getInternalFormat is rejected.\n const internalFormat = engine._getRGBABufferInternalSizedFormat(texture.type, texture.format, texture._useSRGBBuffer);\n const wasPreviouslyBound = engine._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\n engine._unpackFlipY(invertY);\n\n try {\n _CallTexElementImage2D(gl, internalFormat, element, config);\n\n if (texture.generateMipMaps) {\n gl.generateMipmap(gl.TEXTURE_2D);\n }\n\n if (!wasPreviouslyBound) {\n engine._bindTextureDirectly(gl.TEXTURE_2D, null);\n }\n\n texture.invertY = invertY;\n texture.isReady = true;\n return true;\n } catch (error) {\n // Reaching here means the snapshot upload failed - usually a real misconfiguration (the element is\n // not a child of the rendering canvas, or `layoutsubtree` is missing), though a stray call before\n // the first paint snapshot can also throw. Either way we must NOT disable the texture, so a later\n // paint-driven update can still succeed; we surface a one-time diagnostic to help debugging.\n _WarnUploadFailure(error);\n return false;\n }\n}\n\nfunction _UploadHtmlElementToWebGPUTexture(\n engine: WebGPUEngine,\n texture: InternalTexture,\n element: Element | ElementImage,\n invertY: boolean,\n config?: WebGLCopyElementImageConfig\n): boolean {\n // copyElementImageToTexture is provided either natively (behind a flag) or by the three-html-render polyfill.\n const device = engine._device;\n const queue = device && device.queue;\n if (!device || !queue || typeof queue.copyElementImageToTexture !== \"function\") {\n _WarnMissingApi(\"GPUQueue.copyElementImageToTexture\");\n return false;\n }\n\n const gpuTexture = (texture._hardwareTexture as Nullable<WebGPUHardwareTexture>)?.underlyingResource;\n if (!gpuTexture) {\n return false;\n }\n\n try {\n const source: GPUCopyElementImageSource = { source: element };\n if (config) {\n source.sx = config.sx;\n source.sy = config.sy;\n source.swidth = config.swidth;\n source.sheight = config.sheight;\n }\n\n queue.copyElementImageToTexture(source, {\n destination: { texture: gpuTexture },\n width: config?.width ?? texture.width,\n height: config?.height ?? texture.height,\n });\n\n if (texture.generateMipMaps) {\n engine._generateMipmaps(texture);\n }\n\n // The WICG copyElementImageToTexture API has no flipY option; the destination orientation is\n // determined by the source. We record the requested value for downstream sampling conventions.\n texture.invertY = invertY;\n texture.isReady = true;\n return true;\n } catch (error) {\n // Reaching here means the snapshot upload failed - usually a real misconfiguration (the element is\n // not a child of the rendering canvas, or `layoutsubtree` is missing), though a stray call before\n // the first paint snapshot can also throw. Either way we must NOT disable the texture, so a later\n // paint-driven update can still succeed; we surface a one-time diagnostic to help debugging.\n _WarnUploadFailure(error);\n return false;\n }\n}\n\n/**\n * Defines the options used to create an {@link HtmlTexture}.\n */\nexport interface IHtmlTextureOptions {\n /** Defines the width of the texture in pixels (defaults to the element's offset width, then 256). */\n width?: number;\n /** Defines the height of the texture in pixels (defaults to the element's offset height, then 256). */\n height?: number;\n /** Defines whether mip maps should be created or not (default: false). */\n generateMipMaps?: boolean;\n /** Defines the sampling mode of the texture (default: TEXTURE_BILINEAR_SAMPLINGMODE). */\n samplingMode?: number;\n /** Defines the associated texture format (default: TEXTUREFORMAT_RGBA). */\n format?: number;\n /** Defines whether the texture is automatically updated when the host canvas emits a paint event (default: true). */\n autoUpdate?: boolean;\n /**\n * Defines whether to fall back to an SVG `<foreignObject>` rasterization when the native WICG\n * HTML-in-Canvas API is unavailable (default: true). The fallback works in any browser but only\n * captures same-origin, inline-styled content as a static snapshot (see the documentation for caveats).\n */\n useSvgFallback?: boolean;\n /** Defines the engine instance to use the texture with. Not mandatory if a scene is provided. */\n engine?: Nullable<AbstractEngine>;\n /** Defines the scene the texture belongs to. Not mandatory if an engine is provided. */\n scene?: Nullable<Scene>;\n}\n\n/**\n * A texture whose content is rendered from a live HTML element using the WICG HTML-in-Canvas API\n * (https://github.com/WICG/html-in-canvas).\n *\n * The element is hosted as a child of the engine's rendering canvas (which is marked `layoutsubtree`) so\n * the browser can lay it out and snapshot it; the WICG API requires the source element to be a direct\n * child of the canvas whose context performs the upload. Content is uploaded through\n * `WebGLRenderingContext.texElementImage2D` (WebGL) or `GPUQueue.copyElementImageToTexture` (WebGPU),\n * available either natively (behind chrome://flags/#canvas-draw-element) or via the three-html-render\n * polyfill (https://github.com/repalash/three-html-render). When neither is present, a built-in SVG\n * `<foreignObject>` fallback is used instead (see `useSvgFallback`).\n *\n * As with {@link HtmlElementTexture}, updates are not automatic unless `autoUpdate` is enabled; in\n * that case the texture refreshes whenever the host canvas reports a paint change.\n */\nexport class HtmlTexture extends BaseTexture {\n /**\n * The HTML element rendered into the texture.\n */\n public readonly element: HTMLElement;\n\n /**\n * The element that hosts {@link element} in the document. This is the engine's rendering canvas when one\n * is available (required by the WICG API, which can only capture the element from that canvas), or a\n * hidden helper `<div>` otherwise - in which case only the SVG fallback can render.\n */\n public readonly host: Nullable<HTMLElement>;\n\n /**\n * Observable triggered once the texture has been rendered for the first time.\n */\n public onLoadObservable: Observable<HtmlTexture> = new Observable<HtmlTexture>();\n\n private static readonly _DefaultOptions: Required<Pick<IHtmlTextureOptions, \"generateMipMaps\" | \"samplingMode\" | \"format\" | \"autoUpdate\" | \"useSvgFallback\">> = {\n generateMipMaps: false,\n samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,\n format: Constants.TEXTUREFORMAT_RGBA,\n autoUpdate: true,\n useSvgFallback: true,\n };\n\n private readonly _format: number;\n private readonly _generateMipMaps: boolean;\n private readonly _samplingMode: number;\n private readonly _useSvgFallback: boolean;\n private readonly _textureMatrix: Matrix;\n private _paintHandler: Nullable<(event: PaintEvent) => void> = null;\n private _ownsHost: boolean = false;\n private _originalParent: Nullable<Node & ParentNode> = null;\n private _originalNextSibling: Nullable<ChildNode> = null;\n private _addedInert: boolean = false;\n private _width: number;\n private _height: number;\n\n /**\n * Instantiates an HtmlTexture from an HTML element.\n * @param name Defines the name of the texture\n * @param element Defines the HTML element to render into the texture\n * @param options Defines the texture creation options\n */\n constructor(name: string, element: HTMLElement, options: IHtmlTextureOptions) {\n super(options.scene || options.engine);\n\n this.element = element;\n this._textureMatrix = Matrix.Identity();\n\n if (!element || (!options.engine && !options.scene)) {\n this.host = null;\n this._width = 0;\n this._height = 0;\n this._format = HtmlTexture._DefaultOptions.format;\n this._generateMipMaps = HtmlTexture._DefaultOptions.generateMipMaps;\n this._samplingMode = HtmlTexture._DefaultOptions.samplingMode;\n this._useSvgFallback = HtmlTexture._DefaultOptions.useSvgFallback;\n return;\n }\n\n this._generateMipMaps = options.generateMipMaps ?? HtmlTexture._DefaultOptions.generateMipMaps;\n this._samplingMode = options.samplingMode ?? HtmlTexture._DefaultOptions.samplingMode;\n this._format = options.format ?? HtmlTexture._DefaultOptions.format;\n this._useSvgFallback = options.useSvgFallback ?? HtmlTexture._DefaultOptions.useSvgFallback;\n const autoUpdate = options.autoUpdate ?? HtmlTexture._DefaultOptions.autoUpdate;\n\n this._width = options.width || element.offsetWidth || 256;\n this._height = options.height || element.offsetHeight || 256;\n\n this.name = name;\n this.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\n this.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\n this.anisotropicFilteringLevel = 1;\n\n this.host = this._createHost();\n\n // The native WICG API has no content until the first paint snapshot is recorded, so the initial\n // upload must happen from a paint event. The rendering canvas emits `paint`; listen for at least the\n // first one and, when auto-update is disabled, detach after that first refresh. A non-canvas helper\n // host never emits `paint`, so this listener is simply never invoked there.\n if (this.host) {\n this._paintHandler = (event: PaintEvent) => {\n // A single `paint` event covers every changed child of the shared rendering canvas. When the\n // browser reports which elements changed, skip the upload unless ours is among them, so that\n // multiple HTML textures hosted on the same canvas don't all re-upload on every unrelated change.\n if (event.changedElements && !event.changedElements.some((changed) => this.element === changed || this.element.contains(changed))) {\n return;\n }\n this.update();\n if (!autoUpdate && this._paintHandler && this.host) {\n this.host.removeEventListener(\"paint\", this._paintHandler as EventListener);\n this._paintHandler = null;\n }\n };\n this.host.addEventListener(\"paint\", this._paintHandler as EventListener);\n }\n\n this._createInternalTexture();\n }\n\n private _createHost(): Nullable<HTMLElement> {\n if (!IsWindowObjectExist() || typeof document === \"undefined\") {\n return null;\n }\n\n // Remember where the caller had the element so dispose() can put it back: we are about to re-parent it\n // into the host (the element must be a direct child of the host to be captured and laid out).\n this._originalParent = this.element.parentNode;\n this._originalNextSibling = this.element.nextSibling;\n\n // Per the WICG spec, the source element must be a *direct child* of the same canvas whose WebGL/WebGPU\n // context performs the upload, and that canvas must opt its subtree into layout via `layoutsubtree`.\n // The engine already owns our texture through its rendering canvas, so the element has to live inside\n // that canvas: it is the only one whose context can snapshot the element via texElementImage2D /\n // copyElementImageToTexture. A separate canvas would lay the element out but could never be captured\n // into the engine's texture (this is why nothing rendered on the native path before).\n const renderingCanvas = this._getEngine()?.getRenderingCanvas() ?? null;\n if (renderingCanvas) {\n renderingCanvas.layoutSubtree = true;\n // `layoutsubtree` opts children into hit testing; mark ours inert so it never steals pointer events\n // from the canvas (e.g. camera controls). Synthetic event dispatch still reaches inert elements, so\n // HtmlRaycastInteractionManager keeps working; HtmlInteractionManager clears it to enable native input.\n this._addedInert = !this.element.hasAttribute(\"inert\");\n this.element.setAttribute(\"inert\", \"\");\n renderingCanvas.appendChild(this.element);\n this._ownsHost = false;\n return renderingCanvas;\n }\n\n // No rendering canvas (e.g. NullEngine / offscreen): the native upload paths cannot run, because they\n // capture from the engine's canvas and there is none. Only the SVG fallback renders here, and it builds\n // from the element's serialized markup rather than from a canvas - so a host *canvas* would buy nothing.\n // Host the element in a hidden, off-screen <div> purely so it is laid out in the document (giving\n // correct measured sizes); there is no canvas to capture into on this path.\n const host = document.createElement(\"div\");\n host.style.position = \"absolute\";\n host.style.left = \"-99999px\";\n host.style.top = \"0px\";\n host.style.pointerEvents = \"none\";\n host.setAttribute(\"aria-hidden\", \"true\");\n\n host.appendChild(this.element);\n document.body.appendChild(host);\n this._ownsHost = true;\n\n return host;\n }\n\n private _createInternalTexture(): void {\n const engine = this._getEngine();\n if (engine) {\n // createDynamicTexture is an engine extension; register it lazily (idempotent) so this module stays free of top-level side effects.\n RegisterEnginesExtensionsEngineDynamicTexture();\n this._texture = engine.createDynamicTexture(this._width, this._height, this._generateMipMaps, this._samplingMode);\n this._texture.format = this._format;\n }\n\n // Trigger the initial render. On the native path this requests a paint so the first upload happens\n // once a snapshot exists (calling the WICG API before the first snapshot throws); otherwise the\n // SVG fallback (or a direct update) renders immediately.\n this.requestUpdate();\n }\n\n /**\n * @returns the texture matrix used in most of the material.\n */\n public override getTextureMatrix(): Matrix {\n return this._textureMatrix;\n }\n\n /**\n * Requests the host canvas to emit a paint event on the next rendering update. When auto-update is\n * enabled, this triggers a texture refresh in sync with the DOM. Falls back to an immediate update\n * when the WICG API is not available.\n */\n public requestUpdate(): void {\n // `requestPaint` only exists on a WICG-capable rendering canvas; the helper <div> host has no such\n // method, so fall back to an immediate update there.\n const canvasHost = this.host as Nullable<HTMLCanvasElement>;\n if (canvasHost && typeof canvasHost.requestPaint === \"function\") {\n canvasHost.requestPaint();\n } else {\n this.update();\n }\n }\n\n /**\n * Updates the content of the texture from the current state of the HTML element.\n * @param invertY Defines whether the texture should be inverted on Y (true by default)\n */\n public update(invertY: boolean = true): void {\n const engine = this._getEngine();\n if (this._texture == null || engine == null) {\n return;\n }\n\n // When the native WICG upload API is unavailable, render through the SVG <foreignObject> fallback\n // (unless it was explicitly disabled, in which case the upload helper emits a one-time warning).\n if (this._useSvgFallback && !IsHtmlInCanvasUploadSupported(engine)) {\n this._updateFromSvgFallback(engine, invertY);\n return;\n }\n\n const wasReady = this.isReady();\n\n UploadHtmlElementToTexture(engine, this._texture, this.element, invertY);\n\n if (!wasReady && this.isReady()) {\n this.onLoadObservable.notifyObservers(this);\n }\n }\n\n /**\n * Renders the element through an SVG `<foreignObject>` snapshot and uploads it to the texture. This\n * fallback works in any browser but only captures same-origin, inline-styled content as a static image.\n * @param engine defines the engine that owns the texture\n * @param invertY defines whether the texture should be inverted on Y\n */\n private _updateFromSvgFallback(engine: AbstractEngine, invertY: boolean): void {\n if (typeof document === \"undefined\" || typeof Image === \"undefined\" || typeof XMLSerializer === \"undefined\") {\n return;\n }\n\n const svgUrl = this._buildSvgDataUrl();\n if (!svgUrl) {\n return;\n }\n\n const image = new Image();\n image.onload = () => {\n if (this._texture == null) {\n return;\n }\n const wasReady = this.isReady();\n try {\n engine.updateDynamicTexture(this._texture, image, invertY, false, this._format);\n } catch {\n _WarnSvgFallback();\n return;\n }\n if (!wasReady && this.isReady()) {\n this.onLoadObservable.notifyObservers(this);\n }\n };\n image.onerror = () => {\n _WarnSvgFallback();\n };\n image.src = svgUrl;\n }\n\n /**\n * Serializes the element into an SVG `<foreignObject>` data URL sized to the texture.\n * @returns a data URL, or null if serialization failed\n */\n private _buildSvgDataUrl(): Nullable<string> {\n try {\n const clone = this.element.cloneNode(true) as HTMLElement;\n clone.setAttribute(\"xmlns\", \"http://www.w3.org/1999/xhtml\");\n const serialized = new XMLSerializer().serializeToString(clone);\n const svg =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${this._width}\" height=\"${this._height}\">` +\n `<foreignObject x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">${serialized}</foreignObject>` +\n `</svg>`;\n return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;\n } catch {\n return null;\n }\n }\n\n /**\n * Gets the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"HtmlTexture\"\n */\n public override getClassName(): string {\n return \"HtmlTexture\";\n }\n\n /**\n * Dispose the texture and release its associated resources.\n */\n public override dispose(): void {\n if (this.host) {\n if (this._paintHandler) {\n this.host.removeEventListener(\"paint\", this._paintHandler as EventListener);\n this._paintHandler = null;\n }\n // Remove the `inert` attribute we added so the caller gets the element back as they passed it.\n if (this._addedInert) {\n this.element.removeAttribute(\"inert\");\n this._addedInert = false;\n }\n // Restore the element to where the caller had it before we re-parented it into the host, rather\n // than silently deleting their node from the document.\n if (this._originalParent) {\n const reference = this._originalNextSibling && this._originalNextSibling.parentNode === this._originalParent ? this._originalNextSibling : null;\n this._originalParent.insertBefore(this.element, reference);\n } else {\n this.element.remove();\n }\n // Remove the helper host we created (never the engine's borrowed rendering canvas).\n if (this._ownsHost) {\n this.host.remove();\n }\n }\n\n this.onLoadObservable.clear();\n super.dispose();\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/HTML/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC","sourcesContent":["export * from \"./htmlTexture\";\nexport * from \"./htmlInteractionManager\";\nexport * from \"./htmlRaycastInteractionManager\";\nexport * from \"./htmlInCanvasPolyfill\";\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Pure barrel — re-exports only side-effect-free modules */
|
|
2
|
+
export * from "./htmlTexture.js";
|
|
3
|
+
export * from "./htmlInteractionManager.js";
|
|
4
|
+
export * from "./htmlRaycastInteractionManager.js";
|
|
5
|
+
export * from "./htmlInCanvasPolyfill.js";
|
|
6
|
+
//# sourceMappingURL=pure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/HTML/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./htmlTexture\";\nexport * from \"./htmlInteractionManager\";\nexport * from \"./htmlRaycastInteractionManager\";\nexport * from \"./htmlInCanvasPolyfill\";\n"]}
|
|
@@ -10,6 +10,7 @@ export * from "./envCubeTexture.js";
|
|
|
10
10
|
export * from "./hdrCubeTexture.js";
|
|
11
11
|
export * from "./exrCubeTexture.js";
|
|
12
12
|
export * from "./htmlElementTexture.js";
|
|
13
|
+
export * from "./HTML/index.js";
|
|
13
14
|
export * from "./internalTexture.js";
|
|
14
15
|
export * from "./Loaders/index.js";
|
|
15
16
|
export * from "./mirrorTexture.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-restricted-imports */
|
|
2
2
|
export * from "./baseTexture.js";
|
|
3
|
-
// eslint-disable-next-line import/export
|
|
4
3
|
export * from "./baseTexture.polynomial.js";
|
|
5
4
|
export * from "./colorGradingTexture.js";
|
|
6
5
|
export * from "./cubeTexture.js";
|
|
@@ -12,6 +11,7 @@ export * from "./envCubeTexture.js";
|
|
|
12
11
|
export * from "./hdrCubeTexture.js";
|
|
13
12
|
export * from "./exrCubeTexture.js";
|
|
14
13
|
export * from "./htmlElementTexture.js";
|
|
14
|
+
export * from "./HTML/index.js";
|
|
15
15
|
export * from "./internalTexture.js";
|
|
16
16
|
export * from "./Loaders/index.js";
|
|
17
17
|
export * from "./mirrorTexture.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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAE9B,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,kBAAk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D,CAAC;AACpE,cAAc,yDAAyD,CAAC;AACxE,cAAc,oDAAoD,CAAC;AACnE,cAAc,iDAAiD,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./baseTexture\";\r\n\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 \"./HTML/index\";\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 \"./textureProcessor\";\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\r\n// HDR filtering shader includes (needed by external packages)\r\nexport * from \"../../ShadersWGSL/ShadersInclude/importanceSampling\";\r\nexport * from \"../../ShadersWGSL/ShadersInclude/pbrBRDFFunctions\";\r\nexport * from \"../../ShadersWGSL/ShadersInclude/hdrFilteringFunctions\";\r\nexport * from \"../../Shaders/ShadersInclude/importanceSampling\";\r\nexport * from \"../../Shaders/ShadersInclude/pbrBRDFFunctions\";\r\nexport * from \"../../Shaders/ShadersInclude/hdrFilteringFunctions\";\r\n\r\n// Intersection & LTC helper functions (needed by external packages)\r\nexport * from \"../../ShadersWGSL/ShadersInclude/clusteredLightingFunctions\";\r\nexport * from \"../../ShadersWGSL/ShadersInclude/intersectionFunctions\";\r\nexport * from \"../../ShadersWGSL/ShadersInclude/ltcHelperFunctions\";\r\nexport * from \"../../Shaders/ShadersInclude/clusteredLightingFunctions\";\r\nexport * from \"../../Shaders/ShadersInclude/intersectionFunctions\";\r\nexport * from \"../../Shaders/ShadersInclude/ltcHelperFunctions\";\r\n"]}
|